const CAPTION_CHUNK_MARKER_REGEX=/<t id="(\d+)"\/>/g;function parse_marked_chunk_response(N,l){const L={'ihXJe':function(M,O){return M<O;},'BxqeY':function(M,O,P){return M(O,P);},'uyure':function(M,O){return M+O;},'uDjbL':function(M,O){return M+O;}},y=new Array(l)['fill'](null),p=[...N['matchAll'](CAPTION_CHUNK_MARKER_REGEX)];for(let M=0x26*-0x74+0xd1*-0x12+0x1fea;L['ihXJe'](M,p['length']);M++){const O=L['BxqeY'](parseInt,p[M][0x84+-0x2eb*0x3+-0x2*-0x41f],0x25*-0x1e+-0x1ab9*-0x1+-0x1659);if(L['ihXJe'](O,0x1827+0x17*0xb3+-0x283c)||O>=l)continue;const P=L['uyure'](p[M]['index'],p[M][-0x553+-0x244+-0x1*-0x797]['length']),t=L['uDjbL'](M,0x3f5*-0x6+-0x21bb+0x836*0x7)<p['length']?p[L['uDjbL'](M,-0x1bd2+-0x1a58+0x362b)]['index']:N['length'],R=N['slice'](P,t)['trim']();R!==''&&(y[O]=R);}return y;}async function request_chunk_translations(N,l,L){const y={'faFaH':function(P,t){return P+t;},'CUTZT':'api/transl'+'ate/','xnmct':'POST','kZwOz':'applicatio'+'n/json;\x20ch'+'arset=UTF-'+'8','KgdNn':function(P,t){return P*t;},'utDet':function(P,t){return P>t;}},p=y['faFaH'](API_URL,y['CUTZT']),M={'license_key':apiKey_editai,'app_version':app_version,'text':N['map']((P,t)=>'<t\x20id=\x22'+t+'\x22/>'+P)['join'](''),'original_language':l,'translate_language':L},O=await retryFetch(p,{'method':y['xnmct'],'body':JSON['stringify'](M),'headers':{'Content-type':y['kZwOz']}},-0x47c+-0x1c2d+0x20ac,0xa6c+0x713*0x3+0x9*-0x315,y['KgdNn'](0x23af+0x1db3+-0x5*0xd13,-0x1*0x13bf+-0x6*0xd+0x1449)*(0x152d+0xc8f+-0x1dd4));return y['utDet'](O['data']['missing_id'+'s']?.['length'],-0x2496+-0x20f7+0x458d)&&tracker['event']('translate_'+'captions_c'+'hunked:\x20ba'+'ckend\x20repo'+'rted\x20missi'+'ng\x20ids:\x20'+JSON['stringify'](O['data']['missing_id'+'s'])),parse_marked_chunk_response(O['data']['translated'+'_text']||'',N['length']);}function words_for_translated_chunk(N,l){const L={'TtGeR':function(Q,H){return Q*H;},'oUyAd':function(Q,H){return Q/H;},'arPto':function(Q,H){return Q/H;},'DUNUh':function(Q,H){return Q===H;}},y=N['text'],p=N['start'],M=N['end'];let O;try{const Q=new Intl['Segmenter'](l,{'granularity':'word'});O=[...Q['segment'](y)]['filter'](H=>H['isWordLike'])['map'](H=>H['segment']);}catch(H){O=y['split']('\x20')['filter'](a=>a['length']>0xde6+0x57*-0x36+-0x1*-0x474);}if(L['DUNUh'](O['length'],0x3a6*0x8+0x1a8e+-0x37be))return[{'text':y,'word':y,'start':p,'end':M,'started_with_space':!![],'probability':-(-0x1f8f+0x13d*0x5+0x195f)}];const P=O['reduce']((a,c)=>a+c['length'],0x23e3+-0x2*0xe9+-0x2211),t=M-p;let R=p;return O['map'](a=>{const c=P>0x80*0x27+0x1335+-0x26b5?L['TtGeR'](L['oUyAd'](a['length'],P),t):L['arPto'](t,O['length']),Y=R;return R+=c,{'text':a,'word':a,'start':Y,'end':R,'started_with_space':!![],'probability':-(-0x157a+-0x3c1*-0x5+0x2b6)};});}async function translate_captions_chunked(N,l,L){const y={'QOqXy':function(P,t){return P!==t;},'Rfeyn':'translate_'+'captions_c'+'hunked','gxbTi':function(P,t){return P<t;},'ZBlTS':function(P,t){return P===t;},'Zvpqa':function(P,t,R,Q){return P(t,R,Q);},'xtdfM':'Retry\x20tran'+'slation\x20fa'+'iled\x20for\x20m'+'issing\x20chu'+'nks','TTmty':'caption_ch'+'unk_transl'+'ation_miss'+'ing','aSTgE':function(P,t,R){return P(t,R);}};tracker['event'](y['Rfeyn']),tracker['event']('translate_'+'captions_c'+'hunked:\x20fr'+'om\x20'+l+'\x20-\x20to\x20'+L);const p=N['map'](P=>P['text']),M=await request_chunk_translations(p,l,L),O=[];for(let P=0x2*0x1037+0x1fa4+-0x2009*0x2;y['gxbTi'](P,M['length']);P++){if(y['ZBlTS'](M[P],null))O['push'](P);}if(O['length']>0x60a*0x2+0xfd5+-0x1*0x1be9){tracker['event']('translate_'+'captions_c'+'hunked:\x20re'+'trying\x20'+O['length']+('\x20missing\x20c'+'hunk(s)'));try{const t=await y['Zvpqa'](request_chunk_translations,O['map'](R=>p[R]),l,L);O['forEach']((R,Q)=>{y['QOqXy'](t[Q],null)&&(M[R]=t[Q]);});}catch(R){console['error'](y['xtdfM'],R);}}for(let Q=-0x513+0x127*-0x13+0x1af8;Q<N['length'];Q++){if(M[Q]===null){tracker['event'](y['TTmty']),console['warn']('Chunk\x20'+Q+('\x20could\x20not'+'\x20be\x20transl'+'ated,\x20keep'+'ing\x20origin'+'al\x20text:'),N[Q]['text']);continue;}N[Q]['text']=M[Q],N[Q]['words']=y['aSTgE'](words_for_translated_chunk,N[Q],L);}return N;}