PageSourceSearch

https://smt.smtd.ai/vue/assets/pwa.js?v=3.8.60-candidate.58-ui027

js smtd.ai collected 2026-10-05 15:06:49 UTC 5,714 bytes, 91 lines download raw bytes

1(function(){
2  'use strict';
3  var VERSION='3.8.60-candidate.58';
4  var ASSET_REV='ui027';
5  var ASSET_VERSION=VERSION+'-'+ASSET_REV;
6  var CORE=[
7    '/',
8    '/index.html',
9    '/offline.html',
10    '/manifest.webmanifest?v='+ASSET_VERSION,
11    '/vue/assets/vue-parity.css?v='+ASSET_VERSION,
12    '/vue/assets/vue-app.js?v='+ASSET_VERSION,
13    '/vue/assets/pwa.js?v='+ASSET_VERSION,
14    '/vue/vendor/vue.global.prod.js?v='+VERSION,
15    '/vue/vendor/vue-router.global.prod.js?v='+VERSION,
16  '/vue/assets/vue-runtime-lockdown.js?v='+VERSION,
17    '/brand/smt-gold-v1/smt-icon-192.png',
18    '/brand/smt-gold-v1/smt-icon-512.png'
19  ];
20  var state={version:VERSION,assetRevision:ASSET_REV,online:navigator.onLine,sw:'unsupported',standalone:false,installReady:false,activated:false,cacheReady:false,error:''};
21  try{
22    state.standalone=(window.matchMedia&&window.matchMedia('(display-mode: standalone)').matches)||window.navigator.standalone===true;
23    state.activated=localStorage.getItem('gzc_pwa_activated')==='1';
24  }catch(e){}
25  function emit(){try{window.__gzcPwaState=Object.assign({},state);window.dispatchEvent(new CustomEvent('gzc-pwa-state',{detail:window.__gzcPwaState}));}catch(e){}}
26  window.__gzcPwaState=state; emit();
27  window.addEventListener('online',function(){state.online=true;emit();});
28  window.addEventListener('offline',function(){state.online=false;emit();});
29  window.addEventListener('beforeinstallprompt',function(e){e.preventDefault();window.__gzcInstallPrompt=e;state.installReady=true;emit();});
30  if('serviceWorker' in navigator){navigator.serviceWorker.addEventListener('message',function(e){try{var v=String(e&&e.data&&e.data.version||'');if(e&&e.data&&e.data.type==='GZC_RELEASE_ACTIVE'&&v&&v!==ASSET_VERSION){caches.keys().then(function(keys){return Promise.all(keys.filter(function(k){return k.indexOf('gzc-prod-')===0||k.indexOf('gzc-vue-')===0;}).map(function(k){return caches.delete(k);}));}).finally(function(){location.reload();});}}catch(_){}});}
31  window.addEventListener('appinstalled',function(){state.standalone=true;state.installReady=false;state.activated=true;window.__gzcInstallPrompt=null;try{localStorage.setItem('gzc_pwa_activated','1')}catch(e){}emit();});
32
33  async function warmCache(){
34    if(!window.caches) return {ok:false,message:'ميزة العمل دون اتصال غير متاحة في هذا المتصفح'};
35    var cache=await caches.open('gzc-prod-'+ASSET_VERSION);
36    await cache.addAll(CORE.map(function(u){return new Request(u,{cache:'reload'});}));
37    state.cacheReady=true;
38    state.activated=true;
39    try{localStorage.setItem('gzc_pwa_activated','1')}catch(e){}
40    emit();
41    return {ok:true,message:'تم تجهيز المنصة للعمل دون اتصال'};
42  }
43
44  async function ensureWorker(){
45    if(!('serviceWorker' in navigator)) return {ok:false,message:'ميزة العمل دون اتصال غير مدعومة'};
46    try{
47      var reg=await navigator.serviceWorker.register('/sw.js?v='+ASSET_VERSION,{scope:'/'});
48      state.sw='registered'; emit();
49      return {ok:true,registration:reg,message:'تم تفعيل العمل دون اتصال'};
50    }catch(e){
51      state.sw='failed'; state.error=e.message||String(e); emit();
52      return {ok:false,message:'تعذر تفعيل العمل دون اتصال حالياً'};
53    }
54  }
55
56  window.__gzcActivatePwa=async function(){
57    var sw=await ensureWorker();
58    var cache=await warmCache().catch(function(e){return {ok:false,message:e.message||String(e)};});
59    if(!sw.ok) return sw;
60    if(!cache.ok) return cache;
61    return {ok:true,message:'تم تجهيز التطبيق. على iPhone ثبّته من زر المشاركة ثم «إضافة إلى الشاشة الرئيسية».'};
62  };
63
64  window.__gzcInstallApp=function(){
65    if(window.__gzcInstallPrompt){
66      var p=window.__gzcInstallPrompt; window.__gzcInstallPrompt=null; state.installReady=false; emit();
67      return p.prompt().then(function(){return p.userChoice||{};}).then(function(choice){
68        if(choice.outcome==='accepted'){state.activated=true;try{localStorage.setItem('gzc_pwa_activated','1')}catch(e){}emit();}
69        return {ok:true,outcome:choice.outcome||'unknown',message:'تم فتح نافذة التثبيت'};
70      }).catch(function(e){return {ok:false,message:e.message||'تعذر فتح التثبيت'};});
71    }
72    return window.__gzcActivatePwa().then(function(r){
73      return {ok:r.ok,message:'تم تجهيز التطبيق. على iPhone اضغط زر المشاركة ثم «إضافة إلى الشاشة الرئيسية». وعلى Android استخدم خيار الإضافة إلى الشاشة الرئيسية من القائمة.'};
74    });
75  };
76  window.__gzcClearVueCaches=function(){
77    if(!window.caches) return Promise.resolve({ok:false,message:'ميزة العمل دون اتصال غير متاحة'});
78    return caches.keys().then(function(keys){return Promise.all(keys.filter(function(k){return (k.indexOf('gzc-vue-')===0||k.indexOf('gzc-prod-')===0);}).map(function(k){return caches.delete(k);})).then(function(){state.cacheReady=false;emit();return {ok:true,message:'تم تحديث بيانات التطبيق'};});});
79  };
80  if('serviceWorker' in navigator){
81    window.addEventListener('load',function(){
82      // The worker precaches the offline shell on install. Rewarming it on every
83      // navigation downloads the application bundle and large icons again.
84      setTimeout(function(){
85        var register=function(){ensureWorker().catch(function(){});};
86        if(typeof window.requestIdleCallback==='function')window.requestIdleCallback(register,{timeout:3000});
87        else register();
88      },1500);
89    });
90  }
91})();

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.