@gentbajko/slopify 3.23.0 → 3.25.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/adapter-registry.js +5 -4
- package/dist/adapters/explain.js +2 -1
- package/dist/adapters/host-cli/index.js +1 -1
- package/dist/adapters/host-cli/transport.js +1 -1
- package/dist/adapters/llm/antigravity-models.js +37 -0
- package/dist/adapters/llm/antigravity.js +247 -0
- package/dist/adapters/llm/cli-login-error.js +1 -1
- package/dist/edge/docker-install/run.js +1 -1
- package/dist/edge/docker.js +2 -2
- package/dist/edge/http/studio.js +8 -6
- package/dist/extension/slopify-studio-chrome.zip +0 -0
- package/dist/extension/slopify-studio-firefox.zip +0 -0
- package/dist/host-cli/runtime.js +4 -4
- package/dist/host-cli/status.js +23 -9
- package/dist/patch-notes/3.24.0.md +12 -0
- package/dist/patch-notes/3.25.0.md +11 -0
- package/dist/patch-notes/index.json +12 -0
- package/dist/slices/fixes/rules.js +2 -2
- package/dist/slices/onboarding/quick-short.js +1 -1
- package/dist/slices/rebuild/recipe-build.js +2 -1
- package/dist/slices/rebuild/recipe-exports.js +29 -18
- package/dist/slices/rebuild/recipe-softening.js +37 -0
- package/dist/slices/reviews/model.js +1 -1
- package/dist/slices/run-cost/pricing.js +2 -1
- package/dist/slices/settings/first-run.js +1 -1
- package/dist/slices/settings/health.js +3 -7
- package/dist/slices/settings/model.js +2 -2
- package/dist/slices/settings/models.js +1 -1
- package/dist/tutorials/AI-CLIs.md +21 -8
- package/dist/tutorials/Docker.md +2 -2
- package/dist/tutorials/FAQ.md +2 -2
- package/dist/tutorials/First-Launch-and-Welcome.md +1 -1
- package/dist/tutorials/Home-and-Projects.md +1 -1
- package/dist/tutorials/Home.md +2 -2
- package/dist/tutorials/Install.md +1 -1
- package/dist/tutorials/Providers-and-Keys.md +3 -3
- package/dist/tutorials/Recovery-and-Retries.md +3 -3
- package/dist/tutorials/Troubleshooting.md +8 -4
- package/dist/tutorials/Your-First-Short.md +3 -3
- package/dist/web/assets/{index-D4ikiEys.js → index-D8LqNsCl.js} +6 -6
- package/dist/web/assets/{pdf-DSYcdduN.js → pdf-T7MCwjIv.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -2
- package/dist/adapters/llm/gemini-models.js +0 -127
- package/dist/adapters/llm/gemini-workspace.js +0 -135
- package/dist/adapters/llm/gemini.js +0 -168
- package/dist/host-cli/gemini-login.js +0 -83
|
@@ -47,7 +47,7 @@ Error generating stack: `+e.message+`
|
|
|
47
47
|
`},vm=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},nee=function(){m.useEffect(function(){return document.body.setAttribute(_m,(vm()+1).toString()),function(){var e=vm()-1;e<=0?document.body.removeAttribute(_m):document.body.setAttribute(_m,e.toString())}},[])},ree=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;nee();var a=m.useMemo(function(){return gm(i)},[i]);return m.createElement(eee,{styles:tee(a,!t,i,n?``:`!important`)})},ym=!1;if(typeof window<`u`)try{var bm=Object.defineProperty({},"passive",{get:function(){return ym=!0,!0}});window.addEventListener(`test`,bm,bm),window.removeEventListener(`test`,bm,bm)}catch{ym=!1}var xm=ym?{passive:!1}:!1,iee=function(e){return e.tagName===`TEXTAREA`},Sm=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!iee(e)&&n[t]===`visible`)},aee=function(e){return Sm(e,`overflowY`)},oee=function(e){return Sm(e,`overflowX`)},Cm=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),wm(e,r)){var i=Tm(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},see=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},cee=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},wm=function(e,t){return e===`v`?aee(t):oee(t)},Tm=function(e,t){return e===`v`?see(t):cee(t)},lee=function(e,t){return e===`h`&&t===`rtl`?-1:1},uee=function(e,t,n,r,i){var a=lee(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=Tm(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&wm(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},Em=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Dm=function(e){return[e.deltaX,e.deltaY]},Om=function(e){return e&&`current`in e?e.current:e},dee=function(e,t){return e[0]===t[0]&&e[1]===t[1]},fee=function(e){return`
|
|
48
48
|
.block-interactivity-${e} {pointer-events: none;}
|
|
49
49
|
.allow-interactivity-${e} {pointer-events: all;}
|
|
50
|
-
`},pee=0,km=[];function mee(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),i=m.useState(pee++)[0],a=m.useState(fm)[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=Hp([e.lockRef.current],(e.shards||[]).map(Om),!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=Em(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=Cm(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Cm(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 uee(h,t,e,h===`h`?s:c,!0)},[]),c=m.useCallback(function(e){var n=e;if(km.length&&km[km.length-1]===a){var r=`deltaY`in n?Dm(n):Em(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&dee(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Om).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:hee(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=Em(e),r.current=void 0},[]),d=m.useCallback(function(t){l(t.type,Dm(t),t.target,s(t,e.lockRef.current))},[]),f=m.useCallback(function(t){l(t.type,Em(t),t.target,s(t,e.lockRef.current))},[]);m.useEffect(function(){return km.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,xm),document.addEventListener(`touchmove`,c,xm),document.addEventListener(`touchstart`,u,xm),function(){km=km.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,xm),document.removeEventListener(`touchmove`,c,xm),document.removeEventListener(`touchstart`,u,xm)}},[]);var p=e.removeScrollBar,h=e.inert;return m.createElement(m.Fragment,null,h?m.createElement(a,{styles:fee(i)}):null,p?m.createElement(ree,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function hee(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var gee=nm(rm,mee),Am=m.forwardRef(function(e,t){return m.createElement(am,Bp({},e,{ref:t,sideCar:gee}))});Am.classNames=am.classNames;var _ee=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},jm=new WeakMap,Mm=new WeakMap,Nm={},Pm=0,Fm=function(e){return e&&(e.host||Fm(e.parentNode))},vee=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Fm(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})},yee=function(e,t,n,r){var i=vee(t,Array.isArray(e)?e:[e]);Nm[n]||(Nm[n]=new WeakMap);var a=Nm[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=(jm.get(e)||0)+1,l=(a.get(e)||0)+1;jm.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Mm.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(),Pm++,function(){o.forEach(function(e){var t=jm.get(e)-1,i=a.get(e)-1;jm.set(e,t),a.set(e,i),t||(Mm.has(e)||e.removeAttribute(r),Mm.delete(e)),i||e.removeAttribute(n)}),Pm--,Pm||(jm=new WeakMap,jm=new WeakMap,Mm=new WeakMap,Nm={})}},Im=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||_ee(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),yee(r,i,n,`aria-hidden`)):function(){return null}},bee=Object.defineProperty,Lm=(e,t)=>bee(e,`name`,{value:t,configurable:!0}),Rm=`Dialog`,[zm,xee]=Yd(Rm),[Bm,Vm]=zm(Rm),Hm=Lm(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]=Of({prop:r,defaultProp:i??!1,onChange:a,caller:Rm}),[d,f]=m.useState(0),[p,g]=m.useState(0);return(0,h.jsx)(Bm,{scope:t,triggerRef:s,contentRef:c,contentId:Kf(),titleId:Kf(),descriptionId:Kf(),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`),Um=`DialogPortal`,[Wm,Gm]=zm(Um,{forceMount:void 0}),Km=Lm(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Vm(Um,t);return(0,h.jsx)(Wm,{scope:t,forceMount:n,children:m.Children.map(r,e=>(0,h.jsx)(If,{present:n||a.open,children:(0,h.jsx)(Mp,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),qm=`DialogOverlay`,Jm=m.forwardRef(Lm(function(e,t){let n=Gm(qm,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Vm(qm,e.__scopeDialog);return a.modal?(0,h.jsx)(If,{present:r||a.open,children:(0,h.jsx)(Xm,{...i,ref:t})}):null},`DialogOverlay`)),Ym=Dd(`DialogOverlay.RemoveScroll`),Xm=m.forwardRef(Lm(function(e,t){let{__scopeDialog:n,...r}=e,i=Vm(qm,n),a=wd(t,cp());return(0,h.jsx)(Am,{as:Ym,allowPinchZoom:!0,shards:[i.contentRef],children:(0,h.jsx)(Wd.div,{"data-state":th(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Zm=`DialogContent`,Qm=m.forwardRef(Lm(function(e,t){let n=Gm(Zm,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Vm(Zm,e.__scopeDialog);return(0,h.jsx)(If,{present:r||a.open,children:a.modal?(0,h.jsx)(See,{...i,ref:t}):(0,h.jsx)(Cee,{...i,ref:t})})},`DialogContent`)),See=m.forwardRef(Lm(function(e,t){let n=Vm(Zm,e.__scopeDialog),r=m.useRef(null),i=wd(t,n.contentRef,r);return m.useEffect(()=>{let e=r.current;if(e)return Im(e)},[]),(0,h.jsx)($m,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:mf(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:mf(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:mf(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Cee=m.forwardRef(Lm(function(e,t){let n=Vm(Zm,e.__scopeDialog),r=m.useRef(!1),i=m.useRef(!1);return(0,h.jsx)($m,{...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`)),$m=m.forwardRef(Lm(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Vm(Zm,n);return Rp(),(0,h.jsx)(h.Fragment,{children:(0,h.jsx)(yp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,h.jsx)(sp,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":th(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),wee=`DialogTitle`,eh=m.forwardRef(Lm(function(e,t){let{__scopeDialog:n,...r}=e,i=Vm(wee,n),{setTitleCount:a}=i;return yf(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,h.jsx)(Wd.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),Tee=`DialogDescription`,Eee=m.forwardRef(Lm(function(e,t){let{__scopeDialog:n,...r}=e,i=Vm(Tee,n),{setDescriptionCount:a}=i;return yf(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,h.jsx)(Wd.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),Dee=`DialogClose`,Oee=m.forwardRef(Lm(function(e,t){let{__scopeDialog:n,...r}=e,i=Vm(Dee,n);return(0,h.jsx)(Wd.button,{type:`button`,...r,ref:t,onClick:mf(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function th(e){return e?`open`:`closed`}Lm(th,`getState`);var kee=Object.defineProperty,Aee=(e,t)=>kee(e,`name`,{value:t,configurable:!0});function nh(e){let[t,n]=m.useState(void 0);return yf(()=>{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}Aee(nh,`useSize`);var jee=[`top`,`right`,`bottom`,`left`],rh=Math.min,ih=Math.max,ah=Math.round,oh=Math.floor,sh=e=>({x:e,y:e}),Mee={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function ch(e,t,n){return ih(e,rh(t,n))}function lh(e,t){return typeof e==`function`?e(t):e}function uh(e){return e.split(`-`)[0]}function dh(e){return e.split(`-`)[1]}function fh(e){return e===`x`?`y`:`x`}function ph(e){return e===`y`?`height`:`width`}function mh(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function hh(e){return fh(mh(e))}function Nee(e,t,n){n===void 0&&(n=!1);let r=dh(e),i=hh(e),a=ph(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=xh(o)),[o,xh(o)]}function Pee(e){let t=xh(e);return[gh(e),t,gh(t)]}function gh(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var _h=[`left`,`right`],vh=[`right`,`left`],Fee=[`top`,`bottom`],Iee=[`bottom`,`top`];function yh(e,t,n){switch(e){case`top`:case`bottom`:return n?t?vh:_h:t?_h:vh;case`left`:case`right`:return t?Fee:Iee;default:return[]}}function bh(e,t,n,r){let i=dh(e),a=yh(uh(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(gh)))),a}function xh(e){let t=uh(e);return Mee[t]+e.slice(t.length)}function Sh(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Ch(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Sh(e)}function wh(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 Th(e,t,n){let{reference:r,floating:i}=e,a=mh(t),o=hh(t),s=ph(o),c=uh(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=dh(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Eh(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}=lh(t,e),p=Ch(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=wh(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=wh(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 Dh=50,Oh=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Eh},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Th(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<Dh&&(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}=Th(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},kh=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}=lh(e,t)||{};if(l==null)return{};let d=Ch(u),f={x:n,y:r},p=hh(i),m=ph(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=rh(d[_],T),D=rh(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=ch(E,k,O),j=!c.arrow&&dh(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),Ah=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}=lh(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=uh(r),_=mh(o),v=uh(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[xh(o)]:Pee(o)),x=p!==`none`;!d&&x&&b.push(...bh(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=Nee(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`||_===mh(t)||T.every(e=>mh(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=mh(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 jh(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Mh(e){return jee.some(t=>e[t]>=0)}var Nh=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=lh(e,t);switch(i){case`referenceHidden`:{let e=jh(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Mh(e)}}}case`escaped`:{let e=jh(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Mh(e)}}}default:return{}}}}},Ph=new Set([`left`,`top`]);async function Fh(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=uh(n),s=dh(n),c=mh(n)===`y`,l=Ph.has(o)?-1:1,u=a&&c?-1:1,d=lh(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 Ih=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 Fh(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}}}}},Lh=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}=lh(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=mh(i),p=fh(f),m=u[p],h=u[f],g=(e,t)=>ch(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}}}}}},Rh=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}=lh(e,t),u={x:n,y:r},d=mh(i),f=fh(d),p=u[f],m=u[d],h=lh(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=Ph.has(uh(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}}}},zh=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}=lh(e,t),c=await i.detectOverflow(t,s),l=uh(n),u=dh(n),d=mh(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=rh(p-c[m],g),y=rh(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*ih(c.left,c.right):S=p-2*ih(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 Bh(){return typeof window<`u`}function Vh(e){return Wh(e)?(e.nodeName||``).toLowerCase():`#document`}function Hh(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Uh(e){return((Wh(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Wh(e){return Bh()?e instanceof Node||e instanceof Hh(e).Node:!1}function Gh(e){return Bh()?e instanceof Element||e instanceof Hh(e).Element:!1}function Kh(e){return Bh()?e instanceof HTMLElement||e instanceof Hh(e).HTMLElement:!1}function qh(e){return!Bh()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Hh(e).ShadowRoot}function Jh(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=ag(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Yh(e){return/^(table|td|th)$/.test(Vh(e))}function Xh(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Zh=/transform|translate|scale|rotate|perspective|filter/,Qh=/paint|layout|strict|content/,$h=e=>!!e&&e!==`none`,eg;function tg(e){let t=Gh(e)?ag(e):e;return $h(t.transform)||$h(t.translate)||$h(t.scale)||$h(t.rotate)||$h(t.perspective)||!rg()&&($h(t.backdropFilter)||$h(t.filter))||Zh.test(t.willChange||``)||Qh.test(t.contain||``)}function ng(e){let t=sg(e);for(;Kh(t)&&!ig(t);){if(tg(t))return t;if(Xh(t))return null;t=sg(t)}return null}function rg(){return eg??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),eg}function ig(e){return/^(html|body|#document)$/.test(Vh(e))}function ag(e){return Hh(e).getComputedStyle(e)}function og(e){return Gh(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function sg(e){if(Vh(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||qh(e)&&e.host||Uh(e);return qh(t)?t.host:t}function cg(e){let t=sg(e);return ig(t)?(e.ownerDocument||e).body:Kh(t)&&Jh(t)?t:cg(t)}function lg(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=cg(e),i=r===e.ownerDocument?.body,a=Hh(r);if(i){let e=ug(a);return t.concat(a,a.visualViewport||[],Jh(r)?r:[],e&&n?lg(e):[])}return t.concat(r,lg(r,[],n))}function ug(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function dg(e){let t=ag(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Kh(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ah(n)!==a||ah(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function fg(e){return Gh(e)?e:e.contextElement}function pg(e){let t=fg(e);if(!Kh(t))return sh(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=dg(t),o=(a?ah(n.width):n.width)/r,s=(a?ah(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var mg=sh(0);function hg(e){let t=Hh(e);return!rg()||!t.visualViewport?mg:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function gg(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Hh(e)}function _g(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=fg(e),o=sh(1);t&&(r?Gh(r)&&(o=pg(r)):o=pg(e));let s=gg(a,n,r)?hg(a):sh(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=Hh(a),t=Gh(r)?Hh(r):r,n=e,i=ug(n);for(;i&&t!==n;){let e=pg(i),t=i.getBoundingClientRect(),r=ag(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=Hh(i),i=ug(n)}}return wh({width:u,height:d,x:c,y:l})}function vg(e,t){let n=og(e).scrollLeft;return t?t.left+n:_g(Uh(e)).left+n}function yg(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-vg(e,n),y:n.top+t.scrollTop}}function Lee(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Uh(r),s=t?Xh(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=sh(1),u=sh(0),d=Kh(r);if((d||!a)&&((Vh(r)!==`body`||Jh(o))&&(c=og(r)),d)){let e=_g(r);l=pg(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?yg(o,c):sh(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 Ree(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function zee(e){let t=og(e),n=e.ownerDocument.body,r=ih(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=ih(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+vg(e),o=-t.scrollTop;return ag(n).direction===`rtl`&&(a+=ih(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Bee=25;function Vee(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Hh(e),a=Uh(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!rg()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(vg(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<=Bee&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Hee(e,t){let n=_g(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=pg(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function bg(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Vee(e,n,t);else if(t===`document`)r=zee(Uh(e));else if(Gh(t))r=Hee(t,n);else{let n=hg(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return wh(r)}function Uee(e,t){let n=t.get(e);if(n)return n;let r=lg(e,[],!1).filter(e=>Gh(e)&&Vh(e)!==`body`),i=null,a=ag(e).position===`fixed`,o=a?sg(e):e;for(;Gh(o)&&!ig(o);){let e=ag(o),t=tg(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=sg(o)}return t.set(e,r),r}function Wee(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Xh(t)?[]:Uee(t,this._c):[].concat(n),r],o=bg(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=bg(t,a[e],i);s=ih(n.top,s),c=rh(n.right,c),l=rh(n.bottom,l),u=ih(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Gee(e){let{width:t,height:n}=dg(e);return{width:t,height:n}}function Kee(e,t,n){let r=Kh(t),i=Uh(t),a=n===`fixed`,o=_g(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=sh(0);if((r||!a)&&((Vh(t)!==`body`||Jh(i))&&(s=og(t)),r)){let e=_g(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=vg(i));let l=i&&!r&&!a?yg(i,s):sh(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 ag(e).position===`static`}function Sg(e,t){if(!Kh(e)||ag(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Uh(e)===n&&(n=n.ownerDocument.body),n}function Cg(e,t){let n=Hh(e);if(Xh(e))return n;if(!Kh(e)){let t=sg(e);for(;t&&!ig(t);){if(Gh(t)&&!xg(t))return t;t=sg(t)}return n}let r=Sg(e,t);for(;r&&Yh(r)&&xg(r);)r=Sg(r,t);return r&&ig(r)&&xg(r)&&!tg(r)?n:r||ng(e)||n}var qee=async function(e){let t=this.getOffsetParent||Cg,n=this.getDimensions,r=await n(e.floating);return{reference:Kee(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Jee(e){return ag(e).direction===`rtl`}var Yee={convertOffsetParentRelativeRectToViewportRelativeRect:Lee,getDocumentElement:Uh,getClippingRect:Wee,getOffsetParent:Cg,getElementRects:qee,getClientRects:Ree,getDimensions:Gee,getScale:pg,isElement:Gh,isRTL:Jee};function wg(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Xee(e,t,n){let r=null,i,a=Uh(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=oh(d),h=oh(a.clientWidth-(u+f)),g=oh(a.clientHeight-(d+p)),_=oh(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:ih(0,rh(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!wg(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=Hh(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Zee(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=fg(e),u=i||a?[...l?lg(l):[],...t?lg(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Xee(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?_g(e):null;c&&g();function g(){let t=_g(e);h&&!wg(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 Qee=Ih,$ee=Lh,ete=Ah,tte=zh,nte=Nh,Tg=kh,rte=Rh,ite=(e,t,n)=>{let r=new Map,i=n??{},a={...Yee,...i.platform,_c:r};return Oh(e,t,{...i,platform:a})},Eg=typeof document<`u`?m.useLayoutEffect:function(){};function Dg(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(!Dg(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)&&!Dg(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Og(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function kg(e,t){let n=Og(e);return Math.round(t*n)/n}function Ag(e){let t=m.useRef(e);return Eg(()=>{t.current=e}),t}function ate(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);Dg(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=Ag(c),O=Ag(i),k=Ag(l),A=m.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),ite(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!Dg(T.current,t)&&(T.current=t,Vd.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Eg(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=m.useRef(!1);Eg(()=>(j.current=!0,()=>{j.current=!1}),[]),Eg(()=>{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 M=m.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),N=m.useMemo(()=>({reference:x,floating:S}),[x,S]),P=m.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=kg(N.floating,u.x),r=kg(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Og(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return m.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var ote=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?{}:Tg({element:r.current,padding:i}).fn(n):r?Tg({element:r,padding:i}).fn(n):{}}}},ste=(e,t)=>{let n=Qee(e);return{name:n.name,fn:n.fn,options:[e,t]}},cte=(e,t)=>{let n=$ee(e);return{name:n.name,fn:n.fn,options:[e,t]}},lte=(e,t)=>({fn:rte(e).fn,options:[e,t]}),ute=(e,t)=>{let n=ete(e);return{name:n.name,fn:n.fn,options:[e,t]}},dte=(e,t)=>{let n=tte(e);return{name:n.name,fn:n.fn,options:[e,t]}},fte=(e,t)=>{let n=nte(e);return{name:n.name,fn:n.fn,options:[e,t]}},pte=(e,t)=>{let n=ote(e);return{name:n.name,fn:n.fn,options:[e,t]}},mte=Object.defineProperty,jg=(e,t)=>mte(e,`name`,{value:t,configurable:!0}),Mg=`Popper`,[Ng,Pg]=Yd(Mg),[hte,Fg]=Ng(Mg),gte=jg(e=>{let{__scopePopper:t,children:n}=e,[r,i]=m.useState(null),[a,o]=m.useState(void 0);return(0,h.jsx)(hte,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),_te=`PopperAnchor`,vte=m.forwardRef(jg(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=Fg(_te,n),o=m.useRef(null),s=a.onAnchorChange,c=wd(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&&Rg(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,h.jsx)(Wd.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),Ig=`PopperContent`,[yte,bte]=Ng(Ig),xte=m.forwardRef(jg(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=Fg(Ig,n),[y,b]=m.useState(null),x=wd(t,b),[S,C]=m.useState(null),w=nh(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,j={padding:O,boundary:k.filter(Lg),altBoundary:A},{refs:M,floatingStyles:N,placement:P,isPositioned:ee,middlewareData:F}=ate({strategy:`fixed`,placement:D,whileElementsMounted:jg((...e)=>Zee(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:v.anchor},middleware:[ste({mainAxis:i+E,alignmentAxis:o}),c&&cte({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?lte():void 0,...j}),c&&ute({...j}),dte({...j,apply:jg(({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&&pte({element:S,padding:s}),Ste({arrowWidth:T,arrowHeight:E}),f&&fte({strategy:`referenceHidden`,...j,boundary:A?j.boundary:void 0})]}),te=v.setPlacementState;yf(()=>(te(P),()=>{te(void 0)}),[P,te]);let[ne,re]=Rg(P),ie=$f(g);yf(()=>{ee&&ie?.()},[ee,ie]);let ae=F.arrow?.x,oe=F.arrow?.y,se=F.arrow?.centerOffset!==0,[ce,le]=m.useState();return yf(()=>{y&&le(window.getComputedStyle(y).zIndex)},[y]),(0,h.jsx)(`div`,{ref:M.setFloating,"data-radix-popper-content-wrapper":``,style:{...N,transform:ee?N.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ce,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,h.jsx)(yte,{scope:n,placedSide:ne,placedAlign:re,onArrowChange:C,arrowX:ae,arrowY:oe,shouldHideArrow:se,children:(0,h.jsx)(Wd.div,{"data-side":ne,"data-align":re,..._,ref:x,style:{..._.style,animation:ee?_.style?.animation:`none`}})})})},`PopperContent`));function Lg(e){return e!==null}jg(Lg,`isNotNull`);var Ste=jg(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]=Rg(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 Rg(e){let[t,n=`center`]=e.split(`-`);return[t,n]}jg(Rg,`getSideAndAlignFromPlacement`);var zg=gte,Bg=vte,Vg=xte,Cte=Object.defineProperty,Hg=(e,t)=>Cte(e,`name`,{value:t,configurable:!0}),Ug=!1;function Wg(){let[e,t]=m.useState(Ug);return m.useEffect(()=>{Ug||(Ug=!0,t(!0))},[]),e}Hg(Wg,`useIsHydrated`);var Gg=m.useSyncExternalStore;function Kg(){return()=>{}}Hg(Kg,`subscribe`);function qg(){return Gg(Kg,()=>!0,()=>!1)}Hg(qg,`useIsHydratedModern`);var wte=typeof Gg==`function`?qg:Wg,Tte=Object.defineProperty,Jg=(e,t)=>Tte(e,`name`,{value:t,configurable:!0}),Yg=`rovingFocusGroup.onEntryFocus`,Ete={bubbles:!1,cancelable:!0},Xg=`RovingFocusGroup`,[Zg,Qg,Dte]=$d(Xg),[Ote,$g]=Yd(Xg,[Dte]),[kte,Ate]=Ote(Xg),jte=m.forwardRef(Jg(function(e,t){return(0,h.jsx)(Zg.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,h.jsx)(Zg.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,h.jsx)(Mte,{...e,ref:t})})})},`RovingFocusGroup`)),Mte=m.forwardRef(Jg(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=wd(t,f),g=Xf(a),[_,v]=Of({prop:o,defaultProp:s??null,onChange:c,caller:Xg}),[y,b]=m.useState(!1),x=$f(l),S=Qg(n),C=m.useRef(!1),[w,T]=m.useState(0);return m.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Yg,x),()=>e.removeEventListener(Yg,x)},[x]),(0,h.jsx)(kte,{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)(Wd.div,{tabIndex:y||w===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:mf(e.onMouseDown,()=>{C.current=!0}),onFocus:mf(e.onFocus,e=>{let t=!C.current;if(e.target===e.currentTarget&&t&&!y){let t=new CustomEvent(Yg,Ete);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=S().filter(e=>e.focusable);n_([e.find(e=>e.active),e.find(e=>e.id===_),...e].filter(Boolean).map(e=>e.ref.current),u)}}C.current=!1}),onBlur:mf(e.onBlur,()=>b(!1))})})},`RovingFocusGroupImpl`)),Nte=`RovingFocusGroupItem`,Pte=m.forwardRef(Jg(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Kf(),l=a||c,u=Ate(Nte,n),d=u.currentTabStopId===l,f=Qg(n),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:_}=u,v=wte();return yf(()=>{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)(Zg.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,h.jsx)(Wd.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:mf(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:mf(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:mf(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=t_(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?r_(n,r+1):n.slice(r+1)}setTimeout(()=>n_(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:_!=null}):o})})},`RovingFocusGroupItem`)),Fte={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function e_(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}Jg(e_,`getDirectionAwareKey`);function t_(e,t,n){let r=e_(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Fte[r]}Jg(t_,`getFocusIntent`);function n_(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}Jg(n_,`focusFirst`);function r_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Jg(r_,`wrapArray`);var i_=jte,a_=Pte,Ite=Object.defineProperty,o_=(e,t)=>Ite(e,`name`,{value:t,configurable:!0}),s_=[`Enter`,` `],Lte=[`ArrowDown`,`PageUp`,`Home`],c_=[`ArrowUp`,`PageDown`,`End`],Rte=[...Lte,...c_];[...s_],[...s_];var l_=`Menu`,[u_,zte,Bte]=$d(l_),[d_,f_]=Yd(l_,[Bte,Pg,$g]),p_=Pg(),m_=$g(),[Vte,h_]=d_(l_),[Hte,g_]=d_(l_),Ute=o_(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=p_(t),[c,l]=m.useState(null),u=m.useRef(!1),d=$f(a),f=Xf(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)(zg,{...s,children:(0,h.jsx)(Vte,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,h.jsx)(Hte,{scope:t,onClose:m.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),Wte=m.forwardRef(o_(function(e,t){let{__scopeMenu:n,...r}=e,i=p_(n);return(0,h.jsx)(Bg,{...i,...r,ref:t})},`MenuAnchor`)),__=`MenuPortal`,[Gte,Kte]=d_(__,{forceMount:void 0}),qte=o_(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=h_(__,t);return(0,h.jsx)(Gte,{scope:t,forceMount:n,children:(0,h.jsx)(If,{present:n||a.open,children:(0,h.jsx)(Mp,{asChild:!0,container:i,children:r})})})},`MenuPortal`),v_=`MenuContent`,[Jte,y_]=d_(v_),Yte=m.forwardRef(o_(function(e,t){let n=Kte(v_,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=h_(v_,e.__scopeMenu),o=g_(v_,e.__scopeMenu);return(0,h.jsx)(u_.Provider,{scope:e.__scopeMenu,children:(0,h.jsx)(If,{present:r||a.open,children:(0,h.jsx)(u_.Slot,{scope:e.__scopeMenu,children:o.modal?(0,h.jsx)(Xte,{...i,ref:t}):(0,h.jsx)(Zte,{...i,ref:t})})})})},`MenuContent`)),Xte=m.forwardRef(o_(function(e,t){let n=h_(v_,e.__scopeMenu),r=m.useRef(null),i=wd(t,r);return m.useEffect(()=>{let e=r.current;if(e)return Im(e)},[]),(0,h.jsx)(b_,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:mf(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),Zte=m.forwardRef(o_(function(e,t){let n=h_(v_,e.__scopeMenu);return(0,h.jsx)(b_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),Qte=Dd(`MenuContent.ScrollLock`),b_=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=h_(v_,n),y=g_(v_,n),b=p_(n),x=m_(n),S=zte(n),[C,w]=m.useState(null),T=m.useRef(null),E=wd(t,T,v.onContentChange),D=m.useRef(0),O=m.useRef(``),k=m.useRef(0),A=m.useRef(null),j=m.useRef(`right`),M=m.useRef(0),N=g?Am:m.Fragment,P=g?{as:Qte,allowPinchZoom:!0}:void 0,ee=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=D_(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),[]),Rp();let F=m.useCallback(e=>j.current===A.current?.side&&k_(e,A.current?.area),[]);return(0,h.jsx)(Jte,{scope:n,searchRef:O,onItemEnter:m.useCallback(e=>{F(e)&&e.preventDefault()},[F]),onItemLeave:m.useCallback(e=>{F(e)||(T.current?.focus(),w(null))},[F]),onTriggerLeave:m.useCallback(e=>{F(e)&&e.preventDefault()},[F]),pointerGraceTimerRef:k,onPointerGraceIntentChange:m.useCallback(e=>{A.current=e},[]),children:(0,h.jsx)(N,{...P,children:(0,h.jsx)(yp,{asChild:!0,trapped:i,onMountAutoFocus:mf(a,e=>{e.preventDefault(),T.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,h.jsx)(sp,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,h.jsx)(i_,{asChild:!0,...x,dir:y.dir,orientation:`vertical`,loop:r,currentTabStopId:C,onCurrentTabStopIdChange:w,onEntryFocus:mf(c,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,h.jsx)(Vg,{role:`menu`,"aria-orientation":`vertical`,"data-state":C_(v.open),"data-radix-menu-content":``,dir:y.dir,...b,..._,ref:E,style:{outline:`none`,..._.style},onKeyDown:mf(_.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&&ee(e.key));let i=T.current;if(e.target!==i||!Rte.includes(e.key))return;e.preventDefault();let a=S().filter(e=>!e.disabled).map(e=>e.ref.current);c_.includes(e.key)&&a.reverse(),T_(a)}),onBlur:mf(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(D.current),O.current=``)}),onPointerMove:mf(e.onPointerMove,A_(e=>{let t=e.target,n=M.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>M.current?`right`:`left`;j.current=t,M.current=e.clientX}}))})})})})})})},`MenuContentImpl`)),x_=`MenuItem`,S_=`menu.itemSelect`,$te=m.forwardRef(o_(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=m.useRef(null),o=g_(x_,e.__scopeMenu),s=y_(x_,e.__scopeMenu),c=wd(t,a),l=m.useRef(!1),u=o_(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(S_,{bubbles:!0,cancelable:!0});e.addEventListener(S_,e=>r?.(e),{once:!0}),Gd(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,h.jsx)(ene,{...i,ref:c,disabled:n,onClick:mf(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:mf(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:mf(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&s_.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),ene=m.forwardRef(o_(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=y_(x_,n),s=m_(n),c=m.useRef(null),l=wd(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)(u_.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,h.jsx)(a_,{asChild:!0,...s,focusable:!r,children:(0,h.jsx)(Wd.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:mf(e.onPointerMove,A_(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:mf(e.onPointerLeave,A_(e=>o.onItemLeave(e))),onFocus:mf(e.onFocus,()=>d(!0)),onBlur:mf(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),[tne,nne]=d_(`MenuRadioGroup`,{value:void 0,onValueChange:o_(()=>{},`onValueChange`)}),[rne,ine]=d_(`MenuItemIndicator`,{checked:!1}),ane=m.forwardRef(o_(function(e,t){let{__scopeMenu:n,...r}=e;return(0,h.jsx)(Wd.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),[one,sne]=d_(`MenuSub`);function C_(e){return e?`open`:`closed`}o_(C_,`getOpenState`);function w_(e){return e===`indeterminate`}o_(w_,`isIndeterminate`);function cne(e){return w_(e)?`indeterminate`:e?`checked`:`unchecked`}o_(cne,`getCheckedState`);function T_(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}o_(T_,`focusFirst`);function E_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}o_(E_,`wrapArray`);function D_(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=E_(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_(D_,`getNextMatch`);function O_(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_(O_,`isPointInPolygon`);function k_(e,t){return t?O_({x:e.clientX,y:e.clientY},t):!1}o_(k_,`isPointerInGraceArea`);function A_(e){return t=>t.pointerType===`mouse`?e(t):void 0}o_(A_,`whenMouse`);var lne=Ute,une=Wte,dne=qte,fne=Yte,pne=$te,mne=ane,hne=Object.defineProperty,j_=(e,t)=>hne(e,`name`,{value:t,configurable:!0}),M_=`DropdownMenu`,[gne,_ne]=Yd(M_,[f_]),N_=f_(),[P_,F_]=gne(M_),I_=j_(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=N_(t),l=m.useRef(null),[u,d]=Of({prop:i,defaultProp:a??!1,onChange:o,caller:M_});return(0,h.jsx)(P_,{scope:t,triggerId:Kf(),triggerRef:l,contentId:Kf(),open:u,onOpenChange:d,onOpenToggle:m.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,h.jsx)(lne,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),L_=`DropdownMenuTrigger`,R_=m.forwardRef(j_(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=F_(L_,n),o=N_(n),s=wd(t,a.triggerRef);return(0,h.jsx)(une,{asChild:!0,...o,children:(0,h.jsx)(Wd.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:mf(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:mf(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),z_=j_(e=>{let{__scopeDropdownMenu:t,...n}=e,r=N_(t);return(0,h.jsx)(dne,{...r,...n})},`DropdownMenuPortal`),vne=`DropdownMenuContent`,yne=m.forwardRef(j_(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=F_(vne,n),a=N_(n),o=m.useRef(!1);return(0,h.jsx)(fne,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:mf(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:mf(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`)),bne=m.forwardRef(j_(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=N_(n);return(0,h.jsx)(pne,{...i,...r,ref:t})},`DropdownMenuItem`)),xne=m.forwardRef(j_(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=N_(n);return(0,h.jsx)(mne,{...i,...r,ref:t})},`DropdownMenuSeparator`)),Sne=I_,Cne=R_,wne=z_,Tne=yne,Ene=bne,Dne=xne,One=Object.defineProperty,kne=m.forwardRef(((e,t)=>One(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,h.jsx)(Wd.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),Ane=Object.defineProperty,B_=(e,t)=>Ane(e,`name`,{value:t,configurable:!0}),V_=`Popover`,[H_,jne]=Yd(V_,[Pg]),U_=Pg(),[Mne,W_]=H_(V_),G_=B_(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=U_(t),c=m.useRef(null),[l,u]=m.useState(!1),[d,f]=Of({prop:r,defaultProp:i??!1,onChange:a,caller:V_});return(0,h.jsx)(zg,{...s,children:(0,h.jsx)(Mne,{scope:t,contentId:Kf(),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`),K_=`PopoverAnchor`,q_=m.forwardRef(B_(function(e,t){let{__scopePopover:n,...r}=e,i=W_(K_,n),a=U_(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return m.useEffect(()=>(o(),()=>s()),[o,s]),(0,h.jsx)(Bg,{...a,...r,ref:t})},`PopoverAnchor`)),J_=`PopoverTrigger`,Y_=m.forwardRef(B_(function(e,t){let{__scopePopover:n,...r}=e,i=W_(J_,n),a=U_(n),o=wd(t,i.triggerRef),s=(0,h.jsx)(Wd.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":cv(i.open),...r,ref:o,onClick:mf(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,h.jsx)(Bg,{asChild:!0,...a,children:s})},`PopoverTrigger`)),X_=`PopoverPortal`,[Z_,Q_]=H_(X_,{forceMount:void 0}),$_=B_(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=W_(X_,t);return(0,h.jsx)(Z_,{scope:t,forceMount:n,children:(0,h.jsx)(If,{present:n||a.open,children:(0,h.jsx)(Mp,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),ev=`PopoverContent`,tv=m.forwardRef(B_(function(e,t){let n=Q_(ev,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=W_(ev,e.__scopePopover);return(0,h.jsx)(If,{present:r||a.open,children:a.modal?(0,h.jsx)(rv,{...i,ref:t}):(0,h.jsx)(iv,{...i,ref:t})})},`PopoverContent`)),nv=Dd(`PopoverContent.RemoveScroll`),rv=m.forwardRef(B_(function(e,t){let n=W_(ev,e.__scopePopover),r=m.useRef(null),i=wd(t,r),a=m.useRef(!1);return m.useEffect(()=>{let e=r.current;if(e)return Im(e)},[]),(0,h.jsx)(Am,{as:nv,allowPinchZoom:!0,children:(0,h.jsx)(av,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:mf(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:mf(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:mf(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),iv=m.forwardRef(B_(function(e,t){let n=W_(ev,e.__scopePopover),r=m.useRef(!1),i=m.useRef(!1);return(0,h.jsx)(av,{...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`)),av=m.forwardRef(B_(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=W_(ev,n),p=U_(n);return Rp(),(0,h.jsx)(yp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,h.jsx)(sp,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,h.jsx)(Vg,{"data-state":cv(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`)),ov=`PopoverClose`,sv=m.forwardRef(B_(function(e,t){let{__scopePopover:n,...r}=e,i=W_(ov,n);return(0,h.jsx)(Wd.button,{type:`button`,...r,ref:t,onClick:mf(e.onClick,()=>i.onOpenChange(!1))})},`PopoverClose`));function cv(e){return e?`open`:`closed`}B_(cv,`getState`);var lv=G_,Nne=q_,Pne=Y_,Fne=$_,Ine=tv,Lne=sv,Rne=Object.defineProperty,zne=(e,t)=>Rne(e,`name`,{value:t,configurable:!0}),Bne=`Toggle`,Vne=m.forwardRef(zne(function(e,t){let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=Of({prop:n,onChange:i,defaultProp:r??!1,caller:Bne});return(0,h.jsx)(Wd.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:mf(e.onClick,()=>{e.disabled||s(!o)})})},`Toggle`)),Hne=Object.defineProperty,uv=(e,t)=>Hne(e,`name`,{value:t,configurable:!0}),dv=`ToggleGroup`,[fv,Une]=Yd(dv,[$g]),pv=$g(),Wne=m.forwardRef(uv(function(e,t){let{type:n,...r}=e;if(n===`single`)return(0,h.jsx)(Gne,{role:`radiogroup`,...r,ref:t});if(n===`multiple`)return(0,h.jsx)(Kne,{role:`toolbar`,...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${dv}\``)},`ToggleGroup`)),[mv,hv]=fv(dv),Gne=m.forwardRef(uv(function(e,t){let{value:n,defaultValue:r,onValueChange:i=uv(()=>{},`onValueChange`),...a}=e,[o,s]=Of({prop:n,defaultProp:r??``,onChange:i,caller:dv});return(0,h.jsx)(mv,{scope:e.__scopeToggleGroup,type:`single`,value:m.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:m.useCallback(()=>s(``),[s]),children:(0,h.jsx)(gv,{...a,ref:t})})},`ToggleGroupImplSingle`)),Kne=m.forwardRef(uv(function(e,t){let{value:n,defaultValue:r,onValueChange:i=uv(()=>{},`onValueChange`),...a}=e,[o,s]=Of({prop:n,defaultProp:r??[],onChange:i,caller:dv}),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)(mv,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,h.jsx)(gv,{...a,ref:t})})},`ToggleGroupImplMultiple`)),[qne,Jne]=fv(dv),gv=m.forwardRef(uv(function(e,t){let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=pv(n),u=Xf(o),d={dir:u,...c};return(0,h.jsx)(qne,{scope:n,rovingFocus:i,disabled:r,children:i?(0,h.jsx)(i_,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,h.jsx)(Wd.div,{...d,ref:t})}):(0,h.jsx)(Wd.div,{...d,ref:t})})},`ToggleGroupImpl`)),_v=`ToggleGroupItem`,Yne=m.forwardRef(uv(function(e,t){let n=hv(_v,e.__scopeToggleGroup),r=Jne(_v,e.__scopeToggleGroup),i=pv(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)(a_,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,h.jsx)(vv,{...s,ref:t})}):(0,h.jsx)(vv,{...s,ref:t})},`ToggleGroupItem`)),vv=m.forwardRef(uv(function(e,t){let{__scopeToggleGroup:n,value:r,...i}=e,a=hv(_v,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0},s=a.type===`single`?o:void 0;return(0,h.jsx)(Vne,{...s,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})},`ToggleGroupItemImpl`));function yv({variant:e=`secondary`,size:t=`default`}={}){return z(`sl-btn`,`sl-btn--${e}`,t===`small`&&`sl-btn--small`)}function B({variant:e=`secondary`,size:t=`default`,disabledReason:n,focusableWhenDisabled:r=!1,className:i,type:a,title:o,disabled:s,onClick:c,children:l,...u}){let d=(0,m.useId)(),f=z(yv({variant:e,size:t}),i),p=s===!0&&n!==``?n:void 0;if(p===void 0||!r)return(0,h.jsx)(`button`,{"data-slot":`button`,"data-variant":e,type:a??`button`,title:p??o,disabled:s,onClick:c,className:f,...u,children:l});let g=[u[`aria-describedby`],d].filter(Boolean).join(` `);return(0,h.jsxs)(`button`,{"data-slot":`button`,"data-variant":e,type:a??`button`,className:f,...u,"aria-disabled":`true`,"aria-describedby":g,"data-tip":p,"data-reason":``,onClick:e=>e.preventDefault(),onPointerDown:e=>e.preventDefault(),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.preventDefault()},children:[l,(0,h.jsx)(`span`,{id:d,hidden:!0,children:p})]})}function bv({label:e,tip:t,title:n,children:r,...i}){let a=t===!1?void 0:typeof t==`string`?t:e;return(0,h.jsx)(B,{variant:`icon`,"aria-label":e,...a===void 0?{title:n??e}:{"data-tip":a},...i,children:r})}function xv({className:e,asChild:t=!1,type:n,...r}){let i=t?Od:`button`;return(0,h.jsx)(i,{"data-slot":`play-key`,...t?{}:{type:n??`button`},className:z(`sl-key`,e),...r})}function Sv({className:e,...t}){return(0,h.jsx)(`div`,{className:z(`sl-btn-row`,e),...t})}var Xne=5e3,Zne=15e3;function Qne(e,t){if(e!==`error`)return t===void 0?Xne:Zne}var Cv=(0,m.createContext)(void 0);function $ne({children:e}){let[t,n]=(0,m.useState)([]),r=(0,m.useRef)(0),i=(0,m.useRef)(new Map),a=(0,m.useRef)({hover:!1,focus:!1}),o=(0,m.useCallback)(e=>{n(t=>t.filter(t=>t.id!==e));let t=i.current.get(e);t?.handle!==void 0&&clearTimeout(t.handle),i.current.delete(e)},[]),s=(0,m.useCallback)((e,t)=>{t.startedAt=Date.now(),t.handle=setTimeout(()=>o(e),t.remaining)},[o]),c=(0,m.useCallback)((e,t)=>{let n=a.current.hover||a.current.focus;a.current={...a.current,[e]:t};let r=a.current.hover||a.current.focus;if(n!==r)for(let[e,t]of i.current)r?(t.handle!==void 0&&clearTimeout(t.handle),t.handle=void 0,t.remaining=Math.max(0,t.remaining-(Date.now()-t.startedAt))):(t.remaining=Math.max(t.remaining,2e3),s(e,t))},[s]),l=(0,m.useCallback)((e,t=`info`,o)=>{r.current+=1;let c=r.current;n(n=>{let r=n.filter(t=>t.message!==e);for(let e of r.slice(0,Math.max(0,r.length-2))){let t=i.current.get(e.id);t?.handle!==void 0&&clearTimeout(t.handle),i.current.delete(e.id)}return[...r.slice(-2),{id:c,message:e,tone:t,action:o}]});let l=Qne(t,o);if(l===void 0)return;let u={remaining:l,startedAt:Date.now(),handle:void 0};i.current.set(c,u),a.current.hover||a.current.focus||s(c,u)},[s]);(0,m.useEffect)(()=>{t.length===0&&(a.current={hover:!1,focus:!1})},[t.length]),(0,m.useEffect)(()=>{let e=i.current;return()=>{for(let t of e.values())t.handle!==void 0&&clearTimeout(t.handle)}},[]);let u=(0,m.useMemo)(()=>l,[l]),d=t.filter(e=>e.tone!==`error`),f=t.filter(e=>e.tone===`error`),p=e=>(0,h.jsx)(ere,{toast:e,dismiss:()=>o(e.id)},e.id);return(0,h.jsxs)(Cv.Provider,{value:u,children:[e,(0,h.jsxs)(`section`,{"aria-label":`Notifications`,className:`sl-toasts`,onPointerEnter:()=>c(`hover`,!0),onPointerLeave:()=>c(`hover`,!1),onFocus:()=>c(`focus`,!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||c(`focus`,!1)},children:[(0,h.jsx)(`div`,{"aria-live":`assertive`,"aria-relevant":`additions text`,className:`sl-toasts__list`,children:f.map(p)}),(0,h.jsx)(`div`,{"aria-live":`polite`,"aria-relevant":`additions text`,className:`sl-toasts__list`,children:d.map(p)})]})]})}function ere({toast:e,dismiss:t}){return(0,h.jsxs)(`div`,{"data-tone":e.tone,className:z(`sl-toast sl-enter`,e.tone===`error`&&`sl-toast--failed`,e.tone===`success`&&`sl-toast--done`),children:[e.tone===`error`?(0,h.jsx)(Sl,{"aria-hidden":`true`,strokeWidth:1.75}):e.tone===`success`?(0,h.jsx)(Ac,{"aria-hidden":`true`,strokeWidth:1.75}):(0,h.jsx)(el,{"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)(B,{variant:`quiet`,size:`small`,onClick:()=>{t(),e.action?.run()},children:e.action.label}),(0,h.jsx)(`button`,{type:`button`,"aria-label":`Dismiss notification`,onClick:t,className:`sl-btn sl-btn--icon sl-btn--small -mr-1 w-[30px]`,children:(0,h.jsx)(kl,{"aria-hidden":`true`,strokeWidth:1.75})})]})}function wv(){return(0,m.useContext)(Cv)??tre}function tre(){}var Tv=(0,m.createContext)(void 0);function nre({deps:e,children:t}){return(0,h.jsx)(Tv.Provider,{value:e,children:(0,h.jsx)($ne,{children:t})})}function V(){let e=(0,m.useContext)(Tv);if(e===void 0)throw Error(`useApp was called outside AppProvider`);return e}var Ev=`Slopify`,Dv,Ov=[];function kv(){if(typeof document>`u`)return;let e=Ov.at(-1)?.title??Dv;document.title=e===void 0||e===``?Ev:`${e} · ${Ev}`}function Av(e){Dv=e,kv()}function jv(e){(0,m.useEffect)(()=>{if(e===void 0||e===``)return;let t={title:e};return Ov.push(t),kv(),()=>{Ov.splice(Ov.indexOf(t),1),kv()}},[e])}function Mv(e){return[[/^\/$/,`Home`],[/^\/projects\/?$/,`Projects`],[/^\/projects\/[^/]+/,`Project`],[/^\/play/,`Create`],[/^\/calendar/,`Calendar`],[/^\/schedules/,`Calendar`],[/^\/channels\/?$/,`Channels`],[/^\/channels\/[^/]+/,`Channel`],[/^\/prompts/,`Library · Prompts`],[/^\/entries/,`Library · Intros and outros`],[/^\/templates/,`Library · Templates`],[/^\/document-themes/,`Library · Documents`],[/^\/narration-aliases/,`Library · Narration aliases`],[/^\/ab-results/,`Library · A/B results`],[/^\/settings/,`Settings`],[/^\/help/,`Tutorials`],[/^\/welcome/,`Welcome`]].find(([t])=>t.test(e))?.[1]}var Nv=Hm,Pv=Km;function Fv({className:e,...t}){return(0,h.jsx)(Jm,{"data-slot":`dialog-overlay`,className:z(`fixed inset-0 z-40 bg-scrim`,e),...t})}function Iv({className:e,children:t,...n}){return(0,h.jsxs)(Pv,{children:[(0,h.jsx)(Fv,{}),(0,h.jsx)(Qm,{"data-slot":`dialog-content`,className:z(`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 Lv({className:e,...t}){return(0,h.jsx)(eh,{"data-slot":`dialog-title`,className:z(`sl-dialog__title text-ink`,e),...t})}function Rv({className:e,...t}){return(0,h.jsx)(Eee,{"data-slot":`dialog-description`,className:z(`m-0 text-body text-ink-2`,e),...t})}function zv({open:e,onOpenChange:t,title:n,description:r,footer:i,children:a,className:o,dismissible:s=!0}){return(0,h.jsx)(Nv,{open:e,...t===void 0?{}:{onOpenChange:t},children:(0,h.jsxs)(Iv,{className:o,...s?{}:{onEscapeKeyDown:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault()},...r===void 0?{"aria-describedby":void 0}:{},children:[(0,h.jsx)(Lv,{children:n}),r===void 0?null:(0,h.jsx)(Rv,{children:r}),a,i===void 0?null:(0,h.jsx)(`div`,{className:`sl-dialog__foot`,children:i})]})})}function Bv({open:e,title:t,consequence:n,confirmLabel:r,cancelLabel:i,tone:a=`destructive`,pending:o=!1,onConfirm:s,onCancel:c}){return(0,h.jsx)(zv,{open:e,onOpenChange:e=>{e||c()},title:t,description:n,footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(B,{variant:`secondary`,autoFocus:!0,onClick:c,children:i??(a===`destructive`?`Keep it`:`Cancel`)}),(0,h.jsx)(B,{variant:a,disabled:o,disabledReason:`Working on it`,onClick:s,children:r})]})})}var Vv=[`onboarding`],Hv=[`onboarding`,`sample`],Uv=(e,t)=>[`narration-peaks`,e,t],Wv=(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 Gv(e){return R(await e.fetch(`${e.origin}/api/onboarding`))}async function Kv(e){await R(await Wv(e,`/dismiss`))}async function qv(e,t){return R(await Wv(e,`/packs/${encodeURIComponent(t)}`))}async function Jv(e,t){return R(await Wv(e,`/short`,t))}async function Yv(e,t){return R(await Wv(e,`/full-video`,t))}async function Xv(e){return R(await e.fetch(`${e.origin}/api/onboarding/sample`))}function Zv(e,t){return e!==void 0&&Object.values(e.samples).includes(t)}async function Qv(e){return R(await Wv(e,`/sample/restore`))}async function $v(e,t=ey()){return R(await Wv(e,`/sample/copy`,t===void 0?void 0:{projectId:t}))}function ey(){if(typeof window>`u`)return;let e=/\/projects\/([^/?#]+)/.exec(window.location.pathname);return e?.[1]===void 0?void 0:decodeURIComponent(e[1])}async function ty(e,t){return R(await e.fetch(`${e.origin}/api/projects/${encodeURIComponent(t)}/narration/peaks`))}var H={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]},ny=15e3,ry=new Set([`running`,`pending`]);function iy(e){return at({queryKey:H.projects,queryFn:()=>Ao(e),refetchInterval:e=>e.state.data?.projects.some(e=>ry.has(e.status))===!0&&ny,refetchIntervalInBackground:!1})}function ay(e,t){return at({queryKey:H.project(t),queryFn:()=>jo(e,t),refetchInterval:e=>e.state.data!==void 0&&ry.has(e.state.data.project.status)?ny:!1})}function oy(e,t){return at({queryKey:H.runCost(t),queryFn:()=>Mo(e,t)})}function sy(e){return at({queryKey:H.notice,queryFn:()=>Jo(e)})}function rre(e){return at({queryKey:H.usage,queryFn:()=>qo(e)})}function cy(e){return at({queryKey:H.providers,queryFn:()=>Zo(e)})}function ly(e){return at({queryKey:H.voices,queryFn:()=>As(e)})}function uy(e){return at({queryKey:H.prompts,queryFn:()=>Ls(e)})}function dy(e){return at({queryKey:H.entries,queryFn:()=>Ys(e)})}function fy(e){return at({queryKey:H.documentThemes,queryFn:()=>Zs(e)})}function py(e){return at({queryKey:H.narrationAliases,queryFn:()=>nc(e)})}function my(e){return at({queryKey:H.settings,queryFn:()=>ts(e)})}var ire={"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`}}},are={"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 dollars, such as 5 or 2.50. 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, and every Slopify tab open in it follows the same pick.`,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, PDF 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:`PDF 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`}}},ore={"play.output":{title:`What are you making?`,body:`Picks the stages the project uses. Video narrates images with captions. Article writes or takes text, with an optional PDF. Audiobook reads a text aloud. Podcast is a conversation between speakers. Images draws pictures from your prompts. Each choice turns on what it needs and folds the rest away; every stage can still be changed under its row.`,tutorial:{page:`Play-Overview`}},"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 project's name in Slopify, shown on the project and in Projects. For a YouTube video it is also the YouTube title unless the YouTube text writes its own, and YouTube takes at most 100 characters there, without < or >. 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 delete. 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:`Write it for me has the text model write the article from the article prompt, one call. Use my text as written narrates text you paste, word for word, with no text-model cost. Adapt my text has the article prompt rewrite text you paste, one call. No text is for images only. The article is what the narration reads and the PDF lays out. Default: Write it for me.`,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 → Narration 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 (audiobooks) keeps the article as written and has the text model hand its narration and dialogue to the speakers, one extra call. Adapt the article (podcasts, interviews, dramas) also keeps the article as written; one extra call rewrites it as a conversation for the speakers, kept beside it as the script.`,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 → PDF themes. 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.reviewer":{title:`Who reviews`,body:`Model: Slopify asks the reviewer model below, one paid call per item. External agent (MCP): an agent connected in Settings → Connections → Agents (MCP) answers each review instead, at no API cost. A review nobody answers within 2 hours passes on its own, and a notification says so.`,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, PDF 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 canceled, 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`}}},sre={"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.remove-breaths":{title:`Soften breaths`,body:`Turns the audible in-breaths between sentences and after commas down by 12 dB, with soft fades. A breath with any word sound in it is left as it is, and every word, pause and caption stays where it was. Runs on this computer, no API calls; turning it on joins the narration again from its pieces, never makes the speech again. Default: off.`,tutorial:{page:`Editing-a-Project`,anchor:`pauses-and-volume`}},"project.soften-s":{title:`Soften S sounds`,body:`Puts each narration piece through a very light de-esser, which takes the sharp edge off s and sh sounds while the voice keeps its brightness. Works with or without Soften breaths. Runs on this computer, no API calls; turning it on joins the narration again from the pieces it already has, never makes the speech again. Default: off.`,tutorial:{page:`Editing-a-Project`,anchor:`pauses-and-volume`}},"project.level-sentences":{title:`Level each sentence`,body:`Holds each sentence to the sentences in the minute around it, so no line jumps out or drops away: loud ones come down by up to 6 dB, quiet ones up by up to 3 dB, and the volume only changes in the pauses. Runs before Soften breaths and Soften S sounds. Needs Level the volume and one voice. Joins the narration again, never makes the speech again. Default: off.`,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 378 MB (Settings → Production defaults → Subtitle timing model offers smaller ones). 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, Free drops the working files it was made from (narration parts, timing, render settings) and keeps what gets published, the video's and shorts' images and anything you uploaded. Delete old versions removes its History folder (earlier renders and narration). Each button says how much it frees. Changing the project or going back to an old version makes those files again.`,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`}}},cre={"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.subtitle-model":{title:`Subtitle timing model`,body:`The speech model that times English captions on this computer. Most accurate (378 MB) hears the narration best and on most computers runs faster too; Smallest (95 MB) can mishear a line and stop the run. The chosen model downloads once, on first use; switching back reuses one already downloaded. Changing it never marks subtitles outdated. Default: Most accurate.`,tutorial:{page:`Settings-Reference`,anchor:`subtitle-timing-model`}},"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.agents":{title:`Agents (MCP)`,body:`An AI agent on this computer, such as Claude Code or Codex, can run Slopify through this address: start and fix runs, edit the Library and answer reviews set to External agent. It needs no key, like this page, and never uploads to YouTube. What it changes is marked by agent in the project's history, in notifications and in the list below.`,tutorial:{page:`Agents-MCP`,anchor:`connect-an-agent`}},"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, nothing is fetched from a store. Chrome, Edge and Brave load it once with Load unpacked (Developer mode) from the folder shown here: Slopify puts each new version there when it updates, and the extension switches to it by itself after 45 minutes without use. Firefox 128 or newer loads the downloaded zip as a temporary add-on, which it forgets on restart. Then pair it with the token above.`,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:`Clear leftover 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:`clear-leftover-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:`Free disk space`,body:`Delete old versions removes a project's History folder (earlier renders and narration). Keep outputs only removes a finished project's working files (narration parts, timing, render settings). Clean up everything does both for every project; running or unfinished ones keep everything. The current video, shorts, their images, thumbnail, documents and your uploads always stay. Remaking a project or going back to an old version makes the files again.`,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. Channels, cast members, PDF themes and episode summaries never come here: deleting one removes it permanently.`,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, paused runs, topics a schedule suggested for you to accept or reject, and runs that failed with the fix to try; then finished videos you have not marked uploaded. Nothing here moves on until you act: approving a review from here lets that run continue, and Mark uploaded takes a finished video off the list (Projects still has it).`,tutorial:{page:`Home-and-Projects`,anchor:`needs-you`}},"home.running":{title:`Running now`,body:`Videos being made, and runs Waiting for the agent: an External agent reviews something they made, and they carry on once it answers or after 2 hours. Each shows the step it 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.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`}}},lre={...ore,...sre,...ire,...are,...cre};function hy(e,t){let n=lre[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 ure(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 gy(e){return e.toLowerCase().replace(/[^\p{L}\p{N}\p{M} _-]/gu,``).replace(/ /g,`-`)}var dre=`/help/tutorials`;function _y(e,t){return`${dre}/${encodeURIComponent(e)}${t?`#${t}`:``}`}function fre(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)?`](${_y(a,i)})`:e})}function pre(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 mre(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 hre(e,t,n=[]){let r=new Map;for(let e of n){let t=gy(ure(e));r.set(t,(r.get(t)??0)+1)}for(let n of e.querySelectorAll(`h1, h2, h3, h4, h5, h6`)){let e=gy((n.textContent??``).trim()),i=r.get(e)??0;if(r.set(e,i+1),(i===0?e:`${e}-${String(i)}`)===t)return n}}var vy=lv,yy=Pne,gre=Nne,_re=Lne;function by({className:e,align:t=`start`,sideOffset:n=6,...r}){return(0,h.jsx)(Fne,{children:(0,h.jsx)(Ine,{"data-slot":`popover-content`,align:t,sideOffset:n,collisionPadding:12,className:z(`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 U({id:e,label:t,vars:n,className:r}){let i=hy(e,n);return(0,h.jsxs)(vy,{children:[(0,h.jsx)(yy,{type:`button`,"aria-label":`About ${t??i.title}`,"data-help-id":e,className:z(`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)(el,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,h.jsxs)(by,{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
|
+
`},pee=0,km=[];function mee(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),i=m.useState(pee++)[0],a=m.useState(fm)[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=Hp([e.lockRef.current],(e.shards||[]).map(Om),!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=Em(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=Cm(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Cm(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 uee(h,t,e,h===`h`?s:c,!0)},[]),c=m.useCallback(function(e){var n=e;if(km.length&&km[km.length-1]===a){var r=`deltaY`in n?Dm(n):Em(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&dee(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Om).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:hee(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=Em(e),r.current=void 0},[]),d=m.useCallback(function(t){l(t.type,Dm(t),t.target,s(t,e.lockRef.current))},[]),f=m.useCallback(function(t){l(t.type,Em(t),t.target,s(t,e.lockRef.current))},[]);m.useEffect(function(){return km.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,xm),document.addEventListener(`touchmove`,c,xm),document.addEventListener(`touchstart`,u,xm),function(){km=km.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,xm),document.removeEventListener(`touchmove`,c,xm),document.removeEventListener(`touchstart`,u,xm)}},[]);var p=e.removeScrollBar,h=e.inert;return m.createElement(m.Fragment,null,h?m.createElement(a,{styles:fee(i)}):null,p?m.createElement(ree,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function hee(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var gee=nm(rm,mee),Am=m.forwardRef(function(e,t){return m.createElement(am,Bp({},e,{ref:t,sideCar:gee}))});Am.classNames=am.classNames;var _ee=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},jm=new WeakMap,Mm=new WeakMap,Nm={},Pm=0,Fm=function(e){return e&&(e.host||Fm(e.parentNode))},vee=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Fm(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})},yee=function(e,t,n,r){var i=vee(t,Array.isArray(e)?e:[e]);Nm[n]||(Nm[n]=new WeakMap);var a=Nm[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=(jm.get(e)||0)+1,l=(a.get(e)||0)+1;jm.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Mm.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(),Pm++,function(){o.forEach(function(e){var t=jm.get(e)-1,i=a.get(e)-1;jm.set(e,t),a.set(e,i),t||(Mm.has(e)||e.removeAttribute(r),Mm.delete(e)),i||e.removeAttribute(n)}),Pm--,Pm||(jm=new WeakMap,jm=new WeakMap,Mm=new WeakMap,Nm={})}},Im=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||_ee(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),yee(r,i,n,`aria-hidden`)):function(){return null}},bee=Object.defineProperty,Lm=(e,t)=>bee(e,`name`,{value:t,configurable:!0}),Rm=`Dialog`,[zm,xee]=Yd(Rm),[Bm,Vm]=zm(Rm),Hm=Lm(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]=Of({prop:r,defaultProp:i??!1,onChange:a,caller:Rm}),[d,f]=m.useState(0),[p,g]=m.useState(0);return(0,h.jsx)(Bm,{scope:t,triggerRef:s,contentRef:c,contentId:Kf(),titleId:Kf(),descriptionId:Kf(),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`),Um=`DialogPortal`,[Wm,Gm]=zm(Um,{forceMount:void 0}),Km=Lm(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Vm(Um,t);return(0,h.jsx)(Wm,{scope:t,forceMount:n,children:m.Children.map(r,e=>(0,h.jsx)(If,{present:n||a.open,children:(0,h.jsx)(Mp,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),qm=`DialogOverlay`,Jm=m.forwardRef(Lm(function(e,t){let n=Gm(qm,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Vm(qm,e.__scopeDialog);return a.modal?(0,h.jsx)(If,{present:r||a.open,children:(0,h.jsx)(Xm,{...i,ref:t})}):null},`DialogOverlay`)),Ym=Dd(`DialogOverlay.RemoveScroll`),Xm=m.forwardRef(Lm(function(e,t){let{__scopeDialog:n,...r}=e,i=Vm(qm,n),a=wd(t,cp());return(0,h.jsx)(Am,{as:Ym,allowPinchZoom:!0,shards:[i.contentRef],children:(0,h.jsx)(Wd.div,{"data-state":th(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Zm=`DialogContent`,Qm=m.forwardRef(Lm(function(e,t){let n=Gm(Zm,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Vm(Zm,e.__scopeDialog);return(0,h.jsx)(If,{present:r||a.open,children:a.modal?(0,h.jsx)(See,{...i,ref:t}):(0,h.jsx)(Cee,{...i,ref:t})})},`DialogContent`)),See=m.forwardRef(Lm(function(e,t){let n=Vm(Zm,e.__scopeDialog),r=m.useRef(null),i=wd(t,n.contentRef,r);return m.useEffect(()=>{let e=r.current;if(e)return Im(e)},[]),(0,h.jsx)($m,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:mf(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:mf(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:mf(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Cee=m.forwardRef(Lm(function(e,t){let n=Vm(Zm,e.__scopeDialog),r=m.useRef(!1),i=m.useRef(!1);return(0,h.jsx)($m,{...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`)),$m=m.forwardRef(Lm(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Vm(Zm,n);return Rp(),(0,h.jsx)(h.Fragment,{children:(0,h.jsx)(yp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,h.jsx)(sp,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":th(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),wee=`DialogTitle`,eh=m.forwardRef(Lm(function(e,t){let{__scopeDialog:n,...r}=e,i=Vm(wee,n),{setTitleCount:a}=i;return yf(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,h.jsx)(Wd.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),Tee=`DialogDescription`,Eee=m.forwardRef(Lm(function(e,t){let{__scopeDialog:n,...r}=e,i=Vm(Tee,n),{setDescriptionCount:a}=i;return yf(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,h.jsx)(Wd.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),Dee=`DialogClose`,Oee=m.forwardRef(Lm(function(e,t){let{__scopeDialog:n,...r}=e,i=Vm(Dee,n);return(0,h.jsx)(Wd.button,{type:`button`,...r,ref:t,onClick:mf(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function th(e){return e?`open`:`closed`}Lm(th,`getState`);var kee=Object.defineProperty,Aee=(e,t)=>kee(e,`name`,{value:t,configurable:!0});function nh(e){let[t,n]=m.useState(void 0);return yf(()=>{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}Aee(nh,`useSize`);var jee=[`top`,`right`,`bottom`,`left`],rh=Math.min,ih=Math.max,ah=Math.round,oh=Math.floor,sh=e=>({x:e,y:e}),Mee={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function ch(e,t,n){return ih(e,rh(t,n))}function lh(e,t){return typeof e==`function`?e(t):e}function uh(e){return e.split(`-`)[0]}function dh(e){return e.split(`-`)[1]}function fh(e){return e===`x`?`y`:`x`}function ph(e){return e===`y`?`height`:`width`}function mh(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function hh(e){return fh(mh(e))}function Nee(e,t,n){n===void 0&&(n=!1);let r=dh(e),i=hh(e),a=ph(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=xh(o)),[o,xh(o)]}function Pee(e){let t=xh(e);return[gh(e),t,gh(t)]}function gh(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var _h=[`left`,`right`],vh=[`right`,`left`],Fee=[`top`,`bottom`],Iee=[`bottom`,`top`];function yh(e,t,n){switch(e){case`top`:case`bottom`:return n?t?vh:_h:t?_h:vh;case`left`:case`right`:return t?Fee:Iee;default:return[]}}function bh(e,t,n,r){let i=dh(e),a=yh(uh(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(gh)))),a}function xh(e){let t=uh(e);return Mee[t]+e.slice(t.length)}function Sh(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Ch(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Sh(e)}function wh(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 Th(e,t,n){let{reference:r,floating:i}=e,a=mh(t),o=hh(t),s=ph(o),c=uh(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=dh(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Eh(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}=lh(t,e),p=Ch(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=wh(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=wh(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 Dh=50,Oh=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Eh},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Th(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<Dh&&(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}=Th(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},kh=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}=lh(e,t)||{};if(l==null)return{};let d=Ch(u),f={x:n,y:r},p=hh(i),m=ph(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=rh(d[_],T),D=rh(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=ch(E,k,O),j=!c.arrow&&dh(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),Ah=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}=lh(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=uh(r),_=mh(o),v=uh(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[xh(o)]:Pee(o)),x=p!==`none`;!d&&x&&b.push(...bh(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=Nee(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`||_===mh(t)||T.every(e=>mh(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=mh(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 jh(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Mh(e){return jee.some(t=>e[t]>=0)}var Nh=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=lh(e,t);switch(i){case`referenceHidden`:{let e=jh(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Mh(e)}}}case`escaped`:{let e=jh(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Mh(e)}}}default:return{}}}}},Ph=new Set([`left`,`top`]);async function Fh(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=uh(n),s=dh(n),c=mh(n)===`y`,l=Ph.has(o)?-1:1,u=a&&c?-1:1,d=lh(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 Ih=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 Fh(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}}}}},Lh=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}=lh(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=mh(i),p=fh(f),m=u[p],h=u[f],g=(e,t)=>ch(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}}}}}},Rh=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}=lh(e,t),u={x:n,y:r},d=mh(i),f=fh(d),p=u[f],m=u[d],h=lh(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=Ph.has(uh(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}}}},zh=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}=lh(e,t),c=await i.detectOverflow(t,s),l=uh(n),u=dh(n),d=mh(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=rh(p-c[m],g),y=rh(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*ih(c.left,c.right):S=p-2*ih(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 Bh(){return typeof window<`u`}function Vh(e){return Wh(e)?(e.nodeName||``).toLowerCase():`#document`}function Hh(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Uh(e){return((Wh(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Wh(e){return Bh()?e instanceof Node||e instanceof Hh(e).Node:!1}function Gh(e){return Bh()?e instanceof Element||e instanceof Hh(e).Element:!1}function Kh(e){return Bh()?e instanceof HTMLElement||e instanceof Hh(e).HTMLElement:!1}function qh(e){return!Bh()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Hh(e).ShadowRoot}function Jh(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=ag(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Yh(e){return/^(table|td|th)$/.test(Vh(e))}function Xh(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Zh=/transform|translate|scale|rotate|perspective|filter/,Qh=/paint|layout|strict|content/,$h=e=>!!e&&e!==`none`,eg;function tg(e){let t=Gh(e)?ag(e):e;return $h(t.transform)||$h(t.translate)||$h(t.scale)||$h(t.rotate)||$h(t.perspective)||!rg()&&($h(t.backdropFilter)||$h(t.filter))||Zh.test(t.willChange||``)||Qh.test(t.contain||``)}function ng(e){let t=sg(e);for(;Kh(t)&&!ig(t);){if(tg(t))return t;if(Xh(t))return null;t=sg(t)}return null}function rg(){return eg??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),eg}function ig(e){return/^(html|body|#document)$/.test(Vh(e))}function ag(e){return Hh(e).getComputedStyle(e)}function og(e){return Gh(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function sg(e){if(Vh(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||qh(e)&&e.host||Uh(e);return qh(t)?t.host:t}function cg(e){let t=sg(e);return ig(t)?(e.ownerDocument||e).body:Kh(t)&&Jh(t)?t:cg(t)}function lg(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=cg(e),i=r===e.ownerDocument?.body,a=Hh(r);if(i){let e=ug(a);return t.concat(a,a.visualViewport||[],Jh(r)?r:[],e&&n?lg(e):[])}return t.concat(r,lg(r,[],n))}function ug(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function dg(e){let t=ag(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Kh(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ah(n)!==a||ah(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function fg(e){return Gh(e)?e:e.contextElement}function pg(e){let t=fg(e);if(!Kh(t))return sh(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=dg(t),o=(a?ah(n.width):n.width)/r,s=(a?ah(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var mg=sh(0);function hg(e){let t=Hh(e);return!rg()||!t.visualViewport?mg:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function gg(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Hh(e)}function _g(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=fg(e),o=sh(1);t&&(r?Gh(r)&&(o=pg(r)):o=pg(e));let s=gg(a,n,r)?hg(a):sh(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=Hh(a),t=Gh(r)?Hh(r):r,n=e,i=ug(n);for(;i&&t!==n;){let e=pg(i),t=i.getBoundingClientRect(),r=ag(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=Hh(i),i=ug(n)}}return wh({width:u,height:d,x:c,y:l})}function vg(e,t){let n=og(e).scrollLeft;return t?t.left+n:_g(Uh(e)).left+n}function yg(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-vg(e,n),y:n.top+t.scrollTop}}function Lee(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Uh(r),s=t?Xh(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=sh(1),u=sh(0),d=Kh(r);if((d||!a)&&((Vh(r)!==`body`||Jh(o))&&(c=og(r)),d)){let e=_g(r);l=pg(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?yg(o,c):sh(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 Ree(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function zee(e){let t=og(e),n=e.ownerDocument.body,r=ih(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=ih(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+vg(e),o=-t.scrollTop;return ag(n).direction===`rtl`&&(a+=ih(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Bee=25;function Vee(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Hh(e),a=Uh(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!rg()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(vg(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<=Bee&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Hee(e,t){let n=_g(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=pg(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function bg(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Vee(e,n,t);else if(t===`document`)r=zee(Uh(e));else if(Gh(t))r=Hee(t,n);else{let n=hg(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return wh(r)}function Uee(e,t){let n=t.get(e);if(n)return n;let r=lg(e,[],!1).filter(e=>Gh(e)&&Vh(e)!==`body`),i=null,a=ag(e).position===`fixed`,o=a?sg(e):e;for(;Gh(o)&&!ig(o);){let e=ag(o),t=tg(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=sg(o)}return t.set(e,r),r}function Wee(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Xh(t)?[]:Uee(t,this._c):[].concat(n),r],o=bg(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=bg(t,a[e],i);s=ih(n.top,s),c=rh(n.right,c),l=rh(n.bottom,l),u=ih(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Gee(e){let{width:t,height:n}=dg(e);return{width:t,height:n}}function Kee(e,t,n){let r=Kh(t),i=Uh(t),a=n===`fixed`,o=_g(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=sh(0);if((r||!a)&&((Vh(t)!==`body`||Jh(i))&&(s=og(t)),r)){let e=_g(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=vg(i));let l=i&&!r&&!a?yg(i,s):sh(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 ag(e).position===`static`}function Sg(e,t){if(!Kh(e)||ag(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Uh(e)===n&&(n=n.ownerDocument.body),n}function Cg(e,t){let n=Hh(e);if(Xh(e))return n;if(!Kh(e)){let t=sg(e);for(;t&&!ig(t);){if(Gh(t)&&!xg(t))return t;t=sg(t)}return n}let r=Sg(e,t);for(;r&&Yh(r)&&xg(r);)r=Sg(r,t);return r&&ig(r)&&xg(r)&&!tg(r)?n:r||ng(e)||n}var qee=async function(e){let t=this.getOffsetParent||Cg,n=this.getDimensions,r=await n(e.floating);return{reference:Kee(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Jee(e){return ag(e).direction===`rtl`}var Yee={convertOffsetParentRelativeRectToViewportRelativeRect:Lee,getDocumentElement:Uh,getClippingRect:Wee,getOffsetParent:Cg,getElementRects:qee,getClientRects:Ree,getDimensions:Gee,getScale:pg,isElement:Gh,isRTL:Jee};function wg(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Xee(e,t,n){let r=null,i,a=Uh(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=oh(d),h=oh(a.clientWidth-(u+f)),g=oh(a.clientHeight-(d+p)),_=oh(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:ih(0,rh(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!wg(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=Hh(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Zee(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=fg(e),u=i||a?[...l?lg(l):[],...t?lg(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Xee(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?_g(e):null;c&&g();function g(){let t=_g(e);h&&!wg(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 Qee=Ih,$ee=Lh,ete=Ah,tte=zh,nte=Nh,Tg=kh,rte=Rh,ite=(e,t,n)=>{let r=new Map,i=n??{},a={...Yee,...i.platform,_c:r};return Oh(e,t,{...i,platform:a})},Eg=typeof document<`u`?m.useLayoutEffect:function(){};function Dg(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(!Dg(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)&&!Dg(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Og(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function kg(e,t){let n=Og(e);return Math.round(t*n)/n}function Ag(e){let t=m.useRef(e);return Eg(()=>{t.current=e}),t}function ate(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);Dg(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=Ag(c),O=Ag(i),k=Ag(l),A=m.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),ite(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!Dg(T.current,t)&&(T.current=t,Vd.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Eg(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=m.useRef(!1);Eg(()=>(j.current=!0,()=>{j.current=!1}),[]),Eg(()=>{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 M=m.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),N=m.useMemo(()=>({reference:x,floating:S}),[x,S]),P=m.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=kg(N.floating,u.x),r=kg(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Og(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return m.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var ote=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?{}:Tg({element:r.current,padding:i}).fn(n):r?Tg({element:r,padding:i}).fn(n):{}}}},ste=(e,t)=>{let n=Qee(e);return{name:n.name,fn:n.fn,options:[e,t]}},cte=(e,t)=>{let n=$ee(e);return{name:n.name,fn:n.fn,options:[e,t]}},lte=(e,t)=>({fn:rte(e).fn,options:[e,t]}),ute=(e,t)=>{let n=ete(e);return{name:n.name,fn:n.fn,options:[e,t]}},dte=(e,t)=>{let n=tte(e);return{name:n.name,fn:n.fn,options:[e,t]}},fte=(e,t)=>{let n=nte(e);return{name:n.name,fn:n.fn,options:[e,t]}},pte=(e,t)=>{let n=ote(e);return{name:n.name,fn:n.fn,options:[e,t]}},mte=Object.defineProperty,jg=(e,t)=>mte(e,`name`,{value:t,configurable:!0}),Mg=`Popper`,[Ng,Pg]=Yd(Mg),[hte,Fg]=Ng(Mg),gte=jg(e=>{let{__scopePopper:t,children:n}=e,[r,i]=m.useState(null),[a,o]=m.useState(void 0);return(0,h.jsx)(hte,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),_te=`PopperAnchor`,vte=m.forwardRef(jg(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=Fg(_te,n),o=m.useRef(null),s=a.onAnchorChange,c=wd(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&&Rg(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,h.jsx)(Wd.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),Ig=`PopperContent`,[yte,bte]=Ng(Ig),xte=m.forwardRef(jg(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=Fg(Ig,n),[y,b]=m.useState(null),x=wd(t,b),[S,C]=m.useState(null),w=nh(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,j={padding:O,boundary:k.filter(Lg),altBoundary:A},{refs:M,floatingStyles:N,placement:P,isPositioned:ee,middlewareData:F}=ate({strategy:`fixed`,placement:D,whileElementsMounted:jg((...e)=>Zee(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:v.anchor},middleware:[ste({mainAxis:i+E,alignmentAxis:o}),c&&cte({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?lte():void 0,...j}),c&&ute({...j}),dte({...j,apply:jg(({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&&pte({element:S,padding:s}),Ste({arrowWidth:T,arrowHeight:E}),f&&fte({strategy:`referenceHidden`,...j,boundary:A?j.boundary:void 0})]}),te=v.setPlacementState;yf(()=>(te(P),()=>{te(void 0)}),[P,te]);let[ne,re]=Rg(P),ie=$f(g);yf(()=>{ee&&ie?.()},[ee,ie]);let ae=F.arrow?.x,oe=F.arrow?.y,se=F.arrow?.centerOffset!==0,[ce,le]=m.useState();return yf(()=>{y&&le(window.getComputedStyle(y).zIndex)},[y]),(0,h.jsx)(`div`,{ref:M.setFloating,"data-radix-popper-content-wrapper":``,style:{...N,transform:ee?N.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ce,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,h.jsx)(yte,{scope:n,placedSide:ne,placedAlign:re,onArrowChange:C,arrowX:ae,arrowY:oe,shouldHideArrow:se,children:(0,h.jsx)(Wd.div,{"data-side":ne,"data-align":re,..._,ref:x,style:{..._.style,animation:ee?_.style?.animation:`none`}})})})},`PopperContent`));function Lg(e){return e!==null}jg(Lg,`isNotNull`);var Ste=jg(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]=Rg(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 Rg(e){let[t,n=`center`]=e.split(`-`);return[t,n]}jg(Rg,`getSideAndAlignFromPlacement`);var zg=gte,Bg=vte,Vg=xte,Cte=Object.defineProperty,Hg=(e,t)=>Cte(e,`name`,{value:t,configurable:!0}),Ug=!1;function Wg(){let[e,t]=m.useState(Ug);return m.useEffect(()=>{Ug||(Ug=!0,t(!0))},[]),e}Hg(Wg,`useIsHydrated`);var Gg=m.useSyncExternalStore;function Kg(){return()=>{}}Hg(Kg,`subscribe`);function qg(){return Gg(Kg,()=>!0,()=>!1)}Hg(qg,`useIsHydratedModern`);var wte=typeof Gg==`function`?qg:Wg,Tte=Object.defineProperty,Jg=(e,t)=>Tte(e,`name`,{value:t,configurable:!0}),Yg=`rovingFocusGroup.onEntryFocus`,Ete={bubbles:!1,cancelable:!0},Xg=`RovingFocusGroup`,[Zg,Qg,Dte]=$d(Xg),[Ote,$g]=Yd(Xg,[Dte]),[kte,Ate]=Ote(Xg),jte=m.forwardRef(Jg(function(e,t){return(0,h.jsx)(Zg.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,h.jsx)(Zg.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,h.jsx)(Mte,{...e,ref:t})})})},`RovingFocusGroup`)),Mte=m.forwardRef(Jg(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=wd(t,f),g=Xf(a),[_,v]=Of({prop:o,defaultProp:s??null,onChange:c,caller:Xg}),[y,b]=m.useState(!1),x=$f(l),S=Qg(n),C=m.useRef(!1),[w,T]=m.useState(0);return m.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Yg,x),()=>e.removeEventListener(Yg,x)},[x]),(0,h.jsx)(kte,{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)(Wd.div,{tabIndex:y||w===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:mf(e.onMouseDown,()=>{C.current=!0}),onFocus:mf(e.onFocus,e=>{let t=!C.current;if(e.target===e.currentTarget&&t&&!y){let t=new CustomEvent(Yg,Ete);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=S().filter(e=>e.focusable);n_([e.find(e=>e.active),e.find(e=>e.id===_),...e].filter(Boolean).map(e=>e.ref.current),u)}}C.current=!1}),onBlur:mf(e.onBlur,()=>b(!1))})})},`RovingFocusGroupImpl`)),Nte=`RovingFocusGroupItem`,Pte=m.forwardRef(Jg(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Kf(),l=a||c,u=Ate(Nte,n),d=u.currentTabStopId===l,f=Qg(n),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:_}=u,v=wte();return yf(()=>{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)(Zg.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,h.jsx)(Wd.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:mf(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:mf(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:mf(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=t_(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?r_(n,r+1):n.slice(r+1)}setTimeout(()=>n_(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:_!=null}):o})})},`RovingFocusGroupItem`)),Fte={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function e_(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}Jg(e_,`getDirectionAwareKey`);function t_(e,t,n){let r=e_(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Fte[r]}Jg(t_,`getFocusIntent`);function n_(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}Jg(n_,`focusFirst`);function r_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Jg(r_,`wrapArray`);var i_=jte,a_=Pte,Ite=Object.defineProperty,o_=(e,t)=>Ite(e,`name`,{value:t,configurable:!0}),s_=[`Enter`,` `],Lte=[`ArrowDown`,`PageUp`,`Home`],c_=[`ArrowUp`,`PageDown`,`End`],Rte=[...Lte,...c_];[...s_],[...s_];var l_=`Menu`,[u_,zte,Bte]=$d(l_),[d_,f_]=Yd(l_,[Bte,Pg,$g]),p_=Pg(),m_=$g(),[Vte,h_]=d_(l_),[Hte,g_]=d_(l_),Ute=o_(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=p_(t),[c,l]=m.useState(null),u=m.useRef(!1),d=$f(a),f=Xf(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)(zg,{...s,children:(0,h.jsx)(Vte,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,h.jsx)(Hte,{scope:t,onClose:m.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),Wte=m.forwardRef(o_(function(e,t){let{__scopeMenu:n,...r}=e,i=p_(n);return(0,h.jsx)(Bg,{...i,...r,ref:t})},`MenuAnchor`)),__=`MenuPortal`,[Gte,Kte]=d_(__,{forceMount:void 0}),qte=o_(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=h_(__,t);return(0,h.jsx)(Gte,{scope:t,forceMount:n,children:(0,h.jsx)(If,{present:n||a.open,children:(0,h.jsx)(Mp,{asChild:!0,container:i,children:r})})})},`MenuPortal`),v_=`MenuContent`,[Jte,y_]=d_(v_),Yte=m.forwardRef(o_(function(e,t){let n=Kte(v_,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=h_(v_,e.__scopeMenu),o=g_(v_,e.__scopeMenu);return(0,h.jsx)(u_.Provider,{scope:e.__scopeMenu,children:(0,h.jsx)(If,{present:r||a.open,children:(0,h.jsx)(u_.Slot,{scope:e.__scopeMenu,children:o.modal?(0,h.jsx)(Xte,{...i,ref:t}):(0,h.jsx)(Zte,{...i,ref:t})})})})},`MenuContent`)),Xte=m.forwardRef(o_(function(e,t){let n=h_(v_,e.__scopeMenu),r=m.useRef(null),i=wd(t,r);return m.useEffect(()=>{let e=r.current;if(e)return Im(e)},[]),(0,h.jsx)(b_,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:mf(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),Zte=m.forwardRef(o_(function(e,t){let n=h_(v_,e.__scopeMenu);return(0,h.jsx)(b_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),Qte=Dd(`MenuContent.ScrollLock`),b_=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=h_(v_,n),y=g_(v_,n),b=p_(n),x=m_(n),S=zte(n),[C,w]=m.useState(null),T=m.useRef(null),E=wd(t,T,v.onContentChange),D=m.useRef(0),O=m.useRef(``),k=m.useRef(0),A=m.useRef(null),j=m.useRef(`right`),M=m.useRef(0),N=g?Am:m.Fragment,P=g?{as:Qte,allowPinchZoom:!0}:void 0,ee=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=D_(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),[]),Rp();let F=m.useCallback(e=>j.current===A.current?.side&&k_(e,A.current?.area),[]);return(0,h.jsx)(Jte,{scope:n,searchRef:O,onItemEnter:m.useCallback(e=>{F(e)&&e.preventDefault()},[F]),onItemLeave:m.useCallback(e=>{F(e)||(T.current?.focus(),w(null))},[F]),onTriggerLeave:m.useCallback(e=>{F(e)&&e.preventDefault()},[F]),pointerGraceTimerRef:k,onPointerGraceIntentChange:m.useCallback(e=>{A.current=e},[]),children:(0,h.jsx)(N,{...P,children:(0,h.jsx)(yp,{asChild:!0,trapped:i,onMountAutoFocus:mf(a,e=>{e.preventDefault(),T.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,h.jsx)(sp,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,h.jsx)(i_,{asChild:!0,...x,dir:y.dir,orientation:`vertical`,loop:r,currentTabStopId:C,onCurrentTabStopIdChange:w,onEntryFocus:mf(c,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,h.jsx)(Vg,{role:`menu`,"aria-orientation":`vertical`,"data-state":C_(v.open),"data-radix-menu-content":``,dir:y.dir,...b,..._,ref:E,style:{outline:`none`,..._.style},onKeyDown:mf(_.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&&ee(e.key));let i=T.current;if(e.target!==i||!Rte.includes(e.key))return;e.preventDefault();let a=S().filter(e=>!e.disabled).map(e=>e.ref.current);c_.includes(e.key)&&a.reverse(),T_(a)}),onBlur:mf(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(D.current),O.current=``)}),onPointerMove:mf(e.onPointerMove,A_(e=>{let t=e.target,n=M.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>M.current?`right`:`left`;j.current=t,M.current=e.clientX}}))})})})})})})},`MenuContentImpl`)),x_=`MenuItem`,S_=`menu.itemSelect`,$te=m.forwardRef(o_(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=m.useRef(null),o=g_(x_,e.__scopeMenu),s=y_(x_,e.__scopeMenu),c=wd(t,a),l=m.useRef(!1),u=o_(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(S_,{bubbles:!0,cancelable:!0});e.addEventListener(S_,e=>r?.(e),{once:!0}),Gd(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,h.jsx)(ene,{...i,ref:c,disabled:n,onClick:mf(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:mf(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:mf(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&s_.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),ene=m.forwardRef(o_(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=y_(x_,n),s=m_(n),c=m.useRef(null),l=wd(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)(u_.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,h.jsx)(a_,{asChild:!0,...s,focusable:!r,children:(0,h.jsx)(Wd.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:mf(e.onPointerMove,A_(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:mf(e.onPointerLeave,A_(e=>o.onItemLeave(e))),onFocus:mf(e.onFocus,()=>d(!0)),onBlur:mf(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),[tne,nne]=d_(`MenuRadioGroup`,{value:void 0,onValueChange:o_(()=>{},`onValueChange`)}),[rne,ine]=d_(`MenuItemIndicator`,{checked:!1}),ane=m.forwardRef(o_(function(e,t){let{__scopeMenu:n,...r}=e;return(0,h.jsx)(Wd.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),[one,sne]=d_(`MenuSub`);function C_(e){return e?`open`:`closed`}o_(C_,`getOpenState`);function w_(e){return e===`indeterminate`}o_(w_,`isIndeterminate`);function cne(e){return w_(e)?`indeterminate`:e?`checked`:`unchecked`}o_(cne,`getCheckedState`);function T_(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}o_(T_,`focusFirst`);function E_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}o_(E_,`wrapArray`);function D_(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=E_(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_(D_,`getNextMatch`);function O_(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_(O_,`isPointInPolygon`);function k_(e,t){return t?O_({x:e.clientX,y:e.clientY},t):!1}o_(k_,`isPointerInGraceArea`);function A_(e){return t=>t.pointerType===`mouse`?e(t):void 0}o_(A_,`whenMouse`);var lne=Ute,une=Wte,dne=qte,fne=Yte,pne=$te,mne=ane,hne=Object.defineProperty,j_=(e,t)=>hne(e,`name`,{value:t,configurable:!0}),M_=`DropdownMenu`,[gne,_ne]=Yd(M_,[f_]),N_=f_(),[P_,F_]=gne(M_),I_=j_(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=N_(t),l=m.useRef(null),[u,d]=Of({prop:i,defaultProp:a??!1,onChange:o,caller:M_});return(0,h.jsx)(P_,{scope:t,triggerId:Kf(),triggerRef:l,contentId:Kf(),open:u,onOpenChange:d,onOpenToggle:m.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,h.jsx)(lne,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),L_=`DropdownMenuTrigger`,R_=m.forwardRef(j_(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=F_(L_,n),o=N_(n),s=wd(t,a.triggerRef);return(0,h.jsx)(une,{asChild:!0,...o,children:(0,h.jsx)(Wd.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:mf(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:mf(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),z_=j_(e=>{let{__scopeDropdownMenu:t,...n}=e,r=N_(t);return(0,h.jsx)(dne,{...r,...n})},`DropdownMenuPortal`),vne=`DropdownMenuContent`,yne=m.forwardRef(j_(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=F_(vne,n),a=N_(n),o=m.useRef(!1);return(0,h.jsx)(fne,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:mf(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:mf(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`)),bne=m.forwardRef(j_(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=N_(n);return(0,h.jsx)(pne,{...i,...r,ref:t})},`DropdownMenuItem`)),xne=m.forwardRef(j_(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=N_(n);return(0,h.jsx)(mne,{...i,...r,ref:t})},`DropdownMenuSeparator`)),Sne=I_,Cne=R_,wne=z_,Tne=yne,Ene=bne,Dne=xne,One=Object.defineProperty,kne=m.forwardRef(((e,t)=>One(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,h.jsx)(Wd.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),Ane=Object.defineProperty,B_=(e,t)=>Ane(e,`name`,{value:t,configurable:!0}),V_=`Popover`,[H_,jne]=Yd(V_,[Pg]),U_=Pg(),[Mne,W_]=H_(V_),G_=B_(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=U_(t),c=m.useRef(null),[l,u]=m.useState(!1),[d,f]=Of({prop:r,defaultProp:i??!1,onChange:a,caller:V_});return(0,h.jsx)(zg,{...s,children:(0,h.jsx)(Mne,{scope:t,contentId:Kf(),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`),K_=`PopoverAnchor`,q_=m.forwardRef(B_(function(e,t){let{__scopePopover:n,...r}=e,i=W_(K_,n),a=U_(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return m.useEffect(()=>(o(),()=>s()),[o,s]),(0,h.jsx)(Bg,{...a,...r,ref:t})},`PopoverAnchor`)),J_=`PopoverTrigger`,Y_=m.forwardRef(B_(function(e,t){let{__scopePopover:n,...r}=e,i=W_(J_,n),a=U_(n),o=wd(t,i.triggerRef),s=(0,h.jsx)(Wd.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":cv(i.open),...r,ref:o,onClick:mf(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,h.jsx)(Bg,{asChild:!0,...a,children:s})},`PopoverTrigger`)),X_=`PopoverPortal`,[Z_,Q_]=H_(X_,{forceMount:void 0}),$_=B_(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=W_(X_,t);return(0,h.jsx)(Z_,{scope:t,forceMount:n,children:(0,h.jsx)(If,{present:n||a.open,children:(0,h.jsx)(Mp,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),ev=`PopoverContent`,tv=m.forwardRef(B_(function(e,t){let n=Q_(ev,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=W_(ev,e.__scopePopover);return(0,h.jsx)(If,{present:r||a.open,children:a.modal?(0,h.jsx)(rv,{...i,ref:t}):(0,h.jsx)(iv,{...i,ref:t})})},`PopoverContent`)),nv=Dd(`PopoverContent.RemoveScroll`),rv=m.forwardRef(B_(function(e,t){let n=W_(ev,e.__scopePopover),r=m.useRef(null),i=wd(t,r),a=m.useRef(!1);return m.useEffect(()=>{let e=r.current;if(e)return Im(e)},[]),(0,h.jsx)(Am,{as:nv,allowPinchZoom:!0,children:(0,h.jsx)(av,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:mf(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:mf(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:mf(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),iv=m.forwardRef(B_(function(e,t){let n=W_(ev,e.__scopePopover),r=m.useRef(!1),i=m.useRef(!1);return(0,h.jsx)(av,{...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`)),av=m.forwardRef(B_(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=W_(ev,n),p=U_(n);return Rp(),(0,h.jsx)(yp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,h.jsx)(sp,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,h.jsx)(Vg,{"data-state":cv(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`)),ov=`PopoverClose`,sv=m.forwardRef(B_(function(e,t){let{__scopePopover:n,...r}=e,i=W_(ov,n);return(0,h.jsx)(Wd.button,{type:`button`,...r,ref:t,onClick:mf(e.onClick,()=>i.onOpenChange(!1))})},`PopoverClose`));function cv(e){return e?`open`:`closed`}B_(cv,`getState`);var lv=G_,Nne=q_,Pne=Y_,Fne=$_,Ine=tv,Lne=sv,Rne=Object.defineProperty,zne=(e,t)=>Rne(e,`name`,{value:t,configurable:!0}),Bne=`Toggle`,Vne=m.forwardRef(zne(function(e,t){let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=Of({prop:n,onChange:i,defaultProp:r??!1,caller:Bne});return(0,h.jsx)(Wd.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:mf(e.onClick,()=>{e.disabled||s(!o)})})},`Toggle`)),Hne=Object.defineProperty,uv=(e,t)=>Hne(e,`name`,{value:t,configurable:!0}),dv=`ToggleGroup`,[fv,Une]=Yd(dv,[$g]),pv=$g(),Wne=m.forwardRef(uv(function(e,t){let{type:n,...r}=e;if(n===`single`)return(0,h.jsx)(Gne,{role:`radiogroup`,...r,ref:t});if(n===`multiple`)return(0,h.jsx)(Kne,{role:`toolbar`,...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${dv}\``)},`ToggleGroup`)),[mv,hv]=fv(dv),Gne=m.forwardRef(uv(function(e,t){let{value:n,defaultValue:r,onValueChange:i=uv(()=>{},`onValueChange`),...a}=e,[o,s]=Of({prop:n,defaultProp:r??``,onChange:i,caller:dv});return(0,h.jsx)(mv,{scope:e.__scopeToggleGroup,type:`single`,value:m.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:m.useCallback(()=>s(``),[s]),children:(0,h.jsx)(gv,{...a,ref:t})})},`ToggleGroupImplSingle`)),Kne=m.forwardRef(uv(function(e,t){let{value:n,defaultValue:r,onValueChange:i=uv(()=>{},`onValueChange`),...a}=e,[o,s]=Of({prop:n,defaultProp:r??[],onChange:i,caller:dv}),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)(mv,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,h.jsx)(gv,{...a,ref:t})})},`ToggleGroupImplMultiple`)),[qne,Jne]=fv(dv),gv=m.forwardRef(uv(function(e,t){let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=pv(n),u=Xf(o),d={dir:u,...c};return(0,h.jsx)(qne,{scope:n,rovingFocus:i,disabled:r,children:i?(0,h.jsx)(i_,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,h.jsx)(Wd.div,{...d,ref:t})}):(0,h.jsx)(Wd.div,{...d,ref:t})})},`ToggleGroupImpl`)),_v=`ToggleGroupItem`,Yne=m.forwardRef(uv(function(e,t){let n=hv(_v,e.__scopeToggleGroup),r=Jne(_v,e.__scopeToggleGroup),i=pv(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)(a_,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,h.jsx)(vv,{...s,ref:t})}):(0,h.jsx)(vv,{...s,ref:t})},`ToggleGroupItem`)),vv=m.forwardRef(uv(function(e,t){let{__scopeToggleGroup:n,value:r,...i}=e,a=hv(_v,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0},s=a.type===`single`?o:void 0;return(0,h.jsx)(Vne,{...s,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})},`ToggleGroupItemImpl`));function yv({variant:e=`secondary`,size:t=`default`}={}){return z(`sl-btn`,`sl-btn--${e}`,t===`small`&&`sl-btn--small`)}function B({variant:e=`secondary`,size:t=`default`,disabledReason:n,focusableWhenDisabled:r=!1,className:i,type:a,title:o,disabled:s,onClick:c,children:l,...u}){let d=(0,m.useId)(),f=z(yv({variant:e,size:t}),i),p=s===!0&&n!==``?n:void 0;if(p===void 0||!r)return(0,h.jsx)(`button`,{"data-slot":`button`,"data-variant":e,type:a??`button`,title:p??o,disabled:s,onClick:c,className:f,...u,children:l});let g=[u[`aria-describedby`],d].filter(Boolean).join(` `);return(0,h.jsxs)(`button`,{"data-slot":`button`,"data-variant":e,type:a??`button`,className:f,...u,"aria-disabled":`true`,"aria-describedby":g,"data-tip":p,"data-reason":``,onClick:e=>e.preventDefault(),onPointerDown:e=>e.preventDefault(),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.preventDefault()},children:[l,(0,h.jsx)(`span`,{id:d,hidden:!0,children:p})]})}function bv({label:e,tip:t,title:n,children:r,...i}){let a=t===!1?void 0:typeof t==`string`?t:e;return(0,h.jsx)(B,{variant:`icon`,"aria-label":e,...a===void 0?{title:n??e}:{"data-tip":a},...i,children:r})}function xv({className:e,asChild:t=!1,type:n,...r}){let i=t?Od:`button`;return(0,h.jsx)(i,{"data-slot":`play-key`,...t?{}:{type:n??`button`},className:z(`sl-key`,e),...r})}function Sv({className:e,...t}){return(0,h.jsx)(`div`,{className:z(`sl-btn-row`,e),...t})}var Xne=5e3,Zne=15e3;function Qne(e,t){if(e!==`error`)return t===void 0?Xne:Zne}var Cv=(0,m.createContext)(void 0);function $ne({children:e}){let[t,n]=(0,m.useState)([]),r=(0,m.useRef)(0),i=(0,m.useRef)(new Map),a=(0,m.useRef)({hover:!1,focus:!1}),o=(0,m.useCallback)(e=>{n(t=>t.filter(t=>t.id!==e));let t=i.current.get(e);t?.handle!==void 0&&clearTimeout(t.handle),i.current.delete(e)},[]),s=(0,m.useCallback)((e,t)=>{t.startedAt=Date.now(),t.handle=setTimeout(()=>o(e),t.remaining)},[o]),c=(0,m.useCallback)((e,t)=>{let n=a.current.hover||a.current.focus;a.current={...a.current,[e]:t};let r=a.current.hover||a.current.focus;if(n!==r)for(let[e,t]of i.current)r?(t.handle!==void 0&&clearTimeout(t.handle),t.handle=void 0,t.remaining=Math.max(0,t.remaining-(Date.now()-t.startedAt))):(t.remaining=Math.max(t.remaining,2e3),s(e,t))},[s]),l=(0,m.useCallback)((e,t=`info`,o)=>{r.current+=1;let c=r.current;n(n=>{let r=n.filter(t=>t.message!==e);for(let e of r.slice(0,Math.max(0,r.length-2))){let t=i.current.get(e.id);t?.handle!==void 0&&clearTimeout(t.handle),i.current.delete(e.id)}return[...r.slice(-2),{id:c,message:e,tone:t,action:o}]});let l=Qne(t,o);if(l===void 0)return;let u={remaining:l,startedAt:Date.now(),handle:void 0};i.current.set(c,u),a.current.hover||a.current.focus||s(c,u)},[s]);(0,m.useEffect)(()=>{t.length===0&&(a.current={hover:!1,focus:!1})},[t.length]),(0,m.useEffect)(()=>{let e=i.current;return()=>{for(let t of e.values())t.handle!==void 0&&clearTimeout(t.handle)}},[]);let u=(0,m.useMemo)(()=>l,[l]),d=t.filter(e=>e.tone!==`error`),f=t.filter(e=>e.tone===`error`),p=e=>(0,h.jsx)(ere,{toast:e,dismiss:()=>o(e.id)},e.id);return(0,h.jsxs)(Cv.Provider,{value:u,children:[e,(0,h.jsxs)(`section`,{"aria-label":`Notifications`,className:`sl-toasts`,onPointerEnter:()=>c(`hover`,!0),onPointerLeave:()=>c(`hover`,!1),onFocus:()=>c(`focus`,!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||c(`focus`,!1)},children:[(0,h.jsx)(`div`,{"aria-live":`assertive`,"aria-relevant":`additions text`,className:`sl-toasts__list`,children:f.map(p)}),(0,h.jsx)(`div`,{"aria-live":`polite`,"aria-relevant":`additions text`,className:`sl-toasts__list`,children:d.map(p)})]})]})}function ere({toast:e,dismiss:t}){return(0,h.jsxs)(`div`,{"data-tone":e.tone,className:z(`sl-toast sl-enter`,e.tone===`error`&&`sl-toast--failed`,e.tone===`success`&&`sl-toast--done`),children:[e.tone===`error`?(0,h.jsx)(Sl,{"aria-hidden":`true`,strokeWidth:1.75}):e.tone===`success`?(0,h.jsx)(Ac,{"aria-hidden":`true`,strokeWidth:1.75}):(0,h.jsx)(el,{"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)(B,{variant:`quiet`,size:`small`,onClick:()=>{t(),e.action?.run()},children:e.action.label}),(0,h.jsx)(`button`,{type:`button`,"aria-label":`Dismiss notification`,onClick:t,className:`sl-btn sl-btn--icon sl-btn--small -mr-1 w-[30px]`,children:(0,h.jsx)(kl,{"aria-hidden":`true`,strokeWidth:1.75})})]})}function wv(){return(0,m.useContext)(Cv)??tre}function tre(){}var Tv=(0,m.createContext)(void 0);function nre({deps:e,children:t}){return(0,h.jsx)(Tv.Provider,{value:e,children:(0,h.jsx)($ne,{children:t})})}function V(){let e=(0,m.useContext)(Tv);if(e===void 0)throw Error(`useApp was called outside AppProvider`);return e}var Ev=`Slopify`,Dv,Ov=[];function kv(){if(typeof document>`u`)return;let e=Ov.at(-1)?.title??Dv;document.title=e===void 0||e===``?Ev:`${e} · ${Ev}`}function Av(e){Dv=e,kv()}function jv(e){(0,m.useEffect)(()=>{if(e===void 0||e===``)return;let t={title:e};return Ov.push(t),kv(),()=>{Ov.splice(Ov.indexOf(t),1),kv()}},[e])}function Mv(e){return[[/^\/$/,`Home`],[/^\/projects\/?$/,`Projects`],[/^\/projects\/[^/]+/,`Project`],[/^\/play/,`Create`],[/^\/calendar/,`Calendar`],[/^\/schedules/,`Calendar`],[/^\/channels\/?$/,`Channels`],[/^\/channels\/[^/]+/,`Channel`],[/^\/prompts/,`Library · Prompts`],[/^\/entries/,`Library · Intros and outros`],[/^\/templates/,`Library · Templates`],[/^\/document-themes/,`Library · Documents`],[/^\/narration-aliases/,`Library · Narration aliases`],[/^\/ab-results/,`Library · A/B results`],[/^\/settings/,`Settings`],[/^\/help/,`Tutorials`],[/^\/welcome/,`Welcome`]].find(([t])=>t.test(e))?.[1]}var Nv=Hm,Pv=Km;function Fv({className:e,...t}){return(0,h.jsx)(Jm,{"data-slot":`dialog-overlay`,className:z(`fixed inset-0 z-40 bg-scrim`,e),...t})}function Iv({className:e,children:t,...n}){return(0,h.jsxs)(Pv,{children:[(0,h.jsx)(Fv,{}),(0,h.jsx)(Qm,{"data-slot":`dialog-content`,className:z(`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 Lv({className:e,...t}){return(0,h.jsx)(eh,{"data-slot":`dialog-title`,className:z(`sl-dialog__title text-ink`,e),...t})}function Rv({className:e,...t}){return(0,h.jsx)(Eee,{"data-slot":`dialog-description`,className:z(`m-0 text-body text-ink-2`,e),...t})}function zv({open:e,onOpenChange:t,title:n,description:r,footer:i,children:a,className:o,dismissible:s=!0}){return(0,h.jsx)(Nv,{open:e,...t===void 0?{}:{onOpenChange:t},children:(0,h.jsxs)(Iv,{className:o,...s?{}:{onEscapeKeyDown:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault()},...r===void 0?{"aria-describedby":void 0}:{},children:[(0,h.jsx)(Lv,{children:n}),r===void 0?null:(0,h.jsx)(Rv,{children:r}),a,i===void 0?null:(0,h.jsx)(`div`,{className:`sl-dialog__foot`,children:i})]})})}function Bv({open:e,title:t,consequence:n,confirmLabel:r,cancelLabel:i,tone:a=`destructive`,pending:o=!1,onConfirm:s,onCancel:c}){return(0,h.jsx)(zv,{open:e,onOpenChange:e=>{e||c()},title:t,description:n,footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(B,{variant:`secondary`,autoFocus:!0,onClick:c,children:i??(a===`destructive`?`Keep it`:`Cancel`)}),(0,h.jsx)(B,{variant:a,disabled:o,disabledReason:`Working on it`,onClick:s,children:r})]})})}var Vv=[`onboarding`],Hv=[`onboarding`,`sample`],Uv=(e,t)=>[`narration-peaks`,e,t],Wv=(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 Gv(e){return R(await e.fetch(`${e.origin}/api/onboarding`))}async function Kv(e){await R(await Wv(e,`/dismiss`))}async function qv(e,t){return R(await Wv(e,`/packs/${encodeURIComponent(t)}`))}async function Jv(e,t){return R(await Wv(e,`/short`,t))}async function Yv(e,t){return R(await Wv(e,`/full-video`,t))}async function Xv(e){return R(await e.fetch(`${e.origin}/api/onboarding/sample`))}function Zv(e,t){return e!==void 0&&Object.values(e.samples).includes(t)}async function Qv(e){return R(await Wv(e,`/sample/restore`))}async function $v(e,t=ey()){return R(await Wv(e,`/sample/copy`,t===void 0?void 0:{projectId:t}))}function ey(){if(typeof window>`u`)return;let e=/\/projects\/([^/?#]+)/.exec(window.location.pathname);return e?.[1]===void 0?void 0:decodeURIComponent(e[1])}async function ty(e,t){return R(await e.fetch(`${e.origin}/api/projects/${encodeURIComponent(t)}/narration/peaks`))}var H={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]},ny=15e3,ry=new Set([`running`,`pending`]);function iy(e){return at({queryKey:H.projects,queryFn:()=>Ao(e),refetchInterval:e=>e.state.data?.projects.some(e=>ry.has(e.status))===!0&&ny,refetchIntervalInBackground:!1})}function ay(e,t){return at({queryKey:H.project(t),queryFn:()=>jo(e,t),refetchInterval:e=>e.state.data!==void 0&&ry.has(e.state.data.project.status)?ny:!1})}function oy(e,t){return at({queryKey:H.runCost(t),queryFn:()=>Mo(e,t)})}function sy(e){return at({queryKey:H.notice,queryFn:()=>Jo(e)})}function rre(e){return at({queryKey:H.usage,queryFn:()=>qo(e)})}function cy(e){return at({queryKey:H.providers,queryFn:()=>Zo(e)})}function ly(e){return at({queryKey:H.voices,queryFn:()=>As(e)})}function uy(e){return at({queryKey:H.prompts,queryFn:()=>Ls(e)})}function dy(e){return at({queryKey:H.entries,queryFn:()=>Ys(e)})}function fy(e){return at({queryKey:H.documentThemes,queryFn:()=>Zs(e)})}function py(e){return at({queryKey:H.narrationAliases,queryFn:()=>nc(e)})}function my(e){return at({queryKey:H.settings,queryFn:()=>ts(e)})}var ire={"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`}}},are={"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 dollars, such as 5 or 2.50. 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, and every Slopify tab open in it follows the same pick.`,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, PDF 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:`PDF 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`}}},ore={"play.output":{title:`What are you making?`,body:`Picks the stages the project uses. Video narrates images with captions. Article writes or takes text, with an optional PDF. Audiobook reads a text aloud. Podcast is a conversation between speakers. Images draws pictures from your prompts. Each choice turns on what it needs and folds the rest away; every stage can still be changed under its row.`,tutorial:{page:`Play-Overview`}},"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 project's name in Slopify, shown on the project and in Projects. For a YouTube video it is also the YouTube title unless the YouTube text writes its own, and YouTube takes at most 100 characters there, without < or >. 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 delete. 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:`Write it for me has the text model write the article from the article prompt, one call. Use my text as written narrates text you paste, word for word, with no text-model cost. Adapt my text has the article prompt rewrite text you paste, one call. No text is for images only. The article is what the narration reads and the PDF lays out. Default: Write it for me.`,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 → Narration 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 (audiobooks) keeps the article as written and has the text model hand its narration and dialogue to the speakers, one extra call. Adapt the article (podcasts, interviews, dramas) also keeps the article as written; one extra call rewrites it as a conversation for the speakers, kept beside it as the script.`,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 → PDF themes. 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.reviewer":{title:`Who reviews`,body:`Model: Slopify asks the reviewer model below, one paid call per item. External agent (MCP): an agent connected in Settings → Connections → Agents (MCP) answers each review instead, at no API cost. A review nobody answers within 2 hours passes on its own, and a notification says so.`,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, PDF 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 canceled, 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`}}},sre={"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.remove-breaths":{title:`Soften breaths`,body:`Turns the audible in-breaths between sentences and after commas down by 12 dB, with soft fades. A breath with any word sound in it is left as it is, and every word, pause and caption stays where it was. Runs on this computer, no API calls; turning it on joins the narration again from its pieces, never makes the speech again. Default: off.`,tutorial:{page:`Editing-a-Project`,anchor:`pauses-and-volume`}},"project.soften-s":{title:`Soften S sounds`,body:`Puts each narration piece through a very light de-esser, which takes the sharp edge off s and sh sounds while the voice keeps its brightness. Works with or without Soften breaths. Runs on this computer, no API calls; turning it on joins the narration again from the pieces it already has, never makes the speech again. Default: off.`,tutorial:{page:`Editing-a-Project`,anchor:`pauses-and-volume`}},"project.level-sentences":{title:`Level each sentence`,body:`Holds each sentence to the sentences in the minute around it, so no line jumps out or drops away: loud ones come down by up to 6 dB, quiet ones up by up to 3 dB, and the volume only changes in the pauses. Runs before Soften breaths and Soften S sounds. Needs Level the volume and one voice. Joins the narration again, never makes the speech again. Default: off.`,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 378 MB (Settings → Production defaults → Subtitle timing model offers smaller ones). 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, Free drops the working files it was made from (narration parts, timing, render settings) and keeps what gets published, the video's and shorts' images and anything you uploaded. Delete old versions removes its History folder (earlier renders and narration). Each button says how much it frees. Changing the project or going back to an old version makes those files again.`,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`}}},cre={"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:`Antigravity CLI`,body:`Writes the text with Google's Antigravity command-line tool (agy), which replaced the Gemini CLI, using your own Google sign-in, so no API key is needed. Install it from antigravity.google, then run agy in a terminal once to sign in. It researches with web search and can look at pictures, but never opens web pages or runs commands. 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.subtitle-model":{title:`Subtitle timing model`,body:`The speech model that times English captions on this computer. Most accurate (378 MB) hears the narration best and on most computers runs faster too; Smallest (95 MB) can mishear a line and stop the run. The chosen model downloads once, on first use; switching back reuses one already downloaded. Changing it never marks subtitles outdated. Default: Most accurate.`,tutorial:{page:`Settings-Reference`,anchor:`subtitle-timing-model`}},"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.agents":{title:`Agents (MCP)`,body:`An AI agent on this computer, such as Claude Code or Codex, can run Slopify through this address: start and fix runs, edit the Library and answer reviews set to External agent. It needs no key, like this page, and never uploads to YouTube. What it changes is marked by agent in the project's history, in notifications and in the list below.`,tutorial:{page:`Agents-MCP`,anchor:`connect-an-agent`}},"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, nothing is fetched from a store. Chrome, Edge and Brave load it once with Load unpacked (Developer mode) from the folder shown here: Slopify puts each new version there when it updates, and the extension switches to it by itself after 45 minutes without use. Firefox 128 or newer loads the downloaded zip as a temporary add-on, which it forgets on restart. Then pair it with the token above.`,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:`Clear leftover 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:`clear-leftover-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:`Free disk space`,body:`Delete old versions removes a project's History folder (earlier renders and narration). Keep outputs only removes a finished project's working files (narration parts, timing, render settings). Clean up everything does both for every project; running or unfinished ones keep everything. The current video, shorts, their images, thumbnail, documents and your uploads always stay. Remaking a project or going back to an old version makes the files again.`,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. Channels, cast members, PDF themes and episode summaries never come here: deleting one removes it permanently.`,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, paused runs, topics a schedule suggested for you to accept or reject, and runs that failed with the fix to try; then finished videos you have not marked uploaded. Nothing here moves on until you act: approving a review from here lets that run continue, and Mark uploaded takes a finished video off the list (Projects still has it).`,tutorial:{page:`Home-and-Projects`,anchor:`needs-you`}},"home.running":{title:`Running now`,body:`Videos being made, and runs Waiting for the agent: an External agent reviews something they made, and they carry on once it answers or after 2 hours. Each shows the step it 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.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 Antigravity 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`}}},lre={...ore,...sre,...ire,...are,...cre};function hy(e,t){let n=lre[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 ure(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 gy(e){return e.toLowerCase().replace(/[^\p{L}\p{N}\p{M} _-]/gu,``).replace(/ /g,`-`)}var dre=`/help/tutorials`;function _y(e,t){return`${dre}/${encodeURIComponent(e)}${t?`#${t}`:``}`}function fre(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)?`](${_y(a,i)})`:e})}function pre(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 mre(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 hre(e,t,n=[]){let r=new Map;for(let e of n){let t=gy(ure(e));r.set(t,(r.get(t)??0)+1)}for(let n of e.querySelectorAll(`h1, h2, h3, h4, h5, h6`)){let e=gy((n.textContent??``).trim()),i=r.get(e)??0;if(r.set(e,i+1),(i===0?e:`${e}-${String(i)}`)===t)return n}}var vy=lv,yy=Pne,gre=Nne,_re=Lne;function by({className:e,align:t=`start`,sideOffset:n=6,...r}){return(0,h.jsx)(Fne,{children:(0,h.jsx)(Ine,{"data-slot":`popover-content`,align:t,sideOffset:n,collisionPadding:12,className:z(`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 U({id:e,label:t,vars:n,className:r}){let i=hy(e,n);return(0,h.jsxs)(vy,{children:[(0,h.jsx)(yy,{type:`button`,"aria-label":`About ${t??i.title}`,"data-help-id":e,className:z(`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)(el,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,h.jsxs)(by,{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
52
|
`).map(e=>(0,h.jsx)(`p`,{className:`m-0`,children:e},e)),i.tutorial===void 0?null:(0,h.jsx)(vre,{tutorial:i.tutorial})]})]})}function vre({tutorial:e}){let t=mi({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)(Sc,{"aria-hidden":`true`,className:`size-[13px]`})]});return t?(0,h.jsx)(_re,{asChild:!0,children:(0,h.jsx)(fa,{to:`/help/tutorials/$page`,params:{page:e.page},...e.anchor===void 0?{}:{hash:e.anchor},className:n,children:r})}):(0,h.jsx)(`a`,{href:_y(e.page,e.anchor),className:n,children:r})}var xy={"data-help-scope":``};function Sy({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:z(`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:z(`flex items-center gap-2`,l&&`flex-wrap items-baseline gap-x-3 gap-y-0`),children:[(0,h.jsx)(a,{id:s,className:z(`sl-section-head__title`,o===`small`&&`text-title-3`),children:e}),r===void 0?null:(0,h.jsx)(U,{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 Cy({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:z(`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`,...xy,children:[c,(0,h.jsx)(U,{id:o,label:s??(typeof n==`string`?n:void 0)})]})}function wy({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:z(`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`,...xy,children:[s,(0,h.jsx)(U,{id:a,label:r})]})}var Ty=[`settings`,`autostart`],Ey=(e,t=``)=>`${e.origin}/api/settings/autostart${t}`;async function Dy(e){return R(await e.fetch(Ey(e)))}async function yre(e,t){return R(await e.fetch(Ey(e),{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({enabled:t})}))}async function bre(e){return R(await e.fetch(Ey(e,`/answer`),{method:`POST`}))}var Oy=`Start Slopify when I log in`;function xre(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function ky(){let{api:e}=V(),t=_();return{view:I({queryKey:Ty,queryFn:()=>Dy(e)}),turn:L({mutationFn:t=>yre(e,t),onSuccess:e=>t.setQueryData(Ty,e)}),decline:L({mutationFn:()=>bre(e),onSuccess:e=>t.setQueryData(Ty,e)})}}function Sre(){let{view:e,turn:t}=ky(),n=e.data;return(0,h.jsxs)(`div`,{...xy,children:[(0,h.jsx)(Sy,{title:Oy,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)(Ay,{view:n}):(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(Cy,{label:Oy,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 Ay({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 `,xre(e.checkedAt),`.`]})]})}function Cre(){let{view:e,turn:t,decline:n}=ky();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)(Sy,{title:Oy,info:`settings.autostart`}),(0,h.jsx)(`div`,{className:`mb-6`,children:(0,h.jsx)(Ay,{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)(Sy,{title:Oy,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)(B,{variant:`primary`,disabled:t.isPending||n.isPending,onClick:()=>t.mutate(!0),children:`Start when I log in`}),(0,h.jsx)(B,{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 wre(){let{api:e}=V(),t=Va({select:e=>e.pathname}),{view:n,turn:r,decline:i}=ky(),a=I(sy(e)),o=I({queryKey:Vv,queryFn:()=>Gv(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)(zv,{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)(B,{variant:`secondary`,disabled:c,onClick:()=>i.mutate(),children:`No thanks`}),(0,h.jsx)(B,{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 Tre(){let{api:e}=V(),t=I({queryKey:Ty,queryFn:()=>Dy(e),retry:!1,staleTime:1/0}).data?.kind;(0,m.useEffect)(()=>{t!==void 0&&go(t)},[t])}var jy=`00000000-0000-4000-8000-000000000001`,My=[`character`,`creature`,`place`,`object`],Ny={character:`Character`,creature:`Creature`,place:`Place`,object:`Object`},Py=[`channels`],Fy=e=>[`channels`,e],Iy=e=>`${e.origin}/api/channels`,Ly=(e,t)=>({method:e,headers:{"content-type":`application/json`},body:JSON.stringify(t)});function Ry(e){return at({queryKey:Py,queryFn:async()=>(await R(await e.fetch(Iy(e)))).channels})}function zy(e,t){return at({queryKey:Fy(t),queryFn:async()=>R(await e.fetch(`${Iy(e)}/${t}`)),refetchInterval:e=>e.state.data?.cast.some(e=>e.images.some(e=>e.state===`generating`))?3e3:!1})}async function Ere(e,t,n){return R(await e.fetch(Iy(e),Ly(`POST`,{id:t,name:n})))}async function By(e,t,n){return R(await e.fetch(`${Iy(e)}/${t}`,Ly(`PUT`,n)))}async function Vy(e,t){let n=await e.fetch(`${Iy(e)}/${t}`,{method:`DELETE`});n.ok||await R(n)}async function Hy(e,t,n,r){return R(await e.fetch(`${Iy(e)}/${t}/cast`,Ly(`POST`,{id:n,...r})))}async function Dre(e,t,n){return R(await e.fetch(`${Iy(e)}/cast/${t}`,Ly(`PUT`,n)))}async function Ore(e,t){let n=await e.fetch(`${Iy(e)}/cast/${t}`,{method:`DELETE`});n.ok||await R(n)}async function kre(e,t,n,r){return(await R(await e.fetch(`${Iy(e)}/${t}/cast/move`,Ly(`POST`,{memberId:n,to:r})))).cast}async function Are(e,t,n){return R(await e.fetch(`${Iy(e)}/cast/${t}/images`,{method:`POST`,headers:{"content-type":n.type||`application/octet-stream`},body:n}))}async function jre(e,t,n){return R(await e.fetch(`${Iy(e)}/cast/${t}/generate`,Ly(`POST`,n)))}async function Mre(e,t,n){let r=await e.fetch(`${Iy(e)}/cast/${t}/images/${n}`,{method:`DELETE`});r.ok||await R(r)}async function Nre(e,t,n){await R(await e.fetch(`${Iy(e)}/templates/${t}`,Ly(`PUT`,{channelId:n})))}async function Pre(e,t,n){return R(await e.fetch(`${Iy(e)}/${t}/ai-disclosure`,Ly(`PUT`,{aiDisclosure:n})))}function Uy(e,t){return`${Iy(e)}/pictures/${t}`}var Wy=`slopify.channel`,Gy=(0,m.createContext)(void 0);function Ky(){try{let e=window.localStorage.getItem(Wy);return e===null||e===``?null:e}catch{return null}}function Fre({children:e}){let{api:t}=V(),n=I(Ry(t)),[r,i]=(0,m.useState)(Ky),a=n.data??[],o=r!==null&&n.data!==void 0&&!a.some(e=>e.id===r)?null:r;(0,m.useEffect)(()=>{let e=e=>{(e.key===Wy||e.key===null)&&i(Ky())};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]);let s=(0,m.useCallback)(e=>{i(e);try{e===null?window.localStorage.removeItem(Wy):window.localStorage.setItem(Wy,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)(Gy,{value:c,children:e})}var Ire={channelId:null,channel:void 0,channels:[],setChannelId:()=>{},includes:()=>!0};function qy(){return(0,m.useContext)(Gy)??Ire}function Jy({className:e}){let t=qy(),n=(0,m.useId)();return(0,h.jsxs)(`div`,{className:z(`flex flex-col gap-1`,e),...xy,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)(U,{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 Lre=1500,Rre=2e4,zre=4e3;function Bre(e){return window.addEventListener(`online`,e),window.addEventListener(`offline`,e),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,e)}}function Vre(){return typeof navigator>`u`||navigator.onLine!==!1}function Hre(e){let t=(0,m.useSyncExternalStore)(Bre,Vre,()=>!0),[n,r]=(0,m.useState)(`live`),i=(0,m.useRef)(!1);i.current=n!==`live`&&n!==`back`;let a=!t||e===`lost`;return(0,m.useEffect)(()=>{if(!t){r(`offline`);return}if(e===`lost`){let e=setTimeout(()=>r(`reconnecting`),Lre),t=setTimeout(()=>r(`unreachable`),Rre);return()=>{clearTimeout(e),clearTimeout(t)}}if(!i.current){r(e=>e===`back`?e:`live`);return}r(`back`);let n=setTimeout(()=>r(`live`),zre);return()=>clearTimeout(n)},[t,e]),a&&n===`back`?`live`:n}var Ure={reconnecting:`Reconnecting… Numbers on this page may be out of date.`,unreachable:`Can't reach Slopify, so numbers on this page may be out of date. Check that Slopify is still running; this page reconnects by itself.`,offline:`Offline. Numbers on this page may be out of date until the connection is back.`,back:`Back online. The page is up to date.`};function Wre({connection:e}){let t=Hre(e),n=t===`back`?Ol:t===`reconnecting`?ml:Rc;return(0,h.jsx)(`div`,{"aria-live":`polite`,className:`sl-connection-slot`,children:t===`live`?null:(0,h.jsxs)(`p`,{"data-view":t,className:z(`sl-connection sl-enter`,t!==`back`&&`sl-connection--down`),children:[(0,h.jsx)(n,{"aria-hidden":`true`,strokeWidth:1.75}),Ure[t]]})})}var Gre=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()}},Yy=(0,m.createContext)(void 0);function Xy(e){let t=(0,m.useContext)(Yy),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 Zy(e,t){let n=[`/`];return Xy({id:`list.search`,title:`Search ${t}`,group:`This page`,keywords:[`find`,`filter`],shortcut:n,run:()=>{e.current?.focus(),e.current?.select()}}),n}function Qy(){return(0,m.useContext)(Yy)??{open:!1,setOpen:Kre}}function Kre(){}function qre(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 $y(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 eb(e,t,n){let r=null;for(let i of t){let t=qre(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 tb(e,t){if(e.length===0)return 0;let n=eb(e.join(` `),t,!1);if(e.length===1)return n;let r=0;for(let i of e){let e=eb(i,t,!0);if(e===null)return n;r+=e}return n===null?r:Math.max(n,r)}function Jre(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=tb([...r.slice(0,s),...r.slice(s+1)],$y(e));c!==null&&a.push({command:{...e,title:o(n),run:()=>e.run(n)},score:c,order:t});return}let s=tb(r,$y(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 nb=`slopify.palette.recent`,rb=5;function ib(){try{let e=JSON.parse(window.localStorage.getItem(nb)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e==`string`).slice(0,rb):[]}catch{return[]}}function Yre(e){try{let t=[e,...ib().filter(t=>t!==e)].slice(0,rb);window.localStorage.setItem(nb,JSON.stringify(t))}catch{}}var ab=`recent:`;function Xre(e,t,n,r){if(r.trim()!==``||n.length===0)return e;let i=new Map(t.map(e=>[e.id,e])),a=n.map(e=>i.get(e)).filter(e=>e!==void 0&&e.numbered===void 0).map(e=>({...e,id:`${ab}${e.id}`,group:`Recent`})),o=new Set(n);return[...a,...e.filter(e=>!o.has(e.id))]}var Zre=new Set([`Ctrl`,`Alt`,`Shift`]);function ob(e){return{mod:e.includes(`Ctrl`),alt:e.includes(`Alt`),shift:e.includes(`Shift`),keys:e.filter(e=>!Zre.has(e)).map(e=>e.toLowerCase())}}var sb=e=>!e.mod&&!e.alt&&!e.shift&&e.keys.length>1;function cb(e){if(e===void 0)return;let t=ob(e);if(sb(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 lb(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 ub(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 db=()=>document.querySelector(`[role="dialog"][data-state="open"], [role="alertdialog"]`)!==null;function fb(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 pb=1500;function mb({children:e,registry:t}){let[n]=(0,m.useState)(()=>t??new Gre),[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||db())return;let r=ub(t.target),a=fb(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<pb){let t=e.key,n=a.find(e=>{let n=ob(e.shortcut??[]);return sb(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=ob(e.shortcut??[]);return sb(n)||n.keys.length!==1||r&&!n.mod?!1:lb(n,n.keys[0]??``,t)});if(u!==void 0)return l(u);c&&!r&&!t.shiftKey&&a.some(e=>{let t=ob(e.shortcut??[]);return sb(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)(Yy.Provider,{value:c,children:[e,(0,h.jsx)(_b,{}),(0,h.jsx)(gb,{registry:n,open:a,onOpenChange:o})]})}function hb({shortcut:e}){let t=sb(ob(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 gb({registry:e,open:t,onOpenChange:n}){(0,m.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot);let r=new Set,i=fb(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)(zv,{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)(hb,{shortcut:e.keys})}),(0,h.jsx)(`dd`,{className:`m-0 min-w-0`,children:e.title})]},e.keys.join(`+`)))})})}function _b(){let e=(0,m.useContext)(Yy);return e===void 0?null:(0,h.jsx)(Hm,{open:e.open,onOpenChange:e.setOpen,children:(0,h.jsxs)(Km,{children:[(0,h.jsx)(Jm,{className:`sl-overlay`}),(0,h.jsxs)(Qm,{className:`sl-overlay-content sl-palette sl-enter`,"aria-describedby":void 0,children:[(0,h.jsx)(eh,{className:`sr-only`,children:`Command palette`}),(0,h.jsx)(vb,{registry:e.registry,close:()=>e.setOpen(!1)})]})]})})}function vb({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.useState)(ib),l=(0,m.useMemo)(()=>Xre(Jre(n,r),n,c,r),[n,r,c]),u=Math.min(a,Math.max(0,l.length-1)),d=(0,m.useRef)(null),f=(0,m.useMemo)(()=>{let e=new Map;return l.forEach((t,n)=>{let r=e.get(t.group)??[];r.push({command:t,index:n}),e.set(t.group,r)}),[...e.entries()]},[l]),p=e=>`${s}-option-${String(e)}`;(0,m.useEffect)(()=>{d.current?.querySelector(`[data-index="${String(u)}"]`)?.scrollIntoView?.({block:`nearest`})},[u]);let g=(0,m.useCallback)(e=>{e!==void 0&&(t(),e.numbered===void 0&&Yre(e.id.startsWith(ab)?e.id.slice(7):e.id),e.run())},[t]);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`div`,{className:`sl-palette__input`,children:[(0,h.jsx)(_l,{"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":l.length===0?void 0:p(u),"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(l.length===0?0:(u+1)%l.length)):e.key===`ArrowUp`?(e.preventDefault(),o(l.length===0?0:(u-1+l.length)%l.length)):e.key===`Home`?(e.preventDefault(),o(0)):e.key===`End`?(e.preventDefault(),o(Math.max(0,l.length-1))):e.key===`Enter`&&(e.preventDefault(),g(l[u]))}}),(0,h.jsx)(`span`,{className:`sl-kbd`,"aria-hidden":`true`,children:(0,h.jsx)(`kbd`,{children:`Esc`})})]}),(0,h.jsx)(`div`,{ref:d,id:s,role:`listbox`,"aria-label":`Commands`,className:`sl-palette__list`,children:l.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.`}):f.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:p(t),"data-index":t,role:`option`,tabIndex:-1,"aria-selected":t===u,className:`sl-palette__item`,onMouseMove:()=>{t!==u&&o(t)},onClick:()=>g(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)(hb,{shortcut:e.shortcut})]},e.id))]},e))})]})}var yb=[`16:9`,`9:16`,`1:1`],bb=[`research`,`article`,`audio`,`images`,`thumbnail`,`video`,`document`];function xb(e,t){return`${e}@${t??``}`}var Sb=[`running`,`paused`,`canceled`,`failed`,`partial`,`done`,`pending`],Cb=[`generate`,`provide`,`off`,`from_prompt`,`prompt_by_llm`];function wb(e,t){return e[t]??`off`}var Tb=[`zoom`,`pan`,`mixed`,`still`],Eb=[`text`,`llm`];function Db(e){if(e===`thumbnail:image`)return 1;let t=/^thumbnail:image:([23])$/.exec(e);return t===null?void 0:Number(t[1])}function Ob(e){return e.thumbnailCount===3&&(e.sources.thumbnail===`from_prompt`||e.sources.thumbnail===`prompt_by_llm`)?3:1}var kb=[`prompt`,`provide`],Ab=[`video`,`short`],jb=[`article`,`image`,`thumbnail`,`narration`,`description`,`shorts`,`review`,`script`],Mb=[`intro`,`outro`],Nb=1e5,Pb=Mb.map(e=>({value:e,label:Ib(e)})),Fb=Eb.map(e=>({value:e,label:Lb(e)}));function Ib(e){switch(e){case`intro`:return`Intro`;case`outro`:return`Outro`}}function Lb(e){switch(e){case`text`:return`Text`;case`llm`:return`LLM`}}function Rb(e){switch(e){case`text`:return`Text is narrated as written.`;case`llm`:return`LLM is an instruction whose answer is narrated.`}}function zb(e){switch(e){case`text`:return`No slots. This text is narrated as written.`;case`llm`:return`No slots. This instruction runs as written.`}}function Bb(e){return Mb.find(t=>t===e)??`intro`}var Vb=jb.map(e=>({value:e,label:Hb(e)}));function Hb(e){switch(e){case`article`:return`Article`;case`image`:return`Image`;case`thumbnail`:return`Thumbnail`;case`narration`:return`Narration Preparation`;case`description`:return`YouTube Description`;case`shorts`:return`Shorts`;case`review`:return`Review`;case`script`:return`Script (speakers)`}}function Ub(e){return jb.find(t=>t===e)??`article`}function Wb(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 Gb(e,t=`|`){return e.map(e=>ux(e)).join(t)}function Kb(e,t){return typeof t==`bigint`?t.toString():t}function qb(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Jb(e){return e==null}function Yb(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Xb(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 Zb(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Qb(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function $b(e){return JSON.stringify(e)}function ex(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var tx=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function nx(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var rx=qb(()=>{if(Yx.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ix(e){if(nx(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return nx(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ax(e){return ix(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ox=new Set([`string`,`number`,`symbol`]);function sx(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function cx(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function lx(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 ux(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function dx(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var fx={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function px(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 cx(e,Qb(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]&&Zb(e,r,n.shape[r])}return Zb(this,`shape`,e),e},checks:[]}))}function mx(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 cx(e,Qb(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 Zb(this,`shape`,r),r},checks:[]}))}function hx(e,t){if(!ix(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 cx(e,Qb(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Zb(this,`shape`,n),n}}))}function gx(e,t){if(!ix(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return cx(e,Qb(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Zb(this,`shape`,n),n}}))}function _x(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 cx(e,Qb(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Zb(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function vx(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 cx(t,Qb(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 Zb(this,`shape`,i),i},checks:[]}))}function yx(e,t,n){return cx(t,Qb(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 Zb(this,`shape`,i),i}}))}function bx(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 xx(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 Sx(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Cx(e){return typeof e==`string`?e:e?.message}function wx(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Tx(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:Cx(e.inst?._zod.def?.error?.(e))??Cx(a?.(e))??Cx(t?.error?.(e))??Cx(n.customError?.(e))??Cx(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 Ex=/[\uD800-\uDBFF]/;function Dx(e){let t=e.length;if(!Ex.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 Ox(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function kx(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 Ax(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function jx(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Px(e,n,r.value)}}function Mx(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Nx(e,t,n){return Mx(e,t,n,!1)}function Px(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Mx(this,t,n.bind(this))},set(e){Mx(this,t,e)}})}function Fx(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Ix,Lx=!1,Rx={configurable:!0,get(){Lx=!0}};function zx(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Ix!==e._zod){Ix=void 0;return}Ix=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Rx);let e=Lx;Lx=!1;try{let r=n(this);return Lx?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Lx||=e,r}catch(n){throw delete this[t],Lx||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Bx(e,t,n,r){let i=Fx(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 Vx=`~constantCatch`;function Hx(e){let t=()=>e;return t[Vx]=!0,t}var Ux,Wx={value:void 0,enumerable:!1},Gx=`captureStackTrace`in Error?Error:null;function Kx(e){let t=Gx;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Gx=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function W(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){Wx.value=new a(r);try{Object.defineProperty(n,"_zod",Wx)}finally{Wx.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),jx(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?Kx(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 qx=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Jx=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Ux=globalThis).__zod_globalConfig??(Ux.__zod_globalConfig={});var Yx=globalThis.__zod_globalConfig;function Xx(e){return e&&Object.assign(Yx,e),Yx}function Zx(){let e=this._zod;return e.message??=JSON.stringify(e.def,Kb,2),e.message}function Qx(e){this._zod.message=e}var $x={get:Zx,set:Qx,enumerable:!0,configurable:!0},eS={value:void 0,enumerable:!1},tS={value:void 0,enumerable:!1},nS=new WeakSet([Object.prototype,Error.prototype]),rS=(e,t)=>{e.name=`$ZodError`,eS.value=e._zod,Object.defineProperty(e,"_zod",eS),tS.value=t,Object.defineProperty(e,"issues",tS),eS.value=void 0,tS.value=void 0,Object.defineProperty(e,"message",$x);let n=Object.getPrototypeOf(e);nS.has(n)||(nS.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})}}))},iS=W(`$ZodError`,rS),aS=W(`$ZodError`,rS,void 0,{Parent:Error});function oS(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 sS(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?oS(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function cS(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 lS(e,t){return{callee:t?.callee??e,Err:t?.Err}}var uS=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 qx;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Tx(e,o,Xx())));throw tx(n,a?.callee??t),n}return s.value};return t},dS=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=>Tx(e,o,Xx())));throw tx(n,a?.callee??t),n}return s.value};return t},fS=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 qx;return a.issues.length?{success:!1,error:new(e??iS)(a.issues.map(e=>Tx(e,i,Xx())))}:{success:!0,data:a.value}},pS=fS(aS),mS=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=>Tx(e,i,Xx())))}:{success:!0,data:a.value}},hS=mS(aS),gS=e=>{let t=uS(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,lS(n,a))};return n},_S=e=>{let t=uS(e),n=(e,r,i,a)=>t(e,r,i,lS(n,a));return n},vS=e=>{let t=dS(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,lS(n,a))};return n},yS=e=>{let t=dS(e),n=async(e,r,i,a)=>await t(e,r,i,lS(n,a));return n},bS=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return fS(e)(t,n,i)},xS=e=>(t,n,r)=>fS(e)(t,n,r),SS=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return mS(e)(t,n,i)},CS=e=>async(t,n,r)=>mS(e)(t,n,r),wS=/^[cC][0-9a-z]{6,}$/,TS=/^[0-9a-z]+$/,ES=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,DS=/^[0-9a-vA-V]{20}$/,OS=/^[A-Za-z0-9]{27}$/,kS=/^[a-zA-Z0-9_-]{21}$/;function AS(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var jS=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,MS=/^([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})$/,NS=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)$/,PS=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,FS=`^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function IS(){return new RegExp(FS,`u`)}var LS=/^(?:(?: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])$/,RS=/^(([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}|:))$/,zS=/^((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])$/,BS=/^(([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])$/,VS=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,HS=/^[A-Za-z0-9_-]*$/,US=/^https?$/,WS=/^\+[1-9]\d{6,14}$/,GS=`(?:(?:\\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 KS(e){return RegExp(`^${e}$`)}var qS=KS(GS);function JS(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 YS(e){return RegExp(`^${JS(e)}$`)}function XS(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${JS({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${JS({precision:e.precision})}`:n;return RegExp(`^${GS}T(?:${r})$`)}var ZS=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},QS=/^-?\d+$/,$S=/^-?\d+(?:\.\d+)?$/,Qre=/^(?:true|false)$/i,$re=/^null$/i,eie=/^[^A-Z]*$/,tie=/^[^a-z]*$/,eC=W(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),tC=e=>{let t=e.value;return!Jb(t)&&t.length!==void 0},nC={number:`number`,bigint:`bigint`,object:`date`},rC=W(`$ZodCheckLessThan`,(e,t)=>{eC.init(e,t);let n=nC[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:nC[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})}}),iC=W(`$ZodCheckGreaterThan`,(e,t)=>{eC.init(e,t);let n=nC[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:nC[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})}}),nie=W(`$ZodCheckMultipleOf`,(e,t)=>{eC.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):Xb(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})}}),rie=W(`$ZodCheckNumberFormat`,(e,t)=>{eC.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=fx[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=QS)}),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})}}),iie=W(`$ZodCheckMaxLength`,(e,t)=>{var n;eC.init(e,t),(n=e._zod.def).when??(n.when=tC),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?Dx(r):i)<=t.maximum)return;let a=Ox(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),aie=W(`$ZodCheckMinLength`,(e,t)=>{var n;eC.init(e,t),(n=e._zod.def).when??(n.when=tC),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?Dx(r):i)>=t.minimum)return;let a=Ox(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),oie=W(`$ZodCheckLengthEquals`,(e,t)=>{var n;eC.init(e,t),(n=e._zod.def).when??(n.when=tC),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?Dx(r):i;if(a===t.length)return;let o=Ox(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})}}),aC=W(`$ZodCheckStringFormat`,(e,t)=>{var n,r;eC.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=()=>{})}),sie=W(`$ZodCheckRegex`,(e,t)=>{aC.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})}}),cie=W(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=eie,aC.init(e,t)}),lie=W(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=tie,aC.init(e,t)}),uie=W(`$ZodCheckIncludes`,(e,t)=>{eC.init(e,t);let n=sx(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})}}),die=W(`$ZodCheckStartsWith`,(e,t)=>{eC.init(e,t);let n=RegExp(`^${sx(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})}}),fie=W(`$ZodCheckEndsWith`,(e,t)=>{eC.init(e,t);let n=RegExp(`.*${sx(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})}}),pie=W(`$ZodCheckOverwrite`,(e,t)=>{eC.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),mie=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(`
|
|
@@ -101,7 +101,7 @@ Error generating stack: `+e.message+`
|
|
|
101
101
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}e.external&&(e.sharedDefsExtractedFor=e.external)}function ow(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;ow(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var sw=new Set([`type`,`properties`,`required`,`additionalProperties`]),cw=[`oneOf`,`anyOf`];function lw(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function uw(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!sw.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??lw(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}Zb(n,r,e.length===1?e[0]:uw(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=lw(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function boe(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of sw)if(t in e)return;let n=t.filter(e=>cw.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=uw(t);else{let e=n[0],i=cw.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>uw([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,ew(e,r))}function dw(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):ew(i,s),ew(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())ow(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])boe(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}ew(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,Zb(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:pw(t,`input`,e.processors),output:pw(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function fw(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return fw(r.element,n);if(r.type===`set`)return fw(r.valueType,n);if(r.type===`lazy`)return fw(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return fw(r.innerType,n);if(r.type===`intersection`)return fw(r.left,n)||fw(r.right,n);if(r.type===`record`||r.type===`map`)return fw(r.keyType,n)||fw(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:fw(r.in,n)||fw(r.out,n);if(r.type===`object`){for(let e in r.shape)if(fw(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(fw(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(fw(e,n))return!0;return!!(r.rest&&fw(r.rest,n))}return!1}var xoe=(e,t={})=>n=>{let r=tw({...n,processors:t});return rw(e,r),aw(r,e),dw(r,e)},pw=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=tw({...i??{},target:a,io:t,processors:n});return rw(e,o),aw(o,e),dw(o,e)},Soe={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Coe=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Soe[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},woe=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(Number.isFinite(c)&&c!==0?i.multipleOf=Math.abs(c):nw(e,t,i,r,`A multipleOf divisor of ${c} cannot be represented in JSON Schema`))},Toe=(e,t,n,r)=>{n.type=`boolean`},Eoe=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Doe=(e,t,n,r)=>{n.not={}},Ooe=(e,t,n,r)=>{let i=e._zod.def,a=Wb(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},koe=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(nw(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(nw(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Aoe=(e,t,n,r)=>{nw(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},joe=(e,t,n,r)=>{nw(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Moe=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=rw(a.element,t,{...r,path:[...r.path,`items`]})};function mw(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?mw(t.out):t.type===`catch`?mw(t.innerType):e._zod.optin}var Noe=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&nw(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)Zb(i.properties,e,rw(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e];return t.io===`input`?mw(n)===void 0:n._zod.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=rw(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Poe=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>rw(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Foe=(e,t,n,r)=>{let i=e._zod.def,a=rw(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=rw(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Ioe=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>rw(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?rw(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?mw(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=e._zod.bag;typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function hw(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=hw(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>hw(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?$S:QS).source),p):p}var gw=new WeakMap;function Loe(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of gw.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=hw(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Roe=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=rw(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)Zb(i.patternProperties,t.source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=rw(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=gw.get(t);n||(n=[],gw.set(t,n),t.deferred.push(()=>Loe(t))),n.push(e)}i.additionalProperties=rw(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&mw(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},zoe=(e,t,n,r)=>{let i=e._zod.def,a=rw(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Boe=(e,t,n,r)=>{let i=e._zod.def;rw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},_w=Symbol();function vw(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(nw(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),_w):JSON.parse(o)}var Voe=(e,t,n,r)=>{let i=e._zod.def;rw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=vw(i.defaultValue,e,t,n,r);o!==_w&&(n.default=o)},Hoe=(e,t,n,r)=>{let i=e._zod.def;rw(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=vw(i.defaultValue,e,t,n,r);o!==_w&&(n._prefault=o)},Uoe=(e,t,n,r)=>{let i=e._zod.def;rw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{nw(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Woe=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;rw(o,t,r);let s=t.seen.get(e);s.ref=o},Goe=(e,t,n,r)=>{let i=e._zod.def;rw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},yw=(e,t,n,r)=>{let i=e._zod.def;rw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},bw=new WeakSet([Object.prototype,Error.prototype]);function xw(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var Sw=W(`ZodError`,(e,t)=>{iS.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);bw.has(n)||(bw.add(n),xw(n,`format`,e=>t=>cS(e,t)),xw(n,`flatten`,e=>t=>sS(e,t)),xw(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Kb,2)}),xw(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Kb,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Koe=uS(Sw),qoe=dS(Sw),Joe=fS(Sw),Yoe=mS(Sw),Xoe=gS(Sw),Zoe=_S(Sw),Qoe=vS(Sw),$oe=yS(Sw),ese=bS(Sw),tse=xS(Sw),nse=SS(Sw),rse=CS(Sw);function ise(){Yx.localeError||Xx(Tae())}function Cw(){Yx.memoizer||Xx({memoizer:Sae()})}var ww=W(`ZodType`,(e,t)=>(ise(),oC.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Qb(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return cx(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(rce(e,t))},superRefine(e,t){return this.check(ice(e,t))},overwrite(e){return this.check($C(e))},optional(){return Uw(this)},exactOptional(){return Wse(this)},nullable(){return Gw(this)},nullish(){return Uw(Gw(this))},nonoptional(e){return Xse(this,e)},array(){return q(this)},or(e){return Fw([this,e])},and(e){return Rse(this,e)},transform(e){return qw(this,Use(e))},default(e){return qse(this,e)},prefault(e){return Yse(this,e)},catch(e){return Qse(this,e)},pipe(e){return qw(this,e)},readonly(){return tce(this)},describe(e){let t=this.clone();return HC.add(t,{description:e}),t},meta(...e){if(e.length===0)return HC.get(this);let t=this.clone();return HC.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Nx(this,`~standard`,{...cC(this),jsonSchema:{input:pw(this,`input`),output:pw(this,`output`)}})},set"~standard"(e){Mx(this,`~standard`,e)},parse:function e(t,n){return Koe(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await qoe(this,t,n,{callee:e})},safeParse(e,t){return Joe(this,e,t)},async safeParseAsync(e,t){return Yoe(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Mx(this,`spa`,e)},encode:function e(t,n){return Xoe(this,t,n,{callee:e})},decode:function e(t,n){return Zoe(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Qoe(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await $oe(this,t,n,{callee:e})},safeEncode(e,t){return ese(this,e,t)},safeDecode(e,t){return tse(this,e,t)},async safeEncodeAsync(e,t){return nse(this,e,t)},async safeDecodeAsync(e,t){return rse(this,e,t)},toJSONSchema(e){return xoe(this,{})(e)},get description(){return HC.get(this)?.description},get _def(){return this._zod.def}}),Tw=W(`_ZodString`,(e,t)=>{lC.init(e,t),ww.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Coe(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null},{regex(...e){return this.check(aoe(...e))},includes(...e){return this.check(coe(...e))},startsWith(...e){return this.check(loe(...e))},endsWith(...e){return this.check(uoe(...e))},min(...e){return this.check(ZC(...e))},max(...e){return this.check(XC(...e))},length(...e){return this.check(QC(...e))},nonempty(...e){return this.check(ZC(1,...e))},lowercase(e){return this.check(ooe(e))},uppercase(e){return this.check(soe(e))},trim(){return this.check(foe())},normalize(...e){return this.check(doe(...e))},toLowerCase(){return this.check(poe())},toUpperCase(){return this.check(moe())},slugify(){return this.check(hoe())}}),ase=W(`ZodString`,(e,t)=>{lC.init(e,t),Tw.init(e,t)},{email(e){return this.check(kae(lse,e))},url(e){return this.check(Pae(dse,e))},jwt(e){return this.check(Yae(Ese,e))},emoji(e){return this.check(Fae(fse,e))},guid(e){return this.check(Aae(use,e))},uuid(e){return this.check(UC(Ow,e))},uuidv4(e){return this.check(jae(Ow,e))},uuidv6(e){return this.check(Mae(Ow,e))},uuidv7(e){return this.check(Nae(Ow,e))},nanoid(e){return this.check(Iae(pse,e))},cuid(e){return this.check(Lae(mse,e))},cuid2(e){return this.check(Rae(hse,e))},ulid(e){return this.check(zae(gse,e))},base64(e){return this.check(Kae(Cse,e))},base64url(e){return this.check(qae(wse,e))},xid(e){return this.check(Bae(_se,e))},ksuid(e){return this.check(Vae(vse,e))},ipv4(e){return this.check(Hae(yse,e))},ipv6(e){return this.check(Uae(bse,e))},cidrv4(e){return this.check(Wae(xse,e))},cidrv6(e){return this.check(Gae(Sse,e))},e164(e){return this.check(Jae(Tse,e))},datetime(e){return this.check(WC(Dw,e))},date(e){return this.check(Xae(ose,e))},time(e){return this.check(Zae(sse,e))},duration(e){return this.check(Qae(cse,e))}});function G(e){return Oae(ase,e)}var Ew=W(`ZodStringFormat`,(e,t)=>{uC.init(e,t),Tw.init(e,t)}),Dw=W(`ZodISODateTime`,(e,t)=>{Mie.init(e,t),Ew.init(e,t)}),ose=W(`ZodISODate`,(e,t)=>{Nie.init(e,t),Ew.init(e,t)}),sse=W(`ZodISOTime`,(e,t)=>{Pie.init(e,t),Ew.init(e,t)}),cse=W(`ZodISODuration`,(e,t)=>{Fie.init(e,t),Ew.init(e,t)}),lse=W(`ZodEmail`,(e,t)=>{vie.init(e,t),Ew.init(e,t)}),use=W(`ZodGUID`,(e,t)=>{gie.init(e,t),Ew.init(e,t)}),Ow=W(`ZodUUID`,(e,t)=>{_ie.init(e,t),Ew.init(e,t)});function kw(e){return UC(Ow,e)}var dse=W(`ZodURL`,(e,t)=>{wie.init(e,t),Ew.init(e,t)}),fse=W(`ZodEmoji`,(e,t)=>{Tie.init(e,t),Ew.init(e,t)}),pse=W(`ZodNanoID`,(e,t)=>{Eie.init(e,t),Ew.init(e,t)}),mse=W(`ZodCUID`,(e,t)=>{Die.init(e,t),Ew.init(e,t)}),hse=W(`ZodCUID2`,(e,t)=>{Oie.init(e,t),Ew.init(e,t)}),gse=W(`ZodULID`,(e,t)=>{kie.init(e,t),Ew.init(e,t)}),_se=W(`ZodXID`,(e,t)=>{Aie.init(e,t),Ew.init(e,t)}),vse=W(`ZodKSUID`,(e,t)=>{jie.init(e,t),Ew.init(e,t)}),yse=W(`ZodIPv4`,(e,t)=>{Iie.init(e,t),Ew.init(e,t)}),bse=W(`ZodIPv6`,(e,t)=>{Rie.init(e,t),Ew.init(e,t)}),xse=W(`ZodCIDRv4`,(e,t)=>{zie.init(e,t),Ew.init(e,t)}),Sse=W(`ZodCIDRv6`,(e,t)=>{Vie.init(e,t),Ew.init(e,t)}),Cse=W(`ZodBase64`,(e,t)=>{Hie.init(e,t),Ew.init(e,t)}),wse=W(`ZodBase64URL`,(e,t)=>{Wie.init(e,t),Ew.init(e,t)}),Tse=W(`ZodE164`,(e,t)=>{Gie.init(e,t),Ew.init(e,t)}),Ese=W(`ZodJWT`,(e,t)=>{qie.init(e,t),Ew.init(e,t)}),Aw=W(`ZodNumber`,(e,t)=>{pC.init(e,t),ww.init(e,t),e._zod.processJSONSchema=(t,n,r)=>woe(e,t,n,r);let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null},{gt(e,t){return this.check(qC(e,t))},gte(e,t){return this.check(JC(e,t))},min(e,t){return this.check(JC(e,t))},lt(e,t){return this.check(GC(e,t))},lte(e,t){return this.check(KC(e,t))},max(e,t){return this.check(KC(e,t))},int(e){return this.check(jw(e))},safe(e){return this.check(jw(e))},positive(e){return this.check(qC(0,e))},nonnegative(e){return this.check(JC(0,e))},negative(e){return this.check(GC(0,e))},nonpositive(e){return this.check(KC(0,e))},multipleOf(e,t){return this.check(YC(e,t))},step(e,t){return this.check(YC(e,t))},finite(){return this}});function K(e){return $ae(Aw,e)}var Dse=W(`ZodNumberFormat`,(e,t)=>{Jie.init(e,t),Aw.init(e,t)});function jw(e){return eoe(Dse,e)}var Ose=W(`ZodBoolean`,(e,t)=>{Yie.init(e,t),ww.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Toe(e,t,n,r)});function Mw(e){return toe(Ose,e)}var kse=W(`ZodNull`,(e,t)=>{Xie.init(e,t),ww.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eoe(e,t,n,r)});function Ase(e){return noe(kse,e)}var jse=W(`ZodUnknown`,(e,t)=>{Zie.init(e,t),ww.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Nw(){return roe(jse)}var Mse=W(`ZodNever`,(e,t)=>{Qie.init(e,t),ww.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Doe(e,t,n,r)});function Nse(e){return ioe(Mse,e)}var Pse=W(`ZodArray`,(e,t)=>{Cw(),$ie.init(e,t),ww.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Moe(e,t,n,r),e.element=t.element},{min(e,t){return this.check(ZC(e,t))},nonempty(e){return this.check(ZC(1,e))},max(e,t){return this.check(XC(e,t))},length(e,t){return this.check(QC(e,t))},unwrap(){return this.element}});function q(e,t){return goe(Pse,e,t)}var Fse=W(`ZodObject`,(e,t)=>{Cw(),nae.init(e,t),ww.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Noe(e,t,n,r),Bx(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return Y(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Nw()})},loose(){return this.clone({...this._zod.def,catchall:Nw()})},strict(){return this.clone({...this._zod.def,catchall:Nse()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return hx(this,e)},safeExtend(e){return gx(this,e)},merge(e){return _x(this,e)},pick(e){return px(this,e)},omit(e){return mx(this,e)},partial(...e){return vx(Hw,this,e[0])},exactPartial(...e){return vx(Ww,this,e[0],`exactPartial`)},required(...e){return yx(Kw,this,e[0])}});function J(e,t){return new Fse({type:`object`,shape:e??{},...lx(t)})}var Pw=W(`ZodUnion`,(e,t)=>{bC.init(e,t),ww.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Poe(e,t,n,r),e.options=t.options});function Fw(e,t){return new Pw({type:`union`,options:e,...lx(t)})}var Ise=W(`ZodDiscriminatedUnion`,(e,t)=>{Pw.init(e,t),rae.init(e,t)});function Iw(e,t,n){return new Ise({type:`union`,options:t,discriminator:e,...lx(n)})}var Lse=W(`ZodIntersection`,(e,t)=>{iae.init(e,t),ww.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Foe(e,t,n,r)});function Rse(e,t){return new Lse({type:`intersection`,left:e,right:t})}var zse=W(`ZodTuple`,(e,t)=>{Cw(),aae.init(e,t),ww.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ioe(e,t,n,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(`.partial() cannot be used on tuple schemas containing refinements`);return this.clone({...e,items:e.items.map(e=>new Hw({type:`optional`,innerType:e}))})}});function Bse(e,t,n){let r=t instanceof oC;return new zse({type:`tuple`,items:e,rest:r?t:null,...lx(r?n:t)})}var Lw=W(`ZodRecord`,(e,t)=>{Cw(),oae.init(e,t),ww.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Roe(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Rw(e,t,n){return!t||!t._zod?new Lw({type:`record`,keyType:G(),valueType:e,...lx(t)}):new Lw({type:`record`,keyType:e,valueType:t,...lx(n)})}function zw(e,t,n){return new Lw({type:`record`,keyType:e,valueType:t,...lx(n),partial:!0})}var Bw=W(`ZodEnum`,(e,t)=>{sae.init(e,t),ww.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ooe(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Bw({...t,checks:[],...lx(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Bw({...t,checks:[],...lx(r),entries:i})}});function Y(e,t){return new Bw({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...lx(t)})}var Vse=W(`ZodLiteral`,(e,t)=>{cae.init(e,t),ww.init(e,t),e._zod.processJSONSchema=(t,n,r)=>koe(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Vw(e,t){return new Vse({type:`literal`,values:Array.isArray(e)?e:[e],...lx(t)})}var Hse=W(`ZodTransform`,(e,t)=>{Cw(),lae.init(e,t),ww.init(e,t),e._zod.processJSONSchema=(t,n,r)=>joe(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Jx(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ax(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Ax(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Use(e){return new Hse({type:`transform`,transform:e})}var Hw=W(`ZodOptional`,(e,t)=>{DC.init(e,t),ww.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Uw(e){return new Hw({type:`optional`,innerType:e})}var Ww=W(`ZodExactOptional`,(e,t)=>{uae.init(e,t),ww.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Wse(e){return new Ww({type:`optional`,innerType:e})}var Gse=W(`ZodNullable`,(e,t)=>{dae.init(e,t),ww.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zoe(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Gw(e){return new Gse({type:`nullable`,innerType:e})}var Kse=W(`ZodDefault`,(e,t)=>{fae.init(e,t),ww.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Voe(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function qse(e,t){return new Kse({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ax(t)}})}var Jse=W(`ZodPrefault`,(e,t)=>{pae.init(e,t),ww.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hoe(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Yse(e,t){return new Jse({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ax(t)}})}var Kw=W(`ZodNonOptional`,(e,t)=>{mae.init(e,t),ww.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Boe(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Xse(e,t){return new Kw({type:`nonoptional`,innerType:e,...lx(t)})}var Zse=W(`ZodCatch`,(e,t)=>{hae.init(e,t),ww.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uoe(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Qse(e,t){return new Zse({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Hx(t)})}var $se=W(`ZodPipe`,(e,t)=>{gae.init(e,t),ww.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Woe(e,t,n,r),e.in=t.in,e.out=t.out});function qw(e,t){return new $se({type:`pipe`,in:e,out:t})}var ece=W(`ZodReadonly`,(e,t)=>{_ae.init(e,t),ww.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Goe(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function tce(e){return new ece({type:`readonly`,innerType:e})}var nce=W(`ZodCustom`,(e,t)=>{vae.init(e,t),ww.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Aoe(e,t,n,r)});function rce(e,t={}){return _oe(nce,e,t)}function ice(e,t){return voe(e,t)}function Jw(e){return WC(Dw,e)}var Yw=[`off`,`low`,`medium`,`high`,`xhigh`,`max`,`ultra`],Xw=Iw(`kind`,[J({kind:Vw(`once`),at:G().datetime({offset:!0})}).strict(),J({kind:Vw(`daily`),time:G().regex(/^([01]\d|2[0-3]):[0-5]\d$/)}).strict(),J({kind:Vw(`weekly`),time:G().regex(/^([01]\d|2[0-3]):[0-5]\d$/),days:q(K().int().min(0).max(6)).min(1).max(7).readonly()}).strict()]);function Zw(e){try{return new Intl.DateTimeFormat(`en`,{timeZone:e}).format(),!0}catch{return!1}}var Qw=kw(),ace=[`failed`,`paused`,`stopped`,`review`],$w=G().min(1).max(200).refine(e=>e===e.trim(),`Remove the spaces at the start or end of the keyword name.`),eT=Rw($w,G().max(1e4)).readonly(),tT=J({title:G().trim().min(1).max(200),values:eT}).strict().readonly(),nT=Y([`skip`,`run-once`]),oce=[`off`,`queue`,`hold`],rT=4e3,iT=J({mode:Y(oce),keepAtLeast:K().int().min(1).max(100),llm:J({provider:G().min(1).max(100),model:G().min(1).max(200),thinking:Y(Yw).optional()}).strict().readonly().nullable()}).strict().readonly(),aT={mode:`off`,keepAtLeast:10,llm:null},sce=J({held:K().int().nonnegative(),generatingSince:G().nullable(),generatedAt:G().nullable(),failedAt:G().nullable(),error:G().nullable()}).strict().readonly(),cce={held:0,generatingSince:null,generatedAt:null,failedAt:null,error:null},oT=J({day:K().int().min(0).max(6),time:G().regex(/^([01]\d|2[0-3]):[0-5]\d$/)}).strict().readonly(),sT=q(J({day:K().int().min(0).max(6),long:oT,shorts:q(oT).max(10).readonly()}).strict().readonly()).max(7).readonly();J({id:Qw,name:G().trim().min(1).max(200),templateId:Qw,templateVersion:K().int().positive(),cadence:Xw,timezone:G().min(1).max(100).refine(Zw,`Choose a time zone from the list, such as Europe/London.`),missedPolicy:nT.default(`skip`),overlapPolicy:Vw(`skip`).default(`skip`),spendLimitCents:K().int().nonnegative().nullable().default(null),items:q(tT).max(500).default([]).readonly(),topicKeyword:$w.nullable().default(null),values:eT.default({}),brief:G().trim().max(rT).nullable().default(null),topicGeneration:iT.default(aT),releases:sT.default([])}).strict().readonly().unwrap().extend({baseVersion:K().int().positive(),mutationId:Qw}).strict().readonly(),J({id:Qw,baseVersion:K().int().positive()}).strict().readonly(),J({id:Qw,baseVersion:K().int().positive()}).strict().readonly();var cT=J({id:Qw,name:G(),templateId:Qw,templateVersion:K().int().positive(),cadence:Xw,timezone:G(),missedPolicy:nT,overlapPolicy:Vw(`skip`),spendLimitCents:K().int().nonnegative().nullable(),items:q(tT).readonly(),topicKeyword:G().nullable().default(null),values:eT.default({}),brief:G().nullable().default(null),topicGeneration:iT.default(aT),releases:sT.default([]),topics:sce.default(cce),status:Y([`active`,`paused`,`completed`,`canceled`]),version:K().int().positive(),nextRunAt:G().datetime({offset:!0}).nullable(),createdAt:G(),updatedAt:G(),deletedAt:G().datetime({offset:!0}).nullable()}).strict().readonly(),lce=J({id:Qw,scheduleId:Qw,scheduledFor:G().datetime({offset:!0}),status:Y([`running`,`succeeded`,`failed`,`skipped`]),requestId:Qw.nullable(),projectIds:q(G()).readonly(),estimate:Nw().nullable(),startedAt:G().datetime({offset:!0}),endedAt:G().datetime({offset:!0}).nullable(),error:G().nullable()}).strict().readonly(),lT=J({id:Qw,title:G(),values:Rw(G(),G()).readonly().default({}),rank:K().int(),createdAt:G()}).strict().readonly();J({title:G(),values:Rw($w,G()).optional()}).strict(),J({baseVersion:K().int().positive(),from:K().int().nonnegative(),to:K().int().nonnegative()}).strict().readonly(),J({baseVersion:K().int().positive(),items:q(tT).max(500).readonly()}).strict().readonly();var uce=J({at:G(),scheduleId:Qw,scheduleName:G(),scheduleVersion:K().int().positive(),paused:Mw(),templateId:Qw,templateVersion:K().int().positive(),templateName:G().nullable(),index:K().int().nonnegative().nullable(),topic:G().nullable(),topicSource:Y([`queued`,`held`,`generated`,`template`]),renderedTitle:G().nullable().default(null),prepared:G().nullable().default(null)}).strict().readonly(),dce=J({id:G(),title:G(),state:Y(Sb),createdAt:G(),finishedAt:G().nullable(),scheduleId:G().nullable(),progress:K().min(0).max(1).default(0),needs:Y(ace).optional(),readyToUpload:Vw(!0).optional(),setAside:Vw(!0).optional(),prepared:Vw(!0).optional(),waitingForAgent:Vw(!0).optional(),stopped:Vw(!0).optional(),stepFailed:Vw(!0).optional(),limitWaits:q(J({name:G(),stage:Y(bb),resetsAt:G().nullable(),retryAt:G()}).strict().readonly()).readonly().optional()}).strict().readonly(),fce=J({projectId:G(),title:G(),batchId:G(),position:K().int(),state:Y([`queued`,`active`]),queuedAt:G()}).strict().readonly(),pce=J({from:G(),to:G(),runs:q(uce).readonly(),projects:q(dce).readonly(),queued:q(fce).readonly()}).strict().readonly();J({baseVersion:K().int().positive(),index:K().int().nonnegative(),targetId:Qw,position:K().int().nonnegative().optional()}).strict().readonly();var mce=J({title:G(),detail:G().optional(),reason:G().optional()}),hce=J({schedules:q(cT)}),gce=J({schedule:cT,runs:q(lce)}),uT=e=>`${e.origin}/api/schedules`;async function dT(e,t){let n;try{n=await e.json()}catch{throw po(e,void 0)}if(e.ok)return{ok:!0,value:So(t,n)};let r=mce.safeParse(n);if(!r.success)throw po(e,void 0);let i=r.data.detail??r.data.title;if(![400,404,409].includes(e.status))throw Error(i);return{ok:!1,message:i,reason:r.data.reason??`invalid-request`}}var fT=(e,t)=>({method:e,headers:{"content-type":`application/json`},body:JSON.stringify(t)}),pT=[`schedules`];function mT(e){return{queryKey:pT,queryFn:async()=>{let t=await dT(await e.fetch(uT(e)),hce);if(!t.ok)throw Error(t.message);return t.value.schedules},refetchInterval:3e4}}async function _ce(e,t){return dT(await e.fetch(`${uT(e)}/${encodeURIComponent(t)}`),gce)}async function hT(e,t){return dT(await e.fetch(uT(e),fT(`POST`,t)),cT)}async function gT(e,t,n){return dT(await e.fetch(`${uT(e)}/${encodeURIComponent(t)}`,fT(`PUT`,n)),cT)}async function _T(e,t,n,r){return dT(await e.fetch(`${uT(e)}/${encodeURIComponent(t)}/${n}`,fT(`POST`,{baseVersion:r})),cT)}async function vce(e,t,n){return dT(await e.fetch(`${uT(e)}/${encodeURIComponent(t)}`,fT(`DELETE`,{baseVersion:n})),J({deleted:Vw(!0)}))}var yce=J({topics:q(lT)}),vT=e=>[`schedule`,e,`held-topics`];async function yT(e,t){let n=await dT(await e.fetch(`${uT(e)}/${encodeURIComponent(t)}/topics/held`),yce);return n.ok?{ok:!0,value:n.value.topics}:n}var bT=(e,t,n)=>`${uT(e)}/${encodeURIComponent(t)}/topics/${n}`;async function xT(e,t){return dT(await e.fetch(bT(e,t,`generate`),fT(`POST`,{})),J({started:Vw(!0)}))}async function bce(e,t,n){return dT(await e.fetch(bT(e,t,`prepare`),fT(`POST`,{topic:n})),J({projectId:G(),title:G()}))}async function ST(e,t,n,r){return dT(await e.fetch(bT(e,t,`held/${encodeURIComponent(n)}/approve`),fT(`POST`,r===void 0?{}:{title:r})),cT)}async function CT(e,t){return dT(await e.fetch(bT(e,t,`held/approve-all`),fT(`POST`,{})),cT)}async function xce(e,t,n){return dT(await e.fetch(bT(e,t,`held/approve`),fT(`POST`,{ids:n})),cT)}async function Sce(e,t,n){return dT(await e.fetch(bT(e,t,`held/reject`),fT(`POST`,{ids:n})),cT)}async function Cce(e,t,n){return dT(await e.fetch(bT(e,t,`held/restore`),fT(`POST`,{topics:n.map(e=>({id:e.id,values:e.values}))})),cT)}async function wce(e,t,n){return dT(await e.fetch(bT(e,t,`held/${encodeURIComponent(n)}/reject`),fT(`POST`,{})),cT)}async function Tce(e,t,n,r,i){return dT(await e.fetch(bT(e,t,`held/${encodeURIComponent(n)}`),fT(`PUT`,i===void 0?{title:r}:{title:r,values:i})),lT)}async function wT(e,t,n){return dT(await e.fetch(bT(e,t,`move`),fT(`POST`,n)),cT)}async function TT(e,t,n){return dT(await e.fetch(`${uT(e)}/${encodeURIComponent(t)}/topics`,fT(`PUT`,n)),cT)}async function Ece(e,t,n){return dT(await e.fetch(bT(e,t,`transfer`),fT(`POST`,n)),J({source:cT,target:cT}))}var ET=[`calendar`];function DT(e,t,n){return{queryKey:[...ET,t,n],queryFn:async()=>{let r=new URLSearchParams({from:t,to:n}),i=await dT(await e.fetch(`${e.origin}/api/calendar?${r.toString()}`),pce);if(!i.ok)throw Error(i.message);return i.value},refetchInterval:3e4}}var OT=[{code:`en`,name:`English`,native:`English`,script:`latin`,timing:`english`},{code:`es`,name:`Spanish`,native:`Español`,script:`latin`,timing:`multilingual`},{code:`de`,name:`German`,native:`Deutsch`,script:`latin`,timing:`multilingual`},{code:`fr`,name:`French`,native:`Français`,script:`latin`,timing:`multilingual`},{code:`it`,name:`Italian`,native:`Italiano`,script:`latin`,timing:`multilingual`},{code:`pt`,name:`Portuguese`,native:`Português`,script:`latin`,timing:`multilingual`},{code:`nl`,name:`Dutch`,native:`Nederlands`,script:`latin`,timing:`multilingual`},{code:`ca`,name:`Catalan`,native:`Català`,script:`latin`,timing:`multilingual`},{code:`pl`,name:`Polish`,native:`Polski`,script:`latin`,timing:`multilingual`},{code:`cs`,name:`Czech`,native:`Čeština`,script:`latin`,timing:`multilingual`},{code:`ro`,name:`Romanian`,native:`Română`,script:`latin`,timing:`sentences`},{code:`sv`,name:`Swedish`,native:`Svenska`,script:`latin`,timing:`sentences`},{code:`da`,name:`Danish`,native:`Dansk`,script:`latin`,timing:`sentences`},{code:`nb`,name:`Norwegian`,native:`Norsk bokmål`,script:`latin`,timing:`sentences`},{code:`fi`,name:`Finnish`,native:`Suomi`,script:`latin`,timing:`sentences`},{code:`hu`,name:`Hungarian`,native:`Magyar`,script:`latin`,timing:`sentences`},{code:`tr`,name:`Turkish`,native:`Türkçe`,script:`latin`,timing:`sentences`},{code:`id`,name:`Indonesian`,native:`Bahasa Indonesia`,script:`latin`,timing:`sentences`},{code:`vi`,name:`Vietnamese`,native:`Tiếng Việt`,script:`latin`,timing:`sentences`},{code:`el`,name:`Greek`,native:`Ελληνικά`,script:`greek`,timing:`sentences`},{code:`ru`,name:`Russian`,native:`Русский`,script:`cyrillic`,timing:`sentences`},{code:`uk`,name:`Ukrainian`,native:`Українська`,script:`cyrillic`,timing:`sentences`},{code:`ar`,name:`Arabic`,native:`العربية`,script:`arabic`,timing:`sentences`},{code:`he`,name:`Hebrew`,native:`עברית`,script:`hebrew`,timing:`sentences`},{code:`hi`,name:`Hindi`,native:`हिन्दी`,script:`devanagari`,timing:`sentences`},{code:`th`,name:`Thai`,native:`ไทย`,script:`thai`,timing:`sentences`},{code:`ja`,name:`Japanese`,native:`日本語`,script:`cjk`,timing:`sentences`},{code:`zh`,name:`Chinese`,native:`中文`,script:`cjk`,timing:`sentences`},{code:`ko`,name:`Korean`,native:`한국어`,script:`hangul`,timing:`sentences`}],kT=Y(OT.map(e=>e.code));function AT(e){return OT.find(t=>t.code===(e??`en`))??OT[0]}function jT(e){let t=AT(e);if(t.timing===`sentences`)return`Word timing isn't available for ${t.name} yet, so captions are timed sentence by sentence: each sentence is shown for the part of the narration that reads it. Word-by-word captions and cuts that follow the narration need word timing and are off.`}var MT=60/240,Dce=1e5,Oce=1500;function kce(e){return e.imageScale===void 0?60:240}function NT(e){return e.split(/\s+/).filter(e=>e!==``).length}function PT(e){return e/150}function FT(e){return Math.round(60/e*1e4)/1e4}function Ace(e){let t=60/e.perHour,n=Math.round(t*4);return Math.abs(t*4-n)<.001?{every:`minutes`,value:String(n/4)}:{every:`hour`,value:String(e.perHour)}}function IT(e){let t=PT(e.words)*e.perHour/60;return Math.min(Math.max(Math.ceil(t-1e-9),0),240)}function jce(e){return e.imageScale!==void 0&&e.sources.images===`generate`}function LT(e){let t=e.imagePrompts.map(e=>e.number);if(!jce(e)||t.length===0)return t;let n=t.reduce((e,t)=>e+t,0),r=IT(e.imageScale)-n;for(let e=0;e<r;e+=1){let n=e%t.length;t[n]=(t[n]??0)+1}return t}function Mce(e){if(!Number.isFinite(e.perHour)||e.perHour<1||e.perHour>240)return`Enter between 1 and 240 images per hour (one every ${String(MT)} to 60 minutes) under Images → More images for long videos.`;if(!Number.isInteger(e.words)||e.words<1||e.words>1e5)return`Enter the expected words (Review) as a whole number between 1 and ${String(Dce)}; the image count for long videos is planned from it.`}var RT={enabled:!0,videoLufs:-14,audioFilesLufs:-18},Nce=-1.5,zT=.5;function BT(e){return e===`video`?-14:-18}function Pce(e){return e===`video`?Nce:-3}function VT(e,t){return GT(e-BT(t),2)}function Fce(e,t){return GT(BT(t)+e,2)}function HT(e){return Math.round(10**(e/20)*100)}function Ice(e){return GT(20*Math.log10(e/100),2)}function Lce(e){if(!Number.isFinite(e))return;let t=Math.round(e/zT)*zT;return Math.min(4,Math.max(-10,t))}function UT(e,t){let n=e-BT(t);return Number.isFinite(n)&&Number.isInteger(GT(n/.5,6))&&n>=-10.000000001&&n<=4.000000001?void 0:`The volume must be between -10 dB and +4 dB of the recommended level, in steps of ${String(zT)} dB. Change it under Level the volume (Play → Video and style, Edit project → Pauses and volume, or Settings → General).`}function Rce(e){if(e===void 0)return[];let t=[],n=UT(e.videoLufs,`video`);n!==void 0&&t.push({field:`loudness.videoLufs`,message:n});let r=UT(e.audioFilesLufs,`audioFiles`);return r!==void 0&&t.push({field:`loudness.audioFilesLufs`,message:r}),t}function zce(e,t){if(e?.enabled??t.enabled)return{videoLufs:e?.videoLufs??t.videoLufs,audioFilesLufs:e?.audioFilesLufs??t.audioFilesLufs}}function WT(e){let t=`${String(e.pieces)} ${e.pieces===1?`piece`:`pieces`}`,n=e.skipped===0?``:` (${String(e.skipped)} too short or quiet to measure, left as they were)`;return`Levelled ${t} to ${KT(e.target)} LUFS${n}: the spread was ${KT(e.spreadBefore)} LU, now ${KT(e.spreadAfter)} LU.`}function Bce(e){return`Mastered to ${KT(e.target)} LUFS: measured ${KT(e.integrated)} LUFS, peaks ${KT(e.truePeak)} dBTP`}function GT(e,t){let n=10**t;return Math.round(e*n)/n}function KT(e){return String(GT(e,1)).replace(`-`,`−`)}var qT=.4,JT=.05;function YT(e,t){let n=e/JT;return Number.isFinite(e)&&e>=0&&e<=2&&Math.abs(n-Math.round(n))<1e-6?void 0:`The pause between ${t} must be between 0 and 2 seconds, in steps of ${String(JT)}. Change it under Play → Video and style, or Edit project → Pauses and volume.`}function Vce(e){let t=[];if(e.sentencePauseSeconds!==void 0){let n=YT(e.sentencePauseSeconds,`sentences`);n!==void 0&&t.push({field:`sentencePauseSeconds`,message:n})}if(e.paragraphPauseSeconds!==void 0){let n=YT(e.paragraphPauseSeconds,`paragraphs`);n!==void 0&&t.push({field:`paragraphPauseSeconds`,message:n})}return t}function Hce(e){let t=(e,t)=>e===void 0||e.trim()===``?t:Number(e.trim().replace(`,`,`.`)),n=t(e.sentencePause,qT),r=t(e.paragraphPause,0);return{...n===0?{}:{sentencePauseSeconds:n},...r===0?{}:{paragraphPauseSeconds:r}}}var XT=[`article`,`images`,`narration`,`thumbnail`,`shorts`],ZT=[`off`,`flag`,`redo`],QT=[`model`,`agent`],Uce={model:`Model`,agent:`External agent (MCP)`},$T={article:`Article`,images:`Images`,narration:`Narration`,thumbnail:`Thumbnail`,shorts:`Shorts`},Wce={off:`Off`,flag:`Flag only`,redo:`Flag and redo`},eE=[`images`,`thumbnail`,`shorts`],tE=[`claude-code`,`codex`];function Gce(e,t){return e?.stages[t]?.mode??`off`}function Kce(e){return e?.reviewer===`agent`}function qce(e){return`review.${e}`}function Jce(e){return{provider:e.provider,model:e.model,...e.thinking===void 0?{}:{thinking:e.thinking},...e.reviewer===`agent`?{reviewer:`agent`}:{},retries:e.retries===void 0?``:String(e.retries),stages:Object.fromEntries(XT.flatMap(t=>{let n=e.stages[t];return n===void 0?[]:[[t,{mode:n.mode,prompt:n.prompt??``}]]}))}}function nE(e,t){let n=Object.fromEntries(XT.flatMap(n=>{let r=e.stages[n];return r===void 0||r.mode===`off`||!t(n)?[]:[[n,{mode:r.mode,...r.prompt.trim()?{prompt:r.prompt}:{}}]]}));if(Object.keys(n).length===0)return{settings:void 0};let r=e.retries.trim()===``?void 0:Number(e.retries),i=r===void 0||Number.isFinite(r);return{settings:{provider:e.provider,model:e.model,...e.thinking===void 0?{}:{thinking:e.thinking},...e.reviewer===`agent`?{reviewer:`agent`}:{},...r===void 0||!i?{}:{retries:r},stages:n},...i?{}:{retriesProblem:`Enter a number of redos between 0 and 5 in the Reviews section.`}}}function rE(e,t){let{sources:n}=e;switch(t){case`article`:return n.article===`generate`;case`images`:return n.images===`generate`;case`narration`:return n.audio===`generate`;case`thumbnail`:return n.thumbnail===`from_prompt`||n.thumbnail===`prompt_by_llm`;case`shorts`:return e.shorts?.enabled===!0&&n.audio!==`off`}}function Yce(e){return XT.filter(t=>Gce(e.reviews,t)!==`off`&&rE(e,t))}function Xce(e){return tE.includes(e)}function Zce(e){let t=Yce(e),n=e.reviews;if(t.length===0||n===void 0)return[];let r=[],i=Kce(n);!i&&(n.provider.trim()===``||n.model.trim()===``)&&r.push({field:`reviews.provider`,message:`Automatic reviews need a reviewer model. Choose one in the Reviews section, or set every review to Off.`});let a=n.retries;a!==void 0&&(!Number.isInteger(a)||a<0||a>5)&&r.push({field:`reviews.retries`,message:`Enter a number of redos between 0 and 5 in the Reviews section.`});let o=t.filter(e=>eE.includes(e));return!i&&o.length>0&&n.provider.trim()!==``&&!Xce(n.provider)&&r.push({field:`reviews.provider`,message:`The ${o.map(e=>$T[e]).join(`, `)} ${o.length===1?`review looks`:`reviews look`} at pictures, and Slopify can't show pictures to this reviewer. In the Reviews section, choose Claude Code or Codex as the reviewer, or set ${o.length===1?`that review`:`those reviews`} to Off.`}),r}var iE={enabled:!1,count:3,minSeconds:60,maxSeconds:120,titleOnScreen:!0},Qce=1.25,aE=.05,$ce=2e3,ele=`[PASTE THE FULL VIDEO LINK HERE]`;function tle(e){let t=e?.trim()??``;return`Watch the full video: ${t===``?ele:t}`}function nle(e,t){return[e.title,``,`${e.description}\n${tle(t)}`,``,e.hashtags.join(` `)].join(`
|
|
102
102
|
`)}var rle=`Built-in`,ile=[`Pick the moments of this video that work best as vertical shorts on YouTube Shorts, TikTok and Reels.`,``,`- Each short must make sense on its own, to a viewer who has not seen the rest of the video: no references to earlier parts, no setup that pays off outside the clip.`,`- Open on a hook: the first sentence should make someone stop scrolling (a surprising fact, a question, a bold claim). Skip clips that start with filler or a transition.`,`- End on a complete thought, not mid-argument.`,`- Prefer the most surprising, useful or emotional moments over summaries, and don't pick two shorts that say the same thing.`,`- Title: at most 60 characters, plain words, no clickbait and no hashtags.`,`- Description: one line that says what the viewer learns or feels.`,`- Hashtags: 3-5, about the subject of that clip, most specific last.`].join(`
|
|
103
103
|
`);[`Vertical 9:16 images for a short video. Each image illustrates what is being said at that moment of the clip.`,`Cinematic, high-contrast and uncluttered, with the subject large and centred so it reads on a phone screen.`,`Leave the lower half calm: captions are drawn over the middle of the frame.`,`No text, letters, logos or watermarks in the image.`].join(`
|
|
104
|
-
`);function ale(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||t<=0?1:Math.max(1,Math.ceil(e/t-.001))}function oE(e){let t=e=>e===void 0||e.trim()===``?void 0:Number(e),n=t(e.musicVolume),r=t(e.speed),i=e.fullVideoLink?.trim()??``;return{...e.titleOnScreen===void 0?{}:{titleOnScreen:e.titleOnScreen},...i===``?{}:{fullVideoLink:i},...n===void 0?{}:{musicVolume:n},...r===void 0?{}:{speed:r}}}function ole(e){return{...e?.titleOnScreen===void 0?{}:{titleOnScreen:e.titleOnScreen},...e?.fullVideoLink===void 0?{}:{fullVideoLink:e.fullVideoLink},...e?.musicVolume===void 0?{}:{musicVolume:String(e.musicVolume)},...e?.speed===void 0?{}:{speed:e.speed.toFixed(2)}}}function sle(e){let t=[],n=(e,t,n)=>Number.isInteger(e)&&e>=t&&e<=n;n(e.count,1,10)||t.push({field:`count`,message:`Enter a whole number of shorts between 1 and 10.`});for(let r of[`minSeconds`,`maxSeconds`])n(e[r],15,180)||t.push({field:r,message:`Enter a whole number of seconds between 15 and 180.`});if(t.every(e=>e.field===`count`)&&e.minSeconds>e.maxSeconds)for(let e of[`minSeconds`,`maxSeconds`])t.push({field:e,message:`The longest a short may be must be at least the shortest. Raise the maximum or lower the minimum.`});let r=e.speed;r!==void 0&&(!Number.isFinite(r)||r<.999999999||r>1.250000001||Math.abs((r-1)/.05-Math.round((r-1)/.05))>1e-6)&&t.push({field:`speed`,message:`Choose a speed between 1.00× and 1.25×, in steps of 0.05.`}),e.musicVolume!==void 0&&!n(e.musicVolume,0,100)&&t.push({field:`musicVolume`,message:`Enter the music volume as a whole number of percent between 0 and 100.`});let i=e.fullVideoLink?.trim()??``;return i!==``&&!cle(i)&&t.push({field:`fullVideoLink`,message:`The full video link must be a whole web address starting with https:// or http://, like https://youtu.be/abc123. Paste it again, or leave the box empty.`}),t}function cle(e){if(e.length>2e3||/\s/.test(e))return!1;try{let t=new URL(e);return(t.protocol===`https:`||t.protocol===`http:`)&&t.hostname!==``}catch{return!1}}var sE=[`rain`,`fire`,`wind`],cE=[...sE,`upload`],lle={rain:`Rain`,fire:`Fireplace`,wind:`Wind`,upload:`My own file`},lE={levelDb:-18,fadeInSeconds:3,tailSeconds:6};function ule(e){return e.ambientBed!==void 0&&e.mode!==`short`&&e.sources.video===`generate`&&e.sources.audio!==`off`}function uE(e){let t=[];return cE.includes(e.source)||t.push({field:`source`,message:`Choose Rain, Fireplace, Wind or My own file for the ambient sound.`}),Number.isInteger(e.levelDb)&&e.levelDb>=-40&&e.levelDb<=-6||t.push({field:`level`,message:`Enter an ambient sound level between -40 and -6 dB, in whole dB.`}),dE(e.fadeInSeconds,30)||t.push({field:`fadeIn`,message:`Enter a fade-in between 0 and 30 seconds, in steps of 0.5.`}),dE(e.tailSeconds,30)||t.push({field:`tail`,message:`Enter a tail between 0 and 30 seconds, in steps of 0.5.`}),t}function dE(e,t){return Number.isInteger(e*2)&&e>=0&&e<=t}function fE(e){return{source:e.source,level:String(e.levelDb),fadeIn:String(e.fadeInSeconds),tail:String(e.tailSeconds)}}function pE(e){if(e===void 0||e.source===`none`)return;let t=e=>e.trim()===``?NaN:Number(e);return{source:e.source,levelDb:t(e.level),fadeInSeconds:t(e.fadeIn),tailSeconds:t(e.tail)}}var mE=[`interval`,`narration`],hE=[`cut`,`crossfade`,`fadeblack`,`slide`,`wipe`],gE=[`off`,`subtle`,`strong`],_E=[`none`,`warm`,`cold`,`desaturated`,`sepia`],vE=[`none`,`embers`,`dust`,`fog`],yE=[`off`,`chapters`,`every`],bE={cuts:`interval`,transition:`cut`,transitionSeconds:.6,vignette:`off`,grain:`off`,grade:`none`,atmosphere:`none`,chapterCards:!1,animate:`off`,animateEvery:3,animateModel:``},dle={...bE,cuts:`narration`},fle=.2,ple=[.2,.4,.6,.8,1,1.2,1.5,2],xE={interval:`Every N seconds`,narration:`Follow the narration`},SE={cut:`Cut`,crossfade:`Crossfade`,fadeblack:`Fade through black`,slide:`Slide`,wipe:`Wipe`},CE={off:`Off`,subtle:`Subtle`,strong:`Strong`},wE={none:`None`,warm:`Warm fantasy`,cold:`Cold`,desaturated:`Desaturated`,sepia:`Sepia`},TE={none:`None`,embers:`Embers`,dust:`Dust`,fog:`Fog`},EE={off:`Off`,chapters:`Chapter openers`,every:`Every Nth image`};function DE(e){return e.videoEdit??bE}function OE(e){let t=DE(e);return t.animate!==`off`&&e.sources.video===`generate`&&(t.animate===`every`||e.sources.audio!==`off`)}function mle(e){let t=e.videoEdit;if(t===void 0||e.sources.video!==`generate`)return[];let n=[];return t.transition!==`cut`&&!(Number.isFinite(t.transitionSeconds)&&t.transitionSeconds>=.2&&t.transitionSeconds<=2)&&n.push({field:`transitionSeconds`,message:`Choose a transition length between ${String(fle)} and 2 seconds.`}),t.chapterCards&&e.sources.audio===`off`&&n.push({field:`chapterCards`,message:`Chapter cards are placed from the narration. Turn narration on, or turn chapter cards off.`}),t.animate===`chapters`&&e.sources.audio===`off`&&n.push({field:`animate`,message:`Chapter openers are found from the narration. Turn narration on, or choose Every Nth image.`}),t.animate===`every`&&!(Number.isInteger(t.animateEvery)&&t.animateEvery>=2&&t.animateEvery<=10)&&n.push({field:`animateEvery`,message:`Choose every 2nd to every 10th image.`}),t.animate!==`off`&&t.animateModel.trim()===``&&n.push({field:`animateModel`,message:`Choose an image-to-video model to animate images with, or turn Animate images off.`}),n}function kE(e){return[[`Cuts`,xE[e.cuts]],[`Transition`,e.transition===`cut`?SE.cut:`${SE[e.transition]} · ${String(e.transitionSeconds)} s`],[`Vignette`,CE[e.vignette]],[`Film grain`,CE[e.grain]],[`Colour grade`,wE[e.grade]],[`Atmosphere`,TE[e.atmosphere]],[`Chapter cards`,e.chapterCards?`On`:`Off`],[`Animate images`,e.animate===`off`?EE.off:`${e.animate===`every`?`Every ${(e=>e===2?`2nd`:e===3?`3rd`:`${String(e)}th`)(e.animateEvery)} image`:EE.chapters}${e.animateModel.trim()===``?``:` · ${e.animateModel}`}`]]}var AE=[`audiobook`,`podcast`,`drama`,`interview`],jE={audiobook:`Audiobook`,podcast:`Podcast`,drama:`Radio drama`,interview:`Interview`},ME=[`narrator`,`host`,`guest`,`character`],hle=[`script`,`attribute`,`adapt`],NE=[.8,.9,1,1.1,1.2],PE=[0,.2,.35,.5,.8,1.2],gle=.35,_le=J({provider:G(),model:G(),voice:G()}),vle=J({id:G().min(1).max(60).regex(/^[a-z0-9-]+$/),name:G().max(40),role:Y(ME),voice:_le,pace:K().optional(),pronunciations:G().max(2e4).optional(),castId:G().max(200).optional(),portrait:G().regex(/^[0-9a-f]{64}$/).optional()}),FE=9999,yle=J({title:G().max(200),chapter:K()}).strict().readonly();function IE(e){return`${e.title.trim()} · Chapter ${String(e.chapter)}`}var LE=J({format:Y(AE),source:Y(hle),speakers:q(vle).max(10),turnGapSeconds:K(),nameTags:Mw(),nativeDialogue:Mw(),audioFiles:Mw(),book:yle.optional()});function RE(e,t=[]){return{format:e,source:`script`,speakers:ble(e,xle(e),t),turnGapSeconds:gle,nameTags:e===`podcast`||e===`interview`,nativeDialogue:!0,audioFiles:!0}}function ble(e,t,n){if(n.length===0||e!==`podcast`&&e!==`interview`)return[...t];let r=n.slice(0,9).map(e=>({...e,role:`host`})),i=e===`podcast`?t.slice(0,Math.max(0,2-r.length)):t.filter(e=>e.role!==`host`);return[...r,...i.filter(e=>!r.some(t=>t.id===e.id))]}function xle(e){let t={provider:``,model:``,voice:``},n=(e,n,r)=>({id:e,name:n,role:r,voice:t});switch(e){case`audiobook`:return[n(`narrator`,`Narrator`,`narrator`)];case`podcast`:return[n(`host-1`,`Alex`,`host`),n(`host-2`,`Sam`,`host`)];case`drama`:return[n(`narrator`,`Narrator`,`narrator`),n(`character-1`,`Mara`,`character`)];case`interview`:return[n(`host-1`,`Host`,`host`),n(`guest-1`,`Guest`,`guest`)]}}function zE(e){return e.voices!==void 0&&e.sources.audio===`generate`}function BE(e){return zE(e)&&e.voices?.source===`script`}function Sle(e){let t=[],{speakers:n}=e;n.length===0&&t.push({field:`voices.speakers`,message:`Add at least one speaker under Speakers (Play → Narration, or Edit project → Providers).`}),e.source===`attribute`&&e.format!==`audiobook`&&t.push({field:`voices.source`,message:`Only audiobooks can hand an existing text's dialogue to speakers. Choose Write a script under Speakers (Play → Narration, or Edit project → Providers).`}),(e.format===`podcast`||e.format===`interview`)&&n.length<2&&t.push({field:`voices.speakers`,message:`A ${jE[e.format].toLowerCase()} needs at least two speakers. Add one under Speakers (Play → Narration, or Edit project → Providers).`}),(e.format===`audiobook`||e.format===`drama`)&&!n.some(e=>e.role===`narrator`)&&t.push({field:`voices.speakers`,message:`An ${e.format===`drama`?`radio drama`:`audiobook`} needs a narrator. Set one speaker's role to Narrator under Speakers (Play → Narration, or Edit project → Providers).`});let r=new Set,i=new Set;for(let[e,a]of n.entries()){let n=`voices.speakers.${String(e)}`,o=a.name.trim();o===``?t.push({field:`${n}.name`,message:`Enter a name for this speaker.`}):/^[\p{L}\p{N}][\p{L}\p{N} .'-]*$/u.test(o)?r.has(o.toLowerCase())&&t.push({field:`${n}.name`,message:`Two speakers are called "${o}". Give each speaker a different name.`}):t.push({field:`${n}.name`,message:`Use only letters, numbers, spaces, dots, apostrophes and hyphens in a speaker name, starting with a letter or number.`}),r.add(o.toLowerCase()),i.has(a.id)&&t.push({field:`${n}.name`,message:`Two speakers share one id. Remove one of them and add it again.`}),i.add(a.id),a.voice.provider.trim()===``||a.voice.model.trim()===``?t.push({field:`${n}.voice`,message:`Choose a voice provider and model for ${o||`this speaker`}.`}):a.voice.voice.trim()===``&&t.push({field:`${n}.voice.voice`,message:`Choose a voice for ${o||`this speaker`}.`}),a.pace!==void 0&&!NE.includes(a.pace)&&t.push({field:`${n}.pace`,message:`Pick a pace from the list for ${o||`this speaker`}.`})}return e.book!==void 0&&(e.book.title.trim()===``&&t.push({field:`voices.book.title`,message:`Enter the book's title under Speakers (Play → Narration), or remove the book to make a project on its own.`}),(!Number.isInteger(e.book.chapter)||e.book.chapter<1||e.book.chapter>9999)&&t.push({field:`voices.book.chapter`,message:`Enter a chapter number from 1 to ${String(FE)} under Speakers (Play → Narration).`})),PE.includes(e.turnGapSeconds)||t.push({field:`voices.turnGapSeconds`,message:`Pick a gap between turns from the list under Speakers (Play → Narration, or Edit project → Providers).`}),t}function Cle(e){return e.mode===`short`}function wle(e){if(!Cle(e))return[];let t=[];e.format!==`9:16`&&t.push({field:`format`,message:`A short is vertical. Choose the 9:16 format, or make a long video instead.`}),wb(e.sources,`video`)!==`generate`&&t.push({field:`sources.video`,message:`A short is a video. Set Video to Generate.`}),wb(e.sources,`audio`)===`off`&&t.push({field:`sources.audio`,message:`A short's length and captions come from its narration. Set Narration to Generate or Provide.`}),wb(e.sources,`images`)===`off`&&t.push({field:`sources.images`,message:`A short shows images behind its captions. Set Images to Generate or Provide.`});for(let n of[`thumbnail`,`document`])wb(e.sources,n)!==`off`&&t.push({field:`sources.${n}`,message:`A short has no ${n===`thumbnail`?`thumbnail`:`PDF`}. Set ${n===`thumbnail`?`Thumbnail`:`Document`} to Off.`});return e.shorts?.enabled===!0&&t.push({field:`shorts.enabled`,message:`A short isn't cut into more shorts. Turn Shorts off.`}),t}var VE=22.5,HE=`zoom`,UE={zoom:`Zoom in and out`,pan:`Pan across`,mixed:`Mix of both`,still:`Still`};function WE(e){return Number.isInteger(e)&&e>=1&&e<=600?void 0:`Enter a whole number of seconds between 1 and 600.`}function Tle(e){return Number.isInteger(e*2)&&e>=0&&e<=50?void 0:`Enter a zoom between 0 and 50 percent, in steps of 0.5.`}function Ele(e){return Number.isInteger(e*2)&&e>=0&&e<=30?void 0:`Enter a number of seconds between 0 and 30, in steps of 0.5.`}var GE={research:[`off`,`generate`,`provide`],article:[`off`,`generate`,`provide`],audio:[`off`,`generate`,`provide`],images:[`off`,`generate`,`provide`],thumbnail:[`off`,`from_prompt`,`prompt_by_llm`,`provide`],video:[`off`,`generate`],document:[`off`,`generate`]};function Dle(e){let t=[],n=Ole(e.draft),{sources:r}=n;n.title===``?t.push({field:`title`,message:`Enter a title for this video.`}):n.title.length>200&&t.push({field:`title`,message:`Keep the title to 200 characters or fewer.`});for(let e of bb)GE[e].includes(wb(r,e))||t.push({field:`sources.${e}`,message:`"${wb(r,e)}" is not an option for ${e}. Reload the page and choose again.`});Nle(n)&&!$E(n.llm)&&t.push({field:`llm`,message:`Choose a text (LLM) provider and model.`}),r.article===`generate`&&qE(n.articlePrompt)&&t.push({field:`articlePrompt`,message:`Pick an article prompt.`});let i=n.audio;t.push(...Ple(n)),t.push(...Fle(n)),r.audio===`generate`&&(i===void 0||!$E(i)?t.push({field:`audio`,message:`Choose a narration provider and model.`}):i.voice.trim()===``&&t.push({field:`audio.voice`,message:`Choose a voice for the narration.`})),r.images===`generate`&&kle(n,t),(r.images===`generate`||r.thumbnail===`from_prompt`||r.thumbnail===`prompt_by_llm`||QE(n)||OE(n))&&!$E(n.images)&&t.push({field:`images`,message:`Choose an image provider and model.`}),(r.thumbnail===`from_prompt`||r.thumbnail===`prompt_by_llm`)&&qE(n.thumbnailPrompt)&&t.push({field:`thumbnailPrompt`,message:`Pick a thumbnail prompt.`}),r.audio===`off`&&n.subtitles!==void 0&&n.subtitles.mode!==`off`&&t.push({field:`subtitles.mode`,message:`Subtitles need narration. Turn narration on, or turn subtitles off.`}),t.push(...Ile(n)),t.push(...Rle(n)),t.push(...wle(n)),t.push(...zle(n)),t.push(...Ble(n,e.staged)),t.push(...Rce(n.loudness)),t.push(...Vce(n)),t.push(...Lle(n)),t.push(...Zce(n)),ZE(n)&&n.reference?.source===`provide`&&KE(e.staged,n.provided.reference,`images`,`provided.reference`,`Upload the establishing image, or set Establishing image to Off in the Images section.`,t),Ale(n,e.staged,t),Mle(n,e.requiredSlots,t),(!Number.isFinite(n.silenceGapSeconds)||n.silenceGapSeconds<0||n.silenceGapSeconds>30)&&t.push({field:`silenceGapSeconds`,message:`Enter a silence gap between 0 and 30 seconds.`});let a=r.video===`generate`?WE(n.imageSeconds):void 0;a!==void 0&&t.push({field:`imageSeconds`,message:a});let o=r.video===`generate`?Tle(n.zoomPercent):void 0;o!==void 0&&t.push({field:`zoomPercent`,message:o});let s=r.audio===`off`?void 0:Ele(n.edgeSilenceSeconds);return s!==void 0&&t.push({field:`edgeSilenceSeconds`,message:s}),t.length===0?{ok:!0,draft:n}:{ok:!1,fields:t}}function Ole(e){let t={...e.sources};t.article!==`generate`&&(t.research=`off`),t.images===`off`&&t.video===`generate`&&(t.video=`off`);let n=Object.create(null);for(let[t,r]of Object.entries(e.values))n[t]=r.trim();return{...e,title:e.title.trim(),subtitles:t.video===`off`&&e.subtitles?.mode===`burn-in`?{...e.subtitles,mode:`files`}:e.subtitles,sources:t,values:n,intro:t.audio===`generate`?e.intro:void 0,outro:t.audio===`generate`?e.outro:void 0}}function kle(e,t){if(e.imagePrompts.length===0){t.push({field:`imagePrompts`,message:`Tick at least one image prompt, or turn images off.`});return}let n=0;for(let[r,i]of e.imagePrompts.entries())n+=i.number,qE(i.name)&&t.push({field:`imagePrompts.${r}.name`,message:`Pick an image prompt.`}),(!Number.isInteger(i.number)||i.number<1||i.number>20)&&t.push({field:`imagePrompts.${r}.number`,message:`Enter a whole number between 1 and 20.`});n>60&&t.push({field:`imagePrompts`,message:`A video can have at most 60 images; these prompts ask for ${n}. Lower the numbers.`});let r=e.imageScale===void 0?void 0:Mce(e.imageScale);r!==void 0&&t.push({field:`imageScale`,message:r})}function Ale(e,t,n){let{sources:r,provided:i}=e;if(r.research===`provide`&&qE(i.research)&&n.push({field:`provided.research`,message:`Paste the text to adapt, or your research notes.`}),r.article===`provide`&&qE(i.article)&&n.push({field:`provided.article`,message:`Paste the article.`}),n.push(...Vle(e)),r.audio===`provide`&&KE(t,i.audio,`audio`,`provided.audio`,`Pick an audio file.`,n),r.thumbnail===`provide`&&KE(t,i.thumbnail,`thumbnail`,`provided.thumbnail`,`Pick a thumbnail image.`,n),r.images===`provide`){let e=i.images??[];e.length===0?n.push({field:`provided.images`,message:`Pick at least one image.`}):e.length>60&&n.push({field:`provided.images`,message:`A video can have at most 60 images. Remove some.`}),new Set(e).size!==e.length&&n.push({field:`provided.images`,message:`The same image is picked twice. Remove the duplicate.`});for(let[r,i]of e.entries())KE(t,i,`images`,`provided.images.${r}`,`Pick an image.`,n)}jle(e,t,n)}function jle(e,t,n){let r=e.provided.shortsMusic;if(e.shorts?.enabled!==!0||r===void 0)return;let i=`under Outputs → More shorts options → Background music`,a=t.find(e=>e.id===r);a===void 0||a.stageKind!==`audio`?n.push({field:`shorts.music`,message:`The shorts' background music file is no longer available, so it can't be added to the project. Choose the file again ${i}, or remove it.`}):a.state!==`staged`&&n.push({field:`shorts.music`,message:`The shorts' background music is still uploading, so the run can't start yet. Wait for it to finish, or remove it ${i}.`})}function KE(e,t,n,r,i,a){if(t===void 0||t===``){a.push({field:r,message:i});return}let o=e.find(e=>e.id===t);if(o===void 0||o.stageKind!==n){a.push({field:r,message:`That upload is no longer available. Choose the file again.`});return}o.state!==`staged`&&a.push({field:r,message:`This file is still uploading. Wait for it to finish.`})}function Mle(e,t,n){for(let r of t){let t=Object.hasOwn(e.values,r)?e.values[r]:void 0;if(t===void 0||t===``){n.push({field:`values.${r}`,message:`Fill in this field.`});continue}t.length>200&&n.push({field:`values.${r}`,message:`Keep this to 200 characters or fewer.`}),/[\n\r]/.test(t)&&n.push({field:`values.${r}`,message:`Keep this to a single line, without line breaks.`})}}function qE(e){return e===void 0||e.trim()===``}function JE(e){let t=e.sources,n=[];return t.research===`generate`&&n.push({section:`article`,label:`researching the topic`}),t.article===`generate`&&n.push({section:`article`,label:`writing the article`}),zE(e)&&e.voices?.source===`attribute`&&n.push({section:`narration`,label:`working out who speaks each line`}),zE(e)&&e.voices?.source===`adapt`&&n.push({section:`narration`,label:`rewriting the text as a conversation`}),YE(e)&&n.push({section:`narration`,label:`preparing the narration's delivery`}),e.intro?.mode===`llm`&&n.push({section:`narration`,label:`writing the intro`}),e.outro?.mode===`llm`&&n.push({section:`narration`,label:`writing the outro`}),t.thumbnail===`prompt_by_llm`&&n.push({section:`outputs`,label:`writing the thumbnail prompt`}),XE(e)&&n.push({section:`outputs`,label:`writing the YouTube description`}),QE(e)&&n.push({section:`outputs`,label:`picking the shorts`}),n}function Nle(e){return JE(e).length>0}function YE(e){return e.sources.audio===`generate`&&!qE(e.narrationPrompt)}function Ple(e){return YE(e)&&(e.audio?.provider!==`inworld`||e.audio.model!==`inworld-tts-2`)?[{field:`narrationPrompt`,message:`Narration preparation only works with the Inworld TTS-2 model. Choose that model under Narration, or turn preparation Off.`}]:[]}function Fle(e){if(e.voices===void 0||!zE(e))return[];let t=[...Sle(e.voices)];return!qE(e.narrationPrompt)&&!e.voices.speakers.some(e=>e.voice.provider===`inworld`&&e.voice.model===`inworld-tts-2`)&&t.push({field:`narrationPrompt`,message:`Narration preparation adds delivery cues only to speakers on Inworld's TTS-2 model, and no speaker uses it. Choose that model for a speaker under Speakers, or clear Narration Preparation under Narration → Audio Advanced.`}),t}function XE(e){return e.youtubeDescription===!0&&e.sources.audio!==`off`}function Ile(e){return e.youtubeDescription===!0&&e.sources.audio===`off`?[{field:`youtubeDescription`,message:`The YouTube description is timed from the narration. Turn narration on, or turn the YouTube description off.`}]:[]}function ZE(e){return e.reference!==void 0&&e.sources.images===`generate`}function Lle(e){return ZE(e)&&e.reference?.source===`prompt`&&(e.reference.prompt===void 0||e.reference.prompt.trim()===``)?[{field:`reference.prompt`,message:`Pick an image prompt for the establishing image, upload one instead, or set Establishing image to Off in the Images section.`}]:[]}function QE(e){return e.shorts?.enabled===!0&&e.sources.audio!==`off`}function Rle(e){let t=e.shorts;if(t?.enabled!==!0)return[];if(e.sources.audio===`off`)return[{field:`shorts.enabled`,message:`Shorts are cut from the narration. Turn narration on, or turn Shorts off.`}];let n=sle(t).map(e=>({field:`shorts.${e.field}`,message:e.message})),r=e.sources.video===`generate`?void 0:WE(e.imageSeconds);return r!==void 0&&n.push({field:`imageSeconds`,message:r}),n}function zle(e){return mle(e).map(e=>({field:`videoEdit.${e.field}`,message:e.message}))}function Ble(e,t){let n=e.ambientBed;if(n===void 0||!ule(e))return[];let r=`under Video and style → Ambient sound`,i=uE(n).map(e=>({field:`ambientBed.${e.field}`,message:`${e.message} Change it ${r}.`}));if(n.source!==`upload`)return i;let a=e.provided.ambientBed,o=a===void 0?void 0:t.find(e=>e.id===a);return o===void 0||o.stageKind!==`audio`?i.push({field:`ambientBed.file`,message:`The ambient sound's audio file is missing, so it can't be added to the project. Choose the file ${r}, or pick Rain, Fireplace or Wind instead.`}):o.state!==`staged`&&i.push({field:`ambientBed.file`,message:`The ambient sound's audio file is still uploading, so the run can't start yet. Wait for it to finish ${r}.`}),i}function $E(e){return e!==void 0&&e.provider.trim()!==``&&e.model.trim()!==``}function eD(e){return e.sources.audio===`generate`&&e.audio?.usePronunciationGlossary===!0&&e.audio.provider===`inworld`&&(e.audio.model===`inworld-tts-2`||e.audio.model===`inworld-tts-2-flash`)}function Vle(e){let{sources:t}=e;if(t.article!==`off`)return[];let n=`Set Article to Generate or Provide`;return[...t.audio===`generate`?[{field:`sources.audio`,message:`Narration reads the article, and Article is Off. ${n}, or set Narration to Off or Provide.`}]:[],...t.document===`generate`?[{field:`sources.document`,message:`The PDF is made from the article, and Article is Off. ${n}, or set PDF to Off.`}]:[],...t.thumbnail===`prompt_by_llm`?[{field:`sources.thumbnail`,message:`The AI writes the thumbnail prompt from the article, and Article is Off. ${n}, or pick From prompt for the thumbnail.`}]:[],...t.audio!==`off`&&e.subtitles!==void 0&&e.subtitles.mode!==`off`?[{field:`subtitles.mode`,message:`Captions are matched to the article's words, and Article is Off. ${n}, or turn captions off.`}]:[],...XE(e)?[{field:`youtubeDescription`,message:`The YouTube description is written from the narration's words, which come from the article, and Article is Off. ${n}, or turn the YouTube description off.`}]:[],...QE(e)?[{field:`shorts.enabled`,message:`Shorts are picked from the narration's words, which come from the article, and Article is Off. ${n}, or turn Shorts off.`}]:[],...t.images===`generate`&&e.imageScenes===!0?[{field:`imageScenes`,message:`Scenes from the article need the article, and Article is Off. ${n}, or turn Scenes from the article off.`}]:[]]}var tD=[`auto`,`yes`,`no`],nD={auto:`Automatic`,yes:`Always Yes`,no:`Always No`},rD={levelDb:K(),fadeInSeconds:K(),tailSeconds:K()},Hle=J({source:Y(cE),...rD}).strict(),Ule=J({source:Y(sE),...rD}).strict(),iD=`Previous video`,aD=2e3,Wle=/\{\{([^{}\n]{1,80})\}\}/gu;function oD(e){return e.trim().replace(/\s+/gu,` `).toLowerCase()}function Gle(e,t){let n=new Set,r=[];for(let i of[...t,...e]){let e=oD(i.name);n.has(e)||i.url.trim()===``||(n.add(e),r.push(i))}return r}function sD(e,t){let n=new Map(t.map(e=>[oD(e.name),e.url])),r=[],i=0;for(let t of e.matchAll(Wle)){let a=t.index;a>i&&r.push({kind:`text`,text:e.slice(i,a)});let o=(t[1]??``).trim();r.push({kind:`placeholder`,raw:t[0],name:o,url:n.get(oD(o))}),i=a+t[0].length}return i<e.length&&r.push({kind:`text`,text:e.slice(i)}),r}function cD(e,t){let n=[];return{text:sD(e,t).map(e=>e.kind===`text`?e.text:e.url===void 0?(n.some(t=>oD(t)===oD(e.name))||n.push(e.name),e.raw):e.url).join(``),unknown:n}}function Kle(e){if(e.length>50)return`Keep at most 50 links. Remove some.`;let t=new Set;for(let[n,r]of e.entries()){let e=`Link ${String(n+1)}`,i=r.name.trim();if(i===``)return`${e} has no name. Give it one, such as Patreon.`;if(i.length>60)return`${e}'s name is over 60 characters. Shorten it.`;if(/[{}]/u.test(i))return`${e}'s name contains { or }. Use the name alone; the description writes it as {{${i.replace(/[{}]/gu,``)}}}.`;if(t.has(oD(i)))return`Two links are named "${i}". Rename one, since {{${i}}} can only fill with one.`;t.add(oD(i));let a=r.url.trim();if(a.length>2e3)return`The "${i}" link is over ${String(aD)} characters. Use a shorter address.`;if(a===``)return`The "${i}" link has no address. Paste it, starting with https://.`;if(!qle(a))return`The "${i}" link is not a web address. Paste the full address, starting with https://.`}}function qle(e){try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}}var lD=kw(),uD=G().regex(/^#[0-9a-fA-F]{6}$/,`Use a colour like #FFD700.`).transform(e=>e.toUpperCase()),dD=e=>G().trim().max(e).optional(),fD=G().max(160).regex(/^[A-Za-z0-9_-]+$/,`Choose a font from the list.`).optional(),Jle=J({captionFontId:fD,captionColor:uD.optional(),captionOutlineColor:uD.optional(),titleFontId:fD,titleColor:uD.optional(),intro:dD(200),outro:dD(200),endScreenText:dD(200),documentTheme:dD(200),ambientBed:Ule.superRefine((e,t)=>{for(let n of uE(e))t.addIssue({code:`custom`,path:[n.field],message:`${n.message} Change it under Brand kit → Ambient sound on the channel page.`})}).optional(),language:kT.optional(),links:q(J({name:G().max(240),url:G().max(aD*2)}).strict()).max(100).transform(e=>e.map(e=>({name:e.name.trim(),url:e.url.trim()}))).superRefine((e,t)=>{let n=Kle(e);n!==void 0&&t.addIssue({code:`custom`,message:`The channel's links weren't saved: ${n} Then press Save channel on the channel's Brand tab.`})}).optional()}).strict().transform(e=>Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0&&e!==``))),pD=G().trim().min(1,`Enter a name.`).max(200,`Keep the name to 200 characters or fewer.`);J({id:lD,name:pD}).strict().readonly(),J({name:pD,brand:Jle,seriesBrief:G().max(1e4,`Keep the series brief to 10,000 characters or fewer.`),baseVersion:K().int().positive()}).strict().readonly();var mD=G().trim().min(1,`Enter a name, and remove empty aliases.`).max(200,`Keep names and aliases to 200 characters or fewer.`),Yle=J({provider:G().trim().min(1,`Choose a voice provider.`).max(100),model:G().trim().min(1,`Choose a voice model.`).max(200),voice:G().trim().min(1,`Choose a voice.`).max(200),pace:K().refine(e=>NE.includes(e),`Pick a pace from the list.`).optional(),pronunciations:G().max(2e4,`Keep the pronunciations to 20,000 characters or fewer.`).optional()}).strict(),hD=J({kind:Y(My),name:mD,aliases:q(mD).max(20,`Keep to 20 aliases or fewer.`).default([]),description:G().trim().max(2e3,`Keep the description to 2,000 characters or fewer.`).default(``),voice:Yle.nullable().optional(),host:Mw().optional()}).strict();hD.extend({id:lD}).strict(),hD.extend({baseVersion:K().int().positive()}).strict(),J({memberId:lD,to:K().int().nonnegative()}).strict().readonly(),J({prompt:G().trim().min(1,`Describe the picture to make.`).max(4e3,`Keep the picture's description to 4,000 characters or fewer.`),provider:G().min(1).max(100),model:G().min(1).max(200)}).strict(),J({channelId:lD}).strict(),J({aiDisclosure:Y(tD,`Choose Automatic, Always Yes or Always No.`)}).strict();var Xle=q(J({name:G(),aliases:q(G()).readonly(),description:G(),images:q(G()).readonly()})).readonly(),gD=G().min(1),_D=G().regex(/^[a-f0-9]{64}$/),vD=Y([`audio`,`images`,`video`]),yD=J({projectId:gD,revisionId:gD,checkpointId:gD,stage:vD,workId:gD,fingerprint:_D,state:Y([`configured`,`pending-review`,`held`,`released`,`satisfied`,`invalidated`,`canceled`]),createdAt:Jw(),approvedAt:Jw().nullable()}).strict().readonly();J({projectId:gD,revisionId:gD,checkpoints:q(J({checkpointId:gD,stage:vD,workId:gD,fingerprint:_D,state:Y([`configured`,`pending-review`,`held`])}).strict().readonly()).max(3).readonly(),createdAt:Jw()}).strict().readonly();var Zle=J({projectId:gD,revisionId:gD,checkpointId:gD,fingerprint:_D,idempotencyKey:kw(),approvedAt:Jw()}).strict().readonly(),bD=[`plain`],xD=`dicemaster`,Qle=[...bD,xD],SD={plain:`Plain`,dicemaster:`DiceMaster`};function CD(e){return e?.theme??`dicemaster`}function wD(e){return e?.theme??`plain`}function TD(e){return e?.custom?.name??SD[CD(e)]}function $le(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.`}]:[]}var ED=[`Cinzel`,`Literata`,`times`,`helvetica`,`courier`],eue=[`normal`,`medium`,`bold`,`black`,`italic`,`bolditalic`],DD=(e,t)=>{let n={error:`Use a value from ${String(e)} to ${String(t)}.`};return K({error:`Enter a number.`}).finite(n).min(e,n).max(t,n)},OD=G().regex(/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i,`Use a colour like #8c1e14.`),kD=G().max(300,{error:`Keep this under 300 characters.`}),AD=kD.nullable(),jD=G().max(500,{error:`Keep this under 500 characters.`}).nullable(),MD=J({family:Y(ED),style:Y(eue),letterSpacing:DD(-.5,2)}).strict(),ND=J({page:J({format:Y([`a4`,`letter`]),margin:DD(5,60),contentTop:DD(5,80)}).strict(),background:J({image:Y([`parchment`]).nullable(),color:OD}).strict(),colors:J({heading:OD,text:OD,muted:OD,faint:OD}).strict(),fonts:J({body:MD,strong:MD,emphasis:MD,heading:MD,dramatic:MD,decorative:MD,dropCap:MD,footer:MD}).strict(),sizes:J({brand:DD(6,72),title:DD(6,72),section:DD(6,72),heading:DD(6,72),subheading:DD(6,72),body:DD(6,24),footer:DD(5,24),meta:DD(5,24)}).strict(),spacing:J({bodyLine:DD(3,20),headingLine:DD(3,30),subheadingLine:DD(3,30),paragraphGap:DD(0,3),headingGap:DD(0,5),itemGap:DD(0,3),listIndent:DD(0,30),quoteIndent:DD(0,40),ruleWidth:DD(0,150)}).strict(),dropCap:J({enabled:Mw(),lines:Fw([Vw(2),Vw(3),Vw(4)]),scale:DD(1,5),gap:DD(0,20),minLength:K({error:`Enter a number.`}).int({error:`Use a whole number.`}).min(0,{error:`Use a value from 0 to 2000.`}).max(2e3,{error:`Use a value from 0 to 2000.`}),minRoom:DD(0,1)}).strict(),titlePage:J({brandY:DD(10,200),taglineOffset:DD(0,60),titleY:DD(10,250),titleLine:DD(3,40),metaOffset:DD(0,100),metaLine:DD(3,30),showDate:Mw(),showWordCount:Mw(),cover:J({enabled:Mw(),gap:DD(0,40),maxHeight:DD(20,200)}).strict()}).strict(),contents:J({enabled:Mw(),title:kD,depth:Fw([Vw(1),Vw(2),Vw(3)]),titleOffset:DD(0,100),firstEntryOffset:DD(0,150),line:DD(3,30),indent:DD(0,30)}).strict(),header:J({enabled:Mw(),top:DD(3,60),maxTitleCharacters:K({error:`Enter a number.`}).int({error:`Use a whole number.`}).min(5,{error:`Use a value from 5 to 200.`}).max(200,{error:`Use a value from 5 to 200.`})}).strict(),footer:J({enabled:Mw(),bottom:DD(3,60),reserve:DD(0,60),text:kD}).strict(),brand:J({name:AD,url:jD,tagline:AD,linkLabel:AD}).strict(),metadata:J({author:kD,subject:kD,keywords:G().max(1e3),creator:kD}).strict(),sources:J({enabled:Mw(),title:kD,titleOffset:DD(0,100),bodyOffset:DD(0,150),line:DD(3,30),gap:DD(0,20)}).strict(),endPage:J({enabled:Mw(),title:kD,titleOffset:DD(0,100),bodyOffset:DD(0,150),lines:q(kD).max(60).readonly(),showDocumentDetails:Mw(),link:J({text:kD,url:jD}).strict().nullable(),closing:AD}).strict()}).strict(),tue=J({id:G().min(1).max(64),name:G().min(1).max(80),values:ND}).strict(),PD=J({theme:Y(Qle),custom:tue.optional()}).strict(),FD=1e3,ID=/[\p{L}\p{M}\p{N}_]/u;function nue(e,t){let n=[];for(let r of t){let t=r.written.trim();if(t===``)continue;let i=t.split(/\s+/u).map(e=>e.replace(/[|\\{}()[\]^$+*?.]/gu,`\\$&`)).join(`\\s+`),a=new RegExp(i,r.caseSensitive?`gu`:`giu`),o=Array.from(t)[0]??``,s=Array.from(t).at(-1)??``;for(let t of e.matchAll(a)){let i=t.index,a=i+t[0].length;if(r.wholeWord){let t=Array.from(e.slice(Math.max(0,i-2),i)).at(-1)??``,n=Array.from(e.slice(a,a+2))[0]??``;if(ID.test(o)&&ID.test(t)||ID.test(s)&&ID.test(n))continue}n.push({start:i,end:a,spoken:r.spoken})}}n.sort((e,t)=>e.start-t.start||t.end-e.end);let r=[],i=0;for(let e of n)e.start<i||(r.push(e),i=e.end);return r}function LD(e,t){let n=``,r=0;for(let i of nue(e,t))n+=e.slice(r,i.start)+i.spoken,r=i.end;return n+e.slice(r)}var RD=J({written:G().trim().min(1).max(200),spoken:G().trim().min(1).max(500),wholeWord:Mw(),caseSensitive:Mw()}).strict().readonly(),zD=q(RD).max(FD).readonly();function BD(e,t,n){let r=new Map;return(...i)=>{let a=t(...i),o=r.get(a);if(o!==void 0||r.has(a))return r.delete(a),r.set(a,o),o;let s=n(...i);return r.set(a,s),r.size>e&&r.delete(r.keys().next().value),s}}var VD=[`whole`,`paragraph`,`words`,`characters`],HD=[`off`,`files`,`burn-in`],UD=[`top`,`upper-middle`,`center`,`lower-middle`,`bottom`],WD=J({mode:Y(HD),language:Vw(`en`).default(`en`),fontId:G().max(160).regex(/^[A-Za-z0-9_-]+$/).default(`default`),position:Y(UD).default(`bottom`),fontSize:K().int().min(16).max(120).default(48),color:G().regex(/^#[0-9A-Fa-f]{6}$/).optional(),outlineColor:G().regex(/^#[0-9A-Fa-f]{6}$/).optional()}),GD={mode:`off`,language:`en`,fontId:`default`,fontSize:48,position:`bottom`},rue=G().regex(/^#[0-9A-Fa-f]{6}$/),KD=J({provider:G(),model:G(),thinking:Y(Yw).optional()}),qD=J({name:G(),mode:Y(Eb)}),JD=J({cuts:Y(mE),transition:Y(hE),transitionSeconds:K(),vignette:Y(gE),grain:Y(gE),grade:Y(_E),atmosphere:Y(vE),chapterCards:Mw(),animate:Y(yE),animateEvery:K(),animateModel:G()}),YD=J({mode:Y(Ab).optional(),checkpoints:q(vD).max(3).refine(e=>new Set(e).size===e.length).readonly().optional(),title:G(),format:Y(yb),sources:J({research:Y(Cb),article:Y(Cb),audio:Y(Cb),images:Y(Cb),thumbnail:Y(Cb),video:Y(Cb),document:Y(Cb).optional()}),llm:KD.optional(),audio:KD.extend({voice:G(),usePronunciationGlossary:Mw().optional(),shareGlossary:Mw().optional(),useNarrationAliases:Mw().optional(),describeFigures:Mw().optional(),skipCode:Mw().optional()}).optional(),narrationAliases:zD.optional(),pronunciationRules:Fw([Vw(1),Vw(2)]).optional(),sharedGlossary:q(J({term:G().min(1).max(200),ipa:q(G().min(1).max(200)).min(1).max(20).readonly()})).max(2e4).readonly().optional(),images:KD.optional(),reference:J({source:Y(kb),prompt:G().optional(),thumbnail:Mw().optional()}).optional(),articlePrompt:G().optional(),narrationPrompt:G().optional(),imagePrompts:q(J({name:G(),number:K()})),imageScale:J({perHour:K(),words:K()}).optional(),imageScenes:Mw().optional(),thumbnailPrompt:G().optional(),thumbnailCount:Fw([Vw(1),Vw(3)]).optional(),intro:qD.optional(),outro:qD.optional(),values:Rw(G(),G()),provided:J({research:G().optional(),article:G().optional(),audio:G().optional(),images:q(G()).optional(),thumbnail:G().optional(),reference:G().optional(),shortsMusic:G().optional(),ambientBed:G().optional()}),chunking:J({mode:Y(VD),words:K().optional(),characters:K().int().min(1).max(1e6).optional()}).optional(),silenceGapSeconds:K(),imageSeconds:K().default(15),zoomPercent:K().default(VE),motionStyle:Y(Tb).default(HE),edgeSilenceSeconds:K().default(2),subtitles:WD.optional(),document:PD.optional(),youtubeDescription:Mw().optional(),showFigures:Mw().optional(),descriptionPrompt:G().optional(),shorts:J({enabled:Mw(),count:K(),minSeconds:K(),maxSeconds:K(),prompt:G().optional(),imagePrompt:G().optional(),titleOnScreen:Mw().optional(),fullVideoLink:G().optional(),musicVolume:K().optional(),speed:K().optional()}).optional(),videoEdit:JD.optional(),channelId:G().optional(),useBrandKit:Vw(!1).optional(),cast:Xle.optional(),earlierEpisodes:q(J({title:G(),summary:G()})).readonly().optional(),titleStyle:J({fontId:G().max(160).regex(/^[A-Za-z0-9_-]+$/).optional(),color:rue.optional()}).optional(),endScreen:J({text:G().max(200)}).optional(),reviews:J({provider:G(),model:G(),thinking:Y(Yw).optional(),reviewer:Vw(`agent`).optional(),retries:K().optional(),stages:zw(Y(XT),J({mode:Y(ZT),prompt:G().optional()}))}).optional(),voices:LE.optional(),ambientBed:Hle.optional(),loudness:J({videoLufs:K(),audioFilesLufs:K()}).strict().optional(),sentencePauseSeconds:K().optional(),paragraphPauseSeconds:K().optional(),removeBreaths:Mw().optional(),deEss:Mw().optional(),levelSentences:Mw().optional(),language:kT.optional()}),XD=YD.extend({rendered:Rw(G(),G()),titlePattern:G().optional(),subjectTitle:G().optional()});J({id:G(),kind:Y(jb),name:G(),body:G(),slots:G(),updated_at:G()}),J({id:G(),category:Y(Mb),mode:Y(Eb),name:G(),body:G(),slots:G(),updated_at:G()});var ZD=J({id:G(),name:G(),body:G(),slots:q(G()).readonly(),updatedAt:G()}),QD=J({prompts:q(ZD.extend({kind:Y(jb)}).strict().readonly()).readonly(),entries:q(ZD.extend({category:Y(Mb),mode:Y(Eb)}).strict().readonly()).readonly()}).strict().readonly(),$D=kw(),eO=G(),tO=Rw(eO,eO).readonly(),nO=J({provider:eO,model:eO,thinking:Y(Yw).optional()}).strict(),rO=[`audio`,`images`,`thumbnail`,`reference`],iO=J({attachmentId:$D,name:eO}).strict().readonly(),aO=J({title:eO,checkpoints:YD.shape.checkpoints,format:Y(yb),sources:J({research:Y(Cb),article:Y(Cb),audio:Y(Cb),images:Y(Cb),thumbnail:Y(Cb),video:Y(Cb),document:Y(Cb).optional()}).strict().readonly(),document:PD.readonly().optional(),llm:nO.readonly(),audio:nO.extend({voice:eO,usePronunciationGlossary:Mw().optional(),shareGlossary:Mw().optional(),useNarrationAliases:Mw().optional(),describeFigures:Mw().optional(),skipCode:Mw().optional()}).readonly(),images:nO.readonly(),reference:J({source:Y([`off`,...kb]),prompt:eO,thumbnail:Mw()}).strict().readonly().optional(),articlePrompt:eO,narrationPrompt:eO.optional(),thumbnailCount:Fw([Vw(1),Vw(3)]).optional(),loudness:J({enabled:Mw(),videoLufs:K().optional(),audioFilesLufs:K().optional()}).strict().readonly().optional(),sentencePause:eO.optional(),paragraphPause:eO.optional(),removeBreaths:Mw().optional(),deEss:Mw().optional(),levelSentences:Mw().optional(),youtubeDescription:Mw().optional(),showFigures:Mw().optional(),descriptionPrompt:eO.optional(),language:kT.optional(),shorts:J({enabled:Mw(),count:eO,minSeconds:eO,maxSeconds:eO,prompt:eO,imagePrompt:eO,titleOnScreen:Mw().optional(),fullVideoLink:eO.optional(),musicVolume:eO.optional(),speed:eO.optional()}).strict().readonly().optional(),reviews:J({provider:eO,model:eO,thinking:Y(Yw).optional(),reviewer:Y(QT).optional(),retries:eO,stages:zw(Y(XT),J({mode:Y(ZT),prompt:eO}).strict().readonly()).readonly()}).strict().readonly().optional(),imagePrompts:q(J({name:eO,number:eO}).strict().readonly()).readonly(),imageScale:J({every:Y([`minutes`,`hour`]),value:eO}).strict().readonly().optional(),imageScenes:Mw().optional(),thumbnailPrompt:eO,intro:eO,outro:eO,chunking:J({mode:Y(VD),words:eO,characters:eO}).strict().readonly(),subtitles:J({mode:Y(HD),language:Vw(`en`),fontId:eO,fontSize:eO,position:Y(UD)}).strict().readonly(),imageSeconds:eO.default(`15`),edgeSilenceSeconds:eO.default(`2`),zoomPercent:eO.default(String(VE)),motionStyle:Y(Tb).default(HE),silenceGapSeconds:eO.optional(),videoEdit:JD.strict().readonly().optional(),useBrandKit:Mw().optional(),voices:LE.strict().readonly().optional(),ambientBed:J({source:Y([`none`,...cE]),level:eO,fadeIn:eO,tail:eO}).strict().readonly().optional(),values:tO,provided:J({research:eO,article:eO,audio:iO.nullable(),thumbnail:iO.nullable(),images:q(iO).readonly(),reference:iO.nullable().optional(),shortsMusic:iO.nullable().optional(),ambientBed:iO.nullable().optional()}).strict().readonly()}).strict().readonly(),oO=J({schemaVersion:Vw(1),librarySnapshot:QD.optional(),templateSource:J({id:$D,version:K().int().positive()}).strict().readonly().optional(),channelId:$D.optional(),form:aO,section:Y([`content`,`outputs`,`style`,`review`]),variants:q(J({id:$D,title:eO,values:tO}).strict().readonly()).readonly(),queue:Mw().optional(),expectedWords:eO,previewText:eO,fontUpload:J({operationId:$D,name:eO}).strict().readonly().nullable()}).strict().readonly(),sO=J({id:$D,document:oO}).strict().readonly(),cO=sO.unwrap().extend({baseVersion:K().int().positive(),mutationId:$D}).strict().readonly(),lO=sO.unwrap().extend({sourceId:$D}).strict().readonly(),uO=J({id:$D,baseVersion:K().int().positive()}).strict().readonly(),dO=J({id:$D,kind:Y(rO),name:eO,state:Y([`pending`,`copying`,`ready`,`reattach`]),stagedFileId:eO.nullable(),bytes:K().nonnegative(),error:eO.nullable()}).strict().readonly(),fO=J({id:$D,version:K().int().positive(),createdAt:eO,updatedAt:eO,document:oO}).strict().readonly(),pO=J({checkpointSet:q(yD.unwrap().extend({reviewedFingerprint:eO}).strict().readonly()).readonly().optional(),requestId:$D,projectIds:q(eO).readonly(),queue:q(J({projectId:eO,batchId:eO,position:K(),state:Y([`queued`,`active`,`finished`])}).strict().readonly()).readonly(),replayed:Mw()}).strict().readonly(),iue=J({currency:Vw(`USD`),rows:q(J({stage:eO,low:K().nullable(),high:K().nullable(),detail:eO,onPlan:Mw().optional(),apiLow:K().nullable().optional(),apiHigh:K().nullable().optional()}).strict().readonly()).readonly(),low:K(),high:K(),unknown:K(),apiLow:K().optional(),apiHigh:K().optional(),apiUnknown:K().optional(),expectedWords:K(),catalogueDate:eO.nullable(),assumptions:q(eO).readonly()}).strict().readonly(),mO=J({checkpointSet:q(J({runIndex:K().int().nonnegative(),checkpointId:eO,stage:vD,fingerprint:eO,workKeys:q(eO).readonly(),dependents:q(Y(bb)).readonly()}).strict().readonly()).readonly().optional(),id:$D,draftId:$D,draftVersion:K().int().positive(),fingerprint:eO,runs:q(J({draft:YD,rendered:tO,templates:tO}).strict().readonly()).readonly(),estimates:q(iue).readonly()}).strict().readonly(),hO=J({draft:fO,attachments:q(dO).readonly(),review:mO.nullable(),pendingStart:J({reviewId:$D,draftVersion:K().int().positive()}).strict().readonly().nullable(),start:pO.nullable()}).strict().readonly();J({id:kw(),name:G().trim().min(1).max(120),document:oO}).strict().readonly().unwrap().extend({name:G().trim().min(1).max(200),baseVersion:K().int().positive(),mutationId:kw()}).strict().readonly(),J({id:kw(),baseVersion:K().int().positive()}).strict().readonly(),J({templateId:kw(),id:kw(),version:K().int().positive()}).strict().readonly(),J({id:kw(),name:G(),version:K().int().positive(),createdAt:G(),updatedAt:G(),document:oO}).strict().readonly();var gO=J({id:kw(),name:G(),version:K().int().positive(),updatedAt:G(),channelId:G().optional()}),_O=gO.extend({document:oO}),vO=Fw([_O,J({template:_O}).transform(e=>e.template)]),aue=J({title:G(),detail:G().optional(),reason:G().optional()}),yO=[`project-templates`],bO=e=>`${e.origin}/api/project-templates`;async function xO(e,t){let n;try{n=await e.json()}catch{throw po(e,void 0)}if(e.ok)return{ok:!0,value:So(t,n)};let r=aue.safeParse(n);if(!r.success)throw po(e,void 0);let i=r.data.detail??r.data.title;if(![400,404,409].includes(e.status))throw Error(i);return{ok:!1,message:i,reason:r.data.reason??`invalid-request`}}var SO=(e,t)=>({method:e,headers:{"content-type":`application/json`},body:JSON.stringify(t)});async function oue(e){return xO(await e.fetch(bO(e)),J({templates:q(gO)}).transform(e=>e.templates))}function CO(e){return{queryKey:yO,queryFn:async()=>{let t=await oue(e);if(!t.ok)throw Error(t.message);return t.value}}}async function wO(e,t,n){let r=n===void 0?``:`?version=${String(n)}`;return xO(await e.fetch(`${bO(e)}/${encodeURIComponent(t)}${r}`),vO)}async function TO(e,t){let n=J({id:kw(),name:G().trim().min(1),document:oO}).parse(t);return xO(await e.fetch(bO(e),SO(`POST`,n)),vO)}async function EO(e,t,n){let r=J({baseVersion:K().int().positive(),mutationId:kw(),name:G().trim().min(1),document:oO}).parse(n);return xO(await e.fetch(`${bO(e)}/${encodeURIComponent(t)}`,SO(`PUT`,r)),vO)}async function sue(e,t,n){let r=await wO(e,t);if(!r.ok)return`The name wasn't saved: ${r.message} Press Refresh templates, then rename it again.`;let i=await EO(e,t,{baseVersion:r.value.version,mutationId:crypto.randomUUID(),name:n,document:r.value.document});return i.ok?null:`The name wasn't saved: ${i.message}${i.reason===`conflict`?` Press Refresh templates, then rename it again.`:``}`}async function cue(e,t,n){let r=J({id:kw(),name:G().trim().min(1).max(120),revisionId:G().min(1).max(64)}).parse(n);return xO(await e.fetch(`${bO(e)}/from-project/${encodeURIComponent(t)}`,SO(`POST`,r)),vO)}async function DO(e,t){let n=await e.fetch(`${bO(e)}/${encodeURIComponent(t.id)}`,SO(`DELETE`,{baseVersion:t.version}));return n.ok?{ok:!0,value:null}:xO(n,Ase())}async function lue(e,t,n){return xO(await e.fetch(`${bO(e)}/next-chapter/${encodeURIComponent(t)}`,SO(`POST`,{id:kw().parse(n)})),Fw([hO,J({draft:hO}).transform(e=>e.draft)]))}async function OO(e,t,n){let r=J({id:kw(),version:K().int().positive()}).parse({id:n,version:t.version});return xO(await e.fetch(`${bO(e)}/${encodeURIComponent(t.id)}/instantiate`,SO(`POST`,r)),Fw([hO,J({draft:hO}).transform(e=>e.draft)]))}function uue(){let{api:e}=V(),t=Ji(),n={enabled:Qy().open},r=I({...uy(e),...n}),i=I({...dy(e),...n}),a=I({...fy(e),...n}),o=I({...mT(e),...n}),s=I({...CO(e),...n}),c=[...(I({...Ry(e),...n}).data??[]).map(e=>({id:`channel.open.${e.id}`,title:`Open channel ${e.name}`,keywords:[`channel`,`brand`,`cast`,`episodes`],go:()=>{t({to:`/channels/$channelId`,params:{channelId:e.id}})}})),...(o.data??[]).map(e=>({id:`schedule.open.${e.id}`,title:`Open schedule ${e.name}`,keywords:[`schedule`,`topics`,`calendar`,`plan`],go:()=>{t({to:`/calendar`,search:{tab:`schedules`,schedule:e.id}})}})),...(s.data??[]).map(e=>({id:`template.open.${e.id}`,title:`Open template ${e.name}`,keywords:[`template`,`setup`,`library`,`find`],go:()=>{t({to:`/templates`,search:{item:e.id}})}})),...(r.data?.prompts??[]).map(e=>({id:`prompt.edit.${e.id}`,title:`Edit prompt ${e.name}`,keywords:[`prompt`,`library`,Hb(e.kind)],go:()=>{t({to:`/prompts/$promptId`,params:{promptId:e.id}})}})),...(i.data?.entries??[]).map(e=>({id:`entry.edit.${e.id}`,title:`Edit ${Ib(e.category).toLowerCase()} ${e.name}`,keywords:[`intro`,`outro`,`library`],go:()=>{t({to:`/entries/$entryId`,params:{entryId:e.id}})}})),...(a.data?.themes??[]).map(e=>({id:`theme.edit.${e.id}`,title:`Edit PDF theme ${e.name}`,keywords:[`document`,`pdf`,`theme`,`library`],go:()=>{t({to:`/document-themes/$themeId`,params:{themeId:e.id}})}}))];return(0,h.jsx)(h.Fragment,{children:c.map(e=>(0,h.jsx)(due,{entity:e},e.id))})}function due({entity:e}){return Xy({id:e.id,title:e.title,group:`Library and plans`,keywords:e.keywords,searchOnly:!0,run:e.go}),null}var fue=1e4,kO={newSchedule:`schedules.new`,addToCalendar:`calendar.add`,showImages:e=>`project.${e}.show-images`,regenerateImage:e=>`project.${e}.regenerate-image`},AO=new Map,jO=new Set;function MO(e,t){AO.set(e,{value:t,at:Date.now()});for(let e of jO)e()}function pue(e){let t=AO.get(e);return AO.delete(e),t===void 0||Date.now()-t.at>fue?void 0:t}function NO(e,t,n=!0){let r=(0,m.useRef)(t);r.current=t,(0,m.useEffect)(()=>{if(!n)return;let t=()=>{if(!AO.has(e))return;let t=pue(e);t!==void 0&&r.current(t.value)};return t(),jO.add(t),()=>{jO.delete(t)}},[e,n])}function mue(){let{api:e}=V(),t=I(iy(e)),n=Va({select:e=>e.pathname}),r=Va({select:e=>e.pathname===`/calendar`&&e.search.tab===`schedules`}),i=/^\/projects\/([^/]+)/.exec(n)?.[1];return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(uue,{}),r?null:(0,h.jsx)(hue,{}),n===`/calendar`?null:(0,h.jsx)(gue,{}),(t.data?.projects??[]).filter(e=>e.id!==i).map(e=>(0,h.jsx)(_ue,{project:e},e.id))]})}function hue(){let e=Ji();return Xy({id:`global.schedules.new`,title:`New schedule`,group:`Create`,keywords:[`schedule`,`recurring`,`calendar`,`plan`],searchOnly:!0,run:()=>{MO(kO.newSchedule),e({to:`/calendar`,search:{tab:`schedules`}})}}),null}function gue(){let e=Ji();return Xy({id:`global.calendar.add`,title:`Add to calendar`,group:`Create`,keywords:[`schedule`,`topics`,`batch`,`queue`,`plan`],searchOnly:!0,run:()=>{MO(kO.addToCalendar),e({to:`/calendar`})}}),null}function _ue({project:e}){let t=Ji(),n=()=>{t({to:`/projects/$projectId`,params:{projectId:e.id}})};return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(vue,{project:e,open:n}),e.config.sources.images===`off`?null:(0,h.jsx)(yue,{project:e,open:n})]})}function vue({project:e,open:t}){return Xy({id:`index.open.${e.id}`,title:`Open ${e.title}`,group:`Projects`,keywords:[`project`,`go`],searchOnly:!0,run:t}),null}function yue({project:e,open:t}){return Xy({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=>{MO(kO.showImages(e.id)),n!==void 0&&MO(kO.regenerateImage(e.id),n),t()}}),null}var bue=`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`,xue=`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`,Sue=`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`,Cue={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 PO(e){return{maskImage:`url("${e}")`,maskSize:`contain`,maskRepeat:`no-repeat`,maskPosition:`center`}}function wue({kind:e,className:t}){return(0,h.jsx)(`span`,{"aria-hidden":`true`,"data-glyph":e,className:z(`block size-[22px] shrink-0 bg-current`,t),style:PO(Cue[e])})}var Tue={github:xue,patreon:Sue,coffee:bue};function FO({name:e,className:t}){return(0,h.jsx)(`span`,{"aria-hidden":`true`,"data-glyph":e,className:z(`block size-[14px] shrink-0 bg-current`,t),style:PO(Tue[e])})}function IO({variant:e=`secondary`,size:t=`default`,className:n,...r}){return(0,h.jsx)(`a`,{"data-slot":`button-link`,className:z(yv({variant:e,size:t}),n),...r})}function Eue({className:e,...t}){return(0,h.jsx)(`a`,{"data-slot":`text-link`,className:z(`sl-link`,e),...t})}var LO=da(IO),RO=da(Eue);function zO({href:e,...t}){return(0,h.jsx)(IO,{href:e,...t})}function Due({href:e,label:t,tip:n,...r}){return(0,h.jsx)(IO,{href:e,variant:`icon`,"aria-label":t,"data-tip":n??t,...r})}var BO=Sne,VO=Cne;function HO({className:e,sideOffset:t=4,align:n=`end`,...r}){return(0,h.jsx)(wne,{children:(0,h.jsx)(Tne,{"data-slot":`menu-content`,sideOffset:t,align:n,className:z(`z-50 min-w-[180px] overflow-hidden rounded-control border border-line bg-raised p-1`,`shadow-[var(--shadow-pop)]`,e),...r})})}function UO({className:e,...t}){return(0,h.jsx)(Ene,{"data-slot":`menu-item`,className:z(`flex cursor-default items-center gap-2 rounded-control px-[10px] py-[6px] text-small text-ink`,`outline-hidden select-none focus:bg-sunken data-highlighted:bg-sunken`,`data-disabled:text-ink-3`,e),...t})}function WO({className:e}){return(0,h.jsx)(Dne,{className:z(`my-1 h-px bg-line`,e)})}function GO({tone:e,className:t}){return(0,h.jsx)(`span`,{"aria-hidden":`true`,"data-tone":e,className:z(`sl-lamp`,e!==`off`&&`sl-lamp--${e}`,t)})}function KO({tone:e,children:t,className:n}){let r=e===`done`?`running`:e;return(0,h.jsxs)(`span`,{"data-slot":`status`,className:z(`sl-status`,r!==`off`&&`sl-status--${r}`,n),children:[(0,h.jsx)(GO,{tone:e}),t]})}function qO({tone:e=`neutral`,className:t,...n}){return(0,h.jsx)(`span`,{"data-slot":`badge`,className:z(`sl-badge`,e!==`neutral`&&`sl-badge--${e}`,t),...n})}function JO({children:e,onRemove:t,removeLabel:n,className:r}){return(0,h.jsxs)(`span`,{"data-slot":`chip`,className:z(`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)(kl,{"aria-hidden":`true`,className:`size-[14px]`,strokeWidth:1.75})})]})}function YO({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 XO=[`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`],ZO=[`API keys`,`Prompt bodies`,`Keyword values`,`Titles`,`Article or research text`,`Files and filenames`,`OS, locale, hardware`];function QO(){let{api:e}=V(),t=_(),n=I(sy(e)),r=L({mutationFn:()=>Yo(e),onSuccess:e=>{t.setQueryData(H.notice,e)}}),i=n.data?.seen===!1,a=n.data?.appVersion;return(0,h.jsxs)(zv,{open:i,dismissible:!1,title:`Anonymous usage stats`,description:`These numbers power the live counters on slopify.stream.`,footer:(0,h.jsx)(B,{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)($O,{heading:`Tracked`,items:XO}),(0,h.jsx)($O,{heading:`Never tracked`,items:ZO})]}),(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 $O({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))})]})}var ek={newVideo:[`C`],goHome:[`G`,`H`],goProjects:[`G`,`P`],goCalendar:[`G`,`C`],goSchedules:[`G`,`S`],goLibrary:[`G`,`L`],goChannels:[`G`,`K`],goSettings:[`G`,`,`],nextAction:[`Shift`,`N`],copyDescription:[`Shift`,`D`],reviewSetup:[`Ctrl`,`Enter`],save:[`Ctrl`,`S`]},tk=[{id:`providers`,label:`Providers`,meta:`Keys stay on this machine and go only to their provider. Readiness is checked again before each run.`},{id:`voices`,label:`Voices`,meta:`A wrong voice ID shows up when the audio stage uses it.`},{id:`models`,label:`Models`,meta:`New models, prices and retirements, checked once a day.`},{id:`agents`,label:`Agents (MCP)`,meta:`Let an AI agent on this computer, such as Claude Code or Codex, run Slopify.`},{id:`playback`,label:`Production defaults`,meta:`How new runs pace the narration and level the volume, and which model times English captions.`},{id:`notifications`,label:`Notifications`,meta:`When a run finishes, fails, waits for you, or a review needs a decision.`},{id:`channel-links`,label:`Channel links`,meta:`The links a YouTube description's {{Name}} placeholders fill from.`},{id:`studio`,label:`YouTube Studio`,meta:`The playlist upload packs name, and the Studio extension's pairing.`},{id:`storage`,label:`Backup & storage`,meta:`Daily backups, export and import, and what uses disk space.`},{id:`trash`,label:`Trash`,meta:`Deleted projects, prompts, intros and outros, templates and schedules, kept for 30 days. Channels, cast, PDF themes and episode summaries are deleted permanently.`},{id:`general`,label:`General`,meta:`How Slopify looks and how it starts on this computer.`},{id:`about`,label:`About`,meta:`Free and open source, running on your machine with your own keys.`},{id:`usage`,label:`Usage`,meta:`This machine only. The same counters, anonymised, feed slopify.stream.`},{id:`patch-notes`,label:`Patch notes`,meta:`What changed in each version of Slopify.`}],nk={id:`connections`,label:`Connections`,sections:[`providers`,`voices`,`models`,`agents`]},rk=[nk,{id:`production`,label:`Production defaults`,sections:[`playback`]},{id:`notifications`,label:`Notifications`,sections:[`notifications`]},{id:`publishing`,label:`Publishing`,sections:[`channel-links`,`studio`]},{id:`storage`,label:`Backup & storage`,sections:[`storage`,`trash`]},{id:`general`,label:`General`,sections:[`general`]},{id:`about`,label:`About`,sections:[`about`,`usage`,`patch-notes`]}];function ik(e){return e===`backups`?`storage`:tk.find(t=>t.id===e)?.id??`providers`}function ak(e){return rk.find(t=>t.sections.includes(e))??nk}var ok=[{id:`text-key`,title:`1. Connect a text provider`,target:`keys-llm`,page:`settings`},{id:`audio-key`,title:`2. Connect a voice provider`,target:`keys-tts`,page:`settings`},{id:`image-key`,title:`3. Connect an image provider`,target:`keys-image`,page:`settings`},{id:`voice`,title:`4. Add a narration voice`,target:`voices`,page:`settings`},{id:`article-name`,title:`5. Name your article prompt`,target:`prompt-name`,page:`article`},{id:`article-body`,title:`6. Write instructions with keywords`,target:`prompt-body`,page:`article`},{id:`article-keywords`,title:`7. Check the detected keywords`,target:`prompt-slots`,page:`article`},{id:`article-save`,title:`8. Save your article prompt`,target:`prompt-save`,page:`article`},{id:`image-prompt`,title:`9. Create an image prompt`,target:`prompt-editor`,page:`image`},{id:`image-save`,title:`10. Save your image prompt`,target:`prompt-save`,page:`image`},{id:`play-options`,title:`11. Name the project and choose text generation`,target:`play-options`,page:`play`},{id:`play-article`,title:`12. Choose your article`,target:`play-article`,page:`play`},{id:`play-keywords`,title:`13. Fill in your keywords`,target:`play-keywords`,page:`play`},{id:`play-audio`,title:`14. Choose narration`,target:`play-audio`,page:`play`},{id:`play-images`,title:`15. Choose images`,target:`play-images`,page:`play`},{id:`play-video`,title:`16. Choose video output`,target:`play-video`,page:`play`},{id:`play-subtitles`,title:`17. Style optional subtitles`,target:`play-subtitles`,page:`play`},{id:`play-start`,title:`18. Review and start your run`,target:`play-start`,page:`play`},{id:`project`,title:`19. Follow and control the run`,target:`project-controls`,page:`project`},{id:`download`,title:`20. Download your results`,target:`project-video`,page:`project`},{id:`run-cost`,title:`21. See what the run cost`,target:`project-rail-cost`,page:`project`},{id:`studio-prep`,title:`22. Prepare the YouTube upload`,target:`project-rail-video`,page:`project`},{id:`home`,title:`23. Check Home each day`,target:`home`,page:`home`},{id:`channels`,title:`24. Set up a channel`,target:`channels`,page:`channels`},{id:`calendar`,title:`25. Plan uploads on the calendar`,target:`calendar`,page:`calendar`}],sk=`home`;function ck(e,t){return e.active?t.type===`project-created`?{...e,projectId:t.id,step:ok.findIndex(e=>e.id===`project`)}:t.kind===`article`?{...e,articleId:t.id}:t.kind===`image`?{...e,imageId:t.id}:e:e}function lk(e){let t=ok.findIndex(t=>t.id===e);return t<0?void 0:t}var uk={"play-options":`content`,"play-article":`content`,"play-keywords":`content`,"play-audio":`outputs`,"play-images":`outputs`,"play-video":`outputs`,"play-subtitles":`style`,"play-start":`content`};function dk(e){return e.kind===`keyed`?e.hasKey:e.kind===`local`?e.available:e.installed&&e.issue===void 0}var fk=J({title:G(),status:K(),detail:G().optional(),reason:G().optional(),currentVersion:K().int().positive().nullable().optional(),reviewId:kw().optional(),fields:q(J({field:G(),message:G()})).optional(),errors:q(J({path:G(),message:G()})).optional()}),pk=J({drafts:q(J({id:kw(),title:G(),version:K().int().positive(),updatedAt:G(),readable:Mw()}).strict()).readonly()}).strict(),mk=uO.unwrap().omit({id:!0}).extend({draftId:kw(),reviewId:kw()}).strict();async function hk(e,t){let n;try{n=await e.json()}catch{throw po(e,void 0)}if(e.ok)return{ok:!0,value:So(t,n)};let r=fk.safeParse(n);if(!r.success)throw po(e,void 0);let i=r.data;if(![400,404,409].includes(e.status))throw po(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,currentVersion:i.currentVersion??null,fields:i.fields??i.errors?.map(e=>({field:e.path,message:e.message}))??[],...i.reviewId===void 0?{}:{reviewId:i.reviewId}}}async function gk(e,t,n,r,i){return hk(await e.fetch(`${e.origin}/api/drafts${t}`,{method:n,...i===void 0?{}:{headers:{"content-type":`application/json`},body:JSON.stringify(i)}}),r)}function _k(e){return`/${encodeURIComponent(kw().parse(e))}`}async function vk(e){return gk(e,``,`GET`,pk)}async function yk(e,t){return gk(e,``,`POST`,hO,sO.parse(t))}async function bk(e,t){return gk(e,_k(t),`GET`,hO)}async function xk(e,t){let{id:n,...r}=cO.parse(t);return gk(e,_k(n),`PUT`,hO,r)}async function Sk(e,t){let{sourceId:n,...r}=lO.parse(t);return gk(e,`${_k(n)}/fork`,`POST`,hO,r)}async function Ck(e,t){let{id:n,...r}=uO.parse(t);return gk(e,_k(n),`DELETE`,J({discarded:Vw(!0)}).strict(),r)}async function wk(e,t){let{id:n,...r}=uO.parse(t);return gk(e,`${_k(n)}/review`,`POST`,mO,r)}async function Tk(e,t){let{draftId:n,...r}=mk.parse(t);return gk(e,`${_k(n)}/start`,`POST`,pO,r)}function Ek(e,t,n){return`${e.origin}/api/drafts${_k(t)}/attachments/${encodeURIComponent(kw().parse(n))}/file`}async function Dk(e,t,n,r,i){let a=new FormData;return a.set(`file`,r),hk(await e.fetch(Ek(e,t,n),{method:`PUT`,body:a,...i?{signal:i}:{}}),dO)}var Ok=[`fonts`];async function kk(e){return R(await e.fetch(`${e.origin}/api/fonts`))}async function Ak(e,t){let n=new FormData;return n.set(`file`,t),R(await e.fetch(`${e.origin}/api/fonts`,{method:`POST`,body:n}))}function jk(e,t){return`${e.origin}/api/fonts/${encodeURIComponent(t)}/file`}var Mk=`slopify.play-draft`;function Nk(e){try{e?window.localStorage?.setItem(Mk,e):window.localStorage?.removeItem(Mk)}catch(e){console.warn(`Active draft browser storage is unavailable`,e)}}function Pk(){try{return window.localStorage?.getItem(Mk)??null}catch(e){return console.warn(`Active draft browser storage is unavailable`,e),null}}async function Fk(e,t){let n=await Promise.allSettled([t.fetchQuery({...cy(e),staleTime:0}),t.fetchQuery({...uy(e),staleTime:0}),t.fetchQuery({...dy(e),staleTime:0}),t.fetchQuery({...my(e),staleTime:0}),t.fetchQuery({...ly(e),staleTime:0}),t.fetchQuery({queryKey:Ok,queryFn:()=>kk(e),staleTime:0})]);for(let e of n)e.status===`rejected`&&console.warn(`Draft choices could not refresh`,e.reason)}function Oue(e){return e.removeBreaths===!0?{removeBreaths:!0}:{}}function kue(e){return e.deEss===!0?{deEss:!0}:{}}var Ik=`under Video and style → Ambient sound`;`${Ik}`,`${Ik}`;var Lk=oO.parse({schemaVersion:1,form:{title:``,format:`16:9`,sources:{research:`off`,article:`generate`,audio:`generate`,images:`generate`,thumbnail:`off`,video:`generate`},llm:{provider:``,model:``},audio:{provider:``,model:``,voice:``,usePronunciationGlossary:!0,shareGlossary:!0,useNarrationAliases:!0,describeFigures:!0},images:{provider:``,model:``},articlePrompt:``,narrationPrompt:``,imagePrompts:[],thumbnailPrompt:``,intro:``,outro:``,chunking:{mode:`whole`,words:`500`,characters:`3000`},subtitles:{...GD,fontSize:`48`},imageSeconds:`15`,edgeSilenceSeconds:`2`,zoomPercent:String(VE),motionStyle:HE,videoEdit:dle,showFigures:!0,values:{},provided:{research:``,article:``,audio:null,images:[],thumbnail:null}},section:`content`,variants:[],expectedWords:`1500`,previewText:`Every story begins with a word.`,fontUpload:null}),Rk={};function Aue(e){Rk=e}function zk(e,t=Rk){let{form:n}=e;return n.llm.provider!==``||n.images.provider!==``||t.llm===void 0&&t.images===void 0?e:{...e,form:{...n,...t.llm===void 0?{}:{llm:{...t.llm}},...t.images===void 0?{}:{images:{...t.images}}}}}function jue(e){let t={...e.sources,...e.sources.article===`generate`?{}:{research:`off`},...e.sources.images===`off`?{video:`off`}:{}},n=t.audio===`off`?`off`:t.video===`off`&&e.subtitles.mode===`burn-in`?`files`:e.subtitles.mode;return{...e,sources:t,subtitles:{...e.subtitles,mode:n}}}function Mue(e){let t=oO.parse(e);return JSON.stringify({...t,form:jue(t.form)})}function Nue(e,t,n){return{...e,acknowledged:Math.max(e.acknowledged,t),version:n}}function Bk(e,t){return t.type===`edit`?{...e,edited:e.edited+1}:Nue(e,t.generation,t.version)}function Vk(e,t,n){return{mutationId:n,document:oO.parse(JSON.parse(Mue(e))),generation:t.edited,baseVersion:t.version}}function Hk(){return{document:zk(Lk),view:null,clock:{edited:0,acknowledged:0,version:0},id:null,recoveryId:null,pending:null,status:`unsaved`,error:null,reveal:null}}function Pue(e,t,n){let r=e.form.provided,i=t.form.provided,a=new Map;for(let[e,t]of[[r.audio,i.audio],[r.thumbnail,i.thumbnail],[r.shortsMusic,i.shortsMusic],[r.ambientBed,i.ambientBed],...r.images.map((e,t)=>[e,i.images[t]])])e&&t&&a.set(e.attachmentId,t.attachmentId);let o=e=>e?{...e,attachmentId:a.get(e.attachmentId)??e.attachmentId}:null;return{...n,form:{...n.form,provided:{...n.form.provided,audio:o(n.form.provided.audio),thumbnail:o(n.form.provided.thumbnail),...n.form.provided.shortsMusic===void 0?{}:{shortsMusic:o(n.form.provided.shortsMusic)},...n.form.provided.ambientBed===void 0?{}:{ambientBed:o(n.form.provided.ambientBed)},images:n.form.provided.images.map(e=>({...e,attachmentId:a.get(e.attachmentId)??e.attachmentId}))}}}}function Fue(e,t){if(e.draft.id!==t.id)return e;let n=t.document.form.provided,r=new Set([n.audio,n.thumbnail,n.shortsMusic,n.ambientBed,...n.images].flatMap(e=>e?[e.attachmentId]:[]));return{...e,attachments:e.attachments.filter(e=>r.has(e.id)).map(e=>{let n=t.view?.attachments.find(t=>t.id===e.id);return(e.state===`pending`||e.state===`copying`)&&(n?.state===`ready`||n?.state===`reattach`)?n:e})}}function Uk(e,t){let n={...GD,...e},r=t.audio===`off`?`off`:(t.video===`off`||t.images===`off`)&&n.mode===`burn-in`?`files`:n.mode;if(r!==`off`)return{...n,mode:r};let i=WD.shape.fontId.safeParse(n.fontId),a=WD.shape.fontSize.safeParse(n.fontSize);return{...n,mode:r,fontId:i.success?i.data:GD.fontId,fontSize:a.success?a.data:GD.fontSize}}function Wk(e){return e.mode===`off`||e.fontId!==``&&Number.isInteger(e.fontSize)&&e.fontSize>=16&&e.fontSize<=120}function Iue(e){return e===`shortsMusic`||e===`ambientBed`?`audio`:e}function Gk(e){return e.shorts?.enabled===!0&&e.sources.audio!==`off`}function Kk(e){return e.ambientBed?.source===`upload`&&e.sources.video===`generate`&&e.sources.audio!==`off`}function Lue(e){let t=e=>e.trim()===``?NaN:Number(e);return{enabled:e.enabled,count:t(e.count),minSeconds:t(e.minSeconds),maxSeconds:t(e.maxSeconds),...e.prompt.trim()?{prompt:e.prompt}:{},...e.imagePrompt.trim()?{imagePrompt:e.imagePrompt}:{},...oE(e)}}({...Lk.form}),{...Lk.form.sources};var qk={off:`Off`,generate:`Generate`,provide:`Provide`,from_prompt:`From prompt`,prompt_by_llm:`Prompt by LLM`};function Jk(e){return GE[e].map(e=>({value:e,label:qk[e]}))}function Yk(e,t){return JE(Xk({form:e,entries:t,slots:[],silenceGapSeconds:0}))}function Rue(e,t,n){if(n!==``)return e.find(e=>e.category===t&&e.name===n)?.mode}function zue(e){return[e.audio,e.thumbnail,e.shortsMusic,e.ambientBed,e.reference,...e.images].flatMap(e=>e?.file===void 0?[]:[e.file])}function Xk(e){let{form:t}=e;return{...t.checkpoints===void 0?{}:{checkpoints:t.checkpoints},title:t.title,format:t.format,sources:{...t.sources,...t.sources.article===`provide`?{research:`off`}:{},...t.sources.images===`off`?{video:`off`}:{}},llm:t.llm,audio:t.audio,images:t.images,...t.sources.images===`generate`&&t.reference!==void 0&&t.reference.source!==`off`?{reference:{source:t.reference.source,...t.reference.source===`prompt`?{prompt:t.reference.prompt}:{},thumbnail:t.reference.thumbnail}}:{},articlePrompt:t.articlePrompt,...t.narrationPrompt===void 0?{}:{narrationPrompt:t.narrationPrompt},...t.language===void 0||t.language===`en`?{}:{language:t.language},...t.sources.video===`generate`&&t.sources.images!==`off`&&t.sources.audio===`generate`&&t.audio.describeFigures===!0&&t.showFigures===!0?{showFigures:!0}:{},...t.sources.audio!==`off`&&t.youtubeDescription===!0?{youtubeDescription:!0,...t.descriptionPrompt?.trim()?{descriptionPrompt:t.descriptionPrompt}:{}}:{},...Gk(t)&&t.shorts!==void 0?{shorts:Lue(t.shorts)}:{},imagePrompts:t.imagePrompts,thumbnailPrompt:t.thumbnailPrompt,...t.thumbnailCount===3&&(t.sources.thumbnail===`from_prompt`||t.sources.thumbnail===`prompt_by_llm`)?{thumbnailCount:3}:{},...Zk(Qk(e,`intro`),e=>({intro:e})),...Zk(Qk(e,`outro`),e=>({outro:e})),values:Bue(t.values,e.slots),provided:{research:t.provided.research,article:t.provided.article,...Zk(t.provided.audio?.file,e=>({audio:e.id})),...Zk(t.provided.thumbnail?.file,e=>({thumbnail:e.id})),...Zk(t.sources.images===`generate`&&t.reference?.source===`provide`?t.provided.reference?.file:void 0,e=>({reference:e.id})),images:t.provided.images.flatMap(e=>e.file===void 0?[]:[e.file.id]),...Gk(t)?Zk(t.provided.shortsMusic?.file,e=>({shortsMusic:e.id})):{},...t.ambientBed?.source===`upload`?Zk(t.provided.ambientBed?.file,e=>({ambientBed:e.id})):{}},chunking:t.chunking,subtitles:Uk(t.subtitles,t.sources),silenceGapSeconds:e.silenceGapSeconds,imageSeconds:t.imageSeconds,edgeSilenceSeconds:t.edgeSilenceSeconds,zoomPercent:t.zoomPercent,motionStyle:t.motionStyle,...t.videoEdit===void 0?{}:{videoEdit:t.videoEdit},...t.voices!==void 0&&t.sources.audio===`generate`?{voices:t.voices}:{},...t.sources.document===`generate`?{document:t.document}:{},...Zk(t.sources.video===`generate`&&t.sources.audio!==`off`?pE(t.ambientBed):void 0,e=>({ambientBed:e})),...t.sources.audio===`generate`?Hce(t):{},...t.sources.audio===`generate`?Oue(t):{},...t.sources.audio===`generate`?kue(t):{},...t.sources.audio===`generate`&&t.levelSentences===!0?{levelSentences:!0}:{},...Zk(t.sources.audio===`off`?void 0:zce(t.loudness,e.loudness??RT),e=>({loudness:e}))}}function Zk(e,t){return e===void 0?{}:t(e)}function Qk(e,t){if(e.form.sources.audio!==`generate`)return;let n=t===`intro`?e.form.intro:e.form.outro,r=Rue(e.entries,t,n);return n===``||r===void 0?void 0:{name:n,mode:r}}function Bue(e,t){let n=Object.create(null);for(let r of t)n[r]=Object.hasOwn(e,r)?e[r]??``:``;return n}function $k(e,t){return e?.draftId===t.draftId&&e.version===t.version&&e.editGeneration===t.editGeneration}function Vue({api:e,queryClient:t,current:n,flush:r,resave:i,render:a}){let o={receipt:null,pending:!1,starting:!1,uncertain:!1,valid:!1,error:null,fields:[],created:null},s,c=0,l=0,u=null,d=e=>{o={...o,...e},a()},f=()=>({draftId:n().id??``,version:n().clock.version,editGeneration:n().clock.edited}),p=()=>$k(s,f())&&n().clock.edited===n().clock.acknowledged&&o.receipt?.runs.length===eA(n().document),m=(e=!1)=>{c++,s=void 0,d({valid:!1,...e?{fields:[],error:null}:{}})},h=e=>d({error:e.message,fields:e.fields,valid:!1}),g=e=>{u=null,d({created:e,uncertain:!1,starting:!1,valid:!1})},_=async()=>{let t=u?.draftId;if(!t)return;let n=await bk(e,t);if(!n.ok){h(n);return}n.value.start&&g(n.value.start)};return{reset:()=>{c++,l++,s=void 0,u=null,o={receipt:null,pending:!1,starting:!1,uncertain:!1,valid:!1,error:null,fields:[],created:null},a()},state:()=>({...o,valid:o.valid&&p()}),invalidate:m,restore:e=>{c++,l++,s=void 0,u=e.pendingStart?{draftId:e.draft.id,baseVersion:e.pendingStart.draftVersion,reviewId:e.pendingStart.reviewId}:null,o={receipt:null,pending:!1,starting:!1,uncertain:u!==null,valid:!1,error:null,fields:[],created:e.start},a()},review:async()=>{if(o.pending||o.starting||o.uncertain||o.created)return;let a=++l;d({pending:!0,valid:!1,error:null,fields:[]});try{if(await Promise.all([Fk(e,t),t.refetchQueries({queryKey:[`provider-models`]})]),a!==l||!await r()||!n().id)return;let o=f(),u=c,p=await wk(e,{id:o.draftId,baseVersion:o.version});if(a!==l||u!==c||!$k(o,f()))return;if(!p.ok){h(p);return}if(p.value.draftId!==o.draftId||p.value.draftVersion!==o.version)return;let m=eA(n().document);if(p.value.runs.length!==m){d({receipt:null,valid:!1,error:`The saved draft has ${Hue(p.value.runs.length)}, but this page shows ${m}. Slopify saved this page again. Press Refresh review, then start.`}),i();return}s=o,d({receipt:p.value,valid:!0})}catch(e){a===l&&d({error:e instanceof Error?e.message:`This setup couldn't be checked. Press Refresh review to try again.`})}finally{a===l&&d({pending:!1})}},start:async()=>{if(o.starting||o.created||!u&&(!o.valid||!p()||o.pending||!o.receipt||rA(n().document,n().view)!==void 0)||(!u&&o.receipt&&(u={draftId:o.receipt.draftId,baseVersion:o.receipt.draftVersion,reviewId:o.receipt.id}),!u))return;let t=u;Nk(t.draftId),d({starting:!0,error:null});try{if(o.uncertain&&(await _(),o.created))return;let n=await Tk(e,t);if(n.ok){g(n.value);return}n.reason===`pending-start`||n.reason===`already-started`?(d({uncertain:!0}),await _()):(u=null,d({uncertain:!1}),h(n))}catch(e){d({uncertain:!0,valid:!1,error:`${bo(e instanceof Error?e.message:`Slopify didn't confirm the start`)} The run may already have started. Press Check whether it started to find out before trying again.`})}finally{d({starting:!1})}}}}function eA(e){return e.variants.length+1}function Hue(e){return e===1?`1 video`:`${e} videos`}function tA(e,t){if(e.starting)return`Starting…`;if(e.uncertain)return`Check whether it started`;let n=e.valid&&e.receipt?e.receipt.runs.length:eA(t);return n===1?`Start run`:nA(t)?`Queue ${n} videos`:`Start ${n} videos`}function nA(e){return e.queue!==!1}function rA(e,t){if(e.fontUpload!==null)return`subtitles.fontUpload`;let{sources:n,provided:r}=e.form;return[...n.audio===`provide`&&r.audio?[{ref:r.audio,field:`provided.audio`}]:[],...n.thumbnail===`provide`&&r.thumbnail?[{ref:r.thumbnail,field:`provided.thumbnail`}]:[],...n.images===`provide`?r.images.map((e,t)=>({ref:e,field:`provided.images.${t}`})):[],...Gk(e.form)&&r.shortsMusic?[{ref:r.shortsMusic,field:`shorts.music`}]:[],...Kk(e.form)&&r.ambientBed?[{ref:r.ambientBed,field:`ambientBed.file`}]:[]].find(({ref:e})=>t?.attachments.find(t=>t.id===e.attachmentId)?.state!==`ready`)?.field}function Uue(e,t){return e?.draftId===t.draftId&&e.attachmentId===t.attachmentId}function Wue({api:e,queryClient:t,state:n,edit:r,flush:i,generation:a,publish:o,render:s}){let c=(0,m.useRef)(0),l=(0,m.useRef)(null),u=(0,m.useRef)(null),d=(0,m.useRef)(new Map),f=(0,m.useRef)(new Map),p=e=>{let t=n.current.document.form.provided,r=[t.audio,t.thumbnail,t.shortsMusic,t.ambientBed,t.reference,...t.images].find(t=>t?.attachmentId===e.attachmentId);return Uue(r&&n.current.id?{draftId:n.current.id,attachmentId:r.attachmentId}:void 0,e)};(0,m.useEffect)(()=>{for(let[e,t]of d.current)t!==a()&&d.current.delete(e);for(let[e,t]of f.current)(!p(t.owner)||t.generation!==a())&&(t.controller.abort(),f.current.delete(e))}),(0,m.useEffect)(()=>{let e=f.current,t=d.current;return()=>{c.current++,t.clear();for(let t of e.values())t.controller.abort();e.clear()}},[]);let h=async(t,l,u)=>{if(l.length===0)return;let m=Iue(t),h=m===`images`&&!u?l:l.slice(-1),g=h.map(e=>({attachmentId:crypto.randomUUID(),name:e.name})),_=c.current,v=a();for(let e of g)d.current.set(e.attachmentId,v);let y=n.current.document,b=y.form.provided;r({...y,form:{...y.form,provided:m===`images`?{...b,images:u?b.images.flatMap(e=>e.attachmentId===u?g:[e]):[...b.images,...g]}:{...b,[t]:g.at(-1)??null}}});let x=await i();for(let e of g)d.current.delete(e.attachmentId);if(!x||v!==a()||_!==c.current){s();return}let S=n.current.id;S&&await Promise.all(g.map(async(t,r)=>{let i=h[r],s={draftId:S,attachmentId:t.attachmentId};if(!i||!p(s))return;let l=new AbortController;f.current.set(t.attachmentId,{owner:s,controller:l,generation:v});let u=e=>{let r=n.current.view;v===a()&&_===c.current&&r?.draft.id===S&&p(s)&&!l.signal.aborted&&o({view:{...r,review:null,attachments:[...r.attachments.filter(e=>e.id!==t.attachmentId),e]}})};try{let n=await Dk(e,S,t.attachmentId,i,l.signal);n.ok?u(n.value):u({id:t.attachmentId,kind:m,name:t.name,state:`reattach`,stagedFileId:null,bytes:0,error:n.message})}catch(e){u({id:t.attachmentId,kind:m,name:t.name,state:`reattach`,stagedFileId:null,bytes:0,error:e instanceof Error?e.message:`Reattach this file`})}finally{f.current.delete(t.attachmentId)}}))},g=e=>{l.current=null;let t=n.current.document;r({...t,fontUpload:null,form:{...t.form,subtitles:{...t.form.subtitles,fontId:e}}})},_=async o=>{let d=crypto.randomUUID();l.current=d,r({...n.current.document,fontUpload:{operationId:d,name:o.name}});let f=c.current,p=a();if(!await i()||p!==a()||f!==c.current){l.current===d&&(l.current=null),s();return}if(n.current.document.fontUpload?.operationId===d)try{let{font:r}=await Ak(e,o);if(p!==a()||f!==c.current||n.current.document.fontUpload?.operationId!==d)return;t.setQueryData(Ok,e=>({fonts:[...(e?.fonts??[]).filter(e=>e.id!==r.id),r]})),g(r.id),await i()}catch(e){p===a()&&f===c.current&&n.current.document.fontUpload?.operationId===d&&(u.current={operationId:d,message:e instanceof Error?e.message:`Reattach this font`},s())}finally{l.current===d&&(l.current=null,s())}},v=l.current!==null&&l.current===n.current.document.fontUpload?.operationId;return{attachmentUploading:e=>{let t=f.current.get(e);return d.current.get(e)===a()||t!==void 0&&t.generation===a()&&p(t.owner)&&!t.controller.signal.aborted},fontUpload:{pending:v,error:u.current?.operationId===n.current.document.fontUpload?.operationId?u.current?.message:void 0,pick:e=>{_(e)}},attach:h,selectFont:g,uploadSubtitleFont:_,fontUploading:v}}function Gue(e,t,n){(0,m.useEffect)(()=>{let r=e=>[`prompts`,`entries`,`providers`,`provider-models`,`fonts`,`settings`].includes(String(e[0])),i=t.getQueryCache().subscribe(e=>{e.type===`updated`&&r(e.query.queryKey)&&(e.action.type===`success`||e.action.type===`invalidate`)&&n.invalidate()}),a=()=>{n.invalidate(),Fk(e,t),t.refetchQueries({queryKey:[`provider-models`]})};return window.addEventListener(`focus`,a),()=>{i(),window.removeEventListener(`focus`,a)}},[e,t,n])}function Kue(){let{api:e}=V(),t=_(),[,n]=(0,m.useReducer)(e=>e+1,0),r=(0,m.useRef)(Hk()),i=(0,m.useMemo)(()=>{let i,a=null,o=!1,s=0,c=!1,l=null,u=!0,d=e=>{r.current={...r.current,...e},u&&n()},f=()=>{clearTimeout(i),i=void 0},p=()=>{t.invalidateQueries({queryKey:[`play-drafts`]})},m=e=>{d({status:`error`,error:e instanceof Error?e.message:`Your latest changes weren't saved. Keep this page open and try again.`})},h=e=>e.ok?!0:(d({status:e.reason===`conflict`?`conflict`:`error`,error:e.message}),!1),g=e=>{b.restore(e),d({...Hk(),document:e.draft.document,view:e,id:e.draft.id,clock:{edited:0,acknowledged:0,version:e.draft.version},status:`saved`}),Nk(e.draft.id),p()},_=async()=>{let t=s;for(;r.current.clock.edited>r.current.clock.acknowledged;){if(r.current.status===`conflict`||t!==s||l!==null&&l===r.current.id)return!1;let n=r.current,i=n.id??crypto.randomUUID(),a=n.pending??Vk(n.document,n.clock,crypto.randomUUID());d({id:i,pending:a,status:`saving`,error:null});try{let n=a.baseVersion===0?await yk(e,{id:i,document:a.document}):await xk(e,{id:i,baseVersion:a.baseVersion,mutationId:a.mutationId,document:a.document});if(t!==s)return!1;if(!h(n))return n.reason!==`conflict`&&d({pending:null}),!1;let c=Bk(r.current.clock,{type:`acknowledge`,generation:a.generation,version:n.value.draft.version});if(d({clock:c,view:{...Fue(n.value,r.current),review:c.edited>c.acknowledged?null:n.value.review},pending:null,status:c.edited>c.acknowledged?`unsaved`:`saved`,error:null}),Nk(i),p(),!o)return!0}catch(e){return t===s&&m(e),!1}}return r.current.status!==`conflict`&&r.current.status!==`error`},v=()=>c?Promise.resolve(!1):a||(r.current.clock.edited===r.current.clock.acknowledged?Promise.resolve(!0):l!==null&&l===r.current.id?Promise.resolve(!1):(a=_().finally(()=>{a=null}),a)),y=()=>(f(),o=!0,v()),b=Vue({api:e,queryClient:t,current:()=>r.current,flush:y,resave:()=>x(r.current.document),render:()=>{u&&n()}}),x=e=>{if(b.state().starting||b.state().uncertain||b.state().created)return;b.invalidate(JSON.stringify({...e,section:r.current.document.section})!==JSON.stringify(r.current.document));let t=r.current;d({document:e,clock:Bk(t.clock,{type:`edit`}),view:t.view?{...t.view,review:null}:null,status:t.status===`conflict`||t.status===`error`?t.status:`unsaved`}),f(),!(c||l!==null&&l===t.id||t.status===`conflict`||t.status===`error`)&&(t.id?i=setTimeout(()=>{y()},500):(o=!1,v()))},S=async(n,i=()=>!0)=>{if(b.state().starting||b.state().uncertain||b.state().created||(r.current.id!==n||r.current.status!==`conflict`)&&!await y()||!i())return!1;let a=++s,o=r.current.clock.edited;f();try{let c=await bk(e,n);return a!==s||o!==r.current.clock.edited||!i()?!1:h(c)?(T=null,g(c.value),await Fk(e,t),i()):(r.current.id||d({recoveryId:n}),!1)}catch(e){return a===s&&o===r.current.clock.edited&&(m(e),r.current.id||d({recoveryId:n})),!1}},C=async()=>{if(b.state().starting||b.state().uncertain||b.state().created)return;let e=s;await y()&&e===s&&(s++,T=null,d(Hk()),b.reset(),Nk(null))},w=async({id:t,version:n})=>{if(b.state().starting||b.state().uncertain||b.state().created)throw Error(`Resolve the pending Start before discarding a draft`);if(c||l!==null)throw Error(`Wait for the current draft operation before discarding`);let i=s;l=t,(r.current.id??r.current.recoveryId)===t&&f();try{a&&await a;let o=await Ck(e,{id:t,baseVersion:n});if(!o.ok&&o.reason!==`not-found`)throw Error(o.message);if(p(),i!==s||(r.current.id??r.current.recoveryId)!==t)return;f(),s++,T=null,d(Hk()),b.reset(),Nk(null)}finally{l=null}},T=null;return{review:b,takeCreated:()=>{let e=b.state().created;if(!e)return null;s++,d(Hk()),b.reset(),Nk(null);for(let e of[[`projects`],[`staging`],[`play-drafts`]])t.invalidateQueries({queryKey:e});return e},edit:x,flush:y,open:S,newDraft:C,adoptDefaults:e=>{let t=r.current;if(t.id!==null||t.clock.edited>0||t.view!==null)return;let n=zk(t.document,e);n!==t.document&&d({document:n})},adoptChannel:e=>{let t=r.current;if(t.id!==null||t.clock.edited>0||t.view!==null)return;let n=t.document;n.channelId===void 0&&n.templateSource===void 0&&d({document:{...n,channelId:e}})},discard:w,saveAsNew:async()=>{if(b.state().starting||b.state().uncertain||b.state().created||(f(),c||l!==null))return;a&&await a;let t=r.current;if(!t.id||!t.view&&t.status!==`conflict`){await y();return}let n=s;T?.sourceId!==t.id&&(T=null),T??={sourceId:t.id,id:crypto.randomUUID(),document:Vk(t.document,t.clock,crypto.randomUUID()).document,generation:t.clock.edited};let i=T;c=!0;try{let t=await Sk(e,{sourceId:i.sourceId,id:i.id,document:i.document});if(n!==s)return;if(!h(t)){t.reason===`conflict`&&(T=null);return}let a=r.current.clock.edited>i.generation?r.current.document:null;s++,g(t.value),T=null,c=!1,a&&x(Pue(i.document,t.value.draft.document,a))}catch(e){n===s&&m(e)}finally{c=!1}},navigate:async(e,t)=>{let n=s,i={...r.current.document,section:e};r.current.id||r.current.clock.edited>0?x(i):d({document:i}),await y()&&n===s&&d({reveal:{section:e,...t===void 0?{}:{field:t},sequence:(r.current.reveal?.sequence??0)+1}})},generation:()=>s,publish:d,start:()=>{u=!0;let e=Pk();e&&S(e)},stop:()=>{u=!1,f()}}},[e,t]);(0,m.useEffect)(()=>(i.start(),i.stop),[i]),Gue(e,t,i.review);let a=Wue({api:e,queryClient:t,state:r,edit:i.edit,flush:i.flush,generation:i.generation,publish:i.publish,render:n}),o=r.current;return{...a,review:i.review.state(),reviewDraft:i.review.review,startRun:i.review.start,invalidateReview:i.review.invalidate,takeCreated:i.takeCreated,document:o.document,section:o.document.section,view:o.view,status:o.status,error:o.error,edited:o.clock.edited,acknowledged:o.clock.acknowledged,reveal:o.reveal,edit:i.edit,flush:i.flush,open:i.open,generation:i.generation,newDraft:i.newDraft,adoptDefaults:i.adoptDefaults,adoptChannel:i.adoptChannel,discard:i.discard,saveAsNew:i.saveAsNew,navigate:i.navigate,activeId:o.id??o.recoveryId}}var iA=(0,m.createContext)(null);function que({children:e}){let t=Kue();return(0,h.jsx)(iA.Provider,{value:t,children:e})}function Jue(){return(0,m.useContext)(iA)}function aA(){let e=(0,m.useContext)(iA);if(!e)throw Error(`PlayDraftProvider is required`);return e}var Yue={research:[],article:[`research`],audio:[`article`],images:[],thumbnail:[`article`],video:[`article`,`audio`,`images`],document:[`article`,`thumbnail`]},Xue={document:[`thumbnail`]};function oA(e){return e===`done`||e===`provided`||e===`skipped`}function Zue(e,t,n){return oA(n)?!0:(n===`failed`||n===`canceled`)&&(Xue[e]?.includes(t)??!1)}function Que(e){return e.some(t=>$ue(t,e))}function $ue(e,t){let n=e=>t.find(t=>t.kind===e)?.source??`generate`;return e.state===`pending`&&e.parked===!0&&ede(e.kind,{thumbnail:n(`thumbnail`),video:n(`video`)}).every(n=>{let r=t.find(e=>e.kind===n);return r===void 0||Zue(e.kind,n,r.state)})}function ede(e,t){return e===`thumbnail`&&t.thumbnail===`from_prompt`?[]:e===`video`&&t.video===`off`?[`article`,`audio`]:e===`document`&&t.thumbnail===`off`?[`article`]:Yue[e]}function tde(e){let t=e.filter(e=>e.state!==`provided`&&e.state!==`skipped`);return t.length===0?1:t.reduce((e,t)=>e+nde(t),0)/t.length}function nde(e){if(oA(e.state))return 1;if(e.state!==`running`)return 0;let t=e.progressTotal??0;return t<=0?0:Math.min(1,Math.max(0,(e.progressCurrent??0)/t))}var sA={running:`Running`,paused:`Paused`,pending:`Queued`,failed:`Failed`,partial:`Done with problems`,done:`Done`,canceled:`Canceled`},cA={pending:`Not started`,running:`Running`,done:`Done`,provided:`Provided`,failed:`Failed`,canceled:`Canceled`,skipped:`Off`},lA=`Waiting for your review`,uA=`Waiting for the agent`,dA=`Stopped`,fA=`Prepared`,pA=`Kept as is`;function mA(e){return e.status===`pending`&&(e.progress>0||e.stepFailed===!0||e.stopped===!0||e.waitingForAgent===!0)}function rde(e){return e.setAside!==!0&&e.waitingForAgent!==!0&&e.prepared!==!0}function hA(e){return e.setAside===!0?pA:e.waitingForAgent===!0?uA:e.stopped===!0?dA:e.prepared===!0?fA:lA}function gA(e){return e.status===`pending`&&e.waitingForAgent===!0&&e.setAside!==!0}function _A(e){return e.status===`running`||gA(e)}function vA(e){return e.status===`pending`&&!mA(e)}function yA(e){return e.status===`paused`||mA(e)&&rde(e)}function ide(e,t){return(e===`running`||e===`pending`)&&t.some(e=>e.state===`failed`)&&Que(t)}function bA(e){return e.status===`failed`||e.stepFailed===!0}var xA={research:`Research`,article:`Article`,audio:`Audio`,images:`Images`,thumbnail:`Thumbnail`,video:`Video`,document:`Document`};function SA(e){return e.sources.video===`off`?e.sources.audio===`off`?`article`:`audio`:`video`}function ade(e,t){return e===`video`&&SA(t)===`audio`?`Audio export`:xA[e]}function CA(e,t){return e.kind===`video`&&e.state===`running`&&t.subtitles!==void 0&&t.subtitles.mode!==`off`&&e.progressTotal===100&&(e.progressCurrent??0)<=35}var ode={research:(e,t)=>`chapter ${String(e)} of ${String(t)}`,article:(e,t)=>`${String(e)} of ${String(t)}`,audio:(e,t)=>`chunk ${String(e)} of ${String(t)}`,images:(e,t)=>`image ${String(e)} of ${String(t)}`,thumbnail:(e,t)=>`${String(e)} of ${String(t)}`,video:(e,t)=>`${String(AA(e,t))}% rendered`,document:(e,t)=>`${String(e)} of ${String(t)}`},sde={audio_intro:`intro`,audio_body:`body`,audio_outro:`outro`};function wA(e,t,n,r=!1){let i=t.filter(t=>t.stageKind===e.kind);switch(e.state){case`skipped`:return`Not part of this run`;case`pending`:return n.status===`paused`?`Waits until you continue the run`:n.status===`pending`&&n.setAside===!0?pA:r?`Waits until you continue the run`:gA(n)?uA:e.retryAt===void 0?e.kind===`images`||e.kind===`thumbnail`&&e.source===`from_prompt`?`Ready to run`:`Waits for the stages above`:`Trying again at ${DA(e.retryAt)}`;case`provided`:return dde(i)??`Provided`;case`failed`:return`Stopped after ${lde(e)}`;case`canceled`:return`Canceled by user`;case`running`:return CA(e,n.config)?`Preparing subtitles · ${String(AA(e.progressCurrent??0,35))}%`:e.activity===void 0?e.kind===`video`&&SA(n.config)===`audio`?`Exporting combined audio`:e.progressTotal===null||e.progressTotal<=0?`Running`:ode[e.kind](e.progressCurrent??0,e.progressTotal):EA(TA(e)??``);case`done`:return ude(e.kind,i,n)}}function TA(e){let t=e.activity;if(t!==void 0)return t.percent===void 0?t.done!==void 0&&t.total!==void 0?`${t.label} (${String(t.done)} of ${String(t.total)})`:t.label:`${t.label} (${String(t.percent)}%)`}function EA(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function cde(e){let t=e.activity;if(t?.percent!==void 0)return t.percent/100;if(t?.done!==void 0&&t.total!==void 0&&t.total>0)return t.done/t.total;if(t===void 0&&!(e.progressTotal===null||e.progressTotal<=0))return Math.min(1,Math.max(0,(e.progressCurrent??0)/e.progressTotal))}function DA(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function lde(e){return e.attemptCount===1?`1 attempt`:`${String(e.attemptCount)} attempts`}function ude(e,t,n){switch(e){case`research`:return`Notes ready`;case`article`:{let e=t.filter(e=>e.role===`sources`||e.role===`glossary`);return e.length===0?`Article ready`:`Article and ${String(e.length)} end-matter files`}case`audio`:return MA([pde(t.flatMap(e=>{let t=sde[e.role];return t===void 0?[]:[t]})),kA(OA(t))]);case`images`:return fde(t.filter(e=>e.role===`image`).length,`image`);case`thumbnail`:return t.length===0?`Thumbnail ready`:`1 image`;case`video`:return MA([kA(OA(t)),SA(n.config)===`audio`?`WAV · stereo · 48 kHz`:n.format]);case`document`:return`PDF · ${TD(n.config.document)} theme`}}function dde(e){let t=e.flatMap(e=>e.originalFilename===null?[]:[e.originalFilename]);return t.length===0?void 0:t.join(`, `)}function OA(e){let t=Math.max(0,...e.map(e=>e.durationMs??0));return t===0?void 0:t}function kA(e){if(e===void 0||!Number.isFinite(e)||e<=0)return;let t=Math.round(e/1e3),n=[Math.floor(t/60)%60,t%60].map(e=>String(e).padStart(2,`0`)),r=Math.floor(t/3600);return r===0?n.join(`:`):[String(r),...n].join(`:`)}function AA(e,t){return t<=0?0:Math.min(100,Math.max(0,Math.round(e/t*100)))}function fde(e,t){return e===1?`1 ${t}`:`${String(e)} ${t}s`}function pde(e){if(e.length!==0)return e.length===1?jA(e[0]??``):jA(`${e.slice(0,-1).join(`, `)} and ${e[e.length-1]??``}`)}function jA(e){return e.charAt(0).toUpperCase()+e.slice(1)}function MA(e){return e.filter(e=>e!==void 0&&e!==``).join(` · `)}var NA=12,PA=16;function FA(e,t,n){return Math.max(t,Math.min(e,Math.max(t,n)))}function mde(e,t,n){let r=Math.min(n.width,t.width-24),i=FA(e?.left??(t.width-r)/2,NA,t.width-r-NA),a=FA((e?.top??0)+((e?.height??t.height)-n.height)/2,NA,t.height-n.height-NA),o=t.height-n.height-NA;if(!e)return{left:i,top:a,width:r,docked:!1};let s=e.left+e.width,c=e.top+e.height;return s+PA+r<=t.width-NA?{left:s+PA,top:a,width:r,docked:!1}:e.left-PA-r>=NA?{left:e.left-PA-r,top:a,width:r,docked:!1}:c>=NA&&c+PA+n.height<=t.height-NA?{left:i,top:c+PA,width:r,docked:!1}:e.top-PA-n.height>=NA&&e.top<=t.height-NA?{left:i,top:e.top-PA-n.height,width:r,docked:!1}:{left:t.width-r-NA,top:Math.max(NA,o),width:r,docked:!0}}function IA(e,t,n=t.height){let r=FA(e.left-6,0,t.width),i=FA(e.top-6,0,Math.min(n,t.height)),a=FA(e.left+e.width+6,0,t.width),o=FA(e.top+e.height+6,0,Math.min(n,t.height));return a>r&&o>i?{left:r,top:i,width:a-r,height:o-i}:null}var hde=`[data-slot="select-content"], [data-slot="dropdown-menu-content"], [data-slot="menu-content"]`;function LA(e){try{return document.querySelector(e)}catch{return null}}function RA(){return[...document.querySelectorAll(`[data-slot="dialog-content"][data-state="open"]`)].at(-1)??null}function zA(e){if(!e)return[];let t=[e,...e.querySelectorAll(`[aria-controls]`)],n=new Set(t.flatMap(e=>(e.getAttribute(`aria-controls`)??``).split(` `)));return[...document.querySelectorAll(hde)].filter(e=>n.has(e.id))}function BA(e){let t=e.getBoundingClientRect();return t.width>0&&t.height>0?{left:t.left,top:t.top,width:t.width,height:t.height}:null}var gde=`a[href], button, input, select, textarea, summary, [tabindex], [contenteditable="true"]`;function _de(e,t,n,r){let i=(0,m.useRef)(document.activeElement),a=(0,m.useRef)(t);a.current=t,(0,m.useEffect)(()=>{let e=i.current;return()=>{queueMicrotask(()=>{e instanceof HTMLElement&&e.isConnected&&!n.current&&e.focus({preventScroll:!0})})}},[n]),(0,m.useEffect)(()=>{let t=()=>{let t=LA(e);return[t,n.current,...zA(t)].filter(e=>e!==null)},i=e=>e instanceof Node&&t().some(t=>t.contains(e)),o=e=>{RA()||i(e.target)||(e.preventDefault(),e.stopImmediatePropagation())},s=e=>{RA()||i(e.target)||e.target instanceof HTMLElement&&e.target.hasAttribute(`data-radix-focus-guard`)||r.current?.focus({preventScroll:!0})},c=n=>{if(RA())return;let r=zA(LA(e));if(n.key===`Escape`){if(r.length>0)return;n.preventDefault(),n.stopImmediatePropagation(),a.current();return}if(n.key!==`Tab`){i(n.target)||o(n);return}if(r.length>0)return;let s=t().flatMap(e=>[e,...e.querySelectorAll(gde)]).filter((e,t,n)=>n.indexOf(e)===t&&e.tabIndex>=0&&!e.matches(`:disabled, [hidden], [aria-hidden='true']`)&&!e.closest(`[hidden], [inert]`)&&(!e.closest(`details:not([open])`)||e.closest(`summary`)!==null));if(s.length===0)return;let c=s.indexOf(document.activeElement),l=c===-1?n.shiftKey?s.length-1:0:(c+(n.shiftKey?-1:1)+s.length)%s.length;n.preventDefault(),s[l]?.focus()},l=[`pointerdown`,`pointerup`,`mousedown`,`mouseup`,`click`,`dblclick`,`contextmenu`];for(let e of l)window.addEventListener(e,o,!0);return window.addEventListener(`keydown`,c,!0),window.addEventListener(`focusin`,s,!0),()=>{for(let e of l)window.removeEventListener(e,o,!0);window.removeEventListener(`keydown`,c,!0),window.removeEventListener(`focusin`,s,!0)}},[e,n,r])}function vde(e,t,n,r,i,a){let[o,s]=(0,m.useState)(()=>({key:e,target:null,portals:[],width:window.innerWidth,height:window.innerHeight,cardHeight:260,modalOpen:RA()!==null}));return(0,m.useLayoutEffect)(()=>{let o=0,c=0,l=null,u=null,d=new Map,f=new ResizeObserver(()=>h()),p=e=>{for(let[t,n]of d)e.has(t)||(t.style.zIndex=n,d.delete(t))},m=()=>{o=0;let r=LA(t);r!==u&&(u&&f.unobserve(u),r&&f.observe(r),u=r);let i=r?BA(r):null;r&&i&&l!==r&&(l=r,cancelAnimationFrame(c),c=requestAnimationFrame(()=>{c=0,r.isConnected&&(r.scrollIntoView({block:`start`,inline:`nearest`,behavior:`instant`}),m())}));let a=zA(r),h=new Set;for(let e of a){let t=e.closest(`[data-radix-popper-content-wrapper]`)??e;h.add(t),d.has(t)||(d.set(t,t.style.zIndex),t.style.zIndex=`102`)}p(h);let g={key:e,target:i,portals:a.map(BA).filter(e=>e!==null),width:window.innerWidth,height:window.innerHeight,cardHeight:n.current?.getBoundingClientRect().height||260,modalOpen:RA()!==null};s(e=>JSON.stringify(e)===JSON.stringify(g)?e:g)};function h(){o||=requestAnimationFrame(m)}let g=new MutationObserver(e=>{e.some(e=>!i.current?.contains(e.target)&&e.target!==a.current)&&h()});return g.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`id`,`class`,`style`,`hidden`,`aria-controls`,`data-state`,`data-tour`]}),n.current&&f.observe(n.current),f.observe(document.documentElement),window.addEventListener(`resize`,h),window.addEventListener(`scroll`,h,!0),window.visualViewport?.addEventListener(`resize`,h),window.visualViewport?.addEventListener(`scroll`,h),m(),RA()||r.current?.focus({preventScroll:!0}),()=>{cancelAnimationFrame(o),cancelAnimationFrame(c),f.disconnect(),g.disconnect(),window.removeEventListener(`resize`,h),window.removeEventListener(`scroll`,h,!0),window.visualViewport?.removeEventListener(`resize`,h),window.visualViewport?.removeEventListener(`scroll`,h),p(new Set)}},[e,t,n,r,i,a]),o}function yde({stepId:e,target:t,title:n,children:r,progress:i,onNext:a,onBack:o,onClose:s,nextLabel:c=`Next`,nextDisabled:l=!1,onSkip:u,skipLabel:d=`Skip this step`}){let f=(0,m.useId)(),p=`${e}:${t}`,g=(0,m.useRef)(null),_=(0,m.useRef)(null),v=(0,m.useRef)(null),y=(0,m.useRef)(null),b=vde(p,t,g,_,v,y);_de(t,s,g,_);let[x,S]=(0,m.useState)({key:p,height:0}),C=b.key===p?b.target:null,w={width:b.width,height:b.height},T={width:Math.min(360,w.width-24),height:b.cardHeight},E=mde(C,w,T),D=C?IA(C,w,E.docked?E.top-12:w.height):null,O=b.key===p?b.portals.map(e=>IA(e,w)).filter(e=>e!==null):[],k=[...D?[D]:[],...O],A=`M0 0H${w.width}V${w.height}H0Z`+(D?`M${D.left} ${D.top}H${D.left+D.width}V${D.top+D.height}H${D.left}Z`:``);(0,m.useLayoutEffect)(()=>{S(e=>{let t=Math.max(e.key===p?e.height:0,E.docked?T.height+24:0);return e.key===p&&e.height===t?e:{key:p,height:t}})},[p,E.docked,T.height]);let j=x.key===p?x.height:0;return(0,m.useEffect)(()=>{let e=document.documentElement,t=e.style.scrollPaddingBottom;return e.style.scrollPaddingBottom=`${j}px`,()=>{e.style.scrollPaddingBottom=t}},[j]),(0,Vd.createPortal)((0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`div`,{ref:y,"aria-hidden":`true`,style:{height:j}}),(0,h.jsxs)(`div`,{ref:v,hidden:b.modalOpen,"data-tutorial":`spotlight`,className:`pointer-events-none fixed inset-0 z-[100] font-sans`,children:[(0,h.jsxs)(`svg`,{"aria-hidden":`true`,className:`absolute inset-0 h-full w-full`,width:w.width,height:w.height,children:[(0,h.jsx)(`defs`,{children:(0,h.jsxs)(`mask`,{id:`${f}-mask`,children:[(0,h.jsx)(`rect`,{width:`100%`,height:`100%`,fill:`white`}),k.map(e=>(0,h.jsx)(`rect`,{x:e.left,y:e.top,width:e.width,height:e.height,rx:`6`,fill:`black`},`${e.left}:${e.top}:${e.width}:${e.height}`))]})}),(0,h.jsx)(`rect`,{width:`100%`,height:`100%`,fill:`rgb(0 0 0 / 0.72)`,mask:`url(#${f}-mask)`}),(0,h.jsx)(`path`,{d:A,fill:`transparent`,fillRule:`evenodd`,pointerEvents:`fill`}),D&&(0,h.jsx)(`rect`,{"data-tutorial":`hole`,x:D.left,y:D.top,width:D.width,height:D.height,rx:`6`,fill:`none`,stroke:`var(--color-accent)`,strokeWidth:`2`})]}),(0,h.jsxs)(`section`,{ref:g,"aria-label":`Interactive getting started guide`,"aria-describedby":`${f}-instructions`,"data-tutorial":`card`,className:`pointer-events-auto fixed z-[101] flex flex-col gap-3 rounded-media border border-line-strong bg-surface p-4 text-body text-ink shadow-[var(--shadow-pop)]`,style:{left:E.left,top:E.top,width:E.width,maxHeight:Math.min(w.height-24,Math.max(160,Math.min(420,w.height*.48)))},children:[(0,h.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3`,children:[(0,h.jsxs)(`span`,{className:`engraved text-accent-ink`,children:[`Getting started · `,i]}),(0,h.jsx)(B,{variant:`quiet`,onClick:s,"aria-label":`Exit guide`,className:`h-7 px-2`,children:`Exit`})]}),(0,h.jsx)(`h2`,{ref:_,id:`${f}-title`,tabIndex:-1,className:`shrink-0 text-title-3 font-bold outline-none`,children:n}),(0,h.jsxs)(`div`,{id:`${f}-instructions`,className:`min-h-0 overflow-y-auto text-ink-2 [&_p+p]:mt-2 [&_code]:text-ink`,children:[r,!C&&(0,h.jsx)(`p`,{role:`status`,className:`mt-3 text-waiting`,children:`This section is not available yet. Wait for the page to load, go back, or exit the guide.`}),E.docked&&C&&(0,h.jsx)(`p`,{className:`mt-3 text-small`,children:`Scroll the page to work through the highlighted section.`})]}),(0,h.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-t border-line pt-3`,children:[o&&(0,h.jsx)(B,{onClick:o,children:`Back`}),u&&(0,h.jsx)(B,{variant:`quiet`,onClick:u,className:`px-2`,children:d}),(0,h.jsx)(B,{variant:`primary`,onClick:a,disabled:l||!C,className:`ml-auto`,children:c})]})]})]})]}),document.body)}function VA({href:e,children:t}){return(0,h.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`text-ink underline underline-offset-2`,children:t})}function HA({text:e}){let[t,n]=(0,m.useState)(!1),[r,i]=(0,m.useState)(!1);return(0,h.jsxs)(`div`,{className:`space-y-2`,children:[(0,h.jsx)(`p`,{className:`select-text rounded-control border border-line-strong bg-raised p-3 text-small leading-relaxed`,children:e}),(0,h.jsx)(B,{onClick:()=>{if(i(!1),!navigator.clipboard){i(!0);return}navigator.clipboard.writeText(e).then(()=>n(!0),()=>i(!0))},children:t?`Copied`:`Copy example`}),r?(0,h.jsx)(`p`,{role:`status`,children:`Select the example above and copy it manually.`}):null]})}var UA={signUp:{label:`platform.openai.com/signup`,url:`https://platform.openai.com/signup`},keyPage:{label:`platform.openai.com/api-keys`,url:`https://platform.openai.com/api-keys`},billing:{label:`Billing`,url:`https://platform.openai.com/settings/organization/billing/overview`},steps:[`Sign up or sign in to the OpenAI platform.`,`Open Billing and buy prepaid credit (new accounts need at least $5 before any call works).`,`Open API keys, choose Create new secret key, and copy it (it is shown once).`,`Paste it here, choose Save, then Test.`],permissions:`A key with All permissions works. A restricted key needs Models: Read (for Test) and Model capabilities: Request (for speech and images). GPT Image models may also need Verify Organization under Settings → Organization → General on the OpenAI platform.`,docs:{label:`OpenAI API docs`,url:`https://developers.openai.com/api/docs/guides/error-codes`}},WA={signUp:{label:`aistudio.google.com`,url:`https://aistudio.google.com`},keyPage:{label:`aistudio.google.com/apikey`,url:`https://aistudio.google.com/apikey`},billing:{label:`Projects → Set up billing`,url:`https://aistudio.google.com/projects`},steps:[`Sign in to Google AI Studio with your Google account.`,`Open Projects and choose Set up billing next to your project: Gemini image models are not available on the free tier.`,`Open API keys, choose Create API key, and copy it.`,`Paste it here, choose Save, then Test.`],permissions:`Use a key made in AI Studio. An older Google Cloud key must be set to Restrict to Gemini API only, or Google rejects it.`,docs:{label:`Gemini API keys`,url:`https://ai.google.dev/gemini-api/docs/api-key`}},GA={openrouter:{signUp:{label:`openrouter.ai/sign-up`,url:`https://openrouter.ai/sign-up`},keyPage:{label:`openrouter.ai/settings/keys`,url:`https://openrouter.ai/settings/keys`},billing:{label:`Credits`,url:`https://openrouter.ai/settings/credits`},steps:[`Sign up at OpenRouter.`,`Open Credits and buy credit (paid models are charged from it; a negative balance stops even free models).`,`Open Keys, choose Create API key, and copy it.`,`Paste it here, choose Save, then Test.`],permissions:`Keys have no scopes. If you set a credit limit on the key, keep it above what a run costs.`,docs:{label:`OpenRouter docs`,url:`https://openrouter.ai/docs/api-reference/limits`}},"openai-tts":UA,"openai-image":UA,"google-image":WA,"google-tts":{...WA,steps:[`Sign in to Google AI Studio with your Google account.`,`Open API keys, choose Create API key, and copy it.`,`Paste it here, choose Save, then Test.`],permissions:`The same Gemini API key as Google images: with one saved there, Gemini voices use it and nothing is needed here. ${WA.permissions}`},fal:{signUp:{label:`fal.ai/login`,url:`https://fal.ai/login`},keyPage:{label:`fal.ai/dashboard/keys`,url:`https://fal.ai/dashboard/keys`},billing:{label:`Billing`,url:`https://fal.ai/dashboard/billing`},steps:[`Sign up at fal.ai.`,`Open Billing and buy credit: fal.ai is prepaid and locks the account when the balance runs out.`,`Open Keys, choose Add key with the API scope, and copy it.`,`Paste it here, choose Save, then Test.`],permissions:`The API scope is enough; Slopify does not need an ADMIN key.`,docs:{label:`fal.ai authentication`,url:`https://fal.ai/docs/model-apis/authentication`}},replicate:{signUp:{label:`replicate.com/signin`,url:`https://replicate.com/signin`},keyPage:{label:`replicate.com/account/api-tokens`,url:`https://replicate.com/account/api-tokens`},billing:{label:`Billing`,url:`https://replicate.com/account/billing`},steps:[`Sign in to Replicate.`,`Open Billing and buy credit: Replicate needs credit up front before it runs paid models.`,`Open API tokens, create a token, and copy it (it starts with r8_).`,`Paste it here, choose Save, then Test.`],permissions:`Tokens have no scopes.`,docs:{label:`Replicate billing`,url:`https://replicate.com/docs/topics/billing`}},elevenlabs:{signUp:{label:`elevenlabs.io/app/sign-up`,url:`https://elevenlabs.io/app/sign-up`},keyPage:{label:`elevenlabs.io/app/developers/api-keys`,url:`https://elevenlabs.io/app/developers/api-keys`},steps:[`Sign up at ElevenLabs.`,`Open Developers → API keys, choose Create key, and copy it.`,`Paste it here, choose Save, then Test.`],permissions:`A restricted key needs Text to Speech access and Models read access (models_read) for Test; Voices read helps when picking voices. Remove any credit quota or IP allowlist that would block this computer.`,docs:{label:`ElevenLabs API keys`,url:`https://elevenlabs.io/docs/api-reference/models/list`}},cartesia:{signUp:{label:`play.cartesia.ai/sign-up`,url:`https://play.cartesia.ai/sign-up`},keyPage:{label:`play.cartesia.ai/keys`,url:`https://play.cartesia.ai/keys`},steps:[`Sign up at Cartesia (the free plan needs no card).`,`Open API Keys, create a key, and copy it (it starts with sk_car_).`,`Paste it here, choose Save, then Test.`],permissions:`Keys have no scopes.`,docs:{label:`Cartesia authentication`,url:`https://docs.cartesia.ai/get-started/authenticate-your-client-applications`}},inworld:{signUp:{label:`platform.inworld.ai/signup`,url:`https://platform.inworld.ai/signup`},keyPage:{label:`platform.inworld.ai/api-keys`,url:`https://platform.inworld.ai/api-keys`},billing:{label:`Billing`,url:`https://platform.inworld.ai/billing`},steps:[`Sign up at the Inworld platform.`,`Open API Keys and choose Generate new key (a Standard key, not Realtime-only).`,`Copy the Base64 credentials value exactly as shown, without encoding it again.`,`Paste it here, choose Save, then Test.`],permissions:`A Standard key covers speech and reading voices. Realtime-only keys do not work.`,docs:{label:`Inworld API keys`,url:`https://docs.inworld.ai/portal/api-keys`}}},bde=`system-voice`,KA=[{id:`openrouter`,family:`llm`,displayName:`OpenRouter`,auth:`key`},{id:`claude-code`,family:`llm`,displayName:`Claude Code CLI`,auth:`cli`,binary:`claude`,versionArgs:[`--version`]},{id:`codex`,family:`llm`,displayName:`Codex CLI`,auth:`cli`,binary:`codex`,versionArgs:[`--version`]},{id:`gemini`,family:`llm`,displayName:`Gemini CLI`,auth:`cli`,binary:`gemini`,versionArgs:[`--version`]},{id:`elevenlabs`,family:`tts`,displayName:`ElevenLabs`,auth:`key`},{id:`openai-tts`,family:`tts`,displayName:`OpenAI`,auth:`key`},{id:`cartesia`,family:`tts`,displayName:`Cartesia`,auth:`key`},{id:`inworld`,family:`tts`,displayName:`Inworld`,auth:`key`},{id:`system-voice`,family:`tts`,displayName:`System voice`,auth:`local`},{id:`google-tts`,family:`tts`,displayName:`Google Gemini`,auth:`key`},{id:`fal`,family:`image`,displayName:`fal.ai`,auth:`key`},{id:`replicate`,family:`image`,displayName:`Replicate`,auth:`key`},{id:`openai-image`,family:`image`,displayName:`OpenAI`,auth:`key`},{id:`google-image`,family:`image`,displayName:`Google`,auth:`key`},{id:`codex-image`,family:`image`,displayName:`Codex CLI`,auth:`cli`,binary:`codex`,versionArgs:[`--version`]}],xde=[{name:`Zephyr`,style:`Bright`},{name:`Puck`,style:`Upbeat`},{name:`Charon`,style:`Informative`},{name:`Kore`,style:`Firm`},{name:`Fenrir`,style:`Excitable`},{name:`Leda`,style:`Youthful`},{name:`Orus`,style:`Firm`},{name:`Aoede`,style:`Breezy`},{name:`Callirrhoe`,style:`Easy-going`},{name:`Autonoe`,style:`Bright`},{name:`Enceladus`,style:`Breathy`},{name:`Iapetus`,style:`Clear`},{name:`Umbriel`,style:`Easy-going`},{name:`Algieba`,style:`Smooth`},{name:`Despina`,style:`Smooth`},{name:`Erinome`,style:`Clear`},{name:`Algenib`,style:`Gravelly`},{name:`Rasalgethi`,style:`Informative`},{name:`Laomedeia`,style:`Upbeat`},{name:`Achernar`,style:`Soft`},{name:`Alnilam`,style:`Firm`},{name:`Schedar`,style:`Even`},{name:`Gacrux`,style:`Mature`},{name:`Pulcherrima`,style:`Forward`},{name:`Achird`,style:`Friendly`},{name:`Zubenelgenubi`,style:`Casual`},{name:`Vindemiatrix`,style:`Gentle`},{name:`Sadachbia`,style:`Lively`},{name:`Sadaltager`,style:`Knowledgeable`},{name:`Sulafat`,style:`Warm`}];function qA(e){return KA.flatMap(t=>{let n=t.auth===`key`?GA[t.id]:void 0;return t.family===e&&n!==void 0?[{id:t.id,name:t.displayName,url:n.keyPage.url}]:[]})}function JA({family:e}){return(0,h.jsx)(`p`,{children:qA(e).map((e,t)=>(0,h.jsxs)(`span`,{children:[t===0?null:` · `,(0,h.jsx)(VA,{href:e.url,children:`${e.name} keys`})]},e.id))})}function YA(e){let t=qA(e).map(e=>e.name);return t.length<2?t[0]??``:`${t.slice(0,-1).join(`, `)} or ${t.at(-1)??``}`}function Sde({step:e}){switch(e){case`text-key`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{children:`First, choose what will write your scripts. You only need one text provider.`}),(0,h.jsxs)(`ol`,{className:`list-decimal space-y-1 pl-5`,children:[(0,h.jsxs)(`li`,{children:[`Sign in to`,` `,(0,h.jsx)(VA,{href:GA.openrouter?.keyPage.url??`https://openrouter.ai`,children:`OpenRouter`}),`, create an API key, and make sure the account can use your chosen model.`]}),(0,h.jsxs)(`li`,{children:[`Paste it into OpenRouter’s `,(0,h.jsx)(`strong`,{children:`API key`}),` field here, press`,` `,(0,h.jsx)(`strong`,{children:`Test`}),` to check it, then `,(0,h.jsx)(`strong`,{children:`Save`}),`.`]})]}),(0,h.jsx)(`p`,{children:`Already using Claude Code, Codex or Gemini CLI? You can use its existing CLI login instead. “Installed” means Slopify found the CLI; sign in through that CLI before generating. If it is missing, enter its executable path and save to check again.`}),(0,h.jsx)(`p`,{className:`text-ink-3`,children:`These are the real Settings controls. The tutorial never reads your key. Skip any step you have already handled.`})]});case`audio-key`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`The voice provider turns the finished article into audio. Choose `,YA(`tts`),`; you only need one.`]}),(0,h.jsxs)(`p`,{children:[`Create a key in your provider’s account, enable the API access or credits it requires, then paste the key into its row, press `,(0,h.jsx)(`strong`,{children:`Test`}),` to check it, and press`,` `,(0,h.jsx)(`strong`,{children:`Save`}),`.`]}),(0,h.jsx)(JA,{family:`tts`}),(0,h.jsx)(`p`,{children:`Next, you’ll add the exact voice that this provider should use. Skip voice setup if you plan to provide your own narration or turn Audio Off.`})]});case`image-key`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Choose one image provider (`,YA(`image`),`), create a key in its dashboard, paste it into the matching row, press `,(0,h.jsx)(`strong`,{children:`Test`}),` to check it, and press`,` `,(0,h.jsx)(`strong`,{children:`Save`}),`.`]}),(0,h.jsx)(JA,{family:`image`}),(0,h.jsxs)(`p`,{children:[`A saved key is not a billing check. The selected image model needs available quota. If Google reports `,(0,h.jsx)(`strong`,{children:`limit: 0`}),`, check the key’s project, billing and image-model quota before retrying.`]}),(0,h.jsx)(`p`,{children:`OpenAI’s voice and image rows are saved separately, even when you use the same API key. Skip this step if you plan to provide your own images or turn Images and Thumbnail Off.`})]});case`voice`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`ol`,{className:`list-decimal space-y-1 pl-5`,children:[(0,h.jsxs)(`li`,{children:[`Enter a `,(0,h.jsx)(`strong`,{children:`Voice name`}),` you will recognize, such as “Travel narrator.”`]}),(0,h.jsxs)(`li`,{children:[`Select the `,(0,h.jsx)(`strong`,{children:`Provider`}),` whose voice key you saved.`]}),(0,h.jsxs)(`li`,{children:[`Copy the exact `,(0,h.jsx)(`strong`,{children:`Voice ID`}),` from that provider’s voice library or documentation.`]}),(0,h.jsxs)(`li`,{children:[`Press `,(0,h.jsx)(`strong`,{children:`Add voice`}),`.`]})]}),(0,h.jsx)(`p`,{children:`The name is your label; the ID tells the provider which voice to use. Slopify checks the ID with the provider when narration runs. A voice is only required when Audio is set to Generate.`})]})}}var Cde=`Write a 150-word narration about {{topic}} for {{audience}}. Open with an interesting fact, explain three highlights, and end with one memorable takeaway. Use natural spoken English. Return only the narration, without headings or stage directions.`,wde=`A cinematic editorial photograph of {{topic}}, with natural light, a clear focal point, rich detail, and no text or logos. Compose it for a travel video.`;function Tde({step:e,output:t=`video`}){switch(e){case`text-key`:case`audio-key`:case`image-key`:case`voice`:return(0,h.jsx)(Sde,{step:e});case`article-name`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{children:`A prompt is a reusable set of instructions. This one will write the narration for each video.`}),(0,h.jsxs)(`p`,{children:[`Give it a recognizable name, such as `,(0,h.jsx)(`strong`,{children:`Short travel narration`}),`. This is the prompt’s library name, not your video’s title.`]}),(0,h.jsx)(`p`,{children:`The next steps will add its instructions and reusable keywords.`})]});case`article-body`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{children:`Tell the model what to write, who it is for, the length, and the style. Put anything you want to change between runs inside double braces.`}),(0,h.jsx)(HA,{text:Cde}),(0,h.jsxs)(`p`,{children:[`Paste or write the instructions in `,(0,h.jsx)(`strong`,{children:`Body`}),`. `,(0,h.jsx)(`strong`,{children:`{{topic}}`}),` `,`and `,(0,h.jsx)(`strong`,{children:`{{audience}}`}),` will become fields on Play.`]})]});case`article-keywords`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`This panel detects your keywords as you type. With the example, it should list`,` `,(0,h.jsx)(`strong`,{children:`topic`}),` and `,(0,h.jsx)(`strong`,{children:`audience`}),`.`]}),(0,h.jsxs)(`p`,{children:[(0,h.jsx)(`strong`,{children:`{{topic}}`}),` is a field name, not the value. You will enter “Albania” on Play later. Repeated names use the same value; names are case-sensitive, so`,` `,(0,h.jsx)(`strong`,{children:`topic`}),` and `,(0,h.jsx)(`strong`,{children:`Topic`}),` are different.`]}),(0,h.jsxs)(`p`,{children:[`There are no automatic keywords: `,(0,h.jsx)(`strong`,{children:`{{title}}`}),` would also ask you for a value. Fix any keyword warnings in Body before saving.`]})]});case`article-save`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Press the highlighted `,(0,h.jsx)(`strong`,{children:`Save`}),` button in the editor. The prompt will appear in your Article library.`]}),(0,h.jsx)(`p`,{children:`The tour continues when the save succeeds and the editor returns to the prompt list. If a name is already taken, go Back and choose another.`})]});case`image-prompt`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Keep `,(0,h.jsx)(`strong`,{children:`Kind`}),` on `,(0,h.jsx)(`strong`,{children:`Image`}),`. Name this prompt`,` `,(0,h.jsx)(`strong`,{children:`Travel imagery`}),`, then enter this example or your own visual instructions.`]}),(0,h.jsx)(HA,{text:wde}),(0,h.jsxs)(`p`,{children:[`Using `,(0,h.jsx)(`strong`,{children:`{{topic}}`}),` in both prompts creates one shared field on Play. Image prompts describe the picture directly; they do not automatically receive your article.`]})]});case`image-save`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Press `,(0,h.jsx)(`strong`,{children:`Save`}),` to add this to your Image library. Next you will combine both prompts on Play.`]}),(0,h.jsx)(`p`,{children:`You can create more prompts later for different subjects, styles, lengths, or languages.`})]});case`play-article`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Play is where you configure one project. Leave `,(0,h.jsx)(`strong`,{children:`Article`}),` on`,` `,(0,h.jsx)(`strong`,{children:`Write it for me`}),`, then select the article prompt you saved.`]}),(0,h.jsxs)(`p`,{children:[(0,h.jsx)(`strong`,{children:`Use my text as written`}),` is for an article you already have. For this first run, use Write it for me and keep the script short. Article is required; every other stage can be Off.`]}),(0,h.jsx)(`p`,{children:`Research starts Off. You can turn it on in a later run for web-grounded notes that are automatically passed to the article writer.`})]});case`play-audio`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Leave `,(0,h.jsx)(`strong`,{children:`Audio`}),` on `,(0,h.jsx)(`strong`,{children:`Generate`}),`. Pick your voice`,` `,(0,h.jsx)(`strong`,{children:`TTS`}),` provider, a `,(0,h.jsx)(`strong`,{children:`TTS model`}),`, then the saved`,` `,(0,h.jsx)(`strong`,{children:`Voice`}),`.`]}),(0,h.jsxs)(`p`,{children:[`Keep `,(0,h.jsx)(`strong`,{children:`Chunking`}),` (under `,(0,h.jsx)(`strong`,{children:`More audio settings`}),`) on`,` `,(0,h.jsx)(`strong`,{children:`Whole`}),` for the short example: the narration is sent as one request. Other chunking modes split longer text into pieces. `,(0,h.jsx)(`strong`,{children:`Speakers`}),` is where an audiobook or podcast gets more than one voice; leave it on one voice for now.`]}),(0,h.jsx)(`p`,{children:`Use Provide to upload existing narration, including any intro and outro in that file, or Off to skip narration. Video can still run silently, with each image shown for 5 seconds.`})]});case`play-images`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Leave `,(0,h.jsx)(`strong`,{children:`Images`}),` on `,(0,h.jsx)(`strong`,{children:`Generate`}),`. Choose the image`,` `,(0,h.jsx)(`strong`,{children:`Provider`}),` and `,(0,h.jsx)(`strong`,{children:`Model`}),`, tick your image prompt, and type`,` `,(0,h.jsx)(`strong`,{children:`2`}),` in the number box beside it for a small first run.`]}),(0,h.jsx)(`p`,{children:`The number means separate images made from that same prompt. It does not make one scene per article paragraph. Add more image prompts when you want different scenes.`}),(0,h.jsx)(`p`,{children:`Use Provide for your own images or Off to skip them. Turning Images Off also turns Video Off. Thumbnail remains independent; keep it Off for this first run.`})]});case`play-video`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`On `,(0,h.jsx)(`strong`,{children:`Export`}),`, choose `,(0,h.jsx)(`strong`,{children:`Generate`}),` for an MP4 slideshow. It needs generated or provided images. With Audio Off, the video is silent and each image lasts 5 seconds.`]}),(0,h.jsxs)(`p`,{children:[`Choose `,(0,h.jsx)(`strong`,{children:`Off`}),` to skip video. If Audio is active, Slopify exports one combined `,(0,h.jsx)(`strong`,{children:`WAV`}),` with the intro, body, outro and configured gaps.`]}),(0,h.jsx)(`p`,{children:`If both Audio and Video are Off, download the article and any other enabled outputs individually.`})]});case`play-subtitles`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Subtitles are optional and start `,(0,h.jsx)(`strong`,{children:`Off`}),`. Choose`,` `,(0,h.jsx)(`strong`,{children:`Subtitle files`}),` for SRT and VTT downloads, or`,` `,(0,h.jsx)(`strong`,{children:`Burn into video + files`}),` to keep captions visible in an MP4.`]}),(0,h.jsxs)(`p`,{children:[`English captions are timed locally from your narration with no paid API. First use downloads an approximately `,(0,h.jsx)(`strong`,{children:`378 MB`}),` speech model (a smaller one can be chosen in Settings → Production defaults). Audio must be active; WAV exports support separate subtitle files.`]}),(0,h.jsx)(`p`,{children:`Pick a font or upload a TTF/OTF file, then adjust its size in the preview. Styling applies to burned captions. You can also add or change subtitles on a completed project later without regenerating its narration.`})]});case`play-options`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Enter a `,(0,h.jsx)(`strong`,{children:`Project title`}),`, such as “A quick trip to Albania.” Set the title in Content.`]}),(0,h.jsxs)(`p`,{children:[`Select the text `,(0,h.jsx)(`strong`,{children:`LLM`}),` and `,(0,h.jsx)(`strong`,{children:`Text model`}),`. The model list loads for your provider. Use `,(0,h.jsx)(`strong`,{children:`Refresh`}),` for updated choices or`,` `,(0,h.jsx)(`strong`,{children:`Custom ID`}),`to enter an exact model ID when supported.`]}),(0,h.jsx)(`p`,{children:`Intro and Outro are available in Outputs when Audio is Generate. The LLM controls appear only when an enabled stage needs text generation.`})]});case`play-keywords`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`The prompts you picked created these fields. For the examples, enter`,` `,(0,h.jsx)(`strong`,{children:`Albania`}),` for `,(0,h.jsx)(`strong`,{children:`topic`}),` and`,` `,(0,h.jsx)(`strong`,{children:`first-time travelers`}),` for `,(0,h.jsx)(`strong`,{children:`audience`}),`.`]}),(0,h.jsx)(`p`,{children:`Each keyword is asked once, with the prompts that use it named underneath. A keyword both prompts use feeds the article and the images, so changing it changes both for this run.`}),(0,h.jsx)(`p`,{children:`Fill every visible field. Each value must fit on one line and be no more than 200 characters. Your saved prompt keeps its braces so you can reuse it next time.`})]});case`play-start`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{children:`Review the enabled outputs, costs and readiness in Review. If anything is missing, use Back to fix the highlighted section.`}),(0,h.jsxs)(`p`,{children:[`When ready, press the real `,(0,h.jsx)(`strong`,{children:`Start run`}),` or `,(0,h.jsx)(`strong`,{children:`Queue N`}),` `,`button. This creates a project and sends generation requests to your chosen providers, which may charge your account.`]}),(0,h.jsx)(`p`,{children:`The tour will follow you to the project. You can also skip generating and go on to the screens you run a channel from.`})]});case`project`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`The rail on the left lists the project's sections: Article, Narration, Images, Video and the rest. The right rail says where the run stands and offers the one thing to do next, named for its result: `,(0,h.jsx)(`strong`,{children:`Pause`}),` while it runs,`,` `,(0,h.jsx)(`strong`,{children:`Continue the run`}),` when it is paused, `,(0,h.jsx)(`strong`,{children:`Try images again`}),` `,`when a step fails.`]}),(0,h.jsxs)(`p`,{children:[`Press `,(0,h.jsx)(`strong`,{children:`Edit settings`}),` to change providers, models, voice, prompts or optional steps. `,(0,h.jsx)(`strong`,{children:`Save changes`}),` keeps a new revision without starting generation; what the change made outdated is then offered as the next action, such as`,` `,(0,h.jsx)(`strong`,{children:`Remake 3 outdated images`}),`. Earlier revisions stay in`,` `,(0,h.jsx)(`strong`,{children:`History`}),`.`]}),(0,h.jsxs)(`p`,{children:[`A failed step says why beside it; open `,(0,h.jsx)(`strong`,{children:`Error details`}),` for the provider's own message. Rare actions, such as making a whole stage again, sit behind each section's`,` `,(0,h.jsx)(`strong`,{children:`More`}),` button and in the command palette (Ctrl+K).`]})]});case`download`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[t===`audio`?(0,h.jsxs)(h.Fragment,{children:[`When Audio export finishes, press `,(0,h.jsx)(`strong`,{children:`Download`}),`, then`,` `,(0,h.jsx)(`strong`,{children:`Audio (.wav)`}),` for the combined narration.`]}):t===`article`?(0,h.jsxs)(h.Fragment,{children:[`Use `,(0,h.jsx)(`strong`,{children:`Download`}),` here to save the article. Audio and Video are Off for this project.`]}):(0,h.jsxs)(h.Fragment,{children:[`When Video finishes, press `,(0,h.jsx)(`strong`,{children:`Download`}),`, then`,` `,(0,h.jsx)(`strong`,{children:`Video (.mp4)`}),`.`]}),` `,`The completed project stays in `,(0,h.jsx)(`strong`,{children:`Projects`}),` so you can return to it.`]}),(0,h.jsxs)(`p`,{children:[`Select Article, Audio or Images in the stage list on the `,(0,h.jsx)(`strong`,{children:`Output`}),` tab to download their outputs. `,(0,h.jsx)(`strong`,{children:`Download all`}),` under Images gives an image ZIP, not the video.`]}),(0,h.jsxs)(`p`,{children:[`If subtitles are enabled, download the `,(0,h.jsx)(`strong`,{children:`.srt`}),` or `,(0,h.jsx)(`strong`,{children:`.vtt`}),` `,`files beside the final export. File-mode captions are also available in the video player.`]})]});case`run-cost`:return(0,h.jsxs)(`p`,{children:[(0,h.jsx)(`strong`,{children:`Cost`}),` in the project's sections shows what this run really cost, per stage and model. Totals for every project are in Settings, `,(0,h.jsx)(`strong`,{children:`Usage`}),`.`]});case`studio-prep`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Slopify never uploads for you. When the video is made, `,(0,h.jsx)(`strong`,{children:`Prepare upload`}),` `,`is the next action: it lists everything YouTube Studio asks for, in the order it asks, from the file and title to the thumbnail, tags and the AI disclosure.`]}),(0,h.jsxs)(`p`,{children:[`The browser extension in Settings, `,(0,h.jsx)(`strong`,{children:`YouTube Studio`}),`, can fill those in for you.`]})]});case`home`:return(0,h.jsxs)(`p`,{children:[(0,h.jsx)(`strong`,{children:`Home`}),` is the day at a glance: what needs you, what is running and at which step, what is coming up this week and what is ready to upload.`]});case`channels`:return(0,h.jsxs)(`p`,{children:[`A `,(0,h.jsx)(`strong`,{children:`channel`}),` keeps its brand kit, series brief, templates, schedules and a cast that looks the same in every video. It also remembers finished episodes and your existing videos, so new topics do not repeat them.`]});case`calendar`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`The `,(0,h.jsx)(`strong`,{children:`Calendar`}),` shows the coming weeks of uploads: what is ready, what needs you, and the topics a schedule suggested, waiting for your approval. Its`,` `,(0,h.jsx)(`strong`,{children:`Schedules`}),` tab is where you create, pause and resume the schedules that fill it.`]}),(0,h.jsx)(`p`,{children:`You have reached the end. Press the question-mark button at the foot of the sidebar anytime to walk through these steps again, or the book beside it for Help → Tutorials, the guides to every screen.`})]})}}function XA(e){return dk(e.readiness)}function Ede({session:e,progress:t,update:n}){let{api:r}=V(),i=aA(),a=Ji(),o=Va(),s=I(sy(r)),c=I(cy(r)),l=I(ly(r)),u=I({...ay(r,e.projectId??``),enabled:e.projectId!==void 0}),[d,f]=(0,m.useState)(null),p=(0,m.useRef)(null),g=ok[e.step],_=s.data?.seen===!0;if((0,m.useEffect)(()=>{if(!_||!g||p.current===e.step)return;if(p.current=e.step,g.page===`settings`){let e=g.id===`voice`?`voices`:`providers`;(o.pathname!==`/settings`||!o.searchStr.includes(`section=${e}`))&&a({to:`/settings`,search:{section:e}})}if(g.page===`article`||g.page===`image`){let t=g.page===`article`?e.articleId:e.imageId,n=o.pathname===`/prompts/new`&&o.searchStr.includes(`kind=${g.page}`);t&&o.pathname!==`/prompts/${t}`?a({to:`/prompts/$promptId`,params:{promptId:t}}):!t&&!n&&a({to:`/prompts/new`,search:{kind:g.page}})}g.page===`play`&&o.pathname!==`/play`&&a({to:`/play`});let t={home:`/`,channels:`/channels`,calendar:`/calendar`};if(g.page===`home`||g.page===`channels`||g.page===`calendar`){let e=t[g.page];o.pathname!==e&&a({to:e})}g.page===`project`&&e.projectId&&o.pathname!==`/projects/${e.projectId}`&&a({to:`/projects/$projectId`,params:{projectId:e.projectId}})},[_,g,e.step,e.articleId,e.imageId,e.projectId,o.pathname,o.searchStr,a]),(0,m.useEffect)(()=>{if(!_||g?.page!==`play`||o.pathname!==`/play`)return;let e=!0;return f(null),i.navigate(uk[g.id]).then(()=>{e&&f(g.id)}),()=>{e=!1}},[_,g,o.pathname,i.navigate]),(0,m.useEffect)(()=>{o.pathname===`/prompts`&&(g?.id===`image-prompt`&&e.imageId?n(e=>({...e,step:ok.findIndex(e=>e.id===`play-options`)})):(g?.id===`article-save`&&e.articleId||g?.id===`image-save`&&e.imageId)&&n(e=>({...e,step:e.step+1})))},[o.pathname,g?.id,e.articleId,e.imageId,n]),!_||!g||g.page===`play`&&(d!==g.id||i.section!==uk[g.id]))return null;let v=c.data?.providers??[],y=e=>v.some(t=>t.family===e&&XA(t)),b=(l.data?.voices??[]).some(e=>v.some(t=>t.id===e.provider&&XA(t))),x={"text-key":y(`llm`),"audio-key":y(`tts`),"image-key":y(`image`),voice:b,"article-name":t.promptIsArticle===!0&&t.promptNamed===!0,"article-body":t.promptIsArticle===!0&&t.promptBodyReady===!0&&t.promptHasKeywords===!0,"article-keywords":t.promptHasKeywords===!0,"article-save":!1,"image-prompt":t.promptIsImage===!0&&t.promptSaveReady===!0&&t.promptHasKeywords===!0,"image-save":!1,"play-article":t.playArticleReady===!0,"play-audio":t.playAudioReady===!0,"play-images":t.playImagesReady===!0,"play-video":t.playVideoReady===!0,"play-subtitles":t.playSubtitlesReady===!0,"play-options":t.playOptionsReady===!0,"play-keywords":t.playKeywordsReady===!0,"play-start":!1},S=()=>n(e=>({...e,active:!1})),C=ok.findIndex(e=>e.id===sk),w=e.step===ok.length-1,T=()=>{w?S():g.id===`play-start`?n(e=>({...e,step:C})):n(e=>({...e,step:e.step+1}))},E=()=>n(t=>({...t,step:g.id===`home`&&e.projectId===void 0?ok.findIndex(e=>e.id===`play-start`):t.step-1})),D=u.data?SA(u.data.project.config):`video`,O=g.id===`download`&&D===`article`?`project-article`:g.id===`play-keywords`&&t.playHasKeywords===!1?`play-options`:g.id===`studio-prep`&&D!==`video`?`project-controls`:g.target,k=g.id===`article-save`||g.id===`image-save`,A=(g.page===`article`||g.page===`image`)&&t.promptSaving===!0;return(0,h.jsxs)(yde,{stepId:g.id,target:`[data-tour="${O}"]`,title:g.title,progress:`${e.step+1} of ${ok.length} · First project`,onClose:S,...e.step===0||g.id===`project`||A?{}:{onBack:E},onNext:T,nextDisabled:A||x[g.id]===!1,nextLabel:k?`Use Save in the editor`:g.id===`play-start`?`Use Start run / Queue N on the page`:w?`Finish tutorial`:`Next`,...A?{}:{onSkip:T},skipLabel:g.id===`play-start`?`Skip generating`:k?`Skip without saving`:`Skip this step`,children:[(0,h.jsx)(Tde,{step:g.id,output:D}),c.error||l.error?(0,h.jsx)(`p`,{className:`text-danger`,children:c.error?.message??l.error?.message}):null]})}var ZA=J({schemaVersion:Vw(1),active:Mw(),stepId:Y([`text-key`,`audio-key`,`image-key`,`voice`,`article-name`,`article-body`,`article-keywords`,`article-save`,`image-prompt`,`image-save`,`play-options`,`play-article`,`play-keywords`,`play-audio`,`play-images`,`play-video`,`play-subtitles`,`play-start`,`project`,`download`,`run-cost`,`studio-prep`,`home`,`channels`,`calendar`]),articleId:G().optional(),imageId:G().optional(),projectId:G().optional()}).strict();J({baseVersion:K().int().nonnegative(),mutationId:kw(),session:ZA}).strict();var QA=J({version:K().int().nonnegative(),session:ZA,readable:Mw()}).strict();async function Dde(e){let t=await R(await e.client.tutorial.$get()),n=QA.safeParse(t);return n.success?n.data:{version:0,readable:!1,session:{schemaVersion:1,active:!1,stepId:`text-key`}}}async function Ode(e,t){return QA.parse(await R(await e.client.tutorial.$put({json:t})))}async function kde(e){let t=await e.client.tutorial.$delete();if(!t.ok)throw await fo(t)}function Ade(){let{api:e}=V(),[t,n]=(0,m.useState)({active:!1,step:0}),[r,i]=(0,m.useState)(null),a=(0,m.useMemo)(()=>{let t={active:!1,step:0},r=0,a=!1,o=!1,s=0,c=!0,l=!1,u=!1,d=null,f=[],p=[],m=e=>i(e instanceof Error?e.message:`Your tutorial progress wasn't saved. You can keep going; it will try again on the next step.`),h=async()=>{if(!u&&a&&c){u=!0;try{for(;d||p.length>0;){if(!d){let e=p.shift();if(!e)break;let t=ok[e.step];if(!t)throw Error(`This tutorial step isn't recognised. Choose Restart tutorial to start over.`);let{step:n,...i}=e;d={baseVersion:r,mutationId:crypto.randomUUID(),session:{...i,schemaVersion:1,stepId:t.id}}}r=(await Ode(e,d)).version,d=null}i(null)}catch(e){m(e)}finally{u=!1}}},g=e=>{if(!a){f.push(e);return}let r=typeof e==`function`?e(t):e;r!==t&&(t=r,n(t),p.push(t),h())},_=()=>{if(!a){l=!0;return}if(!c){i(`Saved tutorial progress cannot be read. Choose Restart tutorial to recover.`);return}g({active:!0,step:0})},v=async()=>{if(o||a)return;o=!0;let u=s;try{let o=await Dde(e);if(u!==s)return;if(r=o.version,c=o.readable,c||(a=!0),!c){i(`Saved tutorial progress cannot be read. Choose Restart tutorial to recover.`);return}let{schemaVersion:d,stepId:p,...m}=o.session;if(t={active:m.active,step:lk(p)??0,...m.articleId===void 0?{}:{articleId:m.articleId},...m.imageId===void 0?{}:{imageId:m.imageId},...m.projectId===void 0?{}:{projectId:m.projectId}},t.articleId||t.imageId){let{prompts:n}=await Ls(e),{articleId:r,imageId:i,...a}=t;t={...a,...r!==void 0&&n.some(e=>e.id===r&&e.kind===`article`)?{articleId:r}:{},...i!==void 0&&n.some(e=>e.id===i&&e.kind===`image`)?{imageId:i}:{}}}if(t.projectId&&await jo(e,t.projectId),u!==s)return;a=!0,n(t);for(let e of f.splice(0))g(e);l&&_(),i(null)}catch(e){u===s&&m(e)}finally{o=!1}},y=async()=>{if(!u){u=!0,s++,f.length=0,l=!1;try{await kde(e),r=0,c=!0,a=!0,d=null,p.length=0,t={active:!0,step:0},n(t),p.push(t),i(null)}catch(e){m(e)}finally{u=!1}await h()}};return{update:g,start:_,restore:v,retry:()=>{a?h():v()},restart:()=>{y()}}},[e]);return(0,m.useEffect)(()=>{a.restore()},[a]),{session:t,update:a.update,start:a.start,retry:a.retry,restart:a.restart,error:r}}var $A=(0,m.createContext)(void 0);function jde({children:e}){let{session:t,update:n,start:r,retry:i,restart:a,error:o}=Ade(),[s,c]=(0,m.useState)({}),l=(0,m.useCallback)(e=>{c(t=>Object.entries(e).every(([e,n])=>t[e]===n)?t:{...t,...e})},[]),u=(0,m.useCallback)(e=>{c(t=>Object.fromEntries(Object.entries(t).filter(([t])=>!e.includes(t))))},[]),d=(0,m.useCallback)(e=>{n(t=>ck(t,e))},[n]),f=ok[t.step]?.id,p=t.active&&(f===`project`||f===`download`)?f:void 0,g=(0,m.useMemo)(()=>({active:t.active,projectId:t.projectId,projectStep:p,start:r,report:l,clear:u,event:d}),[t.active,t.projectId,p,r,l,u,d]);return(0,h.jsxs)($A.Provider,{value:g,children:[e,o?(0,h.jsxs)(`div`,{role:`alert`,className:`fixed bottom-4 left-4 z-[100] rounded-media border border-line bg-surface p-4 text-ink`,children:[(0,h.jsx)(`p`,{children:o}),(0,h.jsx)(B,{type:`button`,onClick:i,children:`Retry tutorial save`}),(0,h.jsx)(B,{type:`button`,onClick:a,children:`Restart tutorial`})]}):null,t.active?(0,h.jsx)(Ede,{session:t,progress:s,update:n}):null]})}function ej(){return(0,m.useContext)($A)}function tj(e){let t=(0,m.useContext)($A),n=t?.report,r=t?.clear,i=(0,m.useRef)(e);i.current=e,(0,m.useEffect)(()=>{n?.(e)},[n,e]),(0,m.useEffect)(()=>()=>{r?.(Object.keys(i.current))},[r])}function nj(){let e=(0,m.useContext)($A);return(0,m.useCallback)(t=>{e?.event(t)},[e?.event])}function Mde(e){let t=(0,m.useContext)($A);return t?.projectId===e?t.projectStep:void 0}function Nde(){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Pde,{}),(0,h.jsx)(Ide,{}),tk.map(e=>(0,h.jsx)(Rde,{id:e.id,label:e.label},e.id)),(0,h.jsx)(zde,{})]})}function Pde(){let e=Ji(),t=qy(),n=t=>()=>{e({to:t})};return Xy({id:`nav.home`,title:`Open home`,group:`Go to`,shortcut:ek.goHome,run:n(`/`)}),Xy({id:`nav.channels`,title:`Open channels`,group:`Go to`,run:n(`/channels`),keywords:[`cast`,`brand`],shortcut:ek.goChannels}),Xy({id:`nav.schedules`,title:`Open schedules`,group:`Go to`,run:()=>{e({to:`/calendar`,search:{tab:`schedules`}})},keywords:[`calendar`,`topics`],shortcut:ek.goSchedules}),Xy({id:`channel.all`,title:`Show all channels`,group:`Channel`,run:()=>t.setChannelId(null),keywords:[`switch`,`filter`]}),Xy({id:`create.video`,title:`Create`,group:`Create`,run:n(`/play`),keywords:[`new project`,`play`,`make`,`start`],shortcut:ek.newVideo}),Xy({id:`nav.projects`,title:`Open projects`,group:`Go to`,shortcut:ek.goProjects,run:n(`/projects`)}),Xy({id:`nav.calendar`,title:`Open calendar`,group:`Go to`,run:n(`/calendar`),keywords:[`schedules`],shortcut:ek.goCalendar}),Xy({id:`nav.library`,title:`Open library`,group:`Go to`,run:n(`/prompts`),keywords:[`prompts`,`templates`],shortcut:ek.goLibrary}),Xy({id:`nav.settings`,title:`Open settings`,group:`Go to`,run:n(`/settings`),shortcut:ek.goSettings}),Xy({id:`nav.tutorials`,title:`Open tutorials`,group:`Go to`,run:()=>{e({to:`/help/tutorials/$page`,params:{page:`Home`}})},keywords:[`help`,`guide`,`wiki`,`docs`,`how`]}),Xy({id:`nav.usage`,title:`Open usage and costs`,group:`Go to`,run:()=>{e({to:`/settings`,search:{section:`usage`}})},keywords:[`cost`,`limits`]}),null}function Fde({id:e,name:t}){let n=qy();return Xy({id:`channel.${e}`,title:`Switch to ${t}`,group:`Channel`,run:()=>n.setChannelId(e),keywords:[`channel`,`switch`,`filter`]}),null}function Ide(){let e=qy();return(0,h.jsx)(h.Fragment,{children:e.channels.map(e=>(0,h.jsx)(Fde,{id:e.id,name:e.name},e.id))})}var Lde={general:[`appearance`,`theme`,`dark`,`light`,`start at login`,`autostart`],providers:[`api keys`,`sign in`,`openai`,`gemini`,`claude`,`codex`],voices:[`voice id`,`elevenlabs`,`tts`],agents:[`mcp`,`claude code`,`codex`,`agent`],playback:[`pace`,`loudness`,`volume`,`narration`],notifications:[`webhook`,`ntfy`,`alerts`],studio:[`extension`,`playlist`,`youtube`],storage:[`export`,`import`,`disk`,`space`],backups:[`daily copy`,`restore`],trash:[`deleted`,`restore`,`undelete`],usage:[`costs`,`spending`,`limits`,`money`],"patch-notes":[`changelog`,`what's new`,`version`],about:[`licence`,`version`,`github`]};function Rde({id:e,label:t}){let n=Ji();return Xy({id:`settings.section.${e}`,title:`Open Settings: ${t}`,group:`Settings`,keywords:[`settings`,...Lde[e]??[]],searchOnly:!0,run:()=>{n({to:`/settings`,search:{section:e}})}}),null}function zde(){let e=Ji(),t=ej(),n=wv();return Xy({id:`help.welcome`,title:`Open the welcome screen`,group:`Help`,keywords:[`welcome`,`getting started`,`samples`,`first run`,`onboarding`,`intro`],searchOnly:!0,run:()=>{e({to:`/welcome`})}}),Xy({id:`help.tutorial`,title:`Start the interactive tutorial`,group:`Help`,keywords:[`tour`,`guide`,`walkthrough`,`first video`,`learn`,`help`],searchOnly:!0,run:()=>{t!==void 0&&(t.active?n(`The interactive tutorial is already running.`,`info`):t.start())}}),null}var rj,Bde=/^\/projects\/[^/]+/,Vde=/^\/channels\/([^/]+)$/;function Hde(e,t,n){if(!Bde.test(e)){if(e===`/projects`)rj={to:`/projects`,search:t,label:`Projects`};else if(e===`/`)rj={to:`/`,search:{},label:`Home`};else if(e===`/calendar`)rj={to:`/calendar`,search:t,label:`Calendar`};else{let r=Vde.exec(e)?.[1];rj=r===void 0?void 0:{to:e,search:t,label:n(decodeURIComponent(r))??`Channel`}}}}var Ude={to:`/projects`,search:{},label:`Projects`};function Wde(){return rj??Ude}function Gde(e){let t=Va({select:e=>e.pathname}),n=Va({select:e=>e.search}),r=qy().channels;(0,m.useEffect)(()=>{Av(Mv(t))},[t]),(0,m.useEffect)(()=>{Hde(t,n,e=>r.find(t=>t.id===e)?.name)},[t,n,r]);let i=(0,m.useRef)(!0);(0,m.useEffect)(()=>{if(i.current){i.current=!1;return}let t=requestAnimationFrame(()=>{let t=e.current;if(t===null||document.activeElement?.closest(`[role="dialog"]`))return;let n=t.querySelector(`h1`)??t;n.hasAttribute(`tabindex`)||n.setAttribute(`tabindex`,`-1`),n.focus({preventScroll:!0})});return()=>cancelAnimationFrame(t)},[t,e])}function Kde(e,t){if(t===`system`){e.removeAttribute(`data-theme`);return}e.setAttribute(`data-theme`,t)}function qde(){let{api:e}=V(),t=I(my(e)).data?.appearance??`system`;return(0,m.useEffect)(()=>{Kde(document.documentElement,t)},[t]),null}var ij=`slopify.draft.`;function aj(){try{return typeof window>`u`?void 0:window.localStorage}catch{return}}function oj(e,t){let n=(()=>{try{return aj()?.getItem(ij+e)??null}catch{return null}})();if(n!==null)try{let e=JSON.parse(n);if(typeof e!=`object`||!e)return;let r=`value`in e?e.value:void 0,i=`base`in e?e.base:void 0,a=`savedAt`in e?e.savedAt:void 0;return typeof i!=`string`||typeof a!=`string`||!t(r)?void 0:{value:r,base:i,savedAt:a}}catch{return}}function sj(e,t,n,r=new Date){try{let i=aj();return i!==void 0&&(i.setItem(ij+e,JSON.stringify({value:t,base:n,savedAt:r.toISOString()})),!0)}catch{return!1}}function cj(e){try{aj()?.removeItem(ij+e)}catch{}}function lj(){try{let e=aj();if(e===void 0)return 0;let t=0;for(let n=0;n<e.length;n+=1)e.key(n)?.startsWith(ij)===!0&&(t+=1);return t}catch{return 0}}var uj=new Set;function dj(e){return uj.add(e),()=>{uj.delete(e)}}function fj(){for(let e of uj)try{e()}catch{}return lj()}var pj=!1;function mj(){return pj=!0,fj()}function hj(){return pj}function gj({reload:e}){let{version:t}=V(),n=(0,m.useSyncExternalStore)(t.subscribe,t.staleAt,t.staleAt),r=n!==void 0,[i,a]=(0,m.useState)(0);(0,m.useEffect)(()=>{r&&a(fj())},[r]);let o=`This tab was loaded before the update. Version ${n??``} is running now; reload to catch up.`;return(0,h.jsx)(zv,{open:r,dismissible:!1,title:`Slopify was updated`,description:i===0?o:`${o} Your unsaved ${i===1?`edit is`:`edits are`} kept in this browser and offered back when you open ${i===1?`it`:`them`} again after the reload.`,footer:(0,h.jsx)(B,{autoFocus:!0,variant:`primary`,onClick:()=>{mj(),e()},children:`Reload`})})}var _j=[`stage.state`,`stage.progress`,`article.delta`,`llm.preview`,`image.landed`,`narration.piece`,`project.state`,`project.updated`,`review.flagged`,`review.auto-passed`],vj=[`running.count`,`staging.progress`,`staging.failed`,`project.updated`,`project.state`,`schedule.topics`,`review.flagged`,`review.auto-passed`,`stage.state`,`stage.progress`];function yj(e,t,n){return xj(e,t,_j,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`||e.type===`review.auto-passed`){n.refetch();return}n.patch(e),e.type===`stage.state`&&n.refetch()}})}function bj(e,t,n){return xj(e,t,vj,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),e.type===`stage.state`&&n.stageState?.(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}if(e.type===`review.auto-passed`){n.reviewAutoPassed?.(e),n.refetch(e.projectId);return}n.stagingChanged()},n.connection)}function xj(e,t,n,r,i,a){let o=e(t),s=!1;o.addEventListener(`open`,()=>{s&&r(),s=!0,a?.(`open`)}),a!==void 0&&o.addEventListener(`error`,()=>a(`lost`));for(let e of n)o.addEventListener(e,t=>{let n=Sj(t.data);n.type===e&&i(n)});return()=>{o.close()}}function Sj(e){return JSON.parse(e)}var Cj=(0,m.createContext)(void 0);function wj({children:e}){let[t,n]=(0,m.useState)(()=>new Map),r=(0,m.useCallback)((e,t)=>{n(n=>{let r=n.get(e),i=typeof t==`function`?t(r):t;if(r===i)return n;let a=new Map(n);return i===void 0?a.delete(e):a.set(e,i),a})},[]),i=(0,m.useMemo)(()=>({prompts:t,updatePrompt:r}),[t,r]);return(0,h.jsx)(Cj.Provider,{value:i,children:e})}function Tj(e){let t=(0,m.useContext)(Cj),[n,r]=(0,m.useState)(void 0),i=t?.updatePrompt,a=(0,m.useCallback)(t=>{i?i(e,t):r(t)},[e,i]);return[t?t.prompts.get(e):n,a]}function Ej(e){return e.trim()===``?NaN:Number(e)}function Dj(){let e=aA(),t=(0,m.useRef)(e);t.current=e;let n=e.document.form,r=t=>{if(!t)return;let n=e.view?.attachments.find(e=>e.id===t.attachmentId),r=n?.state===`ready`&&n.stagedFileId?{id:n.stagedFileId,stageKind:n.kind===`reference`?`images`:n.kind,path:n.stagedFileId,originalFilename:n.name,bytes:n.bytes,state:`staged`,createdAt:e.view?.draft.createdAt??``}:void 0;return{key:t.attachmentId,name:t.name,file:r,error:n?.error??(n?.state===`reattach`||!r&&!e.attachmentUploading(t.attachmentId)?`Reattach this file`:void 0)}},i={...n,sources:{...n.sources,document:wb(n.sources,`document`)},document:{theme:wD(n.document),...n.document?.custom===void 0?{}:{custom:n.document.custom}},imagePrompts:n.imagePrompts.map(e=>({...e,number:Number(e.number)})),chunking:n.chunking.mode===`words`?{mode:`words`,...n.chunking.words===``?{}:{words:Number(n.chunking.words)}}:n.chunking.mode===`characters`?{mode:`characters`,...n.chunking.characters===``?{}:{characters:Number(n.chunking.characters)}}:{mode:n.chunking.mode},subtitles:{...n.subtitles,fontSize:Number(n.subtitles.fontSize)},imageSeconds:Ej(n.imageSeconds),edgeSilenceSeconds:Ej(n.edgeSilenceSeconds),zoomPercent:Ej(n.zoomPercent),provided:{research:n.provided.research,article:n.provided.article,audio:r(n.provided.audio),thumbnail:r(n.provided.thumbnail),...n.provided.reference===void 0?{}:{reference:r(n.provided.reference)},shortsMusic:r(n.provided.shortsMusic),ambientBed:r(n.provided.ambientBed),images:n.provided.images.flatMap(e=>{let t=r(e);return t?[t]:[]})}},a=(0,m.useRef)(i);return a.current=i,[i,(0,m.useCallback)(e=>{let n=t.current.document,r=typeof e==`function`?e(a.current):e;a.current=r;let i=(e,t)=>e===void 0?``:Object.is(e,Number(t))?t:String(e),o=e=>e?{attachmentId:e.key,name:e.name}:null,{document:s,...c}=r.sources,{document:l,...u}=r,{shortsMusic:d,ambientBed:f}=r.provided,p=n.form.sources.document!==void 0||s!==`off`,m=n.form.document!==void 0||l.theme!==wD(n.form.document)||l.custom!==void 0;t.current.edit({...n,form:{...u,sources:p?r.sources:c,...m?{document:l}:{},imagePrompts:r.imagePrompts.map(e=>({...e,number:i(e.number,n.form.imagePrompts.find(t=>t.name===e.name)?.number??String(e.number))})),chunking:{...n.form.chunking,mode:r.chunking.mode,...r.chunking.mode===`words`?{words:i(r.chunking.words,n.form.chunking.words)}:{},...r.chunking.mode===`characters`?{characters:i(r.chunking.characters,n.form.chunking.characters)}:{}},subtitles:{...n.form.subtitles,...r.subtitles,fontSize:i(r.subtitles.fontSize,n.form.subtitles.fontSize)},imageSeconds:Object.is(r.imageSeconds,Ej(n.form.imageSeconds))?n.form.imageSeconds:String(r.imageSeconds),edgeSilenceSeconds:Object.is(r.edgeSilenceSeconds,Ej(n.form.edgeSilenceSeconds))?n.form.edgeSilenceSeconds:String(r.edgeSilenceSeconds),zoomPercent:Object.is(r.zoomPercent,Ej(n.form.zoomPercent))?n.form.zoomPercent:String(r.zoomPercent),provided:{research:r.provided.research,article:r.provided.article,audio:o(r.provided.audio),thumbnail:o(r.provided.thumbnail),...r.provided.reference===void 0&&n.form.provided.reference===void 0?{}:{reference:o(r.provided.reference)},images:r.provided.images.map(e=>({attachmentId:e.key,name:e.name})),...d!==void 0||n.form.provided.shortsMusic!==void 0?{shortsMusic:o(d)}:{},...f!==void 0||n.form.provided.ambientBed!==void 0?{ambientBed:o(f)}:{}}}})},[])]}function Oj(e,t){if((e===`running`||e===`pending`)&&(e!==`pending`||t!==`pending`))switch(t){case`done`:return`ready`;case`partial`:return`partial`;case`failed`:return`failed`;case`pending`:return`waiting`;default:return}}var kj={article:`the article`,images:`an image`,narration:`the narration`,thumbnail:`the thumbnail`,shorts:`a short`};function Aj(e){let t=e.title.trim()===``?`Untitled project`:e.title.trim(),n=Lj(e.reason),r=kj[e.stage]??`an item`,i=`Review needs a decision: ${t}`;return{headline:`${n===void 0?i:`${i} — ${n}`}${e.byAgent===!0?` · by agent`:``}`,detail:`${e.byAgent===!0?`An agent's review`:`The automatic review`} flagged ${r} and kept it. Open the project and press Overrule to keep it or Redo to make it again.`}}function jj(e){return{headline:`Passed without review: no agent answered in 2 h`,detail:`${e.title.trim()===``?`Untitled project`:e.title.trim()}: ${e.item??kj[e.stage]??`an item`} went ahead unreviewed. Open the project to look at it, or check that your agent's routine is running.`}}function Mj(e){return e.filter(e=>e.state===`failed`).map(e=>({id:xb(e.kind,e.finishedAt),kind:e.kind,...e.failureReason===null?{}:{reason:e.failureReason}}))}function Nj(e,t,n){let r=t.failures??[],i=r.filter(e=>!n.has(e.id)),a=[],o=[];if(`kind`in e){let{kind:n}=e;!(n===`failed`&&r.length>0&&i.length===0)&&Fj(n,t)&&a.push({kind:n,reason:r[0]?.reason}),n===`waiting`&&t.stepFailedWhileWaiting===!0&&(o=i)}else t.status===`running`&&t.stepFailedWhileWaiting===!0&&(o=i.filter(t=>t.kind===e.stepFailed));o.length>0&&a.push({kind:`step-failed`,reason:o[0]?.reason});let s=a.some(e=>e.kind===`failed`||e.kind===`partial`);return{notices:a,told:new Set(r.filter(e=>s||n.has(e.id)||o.includes(e)).map(e=>e.id)),news:o.map(e=>e.id)}}function Pj(e,t){return e&&t.some(e=>e.waitsFor===`day`)}function Fj(e,t){return e!==`waiting`||t.waitingForAgent!==!0&&t.atItsDay!==!0}var Ij=140;function Lj(e){let t=e?.split(/\r?\n/).map(e=>e.trim()).find(e=>e!==``);if(t!==void 0)return t.length<=Ij?t:`${t.slice(0,139).trimEnd()}…`}function Rj(e,t){let n=zj(e,t);return t.startedBy===`agent`?{...n,headline:`${n.headline} · started by agent`}:n}function zj(e,t){let n=t.title.trim()===``?`Untitled project`:t.title.trim();switch(e){case`ready`:return t.makesVideo?{headline:`Video ready: ${n}`,detail:`Open the project to watch it.`}:{headline:`Run finished: ${n}`,detail:`Open the project to see its files.`};case`partial`:{let e=Lj(t.reason),r=t.makesVideo?`Video ready with problems: ${n}`:`Run finished with problems: ${n}`;return{headline:e===void 0?r:`${r} — ${e}`,detail:`Open the project to see which step failed and the button that fixes it.`}}case`failed`:{let e=Lj(t.reason);return{headline:e===void 0?`Run failed: ${n}`:`Run failed: ${n} — ${e}`,detail:`Open the project to see what stopped it and press Retry.`}}case`step-failed`:{let e=Lj(t.reason);return{headline:e===void 0?`Step failed: ${n}`:`Step failed: ${n} — ${e}`,detail:`The run still waits on another step, so it isn't over. Open the project to see which step failed and press Retry.`}}case`waiting`:return{headline:`Waiting for you: ${n}`,detail:`Open the project to review the held step or press Continue the run.`}}}function Bj(e){let t=e.scheduleName.trim()===``?`Untitled schedule`:e.scheduleName.trim(),n=e.added,r=e.waiting>n?` ${String(e.waiting)} are waiting in all.`:``;return{headline:`${String(n)} new ${n===1?`topic is`:`topics are`} waiting for you`,detail:`Open Calendar → Suggested topics → ${t} to queue or reject ${n===1?`it`:`them`}.${r}`}}var Vj=`slopify.notifications.browser`,Hj=`slopify.notifications.sent`,Uj=`slopify.notifications.told`,Wj=6e4,Gj=new Set;function Kj(){return typeof window<`u`&&`Notification`in window}function qj(){return Kj()?Notification.permission:`unsupported`}function Jj(){try{return window.localStorage.getItem(Vj)===`on`}catch{return!1}}function Yj(e){try{e?window.localStorage.setItem(Vj,`on`):window.localStorage.removeItem(Vj)}catch{}for(let e of Gj)e()}function Xj(e){Gj.add(e);let t=t=>{t.key===Vj&&e()};return window.addEventListener(`storage`,t),()=>{Gj.delete(e),window.removeEventListener(`storage`,t)}}function Zj(){return Jj()&&qj()===`granted`}function Qj(e){if(e===`unsupported`)return`This browser can't show notifications. Use a current Chrome, Edge, Firefox or Safari, or set a Notification URL below instead.`;if(e===`denied`)return`Notifications are blocked for this site. Allow them in your browser's site settings (the icon left of the address bar), reload, then turn Browser notifications on again.`}async function $j(){return Kj()?Notification.permission==="default"?await Notification.requestPermission():Notification.permission:`unsupported`}async function eM(e,t=Date.now){let n=()=>{let n={};try{let e=JSON.parse(window.localStorage.getItem(Hj)??`{}`);typeof e==`object`&&e&&(n=Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`number`&&t()-e[1]<Wj)))}catch{}if(n[e]!==void 0)return!1;try{window.localStorage.setItem(Hj,JSON.stringify({...n,[e]:t()}))}catch{}return!0};try{if(typeof navigator<`u`&&navigator.locks!==void 0)return await navigator.locks.request(`slopify-run-notification`,n)}catch{}return n()}function tM(){try{let e=JSON.parse(window.localStorage.getItem(Uj)??`{}`);return typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).flatMap(([e,t])=>Array.isArray(t)?[[e,t.filter(e=>typeof e==`string`)]]:[]))}catch{return{}}}function nM(e){try{window.localStorage.setItem(Uj,JSON.stringify(e))}catch{}}var rM={read:e=>new Set(tM()[e]??[]),write:(e,t)=>{let{[e]:n,...r}=tM();nM(t.size===0?r:{...r,[e]:[...t]})},keep:e=>{let t=tM();Object.keys(t).every(t=>e.has(t))||nM(Object.fromEntries(Object.entries(t).filter(([t])=>e.has(t))))}};function iM(e,t){let n=new Notification(e.text.headline,{body:e.text.detail,tag:`slopify-run-${e.projectId}`});n.onclick=()=>{window.focus(),t(e.projectId),n.close()}}function aM(e,t){let n=new Notification(e.text.headline,{body:e.text.detail,tag:`slopify-topics-${e.scheduleId}`});n.onclick=()=>{window.focus(),t(),n.close()}}function oM(e,t){let n=e.title.trim()===``?`Untitled project`:e.title.trim(),r=new Notification(`Started: ${n}${e.byAgent===!0?` · by agent`:``}`,{body:`Slopify is working on it. You'll hear a different chime when it ends.`,tag:`slopify-run-${e.projectId}`});r.onclick=()=>{window.focus(),t(e.projectId),r.close()}}var sM=`slopify.notifications.sound`,cM=new Set;function lM(){try{return window.localStorage.getItem(sM)!==`off`}catch{return!0}}function uM(e){try{e?window.localStorage.removeItem(sM):window.localStorage.setItem(sM,`off`)}catch{}for(let e of cM)e()}function dM(e){cM.add(e);let t=t=>{t.key===sM&&e()};return window.addEventListener(`storage`,t),()=>{cM.delete(e),window.removeEventListener(`storage`,t)}}var fM={start:[[784,0,.16],[1175,.14,.3]],end:[[1047,0,.18],[1319,.16,.18],[1568,.32,.55]]};function pM(){if(typeof window<`u`&&typeof window.AudioContext==`function`)try{return new window.AudioContext}catch{return}}function mM(){let e=pM();e!==void 0&&e.resume().catch(()=>{}).finally(()=>void e.close().catch(()=>{}))}function hM(e){let t=pM();t!==void 0&&(async()=>{t.state!==`running`&&await Promise.race([t.resume().catch(()=>{}),new Promise(e=>setTimeout(e,400))]);let n=gM(t,e);setTimeout(()=>void t.close().catch(()=>{}),(n+.5)*1e3)})()}function gM(e,t){let n=e.currentTime+.02,r=e.createDynamicsCompressor();r.threshold.value=-3,r.ratio.value=12,r.connect(e.destination);for(let[i,a,o]of fM[t])for(let[t,s,c]of[[1,.9,`sine`],[2,.25,`triangle`]]){let l=e.createOscillator(),u=e.createGain();l.type=c,l.frequency.value=i*t,u.gain.setValueAtTime(1e-4,n+a),u.gain.exponentialRampToValueAtTime(s,n+a+.012),u.gain.exponentialRampToValueAtTime(1e-4,n+a+o),l.connect(u).connect(r),l.start(n+a),l.stop(n+a+o+.05)}return Math.max(...fM[t].map(([,e,t])=>e+t))}var _M=`slopify.away.snapshot`;function vM(e,t,n){let r=new Set(t.filter(e=>e.status!==`done`).map(e=>e.id)),i=(n?.stepFailures??[]).filter(e=>r.has(e.slice(0,e.indexOf(` `))));return{at:e,states:Object.fromEntries(t.map(e=>[e.id,e.status])),waiting:Object.fromEntries(t.filter(yA).map(e=>[e.id,bM(e).join(`,`)])),stepFailures:[...new Set([...i,...t.flatMap(yM)])]}}function yM(e){return(e.stepFailures??[]).map(t=>`${e.id} ${t}`)}function bM(e){if(e.status===`paused`)return[`paused@${String(e.pauseCount??0)}`];if(e.stopped===!0)return[`stopped@${String(e.stopCount??0)}`];let t=(e.holding??[]).filter(e=>e.waitsFor===`person`).map(e=>`${e.checkpointId}:${e.fingerprint}`);return t.length===0?[`held`]:t}function xM(e,t){let n=e===void 0?[]:e.split(`,`);return t.some(e=>!n.includes(e))}function SM(e,t){let n=0,r=0,i=0,a=0;for(let o of t){a+=yM(o).filter(t=>!e.stepFailures.includes(t)).length;let t=e.states[o.id]!==o.status;t&&(o.status===`done`||o.status===`partial`)?n+=1:t&&o.status===`failed`?r+=1:yA(o)&&xM(e.waiting[o.id],bM(o))&&(i+=1)}return{finished:n,failed:r,waiting:i,stepsFailed:a}}function CM(e){let t=[e.finished>0?`${String(e.finished)} ${e.finished===1?`run finished`:`runs finished`}`:void 0,e.failed>0?`${String(e.failed)} ${e.failed===1?`run failed`:`runs failed`}`:void 0,e.stepsFailed>0?`${String(e.stepsFailed)} ${e.stepsFailed===1?`step failed`:`steps failed`} beside a wait`:void 0,e.waiting>0?`${String(e.waiting)} ${e.waiting===1?`run waits`:`runs wait`} for you`:void 0].filter(e=>e!==void 0);if(t.length!==0)return`While you were away: ${t.join(`, `)}.`}function wM(){try{let e=JSON.parse(window.localStorage.getItem(_M)??`null`);if(typeof e==`object`&&e&&`at`in e&&typeof e.at==`number`&&`states`in e&&typeof e.states==`object`&&e.states!==null&&`waiting`in e&&typeof e.waiting==`object`&&e.waiting!==null&&!Array.isArray(e.waiting)&&`stepFailures`in e&&Array.isArray(e.stepFailures))return{at:e.at,states:Object.fromEntries(Object.entries(e.states).flatMap(([e,t])=>{let n=Sb.find(e=>e===t);return n===void 0?[]:[[e,n]]})),waiting:Object.fromEntries(Object.entries(e.waiting).filter(e=>typeof e[1]==`string`)),stepFailures:e.stepFailures.filter(e=>typeof e==`string`)}}catch{}}function TM(e){try{window.localStorage.setItem(_M,JSON.stringify(e))}catch{}}var EM=3e4;function DM(){let{api:e}=V(),t=_(),n=wv(),r=Ji(),i=(0,m.useRef)(r);i.current=r,(0,m.useEffect)(()=>{let r=!1,a=async()=>(await t.fetchQuery({...iy(e),staleTime:0})).projects,o=async()=>{try{let e=await a();r||TM(vM(Date.now(),e,wM()))}catch{}},s=async()=>{let e=wM();if(e===void 0||Date.now()-e.at<12e4){await o();return}try{let t=await a();if(r)return;let o=CM(SM(e,t));TM(vM(Date.now(),t,e)),o!==void 0&&n(o,`info`,{label:`Open Home`,run:()=>void i.current({to:`/`})})}catch{}},c=()=>{document.visibilityState===`visible`?s():o()};document.visibilityState===`visible`&&s();let l=window.setInterval(()=>{document.visibilityState===`visible`&&o()},EM);return document.addEventListener(`visibilitychange`,c),()=>{r=!0,window.clearInterval(l),document.removeEventListener(`visibilitychange`,c)}},[e,t,n])}function OM(){let e=new Map;return{read:t=>e.get(t)??new Set,write:(t,n)=>{n.size===0?e.delete(t):e.set(t,n)},keep:t=>{for(let n of e.keys())t.has(n)||e.delete(n)}}}var kM=new Set([`done`,`partial`,`failed`,`canceled`]);function AM(e){let t=new Map,n=new Set,r=new Set,i=()=>e.sounds?.()===!0&&e.play!==void 0,a=new Set,o=t=>{let n=t.catch(t=>{e.report(t)}).finally(()=>{a.delete(n)});a.add(n)},s=e.told??OM(),c=async(t,n)=>{let r=await e.subject(t);if(r===void 0)return;let a=Nj(n,r,s.read(t));s.write(t,a.told);let o=[];for(let r of a.notices)await e.claim(r.kind===`step-failed`?`${t}:step-failed:${a.news.join(`,`)}`:`${t}:${`state`in n?n.state:``}`)&&o.push(r);if(o.length>0&&i()&&e.play?.(`end`),e.enabled())for(let n of o)e.show({projectId:t,kind:n.kind,text:Rj(n.kind,{...r,reason:n.reason})})},l=async t=>{let n=await e.subject(t);n!==void 0&&await e.claim(`${t}:started`)&&(i()&&e.play?.(`start`),e.enabled()&&e.showStart?.({projectId:t,title:n.title,...n.startedBy===`agent`?{byAgent:!0}:{}}))};return{observe:r=>{let a=t.get(r.projectId);if(t.set(r.projectId,r.state),a===r.state)return;let s=e.enabled()||i();if(r.state===`running`&&!n.has(r.projectId)){n.add(r.projectId),(i()||e.enabled()&&e.showStart!==void 0)&&o(l(r.projectId));return}kM.has(r.state)&&n.delete(r.projectId);let u=Oj(a,r.state);u!==void 0&&s&&o(c(r.projectId,{kind:u,state:r.state}))},observeStage:t=>{t.state===`failed`&&(e.enabled()||i())&&o(c(t.projectId,{stepFailed:t.stage}))},observeTopics:t=>{if(t.added<=0||!e.enabled()||e.showTopics===void 0)return;let n=e.showTopics;o((async()=>{await e.claim(`topics:${t.scheduleId}:${String(t.waiting)}`)&&n({scheduleId:t.scheduleId,text:Bj(t)})})())},observeReview:t=>{if(!e.enabled()||e.showReview===void 0)return;let n=e.showReview;o((async()=>{let r=await e.subject(t.projectId);r!==void 0&&await e.claim(`review:${t.verdictId}`)&&n({projectId:t.projectId,text:Aj({title:r.title,stage:t.stage,reason:t.reason,...t.byAgent===!0?{byAgent:!0}:{}})})})())},observeAutoPass:t=>{if(r.has(t.reviewId)||!e.enabled()||e.showReview===void 0)return;r.add(t.reviewId);let n=e.showReview;o((async()=>{let r=await e.subject(t.projectId);r!==void 0&&await e.claim(`auto-pass:${t.reviewId}`)&&n({projectId:t.projectId,text:jj({title:r.title,stage:t.stage,item:t.item})})})())},seed:async()=>{try{let r=await e.seed();s.keep(new Set(r.filter(e=>e.status!==`done`).map(e=>e.id)));for(let e of r)t.has(e.id)||(t.set(e.id,e.status),(e.status===`running`||e.status===`paused`)&&n.add(e.id))}catch(t){e.report(t)}},settled:async()=>{for(;a.size>0;)await Promise.all([...a])}}}async function jM(e,t){let n=await jo(e,t),r=Mj(n.stages);return{title:n.project.title,makesVideo:n.project.config.sources.video!==`off`,startedBy:n.startedBy??null,waitingForAgent:n.project.waitingForAgent===!0,status:n.project.status,atItsDay:Pj(n.project.prepared===!0,n.holding),...ide(n.project.status,n.stages)?{stepFailedWhileWaiting:!0}:{},...r.length===0?{}:{failures:r}}}function MM(){let{api:e}=V(),t=_(),n=Ji(),r=(0,m.useRef)(n);r.current=n,DM();let i=(0,m.useMemo)(()=>AM({enabled:Zj,sounds:lM,play:hM,showStart:e=>{oM(e,e=>{r.current({to:`/projects/$projectId`,params:{projectId:e}})})},seed:async()=>(await t.fetchQuery({...iy(e),staleTime:5e3})).projects,subject:t=>jM(e,t),claim:e=>eM(e),told:rM,showTopics:e=>{aM(e,()=>{r.current({to:`/calendar`})})},showReview:e=>{iM(e,e=>{r.current({to:`/projects/$projectId`,params:{projectId:e}})})},show:e=>{iM(e,e=>{r.current({to:`/projects/$projectId`,params:{projectId:e}})})},report:e=>{console.warn(`Slopify couldn't show a run notification.`,e)}}),[e,t]);return(0,m.useEffect)(()=>{let e=()=>Zj()||lM();e()&&i.seed();let t=()=>{e()&&i.seed()},n=Xj(t),r=dM(t);return window.addEventListener(`pointerdown`,mM,{once:!0}),window.addEventListener(`keydown`,mM,{once:!0}),()=>{n(),r(),window.removeEventListener(`pointerdown`,mM),window.removeEventListener(`keydown`,mM)}},[i]),i}function NM({open:e,title:t,onClose:n,children:r,footer:i,width:a=`wide`,headingRef:o,className:s}){let c=(0,m.useId)(),l=(0,m.useRef)(null),u=o??l,d=(0,m.useRef)(null),f=(0,m.useRef)(null),p=(0,m.useRef)(n);return(0,m.useEffect)(()=>{p.current=n}),(0,m.useEffect)(()=>{if(!e)return;d.current=document.activeElement,f.current?.contains(document.activeElement)||u.current?.focus({preventScroll:!0});let t=e=>{e.key!==`Escape`||e.defaultPrevented||document.querySelector(`[data-slot="dialog-content"][data-state="open"]`)||p.current()};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t);let e=d.current;e instanceof HTMLElement&&e.isConnected&&e.focus({preventScroll:!0})}},[e,u]),e?(0,h.jsxs)(`aside`,{ref:f,role:`dialog`,"aria-modal":`false`,"aria-labelledby":c,"data-slot":`drawer`,className:z(`fixed top-0 right-0 bottom-0 z-50 flex w-full flex-col border-l border-line bg-raised shadow-[var(--shadow-dialog)]`,a===`wide`?`sm:w-[min(560px,100vw)]`:`sm:w-[min(440px,100vw)]`,`data-[state=open]:animate-tick-in motion-reduce:animate-none`,s),"data-state":`open`,children:[(0,h.jsxs)(`div`,{className:`flex min-h-12 shrink-0 items-center gap-3 border-b border-line px-4`,children:[(0,h.jsx)(`h2`,{ref:u,id:c,tabIndex:-1,className:`min-w-0 flex-1 truncate text-title-3 font-semibold focus-visible:outline-offset-[-2px]`,children:t}),(0,h.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`Close`,className:`inline-flex size-8 items-center justify-center rounded-control text-ink-2 hover:bg-raised hover:text-ink`,children:(0,h.jsx)(kl,{"aria-hidden":`true`,className:`size-4`})})]}),(0,h.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4`,children:r}),i?(0,h.jsx)(`div`,{className:`flex min-h-14 shrink-0 flex-wrap items-center gap-2 border-t border-line px-4 py-2 pb-[max(8px,env(safe-area-inset-bottom))]`,children:i}):null]}):null}var PM=[`patch-notes`];function FM(e){return at({queryKey:PM,queryFn:async()=>R(await e.client[`patch-notes`].$get()),staleTime:1/0})}function IM(e,t){return at({queryKey:[...PM,t],queryFn:async()=>lo(await e.client[`patch-notes`][`:id`].$get({param:{id:t}})),staleTime:1/0})}async function LM(e){await R(await e.client[`patch-notes`].seen.$post())}var RM={3:[{id:`home`,title:`Home`,body:`What is running and at which step, what is coming up, what needs you and what is ready to upload, on one screen.`,to:`/`,place:`Home`},{id:`play`,title:`Play's one path`,body:`Pick a template, type the topic, press Start. Everything else stays folded away until it needs you.`,to:`/play`,place:`Play`},{id:`reviews`,title:`Automatic reviews`,body:`A reviewer model checks the article, images, narration, thumbnail and shorts, and can send a failed item back to be made again. Turn it on in Play's Review step.`,to:`/play`,place:`Play`},{id:`channels`,title:`Channels and cast`,body:`A channel keeps its brand kit, series brief, templates and schedules, and a cast of characters and places that look the same in every video.`,to:`/channels`,place:`Channels`},{id:`memory`,title:`Episodes that remember`,body:`Each finished episode leaves a short summary on its channel's Episodes tab, and a new article reads the related ones. Add your existing video titles on Existing videos, and topic suggestions skip them too.`,to:`/channels`,place:`Channels`},{id:`calendar`,title:`The calendar`,body:`The coming weeks of uploads on one screen: what is ready, what needs you, and the topics still to come. Its Schedules tab holds every schedule.`,to:`/calendar`,place:`Calendar`},{id:`run-cost`,title:`What a run cost`,body:`Every project has a Run cost tab with the real cost per stage and model. Totals for all projects are in Settings, Usage.`,to:`/settings`,search:{section:`usage`},place:`Usage`},{id:`studio`,title:`YouTube Studio prep`,body:`Slopify never uploads. Prepare upload on a finished project lists everything Studio asks for, and the browser extension can fill it in for you.`,to:`/settings`,search:{section:`studio`},place:`YouTube Studio settings`},{id:`voices`,title:`Multiple voices`,body:`Audiobooks, podcasts, radio drama and interviews, with a voice per speaker. Pick the format under Audio, Speakers on Play.`,to:`/play`,place:`Play`},{id:`long-videos`,title:`Long videos stay watchable`,body:`More images for long videos sets images per hour or one every few minutes, with pan and zoom variety. An ambient bed of rain, fire, wind or your own file can play under the narration. Both are on Play; a channel's brand kit can set the ambient sound for all its videos.`,to:`/play`,place:`Play`},{id:`languages`,title:`Other languages`,body:`A project can be made in another language: pick it on Play, and the article, narration and description are written in it.`,to:`/play`,place:`Play`},{id:`trash`,title:`A trash bin`,body:`Deleted projects, prompts, templates and schedules stay in Settings, Trash for 30 days, and Restore brings them back.`,to:`/settings`,search:{section:`trash`},place:`Trash`}]},zM=[`whats-new`];async function BM(e){return R(await e.client[`whats-new`].$get())}function VM(e){return at({queryKey:zM,queryFn:()=>BM(e),staleTime:1/0})}async function HM(e){return R(await e.client[`whats-new`].seen.$post())}function UM(){let{api:e}=V(),t=_(),n=ej(),r=I(sy(e)),i=I({...VM(e),enabled:r.data?.seen===!0}),[a,o]=(0,m.useState)(0),s=L({mutationFn:()=>HM(e),onSuccess:e=>{t.setQueryData(zM,e),t.setQueryData(PM,e=>e===void 0?e:{...e,due:null})}}),c=i.data?.major,l=c==null?void 0:RM[c],u=l!==void 0&&a>=l.length-1,d=I({...FM(e),enabled:i.data?.show===!0&&u}).data?.current??void 0;if(i.data?.show!==!0||l===void 0||n?.active===!0)return null;let f=l[Math.min(a,l.length-1)];if(f===void 0)return null;let p=l.indexOf(f),g=p===l.length-1,v=()=>{s.mutate()};return(0,h.jsx)(NM,{open:!0,width:`narrow`,title:`What's new in ${String(c)}.0`,onClose:v,footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(B,{variant:`quiet`,disabled:s.isPending,onClick:v,children:`Close tour`}),(0,h.jsx)(`span`,{className:`flex-1`}),(0,h.jsx)(B,{disabled:p===0,disabledReason:`This is the first step`,onClick:()=>{o(p-1)},children:`Back`}),(0,h.jsx)(B,{variant:`primary`,disabled:s.isPending,onClick:()=>{g?v():o(p+1)},children:g?`Finish tour`:`Next`})]}),children:(0,h.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,h.jsx)(`p`,{className:`m-0 text-label text-ink-3`,children:`${String(p+1)} of ${String(l.length)}`}),(0,h.jsx)(`h3`,{className:`m-0 text-title-3`,children:f.title}),(0,h.jsx)(`p`,{className:`m-0 text-ink-2`,children:f.body}),(0,h.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,h.jsx)(LO,{to:f.to,...f.search===void 0?{}:{search:f.search},children:`Open ${f.place}`}),g?(0,h.jsx)(RO,{to:`/settings`,search:{section:`patch-notes`,...d===void 0?{}:{note:d}},onClick:v,children:`Read the full patch notes`}):null]}),s.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:`Slopify could not save that you closed this tour: ${s.error.message} Press Close tour to try again.`})]})})}var WM={danger:(0,h.jsx)(Sl,{"aria-hidden":`true`,strokeWidth:1.75}),waiting:(0,h.jsx)(Fc,{"aria-hidden":`true`,strokeWidth:1.75}),info:(0,h.jsx)(el,{"aria-hidden":`true`,strokeWidth:1.75})};function GM({tone:e=`info`,title:t,children:n,actions:r,className:i}){return(0,h.jsxs)(`div`,{role:e===`danger`?`alert`:`status`,"data-tone":e,className:z(`sl-callout`,e!==`info`&&`sl-callout--${e}`,i),children:[WM[e],(0,h.jsx)(`span`,{className:`sl-callout__title`,children:t}),n===void 0?null:(0,h.jsx)(`div`,{className:`sl-callout__body`,children:n}),r===void 0?null:(0,h.jsx)(`div`,{className:`sl-callout__actions`,children:r})]})}function KM(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var qM=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,JM=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,YM={};function XM(e,t){return((t||YM).jsx?JM:qM).test(e)}var ZM=/[ \t\n\f\r]/g;function QM(e){return typeof e==`object`?e.type===`text`&&$M(e.value):$M(e)}function $M(e){return e.replace(ZM,``)===``}var eN=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};eN.prototype.normal={},eN.prototype.property={},eN.prototype.space=void 0;function tN(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new eN(n,r,t)}function nN(e){return e.toLowerCase()}var rN=class{constructor(e,t){this.attribute=t,this.property=e}};rN.prototype.attribute=``,rN.prototype.booleanish=!1,rN.prototype.boolean=!1,rN.prototype.commaOrSpaceSeparated=!1,rN.prototype.commaSeparated=!1,rN.prototype.defined=!1,rN.prototype.mustUseProperty=!1,rN.prototype.number=!1,rN.prototype.overloadedBoolean=!1,rN.prototype.property=``,rN.prototype.spaceSeparated=!1,rN.prototype.space=void 0;var iN=s({boolean:()=>oN,booleanish:()=>sN,commaOrSpaceSeparated:()=>fN,commaSeparated:()=>dN,number:()=>lN,overloadedBoolean:()=>cN,spaceSeparated:()=>uN}),aN=0,oN=pN(),sN=pN(),cN=pN(),lN=pN(),uN=pN(),dN=pN(),fN=pN();function pN(){return 2**++aN}var mN=Object.keys(iN),hN=class extends rN{constructor(e,t,n,r){let i=-1;if(super(e,t),gN(this,`space`,r),typeof n==`number`)for(;++i<mN.length;){let e=mN[i];gN(this,mN[i],(n&iN[e])===iN[e])}}};hN.prototype.defined=!0;function gN(e,t,n){n&&(e[t]=n)}function _N(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new hN(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[nN(r)]=r,n[nN(a.attribute)]=r}return new eN(t,n,e.space)}var vN=_N({properties:{ariaActiveDescendant:null,ariaAtomic:sN,ariaAutoComplete:null,ariaBusy:sN,ariaChecked:sN,ariaColCount:lN,ariaColIndex:lN,ariaColSpan:lN,ariaControls:uN,ariaCurrent:null,ariaDescribedBy:uN,ariaDetails:null,ariaDisabled:sN,ariaDropEffect:uN,ariaErrorMessage:null,ariaExpanded:sN,ariaFlowTo:uN,ariaGrabbed:sN,ariaHasPopup:null,ariaHidden:sN,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:uN,ariaLevel:lN,ariaLive:null,ariaModal:sN,ariaMultiLine:sN,ariaMultiSelectable:sN,ariaOrientation:null,ariaOwns:uN,ariaPlaceholder:null,ariaPosInSet:lN,ariaPressed:sN,ariaReadOnly:sN,ariaRelevant:null,ariaRequired:sN,ariaRoleDescription:uN,ariaRowCount:lN,ariaRowIndex:lN,ariaRowSpan:lN,ariaSelected:sN,ariaSetSize:lN,ariaSort:null,ariaValueMax:lN,ariaValueMin:lN,ariaValueNow:lN,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function yN(e,t){return t in e?e[t]:t}function bN(e,t){return yN(e,t.toLowerCase())}var xN=_N({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:dN,acceptCharset:uN,accessKey:uN,action:null,allow:null,allowFullScreen:oN,allowPaymentRequest:oN,allowUserMedia:oN,alpha:oN,alt:null,as:null,async:oN,autoCapitalize:null,autoComplete:uN,autoFocus:oN,autoPlay:oN,blocking:uN,capture:null,charSet:null,checked:oN,cite:null,className:uN,closedBy:null,colorSpace:null,cols:lN,colSpan:lN,command:null,commandFor:null,content:null,contentEditable:sN,controls:oN,controlsList:uN,coords:lN|dN,crossOrigin:null,data:null,dateTime:null,decoding:null,default:oN,defer:oN,dir:null,dirName:null,disabled:oN,download:cN,draggable:sN,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:oN,formTarget:null,headers:uN,height:lN,hidden:cN,high:lN,href:null,hrefLang:null,htmlFor:uN,httpEquiv:uN,id:null,imageSizes:null,imageSrcSet:null,inert:oN,inputMode:null,integrity:null,is:null,isMap:oN,itemId:null,itemProp:uN,itemRef:uN,itemScope:oN,itemType:uN,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:oN,low:lN,manifest:null,max:null,maxLength:lN,media:null,method:null,min:null,minLength:lN,multiple:oN,muted:oN,name:null,nonce:null,noModule:oN,noValidate:oN,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:oN,optimum:lN,pattern:null,ping:uN,placeholder:null,playsInline:oN,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:oN,referrerPolicy:null,rel:uN,required:oN,reversed:oN,rows:lN,rowSpan:lN,sandbox:uN,scope:null,scoped:oN,seamless:oN,selected:oN,shadowRootClonable:oN,shadowRootCustomElementRegistry:oN,shadowRootDelegatesFocus:oN,shadowRootMode:null,shadowRootSerializable:oN,shape:null,size:lN,sizes:null,slot:null,span:lN,spellCheck:sN,src:null,srcDoc:null,srcLang:null,srcSet:null,start:lN,step:null,style:null,tabIndex:lN,target:null,title:null,translate:null,type:null,typeMustMatch:oN,useMap:null,value:sN,width:lN,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:uN,axis:null,background:null,bgColor:null,border:lN,borderColor:null,bottomMargin:lN,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:oN,declare:oN,event:null,face:null,frame:null,frameBorder:null,hSpace:lN,leftMargin:lN,link:null,longDesc:null,lowSrc:null,marginHeight:lN,marginWidth:lN,noResize:oN,noHref:oN,noShade:oN,noWrap:oN,object:null,profile:null,prompt:null,rev:null,rightMargin:lN,rules:null,scheme:null,scrolling:sN,standby:null,summary:null,text:null,topMargin:lN,valueType:null,version:null,vAlign:null,vLink:null,vSpace:lN,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:oN,disablePictureInPicture:oN,disableRemotePlayback:oN,exportParts:dN,part:uN,prefix:null,property:null,results:lN,security:null,unselectable:null},space:`html`,transform:bN}),SN=_N({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:fN,accentHeight:lN,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:lN,amplitude:lN,arabicForm:null,ascent:lN,attributeName:null,attributeType:null,azimuth:lN,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:lN,by:null,calcMode:null,capHeight:lN,className:uN,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:lN,diffuseConstant:lN,direction:null,display:null,dur:null,divisor:lN,dominantBaseline:null,download:oN,dx:null,dy:null,edgeMode:null,editable:null,elevation:lN,enableBackground:null,end:null,event:null,exponent:lN,externalResourcesRequired:null,fill:null,fillOpacity:lN,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:dN,g2:dN,glyphName:dN,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:lN,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:lN,horizOriginX:lN,horizOriginY:lN,id:null,ideographic:lN,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:lN,k:lN,k1:lN,k2:lN,k3:lN,k4:lN,kernelMatrix:fN,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:lN,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:lN,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:lN,overlineThickness:lN,paintOrder:null,panose1:null,path:null,pathLength:lN,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:uN,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:lN,pointsAtY:lN,pointsAtZ:lN,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:fN,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:fN,rev:fN,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:fN,requiredFeatures:fN,requiredFonts:fN,requiredFormats:fN,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:lN,specularExponent:lN,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:lN,strikethroughThickness:lN,string:null,stroke:null,strokeDashArray:fN,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:lN,strokeOpacity:lN,strokeWidth:null,style:null,surfaceScale:lN,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:fN,tabIndex:lN,tableValues:null,target:null,targetX:lN,targetY:lN,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:fN,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:lN,underlineThickness:lN,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:lN,values:null,vAlphabetic:lN,vMathematical:lN,vectorEffect:null,vHanging:lN,vIdeographic:lN,version:null,vertAdvY:lN,vertOriginX:lN,vertOriginY:lN,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:lN,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:yN}),CN=_N({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),wN=_N({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:bN}),TN=_N({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),EN={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},DN=/[A-Z]/g,ON=/-[a-z]/g,kN=/^data[-\w.:]+$/i;function AN(e,t){let n=nN(t),r=t,i=rN;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&kN.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(ON,MN);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!ON.test(e)){let n=e.replace(DN,jN);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=hN}return new i(r,t)}function jN(e){return`-`+e.toLowerCase()}function MN(e){return e.charAt(1).toUpperCase()}var NN=tN([vN,xN,CN,wN,TN],`html`),PN=tN([vN,SN,CN,wN,TN],`svg`);function FN(e){return e.join(` `).trim()}var IN=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
|
|
104
|
+
`);function ale(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||t<=0?1:Math.max(1,Math.ceil(e/t-.001))}function oE(e){let t=e=>e===void 0||e.trim()===``?void 0:Number(e),n=t(e.musicVolume),r=t(e.speed),i=e.fullVideoLink?.trim()??``;return{...e.titleOnScreen===void 0?{}:{titleOnScreen:e.titleOnScreen},...i===``?{}:{fullVideoLink:i},...n===void 0?{}:{musicVolume:n},...r===void 0?{}:{speed:r}}}function ole(e){return{...e?.titleOnScreen===void 0?{}:{titleOnScreen:e.titleOnScreen},...e?.fullVideoLink===void 0?{}:{fullVideoLink:e.fullVideoLink},...e?.musicVolume===void 0?{}:{musicVolume:String(e.musicVolume)},...e?.speed===void 0?{}:{speed:e.speed.toFixed(2)}}}function sle(e){let t=[],n=(e,t,n)=>Number.isInteger(e)&&e>=t&&e<=n;n(e.count,1,10)||t.push({field:`count`,message:`Enter a whole number of shorts between 1 and 10.`});for(let r of[`minSeconds`,`maxSeconds`])n(e[r],15,180)||t.push({field:r,message:`Enter a whole number of seconds between 15 and 180.`});if(t.every(e=>e.field===`count`)&&e.minSeconds>e.maxSeconds)for(let e of[`minSeconds`,`maxSeconds`])t.push({field:e,message:`The longest a short may be must be at least the shortest. Raise the maximum or lower the minimum.`});let r=e.speed;r!==void 0&&(!Number.isFinite(r)||r<.999999999||r>1.250000001||Math.abs((r-1)/.05-Math.round((r-1)/.05))>1e-6)&&t.push({field:`speed`,message:`Choose a speed between 1.00× and 1.25×, in steps of 0.05.`}),e.musicVolume!==void 0&&!n(e.musicVolume,0,100)&&t.push({field:`musicVolume`,message:`Enter the music volume as a whole number of percent between 0 and 100.`});let i=e.fullVideoLink?.trim()??``;return i!==``&&!cle(i)&&t.push({field:`fullVideoLink`,message:`The full video link must be a whole web address starting with https:// or http://, like https://youtu.be/abc123. Paste it again, or leave the box empty.`}),t}function cle(e){if(e.length>2e3||/\s/.test(e))return!1;try{let t=new URL(e);return(t.protocol===`https:`||t.protocol===`http:`)&&t.hostname!==``}catch{return!1}}var sE=[`rain`,`fire`,`wind`],cE=[...sE,`upload`],lle={rain:`Rain`,fire:`Fireplace`,wind:`Wind`,upload:`My own file`},lE={levelDb:-18,fadeInSeconds:3,tailSeconds:6};function ule(e){return e.ambientBed!==void 0&&e.mode!==`short`&&e.sources.video===`generate`&&e.sources.audio!==`off`}function uE(e){let t=[];return cE.includes(e.source)||t.push({field:`source`,message:`Choose Rain, Fireplace, Wind or My own file for the ambient sound.`}),Number.isInteger(e.levelDb)&&e.levelDb>=-40&&e.levelDb<=-6||t.push({field:`level`,message:`Enter an ambient sound level between -40 and -6 dB, in whole dB.`}),dE(e.fadeInSeconds,30)||t.push({field:`fadeIn`,message:`Enter a fade-in between 0 and 30 seconds, in steps of 0.5.`}),dE(e.tailSeconds,30)||t.push({field:`tail`,message:`Enter a tail between 0 and 30 seconds, in steps of 0.5.`}),t}function dE(e,t){return Number.isInteger(e*2)&&e>=0&&e<=t}function fE(e){return{source:e.source,level:String(e.levelDb),fadeIn:String(e.fadeInSeconds),tail:String(e.tailSeconds)}}function pE(e){if(e===void 0||e.source===`none`)return;let t=e=>e.trim()===``?NaN:Number(e);return{source:e.source,levelDb:t(e.level),fadeInSeconds:t(e.fadeIn),tailSeconds:t(e.tail)}}var mE=[`interval`,`narration`],hE=[`cut`,`crossfade`,`fadeblack`,`slide`,`wipe`],gE=[`off`,`subtle`,`strong`],_E=[`none`,`warm`,`cold`,`desaturated`,`sepia`],vE=[`none`,`embers`,`dust`,`fog`],yE=[`off`,`chapters`,`every`],bE={cuts:`interval`,transition:`cut`,transitionSeconds:.6,vignette:`off`,grain:`off`,grade:`none`,atmosphere:`none`,chapterCards:!1,animate:`off`,animateEvery:3,animateModel:``},dle={...bE,cuts:`narration`},fle=.2,ple=[.2,.4,.6,.8,1,1.2,1.5,2],xE={interval:`Every N seconds`,narration:`Follow the narration`},SE={cut:`Cut`,crossfade:`Crossfade`,fadeblack:`Fade through black`,slide:`Slide`,wipe:`Wipe`},CE={off:`Off`,subtle:`Subtle`,strong:`Strong`},wE={none:`None`,warm:`Warm fantasy`,cold:`Cold`,desaturated:`Desaturated`,sepia:`Sepia`},TE={none:`None`,embers:`Embers`,dust:`Dust`,fog:`Fog`},EE={off:`Off`,chapters:`Chapter openers`,every:`Every Nth image`};function DE(e){return e.videoEdit??bE}function OE(e){let t=DE(e);return t.animate!==`off`&&e.sources.video===`generate`&&(t.animate===`every`||e.sources.audio!==`off`)}function mle(e){let t=e.videoEdit;if(t===void 0||e.sources.video!==`generate`)return[];let n=[];return t.transition!==`cut`&&!(Number.isFinite(t.transitionSeconds)&&t.transitionSeconds>=.2&&t.transitionSeconds<=2)&&n.push({field:`transitionSeconds`,message:`Choose a transition length between ${String(fle)} and 2 seconds.`}),t.chapterCards&&e.sources.audio===`off`&&n.push({field:`chapterCards`,message:`Chapter cards are placed from the narration. Turn narration on, or turn chapter cards off.`}),t.animate===`chapters`&&e.sources.audio===`off`&&n.push({field:`animate`,message:`Chapter openers are found from the narration. Turn narration on, or choose Every Nth image.`}),t.animate===`every`&&!(Number.isInteger(t.animateEvery)&&t.animateEvery>=2&&t.animateEvery<=10)&&n.push({field:`animateEvery`,message:`Choose every 2nd to every 10th image.`}),t.animate!==`off`&&t.animateModel.trim()===``&&n.push({field:`animateModel`,message:`Choose an image-to-video model to animate images with, or turn Animate images off.`}),n}function kE(e){return[[`Cuts`,xE[e.cuts]],[`Transition`,e.transition===`cut`?SE.cut:`${SE[e.transition]} · ${String(e.transitionSeconds)} s`],[`Vignette`,CE[e.vignette]],[`Film grain`,CE[e.grain]],[`Colour grade`,wE[e.grade]],[`Atmosphere`,TE[e.atmosphere]],[`Chapter cards`,e.chapterCards?`On`:`Off`],[`Animate images`,e.animate===`off`?EE.off:`${e.animate===`every`?`Every ${(e=>e===2?`2nd`:e===3?`3rd`:`${String(e)}th`)(e.animateEvery)} image`:EE.chapters}${e.animateModel.trim()===``?``:` · ${e.animateModel}`}`]]}var AE=[`audiobook`,`podcast`,`drama`,`interview`],jE={audiobook:`Audiobook`,podcast:`Podcast`,drama:`Radio drama`,interview:`Interview`},ME=[`narrator`,`host`,`guest`,`character`],hle=[`script`,`attribute`,`adapt`],NE=[.8,.9,1,1.1,1.2],PE=[0,.2,.35,.5,.8,1.2],gle=.35,_le=J({provider:G(),model:G(),voice:G()}),vle=J({id:G().min(1).max(60).regex(/^[a-z0-9-]+$/),name:G().max(40),role:Y(ME),voice:_le,pace:K().optional(),pronunciations:G().max(2e4).optional(),castId:G().max(200).optional(),portrait:G().regex(/^[0-9a-f]{64}$/).optional()}),FE=9999,yle=J({title:G().max(200),chapter:K()}).strict().readonly();function IE(e){return`${e.title.trim()} · Chapter ${String(e.chapter)}`}var LE=J({format:Y(AE),source:Y(hle),speakers:q(vle).max(10),turnGapSeconds:K(),nameTags:Mw(),nativeDialogue:Mw(),audioFiles:Mw(),book:yle.optional()});function RE(e,t=[]){return{format:e,source:`script`,speakers:ble(e,xle(e),t),turnGapSeconds:gle,nameTags:e===`podcast`||e===`interview`,nativeDialogue:!0,audioFiles:!0}}function ble(e,t,n){if(n.length===0||e!==`podcast`&&e!==`interview`)return[...t];let r=n.slice(0,9).map(e=>({...e,role:`host`})),i=e===`podcast`?t.slice(0,Math.max(0,2-r.length)):t.filter(e=>e.role!==`host`);return[...r,...i.filter(e=>!r.some(t=>t.id===e.id))]}function xle(e){let t={provider:``,model:``,voice:``},n=(e,n,r)=>({id:e,name:n,role:r,voice:t});switch(e){case`audiobook`:return[n(`narrator`,`Narrator`,`narrator`)];case`podcast`:return[n(`host-1`,`Alex`,`host`),n(`host-2`,`Sam`,`host`)];case`drama`:return[n(`narrator`,`Narrator`,`narrator`),n(`character-1`,`Mara`,`character`)];case`interview`:return[n(`host-1`,`Host`,`host`),n(`guest-1`,`Guest`,`guest`)]}}function zE(e){return e.voices!==void 0&&e.sources.audio===`generate`}function BE(e){return zE(e)&&e.voices?.source===`script`}function Sle(e){let t=[],{speakers:n}=e;n.length===0&&t.push({field:`voices.speakers`,message:`Add at least one speaker under Speakers (Play → Narration, or Edit project → Providers).`}),e.source===`attribute`&&e.format!==`audiobook`&&t.push({field:`voices.source`,message:`Only audiobooks can hand an existing text's dialogue to speakers. Choose Write a script under Speakers (Play → Narration, or Edit project → Providers).`}),(e.format===`podcast`||e.format===`interview`)&&n.length<2&&t.push({field:`voices.speakers`,message:`A ${jE[e.format].toLowerCase()} needs at least two speakers. Add one under Speakers (Play → Narration, or Edit project → Providers).`}),(e.format===`audiobook`||e.format===`drama`)&&!n.some(e=>e.role===`narrator`)&&t.push({field:`voices.speakers`,message:`An ${e.format===`drama`?`radio drama`:`audiobook`} needs a narrator. Set one speaker's role to Narrator under Speakers (Play → Narration, or Edit project → Providers).`});let r=new Set,i=new Set;for(let[e,a]of n.entries()){let n=`voices.speakers.${String(e)}`,o=a.name.trim();o===``?t.push({field:`${n}.name`,message:`Enter a name for this speaker.`}):/^[\p{L}\p{N}][\p{L}\p{N} .'-]*$/u.test(o)?r.has(o.toLowerCase())&&t.push({field:`${n}.name`,message:`Two speakers are called "${o}". Give each speaker a different name.`}):t.push({field:`${n}.name`,message:`Use only letters, numbers, spaces, dots, apostrophes and hyphens in a speaker name, starting with a letter or number.`}),r.add(o.toLowerCase()),i.has(a.id)&&t.push({field:`${n}.name`,message:`Two speakers share one id. Remove one of them and add it again.`}),i.add(a.id),a.voice.provider.trim()===``||a.voice.model.trim()===``?t.push({field:`${n}.voice`,message:`Choose a voice provider and model for ${o||`this speaker`}.`}):a.voice.voice.trim()===``&&t.push({field:`${n}.voice.voice`,message:`Choose a voice for ${o||`this speaker`}.`}),a.pace!==void 0&&!NE.includes(a.pace)&&t.push({field:`${n}.pace`,message:`Pick a pace from the list for ${o||`this speaker`}.`})}return e.book!==void 0&&(e.book.title.trim()===``&&t.push({field:`voices.book.title`,message:`Enter the book's title under Speakers (Play → Narration), or remove the book to make a project on its own.`}),(!Number.isInteger(e.book.chapter)||e.book.chapter<1||e.book.chapter>9999)&&t.push({field:`voices.book.chapter`,message:`Enter a chapter number from 1 to ${String(FE)} under Speakers (Play → Narration).`})),PE.includes(e.turnGapSeconds)||t.push({field:`voices.turnGapSeconds`,message:`Pick a gap between turns from the list under Speakers (Play → Narration, or Edit project → Providers).`}),t}function Cle(e){return e.mode===`short`}function wle(e){if(!Cle(e))return[];let t=[];e.format!==`9:16`&&t.push({field:`format`,message:`A short is vertical. Choose the 9:16 format, or make a long video instead.`}),wb(e.sources,`video`)!==`generate`&&t.push({field:`sources.video`,message:`A short is a video. Set Video to Generate.`}),wb(e.sources,`audio`)===`off`&&t.push({field:`sources.audio`,message:`A short's length and captions come from its narration. Set Narration to Generate or Provide.`}),wb(e.sources,`images`)===`off`&&t.push({field:`sources.images`,message:`A short shows images behind its captions. Set Images to Generate or Provide.`});for(let n of[`thumbnail`,`document`])wb(e.sources,n)!==`off`&&t.push({field:`sources.${n}`,message:`A short has no ${n===`thumbnail`?`thumbnail`:`PDF`}. Set ${n===`thumbnail`?`Thumbnail`:`Document`} to Off.`});return e.shorts?.enabled===!0&&t.push({field:`shorts.enabled`,message:`A short isn't cut into more shorts. Turn Shorts off.`}),t}var VE=22.5,HE=`zoom`,UE={zoom:`Zoom in and out`,pan:`Pan across`,mixed:`Mix of both`,still:`Still`};function WE(e){return Number.isInteger(e)&&e>=1&&e<=600?void 0:`Enter a whole number of seconds between 1 and 600.`}function Tle(e){return Number.isInteger(e*2)&&e>=0&&e<=50?void 0:`Enter a zoom between 0 and 50 percent, in steps of 0.5.`}function Ele(e){return Number.isInteger(e*2)&&e>=0&&e<=30?void 0:`Enter a number of seconds between 0 and 30, in steps of 0.5.`}var GE={research:[`off`,`generate`,`provide`],article:[`off`,`generate`,`provide`],audio:[`off`,`generate`,`provide`],images:[`off`,`generate`,`provide`],thumbnail:[`off`,`from_prompt`,`prompt_by_llm`,`provide`],video:[`off`,`generate`],document:[`off`,`generate`]};function Dle(e){let t=[],n=Ole(e.draft),{sources:r}=n;n.title===``?t.push({field:`title`,message:`Enter a title for this video.`}):n.title.length>200&&t.push({field:`title`,message:`Keep the title to 200 characters or fewer.`});for(let e of bb)GE[e].includes(wb(r,e))||t.push({field:`sources.${e}`,message:`"${wb(r,e)}" is not an option for ${e}. Reload the page and choose again.`});Nle(n)&&!$E(n.llm)&&t.push({field:`llm`,message:`Choose a text (LLM) provider and model.`}),r.article===`generate`&&qE(n.articlePrompt)&&t.push({field:`articlePrompt`,message:`Pick an article prompt.`});let i=n.audio;t.push(...Ple(n)),t.push(...Fle(n)),r.audio===`generate`&&(i===void 0||!$E(i)?t.push({field:`audio`,message:`Choose a narration provider and model.`}):i.voice.trim()===``&&t.push({field:`audio.voice`,message:`Choose a voice for the narration.`})),r.images===`generate`&&kle(n,t),(r.images===`generate`||r.thumbnail===`from_prompt`||r.thumbnail===`prompt_by_llm`||QE(n)||OE(n))&&!$E(n.images)&&t.push({field:`images`,message:`Choose an image provider and model.`}),(r.thumbnail===`from_prompt`||r.thumbnail===`prompt_by_llm`)&&qE(n.thumbnailPrompt)&&t.push({field:`thumbnailPrompt`,message:`Pick a thumbnail prompt.`}),r.audio===`off`&&n.subtitles!==void 0&&n.subtitles.mode!==`off`&&t.push({field:`subtitles.mode`,message:`Subtitles need narration. Turn narration on, or turn subtitles off.`}),t.push(...Ile(n)),t.push(...Rle(n)),t.push(...wle(n)),t.push(...zle(n)),t.push(...Ble(n,e.staged)),t.push(...Rce(n.loudness)),t.push(...Vce(n)),t.push(...Lle(n)),t.push(...Zce(n)),ZE(n)&&n.reference?.source===`provide`&&KE(e.staged,n.provided.reference,`images`,`provided.reference`,`Upload the establishing image, or set Establishing image to Off in the Images section.`,t),Ale(n,e.staged,t),Mle(n,e.requiredSlots,t),(!Number.isFinite(n.silenceGapSeconds)||n.silenceGapSeconds<0||n.silenceGapSeconds>30)&&t.push({field:`silenceGapSeconds`,message:`Enter a silence gap between 0 and 30 seconds.`});let a=r.video===`generate`?WE(n.imageSeconds):void 0;a!==void 0&&t.push({field:`imageSeconds`,message:a});let o=r.video===`generate`?Tle(n.zoomPercent):void 0;o!==void 0&&t.push({field:`zoomPercent`,message:o});let s=r.audio===`off`?void 0:Ele(n.edgeSilenceSeconds);return s!==void 0&&t.push({field:`edgeSilenceSeconds`,message:s}),t.length===0?{ok:!0,draft:n}:{ok:!1,fields:t}}function Ole(e){let t={...e.sources};t.article!==`generate`&&(t.research=`off`),t.images===`off`&&t.video===`generate`&&(t.video=`off`);let n=Object.create(null);for(let[t,r]of Object.entries(e.values))n[t]=r.trim();return{...e,title:e.title.trim(),subtitles:t.video===`off`&&e.subtitles?.mode===`burn-in`?{...e.subtitles,mode:`files`}:e.subtitles,sources:t,values:n,intro:t.audio===`generate`?e.intro:void 0,outro:t.audio===`generate`?e.outro:void 0}}function kle(e,t){if(e.imagePrompts.length===0){t.push({field:`imagePrompts`,message:`Tick at least one image prompt, or turn images off.`});return}let n=0;for(let[r,i]of e.imagePrompts.entries())n+=i.number,qE(i.name)&&t.push({field:`imagePrompts.${r}.name`,message:`Pick an image prompt.`}),(!Number.isInteger(i.number)||i.number<1||i.number>20)&&t.push({field:`imagePrompts.${r}.number`,message:`Enter a whole number between 1 and 20.`});n>60&&t.push({field:`imagePrompts`,message:`A video can have at most 60 images; these prompts ask for ${n}. Lower the numbers.`});let r=e.imageScale===void 0?void 0:Mce(e.imageScale);r!==void 0&&t.push({field:`imageScale`,message:r})}function Ale(e,t,n){let{sources:r,provided:i}=e;if(r.research===`provide`&&qE(i.research)&&n.push({field:`provided.research`,message:`Paste the text to adapt, or your research notes.`}),r.article===`provide`&&qE(i.article)&&n.push({field:`provided.article`,message:`Paste the article.`}),n.push(...Vle(e)),r.audio===`provide`&&KE(t,i.audio,`audio`,`provided.audio`,`Pick an audio file.`,n),r.thumbnail===`provide`&&KE(t,i.thumbnail,`thumbnail`,`provided.thumbnail`,`Pick a thumbnail image.`,n),r.images===`provide`){let e=i.images??[];e.length===0?n.push({field:`provided.images`,message:`Pick at least one image.`}):e.length>60&&n.push({field:`provided.images`,message:`A video can have at most 60 images. Remove some.`}),new Set(e).size!==e.length&&n.push({field:`provided.images`,message:`The same image is picked twice. Remove the duplicate.`});for(let[r,i]of e.entries())KE(t,i,`images`,`provided.images.${r}`,`Pick an image.`,n)}jle(e,t,n)}function jle(e,t,n){let r=e.provided.shortsMusic;if(e.shorts?.enabled!==!0||r===void 0)return;let i=`under Outputs → More shorts options → Background music`,a=t.find(e=>e.id===r);a===void 0||a.stageKind!==`audio`?n.push({field:`shorts.music`,message:`The shorts' background music file is no longer available, so it can't be added to the project. Choose the file again ${i}, or remove it.`}):a.state!==`staged`&&n.push({field:`shorts.music`,message:`The shorts' background music is still uploading, so the run can't start yet. Wait for it to finish, or remove it ${i}.`})}function KE(e,t,n,r,i,a){if(t===void 0||t===``){a.push({field:r,message:i});return}let o=e.find(e=>e.id===t);if(o===void 0||o.stageKind!==n){a.push({field:r,message:`That upload is no longer available. Choose the file again.`});return}o.state!==`staged`&&a.push({field:r,message:`This file is still uploading. Wait for it to finish.`})}function Mle(e,t,n){for(let r of t){let t=Object.hasOwn(e.values,r)?e.values[r]:void 0;if(t===void 0||t===``){n.push({field:`values.${r}`,message:`Fill in this field.`});continue}t.length>200&&n.push({field:`values.${r}`,message:`Keep this to 200 characters or fewer.`}),/[\n\r]/.test(t)&&n.push({field:`values.${r}`,message:`Keep this to a single line, without line breaks.`})}}function qE(e){return e===void 0||e.trim()===``}function JE(e){let t=e.sources,n=[];return t.research===`generate`&&n.push({section:`article`,label:`researching the topic`}),t.article===`generate`&&n.push({section:`article`,label:`writing the article`}),zE(e)&&e.voices?.source===`attribute`&&n.push({section:`narration`,label:`working out who speaks each line`}),zE(e)&&e.voices?.source===`adapt`&&n.push({section:`narration`,label:`rewriting the text as a conversation`}),YE(e)&&n.push({section:`narration`,label:`preparing the narration's delivery`}),e.intro?.mode===`llm`&&n.push({section:`narration`,label:`writing the intro`}),e.outro?.mode===`llm`&&n.push({section:`narration`,label:`writing the outro`}),t.thumbnail===`prompt_by_llm`&&n.push({section:`outputs`,label:`writing the thumbnail prompt`}),XE(e)&&n.push({section:`outputs`,label:`writing the YouTube description`}),QE(e)&&n.push({section:`outputs`,label:`picking the shorts`}),n}function Nle(e){return JE(e).length>0}function YE(e){return e.sources.audio===`generate`&&!qE(e.narrationPrompt)}function Ple(e){return YE(e)&&(e.audio?.provider!==`inworld`||e.audio.model!==`inworld-tts-2`)?[{field:`narrationPrompt`,message:`Narration preparation only works with the Inworld TTS-2 model. Choose that model under Narration, or turn preparation Off.`}]:[]}function Fle(e){if(e.voices===void 0||!zE(e))return[];let t=[...Sle(e.voices)];return!qE(e.narrationPrompt)&&!e.voices.speakers.some(e=>e.voice.provider===`inworld`&&e.voice.model===`inworld-tts-2`)&&t.push({field:`narrationPrompt`,message:`Narration preparation adds delivery cues only to speakers on Inworld's TTS-2 model, and no speaker uses it. Choose that model for a speaker under Speakers, or clear Narration Preparation under Narration → Audio Advanced.`}),t}function XE(e){return e.youtubeDescription===!0&&e.sources.audio!==`off`}function Ile(e){return e.youtubeDescription===!0&&e.sources.audio===`off`?[{field:`youtubeDescription`,message:`The YouTube description is timed from the narration. Turn narration on, or turn the YouTube description off.`}]:[]}function ZE(e){return e.reference!==void 0&&e.sources.images===`generate`}function Lle(e){return ZE(e)&&e.reference?.source===`prompt`&&(e.reference.prompt===void 0||e.reference.prompt.trim()===``)?[{field:`reference.prompt`,message:`Pick an image prompt for the establishing image, upload one instead, or set Establishing image to Off in the Images section.`}]:[]}function QE(e){return e.shorts?.enabled===!0&&e.sources.audio!==`off`}function Rle(e){let t=e.shorts;if(t?.enabled!==!0)return[];if(e.sources.audio===`off`)return[{field:`shorts.enabled`,message:`Shorts are cut from the narration. Turn narration on, or turn Shorts off.`}];let n=sle(t).map(e=>({field:`shorts.${e.field}`,message:e.message})),r=e.sources.video===`generate`?void 0:WE(e.imageSeconds);return r!==void 0&&n.push({field:`imageSeconds`,message:r}),n}function zle(e){return mle(e).map(e=>({field:`videoEdit.${e.field}`,message:e.message}))}function Ble(e,t){let n=e.ambientBed;if(n===void 0||!ule(e))return[];let r=`under Video and style → Ambient sound`,i=uE(n).map(e=>({field:`ambientBed.${e.field}`,message:`${e.message} Change it ${r}.`}));if(n.source!==`upload`)return i;let a=e.provided.ambientBed,o=a===void 0?void 0:t.find(e=>e.id===a);return o===void 0||o.stageKind!==`audio`?i.push({field:`ambientBed.file`,message:`The ambient sound's audio file is missing, so it can't be added to the project. Choose the file ${r}, or pick Rain, Fireplace or Wind instead.`}):o.state!==`staged`&&i.push({field:`ambientBed.file`,message:`The ambient sound's audio file is still uploading, so the run can't start yet. Wait for it to finish ${r}.`}),i}function $E(e){return e!==void 0&&e.provider.trim()!==``&&e.model.trim()!==``}function eD(e){return e.sources.audio===`generate`&&e.audio?.usePronunciationGlossary===!0&&e.audio.provider===`inworld`&&(e.audio.model===`inworld-tts-2`||e.audio.model===`inworld-tts-2-flash`)}function Vle(e){let{sources:t}=e;if(t.article!==`off`)return[];let n=`Set Article to Generate or Provide`;return[...t.audio===`generate`?[{field:`sources.audio`,message:`Narration reads the article, and Article is Off. ${n}, or set Narration to Off or Provide.`}]:[],...t.document===`generate`?[{field:`sources.document`,message:`The PDF is made from the article, and Article is Off. ${n}, or set PDF to Off.`}]:[],...t.thumbnail===`prompt_by_llm`?[{field:`sources.thumbnail`,message:`The AI writes the thumbnail prompt from the article, and Article is Off. ${n}, or pick From prompt for the thumbnail.`}]:[],...t.audio!==`off`&&e.subtitles!==void 0&&e.subtitles.mode!==`off`?[{field:`subtitles.mode`,message:`Captions are matched to the article's words, and Article is Off. ${n}, or turn captions off.`}]:[],...XE(e)?[{field:`youtubeDescription`,message:`The YouTube description is written from the narration's words, which come from the article, and Article is Off. ${n}, or turn the YouTube description off.`}]:[],...QE(e)?[{field:`shorts.enabled`,message:`Shorts are picked from the narration's words, which come from the article, and Article is Off. ${n}, or turn Shorts off.`}]:[],...t.images===`generate`&&e.imageScenes===!0?[{field:`imageScenes`,message:`Scenes from the article need the article, and Article is Off. ${n}, or turn Scenes from the article off.`}]:[]]}var tD=[`auto`,`yes`,`no`],nD={auto:`Automatic`,yes:`Always Yes`,no:`Always No`},rD={levelDb:K(),fadeInSeconds:K(),tailSeconds:K()},Hle=J({source:Y(cE),...rD}).strict(),Ule=J({source:Y(sE),...rD}).strict(),iD=`Previous video`,aD=2e3,Wle=/\{\{([^{}\n]{1,80})\}\}/gu;function oD(e){return e.trim().replace(/\s+/gu,` `).toLowerCase()}function Gle(e,t){let n=new Set,r=[];for(let i of[...t,...e]){let e=oD(i.name);n.has(e)||i.url.trim()===``||(n.add(e),r.push(i))}return r}function sD(e,t){let n=new Map(t.map(e=>[oD(e.name),e.url])),r=[],i=0;for(let t of e.matchAll(Wle)){let a=t.index;a>i&&r.push({kind:`text`,text:e.slice(i,a)});let o=(t[1]??``).trim();r.push({kind:`placeholder`,raw:t[0],name:o,url:n.get(oD(o))}),i=a+t[0].length}return i<e.length&&r.push({kind:`text`,text:e.slice(i)}),r}function cD(e,t){let n=[];return{text:sD(e,t).map(e=>e.kind===`text`?e.text:e.url===void 0?(n.some(t=>oD(t)===oD(e.name))||n.push(e.name),e.raw):e.url).join(``),unknown:n}}function Kle(e){if(e.length>50)return`Keep at most 50 links. Remove some.`;let t=new Set;for(let[n,r]of e.entries()){let e=`Link ${String(n+1)}`,i=r.name.trim();if(i===``)return`${e} has no name. Give it one, such as Patreon.`;if(i.length>60)return`${e}'s name is over 60 characters. Shorten it.`;if(/[{}]/u.test(i))return`${e}'s name contains { or }. Use the name alone; the description writes it as {{${i.replace(/[{}]/gu,``)}}}.`;if(t.has(oD(i)))return`Two links are named "${i}". Rename one, since {{${i}}} can only fill with one.`;t.add(oD(i));let a=r.url.trim();if(a.length>2e3)return`The "${i}" link is over ${String(aD)} characters. Use a shorter address.`;if(a===``)return`The "${i}" link has no address. Paste it, starting with https://.`;if(!qle(a))return`The "${i}" link is not a web address. Paste the full address, starting with https://.`}}function qle(e){try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}}var lD=kw(),uD=G().regex(/^#[0-9a-fA-F]{6}$/,`Use a colour like #FFD700.`).transform(e=>e.toUpperCase()),dD=e=>G().trim().max(e).optional(),fD=G().max(160).regex(/^[A-Za-z0-9_-]+$/,`Choose a font from the list.`).optional(),Jle=J({captionFontId:fD,captionColor:uD.optional(),captionOutlineColor:uD.optional(),titleFontId:fD,titleColor:uD.optional(),intro:dD(200),outro:dD(200),endScreenText:dD(200),documentTheme:dD(200),ambientBed:Ule.superRefine((e,t)=>{for(let n of uE(e))t.addIssue({code:`custom`,path:[n.field],message:`${n.message} Change it under Brand kit → Ambient sound on the channel page.`})}).optional(),language:kT.optional(),links:q(J({name:G().max(240),url:G().max(aD*2)}).strict()).max(100).transform(e=>e.map(e=>({name:e.name.trim(),url:e.url.trim()}))).superRefine((e,t)=>{let n=Kle(e);n!==void 0&&t.addIssue({code:`custom`,message:`The channel's links weren't saved: ${n} Then press Save channel on the channel's Brand tab.`})}).optional()}).strict().transform(e=>Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0&&e!==``))),pD=G().trim().min(1,`Enter a name.`).max(200,`Keep the name to 200 characters or fewer.`);J({id:lD,name:pD}).strict().readonly(),J({name:pD,brand:Jle,seriesBrief:G().max(1e4,`Keep the series brief to 10,000 characters or fewer.`),baseVersion:K().int().positive()}).strict().readonly();var mD=G().trim().min(1,`Enter a name, and remove empty aliases.`).max(200,`Keep names and aliases to 200 characters or fewer.`),Yle=J({provider:G().trim().min(1,`Choose a voice provider.`).max(100),model:G().trim().min(1,`Choose a voice model.`).max(200),voice:G().trim().min(1,`Choose a voice.`).max(200),pace:K().refine(e=>NE.includes(e),`Pick a pace from the list.`).optional(),pronunciations:G().max(2e4,`Keep the pronunciations to 20,000 characters or fewer.`).optional()}).strict(),hD=J({kind:Y(My),name:mD,aliases:q(mD).max(20,`Keep to 20 aliases or fewer.`).default([]),description:G().trim().max(2e3,`Keep the description to 2,000 characters or fewer.`).default(``),voice:Yle.nullable().optional(),host:Mw().optional()}).strict();hD.extend({id:lD}).strict(),hD.extend({baseVersion:K().int().positive()}).strict(),J({memberId:lD,to:K().int().nonnegative()}).strict().readonly(),J({prompt:G().trim().min(1,`Describe the picture to make.`).max(4e3,`Keep the picture's description to 4,000 characters or fewer.`),provider:G().min(1).max(100),model:G().min(1).max(200)}).strict(),J({channelId:lD}).strict(),J({aiDisclosure:Y(tD,`Choose Automatic, Always Yes or Always No.`)}).strict();var Xle=q(J({name:G(),aliases:q(G()).readonly(),description:G(),images:q(G()).readonly()})).readonly(),gD=G().min(1),_D=G().regex(/^[a-f0-9]{64}$/),vD=Y([`audio`,`images`,`video`]),yD=J({projectId:gD,revisionId:gD,checkpointId:gD,stage:vD,workId:gD,fingerprint:_D,state:Y([`configured`,`pending-review`,`held`,`released`,`satisfied`,`invalidated`,`canceled`]),createdAt:Jw(),approvedAt:Jw().nullable()}).strict().readonly();J({projectId:gD,revisionId:gD,checkpoints:q(J({checkpointId:gD,stage:vD,workId:gD,fingerprint:_D,state:Y([`configured`,`pending-review`,`held`])}).strict().readonly()).max(3).readonly(),createdAt:Jw()}).strict().readonly();var Zle=J({projectId:gD,revisionId:gD,checkpointId:gD,fingerprint:_D,idempotencyKey:kw(),approvedAt:Jw()}).strict().readonly(),bD=[`plain`],xD=`dicemaster`,Qle=[...bD,xD],SD={plain:`Plain`,dicemaster:`DiceMaster`};function CD(e){return e?.theme??`dicemaster`}function wD(e){return e?.theme??`plain`}function TD(e){return e?.custom?.name??SD[CD(e)]}function $le(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.`}]:[]}var ED=[`Cinzel`,`Literata`,`times`,`helvetica`,`courier`],eue=[`normal`,`medium`,`bold`,`black`,`italic`,`bolditalic`],DD=(e,t)=>{let n={error:`Use a value from ${String(e)} to ${String(t)}.`};return K({error:`Enter a number.`}).finite(n).min(e,n).max(t,n)},OD=G().regex(/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i,`Use a colour like #8c1e14.`),kD=G().max(300,{error:`Keep this under 300 characters.`}),AD=kD.nullable(),jD=G().max(500,{error:`Keep this under 500 characters.`}).nullable(),MD=J({family:Y(ED),style:Y(eue),letterSpacing:DD(-.5,2)}).strict(),ND=J({page:J({format:Y([`a4`,`letter`]),margin:DD(5,60),contentTop:DD(5,80)}).strict(),background:J({image:Y([`parchment`]).nullable(),color:OD}).strict(),colors:J({heading:OD,text:OD,muted:OD,faint:OD}).strict(),fonts:J({body:MD,strong:MD,emphasis:MD,heading:MD,dramatic:MD,decorative:MD,dropCap:MD,footer:MD}).strict(),sizes:J({brand:DD(6,72),title:DD(6,72),section:DD(6,72),heading:DD(6,72),subheading:DD(6,72),body:DD(6,24),footer:DD(5,24),meta:DD(5,24)}).strict(),spacing:J({bodyLine:DD(3,20),headingLine:DD(3,30),subheadingLine:DD(3,30),paragraphGap:DD(0,3),headingGap:DD(0,5),itemGap:DD(0,3),listIndent:DD(0,30),quoteIndent:DD(0,40),ruleWidth:DD(0,150)}).strict(),dropCap:J({enabled:Mw(),lines:Fw([Vw(2),Vw(3),Vw(4)]),scale:DD(1,5),gap:DD(0,20),minLength:K({error:`Enter a number.`}).int({error:`Use a whole number.`}).min(0,{error:`Use a value from 0 to 2000.`}).max(2e3,{error:`Use a value from 0 to 2000.`}),minRoom:DD(0,1)}).strict(),titlePage:J({brandY:DD(10,200),taglineOffset:DD(0,60),titleY:DD(10,250),titleLine:DD(3,40),metaOffset:DD(0,100),metaLine:DD(3,30),showDate:Mw(),showWordCount:Mw(),cover:J({enabled:Mw(),gap:DD(0,40),maxHeight:DD(20,200)}).strict()}).strict(),contents:J({enabled:Mw(),title:kD,depth:Fw([Vw(1),Vw(2),Vw(3)]),titleOffset:DD(0,100),firstEntryOffset:DD(0,150),line:DD(3,30),indent:DD(0,30)}).strict(),header:J({enabled:Mw(),top:DD(3,60),maxTitleCharacters:K({error:`Enter a number.`}).int({error:`Use a whole number.`}).min(5,{error:`Use a value from 5 to 200.`}).max(200,{error:`Use a value from 5 to 200.`})}).strict(),footer:J({enabled:Mw(),bottom:DD(3,60),reserve:DD(0,60),text:kD}).strict(),brand:J({name:AD,url:jD,tagline:AD,linkLabel:AD}).strict(),metadata:J({author:kD,subject:kD,keywords:G().max(1e3),creator:kD}).strict(),sources:J({enabled:Mw(),title:kD,titleOffset:DD(0,100),bodyOffset:DD(0,150),line:DD(3,30),gap:DD(0,20)}).strict(),endPage:J({enabled:Mw(),title:kD,titleOffset:DD(0,100),bodyOffset:DD(0,150),lines:q(kD).max(60).readonly(),showDocumentDetails:Mw(),link:J({text:kD,url:jD}).strict().nullable(),closing:AD}).strict()}).strict(),tue=J({id:G().min(1).max(64),name:G().min(1).max(80),values:ND}).strict(),PD=J({theme:Y(Qle),custom:tue.optional()}).strict(),FD=1e3,ID=/[\p{L}\p{M}\p{N}_]/u;function nue(e,t){let n=[];for(let r of t){let t=r.written.trim();if(t===``)continue;let i=t.split(/\s+/u).map(e=>e.replace(/[|\\{}()[\]^$+*?.]/gu,`\\$&`)).join(`\\s+`),a=new RegExp(i,r.caseSensitive?`gu`:`giu`),o=Array.from(t)[0]??``,s=Array.from(t).at(-1)??``;for(let t of e.matchAll(a)){let i=t.index,a=i+t[0].length;if(r.wholeWord){let t=Array.from(e.slice(Math.max(0,i-2),i)).at(-1)??``,n=Array.from(e.slice(a,a+2))[0]??``;if(ID.test(o)&&ID.test(t)||ID.test(s)&&ID.test(n))continue}n.push({start:i,end:a,spoken:r.spoken})}}n.sort((e,t)=>e.start-t.start||t.end-e.end);let r=[],i=0;for(let e of n)e.start<i||(r.push(e),i=e.end);return r}function LD(e,t){let n=``,r=0;for(let i of nue(e,t))n+=e.slice(r,i.start)+i.spoken,r=i.end;return n+e.slice(r)}var RD=J({written:G().trim().min(1).max(200),spoken:G().trim().min(1).max(500),wholeWord:Mw(),caseSensitive:Mw()}).strict().readonly(),zD=q(RD).max(FD).readonly();function BD(e,t,n){let r=new Map;return(...i)=>{let a=t(...i),o=r.get(a);if(o!==void 0||r.has(a))return r.delete(a),r.set(a,o),o;let s=n(...i);return r.set(a,s),r.size>e&&r.delete(r.keys().next().value),s}}var VD=[`whole`,`paragraph`,`words`,`characters`],HD=[`off`,`files`,`burn-in`],UD=[`top`,`upper-middle`,`center`,`lower-middle`,`bottom`],WD=J({mode:Y(HD),language:Vw(`en`).default(`en`),fontId:G().max(160).regex(/^[A-Za-z0-9_-]+$/).default(`default`),position:Y(UD).default(`bottom`),fontSize:K().int().min(16).max(120).default(48),color:G().regex(/^#[0-9A-Fa-f]{6}$/).optional(),outlineColor:G().regex(/^#[0-9A-Fa-f]{6}$/).optional()}),GD={mode:`off`,language:`en`,fontId:`default`,fontSize:48,position:`bottom`},rue=G().regex(/^#[0-9A-Fa-f]{6}$/),KD=J({provider:G(),model:G(),thinking:Y(Yw).optional()}),qD=J({name:G(),mode:Y(Eb)}),JD=J({cuts:Y(mE),transition:Y(hE),transitionSeconds:K(),vignette:Y(gE),grain:Y(gE),grade:Y(_E),atmosphere:Y(vE),chapterCards:Mw(),animate:Y(yE),animateEvery:K(),animateModel:G()}),YD=J({mode:Y(Ab).optional(),checkpoints:q(vD).max(3).refine(e=>new Set(e).size===e.length).readonly().optional(),title:G(),format:Y(yb),sources:J({research:Y(Cb),article:Y(Cb),audio:Y(Cb),images:Y(Cb),thumbnail:Y(Cb),video:Y(Cb),document:Y(Cb).optional()}),llm:KD.optional(),audio:KD.extend({voice:G(),usePronunciationGlossary:Mw().optional(),shareGlossary:Mw().optional(),useNarrationAliases:Mw().optional(),describeFigures:Mw().optional(),skipCode:Mw().optional()}).optional(),narrationAliases:zD.optional(),pronunciationRules:Fw([Vw(1),Vw(2)]).optional(),sharedGlossary:q(J({term:G().min(1).max(200),ipa:q(G().min(1).max(200)).min(1).max(20).readonly()})).max(2e4).readonly().optional(),images:KD.optional(),reference:J({source:Y(kb),prompt:G().optional(),thumbnail:Mw().optional()}).optional(),articlePrompt:G().optional(),narrationPrompt:G().optional(),imagePrompts:q(J({name:G(),number:K()})),imageScale:J({perHour:K(),words:K()}).optional(),imageScenes:Mw().optional(),thumbnailPrompt:G().optional(),thumbnailCount:Fw([Vw(1),Vw(3)]).optional(),intro:qD.optional(),outro:qD.optional(),values:Rw(G(),G()),provided:J({research:G().optional(),article:G().optional(),audio:G().optional(),images:q(G()).optional(),thumbnail:G().optional(),reference:G().optional(),shortsMusic:G().optional(),ambientBed:G().optional()}),chunking:J({mode:Y(VD),words:K().optional(),characters:K().int().min(1).max(1e6).optional()}).optional(),silenceGapSeconds:K(),imageSeconds:K().default(15),zoomPercent:K().default(VE),motionStyle:Y(Tb).default(HE),edgeSilenceSeconds:K().default(2),subtitles:WD.optional(),document:PD.optional(),youtubeDescription:Mw().optional(),showFigures:Mw().optional(),descriptionPrompt:G().optional(),shorts:J({enabled:Mw(),count:K(),minSeconds:K(),maxSeconds:K(),prompt:G().optional(),imagePrompt:G().optional(),titleOnScreen:Mw().optional(),fullVideoLink:G().optional(),musicVolume:K().optional(),speed:K().optional()}).optional(),videoEdit:JD.optional(),channelId:G().optional(),useBrandKit:Vw(!1).optional(),cast:Xle.optional(),earlierEpisodes:q(J({title:G(),summary:G()})).readonly().optional(),titleStyle:J({fontId:G().max(160).regex(/^[A-Za-z0-9_-]+$/).optional(),color:rue.optional()}).optional(),endScreen:J({text:G().max(200)}).optional(),reviews:J({provider:G(),model:G(),thinking:Y(Yw).optional(),reviewer:Vw(`agent`).optional(),retries:K().optional(),stages:zw(Y(XT),J({mode:Y(ZT),prompt:G().optional()}))}).optional(),voices:LE.optional(),ambientBed:Hle.optional(),loudness:J({videoLufs:K(),audioFilesLufs:K()}).strict().optional(),sentencePauseSeconds:K().optional(),paragraphPauseSeconds:K().optional(),removeBreaths:Mw().optional(),deEss:Mw().optional(),levelSentences:Mw().optional(),language:kT.optional()}),XD=YD.extend({rendered:Rw(G(),G()),titlePattern:G().optional(),subjectTitle:G().optional()});J({id:G(),kind:Y(jb),name:G(),body:G(),slots:G(),updated_at:G()}),J({id:G(),category:Y(Mb),mode:Y(Eb),name:G(),body:G(),slots:G(),updated_at:G()});var ZD=J({id:G(),name:G(),body:G(),slots:q(G()).readonly(),updatedAt:G()}),QD=J({prompts:q(ZD.extend({kind:Y(jb)}).strict().readonly()).readonly(),entries:q(ZD.extend({category:Y(Mb),mode:Y(Eb)}).strict().readonly()).readonly()}).strict().readonly(),$D=kw(),eO=G(),tO=Rw(eO,eO).readonly(),nO=J({provider:eO,model:eO,thinking:Y(Yw).optional()}).strict(),rO=[`audio`,`images`,`thumbnail`,`reference`],iO=J({attachmentId:$D,name:eO}).strict().readonly(),aO=J({title:eO,checkpoints:YD.shape.checkpoints,format:Y(yb),sources:J({research:Y(Cb),article:Y(Cb),audio:Y(Cb),images:Y(Cb),thumbnail:Y(Cb),video:Y(Cb),document:Y(Cb).optional()}).strict().readonly(),document:PD.readonly().optional(),llm:nO.readonly(),audio:nO.extend({voice:eO,usePronunciationGlossary:Mw().optional(),shareGlossary:Mw().optional(),useNarrationAliases:Mw().optional(),describeFigures:Mw().optional(),skipCode:Mw().optional()}).readonly(),images:nO.readonly(),reference:J({source:Y([`off`,...kb]),prompt:eO,thumbnail:Mw()}).strict().readonly().optional(),articlePrompt:eO,narrationPrompt:eO.optional(),thumbnailCount:Fw([Vw(1),Vw(3)]).optional(),loudness:J({enabled:Mw(),videoLufs:K().optional(),audioFilesLufs:K().optional()}).strict().readonly().optional(),sentencePause:eO.optional(),paragraphPause:eO.optional(),removeBreaths:Mw().optional(),deEss:Mw().optional(),levelSentences:Mw().optional(),youtubeDescription:Mw().optional(),showFigures:Mw().optional(),descriptionPrompt:eO.optional(),language:kT.optional(),shorts:J({enabled:Mw(),count:eO,minSeconds:eO,maxSeconds:eO,prompt:eO,imagePrompt:eO,titleOnScreen:Mw().optional(),fullVideoLink:eO.optional(),musicVolume:eO.optional(),speed:eO.optional()}).strict().readonly().optional(),reviews:J({provider:eO,model:eO,thinking:Y(Yw).optional(),reviewer:Y(QT).optional(),retries:eO,stages:zw(Y(XT),J({mode:Y(ZT),prompt:eO}).strict().readonly()).readonly()}).strict().readonly().optional(),imagePrompts:q(J({name:eO,number:eO}).strict().readonly()).readonly(),imageScale:J({every:Y([`minutes`,`hour`]),value:eO}).strict().readonly().optional(),imageScenes:Mw().optional(),thumbnailPrompt:eO,intro:eO,outro:eO,chunking:J({mode:Y(VD),words:eO,characters:eO}).strict().readonly(),subtitles:J({mode:Y(HD),language:Vw(`en`),fontId:eO,fontSize:eO,position:Y(UD)}).strict().readonly(),imageSeconds:eO.default(`15`),edgeSilenceSeconds:eO.default(`2`),zoomPercent:eO.default(String(VE)),motionStyle:Y(Tb).default(HE),silenceGapSeconds:eO.optional(),videoEdit:JD.strict().readonly().optional(),useBrandKit:Mw().optional(),voices:LE.strict().readonly().optional(),ambientBed:J({source:Y([`none`,...cE]),level:eO,fadeIn:eO,tail:eO}).strict().readonly().optional(),values:tO,provided:J({research:eO,article:eO,audio:iO.nullable(),thumbnail:iO.nullable(),images:q(iO).readonly(),reference:iO.nullable().optional(),shortsMusic:iO.nullable().optional(),ambientBed:iO.nullable().optional()}).strict().readonly()}).strict().readonly(),oO=J({schemaVersion:Vw(1),librarySnapshot:QD.optional(),templateSource:J({id:$D,version:K().int().positive()}).strict().readonly().optional(),channelId:$D.optional(),form:aO,section:Y([`content`,`outputs`,`style`,`review`]),variants:q(J({id:$D,title:eO,values:tO}).strict().readonly()).readonly(),queue:Mw().optional(),expectedWords:eO,previewText:eO,fontUpload:J({operationId:$D,name:eO}).strict().readonly().nullable()}).strict().readonly(),sO=J({id:$D,document:oO}).strict().readonly(),cO=sO.unwrap().extend({baseVersion:K().int().positive(),mutationId:$D}).strict().readonly(),lO=sO.unwrap().extend({sourceId:$D}).strict().readonly(),uO=J({id:$D,baseVersion:K().int().positive()}).strict().readonly(),dO=J({id:$D,kind:Y(rO),name:eO,state:Y([`pending`,`copying`,`ready`,`reattach`]),stagedFileId:eO.nullable(),bytes:K().nonnegative(),error:eO.nullable()}).strict().readonly(),fO=J({id:$D,version:K().int().positive(),createdAt:eO,updatedAt:eO,document:oO}).strict().readonly(),pO=J({checkpointSet:q(yD.unwrap().extend({reviewedFingerprint:eO}).strict().readonly()).readonly().optional(),requestId:$D,projectIds:q(eO).readonly(),queue:q(J({projectId:eO,batchId:eO,position:K(),state:Y([`queued`,`active`,`finished`])}).strict().readonly()).readonly(),replayed:Mw()}).strict().readonly(),iue=J({currency:Vw(`USD`),rows:q(J({stage:eO,low:K().nullable(),high:K().nullable(),detail:eO,onPlan:Mw().optional(),apiLow:K().nullable().optional(),apiHigh:K().nullable().optional()}).strict().readonly()).readonly(),low:K(),high:K(),unknown:K(),apiLow:K().optional(),apiHigh:K().optional(),apiUnknown:K().optional(),expectedWords:K(),catalogueDate:eO.nullable(),assumptions:q(eO).readonly()}).strict().readonly(),mO=J({checkpointSet:q(J({runIndex:K().int().nonnegative(),checkpointId:eO,stage:vD,fingerprint:eO,workKeys:q(eO).readonly(),dependents:q(Y(bb)).readonly()}).strict().readonly()).readonly().optional(),id:$D,draftId:$D,draftVersion:K().int().positive(),fingerprint:eO,runs:q(J({draft:YD,rendered:tO,templates:tO}).strict().readonly()).readonly(),estimates:q(iue).readonly()}).strict().readonly(),hO=J({draft:fO,attachments:q(dO).readonly(),review:mO.nullable(),pendingStart:J({reviewId:$D,draftVersion:K().int().positive()}).strict().readonly().nullable(),start:pO.nullable()}).strict().readonly();J({id:kw(),name:G().trim().min(1).max(120),document:oO}).strict().readonly().unwrap().extend({name:G().trim().min(1).max(200),baseVersion:K().int().positive(),mutationId:kw()}).strict().readonly(),J({id:kw(),baseVersion:K().int().positive()}).strict().readonly(),J({templateId:kw(),id:kw(),version:K().int().positive()}).strict().readonly(),J({id:kw(),name:G(),version:K().int().positive(),createdAt:G(),updatedAt:G(),document:oO}).strict().readonly();var gO=J({id:kw(),name:G(),version:K().int().positive(),updatedAt:G(),channelId:G().optional()}),_O=gO.extend({document:oO}),vO=Fw([_O,J({template:_O}).transform(e=>e.template)]),aue=J({title:G(),detail:G().optional(),reason:G().optional()}),yO=[`project-templates`],bO=e=>`${e.origin}/api/project-templates`;async function xO(e,t){let n;try{n=await e.json()}catch{throw po(e,void 0)}if(e.ok)return{ok:!0,value:So(t,n)};let r=aue.safeParse(n);if(!r.success)throw po(e,void 0);let i=r.data.detail??r.data.title;if(![400,404,409].includes(e.status))throw Error(i);return{ok:!1,message:i,reason:r.data.reason??`invalid-request`}}var SO=(e,t)=>({method:e,headers:{"content-type":`application/json`},body:JSON.stringify(t)});async function oue(e){return xO(await e.fetch(bO(e)),J({templates:q(gO)}).transform(e=>e.templates))}function CO(e){return{queryKey:yO,queryFn:async()=>{let t=await oue(e);if(!t.ok)throw Error(t.message);return t.value}}}async function wO(e,t,n){let r=n===void 0?``:`?version=${String(n)}`;return xO(await e.fetch(`${bO(e)}/${encodeURIComponent(t)}${r}`),vO)}async function TO(e,t){let n=J({id:kw(),name:G().trim().min(1),document:oO}).parse(t);return xO(await e.fetch(bO(e),SO(`POST`,n)),vO)}async function EO(e,t,n){let r=J({baseVersion:K().int().positive(),mutationId:kw(),name:G().trim().min(1),document:oO}).parse(n);return xO(await e.fetch(`${bO(e)}/${encodeURIComponent(t)}`,SO(`PUT`,r)),vO)}async function sue(e,t,n){let r=await wO(e,t);if(!r.ok)return`The name wasn't saved: ${r.message} Press Refresh templates, then rename it again.`;let i=await EO(e,t,{baseVersion:r.value.version,mutationId:crypto.randomUUID(),name:n,document:r.value.document});return i.ok?null:`The name wasn't saved: ${i.message}${i.reason===`conflict`?` Press Refresh templates, then rename it again.`:``}`}async function cue(e,t,n){let r=J({id:kw(),name:G().trim().min(1).max(120),revisionId:G().min(1).max(64)}).parse(n);return xO(await e.fetch(`${bO(e)}/from-project/${encodeURIComponent(t)}`,SO(`POST`,r)),vO)}async function DO(e,t){let n=await e.fetch(`${bO(e)}/${encodeURIComponent(t.id)}`,SO(`DELETE`,{baseVersion:t.version}));return n.ok?{ok:!0,value:null}:xO(n,Ase())}async function lue(e,t,n){return xO(await e.fetch(`${bO(e)}/next-chapter/${encodeURIComponent(t)}`,SO(`POST`,{id:kw().parse(n)})),Fw([hO,J({draft:hO}).transform(e=>e.draft)]))}async function OO(e,t,n){let r=J({id:kw(),version:K().int().positive()}).parse({id:n,version:t.version});return xO(await e.fetch(`${bO(e)}/${encodeURIComponent(t.id)}/instantiate`,SO(`POST`,r)),Fw([hO,J({draft:hO}).transform(e=>e.draft)]))}function uue(){let{api:e}=V(),t=Ji(),n={enabled:Qy().open},r=I({...uy(e),...n}),i=I({...dy(e),...n}),a=I({...fy(e),...n}),o=I({...mT(e),...n}),s=I({...CO(e),...n}),c=[...(I({...Ry(e),...n}).data??[]).map(e=>({id:`channel.open.${e.id}`,title:`Open channel ${e.name}`,keywords:[`channel`,`brand`,`cast`,`episodes`],go:()=>{t({to:`/channels/$channelId`,params:{channelId:e.id}})}})),...(o.data??[]).map(e=>({id:`schedule.open.${e.id}`,title:`Open schedule ${e.name}`,keywords:[`schedule`,`topics`,`calendar`,`plan`],go:()=>{t({to:`/calendar`,search:{tab:`schedules`,schedule:e.id}})}})),...(s.data??[]).map(e=>({id:`template.open.${e.id}`,title:`Open template ${e.name}`,keywords:[`template`,`setup`,`library`,`find`],go:()=>{t({to:`/templates`,search:{item:e.id}})}})),...(r.data?.prompts??[]).map(e=>({id:`prompt.edit.${e.id}`,title:`Edit prompt ${e.name}`,keywords:[`prompt`,`library`,Hb(e.kind)],go:()=>{t({to:`/prompts/$promptId`,params:{promptId:e.id}})}})),...(i.data?.entries??[]).map(e=>({id:`entry.edit.${e.id}`,title:`Edit ${Ib(e.category).toLowerCase()} ${e.name}`,keywords:[`intro`,`outro`,`library`],go:()=>{t({to:`/entries/$entryId`,params:{entryId:e.id}})}})),...(a.data?.themes??[]).map(e=>({id:`theme.edit.${e.id}`,title:`Edit PDF theme ${e.name}`,keywords:[`document`,`pdf`,`theme`,`library`],go:()=>{t({to:`/document-themes/$themeId`,params:{themeId:e.id}})}}))];return(0,h.jsx)(h.Fragment,{children:c.map(e=>(0,h.jsx)(due,{entity:e},e.id))})}function due({entity:e}){return Xy({id:e.id,title:e.title,group:`Library and plans`,keywords:e.keywords,searchOnly:!0,run:e.go}),null}var fue=1e4,kO={newSchedule:`schedules.new`,addToCalendar:`calendar.add`,showImages:e=>`project.${e}.show-images`,regenerateImage:e=>`project.${e}.regenerate-image`},AO=new Map,jO=new Set;function MO(e,t){AO.set(e,{value:t,at:Date.now()});for(let e of jO)e()}function pue(e){let t=AO.get(e);return AO.delete(e),t===void 0||Date.now()-t.at>fue?void 0:t}function NO(e,t,n=!0){let r=(0,m.useRef)(t);r.current=t,(0,m.useEffect)(()=>{if(!n)return;let t=()=>{if(!AO.has(e))return;let t=pue(e);t!==void 0&&r.current(t.value)};return t(),jO.add(t),()=>{jO.delete(t)}},[e,n])}function mue(){let{api:e}=V(),t=I(iy(e)),n=Va({select:e=>e.pathname}),r=Va({select:e=>e.pathname===`/calendar`&&e.search.tab===`schedules`}),i=/^\/projects\/([^/]+)/.exec(n)?.[1];return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(uue,{}),r?null:(0,h.jsx)(hue,{}),n===`/calendar`?null:(0,h.jsx)(gue,{}),(t.data?.projects??[]).filter(e=>e.id!==i).map(e=>(0,h.jsx)(_ue,{project:e},e.id))]})}function hue(){let e=Ji();return Xy({id:`global.schedules.new`,title:`New schedule`,group:`Create`,keywords:[`schedule`,`recurring`,`calendar`,`plan`],searchOnly:!0,run:()=>{MO(kO.newSchedule),e({to:`/calendar`,search:{tab:`schedules`}})}}),null}function gue(){let e=Ji();return Xy({id:`global.calendar.add`,title:`Add to calendar`,group:`Create`,keywords:[`schedule`,`topics`,`batch`,`queue`,`plan`],searchOnly:!0,run:()=>{MO(kO.addToCalendar),e({to:`/calendar`})}}),null}function _ue({project:e}){let t=Ji(),n=()=>{t({to:`/projects/$projectId`,params:{projectId:e.id}})};return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(vue,{project:e,open:n}),e.config.sources.images===`off`?null:(0,h.jsx)(yue,{project:e,open:n})]})}function vue({project:e,open:t}){return Xy({id:`index.open.${e.id}`,title:`Open ${e.title}`,group:`Projects`,keywords:[`project`,`go`],searchOnly:!0,run:t}),null}function yue({project:e,open:t}){return Xy({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=>{MO(kO.showImages(e.id)),n!==void 0&&MO(kO.regenerateImage(e.id),n),t()}}),null}var bue=`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`,xue=`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`,Sue=`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`,Cue={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 PO(e){return{maskImage:`url("${e}")`,maskSize:`contain`,maskRepeat:`no-repeat`,maskPosition:`center`}}function wue({kind:e,className:t}){return(0,h.jsx)(`span`,{"aria-hidden":`true`,"data-glyph":e,className:z(`block size-[22px] shrink-0 bg-current`,t),style:PO(Cue[e])})}var Tue={github:xue,patreon:Sue,coffee:bue};function FO({name:e,className:t}){return(0,h.jsx)(`span`,{"aria-hidden":`true`,"data-glyph":e,className:z(`block size-[14px] shrink-0 bg-current`,t),style:PO(Tue[e])})}function IO({variant:e=`secondary`,size:t=`default`,className:n,...r}){return(0,h.jsx)(`a`,{"data-slot":`button-link`,className:z(yv({variant:e,size:t}),n),...r})}function Eue({className:e,...t}){return(0,h.jsx)(`a`,{"data-slot":`text-link`,className:z(`sl-link`,e),...t})}var LO=da(IO),RO=da(Eue);function zO({href:e,...t}){return(0,h.jsx)(IO,{href:e,...t})}function Due({href:e,label:t,tip:n,...r}){return(0,h.jsx)(IO,{href:e,variant:`icon`,"aria-label":t,"data-tip":n??t,...r})}var BO=Sne,VO=Cne;function HO({className:e,sideOffset:t=4,align:n=`end`,...r}){return(0,h.jsx)(wne,{children:(0,h.jsx)(Tne,{"data-slot":`menu-content`,sideOffset:t,align:n,className:z(`z-50 min-w-[180px] overflow-hidden rounded-control border border-line bg-raised p-1`,`shadow-[var(--shadow-pop)]`,e),...r})})}function UO({className:e,...t}){return(0,h.jsx)(Ene,{"data-slot":`menu-item`,className:z(`flex cursor-default items-center gap-2 rounded-control px-[10px] py-[6px] text-small text-ink`,`outline-hidden select-none focus:bg-sunken data-highlighted:bg-sunken`,`data-disabled:text-ink-3`,e),...t})}function WO({className:e}){return(0,h.jsx)(Dne,{className:z(`my-1 h-px bg-line`,e)})}function GO({tone:e,className:t}){return(0,h.jsx)(`span`,{"aria-hidden":`true`,"data-tone":e,className:z(`sl-lamp`,e!==`off`&&`sl-lamp--${e}`,t)})}function KO({tone:e,children:t,className:n}){let r=e===`done`?`running`:e;return(0,h.jsxs)(`span`,{"data-slot":`status`,className:z(`sl-status`,r!==`off`&&`sl-status--${r}`,n),children:[(0,h.jsx)(GO,{tone:e}),t]})}function qO({tone:e=`neutral`,className:t,...n}){return(0,h.jsx)(`span`,{"data-slot":`badge`,className:z(`sl-badge`,e!==`neutral`&&`sl-badge--${e}`,t),...n})}function JO({children:e,onRemove:t,removeLabel:n,className:r}){return(0,h.jsxs)(`span`,{"data-slot":`chip`,className:z(`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)(kl,{"aria-hidden":`true`,className:`size-[14px]`,strokeWidth:1.75})})]})}function YO({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 XO=[`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`],ZO=[`API keys`,`Prompt bodies`,`Keyword values`,`Titles`,`Article or research text`,`Files and filenames`,`OS, locale, hardware`];function QO(){let{api:e}=V(),t=_(),n=I(sy(e)),r=L({mutationFn:()=>Yo(e),onSuccess:e=>{t.setQueryData(H.notice,e)}}),i=n.data?.seen===!1,a=n.data?.appVersion;return(0,h.jsxs)(zv,{open:i,dismissible:!1,title:`Anonymous usage stats`,description:`These numbers power the live counters on slopify.stream.`,footer:(0,h.jsx)(B,{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)($O,{heading:`Tracked`,items:XO}),(0,h.jsx)($O,{heading:`Never tracked`,items:ZO})]}),(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 $O({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))})]})}var ek={newVideo:[`C`],goHome:[`G`,`H`],goProjects:[`G`,`P`],goCalendar:[`G`,`C`],goSchedules:[`G`,`S`],goLibrary:[`G`,`L`],goChannels:[`G`,`K`],goSettings:[`G`,`,`],nextAction:[`Shift`,`N`],copyDescription:[`Shift`,`D`],reviewSetup:[`Ctrl`,`Enter`],save:[`Ctrl`,`S`]},tk=[{id:`providers`,label:`Providers`,meta:`Keys stay on this machine and go only to their provider. Readiness is checked again before each run.`},{id:`voices`,label:`Voices`,meta:`A wrong voice ID shows up when the audio stage uses it.`},{id:`models`,label:`Models`,meta:`New models, prices and retirements, checked once a day.`},{id:`agents`,label:`Agents (MCP)`,meta:`Let an AI agent on this computer, such as Claude Code or Codex, run Slopify.`},{id:`playback`,label:`Production defaults`,meta:`How new runs pace the narration and level the volume, and which model times English captions.`},{id:`notifications`,label:`Notifications`,meta:`When a run finishes, fails, waits for you, or a review needs a decision.`},{id:`channel-links`,label:`Channel links`,meta:`The links a YouTube description's {{Name}} placeholders fill from.`},{id:`studio`,label:`YouTube Studio`,meta:`The playlist upload packs name, and the Studio extension's pairing.`},{id:`storage`,label:`Backup & storage`,meta:`Daily backups, export and import, and what uses disk space.`},{id:`trash`,label:`Trash`,meta:`Deleted projects, prompts, intros and outros, templates and schedules, kept for 30 days. Channels, cast, PDF themes and episode summaries are deleted permanently.`},{id:`general`,label:`General`,meta:`How Slopify looks and how it starts on this computer.`},{id:`about`,label:`About`,meta:`Free and open source, running on your machine with your own keys.`},{id:`usage`,label:`Usage`,meta:`This machine only. The same counters, anonymised, feed slopify.stream.`},{id:`patch-notes`,label:`Patch notes`,meta:`What changed in each version of Slopify.`}],nk={id:`connections`,label:`Connections`,sections:[`providers`,`voices`,`models`,`agents`]},rk=[nk,{id:`production`,label:`Production defaults`,sections:[`playback`]},{id:`notifications`,label:`Notifications`,sections:[`notifications`]},{id:`publishing`,label:`Publishing`,sections:[`channel-links`,`studio`]},{id:`storage`,label:`Backup & storage`,sections:[`storage`,`trash`]},{id:`general`,label:`General`,sections:[`general`]},{id:`about`,label:`About`,sections:[`about`,`usage`,`patch-notes`]}];function ik(e){return e===`backups`?`storage`:tk.find(t=>t.id===e)?.id??`providers`}function ak(e){return rk.find(t=>t.sections.includes(e))??nk}var ok=[{id:`text-key`,title:`1. Connect a text provider`,target:`keys-llm`,page:`settings`},{id:`audio-key`,title:`2. Connect a voice provider`,target:`keys-tts`,page:`settings`},{id:`image-key`,title:`3. Connect an image provider`,target:`keys-image`,page:`settings`},{id:`voice`,title:`4. Add a narration voice`,target:`voices`,page:`settings`},{id:`article-name`,title:`5. Name your article prompt`,target:`prompt-name`,page:`article`},{id:`article-body`,title:`6. Write instructions with keywords`,target:`prompt-body`,page:`article`},{id:`article-keywords`,title:`7. Check the detected keywords`,target:`prompt-slots`,page:`article`},{id:`article-save`,title:`8. Save your article prompt`,target:`prompt-save`,page:`article`},{id:`image-prompt`,title:`9. Create an image prompt`,target:`prompt-editor`,page:`image`},{id:`image-save`,title:`10. Save your image prompt`,target:`prompt-save`,page:`image`},{id:`play-options`,title:`11. Name the project and choose text generation`,target:`play-options`,page:`play`},{id:`play-article`,title:`12. Choose your article`,target:`play-article`,page:`play`},{id:`play-keywords`,title:`13. Fill in your keywords`,target:`play-keywords`,page:`play`},{id:`play-audio`,title:`14. Choose narration`,target:`play-audio`,page:`play`},{id:`play-images`,title:`15. Choose images`,target:`play-images`,page:`play`},{id:`play-video`,title:`16. Choose video output`,target:`play-video`,page:`play`},{id:`play-subtitles`,title:`17. Style optional subtitles`,target:`play-subtitles`,page:`play`},{id:`play-start`,title:`18. Review and start your run`,target:`play-start`,page:`play`},{id:`project`,title:`19. Follow and control the run`,target:`project-controls`,page:`project`},{id:`download`,title:`20. Download your results`,target:`project-video`,page:`project`},{id:`run-cost`,title:`21. See what the run cost`,target:`project-rail-cost`,page:`project`},{id:`studio-prep`,title:`22. Prepare the YouTube upload`,target:`project-rail-video`,page:`project`},{id:`home`,title:`23. Check Home each day`,target:`home`,page:`home`},{id:`channels`,title:`24. Set up a channel`,target:`channels`,page:`channels`},{id:`calendar`,title:`25. Plan uploads on the calendar`,target:`calendar`,page:`calendar`}],sk=`home`;function ck(e,t){return e.active?t.type===`project-created`?{...e,projectId:t.id,step:ok.findIndex(e=>e.id===`project`)}:t.kind===`article`?{...e,articleId:t.id}:t.kind===`image`?{...e,imageId:t.id}:e:e}function lk(e){let t=ok.findIndex(t=>t.id===e);return t<0?void 0:t}var uk={"play-options":`content`,"play-article":`content`,"play-keywords":`content`,"play-audio":`outputs`,"play-images":`outputs`,"play-video":`outputs`,"play-subtitles":`style`,"play-start":`content`};function dk(e){return e.kind===`keyed`?e.hasKey:e.kind===`local`?e.available:e.installed&&e.issue===void 0}var fk=J({title:G(),status:K(),detail:G().optional(),reason:G().optional(),currentVersion:K().int().positive().nullable().optional(),reviewId:kw().optional(),fields:q(J({field:G(),message:G()})).optional(),errors:q(J({path:G(),message:G()})).optional()}),pk=J({drafts:q(J({id:kw(),title:G(),version:K().int().positive(),updatedAt:G(),readable:Mw()}).strict()).readonly()}).strict(),mk=uO.unwrap().omit({id:!0}).extend({draftId:kw(),reviewId:kw()}).strict();async function hk(e,t){let n;try{n=await e.json()}catch{throw po(e,void 0)}if(e.ok)return{ok:!0,value:So(t,n)};let r=fk.safeParse(n);if(!r.success)throw po(e,void 0);let i=r.data;if(![400,404,409].includes(e.status))throw po(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,currentVersion:i.currentVersion??null,fields:i.fields??i.errors?.map(e=>({field:e.path,message:e.message}))??[],...i.reviewId===void 0?{}:{reviewId:i.reviewId}}}async function gk(e,t,n,r,i){return hk(await e.fetch(`${e.origin}/api/drafts${t}`,{method:n,...i===void 0?{}:{headers:{"content-type":`application/json`},body:JSON.stringify(i)}}),r)}function _k(e){return`/${encodeURIComponent(kw().parse(e))}`}async function vk(e){return gk(e,``,`GET`,pk)}async function yk(e,t){return gk(e,``,`POST`,hO,sO.parse(t))}async function bk(e,t){return gk(e,_k(t),`GET`,hO)}async function xk(e,t){let{id:n,...r}=cO.parse(t);return gk(e,_k(n),`PUT`,hO,r)}async function Sk(e,t){let{sourceId:n,...r}=lO.parse(t);return gk(e,`${_k(n)}/fork`,`POST`,hO,r)}async function Ck(e,t){let{id:n,...r}=uO.parse(t);return gk(e,_k(n),`DELETE`,J({discarded:Vw(!0)}).strict(),r)}async function wk(e,t){let{id:n,...r}=uO.parse(t);return gk(e,`${_k(n)}/review`,`POST`,mO,r)}async function Tk(e,t){let{draftId:n,...r}=mk.parse(t);return gk(e,`${_k(n)}/start`,`POST`,pO,r)}function Ek(e,t,n){return`${e.origin}/api/drafts${_k(t)}/attachments/${encodeURIComponent(kw().parse(n))}/file`}async function Dk(e,t,n,r,i){let a=new FormData;return a.set(`file`,r),hk(await e.fetch(Ek(e,t,n),{method:`PUT`,body:a,...i?{signal:i}:{}}),dO)}var Ok=[`fonts`];async function kk(e){return R(await e.fetch(`${e.origin}/api/fonts`))}async function Ak(e,t){let n=new FormData;return n.set(`file`,t),R(await e.fetch(`${e.origin}/api/fonts`,{method:`POST`,body:n}))}function jk(e,t){return`${e.origin}/api/fonts/${encodeURIComponent(t)}/file`}var Mk=`slopify.play-draft`;function Nk(e){try{e?window.localStorage?.setItem(Mk,e):window.localStorage?.removeItem(Mk)}catch(e){console.warn(`Active draft browser storage is unavailable`,e)}}function Pk(){try{return window.localStorage?.getItem(Mk)??null}catch(e){return console.warn(`Active draft browser storage is unavailable`,e),null}}async function Fk(e,t){let n=await Promise.allSettled([t.fetchQuery({...cy(e),staleTime:0}),t.fetchQuery({...uy(e),staleTime:0}),t.fetchQuery({...dy(e),staleTime:0}),t.fetchQuery({...my(e),staleTime:0}),t.fetchQuery({...ly(e),staleTime:0}),t.fetchQuery({queryKey:Ok,queryFn:()=>kk(e),staleTime:0})]);for(let e of n)e.status===`rejected`&&console.warn(`Draft choices could not refresh`,e.reason)}function Oue(e){return e.removeBreaths===!0?{removeBreaths:!0}:{}}function kue(e){return e.deEss===!0?{deEss:!0}:{}}var Ik=`under Video and style → Ambient sound`;`${Ik}`,`${Ik}`;var Lk=oO.parse({schemaVersion:1,form:{title:``,format:`16:9`,sources:{research:`off`,article:`generate`,audio:`generate`,images:`generate`,thumbnail:`off`,video:`generate`},llm:{provider:``,model:``},audio:{provider:``,model:``,voice:``,usePronunciationGlossary:!0,shareGlossary:!0,useNarrationAliases:!0,describeFigures:!0},images:{provider:``,model:``},articlePrompt:``,narrationPrompt:``,imagePrompts:[],thumbnailPrompt:``,intro:``,outro:``,chunking:{mode:`whole`,words:`500`,characters:`3000`},subtitles:{...GD,fontSize:`48`},imageSeconds:`15`,edgeSilenceSeconds:`2`,zoomPercent:String(VE),motionStyle:HE,videoEdit:dle,showFigures:!0,values:{},provided:{research:``,article:``,audio:null,images:[],thumbnail:null}},section:`content`,variants:[],expectedWords:`1500`,previewText:`Every story begins with a word.`,fontUpload:null}),Rk={};function Aue(e){Rk=e}function zk(e,t=Rk){let{form:n}=e;return n.llm.provider!==``||n.images.provider!==``||t.llm===void 0&&t.images===void 0?e:{...e,form:{...n,...t.llm===void 0?{}:{llm:{...t.llm}},...t.images===void 0?{}:{images:{...t.images}}}}}function jue(e){let t={...e.sources,...e.sources.article===`generate`?{}:{research:`off`},...e.sources.images===`off`?{video:`off`}:{}},n=t.audio===`off`?`off`:t.video===`off`&&e.subtitles.mode===`burn-in`?`files`:e.subtitles.mode;return{...e,sources:t,subtitles:{...e.subtitles,mode:n}}}function Mue(e){let t=oO.parse(e);return JSON.stringify({...t,form:jue(t.form)})}function Nue(e,t,n){return{...e,acknowledged:Math.max(e.acknowledged,t),version:n}}function Bk(e,t){return t.type===`edit`?{...e,edited:e.edited+1}:Nue(e,t.generation,t.version)}function Vk(e,t,n){return{mutationId:n,document:oO.parse(JSON.parse(Mue(e))),generation:t.edited,baseVersion:t.version}}function Hk(){return{document:zk(Lk),view:null,clock:{edited:0,acknowledged:0,version:0},id:null,recoveryId:null,pending:null,status:`unsaved`,error:null,reveal:null}}function Pue(e,t,n){let r=e.form.provided,i=t.form.provided,a=new Map;for(let[e,t]of[[r.audio,i.audio],[r.thumbnail,i.thumbnail],[r.shortsMusic,i.shortsMusic],[r.ambientBed,i.ambientBed],...r.images.map((e,t)=>[e,i.images[t]])])e&&t&&a.set(e.attachmentId,t.attachmentId);let o=e=>e?{...e,attachmentId:a.get(e.attachmentId)??e.attachmentId}:null;return{...n,form:{...n.form,provided:{...n.form.provided,audio:o(n.form.provided.audio),thumbnail:o(n.form.provided.thumbnail),...n.form.provided.shortsMusic===void 0?{}:{shortsMusic:o(n.form.provided.shortsMusic)},...n.form.provided.ambientBed===void 0?{}:{ambientBed:o(n.form.provided.ambientBed)},images:n.form.provided.images.map(e=>({...e,attachmentId:a.get(e.attachmentId)??e.attachmentId}))}}}}function Fue(e,t){if(e.draft.id!==t.id)return e;let n=t.document.form.provided,r=new Set([n.audio,n.thumbnail,n.shortsMusic,n.ambientBed,...n.images].flatMap(e=>e?[e.attachmentId]:[]));return{...e,attachments:e.attachments.filter(e=>r.has(e.id)).map(e=>{let n=t.view?.attachments.find(t=>t.id===e.id);return(e.state===`pending`||e.state===`copying`)&&(n?.state===`ready`||n?.state===`reattach`)?n:e})}}function Uk(e,t){let n={...GD,...e},r=t.audio===`off`?`off`:(t.video===`off`||t.images===`off`)&&n.mode===`burn-in`?`files`:n.mode;if(r!==`off`)return{...n,mode:r};let i=WD.shape.fontId.safeParse(n.fontId),a=WD.shape.fontSize.safeParse(n.fontSize);return{...n,mode:r,fontId:i.success?i.data:GD.fontId,fontSize:a.success?a.data:GD.fontSize}}function Wk(e){return e.mode===`off`||e.fontId!==``&&Number.isInteger(e.fontSize)&&e.fontSize>=16&&e.fontSize<=120}function Iue(e){return e===`shortsMusic`||e===`ambientBed`?`audio`:e}function Gk(e){return e.shorts?.enabled===!0&&e.sources.audio!==`off`}function Kk(e){return e.ambientBed?.source===`upload`&&e.sources.video===`generate`&&e.sources.audio!==`off`}function Lue(e){let t=e=>e.trim()===``?NaN:Number(e);return{enabled:e.enabled,count:t(e.count),minSeconds:t(e.minSeconds),maxSeconds:t(e.maxSeconds),...e.prompt.trim()?{prompt:e.prompt}:{},...e.imagePrompt.trim()?{imagePrompt:e.imagePrompt}:{},...oE(e)}}({...Lk.form}),{...Lk.form.sources};var qk={off:`Off`,generate:`Generate`,provide:`Provide`,from_prompt:`From prompt`,prompt_by_llm:`Prompt by LLM`};function Jk(e){return GE[e].map(e=>({value:e,label:qk[e]}))}function Yk(e,t){return JE(Xk({form:e,entries:t,slots:[],silenceGapSeconds:0}))}function Rue(e,t,n){if(n!==``)return e.find(e=>e.category===t&&e.name===n)?.mode}function zue(e){return[e.audio,e.thumbnail,e.shortsMusic,e.ambientBed,e.reference,...e.images].flatMap(e=>e?.file===void 0?[]:[e.file])}function Xk(e){let{form:t}=e;return{...t.checkpoints===void 0?{}:{checkpoints:t.checkpoints},title:t.title,format:t.format,sources:{...t.sources,...t.sources.article===`provide`?{research:`off`}:{},...t.sources.images===`off`?{video:`off`}:{}},llm:t.llm,audio:t.audio,images:t.images,...t.sources.images===`generate`&&t.reference!==void 0&&t.reference.source!==`off`?{reference:{source:t.reference.source,...t.reference.source===`prompt`?{prompt:t.reference.prompt}:{},thumbnail:t.reference.thumbnail}}:{},articlePrompt:t.articlePrompt,...t.narrationPrompt===void 0?{}:{narrationPrompt:t.narrationPrompt},...t.language===void 0||t.language===`en`?{}:{language:t.language},...t.sources.video===`generate`&&t.sources.images!==`off`&&t.sources.audio===`generate`&&t.audio.describeFigures===!0&&t.showFigures===!0?{showFigures:!0}:{},...t.sources.audio!==`off`&&t.youtubeDescription===!0?{youtubeDescription:!0,...t.descriptionPrompt?.trim()?{descriptionPrompt:t.descriptionPrompt}:{}}:{},...Gk(t)&&t.shorts!==void 0?{shorts:Lue(t.shorts)}:{},imagePrompts:t.imagePrompts,thumbnailPrompt:t.thumbnailPrompt,...t.thumbnailCount===3&&(t.sources.thumbnail===`from_prompt`||t.sources.thumbnail===`prompt_by_llm`)?{thumbnailCount:3}:{},...Zk(Qk(e,`intro`),e=>({intro:e})),...Zk(Qk(e,`outro`),e=>({outro:e})),values:Bue(t.values,e.slots),provided:{research:t.provided.research,article:t.provided.article,...Zk(t.provided.audio?.file,e=>({audio:e.id})),...Zk(t.provided.thumbnail?.file,e=>({thumbnail:e.id})),...Zk(t.sources.images===`generate`&&t.reference?.source===`provide`?t.provided.reference?.file:void 0,e=>({reference:e.id})),images:t.provided.images.flatMap(e=>e.file===void 0?[]:[e.file.id]),...Gk(t)?Zk(t.provided.shortsMusic?.file,e=>({shortsMusic:e.id})):{},...t.ambientBed?.source===`upload`?Zk(t.provided.ambientBed?.file,e=>({ambientBed:e.id})):{}},chunking:t.chunking,subtitles:Uk(t.subtitles,t.sources),silenceGapSeconds:e.silenceGapSeconds,imageSeconds:t.imageSeconds,edgeSilenceSeconds:t.edgeSilenceSeconds,zoomPercent:t.zoomPercent,motionStyle:t.motionStyle,...t.videoEdit===void 0?{}:{videoEdit:t.videoEdit},...t.voices!==void 0&&t.sources.audio===`generate`?{voices:t.voices}:{},...t.sources.document===`generate`?{document:t.document}:{},...Zk(t.sources.video===`generate`&&t.sources.audio!==`off`?pE(t.ambientBed):void 0,e=>({ambientBed:e})),...t.sources.audio===`generate`?Hce(t):{},...t.sources.audio===`generate`?Oue(t):{},...t.sources.audio===`generate`?kue(t):{},...t.sources.audio===`generate`&&t.levelSentences===!0?{levelSentences:!0}:{},...Zk(t.sources.audio===`off`?void 0:zce(t.loudness,e.loudness??RT),e=>({loudness:e}))}}function Zk(e,t){return e===void 0?{}:t(e)}function Qk(e,t){if(e.form.sources.audio!==`generate`)return;let n=t===`intro`?e.form.intro:e.form.outro,r=Rue(e.entries,t,n);return n===``||r===void 0?void 0:{name:n,mode:r}}function Bue(e,t){let n=Object.create(null);for(let r of t)n[r]=Object.hasOwn(e,r)?e[r]??``:``;return n}function $k(e,t){return e?.draftId===t.draftId&&e.version===t.version&&e.editGeneration===t.editGeneration}function Vue({api:e,queryClient:t,current:n,flush:r,resave:i,render:a}){let o={receipt:null,pending:!1,starting:!1,uncertain:!1,valid:!1,error:null,fields:[],created:null},s,c=0,l=0,u=null,d=e=>{o={...o,...e},a()},f=()=>({draftId:n().id??``,version:n().clock.version,editGeneration:n().clock.edited}),p=()=>$k(s,f())&&n().clock.edited===n().clock.acknowledged&&o.receipt?.runs.length===eA(n().document),m=(e=!1)=>{c++,s=void 0,d({valid:!1,...e?{fields:[],error:null}:{}})},h=e=>d({error:e.message,fields:e.fields,valid:!1}),g=e=>{u=null,d({created:e,uncertain:!1,starting:!1,valid:!1})},_=async()=>{let t=u?.draftId;if(!t)return;let n=await bk(e,t);if(!n.ok){h(n);return}n.value.start&&g(n.value.start)};return{reset:()=>{c++,l++,s=void 0,u=null,o={receipt:null,pending:!1,starting:!1,uncertain:!1,valid:!1,error:null,fields:[],created:null},a()},state:()=>({...o,valid:o.valid&&p()}),invalidate:m,restore:e=>{c++,l++,s=void 0,u=e.pendingStart?{draftId:e.draft.id,baseVersion:e.pendingStart.draftVersion,reviewId:e.pendingStart.reviewId}:null,o={receipt:null,pending:!1,starting:!1,uncertain:u!==null,valid:!1,error:null,fields:[],created:e.start},a()},review:async()=>{if(o.pending||o.starting||o.uncertain||o.created)return;let a=++l;d({pending:!0,valid:!1,error:null,fields:[]});try{if(await Promise.all([Fk(e,t),t.refetchQueries({queryKey:[`provider-models`]})]),a!==l||!await r()||!n().id)return;let o=f(),u=c,p=await wk(e,{id:o.draftId,baseVersion:o.version});if(a!==l||u!==c||!$k(o,f()))return;if(!p.ok){h(p);return}if(p.value.draftId!==o.draftId||p.value.draftVersion!==o.version)return;let m=eA(n().document);if(p.value.runs.length!==m){d({receipt:null,valid:!1,error:`The saved draft has ${Hue(p.value.runs.length)}, but this page shows ${m}. Slopify saved this page again. Press Refresh review, then start.`}),i();return}s=o,d({receipt:p.value,valid:!0})}catch(e){a===l&&d({error:e instanceof Error?e.message:`This setup couldn't be checked. Press Refresh review to try again.`})}finally{a===l&&d({pending:!1})}},start:async()=>{if(o.starting||o.created||!u&&(!o.valid||!p()||o.pending||!o.receipt||rA(n().document,n().view)!==void 0)||(!u&&o.receipt&&(u={draftId:o.receipt.draftId,baseVersion:o.receipt.draftVersion,reviewId:o.receipt.id}),!u))return;let t=u;Nk(t.draftId),d({starting:!0,error:null});try{if(o.uncertain&&(await _(),o.created))return;let n=await Tk(e,t);if(n.ok){g(n.value);return}n.reason===`pending-start`||n.reason===`already-started`?(d({uncertain:!0}),await _()):(u=null,d({uncertain:!1}),h(n))}catch(e){d({uncertain:!0,valid:!1,error:`${bo(e instanceof Error?e.message:`Slopify didn't confirm the start`)} The run may already have started. Press Check whether it started to find out before trying again.`})}finally{d({starting:!1})}}}}function eA(e){return e.variants.length+1}function Hue(e){return e===1?`1 video`:`${e} videos`}function tA(e,t){if(e.starting)return`Starting…`;if(e.uncertain)return`Check whether it started`;let n=e.valid&&e.receipt?e.receipt.runs.length:eA(t);return n===1?`Start run`:nA(t)?`Queue ${n} videos`:`Start ${n} videos`}function nA(e){return e.queue!==!1}function rA(e,t){if(e.fontUpload!==null)return`subtitles.fontUpload`;let{sources:n,provided:r}=e.form;return[...n.audio===`provide`&&r.audio?[{ref:r.audio,field:`provided.audio`}]:[],...n.thumbnail===`provide`&&r.thumbnail?[{ref:r.thumbnail,field:`provided.thumbnail`}]:[],...n.images===`provide`?r.images.map((e,t)=>({ref:e,field:`provided.images.${t}`})):[],...Gk(e.form)&&r.shortsMusic?[{ref:r.shortsMusic,field:`shorts.music`}]:[],...Kk(e.form)&&r.ambientBed?[{ref:r.ambientBed,field:`ambientBed.file`}]:[]].find(({ref:e})=>t?.attachments.find(t=>t.id===e.attachmentId)?.state!==`ready`)?.field}function Uue(e,t){return e?.draftId===t.draftId&&e.attachmentId===t.attachmentId}function Wue({api:e,queryClient:t,state:n,edit:r,flush:i,generation:a,publish:o,render:s}){let c=(0,m.useRef)(0),l=(0,m.useRef)(null),u=(0,m.useRef)(null),d=(0,m.useRef)(new Map),f=(0,m.useRef)(new Map),p=e=>{let t=n.current.document.form.provided,r=[t.audio,t.thumbnail,t.shortsMusic,t.ambientBed,t.reference,...t.images].find(t=>t?.attachmentId===e.attachmentId);return Uue(r&&n.current.id?{draftId:n.current.id,attachmentId:r.attachmentId}:void 0,e)};(0,m.useEffect)(()=>{for(let[e,t]of d.current)t!==a()&&d.current.delete(e);for(let[e,t]of f.current)(!p(t.owner)||t.generation!==a())&&(t.controller.abort(),f.current.delete(e))}),(0,m.useEffect)(()=>{let e=f.current,t=d.current;return()=>{c.current++,t.clear();for(let t of e.values())t.controller.abort();e.clear()}},[]);let h=async(t,l,u)=>{if(l.length===0)return;let m=Iue(t),h=m===`images`&&!u?l:l.slice(-1),g=h.map(e=>({attachmentId:crypto.randomUUID(),name:e.name})),_=c.current,v=a();for(let e of g)d.current.set(e.attachmentId,v);let y=n.current.document,b=y.form.provided;r({...y,form:{...y.form,provided:m===`images`?{...b,images:u?b.images.flatMap(e=>e.attachmentId===u?g:[e]):[...b.images,...g]}:{...b,[t]:g.at(-1)??null}}});let x=await i();for(let e of g)d.current.delete(e.attachmentId);if(!x||v!==a()||_!==c.current){s();return}let S=n.current.id;S&&await Promise.all(g.map(async(t,r)=>{let i=h[r],s={draftId:S,attachmentId:t.attachmentId};if(!i||!p(s))return;let l=new AbortController;f.current.set(t.attachmentId,{owner:s,controller:l,generation:v});let u=e=>{let r=n.current.view;v===a()&&_===c.current&&r?.draft.id===S&&p(s)&&!l.signal.aborted&&o({view:{...r,review:null,attachments:[...r.attachments.filter(e=>e.id!==t.attachmentId),e]}})};try{let n=await Dk(e,S,t.attachmentId,i,l.signal);n.ok?u(n.value):u({id:t.attachmentId,kind:m,name:t.name,state:`reattach`,stagedFileId:null,bytes:0,error:n.message})}catch(e){u({id:t.attachmentId,kind:m,name:t.name,state:`reattach`,stagedFileId:null,bytes:0,error:e instanceof Error?e.message:`Reattach this file`})}finally{f.current.delete(t.attachmentId)}}))},g=e=>{l.current=null;let t=n.current.document;r({...t,fontUpload:null,form:{...t.form,subtitles:{...t.form.subtitles,fontId:e}}})},_=async o=>{let d=crypto.randomUUID();l.current=d,r({...n.current.document,fontUpload:{operationId:d,name:o.name}});let f=c.current,p=a();if(!await i()||p!==a()||f!==c.current){l.current===d&&(l.current=null),s();return}if(n.current.document.fontUpload?.operationId===d)try{let{font:r}=await Ak(e,o);if(p!==a()||f!==c.current||n.current.document.fontUpload?.operationId!==d)return;t.setQueryData(Ok,e=>({fonts:[...(e?.fonts??[]).filter(e=>e.id!==r.id),r]})),g(r.id),await i()}catch(e){p===a()&&f===c.current&&n.current.document.fontUpload?.operationId===d&&(u.current={operationId:d,message:e instanceof Error?e.message:`Reattach this font`},s())}finally{l.current===d&&(l.current=null,s())}},v=l.current!==null&&l.current===n.current.document.fontUpload?.operationId;return{attachmentUploading:e=>{let t=f.current.get(e);return d.current.get(e)===a()||t!==void 0&&t.generation===a()&&p(t.owner)&&!t.controller.signal.aborted},fontUpload:{pending:v,error:u.current?.operationId===n.current.document.fontUpload?.operationId?u.current?.message:void 0,pick:e=>{_(e)}},attach:h,selectFont:g,uploadSubtitleFont:_,fontUploading:v}}function Gue(e,t,n){(0,m.useEffect)(()=>{let r=e=>[`prompts`,`entries`,`providers`,`provider-models`,`fonts`,`settings`].includes(String(e[0])),i=t.getQueryCache().subscribe(e=>{e.type===`updated`&&r(e.query.queryKey)&&(e.action.type===`success`||e.action.type===`invalidate`)&&n.invalidate()}),a=()=>{n.invalidate(),Fk(e,t),t.refetchQueries({queryKey:[`provider-models`]})};return window.addEventListener(`focus`,a),()=>{i(),window.removeEventListener(`focus`,a)}},[e,t,n])}function Kue(){let{api:e}=V(),t=_(),[,n]=(0,m.useReducer)(e=>e+1,0),r=(0,m.useRef)(Hk()),i=(0,m.useMemo)(()=>{let i,a=null,o=!1,s=0,c=!1,l=null,u=!0,d=e=>{r.current={...r.current,...e},u&&n()},f=()=>{clearTimeout(i),i=void 0},p=()=>{t.invalidateQueries({queryKey:[`play-drafts`]})},m=e=>{d({status:`error`,error:e instanceof Error?e.message:`Your latest changes weren't saved. Keep this page open and try again.`})},h=e=>e.ok?!0:(d({status:e.reason===`conflict`?`conflict`:`error`,error:e.message}),!1),g=e=>{b.restore(e),d({...Hk(),document:e.draft.document,view:e,id:e.draft.id,clock:{edited:0,acknowledged:0,version:e.draft.version},status:`saved`}),Nk(e.draft.id),p()},_=async()=>{let t=s;for(;r.current.clock.edited>r.current.clock.acknowledged;){if(r.current.status===`conflict`||t!==s||l!==null&&l===r.current.id)return!1;let n=r.current,i=n.id??crypto.randomUUID(),a=n.pending??Vk(n.document,n.clock,crypto.randomUUID());d({id:i,pending:a,status:`saving`,error:null});try{let n=a.baseVersion===0?await yk(e,{id:i,document:a.document}):await xk(e,{id:i,baseVersion:a.baseVersion,mutationId:a.mutationId,document:a.document});if(t!==s)return!1;if(!h(n))return n.reason!==`conflict`&&d({pending:null}),!1;let c=Bk(r.current.clock,{type:`acknowledge`,generation:a.generation,version:n.value.draft.version});if(d({clock:c,view:{...Fue(n.value,r.current),review:c.edited>c.acknowledged?null:n.value.review},pending:null,status:c.edited>c.acknowledged?`unsaved`:`saved`,error:null}),Nk(i),p(),!o)return!0}catch(e){return t===s&&m(e),!1}}return r.current.status!==`conflict`&&r.current.status!==`error`},v=()=>c?Promise.resolve(!1):a||(r.current.clock.edited===r.current.clock.acknowledged?Promise.resolve(!0):l!==null&&l===r.current.id?Promise.resolve(!1):(a=_().finally(()=>{a=null}),a)),y=()=>(f(),o=!0,v()),b=Vue({api:e,queryClient:t,current:()=>r.current,flush:y,resave:()=>x(r.current.document),render:()=>{u&&n()}}),x=e=>{if(b.state().starting||b.state().uncertain||b.state().created)return;b.invalidate(JSON.stringify({...e,section:r.current.document.section})!==JSON.stringify(r.current.document));let t=r.current;d({document:e,clock:Bk(t.clock,{type:`edit`}),view:t.view?{...t.view,review:null}:null,status:t.status===`conflict`||t.status===`error`?t.status:`unsaved`}),f(),!(c||l!==null&&l===t.id||t.status===`conflict`||t.status===`error`)&&(t.id?i=setTimeout(()=>{y()},500):(o=!1,v()))},S=async(n,i=()=>!0)=>{if(b.state().starting||b.state().uncertain||b.state().created||(r.current.id!==n||r.current.status!==`conflict`)&&!await y()||!i())return!1;let a=++s,o=r.current.clock.edited;f();try{let c=await bk(e,n);return a!==s||o!==r.current.clock.edited||!i()?!1:h(c)?(T=null,g(c.value),await Fk(e,t),i()):(r.current.id||d({recoveryId:n}),!1)}catch(e){return a===s&&o===r.current.clock.edited&&(m(e),r.current.id||d({recoveryId:n})),!1}},C=async()=>{if(b.state().starting||b.state().uncertain||b.state().created)return;let e=s;await y()&&e===s&&(s++,T=null,d(Hk()),b.reset(),Nk(null))},w=async({id:t,version:n})=>{if(b.state().starting||b.state().uncertain||b.state().created)throw Error(`Resolve the pending Start before discarding a draft`);if(c||l!==null)throw Error(`Wait for the current draft operation before discarding`);let i=s;l=t,(r.current.id??r.current.recoveryId)===t&&f();try{a&&await a;let o=await Ck(e,{id:t,baseVersion:n});if(!o.ok&&o.reason!==`not-found`)throw Error(o.message);if(p(),i!==s||(r.current.id??r.current.recoveryId)!==t)return;f(),s++,T=null,d(Hk()),b.reset(),Nk(null)}finally{l=null}},T=null;return{review:b,takeCreated:()=>{let e=b.state().created;if(!e)return null;s++,d(Hk()),b.reset(),Nk(null);for(let e of[[`projects`],[`staging`],[`play-drafts`]])t.invalidateQueries({queryKey:e});return e},edit:x,flush:y,open:S,newDraft:C,adoptDefaults:e=>{let t=r.current;if(t.id!==null||t.clock.edited>0||t.view!==null)return;let n=zk(t.document,e);n!==t.document&&d({document:n})},adoptChannel:e=>{let t=r.current;if(t.id!==null||t.clock.edited>0||t.view!==null)return;let n=t.document;n.channelId===void 0&&n.templateSource===void 0&&d({document:{...n,channelId:e}})},discard:w,saveAsNew:async()=>{if(b.state().starting||b.state().uncertain||b.state().created||(f(),c||l!==null))return;a&&await a;let t=r.current;if(!t.id||!t.view&&t.status!==`conflict`){await y();return}let n=s;T?.sourceId!==t.id&&(T=null),T??={sourceId:t.id,id:crypto.randomUUID(),document:Vk(t.document,t.clock,crypto.randomUUID()).document,generation:t.clock.edited};let i=T;c=!0;try{let t=await Sk(e,{sourceId:i.sourceId,id:i.id,document:i.document});if(n!==s)return;if(!h(t)){t.reason===`conflict`&&(T=null);return}let a=r.current.clock.edited>i.generation?r.current.document:null;s++,g(t.value),T=null,c=!1,a&&x(Pue(i.document,t.value.draft.document,a))}catch(e){n===s&&m(e)}finally{c=!1}},navigate:async(e,t)=>{let n=s,i={...r.current.document,section:e};r.current.id||r.current.clock.edited>0?x(i):d({document:i}),await y()&&n===s&&d({reveal:{section:e,...t===void 0?{}:{field:t},sequence:(r.current.reveal?.sequence??0)+1}})},generation:()=>s,publish:d,start:()=>{u=!0;let e=Pk();e&&S(e)},stop:()=>{u=!1,f()}}},[e,t]);(0,m.useEffect)(()=>(i.start(),i.stop),[i]),Gue(e,t,i.review);let a=Wue({api:e,queryClient:t,state:r,edit:i.edit,flush:i.flush,generation:i.generation,publish:i.publish,render:n}),o=r.current;return{...a,review:i.review.state(),reviewDraft:i.review.review,startRun:i.review.start,invalidateReview:i.review.invalidate,takeCreated:i.takeCreated,document:o.document,section:o.document.section,view:o.view,status:o.status,error:o.error,edited:o.clock.edited,acknowledged:o.clock.acknowledged,reveal:o.reveal,edit:i.edit,flush:i.flush,open:i.open,generation:i.generation,newDraft:i.newDraft,adoptDefaults:i.adoptDefaults,adoptChannel:i.adoptChannel,discard:i.discard,saveAsNew:i.saveAsNew,navigate:i.navigate,activeId:o.id??o.recoveryId}}var iA=(0,m.createContext)(null);function que({children:e}){let t=Kue();return(0,h.jsx)(iA.Provider,{value:t,children:e})}function Jue(){return(0,m.useContext)(iA)}function aA(){let e=(0,m.useContext)(iA);if(!e)throw Error(`PlayDraftProvider is required`);return e}var Yue={research:[],article:[`research`],audio:[`article`],images:[],thumbnail:[`article`],video:[`article`,`audio`,`images`],document:[`article`,`thumbnail`]},Xue={document:[`thumbnail`]};function oA(e){return e===`done`||e===`provided`||e===`skipped`}function Zue(e,t,n){return oA(n)?!0:(n===`failed`||n===`canceled`)&&(Xue[e]?.includes(t)??!1)}function Que(e){return e.some(t=>$ue(t,e))}function $ue(e,t){let n=e=>t.find(t=>t.kind===e)?.source??`generate`;return e.state===`pending`&&e.parked===!0&&ede(e.kind,{thumbnail:n(`thumbnail`),video:n(`video`)}).every(n=>{let r=t.find(e=>e.kind===n);return r===void 0||Zue(e.kind,n,r.state)})}function ede(e,t){return e===`thumbnail`&&t.thumbnail===`from_prompt`?[]:e===`video`&&t.video===`off`?[`article`,`audio`]:e===`document`&&t.thumbnail===`off`?[`article`]:Yue[e]}function tde(e){let t=e.filter(e=>e.state!==`provided`&&e.state!==`skipped`);return t.length===0?1:t.reduce((e,t)=>e+nde(t),0)/t.length}function nde(e){if(oA(e.state))return 1;if(e.state!==`running`)return 0;let t=e.progressTotal??0;return t<=0?0:Math.min(1,Math.max(0,(e.progressCurrent??0)/t))}var sA={running:`Running`,paused:`Paused`,pending:`Queued`,failed:`Failed`,partial:`Done with problems`,done:`Done`,canceled:`Canceled`},cA={pending:`Not started`,running:`Running`,done:`Done`,provided:`Provided`,failed:`Failed`,canceled:`Canceled`,skipped:`Off`},lA=`Waiting for your review`,uA=`Waiting for the agent`,dA=`Stopped`,fA=`Prepared`,pA=`Kept as is`;function mA(e){return e.status===`pending`&&(e.progress>0||e.stepFailed===!0||e.stopped===!0||e.waitingForAgent===!0)}function rde(e){return e.setAside!==!0&&e.waitingForAgent!==!0&&e.prepared!==!0}function hA(e){return e.setAside===!0?pA:e.waitingForAgent===!0?uA:e.stopped===!0?dA:e.prepared===!0?fA:lA}function gA(e){return e.status===`pending`&&e.waitingForAgent===!0&&e.setAside!==!0}function _A(e){return e.status===`running`||gA(e)}function vA(e){return e.status===`pending`&&!mA(e)}function yA(e){return e.status===`paused`||mA(e)&&rde(e)}function ide(e,t){return(e===`running`||e===`pending`)&&t.some(e=>e.state===`failed`)&&Que(t)}function bA(e){return e.status===`failed`||e.stepFailed===!0}var xA={research:`Research`,article:`Article`,audio:`Audio`,images:`Images`,thumbnail:`Thumbnail`,video:`Video`,document:`Document`};function SA(e){return e.sources.video===`off`?e.sources.audio===`off`?`article`:`audio`:`video`}function ade(e,t){return e===`video`&&SA(t)===`audio`?`Audio export`:xA[e]}function CA(e,t){return e.kind===`video`&&e.state===`running`&&t.subtitles!==void 0&&t.subtitles.mode!==`off`&&e.progressTotal===100&&(e.progressCurrent??0)<=35}var ode={research:(e,t)=>`chapter ${String(e)} of ${String(t)}`,article:(e,t)=>`${String(e)} of ${String(t)}`,audio:(e,t)=>`chunk ${String(e)} of ${String(t)}`,images:(e,t)=>`image ${String(e)} of ${String(t)}`,thumbnail:(e,t)=>`${String(e)} of ${String(t)}`,video:(e,t)=>`${String(AA(e,t))}% rendered`,document:(e,t)=>`${String(e)} of ${String(t)}`},sde={audio_intro:`intro`,audio_body:`body`,audio_outro:`outro`};function wA(e,t,n,r=!1){let i=t.filter(t=>t.stageKind===e.kind);switch(e.state){case`skipped`:return`Not part of this run`;case`pending`:return n.status===`paused`?`Waits until you continue the run`:n.status===`pending`&&n.setAside===!0?pA:r?`Waits until you continue the run`:gA(n)?uA:e.retryAt===void 0?e.kind===`images`||e.kind===`thumbnail`&&e.source===`from_prompt`?`Ready to run`:`Waits for the stages above`:`Trying again at ${DA(e.retryAt)}`;case`provided`:return dde(i)??`Provided`;case`failed`:return`Stopped after ${lde(e)}`;case`canceled`:return`Canceled by user`;case`running`:return CA(e,n.config)?`Preparing subtitles · ${String(AA(e.progressCurrent??0,35))}%`:e.activity===void 0?e.kind===`video`&&SA(n.config)===`audio`?`Exporting combined audio`:e.progressTotal===null||e.progressTotal<=0?`Running`:ode[e.kind](e.progressCurrent??0,e.progressTotal):EA(TA(e)??``);case`done`:return ude(e.kind,i,n)}}function TA(e){let t=e.activity;if(t!==void 0)return t.percent===void 0?t.done!==void 0&&t.total!==void 0?`${t.label} (${String(t.done)} of ${String(t.total)})`:t.label:`${t.label} (${String(t.percent)}%)`}function EA(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function cde(e){let t=e.activity;if(t?.percent!==void 0)return t.percent/100;if(t?.done!==void 0&&t.total!==void 0&&t.total>0)return t.done/t.total;if(t===void 0&&!(e.progressTotal===null||e.progressTotal<=0))return Math.min(1,Math.max(0,(e.progressCurrent??0)/e.progressTotal))}function DA(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function lde(e){return e.attemptCount===1?`1 attempt`:`${String(e.attemptCount)} attempts`}function ude(e,t,n){switch(e){case`research`:return`Notes ready`;case`article`:{let e=t.filter(e=>e.role===`sources`||e.role===`glossary`);return e.length===0?`Article ready`:`Article and ${String(e.length)} end-matter files`}case`audio`:return MA([pde(t.flatMap(e=>{let t=sde[e.role];return t===void 0?[]:[t]})),kA(OA(t))]);case`images`:return fde(t.filter(e=>e.role===`image`).length,`image`);case`thumbnail`:return t.length===0?`Thumbnail ready`:`1 image`;case`video`:return MA([kA(OA(t)),SA(n.config)===`audio`?`WAV · stereo · 48 kHz`:n.format]);case`document`:return`PDF · ${TD(n.config.document)} theme`}}function dde(e){let t=e.flatMap(e=>e.originalFilename===null?[]:[e.originalFilename]);return t.length===0?void 0:t.join(`, `)}function OA(e){let t=Math.max(0,...e.map(e=>e.durationMs??0));return t===0?void 0:t}function kA(e){if(e===void 0||!Number.isFinite(e)||e<=0)return;let t=Math.round(e/1e3),n=[Math.floor(t/60)%60,t%60].map(e=>String(e).padStart(2,`0`)),r=Math.floor(t/3600);return r===0?n.join(`:`):[String(r),...n].join(`:`)}function AA(e,t){return t<=0?0:Math.min(100,Math.max(0,Math.round(e/t*100)))}function fde(e,t){return e===1?`1 ${t}`:`${String(e)} ${t}s`}function pde(e){if(e.length!==0)return e.length===1?jA(e[0]??``):jA(`${e.slice(0,-1).join(`, `)} and ${e[e.length-1]??``}`)}function jA(e){return e.charAt(0).toUpperCase()+e.slice(1)}function MA(e){return e.filter(e=>e!==void 0&&e!==``).join(` · `)}var NA=12,PA=16;function FA(e,t,n){return Math.max(t,Math.min(e,Math.max(t,n)))}function mde(e,t,n){let r=Math.min(n.width,t.width-24),i=FA(e?.left??(t.width-r)/2,NA,t.width-r-NA),a=FA((e?.top??0)+((e?.height??t.height)-n.height)/2,NA,t.height-n.height-NA),o=t.height-n.height-NA;if(!e)return{left:i,top:a,width:r,docked:!1};let s=e.left+e.width,c=e.top+e.height;return s+PA+r<=t.width-NA?{left:s+PA,top:a,width:r,docked:!1}:e.left-PA-r>=NA?{left:e.left-PA-r,top:a,width:r,docked:!1}:c>=NA&&c+PA+n.height<=t.height-NA?{left:i,top:c+PA,width:r,docked:!1}:e.top-PA-n.height>=NA&&e.top<=t.height-NA?{left:i,top:e.top-PA-n.height,width:r,docked:!1}:{left:t.width-r-NA,top:Math.max(NA,o),width:r,docked:!0}}function IA(e,t,n=t.height){let r=FA(e.left-6,0,t.width),i=FA(e.top-6,0,Math.min(n,t.height)),a=FA(e.left+e.width+6,0,t.width),o=FA(e.top+e.height+6,0,Math.min(n,t.height));return a>r&&o>i?{left:r,top:i,width:a-r,height:o-i}:null}var hde=`[data-slot="select-content"], [data-slot="dropdown-menu-content"], [data-slot="menu-content"]`;function LA(e){try{return document.querySelector(e)}catch{return null}}function RA(){return[...document.querySelectorAll(`[data-slot="dialog-content"][data-state="open"]`)].at(-1)??null}function zA(e){if(!e)return[];let t=[e,...e.querySelectorAll(`[aria-controls]`)],n=new Set(t.flatMap(e=>(e.getAttribute(`aria-controls`)??``).split(` `)));return[...document.querySelectorAll(hde)].filter(e=>n.has(e.id))}function BA(e){let t=e.getBoundingClientRect();return t.width>0&&t.height>0?{left:t.left,top:t.top,width:t.width,height:t.height}:null}var gde=`a[href], button, input, select, textarea, summary, [tabindex], [contenteditable="true"]`;function _de(e,t,n,r){let i=(0,m.useRef)(document.activeElement),a=(0,m.useRef)(t);a.current=t,(0,m.useEffect)(()=>{let e=i.current;return()=>{queueMicrotask(()=>{e instanceof HTMLElement&&e.isConnected&&!n.current&&e.focus({preventScroll:!0})})}},[n]),(0,m.useEffect)(()=>{let t=()=>{let t=LA(e);return[t,n.current,...zA(t)].filter(e=>e!==null)},i=e=>e instanceof Node&&t().some(t=>t.contains(e)),o=e=>{RA()||i(e.target)||(e.preventDefault(),e.stopImmediatePropagation())},s=e=>{RA()||i(e.target)||e.target instanceof HTMLElement&&e.target.hasAttribute(`data-radix-focus-guard`)||r.current?.focus({preventScroll:!0})},c=n=>{if(RA())return;let r=zA(LA(e));if(n.key===`Escape`){if(r.length>0)return;n.preventDefault(),n.stopImmediatePropagation(),a.current();return}if(n.key!==`Tab`){i(n.target)||o(n);return}if(r.length>0)return;let s=t().flatMap(e=>[e,...e.querySelectorAll(gde)]).filter((e,t,n)=>n.indexOf(e)===t&&e.tabIndex>=0&&!e.matches(`:disabled, [hidden], [aria-hidden='true']`)&&!e.closest(`[hidden], [inert]`)&&(!e.closest(`details:not([open])`)||e.closest(`summary`)!==null));if(s.length===0)return;let c=s.indexOf(document.activeElement),l=c===-1?n.shiftKey?s.length-1:0:(c+(n.shiftKey?-1:1)+s.length)%s.length;n.preventDefault(),s[l]?.focus()},l=[`pointerdown`,`pointerup`,`mousedown`,`mouseup`,`click`,`dblclick`,`contextmenu`];for(let e of l)window.addEventListener(e,o,!0);return window.addEventListener(`keydown`,c,!0),window.addEventListener(`focusin`,s,!0),()=>{for(let e of l)window.removeEventListener(e,o,!0);window.removeEventListener(`keydown`,c,!0),window.removeEventListener(`focusin`,s,!0)}},[e,n,r])}function vde(e,t,n,r,i,a){let[o,s]=(0,m.useState)(()=>({key:e,target:null,portals:[],width:window.innerWidth,height:window.innerHeight,cardHeight:260,modalOpen:RA()!==null}));return(0,m.useLayoutEffect)(()=>{let o=0,c=0,l=null,u=null,d=new Map,f=new ResizeObserver(()=>h()),p=e=>{for(let[t,n]of d)e.has(t)||(t.style.zIndex=n,d.delete(t))},m=()=>{o=0;let r=LA(t);r!==u&&(u&&f.unobserve(u),r&&f.observe(r),u=r);let i=r?BA(r):null;r&&i&&l!==r&&(l=r,cancelAnimationFrame(c),c=requestAnimationFrame(()=>{c=0,r.isConnected&&(r.scrollIntoView({block:`start`,inline:`nearest`,behavior:`instant`}),m())}));let a=zA(r),h=new Set;for(let e of a){let t=e.closest(`[data-radix-popper-content-wrapper]`)??e;h.add(t),d.has(t)||(d.set(t,t.style.zIndex),t.style.zIndex=`102`)}p(h);let g={key:e,target:i,portals:a.map(BA).filter(e=>e!==null),width:window.innerWidth,height:window.innerHeight,cardHeight:n.current?.getBoundingClientRect().height||260,modalOpen:RA()!==null};s(e=>JSON.stringify(e)===JSON.stringify(g)?e:g)};function h(){o||=requestAnimationFrame(m)}let g=new MutationObserver(e=>{e.some(e=>!i.current?.contains(e.target)&&e.target!==a.current)&&h()});return g.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`id`,`class`,`style`,`hidden`,`aria-controls`,`data-state`,`data-tour`]}),n.current&&f.observe(n.current),f.observe(document.documentElement),window.addEventListener(`resize`,h),window.addEventListener(`scroll`,h,!0),window.visualViewport?.addEventListener(`resize`,h),window.visualViewport?.addEventListener(`scroll`,h),m(),RA()||r.current?.focus({preventScroll:!0}),()=>{cancelAnimationFrame(o),cancelAnimationFrame(c),f.disconnect(),g.disconnect(),window.removeEventListener(`resize`,h),window.removeEventListener(`scroll`,h,!0),window.visualViewport?.removeEventListener(`resize`,h),window.visualViewport?.removeEventListener(`scroll`,h),p(new Set)}},[e,t,n,r,i,a]),o}function yde({stepId:e,target:t,title:n,children:r,progress:i,onNext:a,onBack:o,onClose:s,nextLabel:c=`Next`,nextDisabled:l=!1,onSkip:u,skipLabel:d=`Skip this step`}){let f=(0,m.useId)(),p=`${e}:${t}`,g=(0,m.useRef)(null),_=(0,m.useRef)(null),v=(0,m.useRef)(null),y=(0,m.useRef)(null),b=vde(p,t,g,_,v,y);_de(t,s,g,_);let[x,S]=(0,m.useState)({key:p,height:0}),C=b.key===p?b.target:null,w={width:b.width,height:b.height},T={width:Math.min(360,w.width-24),height:b.cardHeight},E=mde(C,w,T),D=C?IA(C,w,E.docked?E.top-12:w.height):null,O=b.key===p?b.portals.map(e=>IA(e,w)).filter(e=>e!==null):[],k=[...D?[D]:[],...O],A=`M0 0H${w.width}V${w.height}H0Z`+(D?`M${D.left} ${D.top}H${D.left+D.width}V${D.top+D.height}H${D.left}Z`:``);(0,m.useLayoutEffect)(()=>{S(e=>{let t=Math.max(e.key===p?e.height:0,E.docked?T.height+24:0);return e.key===p&&e.height===t?e:{key:p,height:t}})},[p,E.docked,T.height]);let j=x.key===p?x.height:0;return(0,m.useEffect)(()=>{let e=document.documentElement,t=e.style.scrollPaddingBottom;return e.style.scrollPaddingBottom=`${j}px`,()=>{e.style.scrollPaddingBottom=t}},[j]),(0,Vd.createPortal)((0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`div`,{ref:y,"aria-hidden":`true`,style:{height:j}}),(0,h.jsxs)(`div`,{ref:v,hidden:b.modalOpen,"data-tutorial":`spotlight`,className:`pointer-events-none fixed inset-0 z-[100] font-sans`,children:[(0,h.jsxs)(`svg`,{"aria-hidden":`true`,className:`absolute inset-0 h-full w-full`,width:w.width,height:w.height,children:[(0,h.jsx)(`defs`,{children:(0,h.jsxs)(`mask`,{id:`${f}-mask`,children:[(0,h.jsx)(`rect`,{width:`100%`,height:`100%`,fill:`white`}),k.map(e=>(0,h.jsx)(`rect`,{x:e.left,y:e.top,width:e.width,height:e.height,rx:`6`,fill:`black`},`${e.left}:${e.top}:${e.width}:${e.height}`))]})}),(0,h.jsx)(`rect`,{width:`100%`,height:`100%`,fill:`rgb(0 0 0 / 0.72)`,mask:`url(#${f}-mask)`}),(0,h.jsx)(`path`,{d:A,fill:`transparent`,fillRule:`evenodd`,pointerEvents:`fill`}),D&&(0,h.jsx)(`rect`,{"data-tutorial":`hole`,x:D.left,y:D.top,width:D.width,height:D.height,rx:`6`,fill:`none`,stroke:`var(--color-accent)`,strokeWidth:`2`})]}),(0,h.jsxs)(`section`,{ref:g,"aria-label":`Interactive getting started guide`,"aria-describedby":`${f}-instructions`,"data-tutorial":`card`,className:`pointer-events-auto fixed z-[101] flex flex-col gap-3 rounded-media border border-line-strong bg-surface p-4 text-body text-ink shadow-[var(--shadow-pop)]`,style:{left:E.left,top:E.top,width:E.width,maxHeight:Math.min(w.height-24,Math.max(160,Math.min(420,w.height*.48)))},children:[(0,h.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3`,children:[(0,h.jsxs)(`span`,{className:`engraved text-accent-ink`,children:[`Getting started · `,i]}),(0,h.jsx)(B,{variant:`quiet`,onClick:s,"aria-label":`Exit guide`,className:`h-7 px-2`,children:`Exit`})]}),(0,h.jsx)(`h2`,{ref:_,id:`${f}-title`,tabIndex:-1,className:`shrink-0 text-title-3 font-bold outline-none`,children:n}),(0,h.jsxs)(`div`,{id:`${f}-instructions`,className:`min-h-0 overflow-y-auto text-ink-2 [&_p+p]:mt-2 [&_code]:text-ink`,children:[r,!C&&(0,h.jsx)(`p`,{role:`status`,className:`mt-3 text-waiting`,children:`This section is not available yet. Wait for the page to load, go back, or exit the guide.`}),E.docked&&C&&(0,h.jsx)(`p`,{className:`mt-3 text-small`,children:`Scroll the page to work through the highlighted section.`})]}),(0,h.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-t border-line pt-3`,children:[o&&(0,h.jsx)(B,{onClick:o,children:`Back`}),u&&(0,h.jsx)(B,{variant:`quiet`,onClick:u,className:`px-2`,children:d}),(0,h.jsx)(B,{variant:`primary`,onClick:a,disabled:l||!C,className:`ml-auto`,children:c})]})]})]})]}),document.body)}function VA({href:e,children:t}){return(0,h.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`text-ink underline underline-offset-2`,children:t})}function HA({text:e}){let[t,n]=(0,m.useState)(!1),[r,i]=(0,m.useState)(!1);return(0,h.jsxs)(`div`,{className:`space-y-2`,children:[(0,h.jsx)(`p`,{className:`select-text rounded-control border border-line-strong bg-raised p-3 text-small leading-relaxed`,children:e}),(0,h.jsx)(B,{onClick:()=>{if(i(!1),!navigator.clipboard){i(!0);return}navigator.clipboard.writeText(e).then(()=>n(!0),()=>i(!0))},children:t?`Copied`:`Copy example`}),r?(0,h.jsx)(`p`,{role:`status`,children:`Select the example above and copy it manually.`}):null]})}var UA={signUp:{label:`platform.openai.com/signup`,url:`https://platform.openai.com/signup`},keyPage:{label:`platform.openai.com/api-keys`,url:`https://platform.openai.com/api-keys`},billing:{label:`Billing`,url:`https://platform.openai.com/settings/organization/billing/overview`},steps:[`Sign up or sign in to the OpenAI platform.`,`Open Billing and buy prepaid credit (new accounts need at least $5 before any call works).`,`Open API keys, choose Create new secret key, and copy it (it is shown once).`,`Paste it here, choose Save, then Test.`],permissions:`A key with All permissions works. A restricted key needs Models: Read (for Test) and Model capabilities: Request (for speech and images). GPT Image models may also need Verify Organization under Settings → Organization → General on the OpenAI platform.`,docs:{label:`OpenAI API docs`,url:`https://developers.openai.com/api/docs/guides/error-codes`}},WA={signUp:{label:`aistudio.google.com`,url:`https://aistudio.google.com`},keyPage:{label:`aistudio.google.com/apikey`,url:`https://aistudio.google.com/apikey`},billing:{label:`Projects → Set up billing`,url:`https://aistudio.google.com/projects`},steps:[`Sign in to Google AI Studio with your Google account.`,`Open Projects and choose Set up billing next to your project: Gemini image models are not available on the free tier.`,`Open API keys, choose Create API key, and copy it.`,`Paste it here, choose Save, then Test.`],permissions:`Use a key made in AI Studio. An older Google Cloud key must be set to Restrict to Gemini API only, or Google rejects it.`,docs:{label:`Gemini API keys`,url:`https://ai.google.dev/gemini-api/docs/api-key`}},GA={openrouter:{signUp:{label:`openrouter.ai/sign-up`,url:`https://openrouter.ai/sign-up`},keyPage:{label:`openrouter.ai/settings/keys`,url:`https://openrouter.ai/settings/keys`},billing:{label:`Credits`,url:`https://openrouter.ai/settings/credits`},steps:[`Sign up at OpenRouter.`,`Open Credits and buy credit (paid models are charged from it; a negative balance stops even free models).`,`Open Keys, choose Create API key, and copy it.`,`Paste it here, choose Save, then Test.`],permissions:`Keys have no scopes. If you set a credit limit on the key, keep it above what a run costs.`,docs:{label:`OpenRouter docs`,url:`https://openrouter.ai/docs/api-reference/limits`}},"openai-tts":UA,"openai-image":UA,"google-image":WA,"google-tts":{...WA,steps:[`Sign in to Google AI Studio with your Google account.`,`Open API keys, choose Create API key, and copy it.`,`Paste it here, choose Save, then Test.`],permissions:`The same Gemini API key as Google images: with one saved there, Gemini voices use it and nothing is needed here. ${WA.permissions}`},fal:{signUp:{label:`fal.ai/login`,url:`https://fal.ai/login`},keyPage:{label:`fal.ai/dashboard/keys`,url:`https://fal.ai/dashboard/keys`},billing:{label:`Billing`,url:`https://fal.ai/dashboard/billing`},steps:[`Sign up at fal.ai.`,`Open Billing and buy credit: fal.ai is prepaid and locks the account when the balance runs out.`,`Open Keys, choose Add key with the API scope, and copy it.`,`Paste it here, choose Save, then Test.`],permissions:`The API scope is enough; Slopify does not need an ADMIN key.`,docs:{label:`fal.ai authentication`,url:`https://fal.ai/docs/model-apis/authentication`}},replicate:{signUp:{label:`replicate.com/signin`,url:`https://replicate.com/signin`},keyPage:{label:`replicate.com/account/api-tokens`,url:`https://replicate.com/account/api-tokens`},billing:{label:`Billing`,url:`https://replicate.com/account/billing`},steps:[`Sign in to Replicate.`,`Open Billing and buy credit: Replicate needs credit up front before it runs paid models.`,`Open API tokens, create a token, and copy it (it starts with r8_).`,`Paste it here, choose Save, then Test.`],permissions:`Tokens have no scopes.`,docs:{label:`Replicate billing`,url:`https://replicate.com/docs/topics/billing`}},elevenlabs:{signUp:{label:`elevenlabs.io/app/sign-up`,url:`https://elevenlabs.io/app/sign-up`},keyPage:{label:`elevenlabs.io/app/developers/api-keys`,url:`https://elevenlabs.io/app/developers/api-keys`},steps:[`Sign up at ElevenLabs.`,`Open Developers → API keys, choose Create key, and copy it.`,`Paste it here, choose Save, then Test.`],permissions:`A restricted key needs Text to Speech access and Models read access (models_read) for Test; Voices read helps when picking voices. Remove any credit quota or IP allowlist that would block this computer.`,docs:{label:`ElevenLabs API keys`,url:`https://elevenlabs.io/docs/api-reference/models/list`}},cartesia:{signUp:{label:`play.cartesia.ai/sign-up`,url:`https://play.cartesia.ai/sign-up`},keyPage:{label:`play.cartesia.ai/keys`,url:`https://play.cartesia.ai/keys`},steps:[`Sign up at Cartesia (the free plan needs no card).`,`Open API Keys, create a key, and copy it (it starts with sk_car_).`,`Paste it here, choose Save, then Test.`],permissions:`Keys have no scopes.`,docs:{label:`Cartesia authentication`,url:`https://docs.cartesia.ai/get-started/authenticate-your-client-applications`}},inworld:{signUp:{label:`platform.inworld.ai/signup`,url:`https://platform.inworld.ai/signup`},keyPage:{label:`platform.inworld.ai/api-keys`,url:`https://platform.inworld.ai/api-keys`},billing:{label:`Billing`,url:`https://platform.inworld.ai/billing`},steps:[`Sign up at the Inworld platform.`,`Open API Keys and choose Generate new key (a Standard key, not Realtime-only).`,`Copy the Base64 credentials value exactly as shown, without encoding it again.`,`Paste it here, choose Save, then Test.`],permissions:`A Standard key covers speech and reading voices. Realtime-only keys do not work.`,docs:{label:`Inworld API keys`,url:`https://docs.inworld.ai/portal/api-keys`}}},bde=`system-voice`,KA=[{id:`openrouter`,family:`llm`,displayName:`OpenRouter`,auth:`key`},{id:`claude-code`,family:`llm`,displayName:`Claude Code CLI`,auth:`cli`,binary:`claude`,versionArgs:[`--version`]},{id:`codex`,family:`llm`,displayName:`Codex CLI`,auth:`cli`,binary:`codex`,versionArgs:[`--version`]},{id:`gemini`,family:`llm`,displayName:`Antigravity CLI`,auth:`cli`,binary:`agy`,versionArgs:[`--version`]},{id:`elevenlabs`,family:`tts`,displayName:`ElevenLabs`,auth:`key`},{id:`openai-tts`,family:`tts`,displayName:`OpenAI`,auth:`key`},{id:`cartesia`,family:`tts`,displayName:`Cartesia`,auth:`key`},{id:`inworld`,family:`tts`,displayName:`Inworld`,auth:`key`},{id:`system-voice`,family:`tts`,displayName:`System voice`,auth:`local`},{id:`google-tts`,family:`tts`,displayName:`Google Gemini`,auth:`key`},{id:`fal`,family:`image`,displayName:`fal.ai`,auth:`key`},{id:`replicate`,family:`image`,displayName:`Replicate`,auth:`key`},{id:`openai-image`,family:`image`,displayName:`OpenAI`,auth:`key`},{id:`google-image`,family:`image`,displayName:`Google`,auth:`key`},{id:`codex-image`,family:`image`,displayName:`Codex CLI`,auth:`cli`,binary:`codex`,versionArgs:[`--version`]}],xde=[{name:`Zephyr`,style:`Bright`},{name:`Puck`,style:`Upbeat`},{name:`Charon`,style:`Informative`},{name:`Kore`,style:`Firm`},{name:`Fenrir`,style:`Excitable`},{name:`Leda`,style:`Youthful`},{name:`Orus`,style:`Firm`},{name:`Aoede`,style:`Breezy`},{name:`Callirrhoe`,style:`Easy-going`},{name:`Autonoe`,style:`Bright`},{name:`Enceladus`,style:`Breathy`},{name:`Iapetus`,style:`Clear`},{name:`Umbriel`,style:`Easy-going`},{name:`Algieba`,style:`Smooth`},{name:`Despina`,style:`Smooth`},{name:`Erinome`,style:`Clear`},{name:`Algenib`,style:`Gravelly`},{name:`Rasalgethi`,style:`Informative`},{name:`Laomedeia`,style:`Upbeat`},{name:`Achernar`,style:`Soft`},{name:`Alnilam`,style:`Firm`},{name:`Schedar`,style:`Even`},{name:`Gacrux`,style:`Mature`},{name:`Pulcherrima`,style:`Forward`},{name:`Achird`,style:`Friendly`},{name:`Zubenelgenubi`,style:`Casual`},{name:`Vindemiatrix`,style:`Gentle`},{name:`Sadachbia`,style:`Lively`},{name:`Sadaltager`,style:`Knowledgeable`},{name:`Sulafat`,style:`Warm`}];function qA(e){return KA.flatMap(t=>{let n=t.auth===`key`?GA[t.id]:void 0;return t.family===e&&n!==void 0?[{id:t.id,name:t.displayName,url:n.keyPage.url}]:[]})}function JA({family:e}){return(0,h.jsx)(`p`,{children:qA(e).map((e,t)=>(0,h.jsxs)(`span`,{children:[t===0?null:` · `,(0,h.jsx)(VA,{href:e.url,children:`${e.name} keys`})]},e.id))})}function YA(e){let t=qA(e).map(e=>e.name);return t.length<2?t[0]??``:`${t.slice(0,-1).join(`, `)} or ${t.at(-1)??``}`}function Sde({step:e}){switch(e){case`text-key`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{children:`First, choose what will write your scripts. You only need one text provider.`}),(0,h.jsxs)(`ol`,{className:`list-decimal space-y-1 pl-5`,children:[(0,h.jsxs)(`li`,{children:[`Sign in to`,` `,(0,h.jsx)(VA,{href:GA.openrouter?.keyPage.url??`https://openrouter.ai`,children:`OpenRouter`}),`, create an API key, and make sure the account can use your chosen model.`]}),(0,h.jsxs)(`li`,{children:[`Paste it into OpenRouter’s `,(0,h.jsx)(`strong`,{children:`API key`}),` field here, press`,` `,(0,h.jsx)(`strong`,{children:`Test`}),` to check it, then `,(0,h.jsx)(`strong`,{children:`Save`}),`.`]})]}),(0,h.jsx)(`p`,{children:`Already using Claude Code, Codex or Antigravity CLI? You can use its existing CLI login instead. “Installed” means Slopify found the CLI; sign in through that CLI before generating. If it is missing, enter its executable path and save to check again.`}),(0,h.jsx)(`p`,{className:`text-ink-3`,children:`These are the real Settings controls. The tutorial never reads your key. Skip any step you have already handled.`})]});case`audio-key`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`The voice provider turns the finished article into audio. Choose `,YA(`tts`),`; you only need one.`]}),(0,h.jsxs)(`p`,{children:[`Create a key in your provider’s account, enable the API access or credits it requires, then paste the key into its row, press `,(0,h.jsx)(`strong`,{children:`Test`}),` to check it, and press`,` `,(0,h.jsx)(`strong`,{children:`Save`}),`.`]}),(0,h.jsx)(JA,{family:`tts`}),(0,h.jsx)(`p`,{children:`Next, you’ll add the exact voice that this provider should use. Skip voice setup if you plan to provide your own narration or turn Audio Off.`})]});case`image-key`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Choose one image provider (`,YA(`image`),`), create a key in its dashboard, paste it into the matching row, press `,(0,h.jsx)(`strong`,{children:`Test`}),` to check it, and press`,` `,(0,h.jsx)(`strong`,{children:`Save`}),`.`]}),(0,h.jsx)(JA,{family:`image`}),(0,h.jsxs)(`p`,{children:[`A saved key is not a billing check. The selected image model needs available quota. If Google reports `,(0,h.jsx)(`strong`,{children:`limit: 0`}),`, check the key’s project, billing and image-model quota before retrying.`]}),(0,h.jsx)(`p`,{children:`OpenAI’s voice and image rows are saved separately, even when you use the same API key. Skip this step if you plan to provide your own images or turn Images and Thumbnail Off.`})]});case`voice`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`ol`,{className:`list-decimal space-y-1 pl-5`,children:[(0,h.jsxs)(`li`,{children:[`Enter a `,(0,h.jsx)(`strong`,{children:`Voice name`}),` you will recognize, such as “Travel narrator.”`]}),(0,h.jsxs)(`li`,{children:[`Select the `,(0,h.jsx)(`strong`,{children:`Provider`}),` whose voice key you saved.`]}),(0,h.jsxs)(`li`,{children:[`Copy the exact `,(0,h.jsx)(`strong`,{children:`Voice ID`}),` from that provider’s voice library or documentation.`]}),(0,h.jsxs)(`li`,{children:[`Press `,(0,h.jsx)(`strong`,{children:`Add voice`}),`.`]})]}),(0,h.jsx)(`p`,{children:`The name is your label; the ID tells the provider which voice to use. Slopify checks the ID with the provider when narration runs. A voice is only required when Audio is set to Generate.`})]})}}var Cde=`Write a 150-word narration about {{topic}} for {{audience}}. Open with an interesting fact, explain three highlights, and end with one memorable takeaway. Use natural spoken English. Return only the narration, without headings or stage directions.`,wde=`A cinematic editorial photograph of {{topic}}, with natural light, a clear focal point, rich detail, and no text or logos. Compose it for a travel video.`;function Tde({step:e,output:t=`video`}){switch(e){case`text-key`:case`audio-key`:case`image-key`:case`voice`:return(0,h.jsx)(Sde,{step:e});case`article-name`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{children:`A prompt is a reusable set of instructions. This one will write the narration for each video.`}),(0,h.jsxs)(`p`,{children:[`Give it a recognizable name, such as `,(0,h.jsx)(`strong`,{children:`Short travel narration`}),`. This is the prompt’s library name, not your video’s title.`]}),(0,h.jsx)(`p`,{children:`The next steps will add its instructions and reusable keywords.`})]});case`article-body`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{children:`Tell the model what to write, who it is for, the length, and the style. Put anything you want to change between runs inside double braces.`}),(0,h.jsx)(HA,{text:Cde}),(0,h.jsxs)(`p`,{children:[`Paste or write the instructions in `,(0,h.jsx)(`strong`,{children:`Body`}),`. `,(0,h.jsx)(`strong`,{children:`{{topic}}`}),` `,`and `,(0,h.jsx)(`strong`,{children:`{{audience}}`}),` will become fields on Play.`]})]});case`article-keywords`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`This panel detects your keywords as you type. With the example, it should list`,` `,(0,h.jsx)(`strong`,{children:`topic`}),` and `,(0,h.jsx)(`strong`,{children:`audience`}),`.`]}),(0,h.jsxs)(`p`,{children:[(0,h.jsx)(`strong`,{children:`{{topic}}`}),` is a field name, not the value. You will enter “Albania” on Play later. Repeated names use the same value; names are case-sensitive, so`,` `,(0,h.jsx)(`strong`,{children:`topic`}),` and `,(0,h.jsx)(`strong`,{children:`Topic`}),` are different.`]}),(0,h.jsxs)(`p`,{children:[`There are no automatic keywords: `,(0,h.jsx)(`strong`,{children:`{{title}}`}),` would also ask you for a value. Fix any keyword warnings in Body before saving.`]})]});case`article-save`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Press the highlighted `,(0,h.jsx)(`strong`,{children:`Save`}),` button in the editor. The prompt will appear in your Article library.`]}),(0,h.jsx)(`p`,{children:`The tour continues when the save succeeds and the editor returns to the prompt list. If a name is already taken, go Back and choose another.`})]});case`image-prompt`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Keep `,(0,h.jsx)(`strong`,{children:`Kind`}),` on `,(0,h.jsx)(`strong`,{children:`Image`}),`. Name this prompt`,` `,(0,h.jsx)(`strong`,{children:`Travel imagery`}),`, then enter this example or your own visual instructions.`]}),(0,h.jsx)(HA,{text:wde}),(0,h.jsxs)(`p`,{children:[`Using `,(0,h.jsx)(`strong`,{children:`{{topic}}`}),` in both prompts creates one shared field on Play. Image prompts describe the picture directly; they do not automatically receive your article.`]})]});case`image-save`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Press `,(0,h.jsx)(`strong`,{children:`Save`}),` to add this to your Image library. Next you will combine both prompts on Play.`]}),(0,h.jsx)(`p`,{children:`You can create more prompts later for different subjects, styles, lengths, or languages.`})]});case`play-article`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Play is where you configure one project. Leave `,(0,h.jsx)(`strong`,{children:`Article`}),` on`,` `,(0,h.jsx)(`strong`,{children:`Write it for me`}),`, then select the article prompt you saved.`]}),(0,h.jsxs)(`p`,{children:[(0,h.jsx)(`strong`,{children:`Use my text as written`}),` is for an article you already have. For this first run, use Write it for me and keep the script short. Article is required; every other stage can be Off.`]}),(0,h.jsx)(`p`,{children:`Research starts Off. You can turn it on in a later run for web-grounded notes that are automatically passed to the article writer.`})]});case`play-audio`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Leave `,(0,h.jsx)(`strong`,{children:`Audio`}),` on `,(0,h.jsx)(`strong`,{children:`Generate`}),`. Pick your voice`,` `,(0,h.jsx)(`strong`,{children:`TTS`}),` provider, a `,(0,h.jsx)(`strong`,{children:`TTS model`}),`, then the saved`,` `,(0,h.jsx)(`strong`,{children:`Voice`}),`.`]}),(0,h.jsxs)(`p`,{children:[`Keep `,(0,h.jsx)(`strong`,{children:`Chunking`}),` (under `,(0,h.jsx)(`strong`,{children:`More audio settings`}),`) on`,` `,(0,h.jsx)(`strong`,{children:`Whole`}),` for the short example: the narration is sent as one request. Other chunking modes split longer text into pieces. `,(0,h.jsx)(`strong`,{children:`Speakers`}),` is where an audiobook or podcast gets more than one voice; leave it on one voice for now.`]}),(0,h.jsx)(`p`,{children:`Use Provide to upload existing narration, including any intro and outro in that file, or Off to skip narration. Video can still run silently, with each image shown for 5 seconds.`})]});case`play-images`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Leave `,(0,h.jsx)(`strong`,{children:`Images`}),` on `,(0,h.jsx)(`strong`,{children:`Generate`}),`. Choose the image`,` `,(0,h.jsx)(`strong`,{children:`Provider`}),` and `,(0,h.jsx)(`strong`,{children:`Model`}),`, tick your image prompt, and type`,` `,(0,h.jsx)(`strong`,{children:`2`}),` in the number box beside it for a small first run.`]}),(0,h.jsx)(`p`,{children:`The number means separate images made from that same prompt. It does not make one scene per article paragraph. Add more image prompts when you want different scenes.`}),(0,h.jsx)(`p`,{children:`Use Provide for your own images or Off to skip them. Turning Images Off also turns Video Off. Thumbnail remains independent; keep it Off for this first run.`})]});case`play-video`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`On `,(0,h.jsx)(`strong`,{children:`Export`}),`, choose `,(0,h.jsx)(`strong`,{children:`Generate`}),` for an MP4 slideshow. It needs generated or provided images. With Audio Off, the video is silent and each image lasts 5 seconds.`]}),(0,h.jsxs)(`p`,{children:[`Choose `,(0,h.jsx)(`strong`,{children:`Off`}),` to skip video. If Audio is active, Slopify exports one combined `,(0,h.jsx)(`strong`,{children:`WAV`}),` with the intro, body, outro and configured gaps.`]}),(0,h.jsx)(`p`,{children:`If both Audio and Video are Off, download the article and any other enabled outputs individually.`})]});case`play-subtitles`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Subtitles are optional and start `,(0,h.jsx)(`strong`,{children:`Off`}),`. Choose`,` `,(0,h.jsx)(`strong`,{children:`Subtitle files`}),` for SRT and VTT downloads, or`,` `,(0,h.jsx)(`strong`,{children:`Burn into video + files`}),` to keep captions visible in an MP4.`]}),(0,h.jsxs)(`p`,{children:[`English captions are timed locally from your narration with no paid API. First use downloads an approximately `,(0,h.jsx)(`strong`,{children:`378 MB`}),` speech model (a smaller one can be chosen in Settings → Production defaults). Audio must be active; WAV exports support separate subtitle files.`]}),(0,h.jsx)(`p`,{children:`Pick a font or upload a TTF/OTF file, then adjust its size in the preview. Styling applies to burned captions. You can also add or change subtitles on a completed project later without regenerating its narration.`})]});case`play-options`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Enter a `,(0,h.jsx)(`strong`,{children:`Project title`}),`, such as “A quick trip to Albania.” Set the title in Content.`]}),(0,h.jsxs)(`p`,{children:[`Select the text `,(0,h.jsx)(`strong`,{children:`LLM`}),` and `,(0,h.jsx)(`strong`,{children:`Text model`}),`. The model list loads for your provider. Use `,(0,h.jsx)(`strong`,{children:`Refresh`}),` for updated choices or`,` `,(0,h.jsx)(`strong`,{children:`Custom ID`}),`to enter an exact model ID when supported.`]}),(0,h.jsx)(`p`,{children:`Intro and Outro are available in Outputs when Audio is Generate. The LLM controls appear only when an enabled stage needs text generation.`})]});case`play-keywords`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`The prompts you picked created these fields. For the examples, enter`,` `,(0,h.jsx)(`strong`,{children:`Albania`}),` for `,(0,h.jsx)(`strong`,{children:`topic`}),` and`,` `,(0,h.jsx)(`strong`,{children:`first-time travelers`}),` for `,(0,h.jsx)(`strong`,{children:`audience`}),`.`]}),(0,h.jsx)(`p`,{children:`Each keyword is asked once, with the prompts that use it named underneath. A keyword both prompts use feeds the article and the images, so changing it changes both for this run.`}),(0,h.jsx)(`p`,{children:`Fill every visible field. Each value must fit on one line and be no more than 200 characters. Your saved prompt keeps its braces so you can reuse it next time.`})]});case`play-start`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{children:`Review the enabled outputs, costs and readiness in Review. If anything is missing, use Back to fix the highlighted section.`}),(0,h.jsxs)(`p`,{children:[`When ready, press the real `,(0,h.jsx)(`strong`,{children:`Start run`}),` or `,(0,h.jsx)(`strong`,{children:`Queue N`}),` `,`button. This creates a project and sends generation requests to your chosen providers, which may charge your account.`]}),(0,h.jsx)(`p`,{children:`The tour will follow you to the project. You can also skip generating and go on to the screens you run a channel from.`})]});case`project`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`The rail on the left lists the project's sections: Article, Narration, Images, Video and the rest. The right rail says where the run stands and offers the one thing to do next, named for its result: `,(0,h.jsx)(`strong`,{children:`Pause`}),` while it runs,`,` `,(0,h.jsx)(`strong`,{children:`Continue the run`}),` when it is paused, `,(0,h.jsx)(`strong`,{children:`Try images again`}),` `,`when a step fails.`]}),(0,h.jsxs)(`p`,{children:[`Press `,(0,h.jsx)(`strong`,{children:`Edit settings`}),` to change providers, models, voice, prompts or optional steps. `,(0,h.jsx)(`strong`,{children:`Save changes`}),` keeps a new revision without starting generation; what the change made outdated is then offered as the next action, such as`,` `,(0,h.jsx)(`strong`,{children:`Remake 3 outdated images`}),`. Earlier revisions stay in`,` `,(0,h.jsx)(`strong`,{children:`History`}),`.`]}),(0,h.jsxs)(`p`,{children:[`A failed step says why beside it; open `,(0,h.jsx)(`strong`,{children:`Error details`}),` for the provider's own message. Rare actions, such as making a whole stage again, sit behind each section's`,` `,(0,h.jsx)(`strong`,{children:`More`}),` button and in the command palette (Ctrl+K).`]})]});case`download`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[t===`audio`?(0,h.jsxs)(h.Fragment,{children:[`When Audio export finishes, press `,(0,h.jsx)(`strong`,{children:`Download`}),`, then`,` `,(0,h.jsx)(`strong`,{children:`Audio (.wav)`}),` for the combined narration.`]}):t===`article`?(0,h.jsxs)(h.Fragment,{children:[`Use `,(0,h.jsx)(`strong`,{children:`Download`}),` here to save the article. Audio and Video are Off for this project.`]}):(0,h.jsxs)(h.Fragment,{children:[`When Video finishes, press `,(0,h.jsx)(`strong`,{children:`Download`}),`, then`,` `,(0,h.jsx)(`strong`,{children:`Video (.mp4)`}),`.`]}),` `,`The completed project stays in `,(0,h.jsx)(`strong`,{children:`Projects`}),` so you can return to it.`]}),(0,h.jsxs)(`p`,{children:[`Select Article, Audio or Images in the stage list on the `,(0,h.jsx)(`strong`,{children:`Output`}),` tab to download their outputs. `,(0,h.jsx)(`strong`,{children:`Download all`}),` under Images gives an image ZIP, not the video.`]}),(0,h.jsxs)(`p`,{children:[`If subtitles are enabled, download the `,(0,h.jsx)(`strong`,{children:`.srt`}),` or `,(0,h.jsx)(`strong`,{children:`.vtt`}),` `,`files beside the final export. File-mode captions are also available in the video player.`]})]});case`run-cost`:return(0,h.jsxs)(`p`,{children:[(0,h.jsx)(`strong`,{children:`Cost`}),` in the project's sections shows what this run really cost, per stage and model. Totals for every project are in Settings, `,(0,h.jsx)(`strong`,{children:`Usage`}),`.`]});case`studio-prep`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`Slopify never uploads for you. When the video is made, `,(0,h.jsx)(`strong`,{children:`Prepare upload`}),` `,`is the next action: it lists everything YouTube Studio asks for, in the order it asks, from the file and title to the thumbnail, tags and the AI disclosure.`]}),(0,h.jsxs)(`p`,{children:[`The browser extension in Settings, `,(0,h.jsx)(`strong`,{children:`YouTube Studio`}),`, can fill those in for you.`]})]});case`home`:return(0,h.jsxs)(`p`,{children:[(0,h.jsx)(`strong`,{children:`Home`}),` is the day at a glance: what needs you, what is running and at which step, what is coming up this week and what is ready to upload.`]});case`channels`:return(0,h.jsxs)(`p`,{children:[`A `,(0,h.jsx)(`strong`,{children:`channel`}),` keeps its brand kit, series brief, templates, schedules and a cast that looks the same in every video. It also remembers finished episodes and your existing videos, so new topics do not repeat them.`]});case`calendar`:return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`p`,{children:[`The `,(0,h.jsx)(`strong`,{children:`Calendar`}),` shows the coming weeks of uploads: what is ready, what needs you, and the topics a schedule suggested, waiting for your approval. Its`,` `,(0,h.jsx)(`strong`,{children:`Schedules`}),` tab is where you create, pause and resume the schedules that fill it.`]}),(0,h.jsx)(`p`,{children:`You have reached the end. Press the question-mark button at the foot of the sidebar anytime to walk through these steps again, or the book beside it for Help → Tutorials, the guides to every screen.`})]})}}function XA(e){return dk(e.readiness)}function Ede({session:e,progress:t,update:n}){let{api:r}=V(),i=aA(),a=Ji(),o=Va(),s=I(sy(r)),c=I(cy(r)),l=I(ly(r)),u=I({...ay(r,e.projectId??``),enabled:e.projectId!==void 0}),[d,f]=(0,m.useState)(null),p=(0,m.useRef)(null),g=ok[e.step],_=s.data?.seen===!0;if((0,m.useEffect)(()=>{if(!_||!g||p.current===e.step)return;if(p.current=e.step,g.page===`settings`){let e=g.id===`voice`?`voices`:`providers`;(o.pathname!==`/settings`||!o.searchStr.includes(`section=${e}`))&&a({to:`/settings`,search:{section:e}})}if(g.page===`article`||g.page===`image`){let t=g.page===`article`?e.articleId:e.imageId,n=o.pathname===`/prompts/new`&&o.searchStr.includes(`kind=${g.page}`);t&&o.pathname!==`/prompts/${t}`?a({to:`/prompts/$promptId`,params:{promptId:t}}):!t&&!n&&a({to:`/prompts/new`,search:{kind:g.page}})}g.page===`play`&&o.pathname!==`/play`&&a({to:`/play`});let t={home:`/`,channels:`/channels`,calendar:`/calendar`};if(g.page===`home`||g.page===`channels`||g.page===`calendar`){let e=t[g.page];o.pathname!==e&&a({to:e})}g.page===`project`&&e.projectId&&o.pathname!==`/projects/${e.projectId}`&&a({to:`/projects/$projectId`,params:{projectId:e.projectId}})},[_,g,e.step,e.articleId,e.imageId,e.projectId,o.pathname,o.searchStr,a]),(0,m.useEffect)(()=>{if(!_||g?.page!==`play`||o.pathname!==`/play`)return;let e=!0;return f(null),i.navigate(uk[g.id]).then(()=>{e&&f(g.id)}),()=>{e=!1}},[_,g,o.pathname,i.navigate]),(0,m.useEffect)(()=>{o.pathname===`/prompts`&&(g?.id===`image-prompt`&&e.imageId?n(e=>({...e,step:ok.findIndex(e=>e.id===`play-options`)})):(g?.id===`article-save`&&e.articleId||g?.id===`image-save`&&e.imageId)&&n(e=>({...e,step:e.step+1})))},[o.pathname,g?.id,e.articleId,e.imageId,n]),!_||!g||g.page===`play`&&(d!==g.id||i.section!==uk[g.id]))return null;let v=c.data?.providers??[],y=e=>v.some(t=>t.family===e&&XA(t)),b=(l.data?.voices??[]).some(e=>v.some(t=>t.id===e.provider&&XA(t))),x={"text-key":y(`llm`),"audio-key":y(`tts`),"image-key":y(`image`),voice:b,"article-name":t.promptIsArticle===!0&&t.promptNamed===!0,"article-body":t.promptIsArticle===!0&&t.promptBodyReady===!0&&t.promptHasKeywords===!0,"article-keywords":t.promptHasKeywords===!0,"article-save":!1,"image-prompt":t.promptIsImage===!0&&t.promptSaveReady===!0&&t.promptHasKeywords===!0,"image-save":!1,"play-article":t.playArticleReady===!0,"play-audio":t.playAudioReady===!0,"play-images":t.playImagesReady===!0,"play-video":t.playVideoReady===!0,"play-subtitles":t.playSubtitlesReady===!0,"play-options":t.playOptionsReady===!0,"play-keywords":t.playKeywordsReady===!0,"play-start":!1},S=()=>n(e=>({...e,active:!1})),C=ok.findIndex(e=>e.id===sk),w=e.step===ok.length-1,T=()=>{w?S():g.id===`play-start`?n(e=>({...e,step:C})):n(e=>({...e,step:e.step+1}))},E=()=>n(t=>({...t,step:g.id===`home`&&e.projectId===void 0?ok.findIndex(e=>e.id===`play-start`):t.step-1})),D=u.data?SA(u.data.project.config):`video`,O=g.id===`download`&&D===`article`?`project-article`:g.id===`play-keywords`&&t.playHasKeywords===!1?`play-options`:g.id===`studio-prep`&&D!==`video`?`project-controls`:g.target,k=g.id===`article-save`||g.id===`image-save`,A=(g.page===`article`||g.page===`image`)&&t.promptSaving===!0;return(0,h.jsxs)(yde,{stepId:g.id,target:`[data-tour="${O}"]`,title:g.title,progress:`${e.step+1} of ${ok.length} · First project`,onClose:S,...e.step===0||g.id===`project`||A?{}:{onBack:E},onNext:T,nextDisabled:A||x[g.id]===!1,nextLabel:k?`Use Save in the editor`:g.id===`play-start`?`Use Start run / Queue N on the page`:w?`Finish tutorial`:`Next`,...A?{}:{onSkip:T},skipLabel:g.id===`play-start`?`Skip generating`:k?`Skip without saving`:`Skip this step`,children:[(0,h.jsx)(Tde,{step:g.id,output:D}),c.error||l.error?(0,h.jsx)(`p`,{className:`text-danger`,children:c.error?.message??l.error?.message}):null]})}var ZA=J({schemaVersion:Vw(1),active:Mw(),stepId:Y([`text-key`,`audio-key`,`image-key`,`voice`,`article-name`,`article-body`,`article-keywords`,`article-save`,`image-prompt`,`image-save`,`play-options`,`play-article`,`play-keywords`,`play-audio`,`play-images`,`play-video`,`play-subtitles`,`play-start`,`project`,`download`,`run-cost`,`studio-prep`,`home`,`channels`,`calendar`]),articleId:G().optional(),imageId:G().optional(),projectId:G().optional()}).strict();J({baseVersion:K().int().nonnegative(),mutationId:kw(),session:ZA}).strict();var QA=J({version:K().int().nonnegative(),session:ZA,readable:Mw()}).strict();async function Dde(e){let t=await R(await e.client.tutorial.$get()),n=QA.safeParse(t);return n.success?n.data:{version:0,readable:!1,session:{schemaVersion:1,active:!1,stepId:`text-key`}}}async function Ode(e,t){return QA.parse(await R(await e.client.tutorial.$put({json:t})))}async function kde(e){let t=await e.client.tutorial.$delete();if(!t.ok)throw await fo(t)}function Ade(){let{api:e}=V(),[t,n]=(0,m.useState)({active:!1,step:0}),[r,i]=(0,m.useState)(null),a=(0,m.useMemo)(()=>{let t={active:!1,step:0},r=0,a=!1,o=!1,s=0,c=!0,l=!1,u=!1,d=null,f=[],p=[],m=e=>i(e instanceof Error?e.message:`Your tutorial progress wasn't saved. You can keep going; it will try again on the next step.`),h=async()=>{if(!u&&a&&c){u=!0;try{for(;d||p.length>0;){if(!d){let e=p.shift();if(!e)break;let t=ok[e.step];if(!t)throw Error(`This tutorial step isn't recognised. Choose Restart tutorial to start over.`);let{step:n,...i}=e;d={baseVersion:r,mutationId:crypto.randomUUID(),session:{...i,schemaVersion:1,stepId:t.id}}}r=(await Ode(e,d)).version,d=null}i(null)}catch(e){m(e)}finally{u=!1}}},g=e=>{if(!a){f.push(e);return}let r=typeof e==`function`?e(t):e;r!==t&&(t=r,n(t),p.push(t),h())},_=()=>{if(!a){l=!0;return}if(!c){i(`Saved tutorial progress cannot be read. Choose Restart tutorial to recover.`);return}g({active:!0,step:0})},v=async()=>{if(o||a)return;o=!0;let u=s;try{let o=await Dde(e);if(u!==s)return;if(r=o.version,c=o.readable,c||(a=!0),!c){i(`Saved tutorial progress cannot be read. Choose Restart tutorial to recover.`);return}let{schemaVersion:d,stepId:p,...m}=o.session;if(t={active:m.active,step:lk(p)??0,...m.articleId===void 0?{}:{articleId:m.articleId},...m.imageId===void 0?{}:{imageId:m.imageId},...m.projectId===void 0?{}:{projectId:m.projectId}},t.articleId||t.imageId){let{prompts:n}=await Ls(e),{articleId:r,imageId:i,...a}=t;t={...a,...r!==void 0&&n.some(e=>e.id===r&&e.kind===`article`)?{articleId:r}:{},...i!==void 0&&n.some(e=>e.id===i&&e.kind===`image`)?{imageId:i}:{}}}if(t.projectId&&await jo(e,t.projectId),u!==s)return;a=!0,n(t);for(let e of f.splice(0))g(e);l&&_(),i(null)}catch(e){u===s&&m(e)}finally{o=!1}},y=async()=>{if(!u){u=!0,s++,f.length=0,l=!1;try{await kde(e),r=0,c=!0,a=!0,d=null,p.length=0,t={active:!0,step:0},n(t),p.push(t),i(null)}catch(e){m(e)}finally{u=!1}await h()}};return{update:g,start:_,restore:v,retry:()=>{a?h():v()},restart:()=>{y()}}},[e]);return(0,m.useEffect)(()=>{a.restore()},[a]),{session:t,update:a.update,start:a.start,retry:a.retry,restart:a.restart,error:r}}var $A=(0,m.createContext)(void 0);function jde({children:e}){let{session:t,update:n,start:r,retry:i,restart:a,error:o}=Ade(),[s,c]=(0,m.useState)({}),l=(0,m.useCallback)(e=>{c(t=>Object.entries(e).every(([e,n])=>t[e]===n)?t:{...t,...e})},[]),u=(0,m.useCallback)(e=>{c(t=>Object.fromEntries(Object.entries(t).filter(([t])=>!e.includes(t))))},[]),d=(0,m.useCallback)(e=>{n(t=>ck(t,e))},[n]),f=ok[t.step]?.id,p=t.active&&(f===`project`||f===`download`)?f:void 0,g=(0,m.useMemo)(()=>({active:t.active,projectId:t.projectId,projectStep:p,start:r,report:l,clear:u,event:d}),[t.active,t.projectId,p,r,l,u,d]);return(0,h.jsxs)($A.Provider,{value:g,children:[e,o?(0,h.jsxs)(`div`,{role:`alert`,className:`fixed bottom-4 left-4 z-[100] rounded-media border border-line bg-surface p-4 text-ink`,children:[(0,h.jsx)(`p`,{children:o}),(0,h.jsx)(B,{type:`button`,onClick:i,children:`Retry tutorial save`}),(0,h.jsx)(B,{type:`button`,onClick:a,children:`Restart tutorial`})]}):null,t.active?(0,h.jsx)(Ede,{session:t,progress:s,update:n}):null]})}function ej(){return(0,m.useContext)($A)}function tj(e){let t=(0,m.useContext)($A),n=t?.report,r=t?.clear,i=(0,m.useRef)(e);i.current=e,(0,m.useEffect)(()=>{n?.(e)},[n,e]),(0,m.useEffect)(()=>()=>{r?.(Object.keys(i.current))},[r])}function nj(){let e=(0,m.useContext)($A);return(0,m.useCallback)(t=>{e?.event(t)},[e?.event])}function Mde(e){let t=(0,m.useContext)($A);return t?.projectId===e?t.projectStep:void 0}function Nde(){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Pde,{}),(0,h.jsx)(Ide,{}),tk.map(e=>(0,h.jsx)(Rde,{id:e.id,label:e.label},e.id)),(0,h.jsx)(zde,{})]})}function Pde(){let e=Ji(),t=qy(),n=t=>()=>{e({to:t})};return Xy({id:`nav.home`,title:`Open home`,group:`Go to`,shortcut:ek.goHome,run:n(`/`)}),Xy({id:`nav.channels`,title:`Open channels`,group:`Go to`,run:n(`/channels`),keywords:[`cast`,`brand`],shortcut:ek.goChannels}),Xy({id:`nav.schedules`,title:`Open schedules`,group:`Go to`,run:()=>{e({to:`/calendar`,search:{tab:`schedules`}})},keywords:[`calendar`,`topics`],shortcut:ek.goSchedules}),Xy({id:`channel.all`,title:`Show all channels`,group:`Channel`,run:()=>t.setChannelId(null),keywords:[`switch`,`filter`]}),Xy({id:`create.video`,title:`Create`,group:`Create`,run:n(`/play`),keywords:[`new project`,`play`,`make`,`start`],shortcut:ek.newVideo}),Xy({id:`nav.projects`,title:`Open projects`,group:`Go to`,shortcut:ek.goProjects,run:n(`/projects`)}),Xy({id:`nav.calendar`,title:`Open calendar`,group:`Go to`,run:n(`/calendar`),keywords:[`schedules`],shortcut:ek.goCalendar}),Xy({id:`nav.library`,title:`Open library`,group:`Go to`,run:n(`/prompts`),keywords:[`prompts`,`templates`],shortcut:ek.goLibrary}),Xy({id:`nav.settings`,title:`Open settings`,group:`Go to`,run:n(`/settings`),shortcut:ek.goSettings}),Xy({id:`nav.tutorials`,title:`Open tutorials`,group:`Go to`,run:()=>{e({to:`/help/tutorials/$page`,params:{page:`Home`}})},keywords:[`help`,`guide`,`wiki`,`docs`,`how`]}),Xy({id:`nav.usage`,title:`Open usage and costs`,group:`Go to`,run:()=>{e({to:`/settings`,search:{section:`usage`}})},keywords:[`cost`,`limits`]}),null}function Fde({id:e,name:t}){let n=qy();return Xy({id:`channel.${e}`,title:`Switch to ${t}`,group:`Channel`,run:()=>n.setChannelId(e),keywords:[`channel`,`switch`,`filter`]}),null}function Ide(){let e=qy();return(0,h.jsx)(h.Fragment,{children:e.channels.map(e=>(0,h.jsx)(Fde,{id:e.id,name:e.name},e.id))})}var Lde={general:[`appearance`,`theme`,`dark`,`light`,`start at login`,`autostart`],providers:[`api keys`,`sign in`,`openai`,`gemini`,`antigravity`,`agy`,`claude`,`codex`],voices:[`voice id`,`elevenlabs`,`tts`],agents:[`mcp`,`claude code`,`codex`,`agent`],playback:[`pace`,`loudness`,`volume`,`narration`],notifications:[`webhook`,`ntfy`,`alerts`],studio:[`extension`,`playlist`,`youtube`],storage:[`export`,`import`,`disk`,`space`],backups:[`daily copy`,`restore`],trash:[`deleted`,`restore`,`undelete`],usage:[`costs`,`spending`,`limits`,`money`],"patch-notes":[`changelog`,`what's new`,`version`],about:[`licence`,`version`,`github`]};function Rde({id:e,label:t}){let n=Ji();return Xy({id:`settings.section.${e}`,title:`Open Settings: ${t}`,group:`Settings`,keywords:[`settings`,...Lde[e]??[]],searchOnly:!0,run:()=>{n({to:`/settings`,search:{section:e}})}}),null}function zde(){let e=Ji(),t=ej(),n=wv();return Xy({id:`help.welcome`,title:`Open the welcome screen`,group:`Help`,keywords:[`welcome`,`getting started`,`samples`,`first run`,`onboarding`,`intro`],searchOnly:!0,run:()=>{e({to:`/welcome`})}}),Xy({id:`help.tutorial`,title:`Start the interactive tutorial`,group:`Help`,keywords:[`tour`,`guide`,`walkthrough`,`first video`,`learn`,`help`],searchOnly:!0,run:()=>{t!==void 0&&(t.active?n(`The interactive tutorial is already running.`,`info`):t.start())}}),null}var rj,Bde=/^\/projects\/[^/]+/,Vde=/^\/channels\/([^/]+)$/;function Hde(e,t,n){if(!Bde.test(e)){if(e===`/projects`)rj={to:`/projects`,search:t,label:`Projects`};else if(e===`/`)rj={to:`/`,search:{},label:`Home`};else if(e===`/calendar`)rj={to:`/calendar`,search:t,label:`Calendar`};else{let r=Vde.exec(e)?.[1];rj=r===void 0?void 0:{to:e,search:t,label:n(decodeURIComponent(r))??`Channel`}}}}var Ude={to:`/projects`,search:{},label:`Projects`};function Wde(){return rj??Ude}function Gde(e){let t=Va({select:e=>e.pathname}),n=Va({select:e=>e.search}),r=qy().channels;(0,m.useEffect)(()=>{Av(Mv(t))},[t]),(0,m.useEffect)(()=>{Hde(t,n,e=>r.find(t=>t.id===e)?.name)},[t,n,r]);let i=(0,m.useRef)(!0);(0,m.useEffect)(()=>{if(i.current){i.current=!1;return}let t=requestAnimationFrame(()=>{let t=e.current;if(t===null||document.activeElement?.closest(`[role="dialog"]`))return;let n=t.querySelector(`h1`)??t;n.hasAttribute(`tabindex`)||n.setAttribute(`tabindex`,`-1`),n.focus({preventScroll:!0})});return()=>cancelAnimationFrame(t)},[t,e])}function Kde(e,t){if(t===`system`){e.removeAttribute(`data-theme`);return}e.setAttribute(`data-theme`,t)}function qde(){let{api:e}=V(),t=I(my(e)).data?.appearance??`system`;return(0,m.useEffect)(()=>{Kde(document.documentElement,t)},[t]),null}var ij=`slopify.draft.`;function aj(){try{return typeof window>`u`?void 0:window.localStorage}catch{return}}function oj(e,t){let n=(()=>{try{return aj()?.getItem(ij+e)??null}catch{return null}})();if(n!==null)try{let e=JSON.parse(n);if(typeof e!=`object`||!e)return;let r=`value`in e?e.value:void 0,i=`base`in e?e.base:void 0,a=`savedAt`in e?e.savedAt:void 0;return typeof i!=`string`||typeof a!=`string`||!t(r)?void 0:{value:r,base:i,savedAt:a}}catch{return}}function sj(e,t,n,r=new Date){try{let i=aj();return i!==void 0&&(i.setItem(ij+e,JSON.stringify({value:t,base:n,savedAt:r.toISOString()})),!0)}catch{return!1}}function cj(e){try{aj()?.removeItem(ij+e)}catch{}}function lj(){try{let e=aj();if(e===void 0)return 0;let t=0;for(let n=0;n<e.length;n+=1)e.key(n)?.startsWith(ij)===!0&&(t+=1);return t}catch{return 0}}var uj=new Set;function dj(e){return uj.add(e),()=>{uj.delete(e)}}function fj(){for(let e of uj)try{e()}catch{}return lj()}var pj=!1;function mj(){return pj=!0,fj()}function hj(){return pj}function gj({reload:e}){let{version:t}=V(),n=(0,m.useSyncExternalStore)(t.subscribe,t.staleAt,t.staleAt),r=n!==void 0,[i,a]=(0,m.useState)(0);(0,m.useEffect)(()=>{r&&a(fj())},[r]);let o=`This tab was loaded before the update. Version ${n??``} is running now; reload to catch up.`;return(0,h.jsx)(zv,{open:r,dismissible:!1,title:`Slopify was updated`,description:i===0?o:`${o} Your unsaved ${i===1?`edit is`:`edits are`} kept in this browser and offered back when you open ${i===1?`it`:`them`} again after the reload.`,footer:(0,h.jsx)(B,{autoFocus:!0,variant:`primary`,onClick:()=>{mj(),e()},children:`Reload`})})}var _j=[`stage.state`,`stage.progress`,`article.delta`,`llm.preview`,`image.landed`,`narration.piece`,`project.state`,`project.updated`,`review.flagged`,`review.auto-passed`],vj=[`running.count`,`staging.progress`,`staging.failed`,`project.updated`,`project.state`,`schedule.topics`,`review.flagged`,`review.auto-passed`,`stage.state`,`stage.progress`];function yj(e,t,n){return xj(e,t,_j,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`||e.type===`review.auto-passed`){n.refetch();return}n.patch(e),e.type===`stage.state`&&n.refetch()}})}function bj(e,t,n){return xj(e,t,vj,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),e.type===`stage.state`&&n.stageState?.(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}if(e.type===`review.auto-passed`){n.reviewAutoPassed?.(e),n.refetch(e.projectId);return}n.stagingChanged()},n.connection)}function xj(e,t,n,r,i,a){let o=e(t),s=!1;o.addEventListener(`open`,()=>{s&&r(),s=!0,a?.(`open`)}),a!==void 0&&o.addEventListener(`error`,()=>a(`lost`));for(let e of n)o.addEventListener(e,t=>{let n=Sj(t.data);n.type===e&&i(n)});return()=>{o.close()}}function Sj(e){return JSON.parse(e)}var Cj=(0,m.createContext)(void 0);function wj({children:e}){let[t,n]=(0,m.useState)(()=>new Map),r=(0,m.useCallback)((e,t)=>{n(n=>{let r=n.get(e),i=typeof t==`function`?t(r):t;if(r===i)return n;let a=new Map(n);return i===void 0?a.delete(e):a.set(e,i),a})},[]),i=(0,m.useMemo)(()=>({prompts:t,updatePrompt:r}),[t,r]);return(0,h.jsx)(Cj.Provider,{value:i,children:e})}function Tj(e){let t=(0,m.useContext)(Cj),[n,r]=(0,m.useState)(void 0),i=t?.updatePrompt,a=(0,m.useCallback)(t=>{i?i(e,t):r(t)},[e,i]);return[t?t.prompts.get(e):n,a]}function Ej(e){return e.trim()===``?NaN:Number(e)}function Dj(){let e=aA(),t=(0,m.useRef)(e);t.current=e;let n=e.document.form,r=t=>{if(!t)return;let n=e.view?.attachments.find(e=>e.id===t.attachmentId),r=n?.state===`ready`&&n.stagedFileId?{id:n.stagedFileId,stageKind:n.kind===`reference`?`images`:n.kind,path:n.stagedFileId,originalFilename:n.name,bytes:n.bytes,state:`staged`,createdAt:e.view?.draft.createdAt??``}:void 0;return{key:t.attachmentId,name:t.name,file:r,error:n?.error??(n?.state===`reattach`||!r&&!e.attachmentUploading(t.attachmentId)?`Reattach this file`:void 0)}},i={...n,sources:{...n.sources,document:wb(n.sources,`document`)},document:{theme:wD(n.document),...n.document?.custom===void 0?{}:{custom:n.document.custom}},imagePrompts:n.imagePrompts.map(e=>({...e,number:Number(e.number)})),chunking:n.chunking.mode===`words`?{mode:`words`,...n.chunking.words===``?{}:{words:Number(n.chunking.words)}}:n.chunking.mode===`characters`?{mode:`characters`,...n.chunking.characters===``?{}:{characters:Number(n.chunking.characters)}}:{mode:n.chunking.mode},subtitles:{...n.subtitles,fontSize:Number(n.subtitles.fontSize)},imageSeconds:Ej(n.imageSeconds),edgeSilenceSeconds:Ej(n.edgeSilenceSeconds),zoomPercent:Ej(n.zoomPercent),provided:{research:n.provided.research,article:n.provided.article,audio:r(n.provided.audio),thumbnail:r(n.provided.thumbnail),...n.provided.reference===void 0?{}:{reference:r(n.provided.reference)},shortsMusic:r(n.provided.shortsMusic),ambientBed:r(n.provided.ambientBed),images:n.provided.images.flatMap(e=>{let t=r(e);return t?[t]:[]})}},a=(0,m.useRef)(i);return a.current=i,[i,(0,m.useCallback)(e=>{let n=t.current.document,r=typeof e==`function`?e(a.current):e;a.current=r;let i=(e,t)=>e===void 0?``:Object.is(e,Number(t))?t:String(e),o=e=>e?{attachmentId:e.key,name:e.name}:null,{document:s,...c}=r.sources,{document:l,...u}=r,{shortsMusic:d,ambientBed:f}=r.provided,p=n.form.sources.document!==void 0||s!==`off`,m=n.form.document!==void 0||l.theme!==wD(n.form.document)||l.custom!==void 0;t.current.edit({...n,form:{...u,sources:p?r.sources:c,...m?{document:l}:{},imagePrompts:r.imagePrompts.map(e=>({...e,number:i(e.number,n.form.imagePrompts.find(t=>t.name===e.name)?.number??String(e.number))})),chunking:{...n.form.chunking,mode:r.chunking.mode,...r.chunking.mode===`words`?{words:i(r.chunking.words,n.form.chunking.words)}:{},...r.chunking.mode===`characters`?{characters:i(r.chunking.characters,n.form.chunking.characters)}:{}},subtitles:{...n.form.subtitles,...r.subtitles,fontSize:i(r.subtitles.fontSize,n.form.subtitles.fontSize)},imageSeconds:Object.is(r.imageSeconds,Ej(n.form.imageSeconds))?n.form.imageSeconds:String(r.imageSeconds),edgeSilenceSeconds:Object.is(r.edgeSilenceSeconds,Ej(n.form.edgeSilenceSeconds))?n.form.edgeSilenceSeconds:String(r.edgeSilenceSeconds),zoomPercent:Object.is(r.zoomPercent,Ej(n.form.zoomPercent))?n.form.zoomPercent:String(r.zoomPercent),provided:{research:r.provided.research,article:r.provided.article,audio:o(r.provided.audio),thumbnail:o(r.provided.thumbnail),...r.provided.reference===void 0&&n.form.provided.reference===void 0?{}:{reference:o(r.provided.reference)},images:r.provided.images.map(e=>({attachmentId:e.key,name:e.name})),...d!==void 0||n.form.provided.shortsMusic!==void 0?{shortsMusic:o(d)}:{},...f!==void 0||n.form.provided.ambientBed!==void 0?{ambientBed:o(f)}:{}}}})},[])]}function Oj(e,t){if((e===`running`||e===`pending`)&&(e!==`pending`||t!==`pending`))switch(t){case`done`:return`ready`;case`partial`:return`partial`;case`failed`:return`failed`;case`pending`:return`waiting`;default:return}}var kj={article:`the article`,images:`an image`,narration:`the narration`,thumbnail:`the thumbnail`,shorts:`a short`};function Aj(e){let t=e.title.trim()===``?`Untitled project`:e.title.trim(),n=Lj(e.reason),r=kj[e.stage]??`an item`,i=`Review needs a decision: ${t}`;return{headline:`${n===void 0?i:`${i} — ${n}`}${e.byAgent===!0?` · by agent`:``}`,detail:`${e.byAgent===!0?`An agent's review`:`The automatic review`} flagged ${r} and kept it. Open the project and press Overrule to keep it or Redo to make it again.`}}function jj(e){return{headline:`Passed without review: no agent answered in 2 h`,detail:`${e.title.trim()===``?`Untitled project`:e.title.trim()}: ${e.item??kj[e.stage]??`an item`} went ahead unreviewed. Open the project to look at it, or check that your agent's routine is running.`}}function Mj(e){return e.filter(e=>e.state===`failed`).map(e=>({id:xb(e.kind,e.finishedAt),kind:e.kind,...e.failureReason===null?{}:{reason:e.failureReason}}))}function Nj(e,t,n){let r=t.failures??[],i=r.filter(e=>!n.has(e.id)),a=[],o=[];if(`kind`in e){let{kind:n}=e;!(n===`failed`&&r.length>0&&i.length===0)&&Fj(n,t)&&a.push({kind:n,reason:r[0]?.reason}),n===`waiting`&&t.stepFailedWhileWaiting===!0&&(o=i)}else t.status===`running`&&t.stepFailedWhileWaiting===!0&&(o=i.filter(t=>t.kind===e.stepFailed));o.length>0&&a.push({kind:`step-failed`,reason:o[0]?.reason});let s=a.some(e=>e.kind===`failed`||e.kind===`partial`);return{notices:a,told:new Set(r.filter(e=>s||n.has(e.id)||o.includes(e)).map(e=>e.id)),news:o.map(e=>e.id)}}function Pj(e,t){return e&&t.some(e=>e.waitsFor===`day`)}function Fj(e,t){return e!==`waiting`||t.waitingForAgent!==!0&&t.atItsDay!==!0}var Ij=140;function Lj(e){let t=e?.split(/\r?\n/).map(e=>e.trim()).find(e=>e!==``);if(t!==void 0)return t.length<=Ij?t:`${t.slice(0,139).trimEnd()}…`}function Rj(e,t){let n=zj(e,t);return t.startedBy===`agent`?{...n,headline:`${n.headline} · started by agent`}:n}function zj(e,t){let n=t.title.trim()===``?`Untitled project`:t.title.trim();switch(e){case`ready`:return t.makesVideo?{headline:`Video ready: ${n}`,detail:`Open the project to watch it.`}:{headline:`Run finished: ${n}`,detail:`Open the project to see its files.`};case`partial`:{let e=Lj(t.reason),r=t.makesVideo?`Video ready with problems: ${n}`:`Run finished with problems: ${n}`;return{headline:e===void 0?r:`${r} — ${e}`,detail:`Open the project to see which step failed and the button that fixes it.`}}case`failed`:{let e=Lj(t.reason);return{headline:e===void 0?`Run failed: ${n}`:`Run failed: ${n} — ${e}`,detail:`Open the project to see what stopped it and press Retry.`}}case`step-failed`:{let e=Lj(t.reason);return{headline:e===void 0?`Step failed: ${n}`:`Step failed: ${n} — ${e}`,detail:`The run still waits on another step, so it isn't over. Open the project to see which step failed and press Retry.`}}case`waiting`:return{headline:`Waiting for you: ${n}`,detail:`Open the project to review the held step or press Continue the run.`}}}function Bj(e){let t=e.scheduleName.trim()===``?`Untitled schedule`:e.scheduleName.trim(),n=e.added,r=e.waiting>n?` ${String(e.waiting)} are waiting in all.`:``;return{headline:`${String(n)} new ${n===1?`topic is`:`topics are`} waiting for you`,detail:`Open Calendar → Suggested topics → ${t} to queue or reject ${n===1?`it`:`them`}.${r}`}}var Vj=`slopify.notifications.browser`,Hj=`slopify.notifications.sent`,Uj=`slopify.notifications.told`,Wj=6e4,Gj=new Set;function Kj(){return typeof window<`u`&&`Notification`in window}function qj(){return Kj()?Notification.permission:`unsupported`}function Jj(){try{return window.localStorage.getItem(Vj)===`on`}catch{return!1}}function Yj(e){try{e?window.localStorage.setItem(Vj,`on`):window.localStorage.removeItem(Vj)}catch{}for(let e of Gj)e()}function Xj(e){Gj.add(e);let t=t=>{t.key===Vj&&e()};return window.addEventListener(`storage`,t),()=>{Gj.delete(e),window.removeEventListener(`storage`,t)}}function Zj(){return Jj()&&qj()===`granted`}function Qj(e){if(e===`unsupported`)return`This browser can't show notifications. Use a current Chrome, Edge, Firefox or Safari, or set a Notification URL below instead.`;if(e===`denied`)return`Notifications are blocked for this site. Allow them in your browser's site settings (the icon left of the address bar), reload, then turn Browser notifications on again.`}async function $j(){return Kj()?Notification.permission==="default"?await Notification.requestPermission():Notification.permission:`unsupported`}async function eM(e,t=Date.now){let n=()=>{let n={};try{let e=JSON.parse(window.localStorage.getItem(Hj)??`{}`);typeof e==`object`&&e&&(n=Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`number`&&t()-e[1]<Wj)))}catch{}if(n[e]!==void 0)return!1;try{window.localStorage.setItem(Hj,JSON.stringify({...n,[e]:t()}))}catch{}return!0};try{if(typeof navigator<`u`&&navigator.locks!==void 0)return await navigator.locks.request(`slopify-run-notification`,n)}catch{}return n()}function tM(){try{let e=JSON.parse(window.localStorage.getItem(Uj)??`{}`);return typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).flatMap(([e,t])=>Array.isArray(t)?[[e,t.filter(e=>typeof e==`string`)]]:[]))}catch{return{}}}function nM(e){try{window.localStorage.setItem(Uj,JSON.stringify(e))}catch{}}var rM={read:e=>new Set(tM()[e]??[]),write:(e,t)=>{let{[e]:n,...r}=tM();nM(t.size===0?r:{...r,[e]:[...t]})},keep:e=>{let t=tM();Object.keys(t).every(t=>e.has(t))||nM(Object.fromEntries(Object.entries(t).filter(([t])=>e.has(t))))}};function iM(e,t){let n=new Notification(e.text.headline,{body:e.text.detail,tag:`slopify-run-${e.projectId}`});n.onclick=()=>{window.focus(),t(e.projectId),n.close()}}function aM(e,t){let n=new Notification(e.text.headline,{body:e.text.detail,tag:`slopify-topics-${e.scheduleId}`});n.onclick=()=>{window.focus(),t(),n.close()}}function oM(e,t){let n=e.title.trim()===``?`Untitled project`:e.title.trim(),r=new Notification(`Started: ${n}${e.byAgent===!0?` · by agent`:``}`,{body:`Slopify is working on it. You'll hear a different chime when it ends.`,tag:`slopify-run-${e.projectId}`});r.onclick=()=>{window.focus(),t(e.projectId),r.close()}}var sM=`slopify.notifications.sound`,cM=new Set;function lM(){try{return window.localStorage.getItem(sM)!==`off`}catch{return!0}}function uM(e){try{e?window.localStorage.removeItem(sM):window.localStorage.setItem(sM,`off`)}catch{}for(let e of cM)e()}function dM(e){cM.add(e);let t=t=>{t.key===sM&&e()};return window.addEventListener(`storage`,t),()=>{cM.delete(e),window.removeEventListener(`storage`,t)}}var fM={start:[[784,0,.16],[1175,.14,.3]],end:[[1047,0,.18],[1319,.16,.18],[1568,.32,.55]]};function pM(){if(typeof window<`u`&&typeof window.AudioContext==`function`)try{return new window.AudioContext}catch{return}}function mM(){let e=pM();e!==void 0&&e.resume().catch(()=>{}).finally(()=>void e.close().catch(()=>{}))}function hM(e){let t=pM();t!==void 0&&(async()=>{t.state!==`running`&&await Promise.race([t.resume().catch(()=>{}),new Promise(e=>setTimeout(e,400))]);let n=gM(t,e);setTimeout(()=>void t.close().catch(()=>{}),(n+.5)*1e3)})()}function gM(e,t){let n=e.currentTime+.02,r=e.createDynamicsCompressor();r.threshold.value=-3,r.ratio.value=12,r.connect(e.destination);for(let[i,a,o]of fM[t])for(let[t,s,c]of[[1,.9,`sine`],[2,.25,`triangle`]]){let l=e.createOscillator(),u=e.createGain();l.type=c,l.frequency.value=i*t,u.gain.setValueAtTime(1e-4,n+a),u.gain.exponentialRampToValueAtTime(s,n+a+.012),u.gain.exponentialRampToValueAtTime(1e-4,n+a+o),l.connect(u).connect(r),l.start(n+a),l.stop(n+a+o+.05)}return Math.max(...fM[t].map(([,e,t])=>e+t))}var _M=`slopify.away.snapshot`;function vM(e,t,n){let r=new Set(t.filter(e=>e.status!==`done`).map(e=>e.id)),i=(n?.stepFailures??[]).filter(e=>r.has(e.slice(0,e.indexOf(` `))));return{at:e,states:Object.fromEntries(t.map(e=>[e.id,e.status])),waiting:Object.fromEntries(t.filter(yA).map(e=>[e.id,bM(e).join(`,`)])),stepFailures:[...new Set([...i,...t.flatMap(yM)])]}}function yM(e){return(e.stepFailures??[]).map(t=>`${e.id} ${t}`)}function bM(e){if(e.status===`paused`)return[`paused@${String(e.pauseCount??0)}`];if(e.stopped===!0)return[`stopped@${String(e.stopCount??0)}`];let t=(e.holding??[]).filter(e=>e.waitsFor===`person`).map(e=>`${e.checkpointId}:${e.fingerprint}`);return t.length===0?[`held`]:t}function xM(e,t){let n=e===void 0?[]:e.split(`,`);return t.some(e=>!n.includes(e))}function SM(e,t){let n=0,r=0,i=0,a=0;for(let o of t){a+=yM(o).filter(t=>!e.stepFailures.includes(t)).length;let t=e.states[o.id]!==o.status;t&&(o.status===`done`||o.status===`partial`)?n+=1:t&&o.status===`failed`?r+=1:yA(o)&&xM(e.waiting[o.id],bM(o))&&(i+=1)}return{finished:n,failed:r,waiting:i,stepsFailed:a}}function CM(e){let t=[e.finished>0?`${String(e.finished)} ${e.finished===1?`run finished`:`runs finished`}`:void 0,e.failed>0?`${String(e.failed)} ${e.failed===1?`run failed`:`runs failed`}`:void 0,e.stepsFailed>0?`${String(e.stepsFailed)} ${e.stepsFailed===1?`step failed`:`steps failed`} beside a wait`:void 0,e.waiting>0?`${String(e.waiting)} ${e.waiting===1?`run waits`:`runs wait`} for you`:void 0].filter(e=>e!==void 0);if(t.length!==0)return`While you were away: ${t.join(`, `)}.`}function wM(){try{let e=JSON.parse(window.localStorage.getItem(_M)??`null`);if(typeof e==`object`&&e&&`at`in e&&typeof e.at==`number`&&`states`in e&&typeof e.states==`object`&&e.states!==null&&`waiting`in e&&typeof e.waiting==`object`&&e.waiting!==null&&!Array.isArray(e.waiting)&&`stepFailures`in e&&Array.isArray(e.stepFailures))return{at:e.at,states:Object.fromEntries(Object.entries(e.states).flatMap(([e,t])=>{let n=Sb.find(e=>e===t);return n===void 0?[]:[[e,n]]})),waiting:Object.fromEntries(Object.entries(e.waiting).filter(e=>typeof e[1]==`string`)),stepFailures:e.stepFailures.filter(e=>typeof e==`string`)}}catch{}}function TM(e){try{window.localStorage.setItem(_M,JSON.stringify(e))}catch{}}var EM=3e4;function DM(){let{api:e}=V(),t=_(),n=wv(),r=Ji(),i=(0,m.useRef)(r);i.current=r,(0,m.useEffect)(()=>{let r=!1,a=async()=>(await t.fetchQuery({...iy(e),staleTime:0})).projects,o=async()=>{try{let e=await a();r||TM(vM(Date.now(),e,wM()))}catch{}},s=async()=>{let e=wM();if(e===void 0||Date.now()-e.at<12e4){await o();return}try{let t=await a();if(r)return;let o=CM(SM(e,t));TM(vM(Date.now(),t,e)),o!==void 0&&n(o,`info`,{label:`Open Home`,run:()=>void i.current({to:`/`})})}catch{}},c=()=>{document.visibilityState===`visible`?s():o()};document.visibilityState===`visible`&&s();let l=window.setInterval(()=>{document.visibilityState===`visible`&&o()},EM);return document.addEventListener(`visibilitychange`,c),()=>{r=!0,window.clearInterval(l),document.removeEventListener(`visibilitychange`,c)}},[e,t,n])}function OM(){let e=new Map;return{read:t=>e.get(t)??new Set,write:(t,n)=>{n.size===0?e.delete(t):e.set(t,n)},keep:t=>{for(let n of e.keys())t.has(n)||e.delete(n)}}}var kM=new Set([`done`,`partial`,`failed`,`canceled`]);function AM(e){let t=new Map,n=new Set,r=new Set,i=()=>e.sounds?.()===!0&&e.play!==void 0,a=new Set,o=t=>{let n=t.catch(t=>{e.report(t)}).finally(()=>{a.delete(n)});a.add(n)},s=e.told??OM(),c=async(t,n)=>{let r=await e.subject(t);if(r===void 0)return;let a=Nj(n,r,s.read(t));s.write(t,a.told);let o=[];for(let r of a.notices)await e.claim(r.kind===`step-failed`?`${t}:step-failed:${a.news.join(`,`)}`:`${t}:${`state`in n?n.state:``}`)&&o.push(r);if(o.length>0&&i()&&e.play?.(`end`),e.enabled())for(let n of o)e.show({projectId:t,kind:n.kind,text:Rj(n.kind,{...r,reason:n.reason})})},l=async t=>{let n=await e.subject(t);n!==void 0&&await e.claim(`${t}:started`)&&(i()&&e.play?.(`start`),e.enabled()&&e.showStart?.({projectId:t,title:n.title,...n.startedBy===`agent`?{byAgent:!0}:{}}))};return{observe:r=>{let a=t.get(r.projectId);if(t.set(r.projectId,r.state),a===r.state)return;let s=e.enabled()||i();if(r.state===`running`&&!n.has(r.projectId)){n.add(r.projectId),(i()||e.enabled()&&e.showStart!==void 0)&&o(l(r.projectId));return}kM.has(r.state)&&n.delete(r.projectId);let u=Oj(a,r.state);u!==void 0&&s&&o(c(r.projectId,{kind:u,state:r.state}))},observeStage:t=>{t.state===`failed`&&(e.enabled()||i())&&o(c(t.projectId,{stepFailed:t.stage}))},observeTopics:t=>{if(t.added<=0||!e.enabled()||e.showTopics===void 0)return;let n=e.showTopics;o((async()=>{await e.claim(`topics:${t.scheduleId}:${String(t.waiting)}`)&&n({scheduleId:t.scheduleId,text:Bj(t)})})())},observeReview:t=>{if(!e.enabled()||e.showReview===void 0)return;let n=e.showReview;o((async()=>{let r=await e.subject(t.projectId);r!==void 0&&await e.claim(`review:${t.verdictId}`)&&n({projectId:t.projectId,text:Aj({title:r.title,stage:t.stage,reason:t.reason,...t.byAgent===!0?{byAgent:!0}:{}})})})())},observeAutoPass:t=>{if(r.has(t.reviewId)||!e.enabled()||e.showReview===void 0)return;r.add(t.reviewId);let n=e.showReview;o((async()=>{let r=await e.subject(t.projectId);r!==void 0&&await e.claim(`auto-pass:${t.reviewId}`)&&n({projectId:t.projectId,text:jj({title:r.title,stage:t.stage,item:t.item})})})())},seed:async()=>{try{let r=await e.seed();s.keep(new Set(r.filter(e=>e.status!==`done`).map(e=>e.id)));for(let e of r)t.has(e.id)||(t.set(e.id,e.status),(e.status===`running`||e.status===`paused`)&&n.add(e.id))}catch(t){e.report(t)}},settled:async()=>{for(;a.size>0;)await Promise.all([...a])}}}async function jM(e,t){let n=await jo(e,t),r=Mj(n.stages);return{title:n.project.title,makesVideo:n.project.config.sources.video!==`off`,startedBy:n.startedBy??null,waitingForAgent:n.project.waitingForAgent===!0,status:n.project.status,atItsDay:Pj(n.project.prepared===!0,n.holding),...ide(n.project.status,n.stages)?{stepFailedWhileWaiting:!0}:{},...r.length===0?{}:{failures:r}}}function MM(){let{api:e}=V(),t=_(),n=Ji(),r=(0,m.useRef)(n);r.current=n,DM();let i=(0,m.useMemo)(()=>AM({enabled:Zj,sounds:lM,play:hM,showStart:e=>{oM(e,e=>{r.current({to:`/projects/$projectId`,params:{projectId:e}})})},seed:async()=>(await t.fetchQuery({...iy(e),staleTime:5e3})).projects,subject:t=>jM(e,t),claim:e=>eM(e),told:rM,showTopics:e=>{aM(e,()=>{r.current({to:`/calendar`})})},showReview:e=>{iM(e,e=>{r.current({to:`/projects/$projectId`,params:{projectId:e}})})},show:e=>{iM(e,e=>{r.current({to:`/projects/$projectId`,params:{projectId:e}})})},report:e=>{console.warn(`Slopify couldn't show a run notification.`,e)}}),[e,t]);return(0,m.useEffect)(()=>{let e=()=>Zj()||lM();e()&&i.seed();let t=()=>{e()&&i.seed()},n=Xj(t),r=dM(t);return window.addEventListener(`pointerdown`,mM,{once:!0}),window.addEventListener(`keydown`,mM,{once:!0}),()=>{n(),r(),window.removeEventListener(`pointerdown`,mM),window.removeEventListener(`keydown`,mM)}},[i]),i}function NM({open:e,title:t,onClose:n,children:r,footer:i,width:a=`wide`,headingRef:o,className:s}){let c=(0,m.useId)(),l=(0,m.useRef)(null),u=o??l,d=(0,m.useRef)(null),f=(0,m.useRef)(null),p=(0,m.useRef)(n);return(0,m.useEffect)(()=>{p.current=n}),(0,m.useEffect)(()=>{if(!e)return;d.current=document.activeElement,f.current?.contains(document.activeElement)||u.current?.focus({preventScroll:!0});let t=e=>{e.key!==`Escape`||e.defaultPrevented||document.querySelector(`[data-slot="dialog-content"][data-state="open"]`)||p.current()};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t);let e=d.current;e instanceof HTMLElement&&e.isConnected&&e.focus({preventScroll:!0})}},[e,u]),e?(0,h.jsxs)(`aside`,{ref:f,role:`dialog`,"aria-modal":`false`,"aria-labelledby":c,"data-slot":`drawer`,className:z(`fixed top-0 right-0 bottom-0 z-50 flex w-full flex-col border-l border-line bg-raised shadow-[var(--shadow-dialog)]`,a===`wide`?`sm:w-[min(560px,100vw)]`:`sm:w-[min(440px,100vw)]`,`data-[state=open]:animate-tick-in motion-reduce:animate-none`,s),"data-state":`open`,children:[(0,h.jsxs)(`div`,{className:`flex min-h-12 shrink-0 items-center gap-3 border-b border-line px-4`,children:[(0,h.jsx)(`h2`,{ref:u,id:c,tabIndex:-1,className:`min-w-0 flex-1 truncate text-title-3 font-semibold focus-visible:outline-offset-[-2px]`,children:t}),(0,h.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`Close`,className:`inline-flex size-8 items-center justify-center rounded-control text-ink-2 hover:bg-raised hover:text-ink`,children:(0,h.jsx)(kl,{"aria-hidden":`true`,className:`size-4`})})]}),(0,h.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4`,children:r}),i?(0,h.jsx)(`div`,{className:`flex min-h-14 shrink-0 flex-wrap items-center gap-2 border-t border-line px-4 py-2 pb-[max(8px,env(safe-area-inset-bottom))]`,children:i}):null]}):null}var PM=[`patch-notes`];function FM(e){return at({queryKey:PM,queryFn:async()=>R(await e.client[`patch-notes`].$get()),staleTime:1/0})}function IM(e,t){return at({queryKey:[...PM,t],queryFn:async()=>lo(await e.client[`patch-notes`][`:id`].$get({param:{id:t}})),staleTime:1/0})}async function LM(e){await R(await e.client[`patch-notes`].seen.$post())}var RM={3:[{id:`home`,title:`Home`,body:`What is running and at which step, what is coming up, what needs you and what is ready to upload, on one screen.`,to:`/`,place:`Home`},{id:`play`,title:`Play's one path`,body:`Pick a template, type the topic, press Start. Everything else stays folded away until it needs you.`,to:`/play`,place:`Play`},{id:`reviews`,title:`Automatic reviews`,body:`A reviewer model checks the article, images, narration, thumbnail and shorts, and can send a failed item back to be made again. Turn it on in Play's Review step.`,to:`/play`,place:`Play`},{id:`channels`,title:`Channels and cast`,body:`A channel keeps its brand kit, series brief, templates and schedules, and a cast of characters and places that look the same in every video.`,to:`/channels`,place:`Channels`},{id:`memory`,title:`Episodes that remember`,body:`Each finished episode leaves a short summary on its channel's Episodes tab, and a new article reads the related ones. Add your existing video titles on Existing videos, and topic suggestions skip them too.`,to:`/channels`,place:`Channels`},{id:`calendar`,title:`The calendar`,body:`The coming weeks of uploads on one screen: what is ready, what needs you, and the topics still to come. Its Schedules tab holds every schedule.`,to:`/calendar`,place:`Calendar`},{id:`run-cost`,title:`What a run cost`,body:`Every project has a Run cost tab with the real cost per stage and model. Totals for all projects are in Settings, Usage.`,to:`/settings`,search:{section:`usage`},place:`Usage`},{id:`studio`,title:`YouTube Studio prep`,body:`Slopify never uploads. Prepare upload on a finished project lists everything Studio asks for, and the browser extension can fill it in for you.`,to:`/settings`,search:{section:`studio`},place:`YouTube Studio settings`},{id:`voices`,title:`Multiple voices`,body:`Audiobooks, podcasts, radio drama and interviews, with a voice per speaker. Pick the format under Audio, Speakers on Play.`,to:`/play`,place:`Play`},{id:`long-videos`,title:`Long videos stay watchable`,body:`More images for long videos sets images per hour or one every few minutes, with pan and zoom variety. An ambient bed of rain, fire, wind or your own file can play under the narration. Both are on Play; a channel's brand kit can set the ambient sound for all its videos.`,to:`/play`,place:`Play`},{id:`languages`,title:`Other languages`,body:`A project can be made in another language: pick it on Play, and the article, narration and description are written in it.`,to:`/play`,place:`Play`},{id:`trash`,title:`A trash bin`,body:`Deleted projects, prompts, templates and schedules stay in Settings, Trash for 30 days, and Restore brings them back.`,to:`/settings`,search:{section:`trash`},place:`Trash`}]},zM=[`whats-new`];async function BM(e){return R(await e.client[`whats-new`].$get())}function VM(e){return at({queryKey:zM,queryFn:()=>BM(e),staleTime:1/0})}async function HM(e){return R(await e.client[`whats-new`].seen.$post())}function UM(){let{api:e}=V(),t=_(),n=ej(),r=I(sy(e)),i=I({...VM(e),enabled:r.data?.seen===!0}),[a,o]=(0,m.useState)(0),s=L({mutationFn:()=>HM(e),onSuccess:e=>{t.setQueryData(zM,e),t.setQueryData(PM,e=>e===void 0?e:{...e,due:null})}}),c=i.data?.major,l=c==null?void 0:RM[c],u=l!==void 0&&a>=l.length-1,d=I({...FM(e),enabled:i.data?.show===!0&&u}).data?.current??void 0;if(i.data?.show!==!0||l===void 0||n?.active===!0)return null;let f=l[Math.min(a,l.length-1)];if(f===void 0)return null;let p=l.indexOf(f),g=p===l.length-1,v=()=>{s.mutate()};return(0,h.jsx)(NM,{open:!0,width:`narrow`,title:`What's new in ${String(c)}.0`,onClose:v,footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(B,{variant:`quiet`,disabled:s.isPending,onClick:v,children:`Close tour`}),(0,h.jsx)(`span`,{className:`flex-1`}),(0,h.jsx)(B,{disabled:p===0,disabledReason:`This is the first step`,onClick:()=>{o(p-1)},children:`Back`}),(0,h.jsx)(B,{variant:`primary`,disabled:s.isPending,onClick:()=>{g?v():o(p+1)},children:g?`Finish tour`:`Next`})]}),children:(0,h.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,h.jsx)(`p`,{className:`m-0 text-label text-ink-3`,children:`${String(p+1)} of ${String(l.length)}`}),(0,h.jsx)(`h3`,{className:`m-0 text-title-3`,children:f.title}),(0,h.jsx)(`p`,{className:`m-0 text-ink-2`,children:f.body}),(0,h.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,h.jsx)(LO,{to:f.to,...f.search===void 0?{}:{search:f.search},children:`Open ${f.place}`}),g?(0,h.jsx)(RO,{to:`/settings`,search:{section:`patch-notes`,...d===void 0?{}:{note:d}},onClick:v,children:`Read the full patch notes`}):null]}),s.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:`Slopify could not save that you closed this tour: ${s.error.message} Press Close tour to try again.`})]})})}var WM={danger:(0,h.jsx)(Sl,{"aria-hidden":`true`,strokeWidth:1.75}),waiting:(0,h.jsx)(Fc,{"aria-hidden":`true`,strokeWidth:1.75}),info:(0,h.jsx)(el,{"aria-hidden":`true`,strokeWidth:1.75})};function GM({tone:e=`info`,title:t,children:n,actions:r,className:i}){return(0,h.jsxs)(`div`,{role:e===`danger`?`alert`:`status`,"data-tone":e,className:z(`sl-callout`,e!==`info`&&`sl-callout--${e}`,i),children:[WM[e],(0,h.jsx)(`span`,{className:`sl-callout__title`,children:t}),n===void 0?null:(0,h.jsx)(`div`,{className:`sl-callout__body`,children:n}),r===void 0?null:(0,h.jsx)(`div`,{className:`sl-callout__actions`,children:r})]})}function KM(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var qM=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,JM=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,YM={};function XM(e,t){return((t||YM).jsx?JM:qM).test(e)}var ZM=/[ \t\n\f\r]/g;function QM(e){return typeof e==`object`?e.type===`text`&&$M(e.value):$M(e)}function $M(e){return e.replace(ZM,``)===``}var eN=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};eN.prototype.normal={},eN.prototype.property={},eN.prototype.space=void 0;function tN(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new eN(n,r,t)}function nN(e){return e.toLowerCase()}var rN=class{constructor(e,t){this.attribute=t,this.property=e}};rN.prototype.attribute=``,rN.prototype.booleanish=!1,rN.prototype.boolean=!1,rN.prototype.commaOrSpaceSeparated=!1,rN.prototype.commaSeparated=!1,rN.prototype.defined=!1,rN.prototype.mustUseProperty=!1,rN.prototype.number=!1,rN.prototype.overloadedBoolean=!1,rN.prototype.property=``,rN.prototype.spaceSeparated=!1,rN.prototype.space=void 0;var iN=s({boolean:()=>oN,booleanish:()=>sN,commaOrSpaceSeparated:()=>fN,commaSeparated:()=>dN,number:()=>lN,overloadedBoolean:()=>cN,spaceSeparated:()=>uN}),aN=0,oN=pN(),sN=pN(),cN=pN(),lN=pN(),uN=pN(),dN=pN(),fN=pN();function pN(){return 2**++aN}var mN=Object.keys(iN),hN=class extends rN{constructor(e,t,n,r){let i=-1;if(super(e,t),gN(this,`space`,r),typeof n==`number`)for(;++i<mN.length;){let e=mN[i];gN(this,mN[i],(n&iN[e])===iN[e])}}};hN.prototype.defined=!0;function gN(e,t,n){n&&(e[t]=n)}function _N(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new hN(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[nN(r)]=r,n[nN(a.attribute)]=r}return new eN(t,n,e.space)}var vN=_N({properties:{ariaActiveDescendant:null,ariaAtomic:sN,ariaAutoComplete:null,ariaBusy:sN,ariaChecked:sN,ariaColCount:lN,ariaColIndex:lN,ariaColSpan:lN,ariaControls:uN,ariaCurrent:null,ariaDescribedBy:uN,ariaDetails:null,ariaDisabled:sN,ariaDropEffect:uN,ariaErrorMessage:null,ariaExpanded:sN,ariaFlowTo:uN,ariaGrabbed:sN,ariaHasPopup:null,ariaHidden:sN,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:uN,ariaLevel:lN,ariaLive:null,ariaModal:sN,ariaMultiLine:sN,ariaMultiSelectable:sN,ariaOrientation:null,ariaOwns:uN,ariaPlaceholder:null,ariaPosInSet:lN,ariaPressed:sN,ariaReadOnly:sN,ariaRelevant:null,ariaRequired:sN,ariaRoleDescription:uN,ariaRowCount:lN,ariaRowIndex:lN,ariaRowSpan:lN,ariaSelected:sN,ariaSetSize:lN,ariaSort:null,ariaValueMax:lN,ariaValueMin:lN,ariaValueNow:lN,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function yN(e,t){return t in e?e[t]:t}function bN(e,t){return yN(e,t.toLowerCase())}var xN=_N({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:dN,acceptCharset:uN,accessKey:uN,action:null,allow:null,allowFullScreen:oN,allowPaymentRequest:oN,allowUserMedia:oN,alpha:oN,alt:null,as:null,async:oN,autoCapitalize:null,autoComplete:uN,autoFocus:oN,autoPlay:oN,blocking:uN,capture:null,charSet:null,checked:oN,cite:null,className:uN,closedBy:null,colorSpace:null,cols:lN,colSpan:lN,command:null,commandFor:null,content:null,contentEditable:sN,controls:oN,controlsList:uN,coords:lN|dN,crossOrigin:null,data:null,dateTime:null,decoding:null,default:oN,defer:oN,dir:null,dirName:null,disabled:oN,download:cN,draggable:sN,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:oN,formTarget:null,headers:uN,height:lN,hidden:cN,high:lN,href:null,hrefLang:null,htmlFor:uN,httpEquiv:uN,id:null,imageSizes:null,imageSrcSet:null,inert:oN,inputMode:null,integrity:null,is:null,isMap:oN,itemId:null,itemProp:uN,itemRef:uN,itemScope:oN,itemType:uN,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:oN,low:lN,manifest:null,max:null,maxLength:lN,media:null,method:null,min:null,minLength:lN,multiple:oN,muted:oN,name:null,nonce:null,noModule:oN,noValidate:oN,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:oN,optimum:lN,pattern:null,ping:uN,placeholder:null,playsInline:oN,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:oN,referrerPolicy:null,rel:uN,required:oN,reversed:oN,rows:lN,rowSpan:lN,sandbox:uN,scope:null,scoped:oN,seamless:oN,selected:oN,shadowRootClonable:oN,shadowRootCustomElementRegistry:oN,shadowRootDelegatesFocus:oN,shadowRootMode:null,shadowRootSerializable:oN,shape:null,size:lN,sizes:null,slot:null,span:lN,spellCheck:sN,src:null,srcDoc:null,srcLang:null,srcSet:null,start:lN,step:null,style:null,tabIndex:lN,target:null,title:null,translate:null,type:null,typeMustMatch:oN,useMap:null,value:sN,width:lN,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:uN,axis:null,background:null,bgColor:null,border:lN,borderColor:null,bottomMargin:lN,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:oN,declare:oN,event:null,face:null,frame:null,frameBorder:null,hSpace:lN,leftMargin:lN,link:null,longDesc:null,lowSrc:null,marginHeight:lN,marginWidth:lN,noResize:oN,noHref:oN,noShade:oN,noWrap:oN,object:null,profile:null,prompt:null,rev:null,rightMargin:lN,rules:null,scheme:null,scrolling:sN,standby:null,summary:null,text:null,topMargin:lN,valueType:null,version:null,vAlign:null,vLink:null,vSpace:lN,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:oN,disablePictureInPicture:oN,disableRemotePlayback:oN,exportParts:dN,part:uN,prefix:null,property:null,results:lN,security:null,unselectable:null},space:`html`,transform:bN}),SN=_N({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:fN,accentHeight:lN,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:lN,amplitude:lN,arabicForm:null,ascent:lN,attributeName:null,attributeType:null,azimuth:lN,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:lN,by:null,calcMode:null,capHeight:lN,className:uN,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:lN,diffuseConstant:lN,direction:null,display:null,dur:null,divisor:lN,dominantBaseline:null,download:oN,dx:null,dy:null,edgeMode:null,editable:null,elevation:lN,enableBackground:null,end:null,event:null,exponent:lN,externalResourcesRequired:null,fill:null,fillOpacity:lN,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:dN,g2:dN,glyphName:dN,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:lN,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:lN,horizOriginX:lN,horizOriginY:lN,id:null,ideographic:lN,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:lN,k:lN,k1:lN,k2:lN,k3:lN,k4:lN,kernelMatrix:fN,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:lN,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:lN,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:lN,overlineThickness:lN,paintOrder:null,panose1:null,path:null,pathLength:lN,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:uN,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:lN,pointsAtY:lN,pointsAtZ:lN,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:fN,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:fN,rev:fN,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:fN,requiredFeatures:fN,requiredFonts:fN,requiredFormats:fN,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:lN,specularExponent:lN,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:lN,strikethroughThickness:lN,string:null,stroke:null,strokeDashArray:fN,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:lN,strokeOpacity:lN,strokeWidth:null,style:null,surfaceScale:lN,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:fN,tabIndex:lN,tableValues:null,target:null,targetX:lN,targetY:lN,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:fN,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:lN,underlineThickness:lN,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:lN,values:null,vAlphabetic:lN,vMathematical:lN,vectorEffect:null,vHanging:lN,vIdeographic:lN,version:null,vertAdvY:lN,vertOriginX:lN,vertOriginY:lN,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:lN,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:yN}),CN=_N({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),wN=_N({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:bN}),TN=_N({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),EN={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},DN=/[A-Z]/g,ON=/-[a-z]/g,kN=/^data[-\w.:]+$/i;function AN(e,t){let n=nN(t),r=t,i=rN;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&kN.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(ON,MN);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!ON.test(e)){let n=e.replace(DN,jN);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=hN}return new i(r,t)}function jN(e){return`-`+e.toLowerCase()}function MN(e){return e.charAt(1).toUpperCase()}var NN=tN([vN,xN,CN,wN,TN],`html`),PN=tN([vN,SN,CN,wN,TN],`svg`);function FN(e){return e.join(` `).trim()}var IN=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
|
|
105
105
|
`);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),LN=o((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(IN());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),RN=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),zN=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(LN()),r=RN();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),BN=HN(`end`),VN=HN(`start`);function HN(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function Jde(e){let t=VN(e),n=BN(e);if(t&&n)return{start:t,end:n}}function UN(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?GN(e.position):`start`in e||`end`in e?GN(e):`line`in e||`column`in e?WN(e):``}function WN(e){return KN(e&&e.line)+`:`+KN(e&&e.column)}function GN(e){return WN(e&&e.start)+`-`+WN(e&&e.end)}function KN(e){return e&&typeof e==`number`?e:1}var qN=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=UN(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};qN.prototype.file=``,qN.prototype.name=``,qN.prototype.reason=``,qN.prototype.message=``,qN.prototype.stack=``,qN.prototype.column=void 0,qN.prototype.line=void 0,qN.prototype.ancestors=void 0,qN.prototype.cause=void 0,qN.prototype.fatal=void 0,qN.prototype.place=void 0,qN.prototype.ruleId=void 0,qN.prototype.source=void 0;var Yde=l(zN(),1),JN={}.hasOwnProperty,Xde=new Map,Zde=/[A-Z]/g,Qde=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),$de=new Set([`td`,`th`]),YN=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function efe(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=cfe(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=sfe(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?PN:NN,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=XN(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function XN(e,t,n){if(t.type===`element`)return tfe(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return nfe(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return ife(e,t,n);if(t.type===`mdxjsEsm`)return rfe(e,t);if(t.type===`root`)return afe(e,t,n);if(t.type===`text`)return ofe(e,t)}function tfe(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=PN,e.schema=i),e.ancestors.push(t);let a=eP(e,t.tagName,!1),o=lfe(e,t),s=$N(e,t);return Qde.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!QM(e)})),ZN(e,o,a,t),QN(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function nfe(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}tP(e,t.position)}function rfe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);tP(e,t.position)}function ife(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=PN,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:eP(e,t.name,!0),o=ufe(e,t),s=$N(e,t);return ZN(e,o,a,t),QN(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function afe(e,t,n){let r={};return QN(r,$N(e,t)),e.create(t,e.Fragment,r,n)}function ofe(e,t){return t.value}function ZN(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function QN(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function sfe(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function cfe(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=VN(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function lfe(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&JN.call(t.properties,i)){let a=dfe(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&$de.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function ufe(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else tP(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else tP(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function $N(e,t){let n=[],r=-1,i=e.passKeys?new Map:Xde;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=XN(e,a,o);s!==void 0&&n.push(s)}return n}function dfe(e,t,n){let r=AN(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?KM(n):FN(n)),r.property===`style`){let t=typeof n==`object`?n:ffe(e,String(n));return e.stylePropertyNameCase===`css`&&(t=pfe(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?EN[r.property]||r.property:r.attribute,n]}}function ffe(e,t){try{return(0,Yde.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new qN("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=YN+`#cannot-parse-style-attribute`,r}}function eP(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=XM(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=XM(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return JN.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);tP(e)}function tP(e,t){let n=new qN("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=YN+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function pfe(e){let t={},n;for(n in e)JN.call(e,n)&&(t[mfe(n)]=e[n]);return t}function mfe(e){let t=e.replace(Zde,hfe);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function hfe(e){return`-`+e.toLowerCase()}var nP={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},gfe={};function rP(e,t){let n=t||gfe;return iP(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function iP(e,t,n){if(_fe(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return aP(e.children,t,n)}return Array.isArray(e)?aP(e,t,n):``}function aP(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=iP(e[i],t,n);return r.join(``)}function _fe(e){return!!(e&&typeof e==`object`)}var oP=document.createElement(`i`);function sP(e){let t=`&`+e+`;`;oP.innerHTML=t;let n=oP.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function cP(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function lP(e,t){return e.length>0?(cP(e,e.length,0,t),e):t}var uP={}.hasOwnProperty;function dP(e){let t={},n=-1;for(;++n<e.length;)vfe(t,e[n]);return t}function vfe(e,t){let n;for(n in t){let r=(uP.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){uP.call(r,a)||(r[a]=[]);let e=i[a];yfe(r[a],Array.isArray(e)?e:e?[e]:[])}}}function yfe(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);cP(e,0,0,r)}function fP(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function pP(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var mP=CP(/[A-Za-z]/),hP=CP(/[\dA-Za-z]/),bfe=CP(/[#-'*+\--9=?A-Z^-~]/);function gP(e){return e!==null&&(e<32||e===127)}var _P=CP(/\d/),xfe=CP(/[\dA-Fa-f]/),Sfe=CP(/[!-/:-@[-`{-~]/);function vP(e){return e!==null&&e<-2}function yP(e){return e!==null&&(e<0||e===32)}function bP(e){return e===-2||e===-1||e===32}var xP=CP(/\p{P}|\p{S}/u),SP=CP(/\s/);function CP(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function wP(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&hP(e.charCodeAt(n+1))&&hP(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function TP(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return bP(r)?(e.enter(n),s(r)):t(r)}function s(r){return bP(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var Cfe={tokenize:wfe};function wfe(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),TP(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return vP(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Tfe={tokenize:Efe},EP={tokenize:Dfe};function Efe(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return cP(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!(!i.currentConstruct||i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(EP,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(EP,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return vP(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;cP(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Dfe(e,t,n){return TP(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function DP(e){if(e===null||yP(e)||SP(e))return 1;if(xP(e))return 2}function OP(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var kP={name:`attention`,resolveAll:Ofe,tokenize:kfe};function Ofe(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};AP(d,-c),AP(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=lP(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=lP(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=lP(l,OP(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=lP(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=lP(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,cP(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function kfe(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=DP(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=DP(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function AP(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Afe={name:`autolink`,tokenize:jfe};function jfe(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return mP(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||hP(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||hP(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||gP(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):bfe(t)?(e.consume(t),l):n(t)}function u(e){return hP(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||hP(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var jP={partial:!0,tokenize:Mfe};function Mfe(e,t,n){return r;function r(t){return bP(t)?TP(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||vP(e)?t(e):n(e)}}var MP={continuation:{tokenize:Pfe},exit:Ffe,name:`blockQuote`,tokenize:Nfe};function Nfe(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return bP(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Pfe(e,t,n){let r=this;return i;function i(t){return bP(t)?TP(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(MP,t,n)(r)}}function Ffe(e){e.exit(`blockQuote`)}var NP={name:`characterEscape`,tokenize:Ife};function Ife(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Sfe(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var PP={name:`characterReference`,tokenize:Lfe};function Lfe(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=hP,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=xfe,u):(e.enter(`characterReferenceValue`),a=7,o=_P,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===hP&&!sP(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var FP={partial:!0,tokenize:zfe},IP={concrete:!0,name:`codeFenced`,tokenize:Rfe};function Rfe(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),bP(t)?TP(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||vP(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(FP,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||vP(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):bP(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),TP(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||vP(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||vP(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&bP(t)?TP(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||vP(t)?e.check(FP,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||vP(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),bP(t)?TP(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),bP(t)?TP(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||vP(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function zfe(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var LP={name:`codeIndented`,tokenize:Vfe},Bfe={partial:!0,tokenize:Hfe};function Vfe(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),TP(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):vP(t)?e.attempt(Bfe,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||vP(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Hfe(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):vP(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):TP(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):vP(e)?i(e):n(e)}}var Ufe={name:`codeText`,previous:Gfe,resolve:Wfe,tokenize:Kfe};function Wfe(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Gfe(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Kfe(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):vP(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||vP(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var qfe=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&RP(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),RP(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),RP(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);RP(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);RP(this.left,t.reverse())}}}};function RP(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function zP(e){let t={},n=-1,r,i,a,o,s,c,l,u=new qfe(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,Jfe(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return cP(e,0,1/0,u.slice(0)),!l}function Jfe(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var Yfe={resolve:Zfe,tokenize:Qfe},Xfe={partial:!0,tokenize:$fe};function Zfe(e){return zP(e),e}function Qfe(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):vP(t)?e.check(Xfe,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function $fe(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),TP(e,a,`linePrefix`)}function a(i){if(i===null||vP(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function BP(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||gP(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||vP(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||yP(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||gP(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function VP(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):vP(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||vP(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!bP(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function HP(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):vP(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),TP(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||vP(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function UP(e,t){let n;return r;function r(i){return vP(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):bP(i)?TP(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var epe={name:`definition`,tokenize:npe},tpe={partial:!0,tokenize:rpe};function npe(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return VP.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=pP(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return yP(t)?UP(e,l)(t):l(t)}function l(t){return BP(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(tpe,d,d)(t)}function d(t){return bP(t)?TP(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||vP(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function rpe(e,t,n){return r;function r(t){return yP(t)?UP(e,i)(t):n(t)}function i(t){return HP(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return bP(t)?TP(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||vP(e)?t(e):n(e)}}var ipe={name:`hardBreakEscape`,tokenize:ape};function ape(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return vP(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var ope={name:`headingAtx`,resolve:spe,tokenize:cpe};function spe(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},cP(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function cpe(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||yP(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||vP(n)?(e.exit(`atxHeading`),t(n)):bP(n)?TP(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||yP(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var lpe=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),WP=[`pre`,`script`,`style`,`textarea`],upe={concrete:!0,name:`htmlFlow`,resolveTo:ppe,tokenize:mpe},dpe={partial:!0,tokenize:gpe},fpe={partial:!0,tokenize:hpe};function ppe(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function mpe(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:F):mP(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):mP(a)?(e.consume(a),i=4,r.interrupt?t:F):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:F):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return mP(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||yP(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&WP.includes(l)?(i=1,r.interrupt?t(s):O(s)):lpe.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||hP(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return bP(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||mP(t)?(e.consume(t),b):bP(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||hP(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):bP(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):bP(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||vP(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||yP(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||bP(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||vP(t)?O(t):bP(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),te):t===63&&i===3?(e.consume(t),F):t===93&&i===5?(e.consume(t),ee):vP(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(dpe,ne,k)(t)):t===null||vP(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(fpe,A,ne)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||vP(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),F):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return WP.includes(n)?(e.consume(t),te):O(t)}return mP(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function ee(t){return t===93?(e.consume(t),F):O(t)}function F(t){return t===62?(e.consume(t),te):t===45&&i===2?(e.consume(t),F):O(t)}function te(t){return t===null||vP(t)?(e.exit(`htmlFlowData`),ne(t)):(e.consume(t),te)}function ne(n){return e.exit(`htmlFlow`),t(n)}}function hpe(e,t,n){let r=this;return i;function i(t){return vP(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function gpe(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(jP,t,n)}}var _pe={name:`htmlText`,tokenize:vpe};function vpe(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):mP(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):mP(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):vP(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):vP(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):vP(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):vP(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return mP(t)?(e.consume(t),S):n(t)}function S(t){return t===45||hP(t)?(e.consume(t),S):C(t)}function C(t){return vP(t)?(o=C,N(t)):bP(t)?(e.consume(t),C):M(t)}function w(t){return t===45||hP(t)?(e.consume(t),w):t===47||t===62||yP(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||mP(t)?(e.consume(t),E):vP(t)?(o=T,N(t)):bP(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||hP(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):vP(t)?(o=D,N(t)):bP(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):vP(t)?(o=O,N(t)):bP(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):vP(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||yP(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||yP(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return bP(t)?TP(e,ee,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ee(t)}function ee(t){return e.enter(`htmlTextData`),o(t)}}var GP={name:`labelEnd`,resolveAll:Spe,resolveTo:Cpe,tokenize:wpe},ype={tokenize:Tpe},bpe={tokenize:Epe},xpe={tokenize:Dpe};function Spe(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&cP(e,0,e.length,n),e}function Cpe(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=lP(s,e.slice(a+1,a+r+3)),s=lP(s,[[`enter`,u,t]]),s=lP(s,OP(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=lP(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=lP(s,e.slice(o+1)),s=lP(s,[[`exit`,c,t]]),cP(e,a,e.length,s),e}function wpe(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(pP(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(ype,u,o?u:d)(t):t===91?e.attempt(bpe,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(xpe,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function Tpe(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return yP(t)?UP(e,a)(t):a(t)}function a(t){return t===41?u(t):BP(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return yP(t)?UP(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?HP(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return yP(t)?UP(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function Epe(e,t,n){let r=this;return i;function i(t){return VP.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(pP(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function Dpe(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var Ope={name:`labelStartImage`,resolveAll:GP.resolveAll,tokenize:kpe};function kpe(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Ape={name:`labelStartLink`,resolveAll:GP.resolveAll,tokenize:jpe};function jpe(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var KP={name:`lineEnding`,tokenize:Mpe};function Mpe(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),TP(e,t,`linePrefix`)}}var qP={name:`thematicBreak`,tokenize:Npe};function Npe(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||vP(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),bP(t)?TP(e,s,`whitespace`)(t):s(t))}}var JP={continuation:{tokenize:Lpe},exit:zpe,name:`list`,tokenize:Ipe},Ppe={partial:!0,tokenize:Bpe},Fpe={partial:!0,tokenize:Rpe};function Ipe(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:_P(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(qP,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return _P(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(jP,r.interrupt?n:u,e.attempt(Ppe,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return bP(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function Lpe(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(jP,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,TP(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!bP(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Fpe,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,TP(e,e.attempt(JP,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Rpe(e,t,n){let r=this;return TP(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function zpe(e){e.exit(this.containerState.type)}function Bpe(e,t,n){let r=this;return TP(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!bP(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var YP={name:`setextUnderline`,resolveTo:Vpe,tokenize:Hpe};function Vpe(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function Hpe(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),bP(t)?TP(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||vP(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Upe={tokenize:Wpe};function Wpe(e){let t=this,n=e.attempt(jP,r,e.attempt(this.parser.constructs.flowInitial,i,TP(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Yfe,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Gpe={resolveAll:ZP()},Kpe=XP(`string`),qpe=XP(`text`);function XP(e){return{resolveAll:ZP(e===`text`?Jpe:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function ZP(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function Jpe(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var Ype=s({attentionMarkers:()=>rme,contentInitial:()=>Zpe,disable:()=>ime,document:()=>Xpe,flow:()=>$pe,flowInitial:()=>Qpe,insideSpan:()=>nme,string:()=>eme,text:()=>tme}),Xpe={42:JP,43:JP,45:JP,48:JP,49:JP,50:JP,51:JP,52:JP,53:JP,54:JP,55:JP,56:JP,57:JP,62:MP},Zpe={91:epe},Qpe={[-2]:LP,[-1]:LP,32:LP},$pe={35:ope,42:qP,45:[YP,qP],60:upe,61:YP,95:qP,96:IP,126:IP},eme={38:PP,92:NP},tme={[-5]:KP,[-4]:KP,[-3]:KP,33:Ope,38:PP,42:kP,60:[Afe,_pe],91:Ape,92:[ipe,NP],93:GP,95:kP,96:Ufe},nme={null:[kP,Gpe]},rme={null:[42,95]},ime={null:[]};function ame(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=lP(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=OP(a,l.events,l),l.events):[]}function f(e,t){return sme(p(e),t)}function p(e){return ome(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){vP(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&cP(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function ome(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function sme(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
106
106
|
`;break;case-3:o=`\r
|
|
107
107
|
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function cme(e){let t={constructs:dP([Ype,...(e||{}).extensions||[]]),content:n(Cfe),defined:[],document:n(Tfe),flow:n(Upe),lazy:{},string:n(Kpe),text:n(qpe)};return t;function n(e){return n;function n(n){return ame(t,e,n)}}}function lme(e){for(;!zP(e););return e}var QP=/[\0\t\n\r]/g;function ume(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(QP.lastIndex=u,c=QP.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var dme=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function $P(e){return e.replace(dme,fme)}function fme(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return fP(n.slice(t?2:1),t?16:10)}return sP(n)||e}var eF={}.hasOwnProperty;function pme(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),mme(n)(lme(cme(n).document().write(ume()(e,t,!0))))}function mme(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(ye),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(he),blockQuote:a(ue),characterEscape:T,characterReference:T,codeFenced:a(de),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(de,o),codeText:a(fe,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(pe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(me),hardBreakEscape:a(ge),hardBreakTrailing:a(ge),htmlFlow:a(_e,o),htmlFlowData:T,htmlText:a(_e,o),htmlTextData:T,image:a(ve),label:o,link:a(ye),listItem:a(xe),listItemValue:f,listOrdered:a(be,d),listUnordered:a(be),paragraph:a(Se),reference:re,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(he),strong:a(Ce),thematicBreak:a(Te)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:le,autolinkProtocol:ce,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:ae,characterReferenceMarkerNumeric:ae,characterReferenceValue:oe,characterReference:se,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(N),label:ee,labelText:P,lineEnding:D,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ie,resourceDestinationString:F,resourceTitleString:te,resource:ne,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};nF(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];eF.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||rF).call(a,void 0,e[0])}for(r.position={start:tF(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:tF(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(t[1].type!==`linePrefix`&&t[1].type!==`blockQuotePrefix`&&t[1].type!==`blockQuotePrefixWhitespace`&&t[1].type!==`blockQuoteMarker`&&t[1].type!==`listItemIndent`)break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:tF(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||rF).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+UN({start:e.start,end:e.end})+`): it’s not open`);n.position.end=tF(e.end)}function u(){return rP(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=pP(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=we(),n.position={start:tF(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=tF(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=tF(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function P(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=$P(t),n.identifier=pP(t).toLowerCase()}function ee(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function F(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ne(){this.data.inReference=void 0}function re(){this.data.referenceType=`collapsed`}function ie(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=pP(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function ae(e){this.data.characterReferenceType=e.type}function oe(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=fP(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=sP(t);let i=this.stack[this.stack.length-1];i.value+=r}function se(e){let t=this.stack.pop();t.position.end=tF(e.end)}function ce(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function le(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function ue(){return{type:`blockquote`,children:[]}}function de(){return{type:`code`,lang:null,meta:null,value:``}}function fe(){return{type:`inlineCode`,value:``}}function pe(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function me(){return{type:`emphasis`,children:[]}}function he(){return{type:`heading`,depth:0,children:[]}}function ge(){return{type:`break`}}function _e(){return{type:`html`,value:``}}function ve(){return{type:`image`,title:null,url:``,alt:null}}function ye(){return{type:`link`,title:null,url:``,children:[]}}function be(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function xe(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function Se(){return{type:`paragraph`,children:[]}}function Ce(){return{type:`strong`,children:[]}}function we(){return{type:`text`,value:``}}function Te(){return{type:`thematicBreak`}}}function tF(e){return{line:e.line,column:e.column,offset:e.offset}}function nF(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?nF(e,r):hme(e,r)}}function hme(e,t){let n;for(n in t)if(eF.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function rF(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+UN({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+UN({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+UN({start:t.start,end:t.end})+`) is still open`)}function iF(e){let t=this;t.parser=n;function n(n){return pme(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function gme(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function _me(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
@@ -268,10 +268,10 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
268
268
|
`)}function CG(e,t){if(e.trim()===``)return{ok:!0,rows:[]};let n;try{n=Zve(e,{schema:`failsafe`,uniqueKeys:!0})}catch(e){return{ok:!1,problems:[`The list couldn't be read as YAML or JSON: ${(e instanceof Error?e.message.split(`
|
|
269
269
|
`)[0]:``)??``}. Write one item per topic, such as "- Topic: Cleopatra".`]}}if(!Array.isArray(n))return{ok:!1,problems:[`The list must be a list of topics: start each one with "- " in YAML, or wrap them in [ ] in JSON.`]};let r=[],i=[];n.forEach((e,n)=>{let a=`Topic ${String(n+1)}`;if(typeof e==`string`){i.push({title:e.trim(),values:{}});return}if(typeof e!=`object`||!e||Array.isArray(e)){r.push(`${a} is not a topic or a set of keywords. Write it as "- Cleopatra" or "- Topic: Cleopatra".`);return}let o=``,s={};for(let[n,i]of Object.entries(e)){let e=n.trim(),c=i??``;if(typeof c!=`string`){r.push(`${a}: ${_G(e)} holds a list or a map. Give it one value, such as "${e}: 12000".`);continue}t.topicKeyword!==null&&e===t.topicKeyword?o=c.trim():t.keywords.includes(e)?s[e]=c.trim():r.push(`${a}: ${_G(e)} is not a keyword of this template (its keywords are ${vG(t.keywords)}). Rename it to one of them or remove it.`)}i.push({title:o,values:s})});let a=[...r,...yG(i,t)];return a.length>0?{ok:!1,problems:a}:{ok:!0,rows:i}}function wG(e,t){return e.length===0?``:Qve(e.map(e=>Object.keys(e.values).length===0||t===null?e.title:{[t]:e.title,...e.values}),{lineWidth:0})}function TG(e,t=void 0){(0,m.useEffect)(()=>{let t=e.current;if(t===null)return;let n=()=>{let e=t.scrollLeft>1,n=t.scrollLeft+t.clientWidth<t.scrollWidth-1;t.toggleAttribute(`data-more-before`,e),t.toggleAttribute(`data-more-after`,n)};n(),t.addEventListener(`scroll`,n,{passive:!0});let r=typeof ResizeObserver==`function`?new ResizeObserver(n):void 0;return r?.observe(t),()=>{t.removeEventListener(`scroll`,n),r?.disconnect()}},[e]),(0,m.useEffect)(()=>{let t=e.current;if(t===null||t.scrollWidth<=t.clientWidth)return;let n=t.querySelector(`[aria-current]:not([aria-current="false"]), [aria-selected="true"]`);if(n===null)return;let r=n.getBoundingClientRect().left-t.getBoundingClientRect().left+t.scrollLeft,i=r+n.getBoundingClientRect().width;r<t.scrollLeft?t.scrollLeft=Math.max(0,r-24):i>t.scrollLeft+t.clientWidth&&(t.scrollLeft=i-t.clientWidth+24)},[e,t])}function EG({title:e,crumb:t,meta:n,actions:r,display:i=!1,row:a=!1,className:o}){return a?(0,h.jsxs)(`header`,{className:z(`sl-page-header-row mb-4 flex flex-wrap items-center gap-x-4 gap-y-2`,o),"data-slot":`page-header`,children:[t===void 0?null:(0,h.jsx)(`div`,{className:`sl-crumb shrink-0`,children:t}),(0,h.jsx)(`h1`,{className:`sl-title-1 min-w-0 break-words`,children:e}),n===void 0?null:(0,h.jsx)(`p`,{className:`m-0 min-w-0 text-small text-ink-2`,children:n}),r===void 0?null:(0,h.jsx)(`div`,{className:`sl-btn-row ml-auto`,children:r})]}):(0,h.jsxs)(`header`,{className:z(`mb-6 flex flex-wrap items-end justify-between gap-4`,o),"data-slot":`page-header`,children:[(0,h.jsxs)(`div`,{className:`min-w-0`,children:[t===void 0?null:(0,h.jsx)(`div`,{className:`sl-crumb`,children:t}),(0,h.jsx)(`h1`,{className:z(i?`sl-display`:`sl-title-1`,`mt-1 break-words`),children:e}),n===void 0?null:(0,h.jsx)(`p`,{className:`m-0 mt-1 text-small text-ink-2`,children:n})]}),r===void 0?null:(0,h.jsx)(`div`,{className:`sl-btn-row`,children:r})]})}function DG({sections:e,aside:t,asideLabel:n=`Status and next action`,children:r,className:i}){return(0,h.jsxs)(`div`,{className:z(`sl-workspace`,e===void 0&&`sl-workspace--no-sections`,t===void 0&&`sl-workspace--no-aside`,e===void 0&&t===void 0&&`!grid-cols-1`,i),children:[e===void 0?null:(0,h.jsx)(aye,{children:e}),(0,h.jsx)(`div`,{className:`sl-workspace__main`,children:r}),t===void 0?null:(0,h.jsx)(`aside`,{"aria-label":n,className:`sl-workspace__aside`,children:t})]})}function aye({children:e}){let t=(0,m.useRef)(null),[n,r]=(0,m.useState)(void 0);return TG(t,n),(0,m.useEffect)(()=>{let e=t.current;if(e===null||typeof MutationObserver!=`function`)return;let n=()=>r(e.querySelector(`[aria-current]:not([aria-current="false"])`)?.textContent??void 0);n();let i=new MutationObserver(n);return i.observe(e,{subtree:!0,attributes:!0,attributeFilter:[`aria-current`]}),()=>i.disconnect()},[]),(0,h.jsx)(`div`,{ref:t,className:`sl-workspace__sections`,children:e})}function OG({list:e,detail:t,className:n}){return(0,h.jsxs)(`div`,{className:z(`sl-listdetail`,n),children:[(0,h.jsx)(`div`,{className:`sl-listdetail__list`,children:e}),(0,h.jsx)(`div`,{className:`sl-listdetail__detail`,children:t})]})}function kG({className:e}){return(0,h.jsx)(`hr`,{className:z(`sl-rule`,e)})}function AG(e){let[t,n]=(0,m.useState)(()=>new Set),r=(0,m.useRef)(void 0),i=(0,m.useMemo)(()=>e.filter(e=>t.has(e)),[e,t]),a=(0,m.useCallback)((t,i=!1)=>{let a=r.current===void 0?-1:e.indexOf(r.current),o=e.indexOf(t);n(n=>{let r=new Set(n);if(i&&a>=0&&o>=0){let i=!n.has(t);for(let t of e.slice(Math.min(a,o),Math.max(a,o)+1))i?r.add(t):r.delete(t)}else r.has(t)?r.delete(t):r.add(t);return r}),r.current=t},[e]),o=(0,m.useCallback)(t=>n(t?new Set(e):new Set),[e]),s=(0,m.useCallback)(()=>n(new Set),[]),c=(0,m.useCallback)(e=>{if(e.key!==`Escape`||t.size===0)return;let r=e.target;r instanceof HTMLElement&&r.matches(`input:not([type=checkbox]), textarea`)||(e.preventDefault(),n(new Set))},[t]);return{selected:i,count:i.length,has:e=>t.has(e),toggle:a,setAll:o,clear:s,onKeyDown:c}}var jG=`size-4 shrink-0 accent-[var(--color-accent)]`;function MG({selection:e,value:t,label:n,className:r}){let i=(0,m.useRef)(!1);return(0,h.jsx)(`label`,{"data-slot":`row-check`,onPointerDown:e=>{i.current=e.shiftKey},className:z(`relative z-10 -m-1 inline-grid size-6 shrink-0 cursor-pointer place-items-center`,r),children:(0,h.jsx)(`input`,{type:`checkbox`,"aria-label":`Select row: ${n}`,checked:e.has(t),onClick:e=>{e.shiftKey&&(i.current=!0)},onChange:()=>{e.toggle(t,i.current),i.current=!1},className:jG})})}function oye({selection:e,total:t,scope:n}){let r=t>0&&e.count===t;return(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:r,disabled:t===0,ref:t=>{t!==null&&(t.indeterminate=e.count>0&&!r)},onChange:t=>e.setAll(t.currentTarget.checked),className:jG}),n??`Select all`]})}function NG({selection:e,total:t,noun:n,scope:r,actions:i,className:a}){let o=e.count;return(0,h.jsxs)(`div`,{"data-slot":`selection-bar`,className:z(`flex min-h-10 flex-wrap items-center gap-x-3 gap-y-2`,a),children:[(0,h.jsx)(oye,{selection:e,total:t,...r===void 0?{}:{scope:r}}),(0,h.jsx)(`span`,{className:`text-small text-ink-2 tabular-nums`,children:o===0?`${String(t)} ${t===1?n[0]:n[1]}`:`${String(o)} of ${String(t)} ${t===1?n[0]:n[1]} selected`}),(0,h.jsx)(`span`,{className:`flex-1`}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[i,(0,h.jsx)(B,{size:`small`,variant:`quiet`,disabled:o===0,disabledReason:`Nothing is selected`,onClick:e.clear,children:`Clear selection`})]})]})}function PG(e,t,n){return`${String(e)} ${e===1?t:n}`}function FG(e){let t=Object.entries(e);return t.length===0?void 0:t.map(([e,t])=>`${e}: ${t}`).join(` · `)}function sye({topic:e,editing:t,keywords:n,everyRun:r,busy:i,selection:a,onEdit:o,onSave:s,onCancel:c,onApprove:l,onReject:u}){let d=e=>{e.key===`Enter`?(e.preventDefault(),!i&&t!==void 0&&t.title.trim()!==``&&s()):e.key===`Escape`&&(e.preventDefault(),c())};return(0,h.jsx)(hR,{lead:(0,h.jsx)(MG,{selection:a,value:e.id,label:e.title}),title:t===void 0?e.title:(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,h.jsx)(X,{"aria-label":`Edit ${e.title}`,className:`w-full`,maxLength:200,autoFocus:!0,value:t.title,onKeyDown:d,onChange:e=>o({...t,title:e.target.value})}),n.length===0?null:(0,h.jsx)(`div`,{className:`grid grid-cols-1 gap-2 min-[600px]:grid-cols-2`,children:n.map(e=>(0,h.jsx)(_L,{label:e,tip:`planning.schedule.held-keywords`,children:(0,h.jsx)(X,{maxLength:2e3,placeholder:r(e)||`Not set`,value:t.values[e]??``,onKeyDown:d,onChange:n=>o({...t,values:{...t.values,[e]:n.target.value}})})},e))})]}),meta:t===void 0?FG(e.values):void 0,actions:t===void 0?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(B,{size:`small`,disabled:i,onClick:l,children:`Approve`}),(0,h.jsx)(B,{variant:`quiet`,size:`small`,disabled:i,onClick:()=>o({id:e.id,title:e.title,values:e.values}),children:`Edit`}),(0,h.jsx)(B,{variant:`quiet`,size:`small`,disabled:i,onClick:u,children:`Reject`})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(B,{size:`small`,disabled:i||t.title.trim()===``,disabledReason:i?`Saving`:`Write a title first`,onClick:s,children:`Save`}),(0,h.jsx)(B,{variant:`quiet`,size:`small`,onClick:c,children:`Cancel`})]})})}var Z=l(o(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n||=self,n.JSBI=r())})(e,function(){var e=Math.imul,t=Math.clz32;function n(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function r(e){if(Array.isArray(e))return e}function i(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function a(e,t,n){return t=d(t),_(e,m()?Reflect.construct(t,n||[],d(e).constructor):t.apply(e,n))}function o(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function s(e,t,n){if(m())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return n&&v(i,n.prototype),i}function c(e,t){for(var n,r=0;r<t.length;r++)n=t[r],n.enumerable=n.enumerable||!1,n.configurable=!0,`value`in n&&(n.writable=!0),Object.defineProperty(e,x(n.key),n)}function l(e,t,n){return t&&c(e.prototype,t),n&&c(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=C(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
270
270
|
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.
|
|
271
|
-
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),IG=Z.default.BigInt(0),LG=Z.default.BigInt(1),RG=Z.default.BigInt(2),cye=Z.default.BigInt(10),lye=Z.default.BigInt(24),uye=Z.default.BigInt(60),dye=Z.default.BigInt(1e3),zG=Z.default.BigInt(1e6),BG=Z.default.BigInt(1e9),VG=Z.default.multiply(Z.default.BigInt(3600),BG),fye=Z.default.multiply(uye,BG),HG=Z.default.multiply(VG,lye);function UG(e){return typeof e==`bigint`?Z.default.BigInt(e.toString(10)):e}function WG(e){return Z.default.equal(Z.default.remainder(e,RG),IG)}function GG(e){return Z.default.lessThan(e,IG)?Z.default.unaryMinus(e):e}function KG(e,t){return Z.default.lessThan(e,t)?-1:+!!Z.default.greaterThan(e,t)}function qG(e,t){return{quotient:Z.default.divide(e,t),remainder:Z.default.remainder(e,t)}}var JG,YG,XG=`slot-epochNanoSeconds`,ZG=`slot-iso-date`,QG=`slot-iso-date-time`,$G=`slot-time`,eK=`slot-calendar`,tK=`slot-date-brand`,nK=`slot-year-month-brand`,rK=`slot-month-day-brand`,iK=`slot-time-zone`,aK=`slot-years`,oK=`slot-months`,sK=`slot-weeks`,cK=`slot-days`,lK=`slot-hours`,uK=`slot-minutes`,dK=`slot-seconds`,fK=`slot-milliseconds`,pK=`slot-microseconds`,mK=`slot-nanoseconds`,hK=`date`,gK=`ym`,_K=`md`,vK=`time`,yK=`datetime`,bK=`instant`,xK=`original`,SK=`timezone-canonical`,CK=`timezone-original`,wK=`calendar-id`,TK=`locale`,EK=`options`,DK=new WeakMap,OK=Symbol.for(`@@Temporal__GetSlots`);(JG=globalThis)[OK]||(JG[OK]=function(e){return DK.get(e)});var kK=globalThis[OK],AK=Symbol.for(`@@Temporal__CreateSlots`);(YG=globalThis)[AK]||(YG[AK]=function(e){DK.set(e,Object.create(null))});var jK=globalThis[AK];function MK(e,...t){if(!e||typeof e!=`object`)return!1;let n=kK(e);return!!n&&t.every((e=>e in n))}function Q(e,t){let n=kK(e)?.[t];if(n===void 0)throw TypeError(`Missing internal slot ${t}`);return n}function NK(e,t,n){let r=kK(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 PK={};function FK(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))}IK(t,e),IK(`${t}.prototype`,e.prototype)}function IK(e,t){let n=`%${e}%`;if(PK[n]!==void 0)throw Error(`intrinsic ${e} already exists`);PK[n]=t}function LK(e){return PK[e]}function RK(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 zK(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 BK(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 VK(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 HK=class e{constructor(e){this.totalNs=UG(e),this.sec=Z.default.toNumber(Z.default.divide(this.totalNs,BG)),this.subsec=Z.default.toNumber(Z.default.remainder(this.totalNs,BG))}static validateNew(t,n){if(Z.default.greaterThan(GG(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=Z.default.subtract(UG(t),UG(n));return new e(r)}static fromComponents(t,n,r,i,a,o){let s=Z.default.add(Z.default.add(Z.default.add(Z.default.add(Z.default.add(Z.default.BigInt(o),Z.default.multiply(Z.default.BigInt(a),dye)),Z.default.multiply(Z.default.BigInt(i),zG)),Z.default.multiply(Z.default.BigInt(r),BG)),Z.default.multiply(Z.default.BigInt(n),fye)),Z.default.multiply(Z.default.BigInt(t),VG));return e.validateNew(s,`total`)}abs(){return new e(GG(this.totalNs))}add(t){return e.validateNew(Z.default.add(this.totalNs,t.totalNs),`sum`)}add24HourDays(t){return e.validateNew(Z.default.add(this.totalNs,Z.default.multiply(Z.default.BigInt(t),HG)),`sum`)}addToEpochNs(e){return Z.default.add(UG(e),this.totalNs)}cmp(e){return KG(this.totalNs,e.totalNs)}divmod(t){let{quotient:n,remainder:r}=qG(this.totalNs,Z.default.BigInt(t));return{quotient:Z.default.toNumber(n),remainder:new e(r)}}fdiv(e){let t=UG(e),n=Z.default.BigInt(t),{quotient:r,remainder:i}=qG(this.totalNs,n),a=[],o,s=(Z.default.lessThan(this.totalNs,IG)?-1:1)*Math.sign(Z.default.toNumber(t));for(;!Z.default.equal(i,IG)&&a.length<50;)i=Z.default.multiply(i,cye),{quotient:o,remainder:i}=qG(i,n),a.push(Math.abs(Z.default.toNumber(o)));return s*Number(GG(r).toString()+`.`+a.join(``))}isZero(){return Z.default.equal(this.totalNs,IG)}round(t,n){let r=UG(t);if(Z.default.equal(r,LG))return this;let{quotient:i,remainder:a}=qG(this.totalNs,r),o=Z.default.lessThan(this.totalNs,IG)?`negative`:`positive`,s=Z.default.multiply(GG(i),r),c=Z.default.add(s,r),l=KG(GG(Z.default.multiply(a,RG)),r),u=BK(n,o),d=Z.default.equal(GG(this.totalNs),s)?s:VK(s,c,l,WG(i),u),f=o===`positive`?d:Z.default.unaryMinus(d);return e.validateNew(f,`rounding`)}sign(){return this.cmp(new e(IG))}subtract(t){return e.validateNew(Z.default.subtract(this.totalNs,t.totalNs),`difference`)}};HK.MAX=Z.default.BigInt(`9007199254740991999999999`),HK.ZERO=new HK(IG);var UK=/[A-Za-z._][A-Za-z._0-9+-]*/,WK=RegExp(`(?:(?:[+-](?:[01][0-9]|2[0-3])(?::?[0-5][0-9])?)|(?:${UK.source})(?:\\/(?:${UK.source}))*)`),GK=/(?:[+-]\d{6}|\d{4})/,KK=/(?:0[1-9]|1[0-2])/,qK=/(?:0[1-9]|[12]\d|3[01])/,pye=RegExp(`(${GK.source})(?:-(${KK.source})-(${qK.source})|(${KK.source})(${qK.source}))`),JK=/(\d{2})(?::(\d{2})(?::(\d{2})(?:[.,](\d{1,9}))?)?|(\d{2})(?:(\d{2})(?:[.,](\d{1,9}))?)?)?/,YK=/((?:[+-])(?:[01][0-9]|2[0-3])(?::?(?:[0-5][0-9])(?::?(?:[0-5][0-9])(?:[.,](?:\d{1,9}))?)?)?)/,XK=RegExp(`([zZ])|${YK.source}?`),ZK=/\[(!)?([a-z_][a-z0-9_-]*)=([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\]/g,mye=new RegExp([`^${pye.source}`,`(?:(?:[tT]|\\s+)${JK.source}(?:${XK.source})?)?`,`(?:\\[!?(${WK.source})\\])?`,`((?:${ZK.source})*)$`].join(``)),hye=new RegExp([`^[tT]?${JK.source}`,`(?:${XK.source})?`,`(?:\\[!?${WK.source}\\])?`,`((?:${ZK.source})*)$`].join(``)),gye=RegExp(`^(${GK.source})-?(${KK.source})(?:\\[!?${WK.source}\\])?((?:${ZK.source})*)$`),_ye=RegExp(`^(?:--)?(${KK.source})-?(${qK.source})(?:\\[!?${WK.source}\\])?((?:${ZK.source})*)$`),QK=/(\d+)(?:[.,](\d{1,9}))?/,vye=RegExp(`(?:${QK.source}H)?(?:${QK.source}M)?(?:${QK.source}S)?`),yye=RegExp(`^([+-])?P(?:(\\d+)Y)?(?:(\\d+)M)?(?:(\\d+)W)?(?:(\\d+)D)?(?:T(?!$)${vye.source})?$`,`i`),$K=864e5,eq=1e6*$K,bye=6e10,tq=1e8*$K,nq=WX(tq),rq=Z.default.unaryMinus(nq),xye=Z.default.add(Z.default.subtract(rq,HG),LG),Sye=Z.default.subtract(Z.default.add(nq,HG),LG),Cye=146097*$K,iq=-271821,aq=275760,oq=Date.UTC(1847,0,1),wye=[`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`],Tye=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 sq(e){return typeof e==`object`&&!!e||typeof e==`function`}function cq(e){if(typeof e==`bigint`)throw TypeError(`Cannot convert BigInt to number`);return Number(e)}function lq(e){if(typeof e==`symbol`)throw TypeError(`Cannot convert a Symbol value to a String`);return String(e)}function uq(e){let t=cq(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 dq(e,t){let n=uq(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 fq(e){let t=cq(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 pq(e,t){return String(e).padStart(t,`0`)}function mq(e){if(typeof e!=`string`)throw TypeError(`expected a string, not ${String(e)}`);return e}function hq(e,t){if(sq(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 gq=[`era`,`eraYear`,`year`,`month`,`monthCode`,`day`,`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`,`offset`,`timeZone`],Eye={era:lq,eraYear:uq,year:uq,month:dq,monthCode:function(e){let t=mq(hq(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:dq,hour:uq,minute:uq,second:uq,millisecond:uq,microsecond:uq,nanosecond:uq,offset:function(e){let t=mq(hq(e));return vY(t),t},timeZone:XJ},Dye={hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},_q=[[`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`]],vq=Object.fromEntries(_q.map((e=>[e[0],e[1]]))),Oye=Object.fromEntries(_q.map((([e,t])=>[t,e]))),yq=_q.map((([,e])=>e)),bq={day:eq,hour:36e11,minute:6e10,second:1e9,millisecond:1e6,microsecond:1e3,nanosecond:1},xq=[`days`,`hours`,`microseconds`,`milliseconds`,`minutes`,`months`,`nanoseconds`,`seconds`,`weeks`,`years`],kye=Intl.DateTimeFormat,Sq=new Map;function Cq(e){let t=$X(e),n=Sq.get(t);return n===void 0&&(n=new kye(`en-us`,{timeZone:t,hour12:!1,era:`short`,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`}),Sq.set(t,n)),n}function wq(e){return MK(e,XG)&&!MK(e,iK,eK)}function Tq(e){return MK(e,aK,oK,cK,lK,uK,dK,fK,pK,mK)}function Eq(e){return MK(e,tK)}function Dq(e){return MK(e,$G)}function Oq(e){return MK(e,QG)}function kq(e){return MK(e,nK)}function Aq(e){return MK(e,rK)}function jq(e){return MK(e,XG,iK,eK)}function $(e,t){if(!t(e))throw TypeError(`invalid receiver: method called with the wrong type of this-object`)}function Mq(e){if(MK(e,eK)||MK(e,iK))throw TypeError(`with() does not support a calendar or timeZone property`);if(Dq(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 Nq(e,t){return t===`never`||t===`auto`&&e===`iso8601`?``:`[${t===`critical`?`!`:``}u-ca=${e}]`}function Pq(e){let t,n,r=!1;for(ZK.lastIndex=0;n=ZK.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 Fq(e){let t=mye.exec(e);if(!t)throw RangeError(`invalid RFC 9557 string: ${e}`);let n=Pq(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 JY(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 Iq(e){let t=hye.exec(e),n,r,i,a,o,s,c;if(t){c=Pq(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}=Fq(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(qY(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}=Rq(e);GY(1972,t,n)}catch{try{let{year:t,month:n}=Lq(e);GY(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 Lq(e){let t=gye.exec(e),n,r,i,a;if(t){i=Pq(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}=Fq(e),t)throw RangeError(`Z designator not supported for PlainYearMonth`)}return{year:n,month:r,calendar:i,referenceISODay:a}}function Rq(e){let t=_ye.exec(e),n,r,i,a;if(t){if(i=Pq(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}=Fq(e),t)throw RangeError(`Z designator not supported for PlainMonthDay`)}return{month:n,day:r,calendar:i,referenceISOYear:a}}var zq=RegExp(`^${WK.source}$`,`i`),Bq=RegExp(`^([+-])([01][0-9]|2[0-3])(?::?([0-5][0-9])?)?$`);function Vq(e){let t=jye.test(e)?`Seconds not allowed in offset time zone`:`Invalid time zone`;throw RangeError(`${t}: ${e}`)}function Hq(e){return zq.test(e)||Vq(e),Bq.test(e)?{offsetMinutes:vY(e)/6e10}:{tzName:e}}function Uq(e,t,n,r){let i=e,a=t,o=n;switch(r){case`reject`:GY(i,a,o);break;case`constrain`:({year:i,month:a,day:o}=UY(i,a,o))}return{year:i,month:a,day:o}}function Wq(e,t,n,r,i,a,o){let s=e,c=t,l=n,u=r,d=i,f=a;switch(o){case`reject`:qY(s,c,l,u,d,f);break;case`constrain`:s=HY(s,0,23),c=HY(c,0,59),l=HY(l,0,59),u=HY(u,0,999),d=HY(d,0,999),f=HY(f,0,999)}return{hour:s,minute:c,second:l,millisecond:u,microsecond:d,nanosecond:f}}function Gq(e){if(!sq(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<xq.length;r++){let i=xq[r],a=e[i];a!==void 0&&(n=!0,t[i]=fq(a))}if(!n)throw TypeError(`invalid duration-like`);return t}function Kq({years:e,months:t,weeks:n,days:r},i,a,o){return{years:e,months:o??t,weeks:a??n,days:i??r}}function qq(e,t){return{isoDate:e,time:t}}function Jq(e){return ZX(e,`overflow`,[`constrain`,`reject`],`constrain`)}function Yq(e){return ZX(e,`disambiguation`,[`compatible`,`earlier`,`later`,`reject`],`compatible`)}function Xq(e,t){return ZX(e,`roundingMode`,[`ceil`,`floor`,`expand`,`trunc`,`halfCeil`,`halfFloor`,`halfExpand`,`halfTrunc`,`halfEven`],t)}function Zq(e,t){return ZX(e,`offset`,[`prefer`,`use`,`ignore`,`reject`],t)}function Qq(e){return ZX(e,`calendarName`,[`auto`,`always`,`never`,`critical`],`auto`)}function $q(e){let t=e.roundingIncrement;if(t===void 0)return 1;let n=uq(t);if(n<1||n>1e9)throw RangeError(`roundingIncrement must be at least 1 and at most 1e9, not ${t}`);return n}function eJ(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 tJ(e){let t=e.fractionalSecondDigits;if(t===void 0)return`auto`;if(typeof t!=`number`){if(lq(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 nJ(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 rJ=Symbol(`~required~`);function iJ(e,t,n,r,i=[]){let a=[];for(let e=0;e<_q.length;e++){let t=_q[e],r=t[1],i=t[2];n!==`datetime`&&n!==i||a.push(r)}a=a.concat(i);let o=r;o===rJ?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=Oye[a[e]];t!==void 0&&s.push(t)}let c=ZX(e,t,s,o);if(c===void 0&&r===rJ)throw RangeError(`${t} is required`);return c&&c in vq?vq[c]:c}function aJ(e){let t=e.relativeTo;if(t===void 0)return{};let n,r,i,a,o,s=`option`,c=!1;if(sq(t)){if(jq(t))return{zonedRelativeTo:t};if(Eq(t))return{plainRelativeTo:t};if(Oq(t))return{plainRelativeTo:DJ(Q(t,QG).isoDate,Q(t,eK))};i=GJ(t);let e=pJ(i,t,[`year`,`month`,`monthCode`,`day`],[`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`,`offset`,`timeZone`],[]);({isoDate:n,time:r}=gJ(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}=Fq(mq(t)),e)a=XJ(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=QX(i),n={year:u,month:d,day:f}}return a===void 0?{plainRelativeTo:DJ(n,i)}:{zonedRelativeTo:zJ(wJ(n,r,s,s===`option`?vY(o):0,a,`compatible`,`reject`,c),a,i)}}function oJ(e){return Q(e,aK)===0?Q(e,oK)===0?Q(e,sK)===0?Q(e,cK)===0?Q(e,lK)===0?Q(e,uK)===0?Q(e,dK)===0?Q(e,fK)===0?Q(e,pK)===0?`nanosecond`:`microsecond`:`millisecond`:`second`:`minute`:`hour`:`day`:`week`:`month`:`year`}function sJ(e,t){return yq.indexOf(e)>yq.indexOf(t)?t:e}function cJ(e){return e===`year`||e===`month`||e===`week`}function lJ(e){return cJ(e)||e===`day`?`date`:`time`}function uJ(e){return LK(`%calendarImpl%`)(e)}function dJ(e){return LK(`%calendarImpl%`)(Q(e,eK))}function fJ(e,t,n=`date`){let r=Object.create(null),i=uJ(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 pJ(e,t,n,r,i){let a=uJ(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,Eye[n])(r);else if(i!==`partial`){if(i.includes(n))throw TypeError(`required property '${n}' missing or undefined`);s[n]=Dye[n]}}if(i===`partial`&&!c)throw TypeError(`no supported properties found`);return s}function mJ(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]=uq(s),r=!0)}if(!r)throw TypeError(`invalid time-like`);return i}function hJ(e,t){if(sq(e)){if(Eq(e))return Jq(YX(t)),DJ(Q(e,ZG),Q(e,eK));if(jq(e)){let n=eY(Q(e,iK),Q(e,XG));return Jq(YX(t)),DJ(n.isoDate,Q(e,eK))}if(Oq(e))return Jq(YX(t)),DJ(Q(e,QG).isoDate,Q(e,eK));let n=GJ(e);return DJ(qJ(n,pJ(n,e,[`year`,`month`,`monthCode`,`day`],[],[]),Jq(YX(t))),n)}let{year:n,month:r,day:i,calendar:a,z:o}=Fq(mq(e));if(o)throw RangeError(`Z designator not supported for PlainDate`);return a||=`iso8601`,a=QX(a),Jq(YX(t)),DJ({year:n,month:r,day:i},a)}function gJ(e,t,n){return qq(qJ(e,t,n),Wq(t.hour,t.minute,t.second,t.millisecond,t.microsecond,t.nanosecond,n))}function _J(e,t){let n,r,i;if(sq(e)){if(Oq(e))return Jq(YX(t)),kJ(Q(e,QG),Q(e,eK));if(jq(e)){let n=eY(Q(e,iK),Q(e,XG));return Jq(YX(t)),kJ(n,Q(e,eK))}if(Eq(e))return Jq(YX(t)),kJ(qq(Q(e,ZG),{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),Q(e,eK));i=GJ(e);let a=pJ(i,e,[`year`,`month`,`monthCode`,`day`],[`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`],[]),o=Jq(YX(t));({isoDate:n,time:r}=gJ(i,a,o))}else{let a,o,s,c;if({year:o,month:s,day:c,time:r,calendar:i,z:a}=Fq(mq(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}),JY(o,s,c,r.hour,r.minute,r.second,r.millisecond,r.microsecond,r.nanosecond),i||=`iso8601`,i=QX(i),Jq(YX(t)),n={year:o,month:s,day:c}}return kJ(qq(n,r),i)}function vJ(e){let t=LK(`%Temporal.Duration%`);if(Tq(e))return new t(Q(e,aK),Q(e,oK),Q(e,sK),Q(e,cK),Q(e,lK),Q(e,uK),Q(e,dK),Q(e,fK),Q(e,pK),Q(e,mK));if(!sq(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=yye.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:uq(t[2])*n,i=t[3]===void 0?0:uq(t[3])*n,a=t[4]===void 0?0:uq(t[4])*n,o=t[5]===void 0?0:uq(t[5])*n,s=t[6]===void 0?0:uq(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*uq((c+`000000000`).slice(0,9))*n}else if(p=l===void 0?0:uq(l)*n,u!==void 0){if(d??f)throw RangeError(`only the smallest unit can be fractional`);h=60*uq((u+`000000000`).slice(0,9))*n}else m=d===void 0?0:uq(d)*n,f!==void 0&&(h=uq((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),$Y(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(LK(`%Temporal.Duration%`))(t,n,r,i,a,o,s,c,l,u)}(mq(e));let n={years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0,milliseconds:0,microseconds:0,nanoseconds:0},r=Gq(e);for(let e=0;e<xq.length;e++){let t=xq[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 yJ(e){let t;if(sq(e)){if(wq(e)||jq(e))return LJ(Q(e,XG));t=hq(e)}else t=e;let{year:n,month:r,day:i,time:a,offset:o,z:s}=function(e){let t=Fq(e);if(!t.z&&!t.offset)throw RangeError(`Temporal.Instant requires a time zone offset`);return t}(mq(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=RY(n,r,i,c,l,u,d,f,p-(s?0:vY(o)));return oX(m.isoDate),LJ(EY(m))}function bJ(e,t){if(sq(e)){if(Aq(e))return Jq(YX(t)),jJ(Q(e,ZG),Q(e,eK));let n;return MK(e,eK)?n=Q(e,eK):(n=e.calendar,n===void 0&&(n=`iso8601`),n=WJ(n)),jJ(YJ(n,pJ(n,e,[`year`,`month`,`monthCode`,`day`],[],[]),Jq(YX(t))),n)}let{month:n,day:r,referenceISOYear:i,calendar:a}=Rq(mq(e));if(a===void 0&&(a=`iso8601`),a=QX(a),Jq(YX(t)),a===`iso8601`)return jJ({year:1972,month:n,day:r},a);let o={year:i,month:n,day:r};return KY(o),o=YJ(a,fJ(a,o,`month-day`),`constrain`),jJ(o,a)}function xJ(e,t){let n;if(sq(e)){if(Dq(e))return Jq(YX(t)),NJ(Q(e,$G));if(Oq(e))return Jq(YX(t)),NJ(Q(e,QG).time);if(jq(e)){let n=eY(Q(e,iK),Q(e,XG));return Jq(YX(t)),NJ(n.time)}let{hour:r,minute:i,second:a,millisecond:o,microsecond:s,nanosecond:c}=mJ(e);n=Wq(r,i,a,o,s,c,Jq(YX(t)))}else n=Iq(mq(e)),Jq(YX(t));return NJ(n)}function SJ(e){return e===void 0?{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}:Q(xJ(e),$G)}function CJ(e,t){if(sq(e)){if(kq(e))return Jq(YX(t)),FJ(Q(e,ZG),Q(e,eK));let n=GJ(e);return FJ(JJ(n,pJ(n,e,[`year`,`month`,`monthCode`],[],[]),Jq(YX(t))),n)}let{year:n,month:r,referenceISODay:i,calendar:a}=Lq(mq(e));a===void 0&&(a=`iso8601`),a=QX(a),Jq(YX(t));let o={year:n,month:r,day:i};return QY(o),o=JJ(a,fJ(a,o,`year-month`),`constrain`),FJ(o,a)}function wJ(e,t,n,r,i,a,o,s){if(t===`start-of-day`)return iY(i,e);let c=qq(e,t);if(n===`wall`||o===`ignore`)return tY(i,c,a);if(n===`exact`||o===`use`){let n=RY(e.year,e.month,e.day,t.hour,t.minute,t.second,t.millisecond,t.microsecond,t.nanosecond-r);oX(n.isoDate);let i=EY(n);return ZY(i),i}oX(e);let l=EY(c),u=rY(i,c);for(let e=0;e<u.length;e++){let t=u[e],n=Z.default.toNumber(Z.default.subtract(l,t)),i=NX(n,6e10,`halfExpand`);if(n===r||s&&i===r)return t}if(o===`reject`){let e=$J(r),t=pY(c,`iso8601`,`auto`);throw RangeError(`Offset ${e} is invalid for ${t} in ${i}`)}return nY(u,i,c,a)}function TJ(e,t){let n,r,i,a,o,s,c,l=!1,u=`option`;if(sq(e)){if(jq(e)){let n=YX(t);return Yq(n),Zq(n,`reject`),Jq(n),zJ(Q(e,XG),Q(e,iK),Q(e,eK))}o=GJ(e);let l=pJ(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=YX(t);s=Yq(d),c=Zq(d,`reject`);let f=Jq(d);({isoDate:n,time:r}=gJ(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=Fq(e);if(!t.tzAnnotation)throw RangeError(`Temporal.ZonedDateTime requires a time zone ID in brackets`);return t}(mq(e))),i=XJ(d),f?u=`exact`:a||(u=`wall`),o||=`iso8601`,o=QX(o),l=!0;let g=YX(t);s=Yq(g),c=Zq(g,`reject`),Jq(g),n={year:p,month:m,day:h}}let d=0;return u===`option`&&(d=vY(a)),zJ(wJ(n,r,u,d,i,s,c,l),i,o)}function EJ(e,t,n){KY(t),jK(e),NK(e,ZG,t),NK(e,eK,n),NK(e,tK,!0)}function DJ(e,t){let n=LK(`%Temporal.PlainDate%`),r=Object.create(n.prototype);return EJ(r,e,t),r}function OJ(e,t,n){YY(t),jK(e),NK(e,QG,t),NK(e,eK,n)}function kJ(e,t){let n=LK(`%Temporal.PlainDateTime%`),r=Object.create(n.prototype);return OJ(r,e,t),r}function AJ(e,t,n){KY(t),jK(e),NK(e,ZG,t),NK(e,eK,n),NK(e,rK,!0)}function jJ(e,t){let n=LK(`%Temporal.PlainMonthDay%`),r=Object.create(n.prototype);return AJ(r,e,t),r}function MJ(e,t){jK(e),NK(e,$G,t)}function NJ(e){let t=LK(`%Temporal.PlainTime%`),n=Object.create(t.prototype);return MJ(n,e),n}function PJ(e,t,n){QY(t),jK(e),NK(e,ZG,t),NK(e,eK,n),NK(e,nK,!0)}function FJ(e,t){let n=LK(`%Temporal.PlainYearMonth%`),r=Object.create(n.prototype);return PJ(r,e,t),r}function IJ(e,t){ZY(t),jK(e),NK(e,XG,t)}function LJ(e){let t=LK(`%Temporal.Instant%`),n=Object.create(t.prototype);return IJ(n,e),n}function RJ(e,t,n,r){ZY(t),jK(e),NK(e,XG,t),NK(e,iK,n),NK(e,eK,r)}function zJ(e,t,n=`iso8601`){let r=LK(`%Temporal.ZonedDateTime%`),i=Object.create(r.prototype);return RJ(i,e,t,n),i}function BJ(e){return gq.filter((t=>e[t]!==void 0))}function VJ(e,t,n){let r=BJ(n),i=uJ(e).fieldKeysToIgnore(r),a=Object.create(null),o=BJ(t);for(let e=0;e<gq.length;e++){let s,c=gq[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 HJ(e,t,n,r){let i=uJ(e).dateAdd(t,n,r);return KY(i),i}function UJ(e,t,n,r){return uJ(e).dateUntil(t,n,r)}function WJ(e){if(sq(e)&&MK(e,eK))return Q(e,eK);let t=mq(e);try{return QX(t)}catch{}let n;try{({calendar:n}=Fq(t))}catch{try{({calendar:n}=Iq(t))}catch{try{({calendar:n}=Lq(t))}catch{({calendar:n}=Rq(t))}}}return n||=`iso8601`,QX(n)}function GJ(e){if(MK(e,eK))return Q(e,eK);let{calendar:t}=e;return t===void 0?`iso8601`:WJ(t)}function KJ(e,t){return QX(e)===QX(t)}function qJ(e,t,n){let r=uJ(e);r.resolveFields(t,`date`);let i=r.dateToISO(t,n);return KY(i),i}function JJ(e,t,n){let r=uJ(e);r.resolveFields(t,`year-month`),t.day=1;let i=r.dateToISO(t,n);return QY(i),i}function YJ(e,t,n){let r=uJ(e);r.resolveFields(t,`month-day`);let i=r.monthDayToISOReferenceDate(t,n);return KY(i),i}function XJ(e){if(sq(e)&&jq(e))return Q(e,iK);let t=mq(e);if(t===`UTC`)return`UTC`;let{tzName:n,offsetMinutes:r}=function(e){let{tzAnnotation:t,offset:n,z:r}=function(e){if(zq.test(e))return{tzAnnotation:e,offset:void 0,z:!1};try{let{tzAnnotation:t,offset:n,z:r}=Fq(e);if(r||t||n)return{tzAnnotation:t,offset:n,z:r}}catch{}Vq(e)}(e);return t?Hq(t):r?Hq(`UTC`):n?Hq(n):void 0}(t);if(r!==void 0)return CY(r);let i=bY(n);if(!i)throw RangeError(`Unrecognized time zone ${n}`);return i.identifier}function ZJ(e,t){if(e===t)return!0;let n=Hq(e).offsetMinutes,r=Hq(t).offsetMinutes;if(n===void 0&&r===void 0){let n=bY(t);if(!n)return!1;let r=bY(e);return!!r&&r.primaryIdentifier===n.primaryIdentifier}return n===r}function QJ(e,t){let n=Hq(e).offsetMinutes;return n===void 0?SY(e,t):6e10*n}function $J(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}${cY(r,i,a,o,a===0&&o===0?`minute`:`auto`)}`}function eY(e,t){let n=QJ(e,t),{isoDate:{year:r,month:i,day:a},time:{hour:o,minute:s,second:c,millisecond:l,microsecond:u,nanosecond:d}}=DY(t);return RY(r,i,a,o,s,c,l,u,d+n)}function tY(e,t,n){return nY(rY(e,t),e,t,n)}function nY(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=EY(n),o=Z.default.subtract(a,HG);ZY(o);let s=QJ(t,o),c=Z.default.add(a,HG);ZY(c);let l=QJ(t,c)-s;switch(r){case`earlier`:{let e=HK.fromComponents(0,0,0,0,0,-l),r=CX(n.time,e);return rY(t,qq(LY(n.isoDate.year,n.isoDate.month,n.isoDate.day+r.deltaDays),r))[0]}case`compatible`:case`later`:{let e=HK.fromComponents(0,0,0,0,0,l),r=CX(n.time,e),i=rY(t,qq(LY(n.isoDate.year,n.isoDate.month,n.isoDate.day+r.deltaDays),r));return i[i.length-1]}}}function rY(e,t){if(e===`UTC`)return oX(t.isoDate),[EY(t)];let n=Hq(e).offsetMinutes;if(n!==void 0){let e=RY(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);oX(e.isoDate);let r=EY(e);return ZY(r),[r]}return oX(t.isoDate),function(e,t){let n=EY(t),r=Z.default.subtract(n,HG);Z.default.lessThan(r,rq)&&(r=n);let i=Z.default.add(n,HG);Z.default.greaterThan(i,nq)&&(i=n);let a=SY(e,r),o=SY(e,i);return(a===o?[a]:[a,o]).map((r=>{let i=Z.default.subtract(n,Z.default.BigInt(r));if(VX(t,function(e,t){let{epochMilliseconds:n,time:{millisecond:r,microsecond:i,nanosecond:a}}=DY(t),{year:o,month:s,day:c,hour:l,minute:u,second:d}=AY(e,n);return RY(o,s,c,l,u,d,r,i,a)}(e,i))===0)return ZY(i),i})).filter((e=>e!==void 0))}(e,t)}function iY(e,t){let n=qq(t,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),r=rY(e,n);if(r.length)return r[0];let i=EY(n),a=Z.default.subtract(i,HG);return ZY(a),OY(e,a)}function aY(e){let t;return t=e<0||e>9999?(e<0?`-`:`+`)+pq(Math.abs(e),6):pq(e,4),t}function oY(e){return pq(e,2)}function sY(e,t){let n;if(t===`auto`){if(e===0)return``;n=pq(e,9).replace(/0+$/,``)}else{if(t===0)return``;n=pq(e,9).slice(0,t)}return`.${n}`}function cY(e,t,n,r,i){let a=`${oY(e)}:${oY(t)}`;return i===`minute`||(a+=`:${oY(n)}`,a+=sY(r,i)),a}function lY(e,t,n){let r=t;r===void 0&&(r=`UTC`);let i=Q(e,XG),a=pY(eY(r,i),`iso8601`,n,`never`),o=`Z`;return t!==void 0&&(o=wY(QJ(r,i))),`${a}${o}`}function uY(e,t){let n=Q(e,aK),r=Q(e,oK),i=Q(e,sK),a=Q(e,cK),o=Q(e,lK),s=Q(e,uK),c=NY(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=HK.fromComponents(0,0,Q(e,dK),Q(e,fK),Q(e,pK),Q(e,mK));d.isZero()&&![`second`,`millisecond`,`microsecond`,`nanosecond`].includes(oJ(e))&&t===`auto`||(u+=`${Math.abs(d.sec)}${sY(Math.abs(d.subsec),t)}S`);let f=`${c<0?`-`:``}P${l}`;return u&&(f=`${f}T${u}`),f}function dY(e,t=`auto`){let{year:n,month:r,day:i}=Q(e,ZG);return`${aY(n)}-${oY(r)}-${oY(i)}${Nq(Q(e,eK),t)}`}function fY({hour:e,minute:t,second:n,millisecond:r,microsecond:i,nanosecond:a},o){return cY(e,t,n,1e6*r+1e3*i+a,o)}function pY(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`${aY(i)}-${oY(a)}-${oY(o)}T${cY(s,c,l,1e6*u+1e3*d+f,n)}${Nq(t,r)}`}function mY(e,t=`auto`){let{year:n,month:r,day:i}=Q(e,ZG),a=`${oY(r)}-${oY(i)}`,o=Q(e,eK);t!==`always`&&t!==`critical`&&o===`iso8601`||(a=`${aY(n)}-${a}`);let s=Nq(o,t);return s&&(a+=s),a}function hY(e,t=`auto`){let{year:n,month:r,day:i}=Q(e,ZG),a=`${aY(n)}-${oY(r)}`,o=Q(e,eK);t!==`always`&&t!==`critical`&&o===`iso8601`||(a+=`-${oY(i)}`);let s=Nq(o,t);return s&&(a+=s),a}function gY(e,t,n=`auto`,r=`auto`,i=`auto`,a=void 0){let o=Q(e,XG);if(a){let{unit:e,increment:t,roundingMode:n}=a;o=PX(o,t,e,n)}let s=Q(e,iK),c=QJ(s,o),l=pY(eY(s,o),`iso8601`,t,`never`);return i!==`never`&&(l+=wY(c)),r!==`never`&&(l+=`[${r===`critical`?`!`:``}${s}]`),l+=Nq(Q(e,eK),n),l}function _Y(e){return Bq.test(e)}function vY(e){let t=Mye.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 yY,Aye=Object.assign(Object.create(null),{"/":!0,"-":!0,_:!0});function bY(e){if(yY===void 0){let e=Intl.supportedValuesOf?.(`timeZone`);if(e){yY=new Map;for(let t=0;t<e.length;t++){let n=e[t];yY.set($X(n),n)}}else yY=null}let t=$X(e),n=yY?.get(t);if(n)return{identifier:n,primaryIdentifier:n};try{n=Cq(e).resolvedOptions().timeZone}catch{return}if(t===`antarctica/south_pole`&&(n=`Antarctica/McMurdo`),Tye.has(e))throw RangeError(`${e} is a legacy time zone identifier from ICU. Use ${n} instead`);let r=[...t].map(((e,n)=>n===0||Aye[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 xY(e,t){let{year:n,month:r,day:i,hour:a,minute:o,second:s}=AY(e,t),c=t%1e3;return c<0&&(c+=1e3),1e6*(TY({isoDate:{year:n,month:r,day:i},time:{hour:a,minute:o,second:s,millisecond:c}})-t)}function SY(e,t){return xY(e,UX(t,`floor`))}function CY(e){let t=e<0?`-`:`+`,n=Math.abs(e);return`${t}${cY(Math.floor(n/60),n%60,0,0,`minute`)}`}function wY(e){return CY(NX(e,bye,`halfExpand`)/6e10)}function TY({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()+Cye*c}function EY(e){let t=TY(e),n=1e3*e.time.microsecond+e.time.nanosecond;return Z.default.add(WX(t),Z.default.BigInt(n))}function DY(e){let t=UX(e,`trunc`),n=Z.default.toNumber(Z.default.remainder(e,zG));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 OY(e,t){if(e===`UTC`)return null;let n=UX(t,`floor`);if(n<oq)return OY(e,WX(oq));let r=Math.max(n,Date.now())+366*$K*3,i=n,a=xY(e,i),o=i,s=a;for(;a===s&&i<r;){if(o=i+2*$K*7,o>tq)return null;s=xY(e,o),a===s&&(i=o)}return a===s?null:WX(tZ((t=>xY(e,t)),i,o,a,s))}function kY(e,t){if(e===`UTC`)return null;let n=UX(t,`ceil`),r=Date.now(),i=r+366*$K*3;if(n>i){let t=kY(e,WX(i));if(t===null||Z.default.lessThan(t,WX(r)))return t}if(e===`Africa/Casablanca`||e===`Africa/El_Aaiun`){let t=Date.UTC(2088,0,1);if(t<n)return kY(e,WX(t))}let a=n-1;if(a<oq)return null;let o=xY(e,a),s=a,c=o;for(;o===c&&a>oq;){if(s=a-2*$K*7,s<oq)return null;c=xY(e,s),o===c&&(a=s)}return o===c?null:WX(tZ((t=>xY(e,t)),s,a,c,o))}function AY(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}}(Cq(e).format(t))}function jY(e){return e!==void 0&&!(e%4!=0||e%100==0&&e%400!=0)}function MY(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]}[jY(e)?`leapyear`:`standard`][t-1]}function NY(e){let t=[Q(e,aK),Q(e,oK),Q(e,sK),Q(e,cK),Q(e,lK),Q(e,uK),Q(e,dK),Q(e,fK),Q(e,pK),Q(e,mK)];for(let e=0;e<t.length;e++){let n=t[e];if(n!==0)return n<0?-1:1}return 0}function PY(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 FY(e){let t=PY(e.date);return t===0?e.time.sign():t}function IY(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 LY(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}=IY(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=jY(c)?366:365,a<-s;)--r,--c,a+=s;for(c+=1;s=jY(c)?366:365,a>s;)r+=1,c+=1,a-=s;for(;a<1;)({year:r,month:i}=IY(r,i-1)),a+=MY(r,i);for(;a>MY(r,i);)a-=MY(r,i),{year:r,month:i}=IY(r,i+1);return{year:r,month:i,day:a}}function RY(e,t,n,r,i,a,o,s,c){let l=zY(r,i,a,o,s,c);return qq(LY(e,t,n+l.deltaDays),l)}function zY(e,t,n,r,i,a){let o,s=e,c=t,l=n,u=r,d=i,f=a;({div:o,mod:f}=RK(f,3)),d+=o,f<0&&(--d,f+=1e3),{div:o,mod:d}=RK(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 BY(e,t){let n=Kq(e,0);if(PY(n)===0)return e.days;let r=Q(t,ZG),i=HJ(Q(t,eK),r,n,`constrain`),a=aX(r.year,r.month-1,r.day),o=aX(i.year,i.month-1,i.day)-a;return e.days+o}function VY(e){return new(LK(`%Temporal.Duration%`))(-Q(e,aK),-Q(e,oK),-Q(e,sK),-Q(e,cK),-Q(e,lK),-Q(e,uK),-Q(e,dK),-Q(e,fK),-Q(e,pK),-Q(e,mK))}function HY(e,t,n){return Math.min(n,Math.max(t,e))}function UY(e,t,n){let r=HY(t,1,12);return{year:e,month:r,day:HY(n,1,MY(e,r))}}function WY(e,t,n){if(e<t||e>n)throw RangeError(`value out of range: ${t} <= ${e} <= ${n}`)}function GY(e,t,n){WY(t,1,12),WY(n,1,MY(e,t))}function KY(e){YY(qq(e,{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}))}function qY(e,t,n,r,i,a){WY(e,0,23),WY(t,0,59),WY(n,0,59),WY(r,0,999),WY(i,0,999),WY(a,0,999)}function JY(e,t,n,r,i,a,o,s,c){GY(e,t,n),qY(r,i,a,o,s,c)}function YY(e){let t=EY(e);(Z.default.lessThan(t,xye)||Z.default.greaterThan(t,Sye))&&ZY(t)}function XY(e){EY(e)}function ZY(e){if(Z.default.lessThan(e,rq)||Z.default.greaterThan(e,nq))throw RangeError(`date/time value is outside of supported range`)}function QY({year:e,month:t}){WY(e,iq,aq),e===iq?WY(t,4,12):e===aq&&WY(t,1,9)}function $Y(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=RK(s,3),p=RK(c,6),m=RK(l,9),h=RK(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 eX(e){return{date:{years:Q(e,aK),months:Q(e,oK),weeks:Q(e,sK),days:Q(e,cK)},time:HK.fromComponents(Q(e,lK),Q(e,uK),Q(e,dK),Q(e,fK),Q(e,pK),Q(e,mK))}}function tX(e){let t=HK.fromComponents(Q(e,lK),Q(e,uK),Q(e,dK),Q(e,fK),Q(e,pK),Q(e,mK)).add24HourDays(Q(e,cK));return{date:{years:Q(e,aK),months:Q(e,oK),weeks:Q(e,sK),days:0},time:t}}function nX(e){let t=tX(e),n=Math.trunc(t.time.sec/86400);return $Y(t.date.years,t.date.months,t.date.weeks,n,0,0,0,0,0,0),{...t.date,days:n}}function rX(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=zK(o,3,Math.trunc(i/1e3)),i%=1e3,o=0;break;case`microsecond`:i=zK(o,6,Math.trunc(r/1e3)),r%=1e3,o=0;break;case`nanosecond`:r=zK(o,9,r),o=0}return new(LK(`%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 iX(e,t){return PY(e),t.sign(),{date:e,time:t}}function aX(e,t,n){return TY({isoDate:{year:e,month:t+1,day:n},time:{hour:0,minute:0,second:0,millisecond:0}})/$K}function oX({year:e,month:t,day:n}){if(Math.abs(aX(e,t-1,n))>1e8)throw RangeError(`date/time value is outside the supported range`)}function sX(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 HK.fromComponents(n,r,i,a,o,s)}function cX(e,t,n,r,i){let a=HK.fromEpochNsDiff(t,e);return a=LX(a,n,r,i),iX({years:0,months:0,weeks:0,days:0},a)}function lX(e,t,n,r){XY(e),XY(t);let i=sX(e.time,t.time),a=i.sign(),o=zX(e.isoDate,t.isoDate),s=t.isoDate;o===a&&(s=LY(s.year,s.month,s.day+a),i=i.add24HourDays(-a));let c=sJ(`day`,r),l=UJ(n,e.isoDate,s,c);return r!==c&&(i=i.add24HourDays(l.days),l.days=0),iX(l,i)}function uX(e,t,n,r,i){let a=Z.default.subtract(t,e);if(Z.default.equal(a,IG))return{date:{years:0,months:0,weeks:0,days:0},time:HK.ZERO};let o=Z.default.lessThan(a,IG)?-1:1,s=eY(n,e),c=eY(n,t),l,u=0,d=o===1?2:1,f=sX(s.time,c.time);for(f.sign()===-o&&u++;u<=d;u++){l=qq(LY(c.isoDate.year,c.isoDate.month,c.isoDate.day-u*o),s.time);let e=tY(n,l,`compatible`);if(f=HK.fromEpochNsDiff(t,e),f.sign()!==-o)break}let p=sJ(`day`,i);return iX(UJ(r,s.isoDate,l.isoDate,p),f)}function dX(e,t,n,r,i,a,o,s,c){let l,u,d,f,p=t;switch(s){case`year`:{let t=NX(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=NX(p.date.months,o,`trunc`);l=t,u=t+o*e,d=Kq(p.date,0,0,l),f=Kq(p.date,0,0,u);break}case`week`:{let t=Kq(p.date,0,0),n=HJ(a,r.isoDate,t,`constrain`),i=UJ(a,n,LY(n.year,n.month,n.day+p.date.days),`week`),s=NX(p.date.weeks+i.weeks,o,`trunc`);l=s,u=s+o*e,d=Kq(p.date,0,l),f=Kq(p.date,0,u);break}case`day`:{let t=NX(p.date.days,o,`trunc`);l=t,u=t+o*e,d=Kq(p.date,l),f=Kq(p.date,u);break}}let m=HJ(a,r.isoDate,d,`constrain`),h=HJ(a,r.isoDate,f,`constrain`),g,_,v=qq(m,r.time),y=qq(h,r.time);i?(g=tY(i,v,`compatible`),_=tY(i,y,`compatible`)):(g=EY(v),_=EY(y));let b=HK.fromEpochNsDiff(n,g),x=HK.fromEpochNsDiff(_,g),S=BK(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)?VK(Math.abs(l),Math.abs(u),C,w,S):Math.abs(u),E=new HK(Z.default.add(Z.default.multiply(x.totalNs,Z.default.BigInt(l)),Z.default.multiply(b.totalNs,Z.default.BigInt(o*e)))).fdiv(x.totalNs),D=T===Math.abs(u);return p={date:D?f:d,time:HK.ZERO},{nudgeResult:{duration:p,nudgedEpochNs:D?_:g,didExpandCalendarUnit:D},total:E}}function fX(e,t,n,r,i,a,o,s,c){let l=e,u=cJ(s)||r&&s===`day`,d=FY(l)<0?-1:1,f;return u?{nudgeResult:f}=dX(d,l,t,n,r,i,o,s,c):f=r?function(e,t,n,r,i,a,o,s){let c=t,l=HJ(i,n.isoDate,c.date,`constrain`),u=qq(l,n.time),d=qq(LY(l.year,l.month,l.day+e),n.time),f=tY(r,u,`compatible`),p=tY(r,d,`compatible`),m=HK.fromEpochNsDiff(p,f);if(m.sign()!==e)throw RangeError(`time zone returned inconsistent Instants`);let h=Z.default.BigInt(bq[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:iX(Kq(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(Z.default.BigInt(r*bq[i]),a),l=c.subtract(s),{quotient:u}=s.divmod(eq),{quotient:d}=c.divmod(eq),f=Math.sign(d-u)===s.sign(),p=l.addToEpochNs(t),m=0,h=c;return lJ(n)===`date`&&(m=d,h=c.add(HK.fromComponents(24*-d,0,0,0,0,0))),{duration:{date:Kq(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=yq.indexOf(o);for(let t=yq.indexOf(s)-1;t>=l;t--){let s=yq[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=Kq(c.date,0,0,t);break}case`week`:{let t=c.date.weeks+e;l=Kq(c.date,0,t);break}}let u=qq(HJ(a,r.isoDate,l,`constrain`),r.time),d;if(d=i?tY(i,u,`compatible`):EY(u),KG(n,d)===-e)break;c={date:l,time:HK.ZERO}}return c}(d,l,f.nudgedEpochNs,n,r,i,a,sJ(s,`day`))),l}function pX(e,t,n,r,i,a){return cJ(a)||r&&a===`day`?dX(FY(e)<0?-1:1,e,t,n,r,i,1,a,`trunc`).total:RX(e.time.add24HourDays(e.date.days),a)}function mX(e,t,n,r,i,a,o){if(VX(e,t)==0)return{date:{years:0,months:0,weeks:0,days:0},time:HK.ZERO};YY(e),YY(t);let s=lX(e,t,n,r);return a===`nanosecond`&&i===1?s:fX(s,EY(t),e,null,n,r,i,a,o)}function hX(e,t,n,r,i,a,o,s){if(lJ(i)===`time`)return cX(e,t,a,o,s);let c=uX(e,t,n,r,i);return o===`nanosecond`&&a===1?c:fX(c,t,eY(n,e),n,r,i,a,o,s)}function gX(e,t,n,r,i,a){let o=_q.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=iJ(t,`largestUnit`,n,`auto`);if(r.includes(s))throw RangeError(`largestUnit must be one of ${o.join(`, `)}, not ${s}`);let c=$q(t),l=Xq(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=iJ(t,`smallestUnit`,n,i);if(r.includes(u))throw RangeError(`smallestUnit must be one of ${o.join(`, `)}, not ${u}`);let d=sJ(a,u);if(s===`auto`&&(s=d),sJ(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&&eJ(c,f,!1),{largestUnit:s,roundingIncrement:c,roundingMode:l,smallestUnit:u}}function _X(e,t,n,r){let i=yJ(n),a=gX(e,YX(r),`time`,[],`nanosecond`,`second`),o=rX(cX(Q(t,XG),Q(i,XG),a.roundingIncrement,a.smallestUnit,a.roundingMode),a.largestUnit);return e===`since`&&(o=VY(o)),o}function vX(e,t,n,r){let i=hJ(n),a=Q(t,eK),o=Q(i,eK);if(!KJ(a,o))throw RangeError(`cannot compute difference between dates of ${a} and ${o} calendars`);let s=gX(e,YX(r),`date`,[],`day`,`day`),c=LK(`%Temporal.Duration%`),l=Q(t,ZG),u=Q(i,ZG);if(zX(l,u)===0)return new c;let d={date:UJ(a,l,u,s.largestUnit),time:HK.ZERO};if(s.smallestUnit!==`day`||s.roundingIncrement!==1){let e=qq(l,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});d=fX(d,EY(qq(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=rX(d,`day`);return e===`since`&&(f=VY(f)),f}function yX(e,t,n,r){let i=_J(n),a=Q(t,eK),o=Q(i,eK);if(!KJ(a,o))throw RangeError(`cannot compute difference between dates of ${a} and ${o} calendars`);let s=gX(e,YX(r),`datetime`,[],`nanosecond`,`day`),c=LK(`%Temporal.Duration%`),l=Q(t,QG),u=Q(i,QG);if(VX(l,u)===0)return new c;let d=rX(mX(l,u,a,s.largestUnit,s.roundingIncrement,s.smallestUnit,s.roundingMode),s.largestUnit);return e===`since`&&(d=VY(d)),d}function bX(e,t,n,r){let i=xJ(n),a=gX(e,YX(r),`time`,[],`nanosecond`,`hour`),o=sX(Q(t,$G),Q(i,$G));o=LX(o,a.roundingIncrement,a.smallestUnit,a.roundingMode);let s=rX(iX({years:0,months:0,weeks:0,days:0},o),a.largestUnit);return e===`since`&&(s=VY(s)),s}function xX(e,t,n,r){let i=CJ(n),a=Q(t,eK),o=Q(i,eK);if(!KJ(a,o))throw RangeError(`cannot compute difference between months of ${a} and ${o} calendars`);let s=gX(e,YX(r),`date`,[`week`,`day`],`month`,`year`),c=LK(`%Temporal.Duration%`);if(zX(Q(t,ZG),Q(i,ZG))==0)return new c;let l=fJ(a,Q(t,ZG),`year-month`);l.day=1;let u=qJ(a,l,`constrain`),d=fJ(a,Q(i,ZG),`year-month`);d.day=1;let f=qJ(a,d,`constrain`),p={date:Kq(UJ(a,u,f,s.largestUnit),0,0),time:HK.ZERO};if(s.smallestUnit!==`month`||s.roundingIncrement!==1){let e=qq(u,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});p=fX(p,EY(qq(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=rX(p,`day`);return e===`since`&&(m=VY(m)),m}function SX(e,t,n,r){let i=TJ(n),a=Q(t,eK),o=Q(i,eK);if(!KJ(a,o))throw RangeError(`cannot compute difference between dates of ${a} and ${o} calendars`);let s=gX(e,YX(r),`datetime`,[],`nanosecond`,`hour`),c=Q(t,XG),l=Q(i,XG),u=LK(`%Temporal.Duration%`),d;if(lJ(s.largestUnit)!==`date`)d=rX(cX(c,l,s.roundingIncrement,s.smallestUnit,s.roundingMode),s.largestUnit);else{let e=Q(t,iK);if(!ZJ(e,Q(i,iK)))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(Z.default.equal(c,l))return new u;d=rX(hX(c,l,e,a,s.largestUnit,s.roundingIncrement,s.smallestUnit,s.roundingMode),`hour`)}return e===`since`&&(d=VY(d)),d}function CX({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,zY(e,t,s,r,i,c)}function wX(e,t){let n=t.addToEpochNs(e);return ZY(n),n}function TX(e,t,n,r,i=`constrain`){if(PY(r.date)===0)return wX(e,r.time);let a=eY(t,e);return wX(tY(t,qq(HJ(n,a.isoDate,r.date,i),a.time),`compatible`),r.time)}function EX(e,t,n){let r=vJ(n);e===`subtract`&&(r=VY(r));let i=sJ(oJ(t),oJ(r));if(cJ(i))throw RangeError(`For years, months, or weeks arithmetic, use date arithmetic relative to a starting point`);let a=tX(t),o=tX(r);return rX(iX({years:0,months:0,weeks:0,days:0},a.time.add(o.time)),i)}function DX(e,t,n){let r=vJ(n);e===`subtract`&&(r=VY(r));let i=oJ(r);if(lJ(i)===`date`)throw RangeError(`Duration field ${i} not supported by Temporal.Instant. Try Temporal.ZonedDateTime instead.`);let a=tX(r);return LJ(wX(Q(t,XG),a.time))}function OX(e,t,n,r){let i=Q(t,eK),a=vJ(n);e===`subtract`&&(a=VY(a));let o=nX(a),s=Jq(YX(r));return DJ(HJ(i,Q(t,ZG),o,s),i)}function kX(e,t,n,r){let i=vJ(n);e===`subtract`&&(i=VY(i));let a=Jq(YX(r)),o=Q(t,eK),s=tX(i),c=Q(t,QG),l=CX(c.time,s.time),u=Kq(s.date,l.deltaDays);return $Y(u.years,u.months,u.weeks,u.days,0,0,0,0,0,0),kJ(qq(HJ(o,c.isoDate,u,a),l),o)}function AX(e,t,n){let r=vJ(n);e===`subtract`&&(r=VY(r));let i=tX(r),{hour:a,minute:o,second:s,millisecond:c,microsecond:l,nanosecond:u}=CX(Q(t,$G),i.time);return NJ(Wq(a,o,s,c,l,u,`reject`))}function jX(e,t,n,r){let i=vJ(n);e===`subtract`&&(i=VY(i));let a=Jq(YX(r)),o=NY(i),s=Q(t,eK),c=fJ(s,Q(t,ZG),`year-month`);c.day=1;let l=qJ(s,c,`constrain`);if(o<0){let e=HJ(s,l,{months:1},`constrain`);l=LY(e.year,e.month,e.day-1)}let u=nX(i);return KY(l),FJ(JJ(s,fJ(s,HJ(s,l,u,a),`year-month`),a),s)}function MX(e,t,n,r){let i=vJ(n);e===`subtract`&&(i=VY(i));let a=Jq(YX(r)),o=Q(t,iK),s=Q(t,eK),c=eX(i);return zJ(TX(Q(t,XG),o,s,c,a),o,s)}function NX(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=JX(Math.abs(2*i)-t),l=o%2==0,u=BK(n,a),d=i===0?o:VK(o,s,c,l,u);return t*(a===`positive`?d:-d)}function PX(e,t,n,r){let i=bq[n]*t;return function(e,t,n){let r=UG(e),i=UG(t),a=Z.default.divide(r,i),o=Z.default.remainder(r,i),s=BK(n,`positive`),c,l;Z.default.lessThan(r,IG)?(c=Z.default.subtract(a,LG),l=a):(c=a,l=Z.default.add(a,LG));let u=KG(GG(Z.default.multiply(o,RG)),i)*(Z.default.lessThan(r,IG)?-1:1)+0,d=Z.default.equal(o,IG)?a:VK(c,l,u,WG(c),s);return Z.default.multiply(d,i)}(e,Z.default.BigInt(i),r)}function FX(e,t,n,r){XY(e);let{year:i,month:a,day:o}=e.isoDate,s=IX(e.time,t,n,r);return qq(LY(i,a,o+s.deltaDays),s)}function IX({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=bq[s],d=NX(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 zY(d,0,0,0,0,0);case`minute`:return zY(e,d,0,0,0,0);case`second`:return zY(e,t,d,0,0,0);case`millisecond`:return zY(e,t,n,d,0,0);case`microsecond`:return zY(e,t,n,r,d,0);case`nanosecond`:return zY(e,t,n,r,i,d);default:throw Error(`Invalid unit ${s}`)}}function LX(e,t,n,r){let i=bq[n];return e.round(Z.default.BigInt(i*t),r)}function RX(e,t){let n=bq[t];return e.fdiv(Z.default.BigInt(n))}function zX(e,t){return e.year===t.year?e.month===t.month?e.day===t.day?0:JX(e.day-t.day):JX(e.month-t.month):JX(e.year-t.year)}function BX(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:JX(e.nanosecond-t.nanosecond):JX(e.microsecond-t.microsecond):JX(e.millisecond-t.millisecond):JX(e.second-t.second):JX(e.minute-t.minute):JX(e.hour-t.hour)}function VX(e,t){let n=zX(e.isoDate,t.isoDate);return n===0?BX(e.time,t.time):n}function HX(e){let t=GX(e);return globalThis.BigInt===void 0?t:globalThis.BigInt(t.toString(10))}function UX(e,t){let{quotient:n,remainder:r}=qG(UG(e),zG),i=Z.default.toNumber(n);return t===`floor`&&Z.default.toNumber(r)<0&&--i,t===`ceil`&&Z.default.toNumber(r)>0&&(i+=1),i}function WX(e){if(!Number.isInteger(e))throw RangeError(`epoch milliseconds must be an integer`);return Z.default.multiply(Z.default.BigInt(e),zG)}function GX(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`?Z.default.BigInt(t.toString(10)):Z.default.BigInt(t)}var KX=(()=>{let e=Z.default.BigInt(Date.now()%1e6);return()=>{let t=Date.now(),n=Z.default.BigInt(t),r=Z.default.add(WX(t),e);return e=Z.default.remainder(n,zG),Z.default.greaterThan(r,nq)?nq:Z.default.lessThan(r,rq)?rq:r}})();function qX(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}function JX(e){return e<0?-1:e>0?1:e}function YX(e){if(e===void 0)return Object.create(null);if(sq(e)&&e!==null)return e;throw TypeError(`Options parameter must be an object, not `+(e===null?`null`:typeof e))}function XX(e,t){let n=Object.create(null);return n[e]=t,n}function ZX(e,t,n,r){let i=e[t];if(i!==void 0){if(i=lq(i),!n.includes(i))throw RangeError(`${t} must be one of ${n.join(`, `)}, not ${i}`);return i}if(r===rJ)throw RangeError(`${t} option is required`);return r}function QX(e){let t=$X(e);if(!wye.includes($X(t)))throw RangeError(`invalid calendar identifier ${t}`);switch(t){case`ethiopic-amete-alem`:return`ethioaa`;case`islamicc`:return`islamic-civil`}return t}function $X(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 eZ(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 jye=RegExp(`^${YK.source}$`),Mye=RegExp(`^([+-])([01][0-9]|2[0-3])(?::?([0-5][0-9])(?::?([0-5][0-9])(?:[.,](\\d{1,9}))?)?)?$`);function tZ(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 nZ(e){return[...e]}function rZ(e,t){if(e!==`gregory`&&e!==`iso8601`)return;let n=aZ[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 iZ(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 aZ={};function oZ(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 sZ(e,t=!1){return`M${`${e}`.padStart(2,`0`)}${t?`L`:``}`}function cZ(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`&&WY(r,1,n),t===`constrain`&&(r=HY(r,1,n)),i=sZ(r)}else{let e=oZ(i);if(i!==sZ(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}}aZ.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,cZ(e))},dateToISO:(e,t)=>Uq(e.year,e.month,e.day,t),monthDayToISOReferenceDate(e,t){let{month:n,day:r}=Uq(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 nZ(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}=IY(o,s),{year:o,month:s,day:c}=Uq(o,s,c,a),c+=i+7*r,LY(o,s,c)},dateUntil(e,t,n){let r=-zX(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);!iZ(r,e.year+s,e.month,e.day,t);)a=s,s+=r;let c=r;for(i=IY(e.year+a,e.month+c);!iZ(r,i.year,i.month,e.day,t);)o=c,c+=r,i=IY(i.year,i.month+r);n===`month`&&(o+=12*a,a=0)}i=IY(e.year+a,e.month+o);let s=UY(i.year,i.month,e.day),c=0,l=aX(t.year,t.month-1,t.day)-aX(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=sZ(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+=MY(e,n);i.dayOfYear=r}return r.weekOfYear&&(i.weekOfYear=rZ(`iso8601`,{year:e,month:t,day:n})),r.daysInMonth&&(i.daysInMonth=MY(e,t)),(r.daysInYear||r.inLeapYear)&&(i.inLeapYear=jY(e),i.daysInYear=i.inLeapYear?366:365),i},getFirstDayOfWeek:()=>1,getMinimalDaysInFirstWeek:()=>4};var lZ=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 uZ({isoYear:e,isoMonth:t,isoDay:n}){return`${aY(e)}-${oY(t)}-${oY(n)}T00:00Z`}function dZ(e,t){return{years:e.year-t.year,months:e.month-t.month,days:e.day-t.day}}lZ.objectMap=new WeakMap,lZ.MAX_CACHE_ENTRIES=1e3;var fZ=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=uZ({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}=cZ(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`?(WY(i,1,r),WY(a,1,this.maximumMonthLength(e))):(i=HY(i,1,r),a=HY(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=dZ(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=dZ(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=dZ(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:JX(e.day-t.day):JX(e.month-t.month):JX(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 LY(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 aX(i.year,i.month-1,i.day)-aX(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(){}},Nye=class extends fZ{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?sZ(5,!0):sZ(t<6?t:t-1):sZ(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=oZ(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`?(WY(a,1,this.monthsInYear({year:i})),WY(s,1,this.maximumMonthLength({year:i,month:a}))):(a=HY(a,1,this.monthsInYear({year:i})),s=HY(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}}},pZ=class extends fZ{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}}},Pye=class extends pZ{constructor(){super(...arguments),this.id=`islamic`}},Fye=class extends pZ{constructor(){super(...arguments),this.id=`islamic-umalqura`}},Iye=class extends pZ{constructor(){super(...arguments),this.id=`islamic-tbla`}},Lye=class extends pZ{constructor(){super(...arguments),this.id=`islamic-civil`}},Rye=class extends pZ{constructor(){super(...arguments),this.id=`islamic-rgsa`}},zye=class extends pZ{constructor(){super(...arguments),this.id=`islamicc`}},Bye=class extends fZ{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 oZ(e)<=6?31:30}estimateIsoDate(e){let{year:t}=this.adjustCalendarDate(e);return{year:t+621,month:1,day:1}}},Vye=class extends fZ{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 mZ(e.year+78)}monthsInYear(){return 12}minimumMonthLength(e){return this.getMonthInfo(e).length}maximumMonthLength(e){return this.getMonthInfo(e).length}maxLengthOfMonthCodeInAnyYear(e){let t=oZ(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 LY(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 mZ(e){return e%4==0&&(e%100!=0||e%400==0)}var hZ=class extends fZ{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 mZ(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][oZ(e)-1]}estimateIsoDate(e){let t=this.adjustCalendarDate(e);return Uq(t.year+this.isoEpoch.year,t.month+this.isoEpoch.month,t.day+this.isoEpoch.day,`constrain`)}},gZ=class extends fZ{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 mZ(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][oZ(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:oZ(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 Uq(t+i.isoEpoch.year-+!i.hasYearZero,n,r,`constrain`)}},_Z=class extends gZ{constructor(e,t){super(e,t)}isoToCalendarDate(e){let{year:t,month:n,day:r}=e,i=sZ(n),a=t-this.anchorEra.isoEpoch.year+1;return this.completeEraYear({year:a,month:n,monthCode:i,day:r})}},vZ={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},Hye=class extends hZ{constructor(e,t){super(e,t),this.inLeapYear=vZ.inLeapYear,this.monthsInYear=vZ.monthsInYear,this.minimumMonthLength=vZ.minimumMonthLength,this.maximumMonthLength=vZ.maximumMonthLength,this.maxLengthOfMonthCodeInAnyYear=vZ.maxLengthOfMonthCodeInAnyYear}},yZ=class extends gZ{constructor(e,t){super(e,t),this.inLeapYear=vZ.inLeapYear,this.monthsInYear=vZ.monthsInYear,this.minimumMonthLength=vZ.minimumMonthLength,this.maximumMonthLength=vZ.maximumMonthLength,this.maxLengthOfMonthCodeInAnyYear=vZ.maxLengthOfMonthCodeInAnyYear}},Uye=class extends Hye{constructor(){super(`ethioaa`,{year:-5492,month:7,day:17})}},Wye=class extends yZ{constructor(){super(`coptic`,[{code:`coptic`,isoEpoch:{year:284,month:8,day:29}},{code:`coptic-inverse`,reverseOf:`coptic`}])}},Gye=class extends yZ{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}}])}},Kye=class extends _Z{constructor(){super(`roc`,[{code:`roc`,names:[`minguo`],isoEpoch:{year:1912,month:1,day:1}},{code:`roc-inverse`,names:[`before-roc`],reverseOf:`roc`}])}},qye=class extends hZ{constructor(){super(`buddhist`,{year:-543,month:1,day:1})}},Jye=class extends _Z{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}},Yye=class extends _Z{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}}},bZ=class extends fZ{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=uZ({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=sZ(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=sZ(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`?(WY(a,1,o),WY(s,1,this.maximumMonthLength())):(a=HY(a,1,o),s=HY(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=sZ(+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}}},Xye=class extends bZ{constructor(){super(...arguments),this.id=`chinese`}},Zye=class extends bZ{constructor(){super(...arguments),this.id=`dangi`}},Qye=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 lZ;cZ(e,void 0,this.helper.monthsInYear({year:e.year??1972},t))}}dateToISO(e,t){let n=new lZ,r=this.helper.calendarToIsoDate(e,t,n);return n.setObject(r),r}monthDayToISOReferenceDate(e,t){let n=new lZ,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 nZ(t)}dateAdd(e,{years:t,months:n,weeks:r,days:i},a){let o=lZ.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 lZ.getCacheForObject(l)||new lZ(o).setObject(l),l}dateUntil(e,t,n){let r=lZ.getCacheForObject(e),i=lZ.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=lZ.getCacheForObject(e),r=this.helper.isoToCalendarDate(e,n);if(t.dayOfWeek&&(r.dayOfWeek=aZ.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=rZ(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[Nye,Bye,Gye,Uye,Wye,Xye,Zye,Kye,Vye,qye,Jye,Yye,Pye,Fye,Iye,Lye,Rye,zye]){let t=new e;aZ[t.id]=new Qye(t)}IK(`calendarImpl`,(function(e){return aZ[e]}));var xZ=Intl.DateTimeFormat;function SZ(e,t){let n=Q(e,t);return typeof n==`function`&&(n=new xZ(Q(e,TK),n(Q(e,EK))),function(e,t,n){let r=kK(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 CZ(e){return MK(e,xK)}var wZ=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 xZ(t,i),o=a.resolvedOptions();if(jK(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,NK(e,EK,t)}else NK(e,EK,i);NK(e,TK,o.locale),NK(e,xK,a),NK(e,SK,o.timeZone),NK(e,wK,o.calendar),NK(e,hK,sbe),NK(e,gK,abe),NK(e,_K,obe),NK(e,vK,ibe),NK(e,yK,cbe),NK(e,bK,lbe);let s=r?i.timeZone:void 0;if(s===void 0)NK(e,CK,o.timeZone);else{let t=lq(s);if(t.startsWith(`−`))throw RangeError(`Unicode minus (U+2212) is not supported in time zone offsets`);NK(e,CK,XJ(t))}})(this,e,t)}get format(){$(this,CZ);let e=ebe.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,CZ),nbe.call(this,e,t)}formatToParts(e,...t){return $(this,CZ),tbe.call(this,e,...t)}formatRangeToParts(e,t){return $(this,CZ),rbe.call(this,e,t)}resolvedOptions(){return $(this,CZ),$ye.call(this)}};`formatToParts`in xZ.prototype||delete wZ.prototype.formatToParts,`formatRangeToParts`in xZ.prototype||delete wZ.prototype.formatRangeToParts;var TZ=function(e=void 0,t=void 0){return new wZ(e,t)};function $ye(){let e=Q(this,xK).resolvedOptions();return e.timeZone=Q(this,CK),e}function ebe(e,...t){let n,r,i=NZ(e,this);return i.formatter?(n=i.formatter,r=[UX(i.epochNs,`floor`)]):(n=Q(this,xK),r=[e,...t]),n.format(...r)}function tbe(e,...t){let n,r,i=NZ(e,this);return i.formatter?(n=i.formatter,r=[UX(i.epochNs,`floor`)]):(n=Q(this,xK),r=[e,...t]),n.formatToParts(...r)}function nbe(e,t){if(e===void 0||t===void 0)throw TypeError(`Intl.DateTimeFormat.formatRange requires two values`);let n=jZ(e),r=jZ(t),i,a=[n,r];if(AZ(n)!==AZ(r))throw TypeError(`Intl.DateTimeFormat.formatRange accepts two values of the same type`);if(AZ(n)){if(!MZ(n,r))throw TypeError(`Intl.DateTimeFormat.formatRange accepts two values of the same type`);let{epochNs:e,formatter:t}=NZ(n,this),{epochNs:o,formatter:s}=NZ(r,this);t&&(i=t,a=[UX(e,`floor`),UX(o,`floor`)])}return i||=Q(this,xK),i.formatRange(...a)}function rbe(e,t){if(e===void 0||t===void 0)throw TypeError(`Intl.DateTimeFormat.formatRange requires two values`);let n=jZ(e),r=jZ(t),i,a=[n,r];if(AZ(n)!==AZ(r))throw TypeError(`Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type`);if(AZ(n)){if(!MZ(n,r))throw TypeError(`Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type`);let{epochNs:e,formatter:t}=NZ(n,this),{epochNs:o,formatter:s}=NZ(r,this);t&&(i=t,a=[UX(e,`floor`),UX(o,`floor`)])}return i||=Q(this,xK),i.formatRangeToParts(...a)}function EZ(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 ibe(e){let t=EZ(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`})),!OZ(t)){if(kZ(e))throw TypeError(`cannot format Temporal.PlainTime with options [${Object.keys(e)}]`);Object.assign(t,{hour:`numeric`,minute:`numeric`,second:`numeric`})}return t}function abe(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=EZ(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(kZ(e))throw TypeError(`cannot format PlainYearMonth with options [${Object.keys(e)}]`);Object.assign(n,{year:`numeric`,month:`numeric`})}return n}function obe(e){let t={short:{month:`numeric`,day:`numeric`},medium:{month:`short`,day:`numeric`},long:{month:`long`,day:`numeric`},full:{month:`long`,day:`numeric`}},n=EZ(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(kZ(e))throw TypeError(`cannot format PlainMonthDay with options [${Object.keys(e)}]`);Object.assign(n,{month:`numeric`,day:`numeric`})}return n}function sbe(e){let t=EZ(e,{hour:!1,minute:!1,second:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if(!DZ(t)){if(kZ(e))throw TypeError(`cannot format PlainDate with options [${Object.keys(e)}]`);Object.assign(t,{year:`numeric`,month:`numeric`,day:`numeric`})}return t}function cbe(e){let t=EZ(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),!OZ(t)&&!DZ(t)){if(kZ(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 lbe(e){let t=e;return OZ(t)||DZ(t)||(t=Object.assign({},t,{year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`})),t}function DZ(e){return`year`in e||`month`in e||`day`in e||`weekday`in e||`dateStyle`in e||`era`in e}function OZ(e){return`hour`in e||`minute`in e||`second`in e||`timeStyle`in e||`dayPeriod`in e||`fractionalSecondDigits`in e}function kZ(e){return DZ(e)||OZ(e)||`dateStyle`in e||`timeStyle`in e||`timeZoneName`in e}function AZ(e){return Eq(e)||Dq(e)||Oq(e)||jq(e)||kq(e)||Aq(e)||wq(e)}function jZ(e){return AZ(e)?e:cq(e)}function MZ(e,t){return!(!AZ(e)||!AZ(t)||Dq(e)&&!Dq(t)||Eq(e)&&!Eq(t)||Oq(e)&&!Oq(t)||jq(e)&&!jq(t)||kq(e)&&!kq(t)||Aq(e)&&!Aq(t)||wq(e)&&!wq(t))}function NZ(e,t){if(Dq(e)){let n={isoDate:{year:1970,month:1,day:1},time:Q(e,$G)};return{epochNs:tY(Q(t,SK),n,`compatible`),formatter:SZ(t,vK)}}if(kq(e)){let n=Q(e,eK),r=Q(t,wK);if(n!==r)throw RangeError(`cannot format PlainYearMonth with calendar ${n} in locale with calendar ${r}`);let i=qq(Q(e,ZG),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:tY(Q(t,SK),i,`compatible`),formatter:SZ(t,gK)}}if(Aq(e)){let n=Q(e,eK),r=Q(t,wK);if(n!==r)throw RangeError(`cannot format PlainMonthDay with calendar ${n} in locale with calendar ${r}`);let i=qq(Q(e,ZG),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:tY(Q(t,SK),i,`compatible`),formatter:SZ(t,_K)}}if(Eq(e)){let n=Q(e,eK),r=Q(t,wK);if(n!==`iso8601`&&n!==r)throw RangeError(`cannot format PlainDate with calendar ${n} in locale with calendar ${r}`);let i=qq(Q(e,ZG),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:tY(Q(t,SK),i,`compatible`),formatter:SZ(t,hK)}}if(Oq(e)){let n=Q(e,eK),r=Q(t,wK);if(n!==`iso8601`&&n!==r)throw RangeError(`cannot format PlainDateTime with calendar ${n} in locale with calendar ${r}`);let i=Q(e,QG);return{epochNs:tY(Q(t,SK),i,`compatible`),formatter:SZ(t,yK)}}if(jq(e))throw TypeError(`Temporal.ZonedDateTime not supported in DateTimeFormat methods. Use toLocaleString() instead.`);return wq(e)?{epochNs:Q(e,XG),formatter:SZ(t,bK)}:{}}function PZ(e){let t=Object.create(null);return t.years=Q(e,aK),t.months=Q(e,oK),t.weeks=Q(e,sK),t.days=Q(e,cK),t.hours=Q(e,lK),t.minutes=Q(e,uK),t.seconds=Q(e,dK),t.milliseconds=Q(e,fK),t.microseconds=Q(e,pK),t.nanoseconds=Q(e,mK),t}wZ.prototype.constructor=TZ,Object.defineProperty(TZ,"prototype",{value:wZ.prototype,writable:!1,enumerable:!1,configurable:!1}),TZ.supportedLocalesOf=xZ.supportedLocalesOf,FK(TZ,`Intl.DateTimeFormat`);var{format:ube,formatToParts:dbe}=Intl.DurationFormat?.prototype??Object.create(null);function FZ(e){Intl.DurationFormat.prototype.resolvedOptions.call(this);let t=PZ(vJ(e));return ube.call(this,t)}Intl.DurationFormat?.prototype&&(Intl.DurationFormat.prototype.format=FZ,Intl.DurationFormat.prototype.formatToParts=function(e){Intl.DurationFormat.prototype.resolvedOptions.call(this);let t=PZ(vJ(e));return dbe.call(this,t)}),Object.freeze({__proto__:null,DateTimeFormat:TZ,ModifiedIntlDurationFormatPrototypeFormat:FZ});var IZ=class{constructor(e){if(arguments.length<1)throw TypeError(`missing argument: epochNanoseconds is required`);IJ(this,GX(e))}get epochMilliseconds(){return $(this,wq),UX(Q(this,XG),`floor`)}get epochNanoseconds(){return $(this,wq),HX(Z.default.BigInt(Q(this,XG)))}add(e){return $(this,wq),DX(`add`,this,e)}subtract(e){return $(this,wq),DX(`subtract`,this,e)}until(e,t=void 0){return $(this,wq),_X(`until`,this,e,t)}since(e,t=void 0){return $(this,wq),_X(`since`,this,e,t)}round(e){if($(this,wq),e===void 0)throw TypeError(`options parameter is required`);let t=typeof e==`string`?XX(`smallestUnit`,e):YX(e),n=$q(t),r=Xq(t,`halfExpand`),i=iJ(t,`smallestUnit`,`time`,rJ);return eJ(n,{hour:24,minute:1440,second:86400,millisecond:864e5,microsecond:864e8,nanosecond:864e11}[i],!0),LJ(PX(Q(this,XG),n,i,r))}equals(e){$(this,wq);let t=yJ(e),n=Q(this,XG),r=Q(t,XG);return Z.default.equal(Z.default.BigInt(n),Z.default.BigInt(r))}toString(e=void 0){$(this,wq);let t=YX(e),n=tJ(t),r=Xq(t,`trunc`),i=iJ(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=XJ(a));let{precision:o,unit:s,increment:c}=nJ(i,n);return lY(LJ(PX(Q(this,XG),c,s,r)),a,o)}toJSON(){return $(this,wq),lY(this,void 0,`auto`)}toLocaleString(e=void 0,t=void 0){return $(this,wq),new TZ(e,t).format(this)}valueOf(){eZ(`Instant`)}toZonedDateTimeISO(e){$(this,wq);let t=XJ(e);return zJ(Q(this,XG),t,`iso8601`)}static fromEpochMilliseconds(e){return LJ(WX(cq(e)))}static fromEpochNanoseconds(e){return LJ(GX(e))}static from(e){return yJ(e)}static compare(e,t){let n=yJ(e),r=yJ(t),i=Q(n,XG),a=Q(r,XG);return Z.default.lessThan(i,a)?-1:+!!Z.default.greaterThan(i,a)}};FK(IZ,`Temporal.Instant`);var LZ=class{constructor(e,t,n,r=`iso8601`){let i=uq(e),a=uq(t),o=uq(n),s=QX(r===void 0?`iso8601`:mq(r));GY(i,a,o),EJ(this,{year:i,month:a,day:o},s)}get calendarId(){return $(this,Eq),Q(this,eK)}get era(){return RZ(this,`era`)}get eraYear(){return RZ(this,`eraYear`)}get year(){return RZ(this,`year`)}get month(){return RZ(this,`month`)}get monthCode(){return RZ(this,`monthCode`)}get day(){return RZ(this,`day`)}get dayOfWeek(){return RZ(this,`dayOfWeek`)}get dayOfYear(){return RZ(this,`dayOfYear`)}get weekOfYear(){return RZ(this,`weekOfYear`)?.week}get yearOfWeek(){return RZ(this,`weekOfYear`)?.year}get daysInWeek(){return RZ(this,`daysInWeek`)}get daysInMonth(){return RZ(this,`daysInMonth`)}get daysInYear(){return RZ(this,`daysInYear`)}get monthsInYear(){return RZ(this,`monthsInYear`)}get inLeapYear(){return RZ(this,`inLeapYear`)}with(e,t=void 0){if($(this,Eq),!sq(e))throw TypeError(`invalid argument`);Mq(e);let n=Q(this,eK),r=fJ(n,Q(this,ZG));return r=VJ(n,r,pJ(n,e,[`year`,`month`,`monthCode`,`day`],[],`partial`)),DJ(qJ(n,r,Jq(YX(t))),n)}withCalendar(e){$(this,Eq);let t=WJ(e);return DJ(Q(this,ZG),t)}add(e,t=void 0){return $(this,Eq),OX(`add`,this,e,t)}subtract(e,t=void 0){return $(this,Eq),OX(`subtract`,this,e,t)}until(e,t=void 0){return $(this,Eq),vX(`until`,this,e,t)}since(e,t=void 0){return $(this,Eq),vX(`since`,this,e,t)}equals(e){$(this,Eq);let t=hJ(e);return zX(Q(this,ZG),Q(t,ZG))===0&&KJ(Q(this,eK),Q(t,eK))}toString(e=void 0){return $(this,Eq),dY(this,Qq(YX(e)))}toJSON(){return $(this,Eq),dY(this)}toLocaleString(e=void 0,t=void 0){return $(this,Eq),new TZ(e,t).format(this)}valueOf(){eZ(`PlainDate`)}toPlainDateTime(e=void 0){$(this,Eq);let t=SJ(e);return kJ(qq(Q(this,ZG),t),Q(this,eK))}toZonedDateTime(e){let t,n;if($(this,Eq),sq(e)){let r=e.timeZone;r===void 0?t=XJ(e):(t=XJ(r),n=e.plainTime)}else t=XJ(e);let r=Q(this,ZG),i;return n===void 0?i=iY(t,r):(n=xJ(n),i=tY(t,qq(r,Q(n,$G)),`compatible`)),zJ(i,t,Q(this,eK))}toPlainYearMonth(){$(this,Eq);let e=Q(this,eK);return FJ(JJ(e,fJ(e,Q(this,ZG)),`constrain`),e)}toPlainMonthDay(){$(this,Eq);let e=Q(this,eK);return jJ(YJ(e,fJ(e,Q(this,ZG)),`constrain`),e)}static from(e,t=void 0){return hJ(e,t)}static compare(e,t){let n=hJ(e),r=hJ(t);return zX(Q(n,ZG),Q(r,ZG))}};function RZ(e,t){$(e,Eq);let n=Q(e,ZG);return dJ(e).isoToDate(n,{[t]:!0})[t]}FK(LZ,`Temporal.PlainDate`);var zZ=class{constructor(e,t,n,r=0,i=0,a=0,o=0,s=0,c=0,l=`iso8601`){let u=uq(e),d=uq(t),f=uq(n),p=r===void 0?0:uq(r),m=i===void 0?0:uq(i),h=a===void 0?0:uq(a),g=o===void 0?0:uq(o),_=s===void 0?0:uq(s),v=c===void 0?0:uq(c),y=QX(l===void 0?`iso8601`:mq(l));JY(u,d,f,p,m,h,g,_,v),OJ(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,Oq),Q(this,eK)}get year(){return BZ(this,`year`)}get month(){return BZ(this,`month`)}get monthCode(){return BZ(this,`monthCode`)}get day(){return BZ(this,`day`)}get hour(){return VZ(this,`hour`)}get minute(){return VZ(this,`minute`)}get second(){return VZ(this,`second`)}get millisecond(){return VZ(this,`millisecond`)}get microsecond(){return VZ(this,`microsecond`)}get nanosecond(){return VZ(this,`nanosecond`)}get era(){return BZ(this,`era`)}get eraYear(){return BZ(this,`eraYear`)}get dayOfWeek(){return BZ(this,`dayOfWeek`)}get dayOfYear(){return BZ(this,`dayOfYear`)}get weekOfYear(){return BZ(this,`weekOfYear`)?.week}get yearOfWeek(){return BZ(this,`weekOfYear`)?.year}get daysInWeek(){return BZ(this,`daysInWeek`)}get daysInYear(){return BZ(this,`daysInYear`)}get daysInMonth(){return BZ(this,`daysInMonth`)}get monthsInYear(){return BZ(this,`monthsInYear`)}get inLeapYear(){return BZ(this,`inLeapYear`)}with(e,t=void 0){if($(this,Oq),!sq(e))throw TypeError(`invalid argument`);Mq(e);let n=Q(this,eK),r=Q(this,QG),i={...fJ(n,r.isoDate),...r.time};return i=VJ(n,i,pJ(n,e,[`year`,`month`,`monthCode`,`day`],[`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`],`partial`)),kJ(gJ(n,i,Jq(YX(t))),n)}withPlainTime(e=void 0){$(this,Oq);let t=SJ(e);return kJ(qq(Q(this,QG).isoDate,t),Q(this,eK))}withCalendar(e){$(this,Oq);let t=WJ(e);return kJ(Q(this,QG),t)}add(e,t=void 0){return $(this,Oq),kX(`add`,this,e,t)}subtract(e,t=void 0){return $(this,Oq),kX(`subtract`,this,e,t)}until(e,t=void 0){return $(this,Oq),yX(`until`,this,e,t)}since(e,t=void 0){return $(this,Oq),yX(`since`,this,e,t)}round(e){if($(this,Oq),e===void 0)throw TypeError(`options parameter is required`);let t=typeof e==`string`?XX(`smallestUnit`,e):YX(e),n=$q(t),r=Xq(t,`halfExpand`),i=iJ(t,`smallestUnit`,`time`,rJ,[`day`]),a={day:1,hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[i];eJ(n,a,a===1);let o=Q(this,QG);return kJ(n===1&&i===`nanosecond`?o:FX(o,n,i,r),Q(this,eK))}equals(e){$(this,Oq);let t=_J(e);return VX(Q(this,QG),Q(t,QG))===0&&KJ(Q(this,eK),Q(t,eK))}toString(e=void 0){$(this,Oq);let t=YX(e),n=Qq(t),r=tJ(t),i=Xq(t,`trunc`),a=iJ(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}=nJ(a,r),l=FX(Q(this,QG),c,s,i);return YY(l),pY(l,Q(this,eK),o,n)}toJSON(){return $(this,Oq),pY(Q(this,QG),Q(this,eK),`auto`)}toLocaleString(e=void 0,t=void 0){return $(this,Oq),new TZ(e,t).format(this)}valueOf(){eZ(`PlainDateTime`)}toZonedDateTime(e,t=void 0){$(this,Oq);let n=XJ(e),r=Yq(YX(t));return zJ(tY(n,Q(this,QG),r),n,Q(this,eK))}toPlainDate(){return $(this,Oq),DJ(Q(this,QG).isoDate,Q(this,eK))}toPlainTime(){return $(this,Oq),NJ(Q(this,QG).time)}static from(e,t=void 0){return _J(e,t)}static compare(e,t){let n=_J(e),r=_J(t);return VX(Q(n,QG),Q(r,QG))}};function BZ(e,t){$(e,Oq);let n=Q(e,QG).isoDate;return dJ(e).isoToDate(n,{[t]:!0})[t]}function VZ(e,t){return $(e,Oq),Q(e,QG).time[t]}FK(zZ,`Temporal.PlainDateTime`);var HZ=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:fq(e),d=t===void 0?0:fq(t),f=n===void 0?0:fq(n),p=r===void 0?0:fq(r),m=i===void 0?0:fq(i),h=a===void 0?0:fq(a),g=o===void 0?0:fq(o),_=s===void 0?0:fq(s),v=c===void 0?0:fq(c),y=l===void 0?0:fq(l);$Y(u,d,f,p,m,h,g,_,v,y),jK(this),NK(this,aK,u),NK(this,oK,d),NK(this,sK,f),NK(this,cK,p),NK(this,lK,m),NK(this,uK,h),NK(this,dK,g),NK(this,fK,_),NK(this,pK,v),NK(this,mK,y)}get years(){return $(this,Tq),Q(this,aK)}get months(){return $(this,Tq),Q(this,oK)}get weeks(){return $(this,Tq),Q(this,sK)}get days(){return $(this,Tq),Q(this,cK)}get hours(){return $(this,Tq),Q(this,lK)}get minutes(){return $(this,Tq),Q(this,uK)}get seconds(){return $(this,Tq),Q(this,dK)}get milliseconds(){return $(this,Tq),Q(this,fK)}get microseconds(){return $(this,Tq),Q(this,pK)}get nanoseconds(){return $(this,Tq),Q(this,mK)}get sign(){return $(this,Tq),NY(this)}get blank(){return $(this,Tq),NY(this)===0}with(t){$(this,Tq);let{years:n=Q(this,aK),months:r=Q(this,oK),weeks:i=Q(this,sK),days:a=Q(this,cK),hours:o=Q(this,lK),minutes:s=Q(this,uK),seconds:c=Q(this,dK),milliseconds:l=Q(this,fK),microseconds:u=Q(this,pK),nanoseconds:d=Q(this,mK)}=Gq(t);return new e(n,r,i,a,o,s,c,l,u,d)}negated(){return $(this,Tq),VY(this)}abs(){return $(this,Tq),new e(Math.abs(Q(this,aK)),Math.abs(Q(this,oK)),Math.abs(Q(this,sK)),Math.abs(Q(this,cK)),Math.abs(Q(this,lK)),Math.abs(Q(this,uK)),Math.abs(Q(this,dK)),Math.abs(Q(this,fK)),Math.abs(Q(this,pK)),Math.abs(Q(this,mK)))}add(e){return $(this,Tq),EX(`add`,this,e)}subtract(e){return $(this,Tq),EX(`subtract`,this,e)}round(e){if($(this,Tq),e===void 0)throw TypeError(`options parameter is required`);let t=oJ(this),n=typeof e==`string`?XX(`smallestUnit`,e):YX(e),r=iJ(n,`largestUnit`,`datetime`,void 0,[`auto`]),{plainRelativeTo:i,zonedRelativeTo:a}=aJ(n),o=$q(n),s=Xq(n,`halfExpand`),c=iJ(n,`smallestUnit`,`datetime`,void 0),l=!0;c||=(l=!1,`nanosecond`);let u=sJ(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(sJ(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&&eJ(o,f,!1),o>1&&lJ(c)===`date`&&r!==c)throw RangeError(`For calendar units with roundingIncrement > 1, use largestUnit = smallestUnit`);if(a){let e=eX(this),t=Q(a,iK),n=Q(a,eK),i=Q(a,XG);return e=hX(i,TX(i,t,n,e),t,n,r,o,c,s),lJ(r)===`date`&&(r=`hour`),rX(e,r)}if(i){let e=tX(this),t=CX({deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},e.time),n=Q(i,ZG),a=Q(i,eK),l=HJ(a,n,Kq(e.date,t.deltaDays),`constrain`);return e=mX(qq(n,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),qq(l,t),a,r,o,c,s),rX(e,r)}if(cJ(t))throw RangeError(`a starting point is required for ${t}s balancing`);if(cJ(r))throw RangeError(`a starting point is required for ${r}s balancing`);let p=tX(this);if(c===`day`){let{quotient:e,remainder:t}=p.time.divmod(eq),n=p.date.days+e+RX(t,`day`);n=NX(n,o,s),p=iX({years:0,months:0,weeks:0,days:n},HK.ZERO)}else p=iX({years:0,months:0,weeks:0,days:0},LX(p.time,o,c,s));return rX(p,r)}total(e){if($(this,Tq),e===void 0)throw TypeError(`options argument is required`);let t=typeof e==`string`?XX(`unit`,e):YX(e),{plainRelativeTo:n,zonedRelativeTo:r}=aJ(t),i=iJ(t,`unit`,`datetime`,rJ);if(r){let e=eX(this),t=Q(r,iK),n=Q(r,eK),a=Q(r,XG);return function(e,t,n,r,i){return lJ(i)===`time`?RX(HK.fromEpochNsDiff(t,e),i):pX(uX(e,t,n,r,i),t,eY(n,e),n,r,i)}(a,TX(a,t,n,e),t,n,i)}if(n){let e=tX(this),t=CX({deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},e.time),r=Q(n,ZG),a=Q(n,eK),o=HJ(a,r,Kq(e.date,t.deltaDays),`constrain`);return function(e,t,n,r){if(VX(e,t)==0)return 0;YY(e),YY(t);let i=lX(e,t,n,r);return r===`nanosecond`?Z.default.toNumber(i.time.totalNs):pX(i,EY(t),e,null,n,r)}(qq(r,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),qq(o,t),a,i)}let a=oJ(this);if(cJ(a))throw RangeError(`a starting point is required for ${a}s total`);if(cJ(i))throw RangeError(`a starting point is required for ${i}s total`);return RX(tX(this).time,i)}toString(e=void 0){$(this,Tq);let t=YX(e),n=tJ(t),r=Xq(t,`trunc`),i=iJ(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}=nJ(i,n);if(o===`nanosecond`&&s===1)return uY(this,a);let c=oJ(this),l=eX(this),u=LX(l.time,s,o,r);return l=iX(l.date,u),uY(rX(l,sJ(c,`second`)),a)}toJSON(){return $(this,Tq),uY(this,`auto`)}toLocaleString(e=void 0,t=void 0){if($(this,Tq),typeof Intl.DurationFormat==`function`){let n=new Intl.DurationFormat(e,t);return FZ.call(n,this)}return console.warn(`Temporal.Duration.prototype.toLocaleString() requires Intl.DurationFormat.`),uY(this,`auto`)}valueOf(){eZ(`Duration`)}static from(e){return vJ(e)}static compare(e,t,n=void 0){let r=vJ(e),i=vJ(t),{plainRelativeTo:a,zonedRelativeTo:o}=aJ(YX(n));if(Q(r,aK)===Q(i,aK)&&Q(r,oK)===Q(i,oK)&&Q(r,sK)===Q(i,sK)&&Q(r,cK)===Q(i,cK)&&Q(r,lK)===Q(i,lK)&&Q(r,uK)===Q(i,uK)&&Q(r,dK)===Q(i,dK)&&Q(r,fK)===Q(i,fK)&&Q(r,pK)===Q(i,pK)&&Q(r,mK)===Q(i,mK))return 0;let s=oJ(r),c=oJ(i),l=eX(r),u=eX(i);if(o&&(lJ(s)===`date`||lJ(c)===`date`)){let e=Q(o,iK),t=Q(o,eK),n=Q(o,XG),r=TX(n,e,t,l),i=TX(n,e,t,u);return JX(Z.default.toNumber(Z.default.subtract(r,i)))}let d=l.date.days,f=u.date.days;if(cJ(s)||cJ(c)){if(!a)throw RangeError(`A starting point is required for years, months, or weeks comparison`);d=BY(l.date,a),f=BY(u.date,a)}let p=l.time.add24HourDays(d),m=u.time.add24HourDays(f);return p.cmp(m)}};FK(HZ,`Temporal.Duration`);var UZ=class{constructor(e,t,n=`iso8601`,r=1972){let i=uq(e),a=uq(t),o=QX(n===void 0?`iso8601`:mq(n)),s=uq(r);GY(s,i,a),AJ(this,{year:s,month:i,day:a},o)}get monthCode(){return WZ(this,`monthCode`)}get day(){return WZ(this,`day`)}get calendarId(){return $(this,Aq),Q(this,eK)}with(e,t=void 0){if($(this,Aq),!sq(e))throw TypeError(`invalid argument`);Mq(e);let n=Q(this,eK),r=fJ(n,Q(this,ZG),`month-day`);return r=VJ(n,r,pJ(n,e,[`year`,`month`,`monthCode`,`day`],[],`partial`)),jJ(YJ(n,r,Jq(YX(t))),n)}equals(e){$(this,Aq);let t=bJ(e);return zX(Q(this,ZG),Q(t,ZG))===0&&KJ(Q(this,eK),Q(t,eK))}toString(e=void 0){return $(this,Aq),mY(this,Qq(YX(e)))}toJSON(){return $(this,Aq),mY(this)}toLocaleString(e=void 0,t=void 0){return $(this,Aq),new TZ(e,t).format(this)}valueOf(){eZ(`PlainMonthDay`)}toPlainDate(e){if($(this,Aq),!sq(e))throw TypeError(`argument should be an object`);let t=Q(this,eK);return DJ(qJ(t,VJ(t,fJ(t,Q(this,ZG),`month-day`),pJ(t,e,[`year`],[],[])),`constrain`),t)}static from(e,t=void 0){return bJ(e,t)}};function WZ(e,t){$(e,Aq);let n=Q(e,ZG);return dJ(e).isoToDate(n,{[t]:!0})[t]}function GZ(e){return eY(e,KX())}FK(UZ,`Temporal.PlainMonthDay`);var KZ={instant:()=>LJ(KX()),plainDateTimeISO:(e=qX())=>kJ(GZ(XJ(e)),`iso8601`),plainDateISO:(e=qX())=>DJ(GZ(XJ(e)).isoDate,`iso8601`),plainTimeISO:(e=qX())=>NJ(GZ(XJ(e)).time),timeZoneId:()=>qX(),zonedDateTimeISO:(e=qX())=>{let t=XJ(e);return zJ(KX(),t,`iso8601`)},[Symbol.toStringTag]:`Temporal.Now`};Object.defineProperty(KZ,Symbol.toStringTag,{value:`Temporal.Now`,writable:!1,enumerable:!1,configurable:!0});var qZ=class e{constructor(e=0,t=0,n=0,r=0,i=0,a=0){let o=e===void 0?0:uq(e),s=t===void 0?0:uq(t),c=n===void 0?0:uq(n),l=r===void 0?0:uq(r),u=i===void 0?0:uq(i),d=a===void 0?0:uq(a);qY(o,s,c,l,u,d),MJ(this,{hour:o,minute:s,second:c,millisecond:l,microsecond:u,nanosecond:d})}get hour(){return $(this,Dq),Q(this,$G).hour}get minute(){return $(this,Dq),Q(this,$G).minute}get second(){return $(this,Dq),Q(this,$G).second}get millisecond(){return $(this,Dq),Q(this,$G).millisecond}get microsecond(){return $(this,Dq),Q(this,$G).microsecond}get nanosecond(){return $(this,Dq),Q(this,$G).nanosecond}with(t,n=void 0){if($(this,Dq),!sq(t))throw TypeError(`invalid argument`);Mq(t);let r=mJ(t,`partial`),i=mJ(this),{hour:a,minute:o,second:s,millisecond:c,microsecond:l,nanosecond:u}=Object.assign(i,r),d=Jq(YX(n));return{hour:a,minute:o,second:s,millisecond:c,microsecond:l,nanosecond:u}=Wq(a,o,s,c,l,u,d),new e(a,o,s,c,l,u)}add(e){return $(this,Dq),AX(`add`,this,e)}subtract(e){return $(this,Dq),AX(`subtract`,this,e)}until(e,t=void 0){return $(this,Dq),bX(`until`,this,e,t)}since(e,t=void 0){return $(this,Dq),bX(`since`,this,e,t)}round(e){if($(this,Dq),e===void 0)throw TypeError(`options parameter is required`);let t=typeof e==`string`?XX(`smallestUnit`,e):YX(e),n=$q(t),r=Xq(t,`halfExpand`),i=iJ(t,`smallestUnit`,`time`,rJ);return eJ(n,{hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[i],!1),NJ(IX(Q(this,$G),n,i,r))}equals(e){$(this,Dq);let t=xJ(e);return BX(Q(this,$G),Q(t,$G))===0}toString(e=void 0){$(this,Dq);let t=YX(e),n=tJ(t),r=Xq(t,`trunc`),i=iJ(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}=nJ(i,n);return fY(IX(Q(this,$G),s,o,r),a)}toJSON(){return $(this,Dq),fY(Q(this,$G),`auto`)}toLocaleString(e=void 0,t=void 0){return $(this,Dq),new TZ(e,t).format(this)}valueOf(){eZ(`PlainTime`)}static from(e,t=void 0){return xJ(e,t)}static compare(e,t){let n=xJ(e),r=xJ(t);return BX(Q(n,$G),Q(r,$G))}};FK(qZ,`Temporal.PlainTime`);var JZ=class{constructor(e,t,n=`iso8601`,r=1){let i=uq(e),a=uq(t),o=QX(n===void 0?`iso8601`:mq(n)),s=uq(r);GY(i,a,s),PJ(this,{year:i,month:a,day:s},o)}get year(){return YZ(this,`year`)}get month(){return YZ(this,`month`)}get monthCode(){return YZ(this,`monthCode`)}get calendarId(){return $(this,kq),Q(this,eK)}get era(){return YZ(this,`era`)}get eraYear(){return YZ(this,`eraYear`)}get daysInMonth(){return YZ(this,`daysInMonth`)}get daysInYear(){return YZ(this,`daysInYear`)}get monthsInYear(){return YZ(this,`monthsInYear`)}get inLeapYear(){return YZ(this,`inLeapYear`)}with(e,t=void 0){if($(this,kq),!sq(e))throw TypeError(`invalid argument`);Mq(e);let n=Q(this,eK),r=fJ(n,Q(this,ZG),`year-month`);return r=VJ(n,r,pJ(n,e,[`year`,`month`,`monthCode`],[],`partial`)),FJ(JJ(n,r,Jq(YX(t))),n)}add(e,t=void 0){return $(this,kq),jX(`add`,this,e,t)}subtract(e,t=void 0){return $(this,kq),jX(`subtract`,this,e,t)}until(e,t=void 0){return $(this,kq),xX(`until`,this,e,t)}since(e,t=void 0){return $(this,kq),xX(`since`,this,e,t)}equals(e){$(this,kq);let t=CJ(e);return zX(Q(this,ZG),Q(t,ZG))===0&&KJ(Q(this,eK),Q(t,eK))}toString(e=void 0){return $(this,kq),hY(this,Qq(YX(e)))}toJSON(){return $(this,kq),hY(this)}toLocaleString(e=void 0,t=void 0){return $(this,kq),new TZ(e,t).format(this)}valueOf(){eZ(`PlainYearMonth`)}toPlainDate(e){if($(this,kq),!sq(e))throw TypeError(`argument should be an object`);let t=Q(this,eK);return DJ(qJ(t,VJ(t,fJ(t,Q(this,ZG),`year-month`),pJ(t,e,[`day`],[],[])),`constrain`),t)}static from(e,t=void 0){return CJ(e,t)}static compare(e,t){let n=CJ(e),r=CJ(t);return zX(Q(n,ZG),Q(r,ZG))}};function YZ(e,t){$(e,kq);let n=Q(e,ZG);return dJ(e).isoToDate(n,{[t]:!0})[t]}FK(JZ,`Temporal.PlainYearMonth`);var fbe=TZ.prototype.resolvedOptions,XZ=class{constructor(e,t,n=`iso8601`){if(arguments.length<1)throw TypeError(`missing argument: epochNanoseconds is required`);let r=GX(e),i=mq(t),{tzName:a,offsetMinutes:o}=Hq(i);if(o===void 0){let e=bY(a);if(!e)throw RangeError(`unknown time zone ${a}`);i=e.identifier}else i=CY(o);RJ(this,r,i,QX(n===void 0?`iso8601`:mq(n)))}get calendarId(){return $(this,jq),Q(this,eK)}get timeZoneId(){return $(this,jq),Q(this,iK)}get year(){return QZ(this,`year`)}get month(){return QZ(this,`month`)}get monthCode(){return QZ(this,`monthCode`)}get day(){return QZ(this,`day`)}get hour(){return $Z(this,`hour`)}get minute(){return $Z(this,`minute`)}get second(){return $Z(this,`second`)}get millisecond(){return $Z(this,`millisecond`)}get microsecond(){return $Z(this,`microsecond`)}get nanosecond(){return $Z(this,`nanosecond`)}get era(){return QZ(this,`era`)}get eraYear(){return QZ(this,`eraYear`)}get epochMilliseconds(){return $(this,jq),UX(Q(this,XG),`floor`)}get epochNanoseconds(){return $(this,jq),HX(Q(this,XG))}get dayOfWeek(){return QZ(this,`dayOfWeek`)}get dayOfYear(){return QZ(this,`dayOfYear`)}get weekOfYear(){return QZ(this,`weekOfYear`)?.week}get yearOfWeek(){return QZ(this,`weekOfYear`)?.year}get hoursInDay(){$(this,jq);let e=Q(this,iK),t=ZZ(this).isoDate,n=LY(t.year,t.month,t.day+1),r=iY(e,t),i=iY(e,n);return RX(HK.fromEpochNsDiff(i,r),`hour`)}get daysInWeek(){return QZ(this,`daysInWeek`)}get daysInMonth(){return QZ(this,`daysInMonth`)}get daysInYear(){return QZ(this,`daysInYear`)}get monthsInYear(){return QZ(this,`monthsInYear`)}get inLeapYear(){return QZ(this,`inLeapYear`)}get offset(){return $(this,jq),$J(QJ(Q(this,iK),Q(this,XG)))}get offsetNanoseconds(){return $(this,jq),QJ(Q(this,iK),Q(this,XG))}with(e,t=void 0){if($(this,jq),!sq(e))throw TypeError(`invalid zoned-date-time-like`);Mq(e);let n=Q(this,eK),r=Q(this,iK),i=QJ(r,Q(this,XG)),a=ZZ(this),o={...fJ(n,a.isoDate),...a.time,offset:$J(i)};o=VJ(n,o,pJ(n,e,[`year`,`month`,`monthCode`,`day`],[`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`,`offset`],`partial`));let s=YX(t),c=Yq(s),l=Zq(s,`prefer`),u=gJ(n,o,Jq(s)),d=vY(o.offset);return zJ(wJ(u.isoDate,u.time,`option`,d,r,c,l,!1),r,n)}withPlainTime(e=void 0){$(this,jq);let t=Q(this,iK),n=Q(this,eK),r=ZZ(this).isoDate,i;return i=e===void 0?iY(t,r):tY(t,qq(r,Q(xJ(e),$G)),`compatible`),zJ(i,t,n)}withTimeZone(e){$(this,jq);let t=XJ(e);return zJ(Q(this,XG),t,Q(this,eK))}withCalendar(e){$(this,jq);let t=WJ(e);return zJ(Q(this,XG),Q(this,iK),t)}add(e,t=void 0){return $(this,jq),MX(`add`,this,e,t)}subtract(e,t=void 0){return $(this,jq),MX(`subtract`,this,e,t)}until(e,t=void 0){return $(this,jq),SX(`until`,this,e,t)}since(e,t=void 0){return $(this,jq),SX(`since`,this,e,t)}round(e){if($(this,jq),e===void 0)throw TypeError(`options parameter is required`);let t=typeof e==`string`?XX(`smallestUnit`,e):YX(e),n=$q(t),r=Xq(t,`halfExpand`),i=iJ(t,`smallestUnit`,`time`,rJ,[`day`]),a={day:1,hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[i];if(eJ(n,a,a===1),i===`nanosecond`&&n===1)return zJ(Q(this,XG),Q(this,iK),Q(this,eK));let o=Q(this,iK),s=Q(this,XG),c=ZZ(this),l;if(i===`day`){let e=c.isoDate,t=LY(e.year,e.month,e.day+1),n=iY(o,e),i=iY(o,t),a=Z.default.subtract(i,n);l=HK.fromEpochNsDiff(s,n).round(a,r).addToEpochNs(n)}else{let e=FX(c,n,i,r),t=QJ(o,s);l=wJ(e.isoDate,e.time,`option`,t,o,`compatible`,`prefer`,!1)}return zJ(l,o,Q(this,eK))}equals(e){$(this,jq);let t=TJ(e),n=Q(this,XG),r=Q(t,XG);return!!Z.default.equal(Z.default.BigInt(n),Z.default.BigInt(r))&&!!ZJ(Q(this,iK),Q(t,iK))&&KJ(Q(this,eK),Q(t,eK))}toString(e=void 0){$(this,jq);let t=YX(e),n=Qq(t),r=tJ(t),i=function(e){return ZX(e,`offset`,[`auto`,`never`],`auto`)}(t),a=Xq(t,`trunc`),o=iJ(t,`smallestUnit`,`time`,void 0);if(o===`hour`)throw RangeError(`smallestUnit must be a time unit other than "hour"`);let s=function(e){return ZX(e,`timeZoneName`,[`auto`,`never`,`critical`],`auto`)}(t),{precision:c,unit:l,increment:u}=nJ(o,r);return gY(this,c,n,s,i,{unit:l,increment:u,roundingMode:a})}toLocaleString(e=void 0,t=void 0){$(this,jq);let n=YX(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,iK),_Y(r.timeZone))throw RangeError(`toLocaleString does not currently support offset time zones`);let i=new TZ(e,r),a=fbe.call(i).calendar,o=Q(this,eK);if(o!==`iso8601`&&a!==`iso8601`&&!KJ(a,o))throw RangeError(`cannot format ZonedDateTime with calendar ${o} in locale with calendar ${a}`);return i.format(LJ(Q(this,XG)))}toJSON(){return $(this,jq),gY(this,`auto`)}valueOf(){eZ(`ZonedDateTime`)}startOfDay(){$(this,jq);let e=Q(this,iK);return zJ(iY(e,ZZ(this).isoDate),e,Q(this,eK))}getTimeZoneTransition(e){$(this,jq);let t=Q(this,iK);if(e===void 0)throw TypeError(`options parameter is required`);let n=ZX(typeof e==`string`?XX(`direction`,e):YX(e),`direction`,[`next`,`previous`],rJ);if(n===void 0)throw TypeError(`direction option is required`);if(_Y(t)||t===`UTC`)return null;let r=Q(this,XG),i=n===`next`?OY(t,r):kY(t,r);return i===null?null:zJ(i,t,Q(this,eK))}toInstant(){return $(this,jq),LJ(Q(this,XG))}toPlainDate(){return $(this,jq),DJ(ZZ(this).isoDate,Q(this,eK))}toPlainTime(){return $(this,jq),NJ(ZZ(this).time)}toPlainDateTime(){return $(this,jq),kJ(ZZ(this),Q(this,eK))}static from(e,t=void 0){return TJ(e,t)}static compare(e,t){let n=TJ(e),r=TJ(t),i=Q(n,XG),a=Q(r,XG);return Z.default.lessThan(Z.default.BigInt(i),Z.default.BigInt(a))?-1:+!!Z.default.greaterThan(Z.default.BigInt(i),Z.default.BigInt(a))}};function ZZ(e){return eY(Q(e,iK),Q(e,XG))}function QZ(e,t){$(e,jq);let n=ZZ(e).isoDate;return dJ(e).isoToDate(n,{[t]:!0})[t]}function $Z(e,t){return $(e,jq),ZZ(e).time[t]}FK(XZ,`Temporal.ZonedDateTime`);var pbe=Object.freeze({__proto__:null,Duration:HZ,Instant:IZ,Now:KZ,PlainDate:LZ,PlainDateTime:zZ,PlainMonthDay:UZ,PlainTime:qZ,PlainYearMonth:JZ,ZonedDateTime:XZ});(class{toTemporalInstant(){return LJ(WX(Date.prototype.valueOf.call(this)))}}).prototype.toTemporalInstant;var mbe=[IZ,LZ,zZ,HZ,UZ,qZ,JZ,XZ];for(let e of mbe){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 hbe(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 gbe(e,t){return hbe(new Date(e),t)}function _be(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=pbe.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 eQ(e,t){return new Intl.DateTimeFormat(void 0,{timeZone:t,dateStyle:`medium`,timeStyle:`short`}).format(new Date(e))}function vbe(e,t){return new Intl.DateTimeFormat(void 0,{timeZone:t,year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,timeZoneName:`short`}).format(new Date(e))}var tQ={"claude-code":{name:`Claude Code`,command:`claude auth login`},codex:{name:`Codex`,command:`codex login`},gemini:{name:`Gemini`,command:`gemini`}},ybe=/not signed in|sign-in has expired|not logged in|run\s+"?(?:codex login|claude auth login)|authentication required/i,bbe=/ENOSPC|no space left on device|disk (?:is )?full|not enough (?:free )?(?:disk )?space/i,xbe=/refused to make|content (?:rules|policy|filter)|safety (?:system|filter)|flagged|moderation/i,Sbe=/\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,Cbe=/did not accept the API key|API key is saved|invalid api key|key may be wrong/i,wbe=[`images`,`thumbnail`],Tbe=/^Short \d+ image \d+:/;function nQ(e){let t=e.reason??``,n=Ebe(e.provider,t);if(n!==void 0&&(ybe.test(t)||e.kind===`auth`))return{kind:`sign-in`,label:`Sign in to ${tQ[n].name}`,cli:n,command:tQ[n].command};if(bbe.test(t))return{kind:`free-space`,label:`Free space`};if(e.kind===`refusal`||xbe.test(t))return wbe.includes(e.stage)||e.stage===`video`&&Tbe.test(t)?{kind:`refused`,label:`Soften and retry`,soften:!0}:{kind:`refused`,label:`Edit the prompt`,soften:!1};if(Sbe.test(t))return{kind:`switch-model`,label:`Switch model`};if(e.kind===`auth`||e.kind===`missing_key`||Cbe.test(t)){let t=Dbe(e.provider);return{kind:`provider-settings`,label:t===void 0?`Open Settings → Providers`:`Open Settings → Providers → ${t}`,provider:e.provider??``}}}function Ebe(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 Dbe(e){return KA.find(t=>t.id===e)?.displayName}function Obe(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}}function kbe(e){let t=e.topics.error;if(t!==null)return nQ({stage:`article`,reason:t,provider:e.topicGeneration.llm?.provider})}function rQ({schedule:e,title:t,retry:n,className:r}){if(e.topics.error===null)return null;let i=kbe(e);return(0,h.jsx)(GM,{tone:`danger`,title:t,...r===void 0?{}:{className:r},...i===void 0?{}:{actions:(0,h.jsx)(Wz,{fix:i,retry:n,variant:`secondary`,size:`small`})},children:e.topics.error})}var iQ=e=>e.length===1?`“${e[0]?.title??``}”`:PG(e.length,`topic`,`topics`);function Abe({schedule:e}){let{api:t}=V(),n=_(),[r,i]=(0,m.useState)(null),a=wv(),[o,s]=(0,m.useState)(null),[c,l]=(0,m.useState)(!1),u=e.deletedAt===null&&(e.status===`active`||e.status===`paused`),d=I({queryKey:[...vT(e.id),e.topics.held,e.topics.generatedAt],enabled:u&&e.topicGeneration.mode===`hold`,queryFn:async()=>{let n=await yT(t,e.id);if(!n.ok)throw Error(n.message);return n.value}}),f=I({queryKey:[`project-template`,e.templateId],enabled:u&&e.topicGeneration.mode===`hold`,queryFn:async()=>{let n=await wO(t,e.templateId);if(!n.ok)throw Error(n.message);return n.value}}).data?.document.form,p=(f===void 0?[]:gG(f)).filter(t=>t!==e.topicKeyword),g=t=>e.values[t]??f?.values[t]??``,v=d.data??[],y=AG(v.map(e=>e.id)),b=L({mutationFn:e=>e(),onSuccess:e=>{i(e.ok?null:e.message),e.ok&&s(null)},onError:e=>i(e.message),onSettled:async()=>{await Promise.all([n.invalidateQueries({queryKey:pT}),n.invalidateQueries({queryKey:vT(e.id)}),n.invalidateQueries({queryKey:ET})])}}),x=b.isPending,S=(e,t)=>b.mutate(e,{onSuccess:e=>{e.ok&&t!==void 0&&(y.clear(),a(t.message,`success`,t.undo===void 0?void 0:{label:`Undo`,run:t.undo}))}}),C=n=>S(()=>Sce(t,e.id,n.map(e=>e.id)),{message:`Turned down ${iQ(n)}. Later generations won't suggest ${n.length===1?`it`:`them`} again.`,undo:()=>S(()=>Cce(t,e.id,n),{message:`${iQ(n)} ${n.length===1?`is`:`are`} waiting again.`})}),w=n=>S(()=>n.length===1&&n[0]!==void 0?ST(t,e.id,n[0].id):xce(t,e.id,n.map(e=>e.id)),{message:`Approved ${iQ(n)}: added to the end of the queue.`}),T=v.filter(e=>y.has(e.id));if(!u||e.topicGeneration.mode===`off`)return null;let{topics:E}=e;return(0,h.jsxs)(`section`,{"aria-label":`Topic generation`,children:[(0,h.jsx)(kG,{className:`my-6`}),(0,h.jsxs)(Sy,{as:`h3`,title:`Topic generation`,meta:`${E.generatingSince===null?E.generatedAt===null?`No topics generated yet.`:`Topics last generated ${vbe(E.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)(U,{id:`planning.schedule.generate-now`}),(0,h.jsx)(B,{disabled:x||E.generatingSince!==null,disabledReason:`Topics are being generated now`,onClick:()=>b.mutate(()=>xT(t,e.id)),children:`Generate topics now`})]}),(0,h.jsx)(rQ,{schedule:e,title:`The last topic generation failed.`,className:`mt-3`,retry:{run:()=>b.mutate(()=>xT(t,e.id)),busy:x||E.generatingSince!==null}}),r===null?null:(0,h.jsx)(GM,{tone:`danger`,title:`That didn't work.`,className:`mt-3`,children:r}),e.topicGeneration.mode===`hold`?(0,h.jsxs)(`div`,{className:`mt-4`,...xy,children:[(0,h.jsxs)(Sy,{as:`h3`,title:`Topics waiting · ${String(v.length)}`,info:`planning.schedule.held`,children:[(0,h.jsx)(B,{variant:`primary`,disabled:x||v.length===0,disabledReason:`Nothing is waiting`,onClick:()=>S(()=>CT(t,e.id),{message:`Approved ${iQ(v)}: added to the end of the queue.`}),children:`Approve all`}),(0,h.jsx)(B,{variant:`quiet`,disabled:x||v.length===0,disabledReason:`Nothing is waiting`,onClick:()=>l(!0),children:`Reject all`})]}),d.error?(0,h.jsx)(`p`,{className:`m-0 mt-2 text-small text-danger`,children:`The waiting topics couldn't be loaded: ${d.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.jsxs)(`div`,{onKeyDown:y.onKeyDown,children:[v.length>1?(0,h.jsx)(NG,{className:`mt-2`,selection:y,total:v.length,noun:[`topic waiting`,`topics waiting`],actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(B,{size:`small`,disabled:x||T.length===0,disabledReason:`Tick the topics to approve`,onClick:()=>w(T),children:`Approve selected`}),(0,h.jsx)(B,{size:`small`,variant:`quiet`,disabled:x||T.length===0,disabledReason:`Tick the topics to turn down`,onClick:()=>C(T),children:`Reject selected`})]})}):null,(0,h.jsx)(mR,{label:`Topics waiting`,className:`mt-2 [&_.sl-row__actions]:flex-wrap`,children:v.map(n=>(0,h.jsx)(sye,{topic:n,editing:o?.id===n.id?o:void 0,keywords:p,everyRun:g,busy:x,selection:y,onEdit:s,onCancel:()=>s(null),onSave:()=>{o!==null&&b.mutate(()=>Tce(t,e.id,n.id,o.title.trim(),Object.fromEntries(Object.entries(o.values).filter(([,e])=>e.trim()!==``))))},onApprove:()=>w([n]),onReject:()=>C([n])},n.id))})]}),(0,h.jsx)(Bv,{open:c,title:`Reject all ${PG(v.length,`waiting topic`,`waiting topics`)}?`,consequence:`Turns down the ${PG(v.length,`topic`,`topics`)} waiting for ${e.name} now (topics generated after this list was shown are not included). Later generations won't suggest them again; Undo in the message that follows brings them back.`,confirmLabel:`Reject ${PG(v.length,`topic`,`topics`)}`,cancelLabel:`Keep them waiting`,pending:x,onCancel:()=>l(!1),onConfirm:()=>{l(!1),C(v)}})]}):null]})}function aQ(e){return e.filter(e=>e.deletedAt===null&&e.topicGeneration.mode!==`off`&&(e.status===`active`||e.status===`paused`))}function jbe({schedules:e}){let t=aQ(e),n=e.filter(e=>e.deletedAt===null&&(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)(Sy,{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`,{className:`flex flex-wrap gap-x-3 gap-y-1`,children:n.length===0?(0,h.jsx)(RO,{to:`/calendar`,search:{tab:`schedules`},children:`Open schedules`}):n.slice(0,4).map(e=>(0,h.jsxs)(RO,{to:`/calendar`,search:{tab:`schedules`,schedule:e.id},children:[`Open `,e.name]},e.id))})]}):t.map((e,t)=>(0,h.jsx)(Mbe,{schedule:e,first:t===0},e.id))})}function Mbe({schedule:e,first:t}){let{api:n}=V(),r=_(),i=wv(),a=I({queryKey:[...vT(e.id),e.topics.held,e.version],queryFn:async()=>{let t=await yT(n,e.id);if(!t.ok)throw Error(t.message);return t.value},enabled:e.topics.held>0}),o=L({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:pT}),r.invalidateQueries({queryKey:ET}),r.invalidateQueries({queryKey:vT(e.id)})])}}),s=e.topics.held>0?a.data??[]:[],c=()=>o.mutate(()=>CT(n,e.id));Xy({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)(Sy,{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)(B,{size:`small`,variant:`secondary`,disabled:o.isPending,onClick:c,children:`Queue all ${String(s.length)}`}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(U,{id:`planning.schedule.generate-now`,label:`Suggest topics now`}),(0,h.jsx)(B,{size:`small`,variant:`quiet`,disabled:o.isPending||l,disabledReason:l?`Slopify is suggesting topics now.`:`Working…`,onClick:()=>o.mutate(()=>xT(n,e.id)),children:l?`Suggesting…`:`Suggest topics now`})]})}),(0,h.jsx)(rQ,{schedule:e,title:`The last suggestion failed.`,retry:{run:()=>o.mutate(()=>xT(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)(mR,{label:`Suggestions for ${e.name}`,children:s.map(t=>(0,h.jsx)(hR,{title:t.title,meta:FG(t.values),actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(B,{size:`small`,variant:`quiet`,disabled:o.isPending,onClick:()=>o.mutate(()=>ST(n,e.id,t.id)),"aria-label":`Queue ${t.title}`,children:`Queue`}),(0,h.jsx)(bv,{size:`small`,label:`Reject ${t.title}`,disabled:o.isPending,onClick:()=>o.mutate(()=>wce(n,e.id,t.id)),children:(0,h.jsx)(kl,{"aria-hidden":`true`,strokeWidth:1.75})})]})},t.id))}),(0,h.jsx)(GM,{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.`})]})}function Nbe(e,t){if(e.kind===`move`)return{kind:`move`,scheduleId:e.scheduleId,baseVersion:t.source.version,from:e.to,to:e.from};let n=t.target??t.source;return{kind:`transfer`,scheduleId:e.targetId,baseVersion:n.version,index:e.position??n.items.length-1,targetId:e.scheduleId,position:e.index}}function Pbe(e,t){if(t.kind!==`move`)return e;let n=e.runs.filter(e=>e.scheduleId===t.scheduleId&&e.index!==null).toSorted((e,t)=>(e.index??0)-(t.index??0)),r=n.map(Fbe),[i]=r.splice(t.from,1);if(i===void 0)return e;r.splice(t.to,0,i);let a=new Map(n.map((e,t)=>[e,r[t]]));return{...e,runs:e.runs.map(e=>{let t=a.get(e);return t===void 0?e:{...e,...t}})}}function Fbe(e){return{topic:e.topic,topicSource:e.topicSource,renderedTitle:e.renderedTitle,prepared:e.prepared}}function Ibe(e,t){let{api:n}=V(),r=_(),i=wv(),a=L({mutationFn:async({drop:e})=>{if(e.kind===`move`){let t=await wT(n,e.scheduleId,{baseVersion:e.baseVersion,from:e.from,to:e.to});return t.ok?{ok:!0,value:{source:t.value}}:t}return Ece(n,e.scheduleId,{baseVersion:e.baseVersion,index:e.index,targetId:e.targetId,...e.position===void 0?{}:{position:e.position}})},onMutate:async({drop:n})=>{await r.cancelQueries({queryKey:e});let i=r.getQueryData(e);return i!==void 0&&r.setQueryData(e,Pbe(i,n)),t(null),{before:i}},onSuccess:(n,o,s)=>{if(!n.ok){s.before!==void 0&&r.setQueryData(e,s.before),t(`${o.title} wasn't moved: ${n.message} The calendar shows where it is now; move it again if you still want to.`);return}if(o.undo===!0){i(`${o.title} is back where it was.`,`success`);return}i(`Moved ${o.title} to ${o.where}.`,`success`,{label:`Undo`,run:()=>a.mutate({drop:Nbe(o.drop,n.value),title:o.title,where:``,undo:!0})})},onError:(n,i,a)=>{a?.before!==void 0&&r.setQueryData(e,a.before),t(`${i.title} wasn't moved: ${n.message} The calendar has been read again; try the move once more.`)},onSettled:async()=>{await Promise.all([r.invalidateQueries({queryKey:ET}),r.invalidateQueries({queryKey:pT})])}});return a}var oQ=[`trash`];async function sQ(e){return(await R(await e.client.trash.$get())).items}async function cQ(e,t,n){return(await R(await e.client.trash[`:kind`][`:id`].restore.$post({param:{kind:t,id:n}}))).restored}async function Lbe(e,t,n){let r=await e.client.trash[`:kind`][`:id`].$delete({param:{kind:t,id:n}});if(!r.ok)throw await fo(r)}async function lQ(e,t){return R(await e.client.trash.bulk.restore.$post({json:{items:[...t]}}))}async function Rbe(e,t){return R(await e.client.trash.bulk.delete.$post({json:{items:[...t]}}))}var uQ=[`batch-queue`];function zbe(){let{api:e}=V(),t=I({queryKey:uQ,queryFn:async()=>R(await e.fetch(`${e.origin}/api/projects/queue`)),refetchInterval:2e3,retry:!1}),n=I(iy(e)),r=t.data?.queue.length,i=r===void 0?t.error===null?`…`:`?`:String(r);return(0,h.jsxs)(vy,{children:[(0,h.jsx)(yy,{asChild:!0,children:(0,h.jsxs)(B,{variant:`quiet`,disabled:r===0&&t.error===null,disabledReason:`Nothing is queued`,"aria-label":r===void 0?t.error===null?`Video queue: loading`:`Video queue: didn't load`:`Video queue: ${String(r)} remaining`,children:[(0,h.jsx)(il,{"aria-hidden":`true`,className:`size-4`}),(0,h.jsxs)(`span`,{className:`tabular-nums`,children:[`Queue · `,i]})]})}),(0,h.jsxs)(by,{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:hy(`play.queue`).body}),(0,h.jsx)(`div`,{className:`px-3 py-2 empty:hidden`,children:(0,h.jsx)(JL,{query:t,what:`The video queue`,compact:!0,loading:null,children:()=>null})}),(0,h.jsx)(Bbe,{queue:t.data?.queue??[],projects:n.data?.projects})]})]})}function Bbe({queue:e,projects:t}){let n=e.filter(e=>e.state===`queued`);return(0,h.jsx)(`ol`,{className:`max-h-60 overflow-y-auto px-4 py-2`,children:e.map((e,r)=>{let i=t?.find(t=>t.id===e.projectId),a=i?.title??`Video`;return(0,h.jsxs)(`li`,{className:`flex items-center justify-between gap-2 py-1 text-small`,children:[(0,h.jsxs)(fa,{className:`min-w-0 truncate`,to:`/projects/$projectId`,params:{projectId:e.projectId},children:[r+1,`. `,a]}),(0,h.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-ink-2`,children:[i?.status===`paused`?`Paused`:e.state===`active`?`Active`:`Queued`,e.state===`queued`?(0,h.jsx)(dQ,{projectId:e.projectId,title:a,place:n.indexOf(e),waiting:n.length}):null]})]},e.projectId)})})}function dQ({projectId:e,title:t,place:n,waiting:r}){let{api:i}=V(),a=_(),o=wv(),s=()=>{a.invalidateQueries({queryKey:uQ}),a.invalidateQueries({queryKey:[`projects`]}),a.invalidateQueries({queryKey:[`calendar`]})},c=L({mutationFn:t=>Vbe(i,e,t),onSuccess:s,onError:e=>{s(),o(`${t} wasn't moved: ${e.message}`,`error`)}}),l=L({mutationFn:()=>Po(i,e),onSuccess:()=>{s(),o(`${t} left the queue and is in Settings → Trash.`,`success`,{label:`Undo`,run:()=>void cQ(i,`project`,e).then(s,e=>o(`${t} wasn't put back: ${e.message} Restore it from Settings → Trash.`,`error`))})},onError:e=>o(`${t} wasn't removed: ${e.message}`,`error`)}),u=c.isPending||l.isPending;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(bv,{size:`small`,label:`Move ${t} earlier in the queue`,disabled:u||n<=0,onClick:()=>c.mutate(-1),children:(0,h.jsx)(wc,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(bv,{size:`small`,label:`Move ${t} later in the queue`,disabled:u||n>=r-1,onClick:()=>c.mutate(1),children:(0,h.jsx)(bc,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(bv,{size:`small`,label:`Remove ${t} from the queue`,disabled:u,onClick:()=>l.mutate(),children:(0,h.jsx)(kl,{"aria-hidden":`true`,strokeWidth:1.75})})]})}async function Vbe(e,t,n){return R(await e.fetch(`${e.origin}/api/projects/queue/${encodeURIComponent(t)}/move`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({by:n})}))}var fQ=`sl-tab inline-flex items-center gap-[6px]`;function pQ({items:e,value:t,onChange:n,label:r,idPrefix:i,trailing:a,className:o}){let s=(0,m.useRef)(null);return TG(s,t),(0,h.jsxs)(`div`,{className:z(`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:fQ,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 Hbe({items:e,label:t,className:n}){let r=(0,m.useRef)(null);return TG(r,Va({select:e=>e.pathname})),(0,h.jsx)(`nav`,{ref:r,"aria-label":t,className:z(`sl-tabs min-w-0`,n),children:e.map(e=>(0,h.jsx)(fa,{to:e.to,...e.search?{search:e.search}:{},activeOptions:{exact:!1,includeSearch:!1},className:fQ,activeProps:{"aria-current":`page`},children:e.label},e.to))})}function mQ({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 hQ({title:e,children:t,actions:n,className:r}){return(0,h.jsxs)(`div`,{className:z(`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 gQ(e){return e.channelId??`00000000-0000-4000-8000-000000000001`}function Ube({channelId:e}){let{api:t}=V(),n=_(),r=I(CO(t)),i=I(Ry(t)),a=L({mutationFn:e=>Nre(t,e.templateId,e.channelId),onSettled:()=>Promise.all([n.invalidateQueries({queryKey:yO}),n.invalidateQueries({queryKey:Py})])}),o=(r.data??[]).filter(t=>gQ(t)===e);return(0,h.jsxs)(`div`,{...xy,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)(fa,{to:`/templates`,className:`underline`,children:`Library → Templates`}),`. Move to sends a template and its schedules to another channel.`,` `,(0,h.jsx)(U,{id:`planning.channel.template-move`,className:`-my-1 align-middle`})]}),(0,h.jsx)(WR,{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)(hQ,{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)(mR,{label:`Channel templates`,className:`[&_.sl-row__actions]:flex-wrap`,children:o.map(t=>(0,h.jsx)(hR,{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)(bL,{"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]})}function Wbe({channelId:e}){let{api:t}=V(),n=I(CO(t)),r=I(mT(t)),i=new Set((n.data??[]).filter(t=>gQ(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)(fa,{to:`/calendar`,search:{tab:`schedules`},className:`underline`,children:`Calendar → Schedules`}),`.`]}),(0,h.jsx)(WR,{tone:r.error?`error`:`info`,className:`mb-2`,children:r.error?.message}),r.data&&a.length===0?(0,h.jsx)(hQ,{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)(mR,{label:`Channel schedules`,children:a.map(e=>(0,h.jsx)(hR,{title:(0,h.jsx)(RO,{to:`/calendar`,search:{tab:`schedules`,schedule:e.id},children:e.name}),meta:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(KO,{tone:iR[e.status].tone,children:iR[e.status].word}),` · ${e.nextRunAt===null?`No next run`:`Next run ${eQ(e.nextRunAt,e.timezone)}`} · ${String(e.items.length)} queued`]})},e.id))}):null]})}function _Q(e,t,n){let r=new Intl.NumberFormat(`en-US`),i=e-t,a=`${r.format(e)} of ${r.format(t)} ${n}`;return i>0?`${a}: ${r.format(i)} over the limit, shorten it to save.`:a}function vQ(e){return BE(e)?`script`:`article`}function Gbe(e){let{form:t}=e,n=[],r=[];if(CQ(n,t.title),YE(t)&&CQ(n,xQ(e.prompts,`narration`,t.narrationPrompt??``)),t.sources.article===`generate`&&CQ(n,xQ(e.prompts,vQ(t),t.articlePrompt)),t.sources.audio===`generate`&&(CQ(n,SQ(e.entries,`intro`,t.intro)),CQ(n,SQ(e.entries,`outro`,t.outro))),XE(t)&&CQ(n,xQ(e.prompts,`description`,t.descriptionPrompt??``)),Gk(t)&&(CQ(n,xQ(e.prompts,`shorts`,t.shorts?.prompt??``)),CQ(r,xQ(e.prompts,`image`,t.shorts?.imagePrompt??``))),t.sources.images===`generate`){for(let n of t.imagePrompts)CQ(r,xQ(e.prompts,`image`,n.name));t.reference?.source===`prompt`&&CQ(r,xQ(e.prompts,`image`,t.reference.prompt))}return(t.sources.thumbnail===`from_prompt`||t.sources.thumbnail===`prompt_by_llm`)&&CQ(r,xQ(e.prompts,`thumbnail`,t.thumbnailPrompt)),tye(n,r)}function Kbe(e){let t=Gbe(e),n={form:e.form,entries:e.entries,slots:t.map(e=>e.name),silenceGapSeconds:e.silenceGapSeconds},r=Xk(n),i=Dle({draft:r,staged:zue(e.form.provided),requiredSlots:n.slots}),a=Wk(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:qbe(e.form,a)}}var yQ=`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,removeBreaths,deEss,levelSentences,loudness.videoLufs,loudness.audioFilesLufs`.split(`,`);function qbe(e,t){let n=Jbe(e);if(n!==void 0)return n;if(t.ok)return;let r=[...t.fields].sort((e,t)=>bQ(e.field)-bQ(t.field))[0];return r===void 0?void 0:{field:r.field,hint:Ybe(e,r)}}function Jbe(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),Gk(e)&&n.shortsMusic!==void 0&&r.push(n.shortsMusic),Kk(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 bQ(e){let t=yQ.length;for(let[n,r]of yQ.entries())(e===r||e.startsWith(`${r}.`))&&n<t&&(t=n);return t}function Ybe(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 vQ(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 your text under Article 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 xQ(e,t,n){if(n!==``)return e.find(e=>e.kind===t&&e.name===n)?.body}function SQ(e,t,n){if(n!==``)return e.find(e=>e.category===t&&e.name===n)?.body}function CQ(e,t){t!==void 0&&e.push(t)}function wQ(e){let t=new Map,n=(e,n)=>{if(e)for(let r of dG(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`),YE(r)&&n(xQ(i,`narration`,r.narrationPrompt??``),`Narration Preparation`),r.sources.article===`generate`&&n(xQ(i,vQ(r),r.articlePrompt),`Article`),r.sources.images===`generate`){for(let e of r.imagePrompts)n(xQ(i,`image`,e.name),`Image: ${e.name}`);r.reference?.source===`prompt`&&n(xQ(i,`image`,r.reference.prompt),`Establishing image`)}if((r.sources.thumbnail===`from_prompt`||r.sources.thumbnail===`prompt_by_llm`)&&n(xQ(i,`thumbnail`,r.thumbnailPrompt),`Thumbnail`),r.sources.audio===`generate`)for(let e of[`intro`,`outro`])n(SQ(a,e,r[e]),e===`intro`?`Intro`:`Outro`);return XE(r)&&n(xQ(i,`description`,r.descriptionPrompt??``),`YouTube description`),Gk(r)&&(n(xQ(i,`shorts`,r.shorts?.prompt??``),`Shorts`),n(xQ(i,`image`,r.shorts?.imagePrompt??``),`Shorts images`)),t}var TQ=[`name`,`template`,`once`,`time`,`weekdays`,`timezone`,`spend`,`topics`,`brief`,`generation`],Xbe={name:`schedule-name`,template:`schedule-template`,once:`schedule-once`,time:`schedule-time`,weekdays:`schedule-weekdays`,timezone:`schedule-timezone`,spend:`schedule-spend`,topics:`schedule-topics`,brief:`schedule-brief`,generation:`schedule-generation`},Zbe={name:`Name`,template:`Template`,once:`Run at`,time:`Local time`,weekdays:`Weekdays`,timezone:`Timezone`,spend:`Spend ceiling`,topics:`Topics`,brief:`Series brief`,generation:`Topic generation`};function Qbe(e){let t={};return e.name.trim()===``&&(t.name=`Give the schedule a name.`),e.templateChosen||(t.template=`Choose the template each run starts from.`),e.kind===`once`&&e.onceAt===``&&(t.once=`Pick the date and time of the one run.`),e.kind!==`once`&&e.time===``&&(t.time=`Pick the time of day runs start.`),e.kind===`weekly`&&e.days.length===0&&(t.weekdays=`Choose at least one weekday for a weekly schedule.`),Zw(e.timezone.trim())||(t.timezone=`Enter a timezone name like Europe/Tirane or America/New_York; start typing to see the list.`),EQ(e.spend)===void 0&&(t.spend=`Enter the ceiling in US dollars, such as 5 or 2.50, or leave it empty for no ceiling.`),e.topicProblems.length>0?t.topics=`Fix the topics first. ${e.topicProblems.slice(0,3).join(` `)}`:e.topicCount>500&&(t.topics=`Keep the list to 500 topics or fewer; it has ${String(e.topicCount)}.`),e.brief.trim().length>4e3&&(t.brief=`Keep the series brief to ${String(rT)} characters or fewer.`),e.generationLlm!==null&&(e.generationLlm.provider===``||e.generationLlm.model===``)&&(t.generation=`Pick both a provider and a model for topic generation, or tick Use the template's LLM.`),t}function $be(e){return TQ.find(t=>e[t]!==void 0)}function exe(e){return TQ.filter(t=>e[t]!==void 0).map(t=>`${Zbe[t]}: ${e[t]??``}`).join(` `)}function EQ(e){let t=e.trim().replace(/^\$/,``);if(t===``)return null;if(/^\d+(\.\d{1,2})?$/.test(t))return Math.round(Number(t)*100)}function txe(e){return e==null?``:e%100==0?String(e/100):(e/100).toFixed(2)}function nxe(){try{return typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[]}catch{return[]}}var rxe=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],DQ=J({day:K().int().min(0).max(6),time:G().regex(/^([01]\d|2[0-3]):[0-5]\d$/)}),ixe=J({name:G().trim().min(1).max(20),series:G().trim().max(100).default(``),long:DQ,shorts:q(DQ).max(10),schedule:G().optional(),runDay:K().int().min(0).max(6).optional(),timeZone:G().optional(),label:G().optional()});J({timeZone:G().min(1).max(100),rows:q(ixe).max(14)});var axe=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],oxe=[1,2,3,4,5,6,0];function OQ(e,t){return{day:(e+1+Math.floor(t/2))%7,time:t%2==0?`12:00`:`17:00`}}function sxe(e,t){return{day:e,long:{day:e,time:`20:00`},shorts:Array.from({length:t},(t,n)=>OQ(e,n))}}function kQ(e,t,n){return oxe.filter(e=>t.includes(e)).map(t=>{let r=e.find(e=>e.day===t)??sxe(t,n);return{...r,shorts:Array.from({length:n},(e,n)=>r.shorts[n]??OQ(t,n))}})}function AQ({value:e,label:t,onChange:n}){return(0,h.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(`span`,{className:`w-[64px] shrink-0 text-small text-ink-3`,children:t}),(0,h.jsx)(bL,{"aria-label":`${t}: day`,className:`w-[84px]`,value:String(e.day),onChange:t=>n({...e,day:Number(t.currentTarget.value)}),options:rxe.map((e,t)=>({value:String(t),label:e}))}),(0,h.jsx)(X,{"aria-label":`${t}: time`,type:`time`,className:`w-[124px]`,value:e.time,onChange:t=>n({...e,time:t.currentTarget.value||e.time})})]})}function cxe({releases:e,onReleases:t,runDays:n,shorts:r,once:i,timezone:a}){let o=e===null?[]:kQ(e,n,r),s=(e,n)=>t(o.map(t=>t.day===e?n:t));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`,...xy,children:[(0,h.jsx)(`legend`,{className:`float-left mb-1 w-full text-title-3 font-semibold`,children:`Release times`}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:i?`A one-time schedule has no release times: set the project's in its Video section once it is done.`:`When each run's project goes out on YouTube, in ${a}. Each short goes out the first time its day and hour come round after the one before it. Calendar → Releases shows them, and the Studio extension types them into Studio.`}),i?null:e===null?(0,h.jsx)(`div`,{children:(0,h.jsx)(B,{variant:`secondary`,onClick:()=>t(kQ([],n,r)),disabled:n.length===0,children:`Set release times`})}):(0,h.jsxs)(h.Fragment,{children:[o.map(e=>(0,h.jsxs)(`div`,{className:`flex flex-col gap-2 border-b border-line pb-3 last:border-b-0`,children:[(0,h.jsxs)(`div`,{className:`text-small font-semibold`,children:[axe[e.day],`'s run`]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-2`,children:[(0,h.jsx)(AQ,{label:`Video`,value:e.long,onChange:t=>s(e.day,{...e,long:t})}),e.shorts.map((t,n)=>(0,h.jsx)(AQ,{label:`Short ${String(n+1)}`,value:t,onChange:t=>s(e.day,{...e,shorts:e.shorts.map((e,r)=>r===n?t:e)})},n))]})]},e.day)),r===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`The template makes no shorts, so only the long video has a time.`}):null,(0,h.jsx)(`div`,{children:(0,h.jsx)(B,{variant:`quiet`,onClick:()=>t(null),children:`Set no release times`})})]})]})}function jQ(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 MQ({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=jQ;return t===void 0?(0,h.jsx)(mR,{label:`Keywords`,children:e.map(e=>(0,h.jsx)(hR,{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)(_L,{label:a(e.name),tip:s,help:l(e),error:n?.(`${r}.${e.name}`),children:(0,h.jsx)(X,{"data-play-field":`${r}.${e.name}`,value:e.value,maxLength:c,...o===void 0?{}:{"aria-label":o(e.name)},spellCheck:e.topic===!0,"aria-invalid":n?.(`${r}.${e.name}`)!==void 0,onChange:n=>t(e.name,n.target.value)})},e.name))})}var NQ={lines:`One per line`,table:`Table`,yaml:`YAML / JSON`};function PQ(e){return{mode:`lines`,rows:e,lines:SG(e),base:e,yaml:``,columns:FQ(e,[])}}function FQ(e,t){return[...new Set([...t,...e.flatMap(e=>Object.keys(e.values))])]}function IQ(e){return e.keywords.filter(t=>t!==e.topicKeyword&&(e.everyRun[t]??``).trim()===``)}function LQ(e,t){if(t.form===void 0)return{rows:e.rows,problems:[]};if(e.mode===`yaml`){let n=CG(e.yaml,{keywords:t.keywords,topicKeyword:t.topicKeyword,required:IQ(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:yG(n,{keywords:t.keywords,topicKeyword:t.topicKeyword,...e.mode===`table`?{required:IQ(t)}:{},kept:t.kept})}}function lxe(e,t,n){if(t===e.mode)return{queue:e,problems:[]};let r=e.rows;if(e.mode===`yaml`){let t=CG(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`?SG(r):e.lines,base:t===`lines`?r:e.base,yaml:t===`yaml`?wG(r,n.topicKeyword):e.yaml,columns:FQ(r,e.columns)},problems:[]}}function RQ(e,t,n){return{...e,rows:t,lines:e.mode===`lines`?SG(t):e.lines,base:e.mode===`lines`?t:e.base,yaml:e.mode===`yaml`?wG(t,n):e.yaml,columns:FQ(t,e.columns)}}function uxe(e,t,n){if(!/\.(ya?ml|json)$/i.test(e))return{ok:!0,rows:xG(t,[])};let r=CG(t,{keywords:n.keywords.length===0?Object.keys(n.everyRun):n.keywords,topicKeyword:n.topicKeyword});return r.ok?{ok:!0,rows:r.rows}:{ok:!1,problems:r.problems}}var zQ={"aria-hidden":!0,strokeWidth:1.75};function BQ(e,t,n){if(!e.altKey||e.key!==`ArrowUp`&&e.key!==`ArrowDown`)return!1;e.preventDefault();let r=e.key===`ArrowUp`;return t.busy||r&&t.index===0||!r&&t.index===t.count-1||n(t.index+(r?-1:1),r?`up`:`down`),!0}var VQ=`Alt+ArrowUp Alt+ArrowDown`;function HQ({name:e,index:t,count:n,busy:r,onMove:i,onRemove:a,onInsertBelow:o,onDuplicate:s}){let c=(0,m.useRef)(!1),l=t===0,u=t===n-1;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(bv,{size:`small`,label:`Move ${e} up`,disabled:r||l,onClick:()=>i(t-1,`up`),children:(0,h.jsx)(wc,{...zQ})}),(0,h.jsx)(bv,{size:`small`,label:`Move ${e} down`,disabled:r||u,onClick:()=>i(t+1,`down`),children:(0,h.jsx)(bc,{...zQ})}),(0,h.jsx)(bv,{size:`small`,label:`Remove ${e}`,disabled:r,onClick:a,children:(0,h.jsx)(kl,{...zQ})}),(0,h.jsxs)(BO,{children:[(0,h.jsx)(VO,{asChild:!0,children:(0,h.jsx)(bv,{size:`small`,label:`More for ${e}`,disabled:r,children:(0,h.jsx)(Hc,{...zQ})})}),(0,h.jsxs)(HO,{onCloseAutoFocus:e=>{c.current&&(c.current=!1,e.preventDefault(),o())},children:[(0,h.jsxs)(UO,{disabled:l,onSelect:()=>i(0,`to the top`),children:[(0,h.jsx)(Cc,{...zQ,className:`size-4`}),`Move to top`]}),(0,h.jsxs)(UO,{disabled:u,onSelect:()=>i(n-1,`to the bottom`),children:[(0,h.jsx)(vc,{...zQ,className:`size-4`}),`Move to bottom`]}),(0,h.jsxs)(UO,{onSelect:()=>{c.current=!0},children:[(0,h.jsx)(rl,{...zQ,className:`size-4`}),`Insert below`]}),(0,h.jsxs)(UO,{onSelect:s,children:[(0,h.jsx)(Bc,{...zQ,className:`size-4`}),`Duplicate`]})]})]})]})}function UQ(e){return e.split(/\r?\n/).map(e=>e.replace(/^\s*[-*•]\s+/,``).trim()).filter(e=>e!==``)}function WQ(e,t,n){let r=[...e],[i]=r.splice(t,1);return i===void 0||r.splice(Math.min(Math.max(n,0),r.length),0,i),r}function GQ(e,t,n){let r=Math.min(Math.max(t,0),e.length);return[...e.slice(0,r),...n,...e.slice(r)]}var KQ=0;function qQ(e){return Array.from({length:e},()=>(KQ+=1,`row-${String(KQ)}`))}function JQ(e,t,n){let r=new Map;return e.forEach((e,n)=>{let i=t[n];i!==void 0&&r.set(e.title,[...r.get(e.title)??[],i])}),n.map(e=>r.get(e.title)?.shift()??qQ(1)[0]??``)}var YQ=()=>({title:``,values:{}});function dxe({queue:e,onQueue:t,keyword:n,addable:r,titleOf:i}){let a=wv(),o=n===null?`Title`:`{{${n}}}`,s=(0,m.useRef)({rows:e.rows,keys:qQ(e.rows.length)});s.current.rows!==e.rows&&(s.current={rows:e.rows,keys:JQ(s.current.rows,s.current.keys,e.rows)});let c=s.current.keys,l=(0,m.useRef)(e);l.current=e;let u=AG(c),d=(0,m.useRef)(new Map),f=(0,m.useRef)(null);(0,m.useEffect)(()=>{let e=f.current;e!==null&&c.includes(e)&&(f.current=null,d.current.get(e)?.focus())},[c]);let p=(n,r,i)=>{s.current={rows:n,keys:r},i!==void 0&&(f.current=i),t({...e,rows:n})},g=(t,n)=>{let r=qQ(n.length);p(GQ(e.rows,t,n),GQ(c,t,r),r[0])},_=(t,n)=>p(e.rows.map((e,r)=>r===t?n:e),c),v=(t,n)=>{let r=c[t];p(WQ(e.rows,t,n),WQ(c,t,n),r)},y=r=>{let i=[...new Set(r)].filter(e=>e>=0).sort((e,t)=>e-t),o=i.flatMap(t=>{let n=e.rows[t];return n===void 0?[]:[{at:t,row:n}]});if(o.length===0)return;let s=new Set(i);p(e.rows.filter((e,t)=>!s.has(t)),c.filter((e,t)=>!s.has(t)));let u=o[0]?.row.title.trim()??``;a(o.length===1?`Removed ${u===``?`an empty topic`:`“${u}”`}. Save the schedule to keep it.`:`Removed ${PG(o.length,`topic`,`topics`)}. Save the schedule to keep it.`,`success`,{label:`Undo`,run:()=>{let e=[...l.current.rows];for(let{at:t,row:n}of o)e=GQ(e,t,[n]);t(RQ(l.current,e,n))}})};return(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,...xy,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsxs)(B,{size:`small`,onClick:()=>g(e.rows.length,[YQ()]),children:[(0,h.jsx)(pl,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Add topic`]}),r.length===0?null:(0,h.jsxs)(bL,{"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))]})]}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,onKeyDown:u.onKeyDown,children:[e.rows.length>1?(0,h.jsx)(NG,{selection:u,total:e.rows.length,noun:[`topic`,`topics`],actions:(0,h.jsx)(B,{size:`small`,variant:`quiet`,disabled:u.count===0,disabledReason:`Tick the topics to remove`,onClick:()=>{y(u.selected.map(e=>c.indexOf(e))),u.clear()},children:`Remove selected`})}):null,(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)(`span`,{className:`sr-only`,children:`Select`})}),(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)(U,{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)(bv,{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)(kl,{"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:`Actions`})})]})}),(0,h.jsx)(`tbody`,{children:e.rows.map((t,n)=>{let r=c[n]??String(n),a=t.title.trim()===``?`topic ${String(n+1)}`:t.title;return(0,h.jsxs)(`tr`,{children:[(0,h.jsx)(`td`,{children:(0,h.jsx)(MG,{selection:u,value:r,label:a})}),(0,h.jsx)(`td`,{className:`num`,children:n+1}),(0,h.jsx)(`td`,{children:(0,h.jsx)(X,{ref:e=>{e===null?d.current.delete(r):d.current.set(r,e)},"aria-label":`Topic ${String(n+1)} ${o}`,"aria-keyshortcuts":VQ,maxLength:200,value:t.title,className:`min-w-[14rem]`,onChange:e=>_(n,{...t,title:e.target.value}),onPaste:t=>{let r=UQ(t.clipboardData.getData(`text`));if(r.length<2)return;t.preventDefault();let[i=``,...a]=r,o=e.rows.map((e,t)=>t===n?{...e,title:`${e.title}${i}`}:e),s=qQ(a.length);p(GQ(o,n+1,a.map(e=>({title:e,values:{}}))),GQ(c,n+1,s),s.at(-1))},onKeyDown:t=>{BQ(t,{index:n,count:e.rows.length,busy:!1},e=>v(n,e))||t.key===`Enter`&&(t.preventDefault(),g(n+1,[YQ()]))}})}),e.columns.map(e=>(0,h.jsx)(`td`,{children:(0,h.jsx)(X,{"aria-label":`Topic ${String(n+1)} ${e}`,maxLength:hG,placeholder:`Every-run value`,value:t.values[e]??``,className:`min-w-[8rem]`,onChange:r=>_(n,{...t,values:{...t.values,[e]:r.target.value}})})},e)),(0,h.jsx)(`td`,{className:`min-w-[180px] text-small text-ink-2`,children:i(t)??`—`}),(0,h.jsx)(`td`,{children:(0,h.jsx)(`span`,{className:`flex items-center gap-1`,children:(0,h.jsx)(HQ,{name:a,index:n,count:e.rows.length,busy:!1,onMove:e=>v(n,e),onRemove:()=>y([n]),onInsertBelow:()=>g(n+1,[YQ()]),onDuplicate:()=>g(n+1,[t])})})})]},r)})})]})})]})]})}function fxe({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=LQ(e,n),y=e.mode===`yaml`?v.rows:e.rows,b=e=>p===void 0?void 0:rye(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=()=>wG(LQ(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=(0,m.useRef)(null),O=async r=>{let i=uxe(r.name,await r.text(),n);if(!i.ok){u(`${r.name} wasn't imported: ${i.problems.slice(0,3).join(` `)} Fix the file and import it again, or paste its text under YAML / JSON to see every problem.`);return}if(i.rows.length===0){u(`${r.name} has no topics in it. Put one topic per line, or a YAML / JSON list.`);return}t(RQ(e,[...LQ(e,n).rows,...i.rows],f)),u(`Imported ${String(i.rows.length)} ${i.rows.length===1?`topic`:`topics`} from ${r.name}, after the ones already here.`)},k=d.filter(t=>t!==f&&!e.columns.includes(t)),A=[...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)(U,{id:`planning.schedule.topics`})]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(wy,{label:`How to write the topics`,tip:`planning.schedule.topic-format`,value:e.mode,options:Object.keys(NQ).map(e=>({value:e,label:NQ[e]})),onChange:r=>{let i=lxe(e,r,n);c(i.problems),t(i.queue)}}),(0,h.jsxs)(B,{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)(Bc,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Copy as YAML`]}),(0,h.jsxs)(B,{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)(Vc,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Export as YAML`]}),(0,h.jsxs)(B,{variant:`quiet`,size:`small`,onClick:()=>D.current?.click(),children:[(0,h.jsx)(Cl,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Import`]}),(0,h.jsx)(`input`,{ref:D,type:`file`,hidden:!0,accept:`.yaml,.yml,.json,.txt,text/plain,application/json,application/yaml`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t!==void 0&&O(t)}}),l===null?null:(0,h.jsx)(`span`,{role:`status`,className:`text-small text-ink-2`,children:l})]}),e.mode===`lines`?(0,h.jsx)(_L,{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)(yL,{rows:Math.min(16,Math.max(6,y.length+1)),value:e.lines,onChange:n=>t({...e,lines:n.target.value,rows:xG(n.target.value,e.base)}),placeholder:`Pyramids
|
|
271
|
+
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),IG=Z.default.BigInt(0),LG=Z.default.BigInt(1),RG=Z.default.BigInt(2),cye=Z.default.BigInt(10),lye=Z.default.BigInt(24),uye=Z.default.BigInt(60),dye=Z.default.BigInt(1e3),zG=Z.default.BigInt(1e6),BG=Z.default.BigInt(1e9),VG=Z.default.multiply(Z.default.BigInt(3600),BG),fye=Z.default.multiply(uye,BG),HG=Z.default.multiply(VG,lye);function UG(e){return typeof e==`bigint`?Z.default.BigInt(e.toString(10)):e}function WG(e){return Z.default.equal(Z.default.remainder(e,RG),IG)}function GG(e){return Z.default.lessThan(e,IG)?Z.default.unaryMinus(e):e}function KG(e,t){return Z.default.lessThan(e,t)?-1:+!!Z.default.greaterThan(e,t)}function qG(e,t){return{quotient:Z.default.divide(e,t),remainder:Z.default.remainder(e,t)}}var JG,YG,XG=`slot-epochNanoSeconds`,ZG=`slot-iso-date`,QG=`slot-iso-date-time`,$G=`slot-time`,eK=`slot-calendar`,tK=`slot-date-brand`,nK=`slot-year-month-brand`,rK=`slot-month-day-brand`,iK=`slot-time-zone`,aK=`slot-years`,oK=`slot-months`,sK=`slot-weeks`,cK=`slot-days`,lK=`slot-hours`,uK=`slot-minutes`,dK=`slot-seconds`,fK=`slot-milliseconds`,pK=`slot-microseconds`,mK=`slot-nanoseconds`,hK=`date`,gK=`ym`,_K=`md`,vK=`time`,yK=`datetime`,bK=`instant`,xK=`original`,SK=`timezone-canonical`,CK=`timezone-original`,wK=`calendar-id`,TK=`locale`,EK=`options`,DK=new WeakMap,OK=Symbol.for(`@@Temporal__GetSlots`);(JG=globalThis)[OK]||(JG[OK]=function(e){return DK.get(e)});var kK=globalThis[OK],AK=Symbol.for(`@@Temporal__CreateSlots`);(YG=globalThis)[AK]||(YG[AK]=function(e){DK.set(e,Object.create(null))});var jK=globalThis[AK];function MK(e,...t){if(!e||typeof e!=`object`)return!1;let n=kK(e);return!!n&&t.every((e=>e in n))}function Q(e,t){let n=kK(e)?.[t];if(n===void 0)throw TypeError(`Missing internal slot ${t}`);return n}function NK(e,t,n){let r=kK(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 PK={};function FK(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))}IK(t,e),IK(`${t}.prototype`,e.prototype)}function IK(e,t){let n=`%${e}%`;if(PK[n]!==void 0)throw Error(`intrinsic ${e} already exists`);PK[n]=t}function LK(e){return PK[e]}function RK(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 zK(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 BK(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 VK(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 HK=class e{constructor(e){this.totalNs=UG(e),this.sec=Z.default.toNumber(Z.default.divide(this.totalNs,BG)),this.subsec=Z.default.toNumber(Z.default.remainder(this.totalNs,BG))}static validateNew(t,n){if(Z.default.greaterThan(GG(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=Z.default.subtract(UG(t),UG(n));return new e(r)}static fromComponents(t,n,r,i,a,o){let s=Z.default.add(Z.default.add(Z.default.add(Z.default.add(Z.default.add(Z.default.BigInt(o),Z.default.multiply(Z.default.BigInt(a),dye)),Z.default.multiply(Z.default.BigInt(i),zG)),Z.default.multiply(Z.default.BigInt(r),BG)),Z.default.multiply(Z.default.BigInt(n),fye)),Z.default.multiply(Z.default.BigInt(t),VG));return e.validateNew(s,`total`)}abs(){return new e(GG(this.totalNs))}add(t){return e.validateNew(Z.default.add(this.totalNs,t.totalNs),`sum`)}add24HourDays(t){return e.validateNew(Z.default.add(this.totalNs,Z.default.multiply(Z.default.BigInt(t),HG)),`sum`)}addToEpochNs(e){return Z.default.add(UG(e),this.totalNs)}cmp(e){return KG(this.totalNs,e.totalNs)}divmod(t){let{quotient:n,remainder:r}=qG(this.totalNs,Z.default.BigInt(t));return{quotient:Z.default.toNumber(n),remainder:new e(r)}}fdiv(e){let t=UG(e),n=Z.default.BigInt(t),{quotient:r,remainder:i}=qG(this.totalNs,n),a=[],o,s=(Z.default.lessThan(this.totalNs,IG)?-1:1)*Math.sign(Z.default.toNumber(t));for(;!Z.default.equal(i,IG)&&a.length<50;)i=Z.default.multiply(i,cye),{quotient:o,remainder:i}=qG(i,n),a.push(Math.abs(Z.default.toNumber(o)));return s*Number(GG(r).toString()+`.`+a.join(``))}isZero(){return Z.default.equal(this.totalNs,IG)}round(t,n){let r=UG(t);if(Z.default.equal(r,LG))return this;let{quotient:i,remainder:a}=qG(this.totalNs,r),o=Z.default.lessThan(this.totalNs,IG)?`negative`:`positive`,s=Z.default.multiply(GG(i),r),c=Z.default.add(s,r),l=KG(GG(Z.default.multiply(a,RG)),r),u=BK(n,o),d=Z.default.equal(GG(this.totalNs),s)?s:VK(s,c,l,WG(i),u),f=o===`positive`?d:Z.default.unaryMinus(d);return e.validateNew(f,`rounding`)}sign(){return this.cmp(new e(IG))}subtract(t){return e.validateNew(Z.default.subtract(this.totalNs,t.totalNs),`difference`)}};HK.MAX=Z.default.BigInt(`9007199254740991999999999`),HK.ZERO=new HK(IG);var UK=/[A-Za-z._][A-Za-z._0-9+-]*/,WK=RegExp(`(?:(?:[+-](?:[01][0-9]|2[0-3])(?::?[0-5][0-9])?)|(?:${UK.source})(?:\\/(?:${UK.source}))*)`),GK=/(?:[+-]\d{6}|\d{4})/,KK=/(?:0[1-9]|1[0-2])/,qK=/(?:0[1-9]|[12]\d|3[01])/,pye=RegExp(`(${GK.source})(?:-(${KK.source})-(${qK.source})|(${KK.source})(${qK.source}))`),JK=/(\d{2})(?::(\d{2})(?::(\d{2})(?:[.,](\d{1,9}))?)?|(\d{2})(?:(\d{2})(?:[.,](\d{1,9}))?)?)?/,YK=/((?:[+-])(?:[01][0-9]|2[0-3])(?::?(?:[0-5][0-9])(?::?(?:[0-5][0-9])(?:[.,](?:\d{1,9}))?)?)?)/,XK=RegExp(`([zZ])|${YK.source}?`),ZK=/\[(!)?([a-z_][a-z0-9_-]*)=([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\]/g,mye=new RegExp([`^${pye.source}`,`(?:(?:[tT]|\\s+)${JK.source}(?:${XK.source})?)?`,`(?:\\[!?(${WK.source})\\])?`,`((?:${ZK.source})*)$`].join(``)),hye=new RegExp([`^[tT]?${JK.source}`,`(?:${XK.source})?`,`(?:\\[!?${WK.source}\\])?`,`((?:${ZK.source})*)$`].join(``)),gye=RegExp(`^(${GK.source})-?(${KK.source})(?:\\[!?${WK.source}\\])?((?:${ZK.source})*)$`),_ye=RegExp(`^(?:--)?(${KK.source})-?(${qK.source})(?:\\[!?${WK.source}\\])?((?:${ZK.source})*)$`),QK=/(\d+)(?:[.,](\d{1,9}))?/,vye=RegExp(`(?:${QK.source}H)?(?:${QK.source}M)?(?:${QK.source}S)?`),yye=RegExp(`^([+-])?P(?:(\\d+)Y)?(?:(\\d+)M)?(?:(\\d+)W)?(?:(\\d+)D)?(?:T(?!$)${vye.source})?$`,`i`),$K=864e5,eq=1e6*$K,bye=6e10,tq=1e8*$K,nq=WX(tq),rq=Z.default.unaryMinus(nq),xye=Z.default.add(Z.default.subtract(rq,HG),LG),Sye=Z.default.subtract(Z.default.add(nq,HG),LG),Cye=146097*$K,iq=-271821,aq=275760,oq=Date.UTC(1847,0,1),wye=[`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`],Tye=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 sq(e){return typeof e==`object`&&!!e||typeof e==`function`}function cq(e){if(typeof e==`bigint`)throw TypeError(`Cannot convert BigInt to number`);return Number(e)}function lq(e){if(typeof e==`symbol`)throw TypeError(`Cannot convert a Symbol value to a String`);return String(e)}function uq(e){let t=cq(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 dq(e,t){let n=uq(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 fq(e){let t=cq(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 pq(e,t){return String(e).padStart(t,`0`)}function mq(e){if(typeof e!=`string`)throw TypeError(`expected a string, not ${String(e)}`);return e}function hq(e,t){if(sq(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 gq=[`era`,`eraYear`,`year`,`month`,`monthCode`,`day`,`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`,`offset`,`timeZone`],Eye={era:lq,eraYear:uq,year:uq,month:dq,monthCode:function(e){let t=mq(hq(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:dq,hour:uq,minute:uq,second:uq,millisecond:uq,microsecond:uq,nanosecond:uq,offset:function(e){let t=mq(hq(e));return vY(t),t},timeZone:XJ},Dye={hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},_q=[[`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`]],vq=Object.fromEntries(_q.map((e=>[e[0],e[1]]))),Oye=Object.fromEntries(_q.map((([e,t])=>[t,e]))),yq=_q.map((([,e])=>e)),bq={day:eq,hour:36e11,minute:6e10,second:1e9,millisecond:1e6,microsecond:1e3,nanosecond:1},xq=[`days`,`hours`,`microseconds`,`milliseconds`,`minutes`,`months`,`nanoseconds`,`seconds`,`weeks`,`years`],kye=Intl.DateTimeFormat,Sq=new Map;function Cq(e){let t=$X(e),n=Sq.get(t);return n===void 0&&(n=new kye(`en-us`,{timeZone:t,hour12:!1,era:`short`,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`}),Sq.set(t,n)),n}function wq(e){return MK(e,XG)&&!MK(e,iK,eK)}function Tq(e){return MK(e,aK,oK,cK,lK,uK,dK,fK,pK,mK)}function Eq(e){return MK(e,tK)}function Dq(e){return MK(e,$G)}function Oq(e){return MK(e,QG)}function kq(e){return MK(e,nK)}function Aq(e){return MK(e,rK)}function jq(e){return MK(e,XG,iK,eK)}function $(e,t){if(!t(e))throw TypeError(`invalid receiver: method called with the wrong type of this-object`)}function Mq(e){if(MK(e,eK)||MK(e,iK))throw TypeError(`with() does not support a calendar or timeZone property`);if(Dq(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 Nq(e,t){return t===`never`||t===`auto`&&e===`iso8601`?``:`[${t===`critical`?`!`:``}u-ca=${e}]`}function Pq(e){let t,n,r=!1;for(ZK.lastIndex=0;n=ZK.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 Fq(e){let t=mye.exec(e);if(!t)throw RangeError(`invalid RFC 9557 string: ${e}`);let n=Pq(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 JY(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 Iq(e){let t=hye.exec(e),n,r,i,a,o,s,c;if(t){c=Pq(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}=Fq(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(qY(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}=Rq(e);GY(1972,t,n)}catch{try{let{year:t,month:n}=Lq(e);GY(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 Lq(e){let t=gye.exec(e),n,r,i,a;if(t){i=Pq(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}=Fq(e),t)throw RangeError(`Z designator not supported for PlainYearMonth`)}return{year:n,month:r,calendar:i,referenceISODay:a}}function Rq(e){let t=_ye.exec(e),n,r,i,a;if(t){if(i=Pq(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}=Fq(e),t)throw RangeError(`Z designator not supported for PlainMonthDay`)}return{month:n,day:r,calendar:i,referenceISOYear:a}}var zq=RegExp(`^${WK.source}$`,`i`),Bq=RegExp(`^([+-])([01][0-9]|2[0-3])(?::?([0-5][0-9])?)?$`);function Vq(e){let t=jye.test(e)?`Seconds not allowed in offset time zone`:`Invalid time zone`;throw RangeError(`${t}: ${e}`)}function Hq(e){return zq.test(e)||Vq(e),Bq.test(e)?{offsetMinutes:vY(e)/6e10}:{tzName:e}}function Uq(e,t,n,r){let i=e,a=t,o=n;switch(r){case`reject`:GY(i,a,o);break;case`constrain`:({year:i,month:a,day:o}=UY(i,a,o))}return{year:i,month:a,day:o}}function Wq(e,t,n,r,i,a,o){let s=e,c=t,l=n,u=r,d=i,f=a;switch(o){case`reject`:qY(s,c,l,u,d,f);break;case`constrain`:s=HY(s,0,23),c=HY(c,0,59),l=HY(l,0,59),u=HY(u,0,999),d=HY(d,0,999),f=HY(f,0,999)}return{hour:s,minute:c,second:l,millisecond:u,microsecond:d,nanosecond:f}}function Gq(e){if(!sq(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<xq.length;r++){let i=xq[r],a=e[i];a!==void 0&&(n=!0,t[i]=fq(a))}if(!n)throw TypeError(`invalid duration-like`);return t}function Kq({years:e,months:t,weeks:n,days:r},i,a,o){return{years:e,months:o??t,weeks:a??n,days:i??r}}function qq(e,t){return{isoDate:e,time:t}}function Jq(e){return ZX(e,`overflow`,[`constrain`,`reject`],`constrain`)}function Yq(e){return ZX(e,`disambiguation`,[`compatible`,`earlier`,`later`,`reject`],`compatible`)}function Xq(e,t){return ZX(e,`roundingMode`,[`ceil`,`floor`,`expand`,`trunc`,`halfCeil`,`halfFloor`,`halfExpand`,`halfTrunc`,`halfEven`],t)}function Zq(e,t){return ZX(e,`offset`,[`prefer`,`use`,`ignore`,`reject`],t)}function Qq(e){return ZX(e,`calendarName`,[`auto`,`always`,`never`,`critical`],`auto`)}function $q(e){let t=e.roundingIncrement;if(t===void 0)return 1;let n=uq(t);if(n<1||n>1e9)throw RangeError(`roundingIncrement must be at least 1 and at most 1e9, not ${t}`);return n}function eJ(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 tJ(e){let t=e.fractionalSecondDigits;if(t===void 0)return`auto`;if(typeof t!=`number`){if(lq(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 nJ(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 rJ=Symbol(`~required~`);function iJ(e,t,n,r,i=[]){let a=[];for(let e=0;e<_q.length;e++){let t=_q[e],r=t[1],i=t[2];n!==`datetime`&&n!==i||a.push(r)}a=a.concat(i);let o=r;o===rJ?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=Oye[a[e]];t!==void 0&&s.push(t)}let c=ZX(e,t,s,o);if(c===void 0&&r===rJ)throw RangeError(`${t} is required`);return c&&c in vq?vq[c]:c}function aJ(e){let t=e.relativeTo;if(t===void 0)return{};let n,r,i,a,o,s=`option`,c=!1;if(sq(t)){if(jq(t))return{zonedRelativeTo:t};if(Eq(t))return{plainRelativeTo:t};if(Oq(t))return{plainRelativeTo:DJ(Q(t,QG).isoDate,Q(t,eK))};i=GJ(t);let e=pJ(i,t,[`year`,`month`,`monthCode`,`day`],[`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`,`offset`,`timeZone`],[]);({isoDate:n,time:r}=gJ(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}=Fq(mq(t)),e)a=XJ(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=QX(i),n={year:u,month:d,day:f}}return a===void 0?{plainRelativeTo:DJ(n,i)}:{zonedRelativeTo:zJ(wJ(n,r,s,s===`option`?vY(o):0,a,`compatible`,`reject`,c),a,i)}}function oJ(e){return Q(e,aK)===0?Q(e,oK)===0?Q(e,sK)===0?Q(e,cK)===0?Q(e,lK)===0?Q(e,uK)===0?Q(e,dK)===0?Q(e,fK)===0?Q(e,pK)===0?`nanosecond`:`microsecond`:`millisecond`:`second`:`minute`:`hour`:`day`:`week`:`month`:`year`}function sJ(e,t){return yq.indexOf(e)>yq.indexOf(t)?t:e}function cJ(e){return e===`year`||e===`month`||e===`week`}function lJ(e){return cJ(e)||e===`day`?`date`:`time`}function uJ(e){return LK(`%calendarImpl%`)(e)}function dJ(e){return LK(`%calendarImpl%`)(Q(e,eK))}function fJ(e,t,n=`date`){let r=Object.create(null),i=uJ(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 pJ(e,t,n,r,i){let a=uJ(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,Eye[n])(r);else if(i!==`partial`){if(i.includes(n))throw TypeError(`required property '${n}' missing or undefined`);s[n]=Dye[n]}}if(i===`partial`&&!c)throw TypeError(`no supported properties found`);return s}function mJ(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]=uq(s),r=!0)}if(!r)throw TypeError(`invalid time-like`);return i}function hJ(e,t){if(sq(e)){if(Eq(e))return Jq(YX(t)),DJ(Q(e,ZG),Q(e,eK));if(jq(e)){let n=eY(Q(e,iK),Q(e,XG));return Jq(YX(t)),DJ(n.isoDate,Q(e,eK))}if(Oq(e))return Jq(YX(t)),DJ(Q(e,QG).isoDate,Q(e,eK));let n=GJ(e);return DJ(qJ(n,pJ(n,e,[`year`,`month`,`monthCode`,`day`],[],[]),Jq(YX(t))),n)}let{year:n,month:r,day:i,calendar:a,z:o}=Fq(mq(e));if(o)throw RangeError(`Z designator not supported for PlainDate`);return a||=`iso8601`,a=QX(a),Jq(YX(t)),DJ({year:n,month:r,day:i},a)}function gJ(e,t,n){return qq(qJ(e,t,n),Wq(t.hour,t.minute,t.second,t.millisecond,t.microsecond,t.nanosecond,n))}function _J(e,t){let n,r,i;if(sq(e)){if(Oq(e))return Jq(YX(t)),kJ(Q(e,QG),Q(e,eK));if(jq(e)){let n=eY(Q(e,iK),Q(e,XG));return Jq(YX(t)),kJ(n,Q(e,eK))}if(Eq(e))return Jq(YX(t)),kJ(qq(Q(e,ZG),{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),Q(e,eK));i=GJ(e);let a=pJ(i,e,[`year`,`month`,`monthCode`,`day`],[`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`],[]),o=Jq(YX(t));({isoDate:n,time:r}=gJ(i,a,o))}else{let a,o,s,c;if({year:o,month:s,day:c,time:r,calendar:i,z:a}=Fq(mq(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}),JY(o,s,c,r.hour,r.minute,r.second,r.millisecond,r.microsecond,r.nanosecond),i||=`iso8601`,i=QX(i),Jq(YX(t)),n={year:o,month:s,day:c}}return kJ(qq(n,r),i)}function vJ(e){let t=LK(`%Temporal.Duration%`);if(Tq(e))return new t(Q(e,aK),Q(e,oK),Q(e,sK),Q(e,cK),Q(e,lK),Q(e,uK),Q(e,dK),Q(e,fK),Q(e,pK),Q(e,mK));if(!sq(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=yye.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:uq(t[2])*n,i=t[3]===void 0?0:uq(t[3])*n,a=t[4]===void 0?0:uq(t[4])*n,o=t[5]===void 0?0:uq(t[5])*n,s=t[6]===void 0?0:uq(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*uq((c+`000000000`).slice(0,9))*n}else if(p=l===void 0?0:uq(l)*n,u!==void 0){if(d??f)throw RangeError(`only the smallest unit can be fractional`);h=60*uq((u+`000000000`).slice(0,9))*n}else m=d===void 0?0:uq(d)*n,f!==void 0&&(h=uq((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),$Y(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(LK(`%Temporal.Duration%`))(t,n,r,i,a,o,s,c,l,u)}(mq(e));let n={years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0,milliseconds:0,microseconds:0,nanoseconds:0},r=Gq(e);for(let e=0;e<xq.length;e++){let t=xq[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 yJ(e){let t;if(sq(e)){if(wq(e)||jq(e))return LJ(Q(e,XG));t=hq(e)}else t=e;let{year:n,month:r,day:i,time:a,offset:o,z:s}=function(e){let t=Fq(e);if(!t.z&&!t.offset)throw RangeError(`Temporal.Instant requires a time zone offset`);return t}(mq(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=RY(n,r,i,c,l,u,d,f,p-(s?0:vY(o)));return oX(m.isoDate),LJ(EY(m))}function bJ(e,t){if(sq(e)){if(Aq(e))return Jq(YX(t)),jJ(Q(e,ZG),Q(e,eK));let n;return MK(e,eK)?n=Q(e,eK):(n=e.calendar,n===void 0&&(n=`iso8601`),n=WJ(n)),jJ(YJ(n,pJ(n,e,[`year`,`month`,`monthCode`,`day`],[],[]),Jq(YX(t))),n)}let{month:n,day:r,referenceISOYear:i,calendar:a}=Rq(mq(e));if(a===void 0&&(a=`iso8601`),a=QX(a),Jq(YX(t)),a===`iso8601`)return jJ({year:1972,month:n,day:r},a);let o={year:i,month:n,day:r};return KY(o),o=YJ(a,fJ(a,o,`month-day`),`constrain`),jJ(o,a)}function xJ(e,t){let n;if(sq(e)){if(Dq(e))return Jq(YX(t)),NJ(Q(e,$G));if(Oq(e))return Jq(YX(t)),NJ(Q(e,QG).time);if(jq(e)){let n=eY(Q(e,iK),Q(e,XG));return Jq(YX(t)),NJ(n.time)}let{hour:r,minute:i,second:a,millisecond:o,microsecond:s,nanosecond:c}=mJ(e);n=Wq(r,i,a,o,s,c,Jq(YX(t)))}else n=Iq(mq(e)),Jq(YX(t));return NJ(n)}function SJ(e){return e===void 0?{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}:Q(xJ(e),$G)}function CJ(e,t){if(sq(e)){if(kq(e))return Jq(YX(t)),FJ(Q(e,ZG),Q(e,eK));let n=GJ(e);return FJ(JJ(n,pJ(n,e,[`year`,`month`,`monthCode`],[],[]),Jq(YX(t))),n)}let{year:n,month:r,referenceISODay:i,calendar:a}=Lq(mq(e));a===void 0&&(a=`iso8601`),a=QX(a),Jq(YX(t));let o={year:n,month:r,day:i};return QY(o),o=JJ(a,fJ(a,o,`year-month`),`constrain`),FJ(o,a)}function wJ(e,t,n,r,i,a,o,s){if(t===`start-of-day`)return iY(i,e);let c=qq(e,t);if(n===`wall`||o===`ignore`)return tY(i,c,a);if(n===`exact`||o===`use`){let n=RY(e.year,e.month,e.day,t.hour,t.minute,t.second,t.millisecond,t.microsecond,t.nanosecond-r);oX(n.isoDate);let i=EY(n);return ZY(i),i}oX(e);let l=EY(c),u=rY(i,c);for(let e=0;e<u.length;e++){let t=u[e],n=Z.default.toNumber(Z.default.subtract(l,t)),i=NX(n,6e10,`halfExpand`);if(n===r||s&&i===r)return t}if(o===`reject`){let e=$J(r),t=pY(c,`iso8601`,`auto`);throw RangeError(`Offset ${e} is invalid for ${t} in ${i}`)}return nY(u,i,c,a)}function TJ(e,t){let n,r,i,a,o,s,c,l=!1,u=`option`;if(sq(e)){if(jq(e)){let n=YX(t);return Yq(n),Zq(n,`reject`),Jq(n),zJ(Q(e,XG),Q(e,iK),Q(e,eK))}o=GJ(e);let l=pJ(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=YX(t);s=Yq(d),c=Zq(d,`reject`);let f=Jq(d);({isoDate:n,time:r}=gJ(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=Fq(e);if(!t.tzAnnotation)throw RangeError(`Temporal.ZonedDateTime requires a time zone ID in brackets`);return t}(mq(e))),i=XJ(d),f?u=`exact`:a||(u=`wall`),o||=`iso8601`,o=QX(o),l=!0;let g=YX(t);s=Yq(g),c=Zq(g,`reject`),Jq(g),n={year:p,month:m,day:h}}let d=0;return u===`option`&&(d=vY(a)),zJ(wJ(n,r,u,d,i,s,c,l),i,o)}function EJ(e,t,n){KY(t),jK(e),NK(e,ZG,t),NK(e,eK,n),NK(e,tK,!0)}function DJ(e,t){let n=LK(`%Temporal.PlainDate%`),r=Object.create(n.prototype);return EJ(r,e,t),r}function OJ(e,t,n){YY(t),jK(e),NK(e,QG,t),NK(e,eK,n)}function kJ(e,t){let n=LK(`%Temporal.PlainDateTime%`),r=Object.create(n.prototype);return OJ(r,e,t),r}function AJ(e,t,n){KY(t),jK(e),NK(e,ZG,t),NK(e,eK,n),NK(e,rK,!0)}function jJ(e,t){let n=LK(`%Temporal.PlainMonthDay%`),r=Object.create(n.prototype);return AJ(r,e,t),r}function MJ(e,t){jK(e),NK(e,$G,t)}function NJ(e){let t=LK(`%Temporal.PlainTime%`),n=Object.create(t.prototype);return MJ(n,e),n}function PJ(e,t,n){QY(t),jK(e),NK(e,ZG,t),NK(e,eK,n),NK(e,nK,!0)}function FJ(e,t){let n=LK(`%Temporal.PlainYearMonth%`),r=Object.create(n.prototype);return PJ(r,e,t),r}function IJ(e,t){ZY(t),jK(e),NK(e,XG,t)}function LJ(e){let t=LK(`%Temporal.Instant%`),n=Object.create(t.prototype);return IJ(n,e),n}function RJ(e,t,n,r){ZY(t),jK(e),NK(e,XG,t),NK(e,iK,n),NK(e,eK,r)}function zJ(e,t,n=`iso8601`){let r=LK(`%Temporal.ZonedDateTime%`),i=Object.create(r.prototype);return RJ(i,e,t,n),i}function BJ(e){return gq.filter((t=>e[t]!==void 0))}function VJ(e,t,n){let r=BJ(n),i=uJ(e).fieldKeysToIgnore(r),a=Object.create(null),o=BJ(t);for(let e=0;e<gq.length;e++){let s,c=gq[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 HJ(e,t,n,r){let i=uJ(e).dateAdd(t,n,r);return KY(i),i}function UJ(e,t,n,r){return uJ(e).dateUntil(t,n,r)}function WJ(e){if(sq(e)&&MK(e,eK))return Q(e,eK);let t=mq(e);try{return QX(t)}catch{}let n;try{({calendar:n}=Fq(t))}catch{try{({calendar:n}=Iq(t))}catch{try{({calendar:n}=Lq(t))}catch{({calendar:n}=Rq(t))}}}return n||=`iso8601`,QX(n)}function GJ(e){if(MK(e,eK))return Q(e,eK);let{calendar:t}=e;return t===void 0?`iso8601`:WJ(t)}function KJ(e,t){return QX(e)===QX(t)}function qJ(e,t,n){let r=uJ(e);r.resolveFields(t,`date`);let i=r.dateToISO(t,n);return KY(i),i}function JJ(e,t,n){let r=uJ(e);r.resolveFields(t,`year-month`),t.day=1;let i=r.dateToISO(t,n);return QY(i),i}function YJ(e,t,n){let r=uJ(e);r.resolveFields(t,`month-day`);let i=r.monthDayToISOReferenceDate(t,n);return KY(i),i}function XJ(e){if(sq(e)&&jq(e))return Q(e,iK);let t=mq(e);if(t===`UTC`)return`UTC`;let{tzName:n,offsetMinutes:r}=function(e){let{tzAnnotation:t,offset:n,z:r}=function(e){if(zq.test(e))return{tzAnnotation:e,offset:void 0,z:!1};try{let{tzAnnotation:t,offset:n,z:r}=Fq(e);if(r||t||n)return{tzAnnotation:t,offset:n,z:r}}catch{}Vq(e)}(e);return t?Hq(t):r?Hq(`UTC`):n?Hq(n):void 0}(t);if(r!==void 0)return CY(r);let i=bY(n);if(!i)throw RangeError(`Unrecognized time zone ${n}`);return i.identifier}function ZJ(e,t){if(e===t)return!0;let n=Hq(e).offsetMinutes,r=Hq(t).offsetMinutes;if(n===void 0&&r===void 0){let n=bY(t);if(!n)return!1;let r=bY(e);return!!r&&r.primaryIdentifier===n.primaryIdentifier}return n===r}function QJ(e,t){let n=Hq(e).offsetMinutes;return n===void 0?SY(e,t):6e10*n}function $J(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}${cY(r,i,a,o,a===0&&o===0?`minute`:`auto`)}`}function eY(e,t){let n=QJ(e,t),{isoDate:{year:r,month:i,day:a},time:{hour:o,minute:s,second:c,millisecond:l,microsecond:u,nanosecond:d}}=DY(t);return RY(r,i,a,o,s,c,l,u,d+n)}function tY(e,t,n){return nY(rY(e,t),e,t,n)}function nY(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=EY(n),o=Z.default.subtract(a,HG);ZY(o);let s=QJ(t,o),c=Z.default.add(a,HG);ZY(c);let l=QJ(t,c)-s;switch(r){case`earlier`:{let e=HK.fromComponents(0,0,0,0,0,-l),r=CX(n.time,e);return rY(t,qq(LY(n.isoDate.year,n.isoDate.month,n.isoDate.day+r.deltaDays),r))[0]}case`compatible`:case`later`:{let e=HK.fromComponents(0,0,0,0,0,l),r=CX(n.time,e),i=rY(t,qq(LY(n.isoDate.year,n.isoDate.month,n.isoDate.day+r.deltaDays),r));return i[i.length-1]}}}function rY(e,t){if(e===`UTC`)return oX(t.isoDate),[EY(t)];let n=Hq(e).offsetMinutes;if(n!==void 0){let e=RY(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);oX(e.isoDate);let r=EY(e);return ZY(r),[r]}return oX(t.isoDate),function(e,t){let n=EY(t),r=Z.default.subtract(n,HG);Z.default.lessThan(r,rq)&&(r=n);let i=Z.default.add(n,HG);Z.default.greaterThan(i,nq)&&(i=n);let a=SY(e,r),o=SY(e,i);return(a===o?[a]:[a,o]).map((r=>{let i=Z.default.subtract(n,Z.default.BigInt(r));if(VX(t,function(e,t){let{epochMilliseconds:n,time:{millisecond:r,microsecond:i,nanosecond:a}}=DY(t),{year:o,month:s,day:c,hour:l,minute:u,second:d}=AY(e,n);return RY(o,s,c,l,u,d,r,i,a)}(e,i))===0)return ZY(i),i})).filter((e=>e!==void 0))}(e,t)}function iY(e,t){let n=qq(t,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),r=rY(e,n);if(r.length)return r[0];let i=EY(n),a=Z.default.subtract(i,HG);return ZY(a),OY(e,a)}function aY(e){let t;return t=e<0||e>9999?(e<0?`-`:`+`)+pq(Math.abs(e),6):pq(e,4),t}function oY(e){return pq(e,2)}function sY(e,t){let n;if(t===`auto`){if(e===0)return``;n=pq(e,9).replace(/0+$/,``)}else{if(t===0)return``;n=pq(e,9).slice(0,t)}return`.${n}`}function cY(e,t,n,r,i){let a=`${oY(e)}:${oY(t)}`;return i===`minute`||(a+=`:${oY(n)}`,a+=sY(r,i)),a}function lY(e,t,n){let r=t;r===void 0&&(r=`UTC`);let i=Q(e,XG),a=pY(eY(r,i),`iso8601`,n,`never`),o=`Z`;return t!==void 0&&(o=wY(QJ(r,i))),`${a}${o}`}function uY(e,t){let n=Q(e,aK),r=Q(e,oK),i=Q(e,sK),a=Q(e,cK),o=Q(e,lK),s=Q(e,uK),c=NY(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=HK.fromComponents(0,0,Q(e,dK),Q(e,fK),Q(e,pK),Q(e,mK));d.isZero()&&![`second`,`millisecond`,`microsecond`,`nanosecond`].includes(oJ(e))&&t===`auto`||(u+=`${Math.abs(d.sec)}${sY(Math.abs(d.subsec),t)}S`);let f=`${c<0?`-`:``}P${l}`;return u&&(f=`${f}T${u}`),f}function dY(e,t=`auto`){let{year:n,month:r,day:i}=Q(e,ZG);return`${aY(n)}-${oY(r)}-${oY(i)}${Nq(Q(e,eK),t)}`}function fY({hour:e,minute:t,second:n,millisecond:r,microsecond:i,nanosecond:a},o){return cY(e,t,n,1e6*r+1e3*i+a,o)}function pY(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`${aY(i)}-${oY(a)}-${oY(o)}T${cY(s,c,l,1e6*u+1e3*d+f,n)}${Nq(t,r)}`}function mY(e,t=`auto`){let{year:n,month:r,day:i}=Q(e,ZG),a=`${oY(r)}-${oY(i)}`,o=Q(e,eK);t!==`always`&&t!==`critical`&&o===`iso8601`||(a=`${aY(n)}-${a}`);let s=Nq(o,t);return s&&(a+=s),a}function hY(e,t=`auto`){let{year:n,month:r,day:i}=Q(e,ZG),a=`${aY(n)}-${oY(r)}`,o=Q(e,eK);t!==`always`&&t!==`critical`&&o===`iso8601`||(a+=`-${oY(i)}`);let s=Nq(o,t);return s&&(a+=s),a}function gY(e,t,n=`auto`,r=`auto`,i=`auto`,a=void 0){let o=Q(e,XG);if(a){let{unit:e,increment:t,roundingMode:n}=a;o=PX(o,t,e,n)}let s=Q(e,iK),c=QJ(s,o),l=pY(eY(s,o),`iso8601`,t,`never`);return i!==`never`&&(l+=wY(c)),r!==`never`&&(l+=`[${r===`critical`?`!`:``}${s}]`),l+=Nq(Q(e,eK),n),l}function _Y(e){return Bq.test(e)}function vY(e){let t=Mye.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 yY,Aye=Object.assign(Object.create(null),{"/":!0,"-":!0,_:!0});function bY(e){if(yY===void 0){let e=Intl.supportedValuesOf?.(`timeZone`);if(e){yY=new Map;for(let t=0;t<e.length;t++){let n=e[t];yY.set($X(n),n)}}else yY=null}let t=$X(e),n=yY?.get(t);if(n)return{identifier:n,primaryIdentifier:n};try{n=Cq(e).resolvedOptions().timeZone}catch{return}if(t===`antarctica/south_pole`&&(n=`Antarctica/McMurdo`),Tye.has(e))throw RangeError(`${e} is a legacy time zone identifier from ICU. Use ${n} instead`);let r=[...t].map(((e,n)=>n===0||Aye[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 xY(e,t){let{year:n,month:r,day:i,hour:a,minute:o,second:s}=AY(e,t),c=t%1e3;return c<0&&(c+=1e3),1e6*(TY({isoDate:{year:n,month:r,day:i},time:{hour:a,minute:o,second:s,millisecond:c}})-t)}function SY(e,t){return xY(e,UX(t,`floor`))}function CY(e){let t=e<0?`-`:`+`,n=Math.abs(e);return`${t}${cY(Math.floor(n/60),n%60,0,0,`minute`)}`}function wY(e){return CY(NX(e,bye,`halfExpand`)/6e10)}function TY({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()+Cye*c}function EY(e){let t=TY(e),n=1e3*e.time.microsecond+e.time.nanosecond;return Z.default.add(WX(t),Z.default.BigInt(n))}function DY(e){let t=UX(e,`trunc`),n=Z.default.toNumber(Z.default.remainder(e,zG));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 OY(e,t){if(e===`UTC`)return null;let n=UX(t,`floor`);if(n<oq)return OY(e,WX(oq));let r=Math.max(n,Date.now())+366*$K*3,i=n,a=xY(e,i),o=i,s=a;for(;a===s&&i<r;){if(o=i+2*$K*7,o>tq)return null;s=xY(e,o),a===s&&(i=o)}return a===s?null:WX(tZ((t=>xY(e,t)),i,o,a,s))}function kY(e,t){if(e===`UTC`)return null;let n=UX(t,`ceil`),r=Date.now(),i=r+366*$K*3;if(n>i){let t=kY(e,WX(i));if(t===null||Z.default.lessThan(t,WX(r)))return t}if(e===`Africa/Casablanca`||e===`Africa/El_Aaiun`){let t=Date.UTC(2088,0,1);if(t<n)return kY(e,WX(t))}let a=n-1;if(a<oq)return null;let o=xY(e,a),s=a,c=o;for(;o===c&&a>oq;){if(s=a-2*$K*7,s<oq)return null;c=xY(e,s),o===c&&(a=s)}return o===c?null:WX(tZ((t=>xY(e,t)),s,a,c,o))}function AY(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}}(Cq(e).format(t))}function jY(e){return e!==void 0&&!(e%4!=0||e%100==0&&e%400!=0)}function MY(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]}[jY(e)?`leapyear`:`standard`][t-1]}function NY(e){let t=[Q(e,aK),Q(e,oK),Q(e,sK),Q(e,cK),Q(e,lK),Q(e,uK),Q(e,dK),Q(e,fK),Q(e,pK),Q(e,mK)];for(let e=0;e<t.length;e++){let n=t[e];if(n!==0)return n<0?-1:1}return 0}function PY(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 FY(e){let t=PY(e.date);return t===0?e.time.sign():t}function IY(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 LY(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}=IY(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=jY(c)?366:365,a<-s;)--r,--c,a+=s;for(c+=1;s=jY(c)?366:365,a>s;)r+=1,c+=1,a-=s;for(;a<1;)({year:r,month:i}=IY(r,i-1)),a+=MY(r,i);for(;a>MY(r,i);)a-=MY(r,i),{year:r,month:i}=IY(r,i+1);return{year:r,month:i,day:a}}function RY(e,t,n,r,i,a,o,s,c){let l=zY(r,i,a,o,s,c);return qq(LY(e,t,n+l.deltaDays),l)}function zY(e,t,n,r,i,a){let o,s=e,c=t,l=n,u=r,d=i,f=a;({div:o,mod:f}=RK(f,3)),d+=o,f<0&&(--d,f+=1e3),{div:o,mod:d}=RK(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 BY(e,t){let n=Kq(e,0);if(PY(n)===0)return e.days;let r=Q(t,ZG),i=HJ(Q(t,eK),r,n,`constrain`),a=aX(r.year,r.month-1,r.day),o=aX(i.year,i.month-1,i.day)-a;return e.days+o}function VY(e){return new(LK(`%Temporal.Duration%`))(-Q(e,aK),-Q(e,oK),-Q(e,sK),-Q(e,cK),-Q(e,lK),-Q(e,uK),-Q(e,dK),-Q(e,fK),-Q(e,pK),-Q(e,mK))}function HY(e,t,n){return Math.min(n,Math.max(t,e))}function UY(e,t,n){let r=HY(t,1,12);return{year:e,month:r,day:HY(n,1,MY(e,r))}}function WY(e,t,n){if(e<t||e>n)throw RangeError(`value out of range: ${t} <= ${e} <= ${n}`)}function GY(e,t,n){WY(t,1,12),WY(n,1,MY(e,t))}function KY(e){YY(qq(e,{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}))}function qY(e,t,n,r,i,a){WY(e,0,23),WY(t,0,59),WY(n,0,59),WY(r,0,999),WY(i,0,999),WY(a,0,999)}function JY(e,t,n,r,i,a,o,s,c){GY(e,t,n),qY(r,i,a,o,s,c)}function YY(e){let t=EY(e);(Z.default.lessThan(t,xye)||Z.default.greaterThan(t,Sye))&&ZY(t)}function XY(e){EY(e)}function ZY(e){if(Z.default.lessThan(e,rq)||Z.default.greaterThan(e,nq))throw RangeError(`date/time value is outside of supported range`)}function QY({year:e,month:t}){WY(e,iq,aq),e===iq?WY(t,4,12):e===aq&&WY(t,1,9)}function $Y(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=RK(s,3),p=RK(c,6),m=RK(l,9),h=RK(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 eX(e){return{date:{years:Q(e,aK),months:Q(e,oK),weeks:Q(e,sK),days:Q(e,cK)},time:HK.fromComponents(Q(e,lK),Q(e,uK),Q(e,dK),Q(e,fK),Q(e,pK),Q(e,mK))}}function tX(e){let t=HK.fromComponents(Q(e,lK),Q(e,uK),Q(e,dK),Q(e,fK),Q(e,pK),Q(e,mK)).add24HourDays(Q(e,cK));return{date:{years:Q(e,aK),months:Q(e,oK),weeks:Q(e,sK),days:0},time:t}}function nX(e){let t=tX(e),n=Math.trunc(t.time.sec/86400);return $Y(t.date.years,t.date.months,t.date.weeks,n,0,0,0,0,0,0),{...t.date,days:n}}function rX(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=zK(o,3,Math.trunc(i/1e3)),i%=1e3,o=0;break;case`microsecond`:i=zK(o,6,Math.trunc(r/1e3)),r%=1e3,o=0;break;case`nanosecond`:r=zK(o,9,r),o=0}return new(LK(`%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 iX(e,t){return PY(e),t.sign(),{date:e,time:t}}function aX(e,t,n){return TY({isoDate:{year:e,month:t+1,day:n},time:{hour:0,minute:0,second:0,millisecond:0}})/$K}function oX({year:e,month:t,day:n}){if(Math.abs(aX(e,t-1,n))>1e8)throw RangeError(`date/time value is outside the supported range`)}function sX(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 HK.fromComponents(n,r,i,a,o,s)}function cX(e,t,n,r,i){let a=HK.fromEpochNsDiff(t,e);return a=LX(a,n,r,i),iX({years:0,months:0,weeks:0,days:0},a)}function lX(e,t,n,r){XY(e),XY(t);let i=sX(e.time,t.time),a=i.sign(),o=zX(e.isoDate,t.isoDate),s=t.isoDate;o===a&&(s=LY(s.year,s.month,s.day+a),i=i.add24HourDays(-a));let c=sJ(`day`,r),l=UJ(n,e.isoDate,s,c);return r!==c&&(i=i.add24HourDays(l.days),l.days=0),iX(l,i)}function uX(e,t,n,r,i){let a=Z.default.subtract(t,e);if(Z.default.equal(a,IG))return{date:{years:0,months:0,weeks:0,days:0},time:HK.ZERO};let o=Z.default.lessThan(a,IG)?-1:1,s=eY(n,e),c=eY(n,t),l,u=0,d=o===1?2:1,f=sX(s.time,c.time);for(f.sign()===-o&&u++;u<=d;u++){l=qq(LY(c.isoDate.year,c.isoDate.month,c.isoDate.day-u*o),s.time);let e=tY(n,l,`compatible`);if(f=HK.fromEpochNsDiff(t,e),f.sign()!==-o)break}let p=sJ(`day`,i);return iX(UJ(r,s.isoDate,l.isoDate,p),f)}function dX(e,t,n,r,i,a,o,s,c){let l,u,d,f,p=t;switch(s){case`year`:{let t=NX(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=NX(p.date.months,o,`trunc`);l=t,u=t+o*e,d=Kq(p.date,0,0,l),f=Kq(p.date,0,0,u);break}case`week`:{let t=Kq(p.date,0,0),n=HJ(a,r.isoDate,t,`constrain`),i=UJ(a,n,LY(n.year,n.month,n.day+p.date.days),`week`),s=NX(p.date.weeks+i.weeks,o,`trunc`);l=s,u=s+o*e,d=Kq(p.date,0,l),f=Kq(p.date,0,u);break}case`day`:{let t=NX(p.date.days,o,`trunc`);l=t,u=t+o*e,d=Kq(p.date,l),f=Kq(p.date,u);break}}let m=HJ(a,r.isoDate,d,`constrain`),h=HJ(a,r.isoDate,f,`constrain`),g,_,v=qq(m,r.time),y=qq(h,r.time);i?(g=tY(i,v,`compatible`),_=tY(i,y,`compatible`)):(g=EY(v),_=EY(y));let b=HK.fromEpochNsDiff(n,g),x=HK.fromEpochNsDiff(_,g),S=BK(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)?VK(Math.abs(l),Math.abs(u),C,w,S):Math.abs(u),E=new HK(Z.default.add(Z.default.multiply(x.totalNs,Z.default.BigInt(l)),Z.default.multiply(b.totalNs,Z.default.BigInt(o*e)))).fdiv(x.totalNs),D=T===Math.abs(u);return p={date:D?f:d,time:HK.ZERO},{nudgeResult:{duration:p,nudgedEpochNs:D?_:g,didExpandCalendarUnit:D},total:E}}function fX(e,t,n,r,i,a,o,s,c){let l=e,u=cJ(s)||r&&s===`day`,d=FY(l)<0?-1:1,f;return u?{nudgeResult:f}=dX(d,l,t,n,r,i,o,s,c):f=r?function(e,t,n,r,i,a,o,s){let c=t,l=HJ(i,n.isoDate,c.date,`constrain`),u=qq(l,n.time),d=qq(LY(l.year,l.month,l.day+e),n.time),f=tY(r,u,`compatible`),p=tY(r,d,`compatible`),m=HK.fromEpochNsDiff(p,f);if(m.sign()!==e)throw RangeError(`time zone returned inconsistent Instants`);let h=Z.default.BigInt(bq[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:iX(Kq(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(Z.default.BigInt(r*bq[i]),a),l=c.subtract(s),{quotient:u}=s.divmod(eq),{quotient:d}=c.divmod(eq),f=Math.sign(d-u)===s.sign(),p=l.addToEpochNs(t),m=0,h=c;return lJ(n)===`date`&&(m=d,h=c.add(HK.fromComponents(24*-d,0,0,0,0,0))),{duration:{date:Kq(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=yq.indexOf(o);for(let t=yq.indexOf(s)-1;t>=l;t--){let s=yq[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=Kq(c.date,0,0,t);break}case`week`:{let t=c.date.weeks+e;l=Kq(c.date,0,t);break}}let u=qq(HJ(a,r.isoDate,l,`constrain`),r.time),d;if(d=i?tY(i,u,`compatible`):EY(u),KG(n,d)===-e)break;c={date:l,time:HK.ZERO}}return c}(d,l,f.nudgedEpochNs,n,r,i,a,sJ(s,`day`))),l}function pX(e,t,n,r,i,a){return cJ(a)||r&&a===`day`?dX(FY(e)<0?-1:1,e,t,n,r,i,1,a,`trunc`).total:RX(e.time.add24HourDays(e.date.days),a)}function mX(e,t,n,r,i,a,o){if(VX(e,t)==0)return{date:{years:0,months:0,weeks:0,days:0},time:HK.ZERO};YY(e),YY(t);let s=lX(e,t,n,r);return a===`nanosecond`&&i===1?s:fX(s,EY(t),e,null,n,r,i,a,o)}function hX(e,t,n,r,i,a,o,s){if(lJ(i)===`time`)return cX(e,t,a,o,s);let c=uX(e,t,n,r,i);return o===`nanosecond`&&a===1?c:fX(c,t,eY(n,e),n,r,i,a,o,s)}function gX(e,t,n,r,i,a){let o=_q.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=iJ(t,`largestUnit`,n,`auto`);if(r.includes(s))throw RangeError(`largestUnit must be one of ${o.join(`, `)}, not ${s}`);let c=$q(t),l=Xq(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=iJ(t,`smallestUnit`,n,i);if(r.includes(u))throw RangeError(`smallestUnit must be one of ${o.join(`, `)}, not ${u}`);let d=sJ(a,u);if(s===`auto`&&(s=d),sJ(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&&eJ(c,f,!1),{largestUnit:s,roundingIncrement:c,roundingMode:l,smallestUnit:u}}function _X(e,t,n,r){let i=yJ(n),a=gX(e,YX(r),`time`,[],`nanosecond`,`second`),o=rX(cX(Q(t,XG),Q(i,XG),a.roundingIncrement,a.smallestUnit,a.roundingMode),a.largestUnit);return e===`since`&&(o=VY(o)),o}function vX(e,t,n,r){let i=hJ(n),a=Q(t,eK),o=Q(i,eK);if(!KJ(a,o))throw RangeError(`cannot compute difference between dates of ${a} and ${o} calendars`);let s=gX(e,YX(r),`date`,[],`day`,`day`),c=LK(`%Temporal.Duration%`),l=Q(t,ZG),u=Q(i,ZG);if(zX(l,u)===0)return new c;let d={date:UJ(a,l,u,s.largestUnit),time:HK.ZERO};if(s.smallestUnit!==`day`||s.roundingIncrement!==1){let e=qq(l,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});d=fX(d,EY(qq(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=rX(d,`day`);return e===`since`&&(f=VY(f)),f}function yX(e,t,n,r){let i=_J(n),a=Q(t,eK),o=Q(i,eK);if(!KJ(a,o))throw RangeError(`cannot compute difference between dates of ${a} and ${o} calendars`);let s=gX(e,YX(r),`datetime`,[],`nanosecond`,`day`),c=LK(`%Temporal.Duration%`),l=Q(t,QG),u=Q(i,QG);if(VX(l,u)===0)return new c;let d=rX(mX(l,u,a,s.largestUnit,s.roundingIncrement,s.smallestUnit,s.roundingMode),s.largestUnit);return e===`since`&&(d=VY(d)),d}function bX(e,t,n,r){let i=xJ(n),a=gX(e,YX(r),`time`,[],`nanosecond`,`hour`),o=sX(Q(t,$G),Q(i,$G));o=LX(o,a.roundingIncrement,a.smallestUnit,a.roundingMode);let s=rX(iX({years:0,months:0,weeks:0,days:0},o),a.largestUnit);return e===`since`&&(s=VY(s)),s}function xX(e,t,n,r){let i=CJ(n),a=Q(t,eK),o=Q(i,eK);if(!KJ(a,o))throw RangeError(`cannot compute difference between months of ${a} and ${o} calendars`);let s=gX(e,YX(r),`date`,[`week`,`day`],`month`,`year`),c=LK(`%Temporal.Duration%`);if(zX(Q(t,ZG),Q(i,ZG))==0)return new c;let l=fJ(a,Q(t,ZG),`year-month`);l.day=1;let u=qJ(a,l,`constrain`),d=fJ(a,Q(i,ZG),`year-month`);d.day=1;let f=qJ(a,d,`constrain`),p={date:Kq(UJ(a,u,f,s.largestUnit),0,0),time:HK.ZERO};if(s.smallestUnit!==`month`||s.roundingIncrement!==1){let e=qq(u,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});p=fX(p,EY(qq(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=rX(p,`day`);return e===`since`&&(m=VY(m)),m}function SX(e,t,n,r){let i=TJ(n),a=Q(t,eK),o=Q(i,eK);if(!KJ(a,o))throw RangeError(`cannot compute difference between dates of ${a} and ${o} calendars`);let s=gX(e,YX(r),`datetime`,[],`nanosecond`,`hour`),c=Q(t,XG),l=Q(i,XG),u=LK(`%Temporal.Duration%`),d;if(lJ(s.largestUnit)!==`date`)d=rX(cX(c,l,s.roundingIncrement,s.smallestUnit,s.roundingMode),s.largestUnit);else{let e=Q(t,iK);if(!ZJ(e,Q(i,iK)))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(Z.default.equal(c,l))return new u;d=rX(hX(c,l,e,a,s.largestUnit,s.roundingIncrement,s.smallestUnit,s.roundingMode),`hour`)}return e===`since`&&(d=VY(d)),d}function CX({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,zY(e,t,s,r,i,c)}function wX(e,t){let n=t.addToEpochNs(e);return ZY(n),n}function TX(e,t,n,r,i=`constrain`){if(PY(r.date)===0)return wX(e,r.time);let a=eY(t,e);return wX(tY(t,qq(HJ(n,a.isoDate,r.date,i),a.time),`compatible`),r.time)}function EX(e,t,n){let r=vJ(n);e===`subtract`&&(r=VY(r));let i=sJ(oJ(t),oJ(r));if(cJ(i))throw RangeError(`For years, months, or weeks arithmetic, use date arithmetic relative to a starting point`);let a=tX(t),o=tX(r);return rX(iX({years:0,months:0,weeks:0,days:0},a.time.add(o.time)),i)}function DX(e,t,n){let r=vJ(n);e===`subtract`&&(r=VY(r));let i=oJ(r);if(lJ(i)===`date`)throw RangeError(`Duration field ${i} not supported by Temporal.Instant. Try Temporal.ZonedDateTime instead.`);let a=tX(r);return LJ(wX(Q(t,XG),a.time))}function OX(e,t,n,r){let i=Q(t,eK),a=vJ(n);e===`subtract`&&(a=VY(a));let o=nX(a),s=Jq(YX(r));return DJ(HJ(i,Q(t,ZG),o,s),i)}function kX(e,t,n,r){let i=vJ(n);e===`subtract`&&(i=VY(i));let a=Jq(YX(r)),o=Q(t,eK),s=tX(i),c=Q(t,QG),l=CX(c.time,s.time),u=Kq(s.date,l.deltaDays);return $Y(u.years,u.months,u.weeks,u.days,0,0,0,0,0,0),kJ(qq(HJ(o,c.isoDate,u,a),l),o)}function AX(e,t,n){let r=vJ(n);e===`subtract`&&(r=VY(r));let i=tX(r),{hour:a,minute:o,second:s,millisecond:c,microsecond:l,nanosecond:u}=CX(Q(t,$G),i.time);return NJ(Wq(a,o,s,c,l,u,`reject`))}function jX(e,t,n,r){let i=vJ(n);e===`subtract`&&(i=VY(i));let a=Jq(YX(r)),o=NY(i),s=Q(t,eK),c=fJ(s,Q(t,ZG),`year-month`);c.day=1;let l=qJ(s,c,`constrain`);if(o<0){let e=HJ(s,l,{months:1},`constrain`);l=LY(e.year,e.month,e.day-1)}let u=nX(i);return KY(l),FJ(JJ(s,fJ(s,HJ(s,l,u,a),`year-month`),a),s)}function MX(e,t,n,r){let i=vJ(n);e===`subtract`&&(i=VY(i));let a=Jq(YX(r)),o=Q(t,iK),s=Q(t,eK),c=eX(i);return zJ(TX(Q(t,XG),o,s,c,a),o,s)}function NX(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=JX(Math.abs(2*i)-t),l=o%2==0,u=BK(n,a),d=i===0?o:VK(o,s,c,l,u);return t*(a===`positive`?d:-d)}function PX(e,t,n,r){let i=bq[n]*t;return function(e,t,n){let r=UG(e),i=UG(t),a=Z.default.divide(r,i),o=Z.default.remainder(r,i),s=BK(n,`positive`),c,l;Z.default.lessThan(r,IG)?(c=Z.default.subtract(a,LG),l=a):(c=a,l=Z.default.add(a,LG));let u=KG(GG(Z.default.multiply(o,RG)),i)*(Z.default.lessThan(r,IG)?-1:1)+0,d=Z.default.equal(o,IG)?a:VK(c,l,u,WG(c),s);return Z.default.multiply(d,i)}(e,Z.default.BigInt(i),r)}function FX(e,t,n,r){XY(e);let{year:i,month:a,day:o}=e.isoDate,s=IX(e.time,t,n,r);return qq(LY(i,a,o+s.deltaDays),s)}function IX({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=bq[s],d=NX(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 zY(d,0,0,0,0,0);case`minute`:return zY(e,d,0,0,0,0);case`second`:return zY(e,t,d,0,0,0);case`millisecond`:return zY(e,t,n,d,0,0);case`microsecond`:return zY(e,t,n,r,d,0);case`nanosecond`:return zY(e,t,n,r,i,d);default:throw Error(`Invalid unit ${s}`)}}function LX(e,t,n,r){let i=bq[n];return e.round(Z.default.BigInt(i*t),r)}function RX(e,t){let n=bq[t];return e.fdiv(Z.default.BigInt(n))}function zX(e,t){return e.year===t.year?e.month===t.month?e.day===t.day?0:JX(e.day-t.day):JX(e.month-t.month):JX(e.year-t.year)}function BX(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:JX(e.nanosecond-t.nanosecond):JX(e.microsecond-t.microsecond):JX(e.millisecond-t.millisecond):JX(e.second-t.second):JX(e.minute-t.minute):JX(e.hour-t.hour)}function VX(e,t){let n=zX(e.isoDate,t.isoDate);return n===0?BX(e.time,t.time):n}function HX(e){let t=GX(e);return globalThis.BigInt===void 0?t:globalThis.BigInt(t.toString(10))}function UX(e,t){let{quotient:n,remainder:r}=qG(UG(e),zG),i=Z.default.toNumber(n);return t===`floor`&&Z.default.toNumber(r)<0&&--i,t===`ceil`&&Z.default.toNumber(r)>0&&(i+=1),i}function WX(e){if(!Number.isInteger(e))throw RangeError(`epoch milliseconds must be an integer`);return Z.default.multiply(Z.default.BigInt(e),zG)}function GX(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`?Z.default.BigInt(t.toString(10)):Z.default.BigInt(t)}var KX=(()=>{let e=Z.default.BigInt(Date.now()%1e6);return()=>{let t=Date.now(),n=Z.default.BigInt(t),r=Z.default.add(WX(t),e);return e=Z.default.remainder(n,zG),Z.default.greaterThan(r,nq)?nq:Z.default.lessThan(r,rq)?rq:r}})();function qX(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}function JX(e){return e<0?-1:e>0?1:e}function YX(e){if(e===void 0)return Object.create(null);if(sq(e)&&e!==null)return e;throw TypeError(`Options parameter must be an object, not `+(e===null?`null`:typeof e))}function XX(e,t){let n=Object.create(null);return n[e]=t,n}function ZX(e,t,n,r){let i=e[t];if(i!==void 0){if(i=lq(i),!n.includes(i))throw RangeError(`${t} must be one of ${n.join(`, `)}, not ${i}`);return i}if(r===rJ)throw RangeError(`${t} option is required`);return r}function QX(e){let t=$X(e);if(!wye.includes($X(t)))throw RangeError(`invalid calendar identifier ${t}`);switch(t){case`ethiopic-amete-alem`:return`ethioaa`;case`islamicc`:return`islamic-civil`}return t}function $X(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 eZ(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 jye=RegExp(`^${YK.source}$`),Mye=RegExp(`^([+-])([01][0-9]|2[0-3])(?::?([0-5][0-9])(?::?([0-5][0-9])(?:[.,](\\d{1,9}))?)?)?$`);function tZ(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 nZ(e){return[...e]}function rZ(e,t){if(e!==`gregory`&&e!==`iso8601`)return;let n=aZ[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 iZ(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 aZ={};function oZ(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 sZ(e,t=!1){return`M${`${e}`.padStart(2,`0`)}${t?`L`:``}`}function cZ(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`&&WY(r,1,n),t===`constrain`&&(r=HY(r,1,n)),i=sZ(r)}else{let e=oZ(i);if(i!==sZ(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}}aZ.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,cZ(e))},dateToISO:(e,t)=>Uq(e.year,e.month,e.day,t),monthDayToISOReferenceDate(e,t){let{month:n,day:r}=Uq(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 nZ(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}=IY(o,s),{year:o,month:s,day:c}=Uq(o,s,c,a),c+=i+7*r,LY(o,s,c)},dateUntil(e,t,n){let r=-zX(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);!iZ(r,e.year+s,e.month,e.day,t);)a=s,s+=r;let c=r;for(i=IY(e.year+a,e.month+c);!iZ(r,i.year,i.month,e.day,t);)o=c,c+=r,i=IY(i.year,i.month+r);n===`month`&&(o+=12*a,a=0)}i=IY(e.year+a,e.month+o);let s=UY(i.year,i.month,e.day),c=0,l=aX(t.year,t.month-1,t.day)-aX(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=sZ(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+=MY(e,n);i.dayOfYear=r}return r.weekOfYear&&(i.weekOfYear=rZ(`iso8601`,{year:e,month:t,day:n})),r.daysInMonth&&(i.daysInMonth=MY(e,t)),(r.daysInYear||r.inLeapYear)&&(i.inLeapYear=jY(e),i.daysInYear=i.inLeapYear?366:365),i},getFirstDayOfWeek:()=>1,getMinimalDaysInFirstWeek:()=>4};var lZ=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 uZ({isoYear:e,isoMonth:t,isoDay:n}){return`${aY(e)}-${oY(t)}-${oY(n)}T00:00Z`}function dZ(e,t){return{years:e.year-t.year,months:e.month-t.month,days:e.day-t.day}}lZ.objectMap=new WeakMap,lZ.MAX_CACHE_ENTRIES=1e3;var fZ=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=uZ({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}=cZ(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`?(WY(i,1,r),WY(a,1,this.maximumMonthLength(e))):(i=HY(i,1,r),a=HY(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=dZ(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=dZ(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=dZ(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:JX(e.day-t.day):JX(e.month-t.month):JX(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 LY(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 aX(i.year,i.month-1,i.day)-aX(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(){}},Nye=class extends fZ{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?sZ(5,!0):sZ(t<6?t:t-1):sZ(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=oZ(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`?(WY(a,1,this.monthsInYear({year:i})),WY(s,1,this.maximumMonthLength({year:i,month:a}))):(a=HY(a,1,this.monthsInYear({year:i})),s=HY(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}}},pZ=class extends fZ{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}}},Pye=class extends pZ{constructor(){super(...arguments),this.id=`islamic`}},Fye=class extends pZ{constructor(){super(...arguments),this.id=`islamic-umalqura`}},Iye=class extends pZ{constructor(){super(...arguments),this.id=`islamic-tbla`}},Lye=class extends pZ{constructor(){super(...arguments),this.id=`islamic-civil`}},Rye=class extends pZ{constructor(){super(...arguments),this.id=`islamic-rgsa`}},zye=class extends pZ{constructor(){super(...arguments),this.id=`islamicc`}},Bye=class extends fZ{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 oZ(e)<=6?31:30}estimateIsoDate(e){let{year:t}=this.adjustCalendarDate(e);return{year:t+621,month:1,day:1}}},Vye=class extends fZ{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 mZ(e.year+78)}monthsInYear(){return 12}minimumMonthLength(e){return this.getMonthInfo(e).length}maximumMonthLength(e){return this.getMonthInfo(e).length}maxLengthOfMonthCodeInAnyYear(e){let t=oZ(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 LY(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 mZ(e){return e%4==0&&(e%100!=0||e%400==0)}var hZ=class extends fZ{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 mZ(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][oZ(e)-1]}estimateIsoDate(e){let t=this.adjustCalendarDate(e);return Uq(t.year+this.isoEpoch.year,t.month+this.isoEpoch.month,t.day+this.isoEpoch.day,`constrain`)}},gZ=class extends fZ{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 mZ(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][oZ(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:oZ(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 Uq(t+i.isoEpoch.year-+!i.hasYearZero,n,r,`constrain`)}},_Z=class extends gZ{constructor(e,t){super(e,t)}isoToCalendarDate(e){let{year:t,month:n,day:r}=e,i=sZ(n),a=t-this.anchorEra.isoEpoch.year+1;return this.completeEraYear({year:a,month:n,monthCode:i,day:r})}},vZ={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},Hye=class extends hZ{constructor(e,t){super(e,t),this.inLeapYear=vZ.inLeapYear,this.monthsInYear=vZ.monthsInYear,this.minimumMonthLength=vZ.minimumMonthLength,this.maximumMonthLength=vZ.maximumMonthLength,this.maxLengthOfMonthCodeInAnyYear=vZ.maxLengthOfMonthCodeInAnyYear}},yZ=class extends gZ{constructor(e,t){super(e,t),this.inLeapYear=vZ.inLeapYear,this.monthsInYear=vZ.monthsInYear,this.minimumMonthLength=vZ.minimumMonthLength,this.maximumMonthLength=vZ.maximumMonthLength,this.maxLengthOfMonthCodeInAnyYear=vZ.maxLengthOfMonthCodeInAnyYear}},Uye=class extends Hye{constructor(){super(`ethioaa`,{year:-5492,month:7,day:17})}},Wye=class extends yZ{constructor(){super(`coptic`,[{code:`coptic`,isoEpoch:{year:284,month:8,day:29}},{code:`coptic-inverse`,reverseOf:`coptic`}])}},Gye=class extends yZ{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}}])}},Kye=class extends _Z{constructor(){super(`roc`,[{code:`roc`,names:[`minguo`],isoEpoch:{year:1912,month:1,day:1}},{code:`roc-inverse`,names:[`before-roc`],reverseOf:`roc`}])}},qye=class extends hZ{constructor(){super(`buddhist`,{year:-543,month:1,day:1})}},Jye=class extends _Z{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}},Yye=class extends _Z{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}}},bZ=class extends fZ{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=uZ({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=sZ(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=sZ(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`?(WY(a,1,o),WY(s,1,this.maximumMonthLength())):(a=HY(a,1,o),s=HY(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=sZ(+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}}},Xye=class extends bZ{constructor(){super(...arguments),this.id=`chinese`}},Zye=class extends bZ{constructor(){super(...arguments),this.id=`dangi`}},Qye=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 lZ;cZ(e,void 0,this.helper.monthsInYear({year:e.year??1972},t))}}dateToISO(e,t){let n=new lZ,r=this.helper.calendarToIsoDate(e,t,n);return n.setObject(r),r}monthDayToISOReferenceDate(e,t){let n=new lZ,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 nZ(t)}dateAdd(e,{years:t,months:n,weeks:r,days:i},a){let o=lZ.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 lZ.getCacheForObject(l)||new lZ(o).setObject(l),l}dateUntil(e,t,n){let r=lZ.getCacheForObject(e),i=lZ.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=lZ.getCacheForObject(e),r=this.helper.isoToCalendarDate(e,n);if(t.dayOfWeek&&(r.dayOfWeek=aZ.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=rZ(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[Nye,Bye,Gye,Uye,Wye,Xye,Zye,Kye,Vye,qye,Jye,Yye,Pye,Fye,Iye,Lye,Rye,zye]){let t=new e;aZ[t.id]=new Qye(t)}IK(`calendarImpl`,(function(e){return aZ[e]}));var xZ=Intl.DateTimeFormat;function SZ(e,t){let n=Q(e,t);return typeof n==`function`&&(n=new xZ(Q(e,TK),n(Q(e,EK))),function(e,t,n){let r=kK(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 CZ(e){return MK(e,xK)}var wZ=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 xZ(t,i),o=a.resolvedOptions();if(jK(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,NK(e,EK,t)}else NK(e,EK,i);NK(e,TK,o.locale),NK(e,xK,a),NK(e,SK,o.timeZone),NK(e,wK,o.calendar),NK(e,hK,sbe),NK(e,gK,abe),NK(e,_K,obe),NK(e,vK,ibe),NK(e,yK,cbe),NK(e,bK,lbe);let s=r?i.timeZone:void 0;if(s===void 0)NK(e,CK,o.timeZone);else{let t=lq(s);if(t.startsWith(`−`))throw RangeError(`Unicode minus (U+2212) is not supported in time zone offsets`);NK(e,CK,XJ(t))}})(this,e,t)}get format(){$(this,CZ);let e=ebe.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,CZ),nbe.call(this,e,t)}formatToParts(e,...t){return $(this,CZ),tbe.call(this,e,...t)}formatRangeToParts(e,t){return $(this,CZ),rbe.call(this,e,t)}resolvedOptions(){return $(this,CZ),$ye.call(this)}};`formatToParts`in xZ.prototype||delete wZ.prototype.formatToParts,`formatRangeToParts`in xZ.prototype||delete wZ.prototype.formatRangeToParts;var TZ=function(e=void 0,t=void 0){return new wZ(e,t)};function $ye(){let e=Q(this,xK).resolvedOptions();return e.timeZone=Q(this,CK),e}function ebe(e,...t){let n,r,i=NZ(e,this);return i.formatter?(n=i.formatter,r=[UX(i.epochNs,`floor`)]):(n=Q(this,xK),r=[e,...t]),n.format(...r)}function tbe(e,...t){let n,r,i=NZ(e,this);return i.formatter?(n=i.formatter,r=[UX(i.epochNs,`floor`)]):(n=Q(this,xK),r=[e,...t]),n.formatToParts(...r)}function nbe(e,t){if(e===void 0||t===void 0)throw TypeError(`Intl.DateTimeFormat.formatRange requires two values`);let n=jZ(e),r=jZ(t),i,a=[n,r];if(AZ(n)!==AZ(r))throw TypeError(`Intl.DateTimeFormat.formatRange accepts two values of the same type`);if(AZ(n)){if(!MZ(n,r))throw TypeError(`Intl.DateTimeFormat.formatRange accepts two values of the same type`);let{epochNs:e,formatter:t}=NZ(n,this),{epochNs:o,formatter:s}=NZ(r,this);t&&(i=t,a=[UX(e,`floor`),UX(o,`floor`)])}return i||=Q(this,xK),i.formatRange(...a)}function rbe(e,t){if(e===void 0||t===void 0)throw TypeError(`Intl.DateTimeFormat.formatRange requires two values`);let n=jZ(e),r=jZ(t),i,a=[n,r];if(AZ(n)!==AZ(r))throw TypeError(`Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type`);if(AZ(n)){if(!MZ(n,r))throw TypeError(`Intl.DateTimeFormat.formatRangeToParts accepts two values of the same type`);let{epochNs:e,formatter:t}=NZ(n,this),{epochNs:o,formatter:s}=NZ(r,this);t&&(i=t,a=[UX(e,`floor`),UX(o,`floor`)])}return i||=Q(this,xK),i.formatRangeToParts(...a)}function EZ(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 ibe(e){let t=EZ(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`})),!OZ(t)){if(kZ(e))throw TypeError(`cannot format Temporal.PlainTime with options [${Object.keys(e)}]`);Object.assign(t,{hour:`numeric`,minute:`numeric`,second:`numeric`})}return t}function abe(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=EZ(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(kZ(e))throw TypeError(`cannot format PlainYearMonth with options [${Object.keys(e)}]`);Object.assign(n,{year:`numeric`,month:`numeric`})}return n}function obe(e){let t={short:{month:`numeric`,day:`numeric`},medium:{month:`short`,day:`numeric`},long:{month:`long`,day:`numeric`},full:{month:`long`,day:`numeric`}},n=EZ(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(kZ(e))throw TypeError(`cannot format PlainMonthDay with options [${Object.keys(e)}]`);Object.assign(n,{month:`numeric`,day:`numeric`})}return n}function sbe(e){let t=EZ(e,{hour:!1,minute:!1,second:!1,dayPeriod:!1,timeZoneName:!1,timeStyle:!1});if(!DZ(t)){if(kZ(e))throw TypeError(`cannot format PlainDate with options [${Object.keys(e)}]`);Object.assign(t,{year:`numeric`,month:`numeric`,day:`numeric`})}return t}function cbe(e){let t=EZ(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),!OZ(t)&&!DZ(t)){if(kZ(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 lbe(e){let t=e;return OZ(t)||DZ(t)||(t=Object.assign({},t,{year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`})),t}function DZ(e){return`year`in e||`month`in e||`day`in e||`weekday`in e||`dateStyle`in e||`era`in e}function OZ(e){return`hour`in e||`minute`in e||`second`in e||`timeStyle`in e||`dayPeriod`in e||`fractionalSecondDigits`in e}function kZ(e){return DZ(e)||OZ(e)||`dateStyle`in e||`timeStyle`in e||`timeZoneName`in e}function AZ(e){return Eq(e)||Dq(e)||Oq(e)||jq(e)||kq(e)||Aq(e)||wq(e)}function jZ(e){return AZ(e)?e:cq(e)}function MZ(e,t){return!(!AZ(e)||!AZ(t)||Dq(e)&&!Dq(t)||Eq(e)&&!Eq(t)||Oq(e)&&!Oq(t)||jq(e)&&!jq(t)||kq(e)&&!kq(t)||Aq(e)&&!Aq(t)||wq(e)&&!wq(t))}function NZ(e,t){if(Dq(e)){let n={isoDate:{year:1970,month:1,day:1},time:Q(e,$G)};return{epochNs:tY(Q(t,SK),n,`compatible`),formatter:SZ(t,vK)}}if(kq(e)){let n=Q(e,eK),r=Q(t,wK);if(n!==r)throw RangeError(`cannot format PlainYearMonth with calendar ${n} in locale with calendar ${r}`);let i=qq(Q(e,ZG),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:tY(Q(t,SK),i,`compatible`),formatter:SZ(t,gK)}}if(Aq(e)){let n=Q(e,eK),r=Q(t,wK);if(n!==r)throw RangeError(`cannot format PlainMonthDay with calendar ${n} in locale with calendar ${r}`);let i=qq(Q(e,ZG),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:tY(Q(t,SK),i,`compatible`),formatter:SZ(t,_K)}}if(Eq(e)){let n=Q(e,eK),r=Q(t,wK);if(n!==`iso8601`&&n!==r)throw RangeError(`cannot format PlainDate with calendar ${n} in locale with calendar ${r}`);let i=qq(Q(e,ZG),{deltaDays:0,hour:12,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});return{epochNs:tY(Q(t,SK),i,`compatible`),formatter:SZ(t,hK)}}if(Oq(e)){let n=Q(e,eK),r=Q(t,wK);if(n!==`iso8601`&&n!==r)throw RangeError(`cannot format PlainDateTime with calendar ${n} in locale with calendar ${r}`);let i=Q(e,QG);return{epochNs:tY(Q(t,SK),i,`compatible`),formatter:SZ(t,yK)}}if(jq(e))throw TypeError(`Temporal.ZonedDateTime not supported in DateTimeFormat methods. Use toLocaleString() instead.`);return wq(e)?{epochNs:Q(e,XG),formatter:SZ(t,bK)}:{}}function PZ(e){let t=Object.create(null);return t.years=Q(e,aK),t.months=Q(e,oK),t.weeks=Q(e,sK),t.days=Q(e,cK),t.hours=Q(e,lK),t.minutes=Q(e,uK),t.seconds=Q(e,dK),t.milliseconds=Q(e,fK),t.microseconds=Q(e,pK),t.nanoseconds=Q(e,mK),t}wZ.prototype.constructor=TZ,Object.defineProperty(TZ,"prototype",{value:wZ.prototype,writable:!1,enumerable:!1,configurable:!1}),TZ.supportedLocalesOf=xZ.supportedLocalesOf,FK(TZ,`Intl.DateTimeFormat`);var{format:ube,formatToParts:dbe}=Intl.DurationFormat?.prototype??Object.create(null);function FZ(e){Intl.DurationFormat.prototype.resolvedOptions.call(this);let t=PZ(vJ(e));return ube.call(this,t)}Intl.DurationFormat?.prototype&&(Intl.DurationFormat.prototype.format=FZ,Intl.DurationFormat.prototype.formatToParts=function(e){Intl.DurationFormat.prototype.resolvedOptions.call(this);let t=PZ(vJ(e));return dbe.call(this,t)}),Object.freeze({__proto__:null,DateTimeFormat:TZ,ModifiedIntlDurationFormatPrototypeFormat:FZ});var IZ=class{constructor(e){if(arguments.length<1)throw TypeError(`missing argument: epochNanoseconds is required`);IJ(this,GX(e))}get epochMilliseconds(){return $(this,wq),UX(Q(this,XG),`floor`)}get epochNanoseconds(){return $(this,wq),HX(Z.default.BigInt(Q(this,XG)))}add(e){return $(this,wq),DX(`add`,this,e)}subtract(e){return $(this,wq),DX(`subtract`,this,e)}until(e,t=void 0){return $(this,wq),_X(`until`,this,e,t)}since(e,t=void 0){return $(this,wq),_X(`since`,this,e,t)}round(e){if($(this,wq),e===void 0)throw TypeError(`options parameter is required`);let t=typeof e==`string`?XX(`smallestUnit`,e):YX(e),n=$q(t),r=Xq(t,`halfExpand`),i=iJ(t,`smallestUnit`,`time`,rJ);return eJ(n,{hour:24,minute:1440,second:86400,millisecond:864e5,microsecond:864e8,nanosecond:864e11}[i],!0),LJ(PX(Q(this,XG),n,i,r))}equals(e){$(this,wq);let t=yJ(e),n=Q(this,XG),r=Q(t,XG);return Z.default.equal(Z.default.BigInt(n),Z.default.BigInt(r))}toString(e=void 0){$(this,wq);let t=YX(e),n=tJ(t),r=Xq(t,`trunc`),i=iJ(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=XJ(a));let{precision:o,unit:s,increment:c}=nJ(i,n);return lY(LJ(PX(Q(this,XG),c,s,r)),a,o)}toJSON(){return $(this,wq),lY(this,void 0,`auto`)}toLocaleString(e=void 0,t=void 0){return $(this,wq),new TZ(e,t).format(this)}valueOf(){eZ(`Instant`)}toZonedDateTimeISO(e){$(this,wq);let t=XJ(e);return zJ(Q(this,XG),t,`iso8601`)}static fromEpochMilliseconds(e){return LJ(WX(cq(e)))}static fromEpochNanoseconds(e){return LJ(GX(e))}static from(e){return yJ(e)}static compare(e,t){let n=yJ(e),r=yJ(t),i=Q(n,XG),a=Q(r,XG);return Z.default.lessThan(i,a)?-1:+!!Z.default.greaterThan(i,a)}};FK(IZ,`Temporal.Instant`);var LZ=class{constructor(e,t,n,r=`iso8601`){let i=uq(e),a=uq(t),o=uq(n),s=QX(r===void 0?`iso8601`:mq(r));GY(i,a,o),EJ(this,{year:i,month:a,day:o},s)}get calendarId(){return $(this,Eq),Q(this,eK)}get era(){return RZ(this,`era`)}get eraYear(){return RZ(this,`eraYear`)}get year(){return RZ(this,`year`)}get month(){return RZ(this,`month`)}get monthCode(){return RZ(this,`monthCode`)}get day(){return RZ(this,`day`)}get dayOfWeek(){return RZ(this,`dayOfWeek`)}get dayOfYear(){return RZ(this,`dayOfYear`)}get weekOfYear(){return RZ(this,`weekOfYear`)?.week}get yearOfWeek(){return RZ(this,`weekOfYear`)?.year}get daysInWeek(){return RZ(this,`daysInWeek`)}get daysInMonth(){return RZ(this,`daysInMonth`)}get daysInYear(){return RZ(this,`daysInYear`)}get monthsInYear(){return RZ(this,`monthsInYear`)}get inLeapYear(){return RZ(this,`inLeapYear`)}with(e,t=void 0){if($(this,Eq),!sq(e))throw TypeError(`invalid argument`);Mq(e);let n=Q(this,eK),r=fJ(n,Q(this,ZG));return r=VJ(n,r,pJ(n,e,[`year`,`month`,`monthCode`,`day`],[],`partial`)),DJ(qJ(n,r,Jq(YX(t))),n)}withCalendar(e){$(this,Eq);let t=WJ(e);return DJ(Q(this,ZG),t)}add(e,t=void 0){return $(this,Eq),OX(`add`,this,e,t)}subtract(e,t=void 0){return $(this,Eq),OX(`subtract`,this,e,t)}until(e,t=void 0){return $(this,Eq),vX(`until`,this,e,t)}since(e,t=void 0){return $(this,Eq),vX(`since`,this,e,t)}equals(e){$(this,Eq);let t=hJ(e);return zX(Q(this,ZG),Q(t,ZG))===0&&KJ(Q(this,eK),Q(t,eK))}toString(e=void 0){return $(this,Eq),dY(this,Qq(YX(e)))}toJSON(){return $(this,Eq),dY(this)}toLocaleString(e=void 0,t=void 0){return $(this,Eq),new TZ(e,t).format(this)}valueOf(){eZ(`PlainDate`)}toPlainDateTime(e=void 0){$(this,Eq);let t=SJ(e);return kJ(qq(Q(this,ZG),t),Q(this,eK))}toZonedDateTime(e){let t,n;if($(this,Eq),sq(e)){let r=e.timeZone;r===void 0?t=XJ(e):(t=XJ(r),n=e.plainTime)}else t=XJ(e);let r=Q(this,ZG),i;return n===void 0?i=iY(t,r):(n=xJ(n),i=tY(t,qq(r,Q(n,$G)),`compatible`)),zJ(i,t,Q(this,eK))}toPlainYearMonth(){$(this,Eq);let e=Q(this,eK);return FJ(JJ(e,fJ(e,Q(this,ZG)),`constrain`),e)}toPlainMonthDay(){$(this,Eq);let e=Q(this,eK);return jJ(YJ(e,fJ(e,Q(this,ZG)),`constrain`),e)}static from(e,t=void 0){return hJ(e,t)}static compare(e,t){let n=hJ(e),r=hJ(t);return zX(Q(n,ZG),Q(r,ZG))}};function RZ(e,t){$(e,Eq);let n=Q(e,ZG);return dJ(e).isoToDate(n,{[t]:!0})[t]}FK(LZ,`Temporal.PlainDate`);var zZ=class{constructor(e,t,n,r=0,i=0,a=0,o=0,s=0,c=0,l=`iso8601`){let u=uq(e),d=uq(t),f=uq(n),p=r===void 0?0:uq(r),m=i===void 0?0:uq(i),h=a===void 0?0:uq(a),g=o===void 0?0:uq(o),_=s===void 0?0:uq(s),v=c===void 0?0:uq(c),y=QX(l===void 0?`iso8601`:mq(l));JY(u,d,f,p,m,h,g,_,v),OJ(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,Oq),Q(this,eK)}get year(){return BZ(this,`year`)}get month(){return BZ(this,`month`)}get monthCode(){return BZ(this,`monthCode`)}get day(){return BZ(this,`day`)}get hour(){return VZ(this,`hour`)}get minute(){return VZ(this,`minute`)}get second(){return VZ(this,`second`)}get millisecond(){return VZ(this,`millisecond`)}get microsecond(){return VZ(this,`microsecond`)}get nanosecond(){return VZ(this,`nanosecond`)}get era(){return BZ(this,`era`)}get eraYear(){return BZ(this,`eraYear`)}get dayOfWeek(){return BZ(this,`dayOfWeek`)}get dayOfYear(){return BZ(this,`dayOfYear`)}get weekOfYear(){return BZ(this,`weekOfYear`)?.week}get yearOfWeek(){return BZ(this,`weekOfYear`)?.year}get daysInWeek(){return BZ(this,`daysInWeek`)}get daysInYear(){return BZ(this,`daysInYear`)}get daysInMonth(){return BZ(this,`daysInMonth`)}get monthsInYear(){return BZ(this,`monthsInYear`)}get inLeapYear(){return BZ(this,`inLeapYear`)}with(e,t=void 0){if($(this,Oq),!sq(e))throw TypeError(`invalid argument`);Mq(e);let n=Q(this,eK),r=Q(this,QG),i={...fJ(n,r.isoDate),...r.time};return i=VJ(n,i,pJ(n,e,[`year`,`month`,`monthCode`,`day`],[`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`],`partial`)),kJ(gJ(n,i,Jq(YX(t))),n)}withPlainTime(e=void 0){$(this,Oq);let t=SJ(e);return kJ(qq(Q(this,QG).isoDate,t),Q(this,eK))}withCalendar(e){$(this,Oq);let t=WJ(e);return kJ(Q(this,QG),t)}add(e,t=void 0){return $(this,Oq),kX(`add`,this,e,t)}subtract(e,t=void 0){return $(this,Oq),kX(`subtract`,this,e,t)}until(e,t=void 0){return $(this,Oq),yX(`until`,this,e,t)}since(e,t=void 0){return $(this,Oq),yX(`since`,this,e,t)}round(e){if($(this,Oq),e===void 0)throw TypeError(`options parameter is required`);let t=typeof e==`string`?XX(`smallestUnit`,e):YX(e),n=$q(t),r=Xq(t,`halfExpand`),i=iJ(t,`smallestUnit`,`time`,rJ,[`day`]),a={day:1,hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[i];eJ(n,a,a===1);let o=Q(this,QG);return kJ(n===1&&i===`nanosecond`?o:FX(o,n,i,r),Q(this,eK))}equals(e){$(this,Oq);let t=_J(e);return VX(Q(this,QG),Q(t,QG))===0&&KJ(Q(this,eK),Q(t,eK))}toString(e=void 0){$(this,Oq);let t=YX(e),n=Qq(t),r=tJ(t),i=Xq(t,`trunc`),a=iJ(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}=nJ(a,r),l=FX(Q(this,QG),c,s,i);return YY(l),pY(l,Q(this,eK),o,n)}toJSON(){return $(this,Oq),pY(Q(this,QG),Q(this,eK),`auto`)}toLocaleString(e=void 0,t=void 0){return $(this,Oq),new TZ(e,t).format(this)}valueOf(){eZ(`PlainDateTime`)}toZonedDateTime(e,t=void 0){$(this,Oq);let n=XJ(e),r=Yq(YX(t));return zJ(tY(n,Q(this,QG),r),n,Q(this,eK))}toPlainDate(){return $(this,Oq),DJ(Q(this,QG).isoDate,Q(this,eK))}toPlainTime(){return $(this,Oq),NJ(Q(this,QG).time)}static from(e,t=void 0){return _J(e,t)}static compare(e,t){let n=_J(e),r=_J(t);return VX(Q(n,QG),Q(r,QG))}};function BZ(e,t){$(e,Oq);let n=Q(e,QG).isoDate;return dJ(e).isoToDate(n,{[t]:!0})[t]}function VZ(e,t){return $(e,Oq),Q(e,QG).time[t]}FK(zZ,`Temporal.PlainDateTime`);var HZ=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:fq(e),d=t===void 0?0:fq(t),f=n===void 0?0:fq(n),p=r===void 0?0:fq(r),m=i===void 0?0:fq(i),h=a===void 0?0:fq(a),g=o===void 0?0:fq(o),_=s===void 0?0:fq(s),v=c===void 0?0:fq(c),y=l===void 0?0:fq(l);$Y(u,d,f,p,m,h,g,_,v,y),jK(this),NK(this,aK,u),NK(this,oK,d),NK(this,sK,f),NK(this,cK,p),NK(this,lK,m),NK(this,uK,h),NK(this,dK,g),NK(this,fK,_),NK(this,pK,v),NK(this,mK,y)}get years(){return $(this,Tq),Q(this,aK)}get months(){return $(this,Tq),Q(this,oK)}get weeks(){return $(this,Tq),Q(this,sK)}get days(){return $(this,Tq),Q(this,cK)}get hours(){return $(this,Tq),Q(this,lK)}get minutes(){return $(this,Tq),Q(this,uK)}get seconds(){return $(this,Tq),Q(this,dK)}get milliseconds(){return $(this,Tq),Q(this,fK)}get microseconds(){return $(this,Tq),Q(this,pK)}get nanoseconds(){return $(this,Tq),Q(this,mK)}get sign(){return $(this,Tq),NY(this)}get blank(){return $(this,Tq),NY(this)===0}with(t){$(this,Tq);let{years:n=Q(this,aK),months:r=Q(this,oK),weeks:i=Q(this,sK),days:a=Q(this,cK),hours:o=Q(this,lK),minutes:s=Q(this,uK),seconds:c=Q(this,dK),milliseconds:l=Q(this,fK),microseconds:u=Q(this,pK),nanoseconds:d=Q(this,mK)}=Gq(t);return new e(n,r,i,a,o,s,c,l,u,d)}negated(){return $(this,Tq),VY(this)}abs(){return $(this,Tq),new e(Math.abs(Q(this,aK)),Math.abs(Q(this,oK)),Math.abs(Q(this,sK)),Math.abs(Q(this,cK)),Math.abs(Q(this,lK)),Math.abs(Q(this,uK)),Math.abs(Q(this,dK)),Math.abs(Q(this,fK)),Math.abs(Q(this,pK)),Math.abs(Q(this,mK)))}add(e){return $(this,Tq),EX(`add`,this,e)}subtract(e){return $(this,Tq),EX(`subtract`,this,e)}round(e){if($(this,Tq),e===void 0)throw TypeError(`options parameter is required`);let t=oJ(this),n=typeof e==`string`?XX(`smallestUnit`,e):YX(e),r=iJ(n,`largestUnit`,`datetime`,void 0,[`auto`]),{plainRelativeTo:i,zonedRelativeTo:a}=aJ(n),o=$q(n),s=Xq(n,`halfExpand`),c=iJ(n,`smallestUnit`,`datetime`,void 0),l=!0;c||=(l=!1,`nanosecond`);let u=sJ(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(sJ(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&&eJ(o,f,!1),o>1&&lJ(c)===`date`&&r!==c)throw RangeError(`For calendar units with roundingIncrement > 1, use largestUnit = smallestUnit`);if(a){let e=eX(this),t=Q(a,iK),n=Q(a,eK),i=Q(a,XG);return e=hX(i,TX(i,t,n,e),t,n,r,o,c,s),lJ(r)===`date`&&(r=`hour`),rX(e,r)}if(i){let e=tX(this),t=CX({deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},e.time),n=Q(i,ZG),a=Q(i,eK),l=HJ(a,n,Kq(e.date,t.deltaDays),`constrain`);return e=mX(qq(n,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),qq(l,t),a,r,o,c,s),rX(e,r)}if(cJ(t))throw RangeError(`a starting point is required for ${t}s balancing`);if(cJ(r))throw RangeError(`a starting point is required for ${r}s balancing`);let p=tX(this);if(c===`day`){let{quotient:e,remainder:t}=p.time.divmod(eq),n=p.date.days+e+RX(t,`day`);n=NX(n,o,s),p=iX({years:0,months:0,weeks:0,days:n},HK.ZERO)}else p=iX({years:0,months:0,weeks:0,days:0},LX(p.time,o,c,s));return rX(p,r)}total(e){if($(this,Tq),e===void 0)throw TypeError(`options argument is required`);let t=typeof e==`string`?XX(`unit`,e):YX(e),{plainRelativeTo:n,zonedRelativeTo:r}=aJ(t),i=iJ(t,`unit`,`datetime`,rJ);if(r){let e=eX(this),t=Q(r,iK),n=Q(r,eK),a=Q(r,XG);return function(e,t,n,r,i){return lJ(i)===`time`?RX(HK.fromEpochNsDiff(t,e),i):pX(uX(e,t,n,r,i),t,eY(n,e),n,r,i)}(a,TX(a,t,n,e),t,n,i)}if(n){let e=tX(this),t=CX({deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0},e.time),r=Q(n,ZG),a=Q(n,eK),o=HJ(a,r,Kq(e.date,t.deltaDays),`constrain`);return function(e,t,n,r){if(VX(e,t)==0)return 0;YY(e),YY(t);let i=lX(e,t,n,r);return r===`nanosecond`?Z.default.toNumber(i.time.totalNs):pX(i,EY(t),e,null,n,r)}(qq(r,{deltaDays:0,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}),qq(o,t),a,i)}let a=oJ(this);if(cJ(a))throw RangeError(`a starting point is required for ${a}s total`);if(cJ(i))throw RangeError(`a starting point is required for ${i}s total`);return RX(tX(this).time,i)}toString(e=void 0){$(this,Tq);let t=YX(e),n=tJ(t),r=Xq(t,`trunc`),i=iJ(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}=nJ(i,n);if(o===`nanosecond`&&s===1)return uY(this,a);let c=oJ(this),l=eX(this),u=LX(l.time,s,o,r);return l=iX(l.date,u),uY(rX(l,sJ(c,`second`)),a)}toJSON(){return $(this,Tq),uY(this,`auto`)}toLocaleString(e=void 0,t=void 0){if($(this,Tq),typeof Intl.DurationFormat==`function`){let n=new Intl.DurationFormat(e,t);return FZ.call(n,this)}return console.warn(`Temporal.Duration.prototype.toLocaleString() requires Intl.DurationFormat.`),uY(this,`auto`)}valueOf(){eZ(`Duration`)}static from(e){return vJ(e)}static compare(e,t,n=void 0){let r=vJ(e),i=vJ(t),{plainRelativeTo:a,zonedRelativeTo:o}=aJ(YX(n));if(Q(r,aK)===Q(i,aK)&&Q(r,oK)===Q(i,oK)&&Q(r,sK)===Q(i,sK)&&Q(r,cK)===Q(i,cK)&&Q(r,lK)===Q(i,lK)&&Q(r,uK)===Q(i,uK)&&Q(r,dK)===Q(i,dK)&&Q(r,fK)===Q(i,fK)&&Q(r,pK)===Q(i,pK)&&Q(r,mK)===Q(i,mK))return 0;let s=oJ(r),c=oJ(i),l=eX(r),u=eX(i);if(o&&(lJ(s)===`date`||lJ(c)===`date`)){let e=Q(o,iK),t=Q(o,eK),n=Q(o,XG),r=TX(n,e,t,l),i=TX(n,e,t,u);return JX(Z.default.toNumber(Z.default.subtract(r,i)))}let d=l.date.days,f=u.date.days;if(cJ(s)||cJ(c)){if(!a)throw RangeError(`A starting point is required for years, months, or weeks comparison`);d=BY(l.date,a),f=BY(u.date,a)}let p=l.time.add24HourDays(d),m=u.time.add24HourDays(f);return p.cmp(m)}};FK(HZ,`Temporal.Duration`);var UZ=class{constructor(e,t,n=`iso8601`,r=1972){let i=uq(e),a=uq(t),o=QX(n===void 0?`iso8601`:mq(n)),s=uq(r);GY(s,i,a),AJ(this,{year:s,month:i,day:a},o)}get monthCode(){return WZ(this,`monthCode`)}get day(){return WZ(this,`day`)}get calendarId(){return $(this,Aq),Q(this,eK)}with(e,t=void 0){if($(this,Aq),!sq(e))throw TypeError(`invalid argument`);Mq(e);let n=Q(this,eK),r=fJ(n,Q(this,ZG),`month-day`);return r=VJ(n,r,pJ(n,e,[`year`,`month`,`monthCode`,`day`],[],`partial`)),jJ(YJ(n,r,Jq(YX(t))),n)}equals(e){$(this,Aq);let t=bJ(e);return zX(Q(this,ZG),Q(t,ZG))===0&&KJ(Q(this,eK),Q(t,eK))}toString(e=void 0){return $(this,Aq),mY(this,Qq(YX(e)))}toJSON(){return $(this,Aq),mY(this)}toLocaleString(e=void 0,t=void 0){return $(this,Aq),new TZ(e,t).format(this)}valueOf(){eZ(`PlainMonthDay`)}toPlainDate(e){if($(this,Aq),!sq(e))throw TypeError(`argument should be an object`);let t=Q(this,eK);return DJ(qJ(t,VJ(t,fJ(t,Q(this,ZG),`month-day`),pJ(t,e,[`year`],[],[])),`constrain`),t)}static from(e,t=void 0){return bJ(e,t)}};function WZ(e,t){$(e,Aq);let n=Q(e,ZG);return dJ(e).isoToDate(n,{[t]:!0})[t]}function GZ(e){return eY(e,KX())}FK(UZ,`Temporal.PlainMonthDay`);var KZ={instant:()=>LJ(KX()),plainDateTimeISO:(e=qX())=>kJ(GZ(XJ(e)),`iso8601`),plainDateISO:(e=qX())=>DJ(GZ(XJ(e)).isoDate,`iso8601`),plainTimeISO:(e=qX())=>NJ(GZ(XJ(e)).time),timeZoneId:()=>qX(),zonedDateTimeISO:(e=qX())=>{let t=XJ(e);return zJ(KX(),t,`iso8601`)},[Symbol.toStringTag]:`Temporal.Now`};Object.defineProperty(KZ,Symbol.toStringTag,{value:`Temporal.Now`,writable:!1,enumerable:!1,configurable:!0});var qZ=class e{constructor(e=0,t=0,n=0,r=0,i=0,a=0){let o=e===void 0?0:uq(e),s=t===void 0?0:uq(t),c=n===void 0?0:uq(n),l=r===void 0?0:uq(r),u=i===void 0?0:uq(i),d=a===void 0?0:uq(a);qY(o,s,c,l,u,d),MJ(this,{hour:o,minute:s,second:c,millisecond:l,microsecond:u,nanosecond:d})}get hour(){return $(this,Dq),Q(this,$G).hour}get minute(){return $(this,Dq),Q(this,$G).minute}get second(){return $(this,Dq),Q(this,$G).second}get millisecond(){return $(this,Dq),Q(this,$G).millisecond}get microsecond(){return $(this,Dq),Q(this,$G).microsecond}get nanosecond(){return $(this,Dq),Q(this,$G).nanosecond}with(t,n=void 0){if($(this,Dq),!sq(t))throw TypeError(`invalid argument`);Mq(t);let r=mJ(t,`partial`),i=mJ(this),{hour:a,minute:o,second:s,millisecond:c,microsecond:l,nanosecond:u}=Object.assign(i,r),d=Jq(YX(n));return{hour:a,minute:o,second:s,millisecond:c,microsecond:l,nanosecond:u}=Wq(a,o,s,c,l,u,d),new e(a,o,s,c,l,u)}add(e){return $(this,Dq),AX(`add`,this,e)}subtract(e){return $(this,Dq),AX(`subtract`,this,e)}until(e,t=void 0){return $(this,Dq),bX(`until`,this,e,t)}since(e,t=void 0){return $(this,Dq),bX(`since`,this,e,t)}round(e){if($(this,Dq),e===void 0)throw TypeError(`options parameter is required`);let t=typeof e==`string`?XX(`smallestUnit`,e):YX(e),n=$q(t),r=Xq(t,`halfExpand`),i=iJ(t,`smallestUnit`,`time`,rJ);return eJ(n,{hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[i],!1),NJ(IX(Q(this,$G),n,i,r))}equals(e){$(this,Dq);let t=xJ(e);return BX(Q(this,$G),Q(t,$G))===0}toString(e=void 0){$(this,Dq);let t=YX(e),n=tJ(t),r=Xq(t,`trunc`),i=iJ(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}=nJ(i,n);return fY(IX(Q(this,$G),s,o,r),a)}toJSON(){return $(this,Dq),fY(Q(this,$G),`auto`)}toLocaleString(e=void 0,t=void 0){return $(this,Dq),new TZ(e,t).format(this)}valueOf(){eZ(`PlainTime`)}static from(e,t=void 0){return xJ(e,t)}static compare(e,t){let n=xJ(e),r=xJ(t);return BX(Q(n,$G),Q(r,$G))}};FK(qZ,`Temporal.PlainTime`);var JZ=class{constructor(e,t,n=`iso8601`,r=1){let i=uq(e),a=uq(t),o=QX(n===void 0?`iso8601`:mq(n)),s=uq(r);GY(i,a,s),PJ(this,{year:i,month:a,day:s},o)}get year(){return YZ(this,`year`)}get month(){return YZ(this,`month`)}get monthCode(){return YZ(this,`monthCode`)}get calendarId(){return $(this,kq),Q(this,eK)}get era(){return YZ(this,`era`)}get eraYear(){return YZ(this,`eraYear`)}get daysInMonth(){return YZ(this,`daysInMonth`)}get daysInYear(){return YZ(this,`daysInYear`)}get monthsInYear(){return YZ(this,`monthsInYear`)}get inLeapYear(){return YZ(this,`inLeapYear`)}with(e,t=void 0){if($(this,kq),!sq(e))throw TypeError(`invalid argument`);Mq(e);let n=Q(this,eK),r=fJ(n,Q(this,ZG),`year-month`);return r=VJ(n,r,pJ(n,e,[`year`,`month`,`monthCode`],[],`partial`)),FJ(JJ(n,r,Jq(YX(t))),n)}add(e,t=void 0){return $(this,kq),jX(`add`,this,e,t)}subtract(e,t=void 0){return $(this,kq),jX(`subtract`,this,e,t)}until(e,t=void 0){return $(this,kq),xX(`until`,this,e,t)}since(e,t=void 0){return $(this,kq),xX(`since`,this,e,t)}equals(e){$(this,kq);let t=CJ(e);return zX(Q(this,ZG),Q(t,ZG))===0&&KJ(Q(this,eK),Q(t,eK))}toString(e=void 0){return $(this,kq),hY(this,Qq(YX(e)))}toJSON(){return $(this,kq),hY(this)}toLocaleString(e=void 0,t=void 0){return $(this,kq),new TZ(e,t).format(this)}valueOf(){eZ(`PlainYearMonth`)}toPlainDate(e){if($(this,kq),!sq(e))throw TypeError(`argument should be an object`);let t=Q(this,eK);return DJ(qJ(t,VJ(t,fJ(t,Q(this,ZG),`year-month`),pJ(t,e,[`day`],[],[])),`constrain`),t)}static from(e,t=void 0){return CJ(e,t)}static compare(e,t){let n=CJ(e),r=CJ(t);return zX(Q(n,ZG),Q(r,ZG))}};function YZ(e,t){$(e,kq);let n=Q(e,ZG);return dJ(e).isoToDate(n,{[t]:!0})[t]}FK(JZ,`Temporal.PlainYearMonth`);var fbe=TZ.prototype.resolvedOptions,XZ=class{constructor(e,t,n=`iso8601`){if(arguments.length<1)throw TypeError(`missing argument: epochNanoseconds is required`);let r=GX(e),i=mq(t),{tzName:a,offsetMinutes:o}=Hq(i);if(o===void 0){let e=bY(a);if(!e)throw RangeError(`unknown time zone ${a}`);i=e.identifier}else i=CY(o);RJ(this,r,i,QX(n===void 0?`iso8601`:mq(n)))}get calendarId(){return $(this,jq),Q(this,eK)}get timeZoneId(){return $(this,jq),Q(this,iK)}get year(){return QZ(this,`year`)}get month(){return QZ(this,`month`)}get monthCode(){return QZ(this,`monthCode`)}get day(){return QZ(this,`day`)}get hour(){return $Z(this,`hour`)}get minute(){return $Z(this,`minute`)}get second(){return $Z(this,`second`)}get millisecond(){return $Z(this,`millisecond`)}get microsecond(){return $Z(this,`microsecond`)}get nanosecond(){return $Z(this,`nanosecond`)}get era(){return QZ(this,`era`)}get eraYear(){return QZ(this,`eraYear`)}get epochMilliseconds(){return $(this,jq),UX(Q(this,XG),`floor`)}get epochNanoseconds(){return $(this,jq),HX(Q(this,XG))}get dayOfWeek(){return QZ(this,`dayOfWeek`)}get dayOfYear(){return QZ(this,`dayOfYear`)}get weekOfYear(){return QZ(this,`weekOfYear`)?.week}get yearOfWeek(){return QZ(this,`weekOfYear`)?.year}get hoursInDay(){$(this,jq);let e=Q(this,iK),t=ZZ(this).isoDate,n=LY(t.year,t.month,t.day+1),r=iY(e,t),i=iY(e,n);return RX(HK.fromEpochNsDiff(i,r),`hour`)}get daysInWeek(){return QZ(this,`daysInWeek`)}get daysInMonth(){return QZ(this,`daysInMonth`)}get daysInYear(){return QZ(this,`daysInYear`)}get monthsInYear(){return QZ(this,`monthsInYear`)}get inLeapYear(){return QZ(this,`inLeapYear`)}get offset(){return $(this,jq),$J(QJ(Q(this,iK),Q(this,XG)))}get offsetNanoseconds(){return $(this,jq),QJ(Q(this,iK),Q(this,XG))}with(e,t=void 0){if($(this,jq),!sq(e))throw TypeError(`invalid zoned-date-time-like`);Mq(e);let n=Q(this,eK),r=Q(this,iK),i=QJ(r,Q(this,XG)),a=ZZ(this),o={...fJ(n,a.isoDate),...a.time,offset:$J(i)};o=VJ(n,o,pJ(n,e,[`year`,`month`,`monthCode`,`day`],[`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`,`offset`],`partial`));let s=YX(t),c=Yq(s),l=Zq(s,`prefer`),u=gJ(n,o,Jq(s)),d=vY(o.offset);return zJ(wJ(u.isoDate,u.time,`option`,d,r,c,l,!1),r,n)}withPlainTime(e=void 0){$(this,jq);let t=Q(this,iK),n=Q(this,eK),r=ZZ(this).isoDate,i;return i=e===void 0?iY(t,r):tY(t,qq(r,Q(xJ(e),$G)),`compatible`),zJ(i,t,n)}withTimeZone(e){$(this,jq);let t=XJ(e);return zJ(Q(this,XG),t,Q(this,eK))}withCalendar(e){$(this,jq);let t=WJ(e);return zJ(Q(this,XG),Q(this,iK),t)}add(e,t=void 0){return $(this,jq),MX(`add`,this,e,t)}subtract(e,t=void 0){return $(this,jq),MX(`subtract`,this,e,t)}until(e,t=void 0){return $(this,jq),SX(`until`,this,e,t)}since(e,t=void 0){return $(this,jq),SX(`since`,this,e,t)}round(e){if($(this,jq),e===void 0)throw TypeError(`options parameter is required`);let t=typeof e==`string`?XX(`smallestUnit`,e):YX(e),n=$q(t),r=Xq(t,`halfExpand`),i=iJ(t,`smallestUnit`,`time`,rJ,[`day`]),a={day:1,hour:24,minute:60,second:60,millisecond:1e3,microsecond:1e3,nanosecond:1e3}[i];if(eJ(n,a,a===1),i===`nanosecond`&&n===1)return zJ(Q(this,XG),Q(this,iK),Q(this,eK));let o=Q(this,iK),s=Q(this,XG),c=ZZ(this),l;if(i===`day`){let e=c.isoDate,t=LY(e.year,e.month,e.day+1),n=iY(o,e),i=iY(o,t),a=Z.default.subtract(i,n);l=HK.fromEpochNsDiff(s,n).round(a,r).addToEpochNs(n)}else{let e=FX(c,n,i,r),t=QJ(o,s);l=wJ(e.isoDate,e.time,`option`,t,o,`compatible`,`prefer`,!1)}return zJ(l,o,Q(this,eK))}equals(e){$(this,jq);let t=TJ(e),n=Q(this,XG),r=Q(t,XG);return!!Z.default.equal(Z.default.BigInt(n),Z.default.BigInt(r))&&!!ZJ(Q(this,iK),Q(t,iK))&&KJ(Q(this,eK),Q(t,eK))}toString(e=void 0){$(this,jq);let t=YX(e),n=Qq(t),r=tJ(t),i=function(e){return ZX(e,`offset`,[`auto`,`never`],`auto`)}(t),a=Xq(t,`trunc`),o=iJ(t,`smallestUnit`,`time`,void 0);if(o===`hour`)throw RangeError(`smallestUnit must be a time unit other than "hour"`);let s=function(e){return ZX(e,`timeZoneName`,[`auto`,`never`,`critical`],`auto`)}(t),{precision:c,unit:l,increment:u}=nJ(o,r);return gY(this,c,n,s,i,{unit:l,increment:u,roundingMode:a})}toLocaleString(e=void 0,t=void 0){$(this,jq);let n=YX(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,iK),_Y(r.timeZone))throw RangeError(`toLocaleString does not currently support offset time zones`);let i=new TZ(e,r),a=fbe.call(i).calendar,o=Q(this,eK);if(o!==`iso8601`&&a!==`iso8601`&&!KJ(a,o))throw RangeError(`cannot format ZonedDateTime with calendar ${o} in locale with calendar ${a}`);return i.format(LJ(Q(this,XG)))}toJSON(){return $(this,jq),gY(this,`auto`)}valueOf(){eZ(`ZonedDateTime`)}startOfDay(){$(this,jq);let e=Q(this,iK);return zJ(iY(e,ZZ(this).isoDate),e,Q(this,eK))}getTimeZoneTransition(e){$(this,jq);let t=Q(this,iK);if(e===void 0)throw TypeError(`options parameter is required`);let n=ZX(typeof e==`string`?XX(`direction`,e):YX(e),`direction`,[`next`,`previous`],rJ);if(n===void 0)throw TypeError(`direction option is required`);if(_Y(t)||t===`UTC`)return null;let r=Q(this,XG),i=n===`next`?OY(t,r):kY(t,r);return i===null?null:zJ(i,t,Q(this,eK))}toInstant(){return $(this,jq),LJ(Q(this,XG))}toPlainDate(){return $(this,jq),DJ(ZZ(this).isoDate,Q(this,eK))}toPlainTime(){return $(this,jq),NJ(ZZ(this).time)}toPlainDateTime(){return $(this,jq),kJ(ZZ(this),Q(this,eK))}static from(e,t=void 0){return TJ(e,t)}static compare(e,t){let n=TJ(e),r=TJ(t),i=Q(n,XG),a=Q(r,XG);return Z.default.lessThan(Z.default.BigInt(i),Z.default.BigInt(a))?-1:+!!Z.default.greaterThan(Z.default.BigInt(i),Z.default.BigInt(a))}};function ZZ(e){return eY(Q(e,iK),Q(e,XG))}function QZ(e,t){$(e,jq);let n=ZZ(e).isoDate;return dJ(e).isoToDate(n,{[t]:!0})[t]}function $Z(e,t){return $(e,jq),ZZ(e).time[t]}FK(XZ,`Temporal.ZonedDateTime`);var pbe=Object.freeze({__proto__:null,Duration:HZ,Instant:IZ,Now:KZ,PlainDate:LZ,PlainDateTime:zZ,PlainMonthDay:UZ,PlainTime:qZ,PlainYearMonth:JZ,ZonedDateTime:XZ});(class{toTemporalInstant(){return LJ(WX(Date.prototype.valueOf.call(this)))}}).prototype.toTemporalInstant;var mbe=[IZ,LZ,zZ,HZ,UZ,qZ,JZ,XZ];for(let e of mbe){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 hbe(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 gbe(e,t){return hbe(new Date(e),t)}function _be(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=pbe.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 eQ(e,t){return new Intl.DateTimeFormat(void 0,{timeZone:t,dateStyle:`medium`,timeStyle:`short`}).format(new Date(e))}function vbe(e,t){return new Intl.DateTimeFormat(void 0,{timeZone:t,year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,timeZoneName:`short`}).format(new Date(e))}var tQ={"claude-code":{name:`Claude Code`,command:`claude auth login`},codex:{name:`Codex`,command:`codex login`},gemini:{name:`Antigravity`,command:`agy`}},ybe=/not signed in|sign-in has expired|not logged in|run\s+"?(?:codex login|claude auth login)|authentication required/i,bbe=/ENOSPC|no space left on device|disk (?:is )?full|not enough (?:free )?(?:disk )?space/i,xbe=/refused to make|content (?:rules|policy|filter)|safety (?:system|filter)|flagged|moderation/i,Sbe=/\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,Cbe=/did not accept the API key|API key is saved|invalid api key|key may be wrong/i,wbe=[`images`,`thumbnail`],Tbe=/^Short \d+ image \d+:/;function nQ(e){let t=e.reason??``,n=Ebe(e.provider,t);if(n!==void 0&&(ybe.test(t)||e.kind===`auth`))return{kind:`sign-in`,label:`Sign in to ${tQ[n].name}`,cli:n,command:tQ[n].command};if(bbe.test(t))return{kind:`free-space`,label:`Free space`};if(e.kind===`refusal`||xbe.test(t))return wbe.includes(e.stage)||e.stage===`video`&&Tbe.test(t)?{kind:`refused`,label:`Soften and retry`,soften:!0}:{kind:`refused`,label:`Edit the prompt`,soften:!1};if(Sbe.test(t))return{kind:`switch-model`,label:`Switch model`};if(e.kind===`auth`||e.kind===`missing_key`||Cbe.test(t)){let t=Dbe(e.provider);return{kind:`provider-settings`,label:t===void 0?`Open Settings → Providers`:`Open Settings → Providers → ${t}`,provider:e.provider??``}}}function Ebe(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(/Antigravity CLI|Gemini CLI/.test(t))return`gemini`}function Dbe(e){return KA.find(t=>t.id===e)?.displayName}function Obe(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}}function kbe(e){let t=e.topics.error;if(t!==null)return nQ({stage:`article`,reason:t,provider:e.topicGeneration.llm?.provider})}function rQ({schedule:e,title:t,retry:n,className:r}){if(e.topics.error===null)return null;let i=kbe(e);return(0,h.jsx)(GM,{tone:`danger`,title:t,...r===void 0?{}:{className:r},...i===void 0?{}:{actions:(0,h.jsx)(Wz,{fix:i,retry:n,variant:`secondary`,size:`small`})},children:e.topics.error})}var iQ=e=>e.length===1?`“${e[0]?.title??``}”`:PG(e.length,`topic`,`topics`);function Abe({schedule:e}){let{api:t}=V(),n=_(),[r,i]=(0,m.useState)(null),a=wv(),[o,s]=(0,m.useState)(null),[c,l]=(0,m.useState)(!1),u=e.deletedAt===null&&(e.status===`active`||e.status===`paused`),d=I({queryKey:[...vT(e.id),e.topics.held,e.topics.generatedAt],enabled:u&&e.topicGeneration.mode===`hold`,queryFn:async()=>{let n=await yT(t,e.id);if(!n.ok)throw Error(n.message);return n.value}}),f=I({queryKey:[`project-template`,e.templateId],enabled:u&&e.topicGeneration.mode===`hold`,queryFn:async()=>{let n=await wO(t,e.templateId);if(!n.ok)throw Error(n.message);return n.value}}).data?.document.form,p=(f===void 0?[]:gG(f)).filter(t=>t!==e.topicKeyword),g=t=>e.values[t]??f?.values[t]??``,v=d.data??[],y=AG(v.map(e=>e.id)),b=L({mutationFn:e=>e(),onSuccess:e=>{i(e.ok?null:e.message),e.ok&&s(null)},onError:e=>i(e.message),onSettled:async()=>{await Promise.all([n.invalidateQueries({queryKey:pT}),n.invalidateQueries({queryKey:vT(e.id)}),n.invalidateQueries({queryKey:ET})])}}),x=b.isPending,S=(e,t)=>b.mutate(e,{onSuccess:e=>{e.ok&&t!==void 0&&(y.clear(),a(t.message,`success`,t.undo===void 0?void 0:{label:`Undo`,run:t.undo}))}}),C=n=>S(()=>Sce(t,e.id,n.map(e=>e.id)),{message:`Turned down ${iQ(n)}. Later generations won't suggest ${n.length===1?`it`:`them`} again.`,undo:()=>S(()=>Cce(t,e.id,n),{message:`${iQ(n)} ${n.length===1?`is`:`are`} waiting again.`})}),w=n=>S(()=>n.length===1&&n[0]!==void 0?ST(t,e.id,n[0].id):xce(t,e.id,n.map(e=>e.id)),{message:`Approved ${iQ(n)}: added to the end of the queue.`}),T=v.filter(e=>y.has(e.id));if(!u||e.topicGeneration.mode===`off`)return null;let{topics:E}=e;return(0,h.jsxs)(`section`,{"aria-label":`Topic generation`,children:[(0,h.jsx)(kG,{className:`my-6`}),(0,h.jsxs)(Sy,{as:`h3`,title:`Topic generation`,meta:`${E.generatingSince===null?E.generatedAt===null?`No topics generated yet.`:`Topics last generated ${vbe(E.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)(U,{id:`planning.schedule.generate-now`}),(0,h.jsx)(B,{disabled:x||E.generatingSince!==null,disabledReason:`Topics are being generated now`,onClick:()=>b.mutate(()=>xT(t,e.id)),children:`Generate topics now`})]}),(0,h.jsx)(rQ,{schedule:e,title:`The last topic generation failed.`,className:`mt-3`,retry:{run:()=>b.mutate(()=>xT(t,e.id)),busy:x||E.generatingSince!==null}}),r===null?null:(0,h.jsx)(GM,{tone:`danger`,title:`That didn't work.`,className:`mt-3`,children:r}),e.topicGeneration.mode===`hold`?(0,h.jsxs)(`div`,{className:`mt-4`,...xy,children:[(0,h.jsxs)(Sy,{as:`h3`,title:`Topics waiting · ${String(v.length)}`,info:`planning.schedule.held`,children:[(0,h.jsx)(B,{variant:`primary`,disabled:x||v.length===0,disabledReason:`Nothing is waiting`,onClick:()=>S(()=>CT(t,e.id),{message:`Approved ${iQ(v)}: added to the end of the queue.`}),children:`Approve all`}),(0,h.jsx)(B,{variant:`quiet`,disabled:x||v.length===0,disabledReason:`Nothing is waiting`,onClick:()=>l(!0),children:`Reject all`})]}),d.error?(0,h.jsx)(`p`,{className:`m-0 mt-2 text-small text-danger`,children:`The waiting topics couldn't be loaded: ${d.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.jsxs)(`div`,{onKeyDown:y.onKeyDown,children:[v.length>1?(0,h.jsx)(NG,{className:`mt-2`,selection:y,total:v.length,noun:[`topic waiting`,`topics waiting`],actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(B,{size:`small`,disabled:x||T.length===0,disabledReason:`Tick the topics to approve`,onClick:()=>w(T),children:`Approve selected`}),(0,h.jsx)(B,{size:`small`,variant:`quiet`,disabled:x||T.length===0,disabledReason:`Tick the topics to turn down`,onClick:()=>C(T),children:`Reject selected`})]})}):null,(0,h.jsx)(mR,{label:`Topics waiting`,className:`mt-2 [&_.sl-row__actions]:flex-wrap`,children:v.map(n=>(0,h.jsx)(sye,{topic:n,editing:o?.id===n.id?o:void 0,keywords:p,everyRun:g,busy:x,selection:y,onEdit:s,onCancel:()=>s(null),onSave:()=>{o!==null&&b.mutate(()=>Tce(t,e.id,n.id,o.title.trim(),Object.fromEntries(Object.entries(o.values).filter(([,e])=>e.trim()!==``))))},onApprove:()=>w([n]),onReject:()=>C([n])},n.id))})]}),(0,h.jsx)(Bv,{open:c,title:`Reject all ${PG(v.length,`waiting topic`,`waiting topics`)}?`,consequence:`Turns down the ${PG(v.length,`topic`,`topics`)} waiting for ${e.name} now (topics generated after this list was shown are not included). Later generations won't suggest them again; Undo in the message that follows brings them back.`,confirmLabel:`Reject ${PG(v.length,`topic`,`topics`)}`,cancelLabel:`Keep them waiting`,pending:x,onCancel:()=>l(!1),onConfirm:()=>{l(!1),C(v)}})]}):null]})}function aQ(e){return e.filter(e=>e.deletedAt===null&&e.topicGeneration.mode!==`off`&&(e.status===`active`||e.status===`paused`))}function jbe({schedules:e}){let t=aQ(e),n=e.filter(e=>e.deletedAt===null&&(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)(Sy,{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`,{className:`flex flex-wrap gap-x-3 gap-y-1`,children:n.length===0?(0,h.jsx)(RO,{to:`/calendar`,search:{tab:`schedules`},children:`Open schedules`}):n.slice(0,4).map(e=>(0,h.jsxs)(RO,{to:`/calendar`,search:{tab:`schedules`,schedule:e.id},children:[`Open `,e.name]},e.id))})]}):t.map((e,t)=>(0,h.jsx)(Mbe,{schedule:e,first:t===0},e.id))})}function Mbe({schedule:e,first:t}){let{api:n}=V(),r=_(),i=wv(),a=I({queryKey:[...vT(e.id),e.topics.held,e.version],queryFn:async()=>{let t=await yT(n,e.id);if(!t.ok)throw Error(t.message);return t.value},enabled:e.topics.held>0}),o=L({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:pT}),r.invalidateQueries({queryKey:ET}),r.invalidateQueries({queryKey:vT(e.id)})])}}),s=e.topics.held>0?a.data??[]:[],c=()=>o.mutate(()=>CT(n,e.id));Xy({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)(Sy,{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)(B,{size:`small`,variant:`secondary`,disabled:o.isPending,onClick:c,children:`Queue all ${String(s.length)}`}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(U,{id:`planning.schedule.generate-now`,label:`Suggest topics now`}),(0,h.jsx)(B,{size:`small`,variant:`quiet`,disabled:o.isPending||l,disabledReason:l?`Slopify is suggesting topics now.`:`Working…`,onClick:()=>o.mutate(()=>xT(n,e.id)),children:l?`Suggesting…`:`Suggest topics now`})]})}),(0,h.jsx)(rQ,{schedule:e,title:`The last suggestion failed.`,retry:{run:()=>o.mutate(()=>xT(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)(mR,{label:`Suggestions for ${e.name}`,children:s.map(t=>(0,h.jsx)(hR,{title:t.title,meta:FG(t.values),actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(B,{size:`small`,variant:`quiet`,disabled:o.isPending,onClick:()=>o.mutate(()=>ST(n,e.id,t.id)),"aria-label":`Queue ${t.title}`,children:`Queue`}),(0,h.jsx)(bv,{size:`small`,label:`Reject ${t.title}`,disabled:o.isPending,onClick:()=>o.mutate(()=>wce(n,e.id,t.id)),children:(0,h.jsx)(kl,{"aria-hidden":`true`,strokeWidth:1.75})})]})},t.id))}),(0,h.jsx)(GM,{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.`})]})}function Nbe(e,t){if(e.kind===`move`)return{kind:`move`,scheduleId:e.scheduleId,baseVersion:t.source.version,from:e.to,to:e.from};let n=t.target??t.source;return{kind:`transfer`,scheduleId:e.targetId,baseVersion:n.version,index:e.position??n.items.length-1,targetId:e.scheduleId,position:e.index}}function Pbe(e,t){if(t.kind!==`move`)return e;let n=e.runs.filter(e=>e.scheduleId===t.scheduleId&&e.index!==null).toSorted((e,t)=>(e.index??0)-(t.index??0)),r=n.map(Fbe),[i]=r.splice(t.from,1);if(i===void 0)return e;r.splice(t.to,0,i);let a=new Map(n.map((e,t)=>[e,r[t]]));return{...e,runs:e.runs.map(e=>{let t=a.get(e);return t===void 0?e:{...e,...t}})}}function Fbe(e){return{topic:e.topic,topicSource:e.topicSource,renderedTitle:e.renderedTitle,prepared:e.prepared}}function Ibe(e,t){let{api:n}=V(),r=_(),i=wv(),a=L({mutationFn:async({drop:e})=>{if(e.kind===`move`){let t=await wT(n,e.scheduleId,{baseVersion:e.baseVersion,from:e.from,to:e.to});return t.ok?{ok:!0,value:{source:t.value}}:t}return Ece(n,e.scheduleId,{baseVersion:e.baseVersion,index:e.index,targetId:e.targetId,...e.position===void 0?{}:{position:e.position}})},onMutate:async({drop:n})=>{await r.cancelQueries({queryKey:e});let i=r.getQueryData(e);return i!==void 0&&r.setQueryData(e,Pbe(i,n)),t(null),{before:i}},onSuccess:(n,o,s)=>{if(!n.ok){s.before!==void 0&&r.setQueryData(e,s.before),t(`${o.title} wasn't moved: ${n.message} The calendar shows where it is now; move it again if you still want to.`);return}if(o.undo===!0){i(`${o.title} is back where it was.`,`success`);return}i(`Moved ${o.title} to ${o.where}.`,`success`,{label:`Undo`,run:()=>a.mutate({drop:Nbe(o.drop,n.value),title:o.title,where:``,undo:!0})})},onError:(n,i,a)=>{a?.before!==void 0&&r.setQueryData(e,a.before),t(`${i.title} wasn't moved: ${n.message} The calendar has been read again; try the move once more.`)},onSettled:async()=>{await Promise.all([r.invalidateQueries({queryKey:ET}),r.invalidateQueries({queryKey:pT})])}});return a}var oQ=[`trash`];async function sQ(e){return(await R(await e.client.trash.$get())).items}async function cQ(e,t,n){return(await R(await e.client.trash[`:kind`][`:id`].restore.$post({param:{kind:t,id:n}}))).restored}async function Lbe(e,t,n){let r=await e.client.trash[`:kind`][`:id`].$delete({param:{kind:t,id:n}});if(!r.ok)throw await fo(r)}async function lQ(e,t){return R(await e.client.trash.bulk.restore.$post({json:{items:[...t]}}))}async function Rbe(e,t){return R(await e.client.trash.bulk.delete.$post({json:{items:[...t]}}))}var uQ=[`batch-queue`];function zbe(){let{api:e}=V(),t=I({queryKey:uQ,queryFn:async()=>R(await e.fetch(`${e.origin}/api/projects/queue`)),refetchInterval:2e3,retry:!1}),n=I(iy(e)),r=t.data?.queue.length,i=r===void 0?t.error===null?`…`:`?`:String(r);return(0,h.jsxs)(vy,{children:[(0,h.jsx)(yy,{asChild:!0,children:(0,h.jsxs)(B,{variant:`quiet`,disabled:r===0&&t.error===null,disabledReason:`Nothing is queued`,"aria-label":r===void 0?t.error===null?`Video queue: loading`:`Video queue: didn't load`:`Video queue: ${String(r)} remaining`,children:[(0,h.jsx)(il,{"aria-hidden":`true`,className:`size-4`}),(0,h.jsxs)(`span`,{className:`tabular-nums`,children:[`Queue · `,i]})]})}),(0,h.jsxs)(by,{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:hy(`play.queue`).body}),(0,h.jsx)(`div`,{className:`px-3 py-2 empty:hidden`,children:(0,h.jsx)(JL,{query:t,what:`The video queue`,compact:!0,loading:null,children:()=>null})}),(0,h.jsx)(Bbe,{queue:t.data?.queue??[],projects:n.data?.projects})]})]})}function Bbe({queue:e,projects:t}){let n=e.filter(e=>e.state===`queued`);return(0,h.jsx)(`ol`,{className:`max-h-60 overflow-y-auto px-4 py-2`,children:e.map((e,r)=>{let i=t?.find(t=>t.id===e.projectId),a=i?.title??`Video`;return(0,h.jsxs)(`li`,{className:`flex items-center justify-between gap-2 py-1 text-small`,children:[(0,h.jsxs)(fa,{className:`min-w-0 truncate`,to:`/projects/$projectId`,params:{projectId:e.projectId},children:[r+1,`. `,a]}),(0,h.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-ink-2`,children:[i?.status===`paused`?`Paused`:e.state===`active`?`Active`:`Queued`,e.state===`queued`?(0,h.jsx)(dQ,{projectId:e.projectId,title:a,place:n.indexOf(e),waiting:n.length}):null]})]},e.projectId)})})}function dQ({projectId:e,title:t,place:n,waiting:r}){let{api:i}=V(),a=_(),o=wv(),s=()=>{a.invalidateQueries({queryKey:uQ}),a.invalidateQueries({queryKey:[`projects`]}),a.invalidateQueries({queryKey:[`calendar`]})},c=L({mutationFn:t=>Vbe(i,e,t),onSuccess:s,onError:e=>{s(),o(`${t} wasn't moved: ${e.message}`,`error`)}}),l=L({mutationFn:()=>Po(i,e),onSuccess:()=>{s(),o(`${t} left the queue and is in Settings → Trash.`,`success`,{label:`Undo`,run:()=>void cQ(i,`project`,e).then(s,e=>o(`${t} wasn't put back: ${e.message} Restore it from Settings → Trash.`,`error`))})},onError:e=>o(`${t} wasn't removed: ${e.message}`,`error`)}),u=c.isPending||l.isPending;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(bv,{size:`small`,label:`Move ${t} earlier in the queue`,disabled:u||n<=0,onClick:()=>c.mutate(-1),children:(0,h.jsx)(wc,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(bv,{size:`small`,label:`Move ${t} later in the queue`,disabled:u||n>=r-1,onClick:()=>c.mutate(1),children:(0,h.jsx)(bc,{"aria-hidden":`true`,strokeWidth:1.75})}),(0,h.jsx)(bv,{size:`small`,label:`Remove ${t} from the queue`,disabled:u,onClick:()=>l.mutate(),children:(0,h.jsx)(kl,{"aria-hidden":`true`,strokeWidth:1.75})})]})}async function Vbe(e,t,n){return R(await e.fetch(`${e.origin}/api/projects/queue/${encodeURIComponent(t)}/move`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({by:n})}))}var fQ=`sl-tab inline-flex items-center gap-[6px]`;function pQ({items:e,value:t,onChange:n,label:r,idPrefix:i,trailing:a,className:o}){let s=(0,m.useRef)(null);return TG(s,t),(0,h.jsxs)(`div`,{className:z(`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:fQ,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 Hbe({items:e,label:t,className:n}){let r=(0,m.useRef)(null);return TG(r,Va({select:e=>e.pathname})),(0,h.jsx)(`nav`,{ref:r,"aria-label":t,className:z(`sl-tabs min-w-0`,n),children:e.map(e=>(0,h.jsx)(fa,{to:e.to,...e.search?{search:e.search}:{},activeOptions:{exact:!1,includeSearch:!1},className:fQ,activeProps:{"aria-current":`page`},children:e.label},e.to))})}function mQ({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 hQ({title:e,children:t,actions:n,className:r}){return(0,h.jsxs)(`div`,{className:z(`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 gQ(e){return e.channelId??`00000000-0000-4000-8000-000000000001`}function Ube({channelId:e}){let{api:t}=V(),n=_(),r=I(CO(t)),i=I(Ry(t)),a=L({mutationFn:e=>Nre(t,e.templateId,e.channelId),onSettled:()=>Promise.all([n.invalidateQueries({queryKey:yO}),n.invalidateQueries({queryKey:Py})])}),o=(r.data??[]).filter(t=>gQ(t)===e);return(0,h.jsxs)(`div`,{...xy,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)(fa,{to:`/templates`,className:`underline`,children:`Library → Templates`}),`. Move to sends a template and its schedules to another channel.`,` `,(0,h.jsx)(U,{id:`planning.channel.template-move`,className:`-my-1 align-middle`})]}),(0,h.jsx)(WR,{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)(hQ,{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)(mR,{label:`Channel templates`,className:`[&_.sl-row__actions]:flex-wrap`,children:o.map(t=>(0,h.jsx)(hR,{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)(bL,{"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]})}function Wbe({channelId:e}){let{api:t}=V(),n=I(CO(t)),r=I(mT(t)),i=new Set((n.data??[]).filter(t=>gQ(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)(fa,{to:`/calendar`,search:{tab:`schedules`},className:`underline`,children:`Calendar → Schedules`}),`.`]}),(0,h.jsx)(WR,{tone:r.error?`error`:`info`,className:`mb-2`,children:r.error?.message}),r.data&&a.length===0?(0,h.jsx)(hQ,{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)(mR,{label:`Channel schedules`,children:a.map(e=>(0,h.jsx)(hR,{title:(0,h.jsx)(RO,{to:`/calendar`,search:{tab:`schedules`,schedule:e.id},children:e.name}),meta:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(KO,{tone:iR[e.status].tone,children:iR[e.status].word}),` · ${e.nextRunAt===null?`No next run`:`Next run ${eQ(e.nextRunAt,e.timezone)}`} · ${String(e.items.length)} queued`]})},e.id))}):null]})}function _Q(e,t,n){let r=new Intl.NumberFormat(`en-US`),i=e-t,a=`${r.format(e)} of ${r.format(t)} ${n}`;return i>0?`${a}: ${r.format(i)} over the limit, shorten it to save.`:a}function vQ(e){return BE(e)?`script`:`article`}function Gbe(e){let{form:t}=e,n=[],r=[];if(CQ(n,t.title),YE(t)&&CQ(n,xQ(e.prompts,`narration`,t.narrationPrompt??``)),t.sources.article===`generate`&&CQ(n,xQ(e.prompts,vQ(t),t.articlePrompt)),t.sources.audio===`generate`&&(CQ(n,SQ(e.entries,`intro`,t.intro)),CQ(n,SQ(e.entries,`outro`,t.outro))),XE(t)&&CQ(n,xQ(e.prompts,`description`,t.descriptionPrompt??``)),Gk(t)&&(CQ(n,xQ(e.prompts,`shorts`,t.shorts?.prompt??``)),CQ(r,xQ(e.prompts,`image`,t.shorts?.imagePrompt??``))),t.sources.images===`generate`){for(let n of t.imagePrompts)CQ(r,xQ(e.prompts,`image`,n.name));t.reference?.source===`prompt`&&CQ(r,xQ(e.prompts,`image`,t.reference.prompt))}return(t.sources.thumbnail===`from_prompt`||t.sources.thumbnail===`prompt_by_llm`)&&CQ(r,xQ(e.prompts,`thumbnail`,t.thumbnailPrompt)),tye(n,r)}function Kbe(e){let t=Gbe(e),n={form:e.form,entries:e.entries,slots:t.map(e=>e.name),silenceGapSeconds:e.silenceGapSeconds},r=Xk(n),i=Dle({draft:r,staged:zue(e.form.provided),requiredSlots:n.slots}),a=Wk(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:qbe(e.form,a)}}var yQ=`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,removeBreaths,deEss,levelSentences,loudness.videoLufs,loudness.audioFilesLufs`.split(`,`);function qbe(e,t){let n=Jbe(e);if(n!==void 0)return n;if(t.ok)return;let r=[...t.fields].sort((e,t)=>bQ(e.field)-bQ(t.field))[0];return r===void 0?void 0:{field:r.field,hint:Ybe(e,r)}}function Jbe(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),Gk(e)&&n.shortsMusic!==void 0&&r.push(n.shortsMusic),Kk(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 bQ(e){let t=yQ.length;for(let[n,r]of yQ.entries())(e===r||e.startsWith(`${r}.`))&&n<t&&(t=n);return t}function Ybe(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 vQ(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 your text under Article 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 xQ(e,t,n){if(n!==``)return e.find(e=>e.kind===t&&e.name===n)?.body}function SQ(e,t,n){if(n!==``)return e.find(e=>e.category===t&&e.name===n)?.body}function CQ(e,t){t!==void 0&&e.push(t)}function wQ(e){let t=new Map,n=(e,n)=>{if(e)for(let r of dG(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`),YE(r)&&n(xQ(i,`narration`,r.narrationPrompt??``),`Narration Preparation`),r.sources.article===`generate`&&n(xQ(i,vQ(r),r.articlePrompt),`Article`),r.sources.images===`generate`){for(let e of r.imagePrompts)n(xQ(i,`image`,e.name),`Image: ${e.name}`);r.reference?.source===`prompt`&&n(xQ(i,`image`,r.reference.prompt),`Establishing image`)}if((r.sources.thumbnail===`from_prompt`||r.sources.thumbnail===`prompt_by_llm`)&&n(xQ(i,`thumbnail`,r.thumbnailPrompt),`Thumbnail`),r.sources.audio===`generate`)for(let e of[`intro`,`outro`])n(SQ(a,e,r[e]),e===`intro`?`Intro`:`Outro`);return XE(r)&&n(xQ(i,`description`,r.descriptionPrompt??``),`YouTube description`),Gk(r)&&(n(xQ(i,`shorts`,r.shorts?.prompt??``),`Shorts`),n(xQ(i,`image`,r.shorts?.imagePrompt??``),`Shorts images`)),t}var TQ=[`name`,`template`,`once`,`time`,`weekdays`,`timezone`,`spend`,`topics`,`brief`,`generation`],Xbe={name:`schedule-name`,template:`schedule-template`,once:`schedule-once`,time:`schedule-time`,weekdays:`schedule-weekdays`,timezone:`schedule-timezone`,spend:`schedule-spend`,topics:`schedule-topics`,brief:`schedule-brief`,generation:`schedule-generation`},Zbe={name:`Name`,template:`Template`,once:`Run at`,time:`Local time`,weekdays:`Weekdays`,timezone:`Timezone`,spend:`Spend ceiling`,topics:`Topics`,brief:`Series brief`,generation:`Topic generation`};function Qbe(e){let t={};return e.name.trim()===``&&(t.name=`Give the schedule a name.`),e.templateChosen||(t.template=`Choose the template each run starts from.`),e.kind===`once`&&e.onceAt===``&&(t.once=`Pick the date and time of the one run.`),e.kind!==`once`&&e.time===``&&(t.time=`Pick the time of day runs start.`),e.kind===`weekly`&&e.days.length===0&&(t.weekdays=`Choose at least one weekday for a weekly schedule.`),Zw(e.timezone.trim())||(t.timezone=`Enter a timezone name like Europe/Tirane or America/New_York; start typing to see the list.`),EQ(e.spend)===void 0&&(t.spend=`Enter the ceiling in US dollars, such as 5 or 2.50, or leave it empty for no ceiling.`),e.topicProblems.length>0?t.topics=`Fix the topics first. ${e.topicProblems.slice(0,3).join(` `)}`:e.topicCount>500&&(t.topics=`Keep the list to 500 topics or fewer; it has ${String(e.topicCount)}.`),e.brief.trim().length>4e3&&(t.brief=`Keep the series brief to ${String(rT)} characters or fewer.`),e.generationLlm!==null&&(e.generationLlm.provider===``||e.generationLlm.model===``)&&(t.generation=`Pick both a provider and a model for topic generation, or tick Use the template's LLM.`),t}function $be(e){return TQ.find(t=>e[t]!==void 0)}function exe(e){return TQ.filter(t=>e[t]!==void 0).map(t=>`${Zbe[t]}: ${e[t]??``}`).join(` `)}function EQ(e){let t=e.trim().replace(/^\$/,``);if(t===``)return null;if(/^\d+(\.\d{1,2})?$/.test(t))return Math.round(Number(t)*100)}function txe(e){return e==null?``:e%100==0?String(e/100):(e/100).toFixed(2)}function nxe(){try{return typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[]}catch{return[]}}var rxe=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],DQ=J({day:K().int().min(0).max(6),time:G().regex(/^([01]\d|2[0-3]):[0-5]\d$/)}),ixe=J({name:G().trim().min(1).max(20),series:G().trim().max(100).default(``),long:DQ,shorts:q(DQ).max(10),schedule:G().optional(),runDay:K().int().min(0).max(6).optional(),timeZone:G().optional(),label:G().optional()});J({timeZone:G().min(1).max(100),rows:q(ixe).max(14)});var axe=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],oxe=[1,2,3,4,5,6,0];function OQ(e,t){return{day:(e+1+Math.floor(t/2))%7,time:t%2==0?`12:00`:`17:00`}}function sxe(e,t){return{day:e,long:{day:e,time:`20:00`},shorts:Array.from({length:t},(t,n)=>OQ(e,n))}}function kQ(e,t,n){return oxe.filter(e=>t.includes(e)).map(t=>{let r=e.find(e=>e.day===t)??sxe(t,n);return{...r,shorts:Array.from({length:n},(e,n)=>r.shorts[n]??OQ(t,n))}})}function AQ({value:e,label:t,onChange:n}){return(0,h.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(`span`,{className:`w-[64px] shrink-0 text-small text-ink-3`,children:t}),(0,h.jsx)(bL,{"aria-label":`${t}: day`,className:`w-[84px]`,value:String(e.day),onChange:t=>n({...e,day:Number(t.currentTarget.value)}),options:rxe.map((e,t)=>({value:String(t),label:e}))}),(0,h.jsx)(X,{"aria-label":`${t}: time`,type:`time`,className:`w-[124px]`,value:e.time,onChange:t=>n({...e,time:t.currentTarget.value||e.time})})]})}function cxe({releases:e,onReleases:t,runDays:n,shorts:r,once:i,timezone:a}){let o=e===null?[]:kQ(e,n,r),s=(e,n)=>t(o.map(t=>t.day===e?n:t));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`,...xy,children:[(0,h.jsx)(`legend`,{className:`float-left mb-1 w-full text-title-3 font-semibold`,children:`Release times`}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:i?`A one-time schedule has no release times: set the project's in its Video section once it is done.`:`When each run's project goes out on YouTube, in ${a}. Each short goes out the first time its day and hour come round after the one before it. Calendar → Releases shows them, and the Studio extension types them into Studio.`}),i?null:e===null?(0,h.jsx)(`div`,{children:(0,h.jsx)(B,{variant:`secondary`,onClick:()=>t(kQ([],n,r)),disabled:n.length===0,children:`Set release times`})}):(0,h.jsxs)(h.Fragment,{children:[o.map(e=>(0,h.jsxs)(`div`,{className:`flex flex-col gap-2 border-b border-line pb-3 last:border-b-0`,children:[(0,h.jsxs)(`div`,{className:`text-small font-semibold`,children:[axe[e.day],`'s run`]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-2`,children:[(0,h.jsx)(AQ,{label:`Video`,value:e.long,onChange:t=>s(e.day,{...e,long:t})}),e.shorts.map((t,n)=>(0,h.jsx)(AQ,{label:`Short ${String(n+1)}`,value:t,onChange:t=>s(e.day,{...e,shorts:e.shorts.map((e,r)=>r===n?t:e)})},n))]})]},e.day)),r===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`The template makes no shorts, so only the long video has a time.`}):null,(0,h.jsx)(`div`,{children:(0,h.jsx)(B,{variant:`quiet`,onClick:()=>t(null),children:`Set no release times`})})]})]})}function jQ(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 MQ({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=jQ;return t===void 0?(0,h.jsx)(mR,{label:`Keywords`,children:e.map(e=>(0,h.jsx)(hR,{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)(_L,{label:a(e.name),tip:s,help:l(e),error:n?.(`${r}.${e.name}`),children:(0,h.jsx)(X,{"data-play-field":`${r}.${e.name}`,value:e.value,maxLength:c,...o===void 0?{}:{"aria-label":o(e.name)},spellCheck:e.topic===!0,"aria-invalid":n?.(`${r}.${e.name}`)!==void 0,onChange:n=>t(e.name,n.target.value)})},e.name))})}var NQ={lines:`One per line`,table:`Table`,yaml:`YAML / JSON`};function PQ(e){return{mode:`lines`,rows:e,lines:SG(e),base:e,yaml:``,columns:FQ(e,[])}}function FQ(e,t){return[...new Set([...t,...e.flatMap(e=>Object.keys(e.values))])]}function IQ(e){return e.keywords.filter(t=>t!==e.topicKeyword&&(e.everyRun[t]??``).trim()===``)}function LQ(e,t){if(t.form===void 0)return{rows:e.rows,problems:[]};if(e.mode===`yaml`){let n=CG(e.yaml,{keywords:t.keywords,topicKeyword:t.topicKeyword,required:IQ(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:yG(n,{keywords:t.keywords,topicKeyword:t.topicKeyword,...e.mode===`table`?{required:IQ(t)}:{},kept:t.kept})}}function lxe(e,t,n){if(t===e.mode)return{queue:e,problems:[]};let r=e.rows;if(e.mode===`yaml`){let t=CG(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`?SG(r):e.lines,base:t===`lines`?r:e.base,yaml:t===`yaml`?wG(r,n.topicKeyword):e.yaml,columns:FQ(r,e.columns)},problems:[]}}function RQ(e,t,n){return{...e,rows:t,lines:e.mode===`lines`?SG(t):e.lines,base:e.mode===`lines`?t:e.base,yaml:e.mode===`yaml`?wG(t,n):e.yaml,columns:FQ(t,e.columns)}}function uxe(e,t,n){if(!/\.(ya?ml|json)$/i.test(e))return{ok:!0,rows:xG(t,[])};let r=CG(t,{keywords:n.keywords.length===0?Object.keys(n.everyRun):n.keywords,topicKeyword:n.topicKeyword});return r.ok?{ok:!0,rows:r.rows}:{ok:!1,problems:r.problems}}var zQ={"aria-hidden":!0,strokeWidth:1.75};function BQ(e,t,n){if(!e.altKey||e.key!==`ArrowUp`&&e.key!==`ArrowDown`)return!1;e.preventDefault();let r=e.key===`ArrowUp`;return t.busy||r&&t.index===0||!r&&t.index===t.count-1||n(t.index+(r?-1:1),r?`up`:`down`),!0}var VQ=`Alt+ArrowUp Alt+ArrowDown`;function HQ({name:e,index:t,count:n,busy:r,onMove:i,onRemove:a,onInsertBelow:o,onDuplicate:s}){let c=(0,m.useRef)(!1),l=t===0,u=t===n-1;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(bv,{size:`small`,label:`Move ${e} up`,disabled:r||l,onClick:()=>i(t-1,`up`),children:(0,h.jsx)(wc,{...zQ})}),(0,h.jsx)(bv,{size:`small`,label:`Move ${e} down`,disabled:r||u,onClick:()=>i(t+1,`down`),children:(0,h.jsx)(bc,{...zQ})}),(0,h.jsx)(bv,{size:`small`,label:`Remove ${e}`,disabled:r,onClick:a,children:(0,h.jsx)(kl,{...zQ})}),(0,h.jsxs)(BO,{children:[(0,h.jsx)(VO,{asChild:!0,children:(0,h.jsx)(bv,{size:`small`,label:`More for ${e}`,disabled:r,children:(0,h.jsx)(Hc,{...zQ})})}),(0,h.jsxs)(HO,{onCloseAutoFocus:e=>{c.current&&(c.current=!1,e.preventDefault(),o())},children:[(0,h.jsxs)(UO,{disabled:l,onSelect:()=>i(0,`to the top`),children:[(0,h.jsx)(Cc,{...zQ,className:`size-4`}),`Move to top`]}),(0,h.jsxs)(UO,{disabled:u,onSelect:()=>i(n-1,`to the bottom`),children:[(0,h.jsx)(vc,{...zQ,className:`size-4`}),`Move to bottom`]}),(0,h.jsxs)(UO,{onSelect:()=>{c.current=!0},children:[(0,h.jsx)(rl,{...zQ,className:`size-4`}),`Insert below`]}),(0,h.jsxs)(UO,{onSelect:s,children:[(0,h.jsx)(Bc,{...zQ,className:`size-4`}),`Duplicate`]})]})]})]})}function UQ(e){return e.split(/\r?\n/).map(e=>e.replace(/^\s*[-*•]\s+/,``).trim()).filter(e=>e!==``)}function WQ(e,t,n){let r=[...e],[i]=r.splice(t,1);return i===void 0||r.splice(Math.min(Math.max(n,0),r.length),0,i),r}function GQ(e,t,n){let r=Math.min(Math.max(t,0),e.length);return[...e.slice(0,r),...n,...e.slice(r)]}var KQ=0;function qQ(e){return Array.from({length:e},()=>(KQ+=1,`row-${String(KQ)}`))}function JQ(e,t,n){let r=new Map;return e.forEach((e,n)=>{let i=t[n];i!==void 0&&r.set(e.title,[...r.get(e.title)??[],i])}),n.map(e=>r.get(e.title)?.shift()??qQ(1)[0]??``)}var YQ=()=>({title:``,values:{}});function dxe({queue:e,onQueue:t,keyword:n,addable:r,titleOf:i}){let a=wv(),o=n===null?`Title`:`{{${n}}}`,s=(0,m.useRef)({rows:e.rows,keys:qQ(e.rows.length)});s.current.rows!==e.rows&&(s.current={rows:e.rows,keys:JQ(s.current.rows,s.current.keys,e.rows)});let c=s.current.keys,l=(0,m.useRef)(e);l.current=e;let u=AG(c),d=(0,m.useRef)(new Map),f=(0,m.useRef)(null);(0,m.useEffect)(()=>{let e=f.current;e!==null&&c.includes(e)&&(f.current=null,d.current.get(e)?.focus())},[c]);let p=(n,r,i)=>{s.current={rows:n,keys:r},i!==void 0&&(f.current=i),t({...e,rows:n})},g=(t,n)=>{let r=qQ(n.length);p(GQ(e.rows,t,n),GQ(c,t,r),r[0])},_=(t,n)=>p(e.rows.map((e,r)=>r===t?n:e),c),v=(t,n)=>{let r=c[t];p(WQ(e.rows,t,n),WQ(c,t,n),r)},y=r=>{let i=[...new Set(r)].filter(e=>e>=0).sort((e,t)=>e-t),o=i.flatMap(t=>{let n=e.rows[t];return n===void 0?[]:[{at:t,row:n}]});if(o.length===0)return;let s=new Set(i);p(e.rows.filter((e,t)=>!s.has(t)),c.filter((e,t)=>!s.has(t)));let u=o[0]?.row.title.trim()??``;a(o.length===1?`Removed ${u===``?`an empty topic`:`“${u}”`}. Save the schedule to keep it.`:`Removed ${PG(o.length,`topic`,`topics`)}. Save the schedule to keep it.`,`success`,{label:`Undo`,run:()=>{let e=[...l.current.rows];for(let{at:t,row:n}of o)e=GQ(e,t,[n]);t(RQ(l.current,e,n))}})};return(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,...xy,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsxs)(B,{size:`small`,onClick:()=>g(e.rows.length,[YQ()]),children:[(0,h.jsx)(pl,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Add topic`]}),r.length===0?null:(0,h.jsxs)(bL,{"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))]})]}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,onKeyDown:u.onKeyDown,children:[e.rows.length>1?(0,h.jsx)(NG,{selection:u,total:e.rows.length,noun:[`topic`,`topics`],actions:(0,h.jsx)(B,{size:`small`,variant:`quiet`,disabled:u.count===0,disabledReason:`Tick the topics to remove`,onClick:()=>{y(u.selected.map(e=>c.indexOf(e))),u.clear()},children:`Remove selected`})}):null,(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)(`span`,{className:`sr-only`,children:`Select`})}),(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)(U,{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)(bv,{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)(kl,{"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:`Actions`})})]})}),(0,h.jsx)(`tbody`,{children:e.rows.map((t,n)=>{let r=c[n]??String(n),a=t.title.trim()===``?`topic ${String(n+1)}`:t.title;return(0,h.jsxs)(`tr`,{children:[(0,h.jsx)(`td`,{children:(0,h.jsx)(MG,{selection:u,value:r,label:a})}),(0,h.jsx)(`td`,{className:`num`,children:n+1}),(0,h.jsx)(`td`,{children:(0,h.jsx)(X,{ref:e=>{e===null?d.current.delete(r):d.current.set(r,e)},"aria-label":`Topic ${String(n+1)} ${o}`,"aria-keyshortcuts":VQ,maxLength:200,value:t.title,className:`min-w-[14rem]`,onChange:e=>_(n,{...t,title:e.target.value}),onPaste:t=>{let r=UQ(t.clipboardData.getData(`text`));if(r.length<2)return;t.preventDefault();let[i=``,...a]=r,o=e.rows.map((e,t)=>t===n?{...e,title:`${e.title}${i}`}:e),s=qQ(a.length);p(GQ(o,n+1,a.map(e=>({title:e,values:{}}))),GQ(c,n+1,s),s.at(-1))},onKeyDown:t=>{BQ(t,{index:n,count:e.rows.length,busy:!1},e=>v(n,e))||t.key===`Enter`&&(t.preventDefault(),g(n+1,[YQ()]))}})}),e.columns.map(e=>(0,h.jsx)(`td`,{children:(0,h.jsx)(X,{"aria-label":`Topic ${String(n+1)} ${e}`,maxLength:hG,placeholder:`Every-run value`,value:t.values[e]??``,className:`min-w-[8rem]`,onChange:r=>_(n,{...t,values:{...t.values,[e]:r.target.value}})})},e)),(0,h.jsx)(`td`,{className:`min-w-[180px] text-small text-ink-2`,children:i(t)??`—`}),(0,h.jsx)(`td`,{children:(0,h.jsx)(`span`,{className:`flex items-center gap-1`,children:(0,h.jsx)(HQ,{name:a,index:n,count:e.rows.length,busy:!1,onMove:e=>v(n,e),onRemove:()=>y([n]),onInsertBelow:()=>g(n+1,[YQ()]),onDuplicate:()=>g(n+1,[t])})})})]},r)})})]})})]})]})}function fxe({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=LQ(e,n),y=e.mode===`yaml`?v.rows:e.rows,b=e=>p===void 0?void 0:rye(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=()=>wG(LQ(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=(0,m.useRef)(null),O=async r=>{let i=uxe(r.name,await r.text(),n);if(!i.ok){u(`${r.name} wasn't imported: ${i.problems.slice(0,3).join(` `)} Fix the file and import it again, or paste its text under YAML / JSON to see every problem.`);return}if(i.rows.length===0){u(`${r.name} has no topics in it. Put one topic per line, or a YAML / JSON list.`);return}t(RQ(e,[...LQ(e,n).rows,...i.rows],f)),u(`Imported ${String(i.rows.length)} ${i.rows.length===1?`topic`:`topics`} from ${r.name}, after the ones already here.`)},k=d.filter(t=>t!==f&&!e.columns.includes(t)),A=[...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)(U,{id:`planning.schedule.topics`})]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(wy,{label:`How to write the topics`,tip:`planning.schedule.topic-format`,value:e.mode,options:Object.keys(NQ).map(e=>({value:e,label:NQ[e]})),onChange:r=>{let i=lxe(e,r,n);c(i.problems),t(i.queue)}}),(0,h.jsxs)(B,{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)(Bc,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Copy as YAML`]}),(0,h.jsxs)(B,{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)(Vc,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Export as YAML`]}),(0,h.jsxs)(B,{variant:`quiet`,size:`small`,onClick:()=>D.current?.click(),children:[(0,h.jsx)(Cl,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Import`]}),(0,h.jsx)(`input`,{ref:D,type:`file`,hidden:!0,accept:`.yaml,.yml,.json,.txt,text/plain,application/json,application/yaml`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t!==void 0&&O(t)}}),l===null?null:(0,h.jsx)(`span`,{role:`status`,className:`text-small text-ink-2`,children:l})]}),e.mode===`lines`?(0,h.jsx)(_L,{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)(yL,{rows:Math.min(16,Math.max(6,y.length+1)),value:e.lines,onChange:n=>t({...e,lines:n.target.value,rows:xG(n.target.value,e.base)}),placeholder:`Pyramids
|
|
272
272
|
Sphinxes
|
|
273
273
|
Obelisks`})}):e.mode===`yaml`?(0,h.jsx)(_L,{id:`schedule-topics-yaml`,label:`Topics as YAML or JSON`,tip:`planning.schedule.topic-yaml`,children:(0,h.jsx)(yL,{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)(dxe,{queue:e,onQueue:t,keyword:f,addable:k,titleOf:b}),v.rows.length===0?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,"aria-live":`polite`,children:`${_Q(v.rows.length,500,`topics`)}.`}),A.length===0?null:(0,h.jsx)(GM,{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:[A.slice(0,8).map(e=>(0,h.jsx)(`li`,{children:e},e)),A.length>8?(0,h.jsx)(`li`,{children:`And ${String(A.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)(_L,{label:`Each topic fills`,id:`schedule-topic-keyword`,tip:`planning.schedule.topic-keyword`,...f===null?{}:{help:jQ({feeds:_(f)})},children:(0,h.jsx)(bL,{value:f??``,onChange:e=>r(e.target.value),children:d.map(e=>(0,h.jsx)(`option`,{value:e,children:`{{${e}}}`},e))})})}),(0,h.jsx)(MQ,{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]})}var pxe=[[1,`Mon`],[2,`Tue`],[3,`Wed`],[4,`Thu`],[5,`Fri`],[6,`Sat`],[0,`Sun`]];function mxe({templates:e,pending:t,onCreated:n,onError:r,editing:i,onCancel:a,error:o,onBusy:s}){let{api:c}=V(),[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`?gbe(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)(txe(i?.spendLimitCents)),[k,A]=(0,m.useState)(()=>PQ(i?.items??[])),[j,M]=(0,m.useState)(i?.topicKeyword??null),[N,P]=(0,m.useState)(i?.values??{}),[ee,F]=(0,m.useState)(i?.brief??``),[te,ne]=(0,m.useState)(i?.topicGeneration??aT),[re,ie]=(0,m.useState)((i?.releases??[]).length===0?null:i?.releases??null),[ae,oe]=(0,m.useState)(!1),[se,ce]=(0,m.useState)(!1),[le,ue]=(0,m.useState)(!1),de=(0,m.useId)(),fe=(0,m.useRef)(!1),pe=(0,m.useRef)(null),me=i&&!e.some(e=>e.id===i.templateId)?[...e,{id:i.templateId,version:i.templateVersion,name:`Saved template`}]:e,he=me.find(e=>e.id===d),ge=I({queryKey:[`project-template`,d],enabled:d!==``,queryFn:async()=>{let e=await wO(c,d);if(!e.ok)throw Error(e.message);return e.value}}),_e=ge.data?.document.form,ve=_e===void 0?void 0:wQ({form:_e,prompts:ge.data?.document.librarySnapshot?.prompts??[],entries:ge.data?.document.librarySnapshot?.entries??[]}),ye=_e===void 0?[]:gG(_e),be=j!==null&&ye.includes(j)?j:ye.find(e=>_e?.title.includes(`{{${e}}}`))??ye[0]??null,xe=Object.fromEntries(ye.filter(e=>e!==be).map(e=>[e,N[e]??_e?.values[e]??``])),Se={keywords:ye,topicKeyword:be,everyRun:xe,form:_e,kept:i?.items??[],...ve===void 0?{}:{origins:ve}},Ce=LQ(k,Se),we=p===`weekly`?x:p===`daily`?[0,1,2,3,4,5,6]:[],Te=_e!==void 0&&_e.sources.audio!==`off`&&_e.shorts?.enabled===!0?Math.max(0,Math.min(10,Number(_e.shorts.count)||0)):0,Ee=()=>Qbe({name:l,templateChosen:he!==void 0,kind:p,onceAt:_,time:y,days:x,timezone:C,spend:D,topicProblems:Ce.problems,topicCount:Ce.rows.length,brief:ee,generationLlm:te.llm}),De=le?Ee():{};async function Oe(e){if(e.preventDefault(),!(fe.current||t)){if(!pe.current){let e=Ee(),t=$be(e);if(t!==void 0){ue(!0),r(exe(e)),hxe(Xbe[t]);return}}fe.current=!0,oe(!0),s(!0);try{if(!pe.current){if(!he)throw Error(`Choose a template before saving the schedule.`);let e=C.trim();if(!Zw(e))throw Error(`Enter a timezone name like Europe/Tirane or America/New_York.`);let t=p===`once`?{kind:p,at:_be(_,e)}:p===`weekly`?{kind:p,time:y,days:x}:{kind:p,time:y},n=EQ(D);if(n===void 0)throw Error(`Enter the spend ceiling in US dollars, such as 5 or 2.50, or leave it empty.`);let r={id:i?.id??crypto.randomUUID(),name:l.trim(),templateId:he.id,templateVersion:he.version,cadence:t,timezone:e,missedPolicy:T,overlapPolicy:`skip`,spendLimitCents:n,items:Ce.rows,topicKeyword:be,values:xe,brief:ee.trim()===``?null:ee.trim(),topicGeneration:te,releases:re===null||p===`once`?[]:kQ(re,we,Te)};pe.current=i?{...r,baseVersion:i.version,mutationId:crypto.randomUUID()}:r}let e=pe.current,{id:t,...a}=e,o=`mutationId`in a?await gT(c,t,a):await hT(c,e);if(!o.ok){pe.current=null,ce(!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}pe.current=null,ce(!1),ue(!1),u(``),A(PQ([])),n()}catch(e){ce(pe.current!==null),r(e instanceof Error?e.message:`The schedule wasn't saved. Try again.`)}finally{fe.current=!1,oe(!1),s(pe.current!==null)}}}return(0,h.jsxs)(`section`,{"aria-label":i?`Edit schedule`:`New schedule`,children:[o?(0,h.jsx)(GM,{tone:`danger`,title:`The schedule wasn't saved.`,className:`mb-4`,children:o}):null,(0,h.jsxs)(`form`,{noValidate:!0,onSubmit:e=>void Oe(e),children:[(0,h.jsxs)(`fieldset`,{disabled:ae||se||t,className:`m-0 grid min-w-0 gap-4 border-0 p-0 min-[700px]:grid-cols-2`,children:[(0,h.jsx)(_L,{label:`Name`,id:`schedule-name`,tip:`planning.schedule.name`,error:De.name,children:(0,h.jsx)(X,{required:!0,value:l,onChange:e=>u(e.target.value),placeholder:`Monday morning stories`})}),(0,h.jsx)(_L,{label:`Template`,id:`schedule-template`,tip:`planning.schedule.template`,error:De.template,children:(0,h.jsxs)(bL,{required:!0,value:d,onChange:e=>f(e.target.value),disabled:me.length===0,children:[(0,h.jsx)(`option`,{value:``,children:`Choose a template`}),me.map(e=>(0,h.jsxs)(`option`,{value:e.id,children:[e.name,` · v`,e.version]},e.id))]})}),(0,h.jsx)(_L,{label:`Cadence`,id:`schedule-cadence`,tip:`planning.schedule.cadence`,children:(0,h.jsxs)(bL,{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)(_L,{label:`Run at`,id:`schedule-once`,tip:`planning.schedule.once-at`,error:De.once,children:(0,h.jsx)(X,{required:!0,type:`datetime-local`,value:_,onChange:e=>v(e.target.value)})}):(0,h.jsx)(_L,{label:`Local time`,id:`schedule-time`,tip:`planning.schedule.time`,error:De.time,children:(0,h.jsx)(X,{required:!0,type:`time`,value:y,onChange:e=>b(e.target.value)})}),p===`weekly`?(0,h.jsxs)(`fieldset`,{id:`schedule-weekdays`,className:`m-0 min-w-0 border-0 p-0`,"aria-invalid":De.weekdays!==void 0,"aria-describedby":De.weekdays===void 0?void 0:`schedule-weekdays-error`,...xy,children:[(0,h.jsxs)(`legend`,{className:`sl-field__label mb-2 flex items-center gap-1`,children:[`Weekdays`,(0,h.jsx)(U,{id:`planning.schedule.weekdays`,className:`-my-1`})]}),(0,h.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:pxe.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))}),De.weekdays===void 0?null:(0,h.jsx)(`p`,{id:`schedule-weekdays-error`,className:`sl-field__error m-0 mt-1`,children:De.weekdays})]}):(0,h.jsx)(`div`,{}),(0,h.jsx)(_L,{label:`Timezone`,id:`schedule-timezone`,tip:p===`once`?`planning.schedule.timezone-once`:`planning.schedule.timezone`,help:`Start typing to pick from the list. This computer uses ${gxe}.`,error:De.timezone,children:(0,h.jsx)(X,{value:C,list:de,autoComplete:`off`,spellCheck:!1,onChange:e=>w(e.target.value),placeholder:`Europe/Tirane`})}),(0,h.jsx)(`datalist`,{id:de,children:nxe().map(e=>(0,h.jsx)(`option`,{value:e},e))}),(0,h.jsx)(_L,{label:`Missed run`,id:`schedule-missed`,tip:`planning.schedule.missed`,children:(0,h.jsxs)(bL,{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)(_L,{label:`Spend ceiling per run (US$, optional)`,id:`schedule-spend`,tip:`planning.schedule.spend`,tipLabel:`Spend ceiling`,help:`In dollars, such as 5 or 2.50. Empty means no ceiling.`,error:De.spend,children:(0,h.jsx)(X,{inputMode:`decimal`,value:D,onChange:e=>O(e.target.value),placeholder:`10.00`})}),(0,h.jsxs)(`div`,{id:`schedule-topics`,tabIndex:-1,className:`min-w-0 min-[700px]:col-span-2`,children:[(0,h.jsx)(fxe,{queue:k,onQueue:A,context:Se,onKeyword:M,onValue:(e,t)=>P(n=>({...n,[e]:t})),loading:d!==``&&ge.isPending,exportName:l}),De.topics===void 0?null:(0,h.jsx)(`p`,{className:`sl-field__error m-0 mt-2`,children:De.topics})]}),(0,h.jsx)(cxe,{releases:re,onReleases:ie,runDays:we,shorts:Te,once:p===`once`,timezone:C}),(0,h.jsx)(_xe,{problems:De,brief:ee,onBrief:F,generation:te,onGeneration:ne,templateLlm:_e?.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)(B,{type:`submit`,variant:`primary`,disabled:t||ae||me.length===0&&!se,children:ae?`Saving…`:se?`Retry save`:i?`Save changes`:`Save schedule`}),(0,h.jsx)(B,{variant:`quiet`,disabled:ae||se,onClick:a,children:i?`Cancel editing`:`Cancel`})]})]})]})}function hxe(e){let t=document.getElementById(e);t!==null&&(((t instanceof HTMLFieldSetElement?t.querySelector(`input, select, textarea`):t)??t).focus(),t.scrollIntoView?.({block:`center`,behavior:`smooth`}))}var gxe=Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`;function _xe({problems:e,brief:t,onBrief:n,generation:r,onGeneration:i,templateLlm:a}){let{api:o}=V(),s=I({...cy(o),enabled:r.mode!==`off`}),c=r.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)(U,{id:`planning.schedule.generation`})]}),(0,h.jsx)(_L,{label:`Series brief (optional)`,id:`schedule-brief`,tip:`planning.schedule.brief`,tipLabel:`Series brief`,help:_Q(t.length,rT,`characters`),error:e.brief,children:(0,h.jsx)(yL,{rows:3,maxLength:rT,value:t,onChange:e=>n(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)(_L,{label:`New topics`,id:`schedule-generation`,tip:`planning.schedule.new-topics`,error:e.generation,children:(0,h.jsxs)(bL,{value:r.mode,onChange:e=>{let t=e.target.value;i({...r,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`})]})}),r.mode===`off`?null:(0,h.jsx)(_L,{label:`Keep at least this many queued`,id:`schedule-keep`,tip:`planning.schedule.keep-count`,children:(0,h.jsx)(X,{type:`number`,min:1,max:100,value:String(r.keepAtLeast),onChange:e=>{let t=Math.round(Number(e.target.value));i({...r,keepAtLeast:Number.isFinite(t)?Math.min(100,Math.max(1,t)):1})}})})]}),r.mode===`off`?null:(0,h.jsxs)(`div`,{className:`flex flex-col gap-3`,...xy,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:c===null,onChange:e=>i({...r,llm:e.target.checked?null:{provider:a?.provider??``,model:a?.model??``}})}),`Use the template's LLM`,c===null&&a!==void 0&&a.provider!==``?` (${a.provider} · ${a.model})`:``]}),(0,h.jsx)(U,{id:`planning.schedule.generation-llm`,className:`-my-1`})]}),c===null?null:(0,h.jsxs)(`div`,{className:`grid gap-4 min-[700px]:grid-cols-2`,children:[(0,h.jsx)(jL,{label:`Provider`,family:`llm`,providers:s.data?.providers??[],value:c.provider,problem:s.error?.message,onPick:e=>i({...r,llm:{provider:e,model:``}})}),(0,h.jsx)(OL,{label:`Model`,provider:c.provider,value:c.model,problem:void 0,onPick:e=>i({...r,llm:{...c,model:e}})})]})]})]})}function vxe(e,t){let n=new Set(t);for(let t=1;;t+=1){let r=t===1?` (copy)`:` (copy ${String(t)})`,i=`${e.slice(0,200-r.length)}${r}`;if(!n.has(i))return i}}function yxe(e,t,n){return{id:t,name:n,templateId:e.templateId,templateVersion:e.templateVersion,cadence:e.cadence,timezone:e.timezone,missedPolicy:e.missedPolicy,overlapPolicy:e.overlapPolicy,spendLimitCents:e.spendLimitCents,items:[],topicKeyword:e.topicKeyword,values:e.values,brief:e.brief,topicGeneration:e.topicGeneration,releases:e.releases}}async function bxe(e,t,n){let r=vxe(t.name,n),i=await hT(e,yxe(t,crypto.randomUUID(),r));if(!i.ok)return{...i,message:i.reason===`not-due`?`“${t.name}” wasn't duplicated: its one-time run has already passed. Press New schedule and choose a time in the future instead.`:`“${t.name}” wasn't duplicated: ${i.message}`};let a=await _T(e,i.value.id,`pause`,i.value.version);return a.ok?a:{...a,message:`“${r}” was made but couldn't be paused: ${a.message} Press Pause on its row before its first run.`}}var XQ={newest:`Newest first`,next:`Next run first`,name:`Name A–Z`,changed:`Recently changed`},xxe=e=>Object.hasOwn(XQ,e);function Sxe(e,t,n){let r=t.trim().toLowerCase().split(/\s+/).filter(Boolean),i=e.filter(e=>r.every(t=>e.name.toLowerCase().includes(t)));return n===`newest`?i:[...i].sort((e,t)=>n===`name`?e.name.localeCompare(t.name):n===`changed`?t.updatedAt.localeCompare(e.updatedAt):(e.nextRunAt??`~`).localeCompare(t.nextRunAt??`~`))}function Cxe({query:e,sort:t,onQuery:n,onSort:r}){return(0,h.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2`,...xy,children:[(0,h.jsx)(X,{type:`search`,"aria-label":`Search schedules by name`,placeholder:`Search schedules`,value:e,className:`min-w-0 flex-1`,onChange:e=>n(e.target.value)}),(0,h.jsx)(bL,{"aria-label":`Sort schedules`,value:t,className:`w-auto`,onChange:e=>{let t=e.target.value;xxe(t)&&r(t)},children:Object.keys(XQ).map(e=>(0,h.jsx)(`option`,{value:e,children:XQ[e]},e))}),(0,h.jsx)(U,{id:`planning.schedules`})]})}function wxe({rowKey:e,index:t,title:n,count:r,busy:i,selection:a,inputRef:o,onRename:s,onMove:c,onRemove:l,onInsertBelow:u,onDuplicate:d}){let[f,p]=(0,m.useState)(n);return(0,m.useEffect)(()=>p(n),[n]),(0,h.jsx)(hR,{lead:(0,h.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(MG,{selection:a,value:e,label:n}),(0,h.jsx)(`span`,{className:`w-7 text-right text-small text-ink-3 tabular-nums`,children:t+1})]}),title:(0,h.jsx)(X,{ref:o,"aria-label":`Topic ${String(t+1)}`,"aria-keyshortcuts":VQ,maxLength:200,value:f,className:`min-w-[12rem]`,onChange:e=>p(e.target.value),onBlur:()=>s(f),onKeyDown:e=>{BQ(e,{index:t,count:r,busy:i},c)||(e.key===`Enter`?(e.preventDefault(),s(f)):e.key===`Escape`&&f!==n&&(e.preventDefault(),p(n)))}}),actions:(0,h.jsx)(HQ,{name:n,index:t,count:r,busy:i,onMove:c,onRemove:l,onInsertBelow:u,onDuplicate:d})})}function ZQ({label:e,placeholder:t,buttonLabel:n,disabled:r,disabledReason:i,autoFocus:a=!1,className:o,onAdd:s,onCancel:c}){let[l,u]=(0,m.useState)(``),d=async e=>{await s(e)&&u(``)};return(0,h.jsxs)(`form`,{className:z(`flex flex-wrap items-center gap-2`,o),onSubmit:e=>{e.preventDefault(),d(UQ(l))},children:[(0,h.jsx)(X,{"aria-label":e,placeholder:t,maxLength:200,value:l,autoFocus:a,className:`min-w-0 flex-1`,onChange:e=>u(e.target.value),onPaste:e=>{let t=e.clipboardData.getData(`text`);/\r?\n/.test(t.trim())&&(e.preventDefault(),d(UQ(`${l}${t}`)))},onKeyDown:e=>{e.key===`Escape`&&(c===void 0?l!==``&&(e.preventDefault(),u(``)):(e.preventDefault(),c()))}}),(0,h.jsxs)(B,{type:`submit`,size:`small`,disabled:r,disabledReason:i,children:[(0,h.jsx)(pl,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),n]}),c===void 0?null:(0,h.jsx)(B,{variant:`quiet`,size:`small`,onClick:c,children:`Cancel`})]})}var QQ=e=>`“${e}”`;function Txe(e,t){let{api:n}=V(),r=_(),i=wv(),[a,o]=(0,m.useState)(null),[s,c]=(0,m.useState)(!1),l=(0,m.useRef)(!1),u=(0,m.useRef)(e);e.version>u.current.version&&(u.current=e);let d=(0,m.useRef)({version:e.version,items:e.items,keys:qQ(e.items.length)});if(d.current.version!==u.current.version){let{items:e}=u.current;d.current={version:u.current.version,items:e,keys:JQ(d.current.items,d.current.keys,e)}}let f=(0,m.useRef)(null),p=u.current.items,h=d.current.keys,g=async(e,t,a,s)=>{if(l.current)return!1;l.current=!0;let f=u.current,p=d.current.keys;c(!0),o(null);try{let c=await e(f);return c.ok?(u.current=c.value,d.current={version:c.value.version,items:c.value.items,keys:t.length===c.value.items.length?t:JQ(f.items,p,c.value.items)},r.setQueryData(pT,e=>e?.map(e=>e.id===c.value.id?c.value:e)),r.invalidateQueries({queryKey:ET}),i(a,`success`,s?{label:`Undo`,run:()=>void g(e=>TT(n,e.id,{baseVersion:e.version,items:f.items}),p,`Put the topics back as they were.`,!1)}:void 0),!0):(o(c.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: ${c.message}`),await r.invalidateQueries({queryKey:pT}),!1)}catch(e){return o(`The topics weren't saved: ${e instanceof Error?e.message:`Slopify didn't answer.`} Check that Slopify is running, then try again.`),!1}finally{l.current=!1,c(!1)}},v=(e,t,r)=>g(t=>TT(n,t.id,{baseVersion:t.version,items:e}),t,r,!0);return{items:p,keys:h,saving:s,error:a,setError:o,focusKey:f,add:async(e,n=p.length,r=!1)=>{if(e.length===0)return o(`Write the new topic's ${t} first, then press Add topic.`),!1;let i=500-p.length;if(e.length>i)return o(`${PG(e.length,`topic`,`topics`)} didn't fit: a queue holds at most 500 and ${PG(i,`more fits`,`more fit`)}. Remove some topics first, or add fewer lines.`),!1;let a=qQ(e.length),s=a[0];return r&&s!==void 0&&(f.current=s),v(GQ(p,n,e.map(e=>({title:e,values:{}}))),GQ(h,n,a),e.length===1?`Added ${QQ(e[0]??``)}.`:`Added ${PG(e.length,`topic`,`topics`)}.`)},rename:(e,n)=>{let r=p[e],i=n.trim();if(r!==void 0&&i!==r.title){if(i===``){o(`Topic ${String(e+1)} needs a ${t}. Write one, or press its Remove button.`);return}v(p.map((t,n)=>n===e?{...t,title:i}:t),h,`Renamed to ${QQ(i)}.`)}},move:(e,t,r)=>{let i=p[e],a=h[e];i!==void 0&&e!==t&&(a!==void 0&&(f.current=a),g(r=>wT(n,r.id,{baseVersion:r.version,from:e,to:t}),WQ(h,e,t),`Moved ${QQ(i.title)} ${r}.`,!0))},remove:e=>{let t=new Set(e),n=p[e[0]??-1];return n===void 0?Promise.resolve(!1):v(p.filter((e,n)=>!t.has(n)),h.filter((e,n)=>!t.has(n)),t.size===1?`Removed ${QQ(n.title)}.`:`Removed ${PG(t.size,`topic`,`topics`)}.`)},duplicate:e=>{let t=p[e];if(t===void 0)return;if(p.length>=500){o(`${QQ(t.title)} wasn't duplicated: a queue holds at most 500 topics. Remove one first.`);return}let[n]=qQ(1);n!==void 0&&(f.current=n),v(GQ(p,e+1,[t]),GQ(h,e+1,n===void 0?[]:[n]),`Duplicated ${QQ(t.title)}.`)}}}function Exe({schedule:e}){let t=e.topicKeyword===null?`title`:`{{${e.topicKeyword}}}`,n=Txe(e,t),{items:r,keys:i,saving:a}=n,o=AG(i),[s,c]=(0,m.useState)(null),[l,u]=(0,m.useState)(!1),d=(0,m.useRef)(new Map);(0,m.useEffect)(()=>{let e=n.focusKey.current;if(e!==null&&i.includes(e)){if(!l&&i.indexOf(e)>=100){u(!0);return}n.focusKey.current=null,d.current.get(e)?.focus()}},[i,n.focusKey,l]);let f=r.length>=500,p=a?`Saving the last change`:`A queue holds at most 500 topics`,g=l?r.length:Math.min(r.length,100),_=s===null?-1:i.indexOf(s);return(0,h.jsxs)(`section`,{"aria-label":`Queued topics`,className:`mt-6`,...xy,children:[(0,h.jsx)(Sy,{as:`h3`,title:`Queued topics · ${String(r.length)}`,info:`planning.schedule.inline-topics`,meta:e.topicKeyword===null?`Each topic becomes the next project's title.`:`Each topic fills ${t}; the next run takes the first.`}),n.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 mt-2 text-small text-danger`,children:n.error}),(0,h.jsx)(ZQ,{className:`mt-3`,label:`New topic`,placeholder:`${e.topicKeyword===null?`New topic`:`New ${t}`}, or paste several lines`,buttonLabel:`Add topic`,disabled:a||f,disabledReason:p,onAdd:e=>n.add(e)}),r.length===0?null:(0,h.jsxs)(`div`,{onKeyDown:o.onKeyDown,children:[r.length>1?(0,h.jsx)(NG,{className:`mt-3`,selection:o,total:r.length,noun:[`topic`,`topics`],actions:(0,h.jsx)(B,{size:`small`,variant:`quiet`,disabled:a||o.count===0,disabledReason:a?`Saving the last change`:`Tick the topics to remove`,onClick:()=>void n.remove(o.selected.map(e=>i.indexOf(e))).then(e=>{e&&o.clear()}),children:`Remove selected`})}):null,(0,h.jsx)(mR,{label:`Topics of ${e.name}`,className:`mt-2`,children:r.slice(0,g).flatMap((e,t)=>{let s=i[t]??String(t),l=(0,h.jsx)(wxe,{rowKey:s,index:t,title:e.title,count:r.length,busy:a,selection:o,inputRef:e=>{e===null?d.current.delete(s):d.current.set(s,e)},onRename:e=>n.rename(t,e),onMove:(e,r)=>n.move(t,e,r),onRemove:()=>void n.remove([t]),onInsertBelow:()=>c(s),onDuplicate:()=>n.duplicate(t)},s);return t===_?[l,(0,h.jsx)(hR,{title:(0,h.jsx)(ZQ,{autoFocus:!0,label:`New topic below ${String(t+1)}`,placeholder:`New topic, or paste several lines`,buttonLabel:`Insert`,disabled:a||f,disabledReason:p,onAdd:async e=>{let r=await n.add(e,t+1,!0);return r&&c(null),r},onCancel:()=>c(null)})},`${s}:insert`)]:[l]})}),g<r.length?(0,h.jsx)(B,{variant:`quiet`,size:`small`,className:`mt-2`,onClick:()=>u(!0),children:`Show all ${String(r.length)} topics`}):null]})]})}function Dxe(e){return e.cadence.kind===`once`?`One time`:e.cadence.kind===`daily`?`Daily at ${e.cadence.time}`:`Weekly at ${e.cadence.time}`}function $Q({schedule:e}){return e.deletedAt===null?(0,h.jsx)(KO,{tone:iR[e.status].tone,children:iR[e.status].word}):(0,h.jsx)(KO,{tone:`off`,children:`Deleted`})}function e$({schedule:e,nextTitle:t,selected:n,pending:r,onSelect:i,onEdit:a,onAction:o,onConfirm:s}){let{api:c}=V(),l=e.deletedAt===null,u=l&&(e.status===`active`||e.status===`paused`),d=e.status===`canceled`||e.status===`completed`;return(0,h.jsx)(hR,{selected:n,onSelect:i,title:e.name,meta:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)($Q,{schedule:e}),` · ${Dxe(e)} · ${e.deletedAt===null?e.nextRunAt===null?`No future run`:`Next: ${eQ(e.nextRunAt,e.timezone)}${t===void 0?``:` · “${t}”`}`:`Deleted: ${eQ(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)(B,{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)(B,{variant:`quiet`,size:`small`,"aria-label":`Resume ${e.name}`,disabled:r,onClick:()=>o(()=>_T(c,e.id,`resume`,e.version)),children:`Resume`}):(0,h.jsx)(B,{variant:`quiet`,size:`small`,"aria-label":`Pause ${e.name}`,disabled:r||e.status!==`active`,disabledReason:`Only an active schedule can pause`,onClick:()=>o(()=>_T(c,e.id,`pause`,e.version)),children:`Pause`}),(0,h.jsx)(B,{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 Oxe({schedule:e,pending:t,onAction:n,onConfirm:r,onDuplicate:i}){let{api:a}=V(),o=I({queryKey:[`schedule`,e.id],queryFn:async()=>{let t=await _ce(a,e.id);if(!t.ok)throw Error(t.message);return t.value},refetchInterval:3e4}),s=e.deletedAt===null,c=s&&(e.status===`active`||e.status===`paused`),l=e.status===`paused`,u=[[`When`,e.cadence.kind===`once`?`Once, ${eQ(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`:eQ(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:[s&&c?(0,h.jsx)(kxe,{schedule:e,paused:l,onAction:n}):null,(0,h.jsxs)(Sy,{kicker:(0,h.jsx)($Q,{schedule:e}),title:e.name,meta:e.topics.held>0?`${String(e.topics.held)} topics waiting for you`:void 0,children:[s?(0,h.jsx)(B,{variant:`quiet`,size:`small`,"aria-label":`Duplicate ${e.name}`,disabled:t,disabledReason:`Finish or cancel the open change first`,onClick:i,children:`Duplicate`}):null,s?(0,h.jsx)(B,{variant:`quiet`,size:`small`,"aria-label":`Cancel ${e.name}`,disabled:t||!c,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:u.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))}),c?(0,h.jsx)(Exe,{schedule:e}):null,(0,h.jsx)(Abe,{schedule:e}),(0,h.jsx)(kG,{className:`my-6`}),(0,h.jsx)(Sy,{as:`h3`,title:`Run history`}),(0,h.jsx)(`div`,{className:`mt-3`,children:o.isPending?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`Loading history…`}):o.error?(0,h.jsx)(`p`,{className:`m-0 text-small text-danger`,children:`The run history couldn't be loaded: ${o.error.message} It tries again every 30 seconds.`}):o.data.runs.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`No runs yet.`}):(0,h.jsx)(mR,{label:`Runs of ${e.name}`,children:o.data.runs.map(t=>(0,h.jsx)(hR,{title:(0,h.jsx)(`span`,{className:`capitalize`,children:`${t.status} · ${eQ(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)(fa,{className:`underline hover:text-ink`,to:`/projects/$projectId`,params:{projectId:e},children:[`Project `,t+1]},e))}):`No projects`},t.id))})})]})}function kxe({schedule:e,paused:t,onAction:n}){let{api:r}=V();return Xy({id:`schedules.pause-resume`,title:t?`Resume schedule`:`Pause schedule`,group:`Schedules`,context:e.name,run:()=>n(()=>_T(r,e.id,t?`resume`:`pause`,e.version))}),null}var t$={llm:`Text model`,audio:`Voice model`,images:`Image model`,animate:`Animation model`},Axe=RegExp(`Settings → (${tk.map(e=>e.label.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).toSorted((e,t)=>t.length-e.length).join(`|`)})`,`g`);function jxe(e){let t=[],n=0;for(let r of e.matchAll(Axe)){let i=r[1],a=tk.find(e=>e.label===i);a!==void 0&&r.index!==void 0&&(r.index>n&&t.push(e.slice(n,r.index)),t.push({label:r[0],section:a.id}),n=r.index+r[0].length)}return n<e.length&&t.push(e.slice(n)),t}function n$({text:e}){if(mi({warn:!1})==null)return(0,h.jsx)(h.Fragment,{children:e});let t=jxe(e).map((e,t)=>typeof e==`string`?e:(0,h.jsx)(RO,{to:`/settings`,search:{section:e.section},children:e.label},t));return(0,h.jsx)(h.Fragment,{children:t})}function r$({kind:e,id:t,name:n}){let{api:r}=V(),i=_(),a=I({queryKey:Oz.retired,queryFn:()=>Fz(r)}),o=L({mutationFn:e=>Iz(r,e),onSuccess:()=>Promise.all([i.invalidateQueries({queryKey:Oz.retired}),i.invalidateQueries({queryKey:yO}),i.invalidateQueries({queryKey:pT})])}),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:[`${t$[t.slot]} ${t.model} is ${t.why===`retired`?`retired`:`no longer listed`}.`,t.blocked===null?``:` ${t.blocked}`,t.replacement===null&&t.blocked===null?(0,h.jsx)(n$,{text:` No replacement is suggested: choose another model in Settings → Models, or edit the ${e}.`}):null]}),t.replacement===null?null:(0,h.jsx)(B,{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 Mxe({tools:e,loaded:t,live:n,hiddenBySearch:r,channelFiltered:i,deleted:a,selectedId:o,pending:s,nextTitles:c,onPick:l,onEdit:u,onAction:d,onConfirm:f}){return(0,h.jsxs)(h.Fragment,{children:[e,n.length===0&&r>0?(0,h.jsx)(hQ,{title:`No schedule matches this search`,children:`Check the spelling, or clear the search to see all ${String(r)}.`}):t&&n.length===0?(0,h.jsx)(hQ,{title:i?`No schedules run this channel's templates`:a.length===0?`No schedules yet`:`No active schedules`,children:i?`Pick All channels to see the others, or make one from this channel's templates.`:a.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.`}):null,n.length>0?(0,h.jsx)(mR,{label:`Saved schedules`,className:`[&_.sl-row__actions]:flex-wrap`,children:n.map(e=>(0,h.jsxs)(m.Fragment,{children:[(0,h.jsx)(e$,{schedule:e,nextTitle:c.get(e.id),selected:o===e.id,pending:s,onSelect:()=>l(e.id),onEdit:()=>u(e),onAction:d,onConfirm:t=>f(t,e)}),(0,h.jsx)(r$,{kind:`schedule`,id:e.id,name:e.name})]},e.id))}):null,a.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 · `,a.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)(mR,{label:`Deleted schedules`,children:a.map(e=>(0,h.jsx)(e$,{schedule:e,nextTitle:void 0,selected:o===e.id,pending:!1,onSelect:()=>l(e.id),onEdit:()=>void 0,onAction:d,onConfirm:()=>void 0},e.id))})]}):null]})}function Nxe({pickedId:e,onPick:t}={}){let{api:n}=V(),r=_(),i=I(mT(n)),a=I(CO(n)),[o,s]=(0,m.useState)(null),c=wv(),[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=I(Ry(n)),[E]=(0,m.useState)(()=>{let e=new Date;return{from:e.toISOString(),to:new Date(e.valueOf()+79488e5).toISOString()}}),D=I(DT(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=qy().channelId,[A,j]=(0,m.useState)(k??``),M=e=>{if(A===``)return!0;let t=a.data?.find(t=>t.id===e.templateId);return(t?gQ(t):jy)===A},[N,P]=(0,m.useState)(``),[ee,F]=(0,m.useState)(`newest`),te=i.data?.filter(e=>e.deletedAt===null)??[],ne=te.length>=5,re=te.filter(M),ie=ne?Sxe(re,N,ee):re,ae=i.data?.filter(e=>e.deletedAt!==null)??[],oe=b!==null&&i.data!==void 0&&!i.data.some(e=>e.id===b),se=oe?null:i.data?.find(e=>e.id===b)??ie[0]??null,ce=L({onError:e=>s(e.message),onSettled:async()=>{w.current=!1,await r.invalidateQueries({queryKey:pT})},mutationFn:async e=>e(),onSuccess:async e=>{if(!e.ok){s(e.message);return}s(null)}}),le=e=>{w.current||(w.current=!0,s(null),ce.mutate(e))},ue=d||l!==null,de=()=>{u(null),f(!1),s(null)},fe=a.data?.length===0,pe=()=>{ue||fe||(u(null),f(!0),s(null))},me=e=>le(async()=>{let t=await bxe(n,e,(i.data??[]).map(e=>e.name));if(t.ok){let e=t.value;await r.invalidateQueries({queryKey:pT}),x(e.id),c(`Duplicated as “${e.name}”: paused, with an empty topic queue. Press Edit to change it, then Resume.`,`success`,{label:`Edit`,run:()=>he(e)})}return t}),he=e=>{f(!1),x(e.id),u(e),s(null)};Xy({id:`schedules.new`,title:`New schedule`,group:`Schedules`,keywords:[`calendar`,`recurring`],run:pe}),NO(kO.newSchedule,()=>{fe?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`):pe()},a.data!==void 0);let ge=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,_e=ce.isPending||p||ue;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:fe?(0,h.jsxs)(h.Fragment,{children:[`Save a template in`,` `,(0,h.jsx)(fa,{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)(U,{id:`planning.schedules`})]})}),(0,h.jsxs)(Sv,{children:[(0,h.jsxs)(bL,{"aria-label":`Filter schedules by channel`,value:A,className:`w-auto min-w-[160px]`,onChange:e=>j(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)(B,{variant:`primary`,onClick:pe,disabled:ue||fe,disabledReason:fe?`Save a template in Library → Templates first`:`Finish or cancel the open form first`,children:[(0,h.jsx)(pl,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`New schedule`]})]})]}),(0,h.jsx)(WR,{tone:ue?`info`:ge?.tone??`info`,className:`mb-2`,children:ue?void 0:ge?.text}),(0,h.jsx)(OG,{className:`min-[768px]:grid-cols-[minmax(320px,460px)_minmax(0,1fr)]`,list:(0,h.jsx)(Mxe,{tools:ne?(0,h.jsx)(Cxe,{query:N,sort:ee,onQuery:P,onSort:F}):null,loaded:i.data!==void 0,live:ie,hiddenBySearch:ne?re.length-ie.length:0,channelFiltered:A!==``,deleted:ae,selectedId:ue?void 0:se?.id,pending:_e,nextTitles:O,onPick:x,onEdit:he,onAction:le,onConfirm:(e,t)=>C({kind:e,schedule:t})}),detail:ue?(0,h.jsxs)(`div`,{children:[(0,h.jsx)(Sy,{kicker:l?l.name:void 0,title:l?`Edit schedule`:`New schedule`,className:`mb-4`}),(0,h.jsx)(mxe,{onBusy:g,editing:l,onCancel:()=>{p||de()},templates:a.data??[],pending:ce.isPending,error:o,onCreated:()=>{c(l?`Schedule updated.`:`Schedule saved. It will run automatically while Slopify is open.`,`success`),de(),r.invalidateQueries({queryKey:pT})},onError:e=>{s(e),r.invalidateQueries({queryKey:pT})}},l?.id??`new`)]}):oe?(0,h.jsx)(hQ,{title:`This schedule wasn't found`,children:`The link names a schedule that is no longer here: a deleted schedule leaves Settings → Trash after 30 days. Pick one from the list, or press New schedule.`}):se?(0,h.jsx)(Oxe,{schedule:se,pending:_e,onAction:le,onConfirm:e=>C({kind:e,schedule:se}),onDuplicate:()=>me(se)},se.id):null}),(0,h.jsx)(Bv,{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:ce.isPending,onCancel:()=>{ce.isPending||C(null)},onConfirm:()=>{if(!S)return;let{kind:e,schedule:t}=S;le(async()=>{let r=e===`delete`?await vce(n,t.id,t.version):await _T(n,t.id,`cancel`,t.version);return r.ok&&C(null),r})}})]})}var i$=[`studio`,`releases`],a$=new Intl.DateTimeFormat(void 0,{weekday:`short`,day:`numeric`,month:`short`}),Pxe=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`}),o$=e=>`${a$.format(new Date(e))}, ${Pxe.format(new Date(e))}`;function Fxe(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 Ixe(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:`neutral`,word:`Ready to upload`}}}function Lxe(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 ${a$.format(r)}`}}function Rxe({item:e,projectId:t,onDone:n}){let{api:r}=V(),i=_(),a=wv(),[o,s]=(0,m.useState)(e.at===null?``:Fxe(e.at)),c=L({mutationFn:n=>_s(r,t,{short:e.short,at:n}),onSuccess:()=>{i.invalidateQueries({queryKey:i$}),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)(X,{"aria-label":`${l}: release`,type:`datetime-local`,className:`w-[200px]`,value:o,onChange:e=>s(e.currentTarget.value)}),(0,h.jsx)(B,{type:`button`,size:`small`,disabled:o===``||c.isPending,onClick:()=>c.mutate(new Date(o).toISOString()),children:`Save`}),e.short===0?(0,h.jsx)(B,{type:`button`,size:`small`,variant:`quiet`,disabled:c.isPending,onClick:()=>c.mutate(null),children:`Not scheduled`}):null,(0,h.jsx)(B,{type:`button`,size:`small`,variant:`quiet`,onClick:n,children:`Cancel`})]})}function s$({item:e,projectId:t,editing:n,onEdit:r}){let i=Ixe(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.jsxs)(`span`,{className:`text-small text-ink-3`,children:[o,e.at===null?``:` · goes public`]}),e.short===0?null:(0,h.jsx)(`span`,{className:`w-full truncate text-small`,title:e.title,children:e.title}),a?(0,h.jsx)(Rxe,{item:e,projectId:t,onDone:()=>r(void 0)}):(0,h.jsx)(B,{type:`button`,size:`small`,variant:`quiet`,"aria-label":`${o}: move from ${e.at===null?`no time`:o$(e.at)}`,onClick:()=>r({projectId:t,short:e.short}),children:e.at===null?`Set a time`:o$(e.at)}),(0,h.jsx)(qO,{tone:i.tone,children:i.word})]})}function zxe({entry:e,candidates:t}){let{api:n}=V(),r=_(),i=wv(),a=t.filter(t=>e.series===``||t.series===e.series),[o,s]=(0,m.useState)(``),c=L({mutationFn:t=>_s(n,t,{short:0,at:e.at,...e.line===null?{}:{line:e.line}}),onSuccess:()=>void r.invalidateQueries({queryKey:i$}),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)(bL,{"aria-label":`Project for ${o$(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)(B,{type:`button`,size:`small`,disabled:o===``||c.isPending,onClick:()=>c.mutate(o),children:`Put it here`})]})}var c$=6048e5;function Bxe(e,t){let n=Math.min(Math.max(0,e),3),r=Math.min(8,(n+1)*2);return{weeks:r,start:n===0?void 0:new Date(t.getTime()+n*2*c$),end:new Date(t.getTime()+r*c$),hasEarlier:n>0,hasLater:n<3}}function Vxe(e,t){return e.filter(e=>{let n=new Date(e.at).getTime();return(t.start===void 0||n>=t.start.getTime())&&n<t.end.getTime()})}function Hxe(){let{api:e}=V(),[t,n]=(0,m.useState)(0),[r]=(0,m.useState)(()=>new Date),i=Bxe(t,r),a=I({queryKey:[...i$,i.weeks],queryFn:()=>ms(e,i.weeks),placeholderData:e=>e}),[o,s]=(0,m.useState)();if(a.isPending)return(0,h.jsx)(`p`,{className:`text-small text-ink-3`,children:`Loading the releases…`});if(a.isError)return(0,h.jsxs)(`p`,{className:`text-small text-danger`,children:[`The releases didn't load: `,a.error.message,` Reload the page to try again.`]});let c=a.data,l=Vxe(c.entries,i),u=t===0?`The next two weeks`:`${a$.format(i.start??r)} to ${a$.format(i.end)}`,d=new Map;for(let e of l){let t=Lxe(e.at,r),n=d.get(t.key)??{label:t.label,entries:[]};n.entries.push(e),d.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(c.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)(fa,{to:`/settings`,search:{section:`studio`},children:`Settings → YouTube Studio`}),`.`]}),(0,h.jsxs)(`nav`,{"aria-label":`Release weeks`,className:`flex flex-wrap items-center gap-3`,children:[(0,h.jsxs)(Sv,{children:[(0,h.jsx)(B,{size:`small`,disabled:!i.hasEarlier,disabledReason:`Releases already public are not listed here; open the project to see its release.`,onClick:()=>n(t-1),children:`Earlier`}),(0,h.jsx)(B,{size:`small`,disabled:!i.hasLater,disabledReason:`Releases are listed up to 8 weeks ahead.`,onClick:()=>n(t+1),children:`Later`}),t===0?null:(0,h.jsx)(B,{size:`small`,variant:`quiet`,onClick:()=>n(0),children:`Back to this week`})]}),(0,h.jsx)(`span`,{className:`text-small text-ink-2`,role:`status`,children:u})]}),l.length===0?t===0?(0,h.jsx)(hQ,{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, or press Later to look further ahead.`}):(0,h.jsx)(hQ,{title:`No releases from ${u}`,children:`Nothing is planned in these weeks yet. Press Back to this week, or Earlier.`}):null,[...d.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),n=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:o$(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)(fa,{to:`/projects/$projectId`,params:{projectId:e.project.id},children:e.project.title})]}),e.project===null?(0,h.jsx)(zxe,{entry:e,candidates:c.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)(s$,{item:t,projectId:e.project.id,editing:o,onEdit:s}),n.map(t=>(0,h.jsx)(s$,{item:t,projectId:e.project?.id??``,editing:o,onEdit:s},t.short))]})]},`${e.at}-${e.project?.id??`free`}`)})})]},e.label))]})}var l$=4;function Uxe(e){return e===`schedules`?`schedules`:e===`releases`?`releases`:`weeks`}var u$=new Intl.DateTimeFormat(void 0,{dateStyle:`full`}),d$=new Intl.DateTimeFormat(void 0,{day:`numeric`,month:`short`}),f$=864e5,p$=`slopify.calendar.view`;function Wxe(){try{return window.localStorage.getItem(p$)===`list`?`list`:`weeks`}catch{return`weeks`}}function Gxe({tab:e,schedule:t,onTab:n,onSchedule:r}={}){let{api:i}=V(),a=qy(),[o,s]=(0,m.useState)(0),c=(0,m.useMemo)(()=>SR(new Date(Date.now()+o*l$*7*f$),l$),[o]),[l,u]=(0,m.useState)(Wxe),[d,f]=(0,m.useState)(e??`weeks`),p=n===void 0?d:e??`weeks`,g=e=>{n===void 0?f(e):n(e)},[_,v]=(0,m.useState)(!1),y=I(DT(i,c.from,c.to)),b=I(mT(i)),x=I(CO(i)),S=I(iy(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=>a.includes(D.get(e.templateId))),A=y.data===void 0?void 0:{...y.data,runs:y.data.runs.filter(e=>a.includes(D.get(e.templateId))),projects:y.data.projects.filter(e=>a.includes(O.get(e.id)))},j=(0,m.useMemo)(()=>A===void 0?new Map:xR(A),[A]),M=A?.runs??[],N=dR(A?.projects??[]),P=Ibe(DT(i,c.from,c.to).queryKey,w),ee=(e,t,n)=>{if(e.kind!==`none`){if(e.kind===`refused`){w(e.message);return}P.mutate({drop:e,title:t,where:n})}},F=(e,t)=>{let n=wR(M,e,t);if(n===void 0){w(t===-1?`${TR(e)} is already the next topic of ${e.scheduleName}.`:`${TR(e)} is the last topic on the calendar for ${e.scheduleName}. Show Later weeks to move it further.`);return}let r=u$.format(new Date(n.at));ee(CR(e,n,r),TR(e),r)},te=e=>{u(e),p!==`weeks`&&g(`weeks`);try{window.localStorage.setItem(p$,e)}catch{}};Xy({id:`calendar.add`,title:`Add to calendar`,group:`Calendar`,keywords:[`topics`,`batch`,`queue`],run:()=>v(!0)}),Xy({id:`calendar.schedules`,title:`Show the schedules`,group:`Calendar`,keywords:[`edit`,`recurring`,`pause`,`resume`],run:()=>g(`schedules`)}),NO(kO.addToCalendar,()=>v(!0)),Xy({id:`calendar.weeks`,title:`Show the calendar as weeks`,group:`Calendar`,run:()=>te(`weeks`)}),Xy({id:`calendar.list`,title:`Show the calendar as a list`,group:`Calendar`,run:()=>te(`list`)});let ne=k.reduce((e,t)=>e+(t.deletedAt===null?t.items.length:0),0),re=vR(new Date),ie=`${d$.format(new Date(c.from))} to ${d$.format(new Date(Date.parse(c.to)-2*f$))}`,ae=(A?.queued??[]).toSorted((e,t)=>e.position-t.position),oe=ae.filter(e=>e.state===`queued`),se=(b.data??[]).filter(e=>e.deletedAt===null).length;return(0,h.jsxs)(`div`,{"data-tour":`calendar`,children:[(0,h.jsx)(EG,{title:`Calendar`,meta:`${a.channel?.name??`Every channel`} · ${String(M.length)} scheduled ${M.length===1?`run`:`runs`} ${o===0?`in the next ${String(l$)} weeks`:ie} · ${String(ne)} ${ne===1?`topic`:`topics`} queued`,actions:p===`weeks`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(wy,{label:`Calendar view`,tip:`planning.calendar.view`,value:l,onChange:te,options:[{value:`weeks`,label:`Weeks`},{value:`list`,label:`List`}]}),(0,h.jsxs)(B,{variant:`primary`,onClick:()=>v(!0),children:[(0,h.jsx)(pl,{"aria-hidden":`true`,strokeWidth:1.75}),`Add to calendar`]})]}):void 0}),(0,h.jsx)(pQ,{items:[{id:`weeks`,label:`Coming weeks`},{id:`releases`,label:`Releases`},{id:`schedules`,label:`Schedules`,...b.data===void 0?{}:{badge:String(se)}}],value:p,onChange:g,label:`Calendar sections`,idPrefix:`calendar`,className:`mb-6`}),(0,h.jsx)(mQ,{idPrefix:`calendar`,id:`releases`,active:p===`releases`,children:p===`releases`?(0,h.jsx)(Hxe,{}):null}),(0,h.jsx)(mQ,{idPrefix:`calendar`,id:`schedules`,active:p===`schedules`,children:p===`schedules`?(0,h.jsx)(Nxe,{pickedId:t,onPick:r}):null}),(0,h.jsxs)(mQ,{idPrefix:`calendar`,id:`weeks`,active:p===`weeks`,children:[(0,h.jsx)(WR,{tone:C===null?`info`:`error`,className:`mb-3`,children:C??void 0}),y.data===void 0||y.error===null?null:(0,h.jsx)(`div`,{className:`mb-3`,children:(0,h.jsx)(qL,{what:`the calendar`,error:y.error,updatedAt:y.dataUpdatedAt,onRetry:()=>void y.refetch(),retrying:y.isFetching})}),y.data===void 0&&y.error!==null?(0,h.jsx)(KL,{what:`The calendar`,error:y.error,onRetry:()=>void y.refetch(),retrying:y.isFetching}):(0,h.jsxs)(h.Fragment,{children:[A===void 0||N.length===0?null:(0,h.jsxs)(`p`,{className:`m-0 mb-4 text-small text-ink-2`,children:[uR(N),`. `,(0,h.jsx)(RO,{to:`/`,children:`Open Home`}),` to act on them.`]}),b.data!==void 0&&aQ(k).length===0?null:(0,h.jsx)(`section`,{"aria-label":`Suggested topics`,className:`mb-6 min-w-0`,children:b.data===void 0&&b.error!==null?(0,h.jsx)(KL,{compact:!0,what:`Your schedules`,error:b.error,onRetry:()=>void b.refetch(),retrying:b.isFetching}):(0,h.jsx)(jbe,{schedules:k})}),(0,h.jsxs)(`section`,{"aria-label":`Coming weeks`,className:`flex min-w-0 flex-col gap-4`,children:[(0,h.jsx)(Kxe,{label:ie,shift:o,onShift:e=>s(t=>e===0?0:t+e)}),y.data===void 0?(0,h.jsx)(GL,{label:`Loading the calendar…`,rows:2,rowClassName:`h-40`}):l===`weeks`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Drag a topic by its grip 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+→.`}),bR(new Date(c.from),l$).map(e=>(0,h.jsx)(`div`,{className:`sl-cal-week`,children:e.map(e=>{let t=vR(e),n=j.get(t);return(0,h.jsx)(kR,{date:e,today:t===re,day:n,dragging:T,busy:P.isPending,onDragStart:E,onDragEnd:()=>E(null),onDrop:t=>{T!==null&&(ee(CR(T,t,u$.format(e)),TR(T),u$.format(e)),E(null))},onStep:F},t)})},vR(e[0]??new Date)))]}):(0,h.jsx)(bV,{days:j,busy:P.isPending,onStep:F,schedules:k,onMove:(e,t)=>{let n=u$.format(new Date(t.at));ee(CR(e,t,n),TR(e),n)},onTransfer:(e,t)=>{e.index!==null&&ee({kind:`transfer`,scheduleId:e.scheduleId,baseVersion:e.scheduleVersion,index:e.index,targetId:t,position:void 0},TR(e),`the end of ${k.find(e=>e.id===t)?.name??`the other schedule`}`)}}),A!==void 0&&A.queued.length>0?(0,h.jsxs)(`section`,{"aria-label":`Batch queue`,children:[(0,h.jsx)(Sy,{title:`Batch queue`,meta:`${String(A.queued.length)} waiting to start`,info:`play.queue`}),(0,h.jsx)(mR,{label:`Batch queue`,children:ae.map((e,t)=>{let n=A.projects.find(t=>t.id===e.projectId)?.state===`paused`;return(0,h.jsx)(hR,{title:(0,h.jsx)(fa,{to:`/projects/$projectId`,params:{projectId:e.projectId},children:e.title}),meta:`${String(t+1)} in line`,actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(KO,{tone:n?`waiting`:e.state===`active`?`running`:`off`,children:n?`Paused`:e.state===`active`?`Running now`:`Waiting its turn`}),e.state===`queued`?(0,h.jsx)(dQ,{projectId:e.projectId,title:e.title,place:oe.indexOf(e),waiting:oe.length}):null]})},e.projectId)})})]}):null]})]})]}),(0,h.jsx)(eR,{open:_,onOpenChange:v,schedules:k})]})}function Kxe({label:e,shift:t,onShift:n}){return(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsxs)(B,{size:`small`,variant:`secondary`,onClick:()=>n(-1),children:[(0,h.jsx)(Mc,{"aria-hidden":`true`,strokeWidth:1.75}),`Earlier`]}),(0,h.jsx)(`span`,{className:`text-small text-ink-2 tabular-nums`,"aria-live":`polite`,children:e}),(0,h.jsxs)(B,{size:`small`,variant:`secondary`,onClick:()=>n(1),children:[`Later`,(0,h.jsx)(Nc,{"aria-hidden":`true`,strokeWidth:1.75})]}),(0,h.jsx)(B,{size:`small`,variant:`quiet`,disabled:t===0,onClick:()=>n(0),children:`This week`})]})}var qxe=tD.map(e=>({value:e,label:nD[e]}));function Jxe({channel:e}){let{api:t}=V(),n=_(),r=wv(),i=L({mutationFn:n=>Pre(t,e.id,n),onSuccess:async e=>{r(`YouTube AI disclosure set to ${nD[e.aiDisclosure]}.`,`success`),n.setQueryData(Fy(e.id),t=>typeof t==`object`&&t&&`channel`in t?{...t,channel:{...t.channel,aiDisclosure:e.aiDisclosure}}:t),await n.invalidateQueries({queryKey:Py,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)(_L,{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)(bL,{value:i.isPending?i.variables:e.aiDisclosure,options:qxe,disabled:i.isPending,onChange:e=>{let t=tD.find(t=>t===e.currentTarget.value);t!==void 0&&i.mutate(t)},className:`max-w-[260px]`})}),(0,h.jsx)(WR,{tone:`error`,children:i.error?`Couldn't save the YouTube AI disclosure: ${i.error.message}`:void 0})]})}var Yxe=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i;function m$(e){let t=Yxe.exec(e.trim())?.[1];if(t!==void 0)return`#${(t.length===3?[...t].map(e=>e+e).join(``):t).toLowerCase()}`}var Xxe=`Write the colour as # and 3 or 6 hex digits, like #8c1e14 or #fff.`;function h$(e){if(e.trim()!==``)return m$(e)===void 0?Xxe:void 0}function g$(e){let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function _$(e){let t=Number.parseInt(e.slice(1,3),16),n=Number.parseInt(e.slice(3,5),16),r=Number.parseInt(e.slice(5,7),16);return .2126*g$(t)+.7152*g$(n)+.0722*g$(r)}function Zxe(e,t){let n=m$(e),r=m$(t);if(n===void 0||r===void 0)return;let[i,a]=[_$(n),_$(r)].sort((e,t)=>t-e);return(i+.05)/(a+.05)}function v$(e,t,n,r){let i=Zxe(e,t);if(!(i===void 0||i>=r))return`Hard to read on ${n}: contrast ${i.toFixed(1)}:1, below the ${String(r)}:1 text needs. Pick a lighter or darker colour.`}function y$({value:e,onChange:t,pickerLabel:n,className:r,...i}){let a=m$(e),o=(0,m.useRef)(a);a!==void 0&&(o.current=a),e.trim()===``&&(o.current=void 0);let s=a??o.current;return(0,h.jsxs)(`span`,{className:z(`flex min-w-0 items-center gap-2`,r),children:[(0,h.jsx)(`span`,{"data-partial":a===void 0&&s!==void 0?``:void 0,className:`relative size-8 shrink-0 overflow-hidden rounded-control border border-line-strong data-[partial]:opacity-40`,style:{background:s??`repeating-linear-gradient(45deg, transparent 0 4px, var(--color-line) 4px 5px)`},children:(0,h.jsx)(`input`,{type:`color`,"aria-label":n,value:s??`#ffffff`,className:`absolute inset-0 size-full cursor-pointer opacity-0`,onChange:e=>t(e.target.value)})}),(0,h.jsx)(X,{...i,className:`w-28 font-mono`,spellCheck:!1,autoComplete:`off`,value:e,onChange:e=>t(e.target.value)})]})}function b$({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)(_L,{label:r,tip:o,help:Qxe(s),error:i,children:(0,h.jsxs)(bL,{"data-play-field":`language`,value:e??(n===void 0?`en`:``),disabled:a,onChange:e=>t(e.target.value===``?void 0:kT.parse(e.target.value)),children:[n===void 0?null:(0,h.jsxs)(`option`,{value:``,children:[n.label,` (`,AT(n.language).name,`)`]}),OT.map(e=>(0,h.jsx)(`option`,{value:e.code,children:e.native===e.name?e.name:`${e.native} · ${e.name}`},e.code))]})})}function Qxe(e){let t=AT(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=jT(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 $xe({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`,...xy,children:[(0,h.jsx)(Sy,{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.jsxs)(`ul`,{"aria-label":`Channel links`,className:`sl-list m-0 list-none p-0`,children:[(0,h.jsxs)(`li`,{"aria-hidden":`true`,className:`hidden grid-cols-[220px_minmax(0,1fr)_auto] gap-2 border-b border-line pt-1 pb-2 text-label text-ink-2 md:grid`,children:[(0,h.jsxs)(`span`,{children:[`Name, used as `,`{{Name}}`]}),(0,h.jsx)(`span`,{children:`Address`})]}),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.jsxs)(`span`,{className:`grid gap-1`,children:[(0,h.jsxs)(`span`,{"aria-hidden":`true`,className:`text-label text-ink-2 md:hidden`,children:[`Name, used as `,`{{Name}}`]}),(0,h.jsx)(X,{"aria-label":`Name of link ${String(i+1)}`,placeholder:`Patreon`,value:r.name,onChange:e=>n(i,{name:e.currentTarget.value})})]}),(0,h.jsxs)(`span`,{className:`grid gap-1`,children:[(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`text-label text-ink-2 md:hidden`,children:`Address`}),(0,h.jsx)(X,{"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)(B,{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)(xl,{"aria-hidden":`true`,className:`size-[14px]`}),`Remove`]})]},i))]}),(0,h.jsx)(`div`,{className:`mt-3`,children:(0,h.jsxs)(B,{onClick:()=>t([...e,{name:``,url:``}]),children:[(0,h.jsx)(pl,{"aria-hidden":`true`,className:`size-[14px]`}),`Add link`]})})]})}function eSe(){return(0,h.jsxs)(`div`,{...xy,children:[(0,h.jsx)(Sy,{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)(LO,{to:`/channels/$channelId`,params:{channelId:jy},children:`Open the default channel's links`})})]})}function x$({changed:e,defaultText:t,label:n,onReset:r}){return(0,h.jsxs)(`span`,{className:`mt-1 flex min-h-7 items-center gap-2 text-label text-ink-2`,children:[(0,h.jsx)(`span`,{children:e?`Changed · default ${t}`:`Default`}),(0,h.jsx)(B,{variant:`quiet`,size:`small`,disabled:!e,"aria-label":`Reset ${n} to ${t}`,onClick:r,children:`Reset`})]})}function S$({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(lE.levelDb),fadeIn:e?.fadeIn??String(lE.fadeInSeconds),tail:e?.tail??String(lE.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.jsxs)(_L,{label:n,help:r,tip:a,error:i(t),children:[(0,h.jsx)(X,{"data-play-field":`${o}.${t}`,type:`text`,inputMode:`decimal`,className:`sl-input--number`,value:e[t],onChange:n=>s({...e,[t]:n.target.value})}),t===`level`?(0,h.jsx)(x$,{changed:e.level.trim()!==String(lE.levelDb),defaultText:`${String(lE.levelDb)} dB`,label:`ambient level`,onReset:()=>s({...e,level:String(lE.levelDb)})}):null]});return(0,h.jsxs)(`div`,{className:`sl-fields`,children:[(0,h.jsx)(_L,{label:`Ambient sound`,tip:`project.ambient.source`,error:i(`source`),children:(0,h.jsxs)(bL,{"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:lle[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 tSe({value:e,onChange:t}){let n=pE(e),r=n===void 0?[]:uE(n);return(0,h.jsx)(S$,{value:e,inherit:`Not set`,sources:sE,offerNone:!1,fieldPrefix:`brand.ambientBed`,problem:e=>r.find(t=>t.field===e)?.message,onChange:t})}function nSe(e){return e.ambientBed===void 0?void 0:fE(e.ambientBed)}function rSe(e){let t=pE(e);return t===void 0||t.source===`upload`?{brand:{},blocked:!1}:{brand:{ambientBed:{...t,source:t.source}},blocked:uE(t).length>0}}var C$=[`captionFontId`,`captionColor`,`captionOutlineColor`,`titleFontId`,`titleColor`,`intro`,`outro`,`endScreenText`,`documentTheme`,`language`],w$=1e4;function iSe(e){return Object.fromEntries(C$.map(t=>[t,e[t]??``]))}function aSe({channel:e}){let{api:t}=V(),n=_(),r=wv(),i=I({queryKey:Ok,queryFn:()=>kk(t)}),a=I(dy(t)),o=I(fy(t)),[s,c]=(0,m.useState)(e.name),[l,u]=(0,m.useState)(e.seriesBrief),[d,f]=(0,m.useState)(iSe(e.brand)),[p,g]=(0,m.useState)(nSe(e.brand)),v=rSe(p),y=I({queryKey:H.channelLinks,queryFn:()=>Vs(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=L({mutationFn:()=>By(t,e.id,{name:s,seriesBrief:l,brand:{...Object.fromEntries(C$.flatMap(e=>d[e].trim()===``?[]:[[e,oSe(e,d[e])]])),...v.brand,...C?{links:S}:{}},baseVersion:e.version}),onSuccess:async e=>{r(`Channel saved.`,`success`),n.setQueryData(Fy(e.id),t=>typeof t==`object`&&t?{...t,channel:e}:t),await Promise.all([n.invalidateQueries({queryKey:Py}),n.invalidateQueries({queryKey:H.channelLinks})])}}),T=e=>t=>f({...d,[e]:t}),E=D$.some(e=>h$(d[e])!==void 0),D=(i.data?.fonts??[]).map(e=>({value:e.id,label:e.name})),O=e=>(a.data?.entries??[]).filter(t=>t.category===e).map(e=>({value:e.name,label:e.name})),k=[...(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)(_L,{label:`Channel name`,tip:`planning.channel.name`,children:(0,h.jsx)(X,{value:s,maxLength:200,required:!0,onChange:e=>c(e.target.value)})}),(0,h.jsx)(_L,{label:`Series brief`,tip:`planning.channel.brief`,help:`Topic generation reads it for this channel's schedules. ${_Q(l.length,w$,`characters`)}.`,children:(0,h.jsx)(yL,{rows:4,value:l,maxLength:w$,onChange:e=>u(e.target.value)})}),(0,h.jsx)(Sy,{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)(b$,{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)(T$,{label:`Caption font`,tip:`planning.channel.brand.caption-font`,value:d.captionFontId,options:D,onPick:T(`captionFontId`)}),(0,h.jsx)(E$,{label:`Caption colour`,tip:`planning.channel.brand.caption-colour`,value:d.captionColor,onChange:T(`captionColor`)}),(0,h.jsx)(E$,{label:`Caption outline`,tip:`planning.channel.brand.caption-outline`,value:d.captionOutlineColor,onChange:T(`captionOutlineColor`),contrast:v$(d.captionColor,d.captionOutlineColor,`the caption colour`,3)})]}),(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)(T$,{label:`Title font`,tip:`planning.channel.brand.font`,value:d.titleFontId,options:D,onPick:T(`titleFontId`)}),(0,h.jsx)(E$,{label:`Title colour`,tip:`planning.channel.brand.title-colour`,value:d.titleColor,onChange:T(`titleColor`)}),(0,h.jsx)(_L,{label:`End screen text`,tip:`planning.channel.brand.end-screen`,help:`Shown over the last 5 seconds.`,children:(0,h.jsx)(X,{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)(T$,{label:`Intro`,tip:`planning.channel.brand.intro`,value:d.intro,options:O(`intro`),onPick:T(`intro`)}),(0,h.jsx)(T$,{label:`Outro`,tip:`planning.channel.brand.outro`,value:d.outro,options:O(`outro`),onPick:T(`outro`)}),(0,h.jsx)(T$,{label:`PDF theme`,tip:`planning.channel.brand.document-theme`,value:d.documentTheme,options:k,onPick:T(`documentTheme`)})]}),(0,h.jsx)(tSe,{value:p,onChange:g}),(0,h.jsx)(`div`,{className:`border-t border-line pt-6`,children:(0,h.jsx)($xe,{rows:S,onChange:x})})]}),(0,h.jsx)(GR,{status:(0,h.jsx)(WR,{tone:w.error?`error`:`info`,children:w.error?.message??(w.isPending?`Saving…`:void 0)}),children:(0,h.jsx)(B,{type:`submit`,variant:`primary`,disabled:w.isPending||s.trim()===``||v.blocked||E,disabledReason:s.trim()===``?`Give the channel a name`:E?`Fix the colour marked above`:`Fix the ambient sound settings above`,children:`Save channel`})})]})}function T$({label:e,tip:t,value:n,options:r,onPick:i}){return(0,h.jsx)(_L,{label:e,tip:t,children:(0,h.jsxs)(bL,{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 E$({label:e,tip:t,value:n,onChange:r,contrast:i}){let a=h$(n);return(0,h.jsx)(_L,{label:e,tip:t,...a===void 0?{}:{error:a},...a===void 0&&i!==void 0?{help:i}:{},children:(0,h.jsx)(y$,{value:n,placeholder:`#FFFFFF`,maxLength:7,pickerLabel:`${e} picker`,onChange:r})})}var D$=[`captionColor`,`captionOutlineColor`,`titleColor`];function oSe(e,t){let n=t.trim();return D$.includes(e)?m$(n)?.toUpperCase()??n:n}function O$(e,t){return e.languages===void 0||e.languages.includes(AT(t).code)}function sSe(e,t,n,r){return n?e:e.filter(e=>O$(e,t)||e.voiceId===r)}function cSe(e,t){if(e===void 0||O$(e,t))return;let n=AT(t).name,r=(e.languages??[]).map(e=>AT(e).code===e?AT(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 k$(e,t,n){let[r,i]=(0,m.useState)(!1),a=sSe(e,t,r,n);return{listed:a,hidden:e.length-a.length,showAll:r,setShowAll:i}}function A$({language:e,voice:t,hidden:n,showAll:r,onShowAll:i}){let a=(0,m.useId)(),o=cSe(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`,...xy,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 ${AT(e).name})`]}),(0,h.jsx)(U,{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 j$(e,t,n){let r=t+n,i=e[t];if(i===void 0||r<0||r>=e.length)return[...e];let a=e.filter((e,n)=>n!==t);return a.splice(r,0,i),a}function M$(e,t,n){let r=`${e.trim()||`Untitled`} copy`,i=new Set(t.map(e=>e.trim().toLowerCase())),a=1,o=r;for(;i.has(o.slice(0,n).toLowerCase());)a+=1,o=`${r} ${String(a)}`;return o.slice(0,n)}var lSe=200;function uSe({channelId:e,member:t,onCreated:n}){let{api:r}=V(),i=_(),a=wv(),o=I(zy(r,e)),s=L({mutationFn:()=>Hy(r,e,crypto.randomUUID(),{kind:t.kind,name:M$(t.name,(o.data?.cast??[]).map(e=>e.name),lSe),aliases:[],description:t.description,voice:t.voice??null,host:!1}),onSuccess:async t=>{await Promise.all([i.invalidateQueries({queryKey:Fy(e)}),i.invalidateQueries({queryKey:Py})]),a(`Made “${t.name}”. Its pictures are not copied: upload or generate them under Reference pictures.`,`success`),n(t.id)},onError:e=>a(`Couldn't duplicate ${t.name}: ${e.message} Press Duplicate in its editor to try again.`,`error`)});return(0,h.jsx)(B,{variant:`quiet`,size:`small`,disabled:s.isPending||o.data===void 0,disabledReason:s.isPending?`Making the copy`:`Loading the cast`,onClick:()=>s.mutate(),children:`Duplicate`})}var N$=4e3;function dSe({channelId:e,member:t,open:n,onClose:r,onCreated:i}){let{api:a}=V(),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:Fy(e)}),o.invalidateQueries({queryKey:Py})]),T=L({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?Hy(a,e,crypto.randomUUID(),n):Dre(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.jsxs)(Sy,{kicker:t===void 0?`New cast member`:Ny[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:[t===void 0?null:(0,h.jsx)(uSe,{channelId:e,member:t,onCreated:i}),(0,h.jsx)(B,{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)(_L,{label:`Kind`,tip:`planning.cast.kind`,children:(0,h.jsx)(bL,{value:s,onChange:e=>c(My.find(t=>t===e.target.value)??`character`),options:My.map(e=>({value:e,label:Ny[e]}))})}),(0,h.jsx)(_L,{label:`Name`,tip:`planning.cast.name`,children:(0,h.jsx)(X,{value:l,maxLength:200,required:!0,onChange:e=>u(e.target.value)})})]}),(0,h.jsx)(_L,{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)(X,{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)(B,{onClick:E,disabled:p.trim()===``,children:[(0,h.jsx)(pl,{"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)(JO,{removeLabel:`Remove alias ${e}`,onRemove:()=>f(d.filter(t=>t!==e)),children:e})},e))}):null,(0,h.jsx)(_L,{label:`Description for the image model`,tip:`planning.cast.description`,children:(0,h.jsx)(yL,{rows:3,value:v,maxLength:2e3,placeholder:`What they look like, in a sentence.`,onChange:e=>y(e.target.value)})}),(0,h.jsx)(pSe,{channelId:e,value:b,onChange:x}),(0,h.jsxs)(`div`,{className:`flex flex-col items-start gap-1`,children:[(0,h.jsx)(Cy,{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)(WR,{tone:T.error?`error`:`info`,children:T.error?.message??(T.isPending?`Saving…`:T.isSuccess?`Saved.`:void 0)}),(0,h.jsx)(B,{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)(fSe,{channelId:e,member:t})]}):null}function fSe({channelId:e,member:t}){let{api:n}=V(),r=_(),i=I(cy(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:Fy(e)}),r.invalidateQueries({queryKey:Py})]),g=L({mutationFn:e=>Are(n,t.id,e),onSettled:p}),v=L({mutationFn:()=>jre(n,t.id,{prompt:d,provider:s,model:l}),onSettled:p}),y=L({mutationFn:e=>Mre(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:Uy(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)(kG,{className:`mb-6`}),(0,h.jsx)(Sy,{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)(wz,{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)(Cz,{aspect:`square`,alt:`${t.name}, reference ${String(r+1)}`,...e.state===`ready`&&e.sha256!==null?{src:Uy(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)(qO,{tone:`failed`,children:`Failed`})}:{},actionsShown:!0,actions:(0,h.jsx)(B,{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)(mSe,{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)(Tz,{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)(zO,{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)(B,{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`,...xy,children:[(0,h.jsxs)(`p`,{className:`sl-kicker m-0 flex items-center gap-1`,children:[`Make a picture`,(0,h.jsx)(U,{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)(jL,{label:`Image provider`,family:`image`,providers:i.data?.providers??[],value:s,problem:void 0,onPick:e=>{c(e),u(``)}}),(0,h.jsx)(OL,{label:`Image model`,provider:s,value:l,problem:void 0,onPick:u})]})]}),(0,h.jsx)(_L,{label:`Picture to make`,tip:`planning.cast.picture-prompt`,help:_Q(d.length,N$,`characters`),children:(0,h.jsx)(yL,{ref:o,rows:3,value:d,maxLength:N$,onChange:e=>f(e.target.value)})}),(0,h.jsx)(`div`,{children:(0,h.jsx)(B,{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)(WR,{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 pSe({channelId:e,value:t,onChange:n}){let{api:r}=V(),i=I(cy(r)),a=I(ly(r)),o=I(zy(r,e)).data?.channel.brand.language??`en`,s=t??{provider:``,model:``,voice:``},c=(a.data?.voices??[]).filter(e=>e.provider===s.provider),l=k$(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`,...xy,children:[(0,h.jsxs)(`legend`,{className:`sl-kicker flex items-center gap-1`,children:[`Voice`,(0,h.jsx)(U,{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)(jL,{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)(OL,{label:`Voice model`,provider:s.provider,value:s.model,problem:void 0,onPick:e=>n({...s,model:e})}),(0,h.jsx)(AL,{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)(A$,{language:o,voice:c.find(e=>e.voiceId===s.voice),hidden:l.hidden,showAll:l.showAll,onShowAll:l.setShowAll}),(0,h.jsx)(AL,{label:`Pace`,value:String(s.pace??1),placeholder:`Pick a pace`,options:NE.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)(B,{variant:`quiet`,onClick:()=>n(void 0),children:`Remove the voice`})]})}function mSe({error:e,retry:t,onReword:n}){let r=nQ({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)(Sv,{className:`mt-2`,children:(0,h.jsx)(Wz,{fix:r,retry:t,variant:`secondary`,size:`small`,edit:r.kind===`refused`?(0,h.jsx)(B,{variant:`secondary`,size:`small`,onClick:n,children:`Reword the picture`}):void 0})})]})}var P$=`Alt+ArrowUp Alt+ArrowDown`;function hSe(e,t){let{api:n}=V(),r=_(),i=wv(),a=(0,m.useRef)(t);a.current=t;let o=L({mutationFn:t=>kre(n,e,t.member.id,t.to),onSuccess:async t=>{r.setQueryData(Fy(e),e=>e===void 0?e:{...e,cast:t}),await r.invalidateQueries({queryKey:Fy(e)})}}),s=(e,t,n,r=!0)=>{let c=a.current,l=c.findIndex(t=>t.id===e.id);l<0||t===l||t<0||t>=c.length||o.mutate({member:e,to:t},{onSuccess:()=>i(`Moved ${e.name} ${n}: ${String(t+1)} of ${String(c.length)}.`,`success`,r?{label:`Undo`,run:()=>s(e,l,`back`,!1)}:void 0),onError:t=>i(`Couldn't move ${e.name}: ${t.message} Try Move up or Move down in its More menu again.`,`error`)})};return{busy:o.isPending,move:s,onKeyDown:e=>t=>{if(!t.altKey||t.key!==`ArrowUp`&&t.key!==`ArrowDown`||(t.preventDefault(),o.isPending))return;let n=a.current.findIndex(t=>t.id===e.id),r=t.key===`ArrowUp`;s(e,n+(r?-1:1),r?`up`:`down`)}}}function gSe({member:e,index:t,count:n,order:r}){let i=t===0,a=t===n-1;return(0,h.jsxs)(BO,{modal:!1,children:[(0,h.jsx)(VO,{asChild:!0,children:(0,h.jsx)(bv,{size:`small`,label:`More for ${e.name}`,"aria-keyshortcuts":P$,disabled:n<2,disabledReason:`Add another member to change the order`,onKeyDown:r.onKeyDown(e),children:(0,h.jsx)(Hc,{"aria-hidden":`true`,strokeWidth:1.75})})}),(0,h.jsxs)(HO,{children:[(0,h.jsx)(UO,{disabled:i||r.busy,onSelect:()=>r.move(e,t-1,`up`),children:`Move up`}),(0,h.jsx)(UO,{disabled:a||r.busy,onSelect:()=>r.move(e,t+1,`down`),children:`Move down`}),(0,h.jsx)(UO,{disabled:i||r.busy,onSelect:()=>r.move(e,0,`to the top`),children:`Move to top`}),(0,h.jsx)(UO,{disabled:a||r.busy,onSelect:()=>r.move(e,n-1,`to the bottom`),children:`Move to bottom`})]})]})}var F$=e=>`It is deleted permanently: ${e} do not go to Settings → Trash, so it cannot be restored.`,I$=e=>e===void 0?`Delete this channel?`:`Delete the channel “${e}”?`,L$=`${F$(`channels`)} Its cast and their reference pictures, its episode summaries, its video memory and its brand settings go with it. Its projects move to the default channel and keep what they were made with.`,_Se=e=>e===void 0?`Delete this cast member?`:`Delete “${e}” from the cast?`,vSe=`${F$(`cast members`)} Its reference pictures go with it, and new videos stop using them. Videos already made keep the pictures they were started with.`,ySe=e=>e===void 0?`Delete this episode summary?`:`Delete the episode summary of “${e}”?`,bSe=`${F$(`episode summaries`)} New episodes stop being reminded of it. The video itself is not changed.`,xSe=8;function SSe({channelId:e,cast:t,selected:n,onSelect:r}){let{api:i}=V(),a=_(),[o,s]=(0,m.useState)(null),c=n===void 0?o:n,l=r??s,[u,d]=(0,m.useState)(null),f=L({mutationFn:e=>Ore(i,e),onSuccess:async(t,n)=>{d(null),c===n&&l(null),await Promise.all([a.invalidateQueries({queryKey:Fy(e)}),a.invalidateQueries({queryKey:Py})])}}),p=t.find(e=>e.id===c),g=hSe(e,t),v=t.flatMap(e=>{let t=e.images.find(e=>e.state===`ready`)?.sha256;return t?[{member:e,src:Uy(i,t)}]:[]}),y=v.map(e=>({src:e.src,alt:e.member.name,caption:`${Ny[e.member.kind]} · ${e.member.description||`No description yet`}`})),[b,x]=(0,m.useState)(null),[S,C]=(0,m.useState)(``),w=S.trim().toLowerCase(),T=w===``?t:t.filter(e=>e.id===c||[e.name,...e.aliases,Ny[e.kind],e.description].join(` `).toLowerCase().includes(w)),E=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)(hQ,{title:`No cast yet`,actions:(0,h.jsx)(B,{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.jsxs)(h.Fragment,{children:[t.length>xSe?(0,h.jsx)(X,{type:`search`,"aria-label":`Search the cast`,placeholder:`Search ${String(t.length)} members by name, kind or description`,value:S,onChange:e=>C(e.target.value),className:`mb-4 max-w-[420px]`}):null,T.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`No member's name, kind or description contains "${S.trim()}".`}):null,(0,h.jsx)(wz,{label:`Cast`,children:T.map(e=>{let n=e.images.filter(e=>e.state===`ready`),r=n[0]?.sha256;return(0,h.jsx)(Cz,{className:z(e.id===c&&`rounded-media outline-2 outline-accent outline-offset-4 outline-solid`),...r?{src:Uy(i,r)}:{},alt:e.name,onOpen:()=>x(v.findIndex(t=>t.member.id===e.id)),openLabel:`Open ${e.name}'s picture full size`,title:e.name,meta:`${Ny[e.kind]}${e.host===!0?` · Host`:``} · ${String(n.length)} ${n.length===1?`picture`:`pictures`}`,...n.length===0?{badge:(0,h.jsx)(qO,{tone:`waiting`,children:`No picture`})}:{},actionsShown:!0,actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(B,{variant:`secondary`,size:`small`,"aria-label":`Edit ${e.name}`,"aria-pressed":e.id===c,"aria-keyshortcuts":P$,onKeyDown:g.onKeyDown(e),onClick:()=>l(e.id),children:`Edit`}),(0,h.jsx)(B,{variant:`secondary`,size:`small`,"aria-label":`Delete ${e.name}`,onClick:()=>{f.reset(),d(e)},children:`Delete`}),(0,h.jsx)(gSe,{member:e,index:t.indexOf(e),count:t.length,order:g})]})},e.id)})})]}),(0,h.jsx)(Tz,{items:y,index:b,onIndex:x,onClose:()=>x(null),actions:(e,t)=>{let n=v[t];return n===void 0?null:(0,h.jsx)(B,{size:`small`,onClick:()=>{x(null),l(n.member.id)},children:`Edit ${n.member.name}`})}}),(0,h.jsx)(WR,{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:E?(0,h.jsx)(dSe,{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)(Bv,{open:u!==null,title:_Se(u?.name),consequence:f.error?.message??vSe,confirmLabel:`Delete from cast`,cancelLabel:`Keep it`,pending:f.isPending,onConfirm:()=>{u&&f.mutate(u.id)},onCancel:()=>d(null)})]})}var R$=e=>[`channels`,e,`episodes`],z$=e=>[`channels`,e,`videos`],B$=(e,t)=>`${e.origin}/api/channels/${t}`,V$=(e,t)=>({method:e,headers:{"content-type":`application/json`},body:JSON.stringify(t)});function CSe(e,t){return at({queryKey:R$(t),queryFn:async()=>R(await e.fetch(`${B$(e,t)}/episodes`))})}async function wSe(e,t,n){return R(await e.fetch(`${B$(e,t)}/episodes/setting`,V$(`PUT`,{enabled:n})))}async function TSe(e,t,n,r){return R(await e.fetch(`${B$(e,t)}/episodes/${encodeURIComponent(n)}`,V$(`PUT`,{summary:r})))}async function ESe(e,t,n){let r=await e.fetch(`${B$(e,t)}/episodes/${encodeURIComponent(n)}`,{method:`DELETE`});r.ok||await R(r)}function H$(e,t){return at({queryKey:z$(t),queryFn:async()=>(await R(await e.fetch(`${B$(e,t)}/videos`))).videos})}async function U$(e,t,n){return R(await e.fetch(`${B$(e,t)}/videos`,V$(`POST`,n)))}async function DSe(e,t,n){return R(await e.fetch(`${B$(e,t)}/videos/preview`,V$(`POST`,{format:`csv`,text:n})))}async function OSe(e,t,n){let r=await e.fetch(`${B$(e,t)}/videos/${n}`,{method:`DELETE`});r.ok||await R(r)}async function kSe(e,t){await R(await e.fetch(`${B$(e,t)}/videos`,{method:`DELETE`}))}function ASe(e,t){let n=t.trim().toLowerCase().split(/\s+/u).filter(Boolean);return n.length===0?e:e.filter(e=>{let t=[e.title,e.summary,...e.cast].join(` `).toLowerCase();return n.every(e=>t.includes(e))})}var jSe=e=>e.length>160?`${e.slice(0,160)}…`:e;function MSe({channelId:e}){let{api:t}=V(),n=_(),r=I(CSe(t,e)),[i,a]=(0,m.useState)(null),[o,s]=(0,m.useState)(null),c=()=>n.invalidateQueries({queryKey:R$(e)}),l=L({mutationFn:n=>wSe(t,e,n),onSuccess:t=>n.setQueryData(R$(e),t)}),u=L({mutationFn:n=>ESe(t,e,n),onSuccess:async()=>{s(null),await c()}}),d=r.data?.enabled??!1,f=r.data?.memories??[],[p,g]=(0,m.useState)(``),v=ASe(f,p);return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(Cy,{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)(WR,{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)(hQ,{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.jsxs)(`div`,{className:`mt-2 mb-2 flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(X,{type:`search`,"aria-label":`Search episode summaries`,placeholder:`Search episode summaries`,value:p,className:`w-full min-w-0 sm:w-64`,onChange:e=>g(e.target.value)}),(0,h.jsx)(`span`,{className:`text-small text-ink-2`,role:`status`,children:p.trim()===``?`${String(f.length)} ${f.length===1?`episode`:`episodes`}`:`${String(v.length)} of ${String(f.length)} match`})]}):null,f.length>0&&v.length===0?(0,h.jsx)(hQ,{title:`No episode matches`,children:`No title, cast member or summary contains “${p.trim()}”. Clear the search to see every episode.`}):null,v.length>0?(0,h.jsx)(mR,{label:`Episode summaries`,children:v.map(e=>(0,h.jsx)(hR,{title:e.title,meta:(0,h.jsxs)(h.Fragment,{children:[e.source===`edited`?`Edited · `:``,e.cast.length>0?`${e.cast.join(`, `)} · `:``,jSe(e.summary)]}),actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(B,{size:`small`,"aria-label":`Open the summary of ${e.title}`,onClick:()=>a(e),children:`Open`}),(0,h.jsx)(B,{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)(NSe,{channelId:e,memory:i,onClose:()=>a(null)},i.id):null,(0,h.jsx)(Bv,{open:o!==null,title:ySe(o?.title),consequence:u.error?.message??bSe,confirmLabel:`Delete summary`,pending:u.isPending,onConfirm:()=>{o&&u.mutate(o.id)},onCancel:()=>s(null)})]})}function NSe({channelId:e,memory:t,onClose:n}){let{api:r}=V(),i=_(),[a,o]=(0,m.useState)(t.summary),s=L({mutationFn:()=>TSe(r,e,t.id,a),onSuccess:async()=>{await i.invalidateQueries({queryKey:R$(e)}),n()}}),c=a.trim()!==t.summary.trim();return(0,h.jsx)(zv,{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)(B,{onClick:n,children:`Close`}),(0,h.jsx)(B,{variant:`primary`,disabled:!c||s.isPending,onClick:()=>s.mutate(),children:`Save summary`})]}),children:(0,h.jsx)(_L,{label:`Summary`,error:s.error?.message,tip:`planning.channel.episode-summary`,children:(0,h.jsx)(yL,{rows:8,value:a,onChange:e=>o(e.target.value)})})})}function W$(e,t){let[n,r]=(0,m.useState)({limit:200,resetOn:t}),i=Object.is(n.resetOn,t)?n.limit:200;return Object.is(n.resetOn,t)||r({limit:200,resetOn:t}),{shown:e.length>i?e.slice(0,i):e,hidden:Math.max(0,e.length-i),more:()=>r({limit:i+200,resetOn:t})}}function G$({hidden:e,onMore:t}){return e===0?null:(0,h.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(B,{size:`small`,onClick:t,children:`Show ${Math.min(e,200).toLocaleString(`en`)} more`}),(0,h.jsx)(`span`,{className:`text-small text-ink-2`,children:`${e.toLocaleString(`en`)} not shown`})]})}var K$=(e,t,n)=>`${e.toLocaleString(`en`)} ${e===1?t:n}`;function q$(e,t){let n=t.trim().toLowerCase();return e.map(e=>n===``||e.toLowerCase().includes(n))}function PSe(e,t,n,r){let i=t===void 0?n:Math.min(t,n),a=t===void 0?n:Math.max(t,n);return e.map((e,t)=>t>=i&&t<=a?r:e)}function FSe({preview:e,filter:t,busy:n,onFilter:r,onTick:i,onSave:a,onCancel:o}){let s=(0,m.useId)(),c=(0,m.useRef)(void 0),l=(0,m.useRef)(!1),u=e.ticked.filter(Boolean).length,d=W$(e.titles,e.titles);return(0,h.jsxs)(`section`,{"aria-label":`Titles in the CSV`,className:`mt-4`,...xy,children:[(0,h.jsxs)(Sy,{as:`h3`,title:`Titles in the CSV`,info:`planning.channel.videos-ticks`,meta:`${u.toLocaleString(`en`)} of ${K$(e.titles.length,`title`,`titles`)} ticked · Shift+click ticks a range`,children:[(0,h.jsxs)(B,{variant:`primary`,disabled:n||u===0,onClick:a,children:[`Add `,K$(u,`ticked title`,`ticked titles`)]}),(0,h.jsx)(B,{variant:`quiet`,disabled:n,onClick:o,children:`Cancel`})]}),(0,h.jsx)(_L,{label:`Keep only titles containing…`,tip:`planning.channel.videos-filter`,tipLabel:`Keep only titles containing`,children:(0,h.jsx)(X,{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)(B,{size:`small`,disabled:n,onClick:()=>i(e.titles.map(()=>!0)),children:`Tick all`}),(0,h.jsx)(B,{size:`small`,disabled:n,onClick:()=>i(e.titles.map(()=>!1)),children:`Untick all`})]}),(0,h.jsx)(mR,{label:`Titles in the CSV`,className:`mt-2`,children:d.shown.map((t,r)=>(0,h.jsx)(hR,{lead:(0,h.jsx)(`input`,{id:`${s}-${r}`,type:`checkbox`,checked:e.ticked[r]===!0,disabled:n,className:`size-4 shrink-0 accent-accent`,onClick:e=>{l.current=e.shiftKey},onChange:t=>{let n=l.current?c.current:void 0;l.current=!1,c.current=r,i(PSe(e.ticked,n,r,t.target.checked))}}),title:(0,h.jsx)(`label`,{htmlFor:`${s}-${r}`,children:t})},r))}),(0,h.jsx)(G$,{hidden:d.hidden,onMore:d.more})]})}var J$=(e,t,n)=>`${e.toLocaleString(`en`)} ${e===1?t:n}`;function ISe({channelId:e}){let{api:t}=V(),n=_(),r=I(H$(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:z$(e)}),[f,p]=(0,m.useState)(void 0),[g,v]=(0,m.useState)(``),y=L({mutationFn:n=>U$(t,e,{format:`lines`,...n}),onSuccess:async(e,t)=>{t.filter===void 0?a(``):p(void 0),l(`Added ${J$(e.added,`title`,`titles`)}${e.skipped>0?`; skipped ${e.skipped.toLocaleString(`en`)} already listed`:``}.`),await d()}}),b=L({mutationFn:n=>DSe(t,e,n),onSuccess:e=>{v(e.filter),p({titles:e.titles,ticked:q$(e.titles,e.filter)})}}),x=wv(),S=L({mutationFn:n=>OSe(t,e,n.id),onSuccess:async(e,t)=>{x(`Removed “${t.title}”.`,`info`,{label:`Undo`,run:()=>C.mutate(t.title)}),await d()}}),C=L({mutationFn:n=>U$(t,e,{format:`lines`,text:n}),onSuccess:d,onError:(e,t)=>x(`Couldn't put “${t}” back: ${e.message} Paste it into Paste titles and press Add titles.`,`error`)}),[w,T]=(0,m.useState)(``),E=L({mutationFn:()=>kSe(t,e),onSuccess:async()=>{s(!1),await d()}}),D=r.data??[],O=w.trim().toLowerCase(),k=O===``?D:D.filter(e=>e.title.toLowerCase().includes(O)),A=W$(k,O),j=y.isPending||b.isPending||S.isPending||C.isPending||E.isPending,M=r.error??b.error??y.error??S.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)(_L,{label:`Paste titles`,tip:`planning.channel.videos-paste`,help:`One title per line.`,children:(0,h.jsx)(yL,{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)(B,{variant:`primary`,disabled:j||i.trim()===``,onClick:()=>{l(void 0),y.mutate({text:i})},children:`Add titles`}),(0,h.jsx)(B,{disabled:j,onClick:()=>{u.current?.click()},children:`Import a YouTube Studio CSV…`}),(0,h.jsx)(U,{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)(B,{variant:`quiet`,disabled:j||D.length===0,onClick:()=>{E.reset(),s(!0)},children:`Remove all`})]}),(0,h.jsx)(WR,{tone:M?`error`:c?`success`:`info`,className:`mt-1`,children:M?.message??c??(r.isPending?`Loading the titles…`:b.isPending?`Reading the CSV…`:void 0)}),f===void 0?null:(0,h.jsx)(FSe,{preview:f,filter:g,busy:j,onFilter:e=>{v(e),p({...f,ticked:q$(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(`
|
|
274
|
-
`),filter:g})},onCancel:()=>{y.reset(),p(void 0)}}),r.data&&D.length===0?(0,h.jsx)(hQ,{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,D.length>0?(0,h.jsxs)(`section`,{"aria-label":`Existing videos`,className:`mt-4`,children:[(0,h.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(X,{type:`search`,"aria-label":`Search existing videos`,placeholder:`Search existing videos`,value:w,className:`w-full min-w-0 sm:w-64`,onChange:e=>T(e.target.value)}),(0,h.jsx)(`span`,{className:`text-small text-ink-2`,role:`status`,children:O===``?J$(D.length,`title`,`titles`):`${k.length.toLocaleString(`en`)} of ${J$(D.length,`title`,`titles`)} match`})]}),k.length===0?(0,h.jsx)(hQ,{title:`No title matches`,children:`None of the titles contains “${w.trim()}”. Clear the search to see them all.`}):(0,h.jsx)(mR,{label:`Existing videos`,children:A.shown.map(e=>(0,h.jsx)(hR,{title:e.title,actions:(0,h.jsx)(B,{size:`small`,variant:`quiet`,disabled:j,"aria-label":`Remove ${e.title}`,onClick:()=>S.mutate(e),children:`Remove`})},e.id))}),(0,h.jsx)(G$,{hidden:A.hidden,onMore:A.more})]}):null,(0,h.jsx)(Bv,{open:o,title:`Remove all ${J$(D.length,`title`,`titles`)}?`,consequence:E.error?.message??`Topic suggestions and duplicate checks stop skipping them. Your videos on YouTube are not touched.`,confirmLabel:`Remove all`,cancelLabel:`Keep them`,pending:E.isPending,onConfirm:()=>E.mutate(),onCancel:()=>s(!1)})]})}var Y$=[`brand`,`cast`,`templates`,`schedules`,`episodes`,`videos`],X$={brand:`Brand`,cast:`Cast`,templates:`Templates`,schedules:`Schedules`,episodes:`Episodes`,videos:`Existing videos`};function LSe(e){return Y$.find(t=>t===e)??`brand`}function RSe({channelId:e,tab:t,onTab:n}){let{api:r}=V(),i=_(),a=Ji(),o=I(zy(r,e)),[s,c]=(0,m.useState)(!1),[l,u]=(0,m.useState)(null),d=L({mutationFn:()=>Vy(r,e),onSuccess:async()=>{c(!1),await i.invalidateQueries({queryKey:Py}),await a({to:`/channels`})}}),f=o.data?.channel,p=o.data?.cast??[];jv(f===void 0?void 0:`${f.name} · ${X$[t]}`);let g=()=>{n(`cast`),u(`new`)};return Xy({id:`channel.add-to-cast`,title:`Add to cast`,group:`Channel`,...f===void 0?{}:{context:f.name},keywords:[`character`,`creature`,`place`,`object`],run:g}),o.error!==null&&o.data===void 0?(0,h.jsxs)(`div`,{children:[(0,h.jsx)(EG,{crumb:(0,h.jsx)(fa,{to:`/channels`,children:`Channels`}),title:`Channel not opened`}),(0,h.jsx)(hQ,{title:`This channel could not be opened`,actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(LO,{to:`/channels`,variant:`primary`,children:`Open Channels`}),(0,h.jsx)(B,{disabled:o.isFetching,disabledReason:`Trying again…`,onClick:()=>void o.refetch(),children:`Try again`})]}),children:`${o.error.message} A deleted channel is gone for good (its videos moved to the default channel). Pick a channel from Channels, or press Try again.`})]}):(0,h.jsxs)(`div`,{children:[(0,h.jsx)(EG,{crumb:(0,h.jsx)(fa,{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)(B,{variant:`primary`,onClick:g,children:[(0,h.jsx)(pl,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Add to cast`]}):null,f&&!f.isDefault?(0,h.jsx)(B,{variant:`quiet`,onClick:()=>{d.reset(),c(!0)},children:`Delete channel`}):null]})}),(0,h.jsx)(pQ,{items:Y$.map(e=>({id:e,label:X$[e],...e===`cast`?{badge:String(p.length)}:{}})),value:t,onChange:n,label:`Channel sections`,idPrefix:`channel`,className:`mb-6`}),(0,h.jsx)(WR,{tone:o.error?`error`:`info`,className:`mb-2`,children:o.error?`The channel couldn't be read again: ${o.error.message} What is shown may be out of date; reload the page to try again.`:o.isPending?`Loading the channel…`:void 0}),f?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(mQ,{idPrefix:`channel`,id:`brand`,active:t===`brand`,children:[(0,h.jsx)(Jxe,{channel:f}),(0,h.jsx)(aSe,{channel:f},`${f.id}:${String(f.version)}`)]}),(0,h.jsx)(mQ,{idPrefix:`channel`,id:`cast`,active:t===`cast`,children:(0,h.jsx)(SSe,{channelId:f.id,cast:p,selected:l,onSelect:u})}),(0,h.jsx)(mQ,{idPrefix:`channel`,id:`templates`,active:t===`templates`,children:t===`templates`?(0,h.jsx)(Ube,{channelId:f.id}):null}),(0,h.jsx)(mQ,{idPrefix:`channel`,id:`schedules`,active:t===`schedules`,children:t===`schedules`?(0,h.jsx)(Wbe,{channelId:f.id}):null}),(0,h.jsx)(mQ,{idPrefix:`channel`,id:`episodes`,active:t===`episodes`,children:t===`episodes`?(0,h.jsx)(MSe,{channelId:f.id}):null}),(0,h.jsx)(mQ,{idPrefix:`channel`,id:`videos`,active:t===`videos`,children:t===`videos`?(0,h.jsx)(ISe,{channelId:f.id}):null})]}):null,(0,h.jsx)(Bv,{open:s,title:I$(f?.name),consequence:d.error?.message??L$,confirmLabel:`Delete channel`,cancelLabel:`Keep it`,pending:d.isPending,onConfirm:()=>d.mutate(),onCancel:()=>c(!1)})]})}function Z$({className:e,children:t}){return(0,h.jsx)(`dl`,{className:z(`sl-stats m-0`,e),children:t})}function Q$({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 $$({value:e,label:t,valueText:n,tone:r=`accent`,progress:i=!1,className:a}){let o=Math.round(Math.min(1,Math.max(0,Number.isFinite(e)?e:0))*100),s=n??`${String(o)}%`,c=z(`sl-meter`,r===`waiting`&&`sl-meter--waiting`,a),l=(0,h.jsx)(`span`,{style:{width:`${String(o)}%`}});return i?(0,h.jsx)(`div`,{role:`progressbar`,"aria-label":t,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":o,"aria-valuetext":s,className:c,children:l}):(0,h.jsx)(`div`,{role:`meter`,"aria-label":t,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":o,"aria-valuetext":s,className:c,children:l})}function e1({columns:e,rows:t,rowKey:n,caption:r,empty:i,className:a}){return(0,h.jsxs)(`table`,{className:z(`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 zSe(){let{api:e}=V(),t=_(),n=Ji(),r=I(Ry(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=L({mutationFn:()=>Ere(e,crypto.randomUUID(),c.trim()),onSuccess:async e=>{await t.invalidateQueries({queryKey:Py}),a(null),l(``),await n({to:`/channels/$channelId`,params:{channelId:e.id}})}}),g=L({mutationFn:t=>By(e,t.id,{name:c.trim(),brand:t.brand,seriesBrief:t.seriesBrief,baseVersion:t.version}),onSuccess:async()=>{await t.invalidateQueries({queryKey:Py}),a(null)}}),v=L({mutationFn:t=>Vy(e,t.id),onSuccess:async()=>{s(null),await t.invalidateQueries({queryKey:Py})}}),y=()=>{p.reset(),l(``),a(`new`)};Xy({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)(EG,{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)(U,{id:`planning.channels`})]}),actions:(0,h.jsxs)(B,{variant:`primary`,"aria-expanded":i===`new`,onClick:y,children:[(0,h.jsx)(pl,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`New channel`]})}),(0,h.jsx)(WR,{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)(hQ,{title:`No channels yet`,actions:(0,h.jsx)(B,{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)(OG,{list:(0,h.jsx)(mR,{label:`Channels`,className:`[&_.sl-row__actions]:flex-wrap`,children:r.data.map(e=>(0,h.jsx)(hR,{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)(RO,{to:`/channels/$channelId`,params:{channelId:e.id},"aria-label":`Open ${e.name}`,className:`px-2 text-small`,children:`Open`}),(0,h.jsx)(B,{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)(B,{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)(BSe,{channel:f})}):null,(0,h.jsx)(zv,{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)(WR,{tone:b.error?`error`:`info`,children:b.error?.message??(b.isPending?`Saving…`:void 0)}),(0,h.jsx)(B,{disabled:b.isPending,onClick:()=>a(null),children:`Cancel`}),(0,h.jsx)(B,{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)(_L,{label:`Channel name`,tip:`planning.channel.name`,children:(0,h.jsx)(X,{value:c,maxLength:200,required:!0,disabled:b.isPending,onChange:e=>l(e.target.value)})})})}),(0,h.jsx)(Bv,{open:o!==null,title:I$(o?.name),consequence:v.error?.message??L$,confirmLabel:`Delete channel`,cancelLabel:`Keep it`,pending:v.isPending,onConfirm:()=>{o&&v.mutate(o)},onCancel:()=>s(null)})]})}function BSe({channel:e}){let t=e.brand,n=[[`Intro`,t.intro??`None`],[`Outro`,t.outro??`None`],[`PDF theme`,t.documentTheme??`Default`],[`End screen text`,t.endScreenText??`None`]];return(0,h.jsxs)(`section`,{"aria-label":`About ${e.name}`,children:[(0,h.jsx)(Sy,{title:`About ${e.name}`,meta:e.isDefault?`The default channel`:void 0,children:(0,h.jsx)(LO,{to:`/channels/$channelId`,params:{channelId:e.id},children:`Open channel`})}),(0,h.jsxs)(Z$,{className:`mb-6`,children:[(0,h.jsx)(Q$,{value:String(e.templates),label:`Templates`}),(0,h.jsx)(Q$,{value:String(e.cast),label:`In the cast`})]}),(0,h.jsx)(Sy,{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)(Sy,{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 t1=2e3;function n1(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()},t1);return()=>{clearTimeout(t)}},[e])}function r1(){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)(Ac,{"aria-hidden":`true`,className:`size-[14px]`}),`Saved`]})}function i1({onDelete:e,blocked:t,blockedId:n,pending:r,saved:i,cancel:a,errors:o,onSave:s}){let c=t!==void 0||r||i,l=wv();Xy({id:`editor.save`,title:`Save`,group:`This editor`,keywords:[`save`,`keep`],shortcut:ek.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)(B,{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)(WR,{tone:u?`error`:`info`,id:u?void 0:n,children:u||(i?(0,h.jsx)(r1,{}):t)}),a,(0,h.jsx)(B,{variant:`primary`,"aria-disabled":c,"aria-describedby":t===void 0?void 0:n,"aria-keyshortcuts":cb(ek.save),onClick:()=>{c||s()},children:`Save`})]})}var VSe=`rounded-media border border-line bg-surface p-4`;function a1(){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:`${VSe} 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 HSe=`modulepreload`,USe=function(e){return`/`+e},o1={},s1=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=USe(t,n),t=s(t),t in o1)return;o1[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`:HSe,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 c1({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 WSe(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 WSe(e,t){let n=await s1(()=>import(`./pdf-DSYcdduN.js`),[]),r=await s1(()=>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 l1=(e,t,n)=>({kind:`number`,path:e,label:t,unit:`mm`,step:1,...n===void 0?{}:{help:n}}),u1=(e,t,n)=>({kind:`number`,path:e,label:t,unit:`pt`,step:.5,...n===void 0?{}:{help:n}}),d1=(e,t,n,r)=>({kind:`number`,path:e,label:t,unit:n,step:.05,...r===void 0?{}:{help:r}}),f1=(e,t,n)=>({kind:`toggle`,path:e,label:t,...n===void 0?{}:{help:n}}),p1=(e,t,n)=>({kind:`text`,path:e,label:t,...n===void 0?{}:{help:n}}),m1=(e,t,n)=>({kind:`optional-text`,path:e,label:t,...n===void 0?{}:{help:n}}),h1=(e,t,n)=>({kind:`face`,path:[`fonts`,e],label:t,...n===void 0?{}:{help:n}}),g1=[{title:`Page`,fields:[{kind:`choice`,path:[`page`,`format`],label:`Paper size`,options:[{value:`a4`,label:`A4`},{value:`letter`,label:`US Letter`}]},l1([`page`,`margin`],`Margins`),l1([`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:[h1(`body`,`Body`),h1(`strong`,`Bold text`),h1(`emphasis`,`Italic text`),h1(`heading`,`Headings`),h1(`dramatic`,`Chapter numbers and brand`,`The big number of a "Chapter 3:" heading.`),h1(`decorative`,`Tagline and title-page link`),h1(`dropCap`,`Drop caps`),h1(`footer`,`Header and page numbers`)]},{title:`Text sizes`,fields:[u1([`sizes`,`title`],`Title`),u1([`sizes`,`brand`],`Brand`),u1([`sizes`,`section`],`Top-level headings`,`Also the titles of the contents, sources and closing pages.`),u1([`sizes`,`heading`],`Second-level headings`),u1([`sizes`,`subheading`],`Third-level headings`),u1([`sizes`,`body`],`Body`),u1([`sizes`,`meta`],`Date and word count`),u1([`sizes`,`footer`],`Header and page numbers`)]},{title:`Spacing`,fields:[l1([`spacing`,`bodyLine`],`Body line height`),l1([`spacing`,`headingLine`],`Heading line height`),l1([`spacing`,`subheadingLine`],`Subheading line height`),d1([`spacing`,`paragraphGap`],`After a paragraph`,`× line`),d1([`spacing`,`headingGap`],`Before a heading`,`× line`),d1([`spacing`,`itemGap`],`After a list item`,`× line`),l1([`spacing`,`listIndent`],`List indent`),l1([`spacing`,`quoteIndent`],`Quote indent`),l1([`spacing`,`ruleWidth`],`Divider width`,`The short centred line a --- becomes.`)]},{title:`Drop caps`,fields:[f1([`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`}]},d1([`dropCap`,`scale`],`Letter size`,`× lines`),l1([`dropCap`,`gap`],`Gap beside it`),{kind:`number`,path:[`dropCap`,`minLength`],label:`Shortest paragraph`,unit:`chars`,step:10,help:`Shorter paragraphs start plainly.`},d1([`dropCap`,`minRoom`],`Room needed`,`of page`,`With less room left, the paragraph starts on the next page.`)]},{title:`Title page`,fields:[l1([`titlePage`,`brandY`],`Brand from top`),l1([`titlePage`,`taglineOffset`],`Tagline below brand`),l1([`titlePage`,`titleY`],`Title from top`),l1([`titlePage`,`titleLine`],`Title line height`),l1([`titlePage`,`metaOffset`],`Details below title`),l1([`titlePage`,`metaLine`],`Details line height`),f1([`titlePage`,`showDate`],`Show the date`),f1([`titlePage`,`showWordCount`],`Show the word count`),f1([`titlePage`,`cover`,`enabled`],`Thumbnail as cover`,`When the project has a thumbnail.`),l1([`titlePage`,`cover`,`gap`],`Space around cover`),l1([`titlePage`,`cover`,`maxHeight`],`Cover height at most`)]},{title:`Branding`,fields:[m1([`brand`,`name`],`Brand name`,`Leave empty to hide the brand.`),m1([`brand`,`tagline`],`Tagline`),m1([`brand`,`url`],`Website`,`Where the brand and its link go.`),m1([`brand`,`linkLabel`],`Link text`,`The linked line under the word count.`)]},{title:`Contents page`,fields:[f1([`contents`,`enabled`],`Contents page`),p1([`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`}]},l1([`contents`,`titleOffset`],`Title from top margin`),l1([`contents`,`firstEntryOffset`],`First entry from top margin`),l1([`contents`,`line`],`Line height`),l1([`contents`,`indent`],`Indent per level`)]},{title:`Header and footer`,fields:[f1([`header`,`enabled`],`Running header`,`The title at the top of each page.`),l1([`header`,`top`],`Header from top`),{kind:`number`,path:[`header`,`maxTitleCharacters`],label:`Header title at most`,unit:`chars`,step:1},f1([`footer`,`enabled`],`Page numbers`),p1([`footer`,`text`],`Page number text`,`{page} becomes the page number.`),l1([`footer`,`bottom`],`From the bottom`),l1([`footer`,`reserve`],`Space kept above it`)]},{title:`Sources page`,fields:[f1([`sources`,`enabled`],`Sources page`,`The links the article and research used.`),p1([`sources`,`title`],`Title`),l1([`sources`,`titleOffset`],`Title from top margin`),l1([`sources`,`bodyOffset`],`List from top margin`),l1([`sources`,`line`],`Line height`),l1([`sources`,`gap`],`Gap between sources`)]},{title:`Closing page`,fields:[f1([`endPage`,`enabled`],`Closing page`),p1([`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.`},f1([`endPage`,`showDocumentDetails`],`Add date, word and page counts`),{kind:`link`,path:[`endPage`,`link`],label:`Link`},m1([`endPage`,`closing`],`Closing line`),l1([`endPage`,`titleOffset`],`Title from top margin`),l1([`endPage`,`bodyOffset`],`Text from top margin`)]},{title:`PDF details`,fields:[p1([`metadata`,`author`],`Author`,`Shown in a PDF reader's document properties. {title} becomes the title.`),p1([`metadata`,`subject`],`Subject`),p1([`metadata`,`keywords`],`Keywords`),p1([`metadata`,`creator`],`Creator`)]}],_1=ED.map(e=>({value:e,label:{Cinzel:`Cinzel`,Literata:`Literata`,times:`Times`,helvetica:`Helvetica`,courier:`Courier`}[e]}));function v1(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 y1(e,t){let n=e;for(let e of t)n=n?.[e];return n}function b1(e,t,n){let[r,...i]=t;if(r===void 0)return n;let a=e[r];return{...e,[r]:i.length===0?n:b1(a,i,n)}}function GSe(e){let t=ND;for(let n of e)t=t?.shape?.[n];return{min:t?.minValue??0,max:t?.maxValue??1e3}}function x1(e){return`values.${e.join(`.`)}`}var S1=`pt-1`,C1=`flex min-w-0 flex-col gap-3 pt-1 lg:sticky lg:top-16`;function w1({children:e}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`span`,{children:`Library`}),(0,h.jsx)(Nc,{"aria-hidden":`true`}),e]})}function T1({children:e,back:t}){return(0,h.jsxs)(`div`,{className:`mx-auto flex max-w-[1440px] flex-col gap-3`,children:[(0,h.jsx)(GM,{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 E1(e){return`theme-group-${e.toLowerCase().replace(/[^a-z0-9]+/g,`-`)}`}function KSe({problems:e,changed:t}){return e===0&&t===0?null:(0,h.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 text-small font-normal`,children:[e===0?null:(0,h.jsx)(qO,{tone:`failed`,children:`${String(e)} to fix`}),t===0?null:(0,h.jsx)(qO,{children:`${String(t)} changed`})]})}function qSe({groups:e,onJump:t}){return(0,h.jsx)(`nav`,{"aria-label":`Theme groups`,className:`flex flex-wrap gap-1 border-t border-line pt-3`,children:e.map(e=>{let n=[e.problems===0?``:`${String(e.problems)} to fix`,e.changed===0?``:`${String(e.changed)} changed`].filter(e=>e!==``);return(0,h.jsx)(B,{variant:`quiet`,size:`small`,className:e.problems===0?void 0:`text-danger`,onClick:()=>t(e.title),children:n.length===0?e.title:`${e.title} · ${n.join(` · `)}`},e.title)})})}var JSe={"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 D1(e,t){let n=x1(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 YSe({field:e,theme:t,original:n,problem:r,onChange:i}){let a=(0,m.useId)(),o=y1(t,e.path),s=y1(n,e.path),c=k1(t,n,e.path),l=JSe[x1(e.path)],u=n=>{i(b1(t,e.path,n))},d=(0,h.jsxs)(h.Fragment,{children:[l===void 0?null:(0,h.jsx)(U,{id:l,label:e.label,className:`-my-1`}),c?(0,h.jsx)(bv,{label:`Reset ${e.label} to ${A1(s)}`,tip:`Changed. Reset to ${A1(s)}`,className:`-my-1 size-6`,onClick:()=>u(s),children:(0,h.jsx)(gl,{"aria-hidden":`true`,className:`size-[13px]`})}):null]}),f=e.kind===`color`&&r===void 0?ZSe(t,e.path):void 0,p=[e.help===void 0?``:`${a}-help`,r===void 0?``:`${a}-error`,f===void 0?``:`${a}-contrast`].filter(e=>e!==``).join(` `),g=(0,h.jsxs)(h.Fragment,{children:[e.help===void 0?null:(0,h.jsx)(`p`,{id:`${a}-help`,className:`sl-field__help m-0`,children:e.help}),r===void 0?null:(0,h.jsx)(`p`,{id:`${a}-error`,className:`sl-field__error m-0`,children:r}),f===void 0?null:(0,h.jsx)(`p`,{id:`${a}-contrast`,className:`m-0 text-small text-waiting`,children:f})]}),_={id:a,"aria-invalid":r!==void 0,"aria-describedby":p===``?void 0:p};switch(e.kind){case`toggle`:return(0,h.jsxs)(`div`,{className:`flex flex-col gap-1 sm:col-span-2`,...xy,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsxs)(`label`,{htmlFor:a,className:`flex min-h-8 items-center gap-3 text-small font-semibold`,children:[(0,h.jsx)(`input`,{..._,type:`checkbox`,checked:o===!0,className:`size-4 accent-accent`,onChange:e=>{u(e.currentTarget.checked)}}),e.label]}),d]}),g]});case`number`:{let{min:t,max:n}=GSe(e.path);return(0,h.jsx)(O1,{id:a,label:e.label,notes:g,info:d,children:(0,h.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(X,{..._,type:`number`,inputMode:`decimal`,min:t,max:n,step:e.step,className:`w-28`,value:typeof o==`number`&&Number.isFinite(o)?o:``,onChange:e=>{u(e.target.value===``?NaN:Number(e.target.value))}}),(0,h.jsx)(`span`,{className:`text-small text-ink-2`,children:e.unit})]})})}case`color`:return(0,h.jsx)(O1,{id:a,label:e.label,notes:g,info:d,children:(0,h.jsx)(y$,{..._,pickerLabel:`${e.label} colour`,value:typeof o==`string`?o:``,onChange:u})});case`text`:return(0,h.jsx)(O1,{id:a,label:e.label,notes:g,info:d,children:(0,h.jsx)(X,{..._,value:typeof o==`string`?o:``,onChange:e=>{u(e.target.value)}})});case`optional-text`:return(0,h.jsx)(O1,{id:a,label:e.label,notes:g,info:d,children:(0,h.jsx)(X,{..._,value:typeof o==`string`?o:``,onChange:e=>{u(e.target.value===``?null:e.target.value)}})});case`choice`:{let t=e.options.findIndex(e=>e.value===o);return(0,h.jsx)(O1,{id:a,label:e.label,notes:g,info:d,children:(0,h.jsx)(bL,{..._,value:String(t),onChange:t=>{let n=e.options[Number(t.target.value)];n!==void 0&&u(n.value)},children:e.options.map((e,t)=>(0,h.jsx)(`option`,{value:String(t),children:e.label},e.label))})})}case`face`:{let t=o,n=v1(t.family);return(0,h.jsx)(O1,{id:a,label:e.label,notes:g,info:d,children:(0,h.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(bL,{..._,"aria-label":`${e.label} font`,value:t.family,onChange:e=>{let n=_1.find(t=>t.value===e.target.value);if(n===void 0)return;let r=v1(n.value).some(e=>e.value===t.style);u({...t,family:n.value,style:r?t.style:`normal`})},children:_1.map(e=>(0,h.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,h.jsx)(bL,{"aria-label":`${e.label} style`,value:t.style,onChange:e=>{u({...t,style:e.target.value})},children:n.map(e=>(0,h.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,h.jsx)(X,{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=>{u({...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`,...xy,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(`label`,{htmlFor:a,className:`sl-field__label`,children:e.label}),d]}),(0,h.jsx)(yL,{..._,rows:8,value:Array.isArray(o)?o.join(`
|
|
274
|
+
`),filter:g})},onCancel:()=>{y.reset(),p(void 0)}}),r.data&&D.length===0?(0,h.jsx)(hQ,{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,D.length>0?(0,h.jsxs)(`section`,{"aria-label":`Existing videos`,className:`mt-4`,children:[(0,h.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(X,{type:`search`,"aria-label":`Search existing videos`,placeholder:`Search existing videos`,value:w,className:`w-full min-w-0 sm:w-64`,onChange:e=>T(e.target.value)}),(0,h.jsx)(`span`,{className:`text-small text-ink-2`,role:`status`,children:O===``?J$(D.length,`title`,`titles`):`${k.length.toLocaleString(`en`)} of ${J$(D.length,`title`,`titles`)} match`})]}),k.length===0?(0,h.jsx)(hQ,{title:`No title matches`,children:`None of the titles contains “${w.trim()}”. Clear the search to see them all.`}):(0,h.jsx)(mR,{label:`Existing videos`,children:A.shown.map(e=>(0,h.jsx)(hR,{title:e.title,actions:(0,h.jsx)(B,{size:`small`,variant:`quiet`,disabled:j,"aria-label":`Remove ${e.title}`,onClick:()=>S.mutate(e),children:`Remove`})},e.id))}),(0,h.jsx)(G$,{hidden:A.hidden,onMore:A.more})]}):null,(0,h.jsx)(Bv,{open:o,title:`Remove all ${J$(D.length,`title`,`titles`)}?`,consequence:E.error?.message??`Topic suggestions and duplicate checks stop skipping them. Your videos on YouTube are not touched.`,confirmLabel:`Remove all`,cancelLabel:`Keep them`,pending:E.isPending,onConfirm:()=>E.mutate(),onCancel:()=>s(!1)})]})}var Y$=[`brand`,`cast`,`templates`,`schedules`,`episodes`,`videos`],X$={brand:`Brand`,cast:`Cast`,templates:`Templates`,schedules:`Schedules`,episodes:`Episodes`,videos:`Existing videos`};function LSe(e){return Y$.find(t=>t===e)??`brand`}function RSe({channelId:e,tab:t,onTab:n}){let{api:r}=V(),i=_(),a=Ji(),o=I(zy(r,e)),[s,c]=(0,m.useState)(!1),[l,u]=(0,m.useState)(null),d=L({mutationFn:()=>Vy(r,e),onSuccess:async()=>{c(!1),await i.invalidateQueries({queryKey:Py}),await a({to:`/channels`})}}),f=o.data?.channel,p=o.data?.cast??[];jv(f===void 0?void 0:`${f.name} · ${X$[t]}`);let g=()=>{n(`cast`),u(`new`)};return Xy({id:`channel.add-to-cast`,title:`Add to cast`,group:`Channel`,...f===void 0?{}:{context:f.name},keywords:[`character`,`creature`,`place`,`object`],run:g}),o.error!==null&&o.data===void 0?(0,h.jsxs)(`div`,{children:[(0,h.jsx)(EG,{crumb:(0,h.jsx)(fa,{to:`/channels`,children:`Channels`}),title:`Channel not opened`}),(0,h.jsx)(hQ,{title:`This channel could not be opened`,actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(LO,{to:`/channels`,variant:`primary`,children:`Open Channels`}),(0,h.jsx)(B,{disabled:o.isFetching,disabledReason:`Trying again…`,onClick:()=>void o.refetch(),children:`Try again`})]}),children:`${o.error.message} A deleted channel is gone for good (its videos moved to the default channel). Pick a channel from Channels, or press Try again.`})]}):(0,h.jsxs)(`div`,{children:[(0,h.jsx)(EG,{crumb:(0,h.jsx)(fa,{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)(B,{variant:`primary`,onClick:g,children:[(0,h.jsx)(pl,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`Add to cast`]}):null,f&&!f.isDefault?(0,h.jsx)(B,{variant:`quiet`,onClick:()=>{d.reset(),c(!0)},children:`Delete channel`}):null]})}),(0,h.jsx)(pQ,{items:Y$.map(e=>({id:e,label:X$[e],...e===`cast`?{badge:String(p.length)}:{}})),value:t,onChange:n,label:`Channel sections`,idPrefix:`channel`,className:`mb-6`}),(0,h.jsx)(WR,{tone:o.error?`error`:`info`,className:`mb-2`,children:o.error?`The channel couldn't be read again: ${o.error.message} What is shown may be out of date; reload the page to try again.`:o.isPending?`Loading the channel…`:void 0}),f?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(mQ,{idPrefix:`channel`,id:`brand`,active:t===`brand`,children:[(0,h.jsx)(Jxe,{channel:f}),(0,h.jsx)(aSe,{channel:f},`${f.id}:${String(f.version)}`)]}),(0,h.jsx)(mQ,{idPrefix:`channel`,id:`cast`,active:t===`cast`,children:(0,h.jsx)(SSe,{channelId:f.id,cast:p,selected:l,onSelect:u})}),(0,h.jsx)(mQ,{idPrefix:`channel`,id:`templates`,active:t===`templates`,children:t===`templates`?(0,h.jsx)(Ube,{channelId:f.id}):null}),(0,h.jsx)(mQ,{idPrefix:`channel`,id:`schedules`,active:t===`schedules`,children:t===`schedules`?(0,h.jsx)(Wbe,{channelId:f.id}):null}),(0,h.jsx)(mQ,{idPrefix:`channel`,id:`episodes`,active:t===`episodes`,children:t===`episodes`?(0,h.jsx)(MSe,{channelId:f.id}):null}),(0,h.jsx)(mQ,{idPrefix:`channel`,id:`videos`,active:t===`videos`,children:t===`videos`?(0,h.jsx)(ISe,{channelId:f.id}):null})]}):null,(0,h.jsx)(Bv,{open:s,title:I$(f?.name),consequence:d.error?.message??L$,confirmLabel:`Delete channel`,cancelLabel:`Keep it`,pending:d.isPending,onConfirm:()=>d.mutate(),onCancel:()=>c(!1)})]})}function Z$({className:e,children:t}){return(0,h.jsx)(`dl`,{className:z(`sl-stats m-0`,e),children:t})}function Q$({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 $$({value:e,label:t,valueText:n,tone:r=`accent`,progress:i=!1,className:a}){let o=Math.round(Math.min(1,Math.max(0,Number.isFinite(e)?e:0))*100),s=n??`${String(o)}%`,c=z(`sl-meter`,r===`waiting`&&`sl-meter--waiting`,a),l=(0,h.jsx)(`span`,{style:{width:`${String(o)}%`}});return i?(0,h.jsx)(`div`,{role:`progressbar`,"aria-label":t,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":o,"aria-valuetext":s,className:c,children:l}):(0,h.jsx)(`div`,{role:`meter`,"aria-label":t,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":o,"aria-valuetext":s,className:c,children:l})}function e1({columns:e,rows:t,rowKey:n,caption:r,empty:i,className:a}){return(0,h.jsxs)(`table`,{className:z(`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 zSe(){let{api:e}=V(),t=_(),n=Ji(),r=I(Ry(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=L({mutationFn:()=>Ere(e,crypto.randomUUID(),c.trim()),onSuccess:async e=>{await t.invalidateQueries({queryKey:Py}),a(null),l(``),await n({to:`/channels/$channelId`,params:{channelId:e.id}})}}),g=L({mutationFn:t=>By(e,t.id,{name:c.trim(),brand:t.brand,seriesBrief:t.seriesBrief,baseVersion:t.version}),onSuccess:async()=>{await t.invalidateQueries({queryKey:Py}),a(null)}}),v=L({mutationFn:t=>Vy(e,t.id),onSuccess:async()=>{s(null),await t.invalidateQueries({queryKey:Py})}}),y=()=>{p.reset(),l(``),a(`new`)};Xy({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)(EG,{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)(U,{id:`planning.channels`})]}),actions:(0,h.jsxs)(B,{variant:`primary`,"aria-expanded":i===`new`,onClick:y,children:[(0,h.jsx)(pl,{"aria-hidden":`true`,className:`size-4`,strokeWidth:1.75}),`New channel`]})}),(0,h.jsx)(WR,{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)(hQ,{title:`No channels yet`,actions:(0,h.jsx)(B,{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)(OG,{list:(0,h.jsx)(mR,{label:`Channels`,className:`[&_.sl-row__actions]:flex-wrap`,children:r.data.map(e=>(0,h.jsx)(hR,{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)(RO,{to:`/channels/$channelId`,params:{channelId:e.id},"aria-label":`Open ${e.name}`,className:`px-2 text-small`,children:`Open`}),(0,h.jsx)(B,{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)(B,{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)(BSe,{channel:f})}):null,(0,h.jsx)(zv,{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)(WR,{tone:b.error?`error`:`info`,children:b.error?.message??(b.isPending?`Saving…`:void 0)}),(0,h.jsx)(B,{disabled:b.isPending,onClick:()=>a(null),children:`Cancel`}),(0,h.jsx)(B,{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)(_L,{label:`Channel name`,tip:`planning.channel.name`,children:(0,h.jsx)(X,{value:c,maxLength:200,required:!0,disabled:b.isPending,onChange:e=>l(e.target.value)})})})}),(0,h.jsx)(Bv,{open:o!==null,title:I$(o?.name),consequence:v.error?.message??L$,confirmLabel:`Delete channel`,cancelLabel:`Keep it`,pending:v.isPending,onConfirm:()=>{o&&v.mutate(o)},onCancel:()=>s(null)})]})}function BSe({channel:e}){let t=e.brand,n=[[`Intro`,t.intro??`None`],[`Outro`,t.outro??`None`],[`PDF theme`,t.documentTheme??`Default`],[`End screen text`,t.endScreenText??`None`]];return(0,h.jsxs)(`section`,{"aria-label":`About ${e.name}`,children:[(0,h.jsx)(Sy,{title:`About ${e.name}`,meta:e.isDefault?`The default channel`:void 0,children:(0,h.jsx)(LO,{to:`/channels/$channelId`,params:{channelId:e.id},children:`Open channel`})}),(0,h.jsxs)(Z$,{className:`mb-6`,children:[(0,h.jsx)(Q$,{value:String(e.templates),label:`Templates`}),(0,h.jsx)(Q$,{value:String(e.cast),label:`In the cast`})]}),(0,h.jsx)(Sy,{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)(Sy,{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 t1=2e3;function n1(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()},t1);return()=>{clearTimeout(t)}},[e])}function r1(){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)(Ac,{"aria-hidden":`true`,className:`size-[14px]`}),`Saved`]})}function i1({onDelete:e,blocked:t,blockedId:n,pending:r,saved:i,cancel:a,errors:o,onSave:s}){let c=t!==void 0||r||i,l=wv();Xy({id:`editor.save`,title:`Save`,group:`This editor`,keywords:[`save`,`keep`],shortcut:ek.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)(B,{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)(WR,{tone:u?`error`:`info`,id:u?void 0:n,children:u||(i?(0,h.jsx)(r1,{}):t)}),a,(0,h.jsx)(B,{variant:`primary`,"aria-disabled":c,"aria-describedby":t===void 0?void 0:n,"aria-keyshortcuts":cb(ek.save),onClick:()=>{c||s()},children:`Save`})]})}var VSe=`rounded-media border border-line bg-surface p-4`;function a1(){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:`${VSe} 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 HSe=`modulepreload`,USe=function(e){return`/`+e},o1={},s1=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=USe(t,n),t=s(t),t in o1)return;o1[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`:HSe,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 c1({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 WSe(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 WSe(e,t){let n=await s1(()=>import(`./pdf-T7MCwjIv.js`),[]),r=await s1(()=>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 l1=(e,t,n)=>({kind:`number`,path:e,label:t,unit:`mm`,step:1,...n===void 0?{}:{help:n}}),u1=(e,t,n)=>({kind:`number`,path:e,label:t,unit:`pt`,step:.5,...n===void 0?{}:{help:n}}),d1=(e,t,n,r)=>({kind:`number`,path:e,label:t,unit:n,step:.05,...r===void 0?{}:{help:r}}),f1=(e,t,n)=>({kind:`toggle`,path:e,label:t,...n===void 0?{}:{help:n}}),p1=(e,t,n)=>({kind:`text`,path:e,label:t,...n===void 0?{}:{help:n}}),m1=(e,t,n)=>({kind:`optional-text`,path:e,label:t,...n===void 0?{}:{help:n}}),h1=(e,t,n)=>({kind:`face`,path:[`fonts`,e],label:t,...n===void 0?{}:{help:n}}),g1=[{title:`Page`,fields:[{kind:`choice`,path:[`page`,`format`],label:`Paper size`,options:[{value:`a4`,label:`A4`},{value:`letter`,label:`US Letter`}]},l1([`page`,`margin`],`Margins`),l1([`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:[h1(`body`,`Body`),h1(`strong`,`Bold text`),h1(`emphasis`,`Italic text`),h1(`heading`,`Headings`),h1(`dramatic`,`Chapter numbers and brand`,`The big number of a "Chapter 3:" heading.`),h1(`decorative`,`Tagline and title-page link`),h1(`dropCap`,`Drop caps`),h1(`footer`,`Header and page numbers`)]},{title:`Text sizes`,fields:[u1([`sizes`,`title`],`Title`),u1([`sizes`,`brand`],`Brand`),u1([`sizes`,`section`],`Top-level headings`,`Also the titles of the contents, sources and closing pages.`),u1([`sizes`,`heading`],`Second-level headings`),u1([`sizes`,`subheading`],`Third-level headings`),u1([`sizes`,`body`],`Body`),u1([`sizes`,`meta`],`Date and word count`),u1([`sizes`,`footer`],`Header and page numbers`)]},{title:`Spacing`,fields:[l1([`spacing`,`bodyLine`],`Body line height`),l1([`spacing`,`headingLine`],`Heading line height`),l1([`spacing`,`subheadingLine`],`Subheading line height`),d1([`spacing`,`paragraphGap`],`After a paragraph`,`× line`),d1([`spacing`,`headingGap`],`Before a heading`,`× line`),d1([`spacing`,`itemGap`],`After a list item`,`× line`),l1([`spacing`,`listIndent`],`List indent`),l1([`spacing`,`quoteIndent`],`Quote indent`),l1([`spacing`,`ruleWidth`],`Divider width`,`The short centred line a --- becomes.`)]},{title:`Drop caps`,fields:[f1([`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`}]},d1([`dropCap`,`scale`],`Letter size`,`× lines`),l1([`dropCap`,`gap`],`Gap beside it`),{kind:`number`,path:[`dropCap`,`minLength`],label:`Shortest paragraph`,unit:`chars`,step:10,help:`Shorter paragraphs start plainly.`},d1([`dropCap`,`minRoom`],`Room needed`,`of page`,`With less room left, the paragraph starts on the next page.`)]},{title:`Title page`,fields:[l1([`titlePage`,`brandY`],`Brand from top`),l1([`titlePage`,`taglineOffset`],`Tagline below brand`),l1([`titlePage`,`titleY`],`Title from top`),l1([`titlePage`,`titleLine`],`Title line height`),l1([`titlePage`,`metaOffset`],`Details below title`),l1([`titlePage`,`metaLine`],`Details line height`),f1([`titlePage`,`showDate`],`Show the date`),f1([`titlePage`,`showWordCount`],`Show the word count`),f1([`titlePage`,`cover`,`enabled`],`Thumbnail as cover`,`When the project has a thumbnail.`),l1([`titlePage`,`cover`,`gap`],`Space around cover`),l1([`titlePage`,`cover`,`maxHeight`],`Cover height at most`)]},{title:`Branding`,fields:[m1([`brand`,`name`],`Brand name`,`Leave empty to hide the brand.`),m1([`brand`,`tagline`],`Tagline`),m1([`brand`,`url`],`Website`,`Where the brand and its link go.`),m1([`brand`,`linkLabel`],`Link text`,`The linked line under the word count.`)]},{title:`Contents page`,fields:[f1([`contents`,`enabled`],`Contents page`),p1([`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`}]},l1([`contents`,`titleOffset`],`Title from top margin`),l1([`contents`,`firstEntryOffset`],`First entry from top margin`),l1([`contents`,`line`],`Line height`),l1([`contents`,`indent`],`Indent per level`)]},{title:`Header and footer`,fields:[f1([`header`,`enabled`],`Running header`,`The title at the top of each page.`),l1([`header`,`top`],`Header from top`),{kind:`number`,path:[`header`,`maxTitleCharacters`],label:`Header title at most`,unit:`chars`,step:1},f1([`footer`,`enabled`],`Page numbers`),p1([`footer`,`text`],`Page number text`,`{page} becomes the page number.`),l1([`footer`,`bottom`],`From the bottom`),l1([`footer`,`reserve`],`Space kept above it`)]},{title:`Sources page`,fields:[f1([`sources`,`enabled`],`Sources page`,`The links the article and research used.`),p1([`sources`,`title`],`Title`),l1([`sources`,`titleOffset`],`Title from top margin`),l1([`sources`,`bodyOffset`],`List from top margin`),l1([`sources`,`line`],`Line height`),l1([`sources`,`gap`],`Gap between sources`)]},{title:`Closing page`,fields:[f1([`endPage`,`enabled`],`Closing page`),p1([`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.`},f1([`endPage`,`showDocumentDetails`],`Add date, word and page counts`),{kind:`link`,path:[`endPage`,`link`],label:`Link`},m1([`endPage`,`closing`],`Closing line`),l1([`endPage`,`titleOffset`],`Title from top margin`),l1([`endPage`,`bodyOffset`],`Text from top margin`)]},{title:`PDF details`,fields:[p1([`metadata`,`author`],`Author`,`Shown in a PDF reader's document properties. {title} becomes the title.`),p1([`metadata`,`subject`],`Subject`),p1([`metadata`,`keywords`],`Keywords`),p1([`metadata`,`creator`],`Creator`)]}],_1=ED.map(e=>({value:e,label:{Cinzel:`Cinzel`,Literata:`Literata`,times:`Times`,helvetica:`Helvetica`,courier:`Courier`}[e]}));function v1(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 y1(e,t){let n=e;for(let e of t)n=n?.[e];return n}function b1(e,t,n){let[r,...i]=t;if(r===void 0)return n;let a=e[r];return{...e,[r]:i.length===0?n:b1(a,i,n)}}function GSe(e){let t=ND;for(let n of e)t=t?.shape?.[n];return{min:t?.minValue??0,max:t?.maxValue??1e3}}function x1(e){return`values.${e.join(`.`)}`}var S1=`pt-1`,C1=`flex min-w-0 flex-col gap-3 pt-1 lg:sticky lg:top-16`;function w1({children:e}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`span`,{children:`Library`}),(0,h.jsx)(Nc,{"aria-hidden":`true`}),e]})}function T1({children:e,back:t}){return(0,h.jsxs)(`div`,{className:`mx-auto flex max-w-[1440px] flex-col gap-3`,children:[(0,h.jsx)(GM,{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 E1(e){return`theme-group-${e.toLowerCase().replace(/[^a-z0-9]+/g,`-`)}`}function KSe({problems:e,changed:t}){return e===0&&t===0?null:(0,h.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 text-small font-normal`,children:[e===0?null:(0,h.jsx)(qO,{tone:`failed`,children:`${String(e)} to fix`}),t===0?null:(0,h.jsx)(qO,{children:`${String(t)} changed`})]})}function qSe({groups:e,onJump:t}){return(0,h.jsx)(`nav`,{"aria-label":`Theme groups`,className:`flex flex-wrap gap-1 border-t border-line pt-3`,children:e.map(e=>{let n=[e.problems===0?``:`${String(e.problems)} to fix`,e.changed===0?``:`${String(e.changed)} changed`].filter(e=>e!==``);return(0,h.jsx)(B,{variant:`quiet`,size:`small`,className:e.problems===0?void 0:`text-danger`,onClick:()=>t(e.title),children:n.length===0?e.title:`${e.title} · ${n.join(` · `)}`},e.title)})})}var JSe={"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 D1(e,t){let n=x1(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 YSe({field:e,theme:t,original:n,problem:r,onChange:i}){let a=(0,m.useId)(),o=y1(t,e.path),s=y1(n,e.path),c=k1(t,n,e.path),l=JSe[x1(e.path)],u=n=>{i(b1(t,e.path,n))},d=(0,h.jsxs)(h.Fragment,{children:[l===void 0?null:(0,h.jsx)(U,{id:l,label:e.label,className:`-my-1`}),c?(0,h.jsx)(bv,{label:`Reset ${e.label} to ${A1(s)}`,tip:`Changed. Reset to ${A1(s)}`,className:`-my-1 size-6`,onClick:()=>u(s),children:(0,h.jsx)(gl,{"aria-hidden":`true`,className:`size-[13px]`})}):null]}),f=e.kind===`color`&&r===void 0?ZSe(t,e.path):void 0,p=[e.help===void 0?``:`${a}-help`,r===void 0?``:`${a}-error`,f===void 0?``:`${a}-contrast`].filter(e=>e!==``).join(` `),g=(0,h.jsxs)(h.Fragment,{children:[e.help===void 0?null:(0,h.jsx)(`p`,{id:`${a}-help`,className:`sl-field__help m-0`,children:e.help}),r===void 0?null:(0,h.jsx)(`p`,{id:`${a}-error`,className:`sl-field__error m-0`,children:r}),f===void 0?null:(0,h.jsx)(`p`,{id:`${a}-contrast`,className:`m-0 text-small text-waiting`,children:f})]}),_={id:a,"aria-invalid":r!==void 0,"aria-describedby":p===``?void 0:p};switch(e.kind){case`toggle`:return(0,h.jsxs)(`div`,{className:`flex flex-col gap-1 sm:col-span-2`,...xy,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsxs)(`label`,{htmlFor:a,className:`flex min-h-8 items-center gap-3 text-small font-semibold`,children:[(0,h.jsx)(`input`,{..._,type:`checkbox`,checked:o===!0,className:`size-4 accent-accent`,onChange:e=>{u(e.currentTarget.checked)}}),e.label]}),d]}),g]});case`number`:{let{min:t,max:n}=GSe(e.path);return(0,h.jsx)(O1,{id:a,label:e.label,notes:g,info:d,children:(0,h.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(X,{..._,type:`number`,inputMode:`decimal`,min:t,max:n,step:e.step,className:`w-28`,value:typeof o==`number`&&Number.isFinite(o)?o:``,onChange:e=>{u(e.target.value===``?NaN:Number(e.target.value))}}),(0,h.jsx)(`span`,{className:`text-small text-ink-2`,children:e.unit})]})})}case`color`:return(0,h.jsx)(O1,{id:a,label:e.label,notes:g,info:d,children:(0,h.jsx)(y$,{..._,pickerLabel:`${e.label} colour`,value:typeof o==`string`?o:``,onChange:u})});case`text`:return(0,h.jsx)(O1,{id:a,label:e.label,notes:g,info:d,children:(0,h.jsx)(X,{..._,value:typeof o==`string`?o:``,onChange:e=>{u(e.target.value)}})});case`optional-text`:return(0,h.jsx)(O1,{id:a,label:e.label,notes:g,info:d,children:(0,h.jsx)(X,{..._,value:typeof o==`string`?o:``,onChange:e=>{u(e.target.value===``?null:e.target.value)}})});case`choice`:{let t=e.options.findIndex(e=>e.value===o);return(0,h.jsx)(O1,{id:a,label:e.label,notes:g,info:d,children:(0,h.jsx)(bL,{..._,value:String(t),onChange:t=>{let n=e.options[Number(t.target.value)];n!==void 0&&u(n.value)},children:e.options.map((e,t)=>(0,h.jsx)(`option`,{value:String(t),children:e.label},e.label))})})}case`face`:{let t=o,n=v1(t.family);return(0,h.jsx)(O1,{id:a,label:e.label,notes:g,info:d,children:(0,h.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(bL,{..._,"aria-label":`${e.label} font`,value:t.family,onChange:e=>{let n=_1.find(t=>t.value===e.target.value);if(n===void 0)return;let r=v1(n.value).some(e=>e.value===t.style);u({...t,family:n.value,style:r?t.style:`normal`})},children:_1.map(e=>(0,h.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,h.jsx)(bL,{"aria-label":`${e.label} style`,value:t.style,onChange:e=>{u({...t,style:e.target.value})},children:n.map(e=>(0,h.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,h.jsx)(X,{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=>{u({...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`,...xy,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(`label`,{htmlFor:a,className:`sl-field__label`,children:e.label}),d]}),(0,h.jsx)(yL,{..._,rows:8,value:Array.isArray(o)?o.join(`
|
|
275
275
|
`):``,onChange:e=>{u(e.target.value.split(`
|
|
276
276
|
`))}}),g]});case`link`:{let t=o;return(0,h.jsxs)(`div`,{className:`flex flex-col gap-1 sm:col-span-2`,...xy,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsxs)(`label`,{htmlFor:a,className:`flex min-h-8 items-center gap-3 text-small font-semibold`,children:[(0,h.jsx)(`input`,{id:a,type:`checkbox`,checked:t!==null,className:`size-4 accent-accent`,onChange:e=>{u(e.currentTarget.checked?{text:`Visit the website`,url:null}:null)}}),e.label]}),d]}),t===null?null:(0,h.jsxs)(`span`,{className:`grid grid-cols-[minmax(0,1fr)] gap-2 sm:grid-cols-2`,children:[(0,h.jsx)(X,{"aria-label":`Link text`,placeholder:`Link text`,value:t.text,onChange:e=>{u({...t,text:e.target.value})}}),(0,h.jsx)(X,{"aria-label":`Link address`,placeholder:`https://`,value:t.url??``,onChange:e=>{u({...t,url:e.target.value===``?null:e.target.value})}})]}),g]})}}}function O1({id:e,label:t,notes:n,info:r,children:i}){return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,...xy,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 k1(e,t,n){return JSON.stringify(y1(e,n))!==JSON.stringify(y1(t,n))}function A1(e){return e==null||e===``?`empty`:typeof e==`boolean`?e?`on`:`off`:typeof e==`string`||typeof e==`number`?String(e):`the starting value`}var XSe={"colors.text":4.5,"colors.heading":3,"colors.muted":3,"colors.faint":3};function ZSe(e,t){let n=XSe[t.join(`.`)];if(n===void 0||e.background.image!==null)return;let r=y1(e,t);if(typeof r==`string`)return v$(r,e.background.color,`the page colour`,n)}function j1({themeId:e,from:t,onLeave:n}){let{api:r}=V(),i=_(),a=I(fy(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=L({mutationFn:t=>Qs(r,t,e),onSuccess:async e=>{if(!e.ok){u(e.fields);return}f(!0),await i.invalidateQueries({queryKey:fy(r).queryKey})}}),w=L({mutationFn:e=>$s(r,e),onSuccess:async()=>{g(!1),await i.invalidateQueries({queryKey:fy(r).queryKey}),n()}});n1(d,n);let T=(0,m.useMemo)(()=>S===void 0?void 0:ND.safeParse(S.values),[S]),E=[...S===void 0||S.name.trim()===``?[]:$le(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)(M1,{children:a.error.message});if(v===void 0)return(0,h.jsx)(a1,{});if(S===void 0)return(0,h.jsx)(M1,{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=g1.map(e=>({title:e.title,problems:e.fields.filter(e=>D1(E,e.path)!==void 0).length,changed:x===void 0?0:e.fields.filter(e=>k1(S.values,x.values,e.path)).length})),k=O.filter(e=>e.problems>0).map(e=>e.title),A=S.name.trim()===``?`Give the theme a name.`:E.length>0?k.length===0?`Fix the highlighted settings first.`:`Fix the highlighted settings first, in ${k.join(`, `)}.`:void 0,j=E.filter(e=>e.field===`name`);return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(EG,{crumb:(0,h.jsx)(w1,{children:(0,h.jsx)(fa,{to:`/document-themes`,children:`Documents`})}),title:e===void 0?`New PDF theme`:`Edit PDF 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:`${S1} flex min-w-0 flex-col gap-4`,children:[(0,h.jsx)(_L,{label:`Name`,tip:`library.theme.name`,...j.length===0?{}:{error:j.map(e=>e.message).join(` `)},children:(0,h.jsx)(X,{value:S.name,onChange:e=>{D({...S,name:e.target.value},`name`)}})}),(0,h.jsx)(qSe,{groups:O,onJump:e=>{let t=document.getElementById(E1(e));t instanceof HTMLDetailsElement&&(t.open=!0,t.scrollIntoView?.({block:`start`,behavior:`smooth`}),t.querySelector(`summary`)?.focus())}}),g1.map((e,t)=>{let n=O[t];return(0,h.jsxs)(`details`,{id:E1(e.title),open:t<2||(n?.problems??0)>0,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)(Nc,{"aria-hidden":`true`,className:`size-[14px] text-ink-2 transition-transform group-open:rotate-90 motion-reduce:transition-none`}),e.title,(0,h.jsx)(KSe,{problems:n?.problems??0,changed:n?.changed??0})]}),(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)(YSe,{field:e,theme:S.values,original:x?.values??S.values,problem:D1(E,e.path),onChange:t=>{D({...S,values:t},x1(e.path))}},e.path.join(`.`)))})]},e.title)}),(0,h.jsx)(i1,{onDelete:e===void 0?void 0:()=>{g(!0)},blocked:A,blockedId:o,pending:C.isPending,saved:d,cancel:(0,h.jsx)(LO,{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)(QSe,{values:T?.success===!0?S.values:void 0})]}),(0,h.jsx)(Bv,{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)}})]})}function QSe({values:e}){let{api:t}=V(),[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`),ec(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:C1,children:[(0,h.jsx)(Sy,{title:`Preview`,info:`library.theme.preview`,size:`small`,className:`pb-0`,children:n===void 0?null:(0,h.jsxs)(zO,{href:n.url,target:`_blank`,rel:`noreferrer`,variant:`secondary`,size:`small`,children:[(0,h.jsx)(Uc,{"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)(c1,{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 M1({children:e}){return(0,h.jsx)(T1,{back:(0,h.jsx)(fa,{to:`/document-themes`,children:`Back to Documents`}),children:e})}function N1({selection:e,total:t,noun:n,scope:r,busy:i,onDuplicate:a,onExport:o,onDelete:s,deleteLabel:c=`Delete selected`}){return e.count===0?null:(0,h.jsx)(NG,{selection:e,total:t,noun:n,className:`mb-2`,...r===void 0?{}:{scope:r},actions:(0,h.jsxs)(h.Fragment,{children:[a===void 0?null:(0,h.jsxs)(B,{size:`small`,disabled:i,disabledReason:`Working on the last press`,onClick:a,children:[(0,h.jsx)(Bc,{"aria-hidden":`true`,className:`size-[14px]`}),`Duplicate selected`]}),o===void 0?null:(0,h.jsxs)(B,{size:`small`,onClick:o,children:[(0,h.jsx)(Vc,{"aria-hidden":`true`,className:`size-[14px]`}),`Export selected`]}),(0,h.jsxs)(B,{size:`small`,variant:`destructive`,disabled:i,disabledReason:`Working on the last press`,onClick:s,children:[(0,h.jsx)(xl,{"aria-hidden":`true`,className:`size-[14px]`}),c]})]})})}function P1({selection:e,children:t}){return(0,h.jsx)(`div`,{onKeyDown:e.onKeyDown,children:t})}function F1(e){return`${e.page.format===`a4`?`A4`:`Letter`} · ${I1(e.fonts.body.family)} body`}function I1(e){return _1.find(t=>t.value===e)?.label??e}function L1(e){return e.startsWith(`#`)?e:`#${e}`}function R1({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)(Sy,{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)(z1,{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:L1(t)}}),(0,h.jsx)(`span`,{className:`font-mono text-small`,children:L1(t)})]})},e)),o.map(([e,t])=>(0,h.jsx)(z1,{label:`${e} font`,children:`${I1(t.family)}, ${t.style}`},`font-${e}`)),(0,h.jsx)(z1,{label:`Page`,children:`${r.page.format===`a4`?`A4`:`Letter`}, ${r.background.image===`parchment`?`parchment`:`flat ${L1(r.background.color)}`} background`})]})]})}function z1({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 B1({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:L1(e)}},t))})}var V1=`min-[1180px]:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]`,H1=`grid-cols-1 2xl:grid-cols-[minmax(0,1fr)_auto]`;function U1({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 W1({what:e,message:t,onRetry:n}){return(0,h.jsx)(GM,{tone:`danger`,title:`The ${e} couldn't be loaded.`,actions:(0,h.jsx)(B,{size:`small`,onClick:n,children:`Try again`}),children:t})}function G1({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:z(`flex flex-wrap items-center gap-0.5`,o),children:[t,r===void 0?null:(0,h.jsx)(B,{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`}),(0,h.jsxs)(BO,{children:[(0,h.jsx)(VO,{asChild:!0,children:(0,h.jsx)(bv,{size:`small`,label:`More actions for ${e}`,children:(0,h.jsx)(Hc,{"aria-hidden":`true`})})}),(0,h.jsxs)(HO,{children:[(0,h.jsx)(UO,{asChild:!0,children:n}),i===void 0?null:(0,h.jsxs)(UO,{"aria-label":`History of ${e}`,onSelect:i,children:[(0,h.jsx)(hl,{"aria-hidden":`true`,className:`size-4`}),`History`]}),(0,h.jsx)(WO,{}),(0,h.jsxs)(UO,{"aria-label":`Delete ${e}`,onSelect:a,children:[(0,h.jsx)(xl,{"aria-hidden":`true`,className:`size-4`}),`Delete`]})]})]})]})}var K1=[{value:`name`,label:`Name`},{value:`changed`,label:`Last changed`}];function q1(e,t){return[...e].sort((e,n)=>t===`changed`?n.updatedAt.localeCompare(e.updatedAt)||e.name.localeCompare(n.name):e.name.localeCompare(n.name,void 0,{sensitivity:`base`}))}var J1=e=>`slopify.library.sort.${e}`;function $Se(e){try{return globalThis.localStorage?.getItem(J1(e))===`changed`?`changed`:`name`}catch{return`name`}}function Y1(e){let[t,n]=(0,m.useState)(()=>$Se(e));return[t,t=>{n(t);try{globalThis.localStorage?.setItem(J1(e),t)}catch{}}]}function X1({what:e,sort:t,onSort:n}){let r=K1.find(e=>e.value===t)?.label??`Name`;return(0,h.jsxs)(BO,{children:[(0,h.jsx)(VO,{asChild:!0,children:(0,h.jsxs)(B,{variant:`quiet`,size:`small`,"aria-label":`Sort ${e}: ${r}`,children:[(0,h.jsx)(yc,{"aria-hidden":`true`}),r]})}),(0,h.jsx)(HO,{align:`start`,children:K1.map(e=>(0,h.jsxs)(UO,{"aria-label":`Sort by ${e.label.toLowerCase()}${e.value===t?` (current)`:``}`,onSelect:()=>n(e.value),children:[(0,h.jsx)(Ac,{"aria-hidden":`true`,className:e.value===t?`size-4`:`size-4 opacity-0`}),e.value===`changed`?`Last changed first`:`Name, A to Z`]},e.value))})]})}var eCe=4e3;function Z1(e){return e.match(/\s+|[^\s]+/gu)??[]}function tCe(e,t){let n=Z1(e),r=Z1(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=[];$1(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 rCe(s,c))$1(o,e.op,e.text);return $1(o,`same`,n.slice(n.length-a).join(``)),o}function Q1(e,t){let n=t===`before`?`added`:`removed`;return e.filter(e=>e.op!==n)}function nCe(e){let t=t=>e.filter(e=>e.op===t).reduce((e,t)=>e+Z1(t.text).filter(e=>e.trim()!==``).length,0);return{added:t(`added`),removed:t(`removed`)}}function $1(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 rCe(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,eCe),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())$1(f,e.op,e.text);return f}function e0({before:e,after:t,beforeLabel:n,afterLabel:r}){let i=(0,m.useMemo)(()=>tCe(e,t),[e,t]),a=nCe(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)(t0,{label:n,parts:Q1(i,`before`)}),(0,h.jsx)(t0,{label:r,parts:Q1(i,`after`)})]})]})}function t0({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:iCe(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 iCe(e){let t=0;return e.map(e=>{let n=`${e.op}-${String(t)}`;return t+=e.text.length,{key:n,part:e}})}var n0={versions:(e,t)=>[`library-history`,e,t],usedBy:(e,t)=>[`library-used-by`,e,t]};function r0(e,t){let{api:n}=V();return I({queryKey:n0.versions(e,t),queryFn:()=>Ks(n,e,t)})}function aCe(e,t){let{api:n}=V();return I({queryKey:n0.usedBy(e,t),queryFn:()=>qs(n,e,t)})}function i0({item:e,id:t,name:n,onClose:r}){let{api:i}=V(),a=_(),o=r0(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=L({mutationFn:n=>Js(i,e,t,n),onSuccess:async(n,r)=>{v(`Restored version ${String(r)} as a new version.`),l({}),await Promise.all([a.invalidateQueries({queryKey:n0.versions(e,t)}),a.invalidateQueries({queryKey:e===`prompt`?H.prompts:H.entries})])},onError:()=>v(void 0)}),b=s[0]?.version;return(0,h.jsx)(NM,{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)(Sy,{title:`Compare`,as:`h3`}),(0,h.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2`,children:[(0,h.jsx)(_L,{label:`Older`,tip:`library.history.compare`,children:(0,h.jsx)(bL,{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:o0(e,b)},e.version))})}),(0,h.jsx)(_L,{label:`Newer`,tip:`library.history.compare`,children:(0,h.jsx)(bL,{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:o0(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)(e0,{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)(Sy,{title:`Versions`,as:`h3`,info:`library.history.versions`}),(0,h.jsx)(mR,{label:`Versions of ${n}`,children:s.map(e=>(0,h.jsx)(hR,{title:`Version ${String(e.version)}`,meta:a0(e),actions:e.version===b?(0,h.jsx)(`span`,{className:`text-small text-ink-2`,children:`Current`}):(0,h.jsx)(B,{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)(WR,{tone:y.error===null?`success`:`error`,children:y.error?.message??g})]})]})})}function a0(e){return`${e.author} · ${s0(e.createdAt)}${e.restoredFrom===null?``:` · restored from version ${String(e.restoredFrom)}`}`}function o0(e,t){return`Version ${String(e.version)}${e.version===t?` (current)`:``} · ${s0(e.createdAt)}`}function s0(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}function c0({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)(Sy,{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)(xL,{children:`{{${e}}}`})},e))})]}),(0,h.jsx)(oCe,{item:e,id:t}),(0,h.jsx)(sCe,{item:e,id:t,name:n,onOpenHistory:c})]})}function oCe({item:e,id:t}){let n=aCe(e,t),r=n.data;return(0,h.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(Sy,{title:`Used by`,as:`h3`,className:`pb-0`,info:`library.used-by`,...r===void 0?{}:{meta:cCe(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)(mR,{label:`Used by`,children:[r.templates.map(e=>(0,h.jsx)(hR,{title:(0,h.jsx)(fa,{to:`/templates`,children:e.name}),meta:`Template`},`t-${e.id}`)),r.schedules.map(e=>(0,h.jsx)(hR,{title:(0,h.jsx)(fa,{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)(hR,{title:(0,h.jsx)(fa,{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 sCe({item:e,id:t,name:n,onOpenHistory:r}){let i=r0(e,t),a=i.data?.versions??[],[o,s]=a;return(0,h.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,h.jsx)(Sy,{title:`History`,as:`h3`,className:`pb-0`,info:`library.history`,...o===void 0?{}:{meta:(0,h.jsx)(`span`,{title:u0(o.createdAt),children:`${l0(a.length,`version`)} · latest ${a0(o)}`})},children:(0,h.jsx)(B,{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)(e0,{before:s.body,after:o.body,beforeLabel:`Version ${String(s.version)}`,afterLabel:`Version ${String(o.version)}`})]})}function cCe(e){return[l0(e.templates.length,`template`),l0(e.schedules.length,`schedule`),l0(e.projects.length,`project`)].join(`, `)}function l0(e,t){return`${String(e)} ${t}${e===1?``:`s`}`}function lCe(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{dateStyle:`medium`})}function u0(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,timeZoneName:`short`})}function d0({iso:e,children:t}){return(0,h.jsx)(`time`,{dateTime:e,title:u0(e),children:t??lCe(e)})}function f0({what:e,exports:t,accept:n,onFile:r,disabled:i=!1}){let a=(0,m.useRef)(null);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(BO,{children:[(0,h.jsx)(VO,{asChild:!0,children:(0,h.jsxs)(B,{variant:`quiet`,disabled:i,disabledReason:`Still loading`,children:[(0,h.jsx)(yc,{"aria-hidden":`true`,className:`size-[14px]`}),`Import or export`]})}),(0,h.jsxs)(HO,{children:[t.map(e=>(0,h.jsxs)(UO,{disabled:e.disabled===!0,onSelect:e.run,children:[(0,h.jsx)(Vc,{"aria-hidden":`true`,className:`size-4`}),e.label]},e.label)),(0,h.jsx)(WO,{}),(0,h.jsxs)(UO,{onSelect:()=>a.current?.click(),children:[(0,h.jsx)(Cl,{"aria-hidden":`true`,className:`size-4`}),`Import from a file…`]})]})]}),(0,h.jsx)(`input`,{ref:a,type:`file`,hidden:!0,accept:n,"aria-label":`Import ${e} from a file`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t!==void 0&&r(t)}})]})}var p0=`slopify-library`,uCe=20971520,m0=1e4,dCe={prompts:`prompts`,entries:`intros or outros`,documentThemes:`PDF themes`,aliases:`narration aliases`},h0={prompts:e=>({kind:e.kind,name:e.name,body:e.body}),entries:e=>({category:e.category,mode:e.mode,name:e.name,body:e.body}),documentThemes:e=>({name:e.name,values:e.values}),aliases:e=>({written:e.written,spoken:e.spoken,wholeWord:e.wholeWord,caseSensitive:e.caseSensitive})};function g0(e,t){return{format:p0,version:1,exportedAt:t.toISOString(),...e.prompts===void 0?{}:{prompts:e.prompts.map(h0.prompts)},...e.entries===void 0?{}:{entries:e.entries.map(h0.entries)},...e.documentThemes===void 0?{}:{documentThemes:e.documentThemes.map(h0.documentThemes)},...e.aliases===void 0?{}:{aliases:e.aliases.map(h0.aliases)}}}var _0=e=>G({error:`it has no name.`}).trim().min(1,{error:`it has no name.`}).max(e,{error:`its name is longer than ${String(e)} characters.`}),v0=G({error:`it has no text.`}).max(Nb,{error:`its text is longer than ${String(Nb)} characters.`}),fCe={prompts:J({kind:Y(jb,{error:`its kind isn't one of ${jb.join(`, `)}.`}),name:_0(200),body:v0}),entries:J({category:Y(Mb,{error:`it is neither an intro nor an outro.`}),mode:Y(Eb,{error:`its mode isn't one of ${Eb.join(`, `)}.`}),name:_0(200),body:v0}),documentThemes:J({name:_0(80),values:ND}),aliases:RD},pCe=J({format:Vw(p0),version:K().int().positive()}).loose();function y0(e,t){let n=dCe[t],r;try{r=JSON.parse(e)}catch{return{ok:!1,message:`it isn't a Slopify library file (the text isn't JSON). Pick a .json file made by Export.`}}let i=pCe.safeParse(r);if(!i.success)return{ok:!1,message:`it isn't a Slopify library file. Pick a .json file made by Export on a Library tab.`};if(i.data.version>1)return{ok:!1,message:`it was made by a newer Slopify. Update Slopify (Settings → Updates), then import it again.`};let a=i.data[t];if(!Array.isArray(a)||a.length===0)return{ok:!1,message:`it holds no ${n}. Import it on the Library tab it was exported from.`};if(a.length>m0)return{ok:!1,message:`it holds more than ${String(m0)} ${n}. Split it into smaller files.`};let o=[],s=[],c=fCe[t];for(let[e,t]of a.entries()){let n=c.safeParse(t);n.success?o.push(n.data):s.push({item:mCe(t,e),reason:hCe(n.error)})}return{ok:!0,items:o,skipped:s}}function mCe(e,t){let n=J({name:G().trim().min(1)}).safeParse(e);if(n.success)return n.data.name;let r=J({written:G().trim().min(1)}).safeParse(e);return r.success?r.data.written:`Item ${String(t+1)}`}function hCe(e){let t=e.issues[0];if(t===void 0)return`it doesn't fit.`;let[n]=t.path;return n===`values`?`its setting ${t.path.slice(1).join(`.`)}: ${t.message}`:n===`written`||n===`spoken`?`its ${n===`written`?`written form`:`spoken form`} is empty or too long.`:typeof n==`string`&&/^it/u.test(t.message)?t.message:n===void 0?`it isn't an item.`:`its ${String(n)} is missing or wrong.`}function gCe(e,t,n){return b0(e,t,n,e=>e===1?` (imported)`:` (imported ${String(e)})`)}function _Ce(e,t,n){return b0(e,t,n,e=>e===1?` copy`:` copy ${String(e)}`,!1)}function b0(e,t,n,r,i=!0){let a=e.trim();if(i&&!t.has(a.toLowerCase()))return a;for(let e=1;;e+=1){let i=r(e),o=`${a.slice(0,Math.max(0,n-i.length)).trimEnd()}${i}`;if(!t.has(o.toLowerCase()))return o}}var vCe=3;async function yCe(e,t){let n=new Map,r=e=>{let t=n.get(e);if(t!==void 0)return t;let r=new Set;return n.set(e,r),r};for(let e of t.existing)r(e.group).add(e.name.trim().toLowerCase());let i=0,a=0,o=[];for(let n of e){let e=r(t.groupOf(n)),s=``;for(let r=0;r<vCe;r+=1){let r=gCe(n.name,e,t.max);try{let o=await t.save({...n,name:r});if(e.add(r.toLowerCase()),o.ok){i+=1,r!==n.name.trim()&&(a+=1),s=``;break}if(s=o.fields.map(e=>e.message).join(` `),!o.fields.some(e=>e.field===`name`))break}catch(e){s=e instanceof Error?e.message:String(e);break}}s!==``&&o.push({item:n.name.trim()||`An item`,reason:s})}return{added:i,renamed:a,skipped:o}}function x0(e,t,n){let r=[...e],i=0,a=0;for(let e of t){let t=r.findIndex(t=>t.written.trim()===e.written),o=t<0?void 0:r[t];o===void 0?(r.push(n(e)),i+=1):o.spoken.trim()!==e.spoken&&(r[t]={...o,spoken:e.spoken},a+=1)}return{rows:r,added:i,updated:a}}var S0=e=>e instanceof Error?e.message:String(e);function C0({noun:e,listKey:t,all:n,groupOf:r=()=>``,nameMax:i,duplicate:a,remove:o,trash:s,selection:c}){let{api:l}=V(),u=_(),d=wv(),f=t=>PG(t,e[0],e[1]),p=async()=>{await Promise.all([u.invalidateQueries({queryKey:t}),...s===void 0?[]:[u.invalidateQueries({queryKey:oQ})]])},m=(e,t,n)=>{let r=e[0];r!==void 0&&d(`${f(e.length)} ${e.length===1?`wasn't`:`weren't`} ${t}: “${r.item.name}”: ${r.reason} ${n}`,`error`)},h=L({mutationFn:async e=>{let t=new Map;for(let e of n){let n=t.get(r(e))??new Set;n.add(e.name.trim().toLowerCase()),t.set(r(e),n)}let o=[],s=[];for(let n of e){let e=t.get(r(n))??new Set;t.set(r(n),e);let c=_Ce(n.name,e,i);try{let t=await a(n,c);t===null?(e.add(c.toLowerCase()),o.push(c)):s.push({item:n,reason:t})}catch(e){s.push({item:n,reason:S0(e)})}}return{made:o,refused:s}},onSuccess:({made:e,refused:t})=>{let[n]=e;e.length===1&&n!==void 0?d(`Duplicated as “${n}”.`,`success`):e.length>1&&d(`Duplicated ${f(e.length)}.`,`success`),m(t,`duplicated`,`Press Duplicate selected again.`)},onError:e=>d(`Nothing was duplicated: ${S0(e)} Press Duplicate selected again.`,`error`),onSettled:async()=>{c.clear(),await p()}}),g=async(t,n)=>{try{let e=await lQ(l,t.map(e=>({kind:n,id:e.id})));e.failed.length>0?d(`${f(e.failed.length)} couldn't be restored: ${e.failed[0]?.detail??``} Restore ${e.failed.length===1?`it`:`them`} in Settings → Backup & storage → Trash.`,`error`):d(`Restored ${f(e.restored.length)}.`,`success`)}catch(t){d(`The ${e[1]} weren't restored: ${S0(t)} Restore them in Settings → Backup & storage → Trash.`,`error`)}finally{await p()}},v=L({mutationFn:async e=>{let t=[],n=[];for(let r of e)try{await o(r),t.push(r)}catch(e){n.push({item:r,reason:S0(e)})}return{done:t,refused:n}},onSuccess:({done:e,refused:t})=>{e.length>0&&(s===void 0?d(`Deleted ${f(e.length)} permanently.`,`success`):d(`Moved ${f(e.length)} to the trash.`,`success`,{label:`Undo`,run:()=>void g(e,s)})),m(t,`deleted`,`Press Delete selected again.`)},onError:e=>d(`Nothing was deleted: ${S0(e)} Press Delete selected again.`,`error`),onSettled:async()=>{c.clear(),await p()}});return{duplicate:e=>h.mutate(e),remove:e=>v.mutate(e),busy:h.isPending||v.isPending}}function w0(e){return e.ok?null:(e.fields??[]).map(e=>e.message).join(` `)}function T0(e,t,n){let r=URL.createObjectURL(new Blob([t],{type:n})),i=document.createElement(`a`);i.href=r,i.download=e,i.click(),URL.revokeObjectURL(r)}function E0(e,t){T0(`slopify-${e}-${t.exportedAt.slice(0,10)}.json`,`${JSON.stringify(t,null,2)}\n`,`application/json`)}async function D0(e){if(e.size>20971520)return{ok:!1,message:`it is larger than ${String(uCe/1024/1024)} MB, far more than a Library export. Pick the .json file Export made.`};try{return{ok:!0,text:await e.text()}}catch(e){return{ok:!1,message:`the file couldn't be read (${e instanceof Error?e.message:String(e)}). Pick it again.`}}}function O0(e){if(e.length===0)return``;let t=e.slice(0,3).map(e=>`“${e.item}”: ${e.reason}`).join(` `),n=e.length>3?` And ${String(e.length-3)} more.`:``;return`Skipped ${String(e.length)}: ${t}${n}`}function bCe(e,t,n){let r=O0(n.skipped);if(n.added===0)return{text:`Nothing was imported from ${e}. ${r} Fix the file and import it again.`,tone:`error`};let i=n.renamed===0?``:` ${PG(n.renamed,`was`,`were`)} renamed “(imported)” because the name was taken.`;return{text:`Imported ${PG(n.added,t[0],t[1])} from ${e}.${i}${r===``?``:` ${r}`}`,tone:`success`}}var k0=(e,t)=>`${e} wasn't imported: ${t}`;function A0({section:e,pack:t,stem:n,noun:r,listKey:i,existing:a,groupOf:o,nameMax:s,save:c}){let l=_(),u=wv(),d=L({mutationFn:async t=>{let n=await D0(t);if(!n.ok)return{refused:n.message};let r=y0(n.text,e);if(!r.ok)return{refused:r.message};let i=await yCe(r.items,{existing:a.map(e=>({group:o(e),name:e.name})),groupOf:o,max:s,save:c});return{outcome:{...i,skipped:[...r.skipped,...i.skipped]}}},onSuccess:(e,t)=>{if(`refused`in e){u(k0(t.name,e.refused),`error`);return}let n=bCe(t.name,r,e.outcome);u(n.text,n.tone)},onError:(e,t)=>u(k0(t.name,`${e.message} Press Import or export, then Import from a file, to try again.`),`error`),onSettled:()=>l.invalidateQueries({queryKey:i})});return{exportItems:e=>{E0(n,g0(t(e),new Date)),u(`Exported ${PG(e.length,r[0],r[1])}.`,`success`)},importFile:e=>d.mutate(e),importing:d.isPending}}var xCe=[{label:`Setups`,tabs:[{to:`/templates`,label:`Templates`}]},{label:`Building blocks`,tabs:[{to:`/prompts`,label:`Prompts`},{to:`/entries`,label:`Intros & outros`},{to:`/document-themes`,label:`PDF themes`},{to:`/narration-aliases`,label:`Narration aliases`}]},{label:`Results`,tabs:[{to:`/ab-results`,label:`A/B results`}]}];function SCe(){return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(EG,{title:`Library`,meta:`Templates to start from, and the prompts, intros and outros, PDF themes and narration aliases they use`}),(0,h.jsx)(`div`,{className:`mb-6 flex min-w-0 flex-wrap items-end gap-x-8 gap-y-3 border-b border-line`,children:xCe.map(e=>(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsx)(`div`,{className:`sl-kicker`,children:e.label}),(0,h.jsx)(Hbe,{items:e.tabs,label:e.label,className:`border-b-0`})]},e.label))}),(0,h.jsx)(CCe,{}),(0,h.jsx)(Oa,{})]})}function CCe(){let e=Ji(),t=Ba({select:e=>e.location}),n=t.search,r=Ub(t.pathname===`/prompts`?n.kind:void 0),i=Bb(t.pathname===`/entries`?n.category:void 0);return Xy({id:`library.new-prompt`,title:`New prompt`,group:`Library`,keywords:[`create`,`article`,`image`,`thumbnail`],run:()=>{e({to:`/prompts/new`,search:{kind:r}})}}),Xy({id:`library.new-entry`,title:`New intro or outro`,group:`Library`,keywords:[`create`,`entry`],run:()=>{e({to:`/entries/new`,search:{category:i}})}}),Xy({id:`library.new-document-theme`,title:`New PDF theme`,group:`Library`,keywords:[`create`,`pdf`,`theme`,`document`],run:()=>{e({to:`/document-themes/new`,search:{from:`plain`}})}}),Xy({id:`library.open-prompts`,title:`Open prompts`,group:`Library`,run:()=>{e({to:`/prompts`,search:{kind:`article`}})}}),Xy({id:`library.open-entries`,title:`Open intros and outros`,group:`Library`,keywords:[`entries`],run:()=>{e({to:`/entries`,search:{category:`intro`}})}}),Xy({id:`library.open-templates`,title:`Open templates`,group:`Library`,keywords:[`setups`],run:()=>{e({to:`/templates`})}}),Xy({id:`library.open-document-themes`,title:`Open PDF themes`,group:`Library`,keywords:[`pdf`,`documents`,`document themes`],run:()=>{e({to:`/document-themes`})}}),null}function j0({children:e,action:t,className:n}){return(0,h.jsxs)(`div`,{"data-slot":`library-toolbar`,className:z(`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)(Sv,{className:`ml-auto shrink-0`,children:t})]})}function wCe(){let{api:e}=V(),t=_(),n=I(fy(e)),[r,i]=pL(),[a,o]=Y1(`document-theme`),[s,c]=(0,m.useState)(void 0),l=L({mutationFn:t=>$s(e,t),onSettled:async()=>{c(void 0),await t.invalidateQueries({queryKey:H.documentThemes})}}),u=n.data,d=u===void 0?[]:q1(u.themes,a),f=d.find(e=>e.id===r),p=f===void 0?u?.builtIns.find(e=>e.name===r):void 0,g=f===void 0&&p===void 0?d[0]:void 0,v=f??g,y=v===void 0?p??u?.builtIns[0]:void 0,b=AG(d.map(e=>e.id)),x=d.filter(e=>b.has(e.id)),[S,C]=(0,m.useState)(!1),w=C0({noun:M0,listKey:H.documentThemes,all:d,nameMax:80,duplicate:async(t,n)=>w0(await Qs(e,{name:n,values:t.values},void 0)),remove:t=>$s(e,t.id),trash:void 0,selection:b}),T=A0({section:`documentThemes`,pack:e=>({documentThemes:e}),stem:`pdf-themes`,noun:M0,listKey:H.documentThemes,existing:d,groupOf:()=>``,nameMax:80,save:t=>Qs(e,t,void 0)});return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(j0,{action:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(f0,{what:`PDF themes`,disabled:u===void 0||T.importing,exports:[{label:`Export all ${PG(d.length,`theme`,`themes`)} of yours`,run:()=>T.exportItems(d),disabled:d.length===0}],accept:`.json,application/json`,onFile:T.importFile}),(0,h.jsx)(LO,{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)(W1,{what:`PDF themes`,message:n.error.message,onRetry:()=>void n.refetch()}),u===void 0?n.error===null?(0,h.jsx)(U1,{label:`PDF themes`}):null:(0,h.jsx)(OG,{className:V1,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)(Sy,{title:`Your themes`,as:`h3`,className:`pb-0`,info:`library.themes.yours`,children:d.length>1?(0,h.jsx)(X1,{what:`your themes`,sort:a,onSort:o}):null}),u.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.jsxs)(P1,{selection:b,children:[(0,h.jsx)(N1,{selection:b,total:d.length,noun:M0,busy:w.busy,onDuplicate:()=>w.duplicate(x),onExport:()=>T.exportItems(x),onDelete:()=>C(!0)}),(0,h.jsx)(mR,{label:`Your themes`,children:d.map(e=>(0,h.jsx)(hR,{className:H1,lead:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(MG,{selection:b,value:e.id,label:e.name}),(0,h.jsx)(B1,{colors:e.values.colors})]}),title:e.name,meta:(0,h.jsxs)(h.Fragment,{children:[`${F1(e.values)} · updated `,(0,h.jsx)(d0,{iso:e.updatedAt})]}),selected:e.id===v?.id,onSelect:()=>i(e.id),actions:(0,h.jsx)(G1,{name:e.name,edit:(0,h.jsx)(LO,{to:`/document-themes/$themeId`,params:{themeId:e.id},"aria-label":`Edit ${e.name}`,variant:`quiet`,size:`small`,children:`Edit`}),duplicate:(0,h.jsx)(LO,{to:`/document-themes/new`,search:{from:e.id},"aria-label":`Duplicate ${e.name}`,variant:`quiet`,size:`small`,children:`Duplicate`}),onDelete:()=>c(e)})},e.id))})]})]}),(0,h.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(Sy,{title:`Built in`,as:`h3`,className:`pb-0`,info:`library.themes.built-in`}),(0,h.jsx)(mR,{label:`Built-in themes`,children:u.builtIns.map(e=>(0,h.jsx)(hR,{className:H1,lead:(0,h.jsx)(B1,{colors:e.values.colors}),title:e.label,meta:F1(e.values),selected:e.name===y?.name,onSelect:()=>i(e.name),actions:(0,h.jsx)(LO,{to:`/document-themes/new`,search:{from:e.name},"aria-label":`Copy ${e.label}`,variant:`quiet`,size:`small`,children:`Copy`})},e.name))})]})]}),detail:v===void 0?y===void 0?null:(0,h.jsx)(R1,{name:y.label,kicker:`Built in`,meta:`Built-in themes can't be changed. Copy one to make it yours.`,values:y.values,action:(0,h.jsx)(LO,{to:`/document-themes/new`,search:{from:y.name},size:`small`,children:`Copy theme`})}):(0,h.jsx)(R1,{name:v.name,kicker:`Your theme`,meta:(0,h.jsxs)(h.Fragment,{children:[`Updated `,(0,h.jsx)(d0,{iso:v.updatedAt})]}),values:v.values,action:(0,h.jsx)(LO,{to:`/document-themes/$themeId`,params:{themeId:v.id},size:`small`,children:`Edit theme`})})}),l.error===null?null:(0,h.jsx)(GM,{tone:`danger`,title:`The theme wasn't deleted.`,className:`mt-4`,children:l.error.message}),(0,h.jsx)(Bv,{open:s!==void 0,title:`Delete the PDF theme “${s?.name??``}”?`,consequence:TCe,confirmLabel:`Delete theme permanently`,pending:l.isPending,onConfirm:()=>{s!==void 0&&l.mutate(s.id)},onCancel:()=>c(void 0)}),(0,h.jsx)(Bv,{open:S,title:`Delete ${PG(x.length,`PDF theme`,`PDF themes`)} permanently?`,consequence:`${x.length===1?`“${x[0]?.name??``}” is`:`These ${String(x.length)} themes are`} deleted permanently: PDF themes do not go to Settings → Trash, so they cannot be restored. Projects that used them keep their own copy of the settings.`,confirmLabel:`Delete ${PG(x.length,`theme`,`themes`)} permanently`,cancelLabel:`Keep them`,pending:w.busy,onConfirm:()=>{w.remove(x),C(!1)},onCancel:()=>C(!1)})]})}var M0=[`PDF theme`,`PDF themes`],TCe=`It is deleted permanently: PDF themes do not go to Settings → Trash, so it cannot be restored. Projects that used it keep their own copy of its settings.`;function N0(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 P0({name:e,onSelect:t,onRename:n,tip:r=`library.inline-rename`,maxLength:i=200}){let a=wv(),[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`,...xy,children:[(0,h.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1`,children:[(0,h.jsx)(X,{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)(B,{size:`small`,variant:`primary`,disabled:f,onClick:()=>void v(),children:f?`Saving…`:`Save name`}),(0,h.jsx)(B,{size:`small`,variant:`quiet`,disabled:f,onClick:y,children:`Cancel`}),(0,h.jsx)(U,{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)(gR,{onSelect:t,className:`min-w-0`,children:e}),(0,h.jsx)(bv,{size:`small`,label:`Rename ${e}`,onClick:()=>{l(e),s(!0)},children:(0,h.jsx)(ul,{"aria-hidden":`true`,strokeWidth:1.75})})]})}function ECe({category:e,onCategory:t,onUseInPlay:n,playBlocked:r}){let{api:i}=V(),a=_(),o=I(dy(i)),[s,c]=(0,m.useState)(``),l=(0,m.useRef)(null),u=Zy(l,`intros and outros`),[d,f]=pL(),[p,g]=Y1(`entry`),[v,y]=(0,m.useState)(void 0),[b,x]=(0,m.useState)(void 0),S=L({mutationFn:e=>ic(i,e),onSettled:async()=>{y(void 0),await a.invalidateQueries({queryKey:H.entries})}}),C=async(e,t)=>{let n=await Xs(i,{category:e.category,mode:e.mode,name:t,body:e.body},e.id);return await a.invalidateQueries({queryKey:H.entries}),n.ok?null:N0(n.fields)},w=o.data?.entries.filter(t=>t.category===e),T=s.trim().toLowerCase(),E=T===``?w:w?.filter(e=>e.name.toLowerCase().includes(T)||e.body.toLowerCase().includes(T)),D=E===void 0?void 0:q1(E,p),O=D?.find(e=>e.id===d)??D?.[0],k=o.data?.entries??[],A=AG(D?.map(e=>e.id)??[]),j=D?.filter(e=>A.has(e.id))??[],M=[e,`${e}s`],N=C0({noun:M,listKey:H.entries,all:k,groupOf:e=>e.category,nameMax:200,duplicate:async(e,t)=>w0(await Xs(i,{category:e.category,mode:e.mode,name:t,body:e.body},void 0)),remove:e=>ic(i,e.id),trash:`entry`,selection:A}),P=A0({section:`entries`,pack:e=>({entries:e}),stem:`intros-and-outros`,noun:[`intro or outro`,`intros and outros`],listKey:H.entries,existing:k,groupOf:e=>e.category,nameMax:200,save:e=>Xs(i,e,void 0)});return(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(j0,{action:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(f0,{what:`intros and outros`,disabled:o.data===void 0||P.importing,exports:[{label:`Export all ${String(k.length)} intros and outros`,run:()=>P.exportItems(k),disabled:k.length===0}],accept:`.json,application/json`,onFile:P.importFile}),(0,h.jsx)(LO,{to:`/entries/new`,search:{category:e},variant:`primary`,children:`New intro or outro`})]}),children:[(0,h.jsx)(X,{type:`search`,ref:l,"aria-label":`Search intros and outros`,"aria-keyshortcuts":cb(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)(wy,{label:`Entry category`,value:e,options:Pb.map(e=>({...e,label:`${e.label}s`})),onChange:t,tip:`library.entry.category`}),(0,h.jsx)(X1,{what:`intros and outros`,sort:p,onSort:g})]}),o.error===null?null:(0,h.jsx)(W1,{what:`intros and outros`,message:o.error.message,onRetry:()=>void o.refetch()}),D===void 0||w===void 0?o.error===null?(0,h.jsx)(U1,{label:`Intros and outros`}):null:w.length===0?(0,h.jsx)(OCe,{category:e}):(0,h.jsx)(OG,{className:V1,list:D.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.jsxs)(P1,{selection:A,children:[(0,h.jsx)(N1,{selection:A,total:D.length,noun:M,scope:T===``?void 0:`Select all ${String(D.length)} shown`,busy:N.busy,onDuplicate:()=>N.duplicate(j),onExport:()=>P.exportItems(j),onDelete:()=>N.remove(j)}),(0,h.jsx)(mR,{label:`${Ib(e)}s`,children:D.map(e=>(0,h.jsx)(hR,{className:H1,lead:(0,h.jsx)(MG,{selection:A,value:e.id,label:e.name}),title:(0,h.jsx)(P0,{name:e.name,onSelect:()=>f(e.id),onRename:t=>C(e,t)}),meta:DCe(e),selected:e.id===O?.id,actions:(0,h.jsx)(G1,{name:e.name,edit:(0,h.jsx)(LO,{to:`/entries/$entryId`,params:{entryId:e.id},"aria-label":`Edit ${e.name}`,variant:`quiet`,size:`small`,children:`Edit`}),duplicate:(0,h.jsx)(LO,{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:()=>x(e),onDelete:()=>y(e)})},e.id))})]}),detail:O===void 0?null:(0,h.jsx)(c0,{item:`entry`,id:O.id,name:O.name,kicker:`${Ib(O.category)} · ${Lb(O.mode)}`,meta:(0,h.jsxs)(h.Fragment,{children:[`Updated `,(0,h.jsx)(d0,{iso:O.updatedAt})]}),body:O.body,slots:O.slots,actions:(0,h.jsx)(LO,{to:`/entries/$entryId`,params:{entryId:O.id},size:`small`,children:`Edit ${O.category}`}),onOpenHistory:()=>x(O)},O.id)}),S.error===null?null:(0,h.jsx)(GM,{tone:`danger`,title:`The ${e} wasn't deleted.`,className:`mt-4`,children:S.error.message}),b===void 0?null:(0,h.jsx)(i0,{item:`entry`,id:b.id,name:b.name,onClose:()=>x(void 0)},b.id),(0,h.jsx)(Bv,{open:v!==void 0,title:v===void 0?``:`Delete "${v.name}"?`,consequence:`Moves it to the trash for 30 days (Settings → Trash). Projects that used it keep their text.`,confirmLabel:`Delete ${v?.category??e}`,pending:S.isPending,onConfirm:()=>{v!==void 0&&S.mutate(v.id)},onCancel:()=>y(void 0)})]})}function DCe(e){return(0,h.jsxs)(h.Fragment,{children:[`${Lb(e.mode)} · ${l0(e.slots.length,`keyword`)} · updated `,(0,h.jsx)(d0,{iso:e.updatedAt})]})}function OCe({category:e}){let t=e===`intro`?`before`:`after`;return(0,h.jsx)(hQ,{title:`No ${e}s yet`,children:`An ${e} is narrated ${t} the body in the run's voice.`})}function kCe({name:e,className:t}){return(0,h.jsx)(`span`,{"data-slot-chip":e,className:z(`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 F0({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)(Sy,{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)(kCe,{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=>{let n=jCe(t,e.message);return(0,h.jsxs)(`span`,{className:`flex flex-col items-start gap-1`,children:[(0,h.jsx)(`span`,{className:`text-small text-danger`,children:e.message}),n===void 0?null:(0,h.jsx)(B,{variant:`quiet`,size:`small`,onClick:()=>MCe(r,n),children:`Go to ${ACe(e.message)??`it`}`})]},e.message)})]})]})}var I0=/line (\d+), column (\d+)/;function ACe(e){return I0.exec(e)?.[0]}function jCe(e,t){let n=I0.exec(t);if(n===null)return;let r=e.split(`
|
|
277
277
|
`),i=Number(n[1]),a=Number(n[2]);if(!(i<1||i>r.length))return r.slice(0,i-1).reduce((e,t)=>e+t.length+1,0)+a-1}function MCe(e,t){let n=document.querySelector(`textarea[aria-describedby~="${e}"]`);n instanceof HTMLTextAreaElement&&(n.focus(),n.setSelectionRange(t,Math.min(t+2,n.value.length)))}function L0({className:e,...t}){return(0,h.jsx)(kne,{"data-slot":`label`,className:z(`engraved block select-none text-ink-3`,e),...t})}function R0({className:e,...t}){return(0,h.jsx)(Wne,{"data-slot":`toggle-group`,className:z(`inline-flex w-fit items-stretch overflow-hidden rounded-control border border-line-strong`,e),...t})}function z0({className:e,...t}){return(0,h.jsx)(Yne,{"data-slot":`toggle-group-item`,className:z(`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 B0({label:e,value:t,options:n,describedBy:r,tip:i,onPick:a}){let o=(0,m.useId)();return(0,h.jsxs)(`div`,{...xy,children:[(0,h.jsxs)(`div`,{className:`mb-1 flex items-center gap-1`,children:[(0,h.jsx)(L0,{id:o,children:e}),i===void 0?null:(0,h.jsx)(U,{id:i,label:e,className:`-my-1`})]}),(0,h.jsx)(R0,{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)(z0,{value:e.value,children:e.label},e.value))})]})}function V0(e){return H0(e.name,e.body)}function NCe(e){return H0(e.name,e.body)}function H0(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(Nb)} characters or fewer.`}),n;for(let e of dG(t).errors)n.push({field:`body`,message:PCe(e,t)});return n}function PCe(e,t){let n=FCe(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 FCe(e,t){let n=e.slice(0,t),r=n.lastIndexOf(`
|
|
@@ -321,6 +321,6 @@ St. = Saint`,"aria-describedby":o.skipped.length===0?void 0:`${a}-skipped`,onCha
|
|
|
321
321
|
`):void 0,o?.filter(e=>e.trim()).map((e,t)=>`${t+1}. ${e}`).join(`
|
|
322
322
|
`),s].find(e=>e?.trim())??`No text was recorded for this part.`}catch{return`Recorded text cannot be decoded.`}}function WMe({projectId:e,pending:t,onRestore:n}){let{api:r}=V(),[i,a]=(0,m.useState)(),o=I({queryKey:H.revisions(e),queryFn:async()=>{let t=await kB(r,e);if(!t.ok)throw Error(t.message);return t.value}}),s=I({queryKey:H.revision(e,i??``),enabled:i!==void 0,queryFn:async()=>{if(i===void 0)throw Error(`Choose a version from History first.`);let t=await AB(r,e,i);if(!t.ok)throw Error(t.message);return t.value.view}}),c=s.data,l=c?.outputs.find(e=>e.selected&&e.available&&(e.output.role===`image`||e.output.role===`thumbnail`)),u=c===void 0?``:vd(c.revision.createdAt),d=l??c?.outputs.find(e=>e.available);return(0,h.jsxs)(`section`,{"aria-label":`Project history`,className:`space-y-3`,children:[(0,h.jsx)(Sy,{title:`Project history`}),o.error===null?null:(0,h.jsx)(`p`,{role:`alert`,children:o.error.message}),(0,h.jsx)(`ol`,{className:`space-y-2`,children:o.data?.revisions.map(e=>(0,h.jsx)(`li`,{children:(0,h.jsxs)(B,{type:`button`,onClick:()=>a(e.id),children:[e.title,` ·`,` `,(0,h.jsx)(d0,{iso:e.createdAt,children:vd(e.createdAt)}),e.byAgent===!0?` · by agent`:``,e.current?` · Current`:``]})},e.id))}),(o.data?.agentActions.length??0)===0?null:(0,h.jsxs)(`section`,{"aria-label":`Done by agents`,className:`space-y-1`,children:[(0,h.jsx)(`h3`,{className:`m-0 text-title-3`,children:`Done by agents`}),(0,h.jsx)(`ul`,{className:`m-0 list-none space-y-1 p-0 text-small text-ink-2`,children:o.data?.agentActions.map(e=>(0,h.jsxs)(`li`,{children:[e.title,` · by agent ·`,` `,(0,h.jsx)(d0,{iso:e.createdAt,children:vd(e.createdAt)})]},e.id))})]}),s.error===null?null:(0,h.jsx)(`p`,{role:`alert`,children:s.error.message}),c===void 0?null:(0,h.jsxs)(`div`,{className:`space-y-3`,children:[(0,h.jsx)(`h3`,{className:`m-0 text-title-3`,children:c.revision.config.title}),(0,h.jsxs)(Sv,{children:[(0,h.jsx)(B,{variant:`primary`,disabled:t,onClick:()=>n(c.revision.id),children:`Restore this revision`}),l===void 0?null:(0,h.jsxs)(zO,{href:LB(r,e,c.revision.id),download:!0,children:[(0,h.jsx)(Vc,{"aria-hidden":`true`,strokeWidth:1.75}),c.current?`Download all images`:`Download this version's images`]}),d===void 0?null:(0,h.jsx)(BB,{projectId:e,asset:``,folder:{revisionId:c.revision.id,recordId:d.recordId}})]}),(0,h.jsx)(`ul`,{className:`m-0 list-none space-y-3 p-0`,children:c.outputs.map(t=>(0,h.jsxs)(`li`,{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-center justify-between gap-x-4 gap-y-2`,children:[(0,h.jsxs)(`span`,{className:`min-w-0`,children:[(0,h.jsx)(`span`,{className:`font-semibold text-ink`,children:h6(t.output)}),(0,h.jsx)(`span`,{className:`text-small text-ink-2`,children:` · ${t.selected?a6(t.state,t.output.role,t.available):`Earlier result`}`})]}),t.available?(0,h.jsxs)(zO,{href:FB(r,e,c.revision.id,t.recordId),download:!0,size:`small`,"aria-label":`Download ${h6(t.output)} from the version of ${u}`,children:[(0,h.jsx)(Vc,{"aria-hidden":`true`,strokeWidth:1.75}),c.current?`Download`:`Download this version`]}):null]}),t.available?(0,h.jsxs)(`details`,{children:[(0,h.jsx)(`summary`,{children:`Preview retained output`}),t.output.role===`video`?(0,h.jsx)(vz,{className:`max-w-[640px]`,label:h6(t.output),src:FB(r,e,c.revision.id,t.recordId)}):[`audio_export`,`audio_body`,`audio_intro`,`audio_outro`].includes(t.output.role)?(0,h.jsx)(w8,{label:h6(t.output),src:FB(r,e,c.revision.id,t.recordId)}):t.output.role===`image`||t.output.role===`thumbnail`?(0,h.jsx)(Cz,{className:`max-w-[480px]`,alt:h6(t.output),title:h6(t.output),meta:t.selected?`Current`:`Earlier result`,src:FB(r,e,c.revision.id,t.recordId)}):(0,h.jsx)(`p`,{children:`Use Download to inspect this retained file.`})]}):null]},t.recordId))}),(0,h.jsx)(`ul`,{"aria-label":`Retained narration parts`,children:c.pieces.filter(e=>e.stageKind===`audio`&&e.assetId!==null).map(t=>(0,h.jsxs)(`li`,{children:[`Narration part `,t.piece.idx,t.selected?``:` · Earlier result`,t.available?(0,h.jsxs)(`details`,{children:[(0,h.jsx)(`summary`,{children:`Preview retained audio part`}),(0,h.jsx)(w8,{label:`Narration part ${String(t.piece.idx)}`,src:FB(r,e,c.revision.id,t.recordId)}),(0,h.jsxs)(zO,{href:FB(r,e,c.revision.id,t.recordId),download:!0,size:`small`,children:[(0,h.jsx)(Vc,{"aria-hidden":`true`,strokeWidth:1.75}),`Download narration part`]})]}):(0,h.jsx)(`span`,{children:` · File missing`})]},t.recordId))}),(0,h.jsx)(`ul`,{"aria-label":`Retained text parts`,children:c.pieces.filter(e=>e.assetId===null).map(e=>(0,h.jsx)(`li`,{children:(0,h.jsxs)(`details`,{children:[(0,h.jsxs)(`summary`,{children:[e.stageKind,` part `,e.piece.idx]}),(0,h.jsx)(`pre`,{className:`whitespace-pre-wrap break-words`,children:UMe(e.piece.payload)})]})},e.recordId))})]})]})}function GMe({controller:e,projectId:t,active:n}){let r=e;return n?(0,h.jsxs)(h.Fragment,{children:[r.preview===void 0&&(r.error||r.refusal)?(0,h.jsxs)(`div`,{className:`mb-4 flex flex-col gap-3`,children:[(0,h.jsx)(v7,{error:r.error,refusal:r.refusal}),r.edit===void 0&&r.refusal?.reason===`conflict`?(0,h.jsx)(B,{disabled:r.pending,onClick:r.reloadCurrent,className:`self-start`,children:`Reload current revision`}):null]}):null,(0,h.jsx)(WMe,{projectId:t,pending:r.busy,onRestore:r.restore})]}):null}function KMe({controller:e}){let t=e;return(0,h.jsx)(NM,{open:t.preview!==void 0,title:`Choose what to remake`,onClose:t.closePreview,children:t.preview===void 0?null:(0,h.jsx)(DMe,{preview:t.preview,feedback:(0,h.jsx)(v7,{error:t.error,refusal:t.refusal}),pending:t.pending,onStart:t.start,onCancel:t.closePreview},t.preview.id)})}var qMe=e=>{switch(e.state){case`running`:return`running`;case`done`:case`provided`:return`done`;case`failed`:return e.retryAt===void 0?`failed`:`waiting`;default:return`off`}},y7={person:{state:lA,detail:`Approve it under Checkpoints to carry on.`},day:{state:fA,detail:`Its schedule makes it on its day.`},agent:{state:uA,detail:`Goes on once the agent answers.`}},JMe=e=>e.state===`failed`&&e.retryAt!==void 0?rR:cA[e.state];function YMe(e,t){if(e.startedAt===null)return;let n=Date.parse(e.startedAt),r=e.finishedAt===null?t:Date.parse(e.finishedAt);if(!Number.isFinite(n)||!Number.isFinite(r)||r<n)return;let i=Math.round((r-n)/1e3);if(i<1)return;if(i<60)return`${String(i)} s`;let a=Math.round(i/60);return a<60?`${String(a)} min`:`${String(Math.floor(a/60))} h ${String(a%60)} min`}function XMe(e,t,n){let r=s2(t,n);return r===void 0?e:e===void 0||e===``?c2(r):`${e} · ${c2(r)}`}function ZMe({stages:e,outputs:t,project:n,resumable:r,holding:i,now:a}){let o=gA(n),s=e=>i.find(t=>t.stage===e.kind)?.waitsFor??(o&&e.state===`pending`?`agent`:void 0);return e.filter(e=>e.state!==`skipped`).map(e=>{let i=s(e),o=YMe(e,a);return{id:e.id,name:e.kind===`video`&&SA(n.config)===`audio`?`Audio export`:j2[e.kind],tone:i===void 0?qMe(e):`waiting`,state:i===void 0?JMe(e):y7[i].state,...o===void 0?{}:{time:o},detail:i===void 0?XMe(wA(e,t,n,r),e,a):y7[i].detail}})}function QMe({stages:e}){return(0,h.jsx)(`div`,{className:`sr-only`,children:e.filter(e=>e.state!==`skipped`).map(e=>(0,h.jsx)(`span`,{role:`status`,"aria-live":`polite`,children:`${j2[e.kind]}: ${e.state}`},e.id))})}function $Me({steps:e}){return(0,h.jsxs)(`section`,{"aria-labelledby":`run-steps-title`,className:`flex flex-col gap-2`,children:[(0,h.jsx)(Sy,{id:`run-steps-title`,title:`Run`,size:`small`,className:`pb-0`}),(0,h.jsx)(u2,{steps:e,label:`Run steps`,dense:!0})]})}var b7=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function eNe({cost:e,onOpen:t}){if(e===void 0||e.calls===0&&e.byStage.length===0)return null;let n=e.plans.flatMap(e=>e.reported?e.windows.map(t=>({key:`${e.account}/${t.kind}`,name:e.name,window:t.kind===`five_hour`?`5-hour`:t.kind===`weekly`?`weekly`:`current`,used:t.usedPercent,now:t.nowPercent})):[]);return(0,h.jsxs)(`section`,{"aria-labelledby":`cost-so-far-title`,className:`flex flex-col gap-3`,children:[(0,h.jsx)(Sy,{id:`cost-so-far-title`,title:`Cost so far`,size:`small`,className:`pb-0`,children:t===void 0?null:(0,h.jsx)(B,{variant:`quiet`,size:`small`,onClick:t,children:`By stage`})}),(0,h.jsxs)(`p`,{className:`m-0 text-small text-ink-2`,children:[(0,h.jsx)(`strong`,{className:`text-ink`,children:I5(e.cost)}),e.unpriced>0?` known, spent`:` spent`,e.apiEquivalent===null?null:` · ~${I5(e.apiEquivalent)} via API`,e.run===null||e.run.running?null:` · ${L5(e.run.workingMs)} of work`]}),n.map(e=>{let t=e.used<1?`under 1%`:`${b7.format(e.used)}%`,n=`${e.window} ${e.name} limit`;return(0,h.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`${e.name}: ${t} of your ${e.window} limit`}),(0,h.jsx)($$,{value:e.used/100,label:`Share of the ${n} this run used`,valueText:`${t} of your ${n}; now at ${b7.format(e.now)}%`,tone:e.now>=80?`waiting`:`accent`})]},e.key)})]})}function tNe({projectId:e,revisionId:t,title:n,open:r,onClose:i}){let{api:a}=V(),o=_(),[s,c]=(0,m.useState)(null),[l,u]=(0,m.useState)(!1),[d,f]=(0,m.useState)(null),p=wv(),g=(0,m.useRef)(!1),v=(0,m.useRef)(null);(0,m.useEffect)(()=>{r&&t!==null&&(c({revisionId:t,name:n}),f(null)),r||c(null)},[r,t,n]);async function y(){if(!s||g.current||!s.name.trim())return;g.current=!0,u(!0),f(null);let t=JSON.stringify([e,s.revisionId,s.name.trim()]);v.current?.key!==t&&(v.current={key:t,id:crypto.randomUUID()});try{let t=await cue(a,e,{id:v.current.id,name:s.name.trim(),revisionId:s.revisionId});if(!t.ok){v.current=null,f(t.message);return}v.current=null,i(),p(`Template saved.`,`success`),await o.invalidateQueries({queryKey:yO})}catch(e){f(e instanceof Error?e.message:`The template wasn't saved. Press Save template to try again.`)}finally{g.current=!1,u(!1)}}return(0,h.jsx)(zv,{open:r&&s!==null,onOpenChange:e=>{!e&&!g.current&&i()},title:`Save as template`,description:`Save this revision’s setup for a fresh Play draft. This does not rebuild the project.`,children:(0,h.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,h.jsx)(_L,{label:`Template name`,tip:`play.template-name`,children:(0,h.jsx)(X,{autoFocus:!0,required:!0,maxLength:200,disabled:l,value:s?.name??``,onChange:e=>{let t=e.target.value;c(e=>e&&{...e,name:t})}})}),d?(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:d}):null,(0,h.jsxs)(`div`,{className:`sl-dialog__foot`,children:[(0,h.jsx)(B,{disabled:l,onClick:i,children:`Cancel`}),(0,h.jsx)(B,{variant:`primary`,type:`submit`,disabled:l||!s?.name.trim(),children:`Save template`})]})]})})}var x7=e=>e.state===`done`||e.state===`provided`;function nNe(e){let t=e.find(e=>e.state===`failed`)??e.find(e=>e.state===`running`);if(t)return t.kind;let n=e.find(e=>e.kind===`video`&&x7(e));if(n)return n.kind;let r=e.find(e=>e.state===`pending`);return r?r.kind:e.find(e=>e.kind===`article`&&x7(e))?.kind??e.find(e=>e.state!==`skipped`)?.kind??`article`}var rNe=new Intl.DateTimeFormat(void 0,{year:`numeric`,month:`short`,day:`numeric`}),S7=e=>rNe.format(new Date(e));function iNe({projectId:e,error:t,retry:n,retrying:r}){let{api:i}=V(),a=I({queryKey:oQ,queryFn:()=>sQ(i),retry:!1}).data?.find(t=>t.kind===`project`&&t.id===e),o=(0,h.jsx)(RO,{to:`/projects`,children:`Projects`});return a===void 0?(0,h.jsxs)(`div`,{children:[(0,h.jsx)(EG,{crumb:o,title:`Project not opened`}),(0,h.jsx)(hQ,{title:`The project could not be opened`,actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(LO,{to:`/projects`,variant:`primary`,children:`Open Projects`}),(0,h.jsx)(B,{disabled:r,disabledReason:`Trying again…`,onClick:n,children:`Try again`})]}),children:`${t.message} If it was deleted more than 30 days ago it is gone for good; otherwise press Try again, or pick it from Projects.`})]}):(0,h.jsxs)(`div`,{children:[(0,h.jsx)(EG,{crumb:o,title:a.name}),(0,h.jsx)(hQ,{title:`This project is in Trash`,actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(LO,{to:`/settings`,search:{section:`trash`},variant:`primary`,children:`Open Trash`}),(0,h.jsx)(LO,{to:`/projects`,variant:`secondary`,children:`Back to Projects`})]}),children:`It was deleted on ${S7(a.deletedAt)} and stays in Settings → Trash until ${S7(a.purgeAt)}. Restore it there to open it again.`})]})}function aNe({projectId:e,openDraft:t}){return(0,h.jsx)(lNe,{projectId:e,openDraft:t},e)}var oNe=[`outputs`,`article`,`narration`,`images`,`video`,`shorts`,`youtube`,`document`,`cost`,`live`,`settings`,`history`,`checkpoints`];function C7(e){return oNe.find(t=>t===e)}var sNe={outputs:`Outputs`,article:`Article`,narration:`Narration`,images:`Images`,video:`Video`,shorts:`Shorts`,youtube:`YouTube`,document:`PDF`,cost:`Cost`,live:`Live`,settings:`Settings`,history:`History`,checkpoints:`Checkpoints`};function cNe(e){switch(e){case`failed`:return`Failed`;case`running`:return`Running`;case`waiting`:return rR;case`done`:return`Done`;case`info`:return`Info`;case`off`:return`Not started`}}var w7=e=>{let t=e.filter(e=>e!==void 0);if(!(t.length===0||t.every(e=>e.state===`skipped`)))return t.some(e=>e.state===`failed`&&e.retryAt===void 0)?`failed`:t.some(e=>e.state===`running`)?`running`:t.some(e=>e.state===`failed`)?`waiting`:t.every(e=>e.state===`done`||e.state===`provided`||e.state===`skipped`)?`done`:`off`};function lNe({projectId:e,openDraft:t}){let{api:n}=V(),r=wv(),i=fNe(e,t),a=I(ay(n,e)),o=I(uy(n)),s=I({...oy(n,e),refetchInterval:e=>a.data?.project.status===`running`&&e.state.status===`success`&&2e4}),c=H2(e),l=Ji(),u=C7(Va({select:e=>e.search.section})),d=(0,m.useCallback)(t=>{l({to:`/projects/$projectId`,params:{projectId:e},search:{section:t},resetScroll:!1})},[l,e]),[f,p]=(0,m.useState)(!1),[g,_]=(0,m.useState)(!1),[v,y]=(0,m.useState)(!1),[b,x]=(0,m.useState)(!1),S=a.data?.revisionId??null,C=IMe(e,S,{onOpenEdit:()=>d(`settings`)}),w=Mde(e),T=(0,m.useRef)(void 0);(0,m.useEffect)(()=>{if(w===void 0){T.current=void 0;return}a.data!==void 0&&T.current!==w&&(T.current=w,w===`download`&&d(SA(a.data.project.config)===`article`?`article`:`video`))},[w,a.data,d]),x2(e,S);let E=I({queryKey:Hv,queryFn:()=>Xv(n)}),D=Zv(E.data,e),O=I({queryKey:p2(e,S??``),queryFn:()=>h2(n,e),enabled:S!==null,retry:!1}),k=O.data?.ok===!0?O.data.value.checkpoints:[],A=C.saved.data?.outputs.filter(e=>e.selected&&e.state===`outdated`).map(e=>({workKey:e.workKey,role:e.output.role}))??[],j=a.data?.project,M=a.data?.stages??[],N=a.data?.outputs??[],P=j!==void 0&&N.some(e=>e.role===`video`)&&ROe(j.config,N),ee=e=>d(e),F=Lke({project:j??uNe,stages:M,resumable:a.data?.resumable??!1,holding:a.data?.holding??[],sample:D,gates:k,outdated:A,waits:s.data?.waits??[],uploadReady:P,actions:c,controller:C,openSection:ee,openUpload:()=>p(!0)}),te=u===`settings`,ne=(0,m.useRef)(!1);(0,m.useEffect)(()=>{if(!te){ne.current=!1;return}C.edit!==void 0&&(ne.current=!0),!(ne.current||C.busy)&&(ne.current=!0,C.openEditor())},[te,C]);let re=M.some(e=>e.state===`running`),ie=j?.status===`running`,ae=j?.title??``;jv(ae===``?void 0:u===void 0?ae:`${ae} · ${sNe[u]}`);let oe=F.next?.action;Xy({id:`project.next`,title:oe?.label??`Show the project's next action`,group:`This project`,context:ae,keywords:[`next`,`continue`,`resume`,`approve`,`retry`],shortcut:ek.nextAction,run:()=>{oe===void 0?r(`This project has no next action right now: nothing waits on you.`,`info`):oe.intent.kind===`soften`?r(`Soften and retry asks first: press it in the Next action panel on the right.`):F.run(oe.intent)}}),NO(kO.showImages(e),()=>{let e=a.data?.stages.find(e=>e.kind===`images`);e===void 0||e.state===`skipped`?r(`${ae} makes no slideshow images, so there is no image to regenerate. To add them, open Settings in this project and choose how its images are made.`,`error`):d(`images`)},a.data!==void 0),Xy({id:`project.pause`,title:j?.status===`paused`?`Continue the run`:`Pause the run`,group:`This project`,context:ae,keywords:[`pause`,`resume`,`continue`,`stop`],run:()=>c.run({kind:j?.status===`paused`?`resume`:`pause`})}),Xy({id:`project.prepare-upload`,title:`Prepare upload`,group:`This project`,context:ae,keywords:[`youtube`,`studio`,`upload`,`publish`],run:()=>{P?p(!0):r(`Prepare upload opens once the video has been made.`,`info`)}}),Xy({id:`project.settings`,title:`Edit project settings`,group:`This project`,context:ae,keywords:[`edit`,`settings`,`prompts`,`providers`,`channel`],run:()=>d(`settings`)}),Xy({id:`project.rebuild-review`,title:`Choose what to remake`,group:`This project`,context:ae,keywords:[`rebuild`,`review`,`remake`,`outdated`,`affected`],run:()=>C.review({kind:`allAffected`})}),Xy({id:`project.template`,title:`Save as template`,group:`This project`,context:ae,keywords:[`template`,`reuse`],run:()=>_(!0)}),Xy({id:`project.cancel`,title:`Cancel the run`,group:`This project`,context:ae,keywords:[`cancel`,`stop`],run:()=>x(!0)});let se=xwe(A);if(Xy({id:`project.remake-1`,title:se[0]?.label??`Remake outdated outputs`,group:`This project`,context:ae,keywords:[`remake`,`outdated`,`rebuild`],run:()=>{let e=se[0];e===void 0?r(`Nothing is outdated in this project.`,`info`):C.review({kind:`selected`,workKeys:e.workKeys},{autoStart:!0})}}),Xy({id:`project.remake-all`,title:`Remake everything outdated`,group:`This project`,context:ae,keywords:[`remake`,`outdated`,`rebuild`,`all`],run:()=>{let e=[...new Set(se.flatMap(e=>e.workKeys))];e.length===0?r(`Nothing is outdated in this project.`,`info`):C.review({kind:`selected`,workKeys:e},{autoStart:!0})}}),Xy({id:`project.copy`,title:`Make my own copy`,group:`This project`,context:ae,keywords:[`sample`,`copy`,`duplicate`],run:()=>D?F.run({kind:`copy-sample`}):r(`Only the sample project is copied this way.`,`info`)}),a.error!==null&&a.data===void 0)return(0,h.jsx)(iNe,{projectId:e,error:a.error,retry:()=>void a.refetch(),retrying:a.isFetching});if(a.data===void 0||j===void 0)return(0,h.jsx)(dNe,{});let ce=e=>M.find(t=>t.kind===e),le=ce(`article`),ue=ce(`research`),de=ce(`audio`),fe=ce(`images`),pe=ce(`thumbnail`),me=ce(`video`),he=ce(`document`),ge=j.config,_e=e=>e!==void 0&&e.state!==`skipped`,ve=ge.shorts?.enabled===!0||N.some(e=>e.role===`short_video`||e.role===`shorts`),ye=ge.youtubeDescription===!0||N.some(e=>e.role===`youtube_description`),be=a.data.holding.filter(e=>e.waitsFor===`person`).length,xe=[{id:`outputs`,label:`Outputs`},..._e(le)||_e(ue)?[{id:`article`,label:`Article`,tone:w7([le,ue])}]:[],..._e(de)?[{id:`narration`,label:`Narration`,tone:w7([de])}]:[],..._e(fe)||_e(pe)||ge.reference!==void 0?[{id:`images`,label:`Images`,tone:w7([fe,pe])}]:[],..._e(me)?[{id:`video`,label:SA(ge)===`audio`?`Audio export`:`Video`,tone:w7([me])}]:[],..._e(he)?[{id:`document`,label:`PDF`,tone:w7([he])}]:[],{id:`cost`,label:`Cost`},{id:`live`,label:`Live`}].map(e=>{let t=se.filter(t=>t.section===e.id).reduce((e,t)=>e+t.count,0);return t===0?e:{...e,meta:`${String(t)} outdated`}}),Se=[{id:`settings`,label:`Settings`,...C.unsaved?{meta:`unsaved`}:{}},...S===null?[]:[{id:`checkpoints`,label:`Checkpoints`,...be===0?{}:{meta:`${String(be)} held`}}],{id:`history`,label:`History`}],Ce=[...xe,...Se],we=F.next?.situation,Te=F.next?.section!==void 0&&we!==`done`&&we!==`running`?F.next.section:we===`done`&&N.some(e=>e.role===`youtube_description`)?`youtube`:A2(nNe(M)),Ee=e=>e===`shorts`||e===`youtube`?`video`:e,De=u!==void 0&&Ce.some(e=>e.id===Ee(u))?Ee(u)??`video`:Ce.find(e=>e.id===Ee(Te))?.id??xe[0]?.id??`cost`,Oe=(...e)=>S===null?j.status===`running`||j.status===`paused`||re||c.pending:c.pending||e.some(e=>e?.state===`running`),ke={project:j,outputs:N,actions:c,next:F,resumable:a.data.resumable},Ae=(e,t)=>e===void 0?null:(0,h.jsx)(WAe,{stage:e,...t===void 0||t.state===`skipped`?{}:{companion:t},project:j,outputs:N,actions:c,busy:Oe(e,t)}),je=(...e)=>N.some(t=>e.some(e=>e!==void 0&&t.stageKind===e.kind)),Me=(...e)=>je(...e)||e.some(e=>e!==void 0&&[`running`,`done`,`provided`,`failed`,`canceled`].includes(e.state)),Ne=[{id:`rebuild`,label:`Choose what to remake…`,run:()=>C.review({kind:`allAffected`}),disabled:C.busy},{id:`template`,label:`Save as template…`,run:()=>_(!0),disabled:S===null||D},{id:`channel`,label:`Move to channel…`,run:()=>y(!0),disabled:D},{id:`copy-id`,label:`Copy project ID`,run:()=>void Hz(e).then(t=>r(t?`Copied the project ID ${e}.`:`The browser blocked copying. The project ID is ${e}.`,t?`success`:`info`))},{id:`cancel`,label:`Cancel the run…`,run:()=>x(!0),disabled:!ie||c.pending,apart:!0}],Pe=D8({kind:`cancel`}),Fe=c.refusal?.stage===void 0?c.refusal:void 0,Ie=Fe===void 0?c.notice===void 0?C.preview===void 0&&(C.error||C.refusal)&&De!==`settings`&&De!==`history`?(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:C.error??C.refusal?.message}):void 0:(0,h.jsx)(`p`,{role:`status`,className:`m-0 text-small text-ink-2`,children:c.notice}):(0,h.jsx)(GM,{tone:`danger`,title:Fe.message,children:(0,h.jsx)(B,{variant:`quiet`,size:`small`,className:`mt-1`,onClick:c.dismissRefusal,children:`Dismiss`})}),Le=ZMe({stages:M,outputs:N,project:j,resumable:a.data.resumable,holding:a.data.holding,now:Date.now()});return(0,h.jsx)(XDe,{projectId:e,revisionId:S,children:(0,h.jsx)(s8,{value:S!==null,children:(0,h.jsx)(O2,{value:e=>d(e===`edit`?`settings`:`article`),children:(0,h.jsx)(c8,{value:C.pending||C.preview!==void 0?void 0:C.requestEdit,children:(0,h.jsxs)(l8,{value:C.pending||C.preview!==void 0?void 0:C.regenerateNow,children:[(0,h.jsxs)(`div`,{className:`sl-project`,children:[(0,h.jsx)(`div`,{"data-tour":`project-controls`,children:(0,h.jsx)(rje,{project:j,progress:tde(M),prompts:o.data?.prompts,editing:De===`settings`,onEdit:()=>d(`settings`),more:Ne,nextChapter:i,clock:(0,h.jsx)(lje,{cost:s.data,status:j.status,measuredAt:s.dataUpdatedAt})})}),(0,h.jsx)(QMe,{stages:M}),(0,h.jsxs)(DG,{sections:(0,h.jsxs)(Q3,{label:`Project sections`,children:[xe.map(t=>(0,h.jsx)(E7,{projectId:e,item:t,selected:De},t.id)),(0,h.jsx)(`hr`,{className:`sl-rule my-2`}),Se.map(t=>(0,h.jsx)(E7,{projectId:e,item:t,selected:De},t.id))]}),aside:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(zke,{state:F,feedback:Ie}),j===void 0?null:(0,h.jsx)(nje,{projectId:e,title:j.title,status:j.status,sample:D||E.isPending}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-6 max-[1180px]:hidden`,children:[(0,h.jsx)($Me,{steps:Le}),(0,h.jsx)(eNe,{cost:s.data,onOpen:()=>ee(`cost`)}),(0,h.jsx)(zbe,{})]})]}),children:[(0,h.jsx)(I8,{id:`article`,title:`Article`,stages:[le,ue].filter(T7),active:De===`article`,...ke,children:_e(le)||_e(ue)?Ae(le,ue):(0,h.jsx)(L8,{stage:le,project:j,name:`Article`})}),(0,h.jsx)(I8,{id:`narration`,title:`Narration`,stages:[de].filter(T7),active:De===`narration`,...ke,children:Me(de)?Ae(de):(0,h.jsx)(L8,{stage:de,project:j,name:`Narration`})}),(0,h.jsx)(I8,{id:`images`,title:`Images`,head:!1,stages:[fe,pe].filter(T7),active:De===`images`,...ke,children:Ae(fe,pe)}),(0,h.jsxs)(I8,{id:`video`,title:SA(ge)===`audio`?`Audio export`:`Video`,stages:[me].filter(T7),active:De===`video`,...ke,...P&&F.next?.action?.intent.kind!==`prepare-upload`?{extra:(0,h.jsx)(B,{variant:`secondary`,onClick:()=>p(!0),children:`Prepare upload`})}:{},children:[Ae(me),me!==void 0&&ve?(0,h.jsx)(PAe,{stage:me,project:j,outputs:N}):null,me!==void 0&&ye?(0,h.jsx)(YAe,{stage:me,project:j,outputs:N}):null]}),he===void 0?null:(0,h.jsx)(I8,{id:`document`,title:`PDF`,stages:[he],active:De===`document`,...ke,children:Me(he)?Ae(he):(0,h.jsx)(L8,{stage:he,project:j,name:`PDF`})}),(0,h.jsx)(D7,{id:`outputs`,title:`Outputs`,selected:De,children:(0,h.jsx)(Dje,{projectId:e,revisionId:S,config:ge,stages:M,outputs:N,controller:C})}),(0,h.jsx)(D7,{id:`cost`,title:`Run cost`,selected:De,children:(0,h.jsx)(sje,{projectId:e})}),(0,h.jsx)(D7,{id:`live`,title:`Live`,selected:De,children:De===`live`?(0,h.jsx)(yje,{project:j,revisionId:S,stages:M,outputs:N}):null}),(0,h.jsx)(D7,{id:`settings`,title:`Settings`,selected:De,children:(0,h.jsx)(VMe,{controller:C,projectId:e,active:De===`settings`,renderEditor:e=>(0,h.jsx)(CMe,{...e,renderContent:e=>(0,h.jsx)(nMe,{...e},e.view.revision.id)})})}),S===null?null:(0,h.jsx)(D7,{id:`checkpoints`,title:`Checkpoints`,selected:De,children:(0,h.jsx)(QAe,{projectId:e,revisionId:S,paused:j.status===`paused`,stages:M,approvedInRail:F.next?.action?.intent.kind===`approve`?F.next.action.intent.gate.checkpointId:void 0})}),(0,h.jsx)(D7,{id:`history`,title:`History`,selected:De,children:(0,h.jsx)(GMe,{controller:C,projectId:e,active:De===`history`})})]})]}),(0,h.jsx)(KMe,{controller:C}),f?(0,h.jsx)(lV,{projectId:e,onClose:()=>p(!1)}):null,(0,h.jsx)(Cje,{projectId:e,title:j.title,open:v,onClose:()=>y(!1)}),(0,h.jsx)(tNe,{projectId:e,revisionId:S,title:j.title,open:g,onClose:()=>_(!1)}),(0,h.jsx)(Bv,{open:b,title:Pe.title,consequence:Pe.consequence,confirmLabel:Pe.verb,cancelLabel:Pe.dismiss,pending:c.pending,onConfirm:()=>{x(!1),c.run({kind:`cancel`})},onCancel:()=>x(!1)})]})})})})})}var T7=e=>e!==void 0;function E7({projectId:e,item:t,selected:n}){let r=t.tone===void 0?void 0:cNe(t.tone),i=t.tone===`failed`||t.tone===`running`||t.tone===`waiting`,a=[i?r:void 0,t.meta].filter(Boolean).join(` · `);return(0,h.jsxs)(KDe,{to:`/projects/${e}`,search:{section:t.id},resetScroll:!1,className:`max-md:w-auto`,"data-tour":`project-rail-${t.id}`,current:t.id===n,...t.tone===void 0?{}:{icon:(0,h.jsx)(GO,{tone:t.tone})},...a===``?{}:{meta:a},children:[t.label,r===void 0||i?null:(0,h.jsx)(`span`,{className:`sr-only`,children:`, ${r}`})]})}function D7({id:e,title:t,selected:n,children:r}){return(0,h.jsxs)(`section`,{hidden:n!==e,"aria-label":t,className:`flex min-w-0 flex-col gap-5`,children:[(0,h.jsx)(`h2`,{className:`sl-section-head__title m-0`,children:t}),r]})}var uNe={id:``,title:``,format:`16:9`,status:`pending`,createdAt:``,config:{sources:{}}};function dNe(){return(0,h.jsxs)(`div`,{role:`status`,"aria-label":`Loading project`,children:[(0,h.jsxs)(`div`,{className:`mb-6 flex flex-col gap-2`,children:[(0,h.jsx)(`span`,{className:`h-3 w-20 rounded-control bg-sunken`}),(0,h.jsx)(`span`,{className:`h-8 w-80 max-w-full rounded-control bg-sunken`})]}),(0,h.jsx)(DG,{sections:(0,h.jsx)(`div`,{className:`flex flex-col gap-2`,children:[`a`,`b`,`c`,`d`,`e`].map(e=>(0,h.jsx)(`span`,{className:`h-8 rounded-control bg-sunken`},e))}),aside:(0,h.jsx)(`span`,{className:`h-40 rounded-control bg-sunken`}),children:(0,h.jsx)(`span`,{className:`h-[480px] rounded-control bg-sunken`})})]})}function fNe(e,t){let{api:n}=V(),r=(0,m.useRef)(void 0),[i,a]=(0,m.useState)(!1),[o,s]=(0,m.useState)(void 0);if(t!==void 0)return{pending:i,error:o,run:()=>{i||(r.current??=crypto.randomUUID(),a(!0),s(void 0),lue(n,e,r.current).then(async e=>{if(!e.ok){s(e.message);return}await t(e.value.draft.id)?r.current=void 0:s(`The next chapter's draft was made, but Play could not open it because the draft open there is not saved yet. Open Play, let it save, then press Make the next chapter again.`)}).catch(e=>s(`The next chapter could not be made (${e instanceof Error?e.message:`the connection dropped`}). Press Make the next chapter again.`)).finally(()=>a(!1)))}}}function pNe(e){return e.filter(e=>e.disposition===`generate`||e.disposition===`local`||e.disposition===`review`)}function mNe(e,t){if(e===`running`)return`It is running now. Remake it once the run has finished.`;if(t)return`It is a sample project, which stays as it came with Slopify. Open it, press Make my own copy at the top of its page, then remake the copy.`}function hNe(e,t){if(pNe(e.work).length===0)return`Nothing in it is outdated, so there is nothing to remake.`;let n=e.work.find(e=>e.disposition===`blocked`);if(n!==void 0)return`${t(n.key)} can't run: ${n.reason.trim()||`no reason was given.`} Open the project and press Choose what to remake to see what to fix.`;if(e.providedReuseRequired.length>0)return`It uses content you supplied, which you confirm on the project itself: open it and press Choose what to remake.`}function gNe(e){return{low:e.reduce((e,t)=>e+t.low,0),high:e.reduce((e,t)=>e+t.high,0),unknown:e.reduce((e,t)=>e+t.unknown,0)}}function O7(e){return e instanceof Error?e.message:String(e)}async function _Ne(e,t,n,r){let i=mNe(t.status,n);if(i!==void 0)return{project:t,reason:i};try{let n=await TB(e,t.id);if(!n.ok)return{project:t,reason:`It couldn't be checked: ${n.message}`};let i=await NB(e,t.id,{baseRevisionId:n.value.view.revision.id,request:{kind:`allAffected`}});if(!i.ok)return{project:t,reason:`It couldn't be checked: ${i.message}`};let a=i.value.value,o=hNe(a,c7(a));return o===void 0?{project:t,preview:a,idempotencyKey:r()}:{project:t,reason:o}}catch(e){return{project:t,reason:`It couldn't be checked: ${O7(e)} Press Remake outdated again.`}}}async function vNe(e,t,n,r=()=>crypto.randomUUID()){let i=await Promise.all(t.map(t=>_Ne(e,t,n.has(t.id),r)));return{plans:i.filter(e=>`preview`in e),skipped:i.filter(e=>!(`preview`in e))}}function yNe({plans:e,skipped:t}){return e.length>0&&t.length===0&&e.every(e=>h7(e.preview))}async function bNe(e,t,n){let r=[],i=[];for(let a of t)try{let t=await PB(e,a.project.id,{baseRevisionId:a.preview.baseRevisionId,previewId:a.preview.id,idempotencyKey:a.idempotencyKey,acknowledgeUnknownCosts:n&&a.preview.costs.unknown>0,confirmedProvidedWorkKeys:[]});t.ok?r.push(a):i.push({plan:a,reason:t.reason===`stale-preview`||t.reason===`conflict`?`It changed since this review was opened. Close the review and press Remake outdated again.`:`${t.message}`})}catch(e){i.push({plan:a,reason:`${O7(e)} Press Try again.`})}return{started:r,failed:i}}function xNe(e){let t=c7(e),n=t=>e.work.filter(e=>e.disposition===t).map(e=>e.key),r=[...n(`generate`),...n(`review`)],i=n(`local`);return[r.length===0?void 0:`Made again: ${l7(r,t)}.`,i.length===0?void 0:`${r.length===0?`Rebuilt`:`Then rebuilt`} on this computer, free: ${l7(i,t)}.`].filter(e=>e!==void 0)}var SNe=(e,t)=>e===t?S2(e):`${S2(e)}–${S2(t)}`;function k7(e){let{low:t,high:n,unknown:r}=gNe(e),i=e.some(e=>e.rows.some(e=>e.onPlan===!0)),a=n===0?i?`$0 on your plan`:`No charge`:`About ${SNe(t,n)}`;return r===0?a:`${a}, plus ${String(r)} unknown ${r===1?`estimate`:`estimates`}`}var A7=e=>PG(e,`project`,`projects`);function CNe({chosen:e,samples:t,busy:n,onDone:r}){let{api:i}=V(),a=_(),o=wv(),[s,c]=(0,m.useState)(!1),[l,u]=(0,m.useState)(!1),[d,f]=(0,m.useState)(),[p,g]=(0,m.useState)([]),[v,y]=(0,m.useState)(new Set),[b,x]=(0,m.useState)(!1),S=e.filter(e=>e.status!==`running`&&!t.has(e.id)),C=()=>{l||(f(void 0),g([]),y(new Set),x(!1))},w=async(e,t)=>{u(!0);try{let n=await bNe(i,e,t);await Promise.all([a.invalidateQueries({queryKey:H.projects}),...n.started.map(e=>a.invalidateQueries({queryKey:H.project(e.project.id)}))]);let r=new Set([...v,...n.started.map(e=>e.project.id)]);return y(r),g(n.failed),n.started.length>0&&o(`Started the remake of ${A7(n.started.length)}. Each project's page shows its progress.`,`success`),n}finally{u(!1)}},T=async()=>{c(!0);try{let n=await vNe(i,e,t);if(yNe(n)&&(await w(n.plans,!1)).failed.length===0){r(),C();return}f(n)}finally{c(!1)}},E=d?.plans??[],D=new Set(p.map(e=>e.plan.project.id)),O=E.filter(e=>!v.has(e.project.id)),k=O.reduce((e,t)=>e+t.preview.costs.unknown,0),A=k>0&&!b,j=p.length>0,M=E.length>0&&O.length===0;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(B,{size:`small`,disabled:n||s||S.length===0,disabledReason:e.length===0?`Nothing is selected`:n||s?`Working on it`:`Running and sample projects can't be remade from here`,onClick:()=>void T(),children:s?`Checking ${A7(e.length)}…`:`Remake outdated`}),(0,h.jsx)(NM,{open:d!==void 0,title:`Remake outdated: ${A7(E.length+(d?.skipped.length??0))}`,onClose:()=>{M&&r(),C()},footer:(0,h.jsxs)(h.Fragment,{children:[M?(0,h.jsx)(B,{variant:`primary`,onClick:()=>{r(),C()},children:`Done`}):(0,h.jsx)(B,{variant:`primary`,disabled:l||O.length===0||A,disabledReason:O.length===0?`None of the selected projects can be remade from here (reasons above)`:A?`Tick the box about unknown estimates first`:`Starting…`,onClick:()=>void w(O,b),children:l?`Starting…`:j?`Try ${A7(O.length)} again`:`Remake ${A7(O.length)}`}),M?null:(0,h.jsx)(B,{disabled:l,onClick:C,children:`Keep things as they are`})]}),children:d===void 0?null:(0,h.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,h.jsxs)(`section`,{"aria-label":`What the remakes cost`,className:`flex flex-col gap-1`,children:[(0,h.jsx)(`p`,{className:`m-0 font-condensed text-title-2 tabular-nums`,children:O.length===0?`Nothing to start`:k7(O.map(e=>e.preview.costs))}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`${A7(E.length)} to remake${d.skipped.length===0?``:`, ${String(d.skipped.length)} left out`}. If a step fails, that project keeps its current version.`})]}),E.length===0?null:(0,h.jsxs)(`section`,{"aria-label":`Projects to remake`,className:`flex flex-col gap-2`,children:[(0,h.jsx)(Sy,{as:`h3`,size:`small`,title:`To remake`}),(0,h.jsx)(mR,{label:`Projects to remake`,children:E.map(e=>(0,h.jsx)(wNe,{plan:e,started:v.has(e.project.id),failure:D.has(e.project.id)?p.find(t=>t.plan.project.id===e.project.id)?.reason:void 0},e.project.id))})]}),d.skipped.length===0?null:(0,h.jsxs)(`section`,{"aria-label":`Left out`,className:`flex flex-col gap-2`,children:[(0,h.jsx)(Sy,{as:`h3`,size:`small`,title:`Left out`}),(0,h.jsx)(mR,{label:`Left out`,children:d.skipped.map(e=>(0,h.jsx)(hR,{title:(0,h.jsx)(fa,{to:`/projects/$projectId`,params:{projectId:e.project.id},children:e.project.title}),meta:e.reason},e.project.id))})]}),k===0?null:(0,h.jsxs)(`div`,{className:`flex items-start gap-1 text-small`,...xy,children:[(0,h.jsxs)(`label`,{className:`flex items-start gap-2 text-small`,children:[(0,h.jsx)(`input`,{type:`checkbox`,className:`mt-1`,disabled:l,checked:b,onChange:e=>x(e.target.checked)}),(0,h.jsx)(`span`,{children:`I understand that ${String(k)} cost ${k===1?`estimate is`:`estimates are`} unknown.`})]}),(0,h.jsx)(U,{id:`project.rebuild.unknown-costs`,className:`-my-1`})]}),p.length===0?null:(0,h.jsx)(WR,{tone:`error`,children:`${A7(p.length)} didn't start (reasons on ${p.length===1?`its row`:`their rows`}). Press Try again, or open the project.`})]})})]})}function wNe({plan:e,started:t,failure:n}){return(0,h.jsxs)(hR,{title:(0,h.jsx)(fa,{to:`/projects/$projectId`,params:{projectId:e.project.id},children:e.project.title}),meta:t?`Started`:k7([e.preview.costs]),children:[(0,h.jsx)(`ul`,{className:`m-0 flex flex-col gap-1 pl-5 text-small text-ink-2`,children:xNe(e.preview).map(e=>(0,h.jsx)(`li`,{children:e},e))}),n===void 0?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 mt-1 text-small text-danger`,children:`Didn't start: ${n}`})]})}var j7=e=>PG(e,`project`,`projects`);async function M7(e){await Promise.all([e.invalidateQueries({queryKey:H.projects}),e.invalidateQueries({queryKey:oQ})])}async function N7(e,t,n,r){try{let t=await lQ(e,r.map(e=>({kind:`project`,id:e.id})));if(t.failed.length>0){let e=t.failed[0];n(`${j7(t.failed.length)} couldn't be restored: ${e?.reason??``} Restore ${t.failed.length===1?`it`:`them`} in Settings → Backup & storage → Trash.`,`error`)}else n(`Restored ${j7(t.restored.length)}.`,`success`)}catch(e){n(`The projects weren't restored: ${e instanceof Error?e.message:String(e)} Restore them in Settings → Backup & storage → Trash.`,`error`)}finally{await M7(t)}}function TNe({selection:e,rows:t,scope:n,samples:r}){let{api:i}=V(),a=_(),o=wv(),s=qy(),[c,l]=(0,m.useState)(``),[u,d]=(0,m.useState)(!1),f=t.filter(t=>e.has(t.id)),p=f.filter(e=>e.status!==`running`),g=f.filter(o2),v=f.filter(e=>e.uploadedAt!==null),y=(e,t,n)=>{let r=e[0];r!==void 0&&o(`${j7(e.length)} ${e.length===1?`wasn't`:`weren't`} ${t}: "${r.project.title}": ${r.reason} ${n}`,`error`)},b=L({mutationFn:e=>T2(e,e=>Po(i,e.id)),onSuccess:({done:e,failed:t})=>{e.length>0&&o(`Moved ${j7(e.length)} to the trash.`,`success`,{label:`Undo`,run:()=>void N7(i,a,o,e)}),y(t,`deleted`,`Cancel a running project first, then press Delete again.`)},onSettled:async()=>{d(!1),e.clear(),await M7(a)}}),x=D2({noun:[`project`,`projects`],onSettled:e.clear}),S=L({mutationFn:async e=>No(i,e.list.map(e=>e.id),e.to),onSuccess:(e,t)=>{let n=s.channels.find(e=>e.id===t.to)?.name??`the channel`,r=new Map;for(let e of t.list){let n=e.channelId??s.channels[0]?.id;n!==void 0&&n!==t.to&&r.set(n,[...r.get(n)??[],e])}o(`Moved ${j7(e.moved)} to ${n}.`,`success`,r.size===0?void 0:{label:`Undo`,run:()=>{for(let[e,t]of r)S.mutate({list:t,to:e})}}),l(``)},onError:e=>o(`The projects weren't moved: ${e.message} Pick the channel again and press Move.`,`error`),onSettled:async()=>{e.clear(),await a.invalidateQueries({queryKey:H.projects})}}),C=b.isPending||x.isPending||S.isPending,w=e.count===0,T=e=>w?`Nothing is selected`:C?`Working on it`:e,E=f.length-p.length,D=s.channels.find(e=>e.id===c)?.name??``;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(NG,{selection:e,total:t.length,noun:[`project`,`projects`],...n===void 0?{}:{scope:n},actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(B,{size:`small`,disabled:C||g.length===0,disabledReason:T(`None of the selected projects is ready to upload`),onClick:()=>x.mutate({list:g,on:!0}),children:`Mark uploaded`}),v.length===0?null:(0,h.jsx)(B,{size:`small`,variant:`quiet`,disabled:C,disabledReason:`Working on it`,onClick:()=>x.mutate({list:v,on:!1}),children:`Mark not uploaded`}),s.channels.length<2?null:(0,h.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(bL,{"aria-label":`Channel to move the selected projects to`,className:`w-[180px]`,value:c,onChange:e=>l(e.currentTarget.value),options:[{value:``,label:`Move to channel…`},...s.channels.map(e=>({value:e.id,label:e.name}))]}),(0,h.jsx)(B,{size:`small`,disabled:C||w||c===``,disabledReason:T(`Pick the channel to move them to`),onClick:()=>S.mutate({list:f,to:c}),children:D===``?`Move`:`Move to ${D}`})]}),(0,h.jsx)(CNe,{chosen:f,samples:r,busy:C,onDone:e.clear}),(0,h.jsx)(B,{size:`small`,variant:`destructive`,disabled:C||p.length===0,disabledReason:T(`Running projects can't be deleted. Cancel the run first.`),onClick:()=>d(!0),children:`Delete`})]})}),(0,h.jsx)(Bv,{open:u,title:`Delete ${j7(p.length)}?`,consequence:`Moves ${p.length===1?`"${p[0]?.title??``}"`:`these ${String(p.length)} projects`} to the trash for 30 days. Undo brings them back, or restore them later in Settings → Backup & storage → Trash.${E===0?``:` ${j7(E)} still running ${E===1?`stays`:`stay`}: cancel the run first.`}`,confirmLabel:`Delete ${j7(p.length)}`,cancelLabel:`Keep them`,pending:b.isPending,onConfirm:()=>b.mutate(p),onCancel:()=>d(!1)})]})}var ENe=[`all`,`running`,`queued`,`waiting`,`ready`,`failed`];function DNe(e){return ENe.find(t=>t===e)}var P7=[{value:`all`,label:`All`},{value:`running`,label:`Running`},{value:`queued`,label:`Queued`},{value:`waiting`,label:`Needs you`},{value:`ready`,label:`Ready to upload`},{value:`failed`,label:`Failed`}];function F7(e,t){switch(t){case`all`:return!0;case`running`:return _A(e);case`queued`:return vA(e);case`waiting`:return yA(e);case`ready`:return o2(e);case`failed`:return bA(e)||e.status===`partial`}}var ONe=[`newest`,`changed`,`name`,`status`];function kNe(e){return ONe.find(t=>t===e)}var I7=[{value:`newest`,label:`Newest first`},{value:`changed`,label:`Recently changed`},{value:`name`,label:`Name (A–Z)`},{value:`status`,label:`Status`}],ANe={running:1,paused:2,pending:3,failed:4,partial:5,done:6,canceled:7};function L7(e){return yA(e)?0:ANe[e.status]}var R7=(e,t)=>t.createdAt.localeCompare(e.createdAt);function jNe(e,t){let n={newest:R7,changed:(e,t)=>t.updatedAt.localeCompare(e.updatedAt)||R7(e,t),name:(e,t)=>e.title.localeCompare(t.title,void 0,{sensitivity:`base`,numeric:!0})||R7(e,t),status:(e,t)=>L7(e)-L7(t)||R7(e,t)};return[...e].sort(n[t])}function MNe(e){let t=e.status===`running`?aR(e.limitWaits):void 0;return t===void 0?nR(e):{tone:`waiting`,word:t}}function NNe(e){let t=e.config.articlePrompt,n=e.config.voices?.book;return[n===void 0?void 0:IE(n),t===void 0||t===``?void 0:t,e.format].filter(e=>e!==void 0).join(` · `)}var PNe=864e5;function FNe(e,t=Date.now()){return e.uploadedAt!==null&&t-new Date(e.uploadedAt).getTime()<PNe}function INe({project:e,sample:t,check:n,onDelete:r,onUploaded:i,busy:a}){let o=MNe(e),s=e.status===`running`,c=`${NNe(e)} · started ${vd(e.createdAt)}`;return(0,h.jsx)(hR,{lead:n,title:(0,h.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,h.jsx)(fa,{to:`/projects/$projectId`,params:{projectId:e.id},title:e.title,className:`min-w-0 truncate`,children:e.title}),t?(0,h.jsx)(qO,{children:`Sample`}):null]}),meta:(0,h.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`span`,{className:`truncate`,title:c,children:c}),s?(0,h.jsx)($$,{progress:!0,value:e.progress,label:`${e.title} progress`,valueText:`${String(Math.round(e.progress*100))}% done`,className:`max-w-[240px]`}):null]}),actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(KO,{tone:o.tone,children:[o.word,(0,h.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:`${e.title}: ${o.word}`})]}),o2(e)?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(B,{variant:`quiet`,size:`small`,disabled:a,disabledReason:`Saving…`,onClick:()=>i(!0),children:`Mark uploaded`}),(0,h.jsx)(U,{id:`project.mark-uploaded`})]}):e.uploadedAt===null?null:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(qO,{children:`Uploaded`}),FNe(e)?(0,h.jsx)(B,{variant:`quiet`,size:`small`,"aria-label":`Undo upload mark: ${e.title}`,title:`Puts it back on Ready to upload. Offered for a day after marking.`,disabled:a,disabledReason:`Saving…`,onClick:()=>i(!1),children:`Undo upload mark`}):null]}),(0,h.jsx)(bv,{label:`Delete ${e.title}`,size:`small`,disabled:s,focusableWhenDisabled:!0,disabledReason:`Cancel the run first, then delete it.`,onClick:r,children:(0,h.jsx)(xl,{"aria-hidden":`true`,strokeWidth:1.75})})]})})}function LNe(){return(0,h.jsx)(`ul`,{"aria-label":`Loading projects`,className:`sl-list m-0 list-none p-0`,children:[0,1,2,3,4,5].map(e=>(0,h.jsxs)(`li`,{className:`sl-row`,"data-slot":`skeleton-row`,children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,h.jsx)(`span`,{className:`h-3 w-2/5 rounded-control bg-sunken`}),(0,h.jsx)(`span`,{className:`h-[10px] w-1/4 rounded-control bg-sunken`})]}),(0,h.jsx)(`span`,{className:`h-[10px] w-16 rounded-control bg-sunken`})]},e))})}function RNe({initialFilter:e=`all`,filter:t,query:n,sort:r,onFilter:i,onQuery:a,onSort:o}={}){let{api:s}=V(),c=_(),l=wv(),u=qy(),d=I(iy(s)),[f,p]=(0,m.useState)(void 0),[g,v]=(0,m.useState)(e),y=t??g,b=e=>{v(e),i?.(e)},x=I({queryKey:Vv,queryFn:()=>Gv(s)}),S=new Set(Object.values(x.data?.samples??{}).filter(e=>e!==null)),[C,w]=(0,m.useState)(n??``),T=(0,m.useRef)(void 0);(0,m.useEffect)(()=>()=>clearTimeout(T.current),[]);let E=e=>{w(e),a!==void 0&&(clearTimeout(T.current),T.current=setTimeout(()=>a(e),300))},[D,O]=(0,m.useState)(`newest`),k=r??D,A=e=>{O(e),o?.(e)},[j,M]=(0,m.useState)(50),N=(0,m.useRef)(null),P=Zy(N,`projects`),ee=L({mutationFn:e=>Po(s,e.id),onSuccess:(e,t)=>l(`Moved "${t.title}" to the trash.`,`success`,{label:`Undo`,run:()=>void N7(s,c,l,[t])}),onSettled:async()=>{p(void 0),await c.invalidateQueries({queryKey:H.projects})}}),F=L({mutationFn:e=>n2(s,e.project.id,e.uploaded),onSuccess:(e,t)=>l(t.uploaded?`Marked uploaded: ${t.project.title}.`:`${t.project.title} is back on Ready to upload.`,`success`,t.uploaded?{label:`Undo`,run:()=>F.mutate({...t,uploaded:!1})}:void 0),onError:(e,t)=>l(`${t.project.title} wasn't changed: ${e.message} Press the button again.`,`error`),onSettled:async()=>{await c.invalidateQueries({queryKey:H.projects})}});Xy({id:`projects.show.waiting`,title:`Show projects that need you`,group:`Projects`,keywords:[`waiting`,`filter`],run:()=>b(`waiting`)}),Xy({id:`projects.show.ready`,title:`Show videos ready to upload`,group:`Projects`,keywords:[`upload`,`finished`,`filter`],run:()=>b(`ready`)}),Xy({id:`projects.show.failed`,title:`Show failed projects`,group:`Projects`,keywords:[`error`,`filter`],run:()=>b(`failed`)});let te=(d.data?.projects??[]).filter(e=>u.includes(e.channelId)),ne=C.trim().toLowerCase(),re=jNe(te.filter(e=>F7(e,y)&&(ne===``||e.title.toLowerCase().includes(ne))),k);(0,m.useEffect)(()=>M(50),[y,ne,k]);let ie=re.slice(0,j),ae=ie.map(e=>e.id).join(`
|
|
323
323
|
`),oe=AG((0,m.useMemo)(()=>ae===``?[]:ae.split(`
|
|
324
|
-
`),[ae]));return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(EG,{title:`Projects`,meta:d.data===void 0?void 0:`${String(te.length)} ${te.length===1?`project`:`projects`} · ${u.channel?.name??`every channel`}`,actions:(0,h.jsxs)(LO,{to:`/play`,variant:`primary`,children:[(0,h.jsx)(pl,{"aria-hidden":`true`,strokeWidth:1.75}),`Create`]})}),d.data?.projects.length===0?(0,h.jsx)(bve,{}):null,d.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 mb-4 text-danger`,children:d.error.message}),d.data===void 0?d.error===null?(0,h.jsx)(LNe,{}):null:d.data.projects.length===0?(0,h.jsx)(hQ,{title:`No projects yet`,actions:(0,h.jsx)(LO,{to:`/play`,variant:`primary`,children:`Make your first video`}),children:`Set up a run on Play: pick a template, type a topic and start.`}):(0,h.jsxs)(Q0,{split:`aside`,children:[(0,h.jsxs)($0,{label:`Project list`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,h.jsxs)(`div`,{className:`relative w-full max-w-[320px]`,children:[(0,h.jsx)(_l,{"aria-hidden":`true`,strokeWidth:1.75,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-ink-3`}),(0,h.jsx)(`input`,{type:`search`,ref:N,"aria-label":`Search projects`,"aria-keyshortcuts":cb(P),placeholder:`Search projects`,value:C,onChange:e=>E(e.target.value),className:`sl-input pl-9`})]}),(0,h.jsx)(wy,{label:`Show`,value:y,options:P7,onChange:b,className:`max-w-full overflow-x-auto`}),(0,h.jsx)(bL,{"aria-label":`Sort projects`,className:`w-auto`,value:k,onChange:e=>{let t=I7.find(t=>t.value===e.currentTarget.value);t!==void 0&&A(t.value)},options:I7})]}),ie.length===0?(0,h.jsx)(`p`,{className:`m-0 text-ink-2`,children:te.length===0?`No projects in ${u.channel?.name??`this channel`} yet. Pick All channels in the rail to see the others.`:`No project matches. Clear the search or pick All.`}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`div`,{onKeyDown:oe.onKeyDown,className:`flex flex-col gap-4`,children:[(0,h.jsx)(TNe,{selection:oe,rows:ie,samples:S,...ie.length<te.length?{scope:`Select all ${String(ie.length)} shown`}:{}}),(u.channel===void 0&&u.channels.length>1?u.channels.map(e=>({channel:e,projects:ie.filter(t=>(t.channelId??u.channels[0]?.id)===e.id)})).filter(e=>e.projects.length>0):[{channel:void 0,projects:ie}]).map(e=>(0,h.jsxs)(`section`,{"aria-label":e.channel?.name??`Projects`,className:`flex flex-col gap-2`,children:[e.channel===void 0?null:(0,h.jsx)(Sy,{as:`h3`,size:`small`,title:e.channel.name,meta:`${String(e.projects.length)} ${e.projects.length===1?`project`:`projects`}`}),(0,h.jsx)(mR,{label:e.channel?.name??`Projects`,children:e.projects.map(e=>(0,h.jsx)(INe,{project:e,sample:S.has(e.id),check:(0,h.jsx)(MG,{selection:oe,value:e.id,label:e.title}),onDelete:()=>p(e),onUploaded:t=>F.mutate({project:e,uploaded:t}),busy:F.isPending},e.id))})]},e.channel?.id??`all`))]}),re.length>ie.length?(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(B,{size:`small`,onClick:()=>M(e=>e+50),children:`Show ${String(Math.min(50,re.length-ie.length))} more`}),(0,h.jsx)(`span`,{className:`text-small text-ink-2 tabular-nums`,children:`${String(ie.length)} of ${String(re.length)} shown`})]}):null]})]}),(0,h.jsxs)($0,{as:`aside`,label:`Projects at a glance`,children:[(0,h.jsxs)(`section`,{children:[(0,h.jsx)(Sy,{title:`At a glance`}),(0,h.jsx)(Z$,{children:P7.filter(e=>e.value!==`all`).map(e=>(0,h.jsx)(Q$,{label:e.label,value:String(te.filter(t=>F7(t,e.value)).length)},e.value))})]}),(0,h.jsxs)(`section`,{"aria-label":`Video queue`,className:`flex flex-col gap-2`,children:[(0,h.jsx)(Sy,{title:`Video queue`,info:`play.queue`}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Videos started together, in the order they run, are on the calendar.`}),(0,h.jsx)(`div`,{children:(0,h.jsx)(RO,{to:`/calendar`,children:`Open calendar`})})]})]})]}),ee.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`mt-3 text-small text-danger`,children:ee.error.message}),(0,h.jsx)(Bv,{open:f!==void 0,title:f===void 0?``:`Delete "${f.title}"?`,consequence:`Moves the project to the trash for 30 days. Undo brings it back, or restore it later in Settings → Backup & storage → Trash.`,confirmLabel:`Delete project`,cancelLabel:`Keep it`,pending:ee.isPending,onConfirm:()=>{f!==void 0&&ee.mutate(f)},onCancel:()=>p(void 0)})]})}var zNe=`Prepare restrained delivery cues for a documentary narrator. Let the facts carry the scene. Use a measured pace and make only occasional changes where the supplied wording clearly calls for emphasis, reflection or tension. Prefer no cue to an unnecessary cue. Avoid theatrical emotion, invented reactions and routine laughter or sighs. Never rewrite, summarize, translate or add spoken words. Return only the cue annotations required by the supplied format contract.`;function z7({promptId:e,kind:t,from:n,onLeave:r}){let{api:i}=V(),a=_(),o=nj(),s=I(uy(i)),c=(0,m.useId)(),l=(0,m.useId)(),u=(0,m.useId)(),[d,f]=Tj(JSON.stringify(e===void 0?[`new`,t,n??null]:[`prompt`,e])),[p,g]=(0,m.useState)([]),[v,y]=(0,m.useState)(void 0),b=v!==void 0,[x,S]=(0,m.useState)(!1),[C,w]=(0,m.useState)(!1),T=s.data?.prompts,E=e??n,D=E===void 0?void 0:T?.find(e=>e.id===E),O=D===void 0?{kind:t,name:``,body:``}:e===void 0?{kind:D.kind,name:`${D.name} copy`,body:D.body}:{kind:D.kind,name:D.name,body:D.body},k=d??v??O,A=L({mutationFn:t=>Rs(i,t,e),onSuccess:async(e,t)=>{if(!e.ok){g(e.fields);return}y(e.value),f(e=>e===t?void 0:e),o({type:`prompt-saved`,id:e.value.id,kind:e.value.kind}),await a.invalidateQueries({queryKey:uy(i).queryKey})}}),j=L({mutationFn:e=>Bs(i,e),onSuccess:async()=>{S(!1),f(void 0),await a.invalidateQueries({queryKey:uy(i).queryKey}),r(k.kind)}}),M=L({mutationFn:({id:e,on:t})=>zs(i,e,t),onSettled:async()=>{await a.invalidateQueries({queryKey:uy(i).queryKey})}});n1(b,()=>{r(k.kind)});let N=(e,t)=>{f(e),g(e=>e.filter(e=>e.field!==t))},P=U0(k,p),ee=W0(P),F=q0(k.body),te=k.body.trim()===``?[]:G0(P),ne=k.name.trim()===``?[]:K0(P);return tj({promptNamed:k.name.trim()!==``&&ne.length===0,promptBodyReady:k.body.trim()!==``&&te.length===0,promptHasKeywords:F.length>0&&te.length===0,promptSaveReady:ee===void 0&&!A.isPending&&!b,promptSaving:A.isPending||b,promptIsArticle:k.kind===`article`,promptIsImage:k.kind===`image`}),s.error===null?E!==void 0&&T===void 0?(0,h.jsx)(a1,{}):E!==void 0&&D===void 0?(0,h.jsx)(V7,{kind:t,children:`That prompt is gone. It may have been deleted in another tab.`}):(0,h.jsxs)(`div`,{children:[(0,h.jsx)(EG,{crumb:(0,h.jsx)(w1,{children:(0,h.jsx)(fa,{to:`/prompts`,search:{kind:k.kind},children:`Prompts`})}),title:e===void 0?`New prompt`:`Edit prompt`,meta:`${Hb(k.kind)} prompt`}),(0,h.jsxs)(`div`,{"data-tour":`prompt-editor`,className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 lg:grid-cols-[minmax(0,1fr)_360px]`,children:[(0,h.jsxs)(`div`,{className:`${S1} flex min-w-0 flex-col gap-4`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-end gap-4`,children:[(0,h.jsx)(`div`,{"data-tour":`prompt-name`,className:`min-w-[min(100%,240px)] flex-1`,children:(0,h.jsx)(_L,{label:`Name`,tip:`library.prompt.name`,...ne.length===0?{}:{error:ne.map(e=>e.message).join(` `)},children:(0,h.jsx)(X,{value:k.name,onChange:e=>{N({...k,name:e.target.value},`name`)}})})}),(0,h.jsx)(B0,{label:`Kind`,value:k.kind,options:Vb,tip:`library.prompt.kind`,onPick:e=>{N({...k,kind:e},`name`)}})]}),(0,h.jsxs)(`div`,{"data-tour":`prompt-body`,...xy,children:[(0,h.jsxs)(`div`,{className:`mb-1 flex min-h-8 items-end justify-between gap-3`,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(`label`,{htmlFor:c,className:`sl-field__label`,children:`Body`}),(0,h.jsx)(U,{id:BNe[k.kind],label:`${Hb(k.kind)} prompt body`,className:`-my-1`})]}),B7(k.kind)?(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(B,{variant:`quiet`,size:`small`,onClick:()=>{let e=B7(k.kind);e!==void 0&&(k.body.trim()===``?N({...k,body:e.body},`body`):w(!0))},children:B7(k.kind)?.label}),(0,h.jsx)(U,{id:`library.prompt.starter`,label:B7(k.kind)?.label})]}):null]}),(0,h.jsx)(Y0,{id:c,value:k.body,invalid:te.length>0,describedBy:te.length===0?void 0:l,onChange:e=>{N({...k,body:e},`body`)}})]}),k.kind===`image`?(0,h.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e!==void 0&&D?.kind===`image`?(0,h.jsx)(Cy,{checked:M.isPending?M.variables.on:D.photorealistic===!0,disabled:M.isPending,onChange:t=>M.mutate({id:e,on:t}),label:`Draws photorealistic pictures`,tip:`library.prompt.photorealistic`}):(0,h.jsxs)(`span`,{className:`flex items-center gap-1 text-small text-ink-2`,children:[`Save this Image prompt first, then choose whether it draws photorealistic pictures.`,(0,h.jsx)(U,{id:`library.prompt.photorealistic`})]}),M.error===null?null:(0,h.jsx)(`span`,{role:`alert`,className:`text-small text-danger`,children:`Couldn't change Draws photorealistic pictures: ${M.error.message} Press the switch again.`})]}):null,(0,h.jsx)(`div`,{"data-tour":`prompt-save`,children:(0,h.jsx)(i1,{onDelete:e===void 0?void 0:()=>{S(!0)},blocked:ee,blockedId:u,pending:A.isPending,saved:b,cancel:(0,h.jsx)(LO,{to:`/prompts`,search:{kind:k.kind},onClick:()=>{f(void 0)},variant:`secondary`,children:`Cancel`}),errors:[A.error,j.error].flatMap(e=>e===null?[]:[e.message]),onSave:()=>{A.mutate(k)}})})]}),(0,h.jsx)(`div`,{"data-tour":`prompt-slots`,className:C1,children:(0,h.jsx)(F0,{slots:F,body:k.body,lint:te,lintId:l})})]}),(0,h.jsx)(Bv,{open:C,title:`Replace this prompt body?`,consequence:`The starter replaces the text in this editor. Nothing is saved until you choose Save.`,confirmLabel:`Use starter`,tone:`primary`,onConfirm:()=>{let e=B7(k.kind);e!==void 0&&N({...k,body:e.body},`body`),w(!1)},onCancel:()=>w(!1)}),(0,h.jsx)(Bv,{open:x,title:`Delete "${k.name}"?`,consequence:`Moves it to the trash for 30 days (Settings → Trash). Projects that used it keep their text.`,confirmLabel:`Delete prompt`,pending:j.isPending,onConfirm:()=>{e!==void 0&&j.mutate(e)},onCancel:()=>{S(!1)}})]}):(0,h.jsx)(V7,{kind:k.kind,children:s.error.message})}var BNe={article:`library.prompt.body.article`,image:`library.prompt.body.image`,thumbnail:`library.prompt.body.thumbnail`,narration:`library.prompt.body.narration`,description:`library.prompt.body.description`,shorts:`library.prompt.body.shorts`,review:`library.prompt.body.review`,script:`library.prompt.body.script`};function B7(e){if(e===`narration`)return{label:`Use Documentary Starter`,body:zNe};if(e===`description`)return{label:`Use Built-in Starter`,body:LR};if(e===`shorts`)return{label:`Use Built-in Starter`,body:ile}}function V7({kind:e,children:t}){return(0,h.jsx)(T1,{back:(0,h.jsx)(fa,{to:`/prompts`,search:{kind:e},children:`Back to Prompts`}),children:t})}function VNe({kind:e,onKind:t,onUseInPlay:n,playBlocked:r}){let{api:i}=V(),a=_(),o=I(uy(i)),[s,c]=(0,m.useState)(``),l=(0,m.useRef)(null),u=Zy(l,`prompts`),[d,f]=pL(),[p,g]=Y1(`prompt`),[v,y]=(0,m.useState)(void 0),[b,x]=(0,m.useState)(void 0),S=L({mutationFn:e=>Bs(i,e),onSettled:async()=>{y(void 0),await a.invalidateQueries({queryKey:H.prompts})}}),C=async(e,t)=>{let n=await Rs(i,{kind:e.kind,name:t,body:e.body},e.id);return await a.invalidateQueries({queryKey:H.prompts}),n.ok?null:N0(n.fields)},w=o.data?.prompts.filter(t=>t.kind===e),T=s.trim().toLowerCase(),E=T===``?w:w?.filter(e=>e.name.toLowerCase().includes(T)||e.body.toLowerCase().includes(T)),D=E===void 0?void 0:q1(E,p),O=D?.find(e=>e.id===d)??D?.[0],k=o.data?.prompts??[],A=AG(D?.map(e=>e.id)??[]),j=D?.filter(e=>A.has(e.id))??[],M=C0({noun:[`prompt`,`prompts`],listKey:H.prompts,all:k,groupOf:e=>e.kind,nameMax:200,duplicate:async(e,t)=>w0(await Rs(i,{kind:e.kind,name:t,body:e.body},void 0)),remove:e=>Bs(i,e.id),trash:`prompt`,selection:A}),N=A0({section:`prompts`,pack:e=>({prompts:e}),stem:`prompts`,noun:[`prompt`,`prompts`],listKey:H.prompts,existing:k,groupOf:e=>e.kind,nameMax:200,save:e=>Rs(i,e,void 0)});return(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(j0,{action:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(f0,{what:`prompts`,disabled:o.data===void 0||N.importing,exports:[{label:`Export all ${l0(k.length,`prompt`)}`,run:()=>N.exportItems(k),disabled:k.length===0}],accept:`.json,application/json`,onFile:N.importFile}),(0,h.jsx)(UNe,{kind:e})]}),children:[(0,h.jsx)(X,{type:`search`,ref:l,"aria-label":`Search prompts`,"aria-keyshortcuts":cb(u),placeholder:`Search prompts`,value:s,className:`w-full min-w-0 sm:w-64`,onChange:e=>c(e.target.value)}),(0,h.jsxs)(`span`,{className:`flex w-full items-center gap-1 sm:w-auto`,...xy,children:[(0,h.jsx)(bL,{"aria-label":`Prompt kind`,value:e,className:`w-full sm:w-56`,options:Vb,onChange:e=>{let n=Vb.find(t=>t.value===e.target.value);n!==void 0&&t(n.value)}}),(0,h.jsx)(U,{id:`library.prompt.kind`})]}),(0,h.jsx)(X1,{what:`prompts`,sort:p,onSort:g})]}),o.error===null?null:(0,h.jsx)(W1,{what:`prompts`,message:o.error.message,onRetry:()=>void o.refetch()}),D===void 0||w===void 0?o.error===null?(0,h.jsx)(U1,{label:`Prompts`}):null:w.length===0?(0,h.jsxs)(hQ,{title:`No ${Hb(e).toLowerCase()} prompts yet`,children:[`A prompt is text with `,`{{keywords}}`,`; each keyword becomes a field on Play.`]}):(0,h.jsx)(OG,{className:V1,list:D.length===0?(0,h.jsx)(`p`,{className:`m-0 py-3 text-small text-ink-2`,children:`No ${Hb(e).toLowerCase()} prompts match "${s.trim()}".`}):(0,h.jsxs)(P1,{selection:A,children:[(0,h.jsx)(N1,{selection:A,total:D.length,noun:[`prompt`,`prompts`],scope:T===``?void 0:`Select all ${String(D.length)} shown`,busy:M.busy,onDuplicate:()=>M.duplicate(j),onExport:()=>N.exportItems(j),onDelete:()=>M.remove(j)}),(0,h.jsx)(mR,{label:`Prompts`,children:D.map(e=>(0,h.jsx)(hR,{className:H1,lead:(0,h.jsx)(MG,{selection:A,value:e.id,label:e.name}),title:(0,h.jsx)(P0,{name:e.name,onSelect:()=>f(e.id),onRename:t=>C(e,t)}),meta:HNe(e),selected:e.id===O?.id,actions:(0,h.jsx)(G1,{name:e.name,edit:(0,h.jsx)(LO,{to:`/prompts/$promptId`,params:{promptId:e.id},"aria-label":`Edit ${e.name}`,variant:`quiet`,size:`small`,children:`Edit`}),duplicate:(0,h.jsx)(LO,{to:`/prompts/new`,search:{kind:e.kind,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:()=>x(e),onDelete:()=>y(e)})},e.id))})]}),detail:O===void 0?null:(0,h.jsx)(c0,{item:`prompt`,id:O.id,name:O.name,kicker:`${Hb(O.kind)} prompt`,meta:(0,h.jsxs)(h.Fragment,{children:[`Updated `,(0,h.jsx)(d0,{iso:O.updatedAt})]}),body:O.body,slots:O.slots,actions:(0,h.jsx)(LO,{to:`/prompts/$promptId`,params:{promptId:O.id},size:`small`,children:`Edit prompt`}),onOpenHistory:()=>x(O)},O.id)}),S.error===null?null:(0,h.jsx)(GM,{tone:`danger`,title:`The prompt wasn't deleted.`,className:`mt-4`,children:S.error.message}),b===void 0?null:(0,h.jsx)(i0,{item:`prompt`,id:b.id,name:b.name,onClose:()=>x(void 0)},b.id),(0,h.jsx)(Bv,{open:v!==void 0,title:v===void 0?``:`Delete "${v.name}"?`,consequence:`Moves it to the trash for 30 days (Settings → Trash). Projects that used it keep their text.`,confirmLabel:`Delete prompt`,pending:S.isPending,onConfirm:()=>{v!==void 0&&S.mutate(v.id)},onCancel:()=>y(void 0)})]})}function HNe(e){return(0,h.jsxs)(h.Fragment,{children:[`${Hb(e.kind)} · ${l0(e.slots.length,`keyword`)} · updated `,(0,h.jsx)(d0,{iso:e.updatedAt})]})}function UNe({kind:e}){return(0,h.jsx)(LO,{to:`/prompts/new`,search:{kind:e},variant:`primary`,children:`New prompt`})}var WNe=`/mcp`;function GNe(e){return`${e.replace(/\/+$/,``)}${WNe}`}function KNe(e){return`claude mcp add --transport http slopify ${e}`}function qNe(e){return`[mcp_servers.slopify]\nurl = "${e}"`}J({projectIds:q(G()).optional(),projectId:G().optional()}).loose();var JNe=[`agent-connection`],YNe=J({lastConnectedAt:G().nullable(),recent:q(J({id:G(),title:G(),subject:G().nullable(),createdAt:G()}))});async function XNe(e){let t=await e.fetch(`${e.origin}/api/settings/agents`);if(!t.ok)throw po(t,await mo(t));return So(YNe,await t.json())}function ZNe(){let{api:e}=V(),t=wv(),n=I({queryKey:JNe,queryFn:()=>XNe(e)}),r=GNe(e.origin),i=[{label:`Claude Code`,where:`Run it once in a terminal.`,text:KNe(r)},{label:`Codex`,where:`Add it to ~/.codex/config.toml.`,text:qNe(r)}],a=async e=>{await Hz(e.text)?t(`${e.label} setup copied. ${e.where}`,`success`):t(`The ${e.label} setup wasn't copied: this browser blocked the clipboard. Select the line and copy it yourself.`,`error`)};return(0,h.jsxs)(`div`,{className:`flex max-w-prose flex-col gap-4`,...xy,children:[(0,h.jsx)(Sy,{title:`Agents (MCP)`,info:`settings.agents`}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`span`,{className:`text-small font-semibold`,children:`MCP address`}),(0,h.jsx)(`code`,{className:`sl-code py-2 select-all`,children:r})]}),i.map(e=>(0,h.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`span`,{className:`text-small font-semibold`,children:e.label}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[(0,h.jsx)(`code`,{className:`sl-code min-w-0 flex-1 basis-[220px] py-2 whitespace-pre-wrap select-all`,children:e.text}),(0,h.jsxs)(B,{variant:`quiet`,"aria-label":`Copy the ${e.label} setup`,onClick:()=>void a(e),children:[(0,h.jsx)(Bc,{"aria-hidden":`true`,className:`size-[14px] shrink-0`}),`Copy`]})]}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:e.where})]},e.label)),(0,h.jsx)(JL,{query:n,what:`Agent activity`,loading:(0,h.jsx)(GL,{label:`Loading agent activity…`,rows:3,rowClassName:`h-5`}),children:e=>(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:e.lastConnectedAt===null?`No agent has connected yet.`:(0,h.jsxs)(h.Fragment,{children:[`Last connected`,` `,(0,h.jsx)(d0,{iso:e.lastConnectedAt,children:vd(e.lastConnectedAt)}),`.`]})}),(0,h.jsxs)(`section`,{"aria-label":`What agents did`,className:`flex flex-col gap-1`,children:[(0,h.jsx)(`h3`,{className:`m-0 text-title-3`,children:`What agents did`}),e.recent.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`No agent has changed anything yet.`}):(0,h.jsx)(`ul`,{className:`m-0 list-none space-y-1 p-0 text-small text-ink-2`,children:e.recent.map(e=>(0,h.jsxs)(`li`,{children:[e.title,e.subject===null?``:` · ${e.subject}`,` ·`,` `,(0,h.jsx)(d0,{iso:e.createdAt,children:vd(e.createdAt)})]},e.id))})]})]})})]})}var QNe={template:`Template`,schedule:`Schedule`,draft:`Draft`,project:`Project`};function H7(e){let t=[e.added.length>0?`${e.added.length} new`:null,e.priced.length>0?`${e.priced.length} repriced`:null,e.retired.length>0?`${e.retired.length} retired`:null].filter(e=>e!==null);return t.length===0?`No changes`:t.join(`, `)}function $Ne(){let{api:e}=V(),t=_(),n=wv(),r=I({queryKey:Oz.catalogue,queryFn:()=>Mz(e),refetchInterval:3e4}),i=I({queryKey:Oz.retired,queryFn:()=>Fz(e)}),a=async()=>{await Promise.all([t.invalidateQueries({queryKey:[`provider-models`]}),t.invalidateQueries({queryKey:Oz.retired})])},o=L({mutationFn:()=>Nz(e),onSuccess:async e=>{t.setQueryData(Oz.catalogue,e),n(e.sync?.warning??`Model list checked: ${H7(e.sync?.changes??ePe)}.`,e.sync?.warning?`error`:`success`),await a()}}),s=L({mutationFn:()=>Pz(e),onSuccess:async e=>{n(`Catalogue replaced with the published file.`,`success`),t.setQueryData(Oz.catalogue,e),await a()}}),c=async()=>{await Promise.all([t.invalidateQueries({queryKey:Oz.retired}),t.invalidateQueries({queryKey:yO}),t.invalidateQueries({queryKey:pT}),t.invalidateQueries({queryKey:[`play-drafts`]}),t.invalidateQueries({queryKey:[`projects`]}),t.invalidateQueries({queryKey:[`project`]})])},l=L({mutationFn:t=>Iz(e,t),onSuccess:c}),u=L({mutationFn:()=>Lz(e),onSuccess:async e=>{n(e.failed.length===0?`Switched ${e.switched} ${e.switched===1?`use`:`uses`}.`:`Switched ${e.switched}; ${e.failed.length} could not be switched: ${e.failed[0]?.message??``}`,e.failed.length===0?`success`:`error`),await c()}}),d=r.data?.sync,f=i.data??[],p=f.filter(e=>e.blocked===null&&e.replacement!==null),m=o.error?.message??s.error?.message??r.error?.message??r.data?.warning??d?.warning??null;return Xy({id:`settings.check-models`,title:`Check for new models`,group:`Settings`,context:`Models`,keywords:[`catalogue`,`prices`,`retired`],run:()=>{!o.isPending&&r.data?.path&&o.mutate()}}),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(Sy,{title:`Model catalogue`,info:`settings.models.catalogue`,children:[(0,h.jsx)(B,{disabled:o.isPending||!r.data?.path,onClick:()=>o.mutate(),children:o.isPending?`Checking…`:`Check now`}),(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,h.jsx)(B,{variant:`quiet`,disabled:s.isPending||!r.data?.path,onClick:()=>s.mutate(),children:s.isPending?`Replacing…`:`Replace with published file`}),(0,h.jsx)(U,{id:`settings.models.replace`})]})]}),(0,h.jsxs)(`dl`,{className:`m-0 grid gap-x-6 border-t border-line text-small sm:grid-cols-[160px_minmax(0,1fr)]`,children:[(0,h.jsx)(`dt`,{className:`pt-3 font-semibold text-ink sm:border-b sm:border-line sm:pb-3`,children:`Catalogue file`}),(0,h.jsx)(`dd`,{className:`m-0 min-w-0 border-b border-line pb-3 break-all font-mono text-ink-2 sm:pt-3`,children:r.data?.path??`Not available`}),(0,h.jsx)(`dt`,{className:`pt-3 font-semibold text-ink sm:border-b sm:border-line sm:pb-3`,children:`Verified`}),(0,h.jsx)(`dd`,{className:`m-0 border-b border-line pb-3 text-ink-2 sm:pt-3`,children:r.data?.updatedAt??`date unavailable`}),(0,h.jsx)(`dt`,{className:`pt-3 font-semibold text-ink sm:border-b sm:border-line sm:pb-3`,children:`Last checked`}),(0,h.jsx)(`dd`,{className:`m-0 border-b border-line pb-3 text-ink-2 sm:pt-3`,children:d?.checkedAt?`${vd(d.checkedAt)} · ${H7(d.changes)}`:`Not checked yet`})]}),d!==void 0&&d.changes.retired.length+d.changes.added.length>0?(0,h.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1 text-small text-ink-2`,children:[d.changes.added.length>0?(0,h.jsxs)(`span`,{children:[`New: `,d.changes.added.map(e=>e.name).join(`, `)]}):null,d.changes.retired.length>0?(0,h.jsxs)(`span`,{children:[`Retired: `,d.changes.retired.map(e=>e.name).join(`, `)]}):null]}):null,m===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 mt-3 text-body text-danger`,children:m})]}),(0,h.jsxs)(`section`,{"aria-label":`Retired models in use`,children:[(0,h.jsx)(Sy,{title:`Retired models in use`,info:`settings.models.retired`,children:(0,h.jsx)(B,{variant:`primary`,disabled:u.isPending||p.length===0,onClick:()=>u.mutate(),children:u.isPending?`Switching…`:`Switch all`})}),i.error?(0,h.jsx)(`p`,{role:`alert`,className:`m-0 mb-2 text-body text-danger`,children:i.error.message}):null,l.error?(0,h.jsx)(`p`,{role:`alert`,className:`m-0 mb-2 text-body text-danger`,children:l.error.message}):null,f.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:i.isPending?`Looking…`:`Nothing uses a retired model.`}):(0,h.jsx)(`ul`,{"aria-label":`Retired models in use`,className:`sl-list m-0 list-none p-0`,children:f.map(e=>(0,h.jsxs)(`li`,{className:`sl-row max-sm:grid-cols-1`,children:[(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsxs)(`p`,{className:`m-0`,children:[(0,h.jsx)(`span`,{className:`sl-kicker`,children:QNe[e.kind]}),` `,(0,h.jsx)(`span`,{className:`font-semibold`,children:e.name})]}),(0,h.jsxs)(`p`,{className:`m-0 text-small text-ink-2`,children:[t$[e.slot],`: `,e.model,` (`,e.why===`retired`?`retired`:`no longer listed`,`)`]}),e.blocked===null?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-waiting`,children:e.blocked})]}),(0,h.jsx)(Sv,{children:(0,h.jsx)(B,{size:`small`,disabled:e.blocked!==null||e.replacement===null||l.isPending,onClick:()=>l.mutate(e),children:e.replacement===null?`No replacement`:`Switch to ${e.replacement.name}`})})]},e.key))})]})]})}var ePe={added:[],retired:[],priced:[]},tPe={ok:`Ready`,warning:`Check`,problem:`Needs fixing`,unused:`Not set up`},nPe={ok:`done`,warning:`waiting`,problem:`failed`,unused:`off`},rPe={ok:`text-ink-2`,warning:`text-waiting`,problem:`text-danger`,skipped:`text-ink-3`};function U7(){let{api:e}=V();return L({mutationFn:()=>jz(e)})}function iPe(e){let{api:t}=V(),[n,r]=(0,m.useState)({byId:new Map});return{one:L({mutationFn:e=>jz(t,e),onSuccess:t=>{r(n=>{let r=new Map(n.after===e?n.byId:[]);for(let e of t.providers)r.set(e.id,e);return{after:e,byId:r}})}}),latest:t=>n.after===e?n.byId.get(t.id)??t:t}}function aPe({run:e}={}){let t=U7(),n=e??t,r=n.data,i=iPe(r?.checkedAt),a=r?.providers.filter(e=>e.state!==`unused`).map(i.latest)??[],o=r?.providers.filter(e=>e.state===`unused`)??[];return(0,h.jsxs)(`section`,{"aria-label":`Health check`,children:[(0,h.jsx)(Sy,{title:`Health check`,info:`settings.health`,children:e===void 0?(0,h.jsx)(B,{disabled:n.isPending,onClick:()=>{n.mutate()},children:n.isPending?`Checking…`:`Check all`}):void 0}),n.error===null?null:(0,h.jsxs)(`p`,{role:`alert`,className:`m-0 mb-2 text-body text-danger`,children:[`The health check didn't finish: `,n.error.message,` Press Check all to try again.`]}),i.one.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 mb-2 text-body text-danger`,children:`The check didn't finish: ${i.one.error.message} Press Check again on the provider to try again.`}),r===void 0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:n.isPending?`Checking every provider…`:`Not checked yet.`}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`ul`,{"aria-label":`Health by provider`,className:`sl-list m-0 list-none p-0`,children:a.map(e=>(0,h.jsxs)(`li`,{className:`sl-row grid-cols-1 gap-1`,children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,h.jsx)(`span`,{className:`sl-row__title`,children:e.displayName}),(0,h.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(KO,{tone:nPe[e.state],children:tPe[e.state]}),(0,h.jsx)(B,{variant:`quiet`,size:`small`,"aria-label":`Check ${e.displayName} again`,disabled:i.one.isPending,onClick:()=>{i.one.mutate(e.id)},children:i.one.isPending&&i.one.variables===e.id?`Checking…`:`Check again`})]})]}),(0,h.jsx)(`ul`,{className:`m-0 list-none space-y-1 p-0`,children:e.checks.map(e=>(0,h.jsxs)(`li`,{className:z(`text-small`,rPe[e.state]),children:[(0,h.jsxs)(`span`,{className:`font-semibold`,children:[e.label,`:`]}),` `,e.detail]},e.label))})]},e.id))}),(0,h.jsx)(`p`,{className:`m-0 mt-3 text-small text-ink-2`,children:o.length===0?`Checked at ${new Date(r.checkedAt).toLocaleTimeString()}.`:`Not set up and not used anywhere: ${o.map(e=>e.displayName).join(`, `)}.`})]})]})}var W7={openrouter:`settings.provider.openrouter`,"claude-code":`settings.provider.claude-code`,codex:`settings.provider.codex`,gemini:`settings.provider.gemini`,elevenlabs:`settings.provider.elevenlabs`,"openai-tts":`settings.provider.openai-tts`,cartesia:`settings.provider.cartesia`,inworld:`settings.provider.inworld`,"system-voice":`settings.provider.system-voice`,"google-tts":`settings.provider.google-tts`,fal:`settings.provider.fal`,replicate:`settings.provider.replicate`,"openai-image":`settings.provider.openai-image`,"google-image":`settings.provider.google-image`,"codex-image":`settings.provider.codex-image`};function G7(e){return dk(e)?{tone:`done`,word:`Ready`}:e.installed?{tone:`waiting`,word:`Needs attention`}:{tone:`off`,word:`Not found`}}function oPe({provider:e,readiness:t,kind:n}){let{api:r}=V(),i=_(),a=(0,m.useId)(),[o,s]=(0,m.useState)(void 0),[c,l]=(0,m.useState)(!1),u=e.cliPath?.configured??null,d=e.cliPath?.managedOnHost===!0,f=e.id===`claude-code`?`claude`:e.id===`codex-image`?`codex`:e.id,p=e.cliPath?.command??f,g=o??u??``,v=dk(t),y=L({mutationFn:t=>$o(r,e.id,t),onMutate:()=>l(!1),onSuccess:async e=>{i.setQueryData(H.providers,t=>t?{...t,providers:t.providers.map(t=>t.id===e.id?e:t)}:void 0),s(void 0),l(!0),await i.invalidateQueries({queryKey:H.providers})}});(0,m.useEffect)(()=>{if(!c)return;let e=setTimeout(()=>l(!1),t1);return()=>clearTimeout(e)},[c]);let[b,x]=(0,m.useState)(!1),S=(0,m.useId)();return(0,h.jsxs)(`section`,{"aria-labelledby":a,"data-ready":v,className:`flex min-w-0 flex-col gap-5`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`h3`,{id:a,className:`sl-section-head__title`,children:e.displayName}),(0,h.jsx)(U,{id:W7[e.id],label:e.displayName})]}),(0,h.jsxs)(`p`,{className:`sl-section-head__meta`,children:[n,` · command line, no key needed`]})]}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsxs)(`p`,{className:`m-0 flex min-w-0 items-center gap-2`,"aria-live":`polite`,children:[(0,h.jsx)(GO,{tone:G7(t).tone}),(0,h.jsx)(`span`,{className:`min-w-0 break-words`,children:sPe(t,u)})]}),(0,h.jsxs)(`p`,{className:`m-0 flex min-w-0 items-center gap-2 text-small text-ink-2`,children:[(0,h.jsx)(`span`,{children:`Command`}),(0,h.jsx)(xL,{className:`min-w-0 truncate`,title:p,children:p})]})]}),(0,h.jsxs)(Sv,{children:[d?(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-small text-ink-2`,children:[`Managed on host`,(0,h.jsx)(U,{id:`settings.cli.managed-on-host`})]}):(0,h.jsx)(B,{"aria-expanded":b,"aria-controls":S,onClick:()=>x(e=>!e),children:b?`Close path`:`Change path`}),(0,h.jsx)(`span`,{className:`inline-flex w-[52px]`,children:c?(0,h.jsx)(r1,{}):null})]}),d||!b?null:(0,h.jsx)(`form`,{id:S,onSubmit:e=>{e.preventDefault(),y.isPending||y.mutate(g)},children:(0,h.jsx)(_L,{label:`Executable path`,tip:`settings.cli.path`,help:(0,h.jsxs)(h.Fragment,{children:[`Leave blank to find `,(0,h.jsx)(xL,{children:f}),` on PATH. Use an absolute path without quotes or arguments.`]}),error:y.error?.message,children:(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(X,{autoComplete:`off`,spellCheck:!1,maxLength:4096,"aria-label":`${e.displayName} Executable path`,className:`min-w-0 flex-1 basis-[220px]`,placeholder:f,value:g,disabled:y.isPending,onChange:e=>{s(e.target.value),l(!1),y.reset()}}),(0,h.jsx)(B,{type:`submit`,variant:`primary`,"aria-label":`Save ${e.displayName} path`,disabled:y.isPending,children:y.isPending?`Checking…`:`Save path`})]})})})]})}function sPe(e,t){return e.issue===void 0?e.installed?e.version===void 0?`Installed`:`Installed, version ${e.version}`:t===null?`Not found in the folders your terminal searches (PATH)`:`Not found at the saved path`:e.issue}var cPe=[`providers`,`system-voice`,`voices`];async function K7(e){return R(await e.fetch(`${e.origin}/api/providers/system-voice/voices`))}function q7(e=!0){let{api:t}=V();return I({queryKey:cPe,queryFn:()=>K7(t),enabled:e})}function J7(e){return e.available?{tone:`done`,word:`Ready`}:{tone:`off`,word:`Not found`}}function lPe({provider:e,readiness:t}){let n=(0,m.useId)(),r=q7(t.available).data?.engines??[];return(0,h.jsxs)(`section`,{"aria-labelledby":n,"data-ready":t.available,className:`flex min-w-0 flex-col gap-5`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`h3`,{id:n,className:`sl-section-head__title`,children:e.displayName}),(0,h.jsx)(U,{id:W7[e.id],label:e.displayName})]}),(0,h.jsx)(`p`,{className:`sl-section-head__meta`,children:`Speech · built into this computer, no key needed`})]}),(0,h.jsxs)(`p`,{className:`m-0 flex min-w-0 items-center gap-2`,"aria-live":`polite`,children:[(0,h.jsx)(GO,{tone:J7(t).tone}),(0,h.jsx)(`span`,{className:`min-w-0 break-words`,children:t.available?`Found ${t.engine??`a speech program`}. Narration with it is free; a keyed voice (ElevenLabs, OpenAI) sounds better.`:t.issue??`No speech program was found on this computer.`})]}),r.length===0?null:(0,h.jsx)(`ul`,{className:`m-0 list-none p-0 text-small text-ink-2`,children:r.map(e=>{let t=e.voices.length;return(0,h.jsx)(`li`,{children:`${e.name}: ${t} voice${t===1?``:`s`}`},e.id)})}),t.available?(0,h.jsx)(Sv,{children:(0,h.jsx)(LO,{to:`/settings`,search:{section:`voices`},children:`Add a system voice`})}):null]})}function uPe({value:e,onPick:t}){let{api:n}=V(),r=q7(),i=r.data?.engines??[],a=i.find(t=>t.voices.some(t=>t.id===e)),[o,s]=(0,m.useState)(``),c=(0,m.useId)(),l=o.trim().toLowerCase(),u=i.reduce((e,t)=>e+t.voices.length,0),d=t=>l===``||t.id===e||`${t.name} ${t.language??``}`.toLowerCase().includes(l),[f,p]=(0,m.useState)(void 0);(0,m.useEffect)(()=>()=>{f!==void 0&&URL.revokeObjectURL(f)},[f]);let g=L({mutationFn:e=>sc(n,{provider:bde,model:e.engine,voice:e.id,text:dPe}),onSuccess:e=>{let t=URL.createObjectURL(e);p(t),new Audio(t).play().catch(()=>{})}});return r.data!==void 0&&i.length===0?(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:r.data.issue??`No speech program was found on this computer.`}):(0,h.jsxs)(`div`,{className:`grid gap-1`,children:[u>12?(0,h.jsx)(X,{id:c,type:`search`,"aria-label":`Filter voices`,placeholder:`Filter ${String(u)} voices by name or language`,value:o,onChange:e=>s(e.target.value)}):null,(0,h.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,h.jsxs)(bL,{className:`min-w-0 flex-1`,value:e,onChange:e=>{g.reset();for(let n of i){let r=n.voices.find(t=>t.id===e.target.value);if(r!==void 0)return t(r)}},children:[(0,h.jsx)(`option`,{value:``,children:r.data===void 0?`Looking for voices…`:`Pick a voice`}),i.map(e=>(0,h.jsx)(`optgroup`,{label:e.name,children:e.voices.filter(d).map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.language===void 0?e.name:`${e.name} (${e.language})`},e.id))},e.id))]}),(0,h.jsxs)(B,{variant:`quiet`,disabled:a===void 0||g.isPending,disabledReason:`Pick a voice first.`,onClick:()=>{a!==void 0&&g.mutate({engine:a.id,id:e})},children:[(0,h.jsx)(El,{"aria-hidden":`true`,className:`size-[14px]`}),g.isPending?`Speaking…`:`Listen`]})]}),g.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:`The sample couldn't be spoken: ${g.error.message}`})]})}var dPe=`This is how your narration will sound in this voice.`,Y7=[`llm`,`tts`,`image`],X7={llm:`Text`,tts:`Speech`,image:`Images`},fPe=`••••••••••••`;function pPe(e){return dk(e.readiness)}function mPe(e){return e.readiness.kind===`cli`?G7(e.readiness):e.readiness.kind===`local`?J7(e.readiness):e.readiness.hasKey?{tone:`done`,word:`Key saved`}:{tone:`off`,word:`No key`}}function hPe(){let{api:e}=V(),t=I(cy(e)),[n,r]=(0,m.useState)(void 0),i=(0,m.useRef)(null),a=(0,m.useRef)(!1);(0,m.useEffect)(()=>{n!==void 0&&a.current&&(a.current=!1,typeof window.matchMedia==`function`&&window.matchMedia(`(max-width: 1023px)`).matches&&i.current?.scrollIntoView?.({block:`start`,behavior:`smooth`}))},[n]);let o=Y7.flatMap(e=>(t.data?.providers??[]).filter(t=>t.family===e)),s=o.find(e=>!pPe(e))??o[0];if(n===void 0&&s!==void 0&&r(s.id),t.error!==null)return(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-body text-danger`,children:t.error.message});if(t.data===void 0)return(0,h.jsx)(_Pe,{});let c=o.find(e=>e.id===n)??s,l=o.every(e=>e.readiness.kind!==`keyed`||!e.readiness.hasKey),u=e=>{a.current=!0,r(e)};return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-8`,children:[l?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Paste a key to make its provider selectable on Play.`}):null,Y7.map(e=>(0,h.jsxs)(`section`,{"data-tour":`keys-${e}`,"aria-labelledby":`keys-${e}-title`,className:`grid items-start gap-x-8 gap-y-6 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]`,children:[(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsx)(Sy,{id:`keys-${e}-title`,title:X7[e],size:`small`,className:`pb-2`}),(0,h.jsx)(mR,{label:`${X7[e]} providers`,children:o.filter(t=>t.family===e).map(e=>{let t=mPe(e);return(0,h.jsx)(hR,{title:e.displayName,meta:e.readiness.kind===`cli`?`Command line`:e.readiness.kind===`local`?`Built in, no key`:`API key`,selected:e.id===c?.id,onSelect:()=>u(e.id),actions:(0,h.jsx)(KO,{tone:t.tone,children:t.word})},e.id)})})]}),c===void 0||c.family!==e?null:(0,h.jsx)(`div`,{ref:i,className:`min-w-0 scroll-mt-4`,children:c.readiness.kind===`cli`?(0,h.jsx)(oPe,{provider:c,readiness:c.readiness,kind:X7[c.family]},c.id):c.readiness.kind===`local`?(0,h.jsx)(lPe,{provider:c,readiness:c.readiness},c.id):(0,h.jsx)(gPe,{provider:c,hasKey:c.readiness.hasKey},c.id)})]},e))]})}function gPe({provider:e,hasKey:t}){let{api:n}=V(),r=_(),i=(0,m.useId)(),a=(0,m.useId)(),[o,s]=(0,m.useState)(``),[c,l]=(0,m.useState)(!1),[u,d]=(0,m.useState)(!1),[f,p]=(0,m.useState)(void 0),[g,v]=(0,m.useState)(!1),[y,b]=(0,m.useState)(!1),[x,S]=(0,m.useState)(void 0),C=(0,m.useId)(),w=GA[e.id],T=o.trim(),E=async()=>{b(!0),S(void 0);try{S(await Az(n,e.id,T===``?void 0:T))}catch(e){p(e instanceof Error?e.message:String(e))}finally{b(!1)}},D=async()=>{l(!0),p(void 0);try{await Qo(n,e.id,o),s(``),d(!0),S(void 0),await r.invalidateQueries({queryKey:H.providers})}catch(e){p(e instanceof Error?e.message:String(e))}finally{l(!1)}},O=L({mutationFn:()=>es(n,e.id),onSuccess:async()=>{v(!1),p(void 0),await r.invalidateQueries({queryKey:H.providers})},onError:e=>{v(!1),p(e.message)}});(0,m.useEffect)(()=>{if(!u)return;let e=setTimeout(()=>{d(!1)},t1);return()=>{clearTimeout(e)}},[u]);let k=[t?a:void 0,x===void 0?void 0:C].filter(e=>e!==void 0).join(` `);return(0,h.jsxs)(`section`,{"aria-labelledby":i,"data-ready":t,className:`flex min-w-0 flex-col gap-5`,children:[(0,h.jsx)(Sy,{as:`h3`,size:`default`,id:i,title:t?e.displayName:`Set up ${e.displayName}`,info:W7[e.id],infoLabel:e.displayName,meta:`${X7[e.family]} · ${t?`a key is saved`:`needs an API key`}`,className:`pb-0`}),w===void 0?null:t?(0,h.jsxs)(`details`,{className:`text-small text-ink-2`,children:[(0,h.jsx)(`summary`,{className:`cursor-pointer`,children:`Where to get a key`}),(0,h.jsx)(`div`,{className:`mt-2 flex flex-col gap-2`,children:(0,h.jsx)(Z7,{guide:w})})]}):(0,h.jsx)(`div`,{className:`flex flex-col gap-2 text-small text-ink-2`,children:(0,h.jsx)(Z7,{guide:w})}),(0,h.jsx)(_L,{label:`${e.displayName} API key`,tip:`settings.providers.api-key`,help:`Stored on this computer only. Never in backups or exports.`,error:f,children:(0,h.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),o.trim()!==``&&!c&&D()},children:[(0,h.jsx)(qB,{autoComplete:`off`,spellCheck:!1,className:`flex-1 basis-[200px]`,"aria-describedby":k===``?void 0:k,placeholder:t?fPe:`Paste API key`,value:o,onChange:e=>{s(e.target.value)}}),(0,h.jsx)(B,{type:`submit`,variant:`primary`,"aria-label":`Save ${e.displayName} key`,disabled:o.trim()===``||c,children:`Save`})]})}),t?(0,h.jsx)(`span`,{id:a,className:`sr-only`,children:`A key is stored for this provider.`}):null,x===void 0?null:(0,h.jsx)(`p`,{id:C,role:x.ok?`status`:`alert`,className:z(`m-0 text-small`,x.ok?`text-accent-ink`:`text-danger`),children:x.message}),(0,h.jsxs)(Sv,{children:[(0,h.jsx)(B,{"aria-label":`Test ${e.displayName} key`,disabled:!t&&T===``||y,disabledReason:`Paste a key first.`,onClick:()=>{E()},children:y?`Testing…`:`Test`}),(0,h.jsx)(U,{id:`settings.providers.test-key`,label:`Test`}),(0,h.jsx)(B,{variant:`quiet`,"aria-label":`Remove ${e.displayName} key`,disabled:!t,onClick:()=>{v(!0)},children:`Remove`}),(0,h.jsx)(`span`,{className:`inline-flex w-[52px]`,children:u?(0,h.jsx)(r1,{}):null})]}),(0,h.jsx)(Bv,{open:g,title:`Remove the ${e.displayName} key?`,consequence:`Projects that used this provider cannot retry until a key is saved.`,confirmLabel:`Remove key`,pending:O.isPending,onConfirm:()=>{O.mutate()},onCancel:()=>{v(!1)}})]})}function Z7({guide:e}){let t=(e,t)=>(0,h.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`underline`,children:t});return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`ol`,{className:`m-0 list-decimal space-y-1 pl-5`,children:e.steps.map(e=>(0,h.jsx)(`li`,{children:e},e))}),(0,h.jsxs)(`p`,{className:`m-0`,children:[`Sign up: `,t(e.signUp.url,e.signUp.label),`. Make the key:`,` `,t(e.keyPage.url,e.keyPage.label),`.`,e.billing===void 0?null:(0,h.jsxs)(h.Fragment,{children:[` Credit: `,t(e.billing.url,e.billing.label),`.`]})]}),(0,h.jsx)(`p`,{className:`m-0`,children:e.permissions}),(0,h.jsxs)(`p`,{className:`m-0`,children:[`More in the provider's `,t(e.docs.url,e.docs.label),`. After saving, choose Test.`]})]})}function _Pe(){return(0,h.jsxs)(`div`,{className:`grid items-start gap-8 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]`,role:`status`,"aria-label":`Loading providers`,children:[(0,h.jsx)(`div`,{className:`flex flex-col gap-6`,children:[[`llm`,4],[`tts`,5],[`image`,5]].map(([e,t])=>(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`span`,{className:`mb-2 block h-3 w-16 rounded-control bg-raised`}),(0,h.jsx)(`div`,{className:`sl-list`,children:Array.from({length:t},(t,n)=>`${e}-${n}`).map(e=>(0,h.jsxs)(`div`,{className:`sl-row`,children:[(0,h.jsx)(`span`,{className:`h-4 w-32 rounded-control bg-raised`}),(0,h.jsx)(`span`,{className:`h-4 w-20 rounded-control bg-raised`})]},e))})]},e))}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,h.jsx)(`span`,{className:`h-6 w-48 rounded-control bg-raised`}),(0,h.jsx)(`span`,{className:`h-10 rounded-control bg-raised`})]})]})}function Q7(e){return e.split(/[\s,;]+/).map(e=>e.trim().toLowerCase()).filter(e=>e!==``)}function $7(e){let t=Q7(e);if(t.length===0)return`Codes such as es, de. Empty means any language.`;let n=t.filter(e=>OT.some(t=>t.code===e)),r=t.filter(e=>!n.includes(e)),i=n.map(e=>AT(e).name).join(`, `);if(r.length===0)return`Reads as: ${i}.`;let a=OT.map(e=>e.code).join(`, `);return`${i===``?``:`Reads as: ${i}. `}Not a language code Slopify knows: ${r.join(`, `)}. Use one of ${a}.`}function vPe(e){return e.languages===void 0?`Any (not known)`:e.languages.map(e=>AT(e).code===e?AT(e).name:e).join(`, `)}function yPe({voice:e}){let{api:t}=V(),n=_(),r=(0,m.useId)(),[i,a]=(0,m.useState)(!1),[o,s]=(0,m.useState)((e.languages??[]).join(`, `)),[c,l]=(0,m.useState)(void 0),u=L({mutationFn:()=>Ms(t,e.id,Q7(o)),onSuccess:async e=>{if(e!==void 0){l(e.message);return}a(!1),l(void 0),await n.invalidateQueries({queryKey:H.voices})}});return i?(0,h.jsxs)(`form`,{className:`grid gap-1`,onSubmit:e=>{e.preventDefault(),u.isPending||u.mutate()},children:[(0,h.jsx)(X,{id:r,"aria-label":`Languages of ${e.name}`,value:o,placeholder:`es, de`,"aria-invalid":c!==void 0,onChange:e=>{s(e.target.value),l(void 0)}}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:$7(o)}),c===void 0?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-danger`,children:c}),u.error===null?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-danger`,children:u.error.message}),(0,h.jsxs)(`div`,{className:`flex gap-2`,children:[(0,h.jsx)(B,{type:`submit`,size:`small`,disabled:u.isPending,children:`Save`}),(0,h.jsx)(B,{variant:`quiet`,size:`small`,onClick:()=>{a(!1),l(void 0),s((e.languages??[]).join(`, `))},children:`Cancel`})]})]}):(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(`span`,{className:`text-ink-2`,children:vPe(e)}),(0,h.jsx)(B,{variant:`quiet`,size:`small`,"aria-label":`Edit the languages of ${e.name}`,onClick:()=>a(!0),children:`Edit`})]})}function bPe(){let{api:e}=V(),t=_(),n=I(ly(e)),r=I(cy(e)),[i,a]=(0,m.useState)(void 0),o=L({mutationFn:t=>Ps(e,t),onSettled:async()=>{a(void 0),await t.invalidateQueries({queryKey:H.voices})}}),s=L({mutationFn:({id:t,on:n})=>Ns(e,t,n),onSettled:async()=>{await t.invalidateQueries({queryKey:H.voices})}}),c=(r.data?.providers??[]).filter(e=>e.family===`tts`);if(n.error!==null)return(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-body text-danger`,children:n.error.message});let l=n.data?.voices;return(0,h.jsxs)(`div`,{"data-tour":`voices`,className:`flex min-w-0 flex-col gap-10`,children:[(0,h.jsxs)(`div`,{className:`min-w-0 overflow-x-auto`,children:[(0,h.jsxs)(`table`,{className:`sl-table min-w-[640px] table-fixed`,...xy,children:[(0,h.jsx)(`caption`,{className:`sr-only`,children:`Voices`}),(0,h.jsx)(`thead`,{children:(0,h.jsxs)(`tr`,{children:[(0,h.jsx)(`th`,{scope:`col`,className:`w-[22%] pr-4`,children:`Name`}),(0,h.jsx)(`th`,{scope:`col`,className:`w-[18%] pr-4`,children:`Provider`}),(0,h.jsx)(`th`,{scope:`col`,className:`pr-4`,children:`Voice ID`}),(0,h.jsx)(`th`,{scope:`col`,className:`w-[22%] pr-4`,children:(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[`Languages`,(0,h.jsx)(U,{id:`play.voices.languages`,className:`-my-1`})]})}),(0,h.jsx)(`th`,{scope:`col`,className:`w-[20%] pr-4`,children:(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[`Real person`,(0,h.jsx)(U,{id:`play.voices.real-person`,className:`-my-1`})]})}),(0,h.jsx)(`th`,{scope:`col`,className:`w-[96px]`,children:(0,h.jsx)(`span`,{className:`sr-only`,children:`Remove`})})]})}),(0,h.jsx)(`tbody`,{children:l===void 0?(0,h.jsx)(`tr`,{children:(0,h.jsx)(`td`,{colSpan:6,children:(0,h.jsx)(`span`,{className:`block h-4 w-64 rounded-control bg-raised`})})}):l.length===0?(0,h.jsx)(`tr`,{children:(0,h.jsx)(`td`,{colSpan:6,className:`text-ink-2`,children:`Add a voice ID from your text-to-speech provider. Audio needs one to narrate.`})}):l.map(e=>(0,h.jsxs)(`tr`,{children:[(0,h.jsx)(`td`,{className:`truncate pr-4 font-semibold`,children:e.name}),(0,h.jsx)(`td`,{className:`truncate pr-4 text-ink-2`,children:SPe(c,e.provider)}),(0,h.jsx)(`td`,{className:`truncate pr-4 text-ink-2`,children:e.voiceId}),(0,h.jsx)(`td`,{className:`pr-4`,children:(0,h.jsx)(yPe,{voice:e})}),(0,h.jsx)(`td`,{className:`pr-4`,children:(0,h.jsx)(Cy,{checked:s.isPending&&s.variables.id===e.id?s.variables.on:e.imitatesRealPerson===!0,disabled:s.isPending,onChange:t=>s.mutate({id:e.id,on:t}),label:(0,h.jsx)(`span`,{className:`sr-only`,children:`${e.name} imitates a real person`}),className:`text-small`})}),(0,h.jsx)(`td`,{className:`text-right`,children:(0,h.jsx)(B,{variant:`quiet`,size:`small`,"aria-label":`Remove ${e.name}`,onClick:()=>{a(e)},children:`Remove`})})]},e.id))})]}),s.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 mt-2 text-small text-danger`,children:`Couldn't change Real person: ${s.error.message} Press the switch again.`}),o.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 mt-2 text-small text-danger`,children:o.error.message})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(Sy,{title:`Add a voice`}),(0,h.jsx)(xPe,{tts:c})]}),(0,h.jsx)(Bv,{open:i!==void 0,title:i===void 0?``:`Remove ${i.name}?`,consequence:`Projects that used this voice keep the audio they made with it.`,confirmLabel:`Remove voice`,pending:o.isPending,onConfirm:()=>{i!==void 0&&o.mutate(i.id)},onCancel:()=>{a(void 0)}})]})}function xPe({tts:e}){let{api:t}=V(),n=_(),[r,i]=(0,m.useState)(``),[a,o]=(0,m.useState)(``),[s,c]=(0,m.useState)(``),[l,u]=(0,m.useState)(void 0),[d,f]=(0,m.useState)(void 0),p=l??e[0]?.id,g=L({mutationFn:e=>js(t,e),onSuccess:async e=>{if(!e.ok){f(e.refusal);return}i(``),o(``),c(``),f(void 0),await n.invalidateQueries({queryKey:H.voices})}}),v=(e,t)=>{t(),d?.field===e&&f(void 0)},y=e=>d?.field===e?d.message:void 0,b=()=>{if(p===void 0||d!==void 0||g.isPending)return;let e=Q7(s);g.mutate({provider:p,name:r,voiceId:a,...e.length===0?{}:{languages:e}})};return(0,h.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),b()},children:[(0,h.jsxs)(`div`,{className:`grid items-start gap-4 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto]`,children:[(0,h.jsx)(_L,{label:`Voice name`,tip:`play.voices.name`,error:y(`name`),children:(0,h.jsx)(X,{value:r,onChange:e=>{let t=e.target.value;v(`name`,()=>{i(t)})}})}),(0,h.jsx)(_L,{label:`Provider`,tip:`play.voices.provider`,error:y(`provider`),children:(0,h.jsxs)(bL,{value:p??``,onChange:t=>{let n=e.find(e=>e.id===t.target.value);n!==void 0&&v(`provider`,()=>{u(n.id)})},children:[e.length===0?(0,h.jsx)(`option`,{value:``,children:`No speech provider`}):null,e.map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.displayName},e.id))]})}),(0,h.jsx)(_L,{label:`Voice ID`,tip:`play.voices.voice-id`,error:y(`voiceId`),...p===`inworld`?{help:`Use an Inworld voice ID, such as Dennis, or one from your workspace.`}:{},children:p===`system-voice`?(0,h.jsx)(uPe,{value:a,onPick:e=>{v(`voiceId`,()=>{o(e.id)}),r.trim()===``&&i(e.name);let t=/^([a-z]{2,3})(?:[-_]|$)/i.exec(e.language??``)?.[1];s.trim()===``&&t!==void 0&&c(t.toLowerCase())}}):p===`google-tts`?(0,h.jsx)(bL,{value:a,options:[{value:``,label:`Pick a Gemini voice`},...xde.map(e=>({value:e.name,label:`${e.name} (${e.style})`}))],onChange:e=>{let t=e.target.value;v(`voiceId`,()=>{o(t),r.trim()===``&&i(t)})}}):(0,h.jsx)(X,{className:`tabular-nums`,value:a,onChange:e=>{let t=e.target.value;v(`voiceId`,()=>{o(t)})}})}),(0,h.jsx)(_L,{label:`Languages`,tip:`play.voices.languages`,help:$7(s),error:y(`languages`),children:(0,h.jsx)(X,{value:s,placeholder:`es, de`,onChange:e=>{let t=e.target.value;v(`languages`,()=>{c(t)})}})}),(0,h.jsx)(B,{type:`submit`,variant:`primary`,className:`md:mt-6`,disabled:p===void 0||d!==void 0||g.isPending,children:`Add voice`})]}),g.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:g.error.message})]})}function SPe(e,t){return e.find(e=>e.id===t)?.displayName??t}var CPe={headline:`Slopify test notification`,detail:`Notifications work. You'll get one when a run finishes, fails or waits for you, and when a review needs your decision.`},wPe=2048;function TPe(e){let t=e.trim();if(t===``)return;if(t.length>2048)return`Keep the Notification URL to ${String(wPe)} characters or fewer.`;let n;try{n=new URL(t)}catch{return`Enter a full address starting with https:// or http://, for example https://ntfy.sh/your-topic.`}if(n.protocol!==`https:`&&n.protocol!==`http:`)return`The Notification URL must start with https:// or http://.`;if(n.username!==``||n.password!==``)return`Remove the user name and password from the Notification URL; Slopify can't send them.`}var e9=[`settings`,`notifications`],EPe=`The test notification couldn't be shown: this browser only allows notifications from installed apps. Set a Notification URL below instead.`;function DPe(){return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(Sy,{title:`Browser and phone`,info:`settings.notifications`}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,h.jsx)(OPe,{}),(0,h.jsx)(kPe,{}),(0,h.jsx)(APe,{})]})]})}function OPe(){let e=(0,m.useSyncExternalStore)(Xj,Jj,()=>!1),[t,n]=(0,m.useState)(qj),[r,i]=(0,m.useState)(void 0),[a,o]=(0,m.useState)(!1),s=wv(),c=e&&t===`granted`;async function l(e){if(i(void 0),!e){Yj(!1);return}o(!0);try{let e=await $j();n(e);let t=Qj(e);e===`granted`?(Yj(!0),Jj()||i(`Browser notifications couldn't be turned on because this browser blocks site storage for Slopify. Allow site data for this address in your browser's settings, then turn Browser notifications on again.`)):i(t??`Browser notifications weren't turned on because the permission prompt was dismissed. Turn Browser notifications on again and choose Allow.`)}finally{o(!1)}}return(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,h.jsx)(Cy,{label:`Browser notifications`,tip:`settings.notifications.browser`,checked:c,disabled:a,onChange:e=>void l(e)}),(0,h.jsx)(B,{variant:`quiet`,disabled:!c,disabledReason:`Turn Browser notifications on first.`,onClick:()=>{i(void 0);try{iM({projectId:`test`,text:CPe},()=>{}),s(`Test notification sent to this browser.`,`success`)}catch{i(EPe)}},children:`Send test notification`})]}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Works while any Slopify tab is open. The switch applies in this browser at once.`}),r===void 0?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:r})]})}function kPe(){let e=(0,m.useSyncExternalStore)(dM,lM,()=>!0);return(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,h.jsx)(Cy,{label:`Run sounds`,tip:`settings.notifications.sounds`,checked:e,onChange:uM}),(0,h.jsx)(B,{variant:`quiet`,onClick:()=>hM(`start`),children:`Play start`}),(0,h.jsx)(B,{variant:`quiet`,onClick:()=>hM(`end`),children:`Play end`})]}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`A chime when a run starts and a different one when it finishes, fails or waits for you. Works while any Slopify tab is open; set your computer's volume for how loud. The switch applies in this browser at once.`})]})}function APe(){let{api:e}=V(),t=_(),n=wv(),r=(0,m.useId)(),i=I({queryKey:e9,queryFn:()=>rs(e)}),[a,o]=(0,m.useState)(void 0),s=a??i.data?.url??``,c=TPe(s),l=L({mutationFn:t=>as(e,t),onSuccess:e=>{t.setQueryData(e9,e),o(void 0),n(e.url===null?`Notification URL removed.`:`Notification URL saved.`,`success`)}}),u=L({mutationFn:t=>os(e,t),onSuccess:()=>{n(`Test notification sent. Check the app or page behind your Notification URL.`,`success`)}}),d=c??l.error?.message??u.error?.message,f=l.isPending||u.isPending||i.data===void 0,p=a!==void 0&&a!==(i.data?.url??``);return(0,h.jsxs)(_L,{label:`Notification URL`,tip:`settings.notifications.url`,help:`Works with no tab open, for example an ntfy topic on your phone. Saved only when you press Save.`,children:[(0,h.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),!f&&c===void 0&&p&&l.mutate(s)},children:[(0,h.jsx)(X,{type:`url`,inputMode:`url`,autoComplete:`off`,spellCheck:!1,placeholder:`https://ntfy.sh/your-topic`,className:`min-w-0 flex-1 basis-[220px]`,value:s,disabled:i.data===void 0,"aria-invalid":c!==void 0,"aria-describedby":d===void 0?void 0:r,onChange:e=>{l.reset(),u.reset(),o(e.target.value)}}),(0,h.jsx)(B,{type:`submit`,variant:`primary`,disabled:f||c!==void 0||!p,disabledReason:`Type a new address first, or fix the one shown.`,children:`Save`}),(0,h.jsx)(B,{variant:`quiet`,disabled:f||c!==void 0||s.trim()===``,onClick:()=>u.mutate(s),children:`Send test notification`})]}),(0,h.jsx)(KB,{dirty:p,onDiscard:()=>{l.reset(),u.reset(),o(void 0)}}),i.error===null?null:(0,h.jsxs)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:[`The saved Notification URL couldn't be read: `,i.error.message]}),d===void 0?null:(0,h.jsx)(`p`,{id:r,role:`alert`,className:`m-0 text-small text-danger`,children:d})]})}var t9={library:`The Library of Alexandria`,audiobook:`The Wind in the Willows (audiobook)`,podcast:`The Antikythera Mechanism (podcast)`};function jPe(){let{api:e}=V(),t=_(),n=I({queryKey:Hv,queryFn:()=>Xv(e)}),r=L({mutationFn:()=>Qv(e),onSettled:async()=>{await t.invalidateQueries({queryKey:Hv}),await t.invalidateQueries({queryKey:Vv}),await t.invalidateQueries({queryKey:H.projects})}}),i=r.data?.samples??n.data?.samples;return(0,h.jsxs)(`div`,{className:`mt-8`,children:[(0,h.jsx)(Sy,{title:`Sample projects`,info:`settings.sample.restore`}),(0,h.jsx)(mR,{label:`Sample projects`,children:Object.keys(t9).map(e=>{let t=i?.[e]??null;return(0,h.jsx)(hR,{title:t9[e],meta:t===null?`Not in your projects`:`In your projects`,actions:t===null?void 0:(0,h.jsx)(RO,{to:`/projects/$projectId`,params:{projectId:t},className:pR,children:`Open`})},e)})}),(0,h.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(B,{disabled:r.isPending,onClick:()=>r.mutate(),children:r.isPending?`Restoring…`:`Restore samples`}),(0,h.jsx)(`span`,{className:`text-small text-ink-2`,children:`Puts all three back as they shipped.`})]}),(0,h.jsx)(WR,{tone:r.error?`error`:`success`,children:r.error?.message??(r.isSuccess?`The samples are back in Projects.`:void 0)})]})}var MPe=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`];function NPe(e){let[t,n,r]=e.split(`-`).map(Number),i=MPe[(n??0)-1];return i===void 0||r===void 0?e:`${String(r)} ${i} ${String(t)}`}function n9(e,t){let n=[e.range===void 0?e.version:`Versions ${e.range}`,`released ${NPe(e.date)}`].filter(e=>e!==void 0).join(`, `),r=n.charAt(0).toUpperCase()+n.slice(1);return e.version===t?`${r}. The version you are running.`:`${r}.`}function PPe({note:e,onNote:t}){let{api:n}=V(),r=I(FM(n));if(r.error!==null)return(0,h.jsx)(GM,{tone:`danger`,title:`The patch notes did not load`,actions:(0,h.jsx)(B,{onClick:()=>void r.refetch(),children:`Try again`}),children:`${r.error.message} Press Try again, or reload the page.`});if(r.data===void 0)return(0,h.jsx)(`p`,{className:`m-0 text-ink-3`,children:`Loading the patch notes…`});let{notes:i,version:a}=r.data,[o,...s]=i;if(o===void 0)return(0,h.jsx)(`p`,{className:`m-0 text-ink-2`,children:`This version of Slopify has no patch notes.`});let c=e===void 0?void 0:i.find(t=>t.id===e),l=c!==void 0&&c.id!==o.id?c:void 0;return l===void 0?(0,h.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[e!==void 0&&c===void 0?(0,h.jsx)(`p`,{role:`status`,className:`m-0 text-small text-ink-2`,children:`There are no patch notes called "${e}" in this version. The latest are below; older ones are under Earlier versions.`}):null,(0,h.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,h.jsx)(Sy,{title:`Latest version`,meta:n9(o,a),info:`settings.patch-notes`}),(0,h.jsx)(QI,{id:o.id})]}),s.length===0?null:(0,h.jsxs)(`details`,{className:`max-w-prose border-t border-line py-3`,children:[(0,h.jsx)(`summary`,{className:`cursor-pointer font-semibold`,children:`Earlier versions (${String(s.length)})`}),(0,h.jsx)(mR,{label:`Earlier versions`,className:`mt-2`,children:s.map(e=>(0,h.jsx)(hR,{title:e.title,meta:n9(e,a),onSelect:()=>t(e.id),actions:(0,h.jsx)(B,{"aria-label":`Read ${e.title}`,onClick:()=>t(e.id),children:`Read`})},e.id))})]})]}):(0,h.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,h.jsx)(`div`,{children:(0,h.jsxs)(B,{variant:`quiet`,onClick:()=>t(void 0),children:[(0,h.jsx)(xc,{"aria-hidden":`true`,strokeWidth:1.75}),`Back to the latest patch notes`]})}),(0,h.jsx)(Sy,{title:`Earlier version`,meta:n9(l,a)}),(0,h.jsx)(QI,{id:l.id})]})}var FPe={project:`Project`,prompt:`Prompt`,entry:`Intro/outro`,template:`Template`,schedule:`Schedule`},IPe=[{value:`project`,label:`Projects`},{value:`prompt`,label:`Prompts`},{value:`entry`,label:`Intros and outros`},{value:`template`,label:`Templates`},{value:`schedule`,label:`Schedules`}],r9=`Deleted projects, prompts, intros and outros, templates and schedules stay here for 30 days.`,i9=`Channels, cast members, PDF themes and episode summaries are deleted permanently and never come here.`;function LPe(e){return e.kind===`entry`&&e.detail!==null?e.detail===`intro`?`Intro`:`Outro`:e.kind===`prompt`&&e.detail!==null?`Prompt · ${e.detail}`:FPe[e.kind]}function RPe(e){return e<=0?`removed for good today`:e===1?`1 day left`:`${String(e)} days left`}var zPe=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}),a9=new Intl.DateTimeFormat(void 0,{dateStyle:`full`,timeStyle:`long`});function BPe(e){let t=new Date(e.deletedAt);return{short:zPe.format(t),full:`Deleted ${a9.format(t)}. Removed for good ${a9.format(new Date(e.purgeAt))}.`}}function o9(e){return`${e.kind}:${e.id}`}var VPe={project:[H.projects,[`calendar`]],prompt:[H.prompts],entry:[H.entries],template:[yO],schedule:[pT,[`calendar`]]};function HPe(e){let t=e.filter(e=>e.kind===`project`).length,n=e.some(e=>e.kind===`schedule`);return[t===0?void 0:t===1&&e.length===1?`The project and every file it produced are removed from disk.`:`${String(t)} ${t===1?`project and every file it`:`projects and every file they`} produced are removed from disk.`,n?`Deleted schedules keep their run history on Schedules.`:void 0,`Nothing removed here can be restored. This cannot be undone.`].filter(e=>e!==void 0).join(` `)}function s9(e,t,n,r){let i=t[0];if(i===void 0)return``;let a=r.find(e=>e.kind===i.kind&&e.id===i.id)?.name;return`Could not ${e} ${String(t.length)} of ${PG(n,`item`,`items`)}. ${a===void 0?``:`"${a}": `}${i.detail}`}function UPe(){let{api:e}=V(),t=_(),n=wv(),r=async e=>{let n=new Map([[oQ.join(`/`),oQ]]);for(let t of e)for(let e of VPe[t.kind])n.set(e.join(`/`),e);await Promise.all([...n.values()].map(e=>t.invalidateQueries({queryKey:e})))};return{restore:L({mutationFn:async t=>{let[n]=t;return t.length===1&&n!==void 0?{restored:[await cQ(e,n.kind,n.id)],failed:[]}:lQ(e,t)},onSuccess:async({restored:e,failed:t},i)=>{await r(i);let[a]=e;if(e.length===1&&a!==void 0)n(a.renamedFrom===null?`Restored "${a.name}".`:`Restored as "${a.name}": another item is now called "${a.renamedFrom}".`,`success`);else if(e.length>1){let t=e.filter(e=>e.renamedFrom!==null).length;n(`Restored ${PG(e.length,`item`,`items`)}.${t===0?``:` ${PG(t,`came`,`came`)} back renamed because the name was taken.`}`,`success`)}e.some(e=>e.kind===`schedule`)&&n(e.filter(e=>e.kind===`schedule`).length===1?`The schedule is paused. Press Resume on Schedules to run it again.`:`The schedules are paused. Press Resume on Schedules to run each again.`,`info`),t.length>0&&n(s9(`restore`,t,i.length,i),`error`)},onError:e=>n(e.message,`error`)}),remove:L({mutationFn:async t=>{let[n]=t;return t.length===1&&n!==void 0?(await Lbe(e,n.kind,n.id),{deleted:[n],failed:[]}):Rbe(e,t)},onSuccess:async({deleted:e,failed:t},i)=>{await r(i);let[a]=i;i.length===1&&a!==void 0&&t.length===0?n(`Deleted "${a.name}" for good.`,`success`):e.length>0&&n(`Deleted ${PG(e.length,`item`,`items`)} for good.`,`success`),t.length>0&&n(s9(`delete`,t,i.length,i),`error`)},onError:e=>n(e.message,`error`)})}}function WPe(){let{api:e}=V(),t=I({queryKey:oQ,queryFn:()=>sQ(e)}),{restore:n,remove:r}=UPe(),[i,a]=(0,m.useState)(`all`),[o,s]=(0,m.useState)(void 0),c=t.data??[],l=IPe.filter(e=>c.some(t=>t.kind===e.value)),u=l.some(e=>e.value===i)?i:`all`,d=(0,m.useMemo)(()=>u===`all`?c:c.filter(e=>e.kind===u),[c,u]),f=AG((0,m.useMemo)(()=>d.map(o9),[d])),p=d.filter(e=>f.has(o9(e))),g=n.isPending||r.isPending,_=(e,t,n)=>s({title:e,label:t,items:n}),v=()=>{o!==void 0&&r.mutate(o.items,{onSettled:()=>{s(void 0),f.clear()}})};return(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(Sy,{title:`Trash`,info:`settings.trash`,meta:c.length===0?void 0:`${r9} ${i9}`,children:[(0,h.jsx)(B,{size:`small`,disabled:g||c.length===0,disabledReason:c.length===0?`The trash is empty`:`Working on it`,onClick:()=>n.mutate(c,{onSuccess:f.clear}),children:`Restore all`}),(0,h.jsx)(B,{size:`small`,variant:`destructive`,disabled:g||c.length===0,disabledReason:c.length===0?`The trash is empty`:`Working on it`,onClick:()=>_(`Empty the trash: delete all ${PG(c.length,`item`,`items`)} for good?`,`Empty trash`,c),children:`Empty trash`})]}),t.isPending?(0,h.jsx)(`p`,{className:`text-small text-ink-3`,children:`Loading the trash…`}):t.error?(0,h.jsx)(KL,{what:`The trash`,error:t.error,onRetry:()=>void t.refetch(),retrying:t.isFetching,compact:!0}):c.length===0?(0,h.jsxs)(hQ,{title:`The trash is empty`,children:[r9,` `,i9]}):(0,h.jsxs)(`div`,{onKeyDown:f.onKeyDown,children:[l.length>1?(0,h.jsx)(wy,{label:`Filter by kind`,value:u,onChange:a,options:[{value:`all`,label:`All`},...l],className:`mb-2`}):null,(0,h.jsx)(NG,{selection:f,total:d.length,noun:[`item`,`items`],...u===`all`?{}:{scope:`Select all ${String(d.length)} shown`},actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(B,{size:`small`,disabled:g||f.count===0,disabledReason:f.count===0?`Nothing is selected`:`Working on it`,onClick:()=>n.mutate(p,{onSuccess:f.clear}),children:`Restore selected`}),(0,h.jsx)(B,{size:`small`,variant:`destructive`,disabled:g||f.count===0,disabledReason:f.count===0?`Nothing is selected`:`Working on it`,onClick:()=>_(`Delete ${PG(p.length,`selected item`,`selected items`)} for good?`,`Delete for good`,p),children:`Delete selected`})]})}),(0,h.jsx)(mR,{label:`Deleted items`,children:d.map(e=>{let t=BPe(e);return(0,h.jsx)(hR,{lead:(0,h.jsx)(MG,{selection:f,value:o9(e),label:e.name}),title:e.name,meta:(0,h.jsxs)(h.Fragment,{children:[LPe(e),` · deleted`,` `,(0,h.jsx)(`time`,{dateTime:e.deletedAt,title:t.full,children:t.short}),` `,`· `,RPe(e.daysLeft)]}),actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(B,{size:`small`,disabled:g,disabledReason:`Working on it`,onClick:()=>n.mutate([e]),children:`Restore`}),(0,h.jsx)(B,{size:`small`,variant:`destructive`,disabled:g,disabledReason:`Working on it`,onClick:()=>_(`Delete "${e.name}" for good?`,`Delete for good`,[e]),children:`Delete now`})]})},o9(e))})})]}),(0,h.jsx)(Bv,{open:o!==void 0,title:o?.title??``,consequence:o===void 0?``:HPe(o.items),confirmLabel:o?.label??`Delete for good`,cancelLabel:o?.items.length===1?`Keep it`:`Keep them`,pending:r.isPending,onConfirm:v,onCancel:()=>{r.isPending||s(void 0)}})]})}var GPe=`https://github.com/GentBajko/slopify`,KPe=`https://www.patreon.com/cw/GentBajko`,qPe=`https://buymeacoffee.com/gentbajko`;function JPe(){return[{href:GPe,label:`GitHub`,detail:`The code, issues and releases.`,glyph:`github`},{href:KPe,label:`Patreon`,detail:`Monthly support for the project.`,glyph:`patreon`},{href:qPe,label:`Buy Me a Coffee`,detail:`A one-off thank you.`,glyph:`coffee`},{href:`https://slopify.stream/channel.html`,label:`How I run a channel with it`,detail:`A lore channel run on Slopify, start to finish.`}]}function YPe({onWhatsNew:e}){return(0,h.jsxs)(`div`,{className:`max-w-prose`,children:[(0,h.jsx)(Sy,{title:`About`}),(0,h.jsx)(`p`,{className:`m-0 mb-3 text-ink-2`,children:`Slopify is free and open source, and runs on your machine with your own keys. If it saves you time, you can support it here.`}),(0,h.jsxs)(`p`,{className:`m-0 mb-3 flex items-center gap-1 text-small text-ink-2`,children:[`Updates: the circular-arrows button at the foot of the sidebar (at the top on a phone).`,(0,h.jsx)(U,{id:`settings.updates`})]}),e===void 0?null:(0,h.jsxs)(`p`,{className:`m-0 mb-3 flex items-center gap-1`,children:[(0,h.jsx)(B,{onClick:e,children:`What's new in this version`}),(0,h.jsx)(U,{id:`settings.whats-new`})]}),(0,h.jsx)(`p`,{className:`m-0 mb-4 text-small text-ink-2`,children:`Made by Gent Bajko. Apache License 2.0: anyone who redistributes Slopify or builds on it keeps this credit.`}),(0,h.jsx)(`ul`,{"aria-label":`Links`,className:`sl-list m-0 list-none p-0`,children:JPe().map(e=>(0,h.jsx)(`li`,{className:`sl-row`,children:(0,h.jsxs)(`div`,{className:`sl-row__lead`,children:[e.glyph===void 0?(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`size-[14px] shrink-0`}):(0,h.jsx)(FO,{name:e.glyph,className:`shrink-0 text-ink-2`}),(0,h.jsxs)(`div`,{className:`sl-row__text`,children:[(0,h.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer`,className:`font-semibold text-ink underline underline-offset-3`,children:e.label}),(0,h.jsx)(`span`,{className:`sl-row__meta`,children:e.detail})]})]})},e.label))})]})}var c9=[`backups`],l9=1,u9=30;function d9(){return Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`}function XPe(e){let t=e.trim();return/^\d+$/.test(t)&&Number(t)>=l9&&Number(t)<=u9?void 0:`Keep between ${l9} and ${u9} backups.`}function f9(e){return{enabled:e.config.enabled,time:e.config.time,keep:String(e.config.keep),folder:e.config.folder??``}}function p9(){let{api:e}=V(),t=_(),n=wv();return L({mutationFn:()=>ko(e),onSuccess:e=>{t.setQueryData(c9,e),n(`Backup started. Its result shows here when it finishes.`,`success`)}})}function ZPe(){let{api:e}=V(),t=_(),n=I({queryKey:c9,queryFn:()=>Do(e),refetchInterval:e=>e.state.data?.running===!0&&2e3}),[r,i]=(0,m.useState)(void 0),[a,o]=(0,m.useState)(!1),s=L({mutationFn:t=>Oo(e,t),onSuccess:e=>{t.setQueryData(c9,e),i(void 0),o(!0)}}),c=p9();(0,m.useEffect)(()=>{if(!a)return;let e=setTimeout(()=>o(!1),t1);return()=>clearTimeout(e)},[a]);let l=n.data,u=r??(l===void 0?void 0:f9(l)),d=u===void 0?void 0:XPe(u.keep),f=r!==void 0&&l!==void 0&&!QPe(r,f9(l)),p=()=>{u===void 0||d!==void 0||s.isPending||(o(!1),s.mutate({enabled:u.enabled,time:u.time,timeZone:d9(),keep:Number(u.keep.trim()),folder:u.folder.trim()===``?null:u.folder.trim()}))},g=e=>{u!==void 0&&i({...u,...e})};return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(Sy,{title:`Daily backup`,info:`settings.backups`,children:(0,h.jsx)(B,{disabled:l===void 0||l.running||c.isPending,onClick:()=>c.mutate(),children:`Back up now`})}),(0,h.jsxs)(`div`,{className:`mb-6 flex flex-col gap-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap justify-between gap-x-4 gap-y-1 text-small text-ink-2`,children:[(0,h.jsx)(`span`,{role:`status`,children:l===void 0?(0,h.jsx)(`span`,{className:`inline-block h-4 w-48 rounded-control bg-raised`}):$Pe(l)}),(0,h.jsx)(`span`,{children:l===void 0?null:eFe(l)})]}),l?.status.detail?l.status.lastResult===`failed`?(0,h.jsx)(GM,{tone:`danger`,title:`Why the last backup stopped`,children:l.status.detail}):(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:l.status.detail}):null,c.error?(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:c.error.message}):null]}),n.error?(0,h.jsxs)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:[`The backup settings couldn't be read: `,n.error.message]}):(0,h.jsxs)(`form`,{className:`flex flex-col gap-6`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,h.jsx)(Cy,{label:`Back up automatically`,tip:`settings.backups.auto`,checked:u?.enabled===!0,disabled:u===void 0,className:`self-start`,onChange:e=>g({enabled:e})}),(0,h.jsxs)(`div`,{className:`grid items-start gap-6 md:grid-cols-2`,children:[(0,h.jsx)(_L,{label:`Time of day`,tip:`settings.backups.time`,help:`${d9()} time`,children:(0,h.jsx)(X,{type:`time`,className:`w-[140px] tabular-nums`,value:u?.time??`03:00`,disabled:u===void 0,onChange:e=>g({time:e.target.value})})}),(0,h.jsx)(_L,{label:`Keep last`,tip:`settings.backups.keep`,help:`Backups kept in the folder.`,error:d,children:(0,h.jsx)(X,{type:`number`,inputMode:`numeric`,min:l9,max:u9,step:1,className:`w-[88px] tabular-nums`,value:u?.keep??`5`,disabled:u===void 0,onChange:e=>g({keep:e.target.value})})}),(0,h.jsx)(_L,{label:`Folder`,tip:`settings.backups.folder`,className:`md:col-span-2`,...l===void 0?{}:{help:tFe(l)},children:(0,h.jsx)(X,{value:u?.folder??``,placeholder:l?.defaultFolder??``,disabled:u===void 0,onChange:e=>g({folder:e.target.value})})})]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(B,{type:`submit`,variant:`primary`,disabled:!f||d!==void 0||s.isPending,disabledReason:d===void 0?`Nothing changed since the last save.`:d,children:`Save`}),(0,h.jsx)(`span`,{className:`inline-flex w-[52px]`,children:a?(0,h.jsx)(r1,{}):null}),(0,h.jsx)(KB,{dirty:f,onDiscard:()=>{s.reset(),i(void 0)}}),s.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 basis-full text-small text-danger`,children:s.error.message})]})]})]})}function QPe(e,t){return e.enabled===t.enabled&&e.time===t.time&&e.keep.trim()===t.keep.trim()&&e.folder.trim()===t.folder.trim()}function m9(e){return new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}function $Pe(e){if(e.running)return`Backing up now…`;let{status:t}=e,n=t.lastSuccessAt===null?`No backup yet.`:`Last backup ${m9(t.lastSuccessAt)}${t.lastSuccessBytes===null?``:`, ${w5(t.lastSuccessBytes)}`}.`;return t.lastResult===`failed`&&t.lastAttemptAt!==null?`${n} The backup at ${m9(t.lastAttemptAt)} failed.`:t.lastResult===`waiting`?`${n} Waiting for projects to finish.`:n}function eFe(e){return e.config.enabled?e.overdue?`Next: shortly.`:e.nextRunAt===null?``:`Next: ${m9(e.nextRunAt)}.`:`Automatic backups are off.`}function tFe(e){let t=`${e.files.length} backup${e.files.length===1?``:`s`} here (${w5(e.files.reduce((e,t)=>e+t.bytes,0))}).`;return e.hostFolder===null?`Inside Slopify's Docker volume, not on your computer. Leave Folder empty to save backups in the Backups folder on your computer. ${t}`:`${e.config.folder===null?`Empty uses the default: `:`On your computer: `}${e.hostFolder}. ${t}`}var h9=[`storage-usage`],nFe=[h9,H.projects,[`project`],H.usage,H.documentThemes,pT,[`play-drafts`],H.settings,H.providers,H.voices,H.prompts,H.entries,H.staging,yO,Ok,[`provider-models`]];async function rFe(e){await Promise.all(nFe.map(t=>e.invalidateQueries({queryKey:t})))}var g9=`The backup wasn't imported. Check it is a file made with Export everything (.tar) or Export backup (.zip), then try again.`;function iFe(){let{api:e}=V(),t=_(),n=I({queryKey:h9,queryFn:()=>Io(e),staleTime:3e4}),[r,i]=(0,m.useState)(!1),[a,o]=(0,m.useState)({phase:`idle`}),[s,c]=(0,m.useState)({phase:`idle`}),[l,u]=(0,m.useState)(null),d=wv(),[f,p]=(0,m.useState)(null);async function g(){p(null),o({phase:`preparing`});try{let t=await Eo(e);if(!t.ready){o({phase:`idle`}),p(t.detail??`The backup can't be made right now. Try again in a moment.`);return}o({phase:`downloading`,bytes:t.bytes??0,projects:t.projects??0});let n=document.createElement(`a`);n.href=`${e.origin}/api/storage/export`,n.download=``,document.body.append(n),n.click(),n.remove()}catch(e){o({phase:`idle`}),p(e instanceof Error?e.message:`The backup couldn't be prepared. Try again in a moment.`)}}async function v(n){let r=n.name.toLowerCase().endsWith(`.zip`)||n.type===`application/zip`;if(n.size===0||r&&n.size>104857600){p(r?`This file is empty or larger than 100 MB. Choose a .zip made with Export backup, or a .tar made with Export everything.`:`This file is empty. Choose the .tar made with Export everything.`);return}i(!0),p(null),u(null),c({phase:`uploading`,sent:0,total:n.size});try{let i=await e.upload(`${e.origin}/api/storage/import`,n,r?`application/zip`:`application/x-tar`,(e,t)=>{c(e>=t?{phase:`importing`}:{phase:`uploading`,sent:e,total:t})}),a=await i.json();if(!i.ok)throw Error(a.detail??g9);a.projects===void 0?d(`Imported ${a.templates??0} template(s), ${a.fonts??0} uploaded font(s), and ${a.stagedFiles??0} staged file(s).${a.fontFallbacks?` ${a.fontFallbacks} missing legacy font reference(s) now use the default font.`:``}`,`success`):(u(a),d(`Backup imported.`,`success`)),await rFe(t)}catch(e){p(e instanceof Error?e.message:g9)}finally{c({phase:`idle`}),i(!1)}}async function y(){i(!0),p(null);try{let n=await e.fetch(`${e.origin}/api/storage/cleanup`,{method:`POST`}),r=await n.json();if(!n.ok)throw Error(`Clear leftover files didn't finish. Try again in a moment.`);d(`Cleared ${r.orphanFiles??0} leftover project file(s) and ${r.stagedFiles??0} unused upload(s).`,`success`),await t.invalidateQueries({queryKey:h9})}catch(e){p(e instanceof Error?e.message:`Clear leftover files didn't finish. Try again in a moment.`)}finally{i(!1)}}Xy({id:`settings.export-everything`,title:`Export everything`,group:`Settings`,context:`Backup & storage`,keywords:[`backup`,`download`],run:()=>{!r&&a.phase!==`preparing`&&g()}});let b=r||a.phase===`preparing`,x=(0,m.useRef)(null);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(Sy,{title:`Export and import`,info:`settings.storage.export`,children:[(0,h.jsx)(B,{disabled:b,onClick:()=>void g(),children:`Export everything`}),(0,h.jsx)(B,{disabled:b,onClick:()=>x.current?.click(),children:`Import a backup`}),(0,h.jsx)(`input`,{ref:x,className:`sr-only`,type:`file`,tabIndex:-1,"aria-label":`Import a backup`,accept:`.tar,application/x-tar,.zip,application/zip`,disabled:b,onChange:e=>{let t=e.target.files?.[0];t&&v(t),e.target.value=``}}),(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,h.jsx)(B,{variant:`quiet`,disabled:b,onClick:()=>void y(),children:`Clear leftover files`}),(0,h.jsx)(U,{id:`settings.storage.clean`})]})]}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-2 text-small text-ink-2`,children:[(0,h.jsx)(`p`,{className:`m-0`,children:`Provider keys are never included in a backup. After importing, enter them again in Settings → Providers.`}),a.phase===`preparing`?(0,h.jsx)(`p`,{role:`status`,className:`m-0 text-ink`,children:`Preparing the backup…`}):null,a.phase===`downloading`?(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,h.jsxs)(`p`,{role:`status`,className:`m-0 min-w-0 flex-1 text-ink`,children:[`Downloading `,w5(a.bytes),` (`,a.projects,` project`,a.projects===1?``:`s`,`). Your browser's downloads show its progress; keep Slopify running until it finishes.`]}),(0,h.jsx)(B,{variant:`quiet`,size:`small`,onClick:()=>o({phase:`idle`}),children:`Dismiss`})]}):null,s.phase===`uploading`?(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsxs)(`p`,{role:`status`,className:`m-0 text-ink tabular-nums`,children:[`Uploading the backup: `,w5(s.sent),` of `,w5(s.total)]}),(0,h.jsx)($$,{progress:!0,label:`Backup upload`,value:s.total===0?0:s.sent/s.total})]}):null,s.phase===`importing`?(0,h.jsx)(`p`,{role:`status`,className:`m-0 text-ink`,children:`Checking and importing the backup… large projects can take a minute.`}):null,f?(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-danger`,children:f}):null]})]}),l?(0,h.jsx)(oFe,{result:l,onDismiss:()=>u(null)}):null,(0,h.jsxs)(`div`,{children:[(0,h.jsx)(Sy,{title:`Disk space`,info:`settings.storage.disk`,meta:n.data?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`span`,{className:`font-semibold text-ink`,children:[w5(n.data.data),` stored`]}),(0,h.jsxs)(`span`,{className:`tabular-nums`,children:[` `,`· `,w5(Math.max(0,n.data.projects-n.data.trash.bytes)),` project files · `,w5(n.data.staging),` staged files`,n.data.trash.projects>0?` · ${w5(n.data.trash.bytes)} in the trash (${aFe(n.data.trash.projects)}), freed when removed for good`:null]})]}):n.error?`Storage usage is unavailable. Reload the page to try again.`:(0,h.jsx)(`span`,{className:`inline-block h-4 w-48 rounded-control bg-raised`})}),n.data&&n.data.byProject.length>0?(0,h.jsx)(tje,{projects:n.data.byProject,queryKey:[...h9]}):null]})]})}function aFe(e){return e===1?`1 deleted project`:`${String(e)} deleted projects`}function _9(e,t){if(t===void 0)return null;let n=[t.added>0?`${t.added} added`:null,t.renamed>0?`${t.renamed} added as “(imported)” because the name was taken`:null,t.skipped>0?`${t.skipped} already here`:null].filter(e=>e!==null);return n.length===0?null:`${e}: ${n.join(`, `)}.`}function oFe({result:e,onDismiss:t}){let n=[e.projects.imported.length>0?`Projects: ${e.projects.imported.length} added (${w5(e.files.bytes)} of files).`:`Projects: none added.`,_9(`Prompts`,e.prompts),_9(`Intros and outros`,e.entries),_9(`Channels`,e.channels),_9(`Cast members`,e.cast),_9(`Episode memories`,e.episodeMemories),_9(`Existing videos`,e.channelVideos),_9(`PDF themes`,e.documentThemes),_9(`Templates`,e.templates),_9(`Schedules`,e.schedules),e.schedules.paused>0?`${e.schedules.paused} schedule(s) arrived paused so two installs never run them both; resume them on the Schedules screen.`:null,_9(`Voices`,e.voices),_9(`Play drafts`,e.drafts),e.settings.added+e.settings.kept>0?`Settings: ${e.settings.added} filled in${e.settings.kept>0?`, ${e.settings.kept} kept as this install has them`:``}.`:null,e.fonts>0?`Uploaded fonts: ${e.fonts} added.`:null,e.usage.alreadyImported?`Usage: this backup's history was already added before, so it wasn't counted twice.`:`Usage: ${e.usage.events} recorded event(s) added to the totals.`,`Provider keys are not in backups: enter them in Settings → Providers.`].filter(e=>e!==null);return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(Sy,{as:`h3`,title:`Imported the backup from ${e.backup.createdAt.slice(0,10)}`,children:(0,h.jsx)(B,{variant:`quiet`,size:`small`,onClick:t,children:`Dismiss`})}),(0,h.jsxs)(`ul`,{"aria-label":`Import result`,className:`m-0 list-disc pl-5 text-small text-ink-2`,children:[n.map(e=>(0,h.jsx)(`li`,{className:`py-0.5`,children:e},e)),e.projects.skipped.map(e=>(0,h.jsxs)(`li`,{className:`py-0.5`,children:[`Skipped “`,e.title,`”: `,e.reason]},e.id))]})]})}var v9=[`storage-files`];function sFe({usageQueryKey:e}){let{api:t}=V(),n=_(),r=wv(),[i,a]=(0,m.useState)(!1),[o,s]=(0,m.useState)(``),[c,l]=(0,m.useState)(),u=I({queryKey:v9,queryFn:()=>Lo(t),refetchInterval:e=>b9(e.state.data)?1e3:!1}),d=L({mutationFn:e=>Ro(t,e),onMutate:()=>l(void 0),onSuccess:e=>{n.setQueryData(v9,e),a(!1)},onError:e=>l(e.message)}),f=L({mutationFn:()=>zo(t),onSuccess:e=>{e.opened||r(`Your files are in ${e.path}.`,`info`)},onError:e=>r(e.message,`error`)}),p=u.data,g=b9(p),v=p?.move?.phase;if((0,m.useEffect)(()=>{v===`done`&&n.invalidateQueries({queryKey:e})},[v,n,e]),p===void 0)return(0,h.jsx)(`div`,{children:(0,h.jsx)(Sy,{title:`Your files`,meta:u.error?`Where your files are is unavailable. Reload the page to try again.`:`Loading…`})});if(p.docker)return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(Sy,{title:`Your files`,meta:p.folder??`The Docker project folder isn't set up.`,info:`settings.files.docker`,children:(0,h.jsx)(B,{disabled:p.folder===null||f.isPending,onClick:()=>f.mutate(),children:`Open folder`})}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-2 text-small text-ink-2`,children:[(0,h.jsx)(y9,{view:p}),p.dockerCommand===null?null:(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsxs)(`p`,{className:`m-0`,children:[`To move your projects to Documents/Slopify, run this on the computer running Docker (or use `,(0,h.jsx)(xL,{children:`--projects-dir <folder>`}),` for another folder):`]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(xL,{className:`min-w-0 break-all`,children:p.dockerCommand}),(0,h.jsx)(B,{variant:`quiet`,size:`small`,onClick:()=>{let e=p.dockerCommand??``;navigator.clipboard.writeText(e).then(()=>r(`Command copied.`,`success`)).catch(()=>r(`Copying failed: this browser doesn't allow it here. Select the command and copy it yourself.`,`error`))},children:`Copy command`})]})]})]})]});let y=v===`failed`||v===`interrupted`;return(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(Sy,{title:`Your files`,meta:p.folder,info:`settings.files`,children:[p.inDocuments||p.documentsRoot===null?null:(0,h.jsx)(B,{variant:`primary`,disabled:g||d.isPending,onClick:()=>d.mutate(`documents`),children:`Move to Documents/Slopify`}),(0,h.jsx)(B,{disabled:f.isPending,onClick:()=>f.mutate(),children:`Open folder`}),(0,h.jsx)(B,{variant:`quiet`,disabled:g||d.isPending,onClick:()=>{a(e=>!e),l(void 0)},children:`Choose another folder`})]}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-3 text-small text-ink-2`,children:[(0,h.jsx)(y9,{view:p}),i?(0,h.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2`,onSubmit:e=>{e.preventDefault(),d.mutate(o)},children:[(0,h.jsx)(_L,{label:`New folder`,tip:`settings.files.new-folder`,help:`The full path; it must be empty or new.`,error:c,className:`min-w-0 flex-1 basis-80`,children:(0,h.jsx)(X,{value:o,placeholder:p.documentsRoot??`/home/you/Videos/Slopify`,onChange:e=>s(e.target.value)})}),(0,h.jsx)(B,{type:`submit`,disabled:o.trim()===``||d.isPending,children:`Move here`})]}):c===void 0?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-danger`,children:c}),p.move===null?null:g?(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsxs)(`p`,{role:`status`,className:`m-0 text-ink tabular-nums`,children:[p.move.phase===`copying`?`Copying`:`Checking the copy of`,` your files to`,` `,p.move.target,`: `,p.move.files,` of `,p.move.totalFiles,` files (`,w5(p.move.bytes),` of `,w5(p.move.totalBytes),`). Keep Slopify running until it finishes.`]}),(0,h.jsx)($$,{progress:!0,label:p.move.phase===`copying`?`Files copied`:`Files checked`,value:p.move.totalBytes===0?0:p.move.bytes/p.move.totalBytes})]}):y?(0,h.jsx)(GM,{tone:v===`failed`?`danger`:`waiting`,title:v===`failed`?`Moving your files to ${p.move.target} stopped`:`Moving your files to ${p.move.target} didn't finish`,actions:(0,h.jsx)(B,{disabled:d.isPending,onClick:()=>d.mutate(p.move?.target??``),children:`Continue moving`}),children:p.move.error??`Slopify was stopped before the copy was checked, so it still uses the old folder. Continue moving picks up where it left off.`}):v===`done`&&p.move.oldFolder!==null?(0,h.jsxs)(GM,{tone:`info`,title:`Your files are now in ${p.move.target}`,children:[`Every file was copied and checked. The old folder `,p.move.oldFolder,` still has a copy; once your projects open fine, you can delete it to free the space.`]}):null]})]})}function y9({view:e}){let t=[[`Projects`,e.projects],[`Automatic backups`,e.backups],[`Exports`,e.exports]].filter(e=>e[1]!==null);return(0,h.jsx)(`dl`,{className:`m-0 grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1`,children:t.map(([e,t])=>(0,h.jsxs)(`div`,{className:`contents`,children:[(0,h.jsx)(`dt`,{className:`text-ink-3`,children:e}),(0,h.jsx)(`dd`,{className:`m-0 break-all`,children:t})]},e))})}function b9(e){return e?.move?.phase===`copying`||e?.move?.phase===`verifying`}var x9=30,cFe=[{value:`system`,label:`System`},{value:`dark`,label:`Dark`},{value:`light`,label:`Light`}];function lFe(e){let t=e.trim();return/^\d+$/.test(t)&&Number(t)>=0&&Number(t)<=x9?void 0:`The silence gap is a whole number of seconds between 0 and ${String(x9)}.`}function S9(){let{api:e}=V(),t=_();return L({mutationFn:t=>ns(e,t),onMutate:e=>{let n=t.getQueryData(H.settings);return t.setQueryData(H.settings,e),{previous:n}},onError:(e,n,r)=>{r?.previous!==void 0&&t.setQueryData(H.settings,r.previous)},onSuccess:e=>{t.setQueryData(H.settings,e)}})}function C9(){let{api:e}=V(),t=I(my(e));return t.error===null?t.data===void 0?{view:(0,h.jsxs)(`div`,{className:`grid gap-6 md:grid-cols-2`,role:`status`,"aria-label":`Loading settings`,children:[(0,h.jsx)(`span`,{className:`h-16 rounded-control bg-raised`}),(0,h.jsx)(`span`,{className:`h-16 rounded-control bg-raised`})]})}:{data:t.data}:{view:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-body text-danger`,children:t.error.message})}}function uFe(){let{data:e,view:t}=C9(),n=S9(),[r,i]=(0,m.useState)(void 0),[a,o]=(0,m.useState)(!1);if((0,m.useEffect)(()=>{if(!a)return;let e=setTimeout(()=>o(!1),t1);return()=>clearTimeout(e)},[a]),e===void 0)return t??(0,h.jsx)(`span`,{});let s=e,c=r??String(s.silenceGapSeconds),l=lFe(c);return(0,h.jsxs)(`div`,{className:`grid items-start gap-6 md:grid-cols-2`,children:[(0,h.jsx)(_L,{label:`Silence between segments`,tip:`settings.playback.silence-gap`,help:`Seconds of quiet between narrated segments.`,error:l??n.error?.message,children:(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(X,{type:`number`,inputMode:`numeric`,min:0,max:x9,step:1,className:`w-[88px] tabular-nums`,value:c,"aria-invalid":l!==void 0,onChange:e=>{i(e.target.value)}}),(0,h.jsx)(`span`,{className:`text-small text-ink-2`,children:`seconds`}),(0,h.jsx)(B,{variant:`primary`,disabled:l!==void 0||n.isPending,onClick:()=>{o(!1),n.mutate({...s,silenceGapSeconds:Number(c.trim())},{onSuccess:()=>{i(void 0),o(!0)}})},children:`Save`}),(0,h.jsx)(`span`,{className:`inline-flex w-[52px]`,children:a?(0,h.jsx)(r1,{}):null})]})}),(0,h.jsx)(_L,{label:`Subtitle timing model`,tip:`settings.subtitle-model`,help:`Bigger hears the narration more accurately and, on most computers, is also faster. It downloads once, the first time captions are timed.`,error:n.error&&n.variables?.subtitleModel!==s.subtitleModel?`The subtitle timing model wasn't saved. ${n.error.message}`:void 0,children:(0,h.jsx)(bL,{className:`self-start`,value:s.subtitleModel??`fp32`,options:P3,onChange:e=>{let t=P3.find(t=>t.value===e.target.value);t!==void 0&&n.mutate({...s,subtitleModel:t.value})}})}),(0,h.jsx)(`div`,{className:`md:col-span-2`,children:(0,h.jsx)(i3,{value:s.loudness??RT,switchLabel:`Level the volume for new runs`,switchTip:`settings.loudness`,onChange:e=>{n.mutate({...s,loudness:e})}})})]})}function dFe(){let{data:e,view:t}=C9(),n=S9();if(e===void 0)return t??(0,h.jsx)(`span`,{});let r=e;return(0,h.jsxs)(`div`,{className:`sl-field`,...xy,children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,h.jsx)(`span`,{className:`sl-field__label`,children:`Appearance`}),(0,h.jsx)(U,{id:`settings.appearance`,className:`-my-1`})]}),(0,h.jsx)(wy,{label:`Appearance`,value:r.appearance,options:cFe,className:`self-start`,onChange:e=>{n.mutate({...r,appearance:e})}}),n.error?(0,h.jsxs)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:[`The appearance wasn't saved. `,n.error.message]}):null]})}var fFe=[{family:`llm`,label:`Text`,needed:`articles, scripts and descriptions`},{family:`tts`,label:`Voice`,needed:`narration, audiobooks and podcasts`},{family:`image`,label:`Images`,needed:`images and videos`}];function pFe(e){return fFe.map(({family:t,label:n,needed:r})=>{let i=e.filter(e=>e.family===t&&dk(e.readiness));return{label:n,ready:i.length>0,text:i.length>0?i.map(e=>e.displayName).join(`, `):`Not connected: needed for ${r}. Set one up below.`}})}function mFe(){let{api:e}=V(),t=I(cy(e));return t.data===void 0?null:(0,h.jsx)(`ul`,{"aria-label":`What is connected`,className:`m-0 flex list-none flex-col gap-1 p-0`,children:pFe(t.data.providers).map(e=>(0,h.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-3 text-small`,children:[(0,h.jsx)(`span`,{className:`w-16 shrink-0 font-semibold text-ink`,children:e.label}),(0,h.jsx)(KO,{tone:e.ready?`done`:`waiting`,children:e.ready?`Ready`:`Needs setup`}),(0,h.jsx)(`span`,{className:`min-w-0 text-ink-2`,children:e.text})]},e.label))})}function hFe(){let{api:e}=V(),t=I(rre(e));return(0,h.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[t.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-body text-danger`,children:t.error.message}),t.data===void 0?t.error===null?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(SFe,{cells:5}),(0,h.jsx)(CFe,{})]}):null:(0,h.jsx)(_Fe,{usage:t.data})]})}var gFe=[{id:`stage`,header:`Stage`,cell:e=>xA[e.stage]},{id:`model`,header:`Provider · model`,cell:e=>vFe(e)},{id:`in`,header:`Tokens in`,numeric:!0,cell:e=>w9.format(e.tokensIn)},{id:`out`,header:`Tokens out`,numeric:!0,cell:e=>w9.format(e.tokensOut)}];function _Fe({usage:e}){let t=Object.values(e.counters).every(e=>e===0);return(0,h.jsxs)(Q0,{split:`even`,children:[(0,h.jsxs)($0,{children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(Z$,{children:xFe(e).map(e=>(0,h.jsx)(Q$,{label:e.label,value:e.value},e.label))}),t?(0,h.jsx)(`p`,{className:`m-0 mt-3 text-body text-ink-2`,children:`Numbers appear after your first run.`}):null]}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`Machine ID ${e.machineId??`not made yet`} · Slopify ${e.appVersion}`})]}),(0,h.jsx)($0,{children:(0,h.jsx)(`div`,{className:`min-w-0 overflow-x-auto`,children:(0,h.jsx)(e1,{caption:`Tokens by stage`,columns:gFe,rows:e.byStage,rowKey:e=>`${e.stage}/${e.provider}/${e.model??``}`,empty:`No stages have run yet.`,className:`min-w-[480px] [&_td]:pr-4 [&_th]:pr-4`})})})]})}function vFe(e){return e.model===null?e.provider:`${e.provider} · ${e.model}`}var w9=new Intl.NumberFormat(void 0,{maximumFractionDigits:0}),yFe=new Intl.NumberFormat(void 0,{maximumFractionDigits:1}),bFe=new Intl.NumberFormat(void 0,{notation:`compact`,maximumFractionDigits:1});function xFe(e){let t=e.counters;return[{label:`Videos made`,value:w9.format(t.videosMade)},{label:`Hours of audio`,value:yFe.format(t.audioSeconds/3600)},{label:`Images made`,value:w9.format(t.imagesMade)},{label:`Tokens used`,value:t.tokensUsed<1e6?w9.format(t.tokensUsed):bFe.format(t.tokensUsed)},{label:`Projects`,value:w9.format(t.projects)}]}function SFe({cells:e}){return(0,h.jsx)(`div`,{className:`sl-stats`,children:Array.from({length:e},(e,t)=>t).map(e=>(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(`span`,{className:`h-8 w-20 rounded-control bg-sunken`}),(0,h.jsx)(`span`,{className:`h-3 w-24 rounded-control bg-sunken`})]},e))})}function CFe(){return(0,h.jsx)(`div`,{className:`border-t border-line`,children:[0,1,2,3].map(e=>(0,h.jsxs)(`div`,{className:`flex items-center gap-4 border-b border-line py-3`,children:[(0,h.jsx)(`span`,{className:`h-3 w-24 rounded-control bg-sunken`}),(0,h.jsx)(`span`,{className:`h-3 w-56 max-w-[40%] rounded-control bg-sunken`}),(0,h.jsx)(`span`,{className:`ml-auto h-3 w-20 rounded-control bg-sunken`}),(0,h.jsx)(`span`,{className:`h-3 w-20 rounded-control bg-sunken`})]},e))})}function wFe(e){let t=document.createElement(`a`);t.href=`${e}/api/diagnostics`,t.download=`slopify-diagnostics.json`,document.body.append(t),t.click(),t.remove()}function TFe({section:e=`providers`,note:t,onSection:n=()=>{},onNote:r=()=>{}}){let{api:i}=V(),a=_(),o=wv(),s=U7(),c=p9(),l=ik(e),u=tk.find(e=>e.id===l)??tk[0],d=ak(l);Xy({id:`settings.check-providers`,title:`Check all providers`,group:`Settings`,keywords:[`health`,`keys`,`signed in`],run:()=>{n(`providers`),s.mutate()}}),Xy({id:`settings.back-up-now`,title:`Back up now`,group:`Settings`,keywords:[`backup`],run:()=>{n(`storage`),c.mutate(void 0,{onError:e=>{o(`The backup didn't start: ${e.message} Open Settings → Backup & storage to see its state.`,`error`)}})}}),Xy({id:`settings.download-diagnostics`,title:`Download diagnostics`,group:`Settings`,keywords:[`support`,`bug report`],run:()=>{wFe(i.origin)}});let f=d.sections.map(e=>({id:e,label:tk.find(t=>t.id===e)?.label??e}));return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(EG,{crumb:`Settings`,title:u.label,meta:u.meta,actions:(0,h.jsxs)(h.Fragment,{children:[l===`providers`?(0,h.jsx)(B,{disabled:s.isPending,onClick:()=>s.mutate(),children:s.isPending?`Checking…`:`Check all`}):null,(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,h.jsxs)(zO,{variant:`secondary`,href:`${i.origin}/api/diagnostics`,download:`slopify-diagnostics.json`,children:[(0,h.jsx)(Vc,{"aria-hidden":`true`,strokeWidth:1.75}),`Download diagnostics`]}),(0,h.jsx)(U,{id:`settings.diagnostics`})]})]})}),(0,h.jsxs)(DG,{sections:(0,h.jsx)(Q3,{label:`Settings sections`,children:rk.map(e=>(0,h.jsx)(e6,{current:e.id===d.id,onClick:()=>n(e.sections[0]??`providers`),className:`whitespace-nowrap max-md:w-auto`,children:e.label},e.id))}),children:[f.length>1?(0,h.jsx)(pQ,{items:f,value:l,onChange:n,label:`${d.label} sections`,idPrefix:`settings`,className:`mb-6`}):null,(0,h.jsx)(mQ,{idPrefix:`settings`,id:l,active:!0,children:(0,h.jsxs)(`section`,{"aria-label":u.label,className:`flex min-w-0 flex-col gap-10`,children:[l===`providers`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(mFe,{}),(0,h.jsx)($2,{}),(0,h.jsx)(hPe,{}),(0,h.jsx)(aPe,{run:s})]}):null,l===`general`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(dFe,{}),(0,h.jsx)(Sre,{})]}):null,l===`voices`?(0,h.jsx)(bPe,{}):null,l===`models`?(0,h.jsx)($Ne,{}):null,l===`agents`?(0,h.jsx)(ZNe,{}):null,l===`playback`?(0,h.jsx)(uFe,{}):null,l===`notifications`?(0,h.jsx)(DPe,{}):null,l===`channel-links`?(0,h.jsx)(eSe,{}):null,l===`studio`?(0,h.jsx)(QB,{}):null,l===`storage`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(ZPe,{}),(0,h.jsx)(sFe,{usageQueryKey:h9}),(0,h.jsx)(iFe,{}),(0,h.jsx)(jPe,{})]}):null,l===`trash`?(0,h.jsx)(WPe,{}):null,l===`usage`?(0,h.jsx)(hFe,{}):null,l===`patch-notes`?(0,h.jsx)(PPe,{note:t,onNote:r}):null,l===`about`?(0,h.jsx)(YPe,{onWhatsNew:()=>{a.fetchQuery(FM(i)).then(e=>r(e.current??void 0),e=>{o(`The patch notes did not open: ${e instanceof Error?e.message:String(e)} Open Settings → About → Patch notes to try again.`,`error`)})}}):null]})})]})]})}function EFe({open:e,onClose:t,onInstalled:n}){let{api:r}=V(),i=_(),a=I({queryKey:Vv,queryFn:()=>Gv(r),enabled:e}),o=L({mutationFn:e=>qv(r,e),onSuccess:()=>n(),onSettled:()=>i.invalidateQueries({queryKey:Vv})});return(0,h.jsxs)(NM,{open:e,title:`Add a starter pack`,onClose:t,footer:(0,h.jsx)(WR,{tone:o.error||a.error?`error`:`success`,children:o.error?.message??a.error?.message??(o.data===void 0?void 0:o.data.added?`Added: its prompts are in Prompts and its template is in this list.`:`That pack was already added.`)}),children:[(0,h.jsxs)(`p`,{className:`mb-4 flex items-center gap-1 text-small text-ink-2`,children:[`Prompts, a suggested voice and a template for one kind of channel.`,(0,h.jsx)(U,{id:`welcome.packs`})]}),(0,h.jsxs)(mR,{label:`Starter packs`,className:`[&_.sl-row__meta]:whitespace-normal`,children:[(a.data?.packs??[]).map(e=>(0,h.jsx)(hR,{title:e.name,meta:e.summary,actions:(0,h.jsx)(B,{disabled:e.installed||o.isPending,onClick:()=>o.mutate(e.id),children:e.installed?`Added`:`Add pack`})},e.id)),a.data===void 0?(0,h.jsx)(hR,{title:`Loading packs…`}):null]})]})}function DFe({template:e}){let{api:t}=V(),n=I({queryKey:[...yO,e.id,e.version],queryFn:async()=>{let n=await wO(t,e.id);if(!n.ok)throw Error(n.message);return n.value}});if(n.error)return(0,h.jsxs)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:[`The keywords of `,e.name,` didn't load. `,n.error.message,` Press Keywords again.`]});if(!n.data)return(0,h.jsx)(`p`,{role:`status`,className:`m-0 text-small text-ink-2`,children:`Reading the keywords…`});let{form:r,librarySnapshot:i}=n.data.document,a=wQ({form:r,prompts:i?.prompts??[],entries:i?.entries??[]}),o=Q2(r.title),s=[...new Set([...a.keys(),...Object.keys(r.values)])];return(0,h.jsx)(MQ,{keywords:s.map(e=>({name:e,value:r.values[e]??``,feeds:a.get(e)??[],topic:o.includes(e)})),empty:`No keywords: the prompts and the title name none.`})}async function OFe(e,t,n,r){let i=await EO(e,t.id,{baseVersion:t.version,mutationId:r,...n});if(!i.ok)throw Error(i.message);return i.value}function kFe({template:e}){return e===void 0?(0,h.jsx)(`p`,{className:`m-0 py-3 text-small text-ink-2`,children:`Pick a template to see the keywords it fills.`}):(0,h.jsxs)(`section`,{"aria-label":`Keywords of ${e.name}`,className:`flex flex-col gap-4`,children:[(0,h.jsx)(Sy,{title:e.name,as:`h3`,info:`templates.edit`,className:`pb-0`,meta:(0,h.jsxs)(h.Fragment,{children:[`Version ${String(e.version)} · saved `,(0,h.jsx)(d0,{iso:e.updatedAt,children:s0(e.updatedAt)})]})}),(0,h.jsx)(DFe,{template:e}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`To change the settings, press Use in Play, change the draft, then Save a setup.`})]})}function AFe({template:e,onClose:t}){let{api:n}=V(),r=_(),i=Array.from({length:e.version},(t,n)=>e.version-n),a=rt({queries:i.map(t=>({queryKey:[...yO,e.id,`version`,t],queryFn:async()=>{let r=await wO(n,e.id,t);if(!r.ok)throw Error(r.message);return r.value},staleTime:1/0}))}),o=a[0]?.data,[s,c]=(0,m.useState)(i[1]??e.version),l=a[i.indexOf(s)]?.data,u=(0,m.useRef)(crypto.randomUUID()),d=wv(),f=L({mutationFn:t=>OFe(n,e,{name:t.name,document:t.document},u.current),onSuccess:async(n,i)=>{u.current=crypto.randomUUID(),d(`Restored version ${String(i.version)} of ${e.name} as version ${String(n.version)}.`,`success`),await r.invalidateQueries({queryKey:yO}),t()}}),p=a.find(e=>e.error!==null)?.error;return(0,h.jsx)(NM,{open:!0,title:`History of ${e.name}`,onClose:t,className:`sm:w-[min(1080px,100vw)]`,children:(0,h.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[p?(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-body text-danger`,children:`A version couldn't be read: ${p.message} Close History and open it again.`}):null,(0,h.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(Sy,{title:`Versions`,as:`h3`,info:`templates.history`}),(0,h.jsx)(mR,{label:`Versions of ${e.name}`,children:i.map((t,n)=>{let r=a[n]?.data;return(0,h.jsx)(hR,{title:`Version ${String(t)}`,selected:t===s,onSelect:()=>c(t),meta:r===void 0?`Loading…`:(0,h.jsxs)(h.Fragment,{children:[`${r.name} · `,(0,h.jsx)(d0,{iso:r.updatedAt,children:s0(r.updatedAt)})]}),actions:t===e.version?(0,h.jsx)(`span`,{className:`text-small text-ink-2`,children:`Current`}):(0,h.jsx)(B,{size:`small`,"aria-label":`Restore version ${String(t)}`,disabled:r===void 0||f.isPending,disabledReason:r===void 0?`Reading the version`:`Restoring`,onClick:()=>{r!==void 0&&f.mutate(r)},children:`Restore`})},t)})}),(0,h.jsx)(WR,{tone:`error`,children:f.error===null?void 0:`The version wasn't restored: ${f.error.message}`})]}),(0,h.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,h.jsx)(Sy,{title:`Compare with the current version`,as:`h3`}),o===void 0||l===void 0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Loading the versions…`}):l.version===o.version?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:e.version===1?`This is the only version so far.`:`Pick an older version in the list to compare it.`}):(0,h.jsxs)(h.Fragment,{children:[l.name===o.name?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Renamed from "${l.name}" to "${o.name}".`}),(0,h.jsx)(e0,{before:T9(l),after:T9(o),beforeLabel:`Version ${String(l.version)}`,afterLabel:`Version ${String(o.version)} (current)`})]})]})]})})}function T9(e){return JSON.stringify(e.document,null,1).split(`
|
|
324
|
+
`),[ae]));return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(EG,{title:`Projects`,meta:d.data===void 0?void 0:`${String(te.length)} ${te.length===1?`project`:`projects`} · ${u.channel?.name??`every channel`}`,actions:(0,h.jsxs)(LO,{to:`/play`,variant:`primary`,children:[(0,h.jsx)(pl,{"aria-hidden":`true`,strokeWidth:1.75}),`Create`]})}),d.data?.projects.length===0?(0,h.jsx)(bve,{}):null,d.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 mb-4 text-danger`,children:d.error.message}),d.data===void 0?d.error===null?(0,h.jsx)(LNe,{}):null:d.data.projects.length===0?(0,h.jsx)(hQ,{title:`No projects yet`,actions:(0,h.jsx)(LO,{to:`/play`,variant:`primary`,children:`Make your first video`}),children:`Set up a run on Play: pick a template, type a topic and start.`}):(0,h.jsxs)(Q0,{split:`aside`,children:[(0,h.jsxs)($0,{label:`Project list`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,h.jsxs)(`div`,{className:`relative w-full max-w-[320px]`,children:[(0,h.jsx)(_l,{"aria-hidden":`true`,strokeWidth:1.75,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-ink-3`}),(0,h.jsx)(`input`,{type:`search`,ref:N,"aria-label":`Search projects`,"aria-keyshortcuts":cb(P),placeholder:`Search projects`,value:C,onChange:e=>E(e.target.value),className:`sl-input pl-9`})]}),(0,h.jsx)(wy,{label:`Show`,value:y,options:P7,onChange:b,className:`max-w-full overflow-x-auto`}),(0,h.jsx)(bL,{"aria-label":`Sort projects`,className:`w-auto`,value:k,onChange:e=>{let t=I7.find(t=>t.value===e.currentTarget.value);t!==void 0&&A(t.value)},options:I7})]}),ie.length===0?(0,h.jsx)(`p`,{className:`m-0 text-ink-2`,children:te.length===0?`No projects in ${u.channel?.name??`this channel`} yet. Pick All channels in the rail to see the others.`:`No project matches. Clear the search or pick All.`}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`div`,{onKeyDown:oe.onKeyDown,className:`flex flex-col gap-4`,children:[(0,h.jsx)(TNe,{selection:oe,rows:ie,samples:S,...ie.length<te.length?{scope:`Select all ${String(ie.length)} shown`}:{}}),(u.channel===void 0&&u.channels.length>1?u.channels.map(e=>({channel:e,projects:ie.filter(t=>(t.channelId??u.channels[0]?.id)===e.id)})).filter(e=>e.projects.length>0):[{channel:void 0,projects:ie}]).map(e=>(0,h.jsxs)(`section`,{"aria-label":e.channel?.name??`Projects`,className:`flex flex-col gap-2`,children:[e.channel===void 0?null:(0,h.jsx)(Sy,{as:`h3`,size:`small`,title:e.channel.name,meta:`${String(e.projects.length)} ${e.projects.length===1?`project`:`projects`}`}),(0,h.jsx)(mR,{label:e.channel?.name??`Projects`,children:e.projects.map(e=>(0,h.jsx)(INe,{project:e,sample:S.has(e.id),check:(0,h.jsx)(MG,{selection:oe,value:e.id,label:e.title}),onDelete:()=>p(e),onUploaded:t=>F.mutate({project:e,uploaded:t}),busy:F.isPending},e.id))})]},e.channel?.id??`all`))]}),re.length>ie.length?(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(B,{size:`small`,onClick:()=>M(e=>e+50),children:`Show ${String(Math.min(50,re.length-ie.length))} more`}),(0,h.jsx)(`span`,{className:`text-small text-ink-2 tabular-nums`,children:`${String(ie.length)} of ${String(re.length)} shown`})]}):null]})]}),(0,h.jsxs)($0,{as:`aside`,label:`Projects at a glance`,children:[(0,h.jsxs)(`section`,{children:[(0,h.jsx)(Sy,{title:`At a glance`}),(0,h.jsx)(Z$,{children:P7.filter(e=>e.value!==`all`).map(e=>(0,h.jsx)(Q$,{label:e.label,value:String(te.filter(t=>F7(t,e.value)).length)},e.value))})]}),(0,h.jsxs)(`section`,{"aria-label":`Video queue`,className:`flex flex-col gap-2`,children:[(0,h.jsx)(Sy,{title:`Video queue`,info:`play.queue`}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Videos started together, in the order they run, are on the calendar.`}),(0,h.jsx)(`div`,{children:(0,h.jsx)(RO,{to:`/calendar`,children:`Open calendar`})})]})]})]}),ee.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`mt-3 text-small text-danger`,children:ee.error.message}),(0,h.jsx)(Bv,{open:f!==void 0,title:f===void 0?``:`Delete "${f.title}"?`,consequence:`Moves the project to the trash for 30 days. Undo brings it back, or restore it later in Settings → Backup & storage → Trash.`,confirmLabel:`Delete project`,cancelLabel:`Keep it`,pending:ee.isPending,onConfirm:()=>{f!==void 0&&ee.mutate(f)},onCancel:()=>p(void 0)})]})}var zNe=`Prepare restrained delivery cues for a documentary narrator. Let the facts carry the scene. Use a measured pace and make only occasional changes where the supplied wording clearly calls for emphasis, reflection or tension. Prefer no cue to an unnecessary cue. Avoid theatrical emotion, invented reactions and routine laughter or sighs. Never rewrite, summarize, translate or add spoken words. Return only the cue annotations required by the supplied format contract.`;function z7({promptId:e,kind:t,from:n,onLeave:r}){let{api:i}=V(),a=_(),o=nj(),s=I(uy(i)),c=(0,m.useId)(),l=(0,m.useId)(),u=(0,m.useId)(),[d,f]=Tj(JSON.stringify(e===void 0?[`new`,t,n??null]:[`prompt`,e])),[p,g]=(0,m.useState)([]),[v,y]=(0,m.useState)(void 0),b=v!==void 0,[x,S]=(0,m.useState)(!1),[C,w]=(0,m.useState)(!1),T=s.data?.prompts,E=e??n,D=E===void 0?void 0:T?.find(e=>e.id===E),O=D===void 0?{kind:t,name:``,body:``}:e===void 0?{kind:D.kind,name:`${D.name} copy`,body:D.body}:{kind:D.kind,name:D.name,body:D.body},k=d??v??O,A=L({mutationFn:t=>Rs(i,t,e),onSuccess:async(e,t)=>{if(!e.ok){g(e.fields);return}y(e.value),f(e=>e===t?void 0:e),o({type:`prompt-saved`,id:e.value.id,kind:e.value.kind}),await a.invalidateQueries({queryKey:uy(i).queryKey})}}),j=L({mutationFn:e=>Bs(i,e),onSuccess:async()=>{S(!1),f(void 0),await a.invalidateQueries({queryKey:uy(i).queryKey}),r(k.kind)}}),M=L({mutationFn:({id:e,on:t})=>zs(i,e,t),onSettled:async()=>{await a.invalidateQueries({queryKey:uy(i).queryKey})}});n1(b,()=>{r(k.kind)});let N=(e,t)=>{f(e),g(e=>e.filter(e=>e.field!==t))},P=U0(k,p),ee=W0(P),F=q0(k.body),te=k.body.trim()===``?[]:G0(P),ne=k.name.trim()===``?[]:K0(P);return tj({promptNamed:k.name.trim()!==``&&ne.length===0,promptBodyReady:k.body.trim()!==``&&te.length===0,promptHasKeywords:F.length>0&&te.length===0,promptSaveReady:ee===void 0&&!A.isPending&&!b,promptSaving:A.isPending||b,promptIsArticle:k.kind===`article`,promptIsImage:k.kind===`image`}),s.error===null?E!==void 0&&T===void 0?(0,h.jsx)(a1,{}):E!==void 0&&D===void 0?(0,h.jsx)(V7,{kind:t,children:`That prompt is gone. It may have been deleted in another tab.`}):(0,h.jsxs)(`div`,{children:[(0,h.jsx)(EG,{crumb:(0,h.jsx)(w1,{children:(0,h.jsx)(fa,{to:`/prompts`,search:{kind:k.kind},children:`Prompts`})}),title:e===void 0?`New prompt`:`Edit prompt`,meta:`${Hb(k.kind)} prompt`}),(0,h.jsxs)(`div`,{"data-tour":`prompt-editor`,className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 lg:grid-cols-[minmax(0,1fr)_360px]`,children:[(0,h.jsxs)(`div`,{className:`${S1} flex min-w-0 flex-col gap-4`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-end gap-4`,children:[(0,h.jsx)(`div`,{"data-tour":`prompt-name`,className:`min-w-[min(100%,240px)] flex-1`,children:(0,h.jsx)(_L,{label:`Name`,tip:`library.prompt.name`,...ne.length===0?{}:{error:ne.map(e=>e.message).join(` `)},children:(0,h.jsx)(X,{value:k.name,onChange:e=>{N({...k,name:e.target.value},`name`)}})})}),(0,h.jsx)(B0,{label:`Kind`,value:k.kind,options:Vb,tip:`library.prompt.kind`,onPick:e=>{N({...k,kind:e},`name`)}})]}),(0,h.jsxs)(`div`,{"data-tour":`prompt-body`,...xy,children:[(0,h.jsxs)(`div`,{className:`mb-1 flex min-h-8 items-end justify-between gap-3`,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(`label`,{htmlFor:c,className:`sl-field__label`,children:`Body`}),(0,h.jsx)(U,{id:BNe[k.kind],label:`${Hb(k.kind)} prompt body`,className:`-my-1`})]}),B7(k.kind)?(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(B,{variant:`quiet`,size:`small`,onClick:()=>{let e=B7(k.kind);e!==void 0&&(k.body.trim()===``?N({...k,body:e.body},`body`):w(!0))},children:B7(k.kind)?.label}),(0,h.jsx)(U,{id:`library.prompt.starter`,label:B7(k.kind)?.label})]}):null]}),(0,h.jsx)(Y0,{id:c,value:k.body,invalid:te.length>0,describedBy:te.length===0?void 0:l,onChange:e=>{N({...k,body:e},`body`)}})]}),k.kind===`image`?(0,h.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e!==void 0&&D?.kind===`image`?(0,h.jsx)(Cy,{checked:M.isPending?M.variables.on:D.photorealistic===!0,disabled:M.isPending,onChange:t=>M.mutate({id:e,on:t}),label:`Draws photorealistic pictures`,tip:`library.prompt.photorealistic`}):(0,h.jsxs)(`span`,{className:`flex items-center gap-1 text-small text-ink-2`,children:[`Save this Image prompt first, then choose whether it draws photorealistic pictures.`,(0,h.jsx)(U,{id:`library.prompt.photorealistic`})]}),M.error===null?null:(0,h.jsx)(`span`,{role:`alert`,className:`text-small text-danger`,children:`Couldn't change Draws photorealistic pictures: ${M.error.message} Press the switch again.`})]}):null,(0,h.jsx)(`div`,{"data-tour":`prompt-save`,children:(0,h.jsx)(i1,{onDelete:e===void 0?void 0:()=>{S(!0)},blocked:ee,blockedId:u,pending:A.isPending,saved:b,cancel:(0,h.jsx)(LO,{to:`/prompts`,search:{kind:k.kind},onClick:()=>{f(void 0)},variant:`secondary`,children:`Cancel`}),errors:[A.error,j.error].flatMap(e=>e===null?[]:[e.message]),onSave:()=>{A.mutate(k)}})})]}),(0,h.jsx)(`div`,{"data-tour":`prompt-slots`,className:C1,children:(0,h.jsx)(F0,{slots:F,body:k.body,lint:te,lintId:l})})]}),(0,h.jsx)(Bv,{open:C,title:`Replace this prompt body?`,consequence:`The starter replaces the text in this editor. Nothing is saved until you choose Save.`,confirmLabel:`Use starter`,tone:`primary`,onConfirm:()=>{let e=B7(k.kind);e!==void 0&&N({...k,body:e.body},`body`),w(!1)},onCancel:()=>w(!1)}),(0,h.jsx)(Bv,{open:x,title:`Delete "${k.name}"?`,consequence:`Moves it to the trash for 30 days (Settings → Trash). Projects that used it keep their text.`,confirmLabel:`Delete prompt`,pending:j.isPending,onConfirm:()=>{e!==void 0&&j.mutate(e)},onCancel:()=>{S(!1)}})]}):(0,h.jsx)(V7,{kind:k.kind,children:s.error.message})}var BNe={article:`library.prompt.body.article`,image:`library.prompt.body.image`,thumbnail:`library.prompt.body.thumbnail`,narration:`library.prompt.body.narration`,description:`library.prompt.body.description`,shorts:`library.prompt.body.shorts`,review:`library.prompt.body.review`,script:`library.prompt.body.script`};function B7(e){if(e===`narration`)return{label:`Use Documentary Starter`,body:zNe};if(e===`description`)return{label:`Use Built-in Starter`,body:LR};if(e===`shorts`)return{label:`Use Built-in Starter`,body:ile}}function V7({kind:e,children:t}){return(0,h.jsx)(T1,{back:(0,h.jsx)(fa,{to:`/prompts`,search:{kind:e},children:`Back to Prompts`}),children:t})}function VNe({kind:e,onKind:t,onUseInPlay:n,playBlocked:r}){let{api:i}=V(),a=_(),o=I(uy(i)),[s,c]=(0,m.useState)(``),l=(0,m.useRef)(null),u=Zy(l,`prompts`),[d,f]=pL(),[p,g]=Y1(`prompt`),[v,y]=(0,m.useState)(void 0),[b,x]=(0,m.useState)(void 0),S=L({mutationFn:e=>Bs(i,e),onSettled:async()=>{y(void 0),await a.invalidateQueries({queryKey:H.prompts})}}),C=async(e,t)=>{let n=await Rs(i,{kind:e.kind,name:t,body:e.body},e.id);return await a.invalidateQueries({queryKey:H.prompts}),n.ok?null:N0(n.fields)},w=o.data?.prompts.filter(t=>t.kind===e),T=s.trim().toLowerCase(),E=T===``?w:w?.filter(e=>e.name.toLowerCase().includes(T)||e.body.toLowerCase().includes(T)),D=E===void 0?void 0:q1(E,p),O=D?.find(e=>e.id===d)??D?.[0],k=o.data?.prompts??[],A=AG(D?.map(e=>e.id)??[]),j=D?.filter(e=>A.has(e.id))??[],M=C0({noun:[`prompt`,`prompts`],listKey:H.prompts,all:k,groupOf:e=>e.kind,nameMax:200,duplicate:async(e,t)=>w0(await Rs(i,{kind:e.kind,name:t,body:e.body},void 0)),remove:e=>Bs(i,e.id),trash:`prompt`,selection:A}),N=A0({section:`prompts`,pack:e=>({prompts:e}),stem:`prompts`,noun:[`prompt`,`prompts`],listKey:H.prompts,existing:k,groupOf:e=>e.kind,nameMax:200,save:e=>Rs(i,e,void 0)});return(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(j0,{action:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(f0,{what:`prompts`,disabled:o.data===void 0||N.importing,exports:[{label:`Export all ${l0(k.length,`prompt`)}`,run:()=>N.exportItems(k),disabled:k.length===0}],accept:`.json,application/json`,onFile:N.importFile}),(0,h.jsx)(UNe,{kind:e})]}),children:[(0,h.jsx)(X,{type:`search`,ref:l,"aria-label":`Search prompts`,"aria-keyshortcuts":cb(u),placeholder:`Search prompts`,value:s,className:`w-full min-w-0 sm:w-64`,onChange:e=>c(e.target.value)}),(0,h.jsxs)(`span`,{className:`flex w-full items-center gap-1 sm:w-auto`,...xy,children:[(0,h.jsx)(bL,{"aria-label":`Prompt kind`,value:e,className:`w-full sm:w-56`,options:Vb,onChange:e=>{let n=Vb.find(t=>t.value===e.target.value);n!==void 0&&t(n.value)}}),(0,h.jsx)(U,{id:`library.prompt.kind`})]}),(0,h.jsx)(X1,{what:`prompts`,sort:p,onSort:g})]}),o.error===null?null:(0,h.jsx)(W1,{what:`prompts`,message:o.error.message,onRetry:()=>void o.refetch()}),D===void 0||w===void 0?o.error===null?(0,h.jsx)(U1,{label:`Prompts`}):null:w.length===0?(0,h.jsxs)(hQ,{title:`No ${Hb(e).toLowerCase()} prompts yet`,children:[`A prompt is text with `,`{{keywords}}`,`; each keyword becomes a field on Play.`]}):(0,h.jsx)(OG,{className:V1,list:D.length===0?(0,h.jsx)(`p`,{className:`m-0 py-3 text-small text-ink-2`,children:`No ${Hb(e).toLowerCase()} prompts match "${s.trim()}".`}):(0,h.jsxs)(P1,{selection:A,children:[(0,h.jsx)(N1,{selection:A,total:D.length,noun:[`prompt`,`prompts`],scope:T===``?void 0:`Select all ${String(D.length)} shown`,busy:M.busy,onDuplicate:()=>M.duplicate(j),onExport:()=>N.exportItems(j),onDelete:()=>M.remove(j)}),(0,h.jsx)(mR,{label:`Prompts`,children:D.map(e=>(0,h.jsx)(hR,{className:H1,lead:(0,h.jsx)(MG,{selection:A,value:e.id,label:e.name}),title:(0,h.jsx)(P0,{name:e.name,onSelect:()=>f(e.id),onRename:t=>C(e,t)}),meta:HNe(e),selected:e.id===O?.id,actions:(0,h.jsx)(G1,{name:e.name,edit:(0,h.jsx)(LO,{to:`/prompts/$promptId`,params:{promptId:e.id},"aria-label":`Edit ${e.name}`,variant:`quiet`,size:`small`,children:`Edit`}),duplicate:(0,h.jsx)(LO,{to:`/prompts/new`,search:{kind:e.kind,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:()=>x(e),onDelete:()=>y(e)})},e.id))})]}),detail:O===void 0?null:(0,h.jsx)(c0,{item:`prompt`,id:O.id,name:O.name,kicker:`${Hb(O.kind)} prompt`,meta:(0,h.jsxs)(h.Fragment,{children:[`Updated `,(0,h.jsx)(d0,{iso:O.updatedAt})]}),body:O.body,slots:O.slots,actions:(0,h.jsx)(LO,{to:`/prompts/$promptId`,params:{promptId:O.id},size:`small`,children:`Edit prompt`}),onOpenHistory:()=>x(O)},O.id)}),S.error===null?null:(0,h.jsx)(GM,{tone:`danger`,title:`The prompt wasn't deleted.`,className:`mt-4`,children:S.error.message}),b===void 0?null:(0,h.jsx)(i0,{item:`prompt`,id:b.id,name:b.name,onClose:()=>x(void 0)},b.id),(0,h.jsx)(Bv,{open:v!==void 0,title:v===void 0?``:`Delete "${v.name}"?`,consequence:`Moves it to the trash for 30 days (Settings → Trash). Projects that used it keep their text.`,confirmLabel:`Delete prompt`,pending:S.isPending,onConfirm:()=>{v!==void 0&&S.mutate(v.id)},onCancel:()=>y(void 0)})]})}function HNe(e){return(0,h.jsxs)(h.Fragment,{children:[`${Hb(e.kind)} · ${l0(e.slots.length,`keyword`)} · updated `,(0,h.jsx)(d0,{iso:e.updatedAt})]})}function UNe({kind:e}){return(0,h.jsx)(LO,{to:`/prompts/new`,search:{kind:e},variant:`primary`,children:`New prompt`})}var WNe=`/mcp`;function GNe(e){return`${e.replace(/\/+$/,``)}${WNe}`}function KNe(e){return`claude mcp add --transport http slopify ${e}`}function qNe(e){return`[mcp_servers.slopify]\nurl = "${e}"`}J({projectIds:q(G()).optional(),projectId:G().optional()}).loose();var JNe=[`agent-connection`],YNe=J({lastConnectedAt:G().nullable(),recent:q(J({id:G(),title:G(),subject:G().nullable(),createdAt:G()}))});async function XNe(e){let t=await e.fetch(`${e.origin}/api/settings/agents`);if(!t.ok)throw po(t,await mo(t));return So(YNe,await t.json())}function ZNe(){let{api:e}=V(),t=wv(),n=I({queryKey:JNe,queryFn:()=>XNe(e)}),r=GNe(e.origin),i=[{label:`Claude Code`,where:`Run it once in a terminal.`,text:KNe(r)},{label:`Codex`,where:`Add it to ~/.codex/config.toml.`,text:qNe(r)}],a=async e=>{await Hz(e.text)?t(`${e.label} setup copied. ${e.where}`,`success`):t(`The ${e.label} setup wasn't copied: this browser blocked the clipboard. Select the line and copy it yourself.`,`error`)};return(0,h.jsxs)(`div`,{className:`flex max-w-prose flex-col gap-4`,...xy,children:[(0,h.jsx)(Sy,{title:`Agents (MCP)`,info:`settings.agents`}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`span`,{className:`text-small font-semibold`,children:`MCP address`}),(0,h.jsx)(`code`,{className:`sl-code py-2 select-all`,children:r})]}),i.map(e=>(0,h.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`span`,{className:`text-small font-semibold`,children:e.label}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[(0,h.jsx)(`code`,{className:`sl-code min-w-0 flex-1 basis-[220px] py-2 whitespace-pre-wrap select-all`,children:e.text}),(0,h.jsxs)(B,{variant:`quiet`,"aria-label":`Copy the ${e.label} setup`,onClick:()=>void a(e),children:[(0,h.jsx)(Bc,{"aria-hidden":`true`,className:`size-[14px] shrink-0`}),`Copy`]})]}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:e.where})]},e.label)),(0,h.jsx)(JL,{query:n,what:`Agent activity`,loading:(0,h.jsx)(GL,{label:`Loading agent activity…`,rows:3,rowClassName:`h-5`}),children:e=>(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:e.lastConnectedAt===null?`No agent has connected yet.`:(0,h.jsxs)(h.Fragment,{children:[`Last connected`,` `,(0,h.jsx)(d0,{iso:e.lastConnectedAt,children:vd(e.lastConnectedAt)}),`.`]})}),(0,h.jsxs)(`section`,{"aria-label":`What agents did`,className:`flex flex-col gap-1`,children:[(0,h.jsx)(`h3`,{className:`m-0 text-title-3`,children:`What agents did`}),e.recent.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`No agent has changed anything yet.`}):(0,h.jsx)(`ul`,{className:`m-0 list-none space-y-1 p-0 text-small text-ink-2`,children:e.recent.map(e=>(0,h.jsxs)(`li`,{children:[e.title,e.subject===null?``:` · ${e.subject}`,` ·`,` `,(0,h.jsx)(d0,{iso:e.createdAt,children:vd(e.createdAt)})]},e.id))})]})]})})]})}var QNe={template:`Template`,schedule:`Schedule`,draft:`Draft`,project:`Project`};function H7(e){let t=[e.added.length>0?`${e.added.length} new`:null,e.priced.length>0?`${e.priced.length} repriced`:null,e.retired.length>0?`${e.retired.length} retired`:null].filter(e=>e!==null);return t.length===0?`No changes`:t.join(`, `)}function $Ne(){let{api:e}=V(),t=_(),n=wv(),r=I({queryKey:Oz.catalogue,queryFn:()=>Mz(e),refetchInterval:3e4}),i=I({queryKey:Oz.retired,queryFn:()=>Fz(e)}),a=async()=>{await Promise.all([t.invalidateQueries({queryKey:[`provider-models`]}),t.invalidateQueries({queryKey:Oz.retired})])},o=L({mutationFn:()=>Nz(e),onSuccess:async e=>{t.setQueryData(Oz.catalogue,e),n(e.sync?.warning??`Model list checked: ${H7(e.sync?.changes??ePe)}.`,e.sync?.warning?`error`:`success`),await a()}}),s=L({mutationFn:()=>Pz(e),onSuccess:async e=>{n(`Catalogue replaced with the published file.`,`success`),t.setQueryData(Oz.catalogue,e),await a()}}),c=async()=>{await Promise.all([t.invalidateQueries({queryKey:Oz.retired}),t.invalidateQueries({queryKey:yO}),t.invalidateQueries({queryKey:pT}),t.invalidateQueries({queryKey:[`play-drafts`]}),t.invalidateQueries({queryKey:[`projects`]}),t.invalidateQueries({queryKey:[`project`]})])},l=L({mutationFn:t=>Iz(e,t),onSuccess:c}),u=L({mutationFn:()=>Lz(e),onSuccess:async e=>{n(e.failed.length===0?`Switched ${e.switched} ${e.switched===1?`use`:`uses`}.`:`Switched ${e.switched}; ${e.failed.length} could not be switched: ${e.failed[0]?.message??``}`,e.failed.length===0?`success`:`error`),await c()}}),d=r.data?.sync,f=i.data??[],p=f.filter(e=>e.blocked===null&&e.replacement!==null),m=o.error?.message??s.error?.message??r.error?.message??r.data?.warning??d?.warning??null;return Xy({id:`settings.check-models`,title:`Check for new models`,group:`Settings`,context:`Models`,keywords:[`catalogue`,`prices`,`retired`],run:()=>{!o.isPending&&r.data?.path&&o.mutate()}}),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(Sy,{title:`Model catalogue`,info:`settings.models.catalogue`,children:[(0,h.jsx)(B,{disabled:o.isPending||!r.data?.path,onClick:()=>o.mutate(),children:o.isPending?`Checking…`:`Check now`}),(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,h.jsx)(B,{variant:`quiet`,disabled:s.isPending||!r.data?.path,onClick:()=>s.mutate(),children:s.isPending?`Replacing…`:`Replace with published file`}),(0,h.jsx)(U,{id:`settings.models.replace`})]})]}),(0,h.jsxs)(`dl`,{className:`m-0 grid gap-x-6 border-t border-line text-small sm:grid-cols-[160px_minmax(0,1fr)]`,children:[(0,h.jsx)(`dt`,{className:`pt-3 font-semibold text-ink sm:border-b sm:border-line sm:pb-3`,children:`Catalogue file`}),(0,h.jsx)(`dd`,{className:`m-0 min-w-0 border-b border-line pb-3 break-all font-mono text-ink-2 sm:pt-3`,children:r.data?.path??`Not available`}),(0,h.jsx)(`dt`,{className:`pt-3 font-semibold text-ink sm:border-b sm:border-line sm:pb-3`,children:`Verified`}),(0,h.jsx)(`dd`,{className:`m-0 border-b border-line pb-3 text-ink-2 sm:pt-3`,children:r.data?.updatedAt??`date unavailable`}),(0,h.jsx)(`dt`,{className:`pt-3 font-semibold text-ink sm:border-b sm:border-line sm:pb-3`,children:`Last checked`}),(0,h.jsx)(`dd`,{className:`m-0 border-b border-line pb-3 text-ink-2 sm:pt-3`,children:d?.checkedAt?`${vd(d.checkedAt)} · ${H7(d.changes)}`:`Not checked yet`})]}),d!==void 0&&d.changes.retired.length+d.changes.added.length>0?(0,h.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1 text-small text-ink-2`,children:[d.changes.added.length>0?(0,h.jsxs)(`span`,{children:[`New: `,d.changes.added.map(e=>e.name).join(`, `)]}):null,d.changes.retired.length>0?(0,h.jsxs)(`span`,{children:[`Retired: `,d.changes.retired.map(e=>e.name).join(`, `)]}):null]}):null,m===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 mt-3 text-body text-danger`,children:m})]}),(0,h.jsxs)(`section`,{"aria-label":`Retired models in use`,children:[(0,h.jsx)(Sy,{title:`Retired models in use`,info:`settings.models.retired`,children:(0,h.jsx)(B,{variant:`primary`,disabled:u.isPending||p.length===0,onClick:()=>u.mutate(),children:u.isPending?`Switching…`:`Switch all`})}),i.error?(0,h.jsx)(`p`,{role:`alert`,className:`m-0 mb-2 text-body text-danger`,children:i.error.message}):null,l.error?(0,h.jsx)(`p`,{role:`alert`,className:`m-0 mb-2 text-body text-danger`,children:l.error.message}):null,f.length===0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:i.isPending?`Looking…`:`Nothing uses a retired model.`}):(0,h.jsx)(`ul`,{"aria-label":`Retired models in use`,className:`sl-list m-0 list-none p-0`,children:f.map(e=>(0,h.jsxs)(`li`,{className:`sl-row max-sm:grid-cols-1`,children:[(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsxs)(`p`,{className:`m-0`,children:[(0,h.jsx)(`span`,{className:`sl-kicker`,children:QNe[e.kind]}),` `,(0,h.jsx)(`span`,{className:`font-semibold`,children:e.name})]}),(0,h.jsxs)(`p`,{className:`m-0 text-small text-ink-2`,children:[t$[e.slot],`: `,e.model,` (`,e.why===`retired`?`retired`:`no longer listed`,`)`]}),e.blocked===null?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-waiting`,children:e.blocked})]}),(0,h.jsx)(Sv,{children:(0,h.jsx)(B,{size:`small`,disabled:e.blocked!==null||e.replacement===null||l.isPending,onClick:()=>l.mutate(e),children:e.replacement===null?`No replacement`:`Switch to ${e.replacement.name}`})})]},e.key))})]})]})}var ePe={added:[],retired:[],priced:[]},tPe={ok:`Ready`,warning:`Check`,problem:`Needs fixing`,unused:`Not set up`},nPe={ok:`done`,warning:`waiting`,problem:`failed`,unused:`off`},rPe={ok:`text-ink-2`,warning:`text-waiting`,problem:`text-danger`,skipped:`text-ink-3`};function U7(){let{api:e}=V();return L({mutationFn:()=>jz(e)})}function iPe(e){let{api:t}=V(),[n,r]=(0,m.useState)({byId:new Map});return{one:L({mutationFn:e=>jz(t,e),onSuccess:t=>{r(n=>{let r=new Map(n.after===e?n.byId:[]);for(let e of t.providers)r.set(e.id,e);return{after:e,byId:r}})}}),latest:t=>n.after===e?n.byId.get(t.id)??t:t}}function aPe({run:e}={}){let t=U7(),n=e??t,r=n.data,i=iPe(r?.checkedAt),a=r?.providers.filter(e=>e.state!==`unused`).map(i.latest)??[],o=r?.providers.filter(e=>e.state===`unused`)??[];return(0,h.jsxs)(`section`,{"aria-label":`Health check`,children:[(0,h.jsx)(Sy,{title:`Health check`,info:`settings.health`,children:e===void 0?(0,h.jsx)(B,{disabled:n.isPending,onClick:()=>{n.mutate()},children:n.isPending?`Checking…`:`Check all`}):void 0}),n.error===null?null:(0,h.jsxs)(`p`,{role:`alert`,className:`m-0 mb-2 text-body text-danger`,children:[`The health check didn't finish: `,n.error.message,` Press Check all to try again.`]}),i.one.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 mb-2 text-body text-danger`,children:`The check didn't finish: ${i.one.error.message} Press Check again on the provider to try again.`}),r===void 0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:n.isPending?`Checking every provider…`:`Not checked yet.`}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`ul`,{"aria-label":`Health by provider`,className:`sl-list m-0 list-none p-0`,children:a.map(e=>(0,h.jsxs)(`li`,{className:`sl-row grid-cols-1 gap-1`,children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,h.jsx)(`span`,{className:`sl-row__title`,children:e.displayName}),(0,h.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(KO,{tone:nPe[e.state],children:tPe[e.state]}),(0,h.jsx)(B,{variant:`quiet`,size:`small`,"aria-label":`Check ${e.displayName} again`,disabled:i.one.isPending,onClick:()=>{i.one.mutate(e.id)},children:i.one.isPending&&i.one.variables===e.id?`Checking…`:`Check again`})]})]}),(0,h.jsx)(`ul`,{className:`m-0 list-none space-y-1 p-0`,children:e.checks.map(e=>(0,h.jsxs)(`li`,{className:z(`text-small`,rPe[e.state]),children:[(0,h.jsxs)(`span`,{className:`font-semibold`,children:[e.label,`:`]}),` `,e.detail]},e.label))})]},e.id))}),(0,h.jsx)(`p`,{className:`m-0 mt-3 text-small text-ink-2`,children:o.length===0?`Checked at ${new Date(r.checkedAt).toLocaleTimeString()}.`:`Not set up and not used anywhere: ${o.map(e=>e.displayName).join(`, `)}.`})]})]})}var W7={openrouter:`settings.provider.openrouter`,"claude-code":`settings.provider.claude-code`,codex:`settings.provider.codex`,gemini:`settings.provider.gemini`,elevenlabs:`settings.provider.elevenlabs`,"openai-tts":`settings.provider.openai-tts`,cartesia:`settings.provider.cartesia`,inworld:`settings.provider.inworld`,"system-voice":`settings.provider.system-voice`,"google-tts":`settings.provider.google-tts`,fal:`settings.provider.fal`,replicate:`settings.provider.replicate`,"openai-image":`settings.provider.openai-image`,"google-image":`settings.provider.google-image`,"codex-image":`settings.provider.codex-image`};function G7(e){return dk(e)?{tone:`done`,word:`Ready`}:e.installed?{tone:`waiting`,word:`Needs attention`}:{tone:`off`,word:`Not found`}}function oPe({provider:e,readiness:t,kind:n}){let{api:r}=V(),i=_(),a=(0,m.useId)(),[o,s]=(0,m.useState)(void 0),[c,l]=(0,m.useState)(!1),u=e.cliPath?.configured??null,d=e.cliPath?.managedOnHost===!0,f=e.id===`claude-code`?`claude`:e.id===`codex-image`?`codex`:e.id===`gemini`?`agy`:e.id,p=e.cliPath?.command??f,g=o??u??``,v=dk(t),y=L({mutationFn:t=>$o(r,e.id,t),onMutate:()=>l(!1),onSuccess:async e=>{i.setQueryData(H.providers,t=>t?{...t,providers:t.providers.map(t=>t.id===e.id?e:t)}:void 0),s(void 0),l(!0),await i.invalidateQueries({queryKey:H.providers})}});(0,m.useEffect)(()=>{if(!c)return;let e=setTimeout(()=>l(!1),t1);return()=>clearTimeout(e)},[c]);let[b,x]=(0,m.useState)(!1),S=(0,m.useId)();return(0,h.jsxs)(`section`,{"aria-labelledby":a,"data-ready":v,className:`flex min-w-0 flex-col gap-5`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`h3`,{id:a,className:`sl-section-head__title`,children:e.displayName}),(0,h.jsx)(U,{id:W7[e.id],label:e.displayName})]}),(0,h.jsxs)(`p`,{className:`sl-section-head__meta`,children:[n,` · command line, no key needed`]})]}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsxs)(`p`,{className:`m-0 flex min-w-0 items-center gap-2`,"aria-live":`polite`,children:[(0,h.jsx)(GO,{tone:G7(t).tone}),(0,h.jsx)(`span`,{className:`min-w-0 break-words`,children:sPe(t,u)})]}),(0,h.jsxs)(`p`,{className:`m-0 flex min-w-0 items-center gap-2 text-small text-ink-2`,children:[(0,h.jsx)(`span`,{children:`Command`}),(0,h.jsx)(xL,{className:`min-w-0 truncate`,title:p,children:p})]})]}),(0,h.jsxs)(Sv,{children:[d?(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-small text-ink-2`,children:[`Managed on host`,(0,h.jsx)(U,{id:`settings.cli.managed-on-host`})]}):(0,h.jsx)(B,{"aria-expanded":b,"aria-controls":S,onClick:()=>x(e=>!e),children:b?`Close path`:`Change path`}),(0,h.jsx)(`span`,{className:`inline-flex w-[52px]`,children:c?(0,h.jsx)(r1,{}):null})]}),d||!b?null:(0,h.jsx)(`form`,{id:S,onSubmit:e=>{e.preventDefault(),y.isPending||y.mutate(g)},children:(0,h.jsx)(_L,{label:`Executable path`,tip:`settings.cli.path`,help:(0,h.jsxs)(h.Fragment,{children:[`Leave blank to find `,(0,h.jsx)(xL,{children:f}),` on PATH. Use an absolute path without quotes or arguments.`]}),error:y.error?.message,children:(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(X,{autoComplete:`off`,spellCheck:!1,maxLength:4096,"aria-label":`${e.displayName} Executable path`,className:`min-w-0 flex-1 basis-[220px]`,placeholder:f,value:g,disabled:y.isPending,onChange:e=>{s(e.target.value),l(!1),y.reset()}}),(0,h.jsx)(B,{type:`submit`,variant:`primary`,"aria-label":`Save ${e.displayName} path`,disabled:y.isPending,children:y.isPending?`Checking…`:`Save path`})]})})})]})}function sPe(e,t){return e.issue===void 0?e.installed?e.version===void 0?`Installed`:`Installed, version ${e.version}`:t===null?`Not found in the folders your terminal searches (PATH)`:`Not found at the saved path`:e.issue}var cPe=[`providers`,`system-voice`,`voices`];async function K7(e){return R(await e.fetch(`${e.origin}/api/providers/system-voice/voices`))}function q7(e=!0){let{api:t}=V();return I({queryKey:cPe,queryFn:()=>K7(t),enabled:e})}function J7(e){return e.available?{tone:`done`,word:`Ready`}:{tone:`off`,word:`Not found`}}function lPe({provider:e,readiness:t}){let n=(0,m.useId)(),r=q7(t.available).data?.engines??[];return(0,h.jsxs)(`section`,{"aria-labelledby":n,"data-ready":t.available,className:`flex min-w-0 flex-col gap-5`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`h3`,{id:n,className:`sl-section-head__title`,children:e.displayName}),(0,h.jsx)(U,{id:W7[e.id],label:e.displayName})]}),(0,h.jsx)(`p`,{className:`sl-section-head__meta`,children:`Speech · built into this computer, no key needed`})]}),(0,h.jsxs)(`p`,{className:`m-0 flex min-w-0 items-center gap-2`,"aria-live":`polite`,children:[(0,h.jsx)(GO,{tone:J7(t).tone}),(0,h.jsx)(`span`,{className:`min-w-0 break-words`,children:t.available?`Found ${t.engine??`a speech program`}. Narration with it is free; a keyed voice (ElevenLabs, OpenAI) sounds better.`:t.issue??`No speech program was found on this computer.`})]}),r.length===0?null:(0,h.jsx)(`ul`,{className:`m-0 list-none p-0 text-small text-ink-2`,children:r.map(e=>{let t=e.voices.length;return(0,h.jsx)(`li`,{children:`${e.name}: ${t} voice${t===1?``:`s`}`},e.id)})}),t.available?(0,h.jsx)(Sv,{children:(0,h.jsx)(LO,{to:`/settings`,search:{section:`voices`},children:`Add a system voice`})}):null]})}function uPe({value:e,onPick:t}){let{api:n}=V(),r=q7(),i=r.data?.engines??[],a=i.find(t=>t.voices.some(t=>t.id===e)),[o,s]=(0,m.useState)(``),c=(0,m.useId)(),l=o.trim().toLowerCase(),u=i.reduce((e,t)=>e+t.voices.length,0),d=t=>l===``||t.id===e||`${t.name} ${t.language??``}`.toLowerCase().includes(l),[f,p]=(0,m.useState)(void 0);(0,m.useEffect)(()=>()=>{f!==void 0&&URL.revokeObjectURL(f)},[f]);let g=L({mutationFn:e=>sc(n,{provider:bde,model:e.engine,voice:e.id,text:dPe}),onSuccess:e=>{let t=URL.createObjectURL(e);p(t),new Audio(t).play().catch(()=>{})}});return r.data!==void 0&&i.length===0?(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:r.data.issue??`No speech program was found on this computer.`}):(0,h.jsxs)(`div`,{className:`grid gap-1`,children:[u>12?(0,h.jsx)(X,{id:c,type:`search`,"aria-label":`Filter voices`,placeholder:`Filter ${String(u)} voices by name or language`,value:o,onChange:e=>s(e.target.value)}):null,(0,h.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,h.jsxs)(bL,{className:`min-w-0 flex-1`,value:e,onChange:e=>{g.reset();for(let n of i){let r=n.voices.find(t=>t.id===e.target.value);if(r!==void 0)return t(r)}},children:[(0,h.jsx)(`option`,{value:``,children:r.data===void 0?`Looking for voices…`:`Pick a voice`}),i.map(e=>(0,h.jsx)(`optgroup`,{label:e.name,children:e.voices.filter(d).map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.language===void 0?e.name:`${e.name} (${e.language})`},e.id))},e.id))]}),(0,h.jsxs)(B,{variant:`quiet`,disabled:a===void 0||g.isPending,disabledReason:`Pick a voice first.`,onClick:()=>{a!==void 0&&g.mutate({engine:a.id,id:e})},children:[(0,h.jsx)(El,{"aria-hidden":`true`,className:`size-[14px]`}),g.isPending?`Speaking…`:`Listen`]})]}),g.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:`The sample couldn't be spoken: ${g.error.message}`})]})}var dPe=`This is how your narration will sound in this voice.`,Y7=[`llm`,`tts`,`image`],X7={llm:`Text`,tts:`Speech`,image:`Images`},fPe=`••••••••••••`;function pPe(e){return dk(e.readiness)}function mPe(e){return e.readiness.kind===`cli`?G7(e.readiness):e.readiness.kind===`local`?J7(e.readiness):e.readiness.hasKey?{tone:`done`,word:`Key saved`}:{tone:`off`,word:`No key`}}function hPe(){let{api:e}=V(),t=I(cy(e)),[n,r]=(0,m.useState)(void 0),i=(0,m.useRef)(null),a=(0,m.useRef)(!1);(0,m.useEffect)(()=>{n!==void 0&&a.current&&(a.current=!1,typeof window.matchMedia==`function`&&window.matchMedia(`(max-width: 1023px)`).matches&&i.current?.scrollIntoView?.({block:`start`,behavior:`smooth`}))},[n]);let o=Y7.flatMap(e=>(t.data?.providers??[]).filter(t=>t.family===e)),s=o.find(e=>!pPe(e))??o[0];if(n===void 0&&s!==void 0&&r(s.id),t.error!==null)return(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-body text-danger`,children:t.error.message});if(t.data===void 0)return(0,h.jsx)(_Pe,{});let c=o.find(e=>e.id===n)??s,l=o.every(e=>e.readiness.kind!==`keyed`||!e.readiness.hasKey),u=e=>{a.current=!0,r(e)};return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-8`,children:[l?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Paste a key to make its provider selectable on Play.`}):null,Y7.map(e=>(0,h.jsxs)(`section`,{"data-tour":`keys-${e}`,"aria-labelledby":`keys-${e}-title`,className:`grid items-start gap-x-8 gap-y-6 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]`,children:[(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsx)(Sy,{id:`keys-${e}-title`,title:X7[e],size:`small`,className:`pb-2`}),(0,h.jsx)(mR,{label:`${X7[e]} providers`,children:o.filter(t=>t.family===e).map(e=>{let t=mPe(e);return(0,h.jsx)(hR,{title:e.displayName,meta:e.readiness.kind===`cli`?`Command line`:e.readiness.kind===`local`?`Built in, no key`:`API key`,selected:e.id===c?.id,onSelect:()=>u(e.id),actions:(0,h.jsx)(KO,{tone:t.tone,children:t.word})},e.id)})})]}),c===void 0||c.family!==e?null:(0,h.jsx)(`div`,{ref:i,className:`min-w-0 scroll-mt-4`,children:c.readiness.kind===`cli`?(0,h.jsx)(oPe,{provider:c,readiness:c.readiness,kind:X7[c.family]},c.id):c.readiness.kind===`local`?(0,h.jsx)(lPe,{provider:c,readiness:c.readiness},c.id):(0,h.jsx)(gPe,{provider:c,hasKey:c.readiness.hasKey},c.id)})]},e))]})}function gPe({provider:e,hasKey:t}){let{api:n}=V(),r=_(),i=(0,m.useId)(),a=(0,m.useId)(),[o,s]=(0,m.useState)(``),[c,l]=(0,m.useState)(!1),[u,d]=(0,m.useState)(!1),[f,p]=(0,m.useState)(void 0),[g,v]=(0,m.useState)(!1),[y,b]=(0,m.useState)(!1),[x,S]=(0,m.useState)(void 0),C=(0,m.useId)(),w=GA[e.id],T=o.trim(),E=async()=>{b(!0),S(void 0);try{S(await Az(n,e.id,T===``?void 0:T))}catch(e){p(e instanceof Error?e.message:String(e))}finally{b(!1)}},D=async()=>{l(!0),p(void 0);try{await Qo(n,e.id,o),s(``),d(!0),S(void 0),await r.invalidateQueries({queryKey:H.providers})}catch(e){p(e instanceof Error?e.message:String(e))}finally{l(!1)}},O=L({mutationFn:()=>es(n,e.id),onSuccess:async()=>{v(!1),p(void 0),await r.invalidateQueries({queryKey:H.providers})},onError:e=>{v(!1),p(e.message)}});(0,m.useEffect)(()=>{if(!u)return;let e=setTimeout(()=>{d(!1)},t1);return()=>{clearTimeout(e)}},[u]);let k=[t?a:void 0,x===void 0?void 0:C].filter(e=>e!==void 0).join(` `);return(0,h.jsxs)(`section`,{"aria-labelledby":i,"data-ready":t,className:`flex min-w-0 flex-col gap-5`,children:[(0,h.jsx)(Sy,{as:`h3`,size:`default`,id:i,title:t?e.displayName:`Set up ${e.displayName}`,info:W7[e.id],infoLabel:e.displayName,meta:`${X7[e.family]} · ${t?`a key is saved`:`needs an API key`}`,className:`pb-0`}),w===void 0?null:t?(0,h.jsxs)(`details`,{className:`text-small text-ink-2`,children:[(0,h.jsx)(`summary`,{className:`cursor-pointer`,children:`Where to get a key`}),(0,h.jsx)(`div`,{className:`mt-2 flex flex-col gap-2`,children:(0,h.jsx)(Z7,{guide:w})})]}):(0,h.jsx)(`div`,{className:`flex flex-col gap-2 text-small text-ink-2`,children:(0,h.jsx)(Z7,{guide:w})}),(0,h.jsx)(_L,{label:`${e.displayName} API key`,tip:`settings.providers.api-key`,help:`Stored on this computer only. Never in backups or exports.`,error:f,children:(0,h.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),o.trim()!==``&&!c&&D()},children:[(0,h.jsx)(qB,{autoComplete:`off`,spellCheck:!1,className:`flex-1 basis-[200px]`,"aria-describedby":k===``?void 0:k,placeholder:t?fPe:`Paste API key`,value:o,onChange:e=>{s(e.target.value)}}),(0,h.jsx)(B,{type:`submit`,variant:`primary`,"aria-label":`Save ${e.displayName} key`,disabled:o.trim()===``||c,children:`Save`})]})}),t?(0,h.jsx)(`span`,{id:a,className:`sr-only`,children:`A key is stored for this provider.`}):null,x===void 0?null:(0,h.jsx)(`p`,{id:C,role:x.ok?`status`:`alert`,className:z(`m-0 text-small`,x.ok?`text-accent-ink`:`text-danger`),children:x.message}),(0,h.jsxs)(Sv,{children:[(0,h.jsx)(B,{"aria-label":`Test ${e.displayName} key`,disabled:!t&&T===``||y,disabledReason:`Paste a key first.`,onClick:()=>{E()},children:y?`Testing…`:`Test`}),(0,h.jsx)(U,{id:`settings.providers.test-key`,label:`Test`}),(0,h.jsx)(B,{variant:`quiet`,"aria-label":`Remove ${e.displayName} key`,disabled:!t,onClick:()=>{v(!0)},children:`Remove`}),(0,h.jsx)(`span`,{className:`inline-flex w-[52px]`,children:u?(0,h.jsx)(r1,{}):null})]}),(0,h.jsx)(Bv,{open:g,title:`Remove the ${e.displayName} key?`,consequence:`Projects that used this provider cannot retry until a key is saved.`,confirmLabel:`Remove key`,pending:O.isPending,onConfirm:()=>{O.mutate()},onCancel:()=>{v(!1)}})]})}function Z7({guide:e}){let t=(e,t)=>(0,h.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`underline`,children:t});return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`ol`,{className:`m-0 list-decimal space-y-1 pl-5`,children:e.steps.map(e=>(0,h.jsx)(`li`,{children:e},e))}),(0,h.jsxs)(`p`,{className:`m-0`,children:[`Sign up: `,t(e.signUp.url,e.signUp.label),`. Make the key:`,` `,t(e.keyPage.url,e.keyPage.label),`.`,e.billing===void 0?null:(0,h.jsxs)(h.Fragment,{children:[` Credit: `,t(e.billing.url,e.billing.label),`.`]})]}),(0,h.jsx)(`p`,{className:`m-0`,children:e.permissions}),(0,h.jsxs)(`p`,{className:`m-0`,children:[`More in the provider's `,t(e.docs.url,e.docs.label),`. After saving, choose Test.`]})]})}function _Pe(){return(0,h.jsxs)(`div`,{className:`grid items-start gap-8 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]`,role:`status`,"aria-label":`Loading providers`,children:[(0,h.jsx)(`div`,{className:`flex flex-col gap-6`,children:[[`llm`,4],[`tts`,5],[`image`,5]].map(([e,t])=>(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`span`,{className:`mb-2 block h-3 w-16 rounded-control bg-raised`}),(0,h.jsx)(`div`,{className:`sl-list`,children:Array.from({length:t},(t,n)=>`${e}-${n}`).map(e=>(0,h.jsxs)(`div`,{className:`sl-row`,children:[(0,h.jsx)(`span`,{className:`h-4 w-32 rounded-control bg-raised`}),(0,h.jsx)(`span`,{className:`h-4 w-20 rounded-control bg-raised`})]},e))})]},e))}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,h.jsx)(`span`,{className:`h-6 w-48 rounded-control bg-raised`}),(0,h.jsx)(`span`,{className:`h-10 rounded-control bg-raised`})]})]})}function Q7(e){return e.split(/[\s,;]+/).map(e=>e.trim().toLowerCase()).filter(e=>e!==``)}function $7(e){let t=Q7(e);if(t.length===0)return`Codes such as es, de. Empty means any language.`;let n=t.filter(e=>OT.some(t=>t.code===e)),r=t.filter(e=>!n.includes(e)),i=n.map(e=>AT(e).name).join(`, `);if(r.length===0)return`Reads as: ${i}.`;let a=OT.map(e=>e.code).join(`, `);return`${i===``?``:`Reads as: ${i}. `}Not a language code Slopify knows: ${r.join(`, `)}. Use one of ${a}.`}function vPe(e){return e.languages===void 0?`Any (not known)`:e.languages.map(e=>AT(e).code===e?AT(e).name:e).join(`, `)}function yPe({voice:e}){let{api:t}=V(),n=_(),r=(0,m.useId)(),[i,a]=(0,m.useState)(!1),[o,s]=(0,m.useState)((e.languages??[]).join(`, `)),[c,l]=(0,m.useState)(void 0),u=L({mutationFn:()=>Ms(t,e.id,Q7(o)),onSuccess:async e=>{if(e!==void 0){l(e.message);return}a(!1),l(void 0),await n.invalidateQueries({queryKey:H.voices})}});return i?(0,h.jsxs)(`form`,{className:`grid gap-1`,onSubmit:e=>{e.preventDefault(),u.isPending||u.mutate()},children:[(0,h.jsx)(X,{id:r,"aria-label":`Languages of ${e.name}`,value:o,placeholder:`es, de`,"aria-invalid":c!==void 0,onChange:e=>{s(e.target.value),l(void 0)}}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:$7(o)}),c===void 0?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-danger`,children:c}),u.error===null?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-danger`,children:u.error.message}),(0,h.jsxs)(`div`,{className:`flex gap-2`,children:[(0,h.jsx)(B,{type:`submit`,size:`small`,disabled:u.isPending,children:`Save`}),(0,h.jsx)(B,{variant:`quiet`,size:`small`,onClick:()=>{a(!1),l(void 0),s((e.languages??[]).join(`, `))},children:`Cancel`})]})]}):(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(`span`,{className:`text-ink-2`,children:vPe(e)}),(0,h.jsx)(B,{variant:`quiet`,size:`small`,"aria-label":`Edit the languages of ${e.name}`,onClick:()=>a(!0),children:`Edit`})]})}function bPe(){let{api:e}=V(),t=_(),n=I(ly(e)),r=I(cy(e)),[i,a]=(0,m.useState)(void 0),o=L({mutationFn:t=>Ps(e,t),onSettled:async()=>{a(void 0),await t.invalidateQueries({queryKey:H.voices})}}),s=L({mutationFn:({id:t,on:n})=>Ns(e,t,n),onSettled:async()=>{await t.invalidateQueries({queryKey:H.voices})}}),c=(r.data?.providers??[]).filter(e=>e.family===`tts`);if(n.error!==null)return(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-body text-danger`,children:n.error.message});let l=n.data?.voices;return(0,h.jsxs)(`div`,{"data-tour":`voices`,className:`flex min-w-0 flex-col gap-10`,children:[(0,h.jsxs)(`div`,{className:`min-w-0 overflow-x-auto`,children:[(0,h.jsxs)(`table`,{className:`sl-table min-w-[640px] table-fixed`,...xy,children:[(0,h.jsx)(`caption`,{className:`sr-only`,children:`Voices`}),(0,h.jsx)(`thead`,{children:(0,h.jsxs)(`tr`,{children:[(0,h.jsx)(`th`,{scope:`col`,className:`w-[22%] pr-4`,children:`Name`}),(0,h.jsx)(`th`,{scope:`col`,className:`w-[18%] pr-4`,children:`Provider`}),(0,h.jsx)(`th`,{scope:`col`,className:`pr-4`,children:`Voice ID`}),(0,h.jsx)(`th`,{scope:`col`,className:`w-[22%] pr-4`,children:(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[`Languages`,(0,h.jsx)(U,{id:`play.voices.languages`,className:`-my-1`})]})}),(0,h.jsx)(`th`,{scope:`col`,className:`w-[20%] pr-4`,children:(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[`Real person`,(0,h.jsx)(U,{id:`play.voices.real-person`,className:`-my-1`})]})}),(0,h.jsx)(`th`,{scope:`col`,className:`w-[96px]`,children:(0,h.jsx)(`span`,{className:`sr-only`,children:`Remove`})})]})}),(0,h.jsx)(`tbody`,{children:l===void 0?(0,h.jsx)(`tr`,{children:(0,h.jsx)(`td`,{colSpan:6,children:(0,h.jsx)(`span`,{className:`block h-4 w-64 rounded-control bg-raised`})})}):l.length===0?(0,h.jsx)(`tr`,{children:(0,h.jsx)(`td`,{colSpan:6,className:`text-ink-2`,children:`Add a voice ID from your text-to-speech provider. Audio needs one to narrate.`})}):l.map(e=>(0,h.jsxs)(`tr`,{children:[(0,h.jsx)(`td`,{className:`truncate pr-4 font-semibold`,children:e.name}),(0,h.jsx)(`td`,{className:`truncate pr-4 text-ink-2`,children:SPe(c,e.provider)}),(0,h.jsx)(`td`,{className:`truncate pr-4 text-ink-2`,children:e.voiceId}),(0,h.jsx)(`td`,{className:`pr-4`,children:(0,h.jsx)(yPe,{voice:e})}),(0,h.jsx)(`td`,{className:`pr-4`,children:(0,h.jsx)(Cy,{checked:s.isPending&&s.variables.id===e.id?s.variables.on:e.imitatesRealPerson===!0,disabled:s.isPending,onChange:t=>s.mutate({id:e.id,on:t}),label:(0,h.jsx)(`span`,{className:`sr-only`,children:`${e.name} imitates a real person`}),className:`text-small`})}),(0,h.jsx)(`td`,{className:`text-right`,children:(0,h.jsx)(B,{variant:`quiet`,size:`small`,"aria-label":`Remove ${e.name}`,onClick:()=>{a(e)},children:`Remove`})})]},e.id))})]}),s.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 mt-2 text-small text-danger`,children:`Couldn't change Real person: ${s.error.message} Press the switch again.`}),o.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 mt-2 text-small text-danger`,children:o.error.message})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(Sy,{title:`Add a voice`}),(0,h.jsx)(xPe,{tts:c})]}),(0,h.jsx)(Bv,{open:i!==void 0,title:i===void 0?``:`Remove ${i.name}?`,consequence:`Projects that used this voice keep the audio they made with it.`,confirmLabel:`Remove voice`,pending:o.isPending,onConfirm:()=>{i!==void 0&&o.mutate(i.id)},onCancel:()=>{a(void 0)}})]})}function xPe({tts:e}){let{api:t}=V(),n=_(),[r,i]=(0,m.useState)(``),[a,o]=(0,m.useState)(``),[s,c]=(0,m.useState)(``),[l,u]=(0,m.useState)(void 0),[d,f]=(0,m.useState)(void 0),p=l??e[0]?.id,g=L({mutationFn:e=>js(t,e),onSuccess:async e=>{if(!e.ok){f(e.refusal);return}i(``),o(``),c(``),f(void 0),await n.invalidateQueries({queryKey:H.voices})}}),v=(e,t)=>{t(),d?.field===e&&f(void 0)},y=e=>d?.field===e?d.message:void 0,b=()=>{if(p===void 0||d!==void 0||g.isPending)return;let e=Q7(s);g.mutate({provider:p,name:r,voiceId:a,...e.length===0?{}:{languages:e}})};return(0,h.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),b()},children:[(0,h.jsxs)(`div`,{className:`grid items-start gap-4 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto]`,children:[(0,h.jsx)(_L,{label:`Voice name`,tip:`play.voices.name`,error:y(`name`),children:(0,h.jsx)(X,{value:r,onChange:e=>{let t=e.target.value;v(`name`,()=>{i(t)})}})}),(0,h.jsx)(_L,{label:`Provider`,tip:`play.voices.provider`,error:y(`provider`),children:(0,h.jsxs)(bL,{value:p??``,onChange:t=>{let n=e.find(e=>e.id===t.target.value);n!==void 0&&v(`provider`,()=>{u(n.id)})},children:[e.length===0?(0,h.jsx)(`option`,{value:``,children:`No speech provider`}):null,e.map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.displayName},e.id))]})}),(0,h.jsx)(_L,{label:`Voice ID`,tip:`play.voices.voice-id`,error:y(`voiceId`),...p===`inworld`?{help:`Use an Inworld voice ID, such as Dennis, or one from your workspace.`}:{},children:p===`system-voice`?(0,h.jsx)(uPe,{value:a,onPick:e=>{v(`voiceId`,()=>{o(e.id)}),r.trim()===``&&i(e.name);let t=/^([a-z]{2,3})(?:[-_]|$)/i.exec(e.language??``)?.[1];s.trim()===``&&t!==void 0&&c(t.toLowerCase())}}):p===`google-tts`?(0,h.jsx)(bL,{value:a,options:[{value:``,label:`Pick a Gemini voice`},...xde.map(e=>({value:e.name,label:`${e.name} (${e.style})`}))],onChange:e=>{let t=e.target.value;v(`voiceId`,()=>{o(t),r.trim()===``&&i(t)})}}):(0,h.jsx)(X,{className:`tabular-nums`,value:a,onChange:e=>{let t=e.target.value;v(`voiceId`,()=>{o(t)})}})}),(0,h.jsx)(_L,{label:`Languages`,tip:`play.voices.languages`,help:$7(s),error:y(`languages`),children:(0,h.jsx)(X,{value:s,placeholder:`es, de`,onChange:e=>{let t=e.target.value;v(`languages`,()=>{c(t)})}})}),(0,h.jsx)(B,{type:`submit`,variant:`primary`,className:`md:mt-6`,disabled:p===void 0||d!==void 0||g.isPending,children:`Add voice`})]}),g.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:g.error.message})]})}function SPe(e,t){return e.find(e=>e.id===t)?.displayName??t}var CPe={headline:`Slopify test notification`,detail:`Notifications work. You'll get one when a run finishes, fails or waits for you, and when a review needs your decision.`},wPe=2048;function TPe(e){let t=e.trim();if(t===``)return;if(t.length>2048)return`Keep the Notification URL to ${String(wPe)} characters or fewer.`;let n;try{n=new URL(t)}catch{return`Enter a full address starting with https:// or http://, for example https://ntfy.sh/your-topic.`}if(n.protocol!==`https:`&&n.protocol!==`http:`)return`The Notification URL must start with https:// or http://.`;if(n.username!==``||n.password!==``)return`Remove the user name and password from the Notification URL; Slopify can't send them.`}var e9=[`settings`,`notifications`],EPe=`The test notification couldn't be shown: this browser only allows notifications from installed apps. Set a Notification URL below instead.`;function DPe(){return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(Sy,{title:`Browser and phone`,info:`settings.notifications`}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,h.jsx)(OPe,{}),(0,h.jsx)(kPe,{}),(0,h.jsx)(APe,{})]})]})}function OPe(){let e=(0,m.useSyncExternalStore)(Xj,Jj,()=>!1),[t,n]=(0,m.useState)(qj),[r,i]=(0,m.useState)(void 0),[a,o]=(0,m.useState)(!1),s=wv(),c=e&&t===`granted`;async function l(e){if(i(void 0),!e){Yj(!1);return}o(!0);try{let e=await $j();n(e);let t=Qj(e);e===`granted`?(Yj(!0),Jj()||i(`Browser notifications couldn't be turned on because this browser blocks site storage for Slopify. Allow site data for this address in your browser's settings, then turn Browser notifications on again.`)):i(t??`Browser notifications weren't turned on because the permission prompt was dismissed. Turn Browser notifications on again and choose Allow.`)}finally{o(!1)}}return(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,h.jsx)(Cy,{label:`Browser notifications`,tip:`settings.notifications.browser`,checked:c,disabled:a,onChange:e=>void l(e)}),(0,h.jsx)(B,{variant:`quiet`,disabled:!c,disabledReason:`Turn Browser notifications on first.`,onClick:()=>{i(void 0);try{iM({projectId:`test`,text:CPe},()=>{}),s(`Test notification sent to this browser.`,`success`)}catch{i(EPe)}},children:`Send test notification`})]}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Works while any Slopify tab is open. The switch applies in this browser at once.`}),r===void 0?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:r})]})}function kPe(){let e=(0,m.useSyncExternalStore)(dM,lM,()=>!0);return(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,h.jsx)(Cy,{label:`Run sounds`,tip:`settings.notifications.sounds`,checked:e,onChange:uM}),(0,h.jsx)(B,{variant:`quiet`,onClick:()=>hM(`start`),children:`Play start`}),(0,h.jsx)(B,{variant:`quiet`,onClick:()=>hM(`end`),children:`Play end`})]}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`A chime when a run starts and a different one when it finishes, fails or waits for you. Works while any Slopify tab is open; set your computer's volume for how loud. The switch applies in this browser at once.`})]})}function APe(){let{api:e}=V(),t=_(),n=wv(),r=(0,m.useId)(),i=I({queryKey:e9,queryFn:()=>rs(e)}),[a,o]=(0,m.useState)(void 0),s=a??i.data?.url??``,c=TPe(s),l=L({mutationFn:t=>as(e,t),onSuccess:e=>{t.setQueryData(e9,e),o(void 0),n(e.url===null?`Notification URL removed.`:`Notification URL saved.`,`success`)}}),u=L({mutationFn:t=>os(e,t),onSuccess:()=>{n(`Test notification sent. Check the app or page behind your Notification URL.`,`success`)}}),d=c??l.error?.message??u.error?.message,f=l.isPending||u.isPending||i.data===void 0,p=a!==void 0&&a!==(i.data?.url??``);return(0,h.jsxs)(_L,{label:`Notification URL`,tip:`settings.notifications.url`,help:`Works with no tab open, for example an ntfy topic on your phone. Saved only when you press Save.`,children:[(0,h.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),!f&&c===void 0&&p&&l.mutate(s)},children:[(0,h.jsx)(X,{type:`url`,inputMode:`url`,autoComplete:`off`,spellCheck:!1,placeholder:`https://ntfy.sh/your-topic`,className:`min-w-0 flex-1 basis-[220px]`,value:s,disabled:i.data===void 0,"aria-invalid":c!==void 0,"aria-describedby":d===void 0?void 0:r,onChange:e=>{l.reset(),u.reset(),o(e.target.value)}}),(0,h.jsx)(B,{type:`submit`,variant:`primary`,disabled:f||c!==void 0||!p,disabledReason:`Type a new address first, or fix the one shown.`,children:`Save`}),(0,h.jsx)(B,{variant:`quiet`,disabled:f||c!==void 0||s.trim()===``,onClick:()=>u.mutate(s),children:`Send test notification`})]}),(0,h.jsx)(KB,{dirty:p,onDiscard:()=>{l.reset(),u.reset(),o(void 0)}}),i.error===null?null:(0,h.jsxs)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:[`The saved Notification URL couldn't be read: `,i.error.message]}),d===void 0?null:(0,h.jsx)(`p`,{id:r,role:`alert`,className:`m-0 text-small text-danger`,children:d})]})}var t9={library:`The Library of Alexandria`,audiobook:`The Wind in the Willows (audiobook)`,podcast:`The Antikythera Mechanism (podcast)`};function jPe(){let{api:e}=V(),t=_(),n=I({queryKey:Hv,queryFn:()=>Xv(e)}),r=L({mutationFn:()=>Qv(e),onSettled:async()=>{await t.invalidateQueries({queryKey:Hv}),await t.invalidateQueries({queryKey:Vv}),await t.invalidateQueries({queryKey:H.projects})}}),i=r.data?.samples??n.data?.samples;return(0,h.jsxs)(`div`,{className:`mt-8`,children:[(0,h.jsx)(Sy,{title:`Sample projects`,info:`settings.sample.restore`}),(0,h.jsx)(mR,{label:`Sample projects`,children:Object.keys(t9).map(e=>{let t=i?.[e]??null;return(0,h.jsx)(hR,{title:t9[e],meta:t===null?`Not in your projects`:`In your projects`,actions:t===null?void 0:(0,h.jsx)(RO,{to:`/projects/$projectId`,params:{projectId:t},className:pR,children:`Open`})},e)})}),(0,h.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3`,children:[(0,h.jsx)(B,{disabled:r.isPending,onClick:()=>r.mutate(),children:r.isPending?`Restoring…`:`Restore samples`}),(0,h.jsx)(`span`,{className:`text-small text-ink-2`,children:`Puts all three back as they shipped.`})]}),(0,h.jsx)(WR,{tone:r.error?`error`:`success`,children:r.error?.message??(r.isSuccess?`The samples are back in Projects.`:void 0)})]})}var MPe=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`];function NPe(e){let[t,n,r]=e.split(`-`).map(Number),i=MPe[(n??0)-1];return i===void 0||r===void 0?e:`${String(r)} ${i} ${String(t)}`}function n9(e,t){let n=[e.range===void 0?e.version:`Versions ${e.range}`,`released ${NPe(e.date)}`].filter(e=>e!==void 0).join(`, `),r=n.charAt(0).toUpperCase()+n.slice(1);return e.version===t?`${r}. The version you are running.`:`${r}.`}function PPe({note:e,onNote:t}){let{api:n}=V(),r=I(FM(n));if(r.error!==null)return(0,h.jsx)(GM,{tone:`danger`,title:`The patch notes did not load`,actions:(0,h.jsx)(B,{onClick:()=>void r.refetch(),children:`Try again`}),children:`${r.error.message} Press Try again, or reload the page.`});if(r.data===void 0)return(0,h.jsx)(`p`,{className:`m-0 text-ink-3`,children:`Loading the patch notes…`});let{notes:i,version:a}=r.data,[o,...s]=i;if(o===void 0)return(0,h.jsx)(`p`,{className:`m-0 text-ink-2`,children:`This version of Slopify has no patch notes.`});let c=e===void 0?void 0:i.find(t=>t.id===e),l=c!==void 0&&c.id!==o.id?c:void 0;return l===void 0?(0,h.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[e!==void 0&&c===void 0?(0,h.jsx)(`p`,{role:`status`,className:`m-0 text-small text-ink-2`,children:`There are no patch notes called "${e}" in this version. The latest are below; older ones are under Earlier versions.`}):null,(0,h.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,h.jsx)(Sy,{title:`Latest version`,meta:n9(o,a),info:`settings.patch-notes`}),(0,h.jsx)(QI,{id:o.id})]}),s.length===0?null:(0,h.jsxs)(`details`,{className:`max-w-prose border-t border-line py-3`,children:[(0,h.jsx)(`summary`,{className:`cursor-pointer font-semibold`,children:`Earlier versions (${String(s.length)})`}),(0,h.jsx)(mR,{label:`Earlier versions`,className:`mt-2`,children:s.map(e=>(0,h.jsx)(hR,{title:e.title,meta:n9(e,a),onSelect:()=>t(e.id),actions:(0,h.jsx)(B,{"aria-label":`Read ${e.title}`,onClick:()=>t(e.id),children:`Read`})},e.id))})]})]}):(0,h.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,h.jsx)(`div`,{children:(0,h.jsxs)(B,{variant:`quiet`,onClick:()=>t(void 0),children:[(0,h.jsx)(xc,{"aria-hidden":`true`,strokeWidth:1.75}),`Back to the latest patch notes`]})}),(0,h.jsx)(Sy,{title:`Earlier version`,meta:n9(l,a)}),(0,h.jsx)(QI,{id:l.id})]})}var FPe={project:`Project`,prompt:`Prompt`,entry:`Intro/outro`,template:`Template`,schedule:`Schedule`},IPe=[{value:`project`,label:`Projects`},{value:`prompt`,label:`Prompts`},{value:`entry`,label:`Intros and outros`},{value:`template`,label:`Templates`},{value:`schedule`,label:`Schedules`}],r9=`Deleted projects, prompts, intros and outros, templates and schedules stay here for 30 days.`,i9=`Channels, cast members, PDF themes and episode summaries are deleted permanently and never come here.`;function LPe(e){return e.kind===`entry`&&e.detail!==null?e.detail===`intro`?`Intro`:`Outro`:e.kind===`prompt`&&e.detail!==null?`Prompt · ${e.detail}`:FPe[e.kind]}function RPe(e){return e<=0?`removed for good today`:e===1?`1 day left`:`${String(e)} days left`}var zPe=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}),a9=new Intl.DateTimeFormat(void 0,{dateStyle:`full`,timeStyle:`long`});function BPe(e){let t=new Date(e.deletedAt);return{short:zPe.format(t),full:`Deleted ${a9.format(t)}. Removed for good ${a9.format(new Date(e.purgeAt))}.`}}function o9(e){return`${e.kind}:${e.id}`}var VPe={project:[H.projects,[`calendar`]],prompt:[H.prompts],entry:[H.entries],template:[yO],schedule:[pT,[`calendar`]]};function HPe(e){let t=e.filter(e=>e.kind===`project`).length,n=e.some(e=>e.kind===`schedule`);return[t===0?void 0:t===1&&e.length===1?`The project and every file it produced are removed from disk.`:`${String(t)} ${t===1?`project and every file it`:`projects and every file they`} produced are removed from disk.`,n?`Deleted schedules keep their run history on Schedules.`:void 0,`Nothing removed here can be restored. This cannot be undone.`].filter(e=>e!==void 0).join(` `)}function s9(e,t,n,r){let i=t[0];if(i===void 0)return``;let a=r.find(e=>e.kind===i.kind&&e.id===i.id)?.name;return`Could not ${e} ${String(t.length)} of ${PG(n,`item`,`items`)}. ${a===void 0?``:`"${a}": `}${i.detail}`}function UPe(){let{api:e}=V(),t=_(),n=wv(),r=async e=>{let n=new Map([[oQ.join(`/`),oQ]]);for(let t of e)for(let e of VPe[t.kind])n.set(e.join(`/`),e);await Promise.all([...n.values()].map(e=>t.invalidateQueries({queryKey:e})))};return{restore:L({mutationFn:async t=>{let[n]=t;return t.length===1&&n!==void 0?{restored:[await cQ(e,n.kind,n.id)],failed:[]}:lQ(e,t)},onSuccess:async({restored:e,failed:t},i)=>{await r(i);let[a]=e;if(e.length===1&&a!==void 0)n(a.renamedFrom===null?`Restored "${a.name}".`:`Restored as "${a.name}": another item is now called "${a.renamedFrom}".`,`success`);else if(e.length>1){let t=e.filter(e=>e.renamedFrom!==null).length;n(`Restored ${PG(e.length,`item`,`items`)}.${t===0?``:` ${PG(t,`came`,`came`)} back renamed because the name was taken.`}`,`success`)}e.some(e=>e.kind===`schedule`)&&n(e.filter(e=>e.kind===`schedule`).length===1?`The schedule is paused. Press Resume on Schedules to run it again.`:`The schedules are paused. Press Resume on Schedules to run each again.`,`info`),t.length>0&&n(s9(`restore`,t,i.length,i),`error`)},onError:e=>n(e.message,`error`)}),remove:L({mutationFn:async t=>{let[n]=t;return t.length===1&&n!==void 0?(await Lbe(e,n.kind,n.id),{deleted:[n],failed:[]}):Rbe(e,t)},onSuccess:async({deleted:e,failed:t},i)=>{await r(i);let[a]=i;i.length===1&&a!==void 0&&t.length===0?n(`Deleted "${a.name}" for good.`,`success`):e.length>0&&n(`Deleted ${PG(e.length,`item`,`items`)} for good.`,`success`),t.length>0&&n(s9(`delete`,t,i.length,i),`error`)},onError:e=>n(e.message,`error`)})}}function WPe(){let{api:e}=V(),t=I({queryKey:oQ,queryFn:()=>sQ(e)}),{restore:n,remove:r}=UPe(),[i,a]=(0,m.useState)(`all`),[o,s]=(0,m.useState)(void 0),c=t.data??[],l=IPe.filter(e=>c.some(t=>t.kind===e.value)),u=l.some(e=>e.value===i)?i:`all`,d=(0,m.useMemo)(()=>u===`all`?c:c.filter(e=>e.kind===u),[c,u]),f=AG((0,m.useMemo)(()=>d.map(o9),[d])),p=d.filter(e=>f.has(o9(e))),g=n.isPending||r.isPending,_=(e,t,n)=>s({title:e,label:t,items:n}),v=()=>{o!==void 0&&r.mutate(o.items,{onSettled:()=>{s(void 0),f.clear()}})};return(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(Sy,{title:`Trash`,info:`settings.trash`,meta:c.length===0?void 0:`${r9} ${i9}`,children:[(0,h.jsx)(B,{size:`small`,disabled:g||c.length===0,disabledReason:c.length===0?`The trash is empty`:`Working on it`,onClick:()=>n.mutate(c,{onSuccess:f.clear}),children:`Restore all`}),(0,h.jsx)(B,{size:`small`,variant:`destructive`,disabled:g||c.length===0,disabledReason:c.length===0?`The trash is empty`:`Working on it`,onClick:()=>_(`Empty the trash: delete all ${PG(c.length,`item`,`items`)} for good?`,`Empty trash`,c),children:`Empty trash`})]}),t.isPending?(0,h.jsx)(`p`,{className:`text-small text-ink-3`,children:`Loading the trash…`}):t.error?(0,h.jsx)(KL,{what:`The trash`,error:t.error,onRetry:()=>void t.refetch(),retrying:t.isFetching,compact:!0}):c.length===0?(0,h.jsxs)(hQ,{title:`The trash is empty`,children:[r9,` `,i9]}):(0,h.jsxs)(`div`,{onKeyDown:f.onKeyDown,children:[l.length>1?(0,h.jsx)(wy,{label:`Filter by kind`,value:u,onChange:a,options:[{value:`all`,label:`All`},...l],className:`mb-2`}):null,(0,h.jsx)(NG,{selection:f,total:d.length,noun:[`item`,`items`],...u===`all`?{}:{scope:`Select all ${String(d.length)} shown`},actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(B,{size:`small`,disabled:g||f.count===0,disabledReason:f.count===0?`Nothing is selected`:`Working on it`,onClick:()=>n.mutate(p,{onSuccess:f.clear}),children:`Restore selected`}),(0,h.jsx)(B,{size:`small`,variant:`destructive`,disabled:g||f.count===0,disabledReason:f.count===0?`Nothing is selected`:`Working on it`,onClick:()=>_(`Delete ${PG(p.length,`selected item`,`selected items`)} for good?`,`Delete for good`,p),children:`Delete selected`})]})}),(0,h.jsx)(mR,{label:`Deleted items`,children:d.map(e=>{let t=BPe(e);return(0,h.jsx)(hR,{lead:(0,h.jsx)(MG,{selection:f,value:o9(e),label:e.name}),title:e.name,meta:(0,h.jsxs)(h.Fragment,{children:[LPe(e),` · deleted`,` `,(0,h.jsx)(`time`,{dateTime:e.deletedAt,title:t.full,children:t.short}),` `,`· `,RPe(e.daysLeft)]}),actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(B,{size:`small`,disabled:g,disabledReason:`Working on it`,onClick:()=>n.mutate([e]),children:`Restore`}),(0,h.jsx)(B,{size:`small`,variant:`destructive`,disabled:g,disabledReason:`Working on it`,onClick:()=>_(`Delete "${e.name}" for good?`,`Delete for good`,[e]),children:`Delete now`})]})},o9(e))})})]}),(0,h.jsx)(Bv,{open:o!==void 0,title:o?.title??``,consequence:o===void 0?``:HPe(o.items),confirmLabel:o?.label??`Delete for good`,cancelLabel:o?.items.length===1?`Keep it`:`Keep them`,pending:r.isPending,onConfirm:v,onCancel:()=>{r.isPending||s(void 0)}})]})}var GPe=`https://github.com/GentBajko/slopify`,KPe=`https://www.patreon.com/cw/GentBajko`,qPe=`https://buymeacoffee.com/gentbajko`;function JPe(){return[{href:GPe,label:`GitHub`,detail:`The code, issues and releases.`,glyph:`github`},{href:KPe,label:`Patreon`,detail:`Monthly support for the project.`,glyph:`patreon`},{href:qPe,label:`Buy Me a Coffee`,detail:`A one-off thank you.`,glyph:`coffee`},{href:`https://slopify.stream/channel.html`,label:`How I run a channel with it`,detail:`A lore channel run on Slopify, start to finish.`}]}function YPe({onWhatsNew:e}){return(0,h.jsxs)(`div`,{className:`max-w-prose`,children:[(0,h.jsx)(Sy,{title:`About`}),(0,h.jsx)(`p`,{className:`m-0 mb-3 text-ink-2`,children:`Slopify is free and open source, and runs on your machine with your own keys. If it saves you time, you can support it here.`}),(0,h.jsxs)(`p`,{className:`m-0 mb-3 flex items-center gap-1 text-small text-ink-2`,children:[`Updates: the circular-arrows button at the foot of the sidebar (at the top on a phone).`,(0,h.jsx)(U,{id:`settings.updates`})]}),e===void 0?null:(0,h.jsxs)(`p`,{className:`m-0 mb-3 flex items-center gap-1`,children:[(0,h.jsx)(B,{onClick:e,children:`What's new in this version`}),(0,h.jsx)(U,{id:`settings.whats-new`})]}),(0,h.jsx)(`p`,{className:`m-0 mb-4 text-small text-ink-2`,children:`Made by Gent Bajko. Apache License 2.0: anyone who redistributes Slopify or builds on it keeps this credit.`}),(0,h.jsx)(`ul`,{"aria-label":`Links`,className:`sl-list m-0 list-none p-0`,children:JPe().map(e=>(0,h.jsx)(`li`,{className:`sl-row`,children:(0,h.jsxs)(`div`,{className:`sl-row__lead`,children:[e.glyph===void 0?(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`size-[14px] shrink-0`}):(0,h.jsx)(FO,{name:e.glyph,className:`shrink-0 text-ink-2`}),(0,h.jsxs)(`div`,{className:`sl-row__text`,children:[(0,h.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer`,className:`font-semibold text-ink underline underline-offset-3`,children:e.label}),(0,h.jsx)(`span`,{className:`sl-row__meta`,children:e.detail})]})]})},e.label))})]})}var c9=[`backups`],l9=1,u9=30;function d9(){return Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`}function XPe(e){let t=e.trim();return/^\d+$/.test(t)&&Number(t)>=l9&&Number(t)<=u9?void 0:`Keep between ${l9} and ${u9} backups.`}function f9(e){return{enabled:e.config.enabled,time:e.config.time,keep:String(e.config.keep),folder:e.config.folder??``}}function p9(){let{api:e}=V(),t=_(),n=wv();return L({mutationFn:()=>ko(e),onSuccess:e=>{t.setQueryData(c9,e),n(`Backup started. Its result shows here when it finishes.`,`success`)}})}function ZPe(){let{api:e}=V(),t=_(),n=I({queryKey:c9,queryFn:()=>Do(e),refetchInterval:e=>e.state.data?.running===!0&&2e3}),[r,i]=(0,m.useState)(void 0),[a,o]=(0,m.useState)(!1),s=L({mutationFn:t=>Oo(e,t),onSuccess:e=>{t.setQueryData(c9,e),i(void 0),o(!0)}}),c=p9();(0,m.useEffect)(()=>{if(!a)return;let e=setTimeout(()=>o(!1),t1);return()=>clearTimeout(e)},[a]);let l=n.data,u=r??(l===void 0?void 0:f9(l)),d=u===void 0?void 0:XPe(u.keep),f=r!==void 0&&l!==void 0&&!QPe(r,f9(l)),p=()=>{u===void 0||d!==void 0||s.isPending||(o(!1),s.mutate({enabled:u.enabled,time:u.time,timeZone:d9(),keep:Number(u.keep.trim()),folder:u.folder.trim()===``?null:u.folder.trim()}))},g=e=>{u!==void 0&&i({...u,...e})};return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(Sy,{title:`Daily backup`,info:`settings.backups`,children:(0,h.jsx)(B,{disabled:l===void 0||l.running||c.isPending,onClick:()=>c.mutate(),children:`Back up now`})}),(0,h.jsxs)(`div`,{className:`mb-6 flex flex-col gap-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap justify-between gap-x-4 gap-y-1 text-small text-ink-2`,children:[(0,h.jsx)(`span`,{role:`status`,children:l===void 0?(0,h.jsx)(`span`,{className:`inline-block h-4 w-48 rounded-control bg-raised`}):$Pe(l)}),(0,h.jsx)(`span`,{children:l===void 0?null:eFe(l)})]}),l?.status.detail?l.status.lastResult===`failed`?(0,h.jsx)(GM,{tone:`danger`,title:`Why the last backup stopped`,children:l.status.detail}):(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:l.status.detail}):null,c.error?(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:c.error.message}):null]}),n.error?(0,h.jsxs)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:[`The backup settings couldn't be read: `,n.error.message]}):(0,h.jsxs)(`form`,{className:`flex flex-col gap-6`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,h.jsx)(Cy,{label:`Back up automatically`,tip:`settings.backups.auto`,checked:u?.enabled===!0,disabled:u===void 0,className:`self-start`,onChange:e=>g({enabled:e})}),(0,h.jsxs)(`div`,{className:`grid items-start gap-6 md:grid-cols-2`,children:[(0,h.jsx)(_L,{label:`Time of day`,tip:`settings.backups.time`,help:`${d9()} time`,children:(0,h.jsx)(X,{type:`time`,className:`w-[140px] tabular-nums`,value:u?.time??`03:00`,disabled:u===void 0,onChange:e=>g({time:e.target.value})})}),(0,h.jsx)(_L,{label:`Keep last`,tip:`settings.backups.keep`,help:`Backups kept in the folder.`,error:d,children:(0,h.jsx)(X,{type:`number`,inputMode:`numeric`,min:l9,max:u9,step:1,className:`w-[88px] tabular-nums`,value:u?.keep??`5`,disabled:u===void 0,onChange:e=>g({keep:e.target.value})})}),(0,h.jsx)(_L,{label:`Folder`,tip:`settings.backups.folder`,className:`md:col-span-2`,...l===void 0?{}:{help:tFe(l)},children:(0,h.jsx)(X,{value:u?.folder??``,placeholder:l?.defaultFolder??``,disabled:u===void 0,onChange:e=>g({folder:e.target.value})})})]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(B,{type:`submit`,variant:`primary`,disabled:!f||d!==void 0||s.isPending,disabledReason:d===void 0?`Nothing changed since the last save.`:d,children:`Save`}),(0,h.jsx)(`span`,{className:`inline-flex w-[52px]`,children:a?(0,h.jsx)(r1,{}):null}),(0,h.jsx)(KB,{dirty:f,onDiscard:()=>{s.reset(),i(void 0)}}),s.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 basis-full text-small text-danger`,children:s.error.message})]})]})]})}function QPe(e,t){return e.enabled===t.enabled&&e.time===t.time&&e.keep.trim()===t.keep.trim()&&e.folder.trim()===t.folder.trim()}function m9(e){return new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}function $Pe(e){if(e.running)return`Backing up now…`;let{status:t}=e,n=t.lastSuccessAt===null?`No backup yet.`:`Last backup ${m9(t.lastSuccessAt)}${t.lastSuccessBytes===null?``:`, ${w5(t.lastSuccessBytes)}`}.`;return t.lastResult===`failed`&&t.lastAttemptAt!==null?`${n} The backup at ${m9(t.lastAttemptAt)} failed.`:t.lastResult===`waiting`?`${n} Waiting for projects to finish.`:n}function eFe(e){return e.config.enabled?e.overdue?`Next: shortly.`:e.nextRunAt===null?``:`Next: ${m9(e.nextRunAt)}.`:`Automatic backups are off.`}function tFe(e){let t=`${e.files.length} backup${e.files.length===1?``:`s`} here (${w5(e.files.reduce((e,t)=>e+t.bytes,0))}).`;return e.hostFolder===null?`Inside Slopify's Docker volume, not on your computer. Leave Folder empty to save backups in the Backups folder on your computer. ${t}`:`${e.config.folder===null?`Empty uses the default: `:`On your computer: `}${e.hostFolder}. ${t}`}var h9=[`storage-usage`],nFe=[h9,H.projects,[`project`],H.usage,H.documentThemes,pT,[`play-drafts`],H.settings,H.providers,H.voices,H.prompts,H.entries,H.staging,yO,Ok,[`provider-models`]];async function rFe(e){await Promise.all(nFe.map(t=>e.invalidateQueries({queryKey:t})))}var g9=`The backup wasn't imported. Check it is a file made with Export everything (.tar) or Export backup (.zip), then try again.`;function iFe(){let{api:e}=V(),t=_(),n=I({queryKey:h9,queryFn:()=>Io(e),staleTime:3e4}),[r,i]=(0,m.useState)(!1),[a,o]=(0,m.useState)({phase:`idle`}),[s,c]=(0,m.useState)({phase:`idle`}),[l,u]=(0,m.useState)(null),d=wv(),[f,p]=(0,m.useState)(null);async function g(){p(null),o({phase:`preparing`});try{let t=await Eo(e);if(!t.ready){o({phase:`idle`}),p(t.detail??`The backup can't be made right now. Try again in a moment.`);return}o({phase:`downloading`,bytes:t.bytes??0,projects:t.projects??0});let n=document.createElement(`a`);n.href=`${e.origin}/api/storage/export`,n.download=``,document.body.append(n),n.click(),n.remove()}catch(e){o({phase:`idle`}),p(e instanceof Error?e.message:`The backup couldn't be prepared. Try again in a moment.`)}}async function v(n){let r=n.name.toLowerCase().endsWith(`.zip`)||n.type===`application/zip`;if(n.size===0||r&&n.size>104857600){p(r?`This file is empty or larger than 100 MB. Choose a .zip made with Export backup, or a .tar made with Export everything.`:`This file is empty. Choose the .tar made with Export everything.`);return}i(!0),p(null),u(null),c({phase:`uploading`,sent:0,total:n.size});try{let i=await e.upload(`${e.origin}/api/storage/import`,n,r?`application/zip`:`application/x-tar`,(e,t)=>{c(e>=t?{phase:`importing`}:{phase:`uploading`,sent:e,total:t})}),a=await i.json();if(!i.ok)throw Error(a.detail??g9);a.projects===void 0?d(`Imported ${a.templates??0} template(s), ${a.fonts??0} uploaded font(s), and ${a.stagedFiles??0} staged file(s).${a.fontFallbacks?` ${a.fontFallbacks} missing legacy font reference(s) now use the default font.`:``}`,`success`):(u(a),d(`Backup imported.`,`success`)),await rFe(t)}catch(e){p(e instanceof Error?e.message:g9)}finally{c({phase:`idle`}),i(!1)}}async function y(){i(!0),p(null);try{let n=await e.fetch(`${e.origin}/api/storage/cleanup`,{method:`POST`}),r=await n.json();if(!n.ok)throw Error(`Clear leftover files didn't finish. Try again in a moment.`);d(`Cleared ${r.orphanFiles??0} leftover project file(s) and ${r.stagedFiles??0} unused upload(s).`,`success`),await t.invalidateQueries({queryKey:h9})}catch(e){p(e instanceof Error?e.message:`Clear leftover files didn't finish. Try again in a moment.`)}finally{i(!1)}}Xy({id:`settings.export-everything`,title:`Export everything`,group:`Settings`,context:`Backup & storage`,keywords:[`backup`,`download`],run:()=>{!r&&a.phase!==`preparing`&&g()}});let b=r||a.phase===`preparing`,x=(0,m.useRef)(null);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(Sy,{title:`Export and import`,info:`settings.storage.export`,children:[(0,h.jsx)(B,{disabled:b,onClick:()=>void g(),children:`Export everything`}),(0,h.jsx)(B,{disabled:b,onClick:()=>x.current?.click(),children:`Import a backup`}),(0,h.jsx)(`input`,{ref:x,className:`sr-only`,type:`file`,tabIndex:-1,"aria-label":`Import a backup`,accept:`.tar,application/x-tar,.zip,application/zip`,disabled:b,onChange:e=>{let t=e.target.files?.[0];t&&v(t),e.target.value=``}}),(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,h.jsx)(B,{variant:`quiet`,disabled:b,onClick:()=>void y(),children:`Clear leftover files`}),(0,h.jsx)(U,{id:`settings.storage.clean`})]})]}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-2 text-small text-ink-2`,children:[(0,h.jsx)(`p`,{className:`m-0`,children:`Provider keys are never included in a backup. After importing, enter them again in Settings → Providers.`}),a.phase===`preparing`?(0,h.jsx)(`p`,{role:`status`,className:`m-0 text-ink`,children:`Preparing the backup…`}):null,a.phase===`downloading`?(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,h.jsxs)(`p`,{role:`status`,className:`m-0 min-w-0 flex-1 text-ink`,children:[`Downloading `,w5(a.bytes),` (`,a.projects,` project`,a.projects===1?``:`s`,`). Your browser's downloads show its progress; keep Slopify running until it finishes.`]}),(0,h.jsx)(B,{variant:`quiet`,size:`small`,onClick:()=>o({phase:`idle`}),children:`Dismiss`})]}):null,s.phase===`uploading`?(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsxs)(`p`,{role:`status`,className:`m-0 text-ink tabular-nums`,children:[`Uploading the backup: `,w5(s.sent),` of `,w5(s.total)]}),(0,h.jsx)($$,{progress:!0,label:`Backup upload`,value:s.total===0?0:s.sent/s.total})]}):null,s.phase===`importing`?(0,h.jsx)(`p`,{role:`status`,className:`m-0 text-ink`,children:`Checking and importing the backup… large projects can take a minute.`}):null,f?(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-danger`,children:f}):null]})]}),l?(0,h.jsx)(oFe,{result:l,onDismiss:()=>u(null)}):null,(0,h.jsxs)(`div`,{children:[(0,h.jsx)(Sy,{title:`Disk space`,info:`settings.storage.disk`,meta:n.data?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`span`,{className:`font-semibold text-ink`,children:[w5(n.data.data),` stored`]}),(0,h.jsxs)(`span`,{className:`tabular-nums`,children:[` `,`· `,w5(Math.max(0,n.data.projects-n.data.trash.bytes)),` project files · `,w5(n.data.staging),` staged files`,n.data.trash.projects>0?` · ${w5(n.data.trash.bytes)} in the trash (${aFe(n.data.trash.projects)}), freed when removed for good`:null]})]}):n.error?`Storage usage is unavailable. Reload the page to try again.`:(0,h.jsx)(`span`,{className:`inline-block h-4 w-48 rounded-control bg-raised`})}),n.data&&n.data.byProject.length>0?(0,h.jsx)(tje,{projects:n.data.byProject,queryKey:[...h9]}):null]})]})}function aFe(e){return e===1?`1 deleted project`:`${String(e)} deleted projects`}function _9(e,t){if(t===void 0)return null;let n=[t.added>0?`${t.added} added`:null,t.renamed>0?`${t.renamed} added as “(imported)” because the name was taken`:null,t.skipped>0?`${t.skipped} already here`:null].filter(e=>e!==null);return n.length===0?null:`${e}: ${n.join(`, `)}.`}function oFe({result:e,onDismiss:t}){let n=[e.projects.imported.length>0?`Projects: ${e.projects.imported.length} added (${w5(e.files.bytes)} of files).`:`Projects: none added.`,_9(`Prompts`,e.prompts),_9(`Intros and outros`,e.entries),_9(`Channels`,e.channels),_9(`Cast members`,e.cast),_9(`Episode memories`,e.episodeMemories),_9(`Existing videos`,e.channelVideos),_9(`PDF themes`,e.documentThemes),_9(`Templates`,e.templates),_9(`Schedules`,e.schedules),e.schedules.paused>0?`${e.schedules.paused} schedule(s) arrived paused so two installs never run them both; resume them on the Schedules screen.`:null,_9(`Voices`,e.voices),_9(`Play drafts`,e.drafts),e.settings.added+e.settings.kept>0?`Settings: ${e.settings.added} filled in${e.settings.kept>0?`, ${e.settings.kept} kept as this install has them`:``}.`:null,e.fonts>0?`Uploaded fonts: ${e.fonts} added.`:null,e.usage.alreadyImported?`Usage: this backup's history was already added before, so it wasn't counted twice.`:`Usage: ${e.usage.events} recorded event(s) added to the totals.`,`Provider keys are not in backups: enter them in Settings → Providers.`].filter(e=>e!==null);return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(Sy,{as:`h3`,title:`Imported the backup from ${e.backup.createdAt.slice(0,10)}`,children:(0,h.jsx)(B,{variant:`quiet`,size:`small`,onClick:t,children:`Dismiss`})}),(0,h.jsxs)(`ul`,{"aria-label":`Import result`,className:`m-0 list-disc pl-5 text-small text-ink-2`,children:[n.map(e=>(0,h.jsx)(`li`,{className:`py-0.5`,children:e},e)),e.projects.skipped.map(e=>(0,h.jsxs)(`li`,{className:`py-0.5`,children:[`Skipped “`,e.title,`”: `,e.reason]},e.id))]})]})}var v9=[`storage-files`];function sFe({usageQueryKey:e}){let{api:t}=V(),n=_(),r=wv(),[i,a]=(0,m.useState)(!1),[o,s]=(0,m.useState)(``),[c,l]=(0,m.useState)(),u=I({queryKey:v9,queryFn:()=>Lo(t),refetchInterval:e=>b9(e.state.data)?1e3:!1}),d=L({mutationFn:e=>Ro(t,e),onMutate:()=>l(void 0),onSuccess:e=>{n.setQueryData(v9,e),a(!1)},onError:e=>l(e.message)}),f=L({mutationFn:()=>zo(t),onSuccess:e=>{e.opened||r(`Your files are in ${e.path}.`,`info`)},onError:e=>r(e.message,`error`)}),p=u.data,g=b9(p),v=p?.move?.phase;if((0,m.useEffect)(()=>{v===`done`&&n.invalidateQueries({queryKey:e})},[v,n,e]),p===void 0)return(0,h.jsx)(`div`,{children:(0,h.jsx)(Sy,{title:`Your files`,meta:u.error?`Where your files are is unavailable. Reload the page to try again.`:`Loading…`})});if(p.docker)return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(Sy,{title:`Your files`,meta:p.folder??`The Docker project folder isn't set up.`,info:`settings.files.docker`,children:(0,h.jsx)(B,{disabled:p.folder===null||f.isPending,onClick:()=>f.mutate(),children:`Open folder`})}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-2 text-small text-ink-2`,children:[(0,h.jsx)(y9,{view:p}),p.dockerCommand===null?null:(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsxs)(`p`,{className:`m-0`,children:[`To move your projects to Documents/Slopify, run this on the computer running Docker (or use `,(0,h.jsx)(xL,{children:`--projects-dir <folder>`}),` for another folder):`]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(xL,{className:`min-w-0 break-all`,children:p.dockerCommand}),(0,h.jsx)(B,{variant:`quiet`,size:`small`,onClick:()=>{let e=p.dockerCommand??``;navigator.clipboard.writeText(e).then(()=>r(`Command copied.`,`success`)).catch(()=>r(`Copying failed: this browser doesn't allow it here. Select the command and copy it yourself.`,`error`))},children:`Copy command`})]})]})]})]});let y=v===`failed`||v===`interrupted`;return(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(Sy,{title:`Your files`,meta:p.folder,info:`settings.files`,children:[p.inDocuments||p.documentsRoot===null?null:(0,h.jsx)(B,{variant:`primary`,disabled:g||d.isPending,onClick:()=>d.mutate(`documents`),children:`Move to Documents/Slopify`}),(0,h.jsx)(B,{disabled:f.isPending,onClick:()=>f.mutate(),children:`Open folder`}),(0,h.jsx)(B,{variant:`quiet`,disabled:g||d.isPending,onClick:()=>{a(e=>!e),l(void 0)},children:`Choose another folder`})]}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-3 text-small text-ink-2`,children:[(0,h.jsx)(y9,{view:p}),i?(0,h.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2`,onSubmit:e=>{e.preventDefault(),d.mutate(o)},children:[(0,h.jsx)(_L,{label:`New folder`,tip:`settings.files.new-folder`,help:`The full path; it must be empty or new.`,error:c,className:`min-w-0 flex-1 basis-80`,children:(0,h.jsx)(X,{value:o,placeholder:p.documentsRoot??`/home/you/Videos/Slopify`,onChange:e=>s(e.target.value)})}),(0,h.jsx)(B,{type:`submit`,disabled:o.trim()===``||d.isPending,children:`Move here`})]}):c===void 0?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-danger`,children:c}),p.move===null?null:g?(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsxs)(`p`,{role:`status`,className:`m-0 text-ink tabular-nums`,children:[p.move.phase===`copying`?`Copying`:`Checking the copy of`,` your files to`,` `,p.move.target,`: `,p.move.files,` of `,p.move.totalFiles,` files (`,w5(p.move.bytes),` of `,w5(p.move.totalBytes),`). Keep Slopify running until it finishes.`]}),(0,h.jsx)($$,{progress:!0,label:p.move.phase===`copying`?`Files copied`:`Files checked`,value:p.move.totalBytes===0?0:p.move.bytes/p.move.totalBytes})]}):y?(0,h.jsx)(GM,{tone:v===`failed`?`danger`:`waiting`,title:v===`failed`?`Moving your files to ${p.move.target} stopped`:`Moving your files to ${p.move.target} didn't finish`,actions:(0,h.jsx)(B,{disabled:d.isPending,onClick:()=>d.mutate(p.move?.target??``),children:`Continue moving`}),children:p.move.error??`Slopify was stopped before the copy was checked, so it still uses the old folder. Continue moving picks up where it left off.`}):v===`done`&&p.move.oldFolder!==null?(0,h.jsxs)(GM,{tone:`info`,title:`Your files are now in ${p.move.target}`,children:[`Every file was copied and checked. The old folder `,p.move.oldFolder,` still has a copy; once your projects open fine, you can delete it to free the space.`]}):null]})]})}function y9({view:e}){let t=[[`Projects`,e.projects],[`Automatic backups`,e.backups],[`Exports`,e.exports]].filter(e=>e[1]!==null);return(0,h.jsx)(`dl`,{className:`m-0 grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1`,children:t.map(([e,t])=>(0,h.jsxs)(`div`,{className:`contents`,children:[(0,h.jsx)(`dt`,{className:`text-ink-3`,children:e}),(0,h.jsx)(`dd`,{className:`m-0 break-all`,children:t})]},e))})}function b9(e){return e?.move?.phase===`copying`||e?.move?.phase===`verifying`}var x9=30,cFe=[{value:`system`,label:`System`},{value:`dark`,label:`Dark`},{value:`light`,label:`Light`}];function lFe(e){let t=e.trim();return/^\d+$/.test(t)&&Number(t)>=0&&Number(t)<=x9?void 0:`The silence gap is a whole number of seconds between 0 and ${String(x9)}.`}function S9(){let{api:e}=V(),t=_();return L({mutationFn:t=>ns(e,t),onMutate:e=>{let n=t.getQueryData(H.settings);return t.setQueryData(H.settings,e),{previous:n}},onError:(e,n,r)=>{r?.previous!==void 0&&t.setQueryData(H.settings,r.previous)},onSuccess:e=>{t.setQueryData(H.settings,e)}})}function C9(){let{api:e}=V(),t=I(my(e));return t.error===null?t.data===void 0?{view:(0,h.jsxs)(`div`,{className:`grid gap-6 md:grid-cols-2`,role:`status`,"aria-label":`Loading settings`,children:[(0,h.jsx)(`span`,{className:`h-16 rounded-control bg-raised`}),(0,h.jsx)(`span`,{className:`h-16 rounded-control bg-raised`})]})}:{data:t.data}:{view:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-body text-danger`,children:t.error.message})}}function uFe(){let{data:e,view:t}=C9(),n=S9(),[r,i]=(0,m.useState)(void 0),[a,o]=(0,m.useState)(!1);if((0,m.useEffect)(()=>{if(!a)return;let e=setTimeout(()=>o(!1),t1);return()=>clearTimeout(e)},[a]),e===void 0)return t??(0,h.jsx)(`span`,{});let s=e,c=r??String(s.silenceGapSeconds),l=lFe(c);return(0,h.jsxs)(`div`,{className:`grid items-start gap-6 md:grid-cols-2`,children:[(0,h.jsx)(_L,{label:`Silence between segments`,tip:`settings.playback.silence-gap`,help:`Seconds of quiet between narrated segments.`,error:l??n.error?.message,children:(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,h.jsx)(X,{type:`number`,inputMode:`numeric`,min:0,max:x9,step:1,className:`w-[88px] tabular-nums`,value:c,"aria-invalid":l!==void 0,onChange:e=>{i(e.target.value)}}),(0,h.jsx)(`span`,{className:`text-small text-ink-2`,children:`seconds`}),(0,h.jsx)(B,{variant:`primary`,disabled:l!==void 0||n.isPending,onClick:()=>{o(!1),n.mutate({...s,silenceGapSeconds:Number(c.trim())},{onSuccess:()=>{i(void 0),o(!0)}})},children:`Save`}),(0,h.jsx)(`span`,{className:`inline-flex w-[52px]`,children:a?(0,h.jsx)(r1,{}):null})]})}),(0,h.jsx)(_L,{label:`Subtitle timing model`,tip:`settings.subtitle-model`,help:`Bigger hears the narration more accurately and, on most computers, is also faster. It downloads once, the first time captions are timed.`,error:n.error&&n.variables?.subtitleModel!==s.subtitleModel?`The subtitle timing model wasn't saved. ${n.error.message}`:void 0,children:(0,h.jsx)(bL,{className:`self-start`,value:s.subtitleModel??`fp32`,options:P3,onChange:e=>{let t=P3.find(t=>t.value===e.target.value);t!==void 0&&n.mutate({...s,subtitleModel:t.value})}})}),(0,h.jsx)(`div`,{className:`md:col-span-2`,children:(0,h.jsx)(i3,{value:s.loudness??RT,switchLabel:`Level the volume for new runs`,switchTip:`settings.loudness`,onChange:e=>{n.mutate({...s,loudness:e})}})})]})}function dFe(){let{data:e,view:t}=C9(),n=S9();if(e===void 0)return t??(0,h.jsx)(`span`,{});let r=e;return(0,h.jsxs)(`div`,{className:`sl-field`,...xy,children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,h.jsx)(`span`,{className:`sl-field__label`,children:`Appearance`}),(0,h.jsx)(U,{id:`settings.appearance`,className:`-my-1`})]}),(0,h.jsx)(wy,{label:`Appearance`,value:r.appearance,options:cFe,className:`self-start`,onChange:e=>{n.mutate({...r,appearance:e})}}),n.error?(0,h.jsxs)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:[`The appearance wasn't saved. `,n.error.message]}):null]})}var fFe=[{family:`llm`,label:`Text`,needed:`articles, scripts and descriptions`},{family:`tts`,label:`Voice`,needed:`narration, audiobooks and podcasts`},{family:`image`,label:`Images`,needed:`images and videos`}];function pFe(e){return fFe.map(({family:t,label:n,needed:r})=>{let i=e.filter(e=>e.family===t&&dk(e.readiness));return{label:n,ready:i.length>0,text:i.length>0?i.map(e=>e.displayName).join(`, `):`Not connected: needed for ${r}. Set one up below.`}})}function mFe(){let{api:e}=V(),t=I(cy(e));return t.data===void 0?null:(0,h.jsx)(`ul`,{"aria-label":`What is connected`,className:`m-0 flex list-none flex-col gap-1 p-0`,children:pFe(t.data.providers).map(e=>(0,h.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-3 text-small`,children:[(0,h.jsx)(`span`,{className:`w-16 shrink-0 font-semibold text-ink`,children:e.label}),(0,h.jsx)(KO,{tone:e.ready?`done`:`waiting`,children:e.ready?`Ready`:`Needs setup`}),(0,h.jsx)(`span`,{className:`min-w-0 text-ink-2`,children:e.text})]},e.label))})}function hFe(){let{api:e}=V(),t=I(rre(e));return(0,h.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[t.error===null?null:(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-body text-danger`,children:t.error.message}),t.data===void 0?t.error===null?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(SFe,{cells:5}),(0,h.jsx)(CFe,{})]}):null:(0,h.jsx)(_Fe,{usage:t.data})]})}var gFe=[{id:`stage`,header:`Stage`,cell:e=>xA[e.stage]},{id:`model`,header:`Provider · model`,cell:e=>vFe(e)},{id:`in`,header:`Tokens in`,numeric:!0,cell:e=>w9.format(e.tokensIn)},{id:`out`,header:`Tokens out`,numeric:!0,cell:e=>w9.format(e.tokensOut)}];function _Fe({usage:e}){let t=Object.values(e.counters).every(e=>e===0);return(0,h.jsxs)(Q0,{split:`even`,children:[(0,h.jsxs)($0,{children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(Z$,{children:xFe(e).map(e=>(0,h.jsx)(Q$,{label:e.label,value:e.value},e.label))}),t?(0,h.jsx)(`p`,{className:`m-0 mt-3 text-body text-ink-2`,children:`Numbers appear after your first run.`}):null]}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`Machine ID ${e.machineId??`not made yet`} · Slopify ${e.appVersion}`})]}),(0,h.jsx)($0,{children:(0,h.jsx)(`div`,{className:`min-w-0 overflow-x-auto`,children:(0,h.jsx)(e1,{caption:`Tokens by stage`,columns:gFe,rows:e.byStage,rowKey:e=>`${e.stage}/${e.provider}/${e.model??``}`,empty:`No stages have run yet.`,className:`min-w-[480px] [&_td]:pr-4 [&_th]:pr-4`})})})]})}function vFe(e){return e.model===null?e.provider:`${e.provider} · ${e.model}`}var w9=new Intl.NumberFormat(void 0,{maximumFractionDigits:0}),yFe=new Intl.NumberFormat(void 0,{maximumFractionDigits:1}),bFe=new Intl.NumberFormat(void 0,{notation:`compact`,maximumFractionDigits:1});function xFe(e){let t=e.counters;return[{label:`Videos made`,value:w9.format(t.videosMade)},{label:`Hours of audio`,value:yFe.format(t.audioSeconds/3600)},{label:`Images made`,value:w9.format(t.imagesMade)},{label:`Tokens used`,value:t.tokensUsed<1e6?w9.format(t.tokensUsed):bFe.format(t.tokensUsed)},{label:`Projects`,value:w9.format(t.projects)}]}function SFe({cells:e}){return(0,h.jsx)(`div`,{className:`sl-stats`,children:Array.from({length:e},(e,t)=>t).map(e=>(0,h.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(`span`,{className:`h-8 w-20 rounded-control bg-sunken`}),(0,h.jsx)(`span`,{className:`h-3 w-24 rounded-control bg-sunken`})]},e))})}function CFe(){return(0,h.jsx)(`div`,{className:`border-t border-line`,children:[0,1,2,3].map(e=>(0,h.jsxs)(`div`,{className:`flex items-center gap-4 border-b border-line py-3`,children:[(0,h.jsx)(`span`,{className:`h-3 w-24 rounded-control bg-sunken`}),(0,h.jsx)(`span`,{className:`h-3 w-56 max-w-[40%] rounded-control bg-sunken`}),(0,h.jsx)(`span`,{className:`ml-auto h-3 w-20 rounded-control bg-sunken`}),(0,h.jsx)(`span`,{className:`h-3 w-20 rounded-control bg-sunken`})]},e))})}function wFe(e){let t=document.createElement(`a`);t.href=`${e}/api/diagnostics`,t.download=`slopify-diagnostics.json`,document.body.append(t),t.click(),t.remove()}function TFe({section:e=`providers`,note:t,onSection:n=()=>{},onNote:r=()=>{}}){let{api:i}=V(),a=_(),o=wv(),s=U7(),c=p9(),l=ik(e),u=tk.find(e=>e.id===l)??tk[0],d=ak(l);Xy({id:`settings.check-providers`,title:`Check all providers`,group:`Settings`,keywords:[`health`,`keys`,`signed in`],run:()=>{n(`providers`),s.mutate()}}),Xy({id:`settings.back-up-now`,title:`Back up now`,group:`Settings`,keywords:[`backup`],run:()=>{n(`storage`),c.mutate(void 0,{onError:e=>{o(`The backup didn't start: ${e.message} Open Settings → Backup & storage to see its state.`,`error`)}})}}),Xy({id:`settings.download-diagnostics`,title:`Download diagnostics`,group:`Settings`,keywords:[`support`,`bug report`],run:()=>{wFe(i.origin)}});let f=d.sections.map(e=>({id:e,label:tk.find(t=>t.id===e)?.label??e}));return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(EG,{crumb:`Settings`,title:u.label,meta:u.meta,actions:(0,h.jsxs)(h.Fragment,{children:[l===`providers`?(0,h.jsx)(B,{disabled:s.isPending,onClick:()=>s.mutate(),children:s.isPending?`Checking…`:`Check all`}):null,(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,h.jsxs)(zO,{variant:`secondary`,href:`${i.origin}/api/diagnostics`,download:`slopify-diagnostics.json`,children:[(0,h.jsx)(Vc,{"aria-hidden":`true`,strokeWidth:1.75}),`Download diagnostics`]}),(0,h.jsx)(U,{id:`settings.diagnostics`})]})]})}),(0,h.jsxs)(DG,{sections:(0,h.jsx)(Q3,{label:`Settings sections`,children:rk.map(e=>(0,h.jsx)(e6,{current:e.id===d.id,onClick:()=>n(e.sections[0]??`providers`),className:`whitespace-nowrap max-md:w-auto`,children:e.label},e.id))}),children:[f.length>1?(0,h.jsx)(pQ,{items:f,value:l,onChange:n,label:`${d.label} sections`,idPrefix:`settings`,className:`mb-6`}):null,(0,h.jsx)(mQ,{idPrefix:`settings`,id:l,active:!0,children:(0,h.jsxs)(`section`,{"aria-label":u.label,className:`flex min-w-0 flex-col gap-10`,children:[l===`providers`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(mFe,{}),(0,h.jsx)($2,{}),(0,h.jsx)(hPe,{}),(0,h.jsx)(aPe,{run:s})]}):null,l===`general`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(dFe,{}),(0,h.jsx)(Sre,{})]}):null,l===`voices`?(0,h.jsx)(bPe,{}):null,l===`models`?(0,h.jsx)($Ne,{}):null,l===`agents`?(0,h.jsx)(ZNe,{}):null,l===`playback`?(0,h.jsx)(uFe,{}):null,l===`notifications`?(0,h.jsx)(DPe,{}):null,l===`channel-links`?(0,h.jsx)(eSe,{}):null,l===`studio`?(0,h.jsx)(QB,{}):null,l===`storage`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(ZPe,{}),(0,h.jsx)(sFe,{usageQueryKey:h9}),(0,h.jsx)(iFe,{}),(0,h.jsx)(jPe,{})]}):null,l===`trash`?(0,h.jsx)(WPe,{}):null,l===`usage`?(0,h.jsx)(hFe,{}):null,l===`patch-notes`?(0,h.jsx)(PPe,{note:t,onNote:r}):null,l===`about`?(0,h.jsx)(YPe,{onWhatsNew:()=>{a.fetchQuery(FM(i)).then(e=>r(e.current??void 0),e=>{o(`The patch notes did not open: ${e instanceof Error?e.message:String(e)} Open Settings → About → Patch notes to try again.`,`error`)})}}):null]})})]})]})}function EFe({open:e,onClose:t,onInstalled:n}){let{api:r}=V(),i=_(),a=I({queryKey:Vv,queryFn:()=>Gv(r),enabled:e}),o=L({mutationFn:e=>qv(r,e),onSuccess:()=>n(),onSettled:()=>i.invalidateQueries({queryKey:Vv})});return(0,h.jsxs)(NM,{open:e,title:`Add a starter pack`,onClose:t,footer:(0,h.jsx)(WR,{tone:o.error||a.error?`error`:`success`,children:o.error?.message??a.error?.message??(o.data===void 0?void 0:o.data.added?`Added: its prompts are in Prompts and its template is in this list.`:`That pack was already added.`)}),children:[(0,h.jsxs)(`p`,{className:`mb-4 flex items-center gap-1 text-small text-ink-2`,children:[`Prompts, a suggested voice and a template for one kind of channel.`,(0,h.jsx)(U,{id:`welcome.packs`})]}),(0,h.jsxs)(mR,{label:`Starter packs`,className:`[&_.sl-row__meta]:whitespace-normal`,children:[(a.data?.packs??[]).map(e=>(0,h.jsx)(hR,{title:e.name,meta:e.summary,actions:(0,h.jsx)(B,{disabled:e.installed||o.isPending,onClick:()=>o.mutate(e.id),children:e.installed?`Added`:`Add pack`})},e.id)),a.data===void 0?(0,h.jsx)(hR,{title:`Loading packs…`}):null]})]})}function DFe({template:e}){let{api:t}=V(),n=I({queryKey:[...yO,e.id,e.version],queryFn:async()=>{let n=await wO(t,e.id);if(!n.ok)throw Error(n.message);return n.value}});if(n.error)return(0,h.jsxs)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:[`The keywords of `,e.name,` didn't load. `,n.error.message,` Press Keywords again.`]});if(!n.data)return(0,h.jsx)(`p`,{role:`status`,className:`m-0 text-small text-ink-2`,children:`Reading the keywords…`});let{form:r,librarySnapshot:i}=n.data.document,a=wQ({form:r,prompts:i?.prompts??[],entries:i?.entries??[]}),o=Q2(r.title),s=[...new Set([...a.keys(),...Object.keys(r.values)])];return(0,h.jsx)(MQ,{keywords:s.map(e=>({name:e,value:r.values[e]??``,feeds:a.get(e)??[],topic:o.includes(e)})),empty:`No keywords: the prompts and the title name none.`})}async function OFe(e,t,n,r){let i=await EO(e,t.id,{baseVersion:t.version,mutationId:r,...n});if(!i.ok)throw Error(i.message);return i.value}function kFe({template:e}){return e===void 0?(0,h.jsx)(`p`,{className:`m-0 py-3 text-small text-ink-2`,children:`Pick a template to see the keywords it fills.`}):(0,h.jsxs)(`section`,{"aria-label":`Keywords of ${e.name}`,className:`flex flex-col gap-4`,children:[(0,h.jsx)(Sy,{title:e.name,as:`h3`,info:`templates.edit`,className:`pb-0`,meta:(0,h.jsxs)(h.Fragment,{children:[`Version ${String(e.version)} · saved `,(0,h.jsx)(d0,{iso:e.updatedAt,children:s0(e.updatedAt)})]})}),(0,h.jsx)(DFe,{template:e}),(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`To change the settings, press Use in Play, change the draft, then Save a setup.`})]})}function AFe({template:e,onClose:t}){let{api:n}=V(),r=_(),i=Array.from({length:e.version},(t,n)=>e.version-n),a=rt({queries:i.map(t=>({queryKey:[...yO,e.id,`version`,t],queryFn:async()=>{let r=await wO(n,e.id,t);if(!r.ok)throw Error(r.message);return r.value},staleTime:1/0}))}),o=a[0]?.data,[s,c]=(0,m.useState)(i[1]??e.version),l=a[i.indexOf(s)]?.data,u=(0,m.useRef)(crypto.randomUUID()),d=wv(),f=L({mutationFn:t=>OFe(n,e,{name:t.name,document:t.document},u.current),onSuccess:async(n,i)=>{u.current=crypto.randomUUID(),d(`Restored version ${String(i.version)} of ${e.name} as version ${String(n.version)}.`,`success`),await r.invalidateQueries({queryKey:yO}),t()}}),p=a.find(e=>e.error!==null)?.error;return(0,h.jsx)(NM,{open:!0,title:`History of ${e.name}`,onClose:t,className:`sm:w-[min(1080px,100vw)]`,children:(0,h.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[p?(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-body text-danger`,children:`A version couldn't be read: ${p.message} Close History and open it again.`}):null,(0,h.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,h.jsx)(Sy,{title:`Versions`,as:`h3`,info:`templates.history`}),(0,h.jsx)(mR,{label:`Versions of ${e.name}`,children:i.map((t,n)=>{let r=a[n]?.data;return(0,h.jsx)(hR,{title:`Version ${String(t)}`,selected:t===s,onSelect:()=>c(t),meta:r===void 0?`Loading…`:(0,h.jsxs)(h.Fragment,{children:[`${r.name} · `,(0,h.jsx)(d0,{iso:r.updatedAt,children:s0(r.updatedAt)})]}),actions:t===e.version?(0,h.jsx)(`span`,{className:`text-small text-ink-2`,children:`Current`}):(0,h.jsx)(B,{size:`small`,"aria-label":`Restore version ${String(t)}`,disabled:r===void 0||f.isPending,disabledReason:r===void 0?`Reading the version`:`Restoring`,onClick:()=>{r!==void 0&&f.mutate(r)},children:`Restore`})},t)})}),(0,h.jsx)(WR,{tone:`error`,children:f.error===null?void 0:`The version wasn't restored: ${f.error.message}`})]}),(0,h.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,h.jsx)(Sy,{title:`Compare with the current version`,as:`h3`}),o===void 0||l===void 0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Loading the versions…`}):l.version===o.version?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:e.version===1?`This is the only version so far.`:`Pick an older version in the list to compare it.`}):(0,h.jsxs)(h.Fragment,{children:[l.name===o.name?null:(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-2`,children:`Renamed from "${l.name}" to "${o.name}".`}),(0,h.jsx)(e0,{before:T9(l),after:T9(o),beforeLabel:`Version ${String(l.version)}`,afterLabel:`Version ${String(o.version)} (current)`})]})]})]})})}function T9(e){return JSON.stringify(e.document,null,1).split(`
|
|
325
325
|
`).map(e=>e.trim()).filter(e=>!/^[[\]{}],?$/u.test(e)).join(`
|
|
326
|
-
`)}function jFe({open:e,onClose:t,templates:n,channels:r,pending:i,error:a,execute:o}){let{api:s}=V(),c=_(),l=wv(),u=I({queryKey:[`play-drafts`],queryFn:async()=>{let e=await vk(s);if(!e.ok)throw Error(e.message);return e.value.drafts}}),[d,f]=(0,m.useState)(``),[p,g]=(0,m.useState)(``),[v,y]=(0,m.useState)(``),b=(0,m.useRef)(null);async function x(){let e=await bk(s,d);if(!e.ok)throw Error(e.message);let r=JSON.stringify([d,e.value.draft.version,p.trim(),v]);b.current?.key!==r&&(b.current={key:r,id:crypto.randomUUID()});let i=e.value.draft.document,a=n?.find(e=>e.id===i.templateSource?.id),o=v||i.channelId||(a?gQ(a):void 0),u=await TO(s,{id:b.current.id,name:p.trim(),document:o===void 0?i:{...i,channelId:o}});if(!u.ok)throw b.current=null,Error(u.message);b.current=null,g(``),t(),l(`Template saved.`,`success`),await c.invalidateQueries({queryKey:yO})}return(0,h.jsxs)(NM,{open:e,title:`Save a setup`,width:`narrow`,onClose:t,footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(WR,{tone:a?`error`:`info`,children:a??(i?`Saving…`:void 0)}),(0,h.jsx)(B,{type:`submit`,form:`save-template-form`,variant:`primary`,disabled:i||!d||!p.trim(),children:`Save template`})]}),children:[(0,h.jsxs)(`p`,{className:`m-0 mb-4 text-small text-ink-2`,children:[`Choose a saved Play draft, or`,` `,(0,h.jsx)(fa,{to:`/play`,className:`text-accent-ink underline`,children:`open Play`}),` `,`to prepare one.`]}),(0,h.jsx)(`p`,{className:`mb-4 text-small text-ink-2`,children:`A template keeps the settings, not one video's topic.`}),(0,h.jsxs)(`form`,{id:`save-template-form`,"aria-label":`Save a setup`,className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),d&&p.trim()&&o(x)},children:[(0,h.jsx)(_L,{label:`Saved Play draft`,tip:`templates.save.draft`,help:u.isPending?`Loading saved drafts…`:u.data?.length===0?`No saved drafts yet.`:void 0,children:(0,h.jsxs)(bL,{value:d,required:!0,disabled:i,onChange:e=>f(e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:`Choose a draft`}),u.data?.filter(e=>e.readable).map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.title||`Untitled draft`},e.id))]})}),u.error?(0,h.jsx)(GM,{tone:`danger`,title:`The saved drafts couldn't be loaded.`,actions:(0,h.jsx)(B,{size:`small`,onClick:()=>void u.refetch(),children:`Reload drafts`}),children:u.error.message}):null,(0,h.jsx)(_L,{label:`Template name`,id:`template-name`,tip:`templates.save.name`,children:(0,h.jsx)(X,{value:p,required:!0,maxLength:120,disabled:i,onChange:e=>g(e.target.value)})}),(0,h.jsx)(_L,{label:`Channel`,id:`template-channel`,tip:`templates.save.channel`,children:(0,h.jsxs)(bL,{value:v,disabled:i,onChange:e=>y(e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:`The draft's channel`}),r.map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.name},e.id))]})})]})]})}function MFe({onApplied:e,beforeApply:t,getGeneration:n,blocked:r}){let{api:i}=V(),a=_(),o=wv(),s=(0,m.useRef)(new Map),c=(0,m.useRef)(new Map),l=(0,m.useRef)(!0);(0,m.useEffect)(()=>(l.current=!0,()=>{l.current=!1}),[]);async function u(o){let s=n?.();if(r||t&&!await t())throw Error(`Save or discard the draft open in Play first, then apply the template again.`);if(!l.current||s!==void 0&&s!==n?.())return;let u=`${o.id}:${o.version}`,d=c.current.get(u);d||(d=crypto.randomUUID(),c.current.set(u,d));let f=await OO(i,o,d);if(!f.ok)throw c.current.delete(u),Error(f.message);if(!(!l.current||s!==void 0&&s!==n?.())&&(await a.invalidateQueries({queryKey:[`play-drafts`]}),!(!l.current||s!==void 0&&s!==n?.()))){if(await e(f.value.draft.id,()=>l.current)!==!1)c.current.delete(u);else throw Error(`The template's draft was created but didn't open. Press Use in Play again to open it.`)}}async function d(e){let t=`${e.id}:${e.version}`,n=s.current.get(t);n||(n=crypto.randomUUID(),s.current.set(t,n));let r=await wO(i,e.id);if(!r.ok)throw Error(r.message);let c=await TO(i,{id:n,name:`${e.name} copy`,document:r.value.document});if(!c.ok)throw Error(c.message);s.current.delete(t),o(`Duplicated as ${c.value.name}.`,`success`),await a.invalidateQueries({queryKey:yO})}return{apply:u,duplicate:d}}function NFe(e,t){let{api:n}=V();return C0({noun:[`template`,`templates`],listKey:yO,all:e,nameMax:120,duplicate:async(e,t)=>{let r=await wO(n,e.id);if(!r.ok)return r.message;let i=await TO(n,{id:crypto.randomUUID(),name:t,document:r.value.document});return i.ok?null:i.message},remove:async e=>{let t=await DO(n,e);if(!t.ok)throw Error(t.message)},trash:`template`,selection:t})}function PFe({onApplied:e,beforeApply:t,getGeneration:n,blocked:r=!1}){let{api:i}=V(),a=_(),o=I(CO(i)),s=I(Ry(i)),c=qy().channelId,[l,u]=(0,m.useState)(c??``),[d,f]=(0,m.useState)(``),[p,g]=Y1(`template`),v=d.trim().toLowerCase(),y=o.data?.filter(e=>l===``||gQ(e)===l),b=y===void 0?void 0:q1(y.filter(e=>e.name.toLowerCase().includes(v)),p),x=AG(b?.map(e=>e.id)??[]),S=b?.filter(e=>x.has(e.id))??[],C=NFe(o.data??[],x),w=e=>s.data?.find(t=>t.id===gQ(e))?.name,[T,E]=(0,m.useState)(!1),[D,O]=(0,m.useState)(null),k=wv(),[A,j]=(0,m.useState)(!1),[M,N]=(0,m.useState)(!1),[P,ee]=(0,m.useState)(null),[F,te]=pL(),[ne,re]=(0,m.useState)(null),ie=(0,m.useRef)(!1);async function ae(e){if(!ie.current){ie.current=!0,E(!0),O(null);try{await e()}catch(e){O(e instanceof Error?e.message:`That didn't finish. Try again.`)}finally{ie.current=!1,E(!1)}}}let{apply:oe,duplicate:se}=MFe({onApplied:e,beforeApply:t,getGeneration:n,blocked:r});async function ce(){if(!P)return;let e=P.id,t=await DO(i,P);if(!t.ok)throw Error(t.message);ee(null),await a.cancelQueries({queryKey:yO}),a.setQueryData(yO,t=>t?.filter(t=>t.id!==e)),k(`Template moved to the trash. Restore it in Settings → Trash within 30 days.`,`success`),await a.invalidateQueries({queryKey:yO})}Xy({id:`library.save-template`,title:`Save a setup as a template`,group:`Library`,keywords:[`template`,`new template`,`play draft`],run:()=>j(!0)});let le=D&&!P?{tone:`error`,text:D}:r?{tone:`warning`,text:`A run is still starting in Play. Wait for it to finish (or press Check whether it started there), then apply a template.`}:o.error?{tone:`error`,text:o.error.message}:o.isPending?{tone:`info`,text:`Loading templates…`}:void 0;return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(EFe,{open:M,onClose:()=>N(!1),onInstalled:()=>void a.invalidateQueries({queryKey:CO(i).queryKey})}),(0,h.jsxs)(j0,{action:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(B,{variant:`secondary`,onClick:()=>N(!0),"aria-expanded":M,children:`Add pack`}),(0,h.jsx)(U,{id:`welcome.packs`,label:`Add pack`})]}),(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(B,{variant:`primary`,onClick:()=>j(!0),"aria-expanded":A,children:`Save a setup`}),(0,h.jsx)(U,{id:`templates.save`,label:`Save a setup`})]})]}),children:[(0,h.jsx)(X,{type:`search`,"aria-label":`Search templates`,placeholder:`Search templates`,value:d,className:`w-full min-w-0 sm:w-56`,onChange:e=>f(e.target.value)}),(0,h.jsxs)(`span`,{className:`flex w-full items-center gap-1 sm:w-auto`,...xy,children:[(0,h.jsxs)(bL,{"aria-label":`Show templates of`,value:l,className:`w-full sm:w-56`,onChange:e=>u(e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:`All channels`}),(s.data??[]).map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,h.jsx)(U,{id:`templates.show-channel`})]}),(0,h.jsx)(X1,{what:`templates`,sort:p,onSort:g}),(0,h.jsxs)(`p`,{className:`m-0 flex items-center gap-1 text-small text-ink-2`,children:[`Reuse a Play setup and its checkpoint choices. Use in Play creates a fresh draft to review.`,(0,h.jsx)(U,{id:`templates.apply`,label:`Use in Play`})]})]}),(0,h.jsxs)(`div`,{className:`mb-2 flex min-h-8 flex-wrap items-center gap-3`,children:[(0,h.jsx)(WR,{tone:le?.tone??`info`,children:le?.text}),o.error?(0,h.jsx)(B,{size:`small`,onClick:()=>void o.refetch(),children:`Reload templates`}):null,(0,h.jsx)(B,{variant:`quiet`,size:`small`,disabled:T||o.isFetching,onClick:()=>void o.refetch(),children:`Refresh templates`})]}),o.data?.length===0?(0,h.jsx)(hQ,{title:`No templates yet`,children:`Use Save a setup to keep a Play draft for reuse.`}):null,o.data?.length&&b?.length===0?(0,h.jsx)(`p`,{className:`m-0 py-3 text-small text-ink-2`,children:v===``?`No templates in this channel.`:`No templates match "${d.trim()}"${l===``?``:` in this channel`}.`}):null,o.isPending&&!o.error?(0,h.jsx)(U1,{label:`Project templates`}):null,b?.length?(0,h.jsx)(OG,{className:V1,list:(0,h.jsxs)(P1,{selection:x,children:[(0,h.jsx)(N1,{selection:x,total:b.length,noun:[`template`,`templates`],scope:b.length===o.data?.length?void 0:`Select all ${String(b.length)} shown`,busy:C.busy||T,onDuplicate:()=>C.duplicate(S),onDelete:()=>C.remove(S)}),(0,h.jsx)(mR,{label:`Project templates`,children:b.map(e=>(0,h.jsxs)(m.Fragment,{children:[(0,h.jsx)(hR,{className:`max-md:grid-cols-1`,lead:(0,h.jsx)(MG,{selection:x,value:e.id,label:e.name}),title:(0,h.jsx)(P0,{name:e.name,maxLength:120,onSelect:()=>te(e.id),onRename:async t=>{let n=await sue(i,e.id,t);return await a.invalidateQueries({queryKey:yO}),n}}),selected:e.id===F,meta:(0,h.jsxs)(h.Fragment,{children:[w(e)===void 0?``:`${w(e)} · `,`Version `,e.version,` · updated `,(0,h.jsx)(d0,{iso:e.updatedAt})]}),actions:(0,h.jsx)(G1,{name:e.name,edit:(0,h.jsx)(B,{variant:`quiet`,size:`small`,"aria-label":`Edit ${e.name}`,onClick:()=>te(e.id),children:`Edit`}),duplicate:(0,h.jsx)(B,{variant:`quiet`,size:`small`,"aria-label":`Duplicate ${e.name}`,disabled:T,disabledReason:`Working on the last press`,onClick:()=>void ae(()=>se(e)),children:`Duplicate`}),play:{run:()=>void ae(()=>oe(e)),blocked:r?`A run is still starting in Play. Wait for it, then use the template.`:T?`Working on the last press`:void 0},onHistory:()=>re(e),onDelete:()=>{ee(e),O(null)}})}),(0,h.jsx)(r$,{kind:`template`,id:e.id,name:e.name})]},e.id))})]}),detail:(0,h.jsx)(kFe,{template:o.data?.find(e=>e.id===F)})}):null,(0,h.jsx)(jFe,{open:A,onClose:()=>j(!1),templates:o.data,channels:s.data??[],pending:T,error:D,execute:ae}),ne===null?null:(0,h.jsx)(AFe,{template:ne,onClose:()=>re(null)},`${ne.id}:${String(ne.version)}`),(0,h.jsx)(Bv,{open:P!==null,title:`Delete ${P?.name??`template`}?`,consequence:D??`Moves it to the trash for 30 days (Settings → Trash). Existing projects and drafts keep their setup.`,confirmLabel:`Delete template`,pending:T,onConfirm:()=>void ae(ce),onCancel:()=>{T||ee(null)}})]})}function FFe({page:e,anchor:t,words:n}){let{api:r}=V(),i=I(nL(r)),a=I(xve(r,e)),o=Ji(),[s,c]=(0,m.useState)(n??``);(0,m.useEffect)(()=>{c(n??``)},[n]);let l=(0,m.useRef)(null),u=(0,m.useMemo)(()=>new Set((i.data?.pages??[]).map(e=>e.id)),[i.data]),d=i.data?.pages.find(t=>t.id===e)?.title??e.replace(/-/g,` `),f=(0,m.useMemo)(()=>pre(a.data??``),[a.data]),p=(0,m.useMemo)(()=>a.data===void 0?``:fre(f.body,u,e),[a.data,f.body,u,e]);(0,m.useEffect)(()=>{if(p===``)return;let e=l.current;if(e===null)return;let n=t===void 0?void 0:hre(e,t,f.title===void 0?[]:[f.title]);n===void 0?window.scrollTo?.({top:0}):n.scrollIntoView?.({block:`start`})},[p,t,f.title]);let g=i.data?.groups.find(t=>t.pages.some(t=>t.id===e));return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(EG,{crumb:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`span`,{children:`Help`}),(0,h.jsx)(`span`,{"aria-hidden":`true`,children:`›`}),(0,h.jsx)(fa,{to:`/help/tutorials/$page`,params:{page:i.data?.home.id??`Home`},children:`Tutorials`})]}),title:d,meta:g===void 0?`Guides to every screen of Slopify, for the version you are running.`:g.title,actions:(0,h.jsx)(LO,{to:`/welcome`,variant:`quiet`,children:`Welcome screen`})}),(0,h.jsx)(DG,{className:`sl-workspace--tutorials`,sections:(0,h.jsx)(IFe,{index:i.data,page:e,onOpenHit:(e,t)=>{o({to:`/help/tutorials/$page`,params:{page:e.page},search:{q:t},...e.anchor===``?{}:{hash:e.anchor}})}}),children:a.error===null?(0,h.jsxs)(`div`,{ref:l,onClick:e=>{if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey)return;let t=e.target.closest(`a`),n=t?.getAttribute(`href`);if(t===null||n==null)return;let r=mre(n);if(r!==void 0){e.preventDefault(),o({to:`/help/tutorials/$page`,params:{page:r.page},...r.anchor===void 0?{}:{hash:r.anchor}});return}/^https?:/.test(n)&&(e.preventDefault(),window.open(n,`_blank`,`noopener,noreferrer`))},children:[(0,h.jsx)(ZI,{markdown:p,label:`Tutorial`,what:`tutorial`,query:s,onQuery:c,anchorPrefix:`tutorial-`,children:(0,h.jsx)(`p`,{className:`m-0 text-ink-3`,children:`Loading the tutorial…`})}),i.data?.footer?(0,h.jsx)(`p`,{className:`mt-8 border-t border-line pt-4 text-small text-ink-3`,children:i.data.footer.replace(/\[([^\]]+)\]\([^)]+\)/g,`$1`)}):null]}):(0,h.jsx)(GM,{tone:`danger`,title:`This tutorial did not load`,actions:(0,h.jsx)(B,{onClick:()=>void a.refetch(),variant:`secondary`,children:`Try again`}),children:`${a.error.message} Press Try again, or pick another page on the left.`})})]})}function IFe({index:e,page:t,onOpenHit:n}){let{api:r}=V(),[i,a]=(0,m.useState)(``),[o,s]=(0,m.useState)(``),c=(0,m.useRef)(null),l=(0,m.useId)();Zy(c,`the tutorials`),(0,m.useEffect)(()=>{let e=setTimeout(()=>s(i.trim()),200);return()=>clearTimeout(e)},[i]);let u=I(Sve(r,o));return(0,h.jsxs)(`nav`,{"aria-label":`Tutorials`,className:`flex min-w-0 flex-col gap-4`,children:[(0,h.jsxs)(`div`,{className:`relative`,children:[(0,h.jsx)(`label`,{htmlFor:l,className:`sr-only`,children:`Search all tutorials`}),(0,h.jsx)(_l,{"aria-hidden":`true`,strokeWidth:1.75,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-ink-3`}),(0,h.jsx)(`input`,{ref:c,id:l,type:`search`,value:i,placeholder:`Search all tutorials`,onChange:e=>a(e.target.value),onKeyDown:e=>{let t=u.data?.hits[0];e.key===`Enter`&&t!==void 0&&(e.preventDefault(),n(t,o))},className:`sl-input pl-9`})]}),o===``?e===void 0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`Loading the tutorials…`}):(0,h.jsxs)(`div`,{className:`sl-tutorials-nav flex flex-col gap-4`,children:[(0,h.jsx)(E9,{id:e.home.id,title:e.home.title,current:t}),e.groups.map(e=>(0,h.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,h.jsx)(`div`,{className:`sl-kicker px-2.5 pb-1`,children:e.title}),e.pages.map(e=>(0,h.jsx)(E9,{id:e.id,title:e.title,current:t},e.id))]},e.title))]}):(0,h.jsx)(LFe,{query:o,hits:u.data?.hits,error:u.error?.message})]})}function E9({id:e,title:t,current:n}){return(0,h.jsx)(fa,{to:`/help/tutorials/$page`,params:{page:e},"aria-current":e===n?`page`:void 0,className:`sl-tutorials-nav__link`,children:t})}function LFe({query:e,hits:t,error:n}){return n===void 0?t===void 0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`Searching…`}):t.length===0?(0,h.jsx)(`p`,{role:`status`,className:`m-0 text-small text-ink-2`,children:`No tutorial mentions "${e}". Try fewer or other words.`}):(0,h.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`p`,{role:`status`,className:`m-0 px-2.5 text-small text-ink-3`,children:t.length===1?`1 section`:`${String(t.length)} sections`}),(0,h.jsx)(`ul`,{"aria-label":`Search results`,className:`m-0 flex list-none flex-col gap-1 p-0`,children:t.map(t=>(0,h.jsx)(`li`,{children:(0,h.jsxs)(fa,{to:`/help/tutorials/$page`,params:{page:t.page},search:{q:e},...t.anchor===``?{}:{hash:t.anchor},className:`sl-tutorials-hit`,children:[(0,h.jsx)(`span`,{className:`block font-semibold text-ink`,children:t.heading===void 0?t.pageTitle:t.heading}),t.heading===void 0?null:(0,h.jsx)(`span`,{className:`block text-label text-ink-3`,children:t.pageTitle}),(0,h.jsx)(`span`,{className:`mt-0.5 block text-small text-ink-2`,children:t.snippet})]})},`${t.page}#${t.anchor}`))})]}):(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:`The search didn't run: ${n} Change the words or reload the page.`})}var RFe=[{id:`library`,name:`The Library of Alexandria`,summary:`A narrated video with its two shorts, article, PDF, description and images.`,action:`Explore the sample`},{id:`audiobook`,name:`The Wind in the Willows`,summary:`An audiobook: a narrator and two character voices, captions tagged with who speaks, MP3 and M4B with chapters.`,action:`See an audiobook`},{id:`podcast`,name:`The Antikythera Mechanism`,summary:`A two-host podcast with the speaker panel, name tags and portraits, and its MP3 and M4B.`,action:`Hear a podcast`}],D9=[{id:`found`,label:`What you have`},{id:`style`,label:`Pick a style`},{id:`make`,label:`Make your first short`}];function zFe({at:e,onPick:t}){return(0,h.jsx)(u2,{label:`First-run steps`,dense:!0,className:`mb-6 max-w-md`,steps:D9.map((n,r)=>({id:n.id,tone:r<e?`done`:r===e?`info`:`off`,state:r<e?`done`:r===e?`current step`:`not yet`,name:(0,h.jsx)(B,{variant:`quiet`,size:`small`,"aria-current":r===e?`step`:void 0,onClick:()=>t(n.id),children:`${String(r+1)} · ${n.label}`}),detail:r===e?`Step ${String(r+1)} of ${String(D9.length)}`:``}))})}function O9({id:e,active:t,children:n}){let r=D9.find(t=>t.id===e)?.label??``;return(0,h.jsx)(`section`,{id:`welcome-step-${e}`,"aria-label":r,tabIndex:-1,hidden:!t,className:`outline-none`,children:n})}function BFe(e){return e.length<=2?e.join(` or `):`${e.slice(0,-1).join(`, `)} or ${e.at(-1)??``}`}function VFe(e){return e===void 0?{ready:!1,text:`Looking for a voice…`}:e.keyed===null?e.system.available?{ready:!0,text:`Narration uses your computer's built-in voice${e.system.engine===null?``:` (${e.system.engine})`}; add an ElevenLabs or OpenAI key later for a better one.`}:{ready:!1,text:e.system.issue??`No voice can narrate yet. Add an ElevenLabs or OpenAI key in Settings → Providers.`}:{ready:!0,text:`Narration uses your ${e.keyed} voice key.`}}function HFe(){let{api:e}=V(),t=_(),n=Ji(),r=I({queryKey:Vv,queryFn:()=>Gv(e)}),[i,a]=(0,m.useState)(`found`),[o,s]=(0,m.useState)(``),[c,l]=(0,m.useState)(``),[u,d]=(0,m.useState)(void 0),f=(0,m.useRef)(void 0),p=L({mutationFn:()=>Kv(e),onSuccess:async()=>{await t.invalidateQueries({queryKey:Vv}),await n({to:`/`})}}),g=L({mutationFn:t=>qv(e,t),onSettled:()=>t.invalidateQueries({queryKey:Vv})}),v=L({mutationFn:()=>(f.current??=crypto.randomUUID(),Jv(e,{topic:o,requestId:f.current,...c===``?{}:{packId:c}})),onSuccess:async({projectId:e})=>{f.current=void 0,d(e),await t.invalidateQueries({queryKey:H.projects}),await t.invalidateQueries({queryKey:H.voices})}}),y=e=>{e.preventDefault(),o.trim()!==``&&v.mutate()},b=r.data,x=b?.clis.filter(e=>e.ready)??[],S=VFe(b?.voice),C=c===``?`General`:b?.packs.find(e=>e.id===c)?.name??c,w=v.error?{tone:`error`,text:v.error.message}:g.error?{tone:`error`,text:g.error.message}:p.error?{tone:`error`,text:p.error.message}:v.isPending?{tone:`info`,text:`Starting your short…`}:void 0,T=D9.findIndex(e=>e.id===i),E=e=>{a(e),requestAnimationFrame(()=>document.getElementById(`welcome-step-${e}`)?.focus())},D=D9[T+1],O=D9[T-1];return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(EG,{title:`Welcome to Slopify`,meta:`Make a video from a topic, with the tools already on this computer.`,actions:(0,h.jsx)(B,{variant:`quiet`,disabled:p.isPending,onClick:()=>p.mutate(),children:u===void 0?`Skip`:`Done`})}),r.error?(0,h.jsx)(GM,{tone:`danger`,title:`Could not read what this computer has`,className:`mb-6`,children:r.error.message}):null,(0,h.jsx)(zFe,{at:T,onPick:E}),(0,h.jsxs)(O9,{id:`found`,active:i===`found`,children:[(0,h.jsx)(Sy,{title:`Found on this computer`,info:`welcome.found`}),(0,h.jsxs)(mR,{label:`Tools found on this computer`,className:`mb-4`,children:[(b?.clis??[]).map(e=>(0,h.jsx)(hR,{title:e.name,actions:(0,h.jsx)(`span`,{className:`text-small text-ink-2`,children:e.ready?`Ready${e.version===null?``:` · ${e.version}`}${e.draws?` · writes and draws`:` · writes`}`:e.installed?e.issue??`Installed, not usable yet`:`Not found`})},e.id)),b===void 0?(0,h.jsx)(hR,{title:`Looking for installed tools…`}):null]}),b!==void 0&&x.length>0?(0,h.jsx)(`p`,{className:`mb-6 text-small text-ink-2`,children:`You can make a video now: no API keys are needed for ${BFe([`the text`,...x.some(e=>e.draws)?[`the images`]:[],...S.ready&&b.voice.keyed===null?[`the narration`]:[]])}.`}):null,b!==void 0&&x.length===0?(0,h.jsx)(GM,{tone:`waiting`,className:`mb-6`,title:`Nothing on this computer can write the script yet.`,actions:(0,h.jsx)(LO,{to:`/settings`,search:{section:`providers`},children:`Open Settings → Providers`}),children:`Install Claude Code, Codex or Gemini CLI and sign in to it, then press Check again; or add an OpenRouter key in Settings → Providers.`}):null,(0,h.jsx)(Sy,{title:`Narration voice`,info:`welcome.voice`}),b===void 0?(0,h.jsx)(mR,{label:`Narration voice`,className:`mb-6`,children:(0,h.jsx)(hR,{title:`Looking for a voice…`})}):(0,h.jsx)(k9,{voice:S,checking:r.isFetching,onCheck:()=>void r.refetch()})]}),(0,h.jsxs)(O9,{id:`style`,active:i===`style`,children:[(0,h.jsx)(Sy,{title:`Pick a style`,info:`welcome.pack`}),(0,h.jsx)(mR,{label:`Styles`,className:`mb-3 [&_.sl-row__meta]:whitespace-normal`,children:[{id:``,name:`General`,summary:`A neutral explainer style.`,installed:!1,library:!1},...(b?.packs??[]).map(e=>({...e,library:!0}))].map(e=>(0,h.jsx)(hR,{title:e.name,meta:e.summary,selected:c===e.id,actions:(0,h.jsxs)(h.Fragment,{children:[e.library?(0,h.jsx)(B,{variant:`quiet`,disabled:e.installed||g.isPending,"aria-label":e.installed?`${e.name} is in your library`:`Add ${e.name} to library`,onClick:()=>g.mutate(e.id),children:e.installed?`In your library`:`Add to library`}):null,(0,h.jsx)(B,{variant:c===e.id?`primary`:`secondary`,"aria-pressed":c===e.id,"aria-label":`Use ${e.name}`,onClick:()=>l(e.id),children:c===e.id?`Picked`:`Use this style`})]})},e.id===``?`general`:e.id))}),(0,h.jsxs)(`p`,{className:`mb-6 flex items-center gap-1 text-small text-ink-2`,...xy,children:[`Add to library keeps a pack's prompts and Play template for later videos.`,(0,h.jsx)(U,{id:`welcome.packs`,className:`-my-1`})]})]}),(0,h.jsxs)(O9,{id:`make`,active:i===`make`,children:[u===void 0?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Sy,{title:`Make a 60-second short`,info:`welcome.short`}),(0,h.jsxs)(`p`,{className:`mb-3 text-small text-ink-2`,children:[`Style: ${C}. `,S.text]}),S.ready||b===void 0?null:(0,h.jsx)(`div`,{className:`mb-4`,children:(0,h.jsx)(k9,{voice:S,checking:r.isFetching,onCheck:()=>void r.refetch()})}),(0,h.jsxs)(`form`,{onSubmit:y,className:`mb-6 flex flex-wrap items-end gap-3`,children:[(0,h.jsxs)(`div`,{className:`flex min-w-[240px] flex-1 flex-col gap-1`,...xy,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(`label`,{htmlFor:`welcome-topic`,className:`text-label text-ink-2`,children:`Topic`}),(0,h.jsx)(U,{id:`welcome.topic`,className:`-my-1`})]}),(0,h.jsx)(J2,{id:`welcome-topic`,value:o,maxLength:200,placeholder:`Why the sea glows at night`,onChange:e=>s(e.target.value)})]}),(0,h.jsx)(B,{type:`submit`,variant:`primary`,disabled:o.trim()===``||v.isPending,disabledReason:`Type a topic first.`,children:`Make a 60-second short`})]})]}):(0,h.jsx)(GM,{tone:`info`,className:`mb-6`,title:`Your short is being made.`,actions:(0,h.jsx)(LO,{variant:`primary`,to:`/projects/$projectId`,params:{projectId:u},children:`Watch it being made`}),children:`It usually takes about five minutes. The live view shows each step as it runs; while you wait, look at a sample or set Slopify to start when you log in.`}),(0,h.jsx)(Sy,{title:`While you wait: the samples`,info:`welcome.samples`}),(0,h.jsx)(mR,{label:`Samples`,className:`mb-6 [&_.sl-row__meta]:whitespace-normal`,children:RFe.map(e=>{let t=b?.samples[e.id]??null;return(0,h.jsx)(hR,{title:e.name,meta:e.summary,actions:t===null?(0,h.jsx)(RO,{to:`/settings`,search:{section:`storage`},children:`Restore samples in Settings`}):(0,h.jsx)(LO,{to:`/projects/$projectId`,params:{projectId:t},className:pR,children:e.action})},e.id)})}),(0,h.jsx)(Cre,{})]}),(0,h.jsxs)(GR,{status:(0,h.jsx)(WR,{tone:w?.tone??`info`,children:w?.text}),children:[(0,h.jsx)(RO,{to:`/play`,children:`Set up a long video instead`}),O===void 0?null:(0,h.jsx)(B,{onClick:()=>E(O.id),children:`Back`}),D===void 0?null:(0,h.jsx)(B,{variant:`primary`,onClick:()=>E(D.id),children:`Next: ${D.label}`})]})]})}function k9({voice:e,checking:t,onCheck:n}){return e.ready?(0,h.jsx)(mR,{label:`Narration voice`,className:`mb-6 [&_.sl-row__title]:whitespace-normal`,children:(0,h.jsx)(hR,{lead:(0,h.jsx)(GO,{tone:`done`}),title:e.text,actions:(0,h.jsx)(LO,{variant:`quiet`,to:`/settings`,search:{section:`providers`},children:`Add a voice key`})})}):(0,h.jsx)(GM,{tone:`waiting`,className:`mb-6`,title:`No voice can narrate the short yet.`,actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(LO,{variant:`primary`,to:`/settings`,search:{section:`providers`},children:`Add a voice key`}),(0,h.jsx)(B,{disabled:t,onClick:n,children:t?`Checking…`:`Check again`})]}),children:e.text})}var A9=_a({component:Nve,notFoundComponent:oTe}),UFe=ha({getParentRoute:()=>A9,path:`/`,component:Kwe});function j9(e){let t=DNe(e.show),n=typeof e.q==`string`&&e.q.trim()!==``?e.q.slice(0,200):``,r=kNe(e.sort);return{...t===void 0||t===`all`?{}:{show:t},...n===``?{}:{q:n},...r===void 0||r===`newest`?{}:{sort:r}}}var M9=ha({getParentRoute:()=>A9,path:`projects`,validateSearch:j9,component:WFe});function WFe(){let{show:e,q:t,sort:n}=M9.useSearch(),r=Ji();return(0,h.jsx)(RNe,{filter:e??`all`,query:t??``,sort:n??`newest`,onFilter:e=>{r({to:`/projects`,search:j9({show:e,q:t,sort:n}),replace:!0,resetScroll:!1})},onQuery:t=>{r({to:`/projects`,search:j9({show:e,q:t,sort:n}),replace:!0,resetScroll:!1})},onSort:n=>{r({to:`/projects`,search:j9({show:e,q:t,sort:n}),replace:!0,resetScroll:!1})}})}var GFe=ha({getParentRoute:()=>A9,path:`welcome`,component:HFe}),KFe=ha({getParentRoute:()=>A9,path:`play`,component:UDe}),N9=ha({getParentRoute:()=>A9,id:`_library`,component:SCe}),qFe=ha({getParentRoute:()=>A9,path:`library`,beforeLoad:()=>{throw cn({to:`/prompts`,search:{kind:`article`}})}}),JFe=ha({getParentRoute:()=>A9,path:`channels`,component:zSe}),P9=ha({getParentRoute:()=>A9,path:`channels/$channelId`,validateSearch:e=>e.tab===void 0?{}:{tab:LSe(e.tab)},component:YFe});function YFe(){let{channelId:e}=P9.useParams(),{tab:t}=P9.useSearch(),n=Ji();return(0,h.jsx)(RSe,{channelId:e,tab:t??`brand`,onTab:t=>{n({to:`/channels/$channelId`,params:{channelId:e},search:{tab:t},resetScroll:!1})}},e)}var XFe=ha({getParentRoute:()=>N9,path:`templates`,validateSearch:e=>mL(e.item),component:tIe}),ZFe=/^[0-9A-Za-z-]{1,64}$/;function F9(e){let t=Uxe(e.tab);return t===`releases`?{tab:t}:t===`schedules`?typeof e.schedule==`string`&&ZFe.test(e.schedule)?{tab:`schedules`,schedule:e.schedule}:{tab:`schedules`}:{}}var I9=ha({getParentRoute:()=>A9,path:`calendar`,validateSearch:F9,component:eIe}),QFe=ha({getParentRoute:()=>A9,path:`schedules`,beforeLoad:()=>{throw cn({to:`/calendar`,search:{tab:`schedules`},replace:!0})}}),$Fe=ha({getParentRoute:()=>A9,path:`schedules/$scheduleId`,beforeLoad:({params:e})=>{throw cn({to:`/calendar`,search:F9({tab:`schedules`,schedule:e.scheduleId}),replace:!0})}});function eIe(){let e=F9(I9.useSearch()),t=Ji();return(0,h.jsx)(Gxe,{tab:e.tab??`weeks`,schedule:e.schedule,onTab:e=>{t({to:`/calendar`,search:e===`weeks`?{}:{tab:e},resetScroll:!1})},onSchedule:e=>{t({to:`/calendar`,search:{tab:`schedules`,schedule:e},replace:!0})}})}function tIe(){let e=aA(),t=Ji();return(0,h.jsx)(PFe,{getGeneration:e.generation,blocked:e.review.starting||e.review.uncertain||e.review.created!==null,beforeApply:e.flush,onApplied:async(n,r)=>!r()||!await e.open(n,r)||!r()?!1:(await t({to:`/play`}),r())})}var L9=ha({getParentRoute:()=>A9,path:`projects/$projectId`,validateSearch:e=>{let t=C7(e.section);return t===void 0?{}:{section:t}},component:dIe}),R9=ha({getParentRoute:()=>N9,path:`prompts`,validateSearch:e=>({kind:Ub(e.kind),...mL(e.item)}),component:fIe}),z9=ha({getParentRoute:()=>A9,path:`prompts/new`,validateSearch:e=>{let t=Ub(e.kind);return typeof e.from==`string`?{kind:t,from:e.from}:{kind:t}},component:pIe}),B9=ha({getParentRoute:()=>A9,path:`prompts/$promptId`,component:mIe}),V9=ha({getParentRoute:()=>N9,path:`entries`,validateSearch:e=>({category:Bb(e.category),...mL(e.item)}),component:hIe}),H9=ha({getParentRoute:()=>A9,path:`entries/new`,validateSearch:e=>{let t=Bb(e.category);return typeof e.from==`string`?{category:t,from:e.from}:{category:t}},component:gIe}),U9=ha({getParentRoute:()=>A9,path:`entries/$entryId`,component:_Ie}),nIe=ha({getParentRoute:()=>N9,path:`narration-aliases`,component:aTe}),rIe=ha({getParentRoute:()=>N9,path:`ab-results`,component:QL}),iIe=ha({getParentRoute:()=>N9,path:`document-themes`,validateSearch:e=>mL(e.item),component:wCe}),W9=ha({getParentRoute:()=>A9,path:`document-themes/new`,validateSearch:e=>typeof e.from==`string`?{from:e.from}:{},component:vIe}),G9=ha({getParentRoute:()=>A9,path:`document-themes/$themeId`,component:yIe});function aIe(e){let t=e.section===void 0?void 0:ik(e.section),n=t===`patch-notes`&&typeof e.note==`string`&&/^[0-9A-Za-z][0-9A-Za-z.-]{0,63}$/.test(e.note)?e.note:void 0;return{...t===void 0?{}:{section:t},...n===void 0?{}:{note:n}}}var K9=ha({getParentRoute:()=>A9,path:`settings`,validateSearch:aIe,component:uIe}),q9=ha({getParentRoute:()=>A9,path:`help/tutorials/$page`,validateSearch:e=>typeof e.q==`string`&&e.q.trim()!==``?{q:e.q.slice(0,200)}:{},component:oIe});function oIe(){let{page:e}=q9.useParams(),{q:t}=q9.useSearch(),n=Va({select:e=>e.hash});return(0,h.jsx)(FFe,{page:e,anchor:n===``?void 0:n,words:t})}var sIe=ha({getParentRoute:()=>A9,path:`help`,beforeLoad:()=>{throw cn({to:`/help/tutorials/$page`,params:{page:`Home`}})}}),cIe=ha({getParentRoute:()=>A9,path:`help/tutorials`,beforeLoad:()=>{throw cn({to:`/help/tutorials/$page`,params:{page:`Home`}})}}),lIe=ha({getParentRoute:()=>A9,path:`usage`,beforeLoad:()=>{throw cn({to:`/settings`,search:{section:`usage`}})}});function uIe(){let{section:e,note:t}=K9.useSearch(),n=Ji(),r=tk.find(t=>t.id===(e??`providers`));return jv(r===void 0?`Settings`:`Settings · ${r.label}`),(0,h.jsx)(TFe,{section:e??`providers`,note:t,onSection:e=>{n({to:`/settings`,search:{section:e},resetScroll:!1})},onNote:e=>{n({to:`/settings`,search:{section:`patch-notes`,...e===void 0?{}:{note:e}}})}})}function dIe(){let{projectId:e}=L9.useParams(),t=aA(),n=Ji();return(0,h.jsx)(aNe,{projectId:e,openDraft:async e=>!await t.flush()||!await t.open(e)?!1:(await n({to:`/play`}),!0)},e)}function fIe(){let{kind:e}=R9.useSearch(),t=Ji(),n=J9();return(0,h.jsx)(VNe,{kind:e,onKind:e=>{t({to:`/prompts`,search:{kind:e},replace:!0})},onUseInPlay:n.use,playBlocked:n.blocked})}function J9(){let e=aA(),t=Ji();return{blocked:e.review.starting||e.review.uncertain||e.review.created!==null?`Play is starting a run from its draft. Wait for it to start, then try again.`:void 0,use:n=>{let r=BL(e.document,n);e.edit(r.document),t({to:`/play`}).then(()=>e.navigate(r.section,r.field))}}}function pIe(){let{kind:e,from:t}=z9.useSearch(),n=Y9();return(0,h.jsx)(z7,{promptId:void 0,kind:e,from:t,onLeave:n},`${e}:${t??`new`}`)}function mIe(){let{promptId:e}=B9.useParams(),t=Y9();return(0,h.jsx)(z7,{promptId:e,kind:`article`,from:void 0,onLeave:t},e)}function Y9(){let e=Ji();return t=>{e({to:`/prompts`,search:{kind:t}})}}function hIe(){let{category:e}=V9.useSearch(),t=Ji(),n=J9();return(0,h.jsx)(ECe,{category:e,onCategory:e=>{t({to:`/entries`,search:{category:e},replace:!0})},onUseInPlay:n.use,playBlocked:n.blocked})}function gIe(){let{category:e,from:t}=H9.useSearch(),n=Z9();return(0,h.jsx)(X0,{entryId:void 0,category:e,from:t,onLeave:n})}function _Ie(){let{entryId:e}=U9.useParams(),t=Z9();return(0,h.jsx)(X0,{entryId:e,category:`intro`,from:void 0,onLeave:t})}function vIe(){let{from:e}=W9.useSearch(),t=X9();return(0,h.jsx)(j1,{themeId:void 0,from:e,onLeave:t})}function yIe(){let{themeId:e}=G9.useParams(),t=X9();return(0,h.jsx)(j1,{themeId:e,from:void 0,onLeave:t})}function X9(){let e=Ji();return()=>{e({to:`/document-themes`})}}function Z9(){let e=Ji();return t=>{e({to:`/entries`,search:{category:t}})}}var bIe=A9.addChildren({homeRoute:UFe,projectsRoute:M9,welcomeRoute:GFe,playRoute:KFe,libraryRoute:N9.addChildren({promptsRoute:R9,entriesRoute:V9,templatesRoute:XFe,documentThemesRoute:iIe,narrationAliasesRoute:nIe,abResultsRoute:rIe}),schedulesRoute:QFe,scheduleRoute:$Fe,calendarRoute:I9,libraryIndexRoute:qFe,channelsRoute:JFe,channelRoute:P9,projectRoute:L9,newPromptRoute:z9,promptRoute:B9,newEntryRoute:H9,entryRoute:U9,newDocumentThemeRoute:W9,documentThemeRoute:G9,settingsRoute:K9,usageRoute:lIe,helpRoute:sIe,tutorialsIndexRoute:cIe,tutorialsRoute:q9});function xIe(){return Pa({routeTree:bIe,defaultErrorComponent:sTe,scrollRestoration:!0})}function SIe(){let e,t,n=new Set;return{observe:r=>{if(e===void 0){e=r;for(let e of n)e();return}if(r!==e&&r!==t){t=r;for(let e of n)e()}},staleAt:()=>t,loadedAt:()=>e,subscribe:e=>(n.add(e),()=>{n.delete(e)})}}function CIe(e,t){return async(n,r)=>{let i=await e(n,r),a=i.headers.get(`X-Slopify-Version`);return a!==null&&t.observe(a),i}}function wIe(){let e=new Map;return{observe:t=>{if(t.type===`stage.state`){let n=e.get(t.projectId);if(n){for(let[e,r]of n)r.stage===t.stage&&r.revisionId===t.revisionId&&r.workId===t.workId&&n.delete(e);n.size===0&&e.delete(t.projectId)}return}if(t.type!==`llm.preview`)return;let n=e.get(t.projectId)??new Map,r=JSON.stringify([t.revisionId,t.workId,t.callId]),i=n.get(r),a=(t.reset?t.text:`${i?.text??``}${t.text}`).slice(-65536);for(n.delete(r),n.set(r,{...t,text:a,reset:!0});n.size>8;){let e=n.keys().next().value;e!==void 0&&n.delete(e)}for(e.delete(t.projectId),e.set(t.projectId,n);e.size>16;){let t=e.keys().next().value;t!==void 0&&e.delete(t)}},snapshot:t=>[...e.get(t)?.values()??[]],snapshotAll:()=>[...e.values()].flatMap(e=>[...e.values()])}}var Q9=/\/events\/projects\/([^/?#]+)/,TIe=/\/events\/global(?:[?#]|$)/,EIe=[`running.count`,`staging.progress`,`staging.failed`,`schedule.topics`,`stage.state`,`stage.progress`,`article.delta`,`llm.preview`,`image.landed`,`narration.piece`,`project.state`,`project.updated`,`review.flagged`,`review.auto-passed`],DIe=2,OIe=e=>Math.min(3e4,1e3*2**e);function kIe(e,t=(e,t)=>setTimeout(e,t)){let n=new Set,r=wIe(),i,a=!1,o=0,s=(e,t,n)=>{for(let r of e.listeners.get(t)??[])r({data:n})},c=l=>{if(i!==void 0)return;let u=e(l);i=u,u.addEventListener(`open`,()=>{a=!0,o=0;for(let e of[...n])for(let t of e.opens)t()}),u.addEventListener(`error`,()=>{if(i!==u)return;for(let e of[...n])s(e,`error`,``);if(u.readyState!==DIe)return;u.close(),i=void 0;let e=OIe(o);o+=1,t(()=>{i===void 0&&n.size>0&&c(l)},e)});for(let e of EIe)u.addEventListener(e,t=>{let i;try{let n=JSON.parse(t.data);typeof n.projectId==`string`&&(i=n.projectId),(e===`llm.preview`||e===`stage.state`)&&r.observe(n)}catch{return}for(let r of[...n])(r.projectId===void 0||r.projectId===i)&&s(r,e,t.data)})};return t=>{let o=Q9.exec(t)?.[1];if(o===void 0&&!TIe.test(t))return e(t);c(o===void 0?t:t.replace(Q9,`/events/global`));let l={projectId:o===void 0?void 0:decodeURIComponent(o),listeners:new Map,opens:new Set};return n.add(l),a&&queueMicrotask(()=>{if(n.has(l)){for(let e of l.opens)e();if(l.projectId!==void 0)for(let e of r.snapshot(l.projectId))s(l,`llm.preview`,JSON.stringify(e))}}),{addEventListener:(e,t)=>{if(e===`open`){l.opens.add(t);return}let n=l.listeners.get(e)??new Set;n.add(t),l.listeners.set(e,n)},close:()=>{n.delete(l),n.size===0&&i!==void 0&&(i.close(),i=void 0,a=!1)}}}}function AIe(e){let t=SIe(),n={api:Co(window.location.origin,CIe(window.fetch.bind(window),t),To(e=>{let n=e.headers.get(`X-Slopify-Version`);n!==null&&t.observe(n)})),openEvents:kIe(e=>new EventSource(e)),version:t};(0,co.createRoot)(e).render((0,h.jsx)(m.StrictMode,{children:(0,h.jsx)(v,{client:new Ge,children:(0,h.jsx)(nre,{deps:n,children:(0,h.jsx)(La,{router:xIe()})})})}))}var $9=document.getElementById(`root`);if($9===null)throw Error(`index.html carries no #root element for the app to mount on`);AIe($9);export{s1 as t};
|
|
326
|
+
`)}function jFe({open:e,onClose:t,templates:n,channels:r,pending:i,error:a,execute:o}){let{api:s}=V(),c=_(),l=wv(),u=I({queryKey:[`play-drafts`],queryFn:async()=>{let e=await vk(s);if(!e.ok)throw Error(e.message);return e.value.drafts}}),[d,f]=(0,m.useState)(``),[p,g]=(0,m.useState)(``),[v,y]=(0,m.useState)(``),b=(0,m.useRef)(null);async function x(){let e=await bk(s,d);if(!e.ok)throw Error(e.message);let r=JSON.stringify([d,e.value.draft.version,p.trim(),v]);b.current?.key!==r&&(b.current={key:r,id:crypto.randomUUID()});let i=e.value.draft.document,a=n?.find(e=>e.id===i.templateSource?.id),o=v||i.channelId||(a?gQ(a):void 0),u=await TO(s,{id:b.current.id,name:p.trim(),document:o===void 0?i:{...i,channelId:o}});if(!u.ok)throw b.current=null,Error(u.message);b.current=null,g(``),t(),l(`Template saved.`,`success`),await c.invalidateQueries({queryKey:yO})}return(0,h.jsxs)(NM,{open:e,title:`Save a setup`,width:`narrow`,onClose:t,footer:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(WR,{tone:a?`error`:`info`,children:a??(i?`Saving…`:void 0)}),(0,h.jsx)(B,{type:`submit`,form:`save-template-form`,variant:`primary`,disabled:i||!d||!p.trim(),children:`Save template`})]}),children:[(0,h.jsxs)(`p`,{className:`m-0 mb-4 text-small text-ink-2`,children:[`Choose a saved Play draft, or`,` `,(0,h.jsx)(fa,{to:`/play`,className:`text-accent-ink underline`,children:`open Play`}),` `,`to prepare one.`]}),(0,h.jsx)(`p`,{className:`mb-4 text-small text-ink-2`,children:`A template keeps the settings, not one video's topic.`}),(0,h.jsxs)(`form`,{id:`save-template-form`,"aria-label":`Save a setup`,className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),d&&p.trim()&&o(x)},children:[(0,h.jsx)(_L,{label:`Saved Play draft`,tip:`templates.save.draft`,help:u.isPending?`Loading saved drafts…`:u.data?.length===0?`No saved drafts yet.`:void 0,children:(0,h.jsxs)(bL,{value:d,required:!0,disabled:i,onChange:e=>f(e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:`Choose a draft`}),u.data?.filter(e=>e.readable).map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.title||`Untitled draft`},e.id))]})}),u.error?(0,h.jsx)(GM,{tone:`danger`,title:`The saved drafts couldn't be loaded.`,actions:(0,h.jsx)(B,{size:`small`,onClick:()=>void u.refetch(),children:`Reload drafts`}),children:u.error.message}):null,(0,h.jsx)(_L,{label:`Template name`,id:`template-name`,tip:`templates.save.name`,children:(0,h.jsx)(X,{value:p,required:!0,maxLength:120,disabled:i,onChange:e=>g(e.target.value)})}),(0,h.jsx)(_L,{label:`Channel`,id:`template-channel`,tip:`templates.save.channel`,children:(0,h.jsxs)(bL,{value:v,disabled:i,onChange:e=>y(e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:`The draft's channel`}),r.map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.name},e.id))]})})]})]})}function MFe({onApplied:e,beforeApply:t,getGeneration:n,blocked:r}){let{api:i}=V(),a=_(),o=wv(),s=(0,m.useRef)(new Map),c=(0,m.useRef)(new Map),l=(0,m.useRef)(!0);(0,m.useEffect)(()=>(l.current=!0,()=>{l.current=!1}),[]);async function u(o){let s=n?.();if(r||t&&!await t())throw Error(`Save or discard the draft open in Play first, then apply the template again.`);if(!l.current||s!==void 0&&s!==n?.())return;let u=`${o.id}:${o.version}`,d=c.current.get(u);d||(d=crypto.randomUUID(),c.current.set(u,d));let f=await OO(i,o,d);if(!f.ok)throw c.current.delete(u),Error(f.message);if(!(!l.current||s!==void 0&&s!==n?.())&&(await a.invalidateQueries({queryKey:[`play-drafts`]}),!(!l.current||s!==void 0&&s!==n?.()))){if(await e(f.value.draft.id,()=>l.current)!==!1)c.current.delete(u);else throw Error(`The template's draft was created but didn't open. Press Use in Play again to open it.`)}}async function d(e){let t=`${e.id}:${e.version}`,n=s.current.get(t);n||(n=crypto.randomUUID(),s.current.set(t,n));let r=await wO(i,e.id);if(!r.ok)throw Error(r.message);let c=await TO(i,{id:n,name:`${e.name} copy`,document:r.value.document});if(!c.ok)throw Error(c.message);s.current.delete(t),o(`Duplicated as ${c.value.name}.`,`success`),await a.invalidateQueries({queryKey:yO})}return{apply:u,duplicate:d}}function NFe(e,t){let{api:n}=V();return C0({noun:[`template`,`templates`],listKey:yO,all:e,nameMax:120,duplicate:async(e,t)=>{let r=await wO(n,e.id);if(!r.ok)return r.message;let i=await TO(n,{id:crypto.randomUUID(),name:t,document:r.value.document});return i.ok?null:i.message},remove:async e=>{let t=await DO(n,e);if(!t.ok)throw Error(t.message)},trash:`template`,selection:t})}function PFe({onApplied:e,beforeApply:t,getGeneration:n,blocked:r=!1}){let{api:i}=V(),a=_(),o=I(CO(i)),s=I(Ry(i)),c=qy().channelId,[l,u]=(0,m.useState)(c??``),[d,f]=(0,m.useState)(``),[p,g]=Y1(`template`),v=d.trim().toLowerCase(),y=o.data?.filter(e=>l===``||gQ(e)===l),b=y===void 0?void 0:q1(y.filter(e=>e.name.toLowerCase().includes(v)),p),x=AG(b?.map(e=>e.id)??[]),S=b?.filter(e=>x.has(e.id))??[],C=NFe(o.data??[],x),w=e=>s.data?.find(t=>t.id===gQ(e))?.name,[T,E]=(0,m.useState)(!1),[D,O]=(0,m.useState)(null),k=wv(),[A,j]=(0,m.useState)(!1),[M,N]=(0,m.useState)(!1),[P,ee]=(0,m.useState)(null),[F,te]=pL(),[ne,re]=(0,m.useState)(null),ie=(0,m.useRef)(!1);async function ae(e){if(!ie.current){ie.current=!0,E(!0),O(null);try{await e()}catch(e){O(e instanceof Error?e.message:`That didn't finish. Try again.`)}finally{ie.current=!1,E(!1)}}}let{apply:oe,duplicate:se}=MFe({onApplied:e,beforeApply:t,getGeneration:n,blocked:r});async function ce(){if(!P)return;let e=P.id,t=await DO(i,P);if(!t.ok)throw Error(t.message);ee(null),await a.cancelQueries({queryKey:yO}),a.setQueryData(yO,t=>t?.filter(t=>t.id!==e)),k(`Template moved to the trash. Restore it in Settings → Trash within 30 days.`,`success`),await a.invalidateQueries({queryKey:yO})}Xy({id:`library.save-template`,title:`Save a setup as a template`,group:`Library`,keywords:[`template`,`new template`,`play draft`],run:()=>j(!0)});let le=D&&!P?{tone:`error`,text:D}:r?{tone:`warning`,text:`A run is still starting in Play. Wait for it to finish (or press Check whether it started there), then apply a template.`}:o.error?{tone:`error`,text:o.error.message}:o.isPending?{tone:`info`,text:`Loading templates…`}:void 0;return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(EFe,{open:M,onClose:()=>N(!1),onInstalled:()=>void a.invalidateQueries({queryKey:CO(i).queryKey})}),(0,h.jsxs)(j0,{action:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(B,{variant:`secondary`,onClick:()=>N(!0),"aria-expanded":M,children:`Add pack`}),(0,h.jsx)(U,{id:`welcome.packs`,label:`Add pack`})]}),(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(B,{variant:`primary`,onClick:()=>j(!0),"aria-expanded":A,children:`Save a setup`}),(0,h.jsx)(U,{id:`templates.save`,label:`Save a setup`})]})]}),children:[(0,h.jsx)(X,{type:`search`,"aria-label":`Search templates`,placeholder:`Search templates`,value:d,className:`w-full min-w-0 sm:w-56`,onChange:e=>f(e.target.value)}),(0,h.jsxs)(`span`,{className:`flex w-full items-center gap-1 sm:w-auto`,...xy,children:[(0,h.jsxs)(bL,{"aria-label":`Show templates of`,value:l,className:`w-full sm:w-56`,onChange:e=>u(e.target.value),children:[(0,h.jsx)(`option`,{value:``,children:`All channels`}),(s.data??[]).map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,h.jsx)(U,{id:`templates.show-channel`})]}),(0,h.jsx)(X1,{what:`templates`,sort:p,onSort:g}),(0,h.jsxs)(`p`,{className:`m-0 flex items-center gap-1 text-small text-ink-2`,children:[`Reuse a Play setup and its checkpoint choices. Use in Play creates a fresh draft to review.`,(0,h.jsx)(U,{id:`templates.apply`,label:`Use in Play`})]})]}),(0,h.jsxs)(`div`,{className:`mb-2 flex min-h-8 flex-wrap items-center gap-3`,children:[(0,h.jsx)(WR,{tone:le?.tone??`info`,children:le?.text}),o.error?(0,h.jsx)(B,{size:`small`,onClick:()=>void o.refetch(),children:`Reload templates`}):null,(0,h.jsx)(B,{variant:`quiet`,size:`small`,disabled:T||o.isFetching,onClick:()=>void o.refetch(),children:`Refresh templates`})]}),o.data?.length===0?(0,h.jsx)(hQ,{title:`No templates yet`,children:`Use Save a setup to keep a Play draft for reuse.`}):null,o.data?.length&&b?.length===0?(0,h.jsx)(`p`,{className:`m-0 py-3 text-small text-ink-2`,children:v===``?`No templates in this channel.`:`No templates match "${d.trim()}"${l===``?``:` in this channel`}.`}):null,o.isPending&&!o.error?(0,h.jsx)(U1,{label:`Project templates`}):null,b?.length?(0,h.jsx)(OG,{className:V1,list:(0,h.jsxs)(P1,{selection:x,children:[(0,h.jsx)(N1,{selection:x,total:b.length,noun:[`template`,`templates`],scope:b.length===o.data?.length?void 0:`Select all ${String(b.length)} shown`,busy:C.busy||T,onDuplicate:()=>C.duplicate(S),onDelete:()=>C.remove(S)}),(0,h.jsx)(mR,{label:`Project templates`,children:b.map(e=>(0,h.jsxs)(m.Fragment,{children:[(0,h.jsx)(hR,{className:`max-md:grid-cols-1`,lead:(0,h.jsx)(MG,{selection:x,value:e.id,label:e.name}),title:(0,h.jsx)(P0,{name:e.name,maxLength:120,onSelect:()=>te(e.id),onRename:async t=>{let n=await sue(i,e.id,t);return await a.invalidateQueries({queryKey:yO}),n}}),selected:e.id===F,meta:(0,h.jsxs)(h.Fragment,{children:[w(e)===void 0?``:`${w(e)} · `,`Version `,e.version,` · updated `,(0,h.jsx)(d0,{iso:e.updatedAt})]}),actions:(0,h.jsx)(G1,{name:e.name,edit:(0,h.jsx)(B,{variant:`quiet`,size:`small`,"aria-label":`Edit ${e.name}`,onClick:()=>te(e.id),children:`Edit`}),duplicate:(0,h.jsx)(B,{variant:`quiet`,size:`small`,"aria-label":`Duplicate ${e.name}`,disabled:T,disabledReason:`Working on the last press`,onClick:()=>void ae(()=>se(e)),children:`Duplicate`}),play:{run:()=>void ae(()=>oe(e)),blocked:r?`A run is still starting in Play. Wait for it, then use the template.`:T?`Working on the last press`:void 0},onHistory:()=>re(e),onDelete:()=>{ee(e),O(null)}})}),(0,h.jsx)(r$,{kind:`template`,id:e.id,name:e.name})]},e.id))})]}),detail:(0,h.jsx)(kFe,{template:o.data?.find(e=>e.id===F)})}):null,(0,h.jsx)(jFe,{open:A,onClose:()=>j(!1),templates:o.data,channels:s.data??[],pending:T,error:D,execute:ae}),ne===null?null:(0,h.jsx)(AFe,{template:ne,onClose:()=>re(null)},`${ne.id}:${String(ne.version)}`),(0,h.jsx)(Bv,{open:P!==null,title:`Delete ${P?.name??`template`}?`,consequence:D??`Moves it to the trash for 30 days (Settings → Trash). Existing projects and drafts keep their setup.`,confirmLabel:`Delete template`,pending:T,onConfirm:()=>void ae(ce),onCancel:()=>{T||ee(null)}})]})}function FFe({page:e,anchor:t,words:n}){let{api:r}=V(),i=I(nL(r)),a=I(xve(r,e)),o=Ji(),[s,c]=(0,m.useState)(n??``);(0,m.useEffect)(()=>{c(n??``)},[n]);let l=(0,m.useRef)(null),u=(0,m.useMemo)(()=>new Set((i.data?.pages??[]).map(e=>e.id)),[i.data]),d=i.data?.pages.find(t=>t.id===e)?.title??e.replace(/-/g,` `),f=(0,m.useMemo)(()=>pre(a.data??``),[a.data]),p=(0,m.useMemo)(()=>a.data===void 0?``:fre(f.body,u,e),[a.data,f.body,u,e]);(0,m.useEffect)(()=>{if(p===``)return;let e=l.current;if(e===null)return;let n=t===void 0?void 0:hre(e,t,f.title===void 0?[]:[f.title]);n===void 0?window.scrollTo?.({top:0}):n.scrollIntoView?.({block:`start`})},[p,t,f.title]);let g=i.data?.groups.find(t=>t.pages.some(t=>t.id===e));return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(EG,{crumb:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`span`,{children:`Help`}),(0,h.jsx)(`span`,{"aria-hidden":`true`,children:`›`}),(0,h.jsx)(fa,{to:`/help/tutorials/$page`,params:{page:i.data?.home.id??`Home`},children:`Tutorials`})]}),title:d,meta:g===void 0?`Guides to every screen of Slopify, for the version you are running.`:g.title,actions:(0,h.jsx)(LO,{to:`/welcome`,variant:`quiet`,children:`Welcome screen`})}),(0,h.jsx)(DG,{className:`sl-workspace--tutorials`,sections:(0,h.jsx)(IFe,{index:i.data,page:e,onOpenHit:(e,t)=>{o({to:`/help/tutorials/$page`,params:{page:e.page},search:{q:t},...e.anchor===``?{}:{hash:e.anchor}})}}),children:a.error===null?(0,h.jsxs)(`div`,{ref:l,onClick:e=>{if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey)return;let t=e.target.closest(`a`),n=t?.getAttribute(`href`);if(t===null||n==null)return;let r=mre(n);if(r!==void 0){e.preventDefault(),o({to:`/help/tutorials/$page`,params:{page:r.page},...r.anchor===void 0?{}:{hash:r.anchor}});return}/^https?:/.test(n)&&(e.preventDefault(),window.open(n,`_blank`,`noopener,noreferrer`))},children:[(0,h.jsx)(ZI,{markdown:p,label:`Tutorial`,what:`tutorial`,query:s,onQuery:c,anchorPrefix:`tutorial-`,children:(0,h.jsx)(`p`,{className:`m-0 text-ink-3`,children:`Loading the tutorial…`})}),i.data?.footer?(0,h.jsx)(`p`,{className:`mt-8 border-t border-line pt-4 text-small text-ink-3`,children:i.data.footer.replace(/\[([^\]]+)\]\([^)]+\)/g,`$1`)}):null]}):(0,h.jsx)(GM,{tone:`danger`,title:`This tutorial did not load`,actions:(0,h.jsx)(B,{onClick:()=>void a.refetch(),variant:`secondary`,children:`Try again`}),children:`${a.error.message} Press Try again, or pick another page on the left.`})})]})}function IFe({index:e,page:t,onOpenHit:n}){let{api:r}=V(),[i,a]=(0,m.useState)(``),[o,s]=(0,m.useState)(``),c=(0,m.useRef)(null),l=(0,m.useId)();Zy(c,`the tutorials`),(0,m.useEffect)(()=>{let e=setTimeout(()=>s(i.trim()),200);return()=>clearTimeout(e)},[i]);let u=I(Sve(r,o));return(0,h.jsxs)(`nav`,{"aria-label":`Tutorials`,className:`flex min-w-0 flex-col gap-4`,children:[(0,h.jsxs)(`div`,{className:`relative`,children:[(0,h.jsx)(`label`,{htmlFor:l,className:`sr-only`,children:`Search all tutorials`}),(0,h.jsx)(_l,{"aria-hidden":`true`,strokeWidth:1.75,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-ink-3`}),(0,h.jsx)(`input`,{ref:c,id:l,type:`search`,value:i,placeholder:`Search all tutorials`,onChange:e=>a(e.target.value),onKeyDown:e=>{let t=u.data?.hits[0];e.key===`Enter`&&t!==void 0&&(e.preventDefault(),n(t,o))},className:`sl-input pl-9`})]}),o===``?e===void 0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`Loading the tutorials…`}):(0,h.jsxs)(`div`,{className:`sl-tutorials-nav flex flex-col gap-4`,children:[(0,h.jsx)(E9,{id:e.home.id,title:e.home.title,current:t}),e.groups.map(e=>(0,h.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,h.jsx)(`div`,{className:`sl-kicker px-2.5 pb-1`,children:e.title}),e.pages.map(e=>(0,h.jsx)(E9,{id:e.id,title:e.title,current:t},e.id))]},e.title))]}):(0,h.jsx)(LFe,{query:o,hits:u.data?.hits,error:u.error?.message})]})}function E9({id:e,title:t,current:n}){return(0,h.jsx)(fa,{to:`/help/tutorials/$page`,params:{page:e},"aria-current":e===n?`page`:void 0,className:`sl-tutorials-nav__link`,children:t})}function LFe({query:e,hits:t,error:n}){return n===void 0?t===void 0?(0,h.jsx)(`p`,{className:`m-0 text-small text-ink-3`,children:`Searching…`}):t.length===0?(0,h.jsx)(`p`,{role:`status`,className:`m-0 text-small text-ink-2`,children:`No tutorial mentions "${e}". Try fewer or other words.`}):(0,h.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`p`,{role:`status`,className:`m-0 px-2.5 text-small text-ink-3`,children:t.length===1?`1 section`:`${String(t.length)} sections`}),(0,h.jsx)(`ul`,{"aria-label":`Search results`,className:`m-0 flex list-none flex-col gap-1 p-0`,children:t.map(t=>(0,h.jsx)(`li`,{children:(0,h.jsxs)(fa,{to:`/help/tutorials/$page`,params:{page:t.page},search:{q:e},...t.anchor===``?{}:{hash:t.anchor},className:`sl-tutorials-hit`,children:[(0,h.jsx)(`span`,{className:`block font-semibold text-ink`,children:t.heading===void 0?t.pageTitle:t.heading}),t.heading===void 0?null:(0,h.jsx)(`span`,{className:`block text-label text-ink-3`,children:t.pageTitle}),(0,h.jsx)(`span`,{className:`mt-0.5 block text-small text-ink-2`,children:t.snippet})]})},`${t.page}#${t.anchor}`))})]}):(0,h.jsx)(`p`,{role:`alert`,className:`m-0 text-small text-danger`,children:`The search didn't run: ${n} Change the words or reload the page.`})}var RFe=[{id:`library`,name:`The Library of Alexandria`,summary:`A narrated video with its two shorts, article, PDF, description and images.`,action:`Explore the sample`},{id:`audiobook`,name:`The Wind in the Willows`,summary:`An audiobook: a narrator and two character voices, captions tagged with who speaks, MP3 and M4B with chapters.`,action:`See an audiobook`},{id:`podcast`,name:`The Antikythera Mechanism`,summary:`A two-host podcast with the speaker panel, name tags and portraits, and its MP3 and M4B.`,action:`Hear a podcast`}],D9=[{id:`found`,label:`What you have`},{id:`style`,label:`Pick a style`},{id:`make`,label:`Make your first short`}];function zFe({at:e,onPick:t}){return(0,h.jsx)(u2,{label:`First-run steps`,dense:!0,className:`mb-6 max-w-md`,steps:D9.map((n,r)=>({id:n.id,tone:r<e?`done`:r===e?`info`:`off`,state:r<e?`done`:r===e?`current step`:`not yet`,name:(0,h.jsx)(B,{variant:`quiet`,size:`small`,"aria-current":r===e?`step`:void 0,onClick:()=>t(n.id),children:`${String(r+1)} · ${n.label}`}),detail:r===e?`Step ${String(r+1)} of ${String(D9.length)}`:``}))})}function O9({id:e,active:t,children:n}){let r=D9.find(t=>t.id===e)?.label??``;return(0,h.jsx)(`section`,{id:`welcome-step-${e}`,"aria-label":r,tabIndex:-1,hidden:!t,className:`outline-none`,children:n})}function BFe(e){return e.length<=2?e.join(` or `):`${e.slice(0,-1).join(`, `)} or ${e.at(-1)??``}`}function VFe(e){return e===void 0?{ready:!1,text:`Looking for a voice…`}:e.keyed===null?e.system.available?{ready:!0,text:`Narration uses your computer's built-in voice${e.system.engine===null?``:` (${e.system.engine})`}; add an ElevenLabs or OpenAI key later for a better one.`}:{ready:!1,text:e.system.issue??`No voice can narrate yet. Add an ElevenLabs or OpenAI key in Settings → Providers.`}:{ready:!0,text:`Narration uses your ${e.keyed} voice key.`}}function HFe(){let{api:e}=V(),t=_(),n=Ji(),r=I({queryKey:Vv,queryFn:()=>Gv(e)}),[i,a]=(0,m.useState)(`found`),[o,s]=(0,m.useState)(``),[c,l]=(0,m.useState)(``),[u,d]=(0,m.useState)(void 0),f=(0,m.useRef)(void 0),p=L({mutationFn:()=>Kv(e),onSuccess:async()=>{await t.invalidateQueries({queryKey:Vv}),await n({to:`/`})}}),g=L({mutationFn:t=>qv(e,t),onSettled:()=>t.invalidateQueries({queryKey:Vv})}),v=L({mutationFn:()=>(f.current??=crypto.randomUUID(),Jv(e,{topic:o,requestId:f.current,...c===``?{}:{packId:c}})),onSuccess:async({projectId:e})=>{f.current=void 0,d(e),await t.invalidateQueries({queryKey:H.projects}),await t.invalidateQueries({queryKey:H.voices})}}),y=e=>{e.preventDefault(),o.trim()!==``&&v.mutate()},b=r.data,x=b?.clis.filter(e=>e.ready)??[],S=VFe(b?.voice),C=c===``?`General`:b?.packs.find(e=>e.id===c)?.name??c,w=v.error?{tone:`error`,text:v.error.message}:g.error?{tone:`error`,text:g.error.message}:p.error?{tone:`error`,text:p.error.message}:v.isPending?{tone:`info`,text:`Starting your short…`}:void 0,T=D9.findIndex(e=>e.id===i),E=e=>{a(e),requestAnimationFrame(()=>document.getElementById(`welcome-step-${e}`)?.focus())},D=D9[T+1],O=D9[T-1];return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(EG,{title:`Welcome to Slopify`,meta:`Make a video from a topic, with the tools already on this computer.`,actions:(0,h.jsx)(B,{variant:`quiet`,disabled:p.isPending,onClick:()=>p.mutate(),children:u===void 0?`Skip`:`Done`})}),r.error?(0,h.jsx)(GM,{tone:`danger`,title:`Could not read what this computer has`,className:`mb-6`,children:r.error.message}):null,(0,h.jsx)(zFe,{at:T,onPick:E}),(0,h.jsxs)(O9,{id:`found`,active:i===`found`,children:[(0,h.jsx)(Sy,{title:`Found on this computer`,info:`welcome.found`}),(0,h.jsxs)(mR,{label:`Tools found on this computer`,className:`mb-4`,children:[(b?.clis??[]).map(e=>(0,h.jsx)(hR,{title:e.name,actions:(0,h.jsx)(`span`,{className:`text-small text-ink-2`,children:e.ready?`Ready${e.version===null?``:` · ${e.version}`}${e.draws?` · writes and draws`:` · writes`}`:e.installed?e.issue??`Installed, not usable yet`:`Not found`})},e.id)),b===void 0?(0,h.jsx)(hR,{title:`Looking for installed tools…`}):null]}),b!==void 0&&x.length>0?(0,h.jsx)(`p`,{className:`mb-6 text-small text-ink-2`,children:`You can make a video now: no API keys are needed for ${BFe([`the text`,...x.some(e=>e.draws)?[`the images`]:[],...S.ready&&b.voice.keyed===null?[`the narration`]:[]])}.`}):null,b!==void 0&&x.length===0?(0,h.jsx)(GM,{tone:`waiting`,className:`mb-6`,title:`Nothing on this computer can write the script yet.`,actions:(0,h.jsx)(LO,{to:`/settings`,search:{section:`providers`},children:`Open Settings → Providers`}),children:`Install Claude Code, Codex or Antigravity CLI and sign in to it, then press Check again; or add an OpenRouter key in Settings → Providers.`}):null,(0,h.jsx)(Sy,{title:`Narration voice`,info:`welcome.voice`}),b===void 0?(0,h.jsx)(mR,{label:`Narration voice`,className:`mb-6`,children:(0,h.jsx)(hR,{title:`Looking for a voice…`})}):(0,h.jsx)(k9,{voice:S,checking:r.isFetching,onCheck:()=>void r.refetch()})]}),(0,h.jsxs)(O9,{id:`style`,active:i===`style`,children:[(0,h.jsx)(Sy,{title:`Pick a style`,info:`welcome.pack`}),(0,h.jsx)(mR,{label:`Styles`,className:`mb-3 [&_.sl-row__meta]:whitespace-normal`,children:[{id:``,name:`General`,summary:`A neutral explainer style.`,installed:!1,library:!1},...(b?.packs??[]).map(e=>({...e,library:!0}))].map(e=>(0,h.jsx)(hR,{title:e.name,meta:e.summary,selected:c===e.id,actions:(0,h.jsxs)(h.Fragment,{children:[e.library?(0,h.jsx)(B,{variant:`quiet`,disabled:e.installed||g.isPending,"aria-label":e.installed?`${e.name} is in your library`:`Add ${e.name} to library`,onClick:()=>g.mutate(e.id),children:e.installed?`In your library`:`Add to library`}):null,(0,h.jsx)(B,{variant:c===e.id?`primary`:`secondary`,"aria-pressed":c===e.id,"aria-label":`Use ${e.name}`,onClick:()=>l(e.id),children:c===e.id?`Picked`:`Use this style`})]})},e.id===``?`general`:e.id))}),(0,h.jsxs)(`p`,{className:`mb-6 flex items-center gap-1 text-small text-ink-2`,...xy,children:[`Add to library keeps a pack's prompts and Play template for later videos.`,(0,h.jsx)(U,{id:`welcome.packs`,className:`-my-1`})]})]}),(0,h.jsxs)(O9,{id:`make`,active:i===`make`,children:[u===void 0?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Sy,{title:`Make a 60-second short`,info:`welcome.short`}),(0,h.jsxs)(`p`,{className:`mb-3 text-small text-ink-2`,children:[`Style: ${C}. `,S.text]}),S.ready||b===void 0?null:(0,h.jsx)(`div`,{className:`mb-4`,children:(0,h.jsx)(k9,{voice:S,checking:r.isFetching,onCheck:()=>void r.refetch()})}),(0,h.jsxs)(`form`,{onSubmit:y,className:`mb-6 flex flex-wrap items-end gap-3`,children:[(0,h.jsxs)(`div`,{className:`flex min-w-[240px] flex-1 flex-col gap-1`,...xy,children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,h.jsx)(`label`,{htmlFor:`welcome-topic`,className:`text-label text-ink-2`,children:`Topic`}),(0,h.jsx)(U,{id:`welcome.topic`,className:`-my-1`})]}),(0,h.jsx)(J2,{id:`welcome-topic`,value:o,maxLength:200,placeholder:`Why the sea glows at night`,onChange:e=>s(e.target.value)})]}),(0,h.jsx)(B,{type:`submit`,variant:`primary`,disabled:o.trim()===``||v.isPending,disabledReason:`Type a topic first.`,children:`Make a 60-second short`})]})]}):(0,h.jsx)(GM,{tone:`info`,className:`mb-6`,title:`Your short is being made.`,actions:(0,h.jsx)(LO,{variant:`primary`,to:`/projects/$projectId`,params:{projectId:u},children:`Watch it being made`}),children:`It usually takes about five minutes. The live view shows each step as it runs; while you wait, look at a sample or set Slopify to start when you log in.`}),(0,h.jsx)(Sy,{title:`While you wait: the samples`,info:`welcome.samples`}),(0,h.jsx)(mR,{label:`Samples`,className:`mb-6 [&_.sl-row__meta]:whitespace-normal`,children:RFe.map(e=>{let t=b?.samples[e.id]??null;return(0,h.jsx)(hR,{title:e.name,meta:e.summary,actions:t===null?(0,h.jsx)(RO,{to:`/settings`,search:{section:`storage`},children:`Restore samples in Settings`}):(0,h.jsx)(LO,{to:`/projects/$projectId`,params:{projectId:t},className:pR,children:e.action})},e.id)})}),(0,h.jsx)(Cre,{})]}),(0,h.jsxs)(GR,{status:(0,h.jsx)(WR,{tone:w?.tone??`info`,children:w?.text}),children:[(0,h.jsx)(RO,{to:`/play`,children:`Set up a long video instead`}),O===void 0?null:(0,h.jsx)(B,{onClick:()=>E(O.id),children:`Back`}),D===void 0?null:(0,h.jsx)(B,{variant:`primary`,onClick:()=>E(D.id),children:`Next: ${D.label}`})]})]})}function k9({voice:e,checking:t,onCheck:n}){return e.ready?(0,h.jsx)(mR,{label:`Narration voice`,className:`mb-6 [&_.sl-row__title]:whitespace-normal`,children:(0,h.jsx)(hR,{lead:(0,h.jsx)(GO,{tone:`done`}),title:e.text,actions:(0,h.jsx)(LO,{variant:`quiet`,to:`/settings`,search:{section:`providers`},children:`Add a voice key`})})}):(0,h.jsx)(GM,{tone:`waiting`,className:`mb-6`,title:`No voice can narrate the short yet.`,actions:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(LO,{variant:`primary`,to:`/settings`,search:{section:`providers`},children:`Add a voice key`}),(0,h.jsx)(B,{disabled:t,onClick:n,children:t?`Checking…`:`Check again`})]}),children:e.text})}var A9=_a({component:Nve,notFoundComponent:oTe}),UFe=ha({getParentRoute:()=>A9,path:`/`,component:Kwe});function j9(e){let t=DNe(e.show),n=typeof e.q==`string`&&e.q.trim()!==``?e.q.slice(0,200):``,r=kNe(e.sort);return{...t===void 0||t===`all`?{}:{show:t},...n===``?{}:{q:n},...r===void 0||r===`newest`?{}:{sort:r}}}var M9=ha({getParentRoute:()=>A9,path:`projects`,validateSearch:j9,component:WFe});function WFe(){let{show:e,q:t,sort:n}=M9.useSearch(),r=Ji();return(0,h.jsx)(RNe,{filter:e??`all`,query:t??``,sort:n??`newest`,onFilter:e=>{r({to:`/projects`,search:j9({show:e,q:t,sort:n}),replace:!0,resetScroll:!1})},onQuery:t=>{r({to:`/projects`,search:j9({show:e,q:t,sort:n}),replace:!0,resetScroll:!1})},onSort:n=>{r({to:`/projects`,search:j9({show:e,q:t,sort:n}),replace:!0,resetScroll:!1})}})}var GFe=ha({getParentRoute:()=>A9,path:`welcome`,component:HFe}),KFe=ha({getParentRoute:()=>A9,path:`play`,component:UDe}),N9=ha({getParentRoute:()=>A9,id:`_library`,component:SCe}),qFe=ha({getParentRoute:()=>A9,path:`library`,beforeLoad:()=>{throw cn({to:`/prompts`,search:{kind:`article`}})}}),JFe=ha({getParentRoute:()=>A9,path:`channels`,component:zSe}),P9=ha({getParentRoute:()=>A9,path:`channels/$channelId`,validateSearch:e=>e.tab===void 0?{}:{tab:LSe(e.tab)},component:YFe});function YFe(){let{channelId:e}=P9.useParams(),{tab:t}=P9.useSearch(),n=Ji();return(0,h.jsx)(RSe,{channelId:e,tab:t??`brand`,onTab:t=>{n({to:`/channels/$channelId`,params:{channelId:e},search:{tab:t},resetScroll:!1})}},e)}var XFe=ha({getParentRoute:()=>N9,path:`templates`,validateSearch:e=>mL(e.item),component:tIe}),ZFe=/^[0-9A-Za-z-]{1,64}$/;function F9(e){let t=Uxe(e.tab);return t===`releases`?{tab:t}:t===`schedules`?typeof e.schedule==`string`&&ZFe.test(e.schedule)?{tab:`schedules`,schedule:e.schedule}:{tab:`schedules`}:{}}var I9=ha({getParentRoute:()=>A9,path:`calendar`,validateSearch:F9,component:eIe}),QFe=ha({getParentRoute:()=>A9,path:`schedules`,beforeLoad:()=>{throw cn({to:`/calendar`,search:{tab:`schedules`},replace:!0})}}),$Fe=ha({getParentRoute:()=>A9,path:`schedules/$scheduleId`,beforeLoad:({params:e})=>{throw cn({to:`/calendar`,search:F9({tab:`schedules`,schedule:e.scheduleId}),replace:!0})}});function eIe(){let e=F9(I9.useSearch()),t=Ji();return(0,h.jsx)(Gxe,{tab:e.tab??`weeks`,schedule:e.schedule,onTab:e=>{t({to:`/calendar`,search:e===`weeks`?{}:{tab:e},resetScroll:!1})},onSchedule:e=>{t({to:`/calendar`,search:{tab:`schedules`,schedule:e},replace:!0})}})}function tIe(){let e=aA(),t=Ji();return(0,h.jsx)(PFe,{getGeneration:e.generation,blocked:e.review.starting||e.review.uncertain||e.review.created!==null,beforeApply:e.flush,onApplied:async(n,r)=>!r()||!await e.open(n,r)||!r()?!1:(await t({to:`/play`}),r())})}var L9=ha({getParentRoute:()=>A9,path:`projects/$projectId`,validateSearch:e=>{let t=C7(e.section);return t===void 0?{}:{section:t}},component:dIe}),R9=ha({getParentRoute:()=>N9,path:`prompts`,validateSearch:e=>({kind:Ub(e.kind),...mL(e.item)}),component:fIe}),z9=ha({getParentRoute:()=>A9,path:`prompts/new`,validateSearch:e=>{let t=Ub(e.kind);return typeof e.from==`string`?{kind:t,from:e.from}:{kind:t}},component:pIe}),B9=ha({getParentRoute:()=>A9,path:`prompts/$promptId`,component:mIe}),V9=ha({getParentRoute:()=>N9,path:`entries`,validateSearch:e=>({category:Bb(e.category),...mL(e.item)}),component:hIe}),H9=ha({getParentRoute:()=>A9,path:`entries/new`,validateSearch:e=>{let t=Bb(e.category);return typeof e.from==`string`?{category:t,from:e.from}:{category:t}},component:gIe}),U9=ha({getParentRoute:()=>A9,path:`entries/$entryId`,component:_Ie}),nIe=ha({getParentRoute:()=>N9,path:`narration-aliases`,component:aTe}),rIe=ha({getParentRoute:()=>N9,path:`ab-results`,component:QL}),iIe=ha({getParentRoute:()=>N9,path:`document-themes`,validateSearch:e=>mL(e.item),component:wCe}),W9=ha({getParentRoute:()=>A9,path:`document-themes/new`,validateSearch:e=>typeof e.from==`string`?{from:e.from}:{},component:vIe}),G9=ha({getParentRoute:()=>A9,path:`document-themes/$themeId`,component:yIe});function aIe(e){let t=e.section===void 0?void 0:ik(e.section),n=t===`patch-notes`&&typeof e.note==`string`&&/^[0-9A-Za-z][0-9A-Za-z.-]{0,63}$/.test(e.note)?e.note:void 0;return{...t===void 0?{}:{section:t},...n===void 0?{}:{note:n}}}var K9=ha({getParentRoute:()=>A9,path:`settings`,validateSearch:aIe,component:uIe}),q9=ha({getParentRoute:()=>A9,path:`help/tutorials/$page`,validateSearch:e=>typeof e.q==`string`&&e.q.trim()!==``?{q:e.q.slice(0,200)}:{},component:oIe});function oIe(){let{page:e}=q9.useParams(),{q:t}=q9.useSearch(),n=Va({select:e=>e.hash});return(0,h.jsx)(FFe,{page:e,anchor:n===``?void 0:n,words:t})}var sIe=ha({getParentRoute:()=>A9,path:`help`,beforeLoad:()=>{throw cn({to:`/help/tutorials/$page`,params:{page:`Home`}})}}),cIe=ha({getParentRoute:()=>A9,path:`help/tutorials`,beforeLoad:()=>{throw cn({to:`/help/tutorials/$page`,params:{page:`Home`}})}}),lIe=ha({getParentRoute:()=>A9,path:`usage`,beforeLoad:()=>{throw cn({to:`/settings`,search:{section:`usage`}})}});function uIe(){let{section:e,note:t}=K9.useSearch(),n=Ji(),r=tk.find(t=>t.id===(e??`providers`));return jv(r===void 0?`Settings`:`Settings · ${r.label}`),(0,h.jsx)(TFe,{section:e??`providers`,note:t,onSection:e=>{n({to:`/settings`,search:{section:e},resetScroll:!1})},onNote:e=>{n({to:`/settings`,search:{section:`patch-notes`,...e===void 0?{}:{note:e}}})}})}function dIe(){let{projectId:e}=L9.useParams(),t=aA(),n=Ji();return(0,h.jsx)(aNe,{projectId:e,openDraft:async e=>!await t.flush()||!await t.open(e)?!1:(await n({to:`/play`}),!0)},e)}function fIe(){let{kind:e}=R9.useSearch(),t=Ji(),n=J9();return(0,h.jsx)(VNe,{kind:e,onKind:e=>{t({to:`/prompts`,search:{kind:e},replace:!0})},onUseInPlay:n.use,playBlocked:n.blocked})}function J9(){let e=aA(),t=Ji();return{blocked:e.review.starting||e.review.uncertain||e.review.created!==null?`Play is starting a run from its draft. Wait for it to start, then try again.`:void 0,use:n=>{let r=BL(e.document,n);e.edit(r.document),t({to:`/play`}).then(()=>e.navigate(r.section,r.field))}}}function pIe(){let{kind:e,from:t}=z9.useSearch(),n=Y9();return(0,h.jsx)(z7,{promptId:void 0,kind:e,from:t,onLeave:n},`${e}:${t??`new`}`)}function mIe(){let{promptId:e}=B9.useParams(),t=Y9();return(0,h.jsx)(z7,{promptId:e,kind:`article`,from:void 0,onLeave:t},e)}function Y9(){let e=Ji();return t=>{e({to:`/prompts`,search:{kind:t}})}}function hIe(){let{category:e}=V9.useSearch(),t=Ji(),n=J9();return(0,h.jsx)(ECe,{category:e,onCategory:e=>{t({to:`/entries`,search:{category:e},replace:!0})},onUseInPlay:n.use,playBlocked:n.blocked})}function gIe(){let{category:e,from:t}=H9.useSearch(),n=Z9();return(0,h.jsx)(X0,{entryId:void 0,category:e,from:t,onLeave:n})}function _Ie(){let{entryId:e}=U9.useParams(),t=Z9();return(0,h.jsx)(X0,{entryId:e,category:`intro`,from:void 0,onLeave:t})}function vIe(){let{from:e}=W9.useSearch(),t=X9();return(0,h.jsx)(j1,{themeId:void 0,from:e,onLeave:t})}function yIe(){let{themeId:e}=G9.useParams(),t=X9();return(0,h.jsx)(j1,{themeId:e,from:void 0,onLeave:t})}function X9(){let e=Ji();return()=>{e({to:`/document-themes`})}}function Z9(){let e=Ji();return t=>{e({to:`/entries`,search:{category:t}})}}var bIe=A9.addChildren({homeRoute:UFe,projectsRoute:M9,welcomeRoute:GFe,playRoute:KFe,libraryRoute:N9.addChildren({promptsRoute:R9,entriesRoute:V9,templatesRoute:XFe,documentThemesRoute:iIe,narrationAliasesRoute:nIe,abResultsRoute:rIe}),schedulesRoute:QFe,scheduleRoute:$Fe,calendarRoute:I9,libraryIndexRoute:qFe,channelsRoute:JFe,channelRoute:P9,projectRoute:L9,newPromptRoute:z9,promptRoute:B9,newEntryRoute:H9,entryRoute:U9,newDocumentThemeRoute:W9,documentThemeRoute:G9,settingsRoute:K9,usageRoute:lIe,helpRoute:sIe,tutorialsIndexRoute:cIe,tutorialsRoute:q9});function xIe(){return Pa({routeTree:bIe,defaultErrorComponent:sTe,scrollRestoration:!0})}function SIe(){let e,t,n=new Set;return{observe:r=>{if(e===void 0){e=r;for(let e of n)e();return}if(r!==e&&r!==t){t=r;for(let e of n)e()}},staleAt:()=>t,loadedAt:()=>e,subscribe:e=>(n.add(e),()=>{n.delete(e)})}}function CIe(e,t){return async(n,r)=>{let i=await e(n,r),a=i.headers.get(`X-Slopify-Version`);return a!==null&&t.observe(a),i}}function wIe(){let e=new Map;return{observe:t=>{if(t.type===`stage.state`){let n=e.get(t.projectId);if(n){for(let[e,r]of n)r.stage===t.stage&&r.revisionId===t.revisionId&&r.workId===t.workId&&n.delete(e);n.size===0&&e.delete(t.projectId)}return}if(t.type!==`llm.preview`)return;let n=e.get(t.projectId)??new Map,r=JSON.stringify([t.revisionId,t.workId,t.callId]),i=n.get(r),a=(t.reset?t.text:`${i?.text??``}${t.text}`).slice(-65536);for(n.delete(r),n.set(r,{...t,text:a,reset:!0});n.size>8;){let e=n.keys().next().value;e!==void 0&&n.delete(e)}for(e.delete(t.projectId),e.set(t.projectId,n);e.size>16;){let t=e.keys().next().value;t!==void 0&&e.delete(t)}},snapshot:t=>[...e.get(t)?.values()??[]],snapshotAll:()=>[...e.values()].flatMap(e=>[...e.values()])}}var Q9=/\/events\/projects\/([^/?#]+)/,TIe=/\/events\/global(?:[?#]|$)/,EIe=[`running.count`,`staging.progress`,`staging.failed`,`schedule.topics`,`stage.state`,`stage.progress`,`article.delta`,`llm.preview`,`image.landed`,`narration.piece`,`project.state`,`project.updated`,`review.flagged`,`review.auto-passed`],DIe=2,OIe=e=>Math.min(3e4,1e3*2**e);function kIe(e,t=(e,t)=>setTimeout(e,t)){let n=new Set,r=wIe(),i,a=!1,o=0,s=(e,t,n)=>{for(let r of e.listeners.get(t)??[])r({data:n})},c=l=>{if(i!==void 0)return;let u=e(l);i=u,u.addEventListener(`open`,()=>{a=!0,o=0;for(let e of[...n])for(let t of e.opens)t()}),u.addEventListener(`error`,()=>{if(i!==u)return;for(let e of[...n])s(e,`error`,``);if(u.readyState!==DIe)return;u.close(),i=void 0;let e=OIe(o);o+=1,t(()=>{i===void 0&&n.size>0&&c(l)},e)});for(let e of EIe)u.addEventListener(e,t=>{let i;try{let n=JSON.parse(t.data);typeof n.projectId==`string`&&(i=n.projectId),(e===`llm.preview`||e===`stage.state`)&&r.observe(n)}catch{return}for(let r of[...n])(r.projectId===void 0||r.projectId===i)&&s(r,e,t.data)})};return t=>{let o=Q9.exec(t)?.[1];if(o===void 0&&!TIe.test(t))return e(t);c(o===void 0?t:t.replace(Q9,`/events/global`));let l={projectId:o===void 0?void 0:decodeURIComponent(o),listeners:new Map,opens:new Set};return n.add(l),a&&queueMicrotask(()=>{if(n.has(l)){for(let e of l.opens)e();if(l.projectId!==void 0)for(let e of r.snapshot(l.projectId))s(l,`llm.preview`,JSON.stringify(e))}}),{addEventListener:(e,t)=>{if(e===`open`){l.opens.add(t);return}let n=l.listeners.get(e)??new Set;n.add(t),l.listeners.set(e,n)},close:()=>{n.delete(l),n.size===0&&i!==void 0&&(i.close(),i=void 0,a=!1)}}}}function AIe(e){let t=SIe(),n={api:Co(window.location.origin,CIe(window.fetch.bind(window),t),To(e=>{let n=e.headers.get(`X-Slopify-Version`);n!==null&&t.observe(n)})),openEvents:kIe(e=>new EventSource(e)),version:t};(0,co.createRoot)(e).render((0,h.jsx)(m.StrictMode,{children:(0,h.jsx)(v,{client:new Ge,children:(0,h.jsx)(nre,{deps:n,children:(0,h.jsx)(La,{router:xIe()})})})}))}var $9=document.getElementById(`root`);if($9===null)throw Error(`index.html carries no #root element for the app to mount on`);AIe($9);export{s1 as t};
|