1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1648],{50369:function(t,e,n){"use strict";n.r(e),n.d(e,{ChatProvider:function(){return g}});var r=n(57437),o=n(94492),a=n.n(o),c=n(2265),i=n(12566),u=n(12649);n(25594);var l=n(96602),s=n(16615),f=n(41662);n(83079);var p=(0,n(12119).$)("6c2fbf1f6c280cc2dec2f4512c1dfaa4e1244435"),y=n(40613);let d=t=>{let{streamKey:e}=t,{channel:n,chatClient:r,loading:o,setChannel:a,setChatClient:i,setLoading:u,setUnreadMessageCount:d}=(0,s.a)(),{user:h,isLogin:g}=(0,l.t)();return(0,c.useEffect)(()=>{if(!h||!h.uuid||!g||!(0,y.w2)(h)||r&&r.userID===h.uuid)return;let t="".concat(h.firstName," ").concat(h.lastName);return(async()=>{try{u({isLoading:!0,message:"Initializing chat client..."});let n=await f.c8.getInstance(e,{enableInsights:!0,enableWSFallback:!0});u({isLoading:!0,message:"Connecting user..."}),await n.connectUser({id:h.uuid,name:t},async()=>{let t=await p();if(!t)throw Error("failed to get chat token");return t}),i(n),u({isLoading:!0,message:"Creating channel..."});let r=n.channel("messaging",h.uuid,{name:t});await r.watch(),(await r.queryMembers({id:h.uuid})).members.length||await r.addMembers([{user_id:h.uuid}]),d(r.countUnread()),a(r),u({isLoading:!1,message:""})}catch(t){console.error("Error initializing chat:",t)}})(),()=>{r&&r.userID!==h.uuid&&(r.disconnectUser().catch(()=>console.log("failed to disconnect user")).then(()=>console.log("connection closed")),a(null),i(null))}},[h]),{chatClient:r,channel:n,user:h,loading:o}};n(93796);let h=new i.V({language:"id",dayjsLocaleConfigForLanguage:a(),translationsForLanguage:{Reply:"Balas",Pin:"Simpan",Unpin:"Batal Simpan"}}),g=c.memo(function(t){let{children:e,streamKey:n}=t,{isLogin:o}=(0,l.t)(),{chatClient:a,channel:i}=d({streamKey:n}),{setUnreadMessageCount:f}=(0,s.a)();return((0,c.useEffect)(()=>{if(!a)return;let t=t=>{void 0!==t.total_unread_count&&f(t.total_unread_count)};return a.on(t),()=>{a.off(t)}},[a,f]),o)?a&&i?(0,r.jsx)(u.e,{client:a,theme:"str-chat__theme-dark",i18nInstance:h,children:e}):null:(0,r.jsx)(r.Fragment,{children:e})})},93796:function(){},5853:function(t,e,n){"use strict";n.d(e,{Jh:function(){return u},ZT:function(){return o},_T:function(){return c},ev:function(){return l},mG:function(){return i},pi:function(){return a}});var r=function(t,e){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function o(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var a=function(){return(a=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function c(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&0>e.indexOf(r)&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)0>e.indexOf(r[o])&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n}function i(t,e,n,r){return new(n||(n=Promise))(function(o,a){function c(t){try{u(r.next(t))}catch(t){a(t)}}function i(t){try{u(r.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?o(t.value):((e=t.value)instanceof n?e:new n(function(t){t(e)})).then(c,i)}u((r=r.apply(t,e||[])).next())})}function u(t,e){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return c.next=i(0),c.throw=i(1),c.return=i(2),"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function i(i){return function(u){return function(i){if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,i[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}function l(t,e,n){if(n||2==arguments.length)for(var r,o=0,a=e.length;o<a;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError}}]);
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.