1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6035],{1407:(e,t,r)=>{"use strict";r.d(t,{q:()=>y});var n=r(55972);let a="user-storage",s=()=>{try{let e=sessionStorage.getItem(a);if(!e)return null;let t=JSON.parse(e);if(!t.state||!t.state.data||!t.state.data.access_token)return console.warn("Invalid auth data in storage"),null;return t}catch(e){return console.error("Failed to parse user-storage:",e),null}},o=()=>{sessionStorage.removeItem(a)},i="/refresh",u="/canara-login",l=["Unauthenticated"],c=!1,d=[],h=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=[...d];d=[],r.forEach(r=>{let{resolve:n,reject:a}=r;e?a(e):n(t)})},f=e=>{let t=(()=>{var e;return null==(e=s())?void 0:e.state.data.access_token})(),r=e.headers;return t&&r&&("object"==typeof r&&null!==r&&"set"in r&&"function"==typeof r.set?r.set("Authorization","Bearer ".concat(t)):r.Authorization="Bearer ".concat(t)),e},p=e=>Promise.reject(e),v=e=>e,m=async e=>{var t,r,f;let p=e.config;if((null==(t=e.response)?void 0:t.status)!==401)return Promise.reject(e);if(null==(r=p.url)?void 0:r.includes(i))return o(),window.location.href=u,Promise.reject(e);let v=null==(f=e.response)?void 0:f.data,m=(null==v?void 0:v.message)||(null==v?void 0:v.error)||e.message;if(!l.some(e=>m&&m.includes(e)))return console.log("Not a token expiration error, rejecting..."),Promise.reject(e);if(!c){c=!0;try{let e=await n.u.post(i),{token:t}=e.data||{};if(console.log("New token:",e,t),!t)throw Error("No access token received in refresh response");(e=>{let t=s();if(t){var r={...t,state:{...t.state,data:{...t.state.data,access_token:e.accessToken}}};try{sessionStorage.setItem(a,JSON.stringify(r))}catch(e){console.error("Failed to update user-storage:",e)}}})({accessToken:t}),h(null,t);let r=p.headers;return r&&("object"==typeof r&&null!==r&&"set"in r&&"function"==typeof r.set?r.set("Authorization","Bearer ".concat(t)):r.Authorization="Bearer ".concat(t)),await (0,n.u)(p)}catch(e){return console.log("Refresh error:",e),h(e,null),o(),window.location.href=u,Promise.reject(e)}finally{c=!1}}return new Promise((e,t)=>{d.push({resolve:e,reject:t})}).then(e=>{"headers"in p&&p.headers||(p.headers={});let t=p.headers;return"object"==typeof t&&null!==t&&"set"in t&&"function"==typeof t.set?t.set("Authorization","Bearer ".concat(String(e))):t&&"object"==typeof t&&(t.Authorization="Bearer ".concat(String(e))),console.log("[api-interceptors] Retrying failed request with new token:",e,p.url),(0,n.u)(p)}).catch(e=>Promise.reject(e))},y=e=>(e.interceptors.request.use(f,p),e.interceptors.response.use(v,m),e)},20063:(e,t,r)=>{"use strict";var n=r(47260);r.o(n,"notFound")&&r.d(t,{notFound:function(){return n.notFound}}),r.o(n,"useParams")&&r.d(t,{useParams:function(){return n.useParams}}),r.o(n,"usePathname")&&r.d(t,{usePathname:function(){return n.usePathname}}),r.o(n,"useRouter")&&r.d(t,{useRouter:function(){return n.useRouter}}),r.o(n,"useSearchParams")&&r.d(t,{useSearchParams:function(){return n.useSearchParams}})},26260:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>i});var n=r(95155);r(12115);var a=r(20063),s=r(92811),o=r(75714);function i(){let e=(0,a.useRouter)(),{mutate:t,isPending:r}=(0,o.Vh)();return(0,n.jsx)(s.A,{submitting:r,onSubmit:r=>t(r,{onSuccess:()=>e.push("/dashboard/multimedia/videos")})})}},34344:(e,t,r)=>{"use strict";r.d(t,{u:()=>n.u});var n=r(55972);r(1407)},55972:(e,t,r)=>{"use strict";r.d(t,{u:()=>a});var n=r(95125);let a=(0,r(1407).q)(n.A.create({headers:{"Content-type":"application/json"},paramsSerializer:{indexes:null},baseURL:"https://api-prod-news.canaranews.com/api"}))},72191:(e,t,r)=>{Promise.resolve().then(r.bind(r,26260))},75714:(e,t,r)=>{"use strict";r.d(t,{E0:()=>h,Gg:()=>p,OM:()=>u,Vh:()=>c,gD:()=>d,rg:()=>l});var n=r(22454),a=r(99776),s=r(80549),o=r(34344);let i={all:["videos"],detail:e=>["videos",e]};function u(){return(0,n.I)({queryKey:i.all,queryFn:async()=>{let{data:e}=await o.u.get("/videos");return e}})}function l(e){return(0,n.I)({enabled:!!e,queryKey:i.detail(e),queryFn:async()=>{let{data:t}=await o.u.get("/videos/".concat(e));return t}})}function c(){let e=(0,a.jE)();return(0,s.n)({mutationFn:async e=>{let{data:t}=await o.u.post("/videos",e);return t},onSuccess:()=>
1{e.invalidateQueries({queryKey:i.all})}})}function d(e){let t=(0,a.jE)();return(0,s.n)({mutationFn:async t=>{let{data:r}=await o.u.put("/videos/".concat(e),t);return r},onSuccess:()=>t.invalidateQueries({queryKey:i.all})})}function h(){let e=(0,a.jE)();return(0,s.n)({mutationFn:async e=>(await o.u.delete("/videos/".concat(e)),e),onSuccess:()=>e.invalidateQueries({queryKey:i.all})})}async function f(e){await o.u.post("/videos/".concat(e,"/show-hide"))}function p(){let e=(0,a.jE)();return(0,s.n)({mutationFn:f,onSuccess:()=>e.invalidateQueries({queryKey:i.all})})}},92811:(e,t,r)=>{"use strict";r.d(t,{A:()=>c});var n=r(95155),a=r(12115),s=r(41574),o=r(27855),i=r(66088),u=r(80317),l=r(50355);function c(e){let{initialValues:t,onSubmit:r,submitting:c}=e,[d,h]=(0,a.useState)({title:(null==t?void 0:t.title)||"",description:(null==t?void 0:t.description)||"",youtubeUrl:(null==t?void 0:t.youtubeUrl)||"",sort:(null==t?void 0:t.sort)||"",author:(null==t?void 0:t.author)||""}),{title:f,description:p,youtubeUrl:v,sort:m,author:y}=d,[g,j]=(0,a.useState)(""),b=e=>{let{name:t,value:r}=e.target;h(e=>({...e,[t]:r}))};return(0,n.jsxs)(s.default,{component:"form",onSubmit:e=>{e.preventDefault(),j("");let t=new FormData;t.append("youtube_url",v),t.append("title",f),t.append("sort",void 0!==m?String(m):""),t.append("description",p||""),y&&t.append("author",y),r(t)},noValidate:!0,children:[(0,n.jsx)(s.default,{sx:{display:"flex",justifyContent:"flex-end",mb:2},children:(0,n.jsx)(o.A,{type:"submit",variant:"contained",disabled:c,children:"Save"})}),(0,n.jsxs)(i.A,{container:!0,spacing:2,children:[g?(0,n.jsx)(i.A,{size:{xs:12},children:(0,n.jsx)(u.default,{color:"error",children:g})}):null,(0,n.jsx)(i.A,{size:{xs:6},children:(0,n.jsx)(l.A,{fullWidth:!0,name:"title",label:"Title",value:f,onChange:b,required:!0})}),(0,n.jsx)(i.A,{size:{xs:6},children:(0,n.jsx)(l.A,{fullWidth:!0,name:"sort",label:"Sort Order",value:m,onChange:b,required:!0})}),(0,n.jsxs)(i.A,{size:{xs:6},children:[(0,n.jsx)(l.A,{fullWidth:!0,name:"author",label:"Author",value:y,onChange:b,sx:{mb:2}}),(0,n.jsx)(l.A,{fullWidth:!0,name:"description",label:"Description",multiline:!0,rows:4,value:p,onChange:b})]}),(0,n.jsx)(i.A,{size:{xs:6},children:(0,n.jsx)(l.A,{fullWidth:!0,name:"youtubeUrl",label:"YouTube URL",value:v,onChange:b,required:!0})})]})]})}}},e=>{e.O(0,[7578,7743,1057,6236,2454,4810,1988,7855,3683,6855,355,6088,8441,1255,7358],()=>e(e.s=72191)),_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.