WE
website9
Connecting… · সংযোগ হচ্ছে…
Taking a little longer — check your internet connection. · একটু বেশি সময় লাগছে — ইন্টারনেট সংযোগ দেখুন।
Try again · আবার চেষ্টা
']]; while(i < lo.length){ var b = lo.indexOf('= 0 && p < b && (ks < 0 || p < ks)){ ks = p; k = j; } } if(k < 0){ if(/[\s>\/]/.test(lo.charAt(b + 5))){ var e = lo.indexOf('>', b); return e < 0 ? -1 : e + 1; } i = b + 5; continue; } var se = lo.indexOf(SK[k][1], ks + SK[k][0].length); if(se < 0) return -1; i = se + SK[k][1].length; } return -1; } var TPL_CACHE = 'nx-template-v1'; function tplSha(u){ return fetch(u + '/sha.json', {cache:'no-store'}).then(function(r){ return r.ok ? r.json() : null; }) .then(function(h){ return (typeof h === 'string' && /^[0-9a-f]{64}$/.test(h)) ? h : null; }).catch(function(){ return null; }); } function sha256Hex(s){ try{ if(!W.crypto || !W.crypto.subtle || !W.TextEncoder) return Promise.resolve(null); return W.crypto.subtle.digest('SHA-256', new W.TextEncoder().encode(s)).then(function(b){ var a = new Uint8Array(b), h = ''; for(var i = 0; i < a.length; i++) h += ('0' + a[i].toString(16)).slice(-2); return h; }).catch(function(){ return null; }); }catch(e){ return Promise.resolve(null); } } function tplCached(u, want){ try{ if(!W.caches || !W.caches.open) return Promise.resolve(null); want = /^[0-9a-f]{64}$/.test(String(want || '')) ? String(want) : ''; return W.caches.open(TPL_CACHE).then(function(c){ return c.match(u + '/source.json'); }) .then(function(r){ return r ? r.json() : null; }) .then(function(e){ if(!e || typeof e.src !== 'string' || !e.src || !e.sha) return null; var viaNet = function(){ return tplSha(u).then(function(h){ return (h && h === e.sha) ? e.src : null; }); }; if(!want) return viaNet(); return sha256Hex(e.src).then(function(h){ return h ? (h === want ? e.src : null) : viaNet(); }); }).catch(function(){ return null; }); }catch(e){ return Promise.resolve(null); } } function tplSave(u, sha, src){ try{ if(!sha || !W.caches || !W.caches.open || !W.Response) return; var key = u + '/source.json'; W.caches.open(TPL_CACHE).then(function(c){ return c.put(key, new W.Response(JSON.stringify({sha: sha, src: src, at: Date.now()}), {headers: {'content-type': 'application/json'}})) .then(function(){ return c.keys(); }) .then(function(ks){ ks = ks.filter(function(k){ return k.url !== key; }); ks.slice(0, Math.max(0, ks.length - 2)).forEach(function(k){ c['delete'](k); }); }); // keep this + 2 more (websites sharing one domain) }).catch(function(){}); }catch(e){} } function preImages(){ try{ if(L.role === 'admin' || !L.siteUid) return; var h = JSON.parse(W.localStorage.getItem('nx:' + L.siteUid + ':public:nx_preimg_v1:' + L.siteUid) || W.localStorage.getItem('nx_preimg_v1:' + L.siteUid) || 'null'); if(!h || !h.u || !h.u.slice || Date.now() - (Number(h.t) || 0) > 30 * 864e5) return; h.u.slice(0, 6).forEach(function(u){ if(typeof u !== 'string' || u.length > 600 || !/^https:\/\/[^\s"'<>\\]+$/.test(u)) return; fetch(u, {mode:'no-cors', credentials:'include'}).then(function(r){ return r.blob(); }).catch(function(){}); }); }catch(e){} } function hintOrigin(u){ try{ var m = /^https:\/\/[^\/\s"'<>]+/.exec(String(u || '')); if(!m || !D.head) return; var l = D.createElement('link'); l.rel = 'preconnect'; l.href = m[0]; D.head.appendChild(l); }catch(e){} } var LDV = 157, from = ''; function cdnBase(u){ u = String(u || '').replace(/\/+$/, ''); return /^https:\/\/[A-Za-z0-9.-]+(:[0-9]{2,5})?(\/[A-Za-z0-9._~\/-]*)?$/.test(u) && u.length <= 200 ? u : ''; } function tplCdn(cdn, id, h){ try{ if(!W.fetch || !W.crypto || !W.crypto.subtle) return Promise.resolve(null); var ac = W.AbortController ? new W.AbortController() : null, t1 = null, t2 = null; var late = new Promise(function(res){ t1 = setTimeout(function(){ res(null); if(ac) ac.abort(); }, 6000); }); var get = fetch(cdn + '/v1/code/' + encodeURIComponent(id) + '/' + h, ac ? {credentials:'omit', signal: ac.signal} : {credentials:'omit'}) .then(function(r){ clearTimeout(t1); // it answered — the download itself may take longer on a slow phone (at most 40 s more) if(!r.ok) return null; return Promise.race([r.json(), new Promise(function(res){ t2 = setTimeout(function(){ res(null); if(ac) ac.abort(); }, 40000); })]); }) .then(function(src){ clearTimeout(t2); return (typeof src === 'string' && src) ? sha256Hex(src).then(function(x){ return x === h ? src : null; }) : null; }) .catch(function(){ return null; }); return Promise.race([get, late]).catch(function(){ return null; }); }catch(e){ return Promise.resolve(null); } } var preDone = false; function start(){ var my = ++run; if(!preDone){ preDone = true; preImages(); } var box = $('nx-ld-fail'); if(box){ box.hidden = true; box.innerHTML = ''; } clearTimeout(slowT); slow(false); slowT = setTimeout(function(){ if(my === run && !done) slow(true); }, 8000); if(!base || !L.siteUid){ fail('config', 'Missing site configuration.'); return; } if(W.navigator && W.navigator.onLine === false){ fail('offline'); return; } step('connect'); fetch(base + '/siteRuntime/' + encodeURIComponent(L.siteUid) + '.json', {cache:'no-store'}) .then(function(r){ if(!r.ok) throw err('server', 'Registry HTTP ' + r.status); return r.json(); }) .then(function(rec){ if(my !== run) return; if(!rec || !rec.runtime || !rec.templateVersionId) throw err('unpublished', 'This website is not published yet.'); hintOrigin(rec.runtime.firebaseConfig && rec.runtime.firebaseConfig.databaseURL); var p = rec.runtime.platform, by = $('nx-ld-by'); if(by && p && p.name) by.textContent = 'Powered by ' + String(p.name).slice(0, 60); step('fetch'); var tplUrl = base + '/templateCode/' + encodeURIComponent(rec.templateVersionId); var want = /^[0-9a-f]{64}$/.test(String(rec.templateSha || '')) ? String(rec.templateSha) : ''; // v7.4.0.156 var cdn = cdnBase(rec.codeCdn); // v7.4.0.157 return tplCached(tplUrl, want).then(function(hit){ if(hit){ from = 'cache'; return hit; } var shaP = want ? Promise.resolve(want) : tplSha(tplUrl); var viaCdn = cdn ? shaP.then(function(h){ return h ? tplCdn(cdn, rec.templateVersionId, h) : null; }) : Promise.resolve(null); return viaCdn.then(function(got){ if(got){ from = 'cdn'; shaP.then(function(h){ tplSave(tplUrl, h, got); }); return got; } from = 'firebase'; return fetch(tplUrl + '/source.json', {cache:'no-store'}) .then(function(r){ if(!r.ok) throw err(r.status >= 500 || r.status === 0 ? 'server' : 'template', 'Template HTTP ' + r.status); return r.json(); }) .then(function(src){ if(typeof src === 'string' && src) shaP.then(function(h){ tplSave(tplUrl, h, src); }); return src; }); }); }) .then(function(src){ if(my !== run) return; if(typeof src !== 'string' || !src) throw err('template', 'Template code is missing for this version.'); step('build'); var rt = rec.runtime; rt.status = rec.status || rt.status; rt.statusMessage = rec.statusMessage || ''; rt.statusReason = rec.statusReason || ''; rt.billing = rec.billing || rt.billing; rt.builtAt = Date.now(); rt.ldAt = Date.now(); rt.ldMark = rec.updatedAt === undefined ? null : rec.updatedAt; rt.ldStatusAt = Number(rec.statusUpdatedAt || rec.updatedAt) || 0; // v7.4.0.156: the page needs no second read at start rt.ldv = LDV; rt.ldFrom = from; // v7.4.0.157: which loader built the page and where its code came from (version beacon) var html = NX_BUILD(src, rt, L.role, '(' + NX_BOOT_SRC + ')();', {min:false}); done = true; clearTimeout(slowT); html = handoff(html); document.open(); document.write(html); document.close(); }); }).catch(function(e){ if(my === run) fail(kindOf(e), (e && e.message) || e); }); } var again = $('nx-ld-retry'); if(again) again.onclick = start; W.addEventListener('offline', function(){ if(!done) fail('offline'); }); W.addEventListener('online', function(){ if(!done) start(); }); start(); })();