1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,897800,e=>{"use strict";var t=e.i(530362),n=e.i(555264),a=e.i(6799);e.s(["useAdminAction",0,function(){let[e,s]=(0,t.useState)(null),[r,l]=(0,t.useTransition)(),{toast:i}=(0,a.useToast)();return{run:function(e,t={}){return s(null),new Promise(a=>{l(async()=>{let r=await (0,n.settleAdminAction)(e);if(!r.ok){s(r.error),a(!1);return}t.onSuccess?.(r.data),t.successMessage&&i(t.successMessage),a(!0)})})},isPending:r,error:e,clearError:()=>s(null)}}])},330009,e=>{"use strict";var t=e.i(10276),n=e.i(334900),a=e.i(248992),s=e.i(988676),r=e.i(647163),l=e.i(167881);function i({className:e,children:n,...a}){return(0,t.jsx)(s.ModalOverlay,{"data-slot":"alert-dialog-overlay",className:(0,r.cn)("modal modal-open",e),...a,children:n})}e.s(["AlertDialog",0,function({className:e,children:a,...l}){return(0,t.jsx)(i,{...l,children:(0,t.jsx)(s.Modal,{"data-slot":"alert-dialog-content",className:(0,r.cn)("modal-box max-w-sm",e),children:(0,t.jsx)(n.Dialog,{"data-slot":"alert-dialog",role:"alertdialog",className:"flex flex-col gap-3 outline-none",children:a})})})},"AlertDialogAction",0,function({className:e,...n}){return(0,t.jsx)(l.Button,{slot:"close","data-slot":"alert-dialog-action",className:(0,r.cn)(e),...n})},"AlertDialogCancel",0,function({className:e,variant:n="outline",...a}){return(0,t.jsx)(l.Button,{slot:"close","data-slot":"alert-dialog-cancel",className:(0,r.cn)(e),variant:n,...a})},"AlertDialogDescription",0,function({className:e,...n}){return(0,t.jsx)("div",{"data-slot":"alert-dialog-description",className:(0,r.cn)("text-sm text-base-content/70",e),...n})},"AlertDialogFooter",0,function({className:e,...n}){return(0,t.jsx)("div",{"data-slot":"alert-dialog-footer",className:(0,r.cn)("modal-action flex-col-reverse sm:flex-row sm:justify-end",e),...n})},"AlertDialogHeader",0,function({className:e,...n}){return(0,t.jsx)("div",{"data-slot":"alert-dialog-header",className:(0,r.cn)("flex flex-col gap-1 text-center sm:text-left",e),...n})},"AlertDialogTitle",0,function({className:e,...n}){return(0,t.jsx)(a.Heading,{slot:"title","data-slot":"alert-dialog-title",className:(0,r.cn)("font-heading text-base font-medium",e),...n})}])},555264,e=>{"use strict";async function t(e){try{return await e()}catch(e){return console.error("Admin action call failed:",e),{ok:!1,error:"Couldn't reach the server. Reload the page and try again."}}}e.s(["settleAdminAction",0,t])},696718,e=>{"use strict";var t=e.i(10276),n=e.i(330009);e.s(["ConfirmDialog",0,function({isOpen:e,onOpenChange:a,title:s,description:r,confirmLabel:l,onConfirm:i}){return(0,t.jsxs)(n.AlertDialog,{isOpen:e,onOpenChange:a,children:[(0,t.jsxs)(n.AlertDialogHeader,{children:[(0,t.jsx)(n.AlertDialogTitle,{children:s}),(0,t.jsx)(n.AlertDialogDescription,{children:r})]}),(0,t.jsxs)(n.AlertDialogFooter,{children:[(0,t.jsx)(n.AlertDialogCancel,{children:"Cancel"}),(0,t.jsx)(n.AlertDialogAction,{onPress:i,children:l})]})]})}])},148208,e=>{"use strict";e.s(["formatAdminDate",0,function(e){if(!e)return"â";let t=new Date(e).getTime();return Number.isNaN(t)?"â":new Date(t).toISOString().slice(0,10)}])},163873,559308,e=>{"use strict";var t=e.i(948365);let n=(0,t.createServerReference)("40d34e074bb6fdd79ddfe372f5c52455bf088b7e08",t.callServer,void 0,t.findSourceMapURL,"addToNarrationAllowlist");e.s(["addToNarrationAllowlist",0,n],163873);let a=(0,t.createServerReference)("40965915687217099db24912d78b134e2815235001",t.callServer,void 0,t.findSourceMapURL,"removeFromNarrationAllowlist");e.s(["removeFromNarrationAllowlist",0,a],559308)},251272,e=>{"use strict";var t=e.i(10276);e.s(["AdminPageHeader",0,function({title:e,description:n,actions:a}){return(0,t.jsxs)("header",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"m-0 text-2xl font-semibold text-base-content",children:e}),(0,t.jsx)("p",{className:"mt-1 text-base text-base-content/65",children:n})]}),a]})}])},631746,e=>{"use strict";var t=e.i(948365);let n=(0,t.createServerReference)("40f95ef7151c15827ecdbc420acab19d5b2fd076ef",t.callServer,void 0,t.findSourceMapURL,"setNarrationEnabled");
1e.s(["setNarrationEnabled",0,n])},319036,e=>{"use strict";var t=e.i(10276),n=e.i(647163);e.s(["Switch",0,function({className:e,onCheckedChange:a,...s}){return(0,t.jsx)("input",{type:"checkbox","data-slot":"switch",className:(0,n.cn)("toggle",e),onChange:e=>a?.(e.target.checked),...s})}])},342576,e=>{"use strict";var t=e.i(10276),n=e.i(530362),a=e.i(696718),s=e.i(319036),r=e.i(555264),l=e.i(647163);e.s(["AdminSwitch",0,function({value:e,label:i,save:o,disabled:c,busy:d,size:u="md",confirm:m,hideError:x}){let{checked:f,change:h,error:p,isPending:b}=function(e,t){let[a,s]=(0,n.useOptimistic)(e),[l,i]=(0,n.useState)(null),[o,c]=(0,n.useTransition)();return{checked:a,change:function(e){i(null),c(async()=>{s(e);let n=await (0,r.settleAdminAction)(()=>t(e));n.ok||i(n.error)})},error:l,isPending:o}}(e,o),[g,v]=(0,n.useState)(null),j=b||d;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.Switch,{className:(0,l.cn)("toggle-primary","sm"===u&&"toggle-sm"),checked:f,disabled:c,"aria-disabled":j||void 0,onCheckedChange:function(e){if(j)return;let t=m?.(e)??null;t?v({next:e,confirmation:t}):h(e)},"aria-label":i}),p&&!x?(0,t.jsx)("p",{role:"alert",className:"m-0 mt-1 text-sm text-error",children:p}):null,g?(0,t.jsx)(a.ConfirmDialog,{isOpen:!0,onOpenChange:e=>!e&&v(null),...g.confirmation,onConfirm:()=>h(g.next)}):null]})}],342576)},713014,e=>{"use strict";var t=e.i(10276);e.s(["AdminSettingRow",0,function({title:e,description:n,notes:a,control:s}){return(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-base-300 px-4 py-3",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("p",{className:"m-0 font-medium text-base-content",children:e}),n?(0,t.jsx)("p",{className:"m-0 text-sm text-base-content/65",children:n}):null,a]}),(0,t.jsx)("div",{className:"shrink-0",children:s})]})}])},667810,e=>{"use strict";var t=e.i(10276);e.s(["AdminSection",0,function({id:e,title:n,description:a,action:s,children:r}){return(0,t.jsxs)("section",{"aria-labelledby":e,className:"flex flex-col gap-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{id:e,className:"m-0 text-base font-semibold text-base-content",children:n}),a?(0,t.jsx)("p",{className:"m-0 text-sm text-base-content/65",children:a}):null]}),s]}),r]})}])},986034,e=>{"use strict";var t=e.i(10276),n=e.i(631746),a=e.i(948365);let s=(0,a.createServerReference)("60d8915044a92c711367f1e99d56973e42da008e42",a.callServer,void 0,a.findSourceMapURL,"setNarrationProvider");var r=e.i(251272),l=e.i(713014),i=e.i(342576),o=e.i(530362),c=e.i(163873),d=e.i(559308),u=e.i(667810),m=e.i(696718),x=e.i(897800),f=e.i(148208);function h({allowlist:e}){let[n,a]=(0,o.useState)(""),[s,r]=(0,o.useState)(null),{run:l,isPending:i,error:p,clearError:b}=(0,x.useAdminAction)();function g(){let e=n.trim();e&&l(()=>(0,c.addToNarrationAllowlist)(e),{onSuccess:()=>a(""),successMessage:"Added."})}return(0,t.jsxs)(u.AdminSection,{id:"narration-access",title:"Who can use narration",description:"People on this list can play narration while it is switched on.",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row",children:[(0,t.jsx)("input",{type:"email",className:"input input-bordered flex-1",placeholder:"[email protected]","aria-label":"Email to add",value:n,readOnly:i,onChange:e=>{b(),a(e.target.value)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),g())}}),(0,t.jsx)("button",{type:"button",className:"btn btn-primary transition-transform active:scale-[0.96]",disabled:i,onClick:g,children:i?"Workingâ¦":"Add"})]}),p?(0,t.jsx)("p",{role:"alert",className:"m-0 text-sm text-error",children:p}):null,(0,t.jsx)("div",{className:"overflow-x-auto rounded-lg border border-base-300",children:(0,t.jsxs)("table",{className:"table",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{children:"Email"}),(0,t.jsx)("th",{children:"Added"}),(0,t.jsx)("th",{children:(0,t.jsx)("span",{className:"sr-only",children:"Actions"})})]})}),(0,t.jsxs)("tbody",{children:[e.map(e=>(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{className:"font-medium text-base-content",children:e.email}),(0,t.jsx)("td",{className:"text-base-content/65",children:(0,f.formatAdminDate)(e.createdAt)}),(0,t.jsx)("td",{className:"text-right",children:(0,t.jsx)("button",{type:"button",className:"btn btn-sm btn-ghost transition-transform active:scale-[0.96]",disabled:i,onClick:()=>r(e),children:"Remove"})})]}
1,e.userId)),0===e.length?(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:3,className:"text-center text-base-content/50",children:"No one has access yet."})}):null]})]})}),(0,t.jsx)(m.ConfirmDialog,{isOpen:null!==s,onOpenChange:e=>!e&&r(null),title:"Remove access?",description:`${s?.email??"This person"} can no longer play narration.`,confirmLabel:"Remove",onConfirm:function(){if(!s)return;let{userId:e}=s;l(()=>(0,d.removeFromNarrationAllowlist)(e),{successMessage:"Removed."})}})]})}let p=(0,a.createServerReference)("0055804a05f1a60922a95e92b019a24fea087fdf6a",a.callServer,void 0,a.findSourceMapURL,"cancelNarrationSyncJob"),b=(0,a.createServerReference)("40048fdacf570f2739ae101207e4462528563f5f78",a.callServer,void 0,a.findSourceMapURL,"getNarrationSyncCoverage"),g=(0,a.createServerReference)("007c53e16ee607a4ca3d7e1de8a8103b4a3bc317b3",a.callServer,void 0,a.findSourceMapURL,"getNarrationSyncStatus"),v=(0,a.createServerReference)("00b6a27ae2f732c922c89cd135ba058d9d2d8a1cf9",a.callServer,void 0,a.findSourceMapURL,"resumeNarrationSync"),j=(0,a.createServerReference)("40389381b26d4f9ed1cb841541885f317ca01d7bd7",a.callServer,void 0,a.findSourceMapURL,"startNarrationSync");var N=e.i(781947);function S({coverage:e,selectedId:n,selected:a,narrationEnabled:s,active:r,showResume:l,isPending:i,onSelect:o,onStart:c,onCancel:d,onResume:u}){let m=i||!s||!a||0===a.missingCount||r;return(0,t.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-end",children:[(0,t.jsxs)("label",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-base-content",children:"Collection"}),(0,t.jsxs)("select",{className:"select w-full",value:n,disabled:i||r||0===e.length,onChange:e=>o(e.target.value),children:[0===e.length?(0,t.jsx)("option",{value:"",children:"No collections"}):null,e.map(e=>(0,t.jsxs)("option",{value:e.domainId,children:[e.name," (",e.missingCount," missing)"]},e.domainId))]})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("button",{type:"button",className:"btn",disabled:m,onClick:c,children:i&&!r?"Startingâ¦":"Start"}),r?(0,t.jsx)("button",{type:"button",className:"btn",disabled:i,onClick:d,children:"Cancel"}):null,l?(0,t.jsx)("button",{type:"button",className:"btn",disabled:i,onClick:u,children:"Resume"}):null]})]})}function A({job:e}){let n=e.total,a=Math.min(e.cursor,n);return(0,t.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-base-300 px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,t.jsx)("p",{className:"m-0 font-medium text-base-content",children:e.domainName}),(0,t.jsx)("span",{className:"badge",children:e.status})]}),(0,t.jsx)("progress",{className:"progress",value:a,max:n||1}),(0,t.jsxs)("p",{className:"m-0 text-sm text-base-content/65",children:[a,"/",n," · ",e.generatedCount," generated · ",e.failedCount," failed"]}),e.lastError?(0,t.jsx)(N.Alert,{variant:"destructive",children:(0,t.jsx)(N.AlertDescription,{children:e.lastError})}):null]})}var w=e.i(555264);function y(e){return"queued"===e||"running"===e}function C({enabled:e,coverage:n,lastJob:a}){var s,r;let l,[i,c]=(0,o.useState)(n),[d,f]=(0,o.useState)(n[0]?.domainId??""),[h,R]=(0,o.useState)(a),[D,k]=(0,o.useState)(null),[M,E]=(0,o.useState)(!1),{run:L,isPending:T,error:U,clearError:O}=(0,x.useAdminAction)(),I=i.find(e=>e.domainId===d),P=!!(h&&y(h.status));async function F(){if(!await L(v))return;let e=await (0,w.settleAdminAction)(g);e.ok&&R(e.data)}return s=()=>{(async()=>{let e=await (0,w.settleAdminAction)(g);if(!e.ok)return k(e.error);if(k(null),R(e.data),!e.data||y(e.data.status))return;let t=await (0,w.settleAdminAction)(()=>b(i.map(e=>({id:e.domainId,name:e.name}))));t.ok?c(t.data):k(t.error)})()},r=P?2e3:null,(l=(0,o.useRef)(s)).current=s,(0,o.useEffect)(()=>{if(null===r)return;let e=setInterval(()=>l.current(),r);return()=>clearInterval(e)},[r]),(0,t.jsxs)(u.AdminSection,{id:"narration-sync",title:"Audio sync",description:"Generate missing term audio for one collection. Closing this page does not stop a run.",children:[e?null:(0,t.jsx)(N.Alert,{variant:"warning",children:(0,t.jsx)(N.AlertDescription,{children:"Turn narration on above before starting a sync."})}),(0,t.jsx)(S,{coverage:i,selectedId:d,selected:I,narrationEnabled:e,active:P,showResume:!!(h&&y(h.status)&&h.leaseExpired),isPending:T,onSelect:f,onStart:()=>{d&&(O(),L(()=>j(d),{onSuccess:R}))},onCancel:()=>E(!0),onResume:()=>void F()}),U||D?(0,t.jsx)("p",{role:"alert",className:"m-0 text-sm text-error",children:U??D}):null,h?(0,t.jsx)(A,{job:h}):null,(0,t.jsx)(m.ConfirmDialog,{isOpen:M,onOpenChange:E,title:"Cancel this sync?",description:"Clips already made are kept. You can start again later.",confirmLabel:"Cancel sync",onConfirm:()=>void L(p,{onSuccess:R})})]})}let R=(0,a.createServerReference)("40200e9a976584871a22f93ca03b21212017791c35",a.callServer,void 0,a.findSourceMapURL,"setNarrationCaps");var D=e.i(817422);let k=D.z.object({term:D.z.number().int().min(1).max(1e3).nullable(),story:D.z.number().int().min(1).max(1e3)});function M(e){return""===e.trim()?NaN:Number(e)}function E(e){return null===e?"unknown":String(e)}function L({caps:e,usageLast24h:n}){let[a,s]=(0,o.useState)(e.term?.toString()??""),[r,l]=(0,o.useState)(e.story?.toString()??""),[i,c]=(0,o.useState)(!1),{run:d,isPending:m,error:f,clearError:h}=(0,x.useAdminAction)();function p(e,t){c(!1),h(),e(t)}return(0,t.jsx)(u.AdminSection,{id:"narration-caps",title:"Daily limits per person",description:"How many new clips one person can have made in 24 hours. Clips that already exist are free, and failed attempts count. Leave the term limit blank for no limit.",children:(0,t.jsxs)("form",{noValidate:!0,onSubmit:function(e){e.preventDefault();let t=k.safeParse({term:""===a.trim()?null:M(a),story:M(r)});c(!t.success),t.success&&d(()=>R(t.data),{successMessage:"Limits saved."})},className:"flex flex-col gap-3",children:[(0,t.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,t.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,t.jsxs)("span",{className:"text-sm",children:["Term clips (last 24 h: ",E(n.term),")"]}),(0,t.jsx)("input",{type:"number",className:"input input-bordered w-full",value:a,placeholder:"No limit",onChange:e=>p(s,e.target.value)})]}),(0,t.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,t.jsxs)("span",{className:"text-sm",children:["Story clips (last 24 h: ",E(n.story),")"]}),(0,t.jsx)("input",{type:"number",className:"input input-bordered w-full",value:r,onChange:e=>p(l,e.target.value)})]})]}),i?(0,t.jsx)("p",{role:"alert",className:"m-0 text-sm text-error",children:"Enter whole numbers from 1 to 1000. Stories need a limit."}):null,f?(0,t.jsx)("p",{role:"alert",className:"m-0 text-sm text-error",children:f}):null,(0,t.jsx)("div",{children:(0,t.jsx)("button",{type:"submit",className:"btn btn-primary",disabled:m,children:m?"Savingâ¦":"Save limits"})})]})})}e.s(["AdminNarrationPageClient",0,function({healthNote:e,cronNote:a,caps:o,usageLast24h:c,enabled:d,providers:u,providerKeys:m,allowlist:x,coverage:f,lastJob:p}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.AdminPageHeader,{title:"Narration",description:"Control narration for terms and stories, which providers make it, and who can use it. Narration is never charged in AI credits."}),(0,t.jsx)(l.AdminSettingRow,{title:"Narration enabled",description:"When off, no one can play narration regardless of the allowlist below.",notes:(0,t.jsxs)(t.Fragment,{children:[e?(0,t.jsx)("p",{className:"m-0 mt-1 text-sm text-warning",children:e}):null,a?(0,t.jsx)("p",{className:`m-0 mt-1 text-sm ${a.warning?"text-warning":"text-base-content/65"}`,children:a.text}):null]}),control:(0,t.jsx)(i.AdminSwitch,{label:"Enable narration",value:d,save:n.setNarrationEnabled})}),(0,t.jsx)(l.AdminSettingRow,{title:"Murf",description:"The main provider. Used first whenever it is on.",notes:m.murf?null:(0,t.jsx)("p",{className:"m-0 mt-1 text-sm text-warning",children:"Missing MURF_API_KEY, so it is skipped."}),control:(0,t.jsx)(i.AdminSwitch,{label:"Enable Murf",value:u.murf,save:e=>s("murf",e)})}),(0,t.jsx)(l.AdminSettingRow,{title:"ElevenLabs",description:"The fallback. Used when Murf is off, not set up or fails.",notes:m.elevenlabs?null:(0,t.jsx)("p",{className:"m-0 mt-1 text-sm text-warning",children:"Missing ELEVENLABS_API_KEY, so it is skipped."}),control:(0,t.jsx)(i.AdminSwitch,{label:"Enable ElevenLabs",value:u.elevenlabs,save:e=>s("elevenlabs",e)})}),(0,t.jsx)(L,{caps:o,usageLast24h:c}),(0,t.jsx)(h,{allowlist:x}),(0,t.jsx)(C,{enabled:d,coverage:f,lastJob:p})]})}],986034)}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.