PageSourceSearch

https://niilmuniversity.online/_next/static/chunks/pages/panel/aaja/manage-3b7c73df32f4c7a2.js

js niilmuniversity.online collected 2026-10-01 15:05:48 UTC 80,541 bytes, 1 lines download raw bytes

1void 0===Promise.withResolvers&&(Promise.withResolvers=function(){let e,a;return{promise:new Promise((t,s)=>{e=t,a=s}),resolve:e,reject:a}}),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[57810],{12140:function(e,a,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/panel/aaja/manage",function(){return t(56606)}])},43886:function(e,a,t){"use strict";var s=t(85893),l=t(89121),r=t(46320),n=t(67294),i=t(85421),o=t(51726);a.Z=e=>{let{isOpen:a,setIsOpen:t,onDelete:d,title:c,loading:m=!1}=e;return(0,s.jsx)("div",{onClick:()=>t(!0),children:(0,s.jsx)(l.u,{appear:!0,show:a,as:n.Fragment,children:(0,s.jsxs)(r.V,{as:"div",open:a,onClose:()=>t(!1),children:[(0,s.jsx)(l.u.Child,{as:n.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)("div",{className:"fixed inset-0"})}),(0,s.jsx)("div",{className:"fixed inset-0 z-[9998] bg-[black]/60 px-4",children:(0,s.jsx)("div",{className:"flex min-h-screen items-start justify-center px-4",children:(0,s.jsxs)(r.V.Panel,{className:"panel my-8 w-full max-w-lg overflow-hidden  rounded-lg border-0 p-0 text-black dark:text-white-dark z-[9999]",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between bg-[#fbfbfb] px-5 py-3 dark:bg-[#121c2c]",children:[(0,s.jsxs)("h5",{className:"text-lg font-bold",children:["Delete ",c]}),(0,s.jsx)("button",{type:"button",onClick:()=>t(!1),className:"text-white-dark hover:text-dark",children:(0,s.jsx)(o.Z,{})})]}),(0,s.jsxs)("div",{className:"p-5",children:[(0,s.jsx)("p",{children:"Are you sure you want to delete this ".concat(null==c?void 0:c.toLowerCase(),"?")}),(0,s.jsxs)("div",{className:"mt-8 flex items-center justify-end",children:[(0,s.jsx)("button",{disabled:m,onClick:d,type:"button",className:"btn btn-outline-danger",children:m?(0,s.jsx)("div",{className:"animate-spin",children:(0,s.jsx)(i.Z,{})}):"Delete"}),(0,s.jsx)("button",{disabled:m,type:"button",onClick:()=>t(!1),className:"btn btn-primary ltr:ml-4 rtl:mr-4",children:"Cancel"})]})]})]})})})]})})})}},26272:function(e,a,t){"use strict";var s=t(85893);a.Z=e=>{let{className:a,fill:t=!1}=e;return(0,s.jsx)(s.Fragment,{children:t?(0,s.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:a,children:[(0,s.jsx)("path",{d:"M11.2296 27.4907C13.5704 28.7191 14.7408 29.3333 15.9998 29.3333V16L3.51719 9.43018C3.49882 9.45971 3.48077 9.48953 3.46303 9.51965C2.6665 10.8723 2.6665 12.5555 2.6665 15.922V16.078C2.6665 19.4444 2.6665 21.1277 3.46303 22.4803C4.25956 23.833 5.69401 24.5858 8.5629 26.0913L11.2296 27.4907Z",fill:"currentColor"}),(0,s.jsx)("path",{opacity:"0.7",d:"M23.4367 5.90853L20.77 4.50913C18.4292 3.28071 17.2588 2.6665 15.9997 2.6665C14.7407 2.6665 13.5703 3.28071 11.2295 4.50912L8.56279 5.90853C5.75778 7.38053 4.32404 8.13292 3.51709 9.43002L15.9997 15.9998L28.4824 9.43002C27.6754 8.13292 26.2417 7.38054 23.4367 5.90853Z",fill:"currentColor"}),(0,s.jsx)("path",{opacity:"0.5",d:"M28.5368 9.51965C28.5191 9.48953 28.501 9.45971 28.4826 9.43018L16 16V29.3333C17.259 29.3333 18.4294 28.7191 20.7703 27.4907L23.4369 26.0913C26.3058 24.5858 27.7403 23.833 28.5368 22.4803C29.3333 21.1277 29.3333 19.4444 29.3333 16.078V15.922C29.3333 12.5555 29.3333 10.8723 28.5368 9.51965Z",fill:"currentColor"})]}):(0,s.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:a,children:[(0,s.jsx)("path",{d:"M15.5777 3.38197L17.5777 4.43152C19.7294 5.56066 20.8052 6.12523 21.4026 7.13974C22 8.15425 22 9.41667 22 11.9415V12.0585C22 14.5833 22 15.8458 21.4026 16.8603C20.8052 17.8748 19.7294 18.4393 17.5777 19.5685L15.5777 20.618C13.8221 21.5393 12.9443 22 12 22C11.0557 22 10.1779 21.5393 8.42229 20.618L6.42229 19.5685C4.27063 18.4393 3.19479 17.8748 2.5974 16.8603C2 15.8458 2 14.5833 2 12.0585V11.9415C2 9.41667 2 8.15425 2.5974 7.13974C3.19479 6.12523 4.27063 5.56066 6.42229 4.43152L8.42229 3.38197C10.1779 2.46066 11.0557 2 12 2C12.9443 2 13.8221 2.46066 15.5777 3.38197Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,s.jsx)("path",{opacity:"0.5",d:"M21 7.5L12 12M12 12L3 7.5M12 12V21.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}},85563:function(e,a,t){"use strict";var s=t(85893);a.Z=e=>{let{className:a}=e;return(0,s.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:a,children:[(0,s.jsx)("path",{opacity:"0.5",d:"M22 10.5V12C22 16.714 22 19.0711 20.5355 20.5355C19.0711 22 16.714 22 12 22C7.28595 22 4.92893 22 3.46447 20.5355C2 19.0711 2 16.714 2 12C2 7.28595 2 4.92893 3.46447 3.46447C4.92893 2 7.28595 2 12 2H13.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,s.jsx)("path",{d:"M17.3009 2.80624L16.652 3.45506L10.6872 9.41993C10.2832 9.82394 10.0812 10.0259 9.90743 10.2487C9.70249 10.5114 9.52679 10.7957 9.38344 11.0965C9.26191 11.3515 9.17157 11.6225 8.99089 12.1646L8.41242 13.9L8.03811 15.0229C7.9492 15.2897 8.01862 15.5837 8.21744 15.7826C8.41626 15.9814 8.71035 16.0508 8.97709 15.9619L10.1 15.5876L11.8354 15.0091C12.3775 14.8284 12.6485 14.7381 12.9035 14.6166C13.2043 14.4732 13.4886 14.2975 13.7513 14.0926C13.9741 13.9188 14.1761 13.7168 14.5801 13.3128L20.5449 7.34795L21.1938 6.69914C22.2687 5.62415 22.2687 3.88124 21.1938 2.80624C20.1188 1.73125 18.3759 1.73125 17.3009 2.80624Z",stroke:"currentColor",strokeWidth:"1.5"}),(0,s.jsx)("path",{opacity:"0.5",d:"M16.6522 3.45508C16.6522 3.45508 16.7333 4.83381 17.9499 6.05034C19.1664 7.26687 20.5451 7.34797 20.5451 7.34797M10.1002 15.5876L8.4126 13.9",stroke:"currentColor",strokeWidth:"1.5"})]})}},85421:function(e,a,t){"use strict";var s=t(85893);a.Z=e=>{let{className:a}=e;return(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:a,children:[(0,s.jsx)("line",{x1:"12",y1:"2",x2:"12",y2:"6"}),(0,s.jsx)("line",{x1:"12",y1:"18",x2:"12",y2:"22"}),(0,s.jsx)("line",{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76"}),(0,s.jsx)("line",{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07"}),(0,s.jsx)("line",{x1:"2",y1:"12",x2:"6",y2:"12"}),(0,s.jsx)("line",{x1:"18",y1:"12",x2:"22",y2:"12"}),(0,s.jsx)("line",{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24"}),(0,s.jsx)("line",{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93"})]})}},88381:function(e,a,t){"use strict";var s=t(85893);a.Z=e=>{let{className:a}=e;return(0,s.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:a,children:[(0,s.jsx)("path",{d:"M20.5001 6H3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,s.jsx)("path",{d:"M18.8334 8.5L18.3735 15.3991C18.1965 18.054 18.108 19.3815 17.243 20.1907C16.378 21 15.0476 21 12.3868 21H11.6134C8.9526 21 7.6222 21 6.75719 20.1907C5.89218 19.3815 5.80368 18.054 5.62669 15.399
11L5.16675 8.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,s.jsx)("path",{opacity:"0.5",d:"M9.5 11L10 16",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,s.jsx)("path",{opacity:"0.5",d:"M14.5 11L14 16",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,s.jsx)("path",{opacity:"0.5",d:"M6.5 6C6.55588 6 6.58382 6 6.60915 5.99936C7.43259 5.97849 8.15902 5.45491 8.43922 4.68032C8.44784 4.65649 8.45667 4.62999 8.47434 4.57697L8.57143 4.28571C8.65431 4.03708 8.69575 3.91276 8.75071 3.8072C8.97001 3.38607 9.37574 3.09364 9.84461 3.01877C9.96213 3 10.0932 3 10.3553 3H13.6447C13.9068 3 14.0379 3 14.1554 3.01877C14.6243 3.09364 15.03 3.38607 15.2493 3.8072C15.3043 3.91276 15.3457 4.03708 15.4286 4.28571L15.5257 4.57697C15.5433 4.62992 15.5522 4.65651 15.5608 4.68032C15.841 5.45491 16.5674 5.97849 17.3909 5.99936C17.4162 6 17.4441 6 17.5 6",stroke:"currentColor",strokeWidth:"1.5"})]})}},56606:function(e,a,t){"use strict";t.r(a),t.d(a,{default:function(){return D}});var s=t(85893),l=t(43886),r=t(22551),n=t(30178),i=t(26272),o=t(85563),d=t(12014),c=e=>{let{className:a}=e;return(0,s.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:a,children:[(0,s.jsx)("path",{d:"M10.0464 14C8.54044 12.4882 8.67609 9.90087 10.3494 8.22108L15.197 3.35462C16.8703 1.67483 19.4476 1.53865 20.9536 3.05046C22.4596 4.56228 22.3239 7.14956 20.6506 8.82935L18.2268 11.2626",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,s.jsx)("path",{opacity:"0.5",d:"M13.9536 10C15.4596 11.5118 15.3239 14.0991 13.6506 15.7789L11.2268 18.2121L8.80299 20.6454C7.12969 22.3252 4.55237 22.4613 3.0464 20.9495C1.54043 19.4377 1.67609 16.8504 3.34939 15.1706L5.77323 12.7373",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})},m=t(88381),u=t(88057),p=t(93790),x=t(23287),h=t(94425),g=t(88393),f=t(87066),v=t(41664),b=t.n(v),y=t(11163),j=t(67294),N=t(85421),w=t(51726),_=t(89121),C=t(46320);let k=e=>null==e?null:"number"==typeof e?e:e.Valid?e.Int32:null;var S=e=>{let{isOpen:a,setIsOpen:t,modelId:l,modelName:i,onChanged:o}=e,{primaryColor:d}=(0,p.DY)(),c=(0,x.CG)(e=>e.userData),m=1===c.role_id||c.role_id>5,[h,g]=(0,j.useState)([]),[v,b]=(0,j.useState)([]),[y,S]=(0,j.useState)([]),[L,F]=(0,j.useState)(null),[E,A]=(0,j.use
1State)(null),[M,I]=(0,j.useState)([]),[D,T]=(0,j.useState)({schools:!1,departments:!1,classes:!1,mappings:!1}),[P,O]=(0,j.useState)(null);function V(e,a){var t,s;let l=f.default.isAxiosError(e)&&(null===(s=e.response)||void 0===s?void 0:null===(t=s.data)||void 0===t?void 0:t.message)||a;(0,n.CF)("error",l)}(0,j.useEffect)(()=>{a&&(async()=>{var e;await R();let a=null===(e=c.school_id)||void 0===e?void 0:e.toString();if(m||!a)await Z();else{let e={value:a,label:""};g([e]),F(e),await z(a)}})()},[a,l]);let R=async()=>{if(l)try{T(e=>({...e,mappings:!0}));let e=await f.default.get("".concat(u._n,"/admin/aaja_model/mappings/").concat(l));200===e.status&&I(e.data.mappings||[])}catch(e){V(e,"Failed to load model mappings")}finally{T(e=>({...e,mappings:!1}))}};async function Z(){try{T(e=>({...e,schools:!0}));let e=await f.default.get("".concat(u._n,"/school?limit=-1"));if(200===e.status){let a=e.data.data.map(e=>({value:e.id.toString(),label:e.name}));g(a);let t=!m&&c.school_id?a.find(e=>parseInt(e.value)===c.school_id):a[0];t&&(F(t),await z(t.value))}}catch(e){V(e,"Failed to load campuses")}finally{T(e=>({...e,schools:!1}))}}async function z(e){try{T(e=>({...e,departments:!0})),b([]),A(null),S([]);let a=await f.default.get("".concat(u._n,"/departments?school_id=").concat(e));if(200===a.status){let e=a.data.data.map(e=>({value:e.id.toString(),label:e.name}));b(e),e.length>0&&(A(e[0]),await H(e[0].value))}}catch(e){V(e,"Failed to load departments")}finally{T(e=>({...e,departments:!1}))}}async function H(e){try{T(e=>({...e,classes:!0})),S([]);let a=await f.default.get("".concat(u._n,"/classes/").concat(e));if(200===a.status){let e=(a.data.classes||[]).map(e=>({value:e.id.toString(),label:e.name||"Course ".concat(e.id)}));S(e)}}catch(e){V(e,"Failed to load courses")}finally{T(e=>({...e,classes:!1}))}}let B=async e=>{F(e),A(null),S([]),e?await z(e.value):b([])},q=async e=>{A(e),e?await H(e.value):S([])},W=e=>{if(E)return M.find(a=>a.department_id===parseInt(E.value)&&k(a.category_id)===parseInt(e))},J=async e=>{if(L&&E){O(e);try{let a=[{model_id:l,school_id:parseInt(L.value),department_id:parseInt(E.value),category_id:{Valid:!0,Int32:parseInt(e)}}],t=await f.default.post("".concat(u._n,"/admin/aaja_model/mappings"),a,{headers:{"Content-Type":"application/json"}});(200===t.status||201===t.status)&&((0,n.CF)("success","Model assigned successfully"),await R(),null==o||o())}catch(e){V(e,"Failed to assign model")}finally{O(null)}}},U=async(e,a)=>{O(e);try{let e=await f.default.delete("".concat(u._n,"/admin/aaja_model/mappings/").concat(a));200===e.status&&((0,n.CF)("success","Mapping removed"),await R(),null==o||o())}catch(e){V(e,"Failed to remove mapping")}finally{O(null)}};return(0,s.jsx)(_.u,{appear:!0,show:a,as:j.Fragment,children:(0,s.jsxs)(C.V,{as:"div",open:a,onClose:()=>t(!1),children:[(0,s.jsx)(_.u.Child,{as:j.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)("div",{className:"fixed inset-0"})}),(0,s.jsx)("div",{className:"fixed inset-0 z-[999] overflow-y-auto bg-[black]/60 px-4",children:(0,s.jsx)("div",{className:"flex min-h-screen items-start justify-center px-4",children:(0,s.jsxs)(C.V.Panel,{className:"panel my-8 w-full max-w-lg overflow-hidden rounded-lg border-0 p-0 text-black dark:text-white-dark",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between bg-[#fbfbfb] px-5 py-3 dark:bg-[#121c2c]",children:[(0,s.jsx)("h5",{className:"text-lg font-bold",children:i?"Assign - ".concat(i):"Assign Model"}),(0,s.jsx)("button",{type:"button",onClick:()=>t(!1),className:"text-white-dark hover:text-dark",children:(0,s.jsx)(w.Z,{})})]}),(0,s.jsxs)("div",{className:"p-5",children:[(0,s.jsxs)("div",{className:"mb-6 grid grid-cols-1 gap-4",children:[m&&(0,s.jsxs)("div",{className:"flex w-full flex-col",children:[(0,s.jsx)("label",{className:"mb-1 text-base font-normal",htmlFor:"campus",children:"Campus"}),(0,s.jsx)(r.Z,{placeholder:D.schools?"Loading campuses...":"Select Campus",color:d,className:"w-full text-gray-500",options:h,value:L,onChange:B})]}),(0,s.jsxs)("div",{className:"flex w-full flex-col",children:[(0,s.jsx)("label",{className:"mb-1 text-base font-normal",htmlFor:"department",children:"Department"}),(0,s.jsx)(r.Z,{placeholder:D.departments?"Loading departments...":"Select Department",className:"w-full text-gray-500",options:v,value:E,color:d,onChange:q})]})]}),(0,s.jsx)("div",{className:"flex flex-col justify-center gap-0",children:D.classes||D.mappings?(0,s.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,s.jsx)(N.Z,{className:"animate-spin"})}):0===y.length?(0,s.jsx)("div",{className:"py-8 text-center text-sm text-gray-500",children:"No courses found for this department."}):(0,s.jsx)("div",{className:"max-h-[50vh] overflow-y-auto",children:y.map((e,a)=>{let t=W(e.value),l=P===e.value;return(0,s.jsxs)("div",{className:"".concat(a%2==0?"bg-neutral-100":"bg-white"," mt-2 flex h-fit items-center justify-between px-2 py-2 text-sm"),children:[(0,s.jsx)("p",{children:e.label}),t?(0,s.jsx)("button",{onClick:()=>U(e.value,t.id),className:"flex items-center gap-1 rounded bg-red-500 px-2 py-1 text-white",disabled:l,children:l?(0,s.jsx)(N.Z,{className:"h-4 w-4 animate-spin"}):"Remove"}):(0,s.jsx)("button",{onClick:()=>J(e.value),className:"flex items-center gap-1 rounded bg-primary px-2 py-1 text-white",disabled:l,children:l?(0,s.jsx)(N.Z,{className:"h-4 w-4 animate-spin"}):"Assign"})]},e.value)})})})]})]})})})]})})},L=e=>{var a,t;let{isOpen:l,setIsOpen:i,model:o,onModelUpdated:d}=e,{primaryColor:c}=(0,p.DY)(),m=(0,x.CG)(e=>
1e.userData),[h,g]=(0,j.useState)(""),[v,b]=(0,j.useState)(""),[y,N]=(0,j.useState)({value:"INTERNAL",label:"Internal (S3 Link)"}),[k,S]=(0,j.useState)(""),[L,F]=(0,j.useState)(""),[E,A]=(0,j.useState)(null),[M,I]=(0,j.useState)(null),[D,T]=(0,j.useState)(!1),[P,O]=(0,j.useState)([]),[V,R]=(0,j.useState)([]),[Z,z]=(0,j.useState)([]),[H,B]=(0,j.useState)(null),[q,W]=(0,j.useState)(!1),[J,U]=(0,j.useState)(null),[X,G]=(0,j.useState)(null),[Y,$]=(0,j.useState)(0),[K,Q]=(0,j.useState)(.005),[ee,ea]=(0,j.useState)(.04),[et,es]=(0,j.useState)(.2),[el,er]=(0,j.useState)(1.3),[en,ei]=(0,j.useState)(!1),[eo,ed]=(0,j.useState)([]),[ec,em]=(0,j.useState)({label:"All",value:""}),[eu,ep]=(0,j.useState)({}),[ex,eh]=(0,j.useState)({}),[eg,ef]=(0,j.useState)(!1),[ev,eb]=(0,j.useState)("[]"),[ey,ej]=(0,j.useState)(null),[eN,ew]=(0,j.useState)("#000000"),[e_,eC]=(0,j.useState)(null),ek=()=>{ej(null);try{let e=JSON.parse(ev);if(!Array.isArray(e))return ej("Hotspots must be an array"),!1;for(let a=0;a<e.length;a++){let t=e[a];if(!t.id)return ej("Hotspot at index ".concat(a," is missing an id")),!1;if(!Array.isArray(t.position)||3!==t.position.length)return ej("Hotspot '".concat(t.id,"' has invalid position format. Expected [x, y, z]")),!1;for(let e=0;e<t.position.length;e++)if("number"!=typeof t.position[e])return ej("Hotspot '".concat(t.id,"' has non-numeric position value")),!1;if(!t.label)return ej("Hotspot '".concat(t.id,"' is missing a label")),!1}return eb(JSON.stringify(e,null,2)),ej(""),!0}catch(e){return ej("Invalid JSON: ".concat(null==e?void 0:e.message)),!1}},eS=e=>/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(e)?(eC(null),!0):(eC("Please enter a valid hex color code (e.g., #FF5733)"),!1),eL=(e,a)=>{e.preventDefault(),e.stopPropagation(),ef(a)};(0,j.useEffect)(()=>{l&&o&&(g(o.name),b(o.description||""),N({value:o.model_type,label:"INTERNAL"===o.model_type?"Internal (S3 Link)":"External"}),S(o.attachment_url),A(null),I(null),$(o.initial_camera_position_x),Q(o.initial_camera_position_y),ea(o.initial_camera_position_z),es(o.tone_mapping_exposure),er(o.mobile_camera_scale),ei(o.has_animation),ew(o.hexcode||"#000000"),o.hotspots&&eb(JSON.stringify(JSON.parse(o.hotspots),null,2)),eF(o.am_id))},[l,o]),(0,j.useEffect)(()=>{m&&([2,3,4].includes(m.role_id)?eA(m.school_id.toString()):eE())},[m]),(0,j.useEffect)(()=>{if(J){let e=null,a=async()=>{try{let e=await f.default.get("".concat(u._n,"/admin/model_task/").concat(J),{headers:{}});e.data&&e.data.task.status&&(G(e.data.task.status),"completed"===e.data.task.status?((0,n.CF)("success","Model processing completed successfully!"),U(null),i(!1),d&&d()):"failed"===e.data.task.status&&((0,n.CF)("error","Model processing failed: ".concat(e.data.message||"Unknown error")),U(null)))}catch(e){console.error("Error checking processing status:",e)}};return a(),e=setInterval(a,5e3),()=>{e&&clearInterval(e)}}},[J]);let eF=async e=>{W(!0);try{let a=await f.default.get("".concat(u._n,"/admin/aaja_model/mappings/").concat(e),{headers:{}});if(200===a.status){let e=(a.data.mappings||[]).map(e=>({id:e.id,school_id:e.school_id,department_id:e.department_id,category_id:e.category_id,isLocked:!0,school_name:e.school_name,department_name:e.department_name,category_name:e.category_name}));O(e),R([]),z([])}}catch(e){console.error("Error fetching model mappings:",e),(0,n.CF)("error","Failed to load model mappings. Please try again.")}finally{W(!1)}};async function eE(){try{let e=await f.default.get("".concat(u._n,"/school?limit=-1"),{headers:{}});if(200===e.status){let a=e.data.data.map(e=>({value:e.id.toString(),label:e.name}));ed([{label:"Select Campus",value:""},...a]),em({label:"Select Campus",value:""})}}catch(e){console.error("Error fetching schools:",e)}}async function eA(e){if(!e||eu[e])return eu[e]||[];try{let a=await f.default.get("".concat(u._n,"/departments?school_id=").concat(e));if(200===a.status){let t=a.data.data.map(e=>({value:e.id.toString(),label:e.name})),s=[{label:"Select Department",value:""},...t];return ep(a=>({...a,[e]:s})),s}}catch(e){console.error("Error fetching departments:",e)}return[]}async function eM(e){if(!e||ex[e])return ex[e]||[];try{let a=await f.default.get("".concat(u._n,"/classes/").concat(e),{headers:{}});if(200===a.status){let t=(a.data.classes||[]).map(e=>({value:e.id.toString(),label:e.name}));return eh(a=>({...a,[e]:t})),t}}catch(e){console.error("Error fetching categories:",e)}return[]}let eI=e=>{let a=[...V];a.splice(e,1),R(a)},eD=async e=>{if(e&&o){B(e);try{await f.default.delete("".concat(u._n,"/admin/aaja_model/mappings/").concat(e),{headers:{}}),O(a=>a.filter(a=>a.id!==e)),z(a=>[...a,e]),(0,n.CF)("success","Mapping removed successfully")}catch(s){var a,t;let e=(null==s?void 0:null===(t=s.response)||void 0===t?void 0:null===(a=t.data)||void 0===a?void 0:a.message)||"Failed to remove mapping. Please try again.";(0,n.CF)("error",e)}finally{B(null)}}},eT=async(e,a,t)=>{let s=[...V];"school_id"===a?(s[e].school_id=parseInt(t),s[e].department_id=0,s[e].category_id={Valid:!1,Int32:0},t&&await eA(t)):"department_id"===a?(s[e].department_id=parseInt(t),s[e].category_id={Valid:!1,Int32:0},t&&await eM(t)):"category_id"===a&&(s[e].category_id={Valid:""!==t,Int32:""!==t?parseInt(t):0}),R(s)},eP=async e=>
1{if(e.preventDefault(),o){if("INTERNAL"===y.value&&!ek()){(0,n.CF)("error","Please fix the hotspots JSON format errors");return}if("INTERNAL"===y.value&&!eS(eN)){(0,n.CF)("error","Please fix the hex color code format errors");return}if(0===P.length&&0===V.length){(0,n.CF)("error","Please add at least one mapping.");return}T(!0);try{let e=V.filter(e=>e.school_id>0&&e.department_id>0&&e.category_id.Valid),a=new FormData;o.name!==h&&a.append("name",h),o.description!==v&&a.append("description",v),o.model_type!==y.value&&a.append("model_type",y.value),"EXTERNAL"===y.value?(o.attachment_url!==k&&a.append("attachment_url",k),o.hexcode!==eN&&a.append("hexcode",eN)):"INTERNAL"===y.value&&(E&&a.append("model_file",E),o.initial_camera_position_x!==Y&&a.append("initial_camera_position_x",Y.toString()),o.initial_camera_position_y!==K&&a.append("initial_camera_position_y",K.toString()),o.initial_camera_position_z!==ee&&a.append("initial_camera_position_z",ee.toString()),o.tone_mapping_exposure!==et&&a.append("tone_mapping_exposure",et.toString()),o.mobile_camera_scale!==el&&a.append("mobile_camera_scale",el.toString()),o.has_animation!==en&&a.append("has_animation",en.toString()),""==o.hotspots.trim()&&""!=ev.trim()?a.append("hotspots",ev):""!=o.hotspots.trim()&&""==ev.trim()?a.append("hotspots",o.hotspots):o.hotspots!==ev&&a.append("hotspots",ev)),M&&a.append("cover_image",M),o.am_id&&a.append("am_id",o.am_id);let t=await f.default.patch("".concat(u._n,"/admin/aaja_model/"),a,{headers:{"Content-Type":"multipart/form-data"}}),s=!1,l=null;200===t.status&&(s=!0,t.data.task_id&&(l=t.data.task_id,U(l),(0,n.CF)("success","Model update started. Processing in background...")));let r=!0;if(e.length>0)try{let a=e.map(e=>({model_id:o.am_id,school_id:e.school_id,department_id:e.department_id,category_id:e.category_id})),t=await f.default.post("".concat(u._n,"/admin/aaja_model/mappings"),a,{headers:{"Content-Type":"application/json"}});200!==t.status&&201!==t.status&&(r=!1)}catch(e){console.error("Error adding new mappings:",e),r=!1}s&&r?!l&&((0,n.CF)("success","Model updated successfully"),i(!1),d&&d()):s&&!r?(0,n.CF)("warning","Model information updated but failed to add new mappings."):!s&&r?(0,n.CF)("warning","New mappings added but failed to update model information."):(0,n.CF)("error","Failed to update model. Please try again.")}catch(s){var a,t;let e=(null==s?void 0:null===(t=s.response)||void 0===t?void 0:null===(a=t.data)||void 0===a?void 0:a.message)||"Failed to update the 3D model. Please try again.";(0,n.CF)("error",e)}finally{T(!1)}}},eO=e=>eu[e.school_id.toString()]||[{label:"Select Department",value:""}],eV=e=>ex[e.department_id.toString()]||[];return(0,s.jsx)("div",{children:(0,s.jsx)(_.u,{appear:!0,show:l,as:j.Fragment,children:(0,s.jsxs)(C.V,{as:"div",open:l,onClose:()=>{},children:[(0,s.jsx)(_.u.Child,{as:j.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)("div",{className:"fixed inset-0"})}),(0,s.jsx)("div",{id:"edit_model_modal",className:"fixed inset-0 z-[999] overflow-y-auto bg-[black]/60",children:(0,s.jsx)("div",{className:"flex min-h-screen items-start justify-center px-4",children:(0,s.jsx)(_.u.Child,{as:j.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:(0,s.jsxs)(C.V.Panel,{className:"panel my-8 w-full max-w-4xl rounded-lg border-0 px-4 py-1 text-black dark:text-white-dark",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between text-lg font-semibold dark:text-white",children:[(0,s.jsx)("h5",{className:"w-full border-b border-[#ebe9f1] py-3 dark:border-white/10",children:"Edit 3D Model"}),!X&&(0,s.jsx)("button",{type:"button",onClick:()=>i(!1),className:"text-white-dark hover:text-dark",children:(0,s.jsx)(w.Z,{className:"h-4 w-4"})})]}),(0,s.jsx)("div",{className:"p-5",children:J&&X?(0,s.jsxs)("div",{className:"text-center p-6",children:[(0,s.jsx)("div",{className:"mb-4",children:(0,s.jsxs)("svg",{className:"inline-block h-12 w-12 animate-spin text-primary",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}),(0,s.jsx)("h3",{className:"text-xl font-bold mb-2",children:"Processing Your 3D Model"}),(0,s.jsxs)("p",{className:"text-gray-500 mb-4",children:["Status: ",X]}),(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Please wait while we process your upload. This may take a few minutes depending on the file size."})]}):o?(0,s.jsxs)("form",{onSubmit:eP,className:"space-y-4",children:[(0,s.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"gap flex",children:["Model Name",(0,s.jsx)("div",{className:"text-red",style:{color:"red"},children:"*"})]}),(0,s.jsx)("input",{value:h,onChange:e=>g(e.target.value),className:"form-input w-[70%] rounded-[5px] border border-gray-300 bg-white px-3 py-2 font-normal focus:outline-none",placeholder:"Enter model name",required:!0})]}),(0,s.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"gap flex",children:["Model Description",(0,s.jsx)("div",{className:"text-red",style:{color:"red"},children:"*"})]}
1),(0,s.jsx)("textarea",{value:v,onChange:e=>b(e.target.value),className:"form-input w-[70%] rounded-[5px] border border-gray-300 bg-white px-3 py-2 font-normal focus:outline-none",placeholder:"Enter model description",required:!0})]}),(0,s.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"gap flex",children:["Model Type",(0,s.jsx)("div",{className:"text-red",style:{color:"red"},children:"*"})]}),(0,s.jsx)(r.Z,{color:c,className:"w-[70%]",options:[{value:"INTERNAL",label:"Internal (S3 Link)"},{value:"EXTERNAL",label:"External"},{value:"VIDEO",label:"Video"}],value:y,onChange:e=>{e&&N(e)}})]}),"EXTERNAL"===y.value?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"gap flex",children:["Attachment URL",(0,s.jsx)("div",{className:"text-red",style:{color:"red"},children:"*"})]}),(0,s.jsx)("input",{value:k,onChange:e=>S(e.target.value),className:"form-input w-[70%] rounded-[5px] border border-gray-300 bg-white px-3 py-2 font-normal focus:outline-none",placeholder:"Enter external model URL",required:"EXTERNAL"===y.value})]}),(0,s.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"gap flex",children:["Model Color",(0,s.jsx)("div",{className:"text-red",style:{color:"red"},children:"*"})]}),(0,s.jsxs)("div",{className:"w-[70%] flex items-center",children:[(0,s.jsx)("input",{value:eN,onChange:e=>{let a=e.target.value;ew(a),eS(a)},className:"form-input rounded-[5px] border ".concat(e_?"border-red-500":"border-gray-300"," bg-white px-3 py-2 font-normal focus:outline-none flex-grow mr-2"),placeholder:"#000000",required:!0}),(0,s.jsx)("input",{type:"color",value:eN,onChange:e=>ew(e.target.value),className:"h-10 w-10 cursor-pointer rounded border border-gray-300"})]})]}),e_&&(0,s.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,s.jsx)("div",{}),(0,s.jsx)("p",{className:"w-[70%] text-sm text-red-500",children:e_})]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,s.jsx)("div",{className:"gap flex",children:"Current Model File"}),(0,s.jsx)("div",{className:"w-[70%] text-gray-500",children:"processing"===o.attachment_url?(0,s.jsx)("span",{className:"text-amber-500",children:"Processing..."}):o.attachment_url?(0,s.jsx)("span",{className:"text-ellipsis overflow-hidden",children:o.attachment_url.split("/").pop()}):(0,s.jsx)("span",{children:"No file attached"})})]}),(0,s.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"gap flex",children:["New Model File (.GLB)",(0,s.jsx)("span",{className:"text-xs text-gray-500 ml-2 mt-1",children:"(Optional)"})]}),(0,s.jsxs)("div",{className:"w-[70%] form-input cursor-pointer rounded-[5px] border ".concat(eg?"border-primary border-dashed":"border-gray-300"," bg-white px-3 py-2 font-normal flex items-center justify-between"),onClick:()=>{var e,a;return null===(a=document)||void 0===a?void 0:null===(e=a.getElementById("model-file-input"))||void 0===e?void 0:e.click()},onDragOver:e=>eL(e,!0),onDragEnter:e=>eL(e,!0),onDragLeave:e=>eL(e,!1),onDrop:e=>{e.preventDefault(),e.stopPropagation(),ef(!1),e.dataTransfer.files&&e.dataTransfer.files[0]&&A(e.dataTransfer.files[0])},children:[(0,s.jsx)("span",{className:"truncate",children:(null==E?void 0:E.name)||"Choose GLB file or drag and drop here"}),(0,s.jsx)("span",{className:"text-primary ml-2",children:"Browse"}),(0,s.jsx)("input",{id:"model-file-input",type:"file",accept:".glb",className:"hidden",onChange:e=>{e.target.files&&e.target.files[0]&&A(e.target.files[0])}})]})]}),(0,s.jsxs)("div",{className:"border-t border-gray-200 pt-4 pb-2",children:[(0,s.jsx)("h6",{className:"mb-2 font-semibold",children:"Rendering Settings"}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("input",{id:"has-animation",type:"checkbox",checked:en,onChange:e=>
1ei(e.target.checked),className:"h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"}),(0,s.jsx)("label",{htmlFor:"has-animation",className:"ml-2 mt-1.5 block text-sm text-gray-700",children:"Model Has Animation"})]}),(0,s.jsx)("p",{className:"mt-1 text-xs text-gray-500",children:"Enable this if your 3D model contains animations that should be played automatically."})]}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Initial Camera Position"}),(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"X"}),(0,s.jsx)("input",{type:"number",step:"0.001",value:Y,onChange:e=>$(parseFloat(e.target.value)),className:"form-input w-full rounded-[5px] border border-gray-300 bg-white px-3 py-2 font-normal focus:outline-none"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Y"}),(0,s.jsx)("input",{type:"number",step:"0.001",value:K,onChange:e=>Q(parseFloat(e.target.value)),className:"form-input w-full rounded-[5px] border border-gray-300 bg-white px-3 py-2 font-normal focus:outline-none"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Z"}),(0,s.jsx)("input",{type:"number",step:"0.001",value:ee,onChange:e=>ea(parseFloat(e.target.value)),className:"form-input w-full rounded-[5px] border border-gray-300 bg-white px-3 py-2 font-normal focus:outline-none"})]})]})]}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Tone Mapping Exposure"}),(0,s.jsx)("input",{type:"number",step:"0.1",value:et,onChange:e=>es(parseFloat(e.target.value)),className:"form-input w-full rounded-[5px] border border-gray-300 bg-white px-3 py-2 font-normal focus:outline-none"})]}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Mobile Camera Scale"}),(0,s.jsx)("input",{type:"number",step:"0.1",value:el,onChange:e=>er(parseFloat(e.target.value)),className:"form-input w-full rounded-[5px] border border-gray-300 bg-white px-3 py-2 font-normal focus:outline-none"})]}),(0,s.jsxs)("div",{className:"border-t border-gray-200 pt-4 pb-2",children:[(0,s.jsx)("h6",{className:"mb-2 font-semibold",children:"Hotspots (For developers only)"}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Add Hotspots (JSON format)"}),(0,s.jsx)("textarea",{value:ev,onChange:e=>eb(e.target.value),onBlur:ek,className:"form-textarea w-full rounded-[5px] border ".concat(ey?"border-red-500":"border-gray-300"," bg-white px-3 py-2 font-mono text-sm focus:outline-none"),rows:1}),ey&&(0,s.jsx)("p",{className:"mt-1 text-sm text-red-500",children:ey}),""==ey&&(0,s.jsx)("p",{className:"mt-1 text-sm text-green-500",children:"Validated Successfully"}),(0,s.jsx)("p",{className:"mt-1 text-xs text-gray-500",children:"Enter hotspots as a JSON array. Each hotspot should have an id, position (array of 3 numbers [x, y, z]), and label."}),(0,s.jsx)("button",{type:"button",onClick:ek,className:"mt-2 btn btn-sm btn-outline-primary",children:"Validate JSON"})]})]})]})]}),(0,s.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"gap flex flex-col",children:["Cover Image",(0,s.jsx)("span",{className:"text-xs text-gray-500",children:"(Optional - leave empty to keep current)"})]}),(0,s.jsxs)("div",{className:"w-[70%]",children:[(0,s.jsxs)("div",{className:"cursor-pointer form-input rounded-[5px] border ".concat(eg?"border-primary border-dashed":"border-gray-300"," bg-white px-3 py-2 font-normal flex items-center justify-between"),onClick:()=>{var e,a;return null===(a=document)||void 0===a?void 0:null===(e=a.getElementById("cover-image-input"))||void 0===e?void 0:e.click()},onDragOver:e=>eL(e,!0),onDragEnter:e=>eL(e,!0),onDragLeave:e=>eL(e,!1),onDrop:e=>{e.preventDefault(),e.stopPropagation(),ef(!1),e.dataTransfer.files&&e.dataTransfer.files[0]&&I(e.dataTransfer.files[0])},children:[(0,s.jsx)("span",{className:"truncate",children:(null==M?void 0:M.name)||"Choose image file or drag and drop here"}),(0,s.jsx)("span",{className:"text-primary ml-2",children:"Browse"}),(0,s.jsx)("input",{id:"cover-image-input",type:"file",accept:"image/*",className:"hidden",onChange:e=>{e.target.files&&e.target.files[0]&&I(e.target.files[0])}})]}),o.cover_image&&!M&&(0,s.jsxs)("div",{className:"mt-2 flex items-center",children:[(0,s.jsx)("span",{className:"text-xs text-gray-500 mr-2",children:"Current image:"}),(0,s.jsx)("span",{className:"truncate",children:null===(t=o.cover_image)||void 0===t?void 0:null===(a=t.split("/").pop())||void 0===a?void 0:a.split("?")[0]})]})]})]}),(0,s.jsxs)("div",{className:"border-t border-gray-200 pt-4 pb-2",children:[(0,s.jsxs)("h6",{className:"mb-2 font-semibold",children:["Existing Mappings (",q?"...":P.length,")"]}),q?(0,s.jsxs)("div",{className:"flex justify-center py-4",children:[(0,s.jsxs)("svg",{className:"h-6 w-6 animate-spin",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),(0,s.jsx)("span",{className:"ml-2",children:"Loading mappings..."})]}):P.length>0?P.map(e=>(0,s.jsxs)("div",{className:"mb-6 rounded-md border bg-gray-50 border-gray-200 p-3",children:[(0,s.jsxs)("div",{className:"flex justify-between mb-2",children:[(0,s.jsx)("span",{className:"font-medium",children:"Mapping Details"}),(0,s.jsx)("button",{type:"button",onClick:()=>eD(e.id),disabled:H===e.id,className:"text-red-500 hover:text-red-700 ".concat(H===e.id?"opacity-50 cursor-not-allowed":""),children:H===e.id?"Removing...":"Remove"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-4 text-sm",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"font-medium block text-gray-500",children:"Campus:"}),(0,s.jsx)("span",{children:e.school_name})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"font-medium block text-gray-500",children:"Department:"}),(0,s.jsx)("span",{children:e.department_name})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"font-medium block text-gray-500",children:"Category:"}),(0,s.jsx)("span",{children:e.category_name||"None"})]})]})]},e.id)):(0,s.jsx)("div",{className:"text-center py-4 text-gray-500",children:"No mappings found. Add new mappings below."})]}),(0,s.jsxs)("div",{className:"border-t border-gray-200 pt-4 pb-2",children:[(0,s.jsx)("h6",{className:"mb-2 font-semibold",children:"Add New Mappings"}),V.map((e,a)=>(0,s.jsxs)("div",{className:"mb-6 rounded-md border border-gray-200 p-3",children:[(0,s.jsxs)("div",{className:"flex justify-between mb-2",children:[(0,s.jsxs)("span",{className:"font-medium",children:["New Mapping ",a+1]}),(0,s.jsx)("button",{type:"button",onClick:()=>eI(a),className:"text-red-500 hover:text-red-700",children:"Remove"})]}),m&&1===m.role_id&&(0,s.jsxs)("div",{className:"mb-3 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"gap flex",children:["Campus",(0,s.jsx)("div",{className:"text-red",style:{color:"red"},children:"*"})]}),(0,s.jsx)(r.Z,{color:c,className:"w-[70%]",maxMenuHeight:350,options:eo.filter(e=>""!==e.value),value:eo.find(a=>a.value===e.school_id.toString())||null,onChange:e=>{e&&eT(a,"school_id",e.value)}})]}),(0,s.jsxs)("div",{className:"mb-3 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"gap flex",children:["Department",(0,s.jsx)("div",{className:"text-red",style:{color:"red"},children:"*"})]}),(0,s.jsx)(r.Z,{color:c,className:"w-[70%]",maxMenuHeight:350,options:eO(e).filter(e=>""!==e.value),value:eO(e).find(a=>a.value===e.department_id.toString())||null,onChange:e=>{e&&eT(a,"department_id",e.value)}})]}),(0,s.jsxs)("div",{className:"mb-3 flex items-center justify-between",children:[(0,s.jsx)("div",{className:"gap flex",children:"Category"}),(0,s.jsx)(r.Z,{color:c,className:"w-[70%]",maxMenuHeight:350,options:eV(e),value:eV(e).find(a=>a.value===e.category_id.Int32.toString())||null,onChange:e=>eT(a,"category_id",e?e.value:"")}
1)]})]},a)),(0,s.jsx)("button",{type:"button",onClick:()=>{R([...V,{school_id:m&&[2,3,4].includes(m.role_id)?m.school_id:0,department_id:0,category_id:{Valid:!1,Int32:0},isLocked:!1}])},className:"btn btn-outline-primary mt-2",children:"+ Add New Mapping"})]}),(0,s.jsx)("div",{className:"mt-6 flex justify-center",children:(0,s.jsx)("button",{type:"submit",className:"btn btn-success test_help_button flex items-center justify-center px-6 py-2",disabled:D,children:D?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("svg",{className:"mr-2 h-5 w-5 animate-spin",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Updating..."]}):"Update Model"})})]}):(0,s.jsx)("div",{className:"flex justify-center py-8",children:(0,s.jsx)("p",{children:"No model data available"})})})]})})})})]})})})},F=()=>(0,s.jsxs)("div",{className:"flex h-full flex-col overflow-hidden rounded-lg shadow-lg bg-white border border-gray-100",children:[(0,s.jsxs)("div",{className:"relative overflow-hidden bg-gradient-to-br from-slate-300 to-slate-400 h-[280px] rounded-lg m-4",children:[(0,s.jsx)("div",{className:"absolute top-0 left-0 z-10 m-3",children:(0,s.jsx)("div",{className:"h-6 w-20 animate-pulse rounded-md bg-indigo-300/50"})}),(0,s.jsx)("div",{className:"absolute top-0 right-0 z-10 m-3",children:(0,s.jsx)("div",{className:"h-6 w-12 animate-pulse rounded-full bg-gray-300/50"})}),(0,s.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,s.jsx)("div",{className:"h-20 w-20 animate-pulse rounded-full bg-gray-400/20"})})]}),(0,s.jsxs)("div",{className:"flex-grow p-4",children:[(0,s.jsx)("div",{className:"mb-1.5 h-5 w-3/4 animate-pulse rounded-md bg-gray-200"}),(0,s.jsxs)("div",{className:"flex items-center mb-2",children:[(0,s.jsx)("div",{className:"inline-block h-2 w-2 rounded-full mr-1.5 bg-gray-300"}),(0,s.jsx)("div",{className:"h-3 w-14 animate-pulse rounded-md bg-gray-200"})]}),(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsx)("div",{className:"h-3 w-full animate-pulse rounded-md bg-gray-200 mb-1"}),(0,s.jsx)("div",{className:"h-3 w-full animate-pulse rounded-md bg-gray-200"})]}),(0,s.jsx)("div",{className:"flex items-center mb-3",children:(0,s.jsx)("div",{className:"h-3 w-24 animate-pulse rounded-md bg-gray-200"})})]}),(0,s.jsx)("div",{className:"px-4 pb-4 pt-1 border-t border-gray-100",children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("div",{className:"h-8 w-[70px] animate-pulse rounded-md bg-indigo-100"}),(0,s.jsx)("div",{className:"h-8 w-20 animate-pulse rounded-md bg-blue-100"}),(0,s.jsx)("div",{className:"h-8 w-20 animate-pulse rounded-md bg-red-100"})]})})]}),E=e=>{let{shouldRefetch:a,resetRefetch:t}=e;(0,y.useRouter)();
1let[v,N]=(0,j.useState)([]),[w,_]=(0,j.useState)(0),[C,k]=(0,j.useState)(0),E=[10,30,50,100],[A,M]=(0,j.useState)(1),[I,D]=(0,j.useState)(E[0]),{primaryColor:T}=(0,p.DY)(),P=(0,x.CG)(e=>e.userData),[O,V]=(0,j.useState)([]),[R,Z]=(0,j.useState)([]),[z,H]=(0,j.useState)([]),[B,q]=(0,j.useState)({label:"All",value:""}),[W,J]=(0,j.useState)({label:"All",value:""}),[U,X]=(0,j.useState)({label:"All",value:""}),G=1===P.role_id||P.role_id>5,[Y,$]=(0,j.useState)(!0),[K,Q]=(0,j.useState)(void 0),[ee,ea]=(0,j.useState)(!1),[et,es]=(0,j.useState)(null),[el,er]=(0,j.useState)({isOpen:!1,model:null}),[en,ei]=(0,j.useState)({isOpen:!1,model:null}),[eo,ed]=(0,j.useState)("ALL"),ec=4===P.role_id&&6===P.sub_role_id,em=(0,j.useMemo)(()=>!!P&&(!ec||"ALL"!==eo),[P,ec,eo]),[eu,ep]=(0,j.useState)(""),[ex,eh]=(0,j.useState)(""),eg=(0,j.useRef)();async function ef(){try{let e=await f.default.get("".concat(u._n,"/school?limit=-1"),{headers:{}});if(200===e.status){let a=e.data.data.map(e=>({value:e.id.toString(),label:e.name}));V(a)}}catch(a){let e="An unexpected error occurred. Please try again.";if(f.default.isAxiosError(a)){if(a.response)switch(a.response.status){case 400:e="Invalid request. Please check your input.";break;case 401:e="You are not authorized to view this data. Please log in.";break;case 404:e="The requested data could not be found.";break;case 750:e="We're experiencing server issues. Please try again later."}else a.request&&(e="Unable to connect to the server. Please check your internet connection.")}(0,n.CF)("error",e)}}async function ev(e){try{let a=await f.default.get("".concat(u._n,"/departments?school_id=").concat(e));if(200===a.status){let e=a.data.data.map(e=>({value:e.id.toString(),label:e.name}));Z(e)}}catch(a){let e="An unexpected error occurred. Please try again.";if(f.default.isAxiosError(a)){if(a.response)switch(a.response.status){case 400:e="Invalid request. Please check your input.";break;case 401:e="You are not authorized to view this data. Please log in.";break;case 404:e="The requested data could not be found.";break;case 750:e="We're experiencing server issues. Please try again later."}else a.request&&(e="Unable to connect to the server. Please check your internet connection.")}(0,n.CF)("error",e)}}async function eb(e){try{let a=await f.default.get("".concat(u._n,"/classes/").concat(e),{headers:{}});if(200===a.status){let e=a.data.classes.map(e=>({value:e.id.toString(),label:e.name}));H(e)}}catch(a){let e="An unexpected error occurred. Please try again.";if(f.default.isAxiosError(a)){if(a.response)switch(a.response.status){case 400:e="Invalid request. Please check your input.";break;case 401:e="You are not authorized to view this data. Please log in.";break;case 404:e="The requested data could not be found.";break;case 750:e="We're experiencing server issues. Please try again later."}else a.request&&(e="Unable to connect to the server. Please check your internet connection.")}(0,n.CF)("error",e)}}(0,j.useEffect)(()=>{P.role_id&&([2,3,4,5].includes(P.role_id)?(q({label:"",value:P.school_id.toString()}),ev(P.school_id.toString())):ef())},[P]),(0,j.useEffect)(()=>{if(G){var e,a,t;ej(A,I,null!==(e=null==B?void 0:B.value)&&void 0!==e?e:"",null!==(a=null==W?void 0:W.value)&&void 0!==a?a:"",null!==(t=null==U?void 0:U.value)&&void 0!==t?t:"",ex)}else A&&I&&B&&B.value&&ej(A,I,B.value,W.value,U.value,ex)},[P,A,I,null==B?void 0:B.value,null==W?void 0:W.value,null==U?void 0:U.value,ex,eo]),(0,j.useEffect)(()=>{if(a){var e,s,l;ej(A,I,null!==(e=null==B?void 0:B.value)&&void 0!==e?e:"",null!==(s=null==W?void 0:W.value)&&void 0!==s?s:"",null!==(l=null==U?void 0:U.value)&&void 0!==l?l:"",ex),t()}},[a,A,I]),(0,j.useEffect)(()=>()=>{eg.current&&clearTimeout(eg.current)},[]);let ey=(e,a)=>({...e,serial_no:a+1,school:"",department:"",class:""}),ej=async(e,a,t,s,l,r)=>{try{let n="".concat(u._n,"/admin/aaja_model/panel?");e&&(n+="page=".concat(e)),a&&(n+="&limit=".concat(a)),ec&&"ALL"===eo&&(n+="&type=ALL"),t&&(n+="&school_id=".concat(t)),s&&(n+="&department_id=".concat(s)),l&&(n+="&category_id=".concat(l)),r&&(n+="&search=".concat(r));let d=await f.default.get(n,{headers:{"Content-Type":"application/json"}});if(200===d.status){var i,o;let e=d.data.data.map((e,a)=>ey(e,a));N(e);let a=(null===(o=d.data)||void 0===o?void 0:null===(i=o.pagination)||void 0===i?void 0:i.total_count)||0;_(Math.ceil(a/I)),k(a)}}catch(a){let e="An unexpected error occurred. Please try again.";if(f.default.isAxiosError(a)){if(a.response)switch(a.response.status){case 400:e="Invalid request. Please check your input.";break;case 401:e="You are not authorized to view this data. Please log in.";break;case 404:e="The requested data could not be found.";break;
1case 750:e="We're experiencing server issues. Please try again later."}else a.request&&(e="Unable to connect to the server. Please check your internet connection.")}(0,n.CF)("error",e)}finally{$(!1)}},eN=e=>"INTERNAL"===e?(0,s.jsx)("div",{className:"w-fit rounded-lg bg-blue-500 px-3 py-1 text-xs text-white",children:"INTERNAL (S3)"}):"EXTERNAL"===e?(0,s.jsx)("div",{className:"w-fit rounded-lg bg-purple-500 px-3 py-1 text-xs text-white",children:"EXTERNAL"}):"VIDEO"===e?(0,s.jsx)("div",{className:"w-fit rounded-lg bg-green-500 px-3 py-1 text-xs text-white",children:"VIDEO"}):"HTML"===e?(0,s.jsx)("div",{className:"w-fit rounded-lg bg-orange-500 px-3 py-1 text-xs text-white",children:"HTML"}):void 0,ew=async(e,a)=>{var t,s,l,r,i;if(!e)return;Q(e);let o=new FormData;o.append("am_id",e),o.append("active",String(!a));try{let e=await f.default.patch("".concat(u._n,"/admin/aaja_model/"),o,{headers:{}});200===e.status&&((0,n.CF)("success","Model status updated successfully!"),ej(A,I,null!==(t=null==B?void 0:B.value)&&void 0!==t?t:"",null!==(s=null==W?void 0:W.value)&&void 0!==s?s:"",null!==(l=null==U?void 0:U.value)&&void 0!==l?l:"",ex))}catch(a){let e=(null==a?void 0:null===(i=a.response)||void 0===i?void 0:null===(r=i.data)||void 0===r?void 0:r.message)||"An unexpected error occurred. Please try again.";(0,n.CF)("error",e)}finally{Q(void 0)}},e_=(e,a)=>1===P.role_id||8===P.role_id||(4===P.role_id&&6===P.sub_role_id?"assign"===a:P.role_id>5&&(0,h.Fs)(P.issued_certificates,e,a));return(0,s.jsxs)("div",{className:"panel mt-2 w-full",children:[(0,s.jsx)("div",{className:"my-2 flex flex-col gap-4 px-3",children:(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",children:[G&&(0,s.jsxs)("div",{className:"flex w-full flex-col",children:[(0,s.jsx)("label",{className:"mb-1 text-base font-normal",htmlFor:"campus",children:"Campus"}),(0,s.jsx)(r.Z,{placeholder:"Select Campus",color:T,className:"w-full text-gray-500",options:[{label:"All",value:""},...O],value:B,onChange:e=>{e&&(M(1),q(e),Z([]),J({label:"All",value:""}),H([]),X({label:"All",value:""}),""!==e.value&&ev(e.value))}})]}),ec&&(0,s.jsxs)("div",{className:"flex w-full flex-col",children:[(0,s.jsx)("label",{className:"mb-1 text-base font-normal",htmlFor:"filter",children:"Filter"}),(0,s.jsxs)("div",{className:"flex",children:[(0,s.jsx)("button",{type:"button",onClick:()=>{M(1),ed("ALL")},className:"flex-1 rounded-l-md border px-4 py-2.5 text-sm font-medium transition-colors ".concat("ALL"===eo?"text-white border-transparent":"border-gray-300 bg-white text-gray-700 hover:bg-gray-50"),style:{backgroundColor:"ALL"===eo?T:void 0,borderColor:"ALL"===eo?T:void 0},children:"ALL"}),(0,s.jsx)("button",{type:"button",onClick:()=>{M(1),ed("ASSIGNED")},className:"flex-1 rounded-r-md border border-l-0 px-4 py-2.5 text-sm font-medium transition-colors ".concat("ASSIGNED"===eo?"text-white border-transparent":"border-gray-300 bg-white text-gray-700 hover:bg-gray-50"),style:{backgroundColor:"ASSIGNED"===eo?T:void 0,borderColor:"ASSIGNED"===eo?T:void 0},children:"ASSIGNED"})]})]}),em&&(0,s.jsxs)("div",{className:"flex w-full flex-col",children:[(0,s.jsx)("label",{className:"mb-1 text-base font-normal",htmlFor:"department",children:"Department"}),(0,s.jsx)(r.Z,{placeholder:"Select Department",className:"w-full text-gray-500",options:[{label:"All",value:""},...R],value:W,color:T,onChange:e=>{e&&(M(1),J(e),H([]),X({label:"All",value:""}),""!==e.value&&eb(e.value))}})]}),em&&(0,s.jsxs)("div",{className:"flex w-full flex-col",children:[(0,s.jsx)("label",{className:"mb-1 text-base font-normal",htmlFor:"class",children:"Course"}),(0,s.jsx)(r.Z,{placeholder:"Select Course",options:[{label:"All",value:""},...z],value:U,className:"w-full text-gray-500",color:T,onChange:e=>{e&&(M(1),X(e))}})]}),(0,s.jsxs)("div",{className:"flex w-full flex-col",children:[(0,s.jsx)("label",{className:"mb-1 text-base font-normal",htmlFor:"search",children:"Search"}),(0,s.jsx)("input",{type:"text",placeholder:"Search by model name",className:"form-input w-full rounded-md border border-gray-300",value:eu,onChange:e=>{let a=e.target.value;ep(a),eg.current&&clearTimeout(eg.current),eg.current=setTimeout(()=>{eh(a),M(1)},500)}})]})]})}),!Y&&0===v.length&&(0,s.jsx)("div",{className:"mx-auto flex h-[500px] w-full items-center justify-center",children:(0,s.jsx)("h1",{className:"text-lg font-bold text-zinc-500",children:"No 3D models to show"})}),(0,s.jsxs)("div",{className:"mx-auto grid grid-cols-[repeat(auto-fit,300px)] place-content-center gap-x-8 gap-y-4 p-4 sm:place-content-start",children:[Y&&Array.from({length:10}).map((e,a)=>(0,s.jsx)(F,{},a)),!Y&&v.map(e=>(0,s.jsx)("div",{className:"group",children:(0,s.jsxs)("div",{className:"flex h-full flex-col overflow-hidden rounded-lg shadow-lg transition-all duration-300 hover:-translate-y-1 hover:shadow-xl bg-white border border-gray-100",children:[(0,s.jsxs)("div",{className:"relative overflow-hidden bg-gradient-to-br from-slate-300 to-slate-500 h-[280px] rounded-lg m-4",children:[(0,s.jsx)("div",{className:"absolute top-0 left-0 z-10 m-3",children:eN(e.model_type)}),e_("manage_aaja","active")&&(0,s.jsx)("div",{className:"absolute top-0 right-0 z-10 m-3",children:(0,s.jsxs)("button",{onClick:()=>ew(e.am_id,e.active),disabled:K===e.am_id,className:"\n                                                    relative inline-flex items-center h-7 w-14 roun
1ded-full transition-colors \n                                                    focus:outline-none focus:ring-2 focus:ring-offset-2 \n                                                    ".concat(K===e.am_id?"opacity-50 cursor-not-allowed":"cursor-pointer","\n                                                    ").concat(e.active?"bg-green-500":"bg-gray-500/50","\n                                            "),"aria-pressed":e.active,"aria-label":"Toggle model status to ".concat(e.active?"inactive":"active"),children:[(0,s.jsx)("span",{className:"sr-only",children:e.active?"Active":"Inactive"}),(0,s.jsx)("span",{className:"\n                                                            absolute left-1 top-1 inline-block h-5 w-5 transform rounded-full bg-white shadow-md transition-transform duration-300 ease-in-out\n                                                            ".concat(e.active?"translate-x-7":"translate-x-0","\n                                                ")})]})}),(0,s.jsx)("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:(0,s.jsx)(i.Z,{className:"text-white opacity-10 h-20 w-20"})}),(0,s.jsx)("img",{onError:e=>{e.currentTarget.style.display="none"},src:e.cover_image,alt:e.name,draggable:!1,className:"select-none absolute inset-0 h-full w-full object-cover transition-transform duration-300 object-top group-hover:scale-105"})]}),(0,s.jsxs)("div",{className:"flex-grow p-4 !pt-0",children:[(0,s.jsx)("h3",{className:"mb-1.5 text-base font-semibold line-clamp-1 transition-colors group-hover:text-brand",children:e.name}),(0,s.jsxs)("div",{className:"flex items-center mb-2",children:[(0,s.jsx)("span",{className:"inline-block h-2 w-2 rounded-full mr-1.5 ".concat(e.active?"bg-green-500":"bg-red-500")}),(0,s.jsx)("span",{className:"text-xs ".concat(e.active?"text-green-600":"text-red-600"," font-medium"),children:e.active?"Active":"Inactive"})]}),(0,s.jsx)("div",{className:"mb-3",children:(0,s.jsx)("div",{className:"relative",children:(0,s.jsx)("p",{className:"text-sm text-gray-600 line-clamp-3  transition-all duration-300",children:e.description||"No description available"})})}),(0,s.jsxs)("div",{className:"flex items-center text-xs text-gray-500 mb-3",children:[(0,s.jsx)("span",{className:"mr-1",children:"Created:"}),(0,s.jsx)("span",{className:"font-medium",children:new Date(e.created_at).toLocaleDateString()})]})]}),(0,s.jsx)("div",{className:"px-4 pb-4 pt-1 border-t border-gray-100",children:(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,s.jsx)(g.u,{label:"View 3D Model",withArrow:!0,children:(0,s.jsxs)(b(),{href:"/panel/aaja/preview?am_id=".concat(e.am_id),className:"flex w-full border border-indigo-600 items-center justify-center gap-1.5 py-1.5 px-3 rounded-md bg-indigo-50 text-indigo-600 hover:bg-indigo-100 transition-colors",children:[(0,s.jsx)(d.Z,{className:"w-4 h-4"}),(0,s.jsx)("span",{className:"text-sm font-medium",children:"View"})]})}),e_("manage_aaja","assign")&&(0,s.jsx)(g.u,{label:"Assign Model",withArrow:!0,children:(0,s.jsxs)("button",{onClick:a=>{a.stopPropagation(),ei({isOpen:!0,model:e})},className:"flex w-full border border-emerald-600 items-center justify-center gap-1 py-1.5 px-3 rounded-md bg-emerald-50 text-emerald-600 hover:bg-emerald-100 transition-colors",children:[(0,s.jsx)(c,{className:"w-4 h-4"}),(0,s.jsx)("span",{className:"text-sm font-medium",children:"Assign"})]})}),e_("manage_aaja","update")&&(0,s.jsx)(g.u,{label:"Edit Model",withArrow:!0,children:(0,s.jsxs)(b(),{href:"/panel/aaja/edit?am_id=".concat(e.am_id),className:"flex w-full border border-blue-600 items-center justify-center gap-1 py-1.5 px-3 rounded-md bg-blue-50 text-blue-600 hover:bg-blue-100 transition-colors",children:[(0,s.jsx)(o.Z,{className:"w-4 h-4"}),(0,s.jsx)("span",{className:"text-sm font-medium",children:"Edit"})]})}),e_("manage_aaja","delete")&&(0,s.jsx)(g.u,{label:"Delete Model",withArrow:!0,children:(0,s.jsxs)("button",{onClick:a=>{a.stopPropagation(),es(e.am_id),ea(!0)},className:"flex w-full border border-red-600 items-center justify-center gap-1 py-1.5 px-3 rounded-md bg-red-50 text-red-600 hover:bg-red-100 transition-colors",children:[(0,s.jsx)(m.Z,{className:"w-4 h-4"}),(0,s.jsx)("span",{className:"text-sm font-medium",children:"Delete"})]})})]})})]})},e.am_id))]}),(0,s.jsxs)("div",{className:"mt-8 flex flex-col items-center justify-between gap-4 px-3 md:flex-row",children:[(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsxs)("div",{className:"text-sm text-gray-600",children:["Showing ",(A-1)*I+1," to ",Math.min(A*I,C)," of ",C," models"]}),(0,s.jsx)("select",{value:I,disabled:0===v.length,onChange:e=>{D(Number(e.target.value)),_(C/Number(e.target.value)),M(1)},className:"appearance-none rounded-md border px-2.5 py-1.5",children:E.map(e=>(0,s.jsx)("option",{value:e,children:e},e))})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("button",{onClick:()=>M(Math.max(1,A-1)),disabled:1===A||0===v.length,className:"rounded border px-3 py-1 disabled:opacity-50 hover:bg-gray-100",children:"Previous"}),(()=>{let e,a;let t=[];A<=3?(e=1,a=Math.min(w,5)):A>=w-2?(e=Math.max(1,w-5+1),a=w):(e=A-2,a=A+2),A>=5&&a-e+1==5&&a<w&&(e=Math.max(1,A-3),a=A+1);for(let l=e;l<=a;l++)t.push((0,s.jsx)("button",{onClick:()=>M(l),className:"h-8 w-8 rounded-full ".concat(l===A?"bg-brand text-white":"border hover:bg-gray-100"),children:l},l));return t})(),(0,s.jsx)("button",{onClick:()=>M(Math.min(Math.ceil(C/I),A+1)),disabled:A===Math.ceil(C/I)||0===v.length,className:"rounded border px-3 py-1 disabled:opacity-50 hover:bg-gray-100",children:"Next"})]})]}),(0,s.jsx)(l.Z,{isOpen:ee,setIsOpen:ea,onDelete:()=>{if(!et)return;let e={method:"delete",maxBodyLength:1/0,url:"".concat(u._n,"/admin/aaja_model/").concat(et),headers:{}};f.default.request(e).then(e=>{if(200===e.status){var a,t,s;(0,n.CF)("success","3D Model deleted successfully!"),ea(!1);let e=A;A>1&&A===w&&1===v.length&&M(e=Math.max(A-1,1)),ej(e,I,null!==(a=null==B?void 0:B.value)&&void 0!==a?a:"",null!==(t=null==W?void 0:W.value)&&void 0!==t?t:"",null!==(s=null==U?void 0:U.value)&&void 0!==s?s:"",ex)}}).catch(e=>{var a,t;let s=(null==e?void 0:null===(t=e.response)||void 0===t?void 0:null===(a=t.data)||void 0===a?void 0:a.message)||"Could not delete 3D model. Please try again later.";(0,n.CF)("error",s)})},title:"3D model"}),en.isOpen&&en.model&&(0,s.jsx)(S,{isOpen:en.isOpen,setIsOpen:e=>ei({isOpen:e,model:e?en.model:null}),modelId:en.model.am_id,modelName:en.model.name}),el.isOpen&&el.model&&(0,s.jsx)(L,{isOpen:el.isOpen,setIsOpen:e=>er({isOpen:e,model:e?el.model:null}),model:el.model,onModelUpdated:()=>{var e,a,t;return ej(A,I,null!==(e=null==B?void 0:B.value)&&void 0!==e?e:"",null!==(a=null==W?void 0:W.value)&&void 0!==a?a:"",null!==(t=null==U?void 0:U.value)&&void 0!==t?t:"",ex)}})]})},A=e=>{let{isOpen:a,setIsOpen:t,onModelAdded:l}=e,{primaryColor:i}=(0,p.DY)(),o=(0,x.CG)(e=>
1e.userData),[d,c]=(0,j.useState)(""),[m,h]=(0,j.useState)(""),[g,v]=(0,j.useState)({value:"INTERNAL",label:"Internal (S3 Link)"}),[b,y]=(0,j.useState)(""),[N,k]=(0,j.useState)(""),[S,L]=(0,j.useState)(null),[F,E]=(0,j.useState)(null),[A,M]=(0,j.useState)(!1),[I,D]=(0,j.useState)(null),[T,P]=(0,j.useState)(null),[O,V]=(0,j.useState)(0),[R,Z]=(0,j.useState)(.005),[z,H]=(0,j.useState)(.04),[B,q]=(0,j.useState)(.2),[W,J]=(0,j.useState)(1.3),[U,X]=(0,j.useState)(!1),[G,Y]=(0,j.useState)([{school_id:[2,3,4,5].includes(o.role_id)?null==o?void 0:o.school_id:0,department_id:0,category_id:{Valid:!1,Int32:0},isLocked:!1}]),[$,K]=(0,j.useState)([]),[Q,ee]=(0,j.useState)({label:"All",value:""}),[ea,et]=(0,j.useState)({}),[es,el]=(0,j.useState)({}),[er,en]=(0,j.useState)("[]"),[ei,eo]=(0,j.useState)(null),[ed,ec]=(0,j.useState)("#000000"),[em,eu]=(0,j.useState)(null),[ep,ex]=(0,j.useState)(!1),eh=()=>{eo(null);try{let e=JSON.parse(er||"[]");if(!Array.isArray(e))return eo("Hotspots must be an array"),!1;for(let a=0;a<e.length;a++){let t=e[a];if(!t.id)return eo("Hotspot at index ".concat(a," is missing an id")),!1;if(!Array.isArray(t.position)||3!==t.position.length)return eo("Hotspot '".concat(t.id,"' has invalid position format. Expected [x, y, z]")),!1;for(let e=0;e<t.position.length;e++)if("number"!=typeof t.position[e])return eo("Hotspot '".concat(t.id,"' has non-numeric position value")),!1;if(!t.label)return eo("Hotspot '".concat(t.id,"' is missing a label")),!1}return en(JSON.stringify(e,null,2)),eo(""),!0}catch(e){return eo("Invalid JSON: ".concat(null==e?void 0:e.message)),!1}},eg=e=>/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(e)?(eu(null),!0):(eu("Please enter a valid hex color code (e.g., #FF5733)"),!1),ef=(e,a)=>{e.preventDefault(),e.stopPropagation(),ex(a)};(0,j.useEffect)(()=>{o&&([2,3,4].includes(o.role_id)?ey(o.school_id.toString()):eb())},[o]),(0,j.useEffect)(()=>{a||ev()},[a]),(0,j.useEffect)(()=>{if(I){let e=null,a=async()=>{try{let e=await f.default.get("".concat(u._n,"/admin/model_task/").concat(I),{headers:{}});e.data&&e.data.task.status&&(P(e.data.task.status),"completed"===e.data.task.status?((0,n.CF)("success","Model processing completed successfully!"),D(null),ev(),t(!1),l&&l()):"failed"===e.data.task.status&&((0,n.CF)("error","Model processing failed: ".concat(e.data.message||"Unknown error")),D(null)))}catch(e){console.error("Error checking processing status:",e)}};return a(),e=setInterval(a,5e3),()=>{e&&clearInterval(e)}}},[I]);let ev=()=>{c(""),h(""),v({value:"INTERNAL",label:"Internal (S3 Link)"}),y(""),k(""),L(null),E(null),Y([{school_id:[2,3,4,5].includes(o.role_id)?null==o?void 0:o.school_id:0,department_id:0,category_id:{Valid:!1,Int32:0},isLocked:!1}]),D(null),P(null),en("[]"),eo("")};async function eb(){try{let e=await f.default.get("".concat(u._n,"/school?limit=-1"),{headers:{}});if(200===e.status){let a=e.data.data.map(e=>({value:e.id.toString(),label:e.name}));K([{label:"Select Campus",value:""},...a]),ee({label:"Select Campus",value:""})}}catch(e){console.error("Error fetching schools:",e)}}async function ey(e){if(!e||ea[e])return ea[e]||[];try{let a=await f.default.get("".concat(u._n,"/departments?school_id=").concat(e));if(200===a.status){let t=a.data.data.map(e=>({value:e.id.toString(),label:e.name})),s=[{label:"Select Department",value:""},...t];return et(a=>({...a,[e]:s})),s}}catch(e){console.error("Error fetching departments:",e)}return[]}async function ej(e){if(!e||es[e])return es[e]||[];try{let a=await f.default.get("".concat(u._n,"/classes/").concat(e),{headers:{}});if(200===a.status){let t=(a.data.classes||[]).map(e=>({value:e.id.toString(),label:e.name}));return el(a=>({...a,[e]:t})),t}}catch(e){console.error("Error fetching categories:",e)}return[]}let eN=e=>{let a=[...G];a.splice(e,1),0===a.length&&a.push({school_id:o&&[2,3,4].includes(o.role_id)?o.school_id:0,department_id:0,category_id:{Valid:!1,Int32:0},isLocked:!1}),Y(a)},ew=async(e,a,t)=>{let s=[...G];"school_id"===a?(s[e].school_id=parseInt(t),s[e].department_id=0,s[e].category_id={Valid:!1,Int32:0},t&&await ey(t)):"department_id"===a?(s[e].department_id=parseInt(t),s[e].category_id={Valid:!1,Int32:0},t&&await ej(t)):"category_id"===a&&(s[e].category_id={Valid:""!==t,Int32:""!==t?parseInt(t):0}),Y(s)},e_=e=>{e.target.files&&e.target.files[0]&&E(e.target.files[0])},eC=e=>{e.target.files&&e.target.files[0]&&L(e.target.files[0])},ek=async e=>{if(e.preventDefault(),"INTERNAL"===g.value&&!eh()){(0,n.CF)("error","Please fix the hotspots JSON format errors");return}if("EXTERNAL"===g.value&&!eg(ed)){(0,n.CF)("error","Please fix the hex color code format errors");return}M(!0);try{let e=G.filter(e=>e.school_id>0&&e.department_id>0&&e.category_id.Valid).map(e=>({school_id:e.school_id,department_id:e.department_id,category_id:e.category_id}));if(0===e.length){(0,n.CF)("error","Please add at least one valid mapping."),M(!1);return}if("INTERNAL"===g.value&&!S){(0,n.CF)("error","Please select a model file for internal models."),M(!1);return}if("EXTERNAL"===g.value&&!b){(0,n.CF)("error","Please provide an attachment URL for external models."),M(!1);return}if(!F){(0,n.CF)("error","Please select a cover image."),M(!1);return}let a=new FormData;a.append("name",d),a.append("description",m),a.append("model_type",g.value),"EXTERNAL"===g.value?(a.append("hexcode",ed),a.append("attachment_url",b)):S&&(a.append("hotspots",er.trim()),a.append("model_file",S),a.append("initial_camera_position_x",O.toString()),a.append("initial_camera_position_y",R.toString()),a.append("initial_camera_position_z",z.toString()),a.append("tone_mapping_exposure",B.toString()),a.append("mobile_camera_scale",W.toString()),a.append("has_animation",U.toString())),F&&a.append("cover_image",F),a.append("mappings",JSON.stringify(e));let s=await f.default.post("".concat(u._n,"/admin/aaja_model"),a,{headers:{"Content-Type":"multipart/form-data"}});
1200===s.status&&("INTERNAL"===g.value&&s.data.task_id?(D(s.data.task_id),(0,n.CF)("success","Model upload started. Processing in background...")):((0,n.CF)("success","Model added successfully!"),ev(),t(!1),l&&l()))}catch(t){var a,s;let e=(null==t?void 0:null===(s=t.response)||void 0===s?void 0:null===(a=s.data)||void 0===a?void 0:a.message)||"Failed to create a 3D model. Please try again.";(0,n.CF)("error",e)}finally{M(!1)}},eS=e=>ea[e.school_id.toString()]||[{label:"Select Department",value:""}],eL=e=>es[e.department_id.toString()]||[];return(0,s.jsx)("div",{children:(0,s.jsx)(_.u,{appear:!0,show:a,as:j.Fragment,children:(0,s.jsxs)(C.V,{as:"div",open:a,onClose:()=>{},children:[(0,s.jsx)(_.u.Child,{as:j.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)("div",{className:"fixed inset-0"})}),(0,s.jsx)("div",{id:"add_model_modal",className:"fixed inset-0 z-[999] overflow-y-auto bg-[black]/60",children:(0,s.jsx)("div",{className:"flex min-h-screen items-start justify-center px-4",children:(0,s.jsx)(_.u.Child,{as:j.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:(0,s.jsxs)(C.V.Panel,{className:"panel my-8 w-full max-w-4xl rounded-lg border-0 px-4 py-1 text-black dark:text-white-dark",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between text-lg font-semibold dark:text-white",children:[(0,s.jsx)("h5",{className:"w-full border-b border-[#ebe9f1] py-3 dark:border-white/10",children:"Add 3D Model"}),!T&&(0,s.jsx)("button",{type:"button",onClick:()=>t(!1),className:"text-white-dark hover:text-dark",children:(0,s.jsx)(w.Z,{className:"h-4 w-4"})})]}),(0,s.jsx)("div",{className:"p-5",children:I&&T?(0,s.jsxs)("div",{className:"text-center p-6",children:[(0,s.jsx)("div",{className:"mb-4",children:(0,s.jsxs)("svg",{className:"inline-block h-12 w-12 animate-spin text-primary",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}),(0,s.jsx)("h3",{className:"text-xl font-bold mb-2",children:"Processing Your 3D Model"}),(0,s.jsxs)("p",{className:"text-gray-500 mb-4",children:["Status: ",T]}),(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Please wait while we process your upload. This may take a few minutes depending on the file size."})]}):(0,s.jsxs)("form",{onSubmit:ek,className:"space-y-4",children:[(0,s.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"gap flex",children:["Model Name",(0,s.jsx)("div",{className:"text-red",style:{color:"red"},children:"*"})]}),(0,s.jsx)("input",{value:d,onChange:e=>c(e.target.value),className:"form-input w-[70%] rounded-[5px] border border-gray-300 bg-white px-3 py-2 font-normal focus:outline-none",placeholder:"Enter model name",required:!0})]}),(0,s.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"gap flex",children:["Model Description",(0,s.jsx)("div",{className:"text-red",style:{color:"red"},children:"*"})]}),(0,s.jsx)("textarea",{value:m,onChange:e=>h(e.target.value),className:"form-input w-[70%] rounded-[5px] border border-gray-300 bg-white px-3 py-2 font-normal focus:outline-none",placeholder:"Enter model description",required:!0})]}),(0,s.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"gap flex",children:["Model Type",(0,s.jsx)("div",{className:"text-red",style:{color:"red"},children:"*"})]}),(0,s.jsx)(r.Z,{color:i,className:"w-[70%]",options:[{value:"INTERNAL",label:"Internal (S3 Link)"},{value:"EXTERNAL",label:"External"},{value:"VIDEO",label:"Video"}],value:g,onChange:e=>{e&&v(e)}})]}),"EXTERNAL"===g.value?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"gap flex",children:["Attachment URL",(0,s.jsx)("div",{className:"text-red",style:{color:"red"},children:"*"})]}),(0,s.jsx)("input",{value:b,onChange:e=>y(e.target.value),className:"form-input w-[70%] rounded-[5px] border border-gray-300 bg-white px-3 py-2 font-normal focus:outline-none",placeholder:"Enter external model URL",required:"EXTERNAL"===g.value})]}),(0,s.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"gap flex",children:["Model Color",(0,s.jsx)("div",{className:"text-red",style:{color:"red"},children:"*"})]}),(0,s.jsxs)("div",{className:"w-[70%] flex items-center",children:[(0,s.jsx)("input",{value:ed,onChange:e=>{let a=e.target.value;ec(a),eg(a)},className:"form-input rounded-[5px] border ".concat(em?"border-red-500":"border-gray-300"," bg-white px-3 py-2 font-normal focus:outline-none flex-grow mr-2"),placeholder:"#000000",required:!0}),(0,s.jsx)("input",{type:"color",value:ed,onChange:e=>ec(e.target.value),className:"h-10 w-10 cursor-pointer rounded border border-gray-300"})]})]}),em&&(0,s.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,s.jsx)("div",{}),(0,s.jsx)("p",{className:"w-[70%] text-sm text-red-500",children:em})]})]}):"VIDEO"===g.value?(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"gap flex",children:["Video URL",(0,s.jsx)("div",{className:"text-red",style:{color:"red"},children:"*"})]}),(0,s.jsx)("input",{value:N,onChange:e=>k(e.target.value),className:"form-input w-[70%] rounded-[5px] border border-gray-300 bg-white px-3 py-2 font-normal focus:outline-none",placeholder:"Enter video URL (e.g., YouTube link)",required:"VIDEO"===g.value})]})}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"gap flex",children:["Model File (GLB)",(0,s.jsx)("div",{className:"text-red",style:{color:"red"},children:"*"})]}),(0,s.jsxs)("div",{className:"w-[70%] form-input cursor-pointer rounded-[5px] border ".concat(ep?"border-primary border-dashed":"border-gray-300"," bg-white px-3 py-2 font-normal flex items-center justify-between"),onClick:()=>{var e,a;return null===(a=document)||void 0===a?void 0:null===(e=a.getElementById("model-file-input"))||void 0===e?void 0:e.click()},onDragOver:e=>ef(e,!0),onDragEnter:e=>ef(e,!0),onDragLeave:e=>ef(e,!1),onDrop:e=>{e.preventDefault(),e.stopPropagation(),ex(!1),e.dataTransfer.files&&e.dataTransfer.files[0]&&L(e.dataTransfer.files[0])},children:[(0,s.jsx)("span",{className:"truncate",children:(null==S?void 0:S.name)||"Choose GLB file or drag and drop here"}),(0,s.jsx)("span",{className:" text-primary ml-2",children:"Browse"}),(0,s.jsx)("input",{id:"model-file-input",type:"file",accept:".glb",className:"hidden",name:"modelFile",onChange:e=>{eC(e)}})]})]}),(0,s.jsxs)("div",{className:"border-t border-gray-200 pt-4 pb-2",children:[(0,s.jsx)("h6",{className:"mb-2 font-semibold",children:"Rendering Settings"}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("input",{id:"has-animation",type:"checkbox",checked:U,onChange:e=>
1X(e.target.checked),className:"h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"}),(0,s.jsx)("label",{htmlFor:"has-animation",className:"ml-2 mt-1.5 block text-sm text-gray-700",children:"Model Has Animation"})]}),(0,s.jsx)("p",{className:"mt-1 text-xs text-gray-500",children:"Enable this if your 3D model contains animations that should be played automatically."})]}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Initial Camera Position"}),(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"X"}),(0,s.jsx)("input",{type:"number",step:"0.001",value:O,onChange:e=>V(parseFloat(e.target.value)),className:"form-input w-full rounded-[5px] border border-gray-300 bg-white px-3 py-2 font-normal focus:outline-none"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Y"}),(0,s.jsx)("input",{type:"number",step:"0.001",value:R,onChange:e=>Z(parseFloat(e.target.value)),className:"form-input w-full rounded-[5px] border border-gray-300 bg-white px-3 py-2 font-normal focus:outline-none"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Z"}),(0,s.jsx)("input",{type:"number",step:"0.001",value:z,onChange:e=>H(parseFloat(e.target.value)),className:"form-input w-full rounded-[5px] border border-gray-300 bg-white px-3 py-2 font-normal focus:outline-none"})]})]})]}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Tone Mapping Exposure"}),(0,s.jsx)("input",{type:"number",step:"0.1",value:B,onChange:e=>q(parseFloat(e.target.value)),className:"form-input w-full rounded-[5px] border border-gray-300 bg-white px-3 py-2 font-normal focus:outline-none"})]}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Mobile Camera Scale"}),(0,s.jsx)("input",{type:"number",step:"0.1",value:W,onChange:e=>J(parseFloat(e.target.value)),className:"form-input w-full rounded-[5px] border border-gray-300 bg-white px-3 py-2 font-normal focus:outline-none"})]}),(0,s.jsxs)("div",{className:"border-t border-gray-200 pt-4 pb-2",children:[(0,s.jsx)("h6",{className:"mb-2 font-semibold",children:"Hotspots (For developers only)"}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Add Hotspots (JSON format)"}),(0,s.jsx)("textarea",{value:er,onChange:e=>en(e.target.value),onBlur:eh,className:"form-textarea w-full rounded-[5px] border ".concat(ei?"border-red-500":"border-gray-300"," bg-white px-3 py-2 font-mono text-sm focus:outline-none"),rows:1}),ei&&(0,s.jsx)("p",{className:"mt-1 text-sm text-red-500",children:ei}),""==ei&&(0,s.jsx)("p",{className:"mt-1 text-sm text-green-500",children:"Validated Successfully"}),(0,s.jsx)("p",{className:"mt-1 text-xs text-gray-500",children:"Enter hotspots as a JSON array. Each hotspot should have an id, position (array of 3 numbers [x, y, z]), and label."}),(0,s.jsx)("button",{type:"button",onClick:eh,className:"mt-2 btn btn-sm btn-outline-primary",children:"Validate JSON"})]})]})]})]}),(0,s.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"gap flex",children:["Cover Image",(0,s.jsx)("div",{className:"text-red",style:{color:"red"},children:"*"})]}),(0,s.jsxs)("div",{className:"w-[70%] form-input cursor-pointer rounded-[5px] border ".concat(ep?"border-primary border-dashed":"border-gray-300"," bg-white px-3 py-2 font-normal flex items-center justify-between"),onClick:e=>{var a,t;e.stopPropagation(),null===(t=document)||void 0===t||null===(a=t.getElementById("cover-image-input"))||void 0===a||a.click()},onDragOver:e=>ef(e,!0),onDragEnter:e=>ef(e,!0),onDragLeave:e=>ef(e,!1),onDrop:e=>{e.preventDefault(),e.stopPropagation(),ex(!1),e.dataTransfer.files&&e.dataTransfer.files[0]&&E(e.dataTransfer.files[0])},children:[(0,s.jsx)("span",{className:"truncate",children:(null==F?void 0:F.name)||"Choose image file or drag and drop here"}),(0,s.jsx)("span",{className:"text-primary ml-2",children:"Browse"}),(0,s.jsx)("input",{id:"cover-image-input",type:"file",accept:"image/*",className:"hidden",name:"cover-image",onCh
1ange:e=>{e_(e)}})]})]}),(0,s.jsxs)("div",{className:"border-t border-gray-200 pt-4 pb-2",children:[(0,s.jsx)("h6",{className:"mb-2 font-semibold",children:"Model Mappings"}),G.map((e,a)=>(0,s.jsxs)("div",{className:"mb-6 rounded-md border ".concat(e.isLocked?"bg-gray-50":""," border-gray-200 p-3"),children:[(0,s.jsxs)("div",{className:"flex justify-between mb-2",children:[(0,s.jsxs)("span",{className:"font-medium",children:["Mapping ",a+1]}),(0,s.jsx)("button",{type:"button",onClick:()=>eN(a),className:"text-red-500 hover:text-red-700",children:"Remove"})]}),o&&1===o.role_id&&(0,s.jsxs)("div",{className:"mb-3 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"gap flex",children:["Campus",(0,s.jsx)("div",{className:"text-red",style:{color:"red"},children:"*"})]}),(0,s.jsx)(r.Z,{color:i,className:"w-[70%]",maxMenuHeight:350,options:$.filter(e=>""!==e.value),value:$.find(a=>a.value===e.school_id.toString())||null,onChange:e=>{e&&ew(a,"school_id",e.value)}})]}),(0,s.jsxs)("div",{className:"mb-3 flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"gap flex",children:["Department",(0,s.jsx)("div",{className:"text-red",style:{color:"red"},children:"*"})]}),(0,s.jsx)(r.Z,{color:i,className:"w-[70%]",maxMenuHeight:350,options:eS(e).filter(e=>""!==e.value),value:eS(e).find(a=>a.value===e.department_id.toString())||null,onChange:e=>{e&&ew(a,"department_id",e.value)}})]}),(0,s.jsxs)("div",{className:"mb-3 flex items-center justify-between",children:[(0,s.jsx)("div",{className:"gap flex",children:"Category"}),(0,s.jsx)(r.Z,{color:i,className:"w-[70%]",maxMenuHeight:350,options:eL(e),value:eL(e).find(a=>a.value===e.category_id.Int32.toString())||null,onChange:e=>ew(a,"category_id",e?e.value:"")})]})]},a)),(0,s.jsx)("button",{type:"button",onClick:()=>{Y([...G,{school_id:o&&[2,3,4].includes(o.role_id)?o.school_id:0,department_id:0,category_id:{Valid:!1,Int32:0},isLocked:!1}])},className:"btn btn-outline-primary mt-2",children:"+ Add Another Mapping"})]}),(0,s.jsx)("div",{className:"mt-6 flex justify-center",children:(0,s.jsx)("button",{type:"submit",className:"btn btn-success test_help_button flex items-center justify-center px-6 py-2",disabled:A,children:A?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("svg",{className:"mr-2 h-5 w-5 animate-spin",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Submitting..."]}):"Submit"})})]})})]})})})})]})})})},M=t(39133);let I=()=>{var e;let a=(0,y.useRouter)(),t=(0,x.CG)(e=>e.userData),[l,r]=j.useState({isAddModelOpen:!1,isUploadModelOpen:!1}),[n,i]=j.useState(!1);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"mb-6 justify-between p-3",children:(0,s.jsxs)("div",{className:"d-flex flex w-full items-center justify-between py-2",children:[(0,s.jsx)("h2",{className:"text-2xl font-semibold mr-2",children:"Aaja Models "}),(0,s.jsx)("div",{className:"flex gap-x-4",children:(e="manage_aaja",(1===t.role_id||8===t.role_id||t.role_id>5&&(0,h.Fs)(t.issued_certificates,e,"add"))&&(0,s.jsx)("button",{type:"button",onClick:()=>a.push("/panel/aaja/add"),className:"btn btn-brand alignToTitle test_help_button","data-bs-toggle":"modal","data-bs-target":"#testScheduleModal",children:"Add Model"}))})]})}),(0,s.jsx)(E,{shouldRefetch:n,resetRefetch:()=>i(!1)}),l.isAddModelOpen&&(0,s.jsx)(A,{isOpen:l.isAddModelOpen,setIsOpen:e=>r({...l,isAddModelOpen:e}),onModelAdded:()=>i(!0)})]})};I.getLayout=e=>(0,s.jsx)(M.Z,{children:e});var D=I}},function(e){e.O(0,[70917,93021,24750,97083,81397,90457,11283,73011,27164,59100,24260,66183,83498,39133,92888,49774,40179],function(){return e(e.s=12140)}),_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.