PageSourceSearch

https://bowtiesports.com/assets/PostProductionDetail-D0Lv7Dw8.js

js bowtiesports.com collected 2026-10-07 02:29:25 UTC 68,174 bytes, 6 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BrowserRenderer-B1mN2QCW.js","assets/react-vendor-DUhHROXo.js","assets/client-DTel1CZI.js","assets/index-BLtzf0SR.js","assets/router-vendor-Dz9PdDzH.js","assets/index-h_vCROSF.css"])))=>i.map(i=>d[i]);
2import{l as pt,_ as dn,o as q,a5 as Ve,J as Re,b3 as Xn,a2 as Vn}from"./index-BLtzf0SR.js";import{r as l,a as U,b as $e,j as i}from"./react-vendor-DUhHROXo.js";import{d as Yn,L as st}from"./router-vendor-Dz9PdDzH.js";import{u as ee}from"./useMutation-BXp6BKyU.js";import{s as O}from"./client-DTel1CZI.js";import{A as yt}from"./AdminLayout-4AAuHeAU.js";import{C as F}from"./card-9IoFUltb.js";import{B as lt}from"./badge-BsE4KYIf.js";import{T as Wn,a as Hn,b as ze,c as Fe}from"./tabs-B9G-WuXr.js";import{T as Gn}from"./textarea-Da4-oaTC.js";import{I as Ke}from"./input-RFokm5kN.js";import{S as fn,a as pn,b as hn,c as gn,d as Rt}from"./select-CMAo_7oa.js";import{P as mn}from"./plus-Db1qFqHY.js";import{G as Jn}from"./grip-vertical-C9IXDACN.js";import{T as vn}from"./trash-2-cCh6Q5cl.js";import{L as Wt}from"./label-B2yiss_Q.js";import{U as Zn}from"./upload-TDghJ2vl.js";import{A as er}from"./arrow-left-CRb8P6iH.js";import{W as Ht}from"./wand-sparkles-CZDXfwxY.js";import{F as qe}from"./film-BsqWNUHV.js";import{T as tr}from"./triangle-alert-BE8FAob-.js";import{F as Gt}from"./file-audio-C_6eZAST.js";import{B as nr}from"./brain-CXHbf3nU.js";import{M as rr}from"./mic-vocal-CYFzovza.js";import{D as wt}from"./download-DFEQ6r6X.js";import"./NavLink-CsyG-eHO.js";import"./scroll-area-BdyOmc9o.js";import"./index-BdQq_4o_.js";import"./collapsible-BAD8kbtc.js";import"./index-CMI-ZfmW.js";import"./globe-CQ83QW2m.js";import"./users-CIwSfVhi.js";import"./activity-CwFToTs3.js";import"./list-todo-BR3jv1RJ.js";import"./calendar-BDETTnfZ.js";import"./users-round-CCw5yxW7.js";import"./radio-BQgeDg5T.js";import"./clapperboard-BvstouST.js";import"./clipboard-list-CQJ-vJ2y.js";import"./image-arBWrt3y.js";import"./folder-open-CIWhCFhy.js";import"./pencil-C2cyk8cg.js";import"./message-square-BDdDilNB.js";import"./ticket-l9bl0kcm.js";import"./megaphone-DpQsxotQ.js";import"./package-DKB1lvtO.js";import"./circle-user-BeB3uaA1.js";import"./folder-kanban-B8jlMC6s.js";import"./settings-Baim_Eei.js";import"./briefcase-CdSp4ViD.js";import"./chart-line-ohAz7u_s.js";import"./index-O12prPmO.js";import"./chevron-up-B89bkR-F.js";function sr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return l.useMemo(()=>r=>{t.forEach(s=>s(r))},t)}const ht=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ee(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Tt(e){return"nodeType"in e}function Q(e){var t,n;return e?Ee(e)?e:Tt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function It(e){const{Document:t}=Q(e);return e instanceof t}function Ge(e){return Ee(e)?!1:e instanceof Q(e).HTMLElement}function bn(e){return e instanceof Q(e).SVGElement}function _e(e){return e?Ee(e)?e.document:Tt(e)?It(e)?e:Ge(e)||bn(e)?e.ownerDocument:document:document:document}const oe=ht?l.useLayoutEffect:l.useEffect;function Ot(e){const t=l.useRef(e);return oe(()=>{t.current=e}),l.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}function or(){const e=l.useRef(null),t=l.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),n=l.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ye(e,t){t===void 0&&(t=[e]);const n=l.useRef(e);return oe(()=>{n.current!==e&&(n.current=e)},t),n}function Je(e,t){const n=l.useRef();return l.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function ct(e){const t=Ot(e),n=l.useRef(null),r=l.useCallback(s=>{s!==n.current&&(t==null||t(s,n.current)),n.current=s},[]);return[n,r]}function Nt(e){const t=l.useRef();return l.useEffect(()=>{t.current=e},[e]),t.current}let St={};function Ze(e,t){return l.useMemo(()=>{if(t)return t;const n=St[e]==null?0:St[e]+1;return St[e]=n,e+"-"+n},[e,t])}function xn(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((o,a)=>{const c=Object.entries(a);for(const[d,u]of c){const p=o[d];p!=null&&(o[d]=p+e*u)}return o},{...t})}}const Ne=xn(1),ut=xn(-1);function ir(e){return"clientX"in e&&"clientY"in e}function Lt(e){if(!e)return!1;const{KeyboardEvent:t}=Q(e.target);return t&&e instanceof t}function ar(e){if(!e)return!1;const{TouchEvent:t}=Q(e.target);return t&&e instanceof t}function Et(e){if(ar(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return ir(e)?{x:e.clientX,y:e.clientY}:null}const We=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[We.Translate.toString(e),We.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Jt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function lr(e){return e.matches(Jt)?e:e.querySelector(Jt)}const cr={display:"none"};function ur(e){let{id:t,value:n}=e;return U.createElement("div",{id:t,style:cr},n)}function dr(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return U.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function fr(){const[e,t]=l.useState("");return{announce:l.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const yn=l.createContext(null);function pr(e){const t=l.useContext(yn);l.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function hr(){const[e]=l.useState(()=>new Set),t=l.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[l.useCallback(r=>{let{type:s,event:o}=r;e.forEach(a=>{var c;return(c=a[s])==null?void 0:c.call(a,o)})},[e]),t]}const gr={draggable:`
3    To pick up a draggable item, press the space bar.
4    While dragging, use the arrow keys to move the item.
5    Press space again to drop the item in its new position, or press escape to cancel.
6  `},mr={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function vr(e){let{announcements:t=mr,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=gr}=e;const{announce:o,announcement:a}=fr(),c=Ze("DndLiveRegion"),[d,u]=l.useState(!1);if(l.useEffect(()=>{u(!0)},[]),pr(l.useMemo(()=>({onDragStart(f){let{active:g}=f;o(t.onDragStart({active:g}))},onDragMove(f){let{active:g,over:h}=f;t.onDragMove&&o(t.onDragMove({active:g,over:h}))},onDragOver(f){let{active:g,over:h}=f;o(t.onDragOver({active:g,over:h}))},onDragEnd(f){let{active:g,over:h}=f;o(t.onDragEnd({active:g,over:h}))},onDragCancel(f){let{active:g,over:h}=f;
6o(t.onDragCancel({active:g,over:h}))}}),[o,t])),!d)return null;const p=U.createElement(U.Fragment,null,U.createElement(ur,{id:r,value:s.draggable}),U.createElement(dr,{id:c,announcement:a}));return n?$e.createPortal(p,n):p}var L;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(L||(L={}));function dt(){}function br(e,t){return l.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function xr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return l.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const te=Object.freeze({x:0,y:0});function yr(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function wr(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Sr(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function jr(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Zt(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const Cr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=Zt(t,t.left,t.top),o=[];for(const a of r){const{id:c}=a,d=n.get(c);if(d){const u=yr(Zt(d),s);o.push({id:c,data:{droppableContainer:a,value:u}})}}return o.sort(wr)};function Dr(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),a=s-r,c=o-n;if(r<s&&n<o){const d=t.width*t.height,u=e.width*e.height,p=a*c,f=p/(d+u-p);return Number(f.toFixed(4))}return 0}const Rr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=[];for(const o of r){const{id:a}=o,c=n.get(a);if(c){const d=Dr(c,t);d>0&&s.push({id:a,data:{droppableContainer:o,value:d}})}}return s.sort(Sr)};function Nr(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function wn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:te}function Er(e){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),o=1;o<r;o++)s[o-1]=arguments[o];return s.reduce((a,c)=>({...a,top:a.top+e*c.y,bottom:a.bottom+e*c.y,left:a.left+e*c.x,right:a.right+e*c.x}),{...n})}}const _r=Er(1);function Mr(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Ar(e,t,n){const r=Mr(t);if(!r)return e;const{scaleX:s,scaleY:o,x:a,y:c}=r,d=e.left-a-(1-s)*parseFloat(n),u=e.top-c-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),p=s?e.width/s:e.width,f=o?e.height/o:e.height;return{width:p,height:f,top:u,right:d+p,bottom:u+f,left:d}}const Tr={ignoreTransform:!1};function Me(e,t){t===void 0&&(t=Tr);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:p}=Q(e).getComputedStyle(e);u&&(n=Ar(n,u,p))}const{top:r,left:s,width:o,height:a,bottom:c,right:d}=n;return{top:r,left:s,width:o,height:a,bottom:c,right:d}}function en(e){return Me(e,{ignoreTransform:!0})}function Ir(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Or(e,t){return t===void 0&&(t=Q(e).getComputedStyle(e)),t.position==="fixed"}function Lr(e,t){t===void 0&&(t=Q(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const o=t[s];return typeof o=="string"?n.test(o):!1})}function kt(e,t){const n=[];function r(s){if(t!=null&&n.length>=t||!s)return n;if(It(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!Ge(s)||bn(s)||n.includes(s))return n;const o=Q(e).getComputedStyle(s);return s!==e&&Lr(s,o)&&n.push(s),Or(s,o)?n:r(s.parentNode)}return e?r(e):n}function Sn(e){const[t]=kt(e,1);return t??null}function jt(e){return!ht||!e?null:Ee(e)?e:Tt(e)?It(e)||e===_e(e).scrollingElement?window:Ge(e)?e:null:null}function jn(e){return Ee(e)?e.scrollX:e.scrollLeft}function Cn(e){return Ee(e)?e.scrollY:e.scrollTop}function _t(e){return{x:jn(e),y:Cn(e)}}var k;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(k||(k={}));function Dn(e){return!ht||!e?!1:e===document.scrollingElement}function Rn(e){const t={x:0,y:0},n=Dn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},s=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,c=e.scrollLeft>=r.x;return{isTop:s,isLeft:o,isBottom:a,isRight:c,maxScroll:r,minScroll:t}}const kr={x:.2,y:.2};
6function Pr(e,t,n,r,s){let{top:o,left:a,right:c,bottom:d}=n;r===void 0&&(r=10),s===void 0&&(s=kr);const{isTop:u,isBottom:p,isLeft:f,isRight:g}=Rn(e),h={x:0,y:0},j={x:0,y:0},v={height:t.height*s.y,width:t.width*s.x};return!u&&o<=t.top+v.height?(h.y=k.Backward,j.y=r*Math.abs((t.top+v.height-o)/v.height)):!p&&d>=t.bottom-v.height&&(h.y=k.Forward,j.y=r*Math.abs((t.bottom-v.height-d)/v.height)),!g&&c>=t.right-v.width?(h.x=k.Forward,j.x=r*Math.abs((t.right-v.width-c)/v.width)):!f&&a<=t.left+v.width&&(h.x=k.Backward,j.x=r*Math.abs((t.left+v.width-a)/v.width)),{direction:h,speed:j}}function zr(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:a}=window;return{top:0,left:0,right:o,bottom:a,width:o,height:a}}const{top:t,left:n,right:r,bottom:s}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:s,width:e.clientWidth,height:e.clientHeight}}function Nn(e){return e.reduce((t,n)=>Ne(t,_t(n)),te)}function Fr(e){return e.reduce((t,n)=>t+jn(n),0)}function qr(e){return e.reduce((t,n)=>t+Cn(n),0)}function Br(e,t){if(t===void 0&&(t=Me),!e)return;const{top:n,left:r,bottom:s,right:o}=t(e);Sn(e)&&(s<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const $r=[["x",["left","right"],Fr],["y",["top","bottom"],qr]];class Pt{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=kt(n),s=Nn(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,a,c]of $r)for(const d of a)Object.defineProperty(this,d,{get:()=>{const u=c(r),p=s[o]-u;return this.rect[d]+p},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ue{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var s;(s=this.target)==null||s.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Kr(e){const{EventTarget:t}=Q(e);return e instanceof t?e:_e(e)}function Ct(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var Z;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Z||(Z={}));function tn(e){e.preventDefault()}function Ur(e){e.stopPropagation()}var _;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(_||(_={}));const En={start:[_.Space,_.Enter],cancel:[_.Esc],end:[_.Space,_.Enter,_.Tab]},Qr=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case _.Right:return{...n,x:n.x+25};case _.Left:return{...n,x:n.x-25};case _.Down:return{...n,y:n.y+25};case _.Up:return{...n,y:n.y-25}}};class _n{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Ue(_e(n)),this.windowListeners=new Ue(Q(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Z.Resize,this.handleCancel),this.windowListeners.add(Z.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Z.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Br(r),n(te)}handleKeyDown(t){if(Lt(t)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:o=En,coordinateGetter:a=Qr,scrollBehavior:c="smooth"}=s,{code:d}=t;if(o.end.includes(d)){this.handleEnd(t);return}if(o.cancel.includes(d)){this.handleCancel(t);return}const{collisionRect:u}=r.current,p=u?{x:u.left,y:u.top}:te;this.referenceCoordinates||(this.referenceCoordinates=p);const f=a(t,{active:n,context:r.current,currentCoordinates:p});if(f){const g=ut(f,p),h={x:0,y:0},{scrollableAncestors:j}=r.current;for(const v of j){const x=t.code,{isTop:S,isRight:y,isLeft:b,isBottom:C,maxScroll:N,minScroll:E}=Rn(v),R=zr(v),D={x:Math.min(x===_.Right?R.right-R.width/2:R.right,Math.max(x===_.Right?R.left:R.left+R.width/2,f.x)),y:Math.min(x===_.Down?R.bottom-R.height/2:R.bottom,Math.max(x===_.Down?R.top:R.top+R.height/2,f.y))},T=x===_.Right&&!y||x===_.Left&&!b,I=x===_.Down&&!C||x===_.Up&&!S;if(T&&D.x!==f.x){const A=v.scrollLeft+g.x,B=x===_.Right&&A<=N.x||x===_.Left&&A>=E.x;if(B&&!g.y){v.scrollTo({left:A,behavior:c});return}B?h.x=v.scrollLeft-A:h.x=x===_.Right?v.scrollLeft-N.x:v.scrollLeft-E.x,h.x&&v.scrollBy({left:-h.x,behavior:c});break}else if(I&&D.y!==f.y){const A=v.scrollTop+g.y,B=x===_.Down&&A<=N.y||x===_.Up&&A>=E.y;if(B&&!g.x){v.scrollTo({top:A,behavior:c});return}B?h.y=v.scrollTop-A:h.y=x===_.Down?v.scrollTop-N.y:v.scrollTop-E.y,h.y&&v.scrollBy({top:-h.y,behavior:c});break}}this.handleMove(t,Ne(ut(f,this.referenceCoordinates),h))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}_n.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=En,onActivation:s}=t,{active:o}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const c=o.activatorNode.current;return c&&e.target!==c?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function nn(e){return!!(e&&"distance"in e)}function rn(e){return!!(e&&"delay"in e)}class zt{constructor(t,n,r){var s;r===void 0&&(r=Kr(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:a}=o;this.props=t,this.events=n,this.document=_e(a),this.documentListeners=new Ue(this.document),this.listeners=new Ue(r),this.windowListeners=new Ue(Q(a)),this.initialCoordinates=(s=Et(o))!=null?s:te,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Z.Resize,this.handleCancel),this.windowListeners.add(Z.DragStart,tn),this.windowListeners.add(Z.VisibilityChange,this.handleCancel),this.windowListeners.add(Z.ContextMenu,tn),this.documentListeners.add(Z.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(rn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(nn(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:s}=this.props;s(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Z.Click,Ur,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Z.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:s,props:o}=this,{onMove:a,options:{activationConstraint:c}}=o;if(!s)return;const d=(n=Et(t))!=null?n:te,u=ut(s,d);
6if(!r&&c){if(nn(c)){if(c.tolerance!=null&&Ct(u,c.tolerance))return this.handleCancel();if(Ct(u,c.distance))return this.handleStart()}if(rn(c)&&Ct(u,c.tolerance))return this.handleCancel();this.handlePending(c,u);return}t.cancelable&&t.preventDefault(),a(d)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===_.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Xr={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Ft extends zt{constructor(t){const{event:n}=t,r=_e(n.target);super(t,Xr,r)}}Ft.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const Vr={move:{name:"mousemove"},end:{name:"mouseup"}};var Mt;(function(e){e[e.RightClick=2]="RightClick"})(Mt||(Mt={}));class Yr extends zt{constructor(t){super(t,Vr,_e(t.event.target))}}Yr.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Mt.RightClick?!1:(r==null||r({event:n}),!0)}}];const Dt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Wr extends zt{constructor(t){super(t,Dt)}static setup(){return window.addEventListener(Dt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Dt.move.name,t)};function t(){}}}Wr.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:s}=n;return s.length>1?!1:(r==null||r({event:n}),!0)}}];var Qe;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Qe||(Qe={}));var ft;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ft||(ft={}));function Hr(e){let{acceleration:t,activator:n=Qe.Pointer,canScroll:r,draggingRect:s,enabled:o,interval:a=5,order:c=ft.TreeOrder,pointerCoordinates:d,scrollableAncestors:u,scrollableAncestorRects:p,delta:f,threshold:g}=e;const h=Jr({delta:f,disabled:!o}),[j,v]=or(),x=l.useRef({x:0,y:0}),S=l.useRef({x:0,y:0}),y=l.useMemo(()=>{switch(n){case Qe.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case Qe.DraggableRect:return s}},[n,s,d]),b=l.useRef(null),C=l.useCallback(()=>{const E=b.current;if(!E)return;const R=x.current.x*S.current.x,D=x.current.y*S.current.y;E.scrollBy(R,D)},[]),N=l.useMemo(()=>c===ft.TreeOrder?[...u].reverse():u,[c,u]);l.useEffect(()=>{if(!o||!u.length||!y){v();return}for(const E of N){if((r==null?void 0:r(E))===!1)continue;const R=u.indexOf(E),D=p[R];if(!D)continue;const{direction:T,speed:I}=Pr(E,D,y,t,g);for(const A of["x","y"])h[A][T[A]]||(I[A]=0,T[A]=0);if(I.x>0||I.y>0){v(),b.current=E,j(C,a),x.current=I,S.current=T;return}}x.current={x:0,y:0},S.current={x:0,y:0},v()},[t,C,r,v,o,a,JSON.stringify(y),JSON.stringify(h),j,u,N,p,JSON.stringify(g)])}const Gr={x:{[k.Backward]:!1,[k.Forward]:!1},y:{[k.Backward]:!1,[k.Forward]:!1}};function Jr(e){let{delta:t,disabled:n}=e;const r=Nt(t);return Je(s=>{if(n||!r||!s)return Gr;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[k.Backward]:s.x[k.Backward]||o.x===-1,[k.Forward]:s.x[k.Forward]||o.x===1},y:{[k.Backward]:s.y[k.Backward]||o.y===-1,[k.Forward]:s.y[k.Forward]||o.y===1}}},[n,t,r])}function Zr(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Je(s=>{var o;return t==null?null:(o=r??s)!=null?o:null},[r,t])}function es(e,t){return l.useMemo(()=>e.reduce((n,r)=>{const{sensor:s}=r,o=s.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...o]},[]),[e,t])}var He;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(He||(He={}));var At;(function(e){e.Optimized="optimized"})(At||(At={}));const sn=new Map;function ts(e,t){let{dragging:n,dependencies:r,config:s}=t;const[o,a]=l.useState(null),{frequency:c,measure:d,strategy:u}=s,p=l.useRef(e),f=x(),g=Ye(f),h=l.useCallback(function(S){S===void 0&&(S=[]),!g.current&&a(y=>y===null?S:y.concat(S.filter(b=>!y.includes(b))))},[g]),j=l.useRef(null),v=Je(S=>{if(f&&!n)return sn;if(!S||S===sn||p.current!==e||o!=null){const y=new Map;for(let b of e){if(!b)continue;if(o&&o.length>0&&!o.includes(b.id)&&b.rect.current){y.set(b.id,b.rect.current);continue}const C=b.node.current,N=C?new Pt(d(C),C):null;b.rect.current=N,N&&y.set(b.id,N)}return y}return S},[e,o,n,f,d]);return l.useEffect(()=>{p.current=e},[e]),l.useEffect(()=>{f||h()},[n,f]),l.useEffect(()=>{o&&o.length>0&&a(null)},[JSON.stringify(o)]),l.useEffect(()=>{f||typeof c!="number"||j.current!==null||(j.current=setTimeout(()=>{h(),j.current=null},c))},[c,f,h,...r]),{droppableRects:v,measureDroppableContainers:h,measuringScheduled:o!=null};function x(){switch(u){case He.Always:return!1;case He.BeforeDragging:return n;default:return!n}}}function Mn(e,t){return Je(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function ns(e,t){return Mn(e,t)}function rs(e){let{callback:t,disabled:n}=e;const r=Ot(t),s=l.useMemo(()=>
6{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return l.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function gt(e){let{callback:t,disabled:n}=e;const r=Ot(t),s=l.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return l.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function ss(e){return new Pt(Me(e),e)}function on(e,t,n){t===void 0&&(t=ss);const[r,s]=l.useState(null);function o(){s(d=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=d??n)!=null?u:null}const p=t(e);return JSON.stringify(d)===JSON.stringify(p)?d:p})}const a=rs({callback(d){if(e)for(const u of d){const{type:p,target:f}=u;if(p==="childList"&&f instanceof HTMLElement&&f.contains(e)){o();break}}}}),c=gt({callback:o});return oe(()=>{o(),e?(c==null||c.observe(e),a==null||a.observe(document.body,{childList:!0,subtree:!0})):(c==null||c.disconnect(),a==null||a.disconnect())},[e]),r}function os(e){const t=Mn(e);return wn(e,t)}const an=[];function is(e){const t=l.useRef(e),n=Je(r=>e?r&&r!==an&&e&&t.current&&e.parentNode===t.current.parentNode?r:kt(e):an,[e]);return l.useEffect(()=>{t.current=e},[e]),n}function as(e){const[t,n]=l.useState(null),r=l.useRef(e),s=l.useCallback(o=>{const a=jt(o.target);a&&n(c=>c?(c.set(a,_t(a)),new Map(c)):null)},[]);return l.useEffect(()=>{const o=r.current;if(e!==o){a(o);const c=e.map(d=>{const u=jt(d);return u?(u.addEventListener("scroll",s,{passive:!0}),[u,_t(u)]):null}).filter(d=>d!=null);n(c.length?new Map(c):null),r.current=e}return()=>{a(e),a(o)};function a(c){c.forEach(d=>{const u=jt(d);u==null||u.removeEventListener("scroll",s)})}},[s,e]),l.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,a)=>Ne(o,a),te):Nn(e):te,[e,t])}function ln(e,t){t===void 0&&(t=[]);const n=l.useRef(null);return l.useEffect(()=>{n.current=null},t),l.useEffect(()=>{const r=e!==te;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?ut(e,n.current):te}function ls(e){l.useEffect(()=>{if(!ht)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function cs(e,t){return l.useMemo(()=>e.reduce((n,r)=>{let{eventName:s,handler:o}=r;return n[s]=a=>{o(a,t)},n},{}),[e,t])}function An(e){return l.useMemo(()=>e?Ir(e):null,[e])}const cn=[];function us(e,t){t===void 0&&(t=Me);const[n]=e,r=An(n?Q(n):null),[s,o]=l.useState(cn);function a(){o(()=>e.length?e.map(d=>Dn(d)?r:new Pt(t(d),d)):cn)}const c=gt({callback:a});return oe(()=>{c==null||c.disconnect(),a(),e.forEach(d=>c==null?void 0:c.observe(d))},[e]),s}function ds(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ge(t)?t:e}function fs(e){let{measure:t}=e;const[n,r]=l.useState(null),s=l.useCallback(u=>{for(const{target:p}of u)if(Ge(p)){r(f=>{const g=t(p);return f?{...f,width:g.width,height:g.height}:g});break}},[t]),o=gt({callback:s}),a=l.useCallback(u=>{const p=ds(u);o==null||o.disconnect(),p&&(o==null||o.observe(p)),r(p?t(p):null)},[t,o]),[c,d]=ct(a);return l.useMemo(()=>({nodeRef:c,rect:n,setRef:d}),[n,c,d])}const ps=[{sensor:Ft,options:{}},{sensor:_n,options:{}}],hs={current:{}},at={draggable:{measure:en},droppable:{measure:en,strategy:He.WhileDragging,frequency:At.Optimized},dragOverlay:{measure:Me}};class Xe extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const gs={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Xe,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:dt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:at,measureDroppableContainers:dt,windowRect:null,measuringScheduled:!1},ms={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:dt,draggableNodes:new Map,over:null,measureDroppableContainers:dt},mt=l.createContext(ms),Tn=l.createContext(gs);function vs(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Xe}}}function bs(e,t){switch(t.type){case L.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case L.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case L.DragEnd:case L.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case L.RegisterDroppable:{const{element:n}=t,{id:r}
6=n,s=new Xe(e.droppable.containers);return s.set(r,n),{...e,droppable:{...e.droppable,containers:s}}}case L.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const a=new Xe(e.droppable.containers);return a.set(n,{...o,disabled:s}),{...e,droppable:{...e.droppable,containers:a}}}case L.UnregisterDroppable:{const{id:n,key:r}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const o=new Xe(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function xs(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:s}=l.useContext(mt),o=Nt(r),a=Nt(n==null?void 0:n.id);return l.useEffect(()=>{if(!t&&!r&&o&&a!=null){if(!Lt(o)||document.activeElement===o.target)return;const c=s.get(a);if(!c)return;const{activatorNode:d,node:u}=c;if(!d.current&&!u.current)return;requestAnimationFrame(()=>{for(const p of[d.current,u.current]){if(!p)continue;const f=lr(p);if(f){f.focus();break}}})}},[r,t,s,a,o]),null}function ys(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((s,o)=>o({transform:s,...r}),n):n}function ws(e){return l.useMemo(()=>({draggable:{...at.draggable,...e==null?void 0:e.draggable},droppable:{...at.droppable,...e==null?void 0:e.droppable},dragOverlay:{...at.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function Ss(e){let{activeNode:t,measure:n,initialRect:r,config:s=!0}=e;const o=l.useRef(!1),{x:a,y:c}=typeof s=="boolean"?{x:s,y:s}:s;oe(()=>{if(!a&&!c||!t){o.current=!1;return}if(o.current||!r)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const p=n(u),f=wn(p,r);if(a||(f.x=0),c||(f.y=0),o.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const g=Sn(u);g&&g.scrollBy({top:f.y,left:f.x})}},[t,a,c,r,n])}const In=l.createContext({...te,scaleX:1,scaleY:1});var be;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(be||(be={}));const js=l.memo(function(t){var n,r,s,o;let{id:a,accessibility:c,autoScroll:d=!0,children:u,sensors:p=ps,collisionDetection:f=Rr,measuring:g,modifiers:h,...j}=t;const v=l.useReducer(bs,void 0,vs),[x,S]=v,[y,b]=hr(),[C,N]=l.useState(be.Uninitialized),E=C===be.Initialized,{draggable:{active:R,nodes:D,translate:T},droppable:{containers:I}}=x,A=R!=null?D.get(R):null,B=l.useRef({initial:null,translated:null}),$=l.useMemo(()=>{var z;return R!=null?{id:R,data:(z=A==null?void 0:A.data)!=null?z:hs,rect:B}:null},[R,A]),X=l.useRef(null),[de,m]=l.useState(null),[w,V]=l.useState(null),ie=Ye(j,Object.values(j)),Ae=Ze("DndDescribedBy",a),et=l.useMemo(()=>I.getEnabled(),[I]),K=ws(g),{droppableRects:ae,measureDroppableContainers:xe,measuringScheduled:Te}=ts(et,{dragging:E,dependencies:[T.x,T.y],config:K.droppable}),G=Zr(D,R),tt=l.useMemo(()=>w?Et(w):null,[w]),fe=Qn(),le=ns(G,K.draggable.measure);Ss({activeNode:R!=null?D.get(R):null,config:fe.layoutShiftCompensation,initialRect:le,measure:K.draggable.measure});const M=on(G,K.draggable.measure,le),Ie=on(G?G.parentElement:null),ne=l.useRef({activatorEvent:null,active:null,activeNode:G,collisionRect:null,collisions:null,droppableRects:ae,draggableNodes:D,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ye=I.getNodeFor((n=ne.current.over)==null?void 0:n.id),ce=fs({measure:K.dragOverlay.measure}),we=(r=ce.nodeRef.current)!=null?r:G,Se=E?(s=ce.rect)!=null?s:M:null,Bt=!!(ce.nodeRef.current&&ce.rect),$t=os(Bt?null:M),vt=An(we?Q(we):null),pe=is(E?ye??G:null),nt=us(pe),rt=ys(h,{transform:{x:T.x-$t.x,y:T.y-$t.y,scaleX:1,scaleY:1},activatorEvent:w,active:$,activeNodeRect:M,containerNodeRect:Ie,draggingNodeRect:Se,over:ne.current.over,overlayNodeRect:ce.rect,scrollableAncestors:pe,scrollableAncestorRects:nt,windowRect:vt}),Kt=tt?Ne(tt,T):null,Ut=as(pe),zn=ln(Ut),Fn=ln(Ut,[M]),je=Ne(rt,zn),Ce=Se?_r(Se,rt):null,Oe=$&&Ce?f({active:$,collisionRect:Ce,droppableRects:ae,droppableContainers:et,pointerCoordinates:Kt}
6):null,Qt=jr(Oe,"id"),[he,Xt]=l.useState(null),qn=Bt?rt:Ne(rt,Fn),Bn=Nr(qn,(o=he==null?void 0:he.rect)!=null?o:null,M),bt=l.useRef(null),Vt=l.useCallback((z,Y)=>{let{sensor:W,options:ge}=Y;if(X.current==null)return;const J=D.get(X.current);if(!J)return;const H=z.nativeEvent,re=new W({active:X.current,activeNode:J,event:H,options:ge,context:ne,onAbort(P){if(!D.get(P))return;const{onDragAbort:se}=ie.current,ue={id:P};se==null||se(ue),y({type:"onDragAbort",event:ue})},onPending(P,me,se,ue){if(!D.get(P))return;const{onDragPending:ke}=ie.current,ve={id:P,constraint:me,initialCoordinates:se,offset:ue};ke==null||ke(ve),y({type:"onDragPending",event:ve})},onStart(P){const me=X.current;if(me==null)return;const se=D.get(me);if(!se)return;const{onDragStart:ue}=ie.current,Le={activatorEvent:H,active:{id:me,data:se.data,rect:B}};$e.unstable_batchedUpdates(()=>{ue==null||ue(Le),N(be.Initializing),S({type:L.DragStart,initialCoordinates:P,active:me}),y({type:"onDragStart",event:Le}),m(bt.current),V(H)})},onMove(P){S({type:L.DragMove,coordinates:P})},onEnd:De(L.DragEnd),onCancel:De(L.DragCancel)});bt.current=re;function De(P){return async function(){const{active:se,collisions:ue,over:Le,scrollAdjustedTranslate:ke}=ne.current;let ve=null;if(se&&ke){const{cancelDrop:Pe}=ie.current;ve={activatorEvent:H,active:se,collisions:ue,delta:ke,over:Le},P===L.DragEnd&&typeof Pe=="function"&&await Promise.resolve(Pe(ve))&&(P=L.DragCancel)}X.current=null,$e.unstable_batchedUpdates(()=>{S({type:P}),N(be.Uninitialized),Xt(null),m(null),V(null),bt.current=null;const Pe=P===L.DragEnd?"onDragEnd":"onDragCancel";if(ve){const xt=ie.current[Pe];xt==null||xt(ve),y({type:Pe,event:ve})}})}}},[D]),$n=l.useCallback((z,Y)=>(W,ge)=>{const J=W.nativeEvent,H=D.get(ge);if(X.current!==null||!H||J.dndKit||J.defaultPrevented)return;const re={active:H};z(W,Y.options,re)===!0&&(J.dndKit={capturedBy:Y.sensor},X.current=ge,Vt(W,Y))},[D,Vt]),Yt=es(p,$n);ls(p),oe(()=>{M&&C===be.Initializing&&N(be.Initialized)},[M,C]),l.useEffect(()=>{const{onDragMove:z}=ie.current,{active:Y,activatorEvent:W,collisions:ge,over:J}=ne.current;if(!Y||!W)return;const H={active:Y,activatorEvent:W,collisions:ge,delta:{x:je.x,y:je.y},over:J};$e.unstable_batchedUpdates(()=>{z==null||z(H),y({type:"onDragMove",event:H})})},[je.x,je.y]),l.useEffect(()=>{const{active:z,activatorEvent:Y,collisions:W,droppableContainers:ge,scrollAdjustedTranslate:J}=ne.current;if(!z||X.current==null||!Y||!J)return;const{onDragOver:H}=ie.current,re=ge.get(Qt),De=re&&re.rect.current?{id:re.id,rect:re.rect.current,data:re.data,disabled:re.disabled}:null,P={active:z,activatorEvent:Y,collisions:W,delta:{x:J.x,y:J.y},over:De};$e.unstable_batchedUpdates(()=>{Xt(De),H==null||H(P),y({type:"onDragOver",event:P})})},[Qt]),oe(()=>{ne.current={activatorEvent:w,active:$,activeNode:G,collisionRect:Ce,collisions:Oe,droppableRects:ae,draggableNodes:D,draggingNode:we,draggingNodeRect:Se,droppableContainers:I,over:he,scrollableAncestors:pe,scrollAdjustedTranslate:je},B.current={initial:Se,translated:Ce}},[$,G,Oe,Ce,D,we,Se,ae,I,he,pe,je]),Hr({...fe,delta:T,draggingRect:Ce,pointerCoordinates:Kt,scrollableAncestors:pe,scrollableAncestorRects:nt});const Kn=l.useMemo(()=>({active:$,activeNode:G,activeNodeRect:M,activatorEvent:w,collisions:Oe,containerNodeRect:Ie,dragOverlay:ce,draggableNodes:D,droppableContainers:I,droppableRects:ae,over:he,measureDroppableContainers:xe,scrollableAncestors:pe,scrollableAncestorRects:nt,measuringConfiguration:K,measuringScheduled:Te,windowRect:vt}),[$,G,M,w,Oe,Ie,ce,D,I,ae,he,xe,pe,nt,K,Te,vt]),Un=l.useMemo(()=>({activatorEvent:w,activators:Yt,active:$,activeNodeRect:M,ariaDescribedById:{draggable:Ae},dispatch:S,draggableNodes:D,over:he,measureDroppableContainers:xe}),[w,Yt,$,M,S,Ae,D,he,xe]);return U.createElement(yn.Provider,{value:b},U.createElement(mt.Provider,{value:Un},U.createElement(Tn.Provider,{value:Kn},U.createElement(In.Provider,{value:Bn},u)),U.createElement(xs,{disabled:(c==null?void 0:c.restoreFocus)===!1})),U.createElement(vr,{...c,hiddenTextDescribedById:Ae}));function Qn(){const z=(de==null?void 0:de.autoScrollEnabled)===!1,Y=typeof d=="object"?d.enabled===!1:d===!1,W=E&&!z&&!Y;return typeof d=="object"?{...d,enabled:W}:{enabled:W}}}),Cs=l.createContext(null),un="button",Ds="Draggable";function Rs(e){let{id:t,data:n,disabled:r=!1,attributes:s}=e;const o=Ze(Ds),{activators:a,activatorEvent:c,active:d,activeNodeRect:u,ariaDescribedById:p,draggableNodes:f,over:g}=l.useContext(mt),{role:h=un,roleDescription:j="draggable",tabIndex:v=0}=s??{},x=(d==null?void 0:d.id)===t,S=l.useContext(x?In:Cs),[y,b]=ct(),[C,N]=ct(),E=cs(a,t),R=Ye(n);oe(()=>(f.set(t,{id:t,key:o,node:y,activatorNode:C,data:R}),()=>{const T=f.get(t);T&&T.key===o&&f.delete(t)}),[f,t]);const D=l.useMemo(()=>({role:h,tabIndex:v,"aria-disabled":r,"aria-pressed":x&&h===un?!0:void 0,"aria-roledescription":j,"aria-describedby":p.draggable}),[r,h,v,x,j,p.draggable]);return{active:d,activatorEvent:c,activeNodeRect:u,attributes:D,isDragging:x,listeners:r?void 0:E,node:y,over:g,setNodeRef:b,setActivatorNodeRef:N,transform:S}}function Ns(){return l.useContext(Tn)}const Es="Droppable",_s={timeout:25};function Ms(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:s}=e;const o=Ze(Es),{active:a,dispatch:c,over:d,measureDroppableContainers:u}=l.useContext(mt),p=l.useRef({disabled:n}),f=l.useRef(!1),g=l.useRef(null),h=l.useRef(null),{disabled:j,updateMeasurementsFor:v,timeout:x}={..._s,...s},S=Ye(v??r),y=l.useCallback(()=>
6{if(!f.current){f.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(S.current)?S.current:[S.current]),h.current=null},x)},[x]),b=gt({callback:y,disabled:j||!a}),C=l.useCallback((D,T)=>{b&&(T&&(b.unobserve(T),f.current=!1),D&&b.observe(D))},[b]),[N,E]=ct(C),R=Ye(t);return l.useEffect(()=>{!b||!N.current||(b.disconnect(),f.current=!1,b.observe(N.current))},[N,b]),l.useEffect(()=>(c({type:L.RegisterDroppable,element:{id:r,key:o,disabled:n,node:N,rect:g,data:R}}),()=>c({type:L.UnregisterDroppable,key:o,id:r})),[r]),l.useEffect(()=>{n!==p.current.disabled&&(c({type:L.SetDroppableDisabled,id:r,key:o,disabled:n}),p.current.disabled=n)},[r,o,n,c]),{active:a,rect:g,isOver:(d==null?void 0:d.id)===r,node:N,over:d,setNodeRef:E}}function qt(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function As(e,t){return e.reduce((n,r,s)=>{const o=t.get(r);return o&&(n[s]=o),n},Array(e.length))}function ot(e){return e!==null&&e>=0}function Ts(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Is(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const On=e=>{let{rects:t,activeIndex:n,overIndex:r,index:s}=e;const o=qt(t,r,n),a=t[s],c=o[s];return!c||!a?null:{x:c.left-a.left,y:c.top-a.top,scaleX:c.width/a.width,scaleY:c.height/a.height}},it={scaleX:1,scaleY:1},Os=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:s,rects:o,overIndex:a}=e;const c=(t=o[n])!=null?t:r;if(!c)return null;if(s===n){const u=o[a];return u?{x:0,y:n<a?u.top+u.height-(c.top+c.height):u.top-c.top,...it}:null}const d=Ls(o,s,n);return s>n&&s<=a?{x:0,y:-c.height-d,...it}:s<n&&s>=a?{x:0,y:c.height+d,...it}:{x:0,y:0,...it}};function Ls(e,t,n){const r=e[t],s=e[t-1],o=e[t+1];return r?n<t?s?r.top-(s.top+s.height):o?o.top-(r.top+r.height):0:o?o.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const Ln="Sortable",kn=U.createContext({activeIndex:-1,containerId:Ln,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:On,disabled:{draggable:!1,droppable:!1}});function ks(e){let{children:t,id:n,items:r,strategy:s=On,disabled:o=!1}=e;const{active:a,dragOverlay:c,droppableRects:d,over:u,measureDroppableContainers:p}=Ns(),f=Ze(Ln,n),g=c.rect!==null,h=l.useMemo(()=>r.map(E=>typeof E=="object"&&"id"in E?E.id:E),[r]),j=a!=null,v=a?h.indexOf(a.id):-1,x=u?h.indexOf(u.id):-1,S=l.useRef(h),y=!Ts(h,S.current),b=x!==-1&&v===-1||y,C=Is(o);oe(()=>{y&&j&&p(h)},[y,h,j,p]),l.useEffect(()=>{S.current=h},[h]);const N=l.useMemo(()=>({activeIndex:v,containerId:f,disabled:C,disableTransforms:b,items:h,overIndex:x,useDragOverlay:g,sortedRects:As(h,d),strategy:s}),[v,f,C.draggable,C.droppable,b,h,x,d,g,s]);return U.createElement(kn.Provider,{value:N},t)}const Ps=e=>{let{id:t,items:n,activeIndex:r,overIndex:s}=e;return qt(n,r,s).indexOf(t)},zs=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:s,items:o,newIndex:a,previousItems:c,previousContainerId:d,transition:u}=e;return!u||!r||c!==o&&s===a?!1:n?!0:a!==s&&t===d},Fs={duration:200,easing:"ease"},Pn="transform",qs=We.Transition.toString({property:Pn,duration:0,easing:"linear"}),Bs={roleDescription:"sortable"};function $s(e){let{disabled:t,index:n,node:r,rect:s}=e;const[o,a]=l.useState(null),c=l.useRef(n);return oe(()=>{if(!t&&n!==c.current&&r.current){const d=s.current;if(d){const u=Me(r.current,{ignoreTransform:!0}),p={x:d.left-u.left,y:d.top-u.top,scaleX:d.width/u.width,scaleY:d.height/u.height};(p.x||p.y)&&a(p)}}n!==c.current&&(c.current=n)},[t,n,r,s]),l.useEffect(()=>{o&&a(null)},[o]),o}function Ks(e){let{animateLayoutChanges:t=zs,attributes:n,disabled:r,data:s,getNewIndex:o=Ps,id:a,strategy:c,resizeObserverConfig:d,transition:u=Fs}=e;const{items:p,containerId:f,activeIndex:g,disabled:h,disableTransforms:j,sortedRects:v,overIndex:x,useDragOverlay:S,strategy:y}=l.useContext(kn),b=Us(r,h),C=p.indexOf(a),N=l.useMemo(()=>({sortable:{containerId:f,index:C,items:p},...s}),[f,s,C,p]),E=l.useMemo(()=>p.slice(p.indexOf(a)),[p,a]),{rect:R,node:D,isOver:T,setNodeRef:I}=Ms({id:a,data:N,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...d}}),{active:A,activatorEvent:B,activeNodeRect:$,attributes:X,setNodeRef:de,listeners:m,isDragging:w,over:V,setActivatorNodeRef:ie,transform:Ae}=Rs({id:a,data:N,attributes:{...Bs,...n},disabled:b.draggable}),et=sr(I,de),K=!!A,ae=K&&!j&&ot(g)&&ot(x),xe=!S&&w,Te=xe&&ae?Ae:null,tt=ae?Te??(c??y)({rects:v,activeNodeRect:$,activeIndex:g,overIndex:x,index:C}):null,fe=ot(g)&&ot(x)?o({id:a,items:p,activeIndex:g,overIndex:x}):C,le=A==null?void 0:A.id,M=l.useRef({activeId:le,items:p,newIndex:fe,containerId:f}),Ie=p!==M.current.items,ne=t({active:A,containerId:f,isDragging:w,isSorting:K,id:a,index:C,items:p,newIndex:M.current.newIndex,previousItems:M.current.items,previousContainerId:M.current.containerId,transition:u,wasDragging:
6M.current.activeId!=null}),ye=$s({disabled:!ne,index:C,node:D,rect:R});return l.useEffect(()=>{K&&M.current.newIndex!==fe&&(M.current.newIndex=fe),f!==M.current.containerId&&(M.current.containerId=f),p!==M.current.items&&(M.current.items=p)},[K,fe,f,p]),l.useEffect(()=>{if(le===M.current.activeId)return;if(le!=null&&M.current.activeId==null){M.current.activeId=le;return}const we=setTimeout(()=>{M.current.activeId=le},50);return()=>clearTimeout(we)},[le]),{active:A,activeIndex:g,attributes:X,data:N,rect:R,index:C,newIndex:fe,items:p,isOver:T,isSorting:K,isDragging:w,listeners:m,node:D,overIndex:x,over:V,setNodeRef:et,setActivatorNodeRef:ie,setDroppableNodeRef:I,setDraggableNodeRef:de,transform:ye??tt,transition:ce()};function ce(){if(ye||Ie&&M.current.newIndex===C)return qs;if(!(xe&&!Lt(B)||!u)&&(K||ne))return We.Transition.toString({...u,property:Pn})}}function Us(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}_.Down,_.Right,_.Up,_.Left;const Qs=[{value:"intro",label:"Intro"},{value:"content",label:"Content"},{value:"ad_break",label:"Ad Break"},{value:"sponsor_read",label:"Sponsor Read"},{value:"outro",label:"Outro"},{value:"transition",label:"Transition"},{value:"custom",label:"Custom"}];function Xs({projectId:e,segments:t}){const[n,r]=l.useState(t),{toast:s}=pt(),o=dn();l.useEffect(()=>{r(t)},[t]);const a=xr(br(Ft,{activationConstraint:{distance:5}})),c=ee({mutationFn:async g=>{const h=g.map((x,S)=>O.from("pp_timeline_segments").update({sort_order:S}).eq("id",x.id)),v=(await Promise.all(h)).find(x=>x.error);if(v!=null&&v.error)throw v.error},onSuccess:()=>o.invalidateQueries({queryKey:["pp-segments",e]}),onError:g=>s({title:"Reorder failed",description:g.message,variant:"destructive"})}),d=ee({mutationFn:async g=>{const{id:h,...j}=g,{error:v}=await O.from("pp_timeline_segments").update(j).eq("id",h);if(v)throw v},onSuccess:()=>o.invalidateQueries({queryKey:["pp-segments",e]})}),u=ee({mutationFn:async g=>{const{error:h}=await O.from("pp_timeline_segments").delete().eq("id",g);if(h)throw h},onSuccess:()=>o.invalidateQueries({queryKey:["pp-segments",e]})}),p=ee({mutationFn:async()=>{const{error:g}=await O.from("pp_timeline_segments").insert({project_id:e,segment_type:"content",label:"New segment",sort_order:n.length});if(g)throw g},onSuccess:()=>o.invalidateQueries({queryKey:["pp-segments",e]})}),f=g=>{const{active:h,over:j}=g;if(!j||h.id===j.id)return;const v=n.findIndex(y=>y.id===h.id),x=n.findIndex(y=>y.id===j.id),S=qt(n,v,x);r(S),c.mutate(S)};return i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"Drag to reorder. Click a row to edit its type, label, or timing."}),i.jsxs(q,{size:"sm",onClick:()=>p.mutate(),children:[i.jsx(mn,{className:"h-4 w-4 mr-2"})," Add segment"]})]}),n.length?i.jsx(js,{sensors:a,collisionDetection:Cr,onDragEnd:f,children:i.jsx(ks,{items:n.map(g=>g.id),strategy:Os,children:i.jsx("div",{className:"space-y-2",children:n.map(g=>i.jsx(Vs,{segment:g,onUpdate:h=>d.mutate({id:g.id,...h}),onDelete:()=>u.mutate(g.id)},g.id))})})}):i.jsx(F,{className:"p-6 text-sm text-muted-foreground text-center",children:"No segments yet — run AI analysis to populate, or add manually."})]})}function Vs({segment:e,onUpdate:t,onDelete:n}){var x,S;const{attributes:r,listeners:s,setNodeRef:o,transform:a,transition:c,isDragging:d}=Ks({id:e.id}),[u,p]=l.useState(e.label??""),[f,g]=l.useState(((x=e.source_start_seconds)==null?void 0:x.toString())??""),[h,j]=l.useState(((S=e.source_end_seconds)==null?void 0:S.toString())??"");l.useEffect(()=>p(e.label??""),[e.label]);const v={transform:We.Transform.toString(a),transition:c,opacity:d?.5:1};return i.jsxs(F,{ref:o,style:v,className:"p-3 flex items-center gap-3",children:[i.jsx("button",{...r,...s,className:"cursor-grab text-muted-foreground hover:text-foreground touch-none",children:i.jsx(Jn,{className:"h-4 w-4"})}),i.jsx(lt,{variant:"outline",className:"capitalize shrink-0 w-28 justify-center",children:i.jsxs(fn,{value:e.segment_type,onValueChange:y=>t({segment_type:y}),children:[i.jsx(pn,{className:"border-0 h-auto p-0 bg-transparent text-xs uppercase",children:i.jsx(hn,{})}),i.jsx(gn,{children:Qs.map(y=>i.jsx(Rt,{value:y.value,children:y.label},y.value))})]})}),i.jsx(Ke,{value:u,onChange:y=>p(y.target.value),onBlur:()=>u!==e.label&&t({label:u}),placeholder:"Label",className:"flex-1"}),i.jsx(Ke,{type:"number",value:f,onChange:y=>g(y.target.value),onBlur:()=>t({source_start_seconds:f?Number(f):null}),placeholder:"Start (s)",className:"w-24"}),i.jsx(Ke,{type:"number",value:h,onChange:y=>j(y.target.value),onBlur:()=>t({source_end_seconds:h?Number(h):null}),placeholder:"End (s)",className:"w-24"}),i.jsx(q,{variant:"ghost",size:"icon",onClick:n,className:"text-muted-foreground hover:text-destructive",children:i.jsx(vn,{className:"h-4 w-4"})})]})}const Ys=[{value:"intro",label:"Intro"},{value:"outro",label:"Outro"},{value:"sponsor_read",label:"Sponsor Read"},{value:"transition",label:"Transition"},{value:"custom",label:"Custom"}];function Ws({projectId:e,assets:t,onChange:n}){const{toast:r}=pt(),[s,o]=l.useState("intro"),[a,c]=l.useState(""),[d,u]=l.useState(!1),p=async()=>{u(!0);try{const{error:f}=await O.from("pp_voice_assets").insert({project_id:e,asset_type:s,script_text:a||`${s.replace("_"," ")} (host recording)`,status:"pending"});if(f)throw f;c(""),r({title:"Slot created"}),n()}catch(f){r({title:"Failed",description:f instanceof Error?f.message:"Unknown",variant:"destructive"})}finally{u(!1)}};return i.jsxs("div",{className:"space-y-3",children:[i.jsxs(F,{className:"p-4 space-y-3",children:[i.jsx("div",{className:"font-medium text-sm",children:"Add a recording slot"}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[160px_1fr_auto] gap-2 items-end",children:[i.jsxs("div",{children:[i.jsx(Wt,{className:"text-xs",children:"Type"}),i.jsx("select",{className:"w-full h-9 px-2 rounded-md border border-input bg-background text-sm",value:s,onChange:f=>o(f.target.value),children:Ys.map(f=>i.jsx("option",{value:f.value,children:f.label},f.value))})]}),i.jsxs("div",{children:[i.jsx(Wt,{className:"text-xs",children:"Script / note (optional)"}),i.jsx(Ke,{value:a,onChange:f=>c(f.target.value),placeholder:"What D.O.L. should say…"})]}),i.jsx(q,{onClick:p,disabled:d,size:"sm",children:d?i.jsx(Ve,{className:"h-4 w-4 animate-spin"}):i.jsxs(i.Fragment,{children:[i.jsx(mn,{className:"h-4 w-4 mr-1"})," Add"]})})]})]}),t.length?t.map(f=>i.jsx(Hs,{asset:f,projectId:e,onChange:n},f.id)):i.jsx(F,{className:"p-6 text-sm text-muted-foreground text-center",children:"No recording slots yet. Add one above, then upload D.O.L.'s MP3."})]})}function Hs({asset:e,projectId:t,onChange:n}){const{toast:r}=pt(),s=l.useRef(null),[o,a]=l.useState(!1),c=async u=>{a(!0);try{const p=u.name.split(".").pop()||"mp3",f=`${t}/host/${e.asset_type}-${e.id}.${p}`,{error:g}=await O.storage.from("post-production").upload(f,u,{contentType:u.type||"audio/mpeg",upsert:!0});if(g)throw g;const{data:h}=O.storage.from("post-production").getPublicUrl(f),{error:j}=await O.from("pp_voice_assets").update({audio_url:h.publicUrl,status:"ready",voice_model:"host_recording",voice_id:null,error_message:null}).eq("id",e.id);if(j)throw j;r({title:"Recording uploaded"}),n()}catch(p){r({title:"Upload failed",description:p instanceof Error?p.message:"Unknown",variant:"destructive"})}finally{a(!1),s.current&&(s.current.value="")}},d=async()=>
6{if(confirm("Remove this recording slot?"))try{const{error:u}=await O.from("pp_voice_assets").delete().eq("id",e.id);if(u)throw u;r({title:"Removed"}),n()}catch(u){r({title:"Failed",description:u instanceof Error?u.message:"Unknown",variant:"destructive"})}};return i.jsxs(F,{className:"p-4 space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("div",{className:"font-medium capitalize",children:e.asset_type.replace("_"," ")}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(lt,{variant:e.status==="ready"?"default":e.status==="failed"?"destructive":"secondary",children:e.status}),i.jsx(q,{variant:"ghost",size:"sm",onClick:d,children:i.jsx(vn,{className:"h-4 w-4"})})]})]}),e.script_text&&i.jsx("div",{className:"text-sm whitespace-pre-wrap text-muted-foreground",children:e.script_text}),e.audio_url?i.jsx("audio",{src:e.audio_url,controls:!0,className:"w-full"}):i.jsx("div",{className:"text-xs text-muted-foreground",children:"No recording uploaded yet."}),i.jsxs("div",{children:[i.jsx("input",{ref:s,type:"file",accept:"audio/*",className:"hidden",onChange:u=>{var f;const p=(f=u.target.files)==null?void 0:f[0];p&&c(p)}}),i.jsxs(q,{variant:"outline",size:"sm",onClick:()=>{var u;return(u=s.current)==null?void 0:u.click()},disabled:o,children:[o?i.jsx(Ve,{className:"h-4 w-4 animate-spin mr-2"}):i.jsx(Zn,{className:"h-4 w-4 mr-2"}),e.audio_url?"Replace audio":"Upload audio"]})]}),e.error_message&&i.jsx("div",{className:"text-xs text-destructive",children:e.error_message})]})}const Gs=l.lazy(()=>Vn(()=>import("./BrowserRenderer-B1mN2QCW.js"),__vite__mapDeps([0,1,2,3,4,5])).then(e=>({default:e.BrowserRenderer}))),Js={draft:"Draft",transcribing:"Transcribing",analyzing:"Analyzing",scripting:"Scripting",voicing:"Voicing",rendering:"Rendering",complete:"Complete",failed:"Failed"};function Zo(){var N,E,R,D,T,I,A,B,$,X,de;const{projectId:e=""}=Yn(),{toast:t}=pt(),n=dn(),[r,s]=l.useState(""),o=Re({queryKey:["pp-project",e],queryFn:async()=>{const{data:m,error:w}=await O.from("post_production_projects").select("*").eq("id",e).single();if(w)throw w;return m},enabled:!!e,refetchInterval:m=>{var V;const w=(V=m.state.data)==null?void 0:V.status;return w&&["transcribing","analyzing","scripting","voicing","rendering"].includes(w)?4e3:!1}}),a=Re({queryKey:["pp-transcript",e],queryFn:async()=>{const{data:m,error:w}=await O.from("pp_transcripts").select("*").eq("project_id",e).maybeSingle();if(w)throw w;return m},enabled:!!e}),c=Re({queryKey:["pp-segments",e],queryFn:async()=>{const{data:m,error:w}=await O.from("pp_timeline_segments").select("*").eq("project_id",e).order("sort_order",{ascending:!0});if(w)throw w;return m},enabled:!!e}),d=Re({queryKey:["pp-voice",e],queryFn:async()=>{const{data:m,error:w}=await O.from("pp_voice_assets").select("*").eq("project_id",e).order("created_at",{ascending:!0});if(w)throw w;return m},enabled:!!e}),u=Re({queryKey:["pp-render",e],queryFn:async()=>{const{data:m,error:w}=await O.from("pp_render_jobs").select("*").eq("project_id",e).order("created_at",{ascending:!1}).limit(5);if(w)throw w;return m},enabled:!!e,refetchInterval:5e3}),p=Re({queryKey:["pp-link-episodes"],queryFn:async()=>{const{data:m,error:w}=await O.from("podcast_episodes").select("id,title,episode_number,status,published_at,created_at").order("created_at",{ascending:!1}).limit(100);if(w)throw w;return m}}),f=ee({mutationFn:async m=>{const{error:w}=await O.from("post_production_projects").update({episode_id:m}).eq("id",e);if(w)throw w},onSuccess:()=>{t({title:"Episode link updated"}),n.invalidateQueries({queryKey:["pp-project",e]})},onError:m=>t({title:"Could not link episode",description:m.message,variant:"destructive"})}),g=ee({mutationFn:async m=>{const{error:w}=await O.from("post_production_projects").update({source_audio_url:m}).eq("id",e);if(w)throw w},onSuccess:()=>{t({title:"Audio source set"}),s(""),n.invalidateQueries({queryKey:["pp-project",e]})}}),h=async m=>{const{data:w,error:V}=await O.functions.invoke(m,{body:{projectId:e}});if(V)throw V;if(w!=null&&w.error)throw new Error(w.error);return w},j=ee({mutationFn:()=>h("pp-transcribe"),onSuccess:()=>{t({title:"Transcription started"}),n.invalidateQueries({queryKey:["pp-project",e]})},onError:m=>t({title:"Transcribe failed",description:m.message,variant:"destructive"})}),v=ee({mutationFn:()=>h("pp-analyze"),onSuccess:()=>
6{t({title:"Analysis started — timeline will populate"}),n.invalidateQueries({queryKey:["pp-project",e]}),n.invalidateQueries({queryKey:["pp-segments",e]})},onError:m=>t({title:"Analyze failed",description:m.message,variant:"destructive"})}),x=ee({mutationFn:()=>h("pp-generate-scripts"),onSuccess:()=>{t({title:"Scripts generated"}),n.invalidateQueries({queryKey:["pp-voice",e]}),n.invalidateQueries({queryKey:["pp-project",e]})},onError:m=>t({title:"Script gen failed",description:m.message,variant:"destructive"})}),S=ee({mutationFn:()=>h("pp-generate-voice"),onSuccess:m=>{t({title:(m==null?void 0:m.message)??"Voice generation started"}),n.invalidateQueries({queryKey:["pp-voice",e]})},onError:m=>t({title:"Voice gen failed",description:m.message,variant:"destructive"})}),y=ee({mutationFn:()=>h("pp-render-dispatch"),onSuccess:()=>{t({title:"Render queued on server"}),n.invalidateQueries({queryKey:["pp-project",e]}),n.invalidateQueries({queryKey:["pp-render",e]})},onError:m=>t({title:"Render failed",description:m.message,variant:"destructive"})});if(o.isLoading)return i.jsx(yt,{children:i.jsx("div",{className:"flex justify-center p-12 text-muted-foreground",children:i.jsx(Ve,{className:"h-6 w-6 animate-spin"})})});const b=o.data;if(!b)return i.jsx(yt,{children:i.jsx("div",{className:"p-12 text-center",children:"Project not found."})});const C=(N=u.data)==null?void 0:N[0];return i.jsx(yt,{children:i.jsxs("div",{className:"max-w-6xl mx-auto space-y-6",children:[i.jsxs("div",{children:[i.jsx(q,{variant:"ghost",size:"sm",asChild:!0,className:"mb-2",children:i.jsxs(st,{to:"/admin/post-production",children:[i.jsx(er,{className:"h-4 w-4 mr-1"})," All projects"]})}),i.jsxs("div",{className:"flex items-start justify-between gap-4 flex-wrap",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"font-display text-3xl font-bold",children:b.title}),b.description&&i.jsx("p",{className:"text-muted-foreground mt-1",children:b.description})]}),i.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[i.jsx(lt,{variant:b.status==="failed"?"destructive":b.status==="complete"?"default":"secondary",children:Js[b.status]}),i.jsxs(fn,{value:b.episode_id??"__none__",onValueChange:m=>f.mutate(m==="__none__"?null:m),disabled:f.isPending||p.isLoading,children:[i.jsx(pn,{className:"h-9 w-[240px]",children:i.jsx(hn,{placeholder:"Link to episode…"})}),i.jsxs(gn,{children:[i.jsx(Rt,{value:"__none__",children:"Not linked"}),(p.data??[]).map(m=>i.jsxs(Rt,{value:m.id,children:[m.episode_number?`#${m.episode_number} · `:"",m.title]},m.id))]})]}),b.episode_id&&i.jsxs(i.Fragment,{children:[i.jsx(q,{asChild:!0,size:"sm",variant:"outline",children:i.jsxs(st,{to:`/admin/post-production/${e}/edit`,children:[i.jsx(Ht,{className:"h-4 w-4 mr-1"})," Open Editor"]})}),i.jsx(q,{asChild:!0,size:"sm",variant:"outline",children:i.jsxs(st,{to:`/admin/post-production/${e}/timeline-preview`,children:[i.jsx(qe,{className:"h-4 w-4 mr-1"})," Timeline Preview"]})}),i.jsx(q,{asChild:!0,size:"sm",className:"bg-accent text-accent-foreground hover:bg-accent/90",children:i.jsxs(st,{to:`/admin/post-production/${e}/editor`,children:[i.jsx(Ht,{className:"h-4 w-4 mr-1"})," Open Studio Editor"]})})]})]})]}),b.error_message&&i.jsxs(F,{className:"mt-3 p-3 bg-destructive/5 border-destructive/30 text-sm flex gap-2",children:[i.jsx(tr,{className:"h-4 w-4 text-destructive shrink-0 mt-0.5"}),i.jsxs("div",{children:[i.jsx("div",{className:"font-medium text-destructive",children:"Error"}),i.jsx("div",{className:"text-muted-foreground",children:b.error_message})]})]})]}),!b.source_audio_url&&i.jsxs(F,{className:"p-4 space-y-3",children:[i.jsxs("div",{className:"font-medium flex items-center gap-2",children:[i.jsx(Gt,{className:"h-4 w-4"})," Add source audio"]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Paste a URL to the raw recording (MP3, WAV, or M4A). It must be publicly accessible."}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Ke,{placeholder:"https://…/recording.mp3",value:r,onChange:m=>s(m.target.value)}),i.jsx(q,{onClick:()=>g.mutate(r),disabled:!r.trim()||g.isPending,children:"Set audio"})]})]}),i.jsxs(Wn,{defaultValue:"pipeline",children:[i.jsxs(Hn,{children:[i.jsx(ze,{value:"pipeline",children:"Pipeline"}),i.jsx(ze,{value:"transcript",children:"Transcript"}),i.jsx(ze,{value:"timeline",children:"Timeline"}),i.jsx(ze,{value:"voice",children:"Talent Audio"}),i.jsx(ze,{value:"render",children:"Render"})]}),i.jsxs(Fe,{value:"pipeline",className:"space-y-4 pt-4",children:[i.jsxs(F,{className:"p-4 space-y-4",children:[i.jsx(Be,{icon:Gt,title:"1. Transcribe",description:"Generate a timestamped transcript from the source audio using AI.",ready:!!b.source_audio_url,done:!!((E=a.data)!=null&&E.full_text),running:b.status==="transcribing"||j.isPending,onRun:()=>j.mutate()}),i.jsx(Be,{icon:nr,title:"2. Analyze",description:"AI identifies cuts, ad break points, key moments, and stumbles.",ready:!!((R=a.data)!=null&&R.full_text),done:!!((D=c.data)!=null&&D.length),running:b.status==="analyzing"||v.isPending,onRun:()=>v.mutate()}),i.jsx(Be,{icon:Xn,title:"3. Generate scripts",description:"AI writes intro, outro, and sponsor read scripts.",ready:!!((T=c.data)!=null&&T.length),done:!!((I=d.data)!=null&&I.length),running:b.status==="scripting"||x.isPending,onRun:()=>x.mutate()}),i.jsx(Be,{icon:rr,title:"4. Talent Audio",description:"Producer uploads D.O.L.'s recorded intros, outros, and sponsor reads 
6into the timeline. (ElevenLabs auto-generation available later if enabled.)",ready:!!((A=d.data)!=null&&A.length),done:!!((B=d.data)!=null&&B.every(m=>m.status==="ready")),running:b.status==="voicing"||S.isPending,onRun:()=>S.mutate()}),i.jsx(Be,{icon:qe,title:"5. Render MP4",description:"Stitch segments into a podcast-style MP4 with waveform + sponsor cards.",ready:!!(($=c.data)!=null&&$.length),done:b.status==="complete"&&!!b.output_url,running:b.status==="rendering"||y.isPending,onRun:()=>y.mutate()})]}),b.output_url&&i.jsxs(F,{className:"p-4",children:[i.jsxs("div",{className:"font-medium mb-2 flex items-center gap-2",children:[i.jsx(qe,{className:"h-4 w-4"})," Finished episode"]}),i.jsx("video",{src:b.output_url,controls:!0,className:"w-full rounded bg-black"}),i.jsx(q,{asChild:!0,variant:"outline",size:"sm",className:"mt-3",children:i.jsxs("a",{href:b.output_url,download:!0,children:[i.jsx(wt,{className:"h-4 w-4 mr-2"})," Download MP4"]})})]})]}),i.jsx(Fe,{value:"transcript",className:"pt-4",children:i.jsx(F,{className:"p-4",children:(X=a.data)!=null&&X.full_text?i.jsx(Gn,{readOnly:!0,value:a.data.full_text,rows:20,className:"font-mono text-xs"}):i.jsx("p",{className:"text-sm text-muted-foreground",children:"No transcript yet — run step 1."})})}),i.jsx(Fe,{value:"timeline",className:"pt-4",children:i.jsx(Xs,{projectId:e,segments:c.data??[]})}),i.jsx(Fe,{value:"voice",className:"space-y-3 pt-4",children:i.jsx(Ws,{projectId:e,assets:d.data??[],onChange:()=>n.invalidateQueries({queryKey:["pp-voice",e]})})}),i.jsxs(Fe,{value:"render",className:"space-y-3 pt-4",children:[i.jsxs(F,{className:"p-4 space-y-3",children:[i.jsx("div",{className:"font-medium text-sm",children:"Render engine"}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("select",{className:"h-9 px-2 rounded-md border border-input bg-background text-sm",value:b.render_engine,onChange:async m=>{const w=m.target.value,{error:V}=await O.from("post_production_projects").update({render_engine:w}).eq("id",e);V?t({title:"Update failed",description:V.message,variant:"destructive"}):n.invalidateQueries({queryKey:["pp-project",e]})},children:[i.jsx("option",{value:"browser",children:"Browser (ffmpeg.wasm — fallback)"}),i.jsx("option",{value:"server",children:"Server (Render.com worker — recommended)"})]}),b.render_engine==="server"&&i.jsx("span",{className:"text-xs text-muted-foreground",children:"Renders MP3 + MP4 on the external worker."})]})]}),b.render_engine==="server"&&i.jsxs(F,{className:"p-4 space-y-3",children:[i.jsxs("div",{className:"font-medium flex items-center gap-2",children:[i.jsx(qe,{className:"h-4 w-4"})," Server render"]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:"Dispatches the render job to the Render.com worker. Status updates appear below."}),i.jsxs(q,{onClick:()=>y.mutate(),disabled:y.isPending||!b.source_audio_url||(C==null?void 0:C.status)==="running"||(C==null?void 0:C.status)==="queued",children:[y.isPending?i.jsx(Ve,{className:"h-4 w-4 mr-2 animate-spin"}):i.jsx(qe,{className:"h-4 w-4 mr-2"}),"Render Episode"]})]}),b.render_engine==="browser"&&i.jsx(l.Suspense,{fallback:i.jsx(F,{className:"p-6 text-sm text-muted-foreground text-center",children:"Loading renderer…"}),children:i.jsx(Gs,{projectId:e,onComplete:()=>{n.invalidateQueries({queryKey:["pp-project",e]}),n.invalidateQueries({queryKey:["pp-render",e]})}})}),(de=u.data)!=null&&de.length?u.data.map(m=>i.jsxs(F,{className:"p-4 space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-sm",children:new Date(m.created_at).toLocaleString()}),i.jsxs(lt,{variant:m.status==="complete"?"default":m.status==="failed"?"destructive":"secondary",children:[m.status," ",m.status==="running"?`${m.progress_pct}%`:""]})]}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[m.output_url&&i.jsx(q,{asChild:!0,variant:"outline",size:"sm",children:i.jsxs("a",{href:m.output_url,download:!0,children:[i.jsx(wt,{className:"h-4 w-4 mr-2"})," MP3"]})}),m.video_output_url&&i.jsx(q,{asChild:!0,variant:"outline",size:"sm",children:i.jsxs("a",{href:m.video_output_url,download:!0,children:[i.jsx(wt,{className:"h-4 w-4 mr-2"})," MP4"]})})]}),m.error_message&&i.jsx("div",{className:"text-xs text-destructive",children:m.error_message})]},m.id)):i.jsx(F,{className:"p-6 text-sm text-muted-foreground text-center",children:"No renders yet."}),((C==null?void 0:C.status)==="running"||(C==null?void 0:C.status)==="queued")&&i.jsx("p",{className:"text-xs text-muted-foreground",children:"Auto-refreshing every 5s…"})]})]})]})})}function Be({icon:e,title:t,description:n,ready:r,done:s,running:o,onRun:a}){return i.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b border-border last:border-b-0 last:pb-0",children:[i.jsx("div",{className:`mt-0.5 rounded-full p-2 ${s?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"}`,children:i.jsx(e,{className:"h-4 w-4"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("div",{className:"font-medium",children:t}),i.jsx("div",{className:"text-sm text-muted-foreground",children:n})]}),i.jsx(q,{size:"sm",variant:s?"outline":"default",disabled:!r||o,onClick:a,children:o?i.jsx(Ve,{className:"h-4 w-4 animate-spin"}):s?"Re-run":"Run"})]})}
6export{Zo as default};

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.