1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6365],{16786:(e,t,r)=>{"use strict";r.d(t,{uB:()=>E});var s=/[\\\/_+.#"@\[\(\{&]/,l=/[\\\/_+.#"@\[\(\{&]/g,a=/[\s-]/,n=/[\s-]/g;function c(e){return e.toLowerCase().replace(n," ")}var o=r(76198),d=r(14232),i=r(57797),u=r(70294),x=r(10714),p='[cmdk-group=""]',m='[cmdk-group-items=""]',h='[cmdk-item=""]',y=`${h}:not([aria-disabled="true"])`,g="cmdk-item-select",b="data-value",f=(e,t,r)=>(function(e,t,r){return function e(t,r,c,o,d,i,u){if(i===r.length)return d===t.length?1:.99;var x=`${d},${i}`;if(void 0!==u[x])return u[x];for(var p,m,h,y,g=o.charAt(i),b=c.indexOf(g,d),f=0;b>=0;)(p=e(t,r,c,o,b+1,i+1,u))>f&&(b===d?p*=1:s.test(t.charAt(b-1))?(p*=.8,(h=t.slice(d,b-1).match(l))&&d>0&&(p*=Math.pow(.999,h.length))):a.test(t.charAt(b-1))?(p*=.9,(y=t.slice(d,b-1).match(n))&&d>0&&(p*=Math.pow(.999,y.length))):(p*=.17,d>0&&(p*=Math.pow(.999,b-d))),t.charAt(b)!==r.charAt(i)&&(p*=.9999)),(p<.1&&c.charAt(b-1)===o.charAt(i+1)||o.charAt(i+1)===o.charAt(i)&&c.charAt(b-1)!==o.charAt(i))&&.1*(m=e(t,r,c,o,b+1,i+2,u))>p&&(p=.1*m),p>f&&(f=p),b=c.indexOf(g,b+1);return u[x]=f,f}(e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,t,c(e),c(t),0,0,{})})(e,t,r),v=d.createContext(void 0),j=()=>d.useContext(v),N=d.createContext(void 0),S=()=>d.useContext(N),w=d.createContext(void 0),C=d.forwardRef((e,t)=>{let r=D(()=>{var t,r;return{search:"",value:null!=(r=null!=(t=e.value)?t:e.defaultValue)?r:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),s=D(()=>new Set),l=D(()=>new Map),a=D(()=>new Map),n=D(()=>new Set),c=P(e),{label:o,children:x,value:j,onValueChange:S,filter:w,shouldFilter:C,loop:I,disablePointerSelection:T=!1,vimBindings:A=!0,...k}=e,R=(0,u.B)(),M=(0,u.B)(),E=(0,u.B)(),F=d.useRef(null),_=L();O(()=>{if(void 0!==j){let e=j.trim();r.current.value=e,V.emit()}},[j]),O(()=>{_(6,Q)},[]);let V=d.useMemo(()=>({subscribe:e=>(n.current.add(e),()=>n.current.delete(e)),snapshot:()=>r.current,setState:(e,t,s)=>{var l,a,n,o;if(!Object.is(r.current[e],t)){if(r.current[e]=t,"search"===e)q(),H(),_(1,K);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(E);e?e.focus():null==(l=document.getElementById(R))||l.focus()}if(_(7,()=>{var e;r.current.selectedItemId=null==(e=Z())?void 0:e.id,V.emit()}),s||_(5,Q),(null==(a=c.current)?void 0:a.value)!==void 0){null==(o=(n=c.current).onValueChange)||o.call(n,null!=t?t:"");return}}V.emit()}},emit:()=>{n.current.forEach(e=>e())}}),[]),G=d.useMemo(()=>({value:(e,t,s)=>{var l;t!==(null==(l=a.current.get(e))?void 0:l.value)&&(a.current.set(e,{value:t,keywords:s}),r.current.filtered.items.set(e,W(t,s)),_(2,()=>{H(),V.emit()}))},item:(e,t)=>(s.current.add(e),t&&(l.current.has(t)?l.current.get(t).add(e):l.current.set(t,new Set([e]))),_(3,()=>{q(),H(),r.current.value||K(),V.emit()}),()=>{a.current.delete(e),s.current.delete(e),r.current.filtered.items.delete(e);let t=Z();_(4,()=>{q(),(null==t?void 0:t.getAttribute("id"))===e&&K(),V.emit()})}),group:e=>(l.current.has(e)||l.current.set(e,new Set),()=>{a.current.delete(e),l.current.delete(e)}),filter:()=>c.current.shouldFilter,label:o||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:R,inputId:E,labelId:M,listInnerRef:F}),[]);function W(e,t){var s,l;let a=null!=(l=null==(s=c.current)?void 0:s.filter)?l:f;return e?a(e,r.current.search,t):0}function H(){if(!r.current.search||!1===c.current.shouldFilter)return;let e=r.current.filtered.items,t=[];r.current.filtered.groups.forEach(r=>{let s=l.current.get(r),a=0;s.forEach(t=>{a=Math.max(e.get(t),a)}),t.push([r,a])});let s=F.current;$().sort((t,r)=>{var s,l;let a=t.getAttribute("id"),n=r.getAttribute("id");return(null!=(s=e.get(n))?s:0)-(null!=(l=e.get(a))?l:0)}).forEach(e=>{let t=e.closest(m);t?t.appendChild(e.parentElement===t?e:e.closest(`${m} > *`)):s.appendChild(e.parentElement===s?e:e.closest(`${m} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=F.current)?void 0:t.querySelector(`${p}[${b}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function K(){let e=$().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(b);V.setState("value",t||void 0)}function q(){var e,t,n,o;if(!r.current.search||!1===c.current.shouldFilter){r.current.filtered.count=s.current.size;return}r.current.filtered.groups=new Set;let d=0;for(let l of s.current){let s=W(null!=(t=null==(e=a.current.get(l))?void 0:e.value)?t:"",null!=(o=null==(n=a.current.get(l))?void 0:n.keywords)?o:[]);r.current.filtered.items.set(l,s),s>0&&d++}for(let[e,t]of l.current)for(let s of t)if(r.current.filtered.items.get(s)>0){r.current.filtered.groups.add(e);break}r.current.filtered.count=d}function Q(){var e,t,r;let s=Z();s&&((null==(e=s.parentElement)?void 0:e.firstChild)===s&&(null==(r=null==(t=s.closest(p))?void 0:t.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),s.scrollIntoView({block:"nearest"}))}function Z(){var e;return null==(e=F.current)?void 0:e.querySelector(`${h}[aria-selected="true"]`)}function $(){var e;return Array.from((null==(e=F.current)?void 0:e.querySelectorAll(y))||[])}function z(e){let t=$()[e];t&&V.setState("value",t.getAttribute(b))}function X(e){var t;let r=Z(),s=$(),l=s.findIndex(e=>e===r),a=s[l+e];null!=(t=c.current)&&t.loop&&(a=l+e<0?s[s.length-1]:l+e===s.length?s[0]:s[l+e]),a&&V.setState("value",a.getAttribute(b))}function Y(e){let t=Z(),r=null==t?void 0:t.closest(p),s;for(;r&&!s;)s=null==(r=e>0?function(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}(r,p):function(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}(r,p))?void 0:r.querySelector(y);s?V.setState("value",s.getAttribute(b)):X(e)}let J=()=>z($().length-1),ee=e=>
1{e.preventDefault(),e.metaKey?J():e.altKey?Y(1):X(1)},et=e=>{e.preventDefault(),e.metaKey?z(0):e.altKey?Y(-1):X(-1)};return d.createElement(i.sG.div,{ref:t,tabIndex:-1,...k,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=k.onKeyDown)||t.call(k,e);let r=e.nativeEvent.isComposing||229===e.keyCode;if(!(e.defaultPrevented||r))switch(e.key){case"n":case"j":A&&e.ctrlKey&&ee(e);break;case"ArrowDown":ee(e);break;case"p":case"k":A&&e.ctrlKey&&et(e);break;case"ArrowUp":et(e);break;case"Home":e.preventDefault(),z(0);break;case"End":e.preventDefault(),J();break;case"Enter":{e.preventDefault();let t=Z();if(t){let e=new Event(g);t.dispatchEvent(e)}}}}},d.createElement("label",{"cmdk-label":"",htmlFor:G.inputId,id:G.labelId,style:U},o),B(e,e=>d.createElement(N.Provider,{value:V},d.createElement(v.Provider,{value:G},e))))}),I=d.forwardRef((e,t)=>{var r,s;let l=(0,u.B)(),a=d.useRef(null),n=d.useContext(w),c=j(),o=P(e),p=null!=(s=null==(r=o.current)?void 0:r.forceMount)?s:null==n?void 0:n.forceMount;O(()=>{if(!p)return c.item(l,null==n?void 0:n.id)},[p]);let m=_(l,a,[e.value,e.children,a],e.keywords),h=S(),y=F(e=>e.value&&e.value===m.current),b=F(e=>!!p||!1===c.filter()||!e.search||e.filtered.items.get(l)>0);function f(){var e,t;v(),null==(t=(e=o.current).onSelect)||t.call(e,m.current)}function v(){h.setState("value",m.current,!0)}if(d.useEffect(()=>{let t=a.current;if(!(!t||e.disabled))return t.addEventListener(g,f),()=>t.removeEventListener(g,f)},[b,e.onSelect,e.disabled]),!b)return null;let{disabled:N,value:C,onSelect:I,forceMount:T,keywords:A,...k}=e;return d.createElement(i.sG.div,{ref:(0,x.t)(a,t),...k,id:l,"cmdk-item":"",role:"option","aria-disabled":!!N,"aria-selected":!!y,"data-disabled":!!N,"data-selected":!!y,onPointerMove:N||c.getDisablePointerSelection()?void 0:v,onClick:N?void 0:f},e.children)}),T=d.forwardRef((e,t)=>{let{heading:r,children:s,forceMount:l,...a}=e,n=(0,u.B)(),c=d.useRef(null),o=d.useRef(null),p=(0,u.B)(),m=j(),h=F(e=>!!l||!1===m.filter()||!e.search||e.filtered.groups.has(n));O(()=>m.group(n),[]),_(n,c,[e.value,e.heading,o]);let y=d.useMemo(()=>({id:n,forceMount:l}),[l]);return d.createElement(i.sG.div,{ref:(0,x.t)(c,t),...a,"cmdk-group":"",role:"presentation",hidden:!h||void 0},r&&d.createElement("div",{ref:o,"cmdk-group-heading":"","aria-hidden":!0,id:p},r),B(e,e=>d.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?p:void 0},d.createElement(w.Provider,{value:y},e))))}),A=d.forwardRef((e,t)=>{let{alwaysRender:r,...s}=e,l=d.useRef(null),a=F(e=>!e.search);return r||a?d.createElement(i.sG.div,{ref:(0,x.t)(l,t),...s,"cmdk-separator":"",role:"separator"}):null}),k=d.forwardRef((e,t)=>{let{onValueChange:r,...s}=e,l=null!=e.value,a=S(),n=F(e=>e.search),c=F(e=>e.selectedItemId),o=j();return d.useEffect(()=>{null!=e.value&&a.setState("search",e.value)},[e.value]),d.createElement(i.sG.input,{ref:t,...s,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":o.listId,"aria-labelledby":o.labelId,"aria-activedescendant":c,id:o.inputId,type:"text",value:l?e.value:n,onChange:e=>{l||a.setState("search",e.target.value),null==r||r(e.target.value)}})}),R=d.forwardRef((e,t)=>{let{children:r,label:s="Suggestions",...l}=e,a=d.useRef(null),n=d.useRef(null),c=F(e=>e.selectedItemId),o=j();return d.useEffect(()=>{if(n.current&&a.current){let e=n.current,t=a.current,r,s=new ResizeObserver(()=>{r=requestAnimationFrame(()=>{let r=e.offsetHeight;t.style.setProperty("--cmdk-list-height",r.toFixed(1)+"px")})});return s.observe(e),()=>{cancelAnimationFrame(r),s.unobserve(e)}}},[]),d.createElement(i.sG.div,{ref:(0,x.t)(a,t),...l,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":s,id:o.listId},B(e,e=>d.createElement("div",{ref:(0,x.t)(n,o.listInnerRef),"cmdk-list-sizer":""},e)))}),M=d.forwardRef((e,t)=>{let{open:r,onOpenChange:s,overlayClassName:l,contentClassName:a,container:n,...c}=e;return d.createElement(o.bL,{open:r,onOpenChange:s},d.createElement(o.ZL,{container:n},d.createElement(o.hJ,{"cmdk-overlay":"",className:l}),d.createElement(o.UC,{"aria-label":e.label,"cmdk-dialog":"",className:a},d.createElement(C,{ref:t,...c}))))}),E=Object.assign(C,{List:R,Item:I,Input:k,Group:T,Separator:A,Dialog:M,Empty:d.forwardRef((e,t)=>
1F(e=>0===e.filtered.count)?d.createElement(i.sG.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Loading:d.forwardRef((e,t)=>{let{progress:r,children:s,label:l="Loading...",...a}=e;return d.createElement(i.sG.div,{ref:t,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":l},B(e,e=>d.createElement("div",{"aria-hidden":!0},e)))})});function P(e){let t=d.useRef(e);return O(()=>{t.current=e}),t}var O="undefined"==typeof window?d.useEffect:d.useLayoutEffect;function D(e){let t=d.useRef();return void 0===t.current&&(t.current=e()),t}function F(e){let t=S(),r=()=>e(t.snapshot());return d.useSyncExternalStore(t.subscribe,r,r)}function _(e,t,r,s=[]){let l=d.useRef(),a=j();return O(()=>{var n;let c=(()=>{var e;for(let t of r){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():l.current}})(),o=s.map(e=>e.trim());a.value(e,c,o),null==(n=t.current)||n.setAttribute(b,c),l.current=c}),l}var L=()=>{let[e,t]=d.useState(),r=D(()=>new Map);return O(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,s)=>{r.current.set(e,s),t({})}};function B({asChild:e,children:t},r){let s;return e&&d.isValidElement(t)?d.cloneElement("function"==typeof(s=t.type)?s(t.props):"render"in s?s.render(t.props):t,{ref:t.ref},r(t.props.children)):r(t)}var U={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"}},27050:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(48900).A)("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]])},28249:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(48900).A)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},53038:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(48900).A)("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},62560:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/projects/[id]/productionReport/[callSheetGroupId]/[callSheetId]",function(){return r(83978)}])},73640:e=>{function t(e,r=100,s={}){let l,a,n,c,o;if("function"!=typeof e)throw TypeError(`Expected the first parameter to be a function, got \`${typeof e}\`.`);if(r<0)throw RangeError("`wait` must not be negative.");let{immediate:d}="boolean"==typeof s?{immediate:s}:s;function i(){let t=l,r=a;return l=void 0,a=void 0,o=e.apply(t,r)}function u(){let e=Date.now()-c;e<r&&e>=0?n=setTimeout(u,r-e):(n=void 0,d||(o=i()))}let x=function(...e){if(l&&this!==l&&Object.getPrototypeOf(this)===Object.getPrototypeOf(l))throw Error("Debounced method called with different contexts of the same prototype.");l=this,a=e,c=Date.now();let t=d&&!n;return n||(n=setTimeout(u,r)),t&&(o=i()),o};return Object.defineProperty(x,"isPending",{get:()=>void 0!==n}),x.clear=()=>{n&&(clearTimeout(n),n=void 0)},x.flush=()=>{n&&x.trigger()},x.trigger=()=>{o=i(),x.clear()},x}e.exports.debounce=t,e.exports=t},83683:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var s=r(14232);let l=s.forwardRef(function(e,t){let{title:r,titleId:l,...a}=e;return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":l},a),r?s.createElement("title",{id:l},r):null,s.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-7-4a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM9 9a.75.75 0 0 0 0 1.5h.253a.25.25 0 0 1 .244.304l-.459 2.066A1.75 1.75 0 0 0 10.747 15H11a.75.75 0 0 0 0-1.5h-.253a.25.25 0 0 1-.244-.304l.459-2.066A1.75 1.75 0 0 0 9.253 9H9Z",clipRule:"evenodd"}))})},83978:(e,t,r)=>{"use strict";r.r(t),r.d(t,{__N_SSP:()=>e9,default:()=>e7});var s=r(37876),l=r(89099),a=r(36854),n=r(14232),c=r(97685),o=r(98110),d=r(33206),i=r(46293),u=r(21134),x=r(28249),p=r(31188),m=r(42298),h=r(73245),y=r(16843);let g=e=>{let{callSheetId:t,isEditable:r=!0,militaryTime:l}
1=e,[a,c]=(0,n.useState)([]),o=d.F.useUtils(),[g,b]=(0,n.useState)(null),[f,v]=(0,n.useState)(null),[j,N]=(0,n.useState)(null),[S,w]=(0,n.useState)({}),{data:C}=d.F.productionReport.get.useQuery({callsheetId:t},{enabled:!!t});(0,n.useEffect)(()=>{(null==C?void 0:C.background)&&C.background.length>0?c(C.background.map(e=>({id:e.id,prBackgroundId:e.id,name:e.name,count:e.count,arrive:e.arrive,mealOut:e.mealOut,mealIn:e.mealIn,dismiss:e.dismiss,notes:e.notes}))):(null==C?void 0:C.background)&&0===C.background.length&&c([])},[C]);let{mutate:I}=d.F.productionReport.addBackground.useMutation({onSuccess:e=>{c(t=>t.map((r,s)=>s!==t.length-1||r.prBackgroundId?r:{...r,id:e.id,prBackgroundId:e.id})),o.productionReport.get.invalidate({callsheetId:t})}}),{mutate:T}=d.F.productionReport.updateBackground.useMutation({onSuccess:()=>{o.productionReport.get.invalidate({callsheetId:t})}}),{mutate:A}=d.F.productionReport.deleteBackground.useMutation({onSuccess:()=>{o.productionReport.get.invalidate({callsheetId:t})}}),k=(e,t,r)=>{w(s=>({...s,[e]:{...s[e]||{},[t]:r}}))},R=(e,r,s,l)=>{if(b(null),v(null),N(null),"count"===r){let t=parseInt(s,10);if(isNaN(t)||t<1)return void w(t=>{let s={...t};return s[e]&&delete s[e][r],s})}if(s===l)return;let n=a.find(t=>t.id===e);(null==n?void 0:n.prBackgroundId)&&T({callsheetId:t,id:n.prBackgroundId,[r]:"count"===r?parseInt(s,10):s})},M=(e,t,r)=>{"Enter"===e.key?e.currentTarget.blur():"Escape"===e.key&&(w(e=>{let s={...e};return s[t]&&delete s[t][r],s}),b(null),v(null),N(null))},E=(e,r,s)=>{let l=a.find(t=>t.id===e);c(t=>t.map(t=>t.id===e?{...t,[r]:s}:t)),(null==l?void 0:l.prBackgroundId)&&T({callsheetId:t,id:l.prBackgroundId,[r]:s})};return(0,s.jsxs)(p.Zp,{children:[(0,s.jsx)(p.aR,{className:"bg-gray-100 py-3",children:(0,s.jsxs)(p.ZB,{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(i.A,{className:"h-4 w-4"}
1),(0,s.jsx)("span",{className:"text-base",children:"Background Performers"}),r&&(0,s.jsx)(m.$n,{variant:"ghost",size:"sm",onClick:()=>{let e="bg-".concat(Date.now()),r=(null==C?void 0:C.crewCall)||"",s=(null==C?void 0:C.firstMealIn)||"",l=(null==C?void 0:C.firstMealOut)||"",a=(null==C?void 0:C.lastPersonOut)||"";c(t=>[...t,{id:e,name:"",count:1,arrive:r,mealOut:l,mealIn:s,dismiss:a,notes:""}]),I({callsheetId:t,name:"",count:1,arrive:r,mealOut:l,mealIn:s,dismiss:a})},className:"h-7 gap-1 text-xs",children:(0,s.jsx)(u.A,{className:"h-4 w-4"})})]}),(0,s.jsx)("div",{className:"flex items-center gap-3",children:(0,s.jsxs)("span",{className:"text-sm font-medium text-black",children:["Total BG: ",a.reduce((e,t)=>e+t.count,0)]})})]})}),(0,s.jsx)(p.Wu,{className:"p-0",children:(0,s.jsxs)("table",{className:"w-full text-sm",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"border-b bg-gray-50",children:[(0,s.jsx)("th",{className:"w-[18%] px-4 py-2 text-left font-medium text-gray-600",children:"Name"}),(0,s.jsx)("th",{className:"w-14 px-2 py-2 text-center font-medium text-gray-600",children:"Count"}),(0,s.jsx)("th",{className:"w-20 px-2 py-2 text-center font-medium text-gray-600",children:"Arrive"}),(0,s.jsx)("th",{className:"w-20 px-2 py-2 text-center font-medium text-gray-600",children:"Meal In"}),(0,s.jsx)("th",{className:"w-20 px-2 py-2 text-center font-medium text-gray-600",children:"Meal Out"}),(0,s.jsx)("th",{className:"w-20 px-2 py-2 text-center font-medium text-gray-600",children:"Dismiss"}),(0,s.jsx)("th",{className:"w-[18%] px-2 py-2 text-center font-medium text-gray-600",children:"Notes"}),r&&(0,s.jsx)("th",{className:"w-8 px-2"})]})}),(0,s.jsx)("tbody",{children:0===a.length?(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:r?8:7,className:"px-3 py-4 text-center text-gray-500",children:"No background performers"})}):a.map((e,n)=>{var o,d,i,u,p,m;return(0,s.jsxs)("tr",{className:(0,y.cn)("h-10 border-b",n%2==0?"bg-white":"bg-gray-50"),children:[(0,s.jsx)("td",{className:"w-[20%] pr-4 py-1 text-left",children:r?g===e.id?(0,s.jsx)("input",{type:"text",autoFocus:!0,value:null!=(u=null==(o=S[e.id])?void 0:o.name)?u:e.name,onChange:t=>k(e.id,"name",t.target.value),onBlur:()=>{var t,r;return R(e.id,"name",null!=(r=null==(t=S[e.id])?void 0:t.name)?r:e.name,e.name)},onKeyDown:t=>M(t,e.id,"name"),className:"h-8 w-full rounded border border-gray-200 px-2 text-left text-sm focus:border-blue-500 focus:outline-none"}):(0,s.jsx)("div",{onClick:()=>b(e.id),className:"flex h-8 w-full cursor-pointer items-center justify-start rounded border border-transparent px-2 hover:underline",children:e.name||"â"}):e.name||"-"}),(0,s.jsx)("td",{className:"w-14 px-2 py-1 text-center",children:r?f===e.id?(0,s.jsx)("input",{type:"number",autoFocus:!0,min:1,value:null!=(p=null==(d=S[e.id])?void 0:d.count)?p:e.count,onChange:t=>k(e.id,"count",t.target.value),onBlur:()=>{var t,r;return R(e.id,"count",null!=(r=null==(t=S[e.id])?void 0:t.count)?r:e.count.toString(),e.count.toString())},onKeyDown:t=>M(t,e.id,"count"),className:"h-8 w-full rounded border border-gray-200 px-2 text-center text-sm focus:border-blue-500 focus:outline-none [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"}):(0,s.jsx)("div",{onClick:()=>v(e.id),className:"flex h-8 w-full cursor-pointer items-center justify-center rounded border border-transparent hover:underline",children:e.count}):e.count}),(0,s.jsx)("td",{className:"px-3 py-1.5 text-center",children:r?(0,s.jsx)(h.A,{value:e.arrive,onChange:t=>E(e.id,"arrive",t),className:"text-xs",militaryTime:l,minuteIncrement:5,allowNA:!0}):e.arrive||"-"}),(0,s.jsx)("td",{className:"px-3 py-1.5 text-center",children:r?(0,s.jsx)(h.A,{value:e.mealIn,onChange:t=>E(e.id,"mealIn",t),className:"text-xs",militaryTime:l,minuteIncrement:5,allowNA:!0}):e.mealIn||"-"}),(0,s.jsx)("td",{className:"px-3 py-1.5 text-center",children:r?(0,s.jsx)(h.A,{value:e.mealOut,onChange:t=>E(e.id,"mealOut",t),className:"text-xs",militaryTime:l,minuteIncrement:5,allowNA:!0}):e.mealOut||"-"}),(0,s.jsx)("td",{className:"px-3 py-1.5 text-center",children:r?(0,s.jsx)(h.A,{value:e.dismiss,onChange:t=>E(e.id,"dismiss",t),className:"text-xs",militaryTime:l,minuteIncrement:5,allowNA:!0}):e.dismiss||"-"}),(0,s.jsx)("td",{className:"w-[20%] px-2 py-1 text-center",children:r?j===e.id?(0,s.jsx)("input",{type:"text",autoFocus:!0,value:null!=(m=null==(i=S[e.id])?void 0:i.notes)?m:e.notes,onChange:t=>k(e.id,"notes",t.target.value),onBlur:()=>{var t,r;return R(e.id,"notes",null!=(r=null==(t=S[e.id])?void 0:t.notes)?r:e.notes,e.notes)},onKeyDown:t=>M(t,e.id,"notes"),className:"h-8 w-full rounded border border-gray-200 px-2 text-center text-sm focus:border-blue-500 focus:outline-none"}):(0,s.jsx)("div",{onClick:()=>N(e.id),className:"flex h-8 w-full cursor-pointer items-center justify-center rounded border border-transparent px-2 hover:underline",children:e.notes||"â"}):e.notes||"-"}),r&&(0,s.jsx)("td",{className:"py-1.5 text-center",children:(0,s.jsx)("button",{onClick:()=>(e=>{let r=a.find(t=>
1t.id===e);(null==r?void 0:r.prBackgroundId)&&A({callsheetId:t,id:r.prBackgroundId}),c(t=>t.filter(t=>t.id!==e))})(e.id),children:(0,s.jsx)(x.A,{className:"h-5 w-5 rounded-full p-0.5 text-gray-500 hover:cursor-pointer hover:border hover:border-gray-300 hover:bg-gray-100"})})})]},e.id)})})]})})]})};var b=r(44632),f=r(83802),v=r(32257),j=r(72991),N=r(9197),S=r(56913),w=r(78135);let C=["SW","W","WF","SWF","H","D","TR","NP","FC"],I=e=>{var t;let{callSheetId:r,callSheetGroupId:l,selectedCast:a,setSelectedCast:c}=e,o=(0,n.useRef)(null),i=d.F.useUtils(),[x,p]=(0,n.useState)(""),[h,g]=(0,n.useState)(!1),[f,C]=(0,n.useState)(""),{data:I}=d.F.talentCS.getAllTalent.useQuery({callSheetGroupId:l},{enabled:!!l,refetchOnWindowFocus:!0,refetchOnReconnect:!0}),{mutate:T}=d.F.productionReport.addCast.useMutation({onSuccess:()=>{i.productionReport.get.invalidate({callsheetId:r})}}),{mutate:A}=d.F.productionReport.deleteCast.useMutation({onSuccess:()=>{i.productionReport.get.invalidate({callsheetId:r})}}),{mutate:k,isPending:R}=d.F.talentCS.createTalentMapping.useMutation({onSuccess:e=>{if(i.talentCS.getAllTalent.invalidate(),null==e?void 0:e.id){var t;T({callsheetId:r,talentMappingId:e.id,publicId:e.publicId,characterName:e.characterName,actorName:null!=(t=e.actorName)?t:""}),c(t=>{var r;return[...t,{id:(0,b.sX)(),talentMappingId:e.id,publicId:e.publicId,characterName:e.characterName,actorName:null!=(r=e.actorName)?r:"",castNumber:e.publicId,status:"W",leaveToLocation:"",arriveAtLocation:"",muReport:"",onSet:"",wrap:"",dismiss:"",mealOut:"",mealIn:"",meal2Out:"",meal2In:"",notes:""}]})}p("")}}),M=null!=(t=null==I?void 0:I.map(e=>e.characterName))?t:[],E=()=>""===x.trim()?void C("Field required"):x.trim().length>50?void C("Too long (max 50 characters)"):M.includes(x)?void C("Name already exists"):void k({callSheetGroupId:l,callsheetId:r,characterName:x}),P=window.navigator.userAgent.includes("Mac");return(0,s.jsxs)(S.AM,{open:h,onOpenChange:e=>{g(e),p("")},children:[(0,s.jsx)(S.Wv,{tabIndex:0,asChild:!0,children:(0,s.jsx)("button",{role:"combobox","aria-expanded":h,"aria-controls":"combobox-list",className:"ml-2",children:(0,s.jsx)(u.A,{className:"h-5 w-5 flex-shrink-0 text-primary hover:cursor-pointer hover:text-gray-600"})})}),(0,s.jsx)(S.hl,{onCloseAutoFocus:()=>C(""),side:"right",align:"start",className:"max-h-[300px] w-[400px] p-0",children:(0,s.jsxs)(N.uB,{className:"flex flex-col",children:[(0,s.jsxs)("div",{className:"sticky top-0 z-20 my-2 flex h-11 w-full items-center gap-0.5 bg-white px-2",children:[(0,s.jsx)(N.G7,{ref:o,placeholder:"Search talent by ID or name...",className:"my-1",onValueChange:e=>{p(e),C("")},value:x,onKeyDown:e=>{"Enter"===e.key&&e.metaKey&&(e.stopPropagation(),E())}}),(0,s.jsx)(w.Bc,{children:(0,s.jsxs)(w.m_,{delayDuration:0,children:[(0,s.jsx)(w.k$,{asChild:!0,children:(0,s.jsx)("div",{children:(0,s.jsx)(m.$n,{disabled:""===x,onClick:E,className:"w-full active:scale-95",children:R?(0,s.jsx)(j.k,{size:15}):"Create"})})}),(0,s.jsx)(w.ZI,{children:P?"Cmd + Enter":"Ctrl + Enter"})]})})]}),f&&(0,s.jsx)("div",{className:"text-center text-sm text-red-500",children:f}),(0,s.jsxs)(N.oI,{children:[(0,s.jsx)(N.xL,{children:"No talent found."}),(0,s.jsx)(N.L$,{className:"max-h-[200px] overflow-auto",children:null==I?void 0:I.map(e=>{let t=a.some(t=>t.publicId===e.publicId);return(0,s.jsxs)(N.h_,{value:"".concat(e.publicId," ").concat(e.characterName),onSelect:()=>(e=>{var t,s;let l=a.find(t=>t.publicId===e.publicId||t.talentMappingId===e.id);l?(l.prCastId&&A({callsheetId:r,id:l.prCastId}),c(t=>t.filter(t=>t.publicId!==e.publicId&&t.talentMappingId!==e.id))):(T({callsheetId:r,talentMappingId:e.id,publicId:e.publicId,characterName:e.characterName,actorName:null!=(s=e.actorName)?s:""}),c(t=>{var r;return t.some(t=>t.publicId===e.publicId||t.talentMappingId===e.id)?t:[...t,{id:(0,b.sX)(),talentMappingId:e.id,publicId:e.publicId,characterName:e.characterName,actorName:null!=(r=e.actorName)?r:"",castNumber:e.publicId,status:"W",leaveToLocation:"",arriveAtLocation:"",muReport:"",onSet:"",wrap:"",dismiss:"",mealOut:"",mealIn:"",meal2Out:"",meal2In:"",notes:""}]}
1)),null==(t=o.current)||t.focus()})(e),children:[(0,s.jsx)(v.A,{className:(0,y.cn)("mr-2 h-4 w-4",t?"opacity-100":"opacity-0")}),(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("span",{className:"mr-2 inline-flex items-center justify-center rounded-full border bg-slate-300 px-1.5 py-0.5 text-sm text-black",children:e.publicId}),e.characterName]})]},e.id)})})]})]})})]})},T=e=>{let{callSheetId:t,callSheetGroupId:r,talentData:l,isEditable:a=!0,showMeal2:c=!0,showTravel:o=!0,militaryTime:i}=e,u=d.F.useUtils(),[m,g]=(0,n.useState)(null),[b,v]=(0,n.useState)(null),[j,N]=(0,n.useState)(null),[S,w]=(0,n.useState)({}),[T,A]=(0,n.useState)([...l].sort((e,t)=>{var r,s;return parseInt(null!=(r=e.publicId)?r:"999")-parseInt(null!=(s=t.publicId)?s:"999")}).map(e=>{var t,r,s,l;return{id:e.id,talentMappingId:e.talentMappingId,publicId:null!=(t=e.publicId)?t:"",characterName:null!=(r=e.characterName)?r:"",actorName:null!=(s=e.actorName)?s:"",castNumber:null!=(l=e.publicId)?l:"",status:e.status,leaveToLocation:"",arriveAtLocation:"",muReport:e.callTime,onSet:e.setTime,wrap:"",dismiss:"",mealOut:"",mealIn:"",meal2Out:"",meal2In:"",notes:e.remarks}})),{data:k}=d.F.productionReport.get.useQuery({callsheetId:t},{enabled:!!t}),R=null==k?void 0:k.castTimes;(0,n.useEffect)(()=>{R&&A([...R].sort((e,t)=>{var r,s;return parseInt(null!=(r=e.publicId)?r:"999")-parseInt(null!=(s=t.publicId)?s:"999")}).map(e=>{var t,r;return{id:null!=(t=e.talentMappingId)?t:e.id,prCastId:e.id,talentMappingId:null!=(r=e.talentMappingId)?r:void 0,publicId:e.publicId,characterName:e.characterName,actorName:e.actorName,castNumber:e.publicId,status:e.status,leaveToLocation:e.leaveToLocation,arriveAtLocation:e.arriveAtLocation,muReport:e.muReport,onSet:e.onSet,wrap:e.wrap,dismiss:e.dismiss,mealIn:e.mealIn,mealOut:e.mealOut,meal2In:e.meal2In,meal2Out:e.meal2Out,notes:e.notes}}))},[R]);let{mutate:M}=d.F.productionReport.updateCastTime.useMutation({onSuccess:()=>{u.productionReport.get.invalidate({callsheetId:t})}}),{mutate:E}=d.F.productionReport.deleteCast.useMutation({onSuccess:()=>{u.productionReport.get.invalidate({callsheetId:t})}}),P=(e,t,r)=>{w(s=>({...s,[e]:{...s[e]||{},[t]:r}}))},O=(e,r,s,l)=>{if(g(null),v(null),N(null),s===l)return;let a=T.find(t=>t.id===e);(null==a?void 0:a.prCastId)&&M({callsheetId:t,id:a.prCastId,[r]:s})},D=(e,t,r)=>{"Enter"===e.key?e.currentTarget.blur():"Escape"===e.key&&(w(e=>{let s={...e};return s[t]&&delete s[t][r],s}),g(null),v(null),N(null))},F=(e,r,s)=>{A(t=>t.map(t=>t.id===e?{...t,[r]:s}:t));let l=T.find(t=>t.id===e);(null==l?void 0:l.prCastId)&&M({callsheetId:t,id:l.prCastId,[r]:s})};return(0,s.jsxs)(p.Zp,{children:[(0,s.jsx)(p.aR,{className:"bg-gray-100 py-3",children:(0,s.jsxs)(p.ZB,{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(f.A,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"text-base",children:"Cast"}),a&&(0,s.jsx)(I,{callSheetId:t,callSheetGroupId:r,selectedCast:T,setSelectedCast:A})]}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"W=Work, R=Rehearsal, T=Test, TR=Travel, F=Finished, D=Drop, H=Hold, NP=Not Photographed, FC=Forced Call"}),(0,s.jsxs)("span",{className:"text-sm font-medium text-black",children:["Total Cast: ",T.length]})]})]})}),(0,s.jsx)(p.Wu,{className:"overflow-x-auto p-0",children:(0,s.jsxs)("table",{className:"w-full text-xs",children:[(0,s.jsxs)("thead",{children:[(0,s.jsxs)("tr",{className:"border-b bg-gray-200",children:[(0,s.jsx)("th",{className:"px-1 py-1",colSpan:4}),(0,s.jsx)("th",{className:"border-l border-r border-gray-400 bg-green-100 px-1 py-1 text-center text-xs font-bold text-green-800",colSpan:4,children:"Work"}),(0,s.jsx)("th",{className:(0,y.cn)("bg-orange-100 px-1 py-1 text-center text-xs font-bold text-orange-800","border-r border-gray-400"),colSpan:c?4:2,children:"Meals"}),o&&(0,s.jsx)("th",{className:"border-r border-gray-400 bg-blue-100 px-1 py-1 text-center text-xs font-bold text-blue-800",colSpan:2,children:"Travel"}),(0,s.jsx)("th",{className:"px-1 py-1"}),a&&(0,s.jsx)("th",{className:"px-1 py-1"})]}),(0,s.jsxs)("tr",{className:"border-b bg-gray-50",children:[(0,s.jsx)("th",{className:"w-8 whitespace-nowrap px-2 py-1.5 text-center text-xs font-semibold text-gray-600",children:"#"}),(0,s.jsx)("th",{className:"w-[15%] whitespace-nowrap px-1 py-1.5 text-left text-xs font-semibold text-gray-600",children:"Cast"}),(0,s.jsx)("th",{className:"w-[15%] whitespace-nowrap px-1 py-1.5 text-left text-xs font-semibold text-gray-600",children:"Character"}),(0,s.jsx)("th",{className:"w-14 whitespace-nowrap px-1 py-1.5 text-center text-xs font-semibold text-gray-600",children:"Status"}),(0,s.jsxs)("th",{className:"w-[65px] border-l border-gray-300 bg-green-50 px-0 py-1.5 text-center text-xs font-semibold leading-tight text-gray-600",children:["HMU",(0,s.jsx)("br",{}),"Report"]}),(0,s.jsxs)("th",{className:"w-[65px] bg-green-50 px-0 py-1.5 text-center text-xs font-semibold leading-tight text-gray-600",children:["On",(0,s.jsx)("br",{}),"Set"]}),(0,s.jsx)("th",{className:"w-[65px] bg-green-50 px-0 py-1.5 text-center text-xs font-semibold text-gray-600",children:"Wrap"}),(0,s.jsx)("th",{className:"w-[65px] border-r border-gray-300 bg-green-50 px-0 py-1.5 text-center text-xs font-semibold text-gray-600",children:"Dismiss"}),(0,s.jsxs)("th",{className:"w-[65px] bg-orange-50 px-0 py-1.5 text-center text-xs font-semibold leading-tight text-gray-600",children:["Meal",(0,s.jsx)("br",{}),"In"]}),(0,s.jsxs)("th",{className:(0,y.cn)("w-[65px] bg-orange-50 px-0 py-1.5 text-center text-xs font-semibold leading-tight text-gray-600",!c&&"border-r border-gray-300"),children:["Meal",(0,s.jsx)("br",{}),"Out"]}),c&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("th",{className:"w-[65px] bg-orange-50 px-0 py-1.5 text-center text-xs font-semibold leading-tight text-gray-600",children:["Meal 2",(0,s.jsx)("br",{}),"In"]}),(0,s.jsxs)("th",{className:(0,y.cn)("w-[65px] bg-orange-50 px-0 py-1.5 text-center text-xs font-semibold leading-tight text-gray-600 border-r border-gray-300"),children:["Meal 2",(0,s.jsx)("br",{}),"Out"]})]}),o&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("th",{className:"w-[65px] bg-blue-50 px-0 py-1.5 text-center text-xs font-semibold leading-tight text-gray-600",children:["Leave for",(0,s.jsx)("br",{}),"Location"]}),(0,s.jsxs)("th",{className:"w-[65px] border-r border-gray-300 bg-blue-50 px-0 py-1.5 text-center text-xs font-semibold leading-tight text-gray-600",children:["Arrive at",(0,s.jsx)("br",{}),"Location"]})]}),(0,s.jsx)("th",{className:"whitespace-nowrap px-1 py-1.5 text-left text-xs font-semibold text-gray-600",children:"Notes"}),a&&(0,s.jsx)("th",{className:"w-8 px-1 py-1.5"})]})]}),(0,s.jsx)("tbody",{children:0===T.length?(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:(c?12:10)+2*!!o+ +!!a+3,className:"px-3 py-4 text-center text-gray-500",children:"No cast members assigned for today"})}):T.map((e,r)=>{var l,n,d,u,p,f;return(0,s.jsxs)("tr",{className:(0,y.cn)("h-9 border-b",r%2==0?"bg-white":"bg-gray-50"),children:[(0,s.jsx)("td",{className:"w-8 px-2 py-1 text-center font-medium",children:e.publicId}),(0,s.jsx)("td",{className:"w-[15%] px-1 py-0.5 text-left font-medium",children:a?m===e.id?(0,s.jsx)("input",{type:"text",autoFocus:!0,value:null!=(u=null==(l=S[e.id])?void 0:l.actorName)?u:e.actorName,onChange:t=>P(e.id,"actorName",t.target.value),onBlur:()=>{var t,r;return O(e.id,"actorName",null!=(r=null==(t=S[e.id])?void 0:t.actorName)?r:e.actorName,e.actorName)},onKeyDown:t=>D(t,e.id,"actorName"),className:"h-7 w-full rounded border border-gray-200 px-1 text-left text-xs font-medium focus:border-blue-500 focus:outline-none"}):(0,s.jsx)("div",{onClick:()=>g(e.id),className:"flex h-7 w-full cursor-pointer items-center justify-start whitespace-normal break-words rounded border border-transparent px-1 text-xs hover:underline",children:e.actorName||"â"}):(0,s.jsx)("span",{className:"whitespace-normal break-words text-xs",children:e.actorName})}),(0,s.jsx)("td",{className:"w-[15%] px-1 py-0.5 text-left",children:a?b===e.id?(0,s.jsx)("input",{type:"text",autoFocus:!0,value:null!=(p=null==(n=S[e.id])?void 0:n.characterName)?p:e.characterName,onChange:t=>P(e.id,"characterName",t.target.value),onBlur:()=>{var t,r;return O(e.id,"characterName",null!=(r=null==(t=S[e.id])?void 0:t.characterName)?r:e.characterName,e.characterName)},onKeyDown:t=>D(t,e.id,"characterName"),className:"h-7 w-full rounded border border-gray-200 px-1 text-left text-xs focus:border-blue-500 focus:outline-none"}):(0,s.jsx)("div",{onClick:()=>v(e.id),className:"flex h-7 w-full cursor-pointer items-center justify-start whitespace-normal break-words rounded border border-transparent px-1 text-xs hover:underline",children:e.characterName||"â"}):(0,s.jsx)("span",{className:"whitespace-normal break-words text-left text-xs",children:e.characterName})}),(0,s.jsx)("td",{className:"px-1 py-1 text-center",children:a?(0,s.jsx)("select",{value:e.status,onChange:t=>
1F(e.id,"status",t.target.value),className:"w-14 rounded border border-gray-300 px-0.5 py-0.5 text-xs",children:C.map(e=>(0,s.jsx)("option",{value:e,children:e},e))}):e.status}),(0,s.jsx)("td",{className:"w-[65px] whitespace-nowrap border-l border-gray-200 bg-green-50/30 px-0 py-1 text-center",children:a?(0,s.jsx)(h.A,{value:e.muReport,onChange:t=>F(e.id,"muReport",t),className:"w-[50px] text-xs",compact:!0,militaryTime:i,minuteIncrement:5,allowNA:!0}):e.muReport||"-"}),(0,s.jsx)("td",{className:"w-[65px] whitespace-nowrap bg-green-50/30 px-0 py-1 text-center",children:a?(0,s.jsx)(h.A,{value:e.onSet,onChange:t=>F(e.id,"onSet",t),className:"w-[50px] text-xs",compact:!0,militaryTime:i,minuteIncrement:5,allowNA:!0}):e.onSet||"-"}),(0,s.jsx)("td",{className:"w-[65px] whitespace-nowrap bg-green-50/30 px-0 py-1 text-center",children:a?(0,s.jsx)(h.A,{value:e.wrap,onChange:t=>F(e.id,"wrap",t),className:"w-[50px] text-xs",compact:!0,militaryTime:i,minuteIncrement:5,allowNA:!0}):e.wrap||"-"}),(0,s.jsx)("td",{className:"w-[65px] whitespace-nowrap border-r border-gray-200 bg-green-50/30 px-0 py-1 text-center",children:a?(0,s.jsx)(h.A,{value:e.dismiss,onChange:t=>F(e.id,"dismiss",t),className:"w-[50px] text-xs",compact:!0,militaryTime:i,minuteIncrement:5,allowNA:!0}):e.dismiss||"-"}),(0,s.jsx)("td",{className:"w-[65px] whitespace-nowrap bg-orange-50/30 px-0 py-1 text-center",children:a?(0,s.jsx)(h.A,{value:e.mealIn,onChange:t=>F(e.id,"mealIn",t),className:"w-[50px] text-xs",compact:!0,militaryTime:i,minuteIncrement:5,allowNA:!0}):e.mealIn||"-"}),(0,s.jsx)("td",{className:(0,y.cn)("w-[65px] whitespace-nowrap bg-orange-50/30 px-0 py-1 text-center",!c&&"border-r border-gray-200"),children:a?(0,s.jsx)(h.A,{value:e.mealOut,onChange:t=>F(e.id,"mealOut",t),className:"w-[50px] text-xs",compact:!0,militaryTime:i,minuteIncrement:5,allowNA:!0}):e.mealOut||"-"}),c&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{className:"w-[65px] whitespace-nowrap bg-orange-50/30 px-0 py-1 text-center",children:a?(0,s.jsx)(h.A,{value:e.meal2In,onChange:t=>F(e.id,"meal2In",t),className:"w-[50px] text-xs",compact:!0,militaryTime:i,minuteIncrement:5,allowNA:!0}):e.meal2In||"N/A"}),(0,s.jsx)("td",{className:(0,y.cn)("w-[65px] whitespace-nowrap bg-orange-50/30 py-1 px-0 text-center border-r border-gray-200"),children:a?(0,s.jsx)(h.A,{value:e.meal2Out,onChange:t=>F(e.id,"meal2Out",t),className:"w-[50px] text-xs",compact:!0,militaryTime:i,minuteIncrement:5,allowNA:!0}):e.meal2Out||"N/A"})]}),o&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{className:"w-[65px] whitespace-nowrap bg-blue-50/30 py-1 px-0 text-center",children:a?(0,s.jsx)(h.A,{value:e.leaveToLocation,onChange:t=>F(e.id,"leaveToLocation",t),className:"w-[50px] text-xs",compact:!0,militaryTime:i,minuteIncrement:5,allowNA:!0}):e.leaveToLocation||"-"}),(0,s.jsx)("td",{className:"w-[65px] whitespace-nowrap border-r px-0 border-gray-200 bg-blue-50/30 py-1 text-center",children:a?(0,s.jsx)(h.A,{value:e.arriveAtLocation,onChange:t=>F(e.id,"arriveAtLocation",t),className:"w-[50px] text-xs",compact:!0,militaryTime:i,minuteIncrement:5,allowNA:!0}):e.arriveAtLocation||"-"})]}),(0,s.jsx)("td",{className:"w-52 px-1 py-0.5 text-left",children:a?j===e.id?(0,s.jsx)("input",{type:"text",autoFocus:!0,value:null!=(f=null==(d=S[e.id])?void 0:d.notes)?f:e.notes,onChange:t=>P(e.id,"notes",t.target.value),onBlur:()=>{var t,r;return O(e.id,"notes",null!=(r=null==(t=S[e.id])?void 0:t.notes)?r:e.notes,e.notes)},onKeyDown:t=>D(t,e.id,"notes"),className:"h-7 w-full min-w-16 rounded border border-gray-200 px-1 text-left text-xs focus:border-blue-500 focus:outline-none"}):(0,s.jsx)("div",{onClick:()=>N(e.id),className:"flex h-7 w-full min-w-16 cursor-pointer items-center justify-start rounded border border-transparent px-1 text-xs hover:underline",children:e.notes||"â"}):e.notes||"-"}),a&&(0,s.jsx)("td",{className:"px-1 py-1 text-center",children:(0,s.jsx)("button",{onClick:()=>((e,r)=>{A(t=>t.filter(t=>t.id!==e)),r&&E({callsheetId:t,id:r})})(e.id,e.prCastId),title:"Remove cast member",children:(0,s.jsx)(x.A,{className:"h-5 w-5 rounded-full p-0.5 text-gray-500 hover:cursor-pointer hover:border hover:border-gray-300 hover:bg-gray-100"})})})]},e.id)})})]})})]})};var A=r(53912),k=r(77966),R=r(31418),M=r(36740),E=r(31528),P=r(40939),O=r(68311),D=r(74819),F=r(48274),_=r(73534),L=r(50104),B=r(10355);let U="grid-cols-[0.9rem_1.5rem_minmax(0,1.8fr)_minmax(0,1.4fr)_3.5rem_3.5rem_1rem]",V={production:{title:"PRODUCTION",crew:[]},continuity:{title:"CONTINUITY",crew:[]},camera:{title:"CAMERA",crew:[]},sound:{title:"SOUND",crew:[]},setLighting:{title:"SET LIGHTING",crew:[]},grip:{title:"GRIP",crew:[]},makeupHair:{title:"MAKEUP & HAIR",crew:[]},costumes:{title:"COSTUMES",crew:[]},artDepartment:{title:"ART DEPARTMENT",crew:[]},setDecoration:{title:"SET DECORATION",crew:[]},property:{title:"PROPERTY",crew:[]},setMedic:{title:"SET MEDIC",crew:[]},productionOffice:{title:"PRODUCTION OFFICE",crew:[]},casting:{title:"CASTING",crew:[]},locations:{title:"LOCATIONS",crew:[]},catering:{title:"CATERING",crew:[]},craftService:{title:"CRAFT SERVICE",crew:[]},vehicles:{title:"VEHICLES",crew:[]}},G=e=>{let{callSheetId:t,callSheetGroupId:r,initialPRCrewColumns:l=3,militaryTime:a,initialPRCrewSectionOrder:o,initialPRCrewSectionVisibility:u,initialPRCrewSectionLabels:m}
1=e,g=d.F.useUtils(),b=(0,k.sf)(),{sectionOrder:f,moveSection:v,onDragEnd:j}=function(e,t){let[r,s]=(0,n.useState)(t&&t.length>0?t:L.N6),l=(0,n.useRef)(r);(0,n.useEffect)(()=>{t&&(s(t),l.current=t)},[t]);let a=d.F.useUtils(),{mutate:c}=d.F.callsheets.updatePRCrewSectionOrder.useMutation({async onMutate(t){await a.callsheets.getAll.cancel({callSheetGroupId:e});let r=a.callsheets.getAll.getData({callSheetGroupId:e});return r&&a.callsheets.getAll.setData({callSheetGroupId:e},{...r,prCrewSectionOrder:t.prCrewSectionOrder}),{prevData:r}},onError(t,r,s){(null==s?void 0:s.prevData)&&a.callsheets.getAll.setData({callSheetGroupId:e},s.prevData)},onSettled(){a.callsheets.getAll.invalidate({callSheetGroupId:e})}}),o=(0,n.useCallback)((e,t)=>{s(r=>{let s=[...r],[a]=s.splice(e,1);return a&&s.splice(t,0,a),l.current=s,s})},[]);return{sectionOrder:r,setSectionOrder:s,moveSection:o,onDragEnd:(0,n.useCallback)(()=>{e&&c({callSheetGroupId:e,prCrewSectionOrder:l.current})},[e,c])}}(r,o),{isVisible:N,setSectionVisible:S}=function(e,t){let[r,s]=(0,n.useState)(null!=t?t:{}),l=(0,n.useRef)(r);(0,n.useEffect)(()=>{t&&(s(t),l.current=t)},[t]);let a=d.F.useUtils(),{mutate:c}=d.F.callsheets.updatePRCrewSectionVisibility.useMutation({async onMutate(t){await a.callsheets.getAll.cancel({callSheetGroupId:e});let r=a.callsheets.getAll.getData({callSheetGroupId:e});return r&&a.callsheets.getAll.setData({callSheetGroupId:e},{...r,prCrewSectionVisibility:t.prCrewSectionVisibility}),{prevData:r}},onError(t,r,s){(null==s?void 0:s.prevData)&&a.callsheets.getAll.setData({callSheetGroupId:e},s.prevData)},onSettled(){a.callsheets.getAll.invalidate({callSheetGroupId:e})}}),o=(0,n.useCallback)((t,r)=>{let a=(0,B.ih)(l.current,t,r);l.current=a,s(a),e&&c({callSheetGroupId:e,prCrewSectionVisibility:a})},[e,c]),i=(0,n.useCallback)(e=>(0,B.gg)(r,e),[r]);return{visibility:r,isVisible:i,setSectionVisible:o}}(r,null!=u?u:null),[w]=(0,A.Q)(),C=(0,n.useCallback)(e=>{var t;return null!=(t=null==m?void 0:m[e])?t:V[e].title}
1,[m]),[I,T]=(0,n.useState)(l),[G,W]=(0,n.useState)(V),[H,K]=(0,n.useState)(null),[q,Q]=(0,n.useState)(""),[Z,$]=(0,n.useState)(""),[z,X]=(0,n.useState)(""),Y=(0,n.useRef)(V),{data:J}=d.F.productionReport.get.useQuery({callsheetId:t},{enabled:!!t}),{mutate:ee}=d.F.callsheets.updatePRCrewColumns.useMutation({onSuccess:()=>{g.callsheets.getAll.invalidate({callSheetGroupId:r})}});(0,n.useEffect)(()=>{T(l)},[l]),(0,n.useEffect)(()=>{Y.current=G},[G]),(0,n.useEffect)(()=>{if((null==J?void 0:J.crew)&&J.crew.length>0){let r={...V};if(Object.keys(r).forEach(e=>{r[e].crew=[]}),J.crew.forEach(e=>{let t=e.section;r[t]&&r[t].crew.push({id:e.id,idNumber:e.idNumber,title:e.title,name:e.name,inTime:e.inTime,outTime:e.outTime})}),W(r),J.crew.length>0){var e,t;$(J.crewCall||(null==(e=J.crew[0])?void 0:e.inTime)||""),X((null==(t=J.crew[0])?void 0:t.outTime)||"")}}else W(V)},[J]);let{mutate:et}=d.F.productionReport.addPRCrewMember.useMutation({async onMutate(e){await g.productionReport.get.cancel();let r=g.productionReport.get.getData({callsheetId:t});return W(t=>{let r=e.section;return{...t,[r]:{...t[r],crew:[...t[r].crew,{id:"temp",...e.crew}]}}}),{prevData:r}},onSuccess:()=>{b.capture("addPRCrewMember_success"),(0,R.hB)("Saving...")},onSettled:()=>{g.productionReport.get.invalidate({callsheetId:t})},onError:(e,r,s)=>{var l;b.capture("addPRCrewMember_fail"),e.data&&e.data.code&&(null==(l=e.data)?void 0:l.code)==="TOO_MANY_REQUESTS"?c.Ay.error("Too many requests. Please wait a moment before adding a crew member again"):c.Ay.error("Error adding crew member. Please try again."),(null==s?void 0:s.prevData)&&g.productionReport.get.setData({callsheetId:t},s.prevData)}}),{mutate:er}=d.F.productionReport.removePRCrewMember.useMutation({async onMutate(e){await g.productionReport.get.cancel();let r=g.productionReport.get.getData({callsheetId:t});return W(t=>{let r={...t};return Object.keys(r).forEach(t=>{r[t]={...r[t],crew:r[t].crew.filter(t=>t.id!==e.crewId)}}),r}),{prevData:r}},onSettled:()=>{g.productionReport.get.invalidate({callsheetId:t})},onSuccess:()=>{b.capture("removePRCrewMember_success"),(0,R.hB)("Saving...")},onError:(e,r,s)=>{var l;b.capture("removePRCrewMember_fail"),e.data&&e.data.code&&(null==(l=e.data)?void 0:l.code)==="TOO_MANY_REQUESTS"?c.Ay.error("Too many requests. Please wait a moment before removing a crew member again"):c.Ay.error("Error removing crew member. Please try again."),(null==s?void 0:s.prevData)&&g.productionReport.get.setData({callsheetId:t},s.prevData)}}),{mutate:es}=d.F.productionReport.editPRCrewMember.useMutation({async onMutate(e){await g.productionReport.get.cancel();let r=g.productionReport.get.getData({callsheetId:t});return W(t=>{let r={...t};return Object.keys(r).forEach(t=>{r[t]={...r[t],crew:r[t].crew.map(t=>{if(t.id===e.crewId){let r={...t};return Object.entries(e.crew).forEach(e=>{let[t,s]=e;void 0!==s&&(r[t]=s)}),r}return t})}}),r}),{prevData:r}},onSettled:()=>{g.productionReport.get.invalidate({callsheetId:t})},onSuccess:()=>{b.capture("editPRCrewMember_success"),(0,R.hB)("Saving...")},onError:(e,r,s)=>{b.capture("editPRCrewMember_fail"),c.Ay.error("Error editing crew member. Please try again."),(null==s?void 0:s.prevData)&&g.productionReport.get.setData({callsheetId:t},s.prevData)}}),{mutate:el}=d.F.productionReport.reorderPRCrew.useMutation({async onMutate(){await g.productionReport.get.cancel({callsheetId:t});let e=g.productionReport.get.getData({callsheetId:t});if(e){let r=new Map;Object.entries(Y.current).forEach(e=>{let[t,s]=e;s.crew.forEach((e,s)=>r.set(e.id,{section:t,order:s}))});let s=e=>{let t=f.indexOf(e);return -1===t?Number.MAX_SAFE_INTEGER:t},l=e.crew.map(e=>{let t=r.get(e.id);return t?{...e,section:t.section,order:t.order}:e}).sort((e,t)=>{let r=s(e.section),l=s(t.section);return r!==l?r-l:e.order-t.order});g.productionReport.get.setData({callsheetId:t},{...e,crew:l})}return{prevData:e}},onError(e,r,s){(null==s?void 0:s.prevData)&&g.productionReport.get.setData({callsheetId:t},s.prevData),c.Ay.error("Error reordering crew. Please try again.")}}),ea=(0,n.useCallback)((e,r)=>{let s,l=Y.current,a=null,n=-1;if(Object.keys(l).some(t=>{let r=l[t].crew.findIndex(t=>t.id===e);return r>=0&&(a=t,n=r,!0)}),null===a)return;let c=a,o=l[c].crew[n];if(!o)return;let d=r.index;
1if(c===r.section){let e=[...l[c].crew];e.splice(n,1),n<d&&(d-=1),e.splice(d,0,o),s={...l,[c]:{...l[c],crew:e}}}else{let e=[...l[c].crew];e.splice(n,1);let t=[...l[r.section].crew];t.splice(d,0,o),s={...l,[c]:{...l[c],crew:e},[r.section]:{...l[r.section],crew:t}}}Y.current=s,W(s),el({callsheetId:t,updates:(c===r.section?[c]:[c,r.section]).map(e=>({section:e,crewIds:s[e].crew.map(e=>e.id)}))})},[t,el]),{dropTarget:en,onHoverTarget:ec,onDragEnd:eo}=(0,F.L)(ea),ed=(e,t,r,s)=>{K({department:e,crewIndex:t,field:r}),Q(s)},ei=(e,r,s,l)=>{let a=G[e].crew.find(e=>e.id===s);(null==a?void 0:a[r])===l||es({callsheetId:t,crewId:s,crew:{id:s,idNumber:"idNumber"===r?l:void 0,title:"title"===r?l:void 0,name:"name"===r?l:void 0,inTime:"inTime"===r?l:void 0,outTime:"outTime"===r?l:void 0}}),K(null),Q("")},eu=(e,r,l,n,c)=>{if((null==H?void 0:H.department)===e&&(null==H?void 0:H.crewIndex)===r&&(null==H?void 0:H.field)===l)if("idNumber"===l)return(0,s.jsx)("div",{className:"p-0",children:(0,s.jsxs)(_.l6,{onValueChange:s=>{var a,n;Q(s),"0"===s?es({callsheetId:t,crewId:c,crew:{id:c,idNumber:"0",inTime:"N/A",outTime:"N/A"}}):ei(e,l,c,s),ed(e,r,"title",(null==(n=G[e])||null==(a=n.crew[r])?void 0:a.title)||"")},onOpenChange:e=>{e||K(null)},defaultValue:n,defaultOpen:!0,children:[(0,s.jsx)(_.bq,{className:"h-6",children:n}),(0,s.jsx)(_.gC,{children:["0","1"].map(e=>(0,s.jsx)(_.eb,{value:e,children:e},e))})]})});else if("inTime"===l||"outTime"===l)return(0,s.jsx)("div",{className:"p-0",children:(0,s.jsx)(h.A,{value:q,onChange:t=>{Q(t),ei(e,l,c,t)},className:"text-xs",compact:!0,militaryTime:a,allowNA:!0,minuteIncrement:5})});else return(0,s.jsx)("div",{className:"p-0",children:(0,s.jsx)("input",{type:"text",value:q,onChange:e=>Q(e.target.value),onBlur:t=>ei(e,l,c,t.target.value),onKeyDown:t=>{if("Enter"===t.key||"Tab"===t.key){var s,a,n,o,d,i,u,x,p,m,h,y,g,b,f,v;t.preventDefault(),ei(e,l,c,q);let j=["title","name","inTime","outTime"],N=j.indexOf(l);if(t.shiftKey&&"Tab"===t.key)if(N>0)ed(e,r,j[N-1],(null==(a=G[e])||null==(s=a.crew[r])?void 0:s[j[N-1]])||"");else if(r>0)ed(e,r-1,"outTime",(null==(o=G[e])||null==(n=o.crew[r-1])?void 0:n.outTime)||"");else{let t=Object.keys(G),r=t.indexOf(e),s=t[r-1];if(s&&(null==(d=G[s])?void 0:d.crew.length)>0){let e=(null==(i=G[s])?void 0:i.crew.length)-1;ed(s,e,"outTime",(null==(x=G[s])||null==(u=x.crew[e])?void 0:u.outTime)||"")}}else if(N<j.length-1)ed(e,r,j[N+1],(null==(h=G[e])||null==(m=h.crew[r])?void 0:m[j[N+1]])||"");else if(r<(null==(p=G[e])?void 0:p.crew.length)-1)ed(e,r+1,"title",(null==(g=G[e])||null==(y=g.crew[r+1])?void 0:y.title)||"");else{let t=Object.keys(G),r=t.indexOf(e),s=t[r+1];s&&(null==(b=G[s])?void 0:b.crew.length)>0&&ed(s,0,"title",(null==(v=G[s])||null==(f=v.crew[0])?void 0:f.title)||"")}}},className:"w-full rounded px-[1px] py-1 text-xs focus:border-0 focus:outline-none focus:ring-1 focus:ring-blue-500",autoFocus:!0})});return"inTime"===l||"outTime"===l?(0,s.jsx)("div",{className:(0,y.cn)("flex justify-center py-0.5","inTime"===l&&"border-r border-gray-200"),children:(0,s.jsx)(h.A,{value:n,onChange:t=>ei(e,l,c,t),className:"text-xs",compact:!0,militaryTime:a,minuteIncrement:5,allowNA:!0})}):(0,s.jsx)("div",{className:(0,y.cn)("cursor-pointer py-1 hover:bg-gray-50 border-r border-gray-200","idNumber"===l?"px-1.5":"px-[1px]"),onClick:()=>ed(e,r,l,n),children:(0,s.jsx)("div",{className:"whitespace-normal break-words",children:n||"-"})})},ex=f.filter(e=>e in G).filter(e=>N(e)).map(e=>[e,G[e]]),ep=Math.ceil(ex.length/I),em=(()=>{if(2===I){let e=ep-1;return[ex.slice(0,e),ex.slice(e)]}return Array.from({length:I},(e,t)=>ex.slice(t*ep,(t+1)*ep))})(),eh=ex.filter(e=>{let[t,r]=e;return r.crew.some(e=>"1"===e.idNumber)}).map(e=>{let[t,r]=e;return r.crew.filter(e=>"1"===e.idNumber).length}).reduce((e,t)=>e+t,0);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(O.w,{}),(0,s.jsx)(E.f,{}),(0,s.jsxs)(p.Zp,{children:[(0,s.jsx)(p.aR,{className:"bg-gray-100 pb-4",children:(0,s.jsxs)("div",{className:"flex flex-col space-y-4 sm:flex-row sm:items-center sm:justify-between sm:space-y-0",children:[(0,s.jsxs)(p.ZB,{className:"flex items-center gap-2",children:[(0,s.jsx)(i.A,{className:"h-4 w-4 text-gray-700"}),(0,s.jsx)("span",{className:"text-lg",children:"Crew"})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,s.jsx)(D._,{columns:I,onColumnsChange:e=>{T(e),ee({callSheetGroupId:r,prCrewColumns:e})},sectionOrder:f,resolveLabel:C,isSectionVisible:N,onToggleSection:S}),(0,s.jsxs)("span",{className:"text-sm font-medium",children:["Total Crew: ",eh]})]})]})}),(0,s.jsx)(p.Wu,{className:"p-0",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("div",{className:"sticky top-0 z-10 flex border-b bg-white",children:em.map((e,t)=>(0,s.jsx)("div",{className:(0,y.cn)("flex-1 p-2",t<em.length-1&&"border-r border-gray-200"),children:(0,s.jsxs)("div",{className:(0,y.cn)("grid items-center gap-1",U),children:[(0,s.jsx)("div",{}),(0,s.jsx)("div",{className:"text-sm font-bold",children:"#"}),(0,s.jsx)("div",{className:"text-sm font-bold",children:"Title"}),(0,s.jsx)("div",{className:"text-sm font-bold",children:"Name"}),(0,s.jsx)("div",{className:"text-center text-sm font-bold",children:"In"}),(0,s.jsx)("div",{className:"text-center text-sm font-bold",children:"Out"}),(0,s.jsx)("div",{})]})},t))}),(0,s.jsx)("div",{className:"flex",children:em.map((e,r)=>(0,s.jsx)("div",{ref:w,className:(0,y.cn)("flex-1",r<em.length-1&&"border-r border-gray-200"),children:e.map(e=>{let[r,l]=e;return(0,s.jsx)(P.I,{departmentKey:r,title:C(r),index:f.indexOf(r),moveSection:v,onDragEnd:j,onAddRow:()=>{et({callsheetId:t,section:r,crew:{idNumber:"1",title:"",name:"",inTime:Z,outTime:z}})},children:((e,r)=>{let l=(null==en?void 0:en.section)===e?en.index:null;return(0,s.jsxs)("div",{className:"mb-4",children:[r.crew.map((r,a)=>(0,s.jsxs)(n.Fragment,{children:[l===a&&(0,s.jsx)(M.Oz,{},"placeholder"),(0,s.jsxs)(M.l4,{crewId:r.id,section:e,index:a,gridCols:U,preview:{idNumber:r.idNumber,title:r.title,name:r.name,trailing:r.inTime},onHoverTarget:ec,onDragEnd:eo,children:[eu(e,a,"idNumber",r.idNumber,r.id),eu(e,a,"title",r.title,r.id),eu(e,a,"name",r.name,r.id),eu(e,a,"inTime",r.inTime,r.id),eu(e,a,"outTime",r.outTime,r.id),(0,s.jsx)("div",{className:"flex justify-center",children:(0,s.jsx)(x.A,{className:"mr-0.5 h-5 w-5 rounded-full text-gray-500 hover:cursor-pointer hover:border hover:border-gray-300 hover:bg-gray-100",onClick:()=>{er({callsheetId:t,crewId:r.id})}})})]},"row")]},r.id)),l===r.crew.length&&(0,s.jsx)(M.Oz,{}),(0,s.jsx)(M.q8,{section:e,crewCount:r.crew.length,onHoverTarget:ec})]})})(r,l)},r)})},r))})]})})]})]})};var W=r(75961),H=r.n(W),K=r(29190),q=r(90609),Q=r(42026),Z=r(19733);let $={actual:{firstUnit:null,secondUnit:null,prep:null,rehearsal:null,holidays:null,travel:null,idle:null},scheduled:{firstUnit:null,secondUnit:null,prep:null,rehearsal:null,holidays:null,travel:null,idle:null}},z=e=>{var t,r,l,a,o,i,u,x,p,m,h,y,g,b,f,v,j,N,S,w,C,I,T;let{callSheetId:A,callSheetData:k,projectTitle:R,totalDays:M,isEditable:E=!0,productionStartDate:P,productionEndDate:O,showActualVsScheduled:D=!0,logoUrl:F}
1=e,_=(0,n.useRef)(null),L=d.F.useUtils(),[B,U]=(0,n.useState)(!1),[V,G]=(0,n.useState)(!1),W=(0,n.useRef)(null),z=(0,n.useRef)(null),X=(0,n.useRef)(null),Y=(0,n.useRef)(null),[J,ee]=(0,n.useState)($),[et,er]=(0,n.useState)(null),[es,el]=(0,n.useState)(null),[ea,en]=(0,n.useState)(""),{data:ec}=d.F.productionReport.get.useQuery({callsheetId:A},{enabled:!!A});(0,n.useEffect)(()=>{et!==A&&ec&&(ec.daysTracking?ee(ec.daysTracking):ee($),er(A))},[ec,A,et]),(0,n.useEffect)(()=>{null!==et&&et!==A&&er(null)},[A,et]);let{mutate:eo}=d.F.productionReport.updateHeaderInfo.useMutation({onSuccess:()=>{L.productionReport.get.invalidate({callsheetId:A})},onError:async(e,t)=>{if((0,Q.m)(e)){var r,s,l,a;c.Ay.error(Q.p),await L.productionReport.get.invalidate({callsheetId:A});let e=L.productionReport.get.getData({callsheetId:A});(null==t?void 0:t.companyInfo)!==void 0&&(null==ey||ey.commands.setContent(null!=(s=null!=(r=null==e?void 0:e.companyInfo)?r:null==k?void 0:k.companyInfo)?s:"")),(null==t?void 0:t.keyPeople)!==void 0&&(null==eg||eg.commands.setContent(null!=(a=null!=(l=null==e?void 0:e.keyPeople)?l:null==k?void 0:k.keyPeople)?a:""))}else c.Ay.error("Error updating. Please try again.")}}),{mutate:ed}=d.F.productionReport.updateDaysTracking.useMutation({onSuccess:()=>{L.productionReport.get.invalidate({callsheetId:A})}}),ei=(0,n.useCallback)((e,t)=>{_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{eo({callsheetId:A,[e]:t})},500)},[A,eo]),eu=(e,t)=>{var r,s;E&&(el({row:e,field:t}),en(null!=(s=null==(r=J[e][t])?void 0:r.toString())?s:""))},ex=()=>{if(!es)return;let{row:e,field:t}=es,r=""===ea?null:parseInt(ea,10),s=isNaN(r)?null:r;if(s!==J[e][t]){let r={...J,[e]:{...J[e],[t]:s}};ee(r),ed({callsheetId:A,daysTracking:r})}el(null),en("")},ep=["firstUnit","secondUnit","prep","rehearsal","holidays","travel","idle"],em=(e,t)=>{var r,s;let l=J;if(es){let{row:e,field:t}=es,r=""===ea?null:parseInt(ea,10),s=isNaN(r)?null:r;s!==J[e][t]&&(ee(l={...J,[e]:{...J[e],[t]:s}}),ed({callsheetId:A,daysTracking:l}))}el({row:e,field:t}),en(null!=(s=null==(r=l[e][t])?void 0:r.toString())?s:"")},eh=e=>{if("Enter"===e.key)ex();else if("Escape"===e.key)el(null),en("");else if("Tab"===e.key){if(!es)return;e.preventDefault();let{row:t,field:r}=es,s=ep.indexOf(r);if(e.shiftKey){let e=ep[s-1],r=ep[ep.length-1];s>0&&e?em(t,e):"scheduled"===t&&r?em("actual",r):ex()}else{let e=ep[s+1],r=ep[0];s<ep.length-1&&e?em(t,e):"actual"===t&&r?em("scheduled",r):ex()}}};(0,n.useEffect)(()=>()=>{_.current&&clearTimeout(_.current)},[]),(0,n.useEffect)(()=>{let e=e=>{var t,r,s,l;let a=e.target,n=null==(t=W.current)?void 0:t.contains(a),c=null==(r=X.current)?void 0:r.contains(a);n||c||U(!1);let o=null==(s=z.current)?void 0:s.contains(a),d=null==(l=Y.current)?void 0:l.contains(a);o||d||G(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let ey=(0,K.hG)({extensions:Z.X,content:null!=(r=null!=(t=null==ec?void 0:ec.companyInfo)?t:null==k?void 0:k.companyInfo)?r:"",editable:E,immediatelyRender:!1,onFocus:()=>U(!0),onUpdate:e=>{let{editor:t}=e;ei("companyInfo",t.getHTML())}}),eg=(0,K.hG)({extensions:Z.X,content:null!=(a=null!=(l=null==ec?void 0:ec.keyPeople)?l:null==k?void 0:k.keyPeople)?a:"",editable:E,immediatelyRender:!1,onFocus:()=>G(!0),onUpdate:e=>{let{editor:t}=e;ei("keyPeople",t.getHTML())}});(0,n.useEffect)(()=>{if(ey){var e,t;let r=null!=(t=null!=(e=null==ec?void 0:ec.companyInfo)?e:null==k?void 0:k.companyInfo)?t:"";ey.getHTML()!==r&&ey.commands.setContent(r)}},[null==ec?void 0:ec.companyInfo,null==k?void 0:k.companyInfo,ey,A]),(0,n.useEffect)(()=>{if(eg){var e,t;let r=null!=(t=null!=(e=null==ec?void 0:ec.keyPeople)?e:null==k?void 0:k.keyPeople)?t:"";eg.getHTML()!==r&&eg.commands.setContent(r)}},[null==ec?void 0:ec.keyPeople,null==k?void 0:k.keyPeople,eg,A]);let eb=(null==k?void 0:k.date)?(0,q.A)(new Date(k.date),"EEEE, MMMM d, yyyy"):"";return(0,s.jsxs)("div",{className:"jsx-64edcd8e2679f396 border border-gray-300 bg-white",children:[(0,s.jsxs)("div",{className:"jsx-64edcd8e2679f396 grid grid-cols-[300px_1fr_350px] border-b border-gray-300 bg-gray-100",children:[(0,s.jsxs)("div",{className:"jsx-64edcd8e2679f396 flex flex-col border-r border-gray-400 p-3",children:[F&&(0,s.jsx)("div",{className:"jsx-64edcd8e2679f396 mb-2 flex items-center justify-center",children:(0,s.jsx)("img",{src:F,alt:"Company Logo",className:"jsx-64edcd8e2679f396 max-h-12 max-w-[160px] object-contain"})}),(0,s.jsx)("div",{className:"jsx-64edcd8e2679f396 relative flex-1",children:E?(0,s.jsxs)("div",{className:"jsx-64edcd8e2679f396 text-xs text-gray-500",children:[(0,s.jsx)("div",{ref:X,className:"jsx-64edcd8e2679f396 absolute right-0 top-0 z-[550]",children:B&&ey&&(0,s.jsx)(Z.A,{reminderEditor:ey})}),(0,s.jsx)("div",{ref:W,className:"jsx-64edcd8e2679f396",children:(0,s.jsx)(K.$Z,{editor:ey,className:"prose-sm prose-invert min-h-[4rem]"})})]}):(0,s.jsx)("div",{dangerouslySetInnerHTML:{__html:null!=(i=null!=(o=null==ec?void 0:ec.companyInfo)?o:null==k?void 0:k.companyInfo)?i:""},className:"jsx-64edcd8e2679f396 prose-sm prose-invert min-h-[4rem] text-xs text-gray-500 [&_p]:min-h-[1em]"})})]}),(0,s.jsxs)("div",{className:"jsx-64edcd8e2679f396 flex flex-col items-center justify-center px-4 py-3",children:[(0,s.jsx)("h1",{className:"jsx-64edcd8e2679f396 text-xl font-bold uppercase tracking-wide text-gray-500",children:R||"Production Title"}),(0,s.jsx)("h2",{className:"jsx-64edcd8e2679f396 pb-1 text-sm font-medium text-gray-500",children:"Daily Production Report"}),(0,s.jsx)("div",{className:"jsx-64edcd8e2679f396 my-1 w-full border-t border-gray-300"}),(0,s.jsxs)("div",{className:"jsx-64edcd8e2679f396 pt-1 text-lg font-bold text-gray-700",children:["Day ",null!=(u=null==k?void 0:k.dayNumber)?u:1," of ",M]}),(0,s.jsxs)("div",{className:"jsx-64edcd8e2679f396 mt-1 flex items-center gap-4 text-sm text-gray-600",children:[(0,s.jsxs)("div",{className:"jsx-64edcd8e2679f396 flex items-center gap-1",children:[(0,s.jsx)("span",{className:"jsx-64edcd8e2679f396 font-semibold text-gray-500",children:"Start:"}),(0,s.jsx)("span",{className:"jsx-64edcd8e2679f396",children:null!=P?P:"-"})]}),(0,s.jsxs)("div",{className:"jsx-64edcd8e2679f396 flex items-center gap-1",children:[(0,s.jsx)("span",{className:"jsx-64edcd8e2679f396 font-semibold text-gray-500",children:"End:"}),(0,s.jsx)("span",{className:"jsx-64edcd8e2679f396",children:null!=O?O:"-"})]})]})]}),(0,s.jsxs)("div",{className:"jsx-64edcd8e2679f396 flex flex-col border-l border-gray-400 p-2",children:[(0,s.jsx)("div",{className:"jsx-64edcd8e2679f396 border-b border-gray-400 py-2 text-center",children:(0,s.jsx)("div",{className:"jsx-64edcd8e2679f396 text-base font-semibold text-gray-700",children:eb})}),(0,s.jsx)("div",{className:"jsx-64edcd8e2679f396 relative flex-1 pt-2",children:E?(0,s.jsxs)("div",{className:"jsx-64edcd8e2679f396 text-xs text-gray-500",children:[(0,s.jsx)("div",{ref:Y,className:"jsx-64edcd8e2679f396 absolute right-0 top-2 z-[500]",children:V&&eg&&(0,s.jsx)(Z.A,{reminderEditor:eg})}),(0,s.jsx)("div",{ref:z,className:"jsx-64edcd8e2679f396",children:(0,s.jsx)(K.$Z,{editor:eg,className:"prose-sm prose-invert min-h-[4rem]"})})]}):(0,s.jsx)("div",{dangerouslySetInnerHTML:{__html:null!=(p=null!=(x=null==ec?void 0:ec.keyPeople)?x:null==k?void 0:k.keyPeople)?p:""},className:"jsx-64edcd8e2679f396 prose-sm prose-invert min-h-[4rem] text-xs text-gray-500 [&_p]:min-h-[1em]"})})]})]}),D&&(0,s.jsx)("div",{className:"jsx-64edcd8e2679f396 overflow-x-auto border-b border-gray-300",children:(0,s.jsxs)("table",{className:"jsx-64edcd8e2679f396 w-full text-xs",children:[(0,s.jsx)("thead",{className:"jsx-64edcd8e2679f396",children:(0,s.jsxs)("tr",{className:"jsx-64edcd8e2679f396 bg-gray-100",children:[(0,s.jsx)("th",{className:"jsx-64edcd8e2679f396 border-r border-gray-300 p-2 text-left font-semibold uppercase text-gray-600"}),(0,s.jsx)("th",{className:"jsx-64edcd8e2679f396 border-r border-gray-300 p-2 text-center font-semibold uppercase text-gray-600",children:"1st Unit"}),(0,s.jsx)("th",{className:"jsx-64edcd8e2679f396 border-r border-gray-300 p-2 text-center font-semibold uppercase text-gray-600",children:"2nd Unit"}),(0,s.jsx)("th",{className:"jsx-64edcd8e2679f396 border-r border-gray-300 p-2 text-center font-semibold uppercase text-gray-600",children:"Prep"}),(0,s.jsx)("th",{className:"jsx-64edcd8e2679f396 border-r border-gray-300 p-2 text-center font-semibold uppercase text-gray-600",children:"Rehearsal"}),(0,s.jsx)("th",{className:"jsx-64edcd8e2679f396 border-r border-gray-300 p-2 text-center font-semibold uppercase text-gray-600",children:"Holidays"}),(0,s.jsx)("th",{className:"jsx-64edcd8e2679f396 border-r border-gray-300 p-2 text-center font-semibold uppercase text-gray-600",children:"Travel"}),(0,s.jsx)("th",{className:"jsx-64edcd8e2679f396 border-r border-gray-300 p-2 text-center font-semibold uppercase text-gray-600",children:"Idle"}),(0,s.jsx)("th",{className:"jsx-64edcd8e2679f396 border-r border-gray-300 p-2 text-center font-semibold uppercase text-gray-600",children:"Total"})]})}),(0,s.jsxs)("tbody",{className:"jsx-64edcd8e2679f396",children:[(0,s.jsxs)("tr",{className:"jsx-64edcd8e2679f396 border-t border-gray-300",children:[(0,s.jsx)("td",{className:"jsx-64edcd8e2679f396 border-r border-gray-300 p-2 font-semibold text-gray-700",children:"# of Actual Days"}),["firstUnit","secondUnit","prep","rehearsal","holidays","travel","idle"].map(e=>{var t;let r=(null==es?void 0:es.row)==="actual"&&(null==es?void 0:es.field)===e;return(0,s.jsx)("td",{style:{minWidth:"60px"},className:"jsx-64edcd8e2679f396 border-r border-gray-300 p-1 text-center",children:(0,s.jsx)("div",{className:"jsx-64edcd8e2679f396 flex h-6 items-center justify-center",children:r?(0,s.jsx)("input",{type:"number",autoFocus:!0,value:ea,onChange:e=>en(e.target.value),onBlur:ex,onKeyDown:eh,className:"jsx-64edcd8e2679f396 h-6 w-12 rounded border border-blue-400 text-center text-xs focus:outline-none focus:ring-1 focus:ring-blue-400 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"}):(0,s.jsx)("span",{onClick:()=>eu("actual",e),className:"jsx-64edcd8e2679f396 "+((E?"inline-block h-6 w-12 cursor-pointer rounded leading-6 hover:bg-gray-100":"")||""),children:null!=(t=J.actual[e])?t:"-"})})},e)}),(0,s.jsx)("td",{className:"jsx-64edcd8e2679f396 border-r border-gray-300 p-1 text-center font-medium",children:(null!=(m=J.actual.firstUnit)?m:0)+(null!=(h=J.actual.secondUnit)?h:0)+(null!=(y=J.actual.prep)?y:0)+(null!=(g=J.actual.rehearsal)?g:0)+(null!=(b=J.actual.holidays)?b:0)+(null!=(f=J.actual.travel)?f:0)+(null!=(v=J.actual.idle)?v:0)})]}),(0,s.jsxs)("tr",{className:"jsx-64edcd8e2679f396 border-t border-gray-300",children:[(0,s.jsx)("td",{className:"jsx-64edcd8e2679f396 border-r border-gray-300 p-2 font-semibold text-gray-700",children:"# of Scheduled Days"}),["firstUnit","secondUnit","prep","rehearsal","holidays","travel","idle"].map(e=>{var t;let r=(null==es?void 0:es.row)==="scheduled"&&(null==es?void 0:es.field)===e;return(0,s.jsx)("td",{style:{minWidth:"60px"},className:"jsx-64edcd8e2679f396 border-r border-gray-300 p-1 text-center",children:(0,s.jsx)("div",{className:"jsx-64edcd8e2679f396 flex h-6 items-center justify-center",children:r?(0,s.jsx)("input",{type:"number",autoFocus:!0,value:ea,onChange:e=>en(e.target.value),onBlur:ex,onKeyDown:eh,className:"jsx-64edcd8e2679f396 h-6 w-12 rounded border border-blue-400 text-center text-xs focus:outline-none focus:ring-1 focus:ring-blue-400 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"}):(0,s.jsx)("span",{onClick:()=>eu("scheduled",e),className:"jsx-64edcd8e2679f396 "+((E?"inline-block h-6 w-12 cursor-pointer rounded leading-6 hover:bg-gray-100":"")||""),children:null!=(t=J.scheduled[e])?t:"-"})})},e)}),(0,s.jsx)("td",{className:"jsx-64edcd8e2679f396 border-r border-gray-300 p-1 text-center font-medium",children:(null!=(j=J.scheduled.firstUnit)?j:0)+(null!=(N=J.sc
1heduled.secondUnit)?N:0)+(null!=(S=J.scheduled.prep)?S:0)+(null!=(w=J.scheduled.rehearsal)?w:0)+(null!=(C=J.scheduled.holidays)?C:0)+(null!=(I=J.scheduled.travel)?I:0)+(null!=(T=J.scheduled.idle)?T:0)})]})]})]})}),(0,s.jsx)(H(),{id:"64edcd8e2679f396",children:".ProseMirror{outline:none}.ProseMirror p{margin:0}"})]})};var X=r(19772),Y=r(50549),J=r(38826),ee=r(21355);let et="<p></p>",er="<p>1) Safety Meeting Held at [TIME] on site.</p>\n<p>2)</p>\n<p>3)</p>\n<p>4)</p>\n<p>5)</p>",es=e=>{if(!e||""===e)return{columns:[er,et,et],columnCount:1};try{let t=JSON.parse(e);if(t.columns&&Array.isArray(t.columns))return{columns:[t.columns[0]||et,t.columns[1]||et,t.columns[2]||et],columnCount:t.columnCount||1}}catch(e){}return{columns:[e,et,et],columnCount:1}},el=(e,t)=>JSON.stringify({columns:e,columnCount:t}),ea=e=>{let t=e.filter(e=>!(e=>!e||""===e.replace(/<[^>]*>/g,"").trim())(e));return 0===t.length?et:t.join("")},en=e=>{let{content:t,onUpdate:r,onFocus:l,onBlur:a,focusedEditor:c,columnIndex:o,isEditable:d}=e,i=(0,n.useRef)(!1),u=(0,K.hG)({extensions:Z.X,content:t,editable:d,immediatelyRender:!1,onFocus:e=>{let{editor:t}=e;return l(t)},onBlur:a,onUpdate:e=>{let{editor:t}=e;i.current||r(t.getHTML())}});(0,n.useEffect)(()=>{u&&u.getHTML()!==t&&(i.current=!0,u.commands.setContent(t),queueMicrotask(()=>{i.current=!1}))},[t]);let x=c===u&&null!==u;return(0,s.jsx)("div",{className:"min-h-[80px] flex-1 cursor-text rounded border p-2 ".concat(x?"border-blue-400 ring-1 ring-blue-400":"border-gray-200"),"data-column":o,onClick:()=>{u&&!u.isFocused&&d&&u.commands.focus("end")},children:(0,s.jsx)(K.$Z,{editor:u,className:"prose prose-sm max-w-none"})})},ec=e=>{let{callSheetId:t,isEditable:r=!0}=e,l=(0,n.useRef)(null),a=(0,n.useRef)(null),o=d.F.useUtils(),[i,u]=(0,n.use
1State)(1),[x,m]=(0,n.useState)([er,et,et]),[h,y]=(0,n.useState)(null),[g,b]=(0,n.useState)(!1),f=(0,n.useRef)(!1),v=(0,n.useRef)(x),j=(0,n.useRef)(i),N=(0,n.useRef)(!1);(0,n.useEffect)(()=>{v.current=x},[x]),(0,n.useEffect)(()=>{j.current=i},[i]);let{data:S}=d.F.productionReport.get.useQuery({callsheetId:t},{enabled:!!t});(0,n.useEffect)(()=>{if((null==S?void 0:S.notes)!==void 0){let e=es(S.notes);if(f.current){let t=el(x,i);S.notes!==t&&(m(e.columns),u(e.columnCount))}else m(e.columns),u(e.columnCount),f.current=!0}},[null==S?void 0:S.notes]);let{mutate:w}=d.F.productionReport.updateNotes.useMutation({onSuccess:()=>{o.productionReport.get.invalidate({callsheetId:t})},onError:async e=>{if((0,Q.m)(e)){var r;c.Ay.error(Q.p),await o.productionReport.get.invalidate({callsheetId:t});let e=o.productionReport.get.getData({callsheetId:t}),s=es(null!=(r=null==e?void 0:e.notes)?r:"");m(s.columns),u(s.columnCount)}else c.Ay.error("Error updating. Please try again.")}}),C=(0,n.useCallback)((e,r)=>{if(N.current)return;let s=el(e,r);s!==(null==S?void 0:S.notes)&&(N.current=!0,w({callsheetId:t,notes:s},{onSettled:()=>{N.current=!1}}))},[t,null==S?void 0:S.notes,w]),I=(0,n.useCallback)((e,t)=>{m(r=>{let s=[...r];return s[e]=t,s})},[]),T=(0,n.useCallback)(e=>{y(e),b(!0)},[]),A=(0,n.useCallback)(()=>{setTimeout(()=>{var e,t;let r=document.activeElement,s=null==(e=l.current)?void 0:e.contains(r),n=null==(t=a.current)?void 0:t.contains(r);s||n||(y(null),b(!1),C(v.current,j.current))},100)},[C]);(0,n.useEffect)(()=>{let e=e=>{var t,r;let s=e.target,n=null==(t=l.current)?void 0:t.contains(s),c=null==(r=a.current)?void 0:r.contains(s);n||c||(y(null),b(!1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let k=(0,n.useCallback)(e=>{let t=parseInt(e,10);if(t===i)return;let r=[...x];t<i&&(3===i&&2===t?r=[x[0],ea([x[1],x[2]]),et]:3===i&&1===t?r=[ea([x[0],x[1],x[2]]),et,et]:2===i&&1===t&&(r=[ea([x[0],x[1]]),et,et])),u(t),m(r),C(r,t)},[i,x,C]),R=1===i?X.A:2===i?Y.A:J.A;return(0,s.jsxs)(p.Zp,{children:[(0,s.jsx)(p.aR,{className:"bg-gray-100 py-3",children:(0,s.jsxs)(p.ZB,{className:"flex items-center gap-2",children:[(0,s.jsx)(ee.A,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"text-sm",children:"Notes / Explanations"}),(0,s.jsx)("div",{ref:a,children:r&&g&&h&&(0,s.jsx)(Z.A,{reminderEditor:h})}),r&&(0,s.jsx)("div",{className:"ml-auto flex items-center gap-2",children:(0,s.jsxs)(_.l6,{value:String(i),onValueChange:k,children:[(0,s.jsxs)(_.bq,{className:"h-7 w-[130px] bg-white text-xs",children:[(0,s.jsx)(R,{className:"mr-1 h-3 w-3"}),(0,s.jsx)(_.yv,{})]}),(0,s.jsxs)(_.gC,{children:[(0,s.jsx)(_.eb,{value:"1",children:"1 Column"}),(0,s.jsx)(_.eb,{value:"2",children:"2 Columns"}),(0,s.jsx)(_.eb,{value:"3",children:"3 Columns"})]})]})})]})}),(0,s.jsx)(p.Wu,{className:"p-3",ref:l,children:(0,s.jsxs)("div",{className:"flex gap-3 ".concat(i>1?"divide-x divide-gray-200":""),children:[(0,s.jsx)(en,{content:x[0],onUpdate:e=>I(0,e),onFocus:T,onBlur:A,focusedEditor:h,columnIndex:0,isEditable:r}),i>=2&&(0,s.jsx)(en,{content:x[1],onUpdate:e=>I(1,e),onFocus:T,onBlur:A,focusedEditor:h,columnIndex:1,isEditable:r}),i>=3&&(0,s.jsx)(en,{content:x[2],onUpdate:e=>I(2,e),onFocus:T,onBlur:A,focusedEditor:h,columnIndex:2,isEditable:r})]})})]})};var eo=r(79247);let ed={crewCall:"",scheduledShootingCall:"",actualFirstShot:"",firstMealIn:"",firstMealOut:"",firstShotAfterLunch:"",secondMealIn:"",secondMealOut:"",cameraWrap:"",lastPersonOut:""},ei=e=>{let{callSheetId:t,isEditable:r=!0,showMeal2:l=!0,militaryTime:a}=e,[c,o]=(0,n.useState)(ed),i=(0,n.useRef)(null),u=d.F.useUtils(),{data:x}=d.F.productionReport.get.useQuery({callsheetId:t},{enabled:!!t});(0,n.useEffect)(()=>{x&&o({crewCall:x.crewCall||"",scheduledShootingCall:x.scheduledShootingCall||"",actualFirstShot:x.actualFirstShot||"",firstMealIn:x.firstMealIn||"",firstMealOut:x.firstMealOut||"",firstShotAfterLunch:x.firstShotAfterLunch||"",secondMealIn:x.secondMealIn||"",secondMealOut:x.secondMealOut||"",cameraWrap:x.cameraWrap||"",lastPersonOut:x.lastPersonOut||""})},[x]);let{mutate:m}=d.F.productionReport.updateRecordedTimes.useMutation({onSuccess:()=>{u.productionReport.get.invalidate({callsheetId:t})}}),y=(0,n.useCallback)(e=>{i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{m({callsheetId:t,...e})},500)},[t,m]);(0,n.useEffect)(()=>()=>{i.current&&clearTimeout(i.current)},[]);let g=[{key:"crewCall",label:"Crew Call"},{key:"scheduledShootingCall",label:"Sched. Shooting Call"},{key:"actualFirstShot",label:"Actual 1st Shot"},{key:"firstMealIn",label:"First Meal In"},{key:"firstMealOut",label:"First Meal Out"},{key:"firstShotAfterLunch",label:"1st Shot After Lunch"}],b=[{key:"cameraWrap",label:"Camera Wrap"},{key:"lastPersonOut",label:"Last Person Out"}],f=l?[...g,{key:"secondMealIn",label:"2nd Meal In"},{key:"secondMealOut",label:"2nd Meal Out"},...b]:[...g,...b];
1return(0,s.jsxs)(p.Zp,{children:[(0,s.jsx)(p.aR,{className:"bg-gray-100 py-2",children:(0,s.jsxs)(p.ZB,{className:"flex items-center gap-2",children:[(0,s.jsx)(eo.A,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"text-base",children:"Recorded Times"})]})}),(0,s.jsx)(p.Wu,{className:"p-0",children:(0,s.jsx)("div",{className:"grid ".concat(l?"grid-cols-10":"grid-cols-8"," gap-0"),children:f.map((e,t)=>{var l;return(0,s.jsxs)("div",{className:"border-b border-gray-200 p-2 ".concat(t!==f.length-1?"border-r":""),children:[(0,s.jsx)("div",{className:"mb-1 text-[10px] font-medium text-gray-500",children:e.label}),r?(0,s.jsx)(h.A,{value:null!=(l=c[e.key])?l:"",onChange:t=>((e,t)=>{let r={...c,[e]:t};o(r),y(r)})(e.key,t),className:"text-xs",militaryTime:a,minuteIncrement:5,allowNA:!0}):(0,s.jsx)("div",{className:"text-xs font-medium",children:c[e.key]||"-"})]},e.key)})})})]})},eu=(0,r(48900).A)("Clapperboard",[["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3Z",key:"1tn4o7"}],["path",{d:"m6.2 5.3 3.1 3.9",key:"iuk76l"}],["path",{d:"m12.4 3.4 3.1 4",key:"6hsd6n"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z",key:"ltgou9"}]]);var ex=r(93536),ep=r(23845),em=r(35185),eh=r(41160),ey=r(11040),eg=r(65734);let eb=e=>{let{isOpen:t,setIsOpen:r,sceneId:a}=e,n=(0,k.sf)(),o=d.F.useUtils(),i=(0,l.useRouter)().query.callSheetGroupId,{mutate:u,isPending:x}=d.F.sceneCS.deleteScene.useMutation({onSuccess:()=>{r(!1),o.callsheets.getAll.invalidate(),o.callsheets.get.invalidate(),o.sceneCS.getAll.invalidate(),c.Ay.success("Scene deleted successfully.")},onError:()=>{n.capture("budget_delete_fail"),c.Ay.error("Error. Please try again.")}});return(0,s.jsx)(eg.lG,{open:t,onOpenChange:r,children:(0,s.jsxs)(eg.Cf,{"aria-describedby":void 0,children:[(0,s.jsx)("div",{className:"absolute right-0 top-0 hidden pr-4 pt-4 sm:block",children:!x&&(0,s.jsxs)("button",{type:"button",className:"rounded-md bg-white text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2",onClick:()=>r(!1),disabled:x,children:[(0,s.jsx)("span",{className:"sr-only",children:"Close"}),(0,s.jsx)(eh.A,{className:"h-6 w-6","aria-hidden":"true"})]})}),(0,s.jsxs)("div",{className:"sm:flex sm:items-start",children:[(0,s.jsx)("div",{className:"mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10",children:(0,s.jsx)(ey.A,{className:"h-6 w-6 text-red-600","aria-hidden":"true"})}),(0,s.jsxs)("div",{className:"mt-3 text-center sm:ml-4 sm:mt-0 sm:text-left",children:[(0,s.jsx)(eg.L3,{className:"text-base font-semibold leading-6 text-gray-900",children:"Delete Scene"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this scene?"})})]})]}),(0,s.jsx)("div",{className:"mt-5 sm:mt-4 sm:flex sm:flex-row-reverse",children:x?(0,s.jsxs)(m.$n,{className:"inline-flex w-full justify-center gap-2 px-3 py-2 shadow-sm sm:ml-3 sm:w-auto",disabled:!0,children:[(0,s.jsx)(j.k,{}),"Please wait"]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{type:"button",className:"inline-flex w-full justify-center rounded-md bg-red-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-red-500 sm:ml-3 sm:w-auto",onClick:()=>{u({callSheetGroupId:i,sceneId:a}),r(!1)},disabled:x,children:"Delete"}),(0,s.jsx)("button",{type:"button",className:"mt-3 inline-flex w-full justify-center rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50 sm:mt-0 sm:w-auto",onClick:()=>r(!1),disabled:x,children:"Cancel"})]})})]})})};var ef=r(46815),ev=r(98577),ej=r(13579),eN=r(13065),eS=r(91317),ew=r(80401),eC=r(94865),eI=r(84866),eT=r(62298),eA=r(40866),ek=r(31617);let eR={ROW:"row"},eM=e=>{var t;let{scene:r,index:a,moveRow:c,sceneIds:o,isAdvanced:i,episodePrefixes:u,columnVisibility:p,compactSetSynopsis:m=!1,militaryTime:h=!1}=e,y=d.F.useUtils(),g=(0,l.useRouter)(),b=(0,k.sf)(),f=g.query.callSheetId,[v,j]=(0,n.useState)(0),N=(0,n.useRef)(null),S=(0,ek.kL)(p),{mutate:w}=d.F.sceneCS.editSceneOrder.useMutation({onSuccess:(e,t)=>{(0,R.hB)("Saving..."),y.callsheets.get.invalidate({callsheetId:f}),"today"===t.type?b.capture("editSceneOrder_today_success"):b.capture("editSceneOrder_advanced_success")},onError:(e,t)=>
1{"today"===t.type?b.capture("editSceneOrder_today_fail"):b.capture("editSceneOrder_advanced_fail")}}),{mutate:C}=d.F.sceneCS.removeSceneFromCallSheet.useMutation({onSuccess:(e,t)=>{(0,R.hB)("Saving..."),y.callsheets.get.invalidate({callsheetId:f}),y.talentCS.getTalent.invalidate({callSheetId:f}),t.today?b.capture("removeScene_today_success"):b.capture("removeScene_advanced_success")}}),[{handlerId:I},T]=(0,ep.H)({accept:eR.ROW,collect:e=>({handlerId:e.getHandlerId()}),hover(e,t){if(!N.current)return;let r=e.index;if(r===a)return;let s=N.current.getBoundingClientRect(),l=(s.bottom-s.top)/2,n=t.getClientOffset(),o=n?n.y-s.top:0;(!(r<a)||!(o<l))&&(r>a&&o>l||(c(r,a),e.index=a))}}),[{isDragging:A},M]=(0,em.i)({type:eR.ROW,item:()=>(j(a),{id:r.id,index:a}),collect:e=>({isDragging:e.isDragging()}),end:(e,t)=>{let r=t.didDrop(),s=r?t.getDropResult():null;if(e){if(v===(r&&s&&s.newIndex?s.newIndex:e.index))return;i?w({callsheetId:f,order:o,type:"advanced"}):w({callsheetId:f,order:o,type:"today"})}}});M(T(N));let E=null==(t=r.cast)?void 0:t.sort((e,t)=>parseInt(e)-parseInt(t));return A?(0,s.jsx)("tr",{ref:N,"data-handler-id":I,className:"h-[52px] bg-gray-100",children:(0,s.jsx)("td",{colSpan:S,className:"border-2 border-dashed border-gray-300"})}):r.banner?(0,s.jsxs)("tr",{ref:N,"data-handler-id":I,className:"h-[52px] cursor-move bg-slate-100",children:[(0,s.jsx)("td",{className:"border-t p-2 text-center font-semibold",colSpan:S-1,children:(0,s.jsx)(ef.A,{sceneId:r.id,currentBannerText:r.synopsis||"Banner"})}),(0,s.jsx)("td",{className:"border-t text-center",children:(0,s.jsx)(x.A,{onClick:()=>{i?C({callsheetId:f,sceneId:r.id,today:!1}):C({callsheetId:f,sceneId:r.id,today:!0})},className:"h-5 w-5 rounded-full p-0.5 text-gray-500 hover:cursor-pointer hover:border hover:border-gray-300 hover:bg-gray-100"})})]}):(0,s.jsxs)("tr",{ref:N,"data-handler-id":I,className:"cursor-move",children:[(0,ek.pA)(p).map(e=>{var t,l;switch(e){case"scene":return(0,s.jsx)("td",{className:"my-auto w-[5%] whitespace-nowrap border-t pl-1 text-center sm:text-xs 2xl:text-sm",children:(0,s.jsx)(ew.A,{sceneId:r.id,currentSceneNumber:r.sceneNumber,episode:null!=(t=r.episode)?t:null,episodePrefixes:u})},e);case"setSynopsis":return(0,s.jsx)("td",{className:"border-t p-1.5 text-sm",children:(0,s.jsx)(eI.A,{sceneId:r.id,currentSetId:r.setId,currentSynopsis:r.synopsis,currentIntext:null!=(l=r.intext)?l:"-",compactSetSynopsis:m,showSynopsis:p.synopsis})},e);case"dayNight":return(0,s.jsx)("td",{className:"my-auto w-[7.5%] whitespace-nowrap border-t px-1 text-center sm:text-xs 2xl:text-sm",children:(0,s.jsx)(eA.A,{sceneId:r.id,currentTimeOfDay:r.timeOfDay})},e);case"cast":return(0,s.jsx)("td",{className:"border-t p-1.5 text-center",children:(0,s.jsx)(ev.A,{sceneId:r.id,currSelectedCast:E})},e);case"scriptDay":return(0,s.jsx)("td",{className:"my-auto w-[7.5%] whitespace-nowrap border-t pl-1 text-center sm:text-xs 2xl:text-sm",children:(0,s.jsx)(eC.A,{sceneId:r.id,currentScriptDayId:r.scriptDayId})},e);case"pages":return(0,s.jsx)("td",{className:"border-t p-1.5 text-center",children:(0,s.jsx)(eS.A,{sceneId:r.id,currPageLength:r.pageLength})},e);case"estTime":return(0,s.jsx)("td",{className:"my-auto w-[7.5%] whitespace-nowrap border-t px-1 text-center sm:text-xs 2xl:text-sm",children:(0,s.jsx)(ej.A,{sceneId:r.id,currentHours:r.hours,currentMinutes:r.minutes})},e);case"shootTime":return(0,s.jsx)("td",{className:"my-auto w-[9%] whitespace-nowrap border-t px-1 text-center sm:text-xs 2xl:text-sm",children:(0,s.jsx)(eT.A,{sceneId:r.id,currentShootTime:r.shootTime,militaryTime:h})},e);case"location":return(0,s.jsx)("td",{className:"my-auto w-[12%] whitespace-nowrap border-t pl-1 text-center sm:text-xs 2xl:text-sm",children:(0,s.jsx)(eN.A,{sceneId:r.id,currentLocationId:r.locationId})},e)}}),(0,s.jsx)("td",{className:"border-t text-center",children:(0,s.jsx)(x.A,{onClick:()=>{i?C({callsheetId:f,sceneId:r.id,today:!1}):C({callsheetId:f,sceneId:r.id,today:!0})},className:"h-5 w-5 rounded-full p-0.5 text-gray-500 hover:cursor-pointer hover:border hover:border-gray-300 hover:bg-gray-100"})})]})},eE=e=>{var t;let{prScene:r,linkedScene:a,columnVisibility:o,episodePrefixes:i,compactSetSynopsis:u=!1,militaryTime:p=!1,index:m,moveRow:h,onDragEnd:y}=e,g=d.F.useUtils(),b=(0,l.useRouter)(),f=(0,k.sf)(),v=b.query.callSheetId,j=(0,n.useRef)(null),[N,S]=(0,n.use
1State)(0),{mutate:w}=d.F.productionReport.removeSceneFromPR.useMutation({onSuccess:()=>{(0,R.hB)("Saving..."),g.productionReport.get.invalidate({callsheetId:v}),f.capture("removeSceneFromPR_success")},onError:()=>{f.capture("removeSceneFromPR_fail"),c.Ay.error("Error removing scene from production report")}}),[{handlerId:C},I]=(0,ep.H)({accept:eR.ROW,collect:e=>({handlerId:e.getHandlerId()}),hover(e,t){if(!j.current)return;let r=e.index;if(r===m)return;let s=j.current.getBoundingClientRect(),l=(s.bottom-s.top)/2,a=t.getClientOffset(),n=a?a.y-s.top:0;(!(r<m)||!(n<l))&&(r>m&&n>l||(h(r,m),e.index=m))}}),[{isDragging:T},A]=(0,em.i)({type:eR.ROW,item:()=>(S(m),{id:r.id,index:m}),collect:e=>({isDragging:e.isDragging()}),end:()=>{y()}});A(I(j));let M=(0,ek.kL)(o);if(T)return(0,s.jsx)("tr",{ref:j,"data-handler-id":C,className:"h-[52px] bg-gray-100",children:(0,s.jsx)("td",{colSpan:M,className:"border-2 border-dashed border-gray-300"})});if(null==a?void 0:a.banner)return(0,s.jsxs)("tr",{ref:j,"data-handler-id":C,className:"h-[52px] cursor-move bg-slate-100",children:[(0,s.jsx)("td",{className:"border-t p-2 text-center font-semibold",colSpan:M-1,children:(0,s.jsx)(ef.A,{sceneId:a.id,currentBannerText:a.synopsis||"Banner",isPR:!0})}),(0,s.jsx)("td",{className:"border-t text-center",children:(0,s.jsx)(x.A,{onClick:()=>{w({callsheetId:v,prSceneId:r.id})},className:"h-5 w-5 rounded-full p-0.5 text-gray-500 hover:cursor-pointer hover:border hover:border-gray-300 hover:bg-gray-100"})})]});if(!a)return(0,s.jsxs)("tr",{ref:j,"data-handler-id":C,className:"h-12 cursor-move",children:[(0,ek.pA)(o).map(e=>{switch(e){case"scene":return(0,s.jsx)("td",{className:"my-auto w-[5%] whitespace-nowrap border-t pl-1 text-center sm:text-xs 2xl:text-sm",children:r.sceneNumber},e);case"setSynopsis":return(0,s.jsx)("td",{className:"border-t p-1.5 text-sm",children:u?(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"font-medium",children:r.setDescription}),o.synopsis&&r.synopsis&&(0,s.jsxs)("span",{className:"text-xs text-gray-500",children:[" | ",r.synopsis]})]}):(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-medium",children:r.setDescription}),o.synopsis&&r.synopsis&&(0,s.jsx)("div",{className:"text-gray-600",children:r.synopsis})]})},e);case"dayNight":case"estTime":return(0,s.jsx)("td",{className:"my-auto w-[7.5%] whitespace-nowrap border-t px-1 text-center sm:text-xs 2xl:text-sm",children:"-"},e);case"cast":return(0,s.jsx)("td",{className:"border-t p-1.5 text-center",children:"-"},e);case"scriptDay":return(0,s.jsx)("td",{className:"my-auto w-[7.5%] whitespace-nowrap border-t pl-1 text-center sm:text-xs 2xl:text-sm",children:"-"},e);case"pages":return(0,s.jsx)("td",{className:"border-t p-1.5 text-center",children:r.pageLength||0},e);case"shootTime":return(0,s.jsx)("td",{className:"my-auto w-[9%] whitespace-nowrap border-t px-1 text-center sm:text-xs 2xl:text-sm",children:"-"},e);case"location":return(0,s.jsx)("td",{className:"my-auto w-[12%] whitespace-nowrap border-t pl-1 text-center sm:text-xs 2xl:text-sm",children:r.location||"-"},e)}}),(0,s.jsx)("td",{className:"border-t text-center",children:(0,s.jsx)(x.A,{onClick:()=>{w({callsheetId:v,prSceneId:r.id})},className:"h-5 w-5 rounded-full p-0.5 text-gray-500 hover:cursor-pointer hover:border hover:border-gray-300 hover:bg-gray-100"})})]});let E=null==(t=a.cast)?void 0:t.sort((e,t)=>parseInt(e)-parseInt(t));return(0,s.jsxs)("tr",{ref:j,"data-handler-id":C,className:"h-12 cursor-move",children:[(0,ek.pA)(o).map(e=>{var t,r;switch(e){case"scene":return(0,s.jsx)("td",{className:"my-auto w-[5%] whitespace-nowrap border-t pl-1 text-center sm:text-xs 2xl:text-sm",children:(0,s.jsx)(ew.A,{sceneId:a.id,currentSceneNumber:a.sceneNumber,episode:null!=(t=a.episode)?t:null,episodePrefixes:i,isPR:!0})},e);case"setSynopsis":return(0,s.jsx)("td",{className:"border-t p-1.5 text-sm",children:(0,s.jsx)(eI.A,{sceneId:a.id,currentSetId:a.setId,currentSynopsis:a.synopsis,currentIntext:null!=(r=a.intext)?r:"-",compactSetSynopsis:u,showSynopsis:o.synopsis,isPR:!0})},e);case"dayNight":return(0,s.jsx)("td",{className:"my-auto w-[7.5%] whitespace-nowrap border-t px-1 text-center sm:text-xs 2xl:text-sm",children:(0,s.jsx)(eA.A,{sceneId:a.id,currentTimeOfDay:a.timeOfDay,isPR:!0})},e);case"cast":return(0,s.jsx)("td",{className:"border-t p-1.5 text-center",children:(0,s.jsx)(ev.A,{sceneId:a.id,currSelectedCast:E,isPR:!0})},e);case"scriptDay":return(0,s.jsx)("td",{className:"my-auto w-[7.5%] whitespace-nowrap border-t pl-1 text-center sm:text-xs 2xl:text-sm",children:(0,s.jsx)(eC.A,{sceneId:a.id,currentScriptDayId:a.scriptDayId,isPR:!0})},e);case"pages":return(0,s.jsx)("td",{className:"border-t p-1.5 text-center",children:(0,s.jsx)(eS.A,{sceneId:a.id,currPageLength:a.pageLength,isPR:!0})},e);case"estTime":return(0,s.jsx)("td",{className:"my-auto w-[7.5%] whitespace-nowrap border-t px-1 text-center sm:text-xs 2xl:text-sm",children:(0,s.jsx)(ej.A,{sceneId:a.id,currentHours:a.hours,currentMinutes:a.minutes,isPR:!0})},e);case"shootTime":return(0,s.jsx)("td",{className:"my-auto w-[9%] whitespace-nowrap border-t px-1 text-center sm:text-xs 2xl:text-sm",children:(0,s.jsx)(eT.A,{sceneId:a.id,currentShootTime:a.shootTime,militaryTime:p,isPR:!0})},e);case"location":return(0,s.jsx)("td",{className:"my-auto w-[12%] whitespace-nowrap border-t pl-1 text-center sm:text-xs 2xl:text-sm",children:(0,s.jsx)(eN.A,{sceneId:a.id,currentLocationId:a.locationId,isPR:!0})},e)}}),(0,s.jsx)("td",{className:"border-t text-center",children:(0,s.jsx)(x.A,{onClick:()=>{w({callsheetId:v,prSceneId:r.id})},className:"h-5 w-5 rounded-full p-0.5 text-gray-500 hover:cursor-pointer hover:border hover:border-gray-300 hover:bg-gray-100"})})]})},eP=e=>{var t;let{allScenes:r,selectedScenes:a,advSelectedScenes:o,isAdvanced:i,isPRMode:x=!1,prSceneCSIds:p,csIdToPRSceneId:h}=e,g=(0,k.sf)(),b=d.F.useUtils(),f=(0,n.useRef)(null),j=(0,l.useRouter)(),w=j.query.callSheetId,C=j.query.callSheetGroupId,[I,T]=(0,n.use
1State)(""),[A,M]=(0,n.useState)(!1),[E,P]=(0,n.useState)(!1),[O,D]=(0,n.useState)(null),{mutate:F}=d.F.sceneCS.removeSceneFromCallSheet.useMutation({onSuccess:(e,t)=>{b.callsheets.get.invalidate({callsheetId:w}),b.talentCS.getTalent.invalidate({callSheetId:w}),(0,R.hB)("Saving..."),t.today?g.capture("removeScene_today_success"):g.capture("removeScene_advanced_success")},onError:(e,t)=>{t.today?g.capture("removeScene_today_fail"):g.capture("removeScene_advanced_fail")}}),{mutate:_}=d.F.sceneCS.addSceneToCallSheet.useMutation({onSuccess:(e,t)=>{b.callsheets.get.invalidate({callsheetId:w}),b.talentCS.getTalent.invalidate({callSheetId:w}),(0,R.hB)("Saving..."),t.today?g.capture("addScene_today_success"):g.capture("addScene_advanced_success")},onError:(e,t)=>{var r;let s=null==(r=e.data)?void 0:r.code;t.today?g.capture("addScene_today_fail"):g.capture("addScene_advanced_fail"),s&&"CONFLICT"===s?c.Ay.error("Scene already exists in callsheet"):c.Ay.error("Error adding scene to callsheet")}}),{mutate:L}=d.F.productionReport.addSceneToPR.useMutation({onSuccess:()=>{b.callsheets.get.invalidate({callsheetId:w}),b.productionReport.get.invalidate({callsheetId:w}),(0,R.hB)("Saving..."),g.capture("addSceneToPR_success")},onError:e=>{var t;let r=null==(t=e.data)?void 0:t.code;g.capture("addSceneToPR_fail"),r&&"CONFLICT"===r?c.Ay.error("Scene already exists in production report"):c.Ay.error("Error adding scene to production report")}}),{mutate:B}=d.F.productionReport.removeSceneFromPR.useMutation({onSuccess:()=>{b.callsheets.get.invalidate({callsheetId:w}),b.productionReport.get.invalidate({callsheetId:w}),(0,R.hB)("Saving..."),g.capture("removeSceneFromPR_success")},onError:()=>{g.capture("removeSceneFromPR_fail"),c.Ay.error("Error removing scene from production report")}}),{mutate:U,isPending:V}=d.F.sceneCS.createScene.useMutation({onSuccess:(e,t)=>{b.callsheets.get.invalidate({callsheetId:w}),b.sceneCS.getAll.invalidate({callSheetGroupId:C}),c.Ay.success("Scene created successfully"),t.today?g.capture("createScene_today_success"):g.capture("createScene_advanced_success")},onError:(e,t)=>{var r;e.data&&e.data.code&&(null==(r=e.data)?void 0:r.code)==="TOO_MANY_REQUESTS"?c.Ay.error("Too many requests. Please wait a moment before creating a scene again"):c.Ay.error("Error creating scene. Please try again."),t.today?g.capture("createScene_today_fail"):g.capture("createScene_advanced_fail")}}),{mutate:G,isPending:W}=d.F.sceneCS.createSceneForPR.useMutation({onSuccess:e=>{b.sceneCS.getAll.invalidate({callSheetGroupId:C}),L({callsheetId:w,sceneId:e.id}),g.capture("createSceneForPR_success")},onError:e=>{var t;e.data&&e.data.code&&(null==(t=e.data)?void 0:t.code)==="TOO_MANY_REQUESTS"?c.Ay.error("Too many requests. Please wait a moment before creating a scene again"):c.Ay.error("Error creating scene. Please try again."),g.capture("createSceneForPR_fail")}}),{mutate:H,isPending:K}=d.F.sceneCS.createBanner.useMutation({onSuccess:(e,t)=>{b.callsheets.get.invalidate({callsheetId:w}),b.sceneCS.getAll.invalidate({callSheetGroupId:C}),c.Ay.success("Banner created successfully"),t.today?g.capture("createBanner_today_success"):g.capture("createBanner_advanced_success")},onError:(e,t)=>{var r;e.data&&e.data.code&&(null==(r=e.data)?void 0:r.code)==="TOO_MANY_REQUESTS"?c.Ay.error("Too many requests. Please wait a moment before creating a banner again"):c.Ay.error("Error creating banner. Please try again."),t.today?g.capture("createBanner_today_fail"):g.capture("createBanner_advanced_fail")}}),{mutate:q,isPending:Q}=d.F.sceneCS.createBannerForPR.useMutation({onSuccess:e=>{b.sceneCS.getAll.invalidate({callSheetGroupId:C}),L({callsheetId:w,sceneId:e.id}),g.capture("createBannerForPR_success")},onError:e=>{var t;e.data&&e.data.code&&(null==(t=e.data)?void 0:t.code)==="TOO_MANY_REQUESTS"?c.Ay.error("Too many requests. Please wait a moment before creating a banner again"):c.Ay.error("Error creating banner. Please try again."),g.capture("createBannerForPR_fail")}});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eb,{isOpen:E,setIsOpen:P,sceneId:null!=(t=null==O?void 0:O.id)?t:""}),(0,s.jsxs)(S.AM,{open:A,onOpenChange:e=>{(e=>{var t;null==(t=f.current)||t.blur(),M(e)})(e),T("")},children:[(0,s.jsx)(S.Wv,{tabIndex:0,asChild:!0,children:(0,s.jsx)("button",{role:"combobox","aria-expanded":A,"aria-controls":"combobox-list",children:(0,s.jsx)(u.A,{className:"h-5 w-5 flex-shrink-0 text-primary hover:cursor-pointer hover:text-gray-600"})})}),(0,s.jsxs)(S.hl,{side:"right",align:"start",className:"w-[200px] p-0",children:[(0,s.jsxs)(N.uB,{children:[(0,s.jsx)("div",{className:"sticky top-0 z-20 my-2 flex h-11 w-full items-center bg-white px-1",children:(0,s.jsx)(N.G7,{ref:f,placeholder:"Search scenes...",className:"my-1 w-full",onValueChange:e=>{T(e)},value:I})}),(0,s.jsx)(N.oI,{children:(0,s.jsx)(N.L$,{heading:"Scenes",className:"max-h-[150px] overflow-auto",children:r&&0!==r.filter(e=>!e.banner).length?r.filter(e=>!e.banner).filter(e=>{if(!I)return!0;let t=I.toLowerCase(),r=e.sceneNumber.toLowerCase();if(r.startsWith(t))return!0;let s=t.replace(/[^0-9]/g,"");return r.replace(/[^0-9]/g,"").startsWith(s)}).map(e=>{let t=p?p.has(e.id):a.some(t=>t.id===e.id),r=o.some(t=>t.id===e.id);return(0,s.jsx)(N.h_,{value:"Scene ".concat(e.sceneNumber),className:(0,y.cn)(r&&"pointer-events-none opacity-50","group relative cursor-pointer"),children:(0,s.jsxs)("div",{className:"flex w-full items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex flex-1 items-center",onClick:()=>!r&&(e=>{var t;if(e&&e.id)if(p?p.has(e.id):a.some(t=>t.id===e.id))if(x&&p&&h){let t=h.get(e.id);t&&B({callsheetId:w,prSceneId:t})}else i?F({callsheetId:w,sceneId:e.id,today:!1}):F({callsheetId:w,sceneId:e.id,today:!0});else x?L({callsheetId:w,sceneId:e.id}):i?_({callsheetId:w,sceneId:e.id,today:!1}):_({callsheetId:w,sceneId:e.id,today:!0});
1null==f||null==(t=f.current)||t.focus()})(e),children:[(0,s.jsx)(v.A,{className:(0,y.cn)("mr-2 h-4 w-4",t?"opacity-100":"opacity-0")}),(0,s.jsx)("div",{className:"flex-1",children:(0,s.jsxs)("span",{className:(0,y.cn)("inline-flex items-center justify-center rounded-full border px-1.5 py-0.5 text-sm",r?"bg-gray-200 text-gray-500":"bg-slate-300 text-black"),children:["Scene ",e.sceneNumber]})})]}),(0,s.jsx)("div",{className:"flex items-center",children:(0,s.jsx)("div",{className:"flex gap-1",children:(0,s.jsx)(m.$n,{size:"icon",variant:"ghost",className:"mr-1 h-8 w-8 rounded-md border bg-slate-100 opacity-0 transition-opacity hover:bg-slate-300 group-hover:opacity-100",onClick:()=>{P(!0),D(e)},children:(0,s.jsx)(ex.A,{className:"h-3 w-3"})})})})]})},e.id)}):(0,s.jsx)(N.xL,{className:"py-4",children:(0,s.jsx)("div",{className:"text-center text-sm text-gray-500",children:"No scenes found."})})})})]}),(0,s.jsxs)("div",{className:"flex border-t",children:[(0,s.jsxs)("button",{disabled:V||W,onClick:()=>(()=>{let e=r.filter(e=>!e.banner).map(e=>parseInt(e.sceneNumber)).filter(e=>!isNaN(e)),t=(e.length>0?Math.max(...e):0)+1;x?G({callSheetGroupId:C,sceneNumber:t.toString()}):U({callSheetId:w,callSheetGroupId:C,sceneNumber:t.toString(),today:!i})})(),className:"flex h-10 flex-1 cursor-pointer items-center justify-center border-r py-2 text-sm hover:bg-slate-100 hover:text-slate-600",children:[(0,s.jsx)(u.A,{className:"mr-1.5 h-4 w-4 flex-shrink-0 text-primary"}),"Scene"]}),(0,s.jsxs)("button",{disabled:K||Q,onClick:()=>void(x?q({callSheetGroupId:C,bannerText:"New Banner"}):H({callSheetId:w,callSheetGroupId:C,bannerText:"New Banner",today:!i})),className:"flex h-10 flex-1 cursor-pointer items-center justify-center py-2 text-sm hover:bg-amber-50 hover:text-amber-700",children:[(0,s.jsx)(u.A,{className:"mr-1.5 h-4 w-4 flex-shrink-0 text-amber-600"}),"Banner"]})]})]})]})]})},eO=e=>{var t;let{selectedScenes:r,prScenes:a,prSceneOrder:o,episodePrefixes:i,callSheetGroupId:u,savedColumnVisibilityPR:x,compactSetSynopsis:m=!1,militaryTime:h=!1}=e,y=(0,l.useRouter)(),g=d.F.useUtils(),b=null!=u?u:y.query.callSheetGroupId,f=y.query.callSheetId,[v,j]=(0,n.useState)(r),[N,S]=(0,n.useState)(x?{...ek.WK,...x}:ek.WK),[w,C]=(0,n.useState)(null!=o?o:[]);(0,n.useEffect)(()=>{C(null!=o?o:[])},[o]);let{data:I,isLoading:T}=d.F.sceneCS.getAll.useQuery({callSheetGroupId:b},{initialData:[],enabled:!!b,refetchOnWindowFocus:!0,refetchOnReconnect:!0}),A=!!a&&!T,k=(0,n.useMemo)(()=>{if(!a)return[];if(!w||0===w.length)return a;let e=new Set(w);return[...w.map(e=>a.find(t=>t.id===e)).filter(e=>void 0!==e),...a.filter(t=>!e.has(t.id))]},[a,w]),M=(0,n.useMemo)(()=>a?new Set(a.filter(e=>e.sceneId).map(e=>e.sceneId)):new Set,[a]),E=(0,n.useMemo)(()=>{if(!a)return new Map;let e=new Map;return a.forEach(t=>{t.sceneId&&e.set(t.sceneId,t.id)}),e},[a]),{mutate:P}=d.F.callsheets.updateColumnVisibilityPR.useMutation({onSuccess:()=>{g.callsheets.getAll.invalidate({callSheetGroupId:b})}}),{mutate:O}=d.F.productionReport.updateSceneOrder.useMutation({onSuccess:()=>{(0,R.hB)("Saving..."),g.productionReport.get.invalidate({callsheetId:f})},onError:()=>{c.Ay.error("Error updating scene order"),C(null!=o?o:[])}});(0,n.useEffect)(()=>{A||j(r)},[r,A]),(0,n.useEffect)(()=>{x&&S({...ek.WK,...x})},[x]);let D=(0,n.useCallback)(e=>{S(e),b&&P({callSheetGroupId:b,columnVisibilityPR:e})},[b,P]),F=(0,n.useRef)(N);(0,n.useEffect)(()=>{F.current=N},[N]);let _=(0,n.useCallback)((e,t)=>{S(r=>{let s=(0,ek.Cq)(r),[l]=s.splice(e,1);return l?(s.splice(t,0,l),{...r,columnOrder:s}):r})},[]),L=(0,n.useCallback)(()=>{b&&P({callSheetGroupId:b,columnVisibilityPR:F.current})},[b,P]),B=(e,t)=>{if(A)return void C(r=>{let s=[...r],[l]=s.splice(e,1);return l&&s.splice(t,0,l),s});j(r=>{let s=[...r],[l]=s.splice(e,1);return s.splice(t,0,null!=l?l:{}),s})},U=(0,n.useCallback)(()=>{A&&w.length>0&&O({callsheetId:f,sceneOrder:w})},[A,w,f,O]),V=A?k.map(e=>e.id):v.map(e=>e.id),G=A?k.reduce((e,t)=>e+(t.pageLength||0),0):v.reduce((e,t)=>e+(t.pageLength||0),0),W=Math.floor(G),H=Math.round((G-W)*8),K=0===H?"".concat(W):"".concat(0!==W?"".concat(W," "):"").concat(H,"/8"),q=(0,ek.kL)(N);
1return(0,s.jsxs)(p.Zp,{children:[(0,s.jsx)(p.aR,{className:"bg-gray-100",children:(0,s.jsxs)(p.ZB,{className:"flex h-2 items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(eu,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"text-base",children:"Scheduled Scenes"}),(0,s.jsx)(eP,{allScenes:I,selectedScenes:v,advSelectedScenes:[],isAdvanced:!1,isPRMode:!0,prSceneCSIds:M,csIdToPRSceneId:E})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)(ek.rt,{columnVisibility:N,onColumnVisibilityChange:D,onMoveColumn:_,onColumnOrderCommit:L}),(0,s.jsxs)("span",{className:"text-sm",children:["Total Pages: ",K]})]})]})}),(0,s.jsx)(p.Wu,{className:"p-0",children:(0,s.jsxs)("table",{className:"w-full",children:[(0,s.jsx)("thead",{className:"bg-gray-200",children:(0,s.jsxs)("tr",{className:"text-center text-sm font-medium text-gray-600",children:[(0,ek.pA)(N).map(e=>(0,s.jsx)("th",{className:"p-3",children:"setSynopsis"===e?N.synopsis?"Set/Synopsis":"Set":ek.jq[e]},e)),(0,s.jsx)("th",{className:"w-8 p-2"})]})}),(0,s.jsx)("tbody",{children:A?k.length>0?k.map((e,t)=>{let r=I.find(t=>t.id===e.sceneId);return(0,s.jsx)(eE,{prScene:e,linkedScene:r,columnVisibility:N,episodePrefixes:i,compactSetSynopsis:m,militaryTime:h,index:t,moveRow:B,onDragEnd:U},e.id)}):(0,s.jsx)("tr",{children:(0,s.jsx)("td",{className:"border-t p-3",colSpan:q,children:(0,s.jsx)("div",{className:"text-center italic text-gray-500",children:"No scenes scheduled"})})}):(null!=(t=v.length)?t:0)>0?v.map((e,t)=>(0,s.jsx)(eM,{scene:e,index:t,moveRow:B,sceneIds:V,isAdvanced:!1,episodePrefixes:i,columnVisibility:N,compactSetSynopsis:m,militaryTime:h},e.id)):(0,s.jsx)("tr",{children:(0,s.jsx)("td",{className:"border-t p-3",colSpan:q,children:(0,s.jsx)("div",{className:"text-center italic text-gray-500",children:"No scenes scheduled"})})})})]})})]})},eD=e=>{let t=Math.floor(e),r=Math.round(8*(e-t));return 0===r?"".concat(t):0===t?"".concat(r,"/8"):"".concat(t," ").concat(r,"/8")},eF=[{value:0,label:"0/8"},{value:1,label:"1/8"},{value:2,label:"2/8"},{value:3,label:"3/8"},{value:4,label:"4/8"},{value:5,label:"5/8"},{value:6,label:"6/8"},{value:7,label:"7/8"}],e_=e=>{let{value:t,onChange:r}=e,[l,a]=(0,n.useState)(!1),[c,o]=(0,n.useState)(""),[d,i]=(0,n.useState)(0);return(0,s.jsxs)(S.AM,{open:l,onOpenChange:e=>{if(e){let e=Math.floor(t),r=Math.round((t-e)*8);o(0===e?"":String(e)),i(r)}else{let e=(""===c?0:parseInt(c)||0)+d/8;e!==t&&r(e)}a(e)},children:[(0,s.jsx)(S.Wv,{asChild:!0,children:(0,s.jsx)("button",{type:"button",className:"w-16 px-1 py-0.5 text-center text-xs hover:bg-gray-50",children:eD(t)})}),(0,s.jsx)(S.hl,{className:"w-40 p-3",align:"center",onOpenAutoFocus:e=>e.preventDefault(),onInteractOutside:()=>{},children:(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"mb-1 block text-xs font-medium text-gray-600",children:"Whole Pages"}),(0,s.jsx)("input",{type:"text",inputMode:"numeric",value:c,onChange:e=>o(e.target.value.replace(/[^0-9]/g,"")),className:"w-full rounded border border-gray-300 px-2 py-1 text-center text-sm"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"mb-1 block text-xs font-medium text-gray-600",children:"Eighths"}),(0,s.jsx)("select",{value:d,onChange:e=>i(parseInt(e.target.value)),className:"w-full rounded border border-gray-300 px-2 py-1 text-center text-sm",children:eF.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))})]})]})})]})},eL=e=>{let{callSheetId:t,callSheetGroupId:r,isEditable:l=!0}=e,a=(0,n.useRef)(!1),c=(0,n.useRef)(!1),[o,i]=(0,n.useState)(null),[u,x]=(0,n.useState)(""),[m,h]=(0,n.useState)({scenes:0,pages:0,setups:0,minutes:"-"}),[y,g]=(0,n.useState)({scenes:0,pages:0,setups:0,minutes:"0:00:00"}),[b,f]=(0,n.useState)({scenes:0,pages:0,setups:0,minutes:"0:00:00"}),[v,j]=(0,n.useState)({aCam:0,bCam:0,cCam:0,sound:0}),[N,S]=(0,n.useState)({aCam:0,bCam:0,cCam:0,sound:0}),[w,C]=(0,n.useState)({scheduledScenesShot:"",scheduledNotShot:"",addedScenes:"",retakes:"",scenesOmitted:""}),{data:I}=d.F.productionReport.get.useQuery({callsheetId:t},{enabled:!!t}),{data:T}=d.F.callsheets.getAll.useQuery({callSheetGroupId:r},{enabled:!!r});(0,n.useEffect)(()=>{a.current=!1,c.current=!1},[t]),(0,n.useEffect)(()=>{T&&!c.current&&(c.current=!0,h(e=>{var t,r;return{...e,scenes:null!=(t=T.scriptTotalScenes)?t:0,pages:null!=(r=T.scriptTotalPages)?r:0}}))},[T]),(0,n.useEffect)(()=>{I&&!a.current&&(a.current=!0,h(e=>({...e,setups:I.scriptTotalSetups||0})),g({scenes:I.previouslyShotScenes||0,pages:I.previouslyShotPages||0,setups:I.previouslyShotSetups||0,minutes:I.previouslyShotMinutes||"0:00:00"}),f({scenes:I.todayShotScenes||0,pages:I.todayShotPages||0,setups:I.todayShotSetups||0,minutes:I.todayShotMinutes||"0:00:00"}),j({aCam:I.rollsPreviouslyACam||0,bCam:I.rollsPreviouslyBCam||0,cCam:I.rollsPreviouslyCCam||0,sound:I.rollsPreviouslySound||0}),S({aCam:I.rollsTodayACam||0,bCam:I.rollsTodayBCam||0,cCam:I.rollsTodayCCam||0,sound:I.rollsTodaySound||0}),C({scheduledScenesShot:I.scheduledScenesShot||"",scheduledNotShot:I.scheduledScenesNotShot||"",addedScenes:I.addedScenes||"",retakes:I.retakeScenes||"",scenesOmitted:I.omittedScenes||""}))},[I]);let A=d.F.useUtils(),{mutate:k}=d.F.productionReport.updateScriptProgress.useMutation({onSuccess:()=>{A.productionReport.get.invalidate({callsheetId:t})}}),{mutate:R}=d.F.callsheets.updateScriptTotals.useMutation({onSuccess:()=>
1{A.callsheets.getAll.invalidate({callSheetGroupId:r})}}),M=(0,n.useCallback)(e=>{var r,s,l,a,n,c,o,d,i,u,x,p,h,g,f,j,S,C,I,T,A,R,M,E,P,O,D,F,_,L,B,U,V,G,W,H,K,q,Q,Z,$,z,X;k({callsheetId:t,scriptTotalSetups:null!=(R=e.scriptTotalSetups)?R:m.setups,previouslyShotScenes:null!=(M=null==(r=e.previouslyShot)?void 0:r.scenes)?M:y.scenes,previouslyShotPages:null!=(E=null==(s=e.previouslyShot)?void 0:s.pages)?E:y.pages,previouslyShotSetups:null!=(P=null==(l=e.previouslyShot)?void 0:l.setups)?P:y.setups,previouslyShotMinutes:null!=(O=null==(a=e.previouslyShot)?void 0:a.minutes)?O:y.minutes,todayShotScenes:null!=(D=null==(n=e.today)?void 0:n.scenes)?D:b.scenes,todayShotPages:null!=(F=null==(c=e.today)?void 0:c.pages)?F:b.pages,todayShotSetups:null!=(_=null==(o=e.today)?void 0:o.setups)?_:b.setups,todayShotMinutes:null!=(L=null==(d=e.today)?void 0:d.minutes)?L:b.minutes,rollsPreviouslyACam:null!=(B=null==(i=e.rollsPreviously)?void 0:i.aCam)?B:v.aCam,rollsPreviouslyBCam:null!=(U=null==(u=e.rollsPreviously)?void 0:u.bCam)?U:v.bCam,rollsPreviouslyCCam:null!=(V=null==(x=e.rollsPreviously)?void 0:x.cCam)?V:v.cCam,rollsPreviouslySound:null!=(G=null==(p=e.rollsPreviously)?void 0:p.sound)?G:v.sound,rollsTodayACam:null!=(W=null==(h=e.rollsToday)?void 0:h.aCam)?W:N.aCam,rollsTodayBCam:null!=(H=null==(g=e.rollsToday)?void 0:g.bCam)?H:N.bCam,rollsTodayCCam:null!=(K=null==(f=e.rollsToday)?void 0:f.cCam)?K:N.cCam,rollsTodaySound:null!=(q=null==(j=e.rollsToday)?void 0:j.sound)?q:N.sound,scheduledScenesShot:null!=(Q=null==(S=e.specifics)?void 0:S.scheduledScenesShot)?Q:w.scheduledScenesShot,scheduledScenesNotShot:null!=(Z=null==(C=e.specifics)?void 0:C.scheduledNotShot)?Z:w.scheduledNotShot,addedScenes:null!=($=null==(I=e.specifics)?void 0:I.addedScenes)?$:w.addedScenes,retakeScenes:null!=(z=null==(T=e.specifics)?void 0:T.retakes)?z:w.retakes,omittedScenes:null!=(X=null==(A=e.specifics)?void 0:A.scenesOmitted)?X:w.scenesOmitted})},[t,k,m.setups,y,b,v,N,w]),E=(0,n.useCallback)((e,t)=>{R({callSheetGroupId:r,scriptTotalScenes:e,scriptTotalPages:t})},[r,R]),P=(e,t)=>{i(e),x(String(0===t?"":t))},O=(e,t)=>{"Enter"===e.key?(e.preventDefault(),t()):"Escape"===e.key&&(e.preventDefault(),i(null),x(""))},D={scenes:y.scenes+b.scenes,pages:y.pages+b.pages,setups:y.setups+b.setups,minutes:function(e,t){if("-"===e||"-"===t)return"-"===e?t:e;let r=e.split(":").map(Number),s=t.split(":").map(Number);if(3!==r.length||3!==s.length)return"-";let[l=0,a=0,n=0]=r,[c=0,o=0,d=0]=s,i=(l+c)*3600+(a+o)*60+(n+d),u=Math.floor(i/3600),x=Math.floor((i%=3600)/60),p=i%60;return"".concat(u,":").concat(String(x).padStart(2,"0"),":").concat(String(p).padStart(2,"0"))}(y.minutes,b.minutes)},F={scenes:m.scenes-D.scenes,pages:m.pages-D.pages,setups:0,minutes:"-"},_={aCam:v.aCam+N.aCam,bCam:v.bCam+N.bCam,cCam:v.cCam+N.cCam,sound:v.sound+N.sound},L=function(e,t,r){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return l?o===e?(0,s.jsx)("input",{type:"text",inputMode:"numeric",autoFocus:!0,value:u,onChange:e=>x(e.target.value.replace(/[^0-9.-]/g,"")),onBlur:()=>{let e=parseFloat(u)||0;e!==t&&r(e),i(null)},onKeyDown:e=>O(e,()=>{let e=parseFloat(u)||0;e!==t&&r(e),i(null)}),className:"h-4 w-9 rounded border border-gray-300 bg-white py-0 px-2 text-center text-xs ".concat(a?"font-bold":""," focus:border-blue-400 focus:outline-none")}):(0,s.jsx)("span",{onClick:()=>P(e,t),className:"cursor-pointer text-xs hover:text-blue-600 ".concat(a?"font-bold":"font-medium"),children:0===t?"â":t}):(0,s.jsx)("span",{className:"text-xs ".concat(a?"font-bold":"font-medium"),children:t})},B=function(e,t,r){arguments.length>3&&void 0!==arguments[3]&&arguments[3];let a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return l?o===e?(0,s.jsx)("input",{type:"text",autoFocus:!0,value:u,onChange:e=>x(e.target.value),onBlur:()=>{u!==t&&r(u),i(null)},onKeyDown:e=>O(e,()=>{u!==t&&r(u),i(null)}),className:"h-5 w-12 rounded border border-gray-300 bg-white px-1 text-center text-xs ".concat(a?"font-bold":""," focus:border-blue-400 focus:outline-none")}):(0,s.jsx)("span",{onClick:()=>P(e,t),className:"cursor-pointer text-xs hover:text-blue-600 ".concat(a?"font-bold":""),children:t||"â"}):(0,s.jsx)("span",{className:"text-xs ".concat(a?"font-bold":""),children:t})},U=function(e,t,r){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return l?(0,s.jsx)(e_,{value:t,onChange:e=>{e!==t&&r(e)}}):(0,s.jsx)("span",{className:"text-xs ".concat(a?"font-bold":"font-medium"),children:eD(t)})},V=(e,t,r)=>l?o===e?(0,s.jsx)("input",{type:"text",autoFocus:!0,value:u,onChange:e=>x(e.target.value),onBlur:()=>{u!==t&&r(u),i(null)},onKeyDown:e=>O(e,()=>{u!==t&&r(u),i(null)}),className:"h-5 w-full rounded border border-gray-300 bg-white px-1 text-xs focus:border-blue-400 focus:outline-none"}):(0,s.jsx)("div",{onClick:()=>P(e,t),className:"flex h-5 w-full cursor-pointer items-center px-1 text-xs hover:text-blue-600",children:t||"â"}):(0,s.jsx)("span",{className:"text-xs",children:t||"-"});
1return(0,s.jsxs)(p.Zp,{children:[(0,s.jsx)(p.aR,{className:"bg-gray-100 py-2",children:(0,s.jsxs)(p.ZB,{className:"flex items-center gap-2",children:[(0,s.jsx)(ee.A,{className:"h-4 w-4 text-gray-700"}),(0,s.jsx)("span",{className:"text-base text-gray-700",children:"Script Progress"})]})}),(0,s.jsx)(p.Wu,{className:"p-0",children:(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-0",style:{alignItems:"stretch"},children:[(0,s.jsxs)("div",{className:"border-r border-gray-300",children:[(0,s.jsx)("div",{className:"border-b border-gray-300 bg-gray-200 px-2 py-1.5 text-center text-xs font-bold text-gray-700",children:"Coverage"}),(0,s.jsxs)("table",{className:"w-full text-xs",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"border-b bg-gray-100",children:[(0,s.jsx)("th",{className:"px-2 py-1.5 text-left font-medium text-gray-600"}),(0,s.jsx)("th",{className:"px-1 py-1.5 text-center font-medium text-gray-600",children:"Scenes"}),(0,s.jsx)("th",{className:"px-1 py-1.5 text-center font-medium text-gray-600",children:"Pages"}),(0,s.jsx)("th",{className:"px-1 py-1.5 text-center font-medium text-gray-600",children:"Setups"}),(0,s.jsx)("th",{className:"px-1 py-1.5 text-center font-medium text-gray-600",children:"Minutes"})]})}),(0,s.jsxs)("tbody",{children:[(0,s.jsxs)("tr",{className:"border-b",children:[(0,s.jsx)("td",{className:"px-2 py-1.5 font-medium",children:"Script Total"}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center",children:L("scriptTotal.scenes",m.scenes,e=>{h(t=>({...t,scenes:e})),E(e,m.pages)})}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center",children:U("scriptTotal.pages",m.pages,e=>{h(t=>({...t,pages:e})),E(m.scenes,e)})}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center text-xs text-gray-400",children:"-"}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center text-xs text-gray-400",children:"-"})]}),(0,s.jsxs)("tr",{className:"border-b",children:[(0,s.jsx)("td",{className:"px-2 py-1.5 font-medium",children:"Previously Shot"}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center",children:L("prev.scenes",y.scenes,e=>{let t={...y,scenes:e};g(t),M({previouslyShot:t})})}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center",children:U("prev.pages",y.pages,e=>{let t={...y,pages:e};g(t),M({previouslyShot:t})})}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center",children:L("prev.setups",y.setups,e=>{let t={...y,setups:e};g(t),M({previouslyShot:t})})}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center",children:B("prev.minutes",y.minutes,e=>{let t={...y,minutes:e};g(t),M({previouslyShot:t})},"w-16")})]}),(0,s.jsxs)("tr",{className:"border-b bg-gray-50",children:[(0,s.jsx)("td",{className:"px-2 py-1.5 font-bold",children:"Today"}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center font-bold",children:L("today.scenes",b.scenes,e=>{let t={...b,scenes:e};f(t),M({today:t})},!0)}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center font-bold",children:U("today.pages",b.pages,e=>{let t={...b,pages:e};f(t),M({today:t})},!0)}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center font-bold",children:L("today.setups",b.setups,e=>{let t={...b,setups:e};f(t),M({today:t})},!0)}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center font-bold",children:B("today.minutes",b.minutes,e=>{let t={...b,minutes:e};f(t),M({today:t})},"w-16",!0)})]}),(0,s.jsxs)("tr",{className:"border-b",children:[(0,s.jsx)("td",{className:"px-2 py-1.5 font-medium",children:"To Date"}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center text-xs",children:D.scenes}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center text-xs",children:eD(D.pages)}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center text-xs",children:D.setups}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center text-xs",children:D.minutes})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{className:"px-2 py-1.5 font-medium",children:"Remaining"}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center text-xs",children:F.scenes}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center text-xs",children:eD(F.pages)}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center text-xs text-gray-400",children:"-"}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center text-xs text-gray-400",children:"-"})]})]})]})]}),(0,s.jsxs)("div",{className:"border-r border-gray-300",children:[(0,s.jsx)("div",{className:"border-b border-gray-300 bg-gray-200 px-2 py-1.5 text-center text-xs font-bold text-gray-700",children:"Rolls"}),(0,s.jsxs)("table",{className:"w-full text-xs",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"border-b bg-gray-100",children:[(0,s.jsx)("th",{className:"px-2 py-1.5 text-left font-medium text-gray-600"}),(0,s.jsx)("th",{className:"px-1 py-1.5 text-center font-medium text-gray-600",children:"A Cam"}),(0,s.jsx)("th",{className:"px-1 py-1.5 text-center font-medium text-gray-600",children:"B Cam"}),(0,s.jsx)("th",{className:"px-1 py-1.5 text-center font-medium text-gray-600",children:"C Cam"}),(0,s.jsx)("th",{className:"px-1 py-1.5 text-center font-medium text-gray-600",children:"Sound"})]})}),(0,s.jsxs)("tbody",{children:[(0,s.jsxs)("tr",{className:"border-b",children:[(0,s.jsx)("td",{className:"px-2 py-1.5 pl-4 font-medium",children:"Previously"}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center",children:L("rollsPrev.aCam",v.aCam,e=>{let t={...v,aCam:e};j(t),M({rollsPreviously:t})})}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center",children:L("rollsPrev.bCam",v.bCam,e=>{let t={...v,bCam:e};j(t),M({rollsPreviously:t})})}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center",children:L("rollsPrev.cCam",v.cCam,e=>{let t={...v,cCam:e};j(t),M({rollsPreviously:t})})}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center",children:L("rollsPrev.sound",v.sound,e=>{let t={...v,sound:e};j(t),M({rollsPreviously:t})})})]}),(0,s.jsxs)("tr",{className:"border-b bg-gray-50",children:[(0,s.jsx)("td",{className:"px-2 py-1.5 pl-4 font-bold",children:"Today"}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center font-bold",children:L("rollsToday.aCam",N.aCam,e=>{let t={...N,aCam:e};S(t),M({rollsToday:t})},!0)}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center font-bold",children:L("rollsToday.bCam",N.bCam,e=>{let t={...N,bCam:e};S(t),M({rollsToday:t})},!0)}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center font-bold",children:L("rollsToday.cCam",N.cCam,e=>{let t={...N,cCam:e};S(t),M({rollsToday:t})},!0)}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center font-bold",children:L("rollsToday.sound",N.sound,e=>{let t={...N,sound:e};S(t),M({rollsToday:t})},!0)})]}),(0,s.jsxs)("tr",{className:"border-b",children:[(0,s.jsx)("td",{className:"px-2 py-1.5 pl-4 font-medium",children:"To Date"}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center text-xs",children:_.aCam}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center text-xs",children:_.bCam}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center text-xs",children:_.cCam}),(0,s.jsx)("td",{className:"px-1 py-1.5 text-center text-xs",children:_.sound})]})]})]})]}),(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("div",{className:"border-b border-gray-300 bg-gray-200 px-2 py-1.5 text-center text-xs font-bold text-gray-700",children:"Specifics"}),(0,s.jsxs)("div",{className:"flex flex-1 flex-col justify-between p-2 text-xs",children:[(0,s.jsxs)("div",{className:"flex h-7 items-center gap-1 border-b border-gray-200",children:[(0,s.jsx)("span",{className:"w-[75px] shrink-0 text-[10px] font-semibold text-gray-700",children:"SCENES SHOT:"}),(0,s.jsx)("div",{className:"flex-1",children:V("scheduledScenesShot",w.scheduledScenesShot,e=>{let t={...w,scheduledScenesShot:e};C(t),M({specifics:t})})})]}),(0,s.jsxs)("div",{className:"flex h-7 items-center gap-1 border-b border-gray-200",children:[(0,s.jsx)("span",{className:"w-[75px] shrink-0 text-[10px] font-semibold text-gray-700",children:"NOT SHOT:"}),(0,s.jsx)("div",{className:"flex-1",children:V("scheduledNotShot",w.scheduledNotShot,e=>{let t={...w,scheduledNotShot:e};C(t),M({specifics:t})})})]}),(0,s.jsxs)("div",{className:"flex h-7 items-center gap-1 border-b border-gray-200",children:[(0,s.jsx)("span",{className:"w-[75px] shrink-0 text-[10px] font-semibold text-gray-700",children:"ADDED:"}),(0,s.jsx)("div",{className:"flex-1",children:V("addedScenes",w.addedScenes,e=>{let t={...w,addedScenes:e};C(t),M({specifics:t})})})]}),(0,s.jsxs)("div",{className:"flex h-7 items-center gap-1 border-b border-gray-200",children:[(0,s.jsx)("span",{className:"w-[75px] shrink-0 text-[10px] font-semibold text-gray-700",children:"RETAKES:"}),(0,s.jsx)("div",{className:"flex-1",children:V("retakes",w.retakes,e=>{let t={...w,retakes:e};C(t),M({specifics:t})})})]}),(0,s.jsxs)("div",{className:"flex h-7 items-center gap-1",children:[(0,s.jsx)("span",{className:"w-[75px] shrink-0 text-[10px] font-semibold text-gray-700",children:"OMITTED:"}),(0,s.jsx)("div",{className:"flex-1",children:V("scenesOmitted",w.scenesOmitted,e=>{let t={...w,scenesOmitted:e};C(t),M({specifics:t})})})]})]})]})]})})]})},eB=e=>{var t,r,a,n,c,o;let{callSheetData:i,selectedScenes:u,talentData:x,episodePrefixes:p,projectTitle:m,totalDays:h,sectionView:y,productionStartDate:b,productionEndDate:f,logoUrl:v,callSheetGroupId:j,prCrewColumns:N=3,columnVisibilityPR:S,prCrewSectionOrder:w,prCrewSectionVisibility:C,prCrewSectionLabels:I}=e,A=(0,l.useRouter)(),k=A.query.callSheetId,R=null!=j?j:A.query.callSheetGroupId,{data:M}=d.F.productionReport.get.useQuery({callsheetId:k},{enabled:!!k}),E=null==M||null==(t=M.scenes)?void 0:t.map(e=>({id:e.id,sceneId:e.sceneId,sceneNumber:e.sceneNumber,episode:e.episode,setDescription:e.setDescription,synopsis:e.synopsis,location:e.location,pageLength:e.pageLength,status:e.status})),P=null!=(r=null==M?void 0:M.sceneOrder)?r:[];return(0,s.jsx)("div",{className:"min-h-screen bg-gray-100 py-10",children:(0,s.jsxs)("div",{className:"mx-auto flex w-[95%] max-w-[1400px] flex-col gap-8",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-4 border border-slate-400 bg-white px-8 py-8 shadow-xl",children:[(0,s.jsx)(z,{callSheetId:k,callSheetData:i,projectTitle:m,totalDays:h,productionStartDate:b,productionEndDate:f,showActualVsScheduled:null==(a=y.showActualVsScheduled)||a,logoUrl:v}),(0,s.jsx)(ei,{callSheetId:k,showMeal2:null==(n=y.showMeal2)||n,militaryTime:y.militaryTime}),(0,s.jsx)(eL,{callSheetId:k,callSheetGroupId:R}),(0,s.jsx)(eO,{selectedScenes:u,prScenes:E,prSceneOrder:P,episodePrefixes:p,callSheetGroupId:R,savedColumnVisibilityPR:S,compactSetSynopsis:y.compactSetSynopsis,militaryTime:y.militaryTime}),y.showCastSection&&(0,s.jsx)(T,{callSheetId:k,callSheetGroupId:R,talentData:x,showMeal2:null==(c=y.showMeal2)||c,showTravel:null==(o=y.showTravel)||o,militaryTime:y.militaryTime}
1),y.showBackgroundSection&&(0,s.jsx)(g,{callSheetId:k,militaryTime:y.militaryTime})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-4 border border-slate-400 bg-white px-8 py-8 shadow-xl",children:[y.showCrewSection&&(0,s.jsx)(G,{callSheetId:k,callSheetGroupId:R,initialPRCrewColumns:N,militaryTime:y.militaryTime,initialPRCrewSectionOrder:w,initialPRCrewSectionVisibility:null!=C?C:null,initialPRCrewSectionLabels:null!=I?I:null}),y.showNotesSection&&(0,s.jsx)(ec,{callSheetId:k})]})]})})},eU="<p></p>",eV=e=>{let{content:t}=e,r=(0,K.hG)({extensions:Z.X,content:t,editable:!1,immediatelyRender:!1});return(0,n.useEffect)(()=>{r&&r.getHTML()!==t&&r.commands.setContent(t)},[t,r]),(0,s.jsx)(K.$Z,{editor:r})},eG=e=>{let{notes:t}=e,{columns:r,columnCount:l}=(e=>{if(!e||""===e)return{columns:[eU,eU,eU],columnCount:1};try{let t=JSON.parse(e);if(t.columns&&Array.isArray(t.columns))return{columns:[t.columns[0]||eU,t.columns[1]||eU,t.columns[2]||eU],columnCount:t.columnCount||1}}catch(e){}return{columns:[e,eU,eU],columnCount:1}})(t),a=r.every(e=>!e||e===eU||""===e.replace(/<[^>]*>/g,"").trim());return(0,s.jsxs)("div",{className:"avoid-break overflow-hidden rounded border border-gray-400",children:[(0,s.jsx)("div",{className:"border-b border-gray-400 bg-gray-100 px-2 py-1 text-xs font-bold",children:"Notes / Explanations"}),(0,s.jsx)("div",{className:"p-2 text-2xs",children:a?(0,s.jsx)("div",{dangerouslySetInnerHTML:{__html:"<p>1) Safety Meeting Held at _______ on site.</p>\n<p>2)</p>\n<p>3)</p>\n<p>4)</p>\n<p>5)</p>"}}):(0,s.jsxs)("div",{className:"flex gap-2 ".concat(l>1?"divide-x divide-gray-300":""),children:[(0,s.jsx)("div",{className:"flex-1",children:(0,s.jsx)(eV,{content:r[0]})}),l>=2&&(0,s.jsx)("div",{className:"flex-1 pl-2",children:(0,s.jsx)(eV,{content:r[1]})}),l>=3&&(0,s.jsx)("div",{className:"flex-1 pl-2",children:(0,s.jsx)(eV,{content:r[2]})})]})})]})},eW=e=>{if(!e)return"0";let t=Math.floor(e),r=Math.round(8*(e-t));return 0===r?"".concat(t):0===t?"".concat(r,"/8"):"".concat(t," ").concat(r,"/8")},eH=(0,n.forwardRef)((e,t)=>{var r,l,a,n,c,o,d,i,u,x,p,m,h,g,b,f,v,j,N;let{callSheetData:S,selectedScenes:w,talentData:C,episodePrefixes:I,projectTitle:T,totalDays:A,productionStartDate:k,productionEndDate:M,sectionView:E,prData:P,callSheetGroupId:O,prCrewColumns:D=3,logoUrl:F,allSets:_=[],allLocations:B=[],allScriptDays:U=[],scriptTotalScenes:V=0,scriptTotalPages:G=0,columnVisibility:W=ek.WK,prCrewSectionOrder:H,prCrewSectionVisibility:K,prCrewSectionLabels:Q}=e,Z=(null==S?void 0:S.date)?(0,q.A)(new Date(S.date),"EEEE, MMMM d, yyyy"):"",z=e=>{if(!e||!I)return"";let t=I[e];return t?"".concat(t):""},X=null!=(r=null==P?void 0:P.sceneOrder)?r:[],Y=(()=>{if(!(null==P?void 0:P.scenes))return[];if(0===X.length)return P.scenes;let e=new Set(X);return[...X.map(e=>P.scenes.find(t=>t.id===e)).filter(e=>void 0!==e),...P.scenes.filter(t=>!e.has(t.id))]})(),J=new Map(w.map(e=>[e.id,e])),ee=Y.length>0,et=e=>e&&"-"!==e&&"N/A"!==e?(0,R.fU)(e,E.militaryTime):"-",er=e=>et(e).replace(/AM/g,"A").replace(/PM/g,"P"),es=e=>e&&"-"!==e&&""!==e&&"N/A"!==e?(0,R.fU)(e,E.militaryTime):"-",el=e=>es(e).replace(/AM/g,"A").replace(/PM/g,"P"),ea={crewCall:et(null==P?void 0:P.crewCall),scheduledShootingCall:et(null==P?void 0:P.scheduledShootingCall),actualFirstShot:et(null==P?void 0:P.actualFirstShot),firstMealIn:et(null==P?void 0:P.firstMealIn),firstMealOut:et(null==P?void 0:P.firstMealOut),firstShotAfterLunch:et(null==P?void 0:P.firstShotAfterLunch),secondMealIn:es(null==P?void 0:P.secondMealIn),secondMealOut:es(null==P?void 0:P.secondMealOut),cameraWrap:et(null==P?void 0:P.cameraWrap),lastPersonOut:et(null==P?void 0:P.lastPersonOut)},en={scriptTotalScenes:V,scriptTotalPages:G,scriptTotalSetups:(null==P?void 0:P.scriptTotalSetups)||0,previouslyShotScenes:(null==P?void 0:P.previouslyShotScenes)||0,previouslyShotPages:(null==P?void 0:P.previouslyShotPages)||0,previouslyShotSetups:(null==P?void 0:P.previouslyShotSetups)||0,previouslyShotMinutes:(null==P?void 0:P.previouslyShotMinutes)||"0:00:00",todayShotScenes:(null==P?void 0:P.todayShotScenes)||0,todayShotPages:(null==P?void 0:P.todayShotPages)||0,todayShotSetups:(null==P?void 0:P.todayShotSetups)||0,todayShotMinutes:(null==P?void 0:P.todayShotMinutes)||"0:00:00",rollsPreviouslyACam:(null==P?void 0:P.rollsPreviouslyACam)||0,rollsPreviouslyBCam:(null==P?void 0:P.rollsPreviouslyBCam)||0,rollsPreviouslyCCam:(null==P?void 0:P.rollsPreviouslyCCam)||0,rollsPreviouslySound:(null==P?void 0:P.rollsPreviouslySound)||0,rollsTodayACam:(null==P?void 0:P.rollsTodayACam)||0,rollsTodayBCam:(null==P?void 0:P.rollsTodayBCam)||0,rollsTodayCCam:(null==P?void 0:P.rollsTodayCCam)||0,rollsTodaySound:(null==P?void 0:P.rollsTodaySound)||0,scheduledScenesShot:(null==P?void 0:P.scheduledScenesShot)||"-",scheduledScenesNotShot:(null==P?void 0:P.scheduledScenesNotShot)||"-",addedScenes:(null==P?void 0:P.addedScenes)||"-",retakeScenes:(null==P?void 0:P.retakeScenes)||"-",omittedScenes:(null==P?void 0:P.omittedScenes)||"-"},ec=en.previouslyShotScenes+en.todayShotScenes,eo=en.previouslyShotPages+en.todayShotPages,ed=en.previouslyShotSetups+en.todayShotSetups,ei=en.scriptTotalScenes-ec,eu=en.scriptTotalPages-eo,ex=en.rollsPreviouslyACam+en.rollsTodayACam,ep=e
1n.rollsPreviouslyBCam+en.rollsTodayBCam,em=en.rollsPreviouslyCCam+en.rollsTodayCCam,eh=en.rollsPreviouslySound+en.rollsTodaySound,ey=null!=(l=null==P?void 0:P.castTimes)?l:[],eg=new Map;C.forEach(e=>{e.talentMappingId&&e.publicId&&eg.set(e.talentMappingId,e.publicId)});let eb=new Map;_.forEach(e=>{eb.set(e.id,e.setName)});let ef=new Map;B.forEach(e=>{ef.set(e.id,e.locationName)});let ev=new Map;U.forEach(e=>{ev.set(e.id,e.scriptDay)});let ej=null!=(a=null==P?void 0:P.background)?a:[],eN=null!=(n=null==P?void 0:P.crew)?n:[],eS=(null==P?void 0:P.notes)||"";return(0,s.jsxs)("div",{ref:t,className:"mx-auto flex w-full flex-col gap-1.5 bg-white p-4",children:[(0,s.jsx)("style",{children:"\n @media print {\n .first-page {\n page-break-after: always;\n }\n \n .avoid-break {\n page-break-inside: avoid;\n }\n }\n "}),(0,s.jsxs)("div",{className:"overflow-hidden rounded border border-gray-300 bg-white",children:[(0,s.jsxs)("div",{className:"grid grid-cols-[200px_1fr_250px] border-b border-gray-300 bg-gray-100",children:[(0,s.jsxs)("div",{className:"flex flex-col border-r border-gray-400 p-2",children:[F&&(0,s.jsx)("div",{className:"mb-1 flex items-center justify-center",children:(0,s.jsx)("img",{src:F,alt:"Company Logo",className:"max-h-8 max-w-[120px] object-contain"})}),(0,s.jsx)("div",{className:"flex-1 text-2xs text-gray-500",children:(0,s.jsx)("div",{dangerouslySetInnerHTML:{__html:null!=(o=null!=(c=null==P?void 0:P.companyInfo)?c:null==S?void 0:S.companyInfo)?o:""}})})]}),(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center px-2 py-2",children:[(0,s.jsx)("h1",{className:"text-base font-bold uppercase tracking-wide text-gray-500",children:T||"Production Title"}),(0,s.jsx)("h2",{className:"pb-0.5 text-xs font-medium text-gray-500",children:"Daily Production Report"}),(0,s.jsx)("div",{className:"my-0.5 w-full border-t border-gray-300"}),(0,s.jsxs)("div",{className:"pt-0.5 text-sm font-bold text-gray-700",children:["Day ",null!=(d=null==S?void 0:S.dayNumber)?d:1," of ",A]}),(0,s.jsxs)("div",{className:"mt-0.5 flex items-center gap-3 text-2xs text-gray-600",children:[(0,s.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,s.jsx)("span",{className:"font-semibold text-gray-500",children:"Start:"}),(0,s.jsx)("span",{children:null!=k?k:"-"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,s.jsx)("span",{className:"font-semibold text-gray-500",children:"End:"}),(0,s.jsx)("span",{children:null!=M?M:"-"})]})]})]}),(0,s.jsxs)("div",{className:"flex flex-col border-l border-gray-400 p-1.5",children:[(0,s.jsx)("div",{className:"border-b border-gray-400 py-1 text-center",children:(0,s.jsx)("div",{className:"text-xs font-semibold text-gray-700",children:Z})}),(0,s.jsx)("div",{className:"flex-1 pt-1 text-[9px] text-gray-500",children:(0,s.jsx)("div",{dangerouslySetInnerHTML:{__html:null!=(u=null!=(i=null==P?void 0:P.keyPeople)?i:null==S?void 0:S.keyPeople)?u:""}})})]})]}),(null==(x=E.showActualVsScheduled)||x)&&(0,s.jsx)("div",{className:"overflow-x-auto border-t border-gray-300",children:(0,s.jsxs)("table",{className:"w-full text-[10px]",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"bg-gray-100",children:[(0,s.jsx)("th",{className:"border-r border-gray-300 p-1 text-left font-semibold uppercase text-gray-600"}),(0,s.jsx)("th",{className:"border-r border-gray-300 p-1 text-center font-semibold uppercase text-gray-600",children:"1st Unit"}),(0,s.jsx)("th",{className:"border-r border-gray-300 p-1 text-center font-semibold uppercase text-gray-600",children:"2nd Unit"}),(0,s.jsx)("th",{className:"border-r border-gray-300 p-1 text-center font-semibold uppercase text-gray-600",children:"Prep"}),(0,s.jsx)("th",{className:"border-r border-gray-300 p-1 text-center font-semibold uppercase text-gray-600",children:"Rehearsal"}),(0,s.jsx)("th",{className:"border-r border-gray-300 p-1 text-center font-semibold uppercase text-gray-600",children:"Holidays"}),(0,s.jsx)("th",{className:"border-r border-gray-300 p-1 text-center font-semibold uppercase text-gray-600",children:"Travel"}),(0,s.jsx)("th",{className:"border-r border-gray-300 p-1 text-center font-semibold uppercase text-gray-600",children:"Idle"}),(0,s.jsx)("th",{className:"p-1 text-center font-semibold uppercase text-gray-600",children:"Total"})]})}),(0,s.jsx)("tbody",{children:(()=>{var e,t,r,l,a,n,c,o,d,i,u,x,p,m,h,y,g,b,f,v,j,N,S,w,C,I,T,A,k;let R=null!=(e=null==P?void 0:P.daysTracking)?e:$,M=(null!=(t=R.actual.firstUnit)?t:0)+(null!=(r=R.actual.secondUnit)?r:0)+(null!=(l=R.actual.prep)?l:0)+(null!=(a=R.actual.rehearsal)?a:0)+(null!=(n=R.actual.holidays)?n:0)+(null!=(c=R.actual.travel)?c:0)+(null!=(o=R.actual.idle)?o:0),E=(null!=(d=R.scheduled.firstUnit)?d:0)+(null!=(i=R.scheduled.secondUnit)?
1i:0)+(null!=(u=R.scheduled.prep)?u:0)+(null!=(x=R.scheduled.rehearsal)?x:0)+(null!=(p=R.scheduled.holidays)?p:0)+(null!=(m=R.scheduled.travel)?m:0)+(null!=(h=R.scheduled.idle)?h:0);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("tr",{className:"border-t border-gray-300",children:[(0,s.jsx)("td",{className:"border-r border-gray-300 p-1 font-semibold text-gray-700",children:"# of Actual Days"}),(0,s.jsx)("td",{className:"border-r border-gray-300 p-1 text-center",children:null!=(y=R.actual.firstUnit)?y:"-"}),(0,s.jsx)("td",{className:"border-r border-gray-300 p-1 text-center",children:null!=(g=R.actual.secondUnit)?g:"-"}),(0,s.jsx)("td",{className:"border-r border-gray-300 p-1 text-center",children:null!=(b=R.actual.prep)?b:"-"}),(0,s.jsx)("td",{className:"border-r border-gray-300 p-1 text-center",children:null!=(f=R.actual.rehearsal)?f:"-"}),(0,s.jsx)("td",{className:"border-r border-gray-300 p-1 text-center",children:null!=(v=R.actual.holidays)?v:"-"}),(0,s.jsx)("td",{className:"border-r border-gray-300 p-1 text-center",children:null!=(j=R.actual.travel)?j:"-"}),(0,s.jsx)("td",{className:"border-r border-gray-300 p-1 text-center",children:null!=(N=R.actual.idle)?N:"-"}),(0,s.jsx)("td",{className:"p-1 text-center font-medium",children:M})]}),(0,s.jsxs)("tr",{className:"border-t border-gray-300",children:[(0,s.jsx)("td",{className:"border-r border-gray-300 p-1 font-semibold text-gray-700",children:"# of Scheduled Days"}),(0,s.jsx)("td",{className:"border-r border-gray-300 p-1 text-center",children:null!=(S=R.scheduled.firstUnit)?S:"-"}),(0,s.jsx)("td",{className:"border-r border-gray-300 p-1 text-center",children:null!=(w=R.scheduled.secondUnit)?w:"-"}),(0,s.jsx)("td",{className:"border-r border-gray-300 p-1 text-center",children:null!=(C=R.scheduled.prep)?C:"-"}),(0,s.jsx)("td",{className:"border-r border-gray-300 p-1 text-center",children:null!=(I=R.scheduled.rehearsal)?I:"-"}),(0,s.jsx)("td",{className:"border-r border-gray-300 p-1 text-center",children:null!=(T=R.scheduled.holidays)?T:"-"}),(0,s.jsx)("td",{className:"border-r border-gray-300 p-1 text-center",children:null!=(A=R.scheduled.travel)?A:"-"}),(0,s.jsx)("td",{className:"border-r border-gray-300 p-1 text-center",children:null!=(k=R.scheduled.idle)?k:"-"}),(0,s.jsx)("td",{className:"p-1 text-center font-medium",children:E})]})]})})()})]})})]}),(0,s.jsxs)("div",{className:"avoid-break overflow-hidden rounded border border-gray-400",children:[(0,s.jsx)("div",{className:"border-b border-gray-400 bg-gray-100 px-2 py-1 text-xs font-bold",children:"Recorded Times"}),(0,s.jsx)("div",{className:"flex text-2xs",children:[{label:"Crew Call",value:ea.crewCall},{label:"Sched. Shooting Call",value:ea.scheduledShootingCall},{label:"Actual 1st Shot",value:ea.actualFirstShot},{label:"First Meal In",value:ea.firstMealIn},{label:"First Meal Out",value:ea.firstMealOut},{label:"1st Shot After Lunch",value:ea.firstShotAfterLunch},...null==(p=E.showMeal2)||p?[{label:"2nd Meal In",value:ea.secondMealIn},{label:"2nd Meal Out",value:ea.secondMealOut}]:[],{label:"Camera Wrap",value:ea.cameraWrap},{label:"Last Person Out",value:ea.lastPersonOut}].map((e,t,r)=>(0,s.jsxs)("div",{className:(0,y.cn)("flex-1 border-b border-gray-300 p-1.5",t!==r.length-1&&"border-r"),children:[(0,s.jsx)("div",{className:"whitespace-nowrap text-[8px] font-medium text-gray-500",children:e.label}),(0,s.jsx)("div",{className:"text-[9px] font-medium",children:e.value})]},t))})]}),(0,s.jsxs)("div",{className:"avoid-break overflow-hidden rounded border border-gray-400",children:[(0,s.jsx)("div",{className:"border-b border-gray-400 bg-gray-100 px-2 py-1 text-xs font-bold",children:"Script Progress"}),(0,s.jsxs)("div",{className:"grid grid-cols-3 text-2xs",children:[(0,s.jsxs)("div",{className:"border-r border-gray-400",children:[(0,s.jsx)("div",{className:"border-b border-gray-300 bg-gray-200 px-1 py-1 text-center text-[9px] font-bold text-gray-700",children:"Coverage"}),(0,s.jsxs)("table",{className:"w-full",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"border-b border-gray-300 bg-gray-50",children:[(0,s.jsx)("th",{className:"px-1 py-0.5 text-left text-[8px]"}),(0,s.jsx)("th",{className:"px-1 py-0.5 text-center text-[8px]",children:"Scenes"}),(0,s.jsx)("th",{className:"px-1 py-0.5 text-center text-[8px]",children:"Pages"}),(0,s.jsx)("th",{className:"px-1 py-0.5 text-center text-[8px]",children:"Setups"}),(0,s.jsx)("th",{className:"px-1 py-0.5 text-center text-[8px]",children:"Minutes"})]})}),(0,s.jsxs)("tbody",{children:[(0,s.jsxs)("tr",{className:"border-b border-gray-200",children:[(0,s.jsx)("td",{className:"px-1 py-0.5 text-[8px]",children:"Script Total"}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px]",children:en.scriptTotalScenes||"-"}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px]",children:eW(en.scriptTotalPages)}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px] text-gray-400",children:"-"}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px] text-gray-400",children:"-"})]}),(0,s.jsxs)("tr",{className:"border-b border-gray-200",children:[(0,s.jsx)("td",{className:"px-1 py-0.5 text-[8px]",children:"Previously Shot"}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px]",children:en.previouslyShotScenes}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px]",children:eW(en.previouslyShotPages)}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px]",children:en.previouslyShotSetups}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px]",children:en.previouslyShotMinutes})]}),(0,s.jsxs)("tr",{className:"border-b border-gray-200 bg-gray-50 font-bold",children:[(0,s.jsx)("td",{className:"px-1 py-0.5 text-[8px] font-bold",children:"Today"}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px] font-bold",children:en.todayShotScenes}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px] font-bold",children:eW(en.todayShotPages)}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px] font-bold",children:en.todayShotSetups}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px] font-bold",children:en.todayShotMinutes})]}),(0,s.jsxs)("tr",{className:"border-b border-gray-200",children:[(0,s.jsx)("td",{className:"px-1 py-0.5 text-[8px]",children:"To Date"}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px]",children:ec}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px]",children:eW(eo)}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px]",children:ed}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px]",children:"-"})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{className:"px-1 py-0.5 text-[8px]",children:"Remaining"}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px]",children:ei}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px]",children:eW(eu)}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px] text-gray-400",children:"-"}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px] text-gray-400",children:"-"})]})]})]})]}),(0,s.jsxs)("div",{className:"border-r border-gray-400",children:[(0,s.jsx)("div",{className:"border-b border-gray-300 bg-gray-200 px-1 py-1 text-center text-[9px] font-bold text-gray-700",children:"Rolls"}),(0,s.jsxs)("table",{className:"w-full",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"border-b border-gray-300 bg-gray-50",children:[(0,s.jsx)("th",{className:"px-1 py-0.5 text-left text-[8px]"}),(0,s.jsx)("th",{className:"px-1 py-0.5 text-center text-[8px]",children:"A Cam"}),(0,s.jsx)("th",{className:"px-1 py-0.5 text-center text-[8px]",children:"B Cam"}),(0,s.jsx)("th",{className:"px-1 py-0.5 text-center text-[8px]",children:"C Cam"}),(0,s.jsx)("th",{className:"px-1 py-0.5 text-center text-[8px]",children:"Sound"})]})}),(0,s.jsxs)("tbody",{children:[(0,s.jsxs)("tr",{className:"border-b border-gray-200",children:[(0,s.jsx)("td",{className:"px-1 py-0.5 pl-2 text-[8px]",children:"Previously"}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px]",children:en.rollsPreviouslyACam}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px]",children:en.rollsPreviouslyBCam}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px]",children:en.rollsPreviouslyCCam}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px]",children:en.rollsPreviouslySound})]}),(0,s.jsxs)("tr",{className:"border-b border-gray-200 bg-gray-50 font-bold",children:[(0,s.jsx)("td",{className:"px-1 py-0.5 pl-2 text-[8px] font-bold",children:"Today"}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px] font-bold",children:en.rollsTodayACam}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px] font-bold",children:en.rollsTodayBCam}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px] font-bold",children:en.rollsTodayCCam}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px] font-bold",children:en.rollsTodaySound})]}),(0,s.jsxs)("tr",{className:"border-b border-gray-200",children:[(0,s.jsx)("td",{className:"px-1 py-0.5 pl-2 text-[8px]",children:"To Date"}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px]",children:ex}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px]",children:ep}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px]",children:em}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-center text-[8px]",children:eh})]})]})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"border-b border-gray-300 bg-gray-200 px-1 py-1 text-center text-[9px] font-bold text-gray-700",children:"Specifics"}),(0,s.jsxs)("div",{className:"flex flex-col text-[8px]",children:[(0,s.jsxs)("div",{className:"flex gap-1 border-b border-gray-200 px-1 py-0.5",children:[(0,s.jsx)("span",{className:"w-[50px] shrink-0 font-semibold",children:"SHOT:"}),(0,s.jsx)("span",{children:en.scheduledScenesShot})]}),(0,s.jsxs)("div",{className:"flex gap-1 border-b border-gray-200 px-1 py-0.5",children:[(0,s.jsx)("span",{className:"w-[50px] shrink-0 font-semibold",children:"NOT SHOT:"}),(0,s.jsx)("span",{children:en.scheduledScenesNotShot})]}),(0,s.jsxs)("div",{className:"flex gap-1 border-b border-gray-200 px-1 py-0.5",children:[(0,s.jsx)("span",{className:"w-[50px] shrink-0 font-semibold",children:"ADDED:"}),(0,s.jsx)("span",{children:en.addedScenes})]}),(0,s.jsxs)("div",{className:"flex gap-1 border-b border-gray-200 px-1 py-0.5",children:[(0,s.jsx)("span",{className:"w-[50px] shrink-0 font-semibold",children:"RETAKES:"}),(0,s.jsx)("span",{children:en.retakeScenes})]}),(0,s.jsxs)("div",{className:"flex gap-1 px-1 py-0.5",children:[(0,s.jsx)("span",{className:"w-[50px] shrink-0 font-semibold",children:"OMITTED:"}),(0,s.jsx)("span",{children:en.omittedScenes})]})]})]})]})]}),(()=>{let e={...ek.WK,...null!=W?W:{}},t=(0,ek.pA)(e),r=(0,ek.N9)(e);return(0,s.jsxs)("div",{className:"avoid-break overflow-hidden rounded border border-gray-400",children:[(0,s.jsx)("div",{className:"border-b border-gray-400 bg-gray-100 px-2 py-1 text-xs font-bold",children:"Scheduled Scenes"}),(0,s.jsxs)("table",{className:"w-full text-2xs",children:[(0,s.jsx)("thead",{children:(0,s.jsx)("tr",{className:"border-b border-gray-300 bg-gray-50",children:t.map(t=>(0,s.jsx)("th",{className:(0,y.cn)("px-1 py-0.5","setSynopsis"===t?"text-left":"text-center"),children:"setSynopsis"===t?e.synopsis?"Set/Synopsis":"Set":ek.jq[t]},t))})}),(0,s.jsx)("tbody",{children:ee?0===Y.length?(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:r||6,className:"px-1 py-1 text-center text-gray-500",children:"No scenes scheduled"})}):Y.map((l,a)=>{let n=l.sceneId?J.get(l.sceneId):void 0;if(null==n?void 0:n.banner)return(0,s.jsx)("tr",{className:"bg-slate-100",children:(0,s.jsx)("td",{colSpan:r||6,className:"border-b border-gray-200 px-1 py-0.5 text-center font-semibold",children:n.synopsis||"Banner"})},l.id);let c=(null==n?void 0:n.cast)&&n.cast.length>0?n.cast.map(e=>{var t;return null!=(t=eg.get(e))?t:e}).sort((e,t)=>
1parseInt(e)-parseInt(t)):[],o=c.length>0?c.join(" \xb7 "):"â",d=(null==n?void 0:n.timeOfDay)||"â",i=(null==n?void 0:n.intext)&&"-"!==n.intext?n.intext:"",u=i?"".concat(i," ").concat(l.setDescription||"â"):l.setDescription||"â",x=n?"".concat(n.hours,":").concat(String(n.minutes).padStart(2,"0")):"â",p=(null==n?void 0:n.shootTime)?(0,R.fU)(n.shootTime,E.militaryTime):"â";return(0,s.jsx)("tr",{className:(0,y.cn)("border-b border-gray-200",a%2==0?"bg-white":"bg-gray-50"),children:t.map(t=>{switch(t){case"scene":return(0,s.jsx)("td",{className:"px-1 py-0.5 text-center font-medium",children:(e=>{let t=z(e.episode);return t?"".concat(t).concat(e.sceneNumber):e.sceneNumber})(l)},t);case"setSynopsis":return(0,s.jsx)("td",{className:"px-1 py-0.5",children:E.compactSetSynopsis?(0,s.jsxs)("span",{children:[(0,s.jsx)("span",{className:"font-bold",children:u}),e.synopsis&&l.synopsis&&(0,s.jsxs)("span",{className:"text-[7px] text-gray-600",children:[" | ",l.synopsis]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"font-bold",children:u}),e.synopsis&&l.synopsis&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("br",{}),(0,s.jsx)("span",{children:l.synopsis})]})]})},t);case"dayNight":return(0,s.jsx)("td",{className:"px-1 py-0.5 text-center",children:d},t);case"cast":return(0,s.jsx)("td",{className:"px-1 py-0.5 text-center",children:o},t);case"scriptDay":return(0,s.jsx)("td",{className:"px-1 py-0.5 text-center",children:(null==n?void 0:n.scriptDayId)&&ev.get(n.scriptDayId)||"â"},t);case"pages":return(0,s.jsx)("td",{className:"px-1 py-0.5 text-center",children:l.pageLength?eW(l.pageLength):"â"},t);case"estTime":return(0,s.jsx)("td",{className:"px-1 py-0.5 text-center",children:x},t);case"shootTime":return(0,s.jsx)("td",{className:"px-1 py-0.5 text-center",children:p},t);case"location":return(0,s.jsx)("td",{className:"px-1 py-0.5 text-center",children:l.location||"â"},t)}})},l.id)}):0===w.length?(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:r||6,className:"px-1 py-1 text-center text-gray-500",children:"No scenes scheduled"})}):w.map((l,a)=>{var n,c;if(l.banner)return(0,s.jsx)("tr",{className:"bg-slate-100",children:(0,s.jsx)("td",{colSpan:r||6,className:"border-b border-gray-200 px-1 py-0.5 text-center font-semibold",children:l.synopsis||"Banner"})},l.id);let o=l.cast&&l.cast.length>0?l.cast.map(e=>{var t;return null!=(t=eg.get(e))?t:e}).sort((e,t)=>parseInt(e)-parseInt(t)):[],d=o.length>0?o.join(" \xb7 "):"â",i=l.setId&&null!=(n=eb.get(l.setId))?n:"â",u=l.intext&&"-"!==l.intext?l.intext:"",x=u?"".concat(u," ").concat(i):i,p=l.locationId&&null!=(c=ef.get(l.locationId))?c:"â",m="".concat(l.hours,":").concat(String(l.minutes).padStart(2,"0")),h=l.shootTime?(0,R.fU)(l.shootTime,E.militaryTime):"â";return(0,s.jsx)("tr",{className:(0,y.cn)("border-b border-gray-200",a%2==0?"bg-white":"bg-gray-50"),children:t.map(t=>{switch(t){case"scene":return(0,s.jsx)("td",{className:"px-1 py-0.5 text-center font-medium",children:(e=>{let t=z(e.episode);return t?"".concat(t).concat(e.sceneNumber):e.sceneNumber})(l)},t);case"setSynopsis":return(0,s.jsx)("td",{className:"px-1 py-0.5",children:E.compactSetSynopsis?(0,s.jsxs)("span",{children:[(0,s.jsx)("span",{className:"font-bold",children:x}),e.synopsis&&l.synopsis&&(0,s.jsxs)("span",{className:"text-[7px] text-gray-600",children:[" | ",l.synopsis]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"font-bold",children:x}),e.synopsis&&l.synopsis&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("br",{}),(0,s.jsx)("span",{children:l.synopsis})]})]})},t);case"dayNight":return(0,s.jsx)("td",{className:"px-1 py-0.5 text-center",children:l.timeOfDay||"â"},t);case"cast":return(0,s.jsx)("td",{className:"px-1 py-0.5 text-center",children:d},t);case"scriptDay":return(0,s.jsx)("td",{className:"px-1 py-0.5 text-center",children:l.scriptDayId&&ev.get(l.scriptDayId)||"â"},t);case"pages":return(0,s.jsx)("td",{className:"px-1 py-0.5 text-center",children:l.pageLength?eW(l.pageLength):"â"},t);case"estTime":return(0,s.jsx)("td",{className:"px-1 py-0.5 text-center",children:m},t);case"shootTime":return(0,s.jsx)("td",{className:"px-1 py-0.5 text-center",children:h},t);case"location":return(0,s.jsx)("td",{className:"px-1 py-0.5 text-center",children:p},t)}})},l.id)})})]})]})})(),E.showCastSection&&(0,s.jsxs)("div",{className:"avoid-break overflow-hidden rounded border border-gray-400",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between border-b border-gray-400 bg-gray-100 px-2 py-1",children:[(0,s.jsx)("span",{className:"text-xs font-bold",children:"Cast"}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)("div",{className:"text-2xs text-gray-600",children:"W=Work, R=Rehearsal, T=Test, TR=Travel, F=Finished, D=Drop, H=Hold, NP=Not Photographed, FC=Forced Call"}),(0,s.jsxs)("span",{className:"text-[9px] font-semibold",children:["Total Cast: ",ey.length]})]})]}),(0,s.jsxs)("table",{className:"w-full text-2xs",children:[(0,s.jsxs)("thead",{children:[(0,s.jsxs)("tr",{className:"border-b border-gray-300 bg-gray-200",children:[(0,s.jsx)("th",{className:"px-0.5 py-0.5",colSpan:4}),(0,s.jsx)("th",{className:"border-l border-r border-gray-400 bg-green-100 px-0.5 py-0.5 text-center text-[9px] font-bold text-green-800",colSpan:4,children:"Work"}),(0,s.jsx)("th",{className:"border-r border-gray-400 bg-orange-100 px-0.5 py-0.5 text-center text-[9px] font-bold text-orange-800",colSpan:null==(m=E.showMeal2)||m?4:2,children:"Meals"}),(null==(h=E.showTravel)||h)&&(0,s.jsx)("th",{className:"border-r border-gray-400 bg-blue-100 px-0.5 py-0.5 text-center text-[9px] font-bold text-blue-800",colSpan:2,children:"Travel"}),(0,s.jsx)("th",{className:"px-0.5 py-0.5"})]}),(0,s.jsxs)("tr",{className:"border-b border-gray-300 bg-gray-50",children:[(0,s.jsx)("th",{className:"px-0.5 py-1 text-center text-[9px] font-semibold",children:"#"}),(0,s.jsx)("th",{className:"px-0.5 py-1 text-left text-[9px] font-semibold",children:"Cast"}),(0,s.jsx)("th",{className:"px-0.5 py-1 text-left text-[9px] font-semibold",children:"Character"}),(0,s.jsx)("th",{className:"px-0.5 py-1 text-center text-[9px] font-semibold",children:"Status"}),(0,s.jsxs)("th",{className:"border-l border-gray-300 bg-green-50 px-0.5 py-1 text-center text-[8px] font-semibold leading-tight",children:["HMU",(0,s.jsx)("br",{}),"Report"]}),(0,s.jsxs)("th",{className:"bg-green-50 px-0.5 py-1 text-center text-[8px] font-semibold leading-tight",children:["On",(0,s.jsx)("br",{}),"Set"]}),(0,s.jsx)("th",{className:"bg-green-50 px-0.5 py-1 text-center text-[8px] font-semibold",children:"Wrap"}),(0,s.jsx)("th",{className:"border-r border-gray-300 bg-green-50 px-0.5 py-1 text-center text-[7px] font-semibold",children:"Dismiss"}),(0,s.jsxs)("th",{className:(0,y.cn)("bg-orange-50 px-0.5 py-1 text-center text-[8px] font-semibold leading-tight",!(null==(g=E.showMeal2)||g)&&!(null==(b=E.showTravel)||b)&&"border-r border-gray-300"),children:["Meal",(0,s.jsx)("br",{}),"In"]}),(0,s.jsxs)("th",{className:"bg-orange-50 px-0.5 py-1 text-center text-[8px] font-semibold leading-tight",children:["Meal",(0,s.jsx)("br",{}),"Out"]}),(null==(f=E.showMeal2)||f)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("th",{className:(0,y.cn)("bg-orange-50 px-0.5 py-1 text-center text-[8px] font-semibold leading-tight"),children:["Meal 2",(0,s.jsx)("br",{}),"In"]}),(0,s.jsxs)("th",{className:"bg-orange-50 px-0.5 py-1 text-center text-[8px] font-semibold leading-tight border-r border-gray-300",children:["Meal 2",(0,s.jsx)("br",{}),"Out"]})]}),(null==(v=E.showTravel)||v)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("th",{className:"bg-blue-50 px-0.5 py-1 text-center text-[8px] font-semibold leading-tight",children:["Leave",(0,s.jsx)("br",{}),"Location"]}),(0,s.jsxs)("th",{className:"border-r border-gray-300 bg-blue-50 px-0.5 py-1 text-center text-[8px] font-semibold leading-tight",children:["Arrive at",(0,s.jsx)("br",{}),"Location"]})]}),(0,s.jsx)("th",{className:"px-0.5 py-1 text-left text-[8px] font-semibold",children:"Notes"})]})]}),(0,s.jsx)("tbody",{children:0===ey.length?(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:9+(null==(j=E.showMeal2)||j?2:0)+(null==(N=E.showTravel)||N?2:0)+2,className:"px-2 py-2 text-center text-gray-500",children:"No cast assigned"})}):ey.sort((e,t)=>
1parseInt(e.publicId)-parseInt(t.publicId)).map((e,t)=>{var r,l,a,n,c,o;return(0,s.jsxs)("tr",{className:(0,y.cn)("border-b border-gray-200",t%2==0?"bg-white":"bg-gray-50"),children:[(0,s.jsx)("td",{className:"px-0.5 py-0.5 text-center font-medium",children:null!=(r=e.publicId)?r:"-"}),(0,s.jsx)("td",{className:"px-0.5 py-0.5 font-medium",children:null!=(l=e.actorName)?l:"-"}),(0,s.jsx)("td",{className:"px-0.5 py-0.5",children:null!=(a=e.characterName)?a:"-"}),(0,s.jsx)("td",{className:"px-0.5 py-0.5 text-center",children:e.status}),(0,s.jsx)("td",{className:"border-l border-gray-200 bg-green-50/30 px-0.5 py-0.5 text-center",children:er(e.muReport)}),(0,s.jsx)("td",{className:"bg-green-50/30 px-0.5 py-0.5 text-center",children:er(e.onSet)}),(0,s.jsx)("td",{className:"bg-green-50/30 px-0.5 py-0.5 text-center",children:er(e.wrap)}),(0,s.jsx)("td",{className:"border-r border-gray-200 bg-green-50/30 px-0.5 py-0.5 text-center",children:er(e.dismiss)}),(0,s.jsx)("td",{className:(0,y.cn)("bg-orange-50/30 px-0.5 py-0.5 text-center"),children:er(e.mealIn)}),(0,s.jsx)("td",{className:"bg-orange-50/30 px-0.5 py-0.5 text-center",children:er(e.mealOut)}),(null==(n=E.showMeal2)||n)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{className:(0,y.cn)("bg-orange-50/30 px-0.5 py-0.5 text-center",!(null==(c=E.showTravel)||c)&&"border-r border-gray-200"),children:el(e.meal2In)}),(0,s.jsx)("td",{className:"border-r border-gray-200 bg-orange-50/30 px-0.5 py-0.5 text-center",children:el(e.meal2Out)})]}),(null==(o=E.showTravel)||o)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{className:"bg-blue-50/30 px-0.5 py-0.5 text-center",children:er(e.leaveToLocation)}),(0,s.jsx)("td",{className:"border-r border-gray-200 bg-blue-50/30 px-0.5 py-0.5 text-center",children:er(e.arriveAtLocation)})]}),(0,s.jsx)("td",{className:"px-0.5 py-0.5",children:e.notes||"-"})]},e.id)})})]})]}),E.showBackgroundSection&&(0,s.jsxs)("div",{className:"avoid-break overflow-hidden rounded border border-gray-400",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between border-b border-gray-400 bg-gray-100 px-2 py-1",children:[(0,s.jsx)("span",{className:"text-xs font-bold",children:"Backgroun
1d Performers"}),(0,s.jsxs)("span",{className:"text-[9px] font-semibold",children:["Total BG: ",ej.reduce((e,t)=>e+t.count,0)]})]}),(0,s.jsxs)("table",{className:"w-full text-2xs",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"border-b border-gray-300 bg-gray-50",children:[(0,s.jsx)("th",{className:"px-2 py-0.5 text-left font-semibold",children:"Name"}),(0,s.jsx)("th",{className:"px-0.5 py-0.5 text-center font-semibold",children:"Count"}),(0,s.jsx)("th",{className:"px-0.5 py-0.5 text-center font-semibold",children:"Arrive"}),(0,s.jsx)("th",{className:"px-0.5 py-0.5 text-center font-semibold",children:"Meal In"}),(0,s.jsx)("th",{className:"px-0.5 py-0.5 text-center font-semibold",children:"Meal Out"}),(0,s.jsx)("th",{className:"px-0.5 py-0.5 text-center font-semibold",children:"Dismiss"}),(0,s.jsx)("th",{className:"px-0.5 py-0.5 text-left font-semibold",children:"Notes"})]})}),(0,s.jsx)("tbody",{children:0===ej.length?(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:7,className:"px-0.5 py-1 text-center text-gray-500",children:"No background performers"})}):ej.map((e,t)=>(0,s.jsxs)("tr",{className:(0,y.cn)("border-b border-gray-200",t%2==0?"bg-white":"bg-gray-50"),children:[(0,s.jsx)("td",{className:"px-2 py-0.5 text-left",children:e.name||"-"}),(0,s.jsx)("td",{className:"px-0.5 py-0.5 text-center",children:e.count}),(0,s.jsx)("td",{className:"px-0.5 py-0.5 text-center",children:et(e.arrive)}),(0,s.jsx)("td",{className:"px-0.5 py-0.5 text-center",children:et(e.mealIn)}),(0,s.jsx)("td",{className:"px-0.5 py-0.5 text-center",children:et(e.mealOut)}),(0,s.jsx)("td",{className:"px-0.5 py-0.5 text-center",children:et(e.dismiss)}),(0,s.jsx)("td",{className:"px-1 py-0.5 text-left",children:e.notes||"-"})]},e.id))})]})]}),E.showCrewSection&&eN.length>0&&(()=>{let e={production:"PRODUCTION",continuity:"CONTINUITY",camera:"CAMERA",sound:"SOUND",setLighting:"SET LIGHTING",grip:"GRIP",makeupHair:"MAKEUP & HAIR",costumes:"COSTUMES",artDepartment:"ART DEPARTMENT",setDecoration:"SET DECORATION",property:"PROPERTY",setMedic:"SET MEDIC",productionOffice:"PRODUCTION OFFICE",casting:"CASTING",locations:"LOCATIONS",catering:"CATERING",craftService:"CRAFT SERVICE",vehicles:"VEHICLES"},t={};eN.forEach(r=>{let s=r.section;t[s]||(t[s]={title:(null==Q?void 0:Q[s])||e[s]||s.toUpperCase(),crew:[]}),t[s].crew.push(r)});let r=H&&H.length>0?H:L.N6,l=[...r.filter(e=>t[e]),...Object.keys(t).filter(e=>!r.includes(e))].filter(e=>(null==K?void 0:K[e])!==!1).map(e=>[e,t[e]]).filter(e=>{let[t,r]=e;return r.crew.length>0}),a=Math.ceil(l.length/D),n=(()=>{if(2===D){let e=a-1;return[l.slice(0,e),l.slice(e)]}return Array.from({length:D},(e,t)=>l.slice(t*a,(t+1)*a))})(),c=l.flatMap(e=>{let[t,r]=e;return r.crew}).filter(e=>"1"===e.idNumber).length;return(0,s.jsxs)("div",{className:"avoid-break overflow-hidden rounded border border-gray-400",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between border-b border-gray-400 bg-gray-100 px-2 py-1",children:[(0,s.jsx)("span",{className:"text-xs font-bold",children:"Crew"}),(0,s.jsxs)("span",{className:"text-[9px] font-semibold",children:["Total Crew: ",c]})]}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("div",{className:"flex border-b bg-white",children:n.map((e,t)=>(0,s.jsx)("div",{className:(0,y.cn)("flex-1 px-0.5 py-0.5",t<n.length-1&&"border-r border-gray-200"),children:(0,s.jsxs)("div",{className:"grid grid-cols-[0.8rem_minmax(0,1.8fr)_minmax(0,1.6fr)_2rem_2rem] items-center gap-0.5 text-[8px]",children:[(0,s.jsx)("div",{className:"font-bold",children:"#"}),(0,s.jsx)("div",{className:"font-bold",children:"Title"}),(0,s.jsx)("div",{className:"font-bold",children:"Name"}),(0,s.jsx)("div",{className:"border-r border-gray-200 text-center font-bold",children:"In"}),(0,s.jsx)("div",{className:"text-center font-bold",children:"Out"})]})},t))}),(0,s.jsx)("div",{className:"flex",children:n.map((e,t)=>(0,s.jsx)("div",{className:(0,y.cn)("flex-1",t<n.length-1&&"border-r border-gray-200"),children:e.map(e=>{let[t,r]=e;return(0,s.jsxs)("div",{className:"px-0.5 py-0.5",children:[(0,s.jsx)("div",{className:"mb-0.5 flex items-center justify-between bg-gray-200 px-0.5 py-px",children:(0,s.jsx)("span",{className:"text-[8px] font-bold",children:r.title})}),(0,s.jsx)("div",{className:"mb-1",children:r.crew.map(e=>(0,s.jsxs)("div",{className:"grid grid-cols-[0.8rem_minmax(0,1.8fr)_minmax(0,1.6fr)_2rem_2rem] items-center border-b border-gray-100 text-[8px]",children:[(0,s.jsx)("div",{className:"border-r border-gray-100 px-0.5 py-px",children:e.idNumber||"-"}),(0,s.jsx)("div",{className:"border-r border-gray-100 px-0.5 py-px",children:e.title||"-"}),(0,s.jsx)("div",{className:"border-r border-gray-100 px-0.5 py-px",children:e.name||"-"}),(0,s.jsx)("div",{className:"border-r border-gray-200 py-px text-center",children:3===D?er(e.inTime):et(e.inTime)}),(0,s.jsx)("div",{className:"py-px text-center",children:3===D?er(e.outTime):et(e.outTime)})]},e.id))})]},t)})},t))})]})]})})(),E.showNotesSection&&(0,s.jsx)(eG,{notes:eS})]})});eH.displayName="ProductionReportTemplatePrint";var eK=r(24748),eq=r(55584),eQ=r(30860),eZ=r(48230),e$=r.n(eZ),ez=r(73640),eX=r.n(ez);let eY=e=>{let t;try{if(t=localStorage.getItem("productionReportSettings-".concat(e))){let e=JSON.parse(t);if(e&&"object"==typeof e)return e}}catch(t){console.error("Error parsing production report settings for project");try{localStorage.removeItem("productionReportSettings-".concat(e))}catch(e){console.error("Error removing corrupted settings")}}
1return{showCastSection:!0,showBackgroundSection:!0,showCrewSection:!0,showNotesSection:!0,showMetricsSection:!0,showActualVsScheduled:!1,showMeal2:!0,showTravel:!0,militaryTime:!1,compactSetSynopsis:!1}},eJ=(e,t)=>{localStorage.setItem("productionReportSettings-".concat(e),JSON.stringify(t))};eX()((e,t)=>{if("error"===t)return void c.oR.error(e,{position:"top-center"});(0,c.oR)(e)},1500);var e0=r(77953),e1=r(94043),e5=r(19132),e2=r(74149);let e6=e=>{let{handlePrint:t,isDownloading:r,setIsDownloading:l}=e;return(0,s.jsx)("div",{className:"flex items-center",children:(0,s.jsx)(m.$n,{disabled:r,onClick:()=>{l(!0),setTimeout(()=>{t()},1e3)},variant:"outline",className:"w-32 gap-1.5 bg-black text-white",children:r?(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(j.k,{size:15}),"Generating..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eK.A,{className:"h-5 w-5","aria-hidden":"true"}),"Download"]})})})},e3=e=>{var t,r,a,n;let{sectionView:c,setSectionView:o}=e,d=(0,l.useRouter)().query.id;return(0,s.jsx)("div",{className:"flex h-full items-center",children:(0,s.jsxs)(S.AM,{children:[(0,s.jsx)(S.Wv,{className:"flex items-center",children:(0,s.jsxs)("div",{className:"inline-flex w-full items-center justify-center gap-1.5 rounded-md border border-gray-300 bg-black px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-white hover:text-black",children:[(0,s.jsx)(eQ.A,{className:"h-5 w-5 2xl:h-6 2xl:w-6","aria-hidden":"true"}),"View"]})}),(0,s.jsxs)(S.hl,{className:"px-5 sm:w-64 2xl:w-72",children:[(0,s.jsx)("div",{className:"text-center font-semibold",children:"View Options"}),(0,s.jsxs)("div",{className:"mb-4 mt-4 flex flex-col gap-2",children:[(0,s.jsxs)("div",{className:"mx-4 flex items-center justify-start gap-2",children:[(0,s.jsx)(e2.S,{id:"militaryTime",checked:c.militaryTime,onCheckedChange:e=>{let t={...c,militaryTime:!!e};eJ(d,t),o(t)}}),(0,s.jsx)("label",{htmlFor:"militaryTime",className:"cursor-pointer text-sm hover:text-gray-600",children:"24-Hour Time"})]}),(0,s.jsxs)("div",{className:"mx-4 flex items-center justify-start gap-2",children:[(0,s.jsx)(e2.S,{id:"showMeal2",checked:null==(t=c.showMeal2)||t,onCheckedChange:e=>{let t={...c,showMeal2:!!e};eJ(d,t),o(t)}}),(0,s.jsx)("label",{htmlFor:"showMeal2",className:"cursor-pointer text-sm hover:text-gray-600",children:"Meal 2"})]}),(0,s.jsxs)("div",{className:"mx-4 flex items-center justify-start gap-2",children:[(0,s.jsx)(e2.S,{id:"showTravel",checked:null==(r=c.showTravel)||r,onCheckedChange:e=>{let t={...c,showTravel:!!e};eJ(d,t),o(t)}}),(0,s.jsx)("label",{htmlFor:"showTravel",className:"cursor-pointer text-sm hover:text-gray-600",children:"Travel"})]}),(0,s.jsxs)("div",{className:"mx-4 flex items-center justify-start gap-2",children:[(0,s.jsx)(e2.S,{id:"compactSetSynopsis",checked:null!=(a=c.compactSetSynopsis)&&a,onCheckedChange:e=>{let t={...c,compactSetSynopsis:!!e};eJ(d,t),o(t)}}),(0,s.jsx)("label",{htmlFor:"compactSetSynopsis",className:"cursor-pointer text-sm hover:text-gray-600",children:"Compact Set/Synopsis"})]}),(0,s.jsx)("div",{className:"mx-4 mb-2 border-b border-gray-200"}),(0,s.jsxs)("div",{className:"mx-4 flex items-center justify-start gap-2",children:[(0,s.jsx)(e2.S,{id:"showActualVsScheduled",checked:null==(n=c.showActualVsScheduled)||n,onCheckedChange:e=>{let t={...c,showActualVsScheduled:!!e};eJ(d,t),o(t)}}),(0,s.jsx)("label",{htmlFor:"showActualVsScheduled",className:"cursor-pointer text-sm hover:text-gray-600",children:"Actual vs Scheduled"})]}),(0,s.jsxs)("div",{className:"mx-4 flex items-center justify-start gap-2",children:[(0,s.jsx)(e2.S,{id:"showCastSection",checked:c.showCastSection,onCheckedChange:e=>{let t={...c,showCastSection:!!e};eJ(d,t),o(t)}}),(0,s.jsx)("label",{htmlFor:"showCastSection",className:"cursor-pointer text-sm hover:text-gray-600",children:"Cast Section"})]}),(0,s.jsxs)("div",{className:"mx-4 flex items-center justify-start gap-2",children:[(0,s.jsx)(e2.S,{id:"showBackgroundSection",checked:c.showBackgroundSection,onCheckedChange:e=>{let t={...c,showBackgroundSection:!!e};eJ(d,t),o(t)}}
1),(0,s.jsx)("label",{htmlFor:"showBackgroundSection",className:"cursor-pointer text-sm hover:text-gray-600",children:"Background Performers"})]}),(0,s.jsxs)("div",{className:"mx-4 flex items-center justify-start gap-2",children:[(0,s.jsx)(e2.S,{id:"showCrewSection",checked:c.showCrewSection,onCheckedChange:e=>{let t={...c,showCrewSection:!!e};eJ(d,t),o(t)}}),(0,s.jsx)("label",{htmlFor:"showCrewSection",className:"cursor-pointer text-sm hover:text-gray-600",children:"Crew Section"})]}),(0,s.jsxs)("div",{className:"mx-4 flex items-center justify-start gap-2",children:[(0,s.jsx)(e2.S,{id:"showNotesSection",checked:c.showNotesSection,onCheckedChange:e=>{let t={...c,showNotesSection:!!e};eJ(d,t),o(t)}}),(0,s.jsx)("label",{htmlFor:"showNotesSection",className:"cursor-pointer text-sm hover:text-gray-600",children:"Notes Section"})]})]}),(0,s.jsx)("div",{className:"flex justify-end",children:(0,s.jsx)(m.$n,{onClick:()=>{let e={showCastSection:!0,showBackgroundSection:!0,showCrewSection:!0,showNotesSection:!0,showMetricsSection:!0,showActualVsScheduled:!0,showMeal2:!0,showTravel:!0,militaryTime:!1,compactSetSynopsis:!1};eJ(d,e),o(e)},variant:"outline",children:"Reset"})})]})]})})},e4=e=>{let{sectionView:t,setSectionView:r,handlePrint:l,isDownloading:a,setIsDownloading:n}=e;return(0,s.jsx)("div",{children:(0,s.jsxs)("div",{className:"flex w-full items-center justify-between bg-black",children:[(0,s.jsx)("div",{className:"ml-8",children:(0,s.jsxs)(e$(),{href:"/projects",className:"flex items-center gap-2 text-lg font-semibold text-white lg:text-xl",children:[(0,s.jsx)(eq.A,{className:"h-5 w-5 text-white xl:h-6 xl:w-6"}),"Shamel Studio"]})}),(0,s.jsxs)("div",{className:"flex h-16 gap-5",children:[(0,s.jsx)(e5.A,{currentType:"productionReport"}),(0,s.jsx)(e3,{sectionView:t,setSectionView:r}),(0,s.jsx)(e6,{handlePrint:l,isDownloading:a,setIsDownloading:n})]}),(0,s.jsxs)("div",{className:"flex items-center gap-4 pr-10",children:[(0,s.jsx)(e1.U,{type:"scheduling"}),(0,s.jsx)("div",{className:"h-[35px] w-[35px]",children:(0,s.jsx)(e0.n,{})})]})]})})},e8=e=>{var t;let{componentRef:r,sectionView:a,callSheetData:n,episodePrefixes:c,projectTitle:o,totalDays:i,productionStartDate:u,productionEndDate:x,logoUrl:p,callSheetGroupId:m,prCrewColumns:h,columnVisibilityPR:y,prCrewSectionOrder:g,prCrewSectionVisibility:b,prCrewSectionLabels:f,scriptTotalScenes:v,scriptTotalPages:j}=e,N=(0,l.useRouter)(),S=N.query.id,w=N.query.callSheetId,C=null!=(t=null==n?void 0:n.includedScenes)?t:[],{data:I}=d.F.talentCS.getTalent.useQuery({projectId:S,callSheetId:w},{enabled:!!S&&!!w,refetchOnWindowFocus:!0,refetchOnReconnect:!0}),{data:T}=d.F.productionReport.get.useQuery({callsheetId:w},{enabled:!!w}),{data:A}=d.F.sceneCS.getAllSets.useQuery({callSheetGroupId:m},{enabled:!!m}),{data:k}=d.F.sceneCS.getAllLocations.useQuery({callSheetGroupId:m},{enabled:!!m}),{data:R}=d.F.sceneCS.getAllScriptDays.useQuery({callSheetGroupId:m},{enabled:!!m});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"hidden",children:(0,s.jsx)(eH,{ref:r,callSheetData:n,selectedScenes:C,talentData:null!=I?I:[],episodePrefixes:c,projectTitle:o,totalDays:i,productionStartDate:u,productionEndDate:x,sectionView:a,prData:T,callSheetGroupId:m,prCrewColumns:h,logoUrl:p,allSets:null!=A?A:[],allLocations:null!=k?k:[],allScriptDays:null!=R?R:[],scriptTotalScenes:v,scriptTotalPages:j,columnVisibility:y,prCrewSectionOrder:g,prCrewSectionVisibility:b,prCrewSectionLabels:f})}),(0,s.jsx)(eB,{callSheetData:n,selectedScenes:C,talentData:null!=I?I:[],episodePrefixes:c,projectTitle:o,totalDays:i,productionStartDate:u,productionEndDate:x,sectionView:a,logoUrl:p,callSheetGroupId:m,prCrewColumns:h,columnVisibilityPR:y,prCrewSectionOrder:g,prCrewSectionVisibility:b,prCrewSectionLabels:f})]})};var e9=!0;let e7=e=>{var t,r,i,u,x,p,m,h,y,g,b,f,v,j,N,S,w;let{projectId:C,callSheetId:I,callSheetGroupId:T}=e,A=eY(C),k=(0,l.useRouter)(),{data:R,isPending:M}=d.F.callsheets.get.useQuery({callsheetId:I},{enabled:!!I,refetchOnWindowFocus:!0,refetchOnReconnect:!0}),{data:E}=d.F.callsheets.getAll.useQuery({callSheetGroupId:T},{enabled:!!T,refetchOnWindowFocus:!0,refetchOnReconnect:!0}),{data:P}=d.F.callsheets.callSheetExists.useQuery({callsheetId:I},{enabled:!!I,refetchInterval:3e4,refetchOnWindowFocus:!0,refetchOnReconnect:!0}),{data:O,isLoading:D}=d.F.productionReport.exists.useQuery({callsheetId:I},{enabled:!!I}
1),F=(0,n.useRef)(null),[_,L]=(0,n.useState)(!1),[B,U]=(0,n.useState)({showCastSection:A.showCastSection,showBackgroundSection:A.showBackgroundSection,showCrewSection:A.showCrewSection,showNotesSection:A.showNotesSection,showMetricsSection:A.showMetricsSection,showActualVsScheduled:null==(t=A.showActualVsScheduled)||t,showMeal2:null==(r=A.showMeal2)||r,showTravel:null==(i=A.showTravel)||i,militaryTime:A.militaryTime,compactSetSynopsis:null!=(u=A.compactSetSynopsis)&&u});(0,n.useEffect)(()=>{!1===P&&k.push("/projects")},[P,k]),(0,n.useEffect)(()=>{D||!1!==O||k.push("/projects/".concat(C,"/callsheets/").concat(T,"/").concat(I))},[D,O,k,C,T,I]),(0,n.useEffect)(()=>{if(C){var e,t,r,s;let l=eY(C);U({showCastSection:l.showCastSection,showBackgroundSection:l.showBackgroundSection,showCrewSection:l.showCrewSection,showNotesSection:l.showNotesSection,showMetricsSection:l.showMetricsSection,showActualVsScheduled:null==(e=l.showActualVsScheduled)||e,showMeal2:null==(t=l.showMeal2)||t,showTravel:null==(r=l.showTravel)||r,militaryTime:l.militaryTime,compactSetSynopsis:null!=(s=l.compactSetSynopsis)&&s})}},[C]);let V=(0,o.useReactToPrint)({content:()=>F.current,pageStyle:"@page { size: auto; margin: 8mm; } @media print { body { -webkit-print-color-adjust: exact; } }",print:async e=>{L(!0);let t=e.contentDocument,r=Intl.DateTimeFormat().resolvedOptions().timeZone;if(t){let e=t.getElementsByTagName("html")[0];try{var s,l,n;let t=null!=(s=null==E?void 0:E.projectTitle)?s:"",o=await fetch("/api/generateCallsheetPDF",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:null!=(l=null==e?void 0:e.outerHTML)?l:"",timezone:r,...I&&{callsheetId:I}})});if(!o.ok)throw Error("Failed to generate PDF: ".concat(o.status));let d=await o.json();((e,t,r)=>{let s=new Blob([new Uint8Array(atob(e).split("").map(e=>e.charCodeAt(0)))],{type:"application/pdf"}),l=window.URL.createObjectURL(s),a=document.createElement("a");return a.href=l,a.download="".concat(t,"_production_report_day").concat(null!=r?r:0,".pdf"),document.body.appendChild(a),a.click(),document.body.removeChild(a),window.URL.revokeObjectURL(l),new File([s],t,{type:"application/pdf"})})(d.fileData,t,null!=(n=null==R?void 0:R.dayNumber)?n:0),c.Ay.success("Production Report PDF generated successfully",{position:"top-center"}),a.Ay.capture("download_production_report_success")}catch(e){c.Ay.error("Error generating Production Report PDF",{position:"top-center"}),a.Ay.capture("download_production_report_fail",{error:e instanceof Error?e.message:String(e)})}finally{L(!1)}}}});return(0,s.jsxs)("div",{className:"flex h-screen flex-grow flex-col",children:[(0,s.jsx)("div",{className:"flex-none",children:(0,s.jsx)(e4,{sectionView:B,setSectionView:U,handlePrint:V,isDownloading:_,setIsDownloading:L})}),(0,s.jsx)("div",{className:"scrollbar-gutter-stable relative flex-grow overflow-y-auto px-3",children:!M&&!D&&O&&(0,s.jsx)(e8,{componentRef:F,sectionView:B,callSheetData:null!=R?R:{},episodePrefixes:null!=(x=null==E?void 0:E.episodePrefixes)?x:null,projectTitle:null!=(p=null==E?void 0:E.projectTitle)?p:"",totalDays:null!=(m=null==E?void 0:E.numDays)?m:1,productionStartDate:null!=(h=null==E?void 0:E.productionStartDate)?h:null,productionEndDate:null!=(y=null==E?void 0:E.productionEndDate)?y:null,logoUrl:null!=(g=null==E?void 0:E.logoUrl)?g:null,callSheetGroupId:T,prCrewColumns:null!=(b=null==E?void 0:E.prCrewColumns)?b:3,columnVisibilityPR:null!=(f=null==E?void 0:E.columnVisibilityPR)?f:null,prCrewSectionOrder:null!=(v=null==E?void 0:E.prCrewSectionOrder)?v:null,prCrewSectionVisibility:null!=(j=null==E?void 0:E.prCrewSectionVisibility)?j:null,prCrewSectionLabels:null!=(N=null==E?void 0:E.prCrewSectionLabels)?N:null,scriptTotalScenes:null!=(S=null==E?void 0:E.scriptTotalScenes)?S:0,scriptTotalPages:null!=(w=null==E?void 0:E.scriptTotalPages)?w:0})})]})}},93536:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(48900).A)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])}},e=>{e.O(0,[5352,6361,8230,150,415,1954,4995,4392,4596,8295,8122,6574,8992,609,5477,5314,5798,467,8750,4043,932,6873,636,6593,8792],()=>e(e.s=62560)),_N_E=e.O()}]);
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.