PageSourceSearch

https://smt.smtd.ai/vue/assets/vue-app.js?v=

js smtd.ai collected 2026-10-05 15:06:51 UTC 2,037,744 bytes, 24,977 lines download raw bytes

1(function(){
2  /* v3.5.0 precompiled compatibility bundle: strict mode intentionally omitted for Vue function-mode render output. */
3  const VERSION='3.8.60-candidate.58';
4  const RELEASE_RECOVERY_KEY='gzc_release_recovery';
5  async function recoverStaleRelease(targetVersion){
6    const target=String(targetVersion||'').trim();if(!target||target===VERSION)return false;
7    try{
8      const raw=sessionStorage.getItem(RELEASE_RECOVERY_KEY);const prev=raw?JSON.parse(raw):null;
9      if(prev&&prev.target===target&&Date.now()-Number(prev.at||0)<120000){console.warn('GZC release recovery already attempted',VERSION,target);return false;}
10      sessionStorage.setItem(RELEASE_RECOVERY_KEY,JSON.stringify({from:VERSION,target,at:Date.now()}));
11    }catch(_){}
12    try{if('serviceWorker' in navigator){const regs=await navigator.serviceWorker.getRegistrations();await Promise.all(regs.map(r=>r.unregister().catch(()=>false)));}}catch(_){}
13    try{if(window.caches){const keys=await caches.keys();await Promise.all(keys.filter(k=>k.startsWith('gzc-prod-')||k.startsWith('gzc-vue-')).map(k=>caches.delete(k)));}}catch(_){}
14    try{
15      const u=new URL(window.location.href);u.searchParams.set('__smt_release',target);u.searchParams.set('__refresh',String(Date.now()));window.location.replace(u.toString());return true;
16    }catch(_){window.location.reload();return true;}
17  }
18  async function assertRuntimeRelease(){
19    try{
20      const r=await fetch('/api/health?ui='+encodeURIComponent(VERSION)+'&_='+Date.now(),{cache:'no-store',headers:{Accept:'application/json'}});
21      if(!r||!r.ok)return false;const h=await r.json();const serverVersion=String(h&&h.version||'');
22      if(serverVersion&&serverVersion!==VERSION)return recoverStaleRelease(serverVersion);
23      try{sessionStorage.removeItem(RELEASE_RECOVERY_KEY);}catch(_){}
24    }catch(_){}
25    return false;
26  }
27  const PRIMARY_PUBLIC_ORIGIN='https://smt.smtd.ai';
28  const LEGACY_PUBLIC_ORIGIN='https://gzc.smtd.ai';
29  const PLATFORM_HOSTS=new Set(['smt.smtd.ai','gzc.smtd.ai']);
30  if(!window.Vue || !window.VueRouter || !window.Pinia){
31    const el=document.getElementById('app');
32    if(el) el.innerHTML='<main class="app"><div class="card cdnError"><h3>تعذر فتح المنصة</h3><p>حدثت مشكلة أثناء تحميل الصفحة. حدّث الصفحة أو أعد المحاولة.</p><a class="btn secondary" href="/">العودة للرئيسية</a></div></main>';
33    return;
34  }
35
36  const {createApp,computed,nextTick,onMounted,onUnmounted,reactive,ref,watch}=Vue;
37  const {createRouter,createWebHistory,useRoute,useRouter}=VueRouter;
38  let __gzcStore=null;
39
40  function toLatinDigits(v){return String(v||'').replace(/[٠-٩]/g,d=>'٠١٢٣٤٥٦٧٨٩'.indexOf(d)).replace(/[۰-۹]/g,d=>'۰۱۲۳۴۵۶۷۸۹'.indexOf(d)).replace(/[0-9]/g,d=>String.fromCharCode(d.charCodeAt(0)-65248));}
41  function norm(v){let d=toLatinDigits(v).replace(/\D/g,''); if(d.startsWith('00'))d=d.replace(/^00+/,''); if(d.startsWith('086'))d='86'+d.slice(3); return d;}
42  function withCountryCode(v,prefix){const d=norm(v);if(!d)return prefix;if(d.startsWith(prefix))return d;return prefix+d.replace(/^0+/,'');}
43  function safeMemberNext(v,fallback='/account'){
44    const path=String(v||'').trim();
45    if(!path.startsWith('/')||path.startsWith('//')||path.includes('\\')||path.startsWith('/admin')||path.startsWith('/official'))return fallback;
46    const allowed=['/account','/wallet','/procurement','/orders','/help','/feedback','/emergency','/complete','/announcements','/circulars/','/events','/china-guide','/trade-shipping','/my-china','/new-to-china','/ask','/notification-settings','/official-circulars','/exhibitions','/services','/toolkit','/cities','/city/'];
47    return allowed.some(base=>path===base||path.startsWith(base+'/')||(base.endsWith('/')&&path.startsWith(base)))?path:fallback;
48  }
49  function arabicNameWords(v){return String(v||'').replace(/[ـ\d٠-٩۰-۹]/g,' ').trim().split(/\s+/).filter(w=>/[\u0600-\u06FF]/.test(w));}
50  function isArabicTripleName(v){return arabicNameWords(v).length>=3 && !/[A-Za-z]/.test(String(v||''));}
51  function profileNeedsCompletion(m){if(!m)return false;const s=String(m.status||'');if(s==='pre_registered'||s==='profile_pending')return !(m.profile_locked||m.profile_completed_at);if(['pending','approved','suspended','archived'].includes(s))return false;return !(m.profile_locked||m.profile_completed_at);}
52  function canApproveMember(m){return !!(m&&String(m.status||'')==='pending'&&m.profile_locked&&m.profile_completed_at);}
53  function canShowMemberCard(m){return !!(m&&!m.archived_at&&String(m.status||'')==='approved'&&String(m.gzc_id||'').trim());}
54  function roleName(r){return ({super_admin:'مدير النظام',it_admin:'مدير تقنية المعلومات',system_admin:'مدير تشغيل النظام',community_admin:'مدير مجتمع مدينة',membership:'لجنة العضوية',events:'إدارة الفعاليات',arrival:'متابعة الوصول',help:'متابعة المساعدة',emergency:'متابعة الطوارئ'}[String(r||'')])||'مشرف';}
55  function adminStatusName(s){return ({active:'نشط',suspended:'معلّق',disabled:'معطّل',archived:'مؤرشف'}[String(s||'')])||String(s||'-');}
56  function adminCommitteeKeys(a){return new Set(safeArray(a&&a.committees).map(x=>String((x&&x.key)||x||'')));}
57  function adminIsSenior(a){return !!(a&&['super_admin','it_admin','system_admin'].includes(String(a.role||'')));}
58  function adminCan(a,cap){
59    if(!a)return false;
60    if(adminIsSenior(a))return true;
61    const role=String(a.role||''), committees=adminCommitteeKeys(a);
62    if(cap==='overview'||cap==='tasks'||cap==='search'||cap==='account')return true;
63    if(role==='community_admin')return ['members','communities','arrivals','help','emergency','content','events','feedback'].includes(cap);
64    if(cap==='members')return role==='membership'||committees.has('membership');
65    if(cap==='arrivals')return role==='arrival'||committees.has('arrival');
66    if(cap==='help')return role==='help'||committees.has('help');
67    if(cap==='emergency')return role==='emergency'||committees.has('emergency');
68    if(cap==='events')return role==='events'||committees.has('events');
69    if(cap==='content')return role==='events'||role==='guide'||committees.has('events')||committees.has('guide');
70    if(cap==='feedback')return role==='help'||role==='membership'||role==='guide'||committees.has('help')||committees.has('membership')||committees.has('guide');
71    return false;
72  }
73  const ADMIN_PATH_CAPABILITIES=[
74    ['/admin/member/','members'],['/admin/members','members'],['/admin/register','members'],['/admin/city-hubs','communities'],['/admin/communities','communities'],['/admin/community','communities'],
75    ['/admin/arrivals','arrivals'],['/admin/help','help'],['/admin/emergency','emergency'],['/admin/events','events'],['/admin/event/','events'],
76    ['/admin/media','content'],['/admin/announcements','content'],['/admin/content-intake','content'],['/admin/china-guide','content'],['/admin/sudan-digital','content'],['/admin/trade-shipping','content'],['/admin/feedback','feedback'],
77    ['/admin/orders','procurement'],['/admin/procurement','procurement'],['/admin/wallet','wallet'],['/admin/participation-points','rewards'],['/admin/official-accounts','communications'],['/admin/whatsapp-settings','system'],['/admin/whatsapp','communications'],
78    ['/admin/engineering-advisor','system'],['/admin/ai-operations','system'],['/admin/ai-research','content'],['/admin/ai-efficiency','content'],['/admin/city-coverage','content'],['/admin/taxonomy','content'],['/admin/supervisors','governance'],['/admin/committees','governance'],['/admin/workflows','governance'],['/admin/audit','governance'],
79    ['/admin/system','system'],['/admin/seo','system'],['/admin/backup-settings','system'],['/admin/health','system'],['/admin/releases','system'],['/admin/pwa','system'],['/admin/platform','system'],['/admin/brand-assets','system'],['/admin/options','system'],['/admin/demo','system'],
80    ['/admin/visitors','overview'],['/admin/search','search'],['/admin/task/','tasks'],['/admin/notifications','tasks'],['/admin/account','account'],['/admin','overview']
81  ];
82  function adminCanPath(a,path){const p=String(path||'');const hit=ADMIN_PATH_CAPABILITIES.find(x=>p===x[0]||p.startsWith(x[0]));return hit?adminCan(a,hit[1]):true;}
83  function statusName(s){return ({approved:'معتمد',pending:'مراجعة',profile_pending:'مراجعة',pre_registered:'تذكير التسجيل',suspended:'معلق'}[String(s||'')])||String(s||'-');}
84  function memberType(m){return (m&&m.is_admin_member)||String((m&&m.category)||'').includes('إدارة')?'مشرف / إدارة':'عضو';}
85  function caseTypeName(t){return ({arrival:'وصول',help:'مساعدة',housing:'سكن',translation:'ترجمة',hospital:'مستشفى',documents:'إقامة ووثائق',study:'دراسة',procedures:'إجراءات',health:'صحة',other:'أخرى'}[String(t||'')])||String(t||'-');}
86  function caseStatusName(s){return ({open:'مفتوحة',new:'جديدة',pending:'مراجعة',in_progress:'قيد المتابعة',closed:'مغلقة',resolved:'تم الحل'}[String(s||'')])||String(s||'-');}
87  function eventCategoryName(c){return ({party:'حفل',national_day:'يوم وطني',trip:'رحلة',community_meeting:'اجتماع المجتمع',condolence:'عزاء',iftar:'إفطار',other:'أخرى'}[String(c||'')])||String(c||'-');}
88  function eventStatusName(s){return ({draft:'مسودة',published:'منشورة',completed:'مكتملة',archived:'مؤرشفة',cancelled:'ملغاة'}[String(s||'')])||String(s||'-');}
89  function displayDateAr(v){const raw=String(v||'').trim();if(!raw)return '-';const iso=raw.slice(0,10);const d=new Date(iso+'T00:00:00Z');if(Number.isNaN(d.getTime()))return iso||raw;try{return new Intl.DateTimeFormat('ar-EG',{day:'numeric',month:'short',year:'numeric',timeZone:'UTC'}).format(d);}catch(e){return iso||raw;}}
90  function fmtMB(v){const n=Number(v||0); return 'MB '+(Math.round(n*10)/10).toLocaleString('en-US');}
91  function shortDate(v){return String(v||'').slice(0,16).replace('T',' ');}
92  // Shared by ChinaGuidePage and ChinaGuideDetailPage.
93  function guideServiceLabel(v){return ({markets:'سوق',exhibitions:'معرض / مؤتمر',restaurants:'مطعم',hotels:'فندق / إقامة',health:'صحة',transport:'مواصلات',finance:'بنوك ودفع',housing:'سكن وإقامة',services:'خدمات',education:'تعليم',emergency:'طوارئ',general:'معلومة'}[String(v||'')])||String(v||'معلومة');}
94  function safeImageErrorText(value,status='failed',meta={}){
95    const code=String(meta&&meta.failure_code||'');
96    const messages={
97      no_candidate:'لم نجد صورة مناسبة في المصدر أو نتائج البحث. أضف رابط مصدر بصورة واضحة ثم أعد المحاولة.',
98      source_blocked:'الموقع المصدر منع قراءة الصورة. جرّب مصدراً آخر أو ارفعها يدوياً.',
99      source_missing:'رابط الصورة في المصدر لم يعد صالحاً. جرّب مصدراً آخر.',
100      source_timeout:'تأخر المصدر في الرد. ستعاد المحاولة تلقائياً عند توفرها.',
101      search_timeout:'تأخر بحث الصور في الرد. ستعاد المحاولة تلقائياً عند توفرها.',
102      source_unavailable:'تعذر الاتصال بالمصدر مؤقتاً.',
103      image_too_small:'الصور المتاحة صغيرة أو أبعادها غير مناسبة.',
104      unsupported_format:'صيغة الصورة غير مدعومة على الخادم. جرّب JPG أو PNG أو WebP.',
105      processing_error:'تعذر تجهيز الصورة. أعد المحاولة أو ارفع صورة يدوياً.'
106    };
107    if(messages[code])return messages[code];
108    return String(status||'')==='not_found'?'لم نجد صورة مناسبة وموثوقة من المصدر. يمكنك إعادة المحاولة.':'تعذر تجهيز الصورة المقترحة. لم يتم تغيير العنصر.';
109  }
110  function healthLabel(s){return ({ok:'سليم',warn:'تحذير',warning:'تحذير',bad:'خطر'}[String(s||'')])||String(s||'-');}
111  function queueStatusName(s){return ({queued:'في الانتظار',processing:'قيد الإرسال',sent:'مرسلة',failed:'إعادة مجدولة',dead:'تحتاج مراجعة',cancelled:'ملغاة'}[String(s||'')])||String(s||'-');}
112  function queueFailureName(s){return ({transient_transport:'عطل اتصال مؤقت',transient_rate_limit:'تقييد مؤقت من المزود',transient_provider:'عطل مؤقت لدى المزود',transient_unknown:'فشل مؤقت غير مصنف',permanent_auth:'بيانات اعتماد المزود مرفوضة',permanent_endpoint:'مسار المزود غير صحيح',permanent_request:'القالب أو المعاملات مرفوضة',permanent_provider:'رفض نهائي من المزود',permanent_configuration:'إعداد تشغيلي ناقص',permanent_validation:'بيانات الوجهة غير صحيحة',attempts_exhausted:'استنفدت المحاولات',delivery_unknown:'حالة التسليم غير معروفة',configuration:'إعداد ناقص',validation:'بيانات غير صحيحة',cancelled_by_admin:'ألغتها الإدارة'}[String(s||'')])||String(s||'-');}
113  function safeArray(v){return Array.isArray(v)?v:[];}
114  function safeRecord(v){return v&&typeof v==='object'&&!Array.isArray(v)?v:null;}
115  let __busyActionDepth=0;
116  async function runBusyAction(store,label,task){
117    __busyActionDepth+=1;
118    if(store&&store.state)store.state.busy=true;
119    try{return await task();}
120    catch(err){
121      recordClientRuntimeError('action',err,label||'busy-action');
122      return {ok:false,message:'حدث خطأ غير متوقع. أعد المحاولة.'};
123    }finally{
124      __busyActionDepth=Math.max(0,__busyActionDepth-1);
125      if(store&&store.state)store.state.busy=__busyActionDepth>0;
126    }
127  }
128  function compactContentExcerpt(value,max=180){const text=String(value||'').replace(/<[^>]*>/g,' ').replace(/\s+/g,' ').trim();if(!text)return '';const limit=Math.max(80,Number(max)||180);return text.length>limit?text.slice(0,limit).trimEnd()+'…':text;}
129
130  // BEGIN exhibition-countdown (pure helpers: China time, no DOM / network / storage)
131  const ExhibitionCountdown=(()=>{
132    const CHINA_OFFSET_MS=8*3600000,DAY_MS=86400000;
133    function chinaMs(dateText,endOfDay){
134      const m=/^(\d{4})-(\d{2})-(\d{2})/.exec(String(dateText||''));
135      if(!m)return null;
136      const t=Date.UTC(+m[1],+m[2]-1,+m[3],endOfDay?23:0,endOfDay?59:0,endOfDay?59:0)-CHINA_OFFSET_MS;
137      return Number.isFinite(t)?t:null;
138    }
139    function parts(ms){
140      const total=Math.max(0,Math.floor(ms/1000));
141      return {days:Math.floor(total/86400),hours:Math.floor(total%86400/3600),minutes:Math.floor(total%3600/60),seconds:total%60};
142    }
143    function stateOf(item,now){
144      const start=chinaMs(item&&item.exhibition_start_date,false);
145      if(start===null)return {phase:'unknown',target:null,parts:null};
146      const end=chinaMs((item&&item.exhibition_end_date)||item.exhibition_start_date,true);
147      if(now<start)return {phase:'upcoming',target:start,parts:parts(start-now),near:start-now<=7*DAY_MS};
148      if(end!==null&&now<=end)return {phase:'ongoing',target:end,parts:parts(end-now),near:true};
149      return {phase:'ended',target:null,parts:null};
150    }
151    const RANK={ongoing:0,upcoming:1,unknown:2,ended:3};
152    function sortItems(items,now){
153      return (Array.isArray(items)?items:[]).map(item=>({item,state:stateOf(item,now)})).sort((a,b)=>{
154        if(RANK[a.state.phase]!==RANK[b.state.phase])return RANK[a.state.phase]-RANK[b.state.phase];
155        if(a.state.phase==='ended')return (chinaMs(b.item.exhibition_start_date)||0)-(chinaMs(a.item.exhibition_start_date)||0);
156        if(a.state.phase==='unknown')return String(a.item.title_ar||'').localeCompare(String(b.item.title_ar||''));
157        return (a.state.target||0)-(b.state.target||0);
158      });
159    }
160    const pad=n=>String(n).padStart(2,'0');
161    function icsEscape(text){return String(text||'').replace(/\\/g,'\\\\').replace(/;/g,'\;').replace(/,/g,'\\,').replace(/\r?\n/g,'\\n');}
162    function icsDay(dateText,addDays){
163      const m=/^(\d{4})-(\d{2})-(\d{2})/.exec(String(dateText||''));
164      if(!m)return '';
165      const d=new Date(Date.UTC(+m[1],+m[2]-1,+m[3]+(addDays||0)));
166      return String(d.getUTCFullYear())+pad(d.getUTCMonth()+1)+pad(d.getUTCDate());
167    }
168    function icsFor(item,uidHost){
169      const start=icsDay(item&&item.exhibition_start_date,0);
170      if(!start)return '';
171      const end=icsDay((item.exhibition_end_date||item.exhibition_start_date),1);
172      const rows=['BEGIN:VCALENDAR','VERSION:2.0','PRODID:-//SMT China//Exhibitions//AR','CALSCALE:GREGORIAN','BEGIN:VEVENT',
173        'UID:exhibition-'+String(item.id)+'@'+String(uidHost||'smt'),'DTSTAMP:'+new Date().toISOString().replace(/[-:]/g,'').replace(/\.\d+Z$/,'Z'),
174        'DTSTART;VALUE=DATE:'+start,'DTEND;VALUE=DATE:'+end,'SUMMARY:'+icsEscape(item.title_ar||item.title_en),
175        'LOCATION:'+icsEscape([item.address_ar,item.city].filter(
175Boolean).join(' - ')),'END:VEVENT','END:VCALENDAR'];
176      return rows.join('\r\n')+'\r\n';
177    }
178    return {chinaMs,parts,stateOf,sortItems,icsFor,pad};
179  })();
180  // END exhibition-countdown
181  function safeExternalHttpUrl(url){try{const u=new URL(String(url||''),window.location.origin);return (u.protocol==='http:'||u.protocol==='https:')?u.href:'';}catch(e){return '';}}
182  // App-only AMap handoff. Never route a place click through a web map or start navigation.
183  function amapAppPlaceLink(place,agent=navigator.userAgent){
184    const name=String(place&&(place.name_zh||place.title_zh||place.name_ar||place.title_ar||place.name||place.title_en)||'').trim().slice(0,160);
185    if(!name)return '';
186    const ios=/iPhone|iPad|iPod/i.test(String(agent||''));
187    const android=/Android/i.test(String(agent||''));
188    if(!ios&&!android)return '';
189    const params=new URLSearchParams({sourceApplication:'SMTChina'});
190    const lat=Number(place&&place.latitude),lon=Number(place&&place.longitude);
191    const trusted=place&&place.coordinate_system==='GCJ-02'&&Number.isFinite(lat)&&Number.isFinite(lon)&&lat>=-90&&lat<=90&&lon>=-180&&lon<=180&&place.latitude!=null&&place.longitude!=null;
192    if(trusted){params.set('poiname',name);params.set('lat',String(lat));params.set('lon',String(lon));params.set('dev','0');return (ios?'iosamap://viewMap?':'androidamap://viewMap?')+params.toString();}
193    params.set(ios?'name':'keywords',name);
194    return (ios?'iosamap://poi?':'androidamap://poi?')+params.toString();
195  }
196  function openAmapAppPlace(place,onMessage){
197    const link=amapAppPlaceLink(place);
198    if(!link){onMessage('افتح هذه الصفحة على هاتف iOS أو Android، وتأكد من توفر اسم المكان.');return false;}
199    onMessage('إذا لم يفتح تطبيق AMap، تحقق من تثبيته وافتح الصفحة في متصفح هاتفك مباشرة. لن نفتح خريطة في المتصفح.');
200    window.location.href=link;
201    return true;
202  }
203
204  async function copySharedText(text,okMessage){
205    const value=String(text||'').trim(); if(!value){if(__gzcStore)__gzcStore.state.msg='لا توجد بيانات للنسخ';return false;}
206    try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(value);}else{throw new Error('clipboard unavailable');}if(__gzcStore)__gzcStore.state.msg=okMessage||'تم النسخ';return true;}
207    catch(e){try{const ta=document.createElement('textarea');ta.value=value;ta.setAttribute('readonly','');ta.style.position='fixed';ta.style.opacity='0';document.body.appendChild(ta);ta.select();const ok=document.execCommand('copy');document.body.removeChild(ta);if(!ok)throw new Error('copy failed');if(__gzcStore)__gzcStore.state.msg=okMessage||'تم النسخ';return true;}catch(_){if(__gzcStore)__gzcStore.state.msg='تعذر النسخ تلقائياً';return false;}}
208  }
209  async function shareDetailContent(data){
210    const payload={title:String((data&&data.title)||''),text:String((data&&data.text)||''),url:String((data&&data.url)||window.location.href)};
211    if(navigator.share){try{await navigator.share(payload);return true;}catch(e){if(e&&e.name==='AbortError')return false;}}
212    return copySharedText(payload.url,'تم نسخ رابط المعلومة');
213  }
214  function mediaKindName(k){return ({image:'صورة',video:'فيديو',audio:'صوت'}[String(k||'')])||String(k||'-');}
215  function fileMB(bytes){const n=Number(bytes||0); if(!n)return '0 MB'; return (Math.round((n/1024/1024)*10)/10).toLocaleString('en-US')+' MB';}
216  function countryFlag(code){code=String(code||'').toUpperCase(); if(!/^[A-Z]{2}$/.test(code)||code==='UN')return '🌐'; return code.replace(/./g,c=>String.fromCodePoint(127397+c.charCodeAt(0)));}
217  function countryChangeLabel(v){if(v===null||v===undefined||v==='')return 'جديد'; const n=Number(v||0); if(!Number.isFinite(n))return '0%'; return (n>0?'↗ ':'↘ ')+Math.abs(n).toLocaleString('en-US')+'%';}
218  function countryChangeClass(v){const n=Number(v||0); if(v===null||v===undefined||!Number.isFinite(n)||n===0)return 'flat'; return n>0?'up':'down';}
219  function mediaSrc(m){return (m&&(m.thumb_url||m.file_url))||'';}
220  function isVideo(m){return String((m&&m.kind)||'')==='video';}
221  function isPdf(m){return String((m&&m.kind)||'')==='pdf';}
222  function isVerifiedAnnouncement(a){return ['verified','admin_verified','official_verified'].includes(String((a&&a.verification_status)||''));}
223  function verificationLabel(a){const v=String((a&&a.verification_status)||'');return v==='official_verified'?'تم التحقق بواسطة الحساب الرسمي':(v==='admin_verified'||v==='verified'?'تم التحقق بواسطة الإدارة':'غير موثق');}
224  function mediaPreviewLabel(list){const n=safeArray(list).length;return n?('تم اختيار '+n+' صورة'):'لم يتم اختيار صور';}
225  function channelName(c){return c==='embassy'?'تعميمات السفارة':(c==='consulate'?'تعميمات القنصلية':'إعلانات المنصة')}
226  function channelLogo(c){return c==='embassy'?'/official-logo-embassy-gold.jpeg':(c==='consulate'?'/official-logo-consulate.png':'')}
227  function officialSourceName(a){return (a&&a.source_name_ar)||channelName(a&&a.channel)}
228  function needsOfficialTour(o){return !!(o&&o.tour_required);}
229  function memberPhoto(m,kind){
230    m=m||{}; kind=kind||'profile';
231    if(kind==='thumb') return m.photo_thumb_url||m.photo_profile_url||m.photo_url||'';
232    if(kind==='card') return m.photo_card_url||m.photo_profile_url||m.photo_url||'';
233    return m.photo_profile_url||m.photo_url||'';
234  }
235
236  const CHINA_CITY_DISTRICTS={
237    Guangzhou:['Yuexiu','Liwan','Haizhu','Tianhe','Baiyun','Huangpu','Huadu','Panyu','Nansha','Conghua','Zengcheng','Other'],
238    Foshan:['Chancheng','Nanhai','Shunde','Gaoming','Sanshui','Other'],
239    Shenzhen:['Futian','Luohu','Yantian','Nanshan','Baoan','Longgang','Longhua','Pingshan','Guangming','Dapeng','Other'],
240    Dongguan:['Dongcheng','Nancheng','Wanjiang','Guancheng','Shijie','Gaobu','Dongkeng','Changping','Huangjiang','Zhangmutou','Qingxi','Tangxia','Fenggang','Changan','Humen','Houjie','Dalang','Liaobu','Dalingshan','Shatian','Machong','Chashan','Zhongtang','Daojiao','Hengli','Qishi','Xiegang','Shipai','Qiaotou','Hongmei','Wangniudun','Other'],
241    Yiwu:['Choucheng','Beiyuan','Jiangdong','Futian','Houzhai','Chengxi','Niansanli','Yiting','Fotang','Suxi','Other'],
242    Jinan:['Lixia','Shizhong','Huaiyin','Tianqiao','Licheng','Changqing','Zhangqiu','Jiyang','Laiwu','Gangcheng','Other'],
243    Shanghai:['Huangpu','Xuhui','Changning','Jingan','Putuo','Hongkou','Yangpu','Minhang','Pudong','Other'],
244    Beijing:['Chaoyang','Haidian','Dongcheng','Xicheng','Fengtai','Tongzhou','Shunyi','Daxing','Other'],
245    Hefei:['Yaohai','Luyang','Shushan','Baohe','Feidong','Feixi','Changfeng','Lujiang','Chaohu','Other'],
246    Hangzhou:['Shangcheng','Gongshu','Xihu','Binjiang','Xiaoshan','Yuhang','Qiantang','Linping','Other'],
247    Ningbo:['Haishu','Jiangbei','Beilun','Zhenhai','Yinzhou','Fenghua','Cixi','Yuyao','Other'],
248    Wenzhou:['Lucheng','Longwan','Ouhai','Ruian','Yueqing','Other'],
249    Other:['Other']
250  };
251  const CHINA_CITY_LABELS={Guangzhou:'قوانغتشو / Guangzhou',Foshan:'فوشان / Foshan',Shenzhen:'شنزÙ
251† / Shenzhen',Dongguan:'دونغقوان / Dongguan',Yiwu:'ييوو / Yiwu',Jinan:'جينان / Jinan',Shanghai:'شنغهاي / Shanghai',Beijing:'بكين / Beijing',Hefei:'خفي / Hefei',Hangzhou:'هانغتشو / Hangzhou',Ningbo:'نينغبو / Ningbo',Wenzhou:'ونزو / Wenzhou',Other:'أخرى / Other'};
252  const SUDAN_CITIES=['الخرطوم','أم درمان','بحري','بورتسودان','كسلا','القضارف','مدني','سنار','كوستي','الأبيض','نيالا','الفاشر','زالنجي','الضعين','الجنينة','دنقلا','عطبرة','الدمازين','ربك','أخرى'];
253  const PROFESSION_OPTIONS=['طالب','موظف','رجل أعمال','تاجر','صاحب شركة','طبيب','مهندس','مترجم','عامل','ربة منزل','غير محدد','أخرى'];
254
255  function optionLabel(o){return (o&&(o.name_ar||o.label||o.name_en||o.option_key||o.value))||'';}
256  function optionValue(o){return String((o&&(o.option_key||o.value||o.name_ar))||'');}
257  function publicOptionRows(group){const st=__gzcStore&&__gzcStore.state;return safeArray(st&&st.publicOptions&&st.publicOptions.options&&st.publicOptions.options[group]);}
258  function adminOptionRows(group){const st=__gzcStore&&__gzcStore.state;return safeArray(st&&st.platformOptions&&st.platformOptions.options&&st.platformOptions.options[group]);}
259  function dynamicRows(group,parent){let rows=publicOptionRows(group); if(!rows.length) rows=adminOptionRows(group); if(parent!==undefined&&parent!==null) rows=rows.filter(o=>String(o.parent_key||'')===String(parent||'')); return rows.filter(o=>!o.status||o.status==='active');}
260  function makeOptionList(group,current,parent,fallback){let arr=dynamicRows(group,parent).map(o=>({value:optionValue(o),label:optionLabel(o)})).filter(x=>x.value); if(!arr.length) arr=typeof fallback==='function'?fallback():safeArray(fallback); if(current&&current!=='all'&&!arr.some(x=>String(x.value)===String(current))) arr.unshift({value:current,label:current}); return arr;}
261  function optionList(group,current,parent){return makeOptionList(group,current,parent,[]);}
262  function cityLabel(value){return window.GzcCityLabels.format(value,(__gzcStore&&__gzcStore.state.locale)||'ar');}
263  function cityList(current){return makeOptionList('china_city',current,null,()=>window.GzcCityLabels.cities.map(c=>({value:c.key,label:c.label_ar}))).map(o=>({...o,label:cityLabel(o.value)||o.label}));}
264  function districtList(city,current){return makeOptionList('china_district',current,city,()=>{const key=CHINA_CITY_DISTRICTS[city]?city:'Other';return (CHINA_CITY_DISTRICTS[key]||['Other']).map(value=>({value,label:value}));});}
265  function sudanCityList(current){return makeOptionList('sudan_city',current,null,()=>SUDAN_CITIES.map(value=>({value,label:value})));}
266  function countryList(current){const st=__gzcStore&&__gzcStore.state;let arr=safeArray(st&&st.countries).filter(c=>c.registration_enabled!==false).map(c=>({value:c.code,label:(c.name_ar||c.name_en||c.code)+' / '+(c.name_en||c.code)}));if(current&&!arr.some(x=>x.value===current))arr.unshift({value:current,label:current});return arr;}
267  function professionList(current){return makeOptionList('profession',current,null,()=>PROFESSION_OPTIONS.map(value=>({value,label:value})));}
268
269  function pwaState(){return Object.assign({version:VERSION,online:navigator.onLine,sw:'unknown',standalone:false,installReady:false,error:''},window.__gzcPwaState||{});}
270  function pwaStatusName(s){return ({registered:'مسجل',installed:'مثبت',updated:'تحديث جاهز',updating:'جاري التحديث',waiting:'ينتظر التفعيل',failed:'فشل',unsupported:'غير مدعوم',unknown:'غير معروف'}[String(s||'')])||String(s||'-');}
271  function iosInstallHint(){return 'على iPhone: اضغط زر المشاركة في Safari ثم «إضافة إلى الشاشة الرئيسية». وعلى Android استخدم زر التثبيت أو خيار الإضافة إلى الشاشة الرئيسية.';}
272  function useOtpCooldown(seconds=60){
273    const remaining=ref(0);let timer=null;
274    function stop(){if(timer){clearInterval(timer);timer=null;}}
275    function start(){stop();remaining.value=seconds;timer=setInterval(()=>{remaining.value=Math.max(0,remaining.value-1);if(!remaining.value)stop();},1000);}
276    onUnmounted(stop);
277    return {remaining,start,stop};
278  }
279
280  function collapseKeyFor(d,i){
281    const title=(d.querySelector('summary b')||{}).textContent||('section-'+i);
282    return 'gzc_vue_collapse:'+location.pathname+':'+String(title).trim();
283  }
284  function syncCollapsibleSections(){
285    try{
286      document.querySelectorAll('details.collapseSection').forEach((d,i)=>{
287        if(d.dataset.gzcBound==='1') return;
288        const key=collapseKeyFor(d,i);
289        d.dataset.gzcBound='1'; d.dataset.gzcKey=key;
290        const saved=localStorage.getItem(key);
291        if(saved==='0') d.open=false;
292        if(saved==='1') d.open=true;
293        d.addEventListener('toggle',()=>{try{localStorage.setItem(key,d.open?'1':'0')}catch(e){}},{passive:true});
294      });
295    }catch(e){}
296  }
297
298  let __interactionSeq=0;
299  const __activeInteractions=new Map();
300  function syncGlobalInteraction(){
301    try{
302      const st=__gzcStore&&__gzcStore.state;if(!st)return;
303      if(!st.interaction)st.interaction={active:false,count:0,label:'',kind:'',started_at:0};
304      const rows=Array.from(__activeInteractions.values());const latest=rows.length?rows[rows.length-1]:null;
305      Object.assign(st.interaction,{active:rows.length>0,count:rows.length,label:latest?latest.label:'',kind:latest?latest.kind:'',started_at:latest?latest.started_at:0});
306    }catch(_){ }
307  }
308  function beginGlobalInteraction(label,kind='request'){
309    const token=++__interactionSeq;
310    __activeInteractions.set(token,{label:String(label||'جاري تنفيذ الإجراء...'),kind:String(kind||'request'),started_at:Date.now()});
311    syncGlobalInteraction();return token;
312  }
313  function finishGlobalInteraction(token){if(!token)return;__activeInteractions.delete(token);syncGlobalInteraction();}
314  function apiFeedbackLabel(options){const method=String((options&&options.method)||'GET').toUpperCase();return method==='GET'?'جاري تحميل البيانات...':'جاري تنفيذ الإجراء...';}
315
316  async function api(url,opt){
317    const options=Object.assign({credentials:'include'},opt||{});
318    const feedback=options.feedback!==false;
319    const feedbackLabel=String(options.feedbackLabel||apiFeedbackLabel(options));
320    delete options.feedback;delete options.feedbackLabel;
321    options.headers=Object.assign({'Accept':'application/json'},options.headers||{});
322    if(options.body && !(options.body instanceof FormData) && !options.headers['Content-Type']) options.headers['Content-Type']='application/json';
323    const interactionToken=feedback?beginGlobalInteraction(feedbackLabel,String(options.method||'GET').toUpperCase()==='GET'?'load':'action'):0;
324    try{
325      const r=await fetch(url,options);
326      const txt=await r.text();
327      let j={};
328      try{j=txt?JSON.parse(txt):{};}catch(e){j={ok:false,message:txt||'استجابة غير مفهومة'};}
329      if(!r.ok && !j.status) j.status=r.status;
330      return j;
331    }catch(e){return {ok:false,message:'فشل الاتصال بالسيرفر'};}
332    finally{finishGlobalInteraction(interactionToken);}
333  }
334
335  function frontendDeviceClass(){try{const w=Math.max(document.documentElement&&document.documentElement.clientWidth||0,window.innerWidth||0);return w<=767?'mobile':w<=1023?'tablet':'desktop';}catch(_){return'unknown';}}
336  function safeRoutePattern(route){try{const matched=route&&route.matched&&route.matched.length?route.matched[route.matched.length-1]:null;return String(matched&&matched.path||route&&route.path||location.pathname||'/').slice(0,160);}catch(_){return'/';}}
337  function sendFrontendPerformanceTelemetry(metrics,routePattern){
338    try{const rows=safeArray(metrics).map(x=>({metric:String(x&&x.metric||''),value_ms:Number(x&&x.value_ms)})).filter(x=>x.metric&&Number.isFinite(x.value_ms)&&x.value_ms>=0&&x.value_ms<=60000).slice(0,8);if(!rows.length)return;fetch('/api/platform/performance',{method:'POST',credentials:'omit',cache:'no-store',keepalive:true,headers:{'Content-Type':'application/json','Accept':'application/json'},body:JSON.stringify({release_version:VERSION,device_class:frontendDeviceClass(),route:String(routePattern||'/').slice(0,160),metrics:rows})}).catch(()=>{});}catch(_){ }
339  }
340  let __largestContentfulPaintMs=0;
341  function setupInitialFrontendPerformanceTelemetry(route){
342    try{if('PerformanceObserver' in window){const po=new PerformanceObserver(list=>{for(const e of list.getEntries()){const v=Number(e.startTime||e.renderTime||0);if(Number.isFinite(v)&&v>__largestContentfulPaintMs)__largestContentfulPaintMs=v;}});po.observe({type:'largest-contentful-paint',buffered:true});setTimeout(()=>{try{po.disconnect()}catch(_){ }},10000);}}
343    catch(_){ }
344    const emit=()=>setTimeout(()=>{try{const nav=performance.getEntriesByType&&performance.getEntriesByType('navigation')[0];const metrics=[];if(nav){if(Number(nav.loadEventEnd)>0)metrics.push({metric:'navigation_load_ms',value_ms:Number(nav.loadEventEnd)});if(Number(nav.domContentLoadedEventEnd)>0)metrics.push({metric:'dom_content_loaded_ms',value_ms:Number(nav.domContentLoadedEventEnd)});}if(__largestContentfulPaintMs>0)metrics.push({metric:'largest_contentful_paint_ms',value_ms:__largestContentfulPaintMs});sendFrontendPerformanceTelemetry(metrics,safeRoutePattern(route));}catch(_){ }},1600);
345    if(document.readyState==='complete')emit();else window.addEventListener('load',emit,{once:true});
346  }
347
348  let __uploadSeq=0;
349  function updateGlobalUpload(patch){
350    try{
351      const st=__gzcStore&&__gzcStore.state;
352      if(!st)return;
353      if(!st.upload)st.upload={active:false,progress:0,label:'',loaded:0,total:0};
354      Object.assign(st.upload,patch||{});
355    }catch(_){ }
356  }
357  function finishGlobalUpload(token,ok){
358    try{
359      if(token!==__uploadSeq)return;
360      updateGlobalUpload({progress:ok?100:0});
361      setTimeout(()=>{if(token===__uploadSeq)updateGlobalUpload({active:false,label:'',loaded:0,total:0});},ok?420:180);
362    }catch(_){ }
363  }
364  function uploadApi(url,opt){
365    const options=Object.assign({method:'POST'},opt||{});
366    const token=++__uploadSeq;
367    const label=String(options.uploadLabel||'جاري رفع الملف...');
368    updateGlobalUpload({active:true,progress:0,label,loaded:0,total:0});
369    return new Promise(resolve=>{
370      let settled=false;
371      const done=(result,ok)=>{if(settled)return;settled=true;finishGlobalUpload(token,ok);resolve(result);};
372      try{
373        const xhr=new XMLHttpRequest();
374        xhr.open(String(options.method||'POST'),url,true);
375        xhr.withCredentials=true;
376        xhr.timeout=120000;
377        const headers=Object.assign({'Accept':'application/json'},options.headers||{});
378        Object.keys(headers).forEach(k=>{if(String(k).toLowerCase()!=='content-type')xhr.setRequestHeader(k,String(headers[k]));});
379        if(xhr.upload){xhr.upload.addEventListener('progress',e=>{
380          if(token!==__uploadSeq)return;
381          if(e&&e.lengthComputable&&Number(e.total)>0){const pct=Math.max(1,Math.min(99,Math.round((Number(e.loaded)/Number(e.total))*100)));updateGlobalUpload({active:true,progress:pct,label,loaded:Number(e.loaded||0),total:Number(e.total||0)});}
382          else updateGlobalUpload({active:true,progress:-1,label});
383        });}
384        xhr.addEventListener('load',()=>{
385          let j={};const txt=String(xhr.responseText||'');
386          try{j=txt?JSON.parse(txt):{};}catch(_){j={ok:false,message:txt||'استجابة غير مفهومة'};}
387          if((xhr.status<200||xhr.status>=300)&&!j.status)j.status=xhr.status;
388          done(j,xhr.status>=200&&xhr.status<300&&j.ok!==false);
389        });
390        xhr.addEventListener('error',()=>done({ok:false,message:'فشل الاتصال بالسيرفر'},false));
391        xhr.addEventListener('timeout',()=>done({ok:false,message:'انتهت مهلة رفع الملف. أعد المحاولة.'},false));
392        xhr.addEventListener('abort',()=>done({ok:false,message:'تم إلغاء رفع الملف'},false));
393        xhr.send(options.body||null);
394      }catch(e){done({ok:false,message:e&&e.message||'تعذر بدء رفع الملف'},false);}
395    });
396  }
397
398  async function svgUrlToPngBlob(svgUrl){
399    const r=await fetch(svgUrl,{credentials:'include',cache:'no-store'});
400    if(!r.ok) throw new Error('تعذر تحميل البطاقة');
401    const svg=await r.text();
402    const blob=new Blob([svg],{type:'image/svg+xml;charset=utf-8'});
403    const url=URL.createObjectURL(blob);
404    try{
405      const img=await new Promise((resolve,reject)=>{const im=new Image();im.onload=()=>resolve(im);im.onerror=()=>reject(new Error('تعذر تحويل البطاقة لصورة'));im.src=url;});
406      const canvas=document.createElement('canvas');
407      const ratio=Math.max(2,Math.min(3,window.devicePixelRatio||2));
408      canvas.width=Math.round((img.naturalWidth||720)*ratio);
409      canvas.height=Math.round((img.naturalHeight||432)*ratio);
410      const ctx=canvas.getContext('2d');
411      ctx.fillStyle='#ffffff';ctx.fillRect(0,0,canvas.width,canvas.height);
412      ctx.drawImage(img,0,0,canvas.width,canvas.height);
413      return await new Promise((resolve,reject)=>canvas.toBlob(b=>b?resolve(b):reject(new Error('فشل إنشاء PNG')),'image/png',0.96));
414    }finally{URL.revokeObjectURL(url);}
415  }
416  async function saveCardPng(svgUrl,fileName,store){
417    try{
418      if(store){store.state.busy=true;store.state.msg='جاري تجهيز البطاقة كصورة PNG...';}
419      const blob=await svgUrlToPngBlob(svgUrl);
420      const name=(fileName||'gzc-membership-card')+'.png';
421      const file=new File([blob],name,{type:'image/png'});
422      if(store) store.state.busy=false;
423      if(navigator.canShare&&navigator.canShare({files:[file]})&&navigator.share){
424        await navigator.share({title:'بطاقة عضوية SMT',text:'بطاقة عضوية منصة SMT China',files:[file]});
425        if(store) store.state.msg='تم فتح مشاركة الهاتف. اختر حفظ الصورة أو الصور.';
426        return;
427      }
428      const url=URL.createObjectURL(blob);
429      const a=document.createElement('a');a.href=url;a.download=name;document.body.appendChild(a);a.click();a.remove();
430      setTimeout(()=>URL.revokeObjectURL(url),60000);
431      if(store) store.state.msg='تم تجهيز الصورة. إذا لم تُحفظ تلقائياً، افتحها من التنزيلات.';
432    }catch(e){if(store){store.state.busy=false;store.state.msg=e.message||'فشل حفظ البطاقة كصورة';}}
433  }
434
435  function createGzcStoreCore(){
436    const state=reactive({platformBranding:{},
437      me:null,busy:false,msg:'',interaction:{active:false,count:0,label:'',kind:'',started_at:0},upload:{active:false,progress:0,label:'',loaded:0,total:0},home:null,dash:{},notifications:[],unread:0,memberNotifications:[],memberUnread:0,memberWorkflowSummary:{total:0,needs_action:0,in_progress:0,confirmed:0,completed:0,unread:0},visitorAnalytics:{},storageUsage:{},operationsOverview:{},myWork:{summary:{total:0,overdue:0,mine:0,snoozed:0},items:[]},events:[],eventMeta:{total:0,page:1,limit:30,has_more:false,counts:{total:0,active:0,completed:0,archived:0,media:0}},upcomingEvents:[],engagement:{total_points:0,recent:[],rules:[]},announcements:[],circulars:[],announcementUnread:0,officialAnnouncementUnread:0,digitalServices:[],adminCases:[],emergencie
437s:[],eventMedia:{},eventArchivedMedia:{},eventAudio:[],mediaLibrary:{totals:{},storage:{},items:[],filters:{}},
438      systemHealth:{},offsiteBackupSettings:{config:{s3:{enabled:false,endpoint:'',region:'auto',bucket:'',prefix:'gzc',tiers:['weekly','monthly']},ssh:{enabled:false,host:'',port:22,user:'',base_path:'/var/backups/gzc',tiers:['weekly','monthly']}},overview:{}},auditLogs:[],auditCounts:[],auditTotals:[],whatsappHealth:{},whatsappQueue:{jobs:[],counts:[],audit:[],worker:{}},whatsappSettings:{templates:{},whatsapp:{}},whatsappNotificationPolicy:{policy:{enabled:true,domains:{},events:{}},catalog:{domains:[],events:[]},otp_independent:true},platformOptions:{groups:[],options:{}},publicOptions:{groups:[],options:{}},countries:[],officialSources:[],workflowHealth:{workflows:[]},officialAccounts:[],communities:[],platform:{name_ar:'منصة SMT China'},
439      members:[],memberTotal:0,memberHasMore:false,memberPage:1,committees:[],selectedMember:null,
440      filters:{search:'',status:'all',role_filter:'all',country_code:'all',city:'all',district:'all',community_id:'all',category:'all',sudan_city:'all'}, community:null,
441      locale:'ar',locales:[{code:'ar',label_ar:'العربية',label_en:'Arabic',dir:'rtl'}],localesLoaded:false
442    });
443    const admin=computed(()=>state.me&&state.me.admin?state.me.admin:null);
444    const official=computed(()=>state.me&&state.me.official?state.me.official:null);
445    const ME_CACHE_MS=15000;
446    let meLoadedAt=0;
447    let meInFlight=null;
448    function invalidateMeCache(){meLoadedAt=0;meInFlight=null;}
449    async function loadMe(force=false){
450      const now=Date.now();
451      if(!force&&meLoadedAt&&now-meLoadedAt<ME_CACHE_MS)return state.me;
452      if(!force&&meInFlight)return meInFlight;
453      const request=api('/api/me',{feedback:false}).then(r=>{state.me=r;meLoadedAt=Date.now();return state.me;});
454      meInFlight=request;
455      try{return await request;}finally{if(meInFlight===request)meInFlight=null;}
456    }
457    async function requireAdmin(router){
458      const me=await loadMe();
459      if(!me||!me.authenticated||!me.admin){router.replace('/admin/login');return false;}
460      return true;
461    }
462    async function loadNotifications(status){const qs=status?('?status='+encodeURIComponent(status)):'';const r=await api('/api/admin/notifications'+qs);state.notifications=safeArray(r.notifications);state.unread=Number(r.unread||0);return r;}
463    async function loadMemberNotifications(status='all',limit=40){if(!(state.me&&state.me.authenticated&&state.me.member))return{ok:false,notifications:[],unread:0};const qs=new URLSearchParams({status:String(status||'all'),limit:String(limit||40)});const r=await api('/api/member/notifications?'+qs.toString(),{feedback:false});if(r&&r.ok){state.memberNotifications=safeArray(r.notifications);state.memberUnread=Number(r.unread||0);}return r;}
464    async function loadMemberWorkflowSummary(){if(!(state.me&&state.me.authenticated&&state.me.member))return{ok:false};const r=await api('/api/member/orders',{feedback:false});if(r&&r.ok)state.memberWorkflowSummary=Object.assign({total:0,needs_action:0,in_progress:0,quoted:0,confirmed:0,completed:0,unread:0},r.summary||{});return r;}
465    async function loadPublicContent(){
466      await loadMe();
467      if(state.me&&state.me.authenticated&&state.me.member){
468        await Promise.all([
469          api('/api/events').then(r=>{state.events=safeArray(r.events)}),
470          api('/api/events/upcoming').then(r=>{state.upcomingEvents=safeArray(r.events)}),
471          api('/api/member/engagement').then(r=>{if(r&&r.ok)state.engagement=r;}),
472          Promise.all([api('/api/announcements?engine=announcement'),api('/api/announcements?engine=circular')]).then(([ar,cr])=>{const announcements=safeArray(ar.announcements);const circulars=safeArray(cr.announcements);state.announcements=announcements;state.circulars=circulars;state.announcementUnread=announcements.filter(a=>a.unread_by_me).length;state.officialAnnouncementUnread=circulars.filter(a=>a.unread_by_me).length;})
473        ]);
474      }
475    }
476    async function markAnnouncementsRead(channel){const payload=channel?{channel}:{};const r=await api('/api/announcements/mark-read',{method:'POST',body:JSON.stringify(payload)});if(r&&r.ok){if(channel==='announcement'){state.announcements=safeArray(state.announcements).map(a=>Object.assign({},a,{read_by_me:true,unread_by_me:false}));}else if(channel==='embassy'||channel==='consulate'||channel==='official'||channel==='circular'){state.circulars=safeArray(state.circulars).map(a=>{const match=channel==='official'||channel==='circular'||a.channel===channel;return match?Object.assign({},a,{read_by_me:true,unread_by_me:false}):a;});}else{state.announcements=safeArray(state.announcements).map(a=>Object.assign({},a,{read_by_me:true,unread_by_me:false}));state.circulars=safeArray(state.circulars).map(a=>Object.assign({},a,{read_by_me:true,unread_by_me:false}));}state.announcementUnread=safeArray(state.announcements).filter(a=>a.unread_by_me).length;state.officialAnnouncementUnread=safeArray(state.circulars).filter(a=>a.unread_by_me).length;}return r;}
477    async function loadPublicOptions(){const [r,c]=await Promise.all([api('/api/options',{feedback:false}),api('/api/platform/countries',{feedback:false})]);if(r&&r.ok)state.publicOptions=r;if(c&&c.ok)state.countries=safeArray(c.countries);return r;}
478    async function loadWorkflowHealth(router){state.busy=true;const r=await api('/api/admin/workflows');if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;}state.workflowHealth=r||{workflows:[]};state.busy=false;return r;}
479    async function loadCommunity(){
480      const r=await api('/api/community-profile');
481      state.community=(r&&r.community)||{};
482      return state.community;
483    }
484    async function requireMember(router,nextPath){
485      const me=await loadMe();
486      if(!me||!me.authenticated||!me.member){
487        if(nextPath) try{sessionStorage.setItem('gzc_vue_next',nextPath)}catch(e){}
488        router.replace('/login'); return false;
489      }
490      if(profileNeedsCompletion(me.member) && router && router.currentRoute && router.currentRoute.value && router.currentRoute.value.path!=='/complete'){
491        state.msg='أكمل بياناتك أولاً. لا يمكن استخدام أي صفحة أخرى قبل إكمال التسجيل.';
492        router.replace('/complete'); return false;
493      }
494      return true;
495    }
496    async function requirePublicAccess(router,nextPath){
497      const me=await loadMe();
498      if(!me||!me.authenticated||(!me.member&&!me.official)){
499        if(nextPath) try{sessionStorage.setItem('gzc_vue_next',nextPath)}catch(e){}
500        router.replace('/login'); return false;
501      }
502      if(me.member && profileNeedsCompletion(me.member) && router && router.currentRoute && router.currentRoute.value && router.currentRoute.value.path!=='/complete'){
503        state.msg='أكمل بياناتك أولاً. لا يمكن استخدام أي صفحة أخرى قبل إكمال التسجيل.';
504        router.replace('/complete'); return false;
505      }
506      return true;
507    }
508    async function requireOfficial(router){
509      const me=await loadMe();
510      if(!me||!me.authenticated||!me.official){router.replace('/official/login');return false;}
511      const path=router&&router.currentRoute&&router.currentRoute.value&&router.currentRoute.value.path;
512      if(needsOfficialTour(me.official)&&path!=='/official/tour'){state.msg='الرجاء قراءة جولة الحساب الرسمي أولاً لهذا الرقم.';router.replace('/official/tour');return false;}
513      return true;
514    }
515    async function loadAdminOverview(router){
516      state.busy=true;
517      const [ops,myWork]=await Promise.all([
518        api('/api/admin/operations-overview'),
519        api('/api/admin/my-work?limit=10'),
520        api('/api/admin/committees').then(r=>{state.committees=safeArray(r.committees)}),
521        loadNotifications('open')
522      ]);
523      if(ops&&ops.status===401){state.busy=false;router&&router.replace('/admin/login');return;}
524      state.operationsOverview=ops||{};
525      state.myWork=(myWork&&myWork.ok)?myWork:{summary:{total:0,overdue:0,mine:0,snoozed:0},items:[]};
526      state.dash=(ops&&ops.counts)||{};
527      state.busy=false;
528    }
529    async function loadMembers(append,router){
530      if(!append) state.memberPage=1;
531      state.busy=true;
532      const f=state.filters;
533      const qs=new URLSearchParams({status:f.status||'all',role_filter:f.role_filter||'all',country_code:f.country_code||'all',city:f.city||'all',district:f.district||'all',community_id:f.community_id||'all',category:f.category||'all',sudan_city:f.sudan_city||'all',search:f.search||'',page:String(state.memberPage),limit:'20'});
534      const r=await api('/api/admin/members?'+qs.toString());
535      if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;}
536      state.memberTotal=Number(r.total||0); state.memberHasMore=!!r.has_more;
537      state.members=append?state.members.concat(safeArray(r.members)):safeArray(r.members);
538      state.busy=false;
539    }
540    async function loadMoreMembers(router){state.memberPage++; await loadMembers(true,router);}
541    async function loadMember(id,router){state.busy=true;const r=await api('/api/admin/members/'+encodeURIComponent(id)); if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;} state.selectedMember=r; state.busy=false;}
542    async function loadAdminCases(bucket,router){state.busy=true;const qs=bucket?('?bucket='+encodeURIComponent(bucket)):'';const r=await api('/api/admin/cases'+qs);if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;}state.adminCases=safeArray(r.cases);state.busy=false;return r;}
543    async function loadAdminEmergencies(router){state.busy=true;const r=await api('/api/admin/emergencies');if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;}state.emergencies=safeArray(r.emergencies);state.busy=false;return r;}
544    async function loadAdminEvents(router,opts){
545      const o=opts||{}; if(!o.append)state.busy=true;
546      const qs=new URLSearchParams({page:String(o.page||1),limit:String(o.limit||30),status:o.status||'all',search:o.search||''});
547      const r=await api('/api/admin/events?'+qs.toString());
548      if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;}
549      state.events=o.append?state.events.concat(safeArray(r.events)):safeArray(r.events);
550      state.eventMeta={total:Number(r.total||0),page:Number(r.page||1),limit:Number(r.limit||30),has_more:!!r.has_more,counts:r.counts||state.eventMeta.counts||{}};
551      state.busy=false;return r;
552    }
553    async function loadAdminEvent(id,router){
554      const r=await api('/api/admin/events/'+encodeURIComponent(id));
555      if(r.status===401){router&&router.replace('/admin/login');return;}
556      if(r.ok&&r.event){const i=state.events.findIndex(x=>String(x.id)===String(id));if(i>=0)state.events.splice(i,1,r.event);else state.events=[r.event];}
557      return r;
558    }
559    function replaceEvent(event){if(!event||!event.id)return;const i=state.events.findIndex(x=>String(x.id)===String(event.id));if(i>=0)state.events.splice(i,1,event);else state.events.unshift(event);}
560    async function loadEventMedia(eventId,router){state.busy=true;const r=await api('/api/admin/events/'+encodeURIComponent(eventId)+'/media');if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;}state.eventMedia[eventId]=safeArray(r.media);state.busy=false;return r;}
561    async function loadArchivedEventMedia(eventId,router){state.busy=true;const r=await api('/api/admin/events/'+encodeURIComponent(eventId)+'/media/archived');if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;}state.eventArchivedMedia[eventId]=safeArray(r.media);state.busy=false;return r;}
562    async function loadEventAudio(router){state.busy=true;const r=await api('/api/admin/event-audio');if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;}state.eventAudio=safeArray(r.audio);state.busy=false;return r;}
563    async function loadMediaLibrary(filters,router){state.busy=true;const qs=new URLSearchParams(filters||{});const r=await api('/api/admin/media-library?'+qs.toString());if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;}state.mediaLibrary=r||{totals:{},storage:{},items:[],filters:{}};state.busy=false;return r;}
564    async function loadAdminAnnouncements(router){state.busy=true;const r=await api('/api/admin/announcements');if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;}state.announcements=safeArray(r.announcements);state.busy=false;return r;}
565    async function loadVisitorAnalytics(filters,router){state.busy=true;const qs=new URLSearchParams(filters||{});const r=await api('/api/admin/visitor-analytics?'+qs.toString());if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;}state.visitorAnalytics=r||{};state.busy=false;return r;}
566    async function loadSystemHealth(router){state.busy=true;const r=await api('/api/admin/system-health');if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;}state.systemHealth=r||{};state.busy=false;return r;}
567    async function loadOffsiteBackupSettings(router){state.busy=true;const r=await api('/api/admin/settings/offsite-backups');if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;}state.offsiteBackupSettings=r||state.offsiteBackupSettings;state.busy=false;return r;}
568    async function saveOffsiteBackupSettings(payload,router){state.busy=true;const r=await api('/api/admin/settings/offsite-backups',{method:'POST',body:JSON.stringify(payload||{})});if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;}if(r&&r.ok)state.offsiteBackupSettings=r;state.msg=(r&&r.message)||'';state.busy=false;return r;}
569    async function loadAuditLogs(params,router){state.busy=true;const qs=new URLSearchParams(params||{});const r=await api('/api/admin/audit-logs?'+qs.toString());if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;}state.auditLogs=safeArray(r.logs);state.auditCounts=safeArray(r.counts);state.auditTotals=safeArray(r.totals);state.busy=false;return r;}
570    async function loadWhatsappHealth(router){state.busy=true;const r=await api('/api/admin/settings/whatsapp-health');if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;}state.whatsappHealth=(r&&r.health)||{};state.busy=false;return r;}
571    async function loadWhatsappQueue(status,router){state.busy=true;const qs=status?('?status='+encodeURIComponent(status)):'';const r=await api('/api/admin/whatsapp-queue'+qs);if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;}state.whatsappQueue=r||{jobs:[],counts:[],audit:[],worker:{}};state.busy=false;return r;}
572    async function loadWhatsappSettings(router){state.busy=true;const r=await api('/api/admin/settings/templates');if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;}state.whatsappSettings=r||{templates:{},whatsapp:{}};state.busy=false;return r;}
573    async function loadWhatsappNotificationPolicy(router){state.busy=true;const r=await api('/api/admin/settings/whatsapp-notifications');if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;}state.whatsappNotificationPolicy=r||{policy:{enabled:true,domains:{},events:{}},catalog:{domains:[],events:[]},otp_independent:true};state.busy=false;return r;}
574    async function loadPlatformBranding(router){state.busy=true;const r=await api('/api/admin/platform-branding');if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;}state.platformBranding=(r&&r.branding)||{};state.busy=false;return r;}
575    async function loadReleaseInfo(router){state.busy=true;const r=await api('/api/admin/release-info');if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;}state.releaseInfo=r||{};state.busy=false;return r;}
576    async function loadSeo(router){state.busy=true;const r=await api('/api/admin/seo');if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;}state.seo=r||{seo:{},robots:'',sitemap_preview:''};state.busy=false;return r;}
577    async function saveSeo(payload,router){state.busy=true;const r=await api('/api/admin/seo',{method:'POST',body:JSON.stringify(payload||{})});if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;}state.seo=r||{};state.busy=false;return r;}
578    
579    // UI-002: العنوان محقَّق خادمياً بـsafeUrl، وهذا تحقق ثانٍ قبل حقنه في url()
580    function applyHeroImage(b){try{const u=b&&b.heroImageUrl;const root=document.documentElement;if(typeof u==='string'&&u.charAt(0)==='/'&&u.charAt(1)!=='/'&&!/[\s"'<>\\]/.test(u)&&u.indexOf('..')<0)root.style.setProperty('--smt-hero-image','url("'+u+'")');else root.style.removeProperty('--smt-hero-image');}catch(e){}}
581    async function loadPublicBranding(){const r=await api('/api/platform/branding');state.platformBranding=(r&&r.branding)||state.platformBranding||{};applyHeroImage(state.platformBranding);return r;}
582    
583    async function loadCommunities(router){state.busy=true;const r=await api('/api/admin/communities');if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;}state.communities=safeArray(r.communities);state.platform=r.platform||state.platform;state.busy=false;return r;}
584    async function loadOfficialAccounts(router){state.busy=true;const r=await api('/api/admin/official-accounts');if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;}state.officialAccounts=safeArray(r.accounts).map(a=>Object.assign({},a,{_phones:safeArray(a.phones).map(p=>p.phone).concat(['','','']).slice(0,3),_status:a.status||'active',_can_publish:!!a.can_publish}));state.busy=false;return r;}
585    async function loadPlatformOptions(router){state.busy=true;const r=await api('/api/admin/options');if(r.status===401){state.busy=false;router&&router.replace('/admin/login');return;}state.platformOptions=r||{groups:[],options:{}};state.busy=false;return r;}
586    async function loadOfficialDashboard(router){state.busy=true;const r=await api('/api/official/dashboard');if(r.status===401){state.busy=false;router&&router.replace('/official/login');return;}state.dash=r.counts||{};state.busy=false;return r;}
587    async function loadOfficialMembers(append,router){if(!append)state.memberPage=1;state.busy=true;const f=state.filters;const qs=new URLSearchParams({status:f.status||'all',search:f.search||'',page:String(state.memberPage),limit:'30'});const r=await api('/api/official/members?'+qs.toString());if(r.status===401){state.busy=false;router&&router.replace('/official/login');return;}state.memberTotal=Number(r.total||0);state.memberHasMore=!!r.has_more;state.members=append?state.members.concat(safeArray(r.members)):safeArray(r.members);state.busy=false;return r;}
588    async function loadOfficialMember(id,router){state.busy=true;const r=await api('/api/official/members/'+encodeURIComponent(id));if(r.status===401){state.busy=false;router&&router.replace('/official/login');return;}state.selectedMember=r;state.busy=false;return r;}
589    async function loadOfficialCases(type,router){state.busy=true;const qs=type?('?type='+encodeURIComponent(type)):'';const r=await api('/api/official/cases'+qs);if(r.status===401){state.busy=false;router&&router.replace('/official/login');return;}state.adminCases=safeArray(r.cases);state.busy=false;return r;}
590    async function loadOfficialEmergencies(router){state.busy=true;const r=await api('/api/official/emergencies');if(r.status===401){state.busy=false;router&&router.replace('/official/login');return;}state.emergencies=safeArray(r.emergencies);state.busy=false;return r;}
591    async function loadOfficialAnnouncements(router){state.busy=true;const r=await api('/api/official/announcements');if(r.status===401){state.busy=false;router&&router.replace('/official/login');return;}state.announcements=safeArray(r.announcements);state.busy=false;return r;}
592    async function logout(router,target){state.busy=true;await api('/api/auth/logout',{method:'POST'});state.busy=false;state.me=null;invalidateMeCache();state.msg='تم تسجيل الخروج';router.replace(target||'/admin/login');}
593    return {state,admin,official,loadMe,invalidateMeCache,requireAdmin,requireMember,requirePublicAccess,requireOfficial,loadPublicContent,markAnnouncementsRead,loadPublicOptions,loadWorkflowHealth,loadCommunity,loadAdminOverview,loadNotifications,loadMemberNotifications,loadMemberWorkflowSummary,loadMembers,loadMoreMembers,loadMember,loadAdminCases,loadAdminEmergencies,loadAdminEvents,loadAdminEvent,replaceEvent,loadEventMedia,loadArchivedEventMedia,loadEventAudio,loadMediaLibrary,loadAdminAnnouncements,loadVisitorAnalytics,loadSystemHealth,loadOffsiteBackupSettings,saveOffsiteBackupSettings,loadAuditLogs,loadWhatsappHealth,loadWhatsappQueue,loadWhatsappSettings,loadWhatsappNotificationPolicy,loadPlatformBranding,loadReleaseInfo,loadSeo,saveSeo,loadPublicBranding,loadOfficialAccounts,loadCommunities,loadPlatformOptions,loadOfficialDashboard,loadOfficialMembers,loadOfficialMember,loadOfficialCases,loadOfficialEmergencies,loadOfficialAnnouncements,logout};
594  }
595  const __gzcPiniaStore=window.Pinia.defineStore('gzc-platform',()=>createGzcStoreCore());
596  function useGzcStore(){
597    if(__gzcStore) return __gzcStore;
598    if(!window.__GZC_PINIA) throw new Error('Pinia runtime is not initialized');
599    __gzcStore=__gzcPiniaStore(window.__GZC_PINIA);
600    return __gzcStore;
601  }
602
603  const AdminFrame={
604    props:['title'],
605    setup(){
606      const store=useGzcStore(); const router=useRouter(); const route=useRoute();
607      const drawerOpen=ref(false); const collapsed=ref(false);
608      try{collapsed.value=localStorage.getItem('gzc_admin_sidebar_collapsed')==='1';}catch(e){}
609      const expandedGroups=ref({});
610      try{expandedGroups.value=JSON.parse(localStorage.getItem('gzc_admin_group_expanded')||'{}')||{};}catch(e){expandedGroups.value={};}
611      const plan=[
612        {key:'work',label:'عملي',icon:'tasks',items:[['/admin','عملي','tasks'],['/admin/notifications','الوارد والمهام','tasks'],['/admin/search','بحث شامل','search'],['/admin/daily-utility','تشغيل SMT China اليومي','overview','secondary'],['/admin/visitors','الزوار والإحصائيات','overview','secondary']]},
613        {key:'community',label:'الأعضاء',icon:'members',items:[['/admin/members','الأعضاء والطلبات','members'],['/admin/emergency','الطوارئ','emergency'],['/admin/arrivals','الوصول إلى الصين','arrivals'],['/admin/help','طلبات المساعدة','help'],['/admin/country-communities','جاليات الدول','members','secondary'],['/admin/city-coverage','تغطية المدن','content','secondary'],['/admin/city-hubs','مراكز المدن','communities','secondary'],['/admin/communities','المدن والمجتمعات','communities','secondary'],['/admin/participation-points','نقاط المشاركة','rewards','secondary']]},
614        {key:'business',label:'الأعمال',icon:'sourcing',items:[['/admin/procurement','طلبات التوريد','procurement'],['/admin/orders','الطلبات المؤكدة','procurement'],['/admin/wallet','محفظة SMT','wallet']]},
615        {key:'content',label:'المحتوى',icon:'content',items:[['/admin/announcements','الإعلانات','content'],['/admin/content-intake','إنشاء محتوى','content'],['/admin/events','الفعاليات','events'],['/admin/china-guide','دليلك في الصين','content'],['/admin/trade-shipping','التجارة والشحن','content','secondary'],['/admin/taxonomy','التصنيفات والدول والمسارات','content','secondary'],['/admin/media','مكتبة الوسائط','content','secondary'],['/admin/feedback','الملاحظات والتصحيحات','feedback','secondary']]},
616        {key:'ai',label:'الذكاء الاصطناعي',icon:'system',items:[['/admin/ai-research','المراجعة والمحتوى','content'],['/admin/ai-operations','تشغيل البحث والإعدادات','system'],['/admin/ai-efficiency','الكفاءة والمردود','content'],['/admin/engineering-advisor','المستشار الهندسي AI','system','secondary']]},
617        {key:'communication',label:'التواصل',icon:'communications',items:[['/admin/official-accounts','الحسابات الرسمية','communications'],['/admin/whatsapp','رسائل WhatsApp','communications']]},
618        {key:'system',label:'النظام',icon:'system',items:[['/admin/supervisors','المستخدمون والصلاحيات','governance'],['/admin/committees','اللجان','governance'],['/admin/options','القوائم والخيارات','system','secondary'],['/admin/platform','هوية المنصة والتطبيق','system','secondary'],['/admin/community','عن المنصة','communities','secondary'],['/admin/brand-assets','أصول الهوية البصرية','system','secondary'],['/admin/workflows','مسارات العمل','governance','secondary'],['/admin/audit','سجل التدقيق','governance','secondary'],['/admin/health','صحة النظام والنسخ الاحتياطية','system','secondary'],['/admin/backup-settings','النسخ الخارجية والتعافي','system','secondary'],['/admin/whatsapp-settings','إعدادات واتساب التقنية','system','secondary'],['/admin/system','تشخيص النظام','system','secondary'],['/admin/seo','SEO','system','secondary'],['/admin/releases','الإصدارات','system','secondary'],['/admin/pwa','تطبيق PWA','system','secondary'],['/admin/demo','أدوات الاختبار','system','secondary']]}
619      ];
620      const admin=computed(()=>store.state.me&&store.state.me.admin||null);
621      const allowedGroups=computed(()=>plan.map(g=>Object.assign({},g,{items:g.items.filter(x=>adminCan(admin.value,x[2]))})).filter(g=>g.items.length));
622      function active(p){return route.path===p || (p!=='/admin' && route.path.startsWith(p)) || (p==='/admin/events'&&route.path.startsWith('/admin/event/'));}
623      const groups=computed(()=>allowedGroups.value);
624      const activeGroup=computed(()=>allowedGroups.value.find(g=>g.items.some(x=>active(x[0])))||allowedGroups.value[0]||null);
625      function groupHasSecondary(g){return !!(g&&g.items&&g.items.some(x=>x[3]==='secondary'));}
626      function groupExpanded(g){return !!(g&&expandedGroups.value&&expandedGroups.value[g.key]);}
627      function visibleItems(g){if(!g)return[];if(groupExpanded(g))return g.items;return g.items.filter(x=>x[3]!=='secondary'||active(x[0]));}
628      const localItems=computed(()=>{const g=activeGroup.value;if(!g)return[];const items=visibleItems(g);return items.length>1&&items.length<=5?items:[];});
629      function toggleGroup(g){if(!g)return;expandedGroups.value=Object.assign({},expandedGroups.value,{[g.key]:!groupExpanded(g)});try{localStorage.setItem('gzc_admin_group_expanded',JSON.stringify(expandedGroups.value));}catch(e){}}
630      function go(p){drawerOpen.value=false;router.push(p);}
631      function toggleSidebar(){collapsed.value=!collapsed.value;try{localStorage.setItem('gzc_admin_sidebar_collapsed',collapsed.value?'1':'0');}catch(e){}}
632      function iconPath(name){return ({overview:'M4 13h6V4H4v9Zm10 7h6V11h-6v9Zm0-16v5h6V4h-6ZM4 20h6v-5H4v5Z',tasks:'M5 4h14v16H5V4Zm3 4h8M8 12h8M8 16h5',members:'M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8Zm8-3h5m-2.5-2.5v5',content:'M4 4h16v16H4V4Zm4 4h8M8 12h8M8 16h5',sourcing:'M3 7h18M6 3v4m12-4v4M5 11h14v9H5v-9Zm3 3h3',communications:'M4 5h16v12H7l-3 3V5Zm4 4h8m-8 4h5',system:'M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8Zm0-5v2m0 14v2M3 12h2m14 0h2M5.6 5.6 7 7m10 10 1.4 1.4M18.4 5.6 17 7M7 17l-1.4 1.4'}[name])||'';}
633      function headerIconPath(name){return ({search:'M11 4a7 7 0 1 0 4.9 12L21 21l1-1-5.1-5.1A7 7 0 0 0 11 4Zm0 2a5 5 0 1 1 0 10 5 5 0 0 1 0-10Z',tasks:'M6 3h9l4 4v14H6V3Zm8 2v3h3M9 11h6M9 15h6M9 19h4',account:'M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8Zm-7 9a7 7 0 0 1 14 0'}[name])||'';}
634      watch(()=>route.fullPath,()=>{drawerOpen.value=false;});
635      onMounted(()=>
635{if(admin.value)store.loadNotifications().catch(()=>{});});
636      return {store,router,drawerOpen,collapsed,groups,activeGroup,localItems,active,go,toggleSidebar,roleName,iconPath,headerIconPath,visibleItems,groupHasSecondary,groupExpanded,toggleGroup};
637    },
638    render:(function(){
639const _Vue = Vue
640const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
641
642const _hoisted_1 = ["onClick"]
643const _hoisted_2 = {
644  class: "adminSidebar",
645  "aria-label": "التنقل الإداري"
646}
647const _hoisted_3 = { class: "adminBrand" }
648const _hoisted_4 = ["onClick", "aria-label"]
649const _hoisted_5 = { class: "adminNav" }
650const _hoisted_6 = { class: "adminNavGroupTitle" }
651const _hoisted_7 = {
652  viewBox: "0 0 24 24",
653  "aria-hidden": "true"
654}
655const _hoisted_8 = ["d"]
656const _hoisted_9 = ["onClick"]
657const _hoisted_10 = { key: 0 }
658const _hoisted_11 = ["onClick"]
659const _hoisted_12 = {
660  key: 0,
661  class: "adminSidebarAccount"
662}
663const _hoisted_13 = ["onClick"]
664const _hoisted_14 = ["onClick"]
665const _hoisted_15 = { class: "adminWorkspace" }
666const _hoisted_16 = { class: "adminHeader" }
667const _hoisted_17 = ["onClick"]
668const _hoisted_18 = { class: "adminHeaderTitle" }
669const _hoisted_19 = { key: 0 }
670const _hoisted_20 = { class: "adminHeaderActions" }
671const _hoisted_21 = ["onClick"]
672const _hoisted_22 = {
673  viewBox: "0 0 24 24",
674  "aria-hidden": "true"
675}
676const _hoisted_23 = ["d"]
677const _hoisted_24 = ["onClick"]
678const _hoisted_25 = {
679  viewBox: "0 0 24 24",
680  "aria-hidden": "true"
681}
682const _hoisted_26 = ["d"]
683const _hoisted_27 = { key: 0 }
684const _hoisted_28 = ["onClick"]
685const _hoisted_29 = {
686  viewBox: "0 0 24 24",
687  "aria-hidden": "true"
688}
689const _hoisted_30 = ["d"]
690const _hoisted_31 = {
691  key: 0,
692  class: "adminLocalNav",
693  "aria-label": "التنقل داخل القسم"
694}
695const _hoisted_32 = ["onClick"]
696const _hoisted_33 = { class: "adminPage" }
697
698return function render(_ctx, _cache) {
699  with (_ctx) {
700    const { createElementVNode: _createElementVNode, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, toDisplayString: _toDisplayString, createCommentVNode: _createCommentVNode, normalizeClass: _normalizeClass, renderSlot: _renderSlot } = _Vue
701
702    return (_openBlock(), _createElementBlock("section", { class: _normalizeClass(["adminShell", {sidebarCollapsed:collapsed,drawerOpen:drawerOpen}]) }, [_createElementVNode("div", {
703      class: "adminDrawerScrim",
704      onClick: $event => (drawerOpen=false)
705    }, null, 8, _hoisted_1), _createElementVNode("aside", _hoisted_2, [_createElementVNode("div", _hoisted_3, [_cache[0] || (_cache[0] = _createElementVNode("a", {
706      class: "smtBrandLink",
707      href: "https://smtchgz.cn",
708      target: "_blank",
709      rel: "noopener noreferrer",
710      "aria-label": "فتح موقع SMT Advanced Business"
711    }, [_createElementVNode("img", {
712      src: "/brand/smt-gold-v1/smt-logo-transparent.png",
713      alt: "SMT"
714    })], -1)), _cache[1] || (_cache[1] = _createElementVNode("div", null, [_createElementVNode("b", null, "SMT China"), _createElementVNode("small", null, "لوحة الإدارة")], -1)), _createElementVNode("button", {
715      class: "adminSidebarCollapse",
716      onClick: toggleSidebar,
717      "aria-label": collapsed?'توسيع القائمة':'طي القائمة'
718    }, "‹", 8, _hoisted_4)]), _createElementVNode("nav", _hoisted_5, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(groups, (g) => {
719      return (_openBlock(), _createElementBlock("section", {
720        key: g.key,
721        class: _normalizeClass({activeGroup:activeGroup&&activeGroup.key===g.key})
722      }, [_createElementVNode("div", _hoisted_6, [(_openBlock(), _createElementBlock("svg", _hoisted_7, [_createElementVNode("path", { d: iconPath(g.icon) }, null, 8, _hoisted_8)])), _createElementVNode("span", null, _toDisplayString(g.label), 1)]), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(visibleItems(g), (item) => {
723        return (_openBlock(), _createElementBlock("button", {
724          key: item[0],
725          class: _normalizeClass({active:active(item[0])}),
726          onClick: $event => (go(item[0]))
727        }, [_cache[2] || (_cache[2] = _createElementVNode("span", { class: "adminNavDot" }, null, -1)), _createElementVNode("span", null, _toDisplayString(item[1]), 1), (item[0]==='/admin/notifications'&&store.state.unread)
728          ? (_openBlock(), _createElementBlock("b", _hoisted_10, _toDisplayString(store.state.unread), 1))
729          : _createCommentVNode("", true)], 10, _hoisted_9))
730      }), 128)), (groupHasSecondary(g))
731        ? (_openBlock(), _createElementBlock("button", {
732            key: 0,
733            class: "adminGroupMore",
734            onClick: $event => (toggleGroup(g))
735          }, [_createElementVNode("span", null, _toDisplayString(groupExpanded(g)?'عرض أقل':'المزيد'), 1), _createElementVNode("b", null, _toDisplayString(groupExpanded(g)?'−':'+'), 1)], 8, _hoisted_11))
736        : _createCommentVNode("", true)], 2))
737    }), 128))]), (store.state.me&&store.state.me.admin)
738      ? (_openBlock(), _createElementBlock("div", _hoisted_12, [_createElementVNode("button", { onClick: $event => (go('/admin/account')) }, [_createElementVNode("span", null, _toDisplayString(store.state.me.admin.name||'Admin'), 1), _createElementVNode("small", null, _toDisplayString(roleName(store.state.me.admin.role)), 1)], 8, _hoisted_13), _createElementVNode("button", {
739          class: "danger",
740          onClick: $event => (store.logout(router))
741        }, "خروج", 8, _hoisted_14)]))
742      : _createCommentVNode("", true)]), _createElementVNode("div", _hoisted_15, [_
742createElementVNode("header", _hoisted_16, [_createElementVNode("button", {
743      class: "adminMenuButton",
744      onClick: $event => (drawerOpen=true),
745      "aria-label": "فتح قائمة الإدارة"
746    }, "☰", 8, _hoisted_17), _createElementVNode("div", _hoisted_18, [activeGroup
747      ? (_openBlock(), _createElementBlock("small", _hoisted_19, _toDisplayString(activeGroup.label), 1))
748      : _createCommentVNode("", true), _createElementVNode("h1", null, _toDisplayString(title), 1)]), _createElementVNode("div", _hoisted_20, [
749      _cache[6] || (_cache[6] = _createElementVNode("a", {
750        class: "adminHeaderSmtLink",
751        href: "https://smtchgz.cn",
752        target: "_blank",
753        rel: "noopener noreferrer",
754        "aria-label": "موقع SMT Advanced Business",
755        title: "SMT Advanced Business"
756      }, [_createElementVNode("img", {
757        src: "/brand/smt-gold-v1/smt-icon-192.png",
758        alt: "SMT"
759      })], -1)),
760      _createElementVNode("button", {
761        class: "adminHeaderActionButton",
762        onClick: $event => (go('/admin/search')),
763        "aria-label": "البحث الشامل",
764        title: "البحث الشامل"
765      }, [(_openBlock(), _createElementBlock("svg", _hoisted_22, [_createElementVNode("path", { d: headerIconPath('search') }, null, 8, _hoisted_23)])), _cache[3] || (_cache[3] = _createElementVNode("span", null, "بحث", -1))], 8, _hoisted_21),
766      _createElementVNode("button", {
767        class: "adminBell adminHeaderActionButton",
768        onClick: $event => (go('/admin/notifications')),
769        "aria-label": "المهام والإشعارات",
770        title: "المهام والإشعارات"
771      }, [(_openBlock(), _createElementBlock("svg", _hoisted_25, [_createElementVNode("path", { d: headerIconPath('tasks') }, null, 8, _hoisted_26)])), _cache[4] || (_cache[4] = _createElementVNode("span", null, "مهام", -1)), (store.state.unread)
772        ? (_openBlock(), _createElementBlock("b", _hoisted_27, _toDisplayString(store.state.unread), 1))
773        : _createCommentVNode("", true)], 8, _hoisted_24),
774      _createElementVNode("button", {
775        class: "adminAccountButton adminHeaderActionButton",
776        onClick: $event => (go('/admin/account')),
777        "aria-label": "الحساب",
778        title: "الحساب"
779      }, [(_openBlock(), _createElementBlock("svg", _hoisted_29, [_createElementVNode("path", { d: headerIconPath('account') }, null, 8, _hoisted_30)])), _cache[5] || (_cache[5] = _createElementVNode("span", { class: "srOnly" }, "الحساب", -1))], 8, _hoisted_28)
780    ])]), (localItems.length)
781      ? (_openBlock(), _createElementBlock("nav", _hoisted_31, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(localItems, (item) => {
782          return (_openBlock(), _createElementBlock("button", {
783            key: item[0],
784            class: _normalizeClass({active:active(item[0])}),
785            onClick: $event => (go(item[0]))
786          }, _toDisplayString(item[1]), 11, _hoisted_32))
787        }), 128))]))
788      : _createCommentVNode("", true), _createElementVNode("main", _hoisted_33, [_renderSlot($slots, "default")])])], 2))
789  }
790}
791})()
792  };
793
794  const LoginPage={
795    setup(){
796      const store=useGzcStore(); const router=useRouter(); const route=useRoute(); const phone=ref(''); const code=ref(''); const otp=ref(false);
797      onMounted(()=>{});
798      async function requestOtp(){store.state.busy=true;store.state.msg='جاري إرسال الكود...';const r=await api('/api/auth/request-otp',{method:'POST',body:JSON.stringify({phone:norm(phone.value),purpose:'admin_login'})});store.state.busy=false;store.state.msg=r.message||r.error||'';otp.value=!!r.ok;}
799      async function verifyOtp(){store.state.busy=true;store.state.msg='جاري التحقق...';const r=await api('/api/auth/verify-otp',{method:'POST',body:JSON.stringify({phone:norm(phone.value),code:code.value,purpose:'admin_login'})});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok){await store.loadMe(true);router.replace('/admin');}}
800      return {store,phone,code,otp,requestOtp,verifyOtp};
801    },
802    render:(function(){
803const _Vue = Vue
804const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
805
806const _hoisted_1 = { class: "card" }
807const _hoisted_2 = ["onUpdate:modelValue"]
808const _hoisted_3 = ["onClick"]
809const _hoisted_4 = ["onUpdate:modelValue"]
810const _hoisted_5 = ["onClick"]
811
812return function render(_ctx, _cache) {
813  with (_ctx) {
814    const { createElementVNode: _createElementVNode, vModelText: _vModelText, withDirectives: _withDirectives, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode } = _Vue
815
816    return (_openBlock(), _createElementBlock("section", null, [_cache[2] || (_cache[2] = _createElementVNode("div", { class: "top" }, [_createElementVNode("h2", null, "دخول الإدارة")], -1)), _createElementVNode("div", _hoisted_1, [
817      _cache[0] || (_cache[0] = _createElementVNode("span", { class: "vueBadge" }, "إدارة المنصة", -1)),
818      _cache[1] || (_cache[1] = _createElementVNode("p", { class: "hint" }, "اكتب رقم واتساب بأي صيغة، وسيتم تصحيحه تلقائياً. مثال: 008613660699600 → 8613660699600", -1)),
819      _withDirectives(_createElementVNode("input", {
820        class: "ltr",
821        "onUpdate:modelValue": $event => ((phone) = $event),
822        placeholder: "رقم واتساب"
823      }, null, 8, _hoisted_2), [[_vModelText, phone]]),
824      _createElementVNode("button", {
825        class: "btn",
826        onClick: requestOtp
827      }, "إرسال الكود", 8, _hoisted_3),
828      otp
829        ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_withDirectives(_createElementVNode("input", {
830            class: "ltr otpInput",
831            "onUpdate:modelValue": $event => ((code) = $event),
832            inputmode: "numeric",
833            autocomplete: "one-time-code",
834            maxlength: "6",
835            placeholder: "رمز التحقق"
836          }, null, 8, _hoisted_4), [[_vModelText, code]]), _createElementVNode("button", {
837            class: "btn",
838            onClick: verifyOtp
839          }, "تحقق", 8, _hoisted_5)], 64))
840        : _createCommentVNode("", true)
841    ])]))
842  }
843}
844})()
845  };
846
847  const DashboardPage={
848    components:{AdminFrame},
849    setup(){
850      const store=useGzcStore(); const router=useRouter();
851      const refreshedAt=ref(''); const selectedWorkMode=ref('all'); const workMenuOpen=ref({});
852      const admin=computed(()=>store.state.me&&store.state.me.admin||null);
853      const ops=computed(()=>store.state.operationsOverview||{});
854      const priorities=computed(()=>safeArray(ops.value.priorities));
855      const myWork=computed(()=>store.state.myWork||{summary:{},items:[]});
856      const workItems=computed(()=>safeArray(myWork.value.items).slice(0,10));
857      const workSummary=computed(()=>myWork.value.summary||{});
858      const hasOpenWork=computed(()=>Number(workSummary.value.total||0)>0||workItems.value.length>0);
859      const calmWorkState=computed(()=>!hasOpenWork.value&&!priorities.value.length&&!recentTasks.value.length);
860      const recentTasks=computed(()=>safeArray(ops.value.recent_notifications).slice(0,5));
861      const quickActions=computed(()=>{
862        const out=[];
863        if(adminCan(admin.value,'members'))out.push({label:'إضافة عضو',path:'/admin/register'});
864        if(adminCan(admin.value,'content'))out.push({label:'إنشاء محتوى',path:'/admin/content-intake'});
865        if(adminCan(admin.value,'procurement'))out.push({label:'طلبات التوريد',path:'/admin/procurement'});
866        if(adminCan(admin.value,'events'))out.push({label:'الفعاليات',path:'/admin/events'});
867        out.push({label:'بحث شامل',path:'/admin/search'});
868        return out.slice(0,5);
869      });
870      const workModes=[['all','الكل'],['overdue','متأخر'],['mine','عندي'],['snoozed','مؤجل']];
871      function severityLabel(v){return ({critical:'عاجل',high:'أولوية',normal:'متابعة'}[String(v||'')])||'متابعة';}
872      function workTypeLabel(v){return ({emergency:'طوارئ',member_pending:'عضوية',case_arrival:'وصول',case_help:'مساعدة',case_membership:'متابعة عضو',procurement_overdue:'توريد متأخر',procurement_current:'توريد',wallet_activation:'محفظة',content_verification:'إعادة تحقق',content_pending:'محتوى',content_intake:'محتوى وارد',feedback:'ملاحظة',message_failure:'واتساب'}[String(v||'')])||'مهمة';}
873      function workAgeLabel(x){const m=Math.max(0,Number(x&&x.age_minutes||0));if(m<60)return m+' د';const h=Math.floor(m/60);if(h<24)return h+' س';
873const d=Math.floor(h/24);return d+' يوم';}
874      function workOwnerLabel(x){const c=x&&x.claim||{};if(!c.active)return'غير مستلمة';if(c.mine)return'عندك';return c.claimed_by_name?('عند '+c.claimed_by_name):'عند مسؤول آخر';}
875      async function load(showMessage){if(!(await store.requireAdmin(router)))return;selectedWorkMode.value='all';await store.loadAdminOverview(router);refreshedAt.value=new Date().toLocaleTimeString('ar-EG',{hour:'2-digit',minute:'2-digit'});if(showMessage)store.state.msg='تم تحديث قائمة العمل';}
876      async function selectWorkMode(mode){selectedWorkMode.value=String(mode||'all');workMenuOpen.value={};const r=await api('/api/admin/my-work?limit=10&mode='+encodeURIComponent(selectedWorkMode.value));if(r&&r.ok)store.state.myWork=r;else store.state.msg=r.message||'تعذر تحميل قائمة العمل';}
877      async function claimWork(x){if(!x)return;const r=await api('/api/admin/tasks/'+encodeURIComponent(x.type)+'/'+encodeURIComponent(x.id)+'/claim',{method:'POST',body:'{}'});store.state.msg=r.message||'';if(r.ok)await selectWorkMode(selectedWorkMode.value);}
878      async function releaseWork(x){if(!x)return;const r=await api('/api/admin/tasks/'+encodeURIComponent(x.type)+'/'+encodeURIComponent(x.id)+'/release',{method:'POST',body:'{}'});store.state.msg=r.message||'';workMenuOpen.value={};if(r.ok)await selectWorkMode(selectedWorkMode.value);}
879      async function snoozeWork(x){if(!x)return;const r=await api('/api/admin/tasks/'+encodeURIComponent(x.type)+'/'+encodeURIComponent(x.id)+'/snooze',{method:'POST',body:JSON.stringify({hours:4})});store.state.msg=r.message||'';workMenuOpen.value={};if(r.ok)await selectWorkMode(selectedWorkMode.value);}
880      async function openWork(x){if(x&&x.route)await router.push(x.route);}
881      async function openTask(n){if(!n||!n.id)return;await router.push('/admin/task/'+encodeURIComponent(n.id));}
882      function openPriority(p){if(p&&p.path)router.push(p.path);}
883      function toggleWorkMenu(x){if(!x)return;const k=String(x.type)+':'+String(x.id);workMenuOpen.value=Object.assign({},workMenuOpen.value,{[k]:!workMenuOpen.value[k]});}
884      function workMenuIsOpen(x){return !!(x&&workMenuOpen.value[String(x.type)+':'+String(x.id)]);}
885      onMounted(()=>load(false));
886      return {store,admin,ops,myWork,workItems,workSummary,hasOpenWork,calmWorkState,priorities,recentTasks,quickActions,workModes,selectedWorkMode,workMenuOpen,severityLabel,workTypeLabel,workAgeLabel,workOwnerLabel,refreshedAt,load,selectWorkMode,claimWork,releaseWork,snoozeWork,openWork,openTask,openPriority,toggleWorkMenu,workMenuIsOpen,shortDate};
887    },
888    render:(function(){
889const _Vue = Vue
890const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
891
892const _hoisted_1 = { class: "adminWorkHero" }
893const _hoisted_2 = { class: "adminWorkHeroStats" }
894const _hoisted_3 = { key: 0 }
895const _hoisted_4 = ["onClick"]
896const _hoisted_5 = { key: 1 }
897const _hoisted_6 = {
898  key: 0,
899  class: "card adminTaskFirstPanel",
900  "aria-label": "قائمة عملي"
901}
902const _hoisted_7 = { class: "adminSectionHead" }
903const _hoisted_8 = { class: "adminPriorityCount" }
904const _hoisted_9 = {
905  class: "adminWorkFilterBar",
906  role: "tablist",
907  "aria-label": "تصفية قائمة العمل"
908}
909const _hoisted_10 = ["onClick"]
910const _hoisted_11 = { key: 0 }
911const _hoisted_12 = { key: 1 }
912const _hoisted_13 = { key: 2 }
913const _hoisted_14 = {
914  key: 0,
915  class: "adminTaskRows adminTaskFirstRows"
916}
917const _hoisted_15 = ["onClick"]
918const _hoisted_16 = { class: "adminWorkTitleLine" }
919const _hoisted_17 = { class: "statusPill" }
920const _hoisted_18 = { class: "adminWorkFacts" }
921const _hoisted_19 = { class: "adminWorkActions adminTaskFirstActions" }
922const _hoisted_20 = ["onClick"]
923const _hoisted_21 = ["onClick"]
924const _hoisted_22 = {
925  key: 1,
926  class: "adminWorkMoreWrap"
927}
928const _hoisted_23 = ["onClick"]
929const _hoisted_24 = {
930  key: 0,
931  class: "adminWorkMoreMenu"
932}
933const _hoisted_25 = ["onClick"]
934const _hoisted_26 = ["onClick"]
935const _hoisted_27 = {
936  key: 1,
937  class: "adminEmptyState compact"
938}
939const _hoisted_28 = {
940  key: 1,
941  class: "adminQuickActions adminQuickActionsPrimary",
942  "aria-label": "اختصارات سريعة"
943}
944const _hoisted_29 = ["onClick"]
945const _hoisted_30 = {
946  key: 0,
947  class: "card adminPriorityPanel adminOperationalSummaryPanel"
948}
949const _hoisted_31 = { class: "adminPriorityRows" }
950const _hoisted_32 = ["onClick"]
951const _hoisted_33 = { class: "adminPriorityTitle" }
952const _hoisted_34 = {
953  key: 1,
954  class: "card adminIncomingPanel"
955}
956const _hoisted_35 = { class: "adminSectionHead" }
957const _hoisted_36 = ["onClick"]
958const _hoisted_37 = { class: "adminTaskRows compact" }
959const _hoisted_38 = ["onClick"]
960const _hoisted_39 = {
961  key: 3,
962  class: "card adminDecisionCalm adminWorkZeroState"
963}
964const _hoisted_40 = ["onClick"]
965
966return function render(_ctx, _cache) {
967  with (_ctx) {
968    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, renderList: _renderList, Fragment: _Fragment, createTextVNode: _createTextVNode, normalizeClass: _normalizeClass, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
969
970    const _component_AdminFrame = _resolveComponent("AdminFrame")
971
972    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "عملي" }, {
973      default: _withCtx(() => [
974        _createElementVNode("section", _hoisted_1, [_cache[1] || (_cache[1] = _createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "عملي"), _createElementVNode("h2", null, "ما الذي يحتاج إجراء منك الآن؟"), _createElementVNode("p", null, "قائمة واحدة مرتبة حسب الاستعجال والعمر وموعد الإجراء، ضمن صلاحياتك ونطاقك فقط.")], -1)), _createElementVNode("div", _hoisted_2, [
975          _createElementVNode("strong", null, _toDisplayString(workSummary.total||0), 1),
976          _cache[0] || (_cache[0] = _createElementVNode("span", null, "مهمة مفتوحة", -1)),
977          (workSummary.overdue)
978            ? (_openBlock(), _createElementBlock("small", _hoisted_3, _toDisplayString(workSummary.overdue) + " متأخرة", 1))
979            : _createCommentVNode("", true),
980          _createElementVNode("button", {
981            class: "smallbtn secondary",
982            onClick: $event => (load(true))
983          }, "تحديث", 8, _hoisted_4),
984          refreshedAt
985            ? (_openBlock(), _createElementBlock("small", _hoisted_5, "آخر تحديث " + _toDisplayString(refreshedAt), 1))
986            : _createCommentVNode("", true)
987        ])]),
988        hasOpenWork
989          ? (_openBlock(), _createElementBlock("section", _hoisted_6, [_createElementVNode("div", _hoisted_7, [_createElementVNode("div", null, [_cache[2] || (_cache[2] = _createElementVNode("span", { class: "adminEyebrow" }, "قائمة العمل", -1)), _cache[3] || (_cache[3] = _createElementVNode("h3", null, "أعلى 10 مهام تحتاج تنفيذاً", -1)), _createElementVNode("small", null, _toDisplayString(workSummary.mine||0) + " عندي · " + _toDisplayString(workSummary.snoozed||0) + " مؤجلة", 1)]), _createElementVNode("span", _hoisted_8, _toDisplayString(workItems.length), 1)]), _createElementVNode("div", _hoisted_9, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(workModes, (m) => {
990              return (_openBlock(), _createElementBlock("button", {
991                key: m[0],
992                class: _normalizeClass({active:selectedWorkMode===m[0]}),
993                onClick: $event => (selectWorkMode(m[0]))
994              }, [_createTextVNode(_toDisplayString(m[1]), 1), (m[0]==='overdue'&&workSummary.overdue)
995                ? (_openBlock(), _createElementBlock("b", _hoisted_11, _toDisplayString(workSummary.overdue), 1))
996                : (m[0]==='mine'&&workSummary.mine)
997                  ? (_openBlock(), _createElementBlock("b", _hoisted_12, _toDisplayString(workSummary.mine), 1))
998                  : (m[0]==='snoozed'&&workSummary.snoozed)
999                    ? (_openBlock(), _createElementBlock("b", _hoisted_13, _toDisplayString(workSummary.snoozed), 1))
1000                    : _createCommentVNode("", true)], 10, _hoisted_10))
1001            }), 128))]), (workItems.length)
1002              ? (_openBlock(), _createElementBlock("div", _hoisted_14, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(workItems, (x) => {
1003                  return (_openBlock(), _createElementBlock("article", {
1004                    key: x.type+':'+x.id,
1005                    class: _normalizeClass(["adminTaskRow adminWorkItem adminTaskFirstItem", {overdue:x.overdue,mine:x.claim&&x.claim.mine}])
1006                  }, [_createElementVNode("span", { class: _normalizeClass(["adminTaskState", {unread:x.overdue}]) }, null, 2), _createElementVNode("button", {
1007                    class: "adminWorkMain",
1008                    onClick: $event => (openWork(x))
1009                  }, [_createElementVNode("div", _hoisted_16, [_createElementVNode("b", null, _toDisplayString(x.title), 1), _createElementVNode("span", _hoisted_17, _toDisplayString(workTypeLabel(x.type)), 1
1009)]), _createElementVNode("p", null, _toDisplayString(x.subtitle||x.next_action), 1), _createElementVNode("div", _hoisted_18, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(workAgeLabel(x)), 1), _cache[4] || (_cache[4] = _createElementVNode("small", null, "العمر", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(workOwnerLabel(x)), 1), _cache[5] || (_cache[5] = _createElementVNode("small", null, "المسؤول", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(x.next_action||'فتح'), 1), _cache[6] || (_cache[6] = _createElementVNode("small", null, "الإجراء التالي", -1))])])], 8, _hoisted_15), _createElementVNode("div", _hoisted_19, [_createElementVNode("button", {
1010                    class: "smallbtn",
1011                    onClick: $event => (openWork(x))
1012                  }, _toDisplayString(x.next_action||'فتح'), 9, _hoisted_20), (!(x.claim&&x.claim.active))
1013                    ? (_openBlock(), _createElementBlock("button", {
1014                        key: 0,
1015                        class: "smallbtn secondary",
1016                        onClick: $event => (claimWork(x))
1017                      }, "استلام", 8, _hoisted_21))
1018                    : _createCommentVNode("", true), (!(x.claim&&x.claim.active&&!x.claim.mine))
1019                    ? (_openBlock(), _createElementBlock("div", _hoisted_22, [_createElementVNode("button", {
1020                        class: "smallbtn secondary adminWorkMoreButton",
1021                        onClick: $event => (toggleWorkMenu(x)),
1022                        "aria-label": "إجراءات إضافية"
1023                      }, "⋯", 8, _hoisted_23), (workMenuIsOpen(x))
1024                        ? (_openBlock(), _createElementBlock("div", _hoisted_24, [(x.claim&&x.claim.mine)
1025                            ? (_openBlock(), _createElementBlock("button", {
1026                                key: 0,
1027                                onClick: $event => (releaseWork(x))
1028                              }, "إرجاع للقائمة", 8, _hoisted_25))
1029                            : _createCommentVNode("", true), _createElementVNode("button", { onClick: $event => (snoozeWork(x)) }, "تأجيل 4 ساعات", 8, _hoisted_26)]))
1030                        : _createCommentVNode("", true)]))
1031                    : _createCommentVNode("", true)])], 2))
1032                }), 128))]))
1033              : (_openBlock(), _createElementBlock("div", _hoisted_27, _cache[7] || (_cache[7] = [_createElementVNode("b", null, "لا توجد مهام في هذا الفلتر", -1), _createElementVNode("span", null, "اختر «الكل» أو فلترًا آخر لعرض المهام المفتوحة.", -1)])))]))
1034          : _createCommentVNode("", true),
1035        (quickActions.length)
1036          ? (_openBlock(), _createElementBlock("section", _hoisted_28, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(quickActions, (x) => {
1037              return (_openBlock(), _createElementBlock("button", {
1038                key: x.path,
1039                onClick: $event => ($router.push(x.path))
1040              }, _toDisplayString(x.label), 9, _hoisted_29))
1041            }), 128))]))
1042          : _createCommentVNode("", true),
1043        (priorities.length || recentTasks.length)
1044          ? (_openBlock(), _createElementBlock("section", {
1045              key: 2,
1046              class: _normalizeClass(["adminDecisionGrid adminWorkSecondaryGrid", {single:!priorities.length || !recentTasks.length}])
1047            }, [(priorities.length)
1048              ? (_openBlock(), _createElementBlock("div", _hoisted_30, [_cache[8] || (_cache[8] = _createElementVNode("div", { class: "adminSectionHead" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "صورة عامة"), _createElementVNode("h3", null, "العمل حسب المجال"), _createElementVNode("small", null, "هذه مؤشرات تجميعية؛ التنفيذ الفعلي يتم من قائمة «عملي» أعلاه.")])], -1)), _createElementVNode("div", _hoisted_31, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(priorities, (p) => {
1049                  return (_openBlock(), _createElementBlock("button", {
1050                    key: p.key,
1051                    class: _normalizeClass(['adminPriorityRow',p.severity]),
1052                    onClick: $event => (openPriority(p))
1053                  }, [_createElementVNode("div", null, [_createElementVNode("div", _hoisted_33, [_createElementVNode("b", null, _toDisplayString(p.label), 1), _createElementVNode("span", { class: _normalizeClass(['priorityPill',p.severity]) }
1053, _toDisplayString(severityLabel(p.severity)), 3)]), _createElementVNode("p", null, _toDisplayString(p.reason), 1), _createElementVNode("small", null, _toDisplayString(p.next_action), 1)]), _createElementVNode("strong", null, _toDisplayString(p.count), 1)], 10, _hoisted_32))
1054                }), 128))])]))
1055              : _createCommentVNode("", true), (recentTasks.length)
1056              ? (_openBlock(), _createElementBlock("div", _hoisted_34, [_createElementVNode("div", _hoisted_35, [_cache[9] || (_cache[9] = _createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "الوارد"), _createElementVNode("h3", null, "آخر المهام والإشعارات")], -1)), _createElementVNode("button", {
1057                  class: "smallbtn secondary",
1058                  onClick: $event => ($router.push('/admin/notifications'))
1059                }, "عرض الكل", 8, _hoisted_36)]), _createElementVNode("div", _hoisted_37, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(recentTasks, (n) => {
1060                  return (_openBlock(), _createElementBlock("button", {
1061                    key: n.id,
1062                    class: "adminTaskRow",
1063                    onClick: $event => (openTask(n))
1064                  }, [_createElementVNode("span", { class: _normalizeClass(["adminTaskState", {unread:n.status==='unread'}]) }, null, 2), _createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(n.title || 'مهمة إدارية'), 1), _createElementVNode("p", null, _toDisplayString(n.body || 'افتح السجل المرتبط لإكمال المهمة.'), 1), _createElementVNode("small", null, _toDisplayString(shortDate(n.created_at)), 1)]), _cache[10] || (_cache[10] = _createElementVNode("em", null, "فتح", -1))], 8, _hoisted_38))
1065                }), 128))])]))
1066              : _createCommentVNode("", true)], 2))
1067          : _createCommentVNode("", true),
1068        calmWorkState
1069          ? (_openBlock(), _createElementBlock("section", _hoisted_39, [_cache[11] || (_cache[11] = _createElementVNode("div", null, [_createElementVNode("span", { class: "adminZeroCheck" }, "✓"), _createElementVNode("div", null, [_createElementVNode("b", null, "لا يوجد عمل يحتاج تدخلك الآن"), _createElementVNode("p", null, "كل المهام ضمن صلاحياتك ونطاقك منجزة أو لا توجد مهام مفتوحة حالياً.")])], -1)), _createElementVNode("button", {
1070              class: "smallbtn secondary",
1071              onClick: $event => ($router.push('/admin/notifications'))
1072            }, "مراجعة الوارد", 8, _hoisted_40)]))
1073          : _createCommentVNode("", true)
1074      ]),
1075      _: 1
1076    }))
1077  }
1078}
1079})()
1080  };
1081
1082  const AdminVisitorAnalyticsPage={
1083    components:{AdminFrame},
1084    setup(){
1085      const store=useGzcStore(); const router=useRouter();
1086      const filters=reactive({period:'30d',audience:'public',country:'',page_group:'all'});
1087      const data=computed(()=>store.state.visitorAnalytics||{});
1088      const summary=computed(()=>data.value.summary||{});
1089      const trend=computed(()=>safeArray(data.value.trend));
1090      const topCountries=computed(()=>safeArray(data.value.topCountries));
1091      const topPages=computed(()=>safeArray(data.value.topPages));
1092      const topSources=computed(()=>safeArray(data.value.topSources));
1093      const devices=computed(()=>safeArray(data.value.devices));
1094      const browsers=computed(()=>safeArray(data.value.browsers));
1095      const operatingSystems=computed(()=>safeArray(data.value.operatingSystems));
1096      const recentVisits=computed(()=>safeArray(data.value.recentVisits));
1097      const recentAutomation=computed(()=>safeArray(data.value.recentAutomation));
1098      const automationSummary=computed(()=>data.value.automationSummary||{});
1099      const topPagesPreview=computed(()=>topPages.value.slice(0,5));
1100      const topCountriesPreview=computed(()=>topCountries.value.slice(0,5));
1101      const topSourcesPreview=computed(()=>topSources.value.slice(0,5));
1102      const showAllPages=ref(false); const showAllCountries=ref(false); const showAllSources=ref(false);
1103      const visiblePages=computed(()=>showAllPages.value?topPages.value:topPagesPreview.value);
1104      const visibleCountries=computed(()=>showAllCountries.value?topCountries.value:topCountriesPreview.value);
1105      const visibleSources=computed(()=>showAllSources.value?topSources.value:topSourcesPreview.value);
1106      const recentPage=ref(1); const recentPageSize=6;
1107      const recentPageCount=computed(()=>Math.max(1,Math.ceil(recentVisits.value.length/recentPageSize)));
1108      const visibleRecentVisits=computed(()=>
1108recentVisits.value.slice((recentPage.value-1)*recentPageSize,recentPage.value*recentPageSize));
1109      const periodLabel=computed(()=>data.value.period&&data.value.period.label||'30 يوم');
1110      const trendMax=computed(()=>Math.max(1,...trend.value.map(x=>Number(x.pageviews||0))));
1111      const dimensionReady=computed(()=>Number(summary.value.dimension_coverage_pct||0)>=20);
1112      function visitorTypeName(v){return ({guest:'زائر',member:'عضو',admin:'إدارة',official:'حساب رسمي',bot:'Bot',scanner:'Scanner'}[String(v||'')])||String(v||'-');}
1113      function trafficSourceName(v){return ({direct:'مباشر',search:'محركات البحث',social:'شبكات اجتماعية',referral:'إحالة من موقع',internal:'تنقل داخلي',campaign:'حملة',unknown:'غير متوفر تاريخياً'}[String(v||'')])||String(v||'-');}
1114      function deviceName(v){return ({mobile:'هاتف',tablet:'جهاز لوحي',desktop:'كمبيوتر',other:'جهاز آخر',unknown:'غير متوفر تاريخياً'}[String(v||'')])||String(v||'-');}
1115      function pageGroupName(v){return ({all:'كل الأقسام',home:'الرئيسية',guide:'دليلك في الصين',trade:'التجارة والشحن',auth:'الدخول والتسجيل',account:'الحساب والخدمات',events:'الفعاليات',content:'المحتوى',support:'الدعم والطوارئ',business:'طلبات التوريد',other:'أخرى',admin:'الإدارة'}[String(v||'')])||String(v||'-');}
1116      function changeText(v){if(v===null||v===undefined)return 'جديد';v=Number(v||0);return (v>0?'+':'')+v+'%';}
1117      function changeClass(v){if(v===null||v===undefined)return 'neutral';v=Number(v||0);return v>0?'up':v<0?'down':'neutral';}
1118      function barHeight(v){return Math.max(5,Math.round((Number(v||0)/trendMax.value)*100));}
1119      function barWidth(v,rows){const max=Math.max(1,...safeArray(rows).map(x=>Number(x.visitors||0)));return Math.max(3,Math.round((Number(v||0)/max)*100));}
1120      function bucketLabel(v){const d=new Date(v);if(Number.isNaN(d.getTime()))return String(v||'');return data.value.period&&data.value.period.bucket==='hour'?d.toLocaleTimeString('ar',{hour:'2-digit'}):d.toLocaleDateString('ar',{month:'short',day:'numeric'});}
1121      function trendTitle(x){return bucketLabel(x&&x.bucket)+' — '+Number(x&&x.visitors||0)+' زائر، '+Number(x&&x.pageviews||0)+' مشاهدة';}
1122      async function load(showMessage){if(!(await store.requireAdmin(router)))return;recentPage.value=1;await store.loadVisitorAnalytics(filters,router);if(showMessage)store.state.msg='تم تحديث إحصائيات الزوار';}
1123      function setPeriod(v){filters.period=v;load(false);}
1124      function resetFilters(){Object.assign(filters,{period:'30d',audience:'public',country:'',page_group:'all'});load(false);}
1125      onMounted(()=>load(false));
1126      return {store,filters,data,summary,trend,topCountries,topPages,topSources,visiblePages,visibleCountries,visibleSources,showAllPages,showAllCountries,showAllSources,devices,browsers,operatingSystems,recentVisits,visibleRecentVisits,recentPage,recentPageCount,recentAutomation,automationSummary,periodLabel,dimensionReady,visitorTypeName,trafficSourceName,deviceName,pageGroupName,changeText,changeClass,barHeight,barWidth,bucketLabel,trendTitle,countryFlag,shortDate,load,setPeriod,resetFilters};
1127    },
1128    render:(function(){
1129const _Vue = Vue
1130const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
1131
1132const _hoisted_1 = { class: "adminOverviewHero visitorAnalyticsHero visitorIntelHero" }
1133const _hoisted_2 = { class: "adminOverviewHeroSide" }
1134const _hoisted_3 = ["disabled", "onClick"]
1135const _hoisted_4 = {
1136  class: "card visitorFilterBar",
1137  "aria-label": "فلاتر إحصائيات الزوار"
1138}
1139const _hoisted_5 = {
1140  class: "visitorPeriodChips",
1141  role: "group",
1142  "aria-label": "الفترة"
1143}
1144const _hoisted_6 = ["onClick"]
1145const _hoisted_7 = { class: "visitorFilterFields" }
1146const _hoisted_8 = ["onUpdate:modelValue", "onChange"]
1147const _hoisted_9 = ["onUpdate:modelValue", "onChange"]
1148const _hoisted_10 = ["value"]
1149const _hoisted_11 = ["onUpdate:modelValue", "onChange"]
1150const _hoisted_12 = ["value"]
1151const _hoisted_13 = ["onClick"]
1152const _hoisted_14 = {
1153  class: "visitorMetricGrid visitorMetricGridV2 visitorExecutiveMetrics",
1154  "aria-label": "ملخص الحركة"
1155}
1156const _hoisted_15 = { class: "card visitorMetric primaryMetric" }
1157const _hoisted_16 = { class: "card visitorMetric" }
1158const _hoisted_17 = { class: "card visitorMetric" }
1159const _hoisted_18 = { class: "card visitorMetric" }
1160const _hoisted_19 = { class: "card visitorPanel visitorTrendPanel" }
1161const _hoisted_20 = { class: "adminSectionHead" }
1162const _hoisted_21 = ["aria-label"]
1163const _hoisted_22 = ["title"]
1164const _hoisted_23 = { class: "visitorTrendValue" }
1165const _hoisted_24 = { class: "visitorTrendBarWrap" }
1166const _hoisted_25 = {
1167  key: 1,
1168  class: "adminEmptyState compact"
1169}
1170const _hoisted_26 = { class: "visitorAnalyticsGrid visitorAnalyticsGridV2" }
1171const _hoisted_27 = { class: "card visitorPanel" }
1172const _hoisted_28 = {
1173  key: 0,
1174  class: "visitorPageRows"
1175}
1176const _hoisted_29 = { dir: "ltr" }
1177const _hoisted_30 = {
1178  key: 1,
1179  class: "adminEmptyState compact"
1180}
1181const _hoisted_31 = ["onClick"]
1182const _hoisted_32 = { class: "card visitorPanel" }
1183const _hoisted_33 = {
1184  key: 0,
1185  class: "visitorCountryRows"
1186}
1187const _hoisted_34 = { class: "visitorFlag" }
1188const _hoisted_35 = {
1189  key: 1,
1190  class: "adminEmptyState compact"
1191}
1192const _hoisted_36 = ["onClick"]
1193const _hoisted_37 = { class: "visitorAnalyticsGrid visitorAnalyticsGridV2" }
1194const _hoisted_38 = { class: "card visitorPanel" }
1195const _hoisted_39 = { class: "adminSectionHead" }
1196const _hoisted_40 = { key: 0 }
1197const _hoisted_41 = {
1198  key: 0,
1199  class: "visitorBreakdownRows"
1200}
1201const _hoisted_42 = ["onClick"]
1202const _hoisted_43 = { class: "card visitorPanel" }
1203const _hoisted_44 = {
1204  key: 0,
1205  class: "visitorBreakdownRows"
1206}
1207const _hoisted_45 = { class: "visitorTechDetails" }
1208const _hoisted_46 = { class: "visitorMiniColumns" }
1209const _hoisted_47 = { class: "card visitorPanel" }
1210const _hoisted_48 = {
1211  key: 0,
1212  class: "visitorRecentRows"
1213}
1214const _hoisted_49 = { class: "visitorFlag" }
1215const _hoisted_50 = {
1216  key: 1,
1217  class: "adminEmptyState compact"
1218}
1219const _hoisted_51 = {
1220  key: 2,
1221  class: "visitorPager"
1222}
1223const _hoisted_52 = ["disabled", "onClick"]
1224const _hoisted_53 = ["disabled", "onClick"]
1225const _hoisted_54 = { class: "card visitorPanel visitorDataQualityPanel" }
1226const _hoisted_55 = { class: "visitorDataQualityGrid" }
1227const _hoisted_56 = { class: "card visitorPanel visitorAutomationPanel" }
1228const _hoisted_57 = { class: "visitorAutomationMetrics" }
1229const _hoisted_58 = {
1230  key: 0,
1231  class: "visitorRecentRows"
1232}
1233const _hoisted_59 = { class: "visitorFlag" }
1234
1235return function render(_ctx, _cache) {
1236  with (_ctx) {
1237    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, normalizeClass: _normalizeClass, vModelSelect: _vModelSelect, withDirectives: _withDirectives, normalizeStyle: _normalizeStyle, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
1238
1239    const _component_AdminFrame = _resolveComponent("AdminFrame")
1240
1241    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "الزوار والإحصائيات" }, {
1242      default: _withCtx(() => [
1243        _createElementVNode("section", _hoisted_1, [_cache[1] || (_cache[1] = _createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "Visitor Intelligence"), _createElementVNode("h2", null, "حركة المنصة"), _createElementVNode("p", null, "الافتراضي يعرض الزوار الحقيقيين فقط. الإدارة والحسابات الرسمية والـBots والفحوصات الأمنية مفصولة حتى لا تشوّه الأرقام.")], -1)), _createElementVNode("div", _hoisted_2, [
1244          _createElementVNode("strong", null, _toDisplayString(summary.now_total||0), 1),
1245          _cache[0] || (_cache[0] = _createElementVNode("span", null, "نشط الآن", -1)),
1246          _createElementVNode("small", null, "آخر " + _toDisplayString(data.online_window_minutes||5) + " دقائق", 1),
1247          _createElementVNode("button", {
1248            class: "smallbtn secondary",
1249            disabled: store.state.busy,
1250            onClick: $event => (load(true))
1251          }, _toDisplayString(store.state.busy?'جارٍ التحديث...':'تحديث'), 9, _hoisted_3)
1252        ])]),
1253        _createElementVNode("section", _hoisted_4, [_createElementVNode("div", _hoisted_5, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList([['1d','24 ساعة'],['7d','7 أيام'],['30d','30 يوم'],['90d','90 يوم']], (p) => {
1254          return (_openBlock(), _createElementBlock("button", {
1255            key: p[0],
1256            type: "button",
1257            class: _normalizeClass({active:filters.period===p[0]}),
1258            onClick: $event => (setPeriod(p[0]))
1259          }, _toDisplayString(p[1]), 11, _hoisted_6))
1260        }), 128))]), _createElementVNode("div", _hoisted_7, [
1261          _createElementVNode("label", null, [_cache[3] || (_cache[3] = _createElementVNode("span", null, "الجمهور", -1)), _withDirectives(_createElementVNode("select", {
1262            "onUpdate:modelValue": $event => ((filters.audience) = $event),
1263            onChange: $event => (load(false))
1264          }, _cache[2] || (_cache[2] = [
1265            _createElementVNode("option", { value: "public" }, "الزوار", -1),
1266            _createElementVNode("option", { value: "members" }, "الأعضاء", -1),
1267            _createElementVNode("option", { value: "staff" }, "الإدارة والحسابات الرسمية", -1),
1268            _createElementVNode("option", { value: "human" }, "الزوار + الأعضاء", -1),
1269            _createElementVNode("option", { value: "automation" }, "الحركة الآلية", -1)
1270          ]), 40, _hoisted_8), [[_vModelSelect, filters.audience]])]),
1271          _createElementVNode("label", null, [_cache[5] || (_cache[5] = _createElementVNode("span", null, "الدولة", -1)), _withDirectives(_createElementVNode("select", {
1272            "onUpdate:modelValue": $event => ((filters.country) = $event),
1273            onChange: $event => (load(false))
1274          }, [_cache[4] || (_cache[4] = _createElementVNode("option", { value: "" }, "كل الدول", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList($countryList(filters.country), (c) => {
1275            return (_openBlock(), _createElementBlock("option", {
1276              key: c.value,
1277              value: c.value
1278            }, _toDisplayString(c.label), 9, _hoisted_10))
1279          }), 128))], 40, _hoisted_9), [[_vModelSelect, filters.country]])]),
1280          _createElementVNode("label", null, [_cache[6] || (_cache[6] = _createElementVNode("span", null, "القسم", -1)), _withDirectives(_createElementVNode("select", {
1281            "onUpdate:modelValue": $event => ((filters.page_group) = $event),
1282            onChange: $event => (load(false))
1283          }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(['all','home','guide','trade','auth','account','events','content','supp
1283ort','business','other','admin'], (g) => {
1284            return (_openBlock(), _createElementBlock("option", {
1285              key: g,
1286              value: g
1287            }, _toDisplayString(pageGroupName(g)), 9, _hoisted_12))
1288          }), 128))], 40, _hoisted_11), [[_vModelSelect, filters.page_group]])]),
1289          _createElementVNode("button", {
1290            type: "button",
1291            class: "smallbtn secondary visitorResetFilter",
1292            onClick: resetFilters
1293          }, "إعادة الضبط", 8, _hoisted_13)
1294        ])]),
1295        _createElementVNode("section", _hoisted_14, [
1296          _createElementVNode("article", _hoisted_15, [
1297            _cache[7] || (_cache[7] = _createElementVNode("span", null, "الزوار", -1)),
1298            _createElementVNode("b", null, _toDisplayString(summary.visitors||0), 1),
1299            _createElementVNode("small", null, _toDisplayString(periodLabel), 1),
1300            _createElementVNode("em", { class: _normalizeClass(changeClass(summary.visitors_change_pct)) }, _toDisplayString(changeText(summary.visitors_change_pct)) + " عن الفترة السابقة", 3)
1301          ]),
1302          _createElementVNode("article", _hoisted_16, [
1303            _cache[8] || (_cache[8] = _createElementVNode("span", null, "مشاهدات الصفحات", -1)),
1304            _createElementVNode("b", null, _toDisplayString(summary.pageviews||0), 1),
1305            _createElementVNode("small", null, _toDisplayString(periodLabel), 1),
1306            _createElementVNode("em", { class: _normalizeClass(changeClass(summary.pageviews_change_pct)) }, _toDisplayString(changeText(summary.pageviews_change_pct)) + " عن الفترة السابقة", 3)
1307          ]),
1308          _createElementVNode("article", _hoisted_17, [_cache[9] || (_cache[9] = _createElementVNode("span", null, "نشط الآن", -1)), _createElementVNode("b", null, _toDisplayString(summary.now_total||0), 1), _createElementVNode("small", null, "آخر " + _toDisplayString(data.online_window_minutes||5) + " دقائق", 1)]),
1309          _createElementVNode("article", _hoisted_18, [_cache[10] || (_cache[10] = _createElementVNode("span", null, "صفحات لكل زائر", -1)), _createElementVNode("b", null, _toDisplayString(summary.pages_per_visitor||0), 1), _cache[11] || (_cache[11] = _createElementVNode("small", null, "مؤشر استخدام", -1))])
1310        ]),
1311        _createElementVNode("section", _hoisted_19, [_createElementVNode("div", _hoisted_20, [_createElementVNode("div", null, [_cache[12] || (_cache[12] = _createElementVNode("span", { class: "adminEyebrow" }, "الاتجاه", -1)), _createElementVNode("h3", null, "الحركة خلال " + _toDisplayString(periodLabel), 1)]), _createElementVNode("small", null, _toDisplayString(data.audience_label||'الزوار') + " · " + _toDisplayString(pageGroupName(filters.page_group)), 1)]), (trend.length)
1312          ? (_openBlock(), _createElementBlock("div", {
1313              key: 0,
1314              class: "visitorTrendChart",
1315              role: "img",
1316              "aria-label": 'اتجاه مشاهدات الصفحات خلال '+periodLabel
1317            }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(trend, (x, i) => {
1318              return (_openBlock(), _createElementBlock("div", {
1319                key: String(x.bucket)+i,
1320                class: "visitorTrendPoint",
1321                title: trendTitle(x)
1322              }, [_createElementVNode("span", _hoisted_23, _toDisplayString(x.pageviews), 1), _createElementVNode("div", _hoisted_24, [_createElementVNode("i", { style: _normalizeStyle({height:barHeight(x.pageviews)+'%'}) }, null, 4)]), _createElementVNode("small", null, _toDisplayString(bucketLabel(x.bucket)), 1)], 8, _hoisted_22))
1323            }), 128))], 8, _hoisted_21))
1324          : (_openBlock(), _createElementBlock("div", _hoisted_25, _cache[13] || (_cache[13] = [_createElementVNode("b", null, "لا توجد حركة في هذه الفترة", -1), _createElementVNode("span", null, "غيّر الفلاتر أو الفترة لعرض بيانات أخرى.", -1)])))]),
1325        _createElementVNode("section", _hoisted_26, [_createElementVNode("article", _hoisted_27, [_cache[17] || (_cache[17] = _createElementVNode("div", { class: "adminSectionHead" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "المحتوى"), _createElementVNode("h3", null, "أكثر الصفحات استخداماً")])], -1)), (topPages.length)
1326          ? (_openBlock(), _createElementBlock("div", _hoisted_28, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(visiblePages, (p) => {
1327              return (_openBlock(), _createElementBlock("div", {
1328                key: p.page,
1329                class: "visitorPageRow"
1330              }, [_createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(p.page_label||p.page), 1), _createElementVNode("small", null, [_createTextVNode(_toDisplayString(pageGroupName(p.page_group)) + " · ", 1), _createElementVNode("span", _hoisted_29, _toDisplayString(p.page), 1)])]), _createElementVNode("span", null, [_createElementVNode("strong", null, _toDisplayString(p.view_count), 1), _cache[14] || (_cache[14] = _createElementVNode("small", null, "مشاهدة", -1))]), _createElementVNode("span", null, [_createElementVNode("strong", null, _toDisplayString(p.visitors), 1), _cache[15] || (_cache[15] = _createElementVNode("small", null, "زائر", -1))])]))
1331            }), 128))]))
1332          : (_openBlock(), _createElementBlock("div", _hoisted_30, _cache[16] || (_cache[16] = [_createElementVNode("b", null, "لا توجد صفحات مسجلة", -1)]))), (topPages.length>5)
1333          ? (_openBlock(), _createElementBlock("button", {
1334              key: 2,
1335              class: "visitorShowAll",
1336              onClick: $event => (showAllPages=!showAllPages)
1337            }, _toDisplayString(showAllPages?'عرض أهم 5 فقط':'عرض الكل ('+topPages.length+')'), 9, _hoisted_31))
1338          : _createCommentVNode("", true)]), _createElementVNode("article", _hoisted_32, [_cache[20] || (_cache[20] = _createElementVNode("div", { class: "adminSectionHead" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "الدول"), _createElementVNode("h3", null, "أعلى الدول")]), _createElementVNode("small", null, "UN = غير معروفة")], -1)), (topCountries.length)
1339          ? (_openBlock(), _createElementBlock("div", _hoisted_33, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(visibleCountries, (c) => {
1340              return (_openBlock(), _createElementBlock("div", {
1341                key: c.country_code,
1342                class: "visitorCountryRow"
1343              }, [
1344                _createElementVNode("span", _hoisted_34, _toDisplayString(countryFlag(c.country_code)), 1),
1345                _createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(c.country_name||'غير معروف'), 1), _createElementVNode("small", null, _toDisplayString(c.views||0) + " مشاهدة", 1)]),
1346                _createElementVNode("strong", null, _toDisplayString(c.visitors), 1),
1347                _cache[18] || (_cache[18] = _createElementVNode("em", null, "زائر", -1))
1348              ]))
1349            }), 128))]))
1350          : (_openBlock(), _createElementBlock("div", _hoisted_35, _cache[19] || (_cache[19] = [_createElementVNode("b", null, "لا توجد بيانات دول", -1)]))), (topCountries.length>5)
1351          ? (_openBlock(), _createElementBlock("button", {
1352              key: 2,
1353              class: "visitorShowAll",
1354              onClick: $event => (showAllCountries=!showAllCountries)
1355            }, _toDisplayString(showAllCountries?'عرض أهم 5 فقط':'عرض الكل ('+topCountries.length+')'), 9, _hoisted_36))
1356          : _createCommentVNode("", true)])]),
1357        _createElementVNode("section", _hoisted_37, [_createElementVNode("article", _hoisted_38, [_createElementVNode("div", _hoisted_39, [_cache[21] || (_cache[21] = _createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "الاكتساب"), _createElementVNode("h3", null, "مصادر الوصول")], -1)), (!dimensionReady)
1358          ? (_openBlock(), _createElementBlock("small", _hoisted_40, "البيانات الجديدة ما زالت تتراكم"))
1359          : _createCommentVNode("", true)]), (topSources.length)
1360          ? (_openBlock(), _createElementBlock("div", _hoisted_41, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(visibleSources, (x) => {
1361              return (_openBlock(), _createElementBlock("div", {
1362                key: x.key,
1363                class: "visitorBreakdownRow"
1364              }, [_createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(trafficSourceName(x.key)), 1), _createElementVNode("small", null, _toDisplayString(x.visitors) + " زائر · " + _toDisplayString(x.views) + " مشاهدة", 1)]), _createElementVNode("span", null, [_createElementVNode("i", { style: _normalizeStyle({width:barWidth(x.visitors,visibleSources)+'%'}) }, null, 4)])]))
1365            }), 128))]))
1366          : _createCommentVNode("", true), (topSources.length>5)
1367          ? (_openBlock(), _createElementBlock("button", {
1368              key: 1,
1369              class: "visitorShowAll",
1370              onClick: $event => (showAllSources=!showAllSources)
1371            }, _toDisplayString(showAllSources?'عرض أهم 5 فقط':'عرض الكل ('+topSources.length+')'), 9, _hoisted_42))
1372          : _createCommentVNode("", true)]), _createElementVNode("article", _hoisted_43, [_cache[25] || (_cache[25] = _createElementVNode("div", { class: "adminSectionHead" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "الأجهزة"), _createElementVNode("h3", null, "نوع الجهاز")]), _createElementVNode("small", null, "بدون حفظ User-Agent خام")], -1)), (devices.length)
1373          ? (_openBlock(), _createElementBlock("div", _hoisted_44, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(devices, (x) => {
1374              return (_openBlock(), _createElementBlock("div", {
1375                key: x.key,
1376                class: "visitorBreakdownRow"
1377              }, [_createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(deviceName(x.key)), 1), _createElementVNode("small", null, _toDisplayString(x.visitors) + " زائر", 1)]), _createElementVNode("span", null, [_createElementVNode("i", { style: _normalizeStyle({width:barWidth(x.visitors,devices)+'%'}) }, null, 4)])]))
1378            }), 128))]))
1379          : _createCommentVNode("", true), _createElementVNode("details", _hoisted_45, [_cache[24] || (_cache[24] = _createElementVNode("summary", null, "المتصفحات وأنظمة التشغيل", -1)), _createElementVNode("div", _hoisted_46, [_createElementVNode("div", null, [_cache[22] || (_cache[22] = _createElementVNode("h4", null, "المتصفحات", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(browsers, (x) => {
1380          return (_openBlock(), _createElementBlock("p", { key: 'b-'+x.key }
1380, [_createElementVNode("span", null, _toDisplayString(x.key), 1), _createElementVNode("b", null, _toDisplayString(x.visitors), 1)]))
1381        }), 128))]), _createElementVNode("div", null, [_cache[23] || (_cache[23] = _createElementVNode("h4", null, "الأنظمة", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(operatingSystems, (x) => {
1382          return (_openBlock(), _createElementBlock("p", { key: 'o-'+x.key }, [_createElementVNode("span", null, _toDisplayString(x.key), 1), _createElementVNode("b", null, _toDisplayString(x.visitors), 1)]))
1383        }), 128))])])])])]),
1384        _createElementVNode("section", _hoisted_47, [_cache[27] || (_cache[27] = _createElementVNode("div", { class: "adminSectionHead" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "أحدث نشاط"), _createElementVNode("h3", null, "آخر الزيارات المطابقة للفلاتر")]), _createElementVNode("small", null, "لا IP خام · لا fingerprint")], -1)), (recentVisits.length)
1385          ? (_openBlock(), _createElementBlock("div", _hoisted_48, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(visibleRecentVisits, (v, i) => {
1386              return (_openBlock(), _createElementBlock("div", {
1387                key: i+'-'+v.created_at,
1388                class: "visitorRecentRow"
1389              }, [_createElementVNode("span", _hoisted_49, _toDisplayString(countryFlag(v.country_code)), 1), _createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(v.page_label||v.page), 1), _createElementVNode("small", null, _toDisplayString(v.country_name||'غير معروف') + " · " + _toDisplayString(visitorTypeName(v.visitor_type)) + " · " + _toDisplayString(deviceName(v.device_class)) + " · " + _toDisplayString(trafficSourceName(v.traffic_source)), 1)]), _createElementVNode("time", null, _toDisplayString(shortDate(v.created_at)), 1)]))
1390            }), 128))]))
1391          : (_openBlock(), _createElementBlock("div", _hoisted_50, _cache[26] || (_cache[26] = [_createElementVNode("b", null, "لا يوجد نشاط حديث لهذه الفلاتر", -1)]))), (recentPageCount>1)
1392          ? (_openBlock(), _createElementBlock("div", _hoisted_51, [_createElementVNode("button", {
1393              disabled: recentPage<=1,
1394              onClick: $event => (recentPage--)
1395            }, "السابق", 8, _hoisted_52), _createElementVNode("span", null, _toDisplayString(recentPage) + " / " + _toDisplayString(recentPageCount), 1), _createElementVNode("button", {
1396              disabled: recentPage>=recentPageCount,
1397              onClick: $event => (recentPage++)
1398            }, "التالي", 8, _hoisted_53)]))
1399          : _createCommentVNode("", true)]),
1400        _createElementVNode("details", _hoisted_54, [_createElementVNode("summary", null, [_cache[28] || (_cache[28] = _createElementVNode("span", null, [_createElementVNode("b", null, "جودة بيانات الإحصائيات"), _createElementVNode("small", null, "مؤشرات مساعدة لا تدخل في أرقام الزوار")], -1)), _createElementVNode("strong", null, _toDisplayString(summary.country_coverage_pct||0) + "%", 1)]), _createElementVNode("div", _hoisted_55, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(summary.country_coverage_pct||0) + "%", 1), _cache[29] || (_cache[29] = _createElementVNode("small", null, "تغطية الدولة", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(summary.dimension_coverage_pct||0) + "%", 1), _cache[30] || (_cache[30] = _createElementVNode("small", null, "بيانات الجهاز", -1))])])]),
1401        _createElementVNode("details", _hoisted_56, [_createElementVNode("summary", null, [_cache[31] || (_cache[31] = _createElementVNode("span", null, [_createElementVNode("b", null, "الحركة الآلية والفحوصات الأمنية"), _createElementVNode("small", null, "مفصولة تماماً عن أرقام الزوار")], -1)), _createElementVNode("strong", null, _toDisplayString(automationSummary.events||0), 1)]), _createElementVNode("div", _hoisted_57, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(automationSummary.bots_today||0), 1), _cache[32] || (_cache[32] = _createElementVNode("small", null, "Bots اليوم", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(automationSummary.scanner_events_today||0), 1), _cache[33] || (_cache[33] = _createElementVNode("small", null, "فحوصات محجوبة اليوم", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(automationSummary.actors||0), 1), _cache[34] || (_cache[34] = _createElementVNode("small", null, "مصادر آلية خلال الفترة", -1))])]), (recentAutomation.length)
1402          ? (_openBlock(), _createElementBlock("div", _hoisted_58, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(recentAutomation, (v, i) => {
1403              return (_openBlock(), _createElementBlock("div", {
1404                key: 'auto-'+i+'-'+v.created_at,
1405                class: "visitorRecentRow"
1406              }, [_createElementVNode("span", _hoisted_59, _toDisplayString(countryFlag(v.country_code)), 1), _createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(v.page_label||v.page), 1), _createElementVNode("small", null, _toDisplayString(v.country_name||'غير معروف') + " · " + _toDisplayString(visitorTypeName(v.visitor_type)), 1
1406)]), _createElementVNode("time", null, _toDisplayString(shortDate(v.created_at)), 1)]))
1407            }), 128))]))
1408          : _createCommentVNode("", true)]),
1409        _cache[35] || (_cache[35] = _createElementVNode("p", { class: "visitorPrivacyNote" }, "إحصائيات الخصوصية: لا يُحفظ عنوان IP الخام، ولا User-Agent الخام، ولا fingerprint. الـReferrer يحفظ كنطاق فقط.", -1))
1410      ]),
1411      _: 1,
1412      __: [35]
1413    }))
1414  }
1415}
1416})()
1417  };
1418
1419  const AdminUniversalSearchPage={
1420    components:{AdminFrame},
1421    setup(){
1422      const store=useGzcStore(); const router=useRouter(); const qText=ref(''); const results=ref([]); const groups=ref({}); const total=ref(0); const searched=ref(false);
1423      const labels={members:'الأعضاء',admins:'المشرفين',emergencies:'الطوارئ',cases:'الوصول/المساعدة',feedback:'الملاحظات',events:'الفعاليات',media:'الميديا',announcements:'الإعلانات',circulars:'التعميمات',communities:'الجاليات'};
1424      const icons={member:'👤',admin:'🛡️',emergency:'🚨',case:'📄',feedback:'💬',event:'🗓️',media:'🖼️',announcement:'📢',circular:'📜',community:'🏙️'};
1425      const quick=['عضوية','طوارئ','وصول','مساعدة','فعالية','إعلان','تعميم','قوانغتشو','إيوو'];
1426      let timer=null;
1427      async function search(){
1428        const v=String(qText.value||'').trim(); searched.value=true;
1429        if(v.length<2){results.value=[];groups.value={};total.value=0;return;}
1430        store.state.busy=true;
1431        const r=await api('/api/admin/search?search='+encodeURIComponent(v));
1432        if(r.status===401){store.state.busy=false;router.replace('/admin/login');return;}
1433        results.value=safeArray(r.results); groups.value=r.groups||{}; total.value=Number(r.total||results.value.length||0); store.state.busy=false;
1434      }
1435      function delayed(){clearTimeout(timer); timer=setTimeout(search,300)}
1436      function setQuick(v){qText.value=v;search();}
1437      function go(x){if(x&&x.url) router.push(x.url);}
1438      function groupCount(k){return safeArray(groups.value[k]).length;}
1439      function typeIcon(x){return icons[x.result_type]||'🔎'}
1440      onMounted(async()=>{await store.requireAdmin(router);});
1441      return {store,qText,results,groups,total,searched,labels,quick,search,delayed,setQuick,go,groupCount,typeIcon,shortDate};
1442    },
1443    render:(function(){
1444const _Vue = Vue
1445const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
1446
1447const _hoisted_1 = { class: "card dashboardHeaderCard" }
1448const _hoisted_2 = ["onClick"]
1449const _hoisted_3 = { class: "card searchPanel" }
1450const _hoisted_4 = ["onUpdate:modelValue", "onInput", "onKeyup"]
1451const _hoisted_5 = { class: "searchChips" }
1452const _hoisted_6 = ["onClick"]
1453const _hoisted_7 = {
1454  key: 0,
1455  class: "searchGroupStrip"
1456}
1457const _hoisted_8 = {
1458  key: 1,
1459  class: "card emptyCard"
1460}
1461const _hoisted_9 = {
1462  key: 2,
1463  class: "universalResults"
1464}
1465const _hoisted_10 = ["onClick"]
1466const _hoisted_11 = { class: "resultIcon" }
1467
1468return function render(_ctx, _cache) {
1469  with (_ctx) {
1470    const { createElementVNode: _createElementVNode, vModelText: _vModelText, withKeys: _withKeys, withDirectives: _withDirectives, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, toDisplayString: _toDisplayString, vShow: _vShow, createCommentVNode: _createCommentVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
1471
1472    const _component_AdminFrame = _resolveComponent("AdminFrame")
1473
1474    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "البحث الشامل" }, {
1475      default: _withCtx(() => [
1476        _createElementVNode("section", _hoisted_1, [_cache[0] || (_cache[0] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "إدارة المنصة"), _createElementVNode("h3", null, "البحث الشامل"), _createElementVNode("p", { class: "hint" }, "بحث واحد داخل أنظمة الإدارة بدون خلط البيانات الخاصة مع الصفحات العامة.")], -1)), _createElementVNode("button", {
1477          class: "smallbtn",
1478          onClick: search
1479        }, "بحث", 8, _hoisted_2)]),
1480        _createElementVNode("section", _hoisted_3, [_withDirectives(_createElementVNode("input", {
1481          class: "searchInput",
1482          "onUpdate:modelValue": $event => ((qText) = $event),
1483          onInput: delayed,
1484          onKeyup: _withKeys(search, ["enter"]),
1485          placeholder: "ابحث: اسم، رقم، GZC ID، فعالية، تعميم، مدينة، ملاحظة..."
1486        }, null, 40, _hoisted_4), [[_vModelText, qText]]), _createElementVNode("div", _hoisted_5, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(quick, (x) => {
1487          return (_openBlock(), _createElementBlock("button", {
1488            key: x,
1489            onClick: $event => (setQuick(x))
1490          }, _toDisplayString(x), 9, _hoisted_6))
1491        }), 128))])]),
1492        total
1493          ? (_openBlock(), _createElementBlock("section", _hoisted_7, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(labels, (label, key) => {
1494              return _withDirectives((_openBlock(), _createElementBlock("span", { key: key }, [_createElementVNode("b", null, _toDisplayString(groupCount(key)), 1), _createElementVNode("small", null, _toDisplayString(label), 1)])), [[_vShow, groupCount(key)]])
1495            }), 128))]))
1496          : _createCommentVNode("", true),
1497        (searched && !results.length && !store.state.busy)
1498          ? (_openBlock(), _createElementBlock("section", _hoisted_8, "لا توجد نتائج. اكتب كلمة أو رقماً أو استخدم صيغة أخرى."))
1499          : _createCommentVNode("", true),
1500        (results.length)
1501          ? (_openBlock(), _createElementBlock("section", _hoisted_9, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(results, (x) => {
1502              return (_openBlock(), _createElementBlock("button", {
1503                class: "card resultCard",
1504                key: x.group+'-'+x.id,
1505                onClick: $event => (go(x))
1506              }, [_createElementVNode("span", _hoisted_11, _toDisplayString(typeIcon(x)), 1), _createElementVNode("div", null, [_createElementVNode("h3", null, _toDisplayString(x.title || x.full_name || '-'), 1), _createElementVNode("p", null, _toDisplayString(x.subtitle || x.gzc_id || ''), 1), _createElementVNode("small", null, _toDisplayString(labels[x.group] || x.result_type) + " — " + _toDisplayString(x.status || '-') + " — " + _toDisplayString(shortDate(x.created_at)), 1)]), _cache[1] || (_cache[1] = _createElementVNode("em", null, "فتح", -1))], 8, _hoisted_10))
1507            }), 128))]))
1508          : _createCommentVNode("", true)
1509      ]),
1510      _: 1
1511    }))
1512  }
1513}
1514})()
1515  };
1516
1517
1518  const AdminTaskWorkspacePage={
1519    components:{AdminFrame},
1520    setup(){
1521      const store=useGzcStore();const router=useRouter();const route=useRoute();
1522      const notification=ref(null);const record=ref(null);const payload=ref(null);const context=reactive({hub:'china_guide',status:'',mode:'help',actionUrl:'',fullPath:''});
1523      const categories=ref([]);const localBusy=ref(false);const loadError=ref('');const note=ref('');const reviewChecks=reactive({source_verified:false,content_verified:false,image_verified:false,publish_confirmed:false});const useImage=ref(false);const baseline=ref('');
1524      const taskType=computed(()=>String(notification.value&&notification.value.related_type||''));
1525      const taskResolved=computed(()=>['completed','resolved','closed'].includes(String(notification.value&&notification.value.status||'')));
1526      const taskTitle=computed(()=>String(notification.value&&notification.value.title||'مهمة إدارية'));
1527      const fullRecordPath=computed(()=>String(context.fullPath||context.actionUrl||'/admin/notifications'));
1528      const admin=computed(()=>store.state.me&&store.state.me.admin||null);
1529      const aiSuggestion=computed(()=>taskType.value==='ai_research_suggestion'?record.value:null);
1530      const aiDedupStatus=computed(()=>{
1531        const x=aiSuggestion.value;if(!x)return 'unchecked';
1532        if(aiDirty.value)return 'unchecked';
1533        if(String(x.dedup_current_status||x.dedup_status||'')==='conflict')return 'conflict';
1534        if(String(x.dedup_current_status||x.dedup_status||'')==='clear'&&!x.dedup_stale)return 'clear';
1535        return 'unchecked';
1536      });
1537      const aiDirty=computed(()=>!!(aiSuggestion.value&&String(aiSuggestion.value.status)==='pending'&&baseline.value&&baseline.value!==aiSnapshot(aiSuggestion.value)));
1538      const aiApprovalReady=computed(()=>reviewChecks.source_verified&&reviewChecks.content_verified&&reviewChecks.publish_confirmed&&(!useImage.value||reviewChecks.image_verified));
1539      function safeActionUrl(n){let u=String(n&&n.action_url||'').trim();if(!u)return '/admin/notifications';try{const parsed=new URL(u,PRIMARY_PUBLIC_ORIGIN);if(!PLATFORM_HOSTS.has(parsed.hostname))return '/admin/notifications';return parsed.pathname+parsed.search;}catch(_){return '/admin/notifications';}}
1540      function parseContext(n){const u=safeActionUrl(n);context.actionUrl=u;context.fullPath=u;try{const x=new URL(u,PRIMARY_PUBLIC_ORIGIN);context.hub=x.searchParams.get('hub')||((x.pathname.includes('trade-shipping'))?'trade_shipping':(x.pathname.includes('sudan-digital')?'sudan_digital':'china_guide'));context.status=x.searchParams.get('status')||'';context.mode=x.pathname.includes('/arrivals')?'arrival':'help';}catch(_){} }
1541      function findRelated(list,n,codeKey){const id=String(n&&n.related_id||'');return safeArray(list).find(x=>String(x.id||'')===id||String(x&&x[codeKey]||'')===id)||null;}
1542      function aiSnapshot(x){if(!x)return '';return JSON.stringify(['category_id','service_type','direction','title_ar','summary_ar','description_ar','source_name','source_url','risk_level','admin_note'].map(k=>[k,String(x[k]??'')]));}
1543      function hydrateAi(x){if(!x)return null;const v={...x};useImage.value=String(v.image_status||'')==='ready'&&!!v.image_url;baseline.value=aiSnapshot(v);reviewChecks.source_verified=false;reviewChecks.content_verified=false;reviewChecks.image_verified=false;reviewChecks.publish_confirmed=false;return v;}
1544      function aiRisk(v){return ({low:'منخفض',standard:'عادي',high:'عالي المخاطر'}[String(v||'')])||String(v||'-');}
1545      function aiStatus(v){return ({pending:'مسودة',in_review:'جاهز للاعتماد',approved:'معتمد ومنشور',rejected:'مرفوض'}[String(v||'')])||String(v||'-');}
1546      function dedupLabel(v){return ({clear:'لا يوجد تكرار',conflict:'يوجد تعارض / تكرار',unchecked:'يحتاج فحصاً'}[String(v||'')])||'يحتاج فحصاً';}
1547      function procurementStatus(v){return PROCUREMENT_STATUS_LABELS[String(v||'')]||String(v||'-');}
1548      function orderStatus(v){return CUSTOMER_ORDER_STATUS_LABELS[String(v||'')]||String(v||'-');}
1549      function closeWorkspace(){if(window.history.length>1)router.back();else router.replace('/admin/notifications');}
1550      async function loadNotification(){
1551        loadError.value='';localBusy.value=true;
1552        const id=String(route.params.id||'');
1553        let r=await api('/api/admin/notifications?status=open');
1554        if(r.status===401){localBusy.value=false;router.replace('/admin/login');return false;}
1555        let n=safeArray(r.notifications).find(x=>String(x.id)===id);
1556        if(!n){r=await api('/api/admin/notifications?status=history');n=safeArray(r.notifications).find(x=>String(x.id)===id);}
1557        if(!n){localBusy.value=false;loadError.value='المهمة غير موجودة أو خرجت من نطاق صلاحيات هذا الحساب.';return false;}
1558        notification.value=n;parseContext(n);
1559        if(String(n.status)==='unread'){
1560          n.status='read';await api('/api/admin/notifications/'+encodeURIComponent(n.id)+'/read',{method:'POST'});
1561          store.state.unread=Math.max(0,Number(store.state.unread||0)-1);
1562        }
1563        return true;
1564      }
1565      async function loadTask(){
1566        if(!(await loadNotification()))return;
1567        const n=notification.value,t=String(n.related_type||''),id=String(n.related_id||'');record.value=null;payload.value=null;categories.value=[];
1568        try{
1569          if(t==='member'){
1570            const r=await api('/api/admin/members/'+encodeURIComponent(id));if(!r.ok)throw new Error(r.message||r.error||'تعذر تحميل العضو');payload.value=r;record.value=r.member||null;
1571          }else if(t==='case'){
1572            const r=await api('/api/admin/cases?type='+(context.mode==='arrival'?'arrival':''));if(!r.ok)throw new Error(r.message||r.error||'تعذر تحميل الحالة');
1572record.value=findRelated(r.cases,n,'case_code');
1573          }else if(t==='emergency'){
1574            const r=await api('/api/admin/emergencies');if(!r.ok)throw new Error(r.message||r.error||'تعذر تحميل البلاغ');record.value=findRelated(r.emergencies,n,'ticket_code');
1575          }else if(t==='feedback'){
1576            const r=await api('/api/admin/feedback?status=all');if(!r.ok)throw new Error(r.message||r.error||'تعذر تحميل الملاحظة');record.value=findRelated(r.feedback,n,'id');
1577          }else if(t==='guide_suggestion'||t==='guide_report'){
1578            const r=await api('/api/admin/china-guide?hub='+encodeURIComponent(context.hub));if(!r.ok)throw new Error(r.message||r.error||'تعذر تحميل مهمة المحتوى');record.value=t==='guide_suggestion'?findRelated(r.suggestions,n,'id'):findRelated(r.reports,n,'id');payload.value=r;
1579          }else if(t==='procurement_request'){
1580            const r=await api('/api/admin/procurement/'+encodeURIComponent(id));if(!r.ok)throw new Error(r.message||r.error||'تعذر تحميل طلب التوريد');payload.value=r;record.value=r.request;
1581          }else if(t==='customer_order'){
1582            const r=await api('/api/admin/orders/'+encodeURIComponent(id));if(!r.ok)throw new Error(r.message||r.error||'تعذر تحميل الطلب');payload.value=r;record.value=r.order;
1583          }else if(t==='ai_research_suggestion'){
1584            const status=context.status||'in_review';const rr=await Promise.all([api('/api/admin/ai-research?hub='+encodeURIComponent(context.hub)+'&status='+encodeURIComponent(status)),api('/api/china-guide/categories?hub='+encodeURIComponent(context.hub))]);
1585            if(!rr[0].ok)throw new Error(rr[0].message||rr[0].error||'تعذر تحميل المقترح');record.value=hydrateAi(safeArray(rr[0].suggestions).find(x=>String(x.id)===id));payload.value=rr[0];categories.value=safeArray(rr[1].categories);
1586          }else if(t==='ai_research_job'){
1587            const r=await api('/api/admin/ai-research?hub='+encodeURIComponent(context.hub)+'&status=pending');if(!r.ok)throw new Error(r.message||r.error||'تعذر تحميل مهمة البحث');record.value=findRelated(r.jobs,n,'id');payload.value={...r,jobSuggestions:safeArray(r.suggestions).filter(x=>String(x.job_id||'')===id)};
1588          }
1589          if(!record.value)loadError.value='تعذر العثور على السجل المرتبط. قد تكون المهمة قد اكتملت بالفعل.';
1590        }catch(e){loadError.value=e.message||'تعذر تحميل المهمة';}
1591        localBusy.value=false;
1592      }
1593      async function callAction(url,options={},closeOnSuccess=false){localBusy.value=true;const r=await api(url,options);localBusy.value=false;store.state.msg=r.message||r.error||'';if(r.ok){if(closeOnSuccess){await store.loadNotifications('open');closeWorkspace();}else await loadTask();}return r;}
1594      async function memberApprove(){const x=record.value;if(!x||!x.id)return;await callAction('/api/admin/members/'+encodeURIComponent(x.id)+'/approve',{method:'POST'},true);}
1595      async function memberRemind(){const x=record.value;if(!x||!x.id)return;await callAction('/api/admin/members/'+encodeURIComponent(x.id)+'/send-registration-reminder',{method:'POST'});}
1596      async function caseSetStatus(st){const x=record.value;if(!x||!x.id)return;await callAction('/api/admin/cases/'+encodeURIComponent(x.id)+'/status',{method:'POST',body:JSON.stringify({status:st})},st==='closed');}
1597      async function emergencySetStatus(st){const x=record.value;if(!x||!x.id)return;await callAction('/api/admin/emergencies/'+encodeURIComponent(x.id)+'/status',{method:'POST',body:JSON.stringify({status:st})},st==='closed');}
1598      async function feedbackAction(st){const x=record.value;if(!x||!x.id)return;if((st==='rejected'||st==='archived')&&!note.value.trim()){store.state.msg='اكتب ملاحظة أو سبب الإجراء أولاً';return;}await callAction('/api/admin/feedback/'+encodeURIComponent(x.id),{method:'POST',body:JSON.stringify({status:st,admin_note:note.value})},['done','rejected','archived'].includes(st));}
1599      async function guideReview(action){const x=record.value;if(!x||!x.id)return;if(action==='reject'&&!note.value.trim()){store.state.msg='سبب الرفض مطلوب';return;}const path=taskType.value==='guide_suggestion'?'suggestions':'reports';await callAction('/api/admin/china-guide/'+path+'/'+encodeURIComponent(x.id)+'/review',{method:'POST',body:JSON.stringify({action,note:note.value})},true);}
1600      async function claimProcurement(){const x=record.value;if(!x||!x.id||!admin.value||!admin.value.id)return;await callAction('/api/admin/procurement/'+encodeURIComponent(x.id)+'/assign',{method:'POST',body:JSON.stringify({admin_id:admin.value.id})},true);}
1601      async function claimOrder(){const x=record.value;if(!x||!x.procurement_request_id||!admin.value||!admin.value.id)return;await callAction('/api/admin/procurement/'+encodeURIComponent(x.procurement_request_id)+'/assign',{method:'POST',body:JSON.stringify({admin_id:admin.value.id})},String(notification.value&&notification.value.type)!=='customer_order_payment_proof');}
1602      async function startPaidOrder(){const x=record.value;if(!x||!x.procurement_request_id)return;const msg=note.value.trim()||'تمت مراجعة إثبات الدفع وبدء التنفيذ';await callAction('/api/admin/procurement/'+encodeURIComponent(x.procurement_request_id)+'/status',{method:'POST',body:JSON.stringify({status:'processing',note:msg})},true);}
1603      async function aiSaveAndCheck(){const x=record.value;if(!x||!['pending','in_review'].includes(String(x.status)))return;localBusy.value=true;
1603if(String(x.status)==='pending'){const saved=await api('/api/admin/ai-research/suggestions/'+encodeURIComponent(x.id)+'/update',{method:'POST',body:JSON.stringify(x)});if(!saved.ok){localBusy.value=false;store.state.msg=saved.message||saved.error||'';return;}}const checked=await api('/api/admin/ai-research/suggestions/'+encodeURIComponent(x.id)+'/dedup-check',{method:'POST'});localBusy.value=false;store.state.msg=checked.message||checked.error||'';await loadTask();}
1604      async function aiReview(action){
1605        const x=record.value;if(!x)return;let n=note.value.trim();
1606        if(['reject','return'].includes(action)&&!n){store.state.msg=action==='return'?'اكتب التعديل المطلوب قبل الإرجاع':'سبب الرفض مطلوب';return;}
1607        if(action==='submit'&&aiDedupStatus.value!=='clear'){store.state.msg='نفّذ فحص التكرار أولاً';return;}
1608        if(action==='approve'&&!aiApprovalReady.value){store.state.msg='أكمل تحقق المصدر والمحتوى'+(useImage.value?' والصورة':'')+' وتأكيد النشر';return;}
1609        localBusy.value=true;const r=await api('/api/admin/ai-research/suggestions/'+encodeURIComponent(x.id)+'/review',{method:'POST',body:JSON.stringify({action,note:n,source_verified:reviewChecks.source_verified===true,content_verified:reviewChecks.content_verified===true,use_suggested_image:useImage.value===true,image_verified:reviewChecks.image_verified===true,publish_confirmed:reviewChecks.publish_confirmed===true})});localBusy.value=false;store.state.msg=r.message||r.error||'';
1610        if(r.ok&&['approve','reject','return'].includes(action)){await store.loadNotifications('open');closeWorkspace();}else if(r.ok)await loadTask();
1611      }
1612      function openFull(){router.push(fullRecordPath.value||'/admin/notifications');}
1613      onMounted(async()=>{if(await store.requireAdmin(router))await loadTask();});
1614      return {store,notification,record,payload,context,categories,localBusy,loadError,note,reviewChecks,useImage,taskType,taskResolved,taskTitle,fullRecordPath,admin,aiSuggestion,aiDedupStatus,aiDirty,aiApprovalReady,canApproveMember,caseStatusName,caseTypeName,statusName,shortDate,mediaSrc,procurementStatus,orderStatus,aiRisk,aiStatus,dedupLabel,closeWorkspace,openFull,loadTask,memberApprove,memberRemind,caseSetStatus,emergencySetStatus,feedbackAction,guideReview,claimProcurement,claimOrder,startPaidOrder,aiSaveAndCheck,aiReview};
1615    },
1616    render:(function(){
1617const _Vue = Vue
1618const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
1619
1620const _hoisted_1 = { class: "taskWorkspaceShell" }
1621const _hoisted_2 = { class: "taskWorkspaceHeader" }
1622const _hoisted_3 = ["onClick"]
1623const _hoisted_4 = { key: 0 }
1624const _hoisted_5 = {
1625  key: 0,
1626  class: "statusPill"
1627}
1628const _hoisted_6 = {
1629  key: 0,
1630  class: "card taskWorkspaceLoading"
1631}
1632const _hoisted_7 = {
1633  key: 1,
1634  class: "card errorCard"
1635}
1636const _hoisted_8 = { class: "row" }
1637const _hoisted_9 = ["onClick"]
1638const _hoisted_10 = ["onClick"]
1639const _hoisted_11 = {
1640  key: 0,
1641  class: "card taskFocusCard"
1642}
1643const _hoisted_12 = { class: "taskFocusIdentity" }
1644const _hoisted_13 = ["src"]
1645const _hoisted_14 = {
1646  key: 1,
1647  class: "memberThumb memberThumbPlaceholder large"
1648}
1649const _hoisted_15 = { class: "taskFacts" }
1650const _hoisted_16 = { dir: "ltr" }
1651const _hoisted_17 = { class: "taskPrimaryActions" }
1652const _hoisted_18 = ["onClick", "disabled"]
1653const _hoisted_19 = ["onClick", "disabled"]
1654const _hoisted_20 = {
1655  key: 1,
1656  class: "card taskFocusCard"
1657}
1658const _hoisted_21 = { class: "vueBadge" }
1659const _hoisted_22 = { class: "taskLead" }
1660const _hoisted_23 = { class: "taskFacts" }
1661const _hoisted_24 = { dir: "ltr" }
1662const _hoisted_25 = {
1663  key: 0,
1664  class: "taskMediaStrip"
1665}
1666const _hoisted_26 = ["href"]
1667const _hoisted_27 = ["src"]
1668const _hoisted_28 = { class: "taskPrimaryActions" }
1669const _hoisted_29 = ["onClick", "disabled"]
1670const _hoisted_30 = ["onClick", "disabled"]
1671const _hoisted_31 = {
1672  key: 2,
1673  class: "card taskFocusCard emergencyTaskFocus"
1674}
1675const _hoisted_32 = { class: "taskLead" }
1676const _hoisted_33 = { class: "taskFacts" }
1677const _hoisted_34 = { dir: "ltr" }
1678const _hoisted_35 = {
1679  key: 0,
1680  class: "taskLocation"
1681}
1682const _hoisted_36 = {
1683  key: 1,
1684  class: "taskMediaStrip"
1685}
1686const _hoisted_37 = ["href"]
1687const _hoisted_38 = ["src"]
1688const _hoisted_39 = { class: "taskPrimaryActions" }
1689const _hoisted_40 = ["href"]
1690const _hoisted_41 = ["onClick", "disabled"]
1691const _hoisted_42 = ["onClick", "disabled"]
1692const _hoisted_43 = {
1693  key: 3,
1694  class: "card taskFocusCard"
1695}
1696const _hoisted_44 = { class: "taskLead" }
1697const _hoisted_45 = { class: "taskFacts" }
1698const _hoisted_46 = { dir: "ltr" }
1699const _hoisted_47 = ["onUpdate:modelValue"]
1700const _hoisted_48 = { class: "taskPrimaryActions" }
1701const _hoisted_49 = ["onClick", "disabled"]
1702const _hoisted_50 = ["onClick", "disabled"]
1703const _hoisted_51 = ["onClick", "disabled"]
1704const _hoisted_52 = {
1705  key: 4,
1706  class: "card taskFocusCard"
1707}
1708const _hoisted_53 = { class: "vueBadge" }
1709const _hoisted_54 = { class: "taskLead" }
1710const _hoisted_55 = { class: "taskFacts" }
1711const _hoisted_56 = { dir: "ltr" }
1712const _hoisted_57 = {
1713  key: 0,
1714  class: "hint"
1715}
1716const _hoisted_58 = ["onUpdate:modelValue"]
1717const _hoisted_59 = { class: "taskPrimaryActions" }
1718const _hoisted_60 = ["onClick", "disabled"]
1719const _hoisted_61 = ["onClick", "disabled"]
1720const _hoisted_62 = {
1721  key: 5,
1722  class: "card taskFocusCard sourcingTaskFocus"
1723}
1724const _hoisted_63 = { class: "taskLead" }
1725const _hoisted_64 = { class: "taskFacts" }
1726const _hoisted_65 = {
1727  key: 0,
1728  class: "taskDocumentList"
1729}
1730const _hoisted_66 = ["href"]
1731const _hoisted_67 = { class: "taskPrimaryActions" }
1732const _hoisted_68 = ["onClick", "disabled"]
1733const _hoisted_69 = {
1734  key: 6,
1735  class: "card taskFocusCard sourcingTaskFocus"
1736}
1737const _hoisted_70 = { class: "taskFacts" }
1738const _hoisted_71 = {
1739  key: 0,
1740  class: "taskLead"
1741}
1742const _hoisted_72 = ["onUpdate:modelValue"]
1743const _hoisted_73 = { class: "taskPrimaryActions" }
1744const _hoisted_74 = ["onClick", "disabled"]
1745const _hoisted_75 = ["onClick", "disabled"]
1746const _hoisted_76 = {
1747  key: 7,
1748  class: "card taskFocusCard aiTaskWorkspace"
1749}
1750const _hoisted_77 = { class: "aiTaskHeadline" }
1751const _hoisted_78 = {
1752  key: 0,
1753  class: "taskEditGrid"
1754}
1755const _hoisted_79 = ["onUpdate:modelValue"]
1756const _hoisted_80 = ["value"]
1757const _hoisted_81 = ["onUpdate:modelValue"]
1758const _hoisted_82 = ["onUpdate:modelValue"]
1759const _hoisted_83 = { class: "aiTaskSource" }
1760const _hoisted_84 = ["href"]
1761const _hoisted_85 = {
1762  key: 1,
1763  class: "aiTaskImage"
1764}
1765const _hoisted_86 = ["src", "alt"]
1766const _hoisted_87 = ["href"]
1767const _hoisted_88 = { class: "taskLead" }
1768const _hoisted_89 = { key: 0 }
1769const _hoisted_90 = { key: 1 }
1770const _hoisted_91 = { key: 2 }
1771const _hoisted_92 = ["onUpdate:modelValue"]
1772const _hoisted_93 = {
1773  key: 2,
1774  class: "taskPrimaryActions"
1775}
1776const _hoisted_94 = ["onClick", "disabled"]
1777const _hoisted_95 = ["onClick", "disabled"]
1778const _hoisted_96 = ["onClick", "disabled"]
1779const _hoisted_97 = {
1780  key: 3,
1781  class: "taskApprovalChecklist"
1782}
1783const _hoisted_98 = ["onClick", "disabled"]
1784const _hoisted_99 = { class: "taskCheckRow" }
1785const _hoisted_100 = ["onUpdate:modelValue"]
1786const _hoisted_101 = { class: "taskCheckRow" }
1787const _hoisted_102 = ["onUpdate:modelValue"]
1788const _hoisted_103 = {
1789  key: 1,
1790  class: "taskCheckRow"
1791}
1792const _hoisted_104 = ["onUpdate:modelValue"]
1793const _hoisted_105 = {
1794  key: 2,
1795  class: "taskCheckRow"
1796}
1797const _hoisted_106 = ["onUpdate:modelValue"]
1798const _hoisted_107 = { class: "taskCheckRow" }
1799const _hoisted_108 = ["onUpdate:modelValue"]
1800const _hoisted_109 = { class: "taskPrimaryActions" }
1801const _hoisted_110 = ["onClick", "disabled"]
1802const _hoisted_111 = ["onClick", "disabled"]
1803const _hoisted_112 = ["onClick", "disabled"]
1804const _hoisted_113 = {
1805  key: 8,
1806  class: "card taskFocusCard aiTaskWorkspace"
1807}
1808const _hoisted_114 = { class: "taskFacts" }
1809const _hoisted_115 = { class: "taskPrimaryActions" }
1810const _hoisted_116 = ["onClick"]
1811const _hoisted_117 = {
1812  key: 9,
1813  class: "card taskFocusCard"
1814}
1815const _hoisted_118 = ["onClick"]
1816const _hoisted_119 = { class: "taskWorkspaceFooter" }
1817const _hoisted_120 = ["onClick"]
1818const _hoisted_121 = ["onClick"]
1819const _hoisted_122 = { key: 0 }
1820
1821return function render(_ctx, _cache) {
1822  with (_ctx) {
1823    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, renderList: _renderList, Fragment: _Fragment, vModelText: _vModelText, withDirectives: _withDirectives, normalizeClass: _normalizeClass, vModelSelect: _vModelSelect, createTextVNode: _createTextVNode, vModelCheckbox: _vModelCheckbox, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
1824
1825    const _component_AdminFrame = _resolveComponent("AdminFrame")
1826
1827    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "مساحة المهمة" }, {
1828      default: _withCtx(() => [_createElementVNode("section", _hoisted_1, [_createElementVNode("header", _hoisted_2, [_createElementVNode("button", {
1829        class: "taskWorkspaceClose",
1830        type: "button",
1831        onClick: closeWorkspace,
1832        "aria-label": "إغلاق مساحة المهمة"
1833      }, "×", 8, _hoisted_3), _createElementVNode("div", null, [_cache[0] || (_cache[0] = _createElementVNode("span", { class: "adminEyebrow" }, "مهمة مركزة", -1)), _createElementVNode("h2", null, _toDisplayString(taskTitle), 1), notification
1834        ? (_openBlock(), _createElementBlock("p", _hoisted_4, _toDisplayString(notification.body || 'راجع السجل ونفّذ الإجراء المطلوب.'), 1))
1835        : _createCommentVNode("", true)]), notification
1836        ? (_openBlock(), _createElementBlock("span", _hoisted_5, _toDisplayString(taskResolved?'منتهية':'مفتوحة'), 1))
1837        : _createCommentVNode("", true)]), (localBusy&&!record)
1838        ? (_openBlock(), _createElementBlock("div", _hoisted_6, "جاري تحميل السجل المطلوب فقط..."))
1839        : loadError
1840          ? (_openBlock(), _createElementBlock("div", _hoisted_7, [_cache[1] || (_cache[1] = _createElementVNode("h3", null, "تعذر فتح المهمة", -1)), _createElementVNode("p", null, _toDisplayString(loadError), 1), _createElementVNode("div", _hoisted_8, [_createElementVNode("button", {
1841              class: "btn secondary",
1842              onClick: loadTask
1843            }, "إعادة المحاولة", 8, _hoisted_9), _createElementVNode("button", {
1844              class: "btn",
1845              onClick: closeWorkspace
1846            }, "العودة للصندوق", 8, _hoisted_10)])]))
1847          : record
1848            ? (_openBlock(), _createElementBlock(_Fragment, { key: 2 }, [(taskType==='member')
1849                ? (_openBlock(), _createElementBlock("section", _hoisted_11, [_createElementVNode("div", _hoisted_12, [($memberPhoto(record,'profile'))
1850                    ? (_openBlock(), _createElementBlock("img", {
1851                        key: 0,
1852                        src: $memberPhoto(record,'profile'),
1853                        alt: "صورة العضو"
1854                      }, null, 8, _hoisted_13))
1855                    : (_openBlock(), _createElementBlock("div", _hoisted_14, "👤")), _createElementVNode("div", null, [_cache[2] || (_cache[2] = _createElementVNode("span", { class: "vueBadge" }, "عضوية", -1)), _createElementVNode("h3", null, _toDisplayString(record.full_name||'عضو'), 1), _createElementVNode("p", null, _toDisplayString(record.gzc_id||'بدون رقم عضوية') + " · " + _toDisplayString($cityLabel(record.china_city)||'-') + " · " + _toDisplayString(statusName(record.status)), 1)])]), _createElementVNode("div", _hoisted_15, [_
1855createElementVNode("span", null, [_createElementVNode("b", _hoisted_16, _toDisplayString(record.whatsapp||record.china_phone||'-'), 1), _cache[3] || (_cache[3] = _createElementVNode("small", null, "التواصل", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(record.category||'-'), 1), _cache[4] || (_cache[4] = _createElementVNode("small", null, "الفئة", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(record.china_district||'-'), 1), _cache[5] || (_cache[5] = _createElementVNode("small", null, "المنطقة", -1))])]), _createElementVNode("div", _hoisted_17, [(canApproveMember(record))
1856                    ? (_openBlock(), _createElementBlock("button", {
1857                        key: 0,
1858                        class: "btn",
1859                        onClick: memberApprove,
1860                        disabled: localBusy
1861                      }, "اعتماد العضو وإنهاء المهمة", 8, _hoisted_18))
1862                    : _createCommentVNode("", true), (record.status!=='approved')
1863                    ? (_openBlock(), _createElementBlock("button", {
1864                        key: 1,
1865                        class: "btn secondary",
1866                        onClick: memberRemind,
1867                        disabled: localBusy
1868                      }, "إرسال تذكير", 8, _hoisted_19))
1869                    : _createCommentVNode("", true)])]))
1870                : (taskType==='case')
1871                  ? (_openBlock(), _createElementBlock("section", _hoisted_20, [
1872                      _createElementVNode("span", _hoisted_21, _toDisplayString(context.mode==='arrival'?'وصول':'مساعدة'), 1),
1873                      _createElementVNode("h3", null, _toDisplayString(record.case_code||record.title||'حالة'), 1),
1874                      _createElementVNode("p", _hoisted_22, _toDisplayString(record.description||'لا يوجد وصف.'), 1),
1875                      _createElementVNode("div", _hoisted_23, [
1876                        _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(record.full_name||record.contact_name||'-'), 1), _cache[6] || (_cache[6] = _createElementVNode("small", null, "الاسم", -1))]),
1877                        _createElementVNode("span", null, [_createElementVNode("b", _hoisted_24, _toDisplayString(record.whatsapp||record.contact_whatsapp||record.china_phone||'-'), 1), _cache[7] || (_cache[7] = _createElementVNode("small", null, "التواصل", -1))]),
1878                        _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString($cityLabel(record.china_city)||'-'), 1), _cache[8] || (_cache[8] = _createElementVNode("small", null, "المدينة", -1))]),
1879                        _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(caseStatusName(record.status)), 1), _cache[9] || (_cache[9] = _createElementVNode("small", null, "الحالة", -1))])
1880                      ]),
1881                      (record.media&&record.media.length)
1882                        ? (_openBlock(), _createElementBlock("div", _hoisted_25, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(record.media, (m) => {
1883                            return (_openBlock(), _createElementBlock("a", {
1884                              key: m.id,
1885                              href: m.file_url,
1886                              target: "_blank",
1887                              rel: "noopener"
1888                            }, [_createElementVNode("img", {
1889                              src: mediaSrc(m),
1890                              alt: "مرفق الحالة"
1891                            }, null, 8, _hoisted_27)], 8, _hoisted_26))
1892                          }), 128))]))
1893                        : _createCommentVNode("", true),
1894                      _createElementVNode("div", _hoisted_28, [_createElementVNode("button", {
1895                        class: "btn secondary",
1896                        onClick: $event => (caseSetStatus('in_progress')),
1897                        disabled: localBusy
1898                      }, "بدء المتابعة", 8, _hoisted_29), _createElementVNode("button", {
1899                        class: "btn danger",
1900                        onClick: $event => (caseSetStatus('closed')),
1901                        disabled: localBusy
1902                      }, "إغلاق الحالة وإنهاء المهمة", 8, _hoisted_30)])
1903                    ]))
1904                  : (taskType==='emergency')
1905                    ? (_openBlock(), _createElementBlock("section", _hoisted_31, [
1906                        _cache[14] || (_cache[14] = _createElementVNode("span", { class: "vueBadge" }, "طوارئ", -1)),
1907                        _createElementVNode("h3", null, _toDisplayString(record.ticket_code||'بلاغ طوارئ'), 1),
1908                        _createElementVNode("p", _hoisted_32, _toDisplayString(record.description||'لا يوجد وصف.'), 1),
1909                        _createElementVNode("div", _hoisted_33, [
1910                          _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(record.full_name||'عضو'), 1), _cache[10] || (_cache[10] = _createElementVNode("small", null, "العضو", -1))]),
1911                          _createElementVNode("span", null, [_createElementVNode("b", _hoisted_34, _toDisplayString(record.whatsapp||record.china_ph
1911one||'-'), 1), _cache[11] || (_cache[11] = _createElementVNode("small", null, "التواصل", -1))]),
1912                          _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(record.priority||'-'), 1), _cache[12] || (_cache[12] = _createElementVNode("small", null, "الأولوية", -1))]),
1913                          _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(caseStatusName(record.status)), 1), _cache[13] || (_cache[13] = _createElementVNode("small", null, "الحالة", -1))])
1914                        ]),
1915                        (record.location_text)
1916                          ? (_openBlock(), _createElementBlock("p", _hoisted_35, "الموقع: " + _toDisplayString(record.location_text), 1))
1917                          : _createCommentVNode("", true),
1918                        (record.media&&record.media.length)
1919                          ? (_openBlock(), _createElementBlock("div", _hoisted_36, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(record.media, (m) => {
1920                              return (_openBlock(), _createElementBlock("a", {
1921                                key: m.id,
1922                                href: m.file_url,
1923                                target: "_blank",
1924                                rel: "noopener"
1925                              }, [_createElementVNode("img", {
1926                                src: mediaSrc(m),
1927                                alt: "صورة البلاغ"
1928                              }, null, 8, _hoisted_38)], 8, _hoisted_37))
1929                            }), 128))]))
1930                          : _createCommentVNode("", true),
1931                        _createElementVNode("div", _hoisted_39, [(record.whatsapp)
1932                          ? (_openBlock(), _createElementBlock("a", {
1933                              key: 0,
1934                              class: "btn secondary",
1935                              href: 'https://wa.me/'+record.whatsapp,
1936                              target: "_blank",
1937                              rel: "noopener"
1938                            }, "واتساب", 8, _hoisted_40))
1939                          : _createCommentVNode("", true), _createElementVNode("button", {
1940                          class: "btn secondary",
1941                          onClick: $event => (emergencySetStatus('in_progress')),
1942                          disabled: localBusy
1943                        }, "قيد المتابعة", 8, _hoisted_41), _createElementVNode("button", {
1944                          class: "btn danger",
1945                          onClick: $event => (emergencySetStatus('closed')),
1946                          disabled: localBusy
1947                        }, "إغلاق البلاغ وإنهاء المهمة", 8, _hoisted_42)])
1948                      ]))
1949                    : (taskType==='feedback')
1950                      ? (_openBlock(), _createElementBlock("section", _hoisted_43, [
1951                          _cache[19] || (_cache[19] = _createElementVNode("span", { class: "vueBadge" }, "ملاحظة عضو", -1)),
1952                          _createElementVNode("h3", null, _toDisplayString(record.title||record.feedback_type||'ملاحظة'), 1),
1953                          _createElementVNode("p", _hoisted_44, _toDisplayString(record.message), 1),
1954                          _createElementVNode("div", _hoisted_45, [
1955                            _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(record.full_name||'-'), 1), _cache[15] || (_cache[15] = _createElementVNode("small", null, "العضو", -1))]),
1956                            _createElementVNode("span", null, [_createElementVNode("b", _hoisted_46, _toDisplayString(record.whatsapp||'-'), 1), _cache[16] || (_cache[16] = _createElementVNode("small", null, "واتساب", -1))]),
1957                            _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString($cityLabel(record.china_city)||'-'), 1), _cache[17] || (_cache[17] = _createElementVNode("small", null, "المدينة", -1))]),
1958                            _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(record.status||'-'), 1), _cache[18] || (_cache[18] = _createElementVNode("small", null, "الحالة", -1))])
1959                          ]),
1960                          _withDirectives(_createElementVNode("textarea", {
1961                            "onUpdate:modelValue": $event => ((note) = $event),
1962                            placeholder: "ملاحظة الإدارة / سبب القرار"
1963                          }, null, 8, _hoisted_47), [[_vModelText, note]]),
1964                          _createElementVNode("div", _hoisted_48, [_createElementVNode("button", {
1965                            class: "btn secondary",
1966                            onClick: $event => (feedbackAction('reviewing')),
1967                            disabled: localBusy
1968                          }, "قيد المراجعة", 8, _hoisted_49), _createElementVNode("button", {
1969                            class: "btn",
1970                            onClick: $event => (feedbackAction('done')),
1971                            disabled: localBusy
1972                          }, "تم التنفيذ وإنهاء المهمة", 8, _hoisted_50), _createElementVNode("button", {
1973                            class: "btn danger",
1974                            onClick: $event => (feedbackAction('rejected')),
1975                            disabled: localBusy
1976                          }, "رفض وإنهاء المهمة", 8, _hoisted_51)])
1977                        ]))
1978                      : (taskType==='guide_suggestion'||taskType==='guide_report')
1979                        ? (_openBlock(), _createElementBlock("section", _hoisted_52, [
1980                            _createElementVNode("span", _hoisted_53, _toDisplayString(taskType==='guide_suggestion'?'اقتراح دليل الصين':'بلاغ تصحيح'), 1),
1981                            _createElementVNode("h3", null, _toDisplayString(record.title||record.item_title||'مهمة محتوى'), 1),
1982                            _createElementVNode("p", _hoisted_54, _toDisplayString(record.details||record.message||'-'), 1),
1983                            _createElementVNode("div", _hoisted_55, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(record.member_name||'عضو'), 1), _cache[20] || (_cache[20] = _createElementVNode("small", null, "المرسل", -1))]), _createElementVNode("span", null, [_createElementVNode("b", _hoisted_56, _toDisplayString(record.member_phone||'-'), 1), _cache[21] || (_cache[21] = _createElementVNode("small", null, "التواصل", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(record.status||'-'), 1), _cache[22] || (_cache[22] = _createElementVNode("small", null, "الحالة", -1))])]),
1984                            (taskType==='guide_suggestion'&&record.category==='مقترح مكان — يحتاج مراجعة')
1985                              ? (_openBlock(), _createElementBlock("p", _hoisted_57, "هذا مرجع مكان من AMap، وليس صفحة جاهزة للدليل. تحقق من الفرع والعنوان، واكتب النص من مصادر موثوقة، وأضف صورة مرخصة ومرتبطة بالمكان في محرر الدليل قبل النشر."))
1986                              : _createCommentVNode("", true),
1987                            _withDirectives(_createElementVNode("textarea", {
1988                              "onUpdate:modelValue": $event => ((note) = $event),
1989                              placeholder: "ملاحظة المراجع / سبب الرفض"
1990                            }, null, 8, _hoisted_58), [[_vModelText, note]]),
1991                            _createElementVNode("div", _hoisted_59, [_createElementVNode("button", {
1992                              class: "btn",
1993                              onClick: $event => (guideReview('accept')),
1994                              disabled: localBusy
1995                            }, _toDisplayString(taskType==='guide_suggestion'&&record.category==='مقترح مكان — يحتاج مراجعة'?'قبول الفكرة فقط وإنهاء المهمة':'قبول وإنهاء المهمة'), 9, _hoisted_60), _createElementVNode("button", {
1996                              class: "btn danger",
1997                              onClick: $event => (guideReview('reject')),
1998                              disabled: localBusy
1999                            }, "رفض وإنهاء المهمة", 8, _hoisted_61)])
2000                          ]))
2001                        : (taskType==='procurement_request')
2002                          ? (_openBlock(), _createElementBlock("section", _hoisted_62, [
2003                              _cache[27] || (_cache[27] = _createElementVNode("span", { class: "vueBadge" }, "طلب توريد", -1)),
2004                              _createElementVNode("h3", null, _toDisplayString(record.request_code) + " — " + _toDisplayString(record.title), 1),
2005                              _createElementVNode("p", _hoisted_63, _toDisplayString(record.description), 1),
2006                              _createElementVNode("div", _hoisted_64, [
2007                                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(record.member_name||'-'), 1), _cache[23] || (_cache[23] = _createElementVNode("small", null, "العميل", -1))]),
2008                                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(procurementStatus(record.status)), 1), _cache[24] || (_cache[24] = _createElementVNode("small", null, "المرحلة", -1))]),
2009                                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(record.assigned_admin_name||'غير معين'), 1), _cache[25] || (_cache[25] = _createElementVNode("small", null, "المسؤول", -1))]),
2010                                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(record.service_type||'-'), 1), _cache[26] || (_cache[26] = _createElementVNode("small", null, "الخدمة", -1))])
2011                              ]),
2012                              (payload&&payload.documents&&payload.documents.length)
2013                                ? (_openBlock(), _createElementBlock("div", _hoisted_65, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(payload.documents, (d) => {
2014                                    return (_openBlock(), _createElementBlock("a", {
2015                                      key: d.id,
2016                                      href: d.file_url,
2017                                      target: "_blank",
2018                                      rel: "noopener"
2019                                    }, [_createElementVNode("b", null, _toDisplayString(d.original_name), 1), _createElementVNode("small", null, _toDisplayString(d.document_type), 1)], 8, _hoisted_66))
2020                                  }), 128))]))
2021                                : _createCommentVNode("", true),
2022                              _createElementVNode("div", _hoisted_67, [_createElementVNode("button", {
2023                                class: "btn",
2024                                onClick: claimProcurement,
2025                                disabled: localBusy
2026                              }, "استلام المهمة وإنهاء الإشعار", 8, _hoisted_68)])
2027                            ]))
2028                          : (taskType==='customer_order')
2029                            ? (_openBlock(), _createElementBlock("section", _hoisted_69, [
2030                                _cache[32] || (_cache[32] = _createElementVNode("span", { class: "vueBadge" }, "طلب عميل مؤكد", -1)),
2031                                _createElementVNode("h3", null, _toDisplayString(record.order_code) + " — " + _toDisplayString(record.title_snapshot), 1),
2032                                _createElementVNode("div", _hoisted_70, [
2033                                  _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(record.member_name||'-'), 1), _cache[28] || (_cache[28] = _createElementVNode("small", null, "العميل", -1))]),
2034                                  _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(orderStatus(record.status)), 1), _cache[29] || (_cache[29] = _createElementVNode("small", null, "حالة الطلب", -1))]),
2035                                  _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(record.payment_status||'-'), 1), _cache[30] || (_cache[30] = _createElementVNode("small", null, "الدفع", -1))]),
2036                                  _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(record.total_amount) + " " + _toDisplayString(record.currency), 1), _cache[31] || (_cache[31] = _createElementVNode("small", null, "الإجمالي", -1))])
2037                                ]),
2038                                (notification.type==='customer_order_payment_proof')
2039                                  ? (_openBlock(), _createElementBlock("p", _hoisted_71, "تم رفع إثبات دفع. راجع المستندات المرتبطة قبل بدء التنفيذ."))
2040                                  : _createCommentVNode("", true),
2041                                (notification.type==='customer_order_payment_proof')
2042                                  ? _withDirectives((_openBlock(), _createElementBlock("textarea", {
2043                                      key: 1,
2044                                      "onUpdate:modelValue": $event => ((note) = $event),
2045                                      placeholder: "ملاحظة مراجعة الدفع"
2046                                    }, null, 8, _hoisted_72)), [[_vModelText, note]])
2047                                  : _createCommentVNode("", true),
2048                                _createElementVNode("div", _hoisted_73, [(notification.type!=='customer_order_payment_proof')
2049                                  ? (_openBlock(), _createElementBlock("button", {
2050                                      key: 0,
2051                                      class: "btn",
2052                                      onClick: claimOrder,
2053                                      disabled: localBusy
2054                                    }, "استلام الطلب وإنهاء المهمة", 8, _hoisted_74))
2055                                  : (_openBlock(), _createElementBlock("button", {
2056                                      key: 1,
2057                                      class: "btn",
2058                                      onClick: startPaidOrder,
2059                                      disabled: localBusy
2060                                    }, "تأكيد الدفع وبدء التنفيذ", 8, _hoisted_75))])
2061                              ]))
2062                            : (taskType==='ai_research_suggestion')
2063                              ? (_openBlock(), _createElementBlock("section", _hoisted_76, [
2064                                  _createElementVNode("div", _hoisted_77, [_createElementVNode("div", null, [_cache[33] || (_cache[33] = _createElementVNode("span", { class: "vueBadge" }, "مراجعة AI", -1)), _createElementVNode("h3", null, "#" + _toDisplayString(record.id) + " — " + _toDisplayString(record.title_ar||'مقترح بلا عنوان'), 1), _createElementVNode("p", null, _toDisplayString(record.category_name_ar||'بدون تصنيف') + " · " + _toDisplayString(aiStatus(record.status)) + " · مخاطر " + _toDisplayString(aiRisk(record.risk_level)), 1)]), _createElementVNode("span", { class: _normalizeClass(["statusPill", {'canaryPill':aiDedupStatus==='clear','danger':aiDedupStatus==='conflict'}]) }, _toDisplayString(dedupLabel(aiDedupStatus)), 3)]),
2065                                  (record.status==='pending')
2066                                    ? (_openBlock(), _createElementBlock("div", _hoisted_78, [_withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((record.category_id) = $event) }, [_cache[34] || (_cache[34] = _createElementVNode("option", { value: "" }, "اختر التصنيف", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(categories, (c) => {
2067                                        return (_openBlock(), _createElementBlock("option", {
2068                                          key: c.id,
2069                                          value: c.id
2070                                        }, _toDisplayString(c.icon) + " " + _toDisplayString(c.name_ar), 9, _hoisted_80))
2071                                      }), 128))], 8, _hoisted_79), [[_vModelSelect, record.category_id]]), _withDirectives(_createElementVNode("input", {
2072                                        "onUpdate:modelValue": $event => ((record.title_ar) = $event),
2073                                        placeholder: "العنوان"
2074                                      }, null, 8, _hoisted_81), [[_vModelText, record.title_ar]]), _withDirectives(_createElementVNode("textarea", {
2075                                        "onUpdate:modelValue": $event => ((record.summary_ar) = $event),
2076                                        placeholder: "الملخص"
2077                                      }, null, 8, _hoisted_82), [[_vModelText, record.summary_ar]])]))
2078                                    : _createCommentVNode("", true),
2079                                  _createElementVNode("div", _hoisted_83, [_createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(record.source_name||record.source_domain||'المصدر'), 1), _createElementVNode("small", null, _toDisplayString(record.source_domain||'-'), 1)]), _createElementVNode("a", {
2080                                    href: record.source_url,
2081                                    target: "_blank",
2082                                    rel: "noopener"
2083                                  }, "فتح المصدر", 8, _hoisted_84)]),
2084                                  (record.image_status==='ready'&&record.image_url)
2085                                    ? (_openBlock(), _createElementBlock("figure", _hoisted_85, [_createElementVNode("img", {
2086                                        src: record.image_thumb_url||record.image_url,
2087                                        alt: record.title_ar
2088                                      }, null, 8, _hoisted_86), _createElementVNode("figcaption", null, [(record.image_source_url)
2089                                        ? (_openBlock(), _createElementBlock("a", {
2090                                            key: 0,
2091                                            href: record.image_source_url,
2092                                            target: "_blank",
2093                                            rel: "noopener"
2094                                          }, "فتح أصل الصورة", 8, _hoisted_87))
2095                                        : _createCommentVNode("", true)])]))
2096                                    : _createCommentVNode("", true),
2097                                  _createElementVNode("p", _hoisted_88, [_cache[35] || (_cache[35] = _createElementVNode("b", null, "خلاصة الدليل:", -1)), _createTextVNode(" " + _toDisplayString(record.evidence_summary||'لا توجد خلاصة.'), 1)]),
2098                                  _createElementVNode("section", { class: _normalizeClass(["taskDedupBox", 'state-'+aiDedupStatus]) }, [_createElementVNode("b", null, "منع التكرار: " + _toDisplayString(dedupLabel(aiDedupStatus)), 1), (record.dedup_current_match_item_title)
2099                                    ? (_openBlock(), _createElementBlock("small", _hoisted_89, "التعارض مع: " + _toDisplayString(record.dedup_current_match_item_title), 1))
2100                                    : (record.dedup_current_match_suggestion_title)
2101                                      ? (_openBlock(), _createElementBlock("small", _hoisted_90, "التعارض مع مقترح: " + _toDisplayString(record.dedup_current_match_suggestion_title), 1))
2102                                      : (_openBlock(), _createElementBlock("small", _hoisted_91, "تمت مقارنة المقترح بالمحتوى والمقترحات النشطة."))], 2),
2103                                  _withDirectives(_createElementVNode("textarea", {
2104                                    "onUpdate:modelValue": $event => ((note) = $event),
2105                                    placeholder: "ملاحظة المراجع / سبب الإرجاع أو الرفض"
2106                                  }, null, 8, _hoisted_92), [[_vModelText, note]]),
2107                                  (record.status==='pending')
2108                                    ? (_openBlock(), _createElementBlock("div", _hoisted_93, [_createElementVNode("button", {
2109                                        class: "btn secondary",
2110                                        onClick: aiSaveAndCheck,
2111                                        disabled: localBusy
2112                                      }, _toDisplayString(aiDirty?'حفظ وفحص التكرار':'فحص التكرار'), 9, _hoisted_94), _createElementVNode("button", {
2113                                        class: "btn",
2114                                        onClick: $event => (aiReview('submit')),
2115                                        disabled: localBusy||aiDedupStatus!=='clear'
2116                                      }, _toDisplayString(localBusy?'جاري الإرسال...':'إرسال للمراجعة'), 9, _hoisted_95), _createElementVNode("button", {
2117                                        class: "btn danger",
2118                                        onClick: $event => (aiReview('reject')),
2119                                        disabled: localBusy
2120                                      }, "رفض", 8, _hoisted_96)]))
2121                                    : (record.status==='in_review')
2122                                      ? (_openBlock(), _createElementBlock("section", _hoisted_97, [
2123                                          _cache[41] || (_cache[41] = _createElementVNode("h4", null, "التحقق قبل النشر", -1)),
2124                                          (aiDedupStatus!=='clear')
2125                                            ? (_openBlock(), _createElementBlock("button", {
2126                                                key: 0,
2127                                                class: "btn secondary",
2128                                                onClick: aiSaveAndCheck,
2129                                                disabled: localBusy
2130                                              }, "إعادة فحص التكرار", 8, _hoisted_98))
2131                                            : _createCommentVNode("", true),
2132                                          _createElementVNode("label", _hoisted_99, [_withDirectives(_createElementVNode("input", {
2133                                            type: "checkbox",
2134                                            "onUpdate:modelValue": $event => ((reviewChecks.source_verified) = $event)
2135                                          }, null, 8, _hoisted_100), [[_vModelCheckbox, reviewChecks.source_verified]]), _cache[36] || (_cache[36] = _createElementVNode("span", null, "فتحت المصدر وتأكدت أنه يثبت المعلومة.", -1))]),
2136                                          _createElementVNode("label", _hoisted_101, [_withDirectives(_createElementVNode("input", {
2137                                            type: "checkbox",
2138                                            "onUpdate:modelValue": $event => ((reviewChecks.content_verified) = $event)
2139                                          }, null, 8, _hoisted_102), [[_vModelCheckbox, reviewChecks.content_verified]]), _cache[37] || (_cache[37] = _createElementVNode("span", null, "راجعت العنوان والملخص والتصنيف.", -1))]),
2140                                          (record.image_status==='ready')
2141                                            ? (_openBlock(), _createElementBlock("label", _hoisted_103, [_withDirectives(_createElementVNode("input", {
2142                                                type: "checkbox",
2143                                                "onUpdate:modelValue": $event => ((useImage) = $event)
2144                                              }, null, 8, _hoisted_104), [[_vModelCheckbox, useImage]]), _cache[38] || (_cache[38] = _createElementVNode("span", null, "نشر الصورة المقترحة مع العنصر.", -1))]))
2145                                            : _createCommentVNode("", true),
2146                                          useImage
2147                                            ? (_openBlock(), _createElementBlock("label", _hoisted_105, [_withDirectives(_createElementVNode("input", {
2148                                                type: "checkbox",
2149                                                "onUpdate:modelValue": $event => ((reviewChecks.image_verified) = $event)
2150                              
2150                }, null, 8, _hoisted_106), [[_vModelCheckbox, reviewChecks.image_verified]]), _cache[39] || (_cache[39] = _createElementVNode("span", null, "راجعت الصورة ومصدرها وتأكدت من صلاحيتها.", -1))]))
2151                                            : _createCommentVNode("", true),
2152                                          _createElementVNode("label", _hoisted_107, [_withDirectives(_createElementVNode("input", {
2153                                            type: "checkbox",
2154                                            "onUpdate:modelValue": $event => ((reviewChecks.publish_confirmed) = $event)
2155                                          }, null, 8, _hoisted_108), [[_vModelCheckbox, reviewChecks.publish_confirmed]]), _cache[40] || (_cache[40] = _createElementVNode("span", null, "أفهم أن الاعتماد سينشر أو يحدّث العنصر بعد الفحص النهائي.", -1))]),
2156                                          _createElementVNode("div", _hoisted_109, [_createElementVNode("button", {
2157                                            class: "btn",
2158                                            onClick: $event => (aiReview('approve')),
2159                                            disabled: localBusy||!aiApprovalReady||aiDedupStatus!=='clear'
2160                                          }, "اعتماد ونشر وإنهاء المهمة", 8, _hoisted_110), _createElementVNode("button", {
2161                                            class: "btn secondary",
2162                                            onClick: $event => (aiReview('return')),
2163                                            disabled: localBusy
2164                                          }, "إرجاع للتصحيح", 8, _hoisted_111), _createElementVNode("button", {
2165                                            class: "btn danger",
2166                                            onClick: $event => (aiReview('reject')),
2167                                            disabled: localBusy
2168                                          }, "رفض", 8, _hoisted_112)])
2169                                        ]))
2170                                      : _createCommentVNode("", true)
2171                                ]))
2172                              : (taskType==='ai_research_job')
2173                                ? (_openBlock(), _createElementBlock("section", _hoisted_113, [
2174                                    _cache[45] || (_cache[45] = _createElementVNode("span", { class: "vueBadge" }, "مهمة بحث AI", -1)),
2175                                    _createElementVNode("h3", null, "#" + _toDisplayString(record.id) + " — " + _toDisplayString(record.query_text||'بحث لسد فجوات المحتوى'), 1),
2176                                    _createElementVNode("div", _hoisted_114, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(record.result_count||0), 1), _cache[42] || (_cache[42] = _createElementVNode("small", null, "مقترحات", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(record.source_count||0), 1), _cache[43] || (_cache[43] = _createElementVNode("small", null, "مصادر", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(record.status||'-'), 1), _cache[44] || (_cache[44] = _createElementVNode("small", null, "الحالة", -1))])]),
2177                                    _cache[46] || (_cache[46] = _createElementVNode("p", { class: "taskLead" }, "هذه المهمة قد تحتوي أكثر من مقترح، لذلك تبقى مفتوحة حتى مراجعة المقترحات المرتبطة.", -1)),
2178                                    _createElementVNode("div", _hoisted_115, [_createElementVNode("button", {
2179                                      class: "btn",
2180                                      onClick: openFull
2181                                    }, "فتح صندوق المقترحات المرتبط", 8, _hoisted_116)])
2182                                  ]))
2183                                : (_openBlock(), _createElementBlock("section", _hoisted_117, [_cache[47] || (_cache[47] = _createElementVNode("h3", null, "المهمة مرتبطة بسجل تشغيلي", -1)), _cache[48] || (_cache[48] = _createElementVNode("p", null, "هذا النوع لا يملك إجراءً مختصراً داخل مساحة المهمة بعد.", -1)), _createElementVNode("button", {
2184                                    class: "btn",
2185                                    onClick: openFull
2186                                  }, "فتح السجل الكامل", 8, _hoisted_118)])), _createElementVNode("footer", _hoisted_119, [_createElementVNode("button", {
2187                class: "smallbtn secondary",
2188                onClick: closeWorkspace
2189              }, "إغلاق", 8, _hoisted_120), _createElementVNode("button", {
2190                class: "smallbtn secondary",
2191                onClick: openFull
2192              }, "فتح السجل الكامل", 8, _hoisted_121), localBusy
2193                ? (_openBlock(), _createElementBlock("span", _hoisted_122, "جاري تنفيذ الإجراء..."))
2194                : _createCommentVNode("", true)])], 64))
2195            : _createCommentVNode("", true)])]),
2196      _: 1
2197    }))
2198  }
2199}
2200})()
2201  };
2202
2203  const NotificationsPage={
2204    components:{AdminFrame},
2205    setup(){
2206      const store=useGzcStore();const router=useRouter();const status=ref('open');const openItems=reactive({});
2207      async function load(){if(await store.requireAdmin(router)) await store.loadNotifications(status.value);}
2208      onMounted(load);
2208 watch(status,load);
2209      const notifStats=computed(()=>{
2210        const xs=safeArray(store.state.notifications);
2211        return {
2212          total:xs.length,
2213          unread:xs.filter(x=>String(x.status)==='unread').length,
2214          action:xs.filter(x=>normalizeAction(x)).length,
2215          committee:new Set(xs.map(x=>x.target_committee||x.target_role||'عام')).size
2216        };
2217      });
2218      function toggleItem(id){openItems[id]=!openItems[id];}
2219      function normalizeAction(n){let u=String((n&&n.action_url)||(n&&n.url)||'').trim();if(!u)return '';
2220        if(u.startsWith(PRIMARY_PUBLIC_ORIGIN)) u=u.replace(PRIMARY_PUBLIC_ORIGIN,'');
2221        if(u.startsWith(LEGACY_PUBLIC_ORIGIN)) u=u.replace(LEGACY_PUBLIC_ORIGIN,'');
2222        if(u.startsWith('/vue')) u=u.slice(4)||'/';
2223        if(u.startsWith('/admin/members/')) u=u.replace('/admin/members/','/admin/member/');
2224        return u.startsWith('/admin')&&!u.startsWith('//')&&!u.includes('\\')?u:'/admin/notifications';
2225      }
2226      function typeLabel(n){const v=String((n&&n.target_committee)||(n&&n.target_role)||'');return ({super_admin:'الإدارة',it_admin:'تقنية المعلومات',system_admin:'تشغيل النظام',membership:'لجنة العضوية',events:'الفعاليات',arrival:'الوصول',help:'المساعدة',emergency:'الطوارئ',guide:'المحتوى'}[v])||'إدارة المنصة';}
2227      function taskKindLabel(n){const v=String(n&&n.related_type||'');return ({member:'عضوية',case:'حالة مجتمعية',emergency:'طوارئ',feedback:'ملاحظة عضو',guide_suggestion:'اقتراح محتوى',guide_report:'بلاغ تصحيح',procurement_request:'طلب توريد',customer_order:'طلب مؤكد',ai_research_suggestion:'مراجعة مقترح AI',ai_research_job:'مهمة بحث AI'}[v])||'مهمة إدارية';}
2228      function notificationState(n){if(status.value==='history')return 'done';return String(n&&n.status||'')==='unread'?'unread':'open';}
2229      function notificationStateMark(n){return ({done:'✓',unread:'●',open:'↗'}[notificationState(n)])||'↗';}
2230      function notificationStateLabel(n){return ({done:'مهمة منتهية',unread:'مهمة جديدة غير مقروءة',open:'مهمة مفتوحة'}[notificationState(n)])||'مهمة مفتوحة';}
2231      async function openAction(n){
2232        const u=normalizeAction(n);if(!u||!n||!n.id)return;
2233        await router.push('/admin/task/'+encodeURIComponent(n.id));
2234      }
2235      return {store,status,openItems,notifStats,toggleItem,typeLabel,taskKindLabel,notificationState,notificationStateMark,notificationStateLabel,load,openAction,normalizeAction,shortDate};
2236    },
2237    render:(function(){
2238const _Vue = Vue
2239const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
2240
2241const _hoisted_1 = { class: "miniStats notifStats" }
2242const _hoisted_2 = { class: "segmented" }
2243const _hoisted_3 = ["onClick"]
2244const _hoisted_4 = ["onClick"]
2245const _hoisted_5 = {
2246  key: 0,
2247  class: "card emptyCard"
2248}
2249const _hoisted_6 = {
2250  key: 1,
2251  class: "notificationList notificationListCompact"
2252}
2253const _hoisted_7 = ["onClick", "onKeyup"]
2254const _hoisted_8 = ["aria-label"]
2255const _hoisted_9 = { class: "notificationTaskCopy" }
2256const _hoisted_10 = { class: "statusPill" }
2257const _hoisted_11 = {
2258  key: 0,
2259  class: "notificationTaskArrow"
2260}
2261const _hoisted_12 = {
2262  key: 1,
2263  class: "notificationTaskArrow"
2264}
2265const _hoisted_13 = {
2266  key: 2,
2267  class: "notificationTaskDetails"
2268}
2269
2270return function render(_ctx, _cache) {
2271  with (_ctx) {
2272    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, normalizeClass: _normalizeClass, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, renderList: _renderList, Fragment: _Fragment, withKeys: _withKeys, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
2273
2274    const _component_AdminFrame = _resolveComponent("AdminFrame")
2275
2276    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "المهام والإشعارات" }, {
2277      default: _withCtx(() => [
2278        _cache[3] || (_cache[3] = _createElementVNode("div", { class: "card noticeCard compactNotice" }, [_createElementVNode("span", { class: "vueBadge" }, "إدارة المنصة"), _createElementVNode("h3", null, "صندوق المهام الإدارية"), _createElementVNode("p", null, "كل عنصر هنا مهمة فعلية. افتحها لتنفيذ الإجراء على السجل المطلوب فقط؛ وتُغلق تلقائياً عند اكتمال الإجراء.")], -1)),
2279        _createElementVNode("div", _hoisted_1, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(notifStats.total), 1), _cache[0] || (_cache[0] = _createElementVNode("small", null, "الإجمالي", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(notifStats.unread), 1), _cache[1] || (_cache[1] = _createElementVNode("small", null, "غير مقروء", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(notifStats.action), 1), _cache[2] || (_cache[2] = _createElementVNode("small", null, "لها إجراء", -1))])]),
2280        _createElementVNode("div", _hoisted_2, [_createElementVNode("button", {
2281          class: _normalizeClass({active:status==='open'}),
2282          onClick: $event => (status='open')
2283        }, "المفتوحة", 10, _hoisted_3), _createElementVNode("button", {
2284          class: _normalizeClass({active:status==='history'}),
2285          onClick: $event => (status='history')
2286        }, "السجل", 10, _hoisted_4)]),
2287        (!store.state.notifications.length && !store.state.busy)
2288          ? (_openBlock(), _createElementBlock("div", _hoisted_5, "لا توجد إشعارات حالياً."))
2289          : (_openBlock(), _createElementBlock("div", _hoisted_6, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(store.state.notifications, (n) => {
2290              return (_openBlock(), _createElementBlock("article", {
2291                class: _normalizeClass(["card notificationTaskRow", {unread:n.status==='unread',actionable:!!normalizeAction(n),open:openItems[n.id]}]),
2292                key: n.id,
2293                onClick: $event => (normalizeAction(n)?openAction(n):toggleItem(n.id)),
2294                onKeyup: _withKeys($event => (normalizeAction(n)?openAction(n):toggleItem(n.id)), ["enter"]),
2295                tabindex: "0"
2296              }, [
2297                _createElementVNode("span", {
2298                  class: _normalizeClass(["notificationTaskIcon", 'state-'+notificationState(n)]),
2299                  "aria-label": notificationStateLabel(n),
2300                  role: "img"
2301                }, _toDisplayString(notificationStateMark(n)), 11, _hoisted_8),
2302                _createElementVNode("div", _hoisted_9, [_createElementVNode("div", null, [_createElementVNode("h3", null, _toDisplayString(n.title || n.type || 'إشعار'), 1), _createElementVNode("span", _hoisted_10, _toDisplayString(typeLabel(n)), 1)]), _createElementVNode("p", null, _toDisplayString(n.body || n.message || 'اضغط لفتح المهمة المرتبطة.'), 1), _createElementVNode("small", null, _toDisplayString(shortDate(n.created_at)) + " · " + _toDisplayString(taskKindLabel(n)), 1)]),
2303                (normalizeAction(n))
2304                  ? (_openBlock(), _createElementBlock("span", _hoisted_11, "فتح المهمة ←"))
2305                  : (_openBlock(), _createElementBlock("span", _hoisted_12, _toDisplayString(openItems[n.id]?'إخفاء':'تفاصيل'), 1)),
2306                (openItems[n.id]&&!normalizeAction(n))
2307                  ? (_openBlock(), _createElementBlock("div", _hoisted_13, [_createElementVNode("span", null, _toDisplayString(n.target_committee || n.target_role || 'عام'), 1), _createElementVNode("span", null, _toDisplayString(n.related_type || '-'), 1)]))
2308                  : _createCommentVNode("", true)
2309              ], 42, _hoisted_7))
2310            }), 128))]))
2311      ]),
2312      _: 1,
2313      __: [3]
2314    }))
2315  }
2316}
2317})()
2318  };
2319
2320  const RegisterPage={
2321    components:{AdminFrame},
2322    setup(){
2323      const store=useGzcStore(); const router=useRouter();
2324      const pre=reactive({target_type:'member',role:'membership',name:'',whatsapp:'',china_ph
2324one:'',china_city:'Guangzhou',china_district:'',community_id:'',committees:['membership']});
2325      onMounted(async()=>{if(await store.requireAdmin(router)){await store.loadAdminOverview(router);await store.loadCommunities(router);}});
2326      function toggleCommittee(k){const i=pre.committees.indexOf(k); if(i>=0)pre.committees.splice(i,1); else pre.committees.push(k);}
2327      async function submit(){store.state.busy=true;store.state.msg='جاري إضافة الرقم...';const payload=Object.assign({},pre,{whatsapp:norm(pre.whatsapp),china_phone:norm(pre.china_phone||pre.whatsapp)});const r=await api('/api/admin/pre-register',{method:'POST',body:JSON.stringify(payload)});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok){pre.target_type='member';pre.role='membership';pre.name='';pre.whatsapp='';pre.china_phone='';pre.china_city='Guangzhou';pre.china_district='';pre.community_id='';pre.committees=['membership'];}}
2328      return {store,pre,toggleCommittee,submit};
2329    },
2330    render:(function(){
2331const _Vue = Vue
2332const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
2333
2334const _hoisted_1 = { class: "card" }
2335const _hoisted_2 = { class: "typeGrid" }
2336const _hoisted_3 = ["onClick"]
2337const _hoisted_4 = ["onClick"]
2338const _hoisted_5 = ["onClick"]
2339const _hoisted_6 = ["onUpdate:modelValue"]
2340const _hoisted_7 = ["onUpdate:modelValue"]
2341const _hoisted_8 = ["onUpdate:modelValue"]
2342const _hoisted_9 = ["onUpdate:modelValue"]
2343const _hoisted_10 = ["value"]
2344const _hoisted_11 = { class: "formTwo" }
2345const _hoisted_12 = ["onUpdate:modelValue"]
2346const _hoisted_13 = ["value"]
2347const _hoisted_14 = ["onUpdate:modelValue"]
2348const _hoisted_15 = ["value"]
2349const _hoisted_16 = {
2350  key: 0,
2351  class: "checkgrid"
2352}
2353const _hoisted_17 = ["checked", "onChange"]
2354const _hoisted_18 = ["onClick"]
2355
2356return function render(_ctx, _cache) {
2357  with (_ctx) {
2358    const { createElementVNode: _createElementVNode, normalizeClass: _normalizeClass, vModelText: _vModelText, withDirectives: _withDirectives, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, toDisplayString: _toDisplayString, vModelSelect: _vModelSelect, createTextVNode: _createTextVNode, createCommentVNode: _createCommentVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
2359
2360    const _component_AdminFrame = _resolveComponent("AdminFrame")
2361
2362    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "إضافة عضو أو مشرف" }, {
2363      default: _withCtx(() => [_createElementVNode("div", _hoisted_1, [
2364        _cache[4] || (_cache[4] = _createElementVNode("h3", null, "+ تسجيل رقم جديد", -1)),
2365        _cache[5] || (_cache[5] = _createElementVNode("p", { class: "hint" }, "النموذج ظاهر مباشرة لتسهيل الاستخدام من الهاتف.", -1)),
2366        _createElementVNode("div", _hoisted_2, [_createElementVNode("button", {
2367          class: _normalizeClass(["typeCard", {active:pre.target_type==='member'}]),
2368          onClick: $event => (pre.target_type='member')
2369        }, _cache[0] || (_cache[0] = [_createElementVNode("b", null, "عضو", -1), _createElementVNode("span", null, "يكمل بياناته بعد التحقق", -1)]), 10, _hoisted_3), _createElementVNode("button", {
2370          class: _normalizeClass(["typeCard", {active:pre.target_type==='supervisor'}]),
2371          onClick: $event => (pre.target_type='supervisor')
2372        }, _cache[1] || (_cache[1] = [_createElementVNode("b", null, "مشرف", -1), _createElementVNode("span", null, "صلاحيات حسب اللجنة", -1)]), 10, _hoisted_4), _createElementVNode("button", {
2373          class: _normalizeClass(["typeCard", {active:pre.target_type==='admin'}]),
2374          onClick: $event => (pre.target_type='admin')
2375        }, _cache[2] || (_cache[2] = [_createElementVNode("b", null, "مدير النظام", -1), _createElementVNode("span", null, "صلاحية كاملة", -1)]), 10, _hoisted_5)]),
2376        _withDirectives(_createElementVNode("input", {
2377          "onUpdate:modelValue": $event => ((pre.name) = $event),
2378          placeholder: "الاسم اختياري"
2379        }, null, 8, _hoisted_6), [[_vModelText, pre.name]]),
2380        _withDirectives(_createElementVNode("input", {
2381          class: "ltr",
2382          "onUpdate:modelValue": $event => ((pre.whatsapp) = $event),
2383          placeholder: "رقم واتساب مثال 8613922430742"
2384        }, null, 8, _hoisted_7), [[_vModelText, pre.whatsapp]]),
2385        _withDirectives(_createElementVNode("input", {
2386          class: "ltr",
2387          "onUpdate:modelValue": $event =>
2387 ((pre.china_phone) = $event),
2388          placeholder: "رقم الهاتف في الصين إن وجد"
2389        }, null, 8, _hoisted_8), [[_vModelText, pre.china_phone]]),
2390        _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((pre.community_id) = $event) }, [_cache[3] || (_cache[3] = _createElementVNode("option", { value: "" }, "تحديد تلقائي حسب المدينة", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(store.state.communities.filter(x=>x.slug!=='all-china'), (c) => {
2391          return (_openBlock(), _createElementBlock("option", {
2392            key: c.id,
2393            value: c.id
2394          }, _toDisplayString(c.name_ar), 9, _hoisted_10))
2395        }), 128))], 8, _hoisted_9), [[_vModelSelect, pre.community_id]]),
2396        _createElementVNode("div", _hoisted_11, [_withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((pre.china_city) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList($cityList(pre.china_city), (o) => {
2397          return (_openBlock(), _createElementBlock("option", {
2398            key: o.value,
2399            value: o.value
2400          }, _toDisplayString(o.label), 9, _hoisted_13))
2401        }), 128))], 8, _hoisted_12), [[_vModelSelect, pre.china_city]]), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((pre.china_district) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList($districtList(pre.china_city,pre.china_district), (o) => {
2402          return (_openBlock(), _createElementBlock("option", {
2403            key: o.value,
2404            value: o.value
2405          }, _toDisplayString(o.label), 9, _hoisted_15))
2406        }), 128))], 8, _hoisted_14), [[_vModelSelect, pre.china_district]])]),
2407        (pre.target_type==='supervisor')
2408          ? (_openBlock(), _createElementBlock("div", _hoisted_16, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(store.state.committees, (c) => {
2409              return (_openBlock(), _createElementBlock("label", {
2410                class: "check",
2411                key: c.key
2412              }, [_createElementVNode("input", {
2413                type: "checkbox",
2414                checked: pre.committees.includes(c.key),
2415                onChange: $event => (toggleCommittee(c.key))
2416              }, null, 40, _hoisted_17), _createTextVNode(" " + _toDisplayString(c.name_ar || c.key), 1)]))
2417            }), 128))]))
2418          : _createCommentVNode("", true),
2419        _cache[6] || (_cache[6] = _createElementVNode("p", { class: "hint" }, "اكتب الرقم بأي صيغة، وسيتم تصحيحه تلقائياً.", -1)),
2420        _createElementVNode("button", {
2421          class: "btn loadMore",
2422          onClick: submit
2423        }, "إضافة الرقم", 8, _hoisted_18)
2424      ])]),
2425      _: 1
2426    }))
2427  }
2428}
2429})()
2430  };
2431
2432  const MembersPage={
2433    components:{AdminFrame},
2434    setup(){
2435      const store=useGzcStore(); const router=useRouter();
2436      onMounted(async()=>{if(await store.requireAdmin(router)){await store.loadCommunities(router);await store.loadMembers(false,router);}});
2437      watch(()=>store.state.filters.status,()=>store.loadMembers(false,router));
2438      function search(){store.loadMembers(false,router);}
2439      function more(){store.loadMoreMembers(router);}
2440      const visibleTotal=computed(()=>store.state.members.length);
2441      async function remindAll(){if(!confirm('إرسال تذكير إكمال التسجيل لكل الحسابات غير المكتملة؟'))return;store.state.busy=true;store.state.msg='جاري إرسال التذكيرات...';const r=await api('/api/admin/members/registration-reminders/send-all',{method:'POST',body:JSON.stringify({force:true})});store.state.busy=false;store.state.msg=(r.message||r.error||'')+' — queued: '+(r.queued||0)+' / recipients: '+(r.recipients||0);}
2442      function openMember(m){if(m&&m.id)router.push('/admin/member/'+encodeURIComponent(m.id));}
2443      return {store,search,more,remindAll,openMember,statusName,memberType,visibleTotal,adminRecordUpdatedAt,adminQueueOwner,memberQueueNextAction};
2444    },
2445    render:(function(){
2446const _Vue = Vue
2447const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
2448
2449const _hoisted_1 = { class: "adminQueueIntro" }
2450const _hoisted_2 = ["onClick"]
2451const _hoisted_3 = { class: "memberSearchPanel adminListFilters" }
2452const _hoisted_4 = { class: "memberSearchHead" }
2453const _hoisted_5 = ["onClick"]
2454const _hoisted_6 = { class: "filterGrid" }
2455const _hoisted_7 = ["onUpdate:modelValue", "onKeyup"]
2456const _hoisted_8 = ["onUpdate:modelValue"]
2457const _hoisted_9 = ["value"]
2458const _hoisted_10 = ["onUpdate:modelValue", "onChange"]
2459const _hoisted_11 = ["value"]
2460const _hoisted_12 = ["onUpdate:modelValue", "onChange"]
2461const _hoisted_13 = ["value"]
2462const _hoisted_14 = ["onUpdate:modelValue", "onChange"]
2463const _hoisted_15 = ["value"]
2464const _hoisted_16 = ["onUpdate:modelValue", "onChange"]
2465const _hoisted_17 = ["value"]
2466const _hoisted_18 = ["onUpdate:modelValue", "onChange"]
2467const _hoisted_19 = ["value"]
2468const _hoisted_20 = ["onClick"]
2469const _hoisted_21 = { class: "adminQueueList memberQueueList" }
2470const _hoisted_22 = ["onClick", "onKeyup"]
2471const _hoisted_23 = { class: "adminQueueIdentity" }
2472const _hoisted_24 = ["src"]
2473const _hoisted_25 = {
2474  key: 1,
2475  class: "memberThumb memberThumbPlaceholder"
2476}
2477const _hoisted_26 = { class: "adminQueueFacts adminWorkflowFacts" }
2478const _hoisted_27 = { class: "adminQueueNextAction" }
2479const _hoisted_28 = ["onClick"]
2480const _hoisted_29 = ["onClick"]
2481const _hoisted_30 = {
2482  key: 1,
2483  class: "card adminQueueState adminQueueLoading"
2484}
2485const _hoisted_31 = {
2486  key: 2,
2487  class: "card emptyCard adminQueueState"
2488}
2489
2490return function render(_ctx, _cache) {
2491  with (_ctx) {
2492    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, vModelText: _vModelText, withKeys: _withKeys, withDirectives: _withDirectives, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, vModelSelect: _vModelSelect, createCommentVNode: _createCommentVNode, withModifiers: _withModifiers, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
2493
2494    const _component_AdminFrame = _resolveComponent("AdminFrame")
2495
2496    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "الأعضاء وطلبات العضوية" }, {
2497      default: _withCtx(() => [
2498        _createElementVNode("section", _hoisted_1, [_cache[0] || (_cache[0] = _createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "قائمة العمل"), _createElementVNode("h2", null, "العضويات"), _createElementVNode("p", null, "القائمة للفرز والوصول فقط. الاعتماد والتعديل والتعليق تتم داخل ملف العضو حتى يبقى سياق القرار واضحاً.")], -1)), _createElementVNode("button", {
2499          class: "btn primaryInlineAction",
2500          onClick: $event => ($router.push('/admin/register'))
2501        }, "+ إضافة عضو أو مشرف", 8, _hoisted_2)]),
2502        _createElementVNode("div", _hoisted_3, [_createElementVNode("div", _hoisted_4, [_createElementVNode("div", null, [_cache[1] || (_cache[1] = _createElementVNode("b", null, "النتائج", -1)), _createElementVNode("span", null, _toDisplayString(visibleTotal) + " / " + _toDisplayString(store.state.memberTotal || 0), 1)]), _createElementVNode("button", {
2503          class: "smallbtn secondary",
2504          onClick: remindAll
2505        }, "تذكير غير المكتملين", 8, _hoisted_5)]), _createElementVNode("div", _hoisted_6, [
2506          _withDirectives(_createElementVNode("input", {
2507            "onUpdate:modelValue": $event => ((store.state.filters.search) = $event),
2508            onKeyup: _withKeys(search, ["enter"]),
2509            placeholder: "بحث بالاسم أو الرقم"
2510          }, null, 40, _hoisted_7), [[_vModelText, store.state.filters.search]]),
2511          _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((store.state.filters.status) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList($optionList('member_status',store.state.filters.status), (o) => {
2512            return (_openBlock(), _createElementBlock("option", {
2513              key: o.value,
2514              value: o.value
2515            }, _toDisplayString(o.label), 9, _hoisted_9))
2516          }), 128))], 8, _hoisted_8), [[_vModelSelect, store.state.filters.status]]),
2517          _withDirectives(_createElementVNode("select", {
2518            "onUpdate:modelValue": $event => ((store.state.filters.country_code) = $event),
2519            onChange: search
2520          }, [_cache[2] || (_cache[2] = _createElementVNode("option", { value: "all" }, "كل الدول", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList($countryList(store.state.filters.country_code), (c) => {
2521            return (_openBlock(), _createElementBlock("option", {
2522              key: c.value,
2523              value: c.value
2524            }, _toDisplayString(c.label), 9, _hoisted_11))
2525          }), 128))], 40, _hoisted_10), [[_vModelSelect, store.state.filters.country_code]]),
2526          _withDirectives(_createElementVNode("select", {
2527            "onUpdate:modelValue": $event => ((store.state.filters.community_id) = $event),
2528            onChange: search
2529          }, [_cache[3] || (_cache[3] = _createElementVNode("option", { value: "all" }, "كل الجاليات", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(store.state.communities, (c) => {
2530            return (_openBlock(), _createElementBlock("option", {
2531              key: c.id,
2532              value: c.id
2533            }, _toDisplayString(c.name_ar), 9, _hoisted_13))
2534          }), 128))], 40, _hoisted_12), [[_vModelSelect, store.state.filters.community_id]]),
2535          _withDirectives(_createElementVNode("select", {
2536            "onUpdate:modelValue": $event => ((store.state.filters.city) = $event),
2537            onChange: $event => {store.state.filters.district='all';search()}
2538          }, [_cache[4] || (_cache[4] = _createElementVNode("option", { value: "all" }, "كل المدن", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList($cityList(store.state.filters.city), (c) => {
2539            return (_openBlock(), _createElementBlock("option", {
2540              key: c.value,
2541              value: c.value
2542            }, _toDisplayString(c.label), 9, _hoisted_15))
2543          }), 128))], 40, _hoisted_14), [[_vModelSelect, store.state.filters.city]]),
2544          _withDirectives(_createElementVNode("select", {
2545            "onUpdate:modelValue": $event => ((store.state.filters.district) = $event),
2546            onChange: search
2547          }, [_cache[5] || (_cache[5] = _createElementVNode("option", { value: "all" }, "كل الأحياء", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList($districtList(store.state.filters.city==='all'?'':store.state.filters.city,store.state.filters.district), (d) => {
2548            return (_openBlock(), _createElementBlock("option", {
2549              key: d.value,
2550              value: d.value
2551            }, _toDisplayString(d.label), 9, _hoisted_17))
2552          }), 128))], 40, _hoisted_16), [[_vModelSelect, store.state.filters.district]]),
2553          _withDirectives(_createElementVNode("select", {
2554            "onUpdate:modelValue": $event => ((store.state.filters.category) = $event),
2555            onChange: search
2556          }, [_cache[6] || (_cache[6] = _createElementVNode("option", { value: "all" }, "كل الفئات", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList($optionList('member_category',store.state.filters.category), (o) => {
2557            return (_openBlock(), _createElementBlock("option", {
2558              key: o.value,
2559              value: o.value
2560            }, _toDisplayString(o.label), 9, _hoisted_19))
2561          }), 128))], 40, _hoisted_18), [[_vModelSelect, store.state.filters.category]]),
2562          _createElementVNode("button", {
2563            class: "btn secondary",
2564            onClick: search
2565          }, "تطبيق الفلاتر", 8, _hoisted_20)
2566        ])]),
2567        _createElementVNode("div", _hoisted_21, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(store.state.members, (m) => {
2568          return (_openBlock(), _createElementBlock("article", {
2569            class: "adminQueueRow memberQueueRow",
2570            key: m.id,
2571            onClick: $event => (openMember(m)),
2572            tabindex: "0",
2573            onKeyup: _withKeys($event => (openMember(m)), ["enter"])
2574          }, [_createElementVNode("div", _hoisted_23, [($memberPhoto(m,'thumb'))
2575            ? (_openBlock(), _createElementBlock("img", {
2576                key: 0,
2577                class: "memberThumb",
2578                src: $memberPhoto(m,'thumb'),
2579                loading: "lazy",
2580                alt: "صورة العضو"
2581              }, null, 8, _hoisted_24))
2582            : (_openBlock(), _createElementBlock("div", _hoisted_25, "👤")), _createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(m.full_name || m.whatsapp || m.china_ph
2582one || 'عضو'), 1), _createElementVNode("small", null, _toDisplayString(m.country_name_ar || m.country_code || 'الدولة غير محددة') + " · " + _toDisplayString($cityLabel(m.china_city) || '-'), 1)])]), _createElementVNode("div", _hoisted_26, [
2583            _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(statusName(m.status)), 1), _cache[7] || (_cache[7] = _createElementVNode("small", null, "الحالة", -1))]),
2584            _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(adminQueueOwner('members',m)), 1), _cache[8] || (_cache[8] = _createElementVNode("small", null, "المسؤول", -1))]),
2585            _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(adminRecordUpdatedAt(m)), 1), _cache[9] || (_cache[9] = _createElementVNode("small", null, "آخر تحديث", -1))]),
2586            _createElementVNode("span", _hoisted_27, [_createElementVNode("b", null, _toDisplayString(memberQueueNextAction(m)), 1), _cache[10] || (_cache[10] = _createElementVNode("small", null, "الإجراء التالي", -1))])
2587          ]), _createElementVNode("button", {
2588            class: "smallbtn secondary adminQueueOpen",
2589            onClick: _withModifiers($event => (openMember(m)), ["stop"])
2590          }, "فتح ملف العضو", 8, _hoisted_28)], 40, _hoisted_22))
2591        }), 128))]),
2592        (store.state.memberHasMore)
2593          ? (_openBlock(), _createElementBlock("button", {
2594              key: 0,
2595              class: "btn loadMore",
2596              onClick: more
2597            }, "تحميل المزيد", 8, _hoisted_29))
2598          : _createCommentVNode("", true),
2599        (store.state.busy && !store.state.members.length)
2600          ? (_openBlock(), _createElementBlock("div", _hoisted_30, "جاري تحميل العضويات..."))
2601          : (!store.state.members.length)
2602            ? (_openBlock(), _createElementBlock("div", _hoisted_31, "لا توجد عضويات مطابقة."))
2603            : _createCommentVNode("", true)
2604      ]),
2605      _: 1
2606    }))
2607  }
2608}
2609})()
2610  };
2611
2612  const MemberDetailPage={
2613    components:{AdminFrame},
2614    setup(){
2615      const store=useGzcStore();const router=useRouter();const route=useRoute();
2616      const editOpen=ref(false);const photoFile=ref(null);const photoName=ref('لم يتم اختيار صورة');const photo=ref('');const statusTarget=ref('');const deletePreview=ref(null);const memberPhotoFailed=ref(false);
2617      const edit=reactive({full_name:'',gender:'',whatsapp:'',china_phone:'',wechat:'',category:'',country_code:'',china_city:'',china_district:'',sudan_city:'',profession:'',workplace:'',university:'',family_count:0});
2618      const m=computed(()=>store.state.selectedMember&&store.state.selectedMember.member?store.state.selectedMember.member:null);
2619      const cases=computed(()=>safeArray(store.state.selectedMember&&store.state.selectedMember.cases));
2620      const emergencies=computed(()=>safeArray(store.state.selectedMember&&store.state.selectedMember.emergencies));
2621      const audit=computed(()=>safeArray(store.state.selectedMember&&store.state.selectedMember.audit));
2622      const cardUrl=computed(()=>canShowMemberCard(m.value)?('/api/admin/members/'+m.value.id+'/card?v='+(Date.now())):'#');
2623      const canPermanentDelete=computed(()=>String(store.state.me&&store.state.me.admin&&store.state.me.admin.role||'')==='super_admin');
2624      function isPlaceholderMemberName(x){x=x||{};const name=String(x.full_name||'').trim();if(!name)return true;const digits=norm(name);return !!digits && (digits===norm(x.whatsapp||'') || digits===norm(x.china_phone||'') || /^\+?\d{7,}$/.test(name.replace(/\s+/g,'')));}
2625      function memberDisplayName(x){return isPlaceholderMemberName(x)?'عضو بانتظار إكمال البيانات':String((x&&x.full_name)||'عضو').trim();}
2626      function memberFieldName(x){return isPlaceholderMemberName(x)?'لم يكتمل بعد':String((x&&x.full_name)||'').trim();}
2627      function fillEdit(){const x=m.value||{};['gender','whatsapp','china_phone','wechat','category','country_code','china_city','china_district','sudan_city','profession','workplace','university'].forEach(k=>edit[k]=x[k]||'');edit.full_name=isPlaceholderMemberName(x)?'':(x.full_name||'');
2627edit.family_count=x.family_count||1;statusTarget.value=x.status||'pending';}
2628      async function refresh(){await store.loadMember(route.params.id,router);memberPhotoFailed.value=false;fillEdit();}
2629      watch(()=>m.value&&memberPhoto(m.value,'profile'),()=>{memberPhotoFailed.value=false;});
2630      onMounted(async()=>{if(await store.requireAdmin(router)) await refresh();});
2631      async function approve(){if(!m.value)return;store.state.msg='جاري اعتماد العضو...';const r=await runBusyAction(store,'member-detail.approve',()=>api('/api/admin/members/'+encodeURIComponent(m.value.id)+'/approve',{method:'POST'}));store.state.msg=r.message||r.error||'';await refresh();}
2632      async function remind(){if(!m.value)return;store.state.msg='جاري إرسال تذكير التسجيل...';const r=await runBusyAction(store,'member-detail.remind',()=>api('/api/admin/members/'+encodeURIComponent(m.value.id)+'/send-registration-reminder',{method:'POST'}));store.state.msg=r.message||r.error||'';}
2633      async function saveProfile(){if(!m.value)return;store.state.msg='جاري حفظ بيانات العضو...';const payload=Object.assign({},edit,{whatsapp:norm(edit.whatsapp),china_phone:norm(edit.china_phone),family_count:Math.max(1,Number(edit.family_count||1))});const r=await runBusyAction(store,'member-detail.save-profile',()=>api('/api/admin/members/'+encodeURIComponent(m.value.id)+'/update-profile',{method:'POST',body:JSON.stringify(payload)}));store.state.msg=r.message||r.error||'';if(r.ok){editOpen.value=false;await refresh();}}
2634      async function changeStatus(){if(!m.value||!statusTarget.value)return;if(statusTarget.value==='approved'){await approve();return;}if(statusTarget.value==='suspended'){await suspend();return;}store.state.msg='جاري تحديث الحالة...';const r=await runBusyAction(store,'member-detail.change-status',()=>api('/api/admin/members/'+encodeURIComponent(m.value.id)+'/status',{method:'POST',body:JSON.stringify({status:statusTarget.value})}));store.state.msg=r.message||r.error||'';await refresh();}
2635      async function suspend(){if(!m.value)return;const reason=prompt('سبب تعليق العضوية:','تعليق بواسطة لجنة العضوية');if(reason===null)return;store.state.msg='جاري تعليق العضوية وإنهاء جلساتها...';const r=await runBusyAction(store,'member-detail.suspend',()=>api('/api/admin/members/'+encodeURIComponent(m.value.id)+'/suspend',{method:'POST',body:JSON.stringify({reason})}));store.state.msg=r.message||r.error||'';await refresh();}
2636      async function archiveMember(){if(!m.value)return;if(!confirm('تأكيد أرشفة العضو؟'))return;const r=await runBusyAction(store,'member-detail.archive',()=>api('/api/admin/members/'+encodeURIComponent(m.value.id)+'/archive',{method:'POST'}));store.state.msg=r.message||r.error||'';if(r.ok)router.replace('/admin/members');}
2637      async function permanentDelete(){
2638        if(!m.value||!canPermanentDelete.value)return;
2639        store.state.msg='جاري فحص السجلات المرتبطة قبل الحذف...';
2640        const preview=await runBusyAction(store,'member-detail.deletion-preview',()=>api('/api/admin/members/'+encodeURIComponent(m.value.id)+'/deletion-preview'));
2641        if(!preview.ok){store.state.msg=preview.message||preview.error||'تعذر فحص الحذف';return;}
2642        deletePreview.value=preview;
2643        const retained=Number(preview.policy&&preview.policy.retained_records||0);
2644        const linked=preview.counts||{};
2645        const summary='هذا حذف نهائي وغير قابل للتراجع.\n\nسيتم حذف بيانات الدخول والهوية والصور وإيقاف أي إشراف مرتبط.\n'+(retained?'سيتم الاحتفاظ بـ '+retained+' سجل تشغيلي/تاريخي مرتبط بعد إزالة هوية المستخدم.\n':'لا توجد سجلات تشغيلية رئيسية مرتبطة.\n')+(Number(linked.inflight_messages||0)?'تنبيه: توجد رسالة واتساب قيد الإرسال.\n':'')+'\nهل تريد المتابعة؟';
2646        if(!confirm(summary))return;
2647        const token=prompt('للتأكيد اكتب الرمز التالي كما هو:\n'+preview.confirmation_token,'');
2648        if(token===null)return;
2649        if(String(token).trim()!==String(preview.confirmation_token||'')){store.state.msg='رمز التأكيد غير مطابق. لم يتم حذف أي شيء.';return;}
2650        store.state.msg='جاري تنفيذ الحذف النهائي بأمان...';
2651        const r=await runBusyAction(store,'member-detail.permanent-delete',()=>api('/api/admin/members/'+encodeURIComponent(m.value.id)+'/permanent-delete',{method:'POST',body:JSON.stringify({confirmation:token})}));store.state.msg=r.message||r.error||'';
2652        if(r.ok)router.replace('/admin/members');
2653      }
2654      function onAdminPhoto(e){photoFile.value=e.target.files&&e.target.files[0]?e.target.files[0]:null;photoName.value=photoFile.value?photoFile.value.name:'لم يتم اختيار صورة';photo.value=photoFile.value?URL.createObjectURL(photoFile.value):'';}
2655      async function uploadAdminPhoto(){if(!m.value)return;if(!photoFile.value){store.state.msg='اختر صورة أولاً';return;}const fd=new FormData();fd.append('file',photoFile.value);store.state.msg='جاري رفع صورة العضو...';const r=await runBusyAction(store,'member-detail.upload-photo',()=>uploadApi('/api/admin/members/'+encodeURIComponent(m.value.id)+'/photo',{method:'POST',body:fd,headers:{'Accept':'application/json'},uploadLabel:'رفع صورة العضو'}));store.state.msg=r.message||r.error||'';photoFile.value=null;photoName.value='لم يتم اختيار صورة';photo.value='';await refresh();}
2656      async function removeAdminPhoto(){if(!m.value||!(m.value.photo_profile_url||m.value.photo_url)){store.state.msg='لا توجد صورة محفوظة';return;}if(!confirm('حذف صورة العضو من الملف؟'))return;const r=await runBusyAction(store,'member-detail.remove-photo',()=>api('/api/admin/members/'+encodeURIComponent(m.value.id)+'/photo/remove',{method:'POST'}));store.state.msg=r.message||r.error||'';await refresh();}
2657      function saveAdminCardPng(){if(!canShowMemberCard(m.value)){store.state.msg='البطاقة متاحة بعد اعتماد العضوية وإصدار الرقم';return;}saveCardPng(cardUrl.value,m.value.gzc_id,store);}
2658      return {store,m,cases,emergencies,audit,editOpen,edit,statusTarget,photoName,photo,memberPhotoFailed,cardUrl,deletePreview,canPermanentDelete,statusName,memberType,memberDisplayName,memberFieldName,canApproveMember,canShowMemberCard,approve,remind,saveProfile,changeStatus,suspend,archiveMember,permanentDelete,onAdminPhoto,uploadAdminPhoto,removeAdminPhoto,saveAdminCardPng};
2659    },
2660    render:(function(){
2661const _Vue = Vue
2662const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
2663
2664const _hoisted_1 = {
2665  key: 0,
2666  class: "card skeleton"
2667}
2668const _hoisted_2 = {
2669  key: 1,
2670  class: "adminRecordWorkspace memberRecordWorkspace"
2671}
2672const _hoisted_3 = { class: "memberRecordContent" }
2673const _hoisted_4 = { class: "adminWorkspaceBackBar memberWorkspaceTop" }
2674const _hoisted_5 = ["onClick"]
2675const _hoisted_6 = { class: "card memberDetailHero memberRecordHero" }
2676const _hoisted_7 = { class: "detailIdentity" }
2677const _hoisted_8 = ["src", "onError"]
2678const _hoisted_9 = {
2679  key: 1,
2680  class: "avatar placeholder"
2681}
2682const _hoisted_10 = { class: "memberMiniFoot" }
2683const _hoisted_11 = { key: 0 }
2684const _hoisted_12 = { class: "quickActionGrid memberPrimaryActions" }
2685const _hoisted_13 = ["onClick"]
2686const _hoisted_14 = ["onClick"]
2687const _hoisted_15 = ["onClick"]
2688const _hoisted_16 = ["href"]
2689const _hoisted_17 = ["onClick"]
2690const _hoisted_18 = { class: "memberWorkspaceGrid" }
2691const _hoisted_19 = { class: "card memberDetailCard memberCurrentDataCard" }
2692const _hoisted_20 = { class: "memberSectionHead" }
2693const _hoisted_21 = ["onClick"]
2694const _hoisted_22 = { class: "memberDataGrid" }
2695const _hoisted_23 = { class: "profileLine" }
2696const _hoisted_24 = { class: "profileLine" }
2697const _hoisted_25 = { class: "profileLine" }
2698const _hoisted_26 = { class: "profileLine" }
2699const _hoisted_27 = { class: "profileLine" }
2700const _hoisted_28 = { class: "ltr" }
2701const _hoisted_29 = { class: "profileLine" }
2702const _hoisted_30 = { class: "ltr" }
2703const _hoisted_31 = { class: "profileLine" }
2704const _hoisted_32 = { class: "profileLine" }
2705const _hoisted_33 = { class: "profileLine" }
2706const _hoisted_34 = { class: "profileLine" }
2707const _hoisted_35 = { class: "profileLine" }
2708const _hoisted_36 = { class: "profileLine" }
2709const _hoisted_37 = { class: "profileLine" }
2710const _hoisted_38 = { class: "profileLine" }
2711const _hoisted_39 = { class: "profileLine" }
2712const _hoisted_40 = { class: "profileLine" }
2713const _hoisted_41 = { class: "card actionPanel memberAdminActionsCard" }
2714const _hoisted_42 = { class: "statusChangeRow" }
2715const _hoisted_43 = ["onUpdate:modelValue"]
2716const _hoisted_44 = ["onClick"]
2717const _hoisted_45 = { class: "memberActions" }
2718const _hoisted_46 = ["onClick"]
2719const _hoisted_47 = ["onClick"]
2720const _hoisted_48 = {
2721  key: 0,
2722  class: "memberDangerZone"
2723}
2724const _hoisted_49 = ["onClick"]
2725const _hoisted_50 = {
2726  key: 0,
2727  class: "card memberEditCard"
2728}
2729const _hoisted_51 = { class: "memberSectionHead" }
2730const _hoisted_52 = ["onClick"]
2731const _hoisted_53 = { class: "editGrid memberEditGrid" }
2732const _hoisted_54 = { class: "fieldBlock" }
2733const _hoisted_55 = ["onUpdate:modelValue"]
2734const _hoisted_56 = { class: "fieldBlock" }
2735const _hoisted_57 = ["onUpdate:modelValue"]
2736const _hoisted_58 = ["value"]
2737const _hoisted_59 = { class: "fieldBlock" }
2738const _hoisted_60 = ["onUpdate:modelValue"]
2739const _hoisted_61 = { class: "fieldBlock" }
2740const _hoisted_62 = ["onUpdate:modelValue"]
2741const _hoisted_63 = { class: "fieldBlock" }
2742const _hoisted_64 = ["onUpdate:modelValue"]
2743const _hoisted_65 = { class: "fieldBlock" }
2744const _hoisted_66 = ["onUpdate:modelValue"]
2745const _hoisted_67 = ["value"]
2746const _hoisted_68 = { class: "fieldBlock" }
2747const _hoisted_69 = ["onUpdate:modelValue"]
2748const _hoisted_70 = ["value"]
2749const _hoisted_71 = { class: "fieldBlock" }
2750const _hoisted_72 = ["onUpdate:modelValue", "onChange"]
2751const _hoisted_73 = ["value"]
2752const _hoisted_74 = { class: "fieldBlock" }
2753const _hoisted_75 = ["onUpdate:modelValue"]
2754const _hoisted_76 = ["value"]
2755const _hoisted_77 = { class: "fieldBlock" }
2756const _hoisted_78 = ["onUpdate:modelValue"]
2757const _hoisted_79 = ["value"]
2758const _hoisted_80 = { class: "fieldBlock" }
2759const _hoisted_81 = ["onUpdate:modelValue"]
2760const _hoisted_82 = { class: "fieldBlock" }
2761const _hoisted_83 = ["onUpdate:modelValue"]
2762const _hoisted_84 = { class: "fieldBlock" }
2763const _hoisted_85 = ["onUpdate:modelValue"]
2764const _hoisted_86 = { class: "memberEditSaveBar" }
2765const _hoisted_87 = ["onClick"]
2766const _hoisted_88 = ["onClick"]
2767const _hoisted_89 = { class: "card uploadBoxPro photoManagerCard" }
2768const _hoisted_90 = { class: "photoManager" }
2769const _hoisted_91 = ["src", "onError"]
2770const _hoisted_92 = {
2771  key: 1,
2772  class: "memberThumb memberThumbPlaceholder large"
2773}
2774const _hoisted_93 = { class: "filePicker" }
2775const _hoisted_94 = ["onChange"]
2776const _hoisted_95 = { class: "row" }
2777const _hoisted_96 = ["onClick"]
2778const _hoisted_97 = ["onClick"]
2779const _hoisted_98 = { class: "card relatedCard" }
2780const _hoisted_99 = {
2781  key: 0,
2782  class: "hint"
2783}
2784const _hoisted_100 = { class: "card relatedCard" }
2785const _hoisted_101 = {
2786  key: 0,
2787  class: "hint"
2788}
2789const _hoisted_102 = ["onClick"]
2790
2791return function render(_ctx, _cache) {
2792  with (_ctx) {
2793    const { openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _
2793createCommentVNode, createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, vModelSelect: _vModelSelect, withDirectives: _withDirectives, vModelText: _vModelText, renderList: _renderList, Fragment: _Fragment, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
2794
2795    const _component_AdminFrame = _resolveComponent("AdminFrame")
2796
2797    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "تفاصيل العضو" }, {
2798      default: _withCtx(() => [(!m)
2799        ? (_openBlock(), _createElementBlock("div", _hoisted_1, "جاري تحميل تفاصيل العضو..."))
2800        : (_openBlock(), _createElementBlock("section", _hoisted_2, [_createElementVNode("div", _hoisted_3, [
2801            _createElementVNode("div", _hoisted_4, [_createElementVNode("button", {
2802              class: "smallbtn secondary",
2803              onClick: $event => ($router.push('/admin/members'))
2804            }, "← العودة للعضويات", 8, _hoisted_5), _cache[0] || (_cache[0] = _createElementVNode("span", null, "ملف العضو — عرض البيانات والتعديل والإجراءات في مساحة واحدة", -1))]),
2805            _createElementVNode("div", _hoisted_6, [_createElementVNode("div", _hoisted_7, [(!memberPhotoFailed && $memberPhoto(m,'profile'))
2806              ? (_openBlock(), _createElementBlock("img", {
2807                  key: 0,
2808                  src: $memberPhoto(m,'profile'),
2809                  loading: "lazy",
2810                  alt: "صورة العضو",
2811                  onError: $event => (memberPhotoFailed=true)
2812                }, null, 40, _hoisted_8))
2813              : (_openBlock(), _createElementBlock("div", _hoisted_9, "👤")), _createElementVNode("div", null, [_createElementVNode("h3", null, _toDisplayString(memberDisplayName(m)), 1), _createElementVNode("div", _hoisted_10, [_createElementVNode("span", null, _toDisplayString(statusName(m.status)), 1), _createElementVNode("span", null, _toDisplayString(memberType(m)), 1), (m.gzc_id)
2814              ? (_openBlock(), _createElementBlock("span", _hoisted_11, _toDisplayString(m.gzc_id), 1))
2815              : _createCommentVNode("", true)])])]), _createElementVNode("div", _hoisted_12, [
2816              _createElementVNode("button", {
2817                class: "btn secondary",
2818                onClick: $event => (editOpen=!editOpen)
2819              }, _toDisplayString(editOpen?'إغلاق التعديل':'تعديل البيانات'), 9, _hoisted_13),
2820              (canApproveMember(m))
2821                ? (_openBlock(), _createElementBlock("button", {
2822                    key: 0,
2823                    class: "btn",
2824                    onClick: approve
2825                  }, "اعتماد العضو", 8, _hoisted_14))
2826                : _createCommentVNode("", true),
2827              (m.status!=='approved')
2828                ? (_openBlock(), _createElementBlock("button", {
2829                    key: 1,
2830                    class: "btn secondary",
2831                    onClick: remind
2832                  }, "تذكير التسجيل", 8, _hoisted_15))
2833                : _createCommentVNode("", true),
2834              (canShowMemberCard(m))
2835                ? (_openBlock(), _createElementBlock("a", {
2836                    key: 2,
2837                    class: "btn secondary",
2838                    href: cardUrl,
2839                    target: "_blank"
2840                  }, "عرض البطاقة", 8, _hoisted_16))
2841                : _createCommentVNode("", true),
2842              (canShowMemberCard(m))
2843                ? (_openBlock(), _createElementBlock("button", {
2844                    key: 3,
2845                    class: "btn secondary",
2846                    onClick: saveAdminCardPng
2847                  }, "حفظ البطاقة كصورة", 8, _hoisted_17))
2848                : _createCommentVNode("", true)
2849            ])]),
2850            _createElementVNode("div", _hoisted_18, [_createElementVNode("div", _hoisted_19, [_createElementVNode("div", _hoisted_20, [_cache[1] || (_cache[1] = _createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "الملف الحالي"), _createElementVNode("h3", null, "بيانات العضو")], -1)), _createElementVNode("button", {
2851              class: "smallbtn secondary",
2852              onClick: $event => (editOpen=true)
2853            }, "تعديل", 8, _hoisted_21)]), _createElementVNode("div", _hoisted_22, [
2854              _createElementVNode("div", _hoisted_23, [_cache[2] || (_cache[2] = _createElementVNode("b", null, "الاسم", -1)), _createElementVNode("span", null, _toDisplayString(memberFieldName(m)), 1
2854)]),
2855              _createElementVNode("div", _hoisted_24, [_cache[3] || (_cache[3] = _createElementVNode("b", null, "GZC ID", -1)), _createElementVNode("span", null, _toDisplayString(m.gzc_id || '-'), 1)]),
2856              _createElementVNode("div", _hoisted_25, [_cache[4] || (_cache[4] = _createElementVNode("b", null, "الحالة", -1)), _createElementVNode("span", null, _toDisplayString(statusName(m.status)), 1)]),
2857              _createElementVNode("div", _hoisted_26, [_cache[5] || (_cache[5] = _createElementVNode("b", null, "النوع", -1)), _createElementVNode("span", null, _toDisplayString(memberType(m)), 1)]),
2858              _createElementVNode("div", _hoisted_27, [_cache[6] || (_cache[6] = _createElementVNode("b", null, "واتساب", -1)), _createElementVNode("span", _hoisted_28, _toDisplayString(m.whatsapp || '-'), 1)]),
2859              _createElementVNode("div", _hoisted_29, [_cache[7] || (_cache[7] = _createElementVNode("b", null, "هاتف الصين", -1)), _createElementVNode("span", _hoisted_30, _toDisplayString(m.china_phone || '-'), 1)]),
2860              _createElementVNode("div", _hoisted_31, [_cache[8] || (_cache[8] = _createElementVNode("b", null, "WeChat", -1)), _createElementVNode("span", null, _toDisplayString(m.wechat || '-'), 1)]),
2861              _createElementVNode("div", _hoisted_32, [_cache[9] || (_cache[9] = _createElementVNode("b", null, "الدولة", -1)), _createElementVNode("span", null, _toDisplayString(m.country_name_ar || m.country_code || 'غير محددة'), 1)]),
2862              _createElementVNode("div", _hoisted_33, [_cache[10] || (_cache[10] = _createElementVNode("b", null, "مدينة الإقامة في الصين", -1)), _createElementVNode("span", null, _toDisplayString($cityLabel(m.china_city) || '-'), 1)]),
2863              _createElementVNode("div", _hoisted_34, [_cache[11] || (_cache[11] = _createElementVNode("b", null, "الحي / المنطقة", -1)), _createElementVNode("span", null, _toDisplayString(m.china_district || '-'), 1)]),
2864              _createElementVNode("div", _hoisted_35, [_cache[12] || (_cache[12] = _createElementVNode("b", null, "فئة العضوية", -1)), _createElementVNode("span", null, _toDisplayString(m.category || '-'), 1)]),
2865              _createElementVNode("div", _hoisted_36, [_cache[13] || (_cache[13] = _createElementVNode("b", null, "الجنس", -1)), _createElementVNode("span", null, _toDisplayString(m.gender || '-'), 1)]),
2866              _createElementVNode("div", _hoisted_37, [_cache[14] || (_cache[14] = _createElementVNode("b", null, "المهنة", -1)), _createElementVNode("span", null, _toDisplayString(m.profession || '-'), 1)]),
2867              _createElementVNode("div", _hoisted_38, [_cache[15] || (_cache[15] = _createElementVNode("b", null, "جهة العمل", -1)), _createElementVNode("span", null, _toDisplayString(m.workplace || '-'), 1)]),
2868              _createElementVNode("div", _hoisted_39, [_cache[16] || (_cache[16] = _createElementVNode("b", null, "الجامعة", -1)), _createElementVNode("span", null, _toDisplayString(m.university || '-'), 1)]),
2869              _createElementVNode("div", _hoisted_40, [_cache[17] || (_cache[17] = _createElementVNode("b", null, "عدد أفراد الأسرة", -1)), _createElementVNode("span", null, _toDisplayString(m.family_count || 0), 1)])
2870            ])]), _createElementVNode("div", _hoisted_41, [
2871              _cache[21] || (_cache[21] = _createElementVNode("span", { class: "adminEyebrow" }, "إدارة العضوية", -1)),
2872              _cache[22] || (_cache[22] = _createElementVNode("h3", null, "الإجراءات", -1)),
2873              _cache[23] || (_cache[23] = _createElementVNode("label", { class: "fieldLabel" }, "تغيير الحالة", -1)),
2874              _createElementVNode("div", _hoisted_42, [_withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((statusTarget) = $event) }, _cache[18] || (_cache[18] = [
2875                _createElementVNode("option", { value: "pre_registered" }, "تذكير التسجيل", -1),
2876                _createElementVNode("option", { value: "profile_pending" }, "مراجعة بيانات", -1),
2877                _createElementVNode("option", { value: "pending" }, "مراجعة", -1),
2878                _createElementVNode("option", { value: "approved" }, "معتمد", -1),
2879                _createElementVNode("option", { value: "suspended" }, "معلق", -1)
2880              ]), 8, _hoisted_43), [[_vModelSelect, statusTarget]]), _createElementVNode("button", {
2881                class: "smallbtn",
2882                onClick: changeStatus
2883              }, "تحديث الحالة", 8, _hoisted_44)]),
2884              _createElementVNode("div", _hoisted_45, [_createElementVNode("button", {
2885                class: "smallbtn danger",
2886                onClick: suspend
2887              }, "تعليق العضوية", 8, _hoisted_46), _createElementVNode("button", {
2888                class: "smallbtn danger",
2889                onClick: archiveMember
2890              }, "أرشفة العضو", 8, _hoisted_47)]),
2891              canPermanentDelete
2892                ? (_openBlock(), _createElementBlock("div", _hoisted_48, [_cache[19] || (_cache[19] = _createElementVNode("b", null, "منطقة خطرة", -1)), _cache[20] || (_cache[20] = _createElementVNode("p", { class: "hint" }, "الحذف النهائي يزيل حساب المستخدم وبيانات هويته وصوره ويُنهي جلساته. السجلات التشغيلية اللازمة مثل الطلبات وAudit تبقى محفوظة بدون إعادة تفعيل الحساب.", -1)), _createElementVNode("button", {
2893                    class: "smallbtn danger permanentDeleteButton",
2894                    onClick: permanentDelete
2895                  }, "حذف المستخدم نهائياً", 8, _hoisted_49)]))
2896                : _createCommentVNode("", true)
2897            ])]),
2898            editOpen
2899              ? (_openBlock(), _createElementBlock("div", _hoisted_50, [_createElementVNode("div", _hoisted_51, [_cache[24] || (_cache[24] = _createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "تحرير مباشر"), _createElementVNode("h3", null, "تعديل بيانات العضو"), _createElementVNode("p", { class: "hint" }, "الحقول ذات الخيارات المحددة تستخدم قوائم اختيار. اضغط حفظ بعد المراجعة.")], -1)), _createElementVNode("button", {
2900                  class: "smallbtn secondary",
2901                  onClick: $event => (editOpen=false)
2902                }, "إغلاق", 8, _hoisted_52)]), _createElementVNode("div", _hoisted_53, [
2903                  _createElementVNode("label", _hoisted_54, [_cache[25] || (_cache[25] = _createElementVNode("b", null, "الاسم الكامل", -1)), _withDirectives(_createElementVNode("input", {
2904                    "onUpdate:modelValue": $event => ((edit.full_name) = $event),
2905                    placeholder: "الاسم الكامل"
2906                  }, null, 8, _hoisted_55), [[_vModelText, edit.full_name]])]),
2907                  _createElementVNode("label", _hoisted_56, [_cache[27] || (_cache[27] = _
2907createElementVNode("b", null, "الجنس", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((edit.gender) = $event) }, [_cache[26] || (_cache[26] = _createElementVNode("option", { value: "" }, "اختر الجنس", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList($optionList('gender',edit.gender), (o) => {
2908                    return (_openBlock(), _createElementBlock("option", {
2909                      key: o.value,
2910                      value: o.value
2911                    }, _toDisplayString(o.label), 9, _hoisted_58))
2912                  }), 128))], 8, _hoisted_57), [[_vModelSelect, edit.gender]])]),
2913                  _createElementVNode("label", _hoisted_59, [_cache[28] || (_cache[28] = _createElementVNode("b", null, "واتساب", -1)), _withDirectives(_createElementVNode("input", {
2914                    class: "ltr",
2915                    "onUpdate:modelValue": $event => ((edit.whatsapp) = $event),
2916                    placeholder: "رقم واتساب"
2917                  }, null, 8, _hoisted_60), [[_vModelText, edit.whatsapp]])]),
2918                  _createElementVNode("label", _hoisted_61, [_cache[29] || (_cache[29] = _createElementVNode("b", null, "هاتف الصين", -1)), _withDirectives(_createElementVNode("input", {
2919                    class: "ltr",
2920                    "onUpdate:modelValue": $event => ((edit.china_phone) = $event),
2921                    placeholder: "هاتف الصين"
2922                  }, null, 8, _hoisted_62), [[_vModelText, edit.china_phone]])]),
2923                  _createElementVNode("label", _hoisted_63, [_cache[30] || (_cache[30] = _createElementVNode("b", null, "WeChat", -1)), _withDirectives(_createElementVNode("input", {
2924                    "onUpdate:modelValue": $event => ((edit.wechat) = $event),
2925                    placeholder: "WeChat"
2926                  }, null, 8, _hoisted_64), [[_vModelText, edit.wechat]])]),
2927                  _createElementVNode("label", _hoisted_65, [_cache[32] || (_cache[32] = _createElementVNode("b", null, "فئة العضوية", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((edit.category) = $event) }, [_cache[31] || (_cache[31] = _createElementVNode("option", { value: "" }, "اختر فئة العضوية", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList($optionList('member_category',edit.category), (o) => {
2928                    return (_openBlock(), _createElementBlock("option", {
2929                      key: o.value,
2930                      value: o.value
2931                    }, _toDisplayString(o.label), 9, _hoisted_67))
2932                  }), 128))], 8, _hoisted_66), [[_vModelSelect, edit.category]])]),
2933                  _createElementVNode("label", _hoisted_68, [_cache[34] || (_cache[34] = _createElementVNode("b", null, "الدولة", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((edit.country_code) = $event) }, [_cache[33] || (_cache[33] = _createElementVNode("option", { value: "" }, "اختر الدولة", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList($countryList(edit.country_code), (c) => {
2934                    return (_openBlock(), _createElementBlock("option", {
2935                      key: c.value,
2936                      value: c.value
2937                    }, _toDisplayString(c.label), 9, _hoisted_70))
2938                  }), 128))], 8, _hoisted_69), [[_vModelSelect, edit.country_code]])]),
2939                  _createElementVNode("label", _hoisted_71, [_cache[36] || (_cache[36] = _createElementVNode("b", null, "مدينة الإقامة في الصين", -1)), _withDirectives(_createElementVNode("select", {
2940                    "onUpdate:modelValue": $event => ((edit.china_city) = $event),
2941                    onChange: $event => (edit.china_district='')
2942                  }, [_cache[35] || (_cache[35] = _createElementVNode("option", { value: "" }, "اختر المدينة في الصين", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList($cityList(edit.china_city), (c) => {
2943                    return (_openBlock(), _createElementBlock("option", {
2944                      key: c.value,
2945                      value: c.value
2946                    }, _toDisplayString(c.label), 9, _hoisted_73))
2947                  }), 128))], 40, _hoisted_72), [[_vModelSelect, edit.china_city]])]),
2948                  _createElementVNode("label", _hoisted_74, [_cache[38] || (_cache[38] = _createElementVNode("b", null, "الحي / المنطقة", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((edit.china_district) = $event) }, [_cache[37] || (_cache[37] = _createElementVNode("option", { value: "" }, "اختر الحي / المنطقة", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList($districtList(edit.china_city,edit.china_district), (d) => {
2949                    return (_openBlock(), _createElementBlock("option", {
2950                      key: d.value,
2951                      value: d.value
2952                    }, _toDisplayString(d.label), 9, _hoisted_76))
2953                  }), 128))], 8, _hoisted_75), [[_vModelSelect, edit.china_district]])]),
2954                  _createElementVNode("label", _hoisted_77, [_cache[40] || (_cache[40] = _createElementVNode("b", null, "المهنة", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((edit.profession) = $event) }, [_cache[39] || (_cache[39] = _createElementVNode("option", { value: "" }, "اختر المهنة", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList($professionList(edit.profession), (p) => {
2955                    return (_openBlock(), _createElementBlock("option", {
2956                      key: p.value,
2957                      value: p.value
2958                    }, _toDisplayString(p.label), 9, _hoisted_79))
2959                  }), 128))], 8, _hoisted_78), [[_vModelSelect, edit.profession]])]),
2960                  _createElementVNode("label", _hoisted_80, [_cache[41] || (_cache[41] = _createElementVNode("b", null, "جهة العمل", -1)), _withDirectives(_createElementVNode("input", {
2961                    "onUpdate:modelValue": $event => ((edit.workplace) = $event),
2962                    placeholder: "جهة العمل"
2963                  }, null, 8, _hoisted_81), [[_vModelText, edit.workplace]])]),
2964                  _createElementVNode("label", _hoisted_82, [_cache[42] || (_cache[42] = _createElementVNode("b", null, "الجامعة", -1)), _withDirectives(_createElementVNode("input", {
2965                    "onUpdate:modelValue": $event => ((edit.university) = $event),
2966                    placeholder: "الجامعة"
2967                  }, null, 8, _hoisted_83), [[_vModelText, edit.university]])]),
2968                  _createElementVNode("label", _hoisted_84, [_cache[43] || (_cache[43] = _createElementVNode("b", null, "عدد أفراد الأسرة", -1)), _withDirectives(_createElementVNode("input", {
2969                    type: "number",
2970                    min: "1",
2971                    "onUpdate:modelValue": $event => ((edit.family_count) = $event),
2972                    placeholder: "عدد أفراد الأسرة"
2973                  }
2973, null, 8, _hoisted_85), [[_vModelText, edit.family_count]])])
2974                ]), _createElementVNode("div", _hoisted_86, [_createElementVNode("button", {
2975                  class: "btn",
2976                  onClick: saveProfile
2977                }, "حفظ التعديل", 8, _hoisted_87), _createElementVNode("button", {
2978                  class: "btn secondary",
2979                  onClick: $event => (editOpen=false)
2980                }, "إلغاء", 8, _hoisted_88)])]))
2981              : _createCommentVNode("", true),
2982            _createElementVNode("div", _hoisted_89, [
2983              _cache[46] || (_cache[46] = _createElementVNode("div", { class: "memberSectionHead" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "الصورة"), _createElementVNode("h3", null, "صورة العضو")])], -1)),
2984              _createElementVNode("div", _hoisted_90, [(photo || (!memberPhotoFailed && $memberPhoto(m,'profile')))
2985                ? (_openBlock(), _createElementBlock("img", {
2986                    key: 0,
2987                    src: photo || $memberPhoto(m,'profile'),
2988                    alt: "صورة العضو",
2989                    onError: $event => (!photo && (memberPhotoFailed=true))
2990                  }, null, 40, _hoisted_91))
2991                : (_openBlock(), _createElementBlock("div", _hoisted_92, "👤")), _cache[44] || (_cache[44] = _createElementVNode("p", { class: "hint" }, "سيتم ضبط الصورة تلقائياً لتناسب قائمة العضويات، صفحة العضو، وبطاقة العضوية.", -1))]),
2992              _createElementVNode("label", _hoisted_93, [_createElementVNode("input", {
2993                type: "file",
2994                accept: "image/*",
2995                onChange: onAdminPhoto
2996              }, null, 40, _hoisted_94), _cache[45] || (_cache[45] = _createElementVNode("span", null, "اختيار صورة", -1)), _createElementVNode("em", null, _toDisplayString(photoName), 1)]),
2997              _createElementVNode("div", _hoisted_95, [_createElementVNode("button", {
2998                class: "btn secondary",
2999                onClick: uploadAdminPhoto
3000              }, "رفع الصورة بواسطة الإدارة", 8, _hoisted_96), ($memberPhoto(m,'profile'))
3001                ? (_openBlock(), _createElementBlock("button", {
3002                    key: 0,
3003                    class: "btn danger",
3004                    onClick: removeAdminPhoto
3005                  }, "حذف الصورة", 8, _hoisted_97))
3006                : _createCommentVNode("", true)])
3007            ]),
3008            _createElementVNode("div", _hoisted_98, [
3009              _cache[47] || (_cache[47] = _createElementVNode("h3", null, "الحالات والطوارئ", -1)),
3010              (!cases.length && !emergencies.length)
3011                ? (_openBlock(), _createElementBlock("div", _hoisted_99, "لا توجد حالات مرتبطة."))
3012                : _createCommentVNode("", true),
3013              (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(cases, (c) => {
3014                return (_openBlock(), _createElementBlock("div", {
3015                  class: "relatedItem",
3016                  key: 'c'+c.id
3017                }, [_createElementVNode("b", null, _toDisplayString(c.case_code), 1), _createElementVNode("span", null, _toDisplayString(c.type) + " — " + _toDisplayString(c.status), 1), _createElementVNode("small", null, _toDisplayString(String(c.created_at||'').slice(0,16).replace('T',' ')), 1)]))
3018              }), 128)),
3019              (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(emergencies, (e) => {
3020                return (_openBlock(), _createElementBlock("div", {
3021                  class: "relatedItem dangerRelated",
3022                  key: 'e'+e.id
3023                }, [_createElementVNode("b", null, _toDisplayString(e.ticket_code), 1), _createElementVNode("span", null, _toDisplayString(e.type) + " — " + _toDisplayString(e.status) + " — " + _toDisplayString(e.priority), 1), _createElementVNode("small", null, _toDisplayString(String(e.created_at||'').slice(0,16).replace('T',' ')), 1
3023)]))
3024              }), 128))
3025            ]),
3026            _createElementVNode("div", _hoisted_100, [_cache[48] || (_cache[48] = _createElementVNode("h3", null, "آخر سجل Audit", -1)), (!audit.length)
3027              ? (_openBlock(), _createElementBlock("div", _hoisted_101, "لا يوجد سجل حديث."))
3028              : _createCommentVNode("", true), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(audit.slice(0,8), (a) => {
3029              return (_openBlock(), _createElementBlock("div", {
3030                class: "relatedItem",
3031                key: a.created_at+a.action
3032              }, [_createElementVNode("b", null, _toDisplayString(a.action), 1), _createElementVNode("span", null, _toDisplayString(a.entity_type) + " / " + _toDisplayString(a.entity_id), 1), _createElementVNode("small", null, _toDisplayString(String(a.created_at||'').slice(0,16).replace('T',' ')), 1)]))
3033            }), 128))]),
3034            _createElementVNode("button", {
3035              class: "btn secondary loadMore",
3036              onClick: $event => ($router.push('/admin/members'))
3037            }, "رجوع للعضويات", 8, _hoisted_102)
3038          ])]))]),
3039      _: 1
3040    }))
3041  }
3042}
3043})()
3044  };
3045
3046
3047  // v3.8.55 — i18n foundation. Arabic is the source locale; English and Chinese are
3048  // activated per key as translations land. A missing key never breaks the UI: it falls back to Arabic.
3049  const I18N_DEFAULT_LOCALE='ar';
3050  const I18N={
3051    ar:{
3052      'nav.home':'الرئيسية','nav.login':'دخول','nav.guide':'الدليل','nav.events':'الفعاليات','nav.emergency':'طوارئ',
3053      'nav.account':'حسابي','nav.orders':'طلباتي','nav.notifications':'إشعارات',
3054      'footer.privacy':'الخصوصية','footer.terms':'الشروط','footer.contact':'التواصل','footer.platform':'منصة SMT China',
3055      'common.language':'اللغة'
3056    },
3057    en:{
3058      'nav.home':'Home','nav.login':'Sign in','nav.guide':'Guide','nav.events':'Events','nav.emergency':'Emergency',
3059      'nav.account':'Account','nav.orders':'My orders','nav.notifications':'Alerts',
3060      'footer.privacy':'Privacy','footer.terms':'Terms','footer.contact':'Contact','footer.platform':'SMT China Platform',
3061      'common.language':'Language'
3062    },
3063    zh:{
3064      'nav.home':'首页','nav.login':'登录','nav.guide':'指南','nav.events':'活动','nav.emergency':'紧急',
3065      'nav.account':'我的','nav.orders':'我的订单','nav.notifications':'通知',
3066      'footer.privacy':'隐私','footer.terms':'条款','footer.contact':'联系','footer.platform':'SMT China 平台',
3067      'common.language':'语言'
3068    }
3069  };
3070  function i18nStoredLocale(){try{return String(localStorage.getItem('gzc_locale')||'')}catch(e){return ''}}
3071  function i18nPersistLocale(code){try{localStorage.setItem('gzc_locale',String(code||''))}catch(e){}}
3072  function i18nApplyDocument(code,dir){try{const el=document.documentElement;if(!el)return;el.setAttribute('lang',code==='zh'?'zh-Hans':String(code||'ar'));el.setAttribute('dir',dir||(code==='ar'?'rtl':'ltr'));}catch(e){}}
3073  function i18nTranslate(locale,key){
3074    const table=I18N[String(locale||I18N_DEFAULT_LOCALE)]||I18N[I18N_DEFAULT_LOCALE];
3075    const fallback=I18N[I18N_DEFAULT_LOCALE]||{};
3076    const value=table&&Object.prototype.hasOwnProperty.call(table,key)?table[key]:undefined;
3077    if(value!==undefined&&String(value).trim()!=='')return value;
3078    return Object.prototype.hasOwnProperty.call(fallback,key)?fallback[key]:key;
3079  }
3080
3081  const PublicFrame={
3082    props:['title','home'],
3083    setup(){
3084      const store=useGzcStore(); const router=useRouter(); const route=useRoute();
3085      const navLogged=computed(()=>store.state.me&&store.state.me.authenticated&&store.state.me.member);
3086      const ordersShortcutVisible=computed(()=>!!(store.state.me&&store.state.me.member&&store.state.me.member.show_orders_navigation));
3087      const tabs=computed(()=>navLogged.value?
3088        ([['/','الرئيسية','⌂',''],
3089          ['/notifications','إشعارات','🔔','notifications'],
3090          ['/china-guide','الدليل','📚',''],
3091          ...(ordersShortcutVisible.value
3092            ? [['/orders','طلباتي','🧾','workflow']]
3093            : [['/events','الفعاليات','◷','']]),
3094          ['/account','حسابي','👤','']])
3095        :
3096        [['/','الرئيسية','⌂',''],
3097         ['/login','دخول','👤',''],
3098         ['/china-guide','الدليل','📚',''],
3099         ['/events','الفعاليات','◷',''],
3100         ['/emergency','متابعة','!','']]
3101      );
3102      function active(p){if(p==='/orders')return route.path==='/orders'||route.path.startsWith('/procurement');if(p!=='/'&&route.path.startsWith(p+'/'))return true;return route.path===p;}
3103      function go(p){router.push(p);}
3104      function badgeFor(t){if(t[3]==='notifications')return Number(store.state.memberUnread||0);if(t[3]==='workflow')return Number(store.state.memberWorkflowSummary&&store.state.memberWorkflowSummary.needs_action||0);return 0;}
3105      async function refreshMemberSignals(){if(!navLogged.value)return;await Promise.all([store.loadMemberNotifications('all',8),store.loadMemberWorkflowSummary()]);}
3106      onMounted(async()=>{await store.loadMe();await refreshMemberSignals();});
3107      return {store,router,tabs,active,go,navLogged,ordersShortcutVisible,badgeFor,refreshMemberSignals};
3108    },
3109    render:(function(){
3110const _Vue = Vue
3111const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
3112
3113const _hoisted_1 = { class: "publicShell" }
3114const _hoisted_2 = {
3115  key: 0,
3116  class: "publicHero pageHeroV2"
3117}
3118const _hoisted_3 = { class: "pageHeroBar" }
3119const _hoisted_4 = ["onClick"]
3120const _hoisted_5 = ["onClick"]
3121const _hoisted_6 = { key: 0 }
3122const _hoisted_7 = { class: "smtFooter compactBrandFooter" }
3123const _hoisted_8 = {
3124  class: "footerLinks",
3125  "aria-label": "روابط معلومات المنصة"
3126}
3127const _hoisted_9 = ["onClick"]
3128const _hoisted_10 = ["onClick"]
3129const _hoisted_11 = ["onClick"]
3130const _hoisted_12 = {
3131  class: "nav bottomPro memberOpsNav",
3132  "aria-label": "التنقل السفلي"
3133}
3134const _hoisted_13 = ["onClick"]
3135const _hoisted_14 = { class: "navIcon" }
3136const _hoisted_15 = ["src"]
3137const _hoisted_16 = {
3138  key: 0,
3139  class: "navCounter"
3140}
3141const _hoisted_17 = { class: "navText" }
3142
3143return function render(_ctx, _cache) {
3144  with (_ctx) {
3145    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, renderSlot: _renderSlot, renderList: _renderList, Fragment: _Fragment, normalizeClass: _normalizeClass } = _Vue
3146
3147    return (_openBlock(), _createElementBlock("section", _hoisted_1, [
3148      (!home)
3149        ? (_openBlock(), _createElementBlock("header", _hoisted_2, [_createElementVNode("div", _hoisted_3, [_createElementVNode("button", {
3150            class: "back",
3151            onClick: $event => (go('/'))
3152          }, "الرئيسية", 8, _hoisted_4), _cache[1] || (_cache[1] = _createElementVNode("a", {
3153            class: "smtBrandLink pageHeroBrand",
3154            href: "https://smtchgz.cn",
3155            target: "_blank",
3156            rel: "noopener noreferrer",
3157            "aria-label": "فتح موقع SMT Advanced Business"
3158          }, [_createElementVNode("img", {
3159            src: "/brand/smt-gold-v1/smt-logo-transparent.png",
3160            alt: "SMT",
3161            width: "44",
3162            height: "44"
3163          })], -1)), navLogged
3164            ? (_openBlock(), _createElementBlock("button", {
3165                key: 0,
3166                class: "memberTopBell",
3167                onClick: $event => (go('/notifications')),
3168                "aria-label": "إشعاراتي"
3169              }, [_cache[0] || (_cache[0] = _createElementVNode("span", null, "🔔", -1)), (store.state.memberUnread)
3170                ? (_openBlock(), _createElementBlock("b", _hoisted_6, _toDisplayString(store.state.memberUnread>99?'99+':store.state.memberUnread), 1))
3171                : _createCommentVNode("", true)], 8, _hoisted_5))
3172            : _createCommentVNode("", true)]), _createElementVNode("h1", null, _toDisplayString(title), 1)]))
3173        : _createCommentVNode("", true),
3174      _renderSlot($slots, "default"),
3175      _createElementVNode("footer", _hoisted_7, [_createElementVNode("div", null, [_cache[2] || (_cache[2] = _createElementVNode("b", null, "SMT Advanced Business", -1)), _cache[3] || (_cache[3] = _createElementVNode("span", null, "منصة SMT China", -1)), _createElementVNode("nav", _hoisted_8, [_createElementVNode("button", { onClick: $event => (go('/privacy')) }, "الخصوصية", 8, _hoisted_9), _createElementVNode("button", { onClick: $event => (go('/terms')) }, "الشروط", 8, _hoisted_10), _createElementVNode("button", { onClick: $event => (go('/contact')) }, "التواصل", 8, _hoisted_11)])])]),
3176      _createElementVNode("nav", _hoisted_12, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(tabs, (t) => {
3177        return (_openBlock(), _createElementBlock("button", {
3178          key: t[0],
3179          class: _normalizeClass({active:active(t[0])}),
3180          onClick: $event => (go(t[0]))
3181        }, [_createElementVNode("span", _hoisted_14, [_createElementVNode("img", {
3182          class: "smtNavArt",
3183          src: '/brand/smt-gold-v1/'+(t[0]==='/'?'smt-logo.png':'service-'+({'/china-guide':'guide','/events':'notifications','/notifications':'notifications','/orders':'business','/emergency':'help'}[t[0]]||'account')+'.webp'),
3184          alt: "",
3185          width: "32",
3186          height: "32"
3187        }, null, 8, _hoisted_15), (badgeFor(t))
3188          ? (_openBlock(), _createElementBlock("b", _hoisted_16, _toDisplayString(badgeFor(t)>99?'99+':badgeFor(t)), 1))
3189          : _createCommentVNode("", true)]), _createElementVNode("span", _hoisted_17, _toDisplayString(t[1]), 1)], 10, _hoisted_13))
3190      }), 128))])
3191    ]))
3192  }
3193}
3194})()
3195  };
3196
3197  const PublicHomePage={
3198    components:{PublicFrame},
3199    setup(){
3200      const store=useGzcStore(); const router=useRouter(); const pwa=reactive(pwaState());
3201      const loggedMember=computed(()=>store.state.me&&store.state.me.authenticated&&store.state.me.member);
3202      const installVisible=computed(()=>!pwa.standalone&&(pwa.installReady||/iphone|ipad|ipod|android/i.test(String(navigator.userAgent||''))));
3203      const officialUnread=computed(()=>safeArray(store.state.circulars).filter(a=>a.unread_by_me).length);
3204      const ordersShortcutVisible=computed(()=>!!(store.state.me&&store.state.me.member&&store.state.me.member.show_orders_navigation));
3205      function openOfficial(){router.push('/circulars/all');}
3206      function sync(e){Object.assign(pwa,(e&&e.detail)||pwaState());}
3207      onMounted(async()=>{await store.loadMe();store.loadPublicBranding();api('/api/home').then(r=>{store.state.home=r||null});if(loggedMember.value)store.loadPublicContent();sync();window.addEventListener('gzc-pwa-state',sync);});
3208      function go(p){router.push(p)}
3209      async function installApp(){const r=window.__gzcInstallApp?await window.__gzcInstallApp():{ok:false,message:iosInstallHint()};store.state.msg=r.message||iosInstallHint();sync();}
3210      async function acknowledge(channel){const r=await store.markAnnouncementsRead(channel);store.state.msg=(r&&r.message)||'تم تسجيل الاطلاع';}
3211      function openAttachment(m){if(m&&m.file_url)window.open(m.file_url,'_blank','noopener');}
3212      const branding=computed(()=>store.state.platformBranding||{});return {store,go,pwa,installVisible,installApp,loggedMember,ordersShortcutVisible,openOfficial,officialUnread,branding};
3213    },
3214    render:(function(){
3215const _Vue = Vue
3216const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
3217
3218const _hoisted_1 = { class: "publicHero smtExperienceHero modernHero compactHomeHero homeVisualHierarchyHero finalHomeHero" }
3219const _hoisted_2 = { class: "heroUtilityBar" }
3220const _hoisted_3 = { class: "heroBadge" }
3221const _hoisted_4 = ["onClick"]
3222const _hoisted_5 = { class: "heroContent heroFocusedContent" }
3223const _hoisted_6 = { class: "heroFocusedSummary" }
3224const _hoisted_7 = { class: "experiencePillars modernPillars compactHomePillars finalQuickAccess" }
3225const _hoisted_8 = ["onClick"]
3226const _hoisted_9 = ["onClick"]
3227const _hoisted_10 = ["onClick"]
3228const _hoisted_11 = ["onClick"]
3229const _hoisted_12 = { class: "smtCompanySection modernCompany compactCompanyCard homeCompanyStrip businessBridgeStrip" }
3230const _hoisted_13 = ["onClick"]
3231const _hoisted_14 = {
3232  key: 0,
3233  class: "smartBanner"
3234}
3235const _hoisted_15 = ["onClick"]
3236const _hoisted_16 = { class: "homeGrid orderedHomeGrid compactServiceGrid" }
3237const _hoisted_17 = ["onClick"]
3238const _hoisted_18 = {
3239  key: 0,
3240  class: "tileBadge"
3241}
3242const _hoisted_19 = ["onClick"]
3243const _hoisted_20 = ["onClick"]
3244const _hoisted_21 = ["onClick"]
3245const _hoisted_22 = ["onClick"]
3246const _hoisted_23 = {
3247  key: 0,
3248  class: "tileBadge"
3249}
3250const _hoisted_24 = ["onClick"]
3251const _hoisted_25 = {
3252  key: 0,
3253  class: "tileBadge"
3254}
3255const _hoisted_26 = ["onClick"]
3256const _hoisted_27 = {
3257  key: 0,
3258  class: "tileBadge"
3259}
3260const _hoisted_28 = ["onClick"]
3261const _hoisted_29 = ["onClick"]
3262const _hoisted_30 = ["onClick"]
3263const _hoisted_31 = ["onClick"]
3264const _hoisted_32 = ["onClick"]
3265const _hoisted_33 = ["onClick"]
3266const _hoisted_34 = ["onClick"]
3267const _hoisted_35 = ["onClick"]
3268const _hoisted_36 = ["onClick"]
3269
3270return function render(_ctx, _cache) {
3271  with (_ctx) {
3272    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, Fragment: _Fragment, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
3273
3274    const _component_PublicFrame = _resolveComponent("PublicFrame")
3275
3276    return (_openBlock(), _createBlock(_component_PublicFrame, {
3277      title: "الرئيسية",
3278      home: true
3279    }, {
3280      default: _withCtx(() => [
3281        _createElementVNode("section", _hoisted_1, [
3282          _cache[2] || (_cache[2] = _createElementVNode("div", { class: "heroGlow heroGlowOne" }, null, -1)),
3283          _cache[3] || (_cache[3] = _createElementVNode("div", { class: "heroGlow heroGlowTwo" }, null, -1)),
3284          _createElementVNode("div", _hoisted_2, [_createElementVNode("span", _hoisted_3, _toDisplayString(branding.badge || 'SMT China'), 1), installVisible
3285            ? (_openBlock(), _createElementBlock("button", {
3286                key: 0,
3287                type: "button",
3288                class: "compactHeroInstall",
3289                onClick: installApp,
3290                "aria-label": "تثبيت منصة SMT على الهاتف"
3291              }, _cache[0] || (_cache[0] = [_createElementVNode("span", { "aria-hidden": "true" }, "+", -1), _createTextVNode(" تثبيت المنصة")]), 8, _hoisted_4))
3292            : _createCommentVNode("", true)]),
3293          _cache[4] || (_cache[4] = _createElementVNode("div", { class: "heroTopline" }, [_createElementVNode("a", {
3294            class: "smtBrandLink",
3295            href: "https://smtchgz.cn",
3296            target: "_blank",
3297            rel: "noopener noreferrer",
3298            "aria-label": "فتح موقع SMT Advanced Business"
3299          }, [_createElementVNode("img", {
3300            class: "smtHeroLogo",
3301            src: "/brand/smt-gold-v1/smt-logo.png",
3302            alt: "شعار SMT"
3303          })]), _createElementVNode("div", { class: "heroPlatformIdentity" }, [_createElementVNode("b", null, "منصة SMT"), _createElementVNode("span", null, "خدمات ومجتمعات في الصين")])], -1)),
3304          _createElementVNode("div", _hoisted_5, [_createElementVNode("p", _hoisted_6, _toDisplayString(branding.subtitle || 'خدمات ومعلومات موثوقة للمجتمع والحياة اليومية والأعمال في الصين.'), 1), _cache[1] || (_cache[1] = _createElementVNode("div", { class: "heroCtas heroSingleAction" }, [_createElementVNode("a", {
3305            class: "heroPrimary",
3306            href: "/china-guide"
3307          }, "ابدأ من الدليل")], -1))])
3308        ]),
3309        _createElementVNode("section", _hoisted_7, [
3310          _createElementVNode("button", {
3311            type: "button",
3312            onClick: $event => (go('/about'))
3313          }, _cache[5] || (_cache[5] = [_createElementVNode("span", { class: "pillarIcon" }, [_createElementVNode("img", {
3314            class: "smtServiceArt",
3315            src: "/brand/smt-gold-v1/service-community.webp",
3316            alt: "",
3317            width: "96",
3318            height: "96",
3319            loading: "lazy"
3320          })], -1), _createElementVNode("span", null, [_createElementVNode("b", null, "المجتمع"), _createElementVNode("small", null, "العضوية والجاليات")], -1), _createElementVNode("em", null, "←", -1)]), 8, _hoisted_8),
3321          _createElementVNode("button", {
3322            type: "button",
3323            onClick: $event => (go('/china-guide'))
3324          }, _cache[6] || (_cache[6] = [_createElementVNode("span", { class: "pillarIcon" }, [_createElementVNode("img", {
3325            class: "smtServiceArt",
3326            src: "/brand/smt-gold-v1/service-guide.webp",
3327            alt: "",
3328            width: "96",
3329            height: "96",
3330            loading: "lazy"
3331          })], -1), _createElementVNode("span", null, [_createElementVNode("b", null, "الحياة في الصين"), _createElementVNode("small", null, "الخدمات اليومية")], -1), _createElementVNode("em", null, "←", -1)]), 8, _hoisted_9),
3332          _createElementVNode("button", {
3333            type: "button",
3334            onClick: $event => (go('/trade-shipping'))
3335          }, _cache[7] || (_cache[7] = [_createElementVNode("span", { class: "pillarIcon" }, [_createElementVNode("img", {
3336            class: "smtServiceArt",
3337            src: "/brand/smt-gold-v1/service-business.webp",
3338            alt: "",
3339            width: "96",
3340            height: "96",
3341            loading: "lazy"
3342          })], -1), _createElementVNode("span", null, [_createElementVNode("b", null, "الأعمال"), _createElementVNode("small", null, "التجارة والشحن")], -1), _createElementVNode("em", null, "←", -1)]), 8, _hoisted_10),
3343          _createElementVNode("button", {
3344            type: "button",
3345            onClick: $event => (go('/help'))
3346          }, _cache[8] || (_cache[8] = [_createElementVNode("span", { class: "pillarIcon" }, [_createElementVNode("img", {
3347            class: "smtServiceArt",
3348            src: "/brand/smt-gold-v1/service-help.webp",
3349            alt: "",
3350            width: "96",
3351            height: "96",
3352            loading: "lazy"
3353          })], -1), _createElementVNode("span", null, [_createElementVNode("b", null, "الدعم"), _createElementVNode("small", null, "المساعدة والمتابعة")], -1), _createElementVNode("em", null, "←", -1)]), 8, _hoisted_11)
3354        ]),
3355        _createElementVNode("section", _hoisted_12, [_cache[9] || (_cache[9] = _createElementVNode("div", { class: "companyHeader businessBridgeHeader" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "sectionEyebrow" }, "خدمات التجارة من الصين"), _createElementVNode("h2", null, "SMT Advanced Business")])], -1)), _cache[10] || (_cache[10] = _createElementVNode("p", null, "توريد، فحص جودة، شحن وإدارة سلاسل الإمداد.", -1)), _createElementVNode("button", {
3356          class: "companyAction",
3357          onClick: $event => (go('/trade-shipping'))
3358        }, "استكشف خدمات الأعمال", 8, _hoisted_13)]),
3359        (store.state.home&&store.state.home.banner)
3360          ? (_openBlock(), _createElementBlock("section", _hoisted_14, [_createElementVNode("div", null, [_createElementVNode("small", null, _toDisplayString(store.state.home.banner.kind), 1), _createElementVNode("b", null, _toDisplayString(store.state.home.banner.title), 1), _createElementVNode("p", null, _toDisplayString(store.state.home.banner.body), 1)]), (store.state.home.banner.url)
3361              ? (_openBlock(), _createElementBlock("button", {
3362                  key: 0,
3363                  class: "smallbtn",
3364                  onClick: $event => (go(store.state.home.banner.url))
3365                }, "فتح", 8, _hoisted_15))
3366              : _createCommentVNode("", true)]))
3367          : _createCommentVNode("", true),
3368        _createElementVNode("section", _hoisted_16, [
3369          (store.state.me&&store.state.me.authenticated&&store.state.me.member)
3370            ? (_openBlock(), _createElementBlock("button", {
3371                key: 0,
3372                type: "button",
3373                class: "homeTile officialTile officialTileEmbassy",
3374                onClick: $event => (openOfficial())
3375              }, [
3376                officialUnread
3377                  ? (_openBlock(), _createElementBlock("span", _hoisted_18, _toDisplayString(officialUnread), 1))
3378                  : _createCommentVNode("", true),
3379                _cache[11] || (_cache[11] = _createElementVNode("span", { class: "ico" }, [_createElementVNode("img", {
3380                  class: "smtServiceArt",
3381                  src: "/brand/smt-gold-v1/service-community.webp",
3382                  alt: "",
3383                  width: "96",
3384                  height: "96",
3385                  loading: "lazy"
3386                })], -1)),
3387                _cache[12] || (_cache[12] = _createElementVNode("b", null, "التعميمات الرسمية", -1)),
3388                _cache[13] || (_cache[13] = _createElementVNode("small", null, "سفارات وقنصليات وجهات رسمية موثوقة", -1)),
3389                _cache[14] || (_cache[14] = _createElementVNode("em", null, "فتح القسم", -1))
3390              ], 8, _hoisted_17))
3391            : _createCommentVNode("", true),
3392          _createElementVNode("button", {
3393            class: "homeTile guideTile",
3394            onClick: $event => (go('/china-guide'))
3395          }, _cache[15] || (_cache[15] = [_createElementVNode("span", { class: "ico" }, [_createElementVNode("img", {
3396            class: "smtServiceArt",
3397            src: "/brand/smt-gold-v1/service-guide.webp",
3398            alt: "",
3399            width: "96",
3400            height: "96",
3401            loading: "lazy"
3402          })], -1), _createElementVNode("b", null, "دليلك في الصين", -1), _createElementVNode("small", null, "الحياة والخدمات داخل الصين", -1)]), 8, _hoisted_19),
3403          _createElementVNode("button", {
3404            class: "homeTile guideTile chinaAppsHomeTile",
3405            onClick: $event => (go('/apps-in-china'))
3406          }, _cache[16] || (_cache[16] = [_createElementVNode("span", {
3407            class: "ico chinaAppsHomeIcon",
3408            "aria-hidden": "true"
3409          }, [_createElementVNode("span", { class: "chinaAppsMosaic" }, [
3410            _createElementVNode("img", {
3411              src: "/brand/app-media/alipay-icon.webp",
3412              alt: "",
3413              width: "42",
3414              height: "42",
3415              loading: "lazy"
3416            }),
3417            _createElementVNode("img", {
3418              src: "/brand/app-media/wechat-icon.webp",
3419              alt: "",
3420              width: "42",
3421              height: "42",
3422              loading: "lazy"
3423            }),
3424            _createElementVNode("img", {
3425              src: "/brand/app-media/trip-icon.webp",
3426              alt: "",
3427              width: "42",
3428              height: "42",
3429              loading: "lazy"
3430            }),
3431            _createElementVNode("img", {
3432              src: "/brand/app-media/amap-icon.webp",
3433              alt: "",
3434              width: "42",
3435              height: "42",
3436              loading: "lazy"
3437            })
3438          ])], -1), _createElementVNode("b", null, "تطبيقات مهمة في الصين", -1), _createElementVNode("small", null, "الدفع والتنقل والتسوق والتجارة، مع خطوات وFAQ", -1)]), 8, _hoisted_20),
3439          _createElementVNode("button", {
3440            class: "homeTile guideTile",
3441            onClick: $event => (go('/trade-shipping'))
3442          }, _cache[17] || (_cache[17] = [_createElementVNode("span", { class: "ico" }, [_createElementVNode("img", {
3443            class: "smtServiceArt",
3444            src: "/brand/smt-gold-v1/service-shipping.webp",
3445            alt: "",
3446            width: "96",
3447            height: "96",
3448            loading: "lazy"
3449          })], -1), _createElementVNode("b", null, "التجارة والشحن", -1), _createElementVNode("small", null, "الصين ⇄ العالم", -1)]), 8, _hoisted_21),
3450          (store.state.me&&store.state.me.authenticated&&store.state.me.member)
3451            ? (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [
3452                ordersShortcutVisible
3453                  ? (_openBlock(), _createElementBlock("button", {
3454                      key: 0,
3455                      class: "homeTile memberOpsTile",
3456                      onClick: $event => (go('/orders'))
3457                    }, [
3458                      (store.state.memberWorkflowSummary.needs_action)
3459                        ? (_openBlock(), _createElementBlock("span", _hoisted_23, _toDisplayString(store.state.memberWorkflowSummary.needs_action), 1))
3460                        : _createCommentVNode("", true),
3461                      _cache[18] || (_cache[18] = _createElementVNode("span", { class: "ico" }, [_createElementVNode("img", {
3462                        class: "smtServiceArt",
3463                        src: "/brand/smt-gold-v1/service-business.webp",
3464                        alt: "",
3465                        width: "96",
3466                        height: "96",
3467                        loading: "lazy"
3468                      })], -1)),
3469                      _cache[19] || (_cache[19] = _createElementVNode("b", null, "طلباتي", -1)),
3470                      _createElementVNode("small", null, _toDisplayString(store.state.memberWorkflowSummary.total?'متابعة '+store.state.memberWorkflowSummary.total+' طلب':'طلبات التوريد والمتابعة'), 1)
3471                    ], 8, _hoisted_22))
3472                  : _createCommentVNode("", true),
3473                _createElementVNode("button", {
3474                  class: "homeTile memberOpsTile noticeTile",
3475                  onClick: $event => (go('/notifications'))
3476                }, [
3477                  (store.state.memberUnread)
3478                    ? (_openBlock(), _createElementBlock("span", _hoisted_25, _toDisplayString(store.state.memberUnread), 1))
3479                    : _createCommentVNode("", true),
3480                  _cache[20] || (_cache[20] = _createElementVNode("span", { class: "ico" }, [_createElementVNode("img", {
3481                    class: "smtServiceArt",
3482                    src: "/brand/smt-gold-v1/service-notifications.webp",
3483                    alt: "",
3484                    width: "96",
3485                    height: "96",
3486                    loading: "lazy"
3487                  })], -1)),
3488                  _cache[21] || (_cache[21] = _createElementVNode("b", null, "إشعاراتي", -1)),
3489                  _createElementVNode("small", null, _toDisplayString(store.state.memberUnread?'تحديثات تحتاج مراجعة':'لا توجد تحديثات جديدة'), 1)
3490                ], 8, _hoisted_24),
3491                _createElementVNode("button", {
3492                  class: "homeTile noticeTile",
3493                  onClick: $event => (go('/announcements'))
3494                }, [
3495                  (store.state.announcementUnread)
3496                    ? (_openBlock(), _createElementBlock("span", _hoisted_27, _toDisplayString(store.state.announcementUnread), 1))
3497                    : _createCommentVNode("", true),
3498                  _cache[22] || (_cache[22] = _createElementVNode("span", { class: "ico" }, [_createElementVNode("img", {
3499                    class: "smtServiceArt",
3500                    src: "/brand/smt-gold-v1/service-notifications.webp",
3501                    alt: "",
3502                    width: "96",
3503                    height: "96",
3504                    loading: "lazy"
3505                  })], -1)),
3506                  _cache[23] || (_cache[23] = _createElementVNode("b", null, "الإعلانات", -1)),
3507                  _createElementVNode("small", null, _toDisplayString(store.state.announcementUnread?'إعلانات جديدة':'مركز الإعلانات'), 1)
3508                ], 8, _hoisted_26),
3509                _createElementVNode("button", {
3510                  class: "homeTile",
3511                  onClick: $event => (go('/events'))
3512                }, _cache[24] || (_cache[24] = [_createElementVNode("span", { class: "ico" }, [_createElementVNode("img", {
3513                  class: "smtServiceArt",
3514                  src: "/brand/smt-gold-v1/service-notifications.webp",
3515                  alt: "",
3516                  width: "96",
3517                  height: "96",
3518                  loading: "lazy"
3519                })], -1), _createElementVNode("b", null, "الفعاليات", -1), _createElementVNode("small", null, "أرشيف وأنشطة", -1)]), 8, _hoisted_28),
3520                _createElementVNode("button", {
3521                  class: "homeTile",
3522                  onClick: $event => (go('/about'))
3523                }, _cache[25] || (_cache[25] = [_createElementVNode("span", { class: "ico" }, [_createElementVNode("img", {
3524                  class: "smtServiceArt",
3525                  src: "/brand/smt-gold-v1/service-community.webp",
3526                  alt: "",
3527                  width: "96",
3528                  height: "96",
3529                  loading: "lazy"
3530                })], -1), _createElementVNode("b", null, "عن المنصة", -1), _createElementVNode("small", null, "التعريف والخدمات", -1)]), 8, _hoisted_29),
3531                _createElementVNode("button", {
3532                  class: "homeTile",
3533                  onClick: $event => (go('/account'))
3534                }, _cache[26] || (_cache[26] = [_createElementVNode("span", { class: "ico" }, [_createElementVNode("img", {
3535                  class: "smtServiceArt",
3536                  src: "/brand/smt-gold-v1/service-account.webp",
3537                  alt: "",
3538                  width: "96",
3539                  height: "96",
3540                  loading: "lazy"
3541                })], -1), _createElementVNode("b", null, "حسابي", -1), _createElementVNode("small", null, "ملف البيانات", -1)]), 8, _hoisted_30)
3542              ], 64))
3543            : (_openBlock(), _createElementBlock(_Fragment, { key: 2 }, [_createElementVNode("button", {
3544                class: "homeTile",
3545                onClick: $event => (go('/login'))
3546              }, _cache[27] || (_cache[27] = [_createElementVNode("span", { class: "ico" }, [_createElementVNode("img", {
3547                class: "smtServiceArt",
3548                src: "/brand/smt-gold-v1/service-account.webp",
3549                alt: "",
3550                width: "96",
3551                height: "96",
3552                loading: "lazy"
3553              })], -1), _createElementVNode("b", null, "دخول أو طلب عضوية", -1), _createElementVNode("small", null, "تحقق آمن عبر واتساب", -1)]), 8, _hoisted_31), _createElementVNode("button", {
3554                class: "homeTile",
3555                onClick: $event => (go('/arrival'))
3556              }, _cache[28] || (_cache[28] = [_createElementVNode("span", { class: "ico" }, [_createElementVNode("img", {
3557                class: "smtServiceArt",
3558                src: "/brand/smt-gold-v1/service-arrival.webp",
3559                alt: "",
3560                width: "96",
3561                height: "96",
3562                loading: "lazy"
3563              })], -1), _createElementVNode("b", null, "وصلت حديثاً", -1), _createElementVNode("small", null, "استقبال ومتابعة", -1)]), 8, _hoisted_32), _createElementVNode("button", {
3564                class: "homeTile lockedTile",
3565                onClick: $event => (go('/login'))
3566              }, _cache[29] || (_cache[29] = [_createElementVNode("span", { class: "ico" }, [_createElementVNode("img", {
3567                class: "smtServiceArt",
3568                src: "/brand/smt-gold-v1/service-account.webp",
3569                alt: "",
3570                width: "96",
3571                height: "96",
3572                loading: "lazy"
3573              })], -1), _createElementVNode("b", null, "محتوى الأعضاء", -1), _createElementVNode("small", null, "الخدمات الخاصة بعد الدخول", -1)]), 8, _hoisted_33)], 64)),
3574          _createElementVNode("button", {
3575            class: "homeTile dangerTile endActionTile",
3576            onClick: $event => (go('/emergency'))
3577          }, _cache[30] || (_cache[30] = [_createElementVNode("span", { class: "ico" }, [_createElementVNode("img", {
3578            class: "smtServiceArt",
3579            src: "/brand/smt-gold-v1/service-help.webp",
3580            alt: "",
3581            width: "96",
3582            height: "96",
3583            loading: "lazy"
3584          })], -1), _createElementVNode("b", null, "بلاغ متابعة", -1), _createElementVNode("small", null, "متابعة داخل الشركة للأعضاء", -1)]), 8, _hoisted_34),
3585          _createElementVNode("button", {
3586            class: "homeTile endActionTile",
3587            onClick: $event => (go('/help'))
3588          }, _cache[31] || (_cache[31] = [_createElementVNode("span", { class: "ico" }, [_createElementVNode("img", {
3589            class: "smtServiceArt",
3590            src: "/brand/smt-gold-v1/service-help.webp",
3591            alt: "",
3592            width: "96",
3593            height: "96",
3594            loading: "lazy"
3595          })], -1), _createElementVNode("b", null, "أحتاج مساعدة", -1), _createElementVNode("small", null, "طلب دعم", -1)]), 8, _hoisted_35),
3596          (store.state.me&&store.state.me.authenticated&&store.state.me.member)
3597            ? (_openBlock(), _createElementBlock("button", {
3598                key: 3,
3599                class: "homeTile feedbackTile endActionTile",
3600                onClick: $event => (go('/feedback'))
3601              }, _cache[32] || (_cache[32] = [_createElementVNode("span", { class: "ico" }, [_createElementVNode("img", {
3602                class: "smtServiceArt",
3603                src: "/brand/smt-gold-v1/service-help.webp",
3604                alt: "",
3605                width: "96",
3606                height: "96",
3607                loading: "lazy"
3608              })], -1), _createElementVNode("b", null, "ملاحظات واقتراحات", -1), _createElementVNode("small", null, "ساعدنا نطور المنصة", -1)]), 8, _hoisted_36))
3609            : _createCommentVNode("", true)
3610        ])
3611      ]),
3612      _: 1
3613    }, 8, ["home"]))
3614  }
3615}
3616})()
3617  };
3618
3619
3620
3621  const ChinaGuidePage={
3622    components:{PublicFrame},
3623    setup(){
3624      const store=useGzcStore(); const router=useRouter();
3625      const taxonomyV2=ref(false); const categories=ref([]); const items=ref([]); const pagination=ref(null); const itemsQuery=ref(''); const loadingMore=ref(false); const GUIDE_PAGE_SIZE=20; const totalCount=computed(()=>pagination.value&&Number.isFinite(Number(pagination.value.total))?Number(pagination.value.total):items.value.length); const hubs=ref([]); const growthHubs=ref({city_hubs:[],topic_hubs:[],total:0}); const selected=ref(null); const reportText=ref('');
3626      const loading=ref(true); const loaded=ref(false); const loadError=ref('');
3627      const searchMeta=ref(null); const autoSuggestions=ref([]); const autoOpen=ref(false); const autoIndex=ref(-1);
3628      const recentSearches=ref([]);
3629      const guideJourneys=[
3630        {key:'just_arrived',icon:'🛬',label:'وصلت للتو'},
3631        {key:'papers',icon:'🛂',label:'أوراق وإقامة'},
3632        {key:'daily_life',icon:'🏠',label:'الحياة اليومية'},
3633        {key:'trade',icon:'🏬',label:'تجارة وشحن'}
3634      ];
3635      const guideCities=computed(()=>safeArray(growthHubs.value.city_hubs)
3636        .filter(x=>String(x.city_key||x.key||'').trim())
3637        .slice(0,12)
3638        .map(x=>({
3639          key:String(x.city_key||x.key||''),
3640          label:cityLabel(x),
3641          zh:String(x.label_zh||x.name_zh||'')
3642        })));
3643      const featuredAreas=[
3644        {key:'Xiaobei',city:'Guangzhou',label:'شياوبي',zh:'小北',q:'شياوبي'},
3645        {key:'Sanyuanli',city:'Guangzhou',label:'سانيوانلي',zh:'三元里',q:'سانيوانلي'},
3646        {key:'GuangzhouRailwayStation',city:'Guangzhou',label:'محطة قطار قوانغتشو',zh:'广州火车站',q:'محطة قطار قوانغتشو'},
3647        {key:'Pazhou',city:'Guangzhou',label:'باتشو',zh:'琶洲',q:'باتشو'},
3648        {key:'Lecong',city:'Foshan',label:'ليكونغ',zh:'乐从',q:'ليكونغ'},
3649        {key:'YiwuInternationalTradeCity',city:'Yiwu',label:'فوتيان / ييوو',zh:'义乌国际商贸城',q:'مدينة ييوو للتجارة الدولية'}
3650      ];
3651      const brokenGuideImages=reactive({});
3652      let autoTimer=null;
3653      const route=useRoute();
3654      function routeHub(){
3655        const p=String(route.path||'');
3656        if(p.indexOf('/trade-shipping')===0) return 'trade_shipping';
3657        if(p.indexOf('/sudan-digital')===0) return 'sudan_digital';
3658        return 'china_guide';
3659      }
3660      function routeGrowthType(){const p=String(route.path||'');return p.includes('/city/')?'city':(p.includes('/topic/')?'topic':'');}
3661      function routeGrowthValue(){return String(route.params&& (route.params.city||route.params.service)||'').trim().toLowerCase();}
3662      const filters=reactive({search:'',category:'',city:'',area:'',hub:routeHub(),direction:'',service_type:'',origin_country:'',destination_country:'',company_
3662sector:'',journey:'',community:'',diet:''});
3663      const tradeMeta=ref({countries:[],services:[],coverage:[]});
3664      const tradeMetaLoaded=ref(false);
3665      const tradeCountries=computed(()=>safeArray(tradeMeta.value.countries));
3666      // Company sectors (registry-driven). The chips only appear inside the companies category.
3667      const companySectors=ref({enabled:false,featured:[],sectors:[]});
3668      const sectorsLoaded=ref(false);const showAllSectors=ref(false);
3669      const SECTOR_FEATURED_LIMIT=8;
3670      const tradeOriginIsDefault=computed(()=>!!filters.origin_country&&filters.origin_country===String(tradeMeta.value.default_origin||''));
3671      function sectorLabel(key){const row=safeArray(companySectors.value.sectors).find(x=>x.sector_key===key);return row?row.name_ar:String(key||'');}
3672      const isCompaniesCategory=computed(()=>['china-companies-business-services','companies_business'].includes(String(filters.category||'')));
3673      const sectorChips=computed(()=>safeArray(showAllSectors.value?companySectors.value.sectors:companySectors.value.featured).slice(0,showAllSectors.value?200:SECTOR_FEATURED_LIMIT));
3674      async function loadCompanySectors(){
3675        if(sectorsLoaded.value)return;
3676        sectorsLoaded.value=true;
3677        const r=await api('/api/company-sectors',{feedback:false});
3678        if(r&&r.ok&&r.enabled)companySectors.value={enabled:true,featured:safeArray(r.featured),sectors:safeArray(r.sectors)};
3679      }
3680      function pickSector(key){filters.company_sector=filters.company_sector===key?'':String(key||'');load();}
3681      // Trade search understanding («شحن بحري من الصين للسعودية»): shown as a one-tap route suggestion.
3682      const tradeHint=ref(null);
3683      let tradeHintSequence=0;
3684      async function resolveTradeHint(){
3685        const sequence=++tradeHintSequence;
3686        tradeHint.value=null;
3687        const text=String(filters.search||'').trim();
3688        if(filters.hub!=='trade_shipping'||text.length<3)return;
3689        const r=await api('/api/trade/resolve?q='+encodeURIComponent(text),{feedback:false});
3690        // A slower answer for an older query must never replace a newer one.
3691        if(sequence!==tradeHintSequence||text!==String(filters.search||'').trim())return;
3692        const found=r&&r.ok&&r.enabled?r.resolved:null;
3693        if(found&&found.understood&&(found.destination||found.service_type))tradeHint.value={origin:found.origin||'',destination:found.destination||'',service_type:found.service_type||''};
3694      }
3695      // The service is applied only when the registry covers it for that route; otherwise the route
3696      // alone is applied (an uncovered service would otherwise produce an empty page).
3697      function hintService(hint){
3698        if(!hint.service_type||!hint.origin||!hint.destination)return '';
3699        const covered=safeArray(tradeMeta.value.coverage).some(x=>String(x.origin_country_code)===hint.origin&&String(x.destination_country_code)===hint.destination&&String(x.service_type)===hint.service_type);
3700        return covered?hint.service_type:'';
3701      }
3702      function applyTradeHint(){
3703        const hint=tradeHint.value;if(!hint)return;
3704        if(hint.origin)filters.origin_country=hint.origin;
3705        if(hint.destination)filters.destination_country=hint.destination;
3706        filters.service_type=hintService(hint);
3707        filters.search='';tradeHint.value=null;tradeHintSequence++;load();
3708      }
3709      function tradeHintLabel(){
3710        const hint=tradeHint.value;if(!hint)return '';
3711        const route=[hint.origin&&tradeCountryLabel(hint.origin),hint.destination&&tradeCountryLabel(hint.destination)].filter(Boolean).join(' ← ');
3712        return [route,hint.service_type&&tradeServiceLabel(hint.service_type)].filter(Boolean).join(' · ');
3713      }
3714
3715      function tradeCountryLabel(code){
3716        const row=tradeCountries.value.find(x=>String(x.code||'').toUpperCase()===String(code||'').toUpperCase());
3717        return row?(row.name_ar||row.name_en||row.code):String(code||'');
3718      }
3719
3720      const tradeRouteServices=computed(()=>{
3721        const from=String(filters.origin_country||'').toUpperCase();
3722        const to=String(filters.destination_country||'').toUpperCase();
3723        if(!from||!to||from===to)return [];
3724        const allowed=new Set(
3725          safeArray(tradeMeta.value.coverage)
3726            .filter(x=>String(x.origin_country_code||'').toUpperCase()===from&&String(x.destination_country_code||'').toUpperCase()===to)
3727            .map(x=>String(x.service_type||''))
3728        );
3729        return safeArray(tradeMeta.value.services).filter(x=>allowed.has(String(x.service_type||''))&&String(x.service_type||'')!=='general');
3730      });
3731
3732      const tradeRouteSupported=computed(()=>{
3733        const from=String(filters.origin_country||'').toUpperCase();
3734        const to=String(filters.destination_country||'').toUpperCase();
3735        if(!from||!to||from===to)return false;
3736        return safeArray(tradeMeta.value.coverage).some(x=>String(x.origin_country_code||'').toUpperCase()===from&&String(x.destination_country_code||'').toUpperCase()===to);
3737      });
3738
3739      function tradeSelectedRouteLabel(){
3740        if(!filters.origin_country||!filters.destination_country)return '';
3741        return tradeCountryLabel(filters.origin_country)+' → '+tradeCountryLabel(filters.destination_country);
3742      }
3743
3744      function tradeServiceLabel(key){
3745        const row=safeArray(tradeMeta.value.services).find(x=>String(x.service_type||'')===String(key||''));
3746        return row?(row.name_ar||row.name_en||row.service_type):guideServiceLabel(key);
3747      }
3748
3749      async function loadTradeMeta(){
3750        if(filters.hub!=='trade_shipping')return true;
3751        if(tradeMetaLoaded.value){
3752          if(!filters.origin_country&&tradeMeta.value.default_origin)filters.origin_country=tradeMeta.value.default_origin;
3753          return true;
3754        }
3755        const r=await api('/api/china-guide/trade-meta');
3756        if(!r||!r.ok)return false;
3757        tradeMeta.value={
3758          countries:safeArray(r.countries),
3759          services:safeArray(r.services),
3760          coverage:safeArray(r.coverage),
3761          default_origin:String(r.default_origin||'')
3762        };
3763        if(!filters.origin_country&&tradeMeta.value.default_origin)filters.origin_country=tradeMeta.value.default_origin;
3764        tradeMetaLoaded.value=true;
3765        return true;
3766      }
3767
3768      function pickTradeService(key){
3769        const value=String(key||'');
3770        filters.service_type=filters.service_type===value?'':value;
3771        load();
3772      }
3773
3774      function clearTradeRoute(){
3775        filters.origin_country=String(tradeMeta.value.default_origin||'');
3776        filters.destination_country='';
3777        filters.service_type='';
3778        load();
3779      }
3780      const tradeNeedCategories=computed(()=>safeArray(categories.value).filter(c=>
3781        Number(c.item_count||0)>0 &&
3782        !['trade-china-to-sudan','trade-sudan-to-china'].includes(String(c.slug||''))
3783      ));
3784      function applyGrowthRouteFilters(){
3785        const type=routeGrowthType(),value=routeGrowthValue();
3786        if(type==='city'&&filters.hub==='china_guide'){const row=safeArray(growthHubs.value.city_hubs).find(x=>String(x.key||x.city_key||'').toLowerCase()===value);filters.city=row&&(row.city_key||row.key)||'';}
3787        if(type==='topic'&&filters.hub==='trade_shipping'){filters.service_type=value;}
3788      }
3789      const suggestion=reactive({title:'',category:'',details:''});
3790      const sudanPortalSections=[
3791        {slug:'sudan-identity-passports',icon:'🪪',title:'الهوية والجوازات',desc:'سوداباس، الجوازات، الرقم الوطني والسجل المدني.'},
3792        {slug:'sudan-visas-immigration',icon:'🛂',title:'التأشيرات والهجرة',desc:'التأشيرات، وثائق السفر وإجراءات الدخول والخروج.'},
3793        {slug:'sudan-embassies-consulates',icon:'🏛️',title:'السفارات والقنصليات',desc:'المعاملات القنصلية والبعثات السودانية بالخارج.'},
3794        {slug:'sudan-civil-services',icon:'📋',title:'الخدمات المدنية',desc:'الخدمات الحكومية والوثائق والإجراءات العامة.'},
3795        {slug:'sudan-education-certificates',icon:'🎓',title:'التعليم والشهادات',desc:'الشهادات والتوثيق والخدمات التعليمية الرسمية.'},
3796        {slug:'sudan-health-medical',icon:'🏥',title:'الصحة والخدمات الطبية',desc:'الخدمات الصحية والمنصات والجهات الطبية الرسمية.'},
3797        {slug:'sudan-banking-remittances',icon:'💳',title:'البنوك والتحويلات',desc:'التعاميم المصرفية والتحويلات ونظم الدفع.'},
3798        {slug:'sudan-taxes-customs',icon:'🧾',title:'الضرائب والجمارك',desc:'الوارد والصادر وACD والإجراءات الجمركية.'},
3799        {slug:'sudan-investment-companies',icon:'🏢',title:'الاستثمار وتأسيس الشركات',desc:'التراخيص والسجل التجاري وخدمات المستثمرين.'},
3800        {slug:'sudan-ports-aviation',icon:'✈️',title:'الموانئ والطيران',desc:'الموانئ والمطارات والجهات التشغيلية الرسمية.'},
3801        {slug:'sudan-laws-alerts',icon:'⚖️',title:'القوانين والتنبيهات الرسمية',desc:'القرارات والتعاميم والتنبيهات من مصادرها.'},
3802        {slug:'sudan-diaspora-services',icon:'🌍',title:'خدمات السودانيين بالخارج',desc:'الخدمات والوثائق والمساندة الموجهة للمغتربين.'}
3803      ];
3804      const member=computed(()=>store.state.me&&store.state.me.authenticated&&store.state.me.member);
3805      const smartSearchActive=computed(()=>['china_guide','trade_shipping'].includes(filters.hub)&&(String(filters.search||'').trim().length>0||String(filters.area||'').trim().length>0));
3806      const visibleFeaturedAreas=computed(()=>filters.hub==='china_guide'&&filters.city?featuredAreas.filter(a=>String(a.city||'').toLowerCase()===String(filters.city||'').toLowerCase()):[]);
3807      const populatedCategories=computed(()=>categories.value.filter(c=>Number(c.item_count||0)>0));
3808      const emptyCategories=computed(()=>categories.value.filter(c=>Number(c.item_count||0)===0));
3809      function sectionCount(slug){const c=categories.value.find(x=>x.slug===slug);return Number(c&&c.item_count||0);}
3810      const populatedSudanSections=computed(()=>sudanPortalSections.filter(sec=>sectionCount(sec.slug)>0));
3811      const emptySudanSections=computed(()=>sudanPortalSections.filter(sec=>sectionCount(sec.slug)===0));
3812      async function load(){
3813        loading.value=true;loadError.value='';store.state.busy=true;
3814        if(filters.hub==='trade_shipping'){
3815          const metaOk=await loadTradeMeta();
3816          if(!metaOk){
3817            loadError.value='تعذر تحميل خيارات التجارة والشحن الآن. أعد المحاولة.';
3818            loaded.value=true;
3819            loading.value=false;
3820            store.state.busy=false;
3821            return;
3822          }
3823        }
3824        const growthRequest=['china_guide','trade_shipping'].includes(filters.hub)?api('/api/china-guide/growth-hubs?hub='+encodeURIComponent(filters.hub)):Promise.resolve({ok:true,city_hubs:[],topic_hubs:[],total:0});
3825        const first=await Promise.all([api('/api/knowledge/summary'),api('/api/china-guide/categories?hub='+encodeURIComponent(filters.hub||'')),growthRequest]);
3826        if(first.every(x=>x&&x.ok)){
3827          hubs.value=safeArray(first[0].hubs);categories.value=safeArray(first[1].categories);growthHubs.value={city_hubs:safeArray(first[2].city_hubs),topic_hubs:safeArray(first[2].topic_hubs),total:Number(first[2].total||0)};
3828          const tax=filters.hub==='china_guide'?await api('/api/china-guide/taxonomy'):{enabled:false};
3829          taxonomyV2.value=tax.enabled===true&&tax.version===2;
3830          if(taxonomyV2.value){categories.value=safeArray(tax.categories);growthHubs.value.topic_hubs=[];}
3831          applyGrowthRouteFilters();
3832          if(route.query.category_key)filters.category=String(route.query.category_key);
3833          else if(route.query.category)filters.category=String(route.query.category);
3834
3835          const qs=new URLSearchParams({search:filters.search||'',category:filters.category||'',city:filters.city||'',area:filters.area||'',hub:filters.hub||'',direction:filters.direction||'',service_type:filters.hub==='china_guide'?'':(filters.service_type||''),page:'1',page_size:String(GUIDE_PAGE_SIZE)});
3836          if(filters.hub==='trade_shipping'){
3837            if(filters.origin_country)qs.set('origin_country',String(filters.origin_country));
3838            if(filters.destination_country)qs.set('destination_country',String(filters.destination_country));
3839          }
3840          if(filters.hub==='china_guide'&&filters.company_sector)qs.set('company_sector',String(filters.company_sector));
3841          qs.set('taxonomy',taxonomyV2.value?'2':'1');
3842          if(!taxonomyV2.value&&route.query.category_key){const legacy={emergency:'china-emergency',visa_residence:'china-residence-immigration',gov_consulate:'china-government-services',health:'china-health-pharmacies',transport:'china-transport',payments:'china-payments-banking',telecom:'china-telecom-internet',education:'china-education-universities',markets:'china-business-markets',logistics:'china-shipping-logistics',hotels:'china-hotels-accommodation',housing:'china-hotels-accommodation',restaurants:'china-tourism-restaurants',tourism:'china-tourism-restaurants',worship:'china-tourism-restaurants',exhibitions:'china-exhibitions-conferences'};qs.set('category',legacy[route.query.category_key]||'');}
3843          if(!taxonomyV2.value&&route.query.community==='sudanese')qs.set('category','china-sudanese-services');
3844          if(taxonomyV2.value){
3845            if(filters.community)qs.set('community',String(filters.community));
3846            if(filters.journey)qs.set('journey',String(filters.journey));
3847            if(filters.diet)qs.set('diet',String(filters.diet));
3848            for(const key of ['cuisine','sector'])if(route.query[key])qs.set(key,String(route.query[key]));
3849          }
3850          qs.delete('page');qs.delete('page_size');itemsQuery.value=qs.toString();
3851          qs.set('page','1');qs.set('page_size',String(GUIDE_PAGE_SIZE));
3852          const itemResult=await api('/api/china-guide/items?'+qs.toString());
3853          if(itemResult&&itemResult.ok){items.value=safeArray(itemResult.items);searchMeta.value=itemResult.search||null;pagination.value=itemResult.pagination||null;}else loadError.value='تعذر تحميل البيانات الآن. تحقق من الاتصال ثم أعد المحاولة.';
3854        }else loadError.value='تعذر تحميل البيانات الآن. تحقق من الاتصال ثم أعد المحاولة.';
3855        loaded.value=true;loading.value=false;store.state.busy=false;autoOpen.value=false;autoIndex.value=-1;
3856        if(filters.hub==='china_guide')loadCompanySectors();
3857        resolveTradeHint();
3858      }
3859      // "Load more": next page of the same filters, appended without duplicates.
3860      async function loadMoreItems(){
3861        const current=pagination.value;
3862        if(!current||!current.has_more||loadingMore.value)return;
3863        loadingMore.value=true;
3864        const expectedQuery=itemsQuery.value;
3865        const qs=new URLSearchParams(expectedQuery);qs.set('page',String(current.page+1));qs.set('page_size',String(current.page_size||GUIDE_PAGE_SIZE));
3866        const result=await api('/api/china-guide/items?'+qs.toString(),{feedback:false});
3867        loadingMore.value=false;
3868        // The member changed filters while this page was loading: drop the stale page instead of mixing result sets.
3869        if(expectedQuery!==itemsQuery.value)return;
3870        if(!result||!result.ok){store.state.msg='تعذر تحميل المزيد الآن. حاول مرة أخرى.';return;}
3871        const known=new Set(items.value.map(row=>String(row.id)));
3872        items.value=[...items.value,...safeArray(result.items).filter(row=>!known.has(String(row.id)))];
3873        pagination.value=result.pagination||current;
3874      }
3875      function pickHub(key){filters.hub=key;filters.search='';filters.category='';filters.city='';filters.area='';filters.direction='';filters.service_type='';filters.origin_country='';filters.company_sector='';filters.destination_country='';filters.journey='';filters.community='';filters.diet='';searchMeta.value=null;autoSuggestions.value=[];recentSearches.value=readRecentSearches(key);load();}
3876      function pickCat(slug){filters.category=filters.category===slug?'':slug;selected.value=null;load();}
3877      function clearGuideFilters(){filters.search='';filters.category='';filters.city='';filters.area='';filters.direction='';filters.service_type='';filters.origin_country='';filters.company_sector='';filters.destination_country='';filters.journey='';filters.community='';filters.diet='';selected.value=null;searchMeta.value=null;autoSuggestions.value=[];autoOpen.value=false;load();}
3878      function activeFilterCount(){return [filters.search,filters.category,filters.city,filters.area,filters.hub==='china_guide'?'':filters.service_type,filters.hub==='trade_shipping'&&filters.origin_country!==tradeMeta.value.default_origin?filters.origin_country:'',filters.hub==='trade_shipping'?filters.destination_country:'',filters.company_
3878sector,filters.direction,filters.journey,filters.community,filters.diet].filter(Boolean).length;}
3879      function cityFilterLabel(){const row=guideCities.value.find(c=>String(c.key).toLowerCase()===String(filters.city||'').toLowerCase());return row&&row.label||filters.city||'';}
3880      function areaFilterLabel(){const row=featuredAreas.find(a=>a.key===filters.area);return row&&row.label||filters.area||'';}
3881      function serviceFilterLabel(){return guideServiceLabel(filters.service_type);}
3882      function tradeDirectionLabel(x){
3883        const v=String((x&&x.direction)||x||'');
3884        return v==='china_to_arab'
3885          ?'الصين → الدول العربية'
3886          :(v==='arab_to_china'?'الدول العربية → الصين':'الاتجاهين');
3887      }
3888      function pickTradeNeed(slug){
3889        const next=filters.category===slug?'':slug;
3890        if(routeGrowthType()==='topic'){
3891          router.push({
3892            path:'/trade-shipping',
3893            query:next?{category:next}:{}
3894          });
3895          return;
3896        }
3897        filters.category=next;
3898        filters.service_type='';
3899        selected.value=null;
3900        load();
3901      }
3902      function openTradeServiceRequest(){
3903          const query={service_type:'shipping_logistics'};
3904          const routeLabel=tradeSelectedRouteLabel();
3905          if(routeLabel)query.route_label=routeLabel;
3906          router.push({path:'/procurement/new',query});
3907        }
3908        function pickSudanSection(slug){filters.category=slug;filters.search='';load();}
3909      function clearSudanSection(){filters.category='';selected.value=null;load();}
3910      function currentSudanSection(){return sudanPortalSections.find(x=>x.slug===filters.category)||null;}
3911      function growthRouteHub(){const type=routeGrowthType(),value=routeGrowthValue();const list=type==='city'?safeArray(growthHubs.value.city_hubs):safeArray(growthHubs.value.topic_hubs);return list.find(x=>String(x.key||'').toLowerCase()===value)||null;}
3912      function isGrowthRoot(){return !routeGrowthType();}
3913      function hubTitle(){const gh=growthRouteHub();if(gh)return gh.type==='city'?cityLabel(gh):gh.title_ar||gh.label_ar||'دليلك في الصين';return (hubs.value.find(h=>h.key===filters.hub)||{}).title||'دليلك في الصين'}
3914      function itemTitle(x){return x.title_ar||x.title_en||x.title_zh||'عنصر في الدليل';}
3915      function itemSummary(x){return x.summary_ar||x.summary_en||x.description_ar||x.description_en||'';}
3916      function guideImageUrl(x,kind='thumb'){
3917        const candidates=kind==='main'?[x&&x.image_url,x&&x.image_thumb_url]:[x&&x.image_thumb_url,x&&x.image_url];
3918        return candidates.find(url=>url&&!brokenGuideImages[String(url)])||'';
3919      }
3920      function markGuideImageBroken(url){if(url)brokenGuideImages[String(url)]=true;}
3921      function addressOf(x){return x.address_zh||x.address_ar||x.address_en||'';}
3922      async function copyAddress(x){try{await navigator.clipboard.writeText(addressOf(x));store.state.msg='تم نسخ العنوان';}catch(e){store.state.msg='لم يتم النسخ تلقائياً. انسخ العنوان يدوياً.';}}
3923      function openMap(x){openAmapAppPlace(x,message=>{store.state.msg=message;});}
3924      async function sendReport(x){const msg=String(reportText.value||'').trim(); if(!msg){store.state.msg='اكتب التصحيح أولاً';return;} store.state.busy=true;const r=await api('/api/china-guide/items/'+encodeURIComponent(x.id)+'/report',{method:'POST',body:JSON.stringify({message:msg,hub_key:filters.hub})});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok)reportText.value='';}
3925      async function sendSuggestion(){if(!member.value){try{sessionStorage.setItem('gzc_vue_next','/china-guide')}catch(e){} router.push('/login'); return;} if(!suggestion.title||!suggestion.details){store.state.msg='اكتب اسم المكان والتفاصيل';return;} store.state.busy=true;const r=await api('/api/china-guide/suggestions',{method:'POST',body:JSON.stringify(suggestion)});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok){suggestion.title='';suggestion.category='';suggestion.details='';}}
3926      function scheduleSuggestions(){
3927        if(autoTimer)clearTimeout(autoTimer);
3928        autoIndex.value=-1;
3929        if(!['china_guide','trade_shipping'].includes(filters.hub)||!String(filters.search||'').trim()){autoSuggestions.value=[];autoOpen.value=false;return;}
3930        // Search is universal inside each knowledge hub. A previously opened category
3931        // must never silently hide a relevant result. Direction remains an explicit trade filter.
3932        filters.category='';filters.service_type='';
3933        autoTimer=setTimeout(async()=>{
3934          const q=String(filters.search||'').trim();
3935          const r=await api('/api/china-guide/search-suggestions?q='+encodeURIComponent(q)+'&city='+encodeURIComponent(filters.city||'')+'&area='+encodeURIComponent(filters.area||'')+'&hub='+encodeURIComponent(filters.hub));
3936          if(q!==String(filters.search||'').trim())return;
3937          autoSuggestions.value=r&&r.ok?safeArray(r.suggestions):[];autoOpen.value=autoSuggestions.value.length>0;
3938        },180);
3939      }
3940      async function chooseAutocomplete(s){
3941        if(!s)return;
3942        filters.search=s.query||s.label||filters.search;
3943        rememberSearch(filters.search);
3944        if(s.city){filters.city=s.city;if(filters.area&&!featuredAreas.some(a=>a.key===filters.area&&a.city===s.city))filters.area='';} if(s.area)filters.area=s.area;
3945        autoOpen.value=false;autoSuggestions.value=[];autoIndex.value=-1;
3946        await load();
3947        if(s.item_id)selected.value=s.item_id;
3948      }
3949      function closeSuggestionsSoon(){setTimeout(()=>{autoOpen.value=false;autoIndex.value=-1;},160);}
3950      function recentStorageKey(hub){return 'gzc_recent_searches_'+String(hub||'china_guide');}
3951      function readRecentSearches(hub){try{const raw=JSON.parse(sessionStorage.getItem(recentStorageKey(hub))||'[]');
3951return Array.isArray(raw)?raw.filter(Boolean).slice(0,5):[];}catch(_){return [];}}
3952      function rememberSearch(query){const value=String(query||'').trim().slice(0,80);if(!value)return;const next=[value,...recentSearches.value.filter(x=>String(x).toLowerCase()!==value.toLowerCase())].slice(0,5);recentSearches.value=next;try{sessionStorage.setItem(recentStorageKey(filters.hub),JSON.stringify(next));}catch(_){}}
3953      function popularTerms(){return filters.hub==='trade_shipping'?[{q:'شحن بحري',icon:'🚢'},{q:'التخليص الجمركي',icon:'🧾'},{q:'مستندات الشحن',icon:'📄'},{q:'HS Code',icon:'🏛️'},{q:'الموانئ',icon:'⚓'}]:[{q:'الأسواق',icon:'🏬'},{q:'المعارض والمؤتمرات',icon:'🗓️'},{q:'المطاعم',icon:'🍽️'},{q:'الفنادق',icon:'🏨'},{q:'المستشفيات',icon:'🏥'},{q:'مترجم',icon:'🗣️'},{q:'الشحن واللوجستيات',icon:'🚢'}];}
3954      async function runSearch(){rememberSearch(filters.search);autoOpen.value=false;await load();}
3955      function searchKeydown(e){
3956        if(e.key==='ArrowDown'&&autoSuggestions.value.length){e.preventDefault();autoOpen.value=true;autoIndex.value=(autoIndex.value+1)%autoSuggestions.value.length;return;}
3957        if(e.key==='ArrowUp'&&autoSuggestions.value.length){e.preventDefault();autoOpen.value=true;autoIndex.value=(autoIndex.value<=0?autoSuggestions.value.length:autoIndex.value)-1;return;}
3958        if(e.key==='Escape'){autoOpen.value=false;autoIndex.value=-1;return;}
3959        if(e.key==='Enter'){e.preventDefault();const s=autoOpen.value&&autoIndex.value>=0?autoSuggestions.value[autoIndex.value]:null;s?chooseAutocomplete(s):runSearch();}
3960      }
3961      function popularSearch(query){filters.search=query;filters.category='';filters.service_type='';autoOpen.value=false;rememberSearch(query);load();}
3962      function pickFeaturedCity(city){const next=filters.city===city?'':city;filters.city=next;filters.area='';load();}
3963      function pickFeaturedArea(area){if(!area)return;filters.city=area.city||filters.city||'';filters.area=filters.area===area.key?'':area.key;autoOpen.value=false;load();}
3964      function pickJourney(key){filters.journey=filters.journey===key?'':key;selected.value=null;load();}
3965      function pickDiet(key){filters.diet=filters.diet===key?'':key;selected.value=null;load();}
3966      function journeyFilterLabel(){const row=guideJourneys.find(x=>x.key===filters.journey);return row&&row.label||filters.journey||'';}
3967      function categoryFilterLabel(){const row=categories.value.find(x=>String(x.slug||x.key||x.category_key||'')===String(filters.category||''));return row&&row.name_ar||filters.category||'';}
3968      function callPlace(x){const phone=String(x&&x.phone||'').trim();if(!phone){store.state.msg='لا يوجد رقم اتصال موثق لهذا المكان';return;}const dial=phone.split('/')[0].replace(/[^+0-9]/g,'');if(dial)window.location.href='tel:'+dial;}
3969      function detailRoute(x){
3970        if(!x||!x.id)return '/china-guide';
3971        const base=filters.hub==='trade_shipping'?'/trade-shipping':(filters.hub==='sudan_digital'?'/sudan-digital':'/china-guide');
3972        const ctx=searchMeta.value&&searchMeta.value.quality_context;
3973        const query=smartSearchActive.value&&ctx?{from_search:'1',search_hub:String(ctx.hub_key||filters.hub||''),search_intent:String(ctx.intent_key||'unclassified'),search_city:String(ctx.city_key||''),search_service:String(ctx.service_type||'')}:{};
3974        if(filters.hub==='trade_shipping'){
3975          if(filters.origin_country)query.origin_country=String(filters.origin_country);
3976          if(filters.destination_country)query.destination_country=String(filters.destination_country);
3977          const routeLabel=tradeSelectedRouteLabel();
3978          if(routeLabel)query.route_label=routeLabel;
3979        }
3980        return {path:base+'/'+encodeURIComponent(x.id),query};
3981      }
3982      function openDetail(x){if(!x||!x.id)return;router.push(detailRoute(x));}
3983      function hubExperience(){return filters.hub==='trade_shipping'?{eyebrow:'الأعمال من الصين',image:'/brand/smt-gold-v1/service-shipping.webp',alt:'التجارة والشحن',points:['توريد وفحص','شحن ولوجستيات','جمارك ومستندات']}:{eyebrow:'الحياة في الصين',image:'/brand/smt-gold-v1/service-guide.webp',alt:'دليلك في الصين',points:['أماكن موثقة','صور وعناوين','بحث عربي · English · 中文']};}
3984      function openAskSearch(){const q=String(filters.search||'').trim();router.push(q?{path:'/ask',query:{q}}:{path:'/ask'});}
3985      function resultTrustLabel(x){return x&&x.trust_tier==='official'?'مصدر رسمي':(x&&x.trust_tier==='smt_verified'?'موثق من SMT':(x&&x.verification_status==='verified'?'معلومة موثقة':'معلومة منشورة'));}
3986      onMounted(async()=>{filters.hub=routeHub();filters.journey=String(route.query.journey||'');filters.community=String(route.query.community||'');filters.diet=String(route.query.diet||'');recentSearches.value=readRecentSearches(filters.hub);await store.loadMe();await load();});
3987      onUnmounted(()=>
3987{if(autoTimer)clearTimeout(autoTimer);});
3988      watch(()=>route.fullPath,async()=>{const h=routeHub();filters.hub=h;filters.search='';filters.category='';filters.city='';filters.area='';filters.direction='';filters.service_type='';filters.origin_country='';filters.company_sector='';filters.destination_country='';filters.journey=String(route.query.journey||'');filters.community=String(route.query.community||'');filters.diet=String(route.query.diet||'');growthHubs.value={city_hubs:[],topic_hubs:[],total:0};selected.value=null;searchMeta.value=null;autoSuggestions.value=[];autoOpen.value=false;recentSearches.value=readRecentSearches(h);await load();});
3989      function searchPlaceholder(){return filters.hub==='trade_shipping'?'ابحث: ACD، حاويات، تخليص، موانئ، HS Code...':(filters.hub==='sudan_digital'?'ابحث: Bankak، SudaPass، جوازات، منصة حكومية...':'مثال: معرض كانتون، مطاعم شياوبي، فنادق 小北، أسواق ييوو...')}
3990      return {tradeOriginIsDefault,sectorLabel,companySectors,isCompaniesCategory,sectorChips,showAllSectors,pickSector,tradeHint,applyTradeHint,tradeHintLabel,pagination,totalCount,loadingMore,loadMoreItems,store,router,categories,populatedCategories,emptyCategories,items,hubs,growthHubs,growthRouteHub,isGrowthRoot,filters,selected,reportText,suggestion,sudanPortalSections,populatedSudanSections,emptySudanSections,sectionCount,member,loading,loaded,loadError,searchMeta,autoSuggestions,autoOpen,autoIndex,recentSearches,taxonomyV2,guideJourneys,guideCities,tradeNeedCategories,tradeCountries,tradeRouteServices,tradeRouteSupported,featuredAreas,visibleFeaturedAreas,smartSearchActive,load,runSearch,pickHub,pickCat,clearGuideFilters,activeFilterCount,cityFilterLabel,areaFilterLabel,serviceFilterLabel,pickSudanSection,clearSudanSection,currentSudanSection,hubTitle,searchPlaceholder,itemTitle,itemSummary,guideImageUrl,markGuideImageBroken,addressOf,copyAddress,openMap,sendReport,sendSuggestion,scheduleSuggestions,chooseAutocomplete,closeSuggestionsSoon,searchKeydown,popularSearch,popularTerms,pickTradeNeed,pickTradeService,clearTradeRoute,openTradeServiceRequest,tradeDirectionLabel,tradeCountryLabel,tradeSelectedRouteLabel,tradeServiceLabel,pickFeaturedCity,pickFeaturedArea,pickJourney,pickDiet,journeyFilterLabel,categoryFilterLabel,guideServiceLabel,callPlace,detailRoute,openDetail,hubExperience,openAskSearch,resultTrustLabel,compactContentExcerpt,shortDate};
3991    },
3992    render:(function(){
3993const _Vue = Vue
3994const { createVNode: _createVNode, createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
3995
3996const _hoisted_1 = { class: "hubExperienceCopy" }
3997const _hoisted_2 = { class: "sectionEyebrow" }
3998const _hoisted_3 = { key: 0 }
3999const _hoisted_4 = { key: 1 }
4000const _hoisted_5 = {
4001  class: "hubPromiseRow",
4002  "aria-label": "مزايا القسم"
4003}
4004const _hoisted_6 = { class: "hubPromiseText" }
4005const _hoisted_7 = { class: "hubExperienceArt" }
4006const _hoisted_8 = ["src", "alt"]
4007const _hoisted_9 = { key: 1 }
4008const _hoisted_10 = {
4009  key: 0,
4010  class: "card loadingState",
4011  role: "status"
4012}
4013const _hoisted_11 = {
4014  key: 1,
4015  class: "card errorState",
4016  role: "alert"
4017}
4018const _hoisted_12 = ["onClick"]
4019const _hoisted_13 = {
4020  key: 2,
4021  class: "sudanHubGrid"
4022}
4023const _hoisted_14 = { class: "sudanHubIcon" }
4024const _hoisted_15 = ["onClick"]
4025const _hoisted_16 = {
4026  key: 0,
4027  class: "card comingSoonCategories"
4028}
4029const _hoisted_17 = { class: "comingSoonList" }
4030const _hoisted_18 = {
4031  key: 3,
4032  class: "card sudanSectionHeader"
4033}
4034const _hoisted_19 = ["onClick"]
4035const _hoisted_20 = { class: "hint" }
4036const _hoisted_21 = {
4037  key: 4,
4038  class: "card sudanSectionHeader searchGrowthContext"
4039}
4040const _hoisted_22 = ["onClick"]
4041const _hoisted_23 = { class: "hint" }
4042const _hoisted_24 = {
4043  key: 5,
4044  class: "card searchGrowthCrossLinks"
4045}
4046const _hoisted_25 = { class: "guideCategoryGrid searchGrowthHubGrid" }
4047const _hoisted_26 = {
4048  key: 6,
4049  class: "card guideSearchCard visualDiscoverySearch"
4050}
4051const _hoisted_27 = {
4052  key: 0,
4053  class: "guideSearchHeader"
4054}
4055const _hoisted_28 = { class: "row" }
4056const _hoisted_29 = ["onClick"]
4057const _hoisted_30 = ["onClick"]
4058const _hoisted_31 = { class: "guideSearch" }
4059const _hoisted_32 = { class: "guideSmartInput" }
4060const _hoisted_33 = ["onUpdate:modelValue", "onInput", "onFocus", "onBlur", "onKeydown", "placeholder", "aria-label", "aria-expanded"]
4061const _hoisted_34 = ["onMousedown", "onClick"]
4062const _hoisted_35 = {
4063  key: 1,
4064  class: "guideAutocomplete",
4065  role: "listbox"
4066}
4067const _hoisted_36 = ["aria-selected", "onMousedown", "onClick"]
4068const _hoisted_37 = { class: "guideAutocompleteIcon" }
4069const _hoisted_38 = { key: 0 }
4070const _hoisted_39 = { key: 1 }
4071const _hoisted_40 = ["onUpdate:modelValue", "onChange"]
4072const _hoisted_41 = ["value"]
4073const _hoisted_42 = ["onClick"]
4074const _hoisted_43 = {
4075  key: 1,
4076  class: "guideFilterLayer guideServiceLayer"
4077}
4078const _hoisted_44 = {
4079  class: "guideHorizontalRail guideCategoryRail",
4080  "aria-label": "موضوع التجارة أو الشحن"
4081}
4082const _hoisted_45 = ["onClick"]
4083const _hoisted_46 = ["onClick"]
4084const _hoisted_47 = {
4085  key: 2,
4086  class: "guideFilterLayer guideLocationLayer"
4087}
4088const _hoisted_48 = {
4089  class: "guideCityChips guideHorizontalRail",
4090  "aria-label": "اختيار المدينة"
4091}
4092const _hoisted_49 = ["onClick"]
4093const _hoisted_50 = {
4094  key: 0,
4095  lang: "zh-CN",
4096  dir: "ltr"
4097}
4098const _hoisted_51 = {
4099  key: 3,
4100  class: "guideMobileDiscovery"
4101}
4102const _hoisted_52 = {
4103  key: 0,
4104  class: "guideFilterLayer guideJourneyLayer"
4105}
4106const _hoisted_53 = {
4107  class: "guideHorizontalRail guideJourneyRail",
4108  "aria-label": "مسارات الدليل"
4109}
4110const _hoisted_54 = ["onClick"]
4111const _hoisted_55 = { class: "guideFilterLayer guideCategoryLayer" }
4112const _hoisted_56 = {
4113  class: "guideHorizontalRail guideCategoryRail",
4114  "aria-label": "تصنيفات الدليل"
4115}
4116const _hoisted_57 = ["onClick"]
4117const _hoisted_58 = ["onClick"]
4118const _hoisted_59 = {
4119  key: 1,
4120  class: "guideFilterLayer guideDietLayer"
4121}
4122const _hoisted_60 = { class: "guideHorizontalRail" }
4123const _hoisted_61 = ["onClick"]
4124const _hoisted_62 = {
4125  key: 4,
4126  class: "guideFilterLayer guideAreaLayer"
4127}
4128const _hoisted_63 = ["aria-label"]
4129const _hoisted_64 = ["onClick"]
4130const _hoisted_65 = {
4131  key: 5,
4132  class: "guideRecentSearches"
4133}
4134const _hoisted_66 = ["onClick"]
4135const _hoisted_67 = {
4136  key: 6,
4137  class: "guideSearchUnderstanding",
4138  role: "status"
4139}
4140const _hoisted_68 = { key: 0 }
4141const _hoisted_69 = {
4142  key: 7,
4143  class: "guideFilterSummary"
4144}
4145const _hoisted_70 = {
4146  class: "guideActiveFilters guideHorizontalRail",
4147  "aria-label": "الفلاتر النشطة"
4148}
4149const _hoisted_71 = { key: 0 }
4150const _hoisted_72 = { key: 1 }
4151const _hoisted_73 = { key: 2 }
4152const _hoisted_74 = { key: 3 }
4153const _hoisted_75 = { key: 4 }
4154const _hoisted_76 = { key: 5 }
4155const _hoisted_77 = { key: 6 }
4156const _hoisted_78 = { key: 7 }
4157const _hoisted_79 = { key: 8 }
4158const _hoisted_80 = { key: 9 }
4159const _hoisted_81 = ["onClick"]
4160const _hoisted_82 = {
4161  key: 7,
4162  class: "card tradeResolveHint",
4163  role: "status"
4164}
4165const _hoisted_83 = ["onClick"]
4166const _hoisted_84 = {
4167  key: 8,
4168  class: "card guideSectorCard"
4169}
4170const _hoisted_85 = {
4171  class: "guideHorizontalRail guideQuickChips",
4172  "aria-label": "قطاعات الشركات"
4173}
4174const _hoisted_86 = ["onClick"]
4175const _hoisted_87 = ["onClick"]
4176const _hoisted_88 = { key: 0 }
4177const _hoisted_89 = ["onClick"]
4178const _hoisted_90 = {
4179  key: 9,
4180  class: "card tradeDirectionCard tradeRouteCard"
4181}
4182const _hoisted_91 = { class: "formTwo tradeCountrySelectors" }
4183const _hoisted_92 = { class: "fieldLabel" }
4184const _hoisted_93 = ["onUpdate:modelValue", "onChange"]
4185const _hoisted_94 = ["value", "disabled"]
4186const _hoisted_95 = { class: "fieldLabel" }
4187const _hoisted_96 = ["onUpdate:modelValue", "onChange"]
4188const _hoisted_97 = ["value", "disabled"]
4189const _hoisted_98 = {
4190  key: 0,
4191  class: "hint"
4192}
4193const _hoisted_99 = {
4194  key: 1,
4195  class: "guideEmptyInline"
4196}
4197const _hoisted_100 = { class: "row" }
4198const _hoisted_101 = ["onClick"]
4199const _hoisted_102 = ["onClick"]
4200const _hoisted_103 = { key: 2 }
4201const _hoisted_104 = { class: "hint" }
4202const _hoisted_105 = {
4203  key: 0,
4204  class: "guideFilterLayer"
4205}
4206const _hoisted_106 = {
4207  class: "guideHorizontalRail guideQuickChips",
4208  "aria-label": "نوع خدمة التجارة والشحن"
4209}
4210const _hoisted_107 = ["onClick"]
4211const _hoisted_108 = ["onClick"]
4212const _hoisted_109 = {
4213  key: 10,
4214  class: "guideCategoryGrid"
4215}
4216const _hoisted_110 = ["onClick"]
4217const _hoisted_111 = ["onClick"]
4218const _hoisted_112 = {
4219  key: 0,
4220  class: "card comingSoonCategories"
4221}
4222const _hoisted_113 = { class: "comingSoonList" }
4223const _hoisted_114 = {
4224  key: 11,
4225  class: "guidePills"
4226}
4227const _hoisted_115 = ["onClick"]
4228const _hoisted_116 = ["onClick"]
4229const _hoisted_117 = {
4230  key: 12,
4231  class: "guideResultsBar"
4232}
4233const _hoisted_118 = { class: "sectionEyebrow" }
4234const _hoisted_119 = ["onClick"]
4235const _hoisted_120 = {
4236  key: 0,
4237  class: "card guideEmptyState"
4238}
4239const _hoisted_121 = { class: "hint" }
4240const _hoisted_122 = {
4241  key: 0,
4242  class: "guideEmptyQuick"
4243}
4244const _hoisted_123 = ["onClick"]
4245const _hoisted_124 = ["onClick"]
4246const _hoisted_125 = ["onClick"]
4247const _hoisted_126 = ["onClick"]
4248const _hoisted_127 = { class: "guideEmptyActions" }
4249const _hoisted_128 = ["onClick"]
4250const _hoisted_129 = ["onClick"]
4251const _hoisted_130 = ["onClick"]
4252const _hoisted_131 = { class: "guideVisualFrame" }
4253const _hoisted_132 = ["src", "alt", "onError"]
4254const _hoisted_133 = {
4255  key: 1,
4256  class: "guideItemImg icon",
4257  "aria-hidden": "true"
4258}
4259const _hoisted_134 = {
4260  key: 2,
4261  class: "guideVisualBadge"
4262}
4263const _hoisted_135 = {
4264  key: 3,
4265  class: "guideVisualVerified"
4266}
4267const _hoisted_136 = { class: "guideDiscoveryBody" }
4268const _hoisted_137 = {
4269  key: 0,
4270  class: "guideBestMatchLabel"
4271}
4272const _hoisted_138 = { class: "guideCardTop" }
4273const _hoisted_139 = { key: 0 }
4274const _hoisted_140 = { key: 1 }
4275const _hoisted_141 = { class: "contentQueueExcerpt" }
4276const _hoisted_142 = { class: "guideDiscoveryMeta" }
4277const _hoisted_143 = { key: 0 }
4278const _hoisted_144 = { class: "guideActions row" }
4279const _hoisted_145 = ["onClick"]
4280const _hoisted_146 = ["onClick"]
4281const _hoisted_147 = {
4282  key: 1,
4283  class: "guideLoadMore"
4284}
4285const _hoisted_148 = ["disabled", "onClick"]
4286const _hoisted_149 = {
4287  key: 14,
4288  class: "card guideSuggest",
4289  open: ""
4290}
4291const _hoisted_150 = ["onUpdate:modelValue"]
4292const _hoisted_151 = ["onUpdate:modelValue"]
4293const _hoisted_152 = ["value"]
4294const _hoisted_153 = ["onUpdate:modelValue"]
4295const _hoisted_154 = ["onClick"]
4296
4297return function render(_ctx, _cache) {
4298  with (_ctx) {
4299    const { toDisplayString: _toDisplayString, createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, renderList: _renderList, Fragment: _Fragment, normalizeClass: _normalizeClass, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock, vModelText: _vModelText, withDirectives: _withDirectives, withModifiers: _withModifiers, vModelSelect: _vModelSelect, createTextVNode: _createTextVNode, createVNode: _createVNode } = _Vue
4300
4301    const _component_router_link = _resolveComponent("router-link")
4302    const _component_PublicFrame = _resolveComponent("PublicFrame")
4303
4304    return (_openBlock(), _createBlock(_component_PublicFrame, { title: hubTitle() }, {
4305      default: _withCtx(() => [
4306        _createElementVNode("section", { class: _normalizeClass(['guideHero',filters.hub==='sudan_digital'?'sudanHero':'',filters.hub!=='sudan_digital'?'hubExperienceHero':'']) }, [(filters.hub!=='sudan_digital')
4307          ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createElementVNode("div", _hoisted_1, [_createElementVNode("span", _hoisted_2, _toDisplayString(hubExperience().eyebrow), 1), (filters.hub==='china_guide')
4308              ? (_openBlock(), _createElementBlock("p", _hoisted_3, "اعثر على الأماكن والخدمات والمعلومات العملية في الصين بسرعة، مع صور وعناوين وحالة توثيق واضحة."))
4309              : (_openBlock(), _createElementBlock("p", _hoisted_4, "اعثر على معلومات التجارة والشحن حسب دولة البداية والوجهة: التوريد، الفحص، المستندات، الجمارك، التخليص والموانئ.")), _createElementVNode("div", _hoisted_5, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(hubExperience().points, (x) => {
4310              return (_openBlock(), _createElementBlock("span", { key: x }, [_cache[0] || (_cache[0] = _createElementVNode("i", {
4311                class: "hubPromiseMark",
4312                "aria-hidden": "true"
4313              }, "✓", -1)), _createElementVNode("b", _hoisted_6, _toDisplayString(x), 1)]))
4314            }), 128))])]), _createElementVNode("figure", _hoisted_7, [_createElementVNode("img", {
4315              class: "smtServiceArt hubExperienceIcon",
4316              src: hubExperience().image,
4317              alt: hubExperience().alt,
4318              width: "144",
4319              height: "144",
4320              loading: "eager"
4321            }, null, 8, _hoisted_8)])], 64))
4322          : (_openBlock(), _createElementBlock("p", _hoisted_9, "بوابة منظمة للخدمات السودانية الرسمية والرقمية، مع مصدر وتاريخ تحقق لكل معلومة."))], 2),
4323        (loading && !loaded)
4324          ? (_openBlock(), _createElementBlock("section", _hoisted_10, _cache[1] || (_cache[1] = [_createElementVNode("span", {
4325              class: "loadingSpinner",
4326              "aria-hidden": "true"
4327            }, null, -1), _createElementVNode("h3", null, "جاري تحميل المعلومات...", -1), _createElementVNode("p", { class: "hint" }, "يرجى الانتظار قليلاً.", -1)])))
4328          : loadError
4329            ? (_openBlock(), _createElementBlock("section", _hoisted_11, [
4330                _cache[2] || (_cache[2] = _createElementVNode("span", {
4331                  class: "metricMark",
4332                  "aria-hidden": "true"
4333                }, null, -1)),
4334                _cache[3] || (_cache[3] = _createElementVNode("h3", null, "تعذر تحميل البيانات", -1)),
4335                _createElementVNode("p", null, _toDisplayString(loadError), 1),
4336                _createElementVNode("button", {
4337                  class: "btn secondary",
4338                  onClick: load
4339                }, "إعادة المحاولة", 8, _hoisted_12)
4340              ]))
4341            : _createCommentVNode("", true),
4342        (loaded && !loadError && filters.hub==='sudan_digital' && !filters.category)
4343          ? (_openBlock(), _createElementBlock("section", _hoisted_13, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(populatedSudanSections, (sec) => {
4344              return (_openBlock(), _createElementBlock("article", {
4345                key: sec.slug,
4346                class: "card sudanHubCard"
4347              }, [
4348                _createElementVNode("span", _hoisted_14, _toDisplayString(sec.icon), 1),
4349                _createElementVNode("h3", null, _toDisplayString(sec.title), 1),
4350                _createElementVNode("p", null, _toDisplayString(sec.desc), 1),
4351                _createElementVNode("button", {
4352                  class: "smallbtn secondary",
4353                  onClick: $event => (pickSudanSection(sec.slug))
4354                }, "فتح القسم · " + _toDisplayString(sectionCount(sec.slug)), 9, _hoisted_15)
4355              ]))
4356            }), 128)), (emptySudanSections.length)
4357              ? (_openBlock(), _createElementBlock("details", _hoisted_16, [_createElementVNode("summary", null, "أقسام قادمة (" + _toDisplayString(emptySudanSections.length) + ")", 1), _cache[4] || (_cache[4] = _createElementVNode("p", { class: "hint" }, "سيتم توفير محتوى هذه الأقسام لاحقاً.", -1)), _createElementVNode("div", _hoisted_17, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(emptySudanSections, (sec) => {
4358                  return (_openBlock(), _createElementBlock("span", { key: sec.slug }, _toDisplayString(sec.icon) + " " + _toDisplayString(sec.title) + " · قريباً", 1))
4359                }), 128))])]))
4360              : _createCommentVNode("", true)]))
4361          : _createCommentVNode("", true),
4362        (loaded && !loadError && filters.hub==='sudan_digital' && filters.category)
4363          ? (_openBlock(), _createElementBlock("section", _hoisted_18, [_createElementVNode("button", {
4364              class: "smallbtn secondary",
4365              onClick: clearSudanSection
4366            }, "رجوع للأقسام", 8, _hoisted_19), _createElementVNode("h3", null, _toDisplayString((currentSudanSection()||{}).icon) + " " + _toDisplayString((currentSudanSection()||{}).title || 'قسم البوابة'), 1), _createElementVNode("p", _hoisted_20, _toDisplayString((currentSudanSection()||{}).desc), 1)]))
4367          : _createCommentVNode("", true),
4368        (loaded && !loadError && growthRouteHub())
4369          ? (_openBlock(), _createElementBlock("section", _hoisted_21, [_createElementVNode("button", {
4370              class: "smallbtn secondary",
4371              onClick: $event => (router.push(filters.hub==='trade_shipping'?'/trade-shipping':'/china-guide'))
4372            }, "رجوع للقسم", 8, _hoisted_22), _createElementVNode("h3", null, _toDisplayString(growthRouteHub().title_ar||growthRouteHub().label_ar), 1), _createElementVNode("p", _hoisted_23, _toDisplayString(growthRouteHub().description_ar) + " · " + _toDisplayString(growthRouteHub().item_count) + " معلومة موثقة", 1)]))
4373          : _createCommentVNode("", true),
4374        (loaded && !loadError && growthRouteHub() && growthRouteHub().context_links && growthRouteHub().context_links.length)
4375          ? (_openBlock(), _createElementBlock("section", _hoisted_24, [_cache[5] || (_cache[5] = _createElementVNode("div", { class: "guideDetailSectionHead" }, [_createElementVNode("span", null, "🔗"), _createElementVNode("div", null, [_createElementVNode("h3", null, "استكشف أيضاً"), _createElementVNode("small", null, "روابط مرتبطة بنفس المدينة أو الموضوع")])], -1)), _createElementVNode("div", _hoisted_25, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(growthRouteHub().context_links, (h) => {
4376              return (_openBlock(), _createBlock(_component_router_link, {
4377                key: h.path,
4378                to: h.path,
4379                class: "guideCategoryCard searchGrowthHubCard"
4380              }, {
4381                default: _withCtx(() => [_createElementVNode("span", null, _toDisplayString(h.icon||'↗'), 1), _createElementVNode("b", null, _toDisplayString(h.type==='city'?$cityLabel(h):h.label_ar), 1), _createElementVNode("small", null, _toDisplayString(h.item_count) + " نتيجة مرتبطة", 1)]),
4382                _: 2
4383              }, 1032, ["to"]))
4384            }), 128))])]))
4385          : _createCommentVNode("", true),
4386        (loaded && !loadError && (filters.hub!=='sudan_digital' || filters.category))
4387          ? (_openBlock(), _createElementBlock("section", _hoisted_26, [
4388              (filters.hub!=='sudan_digital')
4389                ? (_openBlock(), _createElementBlock("div", _hoisted_27, [_createElementVNode("div", null, [_cache[6] || (_cache[6] = _createElementVNode("span", { class: "sectionEyebrow" }, "اكتشف بسرعة", -1)), _createElementVNode("h2", null, _toDisplayString(filters.hub==='trade_shipping'?'ابحث في التجارة والشحن':'ابحث في الصين'), 1), _cache[7] || (_cache[7] = _
4389createElementVNode("small", null, "ابدأ بكلمة أو مكان أو خدمة. نرتب النتائج الموثقة الأقرب لبحثك أولاً.", -1))]), _createElementVNode("div", _hoisted_28, [(filters.hub==='trade_shipping')
4390                    ? (_openBlock(), _createElementBlock("button", {
4391                        key: 0,
4392                        class: "smallbtn",
4393                        onClick: openTradeServiceRequest
4394                      }, "طلب خدمة شحن ولوجستيات", 8, _hoisted_29))
4395                    : _createCommentVNode("", true), _createElementVNode("button", {
4396                    class: "smallbtn guideAiSearchCta",
4397                    onClick: openAskSearch
4398                  }, "✦ اسأل SMT عن هذا", 8, _hoisted_30)])]))
4399                : _createCommentVNode("", true),
4400              _createElementVNode("div", _hoisted_31, [_createElementVNode("div", _hoisted_32, [
4401                _cache[8] || (_cache[8] = _createElementVNode("span", {
4402                  class: "guideSearchIcon",
4403                  "aria-hidden": "true"
4404                }, "⌕", -1)),
4405                _withDirectives(_createElementVNode("input", {
4406                  "onUpdate:modelValue": $event => ((filters.search) = $event),
4407                  type: "search",
4408                  autocomplete: "off",
4409                  inputmode: "search",
4410                  onInput: scheduleSuggestions,
4411                  onFocus: scheduleSuggestions,
4412                  onBlur: closeSuggestionsSoon,
4413                  onKeydown: searchKeydown,
4414                  placeholder: searchPlaceholder(),
4415                  "aria-label": filters.hub==='trade_shipping'?'ابحث في التجارة والشحن':'ابحث في دليلك في الصين',
4416                  "aria-expanded": autoOpen?'true':'false'
4417                }, null, 40, _hoisted_33), [[_vModelText, filters.search]]),
4418                (filters.search)
4419                  ? (_openBlock(), _createElementBlock("button", {
4420                      key: 0,
4421                      class: "guideSearchClear",
4422                      type: "button",
4423                      "aria-label": "مسح البحث",
4424                      onMousedown: _withModifiers(() => {}, ["prevent"]),
4425                      onClick: $event => {filters.search='';searchMeta=null;autoSuggestions=[];autoOpen=false;load()}
4426                    }, "×", 40, _hoisted_34))
4427                  : _createCommentVNode("", true),
4428                (autoOpen && autoSuggestions.length)
4429                  ? (_openBlock(), _createElementBlock("div", _hoisted_35, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(autoSuggestions, (s, i) => {
4430                      return (_openBlock(), _createElementBlock("button", {
4431                        key: s.type+'-'+(s.item_id||s.query)+'-'+i,
4432                        type: "button",
4433                        role: "option",
4434                        "aria-selected": autoIndex===i?'true':'false',
4435                        class: _normalizeClass({active:autoIndex===i}),
4436                        onMousedown: _withModifiers(() => {}, ["prevent"]),
4437                        onClick: $event => (chooseAutocomplete(s))
4438                      }, [_createElementVNode("span", _hoisted_37, _toDisplayString(s.icon||'⌕'), 1), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(s.type==='city'?$cityLabel(s.city):s.label), 1), (s.subtitle)
4439                        ? (_openBlock(), _createElementBlock("small", _hoisted_38, _toDisplayString(s.city?s.subtitle.split(s.city).join($cityLabel(s.city)):s.subtitle), 1))
4440                        : (s.type==='intent')
4441                          ? (_openBlock(), _createElementBlock("small", _hoisted_39, "بحث ذكي حسب النوع والمدينة والمنطقة"))
4442                          : _createCommentVNode("", true)])], 42, _hoisted_36))
4443                    }), 128))]))
4444                  : _createCommentVNode("", true)
4445              ]), (filters.hub==='china_guide')
4446                ? _withDirectives((_openBlock(), _createElementBlock("select", {
4447                    key: 0,
4448                    "onUpdate:modelValue": $event => ((filters.city) = $event),
4449                    onChange: $event => {filters.area='';load()}
4450                  }, [_cache[9] || (_cache[9] = _createElementVNode("option", { value: "" }, "كل المدن", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList($cityList(filters.city), (c) => {
4451                    return (_openBlock(), _createElementBlock("option", {
4452                      key: c.value,
4453                      value: c.value
4454                    }, _toDisplayString(c.label), 9, _hoisted_41))
4455                  }), 128))], 40, _hoisted_40)), [[_vModelSelect, filters.city]])
4456                : _createCommentVNode("", true), _createElementVNode("button", {
4457                class: "btn",
4458                onClick: runSearch
4459              }, "بحث", 8, _hoisted_42)]),
4460              (filters.hub==='trade_shipping')
4461                ? (_openBlock(), _createElementBlock("div", _hoisted_43, [_cache[10] || (_cache[10] = _createElementVNode("span", { class: "guideFilterLayerLabel" }, "ما الذي تحتاج معرفته؟", -1)), _createElementVNode("div", _hoisted_44, [_createElementVNode("button", {
4462                    type: "button",
4463                    class: _normalizeClass({active:!filters.category}),
4464                    onClick: $event => (pickTradeNeed(''))
4465                  }, "الكل", 10, _hoisted_45), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(tradeNeedCategories, (c) => {
4466                    return (_openBlock(), _createElementBlock("button", {
4467                      key: c.id||c.slug,
4468                      type: "button",
4469                      class: _normalizeClass({active:filters.category===c.slug}),
4470                      onClick: $event => (pickTradeNeed(c.slug))
4471                    }, [_createElementVNode("span", null, _toDisplayString(c.icon||'📦'), 1), _createElementVNode("b", null, _toDisplayString(c.name_ar), 1)], 10, _hoisted_46))
4472                  }), 128))])]))
4473                : _createCommentVNode("", true),
4474              (filters.hub==='china_guide' && guideCities.length)
4475                ? (_openBlock(), _createElementBlock("div", _hoisted_47, [_cache[11] || (_cache[11] = _createElementVNode("span", { class: "guideFilterLayerLabel" }, "المدينة", -1)), _createElementVNode("div", _hoisted_48, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(guideCities, (c) => {
4476                    return (_openBlock(), _createElementBlock("button", {
4477                      key: c.key,
4478                      type: "button",
4479                      class: _normalizeClass({active:String(filters.city).toLowerCase()===String(c.key).toLowerCase()}),
4480                      onClick: $event => (pickFeaturedCity(c.key))
4481                    }, [_createElementVNode("span", null, "📍 " + _toDisplayString(c.label), 1), (c.zh)
4482                      ? (_openBlock(), _createElementBlock("small", _hoisted_50, _toDisplayString(c.zh), 1))
4483                      : _createCommentVNode("", true)], 10, _hoisted_49))
4484                  }), 128))])]))
4485                : _createCommentVNode("", true),
4486              (filters.hub==='china_guide')
4487                ? (_openBlock(), _createElementBlock("div", _hoisted_51, [taxonomyV2
4488                    ? (_openBlock(), _createElementBlock("div", _hoisted_52, [_cache[12] || (_cache[12] = _createElementVNode("span", { class: "guideFilterLayerLabel" }, "ابدأ من حاجتك", -1)), _createElementVNode("div", _hoisted_53, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(guideJourneys, (j) => {
4489                        return (_openBlock(), _createElementBlock("button", {
4490                          key: j.key,
4491                          type: "button",
4492                          class: _normalizeClass({active:filters.journey===j.key}),
4493                          onClick: $event => (pickJourney(j.key))
4494                        }, [_createElementVNode("span", null, _toDisplayString(j.icon), 1), _createElementVNode("b", null, _toDisplayString(j.label), 1)], 10, _hoisted_54))
4495                      }), 128))])]))
4496                    : _createCommentVNode("", true), _createElementVNode("div", _hoisted_55, [_cache[13] || (_cache[13] = _createElementVNode("span", { class: "guideFilterLayerLabel" }, "التصنيف", -1)), _createElementVNode("div", _hoisted_56, [_createElementVNode("button", {
4497                    type: "button",
4498                    class: _normalizeClass({active:!filters.category}),
4499                    onClick: $event => (pickCat(''))
4500                  }, "الكل", 10, _hoisted_57), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(populatedCategories, (c) => {
4501                    return (_openBlock(), _createElementBlock("button", {
4502                      key: c.id||c.key||c.slug,
4503                      type: "button",
4504                      class: _normalizeClass({active:filters.category===(c.slug||c.key||c.category_key)}),
4505                      onClick: $event => (pickCat(c.slug||c.key||c.category_key))
4506                    }, [_createElementVNode("span", null, _toDisplayString(c.icon||'🧭'), 1), _createElementVNode("b", null, _toDisplayString(c.name_ar), 1)], 10, _hoisted_58))
4507                  }), 128))])]), taxonomyV2
4508                    ? (_openBlock(), _createElementBlock("div", _hoisted_59, [_cache[14] || (_cache[14] = _createElementVNode("span", { class: "guideFilterLayerLabel" }, "خيارات مفيدة", -1)), _createElementVNode("div", _hoisted_60, [_createElementVNode("button", {
4509                        type: "button",
4510                        class: _normalizeClass({active:filters.diet==='halal'}),
4511                        onClick: $event => (pickDiet('halal'))
4512                      }, "✓ حلال", 10, _hoisted_61)])]))
4513                    : _createCommentVNode("", true)]))
4514                : _createCommentVNode("", true),
4515              (filters.hub==='china_guide' && filters.city && visibleFeaturedAreas.length)
4516                ? (_openBlock(), _createElementBlock("div", _hoisted_62, [_cache[15] || (_cache[15] = _createElementVNode("span", { class: "guideFilterLayerLabel" }, "المنطقة", -1)), _createElementVNode("div", {
4517                    class: "guideCityChips guideAreaChips",
4518                    "aria-label": 'مناطق '+cityFilterLabel()
4519                  }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(visibleFeaturedAreas, (a) => {
4520                    return (_openBlock(), _createElementBlock("button", {
4521                      key: a.key,
4522                      type: "button",
4523                      class: _normalizeClass({active:filters.area===a.key}),
4524                      onClick: $event => (pickFeaturedArea(a))
4525                    }, [_createTextVNode("⌖ " + _toDisplayString(a.label) + " ", 1), _createElementVNode("small", null, _toDisplayString(a.zh), 1)], 10, _hoisted_64))
4526                  }), 128))], 8, _hoisted_63)]))
4527                : _createCommentVNode("", true),
4528              (recentSearches.length && (filters.hub==='china_guide'||filters.hub==='trade_shipping'))
4529                ? (_openBlock(), _createElementBlock("div", _hoisted_65, [_
4529cache[16] || (_cache[16] = _createElementVNode("span", null, "بحثت مؤخراً", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(recentSearches, (q) => {
4530                    return (_openBlock(), _createElementBlock("button", {
4531                      key: q,
4532                      type: "button",
4533                      onClick: $event => (popularSearch(q))
4534                    }, "↻ " + _toDisplayString(q), 9, _hoisted_66))
4535                  }), 128))]))
4536                : _createCommentVNode("", true),
4537              (smartSearchActive && searchMeta)
4538                ? (_openBlock(), _createElementBlock("div", _hoisted_67, [_cache[18] || (_cache[18] = _createElementVNode("span", null, "✦", -1)), _createElementVNode("p", null, [_cache[17] || (_cache[17] = _createElementVNode("b", null, "أفضل تطابق لبحثك", -1)), _createElementVNode("small", null, [
4539                    (searchMeta.intent_label_ar)
4540                      ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createTextVNode(_toDisplayString(searchMeta.intent_label_ar), 1)], 64))
4541                      : _createCommentVNode("", true),
4542                    (searchMeta.area_label_ar)
4543                      ? (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [_createTextVNode(" · " + _toDisplayString(searchMeta.area_label_ar), 1)], 64))
4544                      : (searchMeta.city_label_ar)
4545                        ? (_openBlock(), _createElementBlock(_Fragment, { key: 2 }, [_createTextVNode(" · " + _toDisplayString($cityLabel(searchMeta.city_label_ar)), 1)], 64))
4546                        : _createCommentVNode("", true),
4547                    (!searchMeta.intent_label_ar&&!searchMeta.area_label_ar&&!searchMeta.city_label_ar)
4548                      ? (_openBlock(), _createElementBlock(_Fragment, { key: 3 }, [_createTextVNode(" · بحث بالاسم والمحتوى")], 64))
4549                      : _createCommentVNode("", true),
4550                    (searchMeta.fuzzy)
4551                      ? (_openBlock(), _createElementBlock(_Fragment, { key: 4 }, [_createTextVNode(" · صححنا الخطأ تلقائياً")], 64))
4552                      : _createCommentVNode("", true),
4553                    (searchMeta.local_match_count)
4554                      ? (_openBlock(), _createElementBlock(_Fragment, { key: 5 }, [_createTextVNode(" · " + _toDisplayString(searchMeta.local_match_count) + " محلي", 1)], 64))
4555                      : _createCommentVNode("", true)
4556                  ])]), _createElementVNode("strong", null, [_createTextVNode(_toDisplayString(totalCount) + " نتيجة", 1), (searchMeta.image_count)
4557                    ? (_openBlock(), _createElementBlock("small", _hoisted_68, " · " + _toDisplayString(searchMeta.image_count) + " بصورة", 1))
4558                    : _createCommentVNode("", true)])]))
4559                : _createCommentVNode("", true),
4560              ((filters.hub==='china_guide'||filters.hub==='trade_shipping') && activeFilterCount())
4561                ? (_openBlock(), _createElementBlock("div", _hoisted_69, [_createElementVNode("div", _hoisted_70, [
4562                    (filters.search)
4563                      ? (_openBlock(), _createElementBlock("span", _hoisted_71, "بحث: " + _toDisplayString(filters.search), 1))
4564                      : _createCommentVNode("", true),
4565                    (filters.category)
4566                      ? (_openBlock(), _createElementBlock("span", _hoisted_72, "تصنيف: " + _toDisplayString(categoryFilterLabel()), 1))
4567                      : _createCommentVNode("", true),
4568                    (filters.city)
4569                      ? (_openBlock(), _createElementBlock("span", _hoisted_73, "مدينة: " + _toDisplayString(cityFilterLabel()), 1))
4570                      : _createCommentVNode("", true),
4571                    (filters.area)
4572                      ? (_openBlock(), _createElementBlock("span", _hoisted_74, "منطقة: " + _toDisplayString(areaFilterLabel()), 1))
4573                      : _createCommentVNode("", true),
4574                    (filters.journey)
4575                      ? (_openBlock(), _createElementBlock("span", _hoisted_75, "مسار: " + _toDisplayString(journeyFilterLabel()), 1))
4576                      : _createCommentVNode("", true),
4577                    (filters.diet==='halal')
4578                      ? (_openBlock(), _createElementBlock("span", _hoisted_76, "حلال"))
4579                      : _createCommentVNode("", true),
4580                    (filters.hub==='trade_shipping'&&filters.origin_country&&!tradeOriginIsDefault)
4581                      ? (_openBlock(), _createElementBlock("span", _hoisted_77, "من: " + _toDisplayString(tradeCountryLabel(filters.origin_country)), 1))
4582                      : _createCommentVNode("", true),
4583                    (filters.company_sector)
4584                      ? (_openBlock(), _createElementBlock("span", _hoisted_78, "القطاع: " + _toDisplayString(sectorLabel(filters.company_sector)), 1))
4585                      : _createCommentVNode("", true),
4586                    (filters.hub==='trade_shipping'&&filters.destination_country)
4587                      ? (_openBlock(), _createElementBlock("span", _hoisted_79, "إلى: " + _toDisplayString(tradeCountryLabel(filters.destination_country)), 1))
4588                      : _createCommentVNode("", true),
4589                    (filters.hub==='trade_shipping'&&filters.service_type)
4590                      ? (_openBlock(), _createElementBlock("span", _hoisted_80, "خدمة: " + _toDisplayString(tradeServiceLabel(filters.service_type)), 1))
4591                      : _createCommentVNode("", true)
4592                  ]), _createElementVNode("button", {
4593                    class: "smallbtn secondary",
4594                    onClick: clearGuideFilters
4595                  }, "مسح الكل", 8, _hoisted_81)]))
4596                : _createCommentVNode("", true)
4597            ]))
4598          : _createCommentVNode("", true),
4599        (loaded && !loadError && filters.hub==='trade_shipping' && tradeHint)
4600          ? (_openBlock(), _createElementBlock("section", _hoisted_82, [_cache[19] || (_cache[19] = _createElementVNode("span", { class: "guideFilterLayerLabel" }, "فهمنا بحثك", -1)), _createElementVNode("p", null, [_createElementVNode("b", null, _toDisplayString(tradeHintLabel()), 1)]), _createElementVNode("button", {
4601              class: "smallbtn",
4602              type: "button",
4603              onClick: applyTradeHint
4604            }, "اعرض هذا المسار", 8, _hoisted_83)]))
4605          : _createCommentVNode("", true),
4606        (loaded && !loadError && filters.hub==='china_guide' && isCompaniesCategory && companySectors.enabled && sectorChips.length)
4607          ? (_openBlock(), _createElementBlock("section", _hoisted_84, [_cache[20] || (_cache[20] = _createElementVNode("span", { class: "guideFilterLayerLabel" }, "القطاع", -1)), _createElementVNode("div", _hoisted_85, [_createElementVNode("button", {
4608              type: "button",
4609              class: _normalizeClass({active:!filters.company_sector}),
4610              onClick: $event => (pickSector(''))
4611            }, "كل القطاعات", 10, _hoisted_86), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(sectorChips, (s) => {
4612              return (_openBlock(), _createElementBlock("button", {
4613                key: s.sector_key,
4614                type: "button",
4615                class: _normalizeClass({active:filters.company_sector===s.sector_key}),
4616                onClick: $event => (pickSector(s.sector_key))
4617              }, [_createTextVNode(_toDisplayString(s.name_ar), 1), (s.item_count)
4618                ? (_openBlock(), _createElementBlock("small", _hoisted_88, " · " + _toDisplayString(s.item_count), 1))
4619                : _createCommentVNode("", true)], 10, _hoisted_87))
4620            }), 128)), _createElementVNode("button", {
4621              type: "button",
4622              class: "guideSectorMore",
4623              onClick: $event => (showAllSectors=!showAllSectors)
4624            }, _toDisplayString(showAllSectors?'عرض الأهم فقط':'المزيد'), 9, _hoisted_89)])]))
4625          : _createCommentVNode("", true),
4626        (loaded && !loadError && filters.hub==='trade_shipping')
4627          ? (_openBlock(), _createElementBlock("section", _hoisted_90, [_cache[27] || (_cache[27] = _createElementVNode("span", { class: "guideFilterLayerLabel" }, "مسار التجارة أو الشحن", -1)), _createElementVNode("div", _hoisted_91, [_createElementVNode("label", _hoisted_92, [_cache[22] || (_cache[22] = _createElementVNode("span", null, "من", -1)), _withDirectives(_createElementVNode("select", {
4628              "onUpdate:modelValue": $event => ((filters.origin_country) = $event),
4629              onChange: $event => {filters.service_type='';load()}
4630            }, [_cache[21] || (_cache[21] = _createElementVNode("option", { value: "" }, "اختر دولة البداية", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(tradeCountries, (c) => {
4631              return (_openBlock(), _createElementBlock("option", {
4632                key: 'from-'+c.code,
4633                value: c.code,
4634                disabled: c.code===filters.destination_country
4635              }, _toDisplayString(c.name_ar||c.name_en), 9, _hoisted_94))
4636            }), 128))], 40, _hoisted_93), [[_vModelSelect, filters.origin_country]])]), _createElementVNode("label", _hoisted_95, [_cache[24] || (_cache[24] = _createElementVNode("span", null, "إلى", -1)), _withDirectives(_createElementVNode("select", {
4637              "onUpdate:modelValue": $event => ((filters.destination_country) = $event),
4638              onChange: $event => {filters.service_type='';load()}
4639            }, [_cache[23] || (_cache[23] = _createElementVNode("option", { value: "" }, "اختر دولة الوصول", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(tradeCountries, (c) => {
4640              return (_openBlock(), _createElementBlock("option", {
4641                key: 'to-'+c.code,
4642                value: c.code,
4643                disabled: c.code===filters.origin_country
4644              }, _toDisplayString(c.name_ar||c.name_en), 9, _hoisted_97))
4645            }), 128))], 40, _hoisted_96), [[_vModelSelect, filters.destination_country]])])]), (!filters.origin_country||!filters.destination_country)
4646              ? (_openBlock(), _createElementBlock("p", _hoisted_98, "اختر دولة البداية ودولة الوصول لعرض المعلومات المتاحة لهذا المسار."))
4647              : (!tradeRouteSupported)
4648                ? (_openBlock(), _createElementBlock("div", _hoisted_99, [_cache[25] || (_cache[25] = _createElementVNode("b", null, "لا توجد معلومات موثقة لهذا المسار حاليًا", -1)), _createElementVNode("small", null, _toDisplayString(tradeSelectedRouteLabel()), 1), _createElementVNode("div", _hoisted_100, [_createElementVNode("button", {
4649                    class: "smallbtn secondary",
4650                    type: "button",
4651                    onClick: clearTradeRoute
4652                  }, "مسح المسار", 8, _hoisted_101), _createElementVNode("button", {
4653                    class: "smallbtn",
4654                    type: "button",
4655                    onClick: openTradeServiceRequest
4656                  }, "اطلب خدمة من SMT", 8, _hoisted_102)])]))
4657                : (_openBlock(), _createElementBlock("div", _hoisted_103, [_createElementVNode("p", _hoisted_104, _toDisplayString(tradeSelectedRouteLabel()), 1), (tradeRouteServices.length)
4658                    ? (_openBlock(), _createElementBlock("div", _hoisted_105, [_cache[26] || (_cache[26] = _createElementVNode("span", { class: "guideFilterLayerLabel" }, "نوع الخدمة", -1)), _createElementVNode("div", _hoisted_106, [_createElementVNode("button", {
4659                        type: "button",
4660                        class: _normalizeClass({active:!filters.service_type}),
4661                        onClick: $event => (pickTradeService(''))
4662                      }, "كل الخدمات", 10, _hoisted_107), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(tradeRouteServices, (svc) => {
4663                        return (_openBlock(), _createElementBlock("button", {
4664                          key: svc.service_type,
4665                          type: "button",
4666                          class: _normalizeClass({active:filters.service_type===svc.service_type}),
4667                          onClick: $event => (pickTradeService(svc.service_type))
4668                        }, _toDisplayString(svc.icon||'📦') + " " + _toDisplayString(svc.name_ar||svc.name_en), 11, _hoisted_108))
4669                      }), 128))])]))
4670                    : _createCommentVNode("", true)]))]))
4671          : _createCommentVNode("", true),
4672        (loaded && !loadError && filters.hub==='trade_shipping' && growthRouteHub())
4673          ? (_openBlock(), _createElementBlock("section", _hoisted_109, [_createElementVNode("button", {
4674              class: _normalizeClass(["guideCategoryCard", {active:!filters.category}]),
4675              onClick: $event => (pickCat(''))
4676            }, [_createElementVNode("span", null, _toDisplayString(filters.hub==='trade_shipping'?'🚢':'🧭'), 1), _cache[28] || (_cache[28] = _createElementVNode("b", null, "كل الأقسام", -1)), _createElementVNode("small", null, _toDisplayString(totalCount) + " نتيجة", 1)], 10, _hoisted_110), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(populatedCategories, (c) => {
4677              return (_openBlock(), _createElementBlock("button", {
4678                key: c.id,
4679                class: _normalizeClass(["guideCategoryCard", {active:filters.category===c.slug}]),
4680                onClick: $event => (pickCat(c.slug))
4681              }, [_createElementVNode("span", null, _toDisplayString(c.icon||'🧭'), 1), _createElementVNode("b", null, _toDisplayString(c.name_ar), 1), _createElementVNode("small", null, _toDisplayString(c.item_count||0) + " معلومة", 1)], 10, _hoisted_111))
4682            }), 128)), (emptyCategories.length)
4683              ? (_openBlock(), _createElementBlock("details", _hoisted_112, [_createElementVNode("summary", null, "أقسام قيد الإكمال (" + _toDisplayString(emptyCategories.length) + ")", 1), _createElementVNode("div", _hoisted_113, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(emptyCategories, (c) => {
4684                  return (_openBlock(), _createElementBlock("span", { key: c.id }, _toDisplayString(c.icon||'🧭') + " " + _toDisplayString(c.name_ar) + " · قريباً", 1))
4685                }), 128))])]))
4686              : _createCommentVNode("", true)]))
4687          : (loaded && !loadError && filters.hub==='sudan_digital' && filters.category)
4688            ? (_openBlock(), _createElementBlock("div", _hoisted_114, [_createElementVNode("button", {
4689                class: _normalizeClass({active:!filters.category}),
4690                onClick: $event => (pickCat(''))
4691              }, "الكل", 10, _hoisted_115), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(populatedCategories, (c) => {
4692                return (_openBlock(), _createElementBlock("button", {
4693                  key: c.id,
4694                  class: _normalizeClass({active:filters.category===c.slug}),
4695                  onClick: $event => (pickCat(c.slug))
4696                }, [_createElementVNode("span", null, _toDisplayString(c.icon||'🧭'), 1), _createTextVNode(_toDisplayString(c.name_ar), 1), _createElementVNode("small", null, _toDisplayString(c.item_count||0), 1)], 10, _hoisted_116))
4697              }), 128))]))
4698            : _createCommentVNode("", true),
4699        (loaded && !loadError && (filters.hub==='china_guide'||filters.hub==='trade_shipping'))
4700          ? (_openBlock(), _createElementBlock("section", _hoisted_117, [_createElementVNode("div", null, [_createElementVNode("span", _hoisted_118, _toDisplayString(smartSearchActive?'نتائج البحث':'المحتوى المنشور'), 1), _createElementVNode("h2", null, _toDisplayString(smartSearchActive?'الأقرب لما تبحث عنه':(filters.hub==='trade_shipping'?'معلومات التجارة والشحن':'استكشف دليلك في الصين')), 1), _createElementVNode("small", null, [_createTextVNode(_toDisplayString(totalCount) + " نتيجة", 1), (searchMeta&&searchMeta.image_count)
4701              ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createTextVNode(" · " + _toDisplayString(searchMeta.image_count) + " بصورة", 1)], 64))
4702              : _createCommentVNode("", true)])]), smartSearchActive
4703              ? (_openBlock(), _createElementBlock("button", {
4704                  key: 0,
4705                  class: "smallbtn secondary",
4706                  onClick: openAskSearch
4707                }, "لم تجد المطلوب؟ اسأل SMT", 8, _hoisted_119))
4708              : _createCommentVNode("", true)]))
4709          : _createCommentVNode("", true),
4710        (loaded && !loadError && (filters.hub!=='sudan_digital' || filters.category))
4711          ? (_openBlock(), _createElementBlock("section", {
4712              key: 13,
4713              class: _normalizeClass(['guideList',(filters.hub==='china_guide'||filters.hub==='trade_shipping')?'guideDiscoveryList':''])
4714            }, [(!loading && !items.length)
4715              ? (_openBlock(), _createElementBlock("div", _hoisted_120, [
4716                  _cache[29] || (_cache[29] = _createElementVNode("span", null, "🔎", -1)),
4717                  _cache[30] || (_cache[30] = _createElementVNode("h3", null, "لم نجد نتيجة بعد", -1)),
4718                  _createElementVNode("p", _hoisted_121, _toDisplayString(filters.hub==='trade_shipping'&&filters.origin_country&&filters.destination_country&&!tradeRouteSupported?'لا توجد معلومات موثقة لهذا المسار حاليًا. يمكنك مسح المسار أو طلب خدمة من SMT.':(filters.hub==='trade_shipping'?'جرّب اسم المستند أو نوع الشحن أو الميناء أو الإجراء الذي تبحث عنه.':'جرّب نوع المكان + المنطقة. البحث يفهم الأسماء بالعربية والإنجليزية والصينية مثل: مطاعم شياوبي، 小北 酒店، أسواق ييوو.')), 1),
4719                  (filters.hub==='china_guide')
4720                    ? (_openBlock(), _createElementBlock("div", _hoisted_122, [
4721                        _createElementVNode("button", { onClick: $event => (popularSearch('مطاعم شياوبي')) }, "🍽️ مطاعم شياوبي", 8, _hoisted_123),
4722                        _createElementVNode("button", { onClick: $event => (popularSearch('فنادق شياوبي')) }, "🏨 فنادق شياوبي", 8, _hoisted_124),
4723                        _createElementVNode("button", { onClick: $event => (popularSearch('الأسواق')) }, "🏬 الأسواق", 8, _hoisted_125),
4724                        _createElementVNode("button", { onClick: $event => (popularSearch('المستشفيات')) }, "🏥 المستشفيات", 8, _hoisted_126)
4725                      ]))
4726                    : _createCommentVNode("", true),
4727                  _createElementVNode("div", _hoisted_127, [(activeFilterCount())
4728                    ? (_openBlock(), _createElementBlock("button", {
4729                        key: 0,
4730                        class: "smallbtn secondary",
4731                        onClick: clearGuideFilters
4732                      }, "عرض كل المعلومات", 8, _hoisted_128))
4733                    : _createCommentVNode("", true), (filters.hub==='trade_shipping')
4734                    ? (_openBlock(), _createElementBlock("button", {
4735                        key: 1,
4736                        class: "smallbtn",
4737                        onClick: openTradeServiceRequest
4738                      }, "اطلب خدمة شحن", 8, _hoisted_129))
4739                    : _createCommentVNode("", true), (filters.hub==='china_guide'||filters.hub==='trade_shipping')
4740                    ? (_openBlock(), _createElementBlock("button", {
4741                        key: 2,
4742                        class: "smallbtn",
4743                        onClick: openAskSearch
4744                      }, "اسأل SMT عن بحثك", 8, _hoisted_130))
4745                    : _createCommentVNode("", true)])
4746                ]))
4747              : _createCommentVNode("", true), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (x, index) => {
4748              return (_openBlock(), _createElementBlock("article", {
4749                key: x.id,
4750                class: _normalizeClass(['card','guideItemCard',(filters.hub==='china_guide'||filters.hub==='trade_shipping')?'guideDiscoveryCard':'',{guideBestMatch:smartSearchActive&&index===0}])
4751              }, [_createVNode(_component_router_link, {
4752                class: "guideCardOpen",
4753                to: detailRoute(x)
4754              }, {
4755                default: _withCtx(() => [_createElementVNode("span", _hoisted_131, [(guideImageUrl(x,'thumb'))
4756                  ? (_openBlock(), _createElementBlock("img", {
4757                      key: 0,
4758                      class: "guideItemImg",
4759                      loading: "lazy",
4760                      src: guideImageUrl(x,'thumb'),
4761                      alt: 'صورة '+itemTitle(x),
4762                      onError: $event => (markGuideImageBroken(guideImageUrl(x,'thumb')))
4763                    }, null, 40, _hoisted_132))
4764                  : (_openBlock(), _createElementBlock("span", _hoisted_133, _toDisplayString(x.category_icon||'🧭'), 1)), (x.is_recommended)
4765                  ? (_openBlock(), _createElementBlock("em", _hoisted_134, "★ موصى به"))
4766                  : _createCommentVNode("", true), (x.verification_status==='verified')
4767                  ? (_openBlock(), _createElementBlock("em", _hoisted_135, "✓ موثق"))
4768                  : _createCommentVNode("", true)]), _createElementVNode("span", _hoisted_136, [
4769                  (smartSearchActive&&index===0)
4770                    ? (_openBlock(), _createElementBlock("span", _hoisted_137, "أفضل تطابق"))
4771                    : _createCommentVNode("", true),
4772                  _createElementVNode("span", _hoisted_138, [_createElementVNode("small", null, _toDisplayString(filters.hub==='trade_shipping'?(x.category_name_ar||'التجارة والشحن'):(filters.hub==='sudan_digital'?'بوابة السودان':(x.category_name_ar||'دليلك في الصين')+' · '+($cityLabel(x.city_key||x.city)||'China'))), 1), (filters.hub==='trade_shipping'&&x.direction&&x.direction!=='general')
4773                    ? (_openBlock(), _createElementBlock("small", _hoisted_139, _toDisplayString(tradeDirectionLabel(x)), 1))
4774                    : _createCommentVNode("", true), (filters.hub==='china_guide'&&x.district)
4775                    ? (_openBlock(), _createElementBlock("small", _hoisted_140, "📍 " + _toDisplayString(x.district), 1))
4776                    : _createCommentVNode("", true)]),
4777                  _createElementVNode("h3", null, _toDisplayString(itemTitle(x)), 1),
4778                  _createElementVNode("p", _hoisted_141, _toDisplayString(compactContentExcerpt(itemSummary(x),170)||'اضغط لعرض التفاصيل.'), 1),
4779                  _createElementVNode("span", _hoisted_142, [_createElementVNode("b", null, _toDisplayString(resultTrustLabel(x)), 1), (x.last_verified_at||x.updated_at)
4780                    ? (_openBlock(), _createElementBlock("small", _hoisted_143, "آخر تحقق " + _toDisplayString(shortDate(x.last_verified_at||x.updated_at)), 1))
4781                    : _createCommentVNode("", true)])
4782                ])]),
4783                _: 2
4784              }, 1032, ["to"]), _createElementVNode("div", _hoisted_144, [_createVNode(_component_router_link, {
4785                class: "smallbtn secondary",
4786                to: detailRoute(x)
4787              }, {
4788                default: _withCtx(() => _cache[31] || (_cache[31] = [_createTextVNode("التفاصيل")])),
4789                _: 2,
4790                __: [31]
4791              }, 1032, ["to"]), (filters.hub==='china_guide'&&(x.title_zh||x.title_ar||x.title_en))
4792                ? (_openBlock(), _createElementBlock("button", {
4793                    key: 0,
4794                    class: "smallbtn",
4795                    onClick: $event => (openMap(x))
4796                  }, "فتح في AMap", 8, _hoisted_145))
4797                : _createCommentVNode("", true), (filters.hub==='china_guide'&&x.phone)
4798                ? (_openBlock(), _createElementBlock("button", {
4799                    key: 1,
4800                    class: "smallbtn secondary",
4801                    onClick: $event => (callPlace(x))
4802                  }, "اتصال", 8, _hoisted_146))
4803                : _createCommentVNode("", true)])], 2))
4804            }), 128)), (pagination&&pagination.has_more)
4805              ? (_openBlock(), _createElementBlock("div", _hoisted_147, [_createElementVNode("button", {
4806                  type: "button",
4807                  class: "btn secondary",
4808                  disabled: loadingMore,
4809                  onClick: loadMoreItems
4810                }, _toDisplayString(loadingMore?'جارٍ التحميل…':'عرض المزيد ('+Math.max(0,totalCount-items.length)+')'), 9, _hoisted_148)]))
4811              : _createCommentVNode("", true)], 2))
4812          : _createCommentVNode("", true),
4813        (loaded && !loadError && filters.hub==='china_guide')
4814          ? (_openBlock(), _createElementBlock("details", _hoisted_149, [
4815              _cache[34] || (_cache[34] = _createElementVNode("summary", null, "اقترح إضافة مكان أو خدمة واكسب نقاط مشاركة", -1)),
4816              _cache[35] || (_cache[35] = _createElementVNode("p", { class: "hint" }, "الدليل مفروض يكون من الناس وللناس. اقترح مطعم، سوق، مستشفىØ
4816Œ مترجم، مكتب شحن، أو أي خدمة مفيدة. الإدارة تراجع قبل النشر. الاقتراح المقبول يبدأ من +5 نقاط.", -1)),
4817              _withDirectives(_createElementVNode("input", {
4818                "onUpdate:modelValue": $event => ((suggestion.title) = $event),
4819                placeholder: "اسم المكان أو الخدمة"
4820              }, null, 8, _hoisted_150), [[_vModelText, suggestion.title]]),
4821              _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((suggestion.category) = $event) }, [_cache[32] || (_cache[32] = _createElementVNode("option", { value: "" }, "اختر القسم المقترح", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(categories, (c) => {
4822                return (_openBlock(), _createElementBlock("option", {
4823                  key: c.id,
4824                  value: c.name_ar
4825                }, _toDisplayString(c.icon) + " " + _toDisplayString(c.name_ar), 9, _hoisted_152))
4826              }), 128)), _cache[33] || (_cache[33] = _createElementVNode("option", { value: "أخرى" }, "أخرى", -1))], 8, _hoisted_151), [[_vModelSelect, suggestion.category]]),
4827              _withDirectives(_createElementVNode("textarea", {
4828                "onUpdate:modelValue": $event => ((suggestion.details) = $event),
4829                placeholder: "اكتب المدينة، الحي، العنوان، رقم التواصل، WeChat، رابط الخريطة، وليه المكان مفيد."
4830              }, null, 8, _hoisted_153), [[_vModelText, suggestion.details]]),
4831              _createElementVNode("button", {
4832                class: "btn",
4833                onClick: sendSuggestion
4834              }, "إرسال الاقتراح", 8, _hoisted_154)
4835            ]))
4836          : _createCommentVNode("", true)
4837      ]),
4838      _: 1
4839    }, 8, ["title"]))
4840  }
4841}
4842})()
4843  };
4844
4845
4846  const ChinaGuideDetailPage={
4847    components:{PublicFrame},
4848    setup(){
4849      const store=useGzcStore(); const route=useRoute(); const router=useRouter();
4850      const item=ref(null); const related=ref([]); const loading=ref(true); const error=ref(''); const reportText=ref(''); const brokenImage=ref(false);
4851      function hubKey(){const p=String(route.path||'');return p.indexOf('/trade-shipping/')===0?'trade_shipping':(p.indexOf('/sudan-digital/')===0?'sudan_digital':'china_guide');}
4852      function hubBase(){return hubKey()==='trade_shipping'?'/trade-shipping':(hubKey()==='sudan_digital'?'/sudan-digital':'/china-guide');}
4853      function pageTitle(){return hubKey()==='trade_shipping'?'تفاصيل التجارة والشحن':(hubKey()==='sudan_digital'?'تفاصيل بوابة السودان':'تفاصيل دليلك في الصين');}
4854      function backLabel(){return hubKey()==='trade_shipping'?'رجوع للتجارة والشحن':(hubKey()==='sudan_digital'?'رجوع لبوابة السودان':'رجوع للدليل');}
4855      function itemTitle(x){return x&& (x.title_ar||x.title_en||x.title_zh) || 'معلومة';}
4856      function itemSummary(x){return x&& (x.summary_ar||x.summary_en||x.description_ar||x.description_en||x.description_zh) || '';}
4857      function addressOf(x){return x&& (x.address_zh||x.address_ar||x.address_en) || '';}
4858      function safeHttpUrl(url){return safeExternalHttpUrl(url);}
4859      function openDetailAmap(){openAmapAppPlace(item.value,message=>{store.state.msg=message;});}
4860      function guideImageUrl(x){return !brokenImage.value&&x&&(x.image_url||x.image_thumb_url)||'';}
4861      async function copyText(text,okMessage){return copySharedText(text,okMessage);}
4862      async function copyAddress(){return copyText(addressOf(item.value),'تم نسخ العنوان');}
4863      async function copyWechat(){return copyText(item.value&&item.value.wechat_id,'تم نسخ WeChat ID');}
4864      async function shareItem(){const x=item.value;if(!x)return;return shareDetailContent({title:itemTitle(x),text:[itemTitle(x),itemSummary(x),addressOf(x)].filter(Boolean).join(' — '),url:window.location.href});}
4865      async function sendReport(){const x=item.value;const msg=String(reportText.value||'').trim();if(!x||!msg){store.state.msg='اكتب التصحيح أولاً';return;}const r=await api('/api/china-guide/items/'+encodeURIComponent(x.id)+'/report',{method:'POST',body:JSON.stringify({message:msg,hub_key:hubKey()})});store.state.msg=r.message||r.error||'';if(r.ok)reportText.value='';}
4866      function tradeDirection(x){return x&&x.direction==='china_to_arab'?'من الصين إلى الدول العربية':(x&&x.direction==='arab_to_china'?'من الدول العربية إلى الصين':'عام');}
4867      async function load(){loading.value=true;error.value='';brokenImage.value=false;item.value=null;related.value=[];const qs=new URLSearchParams({hub:hubKey()});for(const key of ['from_search','search_hub','search_intent','search_city','search_service']){const value=String((route.query||{})[key]||'');if(value)qs.set(key,value);}const r=await api('/api/china-guide/items/'+encodeURIComponent(route.params.id)+'?'+qs.toString());
4867if(r&&r.ok){item.value=r.item;related.value=safeArray(r.related);}else error.value=(r&& (r.message||r.error))||'تعذر تحميل المعلومة';loading.value=false;}
4868      onMounted(load); watch(()=>route.fullPath,load);
4869      return {store,item,related,loading,error,reportText,brokenImage,hubKey,hubBase,pageTitle,backLabel,itemTitle,itemSummary,addressOf,safeHttpUrl,openDetailAmap,guideImageUrl,copyAddress,copyWechat,shareItem,sendReport,tradeDirection,guideServiceLabel,shortDate,router};
4870    },
4871    render:(function(){
4872const _Vue = Vue
4873const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
4874
4875const _hoisted_1 = { class: "guideDetailBack" }
4876const _hoisted_2 = ["onClick"]
4877const _hoisted_3 = {
4878  key: 0,
4879  class: "card loadingState contentDetailSkeleton",
4880  role: "status"
4881}
4882const _hoisted_4 = {
4883  key: 1,
4884  class: "card errorState",
4885  role: "alert"
4886}
4887const _hoisted_5 = ["onClick"]
4888const _hoisted_6 = { class: "card guideDetailPageCard contentDetailPage" }
4889const _hoisted_7 = {
4890  key: 0,
4891  class: "guideDetailHeroMedia guideDetailMedia"
4892}
4893const _hoisted_8 = ["src", "alt", "onError"]
4894const _hoisted_9 = {
4895  key: 0,
4896  class: "guidePhotoAttribution"
4897}
4898const _hoisted_10 = ["href"]
4899const _hoisted_11 = { key: 1 }
4900const _hoisted_12 = { class: "guideDetailHeroBody" }
4901const _hoisted_13 = { class: "guideDetailBadges" }
4902const _hoisted_14 = {
4903  key: 0,
4904  class: "guideBadge"
4905}
4906const _hoisted_15 = { class: "guideVerifiedBadge" }
4907const _hoisted_16 = {
4908  key: 0,
4909  class: "guideDetailLead"
4910}
4911const _hoisted_17 = { class: "guideDetailPrimaryGrid" }
4912const _hoisted_18 = ["onClick"]
4913const _hoisted_19 = ["onClick"]
4914const _hoisted_20 = ["href"]
4915const _hoisted_21 = ["onClick"]
4916const _hoisted_22 = {
4917  key: 0,
4918  class: "card guideDetailSection exhibitionIntelligenceDetail"
4919}
4920const _hoisted_23 = { class: "guideDetailSectionHead" }
4921const _hoisted_24 = { class: "infoGrid" }
4922const _hoisted_25 = ["href"]
4923const _hoisted_26 = {
4924  key: 1,
4925  class: "card guideDetailSection"
4926}
4927const _hoisted_27 = { class: "guideDetailSectionHead" }
4928const _hoisted_28 = { class: "guideAddressText" }
4929const _hoisted_29 = { class: "row" }
4930const _hoisted_30 = ["onClick"]
4931const _hoisted_31 = ["onClick"]
4932const _hoisted_32 = {
4933  key: 2,
4934  class: "card guideDetailSection"
4935}
4936const _hoisted_33 = { class: "guideDetailSectionHead" }
4937const _hoisted_34 = { class: "guideDetailDescription" }
4938const _hoisted_35 = {
4939  key: 3,
4940  class: "card guideDetailSection"
4941}
4942const _hoisted_36 = { class: "infoGrid" }
4943const _hoisted_37 = { key: 0 }
4944const _hoisted_38 = { class: "row" }
4945const _hoisted_39 = ["href"]
4946const _hoisted_40 = ["onClick"]
4947const _hoisted_41 = {
4948  key: 4,
4949  class: "card guideDetailSection"
4950}
4951const _hoisted_42 = { class: "infoGrid" }
4952const _hoisted_43 = { key: 0 }
4953const _hoisted_44 = {
4954  key: 5,
4955  class: "card guideDetailSection"
4956}
4957const _hoisted_45 = { class: "guideContactList" }
4958const _hoisted_46 = ["href"]
4959const _hoisted_47 = { dir: "ltr" }
4960const _hoisted_48 = ["href"]
4961const _hoisted_49 = { dir: "ltr" }
4962const _hoisted_50 = ["onClick"]
4963const _hoisted_51 = { dir: "ltr" }
4964const _hoisted_52 = ["href"]
4965const _hoisted_53 = { class: "card guideDetailSection guideVerificationCard" }
4966const _hoisted_54 = { class: "guideDetailSectionHead" }
4967const _hoisted_55 = {
4968  key: 6,
4969  class: "card guideDetailSection searchGrowthRelated"
4970}
4971const _hoisted_56 = { class: "guideCategoryGrid searchGrowthRelatedGrid" }
4972const _hoisted_57 = { class: "card guideReport guideDetailReport" }
4973const _hoisted_58 = ["onUpdate:modelValue"]
4974const _hoisted_59 = ["onClick"]
4975
4976return function render(_ctx, _cache) {
4977  with (_ctx) {
4978    const { toDisplayString: _toDisplayString, createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode, normalizeClass: _normalizeClass, Fragment: _Fragment, renderList: _renderList, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock, vModelText: _vModelText, withDirectives: _withDirectives } = _Vue
4979
4980    const _component_router_link = _resolveComponent("router-link")
4981    const _component_PublicFrame = _resolveComponent("PublicFrame")
4982
4983    return (_openBlock(), _createBlock(_component_PublicFrame, { title: pageTitle() }, {
4984      default: _withCtx(() => [_createElementVNode("section", _hoisted_1, [_createElementVNode("button", {
4985        type: "button",
4986        class: "smallbtn secondary",
4987        onClick: $event => (router.push(hubBase()))
4988      }, "← " + _toDisplayString(backLabel()), 9, _hoisted_2)]), loading
4989        ? (_openBlock(), _createElementBlock("section", _hoisted_3, _cache[0] || (_cache[0] = [_createElementVNode("span", { class: "loadingSpinner" }, null, -1), _createElementVNode("h3", null, "جاري تحميل المعلومة...", -1), _createElementVNode("p", { class: "hint" }, "يرجى الانتظار قليلاً.", -1)])))
4990        : error
4991          ? (_openBlock(), _createElementBlock("section", _hoisted_4, [_cache[1] || (_cache[1] = _createElementVNode("h3", null, "تعذر فتح المعلومة", -1)), _createElementVNode("p", null, _toDisplayString(error), 1), _createElementVNode("button", {
4992              class: "btn secondary",
4993              onClick: $event => (router.push(hubBase()))
4994            }
4994, _toDisplayString(backLabel()), 9, _hoisted_5)]))
4995          : item
4996            ? (_openBlock(), _createElementBlock(_Fragment, { key: 2 }, [
4997                _createElementVNode("article", _hoisted_6, [(guideImageUrl(item))
4998                  ? (_openBlock(), _createElementBlock("figure", _hoisted_7, [_createElementVNode("img", {
4999                      src: guideImageUrl(item),
5000                      alt: 'صورة '+itemTitle(item),
5001                      loading: "lazy",
5002                      onError: $event => (brokenImage=true)
5003                    }, null, 40, _hoisted_8), (item.image_attribution)
5004                      ? (_openBlock(), _createElementBlock("figcaption", _hoisted_9, [_cache[2] || (_cache[2] = _createTextVNode("صورة: ")), (safeHttpUrl(item.image_source_url))
5005                          ? (_openBlock(), _createElementBlock("a", {
5006                              key: 0,
5007                              href: safeHttpUrl(item.image_source_url),
5008                              target: "_blank",
5009                              rel: "noopener noreferrer"
5010                            }, _toDisplayString(item.image_attribution), 9, _hoisted_10))
5011                          : (_openBlock(), _createElementBlock("span", _hoisted_11, _toDisplayString(item.image_attribution), 1))]))
5012                      : _createCommentVNode("", true)]))
5013                  : _createCommentVNode("", true), _createElementVNode("div", _hoisted_12, [
5014                  _createElementVNode("div", _hoisted_13, [(item.is_recommended)
5015                    ? (_openBlock(), _createElementBlock("span", _hoisted_14, "موصى به"))
5016                    : _createCommentVNode("", true), _createElementVNode("span", _hoisted_15, _toDisplayString(item.verification_status==='verified'?'✓ موثق':'قيد التحقق'), 1), (hubKey()==='china_guide')
5017                    ? (_openBlock(), _createElementBlock("span", {
5018                        key: 1,
5019                        class: _normalizeClass(["trustBadge", item.trust_tier])
5020                      }, _toDisplayString(item.trust_tier==='official'?'Official':(item.trust_tier==='smt_verified'?'SMT Verified':'Community Listed')), 3))
5021                    : _createCommentVNode("", true)]),
5022                  _createElementVNode("h2", null, _toDisplayString(itemTitle(item)), 1),
5023                  (itemSummary(item))
5024                    ? (_openBlock(), _createElementBlock("p", _hoisted_16, _toDisplayString(itemSummary(item)), 1))
5025                    : _createCommentVNode("", true),
5026                  _createElementVNode("div", _hoisted_17, [(hubKey()==='china_guide' && (addressOf(item)||item.map_url))
5027                    ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createElementVNode("button", {
5028                        class: "btn guideMapPrimary",
5029                        type: "button",
5030                        onClick: openDetailAmap
5031                      }, "🗺️ فتح في AMap", 8, _hoisted_18), (addressOf(item))
5032                        ? (_openBlock(), _createElementBlock("button", {
5033                            key: 0,
5034                            class: "btn secondary",
5035                            type: "button",
5036                            onClick: copyAddress
5037                          }, "نسخ العنوان", 8, _hoisted_19))
5038                        : _createCommentVNode("", true)], 64))
5039                    : _createCommentVNode("", true), (safeHttpUrl(item.source_url))
5040                    ? (_openBlock(), _createElementBlock("a", {
5041                        key: 1,
5042                        class: "btn guideMapPrimary",
5043                        href: safeHttpUrl(item.source_url),
5044                        target: "_blank",
5045                        rel: "noopener noreferrer"
5046                      }, "فتح المصدر ↗", 8, _hoisted_20))
5047                    : _createCommentVNode("", true), _createElementVNode("button", {
5048                    class: "btn secondary",
5049                    type: "button",
5050                    onClick: shareItem
5051                  }, "مشاركة", 8, _hoisted_21)])
5052                ])]),
5053                (hubKey()==='china_guide'&&(item.category_key==='exhibitions'||(!item.category_key&&item.service_type==='exhibitions')))
5054                  ? (_openBlock(), _createElementBlock("section", _hoisted_22, [_createElementVNode("div", _hoisted_23, [_cache[4] || (_cache[4] = _createElementVNode("span", null, "🗓️", -1)), _createElementVNode("div", null, [_cache[3] || (_cache[3] = _createElementVNode("h3", null, "بيانات المعرض", -1)), _createElementVNode("small", null, _toDisplayString(item.exhibition_sector||'معرض / مؤتمر'), 1)])]), _createElementVNode("div", _hoisted_24, [_createElementVNode("span", null, [_cache[5] || (_cache[5] = _createElementVNode("b", null, "البداية", -1)), _createElementVNode("small", null, _toDisplayString(item.exhibition_start_date||'تحتاج مراجعة'), 1)]), _createElementVNode("span", null, [_cache[6] || (_cache[6] = _createElementVNode("b", null, "النهاية", -1)), _createElementVNode("small", null, _toDisplayString(item.exhibition_end_date||'تحتاج مراجعة'), 1)])]), (safeHttpUrl(item.registration_url))
5055                      ? (_openBlock(), _createElementBlock("a", {
5056                          key: 0,
5057                          class: "btn secondary",
5058                          href: safeHttpUrl(item.registration_url),
5059                          target: "_blank",
5060                          rel: "noopener noreferrer"
5061                        }, "التسجيل الرسمي ↗", 8, _hoisted_25))
5062                      : _createCommentVNode("", true)]))
5063                  : _createCommentVNode("", true),
5064                (hubKey()==='china_guide' && addressOf(item))
5065                  ? (_openBlock(), _createElementBlock("section", _hoisted_26, [_createElementVNode("div", _hoisted_27, [_cache[8] || (_cache[8] = _createElementVNode("span", null, "📍", -1)), _createElementVNode("div", null, [_cache[7] || (_cache[7] = _
5065createElementVNode("h3", null, "العنوان", -1)), _createElementVNode("small", null, [_createTextVNode(_toDisplayString($cityLabel(item.city)||'China'), 1), (item.district)
5066                      ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createTextVNode(" · " + _toDisplayString(item.district), 1)], 64))
5067                      : _createCommentVNode("", true)])])]), _createElementVNode("p", _hoisted_28, _toDisplayString(addressOf(item)), 1), _createElementVNode("div", _hoisted_29, [_createElementVNode("button", {
5068                      class: "smallbtn secondary",
5069                      onClick: copyAddress
5070                    }, "نسخ العنوان", 8, _hoisted_30), _createElementVNode("button", {
5071                      class: "smallbtn",
5072                      type: "button",
5073                      onClick: openDetailAmap
5074                    }, "فتح في AMap", 8, _hoisted_31)])]))
5075                  : _createCommentVNode("", true),
5076                (item.description_ar||item.description_en||item.description_zh)
5077                  ? (_openBlock(), _createElementBlock("section", _hoisted_32, [_createElementVNode("div", _hoisted_33, [_cache[10] || (_cache[10] = _createElementVNode("span", null, "ℹ️", -1)), _createElementVNode("div", null, [_cache[9] || (_cache[9] = _createElementVNode("h3", null, "التفاصيل", -1)), _createElementVNode("small", null, _toDisplayString(item.category_name_ar||pageTitle()), 1)])]), _createElementVNode("p", _hoisted_34, _toDisplayString(item.description_ar||item.description_en||item.description_zh), 1)]))
5078                  : _createCommentVNode("", true),
5079                (hubKey()==='trade_shipping')
5080                  ? (_openBlock(), _createElementBlock("section", _hoisted_35, [_cache[15] || (_cache[15] = _createElementVNode("div", { class: "guideDetailSectionHead" }, [_createElementVNode("span", null, "🚢"), _createElementVNode("div", null, [_createElementVNode("h3", null, "بيانات الخدمة"), _createElementVNode("small", null, "التجارة والشحن")])], -1)), _createElementVNode("div", _hoisted_36, [
5081                      _createElementVNode("span", null, [_cache[11] || (_cache[11] = _createElementVNode("b", null, "المسار", -1)), _createElementVNode("small", null, _toDisplayString($route.query.route_label||tradeDirection(item)), 1)]),
5082                      _createElementVNode("span", null, [_cache[12] || (_cache[12] = _createElementVNode("b", null, "نوع الخدمة", -1)), _createElementVNode("small", null, _toDisplayString(guideServiceLabel(item.service_type)), 1)]),
5083                      (item.source_name)
5084                        ? (_openBlock(), _createElementBlock("span", _hoisted_37, [_cache[13] || (_cache[13] = _createElementVNode("b", null, "الجهة / المصدر", -1)), _createElementVNode("small", null, _toDisplayString(item.source_name), 1)]))
5085                        : _createCommentVNode("", true),
5086                      _createElementVNode("span", null, [_cache[14] || (_cache[14] = _createElementVNode("b", null, "آخر تحقق", -1)), _createElementVNode("small", null, _toDisplayString(shortDate(item.last_verified_at||item.updated_at)||'-'), 1)])
5087                    ]), _createElementVNode("div", _hoisted_38, [(safeHttpUrl(item.source_url))
5088                      ? (_openBlock(), _createElementBlock("a", {
5089                          key: 0,
5090                          class: "btn secondary",
5091                          href: safeHttpUrl(item.source_url),
5092                          target: "_blank",
5093                          rel: "noopener noreferrer"
5094                        }, "فتح المصدر الرسمي ↗", 8, _hoisted_39))
5095                      : _createCommentVNode("", true), _createElementVNode("button", {
5096                      class: "btn",
5097                      type: "button",
5098                      onClick: $event => (router.push({path:'/procurement/new',query:{service_type:'shipping_logistics',route_label:$route.query.route_label||''}}))
5099                    }, "اطلب خدمة شحن من SMT", 8, _hoisted_40)])]))
5100                  : _createCommentVNode("", true),
5101                (hubKey()==='sudan_digital')
5102                  ? (_openBlock(), _createElementBlock("section", _hoisted_41, [_
5102cache[19] || (_cache[19] = _createElementVNode("div", { class: "guideDetailSectionHead" }, [_createElementVNode("span", null, "🇸🇩"), _createElementVNode("div", null, [_createElementVNode("h3", null, "بيانات الخدمة"), _createElementVNode("small", null, "بوابة السودان الرقمية")])], -1)), _createElementVNode("div", _hoisted_42, [_createElementVNode("span", null, [_cache[16] || (_cache[16] = _createElementVNode("b", null, "القسم", -1)), _createElementVNode("small", null, _toDisplayString(item.category_name_ar||'-'), 1)]), (item.source_name)
5103                      ? (_openBlock(), _createElementBlock("span", _hoisted_43, [_cache[17] || (_cache[17] = _createElementVNode("b", null, "الجهة", -1)), _createElementVNode("small", null, _toDisplayString(item.source_name), 1)]))
5104                      : _createCommentVNode("", true), _createElementVNode("span", null, [_cache[18] || (_cache[18] = _createElementVNode("b", null, "آخر تحقق", -1)), _createElementVNode("small", null, _toDisplayString(shortDate(item.last_verified_at||item.updated_at)||'-'), 1)])])]))
5105                  : _createCommentVNode("", true),
5106                (hubKey()==='china_guide')
5107                  ? (_openBlock(), _createElementBlock("section", _hoisted_44, [_cache[24] || (_cache[24] = _createElementVNode("div", { class: "guideDetailSectionHead" }, [_createElementVNode("span", null, "☎️"), _createElementVNode("div", null, [_createElementVNode("h3", null, "التواصل والروابط"), _createElementVNode("small", null, "الروابط تفتح خارج المنصة")])], -1)), _createElementVNode("div", _hoisted_45, [
5108                      (item.phone)
5109                        ? (_openBlock(), _createElementBlock("a", {
5110                            key: 0,
5111                            class: "guideContactRow",
5112                            href: 'tel:'+item.phone
5113                          }, [_cache[20] || (_cache[20] = _createElementVNode("span", null, "اتصال", -1)), _createElementVNode("b", _hoisted_47, _toDisplayString(item.phone), 1)], 8, _hoisted_46))
5114                        : _createCommentVNode("", true),
5115                      (item.whatsapp)
5116                        ? (_openBlock(), _createElementBlock("a", {
5117                            key: 1,
5118                            class: "guideContactRow",
5119                            href: 'https://wa.me/'+item.whatsapp,
5120                            target: "_blank",
5121                            rel: "noopener noreferrer"
5122                          }, [_cache[21] || (_cache[21] = _createElementVNode("span", null, "WhatsApp", -1)), _createElementVNode("b", _hoisted_49, _toDisplayString(item.whatsapp), 1)], 8, _hoisted_48))
5123                        : _createCommentVNode("", true),
5124                      (item.wechat_id)
5125                        ? (_openBlock(), _createElementBlock("button", {
5126                            key: 2,
5127                            type: "button",
5128                            class: "guideContactRow",
5129                            onClick: copyWechat
5130                          }, [_cache[22] || (_cache[22] = _createElementVNode("span", null, "WeChat · اضغط للنسخ", -1)), _createElementVNode("b", _hoisted_51, _toDisplayString(item.wechat_id), 1)], 8, _hoisted_50))
5131                        : _createCommentVNode("", true),
5132                      (safeHttpUrl(item.source_url))
5133                        ? (_openBlock(), _createElementBlock("a", {
5134                            key: 3,
5135                            class: "guideContactRow",
5136                            href: safeHttpUrl(item.source_url),
5137                            target: "_blank",
5138                            rel: "noopener noreferrer"
5139                          }, [_createElementVNode("span", null, _toDisplayString(item.source_name||'المصدر الرسمي'), 1), _cache[23] || (_cache[23] = _createElementVNode("b", null, "فتح الرابط ↗", -1))], 8, _hoisted_52))
5140                        : _createCommentVNode("", true)
5141                    ])]))
5142                  : _createCommentVNode("", true),
5143                _createElementVNode("section", _hoisted_53, [_createElementVNode("div", _hoisted_54, [_cache[26] || (_cache[26] = _createElementVNode("span", null, "✓", -1)), _createElementVNode("div", null, [_cache[25] || (_cache[25] = _createElementVNode("h3", null, "حالة المعلومة", -1)), _createElementVNode("small", null, "آخر تحقق: " + _toDisplayString(shortDate(item.last_verified_at||item.updated_at)||'-'), 1)])]), _createElementVNode("p", null, _toDisplayString(item.verification_status==='verified'?'المعلومة محدثة حسب آخر تحقق. يفضّل تأكيد التفاصيل قبل اتخاذ قرار مهم.':'المعلومة تحتاج تأكيداً إضافياً قبل الاعتماد عليها.'), 1)]),
5144                (related.length)
5145                  ? (_openBlock(), _createElementBlock("section", _hoisted_55, [_cache[27] || (_cache[27] = _
5145createElementVNode("div", { class: "guideDetailSectionHead" }, [_createElementVNode("span", null, "🔗"), _createElementVNode("div", null, [_createElementVNode("h3", null, "معلومات مرتبطة"), _createElementVNode("small", null, "روابط موثقة قد تساعدك في نفس الموضوع أو المدينة")])], -1)), _createElementVNode("div", _hoisted_56, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(related, (x) => {
5146                      return (_openBlock(), _createBlock(_component_router_link, {
5147                        key: x.id,
5148                        to: x.path,
5149                        class: "guideCategoryCard searchGrowthRelatedCard"
5150                      }, {
5151                        default: _withCtx(() => [_createElementVNode("span", null, _toDisplayString((x.category_key==='markets'||(!x.category_key&&x.service_type==='markets'))?'🏬':((x.category_key==='hotels'||(!x.category_key&&x.service_type==='hotels'))?'🏨':((x.category_key==='restaurants'||(!x.category_key&&x.service_type==='restaurants'))?'🍽️':'↗'))), 1), _createElementVNode("b", null, _toDisplayString(x.title_ar), 1), _createElementVNode("small", null, [(x.city)
5152                          ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createTextVNode(_toDisplayString($cityLabel(x.city)) + " · ", 1)], 64))
5153                          : _createCommentVNode("", true), _createTextVNode(_toDisplayString(x.category_name_ar||'معلومة موثقة'), 1)])]),
5154                        _: 2
5155                      }, 1032, ["to"]))
5156                    }), 128))])]))
5157                  : _createCommentVNode("", true),
5158                _createElementVNode("details", _hoisted_57, [_cache[28] || (_cache[28] = _createElementVNode("summary", null, "هل توجد معلومة تحتاج تصحيحاً؟", -1)), _withDirectives(_createElementVNode("textarea", {
5159                  "onUpdate:modelValue": $event => ((reportText) = $event),
5160                  placeholder: "اكتب المعلومة الخطأ أو التحديث المطلوب"
5161                }, null, 8, _hoisted_58), [[_vModelText, reportText]]), _createElementVNode("button", {
5162                  class: "btn secondary",
5163                  onClick: sendReport
5164                }, "إرسال البلاغ", 8, _hoisted_59)])
5165              ], 64))
5166            : _createCommentVNode("", true)]),
5167      _: 1
5168    }, 8, ["title"]))
5169  }
5170}
5171})()
5172  };
5173
5174  const MemberLoginPage={
5175    components:{PublicFrame},
5176    setup(){
5177      const store=useGzcStore(); const router=useRouter(); const route=useRoute();
5178      const phone=ref(''); const code=ref(''); const otp=ref(false); const notRegistered=ref(false);
5179      const cooldown=useOtpCooldown(60);
5180      onMounted(()=>{
5181        if(route.query&&route.query.phone)phone.value=String(route.query.phone||'');
5182      });
5183      async function requestOtp(){
5184        if(cooldown.remaining.value>0)return;
5185        notRegistered.value=false;store.state.busy=true;store.state.msg='جاري إرسال رمز التحقق...';
5186        const r=await api('/api/auth/request-otp',{method:'POST',body:JSON.stringify({phone:norm(phone.value),purpose:'member_login'})});
5187        store.state.busy=false;store.state.msg=r.message||r.error||'';otp.value=!!r.ok;notRegistered.value=!!r.not_registered;if(r.ok)cooldown.start();
5188      }
5189      async function verifyOtp(){
5190        store.state.busy=true;store.state.msg='جاري التحقق...';
5191        const r=await api('/api/auth/verify-otp',{method:'POST',body:JSON.stringify({phone:norm(phone.value),code:code.value,purpose:'member_login'})});
5192        store.state.busy=false;store.state.msg=r.message||r.error||'';
5193        if(r.ok){
5194          await store.loadMe(true);const mm=store.state.me&&store.state.me.member;
5195          let saved='';try{saved=sessionStorage.getItem('gzc_vue_next')||'';sessionStorage.removeItem('gzc_vue_next');}catch(e){}
5196          const target=profileNeedsCompletion(mm)?'/complete':safeMemberNext((route.query&&route.query.next)||saved,'/account');
5197          router.replace(target);
5198        }
5199      }
5200      function openRegister(){router.push({path:'/register',query:phone.value?{phone:norm(phone.value)}:{}});}
5201      function applyPrefix(prefix){phone.value=withCountryCode(phone.value,prefix);}
5202      return {store,phone,code,otp,notRegistered,cooldown,requestOtp,verifyOtp,openRegister,applyPrefix};
5203    },
5204    render:(function(){
5205const _Vue = Vue
5206const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
5207
5208const _hoisted_1 = { class: "card authCard" }
5209const _hoisted_2 = ["onUpdate:modelValue"]
5210const _hoisted_3 = {
5211  class: "countryCodeAssist",
5212  "aria-label": "اختيار مفتاح الدولة"
5213}
5214const _hoisted_4 = ["onClick"]
5215const _hoisted_5 = ["onClick"]
5216const _hoisted_6 = ["disabled", "onClick"]
5217const _hoisted_7 = ["onUpdate:modelValue"]
5218const _hoisted_8 = ["disabled", "onClick"]
5219const _hoisted_9 = ["onClick"]
5220const _hoisted_10 = {
5221  key: 1,
5222  class: "hint warningText"
5223}
5224
5225return function render(_ctx, _cache) {
5226  with (_ctx) {
5227    const { createElementVNode: _createElementVNode, vModelText: _vModelText, withDirectives: _withDirectives, toDisplayString: _toDisplayString, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
5228
5229    const _component_PublicFrame = _resolveComponent("PublicFrame")
5230
5231    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "دخول العضوية" }, {
5232      default: _withCtx(() => [_createElementVNode("section", _hoisted_1, [
5233        _cache[2] || (_cache[2] = _createElementVNode("h3", null, "مرحباً بعودتك", -1)),
5234        _cache[3] || (_cache[3] = _createElementVNode("p", { class: "hint" }, "أدخل رقم واتساب المرتبط بعضويتك لاستلام رمز التحقق.", -1)),
5235        _cache[4] || (_cache[4] = _createElementVNode("label", {
5236          class: "fieldLabel",
5237          for: "member-login-phone"
5238        }, "رقم واتساب مع مفتاح الدولة", -1)),
5239        _withDirectives(_createElementVNode("input", {
5240          id: "member-login-phone",
5241          class: "ltr",
5242          "onUpdate:modelValue": $event => ((phone) = $event),
5243          inputmode: "tel",
5244          autocomplete: "tel",
5245          placeholder: "مثال: 86138xxxxxxxx"
5246        }, null, 8, _hoisted_2), [[_vModelText, phone]]),
5247        _createElementVNode("div", _hoisted_3, [_createElementVNode("button", {
5248          type: "button",
5249          onClick: $event => (applyPrefix('86'))
5250        }, "+86 الصين", 8, _hoisted_4), _createElementVNode("button", {
5251          type: "button",
5252          onClick: $event => (applyPrefix('249'))
5253        }, "+249 السودان", 8, _hoisted_5)]),
5254        _createElementVNode("button", {
5255          class: "btn loadMore",
5256          disabled: store.state.busy || cooldown.remaining.value>0,
5257          onClick: requestOtp
5258        }, _toDisplayString(cooldown.remaining.value?'إعادة الإرسال خلال '+cooldown.remaining.value+' ثانية':(otp?'إعادة إرسال الرمز':'إرسال رمز التحقق')), 9, _hoisted_6),
5259        otp
5260          ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [
5261              _cache[0] || (_cache[0] = _createElementVNode("label", {
5262                class: "fieldLabel",
5263                for: "member-login-code"
5264              }, "رمز التحقق", -1)),
5265              _withDirectives(_createElementVNode("input", {
5266                id: "member-login-code",
5267                class: "ltr otpInput",
5268                "onUpdate:modelValue": $event => ((code) = $event),
5269                inputmode: "numeric",
5270                autocomplete: "one-time-code",
5271                maxlength: "6",
5272                placeholder: "6 أرقام"
5273              }, null, 8, _hoisted_7), [[_vModelText, code]]),
5274              _createElementVNode("button", {
5275                class: "btn loadMore",
5276                disabled: store.state.busy,
5277                onClick: verifyOtp
5278              }, "تسجيل الدخول", 8, _hoisted_8),
5279              _cache[1] || (_cache[1] = _createElementVNode("p", { class: "hint" }, "صلاحية الرمز 5 دقائق، والحد الأقصى 3 محاولات.", -1))
5280            ], 64))
5281          : _createCommentVNode("", true),
5282        _cache[5] || (_cache[5] = _createElementVNode("div", { class: "authDivider" }, [_createElementVNode("span", null, "ليس لديك عضوية؟")], -1)),
5283        _createElementVNode("button", {
5284          class: "btn secondary loadMore",
5285          onClick: openRegister
5286        }, "طلب عضوية جديدة", 8, _hoisted_9),
5287        notRegistered
5288          ? (_openBlock(), _createElementBlock("p", _hoisted_10, "رقمك غير مسجل. ابدأ طلب عضوية جديدة من الزر أعلاه."))
5289          : _createCommentVNode("", true)
5290      ])]),
5291      _: 1
5292    }))
5293  }
5294}
5295})()
5296  };
5297
5298
5299  const MemberRegisterPage={
5300    components:{PublicFrame},
5301    setup(){
5302      const store=useGzcStore(); const router=useRouter(); const route=useRoute();
5303      const phone=ref(String((route.query&&route.query.phone)||'')); const code=ref(''); const otp=ref(false); const existing=ref(false);
5304      const cooldown=useOtpCooldown(60);
5305      async function requestOtp(){
5306        if(cooldown.remaining.value>0)return;
5307        existing.value=false;store.state.busy=true;store.state.msg='جاري إرسال رمز التحقق...';
5308        const r=await api('/api/auth/request-otp',{method:'POST',body:JSON.stringify({phone:norm(phone.value),purpose:'member_register'})});
5309        store.state.busy=false;store.state.msg=r.message||r.error||'';otp.value=!!r.ok;existing.value=!!r.existing;if(r.ok)cooldown.start();
5310      }
5311      async function verifyOtp(){
5312        store.state.busy=true;store.state.msg='جاري إنشاء طلب العضوية...';
5313        const r=await api('/api/auth/verify-otp',{method:'POST',body:JSON.stringify({phone:norm(phone.value),code:code.value,purpose:'member_register'})});
5314        store.state.busy=false;store.state.msg=r.message||r.error||'';
5315        if(r.ok){await store.loadMe(true);router.replace(r.redirect||'/complete');}
5316      }
5317      function openLogin(){router.push({path:'/login',query:phone.value?{phone:norm(phone.value)}:{}});}
5318      function applyPrefix(prefix){phone.value=withCountryCode(phone.value,prefix);}
5319      return {store,phone,code,otp,existing,cooldown,requestOtp,verifyOtp,openLogin,applyPrefix};
5320    },
5321    render:(function(){
5322const _Vue = Vue
5323const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
5324
5325const _hoisted_1 = { class: "card authCard" }
5326const _hoisted_2 = ["onUpdate:modelValue"]
5327const _hoisted_3 = {
5328  class: "countryCodeAssist",
5329  "aria-label": "اختيار مفتاح الدولة"
5330}
5331const _hoisted_4 = ["onClick"]
5332const _hoisted_5 = ["onClick"]
5333const _hoisted_6 = ["disabled", "onClick"]
5334const _hoisted_7 = ["onUpdate:modelValue"]
5335const _hoisted_8 = ["disabled", "onClick"]
5336const _hoisted_9 = ["onClick"]
5337const _hoisted_10 = {
5338  key: 1,
5339  class: "hint warningText"
5340}
5341
5342return function render(_ctx, _cache) {
5343  with (_ctx) {
5344    const { createElementVNode: _createElementVNode, vModelText: _vModelText, withDirectives: _withDirectives, toDisplayString: _toDisplayString, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
5345
5346    const _component_PublicFrame = _resolveComponent("PublicFrame")
5347
5348    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "طلب عضوية جديدة" }, {
5349      default: _withCtx(() => [_createElementVNode("section", _hoisted_1, [
5350        _cache[2] || (_cache[2] = _createElementVNode("h3", null, "ابدأ طلب العضوية", -1)),
5351        _cache[3] || (_cache[3] = _createElementVNode("p", { class: "hint" }, "تحقق من رقم واتساب أولاً، ثم أكمل بياناتك وأرسل الطلب للمراجعة.", -1)),
5352        _cache[4] || (_cache[4] = _createElementVNode("div", { class: "stepPills" }, [_createElementVNode("span", { class: "active" }, "1 التحقق"), _createElementVNode("span", null, "2 البيانات"), _createElementVNode("span", null, "3 المراجعة")], -1)),
5353        _cache[5] || (_cache[5] = _createElementVNode("label", {
5354          class: "fieldLabel",
5355          for: "member-register-phone"
5356        }, "رقم واتساب مع مفتاح الدولة", -1)),
5357        _withDirectives(_createElementVNode("input", {
5358          id: "member-register-phone",
5359          class: "ltr",
5360          "onUpdate:modelValue": $event => ((phone) = $event),
5361          inputmode: "tel",
5362          autocomplete: "tel",
5363          placeholder: "مثال: 86138xxxxxxxx"
5364        }, null, 8, _hoisted_2), [[_vModelText, phone]]),
5365        _createElementVNode("div", _hoisted_3, [_createElementVNode("button", {
5366          type: "button",
5367          onClick: $event => (applyPrefix('86'))
5368        }, "+86 الصين", 8, _hoisted_4), _createElementVNode("button", {
5369          type: "button",
5370          onClick: $event => (applyPrefix('249'))
5371        }, "+249 السودان", 8, _hoisted_5)]),
5372        _createElementVNode("button", {
5373          class: "btn loadMore",
5374          disabled: store.state.busy || cooldown.remaining.value>0,
5375          onClick: requestOtp
5376        }, _toDisplayString(cooldown.remaining.value?'إعادة الإرسال خلال '+cooldown.remaining.value+' ثانية':(otp?'إعادة إرسال الرمز':'إرسال رمز التحقق')), 9, _hoisted_6),
5377        otp
5378          ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [
5379              _cache[0] || (_cache[0] = _createElementVNode("label", {
5380                class: "fieldLabel",
5381                for: "member-register-code"
5382              }, "رمز التحقق", -1)),
5383              _withDirectives(_createElementVNode("input", {
5384                id: "member-register-code",
5385                class: "ltr otpInput",
5386                "onUpdate:modelValue": $event => ((code) = $event),
5387                inputmode: "numeric",
5388                autocomplete: "one-time-code",
5389                maxlength: "6",
5390                placeholder: "6 أرقام"
5391              }, null, 8, _hoisted_7), [[_vModelText, code]]),
5392              _createElementVNode("button", {
5393                class: "btn loadMore",
5394                disabled: store.state.busy,
5395                onClick: verifyOtp
5396              }, "تحقق وابدأ التسجيل", 8, _hoisted_8),
5397              _cache[1] || (_cache[1] = _createElementVNode("p", { class: "hint" }, "صلاحية الرمز 5 دقائق، والحد الأقصى 3 محاولات.", -1))
5398            ], 64))
5399          : _createCommentVNode("", true),
5400        _cache[6] || (_cache[6] = _createElementVNode("div", { class: "authDivider" }, [_createElementVNode("span", null, "لديك عضوية بالفعل؟")], -1)),
5401        _createElementVNode("button", {
5402          class: "btn secondary loadMore",
5403          onClick: openLogin
5404        }, "العودة إلى تسجيل الدخول", 8, _hoisted_9),
5405        existing
5406          ? (_openBlock(), _createElementBlock("p", _hoisted_10, "هذا الرقم مسجل بالفعل. استخدم تسجيل الدخول."))
5407          : _createCommentVNode("", true)
5408      ])]),
5409      _: 1
5410    }))
5411  }
5412}
5413})()
5414  };
5415
5416  const PublicAccountPage={
5417    components:{PublicFrame},
5418    setup(){
5419      const store=useGzcStore();const router=useRouter();const file=ref(null);const fileName=ref('لم يتم اختيار صورة');const photo=ref('');
5420      const m=computed(()=>store.state.me&&store.state.me.member?store.state.me.member:null);
5421      const canComplete=computed(()=>profileNeedsCompletion(m.value));
5422      const canViewCard=computed(()=>canShowMemberCard(m.value));
5423      const ordersShortcutVisible=computed(()=>!!(m.value&&m.value.show_orders_navigation));
5424      const cardSrc=computed(()=>canViewCard.value?'/api/member/card-image?v='+encodeURIComponent(((m.value&&(m.value.photo_card_url||m.value.photo_profile_url||m.value.photo_url))||(m.value&&m.value.gzc_id)||'')+'-'+Date.now()):'');
5425      const cardLink=computed(()=>canViewCard.value&&m.value&&m.value.gzc_id?'/member-card/'+encodeURIComponent(m.value.gzc_id):'');
5426      function saveMyCard(){if(!canViewCard.value){if(canComplete.value){store.state.msg='أكمل بياناتك أولاً قبل حفظ البطاقة';router.push('/complete');}else store.state.msg='بطاقة العضوية تظهر بعد اعتماد العضوية وإصدار الرقم';return;}saveCardPng(cardSrc.value,m.value.gzc_id,store);}
5427      onMounted(async()=>
5427{if(await store.requireMember(router,'/account')){const [r]=await Promise.all([api('/api/member/engagement'),store.loadMemberNotifications('all',8),store.loadMemberWorkflowSummary()]);if(r&&r.ok)store.state.engagement=r;}});
5428      function onFile(e){file.value=e.target.files&&e.target.files[0]?e.target.files[0]:null;fileName.value=file.value?file.value.name:'لم يتم اختيار صورة';photo.value=file.value?URL.createObjectURL(file.value):'';}
5429      async function uploadPhoto(){if(!file.value){store.state.msg='اختر صورة أولاً';return;}const fd=new FormData();fd.append('file',file.value);store.state.busy=true;store.state.msg='جاري رفع الصورة...';const r=await uploadApi('/api/member/photo',{method:'POST',body:fd,headers:{'Accept':'application/json'},uploadLabel:'رفع صورة الحساب'});store.state.busy=false;store.state.msg=r.message||r.error||'';file.value=null;fileName.value='لم يتم اختيار صورة';photo.value='';await store.loadMe();}
5430      async function removePhoto(){if(!m.value||!(m.value.photo_profile_url||m.value.photo_url)){store.state.msg='لا توجد صورة محفوظة';return;}if(!confirm('حذف صورتك من ملف العضوية؟'))return;store.state.busy=true;const r=await api('/api/member/photo/remove',{method:'POST'});store.state.busy=false;store.state.msg=r.message||r.error||'';await store.loadMe();}
5431      async function openAccountNotification(n){if(!n)return;if(!n.read_at){const r=await api('/api/member/notifications/'+encodeURIComponent(n.id)+'/read',{method:'POST',body:'{}'});if(r&&r.ok){n.read_at=r.notification&&r.notification.read_at||new Date().toISOString();store.state.memberUnread=Math.max(0,Number(store.state.memberUnread||0)-1);}}if(n.order_id)router.push('/orders?order='+encodeURIComponent(n.order_id));else if(n.request_id)router.push('/procurement?request='+encodeURIComponent(n.request_id));else router.push('/notifications');}
5432      async function setOrdersShortcutVisible(value){const next=!!value;const r=await runBusyAction(store,'member-preferences.orders-navigation',()=>api('/api/member/preferences/navigation',{method:'POST',body:JSON.stringify({show_orders_navigation:next})}));store.state.msg=r.message||r.error||'';if(r&&r.ok){if(store.state.me&&store.state.me.member)store.state.me.member.show_orders_navigation=next;await store.loadMe();}}
5433      return {store,router,m,statusName,onFile,uploadPhoto,removePhoto,openAccountNotification,setOrdersShortcutVisible,ordersShortcutVisible,fileName,photo,canComplete,canViewCard,cardSrc,cardLink,saveMyCard,shortDate};
5434    },
5435    render:(function(){
5436const _Vue = Vue
5437const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
5438
5439const _hoisted_1 = {
5440  key: 0,
5441  class: "card accountOperationsHub accountOperationsPrimary"
5442}
5443const _hoisted_2 = { class: "memberSectionHead" }
5444const _hoisted_3 = ["onClick"]
5445const _hoisted_4 = { key: 0 }
5446const _hoisted_5 = { class: "accountOperationsGrid" }
5447const _hoisted_6 = ["onClick"]
5448const _hoisted_7 = ["onClick"]
5449const _hoisted_8 = ["onClick"]
5450const _hoisted_9 = {
5451  key: 1,
5452  class: "card myChinaAccountLaunch"
5453}
5454const _hoisted_10 = { class: "memberSectionHead" }
5455const _hoisted_11 = ["onClick"]
5456const _hoisted_12 = { class: "dailyQuickRow" }
5457const _hoisted_13 = ["onClick"]
5458const _hoisted_14 = ["onClick"]
5459const _hoisted_15 = ["onClick"]
5460const _hoisted_16 = {
5461  key: 2,
5462  class: "card accountNotificationsPreview"
5463}
5464const _hoisted_17 = { class: "memberSectionHead" }
5465const _hoisted_18 = ["onClick"]
5466const _hoisted_19 = ["onClick"]
5467const _hoisted_20 = {
5468  key: 3,
5469  class: "card accountPreferenceCard"
5470}
5471const _hoisted_21 = { class: "memberSectionHead" }
5472const _hoisted_22 = ["aria-pressed", "onClick"]
5473const _hoisted_23 = { class: "accountPreferenceActions" }
5474const _hoisted_24 = ["onClick"]
5475const _hoisted_25 = ["onClick"]
5476const _hoisted_26 = {
5477  key: 4,
5478  class: "card pointsCard compactPointsCard"
5479}
5480const _hoisted_27 = { class: "memberCardTop" }
5481const _hoisted_28 = { class: "miniStats mediaMini" }
5482const _hoisted_29 = ["onClick"]
5483const _hoisted_30 = {
5484  key: 5,
5485  class: "card skeleton"
5486}
5487const _hoisted_31 = {
5488  key: 6,
5489  class: "card profileCard dataProfile"
5490}
5491const _hoisted_32 = { class: "accountPhotoHero" }
5492const _hoisted_33 = ["src"]
5493const _hoisted_34 = {
5494  key: 1,
5495  class: "avatar placeholder"
5496}
5497const _hoisted_35 = {
5498  key: 2,
5499  class: "statusPill"
5500}
5501const _hoisted_36 = { class: "infoGrid" }
5502const _hoisted_37 = { class: "uploadBox uploadBoxPro photoManagerCard" }
5503const _hoisted_38 = { class: "filePicker" }
5504const _hoisted_39 = ["onChange"]
5505const _hoisted_40 = { class: "row" }
5506const _hoisted_41 = ["onClick"]
5507const _hoisted_42 = ["onClick"]
5508const _hoisted_43 = {
5509  key: 0,
5510  class: "accountMembershipCard"
5511}
5512const _hoisted_44 = ["src"]
5513const _hoisted_45 = { class: "cardSaveActions" }
5514const _hoisted_46 = ["onClick"]
5515const _hoisted_47 = ["href"]
5516const _hoisted_48 = {
5517  key: 1,
5518  class: "completeRequiredCard"
5519}
5520const _hoisted_49 = ["onClick"]
5521const _hoisted_50 = {
5522  key: 2,
5523  class: "completeRequiredCard"
5524}
5525const _hoisted_51 = {
5526  key: 3,
5527  class: "completeRequiredCard"
5528}
5529const _hoisted_52 = { class: "row" }
5530const _hoisted_53 = ["onClick"]
5531const _hoisted_54 = ["onClick"]
5532const _hoisted_55 = ["onClick"]
5533
5534return function render(_ctx, _cache) {
5535  with (_ctx) {
5536    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, normalizeClass: _normalizeClass, renderList: _renderList, Fragment: _Fragment, createTextVNode: _createTextVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
5537
5538    const _component_PublicFrame = _resolveComponent("PublicFrame")
5539
5540    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "حسابي" }, {
5541      default: _withCtx(() => [
5542        (m&&m.status==='approved')
5543          ? (_openBlock(), _createElementBlock("section", _hoisted_1, [_createElementVNode("div", _hoisted_2, [_cache[1] || (_cache[1] = _createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "مركز المتابعة"), _createElementVNode("h3", null, "طلباتك وإشعاراتك"), _createElementVNode("p", { class: "hint" }, "كل ما يحتاج انتباهك يظهر هنا أولاً.")], -1)), _createElementVNode("button", {
5544              class: _normalizeClass(["accountBellAction", {attention:store.state.memberUnread}]),
5545              onClick: $event => ($router.push('/notifications')),
5546              "aria-label": "فتح الإشعارات"
5547            }, [_cache[0] || (_cache[0] = _createElementVNode("span", null, "🔔", -1)), (store.state.memberUnread)
5548              ? (_openBlock(), _createElementBlock("b", _hoisted_4, _toDisplayString(store.state.memberUnread>99?'99+':store.state.memberUnread), 1))
5549              : _createCommentVNode("", true)], 10, _hoisted_3)]), _createElementVNode("div", _hoisted_5, [ordersShortcutVisible
5550              ? (_openBlock(), _createElementBlock("button", {
5551                  key: 0,
5552                  onClick: $event => ($router.push('/orders'))
5553                }, [_cache[2] || (_cache[2] = _createElementVNode("span", null, "🧾", -1)), _cache[3] || (_cache[3] = _createElementVNode("b", null, "طلباتي", -1)), _createElementVNode("small", null, _toDisplayString(store.state.memberWorkflowSummary.total||0) + " طلب · " + _toDisplayString(store.state.memberWorkflowSummary.needs_action||0) + " يحتاج إجراء", 1)], 8, _hoisted_6))
5554              : _createCommentVNode("", true), _createElementVNode("button", { onClick: $event => ($router.push('/procurement/new')) }, _cache[4] || (_cache[4] = [_createElementVNode("span", null, "+", -1), _createElementVNode("b", null, "طلب جديد", -1), _createElementVNode("small", null, "طلب عرض، بحث مورد أو خدمة توريد", -1)]), 8, _hoisted_7), _createElementVNode("button", { onClick: $event => ($router.push('/wallet')) }, _cache[5] || (_cache[5] = [_createElementVNode("span", null, "Ⓢ", -1), _createElementVNode("b", null, "محفظتي", -1), _createElementVNode("small", null, "رصيد SMT مستقل عن نقاط المشاركة", -1)]), 8, _hoisted_8)])]))
5555          : _createCommentVNode("", true),
5556        (m&&m.status==='approved')
5557          ? (_openBlock(), _createElementBlock("section", _hoisted_9, [_createElementVNode("div", _hoisted_10, [_cache[6] || (_cache[6] = _createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "SMT China يومياً"), _createElementVNode("h3", null, "My China"), _createElementVNode("p", { class: "hint" }, "مدينتك، التعميمات، المعارض، الأدوات.")
5557], -1)), _createElementVNode("button", {
5558              class: "smallbtn",
5559              onClick: $event => ($router.push('/my-china'))
5560            }, "فتح My China", 8, _hoisted_11)]), _createElementVNode("div", _hoisted_12, [_createElementVNode("button", { onClick: $event => ($router.push('/new-to-china')) }, "🧭 أنا جديد", 8, _hoisted_13), _createElementVNode("button", { onClick: $event => ($router.push('/ask')) }, "✦ اسأل SMT", 8, _hoisted_14), _createElementVNode("button", { onClick: $event => ($router.push('/notification-settings')) }, "🔔 التنبيهات", 8, _hoisted_15)])]))
5561          : _createCommentVNode("", true),
5562        (m&&m.status==='approved'&&store.state.memberNotifications.length)
5563          ? (_openBlock(), _createElementBlock("section", _hoisted_16, [_createElementVNode("div", _hoisted_17, [_cache[7] || (_cache[7] = _createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "آخر الإشعارات"), _createElementVNode("h3", null, "آخر التحديثات")], -1)), _createElementVNode("button", {
5564              class: "smallbtn secondary",
5565              onClick: $event => ($router.push('/notifications'))
5566            }, "عرض الكل", 8, _hoisted_18)]), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(store.state.memberNotifications.slice(0,3), (n) => {
5567              return (_openBlock(), _createElementBlock("button", {
5568                class: _normalizeClass(["accountNotificationRow", {unread:!n.read_at}]),
5569                key: n.id,
5570                onClick: $event => (openAccountNotification(n))
5571              }, [_cache[8] || (_cache[8] = _createElementVNode("span", { class: "accountNotificationDot" }, null, -1)), _createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(n.title), 1), _createElementVNode("small", null, _toDisplayString(n.order_code||n.request_code) + " · " + _toDisplayString(shortDate(n.created_at)), 1)]), _cache[9] || (_cache[9] = _createElementVNode("strong", null, "فتح ←", -1))], 10, _hoisted_19))
5572            }), 128))]))
5573          : _createCommentVNode("", true),
5574        (m&&m.status==='approved')
5575          ? (_openBlock(), _createElementBlock("section", _hoisted_20, [_createElementVNode("div", _hoisted_21, [_cache[11] || (_cache[11] = _createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "تخصيص الواجهة"), _createElementVNode("h3", null, "ظهور «طلباتي»"), _createElementVNode("p", { class: "hint" }, "مخفي افتراضياً. فعّله إذا أردت اختصار «طلباتي» في الرئيسية وشريط التنقل. الإخفاء لا يحذف أي طلب ولا يمنع فتحه من الإشعارات.")], -1)), _createElementVNode("button", {
5576              type: "button",
5577              class: _normalizeClass(["accountPreferenceSwitch", {on:ordersShortcutVisible}]),
5578              "aria-pressed": ordersShortcutVisible?'true':'false',
5579              onClick: $event => (setOrdersShortcutVisible(!ordersShortcutVisible))
5580            }, [_cache[10] || (_cache[10] = _createElementVNode("span", null, null, -1)), _createElementVNode("b", null, _toDisplayString(ordersShortcutVisible?'ظاهر':'مخفي'), 1)], 10, _hoisted_22)]), _createElementVNode("div", _hoisted_23, [_createElementVNode("button", {
5581              class: "smallbtn secondary",
5582              onClick: $event => ($router.push('/orders'))
5583            }, "فتح طلباتي الآن", 8, _hoisted_24), _createElementVNode("button", {
5584              class: "smallbtn",
5585              onClick: $event => (setOrdersShortcutVisible(!ordersShortcutVisible))
5586            }, _toDisplayString(ordersShortcutVisible?'إخفاء من الواجهة':'إظهار في الواجهة'), 9, _hoisted_25)])]))
5587          : _createCommentVNode("", true),
5588        (store.state.engagement)
5589          ? (_openBlock(), _createElementBlock("section", _hoisted_26, [_createElementVNode("div", _hoisted_27, [_createElementVNode("div", null, [_cache[12] || (_cache[12] = _createElementVNode("span", { class: "vueBadge" }, "نقاط المشاركة", -1)), _createElementVNode("h3", null, _toDisplayString(store.state.engagement.total_points || 0) + " نقطة مشاركة", 1), _cache[13] || (_cache[13] = _createElementVNode("p", { class: "hint" }, "نقاط تقديرية للمشاركة المجتمعية، مستقلة عن المحفظة. ليست مالاً ولا رصيداً نقدياً.", -1))]), _cache[14] || (_cache[14] = _createElementVNode("span", null, "⭐", -1))]), _createElementVNode("div", _hoisted_28, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(store.state.engagement.suggestions || 0), 1), _cache[15] || (_cache[15] = _createElementVNode("small", null, "اقتراحات", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(store.state.engagement.rank || '-'), 1), _cache[16] || (_cache[16] = _createElementVNode("small", null, "الترتيب", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString((store.state.engagement.recent||[]).length), 1), _cache[17] || (_cache[17] = _createElementVNode("small", null, "حركات", -1))])]), _createElementVNode("button", {
5590              class: "smallbtn secondary",
5591              onClick: $event => ($router.push('/china-guide'))
5592            }, "اقترح مكان في دليل الصين", 8, _hoisted_29)]))
5593          : _createCommentVNode("", true),
5594        (!m)
5595          ? (_openBlock(), _createElementBlock("div", _hoisted_30, "جاري تحميل الحساب..."))
5596          : (_openBlock(), _createElementBlock("div", _hoisted_31, [
5597              _createElementVNode("div", _hoisted_32, [(photo || $memberPhoto(m,'profile'))
5598                ? (_openBlock(), _createElementBlock("img", {
5599                    key: 0,
5600                    class: "avatar",
5601                    src: photo || $memberPhoto(m,'profile'),
5602                    alt: "صورة العضو"
5603                  }, null, 8, _hoisted_33))
5604                : (_openBlock(), _createElementBlock("div", _hoisted_34, "👤")), photo
5605                ? (_openBlock(), _createElementBlock("span", _hoisted_35, "معاينة قبل الرفع"))
5606                : _createCommentVNode("", true)]),
5607              _createElementVNode("h3", null, _toDisplayString(m.full_name || 'حساب عضو'), 1),
5608              _cache[35] || (_cache[35] = _createElementVNode("p", { class: "hint" }, "هذه صفحة حسابك وبياناتك الشخصية وبطاقة العضوية.", -1)),
5609              _cache[36] || (_cache[36] = _createElementVNode("details", { class: "memberUseDetails" }, [_createElementVNode("summary", null, "كيف أستخدم المنصة؟"), _createElementVNode("div", { class: "usageList" }, [
5610                _createElementVNode("span", null, "🪪 بطاقة العضوية موجودة داخل حسابك ويمكن حفظها كصورة."),
5611                _createElementVNode("span", null, "📣 تابع الإعلانات والتعميمات الرسمية."),
5612                _createElementVNode("span", null, "🎉 شوف الفعاليات وألبومات الصور."),
5613                _createElementVNode("span", null, "🧭 استخدم دليلك في الصين للخدمات والمعلومات."),
5614                _createElementVNode("span", null, "🆘 افتح طلب مساعدة أو طوارئ عند الحاجة.")
5615              ])], -1)),
5616              _createElementVNode("div", _hoisted_36, [
5617                _createElementVNode("p", null, [_cache[18] || (_cache[18] = _createElementVNode("b", null, "الحالة:", -1)), _createTextVNode(" " + _toDisplayString(statusName(m.status)), 1)]),
5618                _createElementVNode("p", null, [_cache[19] || (_cache[19] = _createElementVNode("b", null, "رقم العضوية:", -1)), _createTextVNode(" " + _toDisplayString(m.gzc_id || '-'), 1)]),
5619                _createElementVNode("p", null, [_cache[20] || (_cache[20] = _createElementVNode("b", null, "واتساب:", -1)), _createTextVNode(" " + _toDisplayString(m.whatsapp || '-'), 1)]),
5620                _createElementVNode("p", null, [_cache[21] || (_cache[21] = _createElementVNode("b", null, "هاتف الصين:", -1)), _createTextVNode(" " + _toDisplayString(m.china_ph
5620one || '-'), 1)]),
5621                _createElementVNode("p", null, [_cache[22] || (_cache[22] = _createElementVNode("b", null, "المدينة:", -1)), _createTextVNode(" " + _toDisplayString($cityLabel(m.china_city) || '-'), 1)]),
5622                _createElementVNode("p", null, [_cache[23] || (_cache[23] = _createElementVNode("b", null, "الحي:", -1)), _createTextVNode(" " + _toDisplayString(m.china_district || '-'), 1)]),
5623                _createElementVNode("p", null, [_cache[24] || (_cache[24] = _createElementVNode("b", null, "فئة العضوية:", -1)), _createTextVNode(" " + _toDisplayString(m.category || '-'), 1)]),
5624                _createElementVNode("p", null, [_cache[25] || (_cache[25] = _createElementVNode("b", null, "المهنة:", -1)), _createTextVNode(" " + _toDisplayString(m.profession || '-'), 1)])
5625              ]),
5626              _createElementVNode("div", _hoisted_37, [
5627                _cache[27] || (_cache[27] = _createElementVNode("b", null, "تحديث صورة العضو", -1)),
5628                _cache[28] || (_cache[28] = _createElementVNode("p", { class: "hint" }, "سيتم ضبط الصورة تلقائياً لتناسب حسابك، بطاقتك، وقائمة العضويات عند الإدارة.", -1)),
5629                _createElementVNode("label", _hoisted_38, [_createElementVNode("input", {
5630                  type: "file",
5631                  accept: "image/*",
5632                  onChange: onFile
5633                }, null, 40, _hoisted_39), _cache[26] || (_cache[26] = _createElementVNode("span", null, "اختيار صورة", -1)), _createElementVNode("em", null, _toDisplayString(fileName), 1)]),
5634                _createElementVNode("div", _hoisted_40, [_createElementVNode("button", {
5635                  class: "btn secondary",
5636                  onClick: uploadPhoto
5637                }, "رفع الصورة", 8, _hoisted_41), ($memberPhoto(m,'profile'))
5638                  ? (_openBlock(), _createElementBlock("button", {
5639                      key: 0,
5640                      class: "btn danger",
5641                      onClick: removePhoto
5642                    }, "حذف الصورة", 8, _hoisted_42))
5643                  : _createCommentVNode("", true)])
5644              ]),
5645              canViewCard
5646                ? (_openBlock(), _createElementBlock("section", _hoisted_43, [
5647                    _cache[29] || (_cache[29] = _createElementVNode("h3", null, "بطاقة العضوية", -1)),
5648                    _createElementVNode("img", {
5649                      class: "membershipImageOnly",
5650                      src: cardSrc,
5651                      alt: "بطاقة العضوية",
5652                      loading: "eager"
5653                    }, null, 8, _hoisted_44),
5654                    _createElementVNode("div", _hoisted_45, [_createElementVNode("button", {
5655                      class: "btn wide",
5656                      onClick: saveMyCard
5657                    }, "حفظ البطاقة كصورة", 8, _hoisted_46), cardLink
5658                      ? (_openBlock(), _createElementBlock("a", {
5659                          key: 0,
5660                          class: "btn secondary wide",
5661                          href: cardLink,
5662                          target: "_blank"
5663                        }, "فتح البطاقة", 8, _hoisted_47))
5664                      : _createCommentVNode("", true)]),
5665                    _cache[30] || (_cache[30] = _createElementVNode("p", { class: "hint small cardSaveHint" }, "على iPhone استخدم Save Image / حفظ الصورة من نافذة المشاركة. على Android يتم الحفظ أو المشاركة كملف PNG.", -1))
5666                  ]))
5667                : canComplete
5668                  ? (_openBlock(), _createElementBlock("div", _hoisted_48, [_cache[31] || (_cache[31] = _createElementVNode("b", null, "بطاقة العضوية تظهر بعد إكمال البيانات والاعتماد", -1)), _cache[32] || (_cache[32] = _createElementVNode("p", { class: "hint" }, "أكمل بياناتك الرسمية أولاً، ثم تراجعها لجنة العضوية وتصدر الرقم والبطاقة.", -1)), _createElementVNode("button", {
5669                      class: "btn",
5670                      onClick: $event => ($router.push('/complete'))
5671                    }, "إكمال البيانات الآن", 8, _hoisted_49)]))
5672                  : (m.status==='suspended')
5673                    ? (_openBlock(), _createElementBlock("div", _hoisted_50, _cache[33] || (_cache[33] = [_createElementVNode("b", null, "بطاقة العضوية موقوفة", -1), _createElementVNode("p", { class: "hint" }, "تم تعليق العضوية، لذلك لا تتوفر البطاقة أو رابط الحفظ حالياً. تواصل مع لجنة العضوية للمراجعة.", -1)])))
5674                    : (_openBlock(), _createElementBlock("div", _hoisted_51, _cache[34] || (_cache[34] = [_createElementVNode("b", null, "طلب العضوية قيد المراجعة", -1), _createElementVNode("p", { class: "hint" }, "ستظهر البطاقة بعد اعتماد العضوية وإصدار رقم GZC. لا توجد بطاقة قابلة للحفظ قبل الاعتماد.", -1)]))),
5675              _createElementVNode("div", _hoisted_52, [(m.status==='approved'&&ordersShortcutVisible)
5676                ? (_openBlock(), _createElementBlock("button", {
5677                    key: 0,
5678                    class: "btn",
5679                    onClick: $event => ($router.push('/orders'))
5680                  }, "طلباتي", 8, _hoisted_53))
5681                : _createCommentVNode("", true), (m.status==='approved')
5682                ? (_openBlock(), _createElementBlock("button", {
5683                    key: 1,
5684                    class: "btn secondary",
5685                    onClick: $event => ($router.push('/procurement/new'))
5686                  }, "طلب عرض أو شراء", 8, _hoisted_54))
5687                : _createCommentVNode("", true), _createElementVNode("button", {
5688                class: "btn danger",
5689                onClick: $event => (store.logout(router,'/login'))
5690              }, "تسجيل الخروج", 8, _hoisted_55)])
5691            ]))
5692      ]),
5693      _: 1
5694    }))
5695  }
5696}
5697})()
5698  };
5699
5700
5701  const SMT_WALLET_SYMBOL='Ⓢ'; const SMT_WALLET_PEG_COPY='1 Ⓢ = 1 CNY';
5701 function walletMoney(v){const n=Number(v||0);return SMT_WALLET_SYMBOL+' '+(Number.isFinite(n)?n:0).toLocaleString('en-US',{minimumFractionDigits:2,maximumFractionDigits:2});}
5702  function walletTransactionLabel(v){return ({admin_credit:'إيداع إداري',admin_debit:'خصم إداري'})[String(v||'')]||String(v||'-');}
5703  function walletStatusLabel(v){return ({active:'نشطة',not_activated:'غير مفعلة',not_opened:'غير مفعلة',frozen:'موقوفة مؤقتاً',closed:'مغلقة'})[String(v||'')]||'غير متاحة';}
5704  function walletStatusHint(v){return ({active:'يمكنك متابعة الرصيد والحركات المعتمدة هنا.',not_activated:'محفظة SMT اختيارية. قدم طلب تفعيل وسيتم فتحها بعد موافقة الإدارة.',not_opened:'محفظة SMT اختيارية. قدم طلب تفعيل وسيتم فتحها بعد موافقة الإدارة.',frozen:'المحفظة موقوفة مؤقتاً. تواصل مع إدارة SMT إذا كنت تحتاج مراجعة الحالة.',closed:'المحفظة مغلقة ولا تستقبل عمليات جديدة.'})[String(v||'')]||'تواصل مع إدارة SMT لمراجعة حالة المحفظة.';}
5705  const MemberWalletPage={
5706    components:{PublicFrame},
5707    setup(){
5708      const store=useGzcStore();const router=useRouter();const wallet=ref(null);const loading=ref(true),loadError=ref(''),activationBusy=ref(false);
5709      async function load(){loading.value=true;loadError.value='';const r=await api('/api/member/wallet');loading.value=false;if(r.status===401)return router.replace('/login');if(!r.ok){loadError.value=r.message||'تعذر تحميل المحفظة';store.state.msg=loadError.value;return;}wallet.value=r;}
5710      async function requestActivation(){if(!wallet.value||activationBusy.value)return;activationBusy.value=true;const r=await api('/api/member/wallet/activation-request',{method:'POST',feedbackLabel:'جاري إرسال طلب التفعيل...',body:JSON.stringify({})});activationBusy.value=false;store.state.msg=r.message||r.error||'';if(r.ok)await load();}
5711      onMounted(async()=>{if(await store.requireMember(router,'/wallet'))await load();});
5712      return{store,wallet,loading,loadError,activationBusy,load,requestActivation,walletMoney,walletTransactionLabel,walletStatusLabel,walletStatusHint,shortDate,safeArray};
5713    },
5714    render:(function(){
5715const _Vue = Vue
5716const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
5717
5718const _hoisted_1 = {
5719  key: 0,
5720  class: "card walletBalanceHero"
5721}
5722const _hoisted_2 = {
5723  key: 1,
5724  class: "card"
5725}
5726const _hoisted_3 = { class: "memberSectionHead" }
5727const _hoisted_4 = {
5728  key: 0,
5729  class: "hint"
5730}
5731const _hoisted_5 = {
5732  key: 1,
5733  class: "hint"
5734}
5735const _hoisted_6 = { key: 0 }
5736const _hoisted_7 = {
5737  key: 2,
5738  class: "hint"
5739}
5740const _hoisted_8 = ["disabled", "onClick"]
5741const _hoisted_9 = ["onClick"]
5742const _hoisted_10 = {
5743  key: 2,
5744  class: "card"
5745}
5746const _hoisted_11 = { class: "memberSectionHead" }
5747const _hoisted_12 = { class: "hint" }
5748const _hoisted_13 = ["onClick"]
5749const _hoisted_14 = {
5750  key: 3,
5751  class: "card walletPolicyCard"
5752}
5753const _hoisted_15 = {
5754  key: 4,
5755  class: "card"
5756}
5757const _hoisted_16 = { class: "memberSectionHead" }
5758const _hoisted_17 = { class: "adminGuideList walletTransactionList" }
5759const _hoisted_18 = { class: "codeToken" }
5760const _hoisted_19 = {
5761  key: 0,
5762  class: "hint"
5763}
5764const _hoisted_20 = {
5765  key: 5,
5766  class: "card skeleton walletInitialLoading",
5767  "aria-live": "polite"
5768}
5769const _hoisted_21 = {
5770  key: 6,
5771  class: "card emptyCard",
5772  role: "alert"
5773}
5774const _hoisted_22 = { class: "hint" }
5775const _hoisted_23 = ["onClick"]
5776
5777return function render(_ctx, _cache) {
5778  with (_ctx) {
5779    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, renderList: _renderList, Fragment: _Fragment, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
5780
5781    const _component_PublicFrame = _resolveComponent("PublicFrame")
5782
5783    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "محفظتي" }, {
5784      default: _withCtx(() => [
5785        (wallet&&wallet.access&&wallet.access.activated)
5786          ? (_openBlock(), _createElementBlock("section", _hoisted_1, [_createElementVNode("div", null, [_cache[0] || (_cache[0] = _createElementVNode("span", { class: "vueBadge" }, "SMT Wallet", -1)), _createElementVNode("h2", null, _toDisplayString(walletMoney(wallet.balance)), 1), _cache[1] || (_cache[1] = _createElementVNode("p", null, [_createTextVNode("رصيد SMT مستقل تماماً عن نقاط المشاركة. "), _createElementVNode("b", null, "1 Ⓢ = 1 CNY"), _createTextVNode(" دائماً.")], -1))]), _cache[2] || (_cache[2] = _createElementVNode("span", null, "Ⓢ", -1))]))
5787          : _createCommentVNode("", true),
5788        (wallet&&wallet.access&&!wallet.access.activated)
5789          ? (_openBlock(), _createElementBlock("section", _hoisted_2, [_createElementVNode("div", _hoisted_3, [_createElementVNode("div", null, [_cache[4] || (_cache[4] = _createElementVNode("span", { class: "adminEyebrow" }, "محفظة SMT", -1)), _createElementVNode("h3", null, _toDisplayString(wallet.access.status==='pending'?'طلب التفعيل قيد المراجعة':wallet.access.status==='rejected'?'طلب التفعيل لم تتم الموافقة عليه':'المحفظة غير مفعلة'), 1), (wallet.access.status==='pending')
5790              ? (_openBlock(), _createElementBlock("p", _hoisted_4, "استلمت الإدارة طلبك. سيتم تفعيل المحفظة بعد الموافقة."))
5791              : (wallet.access.status==='rejected')
5792                ? (_openBlock(), _createElementBlock("p", _hoisted_5, [_cache[3] || (_cache[3] = _createTextVNode("يمكنك تقديم طلب جديد إذا كنت ما زلت تحتاج المحفظة.")), (wallet.access.request&&wallet.access.request.review_note)
5793                    ? (_openBlock(), _createElementBlock("span", _hoisted_6, " · " + _toDisplayString(wallet.access.request.review_note), 1))
5794                    : _createCommentVNode("", true)]))
5795                : (_openBlock(), _createElementBlock("p", _hoisted_7, "محفظة SMT اختيارية ولا تُفتح تلقائياً. اطلب التفعيل من هنا."))]), _cache[5] || (_cache[5] = _createElementVNode("span", { class: "walletActivationSymbol" }, "Ⓢ", -1))]), (wallet.access.status!=='pending')
5796              ? (_openBlock(), _createElementBlock("button", {
5797                  key: 0,
5798                  class: "btn",
5799                  disabled: activationBusy,
5800                  onClick: requestActivation
5801                }, _toDisplayString(activationBusy?'جاري الإرسال...':'طلب تفعيل محفظة SMT'), 9, _hoisted_8))
5802              : (_openBlock(), _createElementBlock("button", {
5803                  key: 1,
5804                  class: "smallbtn secondary",
5805                  onClick: load
5806                }, "تحديث الحالة", 8, _hoisted_9)), _cache[6] || (_cache[6] = _createElementVNode("p", { class: "hint" }, "بعد موافقة الإدارة يبدأ الرصيد من Ⓢ 0.00. التحويل بين الأعضاء والسحب وتحويل العملات غير متاحة حالياً.", -1))]))
5807          : _createCommentVNode("", true),
5808        (wallet&&wallet.access&&wallet.access.activated)
5809          ? (_openBlock(), _createElementBlock("section", _hoisted_10, [_createElementVNode("div", _hoisted_11, [_createElementVNode("div", null, [_cache[7] || (_cache[7] = _
5809createElementVNode("span", { class: "adminEyebrow" }, "حالة المحفظة", -1)), _createElementVNode("h3", null, _toDisplayString(walletStatusLabel(wallet.account.status)), 1), _createElementVNode("p", _hoisted_12, _toDisplayString(walletStatusHint(wallet.account.status)), 1)]), _createElementVNode("button", {
5810              class: "smallbtn secondary",
5811              onClick: load
5812            }, "تحديث", 8, _hoisted_13)])]))
5813          : _createCommentVNode("", true),
5814        (wallet&&wallet.access&&wallet.access.activated)
5815          ? (_openBlock(), _createElementBlock("section", _hoisted_14, _cache[8] || (_cache[8] = [_createElementVNode("b", null, "استخدام المحفظة حالياً", -1), _createElementVNode("p", { class: "hint" }, "تُسجّل الإيداعات والخصومات بعد تحقق إدارة SMT. التحويل بين الأعضاء والسحب النقدي أو البنكي وتحويل العملات غير متاحة حالياً.", -1)])))
5816          : _createCommentVNode("", true),
5817        (wallet&&wallet.access&&wallet.access.activated)
5818          ? (_openBlock(), _createElementBlock("section", _hoisted_15, [_
5818createElementVNode("div", _hoisted_16, [_cache[9] || (_cache[9] = _createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "السجل"), _createElementVNode("h3", null, "آخر حركات المحفظة")], -1)), _createElementVNode("span", null, _toDisplayString(wallet.entries||0) + " حركة", 1)]), _createElementVNode("div", _hoisted_17, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(safeArray(wallet.transactions), (t) => {
5819              return (_openBlock(), _createElementBlock("div", {
5820                class: "guideAdminItem",
5821                key: t.id
5822              }, [_createElementVNode("span", _hoisted_18, _toDisplayString(t.transaction_code), 1), _createElementVNode("b", null, _toDisplayString(walletTransactionLabel(t.transaction_type)) + " · " + _toDisplayString(walletMoney(t.amount)), 1), _createElementVNode("small", null, _toDisplayString(t.reason) + " · " + _toDisplayString(shortDate(t.created_at)), 1)]))
5823            }), 128)), (!safeArray(wallet.transactions).length)
5824              ? (_openBlock(), _createElementBlock("p", _hoisted_19, "لا توجد حركات مالية في المحفظة حتى الآن."))
5825              : _createCommentVNode("", true)])]))
5826          : _createCommentVNode("", true),
5827        (!wallet&&loading)
5828          ? (_openBlock(), _createElementBlock("section", _hoisted_20, "جاري تحميل المحفظة..."))
5829          : (!wallet&&loadError)
5830            ? (_openBlock(), _createElementBlock("section", _hoisted_21, [_cache[10] || (_cache[10] = _createElementVNode("b", null, "تعذر عرض المحفظة", -1)), _createElementVNode("p", _hoisted_22, _toDisplayString(loadError), 1), _createElementVNode("button", {
5831                class: "smallbtn",
5832                onClick: load
5833              }, "إعادة المحاولة", 8, _hoisted_23)]))
5834            : _createCommentVNode("", true)
5835      ]),
5836      _: 1
5837    }))
5838  }
5839}
5840})()
5841  };
5842
5843  const AdminWalletPage={
5844    components:{AdminFrame},
5845    setup(){
5846      const store=useGzcStore();const router=useRouter();const route=useRoute();
5847      const members=ref([]),stats=ref({}),detail=ref(null),reconciliation=ref(null),detailReconciliation=ref(null),recentTransactions=ref([]),activationRequests=ref([]),activationNotes=reactive({}),search=ref(''),statusFilter=ref('all'),page=ref(1),pagination=ref({page:1,limit:10,total:0,pages:1,has_previous:false,has_next:false}),localBusy=ref(false);
5848      const selectedId=computed(()=>String(route.params.id||''));const workspaceMode=computed(()=>!!selectedId.value);const postingBlocked=computed(()=>['not_activated','frozen','closed'].includes(String(detail.value&&detail.value.account&&detail.value.account.status||'')));
5849      const form=reactive({operation:'credit',amount:'',reason:'',idempotency_key:''});
5850      function freshKey(){const a=new Uint32Array(4);try{window.crypto.getRandomValues(a)}catch(_){for(let i=0;i<a.length;i++)a[i]=Math.floor(Math.random()*0xffffffff)}return 'wallet-ui-'+Date.now()+'-'+Array.from(a).map(x=>x.toString(16).padStart(8,'0')).join('');}
5851      function resetForm(){form.operation='credit';form.amount='';form.reason='';form.idempotency_key=freshKey();}
5852      async function loadList(resetPage=false){if(resetPage)page.value=1;localBusy.value=true;const qs=new URLSearchParams({search:String(search.value||''),status:String(statusFilter.value||'all'),page:String(page.value||1),limit:'10'});const r=await api('/api/admin/wallet?'+qs.toString(),{feedbackLabel:'جاري تحميل المحفظة...'});localBusy.value=false;if(r.status===401)return router.replace('/admin/login');if(r.status===403){store.state.msg=r.message||'غير مصرح';return router.replace('/admin');}if(!r.ok){store.state.msg=r.message||'تعذر تحميل المحفظة';return;}members.value=safeArray(r.members);recentTransactions.value=safeArray(r.recent_transactions);activationRequests.value=safeArray(r.pending_activation_requests);stats.value=r.stats||{};pagination.value=Object.assign({page:1,limit:10,total:0,pages:1,has_previous:false,has_next:false},r.pagination||{});page.value=Number(pagination.value.page||1);}
5853      async function loadDetail(){if(!selectedId.value){detail.value=null;return;}localBusy.value=true;const r=await api('/api/admin/wallet/'+encodeURIComponent(selectedId.value),{feedbackLabel:'جاري فتح حساب المحفظة...'});localBusy.value=false;if(r.status===401)return router.replace('/admin/login');if(!r.ok){store.state.msg=r.message||'تعذر تحميل حساب المحفظة';detail.value=null;return;}detail.value=r;}
5854      async function loadReconciliation(){const r=await api('/api/admin/wallet/reconciliation',{feedbackLabel:'جاري تدقيق المحفظة...'});if(r.status===401)return router.replace('/admin/login');if(r.ok)reconciliation.value=r;}
5855      async function loadDetailReconciliation(){if(!selectedId.value){detailReconciliation.value=null;return;}const r=await api('/api/admin/wallet/'+encodeURIComponent(selectedId.value)+'/reconciliation',{feedbackLabel:'جاري تدقيق الحساب...'});if(r.status===401)return router.replace('/admin/login');detailReconciliation.value=r.ok?r:null;}
5856      async function openMember(m){await router.push('/admin/wallet/'+encodeURIComponent(m.id));}
5857      async function back(){await router.push('/admin/wallet');}
5858      async function changePage(nextPage){const n=Math.max(1,Math.min(Number(pagination.value.pages||1),Number(nextPage||1)));if(n===page.value)return;page.value=n;await loadList(false);}
5859      async function reviewActivation(r,decision){if(!r||localBusy.value)return;const label=decision==='approve'?'الموافقة على تفعيل محفظة '+(r.full_name||'العضو')+'؟':'رفض طلب تفعيل محفظة '+(r.full_name||'العضو')+'؟';if(!window.confirm(label))return;localBusy.value=true;const rs=await api('/api/admin/wallet/activation-requests/'+encodeURIComponent(r.id)+'/review',{method:'POST',feedbackLabel:decision==='approve'?'جاري تفعيل المحفظة...':'جاري تسجيل الرفض...',body:JSON.stringify({decision,note:String(activationNotes[r.id]||'').trim()})});localBusy.value=false;store.state.msg=rs.message||rs.error||'';if(rs.ok){delete activationNotes[r.id];await loadList();}}
5860      async function adjust(){if(!detail.value||!detail.value.member)return;if(postingBlocked.value){store.state.msg='المحفظة موقوفة أو مغلقة ولا تقبل معاملات جديدة';return;}const amount=String(form.amount||'').trim(),reason=String(form.reason||'').trim();if(!amount||!reason){store.state.msg='أدخل المبلغ وسبب العملية';return;}const action=form.operation==='credit'?'إيداع':'خصم';if(!window.confirm(action+' '+walletMoney(amount)+' للعضو '+(detail.value.member.full_name||'')+'؟\nسيتم إنشاء معاملة وقيدين متوازنين ولا يمكن تعديل المعاملة بعد ترحيلها.'))return;localBusy.value=true;const r=await api('/api/admin/wallet/'+encodeURIComponent(detail.value.member.id)+'/adjust',{method:'POST',feedbackLabel:'جاري تسجيل المعاملة...',body:JSON.stringify({operation:form.operation,amount,currency:'CNY',reason,idempotency_key:form.idempotency_key||freshKey()})});localBusy.value=false;store.state.msg=r.message||r.error||'';if(r.ok){resetForm();await Promise.all([loadDetail(),loadList()]);}}
5861      async function load(){await Promise.all([loadList(),loadReconciliation()]);if(selectedId.value)await Promise.all([loadDetail(),loadDetailReconciliation()]);}
5862      onMounted(()=>{resetForm();load();});watch(()=>route.params.id,()=>Promise.all([loadDetail(),loadDetailReconciliation()]));
5863      return{store,members,stats,detail,reconciliation,detailReconciliation,recentTransactions,activationRequests,activationNotes,search,statusFilter,page,pagination,localBusy,workspaceMode,postingBlocked,form,loadList,loadReconciliation,openMember,back,changePage,reviewActivation,adjust,walletMoney,walletTransactionLabel,walletStatusLabel,shortDate,safeArray};
5864    },
5865    render:(function(){
5866const _Vue = Vue
5867const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
5868
5869const _hoisted_1 = {
5870  key: 0,
5871  class: "card dashboardHeaderCard walletAdminHeader"
5872}
5873const _hoisted_2 = ["disabled", "onClick"]
5874const _hoisted_3 = {
5875  key: 1,
5876  class: "walletAdminSummaryGrid"
5877}
5878const _hoisted_4 = {
5879  key: 2,
5880  class: "card walletActivationQueue"
5881}
5882const _hoisted_5 = { class: "adminSectionHead" }
5883const _hoisted_6 = { class: "statusPill" }
5884const _hoisted_7 = { class: "adminGuideList" }
5885const _hoisted_8 = {
5886  key: 0,
5887  class: "hint"
5888}
5889const _hoisted_9 = ["onUpdate:modelValue"]
5890const _hoisted_10 = { class: "inlineActions" }
5891const _hoisted_11 = ["disabled", "onClick"]
5892const _hoisted_12 = ["disabled", "onClick"]
5893const _hoisted_13 = {
5894  key: 3,
5895  class: "card walletReconciliationCard"
5896}
5897const _hoisted_14 = { class: "adminSectionHead" }
5898const _hoisted_15 = ["onClick"]
5899const _hoisted_16 = { class: "walletReconciliationDetails" }
5900const _hoisted_17 = { class: "miniStats" }
5901const _hoisted_18 = {
5902  key: 4,
5903  class: "card walletRecentCard"
5904}
5905const _hoisted_19 = { class: "adminSectionHead" }
5906const _hoisted_20 = { class: "statusPill" }
5907const _hoisted_21 = { class: "walletRecentList" }
5908const _hoisted_22 = ["onClick"]
5909const _hoisted_23 = { class: "walletRecentIdentity" }
5910const _hoisted_24 = { class: "walletRecentReason" }
5911const _hoisted_25 = {
5912  key: 0,
5913  class: "hint"
5914}
5915const _hoisted_26 = {
5916  key: 5,
5917  class: "card walletAccountsCard"
5918}
5919const _hoisted_27 = { class: "adminSectionHead" }
5920const _hoisted_28 = { class: "statusPill" }
5921const _hoisted_29 = { class: "walletAccountFilters" }
5922const _hoisted_30 = ["onUpdate:modelValue", "onKeyup"]
5923const _hoisted_31 = ["onUpdate:modelValue", "onChange"]
5924const _hoisted_32 = ["disabled", "onClick"]
5925const _hoisted_33 = { class: "walletAccountList" }
5926const _hoisted_34 = ["onClick"]
5927const _hoisted_35 = { class: "walletAccountIdentity" }
5928const _hoisted_36 = { class: "walletAccountSide" }
5929const _hoisted_37 = {
5930  key: 0,
5931  class: "hint"
5932}
5933const _hoisted_38 = {
5934  key: 0,
5935  class: "walletPagination"
5936}
5937const _hoisted_39 = ["disabled", "onClick"]
5938const _hoisted_40 = ["disabled", "onClick"]
5939const _hoisted_41 = {
5940  key: 6,
5941  class: "card adminRecordWorkspace"
5942}
5943const _hoisted_42 = { class: "adminWorkspaceBackBar" }
5944const _hoisted_43 = ["onClick"]
5945const _hoisted_44 = {
5946  key: 0,
5947  class: "walletBalanceHero"
5948}
5949const _hoisted_45 = {
5950  key: 1,
5951  class: "card"
5952}
5953const _hoisted_46 = {
5954  key: 2,
5955  class: "card walletReconciliationCard"
5956}
5957const _hoisted_47 = { class: "adminSectionHead" }
5958const _hoisted_48 = { class: "hint" }
5959const _hoisted_49 = { class: "miniStats" }
5960const _hoisted_50 = {
5961  key: 3,
5962  class: "card walletAdjustmentCard"
5963}
5964const _hoisted_51 = ["onUpdate:modelValue"]
5965const _hoisted_52 = ["onUpdate:modelValue"]
5966const _hoisted_53 = ["onUpdate:modelValue"]
5967const _hoisted_54 = {
5968  key: 0,
5969  class: "aiWorkflowError"
5970}
5971const _hoisted_55 = ["disabled", "onClick"]
5972const _hoisted_56 = {
5973  key: 4,
5974  class: "card walletPolicyCard"
5975}
5976const _hoisted_57 = {
5977  key: 5,
5978  class: "card"
5979}
5980const _hoisted_58 = { class: "adminGuideList" }
5981const _hoisted_59 = { class: "codeToken" }
5982const _hoisted_60 = {
5983  key: 0,
5984  class: "hint"
5985}
5986
5987return function render(_ctx, _cache) {
5988  with (_ctx) {
5989    const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, toDisplayString: _toDisplayString, renderList: _renderList, Fragment: _Fragment, vModelText: _vModelText, withDirectives: _withDirectives, createTextVNode: _createTextVNode, normalizeClass: _normalizeClass, withKeys: _withKeys, vModelSelect: _vModelSelect, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
5990
5991    const _component_AdminFrame = _resolveComponent("AdminFrame")
5992
5993    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "محفظة SMT" }, {
5994      default: _withCtx(() => [
5995        (!workspaceMode)
5996          ? (_openBlock(), _createElementBlock("section", _hoisted_1, [_cache[0] || (_cache[0] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "SMT Wallet"), _createElementVNode("h3", null, "المحفظة المالية"), _createElementVNode("p", { class: "hint" }, "ملخص سريع للحسابات والعمليات. المحفظة مبنية على دفتر قيود مزدوج، والتفاصيل الفنية والتدقيق المالي تبقى داخل لوحة الإدارة.")], -1)), _createElementVNode("button", {
5997              class: "smallbtn",
5998              disabled: localBusy,
5999              onClick: loadList
6000            }, "تحديث", 8, _hoisted_2)]))
6001          : _createCommentVNode("", true),
6002        (!workspaceMode)
6003          ? (_openBlock(), _createElementBlock("div", _hoisted_3, [
6004              _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(walletMoney(stats.member_balance_total)), 1), _cache[1] || (_cache[1] = _createElementVNode("small", null, "إجمالي أرصدة الأعضاء", -1))]),
6005              _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(stats.member_accounts||0), 1), _cache[2] || (_cache[2] = _createElementVNode("small", null, "الحسابات المفعلة", -1))]),
6006              _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(stats.pending_activation_requests||0), 1), _cache[3] || (_cache[3] = _createElementVNode("small", null, "طلبات تفعيل معلقة", -1))]),
6007              _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(stats.transactions||0), 1), _cache[4] || (_cache[4] = _createElementVNode("small", null, "إجمالي العمليات", -1))])
6008            ]))
6009          : _createCommentVNode("", true),
6010        (!workspaceMode&&activationRequests.length)
6011          ? (_openBlock(), _createElementBlock("section", _hoisted_4, [_createElementVNode("div", _hoisted_5, [_cache[5] || (_cache[5] = _createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "طلبات تحتاج قراراً"), _createElementVNode("h3", null, "طلبات تفعيل محفظة SMT")], -1)), _createElementVNode("span", _hoisted_6, _toDisplayString(stats.pending_activation_requests||activationRequests.length), 1)]), _createElementVNode("div", _hoisted_7, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(activationRequests, (r) => {
6012              return (_openBlock(), _createElementBlock("div", {
6013                class: "guideAdminItem",
6014                key: r.id
6015              }, [
6016                _createElementVNode("b", null, _toDisplayString(r.full_name||'عضو') + " · " + _toDisplayString(r.gzc_id||r.member_id), 1),
6017                _createElementVNode("small", null, _toDisplayString(r.whatsapp||'-') + " · " + _toDisplayString(shortDate(r.requested_at)), 1),
6018                (r.request_note)
6019                  ? (_openBlock(), _createElementBlock("p", _hoisted_8, _toDisplayString(r.request_note), 1))
6020                  : _createCommentVNode("", true),
6021                _createElementVNode("label", null, [_cache[6] || (_cache[6] = _createTextVNode("ملاحظة الإدارة (اختياري)")), _withDirectives(_createElementVNode("input", {
6022                  "onUpdate:modelValue": $event => ((activationNotes[r.id]) = $event),
6023                  maxlength: "500",
6024                  placeholder: "مثال: تم التحقق والموافقة"
6025                }, null, 8, _hoisted_9), [[_vModelText, activationNotes[r.id]]])]),
6026                _createElementVNode("div", _hoisted_10, [_createElementVNode("button", {
6027                  class: "smallbtn",
6028                  disabled: localBusy,
6029                  onClick: $event => (reviewActivation(r,'approve'))
6030                }, "موافقة وتفعيل", 8, _hoisted_11), _createElementVNode("button", {
6031                  class: "smallbtn danger",
6032                  disabled: localBusy,
6033                  onClick: $event => (reviewActivation(r,'reject'))
6034                }, "رفض", 8, _hoisted_12)])
6035              ]))
6036            }), 128))])]))
6037          : _createCommentVNode("", true),
6038        (!workspaceMode&&reconciliation)
6039          ? (_openBlock(), _createElementBlock("section", _hoisted_13, [_createElementVNode("div", _hoisted_14, [_cache[7] || (_cache[7] = _
6039createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "تدقيق مالي للقراءة فقط"), _createElementVNode("h3", null, "مطابقة المحفظة ودفتر القيود")], -1)), _createElementVNode("button", {
6040              class: "smallbtn secondary",
6041              onClick: loadReconciliation
6042            }, "إعادة التدقيق", 8, _hoisted_15)]), _createElementVNode("div", { class: _normalizeClass(reconciliation.status==='healthy'?'aiWorkflowSuccess':'aiWorkflowError') }, [_createElementVNode("b", null, _toDisplayString(reconciliation.status==='healthy'?'المطابقة سليمة':'توجد فروقات تحتاج مراجعة'), 1), _createElementVNode("small", null, "تم فحص " + _toDisplayString(reconciliation.summary.transactions||0) + " معاملة · المتأثرة " + _toDisplayString(reconciliation.summary.affected_transactions||0) + " · لا يتم تعديل أي رصيد.", 1)], 2), _createElementVNode("details", _hoisted_16, [_cache[11] || (_cache[11] = _createElementVNode("summary", null, "عرض تفاصيل التدقيق", -1)), _createElementVNode("div", _hoisted_17, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(reconciliation.summary.valid_transactions||0), 1), _cache[8] || (_cache[8] = _createElementVNode("small", null, "سليمة", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(reconciliation.summary.ledger_count_mismatch||0), 1), _cache[9] || (_cache[9] = _createElementVNode("small", null, "اختلاف القيود", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(reconciliation.summary.unbalanced_transactions||0), 1), _cache[10] || (_cache[10] = _createElementVNode("small", null, "غير متوازنة", -1))])]), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(safeArray(reconciliation.findings), (f) => {
6043              return (_openBlock(), _createElementBlock("p", {
6044                key: f.code,
6045                class: "hint"
6046              }, _toDisplayString(f.message) + " (" + _toDisplayString(f.count) + ")", 1))
6047            }), 128))])]))
6048          : _createCommentVNode("", true),
6049        (!workspaceMode)
6050          ? (_openBlock(), _createElementBlock("section", _hoisted_18, [_createElementVNode("div", _hoisted_19, [_cache[12] || (_cache[12] = _createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "آخر النشاط"), _createElementVNode("h3", null, "آخر 10 عمليات")], -1)), _createElementVNode("span", _hoisted_20, _toDisplayString(recentTransactions.length), 1)]), _createElementVNode("div", _hoisted_21, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(recentTransactions, (t) => {
6051              return (_openBlock(), _createElementBlock("button", {
6052                class: "walletRecentItem",
6053                key: t.id,
6054                onClick: $event => (openMember({id:t.member_id}))
6055              }, [_createElementVNode("span", _hoisted_23, [_createElementVNode("b", null, _toDisplayString(t.full_name||'عضو'), 1), _createElementVNode("small", null, _toDisplayString(t.gzc_id||('عضو #'+t.member_id)) + " · " + _toDisplayString(shortDate(t.created_at)), 1)]), _createElementVNode("span", { class: _normalizeClass(["walletRecentAmount", t.transaction_type==='admin_debit'?'debit':'credit']) }, _toDisplayString(t.transaction_type==='admin_debit'?'-':'+') + _toDisplayString(walletMoney(t.amount)), 3), _createElementVNode("small", _hoisted_24, _toDisplayString(t.reason||walletTransactionLabel(t.transaction_type)) + " · " + _toDisplayString(t.admin_name||'إدارة SMT'), 1)], 8, _hoisted_22))
6056            }), 128)), (!recentTransactions.length)
6057              ? (_openBlock(), _createElementBlock("p", _hoisted_25, "لا توجد عمليات مالية حتى الآن."))
6058              : _createCommentVNode("", true)])]))
6059          : _createCommentVNode("", true),
6060        (!workspaceMode)
6061          ? (_openBlock(), _createElementBlock("section", _hoisted_26, [
6062              _createElementVNode("div", _hoisted_27, [_cache[13] || (_cache[13] = _createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "الحسابات"), _createElementVNode("h3", null, "الحسابات الأخيرة")], -1)), _createElementVNode("span", _hoisted_28, _toDisplayString(pagination.total||0) + " نتيجة", 1)]),
6063              _createElementVNode("div", _hoisted_29, [_createElementVNode("label", null, [_cache[14] || (_cache[14] = _createTextVNode("بحث")), _withDirectives(_createElementVNode("input", {
6064                "onUpdate:modelValue": $event => ((search) = $event),
6065                onKeyup: _withKeys($event => (loadList(true)), ["enter"]),
6066                placeholder: "الاسم أو رقم العضوية أو واتساب"
6067              }, null, 40, _hoisted_30), [[_vModelText, search]])]), _createElementVNode("label", null, [_cache[16] || (_cache[16] = _createTextVNode("حالة الحساب")), _withDirectives(_createElementVNode("select", {
6068                "onUpdate:modelValue": $event => ((statusFilter) = $event),
6069                onChange: $event => (loadList(true))
6070              }, _cache[15] || (_cache[15] = [
6071                _createElementVNode("option", { value: "all" }, "كل الحالات", -1),
6072                _createElementVNode("option", { value: "opened" }, "الحسابات المفتوحة", -1),
6073                _createElementVNode("option", { value: "active" }, "نشطة", -1),
6074                _createElementVNode("option", { value: "frozen" }, "موقوفة مؤقتاً", -1),
6075                _createElementVNode("option", { value: "closed" }, "مغلقة", -1),
6076                _createElementVNode("option", { value: "not_opened" }, "غير مفعلة", -1)
6077              ]), 40, _hoisted_31), [[_vModelSelect, statusFilter]])]), _createElementVNode("button", {
6078                class: "smallbtn secondary walletSearchBtn",
6079                disabled: localBusy,
6080                onClick: $event => (loadList(true))
6081              }, "بحث", 8, _hoisted_32)]),
6082              _createElementVNode("div", _hoisted_33, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(members, (m) => {
6083                return (_openBlock(), _createElementBlock("button", {
6084                  class: "walletAccountRow",
6085                  key: m.id,
6086                  onClick: $event => (openMember(m))
6087                }, [_createElementVNode("span", _hoisted_35, [_createElementVNode("b", null, _toDisplayString(m.full_name||'عضو'), 1), _createElementVNode("small", null, _toDisplayString(m.gzc_id||m.id) + " · " + _toDisplayString(m.whatsapp||'-'), 1), _createElementVNode("small", null, _toDisplayString(m.last_entry_at?'آخر نشاط '+shortDate(m.last_entry_at):'لا توجد عمليات بعد'), 1)]), _createElementVNode("span", _hoisted_36, [_createElementVNode("strong", null, _toDisplayString(walletMoney(m.wallet_balance)), 1), _createElementVNode("small", null, _toDisplayString(walletStatusLabel(m.wallet_status)), 1)])], 8, _hoisted_34))
6088              }), 128)), (!members.length&&!localBusy)
6089                ? (_openBlock(), _createElementBlock("p", _hoisted_37, "لا توجد نتائج."))
6090                : _createCommentVNode("", true)]),
6091              (pagination.pages>1)
6092                ? (_openBlock(), _createElementBlock("div", _hoisted_38, [_createElementVNode("button", {
6093                    class: "smallbtn secondary",
6094                    disabled: !pagination.has_previous||localBusy,
6095                    onClick: $event => (changePage(page-1))
6096                  }, "السابق", 8, _hoisted_39), _createElementVNode("span", null, "صفحة " + _toDisplayString(pagination.page) + " من " + _toDisplayString(pagination.pages), 1), _createElementVNode("button", {
6097                    class: "smallbtn secondary",
6098                    disabled: !pagination.has_next||localBusy,
6099                    onClick: $event => (changePage(page+1))
6100                  }, "التالي", 8, _hoisted_40)]))
6101                : _createCommentVNode("", true)
6102            ]))
6103          : _createCommentVNode("", true),
6104        (workspaceMode&&detail)
6105          ? (_openBlock(), _createElementBlock("section", _hoisted_41, [
6106              _createElementVNode("div", _hoisted_42, [_createElementVNode("button", {
6107                class: "smallbtn secondary",
6108                onClick: back
6109              }, "← العودة للمحفظة", 8, _hoisted_43), _cache[17] || (_cache[17] = _createElementVNode("span", null, "سجل محفظة العضو", -1))]),
6110              (detail.access&&detail.access.activated)
6111                ? (_openBlock(), _createElementBlock("section", _hoisted_44, [_createElementVNode("div", null, [_cache[18] || (_cache[18] = _createElementVNode("span", { class: "vueBadge" }, "الرصيد المتاح", -1)), _createElementVNode("h2", null, _toDisplayString(walletMoney(detail.balance)), 1), _createElementVNode("p", null, _toDisplayString(detail.member.full_name) + " · " + _toDisplayString(detail.member.gzc_id||'-') + " · SMT Ⓢ · " + _toDisplayString(walletStatusLabel(detail.account.status)), 1)]), _cache[19] || (_cache[19] = _createElementVNode("span", null, "Ⓢ", -1))]))
6112                : (_openBlock(), _createElementBlock("section", _hoisted_45, _cache[20] || (_cache[20] = [_createElementVNode("span", { class: "adminEyebrow" }, "حالة المحفظة", -1), _createElementVNode("h3", null, "غير مفعلة", -1), _createElementVNode("p", { class: "hint" }, "لا يمكن تسجيل أي عملية لهذا العضو قبل أن يقدم طلب تفعيل وتوافق عليه الإدارة.", -1)]))),
6113              (detail.access&&detail.access.activated&&detailReconciliation)
6114                ? (_openBlock(), _createElementBlock("section", _hoisted_46, [_createElementVNode("div", _hoisted_47, [_createElementVNode("div", null, [_cache[21] || (_cache[21] = _createElementVNode("span", { class: "adminEyebrow" }, "مطابقة هذا الحساب", -1)), _createElementVNode("h3", null, _toDisplayString(detailReconciliation.status==='healthy'?'سليم ومتطابق':'فروقات تحتاج مراجعة'), 1)])]), _createElementVNode("p", _hoisted_48, _toDisplayString(detailReconciliation.summary.transactions||0) + " معاملة · " + _toDisplayString(detailReconciliation.summary.affected_transactions||0) + " متأثرة · الفحص للقراءة فقط ولا يصلح الأرصدة تلقائياً.", 1), _createElementVNode("div", _hoisted_49, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(walletMoney(detailReconciliation.representation.transaction_net_total)), 1), _cache[22] || (_cache[22] = _createElementVNode("small", null, "صافي المعاملات", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(walletMoney(detailReconciliation.representation.member_balance_total)), 1), _cache[23] || (_cache[23] = _createElementVNode("small", null, "الرصيد المشتق", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(detailReconciliation.summary.ledger_count_mismatch||0), 1), _cache[24] || (_cache[24] = _createElementVNode("small", null, "فروقات القيود", -1))])])]))
6115                : _createCommentVNode("", true),
6116              (detail.access&&detail.access.activated)
6117                ? (_openBlock(), _createElementBlock("section", _hoisted_50, [
6118                    _cache[30] || (_cache[30] = _createElementVNode("div", { class: "adminSectionHead" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "معاملة جديدة"), _createElementVNode("h3", null, "إيداع أو خصم إداري")])], -1)),
6119                    _cache[31] || (_cache[31] = _createElementVNode("p", { class: "hint" }, "كل عملية تنشئ Transaction ثابتة وقيدين متوازنين. لا يمكن الخصم بما يتجاوز الرصيد. 1 Ⓢ = 1 CNY دائماً.", -1)),
6120                    _createElementVNode("label", null, [_cache[26] || (_cache[26] = _createTextVNode("نوع العملية")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((form.operation) = $event) }, _cache[25] || (_cache[25] = [_createElementVNode("option", { value: "credit" }, "إيداع", -1), _createElementVNode("option", { value: "debit" }, "خصم", -1)]), 8, _hoisted_51), [[_vModelSelect, form.operation]])]),
6121                    _createElementVNode("label", null, [_cache[27] || (_cache[27] = _
6121createTextVNode("المبلغ Ⓢ")), _withDirectives(_createElementVNode("input", {
6122                      type: "text",
6123                      inputmode: "decimal",
6124                      "onUpdate:modelValue": $event => ((form.amount) = $event),
6125                      placeholder: "مثال: 198000.00"
6126                    }, null, 8, _hoisted_52), [[_vModelText, form.amount]])]),
6127                    _createElementVNode("label", null, [_cache[28] || (_cache[28] = _createTextVNode("سبب العملية")), _withDirectives(_createElementVNode("textarea", {
6128                      "onUpdate:modelValue": $event => ((form.reason) = $event),
6129                      maxlength: "500",
6130                      placeholder: "مثال: إيداع بعد تأكيد استلام التحويل"
6131                    }, null, 8, _hoisted_53), [[_vModelText, form.reason]])]),
6132                    postingBlocked
6133                      ? (_openBlock(), _createElementBlock("div", _hoisted_54, [_createElementVNode("b", null, "المحفظة " + _toDisplayString(walletStatusLabel(detail.account.status)), 1), _cache[29] || (_cache[29] = _createElementVNode("small", null, "لا يمكن تسجيل أي إيداع أو خصم جديد حتى تصبح حالة الحساب نشطة.", -1))]))
6134                      : _createCommentVNode("", true),
6135                    _createElementVNode("button", {
6136                      class: "btn",
6137                      disabled: localBusy||postingBlocked,
6138                      onClick: adjust
6139                    }, "تسجيل المعاملة", 8, _hoisted_55)
6140                  ]))
6141                : _createCommentVNode("", true),
6142              (detail.access&&detail.access.activated)
6143                ? (_openBlock(), _createElementBlock("section", _hoisted_56, _cache[32] || (_cache[32] = [_createElementVNode("b", null, "حدود المحفظة الحالية", -1), _createElementVNode("p", null, "Admin credit/debit فقط. لا Member-to-Member transfer، لا سحب نقدي/بنكي، لا تحويل عملات، ولا دفع مورد من المحفظة.", -1)])))
6144                : _createCommentVNode("", true),
6145              (detail.access&&detail.access.activated)
6146                ? (_openBlock(), _createElementBlock("section", _hoisted_57, [_cache[33] || (_cache[33] = _createElementVNode("div", { class: "adminSectionHead" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "Ledger history"), _createElementVNode("h3", null, "الحركات")])], -1)), _createElementVNode("div", _hoisted_58, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(safeArray(detail.transactions), (t) => {
6147                    return (_openBlock(), _createElementBlock("div", {
6148                      class: "guideAdminItem",
6149                      key: t.id
6150                    }, [_createElementVNode("span", _hoisted_59, _toDisplayString(t.transaction_code), 1), _createElementVNode("b", null, _toDisplayString(walletTransactionLabel(t.transaction_type)) + " · " + _toDisplayString(walletMoney(t.amount)), 1), _createElementVNode("small", null, _toDisplayString(t.reason) + " · " + _toDisplayString(shortDate(t.created_at)), 1)]))
6151                  }), 128)), (!safeArray(detail.transactions).length)
6152                    ? (_openBlock(), _createElementBlock("p", _hoisted_60, "لا توجد معاملات حتى الآن."))
6153                    : _createCommentVNode("", true)])]))
6154                : _createCommentVNode("", true)
6155            ]))
6156          : _createCommentVNode("", true)
6157      ]),
6158      _: 1
6159    }))
6160  }
6161}
6162})()
6163  };
6164
6165  const PROCUREMENT_SERVICE_LABELS={product_sourcing:'البحث عن منتج أو مصنع',supplier_verification:'التحقق من المورد',quality_inspection:'فحص الجودة',supplier_payment:'دفع مصنع مقابل فاتورة',shipping_logistics:'الشحن والخدمات اللوجستية'};
6166  const PROCUREMENT_STATUS_LABELS={draft:'مسودة',submitted:'تم الإرسال',under_review:'قيد المراجعة',quoted:'صدر عرض السعر',payment_pending:'بانتظار إثبات الدفع',processing:'قيد التنفيذ',completed:'مكتمل',cancelled:'ملغي'};
6167  const PROCUREMENT_DOCUMENT_LABELS={proforma_invoice:'Proforma Invoice',quotation:'Quotation',supplier_document:'مستند المورد',product_specification:'مواصفات المنتج',payment_proof:'إثبات الدفع',shipping_document:'مستند الشحن',other:'مستند آخر'};
6168  const CUSTOMER_ORDER_STATUS_LABELS={confirmed:'طلب مؤكد',procurement:'قيد الشراء والتوريد',completed:'مكتمل',cancelled:'ملغي'};
6169  const CUSTOMER_ORDER_PAYMENT_LABELS={pending:'بانتظار إثبات/تأكيد الدفع',confirmed:'تم تأكيد الدفع',not_required:'لا يتطلب دفعاً',refunded:'تم رد المبلغ'};
6170  const PURCHASE_MODE_LABELS={request_quote:'طلب بحث وتجهيز عرض',buy_now:'عرض مورد جاهز للاعتماد'};
6171  const PROCUREMENT_CURRENCY_LABELS={CNY:'يوان صيني Â¥',USD:'دولار أمريكي $',SDG:'جÙ
6171†ÙŠÙ‡ سوداني SDG',AED:'درهم AED (عرض قديم)'};
6172  const PROCUREMENT_CURRENCY_SYMBOLS={CNY:'Â¥',USD:'$',SDG:'SDG',AED:'AED'};
6173  const PROCUREMENT_PRICING_LABELS={total:'سعر إجمالي',unit:'سعر وحدة × كمية'};
6174  const PROCUREMENT_QUOTE_UNIT_LABELS={unit:'وحدة',piece:'قطعة',set:'طقم / Set',kg:'كجم',ton:'طن',meter:'متر',sqm:'م²',cbm:'م³ / CBM',lot:'دفعة / Lot'};
6175  const PROCUREMENT_INCOTERM_LABELS={EXW:'EXW — استلام من المصنع',FOB:'FOB — على ظهر السفينة',CIF:'CIF — تكلفة + تأمين + شحن'};
6176  const PROCUREMENT_SHIPPING_LABELS={none:'بدون شحن ضمن العرض',fcl:'حاوية كاملة FCL',lcl:'شحن بحري مجزأ LCL',air_cargo:'شحن جوي Air Cargo'};
6177  const PROCUREMENT_CONTAINER_LABELS={'20GP':'20GP — حاوية 20 قدم','40GP':'40GP — حاوية 40 قدم','40HC':'40HC — حاوية 40 قدم High Cube'};
6178  const ORDER_MILESTONE_LABELS={supplier_order:'تم تأكيد الطلب مع المورد',production:'التصنيع',inspection:'الفحص والجودة',shipping:'الشحن',delivery:'التسليم',payment:'الدفع',note:'تحديث تشغيلي'};
6179  const ORDER_EVIDENCE_LABELS={production_photo:'صور التصنيع',production_video:'فيديو التصنيع',inspection_report:'تقرير الفحص',supplier_document:'مستند المورد',shipping_document:'مستند الشحن',payment_document:'مستند الدفع',other:'دليل آخر'};
6180  const ORDER_VISIBILITY_LABELS={member:'ظاهر للعضو',internal:'داخلي للإدارة',inherit:'يتبع المرحلة'};
6181  function procurementServiceLabel(v){return PROCUREMENT_SERVICE_LABELS[String(v||'')]||String(v||'-')}
6182  function procurementStatusLabel(v){return PROCUREMENT_STATUS_LABELS[String(v||'')]||String(v||'-')}
6183  function procurementDocumentLabel(v){return PROCUREMENT_DOCUMENT_LABELS[String(v||'')]||String(v||'-')}
6184  function customerOrderStatusLabel(v){return CUSTOMER_ORDER_STATUS_LABELS[String(v||'')]||String(v||'-')}
6185  function customerOrderPaymentLabel(v){return CUSTOMER_ORDER_PAYMENT_LABELS[String(v||'')]||String(v||'-')}
6186  function purchaseModeLabel(v){return PURCHASE_MODE_LABELS[String(v||'')]||String(v||'-')}
6187  function procurementCurrencyLabel(v){return PROCUREMENT_CURRENCY_LABELS[String(v||'').toUpperCase()]||String(v||'-')}
6188  function procurementCurrencySymbol(v){return PROCUREMENT_CURRENCY_SYMBOLS[String(v||'').toUpperCase()]||String(v||'')}
6189  function procurementMoney(v,currency){const n=Number(v||0);const shown=Number.isFinite(n)?n.toLocaleString('en-US',{minimumFractionDigits:2,maximumFractionDigits:2}):'0.00';const c=String(currency||'').toUpperCase();return (procurementCurrencySymbol(c)?procurementCurrencySymbol(c)+' ':'')+shown+(c==='SDG'?'':'')}
6190  function procurementPricingLabel(v){return PROCUREMENT_PRICING_LABELS[String(v||'')]||String(v||'-')}
6191  function procurementQuoteUnitLabel(v){return PROCUREMENT_QUOTE_UNIT_LABELS[String(v||'')]||String(v||'-')}
6192  function procurementIncotermLabel(v){return PROCUREMENT_INCOTERM_LABELS[String(v||'')]||String(v||'-')}
6193  function procurementShippingLabel(v){return PROCUREMENT_SHIPPING_LABELS[String(v||'')]||String(v||'-')}
6194  function procurementContainerLabel(v){return PROCUREMENT_CONTAINER_LABELS[String(v||'')]||String(v||'-')}
6195  function procurementCommercialSnapshot(order){const raw=safeRecord(order&&order.commercial_snapshot)||{};if(Object.keys(raw).length){const origin=safeRecord(raw.origin)||{},destination=safeRecord(raw.destination)||{};return Object.assign({},raw,{origin_country:raw.origin_country||origin.country||'',origin_city:raw.origin_city||origin.city||'',loading_point:raw.loading_point||origin.loading_point||'',destination_country:raw.destination_country||destination.country||'',destination_city:raw.destination_city||destination.city||'',destination_point:raw.destination_point||destination.point||''});}return{version:Number(order&&order.commercial_model_version||1),currency:order&&order.currency,goods_amount:Number(order&&order.subtotal_amount||0),service_fee_percent:Number(order&&order.service_fee_percent||0),service_fee_amount:Number(order&&order.service_fee_amount||0),shipping_amount:Number(order&&order.shipping_amount||0),insurance_amount:Number(order&&order.insurance_amount||0),discount_amount:Number(order&&order.discount_amount||0),total_amount:Number(order&&order.total_amount||0)}}
6196  function orderMilestoneLabel(v){return ORDER_MILESTONE_LABELS[String(v||'')]||String(v||'-')}
6197  function orderEvidenceLabel(v){return ORDER_EVIDENCE_LABELS[String(v||'')]||String(v||'-')}
6198  function orderVisibilityLabel(v){return ORDER_VISIBILITY_LABELS[String(v||'')]||String(v||'-')}
6199  function procurementQuoteDocuments(payload){return safeArray(payload&&payload.documents).filter(d=>['quotation','proforma_invoice'].includes(String(d&&d.document_type||'')));}
6200  function procurementSupportingDocuments(payload){const docs=safeArray(payload&&payload.documents);return payload&&payload.request&&payload.request.status==='quoted'&&!payload.order?docs.filter(d=>!['quotation','proforma_invoice'].includes(String(d&&d.document_type||''))):docs;}
6201  function procurementNextAction(payload,audience='member'){
6202    const request=safeRecord(payload&&payload.request)||{};const status=String(request.status||'');const docs=safeArray(payload&&payload.documents);const paymentProof=docs.some(d=>String(d&&d.document_type||'')==='payment_proof');
6203    const map={
6204      draft:{owner:audience==='member'?'أنت':'العضو',title:'إكمال المسودة وإرسالها للمراجعة',note:'لن تبدأ SMT المراجعة قبل إرسال الطلب.',tone:'member'},
6205      submitted:{owner:'SMT',title:'مراجعة الطلب وتعيين مسؤول',note:'تم استلام الطلب وهو في طابور المراجعة.',tone:'smt'},
6206      under_review:{owner:'SMT',title:'البحث والتحقق وتجهيز العرض',note:'يجري تجÙ
6206‡ÙŠØ² العرض وسيصلك عند اكتماله.',tone:'smt'},
6207      quoted:{owner:'العضو',title:'مراجعة عرض السعر واتخاذ القرار',note:'يمكنك قبول العرض أو طلب تعديل قبل الاعتماد.',tone:'member'},
6208      payment_pending:paymentProof?{owner:'SMT',title:'مراجعة إثبات الدفع وبدء التنفيذ',note:'إثبات الدفع مرفوع وينتظر إجراء الإدارة.',tone:'smt'}:{owner:'العضو',title:'استكمال الدفع ورفع الإثبات',note:'بعد تأكيد الدفع تنتقل العملية إلى التنفيذ.',tone:'member'},
6209      processing:{owner:'SMT',title:'الشراء والفحص والشحن',note:'التنفيذ جارٍ حسب العرض الذي وافق عليه العضو.',tone:'smt'},
6210      completed:{owner:'مكتمل',title:'اكتمل تنفيذ الطلب',note:'يمكن مراجعة السجل والمستندات في أي وقت.',tone:'done'},
6211      cancelled:{owner:'متوقف',title:'الطلب ملغي',note:'راجع سجل الحالة لمعرفة سبب الإلغاء.',tone:'danger'}
6212    };
6213    return map[status]||{owner:'SMT',title:'متابعة الطلب',note:'راجع الحالة الحالية والسجل.',tone:'smt'};
6214  }
6215  function customerOrderNextAction(payload,audience='member'){
6216    const order=safeRecord(payload&&payload.order)||{};const status=String(order.status||'');const procurement=String(order.procurement_status||'');const payment=String(order.payment_status||'');
6217    if(status==='cancelled'||procurement==='cancelled')return{owner:'متوقف',title:'الطلب ملغي',note:'راجع السجل الزمني لمعرفة آخر إجراء.',tone:'danger'};
6218    if(status==='completed'||procurement==='completed')return{owner:'مكتمل',title:'اكتمل الطلب',note:'جميع مراحل الطلب الأساسية مكتملة.',tone:'done'};
6219    if(procurement==='payment_pending'||(status==='confirmed'&&payment==='pending'))return{owner:audience==='member'?'أنت':'العضو / SMT',title:'استكمال الدفع وتأكيده',note:'بعد تأكيد الدفع يبدأ الشراء والتنفيذ.',tone:'member'};
6220    if(status==='procurement'||procurement==='processing')return{owner:'SMT',title:'الشراء والفحص والشحن',note:'فريق SMT ينفذ الطلب حسب النسخة المعتمدة من العرض.',tone:'smt'};
6221    return{owner:'SMT',title:'تجهيز الطلب للتنفيذ',note:'تم تأكيد الطلب وسيظهر كل تقدم في السجل الزمني.',tone:'smt'};
6222  }
6223
6224  function adminRecordUpdatedAt(row){const r=row||{};return shortDate(r.updated_at||r.last_activity_at||r.last_update_at||r.reviewed_at||r.accepted_at||r.created_at)||'-';}
6225  function adminQueueOwner(domain,row){const r=row||{};if(String(r.assigned_admin_name||'').trim())return r.assigned_admin_name;return ({members:'لجنة العضوية',arrival:'متابعة الوصول',help:'متابعة المساعدة',emergency:'متابعة الطوارئ',events:'إدارة الفعاليات',announcements:'إدارة المحتوى',procurement:'SMT',orders:'SMT'}[String(domain||'')])||'الإدارة';}
6226  function memberQueueNextAction(row){const s=String(row&&row.status||'');return ({pre_registered:'إكمال التسجيل',profile_pending:'إكمال البيانات',pending:'مراجعة واعتماد',approved:'لا إجراء',suspended:'مراجعة التعليق',archived:'مؤرشف'}[s])||'مراجعة السجل';}
6227  function caseQueueNextAction(row){const s=String(row&&row.status||'');return ({new:'فتح الحالة',open:'بدء المتابعة',pending:'مراجعة الحالة',in_progress:'متابعة أو إغلاق',resolved:'مكتملة',closed:'مغلقة'}[s])||'مراجعة الحالة';}
6228  function emergencyQueueNextAction(row){const s=String(row&&row.status||'');const p=String(row&&row.priority||'');if(['closed','resolved'].includes(s))return 'مغلق';if(['critical','high'].includes(p)&&s!=='in_progress')return 'بدء المتابعة فوراً';if(s==='in_progress')return 'متابعة أو إغلاق';return 'مراجعة البلاغ';}
6229  function eventQueueNextAction(row){const s=String(row&&row.status||'');return ({draft:'مراجعة ثم نشر',published:'متابعة الفعالية',completed:'أرشفة عند الانتهاء',archived:'لا إجراء',cancelled:'لا إجراء'}[s])||'مراجعة الفعالية';}
6230  function announcementQueueNextAction(row){const r=row||{},s=String(r.status||''),verified=isVerifiedAnnouncement(r);if(['archived','expired'].includes(s))return 'لا إجراء';if(!verified)return 'مراجعة واعتماد';return 'متابعة النشر';}
6231  function procurementQueueNextAction(row){return procurementNextAction({request:row,documents:[]},'admin').title;}
6232  function orderQueueNextAction(row){return customerOrderNextAction({order:row},'admin').title;}
6233
6234  const MemberNotificationsPage={
6235    components:{PublicFrame},
6236    setup(){
6237      const store=useGzcStore();const router=useRouter();const filter=ref('all');
6238      const items=computed(()=>safeArray(store.state.memberNotifications));
6239      const unread=computed(()=>Number(store.state.memberUnread||0));
6240      async function load(){if(!(await store.requireMember(router,'/notifications')))return;await runBusyAction(store,'member-notifications.load',()=>store.loadMemberNotifications(filter.value,100));}
6241      async function openNotification(n){if(!n)return;if(!n.read_at){const r=await api('/api/member/notifications/'+encodeURIComponent(n.id)+'/read',{method:'POST',body:'{}'});if(r&&r.ok){n.read_at=r.notification&&r.notification.read_at||new Date().toISOString();store.state.memberUnread=Math.max(0,Number(store.state.memberUnread||0)-1);}}if(n.order_id)router.push('/orders?order='+encodeURIComponent(n.order_id));else if(n.request_id)router.push('/procurement?request='+encodeURIComponent(n.request_id));}
6242      async function markAll(){if(!unread.value)return;const r=await runBusyAction(store,'member-notifications.read-all',()=>api('/api/member/notifications/read-all',{method:'POST',body:'{}'}));store.state.msg=r.message||r.error||(r.ok?'تم تعليم الإشعارات كمقروءة':'');if(r.ok)await load();}
6243      onMounted(load);watch(filter,load);
6244      return{store,filter,items,unread,load,openNotification,markAll,procurementStatusLabel,shortDate};
6245    },
6246    render:(function(){
6247const _Vue = Vue
6248const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
6249
6250const _hoisted_1 = { class: "card memberNotificationsHero" }
6251const _hoisted_2 = { class: "memberNotificationCount" }
6252const _hoisted_3 = { class: "memberNotificationToolbar" }
6253const _hoisted_4 = { class: "segmented compactSegments" }
6254const _hoisted_5 = ["onClick"]
6255const _hoisted_6 = ["onClick"]
6256const _hoisted_7 = ["disabled", "onClick"]
6257const _hoisted_8 = { class: "memberNotificationList" }
6258const _hoisted_9 = ["onClick"]
6259const _hoisted_10 = { class: "memberNotificationMeta" }
6260const _hoisted_11 = { class: "memberNotificationTarget" }
6261const _hoisted_12 = {
6262  key: 0,
6263  class: "card emptyCard"
6264}
6265
6266return function render(_ctx, _cache) {
6267  with (_ctx) {
6268    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, normalizeClass: _normalizeClass, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
6269
6270    const _component_PublicFrame = _resolveComponent("PublicFrame")
6271
6272    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "إشعاراتي" }, {
6273      default: _withCtx(() => [_createElementVNode("section", _hoisted_1, [_cache[1] || (_cache[1] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "مركز المتابعة"), _createElementVNode("h2", null, "الإشعارات المهمة"), _createElementVNode("p", null, "تحديثات طلبات التوريد وعروض السعر والتنفيذ تظهر هنا وتفتح السجل الصحيح مباشرة.")], -1)), _createElementVNode("div", _hoisted_2, [_createElementVNode("b", null, _toDisplayString(unread), 1), _cache[0] || (_cache[0] = _createElementVNode("span", null, "غير مقروء", -1))])]), _createElementVNode("section", _hoisted_3, [_createElementVNode("div", _hoisted_4, [_createElementVNode("button", {
6274        class: _normalizeClass({active:filter==='all'}),
6275        onClick: $event => (filter='all')
6276      }, "الكل", 10, _hoisted_5), _createElementVNode("button", {
6277        class: _normalizeClass({active:filter==='unread'}),
6278        onClick: $event => (filter='unread')
6279      }, "غير المقروء", 10, _hoisted_6)]), _createElementVNode("button", {
6280        class: "smallbtn secondary",
6281        disabled: !unread,
6282        onClick: markAll
6283      }, "تعليم الكل كمقروء", 8, _hoisted_7)]), _createElementVNode("section", _hoisted_8, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (n) => {
6284        return (_openBlock(), _createElementBlock("button", {
6285          key: n.id,
6286          class: _normalizeClass(["memberNotificationItem", {unread:!n.read_at}]),
6287          onClick: $event => (openNotification(n))
6288        }, [_cache[2] || (_cache[2] = _createElementVNode("span", { class: "memberNotificationDot" }, null, -1)), _createElementVNode("div", null, [
6289          _createElementVNode("div", _hoisted_10, [_createElementVNode("b", null, _toDisplayString(n.order_code||n.request_code), 1), _createElementVNode("small", null, _toDisplayString(shortDate(n.created_at)), 1)]),
6290          _createElementVNode("h3", null, _toDisplayString(n.title), 1),
6291          _createElementVNode("p", null, _toDisplayString(n.body), 1),
6292          _createElementVNode("span", _hoisted_11, _toDisplayString(n.order_id?'فتح الطلب المؤكد':'فتح طلب التوريد') + " ←", 1)
6293        ])], 10, _hoisted_9))
6294      }), 128)), (!items.length&&!store.state.busy)
6295        ? (_openBlock(), _createElementBlock("div", _hoisted_12, _cache[3] || (_cache[3] = [_createElementVNode("b", null, "لا توجد إشعارات في هذا القسم.", -1), _createElementVNode("p", { class: "hint" }, "عند تحديث طلب أو نشر عرض سعر سيظهر هنا مباشرة.", -1)])))
6296        : _createCommentVNode("", true)])]),
6297      _: 1
6298    }))
6299  }
6300}
6301})()
6302  };
6303
6304  const MemberProcurementPage={
6305    components:{PublicFrame},
6306    setup(){
6307      const store=useGzcStore();const router=useRouter();const route=useRoute();const requests=ref([]);const detail=ref(null);const file=ref(null);const documentType=ref('proforma_invoice');const acceptTerms=ref(false);const revisionNote=ref('');const createMode=computed(()=>route.path==='/procurement/new');
6308      const requestedService=['product_sourcing','supplier_verification','quality_inspection','supplier_payment','shipping_logistics'].includes(String((route.query||{}).service_type||''))?String(route.query.service_type):'product_sourcing';const requestedRoute=String((route.query||{}).route_label||'').trim().slice(0,160);const form=reactive({service_type:requestedService,title:'',description:requestedRoute?('مسار الشحنة: '+requestedRoute):'',supplier_name:'',supplier_contact:'',proforma_number:'',quoted_currency:'CNY',member_note:''});
6309      const editForm=reactive({service_type:'product_sourcing',title:'',description:'',supplier_name:'',supplier_contact:'',proforma_number:'',quoted_currency:'CNY',member_note:''});
6310      const fileLabel=computed(()=>file.value?file.value.name:'لم يتم اختيار مستند');
6311      const nextAction=computed(()=>procurementNextAction(detail.value,'member'));
6312      async function load(){if(!(await store.requireMember(router,route.fullPath||'/orders')))return;if(createMode.value){detail.value=null;requests.value=[];return;}const requested=String(route.query.request||'');if(!requested){router.replace('/orders').catch(()=>{});return;}await open({id:requested});}
6313      async function open(x){const r=await runBusyAction(store,'member-procurement.open',()=>api('/api/member/procurement/'+encodeURIComponent(x.id)));const request=safeRecord(r.request);if(r.ok&&request&&request.id){r.request=request;detail.value=r;acceptTerms.value=false;revisionNote.value='';if(r.request.status==='draft')Object.assign(editForm,{service_type:r.request.service_type,title:r.request.title,de
6313scription:r.request.description,supplier_name:r.request.supplier_name||'',supplier_contact:r.request.supplier_contact||'',proforma_number:r.request.proforma_number||'',quoted_currency:r.request.quoted_currency||'CNY',member_note:r.request.member_note||''});if(r.request.status==='quoted'&&Number(r.request.offer_version||0)>0)await api('/api/member/procurement/'+r.request.id+'/offer/open',{method:'POST',body:'{}'});if(safeArray(r.updates).some(u=>!u.read_at)){const ack=await api('/api/member/procurement/'+r.request.id+'/updates/read',{method:'POST',body:'{}'});if(ack&&ack.ok&&Number(ack.read||0)>0){store.state.memberUnread=Math.max(0,Number(store.state.memberUnread||0)-Number(ack.read||0));store.state.memberNotifications=safeArray(store.state.memberNotifications).map(n=>String(n.request_id)===String(r.request.id)?Object.assign({},n,{read_at:n.read_at||new Date().toISOString()}):n);}const row=requests.value.find(y=>String(y.id)===String(r.request.id));if(row)row.unread_updates=0;}}else store.state.msg=r.message||r.error||(r.ok?'تعذر عرض الطلب لأن استجابة السيرفر غير مكتملة':'');}
6314      async function create(submitNow=false){if(!form.title||!form.description){store.state.msg='العنوان والتفاصيل مطلوبة';return;}const r=await runBusyAction(store,'member-procurement.create',()=>api('/api/member/procurement',{method:'POST',body:JSON.stringify(form)}));if(!r.ok){store.state.msg=r.message||r.error||'تعذر إنشاء الطلب';return;}let current=r.request;if(submitNow){const sent=await runBusyAction(store,'member-procurement.create-submit',()=>api('/api/member/procurement/'+encodeURIComponent(current.id)+'/submit',{method:'POST',body:JSON.stringify({note:'تم إنشاء الطلب وإرساله للمراجعة بواسطة العضو'})}));if(sent&&sent.ok)current=sent.request;else store.state.msg=sent.message||sent.error||'تم حفظ الطلب كمسودة وتعذر إرساله للمراجعة';}Object.assign(form,{service_type:'product_sourcing',title:'',description:'',supplier_name:'',supplier_contact:'',proforma_number:'',quoted_currency:'CNY',member_note:''});await store.loadMemberWorkflowSummary();await router.replace('/procurement?request='+encodeURIComponent(current.id)).catch(()=>{});await open(current);if(!store.state.msg)store.state.msg=submitNow?'تم إرسال طلبك إلى SMT للمراجعة':'تم حفظ الطلب كمسودة';}
6315      async function saveDraft(){if(!detail.value||detail.value.request.status!=='draft')return;const r=await api('/api/member/procurement/'+detail.value.request.id+'/update',{method:'POST',body:JSON.stringify(editForm)});store.state.msg=r.message||r.error||'';if(r.ok){await load();await open(r.request);}}
6316      async function submit(){if(!detail.value)return;const r=await api('/api/member/procurement/'+detail.value.request.id+'/submit',{method:'POST',body:JSON.stringify({note:'تمت المراجعة والإرسال بواسطة العضو'})});store.state.msg=r.message||r.error||'';if(r.ok){await load();await open(r.request);}}
6317      async function cancel(){if(!detail.value||!confirm('إلغاء هذا الطلب؟'))return;const r=await api('/api/member/procurement/'+detail.value.request.id+'/cancel',{method:'POST',body:JSON.stringify({note:'إلغاء بواسطة العضو'})});store.state.msg=r.message||r.error||'';if(r.ok){await load();detail.value=null;}}
6318      function onFile(e){file.value=e.target.files&&e.target.files[0]?e.target.files[0]:null;}
6319      async function upload(){if(!detail.value||!file.value){store.state.msg='اختر المستند أولاً';return;}const fd=new FormData();fd.append('document_type',documentType.value);fd.append('file',file.value);const r=await runBusyAction(store,'member-procurement.upload',()=>uploadApi('/api/member/procurement/'+detail.value.request.id+'/documents',{method:'POST',body:fd,headers:{'Accept':'application/json'},uploadLabel:'رفع مستند الطلب'}));store.state.msg=r.message||r.error||'';if(r.ok){file.value=null;await open(detail.value.request);}}
6320      async function archiveDocument(d){if(!detail.value||!confirm('حذف هذا المستند من المسودة؟'))return;const r=await api('/api/member/procurement/'+detail.value.request.id+'/documents/'+d.id+'/archive',{method:'POST',body:'{}'});store.state.msg=r.message||r.error||'';if(r.ok)await open(detail.value.request);}
6321      async function acceptOffer(){if(!detail.value||detail.value.request.status!=='quoted')return;if(!acceptTerms.value){store.state.msg='أكد قراءة السعر والشروط أولاً';return;}if(!confirm('اعتماد العرض وإنشاء طلب مؤكد بهذه القيم؟'))return;const r=await runBusyAction(store,'member-procurement.accept-offer',()=>api('/api/member/procurement/'+detail.value.request.id+'/accept-offer',{method:'POST',body:JSON.stringify({accept_terms:true})}));store.state.msg=r.message||r.error||'';if(r.ok&&r.order)router.push('/orders?order='+encodeURIComponent(r.order.id));}
6322      async function requestRevision(){if(!detail.value||!String(revisionNote.value||'').trim()){store.state.msg='اكتب التعديل المطلوب على العرض';return;}const r=await api('/api/member/procurement/'+detail.value.request.id+'/request-offer-revision',{method:'POST',body:JSON.stringify({note:revisionNote.value})});store.state.msg=r.message||r.error||'';if(r.ok){await load();await open(detail.value.request);}}
6323      function closeDetail(){detail.value=null;router.push('/orders').catch(()=>{});}
6324      onMounted(load);
6325      return{store,requests,detail,form,editForm,file,fileLabel,documentType,acceptTerms,revisionNote,nextAction,createMode,PROCUREMENT_DOCUMENT_LABELS,load,open,closeDetail,create,saveDraft,submit,cancel,onFile,upload,archiveDocument,acceptOffer,requestRevision,procurementQuoteDocuments,procurementSupportingDocuments,procurementServiceLabel,procurementStatusLabel,procurementDocumentLabel,purchaseModeLabel,procurementCurrencyLabel,procurementMoney,procurementPricingLabel,procurementQuoteUnitLabel,procurementIncotermLabel,procurementShippingLabel,procurementContainerLabel,shortDate,adminRecordUpdatedAt,adminQueueOwner,procurementQueueNextAction};
6326    },
6327    render:(function(){
6328const _Vue = Vue
6329const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
6330
6331const _hoisted_1 = {
6332  key: 0,
6333  class: "memberNewRequestPage"
6334}
6335const _hoisted_2 = { class: "memberNewRequestHero" }
6336const _hoisted_3 = ["onClick"]
6337const _hoisted_4 = { class: "card memberNewRequestForm" }
6338const _hoisted_5 = { class: "fieldLabel" }
6339const _hoisted_6 = ["onUpdate:modelValue"]
6340const _hoisted_7 = { class: "fieldLabel" }
6341const _hoisted_8 = ["onUpdate:modelValue"]
6342const _hoisted_9 = { class: "fieldLabel" }
6343const _hoisted_10 = ["onUpdate:modelValue"]
6344const _hoisted_11 = { class: "formTwo" }
6345const _hoisted_12 = { class: "fieldLabel" }
6346const _hoisted_13 = ["onUpdate:modelValue"]
6347const _hoisted_14 = { class: "fieldLabel" }
6348const _hoisted_15 = ["onUpdate:modelValue"]
6349const _hoisted_16 = { class: "formTwo" }
6350const _hoisted_17 = { class: "fieldLabel" }
6351const _hoisted_18 = ["onUpdate:modelValue"]
6352const _hoisted_19 = { class: "fieldLabel" }
6353const _hoisted_20 = ["onUpdate:modelValue"]
6354const _hoisted_21 = { class: "fieldLabel" }
6355const _hoisted_22 = ["onUpdate:modelValue"]
6356const _hoisted_23 = { class: "newRequestActions" }
6357const _hoisted_24 = ["disabled", "onClick"]
6358const _hoisted_25 = ["disabled", "onClick"]
6359const _hoisted_26 = {
6360  key: 1,
6361  class: "card skeleton"
6362}
6363const _hoisted_27 = {
6364  key: 2,
6365  class: "card adminRecordWorkspace procurementWorkspace memberProcurementWorkspace"
6366}
6367const _hoisted_28 = { class: "adminRecordWorkspaceTop" }
6368const _hoisted_29 = ["onClick"]
6369const _hoisted_30 = { class: "memberCardTop" }
6370const _hoisted_31 = { class: "codeToken requestCode" }
6371const _hoisted_32 = { class: "workspaceTitle" }
6372const _hoisted_33 = { class: "statusPill" }
6373const _hoisted_34 = { class: "workflowActionMeta" }
6374const _hoisted_35 = { class: "recordNarrative" }
6375const _hoisted_36 = { class: "infoGrid" }
6376const _hoisted_37 = {
6377  key: 0,
6378  class: "offerDecisionCard commercialOfferCard commercialDecisionWorkspace"
6379}
6380const _hoisted_38 = { class: "offerDecisionHead commercialDecisionHero" }
6381const _hoisted_39 = { class: "vueBadge" }
6382const _hoisted_40 = { key: 0 }
6383const _hoisted_41 = { class: "commercialHeroTotal" }
6384const _hoisted_42 = { class: "offerTotal" }
6385const _hoisted_43 = { class: "commercialDecisionHighlights" }
6386const _hoisted_44 = { class: "offerBreakdown commercialMoneySummary" }
6387const _hoisted_45 = { key: 0 }
6388const _hoisted_46 = { key: 1 }
6389const _hoisted_47 = {
6390  key: 0,
6391  class: "commercialDisclosure",
6392  open: ""
6393}
6394const _hoisted_48 = { class: "commercialDisclosureBody commercialQuoteGrid" }
6395const _hoisted_49 = { key: 0 }
6396const _hoisted_50 = { key: 1 }
6397const _hoisted_51 = {
6398  key: 1,
6399  class: "commercialDisclosure"
6400}
6401const _hoisted_52 = { class: "commercialDisclosureBody commercialQuoteGrid" }
6402const _hoisted_53 = { key: 0 }
6403const _hoisted_54 = { key: 1 }
6404const _hoisted_55 = { key: 2 }
6405const _hoisted_56 = { key: 3 }
6406const _hoisted_57 = { key: 4 }
6407const _hoisted_58 = { key: 5 }
6408const _hoisted_59 = { key: 6 }
6409const _hoisted_60 = { key: 7 }
6410const _hoisted_61 = { key: 8 }
6411const _hoisted_62 = { key: 9 }
6412const _hoisted_63 = { key: 10 }
6413const _hoisted_64 = { key: 11 }
6414const _hoisted_65 = {
6415  key: 12,
6416  class: "commercialWide"
6417}
6418const _hoisted_66 = { class: "commercialDisclosure" }
6419const _hoisted_67 = { class: "commercialDisclosureBody offerTermsGrid" }
6420const _hoisted_68 = { class: "decisionDocumentList commercialDocuments" }
6421const _hoisted_69 = ["href"]
6422const _hoisted_70 = { class: "commercialDecisionActions" }
6423const _hoisted_71 = { class: "approvalCheck offerAcceptCheck" }
6424const _hoisted_72 = ["onUpdate:modelValue"]
6425const _hoisted_73 = ["disabled", "onClick"]
6426const _hoisted_74 = { class: "offerRevision commercialRevision" }
6427const _hoisted_75 = ["onUpdate:modelValue"]
6428const _hoisted_76 = ["onClick"]
6429const _hoisted_77 = {
6430  key: 1,
6431  class: "orderCreatedBanner"
6432}
6433const _hoisted_78 = ["onClick"]
6434const _hoisted_79 = {
6435  key: 2,
6436  class: "collapseSection procurementEditBox",
6437  open: ""
6438}
6439const _hoisted_80 = { class: "collapseBody formCard" }
6440const _hoisted_81 = ["onUpdate:modelValue"]
6441const _hoisted_82 = ["onUpdate:modelValue"]
6442const _hoisted_83 = ["onUpdate:modelValue"]
6443const _hoisted_84 = { class: "formTwo" }
6444const _hoisted_85 = ["onUpdate:modelValue"]
6445const _hoisted_86 = ["onUpdate:modelValue"]
6446const _hoisted_87 = { class: "formTwo" }
6447const _hoisted_88 = ["onUpdate:modelValue"]
6448const _hoisted_89 = ["onUpdate:modelValue"]
6449const _hoisted_90 = ["onUpdate:modelValue"]
6450const _hoisted_91 = ["onClick"]
6451const _hoisted_92 = {
6452  key: 3,
6453  class: "uploadBox procurementUploadBox memberProcurementUpload"
6454}
6455const _hoisted_93 = { class: "fieldLabel" }
6456const _hoisted_94 = ["onUpdate:modelValue"]
6457const _hoisted_95 = ["value"]
6458const _hoisted_96 = { class: "filePicker wide procurementMemberFilePicker" }
6459const _hoisted_97 = ["onChange"]
6460const _hoisted_98 = ["disabled", "onClick"]
6461const _hoisted_99 = { class: "row" }
6462const _hoisted_100 = ["href"]
6463const _hoisted_101 = ["onClick"]
6464const _hoisted_102 = {
6465  key: 4,
6466  class: "procurementUpdates",
6467  open: ""
6468}
6469const _hoisted_103 = { class: "row" }
6470const _hoisted_104 = ["onClick"]
6471const _hoisted_105 = ["onClick"]
6472
6473return function render(_ctx, _cache) {
6474  with (_ctx) {
6475    const { createElementVNode: _createElementVNode, vModelSelect: _vModelSelect, withDirectives: _withDirectives, vModelText: _vModelText, createTextVNode: _createTextVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, toDisplayString: _toDisplayString, normalizeClass: _normalizeClass, renderList: _renderList, Fragment: _Fragment, vModelCheckbox: _vModelCheckbox, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
6476
6477    const _component_PublicFrame = _resolveComponent("PublicFrame")
6478
6479    return (_openBlock(), _createBlock(_component_PublicFrame, { title: createMode?'طلب جديد':'تفاصيل طلب التوريد' }, {
6480      default: _withCtx(() => [createMode
6481        ? (_openBlock(), _createElementBlock("section", _hoisted_1, [_createElementVNode("div", _hoisted_2, [
6482            _createElementVNode("button", {
6483              class: "smallbtn secondary",
6484              onClick: $event => ($router.push('/orders'))
6485            }, "← طلباتي", 8, _hoisted_3),
6486            _cache[0] || (_cache[0] = _createElementVNode("span", { class: "vueBadge" }, "طلب توريد جديد", -1)),
6487            _cache[1] || (_cache[1] = _createElementVNode("h2", null, "أرسل احتياجك إلى SMT", -1)),
6488            _cache[2] || (_cache[2] = _createElementVNode("p", null, "اكتب المطلوب بوضوح. بعد الإرسال تراجع SMT الطلب، تبحث أو تتحقق من المورد، ثم تنشر عرض السعر لك للموافقة.", -1))
6489          ]), _cache[14] || (_cache[14] = _createElementVNode("div", { class: "requestJourneyMini" }, [
6490            _createElementVNode("span", null, [_createElementVNode("i", null, "1"), _createElementVNode("b", null, "طلبك")]),
6491            _createElementVNode("span", null, [_createElementVNode("i", null, "2"), _createElementVNode("b", null, "مراجعة SMT")]),
6492            _createElementVNode("span", null, [_createElementVNode("i", null, "3"), _createElementVNode("b", null, "عرض السعر")]),
6493            _createElementVNode("span", null, [_createElementVNode("i", null, "4"), _createElementVNode("b", null, "قرارك")]),
6494            _createElementVNode("span", null, [_createElementVNode("i", null, "5"), _createElementVNode("b", null, "التنفيذ")])
6495          ], -1)), _createElementVNode("section", _hoisted_4, [
6496            _createElementVNode("label", _hoisted_5, [_cache[4] || (_cache[4] = _createElementVNode("span", null, "نوع الخدمة", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((form.service_type) = $event) }, _cache[3] || (_cache[3] = [
6497              _createElementVNode("option", { value: "product_sourcing" }, "البحث عن منتج أو مصنع", -1),
6498              _createElementVNode("option", { value: "supplier_verification" }, "التحقق من المورد", -1),
6499              _createElementVNode("option", { value: "quality_inspection" }, "فحص الجودة", -1),
6500              _createElementVNode("option", { value: "supplier_payment" }, "دفع مصنع مقابل فاتورة", -1),
6501              _createElementVNode("option", { value: "shipping_logistics" }, "الشحن والخدمات اللوجستية", -1)
6502            ]), 8, _hoisted_6), [[_vModelSelect, form.service_type]])]),
6503            _createElementVNode("label", _hoisted_7, [_cache[5] || (_cache[5] = _createElementVNode("span", null, "عنوان الطلب", -1)), _withDirectives(_createElementVNode("input", {
6504              "onUpdate:modelValue": $event => ((form.title) = $event),
6505              placeholder: "مثال: خط إنتاج اندومي 10,000 باكيت/ساعة"
6506            }, null, 8, _hoisted_8), [[_vModelText, form.title]])]),
6507            _createElementVNode("label", _hoisted_9, [_cache[6] || (_cache[6] = _createElementVNode("span", null, "التفاصيل والمواصفات", -1)), _withDirectives(_createElementVNode("textarea", {
6508              "onUpdate:modelValue": $event => ((form.description) = $event),
6509              placeholder: "الكمية، المواصفات، الاستخدام، مدينة التسليم وأي شروط مهمة"
6510            }, null, 8, _hoisted_10), [[_vModelText, form.description]])]),
6511            _createElementVNode("div", _hoisted_11, [_createElementVNode("label", _hoisted_12, [_cache[7] || (_cache[7] = _
6511createElementVNode("span", null, [_createTextVNode("اسم المورد / المصنع "), _createElementVNode("small", null, "اختياري")], -1)), _withDirectives(_createElementVNode("input", {
6512              "onUpdate:modelValue": $event => ((form.supplier_name) = $event),
6513              placeholder: "إذا كان لديك مورد محدد"
6514            }, null, 8, _hoisted_13), [[_vModelText, form.supplier_name]])]), _createElementVNode("label", _hoisted_14, [_cache[8] || (_cache[8] = _createElementVNode("span", null, [_createTextVNode("تواصل المورد "), _createElementVNode("small", null, "اختياري")], -1)), _withDirectives(_createElementVNode("input", {
6515              "onUpdate:modelValue": $event => ((form.supplier_contact) = $event),
6516              placeholder: "WeChat / هاتف / بريد"
6517            }, null, 8, _hoisted_15), [[_vModelText, form.supplier_contact]])])]),
6518            _createElementVNode("div", _hoisted_16, [_createElementVNode("label", _hoisted_17, [_cache[9] || (_cache[9] = _createElementVNode("span", null, [_createTextVNode("رقم Proforma "), _createElementVNode("small", null, "اختياري")], -1)), _withDirectives(_createElementVNode("input", {
6519              "onUpdate:modelValue": $event => ((form.proforma_number) = $event),
6520              placeholder: "إذا كان لديك عرض جاهز"
6521            }, null, 8, _hoisted_18), [[_vModelText, form.proforma_number]])]), _createElementVNode("label", _hoisted_19, [_cache[11] || (_cache[11] = _createElementVNode("span", null, "عملة العرض المطلوبة", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((form.quoted_currency) = $event) }, _cache[10] || (_cache[10] = [_createElementVNode("option", { value: "CNY" }, "يوان صيني ¥ (CNY)", -1), _createElementVNode("option", { value: "USD" }, "دولار أمريكي $ (USD)", -1), _createElementVNode("option", { value: "SDG" }, "جنيه سوداني (SDG)", -1)]), 8, _hoisted_20), [[_vModelSelect, form.quoted_currency]])])]),
6522            _createElementVNode("label", _hoisted_21, [_cache[12] || (_cache[12] = _createElementVNode("span", null, [_createTextVNode("ملاحظة إضافية "), _createElementVNode("small", null, "اختياري")], -1)), _withDirectives(_createElementVNode("textarea", {
6523              "onUpdate:modelValue": $event => ((form.member_note) = $event),
6524              placeholder: "أي معلومة تساعد فريق SMT"
6525            }, null, 8, _hoisted_22), [[_vModelText, form.member_note]])]),
6526            _createElementVNode("div", _hoisted_23, [_createElementVNode("button", {
6527              class: "btn",
6528              disabled: store.state.busy,
6529              onClick: $event => (create(true))
6530            }, "إرسال الطلب للمراجعة", 8, _hoisted_24), _createElementVNode("button", {
6531              class: "btn secondary",
6532              disabled: store.state.busy,
6533              onClick: $event => (create(false))
6534            }, "حفظ كمسودة", 8, _hoisted_25)]),
6535            _cache[13] || (_cache[13] = _createElementVNode("p", { class: "hint requestFormHint" }, "لن يتم إنشاء طلب شراء مؤكد أو التزام مالي إلا بعد أن تنشر SMT عرض السعر وتقوم أنت بقبوله صراحة.", -1))
6536          ])]))
6537        : _createCommentVNode("", true), (!createMode&&!detail&&store.state.busy)
6538        ? (_openBlock(), _createElementBlock("div", _hoisted_26, "جاري تحميل الطلب..."))
6539        : _createCommentVNode("", true), (!createMode&&detail)
6540        ? (_openBlock(), _createElementBlock("section", _hoisted_27, [
6541            _createElementVNode("div", _hoisted_28, [_createElementVNode("button", {
6542              class: "smallbtn secondary",
6543              onClick: closeDetail
6544            }, "إغلاق التفاصيل", 8, _hoisted_29)]),
6545            _createElementVNode("div", _hoisted_30, [_createElementVNode("div", null, [_createElementVNode("span", _hoisted_31, _toDisplayString(detail.request.request_code), 1), _createElementVNode("h3", _hoisted_32, _toDisplayString(detail.request.title), 1)]), _createElementVNode("span", _hoisted_33, _toDisplayString(procurementStatusLabel(detail.request.status)), 1)]),
6546            _createElementVNode("section", { class: _normalizeClass('workflowActionCard adminWorkflowActionV4 '+nextAction.tone) }, [
6547              _cache[15] || (_cache[15] = _createElementVNode("span", { class: "workflowActionKicker" }, "الإجراء المطلوب الآن", -1)),
6548              _createElementVNode("h3", null, _toDisplayString(nextAction.title), 1),
6549              _createElementVNode("div", _hoisted_34, [_createElementVNode("b", null, "الدور الآن: " + _toDisplayString(nextAction.owner), 1)]),
6550              _createElementVNode("p", null, _toDisplayString(nextAction.note), 1)
6551            ], 2),
6552            _createElementVNode("p", _hoisted_35, _toDisplayString(detail.request.description), 1),
6553            _createElementVNode("div", _hoisted_36, [
6554              _createElementVNode("p", null, [_cache[16] || (_cache[16] = _createElementVNode("b", null, "الخدمة:", -1)), _createTextVNode(" " + _toDisplayString(procurementServiceLabel(detail.request.service_type)), 1
6554)]),
6555              _createElementVNode("p", null, [_cache[17] || (_cache[17] = _createElementVNode("b", null, "المورد:", -1)), _createTextVNode(" " + _toDisplayString(detail.request.supplier_name||'-'), 1)]),
6556              _createElementVNode("p", null, [_cache[18] || (_cache[18] = _createElementVNode("b", null, "عرض السعر:", -1)), _createTextVNode(" " + _toDisplayString(detail.request.quoted_amount?detail.request.quoted_amount+' '+detail.request.quoted_currency:'لم يصدر'), 1)]),
6557              _createElementVNode("p", null, [_cache[19] || (_cache[19] = _createElementVNode("b", null, "Proforma:", -1)), _createTextVNode(" " + _toDisplayString(detail.request.proforma_number||'-'), 1)])
6558            ]),
6559            (detail.request.status==='quoted'&&!detail.order)
6560              ? (_openBlock(), _createElementBlock("section", _hoisted_37, [
6561                  _createElementVNode("div", _hoisted_38, [_createElementVNode("div", null, [_createElementVNode("span", _hoisted_39, "العرض رقم " + _toDisplayString(detail.request.offer_version), 1), _cache[20] || (_cache[20] = _createElementVNode("h3", null, "راجع عرضك قبل الاعتماد", -1)), (Number(detail.request.commercial_model_version||1)>=2)
6562                    ? (_openBlock(), _createElementBlock("small", _hoisted_40, "السعر والشحن والشروط محفوظة كنسخة واحدة عند القبول"))
6563                    : _createCommentVNode("", true)]), _createElementVNode("div", _hoisted_41, [_cache[21] || (_cache[21] = _createElementVNode("small", null, "الإجمالي النهائي", -1)), _createElementVNode("b", _hoisted_42, _toDisplayString(procurementMoney(detail.request.quoted_amount,detail.request.quoted_currency)), 1)])]),
6564                  _createElementVNode("div", _hoisted_43, [
6565                    _createElementVNode("span", null, [_cache[22] || (_cache[22] = _createElementVNode("small", null, "العملة", -1)), _createElementVNode("b", null, _toDisplayString(procurementCurrencyLabel(detail.request.quoted_currency)), 1)]),
6566                    _createElementVNode("span", null, [_cache[23] || (_cache[23] = _createElementVNode("small", null, "التسليم", -1)), _createElementVNode("b", null, _toDisplayString(detail.request.incoterm?procurementIncotermLabel(detail.request.incoterm):'بدون Incoterm'), 1)]),
6567                    _createElementVNode("span", null, [_cache[24] || (_cache[24] = _createElementVNode("small", null, "الشحن", -1)), _createElementVNode("b", null, _toDisplayString(procurementShippingLabel(detail.request.shipping_mode)), 1)]),
6568                    _createElementVNode("span", null, [_cache[25] || (_cache[25] = _createElementVNode("small", null, "صلاحية العرض", -1)), _createElementVNode("b", null, _toDisplayString(shortDate(detail.request.offer_valid_until)), 1)])
6569                  ]),
6570                  _createElementVNode("div", _hoisted_44, [
6571                    _createElementVNode("span", null, [_cache[26] || (_cache[26] = _createElementVNode("small", null, "قيمة المنتجات / الخدمة", -1)), _createElementVNode("b", null, _toDisplayString(procurementMoney(detail.request.goods_amount||detail.request.quoted_amount-detail.request.service_fee_amount-detail.request.shipping_amount+detail.request.discount_amount,detail.request.quoted_currency)), 1)]),
6572                    _createElementVNode("span", null, [_createElementVNode("small", null, "رسوم الخدمة " + _toDisplayString(Number(detail.request.commercial_model_version||1)>=2?'('+Number(detail.request.service_fee_percent||0)+'%)':''), 1), _createElementVNode("b", null, _toDisplayString(procurementMoney(detail.request.service_fee_amount,detail.request.quoted_currency)), 1)]),
6573                    _createElementVNode("span", null, [_cache[27] || (_cache[27] = _createElementVNode("small", null, "الشحن", -1)), _createElementVNode("b", null, _toDisplayString(procurementMoney(detail.request.shipping_amount,detail.request.quoted_currency)), 1)]),
6574                    (Number(detail.request.insurance_amount||0)>0)
6575                      ? (_openBlock(), _createElementBlock("span", _hoisted_45, [_cache[28] || (_cache[28] = _createElementVNode("small", null, "التأمين", -1)), _createElementVNode("b", null, _toDisplayString(procurementMoney(detail.request.insurance_amount,detail.request.quoted_currency)), 1)]))
6576                      : _createCommentVNode("", true),
6577                    (Number(detail.request.discount_amount||0)>0)
6578                      ? (_openBlock(), _createElementBlock("span", _hoisted_46, [_cache[29] || (_cache[29] = _createElementVNode("small", null, "الخصم", -1)), _createElementVNode("b", null, "- " + _toDisplayString(procurementMoney(detail.request.discount_amount,detail.request.quoted_currency)), 1)]))
6579                      : _createCommentVNode("", true)
6580                  ]),
6581                  (Number(detail.request.commercial_model_version||
65811)>=2)
6582                    ? (_openBlock(), _createElementBlock("details", _hoisted_47, [_createElementVNode("summary", null, [_cache[30] || (_cache[30] = _createElementVNode("span", null, "تفاصيل السعر", -1)), _createElementVNode("strong", null, _toDisplayString(procurementPricingLabel(detail.request.pricing_mode)), 1)]), _createElementVNode("div", _hoisted_48, [
6583                        _createElementVNode("p", null, [_cache[31] || (_cache[31] = _createElementVNode("b", null, "طريقة التسعير:", -1)), _createTextVNode(" " + _toDisplayString(procurementPricingLabel(detail.request.pricing_mode)), 1)]),
6584                        (detail.request.pricing_mode==='unit')
6585                          ? (_openBlock(), _createElementBlock("p", _hoisted_49, [_cache[32] || (_cache[32] = _createElementVNode("b", null, "الكمية:", -1)), _createTextVNode(" " + _toDisplayString(detail.request.quote_quantity) + " " + _toDisplayString(procurementQuoteUnitLabel(detail.request.quote_unit)), 1)]))
6586                          : _createCommentVNode("", true),
6587                        (detail.request.pricing_mode==='unit')
6588                          ? (_openBlock(), _createElementBlock("p", _hoisted_50, [_cache[33] || (_cache[33] = _createElementVNode("b", null, "سعر الوحدة:", -1)), _createTextVNode(" " + _toDisplayString(procurementMoney(detail.request.unit_price,detail.request.quoted_currency)), 1)]))
6589                          : _createCommentVNode("", true),
6590                        _createElementVNode("p", null, [_cache[34] || (_cache[34] = _createElementVNode("b", null, "نوع العرض:", -1)), _createTextVNode(" " + _toDisplayString(purchaseModeLabel(detail.request.purchase_mode)), 1)])
6591                      ])]))
6592                    : _createCommentVNode("", true),
6593                  (Number(detail.request.commercial_model_version||1)>=2)
6594                    ? (_openBlock(), _createElementBlock("details", _hoisted_51, [_createElementVNode("summary", null, [_cache[35] || (_cache[35] = _createElementVNode("span", null, "الشحن والتسليم", -1)), _createElementVNode("strong", null, _toDisplayString(procurementShippingLabel(detail.request.shipping_mode)), 1)]), _createElementVNode("div", _hoisted_52, [
6595                        _createElementVNode("p", null, [_cache[36] || (_cache[36] = _createElementVNode("b", null, "Incoterm:", -1)), _createTextVNode(" " + _toDisplayString(detail.request.incoterm?procurementIncotermLabel(detail.request.incoterm):'بدون Incoterm'), 1)]),
6596                        (detail.request.container_type)
6597                          ? (_openBlock(), _createElementBlock("p", _hoisted_53, [_cache[37] || (_cache[37] = _createElementVNode("b", null, "الحاوية:", -1)), _createTextVNode(" " + _toDisplayString(procurementContainerLabel(detail.request.container_type)), 1)]))
6598                          : _createCommentVNode("", true),
6599                        (Number(detail.request.gross_weight_kg||0))
6600                          ? (_openBlock(), _createElementBlock("p", _hoisted_54, [_cache[38] || (_cache[38] = _createElementVNode("b", null, "الوزن الإجمالي:", -1)), _createTextVNode(" " + _toDisplayString(detail.request.gross_weight_kg) + " كجم", 1)]))
6601                          : _createCommentVNode("", true),
6602                        (Number(detail.request.net_weight_kg||0))
6603                          ? (_openBlock(), _createElementBlock("p", _hoisted_55, [_cache[39] || (_cache[39] = _createElementVNode("b", null, "الوزن الصافي:", -1)), _createTextVNode(" " + _toDisplayString(detail.request.net_weight_kg) + " كجم", 1)]))
6604                          : _createCommentVNode("", true),
6605                        (Number(detail.request.total_cbm||0))
6606                          ? (_openBlock(), _createElementBlock("p", _hoisted_56, [_cache[40] || (_cache[40] = _createElementVNode("b", null, "الحجم:", -1)), _createTextVNode(" " + _toDisplayString(detail.request.total_cbm) + " CBM", 1)]))
6607                          : _createCommentVNode("", true),
6608                        (Number(detail.request.packages_count||0))
6609                          ? (_openBlock(), _createElementBlock("p", _hoisted_57, [_cache[41] || (_cache[41] = _createElementVNode("b", null, "الطرود:", -1)), _createTextVNode(" " + _toDisplayString(detail.request.packages_count), 1)]))
6610                          : _createCommentVNode("", true),
6611                        (detail.request.origin_country||detail.request.origin_city)
6612                          ? (_openBlock(), _createElementBlock("p", _hoisted_58, [_cache[42] || (_cache[42] = _createElementVNode("b", null, "المنشأ:", -1)), _createTextVNode(" " + _toDisplayString([$cityLabel(detail.request.origin_city),detail.request.origin_country].filter(
6612Boolean).join(' — ')), 1)]))
6613                          : _createCommentVNode("", true),
6614                        (detail.request.loading_point)
6615                          ? (_openBlock(), _createElementBlock("p", _hoisted_59, [_cache[43] || (_cache[43] = _createElementVNode("b", null, "نقطة التحميل:", -1)), _createTextVNode(" " + _toDisplayString(detail.request.loading_point), 1)]))
6616                          : _createCommentVNode("", true),
6617                        (detail.request.destination_country||detail.request.destination_city)
6618                          ? (_openBlock(), _createElementBlock("p", _hoisted_60, [_cache[44] || (_cache[44] = _createElementVNode("b", null, "الوجهة:", -1)), _createTextVNode(" " + _toDisplayString([$cityLabel(detail.request.destination_city),detail.request.destination_country].filter(Boolean).join(' — ')), 1)]))
6619                          : _createCommentVNode("", true),
6620                        (detail.request.destination_point)
6621                          ? (_openBlock(), _createElementBlock("p", _hoisted_61, [_cache[45] || (_cache[45] = _createElementVNode("b", null, "نقطة الوصول:", -1)), _createTextVNode(" " + _toDisplayString(detail.request.destination_point), 1)]))
6622                          : _createCommentVNode("", true),
6623                        (Number(detail.request.production_lead_days||0))
6624                          ? (_openBlock(), _createElementBlock("p", _hoisted_62, [_cache[46] || (_cache[46] = _createElementVNode("b", null, "التجهيز/الإنتاج:", -1)), _createTextVNode(" " + _toDisplayString(detail.request.production_lead_days) + " يوم", 1)]))
6625                          : _createCommentVNode("", true),
6626                        (Number(detail.request.transit_days||0))
6627                          ? (_openBlock(), _createElementBlock("p", _hoisted_63, [_cache[47] || (_cache[47] = _createElementVNode("b", null, "زمن الشحن:", -1)), _createTextVNode(" " + _toDisplayString(detail.request.transit_days) + " يوم", 1)]))
6628                          : _createCommentVNode("", true),
6629                        (detail.request.hs_code)
6630                          ? (_openBlock(), _createElementBlock("p", _hoisted_64, [_cache[48] || (_cache[48] = _createElementVNode("b", null, "HS Code:", -1)), _createTextVNode(" " + _toDisplayString(detail.request.hs_code), 1)]))
6631                          : _createCommentVNode("", true),
6632                        (detail.request.packing_notes)
6633                          ? (_openBlock(), _createElementBlock("p", _hoisted_65, [_cache[49] || (_cache[49] = _createElementVNode("b", null, "التعبئة:", -1)), _createTextVNode(" " + _toDisplayString(detail.request.packing_notes), 1)]))
6634                          : _createCommentVNode("", true)
6635                      ])]))
6636                    : _createCommentVNode("", true),
6637                  _createElementVNode("details", _hoisted_66, [_cache[55] || (_cache[55] = _createElementVNode("summary", null, [_createElementVNode("span", null, "الشروط"), _createElementVNode("strong", null, "الدفع والتسليم")], -1)), _createElementVNode("div", _hoisted_67, [_createElementVNode("p", null, [_cache[50] || (_cache[50] = _createElementVNode("b", null, "صالح حتى:", -1)), _createTextVNode(" " + _toDisplayString(shortDate(detail.request.offer_valid_until)), 1)]), _createElementVNode("p", null, [_cache[51] || (_cache[51] = _createElementVNode("b", null, "شروط الدفع والعرض:", -1)), _cache[52] || (_cache[52] = _createElementVNode("br", null, null, -1)), _createTextVNode(_toDisplayString(detail.request.offer_terms), 1)]), _createElementVNode("p", null, [_cache[53] || (_cache[53] = _createElementVNode("b", null, "شروط التسليم:", -1)), _cache[54] || (_cache[54] = _createElementVNode("br", null, null, -1)), _createTextVNode(_toDisplayString(detail.request.delivery_terms), 1)])])]),
6638                  _createElementVNode("div", _hoisted_68, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(procurementQuoteDocuments(detail), (d) => {
6639                    return (_openBlock(), _createElementBlock("div", {
6640                      class: "decisionDocument",
6641                      key: d.id
6642                    }, [_createElementVNode("div", null, [_cache[56] || (_cache[56] = _
6642createElementVNode("span", { class: "adminEyebrow" }, "مستند العرض", -1)), _createElementVNode("b", null, _toDisplayString(procurementDocumentLabel(d.document_type)), 1), _createElementVNode("small", null, _toDisplayString(d.original_name), 1)]), _createElementVNode("a", {
6643                      class: "smallbtn secondary",
6644                      href: d.file_url,
6645                      target: "_blank",
6646                      rel: "noopener"
6647                    }, "فتح المستند", 8, _hoisted_69)]))
6648                  }), 128))]),
6649                  _createElementVNode("div", _hoisted_70, [_createElementVNode("label", _hoisted_71, [_withDirectives(_createElementVNode("input", {
6650                    type: "checkbox",
6651                    "onUpdate:modelValue": $event => ((acceptTerms) = $event)
6652                  }, null, 8, _hoisted_72), [[_vModelCheckbox, acceptTerms]]), _cache[57] || (_cache[57] = _createElementVNode("span", null, "راجعت الإجمالي والعملة والشحن وشروط الدفع والتسليم، وأوافق على إنشاء طلب بهذه النسخة.", -1))]), _createElementVNode("button", {
6653                    class: "btn wide commercialAcceptButton",
6654                    disabled: !acceptTerms||store.state.busy,
6655                    onClick: acceptOffer
6656                  }, "قبول العرض وإنشاء الطلب", 8, _hoisted_73), _createElementVNode("details", _hoisted_74, [_cache[58] || (_cache[58] = _createElementVNode("summary", null, "أحتاج تعديل العرض", -1)), _withDirectives(_createElementVNode("textarea", {
6657                    "onUpdate:modelValue": $event => ((revisionNote) = $event),
6658                    placeholder: "اكتب التعديل المطلوب بوضوح"
6659                  }, null, 8, _hoisted_75), [[_vModelText, revisionNote]]), _createElementVNode("button", {
6660                    class: "smallbtn secondary",
6661                    onClick: requestRevision
6662                  }, "إرسال طلب التعديل", 8, _hoisted_76)])])
6663                ]))
6664              : _createCommentVNode("", true),
6665            (detail.order)
6666              ? (_openBlock(), _createElementBlock("div", _hoisted_77, [_createElementVNode("div", null, [_createElementVNode("b", null, "تم إنشاء الطلب " + _toDisplayString(detail.order.order_code), 1), _cache[59] || (_cache[59] = _createElementVNode("span", null, "السعر والشروط محفوظة داخل الطلب.", -1))]), _createElementVNode("button", {
6667                  class: "smallbtn",
6668                  onClick: $event => ($router.push('/orders?order='+detail.order.id))
6669                }, "فتح الطلب", 8, _hoisted_78)]))
6670              : _createCommentVNode("", true),
6671            (detail.request.status==='draft')
6672              ? (_openBlock(), _createElementBlock("details", _hoisted_79, [_cache[62] || (_cache[62] = _createElementVNode("summary", null, [_createElementVNode("b", null, "تعديل المسودة"), _createElementVNode("span")], -1)), _createElementVNode("div", _hoisted_80, [
6673                  _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((editForm.service_type) = $event) }, _cache[60] || (_cache[60] = [
6674                    _createElementVNode("option", { value: "product_sourcing" }, "البحث عن منتج أو مصنع", -1),
6675                    _createElementVNode("option", { value: "supplier_verification" }, "التحقق من المورد", -1),
6676                    _createElementVNode("option", { value: "quality_inspection" }, "فحص الجودة", -1),
6677                    _createElementVNode("option", { value: "supplier_payment" }, "دفع مصنع مقابل فاتورة", -1),
6678                    _createElementVNode("option", { value: "shipping_logistics" }, "الشحن والخدمات اللوجستية", -1)
6679                  ]), 8, _hoisted_81), [[_vModelSelect, editForm.service_type]]),
6680                  _withDirectives(_createElementVNode("input", {
6681                    "onUpdate:modelValue": $event => ((editForm.title) = $event),
6682                    placeholder: "عنوان الطلب"
6683                  }, null, 8, _hoisted_82), [[_vModelText, editForm.title]]),
6684                  _withDirectives(_createElementVNode("textarea", {
6685                    "onUpdate:modelValue": $event => ((editForm.description) = $event),
6686                    placeholder: "التفاصيل والمواصفات"
6687                  }, null, 8, _hoisted_83), [[_vModelText, editForm.description]]),
6688                  _createElementVNode("div", _hoisted_84, [_withDirectives(_createElementVNode("input", {
6689                    "onUpdate:modelValue": $event => ((editForm.supplier_name) = $event),
6690                    placeholder: "اسم المورد / المصنع"
6691                  }, null, 8, _hoisted_85), [[_vModelText, editForm.supplier_name]]), _withDirectives(_createElementVNode("input", {
6692                    "onUpdate:modelValue": $event => ((editForm.supplier_contact) = $event),
6693                    placeholder: "بيانات تواصل المورد"
6694                  }, null, 8, _hoisted_86), [[_vModelText, editForm.supplier_contact]])]),
6695                  _createElementVNode("div", _hoisted_87, [_withDirectives(_createElementVNode("input", {
6696                    "onUpdate:modelValue": $event => ((editForm.proforma_number) = $event),
6697                    placeholder: "رقم Proforma"
6698                  }, null, 8, _hoisted_88), [[_vModelText, editForm.proforma_number]]), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((editForm.quoted_currency) = $event) }, _cache[61] || (_cache[61] = [_createElementVNode("option", { value: "CNY" }, "يوان صيني ¥ (CNY)", -1), _createElementVNode("option", { value: "USD" }, "دولار أمريكي $ (USD)", -1), _createElementVNode("option", { value: "SDG" }, "جنيه سوداني (SDG)", -1)]), 8, _hoisted_89), [[_vModelSelect, editForm.quoted_currency]])]),
6699                  _withDirectives(_createElementVNode("textarea", {
6700                    "onUpdate:modelValue": $event => ((editForm.member_note) = $event),
6701                    placeholder: "ملاحظة إضافية"
6702                  }, null, 8, _hoisted_90), [[_vModelText, editForm.member_note]]),
6703                  _createElementVNode("button", {
6704                    class: "smallbtn",
6705                    onClick: saveDraft
6706                  }, "حفظ التعديلات", 8, _hoisted_91)
6707                ])]))
6708              : _createCommentVNode("", true),
6709            (['draft','submitted','under_review','quoted','payment_pending'].includes(detail.request.status))
6710              ? (_openBlock(), _createElementBlock("div", _hoisted_92, [
6711                  _cache[65] || (_cache[65] = _createElementVNode("div", { class: "memberSectionHead" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "مستنداتك"), _createElementVNode("h3", null, "رفع مستند للطلب")])], -1)),
6712                  _cache[66] || (_cache[66] = _createElementVNode("p", { class: "hint" }, "PDF أو JPG أو PNG أو WEBP، بحد أقصى 12MB.", -1)),
6713                  _createElementVNode("label", _hoisted_93, [_cache[63] || (_cache[63] = _createElementVNode("span", null, "نوع المستند", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((documentType) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(PROCUREMENT_DOCUMENT_LABELS, (label, key) => {
6714                    return (_openBlock(), _createElementBlock("option", {
6715                      key: key,
6716                      value: key
6717                    }, _toDisplayString(label), 9, _hoisted_95))
6718                  }), 128))], 8, _hoisted_94), [[_vModelSelect, documentType]])]),
6719                  _createElementVNode("label", _hoisted_96, [_createElementVNode("input", {
6720                    type: "file",
6721                    accept: "application/pdf,image/jpeg,image/png,image/webp",
6722                    onChange: onFile
6723                  }, null, 40, _hoisted_97), _cache[64] || (_cache[64] = _createElementVNode("span", null, "اختيار مستند", -1)), _createElementVNode("em", null, _toDisplayString(fileLabel), 1)]),
6724                  _createElementVNode("button", {
6725                    class: "btn loadMore",
6726                    disabled: store.state.upload&&store.state.upload.active,
6727                    onClick: upload
6728                  }, _toDisplayString(store.state.upload&&store.state.upload.active?'جاري الرفع...':'رفع المستند'), 9, _hoisted_98)
6729                ]))
6730              : _createCommentVNode("", true),
6731            (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(procurementSupportingDocuments(detail), (d) => {
6732              return (_openBlock(), _createElementBlock("div", {
6733                class: "relatedItem procurementDocumentRow",
6734                key: d.id
6735              }, [_createElementVNode("b", null, _toDisplayString(procurementDocumentLabel(d.document_type)), 1
6735), _createElementVNode("span", null, _toDisplayString(d.original_name), 1), _createElementVNode("div", _hoisted_99, [_createElementVNode("a", {
6736                class: "smallbtn secondary",
6737                href: d.file_url,
6738                target: "_blank",
6739                rel: "noopener"
6740              }, "فتح", 8, _hoisted_100), (detail.request.status==='draft'&&d.uploaded_by_type==='member')
6741                ? (_openBlock(), _createElementBlock("button", {
6742                    key: 0,
6743                    class: "smallbtn danger",
6744                    onClick: $event => (archiveDocument(d))
6745                  }, "حذف", 8, _hoisted_101))
6746                : _createCommentVNode("", true)])]))
6747            }), 128)),
6748            (detail.updates&&detail.updates.length)
6749              ? (_openBlock(), _createElementBlock("details", _hoisted_102, [_createElementVNode("summary", null, [_cache[67] || (_cache[67] = _createElementVNode("b", null, "تحديثات الطلب", -1)), _createElementVNode("span", null, _toDisplayString(detail.updates.length), 1)]), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(detail.updates, (u) => {
6750                  return (_openBlock(), _createElementBlock("div", {
6751                    class: "relatedItem",
6752                    key: u.id
6753                  }, [_createElementVNode("b", null, _toDisplayString(u.title), 1), _createElementVNode("span", null, _toDisplayString(u.body), 1), _createElementVNode("small", null, _toDisplayString(shortDate(u.created_at)), 1)]))
6754                }), 128))]))
6755              : _createCommentVNode("", true),
6756            _createElementVNode("div", _hoisted_103, [(detail.request.status==='draft')
6757              ? (_openBlock(), _createElementBlock("button", {
6758                  key: 0,
6759                  class: "btn",
6760                  onClick: submit
6761                }, "إرسال للمراجعة", 8, _hoisted_104))
6762              : _createCommentVNode("", true), (['draft','submitted'].includes(detail.request.status))
6763              ? (_openBlock(), _createElementBlock("button", {
6764                  key: 1,
6765                  class: "btn danger",
6766                  onClick: cancel
6767                }, "إلغاء الطلب", 8, _hoisted_105))
6768              : _createCommentVNode("", true)])
6769          ]))
6770        : _createCommentVNode("", true)]),
6771      _: 1
6772    }, 8, ["title"]))
6773  }
6774}
6775})()
6776  };
6777
6778  const MemberOrdersPage={
6779    components:{PublicFrame},
6780    setup(){
6781      const store=useGzcStore();const router=useRouter();const route=useRoute();const orders=ref([]);const workflow=ref([]);const summary=ref({total:0,needs_action:0,in_progress:0,quoted:0,confirmed:0,completed:0,unread:0});const filter=ref('all');const detail=ref(null);const nextAction=computed(()=>customerOrderNextAction(detail.value,'member'));const commercialSnapshot=computed(()=>procurementCommercialSnapshot(detail.value&&detail.value.order));
6782      const visibleItems=computed(()=>workflow.value.filter(x=>{if(filter.value==='action')return memberNeedsAction(x);if(filter.value==='active')return !memberWorkflowDone(x);if(filter.value==='quotes')return x.kind==='procurement'&&String(x.procurement_status||x.status||'')==='quoted';if(filter.value==='confirmed')return x.kind==='order'&&!memberWorkflowDone(x);if(filter.value==='completed')return memberWorkflowDone(x);return true;}));
6783      function progress(status){return({confirmed:1,procurement:2,completed:3,cancelled:0})[String(status||'')]||0}
6784      function memberWorkflowDone(x){return ['completed','cancelled'].includes(String(x.procurement_status||x.status||''))||['completed','cancelled'].includes(String(x.status||''));}
6785      function memberNeedsAction(x){const status=String(x.procurement_status||x.status||'');if(x.kind==='procurement')return ['draft','quoted','payment_pending'].includes(status);return x.kind==='order'&&status==='payment_pending'&&String(x.payment_status||'')==='pending'&&!x.has_payment_proof;}
6786      function workflowStatus(x){if(x.kind==='order')return customerOrderStatusLabel(x.status);return procurementStatusLabel(x.procurement_status||x.status);}
6787      function workflowKind(x){return x.kind==='order'?'طلب مؤكد':'طلب توريد';}
6788      function workflowAction(x){const s=String(x.procurement_status||x.status||'');if(x.kind==='order'){if(s==='payment_pending'&&String(x.payment_status||'')==='pending')return x.has_payment_proof?'إثبات الدفع مرفوع — بانتظار مراجعة SMT':'ارفع إثبات الدفع لاستكمال الطلب';if(s==='processing'||String(x.status||'')==='procurement')return 'التنفيذ لدى SMT';if(s==='completed'||String(x.status||'')==='completed')return 'مكتمل';if(s==='cancelled'||String(x.status||'')==='cancelled')return 'ملغي';return 'متابعة الطلب المؤكد';}if(s==='draft')return 'أكمل الطلب وأرسله';if(s==='submitted'||s==='under_review')return 'قيد متابعة SMT';if(s==='quoted')return 'راجع عرض السعر واتخذ قرارك';if(s==='payment_pending')return 'استكمل الدفع / الإثبات';if(s==='processing')return 'قيد التنفيذ لدى SMT';if(s==='completed')return 'مكتمل';if(s==='cancelled')return 'ملغي';return 'متابعة الطلب';}
6789      function workflowAmount(x){const amount=x.total_amount||x.quoted_amount;const currency=x.currency||x.quoted_currency;return amount?procurementMoney(amount,currency):'';}
6790      function workflowUpdated(x){return shortDate(x.updated_at||x.accepted_at||'');}
6791      async function open(order){const r=await runBusyAction(store,'member-orders.open',()=>api('/api/member/orders/'+encodeURIComponent(order.id||order.order_id)));const record=safeRecord(r.order);
6791if(r.ok&&record&&record.id){r.order=record;detail.value=r;const requestId=record.procurement_request_id;if(requestId){const ack=await api('/api/member/procurement/'+encodeURIComponent(requestId)+'/updates/read',{method:'POST',body:'{}'});if(ack&&ack.ok&&Number(ack.read||0)>0){store.state.memberUnread=Math.max(0,Number(store.state.memberUnread||0)-Number(ack.read||0));store.state.memberNotifications=safeArray(store.state.memberNotifications).map(n=>String(n.request_id)===String(requestId)?Object.assign({},n,{read_at:n.read_at||new Date().toISOString()}):n);const row=workflow.value.find(x=>String(x.request_id)===String(requestId));if(row)row.unread_updates=0;}}}else store.state.msg=r.message||r.error||(r.ok?'تعذر عرض الطلب لأن استجابة السيرفر غير مكتملة':'');}
6792      function openWorkflow(x){if(!x)return;if(x.kind==='order')open({id:x.order_id||x.id});else router.push('/procurement?request='+encodeURIComponent(x.request_id||x.id));}
6793      async function load(){if(!(await store.requireMember(router,'/orders')))return;const r=await runBusyAction(store,'member-orders.load',()=>api('/api/member/orders'));orders.value=safeArray(r.orders);workflow.value=safeArray(r.workflow_items);summary.value=Object.assign({total:0,needs_action:0,in_progress:0,quoted:0,confirmed:0,completed:0,unread:0},r.summary||{});store.state.memberWorkflowSummary=summary.value;const requested=String(route.query.order||'');if(requested){const row=orders.value.find(x=>String(x.id)===requested)||{id:requested};await open(row);}}
6794      function closeDetail(){detail.value=null;router.push('/orders').catch(()=>{});}
6795      onMounted(load);
6796      return{store,orders,workflow,summary,filter,visibleItems,detail,nextAction,commercialSnapshot,load,open,openWorkflow,closeDetail,progress,memberNeedsAction,memberWorkflowDone,workflowStatus,workflowKind,workflowAction,workflowAmount,workflowUpdated,customerOrderStatusLabel,customerOrderPaymentLabel,purchaseModeLabel,procurementDocumentLabel,procurementServiceLabel,procurementMoney,procurementCurrencyLabel,procurementPricingLabel,procurementQuoteUnitLabel,procurementIncotermLabel,procurementShippingLabel,procurementContainerLabel,orderMilestoneLabel,orderEvidenceLabel,orderVisibilityLabel,shortDate,safeArray,adminRecordUpdatedAt,adminQueueOwner,orderQueueNextAction};
6797    },
6798    render:(function(){
6799const _Vue = Vue
6800const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
6801
6802const _hoisted_1 = { class: "memberOrdersCommand" }
6803const _hoisted_2 = ["onClick"]
6804const _hoisted_3 = ["onClick"]
6805const _hoisted_4 = {
6806  class: "memberOrderFilterRail",
6807  "aria-label": "تصنيف الطلبات"
6808}
6809const _hoisted_5 = ["onClick"]
6810const _hoisted_6 = ["onClick"]
6811const _hoisted_7 = ["onClick"]
6812const _hoisted_8 = ["onClick"]
6813const _hoisted_9 = ["onClick"]
6814const _hoisted_10 = ["onClick"]
6815const _hoisted_11 = { class: "memberWorkflowList" }
6816const _hoisted_12 = ["onClick"]
6817const _hoisted_13 = { class: "memberWorkflowCardTop" }
6818const _hoisted_14 = { class: "workflowType" }
6819const _hoisted_15 = {
6820  key: 0,
6821  class: "workflowUnread"
6822}
6823const _hoisted_16 = { class: "workflowState" }
6824const _hoisted_17 = { class: "memberWorkflowIdentity" }
6825const _hoisted_18 = { class: "codeToken" }
6826const _hoisted_19 = { class: "memberWorkflowAction" }
6827const _hoisted_20 = { key: 0 }
6828const _hoisted_21 = {
6829  key: 0,
6830  class: "card emptyCard memberWorkflowEmpty"
6831}
6832const _hoisted_22 = { class: "hint" }
6833const _hoisted_23 = ["onClick"]
6834const _hoisted_24 = {
6835  key: 1,
6836  class: "card customerOrderDetail operationsOrderWorkspace"
6837}
6838const _hoisted_25 = { class: "memberDetailBack" }
6839const _hoisted_26 = ["onClick"]
6840const _hoisted_27 = { class: "memberCardTop" }
6841const _hoisted_28 = { class: "codeToken orderCode" }
6842const _hoisted_29 = { class: "codeToken requestCode" }
6843const _hoisted_30 = { class: "statusPill" }
6844const _hoisted_31 = { class: "orderProgress" }
6845const _hoisted_32 = {
6846  key: 0,
6847  class: "warningBox"
6848}
6849const _hoisted_33 = { class: "orderMoneyCard commercialOrderSnapshot" }
6850const _hoisted_34 = { class: "orderGrandTotal" }
6851const _hoisted_35 = { class: "offerBreakdown commercialMoneySummary" }
6852const _hoisted_36 = { key: 0 }
6853const _hoisted_37 = { class: "infoGrid orderSnapshotGrid" }
6854const _hoisted_38 = {
6855  key: 1,
6856  class: "commercialSnapshotCard commercialAcceptedSnapshot"
6857}
6858const _hoisted_39 = { class: "commercialDecisionHighlights acceptedCommercialHighlights" }
6859const _hoisted_40 = { key: 0 }
6860const _hoisted_41 = { key: 1 }
6861const _hoisted_42 = { class: "commercialDisclosure" }
6862const _hoisted_43 = { class: "commercialDisclosureBody commercialQuoteGrid" }
6863const _hoisted_44 = { key: 0 }
6864const _hoisted_45 = { key: 1 }
6865const _hoisted_46 = { key: 2 }
6866const _hoisted_47 = { key: 3 }
6867const _hoisted_48 = { key: 4 }
6868const _hoisted_49 = { key: 5 }
6869const _hoisted_50 = { key: 6 }
6870const _hoisted_51 = { key: 7 }
6871const _hoisted_52 = { key: 8 }
6872const _hoisted_53 = { key: 9 }
6873const _hoisted_54 = { key: 10 }
6874const _hoisted_55 = { key: 11 }
6875const _hoisted_56 = { key: 12 }
6876const _hoisted_57 = { key: 13 }
6877const _hoisted_58 = {
6878  key: 14,
6879  class: "commercialWide"
6880}
6881const _hoisted_59 = {
6882  key: 2,
6883  class: "collapseSection",
6884  open: ""
6885}
6886const _hoisted_60 = { class: "collapseBody" }
6887const _hoisted_61 = ["href"]
6888const _hoisted_62 = { class: "orderTimeline orderEvidenceTimeline" }
6889const _hoisted_63 = { class: "orderTimelineBody" }
6890const _hoisted_64 = { class: "orderTimelineTitle" }
6891const _hoisted_65 = {
6892  key: 0,
6893  class: "evidenceBadge"
6894}
6895const _hoisted_66 = {
6896  key: 0,
6897  class: "orderEvidenceGrid"
6898}
6899const _hoisted_67 = ["href"]
6900const _hoisted_68 = ["src"]
6901const _hoisted_69 = ["src"]
6902const _hoisted_70 = {
6903  key: 2,
6904  class: "orderEvidenceIcon"
6905}
6906const _hoisted_71 = ["onClick"]
6907
6908return function render(_ctx, _cache) {
6909  with (_ctx) {
6910    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, normalizeClass: _normalizeClass, renderList: _renderList, Fragment: _Fragment, createTextVNode: _createTextVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
6911
6912    const _component_PublicFrame = _resolveComponent("PublicFrame")
6913
6914    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "طلباتي" }, {
6915      default: _withCtx(() => [
6916        _createElementVNode("section", _hoisted_1, [_cache[0] || (_cache[0] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "كل رحلة التوريد"), _createElementVNode("h2", null, "طلباتي"), _createElementVNode("p", null, "من أول طلبك وحتى العرض والشراء والشحن — سجل واحد واضح لا يختفي بين المراحل.")], -1)), _createElementVNode("button", {
6917          class: "btn memberOrderCreate",
6918          onClick: $event => ($router.push('/procurement/new'))
6919        }, "+ طلب جديد", 8, _hoisted_2)]),
6920        (store.state.memberUnread)
6921          ? (_openBlock(), _createElementBlock("section", {
6922              key: 0,
6923              class: "memberOpsNotice",
6924              onClick: $event => ($router.push('/notifications'))
6925            }, [_createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(store.state.memberUnread) + " إشعار يحتاج مراجعتك", 1), _cache[1] || (_cache[1] = _createElementVNode("span", null, "افتح التحديث ثم ارجع للطلب مباشرة.", -1))]), _cache[2] || (_cache[2] = _createElementVNode("strong", null, "الإشعارات ←", -1))], 8, _hoisted_3))
6926          : _createCommentVNode("", true),
6927        _createElementVNode("section", _hoisted_4, [
6928          _createElementVNode("button", {
6929            onClick: $event => (filter='all'),
6930            class: _normalizeClass({active:filter==='all'})
6931          }, [_createElementVNode("b", null, _toDisplayString(summary.total), 1), _cache[3] || (_cache[3] = _createElementVNode("span", null, "الكل", -1))], 10, _hoisted_5),
6932          _createElementVNode("button", {
6933            onClick: $event => (filter='action'),
6934            class: _normalizeClass({active:filter==='action',attention:summary.needs_action})
6935          }, [_createElementVNode("b", null, _toDisplayString(summary.needs_action), 1), _cache[4] || (_cache[4] = _createElementVNode("span", null, "مطلوب مني", -1))], 10, _hoisted_6),
6936          _createElementVNode("button", {
6937            onClick: $event => (filter='active'),
6938            class: _normalizeClass({active:filter==='active'})
6939          }, [_createElementVNode("b", null, _toDisplayString(summary.in_progress), 1), _cache[5] || (_cache[5] = _createElementVNode("span", null, "قيد المتابعة", -1))], 10, _hoisted_7),
6940          _createElementVNode("button", {
6941            onClick: $event => (filter='quotes'),
6942            class: _normalizeClass({active:filter==='quotes'})
6943          }, [_createElementVNode("b", null, _toDisplayString(summary.quoted||0), 1), _cache[6] || (_cache[6] = _createElementVNode("span", null, "عروض السعر", -1))], 10, _hoisted_8),
6944          _createElementVNode("button", {
6945            onClick: $event => (filter='confirmed'),
6946            class: _normalizeClass({active:filter==='confirmed'})
6947          }, [_createElementVNode("b", null, _toDisplayString(summary.confirmed), 1), _cache[7] || (_cache[7] = _createElementVNode("span", null, "مؤكدة", -1))], 10, _hoisted_9),
6948          _createElementVNode("button", {
6949            onClick: $event => (filter='completed'),
6950            class: _normalizeClass({active:filter==='completed'})
6951          }, [_createElementVNode("b", null, _toDisplayString(summary.completed), 1), _cache[8] || (_cache[8] = _createElementVNode("span", null, "مكتملة", -1))], 10, _hoisted_10)
6952        ]),
6953        _createElementVNode("section", _hoisted_11, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(visibleItems, (x) => {
6954          return (_openBlock(), _createElementBlock("button", {
6955            class: _normalizeClass(["memberWorkflowCard", {needsAction:memberNeedsAction(x),done:memberWorkflowDone(x)}]),
6956            key: x.kind+'-'+x.id,
6957            onClick: $event => (openWorkflow(x))
6958          }, [_createElementVNode("div", _hoisted_13, [_createElementVNode("span", _hoisted_14, _toDisplayString(workflowKind(x)), 1), (x.unread_updates)
6959            ? (_openBlock(), _createElementBlock("span", _hoisted_15, _toDisplayString(x.unread_updates) + " جديد", 1))
6960            : _createCommentVNode("", true), _createElementVNode("span", _hoisted_16, _toDisplayString(workflowStatus(x)), 1)]), _createElementVNode("div", _hoisted_17, [_createElementVNode("span", _hoisted_18, _toDisplayString(x.order_code||x.request_code), 1), _createElementVNode("h3", null, _toDisplayString(x.title), 1), _createElementVNode("small", null, _toDisplayString(procurementServiceLabel(x.service_type)) + " · آخر تحديث " + _toDisplayString(workflowUpdated(x)), 1)]), _createElementVNode("div", _hoisted_19, [
6961            _cache[9] || (_cache[9] = _createElementVNode("small", null, "المطلوب الآن", -1)),
6962            _createElementVNode("span", null, _toDisplayString(workflowAction(x)), 1),
6963            (workflowAmount(x))
6964              ? (_openBlock(), _createElementBlock("b", _hoisted_20, _toDisplayString(workflowAmount(x)), 1))
6965              : _createCommentVNode("", true),
6966            _cache[10] || (_cache[10] = _createElementVNode("strong", null, "فتح التفاصيل ←", -1))
6967          ])], 10, _hoisted_12))
6968        }), 128)), (!visibleItems.length&&!store.state.busy)
6969          ? (_openBlock(), _createElementBlock("div", _hoisted_21, [_createElementVNode("b", null, _toDisplayString(workflow.length?'لا توجد طلبات في هذا التصنيف':'لا توجد طلبات حتى الآن'), 1), _createElementVNode("p", _hoisted_22, _toDisplayString(workflow.length?'جرّب تصنيفاً آخر.':'ابدأ بطلب عرض أو خدمة توريد، وسيظهر هنا فور الإرسال.'), 1), (!workflow.length)
6970              ? (_openBlock(), _createElementBlock("button", {
6971                  key: 0,
6972                  class: "btn",
6973                  onClick: $event => ($router.push('/procurement/new'))
6974                }, "إنشاء أول طلب", 8, _hoisted_23))
6975              : _createCommentVNode("", true)]))
6976          : _createCommentVNode("", true)]),
6977        detail
6978          ? (_openBlock(), _createElementBlock("section", _hoisted_24, [
6979              _createElementVNode("div", _hoisted_25, [_createElementVNode("button", {
6980                class: "smallbtn secondary",
6981                onClick: closeDetail
6982              }, "← العودة لكل الطلبات", 8, _hoisted_26)]),
6983              _createElementVNode("div", _hoisted_27, [_createElementVNode("div", null, [_createElementVNode("span", _hoisted_28, _toDisplayString(detail.order.order_code), 1), _createElementVNode("h3", null, _toDisplayString(detail.order.title_snapshot), 1), _createElementVNode("span", _hoisted_29, _toDisplayString(detail.order.request_code), 1)]), _createElementVNode("span", _hoisted_30, _toDisplayString(customerOrderStatusLabel(detail.order.status)), 1)]),
6984              _createElementVNode("section", { class: _normalizeClass('workflowActionCard '+nextAction.tone) }, [
6985                _cache[11] || (_cache[11] = _createElementVNode("span", { class: "workflowActionKicker" }, "الإجراء الحالي", -1)),
6986                _createElementVNode("h3", null, _toDisplayString(nextAction.title), 1),
6987                _createElementVNode("b", null, "الدور الآن: " + _toDisplayString(nextAction.owner), 1),
6988                _createElementVNode("p", null, _toDisplayString(nextAction.note), 1)
6989              ], 2),
6990              _createElementVNode("div", _hoisted_31, [_createElementVNode("span", { class: _normalizeClass({done:progress(detail.order.status)>=1}) }, _cache[12] || (_cache[12] = [_createElementVNode("i", null, "1", -1), _createElementVNode("b", null, "طلب مؤكد", -1)]), 2), _createElementVNode("span", { class: _normalizeClass({done:progress(detail.order.status)>=2}) }, _cache[13] || (_cache[13] = [_createElementVNode("i", null, "2", -1), _createElementVNode("b", null, "الشراء والتوريد", -1)]), 2), _createElementVNode("span", { class: _normalizeClass({done:progress(detail.order.status)>=3}) }, _cache[14] || (_cache[14] = [_createElementVNode("i", null, "3", -1), _createElementVNode("b", null, "مكتمل", -1)]), 2)]),
6991              (detail.order.status==='cancelled')
6992                ? (_openBlock(), _createElementBlock("div", _hoisted_32, "تم إلغاء هذا الطلب. راجع السجل الزمني أدناه لمعرفة آخر إجراء."))
6993                : _createCommentVNode("", true),
6994              _createElementVNode("section", _hoisted_33, [_createElementVNode("div", _hoisted_34, [_cache[15] || (_cache[15] = _createElementVNode("span", null, "الإجمالي المعتمد", -1)), _createElementVNode("b", null, _toDisplayString(procurementMoney(detail.order.total_amount,detail.order.currency)), 1)]), _createElementVNode("div", _hoisted_35, [
6995                _createElementVNode("span", null, [_cache[16] || (_cache[16] = _createElementVNode("small", null, "قيمة المنتجات / الخدمة", -1)), _createElementVNode("b", null, _toDisplayString(procurementMoney(detail.order.subtotal_amount,detail.order.currency)), 1)]),
6996                _createElementVNode("span", null, [_createElementVNode("small", null, "رسوم الخدمة " + _toDisplayString(Number(detail.order.commercial_model_version||
69961)>=2?'('+Number(detail.order.service_fee_percent||0)+'%)':''), 1), _createElementVNode("b", null, _toDisplayString(procurementMoney(detail.order.service_fee_amount,detail.order.currency)), 1)]),
6997                _createElementVNode("span", null, [_cache[17] || (_cache[17] = _createElementVNode("small", null, "الشحن", -1)), _createElementVNode("b", null, _toDisplayString(procurementMoney(detail.order.shipping_amount,detail.order.currency)), 1)]),
6998                (Number(detail.order.insurance_amount||0)>0)
6999                  ? (_openBlock(), _createElementBlock("span", _hoisted_36, [_cache[18] || (_cache[18] = _createElementVNode("small", null, "التأمين", -1)), _createElementVNode("b", null, _toDisplayString(procurementMoney(detail.order.insurance_amount,detail.order.currency)), 1)]))
7000                  : _createCommentVNode("", true),
7001                _createElementVNode("span", null, [_cache[19] || (_cache[19] = _createElementVNode("small", null, "الخصم", -1)), _createElementVNode("b", null, _toDisplayString(procurementMoney(detail.order.discount_amount,detail.order.currency)), 1)])
7002              ])]),
7003              _createElementVNode("div", _hoisted_37, [
7004                _createElementVNode("p", null, [_cache[20] || (_cache[20] = _createElementVNode("b", null, "طريقة الشراء:", -1)), _createTextVNode(" " + _toDisplayString(purchaseModeLabel(detail.order.purchase_mode)), 1)]),
7005                _createElementVNode("p", null, [_cache[21] || (_cache[21] = _createElementVNode("b", null, "الدفع:", -1)), _createTextVNode(" " + _toDisplayString(customerOrderPaymentLabel(detail.order.payment_status)), 1)]),
7006                _createElementVNode("p", null, [_cache[22] || (_cache[22] = _createElementVNode("b", null, "العملة:", -1)), _createTextVNode(" " + _toDisplayString(procurementCurrencyLabel(detail.order.currency)), 1)]),
7007                _createElementVNode("p", null, [_cache[23] || (_cache[23] = _createElementVNode("b", null, "المورد:", -1)), _createTextVNode(" " + _toDisplayString(detail.order.supplier_snapshot||'-'), 1)]),
7008                _createElementVNode("p", null, [_cache[24] || (_cache[24] = _createElementVNode("b", null, "Proforma:", -1)), _createTextVNode(" " + _toDisplayString(detail.order.proforma_snapshot||'-'), 1)]),
7009                _createElementVNode("p", null, [_cache[25] || (_cache[25] = _createElementVNode("b", null, "شروط العرض:", -1)), _cache[26] || (_cache[26] = _createElementVNode("br", null, null, -1)), _createTextVNode(_toDisplayString(detail.order.offer_terms_snapshot), 1)]),
7010                _createElementVNode("p", null, [_cache[27] || (_cache[27] = _createElementVNode("b", null, "شروط التسليم:", -1)), _cache[28] || (_cache[28] = _createElementVNode("br", null, null, -1)), _createTextVNode(_toDisplayString(detail.order.delivery_terms_snapshot), 1)])
7011              ]),
7012              (Number(detail.order.commercial_model_version||1)>=2)
7013                ? (_openBlock(), _createElementBlock("section", _hoisted_38, [_cache[52] || (_cache[52] = _createElementVNode("div", { class: "memberSectionHead" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "النسخة المعتمدة"), _createElementVNode("h3", null, "الشحن والتسليم"), _createElementVNode("p", { class: "hint" }, "هذه البيانات محفوظة مع العرض المقبول ولا تتغير لاحقاً.")])], -1)), _createElementVNode("div", _hoisted_39, [
7014                    _createElementVNode("span", null, [_cache[29] || (_cache[29] = _createElementVNode("small", null, "Incoterm", -1)), _createElementVNode("b", null, _toDisplayString(commercialSnapshot.incoterm?procurementIncotermLabel(commercialSnapshot.incoterm):'-'), 1)]),
7015                    _createElementVNode("span", null, [_cache[30] || (_cache[30] = _createElementVNode("small", null, "الشحن", -1)), _createElementVNode("b", null, _toDisplayString(procurementShippingLabel(commercialSnapshot.shipping_mode)), 1)]),
7016                    (Number(commercialSnapshot.total_cbm||0))
7017                      ? (_openBlock(), _createElementBlock("span", _hoisted_40, [_
7017cache[31] || (_cache[31] = _createElementVNode("small", null, "الحجم", -1)), _createElementVNode("b", null, _toDisplayString(commercialSnapshot.total_cbm) + " CBM", 1)]))
7018                      : _createCommentVNode("", true),
7019                    (Number(commercialSnapshot.gross_weight_kg||0))
7020                      ? (_openBlock(), _createElementBlock("span", _hoisted_41, [_cache[32] || (_cache[32] = _createElementVNode("small", null, "Gross", -1)), _createElementVNode("b", null, _toDisplayString(commercialSnapshot.gross_weight_kg) + " kg", 1)]))
7021                      : _createCommentVNode("", true)
7022                  ]), _createElementVNode("details", _hoisted_42, [_cache[51] || (_cache[51] = _createElementVNode("summary", null, [_createElementVNode("span", null, "كل تفاصيل النسخة اللوجستية"), _createElementVNode("strong", null, "عرض")], -1)), _createElementVNode("div", _hoisted_43, [
7023                    _createElementVNode("p", null, [_cache[33] || (_cache[33] = _createElementVNode("b", null, "التسعير:", -1)), _createTextVNode(" " + _toDisplayString(procurementPricingLabel(commercialSnapshot.pricing_mode)), 1)]),
7024                    (commercialSnapshot.pricing_mode==='unit')
7025                      ? (_openBlock(), _createElementBlock("p", _hoisted_44, [_cache[34] || (_cache[34] = _createElementVNode("b", null, "الكمية:", -1)), _createTextVNode(" " + _toDisplayString(commercialSnapshot.quote_quantity) + " " + _toDisplayString(procurementQuoteUnitLabel(commercialSnapshot.quote_unit)), 1)]))
7026                      : _createCommentVNode("", true),
7027                    (commercialSnapshot.pricing_mode==='unit')
7028                      ? (_openBlock(), _createElementBlock("p", _hoisted_45, [_cache[35] || (_cache[35] = _createElementVNode("b", null, "سعر الوحدة:", -1)), _createTextVNode(" " + _toDisplayString(procurementMoney(commercialSnapshot.unit_price,detail.order.currency)), 1)]))
7029                      : _createCommentVNode("", true),
7030                    _createElementVNode("p", null, [_cache[36] || (_cache[36] = _createElementVNode("b", null, "Incoterm:", -1)), _createTextVNode(" " + _toDisplayString(commercialSnapshot.incoterm?procurementIncotermLabel(commercialSnapshot.incoterm):'-'), 1)]),
7031                    _createElementVNode("p", null, [_cache[37] || (_cache[37] = _createElementVNode("b", null, "نوع الشحن:", -1)), _createTextVNode(" " + _toDisplayString(procurementShippingLabel(commercialSnapshot.shipping_mode)), 1)]),
7032                    (commercialSnapshot.container_type)
7033                      ? (_openBlock(), _createElementBlock("p", _hoisted_46, [_cache[38] || (_cache[38] = _createElementVNode("b", null, "الحاوية:", -1)), _createTextVNode(" " + _toDisplayString(procurementContainerLabel(commercialSnapshot.container_type)), 1)]))
7034                      : _createCommentVNode("", true),
7035                    (Number(commercialSnapshot.gross_weight_kg||0))
7036                      ? (_openBlock(), _createElementBlock("p", _hoisted_47, [_cache[39] || (_cache[39] = _createElementVNode("b", null, "الوزن الإجمالي:", -1)), _createTextVNode(" " + _toDisplayString(commercialSnapshot.gross_weight_kg) + " كجم", 1)]))
7037                      : _createCommentVNode("", true),
7038                    (Number(commercialSnapshot.net_weight_kg||0))
7039                      ? (_openBlock(), _createElementBlock("p", _hoisted_48, [_cache[40] || (_cache[40] = _createElementVNode("b", null, "الوزن الصافي:", -1)), _createTextVNode(" " + _toDisplayString(commercialSnapshot.net_weight_kg) + " كجم", 1)]))
7040                      : _createCommentVNode("", true),
7041                    (Number(commercialSnapshot.total_cbm||0))
7042                      ? (_openBlock(), _createElementBlock("p", _hoisted_49, [_cache[41] || (_cache[41] = _createElementVNode("b", null, "الحجم:", -1)), _createTextVNode(" " + _toDisplayString(commercialSnapshot.total_cbm) + " CBM", 1)]))
7043                      : _createCommentVNode("", true),
7044                    (Number(commercialSnapshot.packages_count||0))
7045                      ? (_openBlock(), _createElementBlock("p", _hoisted_50, [_cache[42] || (_cache[42] = _createElementVNode("b", null, "الطرود:", -1)), _createTextVNode(" " + _toDisplayString(commercialSnapshot.packages_count), 1)]))
7046                      : _createCommentVNode("", true),
7047                    (commercialSnapshot.origin_country||commercialSnapshot.origin_city)
7048                      ? (_openBlock(), _createElementBlock("p", _hoisted_51, [_cache[43] || (_cache[43] = _createElementVNode("b", null, "المنشأ:", -1)), _createTextVNode(" " + _toDisplayString([$cityLabel(commercialSnapshot.origin_city),commercialSnapshot.origin_country].filter(
7048Boolean).join(' — ')), 1)]))
7049                      : _createCommentVNode("", true),
7050                    (commercialSnapshot.loading_point)
7051                      ? (_openBlock(), _createElementBlock("p", _hoisted_52, [_cache[44] || (_cache[44] = _createElementVNode("b", null, "نقطة التحميل:", -1)), _createTextVNode(" " + _toDisplayString(commercialSnapshot.loading_point), 1)]))
7052                      : _createCommentVNode("", true),
7053                    (commercialSnapshot.destination_country||commercialSnapshot.destination_city)
7054                      ? (_openBlock(), _createElementBlock("p", _hoisted_53, [_cache[45] || (_cache[45] = _createElementVNode("b", null, "الوجهة:", -1)), _createTextVNode(" " + _toDisplayString([$cityLabel(commercialSnapshot.destination_city),commercialSnapshot.destination_country].filter(Boolean).join(' — ')), 1)]))
7055                      : _createCommentVNode("", true),
7056                    (commercialSnapshot.destination_point)
7057                      ? (_openBlock(), _createElementBlock("p", _hoisted_54, [_cache[46] || (_cache[46] = _createElementVNode("b", null, "نقطة الوصول:", -1)), _createTextVNode(" " + _toDisplayString(commercialSnapshot.destination_point), 1)]))
7058                      : _createCommentVNode("", true),
7059                    (Number(commercialSnapshot.production_lead_days||0))
7060                      ? (_openBlock(), _createElementBlock("p", _hoisted_55, [_cache[47] || (_cache[47] = _createElementVNode("b", null, "التجهيز/الإنتاج:", -1)), _createTextVNode(" " + _toDisplayString(commercialSnapshot.production_lead_days) + " يوم", 1)]))
7061                      : _createCommentVNode("", true),
7062                    (Number(commercialSnapshot.transit_days||0))
7063                      ? (_openBlock(), _createElementBlock("p", _hoisted_56, [_cache[48] || (_cache[48] = _createElementVNode("b", null, "زمن الشحن:", -1)), _createTextVNode(" " + _toDisplayString(commercialSnapshot.transit_days) + " يوم", 1)]))
7064                      : _createCommentVNode("", true),
7065                    (commercialSnapshot.hs_code)
7066                      ? (_openBlock(), _createElementBlock("p", _hoisted_57, [_cache[49] || (_cache[49] = _createElementVNode("b", null, "HS Code:", -1)), _createTextVNode(" " + _toDisplayString(commercialSnapshot.hs_code), 1)]))
7067                      : _createCommentVNode("", true),
7068                    (commercialSnapshot.packing_notes)
7069                      ? (_openBlock(), _createElementBlock("p", _hoisted_58, [_cache[50] || (_cache[50] = _createElementVNode("b", null, "التعبئة:", -1)), _createTextVNode(" " + _toDisplayString(commercialSnapshot.packing_notes), 1)]))
7070                      : _createCommentVNode("", true)
7071                  ])])]))
7072                : _createCommentVNode("", true),
7073              (safeArray(detail.order.quote_document_snapshot).length)
7074                ? (_openBlock(), _createElementBlock("details", _hoisted_59, [_createElementVNode("summary", null, [_cache[53] || (_cache[53] = _createElementVNode("b", null, "مستندات العرض المقبول", -1)), _createElementVNode("span", null, _toDisplayString(safeArray(detail.order.quote_document_snapshot).length), 1)]), _createElementVNode("div", _hoisted_60, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(safeArray(detail.order.quote_document_snapshot), (d) => {
7075                    return (_openBlock(), _createElementBlock("div", {
7076                      class: "relatedItem",
7077                      key: d.id||d.file_url
7078                    }, [_createElementVNode("b", null, _toDisplayString(procurementDocumentLabel(d.document_type)), 1
7078), _createElementVNode("span", null, _toDisplayString(d.original_name), 1), _createElementVNode("a", {
7079                      class: "smallbtn secondary",
7080                      href: d.file_url,
7081                      target: "_blank",
7082                      rel: "noopener"
7083                    }, "فتح المستند", 8, _hoisted_61)]))
7084                  }), 128))])]))
7085                : _createCommentVNode("", true),
7086              _createElementVNode("section", _hoisted_62, [_cache[55] || (_cache[55] = _createElementVNode("h3", null, "تحديثات التنفيذ", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(safeArray(detail.timeline).length?safeArray(detail.timeline):safeArray(detail.events), (e) => {
7087                return (_openBlock(), _createElementBlock("div", {
7088                  class: "orderTimelineItem",
7089                  key: e.id
7090                }, [_cache[54] || (_cache[54] = _createElementVNode("i", null, null, -1)), _createElementVNode("div", _hoisted_63, [
7091                  _createElementVNode("div", _hoisted_64, [_createElementVNode("b", null, _toDisplayString(e.title), 1), (e.source==='milestone')
7092                    ? (_openBlock(), _createElementBlock("span", _hoisted_65, _toDisplayString(orderMilestoneLabel(e.milestone_type)), 1))
7093                    : _createCommentVNode("", true)]),
7094                  _createElementVNode("p", null, _toDisplayString(e.body||customerOrderStatusLabel(e.to_status)), 1),
7095                  _createElementVNode("small", null, _toDisplayString(shortDate(e.occurred_at||e.created_at)), 1),
7096                  (safeArray(e.evidence).length)
7097                    ? (_openBlock(), _createElementBlock("div", _hoisted_66, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(safeArray(e.evidence), (x) => {
7098                        return (_openBlock(), _createElementBlock("a", {
7099                          key: x.id,
7100                          class: "orderEvidenceCard",
7101                          href: x.file_url,
7102                          target: "_blank",
7103                          rel: "noopener"
7104                        }, [(x.kind==='image')
7105                          ? (_openBlock(), _createElementBlock("img", {
7106                              key: 0,
7107                              src: x.thumb_url||x.file_url,
7108                              loading: "lazy",
7109                              alt: ""
7110                            }, null, 8, _hoisted_68))
7111                          : (x.kind==='video'&&x.thumb_url)
7112                            ? (_openBlock(), _createElementBlock("img", {
7113                                key: 1,
7114                                src: x.thumb_url,
7115                                loading: "lazy",
7116                                alt: ""
7117                              }, null, 8, _hoisted_69))
7118                            : (_openBlock(), _createElementBlock("span", _hoisted_70, _toDisplayString(x.kind==='video'?'▶':'PDF'), 1)), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(orderEvidenceLabel(x.evidence_type)), 1), _createElementVNode("small", null, _toDisplayString(x.original_name), 1)])], 8, _hoisted_67))
7119                      }), 128))]))
7120                    : _createCommentVNode("", true)
7121                ])]))
7122              }), 128))]),
7123              _createElementVNode("button", {
7124                class: "smallbtn secondary",
7125                onClick: $event => ($router.push('/procurement?request='+detail.order.procurement_request_id))
7126              }, "فتح ملف التوريد والمستندات", 8, _hoisted_71)
7127            ]))
7128          : _createCommentVNode("", true)
7129      ]),
7130      _: 1
7131    }))
7132  }
7133}
7134})()
7135  };
7136
7137  const AdminParticipationPointsPage={
7138    components:{AdminFrame},
7139    setup(){
7140      const store=useGzcStore();const router=useRouter();const route=useRoute();
7141      const members=ref([]),stats=ref({}),policy=ref({}),search=ref(''),detail=ref(null),localBusy=ref(false);
7142      const form=reactive({operation:'credit',amount:'',reason:'',idempotency_key:''});
7143      const selectedId=computed(()=>String(route.params&&route.params.id||''));
7144      function freshKey(){try{return 'cp-'+crypto.randomUUID()}catch(e){return 'cp-'+Date.now()+'-'+Math.random().toString(36).slice(2)}}
7145      function resetForm(){form.operation='credit';form.amount='';form.reason='';form.idempotency_key=freshKey();}
7146      function entryTypeLabel(v){return ({reward:'مكافأة تلقائية',admin_credit:'إضافة إدارية',admin_debit:'خصم إداري',migration:'ترحيل سابق'}[String(v||'')])||String(v||'-');}
7147      async function loadList(){localBusy.value=true;const r=await api('/api/admin/participation-points?search='+encodeURIComponent(search.value||'')+'&limit=100');if(r.status===401){localBusy.value=false;return router.replace('/admin/login')}if(r.status===403){store.state.msg=r.message||'غير مصرح';localBusy.value=false;return router.replace('/admin')}members.value=safeArray(r.members);stats.value=r.stats||{};policy.value=r.policy||{};localBusy.value=false;}
7148      async function loadDetail(){if(!selectedId.value){detail.value=null;return;}localBusy.value=true;const r=await api('/api/admin/participation-points/'+encodeURIComponent(selectedId.value));if(r.status===401){localBusy.value=false;return router.replace('/admin/login')}if(!r.ok){store.state.msg=r.message||'تعذر تحميل سجل النقاط';detail.value=null;localBusy.value=false;return;}detail.value=r;policy.value=r.policy||policy.value;localBusy.value=false;}
7149      async function openMember(m){await router.push('/admin/participation-points/'+encodeURIComponent(m.id));}
7150      async function back(){await router.push('/admin/participation-points');}
7151      async function adjust(){
7152        if(!detail.value||!detail.value.member)return;const amount=Number(form.amount||0);if(!Number.isInteger(amount)||amount<=0){store.state.msg='اكتب عدد نقاط صحيحاً أكبر من صفر';return;}if(String(form.reason||'').trim().length<3){store.state.msg='اكتب سبباً واضحاً للعملية';return;}
7153        const action=form.operation==='credit'?'إضافة':'خصم';if(!window.confirm(action+' '+amount+' نقطة للعضو '+(detail.value.member.full_name||'')+'؟\nسيتم إنشاء حركة جديدة في سجل نقاط المشاركة ولن يتم تعديل الإجمالي مباشرة.'))return;
7154        localBusy.value=true;const r=await api('/api/admin/participation-points/'+encodeURIComponent(detail.value.member.id)+'/adjust',{method:'POST',body:JSON.stringify({operation:form.operation,amount,reason:String(form.reason||'').trim(),idempotency_key:form.idempotency_key||freshKey()})});localBusy.value=false;store.state.msg=r.message||'';if(r.ok){resetForm();await Promise.all([loadDetail(),loadList()]);}
7155      }
7156      watch(()=>route.params&&route.params.id,()=>{resetForm();loadDetail();});
7157      onMounted(async()=>
7157{if(!(await store.requireAdmin(router)))return;resetForm();await loadList();await loadDetail();});
7158      return {store,members,stats,policy,search,detail,form,localBusy,selectedId,entryTypeLabel,loadList,openMember,back,adjust,shortDate};
7159    },
7160    render:(function(){
7161const _Vue = Vue
7162const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
7163
7164const _hoisted_1 = {
7165  key: 0,
7166  class: "participationPointsAdmin"
7167}
7168const _hoisted_2 = { class: "pointsAdminStats" }
7169const _hoisted_3 = { class: "card pointsSearchBar" }
7170const _hoisted_4 = ["onUpdate:modelValue", "onKeyup"]
7171const _hoisted_5 = ["onClick"]
7172const _hoisted_6 = { class: "pointsMemberList" }
7173const _hoisted_7 = ["onClick"]
7174const _hoisted_8 = {
7175  key: 0,
7176  class: "card emptyCard"
7177}
7178const _hoisted_9 = {
7179  key: 1,
7180  class: "participationPointsAdmin pointsRecordWorkspace"
7181}
7182const _hoisted_10 = ["onClick"]
7183const _hoisted_11 = { class: "card pointsBalanceHero" }
7184const _hoisted_12 = { class: "card pointsAdjustmentCard" }
7185const _hoisted_13 = ["onUpdate:modelValue"]
7186const _hoisted_14 = ["onUpdate:modelValue"]
7187const _hoisted_15 = ["onUpdate:modelValue"]
7188const _hoisted_16 = ["disabled", "onClick"]
7189const _hoisted_17 = { class: "card" }
7190const _hoisted_18 = { class: "adminSectionHead" }
7191const _hoisted_19 = { class: "pointsLedger" }
7192const _hoisted_20 = {
7193  key: 0,
7194  class: "adminEmptyState compact"
7195}
7196
7197return function render(_ctx, _cache) {
7198  with (_ctx) {
7199    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, vModelText: _vModelText, withKeys: _withKeys, withDirectives: _withDirectives, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, vModelSelect: _vModelSelect, createTextVNode: _createTextVNode, normalizeClass: _normalizeClass, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
7200
7201    const _component_AdminFrame = _resolveComponent("AdminFrame")
7202
7203    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "نقاط المشاركة" }, {
7204      default: _withCtx(() => [(!selectedId)
7205        ? (_openBlock(), _createElementBlock("section", _hoisted_1, [
7206            _cache[5] || (_cache[5] = _createElementVNode("section", { class: "card dashboardHeaderCard" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "Participation Points"), _createElementVNode("h3", null, "سجل نقاط المشاركة"), _createElementVNode("p", { class: "hint" }, "نقاط المشاركة نظام تقدير مجتمعي مستقل تماماً عن المحفظة. الإجمالي مشتق من سجل دائم غير قابل للتعديل المباشر.")])], -1)),
7207            _createElementVNode("section", _hoisted_2, [_createElementVNode("article", null, [_createElementVNode("b", null, _toDisplayString(stats.net_points||0), 1), _cache[0] || (_cache[0] = _createElementVNode("small", null, "صافي النقاط", -1))]), _createElementVNode("article", null, [_createElementVNode("b", null, _toDisplayString(stats.members_with_entries||0), 1), _cache[1] || (_cache[1] = _createElementVNode("small", null, "أعضاء لديهم حركات", -1))]), _createElementVNode("article", null, [_createElementVNode("b", null, _toDisplayString(stats.ledger_entries||0), 1), _cache[2] || (_cache[2] = _createElementVNode("small", null, "إجمالي الحركات", -1))])]),
7208            _createElementVNode("section", _hoisted_3, [_withDirectives(_createElementVNode("input", {
7209              "onUpdate:modelValue": $event => ((search) = $event),
7210              onKeyup: _withKeys(loadList, ["enter"]),
7211              placeholder: "ابحث بالاسم أو رقم العضوية أو واتساب"
7212            }, null, 40, _hoisted_4), [[_vModelText, search]]), _createElementVNode("button", {
7213              class: "smallbtn",
7214              onClick: loadList
7215            }, "بحث", 8, _hoisted_5)]),
7216            _createElementVNode("section", _hoisted_6, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(members, (m) => {
7217              return (_openBlock(), _createElementBlock("button", {
7218                key: m.id,
7219                class: "card pointsMemberRow",
7220                onClick: $event => (openMember(m))
7221              }, [_createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(m.full_name||'-'), 1), _createElementVNode("small", null, _toDisplayString(m.gzc_id||'-') + " · " + _toDisplayString(m.whatsapp||'-') + " · " + _toDisplayString($cityLabel(m.china_city)||'-'), 1)]), _createElementVNode("span", null, [_createElementVNode("strong", null, _toDisplayString(m.points_total||0), 1), _cache[3] || (_cache[3] = _createElementVNode("small", null, "نقطة", -1))]), _cache[4] || (_cache[4] = _createElementVNode("em", null, "فتح", -1))], 8, _hoisted_7))
7222            }), 128)), (!members.length&&!localBusy)
7223              ? (_openBlock(), _createElementBlock("div", _hoisted_8, "لا توجد نتائج."))
7224              : _createCommentVNode("", true)])
7225          ]))
7226        : (_openBlock(), _createElementBlock("section", _hoisted_9, [_createElementVNode("button", {
7227            class: "smallbtn secondary",
7228            onClick: back
7229          }, "← رجوع للقائمة", 8, _hoisted_10), (detail&&detail.member)
7230            ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [
7231                _createElementVNode("section", _hoisted_11, [_createElementVNode("div", null, [_cache[6] || (_cache[6] = _createElementVNode("span", { class: "vueBadge" }, "إجمالي نقاط المشاركة", -1)), _createElementVNode("h2", null, _toDisplayString(detail.points_total||0) + " نقطة", 1), _createElementVNode("p", null, _toDisplayString(detail.member.full_name) + " · " + _toDisplayString(detail.member.gzc_id||'-'), 1)]), _cache[7] || (_cache[7] = _
7231createElementVNode("span", null, "⭐", -1))]),
7232                _createElementVNode("section", _hoisted_12, [
7233                  _cache[12] || (_cache[12] = _createElementVNode("div", { class: "adminSectionHead" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "حركة جديدة"), _createElementVNode("h3", null, "إضافة أو خصم إداري")])], -1)),
7234                  _cache[13] || (_cache[13] = _createElementVNode("p", { class: "hint" }, "كل تعديل يُسجل كحركة جديدة. الخصم لا يمكن أن يجعل إجمالي نقاط المشاركة سالباً.", -1)),
7235                  _createElementVNode("label", null, [_cache[9] || (_cache[9] = _createTextVNode("نوع العملية")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((form.operation) = $event) }, _cache[8] || (_cache[8] = [_createElementVNode("option", { value: "credit" }, "إضافة نقاط", -1), _createElementVNode("option", { value: "debit" }, "خصم نقاط", -1)]), 8, _hoisted_13), [[_vModelSelect, form.operation]])]),
7236                  _createElementVNode("label", null, [_cache[10] || (_cache[10] = _createTextVNode("عدد النقاط")), _withDirectives(_createElementVNode("input", {
7237                    type: "number",
7238                    min: "1",
7239                    step: "1",
7240                    inputmode: "numeric",
7241                    "onUpdate:modelValue": $event => ((form.amount) = $event),
7242                    placeholder: "مثال: 50"
7243                  }, null, 8, _hoisted_14), [[_vModelText, form.amount]])]),
7244                  _createElementVNode("label", null, [_cache[11] || (_cache[11] = _createTextVNode("سبب العملية")), _withDirectives(_createElementVNode("textarea", {
7245                    "onUpdate:modelValue": $event => ((form.reason) = $event),
7246                    maxlength: "500",
7247                    placeholder: "سبب واضح يظهر في سجل التدقيق"
7248                  }, null, 8, _hoisted_15), [[_vModelText, form.reason]])]),
7249                  _createElementVNode("button", {
7250                    class: "btn",
7251                    disabled: localBusy,
7252                    onClick: adjust
7253                  }, "تسجيل الحركة", 8, _hoisted_16)
7254                ]),
7255                _createElementVNode("section", _hoisted_17, [_createElementVNode("div", _hoisted_18, [_cache[14] || (_cache[14] = _createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "Append-only Ledger"), _createElementVNode("h3", null, "سجل الحركات")], -1)), _createElementVNode("small", null, _toDisplayString(detail.entries||0) + " حركة", 1)]), _createElementVNode("div", _hoisted_19, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(detail.ledger, (x) => {
7256                  return (_openBlock(), _createElementBlock("article", {
7257                    key: x.id,
7258                    class: _normalizeClass(['pointsLedgerRow',Number(x.points_delta)>0?'credit':'debit'])
7259                  }, [_createElementVNode("span", null, _toDisplayString(Number(x.points_delta)>
72590?'+':'') + _toDisplayString(x.points_delta), 1), _createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(entryTypeLabel(x.entry_type)), 1), _createElementVNode("p", null, _toDisplayString(x.reason), 1), _createElementVNode("small", null, _toDisplayString(x.admin_name||'النظام') + " · " + _toDisplayString(shortDate(x.created_at)), 1)])], 2))
7260                }), 128)), (!detail.ledger.length)
7261                  ? (_openBlock(), _createElementBlock("div", _hoisted_20, _cache[15] || (_cache[15] = [_createElementVNode("b", null, "لا توجد حركات", -1)])))
7262                  : _createCommentVNode("", true)])]),
7263                _cache[16] || (_cache[16] = _createElementVNode("section", { class: "card pointsPolicyCard" }, [_createElementVNode("b", null, "حدود النظام"), _createElementVNode("p", null, "نقاط المشاركة نظام مجتمعي غير نقدي ومستقل عن SMT Wallet. لا شراء للنقاط، لا سحب نقدي أو بنكي، لا تحويل مالي، ولا قيمة ثابتة بعملة.")], -1))
7264              ], 64))
7265            : _createCommentVNode("", true)]))]),
7266      _: 1
7267    }))
7268  }
7269}
7270})()
7271  };
7272
7273  const AdminOrdersPage={
7274    components:{AdminFrame},
7275    setup(){
7276      const store=useGzcStore();const router=useRouter();const route=useRoute();const status=ref('all');const orders=ref([]);const counts=ref({});const detail=ref(null);const workspaceMode=computed(()=>!!route.params.id);const nextAction=computed(()=>customerOrderNextAction(detail.value,'admin'));const commercialSnapshot=computed(()=>procurementCommercialSnapshot(detail.value&&detail.value.order));
7277      const milestoneForm=reactive({milestone_type:'supplier_order',visibility:'member',title:'',body:''});const evidenceFile=ref(null);const evidenceMilestoneId=ref('');const evidenceType=ref('production_photo');const evidenceVisibility=ref('inherit');const evidenceFileLabel=computed(()=>evidenceFile.value?evidenceFile.value.name:'لم يتم اختيار ملف');
7278      async function open(order){const r=await runBusyAction(store,'admin-orders.open',()=>api('/api/admin/orders/'+encodeURIComponent(order.id)));const record=safeRecord(r.order);if(r.ok&&record&&record.id){r.order=record;detail.value=r;const target='/admin/orders/'+encodeURIComponent(order.id);if(route.path!==target)router.push(target).catch(()=>{});}else store.state.msg=r.message||r.error||(r.ok?'تعذر عرض الطلب لأن استجابة السيرفر غير مكتملة':'');}
7279      function closeDetail(){detail.value=null;router.push('/admin/orders').catch(()=>{});}
7280      async function load(){if(!(await store.requireAdmin(router)))return;store.state.busy=true;const r=await api('/api/admin/orders?status='+encodeURIComponent(status.value));store.state.busy=false;if(r.status===403){store.state.msg=r.message||'الصلاحية غير متاحة';router.push('/admin');return;}orders.value=safeArray(r.orders);counts.value=r.counts||{};const requested=String(route.params.id||route.query.order||'');if(requested){const row=orders.value.find(x=>String(x.id)===requested)||{id:requested};await open(row);}}
7281      async function createMilestone(){if(!detail.value)return;const title=String(milestoneForm.title||orderMilestoneLabel(milestoneForm.milestone_type)).trim();const r=await runBusyAction(store,'admin-orders.milestone-create',()=>api('/api/admin/orders/'+detail.value.order.id+'/milestones',{method:'POST',body:JSON.stringify({...milestoneForm,title})}));store.state.msg=r.message||r.error||'';if(r.ok){detail.value=r.order_payload||detail.value;evidenceMilestoneId.value=r.milestone&&r.milestone.id||'';milestoneForm.title='';milestoneForm.body='';}}
7282      function onEvidenceFile(e){evidenceFile.value=e.target.files&&e.target.files[0]?e.target.files[0]:null;if(evidenceFile.value){const n=String(evidenceFile.value.name||'').toLowerCase();if(/\.(mp4|mov|webm)$/.test(n))evidenceType.value='production_video';else if(/\.(jpe?g|png|webp)$/.test(n)&&evidenceType.value==='production_video')evidenceType.value='production_photo';}}
7283      async function uploadEvidence(){if(!detail.value||!evidenceMilestoneId.value||!evidenceFile.value){store.state.msg='اختر المرحلة وملف الدليل';return;}const fd=new FormData();fd.append('evidence_type',evidenceType.value);fd.append('visibility',evidenceVisibility.value);fd.append('file',evidenceFile.value);const r=await uploadApi('/api/admin/orders/'+detail.value.order.id+'/milestones/'+evidenceMilestoneId.value+'/evidence',{method:'POST',body:fd,headers:{Accept:'application/json'},uploadLabel:'رفع دليل مرحلة الطلب'});store.state.msg=r.message||r.error||'';if(r.ok){detail.value=r.order_payload||detail.value;evidenceFile.value=null;}}
7284      async function archiveMilestone(m){if(!detail.value||!m)return;const reason=String(window.prompt('سبب أرشفة المرحلة؟')||'').trim();if(!reason)return;const r=await api('/api/admin/orders/'+detail.value.order.id+'/milestones/'+m.id+'/archive',{method:'POST',body:JSON.stringify({reason})});store.state.msg=r.message||r.error||'';if(r.ok)detail.value=r.order_payload||detail.value;}
7285      async function archiveEvidence(x){if(!detail.value||!x)return;const reason=String(window.prompt('سبب أرشفة الدليل؟')||'').trim();if(!reason)return;const r=await api('/api/admin/orders/'+detail.value.order.id+'/evidence/'+x.id+'/archive',{method:'POST',body:JSON.stringify({reason})});store.state.msg=r.message||r.error||'';if(r.ok)detail.value=r.order_payload||detail.value;}
7286      onMounted(load);watch(status,load);
7287      return{store,status,orders,counts,detail,workspaceMode,nextAction,commercialSnapshot,milestoneForm,evidenceFile,evidenceMilestoneId,evidenceType,evidenceVisibility,evidenceFileLabel,ORDER_MILESTONE_LABELS,ORDER_EVIDENCE_LABELS,ORDER_VISIBILITY_LABELS,load,open,closeDetail,createMilestone,onEvidenceFile,uploadEvidence,archiveMilestone,archiveEvidence,customerOrderStatusLabel,customerOrderPaymentLabel,purchaseModeLabel,procurementStatusLabel,procurementMoney,procurementCurrencyLabel,procurementPricingLabel,procurementQuoteUnitLabel,procurementIncotermLabel,procurementShippingLabel,procurementContainerLabel,orderMilestoneLabel,orderEvidenceLabel,orderVisibilityLabel,shortDate,safeArray,adminRecordUpdatedAt,adminQueueOwner,orderQueueNextAction};
7288    },
7289    render:(function(){
7290const _Vue = Vue
7291const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
7292
7293const _hoisted_1 = {
7294  key: 0,
7295  class: "card dashboardHeaderCard"
7296}
7297const _hoisted_2 = ["onClick"]
7298const _hoisted_3 = {
7299  key: 1,
7300  class: "miniStats orderStats"
7301}
7302const _hoisted_4 = {
7303  key: 2,
7304  class: "segmented operationsFilters"
7305}
7306const _hoisted_5 = ["onClick"]
7307const _hoisted_6 = {
7308  key: 3,
7309  class: "card"
7310}
7311const _hoisted_7 = {
7312  key: 0,
7313  class: "adminQueueState adminQueueLoading"
7314}
7315const _hoisted_8 = {
7316  key: 1,
7317  class: "emptyCard adminQueueState"
7318}
7319const _hoisted_9 = { class: "customerOrderList adminOrdersList" }
7320const _hoisted_10 = ["onClick"]
7321const _hoisted_11 = { class: "codeToken orderCode" }
7322const _hoisted_12 = { class: "codeToken inlineCode" }
7323const _hoisted_13 = { class: "adminInlineWorkflowFacts" }
7324const _hoisted_14 = { class: "adminQueueNextAction" }
7325const _hoisted_15 = {
7326  key: 4,
7327  class: "card customerOrderDetail adminOrderDetail adminRecordWorkspace recordWorkspaceOnly"
7328}
7329const _hoisted_16 = { class: "adminWorkspaceBackBar" }
7330const _hoisted_17 = ["onClick"]
7331const _hoisted_18 = { class: "memberCardTop" }
7332const _hoisted_19 = { class: "codeToken orderCode" }
7333const _hoisted_20 = { class: "codeToken inlineCode" }
7334const _hoisted_21 = { class: "statusPill" }
7335const _hoisted_22 = { class: "orderAdminActions" }
7336const _hoisted_23 = ["onClick"]
7337const _hoisted_24 = { class: "orderMoneyCard commercialOrderSnapshot" }
7338const _hoisted_25 = { class: "orderGrandTotal" }
7339const _hoisted_26 = { class: "offerBreakdown commercialMoneySummary" }
7340const _hoisted_27 = { key: 0 }
7341const _hoisted_28 = { class: "infoGrid orderSnapshotGrid" }
7342const _hoisted_29 = {
7343  key: 0,
7344  class: "commercialSnapshotCard adminCommercialSnapshot"
7345}
7346const _hoisted_30 = { class: "commercialQuoteGrid" }
7347const _hoisted_31 = { key: 0 }
7348const _hoisted_32 = { key: 1 }
7349const _hoisted_33 = { key: 2 }
7350const _hoisted_34 = { key: 3 }
7351const _hoisted_35 = { key: 4 }
7352const _hoisted_36 = { key: 5 }
7353const _hoisted_37 = { key: 6 }
7354const _hoisted_38 = { key: 7 }
7355const _hoisted_39 = { key: 8 }
7356const _hoisted_40 = { key: 9 }
7357const _hoisted_41 = {
7358  key: 10,
7359  class: "commercialWide"
7360}
7361const _hoisted_42 = {
7362  key: 1,
7363  class: "orderMilestoneComposer"
7364}
7365const _hoisted_43 = { class: "formTwo" }
7366const _hoisted_44 = { class: "fieldLabel" }
7367const _hoisted_45 = ["onUpdate:modelValue"]
7368const _hoisted_46 = ["value"]
7369const _hoisted_47 = { class: "fieldLabel" }
7370const _hoisted_48 = ["onUpdate:modelValue"]
7371const _hoisted_49 = ["onUpdate:modelValue", "placeholder"]
7372const _hoisted_50 = ["onUpdate:modelValue"]
7373const _hoisted_51 = ["disabled", "onClick"]
7374const _hoisted_52 = {
7375  key: 2,
7376  class: "orderEvidenceUploader"
7377}
7378const _hoisted_53 = {
7379  key: 0,
7380  class: "emptyCard"
7381}
7382const _hoisted_54 = { class: "formTwo" }
7383const _hoisted_55 = { class: "fieldLabel" }
7384const _hoisted_56 = ["onUpdate:modelValue"]
7385const _hoisted_57 = ["value"]
7386const _hoisted_58 = { class: "fieldLabel" }
7387const _hoisted_59 = ["onUpdate:modelValue"]
7388const _hoisted_60 = ["value"]
7389const _hoisted_61 = { class: "fieldLabel" }
7390const _hoisted_62 = ["onUpdate:modelValue"]
7391const _hoisted_63 = { class: "filePicker wide" }
7392const _hoisted_64 = ["onChange"]
7393const _hoisted_65 = ["disabled", "onClick"]
7394const _hoisted_66 = { class: "orderTimeline orderEvidenceTimeline adminEvidenceTimeline" }
7395const _hoisted_67 = { class: "orderTimelineHead" }
7396const _hoisted_68 = { class: "orderTimelineBody" }
7397const _hoisted_69 = { class: "orderTimelineTitle" }
7398const _hoisted_70 = {
7399  key: 0,
7400  class: "evidenceBadge"
7401}
7402const _hoisted_71 = {
7403  key: 0,
7404  class: "orderEvidenceGrid"
7405}
7406const _hoisted_72 = ["href"]
7407const _hoisted_73 = ["src"]
7408const _hoisted_74 = ["src"]
7409const _hoisted_75 = {
7410  key: 2,
7411  class: "orderEvidenceIcon"
7412}
7413const _hoisted_76 = ["onClick"]
7414const _hoisted_77 = ["onClick"]
7415
7416return function render(_ctx, _cache) {
7417  with (_ctx) {
7418    const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, toDisplayString: _toDisplayString, renderList: _renderList, Fragment: _Fragment, normalizeClass: _normalizeClass, createTextVNode: _createTextVNode, vModelSelect: _vModelSelect, withDirectives: _withDirectives, vModelText: _vModelText, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
7419
7420    const _component_AdminFrame = _resolveComponent("AdminFrame")
7421
7422    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "طلبات العملاء المؤكدة" }, {
7423      default: _withCtx(() => [
7424        (!workspaceMode)
7425          ? (_openBlock(), _createElementBlock("section", _hoisted_1, [_cache[0] || (_cache[0] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "طلبات العملاء المؤكدة"), _createElementVNode("h3", null, "الطلبات المؤكدة"), _createElementVNode("p", { class: "hint" }, "كل سجل هنا نتج عن موافقة العضو على عرض منشور. الإجماليات والعملات والشروط لقطات ثابتة لا تتغير بتعديل ملف المشتريات.")], -1)), _createElementVNode("button", {
7426              class: "smallbtn",
7427              onClick: load
7428            }, "تحديث", 8, _hoisted_2)]))
7429          : _createCommentVNode("", true),
7430        (!workspaceMode)
7431          ? (_openBlock(), _createElementBlock("div", _hoisted_3, [
7432              _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(counts.total||0), 1), _cache[1] || (_cache[1] = _createElementVNode("small", null, "كل الطلبات", -1))]),
7433              _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(counts.confirmed||0), 1), _cache[2] || (_cache[2] = _createElementVNode("small", null, "مؤكدة", -1))]),
7434              _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(counts.procurement||0), 1), _cache[3] || (_cache[3] = _createElementVNode("small", null, "قيد المشتريات", -1))]),
7435              _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(counts.completed||0), 1), _cache[4] || (_cache[4] = _createElementVNode("small", null, "مكتملة", -1))])
7436            ]))
7437          : _createCommentVNode("", true),
7438        (!workspaceMode)
7439          ? (_openBlock(), _createElementBlock("div", _hoisted_4, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(['all','confirmed','procurement','completed','cancelled'], (s) => {
7440              return (_openBlock(), _createElementBlock("button", {
7441                key: s,
7442                class: _normalizeClass({active:status===s}),
7443                onClick: $event => (status=s)
7444              }, _toDisplayString(s==='all'?'الكل':customerOrderStatusLabel(s)), 11, _hoisted_5))
7445            }), 128))]))
7446          : _createCommentVNode("", true),
7447        (!workspaceMode)
7448          ? (_openBlock(), _createElementBlock("section", _hoisted_6, [(store.state.busy&&!orders.length)
7449              ? (_openBlock(), _createElementBlock("div", _hoisted_7, "جاري تحميل الطلبات المؤكدة..."))
7450              : (!orders.length)
7451                ? (_openBlock(), _createElementBlock("div", _hoisted_8, "لا توجد طلبات في هذا التصنيف."))
7452                : _createCommentVNode("", true), _createElementVNode("div", _hoisted_9, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(orders, (o) => {
7453              return (_openBlock(), _createElementBlock("button", {
7454                class: "customerOrderItem",
7455                key: o.id,
7456                onClick: $event => (open(o))
7457              }, [_createElementVNode("div", null, [
7458                _createElementVNode("span", _hoisted_11, _toDisplayString(o.order_code), 1),
7459                _createElementVNode("b", null, _toDisplayString(o.title_snapshot), 1),
7460                _createElementVNode("span", null, [_createTextVNode(_toDisplayString(o.member_name) + " · ", 1), _createElementVNode("span", _hoisted_12, _toDisplayString(o.request_code), 1)]),
7461                _createElementVNode("div", _hoisted_13, [
7462                  _createElementVNode("span", null, [_cache[5] || (_cache[5] = _createElementVNode("small", null, "الحالة", -1)), _createElementVNode("b", null, _toDisplayString(customerOrderStatusLabel(o.status)), 1)]),
7463                  _createElementVNode("span", null, [_cache[6] || (_cache[6] = _createElementVNode("small", null, "المسؤول", -1)), _createElementVNode("b", null, _toDisplayString(adminQueueOwner('orders',o)), 1)]),
7464                  _createElementVNode("span", null, [_cache[7] || (_cache[7] = _
7464createElementVNode("small", null, "آخر تحديث", -1)), _createElementVNode("b", null, _toDisplayString(adminRecordUpdatedAt(o)), 1)]),
7465                  _createElementVNode("span", _hoisted_14, [_cache[8] || (_cache[8] = _createElementVNode("small", null, "الإجراء التالي", -1)), _createElementVNode("b", null, _toDisplayString(orderQueueNextAction(o)), 1)])
7466                ])
7467              ]), _createElementVNode("div", null, [_createElementVNode("strong", null, _toDisplayString(o.total_amount) + " " + _toDisplayString(o.currency), 1), _createElementVNode("em", { class: _normalizeClass('orderState '+o.status) }, _toDisplayString(customerOrderStatusLabel(o.status)), 3)])], 8, _hoisted_10))
7468            }), 128))])]))
7469          : _createCommentVNode("", true),
7470        detail
7471          ? (_openBlock(), _createElementBlock("section", _hoisted_15, [
7472              _createElementVNode("div", _hoisted_16, [_createElementVNode("button", {
7473                class: "smallbtn secondary",
7474                onClick: closeDetail
7475              }, "← العودة للطلبات", 8, _hoisted_17), _cache[9] || (_cache[9] = _createElementVNode("span", null, "مساحة طلب مستقلة — نفّذ الإجراء هنا ثم ارجع للقائمة", -1))]),
7476              _createElementVNode("div", _hoisted_18, [_createElementVNode("div", null, [_createElementVNode("span", _hoisted_19, _toDisplayString(detail.order.order_code), 1), _createElementVNode("h3", null, _toDisplayString(detail.order.title_snapshot), 1), _createElementVNode("p", null, [_createTextVNode(_toDisplayString(detail.order.member_name) + " — ", 1), _createElementVNode("span", _hoisted_20, _toDisplayString(detail.order.member_whatsapp), 1)])]), _createElementVNode("span", _hoisted_21, _toDisplayString(customerOrderStatusLabel(detail.order.status)), 1)]),
7477              _createElementVNode("section", { class: _normalizeClass('operationsNextAction '+nextAction.tone) }, [_cache[10] || (_cache[10] = _createElementVNode("span", null, "الإجراء الحالي", -1)), _createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(nextAction.title), 1), _createElementVNode("small", null, "الدور الآن: " + _toDisplayString(nextAction.owner), 1)]), _createElementVNode("p", null, _toDisplayString(nextAction.note), 1)], 2),
7478              _createElementVNode("div", _hoisted_22, [_createElementVNode("button", {
7479                class: "btn",
7480                onClick: $event => ($router.push('/admin/procurement/'+detail.order.procurement_request_id))
7481              }, "فتح المشتريات وتنفيذ الإجراء", 8, _hoisted_23), _createElementVNode("span", null, "حالة المشتريات: " + _toDisplayString(procurementStatusLabel(detail.order.procurement_status)), 1)]),
7482              _createElementVNode("section", _hoisted_24, [_createElementVNode("div", _hoisted_25, [_cache[11] || (_cache[11] = _createElementVNode("span", null, "الإجمالي غير القابل للتغيير", -1)), _createElementVNode("b", null, _toDisplayString(procurementMoney(detail.order.total_amount,detail.order.currency)), 1)]), _createElementVNode("div", _hoisted_26, [
7483                _createElementVNode("span", null, [_cache[12] || (_cache[12] = _createElementVNode("small", null, "المنتجات / الخدمة", -1)), _createElementVNode("b", null, _toDisplayString(procurementMoney(detail.order.subtotal_amount,detail.order.currency)), 1)]),
7484                _createElementVNode("span", null, [_createElementVNode("small", null, "الخدمة " + _toDisplayString(Number(detail.order.commercial_model_version||1)>=2?'('+Number(detail.order.service_fee_percent||0)+'%)':''), 1), _createElementVNode("b", null, _toDisplayString(procurementMoney(detail.order.service_fee_amount,detail.order.currency)), 1)]),
7485                _createElementVNode("span", null, [_cache[13] || (_cache[13] = _createElementVNode("small", null, "الشحن", -1)), _createElementVNode("b", null, _toDisplayString(procurementMoney(detail.order.shipping_amount,detail.order.currency)), 1)]),
7486                (Number(detail.order.insurance_amount||0)>0)
7487                  ? (_openBlock(), _createElementBlock("span", _hoisted_27, [_cache[14] || (_cache[14] = _createElementVNode("small", null, "التأمين", -1)), _createElementVNode("b", null, _toDisplayString(procurementMoney(detail.order.insurance_amount,detail.order.currency)), 1)]))
7488                  : _createCommentVNode("", true),
7489                _createElementVNode("span", null, [_cache[15] || (_cache[15] = _createElementVNode("small", null, "الخصم", -1)), _createElementVNode("b", null, _toDisplayString(procurementMoney(detail.order.discount_amount,detail.order.currency)), 1)])
7490              ])]),
7491              _createElementVNode("div", _hoisted_28, [
7492                _createElementVNode("p", null, [_cache[16] || (_cache[16] = _createElementVNode("b", null, "نسخة العرض:", -1)), _createTextVNode(" " + _toDisplayString(detail.order.source_offer_version), 1)]),
7493                _createElementVNode("p", null, [_cache[17] || (_cache[17] = _createElementVNode("b", null, "النموذج التجاري:", -1)), _createTextVNode(" v" + _toDisplayString(detail.order.commercial_model_version||
74931), 1)]),
7494                _createElementVNode("p", null, [_cache[18] || (_cache[18] = _createElementVNode("b", null, "العملة:", -1)), _createTextVNode(" " + _toDisplayString(procurementCurrencyLabel(detail.order.currency)), 1)]),
7495                _createElementVNode("p", null, [_cache[19] || (_cache[19] = _createElementVNode("b", null, "طريقة الشراء:", -1)), _createTextVNode(" " + _toDisplayString(purchaseModeLabel(detail.order.purchase_mode)), 1)]),
7496                _createElementVNode("p", null, [_cache[20] || (_cache[20] = _createElementVNode("b", null, "الدفع:", -1)), _createTextVNode(" " + _toDisplayString(customerOrderPaymentLabel(detail.order.payment_status)), 1)]),
7497                _createElementVNode("p", null, [_cache[21] || (_cache[21] = _createElementVNode("b", null, "المسؤول:", -1)), _createTextVNode(" " + _toDisplayString(detail.order.assigned_admin_name||'غير معين'), 1)]),
7498                _createElementVNode("p", null, [_cache[22] || (_cache[22] = _createElementVNode("b", null, "شروط العرض:", -1)), _cache[23] || (_cache[23] = _createElementVNode("br", null, null, -1)), _createTextVNode(_toDisplayString(detail.order.offer_terms_snapshot), 1)]),
7499                _createElementVNode("p", null, [_cache[24] || (_cache[24] = _createElementVNode("b", null, "شروط التسليم:", -1)), _cache[25] || (_cache[25] = _createElementVNode("br", null, null, -1)), _createTextVNode(_toDisplayString(detail.order.delivery_terms_snapshot), 1)])
7500              ]),
7501              (Number(detail.order.commercial_model_version||1)>=2)
7502                ? (_openBlock(), _createElementBlock("section", _hoisted_29, [_cache[44] || (_cache[44] = _createElementVNode("div", { class: "memberSectionHead" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "Immutable Commercial Snapshot"), _createElementVNode("h3", null, "التسعير والشحن المعتمدان")])], -1)), _createElementVNode("div", _hoisted_30, [
7503                    _createElementVNode("p", null, [_cache[26] || (_cache[26] = _createElementVNode("b", null, "التسعير:", -1)), _createTextVNode(" " + _toDisplayString(procurementPricingLabel(commercialSnapshot.pricing_mode)), 1)]),
7504                    (commercialSnapshot.pricing_mode==='unit')
7505                      ? (_openBlock(), _createElementBlock("p", _hoisted_31, [_cache[27] || (_cache[27] = _createElementVNode("b", null, "الكمية:", -1)), _createTextVNode(" " + _toDisplayString(commercialSnapshot.quote_quantity) + " " + _toDisplayString(procurementQuoteUnitLabel(commercialSnapshot.quote_unit)), 1)]))
7506                      : _createCommentVNode("", true),
7507                    (commercialSnapshot.pricing_mode==='unit')
7508                      ? (_openBlock(), _createElementBlock("p", _hoisted_32, [_cache[28] || (_cache[28] = _createElementVNode("b", null, "سعر الوحدة:", -1)), _createTextVNode(" " + _toDisplayString(procurementMoney(commercialSnapshot.unit_price,detail.order.currency)), 1)]))
7509                      : _createCommentVNode("", true),
7510                    _createElementVNode("p", null, [_cache[29] || (_cache[29] = _createElementVNode("b", null, "Incoterm:", -1)), _createTextVNode(" " + _toDisplayString(commercialSnapshot.incoterm?procurementIncotermLabel(commercialSnapshot.incoterm):'-'), 1)]),
7511                    _createElementVNode("p", null, [_cache[30] || (_cache[30] = _createElementVNode("b", null, "نوع الشحن:", -1)), _createTextVNode(" " + _toDisplayString(procurementShippingLabel(commercialSnapshot.shipping_mode)), 1)]),
7512                    (commercialSnapshot.container_type)
7513                      ? (_openBlock(), _createElementBlock("p", _hoisted_33, [_cache[31] || (_cache[31] = _createElementVNode("b", null, "الحاوية:", -1)), _createTextVNode(" " + _toDisplayString(procurementContainerLabel(commercialSnapshot.container_type)), 1)]))
7514                      : _createCommentVNode("", true),
7515                    (Number(commercialSnapshot.gross_weight_kg||0))
7516                      ? (_openBlock(), _createElementBlock("p", _hoisted_34, [_cache[32] || (_cache[32] = _createElementVNode("b", null, "Gross:", -1)), _createTextVNode(" " + _toDisplayString(commercialSnapshot.gross_weight_kg) + " kg", 1)]))
7517                      : _createCommentVNode("", true),
7518                    (Number(commercialSnapshot.net_weight_kg||0))
7519                      ? (_openBlock(), _createElementBlock("p", _hoisted_35, [_cache[33] || (_cache[33] = _createElementVNode("b", null, "Net:", -1)), _createTextVNode(" " + _toDisplayString(commercialSnapshot.net_weight_kg) + " kg", 1)]))
7520                      : _createCommentVNode("", true),
7521                    (Number(commercialSnapshot.total_cbm||0))
7522                      ? (_openBlock(), _createElementBlock("p", _hoisted_36, [_cache[34] || (_cache[34] = _createElementVNode("b", null, "CBM:", -1)), _createTextVNode(" " + _toDisplayString(commercialSnapshot.total_cbm), 1)]))
7523                      : _createCommentVNode("", true),
7524                    (Number(commercialSnapshot.packages_count||0))
7525                      ? (_openBlock(), _createElementBlock("p", _hoisted_37, [_cache[35] || (_cache[35] = _createElementVNode("b", null, "الطرود:", -1)), _createTextVNode(" " + _toDisplayString(commercialSnapshot.packages_count), 1)]))
7526                      : _createCommentVNode("", true),
7527                    _createElementVNode("p", null, [_cache[36] || (_cache[36] = _createElementVNode("b", null, "المنشأ:", -1)), _createTextVNode(" " + _toDisplayString([$cityLabel(commercialSnapshot.origin_city),commercialSnapshot.origin_country].filter(
7527Boolean).join(' — ')||'-'), 1)]),
7528                    _createElementVNode("p", null, [_cache[37] || (_cache[37] = _createElementVNode("b", null, "التحميل:", -1)), _createTextVNode(" " + _toDisplayString(commercialSnapshot.loading_point||'-'), 1)]),
7529                    _createElementVNode("p", null, [_cache[38] || (_cache[38] = _createElementVNode("b", null, "الوجهة:", -1)), _createTextVNode(" " + _toDisplayString([$cityLabel(commercialSnapshot.destination_city),commercialSnapshot.destination_country].filter(Boolean).join(' — ')||'-'), 1)]),
7530                    _createElementVNode("p", null, [_cache[39] || (_cache[39] = _createElementVNode("b", null, "الوصول:", -1)), _createTextVNode(" " + _toDisplayString(commercialSnapshot.destination_point||'-'), 1)]),
7531                    (Number(commercialSnapshot.production_lead_days||0))
7532                      ? (_openBlock(), _createElementBlock("p", _hoisted_38, [_cache[40] || (_cache[40] = _createElementVNode("b", null, "Lead Time:", -1)), _createTextVNode(" " + _toDisplayString(commercialSnapshot.production_lead_days) + " يوم", 1)]))
7533                      : _createCommentVNode("", true),
7534                    (Number(commercialSnapshot.transit_days||0))
7535                      ? (_openBlock(), _createElementBlock("p", _hoisted_39, [_cache[41] || (_cache[41] = _createElementVNode("b", null, "Transit:", -1)), _createTextVNode(" " + _toDisplayString(commercialSnapshot.transit_days) + " يوم", 1)]))
7536                      : _createCommentVNode("", true),
7537                    (commercialSnapshot.hs_code)
7538                      ? (_openBlock(), _createElementBlock("p", _hoisted_40, [_cache[42] || (_cache[42] = _createElementVNode("b", null, "HS Code:", -1)), _createTextVNode(" " + _toDisplayString(commercialSnapshot.hs_code), 1)]))
7539                      : _createCommentVNode("", true),
7540                    (commercialSnapshot.packing_notes)
7541                      ? (_openBlock(), _createElementBlock("p", _hoisted_41, [_cache[43] || (_cache[43] = _createElementVNode("b", null, "التعبئة:", -1)), _createTextVNode(" " + _toDisplayString(commercialSnapshot.packing_notes), 1)]))
7542                      : _createCommentVNode("", true)
7543                  ])]))
7544                : _createCommentVNode("", true),
7545              (detail.order.status!=='cancelled')
7546                ? (_openBlock(), _createElementBlock("section", _hoisted_42, [
7547                    _cache[48] || (_cache[48] = _createElementVNode("div", { class: "memberSectionHead" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "Order Evidence"), _createElementVNode("h3", null, "إضافة مرحلة تنفيذ"), _createElementVNode("p", { class: "hint compactHint" }, "أضف ما حدث فعلياً. المرحلة الظاهرة للعضو تُرسل كتحديث وتخضع لإعدادات WhatsApp.")])], -1)),
7548                    _createElementVNode("div", _hoisted_43, [_createElementVNode("label", _hoisted_44, [_cache[45] || (_cache[45] = _createElementVNode("span", null, "نوع المرحلة", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((milestoneForm.milestone_type) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(ORDER_MILESTONE_LABELS, (label, key) => {
7549                      return (_openBlock(), _createElementBlock("option", {
7550                        key: key,
7551                        value: key
7552                      }, _toDisplayString(label), 9, _hoisted_46))
7553                    }), 128))], 8, _hoisted_45), [[_vModelSelect, milestoneForm.milestone_type]])]), _createElementVNode("label", _hoisted_47, [_cache[47] || (_cache[47] = _createElementVNode("span", null, "الظهور", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((milestoneForm.visibility) = $event) }, _cache[46] || (_cache[46] = [_createElementVNode("option", { value: "member" }, "ظاهر للعضو", -1), _createElementVNode("option", { value: "internal" }, "داخلي للإدارة فقط", -1)]), 8, _hoisted_48), [[_vModelSelect, milestoneForm.visibility]])])]),
7554                    _withDirectives(_createElementVNode("input", {
7555                      "onUpdate:modelValue": $event => ((milestoneForm.title) = $event),
7556                      placeholder: orderMilestoneLabel(milestoneForm.milestone_type)
7557                    }, null, 8, _hoisted_49), [[_vModelText, milestoneForm.title]]),
7558                    _withDirectives(_createElementVNode("textarea", {
7559                      "onUpdate:modelValue": $event => ((milestoneForm.body) = $event),
7560                      placeholder: "تفاصيل مختصرة: المصنع، نسبة الإنجازØ
7560Œ نتيجة الفحص، رقم الشحنة..."
7561                    }, null, 8, _hoisted_50), [[_vModelText, milestoneForm.body]]),
7562                    _createElementVNode("button", {
7563                      class: "btn",
7564                      disabled: store.state.busy,
7565                      onClick: createMilestone
7566                    }, "إضافة المرحلة", 8, _hoisted_51)
7567                  ]))
7568                : _createCommentVNode("", true),
7569              (detail.order.status!=='cancelled')
7570                ? (_openBlock(), _createElementBlock("section", _hoisted_52, [_cache[55] || (_cache[55] = _createElementVNode("div", { class: "memberSectionHead" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "Evidence"), _createElementVNode("h3", null, "إرفاق دليل بمرحلة"), _createElementVNode("p", { class: "hint compactHint" }, "الصور تُدار تلقائياً: Auto-orientation + WebP + Thumbnail. الفيديو MP4/MOV/WebM وPDF مسموحان.")])], -1)), (!safeArray(detail.milestones).length)
7571                    ? (_openBlock(), _createElementBlock("div", _hoisted_53, "أضف مرحلة أولاً ثم اربط بها الصور أو الفيديو أو المستند."))
7572                    : (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [
7573                        _createElementVNode("div", _hoisted_54, [_createElementVNode("label", _hoisted_55, [_cache[50] || (_cache[50] = _createElementVNode("span", null, "المرحلة", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((evidenceMilestoneId) = $event) }, [_cache[49] || (_cache[49] = _createElementVNode("option", { value: "" }, "اختر المرحلة", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(safeArray(detail.milestones), (m) => {
7574                          return (_openBlock(), _createElementBlock("option", {
7575                            key: m.id,
7576                            value: m.id
7577                          }, _toDisplayString(orderMilestoneLabel(m.milestone_type)) + " — " + _toDisplayString(m.title), 9, _hoisted_57))
7578                        }), 128))], 8, _hoisted_56), [[_vModelSelect, evidenceMilestoneId]])]), _createElementVNode("label", _hoisted_58, [_cache[51] || (_cache[51] = _createElementVNode("span", null, "نوع الدليل", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((evidenceType) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(ORDER_EVIDENCE_LABELS, (label, key) => {
7579                          return (_openBlock(), _createElementBlock("option", {
7580                            key: key,
7581                            value: key
7582                          }, _toDisplayString(label), 9, _hoisted_60))
7583                        }), 128))], 8, _hoisted_59), [[_vModelSelect, evidenceType]])])]),
7584                        _createElementVNode("label", _hoisted_61, [_cache[53] || (_cache[53] = _createElementVNode("span", null, "ظهور الدليل", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((evidenceVisibility) = $event) }, _cache[52] || (_cache[52] = [_createElementVNode("option", { value: "inherit" }, "يتبع ظهور المرحلة", -1), _createElementVNode("option", { value: "member" }, "ظاهر للعضو إذا كانت المرحلة ظاهرة", -1), _createElementVNode("option", { value: "internal" }, "داخلي للإدارة فقط", -1)]), 8, _hoisted_62), [[_vModelSelect, evidenceVisibility]])]),
7585                        _createElementVNode("label", _hoisted_63, [_createElementVNode("input", {
7586                          type: "file",
7587                          accept: "image/jpeg,image/png,image/webp,application/pdf,video/mp4,video/quicktime,video/webm",
7588                          onChange: onEvidenceFile
7589                        }, null, 40, _hoisted_64), _cache[54] || (_cache[54] = _createElementVNode("span", null, "اختيار ملف", -1)), _createElementVNode("em", null, _toDisplayString(evidenceFileLabel), 1)]),
7590                        _createElementVNode("button", {
7591                          class: "btn secondary",
7592                          disabled: store.state.upload&&store.state.upload.active,
7593                          onClick: uploadEvidence
7594                        }, _toDisplayString(store.state.upload&&store.state.upload.active?'جاري الرفع...':'رفع دليل المرحلة'), 9, _hoisted_65)
7595                      ], 64))]))
7596                : _createCommentVNode("", true),
7597              _createElementVNode("section", _hoisted_66, [_createElementVNode("div", _hoisted_67, [_cache[56] || (_cache[56] = _
7597createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "Execution Timeline"), _createElementVNode("h3", null, "السجل الزمني والأدلة")], -1)), _createElementVNode("span", null, _toDisplayString(safeArray(detail.timeline).length) + " تحديث", 1)]), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(safeArray(detail.timeline).length?safeArray(detail.timeline):safeArray(detail.events), (e) => {
7598                return (_openBlock(), _createElementBlock("div", {
7599                  class: "orderTimelineItem",
7600                  key: e.id
7601                }, [_cache[57] || (_cache[57] = _createElementVNode("i", null, null, -1)), _createElementVNode("div", _hoisted_68, [
7602                  _createElementVNode("div", _hoisted_69, [_createElementVNode("b", null, _toDisplayString(e.title), 1), (e.source==='milestone')
7603                    ? (_openBlock(), _createElementBlock("span", _hoisted_70, _toDisplayString(orderMilestoneLabel(e.milestone_type)) + " · " + _toDisplayString(orderVisibilityLabel(e.visibility)), 1))
7604                    : _createCommentVNode("", true)]),
7605                  _createElementVNode("p", null, _toDisplayString(e.body||'-'), 1),
7606                  _createElementVNode("small", null, _toDisplayString(shortDate(e.occurred_at||e.created_at)) + " · " + _toDisplayString(e.actor_type), 1),
7607                  (safeArray(e.evidence).length)
7608                    ? (_openBlock(), _createElementBlock("div", _hoisted_71, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(safeArray(e.evidence), (x) => {
7609                        return (_openBlock(), _createElementBlock("div", {
7610                          key: x.id,
7611                          class: "orderEvidenceCard adminEvidenceCard"
7612                        }, [_createElementVNode("a", {
7613                          href: x.file_url,
7614                          target: "_blank",
7615                          rel: "noopener"
7616                        }, [(x.kind==='image')
7617                          ? (_openBlock(), _createElementBlock("img", {
7618                              key: 0,
7619                              src: x.thumb_url||x.file_url,
7620                              loading: "lazy",
7621                              alt: ""
7622                            }, null, 8, _hoisted_73))
7623                          : (x.kind==='video'&&x.thumb_url)
7624                            ? (_openBlock(), _createElementBlock("img", {
7625                                key: 1,
7626                                src: x.thumb_url,
7627                                loading: "lazy",
7628                                alt: ""
7629                              }, null, 8, _hoisted_74))
7630                            : (_openBlock(), _createElementBlock("span", _hoisted_75, _toDisplayString(x.kind==='video'?'▶':'PDF'), 1)), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(orderEvidenceLabel(x.evidence_type)), 1), _createElementVNode("small", null, _toDisplayString(x.original_name) + " · " + _toDisplayString(orderVisibilityLabel(x.visibility)), 1)])], 8, _hoisted_72), _createElementVNode("button", {
7631                          class: "tinyDanger",
7632                          onClick: $event => (archiveEvidence(x))
7633                        }, "أرشفة", 8, _hoisted_76)]))
7634                      }), 128))]))
7635                    : _createCommentVNode("", true),
7636                  (e.source==='milestone')
7637                    ? (_openBlock(), _createElementBlock("button", {
7638                        key: 1,
7639                        class: "tinyLink dangerText",
7640                        onClick: $event => (archiveMilestone({id:e.milestone_id}))
7641                      }, "أرشفة المرحلة", 8, _hoisted_77))
7642                    : _createCommentVNode("", true)
7643                ])]))
7644              }), 128))])
7645            ]))
7646          : _createCommentVNode("", true)
7647      ]),
7648      _: 1
7649    }))
7650  }
7651}
7652})()
7653  };
7654
7655  const AdminProcurementPage={
7656    components:{AdminFrame},
7657    setup(){
7658      const store=useGzcStore();const router=useRouter();const route=useRoute();const status=ref('all');const overdueOnly=computed(()=>String((route.query||{}).overdue||'')==='1');const requests=ref([]);const detail=ref(null);const memberPreview=ref(false);const workspaceMode=computed(()=>!!route.params.id);const nextAction=computed(()=>procurementNextAction(detail.value,'admin'));const offerDelivery=computed(()=>safeRecord(detail.value&&detail.value.offer_delivery)||{});const memberUpdates=computed(()=>safeArray(detail.value&&detail.value.updates));const unreadMemberUpdates=computed(()=>memberUpdates.value.filter(u=>!u.read_at).length);const note=ref('');const proformaNumber=ref('');const purchaseMode=ref('request_quote');const offerTerms=ref('');const deliveryTerms=ref('');const offerValidUntil=ref('');const file=ref(null);const documentType=ref('quotation');const operators=ref([]);const assignedAdminId=ref('');const nextActionDays=ref('');const fileLabel=computed(()=>file.value?file.value.name:'لم يتم اختيار مستند');
7659      const commercial=reactive({pricing_mode:'total',quote_quantity:1,quote_unit:'unit',unit_price:0,goods_amount:0,quoted_currency:'CNY',service_fee_percent:0,shipping_amount:0,insurance_amount:0,discount_amount:0,incoterm:'',shipping_mode:'none',container_type:'',gross_weight_kg:0,net_weight_kg:0,total_cbm:0,packages_count:0,packing_notes:'',origin_country:'',origin_city:'',loading_point:'',destination_country:'',destination_city:'',destination_point:'',production_lead_days:0,transit_days:0,hs_code:''});
7660      const computedGoodsAmount=computed(()=>commercial.pricing_mode==='unit'?Math.round((Number(commercial.quote_quantity||0)*Number(commercial.unit_price||0)+Number.EPSILON)*100)/100:Math.max(0,Number(commercial.goods_amount||0)));
7661      const computedServiceFee=computed(()=>Math.round((computedGoodsAmount.value*Number(commercial.service_fee_percent||0)/100+Number.EPSILON)*100)/100);
7662      const computedGrandTotal=computed(()=>Math.round((computedGoodsAmount.value+computedServiceFee.value+Number(commercial.shipping_amount||0)+Number(commercial.insurance_amount||0)-Number(commercial.discount_amount||0)+Number.EPSILON)*100)/100);
7663      const commercialReadiness=computed(()=>{const shipping=String(commercial.shipping_mode||'none');const checks=[{key:'price',label:'السعر',ok:computedGoodsAmount.value>0},{key:'validity',label:'الصلاحية',ok:!!String(offerValidUntil.value||'')},{key:'terms',label:'الشروط',ok:!!String(offerTerms.value||'').trim()&&!!String(deliveryTerms.value||'').trim()},{key:'shipping',label:'بيانات الشحن',ok:shipping==='none'||(Number(commercial.total_cbm||0)>0&&Number(commercial.gross_weight_kg||0)>=Number(commercial.net_weight_kg||0)&&(shipping!=='fcl'||!!commercial.container_type))},{key:'route',label:'المسار',ok:shipping==='none'||(!!String(commercial.origin_country||'').trim()&&!!String(commercial.destination_country||'').trim())}];return{checks,done:checks.filter(x=>x.ok).length,total:checks.length,ready:checks.every(x=>x.ok)}});
7664      function loadCommercialForm(r){Object.assign(commercial,{pricing_mode:r.pricing_mode||'total',quote_quantity:Number(r.quote_quantity||1),quote_unit:r.quote_unit||'unit',unit_price:Number(r.unit_price||0),goods_amount:Number(r.goods_amount||0),quoted_currency:['CNY','USD','SDG'].includes(String(r.quoted_currency||'').toUpperCase())?String(r.quoted_currency).toUpperCase():'CNY',service_fee_percent:Number(r.service_fee_percent||0),shipping_amount:Number(r.shipping_amount||0),insurance_amount:Number(r.insurance_amount||0),discount_amount:Number(r.discount_amount||0),incoterm:r.incoterm||'',shipping_mode:r.shipping_mode||'none',container_type:r.container_type||'',gross_weight_kg:Number(r.gross_weight_kg||0),net_weight_kg:Number(r.net_weight_kg||0),total_cbm:Number(r.total_cbm||0),packages_count:Number(r.packages_count||0),packing_notes:r.packing_notes||'',origin_country:r.origin_country||'',origin_city:r.origin_city||'',loading_point:r.loading_point||'',destination_country:r.de
7664stination_country||'',destination_city:r.destination_city||'',destination_point:r.destination_point||'',production_lead_days:Number(r.production_lead_days||0),transit_days:Number(r.transit_days||0),hs_code:r.hs_code||''});}
7665      watch(()=>commercial.shipping_mode,(mode)=>{if(mode!=='fcl')commercial.container_type='';if(mode==='none'){commercial.incoterm='';commercial.shipping_amount=0;commercial.insurance_amount=0;commercial.transit_days=0;}});
7666      async function load(){if(!(await store.requireAdmin(router)))return;store.state.busy=true;const filter='?status='+encodeURIComponent(status.value)+(overdueOnly.value?'&overdue=1':'');const r=await api('/api/admin/procurement'+filter);store.state.busy=false;if(r.status===403){store.state.msg=r.message||'الصلاحية غير متاحة';router.push('/admin');return;}requests.value=safeArray(r.requests);operators.value=safeArray(r.operators);const requested=String(route.params.id||route.query.request||'');if(requested&&!detail.value){const row=requests.value.find(x=>String(x.id)===requested)||{id:requested};await open(row);}}
7667      async function open(x){const r=await runBusyAction(store,'admin-procurement.open',()=>api('/api/admin/procurement/'+encodeURIComponent(x.id)));const request=safeRecord(r.request);if(r.ok&&request&&request.id){r.request=request;detail.value=r;memberPreview.value=false;const target='/admin/procurement/'+encodeURIComponent(x.id);if(route.path!==target)router.push(target).catch(()=>{});loadCommercialForm(r.request);proformaNumber.value=r.request.proforma_number||'';purchaseMode.value=r.request.purchase_mode||'request_quote';offerTerms.value=r.request.offer_terms||'';deliveryTerms.value=r.request.delivery_terms||'';offerValidUntil.value=r.request.offer_valid_until?String(r.request.offer_valid_until).slice(0,10):new Date(Date.now()+7*86400000).toISOString().slice(0,10);assignedAdminId.value=r.request.assigned_admin_id||'';nextActionDays.value='';note.value='';}else store.state.msg=r.message||r.error||'';}
7668      async function move(target){if(!detail.value)return;const payload={status:target,note:note.value,...commercial,proforma_number:proformaNumber.value,purchase_mode:purchaseMode.value,offer_terms:offerTerms.value,delivery_terms:deliveryTerms.value,offer_valid_until:offerValidUntil.value,next_action_days:nextActionDays.value};const r=await api('/api/admin/procurement/'+detail.value.request.id+'/status',{method:'POST',body:JSON.stringify(payload)});store.state.msg=r.message||r.error||'';if(r.ok){detail.value=null;await load();await open(r.request);}}
7669      async function assign(){if(!detail.value)return;const r=await api('/api/admin/procurement/'+detail.value.request.id+'/assign',{method:'POST',body:JSON.stringify({admin_id:assignedAdminId.value||0})});store.state.msg=r.message||r.error||'';if(r.ok){await load();await open(r.request);}}
7670      function onFile(e){file.value=e.target.files&&e.target.files[0]?e.target.files[0]:null;}
7671      async function upload(){if(!detail.value||!file.value){store.state.msg='اختر المستند';return;}const fd=new FormData();fd.append('document_type',documentType.value);fd.append('file',file.value);const r=await uploadApi('/api/admin/procurement/'+detail.value.request.id+'/documents',{method:'POST',body:fd,headers:{'Accept':'application/json'},uploadLabel:'رفع مستند التوريد'});store.state.msg=r.message||r.error||'';if(r.ok){file.value=null;await open(detail.value.request);}}
7672      async function archiveDocument(d){if(!detail.value){return;}const reason=String(note.value||'').trim();if(!reason){store.state.msg='اكتب سبب أرشفة المستند في ملاحظة الإدارة';return;}if(!confirm('أرشفة هذا المستند؟'))return;const r=await api('/api/admin/procurement/'+detail.value.request.id+'/documents/'+d.id+'/archive',{method:'POST',body:JSON.stringify({reason})});store.state.msg=r.message||r.error||'';if(r.ok)await open(detail.value.request);}
7673      async function resendOffer(){if(!detail.value||detail.value.request.status!=='quoted')return;if(!confirm('إعادة إرسال إشعار عرض السعر للعضو؟'))return;const r=await runBusyAction(store,'admin-procurement.offer-resend',()=>api('/api/admin/procurement/'+detail.value.request.id+'/offer/resend',{method:'POST',body:'{}'}));store.state.msg=r.message||r.error||'';if(r.ok)await open(detail.value.request);}
7674      async function refreshOfferDelivery(){if(detail.value)await open(detail.value.request);}
7675      function whatsappDeliveryLabel(d){const status=String(d&&d.whatsapp_queue_status||'');if(status==='sent')return 'تم تسليمه لمزوّد WhatsApp';if(status==='queued')return 'في قائمة الإرسال';if(status==='processing')return 'جاري الإرسال';if(status==='failed')return 'فشل وسيعاد حسب السياسة';if(status==='dead')return 'فشل نهائي';if(status==='cancelled')return 'ملغي';const outcome=String(d&&d.last_whatsapp_outcome||'');if(outcome.startsWith('suppressed:'))return 'متوقف بسياسة الإشعارات';if(outcome.startsWith('skipped:'))return 'لم يُرسل: '+outcome.slice(8);if(outcome==='backfilled')return 'لا توجد حالة WhatsApp موثقة لهذا العرض القديم';return 'لم تتم محاولة WhatsApp بعد';}
7676      const next=computed(()=>{const s=detail.value&&detail.value.request&&detail.value.request.status;return({submitted:['under_review','cancelled'],under_review:['quoted','cancelled'],quoted:['under_review','cancelled'],payment_pending:['processing','cancelled'],processing:['completed']}[s])||[];});
7677      const primaryNext=computed(()=>{const s=String(detail.value&&detail.value.request&&detail.value.request.status||'');return({submitted:['under_review'],payment_pending:['processing'],processing:['completed']}[s])||[];});
7678      const secondaryNext=computed(()=>next.value.filter(x=>!primaryNext.value.includes(x)));
7679      const timelineSteps=[['submitted','طلب العميل'],['under_review','البحث والتحقق من المورد'],['quoted','عرض المورد'],['payment_pending','موافقة العميل والدفع'],['processing','الشراء والفحص والشحن'],['completed','مكتمل']];
7680      function timelineIndex(v){const i=timelineSteps.findIndex(x=>x[0]===String(v||''));return i<0?0:i;}
7681      const currentTimelineLabel=computed(()=>{const i=timelineIndex(detail.value&&detail.value.request&&detail.value.request.status);return 'المرحلة '+(i+1)+' من '+timelineSteps.length+' — '+timelineSteps[i][1];});
7682      function transitionLabel(target){const current=String(detail.value&&detail.value.request&&detail.value.request.status||'');if(target==='under_review')return current==='submitted'?'بدء المراجعة والبحث عن المورد':'إعادة العرض للمراجعة';if(target==='quoted')return 'نشر وإرسال عرض السعر';if(target==='payment_pending')return 'بانتظار دفع العميل';if(target==='processing')return 'تأكيد الدفع وبدء التنفيذ';if(target==='completed')return 'إكمال الطلب';if(target==='cancelled')return 'إلغاء الطلب';return procurementStatusLabel(target);}
7683      function closeDetail(){detail.value=null;router.push('/admin/procurement').catch(()=>{});}
7684      async function clearOverdueFilter(){const query={...(route.query||{})};delete query.overdue;await router.replace({path:'/admin/procurement',query}).catch(()=>{});await load();}
7685      onMounted(load);
7685watch(status,load);
7686      return{store,status,overdueOnly,requests,detail,memberPreview,workspaceMode,nextAction,offerDelivery,memberUpdates,unreadMemberUpdates,note,commercial,computedGoodsAmount,computedServiceFee,computedGrandTotal,commercialReadiness,proformaNumber,purchaseMode,offerTerms,deliveryTerms,offerValidUntil,file,fileLabel,documentType,operators,assignedAdminId,nextActionDays,PROCUREMENT_DOCUMENT_LABELS,PROCUREMENT_PRICING_LABELS,PROCUREMENT_QUOTE_UNIT_LABELS,PROCUREMENT_INCOTERM_LABELS,PROCUREMENT_SHIPPING_LABELS,PROCUREMENT_CONTAINER_LABELS,next,primaryNext,secondaryNext,timelineSteps,timelineIndex,currentTimelineLabel,transitionLabel,closeDetail,clearOverdueFilter,load,open,move,assign,onFile,upload,archiveDocument,resendOffer,refreshOfferDelivery,whatsappDeliveryLabel,procurementQuoteDocuments,procurementServiceLabel,procurementStatusLabel,procurementDocumentLabel,purchaseModeLabel,procurementCurrencyLabel,procurementMoney,procurementPricingLabel,procurementQuoteUnitLabel,procurementIncotermLabel,procurementShippingLabel,procurementContainerLabel,shortDate,adminRecordUpdatedAt,adminQueueOwner,procurementQueueNextAction};
7687    },
7688    render:(function(){
7689const _Vue = Vue
7690const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
7691
7692const _hoisted_1 = {
7693  key: 0,
7694  class: "card dashboardHeaderCard"
7695}
7696const _hoisted_2 = { class: "row" }
7697const _hoisted_3 = ["onClick"]
7698const _hoisted_4 = ["onClick"]
7699const _hoisted_5 = {
7700  key: 1,
7701  class: "card adminQueuePurpose"
7702}
7703const _hoisted_6 = ["onClick"]
7704const _hoisted_7 = {
7705  key: 2,
7706  class: "segmented operationsFilters"
7707}
7708const _hoisted_8 = ["onClick"]
7709const _hoisted_9 = {
7710  key: 3,
7711  class: "card"
7712}
7713const _hoisted_10 = {
7714  key: 0,
7715  class: "adminQueueState adminQueueLoading"
7716}
7717const _hoisted_11 = { class: "adminGuideList" }
7718const _hoisted_12 = ["onClick"]
7719const _hoisted_13 = {
7720  key: 0,
7721  class: "newBadge danger"
7722}
7723const _hoisted_14 = { class: "codeToken requestCode" }
7724const _hoisted_15 = { class: "requestTitle" }
7725const _hoisted_16 = { class: "adminInlineWorkflowFacts procurementInlineWorkflowFacts" }
7726const _hoisted_17 = { class: "adminQueueNextAction" }
7727const _hoisted_18 = {
7728  key: 0,
7729  class: "hint"
7730}
7731const _hoisted_19 = {
7732  key: 4,
7733  class: "card adminRecordWorkspace procurementWorkspace recordWorkspaceOnly adminProcurementWorkspaceV4"
7734}
7735const _hoisted_20 = { class: "adminWorkspaceBackBar" }
7736const _hoisted_21 = ["onClick"]
7737const _hoisted_22 = { class: "memberCardTop" }
7738const _hoisted_23 = { class: "codeToken requestCode" }
7739const _hoisted_24 = { class: "workspaceTitle" }
7740const _hoisted_25 = { class: "codeToken inlineCode" }
7741const _hoisted_26 = { class: "statusPill" }
7742const _hoisted_27 = { class: "workflowActionMeta" }
7743const _hoisted_28 = { key: 0 }
7744const _hoisted_29 = { class: "adminAssignmentCard" }
7745const _hoisted_30 = { class: "fieldLabel" }
7746const _hoisted_31 = ["onUpdate:modelValue"]
7747const _hoisted_32 = ["value"]
7748const _hoisted_33 = ["onClick"]
7749const _hoisted_34 = {
7750  key: 0,
7751  class: "adminPrimaryActionCard"
7752}
7753const _hoisted_35 = { class: "adminPrimaryActionFields" }
7754const _hoisted_36 = { class: "fieldLabel" }
7755const _hoisted_37 = ["onUpdate:modelValue"]
7756const _hoisted_38 = { class: "fieldLabel" }
7757const _hoisted_39 = ["onUpdate:modelValue"]
7758const _hoisted_40 = ["disabled", "onClick"]
7759const _hoisted_41 = { class: "adminProcessMap" }
7760const _hoisted_42 = {
7761  key: 1,
7762  class: "warningBox"
7763}
7764const _hoisted_43 = { class: "recordNarrative" }
7765const _hoisted_44 = { class: "infoGrid" }
7766const _hoisted_45 = {
7767  key: 2,
7768  class: "offerPublishForm commercialOfferComposer commercialComposerWorkspace"
7769}
7770const _hoisted_46 = { class: "offerPublishHead" }
7771const _hoisted_47 = { class: "commercialComposerSummary" }
7772const _hoisted_48 = { class: "commercialComposerTotal" }
7773const _hoisted_49 = { class: "commercialComposerFacts" }
7774const _hoisted_50 = { class: "formTwo commercialOfferBasics" }
7775const _hoisted_51 = { class: "fieldLabel" }
7776const _hoisted_52 = ["onUpdate:modelValue"]
7777const _hoisted_53 = { class: "fieldLabel" }
7778const _hoisted_54 = ["onUpdate:modelValue"]
7779const _hoisted_55 = {
7780  class: "commercialComposerStep",
7781  open: ""
7782}
7783const _hoisted_56 = { class: "commercialComposerStepBody" }
7784const _hoisted_57 = { class: "formTwo" }
7785const _hoisted_58 = { class: "fieldLabel" }
7786const _hoisted_59 = ["onUpdate:modelValue"]
7787const _hoisted_60 = { class: "fieldLabel" }
7788const _hoisted_61 = ["onUpdate:modelValue"]
7789const _hoisted_62 = ["value"]
7790const _hoisted_63 = {
7791  key: 0,
7792  class: "formTwo"
7793}
7794const _hoisted_64 = { class: "fieldLabel" }
7795const _hoisted_65 = ["onUpdate:modelValue"]
7796const _hoisted_66 = { class: "fieldLabel" }
7797const _hoisted_67 = ["onUpdate:modelValue"]
7798const _hoisted_68 = {
7799  key: 1,
7800  class: "fieldLabel"
7801}
7802const _hoisted_69 = ["onUpdate:modelValue"]
7803const _hoisted_70 = { class: "offerAmountGrid commercialFeesGrid" }
7804const _hoisted_71 = ["onUpdate:modelValue"]
7805const _hoisted_72 = ["onUpdate:modelValue"]
7806const _hoisted_73 = ["onUpdate:modelValue"]
7807const _hoisted_74 = ["onUpdate:modelValue"]
7808const _hoisted_75 = { class: "commercialCalculatedTotals" }
7809const _hoisted_76 = { class: "grand" }
7810const _hoisted_77 = { class: "commercialComposerStep" }
7811const _hoisted_78 = { class: "commercialComposerStepBody" }
7812const _hoisted_79 = { class: "formTwo" }
7813const _hoisted_80 = { class: "fieldLabel" }
7814const _hoisted_81 = ["onUpdate:modelValue"]
7815const _hoisted_82 = { class: "fieldLabel" }
7816const _hoisted_83 = ["onUpdate:modelValue"]
7817const _hoisted_84 = {
7818  key: 0,
7819  class: "fieldLabel"
7820}
7821const _hoisted_85 = ["onUpdate:modelValue"]
7822const _hoisted_86 = {
7823  key: 1,
7824  class: "commercialQuoteGrid commercialInputGrid"
7825}
7826const _hoisted_87 = { class: "fieldLabel" }
7827const _hoisted_88 = ["onUpdate:modelValue"]
7828const _hoisted_89 = { class: "fieldLabel" }
7829const _hoisted_90 = ["onUpdate:modelValue"]
7830const _hoisted_91 = { class: "fieldLabel" }
7831const _hoisted_92 = ["onUpdate:modelValue"]
7832const _hoisted_93 = { class: "fieldLabel" }
7833const _hoisted_94 = ["onUpdate:modelValue"]
7834const _hoisted_95 = {
7835  key: 0,
7836  class: "commercialComposerStep"
7837}
7838const _hoisted_96 = { class: "commercialComposerStepBody" }
7839const _hoisted_97 = { class: "formTwo" }
7840const _hoisted_98 = { class: "fieldLabel" }
7841const _hoisted_99 = ["onUpdate:modelValue"]
7842const _hoisted_100 = { class: "fieldLabel" }
7843const _hoisted_101 = ["onUpdate:modelValue"]
7844const _hoisted_102 = { class: "fieldLabel" }
7845const _hoisted_103 = ["onUpdate:modelValue"]
7846const _hoisted_104 = { class: "formTwo" }
7847const _hoisted_105 = { class: "fieldLabel" }
7848const _hoisted_106 = ["onUpdate:modelValue"]
7849const _hoisted_107 = { class: "fieldLabel" }
7850const _hoisted_108 = ["onUpdate:modelValue"]
7851const _hoisted_109 = { class: "fieldLabel" }
7852const _hoisted_110 = ["onUpdate:modelValue"]
7853const _hoisted_111 = { class: "formTwo" }
7854const _hoisted_112 = { class: "fieldLabel" }
7855const _hoisted_113 = ["onUpdate:modelValue"]
7856const _hoisted_114 = { class: "fieldLabel" }
7857const _hoisted_115 = ["onUpdate:modelValue"]
7858const _hoisted_116 = { class: "commercialComposerStep" }
7859const _hoisted_117 = { class: "commercialComposerStepBody" }
7860const _hoisted_118 = { class: "formTwo" }
7861const _hoisted_119 = { class: "fieldLabel" }
7862const _hoisted_120 = ["onUpdate:modelValue"]
7863const _hoisted_121 = { class: "fieldLabel" }
7864const _hoisted_122 = ["onUpdate:modelValue"]
7865const _hoisted_123 = { class: "fieldLabel" }
7866const _hoisted_124 = ["onUpdate:modelValue"]
7867const _hoisted_125 = { class: "fieldLabel" }
7868const _hoisted_126 = ["onUpdate:modelValue"]
7869const _hoisted_127 = { class: "fieldLabel" }
7870const _hoisted_128 = ["onUpdate:modelValue"]
7871const _hoisted_129 = { class: "fieldLabel" }
7872const _hoisted_130 = ["onUpdate:modelValue"]
7873const _hoisted_131 = { class: "commercialReadinessChecks" }
7874const _hoisted_132 = {
7875  key: 3,
7876  class: "offerWaitingCard commercialPublishedWorkspace"
7877}
7878const _hoisted_133 = { class: "commercialPublishedHead" }
7879const _hoisted_134 = { class: "vueBadge" }
7880const _hoisted_135 = { class: "commercialPublishedTotal" }
7881const _hoisted_136 = { class: "commercialDecisionHighlights adminCommercialHighlights" }
7882const _hoisted_137 = { class: "offerDeliveryAssurance" }
7883const _hoisted_138 = { class: "offerDeliveryHead" }
7884const _hoisted_139 = ["onClick"]
7885const _hoisted_140 = { class: "deliverySteps" }
7886const _hoisted_141 = { class: "deliveryStep done" }
7887const _hoisted_142 = { key: 0 }
7888const _hoisted_143 = { key: 0 }
7889const _hoisted_144 = { key: 0 }
7890const _hoisted_145 = { key: 1 }
7891const _hoisted_146 = { class: "row offerDeliveryActions" }
7892const _hoisted_147 = ["disabled", "onClick"]
7893const _hoisted_148 = ["onClick"]
7894const _hoisted_149 = {
7895  key: 0,
7896  class: "hint"
7897}
7898const _hoisted_150 = {
7899  key: 0,
7900  class: "memberOfferPreview commercialMemberPreview"
7901}
7902const _hoisted_151 = { class: "offerTotal" }
7903const _hoisted_152 = { class: "commercialQuoteGrid" }
7904const _hoisted_153 = { key: 0 }
7905const _hoisted_154 = { key: 1 }
7906const _hoisted_155 = { key: 2 }
7907const _hoisted_156 = { key: 3 }
7908const _hoisted_157 = { class: "decisionDocumentList" }
7909const _hoisted_158 = ["href"]
7910const _hoisted_159 = {
7911  key: 4,
7912  class: "orderCreatedBanner"
7913}
7914const _hoisted_160 = ["onClick"]
7915const _hoisted_161 = {
7916  key: 5,
7917  class: "adminNextDecisionCard"
7918}
7919const _hoisted_162 = { class: "fieldLabel" }
7920const _hoisted_163 = ["onUpdate:modelValue"]
7921const _hoisted_164 = { class: "fieldLabel" }
7922const _hoisted_165 = ["onUpdate:modelValue"]
7923const _hoisted_166 = { class: "adminDecisionActions" }
7924const _hoisted_167 = ["onClick"]
7925const _hoisted_168 = { class: "uploadBox procurementUploadBox" }
7926const _hoisted_169 = { class: "fieldLabel" }
7927const _hoisted_170 = ["onUpdate:modelValue"]
7928const _hoisted_171 = ["value"]
7929const _hoisted_172 = { class: "filePicker wide" }
7930const _hoisted_173 = ["onChange"]
7931const _hoisted_174 = ["disabled", "onClick"]
7932const _hoisted_175 = { class: "row" }
7933const _hoisted_176 = ["href"]
7934const _hoisted_177 = ["onClick"]
7935const _hoisted_178 = {
7936  key: 6,
7937  class: "adminMemberUpdatesCard"
7938}
7939const _hoisted_179 = { class: "memberSectionHead" }
7940const _hoisted_180 = { class: "hint compactHint" }
7941const _hoisted_181 = {
7942  key: 0,
7943  class: "compactHistory"
7944}
7945
7946return function render(_ctx, _cache) {
7947  with (_ctx) {
7948    const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, toDisplayString: _toDisplayString, renderList: _renderList, Fragment: _Fragment, normalizeClass: _normalizeClass, createTextVNode: _createTextVNode, vModelSelect: _vModelSelect, withDirectives: _withDirectives, vModelText: _vModelText, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
7949
7950    const _component_AdminFrame = _resolveComponent("AdminFrame")
7951
7952    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "طلبات التوريد" }, {
7953      default: _withCtx(() => [
7954        (!workspaceMode)
7955          ? (_openBlock(), _createElementBlock("section", _hoisted_1, [_cache[0] || (_cache[0] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "عمليات التوريد حسب طلب العميل"), _createElementVNode("h3", null, "طلبات البحث وعروض الموردين"), _createElementVNode("p", { class: "hint" }, "SMT تبحث وتنسّق حسب طلب العميل. انشر عرض المورد مكتملاً، ثم ينتظر النظام قبول العضو؛ لا يوجد مخزون منتجات أو قبول بالنيابة عنه.")], -1)), _createElementVNode("div", _hoisted_2, [_createElementVNode("button", {
7956              class: "smallbtn secondary",
7957              onClick: $event => ($router.push('/admin/orders'))
7958            }, "الطلبات المؤكدة", 8, _hoisted_3), _createElementVNode("button", {
7959              class: "smallbtn",
7960              onClick: load
7961            }, "تحديث", 8, _hoisted_4)])]))
7962          : _createCommentVNode("", true),
7963        (!workspaceMode&&overdueOnly)
7964          ? (_openBlock(), _createElementBlock("section", _hoisted_5, [_createElementVNode("div", null, [_cache[1] || (_cache[1] = _createElementVNode("b", null, "فلتر: تجاوز موعد الإجراء", -1)), _createElementVNode("span", null, _toDisplayString(requests.length) + " طلب توريد متأخر مطابق لنفس عداد لوحة الإدارة.", 1)]), _createElementVNode("button", {
7965              class: "smallbtn secondary",
7966              onClick: clearOverdueFilter
7967            }, "عرض كل الطلبات", 8, _hoisted_6)]))
7968          : _createCommentVNode("", true),
7969        (!workspaceMode)
7970          ? (_openBlock(), _createElementBlock("div", _hoisted_7, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(['all','submitted','under_review','quoted','payment_pending','processing','completed','cancelled'], (s) => {
7971              return (_openBlock(), _createElementBlock("button", {
7972                key: s,
7973                class: _normalizeClass({active:status===s}),
7974                onClick: $event => (status=s)
7975              }, _toDisplayString(s==='all'?'الكل':procurementStatusLabel(s)), 11, _hoisted_8))
7976            }), 128))]))
7977          : _createCommentVNode("", true),
7978        (!workspaceMode)
7979          ? (_openBlock(), _createElementBlock("section", _hoisted_9, [(store.state.busy&&!requests.length)
7980              ? (_openBlock(), _createElementBlock("div", _hoisted_10, "جاري تحميل طلبات التوريد..."))
7981              : _createCommentVNode("", true), _createElementVNode("div", _hoisted_11, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(requests, (x) => {
7982              return (_openBlock(), _createElementBlock("button", {
7983                class: _normalizeClass(["guideAdminItem procurementRequestItem", {overdue:x.is_overdue}]),
7984                key: x.id,
7985                onClick: $event => (open(x))
7986              }, [
7987                (x.is_overdue)
7988                  ? (_openBlock(), _createElementBlock("span", _hoisted_13, "متأخر"))
7989                  : _createCommentVNode("", true),
7990                _createElementVNode("span", _hoisted_14, _toDisplayString(x.request_code), 1),
7991                _createElementVNode("b", _hoisted_15, _toDisplayString(x.title), 1),
7992                _createElementVNode("small", null, _toDisplayString(x.member_name) + " · " + _toDisplayString(procurementServiceLabel(x.service_type)) + " · " + _toDisplayString(x.document_count||0) + " مستند", 1),
7993                _createElementVNode("div", _hoisted_16, [
7994                  _createElementVNode("span", null, [_cache[2] || (_cache[2] = _createElementVNode("small", null, "الحالة", -1)), _createElementVNode("b", null, _toDisplayString(procurementStatusLabel(x.status)), 1)]),
7995                  _createElementVNode("span", null, [_cache[3] || (_cache[3] = _createElementVNode("small", null, "المسؤول", -1)), _createElementVNode("b", null, _toDisplayString(adminQueueOwner('procurement',x)), 1)]),
7996                  _createElementVNode("span", null, [_cache[4] || (_cache[4] = _createElementVNode("small", null, "آخر تحديث", -1)), _createElementVNode("b", null, _toDisplayString(adminRecordUpdatedAt(x)), 1)]),
7997                  _createElementVNode("span", _hoisted_17, [_cache[5] || (_cache[5] = _createElementVNode("small", null, "الإجراء التالي", -1)), _createElementVNode("b", null, _toDisplayString(procurementQueueNextAction(x)), 1)])
7998                ]),
7999                (x.next_action_due_at)
8000                  ? (_openBlock(), _createElementBlock("small", {
8001                      key: 1,
8002                      class: _normalizeClass({errorText:x.is_overdue})
8003                    }, "موعد الإجراء: " + _toDisplayString(shortDate(x.next_action_due_at)), 3))
8004                  : _createCommentVNode("", true)
8005              ], 10, _hoisted_12))
8006            }), 128)), (!requests.length)
8007              ? (_openBlock(), _createElementBlock("p", _hoisted_18, "لا توجد طلبات في هذا التصنيف."))
8008              : _createCommentVNode("", true)])]))
8009          : _createCommentVNode("", true),
8010        detail
8011          ? (_openBlock(), _createElementBlock("section", _hoisted_19, [
8012              _createElementVNode("div", _hoisted_20, [_createElementVNode("button", {
8013                class: "smallbtn secondary",
8014                onClick: closeDetail
8015              }, "← العودة لطلبات التوريد", 8, _hoisted_21), _cache[6] || (_cache[6] = _createElementVNode("span", null, "مساحة طلب توريد مستقلة — كل إجراءات الطلب هنا", -1))]),
8016              _createElementVNode("div", _hoisted_22, [_createElementVNode("div", null, [_createElementVNode("span", _hoisted_23, _toDisplayString(detail.request.request_code), 1), _createElementVNode("h3", _hoisted_24, _toDisplayString(detail.request.title), 1), _createElementVNode("p", null, [_createTextVNode(_toDisplayString(detail.request.member_name) + " — ", 1), _createElementVNode("span", _hoisted_25, _toDisplayString(detail.request.member_whatsapp), 1)])]), _createElementVNode("span", _hoisted_26, _toDisplayString(procurementStatusLabel(detail.request.status)), 1)]),
8017              _createElementVNode("section", { class: _normalizeClass('workflowActionCard '+nextAction.tone) }, [
8018                _cache[7] || (_cache[7] = _createElementVNode("span", { class: "workflowActionKicker" }, "الإجراء المطلوب الآن", -1)),
8019                _createElementVNode("h3", null, _toDisplayString(nextAction.title), 1),
8020                _createElementVNode("div", _hoisted_27, [_createElementVNode("b", null, "الدور الآن: " + _toDisplayString(nextAction.owner), 1), (detail.request.next_action_due_at)
8021                  ? (_openBlock(), _createElementBlock("small", _hoisted_28, "المتابعة قبل " + _toDisplayString(shortDate(detail.request.next_action_due_at)), 1))
8022                  : _createCommentVNode("", true)]),
8023                _createElementVNode("p", null, _toDisplayString(nextAction.note), 1)
8024              ], 2),
8025              _cache[116] || (_cache[116] = _createTextVNode()),
8026              _createElementVNode("section", _hoisted_29, [_createElementVNode("label", _hoisted_30, [_cache[9] || (_cache[9] = _createElementVNode("span", null, "مسؤول الطلب", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((assignedAdminId) = $event) }, [_cache[8] || (_cache[8] = _createElementVNode("option", { value: "" }, "غير معين", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(operators, (a) => {
8027                return (_openBlock(), _createElementBlock("option", {
8028                  key: a.id,
8029                  value: a.id
8030                }, _toDisplayString(a.name) + " — " + _toDisplayString(a.role), 9, _hoisted_32))
8031              }), 128))], 8, _hoisted_31), [[_vModelSelect, assignedAdminId]])]), _createElementVNode("button", {
8032                class: "smallbtn secondary",
8033                onClick: assign
8034              }, "حفظ المسؤول", 8, _hoisted_33)]),
8035              (primaryNext.length)
8036                ? (_openBlock(), _createElementBlock("section", _hoisted_34, [_createElementVNode("div", null, [_cache[10] || (_cache[10] = _createElementVNode("span", { class: "adminEyebrow" }, "نفّذ الآن", -1)), _createElementVNode("b", null, _toDisplayString(transitionLabel(primaryNext[0])), 1), _cache[11] || (_cache[11] = _createElementVNode("small", null, "هذا الإجراء ينقل الطلب إلى المرحلة التالية فقط بعد مراجعة الحالة الحالية.", -1))]), _createElementVNode("div", _hoisted_35, [_createElementVNode("label", _hoisted_36, [_cache[12] || (_cache[12] = _createElementVNode("span", null, "ملاحظة الإدارة", -1)), _withDirectives(_createElementVNode("textarea", {
8037                    "onUpdate:modelValue": $event => ((note) = $event),
8038                    placeholder: "ملاحظة مختصرة عند الحاجة"
8039                  }, null, 8, _hoisted_37), [[_vModelText, note]])]), _createElementVNode("label", _hoisted_38, [_cache[14] || (_cache[14] = _createElementVNode("span", null, "موعد المتابعة", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((nextActionDays) = $event) }, _cache[13] || (_cache[13] = [
8040                    _createElementVNode("option", { value: "" }, "حسب المدة الافتراضية", -1),
8041                    _createElementVNode("option", { value: "1" }, "خلال يوم", -1),
8042                    _createElementVNode("option", { value: "2" }, "خلال يومين", -1),
8043                    _createElementVNode("option", { value: "3" }, "خلال 3 أيام", -1),
8044                    _createElementVNode("option", { value: "7" }, "خلال 7 أيام", -1)
8045                  ]), 8, _hoisted_39), [[_vModelSelect, nextActionDays]])])]), _createElementVNode("button", {
8046                    class: "btn",
8047                    disabled: store.state.busy,
8048                    onClick: $event => (move(primaryNext[0]))
8049                  }, _toDisplayString(transitionLabel(primaryNext[0])), 9, _hoisted_40)]))
8050                : _createCommentVNode("", true),
8051              _createElementVNode("details", _hoisted_41, [_createElementVNode("summary", null, [_createElementVNode("div", null, [_cache[15] || (_cache[15] = _createElementVNode("span", { class: "adminEyebrow" }, "مسار الطلب", -1)), _createElementVNode("b", null, _toDisplayString(currentTimelineLabel), 1)]), _cache[16] || (_cache[16] = _createElementVNode("strong", null, "عرض كل المراحل", -1))]), _createElementVNode("div", { class: _normalizeClass(["adminProcessStepperV3", {cancelled:detail.request.status==='cancelled'}]) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(timelineSteps, (step, i) => {
8052                return (_openBlock(), _createElementBlock("span", {
8053                  key: step[0],
8054                  class: _normalizeClass({done:i<=timelineIndex(detail.request.status),current:i===timelineIndex(detail.request.status)})
8055                }, [_createElementVNode("i", null, _toDisplayString(i+1), 1), _createElementVNode("b", null, _toDisplayString(step[1]), 1)], 2))
8056              }), 128))], 2)]),
8057              (detail.request.status==='cancelled')
8058                ? (_openBlock(), _createElementBlock("div", _hoisted_42, "تم إلغاء الطلب. راجع سجل الحالة لمعرفة السبب وآخر إجراء."))
8059                : _createCommentVNode("", true),
8060              _createElementVNode("p", _hoisted_43, _toDisplayString(detail.request.description), 1),
8061              _createElementVNode("div", _hoisted_44, [
8062                _createElementVNode("p", null, [_cache[17] || (_cache[17] = _createElementVNode("b", null, "الخدمة:", -1)), _createTextVNode(" " + _toDisplayString(procurementServiceLabel(detail.request.service_type)), 1
8062)]),
8063                _createElementVNode("p", null, [_cache[18] || (_cache[18] = _createElementVNode("b", null, "المورد:", -1)), _createTextVNode(" " + _toDisplayString(detail.request.supplier_name||'-'), 1)]),
8064                _createElementVNode("p", null, [_cache[19] || (_cache[19] = _createElementVNode("b", null, "تواصل المورد:", -1)), _createTextVNode(" " + _toDisplayString(detail.request.supplier_contact||'-'), 1)]),
8065                _createElementVNode("p", null, [_cache[20] || (_cache[20] = _createElementVNode("b", null, "المبلغ:", -1)), _createTextVNode(" " + _toDisplayString(detail.request.quoted_amount?detail.request.quoted_amount+' '+detail.request.quoted_currency:'-'), 1)])
8066              ]),
8067              (detail.request.status==='under_review')
8068                ? (_openBlock(), _createElementBlock("section", _hoisted_45, [
8069                    _createElementVNode("div", _hoisted_46, [_cache[21] || (_cache[21] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "الخطوة الأخيرة قبل عرض السعر للعضو"), _createElementVNode("h3", null, "تجهيز العرض التجاري واللوجستي")], -1)), _createElementVNode("span", null, "Commercial v2 · نسخة " + _toDisplayString(Number(detail.request.offer_version||0)+1), 1)]),
8070                    _createElementVNode("div", _hoisted_47, [_createElementVNode("div", _hoisted_48, [_cache[22] || (_cache[22] = _createElementVNode("small", null, "الإجمالي المتوقع", -1)), _createElementVNode("b", null, _toDisplayString(procurementMoney(computedGrandTotal,commercial.quoted_currency)), 1), _createElementVNode("span", null, _toDisplayString(procurementCurrencyLabel(commercial.quoted_currency)), 1)]), _createElementVNode("div", _hoisted_49, [_createElementVNode("span", null, [_cache[23] || (_cache[23] = _createElementVNode("small", null, "التسليم", -1)), _createElementVNode("b", null, _toDisplayString(commercial.incoterm?procurementIncotermLabel(commercial.incoterm):'بدون Incoterm'), 1)]), _createElementVNode("span", null, [_cache[24] || (_cache[24] = _createElementVNode("small", null, "الشحن", -1)), _createElementVNode("b", null, _toDisplayString(procurementShippingLabel(commercial.shipping_mode)), 1)]), _createElementVNode("span", null, [_cache[25] || (_cache[25] = _createElementVNode("small", null, "الجاهزية", -1)), _createElementVNode("b", null, _toDisplayString(commercialReadiness.done) + " / " + _toDisplayString(commercialReadiness.total), 1)])])]),
8071                    _cache[74] || (_cache[74] = _createElementVNode("p", { class: "hint commercialAuthorityHint" }, [_createTextVNode("هذه معاينة تشغيلية فقط؛ "), _createElementVNode("b", null, "السيرفر يعيد حساب رسوم الخدمة والإجمالي ويتحقق من القواعد عند النشر.")], -1)),
8072                    _createElementVNode("div", _hoisted_50, [_createElementVNode("label", _hoisted_51, [_cache[27] || (_cache[27] = _createElementVNode("span", null, "نوع العرض", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((purchaseMode) = $event) }, _cache[26] || (_cache[26] = [_createElementVNode("option", { value: "request_quote" }, "طلب بحث وتجهيز عرض", -1), _createElementVNode("option", { value: "buy_now" }, "عرض مورد جاهز للاعتماد", -1)]), 8, _hoisted_52), [[_vModelSelect, purchaseMode]])]), _createElementVNode("label", _hoisted_53, [_cache[29] || (_cache[29] = _createElementVNode("span", null, "عملة العرض", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((commercial.quoted_currency) = $event) }, _cache[28] || (_cache[28] = [_createElementVNode("option", { value: "CNY" }, "يوان صيني ¥ (CNY)", -1), _createElementVNode("option", { value: "USD" }, "دولار أمريكي $ (USD)", -1), _createElementVNode("option", { value: "SDG" }, "جنيه سوداني (SDG)", -1)]), 8, _hoisted_54), [[_vModelSelect, commercial.quoted_currency]])])]),
8073                    _createElementVNode("details", _hoisted_55, [_createElementVNode("summary", null, [_cache[30] || (_cache[30] = _createElementVNode("span", null, [_createElementVNode("i", null, "1"), _createElementVNode("b", null, "التسعير")], -1)), _createElementVNode("strong", null, _toDisplayString(procurementMoney(computedGrandTotal,commercial.quoted_currency)), 1)]), _createElementVNode("div", _hoisted_56, [
8074                      _createElementVNode("div", _hoisted_57, [_createElementVNode("label", _hoisted_58, [_cache[32] || (_cache[32] = _createElementVNode("span", null, "طريقة التسعير", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((commercial.pricing_mode) = $event) }, _cache[31] || (_cache[31] = [_createElementVNode("option", { value: "total" }, "سعر إجمالي", -1), _createElementVNode("option", { value: "unit" }, "سعر وحدة × كمية", -1)]), 8, _hoisted_59), [[_vModelSelect, commercial.pricing_mode]])]), _createElementVNode("label", _hoisted_60, [_cache[33] || (_cache[33] = _createElementVNode("span", null, "وحدة التسعير", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((commercial.quote_unit) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(PROCUREMENT_QUOTE_UNIT_LABELS, (label, key) => {
8075                        return (_openBlock(), _createElementBlock("option", {
8076                          key: key,
8077                          value: key
8078                        }, _toDisplayString(label), 9, _hoisted_62))
8079                      }), 128))], 8, _hoisted_61), [[_vModelSelect, commercial.quote_unit]])])]),
8080                      (commercial.pricing_mode==='unit')
8081                        ? (_openBlock(), _createElementBlock("div", _hoisted_63, [_createElementVNode("label", _hoisted_64, [_cache[34] || (_cache[34] = _createElementVNode("span", null, "الكمية", -1)), _withDirectives(_createElementVNode("input", {
8082                            type: "number",
8083                            min: "0.001",
8084                            step: "0.001",
8085                            "onUpdate:modelValue": $event => ((commercial.quote_quantity) = $event)
8086                          }, null, 8, _hoisted_65), [[
8087                            _vModelText,
8088                            commercial.quote_quantity,
8089                            void 0,
8090                            { number: true }
8091                          ]])]), _createElementVNode("label", _hoisted_66, [_cache[35] || (_cache[35] = _createElementVNode("span", null, "سعر الوحدة", -1)), _withDirectives(_createElementVNode("input", {
8092                            type: "number",
8093                            min: "0.0001",
8094                            step: "0.0001",
8095                            "onUpdate:modelValue": $event => ((commercial.unit_price) = $event)
8096                          }, null, 8, _hoisted_67), [[
8097                            _vModelText,
8098                            commercial.unit_price,
8099                            void 0,
8100                            { number: true }
8101                          ]])])]))
8102                        : (_openBlock(), _createElementBlock("label", _hoisted_68, [_cache[36] || (_cache[36] = _createElementVNode("span", null, "قيمة المنتجات / الخدمة الأساسية", -1)), _withDirectives(_createElementVNode("input", {
8103                            type: "number",
8104                            min: "0.01",
8105                            step: "0.01",
8106                            "onUpdate:modelValue": $event => ((commercial.goods_amount) = $event)
8107                          }, null, 8, _hoisted_69), [[
8108                            _vModelText,
8109                            commercial.goods_amount,
8110                            void 0,
8111                            { number: true }
8112                          ]])])),
8113                      _createElementVNode("div", _hoisted_70, [
8114                        _createElementVNode("label", null, [_cache[37] || (_cache[37] = _createElementVNode("span", null, "رسوم خدمات SMT %", -1)), _withDirectives(_createElementVNode("input", {
8115                          type: "number",
8116                          min: "0",
8117                          max: "100",
8118                          step: "0.01",
8119                          "onUpdate:modelValue": $event => ((commercial.service_fee_percent) = $event)
8120                        }, null, 8, _hoisted_71), [[
8121                          _vModelText,
8122                          commercial.service_fee_percent,
8123                          void 0,
8124                          { number: true }
8125                        ]]), _cache[38] || (_cache[38] = _createElementVNode("small", null, "تُحسب من القيمة الأساسية", -1))]),
8126                        _createElementVNode("label", null, [_cache[39] || (_cache[39] = _createElementVNode("span", null, "تكلفة الشحن", -1)), _withDirectives(_createElementVNode("input", {
8127                          type: "number",
8128                          min: "0",
8129                          step: "0.01",
8130                          "onUpdate:modelValue": $event => ((commercial.shipping_amount) = $event)
8131                        }, null, 8, _hoisted_72), [[
8132                          _vModelText,
8133                          commercial.shipping_amount,
8134                          void 0,
8135                          { number: true }
8136                        ]])]),
8137                        _createElementVNode("label", null, [_cache[40] || (_cache[40] = _createElementVNode("span", null, "التأمين", -1)), _withDirectives(_createElementVNode("input", {
8138                          type: "number",
8139                          min: "0",
8140                          step: "0.01",
8141                          "onUpdate:modelValue": $event => ((commercial.insurance_amount) = $event)
8142                        }, null, 8, _hoisted_73), [[
8143                          _vModelText,
8144                          commercial.insurance_amount,
8145                          void 0,
8146                          { number: true }
8147                        ]])]),
8148                        _createElementVNode("label", null, [_cache[41] || (_cache[41] = _createElementVNode("span", null, "الخصم", -1)), _withDirectives(_createElementVNode("input", {
8149                          type: "number",
8150                          min: "0",
8151                          step: "0.01",
8152                          "onUpdate:modelValue": $event => ((commercial.discount_amount) = $event)
8153                        }, null, 8, _hoisted_74), [[
8154                          _vModelText,
8155                          commercial.discount_amount,
8156                          void 0,
8157                          { number: true }
8158                        ]])])
8159                      ]),
8160                      _createElementVNode("div", _hoisted_75, [_createElementVNode("span", null, [_cache[42] || (_cache[42] = _createElementVNode("small", null, "القيمة الأساسية", -1)), _createElementVNode("b", null, _toDisplayString(procurementMoney(computedGoodsAmount,commercial.quoted_currency)), 1)]), _createElementVNode("span", null, [_cache[43] || (_cache[43] = _createElementVNode("small", null, "رسوم الخدمة المحسوبة", -1)), _createElementVNode("b", null, _toDisplayString(procurementMoney(computedServiceFee,commercial.quoted_currency)), 1)]), _createElementVNode("span", _hoisted_76, [_cache[44] || (_cache[44] = _createElementVNode("small", null, "الإجمالي المتوقع", -1)), _createElementVNode("b", null, _toDisplayString(procurementMoney(computedGrandTotal,commercial.quoted_currency)), 1)])])
8161                    ])]),
8162                    _createElementVNode("details", _hoisted_77, [_createElementVNode("summary", null, [_cache[45] || (_cache[45] = _
8162createElementVNode("span", null, [_createElementVNode("i", null, "2"), _createElementVNode("b", null, "الشحن والتسليم")], -1)), _createElementVNode("strong", null, _toDisplayString(procurementShippingLabel(commercial.shipping_mode)), 1)]), _createElementVNode("div", _hoisted_78, [_createElementVNode("div", _hoisted_79, [_createElementVNode("label", _hoisted_80, [_cache[47] || (_cache[47] = _createElementVNode("span", null, "Incoterm", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((commercial.incoterm) = $event) }, _cache[46] || (_cache[46] = [
8163                      _createElementVNode("option", { value: "" }, "بدون Incoterm / لا يوجد شحن", -1),
8164                      _createElementVNode("option", { value: "EXW" }, "EXW — استلام من المصنع", -1),
8165                      _createElementVNode("option", { value: "FOB" }, "FOB — على ظهر السفينة", -1),
8166                      _createElementVNode("option", { value: "CIF" }, "CIF — تكلفة + تأمين + شحن", -1)
8167                    ]), 8, _hoisted_81), [[_vModelSelect, commercial.incoterm]])]), _createElementVNode("label", _hoisted_82, [_cache[49] || (_cache[49] = _createElementVNode("span", null, "نوع الشحن", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((commercial.shipping_mode) = $event) }, _cache[48] || (_cache[48] = [
8168                      _createElementVNode("option", { value: "none" }, "بدون شحن ضمن العرض", -1),
8169                      _createElementVNode("option", { value: "fcl" }, "حاوية كاملة FCL", -1),
8170                      _createElementVNode("option", { value: "lcl" }, "شحن بحري مجزأ LCL", -1),
8171                      _createElementVNode("option", { value: "air_cargo" }, "شحن جوي Air Cargo", -1)
8172                    ]), 8, _hoisted_83), [[_vModelSelect, commercial.shipping_mode]])])]), (commercial.shipping_mode==='fcl')
8173                      ? (_openBlock(), _createElementBlock("label", _hoisted_84, [_cache[51] || (_cache[51] = _createElementVNode("span", null, "نوع الحاوية", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((commercial.container_type) = $event) }, _cache[50] || (_cache[50] = [
8174                          _createElementVNode("option", { value: "" }, "اختر الحاوية", -1),
8175                          _createElementVNode("option", { value: "20GP" }, "20GP — 20 قدم", -1),
8176                          _createElementVNode("option", { value: "40GP" }, "40GP — 40 قدم", -1),
8177                          _createElementVNode("option", { value: "40HC" }, "40HC — 40 قدم High Cube", -1)
8178                        ]), 8, _hoisted_85), [[_vModelSelect, commercial.container_type]])]))
8179                      : _createCommentVNode("", true), (commercial.shipping_mode!=='none')
8180                      ? (_openBlock(), _createElementBlock("div", _hoisted_86, [
8181                          _createElementVNode("label", _hoisted_87, [_cache[52] || (_cache[52] = _createElementVNode("span", null, "Gross Weight kg", -1)), _withDirectives(_createElementVNode("input", {
8182                            type: "number",
8183                            min: "0",
8184                            step: "0.001",
8185                            "onUpdate:modelValue": $event => ((commercial.gross_weight_kg) = $event)
8186                          }, null, 8, _hoisted_88), [[
8187                            _vModelText,
8188                            commercial.gross_weight_kg,
8189                            void 0,
8190                            { number: true }
8191                          ]])]),
8192                          _createElementVNode("label", _hoisted_89, [_cache[53] || (_cache[53] = _createElementVNode("span", null, "Net Weight kg", -1)), _withDirectives(_createElementVNode("input", {
8193                            type: "number",
8194                            min: "0",
8195                            step: "0.001",
8196                            "onUpdate:modelValue": $event => ((commercial.net_weight_kg) = $event)
8197                          }, null, 8, _hoisted_90), [[
8198                            _vModelText,
8199                            commercial.net_weight_kg,
8200                            void 0,
8201                            { number: true }
8202                          ]])]),
8203                          _createElementVNode("label", _hoisted_91, [_cache[54] || (_cache[54] = _createElementVNode("span", null, "CBM", -1)), _withDirectives(_createElementVNode("input", {
8204                            type: "number",
8205                            min: "0",
8206                            step: "0.001",
8207                            "onUpdate:modelValue": $event => ((commercial.total_cbm) = $event)
8208                          }, null, 8, _hoisted_92), [[
8209                            _vModelText,
8210                            commercial.total_cbm,
8211                            void 0,
8212                            { number: true }
8213                          ]])]),
8214                          _createElementVNode("label", _hoisted_93, [_cache[55] || (_cache[55] = _createElementVNode("span", null, "عدد الطرود / Packages", -1)), _withDirectives(_createElementVNode("input", {
8215                            type: "number",
8216                            min: "0",
8217                            step: "1",
8218                            "onUpdate:modelValue": $event => ((commercial.packages_count) = $event)
8219                          }, null, 8, _hoisted_94), [[
8220                            _vModelText,
8221                            commercial.packages_count,
8222                            void 0,
8223                            { number: true }
8224                          ]])])
8225                        ]))
8226                      : _createCommentVNode("", true)])]),
8227                    (commercial.shipping_mode!=='none')
8228                      ? (_openBlock(), _createElementBlock("details", _hoisted_95, [_createElementVNode("summary", null, [_cache[56] || (_cache[56] = _
8228createElementVNode("span", null, [_createElementVNode("i", null, "3"), _createElementVNode("b", null, "خط الشحن والمدة")], -1)), _createElementVNode("strong", null, _toDisplayString(commercial.origin_country||'المنشأ') + " ← " + _toDisplayString(commercial.destination_country||'الوجهة'), 1)]), _createElementVNode("div", _hoisted_96, [
8229                          _createElementVNode("div", _hoisted_97, [_createElementVNode("label", _hoisted_98, [_cache[57] || (_cache[57] = _createElementVNode("span", null, "بلد المنشأ", -1)), _withDirectives(_createElementVNode("input", {
8230                            "onUpdate:modelValue": $event => ((commercial.origin_country) = $event),
8231                            placeholder: "China"
8232                          }, null, 8, _hoisted_99), [[_vModelText, commercial.origin_country]])]), _createElementVNode("label", _hoisted_100, [_cache[58] || (_cache[58] = _createElementVNode("span", null, "مدينة المنشأ", -1)), _withDirectives(_createElementVNode("input", {
8233                            "onUpdate:modelValue": $event => ((commercial.origin_city) = $event),
8234                            placeholder: "Guangzhou / Yiwu..."
8235                          }, null, 8, _hoisted_101), [[_vModelText, commercial.origin_city]])])]),
8236                          _createElementVNode("label", _hoisted_102, [_cache[59] || (_cache[59] = _createElementVNode("span", null, "ميناء / مطار / نقطة التحميل", -1)), _withDirectives(_createElementVNode("input", {
8237                            "onUpdate:modelValue": $event => ((commercial.loading_point) = $event),
8238                            placeholder: "Guangzhou / Shenzhen / Shanghai Port أو Airport"
8239                          }, null, 8, _hoisted_103), [[_vModelText, commercial.loading_point]])]),
8240                          _createElementVNode("div", _hoisted_104, [_createElementVNode("label", _hoisted_105, [_cache[60] || (_cache[60] = _createElementVNode("span", null, "بلد الوجهة", -1)), _withDirectives(_createElementVNode("input", {
8241                            "onUpdate:modelValue": $event => ((commercial.destination_country) = $event),
8242                            placeholder: "Sudan"
8243                          }, null, 8, _hoisted_106), [[_vModelText, commercial.destination_country]])]), _createElementVNode("label", _hoisted_107, [_cache[61] || (_cache[61] = _createElementVNode("span", null, "مدينة الوجهة", -1)), _withDirectives(_createElementVNode("input", {
8244                            "onUpdate:modelValue": $event => ((commercial.destination_city) = $event),
8245                            placeholder: "Port Sudan / Khartoum..."
8246                          }, null, 8, _hoisted_108), [[_vModelText, commercial.destination_city]])])]),
8247                          _createElementVNode("label", _hoisted_109, [_cache[62] || (_cache[62] = _createElementVNode("span", null, "ميناء / مطار / نقطة الوصول", -1)), _withDirectives(_createElementVNode("input", {
8248                            "onUpdate:modelValue": $event => ((commercial.destination_point) = $event),
8249                            placeholder: "Port Sudan Port / KRT Airport..."
8250                          }, null, 8, _hoisted_110), [[_vModelText, commercial.destination_point]])]),
8251                          _createElementVNode("div", _hoisted_111, [_createElementVNode("label", _hoisted_112, [_cache[63] || (_cache[63] = _createElementVNode("span", null, "مدة الإنتاج / التجهيز بالأيام", -1)), _withDirectives(_createElementVNode("input", {
8252                            type: "number",
8253                            min: "0",
8254                            step: "1",
8255                            "onUpdate:modelValue": $event => ((commercial.production_lead_days) = $event)
8256                          }, null, 8, _hoisted_113), [[
8257                            _vModelText,
8258                            commercial.production_lead_days,
8259                            void 0,
8260                            { number: true }
8261                          ]])]), _createElementVNode("label", _hoisted_114, [_cache[64] || (_cache[64] = _createElementVNode("span", null, "مدة الشحن / Transit بالأيام", -1)), _withDirectives(_createElementVNode("input", {
8262                            type: "number",
8263                            min: "1",
8264                            step: "1",
8265                            "onUpdate:modelValue": $event => ((commercial.transit_days) = $event)
8266                          }, null, 8, _hoisted_115), [[
8267                            _vModelText,
8268                            commercial.transit_days,
8269                            void 0,
8270                            { number: true }
8271                          ]])])])
8272                        ])]))
8273                      : _createCommentVNode("", true),
8274                    _createElementVNode("details", _hoisted_116, [_createElementVNode("summary", null, [_cache[65] || (_cache[65] = _createElementVNode("span", null, [_createElementVNode("i", null, "4"), _createElementVNode("b", null, "المستندات والشروط")], -1)), _createElementVNode("strong", null, _toDisplayString(offerValidUntil?('حتى '+sh
8274ortDate(offerValidUntil)):'أكمل البيانات'), 1)]), _createElementVNode("div", _hoisted_117, [
8275                      _createElementVNode("div", _hoisted_118, [_createElementVNode("label", _hoisted_119, [_cache[66] || (_cache[66] = _createElementVNode("span", null, "رقم Quotation / Proforma", -1)), _withDirectives(_createElementVNode("input", {
8276                        "onUpdate:modelValue": $event => ((proformaNumber) = $event),
8277                        placeholder: "اختياري للبحث؛ مطلوب في Buy Now"
8278                      }, null, 8, _hoisted_120), [[_vModelText, proformaNumber]])]), _createElementVNode("label", _hoisted_121, [_cache[67] || (_cache[67] = _createElementVNode("span", null, [_createTextVNode("HS Code "), _createElementVNode("small", null, "اختياري")], -1)), _withDirectives(_createElementVNode("input", {
8279                        "onUpdate:modelValue": $event => ((commercial.hs_code) = $event),
8280                        placeholder: "مثال 8479.89"
8281                      }, null, 8, _hoisted_122), [[_vModelText, commercial.hs_code]])])]),
8282                      _createElementVNode("label", _hoisted_123, [_cache[68] || (_cache[68] = _createElementVNode("span", null, [_createTextVNode("التعبئة والتغليف "), _createElementVNode("small", null, "اختياري")], -1)), _withDirectives(_createElementVNode("textarea", {
8283                        "onUpdate:modelValue": $event => ((commercial.packing_notes) = $event),
8284                        placeholder: "Cartons / Pallets / Wooden cases / Shipping Marks..."
8285                      }, null, 8, _hoisted_124), [[_vModelText, commercial.packing_notes]])]),
8286                      _createElementVNode("label", _hoisted_125, [_cache[69] || (_cache[69] = _createElementVNode("span", null, "صالح حتى", -1)), _withDirectives(_createElementVNode("input", {
8287                        type: "date",
8288                        "onUpdate:modelValue": $event => ((offerValidUntil) = $event)
8289                      }, null, 8, _hoisted_126), [[_vModelText, offerValidUntil]])]),
8290                      _createElementVNode("label", _hoisted_127, [_cache[70] || (_cache[70] = _createElementVNode("span", null, "شروط السعر والدفع", -1)), _withDirectives(_createElementVNode("textarea", {
8291                        "onUpdate:modelValue": $event => ((offerTerms) = $event),
8292                        placeholder: "شروط السعر والدفع — مطلوبة"
8293                      }, null, 8, _hoisted_128), [[_vModelText, offerTerms]])]),
8294                      _createElementVNode("label", _hoisted_129, [_cache[71] || (_cache[71] = _createElementVNode("span", null, "شروط ومكان وزمن التسليم", -1)), _withDirectives(_createElementVNode("textarea", {
8295                        "onUpdate:modelValue": $event => ((deliveryTerms) = $event),
8296                        placeholder: "شروط ومكان وزمن التسليم — مطلوبة"
8297                      }, null, 8, _hoisted_130), [[_vModelText, deliveryTerms]])])
8298                    ])]),
8299                    _createElementVNode("div", { class: _normalizeClass(["commercialReadinessCard", {ready:commercialReadiness.ready}]) }, [_createElementVNode("div", null, [_cache[72] || (_cache[72] = _createElementVNode("span", { class: "adminEyebrow" }, "فحص واجهة قبل النشر", -1)), _createElementVNode("b", null, _toDisplayString(commercialReadiness.ready?'البيانات الأساسية مكتملة':'راجع الحقول قبل النشر'), 1), _cache[73] || (_cache[73] = _createElementVNode("small", null, "الفحص النهائي يبقى لدى السيرفر.", -1))]), _createElementVNode("div", _hoisted_131, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(commercialReadiness.checks, (c) => {
8300                      return (_openBlock(), _createElementBlock("span", {
8301                        key: c.key,
8302                        class: _normalizeClass({done:c.ok})
8303                      }, [_createElementVNode("i", null, _toDisplayString(c.ok?'✓':'•'), 1), _createTextVNode(_toDisplayString(c.label), 1)], 2))
8304                    }), 128))])], 2),
8305                    _cache[75] || (_cache[75] = _createElementVNode("p", { class: "hint compactHint" }, "النشر يتطلب Quotation أو Proforma مرفقاً. CIF يتطلب تكلفة شحن وتأمين. FCL يتطلب نوع حاوية، والشحن البحري يتطلب CBM.", -1))
8306                  ]))
8307                : (detail.request.status==='quoted')
8308                  ? (_openBlock(), _createElementBlock("section", _hoisted_132, [
8309                      _createElementVNode("div", _hoisted_133, [_createElementVNode("div", null, [_createElementVNode("span", _hoisted_134, "العرض رقم " + _toDisplayString(detail.request.offer_version), 1), _cache[76] || (_cache[76] = _
8309createElementVNode("h3", null, "العرض منشور وينتظر قرار العضو", -1)), _cache[77] || (_cache[77] = _createElementVNode("p", { class: "hint" }, "الإدارة تتابع الوصول والقراءة فقط؛ القبول قرار العضو.", -1))]), _createElementVNode("div", _hoisted_135, [_cache[78] || (_cache[78] = _createElementVNode("small", null, "الإجمالي المنشور", -1)), _createElementVNode("b", null, _toDisplayString(procurementMoney(detail.request.quoted_amount,detail.request.quoted_currency)), 1)])]),
8310                      _createElementVNode("div", _hoisted_136, [
8311                        _createElementVNode("span", null, [_cache[79] || (_cache[79] = _createElementVNode("small", null, "العملة", -1)), _createElementVNode("b", null, _toDisplayString(procurementCurrencyLabel(detail.request.quoted_currency)), 1)]),
8312                        _createElementVNode("span", null, [_cache[80] || (_cache[80] = _createElementVNode("small", null, "Incoterm", -1)), _createElementVNode("b", null, _toDisplayString(detail.request.incoterm||'بدون Incoterm'), 1)]),
8313                        _createElementVNode("span", null, [_cache[81] || (_cache[81] = _createElementVNode("small", null, "الشحن", -1)), _createElementVNode("b", null, _toDisplayString(procurementShippingLabel(detail.request.shipping_mode)), 1)]),
8314                        _createElementVNode("span", null, [_cache[82] || (_cache[82] = _createElementVNode("small", null, "صالح حتى", -1)), _createElementVNode("b", null, _toDisplayString(shortDate(detail.request.offer_valid_until)), 1)])
8315                      ]),
8316                      _createElementVNode("div", _hoisted_137, [
8317                        _createElementVNode("div", _hoisted_138, [_cache[83] || (_cache[83] = _createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "حالة الوصول"), _createElementVNode("h4", null, "هل وصل العرض وفتحه العضو؟")], -1)), _createElementVNode("button", {
8318                          class: "smallbtn secondary",
8319                          onClick: refreshOfferDelivery
8320                        }, "تحديث الحالة", 8, _hoisted_139)]),
8321                        _createElementVNode("div", _hoisted_140, [
8322                          _createElementVNode("div", _hoisted_141, [_cache[85] || (_cache[85] = _createElementVNode("i", null, "1", -1)), _createElementVNode("span", null, [_cache[84] || (_cache[84] = _createElementVNode("b", null, "منشور في حساب العضو", -1)), _createElementVNode("small", null, _toDisplayString(shortDate(offerDelivery.published_at||detail.request.offer_published_at)), 1)])]),
8323                          _createElementVNode("div", { class: _normalizeClass('deliveryStep '+(offerDelivery.notification_read_at?'done':'waiting')) }, [_cache[86] || (_cache[86] = _createElementVNode("i", null, "2", -1)), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(offerDelivery.notification_read_at?'قرأ إشعار العرض':'إشعار العرض غير مقروء'), 1), _createElementVNode("small", null, _toDisplayString(offerDelivery.notification_read_at?shortDate(offerDelivery.notification_read_at):'تم إنشاء الإشعار '+shortDate(offerDelivery.notification_created_at)), 1)])], 2),
8324                          _createElementVNode("div", { class: _normalizeClass('deliveryStep '+(offerDelivery.first_offer_opened_at?'done':'waiting')) }, [_cache[87] || (_cache[87] = _createElementVNode("i", null, "3", -1)), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(offerDelivery.first_offer_opened_at?'فتح صفحة العرض':'لم يفتح صفحة العرض بعد'), 1), (offerDelivery.first_offer_opened_at)
8325                            ? (_openBlock(), _createElementBlock("small", _hoisted_142, "أول فتح " + _toDisplayString(shortDate(offerDelivery.first_offer_opened_at)) + " · " + _toDisplayString(offerDelivery.offer_open_count||1) + " مرة", 1))
8326                            : _createCommentVNode("", true)])], 2),
8327                          _createElementVNode("div", { class: _normalizeClass('deliveryStep '+(offerDelivery.first_document_opened_at?'done':'waiting')) }, [_cache[88] || (_cache[88] = _createElementVNode("i", null, "4", -1)), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(offerDelivery.first_document_opened_at?'فتح مستند العرض':'لم يفتح Quotation / Proforma بعد'), 1), (offerDelivery.first_document_opened_at)
8328                            ? (_openBlock(), _createElementBlock("small", _hoisted_143, "آخر فتح " + _toDisplayString(shortDate(offerDelivery.last_document_opened_at)) + " · " + _toDisplayString(offerDelivery.document_open_count||1) + " مرة", 1))
8329                            : _createCommentVNode("", true)])], 2),
8330                          _createElementVNode("div", { class: _normalizeClass('deliveryStep '+(offerDelivery.whatsapp_queue_status==='sent'?'done':'waiting')) }, [_cache[89] || (_cache[89] = _createElementVNode("i", null, "WA", -1)), _createElementVNode("span", null, [_createElementVNode("b", null, "WhatsApp: " + _toDisplayString(whatsappDeliveryLabel(offerDelivery)), 1), (offerDelivery.whatsapp_sent_at)
8331                            ? (_openBlock(), _createElementBlock("small", _hoisted_144, "قبله مزود الإرسال " + _toDisplayString(shortDate(offerDelivery.whatsapp_sent_at)), 1))
8332                            : (offerDelivery.last_whatsapp_attempt_at)
8333                              ? (_openBlock(), _createElementBlock("small", _hoisted_145, "آخر محاولة " + _toDisplayString(shortDate(offerDelivery.last_whatsapp_attempt_at)), 1))
8334                              : _createCommentVNode("", true)])], 2)
8335                        ]),
8336                        _cache[90] || (_cache[90] = _createElementVNode("p", { class: "hint compactHint" }, "حالة WhatsApp «تم تسليمه لمزوّد WhatsApp» لا تعني أن العميل قرأ الرسالة؛ Delivered/Read لا يظهران إلا عند توفر callback موثوق من المزود.", -1)),
8337                        _createElementVNode("div", _hoisted_146, [_createElementVNode("button", {
8338                          class: "smallbtn",
8339                          disabled: store.state.busy,
8340                          onClick: resendOffer
8341                        }, "إعادة إرسال الإشعار", 8, _hoisted_147), _createElementVNode("button", {
8342                          class: "smallbtn secondary",
8343                          onClick: $event => (memberPreview=!memberPreview)
8344                        }, _toDisplayString(memberPreview?'إخفاء المعاينة':'معاينة ما يراه العضو'), 9, _hoisted_148)]),
8345                        (offerDelivery.resend_count)
8346                          ? (_openBlock(), _createElementBlock("div", _hoisted_149, "أعيد إرسال الإشعار " + _toDisplayString(offerDelivery.resend_count) + " مرة · آخر إعادة " + _toDisplayString(shortDate(offerDelivery.last_resent_at)), 1))
8347                          : _createCommentVNode("", true)
8348                      ]),
8349                      memberPreview
8350                        ? (_openBlock(), _createElementBlock("div", _hoisted_150, [
8351                            _cache[102] || (_cache[102] = _createElementVNode("span", { class: "adminEyebrow" }, "معاينة غير تفاعلية", -1)),
8352                            _cache[103] || (_cache[103] = _createElementVNode("h4", null, "عرض السعر للعضو", -1)),
8353                            _createElementVNode("b", _hoisted_151, _toDisplayString(procurementMoney(detail.request.quoted_amount,detail.request.quoted_currency)), 1),
8354                            _createElementVNode("div", _hoisted_152, [
8355                              _createElementVNode("p", null, [_cache[91] || (_cache[91] = _createElementVNode("b", null, "قيمة المنتجات/الخدمة:", -1)), _createTextVNode(" " + _toDisplayString(procurementMoney(detail.request.goods_amount,detail.request.quoted_currency)), 1)]),
8356                              _createElementVNode("p", null, [_cache[92] || (_cache[92] = _createElementVNode("b", null, "رسوم SMT:", -1)), _createTextVNode(" " + _toDisplayString(detail.request.service_fee_percent) + "% = " + _toDisplayString(procurementMoney(detail.request.service_fee_amount,detail.request.quoted_currency)), 1)]),
8357                              _createElementVNode("p", null, [_cache[93] || (_cache[93] = _createElementVNode("b", null, "الشحن:", -1)), _createTextVNode(" " + _toDisplayString(procurementMoney(detail.request.shipping_amount,detail.request.quoted_currency)), 1)]),
8358                              (Number(detail.request.insurance_amount||0))
8359                                ? (_openBlock(), _createElementBlock("p", _hoisted_153, [_cache[94] || (_cache[94] = _createElementVNode("b", null, "التأمين:", -1)), _createTextVNode(" " + _toDisplayString(procurementMoney(detail.request.insurance_amount,detail.request.quoted_currency)), 1)]))
8360                                : _createCommentVNode("", true),
8361                              _createElementVNode("p", null, [_cache[95] || (_cache[95] = _createElementVNode("b", null, "Incoterm:", -1)), _createTextVNode(" " + _toDisplayString(detail.request.incoterm||'-'), 1)]),
8362                              _createElementVNode("p", null, [_cache[96] || (_cache[96] = _createElementVNode("b", null, "نوع الشحن:", -1)), _createTextVNode(" " + _toDisplayString(procurementShippingLabel(detail.request.shipping_mode)), 1
8362)]),
8363                              (detail.request.container_type)
8364                                ? (_openBlock(), _createElementBlock("p", _hoisted_154, [_cache[97] || (_cache[97] = _createElementVNode("b", null, "الحاوية:", -1)), _createTextVNode(" " + _toDisplayString(procurementContainerLabel(detail.request.container_type)), 1)]))
8365                                : _createCommentVNode("", true),
8366                              (detail.request.gross_weight_kg)
8367                                ? (_openBlock(), _createElementBlock("p", _hoisted_155, [_cache[98] || (_cache[98] = _createElementVNode("b", null, "Gross:", -1)), _createTextVNode(" " + _toDisplayString(detail.request.gross_weight_kg) + " kg", 1)]))
8368                                : _createCommentVNode("", true),
8369                              (detail.request.total_cbm)
8370                                ? (_openBlock(), _createElementBlock("p", _hoisted_156, [_cache[99] || (_cache[99] = _createElementVNode("b", null, "CBM:", -1)), _createTextVNode(" " + _toDisplayString(detail.request.total_cbm), 1)]))
8371                                : _createCommentVNode("", true)
8372                            ]),
8373                            _createElementVNode("p", null, [_cache[100] || (_cache[100] = _createElementVNode("b", null, "شروط العرض:", -1)), _createTextVNode(" " + _toDisplayString(detail.request.offer_terms), 1)]),
8374                            _createElementVNode("p", null, [_cache[101] || (_cache[101] = _createElementVNode("b", null, "شروط التسليم:", -1)), _createTextVNode(" " + _toDisplayString(detail.request.delivery_terms), 1)])
8375                          ]))
8376                        : _createCommentVNode("", true),
8377                      _createElementVNode("div", _hoisted_157, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(procurementQuoteDocuments(detail), (d) => {
8378                        return (_openBlock(), _createElementBlock("div", {
8379                          class: "decisionDocument",
8380                          key: d.id
8381                        }, [_createElementVNode("div", null, [_cache[104] || (_cache[104] = _createElementVNode("span", { class: "adminEyebrow" }, "ضمن العرض المنشور", -1)), _createElementVNode("b", null, _toDisplayString(procurementDocumentLabel(d.document_type)), 1
8381), _createElementVNode("small", null, _toDisplayString(d.original_name), 1)]), _createElementVNode("a", {
8382                          class: "smallbtn secondary",
8383                          href: d.file_url,
8384                          target: "_blank",
8385                          rel: "noopener"
8386                        }, "فتح", 8, _hoisted_158)]))
8387                      }), 128))])
8388                    ]))
8389                  : _createCommentVNode("", true),
8390              (detail.order)
8391                ? (_openBlock(), _createElementBlock("div", _hoisted_159, [_createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(detail.order.order_code), 1), _cache[105] || (_cache[105] = _createElementVNode("span", null, "تم قبول العرض وإنشاء الطلب.", -1))]), _createElementVNode("button", {
8392                    class: "smallbtn",
8393                    onClick: $event => ($router.push('/admin/orders/'+detail.order.id))
8394                  }, "فتح الطلب", 8, _hoisted_160)]))
8395                : _createCommentVNode("", true),
8396              (secondaryNext.length)
8397                ? (_openBlock(), _createElementBlock("section", _hoisted_161, [
8398                    _cache[109] || (_cache[109] = _createElementVNode("div", { class: "memberSectionHead" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "الخطوة التالية"), _createElementVNode("h3", null, "الإجراء الإداري"), _createElementVNode("p", { class: "hint compactHint" }, "اختر الإجراء المناسب فقط بعد مراجعة بيانات الطلب والمستندات.")])], -1)),
8399                    _createElementVNode("label", _hoisted_162, [_cache[106] || (_cache[106] = _createElementVNode("span", null, "ملاحظة الإدارة", -1)), _withDirectives(_createElementVNode("textarea", {
8400                      "onUpdate:modelValue": $event => ((note) = $event),
8401                      placeholder: "اكتب سبب الإرجاع أو الإلغاء، أو ملاحظة المتابعة عند الحاجة"
8402                    }, null, 8, _hoisted_163), [[_vModelText, note]])]),
8403                    _createElementVNode("label", _hoisted_164, [_cache[108] || (_cache[108] = _createElementVNode("span", null, "موعد المتابعة", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((nextActionDays) = $event) }, _cache[107] || (_cache[107] = [
8404                      _createElementVNode("option", { value: "" }, "حسب المدة الافتراضية للمرحلة", -1),
8405                      _createElementVNode("option", { value: "1" }, "خلال يوم", -1),
8406                      _createElementVNode("option", { value: "2" }, "خلال يومين", -1),
8407                      _createElementVNode("option", { value: "3" }, "خلال 3 أيام", -1),
8408                      _createElementVNode("option", { value: "7" }, "خلال 7 أيام", -1),
8409                      _createElementVNode("option", { value: "14" }, "خلال 14 يوماً", -1),
8410                      _createElementVNode("option", { value: "30" }, "خلال 30 يوماً", -1)
8411                    ]), 8, _hoisted_165), [[_vModelSelect, nextActionDays]])]),
8412                    _createElementVNode("div", _hoisted_166, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(secondaryNext, (n) => {
8413                      return (_openBlock(), _createElementBlock("button", {
8414                        key: n,
8415                        class: _normalizeClass(n==='cancelled'?'btn danger':'btn'),
8416                        onClick: $event => (move(n))
8417                      }, _toDisplayString(transitionLabel(n)), 11, _hoisted_167))
8418                    }), 128))])
8419                  ]))
8420                : _createCommentVNode("", true),
8421              _createElementVNode("div", _hoisted_168, [
8422                _cache[112] || (_cache[112] = _createElementVNode("div", { class: "memberSectionHead" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "المستندات"), _createElementVNode("h3", null, "رفع مستند إداري"), _createElementVNode("p", { class: "hint compactHint" }, "أثناء تجهيز العرض تبقى الملفات الجديدة داخلية حتى نشر العرض.")])], -1)),
8423                _createElementVNode("label", _hoisted_169, [_cache[110] || (_cache[110] = _createElementVNode("span", null, "نوع المستند", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((documentType) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(PROCUREMENT_DOCUMENT_LABELS, (label, key) => {
8424                  return (_openBlock(), _createElementBlock("option", {
8425                    key: key,
8426                    value: key
8427                  }, _toDisplayString(label), 9, _hoisted_171))
8428                }), 128))], 8, _hoisted_170), [[_vModelSelect, documentType]])]),
8429                _createElementVNode("label", _hoisted_172, [_createElementVNode("input", {
8430                  type: "file",
8431                  accept: "application/pdf,image/jpeg,image/png,image/webp",
8432                  onChange: onFile
8433                }, null, 40, _hoisted_173), _cache[111] || (_cache[111] = _createElementVNode("span", null, "اختيار مستند", -1)), _createElementVNode("em", null, _toDisplayString(fileLabel), 1)]),
8434                _createElementVNode("button", {
8435                  class: "btn loadMore",
8436                  disabled: store.state.upload&&store.state.upload.active,
8437                  onClick: upload
8438                }, _toDisplayString(store.state.upload&&store.state.upload.active?'جاري الرفع...':'رفع المستند'), 9, _hoisted_174)
8439              ]),
8440              (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(detail.documents, (d) => {
8441                return (_openBlock(), _createElementBlock("div", {
8442                  class: "relatedItem",
8443                  key: d.id
8444                }, [_createElementVNode("b", null, _toDisplayString(procurementDocumentLabel(d.document_type)), 1
8444), _createElementVNode("span", null, _toDisplayString(d.original_name) + " — " + _toDisplayString(d.uploaded_by_type), 1), _createElementVNode("div", _hoisted_175, [_createElementVNode("a", {
8445                  class: "smallbtn secondary",
8446                  href: d.file_url,
8447                  target: "_blank",
8448                  rel: "noopener"
8449                }, "فتح", 8, _hoisted_176), (!['processing','completed'].includes(detail.request.status))
8450                  ? (_openBlock(), _createElementBlock("button", {
8451                      key: 0,
8452                      class: "smallbtn danger",
8453                      onClick: $event => (archiveDocument(d))
8454                    }, "أرشفة", 8, _hoisted_177))
8455                  : _createCommentVNode("", true)])]))
8456              }), 128)),
8457              (memberUpdates.length)
8458                ? (_openBlock(), _createElementBlock("section", _hoisted_178, [_createElementVNode("div", _hoisted_179, [_createElementVNode("div", null, [_cache[113] || (_cache[113] = _createElementVNode("span", { class: "adminEyebrow" }, "تواصل العميل", -1)), _cache[114] || (_cache[114] = _createElementVNode("h3", null, "إشعارات العضو", -1)), _createElementVNode("p", _hoisted_180, _toDisplayString(unreadMemberUpdates?unreadMemberUpdates+' إشعار لم يقرأه العضو بعد':'اطلع العضو على الإشعارات الحالية'), 1)]), _createElementVNode("span", { class: _normalizeClass(unreadMemberUpdates?'statusPill warning':'statusPill') }, _toDisplayString(unreadMemberUpdates?unreadMemberUpdates+' غير مقروء':'مقروء'), 3)]), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(memberUpdates.slice(0,3), (u) => {
8459                    return (_openBlock(), _createElementBlock("div", {
8460                      class: "memberUpdatePreview",
8461                      key: u.id
8462                    }, [_createElementVNode("span", { class: _normalizeClass({unread:!u.read_at}) }, null, 2), _createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(u.title), 1), _createElementVNode("p", null, _toDisplayString(u.body), 1), _createElementVNode("small", null, _toDisplayString(u.read_at?'اطلع عليه العضو':'غير مقروء') + " · " + _toDisplayString(shortDate(u.created_at)), 1)])]))
8463                  }), 128)), (memberUpdates.length>3)
8464                    ? (_openBlock(), _createElementBlock("details", _hoisted_181, [_createElementVNode("summary", null, "عرض كل الإشعارات (" + _toDisplayString(memberUpdates.length) + ")", 1), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(memberUpdates.slice(3), (u) => {
8465                        return (_openBlock(), _createElementBlock("div", {
8466                          class: "relatedItem",
8467                          key: u.id
8468                        }, [_createElementVNode("b", null, _toDisplayString(u.title), 1), _createElementVNode("span", null, _toDisplayString(u.body), 1), _createElementVNode("small", null, _toDisplayString(u.read_at?'اطلع عليه العضو':'غير مقروء') + " · " + _toDisplayString(shortDate(u.created_at)), 1)]))
8469                      }), 128))]))
8470                    : _createCommentVNode("", true)]))
8471                : _createCommentVNode("", true),
8472              _createElementVNode("details", null, [_cache[115] || (_cache[115] = _createElementVNode("summary", null, "سجل الحالة", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(detail.history, (h) => {
8473                return (_openBlock(), _createElementBlock("div", {
8474                  class: "relatedItem",
8475                  key: h.id
8476                }, [_createElementVNode("b", null, _toDisplayString(procurementStatusLabel(h.from_status)) + " → " + _toDisplayString(procurementStatusLabel(h.to_status)), 1), _createElementVNode("span", null, _toDisplayString(h.note||'-'), 1), _createElementVNode("small", null, _toDisplayString(shortDate(h.created_at)), 1)]))
8477              }), 128))])
8478            ]))
8479          : _createCommentVNode("", true)
8480      ]),
8481      _: 1
8482    }))
8483  }
8484}
8485})()
8486  };
8487
8488  const PublicOfficialCircularsPage={
8489    components:{PublicFrame},
8490    setup(){
8491      const store=useGzcStore();const router=useRouter();
8492      const items=computed(()=>safeArray(store.state.circulars));
8493      const unread=computed(()=>items.value.filter(a=>a.unread_by_me).length);
8494      async function load(){if(await store.requireMember(router,'/circulars/all')){const r=await api('/api/announcements?engine=circular');store.state.circulars=safeArray(r.announcements);setTimeout(()=>store.markAnnouncementsRead('circular'),350);}}
8495      function openDetail(a){if(a&&a.id)router.push('/circulars/all/'+encodeURIComponent(a.id));}
8496      onMounted(load);
8497      return{store,items,unread,shortDate,isVerifiedAnnouncement,verificationLabel,compactContentExcerpt,officialSourceName,openDetail};
8498    },
8499    render:(function(){
8500const _Vue = Vue
8501const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
8502
8503const _hoisted_1 = { class: "officialNoticeCard officialCircularPage embassyCard" }
8504const _hoisted_2 = { class: "officialNoticeHead large" }
8505const _hoisted_3 = {
8506  key: 0,
8507  class: "newBadge"
8508}
8509const _hoisted_4 = { class: "guideList contentQueueList" }
8510const _hoisted_5 = {
8511  key: 0,
8512  class: "card emptyCard officialEmptyPage"
8513}
8514const _hoisted_6 = ["onClick"]
8515const _hoisted_7 = { class: "guideCardTop" }
8516const _hoisted_8 = {
8517  key: 0,
8518  class: "guideBadge"
8519}
8520const _hoisted_9 = { class: "contentQueueExcerpt" }
8521const _hoisted_10 = { class: "guideActions row" }
8522const _hoisted_11 = ["onClick"]
8523
8524return function render(_ctx, _cache) {
8525  with (_ctx) {
8526    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, renderList: _renderList, Fragment: _Fragment, createTextVNode: _createTextVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
8527
8528    const _component_PublicFrame = _resolveComponent("PublicFrame")
8529
8530    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "التعميمات الرسمية" }, {
8531      default: _withCtx(() => [_createElementVNode("section", _hoisted_1, [_createElementVNode("div", _hoisted_2, [_cache[0] || (_cache[0] = _createElementVNode("span", { class: "ico" }, "🏛️", -1)), _cache[1] || (_cache[1] = _createElementVNode("div", null, [_createElementVNode("b", null, "التعميمات الرسمية"), _createElementVNode("small", null, "تعميمات سفارات وقنصليات وجهات رسمية موثوقة، حسب دولة العضو.")], -1)), unread
8532        ? (_openBlock(), _createElementBlock("span", _hoisted_3, _toDisplayString(unread), 1))
8533        : _createCommentVNode("", true)])]), _createElementVNode("section", _hoisted_4, [(!items.length&&!store.state.busy)
8534        ? (_openBlock(), _createElementBlock("div", _hoisted_5, _cache[2] || (_cache[2] = [_createElementVNode("b", null, "لا توجد تعميمات منشورة حالياً.", -1), _createElementVNode("p", { class: "hint" }, "سيظهر هنا أي تعميم جديد من المصادر الرسمية الموثوقة المرتبطة بدولتك.", -1)])))
8535        : _createCommentVNode("", true), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (a) => {
8536        return (_openBlock(), _createElementBlock("article", {
8537          class: "card guideItemCard contentQueueCard officialCircularItem",
8538          key: a.id
8539        }, [_createElementVNode("button", {
8540          type: "button",
8541          class: "guideCardOpen",
8542          onClick: $event => (openDetail(a))
8543        }, [_cache[4] || (_cache[4] = _createElementVNode("span", {
8544          class: "guideItemImg icon",
8545          "aria-hidden": "true"
8546        }, "📜", -1)), _createElementVNode("span", null, [
8547          _createElementVNode("span", _hoisted_7, [(a.unread_by_me)
8548            ? (_openBlock(), _createElementBlock("em", _hoisted_8, "جديد"))
8549            : _createCommentVNode("", true), _createElementVNode("small", null, _toDisplayString(shortDate(a.source_published_at || a.created_at)), 1)]),
8550          _createElementVNode("h3", null, _toDisplayString(a.title), 1),
8551          _createElementVNode("p", _hoisted_9, _toDisplayString(compactContentExcerpt(a.body,170)||'اضغط لعرض التعميم.'), 1),
8552          _createElementVNode("small", null, [_createTextVNode(_toDisplayString(a.country_name_ar || a.country_code || ''), 1), (officialSourceName(a))
8553            ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createTextVNode(" · " + _toDisplayString(officialSourceName(a)), 1)], 64))
8554            : _createCommentVNode("", true), (isVerifiedAnnouncement(a))
8555            ? (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [_cache[3] || (_cache[3] = _createTextVNode(" · ")), _createElementVNode("b", null, _toDisplayString(verificationLabel(a)), 1)], 64))
8556            : _createCommentVNode("", true)])
8557        ])], 8, _hoisted_6), _createElementVNode("div", _hoisted_10, [_createElementVNode("button", {
8558          class: "smallbtn secondary",
8559          onClick: $event => (openDetail(a))
8560        }, "فتح التعميم", 8, _hoisted_11)])]))
8561      }), 128))])]),
8562      _: 1
8563    }))
8564  }
8565}
8566})()
8567  };
8568
8569  const PublicAnnouncementsPage={
8570    components:{PublicFrame},
8571    setup(){const store=useGzcStore();const router=useRouter();const general=computed(()=>safeArray(store.state.announcements).filter(a=>a.source_type!=='official'&&a.channel!=='embassy'&&a.channel!=='consulate'&&((a.content_engine||'announcement')==='announcement')));function openDetail(a){if(a&&a.id)router.push('/announcements/'+encodeURIComponent(a.id));}onMounted(async()=>
8571{if(await store.requirePublicAccess(router,'/announcements')){const r=await api('/api/announcements?engine=announcement');store.state.announcements=safeArray(r.announcements);store.state.announcementUnread=Number(r.unread_count||0);store.state.officialAnnouncementUnread=0;setTimeout(()=>store.markAnnouncementsRead('announcement'),600);}});return {store,general,shortDate,isVerifiedAnnouncement,verificationLabel,compactContentExcerpt,openDetail};},
8572    render:(function(){
8573const _Vue = Vue
8574const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
8575
8576const _hoisted_1 = { class: "guideList contentQueueList" }
8577const _hoisted_2 = {
8578  key: 0,
8579  class: "card emptyCard"
8580}
8581const _hoisted_3 = ["onClick"]
8582const _hoisted_4 = { class: "guideCardTop" }
8583const _hoisted_5 = {
8584  key: 0,
8585  class: "guideBadge"
8586}
8587const _hoisted_6 = { class: "contentQueueExcerpt" }
8588const _hoisted_7 = { key: 0 }
8589const _hoisted_8 = { class: "guideActions row" }
8590const _hoisted_9 = ["onClick"]
8591
8592return function render(_ctx, _cache) {
8593  with (_ctx) {
8594    const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, renderList: _renderList, Fragment: _Fragment, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
8595
8596    const _component_PublicFrame = _resolveComponent("PublicFrame")
8597
8598    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "الإعلانات" }, {
8599      default: _withCtx(() => [_cache[1] || (_cache[1] = _createElementVNode("h3", { class: "sectionLabel" }, "إعلانات المنصة", -1)), _createElementVNode("section", _hoisted_1, [(!general.length && !store.state.busy)
8600        ? (_openBlock(), _createElementBlock("div", _hoisted_2, "لا توجد إعلانات حالياً."))
8601        : _createCommentVNode("", true), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(general, (a) => {
8602        return (_openBlock(), _createElementBlock("article", {
8603          class: "card guideItemCard contentQueueCard announcementQueueCard",
8604          key: a.id
8605        }, [_createElementVNode("button", {
8606          type: "button",
8607          class: "guideCardOpen",
8608          onClick: $event => (openDetail(a))
8609        }, [_cache[0] || (_cache[0] = _createElementVNode("span", {
8610          class: "guideItemImg icon",
8611          "aria-hidden": "true"
8612        }, "📢", -1)), _createElementVNode("span", null, [
8613          _createElementVNode("span", _hoisted_4, [(a.unread_by_me)
8614            ? (_openBlock(), _createElementBlock("em", _hoisted_5, "جديد"))
8615            : _createCommentVNode("", true), _createElementVNode("small", null, _toDisplayString(shortDate(a.created_at)), 1)]),
8616          _createElementVNode("h3", null, _toDisplayString(a.title), 1),
8617          _createElementVNode("p", _hoisted_6, _toDisplayString(compactContentExcerpt(a.body,170)||'اضغط لعرض الإعلان.'), 1),
8618          _createElementVNode("small", null, [(isVerifiedAnnouncement(a))
8619            ? (_openBlock(), _createElementBlock("b", _hoisted_7, _toDisplayString(verificationLabel(a)), 1))
8620            : _createCommentVNode("", true), (a.expires_at)
8621            ? (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [_createTextVNode(" · ينتهي " + _toDisplayString(String(a.expires_at).slice(0,10)), 1)], 64))
8622            : _createCommentVNode("", true)])
8623        ])], 8, _hoisted_3), _createElementVNode("div", _hoisted_8, [_createElementVNode("button", {
8624          class: "smallbtn secondary",
8625          onClick: $event => (openDetail(a))
8626        }, "فتح الإعلان", 8, _hoisted_9)])]))
8627      }), 128))])]),
8628      _: 1,
8629      __: [1]
8630    }))
8631  }
8632}
8633})()
8634  };
8635
8636  const AnnouncementDetailPage={
8637    components:{PublicFrame},
8638    setup(){
8639      const store=useGzcStore();const router=useRouter();const route=useRoute();
8640      const item=ref(null);const loading=ref(true);const error=ref('');
8641      const circular=computed(()=>String(route.path||'').indexOf('/circulars/')===0);
8642      const channel=computed(()=>circular.value?(String(route.params.channel||'embassy')==='consulate'?'consulate':'embassy'):'');
8643      const pageTitle=computed(()=>circular.value?(channel.value==='embassy'?'تعميم السفارة':'تعميم القنصلية'):'تفاصيل الإعلان');
8644      function backPath(){return circular.value?'/circulars/'+channel.value:'/announcements';}
8645      function safeHttpUrl(url){return safeExternalHttpUrl(url);}
8646      function publicVerificationNote(x){let note=String((x&&x.verification_note)||'').trim();if(!note)return 'المحتوى معروض كما نُشر في المنصة.';note=note.replace(/^مسودة AI تمت مراجعتها واعتمادها بشرياً\.\s*/,'');note=note.replace('دليل المصدر: الصورة الأصلية المرفوعة','دليل المصدر: الصورة الأصلية من المصدر');note=note.replace('دليل المصدر: ملف PDF الأصلي المرفوع','دليل المصدر: المستند الأصلي من المصدر');return note||'المحتوى معروض كما نُشر في المنصة.';}
8647      function openAttachment(m){if(m&&m.file_url)window.open(m.file_url,'_blank','noopener,noreferrer');}
8648      async function shareItem(){const x=item.value;if(!x)return;return shareDetailContent({title:x.title||pageTitle.value,text:[x.title,x.body].filter(Boolean).join(' — '),url:window.location.href});}
8649      async function load(){loading.value=true;error.value='';item.value=null;const next=String(route.fullPath||backPath());const allowed=circular.value?await store.requireMember(router,next):await store.requirePublicAccess(router,next);if(!allowed){loading.value=false;return;}const qs=new URLSearchParams({engine:circular.value?'circular':'announcement'});if(channel.value)qs.set('channel',channel.value);const r=await api('/api/announcements/'+encodeURIComponent(route.params.id)+'?'+qs.toString());if(r&&r.ok)item.value=r.announcement;else error.value=(r&&(r.message||r.error))||'تعذر تحميل المحتوى';loading.value=false;}
8650      onMounted(load);watch(()=>route.fullPath,load);
8651      return{store,item,loading,error,circular,channel,pageTitle,backPath,safeHttpUrl,publicVerificationNote,openAttachment,shareItem,shortDate,mediaSrc,isVideo,isPdf,isVerifiedAnnouncement,verificationLabel,router};
8652    },
8653    render:(function(){
8654const _Vue = Vue
8655const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
8656
8657const _hoisted_1 = { class: "guideDetailBack" }
8658const _hoisted_2 = ["onClick"]
8659const _hoisted_3 = {
8660  key: 0,
8661  class: "card loadingState contentDetailSkeleton",
8662  role: "status"
8663}
8664const _hoisted_4 = {
8665  key: 1,
8666  class: "card errorState",
8667  role: "alert"
8668}
8669const _hoisted_5 = ["onClick"]
8670const _hoisted_6 = { class: "card guideDetailPageCard contentDetailPage announcementDetailPage" }
8671const _hoisted_7 = { class: "guideDetailHeroBody" }
8672const _hoisted_8 = { class: "notifyMeta" }
8673const _hoisted_9 = { key: 0 }
8674const _hoisted_10 = {
8675  key: 0,
8676  class: "verifyStamp ok"
8677}
8678const _hoisted_11 = { class: "guideDetailDescription announcementBody" }
8679const _hoisted_12 = { class: "guideDetailPrimaryGrid" }
8680const _hoisted_13 = ["href"]
8681const _hoisted_14 = ["onClick"]
8682const _hoisted_15 = {
8683  key: 0,
8684  class: "card guideDetailSection"
8685}
8686const _hoisted_16 = { class: "guideDetailSectionHead" }
8687const _hoisted_17 = { class: "announcementMediaGrid" }
8688const _hoisted_18 = ["onClick"]
8689const _hoisted_19 = ["src"]
8690const _hoisted_20 = ["src"]
8691const _hoisted_21 = {
8692  key: 2,
8693  class: "announcementPdfTile"
8694}
8695const _hoisted_22 = { class: "card guideDetailSection guideVerificationCard" }
8696const _hoisted_23 = { class: "guideDetailSectionHead" }
8697
8698return function render(_ctx, _cache) {
8699  with (_ctx) {
8700    const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, toDisplayString: _toDisplayString, renderList: _renderList, Fragment: _Fragment, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
8701
8702    const _component_PublicFrame = _resolveComponent("PublicFrame")
8703
8704    return (_openBlock(), _createBlock(_component_PublicFrame, { title: pageTitle }, {
8705      default: _withCtx(() => [_createElementVNode("section", _hoisted_1, [_createElementVNode("button", {
8706        type: "button",
8707        class: "smallbtn secondary",
8708        onClick: $event => (router.push(backPath()))
8709      }, "← رجوع", 8, _hoisted_2)]), loading
8710        ? (_openBlock(), _createElementBlock("section", _hoisted_3, _cache[0] || (_cache[0] = [_createElementVNode("span", { class: "loadingSpinner" }, null, -1), _createElementVNode("h3", null, "جاري تحميل المحتوى...", -1)])))
8711        : error
8712          ? (_openBlock(), _createElementBlock("section", _hoisted_4, [_cache[1] || (_cache[1] = _createElementVNode("h3", null, "تعذر فتح المحتوى", -1)), _createElementVNode("p", null, _toDisplayString(error), 1), _createElementVNode("button", {
8713              class: "btn secondary",
8714              onClick: $event => (router.push(backPath()))
8715            }
8715, "العودة", 8, _hoisted_5)]))
8716          : item
8717            ? (_openBlock(), _createElementBlock(_Fragment, { key: 2 }, [_createElementVNode("article", _hoisted_6, [_createElementVNode("div", _hoisted_7, [
8718                _createElementVNode("div", _hoisted_8, [_createElementVNode("span", null, _toDisplayString(shortDate(item.created_at)), 1), (item.expires_at)
8719                  ? (_openBlock(), _createElementBlock("span", _hoisted_9, "ينتهي " + _toDisplayString(String(item.expires_at).slice(0,10)), 1))
8720                  : _createCommentVNode("", true)]),
8721                (isVerifiedAnnouncement(item))
8722                  ? (_openBlock(), _createElementBlock("div", _hoisted_10, _toDisplayString(verificationLabel(item)), 1))
8723                  : _createCommentVNode("", true),
8724                _createElementVNode("h2", null, _toDisplayString(item.title), 1),
8725                _createElementVNode("p", _hoisted_11, _toDisplayString(item.body), 1),
8726                _createElementVNode("div", _hoisted_12, [(safeHttpUrl(item.action_url))
8727                  ? (_openBlock(), _createElementBlock("a", {
8728                      key: 0,
8729                      class: "btn guideMapPrimary",
8730                      href: safeHttpUrl(item.action_url),
8731                      target: "_blank",
8732                      rel: "noopener noreferrer"
8733                    }, "فتح الرابط ↗", 8, _hoisted_13))
8734                  : _createCommentVNode("", true), _createElementVNode("button", {
8735                  class: "btn secondary",
8736                  onClick: shareItem
8737                }, "مشاركة", 8, _hoisted_14)])
8738              ])]), (item.media&&item.media.length)
8739                ? (_openBlock(), _createElementBlock("section", _hoisted_15, [_
8739createElementVNode("div", _hoisted_16, [_cache[3] || (_cache[3] = _createElementVNode("span", null, "📎", -1)), _createElementVNode("div", null, [_cache[2] || (_cache[2] = _createElementVNode("h3", null, "المرفقات", -1)), _createElementVNode("small", null, _toDisplayString(item.media.length) + " ملف", 1)])]), _createElementVNode("div", _hoisted_17, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(item.media, (m) => {
8740                    return (_openBlock(), _createElementBlock("button", {
8741                      key: m.id,
8742                      class: "announcementMediaItem",
8743                      onClick: $event => (openAttachment(m))
8744                    }, [(!isVideo(m) && !isPdf(m))
8745                      ? (_openBlock(), _createElementBlock("img", {
8746                          key: 0,
8747                          src: mediaSrc(m),
8748                          loading: "lazy",
8749                          alt: ""
8750                        }, null, 8, _hoisted_19))
8751                      : (isVideo(m))
8752                        ? (_openBlock(), _createElementBlock("video", {
8753                            key: 1,
8754                            src: m.file_url,
8755                            controls: "",
8756                            preload: "metadata"
8757                          }, null, 8, _hoisted_20))
8758                        : (_openBlock(), _createElementBlock("span", _hoisted_21, "PDF")), _createElementVNode("span", null, _toDisplayString(isPdf(m)?'PDF':(isVideo(m)?'فيديو':'صورة')), 1)], 8, _hoisted_18))
8759                  }), 128))])]))
8760                : _createCommentVNode("", true), _createElementVNode("section", _hoisted_22, [_createElementVNode("div", _hoisted_23, [_cache[5] || (_cache[5] = _createElementVNode("span", null, "✓", -1)), _createElementVNode("div", null, [_cache[4] || (_cache[4] = _createElementVNode("h3", null, "بيانات النشر", -1)), _createElementVNode("small", null, _toDisplayString(item.source_name_ar||item.source_name_en||'إدارة المنصة'), 1)])]), _createElementVNode("p", null, _toDisplayString(publicVerificationNote(item)), 1)])], 64))
8761            : _createCommentVNode("", true)]),
8762      _: 1
8763    }, 8, ["title"]))
8764  }
8765}
8766})()
8767  };
8768
8769  const PublicEventsPage={
8770    components:{PublicFrame},
8771    setup(){
8772      const store=useGzcStore();const router=useRouter();
8773      const loading=ref(true);const loaded=ref(false);const loadError=ref('');
8774      const memberAccess=computed(()=>!!(store.state.me&&store.state.me.authenticated&&(store.state.me.member||store.state.me.official)));
8775      async function load(){
8776        loading.value=true;loadError.value='';
8777        await store.loadMe();
8778        if(memberAccess.value){
8779          const [events,upcoming]=await Promise.all([api('/api/events'),api('/api/events/upcoming')]);
8780          if(events.ok&&upcoming.ok){store.state.events=safeArray(events.events);store.state.upcomingEvents=safeArray(upcoming.events);}
8781          else loadError.value='تعذر تحميل فعاليات العضوية الآن.';
8782        }else{
8783          const r=await api('/api/public/events');
8784          if(r.ok){store.state.events=safeArray(r.events);store.state.upcomingEvents=store.state.events.filter(e=>e.status==='published'&&String(e.event_date||'')>=new Date().toISOString().slice(0,10)).slice(0,8);}
8785          else loadError.value='تعذر تحميل الفعاليات العامة الآن.';
8786        }
8787        loaded.value=true;loading.value=false;
8788      }
8789      function previewMedia(){return [];}
8790      function previewPhotos(){return [];}
8791      function previewVideos(){return [];}
8792      function eventShareUrl(e){return ((window&&window.location&&window.location.origin)||'')+'/events/'+e.id;}
8793      function shareWhatsapp(e){
8794        const lines=['فعالية من منصة SMT China',e.title||'فعالية',e.event_date||'',e.event_time||'',e.location||e.address||'',eventShareUrl(e)].filter(Boolean);
8795        window.open('https://wa.me/?text='+encodeURIComponent(lines.join('\n')),'_blank');
8796      }
8797      onMounted(load);
8798      return {store,loading,loaded,loadError,memberAccess,load,previewMedia,previewPhotos,previewVideos,shareWhatsapp,eventCategoryName,isVideo,mediaSrc};
8799    },
8800    render:(function(){
8801const _Vue = Vue
8802const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
8803
8804const _hoisted_1 = {
8805  key: 0,
8806  class: "card loadingState",
8807  role: "status"
8808}
8809const _hoisted_2 = {
8810  key: 1,
8811  class: "card errorState",
8812  role: "alert"
8813}
8814const _hoisted_3 = ["onClick"]
8815const _hoisted_4 = {
8816  key: 2,
8817  class: "card upcomingEventsCard"
8818}
8819const _hoisted_5 = { class: "memberCardTop" }
8820const _hoisted_6 = { class: "hint" }
8821const _hoisted_7 = { class: "upcomingEventList" }
8822const _hoisted_8 = ["onClick"]
8823const _hoisted_9 = {
8824  key: 3,
8825  class: "card emptyCard"
8826}
8827const _hoisted_10 = {
8828  key: 0,
8829  class: "hint"
8830}
8831const _hoisted_11 = ["onClick"]
8832const _hoisted_12 = ["src"]
8833const _hoisted_13 = { class: "memberCardTop" }
8834const _hoisted_14 = { class: "statusPill" }
8835const _hoisted_15 = { class: "hint" }
8836const _hoisted_16 = { class: "eventQuickMeta" }
8837const _hoisted_17 = { class: "metaRow" }
8838const _hoisted_18 = { class: "metaRow" }
8839const _hoisted_19 = { class: "metaRow" }
8840const _hoisted_20 = {
8841  key: 1,
8842  class: "miniStats mediaMini"
8843}
8844const _hoisted_21 = {
8845  key: 2,
8846  class: "hint"
8847}
8848const _hoisted_22 = {
8849  key: 3,
8850  class: "membersOnlyNotice"
8851}
8852const _hoisted_23 = { class: "row" }
8853const _hoisted_24 = ["onClick"]
8854const _hoisted_25 = ["onClick"]
8855const _hoisted_26 = ["href"]
8856
8857return function render(_ctx, _cache) {
8858  with (_ctx) {
8859    const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, toDisplayString: _toDisplayString, renderList: _renderList, Fragment: _Fragment, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
8860
8861    const _component_PublicFrame = _resolveComponent("PublicFrame")
8862
8863    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "الفعاليات" }, {
8864      default: _withCtx(() => [
8865        (loading && !loaded)
8866          ? (_openBlock(), _createElementBlock("section", _hoisted_1, _c
8866ache[0] || (_cache[0] = [_createElementVNode("span", {
8867              class: "loadingSpinner",
8868              "aria-hidden": "true"
8869            }, null, -1), _createElementVNode("h3", null, "جاري تحميل الفعاليات...", -1)])))
8870          : loadError
8871            ? (_openBlock(), _createElementBlock("section", _hoisted_2, [_cache[1] || (_cache[1] = _createElementVNode("h3", null, "تعذر تحميل الفعاليات", -1)), _createElementVNode("p", null, _toDisplayString(loadError), 1), _createElementVNode("button", {
8872                class: "btn secondary",
8873                onClick: load
8874              }, "إعادة المحاولة", 8, _hoisted_3)]))
8875            : _createCommentVNode("", true),
8876        (store.state.upcomingEvents && store.state.upcomingEvents.length)
8877          ? (_openBlock(), _createElementBlock("section", _hoisted_4, [_createElementVNode("div", _hoisted_5, [_createElementVNode("div", null, [_cache[2] || (_cache[2] = _createElementVNode("span", { class: "vueBadge" }, "فعاليات قادمة", -1)), _cache[3] || (_cache[3] = _createElementVNode("h3", null, "لا تفوّت الفعالية القادمة", -1)), _createElementVNode("p", _hoisted_6, _toDisplayString(memberAccess?'فعاليات العضوية حسب نطاق جاليتك، مع التذكير عبر واتساب عند تفعيله.':'فعاليات عامة اختارت الإدارة نشر معلوماتها للزوار.'), 1)]), _cache[4] || (_cache[4] = _createElementVNode("span", null, "🗓️", -1))]), _createElementVNode("div", _hoisted_7, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(store.state.upcomingEvents, (u) => {
8878              return (_openBlock(), _createElementBlock("button", {
8879                key: 'u'+u.id,
8880                onClick: $event => ($router.push('/events/'+u.id))
8881              }, [_createElementVNode("b", null, _toDisplayString(u.title), 1), _createElementVNode("small", null, _toDisplayString(u.event_date || '-') + " " + _toDisplayString(u.event_time || '') + " · " + _toDisplayString(u.location || u.address_cn || '-'), 1)], 8, _hoisted_8))
8882            }), 128))])]))
8883          : _createCommentVNode("", true),
8884        (loaded && !loading && !loadError && !store.state.events.length)
8885          ? (_openBlock(), _createElementBlock("div", _hoisted_9, [_cache[5] || (_cache[5] = _createElementVNode("h3", null, "لا توجد فعاليات عامة حالياً", -1)), (!memberAccess)
8886              ? (_openBlock(), _createElementBlock("p", _hoisted_10, "يمكنك تسجيل الدخول لعرض فعاليات العضوية، أو العودة لاحقاً عند نشر فعالية عامة."))
8887              : _createCommentVNode("", true), (!memberAccess)
8888              ? (_openBlock(), _createElementBlock("button", {
8889                  key: 1,
8890                  class: "btn secondary",
8891                  onClick: $event => ($router.push({path:'/login',query:{next:'/events'}}))
8892                }, "دخول العضوية", 8, _hoisted_11))
8893              : _createCommentVNode("", true)]))
8894          : _createCommentVNode("", true),
8895        (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(store.state.events, (e) => {
8896          return (_openBlock(), _createElementBlock("div", {
8897            class: "card eventLite eventLiteExpanded",
8898            key: e.id
8899          }, [
8900            (e.cover_url)
8901              ? (_openBlock(), _createElementBlock("img", {
8902                  key: 0,
8903                  class: "eventCover",
8904                  src: e.cover_url,
8905                  loading: "lazy",
8906                  alt: "غلاف الفعالية"
8907                }, null, 8, _hoisted_12))
8908              : _createCommentVNode("", true),
8909            _createElementVNode("div", _hoisted_13, [_createElementVNode("h3", null, _toDisplayString(e.title || 'فعالية'), 1), _createElementVNode("span", _hoisted_14, _toDisplayString(eventCategoryName(e.category)), 1)]),
8910            _createElementVNode("p", _hoisted_15, _toDisplayString(e.description || 'ألبوم الفعالية يظهر مباشرة للأعضاء بدون الحاجة لفتحه في صفحة منفصلة.'), 1),
8911            _createElementVNode("div", _hoisted_16, [_createElementVNode("div", _hoisted_17, [_cache[6] || (_cache[6] = _createElementVNode("b", null, "التاريخ", -1)), _createElementVNode("span", null, _toDisplayString(e.event_date || '-'), 1)]), _createElementVNode("div", _hoisted_18, [_cache[7] || (_cache[7] = _
8911createElementVNode("b", null, "الوقت", -1)), _createElementVNode("span", null, _toDisplayString(e.event_time || '-'), 1)]), _createElementVNode("div", _hoisted_19, [_cache[8] || (_cache[8] = _createElementVNode("b", null, "الموقع", -1)), _createElementVNode("span", null, _toDisplayString(e.location || e.address || '-'), 1)])]),
8912            memberAccess
8913              ? (_openBlock(), _createElementBlock("div", _hoisted_20, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(e.photo_count||0), 1), _cache[9] || (_cache[9] = _createElementVNode("small", null, "صور", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(e.video_count||0), 1), _cache[10] || (_cache[10] = _createElementVNode("small", null, "فيديو", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(e.media_count||0), 1), _cache[11] || (_cache[11] = _createElementVNode("small", null, "وسائط", -1))])]))
8914              : _createCommentVNode("", true),
8915            (memberAccess && e.has_album)
8916              ? (_openBlock(), _createElementBlock("p", _hoisted_21, "الألبوم متاح داخل صفحة الفعالية حتى لا يتم تحميل وسائط جميع الفعاليات دفعة واحدة."))
8917              : (!memberAccess)
8918                ? (_openBlock(), _createElementBlock("div", _hoisted_22, "الألبوم والتفاصيل الداخلية محمية وتظهر بعد دخول العضوية."))
8919                : _createCommentVNode("", true),
8920            _createElementVNode("div", _hoisted_23, [_createElementVNode("button", {
8921              class: "btn secondary",
8922              onClick: $event => (shareWhatsapp(e))
8923            }, "مشاركة على واتساب", 8, _hoisted_24), _createElementVNode("button", {
8924              class: "btn secondary",
8925              onClick: $event => ($router.push('/events/'+e.id))
8926            }, "عرض منفصل", 8, _hoisted_25), (e.amap_url)
8927              ? (_openBlock(), _createElementBlock("a", {
8928                  key: 0,
8929                  class: "btn secondary",
8930                  href: e.amap_url,
8931                  target: "_blank"
8932                }, "فتح الموقع", 8, _hoisted_26))
8933              : _createCommentVNode("", true)])
8934          ]))
8935        }), 128))
8936      ]),
8937      _: 1
8938    }))
8939  }
8940}
8941})()
8942  };
8943
8944  const CompleteProfilePage={
8945    components:{PublicFrame},
8946    setup(){
8947      const store=useGzcStore();const router=useRouter();
8948      const f=reactive({full_name:'',gender:'',china_phone:'',whatsapp:'',wechat:'',category:'',country_code:'',china_city:'',china_district:'',profession:'',workplace:'',university:'',family_count:1});
8949      const tourOpen=ref(false); const tourStep=ref(0); const nameTouched=ref(false);
8950      const locked=computed(()=>{const m=store.state.me&&store.state.me.member;return m&&(m.profile_locked||m.profile_completed_at||['pending','approved','suspended'].includes(String(m.status||'')));});
8951      const nameWords=computed(()=>arabicNameWords(f.full_name).length);
8952      const nameValid=computed(()=>isArabicTripleName(f.full_name));
8953      const completionTips=[
8954        'اكتب الاسم ثلاثي بالعربي فقط، مثال: محمد أحمد علي.',
8955        'اختر دولتك ثم مدينة إقامتك في الصين والحي من القوائم.',
8956        'رقم واتساب الموثق عبر OTP هو رقم دخولك وتصل عليه التنبيهات.',
8957        'عدد الأسرة يعني الموجودين معك في الصين فقط.'
8958      ];
8959      const usageTips=[
8960        {icon:'🪪',title:'بطاقة العضوية',body:'بعد اعتماد العضوية تظهر البطاقة داخل حسابي، ويمكن حفظها في الهاتف مع رمز الاستجابة السريعة.'},
8961        {icon:'📣',title:'الإعلانات',body:'تابع التعميمات الرسمية والفعاليات والتحديثات المهمة من داخل المنصة.'},
8962        {icon:'🧭',title:'دليلك في الصين',body:'استخدم الدليل للوصول للأسواق، المستشفيات، الخدمات، والمعلومات المفيدة.'},
8963        {icon:'🆘',title:'المساعدة والطوارئ',body:'إذا احتجت إلى المساعدة أو واجهت حالة طارئة، أرسل طلباً عبر المنصة ليصل إلى الجهة المختصة.'}
8964      ];
8965      const tourSteps=[
8966        {title:'مرحباً بك في منصة SMT China',body:'يساعدك التسجيل على الاستفادة من العضوية والخدمات والتواصل. أدخل بياناتك بدقة، ثم راجعها قبل إرسال طلب العضوية للإدارة.',points:['تُستخدم بياناتك لتنظيم خدمات المنصة فقط.','يمكنك استخدام المنصة من هاتفك.','بعد اعتماد العضوية ستظهر بطاقتك ورمز QR.']},
8967        {title:'الاسم من أهم البيانات',body:'اكتب اسمك الثلاثي باللغة العربية. سيظهر الاسم في بطاقة العضوية وسجلات الإدارة، لذا اكتبه بوضوح وبالصيغة الرسمية.',example:'مثال: محمد أحمد علي',points:['استخدم اسمك الحقيقي.','اكتب الاسم بالعربية.','يجب أن يتكوّن الاسم من ثلاثة أجزاء.']},
8968        {title:'اختر من القوائم',body:'اختر الدولة ومدينة الإقامة والحي والفئة والمهنة من القوائم؛ فهذا يساعد على حفظ بياناتك بصورة صحيحة.',points:['اختر دولتك أولاً، ثم مدينة إقامتك في الصين.','تتغير الأحياء المتاحة بحسب المدينة.','إذا غيّرت المدينة، فاختر الحي من جديد.','يمكن للإدارة إضافة أي خيار غير موجود.']},
8969        {title:'أرقام التواصل',body:'رقم واتساب الموثق عبر OTP هو هوية الدخول ولا يتغير من نموذج الإكمال. أضف رقم الصين إن وجد.',points:['تعديل رقم واتساب يتم عبر لجنة العضوية بعد التحقق.','مثال الصين: 8613xxxxxxxxx.','مثال السودان: 2499xxxxxxxx.']},
8970        {title:'كيف تستخدم المنصة بعد التسجيل؟',body:'بعد الإرسال انتظر اعتماد الإدارة. بعدها افتح حسابي لعرض بطاقة العضوية، وتابع الإعلانات والفعاليات والألبومات واستفد من دليل الصين وخدمات المساعدة.',points:['حسابي: لعرض بياناتك وبطاقة العضوية.','الإعلانات: للتعميمات المهمة.','دليلك في الصين: معلومات وخدمات.','المساعدة والطوارئ: للحالات التي تحتاج متابعة.']},
8971        {title:'راجع قبل الإرسال',body:'بعد الضغط على تأكيد وإرسال، البيانات تُقفل وتذهب للمراجعة. أي تعديل لاحق يتم عبر الإدارة أو لجنة العضوية.',points:['راجع الاسم ثلاثي بالعربي.','راجع المدينة والحي.','راجع رقم واتساب.','راجع عدد أفراد الأسرة.']}
8972      ];
8973      onMounted(async()=>{if(await store.requireMember(router,'/complete')){const m=store.state.me.member||{};Object.keys(f).forEach(k=>{if(m[k]!=null)f[k]=m[k]}); if(!Number(f.family_count||0))f.family_count=1; tourOpen.value=!m.profile_tour_seen_at&&!locked.value;}});
8974      async function finishTour(){tourOpen.value=false;tourStep.value=0;try{await api('/api/member/profile-tour/seen',{method:'POST',body:JSON.stringify({})});await store.loadMe();}catch(e){}}
8975      function openTour(){tourStep.value=0;tourOpen.value=true;}
8976      function nextTour(){if(tourStep.value<tourSteps.length-1)tourStep.value++;else finishTour();}
8977      function prevTour(){if(tourStep.value>0)tourStep.value--;}
8978      async function submit(){
8979        nameTouched.value=true;
8980        const family=Number(f.family_count||0);
8981        if(!nameValid.value){store.state.msg='الاسم مطلوب ثلاثي بالعربي، مثال: محمد أحمد علي';return;}
8982        if(!f.country_code){store.state.msg='اختر دولتك من القائمة';return;}
8983        if(!f.china_city){store.state.msg='اختر مدينة إقامتك في الصين';return;}
8984        if(family<1){store.state.msg='عدد أفراد الأسرة يجب أن يكون 1 على الأقل، لأن العضو نفسه محسوب.';return;}
8985        store.state.busy=true;store.state.msg='جاري حفظ البيانات...';
8986        const payload=Object.assign({},f,{full_name:String(f.full_name||'').trim(),china_phone:norm(f.china_phone),whatsapp:norm(f.whatsapp),family_count:family});
8987        const r=await api('/api/members/complete',{method:'POST',body:JSON.stringify(payload)});
8988        store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok){await store.loadMe();router.replace('/account');}
8989      }
8990      return {store,f,locked,submit,tourOpen,tourStep,tourSteps,nextTour,prevTour,finishTour,openTour,nameTouched,nameWords,nameValid,completionTips,usageTips};
8991    },
8992    render:(function(){
8993const _Vue = Vue
8994const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
8995
8996const _hoisted_1 = {
8997  key: 0,
8998  class: "tourOverlay",
8999  role: "dialog",
9000  "aria-modal": "true"
9001}
9002const _hoisted_2 = { class: "tourCard tourCardLarge" }
9003const _hoisted_3 = { class: "tourProgress" }
9004const _hoisted_4 = { class: "tourStepCount" }
9005const _hoisted_5 = {
9006  key: 0,
9007  class: "tourExample"
9008}
9009const _hoisted_6 = {
9010  key: 1,
9011  class: "tourPoints"
9012}
9013const _hoisted_7 = { class: "tourActions" }
9014const _hoisted_8 = ["onClick"]
9015const _hoisted_9 = ["onClick"]
9016const _hoisted_10 = ["onClick"]
9017const _hoisted_11 = {
9018  key: 1,
9019  class: "card"
9020}
9021const _hoisted_12 = ["onClick"]
9022const _hoisted_13 = {
9023  key: 2,
9024  class: "profileCompleteWrap"
9025}
9026const _hoisted_14 = { class: "card onboardingGuide" }
9027const _hoisted_15 = ["onClick"]
9028const _hoisted_16 = { class: "card quickTipsCard" }
9029const _hoisted_17 = { class: "card profileCompleteCard" }
9030const _hoisted_18 = { class: "fieldHelpLabel requiredField" }
9031const _hoisted_19 = ["onUpdate:modelValue", "onBlur"]
9032const _hoisted_20 = ["onUpdate:modelValue"]
9033const _hoisted_21 = ["value"]
9034const _hoisted_22 = { class: "fieldHelpLabel" }
9035const _hoisted_23 = ["onUpdate:modelValue"]
9036const _hoisted_24 = ["onUpdate:modelValue"]
9037const _hoisted_25 = ["onUpdate:modelValue"]
9038const _hoisted_26 = ["onUpdate:modelValue"]
9039const _hoisted_27 = ["value"]
9040const _hoisted_28 = { class: "fieldHelpLabel requiredField" }
9041const _hoisted_29 = ["onUpdate:modelValue"]
9042const _hoisted_30 = ["value"]
9043const _hoisted_31 = ["onUpdate:modelValue", "onChange"]
9044const _hoisted_32 = ["value"]
9045const _hoisted_33 = ["onUpdate:modelValue"]
9046const _hoisted_34 = ["value"]
9047const _hoisted_35 = ["onUpdate:modelValue"]
9048const _hoisted_36 = ["value"]
9049const _hoisted_37 = ["onUpdate:modelValue"]
9050const _hoisted_38 = ["onUpdate:modelValue"]
9051const _hoisted_39 = { class: "fieldHelpLabel" }
9052const _hoisted_40 = ["onUpdate:modelValue"]
9053const _hoisted_41 = ["onClick"]
9054const _hoisted_42 = { class: "card usageGuideCard" }
9055const _hoisted_43 = { class: "usageGrid" }
9056
9057return function render(_ctx, _cache) {
9058  with (_ctx) {
9059    const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, normalizeClass: _normalizeClass, createElementVNode: _
9059createElementVNode, toDisplayString: _toDisplayString, createCommentVNode: _createCommentVNode, vModelText: _vModelText, withDirectives: _withDirectives, vModelSelect: _vModelSelect, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
9060
9061    const _component_PublicFrame = _resolveComponent("PublicFrame")
9062
9063    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "إكمال البيانات" }, {
9064      default: _withCtx(() => [tourOpen
9065        ? (_openBlock(), _createElementBlock("div", _hoisted_1, [_createElementVNode("div", _hoisted_2, [
9066            _createElementVNode("div", _hoisted_3, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(tourSteps, (s, i) => {
9067              return (_openBlock(), _createElementBlock("span", {
9068                key: i,
9069                class: _normalizeClass({active:i===tourStep})
9070              }, null, 2))
9071            }), 128))]),
9072            _createElementVNode("div", _hoisted_4, "خطوة " + _toDisplayString(tourStep+1) + " من " + _toDisplayString(tourSteps.length), 1),
9073            _createElementVNode("h3", null, _toDisplayString(tourSteps[tourStep].title), 1),
9074            _createElementVNode("p", null, _toDisplayString(tourSteps[tourStep].body), 1),
9075            (tourSteps[tourStep].example)
9076              ? (_openBlock(), _createElementBlock("div", _hoisted_5, _toDisplayString(tourSteps[tourStep].example), 1))
9077              : _createCommentVNode("", true),
9078            (tourSteps[tourStep].points)
9079              ? (_openBlock(), _createElementBlock("ul", _hoisted_6, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(tourSteps[tourStep].points, (p) => {
9080                  return (_openBlock(), _createElementBlock("li", { key: p }, _toDisplayString(p), 1))
9081                }), 128))]))
9082              : _createCommentVNode("", true),
9083            _createElementVNode("div", _hoisted_7, [(tourStep>0)
9084              ? (_openBlock(), _createElementBlock("button", {
9085                  key: 0,
9086                  class: "smallbtn secondary",
9087                  onClick: prevTour
9088                }, "السابق", 8, _hoisted_8))
9089              : _createCommentVNode("", true), _createElementVNode("button", {
9090              class: "smallbtn ghost",
9091              onClick: finishTour
9092            }, "تخطي", 8, _hoisted_9), _createElementVNode("button", {
9093              class: "btn",
9094              onClick: nextTour
9095            }, _toDisplayString(tourStep===tourSteps.length-1?'بدء تعبئة البيانات':'التالي'), 9, _hoisted_10)])
9096          ])]))
9097        : _createCommentVNode("", true), locked
9098        ? (_openBlock(), _createElementBlock("div", _hoisted_11, [_cache[0] || (_cache[0] = _createElementVNode("h3", null, "بياناتك مقفولة", -1)), _cache[1] || (_cache[1] = _createElementVNode("p", { class: "hint" }, "إكمال البيانات يتم مرة واحدة فقط. أي تعديل لاحق يتم عبر الإدارة أو لجنة العضوية.", -1)), _createElementVNode("button", {
9099            class: "btn",
9100            onClick: $event => ($router.push('/account'))
9101          }, "عرض البطاقة داخل حسابي", 8, _hoisted_12)]))
9102        : (_openBlock(), _createElementBlock("div", _hoisted_13, [
9103            _createElementVNode("section", _hoisted_14, [_cache[2] || (_cache[2] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "دليل التسجيل"), _createElementVNode("h3", null, "قبل البدء"), _createElementVNode("p", null, "تُستخدم هذه البيانات لإعداد العضوية والبطاقة وتسهيل التواصل. تذكّر كتابة اسمك الثلاثي باللغة العربية.")], -1)), _createElementVNode("button", {
9104              class: "smallbtn secondary",
9105              onClick: openTour
9106            }, "عرض التعليمات", 8, _hoisted_15)]),
9107            _createElementVNode("section", _hoisted_16, [_cache[3] || (_cache[3] = _createElementVNode("h3", null, "تذكير سريع", -1)), _createElementVNode("ul", null, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(completionTips, (t) => {
9108              return (_openBlock(), _createElementBlock("li", { key: t }, _toDisplayString(t), 1))
9109            }), 128))])]),
9110            _createElementVNode("div", _hoisted_17, [
9111              _cache[17] || (_cache[17] = _createElementVNode("h3", null, "إكمال بيانات العضو", -1)),
9112              _cache[18] || (_cache[18] = _createElementVNode("p", { class: "hint" }, "اكتب البيانات بدقة. بعد الإرسال ستُرسل للمراجعة ولا يمكن تعديلها إلا عبر الإدارة.", -1)),
9113              _createElementVNode("label", _hoisted_18, [_cache[4] || (_cache[4] = _createElementVNode("span", null, "الاسم الثلاثي بالعربي", -1)), _withDirectives(_createElementVNode("input", {
9114                "onUpdate:modelValue": $event => ((f.full_name) = $event),
9115                onBlur: $event => (nameTouched=true),
9116                placeholder: "مثال: محمد أحمد علي"
9117              }, null, 40, _hoisted_19), [[_vModelText, f.full_name]]), _createElementVNode("em", { class: _normalizeClass({bad:nameTouched&&!nameValid,ok:nameValid}) }, _toDisplayString(nameValid?'الاسم واضح ومناسب للبطاقة':'مطلوب 3 كلمات عربية على الأقل. الحالي: '+nameWords), 3)]),
9118              _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((f.gender) = $event) }, [_cache[5] || (_cache[5] = _createElementVNode("option", { value: "" }, "الجنس", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList($optionList('gender',f.gender), (o) => {
9119                return (_openBlock(), _createElementBlock("option", {
9120                  key: o.value,
9121                  value: o.value
9122                }, _toDisplayString(o.label), 9, _hoisted_21))
9123              }), 128))], 8, _hoisted_20), [[_vModelSelect, f.gender]]),
9124              _createElementVNode("label", _hoisted_22, [_cache[6] || (_cache[6] = _createElementVNode("span", null, "واتساب الموثق عبر OTP", -1)), _withDirectives(_createElementVNode("input", {
9125                class: "ltr",
9126                "onUpdate:modelValue": $event => ((f.whatsapp) = $event),
9127                readonly: ""
9128              }, null, 8, _hoisted_23), [[_vModelText, f.whatsapp]]), _cache[7] || (_cache[7] = _createElementVNode("em", null, "تعديل رقم الدخول يتم عبر لجنة العضوية بعد التحقق.", -1))]),
9129              _withDirectives(_createElementVNode("input", {
9130                class: "ltr",
9131                "onUpdate:modelValue": $event => ((f.china_phone) = $event),
9132                placeholder: "هاتف الصين"
9133              }, null, 8, _hoisted_24), [[_vModelText, f.china_phone]]),
9134              _withDirectives(_createElementVNode("input", {
9135                "onUpdate:modelValue": $event => ((f.wechat) = $event),
9136                placeholder: "WeChat"
9137              }, null, 8, _hoisted_25), [[_vModelText, f.wechat]]),
9138              _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((f.category) = $event) }, [_cache[8] || (_cache[8] = _createElementVNode("option", { value: "" }, "فئة العضوية", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList($optionList('member_category',f.category), (o) => {
9139                return (_openBlock(), _createElementBlock("option", {
9140                  key: o.value,
9141                  value: o.value
9142                }, _toDisplayString(o.label), 9, _hoisted_27))
9143              }), 128))], 8, _hoisted_26), [[_vModelSelect, f.category]]),
9144              _createElementVNode("label", _hoisted_28, [_cache[10] || (_cache[10] = _createElementVNode("span", null, "الدولة", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((f.country_code) = $event) }, [_cache[9] || (_cache[9] = _createElementVNode("option", { value: "" }, "اختر دولتك", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList($countryList(f.country_code), (c) => {
9145                return (_openBlock(), _createElementBlock("option", {
9146                  key: c.value,
9147                  value: c.value
9148                }, _toDisplayString(c.label), 9, _hoisted_30))
9149              }), 128))], 8, _hoisted_29), [[_vModelSelect, f.country_code]]), _cache[11] || (_cache[11] = _createElementVNode("em", null, "تحدد التعميمات الرسمية المناسبة لحسابك.", -1))]),
9150              _withDirectives(_createElementVNode("select", {
9151                "onUpdate:modelValue": $event => ((f.china_city) = $event),
9152                onChange: $event => (f.china_district='')
9153              }, [_cache[12] || (_cache[12] = _createElementVNode("option", { value: "" }, "اختر مدينة الإقامة في الصين", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList($cityList(f.china_city), (c) => {
9154                return (_openBlock(), _createElementBlock("option", {
9155                  key: c.value,
9156                  value: c.value
9157                }, _toDisplayString(c.label), 9, _hoisted_32))
9158              }), 128))], 40, _hoisted_31), [[_vModelSelect, f.china_city]]),
9159              _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((f.china_district) = $event) }, [_cache[13] || (_cache[13] = _createElementVNode("option", { value: "" }, "اختر الحي / المنطقة", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList($districtList(f.china_city,f.china_district), (d) => {
9160                return (_openBlock(), _createElementBlock("option", {
9161                  key: d.value,
9162                  value: d.value
9163                }, _toDisplayString(d.label), 9, _hoisted_34))
9164              }), 128))], 8, _hoisted_33), [[_vModelSelect, f.china_district]]),
9165              _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((f.profession) = $event) }, [_cache[14] || (_cache[14] = _createElementVNode("option", { value: "" }, "اختر المهنة", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList($professionList(f.profession), (p) => {
9166                return (_openBlock(), _createElementBlock("option", {
9167                  key: p.value,
9168                  value: p.value
9169                }, _toDisplayString(p.label), 9, _hoisted_36))
9170              }), 128))], 8, _hoisted_35), [[_vModelSelect, f.profession]]),
9171              _withDirectives(_createElementVNode("input", {
9172                "onUpdate:modelValue": $event => ((f.workplace) = $event),
9173                placeholder: "جهة العمل"
9174              }, null, 8, _hoisted_37), [[_vModelText, f.workplace]]),
9175              _withDirectives(_createElementVNode("input", {
9176                "onUpdate:modelValue": $event => ((f.university) = $event),
9177                placeholder: "الجامعة"
9178              }, null, 8, _hoisted_38), [[_vModelText, f.university]]),
9179              _createElementVNode("label", _hoisted_39, [_cache[15] || (_cache[15] = _createElementVNode("span", null, "عدد أفراد الأسرة", -1)), _withDirectives(_createElementVNode("input", {
9180                type: "number",
9181                min: "1",
9182                "onUpdate:modelValue": $event => ((f.family_count) = $event),
9183                placeholder: "عدد أفراد الأسرة"
9184              }, null, 8, _hoisted_40), [[_vModelText, f.family_count]]), _cache[16] || (_cache[16] = _createElementVNode("em", null, "يشمل: أنت + الزوجة/الزوج + الأبناء أقل من 18 سنة الموجودين في الصين.", -1))]),
9185              _cache[19] || (_cache[19] = _createElementVNode("div", { class: "privacyNote" }, "تُستخدم البيانات لتنظيم خدمات المنصة والتواصل والتعميمات المناسبة عند الحاجة، ولا تُعرض إلا للجهات المخولة داخل المنصة.", -1)),
9186              _createElementVNode("button", {
9187                class: "btn loadMore",
9188                onClick: submit
9189              }, "تأكيد وإرسال البيانات", 8, _hoisted_41)
9190            ]),
9191            _createElementVNode("section", _hoisted_42, [_cache[20] || (_cache[20] = _createElementVNode("h3", null, "بعد التسجيل تستخدم المنصة كيف؟", -1)), _createElementVNode("div", _hoisted_43, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(usageTips, (u) => {
9192              return (_openBlock(), _createElementBlock("div", {
9193                key: u.title,
9194                class: "usageMini"
9195              }, [_createElementVNode("span", null, _toDisplayString(u.icon), 1), _createElementVNode("b", null, _toDisplayString(u.title), 1), _createElementVNode("small", null, _toDisplayString(u.body), 1)]))
9196            }), 128))])])
9197          ]))]),
9198      _: 1
9199    }))
9200  }
9201}
9202})()
9203  };
9204
9205  const ArrivalPage={
9206    components:{PublicFrame},
9207    setup(){
9208      const store=useGzcStore();const router=useRouter();
9208const f=reactive({full_name:'',china_phone:'',whatsapp:'',china_city:'Guangzhou',china_district:'',type:'طالب',description:''});const code=ref('');const otp=ref(false);const verified=ref(false);
9209      onMounted(()=>store.loadMe());
9210      async function requestOtp(){const phone=norm(f.whatsapp||f.china_phone);if(!phone){store.state.msg='رقم واتساب مطلوب';return;}store.state.busy=true;store.state.msg='جاري إرسال كود التحقق...';const r=await api('/api/auth/request-otp',{method:'POST',body:JSON.stringify({phone,purpose:'arrival_request'})});store.state.busy=false;store.state.msg=r.message||r.error||'';otp.value=!!r.ok;}
9211      async function verifyOtp(){const phone=norm(f.whatsapp||f.china_phone);store.state.busy=true;store.state.msg='جاري التحقق...';const r=await api('/api/auth/verify-otp',{method:'POST',body:JSON.stringify({phone,code:code.value,purpose:'arrival_request'})});store.state.busy=false;store.state.msg=r.message||r.error||'';verified.value=!!r.ok;}
9212      async function submit(){if(!verified.value){store.state.msg='تحقق من رقم واتساب أولاً';return;}store.state.busy=true;store.state.msg='جاري تسجيل الوصول...';const payload=Object.assign({},f,{whatsapp:norm(f.whatsapp),china_phone:norm(f.china_phone),description:(f.type?('نوع القادم: '+f.type+'\n'):'')+(f.description||'')});const r=await api('/api/arrival',{method:'POST',body:JSON.stringify(payload)});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok)router.push('/');}
9213      return {store,f,code,otp,verified,requestOtp,verifyOtp,submit};
9214    },
9215    render:(function(){
9216const _Vue = Vue
9217const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
9218
9219const _hoisted_1 = {
9220  key: 0,
9221  class: "card"
9222}
9223const _hoisted_2 = ["onClick"]
9224const _hoisted_3 = {
9225  key: 1,
9226  class: "card"
9227}
9228const _hoisted_4 = ["onUpdate:modelValue"]
9229const _hoisted_5 = ["onUpdate:modelValue"]
9230const _hoisted_6 = ["onUpdate:modelValue"]
9231const _hoisted_7 = ["onUpdate:modelValue", "onChange"]
9232const _hoisted_8 = ["value"]
9233const _hoisted_9 = ["onUpdate:modelValue"]
9234const _hoisted_10 = ["value"]
9235const _hoisted_11 = ["onUpdate:modelValue"]
9236const _hoisted_12 = ["value"]
9237const _hoisted_13 = ["onUpdate:modelValue"]
9238const _hoisted_14 = { class: "otpBox" }
9239const _hoisted_15 = ["onClick"]
9240const _hoisted_16 = ["onUpdate:modelValue"]
9241const _hoisted_17 = ["onClick"]
9242const _hoisted_18 = {
9243  key: 1,
9244  class: "okText"
9245}
9246const _hoisted_19 = ["disabled", "onClick"]
9247
9248return function render(_ctx, _cache) {
9249  with (_ctx) {
9250    const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, vModelText: _vModelText, withDirectives: _withDirectives, renderList: _renderList, Fragment: _Fragment, toDisplayString: _toDisplayString, vModelSelect: _vModelSelect, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
9251
9252    const _component_PublicFrame = _resolveComponent("PublicFrame")
9253
9254    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "وصلت حديثاً" }, {
9255      default: _withCtx(() => [(store.state.me&&store.state.me.authenticated)
9256        ? (_openBlock(), _createElementBlock("div", _hoisted_1, [_cache[0] || (_cache[0] = _createElementVNode("h3", null, "هذه الخدمة للزائرين غير المسجلين فقط", -1)), _cache[1] || (_cache[1] = _createElementVNode("p", { class: "hint" }, "بعد تسجيل الدخول بياناتك معروفة للنظام.", -1)), _createElementVNode("button", {
9257            class: "btn",
9258            onClick: $event => ($router.push('/'))
9259          }, "الرئيسية", 8, _hoisted_2)]))
9260        : (_openBlock(), _createElementBlock("div", _hoisted_3, [
9261            _cache[4] || (_cache[4] = _createElementVNode("h3", null, "تسجيل وصول جديد", -1)),
9262            _cache[5] || (_cache[5] = _createElementVNode("p", { class: "hint" }, "طلب استقبال وليس عضوية تلقائية. التحقق بالواتساب مطلوب قبل الإرسال.", -1)),
9263            _withDirectives(_createElementVNode("input", {
9264              "onUpdate:modelValue": $event => ((f.full_name) = $event),
9265              placeholder: "الاسم"
9266            }, null, 8, _hoisted_4), [[_vModelText, f.full_name]]),
9267            _withDirectives(_createElementVNode("input", {
9268              class: "ltr",
9269              "onUpdate:modelValue": $event =>
9269 ((f.china_phone) = $event),
9270              placeholder: "رقم الهاتف في الصين"
9271            }, null, 8, _hoisted_5), [[_vModelText, f.china_phone]]),
9272            _withDirectives(_createElementVNode("input", {
9273              class: "ltr",
9274              "onUpdate:modelValue": $event => ((f.whatsapp) = $event),
9275              placeholder: "رقم واتساب"
9276            }, null, 8, _hoisted_6), [[_vModelText, f.whatsapp]]),
9277            _withDirectives(_createElementVNode("select", {
9278              "onUpdate:modelValue": $event => ((f.china_city) = $event),
9279              onChange: $event => (f.china_district='')
9280            }, [_cache[2] || (_cache[2] = _createElementVNode("option", { value: "" }, "اختر المدينة في الصين", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList($cityList(f.china_city), (c) => {
9281              return (_openBlock(), _createElementBlock("option", {
9282                key: c.value,
9283                value: c.value
9284              }, _toDisplayString(c.label), 9, _hoisted_8))
9285            }), 128))], 40, _hoisted_7), [[_vModelSelect, f.china_city]]),
9286            _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((f.china_district) = $event) }, [_cache[3] || (_cache[3] = _createElementVNode("option", { value: "" }, "اختر الحي / المنطقة", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList($districtList(f.china_city,f.china_district), (d) => {
9287              return (_openBlock(), _createElementBlock("option", {
9288                key: d.value,
9289                value: d.value
9290              }, _toDisplayString(d.label), 9, _hoisted_10))
9291            }), 128))], 8, _hoisted_9), [[_vModelSelect, f.china_district]]),
9292            _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((f.type) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList($optionList('member_category',f.type), (o) => {
9293              return (_openBlock(), _createElementBlock("option", {
9294                key: o.value,
9295                value: o.value
9296              }, _toDisplayString(o.label), 9, _hoisted_12))
9297            }), 128))], 8, _hoisted_11), [[_vModelSelect, f.type]]),
9298            _withDirectives(_createElementVNode("textarea", {
9299              "onUpdate:modelValue": $event => ((f.description) = $event),
9300              placeholder: "هل تحتاج سكن؟ ترجمة؟ استقبال؟"
9301            }, null, 8, _hoisted_13), [[_vModelText, f.description]]),
9302            _createElementVNode("div", _hoisted_14, [_createElementVNode("button", {
9303              class: "btn secondary loadMore",
9304              onClick: requestOtp
9305            }, "إرسال رمز التحقق", 8, _hoisted_15), otp
9306              ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_withDirectives(_createElementVNode("input", {
9307                  class: "ltr",
9308                  "onUpdate:modelValue": $event => ((code) = $event),
9309                  placeholder: "رمز التحقق"
9310                }, null, 8, _hoisted_16), [[_vModelText, code]]), _createElementVNode("button", {
9311                  class: "btn secondary loadMore",
9312                  onClick: verifyOtp
9313                }, "تحقق من الرمز", 8, _hoisted_17)], 64))
9314              : _createCommentVNode("", true), verified
9315              ? (_openBlock(), _createElementBlock("p", _hoisted_18, "✅ تم التحقق من الرقم"))
9316              : _createCommentVNode("", true)]),
9317            _createElementVNode("button", {
9318              class: "btn loadMore",
9319              disabled: !verified,
9320              onClick: submit
9321            }, "إرسال", 8, _hoisted_19)
9322          ]))]),
9323      _: 1
9324    }))
9325  }
9326}
9327})()
9328  };
9329
9330  const HelpPage={
9331    components:{PublicFrame},
9332    setup(){const store=useGzcStore();const router=useRouter();const f=reactive({type:'other',description:''});const files=ref([]);const fileLabel=computed(()=>mediaPreviewLabel(files.value));function onFiles(e){files.value=Array.from((e.target&&e.target.files)||[]).slice(0,3);}onMounted(()=>store.requireMember(router,'/help'));async function submit(){const fd=new FormData();fd.append('type',f.type);fd.append('description',f.description);
9332Array.from(files.value||[]).forEach(file=>fd.append('media',file));store.state.busy=true;store.state.msg='جاري إرسال طلب المساعدة...';const r=await uploadApi('/api/help',{method:'POST',body:fd,headers:{'Accept':'application/json'},uploadLabel:'إرسال مرفقات طلب المساعدة'});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok){f.description='';files.value=[];router.push('/');}}return {store,f,files,fileLabel,onFiles,submit};},
9333    render:(function(){
9334const _Vue = Vue
9335const { createElementVNode: _createElementVNode } = _Vue
9336
9337const _hoisted_1 = { class: "card" }
9338const _hoisted_2 = ["onUpdate:modelValue"]
9339const _hoisted_3 = ["value"]
9340const _hoisted_4 = ["onUpdate:modelValue"]
9341const _hoisted_5 = { class: "filePicker caseFilePicker" }
9342const _hoisted_6 = ["onChange"]
9343const _hoisted_7 = ["onClick"]
9344
9345return function render(_ctx, _cache) {
9346  with (_ctx) {
9347    const { createElementVNode: _createElementVNode, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, toDisplayString: _toDisplayString, vModelSelect: _vModelSelect, withDirectives: _withDirectives, vModelText: _vModelText, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
9348
9349    const _component_PublicFrame = _resolveComponent("PublicFrame")
9350
9351    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "أحتاج مساعدة" }, {
9352      default: _withCtx(() => [_createElementVNode("div", _hoisted_1, [
9353        _cache[1] || (_cache[1] = _createElementVNode("h3", null, "طلب مساعدة", -1)),
9354        _cache[2] || (_cache[2] = _createElementVNode("p", { class: "hint" }, "اختر النوع واكتب التفاصيل. يمكن إرفاق حتى 3 صور توضيحية تظهر للإدارة فقط.", -1)),
9355        _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((f.type) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList($optionList('help_type',f.type), (o) => {
9356          return (_openBlock(), _createElementBlock("option", {
9357            key: o.value,
9358            value: o.value
9359          }, _toDisplayString(o.label), 9, _hoisted_3))
9360        }), 128))], 8, _hoisted_2), [[_vModelSelect, f.type]]),
9361        _withDirectives(_createElementVNode("textarea", {
9362          "onUpdate:modelValue": $event => ((f.description) = $event),
9363          placeholder: "اشرح الطلب"
9364        }, null, 8, _hoisted_4), [[_vModelText, f.description]]),
9365        _createElementVNode("label", _hoisted_5, [_createElementVNode("input", {
9366          type: "file",
9367          multiple: "",
9368          accept: "image/jpeg,image/png,image/webp",
9369          onChange: onFiles
9370        }, null, 40, _hoisted_6), _cache[0] || (_cache[0] = _createElementVNode("span", null, "إرفاق صور", -1)), _createElementVNode("em", null, _toDisplayString(fileLabel) + " — الحد الأقصى 3", 1)]),
9371        _createElementVNode("button", {
9372          class: "btn loadMore",
9373          onClick: submit
9374        }, "إرسال", 8, _hoisted_7)
9375      ])]),
9376      _: 1
9377    }))
9378  }
9379}
9380})()
9381  };
9382
9383
9384  const FeedbackPage={
9385    components:{PublicFrame},
9386    setup(){
9387      const store=useGzcStore();const router=useRouter();
9388      const f=reactive({feedback_type:'suggestion',title:'',message:''});
9389      const items=ref([]);const loading=ref(false);
9390      const types=[['suggestion','اقتراح'],['note','ملاحظة'],['bug','مشكلة تقنية'],['correction','تصحيح معلومة'],['feature','طلب إضافة'],['other','أخرى']];
9391      function typeLabel(v){return (types.find(x=>x[0]===v)||['',v])[1];}
9392      function statusLabel(v){return ({new:'جديد',reviewing:'قيد المراجعة',done:'تم التنفيذ',rejected:'مرفوض',archived:'مؤرشف'}[String(v||'')])||String(v||'-');}
9393      async function load(){const me=await store.loadMe();if(!me||!me.authenticated||!me.member){router.replace('/login');return;}loading.value=true;const r=await api('/api/member/feedback');loading.value=false;items.value=safeArray(r.feedback);}
9394      async function submit(){if(!String(f.message||'').trim()){store.state.msg='اكتب الملاحظة أولاً';return;}store.state.busy=true;const r=await api('/api/member/feedback',{method:'POST',body:JSON.stringify(f)});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok){f.title='';f.message='';f.feedback_type='suggestion';await load();}}
9395      onMounted(load);
9396      return{store,f,items,types,typeLabel,statusLabel,submit,loading,shortDate};
9397    },
9398    render:(function(){
9399const _Vue = Vue
9400const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
9401
9402const _hoisted_1 = { class: "card formCard feedbackForm" }
9403const _hoisted_2 = ["onUpdate:modelValue"]
9404const _hoisted_3 = ["value"]
9405const _hoisted_4 = ["onUpdate:modelValue"]
9406const _hoisted_5 = ["onUpdate:modelValue"]
9407const _hoisted_6 = ["onClick"]
9408const _hoisted_7 = { class: "card" }
9409const _hoisted_8 = {
9410  key: 0,
9411  class: "hint"
9412}
9413const _hoisted_9 = {
9414  key: 1,
9415  class: "hint"
9416}
9417const _hoisted_10 = {
9418  key: 2,
9419  class: "feedbackList"
9420}
9421const _hoisted_11 = { key: 0 }
9422
9423return function render(_ctx, _cache) {
9424  with (_ctx) {
9425    const { createElementVNode: _createElementVNode, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, toDisplayString: _toDisplayString, vModelSelect: _vModelSelect, withDirectives: _withDirectives, vModelText: _vModelText, createCommentVNode: _createCommentVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
9426
9427    const _component_PublicFrame = _resolveComponent("PublicFrame")
9428
9429    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "ملاحظات واقتراحات" }, {
9430      default: _withCtx(() => [_cache[1] || (_cache[1] = _createElementVNode("section", { class: "card feedbackHero" }, [_createElementVNode("span", { class: "vueBadge" }, "عضو"), _createElementVNode("h3", null, "أرسل ملاحظة أو اقتراح"), _createElementVNode("p", { class: "hint" }, "اكتب أي مشكلة، تصحيح، أو فكرة تطوير. الرسالة تظهر للإدارة فقط.")], -1)), _createElementVNode("section", _hoisted_1, [
9431        _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((f.feedback_type) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(types, (t) => {
9432          return (_openBlock(), _createElementBlock("option", {
9433            key: t[0],
9434            value: t[0]
9435          }, _toDisplayString(t[1]), 9, _hoisted_3))
9436        }), 128))], 8, _hoisted_2), [[_vModelSelect, f.feedback_type]]),
9437        _withDirectives(_createElementVNode("input", {
9438          "onUpdate:modelValue": $event => ((f.title) = $event),
9439          placeholder: "عنوان اختياري"
9440        }, null, 8, _hoisted_4), [[_vModelText, f.title]]),
9441        _withDirectives(_createElementVNode("textarea", {
9442          "onUpdate:modelValue": $event => ((f.message) = $event),
9443          placeholder: "اكتب الملاحظة أو الاقتراح بوضوح"
9444        }, null, 8, _hoisted_5), [[_vModelText, f.message]]),
9445        _createElementVNode("button", {
9446          class: "btn loadMore",
9447          onClick: submit
9448        }, "إرسال الملاحظة", 8, _hoisted_6)
9449      ]), _createElementVNode("section", _hoisted_7, [_cache[0] || (_cache[0] = _createElementVNode("h3", null, "ملاحظاتي السابقة", -1)), loading
9450        ? (_openBlock(), _createElementBlock("p", _hoisted_8, "جاري التحميل..."))
9451        : (!items.length)
9452          ? (_openBlock(), _createElementBlock("p", _hoisted_9, "لا توجد ملاحظات سابقة."))
9453          : (_openBlock(), _createElementBlock("div", _hoisted_10, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (x) => {
9454              return (_openBlock(), _createElementBlock("article", {
9455                key: x.id,
9456                class: "feedbackItem"
9457              }, [_createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(x.title || typeLabel(x.feedback_type)), 1), _createElementVNode("small", null, _toDisplayString(typeLabel(x.feedback_type)) + " — " + _toDisplayString(statusLabel(x.status)) + " — " + _toDisplayString(shortDate(x.created_at)), 1)]), _createElementVNode("p", null, _toDisplayString(x.message), 1), (x.admin_note)
9458                ? (_openBlock(), _createElementBlock("em", _hoisted_11, "رد الإدارة: " + _toDisplayString(x.admin_note), 1))
9459                : _createCommentVNode("", true)]))
9460            }), 128))]))])]),
9461      _: 1,
9462      __: [1]
9463    }))
9464  }
9465}
9466})()
9467  };
9468
9469  const EmergencyPage={
9470    components:{PublicFrame},
9471    setup(){const store=useGzcStore();const router=useRouter();const f=reactive({type:'medical',priority:'urgent',location_text:'',description:''});const files=ref([]);const submitted=ref(null);const fileLabel=computed(()=>mediaPreviewLabel(files.value));function onFiles(e){files.value=Array.from((e.target&&e.target.files)||[]).slice(0,3);}onMounted(()=>store.requireMember(router,'/emergency'));function useLocation(){if(!navigator.geolocation){store.state.msg='المتصفح لا يدعم تحديد الموقع';return;}navigator.geolocation.getCurrentPosition(pos=>{f.location_text=pos.coords.latitude+','+pos.coords.longitude;store.state.msg='تم تحديد الموقع بعد موافقتك';},()=>{store.state.msg='تعذر تحديد الموقع، اكتب الموقع يدوياً';},{enableHighAccuracy:true,timeout:10000,maximumAge:60000});}async function submit(){if(!String(f.description||'').trim()){store.state.msg='اكتب وصف الحالة أولاً';return;}const fd=new FormData();Object.keys(f).forEach(k=>
9471fd.append(k,String(f[k]||'')));Array.from(files.value||[]).forEach(file=>fd.append('media',file));store.state.busy=true;store.state.msg='جاري إرسال بلاغ الطوارئ...';const r=await uploadApi('/api/emergency',{method:'POST',body:fd,headers:{'Accept':'application/json'},uploadLabel:'إرسال مرفقات بلاغ الطوارئ'});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok)submitted.value=r;}return {store,f,files,submitted,fileLabel,onFiles,useLocation,submit};},
9472    render:(function(){
9473const _Vue = Vue
9474const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
9475
9476const _hoisted_1 = {
9477  key: 0,
9478  class: "card successState"
9479}
9480const _hoisted_2 = { class: "ltr" }
9481const _hoisted_3 = ["onClick"]
9482const _hoisted_4 = {
9483  key: 1,
9484  class: "card emergencyForm"
9485}
9486const _hoisted_5 = ["onUpdate:modelValue"]
9487const _hoisted_6 = ["value"]
9488const _hoisted_7 = ["onUpdate:modelValue"]
9489const _hoisted_8 = ["value"]
9490const _hoisted_9 = ["onClick"]
9491const _hoisted_10 = ["onUpdate:modelValue"]
9492const _hoisted_11 = ["onUpdate:modelValue"]
9493const _hoisted_12 = { class: "filePicker caseFilePicker" }
9494const _hoisted_13 = ["onChange"]
9495const _hoisted_14 = ["disabled", "onClick"]
9496
9497return function render(_ctx, _cache) {
9498  with (_ctx) {
9499    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, renderList: _renderList, Fragment: _Fragment, vModelSelect: _vModelSelect, withDirectives: _withDirectives, vModelText: _vModelText, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
9500
9501    const _component_PublicFrame = _resolveComponent("PublicFrame")
9502
9503    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "طوارئ" }, {
9504      default: _withCtx(() => [_cache[10] || (_cache[10] = _createElementVNode("section", {
9505        class: "card emergencyNumbers",
9506        role: "alert"
9507      }, [
9508        _createElementVNode("span", { class: "vueBadge" }, "اتصل أولاً عند الخطر المباشر"),
9509        _createElementVNode("h3", null, "أرقام الطوارئ الرسمية في الصين"),
9510        _createElementVNode("div", null, [
9511          _createElementVNode("a", { href: "tel:110" }, [_createElementVNode("b", null, "110"), _createElementVNode("small", null, "الشرطة")]),
9512          _createElementVNode("a", { href: "tel:119" }, [_createElementVNode("b", null, "119"), _createElementVNode("small", null, "الإطفاء")]),
9513          _createElementVNode("a", { href: "tel:120" }, [_createElementVNode("b", null, "120"), _createElementVNode("small", null, "الإسعاف")]),
9514          _createElementVNode("a", { href: "tel:122" }, [_createElementVNode("b", null, "122"), _createElementVNode("small", null, "حوادث المرور")])
9515        ]),
9516        _createElementVNode("p", null, "المنصة لا تستبدل خدمات الطوارئ الرسمية. اتصل بالرقم المناسب فوراً، ثم أرسل البلاغ للمتابعة المجتمعية إذا أمكن.")
9517      ], -1)), submitted
9518        ? (_openBlock(), _createElementBlock("div", _hoisted_1, [
9519            _cache[1] || (_cache[1] = _createElementVNode("span", {
9520              class: "metricMark",
9521              "aria-hidden": "true"
9522            }, null, -1)),
9523            _cache[2] || (_cache[2] = _createElementVNode("h3", null, "تم إرسال البلاغ وإخطار الإدارة", -1)),
9524            _createElementVNode("p", null, [_cache[0] || (_cache[0] = _createTextVNode("رقم المتابعة: ")), _createElementVNode("b", _hoisted_2, _toDisplayString(submitted.ticket_code), 1)]),
9525            _cache[3] || (_cache[3] = _createElementVNode("p", { class: "hint" }, "احتفظ بالرقم. إذا كان الخطر مستمراً فاتصل بخدمة الطوارئ الرسمية مباشرة.", -1)),
9526            _createElementVNode("button", {
9527              class: "btn secondary",
9528              onClick: $event => ($router.push('/'))
9529            }, "العودة للرئيسية", 8, _hoisted_3)
9530          ]))
9531        : (_openBlock(), _createElementBlock("div", _hoisted_4, [
9532            _cache[5] || (_cache[5] = _createElementVNode("h3", null, "بلاغ متابعة عاجل", -1)),
9533            _cache[6] || (_cache[6] = _createElementVNode("p", { class: "hint" }, "هذه الخدمة للأعضاء المسجلين. يمكنك إرفاق حتى 3 صور تظهر للإدارة المخولة فقط.", -1)),
9534            _cache[7] || (_cache[7] = _createElementVNode("label", {
9535              class: "fieldLabel",
9536              for: "emergency-type"
9537            }, "نوع الحالة", -1)),
9538            _withDirectives(_createElementVNode("select", {
9539              id: "emergency-type",
9540              "onUpdate:modelValue": $event => ((f.type) = $event)
9541            }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList($optionList('emergency_type',f.type), (o) => {
9542              return (_openBlock(), _createElementBlock("option", {
9543                key: o.value,
9544                value: o.value
9545              }, _toDisplayString(o.label), 9, _hoisted_6))
9546            }), 128))], 8, _hoisted_5), [[_vModelSelect, f.type]]),
9547            _cache[8] || (_cache[8] = _createElementVNode("label", {
9548              class: "fieldLabel",
9549              for: "emergency-priority"
9550            }, "الأولوية", -1)),
9551            _withDirectives(_createElementVNode("select", {
9552              id: "emergency-priority",
9553              "onUpdate:modelValue": $event => ((f.priority) = $event)
9554            }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList($optionList('emergency_priority',f.priority), (o) => {
9555              return (_openBlock(), _createElementBlock("option", {
9556                key: o.value,
9557                value: o.value
9558              }, _toDisplayString(o.label), 9, _hoisted_8))
9559            }), 128))], 8, _hoisted_7), [[_vModelSelect, f.priority]]),
9560            _createElementVNode("button", {
9561              class: "btn secondary loadMore",
9562              onClick: useLocation
9563            }, "السماح باستخدام موقعي الحالي", 8, _hoisted_9),
9564            _cache[9] || (_cache[9] = _createElementVNode("p", { class: "privacyNote" }, "الموقع لا يُطلب تلقائياً؛ يُرسل فقط إذا ضغطت الزر ووافقت من المتصفح. يمكنك كتابة وصف المكان بدلاً منه.", -1)),
9565            _withDirectives(_createElementVNode("input", {
9566              "onUpdate:modelValue": $event => ((f.location_text) = $event),
9567              placeholder: "الموقع التقريبي أو وصف المكان"
9568            }, null, 8, _hoisted_10), [[_vModelText, f.location_text]]),
9569            _withDirectives(_createElementVNode("textarea", {
9570              "onUpdate:modelValue": $event => ((f.description) = $event),
9571              placeholder: "وصف الحالة وما المساعدة المطلوبة"
9572            }, null, 8, _hoisted_11), [[_vModelText, f.description]]),
9573            _createElementVNode("label", _hoisted_12, [_createElementVNode("input", {
9574              type: "file",
9575              multiple: "",
9576              accept: "image/jpeg,image/png,image/webp",
9577              onChange: onFiles
9578            }, null, 40, _hoisted_13), _cache[4] || (_cache[4] = _createElementVNode("span", null, "إرفاق صور", -1)), _createElementVNode("em", null, _toDisplayString(fileLabel) + " — الحد الأقصى 3", 1)]),
9579            _createElementVNode("button", {
9580              class: "btn danger loadMore",
9581              disabled: store.state.busy,
9582              onClick: submit
9583            }, "إرسال البلاغ وإخطار الإدارة", 8, _hoisted_14)
9584          ]))]),
9585      _: 1,
9586      __: [10]
9587    }))
9588  }
9589}
9590})()
9591  };
9592
9593  const AboutPage={
9594    components:{PublicFrame},
9595    setup(){
9596      const store=useGzcStore();
9597      const loading=ref(true);const loadError=ref('');
9598      async function load(){loading.value=true;loadError.value='';const r=await api('/api/community-profile');if(r&&r.ok)store.state.community=r.community||{};else loadError.value=(r&&r.message)||'تعذر تحميل بيانات المجتمع.';loading.value=false;}
9599      onMounted(load);
9600      const c=computed(()=>store.state.community||{});
9601      const profile=computed(()=>c.value.profile||c.value||{});
9602      const communities=computed(()=>safeArray(c.value.communities||c.value.local_communities).filter(x=>!x.archived_at&&x.status!=='archived'&&String(x.slug)!=='all-china'));
9603      const countryCommunities=computed(()=>safeArray(c.value.country_communities));
9604      const locale=computed(()=>store.state.locale||I18N_DEFAULT_LOCALE);
9605      const locales=computed(()=>Array.isArray(store.state.locales)?store.state.locales:[]);
9606      const multiLocale=computed(()=>locales.value.length>1);
9607      function t(key){return i18nTranslate(locale.value,key);}
9608      function localeLabel(x){return locale.value==='ar'?(x.label_ar||x.code):(x.label_en||x.code);}
9609      function setLocale(code){const found=locales.value.find(x=>String(x.code)===String(code));if(!found)return;store.state.locale=found.code;i18nPersistLocale(found.code);i18nApplyDocument(found.code,found.dir);}
9610      async function loadLocales(){
9611        if(store.state.localesLoaded)return;
9612        const r=await api('/api/platform/locales');
9613        if(r&&r.ok){
9614          const list=safeArray(r.locales);if(list.length)store.state.locales=list;
9615          const enabled=safeArray(r.enabled);const stored=i18nStoredLocale();
9616          const initial=enabled.includes(stored)?stored:(r.default_locale||I18N_DEFAULT_LOCALE);
9617          store.state.locale=initial;
9618          const def=safeArray(store.state.locales).find(x=>String(x.code)===String(initial));
9619          i18nApplyDocument(initial,def&&def.dir);
9620        }
9621        store.state.localesLoaded=true;
9622      }
9623      onMounted(loadLocales);
9624      const router=useRouter();
9625      function openCommunity(lc){if(lc&&lc.slug)router.push('/community/'+encodeURIComponent(lc.slug));}
9626      return {store,c,profile,communities,countryCommunities,loading,loadError,load,safeArray,openCommunity,locale,locales,multiLocale,t,setLocale,localeLabel};
9627    },
9628    render:(function(){
9629const _Vue = Vue
9630const { createVNode: _createVNode, createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
9631
9632const _hoisted_1 = {
9633  key: 0,
9634  class: "card loadingState",
9635  role: "status"
9636}
9637const _hoisted_2 = {
9638  key: 1,
9639  class: "card errorState",
9640  role: "alert"
9641}
9642const _hoisted_3 = ["onClick"]
9643const _hoisted_4 = {
9644  key: 2,
9645  class: "card aboutCard communityPublicHero"
9646}
9647const _hoisted_5 = { class: "hint" }
9648const _hoisted_6 = {
9649  key: 0,
9650  class: "infoBox"
9651}
9652const _hoisted_7 = {
9653  key: 1,
9654  class: "infoBox"
9655}
9656const _hoisted_8 = {
9657  key: 3,
9658  class: "card"
9659}
9660const _hoisted_9 = { class: "localCommunityGrid" }
9661const _hoisted_10 = ["onClick"]
9662const _hoisted_11 = ["src"]
9663const _hoisted_12 = { class: "memberCardTop" }
9664const _hoisted_13 = {
9665  key: 1,
9666  class: "hint"
9667}
9668const _hoisted_14 = {
9669  key: 4,
9670  class: "card localeCard"
9671}
9672const _hoisted_15 = { class: "row" }
9673const _hoisted_16 = ["onClick"]
9674const _hoisted_17 = {
9675  key: 5,
9676  class: "card"
9677}
9678const _hoisted_18 = { class: "localCommunityGrid" }
9679const _hoisted_19 = ["onClick"]
9680const _hoisted_20 = { class: "memberCardTop" }
9681const _hoisted_21 = {
9682  key: 0,
9683  class: "hint"
9684}
9685
9686return function render(_ctx, _cache) {
9687  with (_ctx) {
9688    const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, toDisplayString: _toDisplayString, renderList: _renderList, Fragment: _Fragment, createTextVNode: _createTextVNode, normalizeClass: _normalizeClass, resolveComponent: _resolveComponent, withCtx: _withCtx, createVNode: _createVNode, createBlock: _createBlock } = _Vue
9689
9690    const _component_router_link = _resolveComponent("router-link")
9691    const _component_PublicFrame = _resolveComponent("PublicFrame")
9692
9693    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "عن المنصة" }, {
9694      default: _withCtx(() => [
9695        loading
9696          ? (_openBlock(), _createElementBlock("div", _hoisted_1, _c
9696ache[0] || (_cache[0] = [_createElementVNode("span", {
9697              class: "loadingSpinner",
9698              "aria-hidden": "true"
9699            }, null, -1), _createElementVNode("h3", null, "جاري تحميل معلومات المجتمع...", -1)])))
9700          : loadError
9701            ? (_openBlock(), _createElementBlock("div", _hoisted_2, [_cache[1] || (_cache[1] = _createElementVNode("h3", null, "تعذر تحميل الصفحة", -1)), _createElementVNode("p", null, _toDisplayString(loadError), 1), _createElementVNode("button", {
9702                class: "btn secondary",
9703                onClick: load
9704              }, "إعادة المحاولة", 8, _hoisted_3)]))
9705            : _createCommentVNode("", true),
9706        (!loading && !loadError)
9707          ? (_openBlock(), _createElementBlock("div", _hoisted_4, [
9708              _cache[4] || (_cache[4] = _createElementVNode("img", {
9709                class: "communitySplash platformAboutLogo",
9710                src: "/brand/smt-gold-v1/smt-logo-transparent.png",
9711                width: "160",
9712                height: "160",
9713                loading: "eager",
9714                alt: "شعار منصة SMT China"
9715              }, null, -1)),
9716              _createElementVNode("h3", null, _toDisplayString(profile.title_ar || 'منصة SMT China'), 1),
9717              _createElementVNode("p", _hoisted_5, _toDisplayString(profile.body_ar || 'منصة تنظيم وخدمة الأعضاء والمجتمعات في الصين.'), 1),
9718              (profile.mission_ar)
9719                ? (_openBlock(), _createElementBlock("div", _hoisted_6, [_cache[2] || (_cache[2] = _createElementVNode("b", null, "الرسالة", -1)), _createElementVNode("p", null, _toDisplayString(profile.mission_ar), 1)]))
9720                : _createCommentVNode("", true),
9721              (profile.vision_ar)
9722                ? (_openBlock(), _createElementBlock("div", _hoisted_7, [_cache[3] || (_cache[3] = _createElementVNode("b", null, "الرؤية", -1)), _createElementVNode("p", null, _toDisplayString(profile.vision_ar), 1)]))
9723                : _createCommentVNode("", true)
9724            ]))
9725          : _createCommentVNode("", true),
9726        (!loading && !loadError && communities.length)
9727          ? (_openBlock(), _createElementBlock("div", _hoisted_8, [_cache[8] || (_cache[8] = _createElementVNode("h3", null, "المجتمعات المحلية", -1)), _cache[9] || (_cache[9] = _createElementVNode("p", { class: "hint" }, "اختر أي مجتمع محلي لقراءة معلوماته وخدماته.", -1)), _createElementVNode("div", _hoisted_9, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(communities, (lc) => {
9728              return (_openBlock(), _createElementBlock("button", {
9729                type: "button",
9730                class: "localCommunityPublicCard clickable",
9731                key: lc.id,
9732                onClick: $event => (openCommunity(lc))
9733              }, [
9734                (lc.hero_image_url)
9735                  ? (_openBlock(), _createElementBlock("img", {
9736                      key: 0,
9737                      class: "localCommunityHero",
9738                      src: lc.hero_image_url,
9739                      loading: "lazy",
9740                      alt: ""
9741                    }, null, 8, _hoisted_11))
9742                  : _createCommentVNode("", true),
9743                _createElementVNode("span", _hoisted_12, [_createElementVNode("h4", null, _toDisplayString(lc.name_ar), 1)]),
9744                (lc.name_en)
9745                  ? (_openBlock(), _createElementBlock("span", _hoisted_13, _toDisplayString(lc.name_en), 1))
9746                  : _createCommentVNode("", true),
9747                _createElementVNode("span", null, [_cache[5] || (_cache[5] = _createElementVNode("b", null, "المدينة الرئيسية:", -1)), _createTextVNode(" " + _toDisplayString($cityLabel(lc.main_city) || '-'), 1)]),
9748                _createElementVNode("span", null, [_cache[6] || (_cache[6] = _createElementVNode("b", null, "النطاق:", -1)), _createTextVNode(" " + _toDisplayString(safeArray(lc.coverage_cities).map($cityLabel).join('، ') || '
9748-'), 1)]),
9749                _cache[7] || (_cache[7] = _createElementVNode("small", { class: "openHint" }, "اضغط لفتح صفحة المجتمع", -1))
9750              ], 8, _hoisted_10))
9751            }), 128))])]))
9752          : _createCommentVNode("", true),
9753        multiLocale
9754          ? (_openBlock(), _createElementBlock("div", _hoisted_14, [_createElementVNode("h3", null, _toDisplayString(t('common.language')), 1), _createElementVNode("div", _hoisted_15, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(locales, (l) => {
9755              return (_openBlock(), _createElementBlock("button", {
9756                key: l.code,
9757                class: _normalizeClass(["smallbtn", {active:l.code===locale}]),
9758                onClick: $event => (setLocale(l.code))
9759              }, _toDisplayString(localeLabel(l)), 11, _hoisted_16))
9760            }), 128))]), _cache[10] || (_cache[10] = _createElementVNode("p", { class: "hint" }, "اللغة العربية هي لغة المحتوى الأساسية؛ اللغات الأخرى تُفعَّل تدريجياً مع اكتمال ترجمتها.", -1))]))
9761          : _createCommentVNode("", true),
9762        (!loading && !loadError && countryCommunities.length)
9763          ? (_openBlock(), _createElementBlock("div", _hoisted_17, [
9764              _cache[14] || (_cache[14] = _createElementVNode("h3", null, "جاليات دولتك في الصين", -1)),
9765              _cache[15] || (_cache[15] = _createElementVNode("p", { class: "hint" }, "تظهر هنا الجاليات المسجلة لدولتك فقط، وكل جالية تنشر معلوماتها وطريقة التواصل معها بنفسها.", -1)),
9766              _createElementVNode("div", _hoisted_18, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(countryCommunities, (cc) => {
9767                return (_openBlock(), _createElementBlock("button", {
9768                  type: "button",
9769                  class: "localCommunityPublicCard clickable",
9770                  key: cc.id,
9771                  onClick: $event => (openCommunity(cc))
9772                }, [
9773                  _createElementVNode("span", _hoisted_20, [_createElementVNode("h4", null, _toDisplayString(cc.name_ar), 1)]),
9774                  (cc.name_en)
9775                    ? (_openBlock(), _createElementBlock("span", _hoisted_21, _toDisplayString(cc.name_en), 1))
9776                    : _createCommentVNode("", true),
9777                  _createElementVNode("span", null, [_cache[11] || (_cache[11] = _createElementVNode("b", null, "المدينة:", -1)), _createTextVNode(" " + _toDisplayString($cityLabel(cc.main_city) || '-'), 1)]),
9778                  _cache[12] || (_cache[12] = _createElementVNode("small", { class: "openHint" }, "اضغط لفتح صفحة الجالية", -1))
9779                ], 8, _hoisted_19))
9780              }), 128))]),
9781              _createVNode(_component_router_link, {
9782                class: "btn secondary",
9783                to: "/country-communities"
9784              }, {
9785                default: _withCtx(() => _cache[13] || (_cache[13] = [_createTextVNode("إدارة أو طلب تسجيل جالية")])),
9786                _: 1,
9787                __: [13]
9788              })
9789            ]))
9790          : _createCommentVNode("", true)
9791      ]),
9792      _: 1
9793    }))
9794  }
9795}
9796})()
9797  };
9798
9799
9800
9801  const CommunityDetailPage={
9802    components:{PublicFrame},
9803    setup(){
9804      const route=useRoute();
9805      const state=reactive({busy:true,community:null,message:''});
9806      async function load(){state.busy=true;state.message='';const r=await api('/api/communities/'+encodeURIComponent(route.params.slug||''));state.busy=false;if(r.ok)state.community=r.community;else state.message=r.message||'تعذر تحميل صفحة المجتمع';}
9807      onMounted(load);watch(()=>route.params.slug,load);
9808      const lc=computed(()=>state.community||{});
9809      return {state,lc,safeArray};
9810    },
9811    render:(function(){
9812const _Vue = Vue
9813const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
9814
9815const _hoisted_1 = { class: "card localCommunityDetailHero" }
9816const _hoisted_2 = ["src"]
9817const _hoisted_3 = {
9818  key: 1,
9819  class: "hint"
9820}
9821const _hoisted_4 = {
9822  key: 2,
9823  class: "hint"
9824}
9825const _hoisted_5 = {
9826  key: 3,
9827  class: "hint dangerText"
9828}
9829const _hoisted_6 = {
9830  key: 0,
9831  class: "card"
9832}
9833const _hoisted_7 = { class: "communityAboutText" }
9834const _hoisted_8 = {
9835  key: 1,
9836  class: "card"
9837}
9838const _hoisted_9 = {
9839  key: 2,
9840  class: "card"
9841}
9842const _hoisted_10 = { class: "communityGalleryPublic" }
9843const _hoisted_11 = ["src", "alt"]
9844const _hoisted_12 = {
9845  key: 3,
9846  class: "card"
9847}
9848const _hoisted_13 = { class: "memberCardTop" }
9849const _hoisted_14 = {
9850  key: 0,
9851  class: "statusPill"
9852}
9853const _hoisted_15 = {
9854  key: 0,
9855  class: "hint"
9856}
9857const _hoisted_16 = {
9858  key: 1,
9859  class: "executiveGrid"
9860}
9861const _hoisted_17 = ["src"]
9862const _hoisted_18 = {
9863  key: 1,
9864  class: "avatar"
9865}
9866
9867return function render(_ctx, _cache) {
9868  with (_ctx) {
9869    const { openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _
9869createCommentVNode, toDisplayString: _toDisplayString, createElementVNode: _createElementVNode, createTextVNode: _createTextVNode, renderList: _renderList, Fragment: _Fragment, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
9870
9871    const _component_PublicFrame = _resolveComponent("PublicFrame")
9872
9873    return (_openBlock(), _createBlock(_component_PublicFrame, { title: lc.name_ar || 'المجتمع المحلي' }, {
9874      default: _withCtx(() => [
9875        _createElementVNode("div", _hoisted_1, [
9876          (lc.hero_image_url)
9877            ? (_openBlock(), _createElementBlock("img", {
9878                key: 0,
9879                class: "communityHeroPhoto",
9880                src: lc.hero_image_url,
9881                loading: "eager",
9882                alt: "صورة المجتمع"
9883              }, null, 8, _hoisted_2))
9884            : _createCommentVNode("", true),
9885          _createElementVNode("h3", null, _toDisplayString(lc.name_ar || 'المجتمع المحلي'), 1),
9886          (lc.name_en)
9887            ? (_openBlock(), _createElementBlock("p", _hoisted_3, _toDisplayString(lc.name_en), 1))
9888            : _createCommentVNode("", true),
9889          (state.busy)
9890            ? (_openBlock(), _createElementBlock("p", _hoisted_4, "جاري تحميل معلومات المجتمع..."))
9891            : _createCommentVNode("", true),
9892          (state.message)
9893            ? (_openBlock(), _createElementBlock("p", _hoisted_5, _toDisplayString(state.message), 1))
9894            : _createCommentVNode("", true)
9895        ]),
9896        (lc.id)
9897          ? (_openBlock(), _createElementBlock("div", _hoisted_6, [_createElementVNode("h3", null, "عن " + _toDisplayString(lc.name_ar), 1), _createElementVNode("p", _hoisted_7, _toDisplayString(lc.about_ar || 'لا تتوفر معلومات تفصيلية لهذا المجتمع حالياً.'), 1)]))
9898          : _createCommentVNode("", true),
9899        (lc.id)
9900          ? (_openBlock(), _createElementBlock("div", _hoisted_8, [_cache[2] || (_cache[2] = _createElementVNode("h3", null, "نطاق المجتمع", -1)), _createElementVNode("p", null, [_cache[0] || (_cache[0] = _createElementVNode("b", null, "المدينة الرئيسية:", -1)), _createTextVNode(" " + _toDisplayString($cityLabel(lc.main_city) || '-'), 1)]), _createElementVNode("p", null, [_cache[1] || (_cache[1] = _createElementVNode("b", null, "المدن التابعة:", -1)), _createTextVNode(" " + _toDisplayString(safeArray(lc.coverage_cities).map($cityLabel).join('، ') || '-'), 1)])]))
9901          : _createCommentVNode("", true),
9902        (safeArray(lc.images).length)
9903          ? (_openBlock(), _createElementBlock("div", _hoisted_9, [_cache[3] || (_cache[3] = _createElementVNode("h3", null, "صور المجتمع", -1)), _createElementVNode("div", _hoisted_10, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(safeArray(lc.images), (img) => {
9904              return (_openBlock(), _createElementBlock("figure", { key: img.id }, [_createElementVNode("img", {
9905                src: img.image_url,
9906                loading: "lazy",
9907                alt: img.title || 'صورة المجتمع'
9908              }, null, 8, _hoisted_11), _createElementVNode("figcaption", null, _toDisplayString(img.title || 'صورة'), 1)]))
9909            }), 128))])]))
9910          : _createCommentVNode("", true),
9911        (safeArray(lc.terms).length)
9912          ? (_openBlock(), _createElementBlock("div", _hoisted_12, [_cache[4] || (_cache[4] = _createElementVNode("h3", null, "المكتب التنفيذي", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(safeArray(lc.terms), (t) => {
9913              return (_openBlock(), _createElementBlock("div", {
9914                class: "termPublic",
9915                key: t.id
9916              }, [_createElementVNode("div", _hoisted_13, [_createElementVNode("h4", null, _toDisplayString(t.title), 1), (t.is_current)
9917                ? (_openBlock(), _createElementBlock("span", _hoisted_14, "الحالي"))
9918                : _createCommentVNode("", true)]), (t.period_label)
9919                ? (_openBlock(), _createElementBlock("p", _hoisted_15, _toDisplayString(t.period_label), 1))
9920                : _createCommentVNode("", true), (t.members&&t.members.length)
9921                ? (_openBlock(), _createElementBlock("div", _hoisted_16, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(t.members, (m) => {
9922                    return (_openBlock(), _createElementBlock("div", {
9923                      class: "execMini",
9924                      key: m.id
9925                    }, [($memberPhoto(m,'thumb'))
9926                      ? (_openBlock(), _createElementBlock("img", {
9927                          key: 0,
9928                          src: $memberPhoto(m,'thumb'),
9929                          loading: "lazy",
9930                          alt: ""
9931                        }, null, 8, _hoisted_17))
9932                      : (_openBlock(), _createElementBlock("div", _hoisted_18, "👤")), _createElementVNode("b", null, _toDisplayString(m.n
9932ame), 1), _createElementVNode("small", null, _toDisplayString(m.position || 'عضو'), 1)]))
9933                  }), 128))]))
9934                : _createCommentVNode("", true)]))
9935            }), 128))]))
9936          : _createCommentVNode("", true),
9937        _cache[5] || (_cache[5] = _createElementVNode("div", { class: "card noticeCard compactNotice" }, [_createElementVNode("h3", null, "المصدر"), _createElementVNode("p", null, "معلومات هذه الصفحة مقدمة من إدارة المجتمع المحلي.")], -1))
9938      ]),
9939      _: 1,
9940      __: [5]
9941    }, 8, ["title"]))
9942  }
9943}
9944})()
9945  };
9946
9947  const AdminCasesPage={
9948    components:{AdminFrame},
9949    props:['mode'],
9950    setup(props){
9951      const store=useGzcStore();const router=useRouter();const route=useRoute();const filterStatus=ref('active');
9952      const workspaceMode=computed(()=>!!route.params.id);
9953      const targetCase=String((route.query||{}).case||'').trim();
9954      const title=computed(()=>props.mode==='arrival'?'الوصول':'المساعدة');
9955      const type=computed(()=>props.mode==='arrival'?'arrival':'help');
9956      const basePath=computed(()=>props.mode==='arrival'?'/admin/arrivals':'/admin/help');
9957      const baseRows=computed(()=>store.state.adminCases);
9958      const filteredRows=computed(()=>{
9959        const all=baseRows.value;
9960        if(filterStatus.value==='all')return all;
9961        if(filterStatus.value==='active')return all.filter(c=>!['closed','resolved'].includes(String(c.status||'')));
9962        return all.filter(c=>String(c.status||'')===filterStatus.value);
9963      });
9964      const rows=computed(()=>workspaceMode.value?baseRows.value.filter(c=>String(c.id)===String(route.params.id)):filteredRows.value);
9965      const summary=computed(()=>baseRows.value.reduce((a,c)=>{a.total++;const st=String(c.status||'open');if(['closed','resolved'].includes(st))a.closed++;else a.open++;if(st==='in_progress')a.progress++;return a;},{total:0,open:0,progress:0,closed:0}));
9966      function phoneOf(c){return norm(c.whatsapp||c.contact_whatsapp||c.china_phone||c.contact_china_phone||'');}
9967      function waLink(c){const p=phoneOf(c);return p?('https://wa.me/'+p):'#';}
9968      function telLink(c){const p=phoneOf(c);return p?('tel:+'+p):'#';}
9969      function openAttachment(m){if(m&&m.file_url)window.open(m.file_url,'_blank','noopener');}
9970      function openWorkspace(c){if(c&&c.id)router.push(basePath.value+'/'+encodeURIComponent(c.id));}
9971      function closeWorkspace(){router.push(basePath.value);}
9972      async function redirectLegacyTarget(){
9973        if(workspaceMode.value||!targetCase)return;
9974        const row=baseRows.value.find(c=>String(c.id)===targetCase||String(c.case_code||'')===targetCase);
9975        if(row)await router.replace(basePath.value+'/'+encodeURIComponent(row.id));
9976      }
9977      async function load(){if(await store.requireAdmin(router)){await store.loadAdminCases(type.value,router);await redirectLegacyTarget();if(workspaceMode.value&&!rows.value.length)store.state.msg='الحالة غير موجودة أو خارج نطاق صلاحيتك';}}
9978      onMounted(load);
9979      watch(()=>route.params.id,load);
9980      async function setStatus(c,st){if(!c||!c.id)return;store.state.busy=true;store.state.msg='جاري تحديث الحالة...';const r=await api('/api/admin/cases/'+encodeURIComponent(c.id)+'/status',{method:'POST',body:JSON.stringify({status:st})});store.state.busy=false;store.state.msg=r.message||r.error||'';await load();}
9981      return {store,title,rows,baseRows,summary,filterStatus,workspaceMode,basePath,openWorkspace,closeWorkspace,load,setStatus,caseTypeName,caseStatusName,phoneOf,waLink,telLink,openAttachment,mediaSrc,shortDate,adminRecordUpdatedAt,adminQueueOwner,caseQueueNextAction};
9982    },
9983    render:(function(){
9984const _Vue = Vue
9985const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
9986
9987const _hoisted_1 = { class: "adminQueueIntro caseQueueIntro" }
9988const _hoisted_2 = { class: "card opsSummaryCard" }
9989const _hoisted_3 = { class: "miniStats" }
9990const _hoisted_4 = { class: "opsFilterBar" }
9991const _hoisted_5 = ["onClick"]
9992const _hoisted_6 = ["onClick"]
9993const _hoisted_7 = ["onClick"]
9994const _hoisted_8 = ["onClick"]
9995const _hoisted_9 = {
9996  key: 1,
9997  class: "adminWorkspaceBackBar"
9998}
9999const _hoisted_10 = ["onClick"]
10000const _hoisted_11 = {
10001  key: 2,
10002  class: "card adminQueueState adminQueueLoading"
10003}
10004const _hoisted_12 = {
10005  key: 3,
10006  class: "card emptyCard adminQueueState"
10007}
10008const _hoisted_13 = {
10009  key: 4,
10010  class: "adminQueueList caseQueueList"
10011}
10012const _hoisted_14 = ["onClick", "onKeyup"]
10013const _hoisted_15 = { class: "adminQueueIdentity" }
10014const _hoisted_16 = { class: "memberThumb memberThumbPlaceholder" }
10015const _hoisted_17 = { class: "adminQueueFacts adminWorkflowFacts" }
10016const _hoisted_18 = { class: "adminQueueNextAction" }
10017const _hoisted_19 = ["onClick"]
10018const _hoisted_20 = {
10019  key: 5,
10020  class: "opsList"
10021}
10022const _hoisted_21 = { class: "adminRecordWorkspaceTop" }
10023const _hoisted_22 = ["onClick"]
10024const _hoisted_23 = { class: "memberCardTop compactToggleRow" }
10025const _hoisted_24 = { class: "adminEyebrow" }
10026const _hoisted_25 = { class: "hint" }
10027const _hoisted_26 = { class: "statusPill" }
10028const _hoisted_27 = { class: "compactSummaryBar" }
10029const _hoisted_28 = { dir: "ltr" }
10030const _hoisted_29 = { class: "recordNarrative" }
10031const _hoisted_30 = { class: "opsDesc" }
10032const _hoisted_31 = {
10033  key: 0,
10034  class: "announcementMediaGrid"
10035}
10036const _hoisted_32 = ["onClick"]
10037const _hoisted_33 = ["src"]
10038const _hoisted_34 = { class: "notifyMeta" }
10039const _hoisted_35 = { dir: "ltr" }
10040const _hoisted_36 = { class: "memberActions stageActions" }
10041const _hoisted_37 = ["onClick"]
10042const _hoisted_38 = ["onClick"]
10043const _hoisted_39 = ["onClick"]
10044const _hoisted_40 = ["href"]
10045const _hoisted_41 = ["href"]
10046
10047return function render(_ctx, _cache) {
10048  with (_ctx) {
10049    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, normalizeClass: _normalizeClass, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, renderList: _renderList, withModifiers: _withModifiers, withKeys: _withKeys, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
10050
10051    const _component_AdminFrame = _resolveComponent("AdminFrame")
10052
10053    return (_openBlock(), _createBlock(_component_AdminFrame, { title: title }, {
10054      default: _withCtx(() => [
10055        (!workspaceMode)
10056          ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createElementVNode("section", _hoisted_1, [_createElementVNode("div", null, [_cache[0] || (_cache[0] = _createElementVNode("span", { class: "adminEyebrow" }, "قائمة العمل", -1)), _createElementVNode("h2", null, _toDisplayString(title), 1), _createElementVNode("p", null, _toDisplayString(mode==='arrival'?'طلبات الوصول للفرز والمتابعة. افتح السجل لإجراء أي تحديث.':'طلبات المساعدة للفرز والمتابعة. افتح السجل حتى تبقى التفاصيل والإجراءات في سياق واحد.'), 1)])]), _createElementVNode("div", _hoisted_2, [_createElementVNode("div", _hoisted_3, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(summary.total), 1), _cache[1] || (_cache[1] = _createElementVNode("small", null, "الإجمالي", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(summary.open), 1), _cache[2] || (_cache[2] = _createElementVNode("small", null, "مفتوحة", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(summary.progress), 1), _cache[3] || (_cache[3] = _createElementVNode("small", null, "متابعة", -1))])]), _createElementVNode("div", _hoisted_4, [
10057              _createElementVNode("button", {
10058                class: _normalizeClass(filterStatus==='active'?'active':''),
10059                onClick: $event => (filterStatus='active')
10060              }, "النشطة", 10, _hoisted_5),
10061              _createElementVNode("button", {
10062                class: _normalizeClass(filterStatus==='all'?'active':''),
10063                onClick: $event => (filterStatus='all')
10064              }, "الكل", 10, _hoisted_6),
10065              _createElementVNode("button", {
10066                class: _normalizeClass(filterStatus==='in_progress'?'active':''),
10067                onClick: $event => (filterStatus='in_progress')
10068              }, "متابعة", 10, _hoisted_7),
10069              _createElementVNode("button", {
10070                class: _normalizeClass(filterStatus==='closed'?'active':''),
10071                onClick: $event => (filterStatus='closed')
10072              }, "مغلقة", 10, _hoisted_8)
10073            ])])], 64))
10074          : _createCommentVNode("", true),
10075        workspaceMode
10076          ? (_openBlock(), _createElementBlock("div", _hoisted_9, [_createElementVNode("button", {
10077              class: "smallbtn secondary",
10078              onClick: closeWorkspace
10079            }, "← العودة إلى " + _toDisplayString(title), 9, _hoisted_10), _c
10079ache[4] || (_cache[4] = _createElementVNode("span", null, "مساحة حالة مستقلة — التفاصيل والتواصل والإجراء في سجل واحد", -1))]))
10080          : _createCommentVNode("", true),
10081        (store.state.busy && !rows.length)
10082          ? (_openBlock(), _createElementBlock("div", _hoisted_11, "جاري تحميل الحالات..."))
10083          : (!rows.length)
10084            ? (_openBlock(), _createElementBlock("div", _hoisted_12, _toDisplayString(workspaceMode?'الحالة غير موجودة.':'لا توجد طلبات مطابقة.'), 1))
10085            : _createCommentVNode("", true),
10086        (!workspaceMode)
10087          ? (_openBlock(), _createElementBlock("div", _hoisted_13, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(rows, (c) => {
10088              return (_openBlock(), _createElementBlock("article", {
10089                class: "adminQueueRow caseQueueRow",
10090                key: c.id,
10091                onClick: $event => (openWorkspace(c)),
10092                tabindex: "0",
10093                onKeyup: _withKeys($event => (openWorkspace(c)), ["enter"])
10094              }
10094, [_createElementVNode("div", _hoisted_15, [_createElementVNode("div", _hoisted_16, _toDisplayString(mode==='arrival'?'✈':'🤝'), 1), _createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(c.case_code || c.title || 'حالة'), 1), _createElementVNode("small", null, _toDisplayString(c.full_name || c.contact_name || 'بدون اسم') + " · " + _toDisplayString($cityLabel(c.china_city) || '-'), 1)])]), _createElementVNode("div", _hoisted_17, [
10095                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(caseStatusName(c.status)), 1), _cache[5] || (_cache[5] = _createElementVNode("small", null, "الحالة", -1))]),
10096                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(adminQueueOwner(mode==='arrival'?'arrival':'help',c)), 1), _cache[6] || (_cache[6] = _createElementVNode("small", null, "المسؤول", -1))]),
10097                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(adminRecordUpdatedAt(c)), 1), _cache[7] || (_cache[7] = _createElementVNode("small", null, "آخر تحديث", -1))]),
10098                _createElementVNode("span", _hoisted_18, [_createElementVNode("b", null, _toDisplayString(caseQueueNextAction(c)), 1), _cache[8] || (_cache[8] = _createElementVNode("small", null, "الإجراء التالي", -1))])
10099              ]), _createElementVNode("button", {
10100                class: "smallbtn secondary adminQueueOpen",
10101                onClick: _withModifiers($event => (openWorkspace(c)), ["stop"])
10102              }, "فتح الحالة", 8, _hoisted_19)], 40, _hoisted_14))
10103            }), 128))]))
10104          : (_openBlock(), _createElementBlock("div", _hoisted_20, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(rows, (c) => {
10105              return (_openBlock(), _createElementBlock("article", {
10106                class: "card opsCard opsCompactCard adminRecordWorkspace recordWorkspaceOnly caseRecordWorkspace",
10107                key: c.id
10108              }, [
10109                _createElementVNode("div", _hoisted_21, [_createElementVNode("button", {
10110                  class: "smallbtn secondary",
10111                  onClick: closeWorkspace
10112                }, "← العودة إلى " + _toDisplayString(title), 9, _hoisted_22)]),
10113                _createElementVNode("div", _hoisted_23, [_createElementVNode("div", null, [_createElementVNode("span", _hoisted_24, _toDisplayString(caseTypeName(c.type)), 1), _createElementVNode("h3", null, _toDisplayString(c.case_code || c.title || 'حالة'), 1), _createElementVNode("p", _hoisted_25, _toDisplayString(c.full_name || c.contact_name || 'بدون اسم') + " · " + _toDisplayString($cityLabel(c.china_city) || '-'), 1)]), _createElementVNode("span", _hoisted_26, _toDisplayString(caseStatusName(c.status)), 1)]),
10114                _createElementVNode("div", _hoisted_27, [_createElementVNode("span", null, [_createElementVNode("b", _hoisted_28, _toDisplayString(phoneOf(c)||'-'), 1), _cache[9] || (_cache[9] = _createElementVNode("small", null, "التواصل", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(shortDate(c.created_at)), 1), _cache[10] || (_cache[10] = _createElementVNode("small", null, "تاريخ الفتح", -1))])]),
10115                _createElementVNode("section", _hoisted_29, [_cache[11] || (_cache[11] = _createElementVNode("h4", null, "تفاصيل الحالة", -1)), _createElementVNode("p", _hoisted_30, _toDisplayString(c.description || 'لا يوجد وصف.'), 1)]),
10116                (c.media&&c.media.length)
10117                  ? (_openBlock(), _createElementBlock("div", _hoisted_31, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(c.media, (m) => {
10118                      return (_openBlock(), _createElementBlock("button", {
10119                        key: m.id,
10120                        class: "announcementMediaItem",
10121                        onClick: $event => (openAttachment(m))
10122                      }, [_createElementVNode("img", {
10123                        src: mediaSrc(m),
10124                        loading: "lazy",
10125                        alt: "صورة الحالة"
10126                      }, null, 8, _hoisted_33), _cache[12] || (_cache[12] = _createElementVNode("span", null, "صورة", -1))], 8, _hoisted_32))
10127                    }), 128))]))
10128                  : _createCommentVNode("", true),
10129                _createElementVNode("div", _hoisted_34, [
10130                  _createElementVNode("span", null, _toDisplayString(c.full_name || c.contact_name || 'بدون اسم'), 1),
10131                  _createElementVNode("span", _hoisted_35, _toDisplayString(phoneOf(c)||'-'), 1),
10132                  _createElementVNode("span", null, _toDisplayString($cityLabel(c.china_city) || '-'), 1),
10133                  _createElementVNode("span", null, _toDisplayString(shortDate(c.created_at)), 1)
10134                ]),
10135                _createElementVNode("div", _hoisted_36, [
10136                  _createElementVNode("button", {
10137                    class: "smallbtn",
10138                    onClick: $event => (setStatus(c,'open'))
10139                  }, "مفتوحة", 8, _hoisted_37),
10140                  _createElementVNode("button", {
10141                    class: "smallbtn",
10142                    onClick: $event => (setStatus(c,'in_progress'))
10143                  }, "قيد المتابعة", 8, _hoisted_38),
10144                  _createElementVNode("button", {
10145                    class: "smallbtn danger",
10146                    onClick: $event => (setStatus(c,'closed'))
10147                  }, "إغلاق", 8, _hoisted_39),
10148                  _createElementVNode("a", {
10149                    class: "smallbtn secondary",
10150                    href: waLink(c),
10151                    target: "_blank"
10152                  }, "واتساب", 8, _hoisted_40),
10153                  _createElementVNode("a", {
10154                    class: "smallbtn secondary",
10155                    href: telLink(c)
10156                  }, "اتصال", 8, _hoisted_41)
10157                ])
10158              ]))
10159            }), 128))]))
10160      ]),
10161      _: 1
10162    }, 8, ["title"]))
10163  }
10164}
10165})()
10166  };
10167
10168  const AdminEmergencyPage={
10169    components:{AdminFrame},
10170    setup(){
10171      const store=useGzcStore();const router=useRouter();const route=useRoute();const filterStatus=ref('active');
10172      const workspaceMode=computed(()=>!!route.params.id);const targetTicket=String((route.query||{}).ticket||'').trim();
10173      const filteredRows=computed(()=>
10173{const all=store.state.emergencies;if(filterStatus.value==='all')return all;if(filterStatus.value==='active')return all.filter(e=>!['closed','resolved'].includes(String(e.status||'')));return all.filter(e=>String(e.status||'')===filterStatus.value);});
10174      const rows=computed(()=>workspaceMode.value?store.state.emergencies.filter(e=>String(e.id)===String(route.params.id)):filteredRows.value);
10175      const summary=computed(()=>store.state.emergencies.reduce((a,e)=>{a.total++;const st=String(e.status||'open');if(['closed','resolved'].includes(st))a.closed++;else a.open++;if(st==='in_progress')a.progress++;if(String(e.priority||'')==='high')a.high++;return a;},{total:0,open:0,progress:0,closed:0,high:0}));
10176      function phoneOf(e){return norm(e.whatsapp||e.china_phone||'');}
10177      function waLink(e){const p=phoneOf(e);return p?('https://wa.me/'+p):'#';}
10178      function telLink(e){const p=phoneOf(e);return p?('tel:+'+p):'#';}
10179      function mapLink(e){const loc=String(e.location_text||'');return loc.includes(',')?('https://maps.google.com/?q='+encodeURIComponent(loc)):'';}
10180      function priorityName(v){return ({low:'عادية',normal:'عادية',medium:'متوسطة',high:'عاجلة',critical:'حرجة'}[String(v||'')])||String(v||'-');}
10181      function openAttachment(m){if(m&&m.file_url)window.open(m.file_url,'_blank','noopener');}
10182      function openWorkspace(e){if(e&&e.id)router.push('/admin/emergency/'+encodeURIComponent(e.id));}
10183      function closeWorkspace(){router.push('/admin/emergency');}
10184      async function redirectLegacyTarget(){if(workspaceMode.value||!targetTicket)return;const row=store.state.emergencies.find(e=>String(e.id)===targetTicket||String(e.ticket_code||'')===targetTicket);if(row)await router.replace('/admin/emergency/'+encodeURIComponent(row.id));}
10185      async function load(){if(await store.requireAdmin(router)){await store.loadAdminEmergencies(router);await redirectLegacyTarget();if(workspaceMode.value&&!rows.value.length)store.state.msg='بلاغ الطوارئ غير موجود أو خارج نطاق صلاحيتك';}}
10186      onMounted(load);watch(()=>route.params.id,load);
10187      async function setStatus(e,st){if(!e||!e.id)return;store.state.busy=true;store.state.msg='جاري تحديث بلاغ الطوارئ...';const r=await api('/api/admin/emergencies/'+encodeURIComponent(e.id)+'/status',{method:'POST',body:JSON.stringify({status:st})});store.state.busy=false;store.state.msg=r.message||r.error||'';await load();}
10188      return {store,rows,summary,filterStatus,workspaceMode,openWorkspace,closeWorkspace,load,setStatus,caseTypeName,caseStatusName,priorityName,phoneOf,waLink,telLink,mapLink,openAttachment,mediaSrc,shortDate,adminRecordUpdatedAt,adminQueueOwner,emergencyQueueNextAction};
10189    },
10190    render:(function(){
10191const _Vue = Vue
10192const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
10193
10194const _hoisted_1 = { class: "card opsSummaryCard emergencyOps" }
10195const _hoisted_2 = { class: "miniStats" }
10196const _hoisted_3 = { class: "opsFilterBar" }
10197const _hoisted_4 = ["onClick"]
10198const _hoisted_5 = ["onClick"]
10199const _hoisted_6 = ["onClick"]
10200const _hoisted_7 = ["onClick"]
10201const _hoisted_8 = {
10202  key: 1,
10203  class: "adminWorkspaceBackBar emergencyWorkspaceBack"
10204}
10205const _hoisted_9 = ["onClick"]
10206const _hoisted_10 = {
10207  key: 2,
10208  class: "card adminQueueState adminQueueLoading"
10209}
10210const _hoisted_11 = {
10211  key: 3,
10212  class: "card emptyCard adminQueueState"
10213}
10214const _hoisted_12 = {
10215  key: 4,
10216  class: "adminQueueList emergencyQueueList"
10217}
10218const _hoisted_13 = ["onClick", "onKeyup"]
10219const _hoisted_14 = { class: "adminQueueIdentity" }
10220const _hoisted_15 = { class: "adminQueueFacts adminWorkflowFacts" }
10221const _hoisted_16 = { class: "adminQueueNextAction" }
10222const _hoisted_17 = ["onClick"]
10223const _hoisted_18 = {
10224  key: 5,
10225  class: "opsList"
10226}
10227const _hoisted_19 = { class: "adminRecordWorkspaceTop" }
10228const _hoisted_20 = ["onClick"]
10229const _hoisted_21 = { class: "memberCardTop compactToggleRow" }
10230const _hoisted_22 = { class: "hint" }
10231const _hoisted_23 = { class: "statusPill dangerPill" }
10232const _hoisted_24 = { class: "compactSummaryBar" }
10233const _hoisted_25 = { dir: "ltr" }
10234const _hoisted_26 = { class: "recordNarrative emergencyNarrative" }
10235const _hoisted_27 = { class: "opsDesc" }
10236const _hoisted_28 = { class: "metaRow" }
10237const _hoisted_29 = {
10238  key: 0,
10239  class: "announcementMediaGrid"
10240}
10241const _hoisted_30 = ["onClick"]
10242const _hoisted_31 = ["src"]
10243const _hoisted_32 = { class: "memberActions stageActions emergencyStageActions" }
10244const _hoisted_33 = ["onClick"]
10245const _hoisted_34 = ["onClick"]
10246const _hoisted_35 = ["onClick"]
10247const _hoisted_36 = ["href"]
10248const _hoisted_37 = ["href"]
10249const _hoisted_38 = ["href"]
10250
10251return function render(_ctx, _cache) {
10252  with (_ctx) {
10253    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, normalizeClass: _normalizeClass, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, renderList: _renderList, withModifiers: _withModifiers, withKeys: _withKeys, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
10254
10255    const _component_AdminFrame = _resolveComponent("AdminFrame")
10256
10257    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "الطوارئ" }, {
10258      default: _withCtx(() => [
10259        (!workspaceMode)
10260          ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_cache[3] || (_cache[3] = _createElementVNode("section", { class: "adminQueueIntro emergencyQueueIntro" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "قائمة عاجلة"), _createElementVNode("h2", null, "الطوارئ"), _createElementVNode("p", null, "القائمة للفرز السريع فقط. افتح البلاغ قبل اتخاذ إجراء حتى تبقى التفاصيل والتواصل والحالة في سياق واحد.")])], -1)), _createElementVNode("div", _hoisted_1, [_createElementVNode("div", _hoisted_2, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(summary.total), 1), _cache[0] || (_cache[0] = _createElementVNode("small", null, "الإجمالي", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(summary.open), 1), _cache[1] || (_cache[1] = _createElementVNode("small", null, "نشطة", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(summary.high), 1), _cache[2] || (_cache[2] = _createElementVNode("small", null, "عاجلة", -1))])]), _createElementVNode("div", _hoisted_3, [
10261              _createElementVNode("button", {
10262                class: _normalizeClass(filterStatus==='active'?'active':''),
10263                onClick: $event => (filterStatus='active')
10264              }, "النشطة", 10, _hoisted_4),
10265              _createElementVNode("button", {
10266                class: _normalizeClass(filterStatus==='all'?'active':''),
10267                onClick: $event => (filterStatus='all')
10268              }, "الكل", 10, _hoisted_5),
10269              _createElementVNode("button", {
10270                class: _normalizeClass(filterStatus==='in_progress'?'active':''),
10271                onClick: $event => (filterStatus='in_progress')
10272              }, "متابعة", 10, _hoisted_6),
10273              _createElementVNode("button", {
10274                class: _normalizeClass(filterStatus==='closed'?'active':''),
10275                onClick: $event => (filterStatus='closed')
10276              }, "مغلقة", 10, _hoisted_7)
10277            ])])], 64))
10278          : _createCommentVNode("", true),
10279        workspaceMode
10280          ? (_openBlock(), _createElementBlock("div", _hoisted_8, [_createElementVNode("button", {
10281              class: "smallbtn secondary",
10282              onClick: closeWorkspace
10283            }, "← العودة للطوارئ", 8, _hoisted_9), _cache[4] || (_cache[4] = _createElementVNode("span", null, "مساحة بلاغ مستقلة — الأولوية والتواصل والموقع والإجراء في سجل واحد", -1))]))
10284          : _createCommentVNode("", true),
10285        (store.state.busy && !rows.length)
10286          ? (_openBlock(), _createElementBlock("div", _hoisted_10, "جاري تحميل بلاغات الطوارئ..."))
10287          : (!rows.length)
10288            ? (_openBlock(), _createElementBlock("div", _hoisted_11, _toDisplayString(workspaceMode?'بلاغ الطوارئ غير موجود.':'لا توجد بلاغات مطابقة.'), 1))
10289            : _createCommentVNode("", true),
10290        (!workspaceMode)
10291          ? (_openBlock(), _createElementBlock("div", _hoisted_12, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(rows, (e) => {
10292              return (_openBlock(), _createElementBlock("article", {
10293                class: "adminQueueRow emergencyQueueRow",
10294                key: e.id,
10295                onClick: $event => (openWorkspace(e)),
10296                tabindex: "0",
10297                onKeyup: _withKeys($event => (openWorkspace(e)), ["enter"])
10298              }, [_createElementVNode("div", _hoisted_14, [_cache[5] || (_cache[5] = _createElementVNode("div", { class: "memberThumb memberThumbPlaceholder emergencyAvatar" }, "!", -1)), _createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(e.ticket_code || 'بلاغ طوارئ'), 1), _createElementVNode("small", null, _toDisplayString(e.full_name || 'عضو') + " · " + _toDisplayString(e.location_text || $cityLabel(e.china_city) || 'بدون موقع'), 1)])]), _createElementVNode("div", _hoisted_15, [
10299                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(caseStatusName(e.status)), 1), _createElementVNode("small", null, "الحالة · " + _toDisplayString(priorityName(e.priority)), 1)]),
10300                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(adminQueueOwner('emergency',e)), 1), _cache[6] || (_cache[6] = _createElementVNode("small", null, "المسؤول", -1))]),
10301                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(adminRecordUpdatedAt(e)), 1
10301), _cache[7] || (_cache[7] = _createElementVNode("small", null, "آخر تحديث", -1))]),
10302                _createElementVNode("span", _hoisted_16, [_createElementVNode("b", null, _toDisplayString(emergencyQueueNextAction(e)), 1), _cache[8] || (_cache[8] = _createElementVNode("small", null, "الإجراء التالي", -1))])
10303              ]), _createElementVNode("button", {
10304                class: "smallbtn secondary adminQueueOpen",
10305                onClick: _withModifiers($event => (openWorkspace(e)), ["stop"])
10306              }, "فتح البلاغ", 8, _hoisted_17)], 40, _hoisted_13))
10307            }), 128))]))
10308          : (_openBlock(), _createElementBlock("div", _hoisted_18, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(rows, (e) => {
10309              return (_openBlock(), _createElementBlock("article", {
10310                class: "card opsCard emergencyOps adminRecordWorkspace recordWorkspaceOnly emergencyRecordWorkspace",
10311                key: e.id
10312              }, [
10313                _createElementVNode("div", _hoisted_19, [_createElementVNode("button", {
10314                  class: "smallbtn secondary",
10315                  onClick: closeWorkspace
10316                }, "← العودة للطوارئ", 8, _hoisted_20)]),
10317                _createElementVNode("div", _hoisted_21, [_createElementVNode("div", null, [_cache[9] || (_cache[9] = _createElementVNode("span", { class: "adminEyebrow" }, "بلاغ طوارئ", -1)), _createElementVNode("h3", null, _toDisplayString(e.ticket_code || 'بلاغ'), 1), _createElementVNode("p", _hoisted_22, _toDisplayString(e.full_name || 'عضو') + " · الأولوية: " + _toDisplayString(priorityName(e.priority)), 1)]), _createElementVNode("span", _hoisted_23, _toDisplayString(caseStatusName(e.status)), 1)]),
10318                _createElementVNode("div", _hoisted_24, [_createElementVNode("span", null, [_createElementVNode("b", _hoisted_25, _toDisplayString(phoneOf(e)||'-'), 1), _cache[10] || (_cache[10] = _createElementVNode("small", null, "التواصل", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(shortDate(e.created_at)), 1), _cache[11] || (_cache[11] = _createElementVNode("small", null, "وقت البلاغ", -1))])]),
10319                _createElementVNode("section", _hoisted_26, [_cache[13] || (_cache[13] = _createElementVNode("h4", null, "تفاصيل البلاغ", -1)), _createElementVNode("p", _hoisted_27, _toDisplayString(e.description || 'لا يوجد وصف.'), 1), _createElementVNode("div", _hoisted_28, [_cache[12] || (_cache[12] = _createElementVNode("b", null, "الموقع", -1)), _createElementVNode("span", null, _toDisplayString(e.location_text || $cityLabel(e.china_city) || 'غير محدد'), 1)])]),
10320                (e.media&&e.media.length)
10321                  ? (_openBlock(), _createElementBlock("div", _hoisted_29, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(e.media, (m) => {
10322                      return (_openBlock(), _createElementBlock("button", {
10323                        key: m.id,
10324                        class: "announcementMediaItem",
10325                        onClick: $event => (openAttachment(m))
10326                      }, [_createElementVNode("img", {
10327                        src: mediaSrc(m),
10328                        loading: "lazy",
10329                        alt: "صورة البلاغ"
10330                      }, null, 8, _hoisted_31), _cache[14] || (_cache[14] = _createElementVNode("span", null, "صورة", -1))], 8, _hoisted_30))
10331                    }), 128))]))
10332                  : _createCommentVNode("", true),
10333                _createElementVNode("div", _hoisted_32, [
10334                  _createElementVNode("button", {
10335                    class: "smallbtn",
10336                    onClick: $event => (setStatus(e,'open'))
10337                  }, "مفتوح", 8, _hoisted_33),
10338                  _createElementVNode("button", {
10339                    class: "smallbtn",
10340                    onClick: $event => (setStatus(e,'in_progress'))
10341                  }, "قيد المتابعة", 8, _hoisted_34),
10342                  _createElementVNode("button", {
10343                    class: "smallbtn danger",
10344                    onClick: $event => (setStatus(e,'closed'))
10345                  }, "إغلاق البلاغ", 8, _hoisted_35),
10346                  _createElementVNode("a", {
10347                    class: "smallbtn secondary",
10348                    href: waLink(e),
10349                    target: "_blank"
10350                  }, "واتساب", 8, _hoisted_36),
10351                  _createElementVNode("a", {
10352                    class: "smallbtn secondary",
10353                    href: telLink(e)
10354                  }, "اتصال", 8, _hoisted_37),
10355                  (mapLink(e))
10356                    ? (_openBlock(), _createElementBlock("a", {
10357                        key: 0,
10358                        class: "smallbtn secondary",
10359                        href: mapLink(e),
10360                        target: "_blank"
10361                      }, "فتح الموقع", 8, _hoisted_38))
10362                    : _createCommentVNode("", true)
10363                ])
10364              ]))
10365            }), 128))]))
10366      ]),
10367      _: 1
10368    }))
10369  }
10370}
10371})()
10372  };
10373
10374  const AdminEventsPage={
10375    components:{AdminFrame},
10376    setup(){
10377      const store=useGzcStore();const router=useRouter();const route=useRoute();const files=reactive({});const editOpen=reactive({});const filterStatus=ref('active');const search=ref('');const actionBusy=reactive({});
10378      const workspaceMode=computed(()=>!!route.params.id);
10379      const summary=computed(()=>Object.assign({all:0,total:0,active:0,completed:0,archived:0,media:0},store.state.eventMeta.counts||{}, {all:Number((store.state.eventMeta.counts||{}).total||0)}));
10380      const visibleEvents=computed(()=>safeArray(store.state.events));
10381      const workspaceMedia=computed(()=>workspaceMode.value?safeArray(store.state.eventMedia[route.params.id]):[]);
10382      const workspacePhotos=computed(()=>workspaceMedia.value.filter(m=>String(m.kind)==='image'));
10383      const workspaceVideos=computed(()=>workspaceMedia.value.filter(m=>String(m.kind)==='video'));
10384      const workspacePreview=computed(()=>workspaceMedia.value.slice(0,6));
10385      const form=reactive({title:'',title_cn:'',description:'',location:'',address_cn:'',amap_url:'',event_date:'',event_time:'',category:'community_meeting',attendees_count:0,families_count:0,max_seats:0,registration_required:false,checkin_enabled:false,public_visibility:false,public_summary:'',public_location:''});
10386      const edit=reactive({});
10387      function setBusy(key,v){actionBusy[key]=!!v;}
10388      async function load(){
10389        if(!(await store.requireAdmin(router)))return;
10390        if(workspaceMode.value){store.state.busy=true;const r=await store.loadAdminEvent(route.params.id,router);if(r&&r.ok)await store.loadEventMedia(route.params.id,router);else store.state.msg='الفعالية غير موجودة أو خارج نطاق صلاحيتك';store.state.busy=false;return;}
10391        await store.loadAdminEvents(router,{page:1,limit:30,status:filterStatus.value,search:search.value});
10392      }
10393      async function loadMore(){if(!store.state.eventMeta.has_more)return;setBusy('more',true);await store.loadAdminEvents(router,{page:Number(store.state.eventMeta.page||1)+1,limit:30,status:filterStatus.value,search:search.value,append:true});setBusy('more',false);}
10394      onMounted(load);watch(()=>route.params.id,load);watch(filterStatus,()=>{if(!workspaceMode.value)load();});
10395      let searchTimer=0;
10395watch(search,()=>{if(workspaceMode.value)return;clearTimeout(searchTimer);searchTimer=setTimeout(load,300);});
10396      function reset(){Object.assign(form,{title:'',title_cn:'',description:'',location:'',address_cn:'',amap_url:'',event_date:'',event_time:'',category:'community_meeting',attendees_count:0,families_count:0,max_seats:0,registration_required:false,checkin_enabled:false,public_visibility:false,public_summary:'',public_location:''});}
10397      async function createEvent(){setBusy('create',true);store.state.msg='جاري إنشاء الفعالية...';const payload=Object.assign({},form,{attendees_count:Number(form.attendees_count||0),families_count:Number(form.families_count||0),max_seats:Number(form.max_seats||0)});const r=await api('/api/admin/events',{method:'POST',body:JSON.stringify(payload)});setBusy('create',false);store.state.msg=r.message||r.error||'';if(r.ok){reset();if(r.id)router.push('/admin/events/'+encodeURIComponent(r.id));}}
10398      function onFiles(e,id){files[id]=Array.from(e.target.files||[]);}
10399      async function uploadMedia(ev){const list=files[ev.id]||[];if(!list.length){store.state.msg='اختر صور أو فيديوهات أولاً';return;}const fd=new FormData();list.forEach(f=>fd.append('files',f));setBusy('upload:'+ev.id,true);store.state.msg='جاري رفع وسائط الفعالية...';const r=await uploadApi('/api/admin/events/'+encodeURIComponent(ev.id)+'/media',{method:'POST',body:fd,headers:{'Accept':'application/json'},uploadLabel:'رفع وسائط الفعالية'});setBusy('upload:'+ev.id,false);store.state.msg=r.message||r.error||'';files[ev.id]=[];if(r.ok){if(r.event)store.replaceEvent(r.event);store.state.eventMedia[ev.id]=safeArray(store.state.eventMedia[ev.id]).concat(safeArray(r.media));}}
10400      function openWorkspace(e){if(e&&e.id)router.push('/admin/events/'+encodeURIComponent(e.id));}
10401      function closeWorkspace(){router.push('/admin/events');}
10402      function startEdit(e){editOpen[e.id]=true;edit[e.id]={title:e.title||'',title_cn:e.title_cn||'',description:e.description||'',location:e.location||'',address_cn:e.address_cn||'',amap_url:e.amap_url||'',event_date:(e.event_date||'').slice(0,10),event_time:e.event_time||'',category:e.category||'community_meeting',status:e.status||'published',attendees_count:Number(e.attendees_count||0),families_count:Number(e.families_count||0),max_seats:Number(e.max_seats||0),registration_required:!!e.registration_required,checkin_enabled:!!e.checkin_enabled,public_visibility:!!e.public_visibility,public_summary:e.public_summary||'',public_location:e.public_location||''};}
10403      function cancelEdit(e){editOpen[e.id]=false;}
10404      async function saveEvent(e){const payload=edit[e.id];if(!payload){store.state.msg='لا توجد تعديلات محفوظة';return;}setBusy('save:'+e.id,true);store.state.msg='جاري تحديث الفعالية...';const r=await api('/api/admin/events/'+encodeURIComponent(e.id)+'/update',{method:'POST',body:JSON.stringify(payload)});setBusy('save:'+e.id,false);store.state.msg=r.message||r.error||'';if(r.ok){editOpen[e.id]=false;if(r.event)store.replaceEvent(r.event);}}
10405      async function setEventStatus(e,status){if(!e||!e.id)return;setBusy('status:'+e.id,true);const r=await api('/api/admin/events/'+encodeURIComponent(e.id)+'/status',{method:'POST',body:JSON.stringify({status})});setBusy('status:'+e.id,false);store.state.msg=r.message||r.error||'';if(r.ok&&r.event)store.replaceEvent(r.event);}
10406      async function sendReminder(e){if(!e||!e.id)return;setBusy('reminder:'+e.id,true);const r=await api('/api/admin/events/'+encodeURIComponent(e.id)+'/reminder',{method:'POST',body:JSON.stringify({type:'upcoming'})});setBusy('reminder:'+e.id,false);store.state.msg=r.message||r.error||'';}
10407      async function setCover(m){if(!m||!m.id||String(m.kind)!=='image')return;setBusy('cover:'+m.id,true);store.state.msg='جاري تعيين غلاف الفعالية...';const r=await api('/api/admin/event-media/'+encodeURIComponent(m.id)+'/cover',{method:'POST'});setBusy('cover:'+m.id,false);store.state.msg=r.message||r.error||'';if(r.ok){if(r.event)store.replaceEvent(r.event);const list=safeArray(store.state.eventMedia[route.params.id]);store.state.eventMedia[route.params.id]=list.map(x=>Object.assign({},x,{is_cover:String(x.id)===String(m.id)}));}}
10408      function shareWhatsapp(e){const lines=['فعالية من منصة SMT China',e.title||'فعالية',displayDateAr(e.event_date),e.event_time||'',e.location||e.address_cn||'',location.origin+'/events/'+e.id].filter(
10408Boolean);window.open('https://wa.me/?text='+encodeURIComponent(lines.join('\n')),'_blank');}
10409      return {store,form,files,editOpen,edit,filterStatus,search,actionBusy,workspaceMode,summary,visibleEvents,workspaceMedia,workspacePhotos,workspaceVideos,workspacePreview,load,loadMore,createEvent,onFiles,uploadMedia,openWorkspace,closeWorkspace,startEdit,cancelEdit,saveEvent,setEventStatus,sendReminder,setCover,shareWhatsapp,eventCategoryName,eventStatusName,displayDateAr,mediaSrc,isVideo,mediaKindName,adminRecordUpdatedAt,adminQueueOwner,eventQueueNextAction};
10410    },
10411    render:(function(){
10412const _Vue = Vue
10413const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
10414
10415const _hoisted_1 = {
10416  key: 0,
10417  class: "card collapseSection formCard eventComposer"
10418}
10419const _hoisted_2 = { class: "collapseBody" }
10420const _hoisted_3 = { class: "eventFormStack" }
10421const _hoisted_4 = { class: "fieldBlock" }
10422const _hoisted_5 = ["onUpdate:modelValue"]
10423const _hoisted_6 = { class: "fieldBlock" }
10424const _hoisted_7 = ["onUpdate:modelValue"]
10425const _hoisted_8 = { class: "fieldBlock" }
10426const _hoisted_9 = ["onUpdate:modelValue"]
10427const _hoisted_10 = { class: "editGrid eventEditGrid" }
10428const _hoisted_11 = { class: "fieldBlock" }
10429const _hoisted_12 = ["onUpdate:modelValue"]
10430const _hoisted_13 = { class: "fieldBlock" }
10431const _hoisted_14 = ["onUpdate:modelValue"]
10432const _hoisted_15 = { class: "fieldBlock" }
10433const _hoisted_16 = ["onUpdate:modelValue"]
10434const _hoisted_17 = { class: "fieldBlock" }
10435const _hoisted_18 = ["onUpdate:modelValue"]
10436const _hoisted_19 = { class: "fieldBlock" }
10437const _hoisted_20 = ["onUpdate:modelValue"]
10438const _hoisted_21 = { class: "editGrid eventEditGrid" }
10439const _hoisted_22 = { class: "fieldBlock" }
10440const _hoisted_23 = ["onUpdate:modelValue"]
10441const _hoisted_24 = ["value"]
10442const _hoisted_25 = { class: "fieldBlock" }
10443const _hoisted_26 = ["onUpdate:modelValue"]
10444const _hoisted_27 = { class: "fieldBlock" }
10445const _hoisted_28 = ["onUpdate:modelValue"]
10446const _hoisted_29 = { class: "fieldBlock" }
10447const _hoisted_30 = ["onUpdate:modelValue"]
10448const _hoisted_31 = { class: "checkgrid twoChecks" }
10449const _hoisted_32 = { class: "check" }
10450const _hoisted_33 = ["onUpdate:modelValue"]
10451const _hoisted_34 = { class: "check" }
10452const _hoisted_35 = ["onUpdate:modelValue"]
10453const _hoisted_36 = { class: "publicShareBox" }
10454const _hoisted_37 = { class: "check" }
10455const _hoisted_38 = ["onUpdate:modelValue"]
10456const _hoisted_39 = {
10457  key: 0,
10458  class: "editGrid"
10459}
10460const _hoisted_40 = ["onUpdate:modelValue"]
10461const _hoisted_41 = ["onUpdate:modelValue"]
10462const _hoisted_42 = ["onClick"]
10463const _hoisted_43 = {
10464  key: 1,
10465  class: "adminQueueIntro eventQueueIntro"
10466}
10467const _hoisted_44 = ["onClick"]
10468const _hoisted_45 = {
10469  key: 2,
10470  class: "miniStats mediaMini eventQueueStats"
10471}
10472const _hoisted_46 = {
10473  key: 3,
10474  class: "card eventSearchBar"
10475}
10476const _hoisted_47 = ["onUpdate:modelValue"]
10477const _hoisted_48 = {
10478  key: 4,
10479  class: "opsFilterBar announcementQueueFilters eventQueueFilters"
10480}
10481const _hoisted_49 = ["onClick"]
10482const _hoisted_50 = ["onClick"]
10483const _hoisted_51 = ["onClick"]
10484const _hoisted_52 = ["onClick"]
10485const _hoisted_53 = {
10486  key: 5,
10487  class: "card adminQueueState adminQueueLoading"
10488}
10489const _hoisted_54 = {
10490  key: 6,
10491  class: "card emptyCard adminQueueState"
10492}
10493const _hoisted_55 = {
10494  key: 7,
10495  class: "adminWorkspaceBackBar eventWorkspaceBack eventRecordTop"
10496}
10497const _hoisted_56 = ["onClick"]
10498const _hoisted_57 = {
10499  key: 8,
10500  class: "adminQueueList eventQueueList"
10501}
10502const _hoisted_58 = ["onClick", "onKeyup"]
10503const _hoisted_59 = { class: "adminQueueIdentity" }
10504const _hoisted_60 = { class: "eventQueueThumb" }
10505const _hoisted_61 = ["src"]
10506const _hoisted_62 = { key: 1 }
10507const _hoisted_63 = { class: "adminQueueFacts adminWorkflowFacts" }
10508const _hoisted_64 = { class: "adminQueueNextAction" }
10509const _hoisted_65 = ["onClick"]
10510const _hoisted_66 = ["disabled", "onClick"]
10511const _hoisted_67 = {
10512  key: 10,
10513  class: "opsList eventWorkspaceList"
10514}
10515const _hoisted_68 = ["src"]
10516const _hoisted_69 = { class: "eventWorkspaceHeader" }
10517const _hoisted_70 = { class: "adminEyebrow" }
10518const _hoisted_71 = { class: "eventStateRow" }
10519const _hoisted_72 = { class: "statusPill" }
10520const _hoisted_73 = {
10521  key: 0,
10522  class: "statusPill publicStatus"
10523}
10524const _hoisted_74 = { class: "eventWorkspaceCounts" }
10525const _hoisted_75 = { class: "eventActionBar" }
10526const _hoisted_76 = ["onClick"]
10527const _hoisted_77 = ["onClick"]
10528const _hoisted_78 = ["onClick"]
10529const _hoisted_79 = ["onClick"]
10530const _hoisted_80 = ["onClick"]
10531const _hoisted_81 = ["onClick"]
10532const _hoisted_82 = ["onClick"]
10533const _hoisted_83 = { class: "eventWorkspaceSection" }
10534const _hoisted_84 = { class: "eventQuickMeta" }
10535const _hoisted_85 = { class: "metaRow" }
10536const _hoisted_86 = { class: "metaRow" }
10537const _hoisted_87 = { class: "metaRow" }
10538const _hoisted_88 = { class: "metaRow" }
10539const _hoisted_89 = {
10540  key: 0,
10541  class: "recordNarrative eventNarrative"
10542}
10543const _hoisted_90 = {
10544  key: 1,
10545  class: "eventEditPanel"
10546}
10547const _hoisted_91 = { class: "memberSectionHead" }
10548const _hoisted_92 = ["onClick"]
10549const _hoisted_93 = { class: "editGrid eventEditGrid" }
10550const _hoisted_94 = { class: "fieldBlock" }
10551const _hoisted_95 = ["onUpdate:modelValue"]
10552const _hoisted_96 = { class: "fieldBlock" }
10553const _hoisted_97 = ["onUpdate:modelValue"]
10554const _hoisted_98 = { class: "fieldBlock" }
10555const _hoisted_99 = ["onUpdate:modelValue"]
10556const _hoisted_100 = { class: "fieldBlock" }
10557const _hoisted_101 = ["onUpdate:modelValue"]
10558const _hoisted_102 = { class: "fieldBlock" }
10559const _hoisted_103 = ["onUpdate:modelValue"]
10560const _hoisted_104 = { class: "fieldBlock" }
10561const _hoisted_105 = ["onUpdate:modelValue"]
10562const _hoisted_106 = { class: "fieldBlock" }
10563const _hoisted_107 = ["onUpdate:modelValue"]
10564const _hoisted_108 = { class: "fieldBlock" }
10565const _hoisted_109 = ["onUpdate:modelValue"]
10566const _hoisted_110 = { class: "fieldBlock" }
10567const _hoisted_111 = ["onUpdate:modelValue"]
10568const _hoisted_112 = ["value"]
10569const _hoisted_113 = { class: "fieldBlock" }
10570const _hoisted_114 = ["onUpdate:modelValue"]
10571const _hoisted_115 = ["value"]
10572const _hoisted_116 = { class: "fieldBlock" }
10573const _hoisted_117 = ["onUpdate:modelValue"]
10574const _hoisted_118 = { class: "fieldBlock" }
10575const _hoisted_119 = ["onUpdate:modelValue"]
10576const _hoisted_120 = { class: "fieldBlock" }
10577const _hoisted_121 = ["onUpdate:modelValue"]
10578const _hoisted_122 = { class: "checkgrid twoChecks" }
10579const _hoisted_123 = { class: "check" }
10580const _hoisted_124 = ["onUpdate:modelValue"]
10581const _hoisted_125 = { class: "check" }
10582const _hoisted_126 = ["onUpdate:modelValue"]
10583const _hoisted_127 = { class: "publicShareBox" }
10584const _hoisted_128 = { class: "check" }
10585const _hoisted_129 = ["onUpdate:modelValue"]
10586const _hoisted_130 = {
10587  key: 0,
10588  class: "editGrid"
10589}
10590const _hoisted_131 = ["onUpdate:modelValue"]
10591const _hoisted_132 = ["onUpdate:modelValue"]
10592const _hoisted_133 = { class: "row" }
10593const _hoisted_134 = ["onClick"]
10594const _hoisted_135 = ["onClick"]
10595const _hoisted_136 = { class: "eventWorkspaceSection eventAlbumPreviewSection" }
10596const _hoisted_137 = { class: "memberSectionHead" }
10597const _hoisted_138 = ["onClick"]
10598const _hoisted_139 = { class: "miniStats mediaMini eventAlbumStats" }
10599const _hoisted_140 = { class: "uploadBoxPro eventInlineUpload" }
10600const _hoisted_141 = { class: "filePicker" }
10601const _hoisted_142 = ["onChange"]
10602const _hoisted_143 = ["disabled", "onClick"]
10603const _hoisted_144 = {
10604  key: 0,
10605  class: "albumGrid albumGridInline eventWorkspaceAlbumGrid"
10606}
10607const _hoisted_145 = ["src"]
10608const _hoisted_146 = ["src"]
10609const _hoisted_147 = ["disabled", "onClick"]
10610const _hoisted_148 = {
10611  key: 1,
10612  class: "emptyInline"
10613}
10614
10615return function render(_ctx, _cache) {
10616  with (_ctx) {
10617    const { createElementVNode: _createElementVNode, vModelText: _vModelText, withDirectives: _withDirectives, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, toDisplayString: _toDisplayString, vModelSelect: _vModelSelect, vModelCheckbox: _vModelCheckbox, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode, normalizeClass: _normalizeClass, withModifiers: _withModifiers, withKeys: _withKeys, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
10618
10619    const _component_AdminFrame = _resolveComponent("AdminFrame")
10620
10621    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "الفعاليات" }, {
10622      default: _withCtx(() => [
10623        (!workspaceMode)
10624          ? (_openBlock(), _createElementBlock("details", _hoisted_1, [_cache[23] || (_cache[23] = _createElementVNode("summary", null, [_createElementVNode("b", null, "+ إنشاء فعالية جديدة"), _createElementVNode("span", null, "افتح النموذج عند الحاجة")], -1)), _createElementVNode("div", _hoisted_2, [_cache[22] || (_cache[22] = _createElementVNode("p", { class: "hint" }, "أنشئ الفعالية أولاً، ثم افتح مساحتها لإدارة التفاصيل والألبوم والإجراءات من مكان واحد.", -1)), _createElementVNode("div", _hoisted_3, [
10625              _cache[18] || (_cache[18] = _createElementVNode("div", { class: "formSectionTitle" }, "1) المعلومات الأساسية", -1)),
10626              _createElementVNode("div", _hoisted_4, [_cache[0] || (_cache[0] = _createElementVNode("b", null, "عنوان الفعالية", -1)), _cache[1] || (_cache[1] = _createElementVNode("small", null, "الاسم الذي سيظهر للأعضاء وفي واتساب.", -1)), _withDirectives(_createElementVNode("input", {
10627                "onUpdate:modelValue": $event => ((form.title) = $event),
10628                placeholder: "مثال: رحلة عيد الأضحى إلى فوشان"
10629              }, null, 8, _hoisted_5), [[_vModelText, form.title]])]),
10630              _createElementVNode("div", _hoisted_6, [_cache[2] || (_cache[2] = _createElementVNode("b", null, "العنوان بالصيني (اختياري)", -1)), _cache[3] || (_cache[3] = _createElementVNode("small", null, "يفيد للسائق أو للمكان.", -1)), _withDirectives(_createElementVNode("input", {
10631                "onUpdate:modelValue": $event => ((form.title_cn) = $event),
10632                placeholder: "العنوان بالصيني إن وجد"
10633              }, null, 8, _hoisted_7), [[_vModelText, form.title_cn]])]),
10634              _createElementVNode("div", _hoisted_8, [_cache[4] || (_cache[4] = _createElementVNode("b", null, "وصف الفعالية", -1)), _cache[5] || (_cache[5] = _createElementVNode("small", null, "الهدف، الفئة المستهدفة، وأي ملاحظات مهمة.", -1)), _withDirectives(_createElementVNode("textarea", {
10635                "onUpdate:modelValue": $event => ((form.description) = $event),
10636                placeholder: "وصف واضح ومختصر للفعالية"
10637              }, null, 8, _hoisted_9), [[_vModelText, form.description]])]),
10638              _cache[19] || (_cache[19] = _createElementVNode("div", { class: "formSectionTitle" }, "2) المكان والموعد", -1)),
10639              _createElementVNode("div", _hoisted_10, [
10640                _createElementVNode("div", _hoisted_11, [_cache[6] || (_cache[6] = _createElementVNode("b", null, "الموقع المختصر", -1)), _withDirectives(_createElementVNode("input", {
10641                  "onUpdate:modelValue": $event => ((form.location) = $event),
10642                  placeholder: "مثال: فوشان"
10643                }, null, 8, _hoisted_12), [[_vModelText, form.location]])]),
10644                _createElementVNode("div", _hoisted_13, [_cache[7] || (_cache[7] = _
10644createElementVNode("b", null, "العنوان بالصيني", -1)), _withDirectives(_createElementVNode("input", {
10645                  "onUpdate:modelValue": $event => ((form.address_cn) = $event),
10646                  placeholder: "地址 / 中文地址"
10647                }, null, 8, _hoisted_14), [[_vModelText, form.address_cn]])]),
10648                _createElementVNode("div", _hoisted_15, [_cache[8] || (_cache[8] = _createElementVNode("b", null, "رابط Amap", -1)), _withDirectives(_createElementVNode("input", {
10649                  "onUpdate:modelValue": $event => ((form.amap_url) = $event),
10650                  placeholder: "https://uri.amap.com/..."
10651                }, null, 8, _hoisted_16), [[_vModelText, form.amap_url]])]),
10652                _createElementVNode("div", _hoisted_17, [_cache[9] || (_cache[9] = _createElementVNode("b", null, "تاريخ الفعالية", -1)), _withDirectives(_createElementVNode("input", {
10653                  type: "date",
10654                  "onUpdate:modelValue": $event => ((form.event_date) = $event)
10655                }, null, 8, _hoisted_18), [[_vModelText, form.event_date]])]),
10656                _createElementVNode("div", _hoisted_19, [_cache[10] || (_cache[10] = _createElementVNode("b", null, "وقت البداية", -1)), _withDirectives(_createElementVNode("input", {
10657                  "onUpdate:modelValue": $event => ((form.event_time) = $event),
10658                  placeholder: "مثال: 13:30"
10659                }, null, 8, _hoisted_20), [[_vModelText, form.event_time]])])
10660              ]),
10661              _cache[20] || (_cache[20] = _createElementVNode("div", { class: "formSectionTitle" }, "3) النوع والسعة", -1)),
10662              _createElementVNode("div", _hoisted_21, [
10663                _createElementVNode("div", _hoisted_22, [_cache[11] || (_cache[11] = _createElementVNode("b", null, "نوع الفعالية", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((form.category) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList($optionList('event_category',form.category), (o) => {
10664                  return (_openBlock(), _createElementBlock("option", {
10665                    key: o.value,
10666                    value: o.value
10667                  }, _toDisplayString(o.label), 9, _hoisted_24))
10668                }), 128))], 8, _hoisted_23), [[_vModelSelect, form.category]])]),
10669                _createElementVNode("div", _hoisted_25, [_cache[12] || (_cache[12] = _createElementVNode("b", null, "الحضور المتوقع", -1)), _withDirectives(_createElementVNode("input", {
10670                  type: "number",
10671                  min: "0",
10672                  "onUpdate:modelValue": $event => ((form.attendees_count) = $event)
10673                }, null, 8, _hoisted_26), [[_vModelText, form.attendees_count]])]),
10674                _createElementVNode("div", _hoisted_27, [_cache[13] || (_cache[13] = _createElementVNode("b", null, "عدد الأسر", -1)), _withDirectives(_createElementVNode("input", {
10675                  type: "number",
10676                  min: "0",
10677                  "onUpdate:modelValue": $event => ((form.families_count) = $event)
10678                }, null, 8, _hoisted_28), [[_vModelText, form.families_count]])]),
10679                _createElementVNode("div", _hoisted_29, [_cache[14] || (_cache[14] = _createElementVNode("b", null, "السعة القصوى", -1)), _withDirectives(_createElementVNode("input", {
10680                  type: "number",
10681                  min: "0",
10682                  "onUpdate:modelValue": $event => ((form.max_seats) = $event)
10683                }, null, 8, _hoisted_30), [[_vModelText, form.max_seats]])])
10684              ]),
10685              _cache[21] || (_cache[21] = _createElementVNode("div", { class: "formSectionTitle" }, "4) التسجيل والنشر", -1)),
10686              _createElementVNode("div", _hoisted_31, [_createElementVNode("label", _hoisted_32, [_withDirectives(_createElementVNode("input", {
10687                type: "checkbox",
10688                "onUpdate:modelValue": $event => ((form.registration_required) = $event)
10689              }, null, 8, _hoisted_33), [[_vModelCheckbox, form.registration_required]]), _cache[15] || (_cache[15] = _createElementVNode("span", null, [_createElementVNode("b", null, "تسجيل مطلوب"), _createElementVNode("small", null, "الحضور يحتاج تسجيل مسبق.")], -1))]), _createElementVNode("label", _hoisted_34, [_withDirectives(_createElementVNode("input", {
10690                type: "checkbox",
10691                "onUpdate:modelValue": $event => ((form.checkin_enabled) = $event)
10692              }, null, 8, _hoisted_35), [[_vModelCheckbox, form.checkin_enabled]]), _cache[16] || (_cache[16] = _createElementVNode("span", null, [_createElementVNode("b", null, "تفعيل الحضور"), _createElementVNode("small", null, "متابعة الحضور يوم الفعالية.")], -1))])]),
10693              _createElementVNode("div", _hoisted_36, [_createElementVNode("label", _hoisted_37, [_withDirectives(_createElementVNode("input", {
10694                type: "checkbox",
10695                "onUpdate:modelValue": $event => ((form.public_visibility) = $event)
10696              }, null, 8, _hoisted_38), [[_vModelCheckbox, form.public_visibility]]), _cache[17] || (_cache[17] = _createElementVNode("span", null, [_createElementVNode("b", null, "إظهار كفعالية عامة للزوار"), _createElementVNode("small", null, "استخدم ملخصاً وموقعاً آمنين للنشر العام فقط.")], -1))]), (form.public_visibility)
10697                ? (_openBlock(), _createElementBlock("div", _hoisted_39, [_withDirectives(_createElementVNode("textarea", {
10698                    "onUpdate:modelValue": $event => ((form.public_summary) = $event),
10699                    maxlength: "1500",
10700                    placeholder: "ملخص عام آمن للنشر"
10701                  }, null, 8, _hoisted_40), [[_vModelText, form.public_summary]]), _withDirectives(_createElementVNode("input", {
10702                    "onUpdate:modelValue": $event => ((form.public_location) = $event),
10703                    maxlength: "300",
10704                    placeholder: "موقع عام مثل: قوانغتشو"
10705                  }, null, 8, _hoisted_41), [[_vModelText, form.public_location]])]))
10706                : _createCommentVNode("", true)]),
10707              _createElementVNode("button", {
10708                class: "btn loadMore",
10709                onClick: createEvent
10710              }, "إنشاء وفتح مساحة الفعالية", 8, _hoisted_42)
10711            ])])]))
10712          : _createCommentVNode("", true),
10713        (!workspaceMode)
10714          ? (_openBlock(), _createElementBlock("section", _hoisted_43, [_cache[24] || (_cache[24] = _createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "إدارة الفعاليات والألبومات"), _createElementVNode("h2", null, "الفعاليات"), _createElementVNode("p", null, "قائمة خفيفة للفرز. افتح الفعالية لتعديل التفاصيل، رفع الوسائط، تعيين الغلاف، التذكير وتغيير الحالة في سياق واحد.")], -1)), _createElementVNode("button", {
10715              class: "smallbtn primaryInlineAction",
10716              onClick: load
10717            }, "تحديث", 8, _hoisted_44)]))
10718          : _createCommentVNode("", true),
10719        (!workspaceMode)
10720          ? (_openBlock(), _createElementBlock("div", _hoisted_45, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(summary.active), 1), _cache[25] || (_cache[25] = _createElementVNode("small", null, "نشطة", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(summary.completed), 1), _cache[26] || (_cache[26] = _createElementVNode("small", null, "مكتملة", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(summary.media), 1), _cache[27] || (_cache[27] = _
10720createElementVNode("small", null, "وسائط", -1))])]))
10721          : _createCommentVNode("", true),
10722        (!workspaceMode)
10723          ? (_openBlock(), _createElementBlock("div", _hoisted_46, [_withDirectives(_createElementVNode("input", {
10724              "onUpdate:modelValue": $event => ((search) = $event),
10725              type: "search",
10726              placeholder: "ابحث باسم الفعالية، الموقع أو العنوان...",
10727              "aria-label": "بحث الفعاليات"
10728            }, null, 8, _hoisted_47), [[_vModelText, search]])]))
10729          : _createCommentVNode("", true),
10730        (!workspaceMode)
10731          ? (_openBlock(), _createElementBlock("div", _hoisted_48, [
10732              _createElementVNode("button", {
10733                class: _normalizeClass(["smallbtn", {secondary:filterStatus!=='active'}]),
10734                onClick: $event => (filterStatus='active')
10735              }, [_cache[28] || (_cache[28] = _createTextVNode("النشطة ")), _createElementVNode("small", null, _toDisplayString(summary.active), 1)], 10, _hoisted_49),
10736              _createElementVNode("button", {
10737                class: _normalizeClass(["smallbtn", {secondary:filterStatus!=='completed'}]),
10738                onClick: $event => (filterStatus='completed')
10739              }, [_cache[29] || (_cache[29] = _createTextVNode("المكتملة ")), _createElementVNode("small", null, _toDisplayString(summary.completed), 1)], 10, _hoisted_50),
10740              _createElementVNode("button", {
10741                class: _normalizeClass(["smallbtn", {secondary:filterStatus!=='archived'}]),
10742                onClick: $event => (filterStatus='archived')
10743              }, [_cache[30] || (_cache[30] = _createTextVNode("المؤرشفة ")), _createElementVNode("small", null, _toDisplayString(summary.archived), 1)], 10, _hoisted_51),
10744              _createElementVNode("button", {
10745                class: _normalizeClass(["smallbtn", {secondary:filterStatus!=='all'}]),
10746                onClick: $event => (filterStatus='all')
10747              }, [_cache[31] || (_cache[31] = _createTextVNode("الكل ")), _createElementVNode("small", null, _toDisplayString(summary.all), 1)], 10, _hoisted_52)
10748            ]))
10749          : _createCommentVNode("", true),
10750        (store.state.busy && !visibleEvents.length)
10751          ? (_openBlock(), _createElementBlock("div", _hoisted_53, "جاري تحميل الفعاليات..."))
10752          : (!visibleEvents.length)
10753            ? (_openBlock(), _createElementBlock("div", _hoisted_54, _toDisplayString(workspaceMode?'الفعالية غير موجودة.':'لا توجد فعاليات في هذا التصنيف.'), 1))
10754            : _createCommentVNode("", true),
10755        workspaceMode
10756          ? (_openBlock(), _createElementBlock("div", _hoisted_55, [_createElementVNode("button", {
10757              class: "smallbtn secondary compactBackButton",
10758              onClick: closeWorkspace
10759            }, "← العودة للفعاليات", 8, _hoisted_56), _cache[32] || (_cache[32] = _createElementVNode("span", null, "مساحة فعالية مستقلة", -1))]))
10760          : _createCommentVNode("", true),
10761        (!workspaceMode)
10762          ? (_openBlock(), _createElementBlock("div", _hoisted_57, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(visibleEvents, (e) => {
10763              return (_openBlock(), _createElementBlock("article", {
10764                class: "adminQueueRow eventQueueRow",
10765                key: e.id,
10766                onClick: $event => (openWorkspace(e)),
10767                tabindex: "0",
10768                onKeyup: _withKeys($event => (openWorkspace(e)), ["enter"])
10769              }, [_createElementVNode("div", _hoisted_59, [_createElementVNode("div", _hoisted_60, [(e.cover_url)
10770                ? (_openBlock(), _createElementBlock("img", {
10771                    key: 0,
10772                    src: e.cover_url,
10773                    loading: "lazy",
10774                    alt: "غلاف"
10775                  }, null, 8, _hoisted_61))
10776                : (_openBlock(), _createElementBlock("span", _hoisted_62, "🎫"))]), _createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(e.title || 'فعالية'), 1), _createElementVNode("small", null, _toDisplayString(e.location || e.community_name_ar || 'بدون موقع') + " · " + _toDisplayString(eventCategoryName(e.category)), 1)])]), _createElementVNode("div", _hoisted_63, [
10777                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(eventStatusName(e.status)), 1), _cache[33] || (_cache[33] = _createElementVNode("small", null, "الحالة", -1))]),
10778                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(adminQueueOwner('events',e)), 1), _cache[34] || (_cache[34] = _createElementVNode("small", null, "المسؤول", -1))]),
10779                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(adminRecordUpdatedAt(e)), 1
10779), _cache[35] || (_cache[35] = _createElementVNode("small", null, "آخر تحديث", -1))]),
10780                _createElementVNode("span", _hoisted_64, [_createElementVNode("b", null, _toDisplayString(eventQueueNextAction(e)), 1), _cache[36] || (_cache[36] = _createElementVNode("small", null, "الإجراء التالي", -1))])
10781              ]), _createElementVNode("button", {
10782                class: "smallbtn secondary adminQueueOpen",
10783                onClick: _withModifiers($event => (openWorkspace(e)), ["stop"])
10784              }, "فتح مساحة الفعالية", 8, _hoisted_65)], 40, _hoisted_58))
10785            }), 128))]))
10786          : _createCommentVNode("", true),
10787        (!workspaceMode && store.state.eventMeta.has_more)
10788          ? (_openBlock(), _createElementBlock("button", {
10789              key: 9,
10790              class: "btn loadMore",
10791              disabled: actionBusy.more,
10792              onClick: loadMore
10793            }, _toDisplayString(actionBusy.more?'جاري التحميل...':'تحميل المزيد ('+store.state.events.length+' من '+store.state.eventMeta.total+')'), 9, _hoisted_66))
10794          : (_openBlock(), _createElementBlock("div", _hoisted_67, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(visibleEvents, (e) => {
10795              return (_openBlock(), _createElementBlock("article", {
10796                class: "card eventAdminCard adminRecordWorkspace recordWorkspaceOnly eventRecordWorkspace",
10797                key: e.id
10798              }, [
10799                (e.cover_url)
10800                  ? (_openBlock(), _createElementBlock("img", {
10801                      key: 0,
10802                      class: "eventWorkspaceCover",
10803                      src: e.cover_url,
10804                      loading: "lazy",
10805                      alt: "غلاف الفعالية"
10806                    }, null, 8, _hoisted_68))
10807                  : _createCommentVNode("", true),
10808                _createElementVNode("div", _hoisted_69, [_createElementVNode("div", null, [_createElementVNode("span", _hoisted_70, _toDisplayString(eventCategoryName(e.category)) + " · " + _toDisplayString(displayDateAr(e.event_date)), 1), _createElementVNode("h3", null, _toDisplayString(e.title || 'فعالية'), 1), _createElementVNode("div", _hoisted_71, [_createElementVNode("span", _hoisted_72, _toDisplayString(eventStatusName(e.status)), 1), (e.public_visibility)
10809                  ? (_openBlock(), _createElementBlock("span", _hoisted_73, "عامة"))
10810                  : _createCommentVNode("", true)])]), _createElementVNode("div", _hoisted_74, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(e.photo_count||0), 1), _cache[37] || (_cache[37] = _createElementVNode("small", null, "صور", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(e.video_count||0), 1), _cache[38] || (_cache[38] = _createElementVNode("small", null, "فيديو", -1))])])]),
10811                _createElementVNode("div", _hoisted_75, [
10812                  _createElementVNode("button", {
10813                    class: "smallbtn",
10814                    onClick: $event => (startEdit(e))
10815                  }, "تعديل", 8, _hoisted_76),
10816                  _createElementVNode("button", {
10817                    class: "smallbtn secondary",
10818                    onClick: $event => ($router.push('/admin/event/'+e.id+'/album'))
10819                  }, "إدارة الألبوم", 8, _hoisted_77),
10820                  (e.status==='published')
10821                    ? (_openBlock(), _createElementBlock("button", {
10822                        key: 0,
10823                        class: "smallbtn secondary",
10824                        onClick: $event => (shareWhatsapp(e))
10825                      }, "مشاركة", 8, _hoisted_78))
10826                    : _createCommentVNode("", true),
10827                  (e.status==='published')
10828                    ? (_openBlock(), _createElementBlock("button", {
10829                        key: 1,
10830                        class: "smallbtn",
10831                        onClick: $event => (sendReminder(e))
10832                      }, "تذكير واتساب", 8, _hoisted_79))
10833                    : _createCommentVNode("", true),
10834                  (e.status!=='published'&&e.status!=='completed'&&e.status!=='archived')
10835                    ? (_openBlock(), _createElementBlock("button", {
10836                        key: 2,
10837                        class: "smallbtn",
10838                        onClick: $event => (setEventStatus(e,'published'))
10839                      }, "نشر", 8, _hoisted_80))
10840                    : _createCommentVNode("", true),
10841                  (e.status==='published')
10842                    ? (_openBlock(), _createElementBlock("button", {
10843                        key: 3,
10844                        class: "smallbtn",
10845                        onClick: $event => (setEventStatus(e,'completed'))
10846                      }, "مكتملة", 8, _hoisted_81))
10847                    : _createCommentVNode("", true),
10848                  (e.status==='completed')
10849                    ? (_openBlock(), _createElementBlock("button", {
10850                        key: 4,
10851                        class: "smallbtn danger",
10852                        onClick: $event => (setEventStatus(e,'archived'))
10853                      }, "أرشفة", 8, _hoisted_82))
10854                    : _createCommentVNode("", true)
10855                ]),
10856                _createElementVNode("section", _hoisted_83, [_createElementVNode("div", _hoisted_84, [
10857                  _createElementVNode("div", _hoisted_85, [_cache[39] || (_cache[39] = _createElementVNode("b", null, "الموقع", -1)), _createElementVNode("span", null, _toDisplayString(e.location || e.address_cn || '-'), 1)]),
10858                  _createElementVNode("div", _hoisted_86, [_cache[40] || (_cache[40] = _createElementVNode("b", null, "الوقت", -1)), _createElementVNode("span", null, _toDisplayString(e.event_time || '-'), 1)]),
10859                  _createElementVNode("div", _hoisted_87, [_cache[41] || (_cache[41] = _createElementVNode("b", null, "السعة", -1)), _createElementVNode("span", null, _toDisplayString(e.max_seats || 'غير محددة'), 1)]),
10860                  _createElementVNode("div", _hoisted_88, [_cache[42] || (_cache[42] = _createElementVNode("b", null, "التسجيل", -1)), _createElementVNode("span", null, _toDisplayString(e.registration_required?'مطلوب':'غير مطلوب'), 1)])
10861                ]), (e.description)
10862                  ? (_openBlock(), _createElementBlock("div", _hoisted_89, [_cache[43] || (_cache[43] = _createElementVNode("h4", null, "وصف الفعالية", -1)), _createElementVNode("p", null, _toDisplayString(e.description), 1)]))
10863                  : _createCommentVNode("", true)]),
10864                (editOpen[e.id])
10865                  ? (_openBlock(), _createElementBlock("section", _hoisted_90, [
10866                      _createElementVNode("div", _hoisted_91, [_cache[44] || (_cache[44] = _createElementVNode("div", null, [_createElementVNode("span", null, "تعديل السجل"), _createElementVNode("h3", null, "تفاصيل الفعالية")], -1)), _createElementVNode("button", {
10867                        class: "smallbtn secondary",
10868                        onClick: $event => (cancelEdit(e))
10869                      }, "إغلاق", 8, _hoisted_92)]),
10870                      _createElementVNode("div", _hoisted_93, [
10871                        _createElementVNode("div", _hoisted_94, [_cache[45] || (_cache[45] = _
10871createElementVNode("b", null, "العنوان", -1)), _withDirectives(_createElementVNode("input", { "onUpdate:modelValue": $event => ((edit[e.id].title) = $event) }, null, 8, _hoisted_95), [[_vModelText, edit[e.id].title]])]),
10872                        _createElementVNode("div", _hoisted_96, [_cache[46] || (_cache[46] = _createElementVNode("b", null, "العنوان بالصيني", -1)), _withDirectives(_createElementVNode("input", { "onUpdate:modelValue": $event => ((edit[e.id].title_cn) = $event) }, null, 8, _hoisted_97), [[_vModelText, edit[e.id].title_cn]])]),
10873                        _createElementVNode("div", _hoisted_98, [_cache[47] || (_cache[47] = _createElementVNode("b", null, "الوصف", -1)), _withDirectives(_createElementVNode("textarea", { "onUpdate:modelValue": $event => ((edit[e.id].description) = $event) }, null, 8, _hoisted_99), [[_vModelText, edit[e.id].description]])]),
10874                        _createElementVNode("div", _hoisted_100, [_cache[48] || (_cache[48] = _createElementVNode("b", null, "الموقع", -1)), _withDirectives(_createElementVNode("input", { "onUpdate:modelValue": $event => ((edit[e.id].location) = $event) }, null, 8, _hoisted_101), [[_vModelText, edit[e.id].location]])]),
10875                        _createElementVNode("div", _hoisted_102, [_cache[49] || (_cache[49] = _createElementVNode("b", null, "العنوان الصيني", -1)), _withDirectives(_createElementVNode("input", { "onUpdate:modelValue": $event => ((edit[e.id].address_cn) = $event) }, null, 8, _hoisted_103), [[_vModelText, edit[e.id].address_cn]])]),
10876                        _createElementVNode("div", _hoisted_104, [_cache[50] || (_cache[50] = _createElementVNode("b", null, "Amap", -1)), _withDirectives(_createElementVNode("input", { "onUpdate:modelValue": $event => ((edit[e.id].amap_url) = $event) }, null, 8, _hoisted_105), [[_vModelText, edit[e.id].amap_url]])]),
10877                        _createElementVNode("div", _hoisted_106, [_cache[51] || (_cache[51] = _createElementVNode("b", null, "التاريخ", -1)), _withDirectives(_createElementVNode("input", {
10878                          type: "date",
10879                          "onUpdate:modelValue": $event => ((edit[e.id].event_date) = $event)
10880                        }, null, 8, _hoisted_107), [[_vModelText, edit[e.id].event_date]])]),
10881                        _createElementVNode("div", _hoisted_108, [_cache[52] || (_cache[52] = _createElementVNode("b", null, "الوقت", -1)), _withDirectives(_createElementVNode("input", { "onUpdate:modelValue": $event => ((edit[e.id].event_time) = $event) }, null, 8, _hoisted_109), [[_vModelText, edit[e.id].event_time]])]),
10882                        _createElementVNode("div", _hoisted_110, [_cache[53] || (_cache[53] = _createElementVNode("b", null, "النوع", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((edit[e.id].category) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList($optionList('event_category',edit[e.id].category), (o) => {
10883                          return (_openBlock(), _createElementBlock("option", {
10884                            key: o.value,
10885                            value: o.value
10886                          }, _toDisplayString(o.label), 9, _hoisted_112))
10887                        }), 128))], 8, _hoisted_111), [[_vModelSelect, edit[e.id].category]])]),
10888                        _createElementVNode("div", _hoisted_113, [_cache[54] || (_cache[54] = _createElementVNode("b", null, "الحالة", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((edit[e.id].status) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList($optionList('event_status',edit[e.id].status), (o) => {
10889                          return (_openBlock(), _createElementBlock("option", {
10890                            key: o.value,
10891                            value: o.value
10892                          }, _toDisplayString(o.label), 9, _hoisted_115))
10893                        }), 128))], 8, _hoisted_114), [[_vModelSelect, edit[e.id].status]])]),
10894                        _createElementVNode("div", _hoisted_116, [_cache[55] || (_cache[55] = _createElementVNode("b", null, "الحضور المتوقع", -1)), _withDirectives(_createElementVNode("input", {
10895                          type: "number",
10896                          min: "0",
10897                          "onUpdate:modelValue": $event => ((edit[e.id].attendees_count) = $event)
10898                        }, null, 8, _hoisted_117), [[_vModelText, edit[e.id].attendees_count]])]),
10899                        _createElementVNode("div", _hoisted_118, [_cache[56] || (_cache[56] = _
10899createElementVNode("b", null, "عدد الأسر", -1)), _withDirectives(_createElementVNode("input", {
10900                          type: "number",
10901                          min: "0",
10902                          "onUpdate:modelValue": $event => ((edit[e.id].families_count) = $event)
10903                        }, null, 8, _hoisted_119), [[_vModelText, edit[e.id].families_count]])]),
10904                        _createElementVNode("div", _hoisted_120, [_cache[57] || (_cache[57] = _createElementVNode("b", null, "السعة القصوى", -1)), _withDirectives(_createElementVNode("input", {
10905                          type: "number",
10906                          min: "0",
10907                          "onUpdate:modelValue": $event => ((edit[e.id].max_seats) = $event)
10908                        }, null, 8, _hoisted_121), [[_vModelText, edit[e.id].max_seats]])])
10909                      ]),
10910                      _createElementVNode("div", _hoisted_122, [_createElementVNode("label", _hoisted_123, [_withDirectives(_createElementVNode("input", {
10911                        type: "checkbox",
10912                        "onUpdate:modelValue": $event => ((edit[e.id].registration_required) = $event)
10913                      }, null, 8, _hoisted_124), [[_vModelCheckbox, edit[e.id].registration_required]]), _cache[58] || (_cache[58] = _createElementVNode("span", null, [_createElementVNode("b", null, "تسجيل مطلوب")], -1))]), _createElementVNode("label", _hoisted_125, [_withDirectives(_createElementVNode("input", {
10914                        type: "checkbox",
10915                        "onUpdate:modelValue": $event => ((edit[e.id].checkin_enabled) = $event)
10916                      }, null, 8, _hoisted_126), [[_vModelCheckbox, edit[e.id].checkin_enabled]]), _cache[59] || (_cache[59] = _createElementVNode("span", null, [_createElementVNode("b", null, "تفعيل الحضور")], -1))])]),
10917                      _createElementVNode("div", _hoisted_127, [_createElementVNode("label", _hoisted_128, [_withDirectives(_createElementVNode("input", {
10918                        type: "checkbox",
10919                        "onUpdate:modelValue": $event => ((edit[e.id].public_visibility) = $event)
10920                      }, null, 8, _hoisted_129), [[_vModelCheckbox, edit[e.id].public_visibility]]), _cache[60] || (_cache[60] = _createElementVNode("span", null, [_createElementVNode("b", null, "إظهار كفعالية عامة")], -1))]), (edit[e.id].public_visibility)
10921                        ? (_openBlock(), _createElementBlock("div", _hoisted_130, [_withDirectives(_createElementVNode("textarea", {
10922                            "onUpdate:modelValue": $event => ((edit[e.id].public_summary) = $event),
10923                            maxlength: "1500",
10924                            placeholder: "ملخص عام آمن للنشر"
10925                          }, null, 8, _hoisted_131), [[_vModelText, edit[e.id].public_summary]]), _withDirectives(_createElementVNode("input", {
10926                            "onUpdate:modelValue": $event => ((edit[e.id].public_location) = $event),
10927                            maxlength: "300",
10928                            placeholder: "الموقع العام"
10929                          }, null, 8, _hoisted_132), [[_vModelText, edit[e.id].public_location]])]))
10930                        : _createCommentVNode("", true)]),
10931                      _createElementVNode("div", _hoisted_133, [_createElementVNode("button", {
10932                        class: "btn secondary",
10933                        onClick: $event => (saveEvent(e))
10934                      }, "حفظ التعديل", 8, _hoisted_134), _createElementVNode("button", {
10935                        class: "btn danger",
10936                        onClick: $event => (cancelEdit(e))
10937                      }, "إلغاء", 8, _hoisted_135)])
10938                    ]))
10939                  : _createCommentVNode("", true),
10940                _createElementVNode("section", _hoisted_136, [
10941                  _createElementVNode("div", _hoisted_137, [_cache[61] || (_cache[61] = _createElementVNode("div", null, [_createElementVNode("span", null, "Event Album"), _createElementVNode("h3", null, "ألبوم الفعالية")], -1)), _createElementVNode("button", {
10942                    class: "smallbtn secondary",
10943                    onClick: $event =>
10943 ($router.push('/admin/event/'+e.id+'/album'))
10944                  }, "كل الوسائط", 8, _hoisted_138)]),
10945                  _createElementVNode("div", _hoisted_139, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(workspacePhotos.length), 1), _cache[62] || (_cache[62] = _createElementVNode("small", null, "صور", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(workspaceVideos.length), 1), _cache[63] || (_cache[63] = _createElementVNode("small", null, "فيديو", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(workspaceMedia.length), 1), _cache[64] || (_cache[64] = _createElementVNode("small", null, "الإجمالي", -1))])]),
10946                  _createElementVNode("div", _hoisted_140, [_createElementVNode("label", _hoisted_141, [_createElementVNode("input", {
10947                    type: "file",
10948                    multiple: "",
10949                    accept: "image/jpeg,image/png,image/webp,video/mp4,video/quicktime,video/webm",
10950                    onChange: $event => (onFiles($event,e.id))
10951                  }, null, 40, _hoisted_142), _cache[65] || (_cache[65] = _createElementVNode("span", null, "اختيار وسائط", -1)), _createElementVNode("em", null, _toDisplayString((files[e.id]&&files[e.id].length)?files[e.id].length+' ملف':'لم يتم اختيار ملفات'), 1)]), _createElementVNode("button", {
10952                    class: "smallbtn",
10953                    disabled: actionBusy['upload:'+e.id],
10954                    onClick: $event => (uploadMedia(e))
10955                  }, _toDisplayString(actionBusy['upload:'+e.id]?'جاري الرفع...':'رفع للألبوم'), 9, _hoisted_143)]),
10956                  (workspacePreview.length)
10957                    ? (_openBlock(), _createElementBlock("div", _hoisted_144, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(workspacePreview, (m) => {
10958                        return (_openBlock(), _createElementBlock("figure", {
10959                          class: "albumItem",
10960                          key: m.id
10961                        }, [(!isVideo(m))
10962                          ? (_openBlock(), _createElementBlock("img", {
10963                              key: 0,
10964                              src: mediaSrc(m),
10965                              loading: "lazy",
10966                              alt: "صورة الفعالية"
10967                            }, null, 8, _hoisted_145))
10968                          : (_openBlock(), _createElementBlock("video", {
10969                              key: 1,
10970                              src: m.file_url,
10971                              preload: "metadata",
10972                              controls: ""
10973                            }, null, 8, _hoisted_146)), _createElementVNode("figcaption", null, [_createElementVNode("b", null, _toDisplayString(m.is_cover?'غلاف الفعالية':(m.filename||mediaKindName(m.kind))), 1), _createElementVNode("small", null, _toDisplayString(mediaKindName(m.kind)), 1)]), (String(m.kind)==='image'&&!m.is_cover)
10974                          ? (_openBlock(), _createElementBlock("button", {
10975                              key: 2,
10976                              class: "smallbtn secondary coverAction",
10977                              disabled: actionBusy['cover:'+m.id],
10978                              onClick: $event => (setCover(m))
10979                            }, _toDisplayString(actionBusy['cover:'+m.id]?'جاري...':'تعيين كغلاف'), 9, _hoisted_147))
10980                          : _createCommentVNode("", true)]))
10981                      }), 128))]))
10982                    : (!store.state.busy)
10983                      ? (_openBlock(), _createElementBlock("div", _hoisted_148, "لا توجد وسائط بعد. ارفع الصور أو الفيديوهات من هنا."))
10984                      : _createCommentVNode("", true)
10985                ])
10986              ]))
10987            }), 128))]))
10988      ]),
10989      _: 1
10990    }))
10991  }
10992}
10993})()
10994  };
10995
10996  const PublicEventDetailPage={
10997    components:{PublicFrame},
10998    setup(){
10999      const store=useGzcStore();const router=useRouter();const route=useRoute();const event=ref(null);const media=ref([]);
11000      const loading=ref(true);const loadError=ref('');
11001      const memberAccess=computed(()=>!!(store.state.me&&store.state.me.authenticated&&(store.state.me.member||store.state.me.official)));
11002      const photos=computed(()=>media.value.filter(m=>String(m.kind)==='image'));
11003      const videos=computed(()=>media.value.filter(m=>String(m.kind)==='video'));
11004      function shareWhatsapp(){
11005        if(!event.value)return;
11006        const shareUrl=((window&&window.location&&window.location.origin)||'')+'/events/'+route.params.id;
11007        const lines=['فعالية من منصة SMT China',event.value.title||'فعالية',event.value.event_date||'',event.value.event_time||'',event.value.location||event.value.address||'',shareUrl].filter(
11007Boolean);
11008        window.open('https://wa.me/?text='+encodeURIComponent(lines.join('\n')),'_blank');
11009      }
11010      async function load(){
11011        const id=route.params.id;
11012        loading.value=true;loadError.value='';await store.loadMe();
11013        if(memberAccess.value){
11014          const events=await api('/api/events');
11015          event.value=safeArray(events.events).find(e=>String(e.id)===String(id))||null;
11016          const r=await api('/api/events/'+encodeURIComponent(id)+'/media');
11017          media.value=safeArray(r.media);
11018          if(!event.value)loadError.value='الفعالية غير موجودة أو خارج نطاق عضويتك.';
11019        }else{
11020          const r=await api('/api/public/events/'+encodeURIComponent(id));
11021          if(r.ok)event.value=r.event;else loadError.value=r.message||'الفعالية العامة غير موجودة.';
11022        }
11023        loading.value=false;
11024      }
11025      onMounted(load);
11026      return {store,event,media,photos,videos,loading,loadError,memberAccess,shareWhatsapp,mediaSrc,isVideo,mediaKindName,fileMB};
11027    },
11028    render:(function(){
11029const _Vue = Vue
11030const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
11031
11032const _hoisted_1 = {
11033  key: 0,
11034  class: "card loadingState",
11035  role: "status"
11036}
11037const _hoisted_2 = {
11038  key: 1,
11039  class: "card errorState",
11040  role: "alert"
11041}
11042const _hoisted_3 = ["onClick"]
11043const _hoisted_4 = {
11044  key: 2,
11045  class: "card eventAlbumHero"
11046}
11047const _hoisted_5 = ["src"]
11048const _hoisted_6 = { class: "hint" }
11049const _hoisted_7 = {
11050  key: 1,
11051  class: "eventQuickMeta"
11052}
11053const _hoisted_8 = { class: "metaRow" }
11054const _hoisted_9 = { class: "metaRow" }
11055const _hoisted_10 = { class: "metaRow" }
11056const _hoisted_11 = {
11057  key: 2,
11058  class: "miniStats mediaMini"
11059}
11060const _hoisted_12 = { class: "row" }
11061const _hoisted_13 = ["onClick"]
11062const _hoisted_14 = ["href"]
11063const _hoisted_15 = {
11064  key: 3,
11065  class: "card emptyCard"
11066}
11067const _hoisted_16 = {
11068  key: 4,
11069  class: "card membersOnlyNotice"
11070}
11071const _hoisted_17 = ["onClick"]
11072const _hoisted_18 = {
11073  key: 5,
11074  class: "albumGrid"
11075}
11076const _hoisted_19 = ["src"]
11077const _hoisted_20 = ["src"]
11078
11079return function render(_ctx, _cache) {
11080  with (_ctx) {
11081    const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, toDisplayString: _toDisplayString, renderList: _renderList, Fragment: _Fragment, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
11082
11083    const _component_PublicFrame = _resolveComponent("PublicFrame")
11084
11085    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "ألبوم الفعالية" }, {
11086      default: _withCtx(() => [
11087        loading
11088          ? (_openBlock(), _createElementBlock("div", _hoisted_1, _c
11088ache[0] || (_cache[0] = [_createElementVNode("span", {
11089              class: "loadingSpinner",
11090              "aria-hidden": "true"
11091            }, null, -1), _createElementVNode("h3", null, "جاري تحميل الفعالية...", -1)])))
11092          : loadError
11093            ? (_openBlock(), _createElementBlock("div", _hoisted_2, [_cache[1] || (_cache[1] = _createElementVNode("h3", null, "تعذر فتح الفعالية", -1)), _createElementVNode("p", null, _toDisplayString(loadError), 1), _createElementVNode("button", {
11094                class: "btn secondary",
11095                onClick: $event => ($router.push('/events'))
11096              }, "العودة للفعاليات", 8, _hoisted_3)]))
11097            : _createCommentVNode("", true),
11098        event
11099          ? (_openBlock(), _createElementBlock("div", _hoisted_4, [
11100              (event&&event.cover_url)
11101                ? (_openBlock(), _createElementBlock("img", {
11102                    key: 0,
11103                    class: "eventCover",
11104                    src: event.cover_url,
11105                    loading: "lazy",
11106                    alt: "غلاف الفعالية"
11107                  }, null, 8, _hoisted_5))
11108                : _createCommentVNode("", true),
11109              _cache[8] || (_cache[8] = _createElementVNode("span", { class: "vueBadge" }, "إدارة المنصة", -1)),
11110              _createElementVNode("h3", null, _toDisplayString(event&&event.title || 'ألبوم الفعالية'), 1),
11111              _createElementVNode("p", _hoisted_6, _toDisplayString(event&&event.description || (memberAccess?'صور وفيديوهات الفعالية تظهر هنا للأعضاء بعد تسجيل الدخول.':'ملخص فعالية عامة من منصة SMT.')), 1),
11112              event
11113                ? (_openBlock(), _createElementBlock("div", _hoisted_7, [_createElementVNode("div", _hoisted_8, [_cache[2] || (_cache[2] = _createElementVNode("b", null, "التاريخ", -1)), _createElementVNode("span", null, _toDisplayString(event.event_date || '-'), 1)]), _createElementVNode("div", _hoisted_9, [_cache[3] || (_cache[3] = _createElementVNode("b", null, "الوقت", -1)), _createElementVNode("span", null, _toDisplayString(event.event_time || '-'), 1)]), _createElementVNode("div", _hoisted_10, [_cache[4] || (_cache[4] = _createElementVNode("b", null, "الموقع", -1)), _createElementVNode("span", null, _toDisplayString(event.location || event.address || '-'), 1)])]))
11114                : _createCommentVNode("", true),
11115              memberAccess
11116                ? (_openBlock(), _createElementBlock("div", _hoisted_11, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(photos.length), 1), _cache[5] || (_cache[5] = _createElementVNode("small", null, "صور", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(videos.length), 1), _cache[6] || (_cache[6] = _createElementVNode("small", null, "فيديو", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(media.length), 1), _cache[7] || (_cache[7] = _createElementVNode("small", null, "الإجمالي", -1))])]))
11117                : _createCommentVNode("", true),
11118              _createElementVNode("div", _hoisted_12, [_createElementVNode("button", {
11119                class: "btn secondary",
11120                onClick: shareWhatsapp
11121              }, "مشاركة على واتساب", 8, _hoisted_13), (event&&event.amap_url)
11122                ? (_openBlock(), _createElementBlock("a", {
11123                    key: 0,
11124                    class: "btn secondary",
11125                    href: event.amap_url,
11126                    target: "_blank"
11127                  }, "فتح الموقع", 8, _hoisted_14))
11128                : _createCommentVNode("", true)])
11129            ]))
11130          : _createCommentVNode("", true),
11131        (memberAccess && !media.length && !store.state.busy)
11132          ? (_openBlock(), _createElementBlock("div", _hoisted_15, "لا توجد وسائط منشورة لهذا الألبوم حالياً."))
11133          : _createCommentVNode("", true),
11134        (!memberAccess && event)
11135          ? (_openBlock(), _createElementBlock("div", _hoisted_16, [_cache[9] || (_cache[9] = _createElementVNode("h3", null, "ألبوم الفعالية محمي", -1)), _cache[10] || (_cache[10] = _createElementVNode("p", null, "المعلومات العامة أعلاه متاحة للجميع، أما الصور والفيديوهات فتظهر للأعضاء بعد الدخول.", -1)), _createElementVNode("button", {
11136              class: "btn secondary",
11137              onClick: $event => ($router.push({path:'/login',query:{next:'/events/'+$route.params.id}}))
11138            }, "دخول العضوية", 8, _hoisted_17)]))
11139          : _createCommentVNode("", true),
11140        memberAccess
11141          ? (_openBlock(), _createElementBlock("div", _hoisted_18, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(media, (m) => {
11142              return (_openBlock(), _createElementBlock("figure", {
11143                class: "albumItem",
11144                key: m.id
11145              }, [(!isVideo(m))
11146                ? (_openBlock(), _createElementBlock("img", {
11147                    key: 0,
11148                    src: mediaSrc(m),
11149                    loading: "lazy",
11150                    alt: "صورة الفعالية"
11151                  }, null, 8, _hoisted_19))
11152                : (_openBlock(), _createElementBlock("video", {
11153                    key: 1,
11154                    src: m.file_url,
11155                    controls: "",
11156                    preload: "metadata"
11157                  }
11157, null, 8, _hoisted_20)), _createElementVNode("figcaption", null, [_createElementVNode("b", null, _toDisplayString(mediaKindName(m.kind)), 1), _createElementVNode("small", null, _toDisplayString(m.filename || fileMB(m.size_bytes)), 1)])]))
11158            }), 128))]))
11159          : _createCommentVNode("", true)
11160      ]),
11161      _: 1
11162    }))
11163  }
11164}
11165})()
11166  };
11167
11168  const AdminEventAlbumPage={
11169    components:{AdminFrame},
11170    setup(){
11171      const store=useGzcStore();const router=useRouter();const route=useRoute();
11172      const files=ref([]);const audioFile=ref(null);const audioTitle=ref('');const audioType=ref('national');const selectedAudioId=ref('');
11173      const event=computed(()=>store.state.events.find(e=>String(e.id)===String(route.params.id))||{});
11174      const activeMedia=computed(()=>safeArray(store.state.eventMedia[route.params.id]));
11175      const archivedMedia=computed(()=>safeArray(store.state.eventArchivedMedia[route.params.id]));
11176      const photos=computed(()=>activeMedia.value.filter(m=>String(m.kind)==='image'));
11177      const videos=computed(()=>activeMedia.value.filter(m=>String(m.kind)==='video'));
11178      async function load(){if(await store.requireAdmin(router)){await store.loadAdminEvents(router);await Promise.all([store.loadEventMedia(route.params.id,router),store.loadArchivedEventMedia(route.params.id,router),store.loadEventAudio(router)]);}}
11179      onMounted(load);
11180      function onFiles(e){files.value=Array.from(e.target.files||[]);} function onAudio(e){audioFile.value=(e.target.files||[])[0]||null;}
11181      async function uploadMedia(){if(!files.value.length){store.state.msg='اختر صور أو فيديوهات أولاً';return;}const fd=new FormData();files.value.forEach(f=>fd.append('files',f));store.state.busy=true;store.state.msg='جاري رفع وسائط الألبوم...';const r=await uploadApi('/api/admin/events/'+encodeURIComponent(route.params.id)+'/media',{method:'POST',body:fd,headers:{'Accept':'application/json'},uploadLabel:'رفع وسائط الألبوم'});store.state.busy=false;store.state.msg=r.message||r.error||'';files.value=[];await load();}
11182      async function setCover(m){if(!m||!m.id||String(m.kind)!=='image')return;store.state.busy=true;const r=await api('/api/admin/event-media/'+encodeURIComponent(m.id)+'/cover',{method:'POST'});store.state.busy=false;store.state.msg=r.message||r.error||'';await load();}
11183      async function archiveMedia(m){if(!m||!m.id)return;if(!confirm('أرشفة هذا الملف؟'))return;store.state.busy=true;const r=await api('/api/admin/event-media/'+encodeURIComponent(m.id)+'/archive',{method:'POST'});store.state.busy=false;store.state.msg=r.message||r.error||'';await load();}
11184      async function restoreMedia(m){if(!m||!m.id)return;store.state.busy=true;const r=await api('/api/admin/event-media/'+encodeURIComponent(m.id)+'/restore',{method:'POST'});store.state.busy=false;store.state.msg=r.message||r.error||'';await load();}
11185      async function deleteMedia(m){if(!m||!m.id)return;if(!confirm('حذف من العرض نهائياً؟'))return;store.state.busy=true;const r=await api('/api/admin/event-media/'+encodeURIComponent(m.id)+'/delete',{method:'POST'});store.state.busy=false;store.state.msg=r.message||r.error||'';await load();}
11186      async function uploadAudio(){if(!audioFile.value){store.state.msg='يرجى اختيار ملف صوتي أولاً';return;}const fd=new FormData();fd.append('audio',audioFile.value);fd.append('title',audioTitle.value||audioFile.value.name);fd.append('audio_type',audioType.value||'national');store.state.busy=true;store.state.msg='جارٍ رفع الملف الصوتي...';const r=await uploadApi('/api/admin/event-audio',{method:'POST',body:fd,headers:{'Accept':'application/json'},uploadLabel:'رفع الملف الصوتي'});store.state.busy=false;store.state.msg=r.message||r.error||'';audioFile.value=null;audioTitle.value='';await store.loadEventAudio(router);}
11187      async function archiveAudio(a){if(!a||!a.id)return;if(!confirm('أرشفة الملف الصوتي؟'))return;store.state.busy=true;const r=await api('/api/admin/event-audio/'+encodeURIComponent(a.id)+'/archive',{method:'POST'});store.state.busy=false;store.state.msg=r.message||r.error||'';await store.loadEventAudio(router);}
11188      async function createSlideshow(){if(photos.value.length<2){store.state.msg='الفيديو يحتاج صورتين على الأقل';return;}store.state.busy=true;store.state.msg='جاري إنشاء فيديو ملخص الفعالية...';const r=await api('/api/admin/events/'+encodeURIComponent(route.params.id)+'/slideshow',{method:'POST',body:JSON.stringify({audio_id:selectedAudioId.value||''})});store.state.busy=false;store.state.msg=r.message||r.error||'';await store.loadAdminEvents(router);await store.loadEventMedia(route.params.id,router);}
11189      return {store,event,files,audioFile,audioTitle,audioType,selectedAudioId,activeMedia,archivedMedia,photos,videos,load,onFiles,onAudio,uploadMedia,setCover,archiveMedia,restoreMedia,deleteMedia,uploadAudio,archiveAudio,createSlideshow,mediaSrc,isVideo,mediaKindName,fileMB,shortDate,displayDateAr};
11190    },
11191    render:(function(){
11192const _Vue = Vue
11193const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
11194
11195const _hoisted_1 = { class: "adminWorkspaceBackBar eventAlbumBack" }
11196const _hoisted_2 = ["onClick"]
11197const _hoisted_3 = { class: "card eventAlbumHero adminEventAlbumHero" }
11198const _hoisted_4 = ["src"]
11199const _hoisted_5 = { class: "adminEyebrow" }
11200const _hoisted_6 = { class: "miniStats mediaMini" }
11201const _hoisted_7 = { class: "card formCard eventAlbumUploadCard" }
11202const _hoisted_8 = { class: "filePicker wide" }
11203const _hoisted_9 = ["onChange"]
11204const _hoisted_10 = ["onClick"]
11205const _hoisted_11 = {
11206  key: 0,
11207  class: "card emptyCard"
11208}
11209const _hoisted_12 = {
11210  key: 1,
11211  class: "albumGrid adminAlbumGrid eventAlbumManagerGrid"
11212}
11213const _hoisted_13 = {
11214  key: 0,
11215  class: "coverMediaBadge"
11216}
11217const _hoisted_14 = ["src"]
11218const _hoisted_15 = ["src"]
11219const _hoisted_16 = { class: "mediaActions eventMediaActions" }
11220const _hoisted_17 = ["onClick"]
11221const _hoisted_18 = ["onClick"]
11222const _hoisted_19 = ["onClick"]
11223const _hoisted_20 = {
11224  key: 2,
11225  class: "card archivedBox"
11226}
11227const _hoisted_21 = { class: "albumGrid adminAlbumGrid" }
11228const _hoisted_22 = ["src"]
11229const _hoisted_23 = ["src"]
11230const _hoisted_24 = ["onClick"]
11231const _hoisted_25 = { class: "card collapseSection eventAlbumTools" }
11232const _hoisted_26 = { class: "collapseBody" }
11233const _hoisted_27 = { class: "eventToolSection" }
11234const _hoisted_28 = ["onUpdate:modelValue"]
11235const _hoisted_29 = ["value"]
11236const _hoisted_30 = ["onClick"]
11237const _hoisted_31 = ["href"]
11238const _hoisted_32 = { class: "eventToolSection" }
11239const _hoisted_33 = { class: "editGrid" }
11240const _hoisted_34 = ["onUpdate:modelValue"]
11241const _hoisted_35 = ["onUpdate:modelValue"]
11242const _hoisted_36 = { class: "filePicker wide" }
11243const _hoisted_37 = ["onChange"]
11244const _hoisted_38 = ["onClick"]
11245const _hoisted_39 = {
11246  key: 0,
11247  class: "audioList"
11248}
11249const _hoisted_40 = ["src"]
11250const _hoisted_41 = ["onClick"]
11251
11252return function render(_ctx, _cache) {
11253  with (_ctx) {
11254    const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, toDisplayString: _toDisplayString, renderList: _renderList, Fragment: _Fragment, normalizeClass: _normalizeClass, vModelSelect: _vModelSelect, withDirectives: _withDirectives, vModelText: _vModelText, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
11255
11256    const _component_AdminFrame = _resolveComponent("AdminFrame")
11257
11258    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "ألبوم الفعالية" }, {
11259      default: _withCtx(() => [
11260        _createElementVNode("div", _hoisted_1, [_createElementVNode("button", {
11261          class: "smallbtn secondary compactBackButton",
11262          onClick: $event => ($router.push('/admin/events/'+$route.params.id))
11263        }, "← العودة لمساحة الفعالية", 8, _hoisted_2), _cache[0] || (_cache[0] = _createElementVNode("span", null, "إدارة الألبوم", -1))]),
11264        _createElementVNode("section", _hoisted_3, [
11265          (event.cover_url)
11266            ? (_openBlock(), _createElementBlock("img", {
11267                key: 0,
11268                class: "eventCover",
11269                src: event.cover_url,
11270                loading: "lazy",
11271                alt: "غلاف الفعالية"
11272              }, null, 8, _hoisted_4))
11273            : _createCommentVNode("", true),
11274          _createElementVNode("span", _hoisted_5, "Event Albums · " + _toDisplayString(displayDateAr(event.event_date)), 1),
11275          _createElementVNode("h3", null, _toDisplayString(event.title || 'فعالية'), 1),
11276          _cache[4] || (_cache[4] = _createElementVNode("p", { class: "hint" }, "رفع الصور والفيديوهات، اختيار الغلاف، الأرشفة، ثم الأدوات الإضافية عند الحاجة.", -1)),
11277          _createElementVNode("div", _hoisted_6, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(photos.length), 1), _cache[1] || (_cache[1] = _createElementVNode("small", null, "صور", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(videos.length), 1), _cache[2] || (_cache[2] = _createElementVNode("small", null, "فيديو", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(activeMedia.length), 1), _cache[3] || (_cache[3] = _createElementVNode("small", null, "نشط", -1))])])
11278        ]),
11279        _createElementVNode("section", _hoisted_7, [
11280          _cache[6] || (_cache[6] = _createElementVNode("div", { class: "memberSectionHead" }, [_createElementVNode("div", null, [_createElementVNode("span", null, "الخطوة الأساسية"), _createElementVNode("h3", null, "رفع وسائط للألبوم")])], -1)),
11281          _cache[7] || (_cache[7] = _createElementVNode("p", { class: "hint" }, "المسموح: jpg / jpeg / png / webp / mp4 / mov / webm. أول صورة تصبح غلافاً تلقائياً إذا لم يوجد غلاف.", -1)),
11282          _createElementVNode("label", _hoisted_8, [_createElementVNode("input", {
11283            type: "file",
11284            multiple: "",
11285            accept: "image/jpeg,image/png,image/webp,video/mp4,video/quicktime,video/webm",
11286            onChange: onFiles
11287          }, null, 40, _hoisted_9), _cache[5] || (_cache[5] = _createElementVNode("span", null, "اختيار صور أو فيديوهات", -1)), _createElementVNode("em", null, _toDisplayString(files.length?files.length+' ملف':'لم يتم اختيار ملفات'), 1)]),
11288          _createElementVNode("button", {
11289            class: "btn loadMore",
11290            onClick: uploadMedia
11291          }, "رفع للألبوم", 8, _hoisted_10)
11292        ]),
11293        (!activeMedia.length && !store.state.busy)
11294          ? (_openBlock(), _createElementBlock("section", _hoisted_11, "لا توجد وسائط نشطة في هذا الألبوم."))
11295          : (_openBlock(), _createElementBlock("section", _hoisted_12, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(activeMedia, (m) => {
11296              return (_openBlock(), _createElementBlock("figure", {
11297                class: _normalizeClass(["albumItem", {coverMediaItem:m.is_cover}]),
11298                key: m.id
11299              }, [
11300                (m.is_cover)
11301                  ? (_openBlock(), _createElementBlock("div", _hoisted_13, "الغلاف الحالي"))
11302                  : _createCommentVNode("", true),
11303                (!isVideo(m))
11304                  ? (_openBlock(), _createElementBlock("img", {
11305                      key: 1,
11306                      src: mediaSrc(m),
11307                      loading: "lazy",
11308                      alt: "صورة الفعالية"
11309                    }, null, 8, _hoisted_14))
11310                  : (_openBlock(), _createElementBlock("video", {
11311                      key: 2,
11312                      src: m.file_url,
11313                      controls: "",
11314                      preload: "metadata"
11315                    }, null, 8, _hoisted_15)),
11316                _createElementVNode("figcaption", null, [_createElementVNode("b", null, _toDisplayString(m.filename || mediaKindName(m.kind)), 1), _createElementVNode("small", null, _toDisplayString(mediaKindName(m.kind)) + " — " + _toDisplayString(fileMB(m.size_bytes)), 1)]),
11317                _createElementVNode("div", _hoisted_16, [(String(m.kind)==='image'&&!m.is_cover)
11318                  ? (_openBlock(), _createElementBlock("button", {
11319                      key: 0,
11320                      class: "smallbtn secondary",
11321                      onClick: $event => (setCover(m))
11322                    }, "تعيين كغلاف", 8, _hoisted_17))
11323                  : _createCommentVNode("", true), _createElementVNode("button", {
11324                  class: "smallbtn danger",
11325                  onClick: $event => (archiveMedia(m))
11326                }, "أرشفة", 8, _hoisted_18), _createElementVNode("button", {
11327                  class: "smallbtn danger",
11328                  onClick: $event => (deleteMedia(m))
11329                }, "حذف", 8, _hoisted_19)])
11330              ], 2))
11331            }), 128))])),
11332        (archivedMedia.length)
11333          ? (_openBlock(), _createElementBlock("details", _hoisted_20, [_createElementVNode("summary", null, "الوسائط المؤرشفة: " + _toDisplayString(archivedMedia.length), 1), _createElementVNode("div", _hoisted_21, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(archivedMedia, (m) => {
11334              return (_openBlock(), _createElementBlock("figure", {
11335                class: "albumItem",
11336                key: m.id
11337              }, [(!isVideo(m))
11338                ? (_openBlock(), _createElementBlock("img", {
11339                    key: 0,
11340                    src: mediaSrc(m),
11341                    loading: "lazy"
11342                  }, null, 8, _hoisted_22))
11343                : (_openBlock(), _createElementBlock("video", {
11344                    key: 1,
11345                    src: m.file_url,
11346                    controls: "",
11347                    preload: "metadata"
11348                  }, null, 8, _hoisted_23)), _createElementVNode("figcaption", null, [_createElementVNode("b", null, _toDisplayString(m.filename || mediaKindName(m.kind)), 1), _createElementVNode("small", null, _toDisplayString(fileMB(m.size_bytes)), 1)]), _createElementVNode("button", {
11349                class: "smallbtn",
11350                onClick: $event => (restoreMedia(m))
11351              }, "استرجاع", 8, _hoisted_24)]))
11352            }), 128))])]))
11353          : _createCommentVNode("", true),
11354        _createElementVNode("details", _hoisted_25, [_cache[14] || (_cache[14] = _createElementVNode("summary", null, [_createElementVNode("b", null, "أدوات إضافية"), _createElementVNode("span", null, "فيديو الملخص والصوتيات")], -1)), _createElementVNode("div", _hoisted_26, [_createElementVNode("section", _hoisted_27, [
11355          _cache[9] || (_cache[9] = _createElementVNode("h3", null, "فيديو ملخص الفعالية", -1)),
11356          _cache[10] || (_cache[10] = _createElementVNode("p", { class: "hint" }, "يستخدم الصور الموجودة في الألبوم ويحتاج صورتين على الأقل.", -1)),
11357          _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((selectedAudioId) = $event) }, [_cache[8] || (_cache[8] = _createElementVNode("option", { value: "" }, "بدون ملف صوتي", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(store.state.eventAudio, (a) => {
11358            return (_openBlock(), _createElementBlock("option", {
11359              value: a.id,
11360              key: a.id
11361            }, _toDisplayString(a.title) + " — " + _toDisplayString(a.audio_type), 9, _hoisted_29))
11362          }), 128))], 8, _hoisted_28), [[_vModelSelect, selectedAudioId]]),
11363          _createElementVNode("button", {
11364            class: "btn loadMore",
11365            onClick: createSlideshow
11366          }, "إنشاء فيديو الملخص", 8, _hoisted_30),
11367          (event.slideshow_url)
11368            ? (_openBlock(), _createElementBlock("a", {
11369                key: 0,
11370                class: "btn secondary loadMore",
11371                href: event.slideshow_url,
11372                target: "_blank"
11373              }, "فتح فيديو الملخص الحالي", 8, _hoisted_31))
11374            : _createCommentVNode("", true)
11375        ]), _createElementVNode("section", _hoisted_32, [
11376          _cache[13] || (_cache[13] = _createElementVNode("h3", null, "مكتبة الصوتيات", -1)),
11377          _createElementVNode("div", _hoisted_33, [_withDirectives(_createElementVNode("input", {
11378            "onUpdate:modelValue": $event => ((audioTitle) = $event),
11379            placeholder: "اسم الملف الصوتي"
11380          }, null, 8, _hoisted_34), [[_vModelText, audioTitle]]), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((audioType) = $event) }, _cache[11] || (_cache[11] = [_createElementVNode("option", { value: "national" }, "وطني", -1), _createElementVNode("option", { value: "event" }, "فعالية", -1), _createElementVNode("option", { value: "background" }, "خلفية", -1)]), 8, _hoisted_35), [[_vModelSelect, audioType]])]),
11381          _createElementVNode("label", _hoisted_36, [_createElementVNode("input", {
11382            type: "file",
11383            accept: "audio/*,.mp3,.wav,.m4a,.aac,.ogg",
11384            onChange: onAudio
11385          }
11385, null, 40, _hoisted_37), _cache[12] || (_cache[12] = _createElementVNode("span", null, "اختيار ملف صوتي", -1)), _createElementVNode("em", null, _toDisplayString(audioFile?audioFile.name:'لم يتم اختيار ملف'), 1)]),
11386          _createElementVNode("button", {
11387            class: "btn loadMore",
11388            onClick: uploadAudio
11389          }, "رفع ملف صوتي", 8, _hoisted_38),
11390          (store.state.eventAudio.length)
11391            ? (_openBlock(), _createElementBlock("div", _hoisted_39, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(store.state.eventAudio, (a) => {
11392                return (_openBlock(), _createElementBlock("div", {
11393                  class: "audioRow",
11394                  key: a.id
11395                }, [_createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(a.title), 1), _createElementVNode("small", null, _toDisplayString(a.audio_type) + " — " + _toDisplayString(fileMB(a.size_bytes)) + " — " + _toDisplayString(shortDate(a.created_at)), 1)]), _createElementVNode("audio", {
11396                  src: a.file_url,
11397                  controls: "",
11398                  preload: "none"
11399                }, null, 8, _hoisted_40), _createElementVNode("button", {
11400                  class: "smallbtn danger",
11401                  onClick: $event => (archiveAudio(a))
11402                }, "أرشفة", 8, _hoisted_41)]))
11403              }), 128))]))
11404            : _createCommentVNode("", true)
11405        ])])])
11406      ]),
11407      _: 1
11408    }))
11409  }
11410}
11411})()
11412  };
11413
11414  const AdminMediaLibraryPage={
11415    components:{AdminFrame},
11416    setup(){
11417      const store=useGzcStore();const router=useRouter();
11418      const filters=reactive({scope:'all',kind:'all',search:'',limit:40});
11419      async function load(){if(await store.requireAdmin(router)){await store.loadMediaLibrary(filters,router);}}
11420      onMounted(load);
11421      const lib=computed(()=>store.state.mediaLibrary||{totals:{},storage:{},items:[]});
11422      const items=computed(()=>safeArray(lib.value.items));
11423      const totals=computed(()=>lib.value.totals||{});
11424      const storage=computed(()=>lib.value.storage||{});
11425      function scopeLabel(v){return v==='event'?'فعالية':v==='announcement'?'إعلان/تعميم':v==='case'?'حالة':'وسائط';}
11426      function targetPath(m){if(!m)return '/admin/media';if(m.scope==='event'&&m.target_id)return '/admin/event/'+m.target_id+'/album';if(m.scope==='announcement')return '/admin/announcements';if(m.scope==='case')return '/admin/help';return '/admin/media';}
11427      function openMedia(m){if(m&&m.file_url)window.open(m.file_url,'_blank','noopener');}
11428      function isVideo(m){return String(m&&m.kind)==='video';}
11429      function isPdf(m){return String(m&&m.kind)==='pdf'||String(m&&m.mime_type||'').includes('pdf');}
11430      return {store,filters,load,lib,items,totals,storage,scopeLabel,targetPath,openMedia,isVideo,isPdf,mediaSrc,fileMB,shortDate};
11431    },
11432    render:(function(){
11433const _Vue = Vue
11434const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
11435
11436const _hoisted_1 = { class: "card dashboardHeaderCard" }
11437const _hoisted_2 = ["onClick"]
11438const _hoisted_3 = { class: "healthGrid" }
11439const _hoisted_4 = { class: "card healthCard ok" }
11440const _hoisted_5 = { class: "card healthCard" }
11441const _hoisted_6 = { class: "card healthCard" }
11442const _hoisted_7 = { class: "card healthCard" }
11443const _hoisted_8 = { class: "card opsSummaryCard" }
11444const _hoisted_9 = { class: "opsFilterBar" }
11445const _hoisted_10 = ["onUpdate:modelValue"]
11446const _hoisted_11 = ["onUpdate:modelValue"]
11447const _hoisted_12 = ["onUpdate:modelValue"]
11448const _hoisted_13 = ["onClick"]
11449const _hoisted_14 = {
11450  key: 0,
11451  class: "card emptyCard"
11452}
11453const _hoisted_15 = { class: "albumGrid adminAlbumGrid" }
11454const _hoisted_16 = ["src"]
11455const _hoisted_17 = ["src"]
11456const _hoisted_18 = {
11457  key: 2,
11458  class: "card emptyCard"
11459}
11460const _hoisted_19 = { class: "mediaActions" }
11461const _hoisted_20 = ["onClick"]
11462const _hoisted_21 = ["onClick"]
11463
11464return function render(_ctx, _cache) {
11465  with (_ctx) {
11466    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, vModelSelect: _vModelSelect, withDirectives: _withDirectives, vModelText: _vModelText, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, renderList: _renderList, Fragment: _Fragment, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
11467
11468    const _component_AdminFrame = _resolveComponent("AdminFrame")
11469
11470    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "مكتبة الوسائط" }, {
11471      default: _withCtx(() => [
11472        _createElementVNode("section", _hoisted_1, [_cache[0] || (_cache[0] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "إدارة المنصة"), _createElementVNode("h3", null, "مكتبة الوسائط"), _createElementVNode("p", { class: "hint" }, "مركز موحد لمتابعة وسائط الفعاليات والإعلانات والتعميمات وحالات المساعدة والطوارئ، مع فتح الإدارة التفصيلية من القسم المختص.")], -1)), _createElementVNode("button", {
11473          class: "smallbtn",
11474          onClick: load
11475        }, "تحديث", 8, _hoisted_2)]),
11476        _createElementVNode("section", _hoisted_3, [
11477          _createElementVNode("div", _hoisted_4, [_cache[1] || (_cache[1] = _createElementVNode("span", null, "إجمالي النتائج", -1)), _createElementVNode("b", null, _toDisplayString(totals.all || 0), 1), _cache[2] || (_cache[2] = _createElementVNode("small", null, "حسب الفلتر الحالي", -1))]),
11478          _createElementVNode("div", _hoisted_5, [_cache[3] || (_cache[3] = _createElementVNode("span", null, "صور", -1)), _createElementVNode("b", null, _toDisplayString(totals.images || 0), 1), _cache[4] || (_cache[4] = _createElementVNode("small", null, "Thumbnails جاهزة حيث متاح", -1))]),
11479          _createElementVNode("div", _hoisted_6, [_cache[5] || (_cache[5] = _createElementVNode("span", null, "فيديوهات", -1)), _createElementVNode("b", null, _toDisplayString(totals.videos || 0), 1), _cache[6] || (_cache[6] = _createElementVNode("small", null, "تحميل كسول", -1))]),
11480          _createElementVNode("div", _hoisted_7, [_cache[7] || (_cache[7] = _createElementVNode("span", null, "التخزين", -1)), _createElementVNode("b", null, _toDisplayString(storage.total_mb || 0) + " MB", 1), _createElementVNode("small", null, _toDisplayString(storage.uploads_dir || 'uploads'), 1)])
11481        ]),
11482        _createElementVNode("section", _hoisted_8, [_createElementVNode("div", _hoisted_9, [
11483          _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((filters.scope) = $event) }, _cache[8] || (_cache[8] = [
11484            _createElementVNode("option", { value: "all" }, "كل المصادر", -1),
11485            _createElementVNode("option", { value: "events" }, "الفعاليات", -1),
11486            _createElementVNode("option", { value: "announcements" }, "الإعلانات/التعميمات", -1),
11487            _createElementVNode("option", { value: "cases" }, "الحالات", -1)
11488          ]), 8, _hoisted_10), [[_vModelSelect, filters.scope]]),
11489          _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((filters.kind) = $event) }, _cache[9] || (_cache[9] = [
11490            _createElementVNode("option", { value: "all" }, "كل الأنواع", -1),
11491            _createElementVNode("option", { value: "image" }, "صور", -1),
11492            _createElementVNode("option", { value: "video" }, "فيديو", -1),
11493            _createElementVNode("option", { value: "pdf" }, "PDF", -1)
11494          ]), 8, _hoisted_11), [[_vModelSelect, filters.kind]]),
11495          _withDirectives(_createElementVNode("input", {
11496            "onUpdate:modelValue": $event => ((filters.search) = $event),
11497            placeholder: "بحث باسم الملف أو الرابط"
11498          }, null, 8, _hoisted_12), [[_vModelText, filters.search]]),
11499          _createElementVNode("button", {
11500            class: "smallbtn",
11501            onClick: load
11502          }, "تطبيق", 8, _hoisted_13)
11503        ])]),
11504        (!items.length&&!store.state.busy)
11505          ? (_openBlock(), _createElementBlock("section", _hoisted_14, "لا توجد وسائط مطابقة."))
11506          : _createCommentVNode("", true),
11507        _createElementVNode("section", _hoisted_15, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (m) => {
11508          return (_openBlock(), _createElementBlock("figure", {
11509            class: "albumItem",
11510            key: m.scope+'-'+m.id
11511          }, [(!isVideo(m)&&!isPdf(m))
11512            ? (_openBlock(), _createElementBlock("img", {
11513                key: 0,
11514                src: mediaSrc(m),
11515                loading: "lazy",
11516                alt: "media"
11517              }, null, 8, _hoisted_16))
11518            : (isVideo(m))
11519              ? (_openBlock(), _createElementBlock("video", {
11520                  key: 1,
11521                  src: m.file_url,
11522                  controls: "",
11523                  preload: "metadata"
11524                }, null, 8, _hoisted_17))
11525              : (_openBlock(), _createElementBlock("div", _hoisted_18, "PDF")), _createElementVNode("figcaption", null, [_createElementVNode("b", null, _toDisplayString(m.filename || scopeLabel(m.scope)), 1
11525), _createElementVNode("small", null, _toDisplayString(scopeLabel(m.scope)) + " — " + _toDisplayString(m.target_title || '-') + " — " + _toDisplayString(fileMB(m.size_bytes)) + " — " + _toDisplayString(shortDate(m.created_at)), 1)]), _createElementVNode("div", _hoisted_19, [_createElementVNode("button", {
11526            class: "smallbtn secondary",
11527            onClick: $event => (openMedia(m))
11528          }, "فتح", 8, _hoisted_20), _createElementVNode("button", {
11529            class: "smallbtn",
11530            onClick: $event => ($router.push(targetPath(m)))
11531          }, "إدارة المصدر", 8, _hoisted_21)])]))
11532        }), 128))])
11533      ]),
11534      _: 1
11535    }))
11536  }
11537}
11538})()
11539  };
11540
11541  const AdminContentIntakePage={
11542    components:{AdminFrame},
11543    setup(){
11544      const store=useGzcStore(),router=useRouter(),route=useRoute();
11545      const items=ref([]),intake=ref(null),communities=ref([]),categories=ref([]),sourceFile=ref(null),publishConfirmed=ref(false);
11546      const source=reactive({source_type:'image',source_text:'',source_url:'',admin_note:''});
11547      const edit=reactive({title_ar:'',summary_ar:'',body_ar:'',content_type:'news',approved_destination:'announcement',source_name:'',source_country:'',source_date:'',source_url:'',confidence:'low',announcement_type:'news',announcement_target:'all',duration_days:14,action_url:'',approved_community_id:'',destination_category_id:''});
11548      const checks=reactive({source_verified:false,content_verified:false,uncertainties_reviewed:false});
11549      const detailId=computed(()=>Number(route.params.id||0)||0),isDetail=computed(()=>!!detailId.value),isDraft=computed(()=>intake.value&&intake.value.status==='draft'),isReview=computed(()=>intake.value&&intake.value.status==='in_review');
11550      const destinationIsGuide=computed(()=>['china_guide','trade_shipping'].includes(edit.approved_destination));
11551      const uploadedSourceEvidence=computed(()=>intake.value&&['image','pdf'].includes(String(intake.value.source_type||''))&&Array.isArray(intake.value.files)&&intake.value.files.length>0);
11552      const sourceReviewLabel=computed(()=>intake.value&&intake.value.source_type==='image'?'راجعت الصورة الأصلية والجهة الظاهرة فيها':intake.value&&intake.value.source_type==='pdf'?'راجعت ملف PDF الأصلي والجهة الظاهرة فيه':intake.value&&intake.value.source_type==='url'?'راجعت الرابط والجهة الناشرة':'راجعت النص المصدر والجهة المذكورة إن وجدت');
11553      const statusLabel=s=>({draft:'مسودة',in_review:'بانتظار الاعتماد',published:'منشور',handed_off:'أُرسل للتحرير',rejected:'مرفوض'}[String(s||'')]||String(s||'-'));
11554      const sourceLabel=s=>({image:'صورة',pdf:'PDF',text:'نص',url:'رابط'}[String(s||'')]||String(s||'-'));
11555      const destinationLabel=s=>({announcement:'الإعلانات',community:'صفحة مجتمع',china_guide:'دليلك في الصين',trade_shipping:'التجارة والشحن',sudan_digital:'قسم قديم محفوظ'}[String(s||'')]||String(s||'-'));
11556      function sync(row){intake.value=row||null;if(!row)return;Object.assign(edit,{title_ar:row.title_ar||'',summary_ar:row.summary_ar||'',body_ar:row.body_ar||'',content_type:row.content_type||'news',approved_destination:row.approved_destination||row.suggested_destination||'announcement',source_name:row.source_name||'',source_country:row.source_country||'',source_date:String(row.source_date||'').slice(0,10),source_url:row.extracted_source_url||'',confidence:row.confidence||'low',announcement_type:row.announcement_type||row.suggested_announcement_type||'news',announcement_target:row.announcement_target||'all',duration_days:Number(row.duration_days||14),action_url:row.action_url||'',approved_community_id:row.approved_community_id||'',destination_category_id:row.destination_category_id||''});Object.assign(checks,{source_verified:false,content_verified:false,uncertainties_reviewed:false});publishConfirmed.value=false;loadCategories();}
11557      async function loadList(){const r=await api('/api/admin/content-intakes');if(r.status===401){router.replace('/admin/login');return;}items.value=safeArray(r.intakes);}
11558      async function loadCommunities(){const r=await api('/api/admin/communities');communities.value=safeArray(r.communities);}
11559      async function loadCategories(){categories.value=[];
11559if(!destinationIsGuide.value)return;const r=await api('/api/china-guide/categories?hub='+encodeURIComponent(edit.approved_destination));categories.value=safeArray(r.categories);if(edit.destination_category_id&&!categories.value.some(x=>Number(x.id)===Number(edit.destination_category_id)))edit.destination_category_id='';}
11560      async function loadDetail(){if(!detailId.value){intake.value=null;return;}const r=await api('/api/admin/content-intakes/'+encodeURIComponent(detailId.value));if(r.status===401){router.replace('/admin/login');return;}if(r.ok)sync(r.intake);else store.state.msg=r.message||'تعذر فتح المسودة';}
11561      async function load(){if(!await store.requireAdmin(router))return;await Promise.all([loadList(),loadCommunities()]);if(detailId.value)await loadDetail();}
11562      function pickFile(e){sourceFile.value=e&&e.target&&e.target.files&&e.target.files[0]||null;}
11563      async function createAndGenerate(){
11564        store.state.busy=true;store.state.msg='حفظ المصدر...';let created=null;
11565        if(['image','pdf'].includes(source.source_type)){
11566          if(!sourceFile.value){store.state.busy=false;store.state.msg='اختر ملف المصدر أولاً';return;}
11567          const fd=new FormData();fd.append('source_type',source.source_type);fd.append('admin_note',source.admin_note||'');fd.append('source',sourceFile.value);
11568          created=await uploadApi('/api/admin/content-intakes',{method:'POST',body:fd,headers:{Accept:'application/json'},uploadLabel:'رفع وحفظ المصدر'});
11569        }else created=await api('/api/admin/content-intakes',{method:'POST',body:JSON.stringify({source_type:source.source_type,source_text:source.source_text,source_url:source.source_url,admin_note:source.admin_note})});
11570        if(!created.ok){store.state.busy=false;store.state.msg=created.message||'تعذر حفظ المصدر';return;}
11571        const id=created.intake&&created.intake.id;store.state.msg='يقرأ AI المصدر ويجهز مسودة للمراجعة...';
11572        const generated=await api('/api/admin/content-intakes/'+encodeURIComponent(id)+'/generate',{method:'POST',body:'{}',feedbackLabel:'إنشاء مسودة AI'});
11573        store.state.busy=false;store.state.msg=generated.message||generated.error||'';await router.push('/admin/content-intake/'+encodeURIComponent(id));await loadList();await loadDetail();
11574      }
11575      async function saveDraft(){if(!intake.value)return null;store.state.busy=true;const r=await api('/api/admin/content-intakes/'+intake.value.id+'/update',{method:'POST',body:JSON.stringify({...edit,approved_community_id:edit.approved_community_id||null,destination_category_id:edit.destination_category_id||null})});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok)sync(r.intake);return r;}
11576      async function regenerate(){if(!intake.value)return;if(!confirm('إعادة إنشاء المسودة من المصدر؟ يمكنك تعديل الناتج بعدها.'))return;store.state.busy=true;const r=await api('/api/admin/content-intakes/'+intake.value.id+'/generate',{method:'POST',body:'{}',feedbackLabel:'إعادة إنشاء مسودة AI'});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok)sync(r.intake);}
11577      async function submitReview(){const reviewChecks={source_verified:checks.source_verified===true,content_verified:checks.content_verified===true,uncertainties_reviewed:checks.uncertainties_reviewed===true};const saved=await saveDraft();if(!saved||!saved.ok||!intake.value||intake.value.status!=='draft')return;store.state.busy=true;const r=await api('/api/admin/content-intakes/'+intake.value.id+'/submit',{method:'POST',body:JSON.stringify(reviewChecks)});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok)sync(r.intake);}
11578      async function returnDraft(){if(!intake.value)return;const r=await api('/api/admin/content-intakes/'+intake.value.id+'/return',{method:'POST',body:JSON.stringify({note:'إعادة للتعديل من مساحة المراجعة'})});store.state.msg=r.message||r.error||'';if(r.ok)sync(r.intake);}
11579      async function approve(){if(!intake.value||!publishConfirmed.value)return;const behavior=intake.value.destination_behavior||{};const ask=behavior.draft_only?'اعتماد وإرسال كمسودة خاصة لمساحة التحرير؟':'اعتماد ونشر المحتوى الآن؟';if(!confirm(ask))return;store.state.busy=true;const r=await api('/api/admin/content-intakes/'+intake.value.id+'/publish',{method:'POST',body:JSON.stringify({publish_confirmed:true}),feedbackLabel:'اعتماد المحتوى'});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok)sync(r.intake);}
11580      async function reject(){if(!intake.value||!confirm('رفض هذه المسودة مع الاحتفاظ بالمصدر؟'))return;const r=await api('/api/admin/content-intakes/'+intake.value.id+'/reject',{method:'POST',body:JSON.stringify({note:'رفض بواسطة الإدارة'})});store.state.msg=r.message||r.error||'';if(r.ok){await loadList();sync(await (async()=>{const d=await api('/api/admin/content-intakes/'+intake.value.id);return d.intake;})());}}
11580
11581      function openItem(row){router.push('/admin/content-intake/'+encodeURIComponent(row.id));}
11582      function back(){router.push('/admin/content-intake');}
11583      function openDestination(){const row=intake.value;if(!row)return;const p=row.published_entity_type==='announcement'?'/admin/announcements':({china_guide:'/admin/china-guide',trade_shipping:'/admin/trade-shipping',sudan_digital:'/admin/sudan-digital'}[row.approved_destination]||'/admin/content-intake');router.push(p);}
11584      watch(()=>edit.approved_destination,loadCategories);watch(()=>route.params.id,loadDetail);onMounted(load);
11585      return{store,items,intake,communities,categories,source,sourceFile,edit,checks,publishConfirmed,isDetail,isDraft,isReview,destinationIsGuide,uploadedSourceEvidence,sourceReviewLabel,statusLabel,sourceLabel,destinationLabel,pickFile,createAndGenerate,saveDraft,regenerate,submitReview,returnDraft,approve,reject,openItem,back,openDestination,load,shortDate};
11586    },
11587    render:(function(){
11588const _Vue = Vue
11589const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
11590
11591const _hoisted_1 = { class: "card dashboardHeaderCard contentIntakeHero" }
11592const _hoisted_2 = ["onClick"]
11593const _hoisted_3 = { class: "card formCard contentIntakeCreate" }
11594const _hoisted_4 = ["onUpdate:modelValue"]
11595const _hoisted_5 = { key: 0 }
11596const _hoisted_6 = ["onChange"]
11597const _hoisted_7 = { key: 1 }
11598const _hoisted_8 = ["onChange"]
11599const _hoisted_9 = { key: 2 }
11600const _hoisted_10 = ["onUpdate:modelValue"]
11601const _hoisted_11 = { key: 3 }
11602const _hoisted_12 = ["onUpdate:modelValue"]
11603const _hoisted_13 = ["onUpdate:modelValue"]
11604const _hoisted_14 = ["disabled", "onClick"]
11605const _hoisted_15 = { class: "contentIntakeQueue" }
11606const _hoisted_16 = {
11607  key: 0,
11608  class: "card emptyState"
11609}
11610const _hoisted_17 = ["onClick"]
11611const _hoisted_18 = ["src"]
11612const _hoisted_19 = { class: "contentIntakeCardBody" }
11613const _hoisted_20 = { class: "memberCardTop" }
11614const _hoisted_21 = { class: "statusPill" }
11615const _hoisted_22 = {
11616  key: 0,
11617  class: "inlineWarning"
11618}
11619const _hoisted_23 = ["onClick"]
11620const _hoisted_24 = { class: "contentIntakeWorkspace" }
11621const _hoisted_25 = { class: "card contentIntakeSource" }
11622const _hoisted_26 = { class: "memberCardTop" }
11623const _hoisted_27 = { class: "statusPill" }
11624const _hoisted_28 = ["src"]
11625const _hoisted_29 = ["href"]
11626const _hoisted_30 = {
11627  key: 1,
11628  class: "contentIntakeSourceText"
11629}
11630const _hoisted_31 = ["href"]
11631const _hoisted_32 = {
11632  key: 3,
11633  class: "hint"
11634}
11635const _hoisted_33 = {
11636  key: 4,
11637  class: "hint"
11638}
11639const _hoisted_34 = { class: "card formCard contentIntakeDraft" }
11640const _hoisted_35 = { class: "memberCardTop" }
11641const _hoisted_36 = { class: "statusPill" }
11642const _hoisted_37 = {
11643  key: 0,
11644  class: "inlineWarning"
11645}
11646const _hoisted_38 = {
11647  key: 1,
11648  class: "dangerBox"
11649}
11650const _hoisted_39 = {
11651  key: 2,
11652  class: "inlineWarning"
11653}
11654const _hoisted_40 = {
11655  key: 3,
11656  class: "intakeNotes"
11657}
11658const _hoisted_41 = ["disabled"]
11659const _hoisted_42 = ["onUpdate:modelValue"]
11660const _hoisted_43 = ["onUpdate:modelValue"]
11661const _hoisted_44 = ["onUpdate:modelValue"]
11662const _hoisted_45 = { class: "editGrid" }
11663const _hoisted_46 = ["onUpdate:modelValue"]
11664const _hoisted_47 = ["onUpdate:modelValue"]
11665const _hoisted_48 = ["onUpdate:modelValue", "placeholder"]
11666const _hoisted_49 = ["onUpdate:modelValue"]
11667const _hoisted_50 = ["onUpdate:modelValue"]
11668const _hoisted_51 = { key: 0 }
11669const _hoisted_52 = ["onUpdate:modelValue"]
11670const _hoisted_53 = ["onUpdate:modelValue"]
11671const _hoisted_54 = { key: 0 }
11672const _hoisted_55 = ["onUpdate:modelValue"]
11673const _hoisted_56 = ["value"]
11674const _hoisted_57 = { key: 1 }
11675const _hoisted_58 = ["onUpdate:modelValue"]
11676const _hoisted_59 = ["value"]
11677const _hoisted_60 = {
11678  key: 2,
11679  class: "editGrid"
11680}
11681const _hoisted_61 = ["onUpdate:modelValue"]
11682const _hoisted_62 = ["onUpdate:modelValue"]
11683const _hoisted_63 = ["onUpdate:modelValue"]
11684const _hoisted_64 = ["onUpdate:modelValue"]
11685const _hoisted_65 = {
11686  key: 4,
11687  class: "actionRow"
11688}
11689const _hoisted_66 = ["onClick"]
11690const _hoisted_67 = ["onClick"]
11691const _hoisted_68 = { class: "card contentIntakeReview" }
11692const _hoisted_69 = { class: "check" }
11693const _hoisted_70 = ["onUpdate:modelValue"]
11694const _hoisted_71 = { class: "check" }
11695const _hoisted_72 = ["onUpdate:modelValue"]
11696const _hoisted_73 = {
11697  key: 0,
11698  class: "check"
11699}
11700const _hoisted_74 = ["onUpdate:modelValue"]
11701const _hoisted_75 = ["onClick"]
11702const _hoisted_76 = { class: "check publishConfirm" }
11703const _hoisted_77 = ["onUpdate:modelValue"]
11704const _hoisted_78 = ["disabled", "onClick"]
11705const _hoisted_79 = ["onClick"]
11706const _hoisted_80 = {
11707  key: 0,
11708  class: "successBox"
11709}
11710const _hoisted_81 = ["onClick"]
11711const _hoisted_82 = ["onClick"]
11712
11713return function render(_ctx, _cache) {
11714  with (_ctx) {
11715    const { createElementVNode: _createElementVNode, vModelSelect: _vModelSelect, withDirectives: _withDirectives, createTextVNode: _createTextVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, vModelText: _vModelText, renderList: _renderList, Fragment: _Fragment, toDisplayString: _toDisplayString, vModelCheckbox: _vModelCheckbox, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
11716
11717    const _component_AdminFrame = _resolveComponent("AdminFrame")
11718
11719    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "المحتوى الذكي" }, {
11720      default: _withCtx(() => [_createElementVNode("section", _hoisted_1, [_cache[0] || (_cache[0] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "AI + Human Review"), _createElementVNode("h3", null, "إنشاء محتوى من صورة أو PDF أو نص أو رابط"), _createElementVNode("p", { class: "hint" }, "الذكاء الاصطناعي ينشئ مسودة فقط. النشر أو الإرسال لمساحة التحرير يحتاج مراجعة واعتماداً بشرياً واضحاً.")], -1)), _createElementVNode("button", {
11721        class: "smallbtn",
11722        onClick: load
11723      }, "تحديث", 8, _hoisted_2)]), (!isDetail)
11724        ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createElementVNode("section", _hoisted_3, [
11725            _cache[8] || (_cache[8] = _createElementVNode("h3", null, "مصدر جديد", -1)),
11726            _createElementVNode("label", null, [_cache[2] || (_cache[2] = _createTextVNode("نوع المصدر")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((source.source_type) = $event) }, _cache[1] || (_cache[1] = [
11727              _createElementVNode("option", { value: "image" }, "📷 صورة", -1),
11728              _createElementVNode("option", { value: "pdf" }, "📄 PDF", -1),
11729              _createElementVNode("option", { value: "text" }, "📝 نص", -1),
11730              _createElementVNode("option", { value: "url" }, "🔗 رابط", -1)
11731            ]), 8, _hoisted_4), [[_vModelSelect, source.source_type]])]),
11732            (source.source_type==='image')
11733              ? (_openBlock(), _createElementBlock("label", _hoisted_5, [_cache[3] || (_cache[3] = _createTextVNode("الصورة")), _createElementVNode("input", {
11734                  type: "file",
11735                  accept: "image/jpeg,image/png,image/webp",
11736                  onChange: pickFile
11737                }, null, 40, _hoisted_6)]))
11738              : _createCommentVNode("", true),
11739            (source.source_type==='pdf')
11740              ? (_openBlock(), _createElementBlock("label", _hoisted_7, [_cache[4] || (_cache[4] = _createTextVNode("ملف PDF")), _createElementVNode("input", {
11741                  type: "file",
11742                  accept: "application/pdf",
11743                  onChange: pickFile
11744                }, null, 40, _hoisted_8)]))
11745              : _createCommentVNode("", true),
11746            (source.source_type==='text')
11747              ? (_openBlock(), _createElementBlock("label", _hoisted_9, [_cache[5] || (_cache[5] = _createTextVNode("النص المصدر")), _withDirectives(_createElementVNode("textarea", {
11748                  "onUpdate:modelValue": $event => ((source.source_text) = $event),
11749                  maxlength: "12000",
11750                  placeholder: "الصق التعميم أو الخبر كما ورد..."
11751                }, null, 8, _hoisted_10), [[_vModelText, source.source_text]])]))
11752              : _createCommentVNode("", true),
11753            (source.source_type==='url')
11754              ? (_openBlock(), _createElementBlock("label", _hoisted_11, [_cache[6] || (_cache[6] = _createTextVNode("الرابط")), _withDirectives(_createElementVNode("input", {
11755                  type: "url",
11756                  "onUpdate:modelValue": $event => ((source.source_url) = $event),
11757                  placeholder: "https://..."
11758                }, null, 8, _hoisted_12), [[_vModelText, source.source_url]])]))
11759              : _createCommentVNode("", true),
11760            _createElementVNode("label", null, [_cache[7] || (_cache[7] = _
11760createTextVNode("ملاحظة للإ AI (اختياري)")), _withDirectives(_createElementVNode("textarea", {
11761              "onUpdate:modelValue": $event => ((source.admin_note) = $event),
11762              placeholder: "مثلاً: صغ الخبر باختصار مع إبراز متطلبات السفر"
11763            }, null, 8, _hoisted_13), [[_vModelText, source.admin_note]])]),
11764            _createElementVNode("button", {
11765              class: "btn loadMore",
11766              disabled: store.state.busy,
11767              onClick: createAndGenerate
11768            }, "حفظ المصدر وإنشاء مسودة AI", 8, _hoisted_14),
11769            _cache[9] || (_cache[9] = _createElementVNode("p", { class: "hint" }, "لا يوجد Auto Publish. المصدر الأصلي يبقى محفوظاً كدليل.", -1))
11770          ]), _createElementVNode("section", _hoisted_15, [_cache[10] || (_cache[10] = _createElementVNode("h3", null, "المسودات والمراجعات", -1)), (!items.length)
11771            ? (_openBlock(), _createElementBlock("div", _hoisted_16, "لا توجد مسودات حالياً."))
11772            : _createCommentVNode("", true), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (row) => {
11773            return (_openBlock(), _createElementBlock("article", {
11774              class: "card contentIntakeCard",
11775              key: row.id,
11776              onClick: $event => (openItem(row))
11777            }, [(row.thumb_url&&row.file_kind==='image')
11778              ? (_openBlock(), _createElementBlock("img", {
11779                  key: 0,
11780                  src: row.thumb_url,
11781                  alt: ""
11782                }, null, 8, _hoisted_18))
11783              : _createCommentVNode("", true), _createElementVNode("div", _hoisted_19, [
11784              _createElementVNode("div", _hoisted_20, [_createElementVNode("b", null, _toDisplayString(row.title_ar||'مصدر جديد — بانتظار AI'), 1), _createElementVNode("span", _hoisted_21, _toDisplayString(statusLabel(row.status)), 1)]),
11785              _createElementVNode("p", null, _toDisplayString(row.summary_ar||row.source_name||sourceLabel(row.source_type)), 1),
11786              _createElementVNode("small", null, _toDisplayString(sourceLabel(row.source_type)) + " · " + _toDisplayString(destinationLabel(row.approved_destination||row.suggested_destination)) + " · " + _toDisplayString(shortDate(row.updated_at)), 1),
11787              (row.duplicate_status==='conflict')
11788                ? (_openBlock(), _createElementBlock("div", _hoisted_22, "⚠ احتمال تكرار يحتاج مراجعة"))
11789                : _createCommentVNode("", true)
11790            ])], 8, _hoisted_17))
11791          }), 128))])], 64))
11792        : intake
11793          ? (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [_createElementVNode("button", {
11794              class: "smallbtn contentIntakeBack",
11795              onClick: back
11796            }, "← كل المسودات", 8, _hoisted_23), _createElementVNode("section", _hoisted_24, [_createElementVNode("article", _hoisted_25, [
11797              _createElementVNode("div", _hoisted_26, [_cache[11] || (_cache[11] = _createElementVNode("h3", null, "1. المصدر الأصلي", -1)), _createElementVNode("span", _hoisted_27, _toDisplayString(sourceLabel(intake.source_type)), 1)]),
11798              (intake.files&&intake.files.length)
11799                ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [(intake.files[0].kind==='image')
11800                    ? (_openBlock(), _createElementBlock("img", {
11801                        key: 0,
11802                        class: "contentIntakePreview",
11803                        src: intake.files[0].preview_url,
11804                        alt: "المصدر الأصلي"
11805                      }, null, 8, _hoisted_28))
11806                    : (_openBlock(), _createElementBlock("a", {
11807                        key: 1,
11808                        class: "btn secondary",
11809                        href: intake.files[0].file_url,
11810                        target: "_blank",
11811                        rel: "noopener"
11812                      }, "فتح ملف PDF الأصلي", 8, _hoisted_29))], 64))
11813                : _createCommentVNode("", true),
11814              (intake.source_type==='text')
11815                ? (_openBlock(), _createElementBlock("pre", _hoisted_30, _toDisplayString(intake.source_text), 1))
11816                : _createCommentVNode("", true),
11817              (intake.source_type==='url')
11818                ? (_openBlock(), _createElementBlock("a", {
11819                    key: 2,
11820                    href: intake.source_url,
11821                    target: "_blank",
11822                    rel: "noopener"
11823                  }, _toDisplayString(intake.source_url), 9, _hoisted_31))
11824                : _createCommentVNode("", true),
11825              uploadedSourceEvidence
11826                ? (_openBlock(), _createElementBlock("p", _hoisted_32, "الصورة أو المستند الأصلي هو دليل المصدر المحفوظ؛ لا تحتاج لإضافة رابط مصدر يدوي."))
11827                : (_openBlock(), _createElementBlock("p", _hoisted_33, "المصدر محفوظ منفصلاً عن المحتوى المنشور ولا يحذف عند الاعتماد."))
11828            ]), _createElementVNode("article", _hoisted_34, [
11829              _createElementVNode("div", _hoisted_35, [_cache[12] || (_cache[12] = _createElementVNode("h3", null, "2. المسودة", -1)), _createElementVNode("span", _hoisted_36, _toDisplayString(statusLabel(intake.status)), 1)]),
11830              (intake.ai_error)
11831                ? (_openBlock(), _createElementBlock("div", _hoisted_37, "تعذر AI سابقاً: " + _toDisplayString(intake.ai_error), 1))
11832                : _createCommentVNode("", true),
11833              (intake.duplicate_status==='conflict')
11834                ? (_openBlock(), _createElementBlock("div", _hoisted_38, "⚠ تعارض محتمل: " + _toDisplayString(intake.duplicate_reason) + " — " + _toDisplayString(intake.duplicate_entity_type) + " #" + _toDisplayString(intake.duplicate_entity_id), 1))
11835                : _createCommentVNode("", true),
11836              (intake.uncertain_fields&&intake.uncertain_fields.length)
11837                ? (_openBlock(), _createElementBlock("div", _hoisted_39, [_cache[13] || (_cache[13] = _createElementVNode("b", null, "حقول تحتاج مراجعة:", -1)), _createTextVNode(" " + _toDisplayString(intake.uncertain_fields.join('، ')), 1)]))
11838                : _createCommentVNode("", true),
11839              (intake.verification_notes&&intake.verification_notes.length)
11840                ? (_openBlock(), _createElementBlock("div", _hoisted_40, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(intake.verification_notes, (n, i) => {
11841                    return (_openBlock(), _createElementBlock("p", { key: i }, "• " + _toDisplayString(n), 1))
11842                  }), 128))]))
11843                : _createCommentVNode("", true),
11844              _createElementVNode("fieldset", { disabled: !isDraft }, [
11845                _createElementVNode("label", null, [_cache[14] || (_cache[14] = _createTextVNode("العنوان")), _withDirectives(_createElementVNode("input", { "onUpdate:modelValue": $event => ((edit.title_ar) = $event) }, null, 8, _hoisted_42), [[_vModelText, edit.title_ar]])]),
11846                _createElementVNode("label", null, [_cache[15] || (_cache[15] = _createTextVNode("الملخص")), _withDirectives(_createElementVNode("textarea", { "onUpdate:modelValue": $event => ((edit.summary_ar) = $event) }, null, 8, _hoisted_43), [[_vModelText, edit.summary_ar]])]),
11847                _createElementVNode("label", null, [_cache[16] || (_cache[16] = _createTextVNode("نص الخبر")), _withDirectives(_createElementVNode("textarea", {
11848                  class: "contentIntakeBody",
11849                  "onUpdate:modelValue": $event => ((edit.body_ar) = $event)
11850                }, null, 8, _hoisted_44), [[_vModelText, edit.body_ar]])]),
11851                _createElementVNode("div", _hoisted_45, [
11852                  _createElementVNode("label", null, [_cache[18] || (_cache[18] = _createTextVNode("نوع المحتوى")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((edit.content_type) = $event) }, _cache[17] || (_cache[17] = [
11853                    _createElementVNode("option", { value: "news" }, "خبر", -1),
11854                    _createElementVNode("option", { value: "official_notice" }, "تعميم رسمي", -1),
11855                    _createElementVNode("option", { value: "travel" }, "سفر", -1),
11856                    _createElementVNode("option", { value: "community" }, "مجتمعي", -1),
11857                    _createElementVNode("option", { value: "commercial" }, "تجاري", -1),
11858                    _createElementVNode("option", { value: "service" }, "خدمة", -1),
11859                    _createElementVNode("option", { value: "emergency" }, "عاجل", -1),
11860                    _createElementVNode("option", { value: "event" }, "فعالية", -1)
11861                  ]), 8, _hoisted_46), [[_vModelSelect, edit.content_type]])]),
11862                  _createElementVNode("label", null, [_cache[20] || (_cache[20] = _createTextVNode("الثقة")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event =>
11862 ((edit.confidence) = $event) }, _cache[19] || (_cache[19] = [_createElementVNode("option", { value: "low" }, "منخفضة", -1), _createElementVNode("option", { value: "medium" }, "متوسطة", -1), _createElementVNode("option", { value: "high" }, "عالية", -1)]), 8, _hoisted_47), [[_vModelSelect, edit.confidence]])]),
11863                  _createElementVNode("label", null, [_createTextVNode(_toDisplayString(uploadedSourceEvidence?'الجهة الظاهرة في المستند (اختياري)':'الجهة / المصدر'), 1), _withDirectives(_createElementVNode("input", {
11864                    "onUpdate:modelValue": $event => ((edit.source_name) = $event),
11865                    placeholder: uploadedSourceEvidence?'يستخرجها AI إن كانت واضحة':'الجهة الناشرة أو المصدر'
11866                  }, null, 8, _hoisted_48), [[_vModelText, edit.source_name]])]),
11867                  _createElementVNode("label", null, [_cache[21] || (_cache[21] = _createTextVNode("الدولة")), _withDirectives(_createElementVNode("input", { "onUpdate:modelValue": $event => ((edit.source_country) = $event) }, null, 8, _hoisted_49), [[_vModelText, edit.source_country]])]),
11868                  _createElementVNode("label", null, [_cache[22] || (_cache[22] = _createTextVNode("تاريخ المصدر")), _withDirectives(_createElementVNode("input", {
11869                    type: "date",
11870                    "onUpdate:modelValue": $event => ((edit.source_date) = $event)
11871                  }, null, 8, _hoisted_50), [[_vModelText, edit.source_date]])]),
11872                  (!uploadedSourceEvidence)
11873                    ? (_openBlock(), _createElementBlock("label", _hoisted_51, [_cache[23] || (_cache[23] = _createTextVNode("رابط المصدر المستخرج")), _withDirectives(_createElementVNode("input", {
11874                        type: "url",
11875                        "onUpdate:modelValue": $event => ((edit.source_url) = $event)
11876                      }, null, 8, _hoisted_52), [[_vModelText, edit.source_url]])]))
11877                    : _createCommentVNode("", true)
11878                ]),
11879                _cache[36] || (_cache[36] = _createElementVNode("h4", null, "الوجهة بعد الاعتماد", -1)),
11880                _createElementVNode("label", null, [_cache[25] || (_cache[25] = _createTextVNode("الوجهة")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((edit.approved_destination) = $event) }, _cache[24] || (_cache[24] = [
11881                  _createElementVNode("option", { value: "announcement" }, "الإعلانات — ينشر بعد الاعتماد", -1),
11882                  _createElementVNode("option", { value: "community" }, "صفحة مجتمع — ينشر بعد الاعتماد", -1),
11883                  _createElementVNode("option", { value: "china_guide" }, "دليلك في الصين — مسودة تحرير فقط", -1),
11884                  _createElementVNode("option", { value: "trade_shipping" }, "التجارة والشحن — مسودة تحرير فقط", -1)
11885                ]), 8, _hoisted_53), [[_vModelSelect, edit.approved_destination]])]),
11886                (edit.approved_destination==='community')
11887                  ? (_openBlock(), _createElementBlock("label", _hoisted_54, [_cache[27] || (_cache[27] = _createTextVNode("المجتمع")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((edit.approved_community_id) = $event) }, [_cache[26] || (_cache[26] = _createElementVNode("option", { value: "" }, "اختر المجتمع", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(communities, (c) => {
11888                      return (_openBlock(), _createElementBlock("option", {
11889                        key: c.id,
11890                        value: c.id
11891                      }, _toDisplayString(c.name_ar), 9, _hoisted_56))
11892                    }), 128))], 8, _hoisted_55), [[_vModelSelect, edit.approved_community_id]])]))
11893                  : _createCommentVNode("", true),
11894                destinationIsGuide
11895                  ? (_openBlock(), _createElementBlock("label", _hoisted_57, [_cache[29] || (_cache[29] = _createTextVNode("التصنيف (اختياري)")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((edit.destination_category_id) = $event) }, [_cache[28] || (_cache[28] = _createElementVNode("option", { value: "" }, "يحدد لاحقاً في مساحة التحرير", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(categories, (c) => {
11896                      return (_openBlock(), _createElementBlock("option", {
11897                        key: c.id,
11898                        value: c.id
11899                      }, _toDisplayString(c.name_ar), 9, _hoisted_59))
11900                    }), 128))], 8, _hoisted_58), [[_vModelSelect, edit.destination_category_id]])]))
11901                  : _createCommentVNode("", true),
11902                (['announcement','community'].includes(edit.approved_destination))
11903                  ? (_openBlock(), _createElementBlock("div", _hoisted_60, [
11904                      _createElementVNode("label", null, [_cache[31] || (_cache[31] = _createTextVNode("نوع الإعلان")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((edit.announcement_type) = $event) }, _cache[30] || (_cache[30] = [
11905                        _createElementVNode("option", { value: "news" }, "خبر", -1),
11906                        _createElementVNode("option", { value: "general" }, "عام", -1),
11907                        _createElementVNode("option", { value: "event" }, "فعالية", -1),
11908                        _createElementVNode("option", { value: "urgent" }, "عاجل", -1)
11909                      ]), 8, _hoisted_61), [[_vModelSelect, edit.announcement_type]])]),
11910                      _createElementVNode("label", null, [_cache[33] || (_cache[33] = _createTextVNode("الجمهور")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((edit.announcement_target) = $event) }, _cache[32] || (_cache[32] = [
11911                        _createElementVNode("option", { value: "all" }, "الكل", -1),
11912                        _createElementVNode("option", { value: "members" }, "الأعضاء", -1),
11913                        _createElementVNode("option", { value: "admins" }, "الإدارة", -1),
11914                        _createElementVNode("option", { value: "visitors" }, "الزوار", -1)
11915                      ]), 8, _hoisted_62), [[_vModelSelect, edit.announcement_target]])]),
11916                      _createElementVNode("label", null, [_cache[34] || (_cache[34] = _createTextVNode("مدة العرض بالأيام")), _withDirectives(_createElementVNode("input", {
11917                        type: "number",
11918                        min: "1",
11919                        max: "365",
11920                        "onUpdate:modelValue": $event => ((edit.duration_days) = $event)
11921                      }, null, 8, _hoisted_63), [[_vModelText, edit.duration_days]])]),
11922                      _createElementVNode("label", null, [_cache[35] || (_cache[35] = _createTextVNode("رابط الإجراء")), _withDirectives(_createElementVNode("input", {
11923                        "onUpdate:modelValue": $event => ((edit.action_url) = $event),
11924                        placeholder: "اختياري"
11925                      }, null, 8, _hoisted_64), [[_vModelText, edit.action_url]])])
11926                    ]))
11927                  : _createCommentVNode("", true)
11928              ], 8, _hoisted_41),
11929              isDraft
11930                ? (_openBlock(), _createElementBlock("div", _hoisted_65, [_
11930createElementVNode("button", {
11931                    class: "btn secondary",
11932                    onClick: saveDraft
11933                  }, "حفظ المسودة", 8, _hoisted_66), _createElementVNode("button", {
11934                    class: "btn secondary",
11935                    onClick: regenerate
11936                  }, "إعادة القراءة بالـ AI", 8, _hoisted_67)]))
11937                : _createCommentVNode("", true)
11938            ]), _createElementVNode("article", _hoisted_68, [_cache[41] || (_cache[41] = _createElementVNode("h3", null, "3. المراجعة البشرية", -1)), isDraft
11939              ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [
11940                  _createElementVNode("label", _hoisted_69, [_withDirectives(_createElementVNode("input", {
11941                    type: "checkbox",
11942                    "onUpdate:modelValue": $event => ((checks.source_verified) = $event)
11943                  }, null, 8, _hoisted_70), [[_vModelCheckbox, checks.source_verified]]), _createTextVNode(" " + _toDisplayString(sourceReviewLabel), 1)]),
11944                  _createElementVNode("label", _hoisted_71, [_withDirectives(_createElementVNode("input", {
11945                    type: "checkbox",
11946                    "onUpdate:modelValue": $event => ((checks.content_verified) = $event)
11947                  }, null, 8, _hoisted_72), [[_vModelCheckbox, checks.content_verified]]), _cache[37] || (_cache[37] = _createTextVNode(" راجعت العنوان والنص والأرقام والمتطلبات"))]),
11948                  (intake.uncertain_fields&&intake.uncertain_fields.length)
11949                    ? (_openBlock(), _createElementBlock("label", _hoisted_73, [_withDirectives(_createElementVNode("input", {
11950                        type: "checkbox",
11951                        "onUpdate:modelValue": $event => ((checks.uncertainties_reviewed) = $event)
11952                      }, null, 8, _hoisted_74), [[_vModelCheckbox, checks.uncertainties_reviewed]]), _cache[38] || (_cache[38] = _createTextVNode(" راجعت الحقول التي أشار AI إلى عدم وضوحها"))]))
11953                    : _createCommentVNode("", true),
11954                  _createElementVNode("button", {
11955                    class: "btn loadMore",
11956                    onClick: submitReview
11957                  }, "قفل المسودة وإرسالها للاعتماد", 8, _hoisted_75)
11958                ], 64))
11959              : isReview
11960                ? (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [
11961                    _cache[40] || (_cache[40] = _createElementVNode("div", { class: "successBox" }, "المسودة مقفلة للمراجعة. أي تعديل يتطلب إعادتها للمسودة.", -1)),
11962                    _createElementVNode("label", _hoisted_76, [_withDirectives(_createElementVNode("input", {
11963                      type: "checkbox",
11964                      "onUpdate:modelValue": $event => ((publishConfirmed) = $event)
11965                    }, null, 8, _hoisted_77), [[_vModelCheckbox, publishConfirmed]]), _cache[39] || (_cache[39] = _createTextVNode(" راجعت النسخة النهائية وأتحمل قرار الاعتماد لهذه الوجهة"))]),
11966                    _createElementVNode("button", {
11967                      class: "btn loadMore",
11968                      disabled: !publishConfirmed,
11969                      onClick: approve
11970                    }, _toDisplayString(intake.destination_behavior&&intake.destination_behavior.draft_only?'اعتماد وإرسال لمساحة التحرير':'اعتماد ونشر'), 9, _hoisted_78),
11971                    _createElementVNode("button", {
11972                      class: "btn secondary",
11973                      onClick: returnDraft
11974                    }, "إعادة للمسودة", 8, _hoisted_79)
11975                  ], 64))
11976                : (_openBlock(), _createElementBlock(_Fragment, { key: 2 }, [(['published','handed_off'].includes(intake.status))
11977                    ? (_openBlock(), _createElementBlock("div", _hoisted_80, "اكتملت هذه العملية بواسطة اعتماد بشري. " + _toDisplayString(intake.status==='published'?'تم النشر':'تم إنشاء مسودة في الوجهة المختارة بدون نشر عام') + ".", 1))
11978                    : _createCommentVNode("", true), (['published','handed_off'].includes(intake.status))
11979                    ? (_openBlock(), _createElementBlock("button", {
11980                        key: 1,
11981                        class: "btn secondary",
11982                        onClick: openDestination
11983                      }, "فتح الوجهة", 8, _hoisted_81))
11984                    : _createCommentVNode("", true)], 64)), (['draft','in_review'].includes(intake.status))
11985              ? (_openBlock(), _createElementBlock("button", {
11986                  key: 3,
11987                  class: "smallbtn dangerBtn",
11988                  onClick: reject
11989                }, "رفض المسودة", 8, _hoisted_82))
11990              : _createCommentVNode("", true)])])], 64))
11991          : _createCommentVNode("", true)]),
11992      _: 1
11993    }))
11994  }
11995}
11996})()
11997  };
11998
11999  const AdminAnnouncementsPage={
12000    components:{AdminFrame},
12001    setup(){
12002      const store=useGzcStore();const router=useRouter();const route=useRoute();const workspaceMode=computed(()=>!!route.params.id);
12003      const form=reactive({title:'',body:'',type:'general',target:'all',duration_days:14,action_url:'',verification_status:'unverified',verification_note:''});
12004      const edit=reactive({title:'',body:'',type:'general',target:'all',action_url:'',verification_status:'unverified',verification_note:'',expires_at:''});
12005      const editOpen=ref(false);const listMode=ref('active');
12006      const files=ref([]);const fileLabel=computed(()=>mediaPreviewLabel(files.value));
12007      const workspaceRows=computed(()=>store.state.announcements.filter(a=>String(a.id)===String(route.params.id)));
12008      const queueCounts=computed(()=>{const all=safeArray(store.state.announcements);return{all:all.length,active:all.filter(a=>!['expired','archived'].includes(String(a.status||''))).length,expired:all.filter(a=>String(a.status||'')==='expired').length};});
12009      const rows=computed(()=>
12009{if(workspaceMode.value)return workspaceRows.value;const all=safeArray(store.state.announcements);if(listMode.value==='expired')return all.filter(a=>String(a.status||'')==='expired');if(listMode.value==='all')return all;return all.filter(a=>!['expired','archived'].includes(String(a.status||'')));});
12010      function onFiles(e){files.value=Array.from((e.target&&e.target.files)||[]).slice(0,5);}
12011      function openAttachment(m){if(m&&m.file_url)window.open(m.file_url,'_blank','noopener');}
12012      function announcementStatusName(v){return ({published:'منشور',active:'منشور',draft:'مسودة',archived:'مؤرشف',expired:'منتهي'}[String(v||'')])||String(v||'-');}
12013      function announcementTypeName(v){return ({general:'عام',service:'خدمة',event:'فعالية',warning:'تنبيه',important:'مهم',urgent:'عاجل',album:'وسائط فعالية',official:'رسمي'}[String(v||'')])||String(v||'-');}
12014      function announcementTargetName(v){return ({all:'الجميع',members:'الأعضاء',admins:'الإدارة',visitors:'الزوار'}[String(v||'')])||String(v||'-');}
12015      function adminVerificationLabel(a){return isVerifiedAnnouncement(a)?'معتمد من الإدارة':'لم تتم المراجعة';}
12016      function dateInput(v){return String(v||'').slice(0,10);}
12017      function fillEdit(a){a=a||{};edit.title=String(a.title||'');edit.body=String(a.body||'');edit.type=String(a.type||'general');edit.target=String(a.target||'all');edit.action_url=String(a.action_url||'');edit.verification_status=String(a.verification_status||'unverified');edit.verification_note=String(a.verification_note||'');edit.expires_at=dateInput(a.expires_at);}
12018      function openWorkspace(a){if(a&&a.id)router.push('/admin/announcements/'+encodeURIComponent(a.id));}
12019      function closeWorkspace(){editOpen.value=false;router.push('/admin/announcements');}
12020      async function load(){if(await store.requireAdmin(router)){await store.loadAdminAnnouncements(router);if(workspaceMode.value){if(!workspaceRows.value.length)store.state.msg='الإعلان غير موجود أو خارج نطاق صلاحيتك';else if(!editOpen.value)fillEdit(workspaceRows.value[0]);}}}
12021      onMounted(load);watch(()=>route.params.id,async()=>{editOpen.value=false;await load();});
12022      async function publish(){const fd=new FormData();Object.keys(form).forEach(k=>fd.append(k,String(form[k]||'')));Array.from(files.value||[]).forEach(file=>fd.append('media',file));store.state.busy=true;store.state.msg='جاري نشر الإعلان...';const r=await uploadApi('/api/admin/announcements',{method:'POST',body:fd,headers:{'Accept':'application/json'},uploadLabel:'رفع وسائط الإعلان'});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok){form.title='';form.body='';form.action_url='';form.duration_days=14;form.verification_status='unverified';form.verification_note='';files.value=[];await load();}}
12023      function beginEdit(a){fillEdit(a);editOpen.value=true;}
12024      async function saveEdit(a){if(!a||!a.id)return;store.state.busy=true;const payload={title:edit.title,body:edit.body,type:edit.type,target:edit.target,action_url:edit.action_url,verification_status:edit.verification_status,verification_note:edit.verification_note,expires_at:edit.expires_at};const r=await api('/api/admin/announcements/'+encodeURIComponent(a.id)+'/update',{method:'POST',body:JSON.stringify(payload)});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok){editOpen.value=false;await load();}}
12025      async function verify(a){if(!a||!a.id)return;store.state.busy=true;const r=await api('/api/admin/announcements/'+encodeURIComponent(a.id)+'/verify',{method:'POST',body:JSON.stringify({verification_note:edit.verification_note||a.verification_note||''})});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok)await load();}
12026      async function archive(a){if(!a||!a.id)return;if(!confirm('أرشفة الإعلان؟'))return;store.state.busy=true;const r=await api('/api/admin/announcements/'+encodeURIComponent(a.id)+'/archive',{method:'POST'});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok&&workspaceMode.value){closeWorkspace();return;}await load();}
12027      return {store,form,edit,editOpen,listMode,queueCounts,files,fileLabel,workspaceMode,rows,onFiles,openAttachment,openWorkspace,closeWorkspace,publish,beginEdit,saveEdit,verify,archive,mediaSrc,isVideo,isPdf,isVerifiedAnnouncement,adminVerificationLabel,announcementStatusName,announcementTypeName,announcementTargetName,shortDate,adminRecordUpdatedAt,adminQueueOwner,announcementQueueNextAction};
12028    },
12029    render:(function(){
12030const _Vue = Vue
12031const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
12032
12033const _hoisted_1 = { class: "card collapseSection formCard announcementComposer" }
12034const _hoisted_2 = { class: "collapseBody" }
12035const _hoisted_3 = ["onUpdate:modelValue"]
12036const _hoisted_4 = ["onUpdate:modelValue"]
12037const _hoisted_5 = { class: "editGrid" }
12038const _hoisted_6 = ["onUpdate:modelValue"]
12039const _hoisted_7 = ["value"]
12040const _hoisted_8 = ["onUpdate:modelValue"]
12041const _hoisted_9 = ["value"]
12042const _hoisted_10 = ["onUpdate:modelValue"]
12043const _hoisted_11 = ["onUpdate:modelValue"]
12044const _hoisted_12 = ["onUpdate:modelValue"]
12045const _hoisted_13 = ["onUpdate:modelValue"]
12046const _hoisted_14 = { class: "filePicker caseFilePicker" }
12047const _hoisted_15 = ["onChange"]
12048const _hoisted_16 = ["onClick"]
12049const _hoisted_17 = { class: "segmented announcementQueueFilters" }
12050const _hoisted_18 = ["onClick"]
12051const _hoisted_19 = ["onClick"]
12052const _hoisted_20 = ["onClick"]
12053const _hoisted_21 = {
12054  key: 1,
12055  class: "card adminQueueState adminQueueLoading"
12056}
12057const _hoisted_22 = {
12058  key: 2,
12059  class: "card emptyCard adminQueueState"
12060}
12061const _hoisted_23 = {
12062  key: 3,
12063  class: "adminQueueList announcementQueueList"
12064}
12065const _hoisted_24 = ["onClick", "onKeyup"]
12066const _hoisted_25 = { class: "adminQueueIdentity" }
12067const _hoisted_26 = { class: "adminQueueFacts adminWorkflowFacts" }
12068const _hoisted_27 = { class: "adminQueueNextAction" }
12069const _hoisted_28 = ["onClick"]
12070const _hoisted_29 = {
12071  key: 4,
12072  class: "opsList"
12073}
12074const _hoisted_30 = { class: "adminRecordWorkspaceTop announcementRecordTop" }
12075const _hoisted_31 = ["onClick"]
12076const _hoisted_32 = { class: "announcementWorkspaceHeader" }
12077const _hoisted_33 = { class: "announcementStateRow" }
12078const _hoisted_34 = { class: "statusPill" }
12079const _hoisted_35 = { class: "announcementActionBar" }
12080const _hoisted_36 = ["onClick"]
12081const _hoisted_37 = ["onClick"]
12082const _hoisted_38 = ["href"]
12083const _hoisted_39 = ["onClick"]
12084const _hoisted_40 = {
12085  key: 0,
12086  class: "announcementEditPanel"
12087}
12088const _hoisted_41 = { class: "memberSectionHead" }
12089const _hoisted_42 = ["onClick"]
12090const _hoisted_43 = ["onUpdate:modelValue"]
12091const _hoisted_44 = ["onUpdate:modelValue"]
12092const _hoisted_45 = { class: "editGrid" }
12093const _hoisted_46 = ["onUpdate:modelValue"]
12094const _hoisted_47 = ["value"]
12095const _hoisted_48 = ["onUpdate:modelValue"]
12096const _hoisted_49 = ["value"]
12097const _hoisted_50 = ["onUpdate:modelValue"]
12098const _hoisted_51 = ["onUpdate:modelValue"]
12099const _hoisted_52 = ["onUpdate:modelValue"]
12100const _hoisted_53 = ["onUpdate:modelValue"]
12101const _hoisted_54 = ["onClick"]
12102const _hoisted_55 = { class: "recordNarrative announcementNarrative" }
12103const _hoisted_56 = {
12104  key: 1,
12105  class: "announcementWorkspaceSection"
12106}
12107const _hoisted_57 = { class: "memberSectionHead" }
12108const _hoisted_58 = { class: "statusPill" }
12109const _hoisted_59 = { class: "announcementMediaGrid" }
12110const _hoisted_60 = ["onClick"]
12111const _hoisted_61 = ["src"]
12112const _hoisted_62 = ["src"]
12113const _hoisted_63 = { class: "announcementWorkspaceSection announcementMetaSection" }
12114const _hoisted_64 = { class: "memberDataGrid announcementMetaGrid" }
12115const _hoisted_65 = { class: "profileLine" }
12116const _hoisted_66 = { class: "profileLine" }
12117const _hoisted_67 = { class: "profileLine" }
12118const _hoisted_68 = { class: "profileLine" }
12119const _hoisted_69 = { class: "profileLine" }
12120const _hoisted_70 = { class: "profileLine" }
12121const _hoisted_71 = {
12122  key: 0,
12123  class: "profileLine announcementReviewNote"
12124}
12125
12126return function render(_ctx, _cache) {
12127  with (_ctx) {
12128    const { createElementVNode: _createElementVNode, vModelText: _vModelText, withDirectives: _withDirectives, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, toDisplayString: _toDisplayString, vModelSelect: _vModelSelect, createTextVNode: _createTextVNode, normalizeClass: _normalizeClass, createCommentVNode: _createCommentVNode, withModifiers: _withModifiers, withKeys: _withKeys, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
12129
12130    const _component_AdminFrame = _resolveComponent("AdminFrame")
12131
12132    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "الإعلانات" }, {
12133      default: _withCtx(() => [(!workspaceMode)
12134        ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createElementVNode("details", _hoisted_1, [_cache[3] || (_cache[3] = _createElementVNode("summary", null, [_createElementVNode("b", null, "+ نشر إعلان جديد"), _createElementVNode("span", null, "افتح النموذج عند الحاجة")], -1)), _createElementVNode("div", _hoisted_2, [
12135            _cache[2] || (_cache[2] = _createElementVNode("p", { class: "hint" }, "الإعلانات المجتمعية فقط. التعميمات الرسمية تبقى في الحسابات الرسمية.", -1)),
12136            _withDirectives(_createElementVNode("input", {
12137              "onUpdate:modelValue": $event => ((form.title) = $event),
12138              placeholder: "عنوان الإعلان"
12139            }, null, 8, _hoisted_3), [[_vModelText, form.title]]),
12140            _withDirectives(_createElementVNode("textarea", {
12141              "onUpdate:modelValue": $event => ((form.body) = $event),
12142              placeholder: "نص الإعلان"
12143            }, null, 8, _hoisted_4), [[_vModelText, form.body]]),
12144            _createElementVNode("div", _hoisted_5, [
12145              _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((form.type) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList($optionList('announcement_type',form.type), (o) => {
12146                return (_openBlock(), _createElementBlock("option", {
12147                  key: o.value,
12148                  value: o.value
12149                }, _toDisplayString(o.label), 9, _hoisted_7))
12150              }), 128))], 8, _hoisted_6), [[_vModelSelect, form.type]]),
12151              _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((form.target) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList($optionList('announcement_target',form.target), (o) => {
12152                return (_openBlock(), _createElementBlock("option", {
12153                  key: o.value,
12154                  value: o.value
12155                }, _toDisplayString(o.label), 9, _hoisted_9))
12156              }), 128))], 8, _hoisted_8), [[_vModelSelect, form.target]]),
12157              _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((form.verification_status) = $event) }, _cache[0] || (_cache[0] = [_createElementVNode("option", { value: "unverified" }, "لم تتم المراجعة", -1), _createElementVNode("option", { value: "admin_verified" }, "معتمد من الإدارة", -1)]), 8, _hoisted_10), [[_vModelSelect, form.verification_status]]),
12158              _withDirectives(_createElementVNode("input", {
12159                type: "number",
12160                min: "1",
12161                max: "365",
12162                "onUpdate:modelValue": $event => ((form.duration_days) = $event),
12163                placeholder: "مدة الظهور بالأيام"
12164              }, null, 8, _hoisted_11), [[_vModelText, form.duration_days]]),
12165              _withDirectives(_createElementVNode("input", {
12166                "onUpdate:modelValue": $event => ((form.action_url) = $event),
12167                placeholder: "رابط إجراء اختياري"
12168              }, null, 8, _hoisted_12), [[_vModelText, form.action_url]]),
12169              _withDirectives(_createElementVNode("input", {
12170                "onUpdate:modelValue": $event => ((form.verification_note) = $event),
12171                placeholder: "ملاحظة مراجعة اختيارية"
12172              }, null, 8, _hoisted_13), [[_vModelText, form.verification_note]])
12173            ]),
12174            _createElementVNode("label", _hoisted_14, [_createElementVNode("input", {
12175              type: "file",
12176              multiple: "",
12177              accept: "image/jpeg,image/png,image/webp,application/pdf",
12178              onChange: onFiles
12179            }, null, 40, _hoisted_15), _cache[1] || (_cache[1] = _createElementVNode("span", null, "إرفاق صور / PDF", -1)), _createElementVNode("em", null, _toDisplayString(fileLabel), 1)]),
12180            _createElementVNode("button", {
12181              class: "btn loadMore",
12182              onClick: publish
12183            }, "نشر الإعلان", 8, _hoisted_16)
12184          ])]), _cache[7] || (_cache[7] = _createElementVNode("section", { class: "adminQueueIntro announcementQueueIntro" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "المحتوى المنشور"), _createElementVNode("h2", null, "الإعلانات"), _createElementVNode("p", null, "القائمة للفرز فقط. افتح الإعلان للمراجعة والتعديل والإجراء في مساحة واحدة.")])], -1)), _createElementVNode("div", _hoisted_17, [_createElementVNode("button", {
12185            class: _normalizeClass({active:listMode==='active'}),
12186            onClick: $event => (listMode='active')
12187          }, [_cache[4] || (_cache[4] = _createTextVNode("النشطة ")), _createElementVNode("small", null, _toDisplayString(queueCounts.active), 1)], 10, _hoisted_18), _createElementVNode("button", {
12188            class: _normalizeClass({active:listMode==='expired'}),
12189            onClick: $event => (listMode='expired')
12190          }, [_cache[5] || (_cache[5] = _createTextVNode("المنتهية ")), _createElementVNode("small", null, _toDisplayString(queueCounts.expired), 1)], 10, _hoisted_19), _createElementVNode("button", {
12191            class: _normalizeClass({active:listMode==='all'}),
12192            onClick: $event => (listMode='all')
12193          }, [_cache[6] || (_cache[6] = _createTextVNode("الكل ")), _createElementVNode("small", null, _toDisplayString(queueCounts.all), 1)], 10, _hoisted_20)])], 64))
12194        : _createCommentVNode("", true), (store.state.busy && !rows.length)
12195        ? (_openBlock(), _createElementBlock("div", _hoisted_21, "جاري تحميل الإعلانات..."))
12196        : (!rows.length)
12197          ? (_openBlock(), _createElementBlock("div", _hoisted_22, _toDisplayString(workspaceMode?'الإعلان غير موجود.':'لا توجد إعلانات في هذا التصنيف.'), 1))
12198          : _createCommentVNode("", true), (!workspaceMode)
12199        ? (_openBlock(), _createElementBlock("div", _hoisted_23, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(rows, (a) => {
12200            return (_openBlock(), _createElementBlock("article", {
12201              class: "adminQueueRow announcementQueueRow",
12202              key: a.id,
12203              onClick: $event => (openWorkspace(a)),
12204              tabindex: "0",
12205              onKeyup: _withKeys($event => (openWorkspace(a)), ["enter"])
12206            }, [_createElementVNode("div", _hoisted_25, [_cache[8] || (_cache[8] = _createElementVNode("div", { class: "memberThumb memberThumbPlaceholder" }, "📣", -1)), _createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(a.title || 'إعلان'), 1), _createElementVNode("small", null, _toDisplayString(String(a.body||'').slice(0,100) || 'بدون نص'), 1)])]), _createElementVNode("div", _hoisted_26, [
12207              _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(announcementStatusName(a.status)), 1), _createElementVNode("small", null, "الحالة · " + _toDisplayString(adminVerificationLabel(a)), 1)]),
12208              _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(adminQueueOwner('announcements',a)), 1), _cache[9] || (_cache[9] = _createElementVNode("small", null, "المسؤول", -1))]),
12209              _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(adminRecordUpdatedAt(a)), 1), _cache[10] || (_cache[10] = _createElementVNode("small", null, "آخر تحديث", -1))]),
12210              _createElementVNode("span", _hoisted_27, [_createElementVNode("b", null, _toDisplayString(announcementQueueNextAction(a)), 1), _cache[11] || (_cache[11] = _createElementVNode("small", null, "الإجراء التالي", -1))])
12211            ]), _createElementVNode("button", {
12212              class: "smallbtn secondary adminQueueOpen",
12213              onClick: _withModifiers($event => (openWorkspace(a)), ["stop"])
12214            }, "فتح الإعلان", 8, _hoisted_28)], 40, _hoisted_24))
12215          }), 128))]))
12216        : (_openBlock(), _createElementBlock("div", _hoisted_29, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(rows, (a) => {
12217            return (_openBlock(), _createElementBlock("article", {
12218              class: "card announcementCard adminRecordWorkspace recordWorkspaceOnly announcementRecordWorkspace",
12219              key: a.id
12220            }, [
12221              _createElementVNode("div", _hoisted_30, [_createElementVNode("button", {
12222                class: "smallbtn secondary compactBackButton",
12223                onClick: closeWorkspace
12224              }, "← الإعلانات", 8, _hoisted_31), _cache[12] || (_cache[12] = _createElementVNode("span", null, "سجل الإعلان", -1))]),
12225              _createElementVNode("header", _hoisted_32, [_createElementVNode("div", null, [_cache[13] || (_cache[13] = _createElementVNode("span", { class: "adminEyebrow" }, "إعلان", -1)), _createElementVNode("h3", null, _toDisplayString(a.title || 'إعلان'), 1), _createElementVNode("div", _hoisted_33, [_createElementVNode("span", _hoisted_34, _toDisplayString(announcementStatusName(a.status)), 1), _createElementVNode("span", { class: _normalizeClass(["verifyStamp", isVerifiedAnnouncement(a)?'ok':'warn']) }, _toDisplayString(adminVerificationLabel(a)), 3)])])]),
12226              _createElementVNode("div", _hoisted_35, [
12227                _createElementVNode("button", {
12228                  class: "smallbtn secondary",
12229                  onClick: $event => (beginEdit(a))
12230                }, "تعديل", 8, _hoisted_36),
12231                (!isVerifiedAnnouncement(a))
12232                  ? (_openBlock(), _createElementBlock("button", {
12233                      key: 0,
12234                      class: "smallbtn",
12235                      onClick: $event =>
12235 (verify(a))
12236                    }, "اعتماد بعد المراجعة", 8, _hoisted_37))
12237                  : _createCommentVNode("", true),
12238                (a.action_url)
12239                  ? (_openBlock(), _createElementBlock("a", {
12240                      key: 1,
12241                      class: "smallbtn secondary",
12242                      href: a.action_url,
12243                      target: "_blank",
12244                      rel: "noopener noreferrer"
12245                    }, "فتح الرابط", 8, _hoisted_38))
12246                  : _createCommentVNode("", true),
12247                _createElementVNode("button", {
12248                  class: "smallbtn danger",
12249                  onClick: $event => (archive(a))
12250                }, "أرشفة", 8, _hoisted_39)
12251              ]),
12252              editOpen
12253                ? (_openBlock(), _createElementBlock("section", _hoisted_40, [
12254                    _createElementVNode("div", _hoisted_41, [_cache[14] || (_cache[14] = _createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "وضع التعديل"), _createElementVNode("h3", null, "تعديل الإعلان")], -1)), _createElementVNode("button", {
12255                      class: "smallbtn secondary",
12256                      onClick: $event => (editOpen=false)
12257                    }, "إلغاء", 8, _hoisted_42)]),
12258                    _withDirectives(_createElementVNode("input", {
12259                      "onUpdate:modelValue": $event => ((edit.title) = $event),
12260                      placeholder: "عنوان الإعلان"
12261                    }, null, 8, _hoisted_43), [[_vModelText, edit.title]]),
12262                    _withDirectives(_createElementVNode("textarea", {
12263                      "onUpdate:modelValue": $event => ((edit.body) = $event),
12264                      placeholder: "نص الإعلان"
12265                    }, null, 8, _hoisted_44), [[_vModelText, edit.body]]),
12266                    _createElementVNode("div", _hoisted_45, [
12267                      _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((edit.type) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList($optionList('announcement_type',edit.type), (o) => {
12268                        return (_openBlock(), _createElementBlock("option", {
12269                          key: o.value,
12270                          value: o.value
12271                        }, _toDisplayString(o.label), 9, _hoisted_47))
12272                      }), 128))], 8, _hoisted_46), [[_vModelSelect, edit.type]]),
12273                      _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((edit.target) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList($optionList('announcement_target',edit.target), (o) => {
12274                        return (_openBlock(), _createElementBlock("option", {
12275                          key: o.value,
12276                          value: o.value
12277                        }, _toDisplayString(o.label), 9, _hoisted_49))
12278                      }), 128))], 8, _hoisted_48), [[_vModelSelect, edit.target]]),
12279                      _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((edit.verification_status) = $event) }, _cache[15] || (_cache[15] = [_createElementVNode("option", { value: "unverified" }, "لم تتم المراجعة", -1), _createElementVNode("option", { value: "admin_verified" }, "معتمد من الإدارة", -1)]), 8, _hoisted_50), [[_vModelSelect, edit.verification_status]]),
12280                      _withDirectives(_createElementVNode("input", {
12281                        type: "date",
12282                        "onUpdate:modelValue": $event => ((edit.expires_at) = $event)
12283                      }, null, 8, _hoisted_51), [[_vModelText, edit.expires_at]]),
12284                      _withDirectives(_createElementVNode("input", {
12285                        "onUpdate:modelValue": $event => ((edit.action_url) = $event),
12286                        placeholder: "رابط الإجراء"
12287                      }, null, 8, _hoisted_52), [[_vModelText, edit.action_url]]),
12288                      _withDirectives(_createElementVNode("input", {
12289                        "onUpdate:modelValue": $event => ((edit.verification_note) = $event),
12290                        placeholder: "ملاحظة المراجعة"
12291                      }, null, 8, _hoisted_53), [[_vModelText, edit.verification_note]])
12292                    ]),
12293                    _createElementVNode("button", {
12294                      class: "btn loadMore",
12295                      onClick: $event => (saveEdit(a))
12296                    }, "حفظ التعديلات", 8, _hoisted_54)
12297                  ]))
12298                : _createCommentVNode("", true),
12299              _createElementVNode("section", _hoisted_55, [_cache[16] || (_cache[16] = _createElementVNode("h4", null, "المحتوى", -1)), _createElementVNode("p", null, _toDisplayString(a.body || 'لا يوجد نص.'), 1)]),
12300              (a.media&&a.media.length)
12301                ? (_openBlock(), _createElementBlock("section", _hoisted_56, [_createElementVNode("div", _hoisted_57, [_cache[17] || (_cache[17] = _createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "الوسائط"), _createElementVNode("h3", null, "المرفقات")], -1)), _createElementVNode("span", _hoisted_58, _toDisplayString(a.media.length), 1)]), _createElementVNode("div", _hoisted_59, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(a.media, (m) => {
12302                    return (_openBlock(), _createElementBlock("button", {
12303                      key: m.id,
12304                      class: "announcementMediaItem",
12305                      onClick: $event => (openAttachment(m))
12306                    }, [(!isVideo(m))
12307                      ? (_openBlock(), _createElementBlock("img", {
12308                          key: 0,
12309                          src: mediaSrc(m),
12310                          loading: "lazy",
12311                          alt: ""
12312                        }, null, 8, _hoisted_61))
12313                      : (_openBlock(), _createElementBlock("video", {
12314                          key: 1,
12315                          src: m.file_url,
12316                          controls: "",
12317                          preload: "metadata"
12318                        }, null, 8, _hoisted_62)), _createElementVNode("span", null, _toDisplayString(isPdf(m)?'PDF':(isVideo(m)?'فيديو':'صورة')), 1)], 8, _hoisted_60))
12319                  }), 128))])]))
12320                : _createCommentVNode("", true),
12321              _createElementVNode("section", _hoisted_63, [_cache[25] || (_cache[25] = _createElementVNode("div", { class: "memberSectionHead" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "النشر والتواريخ"), _createElementVNode("h3", null, "بيانات الإعلان")])], -1)), _createElementVNode("div", _hoisted_64, [
12322                _createElementVNode("div", _hoisted_65, [_cache[18] || (_cache[18] = _createElementVNode("b", null, "النوع", -1)), _createElementVNode("span", null, _toDisplayString(announcementTypeName(a.type)), 1)]),
12323                _createElementVNode("div", _hoisted_66, [_cache[19] || (_cache[19] = _createElementVNode("b", null, "الجمهور", -1)), _createElementVNode("span", null, _toDisplayString(announcementTargetName(a.target)), 1)]),
12324                _createElementVNode("div", _hoisted_67, [_cache[20] || (_cache[20] = _createElementVNode("b", null, "تاريخ النشر", -1)), _createElementVNode("span", null, _toDisplayString(shortDate(a.created_at)), 1)]),
12325                _createElementVNode("div", _hoisted_68, [_cache[21] || (_cache[21] = _createElementVNode("b", null, "الانتهاء", -1)), _createElementVNode("span", null, _toDisplayString(shortDate(a.expires_at)), 1)]),
12326                _createElementVNode("div", _hoisted_69, [_cache[22] || (_cache[22] = _createElementVNode("b", null, "آخر تحديث", -1)), _createElementVNode("span", null, _toDisplayString(shortDate(a.updated_at)), 1)]),
12327                _createElementVNode("div", _hoisted_70, [_cache[23] || (_cache[23] = _createElementVNode("b", null, "المراجعة", -1)), _createElementVNode("span", null, _toDisplayString(adminVerificationLabel(a)), 1)]),
12328                (a.verification_note)
12329                  ? (_openBlock(), _createElementBlock("div", _hoisted_71, [_cache[24] || (_cache[24] = _createElementVNode("b", null, "ملاحظة المراجعة", -1)), _createElementVNode("span", null, _toDisplayString(a.verification_note), 1)]))
12330                  : _createCommentVNode("", true)
12331              ])])
12332            ]))
12333          }), 128))]))]),
12334      _: 1
12335    }))
12336  }
12337}
12338})()
12339  };
12340
12341  const AdminSystemPage={
12342    components:{AdminFrame},
12343    setup(){
12344      const store=useGzcStore();const router=useRouter();const auditDays=ref(90);const msgDays=ref(30);
12345      const h=computed(()=>store.state.systemHealth||{});
12346      const backupItems=computed(()=>safeArray(h.value.backups&&h.value.backups.items));
12347      async function load(){if(await store.requireAdmin(router)) await store.loadSystemHealth(router);}
12348      onMounted(load);
12349      async function createBackup(){store.state.busy=true;store.state.msg='جاري إنشاء نسخة احتياطية...';const r=await api('/api/admin/backups/create',{method:'POST'});store.state.busy=false;store.state.msg=r.message||r.error||'';await load();}
12350      async function rotateLogs(){if(!confirm('تشغيل تدوير السجلات الآن؟'))return;store.state.busy=true;store.state.msg='جاري تدوير السجلات...';const r=await api('/api/admin/log-rotation/run',{method:'POST',body:JSON.stringify({audit_days:auditDays.value,message_days:msgDays.value})});store.state.busy=false;store.state.msg=r.message||r.error||'';await load();}
12351      return {store,h,backupItems,auditDays,msgDays,load,createBackup,rotateLogs,healthLabel,shortDate,fmtMB};
12352    },
12353    render:(function(){
12354const _Vue = Vue
12355const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
12356
12357const _hoisted_1 = { class: "healthGrid" }
12358const _hoisted_2 = {
12359  class: "card collapseSection formCard",
12360  open: ""
12361}
12362const _hoisted_3 = { class: "collapseBody" }
12363const _hoisted_4 = ["onClick"]
12364const _hoisted_5 = { class: "card collapseSection" }
12365const _hoisted_6 = { class: "collapseBody" }
12366const _hoisted_7 = {
12367  key: 0,
12368  class: "hint"
12369}
12370const _hoisted_8 = { class: "card collapseSection formCard" }
12371const _hoisted_9 = { class: "collapseBody" }
12372const _hoisted_10 = { class: "editGrid" }
12373const _hoisted_11 = ["onUpdate:modelValue"]
12374const _hoisted_12 = ["onUpdate:modelValue"]
12375const _hoisted_13 = ["onClick"]
12376
12377return function render(_ctx, _cache) {
12378  with (_ctx) {
12379    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, normalizeClass: _normalizeClass, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, renderList: _renderList, Fragment: _Fragment, vModelText: _vModelText, withDirectives: _withDirectives, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
12380
12381    const _component_AdminFrame = _resolveComponent("AdminFrame")
12382
12383    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "النظام والنسخ الاحتياطي" }, {
12384      default: _withCtx(() => [
12385        _cache[12] || (_cache[12] = _createElementVNode("div", { class: "card noticeCard compactNotice" }, [_createElementVNode("h3", null, "مركز النظام"), _createElementVNode("p", null, "فحص الصحة، النسخ الاحتياطي، وتدوير السجلات. هذه الصفحة للمسؤول التقني فقط.")], -1)),
12386        _createElementVNode("div", _hoisted_1, [
12387          _createElementVNode("div", { class: _normalizeClass(["card healthCard", h.overall]) }, [_cache[0] || (_cache[0] = _createElementVNode("span", null, "الحالة العامة", -1)), _createElementVNode("b", null, _toDisplayString(healthLabel(h.overall)), 1), _createElementVNode("small", null, _toDisplayString(shortDate(h.checked_at)), 1)], 2),
12388          _createElementVNode("div", { class: _normalizeClass(["card healthCard", h.db&&h.db.status]) }, [_cache[1] || (_cache[1] = _createElementVNode("span", null, "قاعدة البيانات", -1)), _createElementVNode("b", null, _toDisplayString(healthLabel(h.db&&h.db.status)), 1), _createElementVNode("small", null, _toDisplayString(h.db&&h.db.message), 1)], 2),
12389          _createElementVNode("div", { class: _normalizeClass(["card healthCard", h.whatsapp&&h.whatsapp.status]) }, [_cache[2] || (_cache[2] = _createElementVNode("span", null, "واتساب", -1)), _createElementVNode("b", null, _toDisplayString(healthLabel(h.whatsapp&&h.whatsapp.status)), 1), _createElementVNode("small", null, _toDisplayString(h.whatsapp&&h.whatsapp.enabled?'مفعل':'غير مكتمل'), 1)], 2),
12390          _createElementVNode("div", { class: _normalizeClass(["card healthCard", h.backups&&h.backups.status]) }, [_cache[3] || (_cache[3] = _createElementVNode("span", null, "النسخ الاحتياطي", -1)), _createElementVNode("b", null, _toDisplayString(healthLabel(h.backups&&h.backups.status)), 1), _createElementVNode("small", null, _toDisplayString(h.backups&&h.backups.message), 1)], 2),
12391          _createElementVNode("div", { class: _normalizeClass(["card healthCard", h.storage&&h.storage.status]) }, [_cache[4] || (_cache[4] = _createElementVNode("span", null, "التخزين", -1)), _createElementVNode("b", null, _toDisplayString(healthLabel(h.storage&&h.storage.status)), 1), _createElementVNode("small", null, _toDisplayString(h.storage&&h.storage.message), 1)], 2),
12392          _createElementVNode("div", { class: _normalizeClass(["card healthCard", h.geoip&&h.geoip.status]) }, [_cache[5] || (_cache[5] = _createElementVNode("span", null, "موقع الزائر", -1)), _createElementVNode("b", null, _toDisplayString(healthLabel(h.geoip&&h.geoip.status)), 1), _createElementVNode("small", null, _toDisplayString(h.geoip&&h.geoip.message), 1)], 2),
12393          _createElementVNode("div", { class: _normalizeClass(["card healthCard", h.pwa&&h.pwa.status]) }, [_cache[6] || (_cache[6] = _createElementVNode("span", null, "تطبيق الهاتف", -1)), _createElementVNode("b", null, _toDisplayString(healthLabel(h.pwa&&h.pwa.status)), 1), _createElementVNode("small", null, _toDisplayString(h.pwa&&h.pwa.message), 1)], 2)
12394        ]),
12395        _createElementVNode("details", _hoisted_2, [_cache[8] || (_cache[8] = _createElementVNode("summary", null, [_createElementVNode("b", null, "نسخة احتياطية يدوية"), _createElementVNode("span")], -1)), _createElementVNode("div", _hoisted_3, [_cache[7] || (_cache[7] = _createElementVNode("p", { class: "hint" }, "تشغيل pg_dump وتسجيل العملية في Audit Log.", -1)), _createElementVNode("button", {
12396          class: "btn loadMore",
12397          onClick: createBackup
12398        }, "إنشاء نسخة احتياطية الآن", 8, _hoisted_4)])]),
12399        _createElementVNode("details", _hoisted_5, [_cache[9] || (_cache[9] = _createElementVNode("summary", null, [_createElementVNode("b", null, "آخر النسخ الاحتياطية"), _createElementVNode("span")], -1)), _createElementVNode("div", _hoisted_6, [(!backupItems.length)
12400          ? (_openBlock(), _createElementBlock("div", _hoisted_7, "لا توجد نسخ مسجلة."))
12401          : _createCommentVNode("", true), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(backupItems, (b) => {
12402          return (_openBlock(), _createElementBlock("div", {
12403            class: "backupRow",
12404            key: b.id
12405          }, [_createElementVNode("span", null, _toDisplayString(b.file_name||'-'), 1), _createElementVNode("b", null, _toDisplayString(b.status), 1), _createElementVNode("small", null, _toDisplayString(fmtMB((b.file_size||0)/1024/1024)) + " — " + _toDisplayString(shortDate(b.created_at)), 1)]))
12406        }), 128))])]),
12407        _createElementVNode("details", _hoisted_8, [_cache[11] || (_cache[11] = _createElementVNode("summary", null, [_createElementVNode("b", null, "تدوير السجلات"), _createElementVNode("span")], -1)), _createElementVNode("div", _hoisted_9, [_cache[10] || (_cache[10] = _createElementVNode("p", { class: "hint" }, "حذف Audit Logs القديمة وMessage Logs القديمة حسب عدد الأيام. لا تشغلها إلا عند الحاجة.", -1)), _createElementVNode("div", _hoisted_10, [_withDirectives(_createElementVNode("input", {
12408          type: "number",
12409          min: "30",
12410          "onUpdate:modelValue": $event => ((auditDays) = $event),
12411          placeholder: "Audit أيام"
12412        }, null, 8, _hoisted_11), [[_vModelText, auditDays]]), _withDirectives(_createElementVNode("input", {
12413          type: "number",
12414          min: "7",
12415          "onUpdate:modelValue": $event => ((msgDays) = $event),
12416          placeholder: "رسائل أيام"
12417        }, null, 8, _hoisted_12), [[_vModelText, msgDays]])]), _createElementVNode("button", {
12418          class: "btn dangerBtn",
12419          onClick: rotateLogs
12420        }, "تشغيل تدوير السجلات", 8, _hoisted_13)])])
12421      ]),
12422      _: 1,
12423      __: [12]
12424    }))
12425  }
12426}
12427})()
12428  };
12429
12430
12431  const AdminSeoPage={
12432    components:{AdminFrame},
12433    setup(){
12434      const store=useGzcStore();const router=useRouter();
12435      const form=reactive({site_title:'',organization_name:'',public_base_url:'https://smt.smtd.ai',site_description:'',default_keywords:'',default_og_image:'',google_analytics_id:'',search_console_code:'',enable_indexing:'false',pages:[]});
12436      const robots=computed(()=>store.state.seo&&store.state.seo.robots||'');
12437      const sitemap=computed(()=>store.state.seo&&store.state.seo.sitemap_preview||'');
12438      const coverage=computed(()=>store.state.seo&&store.state.seo.coverage||{static:0,communities:0,china_guide:0,trade_shipping:0,events:0,total:0});
12439      const indexingEnabled=computed(()=>!!(store.state.seo&&store.state.seo.indexing_enabled));
12440      const linking=computed(()=>store.state.seo&&store.state.seo.linking||{model_version:1,summary:{pages:0,links:0,orphan_pages:0,weak_pages:0,healthy_pages:0,average_inbound:0},opportunities:[],context_cross_links:0});
12441      const linkingSummary=computed(()=>linking.value.summary||{});
12442      const linkingOpportunities=computed(()=>safeArray(linking.value.opportunities));
12443      const searchPerf=ref({connected:false,configured:false,summary:{pages:0,clicks:0,impressions:0,ctr_pct:0,average_position:0},pages:[],opportunities:[]});
12444      const searchPerfLoading=ref(false);
12445      const searchPerfSummary=computed(()=>searchPerf.value&&searchPerf.value.summary||{});
12446      const searchPerfPages=computed(()=>safeArray(searchPerf.value&&searchPerf.value.pages));
12447      const searchPerfOpportunities=computed(()=>safeArray(searchPerf.value&&searchPerf.value.opportunities));
12448      const searchPerfPriorities=computed(()=>safeArray(searchPerf.value&&searchPerf.value.growth_priorities));
12449      const searchPerfMovers=computed(()=>searchPerf.value&&searchPerf.value.top_movers||{clicks_up:[],clicks_down:[],position_up:[],position_down:[]});
12450      const searchPerfCache=computed(()=>searchPerf.value&&searchPerf.value.cache||{});
12451      const searchConsoleStatus=computed(()=>store.state.seo&&store.state.seo.search_console_status||{});
12452      const pages=computed(()=>form.pages||[]);
12453      function sync(){const seo=(store.state.seo&&store.state.seo.seo)||{};Object.assign(form,seo);form.pages=Array.isArray(seo.pages)?seo.pages:[];if(!form.public_base_url)form.public_base_url='https://smt.smtd.ai';if(form.enable_indexing!== 'true')form.enable_indexing='false';}
12454      function perfTypeLabel(v){return ({low_ctr:'CTR منخفض',near_page_one:'قريبة من الصفحة الأولى',weak_internal_links:'ربط داخلي ضعيف',click_decline:'انخفاض النقرات'}[String(v||'')])||'فرصة تحسين';}
12455      function changeLabel(v,suffix='%'){const n=Number(v);if(!Number.isFinite(n))return '—';return `${n>0?'+':''}${n}${suffix}`;}
12456      function priorityLabel(v){return ({high:'عالية',medium:'متوسطة',low:'منخفضة'}[String(v||'')])||'متوسطة';}
12457      async function loadSearchPerformance(force=false){searchPerfLoading.value=true;try{const r=await api('/api/admin/seo/search-performance'+(force?'?refresh=1':''));if(r&&r.status===401){router.replace('/admin/login');return;}searchPerf.value=(r&&r.search_performance)||{connected:false,configured:false,summary:{},pages:[],opportunities:[]};}finally{searchPerfLoading.value=false;}}
12458      async function load(){if(await store.requireAdmin(router)){await store.loadSeo(router);sync();loadSearchPerformance(false);}}
12459      async function refreshSearchPerformance(){await loadSearchPerformance(true);}
12460      function addPage(){form.pages.push({path:'/',title:'',description:'',indexable:true});}
12461      function removePage(i){form.pages.splice(i,1);}
12462      async function save(){const payload=Object.assign({},form,{pages:form.pages});await store.saveSeo(payload,router);sync();}
12463      onMounted(load);
12464      return{store,form,pages,robots,sitemap,coverage,indexingEnabled,linking,linkingSummary,linkingOpportunities,searchPerf,searchPerfLoading,searchPerfSummary,searchPerfPages,searchPerfOpportunities,searchPerfPriorities,searchPerfMovers,searchPerfCache,searchConsoleStatus,perfTypeLabel,changeLabel,priorityLabel,shortDate,refreshSearchPerformance,load,save,addPage,removePage};
12465    },
12466    render:(function(){
12467const _Vue = Vue
12468const { createVNode: _createVNode, createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
12469
12470const _hoisted_1 = { class: "card dashboardHeaderCard" }
12471const _hoisted_2 = ["onClick"]
12472const _hoisted_3 = { class: "card" }
12473const _hoisted_4 = { class: "memberCardTop" }
12474const _hoisted_5 = { class: "statsGrid compactStats" }
12475const _hoisted_6 = { class: "card seoLinkingCard" }
12476const _hoisted_7 = { class: "memberCardTop" }
12477const _hoisted_8 = { class: "statsGrid compactStats" }
12478const _hoisted_9 = {
12479  key: 0,
12480  class: "seoLinkingOpportunities"
12481}
12482const _hoisted_10 = {
12483  key: 1,
12484  class: "hint"
12485}
12486const _hoisted_11 = { class: "card seoSearchPerformanceCard" }
12487const _hoisted_12 = { class: "memberCardTop" }
12488const _hoisted_13 = { class: "row" }
12489const _hoisted_14 = ["disabled", "onClick"]
12490const _hoisted_15 = {
12491  key: 0,
12492  class: "emptyState compactEmpty"
12493}
12494const _hoisted_16 = { class: "seoLiveMeta" }
12495const _hoisted_17 = { key: 0 }
12496const _hoisted_18 = {
12497  key: 1,
12498  class: "statusWarn"
12499}
12500const _hoisted_19 = { class: "statsGrid compactStats seoPerformanceStats" }
12501const _hoisted_20 = {
12502  key: 0,
12503  class: "seoGrowthPriorityBlock"
12504}
12505const _hoisted_21 = { class: "seoPriorityScore" }
12506const _hoisted_22 = { class: "seoPriorityBody" }
12507const _hoisted_23 = { class: "row seoPriorityHeadline" }
12508const _hoisted_24 = { class: "statusPill" }
12509const _hoisted_25 = { class: "hint compactHint" }
12510const _hoisted_26 = {
12511  key: 1,
12512  class: "seoLinkingOpportunities"
12513}
12514const _hoisted_27 = { class: "hint compactHint" }
12515const _hoisted_28 = {
12516  key: 2,
12517  class: "hint"
12518}
12519const _hoisted_29 = {
12520  key: 3,
12521  class: "collapseSection compactCollapse"
12522}
12523const _hoisted_30 = { class: "collapseBody seoMoversGrid" }
12524const _hoisted_31 = {
12525  key: 4,
12526  class: "collapseSection compactCollapse"
12527}
12528const _hoisted_32 = { class: "collapseBody" }
12529const _hoisted_33 = { class: "card formCard" }
12530const _hoisted_34 = { class: "editGrid" }
12531const _hoisted_35 = ["onUpdate:modelValue"]
12532const _hoisted_36 = ["onUpdate:modelValue"]
12533const _hoisted_37 = ["onUpdate:modelValue"]
12534const _hoisted_38 = ["onUpdate:modelValue"]
12535const _hoisted_39 = ["onUpdate:modelValue"]
12536const _hoisted_40 = ["onUpdate:modelValue"]
12537const _hoisted_41 = ["onUpdate:modelValue"]
12538const _hoisted_42 = ["onUpdate:modelValue"]
12539const _hoisted_43 = ["onUpdate:modelValue"]
12540const _hoisted_44 = ["onClick"]
12541const _hoisted_45 = { class: "card" }
12542const _hoisted_46 = { class: "memberCardTop" }
12543const _hoisted_47 = ["onClick"]
12544const _hoisted_48 = { class: "editGrid" }
12545const _hoisted_49 = ["onUpdate:modelValue"]
12546const _hoisted_50 = ["onUpdate:modelValue"]
12547const _hoisted_51 = ["onUpdate:modelValue"]
12548const _hoisted_52 = { class: "check" }
12549const _hoisted_53 = ["onUpdate:modelValue"]
12550const _hoisted_54 = ["onClick"]
12551const _hoisted_55 = { class: "card collapseSection" }
12552const _hoisted_56 = { class: "collapseBody" }
12553const _hoisted_57 = { class: "logBox" }
12554const _hoisted_58 = { class: "card collapseSection" }
12555const _hoisted_59 = { class: "collapseBody" }
12556const _hoisted_60 = { class: "logBox" }
12557
12558return function render(_ctx, _cache) {
12559  with (_ctx) {
12560    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, normalizeClass: _normalizeClass, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, createTextVNode: _createTextVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, createVNode: _createVNode, createCommentVNode: _createCommentVNode, vModelText: _vModelText, withDirectives: _withDirectives, vModelSelect: _vModelSelect, vModelCheckbox: _vModelCheckbox, createBlock: _createBlock } = _Vue
12561
12562    const _component_router_link = _resolveComponent("router-link")
12563    const _component_AdminFrame = _resolveComponent("AdminFrame")
12564
12565    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "الظهور في محركات البحث" }, {
12566      default: _withCtx(() => [
12567        _createElementVNode("section", _hoisted_1, [_cache[0] || (_cache[0] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "SEO"), _createElementVNode("h3", null, "الظهور في محركات البحث"), _createElementVNode("p", { class: "hint" }, "إدارة فهرسة الصفحات العامة فقط. صفحات الأعضاء والحسابات والطوارئ والطلبات ولوحة الإدارة تبقى خارج محركات البحث.")], -1)), _createElementVNode("button", {
12568          class: "smallbtn",
12569          onClick: load
12570        }, "تحديث", 8, _hoisted_2)]),
12571        _createElementVNode("section", _hoisted_3, [_createElementVNode("div", _hoisted_4, [_cache[1] || (_cache[1] = _createElementVNode("h3", null, "SEO Coverage — تغطية الفهرسة", -1)), _createElementVNode("b", { class: _normalizeClass(indexingEnabled?'statusOk':'statusWarn') }, _toDisplayString(indexingEnabled?'الفهرسة مفعّلة':'الفهرسة متوقفة'), 3)]), _createElementVNode("div", _hoisted_5, [
12572          _createElementVNode("div", null, [_cache[2] || (_cache[2] = _createElementVNode("span", null, "إجمالي الروابط", -1)), _createElementVNode("b", null, _toDisplayString(coverage.total), 1)]),
12573          _createElementVNode("div", null, [_cache[3] || (_cache[3] = _createElementVNode("span", null, "صفحات أساسية", -1)), _createElementVNode("b", null, _toDisplayString(coverage.static), 1
12573)]),
12574          _createElementVNode("div", null, [_cache[4] || (_cache[4] = _createElementVNode("span", null, "الجاليات", -1)), _createElementVNode("b", null, _toDisplayString(coverage.communities), 1)]),
12575          _createElementVNode("div", null, [_cache[5] || (_cache[5] = _createElementVNode("span", null, "دليلك في الصين", -1)), _createElementVNode("b", null, _toDisplayString(coverage.china_guide), 1)]),
12576          _createElementVNode("div", null, [_cache[6] || (_cache[6] = _createElementVNode("span", null, "التجارة والشحن", -1)), _createElementVNode("b", null, _toDisplayString(coverage.trade_shipping), 1)]),
12577          _createElementVNode("div", null, [_cache[7] || (_cache[7] = _createElementVNode("span", null, "الفعاليات", -1)), _createElementVNode("b", null, _toDisplayString(coverage.events), 1)]),
12578          _createElementVNode("div", null, [_cache[8] || (_cache[8] = _createElementVNode("span", null, "صفحات المدن", -1)), _createElementVNode("b", null, _toDisplayString(coverage.guide_city||0), 1)]),
12579          _createElementVNode("div", null, [_cache[9] || (_cache[9] = _createElementVNode("span", null, "مواضيع دليل الصين", -1)), _createElementVNode("b", null, _toDisplayString(coverage.guide_topic||0), 1)]),
12580          _createElementVNode("div", null, [_cache[10] || (_cache[10] = _createElementVNode("span", null, "مواضيع التجارة والشحن", -1)), _createElementVNode("b", null, _toDisplayString(coverage.trade_topic||0), 1)])
12581        ])]),
12582        _createElementVNode("section", _hoisted_6, [_createElementVNode("div", _hoisted_7, [_cache[11] || (_cache[11] = _createElementVNode("div", null, [_createElementVNode("h3", null, "الربط الداخلي"), _createElementVNode("p", { class: "hint compactHint" }, "خريطة مشتقة من الصفحات العامة الموثقة فقط، لتحديد الصفحات التي تحتاج روابط داخلية أوضح.")], -1)), _createElementVNode("b", { class: _normalizeClass(linkingSummary.orphan_pages?'statusWarn':'statusOk') }, _toDisplayString(linkingSummary.orphan_pages?linkingSummary.orphan_pages+' بلا روابط':'التغطية مترابطة'), 3)]), _createElementVNode("div", _hoisted_8, [
12583          _createElementVNode("div", null, [_cache[12] || (_cache[12] = _createElementVNode("span", null, "صفحات الشبكة", -1)), _createElementVNode("b", null, _toDisplayString(linkingSummary.pages||0), 1)]),
12584          _createElementVNode("div", null, [_cache[13] || (_cache[13] = _createElementVNode("span", null, "روابط داخلية", -1)), _createElementVNode("b", null, _toDisplayString(linkingSummary.links||0), 1)]),
12585          _createElementVNode("div", null, [_cache[14] || (_cache[14] = _createElementVNode("span", null, "بلا روابط", -1)), _createElementVNode("b", null, _toDisplayString(linkingSummary.orphan_pages||0), 1)]),
12586          _createElementVNode("div", null, [_cache[15] || (_cache[15] = _createElementVNode("span", null, "ضعيفة الربط", -1)), _createElementVNode("b", null, _toDisplayString(linkingSummary.weak_pages||0), 1)]),
12587          _createElementVNode("div", null, [_cache[16] || (_cache[16] = _createElementVNode("span", null, "سليمة", -1)), _createElementVNode("b", null, _toDisplayString(linkingSummary.healthy_pages||0), 1)]),
12588          _createElementVNode("div", null, [_cache[17] || (_cache[17] = _createElementVNode("span", null, "متوسط الروابط الداخلة", -1)), _createElementVNode("b", null, _toDisplayString(linkingSummary.average_inbound||0), 1)])
12589        ]), (linkingOpportunities.length)
12590          ? (_openBlock(), _createElementBlock("div", _hoisted_9, [_cache[19] || (_cache[19] = _createElementVNode("h4", null, "صفحات تحتاج تقوية الربط", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(linkingOpportunities.slice(0,8), (o) => {
12591              return (_openBlock(), _createElementBlock("article", {
12592                key: o.path,
12593                class: "miniCard seoLinkingOpportunity"
12594              }, [_createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(o.title_ar||o.path), 1
12594), _createElementVNode("small", null, _toDisplayString(o.label) + " · " + _toDisplayString(o.inbound_links) + " رابط داخل", 1), _createElementVNode("p", null, _toDisplayString(o.reason), 1)]), _createVNode(_component_router_link, {
12595                to: o.path,
12596                class: "smallbtn secondary"
12597              }, {
12598                default: _withCtx(() => _cache[18] || (_cache[18] = [_createTextVNode("فتح الصفحة")])),
12599                _: 2,
12600                __: [18]
12601              }, 1032, ["to"])]))
12602            }), 128))]))
12603          : (_openBlock(), _createElementBlock("p", _hoisted_10, "لا توجد حالياً صفحات عامة ضعيفة الربط ضمن دليل الصين والتجارة والشحن."))]),
12604        _createElementVNode("section", _hoisted_11, [_createElementVNode("div", _hoisted_12, [_cache[20] || (_cache[20] = _createElementVNode("div", null, [_createElementVNode("h3", null, "أداء الظهور في Google"), _createElementVNode("p", { class: "hint compactHint" }, "قراءة إدارية فقط لبيانات الصفحات من Search Console: نقرات، ظهور، CTR ومتوسط الترتيب. لا يتم جلب أو تخزين عبارات البحث الخام.")], -1)), _createElementVNode("div", _hoisted_13, [_createElementVNode("b", { class: _normalizeClass(searchPerf.connected?(searchPerf.stale?'statusWarn':'statusOk'):'statusWarn') }, _toDisplayString(searchPerf.connected?(searchPerf.stale?'آخر بيانات متاحة':'متصل حي'):(searchPerf.configured?'تعذر الاتصال':'غير متصل')), 3), _createElementVNode("button", {
12605          class: "smallbtn",
12606          disabled: searchPerfLoading,
12607          onClick: refreshSearchPerformance
12608        }, _toDisplayString(searchPerfLoading?'جاري التحديث...':'تحديث البيانات'), 9, _hoisted_14)])]), (!searchPerf.connected)
12609          ? (_openBlock(), _createElementBlock("div", _hoisted_15, [_
12609createElementVNode("b", null, _toDisplayString(searchPerf.configured?'تعذر جلب بيانات Search Console حالياً':'Search Console API غير مربوط بعد'), 1), _createElementVNode("p", null, _toDisplayString(searchPerf.configured?'SEO الحالي يعمل بشكل طبيعي، ويمكن إعادة المحاولة لاحقاً.':'يحتاج حساب خدمة Search Console مضبوطاً على الخادم. المفاتيح لا تُحفظ داخل المنصة.'), 1)]))
12610          : (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [
12611              _createElementVNode("div", _hoisted_16, [
12612                _createElementVNode("span", null, [_cache[21] || (_cache[21] = _createTextVNode("آخر جلب: ")), _createElementVNode("b", null, _toDisplayString(shortDate(searchPerf.fetched_at)), 1)]),
12613                _createElementVNode("span", null, [_cache[22] || (_cache[22] = _createTextVNode("البيانات حتى: ")), _createElementVNode("b", null, _toDisplayString(searchPerf.data_through||'—'), 1)]),
12614                (searchPerfCache.hit)
12615                  ? (_openBlock(), _createElementBlock("span", _hoisted_17, "من الذاكرة المؤقتة · " + _toDisplayString(searchPerfCache.age_seconds||0) + "ث", 1))
12616                  : _createCommentVNode("", true),
12617                (searchPerf.stale)
12618                  ? (_openBlock(), _createElementBlock("span", _hoisted_18, "تعذر التحديث الحي؛ نعرض آخر snapshot آمن"))
12619                  : _createCommentVNode("", true)
12620              ]),
12621              _createElementVNode("div", _hoisted_19, [
12622                _createElementVNode("div", null, [_cache[23] || (_cache[23] = _createElementVNode("span", null, "النقرات", -1)), _createElementVNode("b", null, _toDisplayString(searchPerfSummary.clicks||0), 1), _createElementVNode("small", null, _toDisplayString(changeLabel(searchPerfSummary.clicks_change_pct)) + " عن الفترة السابقة", 1)]),
12623                _createElementVNode("div", null, [_cache[24] || (_cache[24] = _createElementVNode("span", null, "مرات الظهور", -1)), _createElementVNode("b", null, _toDisplayString(searchPerfSummary.impressions||0), 1), _createElementVNode("small", null, _toDisplayString(changeLabel(searchPerfSummary.impressions_change_pct)) + " عن الفترة السابقة", 1)]),
12624                _createElementVNode("div", null, [_cache[25] || (_cache[25] = _createElementVNode("span", null, "CTR", -1)), _createElementVNode("b", null, _toDisplayString(searchPerfSummary.ctr_pct||0) + "%", 1), _createElementVNode("small", null, _toDisplayString(changeLabel(searchPerfSummary.ctr_change_points,' نقطة')), 1)]),
12625                _createElementVNode("div", null, [_cache[26] || (_cache[26] = _createElementVNode("span", null, "متوسط الترتيب", -1)), _createElementVNode("b", null, _toDisplayString(searchPerfSummary.average_position||0), 1), _createElementVNode("small", null, _toDisplayString(changeLabel(searchPerfSummary.position_change,' مركز')), 1)]),
12626                _createElementVNode("div", null, [_cache[27] || (_cache[27] = _createElementVNode("span", null, "الصفحات المقاسة", -1)), _createElementVNode("b", null, _toDisplayString(searchPerfSummary.pages||0), 1)]),
12627                _createElementVNode("div", null, [_cache[28] || (_cache[28] = _createElementVNode("span", null, "أولويات النمو", -1)), _createElementVNode("b", null, _toDisplayString(searchPerfPriorities.length), 1)])
12628              ]),
12629              (searchPerfPriorities.length)
12630                ? (_openBlock(), _createElementBlock("div", _hoisted_20, [_cache[32] || (_cache[32] = _createElementVNode("div", { class: "memberCardTop" }, [_createElementVNode("div", null, [_createElementVNode("h4", null, "أولوية النمو الآن"), _createElementVNode("p", { class: "hint compactHint" }, "ترتيب مركب من الظهور وCTR والترتيب وتراجع النقرات وقوة الربط الداخلي.")]), _createElementVNode("span", { class: "vueBadge" }, "Live Data")], -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(searchPerfPriorities.slice(0,6), (o) => {
12631                    return (_openBlock(), _createElementBlock("article", {
12632                      key: 'priority:'+o.path,
12633                      class: "miniCard seoGrowthPriorityRow"
12634                    }, [_createElementVNode("div", _hoisted_21, [_createElementVNode("b", null, _toDisplayString(o.score), 1), _cache[29] || (_cache[29] = _createElementVNode("small", null, "/100", -1))]), _createElementVNode("div", _hoisted_22, [
12635                      _createElementVNode("div", _hoisted_23, [_createElementVNode("b", null, _toDisplayString(o.path), 1
12635), _createElementVNode("span", _hoisted_24, _toDisplayString(priorityLabel(o.priority)), 1)]),
12636                      _createElementVNode("small", null, _toDisplayString(o.impressions) + " ظهور · " + _toDisplayString(o.clicks) + " نقرة · CTR " + _toDisplayString(o.ctr_pct) + "% · ترتيب " + _toDisplayString(o.position), 1),
12637                      _createElementVNode("p", null, _toDisplayString(o.reason), 1),
12638                      _createElementVNode("p", _hoisted_25, [_cache[30] || (_cache[30] = _createElementVNode("b", null, "الإجراء:", -1)), _createTextVNode(" " + _toDisplayString(o.action), 1)])
12639                    ]), _createVNode(_component_router_link, {
12640                      to: o.path,
12641                      class: "smallbtn secondary"
12642                    }, {
12643                      default: _withCtx(() => _cache[31] || (_cache[31] = [_createTextVNode("فتح")])),
12644                      _: 2,
12645                      __: [31]
12646                    }, 1032, ["to"])]))
12647                  }), 128))]))
12648                : _createCommentVNode("", true),
12649              (searchPerfOpportunities.length)
12650                ? (_openBlock(), _createElementBlock("div", _hoisted_26, [_cache[34] || (_cache[34] = _createElementVNode("h4", null, "تفاصيل فرص التحسين", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(searchPerfOpportunities.slice(0,8), (o) => {
12651                    return (_openBlock(), _createElementBlock("article", {
12652                      key: o.path+':'+o.type,
12653                      class: "miniCard seoLinkingOpportunity"
12654                    }, [_createElementVNode("div", null, [
12655                      _createElementVNode("b", null, _toDisplayString(perfTypeLabel(o.type)), 1),
12656                      _createElementVNode("small", null, _toDisplayString(o.path) + " · " + _toDisplayString(o.impressions) + " ظهور · ترتيب " + _toDisplayString(o.position), 1),
12657                      _createElementVNode("p", null, _toDisplayString(o.reason), 1),
12658                      _createElementVNode("p", _hoisted_27, _toDisplayString(o.action), 1)
12659                    ]), _createVNode(_component_router_link, {
12660                      to: o.path,
12661                      class: "smallbtn secondary"
12662                    }, {
12663                      default: _withCtx(() => _cache[33] || (_cache[33] = [_createTextVNode("فتح الصفحة")])),
12664                      _: 2,
12665                      __: [33]
12666                    }, 1032, ["to"])]))
12667                  }), 128))]))
12668                : (_openBlock(), _createElementBlock("p", _hoisted_28, "لا توجد فرص واضحة ضمن البيانات الحالية.")),
12669              (searchPerfMovers.clicks_up&&searchPerfMovers.clicks_up.length)
12670                ? (_openBlock(), _createElementBlock("details", _hoisted_29, [_cache[37] || (_cache[37] = _createElementVNode("summary", null, [_createElementVNode("b", null, "أكبر التحركات"), _createElementVNode("span", null, "28 يوم مقابل 28 يوم")], -1)), _createElementVNode("div", _hoisted_30, [_createElementVNode("div", null, [_cache[35] || (_cache[35] = _createElementVNode("h4", null, "صعود النقرات", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(searchPerfMovers.clicks_up, (p) => {
12671                    return (_openBlock(), _createElementBlock("article", {
12672                      key: 'up:'+p.path,
12673                      class: "miniCard"
12674                    }, [_createElementVNode("b", null, _toDisplayString(p.path), 1), _createElementVNode("small", null, _toDisplayString(changeLabel(p.clicks_change_pct)) + " · " + _toDisplayString(p.clicks) + " نقرة", 1)]))
12675                  }), 128))]), _createElementVNode("div", null, [_cache[36] || (_cache[36] = _createElementVNode("h4", null, "تراجع النقرات", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(searchPerfMovers.clicks_down, (p) => {
12676                    return (_openBlock(), _createElementBlock("article", {
12677                      key: 'down:'+p.path,
12678                      class: "miniCard"
12679                    }
12679, [_createElementVNode("b", null, _toDisplayString(p.path), 1), _createElementVNode("small", null, _toDisplayString(changeLabel(p.clicks_change_pct)) + " · " + _toDisplayString(p.clicks) + " نقرة", 1)]))
12680                  }), 128))])])]))
12681                : _createCommentVNode("", true),
12682              (searchPerfPages.length)
12683                ? (_openBlock(), _createElementBlock("details", _hoisted_31, [_createElementVNode("summary", null, [_cache[38] || (_cache[38] = _createElementVNode("b", null, "أفضل الصفحات حسب الظهور", -1)), _createElementVNode("span", null, _toDisplayString(searchPerfPages.length), 1)]), _createElementVNode("div", _hoisted_32, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(searchPerfPages.slice(0,12), (p) => {
12684                    return (_openBlock(), _createElementBlock("article", {
12685                      key: p.path,
12686                      class: "miniCard seoPerfPageRow"
12687                    }, [_createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(p.path), 1), _createElementVNode("small", null, _toDisplayString(p.impressions) + " ظهور · " + _toDisplayString(p.clicks) + " نقرة · CTR " + _toDisplayString(p.ctr_pct) + "% · ترتيب " + _toDisplayString(p.position), 1)]), _createVNode(_component_router_link, {
12688                      to: p.path,
12689                      class: "smallbtn secondary"
12690                    }, {
12691                      default: _withCtx(() => _cache[39] || (_cache[39] = [_createTextVNode("فتح")])),
12692                      _: 2,
12693                      __: [39]
12694                    }, 1032, ["to"])]))
12695                  }), 128))])]))
12696                : _createCommentVNode("", true)
12697            ], 64))]),
12698        _createElementVNode("section", _hoisted_33, [
12699          _cache[50] || (_cache[50] = _createElementVNode("h3", null, "الإعدادات الرئيسية", -1)),
12700          _createElementVNode("div", _hoisted_34, [
12701            _createElementVNode("label", null, [_cache[40] || (_cache[40] = _createTextVNode("عنوان الموقع")), _withDirectives(_createElementVNode("input", { "onUpdate:modelValue": $event => ((form.site_title) = $event) }, null, 8, _hoisted_35), [[_vModelText, form.site_title]])]),
12702            _createElementVNode("label", null, [_cache[41] || (_cache[41] = _createTextVNode("الجهة المشغلة")), _withDirectives(_createElementVNode("input", { "onUpdate:modelValue": $event => ((form.organization_name) = $event) }, null, 8, _hoisted_36), [[_vModelText, form.organization_name]])]),
12703            _createElementVNode("label", null, [_cache[42] || (_cache[42] = _createTextVNode("الرابط العام")), _withDirectives(_createElementVNode("input", { "onUpdate:modelValue": $event => ((form.public_base_url) = $event) }, null, 8, _hoisted_37), [[_vModelText, form.public_base_url]])]),
12704            _createElementVNode("label", null, [_cache[43] || (_cache[43] = _createTextVNode("صورة المشاركة الافتراضية")), _withDirectives(_createElementVNode("input", { "onUpdate:modelValue": $event => ((form.default_og_image) = $event) }, null, 8, _hoisted_38), [[_vModelText, form.default_og_image]])]),
12705            _createElementVNode("label", null, [_cache[44] || (_cache[44] = _createTextVNode("Google Analytics ID")), _withDirectives(_createElementVNode("input", {
12706              "onUpdate:modelValue": $event => ((form.google_analytics_id) = $event),
12707              placeholder: "اختياري"
12708            }, null, 8, _hoisted_39), [[_vModelText, form.google_analytics_id]])]),
12709            _createElementVNode("label", null, [_cache[45] || (_cache[45] = _createTextVNode("Google Search Console")), _withDirectives(_createElementVNode("input", {
12710              "onUpdate:modelValue": $event => ((form.search_console_code) = $event),
12711              placeholder: "رمز التحقق"
12712            }, null, 8, _hoisted_40), [[_vModelText, form.search_console_code]])])
12713          ]),
12714          _createElementVNode("label", null, [_cache[46] || (_cache[46] = _createTextVNode("وصف الموقع")), _withDirectives(_createElementVNode("textarea", { "onUpdate:modelValue": $event => ((form.site_description) = $event) }, null, 8, _hoisted_41), [[_vModelText, form.site_description]])]),
12715          _createElementVNode("label", null, [_cache[47] || (_cache[47] = _createTextVNode("كلمات مرجعية داخلية")), _withDirectives(_createElementVNode("textarea", { "onUpdate:modelValue": $event => ((form.default_keywords) = $event) }, null, 8, _hoisted_42), [[_vModelText, form.default_keywords]])]),
12716          _createElementVNode("label", null, [_cache[49] || (_cache[49] = _createTextVNode("الفهرسة")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((form.enable_indexing) = $event) }, _cache[48] || (_cache[48] = [_createElementVNode("option", { value: "false" }, "إيقاف الفهرسة العامة", -1), _createElementVNode("option", { value: "true" }, "تفعيل الفهرسة العامة", -1)]), 8, _hoisted_43), [[_vModelSelect, form.enable_indexing]])]),
12717          _cache[51] || (_cache[51] = _createElementVNode("p", { class: "hint" }, "الكلمات المرجعية لا تُرسل كـ meta keywords؛ تستخدم فقط كمرجع تحريري. خريطة الموقع تشمل المحتوى المنشور والموثق تلقائياً.", -1)),
12718          _createElementVNode("button", {
12719            class: "btn loadMore",
12720            onClick: save
12721          }, "حفظ إعدادات الظهور", 8, _hoisted_44)
12722        ]),
12723        _createElementVNode("section", _hoisted_45, [_createElementVNode("div", _hoisted_46, [_cache[52] || (_cache[52] = _createElementVNode("h3", null, "الصفحات الأساسية", -1)), _createElementVNode("button", {
12724          class: "smallbtn",
12725          onClick: addPage
12726        }, "+ إضافة صفحة", 8, _hoisted_47)]), _cache[54] || (_cache[54] = _createElementVNode("p", { class: "hint" }, "العناصر المنشورة في الدليل والتجارة وبوابة السودان والفعاليات والجاليات تُضاف تلقائياً إلى sitemap ولا تحتاج إدخالاً يدوياً هنا.", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(pages, (p, i) => {
12727          return (_openBlock(), _createElementBlock("div", {
12728            class: "miniCard seoPageRow",
12729            key: i
12730          }, [
12731            _createElementVNode("div", _hoisted_48, [_withDirectives(_createElementVNode("input", {
12732              "onUpdate:modelValue": $event => ((p.path) = $event),
12733              placeholder: "/about"
12734            }, null, 8, _hoisted_49), [[_vModelText, p.path]]), _withDirectives(_createElementVNode("input", {
12735              "onUpdate:modelValue": $event => ((p.title) = $event),
12736              placeholder: "عنوان محرك البحث"
12737            }, null, 8, _hoisted_50), [[_vModelText, p.title]])]),
12738            _withDirectives(_createElementVNode("textarea", {
12739              "onUpdate:modelValue": $event => ((p.description) = $event),
12740              placeholder: "وصف مختصر للصفحة"
12741            }, null, 8, _hoisted_51), [[_vModelText, p.description]]),
12742            _createElementVNode("label", _hoisted_52, [_withDirectives(_createElementVNode("input", {
12743              type: "checkbox",
12744              "onUpdate:modelValue": $event => ((p.indexable) = $event)
12745            }, null, 8, _hoisted_53), [[_vModelCheckbox, p.indexable]]), _cache[53] || (_cache[53] = _createTextVNode(" فهرسة"))]),
12746            _createElementVNode("button", {
12747              class: "smallbtn dangerBtn",
12748              onClick: $event => (removePage(i))
12749            }, "حذف", 8, _hoisted_54)
12750          ]))
12751        }), 128))]),
12752        _createElementVNode("details", _hoisted_55, [_cache[55] || (_cache[55] = _createElementVNode("summary", null, [_createElementVNode("b", null, "robots.txt"), _createElementVNode("span")], -1)), _createElementVNode("div", _hoisted_56, [_createElementVNode("pre", _hoisted_57, _toDisplayString(robots), 1)])]),
12753        _createElementVNode("details", _hoisted_58, [_createElementVNode("summary", null, [_cache[56] || (_cache[56] = _createElementVNode("b", null, "معاينة sitemap.xml", -1)), _createElementVNode("span", null, _toDisplayString(coverage.total) + " رابط", 1)]), _createElementVNode("div", _hoisted_59, [_createElementVNode("pre", _hoisted_60, _toDisplayString(sitemap), 1)])])
12754      ]),
12755      _: 1
12756    }))
12757  }
12758}
12759})()
12760  };
12761
12762
12763  const AdminHealthPage={
12764    components:{AdminFrame},
12765    setup(){const store=useGzcStore();const router=useRouter();const h=computed(()=>store.state.systemHealth||{});async function load(){if(await store.requireAdmin(router)) await store.loadSystemHealth(router);}onMounted(load);return{store,h,load,healthLabel,shortDate};},
12766    render:(function(){
12767const _Vue = Vue
12768const { createElementVNode: _createElementVNode } = _Vue
12769
12770const _hoisted_1 = { class: "card dashboardHeaderCard" }
12771const _hoisted_2 = ["onClick"]
12772const _hoisted_3 = { class: "healthGrid" }
12773
12774return function render(_ctx, _cache) {
12775  with (_ctx) {
12776    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, normalizeClass: _normalizeClass, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = _Vue
12777
12778    const _component_AdminFrame = _resolveComponent("AdminFrame")
12779
12780    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "حالة النظام" }, {
12781      default: _withCtx(() => [_createElementVNode("section", _hoisted_1, [_cache[0] || (_cache[0] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "مراقبة الإنتاج"), _createElementVNode("h3", null, "مركز صحة النظام"), _createElementVNode("p", { class: "hint" }, "فحص سريع للخدمة وقاعدة البيانات والتخزين وواتساب وتطبيق الهاتف وبيانات موقع الزائر والنسخ الاحتياطي. هذه الصفحة للمراقبة فقط.")], -1)), _createElementVNode("button", {
12782        class: "smallbtn",
12783        onClick: load
12784      }, "تحديث", 8, _hoisted_2)]), _createElementVNode("section", _hoisted_3, [
12785        _createElementVNode("div", { class: _normalizeClass(["card healthCard", h.overall]) }, [_cache[1] || (_cache[1] = _createElementVNode("span", null, "الحالة العامة", -1)), _createElementVNode("b", null, _toDisplayString(healthLabel(h.overall)), 1), _createElementVNode("small", null, _toDisplayString(shortDate(h.checked_at)), 1)], 2),
12786        _createElementVNode("div", { class: _normalizeClass(["card healthCard", h.db&&h.db.status]) }, [_cache[2] || (_cache[2] = _createElementVNode("span", null, "قاعدة البيانات", -1)), _createElementVNode("b", null, _toDisplayString(healthLabel(h.db&&h.db.status)), 1), _createElementVNode("small", null, _toDisplayString(h.db&&h.db.message), 1)], 2),
12787        _createElementVNode("div", { class: _normalizeClass(["card healthCard", h.storage&&h.storage.status]) }, [_cache[3] || (_cache[3] = _createElementVNode("span", null, "التخزين", -1)), _createElementVNode("b", null, _toDisplayString(healthLabel(h.storage&&h.storage.status)), 1), _createElementVNode("small", null, _toDisplayString(h.storage&&h.storage.message), 1)], 2),
12788        _createElementVNode("div", { class: _normalizeClass(["card healthCard", h.whatsapp&&h.whatsapp.status]) }, [_cache[4] || (_cache[4] = _createElementVNode("span", null, "WhatsApp", -1)), _createElementVNode("b", null, _toDisplayString(healthLabel(h.whatsapp&&h.whatsapp.status)), 1), _createElementVNode("small", null, _toDisplayString(h.whatsapp&&h.whatsapp.enabled?'مفعل':'الإعدادات غير مكتملة'), 1)], 2),
12789        _createElementVNode("div", { class: _normalizeClass(["card healthCard", h.backups&&h.backups.status]) }, [_cache[5] || (_cache[5] = _createElementVNode("span", null, "النسخ الاحتياطي", -1)), _createElementVNode("b", null, _toDisplayString(healthLabel(h.backups&&h.backups.status)), 1), _createElementVNode("small", null, _toDisplayString(h.backups&&h.backups.message), 1)], 2),
12790        _createElementVNode("div", { class: _normalizeClass(["card healthCard", h.offsite_backups&&h.offsite_backups.enabled?(h.offsite_backups.status==='ok'?'ok':'warn'):'ok']) }, [_cache[6] || (_cache[6] = _createElementVNode("span", null, "النسخ الخارجية", -1)), _createElementVNode("b", null, _toDisplayString(h.offsite_backups&&h.offsite_backups.enabled?(h.offsite_backups.status==='ok'?'سليم':'يحتاج انتباه'):'جاهز'), 1), _createElementVNode("small", null, _toDisplayString(h.offsite_backups&&h.offsite_backups.enabled?'مفعّل':'غير مفعّل'), 1)], 2),
12791        _createElementVNode("div", { class: _normalizeClass(["card healthCard", h.pwa&&h.pwa.status]) }, [_cache[7] || (_cache[7] = _createElementVNode("span", null, "تطبيق الهاتف", -1)), _createElementVNode("b", null, _toDisplayString(healthLabel(h.pwa&&h.pwa.status)), 1), _createElementVNode("small", null, _toDisplayString(h.pwa&&h.pwa.message), 1)], 2),
12792        _createElementVNode("div", { class: _normalizeClass(["card healthCard", h.geoip&&h.geoip.status]) }, [_cache[8] || (_cache[8] = _createElementVNode("span", null, "موقع الزائر", -1)), _createElementVNode("b", null, _toDisplayString(healthLabel(h.geoip&&h.geoip.status)), 1), _createElementVNode("small", null, _toDisplayString(h.geoip&&h.geoip.message), 1)], 2),
12793        _createElementVNode("div", { class: _normalizeClass(["card healthCard", h.logs&&h.logs.status]) }, [_cache[9] || (_cache[9] = _createElementVNode("span", null, "السجلات", -1)), _createElementVNode("b", null, _toDisplayString(healthLabel(h.logs&&h.logs.status)), 1), _createElementVNode("small", null, "سجلات أقدم من 90 يوماً: " + _toDisplayString(h.logs&&h.logs.audit_90_days || 0), 1)], 2)
12794      ])]),
12795      _: 1
12796    }))
12797  }
12798}
12799})()
12800  };
12801
12802
12803  const AdminBackupSettingsPage={
12804    components:{AdminFrame},
12805    setup(){
12806      const store=useGzcStore();const router=useRouter();
12807      const form=reactive({s3:{enabled:false,endpoint:'',region:'auto',bucket:'',prefix:'gzc',tiers:['weekly','monthly']},ssh:{enabled:false,host:'',port:22,user:'',base_path:'/var/backups/gzc',tiers:['weekly','monthly']}});
12808      const r2Account=ref('');
12809      const r2Keys=reactive({access_key_id:'',secret_access_key:''});const savingKeys=ref(false);
12810      async function saveKeys(){
12811        if(savingKeys.value)return;
12812        if(!/^[a-f0-9]{32}$/i.test(r2Keys.access_key_id.trim())||!/^[a-f0-9]{64}$/i.test(r2Keys.secret_access_key.trim())){store.state.msg='أدخل Access Key ID من 32 حرفاً وSecret Acce
12812ss Key من 64 حرفاً من بيانات R2 S3';return;}
12813        if(r2Account.value.trim()&&r2Account.value.trim()===r2Keys.access_key_id.trim()){store.state.msg='Account ID مختلف عن Access Key ID؛ راجع الحقلين';return;}
12814        savingKeys.value=true;
12815        try{const r=await api('/api/admin/settings/r2-credentials',{method:'POST',body:JSON.stringify(r2Keys)});store.state.msg=r.message||'تعذر الحفظ';if(r.ok)await store.loadOffsiteBackupSettings(router);}
12816        finally{r2Keys.access_key_id='';r2Keys.secret_access_key='';savingKeys.value=false;}
12817      }
12818      function applyR2(){const id=String(r2Account.value||'').trim();if(!/^[a-f0-9]{32}$/i.test(id)){store.state.msg='أدخل Cloudflare Account ID الصحيح (٣٢ حرفاً)';return;}form.s3.endpoint='https://'+id.toLowerCase()+'.r2.cloudflarestorage.com';form.s3.region='auto';store.state.msg='تم تجهيز عنوان R2؛ أدخل اسم الحاوية ثم احفظ الإعدادات.';}
12819      const data=computed(()=>store.state.offsiteBackupSettings||{});const overview=computed(()=>data.value.overview||{});
12820      function sync(){const c=data.value.config||{};const s3=c.s3||{},ssh=c.ssh||{};Object.assign(form.s3,{enabled:!!s3.enabled,endpoint:s3.endpoint||'',region:s3.region||'auto',bucket:s3.bucket||'',prefix:s3.prefix||'gzc',tiers:safeArray(s3.tiers).length?safeArray(s3.tiers):['weekly','monthly']});Object.assign(form.ssh,{enabled:!!ssh.enabled,host:ssh.host||'',port:Number(ssh.port||22),user:ssh.user||'',base_path:ssh.base_path||'/var/backups/gzc',tiers:safeArray(ssh.tiers).length?safeArray(ssh.tiers):['weekly','monthly']});}
12821      async function load(){if(await store.requireAdmin(router)){await store.loadOffsiteBackupSettings(router);sync();}}
12822      async function save(){const r=await store.saveOffsiteBackupSettings({s3:{...form.s3,account_id:r2Account.value.trim(),tiers:[...form.s3.tiers]},ssh:{...form.ssh,tiers:[...form.ssh.tiers]}},router);if(r&&r.ok)sync();}
12823      function toggleTier(target,tier){const arr=form[target].tiers;const i=arr.indexOf(tier);if(i>=0){if(arr.length>1)arr.splice(i,1);}else arr.push(tier);}
12824      function tierOn(target,tier){return form[target].tiers.includes(tier);}
12825      function stateLabel(x){return ({ok:'سليم',disabled:'غير مفعّل',waiting:'بانتظار أول نسخة',needs_credentials:'بيانات الدخول ناقصة',failed:'تعذر النسخ'}[String(x&&x.status||'')])||'لم يتم التحقق';}
12826      function lastLabel(x){const l=x&&x.last;if(!l)return 'لا توجد عملية خارجية بعد';return (l.status==='success'?'آخر نسخة ناجحة':'آخر محاولة لم تنجح')+' · '+shortDate(l.updated_at);}
12827      onMounted(load);return{store,form,data,overview,load,save,toggleTier,tierOn,stateLabel,lastLabel,r2Account,applyR2,r2Keys,savingKeys,saveKeys};
12828    },
12829    render:(function(){
12830const _Vue = Vue
12831const { createElementVNode: _createElementVNode, createTextVNode: _createTextVNode } = _Vue
12832
12833const _hoisted_1 = { class: "card dashboardHeaderCard" }
12834const _hoisted_2 = ["onClick"]
12835const _hoisted_3 = { class: "card formCard" }
12836const _hoisted_4 = { class: "adminSectionHead" }
12837const _hoisted_5 = { class: "statusPill" }
12838const _hoisted_6 = { class: "checkLine" }
12839const _hoisted_7 = ["onUpdate:modelValue"]
12840const _hoisted_8 = { class: "editGrid" }
12841const _hoisted_9 = ["onUpdate:modelValue"]
12842const _hoisted_10 = ["onClick"]
12843const _hoisted_11 = { class: "editGrid" }
12844const _hoisted_12 = ["onUpdate:modelValue"]
12845const _hoisted_13 = ["onUpdate:modelValue"]
12846const _hoisted_14 = ["onUpdate:modelValue"]
12847const _hoisted_15 = ["onUpdate:modelValue"]
12848const _hoisted_16 = { class: "editGrid" }
12849const _hoisted_17 = ["onUpdate:modelValue"]
12850const _hoisted_18 = ["onUpdate:modelValue"]
12851const _hoisted_19 = ["disabled", "onClick"]
12852const _hoisted_20 = { class: "fieldLabel" }
12853const _hoisted_21 = { class: "row" }
12854const _hoisted_22 = ["onClick"]
12855const _hoisted_23 = ["onClick"]
12856const _hoisted_24 = ["onClick"]
12857const _hoisted_25 = { class: "hint" }
12858const _hoisted_26 = { class: "hint" }
12859const _hoisted_27 = { class: "card formCard" }
12860const _hoisted_28 = { class: "adminSectionHead" }
12861const _hoisted_29 = { class: "statusPill" }
12862const _hoisted_30 = { class: "checkLine" }
12863const _hoisted_31 = ["onUpdate:modelValue"]
12864const _hoisted_32 = { class: "editGrid" }
12865const _hoisted_33 = ["onUpdate:modelValue"]
12866const _hoisted_34 = ["onUpdate:modelValue"]
12867const _hoisted_35 = ["onUpdate:modelValue"]
12868const _hoisted_36 = ["onUpdate:modelValue"]
12869const _hoisted_37 = { class: "fieldLabel" }
12870const _hoisted_38 = { class: "row" }
12871const _hoisted_39 = ["onClick"]
12872const _hoisted_40 = ["onClick"]
12873const _hoisted_41 = ["onClick"]
12874const _hoisted_42 = { class: "hint" }
12875const _hoisted_43 = { class: "hint" }
12876const _hoisted_44 = ["disabled", "onClick"]
12877
12878return function render(_ctx, _cache) {
12879  with (_ctx) {
12880    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, vModelCheckbox: _vModelCheckbox, withDirectives: _withDirectives, createTextVNode: _createTextVNode, vModelText: _vModelText, normalizeClass: _normalizeClass, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = _Vue
12881
12882    const _component_AdminFrame = _resolveComponent("AdminFrame")
12883
12884    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "النسخ الخارجية والتعافي" }, {
12885      default: _withCtx(() => [
12886        _createElementVNode("section", _hoisted_1, [_cache[0] || (_cache[0] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "حماية البيانات"), _createElementVNode("h3", null, "النسخ الخارجية"), _createElementVNode("p", { class: "hint" }, "يمكن الاحتفاظ بنسخة خارج السيرفر الرئيسي عبر S3-compatible أو سيرفر Backup منفصل.")], -1)), _createElementVNode("button", {
12887          class: "smallbtn",
12888          onClick: load
12889        }, "تحديث", 8, _hoisted_2)]),
12890        _createElementVNode("section", _hoisted_3, [
12891          _createElementVNode("div", _hoisted_4, [_cache[1] || (_cache[1] = _createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "S3-compatible"), _createElementVNode("h3", null, "Cloudflare R2 / Object Storage")], -1)), _createElementVNode("span", _hoisted_5, _toDisplayString(stateLabel(overview.s3)), 1)]),
12892          _createElementVNode("label", _hoisted_6, [_withDirectives(_createElementVNode("input", {
12893            type: "checkbox",
12894            "onUpdate:modelValue": $event => ((form.s3.enabled) = $event)
12895          }, null, 8, _hoisted_7), [[_vModelCheckbox, form.s3.enabled]]), _cache[2] || (_cache[2] = _createTextVNode(" تفعيل النسخ إلى R2 / S3"))]),
12896          _createElementVNode("div", _hoisted_8, [_createElementVNode("label", null, [_cache[3] || (_cache[3] = _createTextVNode("Cloudflare Account ID (اختياري لتجهيز العنوان)")), _withDirectives(_createElementVNode("input", {
12897            "onUpdate:modelValue": $event => ((r2Account) = $event),
12898            dir: "ltr",
12899            autocomplete: "off",
12900            placeholder: "معرّف الحساب، وليس API Token"
12901          }, null, 8, _hoisted_9), [[_vModelText, r2Account]])]), _createElementVNode("button", {
12902            type: "button",
12903            class: "smallbtn secondary",
12904            onClick: applyR2
12905          }, "تجهيز إعدادات Cloudflare R2", 8, _hoisted_10)]),
12906          _cache[11] || (_cache[11] = _createElementVNode("p", { class: "hint" }, "R2 يستخدم Region: auto. انسخ S3 API Endpoint من إعدادات الحاوية، ولا تستخدم رابط العرض العام r2.dev. للحاويات ذات نطاق اختصاص خاص استخدم عنوانها كما يظهر في Cloudflare.", -1)),
12907          _createElementVNode("div", _hoisted_11, [
12908            _createElementVNode("label", null, [_cache[4] || (_cache[4] = _createTextVNode("Endpoint")), _withDirectives(_createElementVNode("input", {
12909              "onUpdate:modelValue": $event => ((form.s3.endpoint) = $event),
12910              dir: "ltr",
12911              placeholder: "https://ACCOUNT_ID.r2.cloudflarestorage.com"
12912            }, null, 8, _hoisted_12), [[_vModelText, form.s3.endpoint]])]),
12913            _createElementVNode("label", null, [_cache[5] || (_cache[5] = _createTextVNode("Region")), _withDirectives(_createElementVNode("input", {
12914              "onUpdate:modelValue": $event => ((form.s3.region) = $event),
12915              dir: "ltr",
12916              placeholder: "auto"
12917            }, null, 8, _hoisted_13), [[_vModelText, form.s3.region]])]),
12918            _createElementVNode("label", null, [_cache[6] || (_cache[6] = _createTextVNode("Bucket")), _withDirectives(_createElementVNode("input", {
12919              "onUpdate:modelValue": $event => ((form.s3.bucket) = $event),
12920              dir: "ltr",
12921              placeholder: "smtsudan"
12922            }, null, 8, _hoisted_14), [[_vModelText, form.s3.bucket]])]),
12923            _createElementVNode("label", null, [_cache[7] || (_cache[7] = _
12923createTextVNode("Prefix")), _withDirectives(_createElementVNode("input", {
12924              "onUpdate:modelValue": $event => ((form.s3.prefix) = $event),
12925              dir: "ltr",
12926              placeholder: "gzc"
12927            }, null, 8, _hoisted_15), [[_vModelText, form.s3.prefix]])])
12928          ]),
12929          _createElementVNode("div", _hoisted_16, [_createElementVNode("label", null, [_cache[8] || (_cache[8] = _createTextVNode("Access Key ID")), _withDirectives(_createElementVNode("input", {
12930            type: "password",
12931            "onUpdate:modelValue": $event => ((r2Keys.access_key_id) = $event),
12932            dir: "ltr",
12933            autocomplete: "new-password",
12934            spellcheck: "false",
12935            placeholder: "32 حرفاً — مفتاح الدخول وليس Account ID"
12936          }, null, 8, _hoisted_17), [[_vModelText, r2Keys.access_key_id]])]), _createElementVNode("label", null, [_cache[9] || (_cache[9] = _createTextVNode("Secret Access Key")), _withDirectives(_createElementVNode("input", {
12937            type: "password",
12938            "onUpdate:modelValue": $event => ((r2Keys.secret_access_key) = $event),
12939            dir: "ltr",
12940            autocomplete: "new-password",
12941            spellcheck: "false",
12942            placeholder: "64 حرفاً — المفتاح السري"
12943          }, null, 8, _hoisted_18), [[_vModelText, r2Keys.secret_access_key]])])]),
12944          _createElementVNode("button", {
12945            type: "button",
12946            class: "smallbtn",
12947            disabled: savingKeys,
12948            onClick: saveKeys
12949          }, _toDisplayString(savingKeys?'جارٍ حفظ المفاتيح…':'حفظ / استبدال مفاتيح R2'), 9, _hoisted_19),
12950          _cache[12] || (_cache[12] = _createElementVNode("p", { class: "hint" }, "احفظ المفتاحين أولاً، ثم إعدادات الحاوية والتفعيل. الحقول الفارغة لا تحذف المفاتيح المحفوظة. لا نعيد عرض المفاتيح بعد الحفظ. استخدم Object Read & Write للحاوية المطلوبة.", -1)),
12951          _createElementVNode("div", _hoisted_20, [_cache[10] || (_cache[10] = _createTextVNode("النسخ المطلوبة")), _createElementVNode("div", _hoisted_21, [_createElementVNode("button", {
12952            type: "button",
12953            class: _normalizeClass(["smallbtn", {secondary:!tierOn('s3','daily')}]),
12954            onClick: $event => (toggleTier('s3','daily'))
12955          }, "يومي", 10, _hoisted_22), _createElementVNode("button", {
12956            type: "button",
12957            class: _normalizeClass(["smallbtn", {secondary:!tierOn('s3','weekly')}]),
12958            onClick: $event => (toggleTier('s3','weekly'))
12959          }, "أسبوعي", 10, _hoisted_23), _createElementVNode("button", {
12960            type: "button",
12961            class: _normalizeClass(["smallbtn", {secondary:!tierOn('s3','monthly')}]),
12962            onClick: $event => (toggleTier('s3','monthly'))
12963          }, "شهري", 10, _hoisted_24)])]),
12964          _createElementVNode("p", _hoisted_25, "بيانات الدخول: " + _toDisplayString(overview.s3&&overview.s3.credentials&&overview.s3.credentials.ready?'مضافة على الخادم':'غير مضافة على الخادم') + ". لا يتم عرض المفاتيح هنا.", 1),
12965          _createElementVNode("p", _hoisted_26, _toDisplayString(lastLabel(overview.s3)), 1)
12966        ]),
12967        _createElementVNode("section", _hoisted_27, [
12968          _createElementVNode("div", _hoisted_28, [_cache[13] || (_cache[13] = _createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "سيرفر Backup منفصل"), _createElementVNode("h3", null, "نسخ عبر SSH")], -1)), _createElementVNode("span", _hoisted_29, _toDisplayString(stateLabel(overview.ssh)), 1)]),
12969          _createElementVNode("label", _hoisted_30, [_withDirectives(_createElementVNode("input", {
12970            type: "checkbox",
12971            "onUpdate:modelValue": $event => ((form.ssh.enabled) = $event)
12972          }, null, 8, _hoisted_31), [[_vModelCheckbox, form.ssh.enabled]]), _cache[14] || (_cache[14] = _createTextVNode(" تفعيل النسخ إلى السيرفر المنفصل"))]),
12973          _createElementVNode("div", _hoisted_32, [
12974            _createElementVNode("label", null, [_cache[15] || (_cache[15] = _createTextVNode("Host")), _withDirectives(_createElementVNode("input", {
12975              "onUpdate:modelValue": $event => ((form.ssh.host) = $event),
12976              dir: "ltr",
12977              placeholder: "backup.example.com"
12978            }, null, 8, _hoisted_33), [[_vModelText, form.ssh.host]])]),
12979            _createElementVNode("label", null, [_cache[16] || (_cache[16] = _createTextVNode("Port")), _withDirectives(_createElementVNode("input", {
12980              type: "number",
12981              min: "1",
12982              max: "65535",
12983              "onUpdate:modelValue": $event => ((form.ssh.port) = $event)
12984            }, null, 8, _hoisted_34), [[
12985              _vModelText,
12986              form.ssh.port,
12987              void 0,
12988              { number: true }
12989            ]])]),
12990            _createElementVNode("label", null, [_cache[17] || (_cache[17] = _createTextVNode("User")), _withDirectives(_createElementVNode("input", {
12991              "onUpdate:modelValue": $event => ((form.ssh.user) = $event),
12992              dir: "ltr",
12993              placeholder: "backup"
12994            }, null, 8, _hoisted_35), [[_vModelText, form.ssh.user]])]),
12995            _createElementVNode("label", null, [_cache[18] || (_cache[18] = _createTextVNode("Path")), _withDirectives(_createElementVNode("input", {
12996              "onUpdate:modelValue": $event => ((form.ssh.base_path) = $event),
12997              dir: "ltr",
12998              placeholder: "/var/backups/gzc"
12999            }, null, 8, _hoisted_36), [[_vModelText, form.ssh.base_path]])])
13000          ]),
13001          _createElementVNode("div", _hoisted_37, [_cache[19] || (_cache[19] = _createTextVNode("النسخ المطلوبة")), _createElementVNode("div", _hoisted_38, [_createElementVNode("button", {
13002            type: "button",
13003            class: _normalizeClass(["smallbtn", {secondary:!tierOn('ssh','daily')}]),
13004            onClick: $event => (toggleTier('ssh','daily'))
13005          }, "يومي", 10, _hoisted_39), _createElementVNode("button", {
13006            type: "button",
13007            class: _normalizeClass(["smallbtn", {secondary:!tierOn('ssh','weekly')}]),
13008            onClick: $event => (toggleTier('ssh','weekly'))
13009          }, "أسبوعي", 10, _hoisted_40), _createElementVNode("button", {
13010            type: "button",
13011            class: _normalizeClass(["smallbtn", {secondary:!tierOn('ssh','monthly')}]),
13012            onClick: $event => (toggleTier('ssh','monthly'))
13013          }, "شهري", 10, _hoisted_41)])]),
13014          _createElementVNode("p", _hoisted_42, "مفتاح SSH وknown_hosts: " + _toDisplayString(overview.ssh&&overview.ssh.credentials&&overview.ssh.credentials.ready?'مضافان على الخادم':'غير مكتملين على الخادم') + ".", 1),
13015          _createElementVNode("p", _hoisted_43, _toDisplayString(lastLabel(overview.ssh)), 1)
13016        ]),
13017        _createElementVNode("button", {
13018          class: "btn loadMore",
13019          disabled: store.state.busy,
13020          onClick: save
13021        }, "حفظ إعدادات النسخ الخارجية", 8, _hoisted_44)
13022      ]),
13023      _: 1
13024    }))
13025  }
13026}
13027})()
13028  };
13029
13030  const AdminReleasePage={
13031    components:{AdminFrame},
13032    setup(){const store=useGzcStore();const router=useRouter();const r=computed(()=>store.state.releaseInfo&&store.state.releaseInfo.release||{});const h=computed(()=>store.state.releaseInfo&&store.state.releaseInfo.health||{});async function load(){if(await store.requireAdmin(router)) await store.loadReleaseInfo(router);}onMounted(load);return{store,r,h,load,shortDate,healthLabel};},
13033    render:(function(){
13034const _Vue = Vue
13035const { createElementVNode: _createElementVNode } = _Vue
13036
13037const _hoisted_1 = { class: "card dashboardHeaderCard" }
13038const _hoisted_2 = ["onClick"]
13039const _hoisted_3 = { class: "healthGrid" }
13040const _hoisted_4 = { class: "card healthCard ok" }
13041const _hoisted_5 = { class: "card healthCard ok" }
13042const _hoisted_6 = { class: "card healthCard ok" }
13043const _hoisted_7 = { class: "card healthCard" }
13044const _hoisted_8 = { class: "card healthCard" }
13045const _hoisted_9 = { class: "card healthCard" }
13046const _hoisted_10 = { class: "card healthCard" }
13047const _hoisted_11 = { class: "card" }
13048
13049return function render(_ctx, _cache) {
13050  with (_ctx) {
13051    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, normalizeClass: _normalizeClass, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = _Vue
13052
13053    const _component_AdminFrame = _resolveComponent("AdminFrame")
13054
13055    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "مركز الإصدارات" }, {
13056      default: _withCtx(() => [_createElementVNode("section", _hoisted_1, [_cache[0] || (_cache[0] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "إدارة المنصة"), _createElementVNode("h3", null, "مركز الإصدار"), _createElementVNode("p", { class: "hint" }, "يعرض رقم النسخة والتخزين المحلي وقاعدة البيانات وآخر نسخة احتياطية وآخر عملية تثبيت مسجلة.")], -1)), _createElementVNode("button", {
13057        class: "smallbtn",
13058        onClick: load
13059      }, "تحديث", 8, _hoisted_2)]), _createElementVNode("section", _hoisted_3, [
13060        _createElementVNode("div", _hoisted_4, [_cache[1] || (_cache[1] = _createElementVNode("span", null, "النسخة الحالية", -1)), _createElementVNode("b", null, _toDisplayString(r.current_version||'-'), 1), _cache[2] || (_cache[2] = _createElementVNode("small", null, null, -1))]),
13061        _createElementVNode("div", _hoisted_5, [_cache[3] || (_cache[3] = _createElementVNode("span", null, "نسخة التخزين المحلي", -1)), _createElementVNode("b", null, _toDisplayString(r.cache_version||'-'), 1), _cache[4] || (_cache[4] = _createElementVNode("small", null, null, -1))]),
13062        _createElementVNode("div", _hoisted_6, [_cache[5] || (_cache[5] = _createElementVNode("span", null, "نسخة تطبيق الهاتف", -1)), _createElementVNode("b", null, _toDisplayString(r.pwa_version||'-'), 1), _cache[6] || (_cache[6] = _createElementVNode("small", null, null, -1))]),
13063        _createElementVNode("div", { class: _normalizeClass(["card healthCard", h.overall]) }, [_cache[7] || (_cache[7] = _createElementVNode("span", null, "حالة النظام", -1)), _createElementVNode("b", null, _toDisplayString(healthLabel(h.overall)), 1), _createElementVNode("small", null, _toDisplayString(shortDate(h.checked_at)), 1)], 2),
13064        _createElementVNode("div", _hoisted_7, [_cache[8] || (_cache[8] = _createElementVNode("span", null, "قاعدة البيانات", -1)), _createElementVNode("b", null, _toDisplayString(r.database_version||'-'), 1), _cache[9] || (_cache[9] = _createElementVNode("small", null, null, -1))]),
13065        _createElementVNode("div", _hoisted_8, [_cache[10] || (_cache[10] = _createElementVNode("span", null, "تاريخ التثبيت", -1)), _createElementVNode("b", null, _toDisplayString(shortDate(r.install_date)), 1), _cache[11] || (_cache[11] = _createElementVNode("small", null, null, -1))]),
13066        _createElementVNode("div", _hoisted_9, [_cache[12] || (_cache[12] = _createElementVNode("span", null, "آخر نسخة احتياطية", -1)), _createElementVNode("b", null, _toDisplayString(r.last_backup&&r.last_backup.status || '-'), 1), _createElementVNode("small", null, _toDisplayString(shortDate(r.last_backup&&r.last_backup.created_at)), 1)]),
13067        _createElementVNode("div", _hoisted_10, [_cache[13] || (_cache[13] = _createElementVNode("span", null, "آخر تحديث لقاعدة البيانات", -1)), _createElementVNode("b", null, _toDisplayString(r.last_migration&&r.last_migration.action || '-'), 1), _createElementVNode("small", null, _toDisplayString(shortDate(r.last_migration&&r.last_migration.created_at)), 1)])
13068      ]), _createElementVNode("section", _hoisted_11, [_cache[14] || (_cache[14] = _createElementVNode("h3", null, "ملاحظات الإصدار", -1)), _createElementVNode("p", null, _toDisplayString(r.release_notes), 1)])]),
13069      _: 1
13070    }))
13071  }
13072}
13073})()
13074  };
13075
13076  const AdminAuditPage={
13077    components:{AdminFrame},
13078    setup(){
13079      const store=useGzcStore();const router=useRouter();const openLogs=reactive({});
13080      const f=reactive({search:'',actor_type:'',entity_type:'',action:'',limit:100});
13081      async function load(){if(await store.requireAdmin(router)) await store.loadAuditLogs(f,router);}
13082      function toggleLog(id){openLogs[id]=!openLogs[id];}
13083      const auditStats=computed(()=>({total:safeArray(store.state.auditLogs).length,actions:safeArray(store.state.auditCounts).length,admins:safeArray(store.state.auditLogs).filter(x=>x.actor_type==='admin').length,members:safeArray(store.state.auditLogs).filter(x=>x.actor_type==='member').length}));
13084      onMounted(load);
13085      return {store,f,openLogs,auditStats,toggleLog,load,shortDate};
13086    },
13087    render:(function(){
13088const _Vue = Vue
13089const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
13090
13091const _hoisted_1 = { class: "miniStats auditStats" }
13092const _hoisted_2 = {
13093  class: "card collapseSection formCard",
13094  open: ""
13095}
13096const _hoisted_3 = { class: "collapseBody" }
13097const _hoisted_4 = { class: "editGrid" }
13098const _hoisted_5 = ["onUpdate:modelValue", "onKeyup"]
13099const _hoisted_6 = ["onUpdate:modelValue"]
13100const _hoisted_7 = ["onUpdate:modelValue"]
13101const _hoisted_8 = ["onUpdate:modelValue"]
13102const _hoisted_9 = ["onUpdate:modelValue"]
13103const _hoisted_10 = ["onClick"]
13104const _hoisted_11 = { class: "card collapseSection" }
13105const _hoisted_12 = { class: "collapseBody" }
13106const _hoisted_13 = { class: "auditChips" }
13107const _hoisted_14 = { class: "auditListCompact" }
13108const _hoisted_15 = { class: "memberCardTop compactToggleRow" }
13109const _hoisted_16 = { class: "notifTitleBox" }
13110const _hoisted_17 = { class: "toggleSide" }
13111const _hoisted_18 = { class: "statusPill" }
13112const _hoisted_19 = ["onClick"]
13113const _hoisted_20 = { class: "compactSummaryBar notifSummary" }
13114const _hoisted_21 = {
13115  key: 0,
13116  class: "collapsibleBody"
13117}
13118const _hoisted_22 = { class: "notifyMeta" }
13119const _hoisted_23 = { class: "auditPre" }
13120
13121return function render(_ctx, _cache) {
13122  with (_ctx) {
13123    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, vModelText: _vModelText, withKeys: _withKeys, withDirectives: _withDirectives, vModelSelect: _vModelSelect, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, createTextVNode: _createTextVNode, createCommentVNode: _createCommentVNode, normalizeClass: _normalizeClass, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
13124
13125    const _component_AdminFrame = _resolveComponent("AdminFrame")
13126
13127    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "Audit Log" }, {
13128      default: _withCtx(() => [
13129        _cache[8] || (_cache[8] = _createElementVNode("div", { class: "card noticeCard compactNotice" }, [_createElementVNode("span", { class: "vueBadge" }, "إدارة المنصة"), _createElementVNode("h3", null, "سجل العمليات"), _createElementVNode("p", null, "عرض مختصر للسجل مع فتح التفاصيل عند الحاجة. مهم للأمان والمتابعة.")], -1)),
13130        _createElementVNode("div", _hoisted_1, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(auditStats.total), 1), _cache[0] || (_cache[0] = _createElementVNode("small", null, "نتائج", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(auditStats.admins), 1), _cache[1] || (_cache[1] = _createElementVNode("small", null, "إدارة", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(auditStats.members), 1), _cache[2] || (_cache[2] = _createElementVNode("small", null, "أعضاء", -1))])]),
13131        _createElementVNode("details", _hoisted_2, [_cache[4] || (_cache[4] = _createElementVNode("summary", null, [_createElementVNode("b", null, "بحث في سجل العمليات"), _createElementVNode("span")], -1)), _createElementVNode("div", _hoisted_3, [_createElementVNode("div", _hoisted_4, [
13132          _withDirectives(_createElementVNode("input", {
13133            "onUpdate:modelValue": $event => ((f.search) = $event),
13134            onKeyup: _withKeys(load, ["enter"]),
13135            placeholder: "بحث: عضو، رقم، إجراء، IP"
13136          }, null, 40, _hoisted_5), [[_vModelText, f.search]]),
13137          _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((f.actor_type) = $event) }, _cache[3] || (_cache[3] = [
13138            _createElementVNode("option", { value: "" }, "كل المنفذين", -1),
13139            _createElementVNode("option", { value: "admin" }, "Admin", -1),
13140            _createElementVNode("option", { value: "member" }, "Member", -1),
13141            _createElementVNode("option", { value: "anonymous" }, "Anonymous", -1),
13142            _createElementVNode("option", { value: "system" }, "System", -1)
13143          ]), 8, _hoisted_6), [[_vModelSelect, f.actor_type]]),
13144          _withDirectives(_createElementVNode("input", {
13145            "onUpdate:modelValue": $event => ((f.entity_type) = $event),
13146            placeholder: "نوع الكيان: member / case"
13147          }, null, 8, _hoisted_7), [[_vModelText, f.entity_type]]),
13148          _withDirectives(_createElementVNode("input", {
13149            "onUpdate:modelValue": $event => ((f.action) = $event),
13150            placeholder: "action"
13151          }, null, 8, _hoisted_8), [[_vModelText, f.action]]),
13152          _withDirectives(_createElementVNode("input", {
13153            type: "number",
13154            min: "1",
13155            max: "300",
13156            "onUpdate:modelValue": $event => ((f.limit) = $event),
13157            placeholder: "limit"
13158          }, null, 8, _hoisted_9), [[_vModelText, f.limit]])
13159        ]), _createElementVNode("button", {
13160          class: "btn loadMore",
13161          onClick: load
13162        }, "بحث", 8, _hoisted_10)])]),
13163        _createElementVNode("details", _hoisted_11, [_cache[5] || (_cache[5] = _createElementVNode("summary", null, [_createElementVNode("b", null, "أكثر الإجراءات خلال 7 أيام"), _createElementVNode("span")], -1)), _createElementVNode("div", _hoisted_12, [_createElementVNode("div", _hoisted_13, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(store.state.auditCounts, (c) => {
13164          return (_openBlock(), _createElementBlock("span", { key: c.action }, [_createElementVNode("b", null, _toDisplayString(c.n), 1), _createTextVNode(" " + _toDisplayString(c.action), 1)]))
13165        }), 128))])])]),
13166        _createElementVNode("div", _hoisted_14, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(store.state.auditLogs, (l) => {
13167          return (_openBlock(), _createElementBlock("div", {
13168            class: _normalizeClass(["card auditCard collapsibleCard auditCardCompact", {open:openLogs[l.id]}]),
13169            key: l.id
13170          }
13170, [_createElementVNode("div", _hoisted_15, [_createElementVNode("div", _hoisted_16, [_createElementVNode("h3", null, _toDisplayString(l.action), 1), _createElementVNode("small", null, _toDisplayString(shortDate(l.created_at)) + " — " + _toDisplayString(l.actor_name || '-'), 1)]), _createElementVNode("div", _hoisted_17, [_createElementVNode("span", _hoisted_18, _toDisplayString(l.actor_type), 1), _createElementVNode("button", {
13171            class: "smallbtn secondary",
13172            onClick: $event => (toggleLog(l.id))
13173          }, _toDisplayString(openLogs[l.id]?'− إخفاء':'+ إظهار'), 9, _hoisted_19)])]), _createElementVNode("div", _hoisted_20, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(l.entity_type || '-'), 1), _cache[6] || (_cache[6] = _createElementVNode("small", null, "الكيان", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(l.entity_id || '-'), 1), _cache[7] || (_cache[7] = _createElementVNode("small", null, "ID", -1))])]), (openLogs[l.id])
13174            ? (_openBlock(), _createElementBlock("div", _hoisted_21, [_createElementVNode("div", _hoisted_22, [
13175                _createElementVNode("span", null, _toDisplayString(l.actor_name || '-'), 1),
13176                _createElementVNode("span", null, _toDisplayString(l.entity_type) + ":" + _toDisplayString(l.entity_id), 1),
13177                _createElementVNode("span", null, _toDisplayString(shortDate(l.created_at)), 1),
13178                _createElementVNode("span", null, _toDisplayString(l.ip || '-'), 1)
13179              ]), _createElementVNode("pre", _hoisted_23, _toDisplayString(JSON.stringify(l.new_value || {}, null, 2)), 1)]))
13180            : _createCommentVNode("", true)], 2))
13181        }), 128))])
13182      ]),
13183      _: 1,
13184      __: [8]
13185    }))
13186  }
13187}
13188})()
13189  };
13190
13191  const AdminWhatsappPage={
13192    components:{AdminFrame},
13193    setup(){
13194      const store=useGzcStore();const router=useRouter();const route=useRoute();const queueStatus=ref('all');const testPhone=ref('');const cleanDays=ref(30);
13195      const technicalMode=computed(()=>route.path==='/admin/whatsapp-settings');
13196      const pageTitle=computed(()=>technicalMode.value?'إعدادات واتساب التقنية':'واتساب والرسائل');
13197      const tpl=reactive({otp:'',invite:'',profileComplete:'',memberApproved:'',event:'',arrival:'',help:'',emergency:'',announcement:'',officialAnnouncement:'',adminInvite:'',operations:''});
13198      const wa=reactive({enabled:true,apiKey:'',sourceNumber:'',appName:'',publicUrl:'',apiKeyMasked:''});const notificationPolicy=reactive({enabled:true,domains:{},events:{}});const notificationTest=reactive({eventKey:'procurement.offer_published',audience:'member',phone:''});
13199      const health=computed(()=>store.state.whatsappHealth||{});
13200      const queue=computed(()=>store.state.whatsappQueue||{jobs:[],counts:[],audit:[],worker:{}});
13201      const queueTabs=[{key:'all',label:'الكل'},{key:'queued',label:'انتظار'},{key:'failed',label:'إعادة مجدولة'},{key:'dead',label:'مراجعة'},{key:'sent',label:'مرسلة'},{key:'cancelled',label:'ملغاة'}];
13202      const templateKeys=['otp','invite','profileComplete','memberApproved','event','arrival','help','emergency','announcement','officialAnnouncement','adminInvite','operations'];
13203      function templateLabel(k){return ({otp:'رمز التحقق / الدخول',invite:'دعوة التسجيل',profileComplete:'إكمال البيانات',memberApproved:'اعتماد العضو',event:'فعالية جديدة',arrival:'وصول جديد',help:'طلب مساعدة',emergency:'طوارئ',announcement:'إعلانات المنصة',officialAnnouncement:'تعميمات السفارة والقنصلية',adminInvite:'دعوة المشرفين',operations:'إشعار تشغيلي عام (التوريد والطلبات)'}[k])||k;}
13204      function issueLabel(x){return ({whatsapp_disabled:'واتساب غير مفعل',api_key_missing:'API Key غير موجود',source_number_missing:'Source Number ناقص',app_name_missing:'App Name ناقص',required_templates_missing:'قوالب تشغيلية إلزامية ناقصة',queue_retry_scheduled:'توجد رسائل مجدولة لإعادة المحاولة',queue_dead_letter:'توجد رسائل تحتاج مراجعة يدوية',queue_delivery_unknown:'توجد رسائل حالة تسليمها غير معروفة',queue_stale_processing:'توجد رسائل عالقة قيد الإرسال'}[x])||x;}
13205      const templateRows=computed(()=>templateKeys.map(k=>
13205({key:k,label:templateLabel(k),required:!['adminInvite','operations'].includes(k),ok:Object.prototype.hasOwnProperty.call(health.value.templateStatus||{},k)?!!health.value.templateStatus[k]:!!String(tpl[k]||'').trim()})));
13206      const issues=computed(()=>safeArray(health.value.issues).map(issueLabel));
13207      const queueMap=computed(()=>{const out={all:0,queued:0,processing:0,sent:0,failed:0,dead:0,cancelled:0};safeArray(queue.value.counts).forEach(c=>{out[c.status]=Number(c.n||0);out.all+=Number(c.n||0)});return out;});
13208      const recentLogs=computed(()=>safeArray(health.value.recentLogs).slice(0,8));
13209      const queueJobs=computed(()=>safeArray(queue.value.jobs).slice(0,80));
13210      const worker=computed(()=>queue.value.worker||health.value.worker||{});
13211      const notificationState=computed(()=>store.state.whatsappNotificationPolicy||{policy:{},catalog:{domains:[],events:[]}});
13212      const notificationEvents=computed(()=>safeArray(notificationState.value.catalog&&notificationState.value.catalog.events));
13213      const notificationDomains=computed(()=>safeArray(notificationState.value.catalog&&notificationState.value.catalog.domains).map(d=>({ ...d,events:notificationEvents.value.filter(e=>e.domain===d.key) })));
13214      const selectedNotificationEvent=computed(()=>notificationEvents.value.find(e=>e.key===notificationTest.eventKey)||notificationEvents.value[0]||null);
13215      const selectedNotificationAudiences=computed(()=>safeArray(selectedNotificationEvent.value&&selectedNotificationEvent.value.audiences));
13216      async function load(){if(await store.requireAdmin(router)){await Promise.all([store.loadWhatsappHealth(router),store.loadWhatsappQueue(queueStatus.value,router),store.loadWhatsappSettings(router),store.loadWhatsappNotificationPolicy(router)]);syncForms();}}
13217      function syncForms(){const s=store.state.whatsappSettings||{};Object.assign(tpl,s.templates||{});Object.assign(wa,s.whatsapp||{});wa.apiKey='';const p=(store.state.whatsappNotificationPolicy&&store.state.whatsappNotificationPolicy.policy)||{};notificationPolicy.enabled=p.enabled!==false;notificationPolicy.domains=JSON.parse(JSON.stringify(p.domains||{}));notificationPolicy.events=JSON.parse(JSON.stringify(p.events||{}));if(!notificationEvents.value.some(e=>e.key===notificationTest.eventKey)&&notificationEvents.value.length)notificationTest.eventKey=notificationEvents.value[0].key;if(!selectedNotificationAudiences.value.includes(notificationTest.audience))notificationTest.audience=selectedNotificationAudiences.value[0]||'member';}
13218      onMounted(load);watch(queueStatus,()=>store.loadWhatsappQueue(queueStatus.value,router));watch(()=>notificationTest.eventKey,()=>{const allowed=selectedNotificationAudiences.value;if(!allowed.includes(notificationTest.audience))notificationTest.audience=allowed[0]||'member';});
13219      async function saveTemplates(){const r=await runBusyAction(store,'whatsapp.save-templates',()=>api('/api/admin/settings/templates',{method:'POST',body:JSON.stringify(tpl)}));store.state.msg=r.message||r.error||'';await load();}
13220      async function saveWhatsapp(){const payload={enabled:!!wa.enabled,sourceNumber:wa.sourceNumber||'',appName:wa.appName||'',publicUrl:wa.publicUrl||'',apiKey:wa.apiKey||''};const r=await runBusyAction(store,'whatsapp.save-settings',()=>api('/api/admin/settings/whatsapp',{method:'POST',body:JSON.stringify(payload)}));store.state.msg=r.message||r.error||'';await load();}
13221      async function saveNotificationPolicy(){const payload={enabled:!!notificationPolicy.enabled,domains:notificationPolicy.domains||{},events:notificationPolicy.events||{}};const r=await runBusyAction(store,'whatsapp.save-notification-policy',()=>api('/api/admin/settings/whatsapp-notifications',{method:'POST',body:JSON.stringify(payload)}));store.state.msg=r.message||r.error||'';await load();}
13222      async function sendNotificationTest(){if(!notificationTest.eventKey)return;const r=await runBusyAction(store,'whatsapp.notification-test',()=>api('/api/admin/settings/whatsapp-notifications/test',{method:'POST',body:JSON.stringify({event_key:notificationTest.eventKe
13222y,audience:notificationTest.audience,phone:norm(notificationTest.phone)})}));store.state.msg=r.message||r.error||'';await load();}
13223      function eventPolicy(key){if(!notificationPolicy.events[key])notificationPolicy.events[key]={enabled:true,audiences:{}};return notificationPolicy.events[key];}
13224      function domainPolicy(key){if(!notificationPolicy.domains[key])notificationPolicy.domains[key]={enabled:true};return notificationPolicy.domains[key];}
13225      async function sendTest(){const r=await runBusyAction(store,'whatsapp.test',()=>api('/api/admin/settings/whatsapp/test',{method:'POST',body:JSON.stringify({phone:norm(testPhone.value)})}));store.state.msg=r.message||r.error||'';await load();}
13226      async function processQueue(){const r=await runBusyAction(store,'whatsapp.process-queue',()=>api('/api/admin/whatsapp-queue/process',{method:'POST'}));store.state.msg=r.message||r.error||('تمت المعالجة');await load();}
13227      async function retryJob(j){let confirmed=false;if(j.failure_class==='delivery_unknown'){confirmed=confirm('حالة التسليم غير معروفة. قد يكون المستلم استلم الرسالة فعلاً؛ هل تؤكد إعادة إرسالها؟');if(!confirmed)return;}const r=await runBusyAction(store,'whatsapp.retry-job',()=>api('/api/admin/whatsapp-queue/'+encodeURIComponent(j.id)+'/retry',{method:'POST',body:JSON.stringify({confirm_delivery_unknown:confirmed})}));store.state.msg=r.message||r.error||'';await store.loadWhatsappQueue(queueStatus.value,router);}
13228      async function cancelJob(j){const r=await runBusyAction(store,'whatsapp.cancel-job',()=>api('/api/admin/whatsapp-queue/'+encodeURIComponent(j.id)+'/cancel',{method:'POST'}));store.state.msg=r.message||r.error||'';await store.loadWhatsappQueue(queueStatus.value,router);}
13229      async function cleanup(){if(!confirm('تنظيف رسائل واتساب القديمة؟'))return;const r=await runBusyAction(store,'whatsapp.cleanup',()=>api('/api/admin/whatsapp-queue/cleanup',{method:'POST',body:JSON.stringify({days:cleanDays.value})}));store.state.msg=r.message||r.error||'';await load();}
13230      return {store,health,queue,queueJobs,queueMap,queueStatus,queueTabs,testPhone,cleanDays,tpl,wa,templateRows,issues,recentLogs,worker,technicalMode,pageTitle,notificationPolicy,notificationTest,notificationDomains,notificationEvents,selectedNotificationEvent,selectedNotificationAudiences,eventPolicy,domainPolicy,load,saveTemplates,saveWhatsapp,saveNotificationPolicy,sendNotificationTest,sendTest,processQueue,retryJob,cancelJob,cleanup,queueStatusName,queueFailureName,shortDate};
13231    },
13232    render:(function(){
13233const _Vue = Vue
13234const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
13235
13236const _hoisted_1 = { class: "card waHero" }
13237const _hoisted_2 = { class: "vueBadge" }
13238const _hoisted_3 = ["onClick"]
13239const _hoisted_4 = { class: "waHealthGrid" }
13240const _hoisted_5 = { class: "card waHealthTile" }
13241const _hoisted_6 = { dir: "ltr" }
13242const _hoisted_7 = { class: "card waHealthTile" }
13243const _hoisted_8 = { class: "card waHealthTile" }
13244const _hoisted_9 = { class: "card waHealthTile" }
13245const _hoisted_10 = {
13246  key: 0,
13247  class: "card waIssueCard"
13248}
13249const _hoisted_11 = { class: "issueChips" }
13250const _hoisted_12 = {
13251  key: 1,
13252  class: "card collapseSection waConfigCard",
13253  open: ""
13254}
13255const _hoisted_13 = { class: "collapseBody" }
13256const _hoisted_14 = { class: "waSwitchRow" }
13257const _hoisted_15 = { class: "check" }
13258const _hoisted_16 = ["onUpdate:modelValue"]
13259const _hoisted_17 = { class: "apiMask" }
13260const _hoisted_18 = { class: "editGrid waFormGrid" }
13261const _hoisted_19 = ["onUpdate:modelValue"]
13262const _hoisted_20 = ["onUpdate:modelValue"]
13263const _hoisted_21 = ["onUpdate:modelValue"]
13264const _hoisted_22 = ["onUpdate:modelValue"]
13265const _hoisted_23 = ["onClick"]
13266const _hoisted_24 = {
13267  key: 2,
13268  class: "card collapseSection waPolicyCard",
13269  open: ""
13270}
13271const _hoisted_25 = { class: "collapseBody" }
13272const _hoisted_26 = { class: "waPolicyMaster" }
13273const _hoisted_27 = { class: "check" }
13274const _hoisted_28 = ["onUpdate:modelValue"]
13275const _hoisted_29 = { class: "waPolicyDomainHead" }
13276const _hoisted_30 = { class: "switchMini" }
13277const _hoisted_31 = ["onUpdate:modelValue"]
13278const _hoisted_32 = { class: "waPolicyEventTitle" }
13279const _hoisted_33 = { class: "check" }
13280const _hoisted_34 = ["onUpdate:modelValue"]
13281const _hoisted_35 = { dir: "ltr" }
13282const _hoisted_36 = { class: "waAudienceSwitches" }
13283const _hoisted_37 = {
13284  key: 0,
13285  class: "check"
13286}
13287const _hoisted_38 = ["onUpdate:modelValue"]
13288const _hoisted_39 = {
13289  key: 1,
13290  class: "check"
13291}
13292const _hoisted_40 = ["onUpdate:modelValue"]
13293const _hoisted_41 = ["onClick"]
13294const _hoisted_42 = { class: "waPolicyTest" }
13295const _hoisted_43 = { class: "editGrid" }
13296const _hoisted_44 = ["onUpdate:modelValue"]
13297const _hoisted_45 = ["value"]
13298const _hoisted_46 = ["onUpdate:modelValue"]
13299const _hoisted_47 = ["value"]
13300const _hoisted_48 = ["onUpdate:modelValue"]
13301const _hoisted_49 = ["onClick"]
13302const _hoisted_50 = {
13303  id: "wa-templates",
13304  class: "card collapseSection waTemplatesCard",
13305  open: ""
13306}
13307const _hoisted_51 = { class: "statusPill" }
13308const _hoisted_52 = { class: "collapseBody" }
13309const _hoisted_53 = { class: "templateRows" }
13310const _hoisted_54 = ["onUpdate:modelValue", "placeholder"]
13311const _hoisted_55 = ["onClick"]
13312const _hoisted_56 = {
13313  key: 3,
13314  class: "card collapseSection waTestCard"
13315}
13316const _hoisted_57 = { class: "collapseBody" }
13317const _hoisted_58 = { class: "editGrid" }
13318const _hoisted_59 = ["onUpdate:modelValue"]
13319const _hoisted_60 = ["onClick"]
13320const _hoisted_61 = {
13321  key: 4,
13322  class: "card collapseSection waQueueCard",
13323  open: ""
13324}
13325const _hoisted_62 = ["onClick"]
13326const _hoisted_63 = { class: "collapseBody" }
13327const _hoisted_64 = { class: "segmented queueSegmentPro" }
13328const _hoisted_65 = ["onClick"]
13329const _hoisted_66 = { class: "queueOps" }
13330const _hoisted_67 = ["onClick"]
13331const _hoisted_68 = ["onClick"]
13332const _hoisted_69 = ["onUpdate:modelValue"]
13333const _hoisted_70 = {
13334  key: 0,
13335  class: "queueCounts"
13336}
13337const _hoisted_71 = {
13338  key: 1,
13339  class: "hint"
13340}
13341const _hoisted_72 = { class: "memberCardTop" }
13342const _hoisted_73 = { class: "notifyMeta" }
13343const _hoisted_74 = { dir: "ltr" }
13344const _hoisted_75 = { key: 0 }
13345const _hoisted_76 = { key: 1 }
13346const _hoisted_77 = { key: 2 }
13347const _hoisted_78 = {
13348  key: 3,
13349  dir: "ltr"
13350}
13351const _hoisted_79 = {
13352  key: 0,
13353  class: "hint errorText"
13354}
13355const _hoisted_80 = { class: "memberActions" }
13356const _hoisted_81 = ["onClick"]
13357const _hoisted_82 = ["onClick"]
13358const _hoisted_83 = {
13359  key: 6,
13360  class: "card adminTechnicalPanel"
13361}
13362const _hoisted_84 = { class: "row" }
13363const _hoisted_85 = ["onClick"]
13364const _hoisted_86 = ["onClick"]
13365const _hoisted_87 = ["onUpdate:modelValue"]
13366const _hoisted_88 = {
13367  key: 0,
13368  class: "queueCounts"
13369}
13370const _hoisted_89 = {
13371  key: 7,
13372  class: "card collapseSection waRecentCard"
13373}
13374const _hoisted_90 = { class: "collapseBody" }
13375const _hoisted_91 = { key: 0 }
13376const _hoisted_92 = { key: 1 }
13377
13378return function render(_ctx, _cache) {
13379  with (_ctx) {
13380    const { toDisplayString: _toDisplayString, createElementVNode: _
13380createElementVNode, normalizeClass: _normalizeClass, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, vModelCheckbox: _vModelCheckbox, withDirectives: _withDirectives, createTextVNode: _createTextVNode, vModelText: _vModelText, vModelSelect: _vModelSelect, withModifiers: _withModifiers, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
13381
13382    const _component_AdminFrame = _resolveComponent("AdminFrame")
13383
13384    return (_openBlock(), _createBlock(_component_AdminFrame, { title: pageTitle }, {
13385      default: _withCtx(() => [
13386        _createElementVNode("div", _hoisted_1, [_createElementVNode("div", null, [_createElementVNode("span", _hoisted_2, _toDisplayString(technicalMode?'تشغيل تقني':'الاتصالات'), 1), _createElementVNode("h3", null, _toDisplayString(technicalMode?'إعدادات واتساب والصيانة':'قائمة واتساب والقوالب'), 1), _createElementVNode("p", null, _toDisplayString(technicalMode?'إعداد المزود، اختبار الاتصال وصيانة عامل الإرسال للإدارة العليا فقط.':'راجع الرسائل المنتظرة أو الفاشلة والقوالب التشغيلية من مكان واحد.'), 1)]), _createElementVNode("button", {
13387          class: "smallbtn",
13388          onClick: load
13389        }, "تحديث", 8, _hoisted_3)]),
13390        _cache[23] || (_cache[23] = _createElementVNode("a", {
13391          class: "smallbtn secondary",
13392          href: "#wa-templates"
13393        }, "إعدادات قوالب واتساب", -1)),
13394        _createElementVNode("div", _hoisted_4, [
13395          _createElementVNode("div", { class: _normalizeClass(["card waStatusMain", health.status]) }, [_cache[0] || (_cache[0] = _createElementVNode("span", null, "الحالة العامة", -1)), _createElementVNode("b", null, _toDisplayString(health.status==='ok'?'سليم':'يحتاج ضبط'), 1), _createElementVNode("small", null, _toDisplayString(health.enabled?'واتساب مفعل':'واتساب غير مفعل'), 1)], 2),
13396          _createElementVNode("div", _hoisted_5, [_cache[1] || (_cache[1] = _createElementVNode("span", null, "القوالب", -1)), _createElementVNode("b", _hoisted_6, _toDisplayString(health.templatesConfigured || 0) + " / " + _toDisplayString(health.templatesTotal || 0), 1), _cache[2] || (_cache[2] = _createElementVNode("small", null, "المكتملة", -1))]),
13397          _createElementVNode("div", _hoisted_7, [_cache[3] || (_cache[3] = _createElementVNode("span", null, "قائمة الإرسال", -1)), _createElementVNode("b", null, _toDisplayString(queueMap.all || 0), 1), _createElementVNode("small", null, "انتظار " + _toDisplayString(queueMap.queued || 0) + " — إعادة " + _toDisplayString(queueMap.failed || 0) + " — مراجعة " + _toDisplayString(queueMap.dead || 0), 1)]),
13398          _createElementVNode("div", _hoisted_8, [_cache[4] || (_cache[4] = _createElementVNode("span", null, "منع التكرار", -1)), _createElementVNode("b", null, _toDisplayString((health.operations&&health.operations.dedupe_protected) || 0), 1), _cache[5] || (_cache[5] = _createElementVNode("small", null, "رسائل محمية بمفتاح يومي", -1))]),
13399          _createElementVNode("div", _hoisted_9, [_cache[6] || (_cache[6] = _createElementVNode("span", null, "العامل", -1)), _createElementVNode("b", null, _toDisplayString(worker.running?'يعمل':'جاهز'), 1), _createElementVNode("small", null, "Batch " + _toDisplayString(worker.batch || '-') + " — Timeout " + _toDisplayString(Math.round((worker.provider_timeout_ms||0)/1000)||'-') + "s", 1)])
13400        ]),
13401        (issues.length)
13402          ? (_openBlock(), _createElementBlock("div", _hoisted_10, [_cache[7] || (_cache[7] = _createElementVNode("h3", null, "تنبيهات تحتاج ضبط", -1)), _createElementVNode("div", _hoisted_11, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(issues, (x) => {
13403              return (_openBlock(), _createElementBlock("span", { key: x }, _toDisplayString(x), 1))
13404            }), 128))])]))
13405          : _createCommentVNode("", true),
13406        technicalMode
13407          ? (_openBlock(), _createElementBlock("details", _hoisted_12, [_cache[9] || (_cache[9] = _createElementVNode("summary", null, [_createElementVNode("b", null, "إعدادات مزود واتساب"), _createElementVNode("span")], -1)), _createElementVNode("div", _hoisted_13, [_createElementVNode("div", _hoisted_14, [_createElementVNode("label", _hoisted_15, [_withDirectives(_createElementVNode("input", {
13408              type: "checkbox",
13409              "onUpdate:modelValue": $event => ((wa.enabled) = $event),
13410              disabled: ""
13411            }, null, 8, _hoisted_16), [[_vModelCheckbox, wa.enabled]]), _cache[8] || (_cache[8] = _createTextVNode(" مزود واتساب وOTP (إلزامي)"))]), _createElementVNode("span", _hoisted_17, "API: " + _toDisplayString(wa.apiKeyMasked || (health.apiKeyPresent?'محفوظ':'غير محفوظ')), 1
13411)]), _createElementVNode("div", _hoisted_18, [
13412              _withDirectives(_createElementVNode("input", {
13413                class: "ltr",
13414                "onUpdate:modelValue": $event => ((wa.sourceNumber) = $event),
13415                placeholder: "Source Number"
13416              }, null, 8, _hoisted_19), [[_vModelText, wa.sourceNumber]]),
13417              _withDirectives(_createElementVNode("input", {
13418                class: "ltr",
13419                "onUpdate:modelValue": $event => ((wa.appName) = $event),
13420                placeholder: "App Name"
13421              }, null, 8, _hoisted_20), [[_vModelText, wa.appName]]),
13422              _withDirectives(_createElementVNode("input", {
13423                class: "ltr",
13424                "onUpdate:modelValue": $event => ((wa.publicUrl) = $event),
13425                placeholder: "Public URL"
13426              }, null, 8, _hoisted_21), [[_vModelText, wa.publicUrl]]),
13427              _withDirectives(_createElementVNode("input", {
13428                class: "ltr",
13429                "onUpdate:modelValue": $event => ((wa.apiKey) = $event),
13430                placeholder: "API Key جديد فقط؛ اتركه فارغاً للإبقاء على القديم"
13431              }, null, 8, _hoisted_22), [[_vModelText, wa.apiKey]])
13432            ]), _createElementVNode("button", {
13433              class: "btn loadMore",
13434              onClick: saveWhatsapp
13435            }, "حفظ إعدادات واتساب", 8, _hoisted_23)])]))
13436          : _createCommentVNode("", true),
13437        (!technicalMode)
13438          ? (_openBlock(), _createElementBlock("details", _hoisted_24, [_createElementVNode("summary", null, [_cache[10] || (_cache[10] = _createElementVNode("b", null, "مركز التحكم في إشعارات واتساب", -1)), _createElementVNode("span", { class: _normalizeClass(["statusPill", notificationPolicy.enabled?'sent':'cancelled']) }, _toDisplayString(notificationPolicy.enabled?'تشغيل':'متوقف'), 3)]), _createElementVNode("div", _hoisted_25, [
13439              _createElementVNode("div", _hoisted_26, [_createElementVNode("label", _hoisted_27, [_withDirectives(_createElementVNode("input", {
13440                type: "checkbox",
13441                "onUpdate:modelValue": $event => ((notificationPolicy.enabled) = $event)
13442              }, null, 8, _hoisted_28), [[_vModelCheckbox, notificationPolicy.enabled]]), _cache[11] || (_cache[11] = _createTextVNode(" تشغيل الإشعارات التشغيلية للمنصة"))]), _cache[12] || (_cache[12] = _createElementVNode("small", null, "OTP مستقل ولا يتأثر بهذا المفتاح.", -1))]),
13443              (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(notificationDomains, (d) => {
13444                return (_openBlock(), _createElementBlock("div", {
13445                  class: "waPolicyDomain",
13446                  key: d.key
13447                }, [_createElementVNode("div", _hoisted_29, [_createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(d.label), 1), _createElementVNode("small", null, _toDisplayString(d.events.length) + " إشعارات", 1)]), _createElementVNode("label", _hoisted_30, [_withDirectives(_createElementVNode("input", {
13448                  type: "checkbox",
13449                  "onUpdate:modelValue": $event => ((domainPolicy(d.key).enabled) = $event)
13450                }, null, 8, _hoisted_31), [[_vModelCheckbox, domainPolicy(d.key).enabled]]), _createElementVNode("span", null, _toDisplayString(domainPolicy(d.key).enabled?'ON':'OFF'), 1)])]), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(d.events, (e) => {
13451                  return (_openBlock(), _createElementBlock("div", {
13452                    class: _normalizeClass(["waPolicyEvent", {muted:!notificationPolicy.enabled||!domainPolicy(d.key).enabled||!eventPolicy(e.key).enabled}]),
13453                    key: e.key
13454                  }, [_createElementVNode("div", _hoisted_32, [_createElementVNode("label", _hoisted_33, [_withDirectives(_createElementVNode("input", {
13455                    type: "checkbox",
13456                    "onUpdate:modelValue": $event => ((eventPolicy(e.key).enabled) = $event)
13457                  }, null, 8, _hoisted_34), [[_vModelCheckbox, eventPolicy(e.key).enabled]]), _cache[13] || (_cache[13] = _createTextVNode()), _createElementVNode("b", null, _toDisplayString(e.label), 1)]), _createElementVNode("small", _hoisted_35, _toDisplayString(e.key), 1)]), _createElementVNode("div", _hoisted_36, [(e.audiences.includes('member'))
13458                    ? (_openBlock(), _createElementBlock("label", _hoisted_37, [_withDirectives(_createElementVNode("input", {
13459                        type: "checkbox",
13460                        "onUpdate:modelValue": $event => ((eventPolicy(e.key).audiences.member) = $event)
13461                      }, null, 8, _hoisted_38), [[_vModelCheckbox, eventPolicy(e.key).audiences.member]]), _cache[14] || (_cache[14] = _createTextVNode(" للعضو"))]))
13462                    : _createCommentVNode("", true), (e.audiences.includes('admin'))
13463                    ? (_openBlock(), _createElementBlock("label", _hoisted_39, [_withDirectives(_createElementVNode("input", {
13464                        type: "checkbox",
13465                        "onUpdate:modelValue": $event => ((eventPolicy(e.key).audiences.admin) = $event)
13466                      }, null, 8, _hoisted_40), [[_vModelCheckbox, eventPolicy(e.key).audiences.admin]]), _cache[15] || (_cache[15] = _createTextVNode(" للإدارة"))]))
13467                    : _createCommentVNode("", true)])], 2))
13468                }), 128))]))
13469              }), 128)),
13470              _createElementVNode("button", {
13471                class: "btn loadMore",
13472                onClick: saveNotificationPolicy
13473              }, "حفظ سياسة الإشعارات", 8, _hoisted_41),
13474              _createElementVNode("div", _hoisted_42, [_cache[16] || (_cache[16] = _createElementVNode("h4", null, "اختبار حدث", -1)), _createElementVNode("div", _hoisted_43, [
13475                _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event =>
13475 ((notificationTest.eventKey) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(notificationEvents, (e) => {
13476                  return (_openBlock(), _createElementBlock("option", {
13477                    key: e.key,
13478                    value: e.key
13479                  }, _toDisplayString(e.label), 9, _hoisted_45))
13480                }), 128))], 8, _hoisted_44), [[_vModelSelect, notificationTest.eventKey]]),
13481                _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((notificationTest.audience) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(selectedNotificationAudiences, (a) => {
13482                  return (_openBlock(), _createElementBlock("option", {
13483                    key: a,
13484                    value: a
13485                  }, _toDisplayString(a==='member'?'عضو':'إدارة'), 9, _hoisted_47))
13486                }), 128))], 8, _hoisted_46), [[_vModelSelect, notificationTest.audience]]),
13487                _withDirectives(_createElementVNode("input", {
13488                  class: "ltr",
13489                  "onUpdate:modelValue": $event => ((notificationTest.phone) = $event),
13490                  placeholder: "رقم الاختبار"
13491                }, null, 8, _hoisted_48), [[_vModelText, notificationTest.phone]]),
13492                _createElementVNode("button", {
13493                  class: "btn secondary",
13494                  onClick: sendNotificationTest
13495                }, "إضافة رسالة اختبار للقائمة", 8, _hoisted_49)
13496              ])])
13497            ])]))
13498          : _createCommentVNode("", true),
13499        _createElementVNode("details", _hoisted_50, [_createElementVNode("summary", null, [_cache[17] || (_cache[17] = _createElementVNode("b", null, "إعدادات القوالب — Template IDs", -1)), _createElementVNode("span", _hoisted_51, _toDisplayString(health.templatesConfigured || 0) + "/" + _toDisplayString(health.templatesTotal || 0), 1)]), _createElementVNode("div", _hoisted_52, [_createElementVNode("div", _hoisted_53, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(templateRows, (r) => {
13500          return (_openBlock(), _createElementBlock("label", {
13501            key: r.key,
13502            class: _normalizeClass(["templateRow", {ready:r.ok}])
13503          }, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(r.label), 1), _createElementVNode("small", null, _toDisplayString(r.required?'إلزامي':'اختياري') + " — " + _toDisplayString(r.ok?'مكتمل':'ناقص'), 1)]), _withDirectives(_createElementVNode("input", {
13504            class: "ltr",
13505            "onUpdate:modelValue": $event => ((tpl[r.key]) = $event),
13506            placeholder: r.key
13507          }, null, 8, _hoisted_54), [[_vModelText, tpl[r.key]]])], 2))
13508        }), 128))]), _createElementVNode("button", {
13509          class: "btn loadMore",
13510          onClick: saveTemplates
13511        }, "حفظ القوالب", 8, _hoisted_55)])]),
13512        technicalMode
13513          ? (_openBlock(), _createElementBlock("details", _hoisted_56, [_cache[18] || (_cache[18] = _createElementVNode("summary", null, [_createElementVNode("b", null, "اختبار واتساب"), _createElementVNode("span")], -1)), _createElementVNode("div", _hoisted_57, [_createElementVNode("div", _hoisted_58, [_withDirectives(_createElementVNode("input", {
13514              class: "ltr",
13515              "onUpdate:modelValue": $event => ((testPhone) = $event),
13516              placeholder: "رقم الاختبار مثال 8613660699600"
13517            }, null, 8, _hoisted_59), [[_vModelText, testPhone]]), _createElementVNode("button", {
13518              class: "btn secondary",
13519              onClick: sendTest
13520            }, "إرسال رمز تحقق تجريبي", 8, _hoisted_60)])])]))
13521          : _createCommentVNode("", true),
13522        (!technicalMode)
13523          ? (_openBlock(), _createElementBlock("details", _hoisted_61, [_createElementVNode("summary", null, [_cache[19] || (_cache[19] = _createElementVNode("b", null, "قائمة الإرسال", -1)), _createElementVNode("button", {
13524              class: "smallbtn",
13525              onClick: _withModifiers($event => (store.loadWhatsappQueue(queueStatus,$router)), ["stop"])
13526            }, "تحديث", 8, _hoisted_62)]), _createElementVNode("div", _hoisted_63, [
13527              _createElementVNode("div", _hoisted_64, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(queueTabs, (s) => {
13528                return (_openBlock(), _createElementBlock("button", {
13529                  key: s.key,
13530                  class: _normalizeClass({active:queueStatus===s.key}),
13531                  onClick: $event => (queueStatus=s.key)
13532                }, [_createElementVNode("b", null, _toDisplayString(s.label), 1), _createElementVNode("small", null, _toDisplayString(queueMap[s.key] || 0), 1)], 10, _hoisted_65))
13533              }), 128))]),
13534              _createElementVNode("div", _hoisted_66, [_createElementVNode("button", {
13535                class: "btn secondary",
13536                onClick: processQueue
13537              }, "تشغيل العامل الآن", 8, _hoisted_67), _createElementVNode("button", {
13538                class: "btn dangerBtn",
13539                onClick: cleanup
13540              }, "تنظيف أقدم من " + _toDisplayString(cleanDays) + " يوم", 9, _hoisted_68), _withDirectives(_createElementVNode("input", {
13541                type: "number",
13542                min: "7",
13543                max: "365",
13544                "onUpdate:modelValue": $event => ((cleanDays) = $event)
13545              }, null, 8, _hoisted_69), [[_vModelText, cleanDays]])]),
13546              (queue.counts&&queue.counts.length)
13547                ? (_openBlock(), _createElementBlock("div", _hoisted_70, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(queue.counts, (c) => {
13548                    return (_openBlock(), _createElementBlock("span", { key: c.status }, [_createElementVNode("b", null, _toDisplayString(c.n), 1), _createTextVNode(" " + _toDisplayString(queueStatusName(c.status)), 1)]))
13549                  }), 128))]))
13550                : _createCommentVNode("", true),
13551              (!queueJobs.length)
13552                ? (_openBlock(), _createElementBlock("p", _hoisted_71, "لا توجد رسائل في هذا الفلتر."))
13553                : _createCommentVNode("", true)
13554            ])]))
13555          : _createCommentVNode("", true),
13556        (!technicalMode)
13557          ? (_openBlock(true), _createElementBlock(_Fragment, { key: 5 }, _renderList(queueJobs, (j) => {
13558              return (_openBlock(), _createElementBlock("div", {
13559                class: "card queueJobPro",
13560                key: j.id
13561              }, [
13562                _createElementVNode("div", _hoisted_72, [_createElementVNode("h3", null, _toDisplayString(j.template_name || 'template'), 1), _createElementVNode("span", { class: _normalizeClass(["statusPill", j.status]) }, _toDisplayString(queueStatusName(j.status)), 3)]),
13563                _createElementVNode("div", _hoisted_73, [
13564                  _createElementVNode("span", _hoisted_74, _toDisplayString(j.phone), 1),
13565                  _createElementVNode("span", null, "محاولات " + _toDisplayString(j.attempts) + "/" + _toDisplayString(j.max_attempts), 1),
13566                  _createElementVNode("span", null, "إنشاء " + _toDisplayString(shortDate(j.created_at)), 1),
13567                  (j.last_attempt_at)
13568                    ? (_openBlock(), _createElementBlock("span", _hoisted_75, "آخر محاولة " + _toDisplayString(shortDate(j.last_attempt_at)), 1))
13569                    : _createCommentVNode("", true),
13570                  (j.status==='failed'&&j.next_attempt_at)
13571                    ? (_openBlock(), _createElementBlock("span", _hoisted_76, "التالي " + _toDisplayString(shortDate(j.next_attempt_at)), 1))
13572                    : _createCommentVNode("", true),
13573                  (j.failure_class)
13574                    ? (_openBlock(), _createElementBlock("span", _hoisted_77, _toDisplayString(queueFailureName(j.failure_class)), 1))
13575                    : _createCommentVNode("", true),
13576                  (j.provider_message_id)
13577                    ? (_openBlock(), _createElementBlock("span", _hoisted_78, "Provider: " + _toDisplayString(j.provider_message_id), 1))
13578                    : _createCommentVNode("", true)
13579                ]),
13580                (j.last_error)
13581                  ? (_openBlock(), _createElementBlock("p", _hoisted_79, _toDisplayString(j.last_error), 1))
13582                  : _createCommentVNode("", true),
13583                _createElementVNode("div", _hoisted_80, [(['failed','dead','cancelled'].includes(j.status))
13584                  ? (_openBlock(), _createElementBlock("button", {
13585                      key: 0,
13586                      class: "smallbtn",
13587                      onClick: $event => (retryJob(j))
13588                    }, "إعادة للإرسال", 8, _hoisted_81))
13589                  : _createCommentVNode("", true), (['queued','failed'].includes(j.status))
13590                  ? (_openBlock(), _createElementBlock("button", {
13591                      key: 1,
13592                      class: "smallbtn danger",
13593                      onClick: $event => (cancelJob(j))
13594                    }, "إلغاء", 8, _hoisted_82))
13595                  : _createCommentVNode("", true)])
13596              ]))
13597            }), 128))
13598          : _createCommentVNode("", true),
13599        technicalMode
13600          ? (_openBlock(), _createElementBlock("section", _hoisted_83, [
13601              _cache[20] || (_cache[20] = _createElementVNode("h3", null, "صيانة عامل الإرسال", -1)),
13602              _cache[21] || (_cache[21] = _createElementVNode("p", { class: "hint" }, "هذه الإجراءات تشغيلية تقنية ولا تظهر في صندوق الرسائل اليومي.", -1)),
13603              _createElementVNode("div", _hoisted_84, [_createElementVNode("button", {
13604                class: "btn secondary",
13605                onClick: processQueue
13606              }, "تشغيل العامل الآن", 8, _hoisted_85), _createElementVNode("button", {
13607                class: "btn dangerBtn",
13608                onClick: cleanup
13609              }, "تنظيف السجلات القديمة", 8, _hoisted_86), _withDirectives(_createElementVNode("input", {
13610                type: "number",
13611                min: "7",
13612                max: "365",
13613                "onUpdate:modelValue": $event => ((cleanDays) = $event),
13614                "aria-label": "عدد الأيام"
13615              }, null, 8, _hoisted_87), [[_vModelText, cleanDays]])]),
13616              (queue.counts&&queue.counts.length)
13617                ? (_openBlock(), _createElementBlock("div", _hoisted_88, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(queue.counts, (c) => {
13618                    return (_openBlock(), _createElementBlock("span", { key: c.status }, [_createElementVNode("b", null, _toDisplayString(c.n), 1), _createTextVNode(" " + _toDisplayString(queueStatusName(c.status)), 1)]))
13619                  }), 128))]))
13620                : _createCommentVNode("", true)
13621            ]))
13622          : _createCommentVNode("", true),
13623        (recentLogs.length)
13624          ? (_openBlock(), _createElementBlock("details", _hoisted_89, [_cache[22] || (_cache[22] = _createElementVNode("summary", null, [_createElementVNode("b", null, "آخر سجلات الإرسال"), _createElementVNode("span")], -1)), _createElementVNode("div", _hoisted_90, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(recentLogs, (l) => {
13625              return (_openBlock(), _createElementBlock("div", {
13626                class: "logMini",
13627                key: (l.queue_id||'direct')+'-'+l.template_name+'-'+l.created_at
13628              }, [
13629                _createElementVNode("b", null, _toDisplayString(l.template_name || '-'), 1),
13630                _createElementVNode("span", null, [_createTextVNode(_toDisplayString(l.status), 1), (l.attempt_no)
13631                  ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createTextVNode(" — محاولة " + _toDisplayString(l.attempt_no), 1)], 64))
13632                  : _createCommentVNode("", true)]),
13633                _createElementVNode("small", null, _toDisplayString(shortDate(l.sent_at || l.created_at)), 1),
13634                (l.failure_class)
13635                  ? (_openBlock(), _createElementBlock("em", _hoisted_91, _toDisplayString(queueFailureName(l.failure_class)), 1))
13636                  : _createCommentVNode("", true),
13637                (l.error_message)
13638                  ? (_openBlock(), _createElementBlock("em", _hoisted_92, _toDisplayString(l.error_message), 1))
13639                  : _createCommentVNode("", true)
13640              ]))
13641            }), 128))])]))
13642          : _createCommentVNode("", true)
13643      ]),
13644      _: 1,
13645      __: [23]
13646    }, 8, ["title"]))
13647  }
13648}
13649})()
13650  };
13651
13652
13653
13654  const AdminWorkflowPage={
13655    components:{AdminFrame},
13656    setup(){
13657      const store=useGzcStore();const router=useRouter();
13658      const workflows=computed(()=>safeArray(store.state.workflowHealth.workflows));
13659      const missing=computed(()=>workflows.value.filter(w=>w.required&&!w.template_id_present));
13660      const okCount=computed(()=>workflows.value.filter(w=>w.ok).length);
13661      async function load(){if(await store.requireAdmin(router))await store.loadWorkflowHealth(router);}
13662      onMounted(load);
13663      return {store,workflows,missing,okCount,load,shortDate,queueStatusName};
13664    },
13665    render:(function(){
13666const _Vue = Vue
13667const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
13668
13669const _hoisted_1 = { class: "card waHero" }
13670const _hoisted_2 = ["onClick"]
13671const _hoisted_3 = { class: "waHealthGrid" }
13672const _hoisted_4 = { class: "card waHealthTile" }
13673const _hoisted_5 = {
13674  key: 0,
13675  class: "card waIssueCard"
13676}
13677const _hoisted_6 = { class: "issueChips" }
13678const _hoisted_7 = { class: "memberCardTop" }
13679const _hoisted_8 = { class: "notifyMeta" }
13680const _hoisted_9 = { class: "hint" }
13681const _hoisted_10 = { class: "hint ltr" }
13682const _hoisted_11 = { class: "collapseSection" }
13683const _hoisted_12 = { class: "collapseBody" }
13684const _hoisted_13 = {
13685  key: 0,
13686  class: "hint"
13687}
13688const _hoisted_14 = { class: "collapseSection" }
13689const _hoisted_15 = { class: "collapseBody" }
13690const _hoisted_16 = {
13691  key: 0,
13692  class: "hint"
13693}
13694
13695return function render(_ctx, _cache) {
13696  with (_ctx) {
13697    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, normalizeClass: _normalizeClass, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
13698
13699    const _component_AdminFrame = _resolveComponent("AdminFrame")
13700
13701    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "Workflow & WhatsApp" }, {
13702      default: _withCtx(() => [
13703        _createElementVNode("div", _hoisted_1, [_cache[0] || (_cache[0] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "إدارة المنصة"), _createElementVNode("h3", null, "خريطة الإجراءات المرتبطة بواتساب"), _createElementVNode("p", null, "تعرض هذه الصفحة ارتباط كل إجراء بقالب الرسالة المناسب، وتوضح توفر القالب ووجود سجلات إرسال حديثة.")], -1)), _createElementVNode("button", {
13704          class: "smallbtn",
13705          onClick: load
13706        }, "تحديث", 8, _hoisted_2)]),
13707        _cache[9] || (_cache[9] = _createElementVNode("a", {
13708          class: "smallbtn secondary",
13709          href: "#wa-templates"
13710        }, "إعدادات قوالب واتساب", -1)),
13711        _createElementVNode("div", _hoisted_3, [_createElementVNode("div", { class: _normalizeClass(["card waStatusMain", missing.length?'warn':'ok']) }, [_cache[1] || (_cache[1] = _createElementVNode("span", null, "حالة الربط", -1)), _createElementVNode("b", null, _toDisplayString(okCount) + " / " + _toDisplayString(workflows.length), 1), _createElementVNode("small", null, _toDisplayString(missing.length?missing.length+' قوالب ناقصة':'كل الإلزامي مضبوط'), 1)], 2), _createElementVNode("div", _hoisted_4, [_cache[2] || (_cache[2] = _createElementVNode("span", null, "واتساب", -1)), _createElementVNode("b", null, _toDisplayString(store.state.workflowHealth.whatsapp&&store.state.workflowHealth.whatsapp.enabled?'مفعل':'غير مفعل'), 1), _createElementVNode("small", null, _toDisplayString(store.state.workflowHealth.whatsapp&&store.state.workflowHealth.whatsapp.app_name), 1)])]),
13712        (missing.length)
13713          ? (_openBlock(), _createElementBlock("div", _hoisted_5, [_cache[3] || (_cache[3] = _createElementVNode("h3", null, "ناقص Template ID", -1)), _createElementVNode("div", _hoisted_6, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(missing, (w) => {
13714              return (_openBlock(), _createElementBlock("span", { key: w.key }, _toDisplayString(w.name) + " — " + _toDisplayString(w.template), 1))
13715            }), 128))]), _cache[4] || (_cache[4] = _createElementVNode("p", { class: "hint" }, "ادخل صفحة واتساب وأضف Template ID الناقص.", -1))]))
13716          : _createCommentVNode("", true),
13717        (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(workflows, (w) => {
13718          return (_openBlock(), _createElementBlock("div", {
13719            class: "card queueJobPro",
13720            key: w.key
13721          }, [
13722            _createElementVNode("div", _hoisted_7, [_createElementVNode("h3", null, _toDisplayString(w.name), 1), _createElementVNode("span", { class: _normalizeClass(["statusPill", w.ok?'sent':'failed']) }, _toDisplayString(w.ok?'مضبوط':'ناقص'), 3)]),
13723            _createElementVNode("div", _hoisted_8, [_createElementVNode("span", null, "Template: " + _toDisplayString(w.template), 1), _createElementVNode("span", null, _toDisplayString(w.required?'إلزامي':'اختياري'), 1), _createElementVNode("span", null, _toDisplayString(w.queue?'Queue':'Direct'), 1)]),
13724            _createElementVNode("p", _hoisted_9, [_cache[5] || (_cache[5] = _createElementVNode("b", null, "الإجراء:", -1)), _createTextVNode(" " + _toDisplayString(w.trigger), 1)]),
13725            _createElementVNode("p", _hoisted_10, [_cache[6] || (_cache[6] = _createElementVNode("b", null, "المسار:", -1)), _createTextVNode(" " + _toDisplayString(w.endpoint), 1)]),
13726            _createElementVNode("details", _hoisted_11, [_cache[7] || (_cache[7] = _
13726createElementVNode("summary", null, [_createElementVNode("b", null, "آخر السجلات"), _createElementVNode("span")], -1)), _createElementVNode("div", _hoisted_12, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(w.recent_logs, (l) => {
13727              return (_openBlock(), _createElementBlock("div", {
13728                class: "logMini",
13729                key: l.template_name+l.status
13730              }, [_createElementVNode("b", null, _toDisplayString(l.template_name), 1), _createElementVNode("span", null, _toDisplayString(l.status), 1), _createElementVNode("small", null, _toDisplayString(l.n) + " — " + _toDisplayString(shortDate(l.last_sent_at||l.last_created_at)), 1)]))
13731            }), 128)), (!w.recent_logs.length)
13732              ? (_openBlock(), _createElementBlock("p", _hoisted_13, "لا توجد سجلات حديثة لهذا الإجراء."))
13733              : _createCommentVNode("", true)])]),
13734            _createElementVNode("details", _hoisted_14, [_cache[8] || (_cache[8] = _createElementVNode("summary", null, [_createElementVNode("b", null, "Queue"), _createElementVNode("span")], -1)), _createElementVNode("div", _hoisted_15, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(w.queue, (q) => {
13735              return (_openBlock(), _createElementBlock("div", {
13736                class: "logMini",
13737                key: q.template_name+q.status
13738              }, [_createElementVNode("b", null, _toDisplayString(q.template_name), 1), _createElementVNode("span", null, _toDisplayString(queueStatusName(q.status)), 1), _createElementVNode("small", null, _toDisplayString(q.n) + " — " + _toDisplayString(shortDate(q.last_created_at)), 1)]))
13739            }), 128)), (!w.queue.length)
13740              ? (_openBlock(), _createElementBlock("p", _hoisted_16, "لا توجد رسائل Queue حديثة لهذا الإجراء."))
13741              : _createCommentVNode("", true)])])
13742          ]))
13743        }), 128))
13744      ]),
13745      _: 1,
13746      __: [9]
13747    }))
13748  }
13749}
13750})()
13751  };
13752
13753  const AdminOfficialAccountsPage={
13754    components:{AdminFrame},
13755    setup(){
13756      const store=useGzcStore();const router=useRouter();const denied=ref(false);const sources=ref([]);const countries=ref([]);const sourceForm=reactive({country_code:'SD',authority_type:'embassy',name_ar:'',name_en:'',china_city:'Beijing',official_url:'',allowed_host:'',source_language:'ar',fetch_method:'html',trust_status:'pending',discovery_enabled:false,check_interval:'inherit',is_priority:false});
13757      function channelName(c){return ({embassy:'تعميمات السفارة',consulate:'تعميمات القنصلية',general:'إعلانات عامة'}[String(c||'')])||String(c||'-');}
13758      function accountTypeName(t){return ({embassy:'سفارة',consulate:'قنصلية'}[String(t||'')])||String(t||'-');}
13759      async function load(){if(!(await store.requireAdmin(router)))return;store.state.busy=true;const [r,src,ct]=await Promise.all([store.loadOfficialAccounts(router),api('/api/admin/official-sources'),api('/api/admin/platform-countries')]);store.state.busy=false;if(r&&r.status===403){denied.value=true;store.state.officialAccounts=[];store.state.msg=r.message||'هذه الصفحة متاحة فقط لمدير تقنية المعلومات';return;}denied.value=false;sources.value=safeArray(src.sources);countries.value=safeArray(ct.countries);}
13760      function cleanPhones(a){return safeArray(a._phones).map(norm).filter(Boolean).slice(0,3);}
13761      async function savePhones(a){const phones=cleanPhones(a);if(!phones.length){store.state.msg='أدخل رقم واحد على الأقل';return;}store.state.busy=true;const r=await api('/api/admin/official-accounts/'+encodeURIComponent(a.id)+'/phones',{method:'POST',body:JSON.stringify({phones})});store.state.busy=false;store.state.msg=r.message||r.error||'';await load();}
13762      async function saveStatus(a){store.state.busy=true;const r=await api('/api/admin/official-accounts/'+encodeURIComponent(a.id)+'/status',{method:'POST',body:JSON.stringify({status:a._status,can_publish:!!a._can_publish})});store.state.busy=false;store.state.msg=r.message||r.error||'';await load();}
13763      async function resetTour(a,p){if(!confirm('إعادة جولة الاستخدام لهذا الرقم؟ ستظهر له عند أول دخول قادم.'))return;store.state.busy=true;const r=await api('/api/admin/official-accounts/'+encodeURIComponent(a.id)+'/phones/'+encodeURIComponent(p.id)+'/tour/reset',{method:'POST'});store.state.busy=false;store.state.msg=r.message||r.error||'';await load();}
13764      // UI-002: سبب تعذّر تفعيل الاكتشاف — مرآة لحارس الخادم ولقيد قاعدة البيانات
13765      function sourceBlockReason(s){
13766        if(!s)return '';
13767        if(String(s.status||'')!=='active')return 'المصدر غير مفعّل';
13768        if(String(s.trust_status||'')!=='trusted')return 'الثقة ليست «موثوق»';
13769        const url=String(s.official_url||'');
13770        if(!/^https:\/\//.test(url))return 'الرابط الرسمي يجب أن يبدأ بـhttps';
13771        const host=String(s.allowed_host||'').trim().toLowerCase().replace(/^www\./,'');
13772        if(host.length<4)return 'النطاق المسموح غير محدد';
13773        let h='';try{h=new URL(url).hostname.toLowerCase().replace(/^www\./,'');}catch(e){return 'الرابط الرسمي غير صالح';}
13774        if(!(h===host||h.endsWith('.'+host)))return 'النطاق لا يطابق الرابط الرسمي';
13775        return '';
13776      }
13777      function sourceHealth(s){
13778        if(!s)return '';
13779        const parts=['الجلب: '+(s.fetch_method||'غير محدد')];
13780        parts.push(s.last_success_at?('آخر فحص ناجح '+shortDate(s.last_success_at)):'لم يُفحص بعد');
13781        if(Number(s.failure_count||0)>0)parts.push('إخفاقات متتالية '+s.failure_count);
13782        if(s.last_error_text)parts.push('آخر خطأ: '+String(s.last_error_text).slice(0,80));
13783        return parts.join(' · ');
13784      }
13785      async function addSource(){store.state.busy=true;const r=await api('/api/admin/official-sources',{method:'POST',body:JSON.stringify(sourceForm)});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok){sourceForm.name_ar='';sourceForm.name_en='';sourceForm.official_url='';sourceForm.allowed_host='';sourceForm.fetch_method='html';sourceForm.trust_status='pending';sourceForm.discovery_enabled=false;await load();}}
13786      async function saveSource(src){store.state.busy=true;const r=await api('/api/admin/official-sources/'+encodeURIComponent(src.id),{method:'POST',body:JSON.stringify(src)});store.state.busy=false;store.state.msg=r.message||r.error||'';await load();}
13787      const circ=reactive({rows:[],total:0,status:'pending_review',busy:false,msg:'',drafts:{}});
13788      async function loadCirc(){const r=await api('/api/admin/official-circulars/candidates?status='+encodeURIComponent(circ.status),{feedback:false});if(r&&r.ok){circ.rows=safeArray(r.rows);circ.total=r.total||0;for(const x of circ.rows)if(!circ.drafts[x.id])circ.drafts[x.id]={title:x.ai_title_ar||x.source_title||'',summary:x.summary_ar||'',confirm:false,note:''};}}
13789      async function decideCirc(x,action){const d=circ.drafts[x.id]||{};circ.busy=true;circ.msg='';const body={action,note:d.note,title:d.title,summary:d.summary,confirm_checked_against_source:!!d.c
13789onfirm,include_deadline:!!x.deadline_at};const r=await api('/api/admin/official-circulars/candidates/'+x.id+'/decision',{method:'POST',body:JSON.stringify(body),feedback:false});circ.busy=false;circ.msg=(r&&r.message)||'تعذر التنفيذ.';if(r&&r.ok)await loadCirc();}
13790      watch(()=>circ.status,loadCirc);
13791      onMounted(loadCirc);
13792      onMounted(load);
13793      return {circ,decideCirc,store,denied,sources,countries,sourceForm,load,savePhones,saveStatus,resetTour,addSource,saveSource,sourceBlockReason,sourceHealth,channelName,accountTypeName,shortDate,norm,safeArray};
13794    },
13795    render:(function(){
13796const _Vue = Vue
13797const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
13798
13799const _hoisted_1 = {
13800  key: 0,
13801  class: "card"
13802}
13803const _hoisted_2 = {
13804  key: 1,
13805  class: "card formCard"
13806}
13807const _hoisted_3 = { class: "editGrid" }
13808const _hoisted_4 = ["onUpdate:modelValue"]
13809const _hoisted_5 = ["value"]
13810const _hoisted_6 = ["onUpdate:modelValue"]
13811const _hoisted_7 = ["onUpdate:modelValue"]
13812const _hoisted_8 = { class: "check" }
13813const _hoisted_9 = ["onUpdate:modelValue"]
13814const _hoisted_10 = ["onUpdate:modelValue"]
13815const _hoisted_11 = ["onUpdate:modelValue"]
13816const _hoisted_12 = ["onUpdate:modelValue"]
13817const _hoisted_13 = ["value"]
13818const _hoisted_14 = ["onUpdate:modelValue"]
13819const _hoisted_15 = ["onUpdate:modelValue"]
13820const _hoisted_16 = ["onUpdate:modelValue"]
13821const _hoisted_17 = ["onUpdate:modelValue"]
13822const _hoisted_18 = ["onUpdate:modelValue"]
13823const _hoisted_19 = { class: "check" }
13824const _hoisted_20 = ["onUpdate:modelValue"]
13825const _hoisted_21 = ["onClick"]
13826const _hoisted_22 = { class: "hint" }
13827const _hoisted_23 = {
13828  key: 0,
13829  class: "hint"
13830}
13831const _hoisted_24 = ["onUpdate:modelValue"]
13832const _hoisted_25 = ["onUpdate:modelValue"]
13833const _hoisted_26 = { class: "check" }
13834const _hoisted_27 = ["onUpdate:modelValue"]
13835const _hoisted_28 = ["onUpdate:modelValue"]
13836const _hoisted_29 = { class: "check" }
13837const _hoisted_30 = ["onUpdate:modelValue"]
13838const _hoisted_31 = ["onClick"]
13839const _hoisted_32 = {
13840  key: 2,
13841  class: "card formCard circReview"
13842}
13843const _hoisted_33 = { class: "row" }
13844const _hoisted_34 = ["onClick"]
13845const _hoisted_35 = {
13846  key: 0,
13847  class: "hint"
13848}
13849const _hoisted_36 = { class: "aiGapHead" }
13850const _hoisted_37 = {
13851  key: 0,
13852  class: "statusPill"
13853}
13854const _hoisted_38 = { class: "hint ltr" }
13855const _hoisted_39 = ["href"]
13856const _hoisted_40 = { class: "hint" }
13857const _hoisted_41 = { key: 0 }
13858const _hoisted_42 = ["onUpdate:modelValue"]
13859const _hoisted_43 = ["onUpdate:modelValue"]
13860const _hoisted_44 = ["onUpdate:modelValue"]
13861const _hoisted_45 = { class: "check" }
13862const _hoisted_46 = ["onUpdate:modelValue"]
13863const _hoisted_47 = { class: "row" }
13864const _hoisted_48 = ["disabled", "onClick"]
13865const _hoisted_49 = ["disabled", "onClick"]
13866const _hoisted_50 = ["disabled", "onClick"]
13867const _hoisted_51 = {
13868  key: 1,
13869  class: "row"
13870}
13871const _hoisted_52 = ["onUpdate:modelValue"]
13872const _hoisted_53 = ["disabled", "onClick"]
13873const _hoisted_54 = ["disabled", "onClick"]
13874const _hoisted_55 = {
13875  class: "hint",
13876  role: "status",
13877  "aria-live": "polite"
13878}
13879const _hoisted_56 = {
13880  key: 3,
13881  class: "officialAdminGrid"
13882}
13883const _hoisted_57 = { class: "memberCardTop" }
13884const _hoisted_58 = { class: "hint ltr" }
13885const _hoisted_59 = { class: "statusPill" }
13886const _hoisted_60 = { class: "compactSummaryBar" }
13887const _hoisted_61 = {
13888  class: "collapseSection officialInlineSection",
13889  open: ""
13890}
13891const _hoisted_62 = { class: "collapseBody" }
13892const _hoisted_63 = { class: "editGrid" }
13893const _hoisted_64 = ["onUpdate:modelValue"]
13894const _hoisted_65 = ["onUpdate:modelValue"]
13895const _hoisted_66 = ["onUpdate:modelValue"]
13896const _hoisted_67 = ["onClick"]
13897const _hoisted_68 = { class: "collapseSection officialInlineSection" }
13898const _hoisted_69 = { class: "collapseBody" }
13899const _hoisted_70 = { class: "editGrid" }
13900const _hoisted_71 = ["onUpdate:modelValue"]
13901const _hoisted_72 = { class: "check" }
13902const _hoisted_73 = ["onUpdate:modelValue"]
13903const _hoisted_74 = ["onClick"]
13904const _hoisted_75 = {
13905  key: 0,
13906  class: "collapseSection officialInlineSection"
13907}
13908const _hoisted_76 = { class: "collapseBody" }
13909const _hoisted_77 = { dir: "ltr" }
13910const _hoisted_78 = { class: "statusPill" }
13911const _hoisted_79 = ["onClick"]
13912
13913return function render(_ctx, _cache) {
13914  with (_ctx) {
13915    const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, renderList: _renderList, Fragment: _Fragment, toDisplayString: _toDisplayString, vModelSelect: _vModelSelect, withDirectives: _withDirectives, vModelCheckbox: _vModelCheckbox, createTextVNode: _createTextVNode, vModelText: _vModelText, normalizeClass: _normalizeClass, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
13916
13917    const _component_AdminFrame = _resolveComponent("AdminFrame")
13918
13919    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "الحسابات الرسمية" }, {
13920      default: _withCtx(() => [
13921        _cache[28] || (_cache[28] = _createElementVNode("div", { class: "card noticeCard compactNotice" }, [_createElementVNode("span", { class: "vueBadge" }, "إدارة المنصة"), _createElementVNode("h3", null, "الجهات والمصادر الرسمية"), _createElementVNode("p", null, "إدارة حسابات السفارات والقنصليات ومصادر التعميمات الموثوقة لكل دولة. بحث AI لا يعمل على أي مصدر قبل اعتماده كمصدر موثوق وربطه بنطاق HTTPS مسموح.")], -1)),
13922        denied
13923          ? (_openBlock(), _createElementBlock("div", _hoisted_1, _c
13923ache[0] || (_cache[0] = [_createElementVNode("h3", null, "متاحة لمدير تقنية المعلومات فقط", -1), _createElementVNode("p", { class: "hint" }, "تُدار أرقام السفارة والقنصلية من هذه الصفحة حصراً بواسطة مدير تقنية المعلومات، لضمان تسجيل كل تعديل في سجل العمليات.", -1)])))
13924          : _createCommentVNode("", true),
13925        (!denied)
13926          ? (_openBlock(), _createElementBlock("section", _hoisted_2, [
13927              _cache[12] || (_cache[12] = _createElementVNode("h3", null, "مصادر التعميمات الرسمية", -1)),
13928              _cache[13] || (_cache[13] = _createElementVNode("p", { class: "hint" }, "أضف الموقع الرسمي أولاً. اترك البحث الآلي مقفلاً حتى تتأكد من النطاق ثم غيّر الثقة إلى موثوق وفعّل البحث.", -1)),
13929              _createElementVNode("div", _hoisted_3, [
13930                _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((sourceForm.country_code) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(countries, (c) => {
13931                  return (_openBlock(), _createElementBlock("option", {
13932                    key: c.code,
13933                    value: c.code
13934                  }, _toDisplayString(c.name_ar) + " / " + _toDisplayString(c.name_en), 9, _hoisted_5))
13935                }), 128))], 8, _hoisted_4), [[_vModelSelect, sourceForm.country_code]]),
13936                _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((sourceForm.authority_type) = $event) }, _cache[1] || (_cache[1] = [
13937                  _createElementVNode("option", { value: "embassy" }, "سفارة", -1),
13938                  _createElementVNode("option", { value: "consulate" }, "قنصلية", -1),
13939                  _createElementVNode("option", { value: "mission" }, "بعثة", -1),
13940                  _createElementVNode("option", { value: "official_body" }, "جهة رسمية", -1),
13941                  _createElementVNode("option", { value: "foreign_ministry" }, "وزارة خارجية", -1),
13942                  _createElementVNode("option", { value: "government_authority" }, "جهة حكومية", -1),
13943                  _createElementVNode("option", { value: "chinese_authority" }, "جهة صينية", -1),
13944                  _createElementVNode("option", { value: "other_approved_official" }, "جهة رسمية معتمدة أخرى", -1)
13945                ]), 8, _hoisted_6), [[_vModelSelect, sourceForm.authority_type]]),
13946                _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((sourceForm.check_interval) = $event) }, _cache[2] || (_cache[2] = [
13947                  _createElementVNode("option", { value: "inherit" }, "الفحص: حسب الإعدادات", -1),
13948                  _createElementVNode("option", { value: "6h" }, "كل 6 ساعات", -1),
13949                  _createElementVNode("option", { value: "12h" }, "كل 12 ساعة", -1),
13950                  _createElementVNode("option", { value: "24h" }, "كل 24 ساعة", -1),
13951                  _createElementVNode("option", { value: "manual" }, "يدوي فقط", -1)
13952                ]), 8, _hoisted_7), [[_vModelSelect, sourceForm.check_interval]]),
13953                _createElementVNode("label", _hoisted_8, [_withDirectives(_createElementVNode("input", {
13954                  type: "checkbox",
13955                  "onUpdate:modelValue": $event => ((sourceForm.is_priority) = $event)
13956                }, null, 8, _hoisted_9), [[_vModelCheckbox, sourceForm.is_priority]]), _cache[3] || (_cache[3] = _createTextVNode(" مصدر أولوية"))]),
13957                _withDirectives(_createElementVNode("input", {
13958                  "onUpdate:modelValue": $event => ((sourceForm.name_ar) = $event),
13959                  placeholder: "اسم الجهة بالعربي"
13960                }, null, 8, _hoisted_10), [[_vModelText, sourceForm.name_ar]]),
13961                _withDirectives(_createElementVNode("input", {
13962                  "onUpdate:modelValue": $event => ((sourceForm.name_en) = $event),
13963                  placeholder: "Official name"
13964                }, null, 8, _hoisted_11), [[_vModelText, sourceForm.name_en]]),
13965                _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((sourceForm.china_city) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList($cityList(sourceForm.china_city), (c) => {
13966                  return (_openBlock(), _createElementBlock("option", {
13967                    key: c.value,
13968                    value: c.value
13969                  }, _toDisplayString(c.label), 9, _hoisted_13))
13970                }), 128))], 8, _hoisted_12), [[_vModelSelect, sourceForm.china_city]]),
13971                _withDirectives(_createElementVNode("input", {
13972                  class: "ltr",
13973                  "onUpdate:modelValue": $event => ((sourceForm.official_url) = $event),
13974                  placeholder: "https://official.example/..."
13975                }, null, 8, _hoisted_14), [[_vModelText, sourceForm.official_url]]),
13976                _withDirectives(_createElementVNode("input", {
13977                  class: "ltr",
13978                  "onUpdate:modelValue": $event => ((sourceForm.allowed_host) = $event),
13979                  placeholder: "official.example"
13980                }, null, 8, _hoisted_15), [[_vModelText, sourceForm.allowed_host]]),
13981                _withDirectives(_createElementVNode("input", {
13982                  "onUpdate:modelValue": $event => ((sourceForm.source_language) = $event),
13983                  placeholder: "ar / en / fr"
13984                }, null, 8, _hoisted_16), [[_vModelText, sourceForm.source_language]]),
13985                _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((sourceForm.fetch_method) = $event) }, _cache[4] || (_cache[4] = [
13986                  _createElementVNode("option", { value: "" }, "طريقة الجلب", -1),
13987                  _createElementVNode("option", { value: "html" }, "HTML", -1),
13988                  _createElementVNode("option", { value: "rss" }, "RSS", -1),
13989                  _createElementVNode("option", { value: "sitemap" }, "Sitemap", -1),
13990                  _createElementVNode("option", { value: "pdf" }, "PDF", -1)
13991                ]), 8, _hoisted_17), [[_vModelSelect, sourceForm.fetch_method]]),
13992                _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((sourceForm.trust_status) = $event) }, _cache[5] || (_cache[5] = [
13993                  _createElementVNode("option", { value: "pending" }, "بانتظار التحقق", -1),
13994                  _createElementVNode("option", { value: "trusted" }, "موثوق", -1),
13995                  _createElementVNode("option", { value: "suspended" }, "موقوف", -1),
13996                  _createElementVNode("option", { value: "rejected" }, "مرفوض", -1)
13997                ]), 8, _hoisted_18), [[_vModelSelect, sourceForm.trust_status]]),
13998                _createElementVNode("label", _hoisted_19, [_withDirectives(_createElementVNode("input", {
13999                  type: "checkbox",
14000                  "onUpdate:modelValue": $event => ((sourceForm.discovery_enabled) = $event)
14001                }, null, 8, _hoisted_20), [[_vModelCheckbox, sourceForm.discovery_enabled]]), _cache[6] || (_cache[6] = _createTextVNode(" تفعيل بحث AI لهذا المصدر"))])
14002              ]),
14003              _createElementVNode("button", {
14004                class: "btn",
14005                onClick: addSource
14006              }, "إضافة المصدر", 8, _hoisted_21),
14007              (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(sources, (src) => {
14008                return (_openBlock(), _createElementBlock("div", {
14009                  class: "committeeRow",
14010                  key: src.id
14011                }, [
14012                  _createElementVNode("div", null, [
14013                    _createElementVNode("b", null, _toDisplayString(src.country_name_ar) + " — " + _toDisplayString(src.name_ar), 1),
14014                    _createElementVNode("small", null, _toDisplayString(src.authority_type) + " · " + _toDisplayString($cityLabel(src.china_city) || '-') + " · " + _toDisplayString(src.allowed_host || 'لم يحدد النطاق بعد'), 1),
14015                    _createElementVNode("small", _hoisted_22, _toDisplayString(sourceHealth(src)), 1),
14016                    (sourceBlockReason(src))
14017                      ? (_openBlock(), _createElementBlock("small", _hoisted_23, "⚠ " + _toDisplayString(sourceBlockReason(src)), 1))
14018                      : _createCommentVNode("", true)
14019                  ]),
14020                  _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((src.fetch_method) = $event) }, _cache[7] || (_cache[7] = [
14021                    _createElementVNode("option", { value: "" }, "طريقة الجلب", -1),
14022                    _createElementVNode("option", { value: "html" }, "HTML", -1),
14023                    _createElementVNode("option", { value: "rss" }, "RSS", -1),
14024                    _createElementVNode("option", { value: "sitemap" }, "Sitemap", -1),
14025                    _createElementVNode("option", { value: "pdf" }, "PDF", -1)
14026                  ]), 8, _hoisted_24), [[_vModelSelect, src.fetch_method]]),
14027                  _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((src.check_interval) = $event) }, _cache[8] || (_cache[8] = [
14028                    _createElementVNode("option", { value: "inherit" }, "حسب الإعدادات", -1),
14029                    _createElementVNode("option", { value: "6h" }, "6 ساعات", -1),
14030                    _createElementVNode("option", { value: "12h" }, "12 ساعة", -1),
14031                    _createElementVNode("option", { value: "24h" }, "24 ساعة", -1),
14032                    _createElementVNode("option", { value: "manual" }, "يدوي", -1)
14033                  ]), 8, _hoisted_25), [[_vModelSelect, src.check_interval]]),
14034                  _createElementVNode("label", _hoisted_26, [_withDirectives(_createElementVNode("input", {
14035                    type: "checkbox",
14036                    "onUpdate:modelValue": $event => ((src.is_priority) = $event)
14037                  }, null, 8, _hoisted_27), [[_vModelCheckbox, src.is_priority]]), _cache[9] || (_cache[9] = _createTextVNode(" أولوية"))]),
14038                  _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((src.trust_status) = $event) }, _cache[10] || (_cache[10] = [
14039                    _createElementVNode("option", { value: "pending" }, "بانتظار التحقق", -1),
14040                    _createElementVNode("option", { value: "trusted" }, "موثوق", -1),
14041                    _createElementVNode("option", { value: "suspended" }, "موقوف", -1),
14042                    _createElementVNode("option", { value: "rejected" }, "مرفوض", -1)
14043                  ]), 8, _hoisted_28), [[_vModelSelect, src.trust_status]]),
14044                  _createElementVNode("label", _hoisted_29, [_withDirectives(_createElementVNode("input", {
14045                    type: "checkbox",
14046                    "onUpdate:modelValue": $event => ((src.discovery_enabled) = $event)
14047                  }, null, 8, _hoisted_30), [[_vModelCheckbox, src.discovery_enabled]]), _cache[11] || (_cache[11] = _createTextVNode(" AI"))]),
14048                  _createElementVNode("button", {
14049                    class: "smallbtn secondary",
14050                    onClick: $event => (saveSource(src))
14051                  }, "حفظ", 8, _hoisted_31)
14052                ]))
14053              }), 128))
14054            ]))
14055          : _createCommentVNode("", true),
14056        (!denied)
14057          ? (_openBlock(), _createElementBlock("section", _hoisted_32, [
14058              _cache[15] || (_cache[15] = _createElementVNode("h3", null, "مراجعة التعميمات المقترحة", -1)),
14059              _cache[16] || (_cache[16] = _createElementVNode("p", { class: "hint" }, "يقترح الذكاء الاصطناعي عنواناً وملخصاً فقط. لا يُنشر شيء قبل أن تطابق النص مع المصدر الرسمي وتؤكد.", -1)),
14060              _createElementVNode("div", _hoisted_33, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(['pending_review','published','rejected','duplicate'], (s) => {
14061                return (_openBlock(), _createElementBlock("button", {
14062                  key: s,
14063                  type: "button",
14064                  class: _normalizeClass(['smallbtn',circ.status===s?'':'secondary']),
14065                  onClick: $event => (circ.status=s)
14066                }, _toDisplayString(({pending_review:'بانتظار المراجعة',published:'منشور',rejected:'مرفوض',duplicate:'مكرر'})[s]), 11, _hoisted_34))
14067              }), 128))]),
14068              (!circ.rows.length)
14069                ? (_openBlock(), _createElementBlock("p", _hoisted_35, "لا عناصر."))
14070                : _createCommentVNode("", true),
14071              (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(circ.rows, (x) => {
14072                return (_openBlock(), _createElementBlock("article", {
14073                  key: x.id,
14074                  class: "aiGapCard"
14075                }, [
14076                  _createElementVNode("div", _hoisted_36, [_createElementVNode("b", null, _toDisplayString(x.source_name_ar), 1), (x.content_changed_at)
14077                    ? (_openBlock(), _createElementBlock("span", _hoisted_37, "تغيّر بعد الاعتماد"))
14078                    : _createCommentVNode("", true)]),
14079                  _createElementVNode("small", _hoisted_38, [_createElementVNode("a", {
14080                    href: x.source_url,
14081                    target: "_blank",
14082                    rel: "noopener noreferrer"
14083                  }, _toDisplayString(x.source_title||x.source_url), 9, _hoisted_39)]),
14084                  _createElementVNode("small", _hoisted_40, [_createTextVNode(_toDisplayString(x.classification||'-') + " · أهمية " + _toDisplayString(x.urgency) + " · ثقة " + _toDisplayString(x.confidence_score==null?'-':x.confidence_score), 1), (x.deadline_at)
14085                    ? (_openBlock(), _createElementBlock("span", _hoisted_41, " · موعد مذكور: " + _toDisplayString(shortDate(x.deadline_at)) + " (تحقق منه)", 1))
14086                    : _createCommentVNode("", true)]),
14087                  (circ.drafts[x.id]&&(x.status==='pending_review'||x.status==='approved'))
14088                    ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [
14089                        _withDirectives(_createElementVNode("input", {
14090                          "onUpdate:modelValue": $event => ((circ.drafts[x.id].title) = $event),
14091                          maxlength: "300"
14092                        }, null, 8, _hoisted_42), [[_vModelText, circ.drafts[x.id].title]]),
14093                        _withDirectives(_createElementVNode("textarea", {
14094                          "onUpdate:modelValue": $event => ((circ.drafts[x.id].summary) = $event),
14095                          rows: "3",
14096                          maxlength: "900"
14097                        }, null, 8, _hoisted_43), [[_vModelText, circ.drafts[x.id].summary]]),
14098                        _withDirectives(_createElementVNode("input", {
14099                          "onUpdate:modelValue": $event => ((circ.drafts[x.id].note) = $event),
14100                          placeholder: "سبب الرفض (للرفض فقط)",
14101                          maxlength: "300"
14102                        }, null, 8, _hoisted_44), [[_vModelText, circ.drafts[x.id].note]]),
14103                        _createElementVNode("label", _hoisted_45, [_withDirectives(_createElementVNode("input", {
14104                          type: "checkbox",
14105                          "onUpdate:modelValue": $event => ((circ.drafts[x.id].confirm) = $event)
14106                        }, null, 8, _hoisted_46), [[_vModelCheckbox, circ.drafts[x.id].confirm]]), _cache[14] || (_cache[14] = _createTextVNode(" طابقت العنوان والملخص مع المصدر الرسمي"))]),
14107                        _createElementVNode("div", _hoisted_47, [_createElementVNode("button", {
14108                          class: "smallbtn",
14109                          type: "button",
14110                          disabled: circ.busy||!circ.drafts[x.id].confirm,
14111                          onClick: $event => (decideCirc(x,'publish'))
14112                        }, "نشر", 8, _hoisted_48), _createElementVNode("button", {
14113                          class: "smallbtn secondary",
14114                          type: "button",
14115                          disabled: circ.busy,
14116                          onClick: $event => (decideCirc(x,'reject'))
14117                        }, "رفض", 8, _hoisted_49), _createElementVNode("button", {
14118                          class: "smallbtn secondary",
14119                          type: "button",
14120                          disabled: circ.busy,
14121                          onClick: $event => (decideCirc(x,'duplicate'))
14122                        }, "مكرر", 8, _hoisted_50)])
14123                      ], 64))
14124                    : _createCommentVNode("", true),
14125                  (x.status==='published'&&x.content_changed_at&&circ.drafts[x.id])
14126                    ? (_openBlock(), _createElementBlock("div", _hoisted_51, [_withDirectives(_createElementVNode("input", {
14127                        "onUpdate:modelValue": $event => ((circ.drafts[x.id].note) = $event),
14128                        placeholder: "سبب سحب النشر",
14129                        maxlength: "300"
14130                      }, null, 8, _hoisted_52), [[_vModelText, circ.drafts[x.id].note]]), _createElementVNode("button", {
14131                        class: "smallbtn",
14132                        type: "button",
14133                        disabled: circ.busy,
14134                        onClick: $event => (decideCirc(x,'acknowledge_change'))
14135                      }, "سليم", 8, _hoisted_53), _createElementVNode("button", {
14136                        class: "smallbtn secondary",
14137                        type: "button",
14138                        disabled: circ.busy||!circ.drafts[x.id].note,
14139                        onClick: $event => (decideCirc(x,'unpublish'))
14140                      }, "سحب النشر", 8, _hoisted_54)]))
14141                    : _createCommentVNode("", true)
14142                ]))
14143              }), 128)),
14144              _createElementVNode("p", _hoisted_55, _toDisplayString(circ.msg), 1)
14145            ]))
14146          : _createCommentVNode("", true),
14147        (!denied)
14148          ? (_openBlock(), _createElementBlock("div", _hoisted_56, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(store.state.officialAccounts, (a) => {
14149              return (_openBlock(), _createElementBlock("div", {
14150                class: "card supervisorCard officialAccountAdminCard",
14151                key: a.id
14152              }, [
14153                _createElementVNode("div", _hoisted_57, [_createElementVNode("div", null, [_createElementVNode("h3", null, _toDisplayString(a.name_ar), 1), _createElementVNode("p", _hoisted_58, _toDisplayString(a.account_key), 1)]), _createElementVNode("span", _hoisted_59, _toDisplayString(a._status), 1)]),
14154                _createElementVNode("div", _hoisted_60, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(accountTypeName(a.account_type)), 1
14154), _cache[17] || (_cache[17] = _createElementVNode("small", null, "النوع", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(channelName(a.channel)), 1), _cache[18] || (_cache[18] = _createElementVNode("small", null, "قناة النشر", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(safeArray(a.phones).length), 1), _cache[19] || (_cache[19] = _createElementVNode("small", null, "أرقام دخول", -1))])]),
14155                _createElementVNode("details", _hoisted_61, [_cache[21] || (_cache[21] = _createElementVNode("summary", null, [_createElementVNode("b", null, "أرقام الدخول"), _createElementVNode("span", null, "حد أقصى 3")], -1)), _createElementVNode("div", _hoisted_62, [_cache[20] || (_cache[20] = _createElementVNode("p", { class: "hint" }, "أي رقم من الثلاثة يفتح نفس الحساب الرسمي. اكتب الأرقام بصيغة دولية بدون +.", -1)), _createElementVNode("div", _hoisted_63, [_withDirectives(_createElementVNode("input", {
14156                  class: "ltr",
14157                  "onUpdate:modelValue": $event => ((a._phones[0]) = $event),
14158                  placeholder: "رقم الدخول 1"
14159                }, null, 8, _hoisted_64), [[_vModelText, a._phones[0]]]), _withDirectives(_createElementVNode("input", {
14160                  class: "ltr",
14161                  "onUpdate:modelValue": $event => ((a._phones[1]) = $event),
14162                  placeholder: "رقم الدخول 2"
14163                }, null, 8, _hoisted_65), [[_vModelText, a._phones[1]]]), _withDirectives(_createElementVNode("input", {
14164                  class: "ltr",
14165                  "onUpdate:modelValue": $event => ((a._phones[2]) = $event),
14166                  placeholder: "رقم الدخول 3"
14167                }, null, 8, _hoisted_66), [[_vModelText, a._phones[2]]])]), _createElementVNode("button", {
14168                  class: "btn loadMore",
14169                  onClick: $event => (savePhones(a))
14170                }, "حفظ أرقام الدخول", 8, _hoisted_67)])]),
14171                _createElementVNode("details", _hoisted_68, [_cache[25] || (_cache[25] = _createElementVNode("summary", null, [_createElementVNode("b", null, "الحالة والنشر"), _createElementVNode("span")], -1)), _createElementVNode("div", _hoisted_69, [_createElementVNode("div", _hoisted_70, [_withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((a._status) = $event) }, _cache[22] || (_cache[22] = [_createElementVNode("option", { value: "active" }, "مفعل", -1), _createElementVNode("option", { value: "disabled" }, "معطل", -1), _createElementVNode("option", { value: "archived" }, "مؤرشف", -1)]), 8, _hoisted_71), [[_vModelSelect, a._status]]), _createElementVNode("label", _hoisted_72, [_withDirectives(_createElementVNode("input", {
14172                  type: "checkbox",
14173                  "onUpdate:modelValue": $event => ((a._can_publish) = $event)
14174                }, null, 8, _hoisted_73), [[_vModelCheckbox, a._can_publish]]), _cache[23] || (_cache[23] = _createTextVNode(" السماح بنشر تعميم رسمي"))])]), _cache[24] || (_cache[24] = _createElementVNode("p", { class: "hint" }, "حتى مع صلاحية النشر، الحساب الرسمي لا يستطيع تعديل الأعضاء أو الحالات أو الطوارئ.", -1)), _createElementVNode("button", {
14175                  class: "btn secondary",
14176                  onClick: $event =>
14176 (saveStatus(a))
14177                }, "حفظ الحالة", 8, _hoisted_74)])]),
14178                (safeArray(a.phones).length)
14179                  ? (_openBlock(), _createElementBlock("details", _hoisted_75, [_cache[27] || (_cache[27] = _createElementVNode("summary", null, [_createElementVNode("b", null, "الأرقام الحالية"), _createElementVNode("span")], -1)), _createElementVNode("div", _hoisted_76, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(a.phones, (p) => {
14180                      return (_openBlock(), _createElementBlock("div", {
14181                        class: "committeeRow",
14182                        key: p.id
14183                      }, [_createElementVNode("div", null, [_createElementVNode("b", _hoisted_77, _toDisplayString(p.phone), 1), _createElementVNode("small", null, [_createTextVNode(_toDisplayString(p.label || '-') + " — آخر تحديث " + _toDisplayString(shortDate(p.updated_at || p.created_at)), 1), _cache[26] || (_cache[26] = _createElementVNode("br", null, null, -1)), _createTextVNode("الجولة: " + _toDisplayString(p.tour_seen_at ? ('تمت ' + shortDate(p.tour_seen_at)) : 'لم تظهر بعد / ستظهر عند الدخول القادم'), 1)])]), _createElementVNode("span", _hoisted_78, _toDisplayString(p.status), 1), _createElementVNode("button", {
14184                        class: "smallbtn secondary",
14185                        onClick: $event => (resetTour(a,p))
14186                      }, "إعادة الجولة", 8, _hoisted_79)]))
14187                    }), 128))])]))
14188                  : _createCommentVNode("", true)
14189              ]))
14190            }), 128))]))
14191          : _createCommentVNode("", true)
14192      ]),
14193      _: 1,
14194      __: [28]
14195    }))
14196  }
14197}
14198})()
14199  };
14200
14201
14202  const AdminOptionsPage={
14203    components:{AdminFrame},
14204    setup(){
14205      const store=useGzcStore();const router=useRouter();const form=reactive({group_key:'china_city',parent_key:'',option_key:'',name_ar:'',name_en:'',sort_order:100});
14206      const groups=computed(()=>safeArray(store.state.platformOptions.groups));
14207      const options=computed(()=>store.state.platformOptions.options||{});
14208      const currentRows=computed(()=>safeArray(options.value[form.group_key]));
14209      const cityParents=computed(()=>safeArray(options.value.china_city).filter(x=>x.status==='active'));
14210      const needsParent=computed(()=>form.group_key==='china_district');
14211      function label(o){return (o.name_ar||o.name_en||o.option_key||'-')+(o.parent_key?' — '+o.parent_key:'');}
14212      async function load(){if(await store.requireAdmin(router)){await store.loadPlatformOptions(router);if(!groups.value.some(g=>g.key===form.group_key)&&groups.value[0])form.group_key=groups.value[0].key;}}
14213      function editOption(o){form.group_key=o.group_key;form.parent_key=o.parent_key||'';form.option_key=o.option_key||'';form.name_ar=o.name_ar||'';form.name_en=o.name_en||'';form.sort_order=o.sort_order||100;window.scrollTo({top:0,behavior:'smooth'});}
14214      function resetForm(){form.parent_key='';form.option_key='';form.name_ar='';form.name_en='';form.sort_order=100;}
14215      onMounted(load);watch(()=>form.group_key,()=>{if(!needsParent.value)form.parent_key='';});
14216      async function save(){if(needsParent.value&&!form.parent_key){store.state.msg='اختر المدينة أولاً لهذا الحي';return;}store.state.busy=true;const r=await api('/api/admin/options',{method:'POST',body:JSON.stringify(form)});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok){resetForm();await load();}}
14217      async function setStatus(o,st){store.state.busy=true;const r=await api('/api/admin/options/'+encodeURIComponent(o.id)+'/status',{method:'POST',body:JSON.stringify({status:st})});store.state.busy=false;store.state.msg=r.message||r.error||'';await load();}
14218      return {store,form,groups,options,currentRows,cityParents,needsParent,label,load,save,setStatus,editOption,resetForm};
14219    },
14220    render:(function(){
14221const _Vue = Vue
14222const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
14223
14224const _hoisted_1 = {
14225  class: "card collapseSection formCard",
14226  open: ""
14227}
14228const _hoisted_2 = { class: "collapseBody" }
14229const _hoisted_3 = { class: "editGrid" }
14230const _hoisted_4 = ["onUpdate:modelValue"]
14231const _hoisted_5 = ["value"]
14232const _hoisted_6 = ["onUpdate:modelValue"]
14233const _hoisted_7 = ["value"]
14234const _hoisted_8 = ["onUpdate:modelValue"]
14235const _hoisted_9 = ["onUpdate:modelValue"]
14236const _hoisted_10 = ["onUpdate:modelValue"]
14237const _hoisted_11 = ["onUpdate:modelValue"]
14238const _hoisted_12 = { class: "memberActions" }
14239const _hoisted_13 = ["onClick"]
14240const _hoisted_14 = ["onClick"]
14241const _hoisted_15 = { class: "card" }
14242const _hoisted_16 = { class: "segmented queueSegmentPro" }
14243const _hoisted_17 = ["onClick"]
14244const _hoisted_18 = { class: "ltr" }
14245const _hoisted_19 = { class: "memberActions" }
14246const _hoisted_20 = ["onClick"]
14247const _hoisted_21 = ["onClick"]
14248const _hoisted_22 = ["onClick"]
14249const _hoisted_23 = ["onClick"]
14250
14251return function render(_ctx, _cache) {
14252  with (_ctx) {
14253    const { createElementVNode: _createElementVNode, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, toDisplayString: _toDisplayString, vModelSelect: _vModelSelect, withDirectives: _withDirectives, createCommentVNode: _createCommentVNode, vModelText: _vModelText, normalizeClass: _normalizeClass, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
14254
14255    const _component_AdminFrame = _resolveComponent("AdminFrame")
14256
14257    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "إدارة قوائم النظام" }, {
14258      default: _withCtx(() => [
14259        _cache[3] || (_cache[3] = _createElementVNode("div", { class: "card noticeCard compactNotice" }, [_createElementVNode("span", { class: "vueBadge" }, "إدارة المنصة"), _createElementVNode("h3", null, "كل خيارات القوائم من هنا"), _createElementVNode("p", null, "أي حقل له خيارات معروفة يتم التحكم فيه من هذه الصفحة: المدن، الأحياء، الجنس، نوع العضو، حالات الطلبات، الفعاليات، الإعلانات، ودليل الصين. لا كتابة حرة في القوائم بعد الآن.")], -1)),
14260        _createElementVNode("details", _hoisted_1, [_cache[1] || (_cache[1] = _createElementVNode("summary", null, [_createElementVNode("b", null, "إضافة / تعديل خيار"), _createElementVNode("span")], -1)), _createElementVNode("div", _hoisted_2, [_createElementVNode("div", _hoisted_3, [
14261          _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((form.group_key) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(groups, (g) => {
14262            return (_openBlock(), _createElementBlock("option", {
14263              value: g.key,
14264              key: g.key
14265            }, _toDisplayString(g.name || g.key) + " — " + _toDisplayString(g.key), 9, _hoisted_5))
14266          }), 128))], 8, _hoisted_4), [[_vModelSelect, form.group_key]]),
14267          needsParent
14268            ? _withDirectives((_openBlock(), _createElementBlock("select", {
14269                key: 0,
14270                "onUpdate:modelValue": $event => ((form.parent_key) = $event)
14271              }, [_cache[0] || (_cache[0] = _createElementVNode("option", { value: "" }, "اختر المدينة التابعة", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(cityParents, (c) => {
14272                return (_openBlock(), _createElementBlock("option", {
14273                  key: c.option_key,
14274                  value: c.option_key
14275                }, _toDisplayString(c.name_ar || c.option_key), 9, _hoisted_7))
14276              }), 128))], 8, _hoisted_6)), [[_vModelSelect, form.parent_key]])
14277            : _createCommentVNode("", true),
14278          _withDirectives(_createElementVNode("input", {
14279            "onUpdate:modelValue": $event => ((form.name_ar) = $event),
14280            placeholder: "الاسم بالعربي"
14281          }, null, 8, _hoisted_8), [[_vModelText, form.name_ar]]),
14282          _withDirectives(_createElementVNode("input", {
14283            "onUpdate:modelValue": $event => ((form.name_en) = $event),
14284            placeholder: "English name"
14285          }, null, 8, _hoisted_9), [[_vModelText, form.name_en]]),
14286          _withDirectives(_createElementVNode("input", {
14287            class: "ltr",
14288            "onUpdate:modelValue": $event => ((form.option_key) = $event),
14289            placeholder: "option_key اختياري"
14290          }, null, 8, _hoisted_10), [[_vModelText, form.option_key]]),
14291          _withDirectives(_createElementVNode("input", {
14292            type: "number",
14293            "onUpdate:modelValue": $event => ((form.sort_order) = $event),
14294            placeholder: "الترتيب"
14295          }, null, 8, _hoisted_11), [[_vModelText, form.sort_order]])
14296        ]), _createElementVNode("div", _hoisted_12, [_createElementVNode("button", {
14297          class: "btn",
14298          onClick: save
14299        }, "حفظ الخيار", 8, _hoisted_13), _createElementVNode("button", {
14300          class: "btn secondary",
14301          onClick: resetForm
14302        }, "تفريغ", 8, _hoisted_14)])])]),
14303        _createElementVNode("div", _hoisted_15, [_cache[2] || (_cache[2] = _createElementVNode("h3", null, "القوائم", -1)), _createElementVNode("div", _hoisted_16, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(groups, (g) => {
14304          return (_openBlock(), _createElementBlock("button", {
14305            key: g.key,
14306            class: _normalizeClass({active:form.group_key===g.key}),
14307            onClick: $event => (form.group_key=g.key)
14308          }, [_createElementVNode("b", null, _toDisplayString(g.name), 1), _createElementVNode("small", null, _toDisplayString(g.count), 1)], 10, _hoisted_17))
14309        }), 128))])]),
14310        (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(currentRows, (o) => {
14311          return (_openBlock(), _createElementBlock("div", {
14312            class: "card optionAdminRow",
14313            key: o.id||o.option_key
14314          }, [_createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(label(o)), 1), _createElementVNode("small", _hoisted_18, _toDisplayString(o.group_key) + " / " + _toDisplayString(o.parent_key || '-') + " / " + _toDisplayString(o.option_key), 1)]), _createElementVNode("span", { class: _normalizeClass(["statusPill", o.status]) }, _toDisplayString(o.status), 3), _createElementVNode("div", _hoisted_19, [
14315            _createElementVNode("button", {
14316              class: "smallbtn",
14317              onClick: $event => (editOption(o))
14318            }, "تعديل", 8, _hoisted_20),
14319            (o.status!=='active')
14320              ? (_openBlock(), _createElementBlock("button", {
14321                  key: 0,
14322                  class: "smallbtn",
14323                  onClick: $event => (setStatus(o,'active'))
14324                }, "تفعيل", 8, _hoisted_21))
14325              : _createCommentVNode("", true),
14326            (o.status==='active')
14327              ? (_openBlock(), _createElementBlock("button", {
14328                  key: 1,
14329                  class: "smallbtn",
14330                  onClick: $event => (setStatus(o,'disabled'))
14331                }, "تعطيل", 8, _hoisted_22))
14332              : _createCommentVNode("", true),
14333            _createElementVNode("button", {
14334              class: "smallbtn danger",
14335              onClick: $event => (setStatus(o,'archived'))
14336            }, "حذف", 8, _hoisted_23)
14337          ])]))
14338        }), 128))
14339      ]),
14340      _: 1,
14341      __: [3]
14342    }))
14343  }
14344}
14345})()
14346  };
14347
14348  const IdentityAdminNav={
14349    setup(){const route=useRoute();function active(p){return route.path===p;}return{active};},
14350    render:(function(){
14351const _Vue = Vue
14352const { createVNode: _createVNode, createTextVNode: _createTextVNode } = _Vue
14353
14354const _hoisted_1 = {
14355  class: "identityAdminNav",
14356  "aria-label": "مركز هوية المنصة"
14357}
14358
14359return function render(_ctx, _cache) {
14360  with (_ctx) {
14361    const { createTextVNode: _createTextVNode, resolveComponent: _resolveComponent, normalizeClass: _normalizeClass, withCtx: _withCtx, createVNode: _createVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
14362
14363    const _component_router_link = _resolveComponent("router-link")
14364
14365    return (_openBlock(), _createElementBlock("nav", _hoisted_1, [
14366      _createVNode(_component_router_link, {
14367        to: "/admin/platform",
14368        class: _normalizeClass({active:active('/admin/platform')})
14369      }, {
14370        default: _withCtx(() => _cache[0] || (_cache[0] = [_createTextVNode("هوية المنصة")])),
14371        _: 1,
14372        __: [0]
14373      }, 8, ["class"]),
14374      _createVNode(_component_router_link, {
14375        to: "/admin/community",
14376        class: _normalizeClass({active:active('/admin/community')})
14377      }, {
14378        default: _withCtx(() => _cache[1] || (_cache[1] = [_createTextVNode("عن المنصة")])),
14379        _: 1,
14380        __: [1]
14381      }, 8, ["class"]),
14382      _createVNode(_component_router_link, {
14383        to: "/admin/communities",
14384        class: _normalizeClass({active:active('/admin/communities')})
14385      }, {
14386        default: _withCtx(() => _cache[2] || (_cache[2] = [_createTextVNode("المجتمعات")])),
14387        _: 1,
14388        __: [2]
14389      }, 8, ["class"]),
14390      _createVNode(_component_router_link, {
14391        to: "/admin/brand-assets",
14392        class: _normalizeClass({active:active('/admin/brand-assets')})
14393      }, {
14394        default: _withCtx(() => _cache[3] || (_cache[3] = [_createTextVNode("الأصول البصرية")])),
14395        _: 1,
14396        __: [3]
14397      }, 8, ["class"])
14398    ]))
14399  }
14400}
14401})()
14402  };
14403
14404  const AdminCommunitiesPage={
14405    components:{AdminFrame,IdentityAdminNav},
14406    setup(){
14407      const store=useGzcStore();const router=useRouter();
14408      const form=reactive({id:null,name_ar:'',name_en:'',slug:'',main_city:'',coverage_cities:'',about_ar:'',about_en:'',hero_image_url:'',sort_order:100,status:'active'});
14409      const heroFile=ref(null), heroName=ref('لم يتم اختيار صورة');
14410      async function load(){if(await store.requireAdmin(router))await store.loadCommunities(router);}
14411      function edit(c){Object.assign(form,{id:c.id,name_ar:c.name_ar||'',name_en:c.name_en||'',slug:c.slug||'',main_city:c.main_city||'',coverage_cities:safeArray(c.coverage_cities).join(', '),about_ar:c.about_ar||'',about_en:c.about_en||'',hero_image_url:c.hero_image_url||'',sort_order:c.sort_order||100,status:c.status||'active'});heroFile.value=null;heroName.value='لم يتم اختيار صورة';window.scrollTo({top:0,behavior:'smooth'});}
14412      function clear(){Object.assign(form,{id:null,name_ar:'',name_en:'',slug:'',main_city:'',coverage_cities:'',about_ar:'',about_en:'',hero_image_url:'',sort_order:100,status:'active'});heroFile.value=null;heroName.value='لم يتم اختيار صورة';}
14413      function onHeroFile(e){const f=e.target.files&&e.target.files[0];heroFile.value=f||null;heroName.value=f?f.name:'لم يتم اختيار صورة';}
14414      async function uploadHero(id){if(!heroFile.value||!id)return null;const fd=new FormData();fd.append('file',heroFile.value);return await uploadApi('/api/admin/communities/'+encodeURIComponent(id)+'/hero',{method:'POST',body:fd,headers:{'Accept':'application/json'},uploadLabel:'رفع صورة المجتمع'});}
14415      async function save(){store.state.busy=true;const payload=Object.assign({},form,{coverage_cities:String(form.coverage_cities||'').split(',').map(x=>x.trim()).filter(Boolean)});let r=await api('/api/admin/communities',{method:'POST',body:JSON.stringify(payload)});let msg=r.message||r.error||'';if(r.ok&&heroFile.value&&r.community&&r.community.id){const up=await uploadHero(r.community.id);msg=(up&&up.message)||msg;}store.state.busy=false;store.state.msg=msg;if(r.ok){clear();await load();}}
14416      async function archive(c){if(!confirm('أرشفة '+(c.name_ar||'المجتمع')+'؟'))return;store.state.busy=true;const r=await api('/api/admin/communities/'+encodeURIComponent(c.id)+'/archive',{method:'POST'});store.state.busy=false;store.state.msg=r.message||r.error||'';await load();}
14417      onMounted(load);
14418      return{store,form,heroName,load,edit,clear,save,archive,onHeroFile,safeArray};
14419    },
14420    render:(function(){
14421const _Vue = Vue
14422const { createVNode: _createVNode, createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
14423
14424const _hoisted_1 = { class: "card formCard" }
14425const _hoisted_2 = { class: "editGrid" }
14426const _hoisted_3 = ["onUpdate:modelValue"]
14427const _hoisted_4 = ["onUpdate:modelValue"]
14428const _hoisted_5 = ["onUpdate:modelValue"]
14429const _hoisted_6 = ["onUpdate:modelValue"]
14430const _hoisted_7 = ["onUpdate:modelValue"]
14431const _hoisted_8 = ["onUpdate:modelValue"]
14432const _hoisted_9 = ["onUpdate:modelValue"]
14433const _hoisted_10 = ["onUpdate:modelValue"]
14434const _hoisted_11 = {
14435  key: 0,
14436  class: "heroAdminPreview"
14437}
14438const _hoisted_12 = ["src"]
14439const _hoisted_13 = { class: "filePicker" }
14440const _hoisted_14 = ["onChange"]
14441const _hoisted_15 = { class: "row" }
14442const _hoisted_16 = ["onClick"]
14443const _hoisted_17 = ["onClick"]
14444const _hoisted_18 = { class: "grid cardsGrid" }
14445const _hoisted_19 = ["src"]
14446const _hoisted_20 = { class: "memberCardTop" }
14447const _hoisted_21 = { class: "statusPill" }
14448const _hoisted_22 = { class: "hint" }
14449const _hoisted_23 = {
14450  key: 1,
14451  class: "hint"
14452}
14453const _hoisted_24 = { class: "row" }
14454const _hoisted_25 = ["onClick"]
14455const _hoisted_26 = ["onClick"]
14456
14457return function render(_ctx, _cache) {
14458  with (_ctx) {
14459    const { resolveComponent: _resolveComponent, createVNode: _createVNode, createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, vModelText: _vModelText, withDirectives: _withDirectives, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, renderList: _renderList, Fragment: _Fragment, createTextVNode: _createTextVNode, withCtx: _withCtx, createBlock: _createBlock } = _Vue
14460
14461    const _component_IdentityAdminNav = _resolveComponent("IdentityAdminNav")
14462    const _component_AdminFrame = _resolveComponent("AdminFrame")
14463
14464    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "المجتمعات المحلية" }, {
14465      default: _withCtx(() => [
14466        _createVNode(_component_IdentityAdminNav),
14467        _cache[3] || (_cache[3] = _createElementVNode("div", { class: "card noticeCard compactNotice identityBoundaryNote" }, [_createElementVNode("span", { class: "vueBadge" }, "المجتمعات المحلية"), _createElementVNode("h3", null, "قوانغتشو وإيوو وغيرها"), _createElementVNode("p", null, "هذه الصفحة تخص بيانات وصور كل مجتمع محلي فقط. لا تغيّر اسم منصة SMT China ولا محتوى صفحة «عن المنصة» ولا أيقونة التطبيق.")], -1)),
14468        _createElementVNode("section", _hoisted_1, [
14469          _createElementVNode("h3", null, _toDisplayString(form.id?'تعديل مجتمع محلي':'إضافة مجتمع محلي'), 1),
14470          _createElementVNode("div", _hoisted_2, [
14471            _withDirectives(_createElementVNode("input", {
14472              "onUpdate:modelValue": $event => ((form.name_ar) = $event),
14473              placeholder: "الاسم بالعربي: مجتمع قوانغتشو"
14474            }, null, 8, _hoisted_3), [[_vModelText, form.name_ar]]),
14475            _withDirectives(_createElementVNode("input", {
14476              "onUpdate:modelValue": $event => ((form.name_en) = $event),
14477              placeholder: "English name"
14478            }, null, 8, _hoisted_4), [[_vModelText, form.name_en]]),
14479            _withDirectives(_createElementVNode("input", {
14480              "onUpdate:modelValue": $event => ((form.slug) = $event),
14481              placeholder: "slug مثل guangzhou"
14482            }, null, 8, _hoisted_5), [[_vModelText, form.slug]]),
14483            _withDirectives(_createElementVNode("input", {
14484              "onUpdate:modelValue": $event => ((form.main_city) = $event),
14485              placeholder: "المدينة الرئيسية"
14486            }, null, 8, _hoisted_6), [[_vModelText, form.main_city]]),
14487            _withDirectives(_createElementVNode("input", {
14488              "onUpdate:modelValue": $event => ((form.coverage_cities) = $event),
14489              placeholder: "المدن التابعة مفصولة بفواصل"
14490            }, null, 8, _hoisted_7), [[_vModelText, form.coverage_cities]]),
14491            _withDirectives(_createElementVNode("input", {
14492              type: "number",
14493              "onUpdate:modelValue": $event => ((form.sort_order) = $event),
14494              placeholder: "ترتيب"
14495            }, null, 8, _hoisted_8), [[_vModelText, form.sort_order]])
14496          ]),
14497          _withDirectives(_createElementVNode("textarea", {
14498            "onUpdate:modelValue": $event => ((form.about_ar) = $event),
14499            placeholder: "عن المجتمع المحلي - قوانغتشو / إيوو"
14500          }, null, 8, _hoisted_9), [[_vModelText, form.about_ar]]),
14501          _withDirectives(_createElementVNode("textarea", {
14502            "onUpdate:modelValue": $event => ((form.about_en) = $event),
14503            placeholder: "About this local community"
14504          }, null, 8, _hoisted_10), [[_vModelText, form.about_en]]),
14505          (form.hero_image_url)
14506            ? (_openBlock(), _createElementBlock("div", _hoisted_11, [_createElementVNode("img", {
14507                src: form.hero_image_url,
14508                loading: "lazy",
14509                alt: ""
14510              }, null, 8, _hoisted_12)]))
14511            : _createCommentVNode("", true),
14512          _createElementVNode("label", _hoisted_13, [_createElementVNode("input", {
14513            type: "file",
14514            accept: "image/jpeg,image/png,image/webp",
14515            onChange: onHeroFile
14516          }, null, 40, _hoisted_14), _cache[0] || (_cache[0] = _createElementVNode("span", null, "اختيار صورة مميزة للمجتمع", -1)), _createElementVNode("em", null, _toDisplayString(heroName), 1)]),
14517          _createElementVNode("div", _hoisted_15, [_createElementVNode("button", {
14518            class: "btn",
14519            onClick: save
14520          }, "حفظ", 8, _hoisted_16), _createElementVNode("button", {
14521            class: "btn secondary",
14522            onClick: clear
14523          }, "تفريغ", 8, _hoisted_17)])
14524        ]),
14525        _createElementVNode("section", _hoisted_18, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(store.state.communities, (c) => {
14526          return (_openBlock(), _createElementBlock("article", {
14527            class: "card communityScopeCard",
14528            key: c.id
14529          }, [
14530            (c.hero_image_url)
14531              ? (_openBlock(), _createElementBlock("img", {
14532                  key: 0,
14533                  class: "localCommunityHero",
14534                  src: c.hero_image_url,
14535                  loading: "lazy",
14536                  alt: ""
14537                }, null, 8, _hoisted_19))
14538              : _createCommentVNode("", true),
14539            _createElementVNode("div", _hoisted_20, [_createElementVNode("h3", null, _toDisplayString(c.name_ar), 1), _createElementVNode("span", _hoisted_21, _toDisplayString(c.slug), 1)]),
14540            _createElementVNode("p", _hoisted_22, _toDisplayString(c.name_en), 1),
14541            _createElementVNode("p", null, [_cache[1] || (_cache[1] = _createElementVNode("b", null, "المدينة الرئيسية:", -1)), _createTextVNode(" " + _toDisplayString($cityLabel(c.main_city) || '-'), 1)]),
14542            _createElementVNode("p", null, [_cache[2] || (_cache[2] = _createElementVNode("b", null, "النطاق:", -1)), _createTextVNode(" " + _toDisplayString(safeArray(c.coverage_cities).map($cityLabel).join('، ') || '-'), 1)]),
14543            (c.about_ar)
14544              ? (_openBlock(), _createElementBlock("p", _hoisted_23, _toDisplayString(c.about_ar), 1))
14545              : _createCommentVNode("", true),
14546            _createElementVNode("div", _hoisted_24, [_createElementVNode("button", {
14547              class: "smallbtn secondary",
14548              onClick: $event => (edit(c))
14549            }, "تعديل", 8, _hoisted_25), (c.slug!=='all-china'&&(store.state.me&&store.state.me.admin&&store.state.me.admin.role==='super_admin'))
14550              ? (_openBlock(), _createElementBlock("button", {
14551                  key: 0,
14552                  class: "smallbtn danger",
14553                  onClick: $event => (archive(c))
14554                }, "أرشفة", 8, _hoisted_26))
14555              : _createCommentVNode("", true)])
14556          ]))
14557        }), 128))])
14558      ]),
14559      _: 1,
14560      __: [3]
14561    }))
14562  }
14563}
14564})()
14565  };
14566
14567  const AdminCommunityPage={
14568    components:{AdminFrame,IdentityAdminNav},
14569    setup(){
14570      const store=useGzcStore();const router=useRouter();
14571      const community=ref({profile:{},images:[],terms:[]});
14572      const selectedCommunityId=ref('');
14573      const profile=reactive({title_ar:'',title_en:'',body_ar:'',body_en:'',mission_ar:'',vision_ar:'',splash_enabled:true,splash_seconds:4});
14574      const splashFile=ref(null);const splashName=ref('لم يتم اختيار صورة');
14575      const galleryFile=ref(null);const galleryName=ref('لم يتم اختيار صورة');const imageTitle=ref('');
14576      const term=reactive({title:'',period_label:'',is_current:false,sort_order:100});
14577      const exec=reactive({term_id:'',name:'',position:'',sort_order:100});const execFile=ref(null);const execFileName=ref('اختياري');
14578      const images=computed(()=>selectedCommunityId.value?safeArray(community.value.images).filter(x=>!x.archived_at):[]);
14579      const communities=computed(()=>safeArray(community.value.communities||community.value.local_communities).filter(x=>!x.archived_at&&x.status!=='archived'&&String(x.slug)!=='all-china'));
14580      const terms=computed(()=>selectedCommunityId.value?safeArray(community.value.terms).filter(x=>!x.archived_at):[]);
14581      const selectedCommunity=computed(()=>communities.value.find(x=>String(x.id)===String(selectedCommunityId.value))||null);
14582      const currentTerm=computed(()=>terms.value.find(t=>t.is_current)||terms.value[0]||null);
14583      function applyProfile(p){Object.assign(profile,{title_ar:p.title_ar||'',title_en:p.title_en||'',body_ar:p.body_ar||'',body_en:p.body_en||'',mission_ar:p.mission_ar||'',vision_ar:p.vision_ar||'',splash_enabled:p.splash_enabled!==false,splash_seconds:Number(p.splash_seconds||4)});}
14584      async function load(){if(!(await store.requireAdmin(router)))return;store.state.busy=true;const qs=selectedCommunityId.value?('?community_id='+encodeURIComponent(selectedCommunityId.value)):'';const r=await api('/api/admin/community-profile'+qs);store.state.busy=false;if(r.status===401){router.replace('/admin/login');return;}community.value=(r&&r.community)||{profile:{},images:[],terms:[]};applyProfile(community.value.profile||{});if(selectedCommunityId.value&&currentTerm.value&&!exec.term_id)exec.term_id=currentTerm.value.id;if(!selectedCommunityId.value)exec.term_id='';}
14585      onMounted(load);
14586      function pickSplash(e){splashFile.value=(e.target.files&&e.target.files[0])||null;splashName.value=splashFile.value?splashFile.value.name:'لم يتم اختيار صورة';}
14587      function pickGallery(e){galleryFile.value=(e.target.files&&e.target.files[0])||null;galleryName.value=galleryFile.value?galleryFile.value.name:'لم يتم اختيار صورة';}
14588      function pickExec(e){execFile.value=(e.target.files&&e.target.files[0])||null;execFileName.value=execFile.value?execFile.value.name:'اختياري';}
14589      async function saveProfile(){store.state.busy=true;store.state.msg='جاري حفظ صفحة عن المنصة...';const r=await api('/api/admin/community-profile',{method:'POST',body:JSON.stringify(profile)}
14589);store.state.busy=false;store.state.msg=r.message||r.error||'';await load();}
14590      async function uploadSplash(){if(!splashFile.value){store.state.msg='اختر صورة أولاً';return;}const fd=new FormData();fd.append('file',splashFile.value);store.state.busy=true;store.state.msg='جاري رفع صورة صفحة عن المنصة...';const r=await uploadApi('/api/admin/community-profile/splash',{method:'POST',body:fd,headers:{'Accept':'application/json'},uploadLabel:'رفع صورة صفحة عن المنصة'});store.state.busy=false;store.state.msg=r.message||r.error||'';splashFile.value=null;splashName.value='لم يتم اختيار صورة';await load();}
14591      async function uploadGallery(){if(!selectedCommunityId.value){store.state.msg='اختر المجتمع المحلي أولاً';return;}if(!galleryFile.value){store.state.msg='اختر صورة للألبوم أولاً';return;}const fd=new FormData();fd.append('community_id',selectedCommunityId.value);fd.append('title',imageTitle.value||'');fd.append('file',galleryFile.value);store.state.busy=true;store.state.msg='جاري رفع صورة الألبوم...';const r=await uploadApi('/api/admin/community-images',{method:'POST',body:fd,headers:{'Accept':'application/json'},uploadLabel:'رفع صورة ألبوم المجتمع'});store.state.busy=false;store.state.msg=r.message||r.error||'';galleryFile.value=null;galleryName.value='لم يتم اختيار صورة';imageTitle.value='';await load();}
14592      async function archiveImage(img){if(!confirm('أرشفة الصورة؟'))return;store.state.busy=true;const r=await api('/api/admin/community-images/'+encodeURIComponent(img.id)+'/archive',{method:'POST'});store.state.busy=false;store.state.msg=r.message||r.error||'';await load();}
14593      async function createTerm(){if(!selectedCommunityId.value){store.state.msg='اختر المجتمع المحلي أولاً';return;}if(!term.title.trim()){store.state.msg='اسم الدورة مطلوب';return;}store.state.busy=true;const r=await api('/api/admin/executive-terms',{method:'POST',body:JSON.stringify({...term,community_id:selectedCommunityId.value})});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok){term.title='';term.period_label='';term.is_current=false;term.sort_order=100;}await load();}
14594      async function archiveTerm(t){if(!confirm('أرشفة الدورة؟'))return;store.state.busy=true;const r=await api('/api/admin/executive-terms/'+encodeURIComponent(t.id)+'/archive',{method:'POST'});store.state.busy=false;store.state.msg=r.message||r.error||'';await load();}
14595      async function createExec(){if(!selectedCommunityId.value){store.state.msg='اختر المجتمع المحلي أولاً';return;}if(!exec.term_id||!exec.name.trim()){store.state.msg='الدورة والاسم مطلوبة';return;}const fd=new FormData();fd.append('community_id',selectedCommunityId.value);Object.keys(exec).forEach(k=>fd.append(k,exec[k]));if(execFile.value)fd.append('file',execFile.value);store.state.busy=true;const r=await uploadApi('/api/admin/executive-members',{method:'POST',body:fd,headers:{'Accept':'application/json'},uploadLabel:'رفع بيانات وصورة المشرف'});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok){exec.name='';exec.position='';exec.sort_order=100;execFile.value=null;execFileName.value='اختياري';}await load();}
14596      async function archiveExec(m){if(!confirm('أرشفة عضو المكتب التنفيذي؟'))return;store.state.busy=true;const r=await api('/api/admin/executive-members/'+encodeURIComponent(m.id)+'/archive',{method:'POST'});store.state.busy=false;store.state.msg=r.message||r.error||'';await load();}
14597      return {store,community,selectedCommunityId,selectedCommunity,profile,images,communities,terms,currentTerm,splashName,galleryName,imageTitle,term,exec,execFileName,load,pickSplash,pickGallery,pickExec,saveProfile,uploadSplash,uploadGallery,archiveImage,createTerm,archiveTerm,createExec,archiveExec,safeArray};
14598    },
14599    render:(function(){
14600const _Vue = Vue
14601const { createVNode: _createVNode, createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
14602
14603const _hoisted_1 = { class: "communityCmsGrid" }
14604const _hoisted_2 = { class: "card formCard communityProfileCard" }
14605const _hoisted_3 = ["onUpdate:modelValue"]
14606const _hoisted_4 = ["onUpdate:modelValue"]
14607const _hoisted_5 = ["onUpdate:modelValue"]
14608const _hoisted_6 = ["onUpdate:modelValue"]
14609const _hoisted_7 = ["onUpdate:modelValue"]
14610const _hoisted_8 = ["onClick"]
14611const _hoisted_9 = { class: "card communityCard communityPreviewCard" }
14612const _hoisted_10 = { class: "memberActions" }
14613const _hoisted_11 = ["onClick"]
14614const _hoisted_12 = ["onClick"]
14615const _hoisted_13 = { class: "card identityScopeChooser" }
14616const _hoisted_14 = { class: "editGrid" }
14617const _hoisted_15 = ["onUpdate:modelValue", "onChange"]
14618const _hoisted_16 = ["value"]
14619const _hoisted_17 = ["onClick"]
14620const _hoisted_18 = {
14621  key: 0,
14622  class: "identityScopeActive"
14623}
14624const _hoisted_19 = {
14625  key: 0,
14626  class: "card emptyCard identityEmptyScope"
14627}
14628const _hoisted_20 = {
14629  class: "card collapseSection",
14630  open: ""
14631}
14632const _hoisted_21 = { class: "collapseBody" }
14633const _hoisted_22 = { class: "editGrid" }
14634const _hoisted_23 = ["onUpdate:modelValue"]
14635const _hoisted_24 = { class: "filePicker" }
14636const _hoisted_25 = ["onChange"]
14637const _hoisted_26 = ["onClick"]
14638const _hoisted_27 = {
14639  key: 0,
14640  class: "communityImageGrid"
14641}
14642const _hoisted_28 = ["src"]
14643const _hoisted_29 = ["onClick"]
14644const _hoisted_30 = {
14645  key: 1,
14646  class: "hint"
14647}
14648const _hoisted_31 = { class: "card collapseSection" }
14649const _hoisted_32 = { class: "collapseBody" }
14650const _hoisted_33 = { class: "editGrid" }
14651const _hoisted_34 = ["onUpdate:modelValue"]
14652const _hoisted_35 = ["onUpdate:modelValue"]
14653const _hoisted_36 = ["onUpdate:modelValue"]
14654const _hoisted_37 = { class: "check" }
14655const _hoisted_38 = ["onUpdate:modelValue"]
14656const _hoisted_39 = ["onClick"]
14657const _hoisted_40 = {
14658  key: 0,
14659  class: "statusPill"
14660}
14661const _hoisted_41 = ["onClick"]
14662const _hoisted_42 = { class: "card collapseSection" }
14663const _hoisted_43 = { class: "collapseBody" }
14664const _hoisted_44 = { class: "editGrid" }
14665const _hoisted_45 = ["onUpdate:modelValue"]
14666const _hoisted_46 = ["value"]
14667const _hoisted_47 = ["onUpdate:modelValue"]
14668const _hoisted_48 = ["onUpdate:modelValue"]
14669const _hoisted_49 = ["onUpdate:modelValue"]
14670const _hoisted_50 = { class: "filePicker" }
14671const _hoisted_51 = ["onChange"]
14672const _hoisted_52 = ["onClick"]
14673const _hoisted_53 = {
14674  key: 0,
14675  class: "executiveGrid"
14676}
14677const _hoisted_54 = ["src"]
14678const _hoisted_55 = {
14679  key: 1,
14680  class: "avatar"
14681}
14682const _hoisted_56 = ["onClick"]
14683const _hoisted_57 = {
14684  key: 1,
14685  class: "hint"
14686}
14687
14688return function render(_ctx, _cache) {
14689  with (_ctx) {
14690    const { resolveComponent: _resolveComponent, createVNode: _createVNode, createElementVNode: _createElementVNode, createTextVNode: _createTextVNode, vModelText: _vModelText, withDirectives: _withDirectives, toDisplayString: _toDisplayString, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, vModelSelect: _vModelSelect, createCommentVNode: _createCommentVNode, vModelCheckbox: _vModelCheckbox, withCtx: _withCtx, createBlock: _createBlock } = _Vue
14691
14692    const _component_IdentityAdminNav = _resolveComponent("IdentityAdminNav")
14693    const _component_AdminFrame = _resolveComponent("AdminFrame")
14694
14695    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "عن المنصة" }, {
14696      default: _withCtx(() => [
14697        _createVNode(_component_IdentityAdminNav),
14698        _cache[15] || (_cache[15] = _createElementVNode("div", { class: "card noticeCard compactNotice identityBoundaryNote" }, [_createElementVNode("span", { class: "vueBadge" }, "عام لكل المنصة"), _createElementVNode("h3", null, "صفحة «عن المنصة» مستقلة عن المجتمعات"), _createElementVNode("p", null, [_createTextVNode("العنوان والنبذة والرسالة والرؤية أدناه تخص SMT China بالكامل وتظهر في "), _createElementVNode("b", null, "/about"), _createTextVNode(". اختيار قوانغتشو أو إيوو لا يغيّر هذا المحتوى.")])], -1)),
14699        _createElementVNode("div", _hoisted_1, [_createElementVNode("div", _hoisted_2, [
14700          _cache[0] || (_cache[0] = _createElementVNode("h3", null, "محتوى صفحة عن المنصة", -1)),
14701          _withDirectives(_createElementVNode("input", {
14702            "onUpdate:modelValue": $event => ((profile.title_ar) = $event),
14703            placeholder: "العنوان بالعربي"
14704          }, null, 8, _hoisted_3), [[_vModelText, profile.title_ar]]),
14705          _withDirectives(_createElementVNode("input", {
14706            "onUpdate:modelValue": $event => ((profile.title_en) = $event),
14707            placeholder: "English title"
14708          }, null, 8, _hoisted_4), [[_vModelText, profile.title_en]]),
14709          _withDirectives(_createElementVNode("textarea", {
14710            "onUpdate:modelValue": $event => ((profile.body_ar) = $event),
14711            placeholder: "نبذة عن منصة SMT China"
14712          }, null, 8, _hoisted_5), [[_vModelText, profile.body_ar]]),
14713          _withDirectives(_createElementVNode("textarea", {
14714            "onUpdate:modelValue": $event => ((profile.mission_ar) = $event),
14715            placeholder: "الرسالة"
14716          }, null, 8, _hoisted_6), [[_vModelText, profile.mission_ar]]),
14717          _withDirectives(_createElementVNode("textarea", {
14718            "onUpdate:modelValue": $event => ((profile.vision_ar) = $event),
14719            placeholder: "الرؤية"
14720          }, null, 8, _hoisted_7), [[_vModelText, profile.vision_ar]]),
14721          _cache[1] || (_cache[1] = _createElementVNode("p", { class: "hint" }, "شعار الصفحة يتبع هوية SMT المعتمدة، وليس شعار أي جالية أو مجتمع محلي.", -1)),
14722          _createElementVNode("button", {
14723            class: "btn loadMore",
14724            onClick: saveProfile
14725          }, "حفظ صفحة عن المنصة", 8, _hoisted_8)
14726        ]), _createElementVNode("div", _hoisted_9, [
14727          _cache[3] || (_cache[3] = _createElementVNode("h3", null, "معاينة الصفحة", -1)),
14728          _cache[4] || (_cache[4] = _createElementVNode("img", {
14729            class: "communitySplashPreview platformAboutLogo",
14730            src: "/brand/smt-gold-v1/smt-logo-transparent.png",
14731            width: "160",
14732            height: "160",
14733            loading: "lazy",
14734            alt: "شعار منصة SMT China"
14735          }, null, -1)),
14736          _createElementVNode("b", null, _toDisplayString(profile.title_ar || 'عن منصة SMT China'), 1),
14737          _createElementVNode("p", null, _toDisplayString(profile.body_ar || 'لا يوجد نص بعد.'), 1),
14738          _createElementVNode("div", _hoisted_10, [_cache[2] || (_cache[2] = _createElementVNode("a", {
14739            class: "smallbtn",
14740            href: "/about",
14741            target: "_blank",
14742            rel: "noopener"
14743          }, "فتح صفحة عن المنصة", -1)), _createElementVNode("button", {
14744            class: "smallbtn",
14745            onClick: $event => ($router.push('/admin/platform'))
14746          }, "هوية المنصة", 8, _hoisted_11), _createElementVNode("button", {
14747            class: "smallbtn",
14748            onClick: $event => ($router.push('/admin/brand-assets'))
14749          }, "الأصول البصرية", 8, _hoisted_12)])
14750        ])]),
14751        _createElementVNode("section", _hoisted_13, [_cache[7] || (_cache[7] = _
14751createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "محتوى محلي"), _createElementVNode("h3", null, "ألبوم ومكتب المجتمع المحلي"), _createElementVNode("p", null, "اختر مجتمعاً فقط عند إدارة صوره أو دوراته أو أعضاء مكتبه التنفيذي. هذه البيانات لا تغيّر صفحة «عن المنصة» العامة.")], -1)), _createElementVNode("div", _hoisted_14, [_withDirectives(_createElementVNode("select", {
14752          "onUpdate:modelValue": $event => ((selectedCommunityId) = $event),
14753          onChange: load
14754        }, [_cache[5] || (_cache[5] = _createElementVNode("option", { value: "" }, "اختر مجتمعاً محلياً", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(communities, (lc) => {
14755          return (_openBlock(), _createElementBlock("option", {
14756            key: lc.id,
14757            value: lc.id
14758          }, _toDisplayString(lc.name_ar), 9, _hoisted_16))
14759        }), 128))], 40, _hoisted_15), [[_vModelSelect, selectedCommunityId]]), _createElementVNode("button", {
14760          class: "smallbtn secondary",
14761          onClick: $event => ($router.push('/admin/communities'))
14762        }, "إدارة المجتمعات", 8, _hoisted_17)]), selectedCommunity
14763          ? (_openBlock(), _createElementBlock("p", _hoisted_18, [_cache[6] || (_cache[6] = _createTextVNode("النطاق الحالي: ")), _createElementVNode("b", null, _toDisplayString(selectedCommunity.name_ar), 1), _createTextVNode(" — " + _toDisplayString($cityLabel(selectedCommunity.main_city)||'-'), 1)]))
14764          : _createCommentVNode("", true)]),
14765        (!selectedCommunityId)
14766          ? (_openBlock(), _createElementBlock("div", _hoisted_19, "اختر مجتمعاً محلياً من الأعلى لإدارة الألبوم والمكتب التنفيذي."))
14767          : (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [_createElementVNode("details", _hoisted_20, [_createElementVNode("summary", null, [_createElementVNode("b", null, "ألبوم " + _toDisplayString(selectedCommunity&&selectedCommunity.name_ar || 'المجتمع'), 1), _cache[8] || (_cache[8] = _createElementVNode("span", null, null, -1))]), _createElementVNode("div", _hoisted_21, [_createElementVNode("div", _hoisted_22, [_withDirectives(_createElementVNode("input", {
14768              "onUpdate:modelValue": $event => ((imageTitle) = $event),
14769              placeholder: "عنوان الصورة"
14770            }, null, 8, _hoisted_23), [[_vModelText, imageTitle]]), _createElementVNode("label", _hoisted_24, [_createElementVNode("input", {
14771              type: "file",
14772              accept: "image/jpeg,image/png,image/webp",
14773              onChange: pickGallery
14774            }, null, 40, _hoisted_25), _cache[9] || (_cache[9] = _createElementVNode("span", null, "اختيار صورة", -1)), _createElementVNode("em", null, _toDisplayString(galleryName), 1)])]), _createElementVNode("button", {
14775              class: "btn secondary",
14776              onClick: uploadGallery
14777            }, "رفع الصورة", 8, _hoisted_26), (images.length)
14778              ? (_openBlock(), _createElementBlock("div", _hoisted_27, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(images, (img) => {
14779                  return (_openBlock(), _createElementBlock("figure", { key: img.id }, [_createElementVNode("img", {
14780                    src: img.image_url,
14781                    loading: "lazy",
14782                    alt: ""
14783                  }, null, 8, _hoisted_28), _createElementVNode("figcaption", null, _toDisplayString(img.title || 'صورة'), 1), _createElementVNode("button", {
14784                    class: "smallbtn danger",
14785                    onClick: $event => (archiveImage(img))
14786                  }, "أرشفة", 8, _hoisted_29)]))
14787                }), 128))]))
14788              : (_openBlock(), _createElementBlock("p", _hoisted_30, "لا توجد صور في ألبوم هذا المجتمع."))])]), _createElementVNode("details", _hoisted_31, [_cache[11] || (_cache[11] = _createElementVNode("summary", null, [_createElementVNode("b", null, "دورات المكتب التنفيذي"), _createElementVNode("span")], -1)), _createElementVNode("div", _hoisted_32, [_createElementVNode("div", _hoisted_33, [
14789              _withDirectives(_createElementVNode("input", {
14790                "onUpdate:modelValue": $event => ((term.title) = $event),
14791                placeholder: "اسم الدورة"
14792              }, null, 8, _hoisted_34), [[_vModelText, term.title]]),
14793              _withDirectives(_createElementVNode("input", {
14794                "onUpdate:modelValue": $event => ((term.period_label) = $event),
14795                placeholder: "الفترة مثال 2026 - 2027"
14796              }, null, 8, _hoisted_35), [[_vModelText, term.period_label]]),
14797              _withDirectives(_createElementVNode("input", {
14798                type: "number",
14799                "onUpdate:modelValue": $event => ((term.sort_order) = $event),
14800                placeholder: "ترتيب"
14801              }, null, 8, _hoisted_36), [[_vModelText, term.sort_order]]),
14802              _createElementVNode("label", _hoisted_37, [_withDirectives(_createElementVNode("input", {
14803                type: "checkbox",
14804                "onUpdate:modelValue": $event => ((term.is_current) = $event)
14805              }, null, 8, _hoisted_38), [[_vModelCheckbox, term.is_current]]), _cache[10] || (_cache[10] = _createTextVNode(" الدورة الحالية"))])
14806            ]), _createElementVNode("button", {
14807              class: "btn secondary",
14808              onClick: createTerm
14809            }, "حفظ الدورة", 8, _hoisted_39), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(terms, (t) => {
14810              return (_openBlock(), _createElementBlock("div", {
14811                class: "termAdmin",
14812                key: t.id
14813              }, [_createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(t.title), 1), _createElementVNode("small", null, _toDisplayString(t.period_label || '-'), 1)]), (t.is_current)
14814                ? (_openBlock(), _createElementBlock("span", _hoisted_40, "الحالية"))
14815                : _createCommentVNode("", true), _createElementVNode("button", {
14816                class: "smallbtn danger",
14817                onClick: $event => (archiveTerm(t))
14818              }, "أرشفة", 8, _hoisted_41)]))
14819            }), 128))])]), _createElementVNode("details", _hoisted_42, [_cache[14] || (_cache[14] = _createElementVNode("summary", null, [_createElementVNode("b", null, "أعضاء المكتب التنفيذي"), _createElementVNode("span")], -1)), _createElementVNode("div", _hoisted_43, [_createElementVNode("div", _hoisted_44, [
14820              _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((exec.term_id) = $event) }, [_cache[12] || (_cache[12] = _createElementVNode("option", { value: "" }, "اختر الدورة", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(terms, (t) => {
14821                return (_openBlock(), _createElementBlock("option", {
14822                  key: t.id,
14823                  value: t.id
14824                }, _toDisplayString(t.title), 9, _hoisted_46))
14825              }), 128))], 8, _hoisted_45), [[_vModelSelect, exec.term_id]]),
14826              _withDirectives(_createElementVNode("input", {
14827                "onUpdate:modelValue": $event => ((exec.name) = $event),
14828                placeholder: "الاسم"
14829              }, null, 8, _hoisted_47), [[_vModelText, exec.name]]),
14830              _withDirectives(_createElementVNode("input", {
14831                "onUpdate:modelValue": $event => ((exec.position) = $event),
14832                placeholder: "المنصب"
14833              }, null, 8, _hoisted_48), [[_vModelText, exec.position]]),
14834              _withDirectives(_createElementVNode("input", {
14835                type: "number",
14836                "onUpdate:modelValue": $event => ((exec.sort_order) = $event),
14837                placeholder: "ترتيب"
14838              }, null, 8, _hoisted_49), [[_vModelText, exec.sort_order]]),
14839              _createElementVNode("label", _hoisted_50, [_createElementVNode("input", {
14840                type: "file",
14841                accept: "image/jpeg,image/png,image/webp",
14842                onChange: pickExec
14843              }, null, 40, _hoisted_51), _cache[13] || (_cache[13] = _createElementVNode("span", null, "صورة العضو", -1)), _createElementVNode("em", null, _toDisplayString(execFileName), 1)])
14844            ]), _createElementVNode("button", {
14845              class: "btn secondary",
14846              onClick: createExec
14847            }, "إضافة عضو", 8, _hoisted_52), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(terms, (t) => {
14848              return (_openBlock(), _createElementBlock("div", {
14849                class: "execAdminTerms",
14850                key: 'm'+t.id
14851              }, [_createElementVNode("h4", null, _toDisplayString(t.title), 1), (t.members&&t.members.length)
14852                ? (_openBlock(), _createElementBlock("div", _hoisted_53, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(t.members, (m) => {
14853                    return (_openBlock(), _createElementBlock("div", {
14854                      class: "execMini",
14855                      key: m.id
14856                    }, [
14857                      ($memberPhoto(m,'thumb'))
14858                        ? (_openBlock(), _createElementBlock("img", {
14859                            key: 0,
14860                            src: $memberPhoto(m,'thumb'),
14861                            loading: "lazy",
14862                            alt: ""
14863                          }, null, 8, _hoisted_54))
14864                        : (_openBlock(), _createElementBlock("div", _hoisted_55, "👤")),
14865                      _createElementVNode("b", null, _toDisplayString(m.name), 1),
14866                      _createElementVNode("small", null, _toDisplayString(m.position || 'عضو'), 1),
14867                      _createElementVNode("button", {
14868                        class: "smallbtn danger",
14869                        onClick: $event => (archiveExec(m))
14870                      }, "أرشفة", 8, _hoisted_56)
14871                    ]))
14872                  }), 128))]))
14873                : (_openBlock(), _createElementBlock("p", _hoisted_57, "لا يوجد أعضاء في هذه الدورة."))]))
14874            }), 128))])])], 64))
14875      ]),
14876      _: 1,
14877      __: [15]
14878    }))
14879  }
14880}
14881})()
14882  };
14883
14884
14885
14886  const PublicDemoPage={
14887    setup(){
14888      const store=useGzcStore();
14889      const loading=ref(false),status=ref(null),loaded=ref(false);
14890      async function load(){status.value=await api('/api/demo-member/status');loaded.value=true;}
14891      async function start(){
14892        loading.value=true;store.state.msg='جاري تجهيز الحساب التجريبي...';
14893        const r=await api('/api/demo-member/start',{method:'POST'});
14894        loading.value=false;
14895        if(r.ok){store.state.msg=r.message||'تم فتح الحساب التجريبي';window.location.href=r.redirect||'/complete?demo=1';return;}
14896        status.value=r;loaded.value=true;store.state.msg=r.message||r.error||'الخدمة التجريبية غير متاحة';
14897      }
14898      onMounted(load);
14899      return {store,loading,status,loaded,start,load,Math};
14900    },
14901    render:(function(){
14902const _Vue = Vue
14903const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
14904
14905const _hoisted_1 = { class: "demoPublicPage" }
14906const _hoisted_2 = { class: "hero card" }
14907const _hoisted_3 = {
14908  key: 0,
14909  class: "hint"
14910}
14911const _hoisted_4 = { class: "demoBox" }
14912const _hoisted_5 = ["onClick", "disabled"]
14913const _hoisted_6 = ["onClick"]
14914const _hoisted_7 = ["onClick"]
14915const _hoisted_8 = {
14916  key: 0,
14917  class: "card"
14918}
14919
14920return function render(_ctx, _cache) {
14921  with (_ctx) {
14922    const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, Fragment: _Fragment } = _Vue
14923
14924    return (_openBlock(), _createElementBlock("section", _hoisted_1, [_createElementVNode("div", _hoisted_2, [_cache[5] || (_cache[5] = _createElementVNode("h2", null, "التجربة الآمنة للمنصة", -1)), (!loaded)
14925      ? (_openBlock(), _createElementBlock("p", _hoisted_3, "جاري التحقق من توفر التجربة..."))
14926      : (status&&status.ok)
14927        ? (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [
14928            _cache[3] || (_cache[3] = _createElementVNode("p", { class: "hint" }, "حساب تجريبي مخصص للتجربة. لا تستخدم بيانات شخصية حقيقية.", -1)),
14929            _createElementVNode("div", _hoisted_4, [
14930              _cache[0] || (_cache[0] = _createElementVNode("b", null, "رقم الحساب التجريبي:", -1)),
14931              _createTextVNode(" " + _toDisplayString(status.phone), 1),
14932              _cache[1] || (_cache[1] = _createElementVNode("br", null, null, -1)),
14933              _cache[2] || (_cache[2] = _createElementVNode("b", null, "رمز التحقق:", -1)),
14934              _createTextVNode(" " + _toDisplayString(status.code), 1)
14935            ]),
14936            _createElementVNode("button", {
14937              class: "btn",
14938              onClick: start,
14939              disabled: loading||status.busy
14940            }, _toDisplayString(loading?'جاري التجهيز...':'ابدأ التجربة الآن'), 9, _hoisted_5),
14941            _createElementVNode("button", {
14942              class: "smallbtn",
14943              onClick: load
14944            }, "تحديث الحالة", 8, _hoisted_6)
14945          ], 64))
14946        : (_openBlock(), _createElementBlock(_Fragment, { key: 2 }, [_cache[4] || (_cache[4] = _createElementVNode("p", { class: "hint" }, "التجربة غير متاحة حالياً.", -1)), _createElementVNode("button", {
14947            class: "smallbtn",
14948            onClick: $event => ($router.push('/'))
14949          }, "العودة للرئيسية", 8, _hoisted_7)], 64))]), (status&&status.ok&&status.busy)
14950      ? (_openBlock(), _createElementBlock("div", _hoisted_8, [_cache[6] || (_cache[6] = _createElementVNode("h3", null, "الحساب مستخدم الآن", -1)), _createElementVNode("p", null, "جرّب مرة أخرى بعد حوالي " + _toDisplayString(Math.ceil((status.remaining_seconds||60)/60)) + " دقيقة.", 1)]))
14951      : _createCommentVNode("", true)]))
14952  }
14953}
14954})()
14955  };
14956
14957  const AdminDemoPage={
14958    components:{AdminFrame},
14959    setup(){
14960      const store=useGzcStore(); const router=useRouter(); const demo=ref(null); const loading=ref(false);
14961      async function load(){if(!(await store.requireAdmin(router)))return;loading.value=true;const r=await api('/api/admin/demo-member?ts='+Date.now(),{cache:'no-store'});loading.value=false;if(r.status===401){router.replace('/admin/login');return;}demo.value=r;}
14962      async function reset(){loading.value=true;const r=await api('/api/admin/demo-member/reset',{method:'POST'});loading.value=false;store.state.msg=r.message||r.error||'';demo.value=Object.assign({},demo.value||{},r);}
14963      async function start(){if(!confirm('سيتم فتح جلسة كعضو تجريبي وقد تخرج من جلسة الإدارة في هذا المتصفح. موافق؟'))return;loading.value=true;const r=await api('/api/admin/demo-member/login',{method:'POST'});loading.value=false;if(r.ok){store.state.msg=r.message||'';window.location.href=r.redirect||'/complete?demo=1';return;}store.state.msg=r.message||r.error||'تعذر فتح الحساب التجريبي';}
14964      onMounted(load);
14965      return {store,demo,loading,load,reset,start};
14966    },
14967    render:(function(){
14968const _Vue = Vue
14969const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
14970
14971const _hoisted_1 = {
14972  key: 0,
14973  class: "card"
14974}
14975const _hoisted_2 = {
14976  key: 1,
14977  class: "card formCard"
14978}
14979const _hoisted_3 = { class: "infoGrid" }
14980const _hoisted_4 = { class: "ltr" }
14981const _hoisted_5 = { class: "ltr" }
14982const _hoisted_6 = { class: "row" }
14983const _hoisted_7 = ["onClick"]
14984const _hoisted_8 = ["onClick"]
14985const _hoisted_9 = ["onClick"]
14986
14987return function render(_ctx, _cache) {
14988  with (_ctx) {
14989    const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
14990
14991    const _component_AdminFrame = _resolveComponent("AdminFrame")
14992
14993    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "حساب تجريبي للعضو" }, {
14994      default: _withCtx(() => [
14995        _cache[10] || (_cache[10] = _createElementVNode("section", { class: "card noticeCard compactNotice" }, [_createElementVNode("span", { class: "vueBadge" }, "اختبار العضوية"), _createElementVNode("h3", null, "اختبار تسجيل العضو بدون رقم جديد"), _createElementVNode("p", null, "هذه الصفحة تنشئ حساب عضو تجريبي ثابت لا يرسل واتساب ولا ينبه الإدارة. استخدمه لاختبار رحلة التسجيل وإكمال البيانات والبطاقة دون إضافة رقم حقيقي كل مرة.")], -1)),
14996        loading
14997          ? (_openBlock(), _createElementBlock("div", _hoisted_1, "جاري تجهيز الحساب التجريبي..."))
14998          : _createCommentVNode("", true),
14999        demo
15000          ? (_openBlock(), _createElementBlock("section", _hoisted_2, [
15001              _cache[8] || (_cache[8] = _createElementVNode("h3", null, "بيانات الحساب التجريبي", -1)),
15002              _createElementVNode("div", _hoisted_3, [
15003                _createElementVNode("p", null, [_cache[0] || (_cache[0] = _createElementVNode("b", null, "رقم الاختبار:", -1)), _cache[1] || (_cache[1] = _createTextVNode()), _createElementVNode("span", _hoisted_4, _toDisplayString(demo.phone), 1)]),
15004                _createElementVNode("p", null, [_cache[2] || (_cache[2] = _createElementVNode("b", null, "رمز الدخول:", -1)), _cache[3] || (_cache[3] = _createTextVNode()), _createElementVNode("span", _hoisted_5, _toDisplayString(demo.code || '000000'), 1)]),
15005                _createElementVNode("p", null, [_cache[4] || (_cache[4] = _createElementVNode("b", null, "حالة العضو:", -1)), _createTextVNode(" " + _toDisplayString(demo.member && demo.member.status || '-'), 1)]),
15006                _createElementVNode("p", null, [_cache[5] || (_cache[5] = _createElementVNode("b", null, "قفل البيانات:", -1)), _createTextVNode(" " + _toDisplayString(demo.member && demo.member.profile_locked ? 'مقفولة' : 'مفتوحة'), 1)]),
15007                _createElementVNode("p", null, [_cache[6] || (_cache[6] = _createElementVNode("b", null, "الاسم الحالي:", -1)), _createTextVNode(" " + _toDisplayString(demo.member && demo.member.full_name || '-'), 1)]),
15008                _createElementVNode("p", null, [_cache[7] || (_cache[7] = _createElementVNode("b", null, "النقاط:", -1)), _createTextVNode(" " + _toDisplayString(demo.points && demo.points.total_points || 0), 1)])
15009              ]),
15010              _createElementVNode("div", _hoisted_6, [_createElementVNode("button", {
15011                class: "btn",
15012                onClick: reset
15013              }, "تصفير الحساب", 8, _hoisted_7), _createElementVNode("button", {
15014                class: "btn secondary",
15015                onClick: start
15016              }, "فتح كعضو تجريبي الآن", 8, _hoisted_8), _createElementVNode("button", {
15017                class: "smallbtn",
15018                onClick: load
15019              }, "تحديث", 8, _hoisted_9)]),
15020              _cache[9] || (_cache[9] = _createElementVNode("p", { class: "hint" }, "يمكنك أيضاً فتح صفحة دخول العضوية واستخدام رقم الاختبار والرمز الموضحين أعلاه، ثم العودة إلى هنا لتصفير الحساب بعد انتهاء الاختبار.", -1))
15021            ]))
15022          : _createCommentVNode("", true),
15023        _cache[11] || (_cache[11] = _createElementVNode("section", { class: "card dangerZone" }, [_createElementVNode("h3", null, "ملاحظات مهمة"), _createElementVNode("p", null, "الحساب التجريبي مستبعد من رسائل واتساب الجماعية. عند إكمال بياناته لا يتم إرسال تنبيه للإدارة ولا يتم إرسال قالب رسائل. الهدف اختبار واجهة العضو فقط.")], -1))
15024      ]),
15025      _: 1,
15026      __: [10,11]
15027    }))
15028  }
15029}
15030})()
15031  };
15032
15033  const AdminAccountPage={
15034    components:{AdminFrame},
15035    setup(){
15036      const store=useGzcStore();
15037      const router=useRouter();
15038      const committees=ref([]);
15039      const current=ref({});
15040      const loading=ref(true);
15041      const error=ref('');
15042      function baseAdmin(){return (store.state.me&&store.state.me.admin)||{};}
15043      function value(k,fb){const c=current.value||{};const b=baseAdmin();return c[k]||b[k]||fb||'';}
15044      function cName(k){const c=safeArray(committees.value).find(x=>
15044String(x.key)===String(k));return (c&&c.name_ar)||String(k||'-');}
15045      const displayName=computed(()=>String(value('name','Admin')));
15046      const displayRole=computed(()=>String(value('role','admin')));
15047      const displayWhatsapp=computed(()=>String(value('whatsapp',(store.state.me&&store.state.me.phone)||'-')));
15048      const displayStatus=computed(()=>String(value('status','active')));
15049      const displayCommittees=computed(()=>{const list=safeArray((current.value||{}).committees);return list.length?list.map(cName).join('، '):'حسب الدور';});
15050      async function load(){
15051        loading.value=true; error.value='';
15052        try{
15053          if(!(await store.requireAdmin(router))){loading.value=false;return;}
15054          current.value=baseAdmin();
15055          const r=await api('/api/admin/account?ts='+Date.now(),{cache:'no-store'});
15056          if(r.status===401){loading.value=false;router.replace('/admin/login');return;}
15057          if(!r||!r.ok){error.value=(r&&(r.message||r.error))||'تعذر تحميل حساب الإدارة';committees.value=[];}
15058          else{current.value=r.admin||baseAdmin();committees.value=safeArray(r.committees);}
15059        }catch(e){error.value='حدث خطأ في عرض حساب الإدارة: '+(e&&e.message?e.message:String(e));current.value=baseAdmin();}
15060        loading.value=false;
15061      }
15062      function goSupervisors(){router.push('/admin/supervisors');}
15063      onMounted(load);
15064      return {store,current,committees,loading,error,displayName,displayRole,displayWhatsapp,displayStatus,displayCommittees,goSupervisors,roleName,load};
15065    },
15066    render:(function(){
15067const _Vue = Vue
15068const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
15069
15070const _hoisted_1 = { class: "card noticeCard compactNotice" }
15071const _hoisted_2 = ["onClick"]
15072const _hoisted_3 = {
15073  key: 0,
15074  class: "card"
15075}
15076const _hoisted_4 = {
15077  key: 1,
15078  class: "card errorCard"
15079}
15080const _hoisted_5 = ["onClick"]
15081const _hoisted_6 = {
15082  key: 2,
15083  class: "card accountAdminCard"
15084}
15085const _hoisted_7 = { class: "profileLine" }
15086const _hoisted_8 = { class: "profileLine" }
15087const _hoisted_9 = { class: "profileLine" }
15088const _hoisted_10 = { class: "profileLine" }
15089const _hoisted_11 = { class: "card" }
15090const _hoisted_12 = ["onClick"]
15091
15092return function render(_ctx, _cache) {
15093  with (_ctx) {
15094    const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
15095
15096    const _component_AdminFrame = _resolveComponent("AdminFrame")
15097
15098    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "حسابي" }, {
15099      default: _withCtx(() => [
15100        _createElementVNode("div", _hoisted_1, [
15101          _cache[0] || (_cache[0] = _createElementVNode("span", { class: "vueBadge" }, "حساب المشرف", -1)),
15102          _cache[1] || (_cache[1] = _createElementVNode("h3", null, "حسابي في الإدارة", -1)),
15103          _cache[2] || (_cache[2] = _createElementVNode("p", null, "عرض بيانات المشرف الحالي دون الحاجة إلى صلاحية المدير العام للنظام.", -1)),
15104          _createElementVNode("button", {
15105            class: "smallbtn",
15106            onClick: load
15107          }, "تحديث", 8, _hoisted_2)
15108        ]),
15109        loading
15110          ? (_openBlock(), _createElementBlock("div", _hoisted_3, _cache[3] || (_cache[3] = [_createElementVNode("h3", null, "جاري تحميل الحساب...", -1), _createElementVNode("p", { class: "hint" }, "انتظر لحظة.", -1)])))
15111          : _createCommentVNode("", true),
15112        error
15113          ? (_openBlock(), _createElementBlock("div", _hoisted_4, [_cache[4] || (_cache[4] = _createElementVNode("h3", null, "تعذر فتح حسابي", -1)), _createElementVNode("p", null, _toDisplayString(error), 1), _createElementVNode("button", {
15114              class: "btn secondary",
15115              onClick: load
15116            }
15116, "إعادة المحاولة", 8, _hoisted_5)]))
15117          : _createCommentVNode("", true),
15118        (!loading)
15119          ? (_openBlock(), _createElementBlock("div", _hoisted_6, [
15120              _cache[9] || (_cache[9] = _createElementVNode("div", { class: "profileAvatar" }, "👤", -1)),
15121              _createElementVNode("h3", null, _toDisplayString(displayName), 1),
15122              _createElementVNode("div", _hoisted_7, [_cache[5] || (_cache[5] = _createElementVNode("b", null, "الدور", -1)), _createElementVNode("span", null, _toDisplayString(roleName(displayRole)), 1)]),
15123              _createElementVNode("div", _hoisted_8, [_cache[6] || (_cache[6] = _createElementVNode("b", null, "واتساب", -1)), _createElementVNode("span", null, _toDisplayString(displayWhatsapp), 1)]),
15124              _createElementVNode("div", _hoisted_9, [_cache[7] || (_cache[7] = _createElementVNode("b", null, "الحالة", -1)), _createElementVNode("span", null, _toDisplayString(displayStatus), 1)]),
15125              _createElementVNode("div", _hoisted_10, [_cache[8] || (_cache[8] = _createElementVNode("b", null, "اللجان", -1)), _createElementVNode("span", null, _toDisplayString(displayCommittees), 1)])
15126            ]))
15127          : _createCommentVNode("", true),
15128        _createElementVNode("div", _hoisted_11, [_cache[10] || (_cache[10] = _createElementVNode("h3", null, "تنبيه أمان", -1)), _cache[11] || (_cache[11] = _createElementVNode("p", { class: "hint" }, "إدارة الصلاحيات لا تتم من هذه الصفحة. استخدم صفحة المشرفين فقط، ويجب أن تكون محصورة بالمدير العام للنظام.", -1)), _createElementVNode("button", {
15129          class: "btn secondary loadMore",
15130          onClick: goSupervisors
15131        }, "فتح إدارة المشرفين", 8, _hoisted_12)])
15132      ]),
15133      _: 1
15134    }))
15135  }
15136}
15137})()
15138  };
15139
15140  const AdminSupervisorsPage={
15141    components:{AdminFrame},
15142    setup(){
15143      const store=useGzcStore(); const router=useRouter(); const admins=ref([]); const committees=ref([]); const denied=ref(false); const loading=ref(true); const error=ref('');
15144      const roles=[['community_admin','مدير مجتمع محلي'],['membership','مشرف العضوية'],['arrival','مشرف الوصول'],['help','مشرف المساعدة'],['emergency','مشرف الطوارئ'],['events','مشرف الفعاليات'],['sports','مشرف الرياضة'],['super_admin','المدير العام للنظام']];
15145      function normalizeAdmin(a){const cs=safeArray(a.committees);return Object.assign({},a,{edit_role:a.role||'membership',edit_community_id:a.community_id||'',edit_committees:cs.length?cs.slice():[a.role||'membership'],_open:false});}
15146      function cName(k){const c=safeArray(committees.value).find(x=>String(x.key)===String(k));return (c&&c.name_ar)||String(k||'-');}
15147      function activeCommitteeOptions(){return safeArray(committees.value).filter(c=>String(c.status||'active')==='active');}
15148      async function load(){
15149        loading.value=true;error.value='';
15150        try{
15151          if(!(await store.requireAdmin(router)))return;
15152          const [ar,cr,cm]=await Promise.all([api('/api/admin/admins'),api('/api/admin/committees'),api('/api/admin/communities')]);
15153          if(ar.status===403||ar.status===401){denied.value=true;admins.value=[];return;}
15154          if(!ar.ok){error.value=ar.message||ar.error||'تعذر تحميل المشرفين';admins.value=[];return;}
15155          denied.value=false;
15156          committees.value=safeArray(cr&&cr.committees);
15157          if(cm&&cm.ok){store.state.communities=safeArray(cm.communities);store.state.platform=cm.platform||store.state.platform;}
15158          admins.value=safeArray(ar.admins).map(normalizeAdmin);
15159        }catch(e){
15160          console.error('AdminSupervisorsPage load failed',e);
15161          error.value='تعذر تحميل صفحة المستخدمين والصلاحيات. أعد المحاولة.';
15162          admins.value=[];
15163        }finally{loading.value=false;}
15164      }
15165      onMounted(load);
15166      async function save(a){const body={role:a.edit_role,community_id:a.edit_role==='super_admin'?null:a.edit_community_id,committees:a.edit_role==='super_admin'?[]:safeArray(a.edit_committees)};store.state.busy=true;try{const r=await api('/api/admin/admins/'+encodeURIComponent(a.id)+'/role',{method:'POST',body:JSON.stringify(body)});store.state.msg=r.message||r.error||'';if(r.ok)await load();}finally{store.state.busy=false;}}
15167      function isSelf(a){return Number(store.state.me&&store.state.me.admin&&store.state.me.admin.id||0)===Number(a&&a.id||0);}
15168      async function demote(a){if(isSelf(a)){store.state.msg='لا يمكنك إزالة صلاحيات إشراف حسابك الحالي';return;}if(!confirm('إزالة هذا الحساب من الإشراف؟\n\nسيتم إنهاء جلسات الإدارة وسحب اللجان والصلاحيات، لكن العضوية العادية لن تُحذف.'))return;store.state.busy=true;try{const r=await api('/api/admin/admins/'+encodeURIComponent(a.id)+'/remove-supervision',{method:'POST'});store.state.msg=r.message||r.error||'';if(r.ok)await load();}finally{store.state.busy=false;}}
15169      function toggleOpen(a){a._open=!a._open;} return {store,admins,committees,denied,loading,error,roles,cName,roleName,adminStatusName,activeCommitteeOptions,save,demote,isSelf,toggleOpen,safeArray,load};
15170    },
15171    render:(function(){
15172const _Vue = Vue
15173const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
15174
15175const _hoisted_1 = {
15176  key: 0,
15177  class: "card skeleton"
15178}
15179const _hoisted_2 = {
15180  key: 1,
15181  class: "card errorCard"
15182}
15183const _hoisted_3 = ["onClick"]
15184const _hoisted_4 = {
15185  key: 2,
15186  class: "card"
15187}
15188const _hoisted_5 = {
15189  key: 3,
15190  class: "card formCard"
15191}
15192const _hoisted_6 = { class: "memberCardTop" }
15193const _hoisted_7 = ["onClick"]
15194const _hoisted_8 = { class: "hint" }
15195const _hoisted_9 = {
15196  key: 4,
15197  class: "supervisorGrid"
15198}
15199const _hoisted_10 = { class: "memberCardTop compactToggleRow" }
15200const _hoisted_11 = { class: "hint ltr" }
15201const _hoisted_12 = { class: "toggleSide" }
15202const _hoisted_13 = ["onClick"]
15203const _hoisted_14 = { class: "compactSummaryBar" }
15204const _hoisted_15 = {
15205  key: 0,
15206  class: "collapsibleBody"
15207}
15208const _hoisted_16 = { class: "profileLine" }
15209const _hoisted_17 = { class: "profileLine" }
15210const _hoisted_18 = { class: "profileLine" }
15211const _hoisted_19 = ["onUpdate:modelValue"]
15212const _hoisted_20 = ["value"]
15213const _hoisted_21 = ["onUpdate:modelValue"]
15214const _hoisted_22 = ["value"]
15215const _hoisted_23 = {
15216  key: 1,
15217  class: "committeePick"
15218}
15219const _hoisted_24 = ["value", "onUpdate:modelValue"]
15220const _hoisted_25 = {
15221  key: 2,
15222  class: "hint"
15223}
15224const _hoisted_26 = { class: "memberActions" }
15225const _hoisted_27 = ["onClick"]
15226const _hoisted_28 = ["disabled", "onClick"]
15227
15228return function render(_ctx, _cache) {
15229  with (_ctx) {
15230    const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, toDisplayString: _toDisplayString, renderList: _renderList, Fragment: _Fragment, normalizeClass: _normalizeClass, vModelSelect: _vModelSelect, withDirectives: _withDirectives, vModelCheckbox: _vModelCheckbox, createTextVNode: _createTextVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
15231
15232    const _component_AdminFrame = _resolveComponent("AdminFrame")
15233
15234    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "المشرفين" }, {
15235      default: _withCtx(() => [
15236        _cache[10] || (_cache[10] = _createElementVNode("div", { class: "card noticeCard compactNotice" }, [_createElementVNode("span", { class: "vueBadge" }, "إدارة المنصة"), _createElementVNode("h3", null, "إدارة المشرفين"), _createElementVNode("p", null, "عرض المشرفين النشطين، تعديل الدور واللجان، أو إزالة الحساب من الإشراف بدون حذف عضويته. التعديل متاح للمدير العام للنظام فقط.")], -1)),
15237        loading
15238          ? (_openBlock(), _createElementBlock("div", _hoisted_1, _c
15238ache[0] || (_cache[0] = [_createElementVNode("div", null, [_createElementVNode("h3", null, "جاري تحميل المستخدمين والصلاحيات..."), _createElementVNode("p", { class: "hint" }, "يتم جلب المشرفين واللجان والصلاحيات.")], -1)])))
15239          : _createCommentVNode("", true),
15240        (!loading&&error)
15241          ? (_openBlock(), _createElementBlock("div", _hoisted_2, [_cache[1] || (_cache[1] = _createElementVNode("h3", null, "تعذر تحميل المستخدمين والصلاحيات", -1)), _createElementVNode("p", null, _toDisplayString(error), 1), _createElementVNode("button", {
15242              class: "btn secondary",
15243              onClick: load
15244            }, "إعادة المحاولة", 8, _hoisted_3)]))
15245          : _createCommentVNode("", true),
15246        (!loading&&!error&&denied)
15247          ? (_openBlock(), _createElementBlock("div", _hoisted_4, _cache[2] || (_cache[2] = [_createElementVNode("h3", null, "صلاحية غير كافية", -1), _createElementVNode("p", { class: "hint" }, "هذه الصفحة تتطلب صلاحية المدير العام للنظام. يمكنك متابعة صفحات لجنتك فقط.", -1)])))
15248          : _createCommentVNode("", true),
15249        (!loading&&!error&&!denied)
15250          ? (_openBlock(), _createElementBlock("div", _hoisted_5, [_createElementVNode("div", _hoisted_6, [_cache[3] || (_cache[3] = _createElementVNode("h3", null, "المشرفون الحاليون", -1)), _createElementVNode("button", {
15251              class: "smallbtn",
15252              onClick: $event => ($router.push('/admin/register'))
15253            }, "تسجيل مشرف جديد", 8, _hoisted_7)]), _createElementVNode("p", _hoisted_8, "العدد: " + _toDisplayString(admins.length), 1)]))
15254          : _createCommentVNode("", true),
15255        (!loading&&!error&&!denied)
15256          ? (_openBlock(), _createElementBlock("div", _hoisted_9, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(admins, (a) => {
15257              return (_openBlock(), _createElementBlock("div", {
15258                class: _normalizeClass(["card supervisorCard collapsibleCard", {open:a._open}]),
15259                key: a.id
15260              }, [_createElementVNode("div", _hoisted_10, [_createElementVNode("div", null, [_createElementVNode("h3", null, _toDisplayString(a.name || '-'), 1), _createElementVNode("p", _hoisted_11, _toDisplayString(a.whatsapp || '-'), 1)]), _createElementVNode("div", _hoisted_12, [_createElementVNode("span", { class: _normalizeClass(["statusPill", a.status==='active'?'':'warn']) }, _toDisplayString(adminStatusName(a.status)), 3), _createElementVNode("button", {
15261                class: "smallbtn secondary",
15262                onClick: $event => (toggleOpen(a))
15263              }, _toDisplayString(a._open?'− إخفاء':'+ إظهار'), 9, _hoisted_13)])]), _createElementVNode("div", _hoisted_14, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(roleName(a.role)), 1), _cache[4] || (_cache[4] = _createElementVNode("small", null, "الدور", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(safeArray(a.committees).length?safeArray(a.committees).length:'0'), 1), _cache[5] || (_cache[5] = _createElementVNode("small", null, "عدد اللجان", -1))])]), (a._open)
15264                ? (_openBlock(), _createElementBlock("div", _hoisted_15, [
15265                    _createElementVNode("div", _hoisted_16, [_cache[6] || (_cache[6] = _createElementVNode("b", null, "الدور الحالي", -1)), _createElementVNode("span", null, _toDisplayString(roleName(a.role)), 1)]),
15266                    _createElementVNode("div", _hoisted_17, [_cache[7] || (_cache[7] = _createElementVNode("b", null, "المجتمع", -1)), _createElementVNode("span", null, _toDisplayString(a.community_name_ar || (a.role==='super_admin'?'كل الصين':'غير محدد')), 1)]),
15267                    _createElementVNode("div", _hoisted_18, [_cache[8] || (_cache[8] = _createElementVNode("b", null, "اللجان الحالية", -1)), _createElementVNode("span", null, _toDisplayString(safeArray(a.committees).length?safeArray(a.committees).map(cName).join('، '):'—'), 1)]),
15268                    _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((a.edit_role) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(roles, (r) => {
15269                      return (_openBlock(), _createElementBlock("option", {
15270                        key: r[0],
15271                        value: r[0]
15272                      }
15272, _toDisplayString(r[1]), 9, _hoisted_20))
15273                    }), 128))], 8, _hoisted_19), [[_vModelSelect, a.edit_role]]),
15274                    (a.edit_role!=='super_admin')
15275                      ? _withDirectives((_openBlock(), _createElementBlock("select", {
15276                          key: 0,
15277                          "onUpdate:modelValue": $event => ((a.edit_community_id) = $event)
15278                        }, [_cache[9] || (_cache[9] = _createElementVNode("option", { value: "" }, "اختر المجتمع المحلي", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(store.state.communities.filter(x=>x.slug!=='all-china'), (c) => {
15279                          return (_openBlock(), _createElementBlock("option", {
15280                            key: c.id,
15281                            value: c.id
15282                          }, _toDisplayString(c.name_ar), 9, _hoisted_22))
15283                        }), 128))], 8, _hoisted_21)), [[_vModelSelect, a.edit_community_id]])
15284                      : _createCommentVNode("", true),
15285                    (a.edit_role!=='super_admin')
15286                      ? (_openBlock(), _createElementBlock("div", _hoisted_23, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(activeCommitteeOptions(), (c) => {
15287                          return (_openBlock(), _createElementBlock("label", {
15288                            class: "check",
15289                            key: c.key
15290                          }, [_withDirectives(_createElementVNode("input", {
15291                            type: "checkbox",
15292                            value: c.key,
15293                            "onUpdate:modelValue": $event => ((a.edit_committees) = $event)
15294                          }, null, 8, _hoisted_24), [[_vModelCheckbox, a.edit_committees]]), _createTextVNode(" " + _toDisplayString(c.name_ar || c.key), 1)]))
15295                        }), 128))]))
15296                      : (_openBlock(), _createElementBlock("p", _hoisted_25, "المدير العام للنظام يرى ويدير جميع الأقسام ولا يحتاج إلى ربطه بلجنة.")),
15297                    _createElementVNode("div", _hoisted_26, [_createElementVNode("button", {
15298                      class: "smallbtn",
15299                      onClick: $event => (save(a))
15300                    }, "حفظ الصلاحيات", 8, _hoisted_27), _createElementVNode("button", {
15301                      class: "smallbtn danger",
15302                      disabled: isSelf(a),
15303                      onClick: $event => (demote(a))
15304                    }, _toDisplayString(isSelf(a)?'حسابك الحالي':'إزالة من الإشراف'), 9, _hoisted_28)])
15305                  ]))
15306                : _createCommentVNode("", true)], 2))
15307            }), 128))]))
15308          : _createCommentVNode("", true)
15309      ]),
15310      _: 1,
15311      __: [10]
15312    }))
15313  }
15314}
15315})()
15316  };
15317
15318  const AdminCommitteesPage={
15319    components:{AdminFrame},
15320    setup(){
15321      const store=useGzcStore(); const router=useRouter(); const committees=ref([]); const denied=ref(false); const f=reactive({key:'',name_ar:'',name_en:''});
15322      const core=['membership','arrival','help','emergency','events','sports'];
15323      async function load(){if(!(await store.requireAdmin(router)))return;store.state.busy=true;const r=await api('/api/admin/committees');store.state.busy=false;if(r.status===401){router.replace('/admin/login');return;}committees.value=safeArray(r.committees);}
15324      onMounted(load);
15325      async function save(){if(!f.key.trim()||!f.name_ar.trim()){store.state.msg='المفتاح والاسم العربي مطلوبان';return;}store.state.busy=true;const r=await api('/api/admin/committees',{method:'POST',body:JSON.stringify(f)});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.status===403)denied.value=true;if(r.ok){f.key='';f.name_ar='';f.name_en='';}await load();}
15326      async function archive(c){if(core.includes(String(c.key))){store.state.msg='لا يمكن حذف لجنة أساسية';return;}if(!confirm('أرشفة اللجنة؟'))return;store.state.busy=true;const r=await api('/api/admin/committees/'+encodeURIComponent(c.key)+'/archive',{method:'POST'});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.status===403)denied.value=true;await load();}
15327      return {store,committees,f,core,denied,save,archive};
15328    },
15329    render:(function(){
15330const _Vue = Vue
15331const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
15332
15333const _hoisted_1 = { class: "card formCard" }
15334const _hoisted_2 = {
15335  key: 0,
15336  class: "hint"
15337}
15338const _hoisted_3 = { class: "editGrid" }
15339const _hoisted_4 = ["onUpdate:modelValue"]
15340const _hoisted_5 = ["onUpdate:modelValue"]
15341const _hoisted_6 = ["onUpdate:modelValue"]
15342const _hoisted_7 = ["onClick"]
15343const _hoisted_8 = { class: "card" }
15344const _hoisted_9 = { class: "ltr" }
15345const _hoisted_10 = { class: "statusPill" }
15346const _hoisted_11 = ["disabled", "onClick"]
15347
15348return function render(_ctx, _cache) {
15349  with (_ctx) {
15350    const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, vModelText: _vModelText, withDirectives: _withDirectives, renderList: _renderList, Fragment: _Fragment, toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
15351
15352    const _component_AdminFrame = _resolveComponent("AdminFrame")
15353
15354    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "اللجان" }, {
15355      default: _withCtx(() => [_cache[2] || (_cache[2] = _createElementVNode("div", { class: "card noticeCard compactNotice" }, [_createElementVNode("span", { class: "vueBadge" }, "إدارة المنصة"), _createElementVNode("h3", null, "إدارة اللجان"), _createElementVNode("p", null, "اللجان هي أساس الصلاحيات: العضوية، الوصول، المساعدة، الطوارئ، الفعاليات، والرياضة. لا تضيف لجنة إلا لو عندها شغل حقيقي.")], -1)), _createElementVNode("div", _hoisted_1, [
15356        _cache[0] || (_cache[0] = _createElementVNode("h3", null, "إضافة / تحديث لجنة", -1)),
15357        denied
15358          ? (_openBlock(), _createElementBlock("p", _hoisted_2, "الحفظ يتطلب صلاحية مدير تقنية المعلومات؛ العرض فقط متاح حالياً."))
15359          : _createCommentVNode("", true),
15360        _createElementVNode("div", _hoisted_3, [_withDirectives(_createElementVNode("input", {
15361          "onUpdate:modelValue": $event => ((f.key) = $event),
15362          placeholder: "committee_key مثال media_team"
15363        }, null, 8, _hoisted_4), [[_vModelText, f.key]]), _withDirectives(_createElementVNode("input", {
15364          "onUpdate:modelValue": $event => ((f.name_ar) = $event),
15365          placeholder: "اسم اللجنة بالعربي"
15366        }, null, 8, _hoisted_5), [[_vModelText, f.name_ar]]), _withDirectives(_createElementVNode("input", {
15367          "onUpdate:modelValue": $event => ((f.name_en) = $event),
15368          placeholder: "English name"
15369        }, null, 8, _hoisted_6), [[_vModelText, f.name_en]])]),
15370        _createElementVNode("button", {
15371          class: "btn loadMore",
15372          onClick: save
15373        }, "حفظ اللجنة", 8, _hoisted_7)
15374      ]), _createElementVNode("div", _hoisted_8, [_cache[1] || (_cache[1] = _createElementVNode("h3", null, "اللجان الحالية", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(committees, (c) => {
15375        return (_openBlock(), _createElementBlock("div", {
15376          class: "committeeRow",
15377          key: c.key
15378        }, [_createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(c.name_ar || c.key), 1), _createElementVNode("small", _hoisted_9, _toDisplayString(c.key) + " — " + _toDisplayString(c.name_en || '-'), 1)]), _createElementVNode("span", _hoisted_10, _toDisplayString(c.status || 'active'), 1), _createElementVNode("button", {
15379          class: "smallbtn danger",
15380          disabled: core.includes(String(c.key)),
15381          onClick: $event => (archive(c))
15382        }, _toDisplayString(core.includes(String(c.key))?'أساسية':'أرشفة'), 9, _hoisted_11)]))
15383      }), 128))])]),
15384      _: 1,
15385      __: [2]
15386    }))
15387  }
15388}
15389})()
15390  };
15391
15392
15393  const AdminPwaPage={
15394    components:{AdminFrame},
15395    setup(){
15396      const store=useGzcStore(); const router=useRouter(); const pwa=reactive(pwaState());
15396 const محليKeys=ref([]);
15397      function sync(e){Object.assign(pwa,(e&&e.detail)||pwaState());}
15398      async function loadCaches(){try{محليKeys.value=window.caches?await window.caches.keys():[]}catch(e){محليKeys.value=[];}}
15399      onMounted(async()=>{if(await store.requireAdmin(router)){sync();window.addEventListener('gzc-pwa-state',sync);await loadCaches();}});
15400      async function activatePwa(){try{let r=window.__gzcActivatePwa?await window.__gzcActivatePwa():{ok:false,message:'أداة تفعيل التطبيق غير متاحة'};store.state.msg=r.message||'تم تفعيل التطبيق';sync();await loadCaches();}catch(e){store.state.msg='فشل تفعيل التطبيق: '+(e.message||e);}}
15401      async function updateWorker(){try{if(navigator.serviceWorker){const reg=await navigator.serviceWorker.getRegistration('/'); if(reg) await reg.update();} store.state.msg='تم طلب تحديث التخزين المحلي'; sync(); await loadCaches();}catch(e){store.state.msg='فشل تحديث التخزين المحلي: '+(e.message||e);}}
15402      async function clearCaches(){try{let r=window.__gzcClearVueCaches?await window.__gzcClearVueCaches():{ok:false,message:'التخزين المحلي غير متاح'};store.state.msg=r.message||'تم تنظيف الكاش';await loadCaches();}catch(e){store.state.msg='تعذر تنظيف الكاش';}}
15403      async function installApp(){const r=window.__gzcInstallApp?await window.__gzcInstallApp():{ok:false,message:iosInstallHint()};store.state.msg=r.message||iosInstallHint();sync();await loadCaches();}
15404      return {store,pwa,محليKeys,activatePwa,updateWorker,clearCaches,installApp,pwaStatusName,iosInstallHint};
15405    },
15406    render:(function(){
15407const _Vue = Vue
15408const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
15409
15410const _hoisted_1 = { class: "healthGrid pwaHealthGrid" }
15411const _hoisted_2 = { class: "card healthCard ok" }
15412const _hoisted_3 = {
15413  class: "card collapseSection formCard",
15414  open: ""
15415}
15416const _hoisted_4 = { class: "collapseBody" }
15417const _hoisted_5 = { class: "row" }
15418const _hoisted_6 = ["onClick"]
15419const _hoisted_7 = ["onClick"]
15420const _hoisted_8 = ["onClick"]
15421const _hoisted_9 = ["onClick"]
15422const _hoisted_10 = { class: "hint" }
15423const _hoisted_11 = {
15424  class: "card collapseSection",
15425  open: ""
15426}
15427const _hoisted_12 = { class: "collapseBody" }
15428const _hoisted_13 = {
15429  key: 0,
15430  class: "hint"
15431}
15432
15433return function render(_ctx, _cache) {
15434  with (_ctx) {
15435    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, normalizeClass: _normalizeClass, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, renderList: _renderList, Fragment: _Fragment, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
15436
15437    const _component_AdminFrame = _resolveComponent("AdminFrame")
15438
15439    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "تطبيق الهاتف والأداء" }, {
15440      default: _withCtx(() => [
15441        _cache[13] || (_cache[13] = _createElementVNode("div", { class: "card noticeCard compactNotice" }, [_createElementVNode("span", { class: "vueBadge" }, "تطبيق الهاتف"), _createElementVNode("h3", null, "حالة تطبيق المنصة"), _createElementVNode("p", null, "هذه الصفحة تتابع حالة التثبيت والتخزين المحلي للمنصة. على iPhone يتم التثبيت من Safari عبر Share ثم Add to Home Screen.")], -1)),
15442        _createElementVNode("div", _hoisted_1, [
15443          _createElementVNode("div", { class: _normalizeClass(["card healthCard", pwa.online?'ok':'warn']) }, [_cache[0] || (_cache[0] = _createElementVNode("span", null, "الشبكة", -1)), _createElementVNode("b", null, _toDisplayString(pwa.online?'Online':'Offline'), 1), _cache[1] || (_cache[1] = _createElementVNode("small", null, "حالة المتصفح الحالية", -1))], 2),
15444          _createElementVNode("div", { class: _normalizeClass(["card healthCard", pwa.sw==='failed'?'bad':'ok']) }, [_cache[2] || (_cache[2] = _createElementVNode("span", null, "التخزين المحلي", -1)), _createElementVNode("b", null, _toDisplayString(pwaStatusName(pwa.sw)), 1), _createElementVNode("small", null, _toDisplayString(pwa.error || 'مفعّل'), 1)], 2),
15445          _createElementVNode("div", { class: _normalizeClass(["card healthCard", pwa.activated?'ok':'warn']) }, [_cache[3] || (_cache[3] = _createElementVNode("span", null, "التفعيل المحلي", -1)), _createElementVNode("b", null, _toDisplayString(pwa.activated?'مفعل':'غير مفعل'), 1), _cache[4] || (_cache[4] = _createElementVNode("small", null, "Cache + التخزين المحلي", -1))], 2),
15446          _createElementVNode("div", { class: _normalizeClass(["card healthCard", pwa.standalone?'ok':'warn']) }, [_cache[5] || (_cache[5] = _createElementVNode("span", null, "التثبيت", -1)), _createElementVNode("b", null, _toDisplayString(pwa.standalone?'مثبت':'غير مثبت'), 1), _cache[6] || (_cache[6] = _createElementVNode("small", null, "Standalone / Browser", -1))], 2),
15447          _createElementVNode("div", _hoisted_2, [_cache[7] || (_cache[7] = _
15447createElementVNode("span", null, "الإصدار", -1)), _createElementVNode("b", null, _toDisplayString(pwa.version || '3.8.55'), 1), _cache[8] || (_cache[8] = _createElementVNode("small", null, null, -1))])
15448        ]),
15449        _createElementVNode("details", _hoisted_3, [_cache[9] || (_cache[9] = _createElementVNode("summary", null, [_createElementVNode("b", null, "إجراءات التطبيق"), _createElementVNode("span")], -1)), _createElementVNode("div", _hoisted_4, [_createElementVNode("div", _hoisted_5, [
15450          _createElementVNode("button", {
15451            class: "btn",
15452            onClick: activatePwa
15453          }, "تفعيل التطبيق الآن", 8, _hoisted_6),
15454          _createElementVNode("button", {
15455            class: "btn secondary",
15456            onClick: installApp
15457          }, "تثبيت التطبيق", 8, _hoisted_7),
15458          _createElementVNode("button", {
15459            class: "btn secondary",
15460            onClick: updateWorker
15461          }, "تحديث التخزين المحلي", 8, _hoisted_8),
15462          _createElementVNode("button", {
15463            class: "btn dangerBtn",
15464            onClick: clearCaches
15465          }, "تنظيف التخزين المحلي", 8, _hoisted_9)
15466        ]), _createElementVNode("p", _hoisted_10, _toDisplayString(iosInstallHint()), 1)])]),
15467        _createElementVNode("details", _hoisted_11, [_cache[12] || (_cache[12] = _createElementVNode("summary", null, [_createElementVNode("b", null, "الكاش المحلي"), _createElementVNode("span")], -1)), _createElementVNode("div", _hoisted_12, [(!محليKeys.length)
15468          ? (_openBlock(), _createElementBlock("div", _hoisted_13, "لا توجد ملفات محفوظة محلياً حالياً. اضغط تفعيل التطبيق الآن."))
15469          : _createCommentVNode("", true), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(محليKeys, (k) => {
15470          return (_openBlock(), _createElementBlock("div", {
15471            class: "backupRow",
15472            key: k
15473          }, [_createElementVNode("span", null, _toDisplayString(k), 1), _cache[10] || (_cache[10] = _createElementVNode("b", null, "محلي", -1)), _cache[11] || (_cache[11] = _createElementVNode("small", null, "محلي داخل المتصفح", -1))]))
15474        }), 128))])]),
15475        _cache[14] || (_cache[14] = _createElementVNode("details", { class: "card collapseSection" }, [_createElementVNode("summary", null, [_createElementVNode("b", null, "اختبار سريع"), _createElementVNode("span")]), _createElementVNode("div", { class: "collapseBody" }, [_createElementVNode("p", { class: "hint" }, "بعد تفعيل التطبيق، افتح المنصة مرة واحدة، ثم جرّب ضعف الشبكة. يجب أن تظهر الواجهة أو صفحة عدم الاتصال بوضوح. على iPhone يتم التثبيت عبر Add to Home Screen.")])], -1))
15476      ]),
15477      _: 1,
15478      __: [13,14]
15479    }))
15480  }
15481}
15482})()
15483  };
15484
15485  const AdminNotFoundPage={
15486    components:{AdminFrame},
15487    setup(){const router=useRouter();return{router};},
15488    render:(function(){
15489const _Vue = Vue
15490const { createElementVNode: _createElementVNode } = _Vue
15491
15492const _hoisted_1 = { class: "card emptyCard" }
15493const _hoisted_2 = ["onClick"]
15494
15495return function render(_ctx, _cache) {
15496  with (_ctx) {
15497    const { createElementVNode: _createElementVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = _Vue
15498
15499    const _component_AdminFrame = _resolveComponent("AdminFrame")
15500
15501    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "الصفحة غير موجودة" }, {
15502      default: _withCtx(() => [_createElementVNode("section", _hoisted_1, [_cache[0] || (_cache[0] = _createElementVNode("h3", null, "تعذر العثور على هذه الصفحة", -1)), _cache[1] || (_cache[1] = _createElementVNode("p", { class: "hint" }, "قد يكون الرابط قديماً أو غير متاح لصلاحيات حسابك.", -1)), _createElementVNode("button", {
15503        class: "btn secondary",
15504        onClick: $event => (router.push('/admin'))
15505      }, "العودة إلى لوحة الإدارة", 8, _hoisted_2)])]),
15506      _: 1
15507    }))
15508  }
15509}
15510})()
15511  };
15512
15513
15514  const OfficialFrame={
15515    props:['title'],
15516    setup(){const store=useGzcStore();const router=useRouter();const route=useRoute();const tabs=[['/official','الرئيسية','⌂'],['/official/members','العضوية','👥'],['/official/cases','الحالات','📄'],['/official/emergency','الطوارئ','🚨'],['/official/events','الفعاليات','🗓️'],['/official/announcements','التعميمات','📢']];function active(p){return route.path===p||(p!=='/official'&&route.path.startsWith(p));}function go(p){router.push(p);}return{store,router,tabs,active,go};},
15517    render:(function(){
15518const _Vue = Vue
15519const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
15520
15521const _hoisted_1 = { class: "publicShell officialShell" }
15522const _hoisted_2 = { class: "top" }
15523const _hoisted_3 = ["onClick"]
15524const _hoisted_4 = {
15525  key: 0,
15526  class: "adminAccount officialAccount"
15527}
15528const _hoisted_5 = ["onClick"]
15529const _hoisted_6 = ["onClick"]
15530const _hoisted_7 = ["onClick"]
15531const _hoisted_8 = {
15532  class: "nav bottomPro",
15533  "aria-label": "التنقل الرسمي"
15534}
15535const _hoisted_9 = ["onClick"]
15536const _hoisted_10 = { class: "navIcon" }
15537const _hoisted_11 = { class: "navText" }
15538
15539return function render(_ctx, _cache) {
15540  with (_ctx) {
15541    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, renderSlot: _renderSlot, renderList: _renderList, Fragment: _Fragment, normalizeClass: _normalizeClass } = _Vue
15542
15543    return (_openBlock(), _createElementBlock("section", _hoisted_1, [
15544      _createElementVNode("div", _hoisted_2, [_createElementVNode("button", {
15545        class: "back",
15546        onClick: $event => (go('/official'))
15547      }, "رسمي", 8, _hoisted_3), _createElementVNode("h2", null, _toDisplayString(title), 1)]),
15548      (store.state.me&&store.state.me.official)
15549        ? (_openBlock(), _createElementBlock("div", _hoisted_4, [
15550            _createElementVNode("span", null, _toDisplayString(store.state.me.official.name_ar), 1),
15551            _createElementVNode("button", {
15552              class: "smallbtn",
15553              onClick: $event => (go('/official/tour'))
15554            }, "دليل الاستخدام", 8, _hoisted_5),
15555            _createElementVNode("button", {
15556              class: "smallbtn",
15557              onClick: $event => (go('/official/publish'))
15558            }, "نشر تعميم", 8, _hoisted_6),
15559            _createElementVNode("button", {
15560              class: "smallbtn danger",
15561              onClick: $event => (store.logout(router,'/official/login'))
15562            }, "خروج", 8, _hoisted_7)
15563          ]))
15564        : _createCommentVNode("", true),
15565      _renderSlot($slots, "default"),
15566      _createElementVNode("nav", _hoisted_8, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(tabs, (t) => {
15567        return (_openBlock(), _createElementBlock("button", {
15568          key: t[0],
15569          class: _normalizeClass({active:active(t[0])}),
15570          onClick: $event => (go(t[0]))
15571        }, [_createElementVNode("span", _hoisted_10, _toDisplayString(t[2]), 1), _createElementVNode("span", _hoisted_11, _toDisplayString(t[1]), 1)], 10, _hoisted_9))
15572      }), 128))])
15573    ]))
15574  }
15575}
15576})()
15577  };
15578
15579  const OfficialLoginPage={
15580    components:{PublicFrame},
15581    setup(){const store=useGzcStore();const router=useRouter();const phone=ref('');const code=ref('');const otp=ref(false);async function requestOtp(){store.state.busy=true;store.state.msg='جاري إرسال كود الحساب الرسمي...';const r=await api('/api/auth/request-otp',{method:'POST',body:JSON.stringify({phone:norm(phone.value),purpose:'official_login'})});store.state.busy=false;store.state.msg=r.message||r.error||'';otp.value=!!r.ok;}async function verifyOtp(){store.state.busy=true;store.state.msg='جاري التحقق...';const r=await api('/api/auth/verify-otp',{method:'POST',body:JSON.stringify({phone:norm(phone.value),code:code.value,purpose:'official_login'})});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok){const me=await store.loadMe(true);router.replace(me&&me.official&&me.official.tour_required?'/official/tour':'/official');}}return{store,phone,code,otp,requestOtp,verifyOtp};},
15582    render:(function(){
15583const _Vue = Vue
15584const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
15585
15586const _hoisted_1 = { class: "card" }
15587const _hoisted_2 = ["onUpdate:modelValue"]
15588const _hoisted_3 = ["onClick"]
15589const _hoisted_4 = ["onUpdate:modelValue"]
15590const _hoisted_5 = ["onClick"]
15591
15592return function render(_ctx, _cache) {
15593  with (_ctx) {
15594    const { createElementVNode: _createElementVNode, vModelText: _vModelText, withDirectives: _withDirectives, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
15595
15596    const _component_PublicFrame = _resolveComponent("PublicFrame")
15597
15598    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "دخول الحساب الرسمي" }, {
15599      default: _withCtx(() => [_createElementVNode("div", _hoisted_1, [
15600        _cache[0] || (_cache[0] = _createElementVNode("span", { class: "vueBadge" }, "حسابات السفارة / القنصلية", -1)),
15601        _cache[1] || (_cache[1] = _createElementVNode("h3", null, "دخول جهة رسمية", -1)),
15602        _cache[2] || (_cache[2] = _createElementVNode("p", { class: "hint" }, "هذا الدخول مخصص للحسابات الرسمية المسجلة من الإدارة. كل حساب يمكنه الدخول بثلاثة أرقام.", -1)),
15603        _withDirectives(_createElementVNode("input", {
15604          class: "ltr",
15605          "onUpdate:modelValue": $event => ((phone) = $event),
15606          placeholder: "رقم واتساب الرسمي"
15607        }, null, 8, _hoisted_2), [[_vModelText, phone]]),
15608        _createElementVNode("button", {
15609          class: "btn loadMore",
15610          onClick: requestOtp
15611        }, "إرسال الكود", 8, _hoisted_3),
15612        otp
15613          ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_withDirectives(_createElementVNode("input", {
15614              class: "ltr",
15615              "onUpdate:modelValue": $event => ((code) = $event),
15616              placeholder: "رمز التحقق"
15617            }, null, 8, _hoisted_4), [[_vModelText, code]]), _createElementVNode("button", {
15618              class: "btn loadMore",
15619              onClick: verifyOtp
15620            }, "تحقق ودخول", 8, _hoisted_5)], 64))
15621          : _createCommentVNode("", true)
15622      ])]),
15623      _: 1
15624    }))
15625  }
15626}
15627})()
15628  };
15629
15630  const OfficialTourPage={
15631    components:{OfficialFrame},
15632    setup(){
15633      const store=useGzcStore(); const router=useRouter(); const route=useRoute(); const active=ref(0);
15634      const steps=[
15635        {icon:'🏛️',title:'أنت داخل باسم جهة رسمية',body:'هذا الحساب مخصص للسفارة أو القنصلية أو أي جهة رسمية معتمدة. كل رقم دخول مرتبط بنفس الجهة، لكن يتم تسجيل استخدام كل رقم لوحده.'},
15636        {icon:'👥',title:'العضويات للعرض فقط',body:'يمكنكم الاطلاع على بيانات العضوية والحالات حسب الصلاحيات، لكن لا يوجد تعديل أو حذف لبيانات الأعضاء من الحساب الرسمي.'},
15637        {icon:'📢',title:'نشر تعميم رسمي',body:'التعميم المنشور يظهر باسم الجهة الرسمية وفي قناتها المحددة: السفارة أو القنصلية. يمكن إضافة نص، رابط، صور، PDF أو فيديو قصير.'},
15638        {icon:'💬',title:'واتساب والقوالب',body:'عند نشر تعميم رسمي، النظام يضيف رسائل واتساب إلى قائمة الإرسال إذا كان قالب official_announcement مضبوطاً. لا يتم الإرسال العشوائي بدون قالب.'},
15639        {icon:'🚨',title:'الحالات والطوارئ',body:'الحساب الرسمي يستطيع المتابعة والاطلاع حسب الصلاحية. المعالجة التشغيلية تبقى عند إدارة المنصة واللجان المختصة.'},
15640        {icon:'🔐',title:'الأمان وتغيير الموظف',body:'كل رقم تظهر له هذه الجولة أول مرة. وإذا تغير الموظف مستقبلاً، الإدارة تستطيع إعادة الجولة لهذا الرقم، ويمكنكم فتح دليل الاستخدام في أي وقت من الأعلى.'}
15641      ];
15642      const current=computed(()=>steps[Math.max(0,Math.min(active.value,steps.length-1))]);
15643      const official=computed(()=>store.state.me&&store.state.me.official?store.state.me.official:{});
15644      async function load(){const me=await store.loadMe();if(!me||!me.authenticated||!me.official){router.replace('/official/login');return;}}
15645      function next(){if(active.value<steps.length-1)active.value++;else finish();}
15646      function prev(){if(active.value>0)active.value--;}
15647      async function finish(){store.state.busy=true;const r=await api('/api/official/tour/seen',{method:'POST',body:JSON.stringify({version:'official-tour-v1'})});store.state.busy=false;store.state.msg=r.message||r.error||'';await store.loadMe();router.replace('/official');}
15648      onMounted(load);
15649      return{store,route,steps,active,current,official,next,prev,finish,shortDate};
15650    },
15651    render:(function(){
15652const _Vue = Vue
15653const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
15654
15655const _hoisted_1 = { class: "card officialTourHero" }
15656const _hoisted_2 = { class: "officialTourMeta" }
15657const _hoisted_3 = { dir: "ltr" }
15658const _hoisted_4 = { key: 0 }
15659const _hoisted_5 = { key: 1 }
15660const _hoisted_6 = { class: "card officialTourStep" }
15661const _hoisted_7 = { class: "officialTourIcon" }
15662const _hoisted_8 = { class: "tourDots" }
15663const _hoisted_9 = ["onClick"]
15664const _hoisted_10 = { class: "memberActions tourActions" }
15665const _hoisted_11 = ["disabled", "onClick"]
15666const _hoisted_12 = ["onClick"]
15667
15668return function render(_ctx, _cache) {
15669  with (_ctx) {
15670    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, renderList: _renderList, Fragment: _Fragment, normalizeClass: _normalizeClass, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
15671
15672    const _component_OfficialFrame = _resolveComponent("OfficialFrame")
15673
15674    return (_openBlock(), _createBlock(_component_OfficialFrame, { title: "جولة الحساب الرسمي" }, {
15675      default: _withCtx(() => [_createElementVNode("section", _hoisted_1, [
15676        _cache[1] || (_cache[1] = _createElementVNode("span", { class: "vueBadge" }, "دليل الحساب الرسمي", -1)),
15677        _createElementVNode("h3", null, "مرحباً " + _toDisplayString(official.name_ar || 'الحساب الرسمي'), 1),
15678        _cache[2] || (_cache[2] = _createElementVNode("p", null, "هذه الجولة تظهر لأول مرة لكل رقم دخول رسمي. الهدف هو توضيح حدود الصلاحية وطريقة النشر والمتابعة لكل مستخدم جديد.", -1)),
15679        _createElementVNode("div", _hoisted_2, [_createElementVNode("span", null, [_cache[0] || (_cache[0] = _createTextVNode("رقم الدخول: ")), _createElementVNode("b", _hoisted_3, _toDisplayString(official.login_phone || '-'), 1)]), (official.phone_label)
15680          ? (_openBlock(), _createElementBlock("span", _hoisted_4, _toDisplayString(official.phone_label), 1))
15681          : _createCommentVNode("", true), (official.tour_seen_at)
15682          ? (_openBlock(), _createElementBlock("span", _hoisted_5, "آخر مشاهدة: " + _toDisplayString(shortDate(official.tour_seen_at)), 1))
15683          : _createCommentVNode("", true)])
15684      ]), _createElementVNode("section", _hoisted_6, [
15685        _createElementVNode("div", _hoisted_7, _toDisplayString(current.icon), 1),
15686        _createElementVNode("h2", null, _toDisplayString(current.title), 1),
15687        _createElementVNode("p", null, _toDisplayString(current.body), 1),
15688        _createElementVNode("div", _hoisted_8, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(steps, (s, i) => {
15689          return (_openBlock(), _createElementBlock("button", {
15690            key: i,
15691            class: _normalizeClass({active:i===active}),
15692            onClick: $event => (active=i)
15693          }, _toDisplayString(i+1), 11, _hoisted_9))
15694        }), 128))]),
15695        _createElementVNode("div", _hoisted_10, [_createElementVNode("button", {
15696          class: "btn secondary",
15697          disabled: active===0,
15698          onClick: prev
15699        }, "السابق", 8, _hoisted_11), _createElementVNode("button", {
15700          class: "btn loadMore",
15701          onClick: next
15702        }, _toDisplayString(active===steps.length-1?'فهمت، ابدأ العمل':'التالي'), 9, _hoisted_12)])
15703      ]), _cache[3] || (_cache[3] = _createElementVNode("section", { class: "card officialTourRules" }, [_createElementVNode("h3", null, "قواعد مختصرة لاستخدام الحساب الرسمي"), _createElementVNode("ul", null, [
15704        _createElementVNode("li", null, "لا تنشر تعميم إلا إذا كان صادر من الجهة الرسمية فعلاً."),
15705        _createElementVNode("li", null, "لا تكتب بيانات شخصية حساسة داخل نص التعميم العام."),
15706        _createElementVNode("li", null, "راجع العنوان والنص قبل النشر لأن التعميم قد يصل واتساب للأعضاء."),
15707        _createElementVNode("li", null, "إذا تغير الموظف المسؤول عن الرقم، اطلب من الإدارة إعادة الجولة لهذا الرقم.")
15708      ])], -1))]),
15709      _: 1,
15710      __: [3]
15711    }))
15712  }
15713}
15714})()
15715  };
15716
15717  const OfficialDashboardPage={
15718    components:{OfficialFrame},
15719    setup(){const store=useGzcStore();const router=useRouter();onMounted(async()=>
15719{if(await store.requireOfficial(router))await store.loadOfficialDashboard(router);});const c=computed(()=>store.state.dash||{});return{store,c};},
15720    render:(function(){
15721const _Vue = Vue
15722const { createElementVNode: _createElementVNode } = _Vue
15723
15724const _hoisted_1 = { class: "publicHero" }
15725const _hoisted_2 = { class: "miniStats adminStatsPro" }
15726const _hoisted_3 = { class: "homeGrid" }
15727const _hoisted_4 = ["onClick"]
15728const _hoisted_5 = ["onClick"]
15729const _hoisted_6 = ["onClick"]
15730const _hoisted_7 = ["onClick"]
15731
15732return function render(_ctx, _cache) {
15733  with (_ctx) {
15734    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = _Vue
15735
15736    const _component_OfficialFrame = _resolveComponent("OfficialFrame")
15737
15738    return (_openBlock(), _createBlock(_component_OfficialFrame, { title: "لوحة الحساب الرسمي" }, {
15739      default: _withCtx(() => [_createElementVNode("section", _hoisted_1, [_cache[0] || (_cache[0] = _createElementVNode("div", { class: "heroBadge" }, "حساب رسمي", -1)), _createElementVNode("h1", null, _toDisplayString(store.state.me&&store.state.me.official&&store.state.me.official.name_ar || 'حساب رسمي'), 1), _cache[1] || (_cache[1] = _createElementVNode("p", null, "اطلاع موسع على المنصة + نشر تعميمات رسمية بدون صلاحيات تعديل أو حذف.", -1))]), _createElementVNode("section", _hoisted_2, [
15740        _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(c.members||0), 1), _cache[2] || (_cache[2] = _createElementVNode("small", null, "عضو", -1))]),
15741        _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(c.approved_members||0), 1), _cache[3] || (_cache[3] = _createElementVNode("small", null, "معتمد", -1))]),
15742        _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(c.open_cases||0), 1), _cache[4] || (_cache[4] = _createElementVNode("small", null, "حالات", -1))]),
15743        _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(c.emergencies||0), 1), _cache[5] || (_cache[5] = _createElementVNode("small", null, "طوارئ", -1))])
15744      ]), _createElementVNode("section", _hoisted_3, [
15745        _createElementVNode("button", {
15746          class: "homeTile",
15747          onClick: $event => ($router.push('/official/members'))
15748        }, _cache[6] || (_cache[6] = [_createElementVNode("span", { class: "ico" }, "👥", -1), _createElementVNode("b", null, "بيانات الأعضاء", -1), _createElementVNode("small", null, "عرض فقط", -1)]), 8, _hoisted_4),
15749        _createElementVNode("button", {
15750          class: "homeTile",
15751          onClick: $event => ($router.push('/official/cases'))
15752        }, _cache[7] || (_cache[7] = [_createElementVNode("span", { class: "ico" }, "📄", -1), _createElementVNode("b", null, "الحالات", -1), _createElementVNode("small", null, "وصول ومساعدة", -1)]), 8, _hoisted_5),
15753        _createElementVNode("button", {
15754          class: "homeTile dangerTile",
15755          onClick: $event => ($router.push('/official/emergency'))
15756        }, _cache[8] || (_cache[8] = [_createElementVNode("span", { class: "ico" }, "🚨", -1), _createElementVNode("b", null, "الطوارئ", -1), _createElementVNode("small", null, "عرض فقط", -1)]), 8, _hoisted_6),
15757        _createElementVNode("button", {
15758          class: "homeTile",
15759          onClick: $event => ($router.push('/official/publish'))
15760        }, _cache[9] || (_cache[9] = [_createElementVNode("span", { class: "ico" }, "📢", -1), _createElementVNode("b", null, "نشر تعميم رسمي", -1), _createElementVNode("small", null, "في خانتكم فقط", -1)]), 8, _hoisted_7)
15761      ])]),
15762      _: 1
15763    }))
15764  }
15765}
15766})()
15767  };
15768
15769  const OfficialMembersPage={
15770    components:{OfficialFrame},
15771    setup(){const store=useGzcStore();const router=useRouter();async function load(){if(await store.requireOfficial(router))await store.loadOfficialMembers(false,router);}onMounted(load);async function more(){store.state.memberPage++;await store.loadOfficialMembers(true,router);}watch(()=>[store.state.filters.search,store.state.filters.status],()=>{clearTimeout(window.__gzcOfficialMemberTimer);window.__gzcOfficialMemberTimer=setTimeout(load,350);});return{store,load,more,statusName};},
15772    render:(function(){
15773const _Vue = Vue
15774const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
15775
15776const _hoisted_1 = { class: "card formCard" }
15777const _hoisted_2 = { class: "editGrid" }
15778const _hoisted_3 = ["onUpdate:modelValue"]
15779const _hoisted_4 = ["onUpdate:modelValue"]
15780const _hoisted_5 = ["value"]
15781const _hoisted_6 = { class: "hint" }
15782const _hoisted_7 = {
15783  key: 0,
15784  class: "card emptyCard"
15785}
15786const _hoisted_8 = { class: "memberList" }
15787const _hoisted_9 = { class: "memberMiniIdentity" }
15788const _hoisted_10 = ["src"]
15789const _hoisted_11 = {
15790  key: 1,
15791  class: "memberThumb memberThumbPlaceholder"
15792}
15793const _hoisted_12 = { class: "memberIdentityInfo" }
15794const _hoisted_13 = { class: "memberMiniMeta" }
15795const _hoisted_14 = { dir: "ltr" }
15796const _hoisted_15 = { class: "memberMiniFoot" }
15797const _hoisted_16 = ["onClick"]
15798const _hoisted_17 = ["onClick"]
15799
15800return function render(_ctx, _cache) {
15801  with (_ctx) {
15802    const { createElementVNode: _createElementVNode, vModelText: _vModelText, withDirectives: _withDirectives, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, toDisplayString: _toDisplayString, vModelSelect: _vModelSelect, createCommentVNode: _createCommentVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
15803
15804    const _component_OfficialFrame = _resolveComponent("OfficialFrame")
15805
15806    return (_openBlock(), _createBlock(_component_OfficialFrame, { title: "قائمة العضويات" }, {
15807      default: _withCtx(() => [
15808        _createElementVNode("div", _hoisted_1, [_cache[0] || (_cache[0] = _createElementVNode("h3", null, "بحث العضوية", -1)), _createElementVNode("div", _hoisted_2, [_withDirectives(_createElementVNode("input", {
15809          "onUpdate:modelValue": $event => ((store.state.filters.search) = $event),
15810          placeholder: "بحث بالاسم / الرقم / GZC"
15811        }, null, 8, _hoisted_3), [[_vModelText, store.state.filters.search]]), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((store.state.filters.status) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList($optionList('member_status',store.state.filters.status), (o) => {
15812          return (_openBlock(), _createElementBlock("option", {
15813            key: o.value,
15814            value: o.value
15815          }, _toDisplayString(o.label), 9, _hoisted_5))
15816        }), 128))], 8, _hoisted_4), [[_vModelSelect, store.state.filters.status]])]), _createElementVNode("p", _hoisted_6, "العدد: " + _toDisplayString(store.state.memberTotal), 1)]),
15817        (!store.state.members.length&&!store.state.busy)
15818          ? (_openBlock(), _createElementBlock("div", _hoisted_7, "لا توجد عضويات."))
15819          : _createCommentVNode("", true),
15820        _createElementVNode("div", _hoisted_8, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(store.state.members, (m) => {
15821          return (_openBlock(), _createElementBlock("div", {
15822            class: "card memberRowPro",
15823            key: m.id
15824          }, [_createElementVNode("div", _hoisted_9, [($memberPhoto(m,'thumb'))
15825            ? (_openBlock(), _createElementBlock("img", {
15826                key: 0,
15827                class: "memberThumb",
15828                src: $memberPhoto(m,'thumb'),
15829                loading: "lazy",
15830                alt: ""
15831              }, null, 8, _hoisted_10))
15832            : (_openBlock(), _createElementBlock("div", _hoisted_11, "👤")), _createElementVNode("div", _hoisted_12, [_createElementVNode("b", null, _toDisplayString(m.full_name||'عضو'), 1), _createElementVNode("div", _hoisted_13, [_createElementVNode("span", null, _toDisplayString(m.gzc_id||'-'), 1), _createElementVNode("span", _hoisted_14, _toDisplayString(m.whatsapp||'-'), 1)]), _createElementVNode("div", _hoisted_15, [_
15832createElementVNode("span", null, _toDisplayString(statusName(m.status)), 1), _createElementVNode("span", null, _toDisplayString($cityLabel(m.china_city)||'-'), 1), _createElementVNode("span", null, _toDisplayString(m.category||'-'), 1)])])]), _createElementVNode("button", {
15833            class: "smallbtn secondary",
15834            onClick: $event => ($router.push('/official/member/'+m.id))
15835          }, "عرض", 8, _hoisted_16)]))
15836        }), 128))]),
15837        (store.state.memberHasMore)
15838          ? (_openBlock(), _createElementBlock("button", {
15839              key: 1,
15840              class: "btn secondary loadMore",
15841              onClick: more
15842            }, "تحميل المزيد", 8, _hoisted_17))
15843          : _createCommentVNode("", true)
15844      ]),
15845      _: 1
15846    }))
15847  }
15848}
15849})()
15850  };
15851
15852  const OfficialMemberDetailPage={
15853    components:{OfficialFrame},
15854    setup(){const store=useGzcStore();const route=useRoute();const router=useRouter();async function load(){if(await store.requireOfficial(router))await store.loadOfficialMember(route.params.id,router);}onMounted(load);const m=computed(()=>store.state.selectedMember&&store.state.selectedMember.member);const cases=computed(()=>safeArray(store.state.selectedMember&&store.state.selectedMember.cases));const emergencies=computed(()=>safeArray(store.state.selectedMember&&store.state.selectedMember.emergencies));return{store,m,cases,emergencies,statusName,caseStatusName,caseTypeName,shortDate};},
15855    render:(function(){
15856const _Vue = Vue
15857const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
15858
15859const _hoisted_1 = {
15860  key: 0,
15861  class: "card skeleton"
15862}
15863const _hoisted_2 = { class: "card memberDetailHero" }
15864const _hoisted_3 = { class: "detailIdentity" }
15865const _hoisted_4 = ["src"]
15866const _hoisted_5 = {
15867  key: 1,
15868  class: "avatar placeholder"
15869}
15870const _hoisted_6 = { class: "memberMiniFoot" }
15871const _hoisted_7 = { class: "card memberDetailCard" }
15872const _hoisted_8 = { class: "profileLine" }
15873const _hoisted_9 = { dir: "ltr" }
15874const _hoisted_10 = { class: "profileLine" }
15875const _hoisted_11 = { dir: "ltr" }
15876const _hoisted_12 = { class: "profileLine" }
15877const _hoisted_13 = { class: "profileLine" }
15878const _hoisted_14 = { class: "profileLine" }
15879const _hoisted_15 = { class: "profileLine" }
15880const _hoisted_16 = { class: "profileLine" }
15881const _hoisted_17 = { class: "profileLine" }
15882const _hoisted_18 = { class: "card relatedCard" }
15883const _hoisted_19 = {
15884  key: 0,
15885  class: "hint"
15886}
15887
15888return function render(_ctx, _cache) {
15889  with (_ctx) {
15890    const { openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, toDisplayString: _toDisplayString, createElementVNode: _createElementVNode, renderList: _renderList, Fragment: _Fragment, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
15891
15892    const _component_OfficialFrame = _resolveComponent("OfficialFrame")
15893
15894    return (_openBlock(), _createBlock(_component_OfficialFrame, { title: "بيانات العضو" }, {
15895      default: _withCtx(() => [(!m)
15896        ? (_openBlock(), _createElementBlock("div", _hoisted_1, "جاري تحميل البيانات..."))
15897        : (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [_createElementVNode("div", _hoisted_2, [_createElementVNode("div", _hoisted_3, [($memberPhoto(m,'thumb'))
15898            ? (_openBlock(), _createElementBlock("img", {
15899                key: 0,
15900                src: $memberPhoto(m,'thumb'),
15901                loading: "lazy",
15902                alt: ""
15903              }, null, 8, _hoisted_4))
15904            : (_openBlock(), _createElementBlock("div", _hoisted_5, "👤")), _createElementVNode("div", null, [_createElementVNode("h3", null, _toDisplayString(m.full_name||'عضو'), 1), _createElementVNode("div", _hoisted_6, [_createElementVNode("span", null, _toDisplayString(statusName(m.status)), 1), _createElementVNode("span", null, _toDisplayString(m.gzc_id||'-'), 1)])])])]), _createElementVNode("div", _hoisted_7, [
15905            _cache[8] || (_cache[8] = _createElementVNode("h3", null, "بيانات العضوية", -1)),
15906            _createElementVNode("div", _hoisted_8, [_cache[0] || (_cache[0] = _createElementVNode("b", null, "واتساب", -1)), _createElementVNode("span", _hoisted_9, _toDisplayString(m.whatsapp||'-'), 1)]),
15907            _createElementVNode("div", _hoisted_10, [_cache[1] || (_cache[1] = _createElementVNode("b", null, "هاتف الصين", -1)), _createElementVNode("span", _hoisted_11, _toDisplayString(m.china_ph
15907one||'-'), 1)]),
15908            _createElementVNode("div", _hoisted_12, [_cache[2] || (_cache[2] = _createElementVNode("b", null, "WeChat", -1)), _createElementVNode("span", null, _toDisplayString(m.wechat||'-'), 1)]),
15909            _createElementVNode("div", _hoisted_13, [_cache[3] || (_cache[3] = _createElementVNode("b", null, "المدينة", -1)), _createElementVNode("span", null, _toDisplayString($cityLabel(m.china_city)||'-'), 1)]),
15910            _createElementVNode("div", _hoisted_14, [_cache[4] || (_cache[4] = _createElementVNode("b", null, "الحي", -1)), _createElementVNode("span", null, _toDisplayString(m.china_district||'-'), 1)]),
15911            _createElementVNode("div", _hoisted_15, [_cache[5] || (_cache[5] = _createElementVNode("b", null, "فئة العضوية", -1)), _createElementVNode("span", null, _toDisplayString(m.category||'-'), 1)]),
15912            _createElementVNode("div", _hoisted_16, [_cache[6] || (_cache[6] = _createElementVNode("b", null, "المهنة", -1)), _createElementVNode("span", null, _toDisplayString(m.profession||'-'), 1)]),
15913            _createElementVNode("div", _hoisted_17, [_cache[7] || (_cache[7] = _createElementVNode("b", null, "الأسرة", -1)), _createElementVNode("span", null, _toDisplayString(m.family_count||0), 1)])
15914          ]), _createElementVNode("div", _hoisted_18, [
15915            _cache[9] || (_cache[9] = _createElementVNode("h3", null, "الحالات والطوارئ المرتبطة", -1)),
15916            (!cases.length&&!emergencies.length)
15917              ? (_openBlock(), _createElementBlock("div", _hoisted_19, "لا توجد حالات مرتبطة."))
15918              : _createCommentVNode("", true),
15919            (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(cases, (c) => {
15920              return (_openBlock(), _createElementBlock("div", {
15921                class: "relatedItem",
15922                key: 'c'+c.id
15923              }, [_createElementVNode("b", null, _toDisplayString(c.case_code), 1), _createElementVNode("span", null, _toDisplayString(caseTypeName(c.type)) + " — " + _toDisplayString(caseStatusName(c.status)), 1), _createElementVNode("small", null, _toDisplayString(shortDate(c.created_at)), 1)]))
15924            }), 128)),
15925            (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(emergencies, (e) => {
15926              return (_openBlock(), _createElementBlock("div", {
15927                class: "relatedItem dangerRelated",
15928                key: 'e'+e.id
15929              }, [_createElementVNode("b", null, _toDisplayString(e.ticket_code), 1), _createElementVNode("span", null, _toDisplayString(e.type) + " — " + _toDisplayString(caseStatusName(e.status)) + " — " + _toDisplayString(e.priority), 1), _createElementVNode("small", null, _toDisplayString(shortDate(e.created_at)), 1)]))
15930            }), 128))
15931          ])], 64))]),
15932      _: 1
15933    }))
15934  }
15935}
15936})()
15937  };
15938
15939  const OfficialCasesPage={
15940    components:{OfficialFrame},
15941    setup(){const store=useGzcStore();const router=useRouter();const mode=ref('');function openAttachment(m){if(m&&m.file_url)window.open(m.file_url,'_blank','noopener');}async function load(){if(await store.requireOfficial(router))await store.loadOfficialCases(mode.value,router);}onMounted(load);watch(mode,load);return{store,mode,caseTypeName,caseStatusName,shortDate,mediaSrc,openAttachment};},
15942    render:(function(){
15943const _Vue = Vue
15944const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
15945
15946const _hoisted_1 = { class: "card opsSummaryCard" }
15947const _hoisted_2 = { class: "opsFilterBar" }
15948const _hoisted_3 = ["onClick"]
15949const _hoisted_4 = ["onClick"]
15950const _hoisted_5 = ["onClick"]
15951const _hoisted_6 = {
15952  key: 0,
15953  class: "card emptyCard"
15954}
15955const _hoisted_7 = { class: "opsList" }
15956const _hoisted_8 = { class: "memberCardTop" }
15957const _hoisted_9 = { class: "statusPill" }
15958const _hoisted_10 = { class: "hint" }
15959const _hoisted_11 = {
15960  key: 0,
15961  class: "announcementMediaGrid"
15962}
15963const _hoisted_12 = ["onClick"]
15964const _hoisted_13 = ["src"]
15965const _hoisted_14 = { class: "notifyMeta" }
15966const _hoisted_15 = { dir: "ltr" }
15967
15968return function render(_ctx, _cache) {
15969  with (_ctx) {
15970    const { normalizeClass: _normalizeClass, createElementVNode: _
15970createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, renderList: _renderList, Fragment: _Fragment, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
15971
15972    const _component_OfficialFrame = _resolveComponent("OfficialFrame")
15973
15974    return (_openBlock(), _createBlock(_component_OfficialFrame, { title: "الحالات" }, {
15975      default: _withCtx(() => [_createElementVNode("div", _hoisted_1, [_createElementVNode("div", _hoisted_2, [_createElementVNode("button", {
15976        class: _normalizeClass(mode===''?'active':''),
15977        onClick: $event => (mode='')
15978      }, "الكل", 10, _hoisted_3), _createElementVNode("button", {
15979        class: _normalizeClass(mode==='arrival'?'active':''),
15980        onClick: $event => (mode='arrival')
15981      }, "الوصول", 10, _hoisted_4), _createElementVNode("button", {
15982        class: _normalizeClass(mode==='help'?'active':''),
15983        onClick: $event => (mode='help')
15984      }, "المساعدة", 10, _hoisted_5)])]), (!store.state.adminCases.length&&!store.state.busy)
15985        ? (_openBlock(), _createElementBlock("div", _hoisted_6, "لا توجد حالات."))
15986        : _createCommentVNode("", true), _createElementVNode("div", _hoisted_7, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(store.state.adminCases, (c) => {
15987        return (_openBlock(), _createElementBlock("div", {
15988          class: "card opsCard",
15989          key: c.id
15990        }, [
15991          _createElementVNode("div", _hoisted_8, [_createElementVNode("h3", null, _toDisplayString(c.case_code||c.title||'حالة'), 1), _createElementVNode("span", _hoisted_9, _toDisplayString(caseStatusName(c.status)), 1)]),
15992          _createElementVNode("p", _hoisted_10, [_createElementVNode("b", null, _toDisplayString(caseTypeName(c.type)), 1), _createTextVNode(" — " + _toDisplayString(c.full_name||c.contact_name||'بدون اسم'), 1)]),
15993          _createElementVNode("p", null, _toDisplayString(c.description||'لا يوجد وصف.'), 1),
15994          (c.media&&c.media.length)
15995            ? (_openBlock(), _createElementBlock("div", _hoisted_11, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(c.media, (m) => {
15996                return (_openBlock(), _createElementBlock("button", {
15997                  key: m.id,
15998                  class: "announcementMediaItem",
15999                  onClick: $event => (openAttachment(m))
16000                }, [_createElementVNode("img", {
16001                  src: mediaSrc(m),
16002                  loading: "lazy",
16003                  alt: "صورة الحالة"
16004                }, null, 8, _hoisted_13), _cache[0] || (_cache[0] = _createElementVNode("span", null, "صورة", -1))], 8, _hoisted_12))
16005              }), 128))]))
16006            : _createCommentVNode("", true),
16007          _createElementVNode("div", _hoisted_14, [_createElementVNode("span", _hoisted_15, _toDisplayString(c.whatsapp||c.contact_whatsapp||c.contact_china_phone||'-'), 1), _createElementVNode("span", null, _toDisplayString($cityLabel(c.china_city)||'-'), 1), _createElementVNode("span", null, _toDisplayString(shortDate(c.created_at)), 1)])
16008        ]))
16009      }), 128))])]),
16010      _: 1
16011    }))
16012  }
16013}
16014})()
16015  };
16016
16017  const OfficialEmergencyPage={
16018    components:{OfficialFrame},
16019    setup(){const store=useGzcStore();const router=useRouter();function openAttachment(m){if(m&&m.file_url)window.open(m.file_url,'_blank','noopener');}async function load(){if(await store.requireOfficial(router))await store.loadOfficialEmergencies(router);}onMounted(load);return{store,caseStatusName,shortDate,mediaSrc,openAttachment};},
16020    render:(function(){
16021const _Vue = Vue
16022const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
16023
16024const _hoisted_1 = {
16025  key: 0,
16026  class: "card emptyCard"
16027}
16028const _hoisted_2 = { class: "opsList" }
16029const _hoisted_3 = { class: "memberCardTop" }
16030const _hoisted_4 = { class: "statusPill" }
16031const _hoisted_5 = { class: "hint" }
16032const _hoisted_6 = {
16033  key: 0,
16034  class: "announcementMediaGrid"
16035}
16036const _hoisted_7 = ["onClick"]
16037const _hoisted_8 = ["src"]
16038const _hoisted_9 = { class: "notifyMeta" }
16039const _hoisted_10 = { dir: "ltr" }
16040
16041return function render(_ctx, _cache) {
16042  with (_ctx) {
16043    const { openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _
16043createCommentVNode, renderList: _renderList, Fragment: _Fragment, toDisplayString: _toDisplayString, createElementVNode: _createElementVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
16044
16045    const _component_OfficialFrame = _resolveComponent("OfficialFrame")
16046
16047    return (_openBlock(), _createBlock(_component_OfficialFrame, { title: "الطوارئ" }, {
16048      default: _withCtx(() => [(!store.state.emergencies.length&&!store.state.busy)
16049        ? (_openBlock(), _createElementBlock("div", _hoisted_1, "لا توجد بلاغات طوارئ."))
16050        : _createCommentVNode("", true), _createElementVNode("div", _hoisted_2, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(store.state.emergencies, (e) => {
16051        return (_openBlock(), _createElementBlock("div", {
16052          class: "card opsCard dangerRelated",
16053          key: e.id
16054        }, [
16055          _createElementVNode("div", _hoisted_3, [_createElementVNode("h3", null, _toDisplayString(e.ticket_code||'بلاغ طوارئ'), 1), _createElementVNode("span", _hoisted_4, _toDisplayString(caseStatusName(e.status)), 1)]),
16056          _createElementVNode("p", _hoisted_5, _toDisplayString(e.full_name||'عضو') + " — " + _toDisplayString(e.type) + " — " + _toDisplayString(e.priority), 1),
16057          _createElementVNode("p", null, _toDisplayString(e.description||'لا يوجد وصف.'), 1),
16058          (e.media&&e.media.length)
16059            ? (_openBlock(), _createElementBlock("div", _hoisted_6, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(e.media, (m) => {
16060                return (_openBlock(), _createElementBlock("button", {
16061                  key: m.id,
16062                  class: "announcementMediaItem",
16063                  onClick: $event => (openAttachment(m))
16064                }, [_createElementVNode("img", {
16065                  src: mediaSrc(m),
16066                  loading: "lazy",
16067                  alt: "صورة البلاغ"
16068                }, null, 8, _hoisted_8), _cache[0] || (_cache[0] = _createElementVNode("span", null, "صورة", -1))], 8, _hoisted_7))
16069              }), 128))]))
16070            : _createCommentVNode("", true),
16071          _createElementVNode("div", _hoisted_9, [_createElementVNode("span", _hoisted_10, _toDisplayString(e.whatsapp||e.china_phone||'-'), 1), _createElementVNode("span", null, _toDisplayString(e.location_text||$cityLabel(e.china_city)||'-'), 1), _createElementVNode("span", null, _toDisplayString(shortDate(e.created_at)), 1)])
16072        ]))
16073      }), 128))])]),
16074      _: 1
16075    }))
16076  }
16077}
16078})()
16079  };
16080
16081  const OfficialEventsPage={
16082    components:{OfficialFrame},
16083    setup(){const store=useGzcStore();const router=useRouter();async function load(){if(await store.requireOfficial(router)){store.state.busy=true;const r=await api('/api/events?limit=30');store.state.events=safeArray(r.events);store.state.busy=false;}}onMounted(load);return{store,load,eventCategoryName};},
16084    render:(function(){
16085const _Vue = Vue
16086const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
16087
16088const _hoisted_1 = {
16089  key: 0,
16090  class: "card emptyCard"
16091}
16092const _hoisted_2 = ["src"]
16093const _hoisted_3 = { class: "memberCardTop" }
16094const _hoisted_4 = { class: "statusPill" }
16095const _hoisted_5 = { class: "hint" }
16096const _hoisted_6 = { class: "eventQuickMeta" }
16097const _hoisted_7 = { class: "metaRow" }
16098const _hoisted_8 = { class: "metaRow" }
16099const _hoisted_9 = { class: "miniStats mediaMini" }
16100const _hoisted_10 = ["onClick"]
16101
16102return function render(_ctx, _cache) {
16103  with (_ctx) {
16104    const { openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, renderList: _renderList, Fragment: _Fragment, toDisplayString: _toDisplayString, createElementVNode: _createElementVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
16105
16106    const _component_OfficialFrame = _resolveComponent("OfficialFrame")
16107
16108    return (_openBlock(), _createBlock(_component_OfficialFrame, { title: "الفعاليات والألبومات" }, {
16109      default: _withCtx(() => [(!store.state.events.length&&!store.state.busy)
16110        ? (_openBlock(), _createElementBlock("div", _hoisted_1, "لا توجد فعاليات."))
16111        : _createCommentVNode("", true), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(store.state.events, (e) => {
16112        return (_openBlock(), _createElementBlock("div", {
16113          class: "card eventLite eventLiteExpanded",
16114          key: e.id
16115        }, [
16116          (e.cover_url)
16117            ? (_openBlock(), _createElementBlock("img", {
16118                key: 0,
16119                class: "eventCover",
16120                src: e.cover_url,
16121                loading: "lazy",
16122                alt: ""
16123              }, null, 8, _hoisted_2))
16124            : _createCommentVNode("", true),
16125          _createElementVNode("div", _hoisted_3, [_createElementVNode("h3", null, _toDisplayString(e.title||'فعالية'), 1), _createElementVNode("span", _hoisted_4, _toDisplayString(eventCategoryName(e.category)), 1)]),
16126          _createElementVNode("p", _hoisted_5, _toDisplayString(e.description||'-'), 1),
16127          _createElementVNode("div", _hoisted_6, [_createElementVNode("div", _hoisted_7, [_cache[0] || (_cache[0] = _createElementVNode("b", null, "التاريخ", -1)), _createElementVNode("span", null, _toDisplayString(e.event_date||'-'), 1)]), _createElementVNode("div", _hoisted_8, [_cache[1] || (_cache[1] = _createElementVNode("b", null, "الموقع", -1)), _createElementVNode("span", null, _toDisplayString(e.location||e.address_cn||'-'), 1)])]),
16128          _createElementVNode("div", _hoisted_9, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(e.photo_count||0), 1), _cache[2] || (_cache[2] = _createElementVNode("small", null, "صور", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(e.video_count||0), 1), _cache[3] || (_cache[3] = _createElementVNode("small", null, "فيديو", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(e.media_count||0), 1), _cache[4] || (_cache[4] = _createElementVNode("small", null, "وسائط", -1))])]),
16129          _createElementVNode("button", {
16130            class: "smallbtn secondary",
16131            onClick: $event => ($router.push('/events/'+e.id))
16132          }, "فتح الفعالية والألبوم", 8, _hoisted_10)
16133        ]))
16134      }), 128))]),
16135      _: 1
16136    }))
16137  }
16138}
16139})()
16140  };
16141
16142  const OfficialAnnouncementsPage={
16143    components:{OfficialFrame},
16144    setup(){const store=useGzcStore();const router=useRouter();onMounted(async()=>{if(await store.requireOfficial(router))await store.loadOfficialAnnouncements(router);});function openAttachment(m){if(m&&m.file_url)window.open(m.file_url,'_blank','noopener');}return{store,channelName,shortDate,mediaSrc,isVideo,isPdf,openAttachment,isVerifiedAnnouncement,verificationLabel};},
16145    render:(function(){
16146const _Vue = Vue
16147const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
16148
16149const _hoisted_1 = { class: "card" }
16150const _hoisted_2 = ["onClick"]
16151const _hoisted_3 = {
16152  key: 0,
16153  class: "card emptyCard"
16154}
16155const _hoisted_4 = { class: "officialNoticeHead compact" }
16156const _hoisted_5 = ["src"]
16157const _hoisted_6 = { class: "statusPill" }
16158const _hoisted_7 = {
16159  key: 0,
16160  class: "verifyStamp ok"
16161}
16162const _hoisted_8 = { class: "hint" }
16163const _hoisted_9 = {
16164  key: 1,
16165  class: "announcementMediaGrid"
16166}
16167const _hoisted_10 = ["onClick"]
16168const _hoisted_11 = ["src"]
16169const _hoisted_12 = ["src"]
16170const _hoisted_13 = { class: "notifyMeta" }
16171const _hoisted_14 = { key: 0 }
16172const _hoisted_15 = ["href"]
16173
16174return function render(_ctx, _cache) {
16175  with (_ctx) {
16176    const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, renderList: _renderList, Fragment: _Fragment, toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
16177
16178    const _component_OfficialFrame = _resolveComponent("OfficialFrame")
16179
16180    return (_openBlock(), _createBlock(_component_OfficialFrame, { title: "التعميمات المنشورة" }, {
16181      default: _withCtx(() => [_createElementVNode("div", _hoisted_1, [_createElementVNode("button", {
16182        class: "btn loadMore",
16183        onClick: $event => ($router.push('/official/publish'))
16184      }, "نشر تعميم رسمي جديد", 8, _hoisted_2)]), (!store.state.announcements.length&&!store.state.busy)
16185        ? (_openBlock(), _createElementBlock("div", _hoisted_3, "لا توجد تعميمات."))
16186        : _createCommentVNode("", true), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(store.state.announcements, (a) => {
16187        return (_openBlock(), _createElementBlock("div", {
16188          class: "card announcementCard",
16189          key: a.id
16190        }, [
16191          _createElementVNode("div", _hoisted_4, [(a.source_logo_url)
16192            ? (_openBlock(), _createElementBlock("img", {
16193                key: 0,
16194                src: a.source_logo_url,
16195                alt: ""
16196              }, null, 8, _hoisted_5))
16197            : _createCommentVNode("", true), _createElementVNode("div", null, [_createElementVNode("span", _hoisted_6, _toDisplayString(channelName(a.channel)), 1), _createElementVNode("h3", null, _toDisplayString(a.title), 1)])]),
16198          (isVerifiedAnnouncement(a))
16199            ? (_openBlock(), _createElementBlock("div", _hoisted_7, _toDisplayString(verificationLabel(a)), 1))
16200            : _createCommentVNode("", true),
16201          _createElementVNode("p", _hoisted_8, _toDisplayString(a.body), 1),
16202          (a.media&&a.media.length)
16203            ? (_openBlock(), _createElementBlock("div", _hoisted_9, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(a.media, (m) => {
16204                return (_openBlock(), _createElementBlock("button", {
16205                  key: m.id,
16206                  class: "announcementMediaItem",
16207                  onClick: $event => (openAttachment(m))
16208                }, [(!isVideo(m))
16209                  ? (_openBlock(), _createElementBlock("img", {
16210                      key: 0,
16211                      src: mediaSrc(m),
16212                      loading: "lazy",
16213                      alt: ""
16214                    }, null, 8, _hoisted_11))
16215                  : (_openBlock(), _createElementBlock("video", {
16216                      key: 1,
16217                      src: m.file_url,
16218                      controls: "",
16219                      preload: "metadata"
16220                    }, null, 8, _hoisted_12)), _createElementVNode("span", null, _toDisplayString(isPdf(m)?'PDF':(isVideo(m)?'فيديو':'صورة')), 1)], 8, _hoisted_10))
16221              }), 128))]))
16222            : _createCommentVNode("", true),
16223          _createElementVNode("div", _hoisted_13, [_createElementVNode("span", null, _toDisplayString(a.type||'-'), 1), _createElementVNode("span", null, _toDisplayString(shortDate(a.created_at)), 1), (a.expires_at)
16224            ? (_openBlock(), _createElementBlock("span", _hoisted_14, "ينتهي " + _toDisplayString(String(a.expires_at).slice(0,10)), 1))
16225            : _createCommentVNode("", true)]),
16226          (a.action_url)
16227            ? (_openBlock(), _createElementBlock("a", {
16228                key: 2,
16229                class: "btn secondary",
16230                href: a.action_url,
16231                target: "_blank"
16232              }, "فتح الرابط", 8, _hoisted_15))
16233            : _createCommentVNode("", true)
16234        ]))
16235      }), 128))]),
16236      _: 1
16237    }))
16238  }
16239}
16240})()
16241  };
16242
16243
16244
16245
16246  const AdminFeedbackPage={
16247    components:{AdminFrame},
16248    setup(){
16249      const store=useGzcStore();const router=useRouter();const route=useRoute();const targetFeedback=String((route.query||{}).feedback||'').trim();const status=ref(targetFeedback?'all':'open');const items=ref([]);const open=reactive({});const focusedId=ref('');
16250      function statusLabel(v){return ({new:'جديد',reviewing:'قيد المراجعة',done:'تم التنفيذ',rejected:'مرفوض',archived:'مؤرشف'}[String(v||'')])||String(v||'-');}
16251      function typeLabel(v){return ({suggestion:'اقتراح',note:'ملاحظة',bug:'مشكلة تقنية',correction:'تصحيح معلومة',feature:'طلب إضافة',other:'أخرى'}[String(v||'')])||String(v||'-');}
16252      function toggle(x){open[x.id]=!open[x.id];}
16253      async function focusTarget(){if(!targetFeedback)return;const row=items.value.find(x=>String(x.id)===targetFeedback);if(!row)return;open[row.id]=true;focusedId.value=String(row.id);await nextTick();const el=document.querySelector('[data-task-id="feedback-'+String(row.id).replace(/[^0-9]/g,'')+'"]');if(el)el.scrollIntoView({behavior:'smooth',block:'center'});}
16254      async function load(){if(!(await store.requireAdmin(router)))return;store.state.busy=true;const r=await api('/api/admin/feedback?status='+encodeURIComponent(status.value));store.state.busy=false;if(r.status===401){router.replace('/admin/login');return;}items.value=safeArray(r.feedback);await focusTarget();}
16255      async function update(x,newStatus){store.state.busy=true;const r=await api('/api/admin/feedback/'+encodeURIComponent(x.id),{method:'POST',body:JSON.stringify({status:newStatus,admin_note:x.admin_note||''})});store.state.busy=false;store.state.msg=r.message||r.error||'';await load();}
16256      onMounted(load);watch(status,load);
16257      return{store,status,items,open,focusedId,statusLabel,typeLabel,toggle,load,update,shortDate};
16258    },
16259    render:(function(){
16260const _Vue = Vue
16261const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
16262
16263const _hoisted_1 = { class: "card dashboardHeaderCard" }
16264const _hoisted_2 = ["onClick"]
16265const _hoisted_3 = { class: "segmented" }
16266const _hoisted_4 = ["onClick"]
16267const _hoisted_5 = ["onClick"]
16268const _hoisted_6 = ["onClick"]
16269const _hoisted_7 = {
16270  key: 0,
16271  class: "card emptyCard"
16272}
16273const _hoisted_8 = { class: "feedbackAdminList compactTaskList" }
16274const _hoisted_9 = ["data-task-id"]
16275const _hoisted_10 = ["onClick"]
16276const _hoisted_11 = { class: "statusPill" }
16277const _hoisted_12 = {
16278  key: 0,
16279  class: "compactTaskBody"
16280}
16281const _hoisted_13 = { class: "notifyMeta" }
16282const _hoisted_14 = { dir: "ltr" }
16283const _hoisted_15 = { class: "opsDesc" }
16284const _hoisted_16 = ["onUpdate:modelValue"]
16285const _hoisted_17 = { class: "row" }
16286const _hoisted_18 = ["onClick"]
16287const _hoisted_19 = ["onClick"]
16288const _hoisted_20 = ["onClick"]
16289const _hoisted_21 = ["onClick"]
16290
16291return function render(_ctx, _cache) {
16292  with (_ctx) {
16293    const { createElementVNode: _createElementVNode, normalizeClass: _normalizeClass, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, renderList: _renderList, Fragment: _Fragment, toDisplayString: _toDisplayString, vModelText: _vModelText, withDirectives: _withDirectives, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
16294
16295    const _component_AdminFrame = _resolveComponent("AdminFrame")
16296
16297    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "ملاحظات الأعضاء" }, {
16298      default: _withCtx(() => [
16299        _createElementVNode("section", _hoisted_1, [_cache[0] || (_cache[0] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "إدارة المنصة"), _createElementVNode("h3", null, "مركز الملاحظات والاقتراحات"), _createElementVNode("p", { class: "hint" }, "افتح الملاحظة المطلوبة فقط؛ تنتهي مهمتها تلقائياً عند التنفيذ أو الرفض.")], -1)), _createElementVNode("button", {
16300          class: "smallbtn",
16301          onClick: load
16302        }, "تحديث", 8, _hoisted_2)]),
16303        _createElementVNode("div", _hoisted_3, [_createElementVNode("button", {
16304          class: _normalizeClass({active:status==='open'}),
16305          onClick: $event => (status='open')
16306        }, "المفتوحة", 10, _hoisted_4), _createElementVNode("button", {
16307          class: _normalizeClass({active:status==='all'}),
16308          onClick: $event => (status='all')
16309        }, "الكل", 10, _hoisted_5), _createElementVNode("button", {
16310          class: _normalizeClass({active:status==='archived'}),
16311          onClick: $event => (status='archived')
16312        }, "المؤرشفة", 10, _hoisted_6)]),
16313        (!items.length&&!store.state.busy)
16314          ? (_openBlock(), _createElementBlock("section", _hoisted_7, "لا توجد ملاحظات حالياً."))
16315          : _createCommentVNode("", true),
16316        _createElementVNode("section", _hoisted_8, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (x) => {
16317          return (_openBlock(), _createElementBlock("article", {
16318            key: x.id,
16319            class: _normalizeClass(["card feedbackAdminCard compactTaskCard", {taskTarget:focusedId===String(x.id),open:open[x.id]}]),
16320            "data-task-id": 'feedback-'+x.id
16321          }, [_createElementVNode("button", {
16322            class: "compactTaskHead",
16323            onClick: $event => (toggle(x))
16324          }, [_createElementVNode("div", null, [_createElementVNode("h3", null, _toDisplayString(x.title || typeLabel(x.feedback_type)), 1
16324), _createElementVNode("p", null, _toDisplayString(x.message), 1), _createElementVNode("small", null, _toDisplayString(x.full_name || '-') + " · " + _toDisplayString(shortDate(x.created_at)), 1)]), _createElementVNode("span", _hoisted_11, _toDisplayString(statusLabel(x.status)), 1), _createElementVNode("b", null, _toDisplayString(open[x.id]?'−':'+'), 1)], 8, _hoisted_10), (open[x.id])
16325            ? (_openBlock(), _createElementBlock("div", _hoisted_12, [
16326                _createElementVNode("div", _hoisted_13, [_createElementVNode("span", null, _toDisplayString(typeLabel(x.feedback_type)), 1), _createElementVNode("span", _hoisted_14, _toDisplayString(x.whatsapp || '-'), 1), _createElementVNode("span", null, _toDisplayString($cityLabel(x.china_city) || '-'), 1)]),
16327                _createElementVNode("p", _hoisted_15, _toDisplayString(x.message), 1),
16328                _withDirectives(_createElementVNode("textarea", {
16329                  "onUpdate:modelValue": $event => ((x.admin_note) = $event),
16330                  placeholder: "ملاحظة الإدارة / الرد الداخلي"
16331                }, null, 8, _hoisted_16), [[_vModelText, x.admin_note]]),
16332                _createElementVNode("div", _hoisted_17, [
16333                  _createElementVNode("button", {
16334                    class: "smallbtn",
16335                    onClick: $event => (update(x,'reviewing'))
16336                  }, "قيد المراجعة", 8, _hoisted_18),
16337                  _createElementVNode("button", {
16338                    class: "smallbtn secondary",
16339                    onClick: $event => (update(x,'done'))
16340                  }, "تم التنفيذ", 8, _hoisted_19),
16341                  _createElementVNode("button", {
16342                    class: "smallbtn danger",
16343                    onClick: $event => (update(x,'rejected'))
16344                  }, "رفض", 8, _hoisted_20),
16345                  _createElementVNode("button", {
16346                    class: "smallbtn danger",
16347                    onClick: $event => (update(x,'archived'))
16348                  }, "أرشفة", 8, _hoisted_21)
16349                ])
16350              ]))
16351            : _createCommentVNode("", true)], 10, _hoisted_9))
16352        }), 128))])
16353      ]),
16354      _: 1
16355    }))
16356  }
16357}
16358})()
16359  };
16360
16361  const AiAdminCenterNav={
16362    setup(){
16363      const route=useRoute();
16364      const hub=computed(()=>String((route.query||{}).hub||'china_guide'));
16365      const opsWorkspace=computed(()=>String((route.query||{}).workspace||'jobs'));
16366      function active(path,workspace){
16367        if(route.path!==path)return false;
16368        if(path!=='/admin/ai-operations'||!workspace)return true;
16369        return opsWorkspace.value===workspace;
16370      }
16371      return{route,hub,active};
16372    },
16373    render:(function(){
16374const _Vue = Vue
16375const { createVNode: _createVNode, createElementVNode: _createElementVNode } = _Vue
16376
16377const _hoisted_1 = {
16378  class: "card aiAdminCenterNav",
16379  "aria-label": "مركز الذكاء الاصطناعي"
16380}
16381
16382return function render(_ctx, _cache) {
16383  with (_ctx) {
16384    const { createElementVNode: _createElementVNode, resolveComponent: _resolveComponent, normalizeClass: _normalizeClass, withCtx: _withCtx, createVNode: _createVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
16385
16386    const _component_router_link = _resolveComponent("router-link")
16387
16388    return (_openBlock(), _createElementBlock("nav", _hoisted_1, [
16389      _createVNode(_component_router_link, {
16390        class: _normalizeClass({active:active('/admin/ai-research')}),
16391        to: {path:'/admin/ai-research',query:{hub:hub,workspace:'review'}}
16392      }, {
16393        default: _withCtx(() => _cache[0] || (_cache[0] = [_createElementVNode("b", null, "المراجعة", -1), _createElementVNode("small", null, "قرار بشري", -1)])),
16394        _: 1,
16395        __: [0]
16396      }, 8, ["class", "to"]),
16397      _createVNode(_component_router_link, {
16398        class: _normalizeClass({active:active('/admin/ai-operations','jobs')}),
16399        to: {path:'/admin/ai-operations',query:{hub:hub,workspace:'jobs'}}
16400      }, {
16401        default: _withCtx(() => _cache[1] || (_cache[1] = [_createElementVNode("b", null, "تشغيل البحث", -1), _createElementVNode("small", null, "المهام والحالة", -1)])),
16402        _: 1,
16403        __: [1]
16404      }, 8, ["class", "to"]),
16405      _createVNode(_component_router_link, {
16406        class: _normalizeClass({active:active('/admin/ai-efficiency')}),
16407        to: {path:'/admin/ai-efficiency',query:{hub:hub}}
16408      }, {
16409        default: _withCtx(() => _cache[2] || (_cache[2] = [_createElementVNode("b", null, "الكفاءة", -1), _createElementVNode("small", null, "المردود والاستهلاك", -1)])),
16410        _: 1,
16411        __: [2]
16412      }, 8, ["class", "to"]),
16413      _createVNode(_component_router_link, {
16414        class: _normalizeClass({active:active('/admin/ai-operations','settings')}),
16415        to: {path:'/admin/ai-operations',query:{hub:hub,workspace:'settings'}}
16416      }, {
16417        default: _withCtx(() => _cache[3] || (_cache[3] = [_createElementVNode("b", null, "الإعدادات", -1), _createElementVNode("small", null, "المزود والسياسات", -1)])),
16418        _: 1,
16419        __: [3]
16420      }, 8, ["class", "to"]),
16421      _createVNode(_component_router_link, {
16422        class: _normalizeClass({active:active('/admin/engineering-advisor')}),
16423        to: "/admin/engineering-advisor"
16424      }, {
16425        default: _withCtx(() => _cache[4] || (_cache[4] = [_createElementVNode("b", null, "المستشار", -1), _createElementVNode("small", null, "هندسي · قراءة فقط", -1)])),
16426        _: 1,
16427        __: [4]
16428      }, 8, ["class"])
16429    ]))
16430  }
16431}
16432})()
16433  };
16434
16435  const AdminEngineeringAdvisorPage={
16436    components:{AdminFrame,AiAdminCenterNav},
16437    setup(){
16438      const store=useGzcStore(),router=useRouter();const data=ref({runs:[],findings:[],release_links:[],learning:{}});const snapshot=ref(null);const loading=ref(false);const running=ref(false);
16439      const canOperate=computed(()=>adminIsSenior(store.state.me&&store.state.me.admin));
16440      const outcomeOptions=[['improved','تحسّن'],['neutral','محايد'],['regressed','تراجع'],['insufficient_evidence','أدلة غير كافية']];
16441      function severityLabel(v){return ({info:'معلومة',low:'منخفض',medium:'متوسط',high:'مرتفع',critical:'حرج'}[String(v||'')])||String(v||'-');}
16442      function domainLabel(v){return ({performance:'الأداء',reliability:'الاعتمادية',security:'الأمان',database:'قاعدة البيانات',workflow:'مسار العمل',frontend:'الواجهة',operations:'التشغيل',release:'الإصدارات'}[String(v||'')])||String(v||'-');}
16443      function findingStatusLabel(v){return ({new:'جديد',reviewed:'تمت المراجعة',deferred:'مؤجل',rejected:'مرفوض',approved_for_development:'موافق للتطوير'}[String(v||'')])||String(v||'-');}
16444      function outcomeLabel(v){return ({improved:'تحسّن',neutral:'محايد',regressed:'تراجع',insufficient_evidence:'أدلة غير كافية'}[String(v||'')])||String(v||'-');}
16445      function releaseLinkFor(f){return (data.value.release_links||[]).find(x=>Number(x.finding_id)===Number(f.id))||null;}
16446      function releaseTuple(v){const m=String(v||'').match(/^(?:v)?(\d+)\.(\d+)\.(\d+)$/);return m?[+m[1],+m[2],+m[3]]:null;}
16447      function canEvaluateRelease(l){const a=releaseTuple(data.value.current_release),b=releaseTuple(l&&l.release_version);if(!a||!b)return false;for(let i=0;i<3;i++){if(a[i]!==b[i])return a[i]>b[i]}return true;}
16448      async function load(){if(!(await store.requireAdmin(router)))return;loading.value=true;const r=await api('/api/admin/engineering-advisor?limit=20&ts='+Date.now(),{cache:'no-store'});loading.value=false;if(r.status===401){router.replace('/admin/login');return;}if(!r.ok){store.state.msg=r.message||r.error||'تعذر تحميل المستشار الهندسي';return;}data.value=r;}
16449      async function loadSnapshot(){const r=await api('/api/admin/engineering-advisor/snapshot?ts='+Date.now(),{cache:'no-store'});if(r.ok)snapshot.value=r.snapshot;else store.state.msg=r.message||r.error||'';}
16450      async function run(){if(!canOperate.value||running.value)return;if(!confirm('تشغيل تحليل هندسي Read-only الآن؟ لن ينفذ AI أي تغيير على Production.'))return;running.value=true;const r=await api('/api/admin/engineering-advisor/run',{method:'POST',body:'{}'});running.value=false;store.state.msg=r.message||r.error||'';await load();await loadSnapshot();}
16451      async function review(f,action){if(!canOperate.value)return;const note=String(f._review_note||'').trim();if(action==='approve_for_development'&&!confirm('هذه موافقة للتطوير فقط ولا تنفذ التوصية تلقائياً. متابعة؟'))return;const r=await api('/api/admin/engineering-advisor/findings/'+encodeURIComponent(f.id)+'/review',{method:'POST',body:JSON.stringify({action,note})});store.state.msg=r.message||r.error||'';if(r.ok)await load();}
16452      async function linkRelease(f){if(!canOperate.value)return;const release_version=String(f._release_version||f.suggested_release||'').trim();if(!release_version){store.state.msg='اكتب رقم الإصدار المستهدف';return;}if(!confirm('سيتم حفظ Baseline الحالي وربط التوصية بالإصدار '+release_version+'. متابعة؟'))return;const r=await api('/api/admin/engineering-advisor/findings/'+encodeURIComponent(f.id)+'/link-release',{method:'POST',body:JSON.stringify({release_version})});store.state.msg=r.message||r.error||'';if(r.ok)await load();}
16453      async function recordOutcome(l){if(!canOperate.value||!l)return;const outcome=String(l._outcome||'').trim(),note=String(l._outcome_note||'').trim(),evidence=String(l._outcome_evidence||'').split('\n').map(x=>x.trim()).filter(Boolean);if(!outcome){store.state.msg='اختر نتيجة التقييم';return;}if(!note){store.state.msg='اكتب سبب التقييم';return;}if(!confirm('تسجيل نتيجة '+outcomeLabel(outcome)+' كدليل تاريخي للتوصيات المستقبلية؟'))return;const r=await api('/api/admin/engineering-advisor/release-links/'+encodeURIComponent(l.release_link_id)+'/outcome',{method:'POST',body:JSON.stringify({outcome,note,evidence})});store.state.msg=r.message||r.error||'';if(r.ok&&r.read_back_verified){if(r.learning)data.value.learning=r.learning;store.state.msg=(r.message||'تم تسجيل النتيجة')+' — تم التحقق من الذاكرة';await load();await loadSnapshot();}}
16454      onMounted(async()=>{await load();await loadSnapshot();});
16455      return{store,data,snapshot,loading,running,canOperate,outcomeOptions,severityLabel,domainLabel,findingStatusLabel,outcomeLabel,releaseLinkFor,canEvaluateRelease,load,loadSnapshot,run,review,linkRelease,recordOutcome,shortDate};
16456    },
16457    render:(function(){
16458const _Vue = Vue
16459const { createVNode: _createVNode, createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
16460
16461const _hoisted_1 = { class: "card noticeCard compactNotice aiAdvisorHero" }
16462const _hoisted_2 = { class: "row" }
16463const _hoisted_3 = ["disabled", "onClick"]
16464const _hoisted_4 = ["onClick"]
16465const _hoisted_5 = ["onClick"]
16466const _hoisted_6 = {
16467  key: 0,
16468  class: "card"
16469}
16470const _hoisted_7 = { class: "memberCardTop" }
16471const _hoisted_8 = { class: "statusPill" }
16472const _hoisted_9 = { class: "miniStats" }
16473const _hoisted_10 = {
16474  key: 0,
16475  class: "miniStats"
16476}
16477const _hoisted_11 = {
16478  key: 1,
16479  class: "hint"
16480}
16481const _hoisted_12 = { class: "card" }
16482const _hoisted_13 = { class: "memberCardTop" }
16483const _hoisted_14 = { class: "statusPill" }
16484const _hoisted_15 = { class: "miniStats" }
16485const _hoisted_16 = {
16486  key: 0,
16487  class: "hint"
16488}
16489const _hoisted_17 = {
16490  key: 1,
16491  class: "card aiAdminDisclosure"
16492}
16493const _hoisted_18 = { class: "opsList aiDisclosureBody" }
16494const _hoisted_19 = { class: "memberCardTop" }
16495const _hoisted_20 = { class: "statusPill" }
16496const _hoisted_21 = { key: 0 }
16497const _hoisted_22 = {
16498  key: 1,
16499  class: "hint"
16500}
16501const _hoisted_23 = { class: "notifyMeta" }
16502const _hoisted_24 = {
16503  key: 2,
16504  class: "card emptyCard"
16505}
16506const _hoisted_25 = {
16507  key: 3,
16508  class: "opsList"
16509}
16510const _hoisted_26 = { class: "memberCardTop" }
16511const _hoisted_27 = { class: "vueBadge" }
16512const _hoisted_28 = { class: "statusPill" }
16513const _hoisted_29 = {
16514  key: 0,
16515  class: "cardInset"
16516}
16517const _hoisted_30 = { class: "hint" }
16518const _hoisted_31 = { class: "notifyMeta" }
16519const _hoisted_32 = ["onUpdate:modelValue"]
16520const _hoisted_33 = { class: "row" }
16521const _hoisted_34 = ["onClick"]
16522const _hoisted_35 = ["onClick"]
16523const _hoisted_36 = ["onClick"]
16524const _hoisted_37 = ["onClick"]
16525const _hoisted_38 = {
16526  key: 0,
16527  class: "cardInset"
16528}
16529const _hoisted_39 = { class: "row" }
16530const _hoisted_40 = ["onUpdate:modelValue", "placeholder"]
16531const _hoisted_41 = ["onClick"]
16532const _hoisted_42 = {
16533  key: 1,
16534  class: "cardInset"
16535}
16536const _hoisted_43 = { class: "memberCardTop" }
16537const _hoisted_44 = { class: "statusPill" }
16538const _hoisted_45 = { class: "hint" }
16539const _hoisted_46 = ["onUpdate:modelValue"]
16540const _hoisted_47 = ["value"]
16541const _hoisted_48 = ["onUpdate:modelValue"]
16542const _hoisted_49 = ["onUpdate:modelValue"]
16543const _hoisted_50 = ["disabled", "onClick"]
16544const _hoisted_51 = {
16545  key: 1,
16546  class: "hint"
16547}
16548const _hoisted_52 = {
16549  key: 2,
16550  class: "hint"
16551}
16552
16553return function render(_ctx, _cache) {
16554  with (_ctx) {
16555    const { resolveComponent: _resolveComponent, createVNode: _createVNode, createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, renderList: _renderList, Fragment: _Fragment, createTextVNode: _createTextVNode, vModelText: _vModelText, withDirectives: _withDirectives, vModelSelect: _vModelSelect, withCtx: _withCtx, createBlock: _createBlock } = _Vue
16556
16557    const _component_AiAdminCenterNav = _resolveComponent("AiAdminCenterNav")
16558    const _component_AdminFrame = _resolveComponent("AdminFrame")
16559
16560    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "مركز AI — المستشار الهندسي" }, {
16561      default: _withCtx(() => [
16562        _createVNode(_component_AiAdminCenterNav),
16563        _createElementVNode("section", _hoisted_1, [
16564          _cache[0] || (_cache[0] = _createElementVNode("span", { class: "vueBadge" }, "Read-only Engineering Intelligence · قراءة وتحليل فقط", -1)),
16565          _cache[1] || (_cache[1] = _createElementVNode("h3", null, "المستشار الهندسي AI", -1)),
16566          _cache[2] || (_cache[2] = _createElementVNode("p", null, "يحلل مؤشرات المنصة ويقدم توصيات هندسية مدعومة بالأدلة. لا يملك صلاحية تعديل Production أو قاعدة البيانات أو تنفيذ أوامر أو Deployment. القرار والتنفيذ يظلان بشريين.", -1)),
16567          _createElementVNode("div", _hoisted_2, [_createElementVNode("button", {
16568            class: "btn",
16569            disabled: running||!canOperate,
16570            onClick: run
16571          }, _toDisplayString(running?'جاري التحليل...':'تشغيل تحليل هندسي'), 9, _hoisted_3), _createElementVNode("button", {
16572            class: "smallbtn secondary",
16573            onClick: load
16574          }, "تحديث", 8, _hoisted_4), _createElementVNode("button", {
16575            class: "smallbtn secondary",
16576            onClick: loadSnapshot
16577          }, "تحديث المؤشرات", 8, _hoisted_5)])
16578        ]),
16579        snapshot
16580          ? (_openBlock(), _createElementBlock("section", _hoisted_6, [
16581              _createElementVNode("div", _hoisted_7, [_cache[3] || (_cache[3] = _createElementVNode("h3", null, "لقطة المؤشرات الحالية", -1)), _createElementVNode("span", _hoisted_8, "v" + _toDisplayString(snapshot.platform&&snapshot.platform.version), 1)]),
16582              _createElementVNode("div", _hoisted_9, [
16583                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(snapshot.database&&snapshot.database.size_mb||0), 1), _cache[4] || (_cache[4] = _createElementVNode("small", null, "MB قاعدة البيانات", -1))]),
16584                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(snapshot.database&&snapshot.database.active_connections||0), 1), _cache[5] || (_cache[5] = _createElementVNode("small", null, "اتصالات DB", -1))]),
16585                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(snapshot.platform&&snapshot.platform.rss_mb||0), 1), _cache[6] || (_cache[6] = _createElementVNode("small", null, "MB Runtime", -1))]),
16586                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(snapshot.audit&&snapshot.audit.events_24h||0), 1), _cache[7] || (_cache[7] = _createElementVNode("small", null, "Audit / 24h", -1))])
16587              ]),
16588              (snapshot.performance)
16589                ? (_openBlock(), _createElementBlock("div", _hoisted_10, [
16590                    _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(snapshot.performance.api&&snapshot.performance.api.samples||0), 1), _cache[8] || (_cache[8] = _createElementVNode("small", null, "API samples", -1))]),
16591                    _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(snapshot.performance.api&&snapshot.performance.api.p95_ms!=null?snapshot.performance.api.p95_ms:'-'), 1), _cache[9] || (_cache[9] = _createElementVNode("small", null, "API p95 ms", -1))]),
16592                    _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(snapshot.performance.api&&snapshot.performance.api.error_5xx_rate_percent||0) + "%", 1), _cache[10] || (_cache[10] = _createElementVNode("small", null, "5xx rate", -1))]),
16593                    _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(snapshot.performance.api&&snapshot.performance.api.unexpected_4xx_rate_percent||0) + "%", 1), _cache[11] || (_cache[11] = _createElementVNode("small", null, "Unexpected 4xx", -1))]),
16594                    _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(snapshot.performance.api&&snapshot.performance.api.synthetic_samples||0), 1), _cache[12] || (_cache[12] = _createElementVNode("small", null, "QA/UAT excluded", -1))]),
16595                    _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(snapshot.performance.frontend&&snapshot.performance.frontend.samples||0), 1), _cache[13] || (_cache[13] = _createElementVNode("small", null, "Mobile/Web samples", -1))])
16596                  ]))
16597                : _createCommentVNode("", true),
16598              _cache[14] || (_cache[14] = _createElementVNode("p", { class: "hint" }, "هذه البيانات مجمعة ولا ترسل أسماء الأعضاء أو أرقامهم أو محتوى خاصاً إلى المستشار. Performance telemetry مجمعة حسب المسار والإصدار ولا تحفظ member ID أو session ID أو IP داخل بيانات القياس. QA/UAT synthetic traffic مستبعد من مؤشرات Production، و401/403 المتوقعة لغير المسجلين منفصلة عن unexpected 4xx.", -1)),
16599              (snapshot.release_evidence&&snapshot.release_evidence.latest)
16600                ? (_openBlock(), _createElementBlock("p", _hoisted_11, "آخر Evidence إصدار: " + _toDisplayString(snapshot.release_evidence.latest.release_version) + " · QA/UAT/Backup/Restore/Production Stability محفوظة كدليل إصدار.", 1))
16601                : _createCommentVNode("", true)
16602            ]))
16603          : _createCommentVNode("", true),
16604        _createElementVNode("section", _hoisted_12, [
16605          _createElementVNode("div", _hoisted_13, [_cache[15] || (_cache[15] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "Evidence-governed learning"), _createElementVNode("h3", null, "حلقة نتائج الإصدارات")], -1)), _createElementVNode("span", _hoisted_14, _toDisplayString(data.learning&&data.learning.evaluated_total||0) + " تقييم", 1)]),
16606          _cache[19] || (_cache[19] = _createElementVNode("p", { class: "hint" }, "Baseline قبل التنفيذ → إصدار معتمد → مؤشرات بعد الإصدار → تقييم بشري للنتيجة → يستخدم التاريخ كدليل في التوصيات اللاحقة. لا يوجد Auto-apply.", -1)),
16607          _createElementVNode("div", _hoisted_15, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(data.learning&&data.learning.evaluated_total||0), 1), _cache[16] || (_cache[16] = _createElementVNode("small", null, "نتائج موثقة", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(data.learning&&data.learning.pending_release_links||0), 1), _cache[17] || (_cache[17] = _createElementVNode("small", null, "بانتظار التقييم", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(data.learning&&data.learning.integrity&&data.learning.integrity.status==='healthy'?'سليم':(data.learning&&data.learning.integrity&&data.learning.integrity.status||'-')), 1), _cache[18] || (_cache[18] = _createElementVNode("small", null, "سلامة ذاكرة النتائج", -1))])]),
16608          (data.learning&&data.learning.integrity&&data.learning.integrity.status==='healthy')
16609            ? (_openBlock(), _createElementBlock("p", _hoisted_16, "عدد Outcome rows يطابق طبقة القراءة المستخدمة في المستشار."))
16610            : _createCommentVNode("", true)
16611        ]),
16612        (data.runs&&data.runs.length)
16613          ? (_openBlock(), _createElementBlock("details", _hoisted_17, [_createElementVNode("summary", null, [_cache[20] || (_cache[20] = _createElementVNode("b", null, "سجل التحليلات السابقة", -1)), _createElementVNode("span", null, _toDisplayString(data.runs.length) + " تحليل", 1)]), _createElementVNode("div", _hoisted_18, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(data.runs, (r) => {
16614              return (_openBlock(), _createElementBlock("article", {
16615                class: "opsCard",
16616                key: r.id
16617              }, [
16618                _createElementVNode("div", _hoisted_19, [_createElementVNode("b", null, _toDisplayString(r.run_code), 1), _createElementVNode("span", _hoisted_20, _toDisplayString(r.status), 1)]),
16619                (r.summary)
16620                  ? (_openBlock(), _createElementBlock("p", _hoisted_21, _toDisplayString(r.summary), 1))
16621                  : _createCommentVNode("", true),
16622                (r.failure_text)
16623                  ? (_openBlock(), _createElementBlock("p", _hoisted_22, _toDisplayString(r.failure_text), 1))
16624                  : _createCommentVNode("", true),
16625                _createElementVNode("div", _hoisted_23, [
16626                  _createElementVNode("span", null, _toDisplayString(r.model||'-'), 1),
16627                  _createElementVNode("span", null, _toDisplayString(r.duration_ms||0) + " ms", 1),
16628                  _createElementVNode("span", null, _toDisplayString(shortDate(r.created_at)), 1),
16629                  _cache[21] || (_cache[21] = _createElementVNode("span", null, "Read-only", -1))
16630                ])
16631              ]))
16632            }), 128))])]))
16633          : _createCommentVNode("", true),
16634        (!loading&&(!data.findings||!data.findings.length))
16635          ? (_openBlock(), _createElementBlock("section", _hoisted_24, "لا توجد توصيات هندسية بعد. شغّل التحليل عند الحاجة."))
16636          : _createCommentVNode("", true),
16637        (data.findings&&data.findings.length)
16638          ? (_openBlock(), _createElementBlock("section", _hoisted_25, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(data.findings, (f) => {
16639              return (_openBlock(), _createElementBlock("article", {
16640                class: "card opsCard",
16641                key: f.id
16642              }, [
16643                _createElementVNode("div", _hoisted_26, [_createElementVNode("div", null, [_createElementVNode("span", _hoisted_27, _toDisplayString(domainLabel(f.domain)), 1), _createElementVNode("h3", null, _toDisplayString(f.title), 1)]), _createElementVNode("span", _hoisted_28, _toDisplayString(severityLabel(f.severity)
16643), 1)]),
16644                _createElementVNode("p", null, [_cache[22] || (_cache[22] = _createElementVNode("b", null, "الملاحظة:", -1)), _createTextVNode(" " + _toDisplayString(f.observation), 1)]),
16645                (f.evidence&&f.evidence.length)
16646                  ? (_openBlock(), _createElementBlock("div", _hoisted_29, [_cache[23] || (_cache[23] = _createElementVNode("b", null, "Evidence", -1)), _createElementVNode("ul", null, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(f.evidence, (e, i) => {
16647                      return (_openBlock(), _createElementBlock("li", { key: i }, _toDisplayString(e), 1))
16648                    }), 128))])]))
16649                  : _createCommentVNode("", true),
16650                _createElementVNode("p", null, [_cache[24] || (_cache[24] = _createElementVNode("b", null, "التوصية:", -1)), _createTextVNode(" " + _toDisplayString(f.recommendation), 1)]),
16651                _createElementVNode("p", _hoisted_30, [
16652                  _cache[25] || (_cache[25] = _createElementVNode("b", null, "الأثر المتوقع:", -1)),
16653                  _createTextVNode(" " + _toDisplayString(f.expected_impact||'-') + " · ", 1),
16654                  _cache[26] || (_cache[26] = _createElementVNode("b", null, "النطاق:", -1)),
16655                  _createTextVNode(" " + _toDisplayString(f.implementation_scope||'-') + " · ", 1),
16656                  _cache[27] || (_cache[27] = _createElementVNode("b", null, "المخاطر:", -1)),
16657                  _createTextVNode(" " + _toDisplayString(f.risk_level) + " · ", 1),
16658                  _cache[28] || (_cache[28] = _createElementVNode("b", null, "إصدار مقترح:", -1)),
16659                  _createTextVNode(" " + _toDisplayString(f.suggested_release||'يحدد بعد المراجعة'), 1)
16660                ]),
16661                _createElementVNode("div", _hoisted_31, [_createElementVNode("span", null, _toDisplayString(findingStatusLabel(f.status)), 1), _createElementVNode("span", null, "ثقة " + _toDisplayString(Math.round(Number(f.confidence||0)*100)) + "%", 1), _createElementVNode("span", null, _toDisplayString(shortDate(f.created_at)), 1)]),
16662                canOperate
16663                  ? (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [
16664                      _withDirectives(_createElementVNode("textarea", {
16665                        "onUpdate:modelValue": $event => ((f._review_note) = $event),
16666                        placeholder: "ملاحظة الإدارة (اختياري)"
16667                      }, null, 8, _hoisted_32), [[_vModelText, f._review_note]]),
16668                      _createElementVNode("div", _hoisted_33, [
16669                        _createElementVNode("button", {
16670                          class: "smallbtn",
16671                          onClick: $event => (review(f,'review'))
16672                        }, "تمت المراجعة", 8, _hoisted_34),
16673                        _createElementVNode("button", {
16674                          class: "smallbtn secondary",
16675                          onClick: $event => (review(f,'defer'))
16676                        }, "تأجيل", 8, _hoisted_35),
16677                        _createElementVNode("button", {
16678                          class: "smallbtn danger",
16679                          onClick: $event => (review(f,'reject'))
16680                        }, "رفض", 8, _hoisted_36),
16681                        _createElementVNode("button", {
16682                          class: "smallbtn",
16683                          onClick: $event => (review(f,'approve_for_development'))
16684                        }, "موافقة للتطوير", 8, _hoisted_37)
16685                      ]),
16686                      _cache[34] || (_cache[34] = _createElementVNode("p", { class: "hint" }, "موافقة للتطوير لا تشغل كوداً ولا تغير Production؛ تصبح التوصية Input لإصدار لاحق فقط.", -1)),
16687                      (f.status==='approved_for_development'&&!releaseLinkFor(f))
16688                        ? (_openBlock(), _createElementBlock("div", _hoisted_38, [_cache[29] || (_cache[29] = _createElementVNode("b", null, "ربط التوصية بإصدار", -1)), _cache[30] || (_cache[30] = _createElementVNode("p", { class: "hint" }, "يتم التقاط Baseline الآن قبل بدء التنفيذ الفعلي.", -1)), _createElementVNode("div", _hoisted_39, [_withDirectives(_createElementVNode("input", {
16689                            "onUpdate:modelValue": $event => ((f._release_version) = $event),
16690                            placeholder: f.suggested_release||'v3.8.30',
16691                            dir: "ltr"
16692                          }, null, 8, _hoisted_40), [[_vModelText, f._release_version]]), _createElementVNode("button", {
16693                            class: "smallbtn",
16694                            onClick: $event => (linkRelease(f))
16695                          }, "ربط وحفظ Baseline", 8, _hoisted_41)])]))
16696                        : _createCommentVNode("", true),
16697                      (releaseLinkFor(f))
16698                        ? (_openBlock(), _createElementBlock("div", _hoisted_42, [
16699                            _createElementVNode("div", _hoisted_43, [_createElementVNode("b", null, "Evidence / " + _toDisplayString(releaseLinkFor(f).release_version), 1), _createElementVNode("span", _hoisted_44, _toDisplayString(releaseLinkFor(f).outcome?outcomeLabel(releaseLinkFor(f).outcome):'بانتظار النتيجة'), 1)]),
16700                            _createElementVNode("p", _hoisted_45, [_createTextVNode("Baseline: " + _toDisplayString(shortDate(releaseLinkFor(f).linked_at)), 1), (releaseLinkFor(f).evaluated_at)
16701                              ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createTextVNode(" · آخر تقييم: " + _toDisplayString(shortDate(releaseLinkFor(f).evaluated_at)), 1)], 64))
16702                              : _createCommentVNode("", true)]),
16703                            (canEvaluateRelease(releaseLinkFor(f))&&!releaseLinkFor(f).outcome)
16704                              ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [
16705                                  _cache[32] || (_cache[32] = _createElementVNode("p", { class: "hint" }, [_createElementVNode("b", null, "لم تُسجل نتيجة بعد."), _createTextVNode(" اختيار Improved/Neutral وحده لا يحفظ شيئاً؛ يجب الضغط على «تسجيل تقييم ما بعد الإصدار» ليظهر في ذاكرة المستشار.")], -1)),
16706                                  _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((releaseLinkFor(f)._outcome) = $event) }, [_cache[31] || (_cache[31] = _createElementVNode("option", { value: "" }, "اختر النتيجة", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(outcomeOptions, (o) => {
16707                                    return (_openBlock(), _createElementBlock("option", {
16708                                      key: o[0],
16709                                      value: o[0]
16710                                    }, _toDisplayString(o[1]), 9, _hoisted_47))
16711                                  }), 128))], 8, _hoisted_46), [[_vModelSelect, releaseLinkFor(f)._outcome]]),
16712                                  _withDirectives(_createElementVNode("textarea", {
16713                                    "onUpdate:modelValue": $event => ((releaseLinkFor(f)._outcome_note) = $event),
16714                                    placeholder: "لماذا هذه النتيجة؟"
16715                                  }, null, 8, _hoisted_48), [[_vModelText, releaseLinkFor(f)._outcome_note]]),
16716                                  _withDirectives(_createElementVNode("textarea", {
16717                                    "onUpdate:modelValue": $event =>
16717 ((releaseLinkFor(f)._outcome_evidence) = $event),
16718                                    placeholder: "أدلة إضافية — سطر لكل دليل (QA / Performance / Error rate...)"
16719                                  }, null, 8, _hoisted_49), [[_vModelText, releaseLinkFor(f)._outcome_evidence]]),
16720                                  _createElementVNode("button", {
16721                                    class: "smallbtn",
16722                                    disabled: !releaseLinkFor(f)._outcome||!String(releaseLinkFor(f)._outcome_note||'').trim(),
16723                                    onClick: $event => (recordOutcome(releaseLinkFor(f)))
16724                                  }, "تسجيل تقييم ما بعد الإصدار", 8, _hoisted_50)
16725                                ], 64))
16726                              : _createCommentVNode("", true),
16727                            (releaseLinkFor(f).outcome)
16728                              ? (_openBlock(), _createElementBlock("p", _hoisted_51, [_cache[33] || (_cache[33] = _createElementVNode("b", null, "Outcome محفوظ ومتحقق:", -1)), _createTextVNode(" " + _toDisplayString(outcomeLabel(releaseLinkFor(f).outcome)) + ". هذا السجل دخل فعلياً في ذاكرة المستشار.", 1)]))
16729                              : (_openBlock(), _createElementBlock("p", _hoisted_52, "التقييم يفتح بعد تثبيت الإصدار المرتبط أو إصدار أحدث."))
16730                          ]))
16731                        : _createCommentVNode("", true)
16732                    ], 64))
16733                  : _createCommentVNode("", true)
16734              ]))
16735            }), 128))]))
16736          : _createCommentVNode("", true)
16737      ]),
16738      _: 1
16739    }))
16740  }
16741}
16742})()
16743  };
16744
16745  const AI_RESEARCH_HUB_OPTIONS=[
16746    {key:'china_guide',label:'دليلك في الصين',short:'دليل الصين',icon:'🧭',adminPath:'/admin/china-guide',publicPath:'/china-guide'},
16747    {key:'trade_shipping',label:'التجارة والشحن',short:'التجارة والشحن',icon:'🚢',adminPath:'/admin/trade-shipping',publicPath:'/trade-shipping'}
16748  ];
16749  const AI_RESEARCH_SERVICE_OPTIONS={
16750    china_guide:[['general','عام'],['health','صحة'],['transport','مواصلات'],['housing','سكن'],['finance','مالي'],['markets','أسواق وتجارة'],['exhibitions','المعارض والمؤتمرات'],['restaurants','مطاعم'],['hotels','فنادق وإقامة'],['services','خدمات'],['education','تعليم'],['emergency','طوارئ'],['tips','نصائح'],['official_links','روابط مهمة']],
16751    trade_shipping:[['general','عام'],['documents','مستندات'],['customs','جمارك'],['shipping','شحن بحري'],['clearance','تخليص'],['ports','موانئ'],['export','تصدير'],['import','استيراد'],['warnings','تحذيرات'],['official_links','روابط رسمية']]
16752  };
16753
16754  // Patch 3: AI Research Center settings (global + per domain). One validated form over /api/admin/ai-research/settings.
16755  const AI_RS_MODE_LABELS={OFF:'متوقف (OFF)',MANUAL:'يدوي (MANUAL)',SCHEDULED:'مجدول (SCHEDULED)'};
16756  const AI_RS_PROVIDER_MODE_LABELS={primary_fallback:'أساسي ثم احتياطي عند الفشل (موصى به)',parallel_legacy:'متوازٍ قديم (يستهلك مزوّدين)'};
16757  const AI_RS_BACKOFF_LABELS={none:'بلا تأخير',linear:'خطي',exponential:'تصاعدي'};
16758  const AI_RS_SCHEDULE_LABELS={manual:'يدوي فقط','6h':'كل 6 ساعات','12h':'كل 12 ساعة','24h':'يومياً','48h':'كل يومين','72h':'كل 3 أيام','168h':'أسبوعياً'};
16759  const AI_RS_SOURCE_POLICY_LABELS={reputable:'مصادر عامة (بلا منصات التواصل)',trusted_only:'مصادر موثوقة فقط',official_only:'رسمية فقط'};
16760  const AI_RS_PROVIDER_LABELS={openai:'OpenAI',xai:'xAI (Grok)',deepseek:'DeepSeek'};
16761  const AI_RS_DEEPSEEK_MODEL_LABELS={'deepseek-chat':'deepseek-chat (سريع، اسم قديم)','deepseek-flash':'deepseek-flash (يفكّر، أبطأ)','deepseek-v4-pro':'deepseek-v4-pro (الأقوى والأبطأ)','deepseek-reasoner':'deepseek-reasoner (تفكير، اسم قديم)'};
16762  const AI_RS_SEARCH_LABELS={searxng:'SearXNG (مجاني، يتعطل كثيراً)',brave:'Brave Search API',serper:'Serper (نتائج Google)',tavily:'Tavily',serpapi:'SerpApi (نتائج Google، مفتاح 64 حرفاً)'};
16763  const AI_RS_GAP_PRIORITY_LABELS={HIGH:'عالية فقط',MEDIUM:'متوسطة فما فوق',LOW:'الكل'};
16764  const AI_RS_STORAGE_LABELS={metadata_only:'بيانات وصفية فقط',summary_only:'ملخص معتمد فقط'};
16765  const AI_RS_FIELDS={
16766    global:[
16767      ['mode','وضع التشغيل','select','modes',AI_RS_MODE_LABELS],['primary_provider','المزوّد الأساسي','
16767select','primary_providers',AI_RS_PROVIDER_LABELS],['fallback_enabled','تفعيل المزوّد الاحتياطي','bool'],
16768      ['fallback_provider','المزوّد الاحتياطي','select','fallback_providers',AI_RS_PROVIDER_LABELS],['deepseek_model','موديل DeepSeek للبحث','select','deepseek_models',AI_RS_DEEPSEEK_MODEL_LABELS],['ask_smt_provider','مزوّد إجابات «اسأل SMT»','select','ask_smt_providers',AI_RS_PROVIDER_LABELS],['research_search_provider','مزوّد البحث لـ DeepSeek','select','research_search_providers',AI_RS_SEARCH_LABELS],['provider_mode','سياسة المزوّدين','select','provider_modes',AI_RS_PROVIDER_MODE_LABELS],
16769      ['cross_check_high_risk','تحقق مزدوج للعناصر عالية الخطورة','bool'],['daily_job_limit','الحد اليومي للمهام (كل النطاقات)','int'],['concurrent_job_limit','المهام المتزامنة','int'],
16770      ['max_candidates_per_job','أقصى مقترحات لكل مهمة','int'],['max_queries_per_job','أقصى استعلامات لكل مهمة','int'],['max_sources_per_query','أقصى مصادر لكل استعلام','int'],
16771      ['job_timeout_seconds','مهلة المهمة (ثوانٍ)','int'],['retry_limit','حد إعادة المحاولة اليدوية','int'],['retry_backoff','تأخير إعادة المحاولة','select','backoffs',AI_RS_BACKOFF_LABELS],
16772      ['dedup_enabled','منع المهام المكررة','bool'],['hash_skip_enabled','تخطي المحتوى غير المتغير (hash)','bool'],['gap_driven_research','البحث المجدول يبدأ من فجوات المخزون','bool'],['gap_cooldown_hours','مهلة إعادة بحث الفجوة (ساعات)','int'],['backlog_alert_threshold','تنبيه تراكم المراجعة عند (مقترح)','int'],['dry_run','وضع التجربة (بلا استدعاء مزوّد)','bool'],
16773      ['global_blocked_domains','نطاقات محظورة عامة','domains'],['guide_allowed_domains','نطاقات مسموحة — الدليل','domains'],['guide_blocked_domains','نطاقات محظورة — الدليل','domains'],
16774      ['trade_allowed_domains','نطاقات مسموحة — التجارة','domains'],['trade_blocked_domains','نطاقات محظورة — التجارة','domains'],['circular_allowlist_domains','نطاقات التعميمات الموثوقة','domains']
16775    ],
16776    china_guide:[
16777      ['enabled','تفعيل البحث لهذا النطاق','bool'],['schedule','الجدولة','select','schedules',AI_RS_SCHEDULE_LABELS],['max_new_candidates_per_run','أقصى مقترحات جديدة لكل تشغيل','int'],
16778      ['minimum_coverage_target','هدف الحد الأدنى للتغطية','int'],['recheck_stale_after_days','إعادة فحص المحتوى القديم بعد (يوم)','int'],['source_policy','سياسة المصادر','select','source_policies',AI_RS_SOURCE_POLICY_LABELS],
16779      ['allow_research_without_image','السماح بالبحث بلا صورة','bool'],['gap_pilot_daily_limit','تجربة الفجوات: أقصى مهام يومياً (0 = إيقاف)','int'],['gap_pilot_min_priority','تجربة الفجوات: أدنى أولوية','select','gap_priorities',AI_RS_GAP_PRIORITY_LABELS],['target_cities','المدن المستهدفة','multi','cities'],['target_categories','التصنيفات المستهدفة','multi','categories'],
16780      ['target_company_sectors','قطاعات الشركات المستهدفة','multi','sectors']
16781    ],
16782    trade_shipping:[
16783      ['enabled','تفعيل البحث لهذا النطاق','bool'],['schedule','الجدولة','select','schedules',AI_RS_SCHEDULE_LABELS],['max_new_candidates_per_run','أقصى مقترحات جديدة لكل تشغيل','int'],
16784      ['recheck_stale_after_days','إعادة فحص المعرفة القديمة بعد (يوم)','int'],['gap_pilot_daily_limit','تجربة الفجوات: أقصى مهام يومياً (0 = إيقاف)','int'],['gap_pilot_min_priority','تجربة الفجوات: أدنى أولوية','select','gap_priorities',AI_RS_GAP_PRIORITY_LABELS],['origin_countries','دول المنشأ','multi','countries'],['de
16784stination_countries','دول الوجهة','multi','countries'],
16785      ['service_types','الخدمات المستهدفة','multi','services'],['official_required_fields','حقول تتطلب مصدراً رسمياً','multi','official_fields']
16786    ],
16787    circulars:[
16788      ['enabled','تفعيل التعميمات','bool'],['default_check_interval','فترة الفحص العادية','select','circular_intervals',AI_RS_SCHEDULE_LABELS],['priority_check_interval','فترة فحص المصادر ذات الأولوية','select','circular_intervals',AI_RS_SCHEDULE_LABELS],
16789      ['full_text_storage_mode','وضع التخزين','select','storage_modes',AI_RS_STORAGE_LABELS],['ai_summary_enabled','ملخص AI','bool'],['translation_enabled','الترجمة','bool'],['max_candidates_per_run','أقصى مقترحات لكل تشغيل','int']
16790    ]
16791  };
16792  const AI_RS_SECTIONS=[['global','الإعدادات العامة'],['china_guide','دليلك في الصين'],['trade_shipping','التجارة والشحن'],['circulars','التعميمات الرسمية']];
16793  const AiResearchSettingsPanel={setup(){
16794    const state=reactive({loaded:false,error:'',saving:false,message:'',errors:{}});
16795    const data=ref(null),form=reactive({global:{},china_guide:{},trade_shipping:{},circulars:{}}),domainText=reactive({});
16796    const keyOf=(section,key)=>section+'.'+key;
16797    function toForm(settings){
16798      for(const [section] of AI_RS_SECTIONS){
16799        form[section]=JSON.parse(JSON.stringify(settings[section]||{}));
16800        for(const field of AI_RS_FIELDS[section])if(field[2]==='domains')domainText[keyOf(section,field[0])]=safeArray(form[section][field[0]]).join('\n');
16801      }
16802    }
16803    async function load(){
16804      state.error='';
16805      const r=await api('/api/admin/ai-research/settings',{feedback:false});
16806      if(!r||!r.ok){state.error=(r&&r.message)||'تعذر تحميل إعدادات بحث الذكاء الاصطناعي.';return;}
16807      data.value=r;toForm(r.settings);state.loaded=true;
16808    }
16809    const optionList=(field)=>{
16810      const options=(data.value&&data.value.options)||{};
16811      return safeArray(options[field[3]]).map(item=>typeof item==='string'?{key:item,label:(field[4]&&field[4][item])||item}:{key:item.key,label:item.label||item.key});
16812    };
16813    const enforcedBadge=(section,key)=>!(data.value&&data.value.enforced&&data.value.enforced[section]&&data.value.enforced[section][key]);
16814    function toggleMulti(section,key,value){
16815      const list=safeArray(form[section][key]).slice();const index=list.indexOf(value);
16816      if(index>=0)list.splice(index,1);else list.push(value);
16817      form[section][key]=list;
16818    }
16819    function buildPatch(){
16820      const patch={};const base=data.value.settings;
16821      for(const [section] of AI_RS_SECTIONS){
16822        for(const field of AI_RS_FIELDS[section]){
16823          const key=field[0];let value=form[section][key];
16824          if(field[2]==='domains')value=String(domainText[keyOf(section,key)]||'').split(/[\n,\s]+/).map(x=>x.trim()).filter(Boolean);
16825          if(field[2]==='int'){if(value===''||value===null||value===undefined||!Number.isFinite(Number(value)))continue;value=Number(value);}
16826          if(JSON.stringify(value)!==JSON.stringify(base[section][key]))(patch[section]||(patch[section]={}))[key]=value;
16827        }
16828      }
16829      return patch;
16830    }
16831    const changeCount=computed(()=>data.value?Object.values(buildPatch()).reduce((n,fields)=>n+Object.keys(fields).length,0):0);
16832    async function save(){
16833      state.message='';state.errors={};
16834      const patch=buildPatch();
16835      if(!Object.keys(patch).length){state.message='لا توجد تعديلات.';return;}
16836      if(patch.global&&patch.global.dry_run===true&&!confirm('وضع التجربة يوقف كل استدعاءات المزوّد بما فيها اختبارات الجاهزية حتى تعطّله. متابعة؟')){return;}
16837      state.saving=true;
16838      const r=await api('/api/admin/ai-research/settings',{method:'POST',body:JSON.stringify({patch}),feedback:false});
16839      state.saving=false;
16840      if(!r||!r.ok){
16841        state.message=(r&&r.message)||'تعذر الحفظ.';
16842        for(const error of safeArray(r&&r.errors))state.errors[error.path]=error.message||'قيمة غير صالحة';
16843        return;
16844      }
16845      state.message=r.message||'تم الحفظ.';await load();
16846    }
16847    function healthRows(){
16848      const providers=(data.value&&data.value.provider_health&&data.value.provider_health.providers)||{};
16849      return Object.keys(providers).map(key=>({key,...providers[key]}));
16850    }
16851    const fmtTime=value=>
16851value?new Date(value).toLocaleString('ar'):'—';
16852    onMounted(load);
16853    return {state,data,form,domainText,AI_RS_SECTIONS,AI_RS_FIELDS,keyOf,optionList,enforcedBadge,toggleMulti,save,changeCount,healthRows,fmtTime,load};
16854  },
16855  render:(function(){
16856const _Vue = Vue
16857const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
16858
16859const _hoisted_1 = {
16860  class: "card formCard aiResearchSettingsPanel",
16861  "aria-labelledby": "aiRsTitle"
16862}
16863const _hoisted_2 = { class: "aiAutomationHead" }
16864const _hoisted_3 = {
16865  key: 0,
16866  class: "statusPill"
16867}
16868const _hoisted_4 = {
16869  key: 0,
16870  class: "aiWorkflowError",
16871  role: "alert"
16872}
16873const _hoisted_5 = ["onClick"]
16874const _hoisted_6 = ["open"]
16875const _hoisted_7 = { class: "aiRsGrid" }
16876const _hoisted_8 = {
16877  key: 0,
16878  class: "aiRsLater"
16879}
16880const _hoisted_9 = {
16881  key: 1,
16882  class: "aiRsError",
16883  role: "alert"
16884}
16885const _hoisted_10 = ["onUpdate:modelValue"]
16886const _hoisted_11 = ["onUpdate:modelValue"]
16887const _hoisted_12 = ["value"]
16888const _hoisted_13 = ["onUpdate:modelValue"]
16889const _hoisted_14 = ["onUpdate:modelValue"]
16890const _hoisted_15 = {
16891  key: 4,
16892  class: "aiRsMulti"
16893}
16894const _hoisted_16 = ["aria-pressed", "onClick"]
16895const _hoisted_17 = {
16896  key: 0,
16897  class: "hint aiRsWide"
16898}
16899const _hoisted_18 = { class: "aiRsGroup" }
16900const _hoisted_19 = {
16901  key: 0,
16902  class: "hint"
16903}
16904const _hoisted_20 = { key: 0 }
16905const _hoisted_21 = {
16906  key: 1,
16907  class: "hint"
16908}
16909const _hoisted_22 = { class: "row aiRsActions" }
16910const _hoisted_23 = ["disabled", "onClick"]
16911const _hoisted_24 = ["disabled", "onClick"]
16912const _hoisted_25 = {
16913  class: "hint",
16914  role: "status",
16915  "aria-live": "polite"
16916}
16917const _hoisted_26 = {
16918  key: 2,
16919  class: "hint"
16920}
16921
16922return function render(_ctx, _cache) {
16923  with (_ctx) {
16924    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode, renderList: _renderList, Fragment: _Fragment, vModelCheckbox: _vModelCheckbox, withDirectives: _withDirectives, vModelSelect: _vModelSelect, vModelText: _vModelText, normalizeClass: _normalizeClass } = _Vue
16925
16926    return (_openBlock(), _createElementBlock("section", _hoisted_1, [
16927      _createElementVNode("div", _hoisted_2, [_cache[0] || (_cache[0] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "مركز بحث الذكاء الاصطناعي"), _createElementVNode("h3", { id: "aiRsTitle" }, "إعدادات البحث (عامة + لكل نطاق)")], -1)), (data&&data.settings)
16928        ? (_openBlock(), _createElementBlock("span", _hoisted_3, _toDisplayString(data.settings.global.mode), 1))
16929        : _createCommentVNode("", true)]),
16930      _cache[3] || (_cache[3] = _createElementVNode("p", { class: "hint" }, [_createElementVNode("b", null, "AI لا ينشر مباشرة."), _createTextVNode(" كل تغيير هنا يُدقَّق في السجل. الحقول الموسومة «لاحقاً» تُحفظ الآن وتبدأ فاعليتها في باتش لاحق.")], -1)),
16931      (state.error)
16932        ? (_openBlock(), _createElementBlock("p", _hoisted_4, [_createTextVNode(_toDisplayString(state.error) + " ", 1), _createElementVNode("button", {
16933            class: "smallbtn",
16934            type: "button",
16935            onClick: load
16936          }, "إعادة المحاولة", 8, _hoisted_5)]))
16937        : _createCommentVNode("", true),
16938      (state.loaded&&data)
16939        ? (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [
16940            (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(AI_RS_SECTIONS, (sec) => {
16941              return (_openBlock(), _createElementBlock("details", {
16942                class: "aiRsGroup",
16943                key: sec[0],
16944                open: sec[0]==='global'
16945              }, [_createElementVNode("summary", null, [_createElementVNode("b", null, _toDisplayString(sec[1]), 1)]), _createElementVNode("div", _hoisted_7, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(AI_RS_FIELDS[sec[0]], (f) => {
16946                return (_openBlock(), _createElementBlock("label", {
16947                  key: f[0],
16948                  class: _normalizeClass(["fieldLabel aiRsField", {aiRsWide:f[2]==='domains'||f[2]==='multi'}])
16949                }, [_createElementVNode("span", null, [_createTextVNode(_toDisplayString(f[1]) + " ", 1), (enforcedBadge(sec[0],f[0]))
16950                  ? (_openBlock(), _createElementBlock("small", _hoisted_8, "لاحقاً"))
16951                  : _createCommentVNode("", true), (state.errors[keyOf(sec[0],f[0])])
16952                  ? (_openBlock(), _createElementBlock("small", _hoisted_9, " — " + _toDisplayString(state.errors[keyOf(sec[0],f[0])]), 1))
16953                  : _createCommentVNode("", true)]), (f[2]==='bool')
16954                  ? _withDirectives((_openBlock(), _createElementBlock("input", {
16955                      key: 0,
16956                      type: "checkbox",
16957                      "onUpdate:modelValue": $event => ((form[sec[0]][f[0]]) = $event)
16958                    }, null, 8, _hoisted_10)), [[_vModelCheckbox, form[sec[0]][f[0]]]])
16959                  : (f[2]==='select')
16960                    ? _withDirectives((_openBlock(), _createElementBlock("select", {
16961                        key: 1,
16962                        "onUpdate:modelValue": $event => ((form[sec[0]][f[0]]) = $event)
16963                      }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(optionList(f), (o) => {
16964                        return (_openBlock(), _createElementBlock("option", {
16965                          key: o.key,
16966                          value: o.key
16967                        }, _toDisplayString(o.label), 9, _hoisted_12))
16968                      }), 128))], 8, _hoisted_11)), [[_vModelSelect, form[sec[0]][f[0]]]])
16969                    : (f[2]==='int')
16970                      ? _withDirectives((_openBlock(), _createElementBlock("input", {
16971                          key: 2,
16972                          type: "number",
16973                          inputmode: "numeric",
16974                          "onUpdate:modelValue": $event => ((form[sec[0]][f[0]]) = $event)
16975                        }, null, 8, _hoisted_13)), [[
16976                          _vModelText,
16977                          form[sec[0]][f[0]],
16978                          void 0,
16979                          { number: true }
16980                        ]])
16981                      : (f[2]==='domains')
16982                        ? _withDirectives((_openBlock(), _createElementBlock("textarea", {
16983                            key: 3,
16984                            rows: "3",
16985                            "onUpdate:modelValue": $event => ((domainText[keyOf(sec[0],f[0])]) = $event),
16986                            placeholder: "نطاق في كل سطر، مثال: example.com",
16987                            dir: "ltr"
16988                          }, null, 8, _hoisted_14)), [[_vModelText, domainText[keyOf(sec[0],f[0])]]])
16989                        : (_openBlock(), _createElementBlock("div", _hoisted_15, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(optionList(f), (o) => {
16990                            return (_openBlock(), _createElementBlock("button", {
16991                              key: o.key,
16992                              type: "button",
16993                              class: _normalizeClass(['smallbtn',(form[sec[0]][f[0]]||[]).includes(o.key)?'':'secondary']),
16994                              "aria-pressed": (form[sec[0]][f[0]]||[]).includes(o.key),
16995                              onClick: $event => (toggleMulti(sec[0],f[0],o.key))
16996                            }, _toDisplayString(o.label), 11, _hoisted_16))
16997                          }), 128))]))], 2))
16998              }), 128)), (sec[0]==='circulars')
16999                ? (_openBlock(), _createElementBlock("p", _hoisted_17, "«المصادر الموثوقة فقط» مقفل دائماً ولا يمكن تعطيله من الواجهة."))
17000                : _createCommentVNode("", true)])], 8, _hoisted_6))
17001            }), 128)),
17002            _createElementVNode("details", _hoisted_18, [
17003              _cache[2] || (_cache[2] = _createElementVNode("summary", null, [_createElementVNode("b", null, "صحة المزوّدين"), _createTextVNode(), _createElementVNode("small", { class: "hint" }, "للإدارة فقط")], -1)),
17004              (!healthRows().length)
17005                ? (_openBlock(), _createElementBlock("div", _hoisted_19, "لا توجد قياسات بعد؛ تُسجَّل مع أول مهمة بحث."))
17006                : _createCommentVNode("", true),
17007              (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(healthRows(), (h) => {
17008                return (_openBlock(), _createElementBlock("div", {
17009                  key: h.key,
17010                  class: "aiRsHealth"
17011                }, [
17012                  _createElementVNode("b", null, _toDisplayString(h.key), 1),
17013                  _cache[1] || (_cache[1] = _createTextVNode()),
17014                  _createElementVNode("span", { class: _normalizeClass(["statusPill", {canaryPill:!h.temporarily_degraded}]) }, _toDisplayString(h.temporarily_degraded?'متدهور مؤقتاً':'سليم'), 3),
17015                  _createElementVNode("small", null, [_createTextVNode("آخر نجاح: " + _toDisplayString(fmtTime(h.last_success)) + " · آخر فشل: " + _toDisplayString(fmtTime(h.last_failure)) + " · إخفاقات متتالية: " + _toDisplayString(h.c
17015onsecutive_failures) + " · متوسط الاستجابة: " + _toDisplayString(h.average_latency_ms) + " ms", 1), (h.recent_error_code)
17016                    ? (_openBlock(), _createElementBlock("span", _hoisted_20, " · آخر خطأ: " + _toDisplayString(h.recent_error_code), 1))
17017                    : _createCommentVNode("", true)])
17018                ]))
17019              }), 128)),
17020              (data.providers_configured)
17021                ? (_openBlock(), _createElementBlock("div", _hoisted_21, "المفاتيح: OpenAI " + _toDisplayString(data.providers_configured.openai?'✓':'✗') + " · xAI " + _toDisplayString(data.providers_configured.xai?'✓':'✗'), 1))
17022                : _createCommentVNode("", true)
17023            ]),
17024            _createElementVNode("div", _hoisted_22, [_createElementVNode("button", {
17025              class: "smallbtn",
17026              type: "button",
17027              disabled: state.saving||!changeCount,
17028              onClick: save
17029            }, _toDisplayString(state.saving?'جارٍ الحفظ…':'حفظ التعديلات ('+changeCount+')'), 9, _hoisted_23), _createElementVNode("button", {
17030              class: "smallbtn secondary",
17031              type: "button",
17032              disabled: state.saving,
17033              onClick: load
17034            }, "تراجع عن غير المحفوظ", 8, _hoisted_24)]),
17035            _createElementVNode("p", _hoisted_25, _toDisplayString(state.message), 1)
17036          ], 64))
17037        : (!state.error)
17038          ? (_openBlock(), _createElementBlock("p", _hoisted_26, "جارٍ التحميل…"))
17039          : _createCommentVNode("", true)
17040    ]))
17041  }
17042}
17043})()};
17044  // Patch 4: knowledge gaps (inventory gap engine) — coverage summary, open gaps, and one-tap research (candidates only).
17045  const GAP_TYPE_LABELS={zero_coverage:'لا تغطية',low_coverage:'تغطية ضعيفة',repeated_zero_results:'بحث بلا نتيجة',stale_coverage:'معلومات قديمة',missing_taxonomy:'بلا تصنيف',missing_route_service:'خدمة مسار ناقصة',missing_circular_source:'مصدر تعميم ناقص',admin_manual:'يدوية'};
17046  const GAP_PRIORITY_LABELS={HIGH:'عالية',MEDIUM:'متوسطة',LOW:'منخفضة'};
17047  const AiKnowledgeGapsPanel={props:{hub:{type:String,default:'china_guide'}},setup(props){
17048    const state=reactive({loading:true,error:'',busy:false,message:'',priority:'',status:'open'});
17049    const rows=ref([]),total=ref(0),summary=ref(null),coverage=ref(null);
17050    let loadToken=0,coverageHub='';
17051    async function load(){
17052      const token=++loadToken;
17053      state.error='';state.loading=true;
17054      const qs=new URLSearchParams({domain:props.hub,status:state.status,limit:'12'});if(state.priority)qs.set('priority',state.priority);
17055      // The heavier coverage view only reloads when the hub (or an explicit refresh) changes it.
17056      const needCoverage=coverageHub!==props.hub||!coverage.value;
17057      const [g,c]=await Promise.all([api('/api/admin/ai-research/gaps?'+qs.toString(),{feedback:false}),needCoverage?api('/api/admin/ai-research/coverage',{feedback:false}):Promise.resolve(null)]);
17058      if(token!==loadToken)return; // a newer request superseded this one
17059      state.loading=false;
17060      if(!g||!g.ok){state.error=(g&&g.message)||'تعذر تحميل الفجوات.';return;}
17061      rows.value=safeArray(g.rows);total.value=g.total||0;summary.value=g.summary||null;
17062      if(c){coverage.value=c.ok?c:null;coverageHub=props.hub;}
17063    }
17064    const openCount=(priority)=>safeArray(summary.value&&summary.value.open_by_domain_priority).filter(x=>x.domain===props.hub&&x.priority===priority).reduce((n,x)=>n+x.n,0);
17065    async function act(path,body,done){
17066      state.busy=true;state.message='';
17067      const r=await api(path,{method:'POST',body:JSON.stringify(body||{}),feedback:false});
17068      state.busy=false;state.message=(r&&r.message)||(r&&r.ok?done:'تعذر التنفيذ.');
17069      if(r&&r.ok)await load();
17070    }
17071    const batch=ref(null);let batchTimer=null;
17072    async function pollBatch(){
17073      const r=await api('/api/admin/ai-research/gaps/research-batch',{feedback:false});
17074      batch.value=r&&r.ok?r.batch:null;
17075      if(batch.value&&batch.value.running){batchTimer=setTimeout(pollBatch,4000);}else if(batchTimer){batchTimer=null;await load();}
17076    }
17077    async function researchAll(onlyManual,gapIds){
17078      state.busy=true;state.message='';
17079      const r=await api('/api/admin/ai-research/gaps/research-batch',{method:'POST',body:JSON.stringify({domain:props.hub,only_manual:!!onlyManual,limit:12,gap_ids:gapIds||undefined}),feedback:false});
17080      state.busy=false;state.message=(r&&r.message)||'تعذر البدء.';
17081      if(r&&r.ok){batchTimer=setTimeout(pollBatch,1500);}
17082    }
17083    onUnmounted(()=>
17083{if(batchTimer)clearTimeout(batchTimer);});
17084    const BATCH_STOP_LABELS={global_daily_limit:'بلغت الحد اليومي للمهام',concurrency_limit:'يوجد بحث آخر قيد التنفيذ',domain_busy:'النطاق مشغول ببحث آخر',research_off:'البحث متوقف',domain_disabled:'النطاق معطّل'};
17085    const scan=()=>act('/api/admin/ai-research/gaps/scan',{},'اكتمل مسح الفجوات.');
17086    const research=(row,dry)=>dry?act('/api/admin/ai-research/gaps/'+row.id+'/research',{dry_run:true},'تمت الإضافة.'):researchAll(false,[row.id]);
17087    const decide=(row,action)=>act('/api/admin/ai-research/gaps/'+row.id,{action},'تم الحفظ.');
17088    const lastScan=computed(()=>summary.value&&summary.value.last_scan_at?new Date(summary.value.last_scan_at).toLocaleString('ar'):'لم يُجرَ بعد');
17089    watch(()=>[props.hub,state.priority,state.status],load);
17090    onMounted(()=>{load();pollBatch();});
17091    return {state,rows,total,summary,coverage,openCount,scan,research,decide,lastScan,GAP_TYPE_LABELS,GAP_PRIORITY_LABELS,load,batch,researchAll,pollBatch,BATCH_STOP_LABELS};
17092  },
17093  render:(function(){
17094const _Vue = Vue
17095const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
17096
17097const _hoisted_1 = {
17098  class: "card aiGapsPanel",
17099  "aria-labelledby": "aiGapsTitle"
17100}
17101const _hoisted_2 = { class: "aiAutomationHead" }
17102const _hoisted_3 = { class: "row" }
17103const _hoisted_4 = ["disabled", "onClick"]
17104const _hoisted_5 = ["disabled", "onClick"]
17105const _hoisted_6 = ["disabled", "onClick"]
17106const _hoisted_7 = {
17107  key: 0,
17108  class: "hint aiGapsToast",
17109  role: "status",
17110  "aria-live": "polite"
17111}
17112const _hoisted_8 = {
17113  key: 1,
17114  class: "hint aiBatchStatus"
17115}
17116const _hoisted_9 = { class: "hint" }
17117const _hoisted_10 = {
17118  class: "aiGapsChips",
17119  role: "group",
17120  "aria-label": "تصفية الأولوية"
17121}
17122const _hoisted_11 = ["onClick"]
17123const _hoisted_12 = ["onClick"]
17124const _hoisted_13 = {
17125  key: 2,
17126  class: "hint"
17127}
17128const _hoisted_14 = {
17129  key: 3,
17130  class: "hint"
17131}
17132const _hoisted_15 = {
17133  key: 4,
17134  class: "aiWorkflowError",
17135  role: "alert"
17136}
17137const _hoisted_16 = {
17138  key: 5,
17139  class: "hint"
17140}
17141const _hoisted_17 = {
17142  key: 6,
17143  class: "hint"
17144}
17145const _hoisted_18 = { class: "aiGapHead" }
17146const _hoisted_19 = {
17147  key: 0,
17148  class: "hint"
17149}
17150const _hoisted_20 = { class: "hint" }
17151const _hoisted_21 = { key: 0 }
17152const _hoisted_22 = { key: 1 }
17153const _hoisted_23 = { class: "row aiGapActions" }
17154const _hoisted_24 = ["disabled", "onClick"]
17155const _hoisted_25 = ["disabled", "onClick"]
17156const _hoisted_26 = ["disabled", "onClick"]
17157const _hoisted_27 = ["disabled", "onClick"]
17158const _hoisted_28 = {
17159  key: 7,
17160  class: "hint"
17161}
17162
17163return function render(_ctx, _cache) {
17164  with (_ctx) {
17165    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode, Fragment: _Fragment, normalizeClass: _normalizeClass, renderList: _renderList } = _Vue
17166
17167    return (_openBlock(), _createElementBlock("section", _hoisted_1, [
17168      _createElementVNode("div", _hoisted_2, [_cache[0] || (_cache[0] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "محرك فجوات المخزون"), _createElementVNode("h3", { id: "aiGapsTitle" }, "فجوات المعرفة")], -1)), _createElementVNode("div", _hoisted_3, [_createElementVNode("button", {
17169        class: "smallbtn",
17170        type: "button",
17171        disabled: state.busy||(batch&&batch.running),
17172        onClick: $event => (researchAll(false))
17173      }, "ابحث في كل الفجوات (حتى 12)", 8, _hoisted_4), _createElementVNode("button", {
17174        class: "smallbtn secondary",
17175        type: "button",
17176        disabled: state.busy||(batch&&batch.running),
17177        onClick: $event => (researchAll(true))
17178      }, "فجواتي اليدوية فقط", 8, _hoisted_5), _createElementVNode("button", {
17179        class: "smallbtn",
17180        type: "button",
17181        disabled: state.busy,
17182        onClick: scan
17183      }, "مسح الآن", 8, _hoisted_6)])]),
17184      (state.message)
17185        ? (_openBlock(), _createElementBlock("p", _hoisted_7, _toDisplayString(state.message), 1))
17186        : _createCommentVNode("", true),
17187      (batch&&(batch.running||batch.total))
17188        ? (_openBlock(), _createElementBlock("p", _hoisted_8, [_createTextVNode("البحث الجماعي: " + _toDisplayString(batch.done) + " / " + _toDisplayString(batch.total), 1), (batch.running)
17189            ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createTextVNode(" · جارٍ…")], 64))
17190            : (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [_createTextVNode(" · انتهى")], 64)), (batch.stopped_reason)
17191            ? (_openBlock(), _createElementBlock(_Fragment, { key: 2 }, [_createTextVNode(" · توقف: " + _toDisplayString(BATCH_STOP_LABELS[batch.stopped_reason]||batch.stopped_reason), 1)], 64))
17192            : _createCommentVNode("", true)]))
17193        : _createCommentVNode("", true),
17194      _createElementVNode("p", _hoisted_9, "يقيس النظام تغطية ما هو منشور فعلاً ثم يقترح أين نبحث. لا يستهلك AI ولا ينشر شيئاً؛ البحث يُنتج مقترحات للمراجعة فقط. آخر مسح: " + _toDisplayString(lastScan), 1),
17195      _createElementVNode("div", _hoisted_10, [_createElementVNode("button", {
17196        type: "button",
17197        class: _normalizeClass(['smallbtn',state.priority===''?'':'secondary']),
17198        onClick: $event => (state.priority='')
17199      }, "الكل", 10, _hoisted_11), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(['HIGH','MEDIUM','LOW'], (p) => {
17200        return (_openBlock(), _createElementBlock("button", {
17201          key: p,
17202          type: "button",
17203          class: _normalizeClass(['smallbtn',state.priority===p?'':'secondary']),
17204          onClick: $event => (state.priority=p)
17205        }, _toDisplayString(GAP_PRIORITY_LABELS[p]) + " (" + _toDisplayString(openCount(p)) + ")", 11, _hoisted_12))
17206      }), 128))]),
17207      (coverage&&hub==='china_guide')
17208        ? (_openBlock(), _createElementBlock("p", _hoisted_13, "تغطية الدليل: " + _toDisplayString(coverage.china_guide.categories.length) + " تصنيفاً · " + _toDisplayString(coverage.china_guide.company_
17208sectors.length) + " قطاع شركات · قديمة: " + _toDisplayString(coverage.china_guide.stale_items) + " · بلا تصنيف: " + _toDisplayString(coverage.china_guide.unclassified), 1))
17209        : _createCommentVNode("", true),
17210      (coverage&&hub==='trade_shipping')
17211        ? (_openBlock(), _createElementBlock("p", _hoisted_14, "التجارة: " + _toDisplayString(coverage.trade_shipping.routes) + " مساراً · " + _toDisplayString(coverage.trade_shipping.countries_research_enabled) + " دولة بحث · " + _toDisplayString(coverage.trade_shipping.services_research_enabled) + " خدمة بحث", 1))
17212        : _createCommentVNode("", true),
17213      (state.error)
17214        ? (_openBlock(), _createElementBlock("p", _hoisted_15, _toDisplayString(state.error), 1))
17215        : (state.loading)
17216          ? (_openBlock(), _createElementBlock("p", _hoisted_16, "جارٍ التحميل…"))
17217          : (!rows.length)
17218            ? (_openBlock(), _createElementBlock("p", _hoisted_17, "لا فجوات مفتوحة لهذا الفلتر. اضغط «مسح الآن» بعد تغيير الإعدادات."))
17219            : _createCommentVNode("", true),
17220      (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(rows, (row) => {
17221        return (_openBlock(), _createElementBlock("article", {
17222          key: row.id,
17223          class: "aiGapCard"
17224        }, [
17225          _createElementVNode("div", _hoisted_18, [_createElementVNode("b", null, _toDisplayString(row.label_ar), 1), _createElementVNode("span", { class: _normalizeClass(["statusPill", {canaryPill:row.priority==='LOW'}]) }, _toDisplayString(GAP_PRIORITY_LABELS[row.priority_override||row.priority]), 3)]),
17226          (row.yield&&row.yield.jobs)
17227            ? (_openBlock(), _createElementBlock("small", _hoisted_19, "نتائج البحث: " + _toDisplayString(row.yield.pending) + " للمراجعة · " + _toDisplayString(row.yield.approved) + " معتمدة · " + _toDisplayString(row.yield.rejected) + " مرفوضة (" + _toDisplayString(row.yield.jobs) + " مهمة)", 1))
17228            : _createCommentVNode("", true),
17229          _createElementVNode("small", _hoisted_20, [_createTextVNode(_toDisplayString(GAP_TYPE_LABELS[row.gap_type]||row.gap_type) + " · لدينا " + _toDisplayString(row.existing_count) + " / المستهدف " + _toDisplayString(row.target_count), 1), (row.demand_count)
17230            ? (_openBlock(), _createElementBlock("span", _hoisted_21, " · " + _toDisplayString(row.demand_count) + " بحث بلا نتيجة", 1))
17231            : _createCommentVNode("", true)]),
17232          (row.queries&&row.queries.length)
17233            ? (_openBlock(), _createElementBlock("details", _hoisted_22, [_cache[1] || (_cache[1] = _createElementVNode("summary", null, "عبارات البحث", -1)), _createElementVNode("ul", null, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(row.queries, (query, i) => {
17234                return (_openBlock(), _createElementBlock("li", {
17235                  key: i,
17236                  dir: "auto"
17237                }, _toDisplayString(query), 1))
17238              }), 128))])]))
17239            : _createCommentVNode("", true),
17240          _createElementVNode("div", _hoisted_23, [
17241            (row.queries&&row.queries.length)
17242              ? (_openBlock(), _createElementBlock("button", {
17243                  key: 0,
17244                  class: "smallbtn",
17245                  type: "button",
17246                  disabled: state.busy,
17247                  onClick: $event => (research(row,false))
17248                }, "ابحث الآن", 8, _hoisted_24))
17249              : _createCommentVNode("", true),
17250            (row.queries&&row.queries.length)
17251              ? (_openBlock(), _createElementBlock("button", {
17252                  key: 1,
17253                  class: "smallbtn secondary",
17254                  type: "button",
17255                  disabled: state.busy,
17256                  onClick: $event => (research(row,true))
17257                }, "تجربة بلا مزوّد", 8, _hoisted_25))
17258              : _createCommentVNode("", true),
17259            _createElementVNode("button", {
17260              class: "smallbtn secondary",
17261              type: "button",
17262              disabled: state.busy,
17263              onClick: $event => (decide(row,'snooze'))
17264            }, "تأجيل", 8, _hoisted_26),
17265            _createElementVNode("button", {
17266              class: "smallbtn secondary",
17267              type: "button",
17268              disabled: state.busy,
17269              onClick: $event => (decide(row,'dismiss'))
17270            }, "تجاهل", 8, _hoisted_27)
17271          ])
17272        ]))
17273      }), 128)),
17274      (total>rows.length)
17275        ? (_openBlock(), _createElementBlock("small", _hoisted_28, "يعرض أهم " + _toDisplayString(rows.length) + " من " + _toDisplayString(total) + " فجوة.", 1))
17276        : _createCommentVNode("", true)
17277    ]))
17278  }
17279}
17280})()};
17281  const AiQualityPanel={props:{hub:{type:String,default:'china_guide'}},setup(props){
17282    const state=reactive({loading:true,error:'',days:30}),d=ref(null);
17283    let token=0;
17284    async function load(){const t=++token;state.loading=true;state.error='';const r=await api('/api/admin/ai-research/quality?hub='+encodeURIComponent(props.hub)+'&days='+state.days,{feedback:false});if(t!==token)return;state.loading=false;if(!r||!r.ok){state.error=(r&&r.message)||'تعذر تحميل مؤشرات الجودة.';return;}d.value=r;syncPrices();}
17285    const prices=reactive({}),pricing=reactive({busy:false,msg:''});
17286    function syncPrices(){for(const row of ((d.value&&d.value.cost&&d.value.cost.pricing_rows)||[])){const k=row.provider+'|'+row.model;if(!prices[k])prices[k]={input:row.price?row.price.input:'',output:row.price?row.price.output:''};}}
17287    async function savePrices(){const out={};for(const [k,v] of Object.entries(prices)){if(v.input===''||v.output===''||v.input==null||v.output==null)continue;out[k]={input:Number(v.input),output:Number(v.output)};}pricing.busy=true;pricing.msg='';const r=await api('/api/admin/ai-research/pricing',{method:'POST',body:JSON.stringify({prices:out}),feedback:false});pricing.busy=false;pricing.msg=(r&&r.message)||'تعذر الحفظ.';if(r&&r.ok)await load();}
17288    const pct=v=>v==null?'—':Math.round(v*100)+'%';
17289    const num=v=>v==null?'—':Number(v).toLocaleString('ar');
17290    watch(()=>[props.hub,state.days],load);onMounted(load);
17291    const windows=computed(()=>d.value&&d.value.windows?d.value.windows:[7,14,30,90]);
17292    return {state,d,pct,num,load,windows,prices,pricing,savePrices};
17293  },
17294  render:(function(){
17295const _Vue = Vue
17296const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
17297
17298const _hoisted_1 = {
17299  class: "card aiQualityPanel",
17300  "aria-labelledby": "aiQualityTitle"
17301}
17302const _hoisted_2 = { class: "aiAutomationHead" }
17303const _hoisted_3 = ["onUpdate:modelValue"]
17304const _hoisted_4 = ["value"]
17305const _hoisted_5 = {
17306  key: 0,
17307  class: "aiWorkflowError",
17308  role: "alert"
17309}
17310const _hoisted_6 = {
17311  key: 1,
17312  class: "hint"
17313}
17314const _hoisted_7 = { class: "compactSummaryBar" }
17315const _hoisted_8 = { class: "hint" }
17316const _hoisted_9 = { class: "hint" }
17317const _hoisted_10 = { class: "hint" }
17318const _hoisted_11 = { key: 0 }
17319const _hoisted_12 = { class: "hint" }
17320const _hoisted_13 = { key: 0 }
17321const _hoisted_14 = { key: 0 }
17322const _hoisted_15 = { key: 0 }
17323const _hoisted_16 = { dir: "ltr" }
17324const _hoisted_17 = { class: "hint" }
17325const _hoisted_18 = { key: 0 }
17326const _hoisted_19 = { class: "fieldLabel" }
17327const _hoisted_20 = ["onUpdate:modelValue"]
17328const _hoisted_21 = { class: "fieldLabel" }
17329const _hoisted_22 = ["onUpdate:modelValue"]
17330const _hoisted_23 = ["disabled", "onClick"]
17331const _hoisted_24 = {
17332  class: "hint",
17333  role: "status"
17334}
17335const _hoisted_25 = {
17336  key: 1,
17337  class: "hint"
17338}
17339const _hoisted_26 = { key: 2 }
17340const _hoisted_27 = {
17341  key: 3,
17342  class: "hint"
17343}
17344const _hoisted_28 = ["href"]
17345
17346return function render(_ctx, _cache) {
17347  with (_ctx) {
17348    const { createElementVNode: _createElementVNode, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, toDisplayString: _toDisplayString, vModelSelect: _vModelSelect, withDirectives: _withDirectives, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode, vModelText: _vModelText } = _Vue
17349
17350    return (_openBlock(), _createElementBlock("section", _hoisted_1, [_createElementVNode("div", _hoisted_2, [_cache[0] || (_cache[0] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "الجودة والتكلفة"), _createElementVNode("h3", { id: "aiQualityTitle" }, "جودة البحث")], -1)), _withDirectives(_createElementVNode("select", {
17351      "onUpdate:modelValue": $event => ((state.days) = $event),
17352      "aria-label": "الفترة"
17353    }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(windows, (n) => {
17354      return (_openBlock(), _createElementBlock("option", {
17355        key: n,
17356        value: n
17357      }, "آخر " + _toDisplayString(n) + " يوماً", 9, _hoisted_4))
17358    }), 128))], 8, _hoisted_3), [[
17359      _vModelSelect,
17360      state.days,
17361      void 0,
17362      { number: true }
17363    ]])]), (state.error)
17364      ? (_openBlock(), _createElementBlock("p", _hoisted_5, _toDisplayString(state.error), 1))
17365      : (state.loading&&!d)
17366        ? (_openBlock(), _createElementBlock("p", _hoisted_6, "جارٍ التحميل…"))
17367        : _createCommentVNode("", true), d
17368      ? (_openBlock(), _createElementBlock(_Fragment, { key: 2 }, [
17369          _createElementVNode("div", _hoisted_7, [
17370            _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(num(d.yield.candidates)), 1), _cache[1] || (_cache[1] = _createElementVNode("small", null, "مقترحات", -1))]),
17371            _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(pct(d.review.acceptance_rate)), 1), _cache[2] || (_cache[2] = _createElementVNode("small", null, "قبول من المُراجَع", -1))]),
17372            _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(pct(d.yield.duplicate_rate)), 1), _cache[3] || (_cache[3] = _createElementVNode("small", null, "نسبة التكرار", -1))]),
17373            _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(num(d.review.open_now)), 1), _cache[4] || (_cache[4] = _createElementVNode("small", null, "بانتظار المراجعة", -1))])
17374          ]),
17375          _createElementVNode("p", _hoisted_8, "مهام ناجحة " + _toDisplayString(num(d.jobs.completed)) + " · فاشلة " + _toDisplayString(num(d.jobs.failed)) + " · عبر فجوات " + _toDisplayString(num(d.jobs.gap_driven)) + " · وسيط زمن المراجعة " + _toDisplayString(d.review.median_review_hours) + " ساعة", 1),
17376          _createElementVNode("p", _hoisted_9, "استدعاءات AI " + _toDisplayString(num(d.cost.ai_calls)) + " · رموز لكل مقترح " + _toDisplayString(num(d.cost.tokens_per_candidate)) + " · مهام احتياطية " + _toDisplayString(num(d.cost.fallback_jobs)) + " · تخطي مزود متعطل " + _toDisplayString(num(d.cost.primary_skipped_jobs)) + " · تخطي بالبصمة " + _toDisplayString(num(d.yield.hash_skipped)), 1),
17377          _createElementVNode("p", _hoisted_10, [_createTextVNode("رُفض بسياسة المصادر " + _toDisplayString(num(d.yield.rejected_by_source_policy)), 1), (d.hub_key==='trade_shipping')
17378            ? (_openBlock(), _createElementBlock("span", _hoisted_11, " (قواعد بلا مصدر رسمي " + _toDisplayString(num(d.yield.rejected_regulatory_unverified)) + ")", 1))
17379            : _createCommentVNode("", true), _createTextVNode(" · مصادر رسمية " + _toDisplayString(num(d.sources.official)) + " · موثوقة " + _toDisplayString(num(d.sources.trusted)) + " · غير مصنفة " + _toDisplayString(num(d.sources.unknown)), 1)]),
17380          _createElementVNode("p", _hoisted_12, [(d.cost.estimated_cost!=null)
17381            ? (_openBlock(), _createElementBlock("b", _hoisted_13, [_createTextVNode("التكلفة التقديرية: " + _toDisplayString(d.cost.estimated_cost) + " دولار", 1), (d.cost.cost_per_approved!=null)
17382                ? (_openBlock(), _createElementBlock("span", _hoisted_14, " · لكل مقترح معتمد " + _toDisplayString(d.cost.cost_per_approved) + " دولار", 1))
17383                : _createCommentVNode("", true), _cache[5] || (_cache[5] = _createTextVNode(" — "))]))
17384            : _createCommentVNode("", true), _createTextVNode(_toDisplayString(d.cost.estimated_cost_note), 1)]),
17385          (d.cost.pricing_rows.length)
17386            ? (_openBlock(), _createElementBlock("details", _hoisted_15, [
17387                _cache[8] || (_cache[8] = _createElementVNode("summary", null, "أسعار النماذج (دولار لكل مليون رمز)", -1)),
17388                (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(d.cost.pricing_rows, (row) => {
17389                  return (_openBlock(), _createElementBlock("div", {
17390                    class: "aiPriceRow",
17391                    key: row.provider+'|'+row.model
17392                  }, [_createElementVNode("b", _hoisted_16, _toDisplayString(row.provider) + " · " + _toDisplayString(row.model||'—'), 1), _createElementVNode("small", _hoisted_17, [_createTextVNode(_toDisplayString(row.jobs) + " مهمة · " + _toDisplayString(num(row.input_tokens)) + " دخل / " + _toDisplayString(num(row.output_tokens)) + " خرج", 1), (row.mixed)
17393                    ? (_openBlock(), _createElementBlock("span", _hoisted_18, " · مهام مختلطة (بلا تسعير)"))
17394                    : _createCommentVNode("", true)]), (!row.mixed&&prices[row.provider+'|'+row.model])
17395                    ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createElementVNode("label", _hoisted_19, [_cache[6] || (_cache[6] = _createTextVNode("دخل")), _withDirectives(_createElementVNode("input", {
17396                        type: "number",
17397                        min: "0",
17398                        max: "1000",
17399                        step: "0.01",
17400                        "onUpdate:modelValue": $event => ((prices[row.provider+'|'+row.model].input) = $event),
17401                        dir: "ltr"
17402                      }, null, 8, _hoisted_20), [[_vModelText, prices[row.provider+'|'+row.model].input]])]), _createElementVNode("label", _hoisted_21, [_cache[7] || (_cache[7] = _
17402createTextVNode("خرج")), _withDirectives(_createElementVNode("input", {
17403                        type: "number",
17404                        min: "0",
17405                        max: "1000",
17406                        step: "0.01",
17407                        "onUpdate:modelValue": $event => ((prices[row.provider+'|'+row.model].output) = $event),
17408                        dir: "ltr"
17409                      }, null, 8, _hoisted_22), [[_vModelText, prices[row.provider+'|'+row.model].output]])])], 64))
17410                    : _createCommentVNode("", true)]))
17411                }), 128)),
17412                _createElementVNode("button", {
17413                  class: "smallbtn",
17414                  type: "button",
17415                  disabled: pricing.busy,
17416                  onClick: savePrices
17417                }, "حفظ الأسعار", 8, _hoisted_23),
17418                _createElementVNode("small", _hoisted_24, _toDisplayString(pricing.msg), 1)
17419              ]))
17420            : _createCommentVNode("", true),
17421          (d.providers.length)
17422            ? (_openBlock(), _createElementBlock("ul", _hoisted_25, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(d.providers, (p) => {
17423                return (_openBlock(), _createElementBlock("li", { key: p.provider }, _toDisplayString(p.provider) + ": " + _toDisplayString(p.degraded?'متعطل مؤقتاً':'سليم') + " · إخفاقات متتالية " + _toDisplayString(p.consecutive_failures) + " · زمن " + _toDisplayString(p.average_latency_ms) + "ms", 1))
17424              }), 128))]))
17425            : _createCommentVNode("", true),
17426          (d.review_next.length)
17427            ? (_openBlock(), _createElementBlock("h4", _hoisted_26, "الأولى بالمراجعة"))
17428            : _createCommentVNode("", true),
17429          (d.review_next.length)
17430            ? (_openBlock(), _createElementBlock("ol", _hoisted_27, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(d.review_next, (x) => {
17431                return (_openBlock(), _createElementBlock("li", { key: x.id }, [_createElementVNode("a", { href: x.review_path }, _toDisplayString(x.title), 9, _hoisted_28), _createTextVNode(" — عمر " + _toDisplayString(x.age_days) + " يوم", 1)]))
17432              }), 128))]))
17433            : _createCommentVNode("", true)
17434        ], 64))
17435      : _createCommentVNode("", true)]))
17436  }
17437}
17438})()};
17439  const ExhibitionDatesPanel={setup(){
17440    const state=reactive({loading:true,error:'',busy:false,message:'',status:'pending'}),rows=ref([]),summary=ref(null),run=ref(null);
17441    let token=0,poll=null;
17442    async function load(){const t=++token;state.loading=true;state.error='';const r=await api('/api/admin/exhibitions/dates?status='+encodeURIComponent(state.status),{feedback:false});if(t!==token)return;state.loading=false;if(!r||!r.ok){state.error=(r&&r.message)||'تعذر تحميل تواريخ المعارض.';return;}rows.value=safeArray(r.rows);summary.value=r.summary||null;run.value=r.run||null;if(r.run&&r.run.running&&!poll)poll=setInterval(load,6000);if(!(r.run&&r.run.running)&&poll){clearInterval(poll);poll=null;}}
17443    async function act(path,body,done){state.busy=true;state.message='';const r=await api(path,{method:'POST',body:JSON.stringify(body||{}),feedback:false});state.busy=false;state.message=(r&&r.message)||(r&&r.ok?done:'تعذر التنفيذ.');if(r&&r.ok)await load();}
17444    const collect=()=>act('/api/admin/exhibitions/dates/collect',{},'بدأ الجمع.');
17445    const decide=(row,action)=>act('/api/admin/exhibitions/dates/'+row.id+'/decision',{action},'تم.');
17446    const STATUS_LABELS={pending:'للمراجعة',approved:'معتمد',rejected:'مرفوض',not_event:'ليس معرضاً',no_dates:'بلا تواريخ'};
17447    watch(()=>state.status,load);onMounted(load);onUnmounted(()=>{if(poll)clearInterval(poll);});
17448    return {state,rows,summary,run,collect,decide,STATUS_LABELS};
17449  },
17450  render:(function(){
17451const _Vue = Vue
17452const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
17453
17454const _hoisted_1 = {
17455  class: "card exhibitionDatesPanel",
17456  "aria-labelledby": "exDatesTitle"
17457}
17458const _hoisted_2 = { class: "aiAutomationHead" }
17459const _hoisted_3 = ["disabled", "onClick"]
17460const _hoisted_4 = {
17461  key: 0,
17462  class: "hint"
17463}
17464const _hoisted_5 = { key: 0 }
17465const _hoisted_6 = {
17466  class: "aiGapsChips",
17467  role: "group",
17468  "aria-label": "الحالة"
17469}
17470const _hoisted_7 = ["onClick"]
17471const _hoisted_8 = {
17472  key: 1,
17473  class: "aiWorkflowError",
17474  role: "alert"
17475}
17476const _hoisted_9 = {
17477  key: 2,
17478  class: "hint"
17479}
17480const _hoisted_10 = { class: "aiGapHead" }
17481const _hoisted_11 = { class: "statusPill" }
17482const _hoisted_12 = {
17483  key: 0,
17484  class: "routeStepChinese",
17485  dir: "ltr"
17486}
17487const _hoisted_13 = { key: 0 }
17488const _hoisted_14 = { key: 1 }
17489const _hoisted_15 = {
17490  key: 1,
17491  class: "hint"
17492}
17493const _hoisted_16 = {
17494  key: 2,
17495  class: "hint",
17496  dir: "auto"
17497}
17498const _hoisted_17 = { class: "hint ltr" }
17499const _hoisted_18 = ["href"]
17500const _hoisted_19 = {
17501  key: 3,
17502  class: "row aiGapActions"
17503}
17504const _hoisted_20 = ["disabled", "onClick"]
17505const _hoisted_21 = ["disabled", "onClick"]
17506const _hoisted_22 = {
17507  class: "hint",
17508  role: "status",
17509  "aria-live": "polite"
17510}
17511
17512return function render(_ctx, _cache) {
17513  with (_ctx) {
17514    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode, renderList: _renderList, Fragment: _Fragment, normalizeClass: _normalizeClass } = _Vue
17515
17516    return (_openBlock(), _createElementBlock("section", _hoisted_1, [
17517      _createElementVNode("div", _hoisted_2, [_cache[0] || (_cache[0] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "تواريخ المعارض"), _createElementVNode("h3", { id: "exDatesTitle" }, "العدّ التنازلي يحتاج تواريخ")], -1)), _createElementVNode("button", {
17518        class: "smallbtn",
17519        type: "button",
17520        disabled: state.busy||(run&&run.running),
17521        onClick: collect
17522      }, "اجمع التواريخ من المصادر", 8, _hoisted_3)]),
17523      _cache[2] || (_cache[2] = _createElementVNode("p", { class: "hint" }, "يقرأ النظام صفحة كل معرض الرسمية ويقترح تواريخ الدورة القادمة مع الاقتباس الذي ذكرها. لا شيء يظهر للزوار قبل اعتمادك.", -1)),
17524      summary
17525        ? (_openBlock(), _createElementBlock("p", _hoisted_4, [_createTextVNode(_toDisplayString(summary.published) + " عنصراً في المعارض · بتواريخ: " + _toDisplayString(summary.with_dates) + " · للمراجعة: " + _toDisplayString(summary.pending) + " · ليست معارض: " + _toDisplayString(summary.not_event) + " · بلا تواريخ في المصدر: " + _toDisplayString(summary.no_dates), 1), (run&&run.running)
17526            ? (_openBlock(), _createElementBlock("span", _hoisted_5, " · جارٍ الجمع " + _toDisplayString(run.done) + "/" + _toDisplayString(run.total) + "…", 1))
17527            : _createCommentVNode("", true)]))
17528        : _createCommentVNode("", true),
17529      _createElementVNode("div", _hoisted_6, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(STATUS_LABELS, (label, key) => {
17530        return (_openBlock(), _createElementBlock("button", {
17531          key: key,
17532          type: "button",
17533          class: _normalizeClass(['smallbtn',state.status===key?'':'secondary']),
17534          onClick: $event => (state.status=key)
17535        }, _toDisplayString(label), 11, _hoisted_7))
17536      }), 128))]),
17537      (state.error)
17538        ? (_openBlock(), _createElementBlock("p", _hoisted_8, _toDisplayString(state.error), 1))
17539        : (!rows.length&&!state.loading)
17540          ? (_openBlock(), _createElementBlock("p", _hoisted_9, "لا عناصر في هذه الحالة."))
17541          : _createCommentVNode("", true),
17542      (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(rows, (row) => {
17543        return (_openBlock(), _createElementBlock("article", {
17544          key: row.id,
17545          class: "aiGapCard"
17546        }, [
17547          _createElementVNode("div", _hoisted_10, [_createElementVNode("b", null, _toDisplayString(row.title_ar||row.title_en), 1), _createElementVNode("span", _hoisted_11, _toDisplayString(row.confidence?('ثقة '+row.confidence):STATUS_LABELS[row.status]), 1)]),
17548          (row.start_date)
17549            ? (_openBlock(), _createElementBlock("p", _hoisted_12, [
17550                _createElementVNode("b", null, _toDisplayString(row.start_date) + " → " + _toDisplayString(row.end_date), 1),
17551                _cache[1] || (_cache[1] = _createTextVNode()),
17552                (row.edition_label)
17553                  ? (_openBlock(), _createElementBlock("span", _hoisted_13, " · " + _toDisplayString(row.edition_label), 1))
17554                  : _createCommentVNode("", true),
17555                (row.venue)
17556                  ? (_openBlock(), _createElementBlock("span", _hoisted_14, " · " + _toDisplayString(row.venue), 1))
17557                  : _createCommentVNode("", true)
17558              ]))
17559            : _createCommentVNode("", true),
17560          (row.current_start)
17561            ? (_openBlock(), _createElementBlock("small", _hoisted_15, "الحالي في العنصر: " + _toDisplayString(row.
17561current_start) + " → " + _toDisplayString(row.current_end), 1))
17562            : _createCommentVNode("", true),
17563          (row.evidence_quote)
17564            ? (_openBlock(), _createElementBlock("blockquote", _hoisted_16, "«" + _toDisplayString(row.evidence_quote) + "»", 1))
17565            : _createCommentVNode("", true),
17566          _createElementVNode("small", _hoisted_17, [(row.source_url)
17567            ? (_openBlock(), _createElementBlock("a", {
17568                key: 0,
17569                href: row.source_url,
17570                target: "_blank",
17571                rel: "noopener noreferrer"
17572              }, "المصدر", 8, _hoisted_18))
17573            : _createCommentVNode("", true)]),
17574          (row.status==='pending')
17575            ? (_openBlock(), _createElementBlock("div", _hoisted_19, [_createElementVNode("button", {
17576                class: "smallbtn",
17577                type: "button",
17578                disabled: state.busy,
17579                onClick: $event => (decide(row,'approve'))
17580              }, "اعتماد", 8, _hoisted_20), _createElementVNode("button", {
17581                class: "smallbtn secondary",
17582                type: "button",
17583                disabled: state.busy,
17584                onClick: $event => (decide(row,'reject'))
17585              }, "رفض", 8, _hoisted_21)]))
17586            : _createCommentVNode("", true)
17587        ]))
17588      }), 128)),
17589      _createElementVNode("p", _hoisted_22, _toDisplayString(state.message), 1)
17590    ]))
17591  }
17592}
17593})()};
17594  const AdminAiResearchPage={
17595    components:{AdminFrame,AiAdminCenterNav,AiResearchSettingsPanel,AiKnowledgeGapsPanel,AiQualityPanel,ExhibitionDatesPanel},
17596    setup(){
17597      const store=useGzcStore();
17598      const router=useRouter();
17599      const route=useRoute();
17600      const requestedHub=String((route.query||{}).hub||'');
17601      const requestedStatus=String((route.query||{}).status||'pending');
17602      const technicalRoute=computed(()=>route.path==='/admin/ai-operations');
17603      const rawWorkspace=String((route.query||{}).workspace||(technicalRoute.value?'jobs':'review'));
17604      const requestedWorkspace=rawWorkspace==='suggestions'?'review':rawWorkspace;
17605      const targetSuggestion=String((route.query||{}).suggestion||'');
17606      const targetJob=String((route.query||{}).job||'');
17607      const selectedHub=ref(AI_RESEARCH_HUB_OPTIONS.some(item=>item.key===requestedHub)?requestedHub:'china_guide');
17608      const allowedWorkspaces=technicalRoute.value?['jobs','settings']:['review','freshness','growth','inventory'];
17609      const workspace=ref(allowedWorkspaces.includes(requestedWorkspace)?requestedWorkspace:(technicalRoute.value?'jobs':'review'));
17610      const pageTitle=computed(()=>technicalRoute.value?(workspace.value==='settings'?'مركز AI — الإعدادات':'مركز AI — تشغيل البحث'):'مركز AI — المراجعة');
17611      const suggestionStatus=ref(['pending','in_review','approved','rejected','all'].includes(requestedStatus)?requestedStatus:'pending');
17612      const decisionFilter=ref(['all','new','update','image','high_risk','excluded'].includes(String((route.query||{}).decision||''))?String((route.query||{}).decision):'all');
17613      const openSuggestionId=ref(targetSuggestion||'');
17614      const submittingSuggestionId=ref('');
17615      const categories=ref([]);
17616      const reviewEditFields=['category_id','service_type','direction','title_ar','summary_ar','description_ar','source_name','source_url','risk_level','admin_note'];
17617      const research=reactive({
17618        suggestions:[],jobs:[],
17619        stats:{total:0,pending:0,in_review:0,approved:0,rejected:0,high_risk:0,new_items:0,updates:0,dedup_conflicts:0,images_ready:0},
17620        inventory:{hub_key:'china_guide',digest:'',item_count:0,category_count:0,gap_count:0,thin_count:0,incomplete_count:0,demand_bucket_count:0,demand_total:0,coverage:[],gaps:[],thin:[],incomplete:[],demand:[],quality:[]},
17621        growth:{model_version:1,hub_key:'china_guide',total:0,summary:{urgent:0,high:0,medium:0,normal:0,demand_total:0,search_driven:0,coverage_driven:0},recommended:null,opportunities:[]},
17622        freshness:{model_version:1,hub_key:'china_guide',total:0,summary:{urgent:0,high:0,medium:0,normal:0,overdue:0,due_soon:0,unverified:0,source_missing:0,current:0},recommended:null,opportunities:[]},
17623        policy:{},settings:{},provider_state:{latest_failure:null},image_coverage:{hub_key:'china_guide',published:0,with_image:0,missing_image:0,weak_image:0,ai_generated:0,coverage_percent:100,missing_items:[]},image_metrics:{period_days:30,sources:[],failure_reasons:[]},
17624        readiness:{state:'untested',ready:false,max_age_hours:720,job:null},
17625        readiness_summary:{all_ready:false,ready_count:0,total:2,domains:{}},
17626        automation:{policy:{hub_key:'china_guide',auto_enabled:false,interval_hours:24,max_results:3,daily_run_limit:1,monthly_run_limit:30,failure_pause_threshold:3,consecutive_failures:0,paused_reason:'',paused_at:null},usage:{scheduled_today:0,standard_month:0,active_jobs:0,completed_month:0,failed_month:0,canary_month:0,input_tokens_month:0,output_tokens_month:0,total_tokens_month:0},decision:{ok:false,code:'domain_auto_disabled'}
17626,due:true,next_due_at:null,options:{interval_hours:[6,12,24,48,72,168],daily_run_limit:[1,2,3,4,6,12],monthly_run_limit:[4,8,12,20,30,60,90,120,200],failure_pause_threshold:[1,2,3,5]}}
17627      });
17628      const researchForm=reactive({query_text:'',category_id:''});
17629      const aiInput=ref('');
17630      const aiMode=ref('describe');
17631      const aiOutput=ref('');
17632      const searxngLoaded=ref(false),searxngEnabled=ref(false),searxngUrl=ref(''),searxngSource=ref(''),searxngActive=ref(false),searxngSaving=ref(false),searxngTesting=ref(false),searxngTest=ref(null);
17633      const amapSecret=ref(''),amapOtp=ref(''),amapStepUpReady=ref(false),amapSaving=ref(false);
17634      const searchKeyProvider=ref('serper'),searchKeySecret=ref(''),searchKeySaving=ref(false);
17635      const deepseekSecret=ref(''),deepseekSaving=ref(false),deepseekTesting=ref(false),deepseekTest=ref(null);
17636      let canaryPoll=null;
17637      let standardPoll=null;
17638      const currentHub=computed(()=>AI_RESEARCH_HUB_OPTIONS.find(x=>x.key===selectedHub.value)||AI_RESEARCH_HUB_OPTIONS[0]);
17639      const activeStandardJob=computed(()=>safeArray(research.jobs).find(j=>String(j.run_kind||'standard')!=='canary'&&['queued','processing'].includes(String(j.status||'')))||null);
17640      const latestStandardJob=computed(()=>activeStandardJob.value||safeArray(research.jobs).find(j=>String(j.run_kind||'standard')!=='canary')||null);
17641      const visibleSuggestions=computed(()=>{
17642        let rows=targetJob?research.suggestions.filter(s=>String(s.job_id||'')===targetJob):research.suggestions;
17643        const f=decisionFilter.value;
17644        if(f==='new')rows=rows.filter(s=>['pending','in_review'].includes(String(s.status||''))&&String(s.suggestion_kind||'')==='new_item'&&dedupStatus(s)!=='conflict');
17645        else if(f==='update')rows=rows.filter(s=>['pending','in_review'].includes(String(s.status||''))&&String(s.suggestion_kind||'')==='update_existing'&&dedupStatus(s)!=='conflict'&&String(s.image_status||'')!=='ready');
17646        else if(f==='image')rows=rows.filter(s=>['pending','in_review'].includes(String(s.status||''))&&String(s.image_status||'')==='ready'&&dedupStatus(s)!=='conflict');
17647        else if(f==='high_risk')rows=rows.filter(s=>['pending','in_review'].includes(String(s.status||''))&&String(s.risk_level||'')==='high'&&dedupStatus(s)!=='conflict');
17648        else if(f==='excluded')rows=rows.filter(s=>['pending','in_review'].includes(String(s.status||''))&&dedupStatus(s)==='conflict');
17649        return rows;
17650      });
17651      const canOperate=computed(()=>{
17652        const role=String(store.state.me&&store.state.me.admin&&store.state.me.admin.role||'');
17653        return ['it_admin','super_admin','system_admin'].includes(role);
17654      });
17655      function serviceOptions(){return AI_RESEARCH_SERVICE_OPTIONS[selectedHub.value]||AI_RESEARCH_SERVICE_OPTIONS.china_guide;}
17656      function modelOptions(current){return Array.from(new Set([String(current||''),'gpt-5.6-luna'].filter(Boolean)));}
17657      function researchStatusLabel(v){return ({pending:'جديد',in_review:'قيد المراجعة',approved:'معتمد ومنشور',rejected:'مرفوض',archived:'مؤرشف',queued:'في الطابور',processing:'يبحث الآن',completed:'مكتمل',failed:'فشل',cancelled:'ملغي'}[String(v||'')])||String(v||'-');}
17658      function researchRiskLabel(v){return ({low:'منخفض',standard:'عادي',high:'عالي المخاطر'}[String(v||'')])||String(v||'-');}
17659      function suggestionKindLabel(v){return String(v||'')==='update_existing'?'استكمال عنصر موجود':'إضافة جديدة';}
17660      function gapReasonLabel(v){return ({missing_category:'فئة فارغة',thin_category:'تغطية ضعيفة',missing_fields:'بيانات ناقصة',stale_information:'معلومة قديمة',official_source:'مصدر رسمي أفضل',correction:'تصحيح معلومة'}[String(v||'')])||'فجوة محتوى';}
17661      function growthPriorityLabel(v){return ({urgent:'عاجلة',high:'عالية',medium:'متوسطة',normal:'عادية'}[String(v||'')])||'عادية';}
17662      function growthKindLabel(v){return ({search_demand_gap:'طلب بلا نتائج',low_engagement:'نتائج تحتاج تحسين',empty_category:'فئة بلا محتوى',thin_category:'تغطية ضعيفة',local_coverage_gap:'فجوة محلية',incomplete_item:'عنصر يحتاج استكمال'}[String(v||'')])||'فرصة محتوى';}
17663      function growthEvidenceText(x){const e=x&&x.evidence||{};if(x&&x.kind==='search_demand_gap')return `${e.zero_result_count||0} بدون نتيجة${e.search_count?' من '+e.search_count+' بحث':''}`;if(x&&x.kind==='low_engagement')return `${e.result_open_count||0} فتح من ${e.search_count||0} بحث`;if(x&&x.kind==='local_coverage_gap')return `${e.item_count||0} نتيجة حالية`;
17663if(x&&['empty_category','thin_category'].includes(String(x.kind||'')))return `${e.item_count||0} عنصر حالياً`;if(x&&x.kind==='incomplete_item')return `${safeArray(e.missing_fields).length} حقل يحتاج استكمال`;return '';}
17664      function freshnessStateLabel(v){return ({overdue:'متأخر عن التحقق',due_soon:'يقترب موعد التحقق',unverified:'بدون تحقق موثق',source_missing:'المصدر يحتاج استكمال',stale:'قديم'}[String(v||'')])||'يحتاج مراجعة';}
17665      function freshnessEvidenceText(x){const e=x&&x.evidence||{};if(Number(e.overdue_days)>0)return `متأخر ${e.overdue_days} يوم · نافذة التحقق ${e.interval_days||'-'} يوم`;if(Number(e.days_until_due)>0)return `متبقي ${e.days_until_due} يوم · نافذة التحقق ${e.interval_days||'-'} يوم`;if(e.age_days!==null&&e.age_days!==undefined)return `آخر تحقق قبل ${e.age_days} يوم · نافذة التحقق ${e.interval_days||'-'} يوم`;return `نافذة التحقق ${e.interval_days||'-'} يوم`; }
17666      function missingFieldLabel(v){return ({title_en:'العنوان الإنجليزي',title_zh:'العنوان الصيني',summary_ar:'الملخص',description_ar:'الوصف',city:'المدينة',source_url:'المصدر',image:'الصورة'}[String(v||'')])||String(v||'');}
17667      function missingFieldsText(item){return safeArray(item&&item.missing_fields).map(missingFieldLabel).join('، ');}
17668      function readinessLabel(v){return ({untested:'لم يُختبر',running:'الاختبار يعمل',ready:'جاهز',failed:'فشل الاختبار',partial:'نتيجة غير مكتملة',stale:'انتهت صلاحية الاختبار',configuration_changed:'تغيّر إعداد الاتصال'}[String(v||'')])||'غير جاهز';}
17669      function readinessHelp(item){const state=String(item&&item.state||'untested');return ({untested:'شغّل اختباراً حياً مضبوطاً للتأكد من الاتصال والبحث وحفظ المصدر.',running:'يتم الآن تنفيذ طلب حي واحد. انتظر ظهور النتيجة.',ready:'نجح الاتصال والبحث بالمصدر، والنتيجة بقيت محجورة للمراجعة البشرية.',failed:'لم يكتمل الاختبار. راجع سبب الفشل في بطاقة المهمة ثم أعد المحاولة.',partial:'اكتمل اتصال المزود لكن لم تصل نتيجة موثقة كاملة؛ راجع المهمة وأعد الاختبار.',stale:'مرّ أكثر من 30 يوماً على آخر اختبار ناجح؛ أعد الاختبار قبل التشغيل التلقائي.',configuration_changed:'تغيّر المفتاح أو الموديل أو سياسة المصادر بعد آخر اختبار؛ شغّل اختباراً جديداً لهذا القسم.'}[state])||'شغّل اختبار الجاهزية قبل التشغيل التلقائي.';}
17670      function automationStatusLabel(v){return ({within_budget:'جاهز للتشغيل',research_disabled:'محرك البحث متوقف',global_auto_disabled:'المفتاح العام متوقف',api_not_configured:'API Key غير موجود',canary_readiness_required:'اختبار الجاهزية مطلوب',domain_auto_disabled:'جدول القسم متوقف',not_due:'بانتظار الموعد',policy_paused:'متوقف وقائياً',active_job:'مهمة تعمل الآن',daily_limit:'اكتمل حد اليوم',monthly_limit:'اكتمل سقف الشهر'}[String(v||'')])||'غير جاهز';}
17671      function pauseReasonLabel(v){return ({configuration_billing:'الرصيد أو حد الإنفاق',configuration_authentication:'مفتاح API مرفوض',configuration_authorization:'صلاحية المشروع',configuration_model:'الموديل غير متاح',configuration_request:'طلب المزود مرفوض',consecutive_failures:'إخفاقات متتالية'}[String(v||'')])||String(v||'سبب تشغيلي');}
17672      function formatTokens(v){const n=Math.max(0,Number(v)||0);return n>=1000000?(Math.round(n/100000)/10)+'M':n>=1000?(Math.round(n/100)/10)+'K':String(n);}
17673      function formatDuration(v){const ms=Number(v||0);return ms>0?(Math.round(ms/100)/10).toLocaleString('en-US')+' Ø«':'-';}
17674      function providerResearchStats(job,key){const u=job&&job.usage_json&&typeof job.usage_json==='object'?job.usage_json:{};const p=u.providers&&typeof u.providers==='object'?u.providers:{};return p&&p[key]&&typeof p[key]==='object'?p[key]:{};}
17675      function providerStatusLabel(p){return ({completed:'✓ شارك',failed:'تعذر',assist:'مساعد',skipped:'غير مستخدم'}[String(p&&p.status||'')])||'—';}
17676      // Job history keeps everything, but routine outcomes (readiness tests, old image-research tasks,
17677      // completed runs that produced nothing) are folded away by default so attention items stand out.
17678      const showAllJobs=ref(false);
17679      function jobIsRoutine(job){
17680        if(!job||String(job.status||'')!=='completed')return false;
17681        if(job.run_kind==='canary')return true;
17682        if(/^(item image suggestion|image coverage completion)/i.test(String(job.query_text||'').trim()))return true;
17683        const merge=job.usage_json&&job.usage_json.merge||{};
17684        return Number(job.result_count||0)===0&&!Number(merge.rejected_sources||0);
17685      }
17686      const visibleJobs=computed(()=>{const all=safeArray(research.jobs);return showAllJobs.value?all:all.filter(job=>!jobIsRoutine(job)||String(job.id)===targetJob);});
17687      const routineJobCount=computed(()=>safeArray(research.jobs).filter(jobIsRoutine).length);
17688      // Completed jobs may carry counters in error_text (e.g. rejected_sources:4); that is not a failure.
17689      function researchJobHasFailure(job){return !!(job&&job.error_text)&&String(job.status||'')!=='completed';}
17690      function researchNoticeText(job){
17691        const text=String(job&&job.error_text||'');const parts=[];
17692        for(const token of text.split(/[,;\s]+/).filter(Boolean)){
17693          const m=token.match(/^([a-z_]+):(\d+)$/);if(!m){parts.push(token);continue;}
17694          const n=Number(m[2]);
17695          parts.push(({rejected_sources:`رُفض ${n} مقترح لأن مصدره خارج النطاقات المسموحة أو ضمن المحظورة أو لم يُرجعه البحث`,rejected_city_scope:`رُفض ${n} مقترح خارج نطاق المدينة`,rejected_xai_policy:`رُفض ${n} مقترح من Grok لعدم مطابقة سياسة المصادر`,rejected_non_halal_restaurants:`رُفض ${n} مطعم بلا دليل حلال واضح`}[m[1]])||token);
17696        }
17697        return parts.join('، ');
17698      }
17699      function researchFailureLabel(job){const key=String(job&&job.failure_class||'unknown');return ({billing:'مشكلة رصيد أو حد إنفاق',authentication:'مشكلة في مفتاح OpenAI',authorization:'صلاحية المشروع غير كافية',rate_limit:'ضغط مؤقت على الطلبات',model:'الموديل غير متاح للمشروع',request:'إعداد طلب البحث مرفوض',timeout:'انتهت مهلة البحث',provider:'عطل مؤقت لدى المزود',validation:'النتيجة بلا مصادر صالحة',unknown:'فشل غير مصنف'}[key])||'فشل غير مصنف';}
17700      function researchFailureHelp(job){const key=String(job&&job.failure_class||'unknown');return ({billing:'تأكد أن API Key المحفوظ تابع لنفس المشروع الذي أضفت له الرصيد، ثم راجع Billing وLimits لذلك المشروع.',authentication:'أنشئ مفتاحاً جديداً داخل المشروع الصحيح ثم احفظه من إعدادات AI.',authorization:'راجع صلاحيات المفتاح وإتاحة Web Search والموديل داخل المشروع.',rate_limit:'انتظر قليلاً ثم أعد المحاولة؛ هذا الخطأ قابل للاسترداد.',model:'اختر موديل بحث متاحاً للمشروع أو راجع صلاحية الوصول.',request:'راجع إعدادات الموديل وWeb Search قبل إعادة المحاولة.',timeout:'أعد المحاولة؛ وإذا تكرر الخطأ راجع مهلة البحث واتصال الخادم.',provider:'أعد المحاولة لاحقاً لأن الخطأ مؤقت لدى المزود.',validation:'جرّب موضوعاً أوضح يعطي الأولوية للمصادر الرسمية.',unknown:'افتح التفاصيل التقنية وأرسل رمز الخطأ ومعرّف الطلب للمراجعة.'}[key])||'راجع التفاصيل التقنية قبل إعادة المحاولة.';}
17701      function suggestionSnapshot(s){return JSON.stringify(reviewEditFields.map(key=>[key,String((s&&s[key])??'')]));}
17702      function suggestionDirty(s){return String(s&&s.status||'')==='pending'&&String(s&&s._baseline||'')!==suggestionSnapshot(s);}
17703      function hydrateSuggestion(row){const s={...row,_useImage:String(row&&row.image_status||'')==='ready'&&!!row.image_url,_reviewChecks:{source_verified:false,content_verified:false,image_verified:false,publish_confirmed:false}};s._baseline=suggestionSnapshot(s);return s;}
17704      function imageStatusLabel(v){return ({pending:'بانتظار جلب الصورة',fetching:'يجري جلب الصورة',ready:'الصورة جاهزة للمراجعة',not_found:'لم يعثر المصدر على صورة مناسبة',failed:'تعذر تجهيز الصورة'}[String(v||'')])||'لا توجد صورة مقترحة';}
17705      function dedupStatus(s){
17706        if(suggestionDirty(s))return 'unchecked';
17707        if(String(s&&s.dedup_current_status||'')==='conflict')return 'conflict';
17708        if(String(s&&s.dedup_status||'')==='clear'&&!s.dedup_stale)return 'clear';
17709        return 'unchecked';
17710      }
17711      function dedupStatusLabel(s){return ({clear:'لا يوجد تكرار',conflict:'تعارض / تكرار',unchecked:'يحتاج فحصاً'}[dedupStatus(s)])||'يحتاج فحصاً';}
17712      function dedupReasonLabel(v){return ({generation_clear:'فحص الإنشاء سليم',target_update_clear:'استكمال العنصر المحدد دون نسخه',no_duplicate:'لا يوجد تطابق',same_target:'مقترح آخر يستهدف نفس العنصر',target_missing:'العنصر المستهدف لم يعد موجوداً',no_new_information:'لا توجد معلومة جديدة',inventory_duplicate:'تطابق مع عنصر منشور',review_queue_duplicate:'تطابق مع مقترح نشط',exact_contact:'بيانات اتصال متطابقة',exact_source:'المصدر نفسه',semantic_match:'تشابه قوي في المحتوى'}[String(v||'')])||'نتيجة الفحص الآلي';}
17713      function dedupMatchText(s){
17714        if(s&&s.dedup_current_match_item_id)return `العنصر #${s.dedup_current_match_item_id} — ${s.dedup_current_match_item_title||'محتوى منشور'}`;
17715        if(s&&s.dedup_current_match_suggestion_id)return `المقترح #${s.dedup_current_match_suggestion_id} — ${s.dedup_current_match_suggestion_title||'مقترح نشط'}`;
17716        return '';
17717      }
17718      function approvalChecksReady(s){const c=s&&s._reviewChecks||{};return c.source_verified===true&&c.content_verified===true&&c.publish_confirmed===true&&(!s._useImage||c.image_verified===true);}
17719      function canSubmitSuggestion(s){return String(s&&s.status||'')==='pending'&&!suggestionDirty(s)&&dedupStatus(s)==='clear';}
17720      function canApproveSuggestion(s){return String(s&&s.status||'')==='in_review'&&!s.review_content_changed&&dedupStatus(s)==='clear'&&approvalChecksReady(s)&&!(s.risk_level==='high'&&!canOperate.value);}
17721      function suggestionOpen(s){return String(openSuggestionId.value)===String(s&&s.id||'');}
17722      function toggleSuggestion(s){const id=String(s&&s.id||'');openSuggestionId.value=String(openSuggestionId.value)===id?'':id;}
17723      function suggestionReadiness(s){return {source:!!String(s&&s.source_url||'').trim(),image:String(s&&s.image_status||'')==='ready',dedup:dedupStatus(s)==='clear'};}
17724      function nextVisibleSuggestionId(excludeId){const row=visibleSuggestions.value.find(x=>String(x.id)!==String(excludeId||''));return row?String(row.id):'';}
17725      function applyResearch(rr){
17726        research.suggestions=safeArray(rr.suggestions).map(hydrateSuggestion);
17727        research.jobs=safeArray(rr.jobs);
17728        research.stats=rr.stats||{total:0,pending:0,in_review:0,approved:0,rejected:0,high_risk:0,new_items:0,updates:0,dedup_conflicts:0,images_ready:0};
17729        research.inventory=rr.inventory||{hub_key:selectedHub.value,digest:'',item_count:0,category_count:0,gap_count:0,thin_count:0,incomplete_count:0,demand_bucket_count:0,demand_total:0,coverage:[],gaps:[],thin:[],incomplete:[],demand:[],quality:[]};
17730        research.image_coverage=rr.image_coverage||{hub_key:selectedHub.value,published:0,with_image:0,missing_image:0,weak_image:0,ai_generated:0,coverage_percent:100,missing_items:[]};
17731        research.image_metrics=rr.image_metrics||{period_days:30,sources:[],failure_reasons:[]};
17732        research.growth=rr.growth||{model_version:1,hub_key:selectedHub.value,total:0,summary:{urgent:0,high:0,medium:0,normal:0,demand_total:0,search_driven:0,coverage_driven:0},recommended:null,opportunities:[]};
17733        research.freshness=rr.freshness||{model_version:1,hub_key:selectedHub.value,total:0,summary:{urgent:0,high:0,medium:0,normal:0,overdue:0,due_soon:0,unverified:0,source_missing:0,current:0},recommended:null,opportunities:[]};
17734        research.policy=rr.policy||{};
17735        const settings=rr.settings||{};
17736        for(const key of ['enabled','allow_translate','allow_describe','allow_tags','research_enabled','research_auto','research_live_access','secondary_research_enabled','image_assistant_enabled','image_search_enabled','image_generate_enabled'])settings[key]=settings[key]===true||String(settings[key])==='true';
17737        research.settings=settings;
17738        if(!searxngLoaded.value)loadSearxngSettings();
17739        research.provider_state=rr.provider_state||{latest_failure:null};
17740        research.readiness=rr.readiness||{state:'untested',ready:false,max_age_hours:720,job:null};
17741        research.readiness_summary=rr.readiness_summary||{all_ready:false,ready_count:0,total:2,domains:{}};
17742        research.automation=rr.automation||research.automation;
17743        if(research.automation&&research.automation.policy)research.automation.policy.auto_enabled=research.automation.policy.auto_enabled===true||String(research.automation.policy.auto_enabled)==='true';
17744      }
17745      async function load(){
17746        store.state.busy=true;
17747        const results=await Promise.all([
17748          api('/api/admin/ai-research?hub='+encodeURIComponent(selectedHub.value)+'&status='+encodeURIComponent(suggestionStatus.value)+(targetSuggestion?'&suggestion='+encodeURIComponent(target
17748Suggestion):'')),
17749          api('/api/china-guide/categories?hub='+encodeURIComponent(selectedHub.value))
17750        ]);
17751        const rr=results[0],content=results[1];
17752        if(rr.status===401){store.state.busy=false;router.replace('/admin/login');return;}
17753        applyResearch(rr);
17754        categories.value=safeArray(content.categories);
17755        if(openSuggestionId.value&&!visibleSuggestions.value.some(x=>String(x.id)===String(openSuggestionId.value)))openSuggestionId.value='';
17756        if(!openSuggestionId.value&&targetSuggestion&&visibleSuggestions.value.some(x=>String(x.id)===String(targetSuggestion)))openSuggestionId.value=String(targetSuggestion);
17757        store.state.busy=false;
17758        await nextTick();
17759        const target=targetSuggestion?document.querySelector('[data-task-id="ai-suggestion-'+targetSuggestion.replace(/[^0-9]/g,'')+'"]'):(workspace.value==='jobs'&&targetJob?document.querySelector('[data-task-id="ai-job-'+targetJob.replace(/[^0-9]/g,'')+'"]'):null);
17760        if(target)target.scrollIntoView({behavior:'smooth',block:'center'});
17761      }
17762      async function refreshResearch(){
17763        const rr=await api('/api/admin/ai-research?hub='+encodeURIComponent(selectedHub.value)+'&status='+encodeURIComponent(suggestionStatus.value));
17764        if(rr.status===401){router.replace('/admin/login');return false;}
17765        if(rr.ok)applyResearch(rr);
17766        return !!rr.ok;
17767      }
17768      function stopCanaryPoll(){if(canaryPoll){clearTimeout(canaryPoll);canaryPoll=null;}}
17769      function pollCanary(hub,attempt=0){
17770        stopCanaryPoll();
17771        if(hub!==selectedHub.value||attempt>=45)return;
17772        canaryPoll=setTimeout(async()=>{
17773          if(hub!==selectedHub.value)return;
17774          await refreshResearch();
17775          if(String(research.readiness.state)==='running')pollCanary(hub,attempt+1);
17776        },2000);
17777      }
17778      function stopStandardPoll(){if(standardPoll){clearTimeout(standardPoll);standardPoll=null;}}
17779      function hasActiveStandardJob(){return safeArray(research.jobs).some(job=>String(job.run_kind||'standard')!=='canary'&&['queued','processing'].includes(String(job.status||'')));}
17780      function pollStandard(hub,attempt=0){
17781        stopStandardPoll();
17782        if(hub!==selectedHub.value||attempt>=60)return;
17783        standardPoll=setTimeout(async()=>{
17784          if(hub!==selectedHub.value)return;
17785          await refreshResearch();
17786          if(hasActiveStandardJob())pollStandard(hub,attempt+1);
17787        },2000);
17788      }
17789      function selectHub(key){
17790        if(!AI_RESEARCH_HUB_OPTIONS.some(item=>item.key===key)||selectedHub.value===key)return;
17791        stopCanaryPoll();
17792        stopStandardPoll();
17793        selectedHub.value=key;
17794        researchForm.category_id='';
17795        router.replace({path:technicalRoute.value?'/admin/ai-operations':'/admin/ai-research',query:{hub:key,workspace:workspace.value}}).catch(()=>{});
17796        if(suggestionStatus.value!=='pending')suggestionStatus.value='pending';else load();
17797      }
17798
17799      async function selectDecisionFilter(key){
17800        if(!['all','new','update','image','high_risk','excluded'].includes(key))return;
17801        decisionFilter.value=key;
17802        if(key==='excluded')suggestionStatus.value='all';
17803        else if(!['pending','in_review','all'].includes(suggestionStatus.value))suggestionStatus.value='all';
17804        router.replace({path:technicalRoute.value?'/admin/ai-operations':'/admin/ai-research',query:{...route.query,hub:selectedHub.value,workspace:'review',decision:key,status:suggestionStatus.value}}).catch(()=>{});
17805        await load();
17806      }
17807      function decisionFilterLabel(){return ({all:'كل ما يحتاج قرارك',new:'إضافات جديدة',update:'استكمال معلومات',image:'مراجعة الصور',high_risk:'عالية المخاطر',excluded:'مستبعد تلقائياً'}[decisionFilter.value])||'كل ما يحتاج قرارك';}
17808      function selectWorkspace(key){
17809        if(!allowedWorkspaces.includes(key)||workspace.value===key)return;
17810        workspace.value=key;
17811        router.replace({path:technicalRoute.value?'/admin/ai-operations':'/admin/ai-research',query:{...route.query,hub:selectedHub.value,workspace:key}}).catch(()=>{});
17812      }
17813      async function runFreshnessOpportunity(x){
17814        if(!canOperate.value){store.state.msg='إعادة التحقق بالذكاء الاصطناعي متاحة للإدارة العليا فقط';return;}
17815        if(!x||!x.key)return;
17816        if(!confirm(`إعادة التحقق من: ${x.title||'المحتوى'}؟ سيبقى أي تحديث في صندوق المراجعة ولن يُنشر تلقائياً.`))return;
17817        store.state.busy=true;
17818        const r=await api('/api/admin/ai-research/freshness/run',{method:'POST',body:JSON.stringify({hub_key:selectedHub.value,opportunity_key:x.key})});
17819        store.state.busy=false;store.state.msg=r.message||r.error||'';
17820        if(r.ok){await load();pollStandard(selectedHub.value);}
17821      }
17822      async function runGrowthOpportunity(x){
17823        if(!canOperate.value){store.state.msg='تشغيل بحث فرص المحتوى متاح للإدارة العليا فقط';return;}
17824        if(!x||!x.key)return;
17825        if(!confirm(`تشغيل بحث AI لهذه الفرصة: ${x.title||'فرصة المحتوى'}؟ النتائج ستبقى في صندوق المراجعة ولن تُنشر تلقائياً.`))return;
17826        store.state.busy=true;
17827        const r=await api('/api/admin/ai-research/opportunities/run',{method:'POST',body:JSON.stringify({hub_key:selectedHub.value,opportunity_key:x.key})});
17828        store.state.busy=false;store.state.msg=r.message||r.error||'';
17829        if(r.ok){await load();pollStandard(selectedHub.value);}
17830      }
17831      async function runResearch(){
17832        if(!canOperate.value){store.state.msg='تشغيل البحث متاح للإدارة العليا فقط';return;}
17833        const hub=selectedHub.value;
17834        store.state.busy=true;
17835        const r=await api('/api/admin/ai-research/jobs',{method:'POST',body:JSON.stringify({hub_key:hub,category_id:researchForm.category_id||null,query_text:researchForm.query_text||''})});
17836        store.state.busy=false;store.state.msg=r.message||r.error||'';
17837        if(r.ok){researchForm.query_text='';workspace.value='jobs';await refreshResearch();pollStandard(hub);}
17838      }
17839      async function processResearch(){
17840        if(!canOperate.value){store.state.msg='تشغيل الطابور متاح للإدارة العليا فقط';return;}
17841        const hub=selectedHub.value;
17842        store.state.busy=true;const r=await api('/api/admin/ai-research/process',{method:'POST'});store.state.busy=false;store.state.msg=r.message||r.error||'';
17843        if(r.ok){await refreshResearch();pollStandard(hub);}
17844      }
17845      async function runCanary(){
17846        if(!canOperate.value){store.state.msg='اختبار الجاهزية متاح للإدارة العليا فقط';return;}
17847        if(!confirm('سيتم إرسال طلب بحث حي واحد مدفوع وإرجاع مقترح واحد فقط إلى صندوق المراجعة. هل تريد المتابعة؟'))return;
17848        const hub=selectedHub.value;
17849        store.state.busy=true;
17850        const r=await api('/api/admin/ai-research/canary',{method:'POST',body:JSON.stringify({hub_key:hub})});
17851        store.state.busy=false;store.state.msg=r.message||r.error||'';
17852        if(r.ok){workspace.value='jobs';await refreshResearch();pollCanary(hub);}
17853      }
17854      async function saveResearchSuggestion(s){
17855        if(String(s&&s.status||'')!=='pending'){store.state.msg='التعديل متاح في مرحلة المسودة فقط';return;}
17856        store.state.busy=true;const r=await api('/api/admin/ai-research/suggestions/'+encodeURIComponent(s.id)+'/update',{method:'POST',body:JSON.stringify(s)});store.state.busy=false;store.state.msg=r.message||r.error||'';
17857        if(r.ok)await load();
17858      }
17859      async function checkResearchDuplicate(s){
17860        if(suggestionDirty(s)){store.state.msg='احفظ تعديلات المسودة أولاً حتى يفحص النظام نفس المحتوى الظاهر أمامك';return;}
17861        store.state.busy=true;
17862        const r=await api('/api/admin/ai-research/suggestions/'+encodeURIComponent(s.id)+'/dedup-check',{method:'POST'});
17863        store.state.busy=false;store.state.msg=r.message||r.error||'';
17864        if(r.ok||r.report)await load();
17865      }
17866      async function saveAndCheckSuggestion(s){
17867        if(String(s&&s.status||'')!=='pending'){store.state.msg='الفحص متاح في مرحلة المسودة فقط';return;}
17868        store.state.busy=true;
17869        if(suggestionDirty(s)){
17870          const saved=await api('/api/admin/ai-research/suggestions/'+encodeURIComponent(s.id)+'/update',{method:'POST',body:JSON.stringify(s)});
17871          if(!saved.ok){store.state.busy=false;store.state.msg=saved.message||saved.error||'تعذر حفظ المسودة';return;}
17872        }
17873        const checked=await api('/api/admin/ai-research/suggestions/'+encodeURIComponent(s.id)+'/dedup-check',{method:'POST'});
17874        store.state.busy=false;store.state.msg=checked.message||checked.error||'';
17875        if(checked.ok||checked.report)await load();
17876      }
17877      async function refreshResearchImage(s){
17878        if(String(s&&s.status||'')!=='pending'){store.state.msg='إعادة جلب الصورة متاحة قبل إرسال المقترح للمراجعة';return;}
17879        store.state.busy=true;
17880        const r=await api('/api/admin/ai-research/suggestions/'+encodeURIComponent(s.id)+'/image/refresh',{method:'POST'});
17881        store.state.busy=false;store.state.msg=r.message||r.error||'';
17882        await load();
17883      }
17884      async function reviewResearchSuggestion(s,action){
17885        let note=s.admin_note||'';
17886        if(action==='reject'){note=prompt('سبب رفض المقترح:')||'';if(!note)return;}
17887        if(action==='return'){note=prompt('ما التعديل المطلوب قبل إعادة المراجعة؟')||'';if(!note)return;}
17888        if(action==='submit'){
17889          if(suggestionDirty(s)){store.state.msg='هناك تعديلات غير محفوظة؛ احفظ المسودة أولاً';return;}
17890          if(dedupStatus(s)!=='clear'){store.state.msg='نفّذ فحص التكرار أولاً حتى تحصل على شهادة سليمة';return;}
17891        }
17892        if(action==='approve'){
17893          if(!approvalChecksReady(s)){store.state.msg=s._useImage?'أكمل تحقق المصدر والمحتوى والصورة وتأكيد النشر':'أكمل تحقق المصدر والمحتوى وتأكيد النشر';return;}
17894          if(s.review_content_changed){store.state.msg='تغيّر المحتوى بعد الإرسال؛ أعده للمسودة ثم راجعه من جديد';return;}
17895          if(dedupStatus(s)!=='clear'){store.state.msg='شهادة منع التكرار تحتاج تحديثاً قبل الاعتماد';return;}
17896          const message=String(s.suggestion_kind||'')==='update_existing'
17897            ?`تأكيد نهائي: سيعيد النظام فحص الدليل والمقترحات، ثم يستكمل «${s.target_item_title||s.title_ar||'العنصر'}» داخل نفس المعاملة دون بطاقة جديدة. متابعة؟`
17898            :'تأكيد نهائي: سيعيد النظام فحص الدليل والمقترحات داخل نفس المعاملة، ولن ينشر إلا إذا بقيت النتيجة غير مكررة. متابعة؟';
17899          if(!confirm(message))return;
17900        }
17901        if(action==='archive'&&!confirm('أرشفة هذا السجل من صندوق المراجعة؟'))return;
17902        const checks=s._reviewChecks||{};
17903        const submittedId=String(s.id);const nextId=action==='submit'?nextVisibleSuggestionId(submittedId):'';
17904        submittingSuggestionId.value=action==='submit'?submittedId:'';store.state.busy=true;
17905        const r=await api('/api/admin/ai-research/suggestions/'+encodeURIComponent(s.id)+'/review',{method:'POST',body:JSON.stringify({action,note,
17906          source_verified:checks.source_verified===true,content_verified:checks.content_verified===true,use_suggested_image:s._useImage===true,
17907          image_verified:checks.image_verified===true,publish_confirmed:checks.publish_confirmed===true})});
17908        store.state.busy=false;submittingSuggestionId.value='';store.state.msg=r.message||r.error||'';
17909        if(r.ok){if(action==='submit')openSuggestionId.value=nextId;await load();}
17910      }
17911      async function retryResearchJob(job){if(!canOperate.value)return;const hub=selectedHub.value;store.state.busy=true;const r=await api('/api/admin/ai-research/jobs/'+encodeURIComponent(job.id)+'/retry',{method:'POST'});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok){await refreshResearch();pollStandard(hub);}}
17912      async function cancelResearchJob(job){if(!canOperate.value||!confirm('إلغاء مهمة البحث؟'))return;store.state.busy=true;const r=await api('/api/admin/ai-research/jobs/'+encodeURIComponent(job.id)+'/cancel',{method:'POST'});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok)await load();}
17913      async function saveAutomation(resume=false){
17914        if(!canOperate.value)return;
17915        const policy=research.automation&&research.automation.policy||{};
17916        if(resume&&!confirm('استئناف هذا النطاق سيصفر عداد الإخفاقات ويعيد تشغيل جدوله حسب الإعدادات الحالية. متابعة؟'))return;
17917        if(!resume&&policy.auto_enabled&&!confirm(`تفعيل جدول ${currentHub.value.short}: سيشغّل بحثاً مدفوعاً حسب الفاصل والسقف المحددين، لكن النشر سيبقى يدوياً. متابعة؟`))return;
17918        store.state.busy=true;
17919        const r=await api('/api/admin/ai-research/domain-policy',{method:'POST',body:JSON.stringify({hub_key:selectedHub.value,
17920          auto_enabled:policy.auto_enabled===true,interval_hours:Number(policy.interval_hours),max_results:Number(policy.max_results),
17921          daily_run_limit:Number(policy.daily_run_limit),monthly_run_limit:Number(policy.monthly_run_limit),
17922          failure_pause_threshold:Number(policy.failure_pause_threshold),resume:resume===true})});
17923        store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok)await load();
17924      }
17925      async function saveAi(){if(!canOperate.value)return;store.state.busy=true;const r=await api('/api/admin/china-guide/ai-settings',{method:'POST',body:JSON.stringify(research.settings||{})});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ai){const settings=r.ai;for(const key of ['enabled','allow_translate','allow_describe','allow_tags','research_enabled','research_auto','research_live_access','secondary_research_enabled','image_assistant_enabled','image_search_enabled','image_generate_enabled'])settings[key]=settings[key]===true||String(settings[key])==='true';research.settings=settings;}if(r.readiness_summary)research.readiness_summary=r.readiness_summary;if(r.ok)await load();}
17926      async function requestAmapStepUp(){const r=await api('/api/admin/security/step-up/request',{method:'POST',body:'{}'});store.state.msg=r.message||r.error||'';}
17927      async function verifyAmapStepUp(){const code=String(amapOtp.value||'').trim();if(!/^\d{6}$/.test(code)){store.state.msg='أدخل رمز OTP من 6 أرقام';return;}const r=await api('/api/admin/security/step-up/verify',{method:'POST',body:JSON.stringify({code})});store.state.msg=r.message||r.error||'';amapStepUpReady.value=!!r.ok;if(r.ok)amapOtp.value='';}
17928      function applySearxngSettings(value){const v=value||{};searxngEnabled.value=v.enabled===true;searxngUrl.value=String(v.base_url||'');searxngSource.value=String(v.source||'');searxngActive.value=v.active===true;}
17929      async function loadSearxngSettings(){const r=await api('/api/admin/route-search/searxng');if(!r||!r.ok){searxngLoaded.value=false;return;}applySearxngSettings(r.settings);searxngLoaded.value=true;}
17930      async function saveSearxngSettings(){if(searxngSaving.value)return;searxngSaving.value=true;const r=await api('/api/admin/route-search/searxng',{method:'POST',body:JSON.stringify({enabled:searxngEnabled.value,base_url:searxngUrl.value.trim()})});searxngSaving.value=false;store.state.msg=(r&&r.message)||'تعذر
17930 حفظ إعدادات SearXNG';if(r&&r.ok)applySearxngSettings(r.settings);}
17931      async function testSearxngConnection(){if(searxngTesting.value)return;searxngTesting.value=true;searxngTest.value=null;const r=await api('/api/admin/route-search/searxng/test',{method:'POST',body:JSON.stringify({base_url:searxngUrl.value.trim()})});searxngTesting.value=false;if(!r||!r.ok){searxngTest.value={ok:false,message:(r&&r.message)||'تعذر تنفيذ الاختبار'};return;}searxngTest.value=r.test;}
17932      async function saveAmapSecret(){const secret=String(amapSecret.value||'').trim();if(!amapStepUpReady.value){store.state.msg='أكد الهوية برمز OTP أولاً';return;}if(secret.length<8){store.state.msg='أدخل مفتاح Amap Web Service الصحيح';return;}amapSaving.value=true;const configured=!!research.settings.amap_api_key_configured;const path=configured?'/api/admin/security/secrets/'+encodeURIComponent('amap.api_key')+'/replace':'/api/admin/security/secrets';const body=configured?{secret}:{secret_key:'amap.api_key',secret};const r=await api(path,{method:'POST',body:JSON.stringify(body)});amapSaving.value=false;store.state.msg=r.ok?'تم حفظ مفتاح Amap بأمان':(r.message||r.code||r.error||'تعذر حفظ المفتاح');if(r.ok){amapSecret.value='';amapStepUpReady.value=false;await load();}}
17933      async function saveDeepseekSecret(){const secret=String(deepseekSecret.value||'').trim();if(!amapStepUpReady.value){store.state.msg='أكد الهوية برمز OTP أولاً';return;}if(secret.length<20){store.state.msg='أدخل مفتاح DeepSeek الصحيح';return;}deepseekSaving.value=true;const configured=!!research.settings.deepseek_api_key_configured;const path=configured?'/api/admin/security/secrets/'+encodeURIComponent('deepseek.api_key')+'/replace':'/api/admin/security/secrets';const body=configured?{secret}:{secret_key:'deepseek.api_key',secret};const r=await api(path,{method:'POST',body:JSON.stringify(body)});deepseekSaving.value=false;store.state.msg=r.ok?'تم حفظ مفتاح DeepSeek بأمان':(r.message||r.code||r.error||'تعذر حفظ المفتاح');if(r.ok){deepseekSecret.value='';amapStepUpReady.value=false;await load();}}
17934      async function saveSearchKey(){const secret=String(searchKeySecret.value||'').trim();if(!amapStepUpReady.value){store.state.msg='أكد الهوية برمز OTP أولاً';return;}if(secret.length<10){store.state.msg='أدخل مفتاح مزوّد البحث';return;}const name=searchKeyProvider.value+'.api_key';searchKeySaving.value=true;const configured=!!(research.settings.search_keys_configured&&research.settings.search_keys_configured[searchKeyProvider.value]);const path=configured?'/api/admin/security/secrets/'+encodeURIComponent(name)+'/replace':'/api/admin/security/secrets';const body=configured?{secret}:{secret_key:name,secret};const r=await api(path,{method:'POST',body:JSON.stringify(body)});searchKeySaving.value=false;store.state.msg=r.ok?'تم حفظ مفتاح البحث بأمان':(r.message||r.code||r.error||'تعذر حفظ المفتاح');if(r.ok){searchKeySecret.value='';amapStepUpReady.value=false;await load();}}
17935      async function testDeepseek(){if(deepseekTesting.value)return;deepseekTesting.value=true;deepseekTest.value=null;const r=await api('/api/admin/ai-research/deepseek/test',{method:'POST',body:'{}',feedback:false});deepseekTesting.value=false;deepseekTest.value=r&&typeof r==='object'?r:{ok:false,message:'تعذر تنفيذ الاختبار'};}
17936      async function generateAi(){if(!aiInput.value){store.state.msg='اكتب معلومات أولاً';return;}store.state.busy=true;const r=await api('/api/admin/china-guide/ai-draft',{method:'POST',body:JSON.stringify({input:aiInput.value,mode:aiMode.value})});store.state.busy=false;store.state.msg=r.message||r.error||'';aiOutput.value=r.output||'';}
17937      async function runImageCompletion(){
17938        if(!canOperate.value||store.state.busy)return;
17939        const missing=Number(research.image_coverage&&research.image_coverage.missing_image||0);
17940        if(!missing){store.state.msg='لا توجد عناصر منشورة بدون صور في هذا القسم';return;}
17941        const limit=Math.max(1,Math.min(20,Number(research.settings.image_batch_limit||5)||5));
17942        if(!confirm(`سيجهز النظام حتى ${limit} عناصر بدون صور للمراجعة. لن ينشر أي صورة تلقائياً. متابعة؟`))return;
17943        store.state.busy=true;
17944        const r=await api('/api/admin/ai-research/image-completion/run',{method:'POST',body:JSON.stringify({hub_key:selectedHub.value,limit})});
17945        store.state.busy=false;store.state.msg=r.message||r.error||'';
17946        if(r.ok){workspace.value='review';suggestionStatus.value='pending';await load();}
17947      }
17948      onMounted(async()=>
17948{if(await store.requireAdmin(router)){await load();if(hasActiveStandardJob())pollStandard(selectedHub.value);}});
17949      onUnmounted(()=>{stopCanaryPoll();stopStandardPoll();});
17950      watch(suggestionStatus,load);
17951      watch(()=>route.path,()=>{const allowed=technicalRoute.value?['jobs','settings']:['review','freshness','growth','inventory'];if(!allowed.includes(workspace.value))workspace.value=technicalRoute.value?'jobs':'review';});
17952      watch(()=>String((route.query||{}).workspace||''),(value)=>{const normalized=value==='suggestions'?'review':value;if(allowedWorkspaces.includes(normalized))workspace.value=normalized;});
17953      return {searchKeyProvider,searchKeySecret,searchKeySaving,saveSearchKey,deepseekSecret,deepseekSaving,deepseekTesting,deepseekTest,saveDeepseekSecret,testDeepseek,showAllJobs,visibleJobs,routineJobCount,researchJobHasFailure,researchNoticeText,searxngLoaded,searxngEnabled,searxngUrl,searxngSource,searxngActive,searxngSaving,searxngTesting,searxngTest,saveSearxngSettings,testSearxngConnection,store,selectedHub,workspace,suggestionStatus,decisionFilter,targetSuggestion,targetJob,visibleSuggestions,openSuggestionId,submittingSuggestionId,categories,research,researchForm,aiInput,aiMode,aiOutput,amapSecret,amapOtp,amapStepUpReady,amapSaving,currentHub,activeStandardJob,latestStandardJob,canOperate,technicalRoute,pageTitle,selectHub,selectWorkspace,selectDecisionFilter,decisionFilterLabel,serviceOptions,modelOptions,researchStatusLabel,researchRiskLabel,suggestionKindLabel,gapReasonLabel,growthPriorityLabel,growthKindLabel,growthEvidenceText,freshnessStateLabel,freshnessEvidenceText,missingFieldLabel,missingFieldsText,imageStatusLabel,safeImageErrorText,readinessLabel,readinessHelp,automationStatusLabel,pauseReasonLabel,formatTokens,formatDuration,providerResearchStats,providerStatusLabel,researchFailureLabel,researchFailureHelp,suggestionDirty,dedupStatus,dedupStatusLabel,dedupReasonLabel,dedupMatchText,approvalChecksReady,canSubmitSuggestion,canApproveSuggestion,suggestionOpen,toggleSuggestion,suggestionReadiness,load,runFreshnessOpportunity,runGrowthOpportunity,runResearch,processResearch,runCanary,saveResearchSuggestion,checkResearchDuplicate,saveAndCheckSuggestion,refreshResearchImage,reviewResearchSuggestion,retryResearchJob,cancelResearchJob,saveAutomation,saveAi,requestAmapStepUp,verifyAmapStepUp,saveAmapSecret,generateAi,runImageCompletion,shortDate,AI_RESEARCH_HUB_OPTIONS};
17954    },
17955    render:(function(){
17956const _Vue = Vue
17957const { createVNode: _createVNode, createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
17958
17959const _hoisted_1 = { class: "card aiCenterHero aiContentOpsHero" }
17960const _hoisted_2 = { class: "vueBadge" }
17961const _hoisted_3 = ["onClick"]
17962const _hoisted_4 = {
17963  class: "card aiHubSelector",
17964  "aria-label": "اختيار قسم البحث"
17965}
17966const _hoisted_5 = ["onClick"]
17967const _hoisted_6 = ["aria-label"]
17968const _hoisted_7 = ["onClick"]
17969const _hoisted_8 = { class: "aiCenterNavCopy" }
17970const _hoisted_9 = ["onClick"]
17971const _hoisted_10 = { class: "aiCenterNavCopy" }
17972const _hoisted_11 = ["onClick"]
17973const _hoisted_12 = { class: "aiCenterNavCopy" }
17974const _hoisted_13 = ["onClick"]
17975const _hoisted_14 = { class: "aiCenterNavCopy" }
17976const _hoisted_15 = ["onClick"]
17977const _hoisted_16 = ["onClick"]
17978const _hoisted_17 = {
17979  key: 0,
17980  class: "card aiGrowthPanel"
17981}
17982const _hoisted_18 = { class: "aiInventoryHead" }
17983const _hoisted_19 = { class: "statusPill" }
17984const _hoisted_20 = { class: "aiGrowthSummary" }
17985const _hoisted_21 = {
17986  key: 0,
17987  class: "aiGrowthList"
17988}
17989const _hoisted_22 = { class: "aiGrowthRank" }
17990const _hoisted_23 = { key: 0 }
17991const _hoisted_24 = { class: "aiGrowthBody" }
17992const _hoisted_25 = { class: "vueBadge" }
17993const _hoisted_26 = ["onClick"]
17994const _hoisted_27 = {
17995  key: 1,
17996  class: "hint"
17997}
17998const _hoisted_28 = {
17999  key: 1,
18000  class: "card aiGrowthPanel"
18001}
18002const _hoisted_29 = { class: "aiInventoryHead" }
18003const _hoisted_30 = { class: "statusPill" }
18004const _hoisted_31 = { class: "aiGrowthSummary" }
18005const _hoisted_32 = {
18006  key: 0,
18007  class: "aiGrowthList"
18008}
18009const _hoisted_33 = { class: "aiGrowthRank" }
18010const _hoisted_34 = { key: 0 }
18011const _hoisted_35 = { class: "aiGrowthBody" }
18012const _hoisted_36 = { class: "vueBadge" }
18013const _hoisted_37 = { key: 0 }
18014const _hoisted_38 = { class: "row" }
18015const _hoisted_39 = ["onClick"]
18016const _hoisted_40 = {
18017  key: 1,
18018  class: "hint"
18019}
18020const _hoisted_41 = {
18021  key: 2,
18022  class: "card aiInventoryPanel"
18023}
18024const _hoisted_42 = { class: "aiInventoryHead" }
18025const _hoisted_43 = { class: "aiInventoryMetrics" }
18026const _hoisted_44 = { class: "aiImageCoverageCard" }
18027const _hoisted_45 = { class: "hint" }
18028const _hoisted_46 = ["disabled", "onClick"]
18029const _hoisted_47 = {
18030  key: 0,
18031  class: "aiInventoryDetails"
18032}
18033const _hoisted_48 = { class: "aiIncompleteList" }
18034const _hoisted_49 = {
18035  key: 1,
18036  class: "hint"
18037}
18038const _hoisted_50 = { class: "aiInventoryDetails" }
18039const _hoisted_51 = { class: "aiCoverageGrid" }
18040const _hoisted_52 = {
18041  key: 0,
18042  class: "aiIncompleteList"
18043}
18044const _hoisted_53 = {
18045  key: 1,
18046  class: "aiIncompleteList"
18047}
18048const _hoisted_54 = {
18049  key: 2,
18050  class: "aiIncompleteList"
18051}
18052const _hoisted_55 = {
18053  key: 3,
18054  class: "aiDecisionWorkspace"
18055}
18056const _hoisted_56 = { class: "card aiDecisionNow" }
18057const _hoisted_57 = { class: "aiCenterMetrics aiContentOpsMetrics aiDecisionMetrics" }
18058const _hoisted_58 = ["onClick"]
18059const _hoisted_59 = ["onClick"]
18060const _hoisted_60 = ["onClick"]
18061const _hoisted_61 = ["onClick"]
18062const _hoisted_62 = { class: "card aiSystemHistory" }
18063const _hoisted_63 = ["onClick"]
18064const _hoisted_64 = {
18065  key: 4,
18066  class: "card errorCard aiProviderAlert",
18067  role: "alert"
18068}
18069const _hoisted_65 = {
18070  key: 5,
18071  class: "aiCenterPanel"
18072}
18073const _hoisted_66 = { class: "card aiSectionLead" }
18074const _hoisted_67 = { class: "vueBadge" }
18075const _hoisted_68 = { class: "hint" }
18076const _hoisted_69 = { class: "row" }
18077const _hoisted_70 = ["onClick"]
18078const _hoisted_71 = ["onClick"]
18079const _hoisted_72 = {
18080  key: 0,
18081  class: "card aiApprovalGuide aiApprovalGuideDisclosure"
18082}
18083const _hoisted_73 = { class: "segmented aiResearchFilters" }
18084const _hoisted_74 = ["onClick"]
18085const _hoisted_75 = ["onClick"]
18086const _hoisted_76 = ["onClick"]
18087const _hoisted_77 = ["onClick"]
18088const _hoisted_78 = ["onClick"]
18089const _hoisted_79 = {
18090  key: 1,
18091  class: "card aiQueuePurpose"
18092}
18093const _hoisted_80 = {
18094  key: 2,
18095  class: "card aiQueuePurpose"
18096}
18097const _hoisted_81 = {
18098  key: 3,
18099  class: "card aiQueuePurpose system"
18100}
18101const _hoisted_82 = {
18102  key: 4,
18103  class: "card emptyCard"
18104}
18105const _hoisted_83 = ["data-task-id"]
18106const _hoisted_84 = ["aria-expanded", "onClick"]
18107const _hoisted_85 = { class: "aiSuggestionNumber" }
18108const _hoisted_86 = { class: "aiQueueReadiness" }
18109const _hoisted_87 = { class: "aiSuggestionSummaryState" }
18110const _hoisted_88 = { class: "statusPill" }
18111const _hoisted_89 = { "aria-hidden": "true" }
18112const _hoisted_90 = {
18113  key: 0,
18114  class: "aiSuggestionBody"
18115}
18116const _hoisted_91 = { class: "aiSuggestionMeta" }
18117const _hoisted_92 = { class: "statusPill" }
18118const _hoisted_93 = {
18119  key: 0,
18120  class: "statusPill canaryPill"
18121}
18122const _hoisted_94 = { class: "statusPill" }
18123const _hoisted_95 = {
18124  key: 1,
18125  class: "statusPill dirtyPill"
18126}
18127const _hoisted_96 = { class: "formCard aiSuggestionEdit" }
18128const _hoisted_97 = {
18129  key: 0,
18130  class: "aiUpdateTarget"
18131}
18132const _hoisted_98 = {
18133  key: 1,
18134  class: "aiNewItemNotice"
18135}
18136const _hoisted_99 = {
18137  key: 2,
18138  class: "aiReviewLock"
18139}
18140const _hoisted_100 = { class: "formTwo" }
18141const _hoisted_101 = ["onUpdate:modelValue", "disabled"]
18142const _hoisted_102 = ["value"]
18143const _hoisted_103 = ["onUpdate:modelValue", "disabled"]
18144const _hoisted_104 = ["value"]
18145const _hoisted_105 = ["onUpdate:modelValue", "disabled"]
18146const _hoisted_106 = ["onUpdate:modelValue", "disabled"]
18147const _hoisted_107 = ["onUpdate:modelValue", "disabled"]
18148const _hoisted_108 = { class: "aiSourceReview" }
18149const _hoisted_109 = ["href"]
18150const _hoisted_110 = {
18151  key: 0,
18152  class: "aiSuggestionImagePreview"
18153}
18154const _hoisted_111 = ["src", "alt"]
18155const _hoisted_112 = { key: 0 }
18156const _hoisted_113 = { key: 1 }
18157const _hoisted_114 = { class: "aiSuggestionImageCopy" }
18158const _hoisted_115 = { "aria-hidden": "true" }
18159const _hoisted_116 = { key: 0 }
18160const _hoisted_117 = { key: 1 }
18161const _hoisted_118 = { key: 2 }
18162const _hoisted_119 = ["href"]
18163const _hoisted_120 = ["onClick"]
18164const _hoisted_121 = {
18165  key: 2,
18166  class: "checkLine"
18167}
18168const _hoisted_122 = ["onUpdate:modelValue"]
18169const _hoisted_123 = {
18170  key: 3,
18171  class: "aiImageReplaceNote"
18172}
18173const _hoisted_124 = { class: "aiEvidence" }
18174const _hoisted_125 = { class: "aiAdvancedReview" }
18175const _hoisted_126 = { class: "collapseBody" }
18176const _hoisted_127 = ["onUpdate:modelValue", "disabled"]
18177const _hoisted_128 = { class: "formTwo" }
18178const _hoisted_129 = ["onUpdate:modelValue", "disabled"]
18179const _hoisted_130 = ["onUpdate:modelValue", "disabled"]
18180const _hoisted_131 = ["onUpdate:modelValue", "disabled"]
18181const _hoisted_132 = { class: "aiDedupHead" }
18182const _hoisted_133 = {
18183  key: 0,
18184  class: "dangerText"
18185}
18186const _hoisted_134 = { key: 1 }
18187const _hoisted_135 = { class: "aiDedupCounts" }
18188const _hoisted_136 = ["onUpdate:modelValue", "disabled"]
18189const _hoisted_137 = {
18190  key: 4,
18191  class: "aiBoundaryNote"
18192}
18193const _hoisted_138 = {
18194  key: 5,
18195  class: "aiWorkflowError"
18196}
18197const _hoisted_139 = {
18198  key: 6,
18199  class: "aiDraftActions"
18200}
18201const _hoisted_140 = ["onClick"]
18202const _hoisted_141 = ["disabled", "onClick"]
18203const _hoisted_142 = ["onClick"]
18204const _hoisted_143 = {
18205  key: 7,
18206  class: "aiApprovalChecklist"
18207}
18208const _hoisted_144 = ["onUpdate:modelValue"]
18209const _hoisted_145 = ["onUpdate:modelValue"]
18210const _hoisted_146 = { key: 0 }
18211const _hoisted_147 = ["onUpdate:modelValue"]
18212const _hoisted_148 = ["onUpdate:modelValue"]
18213const _hoisted_149 = { class: "aiReviewActions" }
18214const _hoisted_150 = ["disabled", "onClick"]
18215const _hoisted_151 = ["onClick"]
18216const _hoisted_152 = ["onClick"]
18217const _hoisted_153 = {
18218  key: 8,
18219  class: "row"
18220}
18221const _hoisted_154 = ["href"]
18222const _hoisted_155 = ["onClick"]
18223const _hoisted_156 = {
18224  key: 6,
18225  class: "aiCenterPanel"
18226}
18227const _hoisted_157 = { class: "card aiSectionLead" }
18228const _hoisted_158 = { class: "vueBadge" }
18229const _hoisted_159 = ["onClick"]
18230const _hoisted_160 = { class: "aiRunOverviewHead" }
18231const _hoisted_161 = { class: "statusPill" }
18232const _hoisted_162 = { class: "aiRunOverviewMetrics" }
18233const _hoisted_163 = {
18234  key: 0,
18235  class: "aiJobFailure"
18236}
18237const _hoisted_164 = { class: "dangerText" }
18238const _hoisted_165 = {
18239  key: 1,
18240  class: "aiJobNotice"
18241}
18242const _hoisted_166 = {
18243  key: 2,
18244  class: "row"
18245}
18246const _hoisted_167 = {
18247  key: 4,
18248  class: "card formCard aiJobComposer aiFullSearchCard"
18249}
18250const _hoisted_168 = { class: "fieldLabel" }
18251const _hoisted_169 = ["onUpdate:modelValue"]
18252const _hoisted_170 = ["value"]
18253const _hoisted_171 = { class: "fieldLabel" }
18254const _hoisted_172 = ["onUpdate:modelValue"]
18255const _hoisted_173 = ["disabled", "onClick"]
18256const _hoisted_174 = {
18257  key: 5,
18258  class: "card aiBoundaryNote"
18259}
18260const _hoisted_175 = { class: "aiCanaryHead" }
18261const _hoisted_176 = { class: "statusPill" }
18262const _hoisted_177 = ["disabled", "onClick"]
18263const _hoisted_178 = {
18264  key: 0,
18265  class: "aiCanaryMetrics"
18266}
18267const _hoisted_179 = {
18268  key: 6,
18269  class: "card aiAdminDisclosure aiTechnicalTools"
18270}
18271const _hoisted_180 = { class: "aiDisclosureBody" }
18272const _hoisted_181 = ["onClick"]
18273const _hoisted_182 = ["open"]
18274const _hoisted_183 = {
18275  class: "aiJobFilter",
18276  role: "group",
18277  "aria-label": "تصفية سجل المهام"
18278}
18279const _hoisted_184 = ["onClick"]
18280const _hoisted_185 = ["onClick"]
18281const _hoisted_186 = { class: "aiJobTimeline aiDisclosureBody" }
18282const _hoisted_187 = ["data-task-id"]
18283const _hoisted_188 = { class: "memberCardTop" }
18284const _hoisted_189 = { class: "hint" }
18285const _hoisted_190 = { class: "aiJobCounts" }
18286const _hoisted_191 = {
18287  key: 0,
18288  class: "aiProviderBreakdown"
18289}
18290const _hoisted_192 = {
18291  key: 1,
18292  class: "aiJobFailure"
18293}
18294const _hoisted_193 = { class: "dangerText" }
18295const _hoisted_194 = { class: "dangerText" }
18296const _hoisted_195 = {
18297  key: 2,
18298  class: "aiJobNotice"
18299}
18300const _hoisted_196 = {
18301  key: 3,
18302  class: "row"
18303}
18304const _hoisted_197 = ["onClick"]
18305const _hoisted_198 = ["onClick"]
18306const _hoisted_199 = {
18307  key: 0,
18308  class: "hint"
18309}
18310const _hoisted_200 = {
18311  key: 7,
18312  class: "aiCenterPanel"
18313}
18314const _hoisted_201 = { class: "card aiSectionLead" }
18315const _hoisted_202 = { class: "statusPill" }
18316const _hoisted_203 = { class: "card aiConnectionSummary" }
18317const _hoisted_204 = { dir: "ltr" }
18318const _hoisted_205 = { class: "card aiReadinessSummary" }
18319const _hoisted_206 = { class: "aiReadinessDomains" }
18320const _hoisted_207 = { class: "aiAutomationHead" }
18321const _hoisted_208 = { class: "aiAutomationMetrics" }
18322const _hoisted_209 = {
18323  key: 0,
18324  class: "aiWorkflowError"
18325}
18326const _hoisted_210 = {
18327  key: 0,
18328  class: "card aiBoundaryNote"
18329}
18330const _hoisted_211 = { class: "card formCard aiSettingsForm" }
18331const _hoisted_212 = { class: "formTwo" }
18332const _hoisted_213 = ["onUpdate:modelValue"]
18333const _hoisted_214 = ["onUpdate:modelValue"]
18334const _hoisted_215 = ["value"]
18335const _hoisted_216 = ["onUpdate:modelValue"]
18336const _hoisted_217 = { class: "hint" }
18337const _hoisted_218 = { class: "formTwo" }
18338const _hoisted_219 = ["onUpdate:modelValue"]
18339const _hoisted_220 = ["onUpdate:modelValue"]
18340const _hoisted_221 = { class: "checkLine" }
18341const _hoisted_222 = ["onUpdate:modelValue"]
18342const _hoisted_223 = { class: "card formCard aiSettingsForm" }
18343const _hoisted_224 = { class: "aiAutomationHead" }
18344const _hoisted_225 = { class: "statusPill" }
18345const _hoisted_226 = { class: "checkLine" }
18346const _hoisted_227 = ["onUpdate:modelValue"]
18347const _hoisted_228 = { class: "formTwo" }
18348const _hoisted_229 = { class: "fieldLabel" }
18349const _hoisted_230 = ["onUpdate:modelValue"]
18350const _hoisted_231 = { class: "fieldLabel" }
18351const _hoisted_232 = ["onUpdate:modelValue"]
18352const _hoisted_233 = ["value"]
18353const _hoisted_234 = { class: "checkLine" }
18354const _hoisted_235 = ["onUpdate:modelValue"]
18355const _hoisted_236 = { class: "checkLine" }
18356const _hoisted_237 = ["onUpdate:modelValue"]
18357const _hoisted_238 = { class: "checkLine" }
18358const _hoisted_239 = ["onUpdate:modelValue"]
18359const _hoisted_240 = { class: "fieldLabel" }
18360const _hoisted_241 = ["onUpdate:modelValue"]
18361const _hoisted_242 = { class: "card formCard aiSettingsForm aiDeepseekCard" }
18362const _hoisted_243 = { class: "aiAutomationHead" }
18363const _hoisted_244 = { class: "statusPill" }
18364const _hoisted_245 = { class: "fieldLabel" }
18365const _hoisted_246 = ["onUpdate:modelValue"]
18366const _hoisted_247 = { class: "formTwo" }
18367const _hoisted_248 = ["onClick"]
18368const _hoisted_249 = { class: "fieldLabel" }
18369const _hoisted_250 = ["onUpdate:modelValue"]
18370const _hoisted_251 = { class: "row" }
18371const _hoisted_252 = ["onClick"]
18372const _hoisted_253 = ["disabled", "onClick"]
18373const _hoisted_254 = ["disabled", "onClick"]
18374const _hoisted_255 = {
18375  key: 0,
18376  class: "hint",
18377  role: "status"
18378}
18379const _hoisted_256 = { key: 0 }
18380const _hoisted_257 = { class: "formTwo" }
18381const _hoisted_258 = { class: "fieldLabel" }
18382const _hoisted_259 = ["onUpdate:modelValue"]
18383const _hoisted_260 = { value: "serper" }
18384const _hoisted_261 = { value: "brave" }
18385const _hoisted_262 = { value: "tavily" }
18386const _hoisted_263 = { value: "serpapi" }
18387const _hoisted_264 = { class: "fieldLabel" }
18388const _hoisted_265 = ["onUpdate:modelValue"]
18389const _hoisted_266 = { class: "formTwo" }
18390const _hoisted_267 = ["onClick"]
18391const _hoisted_268 = { class: "fieldLabel" }
18392const _hoisted_269 = ["onUpdate:modelValue"]
18393const _hoisted_270 = { class: "row" }
18394const _hoisted_271 = ["onClick"]
18395const _hoisted_272 = ["disabled", "onClick"]
18396const _hoisted_273 = {
18397  class: "hint",
18398  role: "status",
18399  "aria-live": "polite"
18400}
18401const _hoisted_274 = { class: "card formCard aiSettingsForm" }
18402const _hoisted_275 = { class: "aiAutomationHead" }
18403const _hoisted_276 = { class: "statusPill" }
18404const _hoisted_277 = { class: "fieldLabel" }
18405const _hoisted_278 = ["onUpdate:modelValue"]
18406const _hoisted_279 = { class: "formTwo" }
18407const _hoisted_280 = ["onClick"]
18408const _hoisted_281 = { class: "fieldLabel" }
18409const _hoisted_282 = ["onUpdate:modelValue"]
18410const _hoisted_283 = { class: "row" }
18411const _hoisted_284 = ["onClick"]
18412const _hoisted_285 = ["disabled", "onClick"]
18413const _hoisted_286 = {
18414  key: 1,
18415  class: "card formCard aiSettingsForm searxngSettingsCard"
18416}
18417const _hoisted_287 = { class: "aiAutomationHead" }
18418const _hoisted_288 = { class: "statusPill" }
18419const _hoisted_289 = { class: "fieldLabel" }
18420const _hoisted_290 = ["onUpdate:modelValue"]
18421const _hoisted_291 = { class: "checkLine" }
18422const _hoisted_292 = ["onUpdate:modelValue"]
18423const _hoisted_293 = { class: "row" }
18424const _hoisted_294 = ["disabled", "onClick"]
18425const _hoisted_295 = ["disabled", "onClick"]
18426const _hoisted_296 = { class: "card formCard aiSettingsForm" }
18427const _hoisted_297 = { class: "checkLine" }
18428const _hoisted_298 = ["onUpdate:modelValue"]
18429const _hoisted_299 = ["onUpdate:modelValue", "disabled"]
18430const _hoisted_300 = {
18431  key: 0,
18432  class: "hint"
18433}
18434const _hoisted_301 = { class: "checkLine" }
18435const _hoisted_302 = ["onUpdate:modelValue"]
18436const _hoisted_303 = { class: "formTwo" }
18437const _hoisted_304 = ["onUpdate:modelValue"]
18438const _hoisted_305 = ["value"]
18439const _hoisted_306 = ["onUpdate:modelValue"]
18440const _hoisted_307 = { class: "fieldLabel" }
18441const _hoisted_308 = ["onUpdate:modelValue"]
18442const _hoisted_309 = {
18443  key: 1,
18444  class: "aiDomainAlert",
18445  role: "alert"
18446}
18447const _hoisted_310 = { class: "fieldLabel" }
18448const _hoisted_311 = ["onUpdate:modelValue"]
18449const _hoisted_312 = ["onClick"]
18450const _hoisted_313 = { class: "card formCard aiSettingsForm aiDomainPolicyForm" }
18451const _hoisted_314 = { class: "aiAutomationHead" }
18452const _hoisted_315 = { class: "vueBadge" }
18453const _hoisted_316 = { class: "checkLine" }
18454const _hoisted_317 = ["onUpdate:modelValue", "disabled"]
18455const _hoisted_318 = { class: "formTwo" }
18456const _hoisted_319 = { class: "fieldLabel" }
18457const _hoisted_320 = ["onUpdate:modelValue"]
18458const _hoisted_321 = ["value"]
18459const _hoisted_322 = { class: "fieldLabel" }
18460const _hoisted_323 = ["onUpdate:modelValue"]
18461const _hoisted_324 = ["value"]
18462const _hoisted_325 = { class: "formTwo" }
18463const _hoisted_326 = { class: "fieldLabel" }
18464const _hoisted_327 = ["onUpdate:modelValue"]
18465const _hoisted_328 = ["value"]
18466const _hoisted_329 = { class: "fieldLabel" }
18467const _hoisted_330 = ["onUpdate:modelValue"]
18468const _hoisted_331 = ["value"]
18469const _hoisted_332 = { class: "fieldLabel" }
18470const _hoisted_333 = ["onUpdate:modelValue"]
18471const _hoisted_334 = ["value"]
18472const _hoisted_335 = { class: "row" }
18473const _hoisted_336 = ["onClick"]
18474const _hoisted_337 = ["onClick"]
18475const _hoisted_338 = { class: "card collapseSection aiDraftTool" }
18476const _hoisted_339 = { class: "collapseBody formCard" }
18477const _hoisted_340 = ["onUpdate:modelValue"]
18478const _hoisted_341 = ["onUpdate:modelValue"]
18479const _hoisted_342 = ["onClick"]
18480const _hoisted_343 = {
18481  key: 0,
18482  class: "auditPre"
18483}
18484
18485return function render(_ctx, _cache) {
18486  with (_ctx) {
18487    const { resolveComponent: _resolveComponent, createVNode: _createVNode, toDisplayString: _toDisplayString, createElementVNode: _createElementVNode, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, normalizeClass: _normalizeClass, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode, withCtx: _withCtx, createBlock: _createBlock, vModelSelect: _vModelSelect, withDirectives: _withDirectives, vModelText: _vModelText, vModelCheckbox: _vModelCheckbox } = _Vue
18488
18489    const _component_AiAdminCenterNav = _resolveComponent("AiAdminCenterNav")
18490    const _component_router_link = _resolveComponent("router-link")
18491    const _component_AiQualityPanel = _resolveComponent("AiQualityPanel")
18492    const _component_AiKnowledgeGapsPanel = _resolveComponent("AiKnowledgeGapsPanel")
18493    const _component_ExhibitionDatesPanel = _resolveComponent("ExhibitionDatesPanel")
18494    const _component_AiResearchSettingsPanel = _resolveComponent("AiResearchSettingsPanel")
18495    const _component_AdminFrame = _resolveComponent("AdminFrame")
18496
18497    return (_openBlock(), _createBlock(_component_AdminFrame, { title: pageTitle }, {
18498      default: _withCtx(() => [
18499        _createVNode(_component_AiAdminCenterNav),
18500        _createElementVNode("section", _hoisted_1, [_createElementVNode("div", null, [_createElementVNode("span", _hoisted_2, _toDisplayString(technicalRoute?(workspace==='settings'?'إعدادات محكومة':'تشغيل البحث'):'قرار بشري ومراجعة'), 1), _createElementVNode("h3", null, _toDisplayString(technicalRoute?(workspace==='settings'?'إعدادات AI':'تشغيل البحث بالذكاء الاصطناعي'):'مراجعة محتوى AI'), 1), _createElementVNode("p", null, _toDisplayString(technicalRoute?(workspace==='settings'?'إعدادات المزود والبحث والأتمتة. غيّرها فقط عند الحاجة وبعد اختبار مضبوط.':'أنشئ بحثاً كاملاً أو اختبر الجاهزية، ثم تابع الحالة والنتائج تلقائياً دون تحديث الصفحة. بحث المطاعم مقيّد بالمطاعم الحلال فقط.'):'راجع المقترحات والمصادر والتكرار ثم اعتمد أو ارفض. AI يقترح فقط ولا ينشر مباشرة.'), 1)]), _createElementVNode("button", {
18501          class: "smallbtn secondary",
18502          onClick: load
18503        }, "تحديث", 8, _hoisted_3)]),
18504        _createElementVNode("section", _hoisted_4, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(AI_RESEARCH_HUB_OPTIONS, (h) => {
18505          return (_openBlock(), _createElementBlock("button", {
18506            key: h.key,
18507            class: _normalizeClass({active:selectedHub===h.key}),
18508            onClick: $event => (selectHub(h.key))
18509          }, [_createElementVNode("span", null, _toDisplayString(h.icon), 1), _createElementVNode("b", null, _toDisplayString(h.short), 1), _createElementVNode("small", null, _toDisplayString(selectedHub===h.key?'القسم الحالي'
18509:'فتح المساحة'), 1)], 10, _hoisted_5))
18510        }), 128))]),
18511        _createElementVNode("nav", {
18512          class: "card aiCenterNav aiContentOpsNav",
18513          "aria-label": technicalRoute?'أقسام تشغيل AI':'أقسام إدارة محتوى AI'
18514        }, [(!technicalRoute)
18515          ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [
18516              _createElementVNode("button", {
18517                class: _normalizeClass({active:workspace==='review'}),
18518                onClick: $event => (selectWorkspace('review'))
18519              }, [_cache[1] || (_cache[1] = _createElementVNode("span", {
18520                class: "aiCenterNavIcon",
18521                "aria-hidden": "true"
18522              }, "✅", -1)), _createElementVNode("span", _hoisted_8, [_cache[0] || (_cache[0] = _createElementVNode("b", null, "المراجعة اليومية", -1)), _createElementVNode("small", null, _toDisplayString(research.stats.pending||0) + " جديد · " + _toDisplayString(research.stats.in_review||0) + " قيد المراجعة", 1)])], 10, _hoisted_7),
18523              _createElementVNode("button", {
18524                class: _normalizeClass({active:workspace==='freshness'}),
18525                onClick: $event => (selectWorkspace('freshness'))
18526              }, [_cache[3] || (_cache[3] = _createElementVNode("span", {
18527                class: "aiCenterNavIcon",
18528                "aria-hidden": "true"
18529              }, "🕒", -1)), _createElementVNode("span", _hoisted_10, [_cache[2] || (_cache[2] = _createElementVNode("b", null, "إعادة التحقق", -1)), _createElementVNode("small", null, _toDisplayString(research.freshness.total||0) + " عنصر يحتاج مراجعة", 1)])], 10, _hoisted_9),
18530              _createElementVNode("button", {
18531                class: _normalizeClass({active:workspace==='growth'}),
18532                onClick: $event => (selectWorkspace('growth'))
18533              }, [_cache[5] || (_cache[5] = _createElementVNode("span", {
18534                class: "aiCenterNavIcon",
18535                "aria-hidden": "true"
18536              }, "📈", -1)), _createElementVNode("span", _hoisted_12, [_cache[4] || (_cache[4] = _createElementVNode("b", null, "فرص المحتوى", -1)), _createElementVNode("small", null, _toDisplayString(research.growth.total||0) + " فرصة من الطلب والتغطية", 1)])], 10, _hoisted_11),
18537              _createElementVNode("button", {
18538                class: _normalizeClass({active:workspace==='inventory'}),
18539                onClick: $event => (selectWorkspace('inventory'))
18540              }, [_cache[7] || (_cache[7] = _createElementVNode("span", {
18541                class: "aiCenterNavIcon",
18542                "aria-hidden": "true"
18543              }, "🗂️", -1)), _createElementVNode("span", _hoisted_14, [_cache[6] || (_cache[6] = _createElementVNode("b", null, "تغطية الدليل", -1)), _createElementVNode("small", null, _toDisplayString(research.inventory.item_count||0) + " عنصر · " + _toDisplayString(research.inventory.incomplete_count||0) + " ناقص", 1)])], 10, _hoisted_13)
18544            ], 64))
18545          : (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [_createElementVNode("button", {
18546              class: _normalizeClass({active:workspace==='jobs'}),
18547              onClick: $event => (selectWorkspace('jobs'))
18548            }, _cache[8] || (_cache[8] = [_createElementVNode("span", {
18549              class: "aiCenterNavIcon",
18550              "aria-hidden": "true"
18551            }, "🔎", -1), _createElementVNode("span", { class: "aiCenterNavCopy" }, [_createElementVNode("b", null, "مهام البحث"), _createElementVNode("small", null, "بحث كامل · اختبار جاهزية")], -1)]), 10, _hoisted_15), _createElementVNode("button", {
18552              class: _normalizeClass({active:workspace==='settings'}),
18553              onClick: $event => (selectWorkspace('settings'))
18554            }, _cache[9] || (_cache[9] = [_createElementVNode("span", {
18555              class: "aiCenterNavIcon",
18556              "aria-hidden": "true"
18557            }, "⚙️", -1), _createElementVNode("span", { class: "aiCenterNavCopy" }, [_createElementVNode("b", null, "الإعدادات"), _createElementVNode("small", null, "المزود والسياسات والأتمتة")], -1)]), 10, _hoisted_16)], 64))], 8, _hoisted_6),
18558        (!technicalRoute&&workspace==='freshness')
18559          ? (_openBlock(), _createElementBlock("section", _hoisted_17, [_createElementVNode("div", _hoisted_18, [_cache[10] || (_cache[10] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "حداثة المحتوى"), _createElementVNode("h3", null, "محتوى يحتاج إعادة تحقق"), _createElementVNode("p", { class: "hint" }, "يرتب المحتوى المنشور حسب حساسية المعلومة وعمر آخر تحقق. المعلومات الطبية والمالية والإقامة والجمارك تُراجع أسرع من الأسواق والمطاعم والفنادق.")], -1)), _createElementVNode("span", _hoisted_19, _toDisplayString(research.freshness.total||0) + " للمراجعة", 1)]), _createElementVNode("div", _hoisted_20, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(research.freshness.summary&&research.freshness.summary.overdue||0), 1), _cache[11] || (_cache[11] = _createElementVNode("small", null, "متأخر عن الموعد", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(research.freshness.summary&&research.freshness.summary.unverified||0), 1), _cache[12] || (_cache[12] = _createElementVNode("small", null, "بدون تحقق موثق", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(research.freshness.summary&&research.freshness.summary.source_missing||0), 1), _cache[13] || (_cache[13] = _createElementVNode("small", null, "المصدر يحتاج استكمال", -1))])]), ((research.freshness.opportunities||[]).length)
18560              ? (_openBlock(), _createElementBlock("div", _hoisted_21, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(research.freshness.opportunities.slice(0,6), (x, j) => {
18561                  return (_openBlock(), _createElementBlock("article", {
18562                    key: x.key,
18563                    class: _normalizeClass(['aiGrowthOpportunity','priority-'+x.priority,{top:j===0}])
18564                  }, [_createElementVNode("div", _hoisted_22, [_createElementVNode("b", null, _toDisplayString(j+1), 1), (j===0)
18565                    ? (_openBlock(), _createElementBlock("small", _hoisted_23, "الأولوية الأولى"))
18566                    : _createCommentVNode("", true)]), _createElementVNode("div", _hoisted_24, [
18567                    _createElementVNode("div", null, [_createElementVNode("span", _hoisted_25, _toDisplayString(freshnessStateLabel(x.freshness_state)), 1), _createElementVNode("em", null, _toDisplayString(growthPriorityLabel(x.priority)), 1)]),
18568                    _createElementVNode("h4", null, _toDisplayString(x.title), 1),
18569                    _createElementVNode("p", null, _toDisplayString(x.reason), 1),
18570                    _createElementVNode("small", null, _toDisplayString(freshnessEvidenceText(x)), 1)
18571                  ]), (canOperate&&x.action==='research')
18572                    ? (_openBlock(), _createElementBlock("button", {
18573                        key: 0,
18574                        class: "smallbtn",
18575                        onClick: $event => (runFreshnessOpportunity(x))
18576                      }, "إعادة تحقق بالـAI", 8, _hoisted_26))
18577                    : _createCommentVNode("", true)], 2))
18578                }), 128))]))
18579              : (_openBlock(), _createElementBlock("p", _hoisted_27, "لا يوجد محتوى منشور يحتاج إعادة تحقق عاجلة الآن."))]))
18580          : _createCommentVNode("", true),
18581        (!technicalRoute&&workspace==='growth')
18582          ? (_openBlock(), _createElementBlock("section", _hoisted_28, [_createElementVNode("div", _hoisted_29, [_cache[14] || (_cache[14] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "طلب المستخدمين المجمّع"), _createElementVNode("h3", null, "فرص المحتوى الآن"), _createElementVNode("p", { class: "hint" }, "يرتب النظام ما يحتاجه الزوار فعلياً من نتائج البحث والتغطية الحالية. لا نحفظ عبارة البحث الخام أو هوية المستخدم، وAI لا ينشر مباشرة.")], -1)), _createElementVNode("span", _hoisted_30, _toDisplayString(research.growth.total||0) + " فرصة", 1)]), _createElementVNode("div", _hoisted_31, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(research.growth.summary&&research.growth.summary.demand_total||0), 1), _cache[15] || (_cache[15] = _createElementVNode("small", null, "محاولات بلا نتيجة / 30 يوم", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(research.growth.summary&&research.growth.summary.search_driven||0), 1), _cache[16] || (_cache[16] = _createElementVNode("small", null, "فرص من الطلب الفعلي", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(research.growth.summary&&research.growth.summary.coverage_driven||0), 1), _cache[17] || (_cache[17] = _createElementVNode("small", null, "فرص من نقص التغطية", -1))])]), ((research.growth.opportunities||[]).length)
18583              ? (_openBlock(), _createElementBlock("div", _hoisted_32, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(research.growth.opportunities.slice(0,6), (x, i) => {
18584                  return (_openBlock(), _createElementBlock("article", {
18585                    key: x.key,
18586                    class: _normalizeClass(['aiGrowthOpportunity','priority-'+x.priority,{top:i===0}])
18587                  }, [_createElementVNode("div", _hoisted_33, [_createElementVNode("b", null, _toDisplayString(i+1), 1), (i===0)
18588                    ? (_openBlock(), _createElementBlock("small", _hoisted_34, "الأولوية الأولى"))
18589                    : _createCommentVNode("", true)]), _createElementVNode("div", _hoisted_35, [
18590                    _createElementVNode("div", null, [_createElementVNode("span", _hoisted_36, _toDisplayString(growthKindLabel(x.kind)), 1), _createElementVNode("em", null, _toDisplayString(growthPriorityLabel(x.priority)), 1)]),
18591                    _createElementVNode("h4", null, _toDisplayString(x.title), 1),
18592                    _createElementVNode("p", null, _toDisplayString(x.reason), 1),
18593                    (growthEvidenceText(x))
18594                      ? (_openBlock(), _createElementBlock("small", _hoisted_37, _toDisplayString(growthEvidenceText(x)), 1))
18595                      : _createCommentVNode("", true)
18596                  ]), _createElementVNode("div", _hoisted_38, [(x.destination_path)
18597                    ? (_openBlock(), _createBlock(_component_router_link, {
18598                        key: 0,
18599                        class: "smallbtn secondary",
18600                        to: x.destination_path,
18601                        target: "_blank"
18602                      }, {
18603                        default: _withCtx(() => _cache[18] || (_cache[18] = [_createTextVNode("فتح الصفحة المستهدفة")])),
18604                        _: 2,
18605                        __: [18]
18606                      }, 1032, ["to"]))
18607                    : _createCommentVNode("", true), (canOperate&&x.action==='research')
18608                    ? (_openBlock(), _createElementBlock("button", {
18609                        key: 1,
18610                        class: "smallbtn",
18611                        onClick: $event => (runGrowthOpportunity(x))
18612                      }, "بحث AI لهذه الفرصة", 8, _hoisted_39))
18613                    : _createCommentVNode("", true)])], 2))
18614                }), 128))]))
18615              : (_openBlock(), _createElementBlock("p", _hoisted_40, "لا توجد فجوة طلب أو تغطية واضحة الآن. سيظل البحث التلقائي محافظاً ولن ينشئ محتوى لمجرد ملء الصفحة."))]))
18616          : _createCommentVNode("", true),
18617        (!technicalRoute&&workspace==='inventory')
18618          ? (_openBlock(), _createElementBlock("section", _hoisted_41, [
18619              _createElementVNode("div", _hoisted_42, [_createElementVNode("div", null, [_cache[19] || (_cache[19] = _createElementVNode("span", { class: "vueBadge" }, "جرد المحتوى قبل البحث", -1)), _createElementVNode("h3", null, _toDisplayString(currentHub.icon) + " تغطية " + _toDisplayString(currentHub.short), 1), _cache[20] || (_cache[20] = _createElementVNode("p", { class: "hint" }, "المحرك يقارن المقترحات بهذا الجرد الكامل ويمنع تكرار المحتوى المنشور أو المقترحات النشطة.", -1))]), _createElementVNode("span", { class: _normalizeClass(["statusPill", {canaryPill:Number(research.inventory.gap_count||0)===0}]) }, _toDisplayString(Number(research.inventory.gap_count||0)===0?'لا توجد فئات فارغة':research.inventory.gap_count+' فجوات'), 3)]),
18620              _createElementVNode("div", _hoisted_43, [
18621                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(research.inventory.item_count||0), 1), _cache[21] || (_cache[21] = _createElementVNode("small", null, "عناصر مقروءة", -1))]),
18622                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(research.inventory.category_count||0), 1), _cache[22] || (_cache[22] = _createElementVNode("small", null, "تصنيفات", -1))]),
18623                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(research.inventory.gap_count||0), 1), _cache[23] || (_cache[23] = _createElementVNode("small", null, "فئات فارغة", -1))]),
18624                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(research.inventory.thin_count||0), 1), _cache[24] || (_cache[24] = _createElementVNode("small", null, "تغطية ضعيفة", -1))]),
18625                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(research.inventory.incomplete_count||0), 1), _cache[25] || (_cache[25] = _createElementVNode("small", null, "عناصر ناقصة", -1))])
18626              ]),
18627              _createElementVNode("section", _hoisted_44, [_createElementVNode("div", null, [_cache[26] || (_cache[26] = _createElementVNode("span", { class: "vueBadge" }, "تغطية الصور", -1)), _createElementVNode("h4", null, _toDisplayString(research.image_coverage.coverage_percent||0) + "% من المحتوى المنشور لديه صورة", 1), _createElementVNode("p", _hoisted_45, _toDisplayString(research.image_coverage.missing_image||0) + " بدون صورة · " + _toDisplayString(research.image_coverage.weak_image||0) + " صورة ضعيفة · " + _toDisplayString(research.image_coverage.ai_generated||0) + " صورة مولدة ومعلّمة.", 1)]), canOperate
18628                ? (_openBlock(), _createElementBlock("button", {
18629                    key: 0,
18630                    class: "smallbtn",
18631                    disabled: !research.settings.image_assistant_enabled||!research.settings.xai_api_key_configured||!research.image_coverage.missing_image,
18632                    onClick: runImageCompletion
18633                  }, "استكمال دفعة صور", 8, _hoisted_46))
18634                : _createCommentVNode("", true)]),
18635              ((research.image_metrics.sources||[]).length)
18636                ? (_openBlock(), _createElementBlock("details", _hoisted_47, [_cache[28] || (_cache[28] = _createElementVNode("summary", null, "نجاح جلب الصور حسب المصدر خلال 30 يوماً", -1)), _createElementVNode("div", _hoisted_48, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(research.image_metrics.sources, (m) => {
18637                    return (_openBlock(), _createElementBlock("span", { key: 'image-source-'+m.source_domain }, [_createElementVNode("b", null, _toDisplayString(m.source_domain), 1), _createElementVNode("small", null, _toDisplayString(m.s
18637uccess_percent) + "% نجاح · " + _toDisplayString(m.ready) + " جاهزة · " + _toDisplayString(m.not_found) + " بلا صورة · " + _toDisplayString(m.failed) + " فشل", 1)]))
18638                  }), 128)), _cache[27] || (_cache[27] = _createElementVNode("h4", null, "أسباب التعثر", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(research.image_metrics.failure_reasons, (f) => {
18639                    return (_openBlock(), _createElementBlock("span", { key: 'image-failure-'+f.code }, [_createElementVNode("b", null, _toDisplayString(safeImageErrorText('', 'failed', {failure_code:f.code})), 1), _createElementVNode("small", null, _toDisplayString(f.total) + " مقترح", 1)]))
18640                  }), 128))])]))
18641                : _createCommentVNode("", true),
18642              (canOperate&&!research.settings.xai_api_key_configured)
18643                ? (_openBlock(), _createElementBlock("p", _hoisted_49, "أضف XAI_API_KEY على الخادم لتفعيل Grok للبحث عن الصور وتوليد الرسوم التوضيحية عند السماح بذلك."))
18644                : _createCommentVNode("", true),
18645              _createElementVNode("details", _hoisted_50, [
18646                _cache[32] || (_cache[32] = _createElementVNode("summary", null, "عرض خريطة التغطية والعناصر الناقصة", -1)),
18647                _createElementVNode("div", _hoisted_51, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(research.inventory.coverage||[], (c) => {
18648                  return (_openBlock(), _createElementBlock("span", {
18649                    key: 'coverage-'+c.id,
18650                    class: _normalizeClass({empty:Number(c.item_count||0)===0,thin:Number(c.item_count||0)===1})
18651                  }, [_createElementVNode("b", null, _toDisplayString(c.icon||'•') + " " + _toDisplayString(c.name_ar), 1), _createElementVNode("small", null, _toDisplayString(c.item_count||0) + " عنصر", 1)], 2))
18652                }), 128))]),
18653                ((research.inventory.incomplete||[]).length)
18654                  ? (_openBlock(), _createElementBlock("div", _hoisted_52, [_cache[29] || (_cache[29] = _createElementVNode("h4", null, "عناصر يمكن استكمالها", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(research.inventory.incomplete, (x) => {
18655                      return (_openBlock(), _createElementBlock("span", { key: 'incomplete-'+x.id }, [_createElementVNode("b", null, "#" + _toDisplayString(x.id) + " " + _toDisplayString(x.title_ar), 1), _createElementVNode("small", null, _toDisplayString(missingFieldsText(x)), 1)]))
18656                    }), 128))]))
18657                  : _createCommentVNode("", true),
18658                ((research.inventory.demand||[]).length)
18659                  ? (_openBlock(), _createElementBlock("div", _hoisted_53, [_cache[30] || (_cache[30] = _createElementVNode("h4", null, "فجوات طلب من البحث — بيانات مجمعة", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(research.inventory.demand, (x) => {
18660                      return (_openBlock(), _createElementBlock("span", { key: 'demand-'+x.intent_key+'-'+x.city_key+'-'+x.service_type }, [_createElementVNode("b", null, _toDisplayString(x.intent_key) + " " + _toDisplayString($cityLabel(x.city_key)||''), 1), _createElementVNode("small", null, _toDisplayString(x.zero_result_count) + " محاولة بدون نتيجة · لا توجد عبارة بحث خام محفوظة", 1)]))
18661                    }), 128))]))
18662                  : _createCommentVNode("", true),
18663                ((research.inventory.local_gaps||[]).length)
18664                  ? (_openBlock(), _createElementBlock("div", _hoisted_54, [_cache[31] || (_cache[31] = _createElementVNode("h4", null, "فجوات التغطية المحلية", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(research.inventory.local_gaps, (x) => {
18665                      return (_openBlock(), _createElementBlock("span", { key: 'local-gap-'+x.area_key+'-'+x.intent_key }, [_createElementVNode("b", null, _toDisplayString(x.intent_label_ar) + " · " + _toDisplayString(x.area_label_ar), 1), _createElementVNode("small", null, _toDisplayString($cityLabel(x.city_key)) + " · " + _toDisplayString(x.item_count) + " نتيجة حالية · AI يبحث بالعربي/الإنجليزي/الصيني", 1)]))
18666                    }), 128))]))
18667                  : _createCommentVNode("", true)
18668              ])
18669            ]))
18670          : _createCommentVNode("", true),
18671        (!technicalRoute&&workspace==='review')
18672          ? (_openBlock(), _createElementBlock("section", _hoisted_55, [_createElementVNode("div", _hoisted_56, [_createElementVNode("div", null, [_cache[33] || (_cache[33] = _createElementVNode("span", { class: "vueBadge" }, "يحتاج قرارك الآن", -1)), _createElementVNode("h3", null, _toDisplayString(Number(research.stats.actionable||0)) + " مهمة قابلة للتنفيذ", 1), _cache[34] || (_cache[34] = _createElementVNode("p", { class: "hint" }, "كل رقم أدناه يفتح نفس السجلات التي كوّنته. لا توجد عدادات ميتة.", -1))])]), _createElementVNode("div", _hoisted_57, [
18673              _createElementVNode("button", {
18674                type: "button",
18675                class: _normalizeClass(["aiDecisionMetric", {active:decisionFilter==='new'}]),
18676                onClick: $event => (selectDecisionFilter('new'))
18677              }, [
18678                _cache[35] || (_cache[35] = _createElementVNode("span", {
18679                  class: "metricMark",
18680                  "aria-hidden": "true"
18681                }, null, -1)),
18682                _createElementVNode("b", null, _toDisplayString(research.stats.new_items||0), 1),
18683                _cache[36] || (_cache[36] = _createElementVNode("small", null, "إضافات جديدة", -1)),
18684                _cache[37] || (_cache[37] = _createElementVNode("em", null, "فتح القائمة", -1))
18685              ], 10, _hoisted_58),
18686              _createElementVNode("button", {
18687                type: "button",
18688                class: _normalizeClass(["aiDecisionMetric", {active:decisionFilter==='update'}]),
18689                onClick: $event => (selectDecisionFilter('update'))
18690              }, [
18691                _cache[38] || (_cache[38] = _createElementVNode("span", {
18692                  class: "metricMark",
18693                  "aria-hidden": "true"
18694                }, null, -1)),
18695                _createElementVNode("b", null, _toDisplayString(research.stats.updates||0), 1),
18696                _cache[39] || (_cache[39] = _createElementVNode("small", null, "استكمال معلومات", -1)),
18697                _cache[40] || (_cache[40] = _createElementVNode("em", null, "عرض الحقول المقترحة", -1))
18698              ], 10, _hoisted_59),
18699              _createElementVNode("button", {
18700                type: "button",
18701                class: _normalizeClass(["aiDecisionMetric", {active:decisionFilter==='image'}]),
18702                onClick: $event => (selectDecisionFilter('image'))
18703              }, [
18704                _cache[41] || (_cache[41] = _createElementVNode("span", {
18705                  class: "metricMark",
18706                  "aria-hidden": "true"
18707                }, null, -1)),
18708                _createElementVNode("b", null, _toDisplayString(research.stats.images_ready||0), 1),
18709                _cache[42] || (_cache[42] = _createElementVNode("small", null, "صور جاهزة", -1)),
18710                _cache[43] || (_cache[43] = _createElementVNode("em", null, "مراجعة الصور", -1))
18711              ], 10, _hoisted_60),
18712              _createElementVNode("button", {
18713                type: "button",
18714                class: _normalizeClass(["aiDecisionMetric", {active:decisionFilter==='high_risk',alert:Number(research.stats.high_risk||0)>0}]),
18715                onClick: $event => (selectDecisionFilter('high_risk'))
18716              }, [
18717                _cache[44] || (_cache[44] = _createElementVNode("span", {
18718                  class: "metricMark",
18719                  "aria-hidden": "true"
18720                }, null, -1)),
18721                _createElementVNode("b", null, _toDisplayString(research.stats.high_risk||0), 1),
18722                _cache[45] || (_cache[45] = _createElementVNode("small", null, "عالية المخاطر", -1)),
18723                _cache[46] || (_cache[46] = _createElementVNode("em", null, "تحتاج انتباهاً", -1))
18724              ], 10, _hoisted_61)
18725            ]), _createElementVNode("div", _hoisted_62, [_cache[48] || (_cache[48] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "سجل النظام"), _createElementVNode("h4", null, "نتائج لا تحتاج إجراءً يومياً")], -1)), _createElementVNode("button", {
18726              type: "button",
18727              class: "smallbtn secondary",
18728              onClick: $event => (selectDecisionFilter('excluded'))
18729            }, "مستبعد تلقائياً كمكرر: " + _toDisplayString(research.stats.dedup_conflicts||0), 9, _hoisted_63), _createElementVNode("span", null, [_cache[47] || (_cache[47] = _createTextVNode("تم اعتمادها سابقاً: ")), _createElementVNode("b", null, _toDisplayString(research.stats.approved||0), 1)])])]))
18730          : _createCommentVNode("", true),
18731        (research.provider_state&&research.provider_state.latest_failure)
18732          ? (_openBlock(), _createElementBlock("section", _hoisted_64, [_createElementVNode("h4", null, _toDisplayString(researchFailureLabel(research.provider_state.latest_failure)), 1), _createElementVNode("p", null, _toDisplayString(researchFailureHelp(research.provider_state.latest_failure)), 1), _createElementVNode("small", null, "المهمة " + _toDisplayString(research.provider_state.latest_failure.job_id) + " · HTTP " + _toDisplayString(research.provider_state.latest_failure.http_status||'-') + " · الرمز " + _toDisplayString(research.provider_state.latest_failure.error_code||'-') + " · معرّف الطلب " + _toDisplayString(research.provider_state.latest_failure.request_id||'-'), 1)]))
18733          : _createCommentVNode("", true),
18734        (workspace==='review')
18735          ? (_openBlock(), _createElementBlock("section", _hoisted_65, [
18736              _createElementVNode("div", _hoisted_66, [_createElementVNode("div", null, [_createElementVNode("span", _hoisted_67, _toDisplayString(currentHub.icon) + " " + _toDisplayString(currentHub.label), 1), _createElementVNode("h3", null, _toDisplayString(decisionFilterLabel()), 1), _createElementVNode("small", _hoisted_68, "مراجعة مقترحات AI · " + _toDisplayString(visibleSuggestions.length) + " سجل · افتح عنصراً واحداً، راجع المصدر والتكرار، ثم اتخذ القرار وانتقل للتالي.", 1)]), _createElementVNode("div", _hoisted_69, [(decisionFilter!=='all')
18737                ? (_openBlock(), _createElementBlock("button", {
18738                    key: 0,
18739                    class: "smallbtn secondary",
18740                    onClick: $event => (selectDecisionFilter('all'))
18741                  }, "كل المهام", 8, _hoisted_70))
18742                : _createCommentVNode("", true), _createElementVNode("button", {
18743                class: "smallbtn secondary",
18744                onClick: $event => ($router.push(currentHub.adminPath))
18745              }, "إدارة المحتوى المنشور", 8, _hoisted_71)])]),
18746              (decisionFilter==='all')
18747                ? (_openBlock(), _createElementBlock("details", _hoisted_72, _cache[49] || (_cache[49] = [_createElementVNode("summary", null, [_createElementVNode("b", null, "طريقة الاعتماد الصحيحة"), _createElementVNode("span", null, "عرض الخطوات")], -1), _createElementVNode("div", { class: "aiApprovalGuideBody" }, [_createElementVNode("div", { class: "aiApprovalGuideHead" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "طريقة الاعتماد الصحيحة"), _createElementVNode("h3", null, "أربع مراحل واضحة من الاقتراح إلى النشر")]), _createElementVNode("span", { class: "statusPill canaryPill" }, "نشر بشري فقط")]), _createElementVNode("ol", { class: "aiApprovalSteps" }, [
18748                    _createElementVNode("li", null, [_createElementVNode("b", null, "شاهد الاقتراح والصورة"), _createElementVNode("small", null, "افتح المصدر وراجع المعلومة والصورة المقترحة بجانبها.")]),
18749                    _createElementVNode("li", null, [_createElementVNode("b", null, "احفظ وافحص التكرار"), _createElementVNode("small", null, "زر واحد يحفظ أي تعديل ثم يقارن بكل المحتوى النشط.")]),
18750                    _createElementVNode("li", null, [_createElementVNode("b", null, "أرسل للمراجعة"), _createElementVNode("small", null, "يُقفل المحتوى والصورة وتُحفظ بصمة ما تمت مراجعته.")]),
18751                    _createElementVNode("li", null, [_createElementVNode("b", null, "اعتمد وانشر"), _createElementVNode("small", null, "تحقق من المصدر والمحتوى والصورة، ثم يÙ
18751†ÙØ° النظام فحصاً نهائياً وينشر.")])
18752                  ]), _createElementVNode("p", { class: "aiApprovalGuarantee" }, [_createElementVNode("b", null, "ضمان المنع:"), _createTextVNode(" إن ظهر تطابق مع عنصر منشور أو مقترح نشط، يتوقف الاعتماد ويعرض النظام السجل المتعارض. استكمال عنصر موجود يحدّث نفس البطاقة ولا ينشئ نسخة جديدة.")])], -1)])))
18753                : _createCommentVNode("", true),
18754              _createElementVNode("div", _hoisted_73, [
18755                _createElementVNode("button", {
18756                  class: _normalizeClass({active:suggestionStatus==='pending'}),
18757                  onClick: $event => (suggestionStatus='pending')
18758                }, "الجديدة", 10, _hoisted_74),
18759                _createElementVNode("button", {
18760                  class: _normalizeClass({active:suggestionStatus==='in_review'}),
18761                  onClick: $event => (suggestionStatus='in_review')
18762                }, "المراجعة", 10, _hoisted_75),
18763                _createElementVNode("button", {
18764                  class: _normalizeClass({active:suggestionStatus==='approved'}),
18765                  onClick: $event => (suggestionStatus='approved')
18766                }, "المعتمدة", 10, _hoisted_76),
18767                _createElementVNode("button", {
18768                  class: _normalizeClass({active:suggestionStatus==='rejected'}),
18769                  onClick: $event => (suggestionStatus='rejected')
18770                }, "المرفوضة", 10, _hoisted_77),
18771                _createElementVNode("button", {
18772                  class: _normalizeClass({active:suggestionStatus==='all'}),
18773                  onClick: $event => (suggestionStatus='all')
18774                }, "الكل", 10, _hoisted_78)
18775              ]),
18776              (decisionFilter==='image')
18777                ? (_openBlock(), _createElementBlock("div", _hoisted_79, _cache[50] || (_cache[50] = [_createElementVNode("b", null, "مراجعة الصور", -1), _createElementVNode("span", null, "اعرض الصورة والمصدر ثم اعتمد الصورة فقط، أو ارفضها، أو اطلب صورة أخرى. اعتماد الصورة لا يعيد توثيق النص.", -1)])))
18778                : (decisionFilter==='update')
18779                  ? (_openBlock(), _createElementBlock("div", _hoisted_80, _cache[51] || (_cache[51] = [_createElementVNode("b", null, "استكمال معلومات", -1), _createElementVNode("span", null, "هذه القائمة مخصصة للعناصر الموجودة. راجع فقط المعلومة الجديدة أو الناقصة قبل استكمال نفس العنصر.", -1)])))
18780                  : (decisionFilter==='excluded')
18781                    ? (_openBlock(), _createElementBlock("div", _hoisted_81, _cache[52] || (_cache[52] = [_createElementVNode("b", null, "مستبعد تلقائياً", -1), _createElementVNode("span", null, "هذه السجلات تعرض للتدقيق فقط لأنها متعارضة أو مكررة. لا تُعامل كمهام اعتماد يومية.", -1)])))
18782                    : _createCommentVNode("", true),
18783              (!visibleSuggestions.length&&!store.state.busy)
18784                ? (_openBlock(), _createElementBlock("div", _hoisted_82, "لا توجد سجلات في «" + _toDisplayString(decisionFilterLabel()) + "» حالياً.", 1))
18785                : _createCommentVNode("", true),
18786              (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(visibleSuggestions, (s) => {
18787                return (_openBlock(), _createElementBlock("article", {
18788                  class: _normalizeClass(["aiSuggestionCard aiReviewCard aiSuggestionDisclosure", ['risk-'+s.risk_level,'dedup-'+dedupStatus(s),{'taskTarget':String(s.id)===targetSuggestion,'is-open':suggestionOpen(s)}]]),
18789                  "data-task-id": 'ai-suggestion-'+s.id,
18790                  key: 'air'+s.id
18791                }, [_createElementVNode("button", {
18792                  type: "button",
18793                  class: "aiSuggestionSummary",
18794                  "aria-expanded": suggestionOpen(s)?'true':'false',
18795                  onClick: $event => (toggleSuggestion(s))
18796                }, [_createElementVNode("div", null, [
18797                  _createElementVNode("span", _hoisted_85, "#" + _toDisplayString(s.id), 1),
18798                  _createElementVNode("b", null, _toDisplayString(s.title_ar||'مقترح بلا عنوان'), 1),
18799                  _createElementVNode("small", null, _toDisplayString(s.category_name_ar||'لم يحدد التصنيف') + " · " + _toDisplayString(suggestionKindLabel(s.suggestion_kind)), 1),
18800                  _createElementVNode("span", _hoisted_86, [_createElementVNode("em", { class: _normalizeClass({ready:suggestionReadiness(s).source}) }, "مصدر " + _toDisplayString(suggestionReadiness(s).source?'✓':'–'), 3), _createElementVNode("em", { class: _normalizeClass({ready:suggestionReadiness(s).image}) }, "صورة " + _toDisplayString(suggestionReadiness(s).image?'✓':'–'), 3), _createElementVNode("em", { class: _normalizeClass({ready:suggestionReadiness(s).dedup}) }, "تكرار " + _toDisplayString(suggestionReadiness(s).dedup?'✓':'!'), 3)])
18801                ]), _createElementVNode("div", _hoisted_87, [_createElementVNode("span", _hoisted_88, _toDisplayString(researchStatusLabel(s.status)), 1), _createElementVNode("span", { class: _normalizeClass(["statusPill", {'canaryPill':dedupStatus(s)==='clear','danger':dedupStatus(s)==='conflict'}]) }, _toDisplayString(dedupStatusLabel(s)), 3), _createElementVNode("span", _hoisted_89, _toDisplayString(suggestionOpen(s)?'⌃':'⌄'), 1)])], 8, _hoisted_84), (suggestionOpen(s))
18802                  ? (_openBlock(), _createElementBlock("div", _hoisted_90, [_createElementVNode("div", _hoisted_91, [
18803                      _createElementVNode("span", { class: _normalizeClass(["statusPill", {updatePill:s.suggestion_kind==='update_existing',newPill:s.suggestion_kind!=='update_existing'}]) }, _toDisplayString(suggestionKindLabel(s.suggestion_kind)), 3),
18804                      _createElementVNode("span", _hoisted_92, _toDisplayString(gapReasonLabel(s.gap_reason)), 1),
18805                      (s.job_run_kind==='canary')
18806                        ? (_openBlock(), _createElementBlock("span", _hoisted_93, "اختبار حي"))
18807                        : _createCommentVNode("", true),
18808                      _createElementVNode("span", _hoisted_94, "ثقة " + _toDisplayString(s.confidence) + "%", 1),
18809                      _createElementVNode("span", { class: _normalizeClass(["statusPill", {danger:s.risk_level==='high'}]) }, _toDisplayString(researchRiskLabel(s.risk_level)), 3),
18810                      (suggestionDirty(s))
18811                        ? (_openBlock(), _createElementBlock("span", _hoisted_95, "تعديلات غير محفوظة"))
18812                        : _createCommentVNode("", true)
18813                    ]), _createElementVNode("div", _hoisted_96, [
18814                      (s.suggestion_kind==='update_existing')
18815                        ? (_openBlock(), _createElementBlock("div", _hoisted_97, [_cache[54] || (_cache[54] = _createElementVNode("span", {
18816                            class: "metricMark",
18817                            "aria-hidden": "true"
18818                          }, null, -1)), _createElementVNode("div", null, [_createElementVNode("b", null, "سيُستكمل العنصر الموجود #" + _toDisplayString(s.target_item_id), 1), _createElementVNode("p", null, _toDisplayString(s.target_item_title||'عنصر قائم في الدليل'), 1), _cache[53] || (_cache[53] = _createElementVNode("small", null, "لن ينشئ الاعتماد بطاقة جديدة؛ ستُملأ البيانات الناقصة أو يُØ
18818·Ø¨Ù‘Ù‚ التصحيح الموثق على نفس العنصر.", -1))])]))
18819                        : (_openBlock(), _createElementBlock("div", _hoisted_98, _cache[55] || (_cache[55] = [_createElementVNode("span", {
18820                            class: "metricMark",
18821                            "aria-hidden": "true"
18822                          }, null, -1), _createElementVNode("div", null, [_createElementVNode("b", null, "مرشح لإضافة معلومة جديدة"), _createElementVNode("small", null, "هذه ليست شهادة نهائية. الفحص الآلي الحالي والفحص داخل معاملة الاعتماد هما اللذان يمنعان إنشاء نسخة مكررة.")], -1)]))),
18823                      (s.status==='in_review')
18824                        ? (_openBlock(), _createElementBlock("div", _hoisted_99, _cache[56] || (_cache[56] = [_createElementVNode("span", null, "🔒", -1), _createElementVNode("div", null, [_createElementVNode("b", null, "المحتوى مقفول للمراجعة"), _createElementVNode("small", null, "إذا احتاج تعديلًا استخدم «إرجاع للتصحيح». أي تغيير يلغي بصمة المراجعة ولا يمكن اعتماده.")], -1)])))
18825                        : _createCommentVNode("", true),
18826                      _createElementVNode("div", _hoisted_100, [_withDirectives(_createElementVNode("select", {
18827                        "onUpdate:modelValue": $event => ((s.category_id) = $event),
18828                        disabled: s.status!=='pending'
18829                      }, [_cache[57] || (_cache[57] = _createElementVNode("option", { value: "" }, "اختر التصنيف قبل الإرسال", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(categories, (c) => {
18830                        return (_openBlock(), _createElementBlock("option", {
18831                          key: 'sc'+s.id+'-'+c.id,
18832                          value: c.id
18833                        }, _toDisplayString(c.icon) + " " + _toDisplayString(c.name_ar), 9, _hoisted_102))
18834                      }), 128))], 8, _hoisted_101), [[_vModelSelect, s.category_id]]), (selectedHub!=='china_guide')
18835                        ? _withDirectives((_openBlock(), _createElementBlock("select", {
18836                            key: 0,
18837                            "onUpdate:modelValue": $event => ((s.service_type) = $event),
18838                            disabled: s.status!=='pending'
18839                          }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(serviceOptions(), (o) => {
18840                            return (_openBlock(), _createElementBlock("option", {
18841                              key: o[0],
18842                              value: o[0]
18843                            }, _toDisplayString(o[1]), 9, _hoisted_104))
18844                          }), 128))], 8, _hoisted_103)), [[_vModelSelect, s.service_type]])
18845                        : _createCommentVNode("", true)]),
18846                      (selectedHub==='trade_shipping')
18847                        ? _withDirectives((_openBlock(), _createElementBlock("select", {
18848                            key: 3,
18849                            "onUpdate:modelValue": $event => ((s.direction) = $event),
18850                            disabled: s.status!=='pending'
18851                          }, _cache[58] || (_cache[58] = [_createElementVNode("option", { value: "general" }, "عام / الاتجاهين", -1), _createElementVNode("option", { value: "china_to_arab" }, "من الصين إلى الدول العربية", -1), _createElementVNode("option", { value: "arab_to_china" }, "من الدول العربية إلى الصين", -1)]), 8, _hoisted_105)), [[_vModelSelect, s.direction]])
18852                        : _createCommentVNode("", true),
18853                      _withDirectives(_createElementVNode("input", {
18854                        "onUpdate:modelValue": $event => ((s.title_ar) = $event),
18855                        disabled: s.status!=='pending',
18856                        placeholder: "العنوان العربي"
18857                      }, null, 8, _hoisted_106), [[_vModelText, s.title_ar]]),
18858                      _withDirectives(_createElementVNode("textarea", {
18859                        "onUpdate:modelValue": $event => ((s.summary_ar) = $event),
18860                        disabled: s.status!=='pending',
18861                        placeholder: "الملخص الذي سيظهر للمستخدم"
18862                      }, null, 8, _hoisted_107), [[_vModelText, s.summary_ar]]),
18863                      _createElementVNode("div", _hoisted_108, [_createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(s.source_name||s.source_domain||'المصدر'), 1), _createElementVNode("small", null, _toDisplayString(s.source_domain||'-'), 1)]), _createElementVNode("a", {
18864                        class: "sourceLink",
18865                        href: s.source_url,
18866                        target: "_blank",
18867                        rel: "noopener noreferrer"
18868                      }, "فتح المصدر ومراجعته", 8, _hoisted_109)]),
18869                      _createElementVNode("section", { class: _normalizeClass(["aiSuggestionImageReview", 'state-'+(s.image_status||'pending')]) }, [(s.image_status==='ready'&&s.image_url)
18870                        ? (_openBlock(), _createElementBlock("figure", _hoisted_110, [_createElementVNode("img", {
18871                            src: s.image_thumb_url||s.image_url,
18872                            alt: 'الصورة المقترحة لـ '+(s.title_ar||'العنصر'),
18873                            loading: "lazy"
18874                          }, null, 8, _hoisted_111), (s.image_meta&&s.image_meta.ai_generated)
18875                            ? (_openBlock(), _createElementBlock("figcaption", _hoisted_112, "رسم توضيحي مولد بالذكاء الاصطناعي — ليس صورة للموقع — لا يُنشر قبل موافقتك"))
18876                            : (_openBlock(), _createElementBlock("figcaption", _hoisted_113, "صورة مقترحة — لا تُنشر قبل موافقتك"))]))
18877                        : _createCommentVNode("", true), _createElementVNode("div", _hoisted_114, [
18878                        _createElementVNode("div", null, [_createElementVNode("span", _hoisted_115, _toDisplayString(s.image_status==='ready'?'🖼️':s.image_status==='fetching'?'⏳':'🔎'), 1), _createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(imageStatusLabel(s.image_status)), 1), (s.image_attribution)
18879                          ? (_openBlock(), _createElementBlock("small", _hoisted_116, _toDisplayString(s.image_attribution), 1))
18880                          : (s.image_error)
18881                            ? (_openBlock(), _createElementBlock("small", _hoisted_117, _toDisplayString(safeImageErrorText(s.image_error,s.image_status,s.image_meta)), 1))
18882                            : (_openBlock(), _createElementBlock("small", _hoisted_118, "يبحث النظام داخل مصدر المقترح ويضبط الصورة تلقائياً."))])]),
18883                        (s.image_source_url)
18884                          ? (_openBlock(), _createElementBlock("a", {
18885                              key: 0,
18886                              class: "sourceLink",
18887                              href: s.image_source_url,
18888                              target: "_blank",
18889                              rel: "noopener noreferrer"
18890                            }, "فتح أصل الصورة", 8, _hoisted_119))
18891                          : _createCommentVNode("", true),
18892                        (s.status==='pending'&&['not_found','failed'].includes(s.image_status))
18893                          ? (_openBlock(), _createElementBlock("button", {
18894                              key: 1,
18895                              class: "smallbtn secondary",
18896                              onClick: $event => (refreshResearchImage(s))
18897                            }, "إعادة جلب الصورة من المصدر", 8, _hoisted_120))
18898                          : _createCommentVNode("", true),
18899                        (s.status==='in_review'&&s.image_status==='ready')
18900                          ? (_openBlock(), _createElementBlock("label", _hoisted_121, [_withDirectives(_createElementVNode("input", {
18901                              type: "checkbox",
18902                              "onUpdate:modelValue": $event => ((s._useImage) = $event)
18903                            }, null, 8, _hoisted_122), [[_vModelCheckbox, s._useImage]]), _cache[59] || (_cache[59] = _createTextVNode(" نشر هذه الصورة مع العنصر بعد اعتمادها"))]))
18904                          : _createCommentVNode("", true),
18905                        (s.suggestion_kind==='update_existing'&&s.target_item_image_url&&s._useImage)
18906                          ? (_openBlock(), _createElementBlock("small", _hoisted_123, "سيتم استبدال صورة العنصر الحالية بالصورة التي تعتمدها هنا."))
18907                          : _createCommentVNode("", true)
18908                      ])], 2),
18909                      _createElementVNode("p", _hoisted_124, [_cache[60] || (_cache[60] = _createElementVNode("b", null, "خلاصة الدليل:", -1)), _createTextVNode(" " + _toDisplayString(s.evidence_summary||'لم يضف المحرك خلاصة.'), 1)]),
18910                      _createElementVNode("details", _hoisted_125, [_cache[62] || (_cache[62] = _createElementVNode("summary", null, "تفاصيل التحرير والمراجعة", -1)), _createElementVNode("div", _hoisted_126, [_withDirectives(_createElementVNode("textarea", {
18911                        "onUpdate:modelValue": $event => ((s.description_ar) = $event),
18912                        disabled: s.status!=='pending',
18913                        placeholder: "الوصف الكامل"
18914                      }, null, 8, _hoisted_127), [[_vModelText, s.description_ar]]), _createElementVNode("div", _hoisted_128, [_withDirectives(_createElementVNode("input", {
18915                        "onUpdate:modelValue": $event => ((s.source_name) = $event),
18916                        disabled: s.status!=='pending',
18917                        placeholder: "اسم المصدر"
18918                      }, null, 8, _hoisted_129), [[_vModelText, s.source_name]]), _withDirectives(_createElementVNode("input", {
18919                        "onUpdate:modelValue": $event => ((s.source_url) = $event),
18920                        disabled: s.status!=='pending',
18921                        placeholder: "رابط المصدر"
18922                      }, null, 8, _hoisted_130), [[_vModelText, s.source_url]])]), _withDirectives(_createElementVNode("select", {
18923                        "onUpdate:modelValue": $event => ((s.risk_level) = $event),
18924                        disabled: s.status!=='pending'
18925                      }, _cache[61] || (_cache[61] = [_createElementVNode("option", { value: "low" }, "مخاطر منخفضة", -1), _createElementVNode("option", { value: "standard" }, "مخاطر عادية", -1), _createElementVNode("option", { value: "high" }, "عالي المخاطر", -1)]), 8, _hoisted_131), [[_vModelSelect, s.risk_level]])])]),
18926                      _createElementVNode("section", { class: _normalizeClass(["aiDedupCertificate", 'state-'+dedupStatus(s)]) }, [
18927                        _createElementVNode("div", _hoisted_132, [_createElementVNode("span", null, _toDisplayString(dedupStatus(s)==='clear'?'🛡️':dedupStatus(s)==='conflict'?'⛔':'🔄'), 1), _createElementVNode("div", null, [_createElementVNode("b", null, "شهادة منع التكرار: " + _toDisplayString(dedupStatusLabel(s)), 1), _createElementVNode("small", null, _toDisplayString(suggestionDirty(s)?'احفظ التعديل قبل الفحص':dedupReasonLabel(s.dedup_current_reason||s.dedup_reason)), 1)])]),
18928                        (dedupMatchText(s))
18929                          ? (_openBlock(), _createElementBlock("p", _hoisted_133, "التعارض مع: " + _toDisplayString(dedupMatchText(s)), 1))
18930                          : (s.dedup_stale)
18931                            ? (_openBlock(), _createElementBlock("p", _hoisted_134, "تغيّر جرد الدليل بعد آخر شهادة؛ نفّذ الفحص مرة أخرى."))
18932                            : _createCommentVNode("", true),
18933                        _createElementVNode("div", _hoisted_135, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(s.dedup_checked_item_count||research.inventory.item_count||0), 1), _cache[63] || (_cache[63] = _createElementVNode("small", null, "عنصر في الدليل", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(s.dedup_checked_suggestion_count||0), 1), _cache[64] || (_cache[64] = _createElementVNode("small", null, "مقترح نشط", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(s.dedup_checked_at?shortDate(s.dedup_checked_at):'-'), 1), _cache[65] || (_cache[65] = _createElementVNode("small", null, "آخر شهادة", -1))])]),
18934                        _cache[66] || (_cache[66] = _createElementVNode("small", { class: "aiFinalCheckNote" }, "يعاد نفس الفحص للمرة الأخيرة داخل معاملة الاعتماد قبل أي كتابة أو نشر.", -1))
18935                      ], 2),
18936                      _withDirectives(_createElementVNode("textarea", {
18937                        "onUpdate:modelValue": $event => ((s.admin_note) = $event),
18938                        disabled: s.status==='approved'||s.status==='rejected',
18939                        placeholder: "ملاحظة المراجع"
18940                      }, null, 8, _hoisted_136), [[_vModelText, s.admin_note]]),
18941                      (s.risk_level==='high'&&!canOperate)
18942                        ? (_openBlock(), _createElementBlock("p", _hoisted_137, _cache[67] || (_cache[67] = [_createElementVNode("b", null, "يتطلب إدارة عليا:", -1), _createTextVNode(" هذا المقترح عالي المخاطر ولا يمكن اعتماده من هذا الحساب.")])))
18943                        : _createCommentVNode("", true),
18944                      (s.review_content_changed)
18945                        ? (_openBlock(), _createElementBlock("div", _hoisted_138, _cache[68] || (_cache[68] = [_createElementVNode("b", null, "تغيّر المحتوى بعد الإرسال.", -1), _createElementVNode("small", null, "الاعتماد مقفول. أعد المقترح للمسودة ثم صححه وأعد الفحص والإرسال.", -1)])))
18946                        : _createCommentVNode("", true),
18947                      (s.status==='pending')
18948                        ? (_openBlock(), _createElementBlock("div", _hoisted_139, [_createElementVNode("button", {
18949                            class: "smallbtn secondary",
18950                            onClick: $event => (saveAndCheckSuggestion(s))
18951                          }, _toDisplayString(suggestionDirty(s)?'2. حفظ وفحص التكرار':dedupStatus(s)==='clear'?'2. إعادة فحص التكرار':'2. فحص التكرار'), 9, _hoisted_140), _createElementVNode("button", {
18952                            class: "smallbtn",
18953                            disabled: !canSubmitSuggestion(s)||submittingSuggestionId===String(s.id),
18954                            onClick: $event => (reviewResearchSuggestion(s,'submit'))
18955                          }, _toDisplayString(submittingSuggestionId===String(s.id)?'جاري الإرسال...':'إرسال للمراجعة'), 9, _hoisted_141), _createElementVNode("button", {
18956                            class: "smallbtn danger",
18957                            onClick: $event => (reviewResearchSuggestion(s,'reject'))
18958                          }, "رفض الاقتراح", 8, _hoisted_142)]))
18959                        : (s.status==='in_review')
18960                          ? (_openBlock(), _createElementBlock("section", _hoisted_143, [
18961                              _cache[73] || (_cache[73] = _createElementVNode("h4", null, "تحقق المراجع قبل الاعتماد", -1)),
18962                              _createElementVNode("label", null, [_withDirectives(_createElementVNode("input", {
18963                                type: "checkbox",
18964                                "onUpdate:modelValue": $event => ((s._reviewChecks.source_verified) = $event)
18965                              }, null, 8, _hoisted_144), [[_vModelCheckbox, s._reviewChecks.source_verified]]), _cache[69] || (_cache[69] = _createTextVNode(" فتحت المصدر وتأكدت أنه يثبت المعلومة الحالية."))]),
18966                              _createElementVNode("label", null, [_withDirectives(_createElementVNode("input", {
18967                                type: "checkbox",
18968                                "onUpdate:modelValue": $event => ((s._reviewChecks.content_verified) = $event)
18969                              }, null, 8, _hoisted_145), [[_vModelCheckbox, s._reviewChecks.content_verified]]), _cache[70] || (_cache[70] = _createTextVNode(" راجعت العنوان والملخص والتصنيف، وتأكدت أن الاستكمال يضيف بيانات فعلية."))]),
18970                              (s._useImage)
18971                                ? (_openBlock(), _createElementBlock("label", _hoisted_146, [_withDirectives(_createElementVNode("input", {
18972                                    type: "checkbox",
18973                                    "onUpdate:modelValue": $event => ((s._reviewChecks.image_verified) = $event)
18974                                  }, null, 8, _hoisted_147), [[_vModelCheckbox, s._reviewChecks.image_verified]]), _cache[71] || (_cache[71] = _createTextVNode(" فتحت الصورة وتأكدت أنها تخص العنصر ويمكن نشرها مع توثيق مصدرها."))]))
18975                                : _createCommentVNode("", true),
18976                              _createElementVNode("label", null, [_withDirectives(_createElementVNode("input", {
18977                                type: "checkbox",
18978                                "onUpdate:modelValue": $event => ((s._reviewChecks.publish_confirmed) = $event)
18979                              }, null, 8, _hoisted_148), [[_vModelCheckbox, s._reviewChecks.publish_confirmed]]), _cache[72] || (_cache[72] = _createTextVNode(" أفهم أن الاعتماد سينشر الإضافة أو يحدّث العنصر القائم بعد الفحص النهائي."))]),
18980                              _createElementVNode("div", _hoisted_149, [_createElementVNode("button", {
18981                                class: "smallbtn",
18982                                disabled: !canApproveSuggestion(s),
18983                                onClick: $event => (reviewResearchSuggestion(s,'approve'))
18984                              }, _toDisplayString(s.suggestion_kind==='update_existing'?'4. اعتماد استكمال العنصر':'4. اعتماد ونشر الإضافة'), 9, _hoisted_150), _createElementVNode("button", {
18985                                class: "smallbtn secondary",
18986                                onClick: $event => (reviewResearchSuggestion(s,'return'))
18987                              }, "إرجاع للتصحيح", 8, _hoisted_151), _createElementVNode("button", {
18988                                class: "smallbtn danger",
18989                                onClick: $event => (reviewResearchSuggestion(s,'reject'))
18990                              }, "رفض", 8, _hoisted_152)])
18991                            ]))
18992                          : (s.status==='approved'||s.status==='rejected')
18993                            ? (_openBlock(), _createElementBlock("div", _hoisted_153, [(s.approved_item_id)
18994                                ? (_openBlock(), _createElementBlock("a", {
18995                                    key: 0,
18996                                    class: "smallbtn secondary",
18997                                    href: currentHub.publicPath,
18998                                    target: "_blank",
18999                                    rel: "noopener"
19000                                  }, "فتح المحتوى المنشور", 8, _hoisted_154))
19001                                : _createCommentVNode("", true), _createElementVNode("button", {
19002                                class: "smallbtn danger",
19003                                onClick: $event => (reviewResearchSuggestion(s,'archive'))
19004                              }, "أرشفة المقترح", 8, _hoisted_155)]))
19005                            : _createCommentVNode("", true)
19006                    ])]))
19007                  : _createCommentVNode("", true)], 10, _hoisted_83))
19008              }), 128))
19009            ]))
19010          : (workspace==='jobs')
19011            ? (_openBlock(), _createElementBlock("section", _hoisted_156, [
19012                canOperate
19013                  ? (_openBlock(), _createBlock(_component_AiQualityPanel, {
19014                      key: 0,
19015                      hub: selectedHub
19016                    }, null, 8, ["hub"]))
19017                  : _createCommentVNode("", true),
19018                canOperate
19019                  ? (_openBlock(), _createBlock(_component_AiKnowledgeGapsPanel, {
19020                      key: 1,
19021                      hub: selectedHub
19022                    }, null, 8, ["hub"]))
19023                  : _createCommentVNode("", true),
19024                (canOperate&&selectedHub==='china_guide')
19025                  ? (_openBlock(), _createBlock(_component_ExhibitionDatesPanel, { key: 2 }))
19026                  : _createCommentVNode("", true),
19027                _createElementVNode("div", _hoisted_157, [_createElementVNode("div", null, [_createElementVNode("span", _hoisted_158, _toDisplayString(currentHub.icon) + " " + _toDisplayString(currentHub.label), 1), _cache[74] || (_cache[74] = _createElementVNode("h3", null, "تشغيل البحث", -1)), _cache[75] || (_cache[75] = _createElementVNode("p", { class: "hint" }, "البحث الكامل يجمع مصادر ويب ويقارنها بالجرد ثم يرسل المقترحات للمراجعة البشرية. اختبار الجاهزية فحص محدود بنتيجة واحدة.", -1))]), _createElementVNode("button", {
19028                  class: "smallbtn secondary",
19029                  onClick: load
19030                }, "تحديث الحالة", 8, _hoisted_159)]),
19031                latestStandardJob
19032                  ? (_openBlock(), _createElementBlock("section", {
19033                      key: 3,
19034                      class: _normalizeClass(["card aiRunOverview", ['state-'+latestStandardJob.status,{active:!!activeStandardJob}]])
19035                    }, [
19036                      _createElementVNode("div", _hoisted_160, [_createElementVNode("div", null, [_createElementVNode("span", _hoisted_161, _toDisplayString(researchStatusLabel(latestStandardJob.status)), 1), _createElementVNode("h3", null, "مهمة البحث #" + _toDisplayString(latestStandardJob.id), 1), _createElementVNode("p", null, _toDisplayString(latestStandardJob.status==='processing'?'البحث يعمل الآن ويتم تحديث الأرقام تلقائياً كل ثانيتين.':latestStandardJob.status==='queued'?'المهمة في الطابور وستبدأ تلقائياً.':'آخر مهمة بحث كاملة لهذا القسم.'), 1)]), _cache[76] || (_cache[76] = _
19036createElementVNode("span", { class: "vueBadge" }, "Standard · بحث كامل", -1))]),
19037                      _createElementVNode("div", _hoisted_162, [
19038                        _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(latestStandardJob.inventory_item_count||0), 1), _cache[77] || (_cache[77] = _createElementVNode("small", null, "قرأ من الدليل", -1))]),
19039                        _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(latestStandardJob.source_count||0), 1), _cache[78] || (_cache[78] = _createElementVNode("small", null, "مصادر ويب", -1))]),
19040                        _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(latestStandardJob.result_count||0), 1), _cache[79] || (_cache[79] = _createElementVNode("small", null, "مقترحات", -1))]),
19041                        _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(latestStandardJob.duplicate_count||0), 1), _cache[80] || (_cache[80] = _createElementVNode("small", null, "مكرر", -1))]),
19042                        _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(formatDuration(latestStandardJob.duration_ms)), 1), _cache[81] || (_cache[81] = _createElementVNode("small", null, "المدة", -1))])
19043                      ]),
19044                      (researchJobHasFailure(latestStandardJob))
19045                        ? (_openBlock(), _createElementBlock("div", _hoisted_163, [_createElementVNode("b", _hoisted_164, _toDisplayString(researchFailureLabel(latestStandardJob)), 1), _createElementVNode("small", null, _toDisplayString(researchFailureHelp(latestStandardJob)), 1)]))
19046                        : (latestStandardJob.error_text)
19047                          ? (_openBlock(), _createElementBlock("div", _hoisted_165, [_cache[82] || (_cache[82] = _createElementVNode("b", null, "اكتمل البحث مع ملاحظات", -1)), _createElementVNode("small", null, _toDisplayString(researchNoticeText(latestStandardJob)), 1)]))
19048                          : _createCommentVNode("", true),
19049                      (latestStandardJob.status==='completed')
19050                        ? (_openBlock(), _createElementBlock("div", _hoisted_166, [_createVNode(_component_router_link, {
19051                            class: "smallbtn",
19052                            to: {path:'/admin/ai-research',query:{hub:selectedHub,workspace:'review',status:'pending',job:latestStandardJob.id}}
19053                          }, {
19054                            default: _withCtx(() => _cache[83] || (_cache[83] = [_createTextVNode("فتح النتائج للمراجعة")])),
19055                            _: 1,
19056                            __: [83]
19057                          }, 8, ["to"])]))
19058                        : _createCommentVNode("", true)
19059                    ], 2))
19060                  : _createCommentVNode("", true),
19061                canOperate
19062                  ? (_openBlock(), _createElementBlock("div", _hoisted_167, [
19063                      _cache[87] || (_cache[87] = _createElementVNode("div", { class: "aiRunCardHead" }, [_createElementVNode("span", { class: "vueBadge" }, "بحث كامل · Standard"), _createElementVNode("h3", null, "بحث جديد لسد الفجوات"), _createElementVNode("p", { class: "hint" }, "اقرأ الجرد أولاً، ثم ابحث في الويب عن معلومات غير مكررة. اترك الهدف التحريري فارغاً ليحدد المحرك الأولويات من الفجوات والتغطية.")], -1)),
19064                      _createElementVNode("label", _hoisted_168, [_cache[85] || (_cache[85] = _createTextVNode("نطاق البحث")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((researchForm.category_id) = $event) }, [_cache[84] || (_cache[84] = _createElementVNode("option", { value: "" }, "كل تصنيفات هذا القسم", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(categories, (c) => {
19065                        return (_openBlock(), _createElementBlock("option", {
19066                          key: 'aircat'+c.id,
19067                          value: c.id
19068                        }, _toDisplayString(c.icon) + " " + _toDisplayString(c.name_ar), 9, _hoisted_170))
19069                      }), 128))], 8, _hoisted_169), [[_vModelSelect, researchForm.category_id]])]),
19070                      _createElementVNode("label", _hoisted_171, [_cache[86] || (_cache[86] = _createTextVNode("هدف تحريري اختياري")), _withDirectives(_createElementVNode("textarea", {
19071                        "onUpdate:modelValue": $event => ((researchForm.query_text) = $event),
19072                        placeholder: "اختياري — مثال: تحسين تغطية خدمات السكن في قوانغتشو"
19073                      }, null, 8, _hoisted_172), [[_vModelText, researchForm.query_text]])]),
19074                      _createElementVNode("button", {
19075                        class: "btn aiPrimaryRunButton",
19076                        disabled: !!activeStandardJob||store.state.busy,
19077                        onClick: runResearch
19078                      }, _toDisplayString(activeStandardJob?'بحث كامل يعمل الآن':'تشغيل بحث كامل'), 9, _hoisted_173),
19079                      _cache[88] || (_cache[88] = _createElementVNode("small", { class: "hint" }, "بعد التشغيل لا تحتاج لتحديث الصفحة. الحالة والمصادر والمقترحات تتحدث تلقائياً.", -1))
19080                    ]))
19081                  : (_openBlock(), _createElementBlock("div", _hoisted_174, _cache[89] || (_cache[89] = [_createElementVNode("b", null, "عرض فقط:", -1), _createTextVNode(" يمكنك متابعة المهام ومراجعة المقترحات. تشغيل البحث متاح للإدارة العليا فقط.")]))),
19082                _createElementVNode("section", { class: _normalizeClass(["card aiCanaryCard", 'state-'+research.readiness.state]) }
19082, [_createElementVNode("div", _hoisted_175, [_createElementVNode("div", null, [_createElementVNode("span", _hoisted_176, _toDisplayString(readinessLabel(research.readiness.state)), 1), _cache[90] || (_cache[90] = _createElementVNode("h3", null, "اختبار الجاهزية · Canary", -1)), _createElementVNode("p", null, _toDisplayString(readinessHelp(research.readiness)), 1)]), canOperate
19083                  ? (_openBlock(), _createElementBlock("button", {
19084                      key: 0,
19085                      class: "btn secondary",
19086                      disabled: research.readiness.state==='running'||store.state.busy,
19087                      onClick: runCanary
19088                    }, _toDisplayString(research.readiness.state==='running'?'الاختبار يعمل الآن':'تشغيل اختبار محدود'), 9, _hoisted_177))
19089                  : _createCommentVNode("", true)]), (research.readiness.job)
19090                  ? (_openBlock(), _createElementBlock("div", _hoisted_178, [
19091                      _createElementVNode("span", null, [_createElementVNode("b", null, "#" + _toDisplayString(research.readiness.job.id), 1), _cache[91] || (_cache[91] = _createElementVNode("small", null, "آخر اختبار", -1))]),
19092                      _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(research.readiness.job.source_count||0), 1), _cache[92] || (_cache[92] = _createElementVNode("small", null, "مصادر", -1))]),
19093                      _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(Number(research.readiness.job.result_count||0)+Number(research.readiness.job.duplicate_count||0)), 1), _cache[93] || (_cache[93] = _createElementVNode("small", null, "نتيجة صالحة", -1))]),
19094                      _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(formatDuration(research.readiness.job.duration_ms)), 1), _cache[94] || (_cache[94] = _createElementVNode("small", null, "مدة التنفيذ", -1))])
19095                    ]))
19096                  : _createCommentVNode("", true), _cache[95] || (_cache[95] = _createElementVNode("div", { class: "aiCanaryBoundary" }, [_createElementVNode("b", null, "اختبار فقط:"), _createTextVNode(" طلب حي واحد، حد أقصى مقترح واحد، ولا نشر تلقائي.")], -1))], 2),
19097                canOperate
19098                  ? (_openBlock(), _createElementBlock("details", _hoisted_179, [_cache[97] || (_cache[97] = _createElementVNode("summary", null, [_createElementVNode("b", null, "أدوات تقنية متقدمة"), _createElementVNode("span", null, "لا تستخدم عادةً")], -1)), _createElementVNode("div", _hoisted_180, [_cache[96] || (_cache[96] = _createElementVNode("p", { class: "hint" }, "المعالج يبدأ المهام تلقائياً. استخدم التشغيل اليدوي للطابور فقط أثناء التشخيص التقني.", -1)), _createElementVNode("button", {
19099                      class: "smallbtn secondary",
19100                      onClick: processResearch
19101                    }, "تشغيل الطابور يدوياً", 8, _hoisted_181)])]))
19102                  : _createCommentVNode("", true),
19103                _createElementVNode("details", {
19104                  class: "card aiAdminDisclosure",
19105                  open: !!targetJob
19106                }, [_createElementVNode("summary", null, [_cache[98] || (_cache[98] = _createElementVNode("b", null, "سجل مهام البحث", -1)), _createElementVNode("span", null, [_createTextVNode(_toDisplayString(showAllJobs?research.jobs.length:visibleJobs.length) + " مهمة", 1), (!showAllJobs&&routineJobCount)
19107                  ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createTextVNode(" · " + _toDisplayString(routineJobCount) + " روتينية مخفية", 1)], 64))
19108                  : _createCommentVNode("", true)])]), _createElementVNode("div", _hoisted_183, [_createElementVNode("button", {
19109                  type: "button",
19110                  class: _normalizeClass({active:!showAllJobs}),
19111                  onClick: $event => (showAllJobs=false)
19112                }, "المهمة", 10, _hoisted_184), _createElementVNode("button", {
19113                  type: "button",
19114                  class: _normalizeClass({active:showAllJobs}),
19115                  onClick: $event => (showAllJobs=true)
19116                }, "كل السجل (" + _toDisplayString(research.jobs.length) + ")", 11, _hoisted_185)]), _createElementVNode("div", _hoisted_186, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(visibleJobs, (job) => {
19117                  return (_openBlock(), _createElementBlock("article", {
19118                    class: _normalizeClass(["card aiJobCard", {taskTarget:String(job.id)===targetJob}]),
19119                    "data-task-id": 'ai-job-'+job.id,
19120                    key: 'job'+job.id
19121                  }, [
19122                    _createElementVNode("div", _hoisted_188, [_createElementVNode("div", null, [_createElementVNode("h3", null, _toDisplayString(job.query_text||'خطة سد الفجوات الافتراضية'), 1), _createElementVNode("p", _hoisted_189, _toDisplayString(job.run_kind==='canary'?'اختبار جاهزية حي':(job.trigger_type==='scheduled'?'بحث تلقائي':'بحث يدوي')) + " · " + _toDisplayString(shortDate(job.created_at)), 1)]), _createElementVNode("span", { class: _normalizeClass(["statusPill", {canaryPill:job.run_kind==='canary'}]) }, _toDisplayString(researchStatusLabel(job.status)), 3)]),
19123                    _createElementVNode("div", _hoisted_190, [
19124                      _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(job.inventory_item_count||0), 1), _cache[99] || (_cache[99] = _createElementVNode("small", null, "قرأ من الدليل", -1))]),
19125                      _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(job.source_count||0), 1), _cache[100] || (_cache[100] = _createElementVNode("small", null, "مصادر ويب", -1))]),
19126                      _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(job.result_count||0), 1), _cache[101] || (_cache[101] = _createElementVNode("small", null, "مقترحات", -1))]),
19127                      _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(job.duplicate_count||0), 1), _cache[102] || (_cache[102] = _createElementVNode("small", null, "مكرر", -1))]),
19128                      _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(job.attempts||0), 1), _cache[103] || (_cache[103] = _createElementVNode("small", null, "محاولات", -1))]),
19129                      _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(formatDuration(job.duration_ms)), 1), _cache[104] || (_cache[104] = _createElementVNode("small", null, "المدة", -1))])
19130                    ]),
19131                    (job.usage_json&&job.usage_json.providers)
19132                      ? (_openBlock(), _createElementBlock("div", _hoisted_191, [_createElementVNode("span", null, [_createElementVNode("b", null, "OpenAI · " + _toDisplayString(providerStatusLabel(providerResearchStats(job,'openai'))), 1), _createElementVNode("small", null, _toDisplayString(providerResearchStats(job,'openai').source_count||0) + " مصدر · " + _toDisplayString(providerResearchStats(job,'openai').suggestion_count||0) + " مقترح · " + _toDisplayString(formatDuration(providerResearchStats(job,'openai').duration_ms)), 1)]), _createElementVNode("span", null, [_createElementVNode("b", null, "Grok / xAI · " + _toDisplayString(providerStatusLabel(providerResearchStats(job,'xai'))), 1), _createElementVNode("small", null, _toDisplayString(providerResearchStats(job,'xai').source_count||0) + " مصدر · " + _toDisplayString(providerResearchStats(job,'xai').suggestion_count||0) + " مقترح · " + _toDisplayString(formatDuration(providerResearchStats(job,'xai').duration_ms)), 1)])]))
19133                      : _createCommentVNode("", true),
19134                    (researchJobHasFailure(job))
19135                      ? (_openBlock(), _createElementBlock("div", _hoisted_192, [_createElementVNode("b", _hoisted_193, _toDisplayString(researchFailureLabel(job)), 1), _createElementVNode("small", null, _toDisplayString(researchFailureHelp(job)), 1), _createElementVNode("details", null, [_cache[105] || (_cache[105] = _createElementVNode("summary", null, "التفاصيل التقنية", -1)), _createElementVNode("small", _hoisted_194, _toDisplayString(job.error_text), 1)])]))
19136                      : (job.error_text)
19137                        ? (_openBlock(), _createElementBlock("div", _hoisted_195, [_cache[106] || (_cache[106] = _createElementVNode("b", null, "اكتمل البحث مع ملاحظات", -1)), _createElementVNode("small", null, _toDisplayString(researchNoticeText(job)), 1)]))
19138                        : _createCommentVNode("", true),
19139                    canOperate
19140                      ? (_openBlock(), _createElementBlock("div", _hoisted_196, [(job.status==='failed'||job.status==='cancelled')
19141                          ? (_openBlock(), _createElementBlock("button", {
19142                              key: 0,
19143                              class: "smallbtn",
19144                              onClick: $event => (retryResearchJob(job))
19145                            }, _toDisplayString(job.retryable?'إعادة المحاولة':'إعادة المحاولة بعد معالجة السبب'), 9, _hoisted_197))
19146                          : _createCommentVNode("", true), (job.status==='queued')
19147                          ? (_openBlock(), _createElementBlock("button", {
19148                              key: 1,
19149                              class: "smallbtn danger",
19150                              onClick: $event => (cancelResearchJob(job))
19151                            }, "إلغاء المهمة", 8, _hoisted_198))
19152                          : _createCommentVNode("", true)]))
19153                      : _createCommentVNode("", true)
19154                  ], 10, _hoisted_187))
19155                }), 128)), (!research.jobs.length&&!store.state.busy)
19156                  ? (_openBlock(), _createElementBlock("p", _hoisted_199, "لم تُشغّل مهام بحث لهذا القسم بعد."))
19157                  : _createCommentVNode("", true)])], 8, _hoisted_182)
19158              ]))
19159            : (_openBlock(), _createElementBlock("section", _hoisted_200, [
19160                _createElementVNode("div", _hoisted_201, [_cache[107] || (_cache[107] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "إعداد مركزي مشترك"), _createElementVNode("h3", null, "الاتصال وسياسة التشغيل"), _createElementVNode("p", { class: "hint" }, "الإعدادات تطبق على مساري دليلك في الصين والتجارة والشحن فقط. لا تغيّرها إلا بعد اختبار مهمة واحدة مضبوطة.")], -1)), _createElementVNode("span", _hoisted_202, _toDisplayString(research.settings.api_key_configured?'المفتاح محفوظ':'المفتاح غير مضاف'), 1)]),
19161                _createElementVNode("section", _hoisted_203, [
19162                  _createElementVNode("article", null, [_cache[108] || (_cache[108] = _createElementVNode("small", null, "المزود", -1)), _createElementVNode("b", null, _toDisplayString(research.settings.provider||'openai'), 1)]),
19163                  _createElementVNode("article", null, [_cache[109] || (_cache[109] = _createElementVNode("small", null, "موديل البحث", -1)), _createElementVNode("b", _hoisted_204, _toDisplayString(research.settings.research_model||'-'), 1)]),
19164                  _createElementVNode("article", null, [_cache[110] || (_cache[110] = _createElementVNode("small", null, "البحث", -1)), _createElementVNode("b", null, _toDisplayString(research.settings.research_enabled?'مفعّل':'متوقف'), 1)]),
19165                  _createElementVNode("article", null, [_cache[111] || (_cache[111] = _createElementVNode("small", null, "التشغيل التلقائي", -1)), _createElementVNode("b", null, _toDisplayString(research.settings.research_auto?(research.readiness_summary.ready_count>0?'مفعّل للنطاقات الجاهزة':'موقوف حتى الاختبار'):'متوقف'), 1)])
19166                ]),
19167                _createElementVNode("section", _hoisted_205, [_createElementVNode("div", null, [_createElementVNode("span", { class: _normalizeClass(["statusPill", {canaryPill:research.readiness_summary.ready_count>0}]) }, _toDisplayString(research.readiness_summary.ready_count||0) + " / " + _toDisplayString(research.readiness_summary.total||2), 3), _cache[112] || (_cache[112] = _createElementVNode("h3", null, "جاهزية مستقلة لكل نطاق", -1)), _createElementVNode("p", null, _toDisplayString(research.readiness_summary.all_ready?'القسمان اجتازا اختباراً حياً حديثاً.':'كل قسم يعمل حسب اختباره وسياسته؛ عدم جاهزية قسم لا يوقف القسم الآخر.'), 1)]), _createElementVNode("div", _hoisted_206, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(AI_RESEARCH_HUB_OPTIONS, (h) => {
19168                  return (_openBlock(), _createElementBlock("span", { key: 'ready-'+h.key }, [_createElementVNode("b", null, _toDisplayString(h.icon) + " " + _toDisplayString(h.short), 1), _createElementVNode("small", null, _toDisplayString(readinessLabel((research.readiness_summary.domains[h.key]||{}).state)), 1)]))
19169                }), 128))])]),
19170                _createElementVNode("section", { class: _normalizeClass(["card aiAutomationDashboard", {paused:research.automation.policy.paused_reason}]) }, [
19171                  _createElementVNode("div", _hoisted_207, [_createElementVNode("div", null, [_cache[113] || (_cache[113] = _createElementVNode("span", { class: "vueBadge" }, "سياسة مستقلة لهذا القسم", -1)), _createElementVNode("h3", null, _toDisplayString(currentHub.icon) + " جدول واستهلاك " + _toDisplayString(currentHub.short), 1), _cache[114] || (_cache[114] = _createElementVNode("p", null, "المفتاح العام يشغّل النظام، ثم يتحكم هذا الكرت وحده في توقيت وحدود القسم الحالي.", -1))]), _createElementVNode("span", { class: _normalizeClass(["statusPill", {canaryPill:research.automation.decision.ok,danger:research.automation.policy.paused_reason}]) }, _toDisplayString(automationStatusLabel(research.automation.decision.code)), 3)]),
19172                  _createElementVNode("div", _hoisted_208, [
19173                    _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(research.automation.usage.scheduled_today||0) + " / " + _toDisplayString(research.automation.policy.daily_run_limit||1), 1), _cache[115] || (_cache[115] = _createElementVNode("small", null, "تشغيل تلقائي اليوم", -1))]),
19174                    _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(research.automation.usage.standard_month||0) + " / " + _toDisplayString(research.automation.policy.monthly_run_limit||30), 1), _cache[116] || (_cache[116] = _createElementVNode("small", null, "مهام الشهر", -1))]),
19175                    _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(formatTokens(research.automation.usage.total_tokens_month)), 1), _cache[117] || (_cache[117] = _createElementVNode("small", null, "Tokens هذا الشهر", -1))]),
19176                    _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(research.automation.usage.failed_month||0), 1), _cache[118] || (_cache[118] = _createElementVNode("small", null, "إخفاقات الشهر", -1))]),
19177                    _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(research.automation.policy.consecutive_failures||0), 1), _cache[119] || (_cache[119] = _createElementVNode("small", null, "إخفاقات متتالية", -1))]),
19178                    _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(research.automation.next_due_at?shortDate(research.automation.next_due_at):'-'), 1), _cache[120] || (_cache[120] = _createElementVNode("small", null, "الموعد التالي", -1))])
19179                  ]),
19180                  (research.automation.policy.paused_reason)
19181                    ? (_openBlock(), _createElementBlock("div", _hoisted_209, [_createElementVNode("b", null, "أوقف النظام هذا القسم تلقائياً: " + _toDisplayString(pauseReasonLabel(research.automation.policy.paused_reason)), 1), _cache[121] || (_cache[121] = _createElementVNode("small", null, "عالج سبب المزود أولاً، ثم استخدم زر الاستئناف. لا يعاد التشغيل بصمت.", -1))]))
19182                    : _createCommentVNode("", true),
19183                  _cache[122] || (_cache[122] = _createElementVNode("small", { class: "hint" }, [_createElementVNode("b", null, "AI لا ينشر مباشرة."), _createTextVNode(" تشغيل البحث تلقائياً حسب الجدول يضيف مقترحات إلى صندوق المراجعة فقط. الاستهلاك المعروض تشغيلي من رد المزود، وليس فاتورة مالية؛ وسقف عدد المهام هو الحاجز الصلب لمنع الصرف المفتوح.")], -1))
19184                ], 2),
19185                (!canOperate)
19186                  ? (_openBlock(), _createElementBlock("div", _hoisted_210, _cache[123] || (_cache[123] = [_createElementVNode("b", null, "عرض فقط:", -1), _createTextVNode(" تعديل الاتصال وإعدادات البحث متاح للإدارة العليا. يمكنك استخدام صندوق المقترحات للمراجعة اليومية.")])))
19187                  : (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [
19188                      (workspace==='settings')
19189                        ? (_openBlock(), _createBlock(_component_AiResearchSettingsPanel, { key: 0 }))
19190                        : _createCommentVNode("", true),
19191                      _createElementVNode("section", _hoisted_211, [
19192                        _cache[128] || (_cache[128] = _createElementVNode("h3", null, "اتصال OpenAI", -1)),
19193                        _createElementVNode("div", _hoisted_212, [_withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((research.settings.provider) = $event) }, _cache[124] || (_cache[124] = [_createElementVNode("option", { value: "openai" }, "OpenAI", -1)]), 8, _hoisted_213), [[_vModelSelect, research.settings.provider]]), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((research.settings.model) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(modelOptions(research.settings.model), (m) => {
19194                          return (_openBlock(), _createElementBlock("option", {
19195                            key: 'draft-'+m,
19196                            value: m
19197                          }, _toDisplayString(m), 9, _hoisted_215))
19198                        }), 128))], 8, _hoisted_214), [[_vModelSelect, research.settings.model]])]),
19199                        _withDirectives(_createElementVNode("input", {
19200                          "onUpdate:modelValue": $event => ((research.settings.apiKey) = $event),
19201                          autocomplete: "off",
19202                          placeholder: "OpenAI API Key — اترك القيمة المقنّعة كما هي للاحتفاظ بالمفتاح"
19203                        }, null, 8, _hoisted_216), [[_vModelText, research.settings.apiKey]]),
19204                        _createElementVNode("small", _hoisted_217, "حالة المفتاح: " + _toDisplayString(research.settings.api_key_configured?'موجود ومخفي':'غير مضاف'), 1),
19205                        _createElementVNode("div", _hoisted_218, [_withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((research.settings.default_language) = $event) }, _cache[125] || (_cache[125] = [_createElementVNode("option", { value: "ar" }, "العربية", -1), _createElementVNode("option", { value: "en" }, "English", -1), _createElementVNode("option", { value: "zh" }, "中文", -1)]), 8, _hoisted_219), [[_vModelSelect, research.settings.default_language]]), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((research.settings.tone) = $event) }, _cache[126] || (_cache[126] = [_createElementVNode("option", { value: "simple" }, "بسيطة وواضحة", -1), _createElementVNode("option", { value: "professional" }, "مهنية", -1), _createElementVNode("option", { value: "concise" }, "مختصرة", -1)]), 8, _hoisted_220), [[_vModelSelect, research.settings.tone]])]),
19206                        _createElementVNode("label", _hoisted_221, [_withDirectives(_createElementVNode("input", {
19207                          type: "checkbox",
19208                          "onUpdate:modelValue": $event => ((research.settings.enabled) = $event)
19209                        }, null, 8, _hoisted_222), [[_vModelCheckbox, research.settings.enabled]]), _cache[127] || (_cache[127] = _createTextVNode(" تفعيل مولّد المسودات"))])
19210                      ]),
19211                      _createElementVNode("section", _hoisted_223, [
19212                        _createElementVNode("div", _hoisted_224, [_cache[129] || (_cache[129] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "باحث مشارك"), _createElementVNode("h3", null, "Grok / xAI")], -1)), _createElementVNode("span", _hoisted_225, _toDisplayString(research.settings.xai_api_key_configured?'متصل بالمفتاح':'المفتاح غير موجود'), 1)]),
19213                        _cache[137] || (_cache[137] = _createElementVNode("p", { class: "hint" }, "في البحث الكامل لدليلك في الصين يعمل OpenAI وGrok بالتوازي، ثم تمر المصادر والمقترحات على سياسات التحقق ومنع التكرار والمراجعة البشرية. اختبار الجاهزية Canary يبقى OpenAI فقط، والتجارة والشحن تبقى على المساعدة القصيرة حالياً. فشل Grok لا يوقف OpenAI والعكس صحيح إذا بقيت نتائج موثقة صالحة.", -1)),
19214                        _createElementVNode("label", _hoisted_226, [_withDirectives(_createElementVNode("input", {
19215                          type: "checkbox",
19216                          "onUpdate:modelValue": $event => ((research.settings.secondary_research_enabled) = $event)
19217                        }, null, 8, _hoisted_227), [[_vModelCheckbox, research.settings.secondary_research_enabled]]), _cache[130] || (_cache[130] = _createTextVNode(" تفعيل Grok كباحث مشارك لدليلك في الصين"))]),
19218                        _createElementVNode("div", _hoisted_228, [_createElementVNode("label", _hoisted_229, [_cache[131] || (_cache[131] = _createTextVNode("موديل البحث")), _withDirectives(_createElementVNode("input", {
19219                          "onUpdate:modelValue": $event => ((research.settings.secondary_model) = $event),
19220                          dir: "ltr"
19221                        }, null, 8, _hoisted_230), [[_vModelText, research.settings.secondary_model]])]), _createElementVNode("label", _hoisted_231, [_cache[132] || (_cache[132] = _createTextVNode("أقصى صور في الدفعة")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((research.settings.image_batch_limit) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(20, (n) => {
19222                          return (_openBlock(), _createElementBlock("option", {
19223                            key: 'image-batch-'+n,
19224                            value: String(n)
19225                          }, _toDisplayString(n), 9, _hoisted_233))
19226                        }), 128))], 8, _hoisted_232), [[_vModelSelect, research.settings.image_batch_limit]])])]),
19227                        _createElementVNode("label", _hoisted_234, [_withDirectives(_createElementVNode("input", {
19228                          type: "checkbox",
19229                          "onUpdate:modelValue": $event => ((research.settings.image_assistant_enabled) = $event)
19230                        }, null, 8, _hoisted_235), [[_vModelCheckbox, research.settings.image_assistant_enabled]]), _cache[133] || (_cache[133] = _createTextVNode(" تفعيل مساعد استكمال الصور"))]),
19231                        _createElementVNode("label", _hoisted_236, [_withDirectives(_createElementVNode("input", {
19232                          type: "checkbox",
19233                          "onUpdate:modelValue": $event => ((research.settings.image_search_enabled) = $event)
19234                        }, null, 8, _hoisted_237), [[_vModelCheckbox, research.settings.image_search_enabled]]), _cache[134] || (_cache[134] = _createTextVNode(" البحث عن صورة حقيقية أولاً"))]),
19235                        _createElementVNode("label", _hoisted_238, [_withDirectives(_createElementVNode("input", {
19236                          type: "checkbox",
19237                          "onUpdate:modelValue": $event => ((research.settings.image_generate_enabled) = $event)
19238                        }, null, 8, _hoisted_239), [[_vModelCheckbox, research.settings.image_generate_enabled]]), _cache[135] || (_cache[135] = _
19238createTextVNode(" السماح بتوليد صورة توضيحية عند عدم وجود صورة مناسبة"))]),
19239                        _createElementVNode("label", _hoisted_240, [_cache[136] || (_cache[136] = _createTextVNode("موديل الصور")), _withDirectives(_createElementVNode("input", {
19240                          "onUpdate:modelValue": $event => ((research.settings.image_model) = $event),
19241                          dir: "ltr"
19242                        }, null, 8, _hoisted_241), [[_vModelText, research.settings.image_model]])]),
19243                        _cache[138] || (_cache[138] = _createElementVNode("small", { class: "hint" }, "توليد الصور محظور تلقائياً للأماكن الحقيقية مثل المطاعم والفنادق والأسواق والمستشفيات والمعارض؛ لهذه العناصر يجب العثور على صورة فعلية.", -1))
19244                      ]),
19245                      _createElementVNode("section", _hoisted_242, [
19246                        _createElementVNode("div", _hoisted_243, [_cache[139] || (_cache[139] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "محرك بحث ومساعد"), _createElementVNode("h3", null, "DeepSeek")], -1)), _createElementVNode("span", _hoisted_244, _toDisplayString(research.settings.deepseek_api_key_configured?'المفتاح محفوظ':'المفتاح غير موجود'), 1)]),
19247                        _cache[145] || (_cache[145] = _createElementVNode("p", { class: "hint" }, "يعمل كمحرك بحث (يجلب SMT المصادر عبر SearXNG ويقرؤها DeepSeek ولا يستشهد إلا بها) وككاتب لإجابات «اسأل SMT» من أدلة الدليل فقط. اختيار الأساسي/الاحتياطي ومزوّد «اسأل SMT» من لوحة إعدادات البحث أعلاه. تنبيه: نص السؤال والأدلة المرسلة تذهب إلى خوادم DeepSeek.", -1)),
19248                        _createElementVNode("label", _hoisted_245, [_cache[140] || (_cache[140] = _createTextVNode("DeepSeek API Key")), _withDirectives(_createElementVNode("input", {
19249                          type: "password",
19250                          "onUpdate:modelValue": $event => ((deepseekSecret) = $event),
19251                          dir: "ltr",
19252                          autocomplete: "new-password",
19253                          spellcheck: "false",
19254                          placeholder: "sk-…"
19255                        }, null, 8, _hoisted_246), [[_vModelText, deepseekSecret]])]),
19256                        _createElementVNode("div", _hoisted_247, [_createElementVNode("button", {
19257                          class: "smallbtn secondary",
19258                          onClick: requestAmapStepUp
19259                        }, "إرسال رمز تأكيد واتساب", 8, _hoisted_248), _createElementVNode("label", _hoisted_249, [_cache[141] || (_cache[141] = _createTextVNode("رمز OTP")), _withDirectives(_createElementVNode("input", {
19260                          "onUpdate:modelValue": $event => ((amapOtp) = $event),
19261                          inputmode: "numeric",
19262                          maxlength: "6",
19263                          autocomplete: "one-time-code",
19264                          placeholder: "6 أرقام"
19265                        }, null, 8, _hoisted_250), [[_vModelText, amapOtp]])])]),
19266                        _createElementVNode("div", _hoisted_251, [_createElementVNode("button", {
19267                          class: "smallbtn secondary",
19268                          onClick: verifyAmapStepUp
19269                        }, "تأكيد الهوية", 8, _hoisted_252), _createElementVNode("button", {
19270                          class: "btn",
19271                          disabled: !amapStepUpReady||deepseekSaving,
19272                          onClick: saveDeepseekSecret
19273                        }, _toDisplayString(deepseekSaving?'جارٍ الحفظ…':(research.settings.deepseek_api_key_configured?'استبدال مفتاح DeepSeek':'حفظ مفتاح DeepSeek')), 9, _hoisted_253), _createElementVNode("button", {
19274                          class: "smallbtn secondary",
19275                          disabled: deepseekTesting,
19276                          onClick: testDeepseek
19277                        }, "اختبار الاتصال", 8, _hoisted_254)]),
19278                        deepseekTest
19279                          ? (_openBlock(), _createElementBlock("p", _hoisted_255, [_createTextVNode(_toDisplayString(deepseekTest.message), 1), (deepseekTest.latency_ms)
19280                              ? (_openBlock(), _createElementBlock("span", _hoisted_256, " · " + _toDisplayString(deepseekTest.latency_ms) + "ms", 1))
19281                              : _createCommentVNode("", true), _createTextVNode(" · البحث (" + _toDisplayString(deepseekTest.search?deepseekTest.search.provider:'searxng') + "): " + _toDisplayString(deepseekTest.search?deepseekTest.search.message:(deepseekTest.searxng_ready?'جاهز':'غير مفعّل')), 1)]))
19282                          : _createCommentVNode("", true),
19283                        _cache[146] || (_cache[146] = _createElementVNode("h4", null, "مزوّد البحث (للمصادر)", -1)),
19284                        _cache[147] || (_cache[147] = _createElementVNode("p", { class: "hint" }, "SearXNG مجاني لكن محركاته تُوقف مؤقتاً من خادم مراكز البيانات. لبحث موثوق أدخل مفتاح مزوّد (Serper أو SerpApi أو Brave أو Tavily) ثم اختره من «مزوّد البحث لـ DeepSeek» في الإعدادات؛ ويبقى SearXNG احتياطياً.", -1)),
19285                        _createElementVNode("div", _hoisted_257, [_createElementVNode("label", _hoisted_258, [_cache[142] || (_cache[142] = _createTextVNode("المزوّد")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((searchKeyProvider) = $event) }, [
19286                          _createElementVNode("option", _hoisted_260, "Serper (Google)" + _toDisplayString(research.settings.search_keys_configured&&research.settings.search_keys_configured.serper?' ✓':''), 1),
19287                          _createElementVNode("option", _hoisted_261, "Brave Search" + _toDisplayString(research.settings.search_keys_configured&&research.settings.search_keys_configured.brave?' ✓':''), 1),
19288                          _createElementVNode("option", _hoisted_262, "Tavily" + _toDisplayString(research.settings.search_keys_configured&&research.settings.search_keys_configured.tavily?' ✓':''), 1),
19289                          _createElementVNode("option", _hoisted_263, "SerpApi" + _toDisplayString(research.settings.search_keys_configured&&research.settings.search_keys_configured.serpapi?' ✓':''), 1)
19290                        ], 8, _hoisted_259), [[_vModelSelect, searchKeyProvider]])]), _createElementVNode("label", _hoisted_264, [_cache[143] || (_cache[143] = _createTextVNode("مفتاح المزوّد")), _withDirectives(_createElementVNode("input", {
19291                          type: "password",
19292                          "onUpdate:modelValue": $event => ((searchKeySecret) = $event),
19293                          dir: "ltr",
19294                          autocomplete: "new-password",
19295                          spellcheck: "false"
19296                        }, null, 8, _hoisted_265), [[_vModelText, searchKeySecret]])])]),
19297                        _cache[148] || (_cache[148] = _createElementVNode("ol", { class: "hint" }, [_createElementVNode("li", null, "الصق المفتاح أعلاه."), _createElementVNode("li", null, "اضغط «إرسال رمز تأكيد واتساب» ثم اكتب الرمز واضغط «تأكيد الهوية» (مطلوب لكل حفظ)."), _createElementVNode("li", null, "اضغط «حفظ مفتاح البحث».")], -1)),
19298                        _createElementVNode("div", _hoisted_266, [_createElementVNode("button", {
19299                          class: "smallbtn secondary",
19300                          onClick: requestAmapStepUp
19301                        }, "إرسال رمز تأكيد واتساب", 8, _hoisted_267), _createElementVNode("label", _hoisted_268, [_cache[144] || (_cache[144] = _createTextVNode("رمز OTP")), _withDirectives(_createElementVNode("input", {
19302                          "onUpdate:modelValue": $event => ((amapOtp) = $event),
19303                          inputmode: "numeric",
19304                          maxlength: "6",
19305                          autocomplete: "one-time-code",
19306                          placeholder: "6 أرقام"
19307                        }, null, 8, _hoisted_269), [[_vModelText, amapOtp]])])]),
19308                        _createElementVNode("div", _hoisted_270, [_createElementVNode("button", {
19309                          class: "smallbtn secondary",
19310                          onClick: verifyAmapStepUp
19311                        }, "تأكيد الهوية", 8, _hoisted_271), _createElementVNode("button", {
19312                          class: "btn",
19313                          disabled: !amapStepUpReady||searchKeySaving,
19314                          onClick: saveSearchKey
19315                        }, _toDisplayString(searchKeySaving?'جارٍ الحفظ…':'حفظ مفتاح البحث'), 9, _hoisted_272)]),
19316                        _createElementVNode("p", _hoisted_273, _toDisplayString(amapStepUpReady?'الهوية مؤكدة: يمكنك الحفظ الآن.':'الحفظ معطّل حتى تؤكد الهوية برمز OTP.') + " " + _toDisplayString(store.state.msg), 1),
19317                        _cache[149] || (_cache[149] = _createElementVNode("small", { class: "hint" }, "المفتاح يُحفظ مشفراً ولا يظهر مرة أخرى.", -1))
19318                      ]),
19319                      _createElementVNode("section", _hoisted_274, [
19320                        _createElementVNode("div", _hoisted_275, [_cache[150] || (_cache[150] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "خرائط الصين"), _createElementVNode("h3", null, "Amap / 高德地图")], -1)), _createElementVNode("span", _hoisted_276, _toDisplayString(research.settings.amap_api_key_configured?'المفتاح محفوظ':'يُربط لاحقاً'), 1)]),
19321                        _cache[153] || (_cache[153] = _createElementVNode("p", { class: "hint" }, "يُستخدم فقط عندما لا يجد «اسأل SMT» المكان داخل دليل المنصة. النتيجة تظهر بوسم «معلومة من خريطة Amap» وتدخل تلقائياً صندوق اقتراحات الإدارة دون نشر تلقائي.", -1)),
19322                        _createElementVNode("label", _hoisted_277, [_cache[151] || (_cache[151] = _createTextVNode("Amap Web Service API Key")), _withDirectives(_createElementVNode("input", {
19323                          type: "password",
19324                          "onUpdate:modelValue": $event => ((amapSecret) = $event),
19325                          dir: "ltr",
19326                          autocomplete: "new-password",
19327                          spellcheck: "false",
19328                          placeholder: "أدخل المفتاح عند توفره"
19329                        }, null, 8, _hoisted_278), [[_vModelText, amapSecret]])]),
19330                        _createElementVNode("div", _hoisted_279, [_createElementVNode("button", {
19331                          class: "smallbtn secondary",
19332                          onClick: requestAmapStepUp
19333                        }, "إرسال رمز تأكيد واتساب", 8, _hoisted_280), _createElementVNode("label", _hoisted_28
193331, [_cache[152] || (_cache[152] = _createTextVNode("رمز OTP")), _withDirectives(_createElementVNode("input", {
19334                          "onUpdate:modelValue": $event => ((amapOtp) = $event),
19335                          inputmode: "numeric",
19336                          maxlength: "6",
19337                          autocomplete: "one-time-code",
19338                          placeholder: "6 أرقام"
19339                        }, null, 8, _hoisted_282), [[_vModelText, amapOtp]])])]),
19340                        _createElementVNode("div", _hoisted_283, [_createElementVNode("button", {
19341                          class: "smallbtn secondary",
19342                          onClick: verifyAmapStepUp
19343                        }, "تأكيد الهوية", 8, _hoisted_284), _createElementVNode("button", {
19344                          class: "btn",
19345                          disabled: !amapStepUpReady||amapSaving,
19346                          onClick: saveAmapSecret
19347                        }, _toDisplayString(amapSaving?'جارٍ الحفظ…':(research.settings.amap_api_key_configured?'استبدال مفتاح Amap':'حفظ مفتاح Amap')), 9, _hoisted_285)]),
19348                        _cache[154] || (_cache[154] = _createElementVNode("small", { class: "hint" }, "المفتاح يُحفظ مشفراً ولا يظهر مرة أخرى. يمكن تركه الآن وربطه لاحقاً من نفس المكان.", -1))
19349                      ]),
19350                      searxngLoaded
19351                        ? (_openBlock(), _createElementBlock("section", _hoisted_286, [
19352                            _createElementVNode("div", _hoisted_287, [_cache[155] || (_cache[155] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "احسب طريقك"), _createElementVNode("h3", null, "SearXNG")], -1)), _createElementVNode("span", _hoisted_288, _toDisplayString(searxngActive?'مفعّل':(searxngSource==='env'?'من متغير البيئة':'غير مفعّل')), 1)]),
19353                            _cache[159] || (_cache[159] = _createElementVNode("p", { class: "hint" }, "اختياري. يُستخدم فقط لاستخراج اسم صيني وعنوان من أفضل نتيجة بحث عندما يكتب العضو اسم المكان بالعربية. لا يُستخدم للإحداثيات أو حساب المسار، وغيابه لا يوقف Amap.", -1)),
19354                            _createElementVNode("label", _hoisted_289, [_cache[156] || (_cache[156] = _createTextVNode("عنوان SearXNG")), _withDirectives(_createElementVNode("input", {
19355                              "onUpdate:modelValue": $event => ((searxngUrl) = $event),
19356                              type: "url",
19357                              dir: "ltr",
19358                              maxlength: "300",
19359                              spellcheck: "false",
19360                              autocomplete: "off",
19361                              placeholder: "http://127.0.0.1:8888/"
19362                            }, null, 8, _hoisted_290), [[_vModelText, searxngUrl]])]),
19363                            _createElementVNode("label", _hoisted_291, [_withDirectives(_createElementVNode("input", {
19364                              type: "checkbox",
19365                              "onUpdate:modelValue": $event => ((searxngEnabled) = $event)
19366                            }, null, 8, _hoisted_292), [[_vModelCheckbox, searxngEnabled]]), _cache[157] || (_cache[157] = _createTextVNode(" تفعيل SearXNG في «احسب طريقك»"))]),
19367                            _createElementVNode("div", _hoisted_293, [_createElementVNode("button", {
19368                              class: "smallbtn secondary",
19369                              disabled: searxngTesting,
19370                              onClick: testSearxngConnection
19371                            }, _toDisplayString(searxngTesting?'جارٍ الاختبار…':'اختبار الاتصال'), 9, _hoisted_294), _createElementVNode("button", {
19372                              class: "btn",
19373                              disabled: searxngSaving,
19374                              onClick: saveSearxngSettings
19375                            }, _toDisplayString(searxngSaving?'جارٍ الحفظ…':'حفظ إعدادات SearXNG'), 9, _hoisted_295)]),
19376                            searxngTest
19377                              ? (_openBlock(), _createElementBlock("p", {
19378                                  key: 0,
19379                                  class: _normalizeClass(['hint',searxngTest.ok?'searxngTestOk':'searxngTestFail']),
19380                                  role: "status"
19381                                }, [_createTextVNode(_toDisplayString(searxngTest.message), 1), (searxngTest.elapsed_ms!=null)
19382                                  ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createTextVNode(" (" + _toDisplayString(searxngTest.elapsed_ms) + " ms", 1), (searxngTest.results!=null)
19383                                      ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createTextVNode(" · " + _toDisplayString(searxngTest.results) + " نتيجة", 1)], 64))
19384                                      : _createCommentVNode("", true), _cache[158] || (_cache[158] = _createTextVNode(")"))], 64))
19385                                  : _createCommentVNode("", true)], 2))
19386                              : _createCommentVNode("", true),
19387                            _cache[160] || (_cache[160] = _createElementVNode("small", { class: "hint" }, "يجب تفعيل صيغة json في SearXNG (search.formats). مهلة كل طلب 5 ثوانٍ.", -1))
19388                          ]))
19389                        : _createCommentVNode("", true),
19390                      _createElementVNode("section", _hoisted_296, [
19391                        _cache[167] || (_cache[167] = _createElementVNode("h3", null, "المفتاح العام لمحرك البحث", -1)),
19392                        _createElementVNode("label", _hoisted_297, [_withDirectives(_createElementVNode("input", {
19393                          type: "checkbox",
19394                          "onUpdate:modelValue": $event => ((research.settings.research_enabled) = $event)
19395                        }, null, 8, _hoisted_298), [[_vModelCheckbox, research.settings.research_enabled]]), _cache[161] || (_cache[161] = _createTextVNode(" تفعيل محرك البحث"))]),
19396                        _createElementVNode("label", { class: _normalizeClass(["checkLine", {disabledLine:research.readiness_summary.ready_count<1&&!research.settings.research_auto}]) }, [_withDirectives(_createElementVNode("input", {
19397                          type: "checkbox",
19398                          "onUpdate:modelValue": $event => ((research.settings.research_auto) = $event),
19399                          disabled: research.readiness_summary.ready_count<1&&!research.settings.research_auto
19400                        }, null, 8, _hoisted_299), [[_vModelCheckbox, research.settings.research_auto]]), _cache[162] || (_cache[162] = _createTextVNode(" السماح للتشغيل التلقائي للنطاقات المفعلة"))], 2),
19401                        (research.readiness_summary.ready_count<1)
19402                          ? (_openBlock(), _createElementBlock("small", _hoisted_300, "المفتاح العام مقفول حتى ينجح اختبار حي حديث في نطاق واحد على الأقل. بعد ذلك يعمل كل نطاق وفق جاهزيته وسياسته فقط."))
19403                          : _createCommentVNode("", true),
19404                        _createElementVNode("label", _hoisted_301, [_withDirectives(_createElementVNode("input", {
19405                          type: "checkbox",
19406                          "onUpdate:modelValue": $event => ((research.settings.research_live_access) = $event)
19407                        }, null, 8, _hoisted_302), [[_vModelCheckbox, research.settings.research_live_access]]), _cache[163] || (_cache[163] = _createTextVNode(" استخدام نتائج ويب حية"))]),
19408                        _createElementVNode("div", _hoisted_303, [_withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((research.settings.research_model) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(modelOptions(research.settings.research_model), (m) => {
19409                          return (_openBlock(), _createElementBlock("option", {
19410                            key: 'research-'+m,
19411                            value: m
19412                          }, _toDisplayString(m), 9, _hoisted_305))
19413                        }), 128))], 8, _hoisted_304), [[_vModelSelect, research.settings.research_model]]), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((research.settings.research_reasoning) = $event) }, _cache[164] || (_cache[164] = [_createElementVNode("option", { value: "low" }, "Reasoning منخفض", -1), _createElementVNode("option", { value: "medium" }, "Reasoning متوسط", -1), _createElementVNode("option", { value: "high" }, "Reasoning مرتفع", -1)]), 8, _hoisted_306), [[_vModelSelect, research.settings.research_reasoning]])]),
19414                        _createElementVNode("label", _hoisted_307, [_
19414cache[165] || (_cache[165] = _createTextVNode("النطاقات المسموحة — اتركها فارغة عادةً")), _withDirectives(_createElementVNode("textarea", {
19415                          "onUpdate:modelValue": $event => ((research.settings.research_allowed_domains) = $event),
19416                          placeholder: "فارغ = كل المصادر ما عدا المحظورة"
19417                        }, null, 8, _hoisted_308), [[_vModelText, research.settings.research_allowed_domains]])]),
19418                        _cache[168] || (_cache[168] = _createElementVNode("p", { class: "hint aiDomainWarning" }, [_createTextVNode("تنبيه: أي نطاق يُكتب هنا "), _createElementVNode("b", null, "يقصر البحث عليه وحده"), _createTextVNode(" ويرفض أي مقترح من مصدر آخر. لإضافة مصدر موثوق لا تكتبه هنا؛ اتركه فارغاً وضع غير المرغوب فيه في «المحظورة».")], -1)),
19419                        (String(research.settings.research_allowed_domains||'').trim())
19420                          ? (_openBlock(), _createElementBlock("p", _hoisted_309, "البحث الآن مقصور على: " + _toDisplayString(research.settings.research_allowed_domains) + " — معظم المقترحات ستُرفض.", 1))
19421                          : _createCommentVNode("", true),
19422                        _createElementVNode("label", _hoisted_310, [_cache[166] || (_cache[166] = _createTextVNode("النطاقات المحظورة، مفصولة بفواصل")), _withDirectives(_createElementVNode("textarea", {
19423                          "onUpdate:modelValue": $event => ((research.settings.research_blocked_domains) = $event),
19424                          placeholder: "reddit.com, quora.com"
19425                        }, null, 8, _hoisted_311), [[_vModelText, research.settings.research_blocked_domains]])]),
19426                        _createElementVNode("button", {
19427                          class: "btn",
19428                          onClick: saveAi
19429                        }, "حفظ الاتصال والمفتاح العام", 8, _hoisted_312)
19430                      ]),
19431                      _createElementVNode("section", _hoisted_313, [
19432                        _createElementVNode("div", _hoisted_314, [_createElementVNode("div", null, [_createElementVNode("span", _hoisted_315, _toDisplayString(currentHub.icon) + " إعداد خاص بالقسم", 1), _createElementVNode("h3", null, "جدول وحدود " + _toDisplayString(currentHub.short), 1)]), _cache[169] || (_cache[169] = _createElementVNode("span", { class: "statusPill" }, "لا نشر تلقائي", -1))]),
19433                        _createElementVNode("label", _hoisted_316, [_withDirectives(_createElementVNode("input", {
19434                          type: "checkbox",
19435                          "onUpdate:modelValue": $event => ((research.automation.policy.auto_enabled) = $event),
19436                          disabled: !!research.automation.policy.paused_reason
19437                        }, null, 8, _hoisted_317), [[_vModelCheckbox, research.automation.policy.auto_enabled]]), _cache[170] || (_cache[170] = _createTextVNode(" تشغيل هذا القسم تلقائياً"))]),
19438                        _createElementVNode("div", _hoisted_318, [_createElementVNode("label", _hoisted_319, [_cache[171] || (_cache[171] = _createTextVNode("الفاصل الزمني")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((research.automation.policy.interval_hours) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(research.automation.options.interval_hours, (n) => {
19439                          return (_openBlock(), _createElementBlock("option", {
19440                            key: 'interval-'+n,
19441                            value: n
19442                          }, _toDisplayString(n===168?'كل أسبوع':n===72?'كل 3 أيام':'كل '+n+' ساعة'), 9, _hoisted_321))
19443                        }), 128))], 8, _hoisted_320), [[
19444                          _vModelSelect,
19445                          research.automation.policy.interval_hours,
19446                          void 0,
19447                          { number: true }
19448                        ]])]), _createElementVNode("label", _hoisted_322, [_cache[172] || (_cache[172] = _createTextVNode("أقصى مقترحات للمهمة")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((research.automation.policy.max_results) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(12, (n) => {
19449                          return (_openBlock(), _createElementBlock("option", {
19450                            key: 'domain-max-'+n,
19451                            value: n
19452                          }, _toDisplayString(n), 9, _hoisted_324))
19453                        }), 128))], 8, _hoisted_323), [[
19454                          _vModelSelect,
19455                          research.automation.policy.max_results,
19456                          void 0,
19457                          { number: true }
19458                        ]])])]),
19459                        _createElementVNode("div", _hoisted_325, [_createElementVNode("label", _hoisted_326, [_cache[173] || (_cache[173] = _createTextVNode("حد التشغيل التلقائي يومياً")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((research.automation.policy.daily_run_limit) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(research.automation.options.daily_run_limit, (n) => {
19460                          return (_openBlock(), _createElementBlock("option", {
19461                            key: 'daily-'+n,
19462                            value: n
19463                          }, _toDisplayString(n), 9, _hoisted_328))
19464                        }), 128))], 8, _hoisted_327), [[
19465                          _vModelSelect,
19466                          research.automation.policy.daily_run_limit,
19467                          void 0,
19468                          { number: true }
19469                        ]])]), _createElementVNode("label", _hoisted_329, [_cache[174] || (_cache[174] = _createTextVNode("سقف كل مهام الشهر")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((research.automation.policy.monthly_run_limit) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(research.automation.options.monthly_run_limit, (n) => {
19470                          return (_openBlock(), _createElementBlock("option", {
19471                            key: 'monthly-'+n,
19472                            value: n
19473                          }, _toDisplayString(n) + " مهمة", 9, _hoisted_331))
19474                        }), 128))], 8, _hoisted_330), [[
19475                          _vModelSelect,
19476                          research.automation.policy.monthly_run_limit,
19477                          void 0,
19478                          { number: true }
19479                        ]])])]),
19480                        _createElementVNode("label", _hoisted_332, [_cache[175] || (_cache[175] = _createTextVNode("الإيقاف بعد إخفاقات متتالية")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((research.automation.policy.failure_pause_threshold) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(research.automation.options.failure_pause_threshold, (n) => {
19481                          return (_openBlock(), _createElementBlock("option", {
19482                            key: 'failure-'+n,
19483                            value: n
19484                          }, _toDisplayString(n) + " إخفاق", 9, _hoisted_334))
19485                        }), 128))], 8, _hoisted_333), [[
19486                          _vModelSelect,
19487                          research.automation.policy.failure_pause_threshold,
19488                          void 0,
19489                          { number: true }
19490                        ]])]),
19491                        _cache[176] || (_cache[176] = _createElementVNode("div", { class: "aiBoundaryNote" }, [_createElementVNode("b", null, "Flow التشغيل:"), _createTextVNode(" جاهزية حية ← مفتاح عام ← جدول القسم ← حدود يومية وشهرية ← إيقاف وقائي عند الفشل. جميع النتائج تبقى في صندوق المراجعة.")], -1)),
19492                        _createElementVNode("div", _hoisted_335, [_createElementVNode("button", {
19493                          class: "btn",
19494                          onClick: $event => (saveAutomation(false))
19495                        }, "حفظ سياسة القسم", 8, _hoisted_336), (research.automation.policy.paused_reason)
19496                          ? (_openBlock(), _createElementBlock("button", {
19497                              key: 0,
19498                              class: "btn secondary",
19499                              onClick: $event => (saveAutomation(true))
19500                            }, "استئناف النطاق بعد المعالجة", 8, _hoisted_337))
19501                          : _createCommentVNode("", true)])
19502                      ]),
19503                      _createElementVNode("details", _hoisted_338, [_cache[179] || (_cache[179] = _createElementVNode("summary", null, [_createElementVNode("b", null, "أداة صياغة مسودة يدوية"), _createElementVNode("span", null, "اختيارية")], -1)), _createElementVNode("div", _hoisted_339, [
19504                        _cache[178] || (_cache[178] = _createElementVNode("p", { class: "hint" }, "هذه الأداة للصياغة فقط ولا تنشر محتوى.", -1)),
19505                        _withDirectives(_createElementVNode("textarea", {
19506                          "onUpdate:modelValue": $event => ((aiInput) = $event),
19507                          placeholder: "اكتب معلومات خام ليحوّلها AI إلى مسودة"
19508                        }, null, 8, _hoisted_340), [[_vModelText, aiInput]]),
19509                        _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((aiMode) = $event) }, _cache[177] || (_cache[177] = [
19510                          _createElementVNode("option", { value: "describe" }, "صياغة وصف", -1),
19511                          _createElementVNode("option", { value: "translate" }, "ترجمة", -1),
19512                          _createElementVNode("option", { value: "summary" }, "تلخيص", -1),
19513                          _createElementVNode("option", { value: "tags" }, "كلمات بحث", -1)
19514                        ]), 8, _hoisted_341), [[_vModelSelect, aiMode]]),
19515                        _createElementVNode("button", {
19516                          class: "btn secondary",
19517                          onClick: generateAi
19518                        }, "توليد مسودة", 8, _hoisted_342),
19519                        aiOutput
19520                          ? (_openBlock(), _createElementBlock("pre", _hoisted_343, _toDisplayString(aiOutput), 1))
19521                          : _createCommentVNode("", true)
19522                      ])])
19523                    ], 64))
19524              ]))
19525      ]),
19526      _: 1
19527    }, 8, ["title"]))
19528  }
19529}
19530})()
19531  };
19532
19533  const AdminChinaGuidePage={
19534    components:{AdminFrame},
19535    setup(){
19536      const store=useGzcStore();const router=useRouter();const route=useRoute();
19537      function adminHub(){const p=String(route.path||'');if(p.indexOf('/admin/trade-shipping')===0)return 'trade_shipping';if(p.indexOf('/admin/sudan-digital')===0)return 'sudan_digital';return 'china_guide';}
19538      function adminBase(){return adminHub()==='trade_shipping'?'/api/admin/trade-shipping':(adminHub()==='sudan_digital'?'/api/admin/sudan-digital':'/api/admin/china-guide');}
19539      const verificationDueOnly=computed(()=>String((route.query||{}).verification||'')==='due');
19540      function adminApiPath(){return adminBase()+(verificationDueOnly.value?'?verification=due':'');}
19541      async function clearVerificationFilter(){const query={...(route.query||{})};delete query.verification;await router.replace({path:route.path,query}).catch(()=>{});await load();}
19542      function publicPath(){return adminHub()==='trade_shipping'?'/trade-shipping':(adminHub()==='sudan_digital'?'/sudan-digital':'/china-guide');}
19543      function adminTitle(){return adminHub()==='trade_shipping'?'إدارة التجارة والشحن':(adminHub()==='sudan_digital'?'إدارة بوابة السودان الرقمية':'إدارة دليلك في الصين');}
19544      function adminDesc(){return adminHub()==='trade_shipping'?'محتوى المصادر والجمارك والشحن بين السودان والصين.':(adminHub()==='sudan_digital'?'التطبيقات والمنصات السودانية الموثقة.':'خدمات الحياة داخل الصين: أسواق، مطاعم، صحة، سكن ومواصلات.');}
19545      function sectionIcon(){return adminHub()==='trade_shipping'?'🚢':(adminHub()==='sudan_digital'?'🇸🇩':'
19545🧭');}
19546      function aiResearchPath(){return '/admin/ai-research?workspace=review&hub='+encodeURIComponent(adminHub());}
19547      const requestedWorkspace=String((route.query||{}).workspace||'items');
19548      const workspace=ref(['items','categories','feedback'].includes(requestedWorkspace)?requestedWorkspace:'items');
19549      const data=reactive({categories:[],items:[],suggestions:[],reports:[],stats:{total:0,published:0,verified:0,missing_image:0,missing_source:0,image_coverage_percent:100},demand:[],search_quality:{model_version:1,search_count:0,zero_result_count:0,nonzero_result_count:0,image_result_search_count:0,verified_result_search_count:0,result_open_count:0,search_success_rate:0,image_result_rate:0,result_open_rate:0,top_opened:[]},operations:{model_version:1,total:0,by_kind:{content_gap:0,source_gap:0,image_gap:0},priorities:[]},governance:null});
19550      const queryText=ref(''),categoryFilter=ref('all'),serviceFilter=ref('all'),statusFilter=ref('all'),visibleLimit=ref(24),feedbackLimit=ref(20);
19551      const editorOpen=ref(false),removeImageOnSave=ref(false),reviewOpen=reactive({}),focusedTask=ref('');
19552      const catForm=reactive({name_ar:'',name_en:'',name_zh:'',slug:'',icon:'🧭',sort_order:100,hub_key:adminHub()});
19553      const emptyItem=()=>({id:'',category_id:'',hub_key:adminHub(),direction:'general',service_type:'general',company_sector_key:null,verification_status:'pending',source_name:'',source_url:'',trust_tier:'community_listed',trust_note:'',exhibition_start_date:'',exhibition_end_date:'',exhibition_sector:'',registration_url:'',title_ar:'',title_en:'',title_zh:'',summary_ar:'',description_ar:'',city:'Guangzhou',district:'',address_ar:'',address_zh:'',phone:'',wechat_id:'',whatsapp:'',map_url:'',image_url:'',image_thumb_url:'',tags:'',visibility:'public',status:'draft',is_recommended:false,governance_status:'draft',governance_note:''});
19554      const itemForm=reactive(emptyItem());
19555      // Registry-driven option lists for the editor (company sectors, trade services).
19556      const registrySectors=ref([]);const registryTradeServices=ref([]);
19557      async function loadRegistryOptions(){
19558        if(adminHub()==='china_guide'){const r=await api('/api/admin/taxonomy/sectors',{feedback:false});if(r&&r.ok)registrySectors.value=safeArray(r.sectors).filter(x=>x.active);}
19559        if(adminHub()==='trade_shipping'){const r=await api('/api/china-guide/trade-meta',{feedback:false});if(r&&r.ok)registryTradeServices.value=safeArray(r.services);}
19560      }
19561      const itemImageFile=ref(null),itemImageLabel=ref('لم يتم اختيار صورة'),itemImagePreview=ref(''),itemImagePreviewFailed=ref(false),itemImageInputKey=ref(0),adminBrokenImages=reactive({});
19562      const itemImageSuggestion=ref(null),itemImageSuggestBusy=ref(false);
19563      let imageSuggestionPollTimer=null;
19564      function stopImageSuggestionPoll(){if(imageSuggestionPollTimer){clearInterval(imageSuggestionPollTimer);imageSuggestionPollTimer=null;}}
19565      async function pollImageSuggestion(){
19566        const id=itemForm.id,sid=itemImageSuggestion.value&&itemImageSuggestion.value.id;
19567        if(!id||!sid||!editorOpen.value){stopImageSuggestionPoll();return;}
19568        const r=await api(adminBase()+'/items/'+encodeURIComponent(id)+'/image/suggestions/'+encodeURIComponent(sid),{feedback:false});
19569        if(!r.ok||!r.suggestion||String(itemForm.id)!==String(id))return;
19570        itemImageSuggestion.value=r.suggestion;
19571        if(['not_found','failed'].includes(r.suggestion.image_status)||r.suggestion.image_status==='ready'&&r.suggestion.dedup_status!=='unchecked')stopImageSuggestionPoll();
19572      }
19573      function startImageSuggestionPoll(){
19574        stopImageSuggestionPoll();
19575        if(!itemImageSuggestion.value||!['pending','fetching','ready'].includes(itemImageSuggestion.value.image_status))return;
19576        if(itemImageSuggestion.value.image_status==='ready'&&itemImageSuggestion.value.dedup_status!=='unchecked')return;
19577        imageSuggestionPollTimer=setInterval(()=>pollImageSuggestion().catch(()=>{}),4000);
19578        pollImageSuggestion().catch(()=>{});
19579      }
19580      async function loadEditorImageSuggestion(id){
19581        const r=await api(adminBase()+'/items/'+encodeURIComponent(id)+'/image/suggest',{feedback:false});
19582        if(r.ok&&r.suggestion&&String(itemForm.id)===String(id)){itemImageSuggestion.value=r.suggestion;startImageSuggestionPoll();}
19583      }
19584      const itemImageDisplay=computed(()=>((!itemImagePreviewFailed.value&&itemImagePreview.value)||(!removeImageOnSave.value&&(itemForm.image_thumb_url||itemForm.image_url))||''));
19585      const serviceOptions=computed(()=>Array.from(new Set(data.items.map(x=>String(x.service_type||'general')))).sort());
19586      function adminCategoryIs(key){
19587        const c=data.categories.find(
19588          x=>String(x.id)===String(itemForm.category_id)
19589        )||{};
19590
19591        if(String(c.category_key||'')===String(key)){
19592          return true;
19593        }
19594
19595        return String(key)==='exhibitions'
19596          && String(c.slug||'')==='china-exhibitions-conferences';
19597      }
19598      const filteredItems=computed(()=>{
19599        const text=String(queryText.value||'').trim().toLocaleLowerCase();
19600        return data.items.filter(x=>{
19601          if(categoryFilter.value!=='all'&&String(x.category_id||'')!==String(categoryFilter.value))return false;
19602          if(adminHub()!=='china_guide'&&serviceFilter.value!=='all'&&String(x.service_type||'')!==serviceFilter.value)return false;
19603          if(statusFilter.value!=='all'&&String(x.status||'draft')!==statusFilter.value)return false;
19604          if(!text)return true;
19605          return [x.title_ar,x.title_en,x.title_zh,x.summary_ar,x.city,x.district,x.tags,x.source_name].some(v=>String(v||'').toLocaleLowerCase().includes(text));
19606        });
19607      });
19608      const visibleItems=computed(()=>filteredItems.value.slice(0,visibleLimit.value));
19609      const itemStats=computed(()=>({total:data.items.length,published:data.items.filter(x=>x.status==='published').length,draft:data.items.filter(x=>x.status!=='published').length,images:data.items.filter(x=>x.image_url).length}));
19610      const pendingFeedback=computed(()=>data.suggestions.filter(x=>x.status==='pending').length+data.reports.filter(x=>x.status==='open').length);
19611      function prioritized(rows,target){const list=safeArray(rows);const hit=list.find(x=>String(x.id)===String(target||''));return (hit?[hit,...list.filter(x=>x!==hit)]:list).slice(0,feedbackLimit.value);}
19612      const visibleSuggestions=computed(()=>prioritized(data.suggestions,(route.query||{}).suggestion));
19613      const visibleReports=computed(()=>prioritized(data.reports,(route.query||{}).report));
19614      function itemStatusLabel(v){return ({draft:'مسودة',published:'منشور',archived:'مؤرشف'}[String(v||'')])||String(v||'-');}
19615      function verificationLabel(v){return ({verified:'موثق',pending:'قيد التحقق',review:'يحتاج مراجعة',archived:'مؤرشف'}[String(v||'')])||String(v||'-');}
19616      function serviceLabel(v){return ({general:'عام',health:'صحة',transport:'مواصلات',housing:'سكن',finance:'مالي',markets:'أسواق',exhibitions:'معارض ومؤتمرات',restaurants:'مطاعم',hotels:'فنادق وإقامة',education:'تعليم',services:'خدمات',emergency:'طوارئ',tips:'نصائح',apps:'تطبيقات',official_links:'روابط رسمية',documents:'مستندات',customs:'جمارك',shipping:'شحن',clearance:'تخليص',ports:'موانئ',export:'تصدير',import:'استيراد',warnings:'تحذيرات',government:'حكومي',investment:'استثمار',legal:'قانوني',diaspora:'مغتربون'}[String(v||'')])||String(v||'-');}
19617      function demandLabel(x){const intent=({markets:'أسواق',exhibitions:'معارض ومؤتمرات',restaurants:'مطاعم',hotels:'فنادق',hospitals:'مستشفيات',transport:'مواصلات',banking:'بنوك ودفع',residence:'إقامة وتأشيرات',services:'خدمات وترجمة',shipping:'شحن',education:'تعليم',government:'خدمات حكومية',emergency:'طوارئ',clearance:'تخليص',customs:'جمارك',documents:'مستندات الشحن',ports:'موانئ',export:'تصدير',import:'استيراد',warnings:'تنبيهات',unclassified:'طلب مصنف بالخدمة'}[String(x&&x.intent_key||'')])||String(x&&x.intent_key||'طلب');return [intent,x&&x.city_key,adminHub()==='china_guide'?'':serviceLabel(x&&x.service_type)].filter(v=>v&&v!=='-').join(' · ');}
19618      function priorityKindLabel(v){return ({content_gap:'محتوى مطلوب',source_gap:'مصدر ناقص',image_gap:'صورة ناقصة'}[String(v||'')])||'تحسين';}
19619      function priorityLevelLabel(v){return ({urgent:'عاجل',high:'مرتفع',medium:'متوسط',normal:'عادي'}[String(v||'')])||'عادي';}
19620      function priorityMeta(x){return [x&&x.city_key,adminHub()==='china_guide'?'':serviceLabel(x&&x.service_type),x&&x.kind==='content_gap'&&x&&x.intent_key&&x.intent_key!=='unclassified'?x.intent_key:''].filter(v=>v&&v!=='-').join(' · ');}
19621      function openGuidePriority(x){if(!x)return;if(x.action==='edit_item'&&x.item_id){const item=data.items.find(v=>String(v.id)===String(x.item_id));if(item){openEditor(item);return;}}if(x.action==='research_content')router.push(aiResearchPath());}
19622      function clearItemImageSelection(){if(String(itemImagePreview.value||'').startsWith('blob:'))URL.revokeObjectURL(itemImagePreview.value);itemImageFile.value=null;itemImagePreview.value='';itemImagePreviewFailed.value=false;itemImageLabel.value='لم يتم اختيار صورة';itemImageInputKey.value++;}
19623      function resetItem(){stopImageSuggestionPoll();clearItemImageSelection();itemImageSuggestion.value=null;itemImageSuggestBusy.value=false;removeImageOnSave.value=false;Object.assign(itemForm,emptyItem());}
19624      function setWorkspace(key){if(!['items','categories','feedback'].includes(key))return;workspace.value=key;editorOpen.value=false;resetItem();router.replace({path:route.path,query:{workspace:key}}).catch(()=>{});}
19625      function openEditor(x=null,updateRoute=true){resetItem();if(x){Object.keys(itemForm).forEach(k=>{if(Object.prototype.hasOwnProperty.call(x,k))itemForm[k]=x[k]});itemForm.category_id=x.category_id||'';itemForm.is_recommended=!!x.is_recommended;}workspace.value='items';editorOpen.value=true;if(x&&x.id&&adminHub()!=='sudan_digital')loadEditorImageSuggestion(x.id).catch(()=>{});if(updateRoute)router.replace({path:route.path,query:{workspace:'items',...(x&&x.id?{item:x.id}:{})}}).catch(()=>{});}
19626      async function closeEditor(){editorOpen.value=false;resetItem();await router.replace({path:route.path,query:{workspace:'items'}}).catch(()=>{});}
19627      function toggleReview(kind,x){reviewOpen[kind+'-'+x.id]=!reviewOpen[kind+'-'+x.id];}
19628      async function syncRouteTarget(){
19629        const qy=route.query||{},targetItem=String(qy.item||''),targetReport=String(qy.report||''),targetSuggestion=String(qy.suggestion||'');
19630        if(targetItem){workspace.value='items';const row=data.items.find(x=>String(x.id)===targetItem);if(row&&!editorOpen.value)openEditor(row,false);focusedTask.value='item-'+targetItem;}
19631        else if(targetReport||targetSuggestion){workspace.value='feedback';
19631const kind=targetReport?'report':'suggestion',id=targetReport||targetSuggestion;reviewOpen[kind+'-'+id]=true;focusedTask.value=kind+'-'+id;await nextTick();const el=document.querySelector('[data-task-id="'+kind+'-'+id.replace(/[^0-9]/g,'')+'"]');if(el)el.scrollIntoView({behavior:'smooth',block:'center'});}
19632      }
19633      async function load(){store.state.busy=true;const r=await api(adminApiPath());if(r.status===401){store.state.busy=false;router.replace('/admin/login');return;}data.categories=safeArray(r.categories);data.items=safeArray(r.items);data.suggestions=safeArray(r.suggestions);data.reports=safeArray(r.reports);data.stats=r.stats||data.stats;data.demand=safeArray(r.demand);data.search_quality=r.search_quality||data.search_quality;data.search_quality.top_opened=safeArray(data.search_quality.top_opened);data.operations=r.operations||data.operations;data.operations.priorities=safeArray(data.operations.priorities);data.governance=r.governance||null;store.state.busy=false;await syncRouteTarget();}
19634      async function saveCategory(){if(!catForm.name_ar){store.state.msg='اكتب اسم القسم';return;}store.state.busy=true;catForm.hub_key=adminHub();const r=await api(adminBase()+'/categories',{method:'POST',body:JSON.stringify(catForm)});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok){Object.assign(catForm,{name_ar:'',name_en:'',name_zh:'',slug:'',icon:sectionIcon(),sort_order:100,hub_key:adminHub()});await load();}}
19635      function onItemImage(e){const f=(e.target.files&&e.target.files[0])||null;if(!f){clearItemImageSelection();return;}if(f.size>20*1024*1024){clearItemImageSelection();store.state.msg='حجم الصورة أكبر من 20MB. اختر صورة أصغر';return;}clearItemImageSelection();removeImageOnSave.value=false;itemImageFile.value=f;itemImageLabel.value=f.name;itemImagePreview.value=URL.createObjectURL(f);}
19636      function markItemImagePreviewBroken(){if(itemImagePreview.value&&!itemImagePreviewFailed.value){itemImagePreviewFailed.value=true;return;}itemForm.image_thumb_url='';itemForm.image_url='';}
19637      function adminItemImage(x){return [x&&x.image_thumb_url,x&&x.image_url].find(url=>url&&!adminBrokenImages[String(url)])||'';}
19638      function markAdminImageBroken(x){const url=adminItemImage(x);if(url)adminBrokenImages[String(url)]=true;}
19639      function stageImageRemoval(){if(!itemForm.id||!itemForm.image_url)return;removeImageOnSave.value=!removeImageOnSave.value;if(removeImageOnSave.value)clearItemImageSelection();}
19640      async function uploadItemImage(itemId){const fd=new FormData();fd.append('file',itemImageFile.value);return uploadApi(adminBase()+'/items/'+encodeURIComponent(itemId)+'/image',{method:'POST',body:fd,headers:{Accept:'application/json'},uploadLabel:'رفع صورة المحتوى'});}
19641      async function suggestItemImage(){
19642        if(!itemForm.id){store.state.msg='احفظ العنصر أولاً ثم اطلب استجلاب الصورة';return;}
19643        if(adminHub()==='sudan_digital'){store.state.msg='مساعد الصور غير مفعّل لبوابة السودان حالياً';return;}
19644        if(!String(itemForm.source_url||'').match(/^https?:\/\//i)){store.state.msg='أضف رابط مصدر صالح واحفظ العنصر أولاً';return;}
19645        const saved=data.items.find(x=>String(x.id)===String(itemForm.id));
19646        if(saved&&String(saved.source_url||'')!==String(itemForm.source_url||'')){store.state.msg='احفظ رابط المصدر الجديد أولاً ثم أعد استجلاب الصورة';return;}
19647        itemImageSuggestBusy.value=true;store.state.msg='يجري البحث عن صورة مرتبطة بالمصدر...';
19648        const r=await api(adminBase()+'/items/'+encodeURIComponent(itemForm.id)+'/image/suggest',{method:'POST'});
19649        itemImageSuggestBusy.value=false;store.state.msg=r.message||r.error||'';
19650        if(r.suggestion){itemImageSuggestion.value=r.suggestion;startImageSuggestionPoll();}
19651      }
19652      function suggestedItemImage(){const s=itemImageSuggestion.value||{};return s.image_thumb_url||s.image_url||'';}
19653      function openSuggestedItemImageSource(){const s=itemImageSuggestion.value||{};const url=s.image_source_url||s.source_url||'';if(url)window.open(url,'_blank','noopener,noreferrer');}
19654      function suggestedItemImageSourceLabel(){const s=itemImageSuggestion.value||{},m=s.image_meta||{};if(m.ai_search)return 'Grok Image Search';if(m.ai_generated)return 'صورة مولدة بالذكاء الاصطناعي';if(s.image_source_url)return 'صورة من المصدر';return 'مصدر الصورة';}
19655      async function approveSuggestedItemImage(){const s=itemImageSuggestion.value||{};if(!s.id||!itemForm.id)return;itemImageSuggestBusy.value=true;store.state.msg='جارٍ اعتماد الصورة فقط...';const r=await api(adminBase()+'/items/'+encodeURIComponent(itemForm.id)+'/image/suggestions/'+encodeURIComponent(s.id)+'/approve',{method:'POST'});itemImageSuggestBusy.value=false;store.state.msg=r.message||r.error||'';if(r.ok){itemImageSuggestion.value=null;if(r.item){itemForm.image_url=r.item.image_url||'';itemForm.image_thumb_url=r.item.image_thumb_url||'';}await load();const row=data.items.find(x=>String(x.id)===String(itemForm.id));if(row)openEditor(row,false);}}
19656      async function rejectSuggestedItemImage(){const s=itemImageSuggestion.value||{};if(!s.id||!itemForm.id)return;itemImageSuggestBusy.value=true;const r=await api(adminBase()+'/items/'+encodeURIComponent(itemForm.id)+'/image/suggestions/'+encodeURIComponent(s.id)+'/reject',{method:'POST'});itemImageSuggestBusy.value=false;store.state.msg=r.message||r.error||'';if(r.ok)itemImageSuggestion.value=null;}
19657      async function retrySuggestedItemImage(){const s=itemImageSuggestion.value||{};if(s.id&&s.image_status==='ready')await rejectSuggestedItemImage();if(!itemImageSuggestion.value||['not_found','failed'].includes(s.image_status))await suggestItemImage();}
19658      async function saveItem(){
19659        if(!String(itemForm.title_ar||'').trim()){store.state.msg='اكتب عنوان العنصر';return;}
19660        store.state.busy=true;itemForm.hub_key=adminHub();const hadImage=!!itemForm.image_url,selectedFile=itemImageFile.value;const url=itemForm.id?adminBase()+'/items/'+encodeURIComponent(itemForm.id):adminBase()+'/items';const r=await api(url,{method:'POST',body:JSON.stringify(itemForm)});
19661        if(!r.ok){store.state.busy=false;store.state.msg=r.message||r.error||'تعذر حفظ العنصر';return;}
19662        const itemId=(r.item&&r.item.id)||itemForm.id;let mediaResult={ok:true};
19663        if(selectedFile)mediaResult=await uploadItemImage(itemId);else if(removeImageOnSave.value&&hadImage)mediaResult=await api(adminBase()+'/items/'+encodeURIComponent(itemId)+'/image/remove',{method:'POST'});
19664        if(!mediaResult.ok){itemForm.id=itemId;store.state.busy=false;store.state.msg='حُفظت البيانات، لكن تعذر إكمال معالجة الصورة: '+(mediaResult.message||mediaResult.error||'خطأ غير معروف');return;}
19665        store.state.busy=false;store.state.msg=selectedFile?'تم حفظ كل البيانات والصورة وضبطها تلقائياً':(removeImageOnSave.value?'تم حفظ العنصر وإزالة الصورة':'تم حفظ العنصر');await closeEditor();await load();
19666      }
19667      async function archiveItem(){if(!itemForm.id||!confirm('أرشفة هذا العنصر وإزالته من القوائم النشطة؟'))return;store.state.busy=true;const r=await api(adminBase()+'/items/'+encodeURIComponent(itemForm.id)+'/archive',{method:'POST'});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok){await closeEditor();await load();}}
19668      async function governance(action){if(!itemForm.id)return;let note='';if(['reject','approve','reverify'].includes(action))note=prompt(action==='reject'?'سبب الإرجاع للمسودة:':'ملاحظة الحوكمة (اختياري):')||'';if(action==='reject'&&!note)return;store.state.busy=true;const r=await api('/api/admin/sudan-digital/items/'+encodeURIComponent(itemForm.id)+'/governance',{method:'POST',body:JSON.stringify({action,note})});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok&&r.item)Object.assign(itemForm,r.item);if(r.ok)await load();}
19669      async function reviewReward(kind,x,action){let note='';if(action==='reject'){note=prompt('سبب الرفض:')||'';if(!note)return;}store.state.busy=true;const endpoint=kind==='suggestion'?'/api/admin/china-guide/suggestions/':'/api/admin/china-guide/reports/';const r=await api(endpoint+encodeURIComponent(x.id)+'/review',{method:'POST',body:JSON.stringify({action,note})});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok)await load();}
19670      onMounted(async()=>
19670{if(await store.requireAdmin(router)){await load();loadRegistryOptions();}});
19671      onUnmounted(()=>{stopImageSuggestionPoll();clearItemImageSelection();});
19672      watch(()=>route.fullPath,async()=>{if(data.items.length)await syncRouteTarget();});
19673      return {registrySectors,registryTradeServices,store,data,workspace,queryText,categoryFilter,serviceFilter,statusFilter,visibleLimit,feedbackLimit,editorOpen,removeImageOnSave,reviewOpen,focusedTask,catForm,itemForm,itemImageFile,itemImageLabel,itemImagePreview,itemImagePreviewFailed,itemImageInputKey,itemImageDisplay,itemImageSuggestion,itemImageSuggestBusy,verificationDueOnly,safeImageErrorText,serviceOptions,adminCategoryIs,filteredItems,visibleItems,itemStats,pendingFeedback,visibleSuggestions,visibleReports,load,clearVerificationFilter,resetItem,setWorkspace,openEditor,closeEditor,toggleReview,saveCategory,saveItem,onItemImage,markItemImagePreviewBroken,adminItemImage,markAdminImageBroken,clearItemImageSelection,stageImageRemoval,suggestItemImage,suggestedItemImage,openSuggestedItemImageSource,suggestedItemImageSourceLabel,approveSuggestedItemImage,rejectSuggestedItemImage,retrySuggestedItemImage,archiveItem,governance,reviewReward,adminHub,adminTitle,adminDesc,publicPath,sectionIcon,aiResearchPath,itemStatusLabel,verificationLabel,serviceLabel,demandLabel,priorityKindLabel,priorityLevelLabel,priorityMeta,openGuidePriority,shortDate};
19674    },
19675    render:(function(){
19676const _Vue = Vue
19677const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
19678
19679const _hoisted_1 = { class: "card adminContentHero" }
19680const _hoisted_2 = { class: "adminHeroActions" }
19681const _hoisted_3 = ["onClick"]
19682const _hoisted_4 = ["onClick"]
19683const _hoisted_5 = {
19684  class: "card adminWorkspaceTabs",
19685  "aria-label": "أقسام إدارة المحتوى"
19686}
19687const _hoisted_6 = ["onClick"]
19688const _hoisted_7 = ["onClick"]
19689const _hoisted_8 = ["onClick"]
19690const _hoisted_9 = {
19691  key: 0,
19692  class: "card adminQueuePurpose"
19693}
19694const _hoisted_10 = ["onClick"]
19695const _hoisted_11 = { class: "adminContentMetrics" }
19696const _hoisted_12 = {
19697  key: 0,
19698  class: "card guideOperationsPanel"
19699}
19700const _hoisted_13 = { class: "adminSectionLead" }
19701const _hoisted_14 = { class: "statusPill" }
19702const _hoisted_15 = {
19703  key: 0,
19704  class: "guidePriorityList"
19705}
19706const _hoisted_16 = { class: "guidePriorityRank" }
19707const _hoisted_17 = { key: 0 }
19708const _hoisted_18 = ["onClick"]
19709const _hoisted_19 = {
19710  key: 1,
19711  class: "hint"
19712}
19713const _hoisted_20 = {
19714  key: 1,
19715  class: "card guideEnrichmentPanel"
19716}
19717const _hoisted_21 = { class: "adminSectionLead" }
19718const _hoisted_22 = ["onClick"]
19719const _hoisted_23 = { class: "guideEnrichmentStats" }
19720const _hoisted_24 = {
19721  key: 0,
19722  class: "guideDemandList"
19723}
19724const _hoisted_25 = {
19725  key: 1,
19726  class: "hint"
19727}
19728const _hoisted_26 = {
19729  key: 2,
19730  class: "card guideQualityPanel"
19731}
19732const _hoisted_27 = { class: "adminSectionLead" }
19733const _hoisted_28 = { class: "statusPill" }
19734const _hoisted_29 = { class: "guideQualityStats" }
19735const _hoisted_30 = {
19736  key: 0,
19737  class: "guideTopOpened"
19738}
19739const _hoisted_31 = {
19740  key: 1,
19741  class: "hint"
19742}
19743const _hoisted_32 = {
19744  key: 3,
19745  class: "card compactGovernanceSummary"
19746}
19747const _hoisted_33 = { class: "card adminContentToolbar" }
19748const _hoisted_34 = { class: "adminSearchField" }
19749const _hoisted_35 = ["onUpdate:modelValue", "onInput"]
19750const _hoisted_36 = ["onUpdate:modelValue", "onChange"]
19751const _hoisted_37 = ["value"]
19752const _hoisted_38 = ["onUpdate:modelValue", "onChange"]
19753const _hoisted_39 = ["value"]
19754const _hoisted_40 = ["onUpdate:modelValue", "onChange"]
19755const _hoisted_41 = ["onClick"]
19756const _hoisted_42 = {
19757  key: 4,
19758  class: "card emptyCard"
19759}
19760const _hoisted_43 = { class: "adminCompactList" }
19761const _hoisted_44 = ["onClick"]
19762const _hoisted_45 = { class: "adminCompactThumb" }
19763const _hoisted_46 = ["src", "alt", "onError"]
19764const _hoisted_47 = { key: 1 }
19765const _hoisted_48 = { class: "adminCompactCopy" }
19766const _hoisted_49 = { class: "adminCompactTitle" }
19767const _hoisted_50 = { key: 0 }
19768const _hoisted_51 = { class: "adminCompactState" }
19769const _hoisted_52 = ["onClick"]
19770const _hoisted_53 = ["onClick"]
19771const _hoisted_54 = {
19772  key: 2,
19773  class: "adminCategoryWorkspace"
19774}
19775const _hoisted_55 = {
19776  key: 0,
19777  class: "card formCard adminCategoryComposer"
19778}
19779const _hoisted_56 = { class: "formTwo" }
19780const _hoisted_57 = ["onUpdate:modelValue"]
19781const _hoisted_58 = ["onUpdate:modelValue"]
19782const _hoisted_59 = { class: "formTwo" }
19783const _hoisted_60 = ["onUpdate:modelValue"]
19784const _hoisted_61 = ["onUpdate:modelValue"]
19785const _hoisted_62 = { class: "formTwo" }
19786const _hoisted_63 = ["onUpdate:modelValue"]
19787const _hoisted_64 = ["onUpdate:modelValue"]
19788const _hoisted_65 = ["onClick"]
19789const _hoisted_66 = { class: "card adminCategoryList" }
19790const _hoisted_67 = {
19791  key: 3,
19792  class: "adminFeedbackWorkspace"
19793}
19794const _hoisted_68 = { class: "card adminSectionLead" }
19795const _hoisted_69 = { class: "statusPill" }
19796const _hoisted_70 = {
19797  key: 0,
19798  class: "compactReviewGroup"
19799}
19800const _hoisted_71 = ["data-task-id"]
19801const _hoisted_72 = ["onClick"]
19802const _hoisted_73 = {
19803  key: 0,
19804  class: "compactReviewBody"
19805}
19806const _hoisted_74 = { class: "notifyMeta" }
19807const _hoisted_75 = { dir: "ltr" }
19808const _hoisted_76 = {
19809  key: 0,
19810  class: "row"
19811}
19812const _hoisted_77 = ["onClick"]
19813const _hoisted_78 = ["onClick"]
19814const _hoisted_79 = {
19815  key: 1,
19816  class: "compactReviewGroup"
19817}
19818const _hoisted_80 = ["data-task-id"]
19819const _hoisted_81 = ["onClick"]
19820const _hoisted_82 = {
19821  key: 0,
19822  class: "compactReviewBody"
19823}
19824const _hoisted_83 = { class: "notifyMeta" }
19825const _hoisted_84 = { dir: "ltr" }
19826const _hoisted_85 = {
19827  key: 0,
19828  class: "row"
19829}
19830const _hoisted_86 = ["onClick"]
19831const _hoisted_87 = ["onClick"]
19832const _hoisted_88 = {
19833  key: 2,
19834  class: "card emptyCard"
19835}
19836const _hoisted_89 = ["onClick"]
19837const _hoisted_90 = ["onClick"]
19838const _hoisted_91 = {
19839  class: "adminEditorShell",
19840  role: "dialog",
19841  "aria-modal": "true",
19842  "aria-label": "محرر العنصر"
19843}
19844const _hoisted_92 = { class: "adminEditorHeader" }
19845const _hoisted_93 = { class: "vueBadge" }
19846const _hoisted_94 = ["onClick"]
19847const _hoisted_95 = {
19848  type: "submit",
19849  form: "guide-item-editor",
19850  class: "btn"
19851}
19852const _hoisted_96 = ["onSubmit"]
19853const _hoisted_97 = { class: "adminFormSection" }
19854const _hoisted_98 = { class: "editorMediaAndNames" }
19855const _hoisted_99 = { class: "editorMediaField" }
19856const _hoisted_100 = { class: "guideImageAdminPreview" }
19857const _hoisted_101 = ["src", "alt", "onError"]
19858const _hoisted_102 = { key: 1 }
19859const _hoisted_103 = { key: 2 }
19860const _hoisted_104 = { class: "filePicker guideImagePicker" }
19861const _hoisted_105 = ["onChange"]
19862const _hoisted_106 = { class: "row" }
19863const _hoisted_107 = ["onClick"]
19864const _hoisted_108 = ["onClick"]
19865const _hoisted_109 = {
19866  key: 0,
19867  class: "guideImageAssistBox"
19868}
19869const _hoisted_110 = ["disabled", "onClick"]
19870const _hoisted_111 = {
19871  key: 0,
19872  class: "guideImageSuggestionPreview"
19873}
19874const _hoisted_112 = ["src", "alt"]
19875const _hoisted_113 = { key: 1 }
19876const _hoisted_114 = { key: 0 }
19877const _hoisted_115 = { key: 1 }
19878const _hoisted_116 = { key: 2 }
19879const _hoisted_117 = {
19880  key: 3,
19881  class: "row"
19882}
19883const _hoisted_118 = ["onClick"]
19884const _hoisted_119 = ["disabled", "onClick"]
19885const _hoisted_120 = ["disabled", "onClick"]
19886const _hoisted_121 = ["disabled", "onClick"]
19887const _hoisted_122 = {
19888  key: 4,
19889  class: "row"
19890}
19891const _hoisted_123 = ["disabled", "onClick"]
19892const _hoisted_124 = ["disabled", "onClick"]
19893const _hoisted_125 = { class: "editorNameFields" }
19894const _hoisted_126 = { class: "fieldLabel" }
19895const _hoisted_127 = ["onUpdate:modelValue"]
19896const _hoisted_128 = { class: "fieldLabel" }
19897const _hoisted_129 = ["onUpdate:modelValue"]
19898const _hoisted_130 = { class: "fieldLabel" }
19899const _hoisted_131 = ["onUpdate:modelValue"]
19900const _hoisted_132 = { class: "fieldLabel" }
19901const _hoisted_133 = ["onUpdate:modelValue"]
19902const _hoisted_134 = { class: "fieldLabel" }
19903const _hoisted_135 = ["onUpdate:modelValue"]
19904const _hoisted_136 = { class: "adminFormSection" }
19905const _hoisted_137 = { class: "formTwo" }
19906const _hoisted_138 = { class: "fieldLabel" }
19907const _hoisted_139 = ["onUpdate:modelValue"]
19908const _hoisted_140 = ["value"]
19909const _hoisted_141 = { class: "fieldLabel" }
19910const _hoisted_142 = ["onUpdate:modelValue"]
19911const _hoisted_143 = {
19912  key: 0,
19913  class: "formTwo"
19914}
19915const _hoisted_144 = { class: "fieldLabel" }
19916const _hoisted_145 = ["onUpdate:modelValue"]
19917const _hoisted_146 = ["value"]
19918const _hoisted_147 = ["value"]
19919const _hoisted_148 = {
19920  key: 1,
19921  class: "formTwo"
19922}
19923const _hoisted_149 = { class: "fieldLabel" }
19924const _hoisted_150 = ["onUpdate:modelValue"]
19925const _hoisted_151 = { class: "fieldLabel" }
19926const _hoisted_152 = ["onUpdate:modelValue"]
19927const _hoisted_153 = ["value"]
19928const _hoisted_154 = {
19929  key: 2,
19930  class: "formTwo"
19931}
19932const _hoisted_155 = { class: "fieldLabel" }
19933const _hoisted_156 = ["onUpdate:modelValue"]
19934const _hoisted_157 = { class: "fieldLabel" }
19935const _hoisted_158 = ["onUpdate:modelValue"]
19936const _hoisted_159 = {
19937  key: 3,
19938  class: "formTwo"
19939}
19940const _hoisted_160 = { class: "fieldLabel" }
19941const _hoisted_161 = ["onUpdate:modelValue"]
19942const _hoisted_162 = { class: "fieldLabel" }
19943const _hoisted_163 = ["onUpdate:modelValue"]
19944const _hoisted_164 = { class: "formTwo" }
19945const _hoisted_165 = { class: "fieldLabel" }
19946const _hoisted_166 = ["onUpdate:modelValue"]
19947const _hoisted_167 = { class: "fieldLabel" }
19948const _hoisted_168 = ["onUpdate:modelValue"]
19949const _hoisted_169 = {
19950  key: 0,
19951  class: "adminExhibitionFields"
19952}
19953const _hoisted_170 = { class: "formTwo" }
19954const _hoisted_171 = { class: "fieldLabel" }
19955const _hoisted_172 = ["onUpdate:modelValue"]
19956const _hoisted_173 = { class: "fieldLabel" }
19957const _hoisted_174 = ["onUpdate:modelValue"]
19958const _hoisted_175 = { class: "formTwo" }
19959const _hoisted_176 = { class: "fieldLabel" }
19960const _hoisted_177 = ["onUpdate:modelValue"]
19961const _hoisted_178 = { class: "fieldLabel" }
19962const _hoisted_179 = ["onUpdate:modelValue"]
19963const _hoisted_180 = { class: "fieldLabel" }
19964const _hoisted_181 = ["onUpdate:modelValue"]
19965const _hoisted_182 = { class: "adminFormSection" }
19966const _hoisted_183 = { class: "adminFormSectionHead" }
19967const _hoisted_184 = { class: "formTwo" }
19968const _hoisted_185 = { class: "fieldLabel" }
19969const _hoisted_186 = ["onUpdate:modelValue", "onChange"]
19970const _hoisted_187 = ["value"]
19971const _hoisted_188 = { class: "fieldLabel" }
19972const _hoisted_189 = ["onUpdate:modelValue"]
19973const _hoisted_190 = ["value"]
19974const _hoisted_191 = { class: "fieldLabel" }
19975const _hoisted_192 = ["onUpdate:modelValue"]
19976const _hoisted_193 = { class: "fieldLabel" }
19977const _hoisted_194 = ["onUpdate:modelValue"]
19978const _hoisted_195 = { class: "formTwo" }
19979const _hoisted_196 = { class: "fieldLabel" }
19980const _hoisted_197 = ["onUpdate:modelValue"]
19981const _hoisted_198 = { class: "fieldLabel" }
19982const _hoisted_199 = ["onUpdate:modelValue"]
19983const _hoisted_200 = { class: "formTwo" }
19984const _hoisted_201 = { class: "fieldLabel" }
19985const _hoisted_202 = ["onUpdate:modelValue"]
19986const _hoisted_203 = { class: "fieldLabel" }
19987const _hoisted_204 = ["onUpdate:modelValue"]
19988const _hoisted_205 = {
19989  key: 1,
19990  class: "fieldLabel"
19991}
19992const _hoisted_206 = ["onUpdate:modelValue"]
19993const _hoisted_207 = { class: "formTwo" }
19994const _hoisted_208 = { class: "fieldLabel" }
19995const _hoisted_209 = ["onUpdate:modelValue"]
19996const _hoisted_210 = ["value"]
19997const _hoisted_211 = { class: "fieldLabel" }
19998const _hoisted_212 = ["onUpdate:modelValue"]
19999const _hoisted_213 = ["value"]
20000const _hoisted_214 = { class: "checkLine" }
20001const _hoisted_215 = ["onUpdate:modelValue"]
20002const _hoisted_216 = {
20003  key: 0,
20004  class: "adminFormSection governanceEditorSection"
20005}
20006const _hoisted_217 = { class: "adminFormSectionHead" }
20007const _hoisted_218 = { class: "row" }
20008const _hoisted_219 = ["onClick"]
20009const _hoisted_220 = ["onClick"]
20010const _hoisted_221 = ["onClick"]
20011const _hoisted_222 = ["onClick"]
20012const _hoisted_223 = ["onClick"]
20013const _hoisted_224 = ["onClick"]
20014const _hoisted_225 = { class: "adminEditorFooter" }
20015const _hoisted_226 = {
20016  key: 0,
20017  class: "editorDangerMenu"
20018}
20019const _hoisted_227 = ["onClick"]
20020const _hoisted_228 = ["onClick"]
20021const _hoisted_229 = {
20022  type: "submit",
20023  class: "btn"
20024}
20025
20026return function render(_ctx, _cache) {
20027  with (_ctx) {
20028    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, normalizeClass: _normalizeClass, renderList: _renderList, Fragment: _Fragment, vModelText: _vModelText, withDirectives: _withDirectives, vModelSelect: _vModelSelect, vModelCheckbox: _vModelCheckbox, withModifiers: _withModifiers, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
20029
20030    const _component_AdminFrame = _resolveComponent("AdminFrame")
20031
20032    return (_openBlock(), _createBlock(_component_AdminFrame, { title: adminTitle() }, {
20033      default: _withCtx(() => [
20034        _createElementVNode("section", _hoisted_1, [_createElementVNode("div", null, [_cache[0] || (_cache[0] = _createElementVNode("span", { class: "vueBadge" }, "مساحة إدارة المحتوى", -1)), _createElementVNode("h3", null, [_createElementVNode("span", null, _toDisplayString(sectionIcon()), 1), _createTextVNode(" " + _toDisplayString(adminTitle()), 1)]), _createElementVNode("p", null, _toDisplayString(adminDesc()), 1)]), _createElementVNode("div", _hoisted_2, [_createElementVNode("button", {
20035          class: "smallbtn secondary",
20036          onClick: $event => ($router.push(publicPath()))
20037        }, "معاينة الصفحة", 8, _hoisted_3), (adminHub()!=='sudan_digital')
20038          ? (_openBlock(), _createElementBlock("button", {
20039              key: 0,
20040              class: "smallbtn",
20041              onClick: $event => ($router.push(aiResearchPath()))
20042            }, "إدارة محتوى AI", 8, _hoisted_4))
20043          : _createCommentVNode("", true)])]),
20044        _createElementVNode("nav", _hoisted_5, [_createElementVNode("button", {
20045          class: _normalizeClass({active:workspace==='items'}),
20046          onClick: $event => (setWorkspace('items'))
20047        }, [_cache[1] || (_cache[1] = _createElementVNode("span", null, "▦", -1)), _cache[2] || (_cache[2] = _createElementVNode("b", null, "العناصر", -1)), _createElementVNode("small", null, _toDisplayString(data.items.length), 1)], 10, _hoisted_6), _createElementVNode("button", {
20048          class: _normalizeClass({active:workspace==='categories'}),
20049          onClick: $event => (setWorkspace('categories'))
20050        }, [_cache[3] || (_cache[3] = _createElementVNode("span", null, "⌗", -1)), _cache[4] || (_cache[4] = _createElementVNode("b", null, "الأقسام", -1)), _createElementVNode("small", null, _toDisplayString(data.categories.length), 1)], 10, _hoisted_7), _createElementVNode("button", {
20051          class: _normalizeClass({active:workspace==='feedback'}),
20052          onClick: $event => (setWorkspace('feedback'))
20053        }, [_cache[5] || (_cache[5] = _createElementVNode("span", null, "◉", -1)), _cache[6] || (_cache[6] = _createElementVNode("b", null, "الملاحظات", -1)), _createElementVNode("small", null, _toDisplayString(pendingFeedback), 1)], 10, _hoisted_8)]),
20054        (verificationDueOnly&&workspace==='items')
20055          ? (_openBlock(), _createElementBlock("section", _hoisted_9, [_cache[7] || (_cache[7] = _createElementVNode("div", null, [_createElementVNode("b", null, "فلتر: التوثيق المستحق"), _createElementVNode("span", null, "هذه القائمة تعرض فقط العناصر المنشورة التي تجاوزت موعد إعادة التحقق.")], -1)), _createElementVNode("button", {
20056              class: "smallbtn secondary",
20057              onClick: clearVerificationFilter
20058            }, "عرض كل العناصر", 8, _hoisted_10)]))
20059          : _createCommentVNode("", true),
20060        (workspace==='items')
20061          ? (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [
20062              _createElementVNode("section", _hoisted_11, [
20063                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(itemStats.total), 1), _cache[8] || (_cache[8] = _createElementVNode("small", null, "كل العناصر", -1))]),
20064                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(itemStats.published), 1
20064), _cache[9] || (_cache[9] = _createElementVNode("small", null, "منشور", -1))]),
20065                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(data.stats.image_coverage_percent) + "%", 1), _cache[10] || (_cache[10] = _createElementVNode("small", null, "تغطية الصور", -1))]),
20066                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(data.stats.missing_image||0), 1), _cache[11] || (_cache[11] = _createElementVNode("small", null, "منشور بلا صورة", -1))])
20067              ]),
20068              (adminHub()!=='sudan_digital')
20069                ? (_openBlock(), _createElementBlock("section", _hoisted_12, [_createElementVNode("div", _hoisted_13, [_cache[12] || (_cache[12] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "ابدأ من هنا"), _createElementVNode("h3", null, "أولويات التحسين الآن"), _createElementVNode("p", null, "مرتبة من الخادم حسب الطلب الفعلي، نقص المصدر، نقص الصورة واستخدام نتائج البحث. لا ننشئ مهام مكررة ولا نخزن كلمات البحث الخام.")], -1)), _createElementVNode("span", _hoisted_14, _toDisplayString(data.operations.total||0) + " أولوية", 1)]), ((data.operations.priorities||[]).length)
20070                    ? (_openBlock(), _createElementBlock("div", _hoisted_15, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(data.operations.priorities.slice(0,6), (x, i) => {
20071                        return (_openBlock(), _createElementBlock("article", {
20072                          key: 'priority-'+x.kind+'-'+(x.item_id||i),
20073                          class: _normalizeClass(['guidePriorityItem','priority-'+x.priority])
20074                        }, [_createElementVNode("span", _hoisted_16, _toDisplayString(i+1), 1), _createElementVNode("div", null, [_createElementVNode("p", null, [_createElementVNode("b", null, _toDisplayString(x.kind==='content_gap'?demandLabel(x):x.title), 1), _createElementVNode("em", null, _toDisplayString(priorityKindLabel(x.kind)) + " · " + _toDisplayString(priorityLevelLabel(x.priority)), 1)]), _createElementVNode("small", null, _toDisplayString(x.reason), 1), (priorityMeta(x))
20075                          ? (_openBlock(), _createElementBlock("i", _hoisted_17, _toDisplayString(priorityMeta(x)), 1))
20076                          : _createCommentVNode("", true)]), _createElementVNode("button", {
20077                          class: "smallbtn",
20078                          onClick: $event => (openGuidePriority(x))
20079                        }, _toDisplayString(x.action==='edit_item'?'فتح العنصر':'فتح البحث والتحسين'), 9, _hoisted_18)], 2))
20080                      }), 128))]))
20081                    : (_openBlock(), _createElementBlock("p", _hoisted_19, "لا توجد أولويات تشغيلية ظاهرة الآن. هذا أفضل من ملء الشاشة بأرقام لا تحتاج إجراء."))]))
20082                : _createCommentVNode("", true),
20083              (adminHub()!=='sudan_digital')
20084                ? (_openBlock(), _createElementBlock("section", _hoisted_20, [_createElementVNode("div", _hoisted_21, [_cache[13] || (_cache[13] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "تحسين الدليل"), _createElementVNode("h3", null, "فجوات المحتوى والصور"), _createElementVNode("p", null, "البيانات مجمعة حسب نوع الطلب والمدينة فقط؛ لا نحفظ عبارة بحث المستخدم أو هويته.")], -1)), _createElementVNode("button", {
20085                    class: "smallbtn",
20086                    onClick: $event => ($router.push(aiResearchPath()))
20087                  }, "فتح مقترحات AI", 8, _hoisted_22)]), _createElementVNode("div", _hoisted_23, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(data.stats.missing_image||0), 1), _cache[14] || (_cache[14] = _createElementVNode("small", null, "عنصر منشور يحتاج صورة", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(data.stats.missing_source||0), 1), _cache[15] || (_cache[15] = _createElementVNode("small", null, "عنصر يحتاج مصدر", -1))]), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(data.demand.length), 1), _cache[16] || (_cache[16] = _createElementVNode("small", null, "فجوات طلب مصنفة", -1))])]), (data.demand.length)
20088                    ? (_openBlock(), _createElementBlock("div", _hoisted_24, [_cache[17] || (_cache[17] = _createElementVNode("h4", null, "أكثر ما لم يجد نتيجة — آخر 30 يوماً", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(data.demand, (x) => {
20089                        return (_openBlock(), _createElementBlock("span", { key: x.intent_key+'-'+x.city_key+'-'+x.service_type }, [_createElementVNode("b", null, _toDisplayString(demandLabel(x)), 1), _createElementVNode("small", null, _toDisplayString(x.zero_result_count) + " محاولة بدون نتيجة", 1)]))
20090                      }), 128))]))
20091                    : (_openBlock(), _createElementBlock("p", _hoisted_25, "لا توجد فجوات بحث مصنفة حالياً."))]))
20092                : _createCommentVNode("", true),
20093              (adminHub()!=='sudan_digital')
20094                ? (_openBlock(), _createElementBlock("section", _hoisted_26, [_createElementVNode("div", _hoisted_27, [_cache[18] || (_cache[18] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "جودة البحث"), _createElementVNode("h3", null, "هل يجد المستخدم ما يريد؟"), _createElementVNode("p", null, "مؤشرات مجمعة لآخر 30 يوماً؛ لا كلمات بحث خام ولا هوية مستخدم.")
20094], -1)), _createElementVNode("span", _hoisted_28, _toDisplayString(data.search_quality.search_count||0) + " بحث", 1)]), _createElementVNode("div", _hoisted_29, [
20095                    _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(data.search_quality.search_success_rate||0) + "%", 1), _cache[19] || (_cache[19] = _createElementVNode("small", null, "بحث وجد نتيجة", -1))]),
20096                    _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(data.search_quality.result_open_rate||0) + "%", 1), _cache[20] || (_cache[20] = _createElementVNode("small", null, "فتح نتيجة من البحث", -1))]),
20097                    _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(data.search_quality.image_result_rate||0) + "%", 1), _cache[21] || (_cache[21] = _createElementVNode("small", null, "بحث ظهر معه صورة", -1))]),
20098                    _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(data.search_quality.zero_result_count||0), 1), _cache[22] || (_cache[22] = _createElementVNode("small", null, "بحث بدون نتيجة", -1))])
20099                  ]), ((data.search_quality.top_opened||[]).length)
20100                    ? (_openBlock(), _createElementBlock("div", _hoisted_30, [_cache[23] || (_cache[23] = _createElementVNode("h4", null, "أكثر النتائج فتحاً من البحث", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(data.search_quality.top_opened, (x) => {
20101                        return (_openBlock(), _createElementBlock("span", { key: 'opened-'+x.id }, [_createElementVNode("b", null, _toDisplayString(x.title_ar||x.title_en), 1), _createElementVNode("small", null, [_createTextVNode(_toDisplayString(x.search_open_count) + " فتح · " + _toDisplayString(adminHub()==='china_guide'?(x.category_name_ar||'دليلك في الصين'):serviceLabel(x.service_type)), 1), (x.city)
20102                          ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createTextVNode(" · " + _toDisplayString($cityLabel(x.city)), 1)], 64))
20103                          : _createCommentVNode("", true)])]))
20104                      }), 128))]))
20105                    : (_openBlock(), _createElementBlock("p", _hoisted_31, "لا توجد بيانات فتح نتائج كافية بعد."))]))
20106                : _createCommentVNode("", true),
20107              (adminHub()==='sudan_digital'&&data.governance)
20108                ? (_openBlock(), _createElementBlock("section", _hoisted_32, [_createElementVNode("b", null, _toDisplayString(data.governance.policy), 1), _createElementVNode("span", null, _toDisplayString(data.governance.in_review) + " مراجعة · " + _toDisplayString(data.governance.approved) + " معتمد · " + _toDisplayString(data.governance.verification_due) + " تحقق مستحق", 1)]))
20109                : _createCommentVNode("", true),
20110              _createElementVNode("section", _hoisted_33, [
20111                _createElementVNode("div", _hoisted_34, [_cache[24] || (_cache[24] = _createElementVNode("span", null, "⌕", -1)), _withDirectives(_createElementVNode("input", {
20112                  "onUpdate:modelValue": $event => ((queryText) = $event),
20113                  onInput: $event => (visibleLimit=24),
20114                  placeholder: "ابحث بالاسم أو المدينة أو المصدر..."
20115                }, null, 40, _hoisted_35), [[_vModelText, queryText]])]),
20116                _withDirectives(_createElementVNode("select", {
20117                  "onUpdate:modelValue": $event => ((categoryFilter) = $event),
20118                  onChange: $event => (visibleLimit=24)
20119                }, [_cache[25] || (_cache[25] = _createElementVNode("option", { value: "all" }, "كل الأقسام", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(data.categories, (c) => {
20120                  return (_openBlock(), _createElementBlock("option", {
20121                    key: 'filter-cat-'+c.id,
20122                    value: String(c.id)
20123                  }, _toDisplayString(c.icon) + " " + _toDisplayString(c.name_ar), 9, _hoisted_37))
20124                }), 128))], 40, _hoisted_36), [[_vModelSelect, categoryFilter]]),
20125                (adminHub()!=='china_guide')
20126                  ? _withDirectives((_openBlock(), _createElementBlock("select", {
20127                      key: 0,
20128                      "onUpdate:modelValue": $event => ((serviceFilter) = $event),
20129                      onChange: $event => (visibleLimit=24)
20130                    }, [_cache[26] || (_cache[26] = _createElementVNode("option", { value: "all" }, "كل الأنواع", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(serviceOptions, (s) => {
20131                      return (_openBlock(), _createElementBlock("option", {
20132                        key: 'filter-service-'+s,
20133                        value: s
20134                      }, _toDisplayString(serviceLabel(s)), 9, _hoisted_39))
20135                    }), 128))], 40, _hoisted_38)), [[_vModelSelect, serviceFilter]])
20136                  : _createCommentVNode("", true),
20137                _withDirectives(_createElementVNode("select", {
20138                  "onUpdate:modelValue": $event => ((statusFilter) = $event),
20139                  onChange: $event => (visibleLimit=24)
20140                }, _cache[27] || (_cache[27] = [_createElementVNode("option", { value: "all" }, "كل الحالات", -1), _createElementVNode("option", { value: "published" }, "منشور", -1), _createElementVNode("option", { value: "draft" }, "مسودة", -1)]), 40, _hoisted_40), [[_vModelSelect, statusFilter]]),
20141                _createElementVNode("button", {
20142                  class: "btn adminAddItem",
20143                  onClick: $event => (openEditor())
20144                }, "+ عنصر جديد", 8, _hoisted_41)
20145              ]),
20146              (!visibleItems.length&&!store.state.busy)
20147                ? (_openBlock(), _createElementBlock("section", _hoisted_42, "لا توجد عناصر مطابقة للبحث."))
20148                : _createCommentVNode("", true),
20149              _createElementVNode("section", _hoisted_43, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(visibleItems, (x) => {
20150                return (_openBlock(), _createElementBlock("article", {
20151                  key: x.id,
20152                  class: _normalizeClass(["card adminCompactItem", {taskTarget:focusedTask==='item-'+String(x.id)}])
20153                }, [_createElementVNode("button", {
20154                  class: "adminCompactItemMain",
20155                  onClick: $event => (openEditor(x))
20156                }, [_createElementVNode("span", _hoisted_45, [(adminItemImage(x))
20157                  ? (_openBlock(), _createElementBlock("img", {
20158                      key: 0,
20159                      src: adminItemImage(x),
20160                      loading: "lazy",
20161                      alt: 'صورة '+x.title_ar,
20162                      onError: $event => (markAdminImageBroken(x))
20163                    }, null, 40, _hoisted_46))
20164                  : (_openBlock(), _createElementBlock("i", _hoisted_47, _toDisplayString(x.category_icon||sectionIcon()), 1))]), _createElementVNode("span", _hoisted_48, [_createElementVNode("span", _hoisted_49, [_createElementVNode("b", null, _toDisplayString(x.title_ar), 1), (x.is_recommended)
20165                  ? (_openBlock(), _createElementBlock("em", _hoisted_50, "موصى به"))
20166                  : _createCommentVNode("", true)]), _createElementVNode("small", null, [_createTextVNode(_toDisplayString(x.category_name_ar||'بدون قسم'), 1), (adminHub()==='china_guide')
20167                  ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createTextVNode(" · " + _toDisplayString($cityLabel(x.city)||'-'), 1)], 64))
20168                  : (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [_createTextVNode(" · " + _toDisplayString(serviceLabel(x.service_type)), 1
20168)], 64))]), _createElementVNode("p", null, _toDisplayString(x.summary_ar||'لا يوجد وصف مختصر.'), 1)]), _createElementVNode("span", _hoisted_51, [_createElementVNode("i", { class: _normalizeClass({published:x.status==='published'}) }, _toDisplayString(itemStatusLabel(x.status)), 3), _createElementVNode("small", null, _toDisplayString(verificationLabel(x.verification_status)), 1)])], 8, _hoisted_44), _createElementVNode("button", {
20169                  class: "smallbtn secondary adminCompactEdit",
20170                  onClick: $event => (openEditor(x))
20171                }, "تعديل", 8, _hoisted_52)], 2))
20172              }), 128))]),
20173              (visibleItems.length<filteredItems.length)
20174                ? (_openBlock(), _createElementBlock("button", {
20175                    key: 5,
20176                    class: "btn secondary loadMore",
20177                    onClick: $event => (visibleLimit+=24)
20178                  }, "عرض المزيد (" + _toDisplayString(filteredItems.length-visibleItems.length) + ")", 9, _hoisted_53))
20179                : _createCommentVNode("", true)
20180            ], 64))
20181          : (workspace==='categories')
20182            ? (_openBlock(), _createElementBlock("section", _hoisted_54, [(adminHub()!=='china_guide')
20183                ? (_openBlock(), _createElementBlock("section", _hoisted_55, [
20184                    _cache[28] || (_cache[28] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "تنظيم المحتوى"), _createElementVNode("h3", null, "إضافة قسم"), _createElementVNode("p", { class: "hint" }, "القسم ينظم العناصر والبحث؛ تعديل العنصر نفسه يتم من محرر العناصر.")], -1)),
20185                    _createElementVNode("div", _hoisted_56, [_withDirectives(_createElementVNode("input", {
20186                      "onUpdate:modelValue": $event => ((catForm.name_ar) = $event),
20187                      placeholder: "اسم القسم"
20188                    }, null, 8, _hoisted_57), [[_vModelText, catForm.name_ar]]), _withDirectives(_createElementVNode("input", {
20189                      "onUpdate:modelValue": $event => ((catForm.icon) = $event),
20190                      placeholder: "الأيقونة"
20191                    }, null, 8, _hoisted_58), [[_vModelText, catForm.icon]])]),
20192                    _createElementVNode("div", _hoisted_59, [_withDirectives(_createElementVNode("input", {
20193                      "onUpdate:modelValue": $event => ((catForm.slug) = $event),
20194                      placeholder: "slug"
20195                    }, null, 8, _hoisted_60), [[_vModelText, catForm.slug]]), _withDirectives(_createElementVNode("input", {
20196                      type: "number",
20197                      "onUpdate:modelValue": $event => ((catForm.sort_order) = $event),
20198                      placeholder: "الترتيب"
20199                    }, null, 8, _hoisted_61), [[_vModelText, catForm.sort_order]])]),
20200                    _createElementVNode("div", _hoisted_62, [_withDirectives(_createElementVNode("input", {
20201                      "onUpdate:modelValue": $event => ((catForm.name_en) = $event),
20202                      placeholder: "English"
20203                    }, null, 8, _hoisted_63), [[_vModelText, catForm.name_en]]), _withDirectives(_createElementVNode("input", {
20204                      "onUpdate:modelValue": $event => ((catForm.name_zh) = $event),
20205                      placeholder: "中文"
20206                    }, null, 8, _hoisted_64), [[_vModelText, catForm.name_zh]])]),
20207                    _createElementVNode("button", {
20208                      class: "btn",
20209                      onClick: saveCategory
20210                    }, "حفظ القسم", 8, _hoisted_65)
20211                  ]))
20212                : _createCommentVNode("", true), _createElementVNode("section", _hoisted_66, [_cache[29] || (_cache[29] = _createElementVNode("h3", null, "الأقسام الحالية", -1)), _createElementVNode("div", null, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(data.categories, (c) => {
20213                return (_openBlock(), _createElementBlock("span", { key: c.id }, [_createElementVNode("i", null, _toDisplayString(c.icon), 1), _createElementVNode("b", null, _toDisplayString(c.name_ar), 1), _createElementVNode("small", null, _toDisplayString(c.slug) + " · ترتيب " + _toDisplayString(c.sort_order), 1)]))
20214              }), 128))])])]))
20215            : (_openBlock(), _createElementBlock("section", _hoisted_67, [
20216                _createElementVNode("div", _hoisted_68, [_cache[30] || (_cache[30] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "مهام تحتاج قراراً"), _createElementVNode("h3", null, "الاقتراحات وبلاغات التصحيح"), _createElementVNode("p", null, "افتح السجل المطلوب فقط. بعد القبول أو الرفض تُحل المهمة ويختفي إشعارها تلقائياً.")], -1)), _createElementVNode("span", _hoisted_69, _toDisplayString(pendingFeedback) + " مفتوحة", 1)]),
20217                (adminHub()==='china_guide'&&visibleSuggestions.length)
20218                  ? (_openBlock(), _createElementBlock("section", _hoisted_70, [_cache[31] || (_cache[31] = _createElementVNode("h3", null, "اقتراحات الأعضاء", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(visibleSuggestions, (s) => {
20219                      return (_openBlock(), _createElementBlock("article", {
20220                        key: 's'+s.id,
20221                        class: _normalizeClass(["card compactReviewItem", {taskTarget:focusedTask==='suggestion-'+String(s.id),open:reviewOpen['suggestion-'+s.id]}]),
20222                        "data-task-id": 'suggestion-'+s.id
20223                      }, [_createElementVNode("button", {
20224                        class: "compactReviewHead",
20225                        onClick: $event => (toggleReview('suggestion',s))
20226                      }, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(s.title), 1), _createElementVNode("small", null, _toDisplayString(s.category||'بدون تصنيف') + " · " + _toDisplayString(shortDate(s.created_at)), 1)]), _createElementVNode("i", null, _toDisplayString(s.status), 1), _createElementVNode("em", null, _toDisplayString(reviewOpen['suggestion-'+s.id]?'−':'+'), 1)], 8, _hoisted_72), (reviewOpen['suggestion-'+s.id])
20227                        ? (_openBlock(), _createElementBlock("div", _hoisted_73, [_createElementVNode("p", null, _toDisplayString(s.details), 1), _createElementVNode("div", _hoisted_74, [_createElementVNode("span", null, _toDisplayString(s.member_name||'عضو'), 1), _createElementVNode("span", _hoisted_75, _toDisplayString(s.member_phone||'-'), 1)]), (s.status==='pending')
20228                            ? (_openBlock(), _createElementBlock("div", _hoisted_76, [_createElementVNode("button", {
20229                                class: "smallbtn",
20230                                onClick: $event => (reviewReward('suggestion',s,'accept'))
20231                              }, "قبول +5", 8, _hoisted_77), _createElementVNode("button", {
20232                                class: "smallbtn danger",
20233                                onClick: $event => (reviewReward('suggestion',s,'reject'))
20234                              }, "رفض", 8, _hoisted_78)]))
20235                            : _createCommentVNode("", true)]))
20236                        : _createCommentVNode("", true)], 10, _hoisted_71))
20237                    }), 128))]))
20238                  : _createCommentVNode("", true),
20239                (visibleReports.length)
20240                  ? (_openBlock(), _createElementBlock("section", _hoisted_79, [_cache[32] || (_cache[32] = _createElementVNode("h3", null, "بلاغات التصحيح", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(visibleReports, (r) => {
20241                      return (_openBlock(), _createElementBlock("article", {
20242                        key: 'r'+r.id,
20243                        class: _normalizeClass(["card compactReviewItem", {taskTarget:focusedTask==='report-'+String(r.id),open:reviewOpen['report-'+r.id]}]),
20244                        "data-task-id": 'report-'+r.id
20245                      }, [_createElementVNode("button", {
20246                        class: "compactReviewHead",
20247                        onClick: $event => (toggleReview('report',r))
20248                      }, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(r.item_title||'عنصر'), 1), _createElementVNode("small", null, _toDisplayString(r.member_name||'زائر') + " · " + _toDisplayString(shortDate(r.created_at)), 1)]), _createElementVNode("i", null, _toDisplayString(r.status), 1), _createElementVNode("em", null, _toDisplayString(reviewOpen['report-'+r.id]?'−':'+'), 1)], 8, _hoisted_81), (reviewOpen['report-'+r.id])
20249                        ? (_openBlock(), _createElementBlock("div", _hoisted_82, [_createElementVNode("p", null, _toDisplayString(r.message), 1), _createElementVNode("div", _hoisted_83, [_createElementVNode("span", null, _toDisplayString(r.member_name||'زائر'), 1), _createElementVNode("span", _hoisted_84, _toDisplayString(r.member_phone||'-'), 1)]), (r.status==='open')
20250                            ? (_openBlock(), _createElementBlock("div", _hoisted_85, [_createElementVNode("button", {
20251                                class: "smallbtn",
20252                                onClick: $event => (reviewReward('report',r,'accept'))
20253                              }, "قبول +2", 8, _hoisted_86), _createElementVNode("button", {
20254                                class: "smallbtn danger",
20255                                onClick: $event => (reviewReward('report',r,'reject'))
20256                              }, "رفض", 8, _hoisted_87)]))
20257                            : _createCommentVNode("", true)]))
20258                        : _createCommentVNode("", true)], 10, _hoisted_80))
20259                    }), 128))]))
20260                  : _createCommentVNode("", true),
20261                (!visibleSuggestions.length&&!visibleReports.length)
20262                  ? (_openBlock(), _createElementBlock("p", _hoisted_88, "لا توجد اقتراحات أو بلاغات حالياً."))
20263                  : _createCommentVNode("", true),
20264                (feedbackLimit<Math.max(data.suggestions.length,data.reports.length))
20265                  ? (_openBlock(), _createElementBlock("button", {
20266                      key: 3,
20267                      class: "btn secondary loadMore",
20268                      onClick: $event => (feedbackLimit+=20)
20269                    }, "عرض المزيد", 8, _hoisted_89))
20270                  : _createCommentVNode("", true)
20271              ])),
20272        editorOpen
20273          ? (_openBlock(), _createElementBlock("div", {
20274              key: 4,
20275              class: "adminEditorBackdrop",
20276              onClick: _withModifiers(closeEditor, ["self"])
20277            }, [_createElementVNode("section", _hoisted_91, [_createElementVNode("header", _hoisted_92, [_createElementVNode("div", null, [_createElementVNode("span", _hoisted_93, _toDisplayString(itemForm.id?'تعديل العنصر #'+itemForm.id:'عنصر جديد'), 1), _createElementVNode("h3", null, _toDisplayString(itemForm.title_ar||'إضافة المحتوى والصورة'), 1), _cache[33] || (_cache[33] = _createElementVNode("p", null, "كل بيانات العنصر وصورته تُحفظ من هذا المحرر.", -1))]), _createElementVNode("div", null, [_createElementVNode("button", {
20278              type: "button",
20279              class: "smallbtn secondary",
20280              onClick: closeEditor
20281            }, "إغلاق", 8, _hoisted_94), _createElementVNode("button", _hoisted_95, _toDisplayString(itemForm.id?'حفظ كل التعديلات':'حفظ العنصر'), 1)])]), _createElementVNode("form", {
20282              id: "guide-item-editor",
20283              class: "adminEditorBody",
20284              onSubmit: _withModifiers(saveItem, ["prevent"])
20285            }, [
20286              _createElementVNode("section", _hoisted_97, [
20287                _cache[41] || (_cache[41] = _createElementVNode("div", { class: "adminFormSectionHead" }, [_createElementVNode("span", null, "1"), _createElementVNode("div", null, [_createElementVNode("h4", null, "المحتوى والصورة"), _createElementVNode("p", null, "الصورة جزء من العنصر وليست عملية منفصلة.")])], -1)),
20288                _createElementVNode("div", _hoisted_98, [_createElementVNode("div", _hoisted_99, [
20289                  _createElementVNode("div", _hoisted_100, [itemImageDisplay
20290                    ? (_openBlock(), _createElementBlock("img", {
20291                        key: 0,
20292                        src: itemImageDisplay,
20293                        alt: 'معاينة '+(itemForm.title_ar||'العنصر'),
20294                        onError: markItemImagePreviewBroken
20295                      }, null, 40, _hoisted_101))
20296                    : (_openBlock(), _createElementBlock("span", _hoisted_102, _toDisplayString(sectionIcon()), 1)), removeImageOnSave
20297                    ? (_openBlock(), _createElementBlock("i", _hoisted_103, "ستُزال عند الحفظ"))
20298                    : _createCommentVNode("", true)]),
20299                  _createElementVNode("label", _hoisted_104, [(_openBlock(), _createElementBlock("input", {
20300                    key: itemImageInputKey,
20301                    type: "file",
20302                    accept: "image/jpeg,image/png,image/webp,image/heic,image/heif,image/avif,image/gif,image/tiff,.jpe,.jfif,.heic,.heif,.avif,.tif,.tiff",
20303                    onChange: onItemImage
20304                  }, null, 40, _hoisted_105)), _createElementVNode("span", null, _toDisplayString(itemForm.image_url?'تغيير الصورة':'اختيار صورة'), 1), _createElementVNode("em", null, _toDisplayString(itemImageLabel), 1)]),
20305                  _createElementVNode("div", _hoisted_106, [itemImageFile
20306                    ? (_openBlock(), _createElementBlock("button", {
20307                        key: 0,
20308                        type: "button",
20309                        class: "smallbtn secondary",
20310                        onClick: clearItemImageSelection
20311                      }, "إلغاء المختارة", 8, _hoisted_107))
20312                    : _createCommentVNode("", true), (itemForm.id&&itemForm.image_url)
20313                    ? (_openBlock(), _createElementBlock("button", {
20314                        key: 1,
20315                        type: "button",
20316                        class: _normalizeClass(["smallbtn", {danger:!removeImageOnSave}]),
20317                        onClick: stageImageRemoval
20318                      }, _toDisplayString(removeImageOnSave?'التراجع عن الإزالة':'إزالة عند الحفظ'), 11, _hoisted_108))
20319                    : _createCommentVNode("", true)]),
20320                  _cache[35] || (_cache[35] = _createElementVNode("small", null, "تُصحح الاستدارة وتُحوّل إلى WebP تلقائياً — حتى 20MB.", -1)),
20321                  (itemForm.id&&adminHub()!=='sudan_digital')
20322                    ? (_openBlock(), _createElementBlock("div", _hoisted_109, [_cache[34] || (_cache[34] = _createElementVNode("div", null, [_createElementVNode("b", null, "مساعد الصورة"), _createElementVNode("small", null, "يبحث أولاً في مصدر العنصر ثم يستخدم Grok Image Search عند الحاجة. لا يغيّر الصورة المنشورة تلقائياً.")], -1)), _createElementVNode("button", {
20323                        type: "button",
20324                        class: "smallbtn secondary",
20325                        disabled: itemImageSuggestBusy,
20326                        onClick: suggestItemImage
20327                      }, _toDisplayString(itemImageSuggestBusy?'جارٍ الاستجلاب...':'استجلاب صورة'), 9, _hoisted_110), itemImageSuggestion
20328                        ? (_openBlock(), _createElementBlock("div", _hoisted_111, [(suggestedItemImage())
20329                            ? (_openBlock(), _createElementBlock("img", {
20330                                key: 0,
20331                                src: suggestedItemImage(),
20332                                alt: 'صورة مقترحة لـ '+(itemForm.title_ar||'العنصر')
20333                              }, null, 8, _hoisted_112))
20334                           
20334 : (_openBlock(), _createElementBlock("span", _hoisted_113, _toDisplayString(sectionIcon()), 1)), _createElementVNode("div", null, [
20335                            _createElementVNode("b", null, _toDisplayString(itemImageSuggestion.image_status==='ready'?'صورة مقترحة جاهزة للمراجعة':['pending','fetching'].includes(itemImageSuggestion.image_status)?'جارٍ البحث عن صورة':'لم تجهز صورة مناسبة'), 1),
20336                            (itemImageSuggestion.image_status==='ready')
20337                              ? (_openBlock(), _createElementBlock("small", _hoisted_114, "محفوظة في الحجر الآمن. اعتمادها يغيّر الصورة فقط ولا يعيد توثيق بيانات العنصر."))
20338                              : (_openBlock(), _createElementBlock("small", _hoisted_115, _toDisplayString(itemImageSuggestion.image_error?safeImageErrorText(itemImageSuggestion.image_error,itemImageSuggestion.image_status,itemImageSuggestion.image_meta):'يجري فحص المصدر والبحث عن الصور.'), 1)),
20339                            (itemImageSuggestion.image_status==='ready')
20340                              ? (_openBlock(), _createElementBlock("small", _hoisted_116, _toDisplayString(suggestedItemImageSourceLabel()), 1))
20341                              : _createCommentVNode("", true),
20342                            (itemImageSuggestion.image_status==='ready')
20343                              ? (_openBlock(), _createElementBlock("div", _hoisted_117, [
20344                                  _createElementVNode("button", {
20345                                    type: "button",
20346                                    class: "smallbtn secondary",
20347                                    onClick: openSuggestedItemImageSource
20348                                  }, "فتح المصدر", 8, _hoisted_118),
20349                                  _createElementVNode("button", {
20350                                    type: "button",
20351                                    class: "smallbtn",
20352                                    disabled: itemImageSuggestBusy||itemImageSuggestion.dedup_status!=='clear',
20353                                    onClick: approveSuggestedItemImage
20354                                  }, "اعتماد الصورة", 8, _hoisted_119),
20355                                  _createElementVNode("button", {
20356                                    type: "button",
20357                                    class: "smallbtn secondary",
20358                                    disabled: itemImageSuggestBusy,
20359                                    onClick: retrySuggestedItemImage
20360                                  }, "صورة أخرى", 8, _hoisted_120),
20361                                  _createElementVNode("button", {
20362                                    type: "button",
20363                                    class: "smallbtn danger",
20364                                    disabled: itemImageSuggestBusy,
20365                                    onClick: rejectSuggestedItemImage
20366                                  }, "رفض", 8, _hoisted_121)
20367                                ]))
20368                              : _createCommentVNode("", true),
20369                            (['not_found','failed'].includes(itemImageSuggestion.image_status))
20370                              ? (_openBlock(), _createElementBlock("div", _hoisted_122, [_createElementVNode("button", {
20371                                  type: "button",
20372                                  class: "smallbtn secondary",
20373                                  disabled: itemImageSuggestBusy,
20374                                  onClick: retrySuggestedItemImage
20375                                }, "إعادة المحاولة", 8, _hoisted_123), _createElementVNode("button", {
20376                                  type: "button",
20377                                  class: "smallbtn",
20378                                  disabled: itemImageSuggestBusy,
20379                                  onClick: rejectSuggestedItemImage
20380                                }, "إغلاق المحاولة", 8, _hoisted_124)]))
20381                              : _createCommentVNode("", true)
20382                          ])]))
20383                        : _createCommentVNode("", true)]))
20384                    : _createCommentVNode("", true)
20385                ]), _createElementVNode("div", _hoisted_125, [_createElementVNode("label", _hoisted_126, [_cache[36] || (_cache[36] = _createTextVNode("العنوان بالعربي")), _withDirectives(_createElementVNode("input", {
20386                  "onUpdate:modelValue": $event => ((itemForm.title_ar) = $event),
20387                  required: "",
20388                  placeholder: "مثال: سوق بايما للملابس"
20389                }, null, 8, _hoisted_127), [[_vModelText, itemForm.title_ar]])]), _createElementVNode("label", _hoisted_128, [_cache[37] || (_cache[37] = _createTextVNode("English title")), _withDirectives(_createElementVNode("input", {
20390                  "onUpdate:modelValue": $event => ((itemForm.title_en) = $event),
20391                  placeholder: "English title"
20392                }, null, 8, _hoisted_129), [[_vModelText, itemForm.title_en]])]), _createElementVNode("label", _hoisted_130, [_
20392cache[38] || (_cache[38] = _createTextVNode("中文标题")), _withDirectives(_createElementVNode("input", {
20393                  "onUpdate:modelValue": $event => ((itemForm.title_zh) = $event),
20394                  placeholder: "中文标题"
20395                }, null, 8, _hoisted_131), [[_vModelText, itemForm.title_zh]])])])]),
20396                _createElementVNode("label", _hoisted_132, [_cache[39] || (_cache[39] = _createTextVNode("الوصف المختصر")), _withDirectives(_createElementVNode("input", {
20397                  "onUpdate:modelValue": $event => ((itemForm.summary_ar) = $event),
20398                  placeholder: "سطر واضح يظهر في البطاقة"
20399                }, null, 8, _hoisted_133), [[_vModelText, itemForm.summary_ar]])]),
20400                _createElementVNode("label", _hoisted_134, [_cache[40] || (_cache[40] = _createTextVNode("التفاصيل")), _withDirectives(_createElementVNode("textarea", {
20401                  "onUpdate:modelValue": $event => ((itemForm.description_ar) = $event),
20402                  placeholder: "معلومات عملية ومختصرة للمستخدم"
20403                }, null, 8, _hoisted_135), [[_vModelText, itemForm.description_ar]])])
20404              ]),
20405              _createElementVNode("section", _hoisted_136, [
20406                _cache[73] || (_cache[73] = _createElementVNode("div", { class: "adminFormSectionHead" }, [_createElementVNode("span", null, "2"), _createElementVNode("div", null, [_createElementVNode("h4", null, "التصنيف والمصدر"), _createElementVNode("p", null, "حدد مكان ظهور المعلومة ومرجع التحقق.")])], -1)),
20407                _createElementVNode("div", _hoisted_137, [_createElementVNode("label", _hoisted_138, [_cache[43] || (_cache[43] = _createTextVNode("القسم")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((itemForm.category_id) = $event) }, [_cache[42] || (_cache[42] = _createElementVNode("option", { value: "" }, "بدون قسم", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(data.categories, (c) => {
20408                  return (_openBlock(), _createElementBlock("option", {
20409                    key: c.id,
20410                    value: c.id
20411                  }, _toDisplayString(c.icon) + " " + _toDisplayString(c.name_ar), 9, _hoisted_140))
20412                }), 128))], 8, _hoisted_139), [[_vModelSelect, itemForm.category_id]])]), _createElementVNode("label", _hoisted_141, [_cache[45] || (_cache[45] = _createTextVNode("حالة التوثيق")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((itemForm.verification_status) = $event) }, _cache[44] || (_cache[44] = [
20413                  _createElementVNode("option", { value: "verified" }, "موثق", -1),
20414                  _createElementVNode("option", { value: "pending" }, "قيد التحقق", -1),
20415                  _createElementVNode("option", { value: "review" }, "يحتاج مراجعة", -1),
20416                  _createElementVNode("option", { value: "archived" }, "مؤرشف", -1)
20417                ]), 8, _hoisted_142), [[_vModelSelect, itemForm.verification_status]])])]),
20418                (adminHub()==='china_guide' && registrySectors.length)
20419                  ? (_openBlock(), _createElementBlock("div", _hoisted_143, [_createElementVNode("label", _hoisted_144, [_cache[46] || (_cache[46] = _createTextVNode("قطاع الشركة (للشركات والخدمات التجارية)")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((itemForm.company_sector_key) = $event) }, [_createElementVNode("option", { value: null }, "بدون قطاع", 8, _hoisted_146), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(registrySectors, (sec) => {
20420                      return (_openBlock(), _createElementBlock("option", {
20421                        key: sec.sector_key,
20422                        value: sec.sector_key
20423                      }, _toDisplayString(sec.name_ar), 9, _hoisted_147))
20424                    }
20424), 128))], 8, _hoisted_145), [[_vModelSelect, itemForm.company_sector_key]])])]))
20425                  : _createCommentVNode("", true),
20426                (adminHub()==='trade_shipping')
20427                  ? (_openBlock(), _createElementBlock("div", _hoisted_148, [_createElementVNode("label", _hoisted_149, [_cache[48] || (_cache[48] = _createTextVNode("الاتجاه")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((itemForm.direction) = $event) }, _cache[47] || (_cache[47] = [_createElementVNode("option", { value: "general" }, "عام / الاتجاهين", -1), _createElementVNode("option", { value: "china_to_arab" }, "من الصين إلى الدول العربية", -1), _createElementVNode("option", { value: "arab_to_china" }, "من الدول العربية إلى الصين", -1)]), 8, _hoisted_150), [[_vModelSelect, itemForm.direction]])]), _createElementVNode("label", _hoisted_151, [_cache[59] || (_cache[59] = _createTextVNode("النوع")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((itemForm.service_type) = $event) }, [(registryTradeServices.length)
20428                      ? (_openBlock(true), _createElementBlock(_Fragment, { key: 0 }, _renderList(registryTradeServices, (svc) => {
20429                          return (_openBlock(), _createElementBlock("option", {
20430                            key: svc.service_type,
20431                            value: svc.service_type
20432                          }, _toDisplayString(svc.name_ar||svc.name_en), 9, _hoisted_153))
20433                        }), 128))
20434                      : (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [
20435                          _cache[49] || (_cache[49] = _createElementVNode("option", { value: "general" }, "عام", -1)),
20436                          _cache[50] || (_cache[50] = _createElementVNode("option", { value: "documents" }, "مستندات", -1)),
20437                          _cache[51] || (_cache[51] = _createElementVNode("option", { value: "customs" }, "جمارك", -1)),
20438                          _cache[52] || (_cache[52] = _createElementVNode("option", { value: "shipping" }, "شحن", -1)),
20439                          _cache[53] || (_cache[53] = _createElementVNode("option", { value: "clearance" }, "تخليص", -1)),
20440                          _cache[54] || (_cache[54] = _createElementVNode("option", { value: "ports" }, "موانئ", -1)),
20441                          _cache[55] || (_cache[55] = _createElementVNode("option", { value: "export" }, "تصدير", -1)),
20442                          _cache[56] || (_cache[56] = _createElementVNode("option", { value: "import" }, "استيراد", -1)),
20443                          _cache[57] || (_cache[57] = _createElementVNode("option", { value: "warnings" }, "تحذيرات", -1)),
20444                          _cache[58] || (_cache[58] = _createElementVNode("option", { value: "official_links" }, "روابط رسمية", -1))
20445                        ], 64))], 8, _hoisted_152), [[_vModelSelect, itemForm.service_type]])])]))
20446                  : (adminHub()==='sudan_digital')
20447                    ? (_openBlock(), _createElementBlock("div", _hoisted_154, [_createElementVNode("label", _hoisted_155, [_cache[61] || (_cache[61] = _createTextVNode("النوع")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((itemForm.service_type) = $event) }, _cache[60] || (_cache[60] = [
20448                        _createElementVNode("option", { value: "apps" }, "تطبيقات", -1),
20449                        _createElementVNode("option", { value: "government" }, "منصات حكومية", -1),
20450                        _createElementVNode("option", { value: "finance" }, "خدمات مالية", -1),
20451                        _createElementVNode("option", { value: "official_links" }, "روابط رسمية", -1),
20452                        _createElementVNode("option", { value: "health" }, "صحة", -1),
20453                        _createElementVNode("option", { value: "education" }, "تعليم", -1),
20454                        _createElementVNode("option", { value: "customs" }, "جمارك وضرائب", -1),
20455                        _createElementVNode("option", { value: "investment" }, "استثمار وشركات", -1),
20456                        _createElementVNode("option", { value: "transport" }, "موانئ وطيران", -1),
20457                        _createElementVNode("option", { value: "legal" }, "قوانين وتنبيهات", -1),
20458                        _createElementVNode("option", { value: "diaspora" }, "خدمات المغتربين", -1)
20459                      ]), 8, _hoisted_156), [[_vModelSelect, itemForm.service_type]]
20459)]), _createElementVNode("label", _hoisted_157, [_cache[62] || (_cache[62] = _createTextVNode("الجهة المالكة")), _withDirectives(_createElementVNode("input", {
20460                        "onUpdate:modelValue": $event => ((itemForm.source_name) = $event),
20461                        placeholder: "الوزارة / البنك / المؤسسة"
20462                      }, null, 8, _hoisted_158), [[_vModelText, itemForm.source_name]])])]))
20463                    : (_openBlock(), _createElementBlock("div", _hoisted_159, [_createElementVNode("label", _hoisted_160, [_cache[63] || (_cache[63] = _createTextVNode("اسم المصدر")), _withDirectives(_createElementVNode("input", {
20464                        "onUpdate:modelValue": $event => ((itemForm.source_name) = $event),
20465                        placeholder: "الجهة أو الموقع"
20466                      }, null, 8, _hoisted_161), [[_vModelText, itemForm.source_name]])])])),
20467                _createElementVNode("label", _hoisted_162, [_cache[64] || (_cache[64] = _createTextVNode("رابط المصدر")), _withDirectives(_createElementVNode("input", {
20468                  "onUpdate:modelValue": $event => ((itemForm.source_url) = $event),
20469                  placeholder: "https://..."
20470                }, null, 8, _hoisted_163), [[_vModelText, itemForm.source_url]])]),
20471                (adminHub()==='china_guide')
20472                  ? (_openBlock(), _createElementBlock(_Fragment, { key: 4 }, [_createElementVNode("div", _hoisted_164, [_createElementVNode("label", _hoisted_165, [_cache[66] || (_cache[66] = _createTextVNode("درجة الثقة")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((itemForm.trust_tier) = $event) }, _cache[65] || (_cache[65] = [_createElementVNode("option", { value: "community_listed" }, "Community Listed", -1), _createElementVNode("option", { value: "smt_verified" }, "SMT Verified", -1), _createElementVNode("option", { value: "official" }, "Official — مصدر رسمي موثق", -1)]), 8, _hoisted_166), [[_vModelSelect, itemForm.trust_tier]])]), _createElementVNode("label", _hoisted_167, [_cache[67] || (_cache[67] = _createTextVNode("ملاحظة الثقة")), _withDirectives(_createElementVNode("input", {
20473                      "onUpdate:modelValue": $event => ((itemForm.trust_note) = $event),
20474                      placeholder: "سبب التوثيق أو ملاحظة المراجعة"
20475                    }, null, 8, _hoisted_168), [[_vModelText, itemForm.trust_note]])])]), (adminCategoryIs('exhibitions'))
20476                      ? (_openBlock(), _createElementBlock("div", _hoisted_169, [_createElementVNode("div", _hoisted_170, [_createElementVNode("label", _hoisted_171, [_cache[68] || (_cache[68] = _createTextVNode("بداية المعرض")), _withDirectives(_createElementVNode("input", {
20477                          type: "date",
20478                          "onUpdate:modelValue": $event => ((itemForm.exhibition_start_date) = $event)
20479                        }, null, 8, _hoisted_172), [[_vModelText, itemForm.exhibition_start_date]])]), _createElementVNode("label", _hoisted_173, [_cache[69] || (_cache[69] = _createTextVNode("نهاية المعرض")), _withDirectives(_createElementVNode("input", {
20480                          type: "date",
20481                          "onUpdate:modelValue": $event => ((itemForm.exhibition_end_date) = $event)
20482                        }, null, 8, _hoisted_174), [[_vModelText, itemForm.exhibition_end_date]])])]), _createElementVNode("div", _hoisted_175, [_createElementVNode("label", _hoisted_176, [_cache[70] || (_cache[70] = _createTextVNode("القطاع")), _withDirectives(_createElementVNode("input", {
20483                          "onUpdate:modelValue": $event => ((itemForm.exhibition_sector) = $event),
20484                          placeholder: "معدات، طاقة، أزياء..."
20485                        }, null, 8, _hoisted_177), [[_vModelText, itemForm.exhibition_sector]])]), _createElementVNode("label", _hoisted_178, [_cache[71] || (_cache[71] = _createTextVNode("رابط التسجيل الرسمي")), _withDirectives(_createElementVNode("input", {
20486                          class: "ltr",
20487                          "onUpdate:modelValue": $event => ((itemForm.registration_url) = $event),
20488                          placeholder: "https://..."
20489                        }, null, 8, _hoisted_179), [[_vModelText, itemForm.registration_url]])])])]))
20490                      : _createCommentVNode("", true)], 64))
20491                  : _createCommentVNode("", true),
20492                _createElementVNode("label", _hoisted_180, [_cache[72] || (_cache[72] = _createTextVNode("كلمات البحث")), _withDirectives(_createElementVNode("input", {
20493                  "onUpdate:modelValue": $event => ((itemForm.tags) = $event),
20494                  placeholder: "كلمات مفصولة بفواصل"
20495                }, null, 8, _hoisted_181), [[_vModelText, itemForm.tags]])])
20496              ]),
20497              _createElementVNode("section", _hoisted_182, [
20498                _createElementVNode("div", _hoisted_183, [_cache[75] || (_cache[75] = _createElementVNode("span", null, "3", -1)), _createElementVNode("div", null, [_createElementVNode("h4", null, _toDisplayString(adminHub()==='china_guide'?'الموقع والتواصل':'الروابط والنشر'), 1), _cache[74] || (_cache[74] = _createElementVNode("p", null, "أدخل فقط البيانات التي يحتاجها المستخدم فعلاً.", -1))])]),
20499                (adminHub()==='china_guide')
20500                  ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [
20501                      _createElementVNode("div", _hoisted_184, [_createElementVNode("label", _hoisted_185, [_cache[76] || (_cache[76] = _
20501createTextVNode("المدينة")), _withDirectives(_createElementVNode("select", {
20502                        "onUpdate:modelValue": $event => ((itemForm.city) = $event),
20503                        onChange: $event => (itemForm.district='')
20504                      }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList($cityList(itemForm.city), (c) => {
20505                        return (_openBlock(), _createElementBlock("option", {
20506                          key: c.value,
20507                          value: c.value
20508                        }, _toDisplayString(c.label), 9, _hoisted_187))
20509                      }), 128))], 40, _hoisted_186), [[_vModelSelect, itemForm.city]])]), _createElementVNode("label", _hoisted_188, [_cache[78] || (_cache[78] = _createTextVNode("المنطقة")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((itemForm.district) = $event) }, [_cache[77] || (_cache[77] = _createElementVNode("option", { value: "" }, "اختر المنطقة", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList($districtList(itemForm.city,itemForm.district), (d) => {
20510                        return (_openBlock(), _createElementBlock("option", {
20511                          key: d.value,
20512                          value: d.value
20513                        }, _toDisplayString(d.label), 9, _hoisted_190))
20514                      }), 128))], 8, _hoisted_189), [[_vModelSelect, itemForm.district]])])]),
20515                      _createElementVNode("label", _hoisted_191, [_cache[79] || (_cache[79] = _createTextVNode("العنوان بالصيني")), _withDirectives(_createElementVNode("input", {
20516                        "onUpdate:modelValue": $event => ((itemForm.address_zh) = $event),
20517                        placeholder: "中文地址"
20518                      }, null, 8, _hoisted_192), [[_vModelText, itemForm.address_zh]])]),
20519                      _createElementVNode("label", _hoisted_193, [_cache[80] || (_cache[80] = _createTextVNode("العنوان بالعربي")), _withDirectives(_createElementVNode("input", {
20520                        "onUpdate:modelValue": $event => ((itemForm.address_ar) = $event),
20521                        placeholder: "وصف العنوان"
20522                      }, null, 8, _hoisted_194), [[_vModelText, itemForm.address_ar]])]),
20523                      _createElementVNode("div", _hoisted_195, [_createElementVNode("label", _hoisted_196, [_cache[81] || (_cache[81] = _createTextVNode("الهاتف")), _withDirectives(_createElementVNode("input", { "onUpdate:modelValue": $event => ((itemForm.phone) = $event) }, null, 8, _hoisted_197), [[_vModelText, itemForm.phone]])]), _createElementVNode("label", _hoisted_198, [_cache[82] || (_cache[82] = _createTextVNode("WeChat ID")), _withDirectives(_createElementVNode("input", { "onUpdate:modelValue": $event => ((itemForm.wechat_id) = $event) }, null, 8, _hoisted_199), [[_vModelText, itemForm.wechat_id]])])]),
20524                      _createElementVNode("div", _hoisted_200, [_createElementVNode("label", _hoisted_201, [_cache[83] || (_cache[83] = _createTextVNode("WhatsApp")), _withDirectives(_createElementVNode("input", { "onUpdate:modelValue": $event => ((itemForm.whatsapp) = $event) }, null, 8, _hoisted_202), [[_vModelText, itemForm.whatsapp]])]), _createElementVNode("label", _hoisted_203, [_cache[84] || (_cache[84] = _createTextVNode("رابط الخريطة")), _withDirectives(_createElementVNode("input", {
20525                        "onUpdate:modelValue": $event => ((itemForm.map_url) = $event),
20526                        placeholder: "https://..."
20527                      }, null, 8, _hoisted_204), [[_vModelText, itemForm.map_url]])])])
20528                    ], 64))
20529                  : (_openBlock(), _createElementBlock("label", _hoisted_205, [_cache[85] || (_cache[85] = _createTextVNode("الرابط التشغيلي / الموقع")), _withDirectives(_createElementVNode("input", {
20530                      "onUpdate:modelValue": $event => ((itemForm.map_url) = $event),
20531                      placeholder: "https://..."
20532                    }, null, 8, _hoisted_206), [[_vModelText, itemForm.map_url]])])),
20533                _createElementVNode("div", _hoisted_207, [_createElementVNode("label", _hoisted_208, [_cache[86] || (_cache[86] = _createTextVNode("الظهور")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((itemForm.visibility) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList($optionList('guide_visibility',itemForm.visibility), (o) => {
20534                  return (_openBlock(), _createElementBlock("option", {
20535                    key: o.value,
20536                    value: o.value
20537                  }, _toDisplayString(o.label), 9, _hoisted_210))
20538                }), 128))], 8, _hoisted_209), [[_vModelSelect, itemForm.visibility]])]), _createElementVNode("label", _hoisted_211, [_cache[87] || (_cache[87] = _createTextVNode("حالة النشر")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((itemForm.status) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList($optionList('guide_status',itemForm.status), (o) => {
20539                  return (_openBlock(), _createElementBlock("option", {
20540                    key: o.value,
20541                    value: o.value
20542                  }, _toDisplayString(o.label), 9, _hoisted_213))
20543                }), 128))], 8, _hoisted_212), [[_vModelSelect, itemForm.status]])])]),
20544                _createElementVNode("label", _hoisted_214, [_withDirectives(_createElementVNode("input", {
20545                  type: "checkbox",
20546                  "onUpdate:modelValue": $event => ((itemForm.is_recommended) = $event)
20547                }, null, 8, _hoisted_215), [[_vModelCheckbox, itemForm.is_recommended]]), _cache[88] || (_cache[88] = _createTextVNode(" موصى به من الإدارة"))])
20548              ]),
20549              (adminHub()==='sudan_digital'&&itemForm.id)
20550                ? (_openBlock(), _createElementBlock("section", _hoisted_216, [_createElementVNode("div", _hoisted_217, [_cache[90] || (_cache[90] = _createElementVNode("span", null, "4", -1)), _createElementVNode("div", null, [_cache[89] || (_cache[89] = _createElementVNode("h4", null, "مسار المراجعة والنشر", -1)), _createElementVNode("p", null, "الحالة الحالية: " + _toDisplayString(itemForm.governance_status||'draft'), 1)])]), _createElementVNode("div", _hoisted_218, [
20551                    (!itemForm.governance_status||itemForm.governance_status==='draft')
20552                      ? (_openBlock(), _createElementBlock("button", {
20553                          key: 0,
20554                          type: "button",
20555                          class: "smallbtn",
20556                          onClick: $event => (governance('submit'))
20557                        }, "إرسال للمراجعة", 8, _hoisted_219))
20558                      : _createCommentVNode("", true),
20559                    (itemForm.governance_status==='in_review')
20560                      ? (_openBlock(), _createElementBlock("button", {
20561                          key: 1,
20562                          type: "button",
20563                          class: "smallbtn",
20564                          onClick: $event => (governance('approve'))
20565                        }, "اعتماد", 8, _hoisted_220))
20566                      : _createCommentVNode("", true),
20567                    (itemForm.governance_status==='in_review')
20568                      ? (_openBlock(), _createElementBlock("button", {
20569                          key: 2,
20570                          type: "button",
20571                          class: "smallbtn danger",
20572                          onClick: $event => (governance('reject'))
20573                        }, "إرجاع", 8, _hoisted_221))
20574                      : _createCommentVNode("", true),
20575                    (itemForm.governance_status==='approved')
20576                      ? (_openBlock(), _createElementBlock("button", {
20577                          key: 3,
20578                          type: "button",
20579                          class: "smallbtn",
20580                          onClick: $event => (governance('publish'))
20581                        }, "نشر", 8, _hoisted_222))
20582                      : _createCommentVNode("", true),
20583                    (itemForm.governance_status==='published')
20584                      ? (_openBlock(), _createElementBlock("button", {
20585                          key: 4,
20586                          type: "button",
20587                          class: "smallbtn secondary",
20588                          onClick: $event => (governance('unpublish'))
20589                        }, "إيقاف النشر", 8, _hoisted_223))
20590                      : _createCommentVNode("", true),
20591                    (itemForm.governance_status==='published')
20592                      ? (_openBlock(), _createElementBlock("button", {
20593                          key: 5,
20594                          type: "button",
20595                          class: "smallbtn secondary",
20596                          onClick: $event => (governance('reverify'))
20597                        }, "تجديد التحقق", 8, _hoisted_224))
20598                      : _createCommentVNode("", true)
20599                  ])]))
20600                : _createCommentVNode("", true),
20601              _createElementVNode("footer", _hoisted_225, [(itemForm.id)
20602                ? (_openBlock(), _createElementBlock("details", _hoisted_226, [_cache[91] || (_cache[91] = _createElementVNode("summary", null, "إجراءات أخرى", -1)), _createElementVNode("button", {
20603                    type: "button",
20604                    class: "smallbtn danger",
20605                    onClick: archiveItem
20606                  }, "أرشفة العنصر", 8, _hoisted_227)]))
20607                : _createCommentVNode("", true), _createElementVNode("div", null, [_createElementVNode("button", {
20608                type: "button",
20609                class: "btn secondary",
20610                onClick: closeEditor
20611              }, "إلغاء", 8, _hoisted_228), _createElementVNode("button", _hoisted_229, _toDisplayString(itemForm.id?'حفظ كل التعديلات':'حفظ العنصر'), 1)])])
20612            ], 40, _hoisted_96)])], 8, _hoisted_90))
20613          : _createCommentVNode("", true)
20614      ]),
20615      _: 1
20616    }, 8, ["title"]))
20617  }
20618}
20619})()
20620  };
20621
20622  const OfficialPublishAnnouncementPage={
20623    components:{OfficialFrame},
20624    setup(){const store=useGzcStore();const router=useRouter();const f=reactive({title:'',body:'',duration_days:14,action_url:''});const files=ref([]);const fileLabel=computed(()=>files.value.length?Array.from(files.value).map(x=>x.name).join('، '):'لم يتم اختيار وسائط');function onFiles(e){files.value=Array.from((e.target&&e.target.files)||[]).slice(0,6);}onMounted(()=>store.requireOfficial(router));async function submit(){const fd=new FormData();fd.append('title',f.title);fd.append('body',f.body);fd.append('action_url',f.action_url);fd.append('duration_days',String(f.duration_days||14));Array.from(files.value||[]).forEach(file=>fd.append('media',file));store.state.busy=true;store.state.msg='جاري نشر التعميم الرسمي...';const r=await uploadApi('/api/official/announcements',{method:'POST',body:fd,headers:{'Accept':'application/json'},uploadLabel:'رفع وسائط التعميم'});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.ok){f.title='';f.body='';f.action_url='';files.value=[];router.push('/official/announcements');}}return{store,f,files,fileLabel,onFiles,submit};},
20625    render:(function(){
20626const _Vue = Vue
20627const { createElementVNode: _createElementVNode } = _Vue
20628
20629const _hoisted_1 = { class: "card formCard" }
20630const _hoisted_2 = ["onUpdate:modelValue"]
20631const _hoisted_3 = ["onUpdate:modelValue"]
20632const _hoisted_4 = ["onUpdate:modelValue"]
20633const _hoisted_5 = ["onUpdate:modelValue"]
20634const _hoisted_6 = { class: "filePicker officialFilePicker" }
20635const _hoisted_7 = ["onChange"]
20636const _hoisted_8 = ["onClick"]
20637
20638return function render(_ctx, _cache) {
20639  with (_ctx) {
20640    const { createElementVNode: _createElementVNode, vModelText: _vModelText, withDirectives: _withDirectives, toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = _Vue
20641
20642    const _component_OfficialFrame = _resolveComponent("OfficialFrame")
20643
20644    return (_openBlock(), _createBlock(_component_OfficialFrame, { title: "نشر تعميم رسمي" }, {
20645      default: _withCtx(() => [_createElementVNode("div", _hoisted_1, [
20646        _cache[1] || (_cache[1] = _createElementVNode("h3", null, "تعميم رسمي مع وسائط", -1)),
20647        _cache[2] || (_cache[2] = _createElementVNode("p", { class: "hint" }, "التعميم سيظهر تلقائياً في خانة الحساب: تعميمات السفارة أو تعميمات القنصلية. المسموح: صور، PDF، وفيديو قصير.", -1)),
20648        _withDirectives(_createElementVNode("input", {
20649          "onUpdate:modelValue": $event => ((f.title) = $event),
20650          placeholder: "عنوان التعميم"
20651        }, null, 8, _hoisted_2), [[_vModelText, f.title]]),
20652        _withDirectives(_createElementVNode("textarea", {
20653          "onUpdate:modelValue": $event => ((f.body) = $event),
20654          placeholder: "نص التعميم"
20655        }, null, 8, _hoisted_3), [[_vModelText, f.body]]),
20656        _withDirectives(_createElementVNode("input", {
20657          "onUpdate:modelValue": $event => ((f.action_url) = $event),
20658          placeholder: "رابط اختياري"
20659        }, null, 8, _hoisted_4), [[_vModelText, f.action_url]]),
20660        _withDirectives(_createElementVNode("input", {
20661          type: "number",
20662          min: "1",
20663          max: "365",
20664          "onUpdate:modelValue": $event => ((f.duration_days) = $event),
20665          placeholder: "مدة الظهور بالأيام"
20666        }, null, 8, _hoisted_5), [[_vModelText, f.duration_days]]),
20667        _createElementVNode("label", _hoisted_6, [_createElementVNode("input", {
20668          type: "file",
20669          multiple: "",
20670          accept: "image/jpeg,image/png,image/webp,application/pdf,video/mp4,video/webm,video/quicktime",
20671          onChange: onFiles
20672        }, null, 40, _hoisted_7), _cache[0] || (_cache[0] = _createElementVNode("span", null, "اختيار الوسائط", -1)), _createElementVNode("em", null, _toDisplayString(fileLabel), 1)]),
20673        _createElementVNode("button", {
20674          class: "btn loadMore",
20675          onClick: submit
20676        }, "نشر الإعلان", 8, _hoisted_8)
20677      ])]),
20678      _: 1
20679    }))
20680  }
20681}
20682})()
20683  };
20684
20685
20686  const AdminBrandAssetsPage={
20687    components:{AdminFrame,IdentityAdminNav},
20688    setup(){
20689      const store=useGzcStore(); const router=useRouter();
20690      const kinds=ref([]); const limits=ref({}); const sel=ref('');
20691      const file=ref(null); const fileName=ref('لم يتم اختيار صورة');
20692      const previewUrl=ref(''); const previewOutput=ref(''); const busy=ref('');
20693      const opts=reactive({fit:'',background:'',zoom:1,offsetX:0,offsetY:0,trim:false,quality:''});
20694      const selected=computed(()=>kinds.value.find(k=>k.kind===sel.value)||null);
20695      const maxMb=computed(()=>Math.round((Number(limits.value.max_bytes)||0)/1048576));
20696      const allowed=computed(()=>safeArray(limits.value.allowed).join(' · ')||'jpg · png · webp');
20697      const minSide=computed(()=>Number(limits.value.min_side)||64);
20698      function clearPreview(){if(previewUrl.value){try{URL.revokeObjectURL(previewUrl.value);}catch(e){}}previewUrl.value='';previewOutput.value='';}
20699      function resetOpts(){opts.fit='';opts.background='';opts.zoom=1;opts.offsetX=0;opts.offsetY=0;opts.trim=false;opts.quality='';}
20700      function clearFile(){file.value=null;fileName.value='لم يتم اختيار صورة';clearPreview();}
20701      async function load(){
20702        if(!await store.requireAdmin(router))return;
20703        store.state.busy=true;
20704        const r=await api('/api/admin/brand-assets');
20705        store.state.busy=false;
20706        if(r&&r.ok){
20707          kinds.value=safeArray(r.kinds); limits.value=r.limits||{};
20708          if(!sel.value&&kinds.value.length)sel.value=kinds.value[0].kind;
20709        } else store.state.msg=(r&&(r.message||r.error))||'تعذر تحميل كتالوج أصول الهوية';
20710      }
20711      function pick(k){if(sel.value===k)return;sel.value=k;clearFile();resetOpts();}
20712      function onFile(e){const f=e.target.files&&e.target.files[0]?e.target.files[0]:null;file.value=f;fileName.value=f?f.name:'لم يتم اختيار صورة';clearPreview();}
20713      // الخيارات تُضاف قبل الملف: الخادم يقرأ الحقول النصية المرافقة للملف، وما بعده قد لا يصله
20714      function formPayload(outputName){
20715        const fd=new FormData();
20716        if(opts.fit)fd.append('fit',opts.fit);
20717        if(String(opts.background||'').trim())fd.append('background',String(opts.background).trim());
20718        if(Number(opts.zoom)!==1)fd.append('zoom',String(opts.zoom));
20719        if(Number(opts.offsetX))fd.append('offsetX',String(opts.offsetX));
20720        if(Number(opts.offsetY))fd.append('offsetY',String(opts.offsetY));
20721        if(opts.trim)fd.append('trim','true');
20722        if(String(opts.quality||'').trim())fd.append('quality',String(opts.quality).trim());
20723        if(outputName)fd.append('output',outputName);
20724        fd.append('file',file.value);
20725        return fd;
20726      }
20727      // المعاينة تعيد صورة ثنائية لا JSON، فلا تمرّ عبر api() الذي يفكّ النص دائماً
20728      async function doPreview(outputName){
20729        if(!file.value){store.state.msg='اختر صورة أولاً';return;}
20730        busy.value='preview';
20731        try{
20732          const res=await fetch('/api/admin/brand-assets/'+encodeURIComponent(sel.value)+'/preview',
20733            {method:'POST',credentials:'include',cache:'no-store',headers:{'Accept':'image/*,application/json'},body:formPayload(outputName)});
20734          if(!res.ok){
20735            let m='تعذّرت المعاينة';
20736            try{const j=await res.json();m=(j&&j.message)||m;}catch(e){}
20737            store.state.msg=m; return;
20738          }
20739          const b=await res.blob(); clearPreview();
20740          previewUrl.value=URL.createObjectURL(b); previewOutput.value=outputName||'';
20741          store.state.msg='معاينة بلا حفظ — اضغط «اعتماد ورفع» للحفظ';
20742        }catch(e){store.state.msg='فشل الاتصال بالسيرفر';}
20743        finally{busy.value='';}
20744      }
20745      async function save(){
20746        if(!file.value){store.state.msg='اختر صورة أولاً';return;}
20747        busy.value='save';
20748        const r=await runBusyAction(store,'brand-assets.upload',()=>uploadApi(
20749          '/api/admin/brand-assets/'+encodeURIComponent(sel.value),
20750          {method:'POST',body:formPayload(''),headers:{'Accept':'application/json'},uploadLabel:'رفع أصل الهوية'}));
20751        busy.value='';
20752        store.state.msg=(r&&(r.message||r.error))||'';
20753        if(r&&r.ok){clearFile();await load();}
20754      }
20755      async function doReset(){
20756        if(!sel.value)return;
20757        busy.value='reset';
20758        const r=await api('/api/admin/brand-assets/'+encodeURIComponent(sel.value)+'/reset',{method:'POST'});
20759        busy.value='';
20760        store.state.msg=(r&&(r.message||r.error))||'';
20761        if(r&&r.ok){clearFile();await load();}
20762      }
20763      onMounted(load);
20764      return {store,kinds,limits,sel,selected,file,fileName,opts,previewUrl,previewOutput,busy,
20765              maxMb,allowed,minSide,pick,onFile,doPreview,save,doReset,load};
20766    },
20767    render:(function(){
20768const _Vue = Vue
20769const { createVNode: _createVNode, createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
20770
20771const _hoisted_1 = { class: "card noticeCard compactNotice identityBoundaryNote" }
20772const _hoisted_2 = ["onClick"]
20773const _hoisted_3 = { class: "card formCard" }
20774const _hoisted_4 = { class: "row" }
20775const _hoisted_5 = ["onClick"]
20776const _hoisted_6 = {
20777  key: 0,
20778  class: "hint"
20779}
20780const _hoisted_7 = { class: "card formCard" }
20781const _hoisted_8 = { class: "dailyList" }
20782const _hoisted_9 = ["disabled", "onClick"]
20783const _hoisted_10 = { class: "card formCard" }
20784const _hoisted_11 = { class: "filePicker wide" }
20785const _hoisted_12 = ["onChange"]
20786const _hoisted_13 = { class: "formTwo" }
20787const _hoisted_14 = { class: "fieldLabel" }
20788const _hoisted_15 = ["onUpdate:modelValue"]
20789const _hoisted_16 = { class: "fieldLabel" }
20790const _hoisted_17 = ["onUpdate:modelValue"]
20791const _hoisted_18 = { class: "fieldLabel" }
20792const _hoisted_19 = ["onUpdate:modelValue"]
20793const _hoisted_20 = { class: "fieldLabel" }
20794const _hoisted_21 = ["onUpdate:modelValue"]
20795const _hoisted_22 = { class: "fieldLabel" }
20796const _hoisted_23 = ["onUpdate:modelValue"]
20797const _hoisted_24 = { class: "fieldLabel" }
20798const _hoisted_25 = ["onUpdate:modelValue"]
20799const _hoisted_26 = { class: "fieldLabel" }
20800const _hoisted_27 = ["onUpdate:modelValue"]
20801const _hoisted_28 = { class: "row" }
20802const _hoisted_29 = ["disabled", "onClick"]
20803const _hoisted_30 = ["disabled", "onClick"]
20804const _hoisted_31 = ["disabled", "onClick"]
20805const _hoisted_32 = {
20806  key: 0,
20807  class: "heroAdminPreview"
20808}
20809const _hoisted_33 = ["src"]
20810const _hoisted_34 = { class: "hint" }
20811
20812return function render(_ctx, _cache) {
20813  with (_ctx) {
20814    const { resolveComponent: _resolveComponent, createVNode: _createVNode, createElementVNode: _createElementVNode, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, toDisplayString: _toDisplayString, normalizeClass: _normalizeClass, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode, vModelSelect: _vModelSelect, withDirectives: _withDirectives, vModelText: _vModelText, vModelCheckbox: _vModelCheckbox, withCtx: _withCtx, createBlock: _createBlock } = _Vue
20815
20816    const _component_IdentityAdminNav = _resolveComponent("IdentityAdminNav")
20817    const _component_AdminFrame = _resolveComponent("AdminFrame")
20818
20819    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "أصول الهوية البصرية" }, {
20820      default: _withCtx(() => [
20821        _createVNode(_component_IdentityAdminNav),
20822        _createElementVNode("section", _hoisted_1, [
20823          _cache[0] || (_cache[0] = _createElementVNode("span", { class: "vueBadge" }, "الهوية البصرية", -1)),
20824          _cache[1] || (_cache[1] = _createElementVNode("h3", null, "الشعار والصور الرسمية للمنصة", -1)),
20825          _cache[2] || (_cache[2] = _createElementVNode("p", null, "هذه الأصول تخص SMT China وتُستخدم في الهوية العامة. صور مجتمعات قوانغتشو وإيوو تُدار من صفحة «المجتمعات» ولا تُرفع هنا.", -1)),
20826          _createElementVNode("button", {
20827            class: "smallbtn",
20828            onClick: load
20829          }, "تحديث", 8, _hoisted_2)
20830        ]),
20831        _createElementVNode("section", _hoisted_3, [_cache[3] || (_cache[3] = _createElementVNode("h3", null, "نوع الأصل", -1)), _createElementVNode("div", _hoisted_4, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(kinds, (k) => {
20832          return (_openBlock(), _createElementBlock("button", {
20833            key: k.kind,
20834            class: _normalizeClass(["btn secondary", {active:sel===k.kind}]),
20835            onClick: $event => (pick(k.kind))
20836          }, _toDisplayString(k.label_ar), 11, _hoisted_5))
20837        }), 128))]), (!kinds.length)
20838          ? (_openBlock(), _createElementBlock("p", _hoisted_6, "لا يوجد كتالوج — اضغط تحديث."))
20839          : _createCommentVNode("", true)]),
20840        selected
20841          ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createElementVNode("section", _hoisted_7, [_createElementVNode("h3", null, "المخرجات المشتقّة — " + _toDisplayString(selected.label_ar), 1), _createElementVNode("div", _hoisted_8, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(selected.outputs, (o) => {
20842              return (_openBlock(), _createElementBlock("div", { key: o.name }, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(o.name), 1), _createElementVNode("small", null, [
20843                _createTextVNode(_toDisplayString(o.width), 1),
20844                (o.height)
20845                  ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createTextVNode("×" + _toDisplayString(o.height), 1)], 64))
20846                  : _createCommentVNode("", true),
20847                _createTextVNode(" · " + _toDisplayString(o.format), 1),
20848                (o.budget_kb)
20849                  ? (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [_createTextVNode(" · حد " + _toDisplayString(o.budget_kb) + "KB", 1)], 64))
20850                  : _createCommentVNode("", true),
20851                _createTextVNode(" · " + _toDisplayString(o.is_default?'الأصل المُشحون':'مرفوع من الإدارة'), 1)
20852              ])]), _createElementVNode("button", {
20853                class: "smallbtn secondary",
20854                disabled: !file||busy==='preview',
20855                onClick: $event => (doPreview(o.name))
20856              }, "معاينة", 8, _hoisted_9)]))
20857            }), 128))])]), _createElementVNode("section", _hoisted_10, [
20858              _cache[13] || (_cache[13] = _createElementVNode("h3", null, "رفع صورة جديدة", -1)),
20859              _createElementVNode("label", _hoisted_11, [_createElementVNode("input", {
20860                type: "file",
20861                accept: "image/jpeg,image/png,image/webp",
20862                onChange: onFile
20863              }, null, 40, _hoisted_12), _cache[4] || (_cache[4] = _createElementVNode("span", null, "اختيار صورة", -1)), _createElementVNode("em", null, _toDisplayString(fileName), 1)]),
20864              _createElementVNode("div", _hoisted_13, [
20865                _createElementVNode("label", _hoisted_14, [_cache[6] || (_cache[6] = _createElementVNode("span", null, "الاحتواء", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((opts.fit) = $event) }, _cache[5] || (_cache[5] = [
20866                  _createElementVNode("option", { value: "" }, "افتراضي كل مخرج", -1),
20867                  _createElementVNode("option", { value: "contain" }, "احتواء كامل", -1),
20868                  _createElementVNode("option", { value: "cover" }, "تغطية بالاقتطاع", -1),
20869                  _createElementVNode("option", { value: "inside" }, "بالعرض فقط", -1)
20870                ]), 8, _hoisted_15), [[_vModelSelect, opts.fit]])]),
20871                _createElementVNode("label", _hoisted_16, [_cache[7] || (_cache[7] = _createElementVNode("span", null, "الخلفية", -1)), _withDirectives(_createElementVNode("input", {
20872                  "onUpdate:modelValue": $event => ((opts.background) = $event),
20873                  placeholder: "#ffffff أو transparent"
20874                }, null, 8, _hoisted_17), [[_vModelText, opts.background]])]),
20875                _createElementVNode("label", _hoisted_18, [_cache[8] || (_cache[8] = _createElementVNode("span", null, "التكبير · 0.5 إلى 2", -1)), _withDirectives(_createElementVNode("input", {
20876                  type: "number",
20877                  step: "0.05",
20878                  min: "0.5",
20879                  max: "2",
20880                  "onUpdate:modelValue": $event => ((opts.zoom) = $event)
20881                }, null, 8, _hoisted_19), [[_vModelText, opts.zoom]])]),
20882                _createElementVNode("label", _hoisted_20, [_cache[9] || (_cache[9] = _createElementVNode("span", null, "الجودة · 40 إلى 100", -1)), _withDirectives(_createElementVNode("input", {
20883                  type: "number",
20884                  step: "1",
20885                  min: "40",
20886                  max: "100",
20887                  "onUpdate:modelValue": $event => ((opts.quality) = $event),
20888                  placeholder: "افتراضي المخرج"
20889                }, null, 8, _hoisted_21), [[_vModelText, opts.quality]])]),
20890                _createElementVNode("label", _hoisted_22, [_cache[10] || (_cache[10] = _createElementVNode("span", null, "إزاحة أفقية · ‏-100 إلى 100", -1)), _withDirectives(_createElementVNode("input", {
20891                  type: "number",
20892                  step: "5",
20893                  min: "-100",
20894                  max: "100",
20895                  "onUpdate:modelValue": $event => ((opts.offsetX) = $event)
20896                }, null, 8, _hoisted_23), [[_vModelText, opts.offsetX]])]),
20897                _createElementVNode("label", _hoisted_24, [_cache[11] || (_cache[11] = _createElementVNode("span", null, "إزاحة رأسية · ‏-100 إلى 100", -1)), _withDirectives(_createElementVNode("input", {
20898                  type: "number",
20899                  step: "5",
20900                  min: "-100",
20901                  max: "100",
20902                  "onUpdate:modelValue": $event => ((opts.offsetY) = $event)
20903                }, null, 8, _hoisted_25), [[_vModelText, opts.offsetY]])])
20904              ]),
20905              _createElementVNode("label", _hoisted_26, [_cache[12] || (_cache[12] = _createElementVNode("span", null, "قصّ الحواف الموحّدة", -1)), _withDirectives(_createElementVNode("input", {
20906                type: "checkbox",
20907                "onUpdate:modelValue": $event => ((opts.trim) = $event)
20908              }, null, 8, _hoisted_27), [[_vModelCheckbox, opts.trim]])]),
20909              _createElementVNode("div", _hoisted_28, [_createElementVNode("button", {
20910                class: "btn secondary",
20911                disabled: !file||busy==='preview',
20912                onClick: $event => (doPreview(''))
20913              }, _toDisplayString(busy==='preview'?'جاري المعاينة...'
20913:'معاينة بلا حفظ'), 9, _hoisted_29), _createElementVNode("button", {
20914                class: "btn",
20915                disabled: !file||busy==='save',
20916                onClick: save
20917              }, _toDisplayString(busy==='save'?'جاري الرفع...':'اعتماد ورفع'), 9, _hoisted_30), _createElementVNode("button", {
20918                class: "btn danger",
20919                disabled: busy==='reset',
20920                onClick: doReset
20921              }, "العودة إلى الأصل المُشحون", 8, _hoisted_31)]),
20922              _cache[14] || (_cache[14] = _createElementVNode("p", { class: "hint" }, "المعاينة لا تحفظ شيئاً. «العودة إلى الأصل» تحذف الإعداد فيعود الأصل المشحون مع الإصدار.", -1)),
20923              previewUrl
20924                ? (_openBlock(), _createElementBlock("div", _hoisted_32, [_createElementVNode("img", {
20925                    src: previewUrl,
20926                    alt: "معاينة الأصل"
20927                  }, null, 8, _hoisted_33), _createElementVNode("p", _hoisted_34, "معاينة " + _toDisplayString(previewOutput||selected.outputs[0].name) + " — لم تُحفظ.", 1)]))
20928                : _createCommentVNode("", true)
20929            ])], 64))
20930          : _createCommentVNode("", true)
20931      ]),
20932      _: 1
20933    }))
20934  }
20935}
20936})()
20937  };
20938
20939  const AdminPlatformBrandingPage={
20940    components:{AdminFrame,IdentityAdminNav},
20941    setup(){
20942      const store=useGzcStore(); const router=useRouter();
20943      const form=reactive({titleLine1:'',titleLine2:'',subtitle:'',badge:'',appName:'',appShortName:''});
20944      const iconFile=ref(null), iconLabel=ref('لم يتم اختيار شعار');
20945      async function load(){if(await store.requireAdmin(router)){const r=await store.loadPlatformBranding(router);Object.assign(form,(r&&r.branding)||{});}}
20946      function onIcon(e){const f=e.target.files&&e.target.files[0];iconFile.value=f||null;iconLabel.value=f?f.name:'لم يتم اختيار شعار';}
20947      async function save(){store.state.busy=true;const r=await api('/api/admin/platform-branding',{method:'POST',body:JSON.stringify(form)});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.branding)Object.assign(form,r.branding);}
20948      async function uploadIcon(){if(!iconFile.value){store.state.msg='اختر صورة الشعار أولاً';return;}const fd=new FormData();fd.append('file',iconFile.value);store.state.busy=true;const r=await uploadApi('/api/admin/platform-branding/icon',{method:'POST',body:fd,headers:{'Accept':'application/json'},uploadLabel:'رفع أيقونة التطبيق'});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r.branding)Object.assign(form,r.branding);}
20949      onMounted(load);
20950      return{store,form,iconLabel,onIcon,save,uploadIcon};
20951    },
20952    render:(function(){
20953const _Vue = Vue
20954const { createVNode: _createVNode, createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
20955
20956const _hoisted_1 = { class: "card formCard" }
20957const _hoisted_2 = ["onUpdate:modelValue"]
20958const _hoisted_3 = ["onUpdate:modelValue"]
20959const _hoisted_4 = ["onUpdate:modelValue"]
20960const _hoisted_5 = ["onUpdate:modelValue"]
20961const _hoisted_6 = { class: "formTwo" }
20962const _hoisted_7 = ["onUpdate:modelValue"]
20963const _hoisted_8 = ["onUpdate:modelValue"]
20964const _hoisted_9 = ["onClick"]
20965const _hoisted_10 = { class: "card formCard" }
20966const _hoisted_11 = { class: "filePicker" }
20967const _hoisted_12 = ["onChange"]
20968const _hoisted_13 = ["onClick"]
20969const _hoisted_14 = {
20970  key: 0,
20971  class: "heroAdminPreview"
20972}
20973const _hoisted_15 = ["src"]
20974
20975return function render(_ctx, _cache) {
20976  with (_ctx) {
20977    const { resolveComponent: _resolveComponent, createVNode: _createVNode, createElementVNode: _createElementVNode, vModelText: _vModelText, withDirectives: _withDirectives, toDisplayString: _toDisplayString, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, withCtx: _withCtx, createBlock: _createBlock } = _Vue
20978
20979    const _component_IdentityAdminNav = _resolveComponent("IdentityAdminNav")
20980    const _component_AdminFrame = _resolveComponent("AdminFrame")
20981
20982    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "هوية المنصة والتطبيق" }, {
20983      default: _withCtx(() => [
20984        _createVNode(_component_IdentityAdminNav),
20985        _cache[4] || (_cache[4] = _createElementVNode("section", { class: "card noticeCard compactNotice identityBoundaryNote" }, [_createElementVNode("span", { class: "vueBadge" }, "هوية عامة"), _createElementVNode("h3", null, "الرئيسية واسم التطبيق وPWA"), _createElementVNode("p", null, "هذه الصفحة تتحكم في هوية SMT العامة ونص الهيدر وأيقونة التطبيق. محتوى صفحة «عن المنصة» مستقل، وبيانات المجتمعات المحلية مستقلة.")], -1)),
20986        _createElementVNode("section", _hoisted_1, [
20987          _cache[0] || (_cache[0] = _createElementVNode("h3", null, "نص الهيدر في الرئيسية", -1)),
20988          _withDirectives(_createElementVNode("input", {
20989            "onUpdate:modelValue": $event => ((form.titleLine1) = $event),
20990            placeholder: "السطر الأول: SMT"
20991          }, null, 8, _hoisted_2), [[_vModelText, form.titleLine1]]),
20992          _withDirectives(_createElementVNode("input", {
20993            "onUpdate:modelValue": $event => ((form.titleLine2) = $event),
20994            placeholder: "السطر الثاني: في الصين"
20995          }, null, 8, _hoisted_3), [[_vModelText, form.titleLine2]]),
20996          _withDirectives(_createElementVNode("textarea", {
20997            "onUpdate:modelValue": $event => ((form.subtitle) = $event),
20998            placeholder: "الوصف المختصر"
20999          }, null, 8, _hoisted_4), [[_vModelText, form.subtitle]]),
21000          _withDirectives(_createElementVNode("input", {
21001            "onUpdate:modelValue": $event => ((form.badge) = $event),
21002            placeholder: "الشارة: SMT China"
21003          }, null, 8, _hoisted_5), [[_vModelText, form.badge]]),
21004          _createElementVNode("div", _hoisted_6, [_withDirectives(_createElementVNode("input", {
21005            "onUpdate:modelValue": $event => ((form.appName) = $event),
21006            placeholder: "اسم التطبيق"
21007          }, null, 8, _hoisted_7), [[_vModelText, form.appName]]), _withDirectives(_createElementVNode("input", {
21008            "onUpdate:modelValue": $event => ((form.appShortName) = $event),
21009            placeholder: "الاسم المختصر"
21010          }, null, 8, _hoisted_8), [[_vModelText, form.appShortName]])]),
21011          _createElementVNode("button", {
21012            class: "btn",
21013            onClick: save
21014          }, "حفظ النصوص", 8, _hoisted_9)
21015        ]),
21016        _createElementVNode("section", _hoisted_10, [
21017          _cache[2] || (_cache[2] = _createElementVNode("h3", null, "أيقونة تطبيق الهاتف", -1)),
21018          _cache[3] || (_cache[3] = _createElementVNode("p", { class: "hint" }, "هذه أيقونة PWA/الهاتف وليست صورة صفحة «عن المنصة» أو صورة مجتمع محلي. ارفع شعاراً مربعاً واضحاً. على iPhone قد تحتاج حذف التطبيق من الشاشة وإضافته مرة أخرى حتى تتغير الأيقونة.", -1)),
21019          _createElementVNode("label", _hoisted_11, [_createElementVNode("input", {
21020            type: "file",
21021            accept: "image/jpeg,image/png,image/webp",
21022            onChange: onIcon
21023          }, null, 40, _hoisted_12), _cache[1] || (_cache[1] = _createElementVNode("span", null, "اختيار شعار التطبيق", -1)), _createElementVNode("em", null, _toDisplayString(iconLabel), 1)]),
21024          _createElementVNode("button", {
21025            class: "btn secondary",
21026            onClick: uploadIcon
21027          }, "رفع الأيقونة", 8, _hoisted_13),
21028          (form.appIconUrl)
21029            ? (_openBlock(), _createElementBlock("div", _hoisted_14, [_createElementVNode("img", {
21030                src: form.appIconUrl,
21031                loading: "lazy",
21032                alt: "أيقونة التطبيق"
21033              }, null, 8, _hoisted_15)]))
21034            : _createCommentVNode("", true)
21035        ])
21036      ]),
21037      _: 1,
21038      __: [4]
21039    }))
21040  }
21041}
21042})()
21043  };
21044
21045  const PrivacyPage={
21046    components:{PublicFrame},
21047    render:(function(){
21048const _Vue = Vue
21049const { createElementVNode: _createElementVNode } = _Vue
21050
21051const _hoisted_1 = { class: "card legalSection" }
21052const _hoisted_2 = ["onClick"]
21053
21054return function render(_ctx, _cache) {
21055  with (_ctx) {
21056    const { createElementVNode: _createElementVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = _Vue
21057
21058    const _component_PublicFrame = _resolveComponent("PublicFrame")
21059
21060    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "سياسة الخصوصية" }, {
21061      default: _withCtx(() => [
21062        _cache[2] || (_cache[2] = _createElementVNode("section", { class: "card legalHero" }, [_createElementVNode("span", { class: "vueBadge" }, "آخر تحديث: 28 أغسطس 2026"), _createElementVNode("h2", null, "سياسة الخصوصية"), _createElementVNode("p", null, "تُشغّل SMT Advanced Business منصة SMT China لخدمة العضوية والمعلومات والطلبات والتواصل التشغيلي داخل الصين.")], -1)),
21063        _cache[3] || (_cache[3] = _createElementVNode("section", { class: "card legalSection" }, [_createElementVNode("h3", null, "البيانات التي نعالجها"), _createElementVNode("ul", null, [
21064          _createElementVNode("li", null, "رقم واتساب ورمز التحقق والجلسة الآمنة."),
21065          _createElementVNode("li", null, "بيانات العضوية التي تقدمها، مثل الاسم والمدينة والمهنة وبيانات الأسرة والصورة الاختيارية."),
21066          _createElementVNode("li", null, "طلبات المساعدة والطوارئ والتوريد والمرفقات المرتبطة بها."),
21067          _createElementVNode("li", null, "بيانات تشغيلية محدودة مثل وقت الطلب وسجل الإجراءات لحماية الحساب ومراجعة العمل."),
21068          _createElementVNode("li", null, "لتحسين الدليل، نسجل إحصاءات مجمعة لفئات البحث التي لم تجد نتائج، مثل التصنيف والمدينة. لا نحفظ عبارة البحث الخام أو هوية العضو أو الجلسة أو عنوان IP ضمن هذه الإحصاءات."),
21069          _createElementVNode("li", null, "الموقع فقط عندما تضغط زر السماح في صفحة الطوارئ؛ لا تطلبه المنصة تلقائياً.")
21070        ])], -1)),
21071        _cache[4] || (_cache[4] = _createElementVNode("section", { class: "card legalSection" }, [_createElementVNode("h3", null, "لماذا نستخدم البيانات"), _createElementVNode("p", null, "للتحقق من الهوية، إدارة العضوية، تقديم الخدمات، إرسال إشعارات واتساب المطلوبة، متابعة الحالات، منع إساءة الاستخدام، وتحسين موثوقية المنصة.")], -1)),
21072        _cache[5] || (_cache[5] = _createElementVNode("section", { class: "card legalSection" }, [_createElementVNode("h3", null, "من يمكنه الاطلاع"), _createElementVNode("p", null, "لا تُنشر بيانات العضوية أو الطلبات للعامة. يقتصر الاطلاع على الإداريين أو الحسابات الرسمية المخولة بحسب الدور ونطاق المجتمع، وعلى مزود واتساب بالقدر اللازم لإرسال الرسالة. المرفقات الخاصة لا تظهر في صفحات الزوار.")], -1)),
21073        _cache[6] || (_cache[6] = _createElementVNode("section", { class: "card legalSection" }, [_createElementVNode("h3", null, "الحفظ والحقوق"), _createElementVNode("p", null, "تُحفظ البيانات بقدر الحاجة للتشغيل والمراجعة والالتزامات النظامية، ثم تُؤرشف أو تُحذف وفق سياسة الإدارة. يمكنك طلب تصحيح بياناتك من حسابك أو إرسال طلب عبر صفحة التواصل. قد يلزم الاحتفاظ بسجل مختصر لحماية النظام وإثبات الإجراءات.")], -1)),
21074        _createElementVNode("section", _hoisted_1, [_cache[0] || (_cache[0] = _createElementVNode("h3", null, "التحديثات", -1)), _cache[1] || (_cache[1] = _createElementVNode("p", null, "قد تتغير هذه السياسة عند إضافة خدمة جديدة. سيظهر تاريخ آخر تحديث في أعلى الصفحة، وتُعرض التغييرات المهمة داخل المنصة عند الحاجة.", -1)), _createElementVNode("button", {
21075          class: "btn secondary",
21076          onClick: $event => ($router.push('/contact'))
21077        }, "التواصل بخصوص الخصوصية", 8, _hoisted_2)])
21078      ]),
21079      _: 1,
21080      __: [2,3,4,5,6]
21081    }))
21082  }
21083}
21084})()
21085  };
21086
21087  const TermsPage={
21088    components:{PublicFrame},
21089    render:(function(){
21090const _Vue = Vue
21091
21092return function render(_ctx, _cache) {
21093  with (_ctx) {
21094    const { createElementVNode: _createElementVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = _Vue
21095
21096    const _component_PublicFrame = _resolveComponent("PublicFrame")
21097
21098    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "شروط الاستخدام" }, {
21099      default: _withCtx(() => _cache[0] || (_cache[0] = [
21100        _createElementVNode("section", { class: "card legalHero" }, [_createElementVNode("span", { class: "vueBadge" }, "آخر تحديث: 16 أغسطس 2026"), _createElementVNode("h2", null, "شروط استخدام المنصة"), _createElementVNode("p", null, "باستخدام المنصة توافق على تقديم بيانات صحيحة، حماية رمز الدخول، واستخدام الخدمات بصورة نظامية ومحترمة.")], -1),
21101        _createElementVNode("section", { class: "card legalSection" }, [_createElementVNode("h3", null, "الحساب والعضوية"), _createElementVNode("ul", null, [_createElementVNode("li", null, "الحساب شخصي ويرتبط برقم واتساب تم التحقق منه."), _createElementVNode("li", null, "لا تشارك رمز التحقق أو تستخدم رقم شخص آخر."), _createElementVNode("li", null, "يجوز للإدارة مراجعة الطلب أو تعليقه عند وجود بيانات غير صحيحة أو إساءة استخدام.")])], -1),
21102        _createElementVNode("section", { class: "card legalSection" }, [_createElementVNode("h3", null, "المحتوى والمصادر"), _createElementVNode("p", null, "تسعى المنصة لعرض معلومات موثقة ومراجعة، لكن الأنظمة والمواعيد والرسوم والروابط قد تتغير. راجع المصدر الرسمي قبل اتخاذ قرار مالي أو قانوني أو صحي أو متعلق بالسفر. ")], -1),
21103        _createElementVNode("section", { class: "card legalSection" }, [_createElementVNode("h3", null, "الطوارئ والخدمات المهنية"), _createElementVNode("p", null, "المنصة ليست بديلاً للشرطة أو الإسعاف أو الإطفاء، وليست جهة حكومية أو مكتب محاماة أو منشأة طبية. في الصين استخدم 110 للشرطة، 119 للإطفاء، 120 للإسعاف، و122 لحوادث المرور.")], -1),
21104        _createElementVNode("section", { class: "card legalSection" }, [_createElementVNode("h3", null, "الطلبات والمرفقات"), _createElementVNode("p", null, "أنت مسؤول عن صحة الملفات والمعلومات التي ترفعها وعن امتلاك حق مشاركتها. لا ترفع كلمات مرور أو بيانات بطاقات أو ملفات غير لازمة للخدمة.")], -1),
21105        _createElementVNode("section", { class: "card legalSection" }, [_createElementVNode("h3", null, "التشغيل والتعديل"), _createElementVNode("p", null, "تدير SMT Advanced Business المنصة وقد تحدّث الخدمات أو توقف جزءاً منها للصيانة أو الحماية. سنحاول إظهار التغييرات المهمة بوضوح للمستخدم.")], -1)
21106      ])),
21107      _: 1,
21108      __: [0]
21109    }))
21110  }
21111}
21112})()
21113  };
21114
21115  const ContactPage={
21116    components:{PublicFrame},
21117    setup(){const store=useGzcStore();const router=useRouter();onMounted(()=>store.loadMe());const member=computed(()=>store.state.me&&store.state.me.authenticated&&store.state.me.member);function openFeedback(){if(member.value)router.push('/feedback');else router.push({path:'/login',query:{next:'/feedback'}});}return{member,openFeedback};},
21118    render:(function(){
21119const _Vue = Vue
21120const { createElementVNode: _createElementVNode } = _Vue
21121
21122const _hoisted_1 = { class: "contactGrid" }
21123const _hoisted_2 = { class: "card" }
21124const _hoisted_3 = ["onClick"]
21125const _hoisted_4 = { class: "card" }
21126const _hoisted_5 = ["onClick"]
21127const _hoisted_6 = { class: "card" }
21128const _hoisted_7 = ["onClick"]
21129
21130return function render(_ctx, _cache) {
21131  with (_ctx) {
21132    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock } = _Vue
21133
21134    const _component_PublicFrame = _resolveComponent("PublicFrame")
21135
21136    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "التواصل" }, {
21137      default: _withCtx(() => [_cache[9] || (_cache[9] = _createElementVNode("section", { class: "card legalHero" }, [_createElementVNode("span", { class: "vueBadge" }, "SMT Advanced Business"), _createElementVNode("h2", null, "تواصل مع إدارة المنصة"), _createElementVNode("p", null, "اختر القناة المناسبة حتى يصل طلبك إلى القسم المخول بدون نشر بياناتك للعامة.")], -1)), _createElementVNode("section", _hoisted_1, [_createElementVNode("article", _hoisted_2, [
21138        _cache[0] || (_cache[0] = _createElementVNode("span", null, "💬", -1)),
21139        _cache[1] || (_cache[1] = _createElementVNode("h3", null, "ملاحظة أو اقتراح", -1)),
21140        _cache[2] || (_cache[2] = _createElementVNode("p", null, "للأفكار، تصحيح المعلومات، أو المشكلات التقنية.", -1)),
21141        _createElementVNode("button", {
21142          class: "btn secondary",
21143          onClick: openFeedback
21144        }, _toDisplayString(member?'فتح نموذج الملاحظات':'الدخول ثم إرسال ملاحظة'), 9, _hoisted_3)
21145      ]), _createElementVNode("article", _hoisted_4, [
21146        _cache[3] || (_cache[3] = _createElementVNode("span", null, "🤝", -1)),
21147        _cache[4] || (_cache[4] = _createElementVNode("h3", null, "طلب مساعدة", -1)),
21148        _cache[5] || (_cache[5] = _createElementVNode("p", null, "للترجمة، السكن، الوثائق، الدراسة أو متابعة حالة شخصية.", -1)),
21149        _createElementVNode("button", {
21150          class: "btn secondary",
21151          onClick: $event => ($router.push('/help'))
21152        }, "فتح طلب مساعدة", 8, _hoisted_5)
21153      ]), _createElementVNode("article", _hoisted_6, [
21154        _cache[6] || (_cache[6] = _createElementVNode("span", null, "🆘", -1)),
21155        _cache[7] || (_cache[7] = _createElementVNode("h3", null, "حالة عاجلة", -1)),
21156        _cache[8] || (_cache[8] = _createElementVNode("p", null, "اتصل أولاً بالطوارئ الرسمية ثم استخدم بلاغ المنصة للمتابعة.", -1)),
21157        _createElementVNode("button", {
21158          class: "btn danger",
21159          onClick: $event => ($router.push('/emergency'))
21160        }, "فتح صفحة الطوارئ", 8, _hoisted_7)
21161      ])]), _cache[10] || (_cache[10] = _createElementVNode("section", { class: "card legalSection" }, [
21162        _createElementVNode("h3", null, "عنوان المنصة"),
21163        _createElementVNode("p", null, [_createElementVNode("b", null, "العنوان الرسمي")]),
21164        _createElementVNode("p", { class: "ltr" }, [_createElementVNode("a", {
21165          href: "https://smt.smtd.ai",
21166          target: "_blank",
21167          rel: "noopener noreferrer"
21168        }, "https://smt.smtd.ai")]),
21169        _createElementVNode("p", { class: "hint" }, "استخدم هذا العنوان للوصول إلى المنصة.")
21170      ], -1))]),
21171      _: 1,
21172      __: [9,10]
21173    }))
21174  }
21175}
21176})()
21177  };
21178
21179  const CitiesPage={components:{PublicFrame},setup(){
21180    const hubs=ref([]);const summary=ref(null);const loading=ref(true);const router=useRouter();
21181    onMounted(async()=>{const r=await api('/api/city-hubs');hubs.value=safeArray(r&&r.hubs);summary.value=(r&&r.coverage_summary)||null;loading.value=false;});
21182    // v3.8.55 — a city with no published content is labelled honestly instead of being shown as a
21183    // full destination. Hiding it would understate the platform; faking depth would be worse.
21184    const ready=computed(()=>hubs.value.filter(x=>String(x.coverage_state||'')!=='empty'));
21185    const building=computed(()=>hubs.value.filter(x=>String(x.coverage_state||'')==='empty'));
21186    return{hubs,summary,loading,ready,building,router};},
21187    render:(function(){
21188const _Vue = Vue
21189const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
21190
21191const _hoisted_1 = { class: "dailyHero card" }
21192const _hoisted_2 = {
21193  key: 0,
21194  class: "hint"
21195}
21196const _hoisted_3 = {
21197  key: 0,
21198  class: "card loadingState",
21199  role: "status"
21200}
21201const _hoisted_4 = {
21202  key: 1,
21203  class: "dailyGrid"
21204}
21205const _hoisted_5 = ["onClick"]
21206const _hoisted_6 = {
21207  key: 0,
21208  class: "hint"
21209}
21210const _hoisted_7 = {
21211  key: 2,
21212  class: "card"
21213}
21214const _hoisted_8 = { class: "localCommunityGrid" }
21215const _hoisted_9 = ["onClick"]
21216const _hoisted_10 = { class: "memberCardTop" }
21217const _hoisted_11 = { class: "hint" }
21218
21219return function render(_ctx, _cache) {
21220  with (_ctx) {
21221    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, renderList: _renderList, Fragment: _Fragment, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
21222
21223    const _component_PublicFrame = _resolveComponent("PublicFrame")
21224
21225    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "مدن الصين" }, {
21226      default: _withCtx(() => [
21227        _createElementVNode("section", _hoisted_1, [
21228          _cache[0] || (_cache[0] = _createElementVNode("span", { class: "adminEyebrow" }, "City Hubs", -1)),
21229          _cache[1] || (_cache[1] = _createElementVNode("h2", null, "اختر مدينتك", -1)),
21230          _cache[2] || (_cache[2] = _createElementVNode("p", null, "معلومات وخدمات ومعارض مرتبة حسب المدينة.", -1)),
21231          summary
21232            ? (_openBlock(), _createElementBlock("small", _hoisted_2, _toDisplayString(summary.covered + summary.starter) + " مدينة فيها محتوى منشور من أصل " + _toDisplayString(summary.total_cities) + ".", 1))
21233            : _createCommentVNode("", true)
21234        ]),
21235        loading
21236          ? (_openBlock(), _createElementBlock("div", _hoisted_3, _cache[3] || (_cache[3] = [_createElementVNode("span", {
21237              class: "loadingSpinner",
21238              "aria-hidden": "true"
21239            }, null, -1), _createElementVNode("h3", null, "جاري تحميل المدن...", -1)])))
21240          : _createCommentVNode("", true),
21241        (ready.length)
21242          ? (_openBlock(), _createElementBlock("section", _hoisted_4, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(ready, (x) => {
21243              return (_openBlock(), _createElementBlock("button", {
21244                class: "card dailyTile",
21245                key: x.city_key,
21246                onClick: $event => (router.push('/city/'+x.city_key))
21247              }, [
21248                _cache[4] || (_cache[4] = _createElementVNode("span", { class: "dailyIcon" }, "🏙️", -1)),
21249                _createElementVNode("b", null, _toDisplayString($cityLabel(x)), 1),
21250                _createElementVNode("small", null, _toDisplayString(x.province_ar||x.province_en), 1),
21251                _createElementVNode("p", null, _toDisplayString(x.summary_ar), 1),
21252                (x.item_count)
21253                  ? (_openBlock(), _createElementBlock("small", _hoisted_6, _toDisplayString(x.item_count) + " عنصراً منشوراً", 1))
21254                  : _createCommentVNode("", true),
21255                _cache[5] || (_cache[5] = _createElementVNode("em", null, "فتح مركز المدينة ←", -1))
21256              ], 8, _hoisted_5))
21257            }), 128))]))
21258          : _createCommentVNode("", true),
21259        (!loading && building.length)
21260          ? (_openBlock(), _createElementBlock("section", _hoisted_7, [_cache[6] || (_cache[6] = _createElementVNode("h3", null, "مدن قيد التغطية", -1)), _cache[7] || (_cache[7] = _createElementVNode("p", { class: "hint" }, "هذه المدن مضافة ويجري بناء محتواها الموثق. افتحها لترى ما هو متاح الآن.", -1)), _createElementVNode("div", _hoisted_8, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(building, (x) => {
21261              return (_openBlock(), _createElementBlock("button", {
21262                class: "localCommunityPublicCard clickable",
21263                key: x.city_key,
21264                onClick: $event => (router.push('/city/'+x.city_key))
21265              }, [_createElementVNode("span", _hoisted_10, [_createElementVNode("h4", null, _toDisplayString($cityLabel(x)), 1)]), _createElementVNode("span", _hoisted_11, _toDisplayString(x.province_ar||x.province_en), 1)], 8, _hoisted_9))
21266            }), 128))])]))
21267          : _createCommentVNode("", true)
21268      ]),
21269      _: 1
21270    }))
21271  }
21272}
21273})()};
21274
21275  const CityHubPage={components:{PublicFrame},setup(){const route=useRoute(),router=useRouter(),data=ref(null),loading=ref(true);async function load(){loading.value=true;const r=await api('/api/city-hubs/'+encodeURIComponent(route.params.city));data.value=r&&r.ok?r:null;loading.value=false;}function cityHeroStyle(h){return h&&h.hero_image_url?{backgroundImage:'linear-gradient(rgba(62,26,13,.34),rgba(124,27,16,.78)),url(\"'+h.hero_image_url+'\")'}:{}}onMounted(load);watch(()=>route.params.city,load);return{data,loading,router,cityHeroStyle};},render:(function(){
21276const _Vue = Vue
21277const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
21278
21279const _hoisted_1 = {
21280  key: 0,
21281  class: "card loadingState"
21282}
21283const _hoisted_2 = { class: "adminEyebrow" }
21284const _hoisted_3 = { class: "dailyQuickRow" }
21285const _hoisted_4 = ["onClick"]
21286const _hoisted_5 = ["onClick"]
21287const _hoisted_6 = ["onClick"]
21288const _hoisted_7 = ["onClick"]
21289const _hoisted_8 = { class: "card" }
21290const _hoisted_9 = { class: "dailyList" }
21291const _hoisted_10 = ["onClick"]
21292const _hoisted_11 = {
21293  key: 0,
21294  class: "hint"
21295}
21296const _hoisted_12 = {
21297  key: 0,
21298  class: "infoBox cityCoverageNote"
21299}
21300const _hoisted_13 = { class: "hint" }
21301const _hoisted_14 = {
21302  key: 0,
21303  class: "card"
21304}
21305const _hoisted_15 = { class: "dailyList" }
21306const _hoisted_16 = ["onClick"]
21307
21308return function render(_ctx, _cache) {
21309  with (_ctx) {
21310    const { openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, toDisplayString: _toDisplayString, createElementVNode: _createElementVNode, normalizeStyle: _normalizeStyle, renderList: _renderList, Fragment: _Fragment, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
21311
21312    const _component_PublicFrame = _resolveComponent("PublicFrame")
21313
21314    return (_openBlock(), _createBlock(_component_PublicFrame, { title: data&&data.hub?$cityLabel(data.hub):'مركز المدينة' }, {
21315      default: _withCtx(() => [loading
21316        ? (_openBlock(), _createElementBlock("section", _hoisted_1, "جاري تحميل المدينة..."))
21317        : data
21318          ? (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [
21319              _createElementVNode("section", {
21320                class: "card dailyHero cityHubHero",
21321                style: _normalizeStyle(cityHeroStyle(data.hub))
21322              }, [_createElementVNode("span", _hoisted_2, "SMT China · " + _toDisplayString(data.hub.province_ar), 1), _createElementVNode("h2", null, _toDisplayString($cityLabel(data.hub)), 1), _createElementVNode("p", null, _toDisplayString(data.hub.summary_ar), 1)], 4),
21323              _createElementVNode("section", _hoisted_3, [
21324                _createElementVNode("button", { onClick: $event => (router.push('/new-to-china')) }, "🧭 أنا جديد هنا", 8, _hoisted_4),
21325                _createElementVNode("button", { onClick: $event => (router.push('/services?city='+encodeURIComponent(data.hub.name_en))) }, "✓ خدمات موثوقة", 8, _hoisted_5),
21326                _createElementVNode("button", { onClick: $event => (router.push('/exhibitions?city='+encodeURIComponent(data.hub.name_en))) }, "🗓️ المعارض", 8, _hoisted_6),
21327                _createElementVNode("button", { onClick: $event => (router.push('/toolkit')) }, "🧰 أدوات الحياة", 8, _hoisted_7)
21328              ]),
21329              _createElementVNode("section", _hoisted_8, [_cache[2] || (_cache[2] = _createElementVNode("h3", null, "أهم المعلومات والخدمات", -1)), _createElementVNode("div", _hoisted_9, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(data.guide, (x) => {
21330                return (_openBlock(), _createElementBlock("button", {
21331                  key: x.id,
21332                  onClick: $event => (router.push('/china-guide/'+x.id))
21333                }, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(x.title_ar), 1), _createElementVNode("small", null, _toDisplayString(x.category_name_ar||'دليلك في الصين') + " · " + _toDisplayString(x.trust_tier==='official'?'رسمي':(x.trust_tier==='smt_verified'?'موثق من SMT':'مدرج')), 1)]), _cache[0] || (_cache[0] = _createElementVNode("em", null, "←", -1))], 8, _hoisted_10))
21334              }), 128)), (!data.guide.length)
21335                ? (_openBlock(), _createElementBlock("p", _hoisted_11, "لا توجد معلومات منشورة لهذه المدينة بعد."))
21336                : _createCommentVNode("", true)]), (data.coverage && data.coverage.missing_intents.length)
21337                ? (_openBlock(), _createElementBlock("div", _hoisted_12, [_cache[1] || (_cache[1] = _createElementVNode("b", null, "قيد التغطية", -1)), _createElementVNode("p", _hoisted_13, "تمت تغطية " + _toDisplayString(data.coverage.essential_covered) + " من " + _toDisplayString(data.coverage.essential_total) + " من الأقسام الأساسية لهذه المدينة. الأقسام التي يجري العمل عليها: " + _toDisplayString(data.coverage.intents.filter(i=>i.state==='empty').map(i=>i.label_ar).join('، ')) + ".", 1)]))
21338                : _createCommentVNode("", true)]),
21339              (data.exhibitions.length)
21340                ? (_openBlock(), _createElementBlock("section", _hoisted_14, [_cache[4] || (_cache[4] = _createElementVNode("h3", null, "معارض Ù
21340‚ادمة", -1)), _createElementVNode("div", _hoisted_15, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(data.exhibitions, (x) => {
21341                    return (_openBlock(), _createElementBlock("button", {
21342                      key: x.id,
21343                      onClick: $event => (router.push('/china-guide/'+x.id))
21344                    }, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(x.title_ar), 1), _createElementVNode("small", null, _toDisplayString(x.exhibition_start_date||'التاريخ يحتاج مراجعة'), 1)]), _cache[3] || (_cache[3] = _createElementVNode("em", null, "←", -1))], 8, _hoisted_16))
21345                  }), 128))])]))
21346                : _createCommentVNode("", true)
21347            ], 64))
21348          : _createCommentVNode("", true)]),
21349      _: 1
21350    }, 8, ["title"]))
21351  }
21352}
21353})()};
21354
21355  const NewToChinaPage={components:{PublicFrame},setup(){const store=useGzcStore(),router=useRouter(),type=ref('resident'),data=ref({steps:[],completed:0,total:0});const types=[['visitor','زائر'],['student','طالب'],['trader','تاجر'],['resident','مقيم'],['exhibition','قادم لمعرض'],['business','زيارة عمل']];async function load(){if(!await store.requireMember(router,'/new-to-china'))return;const r=await api('/api/new-to-china?type='+encodeURIComponent(type.value));if(r&&r.ok)data.value=r;}async function toggle(x){const r=await api('/api/new-to-china/progress',{method:'POST',body:JSON.stringify({journey_type:type.value,step_key:x.key,completed:!x.completed})});store.state.msg=r.message||r.error||'';if(r.ok)load();}onMounted(load);watch(type,load);return{store,router,type,types,data,toggle};},render:(function(){
21356const _Vue = Vue
21357const { createElementVNode: _createElementVNode } = _Vue
21358
21359const _hoisted_1 = { class: "card dailyHero" }
21360const _hoisted_2 = { class: "fieldLabel" }
21361const _hoisted_3 = ["onUpdate:modelValue"]
21362const _hoisted_4 = ["value"]
21363const _hoisted_5 = { class: "dailyProgress" }
21364const _hoisted_6 = { class: "journeySteps" }
21365const _hoisted_7 = ["onClick"]
21366const _hoisted_8 = ["onClick"]
21367
21368return function render(_ctx, _cache) {
21369  with (_ctx) {
21370    const { createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, vModelSelect: _vModelSelect, withDirectives: _withDirectives, normalizeStyle: _normalizeStyle, normalizeClass: _normalizeClass, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
21371
21372    const _component_PublicFrame = _resolveComponent("PublicFrame")
21373
21374    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "أنا جديد في الصين" }, {
21375      default: _withCtx(() => [_createElementVNode("section", _hoisted_1, [
21376        _cache[1] || (_cache[1] = _createElementVNode("span", { class: "adminEyebrow" }, "Smart Onboarding", -1)),
21377        _cache[2] || (_cache[2] = _createElementVNode("h2", null, "خطة وصولك للصين", -1)),
21378        _createElementVNode("p", null, "اختر نوع رحلتك، وأنجز الخطوات واحدة واحدة. " + _toDisplayString(data.completed) + " / " + _toDisplayString(data.total), 1),
21379        _createElementVNode("label", _hoisted_2, [_cache[0] || (_cache[0] = _createElementVNode("span", null, "نوع الرحلة", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((type) = $event) }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(types, (t) => {
21380          return (_openBlock(), _createElementBlock("option", {
21381            key: t[0],
21382            value: t[0]
21383          }, _toDisplayString(t[1]), 9, _hoisted_4))
21384        }), 128))], 8, _hoisted_3), [[_vModelSelect, type]])]),
21385        _createElementVNode("div", _hoisted_5, [_createElementVNode("i", { style: _normalizeStyle({width:(data.total?Math.round(data.completed*100/data.total):0)+'%'}) }, null, 4)])
21386      ]), _createElementVNode("section", _hoisted_6, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(data.steps, (x, i) => {
21387        return (_openBlock(), _createElementBlock("article", {
21388          class: _normalizeClass(["card journeyStep", {done:x.completed}]),
21389          key: x.key
21390        }, [_createElementVNode("button", {
21391          class: "journeyCheck",
21392          onClick: $event => (toggle(x))
21393        }, _toDisplayString(x.completed?'✓':i+1), 9, _hoisted_7), _createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(x.title_ar), 1), _createElementVNode("p", null, _toDisplayString(x.summary_ar), 1), _createElementVNode("button", {
21394          class: "smallbtn secondary",
21395          onClick: $event => (router.push(x.action_url))
21396        }, "فتح المساعدة", 8, _hoisted_8)])], 2))
21397      }), 128))])]),
21398      _: 1
21399    }))
21400  }
21401}
21402})()};
21403
21404  // Ask SMT voice input. Native MediaRecorder + Web Audio only (no third-party SDK): the clip is
21405  // uploaded to our server, transcribed there, and the text is placed in the box for review.
21406  const VOICE_MIME_CANDIDATES=['audio/webm;codecs=opus','audio/mp4;codecs=mp4a.40.2','audio/mp4','audio/ogg;
21406codecs=opus','audio/webm'];
21407  const VOICE_SILENCE_STOP_MS=1600,VOICE_NO_SPEECH_MS=7000,VOICE_MIN_SPEECH_MS=200;
21408  function voiceInputSupported(){try{return !!(window.isSecureContext&&navigator.mediaDevices&&typeof navigator.mediaDevices.getUserMedia==='function'&&typeof window.MediaRecorder==='function');}catch(_){return false;}}
21409  function voiceMimeType(){try{return VOICE_MIME_CANDIDATES.find(type=>window.MediaRecorder.isTypeSupported&&window.MediaRecorder.isTypeSupported(type))||'';}catch(_){return '';}}
21410  function voiceExtension(type){const t=String(type||'');return t.includes('mp4')?'m4a':t.includes('ogg')?'ogg':'webm';}
21411  function voiceStartError(error){const name=String(error&&error.name||'');if(name==='NotAllowedError'||name==='SecurityError')return 'اسمح باستخدام الميكروفون لهذا الموقع من إعدادات المتصفح، ثم أعد المحاولة.';if(name==='NotFoundError'||name==='OverconstrainedError')return 'لم نجد ميكروفوناً في هذا الجهاز.';if(name==='NotReadableError'||name==='AbortError')return 'الميكروفون مستخدم في تطبيق آخر. أغلقه ثم أعد المحاولة.';return 'تعذر تشغيل الميكروفون في هذا المتصفح. اكتب سؤالك.';}
21412  function createVoiceInput({onText,maxChars}){
21413    const voice=reactive({supported:voiceInputSupported(),enabled:false,state:'idle',level:0,seconds:0,maxSeconds:45,message:'',messageKind:''});
21414    let stream=null,recorder=null,chunks=[],audioCtx=null,raf=0,tick=0,cancelled=false,startedAt=0,speechMs=0,lastVoiceAt=0,noiseFloor=0.01,lastFrame=0;
21415    // Every start/cancel bumps the generation; results from an older generation are released and ignored.
21416    let generation=0;
21417    function stopTracks(target){if(target){target.getTracks().forEach(track=>{try{track.stop();}catch(_){}});}}
21418    function setMessage(text,kind='info'){voice.message=text;voice.messageKind=kind;}
21419    function release(){if(raf)cancelAnimationFrame(raf);raf=0;if(tick)clearInterval(tick);tick=0;stopTracks(stream);stream=null;if(audioCtx){audioCtx.close().catch(()=>{});}audioCtx=null;voice.level=0;}
21420    function monitor(analyser){
21421      const data=new Uint8Array(analyser.fftSize);
21422      const frame=now=>{
21423        analyser.getByteTimeDomainData(data);
21424        let sum=0;for(let i=0;i<data.length;i++){const v=(data[i]-128)/128;sum+=v*v;}
21425        const rms=Math.sqrt(sum/data.length),elapsed=now-startedAt,dt=lastFrame?now-lastFrame:0;lastFrame=now;
21426        if(elapsed<400)noiseFloor=Math.max(0.004,noiseFloor*0.8+rms*0.2);
21427        const threshold=Math.max(0.02,noiseFloor*3);
21428        voice.level=Math.min(1,rms/(threshold*3));
21429        if(rms>threshold){speechMs+=dt;lastVoiceAt=now;}
21430        if(speechMs<VOICE_MIN_SPEECH_MS&&elapsed>VOICE_NO_SPEECH_MS){cancel('لم نسمع صوتاً. تأكد أن الميكروفون يعمل وتحدث بوضوح.');return;}
21431        if(speechMs>=VOICE_MIN_SPEECH_MS&&now-lastVoiceAt>VOICE_SILENCE_STOP_MS){stop();return;}
21432        raf=requestAnimationFrame(frame);
21433      };
21434      raf=requestAnimationFrame(frame);
21435    }
21436    async function upload(blob,type,gen){
21437      voice.state='processing';setMessage('جارٍ تحويل الصوت إلى نص…');
21438      const form=new FormData();form.append('audio',blob,'clip.'+voiceExtension(type));
21439      const r=await uploadApi('/api/ask-smt/transcribe',{body:form,uploadLabel:'جارٍ تحويل الصوت إلى نص…'});
21440      if(gen!==generation)return;
21441      voice.state='idle';
21442      if(!r||!r.ok||!r.text){setMessage((r&&r.message)||'تعذر تحويل الصوت إلى نص. أعد المحاولة أو اكتب سؤالك.','error');return;}
21443      onText(String(r.text).slice(0,maxChars()));setMessage('تم تحويل كلامك إلى نص.','success');
21444    }
21445    async function start(){
21446      if(voice.state!=='idle'||!voice.supported||!voice.enabled)return;
21447      const gen=++generation;
21448      voice.state='starting';setMessage('');cancelled=false;chunks=[];speechMs=0;lastVoiceAt=0;noiseFloor=0.01;lastFrame=0;
21449      let acquired;
21450      try{acquired=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:true,noiseSuppression:true,autoGainControl:true}});}
21451      catch(error){if(gen!==generation)return;voice.state='idle';release();setMessage(voiceStartError(error),'error');return;}
21452      if(gen!==generation||cancelled){stopTracks(acquired);return;}
21453      stream=acquired;
21454      const mimeType=voiceMimeType();
21455      try{recorder=new MediaRecorder(stream,mimeType?{mimeType,audioBitsPerSecond:32000}:{audioBitsPerSecond:32000});}
21456      catch(_){release();voice.state='idle';setMessage('هذا المتصفح لا يدعم تسجيل الصوت. اكتب سؤالك.','error');return;}
21457      recorder.ondataavailable=event=>{if(event.data&&event.data.size)chunks.push(event.data);};
21458      const ownRecorder=recorder;
21459      recorder.onstop=()=>{const type=ownRecorder.mimeType||mimeType||'audio/webm';if(recorder===ownRecorder)recorder=null;if(gen!==generation)return;release();
21460        if(cancelled){voice.state='idle';return;}
21461        const blob=new Blob(chunks,{type});chunks=[];
21462        if(blob.size<1024||speechMs<VOICE_MIN_SPEECH_MS){voice.state='idle';setMessage('التسجيل قصير جداً. اضغط الميكروفون وتحدث بوضوح.','error');return;}
21463        upload(blob,type,gen).catch(()=>{if(gen!==generation)return;voice.state='idle';setMessage('تعذر إرسال التسجيل. أعد المحاولة.','error');});};
21464      try{const Ctx=window.AudioContext||window.webkitAudioContext;if(Ctx){audioCtx=new Ctx();
21465        // iOS can leave resume() pending; never let it block recording.
21466        if(audioCtx.state==='suspended')await Promise.race([audioCtx.resume().catch(()=>{}),new Promise(done=>setTimeout(done,800))]);
21467        if(gen!==generation){return;}
21468        const analyser=audioCtx.createAnalyser();analyser.fftSize=1024;audioCtx.createMediaStreamSource(stream).connect(analyser);startedAt=performance.now();
21469        if(audioCtx.state==='running')monitor(analyser);else speechMs=VOICE_MIN_SPEECH_MS;}}
21470      catch(_){if(gen!==generation)return;speechMs=VOICE_MIN_SPEECH_MS;}
21471      if(gen!==generation)return;
21472      try{recorder.start(250);}catch(_){release();recorder=null;voice.state='idle';setMessage('تعذر بدء التسجيل. أعد المحاولة.','error');return;}voice.state='recording';voice.seconds=0;setMessage('تحدث الآن… سيتوقف التسجيل تلقائياً عند سكوتك.');
21473      if(navigator.vibrate){try{navigator.vibrate(12);}catch(_){}}
21474      const began=Date.now();tick=setInterval(()=>{voice.seconds=Math.floor((Date.now()-began)/1000);if(voice.seconds>=voice.maxSeconds)stop();},250);
21475    }
21476    function stop(){if(recorder&&recorder.state!=='inactive'){try{recorder.stop();}catch(_){release();voice.state='idle';}}}
21477    function cancel(message){generation++;cancelled=true;const active=recorder;recorder=null;if(active&&active.state!=='inactive'){try{active.stop();}catch(_){}}release();chunks=[];voice.state='idle';if(message)setMessage(message,'error');else setMessage('');}
21478    function toggle(){if(voice.state==='recording')stop();else if(voice.state==='idle')start();}
21479    async function load(){if(!voice.supported)return;const r=await api('/api/ask-smt/voice',{feedback:false});voice.enabled=!!(r&&r.ok&&r.enabled);if(r&&r.max_seconds)voice.maxSeconds=Math.min(60,Math.max(10,Number(r.max_seconds)-5));}
21480    const onHidden=()=>{if(document.visibilityState==='hidden'&&(voice.state==='recording'||voice.state==='starting'))cancel('توقف التسجيل لأن الصفحة لم تعد ظاهرة.');};
21481    document.addEventListener('visibilitychange',onHidden);
21482    onUnmounted(()=>{document.removeEventListener('visibilitychange',onHidden);cancel();});
21483    return {voice,start,stop,cancel,toggle,load};
21484  }
21485  const AskVoiceControl={props:['voice','busy'],emits:['toggle','cancel'],setup(props){
21486    // Five meter bars, taller in the middle, driven by the live input level.
21487    function barStyle(n){const height=Math.max(0.18,Math.min(1,props.voice.level*(1.25-Math.abs(3-n)*0.22)));return {transform:`scaleY(${height.toFixed(3)})`};}
21488    return {barStyle};
21489  },render:(function(){
21490const _Vue = Vue
21491const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
21492
21493const _hoisted_1 = ["disabled", "aria-pressed", "aria-label", "onClick"]
21494const _hoisted_2 = {
21495  key: 0,
21496  class: "askVoiceSpinner",
21497  "aria-hidden": "true"
21498}
21499const _hoisted_3 = {
21500  key: 1,
21501  viewBox: "0 0 24 24",
21502  "aria-hidden": "true"
21503}
21504const _hoisted_4 = {
21505  key: 2,
21506  viewBox: "0 0 24 24",
21507  "aria-hidden": "true"
21508}
21509const _hoisted_5 = { class: "askVoiceLabel" }
21510const _hoisted_6 = {
21511  key: 0,
21512  class: "askVoiceMeter",
21513  "aria-hidden": "true"
21514}
21515const _hoisted_7 = ["onClick"]
21516
21517return function render(_ctx, _cache) {
21518  with (_ctx) {
21519    const { openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, renderList: _renderList, Fragment: _Fragment, normalizeStyle: _normalizeStyle, normalizeClass: _normalizeClass } = _Vue
21520
21521    return (_openBlock(), _createElementBlock(_Fragment, null, [(voice.supported&&voice.enabled)
21522      ? (_openBlock(), _createElementBlock("div", {
21523          key: 0,
21524          class: _normalizeClass(["askVoiceControl", 'is-'+voice.state])
21525        }, [_createElementVNode("button", {
21526          type: "button",
21527          class: "askVoiceButton",
21528          disabled: busy||voice.state==='starting'||voice.state==='processing',
21529          "aria-pressed": voice.state==='recording'?'true':'false',
21530          "aria-label": voice.state==='recording'?'إيقاف التسجيل':'تحدث بدل الكتابة',
21531          onClick: $event => ($emit('toggle'))
21532        }, [(voice.state==='processing'||voice.state==='starting')
21533          ? (_openBlock(), _createElementBlock("span", _hoisted_2))
21534          : (voice.state==='recording')
21535            ? (_openBlock(), _createElementBlock("svg", _hoisted_3, _cache[0] || (_cache[0] = [_createElementVNode("rect", {
21536                x: "7",
21537                y: "7",
21538                width: "10",
21539                height: "10",
21540                rx: "2"
21541              }, null, -1)])))
21542            : (_openBlock(), _createElementBlock("svg", _hoisted_4, _cache[1] || (_cache[1] = [_createElementVNode("path", { d: "M12 15a3.5 3.5 0 0 0 3.5-3.5v-5a3.5 3.5 0 1 0-7 0v5A3.5 3.5 0 0 0 12 15Zm6-3.5a1 1 0 1 0-2 0 4 4 0 0 1-8 0 1 1 0 1 0-2 0 6 6 0 0 0 5 5.91V20H9a1 1 0 1 0 0 2h6a1 1 0 1 0 0-2h-2v-2.59a6 6 0 0 0 5-5.91Z" }, null, -1)]))), _createElementVNode("span", _hoisted_5, _toDisplayString(voice.state==='recording'?('إيقاف · '+voice.seconds+'ث'):voice.state==='processing'?'جارٍ التحويل…':voice.state==='starting'?'جارٍ التشغيل…':'تحدث'), 1)], 8, _hoisted_1), (voice.state==='recording')
21543          ? (_openBlock(), _createElementBlock("span", _hoisted_6, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(5, (n) => {
21544              return (_openBlock(), _createElementBlock("i", {
21545                key: n,
21546                style: _normalizeStyle(barStyle(n))
21547              }, null, 4))
21548            }), 128))]))
21549          : _createCommentVNode("", true), (voice.state==='recording'||voice.state==='starting')
21550          ? (_openBlock(), _createElementBlock("button", {
21551              key: 1,
21552              type: "button",
21553              class: "askVoiceCancel",
21554              "aria-label": "إلغاء التسجيل",
21555              onClick: $event => ($emit('cancel'))
21556            }, "إلغاء", 8, _hoisted_7))
21557          : _createCommentVNode("", true)], 2))
21558      : _createCommentVNode("", true), (voice.supported&&voice.enabled)
21559      ? (_openBlock(), _createElementBlock("p", {
21560          key: 1,
21561          class: _normalizeClass(['askVoiceStatus','is-'+(voice.messageKind||'info'),{isEmpty:!voice.message}]),
21562          role: "status",
21563          "aria-live": "polite"
21564        }, _toDisplayString(voice.message), 3))
21565      : _createCommentVNode("", true)], 64))
21566  }
21567}
21568})()};
21569  // BEGIN step-guidance (pure: no DOM, no network; tested in frontend/tests/step-guidance.test.js)
21570  const StepGuidance=(function(){
21571    const PI=Math.PI,AXIS=6378245.0,ECC=0.00669342162296594323;
21572    function outOfChina(lng,lat){return lng<72.004||lng>137.8347||lat<0.8293||lat>55.8271;}
21573    function tLat(x,y){let r=-100+2*x+3*y+0.2*y*y+0.1*x*y+0.2*Math.sqrt(Math.abs(x));
21573r+=(20*Math.sin(6*x*PI)+20*Math.sin(2*x*PI))*2/3;r+=(20*Math.sin(y*PI)+40*Math.sin(y/3*PI))*2/3;r+=(160*Math.sin(y/12*PI)+320*Math.sin(y*PI/30))*2/3;return r;}
21574    function tLng(x,y){let r=300+x+2*y+0.1*x*x+0.1*x*y+0.1*Math.sqrt(Math.abs(x));r+=(20*Math.sin(6*x*PI)+20*Math.sin(2*x*PI))*2/3;r+=(20*Math.sin(x*PI)+40*Math.sin(x/3*PI))*2/3;r+=(150*Math.sin(x/12*PI)+300*Math.sin(x/30*PI))*2/3;return r;}
21575    // Phone GPS is WGS-84; AMap is GCJ-02. Standard public offset formula, applied on the device only.
21576    function wgs84ToGcj02(lng,lat){
21577      if(!Number.isFinite(lng)||!Number.isFinite(lat))return null;
21578      if(outOfChina(lng,lat))return {longitude:lng,latitude:lat};
21579      let dLat=tLat(lng-105,lat-35),dLng=tLng(lng-105,lat-35);
21580      const radLat=lat/180*PI;let magic=Math.sin(radLat);magic=1-ECC*magic*magic;const sqrtMagic=Math.sqrt(magic);
21581      dLat=(dLat*180)/((AXIS*(1-ECC))/(magic*sqrtMagic)*PI);dLng=(dLng*180)/(AXIS/sqrtMagic*Math.cos(radLat)*PI);
21582      return {longitude:lng+dLng,latitude:lat+dLat};
21583    }
21584    function distanceMeters(a,b){
21585      const toRad=x=>x*PI/180,dLat=toRad(b.latitude-a.latitude),dLng=toRad(b.longitude-a.longitude);
21586      const h=Math.sin(dLat/2)**2+Math.cos(toRad(a.latitude))*Math.cos(toRad(b.latitude))*Math.sin(dLng/2)**2;
21587      return 2*6371000*Math.asin(Math.min(1,Math.sqrt(h)));
21588    }
21589    // pre = announce the manoeuvre, done = step finished, off = distance beyond the step's own length that means "left the route"
21590    const PROFILES={walking:{pre:60,done:20,off:120,accuracy:70},bicycling:{pre:100,done:25,off:200,accuracy:70},electric_bicycle:{pre:100,done:25,off:200,accuracy:70},driving:{pre:300,done:40,off:400,accuracy:90},transit:{pre:60,done:20,off:150,accuracy:70},ride:{pre:400,done:120,off:600,accuracy:100}};
21591    const isRide=step=>step&&(step.type==='transit'||step.type==='railway');
21592    function profileFor(step,mode){return isRide(step)?PROFILES.ride:(PROFILES[mode]||PROFILES.walking);}
21593    function createTracker(steps,options){
21594      const mode=String(options&&options.mode||'walking');
21595      const list=(Array.isArray(steps)?steps:[]).map((step,index)=>({index,type:String(step&&step.type||''),approach:String(step&&step.approach||''),end:step&&step.end&&Number.isFinite(step.end.longitude)&&Number.isFinite(step.end.latitude)?step.end:null,distance:Number(step&&step.distance)||0}));
21596      const approached=new Set(),done=new Set();
21597      let index=0,off=0,offSince=0,offSent=false,started=false;
21598      function advance(events,from,to){
21599        for(let i=from;i<=to;i++){done.add(i);events.push({type:'complete',index:i});}
21600        index=to+1;off=0;offSince=0;offSent=false;
21601        if(index>=list.length)events.push({type:'arrived',index:list.length-1});else events.push({type:'next',index});
21602      }
21603      return {
21604        get index(){return index;},done:()=>Array.from(done),size:()=>list.length,
21605        start(){if(started||!list.length)return [];started=true;return [{type:'start',index:0,total:list.length}];},
21606        manualDone(i){if(i!==index||index>=list.length)return [];const events=[];advance(events,i,i);return events;},
21607        update(fix){
21608          if(!started||index>=list.length||!fix||!Number.isFinite(fix.longitude)||!Number.isFinite(fix.latitude))return [];
21609          const current=list[index],profile=profileFor(current,mode);
21610          if(Number(fix.accuracy)>profile.accuracy)return [];
21611          const events=[];
21612          // jumped ahead (shortcut / missed announcement): finish every step up to the nearest reached end
21613          for(let j=Math.min(list.length-1,index+2);j>index;j--){
21614            const ahead=list[j];
21615            if(ahead.end&&distanceMeters(fix,ahead.end)<=profileFor(ahead,mode).done){advance(events,index,j);return events;}
21616          }
21617          if(!current.end){
21618            // no coordinates for this step (e.g. the walking fallback): finish it once the NEXT step's end is near
21619            const following=list[index+1];
21620            if(following&&following.end&&distanceMeters(fix,following.end)<=profileFor(following,mode).pre){advance(events,index,index);}
21621            return events;
21622          }
21623          const d=distanceMeters(fix,current.end);
21624          if(d<=profile.done){advance(events,index,index);return events;}
21625          if(d<=profile.pre&&!approached.has(index)){approached.add(index);events.push({type:'approach',index,distance:Math.round(d)});}
21626          if(current.distance&&d>current.distance+profile.off){
21627            const now=Number(fix.time)||0;if(!off)offSince=now;off++;
21628            if(off>=3&&(!now||now-offSince>=10000)&&!offSent){offSent=true;events.push({type:'off_route',index});}
21629          }else{off=0;
21629offSince=0;if(offSent&&current.distance&&d<current.distance+profile.off/2)offSent=false;}
21630          return events;
21631        }
21632      };
21633    }
21634    function messageFor(event,steps){
21635      const text=i=>String(steps&&steps[i]&&steps[i].instruction||'');
21636      if(event.type==='start')return 'بدأ التوجيه. الخطوة 1: '+text(0);
21637      if(event.type==='approach')return (steps&&steps[event.index]&&steps[event.index].approach)||('بعد '+event.distance+' متر: '+text(event.index));
21638      if(event.type==='complete')return 'اكتملت الخطوة '+(event.index+1);
21639      if(event.type==='next')return 'الخطوة التالية: '+text(event.index);
21640      if(event.type==='arrived')return 'وصلت إلى وجهتك';
21641      if(event.type==='off_route')return 'يبدو أنك ابتعدت عن المسار. أعد حساب الطريق';
21642      return '';
21643    }
21644    return {wgs84ToGcj02,distanceMeters,createTracker,messageFor,PROFILES};
21645  })();
21646  // END step-guidance
21647  const AskSmtPage={components:{PublicFrame,AskVoiceControl},setup(){
21648    const store=useGzcStore(),router=useRouter(),route=useRoute();
21649    const mode=ref(String(route.query&&route.query.mode||'')==='route'?'route':'ask');
21650    const question=ref(String(route.query&&route.query.q||'').slice(0,1000)),answer=ref(null),questionInput=ref(null);
21651    const navLoading=ref(false),navError=ref(''),navCandidates=ref([]),navAmbiguityToken=ref(''),navDestination=ref(null),navResolutionToken=ref(''),manualMode=ref(false),manualQuery=ref(''),manualCandidates=ref([]),manualAmbiguityToken=ref(''),routeResult=ref(null),selectedRoute=ref(null),routeDetailLoading=ref(false),locationState=ref('idle'),assistMode=ref(''),assistCopyState=ref(''),navNearby=ref([]),navNearbyAvailable=ref(false),navExpanding=ref(false);
21652    // After a voice transcription the search starts by itself 1.5 s later (like AMap); any edit, mode change or the cancel button stops it.
21653    const voiceAuto=reactive({pending:false});let voiceAutoTimer=null,voiceAutoText='';
21654    function cancelVoiceSearch(){if(voiceAutoTimer)clearTimeout(voiceAutoTimer);voiceAutoTimer=null;voiceAuto.pending=false;}
21655    function scheduleVoiceSearch(){
21656      cancelVoiceSearch();voiceAutoText=question.value;
21657      if(question.value.trim().length<(mode.value==='route'?2:3))return;
21658      voiceAuto.pending=true;
21659      voiceAutoTimer=setTimeout(()=>{voiceAutoTimer=null;if(!voiceAuto.pending)return;voiceAuto.pending=false;if(question.value!==voiceAutoText)return;if(mode.value==='route')resolveDestination();else ask();},1500);
21660    }
21661    const voiceInput=createVoiceInput({maxChars:()=>mode.value==='route'?240:1000,onText:text=>{const current=question.value.trim();question.value=(current?current+' '+text:text).slice(0,mode.value==='route'?240:1000);nextTick(()=>{const el=questionInput.value;if(el){el.focus();try{el.setSelectionRange(el.value.length,el.value.length);}catch(_){}}scheduleVoiceSearch();});}});
21662    watch(question,value=>{if(voiceAuto.pending&&value!==voiceAutoText)cancelVoiceSearch();});
21663    function toggleVoice(){cancelVoiceSearch();
21663voiceInput.toggle();}
21664    onUnmounted(cancelVoiceSearch);
21665    const voice=voiceInput.voice;
21666    // Autocomplete: local suggestions first (instant), Amap Input Tips merged a moment later.
21667    const suggest=reactive({items:[],open:false,active:-1,enabled:true});
21668    let suggestTimer=0,suggestSeq=0,suppressSuggest=false,composerFocused=false;
21669    function closeSuggest(){suggest.open=false;suggest.active=-1;}
21670    function showSuggest(){suggest.open=composerFocused&&suggest.items.length>0;}
21671    async function fetchSuggest(text,seq){
21672      const local=await api('/api/ask-smt/suggest?source=local&q='+encodeURIComponent(text),{feedback:false});
21673      if(seq!==suggestSeq)return;
21674      if(!local||!local.ok){suggest.items=[];closeSuggest();return;}
21675      if(local.enabled===false){suggest.enabled=false;suggest.items=[];closeSuggest();return;}
21676      suggest.items=safeArray(local.suggestions);suggest.active=-1;showSuggest();
21677      if(!local.amap_eligible)return;
21678      const remote=await api('/api/ask-smt/suggest?source=amap&q='+encodeURIComponent(text),{feedback:false});
21679      if(seq!==suggestSeq||!remote||!remote.ok)return;
21680      const seen=new Set(suggest.items.map(item=>item.value));
21681      suggest.items=[...suggest.items,...safeArray(remote.suggestions).filter(item=>!seen.has(item.value))].slice(0,8);showSuggest();
21682    }
21683    watch(question,value=>{
21684      if(suppressSuggest){suppressSuggest=false;return;}
21685      clearTimeout(suggestTimer);
21686      const text=String(value||'').trim();
21687      if(!suggest.enabled||!composerFocused||text.length<2||text.length>60){suggestSeq++;suggest.items=[];closeSuggest();return;}
21688      const seq=++suggestSeq;
21689      suggestTimer=setTimeout(()=>{fetchSuggest(text,seq).catch(()=>{});},220);
21690    });
21691    function pickSuggestion(item){
21692      if(!item)return;suggestSeq++;
21693      const next=String(item.value||'').slice(0,mode.value==='route'?240:1000);
21694      suppressSuggest=next!==question.value;question.value=next;suggest.items=[];closeSuggest();
21695      nextTick(()=>{const el=questionInput.value;if(el){el.focus();try{el.setSelectionRange(el.value.length,el.value.length);}catch(_){}}});
21696    }
21697    function onComposerKeydown(event){
21698      if(!suggest.open||!suggest.items.length)return;
21699      const count=suggest.items.length;
21700      if(event.key==='ArrowDown'){event.preventDefault();suggest.active=(suggest.active+1)%count;}
21701      else if(event.key==='ArrowUp'){event.preventDefault();suggest.active=(suggest.active-1+count)%count;}
21702      else if(event.key==='Enter'&&suggest.active>=0){event.preventDefault();pickSuggestion(suggest.items[suggest.active]);}
21703      else if(event.key==='Escape'){event.preventDefault();closeSuggest();}
21704    }
21705    function onComposerFocus(){composerFocused=true;showSuggest();}
21706    function onComposerBlur(){composerFocused=false;setTimeout(()=>{if(!composerFocused)closeSuggest();},150);}
21707    onUnmounted(()=>clearTimeout(suggestTimer));
21708    onMounted(()=>{voiceInput.load().catch(()=>{});});
21709    function closeAssistMode(){assistMode.value='';assistCopyState.value='';}
21710    function resetNavigation(keepQuery=true){stopGuidance();navError.value='';navCandidates.value=[];navNearby.value=[];navNearbyAvailable.value=false;navExpanding.value=false;navAmbiguityToken.value='';navDestination.value=null;navResolutionToken.value='';manualMode.value=false;manualQuery.value='';manualCandidates.value=[];manualAmbiguityToken.value='';routeResult.value=null;selectedRoute.value=null;routeDetailLoading.value=false;locationState.value='idle';closeAssistMode();if(!keepQuery)question.value='';}
21711    function switchMode(value){cancelVoiceSearch();voiceInput.cancel();suggestSeq++;suggest.items=[];closeSuggest();mode.value=value;answer.value=null;resetNavigation(true);nextTick(()=>{if(questionInput.value)questionInput.value.focus();});}
21712    async function ask(){if(!await store.requireMember(router,'/ask'))return;if(question.value.trim().length<3){store.state.msg='اكتب سؤالك بشكل أوضح';return;}store.state.busy=true;answer.value=await api('/api/ask-smt',{method:'POST',body:JSON.stringify({question:question.value})});store.state.busy=false;}
21713    async function resolveDestination(){if(!await store.requireMember(router,'/ask?mode=route'))return;const query=question.value.trim();if(query.length<2){store.state.msg='اكتب اسم الوجهة بصورة أوضح';return;}
21713navLoading.value=true;navError.value='';navCandidates.value=[];navNearby.value=[];navNearbyAvailable.value=false;routeResult.value=null;selectedRoute.value=null;const r=await api('/api/map/resolve-destination',{method:'POST',body:JSON.stringify({query})});navLoading.value=false;if(!r||!r.ok){navError.value=(r&&r.message)||'تعذر البحث عن الوجهة. أعد المحاولة.';return;}navNearbyAvailable.value=r.nearby_available===true;if(r.status==='resolved'&&r.target&&r.resolution_token){navDestination.value=r.target;navResolutionToken.value=r.resolution_token;return;}if(r.status==='ambiguous'||r.status==='needs_selection'){navCandidates.value=safeArray(r.candidates);navAmbiguityToken.value=String(r.ambiguity_token||'');return;}navError.value=r.resolver==='v2'?(r.message||'لم نجد هذه الوجهة'):'لم أجد مكاناً مطابقاً. اكتب الاسم الصيني أو أضف اسم المدينة.';}
21714    async function expandDestinationSearch(){const query=question.value.trim();if(query.length<2||navExpanding.value)return;navExpanding.value=true;const r=await api('/api/map/resolve-destination',{method:'POST',body:JSON.stringify({query,expand:true})});navExpanding.value=false;if(!r||!r.ok){navError.value=(r&&r.message)||'تعذر توسيع البحث الآن.';return;}navNearby.value=safeArray(r.nearby);if(!navNearby.value.length)navError.value='لا توجد أماكن قريبة مسجلة في دليل SMT China لهذه المدينة.';}
21715    async function confirmDestination(candidate){if(!candidate||!navAmbiguityToken.value)return;navLoading.value=true;navError.value='';const r=await api('/api/map/resolve-destination/confirm',{method:'POST',body:JSON.stringify({ambiguity_token:navAmbiguityToken.value,candidate_id:candidate.candidate_id})});navLoading.value=false;if(!r||!r.ok){navError.value=(r&&r.message)||'تعذر تأكيد الوجهة. ابحث عنها مرة أخرى.';return;}navDestination.value=r.target;navResolutionToken.value=r.resolution_token;navCandidates.value=[];navAmbiguityToken.value='';}
21716    async function calculateRoutes(origin,locationConsent=false){if(!navResolutionToken.value)return;navLoading.value=true;navError.value='';routeResult.value=null;selectedRoute.value=null;const r=await api('/api/map/routes',{method:'POST',body:JSON.stringify({resolution_token:navResolutionToken.value,location_consent:locationConsent,origin})});navLoading.value=false;locationState.value='idle';if(!r||!r.ok){navError.value=(r&&r.message)||'حساب الطريق غير متاح مؤقتاً. يمكنك فتح الوجهة في AMap.';return;}routeResult.value=r;manualMode.value=false;manualCandidates.value=[];}
21717    function useCurrentLocation(){navError.value='';if(!navigator.geolocation){navError.value='الموقع غير متاح على هذا الجهاز. اختر نقطة البداية يدوياً.';manualMode.value=true;return;}locationState.value='requesting';navigator.geolocation.getCurrentPosition(position=>{calculateRoutes({longitude:position.coords.longitude,latitude:position.coords.latitude,coordinate_system:'WGS84',source:'current_location'},true);},error=>{locationState.value='idle';manualMode.value=true;navError.value=error&&error.code===1?'تعذّر استخدام موقعك. اختر نقطة البداية يدوياً.':'تعذّر تحديد موقعك الآن. اختر نقطة البداية يدوياً.';},{enableHighAccuracy:true,timeout:10000,maximumAge:30000});}
21718    async function resolveManualOrigin(){const query=manualQuery.value.trim();if(query.length<2){store.state.msg='اكتب اسم نقطة البداية بصورة أوضح';return;}
21718navLoading.value=true;navError.value='';manualCandidates.value=[];const r=await api('/api/map/resolve-destination',{method:'POST',body:JSON.stringify({query,purpose:'origin'})});navLoading.value=false;if(!r||!r.ok){navError.value=(r&&r.message)||'تعذر البحث عن نقطة البداية.';return;}if(r.status==='resolved'&&r.target){return calculateRoutes({longitude:r.target.longitude,latitude:r.target.latitude,coordinate_system:r.target.coordinate_system,source:'amap',citycode:r.target.citycode||null},false);}if(r.status==='ambiguous'){manualCandidates.value=safeArray(r.candidates);manualAmbiguityToken.value=String(r.ambiguity_token||'');return;}navError.value='لم أجد نقطة بداية مطابقة. اكتب الاسم الصيني أو أضف اسم المدينة.';}
21719    async function confirmManualOrigin(candidate){if(!candidate||!manualAmbiguityToken.value)return;navLoading.value=true;navError.value='';const r=await api('/api/map/resolve-destination/confirm',{method:'POST',body:JSON.stringify({ambiguity_token:manualAmbiguityToken.value,candidate_id:candidate.candidate_id})});navLoading.value=false;if(!r||!r.ok){navError.value=(r&&r.message)||'تعذر تأكيد نقطة البداية.';return;}manualCandidates.value=[];manualAmbiguityToken.value='';return calculateRoutes({longitude:r.target.longitude,latitude:r.target.latitude,coordinate_system:r.target.coordinate_system,source:'amap',citycode:r.target.citycode||null},false);}
21720    function improveQuestion(){if(questionInput.value)questionInput.value.focus();}
21721    function openEvidence(x){if(!x)return;if(x.kind==='circular'){router.push('/official-circulars');return;}if(x.kind==='guide'){router.push('/china-guide/'+x.id);return;}const u=safeExternalHttpUrl(x.source_url);if(x.kind==='amap'){openAmapAppPlace(x,message=>{store.state.msg=message;});return;}if(u)window.open(u,'_blank','noopener');}
21722    function openImageSource(x){const u=safeExternalHttpUrl(x&&x.source_url);if(u)window.open(u,'_blank','noopener');}
21723    function openPlaceSuggestion(x){if(x&&x.kind==='guide'){router.push('/china-guide/'+x.id);return;}openAmapAppPlace(x,message=>{store.state.msg=message;});}
21724    async function submitPlaceSuggestion(x){const token=answer.value&&answer.value.place_confirmation&&answer.value.place_confirmation.review_token;if(!x||x.kind!=='amap'||!token)return;const r=await api('/api/ask-smt/place-suggestion',{method:'POST',body:JSON.stringify({review_token:token,candidate_id:x.id})});store.state.msg=r&&r.message||'تعذّر إرسال المكان للمراجعة.';if(r&&r.ok)answer.value.place_confirmation.review_token='';}
21725    function sourceLabel(x){if(!x)return'';if(x.kind==='amap')return'معلومة من خريطة AMap';if(x.kind==='circular')return'مصدر رسمي';if(x.kind==='guide')return x.trust_tier==='official'?'SMT · رسمي':'SMT · موثق';return x.source_name||'مصدر';}
21726    function imageSourceLabel(x){return String(x&&x.source_name||'مصدر الصورة');}
21727    function candidateName(x){return String(x&&x.name_ar||x&&x.name_zh||'مكان');}
21728    function modeLabel(value){return ({transit:'المواصلات العامة',driving:'سيارة أو تاكسي',walking:'المشي',bicycling:'دراجة',electric_bicycle:'دراجة كهربائية'}[String(value||'')])||'طريقة وصول';}
21729    function modeIcon(value){return ({transit:'🚇',driving:'🚕',walking:'🚶',bicycling:'🚲',electric_bicycle:'🛵'}[String(value||'')])||'📍';}
21730    function durationLabel(seconds){const minutes=Math.max(1,Math.round(Number(seconds||0)/60));if(minutes<60)return minutes+' دقيقة';const hours=Math.floor(minutes/60),rest=minutes%60;return hours+' ساعة'+(rest?' و'+rest+' دقيقة':'');}
21731    function distanceLabel(meters){const n=Number(meters||0);return n<1000?Math.round(n)+' متر':(n/1000).toFixed(n>=10000?0:1)+' كم';}
21732    function costLabel(option){return option&&option.cost_available?Number(option.estimated_cost_cny).toFixed(0)+' يوان':'التكلفة غير متوفرة';}
21733    function recalculateRoutes(){stopGuidance();selectedRoute.value=null;routeResult.value=null;navError.value='';}
21734    function clearSelectedRoute(){stopGuidance();selectedRoute.value=null;}
21735    async function selectRouteOption(option){if(!option||!routeResult.value||!routeResult.value.route_result_token)return;stopGuidance();if(Date.parse(routeResult.value.expires_at||'')<=Date.now()){recalculateRoutes();navError.value='انتهت صلاحية حساب الطريق. أعد الحساب للحصول على طريق محدث.';return;}routeDetailLoading.value=true;navError.value='';const r=await api('/api/map/routes/select',{method:'POST',body:JSON.stringify({route_result_token:routeResult.value.route_result_token,route_option_id:option.route_option_id})});routeDetailLoading.value=false;if(!r||!r.ok){if(r&&r.recalculate_required)recalculateRoutes();navError.value=(r&&r.message)||'تعذر فتح تفاصيل الطريق الآن. يمكنك فتح الوجهة في AMap.';return;}selectedRoute.value=r;nextTick(()=>{const el=document.getElementById('selected-route-detail');if(el)el.scrollIntoView({behavior:'smooth',block:'start'});});}
21736    function stepMeta(step){const values=[];if(step&&step.step_distance_meters!==null)values.push(distanceLabel(step.step_distance_meters));if(step&&step.step_duration_seconds!==null)values.push(durationLabel(step.step_duration_seconds));if(step&&step.station_count!==null)values.push(Number(step.station_count)+' محطات');return values.join(' · ');}
21737    function openAssistMode(value){if(!navDestination.value||(value!=='chinese'&&value!=='driver'))return;assistCopyState.value='';assistMode.value=value;}
21738    async function copyAssistAddress(){const value=String(navDestination.value&&(navDestination.value.address_zh||navDe
21738stination.value.name_zh)||'').trim();if(!value)return;try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(value);}else{const input=document.createElement('textarea');input.value=value;input.setAttribute('readonly','');input.style.position='fixed';input.style.opacity='0';document.body.appendChild(input);input.select();const copied=document.execCommand('copy');input.remove();if(!copied)throw new Error('copy_failed');}assistCopyState.value='copied';}catch(_error){assistCopyState.value='failed';}}
21739    function openAmap(){openAmapAppPlace(navDestination.value,message=>{navError.value=message;});}
21740    // ---- Step alerts (foreground, on-device): the phone's position is compared with each step's end point locally.
21741    // Nothing about the position is sent anywhere or stored. Speech / vibration / beep / notification all opt-in via the toggle.
21742    const guide=reactive({on:false,sound:true,index:0,done:[],distance:null,status:'',error:'',weak:false,offRoute:false,voiceNote:''});
21743    let guideTracker=null,guideWatch=null,guideWake=null,guideAudio=null,guideSteps=[];
21744    function guideStepsFrom(option){return safeArray(option&&option.steps).map(step=>({type:step.step_type,end:step.end_location,distance:step.step_distance_meters,instruction:step.instruction_ar,approach:(step.step_type==='transit'||step.step_type==='railway')?('اقتربت من محطة النزول'+(step.arrival_stop_zh?': '+step.arrival_stop_zh:'')):''}));}
21745    function guideBeep(){try{if(!guideAudio){const Ctx=window.AudioContext||window.webkitAudioContext;if(!Ctx)return;guideAudio=new Ctx();}if(guideAudio.state==='suspended')guideAudio.resume();const osc=guideAudio.createOscillator(),gain=guideAudio.createGain();osc.frequency.value=880;gain.gain.value=0.15;osc.connect(gain);gain.connect(guideAudio.destination);osc.start();osc.stop(guideAudio.currentTime+0.18);}catch(_){}}
21746    function guideAlert(text,kind){
21747      guide.status=text;
21748      if(guide.sound){
21749        try{if(window.speechSynthesis&&window.SpeechSynthesisUtterance){const voice=window.speechSynthesis.getVoices().find(v=>/^ar/i.test(v.lang)&&v.localService);/* on-device Arabic voice only: network voices are unreliable in China */if(voice){window.speechSynthesis.cancel();const u=new SpeechSynthesisUtterance(text);u.voice=voice;u.lang=voice.lang;window.speechSynthesis.speak(u);}}}catch(_){}
21750        guideBeep();
21751        try{if(navigator.vibrate)navigator.vibrate(kind==='approach'?[200]:[150,80,150]);}catch(_){}
21752      }
21753    }
21754    // iOS only allows speech after a tap and often lists voices late: prime inside the tap, say so when no on-device Arabic voice exists.
21755    function guideUnlockSpeech(){
21756      guide.voiceNote='';
21757      try{
21758        const synth=window.speechSynthesis;
21759        if(!synth||!window.SpeechSynthesisUtterance){guide.voiceNote='جهازك لا يدعم النطق: ستظهر التنبيهات نصاً مع نغمة.';return;}
21760        const pick=()=>synth.getVoices().find(v=>/^ar/i.test(v.lang)&&v.localService);
21761        const voice=pick();
21762        if(voice){const u=new SpeechSynthesisUtterance('تم تفعيل التنبيهات');u.voice=voice;u.lang=voice.lang;synth.speak(u);}
21763        else{
21764          guide.voiceNote='لا يوجد صوت عربي على جهازك: ستسمع نغمة والنص يظهر على الشاشة.';
21765          synth.addEventListener&&synth.addEventListener('voiceschanged',()=>{if(pick())guide.voiceNote='';},{once:true});
21766        }
21767      }catch(_){}
21768    }
21769    function guideHandle(events){
21770      if(!events||!events.length||!guideTracker)return;
21771      const parts=[];let kind='step';
21772      for(const event of events){
21773        if(event.type==='complete'&&!guide.done.includes(event.index))guide.done.push(event.index);
21774        if(event.type==='approach')kind='approach';
21775        if(event.type==='off_route')guide.offRoute=true;
21776        const message=StepGuidance.messageFor(event,guideSteps);if(message)parts.push(message);
21777      }
21778      guide.index=Math.min(guideTracker.index,guideSteps.length-1);
21779      if(events.some(e=>e.type==='arrived')){guide.index=guideSteps.length;guideAlert(parts.join('. '),'step');stopGuidance(true);return;}
21780      guideAlert(parts.join('. '),kind);
21781    }
21782    async function guideKeepAwake(){try{if(!navigator.wakeLock||document.visibilityState!=='visible')return;if(guideWake){try{await guideWake.release();}catch(_){}guideWake=null;}const lock=await navigator.wakeLock.request('screen');if(!guide.on){try{await lock.release();}catch(_){}return;}guideWake=lock;}catch(_){guideWake=null;}}
21783    function startGuidance(){
21784      const option=selectedRoute.value&&selectedRoute.value.route_option;
21785      if(!option||guide.on)return;
21786      if(!navigator.geolocation){guide.error='المتصفح لا يدعم تحديد الموقع.';return;}
21787      guideSteps=guideStepsFrom(option);
21788      if(!guideSteps.some(step=>step.end)){guide.error='لا تتوفر إحداثيات هذه الخطوات. أعد حساب الطريق ثم جرّب مرة أخرى.';return;}
21789      guide.error='';guide.done=[];guide.index=0;guide.distance=null;guide.on=true;
21790      guideTracker=StepGuidance.createTracker(guideSteps,{mode:option.mode});
21791      guideBeep();guideKeepAwake();
21792      guideUnlockSpeech();
21793      guideHandle(guideTracker.start());
21794      guideWatch=navigator.geolocation.watchPosition(position=>{
21795        const point=StepGuidance.wgs84ToGcj02(position.coords.longitude,position.coords.latitude);
21796        if(!point||!guideTracker)return;
21797        const fix={longitude:point.longitude,latitude:point.latitude,accuracy:position.coords.accuracy,time:Date.now()};
21798        guide.weak=position.coords.accuracy>90;
21799        const current=guideSteps[guideTracker.index];
21800        guide.distance=current&&current.end?Math.round(StepGuidance.distanceMeters(fix,current.end)):null;
21801        guide.error='';
21802        guideHandle(guideTracker.update(fix));
21803      },error=>{guide.error=error&&error.code===1?'لم يُسمح بتحديد الموقع. فعّله من إعدادات المتصفح للتنبيهات.':'تعذر تحديد موقعك الآن. تأكد من تفعيل GPS.';if(error&&error.code===1)stopGuidance();},{enableHighAccuracy:true,maximumAge:1500,timeout:20000});
21804      document.addEventListener('visibilitychange',guideVisibility);
21805    }
21806    function guideVisibility(){if(guide.on&&document.visibilityState==='visible')guideKeepAwake();}
21807    function stopGuidance(keepStatus){
21808      if(guideWatch!==null&&navigator.geolocation){try{navigator.geolocation.clearWatch(guideWatch);}catch(_){}}
21809      guideWatch=null;
21810      try{if(guideWake){guideWake.release();}}catch(_){}
21811      guideWake=null;
21812      try{if(window.speechSynthesis&&!keepStatus)window.speechSynthesis.cancel();}catch(_){}
21813      document.removeEventListener('visibilitychange',guideVisibility);
21814      guide.on=false;guideTracker=null;guide.weak=false;guide.offRoute=false;
21815      if(!keepStatus){guide.status='';guide.distance=null;guide.index=0;guide.done=[];guide.voiceNote='';}
21816    }
21817    function guideManual(index){if(guideTracker)guideHandle(guideTracker.manualDone(index));}
21818    onUnmounted(()=>stopGuidance());
21819    return{guide,startGuidance,stopGuidance,guideManual,suggest,pickSuggestion,onComposerKeydown,onComposerFocus,onComposerBlur,voice,voiceToggle:toggleVoice,voiceAuto,cancelVoiceSearch,voiceCancel:()=>voiceInput.cancel(),navNearby,navNearbyAvailable,navExpanding,expandDestinationSearch,store,router,mode,question,questionInput,answer,ask,switchMode,improveQuestion,openEvidence,openImageSource,openPlaceSuggestion,submitPlaceSuggestion,sourceLabel,imageSourceLabel,shortDate,navLoading,navError,navCandidates,navDestination,manualMode,manualQuery,manualCandidates,routeResult,selectedRoute,routeDetailLoading,locationState,assistMode,assistCopyState,resetNavigation,resolveDestination,confirmDestination,useCurrentLocation,resolveManualOrigin,confirmManualOrigin,candidateName,modeLabel,modeIcon,durationLabel,distanceLabel,costLabel,recalculateRoutes,clearSelectedRoute,selectRouteOption,stepMeta,openAssistMode,closeAssistMode,copyAssistAddress,openAmap};
21820  },render:(function(){
21821const _Vue = Vue
21822const { createVNode: _createVNode, createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
21823
21824const _hoisted_1 = { class: "card dailyHero askSmtHero askSmtSearchCard" }
21825const _hoisted_2 = {
21826  class: "askModeTabs",
21827  role: "tablist",
21828  "aria-label": "نوع المساعدة"
21829}
21830const _hoisted_3 = ["onClick"]
21831const _hoisted_4 = ["onClick"]
21832const _hoisted_5 = {
21833  key: 0,
21834  class: "askVoiceAuto",
21835  role: "status",
21836  "aria-live": "polite"
21837}
21838const _hoisted_6 = ["onClick"]
21839const _hoisted_7 = {
21840  key: 1,
21841  class: "askSearchComposer"
21842}
21843const _hoisted_8 = { class: "askInputWrap" }
21844const _hoisted_9 = ["onUpdate:modelValue", "aria-activedescendant", "onKeydown", "onFocus", "onBlur"]
21845const _hoisted_10 = {
21846  id: "askSuggestList",
21847  class: "askSuggestList",
21848  role: "listbox",
21849  "aria-label": "اقتراحات"
21850}
21851const _hoisted_11 = ["id", "aria-selected", "onMousedown", "onClick"]
21852const _hoisted_12 = {
21853  class: "askSuggestIcon",
21854  "aria-hidden": "true"
21855}
21856const _hoisted_13 = { class: "askSuggestText" }
21857const _hoisted_14 = ["lang", "dir"]
21858const _hoisted_15 = {
21859  key: 0,
21860  dir: "auto"
21861}
21862const _hoisted_16 = { key: 0 }
21863const _hoisted_17 = { class: "askComposerActions" }
21864const _hoisted_18 = ["disabled", "onClick"]
21865const _hoisted_19 = {
21866  key: 2,
21867  class: "askSearchComposer"
21868}
21869const _hoisted_20 = { class: "askInputWrap" }
21870const _hoisted_21 = ["onUpdate:modelValue", "aria-activedescendant", "onKeydown", "onFocus", "onBlur"]
21871const _hoisted_22 = {
21872  id: "askSuggestList",
21873  class: "askSuggestList",
21874  role: "listbox",
21875  "aria-label": "اقتراحات"
21876}
21877const _hoisted_23 = ["id", "aria-selected", "onMousedown", "onClick"]
21878const _hoisted_24 = {
21879  class: "askSuggestIcon",
21880  "aria-hidden": "true"
21881}
21882const _hoisted_25 = { class: "askSuggestText" }
21883const _hoisted_26 = ["lang", "dir"]
21884const _hoisted_27 = {
21885  key: 0,
21886  dir: "auto"
21887}
21888const _hoisted_28 = { key: 0 }
21889const _hoisted_29 = { class: "askComposerActions" }
21890const _hoisted_30 = ["disabled", "onClick"]
21891const _hoisted_31 = {
21892  key: 3,
21893  class: "routeQuerySummary"
21894}
21895const _hoisted_32 = ["onClick"]
21896const _hoisted_33 = {
21897  key: 0,
21898  class: "card askAnswer askResultCard"
21899}
21900const _hoisted_34 = { class: "askResultHead" }
21901const _hoisted_35 = { class: "sectionEyebrow" }
21902const _hoisted_36 = {
21903  key: 0,
21904  class: "askAnswerText"
21905}
21906const _hoisted_37 = {
21907  key: 1,
21908  class: "askPlaceCandidates"
21909}
21910const _hoisted_38 = { class: "askPlaceQuery" }
21911const _hoisted_39 = ["lang", "dir"]
21912const _hoisted_40 = {
21913  key: 0,
21914  class: "askPlaceAddressZh",
21915  lang: "zh-CN",
21916  dir: "ltr"
21917}
21918const _hoisted_41 = {
21919  key: 1,
21920  class: "askPlaceAddressZh",
21921  lang: "zh-CN",
21922  dir: "ltr"
21923}
21924const _hoisted_42 = ["disabled", "onClick"]
21925const _hoisted_43 = ["onClick"]
21926const _hoisted_44 = {
21927  key: 2,
21928  class: "askImageStrip",
21929  "aria-label": "صور مرتبطة بالبحث"
21930}
21931const _hoisted_45 = ["src", "alt"]
21932const _hoisted_46 = ["onClick"]
21933const _hoisted_47 = {
21934  key: 3,
21935  class: "askSourcesSection"
21936}
21937const _hoisted_48 = { class: "askEvidenceGrid" }
21938const _hoisted_49 = ["onClick"]
21939const _hoisted_50 = { class: "askEvidenceIndex" }
21940const _hoisted_51 = {
21941  key: 4,
21942  class: "askFollowupRow"
21943}
21944const _hoisted_52 = ["onClick"]
21945const _hoisted_53 = {
21946  key: 0,
21947  class: "routeUserError",
21948  role: "alert"
21949}
21950const _hoisted_54 = {
21951  key: 1,
21952  class: "card routeChoiceCard"
21953}
21954const _hoisted_55 = { class: "routeCandidateList" }
21955const _hoisted_56 = ["disabled", "onClick"]
21956const _hoisted_57 = ["lang", "dir"]
21957const _hoisted_58 = {
21958  key: 0,
21959  lang: "zh-CN",
21960  dir: "ltr"
21961}
21962const _hoisted_59 = {
21963  key: 1,
21964  lang: "zh-CN",
21965  dir: "ltr"
21966}
21967const _hoisted_60 = {
21968  key: 2,
21969  class: "routeIndexNote"
21970}
21971const _hoisted_61 = {
21972  key: 2,
21973  class: "card routeChoiceCard routeNearbyCard"
21974}
21975const _hoisted_62 = ["disabled", "onClick"]
21976const _hoisted_63 = {
21977  key: 1,
21978  class: "routeCandidateList"
21979}
21980const _hoisted_64 = {
21981  key: 0,
21982  lang: "zh-CN",
21983  dir: "ltr"
21984}
21985const _hoisted_65 = {
21986  key: 1,
21987  lang: "zh-CN",
21988  dir: "ltr"
21989}
21990const _hoisted_66 = {
21991  key: 3,
21992  class: "card routeDestinationCard"
21993}
21994const _hoisted_67 = {
21995  key: 0,
21996  class: "routeChineseName",
21997  lang: "zh-CN",
21998  dir: "ltr"
21999}
22000const _hoisted_68 = {
22001  key: 1,
22002  class: "routeChineseAddress",
22003  lang: "zh-CN",
22004  dir: "ltr"
22005}
22006const _hoisted_69 = {
22007  key: 2,
22008  class: "routeAssistActions"
22009}
22010const _hoisted_70 = ["onClick"]
22011const _hoisted_71 = ["onClick"]
22012const _hoisted_72 = {
22013  key: 4,
22014  class: "card routeOriginCard"
22015}
22016const _hoisted_73 = ["disabled", "onClick"]
22017const _hoisted_74 = ["onClick"]
22018const _hoisted_75 = {
22019  key: 5,
22020  class: "card routeOriginCard"
22021}
22022const _hoisted_76 = { class: "routeManualComposer" }
22023const _hoisted_77 = ["onUpdate:modelValue"]
22024const _hoisted_78 = ["disabled", "onClick"]
22025const _hoisted_79 = ["onClick"]
22026const _hoisted_80 = {
22027  key: 0,
22028  class: "routeCandidateList manual"
22029}
22030const _hoisted_81 = ["disabled", "onClick"]
22031const _hoisted_82 = {
22032  key: 0,
22033  lang: "zh-CN",
22034  dir: "ltr"
22035}
22036const _hoisted_83 = {
22037  key: 1,
22038  lang: "zh-CN",
22039  dir: "ltr"
22040}
22041const _hoisted_84 = {
22042  key: 6,
22043  class: "routeOptionsSection"
22044}
22045const _hoisted_85 = { class: "routeOptionGrid" }
22046const _hoisted_86 = ["disabled", "onClick"]
22047const _hoisted_87 = {
22048  class: "routeModeIcon",
22049  "aria-hidden": "true"
22050}
22051const _hoisted_88 = { class: "routeOptionBody" }
22052const _hoisted_89 = { class: "routeOptionTitle" }
22053const _hoisted_90 = { class: "routeOptionMeta" }
22054const _hoisted_91 = {
22055  key: 0,
22056  class: "routeOptionSummary"
22057}
22058const _hoisted_92 = {
22059  key: 0,
22060  class: "routeUserError"
22061}
22062const _hoisted_93 = ["onClick"]
22063const _hoisted_94 = ["onClick"]
22064const _hoisted_95 = {
22065  key: 7,
22066  id: "selected-route-detail",
22067  class: "card routeDetailSection"
22068}
22069const _hoisted_96 = { class: "routeDetailHead" }
22070const _hoisted_97 = ["onClick"]
22071const _hoisted_98 = { class: "routeGuidanceBar" }
22072const _hoisted_99 = { class: "row" }
22073const _hoisted_100 = ["onClick"]
22074const _hoisted_101 = ["onClick"]
22075const _hoisted_102 = { class: "checkLine" }
22076const _hoisted_103 = ["onUpdate:modelValue"]
22077const _hoisted_104 = {
22078  key: 0,
22079  class: "routeGuidanceStatus",
22080  role: "status",
22081  "aria-live": "polite"
22082}
22083const _hoisted_105 = { key: 0 }
22084const _hoisted_106 = {
22085  key: 1,
22086  class: "routeGuidanceMessage",
22087  role: "status",
22088  "aria-live": "polite"
22089}
22090const _hoisted_107 = {
22091  key: 2,
22092  class: "hint"
22093}
22094const _hoisted_108 = {
22095  key: 3,
22096  class: "hint"
22097}
22098const _hoisted_109 = {
22099  key: 4,
22100  class: "routeUserError",
22101  role: "alert"
22102}
22103const _hoisted_110 = ["onClick"]
22104const _hoisted_111 = {
22105  key: 5,
22106  class: "routeUserError",
22107  role: "alert"
22108}
22109const _hoisted_112 = { class: "routeStepList" }
22110const _hoisted_113 = { class: "routeStepNumber" }
22111const _hoisted_114 = {
22112  key: 0,
22113  class: "routeStepChinese",
22114  lang: "zh-CN",
22115  dir: "ltr"
22116}
22117const _hoisted_115 = {
22118  key: 1,
22119  class: "routeStepChinese",
22120  lang: "zh-CN",
22121  dir: "ltr"
22122}
22123const _hoisted_116 = {
22124  key: 2,
22125  class: "routeStepEnglish",
22126  lang: "en",
22127  dir: "ltr"
22128}
22129const _hoisted_117 = {
22130  key: 3,
22131  class: "routeTransitFacts"
22132}
22133const _hoisted_118 = { key: 0 }
22134const _hoisted_119 = {
22135  lang: "zh-CN",
22136  dir: "ltr"
22137}
22138const _hoisted_120 = {
22139  key: 0,
22140  class: "routeStepEnglish",
22141  dir: "ltr"
22142}
22143const _hoisted_121 = { key: 1 }
22144const _hoisted_122 = {
22145  lang: "zh-CN",
22146  dir: "ltr"
22147}
22148const _hoisted_123 = {
22149  key: 0,
22150  class: "routeStepEnglish",
22151  dir: "ltr"
22152}
22153const _hoisted_124 = { key: 2 }
22154const _hoisted_125 = {
22155  lang: "zh-CN",
22156  dir: "ltr"
22157}
22158const _hoisted_126 = {
22159  key: 0,
22160  class: "routeStepEnglish",
22161  dir: "ltr"
22162}
22163const _hoisted_127 = { key: 4 }
22164const _hoisted_128 = ["onClick"]
22165const _hoisted_129 = {
22166  key: 0,
22167  class: "routeUserError"
22168}
22169const _hoisted_130 = ["onClick"]
22170const _hoisted_131 = ["aria-label"]
22171const _hoisted_132 = ["onClick"]
22172const _hoisted_133 = {
22173  lang: "zh-CN",
22174  dir: "ltr"
22175}
22176const _hoisted_134 = { class: "routeAssistPhrase" }
22177const _hoisted_135 = { key: 0 }
22178const _hoisted_136 = {
22179  key: 1,
22180  class: "routeAssistAddress"
22181}
22182const _hoisted_137 = ["onClick"]
22183const _hoisted_138 = {
22184  key: 1,
22185  role: "alert"
22186}
22187const _hoisted_139 = ["onClick"]
22188
22189return function render(_ctx, _cache) {
22190  with (_ctx) {
22191    const { normalizeClass: _normalizeClass, createElementVNode: _createElementVNode, createTextVNode: _createTextVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, vModelText: _vModelText, withDirectives: _withDirectives, renderList: _renderList, Fragment: _Fragment, toDisplayString: _toDisplayString, withModifiers: _withModifiers, vShow: _vShow, resolveComponent: _resolveComponent, createVNode: _createVNode, vModelCheckbox: _vModelCheckbox, withCtx: _withCtx, createBlock: _createBlock } = _Vue
22192
22193    const _component_AskVoiceControl = _resolveComponent("AskVoiceControl")
22194    const _component_PublicFrame = _resolveComponent("PublicFrame")
22195
22196    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "اسأل SMT China" }, {
22197      default: _withCtx(() => [_createElementVNode("section", _hoisted_1, [_createElementVNode("div", _hoisted_2, [_createElementVNode("button", {
22198        class: _normalizeClass({active:mode==='ask'}),
22199        onClick: $event => (switchMode('ask'))
22200      }, "اسأل SMT", 10, _hoisted_3), _createElementVNode("button", {
22201        class: _normalizeClass({active:mode==='route'}),
22202        onClick: $event => (switchMode('route'))
22203      }, "احسب طريقك", 10, _hoisted_4)]), (voiceAuto.pending)
22204        ? (_openBlock(), _createElementBlock("p", _hoisted_5, [_cache[0] || (_cache[0] = _createTextVNode("جارٍ البحث بنص كلامك… ")), _createElementVNode("button", {
22205            type: "button",
22206            class: "smallbtn secondary",
22207            onClick: cancelVoiceSearch
22208          }, "إلغاء", 8, _hoisted_6)]))
22209        : _createCommentVNode("", true), (mode==='ask')
22210        ? (_openBlock(), _createElementBlock("div", _hoisted_7, [_createElementVNode("div", _hoisted_8, [_withDirectives(_createElementVNode("textarea", {
22211            ref: "questionInput",
22212            "onUpdate:modelValue": $event => ((question) = $event),
22213            maxlength: "1000",
22214            placeholder: "اسأل عن مكان أو خدمة داخل الصين...",
22215            "aria-autocomplete": "list",
22216            "aria-controls": "askSuggestList",
22217            "aria-activedescendant": suggest.open&&suggest.active>=0?'askSuggest-'+suggest.active:null,
22218            onKeydown: onComposerKeydown,
22219            onFocus: onComposerFocus,
22220            onBlur: onComposerBlur
22221          }, null, 40, _hoisted_9), [[_vModelText, question]]), _withDirectives(_createElementVNode("ul", _hoisted_10, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(suggest.items, (x, i) => {
22222            return (_openBlock(), _createElementBlock("li", {
22223              key: x.kind+':'+(x.id||x.value),
22224              id: 'askSuggest-'+i,
22225              role: "option",
22226              "aria-selected": i===suggest.active?'true':'false',
22227              class: _normalizeClass({active:i===suggest.active}),
22228              onMousedown: _withModifiers(() => {}, ["prevent"]),
22229              onClick: $event => (pickSuggestion(x))
22230            }
22230, [_createElementVNode("span", _hoisted_12, _toDisplayString(x.kind==='amap'?'🗺️':(x.kind==='guide'?'📍':(x.kind==='place'?'🧭':'🏙️'))), 1), _createElementVNode("span", _hoisted_13, [_createElementVNode("b", {
22231              lang: x.lang||'ar',
22232              dir: x.lang==='zh-CN'?'ltr':'auto'
22233            }, _toDisplayString(x.label), 9, _hoisted_14), (x.sublabel)
22234              ? (_openBlock(), _createElementBlock("small", _hoisted_15, _toDisplayString(x.sublabel), 1))
22235              : _createCommentVNode("", true)]), (x.kind==='amap')
22236              ? (_openBlock(), _createElementBlock("em", _hoisted_16, "AMap"))
22237              : _createCommentVNode("", true)], 42, _hoisted_11))
22238          }), 128))], 512), [[_vShow, suggest.open]])]), _createElementVNode("div", _hoisted_17, [_createVNode(_component_AskVoiceControl, {
22239            voice: voice,
22240            busy: store.state.busy,
22241            onToggle: voiceToggle,
22242            onCancel: voiceCancel
22243          }, null, 8, ["voice", "busy", "onToggle", "onCancel"]), _createElementVNode("button", {
22244            class: "btn",
22245            disabled: store.state.busy||voice.state==='recording'||voice.state==='processing',
22246            onClick: ask
22247          }, _toDisplayString(store.state.busy?'جارٍ البحث…':'اسأل SMT'), 9, _hoisted_18)])]))
22248        : (!navDestination)
22249          ? (_openBlock(), _createElementBlock("div", _hoisted_19, [_createElementVNode("div", _hoisted_20, [_withDirectives(_createElementVNode("textarea", {
22250              ref: "questionInput",
22251              "onUpdate:modelValue": $event => ((question) = $event),
22252              maxlength: "240",
22253              placeholder: "اكتب اسم المكان أو المنطقة التي تريد الذهاب إليها...",
22254              "aria-autocomplete": "list",
22255              "aria-controls": "askSuggestList",
22256              "aria-activedescendant": suggest.open&&suggest.active>=0?'askSuggest-'+suggest.active:null,
22257              onKeydown: onComposerKeydown,
22258              onFocus: onComposerFocus,
22259              onBlur: onComposerBlur
22260            }, null, 40, _hoisted_21), [[_vModelText, question]]), _withDirectives(_createElementVNode("ul", _hoisted_22, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(suggest.items, (x, i) => {
22261              return (_openBlock(), _createElementBlock("li", {
22262                key: x.kind+':'+(x.id||x.value),
22263                id: 'askSuggest-'+i,
22264                role: "option",
22265                "aria-selected": i===suggest.active?'true':'false',
22266                class: _normalizeClass({active:i===suggest.active}),
22267                onMousedown: _withModifiers(() => {}, ["prevent"]),
22268                onClick: $event => (pickSuggestion(x))
22269              }, [_createElementVNode("span", _hoisted_24, _toDisplayString(x.kind==='amap'?'🗺️':(x.kind==='guide'?'📍':(x.kind==='place'?'🧭':'🏙️'))), 1), _createElementVNode("span", _hoisted_25, [_createElementVNode("b", {
22270                lang: x.lang||'ar',
22271                dir: x.lang==='zh-CN'?'ltr':'auto'
22272              }, _toDisplayString(x.label), 9, _hoisted_26), (x.sublabel)
22273                ? (_openBlock(), _createElementBlock("small", _hoisted_27, _toDisplayString(x.sublabel), 1))
22274                : _createCommentVNode("", true)]), (x.kind==='amap')
22275                ? (_openBlock(), _createElementBlock("em", _hoisted_28, "AMap"))
22276                : _createCommentVNode("", true)], 42, _hoisted_23))
22277            }), 128))], 512), [[_vShow, suggest.open]])]), _createElementVNode("div", _hoisted_29, [_createVNode(_component_AskVoiceControl, {
22278              voice: voice,
22279              busy: navLoading,
22280              onToggle: voiceToggle,
22281              onCancel: voiceCancel
22282            }, null, 8, ["voice", "busy", "onToggle", "onCancel"]), _createElementVNode("button", {
22283              class: "btn",
22284              disabled: navLoading||voice.state==='recording'||voice.state==='processing',
22285              onClick: resolveDestination
22286            }, _toDisplayString(navLoading?'جارٍ البحث…':'ابحث عن الوجهة'), 9, _hoisted_30)])]))
22287          : (_openBlock(), _createElementBlock("div", _hoisted_31, [_cache[1] || (_cache[1] = _createElementVNode("span", null, "الوجهة المختارة", -1)), _createElementVNode("b", null, _toDisplayString(candidateName(navDestination)), 1), _createElementVNode("button", {
22288              class: "smallbtn secondary",
22289              onClick: $event => (resetNavigation(true))
22290            }, "تغيير الوجهة", 8, _hoisted_32)]))]), (mode==='ask'&&answer)
22291        ? (_openBlock(), _createElementBlock("section", _hoisted_33, [
22292            _createElementVNode("header", _hoisted_34, [_createElementVNode("div", null, [_createElementVNode("span", _hoisted_35, _toDisplayString(answer.place_confirmation?(answer.provider==='smt_place_candidates'?'نتائج دليل SMT China':'نتائج AMap المقترحة'):(answer.answered?'Ù
22292†ØªÙŠØ¬Ø© البحث':(answer.reason==='out_of_scope'?'دليل الصين فقط':'نتيجة البحث'))), 1), _createElementVNode("h2", null, _toDisplayString(answer.place_confirmation?'هل تقصد هذا المكان؟':(answer.answered?'الإجابة':(answer.reason==='out_of_scope'?'هذا السؤال خارج نطاق الدليل':'لم أتمكن من العثور على إجابة مؤكدة.'))), 1)])]),
22293            (!answer.place_confirmation)
22294              ? (_openBlock(), _createElementBlock("p", _hoisted_36, _toDisplayString(answer.answered?answer.answer:(answer.answer||'أضف اسم المدينة أو نوع المكان لتحديد ما تبحث عنه.')), 1))
22295              : _createCommentVNode("", true),
22296            (answer.place_confirmation)
22297              ? (_openBlock(), _createElementBlock("section", _hoisted_37, [_createElementVNode("p", _hoisted_38, [_cache[2] || (_cache[2] = _createTextVNode("نتائج البحث عن: ")), _createElementVNode("b", null, _toDisplayString(answer.place_confirmation.query_label), 1)]), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(answer.place_confirmation.candidates, (x) => {
22298                  return (_openBlock(), _createElementBlock("article", {
22299                    key: x.id,
22300                    class: "askPlaceCandidate"
22301                  }, [
22302                    _createElementVNode("b", {
22303                      class: _normalizeClass({'askPlaceNameZh':x.kind!=='guide'}),
22304                      lang: x.kind==='guide'?'ar':'zh-CN',
22305                      dir: x.kind==='guide'?'rtl':'ltr'
22306                    }, _toDisplayString(x.kind==='guide'?x.title:x.name_zh), 11, _hoisted_39),
22307                    (x.kind==='guide'&&x.name_zh&&x.name_zh!==x.title)
22308                      ? (_openBlock(), _createElementBlock("p", _hoisted_40, _toDisplayString(x.name_zh), 1))
22309                      : _createCommentVNode("", true),
22310                    (x.address_zh)
22311                      ? (_openBlock(), _createElementBlock("p", _hoisted_41, _toDisplayString(x.address_zh), 1))
22312                      : _createCommentVNode("", true),
22313                    _createElementVNode("small", null, [_createTextVNode(_toDisplayString(x.city||''), 1), (x.district)
22314                      ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createTextVNode(" · " + _toDisplayString(x.district), 1)], 64))
22315                      : _createCommentVNode("", true), _createTextVNode(" · " + _toDisplayString(x.kind==='guide'?'من دليل SMT China المعتمد':'معلومة من خريطة AMap ولم تتحقق منها SMT China'), 1)]),
22316                    _createElementVNode("button", {
22317                      class: "smallbtn",
22318                      disabled: !x.id,
22319                      onClick: $event => (openPlaceSuggestion(x))
22320                    }, _toDisplayString(x.kind==='guide'?'افتح صفحة المكان':'افتح هذا المكان في تطبيق AMap ↗'), 9, _hoisted_42),
22321                    (x.kind==='amap'&&answer.place_confirmation.review_token)
22322                      ? (_openBlock(), _createElementBlock("button", {
22323                          key: 2,
22324                          class: "smallbtn secondary",
22325                          onClick: $event => (submitPlaceSuggestion(x))
22326                        }, "أرسل هذا المكان للمراجعة في الدليل", 8, _hoisted_43))
22327                      : _createCommentVNode("", true)
22328                  ]))
22329                }), 128))]))
22330              : _createCommentVNode("", true),
22331            (answer.answered&&answer.images&&answer.images.length)
22332              ? (_openBlock(), _createElementBlock("section", _hoisted_44, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(answer.images, (x, i) => {
22333                  return (_openBlock(), _createElementBlock("article", {
22334                    key: x.kind+'-'+x.id,
22335                    class: _normalizeClass(['askImageCard',{featured:i===0}])
22336                  }, [_createElementVNode("img", {
22337                    src: x.image_url,
22338                    alt: x.title||'صورة مرتبطة بالبحث',
22339                    loading: "lazy"
22340                  }, null, 8, _hoisted_45), _createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(x.title||'صورة مرجعية'), 1), _createElementVNode("small", null, [_createTextVNode(_toDisplayString(imageSourceLabel(x)), 1), (x.license)
22341                    ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createTextVNode(" · " + _toDisplayString(x.license), 1)], 64))
22342                    : _createCommentVNode("", true)]), (x.source_url)
22343                    ? (_openBlock(), _createElementBlock("button", {
22344                        key: 0,
22345                        class: "smallbtn secondary",
22346                        onClick: $event => (openImageSource(x))
22347                      }, "عرض مصدر الصورة ↗", 8, _hoisted_46))
22348                    : _createCommentVNode("", true)])], 2))
22349                }), 128))]))
22350              : _createCommentVNode("", true),
22351            (answer.answered&&answer.evidence&&answer.evidence.length)
22352              ? (_openBlock(), _createElementBlock("section", _hoisted_47, [_cache[4] || (_cache[4] = _createElementVNode("div", { class: "guideSearchHeader" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "sectionEyebrow" }, "المصادر"), _createElementVNode("h3", null, "المصادر المرتبطة بالإجابة")])], -1)), _createElementVNode("div", _hoisted_48, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(answer.evidence, (x, i) => {
22353                  return (_openBlock(), _createElementBlock("button", {
22354                    key: x.kind+'-'+x.id,
22355                    class: "askEvidenceCard",
22356                    onClick: $event =>
22356 (openEvidence(x))
22357                  }, [_createElementVNode("span", _hoisted_50, _toDisplayString(i+1), 1), _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(x.title), 1), _createElementVNode("small", null, [_createTextVNode(_toDisplayString(sourceLabel(x)), 1), (x.verified_at)
22358                    ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createTextVNode(" · تاريخ التحقق: " + _toDisplayString(shortDate(x.verified_at)), 1)], 64))
22359                    : _createCommentVNode("", true)])]), _cache[3] || (_cache[3] = _createElementVNode("em", null, "عرض ↗", -1))], 8, _hoisted_49))
22360                }), 128))])]))
22361              : _createCommentVNode("", true),
22362            (!answer.answered)
22363              ? (_openBlock(), _createElementBlock("div", _hoisted_51, [_createElementVNode("button", {
22364                  class: "smallbtn secondary",
22365                  onClick: improveQuestion
22366                }, "تعديل السؤال", 8, _hoisted_52)]))
22367              : _createCommentVNode("", true)
22368          ]))
22369        : _createCommentVNode("", true), (mode==='route')
22370        ? (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [
22371            navError
22372              ? (_openBlock(), _createElementBlock("p", _hoisted_53, _toDisplayString(navError), 1))
22373              : _createCommentVNode("", true),
22374            (navCandidates.length&&!navDestination)
22375              ? (_openBlock(), _createElementBlock("section", _hoisted_54, [
22376                  _cache[5] || (_cache[5] = _createElementVNode("span", { class: "sectionEyebrow" }, "اختر الوجهة", -1)),
22377                  _cache[6] || (_cache[6] = _createElementVNode("h2", null, "أي مكان تقصد؟", -1)),
22378                  _cache[7] || (_cache[7] = _createElementVNode("p", null, "اختر النتيجة الصحيحة قبل حساب الطريق.", -1)),
22379                  _createElementVNode("div", _hoisted_55, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(navCandidates, (x) => {
22380                    return (_openBlock(), _createElementBlock("button", {
22381                      key: x.candidate_id,
22382                      disabled: navLoading||!x.routable,
22383                      onClick: $event => (confirmDestination(x))
22384                    }, [_createElementVNode("span", null, [
22385                      _createElementVNode("b", {
22386                        lang: x.name_ar?'ar':'zh-CN',
22387                        dir: x.name_ar?'rtl':'ltr'
22388                      }, _toDisplayString(candidateName(x)), 9, _hoisted_57),
22389                      (x.name_zh&&x.name_zh!==candidateName(x))
22390                        ? (_openBlock(), _createElementBlock("strong", _hoisted_58, _toDisplayString(x.name_zh), 1))
22391                        : _createCommentVNode("", true),
22392                      (x.address_zh)
22393                        ? (_openBlock(), _createElementBlock("small", _hoisted_59, _toDisplayString(x.address_zh), 1))
22394                        : _createCommentVNode("", true),
22395                      (x.match==='amap_index')
22396                        ? (_openBlock(), _createElementBlock("small", _hoisted_60, "اقتراح من خريطة AMap — تأكد من الاسم والعنوان قبل الاختيار"))
22397                        : _createCommentVNode("", true)
22398                    ]), _createElementVNode("em", null, _toDisplayString(x.routable?'اختيار':(x.badge_ar||'الموقع غير مكتمل')), 1)], 8, _hoisted_56))
22399                  }), 128))])
22400                ]))
22401              : _createCommentVNode("", true),
22402            (navNearbyAvailable&&!navDestination&&!navCandidates.length&&navError)
22403              ? (_openBlock(), _createElementBlock("section", _hoisted_61, [
22404                  _cache[8] || (_cache[8] = _createElementVNode("span", { class: "sectionEyebrow" }, "أماكن قريبة", -1)),
22405                  _cache[9] || (_cache[9] = _createElementVNode("p", null, "هذه ليست الوجهة التي بحثت عنها. اعرضها فقط إذا أردت توسيع البحث.", -1)),
22406                  (!navNearby.length)
22407                    ? (_openBlock(), _createElementBlock("button", {
22408                        key: 0,
22409                        class: "smallbtn secondary",
22410                        disabled: navExpanding,
22411                        onClick: expandDestinationSearch
22412                      }, _toDisplayString(navExpanding?'جارٍ البحث…':'توسيع البحث'), 9, _hoisted_62))
22413                    : _createCommentVNode("", true),
22414                  (navNearby.length)
22415                    ? (_openBlock(), _createElementBlock("div", _hoisted_63, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(navNearby, (x) => {
22416                        return (_openBlock(), _createElementBlock("button", {
22417                          key: x.candidate_id,
22418                          disabled: ""
22419                        }, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(candidateName(x)), 1), (x.name_zh)
22420                          ? (_openBlock(), _createElementBlock("strong", _hoisted_64, _toDisplayString(x.name_zh), 1))
22421                          : _createCommentVNode("", true), (x.address_zh)
22422                          ? (_openBlock(), _createElementBlock("small", _hoisted_65, _toDisplayString(x.address_zh), 1))
22423                          : _createCommentVNode("", true)]), _createElementVNode("em", null, _toDisplayString(x.badge_ar||'مكان قريب'), 1)]))
22424                      }), 128))]))
22425                    : _createCommentVNode("", true)
22426                ]))
22427              : _createCommentVNode("", true),
22428            navDestination
22429              ? (_openBlock(), _createElementBlock("section", _hoisted_66, [
22430                  _cache[10] || (_cache[10] = _createElementVNode("span", { class: "sectionEyebrow" }, "الوجهة", -1)),
22431                  _createElementVNode("h2", null, _toDisplayString(candidateName(navDestination)), 1),
22432                  (navDestination.name_zh)
22433                    ? (_openBlock(), _createElementBlock("b", _hoisted_67, _toDisplayString(navDestination.name_zh), 1))
22434                    : _createCommentVNode("", true),
22435                  (navDestination.address_zh)
22436                    ? (_openBlock(), _createElementBlock("p", _hoisted_68, _toDisplayString(navDestination.address_zh), 1))
22437                    : _createCommentVNode("", true),
22438                  (navDestination.name_zh||navDestination.address_zh)
22439                    ? (_openBlock(), _createElementBlock("div", _hoisted_69, [_createElementVNode("button", {
22440                        class: "smallbtn secondary",
22441                        onClick: $event => (openAssistMode('chinese'))
22442                      }, "اعرض للصيني", 8, _hoisted_70), _createElementVNode("button", {
22443                        class: "smallbtn secondary",
22444                        onClick: $event => (openAssistMode('driver'))
22445                      }, "اعرض للسائق", 8, _hoisted_71)]))
22446                    : _createCommentVNode("", true)
22447                ]))
22448              : _createCommentVNode("", true),
22449            (navDestination&&!routeResult&&!manualMode)
22450              ? (_openBlock(), _createElementBlock("section", _hoisted_72, [
22451                  _cache[11] || (_cache[11] = _createElementVNode("span", { class: "sectionEyebrow" }, "نقطة البداية", -1)),
22452                  _cache[12] || (_cache[12] = _createElementVNode("h2", null, "من أين ستبدأ؟", -1)),
22453                  _cache[13] || (_cache[13] = _createElementVNode("p", null, "نستخدم موقعك لحساب الطريق فقط بعد موافقتك.", -1)),
22454                  _createElementVNode("button", {
22455                    class: "btn",
22456                    disabled: navLoading||locationState==='requesting',
22457                    onClick: useCurrentLocation
22458                  }, _toDisplayString(locationState==='requesting'?'جاري تحديد موقعك…':'استخدم موقعي واحسب الطريق'), 9, _hoisted_73),
22459                  _createElementVNode("button", {
22460                    class: "smallbtn secondary routeManualStart",
22461                    onClick: $event => {manualMode=true;navError=''}
22462                  }, "اختيار نقطة البداية يدوياً", 8, _hoisted_74)
22463                ]))
22464              : _createCommentVNode("", true),
22465            (navDestination&&!routeResult&&manualMode)
22466              ? (_openBlock(), _createElementBlock("section", _hoisted_75, [
22467                  _cache[14] || (_cache[14] = _createElementVNode("span", { class: "sectionEyebrow" }, "نقطة البداية", -1)),
22468                  _cache[15] || (_cache[15] = _createElementVNode("h2", null, "اكتب المكان الذي ستبدأ منه", -1)),
22469                  _createElementVNode("div", _hoisted_76, [_withDirectives(_createElementVNode("input", {
22470                    "onUpdate:modelValue": $event => ((manualQuery) = $event),
22471                    maxlength: "240",
22472                    placeholder: "مثال: محطة قوانغتشو الجنوبية"
22473                  }, null, 8, _hoisted_77), [[_vModelText, manualQuery]]), _createElementVNode("button", {
22474                    class: "btn",
22475                    disabled: navLoading,
22476                    onClick: resolveManualOrigin
22477                  }, _toDisplayString(navLoading?'جارٍ البحث…':'تأكيد نقطة البداية'), 9, _hoisted_78)]),
22478                  _createElementVNode("button", {
22479                    class: "smallbtn secondary routeManualStart",
22480                    onClick: $event => {manualMode=false;manualCandidates=[];navError=''}
22481                  }, "العودة إلى استخدام موقعي", 8, _hoisted_79),
22482                  (manualCandidates.length)
22483                    ? (_openBlock(), _createElementBlock("div", _hoisted_80, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(manualCandidates, (x) => {
22484                        return (_openBlock(), _createElementBlock("button", {
22485                          key: x.candidate_id,
22486                          disabled: navLoading||!x.routable,
22487                          onClick: $event => (confirmManualOrigin(x))
22488                        }, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(candidateName(x)), 1), (x.name_zh)
22489                          ? (_openBlock(), _createElementBlock("strong", _hoisted_82, _toDisplayString(x.name_zh), 1))
22490                          : _createCommentVNode("", true), (x.address_zh)
22491                          ? (_openBlock(), _createElementBlock("small", _hoisted_83, _toDisplayString(x.address_zh), 1))
22492                          : _createCommentVNode("", true)]), _createElementVNode("em", null, _toDisplayString(x.routable?'اختيار':'الموقع غير مكتمل'), 1)], 8, _hoisted_81))
22493                      }), 128))]))
22494                    : _createCommentVNode("", true)
22495                ]))
22496              : _createCommentVNode("", true),
22497            routeResult
22498              ? (_openBlock(), _createElementBlock("section", _hoisted_84, [
22499                  _cache[16] || (_cache[16] = _createElementVNode("div", { class: "routeOptionsHead" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "sectionEyebrow" }, "خيارات الوصول"), _createElementVNode("h2", null, "اختر الطريقة المناسبة لك")]), _createElementVNode("small", null, "الطريق محدث الآن")], -1)),
22500                  _createElementVNode("div", _hoisted_85, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(routeResult.options, (x) => {
22501                    return (_openBlock(), _createElementBlock("button", {
22502                      key: x.route_option_id,
22503                      class: _normalizeClass(['card','routeOptionCard',{selected:selectedRoute&&selectedRoute.route_option.route_option_id===x.route_option_id}]),
22504                      disabled: routeDetailLoading,
22505                      onClick: $event => (selectRouteOption(x))
22506                    }, [_createElementVNode("span", _hoisted_87, _toDisplayString(modeIcon(x.mode)), 1), _createElementVNode("span", _hoisted_88, [
22507                      _createElementVNode("span", _hoisted_89, _toDisplayString(modeLabel(x.mode)), 1),
22508                      _createElementVNode("b", null, _toDisplayString(durationLabel(x.duration_seconds)), 1),
22509                      _createElementVNode("span", _hoisted_90, [_createTextVNode(_toDisplayString(distanceLabel(x.distance_meters)), 1), (x.walking_distance_meters!==null&&x.mode!=='walking')
22510                        ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createTextVNode(" · مشي " + _toDisplayString(distanceLabel(x.walking_distance_meters)), 1)], 64))
22511                        : _createCommentVNode("", true), (x.transfer_count!==null)
22512                        ? (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [_createTextVNode(" · " + _toDisplayString(x.transfer_count) + " تحويلات", 1)], 64))
22513                        : _createCommentVNode("", true)]),
22514                      _createElementVNode("small", null, _toDisplayString(costLabel(x)), 1),
22515                      (x.summary_ar)
22516                        ? (_openBlock(), _createElementBlock("small", _hoisted_91, _toDisplayString(x.summary_ar), 1))
22517                        : _createCommentVNode("", true),
22518                      _createElementVNode("em", null, _toDisplayString(routeDetailLoading?'جارٍ الفتح…':'عرض تفاصيل الطريق'), 1)
22519                    ])], 10, _hoisted_86))
22520                  }), 128))]),
22521                  (!routeResult.options.length)
22522                    ? (_openBlock(), _createElementBlock("p", _hoisted_92, "حساب الطريق غير متاح مؤقتاً. افتح الوجهة في AMap وأعد المحاولة لاحقاً."))
22523                    : _createCommentVNode("", true),
22524                  (navDestination.map_url)
22525                    ? (_openBlock(), _createElementBlock("button", {
22526                        key: 1,
22527                        class: "smallbtn secondary routeOpenAmap",
22528                        onClick: openAmap
22529                      }, "فتح الوجهة في AMap", 8, _hoisted_93))
22530                    : _createCommentVNode("", true),
22531                  _createElementVNode("button", {
22532                    class: "smallbtn secondary routeRecalculate",
22533                    onClick: recalculateRoutes
22534                  }, "إعادة الحساب", 8, _hoisted_94)
22535                ]))
22536              : _createCommentVNode("", true),
22537            selectedRoute
22538              ? (_openBlock(), _createElementBlock("section", _hoisted_95, [
22539                  _createElementVNode("div", _hoisted_96, [_createElementVNode("div", null, [_cache[17] || (_cache[17] = _createElementVNode("span", { class: "sectionEyebrow" }, "تفاصيل الطريق المختار", -1)), _createElementVNode("h2", null, _toDisplayString(modeLabel(selectedRoute.route_option.mode)), 1)]), _createElementVNode("button", {
22540                    class: "smallbtn secondary",
22541                    onClick: clearSelectedRoute
22542                  }, "اختيار وسيلة أخرى", 8, _hoisted_97)]),
22543                  _createElementVNode("div", _hoisted_98, [
22544                    _createElementVNode("div", _hoisted_99, [(!guide.on)
22545                      ? (_openBlock(), _createElementBlock("button", {
22546                          key: 0,
22547                          class: "btn",
22548                          type: "button",
22549                          onClick: startGuidance
22550                        }, "تشغيل تنبيهات الخطوات", 8, _hoisted_100))
22551                      : (_openBlock(), _createElementBlock("button", {
22552                          key: 1,
22553                          class: "btn secondary",
22554                          type: "button",
22555                          onClick: $event => (stopGuidance())
22556                        }, "إيقاف التنبيهات", 8, _hoisted_101)), _createElementVNode("label", _hoisted_102, [_withDirectives(_createElementVNode("input", {
22557                      type: "checkbox",
22558                      "onUpdate:modelValue": $event => ((guide.sound) = $event)
22559                    }, null, 8, _hoisted_103), [[_vModelCheckbox, guide.sound]]), _cache[18] || (_cache[18] = _createTextVNode(" صوت واهتزاز"))])]),
22560                    (guide.on)
22561                      ? (_openBlock(), _createElementBlock("p", _hoisted_104, [_createTextVNode("الخطوة " + _toDisplayString(Math.min(guide.index+1,selectedRoute.route_option.steps.length)) + " من " + _toDisplayString(selectedRoute.route_option.steps.length), 1), (guide.distance!==null)
22562                          ? (_openBlock(), _createElementBlock("span", _hoisted_105, " · " + _toDisplayString(guide.distance) + " م إلى نهاية الخطوة", 1))
22563                          : _createCommentVNode("", true)]))
22564                      : _createCommentVNode("", true),
22565                    (guide.status)
22566                      ? (_openBlock(), _createElementBlock("p", _hoisted_106, _toDisplayString(guide.status), 1))
22567                      : _createCommentVNode("", true),
22568                    (guide.weak&&guide.on)
22569                      ? (_openBlock(), _createElementBlock("p", _hoisted_107, "إشارة GPS ضعيفة الآن؛ قد تتأخر التنبيهات."))
22570                      : _createCommentVNode("", true),
22571                    (guide.voiceNote)
22572                      ? (_openBlock(), _createElementBlock("p", _hoisted_108, _toDisplayString(guide.voiceNote), 1))
22573                      : _createCommentVNode("", true),
22574                    (guide.offRoute&&guide.on)
22575                      ? (_openBlock(), _createElementBlock("p", _hoisted_109, [_cache[19] || (_cache[19] = _createTextVNode("يبدو أنك ابتعدت عن المسار. ")), _createElementVNode("button", {
22576                          class: "smallbtn",
22577                          type: "button",
22578                          onClick: recalculateRoutes
22579                        }, "أعد حساب الطريق", 8, _hoisted_110)]))
22580                      : _createCommentVNode("", true),
22581                    (guide.error)
22582                      ? (_openBlock(), _createElementBlock("p", _hoisted_111, _toDisplayString(guide.error), 1))
22583                      : _createCommentVNode("", true),
22584                    _cache[20] || (_cache[20] = _createElementVNode("small", { class: "hint" }, "تعمل التنبيهات والشاشة مفتوحة فقط؛ إذا انطفأت الشاشة أو قُفل الهاتف تتوقف. يُحسب موقعك داخل جهازك ولا يُرسل أو يُحفظ.", -1))
22585                  ]),
22586                  _createElementVNode("div", _hoisted_112, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(selectedRoute.route_option.steps, (step, index) => {
22587                    return (_openBlock(), _createElementBlock("article", {
22588                      key: step.step_id,
22589                      class: _normalizeClass(["routeStepCard", {routeStepActive:guide.on&&guide.index===index,routeStepDone:guide.done.includes(index)}])
22590                    }, [_createElementVNode("span", _hoisted_113, _toDisplayString(guide.done.includes(index)?'✓':index+1), 1), _createElementVNode("div", null, [
22591                      _createElementVNode("h3", null, _toDisplayString(step.instruction_ar), 1),
22592                      (step.instruction_zh)
22593                        ? (_openBlock(), _createElementBlock("p", _hoisted_114, _toDisplayString(step.instruction_zh), 1))
22594                        : _createCommentVNode("", true),
22595                      (step.road_name_zh&&!step.instruction_zh.includes(step.road_name_zh))
22596                        ? (_openBlock(), _createElementBlock("p", _hoisted_115, _toDisplayString(step.road_name_zh), 1))
22597                        : _createCommentVNode("", true),
22598                      (step.road_name_en)
22599                        ? (_openBlock(), _createElementBlock("p", _hoisted_116, _toDisplayString(step.road_name_en), 1))
22600                        : _createCommentVNode("", true),
22601                      (step.line_name_zh||step.departure_stop_zh||step.arrival_stop_zh)
22602                        ? (_openBlock(), _createElementBlock("dl", _hoisted_117, [(step.line_name_zh)
22603                            ? (_openBlock(), _createElementBlock("div", _hoisted_118, [_cache[21] || (_cache[21] = _createElementVNode("dt", null, "الخط", -1)), _createElementVNode("dd", _hoisted_119, [_createTextVNode(_toDisplayString(step.line_name_zh), 1), (step.line_name_en)
22604                                ? (_openBlock(), _createElementBlock("small", _hoisted_120, _toDisplayString(step.line_name_en), 1))
22605                                : _createCommentVNode("", true)])]))
22606                            : _createCommentVNode("", true), (step.departure_stop_zh)
22607                            ? (_openBlock(), _createElementBlock("div", _hoisted_121, [_cache[22] || (_cache[22] = _createElementVNode("dt", null, "الصعود", -1)), _createElementVNode("dd", _hoisted_122, [_createTextVNode(_toDisplayString(step.departure_stop_zh), 1), (step.departure_stop_en)
22608                                ? (_openBlock(), _createElementBlock("small", _hoisted_123, _toDisplayString(step.departure_stop_en), 1))
22609                                : _createCommentVNode("", true)])]))
22610                            : _createCommentVNode("", true), (step.arrival_stop_zh)
22611                            ? (_openBlock(), _createElementBlock("div", _hoisted_124, [_cache[23] || (_cache[23] = _createElementVNode("dt", null, "النزول", -1)), _createElementVNode("dd", _hoisted_125, [_createTextVNode(_toDisplayString(step.arrival_stop_zh), 1), (step.arrival_stop_en)
22612                                ? (_openBlock(), _createElementBlock("small", _hoisted_126, _toDisplayString(step.arrival_stop_en), 1))
22613                                : _createCommentVNode("", true)])]))
22614                            : _createCommentVNode("", true)]))
22615                        : _createCommentVNode("", true),
22616                      (stepMeta(step))
22617                        ? (_openBlock(), _createElementBlock("small", _hoisted_127, _toDisplayString(stepMeta(step)), 1))
22618                        : _createCommentVNode("", true),
22619                      (guide.on&&guide.index===index)
22620                        ? (_openBlock(), _createElementBlock("button", {
22621                            key: 5,
22622                            class: "smallbtn",
22623                            type: "button",
22624                            onClick: $event => (guideManual(index))
22625                          }, "أنهيت هذه الخطوة", 8, _hoisted_128))
22626                        : _createCommentVNode("", true)
22627                    ])], 2))
22628                  }), 128)), (!selectedRoute.route_option.steps.length)
22629                    ? (_openBlock(), _createElementBlock("p", _hoisted_129, "لا توجد خطوات تفصيلية متاحة لهذا الطريق. افتح الوجهة في AMap للمتابعة."))
22630                    : _createCommentVNode("", true)]),
22631                  (navDestination.map_url)
22632                    ? (_openBlock(), _createElementBlock("button", {
22633                        key: 0,
22634                        class: "btn routeDetailAmap",
22635                        onClick: openAmap
22636                      }, "فتح الوجهة في AMap", 8, _hoisted_130))
22637                    : _createCommentVNode("", true)
22638                ]))
22639              : _createCommentVNode("", true),
22640            (assistMode&&navDestination)
22641              ? (_openBlock(), _createElementBlock("section", {
22642                  key: 8,
22643                  class: _normalizeClass(["routeAssistScreen", 'routeAssistScreen--'+assistMode]),
22644                  role: "dialog",
22645                  "aria-modal": "true",
22646                  "aria-label": assistMode==='driver'?'عرض الوجهة للسائق':'عرض الوجهة باللغة الصينية'
22647                }, [_createElementVNode("header", null, [_createElementVNode("button", {
22648                  class: "routeAssistClose",
22649                  onClick: closeAssistMode,
22650                  "aria-label": "إغلاق العرض"
22651                }, "عودة", 8, _hoisted_132), _createElementVNode("span", null, _toDisplayString(assistMode==='driver'?'للسائق':'للمساعدة'), 1)]), _createElementVNode("main", _hoisted_133, [_createElementVNode("p", _hoisted_134, _toDisplayString(assistMode==='driver'?'请带我去这里。':'我要去这里,请问怎么走?'), 1), (navDestination.name_zh)
22652                  ? (_openBlock(), _createElementBlock("h2", _hoisted_135, _toDisplayString(navDestination.name_zh), 1))
22653                  : _createCommentVNode("", true), (navDestination.address_zh)
22654                  ? (_openBlock(), _createElementBlock("p", _hoisted_136, _toDisplayString(navDestination.address_zh), 1))
22655                  : _createCommentVNode("", true)]), _createElementVNode("footer", null, [(assistMode==='chinese'&&(navDestination.address_zh||navDestination.name_zh))
22656                  ? (_openBlock(), _createElementBlock("button", {
22657                      key: 0,
22658                      class: "routeAssistCopy",
22659                      onClick: copyAssistAddress
22660                    }
22660, _toDisplayString(assistCopyState==='copied'?'تم النسخ':(assistCopyState==='failed'?'تعذّر النسخ':'نسخ العنوان')), 9, _hoisted_137))
22661                  : _createCommentVNode("", true), (assistCopyState==='failed')
22662                  ? (_openBlock(), _createElementBlock("p", _hoisted_138, "يمكنك إظهار الشاشة مباشرة للشخص أمامك."))
22663                  : _createCommentVNode("", true), (navDestination.map_url)
22664                  ? (_openBlock(), _createElementBlock("button", {
22665                      key: 2,
22666                      class: "routeAssistAmap",
22667                      onClick: openAmap
22668                    }, "افتح الوجهة في AMap", 8, _hoisted_139))
22669                  : _createCommentVNode("", true)])], 10, _hoisted_131))
22670              : _createCommentVNode("", true)
22671          ], 64))
22672        : _createCommentVNode("", true)]),
22673      _: 1
22674    }))
22675  }
22676}
22677})()};
22678
22679  const OfficialCircularCenterPage={components:{PublicFrame},setup(){const countries=ref([]),country=ref(''),items=ref([]);async function loadCountries(){const r=await api('/api/platform/countries');countries.value=safeArray(r.countries).filter(x=>x.circulars_enabled);if(!country.value&&countries.value.length)country.value='SD';}async function load(){const r=await api('/api/official-circulars'+(country.value?'?country='+encodeURIComponent(country.value):''));items.value=safeArray(r.items);}onMounted(async()=>{await loadCountries();await load();});watch(country,load);return{countries,country,items,shortDate,safeExternalHttpUrl};},render:(function(){
22680const _Vue = Vue
22681const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode } = _Vue
22682
22683const _hoisted_1 = { class: "card dailyHero" }
22684const _hoisted_2 = { class: "fieldLabel" }
22685const _hoisted_3 = ["onUpdate:modelValue"]
22686const _hoisted_4 = ["value"]
22687const _hoisted_5 = { class: "dailyList card" }
22688const _hoisted_6 = ["href"]
22689const _hoisted_7 = {
22690  key: 0,
22691  class: "hint"
22692}
22693
22694return function render(_ctx, _cache) {
22695  with (_ctx) {
22696    const { createElementVNode: _createElementVNode, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, toDisplayString: _toDisplayString, vModelSelect: _vModelSelect, withDirectives: _withDirectives, createCommentVNode: _createCommentVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
22697
22698    const _component_PublicFrame = _resolveComponent("PublicFrame")
22699
22700    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "التعميمات الرسمية" }, {
22701      default: _withCtx(() => [_createElementVNode("section", _hoisted_1, [
22702        _cache[2] || (_cache[2] = _createElementVNode("span", { class: "adminEyebrow" }, "Official Circulars", -1)),
22703        _cache[3] || (_cache[3] = _createElementVNode("h2", null, "سفارات وقنصليات وجهات رسمية", -1)),
22704        _cache[4] || (_cache[4] = _createElementVNode("p", null, "المحتوى المنشور فقط من القنوات الرسمية المعتمدة أو بعد المراجعة البشرية.", -1)),
22705        _createElementVNode("label", _hoisted_2, [_cache[1] || (_cache[1] = _createElementVNode("span", null, "الدولة", -1)), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((country) = $event) }, [_cache[0] || (_cache[0] = _createElementVNode("option", { value: "" }, "كل الدول", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(countries, (c) => {
22706          return (_openBlock(), _createElementBlock("option", {
22707            key: c.code,
22708            value: c.code
22709          }, _toDisplayString(c.name_ar), 9, _hoisted_4))
22710        }), 128))], 8, _hoisted_3), [[_vModelSelect, country]])])
22711      ]), _createElementVNode("section", _hoisted_5, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (x) => {
22712        return (_openBlock(), _createElementBlock("article", {
22713          class: "officialDailyItem",
22714          key: x.id
22715        }, [
22716          _cache[5] || (_cache[5] = _createElementVNode("span", { class: "trustBadge official" }, "رسمي", -1)),
22717          _createElementVNode("h3", null, _toDisplayString(x.title), 1),
22718          _createElementVNode("small", null, _toDisplayString(x.country_name_ar) + " · " + _toDisplayString(x.source_name_ar) + " · " + _toDisplayString(shortDate(x.source_published_at||x.created_at)), 1),
22719          _createElementVNode("p", null, _toDisplayString(x.body), 1),
22720          (safeExternalHttpUrl(x.source_url))
22721            ? (_openBlock(), _createElementBlock("a", {
22722                key: 0,
22723                class: "smallbtn secondary",
22724                href: safeExternalHttpUrl(x.source_url),
22725                target: "_blank",
22726                rel: "noopener noreferrer"
22727              }, "المصدر الرسمي ↗", 8, _hoisted_6))
22728            : _createCommentVNode("", true)
22729        ]))
22730      }), 128)), (!items.length)
22731        ? (_openBlock(), _createElementBlock("p", _hoisted_7, "لا توجد تعميمات منشورة في هذا الاختيار."))
22732        : _createCommentVNode("", true)])]),
22733      _: 1
22734    }))
22735  }
22736}
22737})()};
22738
22739
22740  const ServicesDirectoryPage={components:{PublicFrame},setup(){const router=useRouter(),items=ref([]),hubs=ref([]),filters=reactive({city:String(useRoute().query.city||''),trust_tier:''});async function load(){const qs=new URLSearchParams();if(filters.city)qs.set('city',filters.city);if(filters.trust_tier)qs.set('trust_tier',filters.trust_tier);const [r,h]=await Promise.all([api('/api/services-directory?'+qs.toString()),api('/api/city-hubs')]);items.value=safeArray(r.items);hubs.value=safeArray(h.hubs);}onMounted(load);watch(()=>[filters.city,filters.trust_tier],load);function trust(x){return x==='official'?'Official':x==='smt_verified'?'SMT Verified':'Community Listed';}return{router,items,hubs,filters,trust};},render:(function(){
22741const _Vue = Vue
22742const { createElementVNode: _createElementVNode } = _Vue
22743
22744const _hoisted_1 = { class: "card dailyFilters" }
22745const _hoisted_2 = ["onUpdate:modelValue"]
22746const _hoisted_3 = ["value"]
22747const _hoisted_4 = ["onUpdate:modelValue"]
22748const _hoisted_5 = { class: "dailyGrid" }
22749const _hoisted_6 = ["onClick"]
22750
22751return function render(_ctx, _cache) {
22752  with (_ctx) {
22753    const { createElementVNode: _createElementVNode, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, toDisplayString: _toDisplayString, vModelSelect: _vModelSelect, withDirectives: _withDirectives, normalizeClass: _normalizeClass, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
22754
22755    const _component_PublicFrame = _resolveComponent("PublicFrame")
22756
22757    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "الخدمات الموثوقة" }, {
22758      default: _withCtx(() => [_cache[3] || (_cache[3] = _createElementVNode("section", { class: "card dailyHero" }, [_createElementVNode("span", { class: "adminEyebrow" }, "Trusted Services"), _createElementVNode("h2", null, "دليل خدمات بدرجات ثقة واضحة"), _createElementVNode("p", null, "Official للمصادر الرسمية المربوطة بسجل المصادر، SMT Verified للمعلومات التي راجعتها SMT، وCommunity Listed للإدراج المجتمعي.")], -1)), _createElementVNode("section", _hoisted_1, [_withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((filters.city) = $event) }, [_cache[0] || (_cache[0] = _createElementVNode("option", { value: "" }, "كل المدن", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(hubs, (c) => {
22759        return (_openBlock(), _createElementBlock("option", {
22760          value: c.name_en,
22761          key: c.city_key
22762        }, _toDisplayString(c.name_ar), 9, _hoisted_3))
22763      }), 128))], 8, _hoisted_2), [[_vModelSelect, filters.city]]), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((filters.trust_tier) = $event) }, _cache[1] || (_cache[1] = [
22764        _createElementVNode("option", { value: "" }, "كل درجات الثقة", -1),
22765        _createElementVNode("option", { value: "official" }, "Official", -1),
22766        _createElementVNode("option", { value: "smt_verified" }, "SMT Verified", -1),
22767        _createElementVNode("option", { value: "community_listed" }, "Community Listed", -1)
22768      ]), 8, _hoisted_4), [[_vModelSelect, filters.trust_tier]])]), _createElementVNode("section", _hoisted_5, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (x) => {
22769        return (_openBlock(), _createElementBlock("button", {
22770          class: "card dailyTile serviceTrustCard",
22771          key: x.id,
22772          onClick: $event => (router.push('/china-guide/'+x.id))
22773        }, [
22774          _createElementVNode("span", { class: _normalizeClass(["trustBadge", x.trust_tier]) }, _toDisplayString(trust(x.trust_tier)), 3),
22775          _createElementVNode("b", null, _toDisplayString(x.title_ar), 1),
22776          _createElementVNode("small", null, _toDisplayString($cityLabel(x.city)) + " · " + _toDisplayString(x.district), 1),
22777          _createElementVNode("p", null, _toDisplayString(x.summary_ar), 1),
22778          _cache[2] || (_cache[2] = _createElementVNode("em", null, "فتح التفاصيل ←", -1))
22779        ], 8, _hoisted_6))
22780      }), 128))])]),
22781      _: 1,
22782      __: [3]
22783    }))
22784  }
22785}
22786})()};
22787
22788  const ToolkitPage={components:{PublicFrame},setup(){const router=useRouter(),tools=ref([]);onMounted(async()=>{const r=await api('/api/toolkit');tools.value=safeArray(r.tools)});function open(x){router.push('/china-guide?search='+encodeURIComponent(x.search));}return{router,tools,open};},render:(function(){
22789const _Vue = Vue
22790const { createElementVNode: _createElementVNode } = _Vue
22791
22792const _hoisted_1 = { class: "dailyGrid" }
22793const _hoisted_2 = ["onClick"]
22794const _hoisted_3 = { class: "dailyIcon" }
22795
22796return function render(_ctx, _cache) {
22797  with (_ctx) {
22798    const { createElementVNode: _createElementVNode, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
22799
22800    const _component_PublicFrame = _resolveComponent("PublicFrame")
22801
22802    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "أدوات الحياة في الصين" }, {
22803      default: _withCtx(() => [_cache[1] || (_cache[1] = _createElementVNode("section", { class: "card dailyHero" }, [_createElementVNode("span", { class: "adminEyebrow" }, "China Life Toolkit"), _createElementVNode("h2", null, "اختصارات عملية للحياة اليومية"), _createElementVNode("p", null, "الدفع، المواصلات، القطارات، المطارات، العناوين والطوارئ من مكان واحد.")], -1)), _createElementVNode("section", _hoisted_1, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(tools, (x) => {
22804        return (_openBlock(), _createElementBlock("button", {
22805          class: "card dailyTile",
22806          key: x.key,
22807          onClick: $event => (open(x))
22808        }, [
22809          _createElementVNode("span", _hoisted_3, _toDisplayString(x.icon), 1),
22810          _createElementVNode("b", null, _toDisplayString(x.title_ar), 1),
22811          _createElementVNode("p", null, _toDisplayString(x.summary_ar), 1),
22812          _cache[0] || (_cache[0] = _createElementVNode("em", null, "ابحث في الدليل ←", -1))
22813        ], 8, _hoisted_2))
22814      }), 128))])]),
22815      _: 1,
22816      __: [1]
22817    }))
22818  }
22819}
22820})()};
22821
22822  const ChinaAppsPage={
22823    components:{PublicFrame},
22824    setup(){
22825      const apps=ref([]),categories=ref([]),loading=ref(false),error=ref(''),query=ref(''),category=ref('all'),selected=ref('');
22826      let controller=null;
22827      const filtered=computed(()=>{
22828        const q=String(query.value||'').trim().toLocaleLowerCase();
22829        return apps.value.filter(app=>(category.value==='all'||app.category===category.value)&&(!q||[app.name,app.zh,app.summary].some(v=>String(v||'').toLocaleLowerCase().includes(q))));
22830      });
22831      async function load(){
22832        if(controller)controller.abort();
22833        controller=new AbortController();const current=controller;
22834        loading.value=true;error.value='';
22835        const timer=setTimeout(()=>current.abort(),8000);
22836        try{
22837          const response=await fetch('/vue/assets/china-apps.json?v='+VERSION+'-ui027',{signal:current.signal,cache:'force-cache'});
22838          if(!response.ok)throw new Error('HTTP '+response.status);
22839          const data=await response.json();
22840          if(!Array.isArray(data.apps)||!Array.isArray(data.categories)||!data.apps.length)throw new Error('Invalid apps guide');
22841          apps.value=data.apps;categories.value=data.categories;
22842        }catch(_){if(current===controller)error.value='تعذّر تحميل دليل التطبيقات. تحقق من اتصالك ثم أعد المحاولة.';}
22843        finally{clearTimeout(timer);if(current===controller){loading.value=false;controller=null;}}
22844      }
22845      async function toggle(id,event){
22846        const opening=selected.value!==id;
22847        selected.value=opening?id:'';
22848        if(!opening)return;
22849        await nextTick();
22850        const card=event&&event.currentTarget&&event.currentTarget.closest('.chinaAppCard');
22851        if(card)card.scrollIntoView({behavior:window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches?'auto':'smooth',block:'start'});
22852      }
22853      onMounted(load);onUnmounted(()=>{if(controller)controller.abort();});
22854      return{apps,categories,loading,error,query,category,selected,filtered,load,toggle};
22855    },
22856    render:(function(){
22857const _Vue = Vue
22858const { createElementVNode: _createElementVNode, createCommentVNode: _
22858createCommentVNode, createTextVNode: _createTextVNode } = _Vue
22859
22860const _hoisted_1 = {
22861  class: "chinaAppsControls",
22862  "aria-label": "البحث والتصنيفات"
22863}
22864const _hoisted_2 = { class: "chinaAppsSearch" }
22865const _hoisted_3 = ["onUpdate:modelValue"]
22866const _hoisted_4 = { class: "chinaAppsFilters" }
22867const _hoisted_5 = ["aria-pressed", "onClick"]
22868const _hoisted_6 = ["aria-pressed", "onClick"]
22869const _hoisted_7 = {
22870  key: 0,
22871  class: "card chinaAppsStatus",
22872  role: "status"
22873}
22874const _hoisted_8 = {
22875  key: 1,
22876  class: "card chinaAppsStatus",
22877  role: "alert"
22878}
22879const _hoisted_9 = ["onClick"]
22880const _hoisted_10 = {
22881  class: "chinaAppsCount",
22882  role: "status"
22883}
22884const _hoisted_11 = {
22885  key: 0,
22886  class: "card chinaAppsStatus"
22887}
22888const _hoisted_12 = {
22889  class: "chinaAppsList",
22890  "aria-label": "التطبيقات"
22891}
22892const _hoisted_13 = ["aria-expanded", "onClick"]
22893const _hoisted_14 = { class: "chinaAppGlyph" }
22894const _hoisted_15 = ["src"]
22895const _hoisted_16 = { class: "chinaAppIdentity" }
22896const _hoisted_17 = {
22897  lang: "zh-CN",
22898  dir: "ltr"
22899}
22900const _hoisted_18 = { class: "chinaAppExpand" }
22901const _hoisted_19 = {
22902  key: 0,
22903  class: "chinaAppDetail"
22904}
22905const _hoisted_20 = { class: "chinaAppSteps" }
22906const _hoisted_21 = { class: "chinaAppDownloadStep" }
22907const _hoisted_22 = { class: "chinaAppStepCopy" }
22908const _hoisted_23 = { class: "chinaStoreLinks" }
22909const _hoisted_24 = ["href", "aria-label"]
22910const _hoisted_25 = ["href", "aria-label"]
22911const _hoisted_26 = { class: "chinaAppStepCopy" }
22912const _hoisted_27 = { class: "chinaAppStepFigure" }
22913const _hoisted_28 = ["src", "alt"]
22914const _hoisted_29 = { class: "chinaAppStepCopy" }
22915const _hoisted_30 = { class: "chinaAppStepFigure" }
22916const _hoisted_31 = ["src", "alt"]
22917const _hoisted_32 = { class: "chinaAppStepCopy" }
22918const _hoisted_33 = { class: "chinaAppStepFigure" }
22919const _hoisted_34 = ["src", "alt"]
22920const _hoisted_35 = ["href"]
22921const _hoisted_36 = { class: "chinaAppFaq" }
22922
22923return function render(_ctx, _cache) {
22924  with (_ctx) {
22925    const { createElementVNode: _createElementVNode, vModelText: _vModelText, withDirectives: _withDirectives, createTextVNode: _createTextVNode, normalizeClass: _normalizeClass, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, toDisplayString: _toDisplayString, createCommentVNode: _createCommentVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
22926
22927    const _component_PublicFrame = _resolveComponent("PublicFrame")
22928
22929    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "تطبيقات مهمة في الصين" }, {
22930      default: _withCtx(() => [_cache[12] || (_cache[12] = _createElementVNode("section", { class: "card chinaAppsIntro" }, [
22931        _createElementVNode("span", { class: "sectionEyebrow" }, "دليل عملي للأجانب والعرب"),
22932        _createElementVNode("h2", null, "تطبيقات مهمة في الصين"),
22933        _createElementVNode("p", null, "ابدأ بالدفع والخرائط، ثم اختر التطبيقات المناسبة للسفر والحياة اليومية والتجارة. افتح أي تطبيق لقراءة خطوات التنزيل والتثبيت والتسجيل والاستخدام والأسئلة الشائعة."),
22934        _createElementVNode("p", { class: "chinaAppsCaution" }, "نزّل التطبيق من متجر هاتفك أو موقع الجهة الرسمية فقط. قد تختلف الشاشات والبطاقات المقبولة وخطوات التحقق حسب البلد وإصدار التطبيق.")
22935      ], -1)), _createElementVNode("section", _hoisted_1, [_createElementVNode("label", _hoisted_2, [_cache[0] || (_cache[0] = _createTextVNode("ابحث عن تطبيق")), _withDirectives(_createElementVNode("input", {
22936        "onUpdate:modelValue": $event => ((query) = $event),
22937        type: "search",
22938        placeholder: "مثال: Alipay أو القطارات أو 支付宝",
22939        autocomplete: "off"
22940      }, null, 8, _hoisted_3), [[_vModelText, query]])]), _createElementVNode("div", _hoisted_4, [_createElementVNode("button", {
22941        type: "button",
22942        class: _normalizeClass({active:category==='all'}),
22943        "aria-pressed": category==='all',
22944        onClick: $event => (category='all')
22945      }, "الكل", 10, _hoisted_5), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(categories, (item) => {
22946        return (_openBlock(), _createElementBlock("button", {
22947          key: item.key,
22948          type: "button",
22949          class: _normalizeClass({active:category===item.key}),
22950          "aria-pressed": category===item.key,
22951          onClick: $event => (category=item.key)
22952        }, _toDisplayString(item.label), 11, _hoisted_6))
22953      }), 128))])]), loading
22954        ? (_openBlock(), _createElementBlock("p", _hoisted_7, "جارٍ تحميل دليل التطبيقات…"))
22955        : error
22956          ? (_openBlock(), _createElementBlock("section", _hoisted_8, [_createElementVNode("p", null, _toDisplayString(error), 1), _createElementVNode("button", {
22957              class: "smallbtn",
22958              type: "button",
22959              onClick: load
22960            }, "إعادة المحاولة", 8, _hoisted_9)]))
22961          : (_openBlock(), _createElementBlock(_Fragment, { key: 2 }, [
22962              _createElementVNode("p", _hoisted_10, _toDisplayString(filtered.length) + " من " + _toDisplayString(apps.length) + " تطبيقًا", 1),
22963              (!filtered.length)
22964                ? (_openBlock(), _createElementBlock("p", _hoisted_11, "لا توجد تطبيقات تطابق البحث. جرّب اسمًا آخر أو اختر «الكل»."))
22965                : _createCommentVNode("", true),
22966              _createElementVNode("section", _hoisted_12, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(filtered, (app) => {
22967                return (_openBlock(), _createElementBlock("article", {
22968                  key: app.id,
22969                  class: "card chinaAppCard"
22970                }, [_createElementVNode("button", {
22971                  class: "chinaAppHead",
22972                  type: "button",
22973                  "aria-expanded": selected===app.id,
22974                  onClick: $event => (toggle(app.id,$event))
22975                }, [_createElementVNode("span", _hoisted_14, [_createElementVNode("img", {
22976                  src: app.icon_url,
22977                  alt: "",
22978                  width: "52",
22979                  height: "52",
22980                  loading: "lazy"
22981                }, null, 8, _hoisted_15)]), _createElementVNode("span", _hoisted_16, [_createElementVNode("b", null, [_createTextVNode(_toDisplayString(app.name) + " ", 1), _createElementVNode("small", _hoisted_17, _toDisplayString(app.zh), 1)]), _createElementVNode("span", null, _toDisplayString(app.summary), 1)]), _createElementVNode("span", _hoisted_18, _toDisplayString(selected===app.id?'إغلاق':'عرض الدليل'), 1)], 8, _hoisted_13), (selected===app.id)
22982                  ? (_openBlock(), _createElementBlock("div", _hoisted_19, [_createElementVNode("div", _hoisted_20, [
22983                      _createElementVNode("section", _hoisted_21, [_createElementVNode("div", _hoisted_22, [_cache[3] || (_cache[3] = _createElementVNode("h3", null, [_createElementVNode("span", null, "1"), _createTextVNode(" التنزيل")], -1)), _createElementVNode("p", null, _toDisplayString(app.download), 1), _createElementVNode("div", _hoisted_23, [_createElementVNode("a", {
22984                        href: app.ios_url,
22985                        target: "_blank",
22986                        rel: "noopener noreferrer",
22987                        "aria-label": 'تنزيل '+app.name+' من App Store'
22988                      }, _cache[1] || (_cache[1] = [_createElementVNode("span", { "aria-hidden": "true" }, "●", -1), _createElementVNode("small", null, "تنزيل من", -1), _createElementVNode("b", null, "App Store", -1)]), 8, _hoisted_24), _createElementVNode("a", {
22989                        href: app.google_play_url,
22990                        target: "_blank",
22991                        rel: "noopener noreferrer",
22992                        "aria-label": 'تنزيل '+app.name+' من Google Play'
22993                      }, _cache[2] || (_cache[2] = [_createElementVNode("span", { "aria-hidden": "true" }, "▶", -1), _createElementVNode("small", null, "تنزيل من", -1), _createElementVNode("b", null, "Google Play", -1)]), 8, _hoisted_25)])])]),
22994                      _createElementVNode("section", null, [_createElementVNode("div", _hoisted_26, [_cache[4] || (_cache[4] = _createElementVNode("h3", null, [_createElementVNode("span", null, "2"), _createTextVNode(" التثبيت")], -1)), _createElementVNode("p", null, _toDisplayString(app.install), 1)]), _createElementVNode("figure", _hoisted_27, [_createElementVNode("img", {
22995                        src: app.screenshots.install,
22996                        alt: 'لقطة حقيقية من واجهة تطبيق '+app.name,
22997                        width: "310",
22998                        height: "550",
22999                        loading: "lazy"
23000                      }, null, 8, _hoisted_28), _cache[5] || (_cache[5] = _createElementVNode("figcaption", null, "لقطة حقيقية من صفحة التطبيق الرسمية؛ قد يختلف ترتيب الشاشة حسب الإصدار.", -1))])]),
23001                      _createElementVNode("section", null, [_createElementVNode("div", _hoisted_29, [_cache[6] || (_cache[6] = _createElementVNode("h3", null, [_createElementVNode("span", null, "3"), _createTextVNode(" التسجيل")], -1)), _createElementVNode("p", null, _toDisplayString(app.signup), 1)]), _createElementVNode("figure", _hoisted_30, [_createElementVNode("img", {
23002                        src: app.screenshots.signup,
23003                        alt: 'لقطة حقيقية من واجهة تطبيق '+app.name,
23004                        width: "310",
23005                        height: "550",
23006                        loading: "lazy"
23007                      }, null, 8, _hoisted_31), _cache[7] || (_cache[7] = _createElementVNode("figcaption", null, "واجهة حقيقية للتطبيق. اتبع نص الخطوة لأن موضع الخيارات قد يتغير.", -1))])]),
23008                      _createElementVNode("section", null, [_createElementVNode("div", _hoisted_32, [_cache[8] || (_cache[8] = _createElementVNode("h3", null, [_createElementVNode("span", null, "4"), _createTextVNode(" الاستخدام")], -1)), _createElementVNode("p", null, _toDisplayString(app.use), 1)]), _createElementVNode("figure", _hoisted_33, [_createElementVNode("img", {
23009                        src: app.screenshots.use,
23010                        alt: 'لقطة حقيقية من واجهة تطبيق '+app.name,
23011                        width: "310",
23012                        height: "550",
23013                        loading: "lazy"
23014                      }, null, 8, _hoisted_34), _cache[9] || (_cache[9] = _createElementVNode("figcaption", null, "مثال حقيقي من واجهة الاستخدام الرسمية للتطبيق.", -1))])])
23015                    ]), _createElementVNode("a", {
23016                      class: "chinaAppOfficial",
23017                      href: app.official,
23018                      target: "_blank",
23019                      rel: "noopener noreferrer"
23020                    }, "فتح موقع الجهة الرسمية ↗", 8, _hoisted_35), _createElementVNode("div", _hoisted_36, [_cache[10] || (_cache[10] = _createElementVNode("h3", null, "الأسئلة الشائعة (FAQ)", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(app.faq, (faq, index) => {
23021                      return (_openBlock(), _createElementBlock("details", { key: index }, [_createElementVNode("summary", null, _toDisplayString(faq.q), 1), _createElementVNode("p", null, _toDisplayString(faq.a), 1)]))
23022                    }), 128))])]))
23023                  : _createCommentVNode("", true)]))
23024              }), 128))]),
23025              _cache[11] || (_cache[11] = _createElementVNode("p", { class: "chinaAppsReferences" }, [_createTextVNode("آخر مراجعة: 5 أكتوبر 2026 · "), _createElementVNode("a", {
23026                href: "https://english.www.gov.cn/2025special/bizexpatsinchina2025",
23027                target: "_blank",
23028                rel: "noopener noreferrer"
23029              }, "دليل الحكومة الصينية للزوار والمقيمين"), _createTextVNode(" · الأيقونات ولقطات الواجهة مأخوذة من صفحات التطبيقات الرسمية في App Store، وقد تختلف حسب الإصدار والمنطقة.")], -1))
23030            ], 64))]),
23031      _: 1,
23032      __: [12]
23033    }))
23034  }
23035}
23036})()
23037  };
23038
23039  const ExhibitionsPage={components:{PublicFrame},setup(){
23040    const store=useGzcStore(),router=useRouter(),route=useRoute(),items=ref([]),hubs=ref([]),saved=ref(new Set()),reminders=ref([]),
23041      now=ref(Date.now()),filters=reactive({city:String(route.query.city||''),sector:'',showEnded:false});
23042    let ticker=null;
23043    async function load(){
23044      const qs=new URLSearchParams();if(filters.city)qs.set('city',filters.city);if(filters.sector)qs.set('sector',filters.sector);
23045      const [r,h]=await Promise.all([api('/api/exhibitions?'+qs.toString()),api('/api/city-hubs')]);
23046      items.value=safeArray(r.items);hubs.value=safeArray(h.hubs);
23047      if(store.state.me&&store.state.me.authenticated){
23048        const s=await api('/api/member/saved-items');
23049        saved.value=new Set(safeArray(s.items).filter(x=>x.item_type==='exhibition').map(x=>String(x.item_id)));
23050        const rem=await api('/api/member/exhibition-reminders');reminders.value=safeArray(rem.items);
23051      }
23052    }
23053    async function toggleSave(x){
23054      if(!await store.requireMember(router,'/exhibitions'))return;
23055      const on=saved.value.has(String(x.id));
23056      const r=await api(on?'/api/member/saved-items/remove':'/api/member/saved-items',{method:'POST',body:JSON.stringify({item_type:'exhibition',item_id:String(x.id)})});
23057      store.state.msg=r.message||r.error||(r.ok?(on?'أُلغي التذكير.':'سنذكّرك قبل المعرض بـ 30 و7 ويوم واحد.'):'');
23058      if(r.ok)load();
23059    }
23060    function addToCalendar(x){
23061      const text=ExhibitionCountdown.icsFor(x,window.location.hostname);
23062      if(!text)return;
23063      const url=URL.createObjectURL(new Blob([text],{type:'text/calendar;charset=utf-8'}));
23064      const a=document.createElement('a');a.href=url;a.download='exhibition-'+x.id+'.ics';document.body.appendChild(a);a.click();a.remove();
23065      setTimeout(()=>URL.revokeObjectURL(url),4000);
23066    }
23067    const rows=computed(()=>ExhibitionCountdown.sortItems(items.value,now.value).filter(r=>filters.showEnded||r.state.phase!=='ended'));
23068    const hero=computed(()=>rows.value.find(r=>r.state.phase==='ongoing'||r.state.phase==='upcoming')||null);
23069    const phaseLabel=p=>({ongoing:'جارٍ الآن',upcoming:'قادم',ended:'انتهى',unknown:'التاريخ قيد التأكيد'}[p]||'');
23070    const pad=ExhibitionCountdown.pad;
23071    onMounted(async()=>{await store.loadMe();await load();ticker=setInterval(()=>{now.value=Date.now();},1000);});
23072    onUnmounted(()=>
23072{if(ticker)clearInterval(ticker);});
23073    watch(()=>[filters.city,filters.sector],load);
23074    return{store,router,rows,hero,hubs,saved,filters,reminders,toggleSave,addToCalendar,phaseLabel,pad,safeExternalHttpUrl};
23075  },render:(function(){
23076const _Vue = Vue
23077const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
23078
23079const _hoisted_1 = { class: "adminEyebrow" }
23080const _hoisted_2 = {
23081  class: "exClock",
23082  role: "timer",
23083  "aria-live": "off"
23084}
23085const _hoisted_3 = { class: "row" }
23086const _hoisted_4 = ["onClick"]
23087const _hoisted_5 = ["onClick"]
23088const _hoisted_6 = {
23089  key: 1,
23090  class: "card dailyHero"
23091}
23092const _hoisted_7 = {
23093  key: 2,
23094  class: "card exReminders"
23095}
23096const _hoisted_8 = ["onClick"]
23097const _hoisted_9 = { class: "card dailyFilters" }
23098const _hoisted_10 = ["onUpdate:modelValue"]
23099const _hoisted_11 = ["value"]
23100const _hoisted_12 = ["onUpdate:modelValue"]
23101const _hoisted_13 = { class: "checkRow" }
23102const _hoisted_14 = ["onUpdate:modelValue"]
23103const _hoisted_15 = { class: "dailyGrid" }
23104const _hoisted_16 = { class: "exCardTop" }
23105const _hoisted_17 = { class: "row" }
23106const _hoisted_18 = ["onClick"]
23107const _hoisted_19 = ["href"]
23108const _hoisted_20 = ["onClick"]
23109const _hoisted_21 = ["onClick"]
23110const _hoisted_22 = {
23111  key: 0,
23112  class: "hint"
23113}
23114
23115return function render(_ctx, _cache) {
23116  with (_ctx) {
23117    const { toDisplayString: _toDisplayString, createElementVNode: _createElementVNode, createTextVNode: _createTextVNode, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, normalizeClass: _normalizeClass, renderList: _renderList, vModelSelect: _vModelSelect, withDirectives: _withDirectives, vModelText: _vModelText, vModelCheckbox: _vModelCheckbox, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
23118
23119    const _component_PublicFrame = _resolveComponent("PublicFrame")
23120
23121    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "المعارض في الصين" }, {
23122      default: _withCtx(() => [
23123        hero
23124          ? (_openBlock(), _createElementBlock("section", {
23125              key: 0,
23126              class: _normalizeClass(["card exCountdownHero", hero.state.phase])
23127            }, [
23128              _createElementVNode("span", _hoisted_1, _toDisplayString(hero.state.phase==='ongoing'?'يجري الآن · ينتهي بعد':'المعرض القادم · يبدأ بعد'), 1),
23129              _createElementVNode("h2", null, _toDisplayString(hero.item.title_ar), 1),
23130              _createElementVNode("div", _hoisted_2, [
23131                _createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(hero.state.parts.days), 1), _cache[0] || (_cache[0] = _createElementVNode("small", null, "يوم", -1))]),
23132                _createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(pad(hero.state.parts.hours)), 1), _cache[1] || (_cache[1] = _createElementVNode("small", null, "ساعة", -1))]),
23133                _createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(pad(hero.state.parts.minutes)), 1), _cache[2] || (_cache[2] = _createElementVNode("small", null, "دقيقة", -1))]),
23134                _createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(pad(hero.state.parts.seconds)), 1), _cache[3] || (_cache[3] = _createElementVNode("small", null, "ثانية", -1))])
23135              ]),
23136              _createElementVNode("small", null, [_createTextVNode(_toDisplayString($cityLabel(hero.item.city)) + " · " + _toDisplayString(hero.item.exhibition_start_date), 1), (hero.item.exhibition_end_date)
23137                ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createTextVNode(" → " + _toDisplayString(hero.item.exhibition_end_date), 1)], 64))
23138                : _createCommentVNode("", true), _cache[4] || (_cache[4] = _createTextVNode(" · بتوقيت الصين"))]),
23139              _createElementVNode("div", _hoisted_3, [_createElementVNode("button", {
23140                class: "smallbtn",
23141                onClick: $event => (router.push('/china-guide/'+hero.item.id))
23142              }, "التفاصيل", 8, _hoisted_4), _createElementVNode("button", {
23143                class: "smallbtn secondary",
23144                onClick: $event => (toggleSave(hero.item))
23145              }, _toDisplayString(saved.has(String(hero.item.id))?'✓ سأُذكَّر':'ذكّرني'), 9, _hoisted_5)])
23146            ], 2))
23147          : (_openBlock(), _createElementBlock("section", _hoisted_6, _cache[5] || (_cache[5] = [_createElementVNode("span", { class: "adminEyebrow" }, "Exhibitions Intelligence", -1), _createElementVNode("h2", null, "خطط للمعارض المهمة", -1), _createElementVNode("p", null, "التاريخ، القطاع، المدينة، التسجيل الرسمي والتذكير.", -1)]))),
23148        (reminders.length)
23149          ? (_openBlock(), _createElementBlock("section", _hoisted_7, [_cache[6] || (_cache[6] = _createElementVNode("h3", null, "تذكيراتك", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(reminders, (r) => {
23150              return (_openBlock(), _createElementBlock("button", {
23151                key: r.id,
23152                class: "exReminderRow",
23153                onClick: $event => (router.push('/china-guide/'+r.id))
23154              }, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(r.title_ar), 1), _createElementVNode("small", null, _toDisplayString(r.start_date), 1)]), _createElementVNode("em", null, _toDisplayString(r.phase==='ongoing'?'جارٍ الآن':('بعد '+r.days_until+' يوم')), 1)], 8, _hoisted_8))
23155            }
23155), 128)), _cache[7] || (_cache[7] = _createElementVNode("small", { class: "hint" }, "التذكير عبر واتساب يصلك إن فعّلته من إعدادات الإشعارات.", -1))]))
23156          : _createCommentVNode("", true),
23157        _createElementVNode("section", _hoisted_9, [_withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((filters.city) = $event) }, [_cache[8] || (_cache[8] = _createElementVNode("option", { value: "" }, "كل المدن", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(hubs, (c) => {
23158          return (_openBlock(), _createElementBlock("option", {
23159            value: c.name_en,
23160            key: c.city_key
23161          }, _toDisplayString($cityLabel(c)), 9, _hoisted_11))
23162        }), 128))], 8, _hoisted_10), [[_vModelSelect, filters.city]]), _withDirectives(_createElementVNode("input", {
23163          "onUpdate:modelValue": $event => ((filters.sector) = $event),
23164          placeholder: "القطاع: معدات، طاقة، أزياء..."
23165        }, null, 8, _hoisted_12), [[_vModelText, filters.sector]]), _createElementVNode("label", _hoisted_13, [_withDirectives(_createElementVNode("input", {
23166          type: "checkbox",
23167          "onUpdate:modelValue": $event => ((filters.showEnded) = $event)
23168        }, null, 8, _hoisted_14), [[_vModelCheckbox, filters.showEnded]]), _cache[9] || (_cache[9] = _createTextVNode(" المنتهية"))])]),
23169        _createElementVNode("section", _hoisted_15, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(rows, (r) => {
23170          return (_openBlock(), _createElementBlock("article", {
23171            class: _normalizeClass(["card exhibitionCard exCard", r.state.phase]),
23172            key: r.item.id
23173          }, [
23174            _createElementVNode("div", _hoisted_16, [_createElementVNode("span", { class: _normalizeClass(["exPhase", r.state.phase]) }, _toDisplayString(phaseLabel(r.state.phase)), 3), _createElementVNode("span", { class: _normalizeClass(["trustBadge", r.item.trust_tier]) }, _toDisplayString(r.item.trust_tier==='official'?'Official':(r.item.trust_tier==='smt_verified'?'SMT Verified':'Listed')), 3)]),
23175            _createElementVNode("h3", null, _toDisplayString(r.item.title_ar), 1),
23176            _createElementVNode("small", null, [_createTextVNode(_toDisplayString($cityLabel(r.item.city)) + " · " + _toDisplayString(r.item.exhibition_start_date||'التاريخ قيد التأكيد'), 1), (r.item.exhibition_end_date)
23177              ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createTextVNode(" → " + _toDisplayString(r.item.exhibition_end_date), 1)], 64))
23178              : _createCommentVNode("", true)]),
23179            (r.state.parts)
23180              ? (_openBlock(), _createElementBlock("div", {
23181                  key: 0,
23182                  class: _normalizeClass(["exClock mini", {near:r.state.near}])
23183                }, [
23184                  _createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(r.state.parts.days), 1), _cache[10] || (_cache[10] = _createElementVNode("small", null, "يوم", -1))]),
23185                  _createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(pad(r.state.parts.hours)), 1), _cache[11] || (_cache[11] = _createElementVNode("small", null, "س", -1))]),
23186                  _createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(pad(r.state.parts.minutes)), 1), _cache[12] || (_cache[12] = _createElementVNode("small", null, "د", -1))]),
23187                  _createElementVNode("div", null, [_createElementVNode("b", null, _toDisplayString(pad(r.state.parts.seconds)), 1), _cache[13] || (_cache[13] = _createElementVNode("small", null, "Ø«", -1))])
23188                ], 2))
23189              : _createCommentVNode("", true),
23190            _createElementVNode("p", null, _toDisplayString(r.item.summary_ar), 1),
23191            _createElementVNode("div", _hoisted_17, [
23192              _createElementVNode("button", {
23193                class: "smallbtn",
23194                onClick: $event => (router.push('/china-guide/'+r.item.id))
23195              }, "التفاصيل", 8, _hoisted_18),
23196              (safeExternalHttpUrl(r.item.registration_url))
23197                ? (_openBlock(), _createElementBlock("a", {
23198                    key: 0,
23199                    class: "smallbtn secondary",
23200                    href: safeExternalHttpUrl(r.item.registration_url),
23201                    target: "_blank",
23202                    rel: "noopener noreferrer"
23203                  }, "التسجيل الرسمي ↗", 8, _hoisted_19))
23204                : _createCommentVNode("", true),
23205              (r.state.phase!=='ended'&&r.item.exhibition_start_date)
23206                ? (_openBlock(), _createElementBlock("button", {
23207                    key: 1,
23208                    class: "smallbtn secondary",
23209                    onClick: $event => (toggleSave(r.item))
23210                  }, _toDisplayString(saved.has(String(r.item.id))?'✓ سأُذكَّر':'ذكّرني'), 9, _hoisted_20))
23211                : _createCommentVNode("", true),
23212              (r.state.phase!=='ended'&&r.item.exhibition_start_date)
23213                ? (_openBlock(), _createElementBlock("button", {
23214                    key: 2,
23215                    class: "smallbtn secondary",
23216                    onClick: $event => (addToCalendar(r.item))
23217                  }, "أضف للتقويم", 8, _hoisted_21))
23218                : _createCommentVNode("", true)
23219            ])
23220          ], 2))
23221        }), 128)), (!rows.length)
23222          ? (_openBlock(), _createElementBlock("p", _hoisted_22, "لا توجد معارض مطابقة حالياً."))
23223          : _createCommentVNode("", true)])
23224      ]),
23225      _: 1
23226    }))
23227  }
23228}
23229})()};
23230
23231  const MyChinaPage={components:{PublicFrame},setup(){const store=useGzcStore(),router=useRouter(),data=ref(null),loading=ref(true);async function load(){loading.value=true;if(await store.requireMember(router,'/my-china')){const r=await api('/api/my-china');if(r&&r.ok)data.value=r;}loading.value=false;}function openNext(x){if(x&&x.path)router.push(x.path);}onMounted(load);return{store,router,data,loading,shortDate,openNext};},render:(function(){
23232const _Vue = Vue
23233const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
23234
23235const _hoisted_1 = {
23236  key: 0,
23237  class: "card loadingState"
23238}
23239const _hoisted_2 = { class: "card dailyHero myChinaHero" }
23240const _hoisted_3 = { class: "dailyQuickRow" }
23241const _hoisted_4 = ["onClick"]
23242const _hoisted_5 = ["onClick"]
23243const _hoisted_6 = ["onClick"]
23244const _hoisted_7 = ["onClick"]
23245const _hoisted_8 = {
23246  key: 0,
23247  class: "card myChinaNext"
23248}
23249const _hoisted_9 = { class: "dailyList" }
23250const _hoisted_10 = ["onClick"]
23251const _hoisted_11 = { class: "dailyDashboardGrid myChinaDashboard" }
23252const _hoisted_12 = { class: "card journeyProgressCard" }
23253const _hoisted_13 = { class: "memberSectionHead" }
23254const _hoisted_14 = { class: "dailyProgress" }
23255const _hoisted_15 = { key: 0 }
23256const _hoisted_16 = {
23257  key: 1,
23258  class: "successText"
23259}
23260const _hoisted_17 = ["onClick"]
23261const _hoisted_18 = { class: "card" }
23262const _hoisted_19 = { class: "dailyList" }
23263const _hoisted_20 = ["onClick"]
23264const _hoisted_21 = {
23265  key: 0,
23266  class: "hint"
23267}
23268const _hoisted_22 = { class: "card" }
23269const _hoisted_23 = { class: "dailyList" }
23270const _hoisted_24 = ["onClick"]
23271const _hoisted_25 = {
23272  key: 0,
23273  class: "hint"
23274}
23275const _hoisted_26 = ["onClick"]
23276const _hoisted_27 = { class: "card" }
23277const _hoisted_28 = { class: "dailyList" }
23278const _hoisted_29 = ["onClick"]
23279const _hoisted_30 = {
23280  key: 0,
23281  class: "hint"
23282}
23283const _hoisted_31 = { class: "card digestPreviewCard" }
23284const _hoisted_32 = { class: "digestMiniGrid" }
23285const _hoisted_33 = {
23286  key: 1,
23287  class: "hint"
23288}
23289const _hoisted_34 = ["onClick"]
23290const _hoisted_35 = { class: "card" }
23291const _hoisted_36 = { class: "savedCountGrid" }
23292const _hoisted_37 = ["onClick"]
23293
23294return function render(_ctx, _cache) {
23295  with (_ctx) {
23296    const { openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, Fragment: _Fragment, renderList: _renderList, normalizeStyle: _normalizeStyle, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
23297
23298    const _component_PublicFrame = _resolveComponent("PublicFrame")
23299
23300    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "My China" }, {
23301      default: _withCtx(() => [loading
23302        ? (_openBlock(), _createElementBlock("section", _hoisted_1, "جاري تجÙ
23302‡ÙŠØ² صفحتك اليومية..."))
23303        : data
23304          ? (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [_createElementVNode("section", _hoisted_2, [
23305              _cache[0] || (_cache[0] = _createElementVNode("span", { class: "adminEyebrow" }, "My China · Daily", -1)),
23306              _createElementVNode("h2", null, "مرحباً " + _toDisplayString(data.member.full_name), 1),
23307              _createElementVNode("p", null, [_createTextVNode(_toDisplayString(data.city_hub?$cityLabel(data.city_hub):($cityLabel(data.member.china_city)||'حدد مدينتك من الحساب')), 1), (data.member.china_district)
23308                ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createTextVNode(" · " + _toDisplayString(data.member.china_district), 1)], 64))
23309                : _createCommentVNode("", true)]),
23310              _createElementVNode("div", _hoisted_3, [
23311                _createElementVNode("button", { onClick: $event => (router.push(data.city_key?'/city/'+data.city_key:'/cities')) }, "🏙️ مدينتي", 8, _hoisted_4),
23312                _createElementVNode("button", { onClick: $event => (router.push('/new-to-china')) }, "🧭 خطة الوصول", 8, _hoisted_5),
23313                _createElementVNode("button", { onClick: $event => (router.push('/ask')) }, "✦ اسأل SMT", 8, _hoisted_6),
23314                _createElementVNode("button", { onClick: $event => (router.push('/notification-settings')) }, "🔔 التنبيهات", 8, _hoisted_7)
23315              ])
23316            ]), (data.next_actions&&data.next_actions.length)
23317              ? (_openBlock(), _createElementBlock("section", _hoisted_8, [_cache[2] || (_cache[2] = _createElementVNode("div", { class: "memberSectionHead" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "التالي عندك"), _createElementVNode("h3", null, "أشياء تستحق انتباهك الآن")])], -1)), _createElementVNode("div", _hoisted_9, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(data.next_actions, (x) => {
23318                  return (_openBlock(), _createElementBlock("button", {
23319                    key: x.kind+'-'+x.title,
23320                    onClick: $event => (openNext(x))
23321                  }, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(x.title), 1), _createElementVNode("small", null, _toDisplayString(x.summary), 1)]), _cache[1] || (_cache[1] = _createElementVNode("em", null, "←", -1))], 8, _hoisted_10))
23322                }), 128))])]))
23323              : _createCommentVNode("", true), _createElementVNode("section", _hoisted_11, [
23324              _createElementVNode("article", _hoisted_12, [
23325                _createElementVNode("div", _hoisted_13, [_cache[3] || (_cache[3] = _createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "أنا جديد في الصين"), _createElementVNode("h3", null, "تقدم خطة الوصول")], -1)), _createElementVNode("b", null, _toDisplayString(data.journey.percent) + "%", 1)]),
23326                _createElementVNode("div", _hoisted_14, [_createElementVNode("i", { style: _normalizeStyle({width:data.journey.percent+'%'}) }, null, 4)]),
23327                (data.journey.next_step)
23328                  ? (_openBlock(), _createElementBlock("p", _hoisted_15, [_
23328cache[4] || (_cache[4] = _createElementVNode("b", null, "الخطوة التالية:", -1)), _createTextVNode(" " + _toDisplayString(data.journey.next_step.title_ar), 1)]))
23329                  : (_openBlock(), _createElementBlock("p", _hoisted_16, "أكملت خطوات الخطة الأساسية.")),
23330                _createElementVNode("button", {
23331                  class: "smallbtn",
23332                  onClick: $event => (router.push('/new-to-china'))
23333                }, "فتح الخطة", 8, _hoisted_17)
23334              ]),
23335              _createElementVNode("article", _hoisted_18, [_cache[6] || (_cache[6] = _createElementVNode("h3", null, "أهم ما حولك", -1)), _createElementVNode("div", _hoisted_19, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(data.city_essentials, (x) => {
23336                return (_openBlock(), _createElementBlock("button", {
23337                  key: x.id,
23338                  onClick: $event => (router.push('/china-guide/'+x.id))
23339                }, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(x.title_ar), 1), _createElementVNode("small", null, _toDisplayString(x.category_name_ar||'دليلك في الصين') + " · " + _toDisplayString(x.trust_tier==='official'?'رسمي':(x.trust_tier==='smt_verified'?'موثق من SMT':'مدرج')), 1)]), _cache[5] || (_cache[5] = _createElementVNode("em", null, "←", -1))], 8, _hoisted_20))
23340              }), 128)), (!data.city_essentials.length)
23341                ? (_openBlock(), _createElementBlock("p", _hoisted_21, "لا توجد عناصر موثقة كافية لمدينتك بعد."))
23342                : _createCommentVNode("", true)])]),
23343              _createElementVNode("article", _hoisted_22, [_cache[8] || (_cache[8] = _createElementVNode("h3", null, "المعارض القادمة", -1)), _createElementVNode("div", _hoisted_23, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(data.exhibitions, (x) => {
23344                return (_openBlock(), _createElementBlock("button", {
23345                  key: x.id,
23346                  onClick: $event => (router.push('/china-guide/'+x.id))
23347                }, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(x.title_ar), 1), _createElementVNode("small", null, _toDisplayString(x.exhibition_start_date||'قريباً'), 1)]), _cache[7] || (_cache[7] = _createElementVNode("em", null, "←", -1))], 8, _hoisted_24))
23348              }), 128)), (!data.exhibitions.length)
23349                ? (_openBlock(), _createElementBlock("p", _hoisted_25, "لا توجد معارض قادمة لمدينتك في البيانات الحالية."))
23350                : _createCommentVNode("", true)]), _createElementVNode("button", {
23351                class: "smallbtn secondary",
23352                onClick: $event => (router.push('/exhibitions'))
23353              }, "كل المعارض", 8, _hoisted_26)]),
23354              _createElementVNode("article", _hoisted_27, [_cache[10] || (_cache[10] = _createElementVNode("h3", null, "آخر التعميمات", -1)), _createElementVNode("div", _hoisted_28, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(data.circulars, (x) => {
23355                return (_openBlock(), _createElementBlock("button", {
23356                  key: x.id,
23357                  onClick: $event => (router.push('/official-circulars'))
23358                }, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(x.title), 1), _createElementVNode("small", null, _toDisplayString(shortDate(x.source_published_at||x.created_at)), 1)]), _cache[9] || (_cache[9] = _createElementVNode("em", null, "←", -1))], 8, _hoisted_29))
23359              }), 128)), (!data.circulars.length)
23360                ? (_openBlock(), _createElementBlock("p", _hoisted_30, "لا توجد تعميمات حديثة مطابقة لدولتك."))
23361                : _createCommentVNode("", true)])]),
23362              _createElementVNode("article", _hoisted_31, [_cache[11] || (_cache[11] = _createElementVNode("h3", null, "ملخص التنبيهات", -1)), (data.digest_preview)
23363                ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createElementVNode("b", null, _toDisplayString(data.digest_preview.item_count) + " تحديث", 1), _createElementVNode("small", null, _toDisplayString(data.digest_preview.digest_kind==='weekly'?'ملخص أسبوعي':'ملخص يومي') + " · " + _toDisplayString(shortDate(data.digest_preview.created_at)), 1), _createElementVNode("div", _hoisted_32, [_createElementVNode("span", null, "🏛️ " + _toDisplayString(data.digest_preview.counts.circulars), 1), _createElementVNode("span", null, "🗓️ " + _toDisplayString(data.digest_preview.counts.exhibitions), 1
23363)])], 64))
23364                : (_openBlock(), _createElementBlock("p", _hoisted_33, "لا يوجد ملخص جديد حالياً.")), _createElementVNode("button", {
23365                class: "smallbtn secondary",
23366                onClick: $event => (router.push('/notification-settings'))
23367              }, "إعداد التنبيهات", 8, _hoisted_34)]),
23368              _createElementVNode("article", _hoisted_35, [_cache[16] || (_cache[16] = _createElementVNode("h3", null, "المحفوظات", -1)), _createElementVNode("div", _hoisted_36, [
23369                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(data.saved_summary.city||0), 1), _cache[12] || (_cache[12] = _createElementVNode("small", null, "مدن", -1))]),
23370                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(data.saved_summary.exhibition||0), 1), _cache[13] || (_cache[13] = _createElementVNode("small", null, "معارض", -1))]),
23371                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(data.saved_summary.china_guide||0), 1), _cache[14] || (_cache[14] = _createElementVNode("small", null, "دليل", -1))]),
23372                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(data.saved_summary.circular||0), 1), _cache[15] || (_cache[15] = _createElementVNode("small", null, "تعميمات", -1))])
23373              ]), _createElementVNode("button", {
23374                class: "smallbtn",
23375                onClick: $event => (router.push('/services'))
23376              }, "استكشف الخدمات", 8, _hoisted_37)])
23377            ])], 64))
23378          : _createCommentVNode("", true)]),
23379      _: 1
23380    }))
23381  }
23382}
23383})()};
23384
23385  // Patch 2: registries for company sectors, countries, routes and unclassified items.
23386  const AdminTaxonomyPage={components:{AdminFrame},setup(){
23387    const store=useGzcStore(),router=useRouter();
23388    const tab=ref('sectors'),sectors=ref([]),countries=ref([]),routes=ref([]),statusCounts=ref([]),needs=ref({totals:{},items:[]}),flags=ref({}),routeServices=ref([]),openRoute=ref(null),msg=ref(''),busy=ref(false),loading=ref(true);
23389    const COVERAGE_AR={AVAILABLE:'متاح',LIMITED:'محدود',UNKNOWN:'غير معروف',NOT_SUPPORTED:'غير مدعوم',NEEDS_VERIFICATION:'يحتاج تحقق'};
23390    const COVERAGE_KEYS=Object.keys(COVERAGE_AR);
23391    const countryName=code=>{const row=countries.value.find(x=>x.code===code);return row?(row.name_ar||row.name_en||code):code;};
23392    async function save(url,body){busy.value=true;const r=await api(url,{method:'POST',body:JSON.stringify(body||{}),feedback:false});busy.value=false;msg.value=r&&r.ok?'تم الحفظ':((r&&r.message)||'تعذر الحفظ');return r;}
23393    async function load(){
23394      if(!await store.requireAdmin(router))return;
23395      loading.value=true;
23396      const [a,b,c,d,e]=await Promise.all([api('/api/admin/taxonomy/sectors',{feedback:false}),api('/api/admin/taxonomy/countries',{feedback:false}),api('/api/admin/taxonomy/routes',{feedback:false}),api('/api/admin/taxonomy/needs-classification',{feedback:false}),api('/api/admin/taxonomy/flags',{feedback:false})]);
23397      if(a&&a.ok)sectors.value=safeArray(a.sectors);if(b&&b.ok)countries.value=safeArray(b.countries);
23398      if(c&&c.ok){routes.value=safeArray(c.routes);statusCounts.value=safeArray(c.coverage_status_counts);}
23399      if(d&&d.ok)needs.value={totals:d.totals||{},items:safeArray(d.items)};if(e&&e.ok)flags.value=e.flags||{};
23400      loading.value=false;
23401    }
23402    async function toggleSector(row,field){const r=await save('/api/admin/taxonomy/sectors/'+encodeURIComponent(row.sector_key),{[field]:!row[field]});if(r&&r.ok)row[field]=!row[field];}
23403    async function toggleCountry(row,field){const r=await save('/api/admin/taxonomy/countries/'+encodeURIComponent(row.code),{[field]:!row[field]});if(r&&r.ok)row[field]=!row[field];}
23404    async function toggleFlag(key){const r=await save('/api/admin/taxonomy/flags',{[key]:!flags.value[key]});if(r&&r.ok)flags.value=r.flags;}
23405    async function showRoute(row){openRoute.value=row;routeServices.value=[];const r=await api('/api/admin/taxonomy/routes/'+row.route_id+'/services',{feedback:false});if(r&&r.ok)routeServices.value=safeArray(r.services);}
23406    async function setCoverage(svc,status){
23407      let evidence;
23408      if(status==='AVAILABLE'){evidence=prompt('اكتب دليل التغطية (مصدر أو ملاحظة تحقق):')||'';if(evidence.trim().length<5)return;}
23409      const r=await save('/api/admin/taxonomy/routes/'+openRoute.value.route_id+'/services/'+encodeURIComponent(svc.service_type),{coverage_status:status,active:['AVAILABLE','LIMITED'].includes(status),...(evidence?{evidence_note:evidence}:{})});
23410      if(r&&r.ok){Object.assign(svc,r.service);await load();}
23411    }
23412    async function classify(item,sectorKey){const r=await save('/api/admin/taxonomy/items/'+item.id+'/classify',{company_
23412sector_key:sectorKey||null});if(r&&r.ok)await load();}
23413    onMounted(load);
23414    return {store,tab,sectors,countries,routes,statusCounts,needs,flags,routeServices,openRoute,msg,busy,loading,COVERAGE_AR,COVERAGE_KEYS,countryName,toggleSector,toggleCountry,toggleFlag,showRoute,setCoverage,classify};
23415  },
23416  render:(function(){
23417const _Vue = Vue
23418const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
23419
23420const _hoisted_1 = { class: "card" }
23421const _hoisted_2 = {
23422  class: "row adminTabs",
23423  role: "tablist"
23424}
23425const _hoisted_3 = ["aria-selected", "onClick"]
23426const _hoisted_4 = { key: 0 }
23427const _hoisted_5 = {
23428  class: "hint",
23429  role: "status",
23430  "aria-live": "polite"
23431}
23432const _hoisted_6 = { class: "row" }
23433const _hoisted_7 = ["checked", "disabled", "onChange"]
23434const _hoisted_8 = ["checked", "disabled", "onChange"]
23435const _hoisted_9 = {
23436  key: 0,
23437  class: "hint"
23438}
23439const _hoisted_10 = {
23440  key: 1,
23441  class: "card"
23442}
23443const _hoisted_11 = { class: "tableWrap" }
23444const _hoisted_12 = { class: "dataTable" }
23445const _hoisted_13 = ["checked", "disabled", "onChange"]
23446const _hoisted_14 = ["checked", "disabled", "onChange"]
23447const _hoisted_15 = ["checked", "disabled", "onChange"]
23448const _hoisted_16 = ["checked", "disabled", "onChange"]
23449const _hoisted_17 = {
23450  key: 2,
23451  class: "card"
23452}
23453const _hoisted_18 = { class: "tableWrap" }
23454const _hoisted_19 = { class: "dataTable" }
23455const _hoisted_20 = ["checked", "disabled", "onChange"]
23456const _hoisted_21 = ["checked", "disabled", "onChange"]
23457const _hoisted_22 = ["checked", "disabled", "onChange"]
23458const _hoisted_23 = {
23459  key: 3,
23460  class: "card"
23461}
23462const _hoisted_24 = { class: "hint" }
23463const _hoisted_25 = { class: "tableWrap" }
23464const _hoisted_26 = { class: "dataTable" }
23465const _hoisted_27 = ["onClick"]
23466const _hoisted_28 = {
23467  key: 0,
23468  class: "card"
23469}
23470const _hoisted_29 = ["value", "disabled", "onChange"]
23471const _hoisted_30 = ["value"]
23472const _hoisted_31 = {
23473  key: 4,
23474  class: "card"
23475}
23476const _hoisted_32 = { class: "hint" }
23477const _hoisted_33 = {
23478  key: 0,
23479  class: "hint"
23480}
23481const _hoisted_34 = ["disabled", "onChange"]
23482const _hoisted_35 = ["value"]
23483
23484return function render(_ctx, _cache) {
23485  with (_ctx) {
23486    const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, toDisplayString: _toDisplayString, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode, normalizeClass: _normalizeClass, createElementVNode: _createElementVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
23487
23488    const _component_router_link = _resolveComponent("router-link")
23489    const _component_AdminFrame = _resolveComponent("AdminFrame")
23490
23491    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "التصنيفات والدول والمسارات" }, {
23492      default: _withCtx(() => [
23493        _createElementVNode("section", _hoisted_1, [_createElementVNode("div", _hoisted_2, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList([['sectors','القطاعات'],['countries','الدول'],['routes','المسارات'],['needs','يحتاج تصنيف']], (t) => {
23494          return (_openBlock(), _createElementBlock("button", {
23495            key: t[0],
23496            type: "button",
23497            role: "tab",
23498            "aria-selected": tab===t[0],
23499            class: _normalizeClass(['smallbtn',tab===t[0]?'':'secondary']),
23500            onClick: $event => (tab=t[0])
23501          }, [_createTextVNode(_toDisplayString(t[1]), 1), (t[0]==='needs' && (needs.totals.without_category||needs.totals.company_without_sector))
23502            ? (_openBlock(), _createElementBlock("span", _hoisted_4, " · " + _toDisplayString((needs.totals.without_category||0)+(needs.totals.company_without_sector||0)), 1))
23503            : _createCommentVNode("", true)], 10, _hoisted_3))
23504        }), 128))]), _createElementVNode("p", _hoisted_5, _toDisplayString(msg), 1), _createElementVNode("div", _hoisted_6, [_createElementVNode("label", null, [_createElementVNode("input", {
23505          type: "checkbox",
23506          checked: flags.company_sector_taxonomy,
23507          disabled: busy,
23508          onChange: $event => (toggleFlag('company_sector_taxonomy'))
23509        }, null, 40, _hoisted_7), _cache[0] || (_cache[0] = _createTextVNode(" إظهار قطاعات الشركات للزوار"))]), _createElementVNode("label", null, [_createElementVNode("input", {
23510          type: "checkbox",
23511          checked: flags.trade_country_registry,
23512          disabled: busy,
23513          onChange: $event => (toggleFlag('trade_country_registry'))
23514        }, null, 40, _hoisted_8), _cache[1] || (_cache[1] = _createTextVNode(" التجارة تتبع سجل الدول"))])])]),
23515        loading
23516          ? (_openBlock(), _createElementBlock("p", _hoisted_9, "جارٍ التحميل..."))
23517          : _createCommentVNode("", true),
23518        (tab==='sectors')
23519          ? (_openBlock(), _createElementBlock("section", _hoisted_10, [_createElementVNode("h3", null, "قطاعات الشركات (" + _toDisplayString(sectors.length) + ")", 1), _createElementVNode("div", _hoisted_11, [_createElementVNode("table", _hoisted_12, [_cache[2] || (_cache[2] = _createElementVNode("thead", null, [_createElementVNode("tr", null, [
23520              _createElementVNode("th", null, "القطاع"),
23521              _createElementVNode("th", null, "EN"),
23522              _createElementVNode("th", null, "中文"),
23523              _createElementVNode("th", null, "العناصر"),
23524              _createElementVNode("th", null, "مفعّل"),
23525              _createElementVNode("th", null, "مميّز"),
23526              _createElementVNode("th", null, "بحث"),
23527              _createElementVNode("th", null, "أبحاث")
23528            ])], -1)), _createElementVNode("tbody", null, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(sectors, (s) => {
23529              return (_openBlock(), _createElementBlock("tr", { key: s.sector_key }, [
23530                _createElementVNode("td", null, [_createTextVNode(_toDisplayString(s.name_ar), 1), _createElementVNode("small", null, _toDisplayString(s.sector_key), 1)]),
23531                _createElementVNode("td", null, _toDisplayString(s.name_en), 1),
23532                _createElementVNode("td", null, _toDisplayString(s.name_zh), 1),
23533                _createElementVNode("td", null, _toDisplayString(s.public_item_count) + "/" + _toDisplayString(s.item_count), 1),
23534                _createElementVNode("td", null, [_createElementVNode("input", {
23535                  type: "checkbox",
23536                  checked: s.active,
23537                  disabled: busy,
23538                  onChange: $event => (toggleSector(s,'active'))
23539                }, null, 40, _hoisted_13)]),
23540                _createElementVNode("td", null, [_createElementVNode("input", {
23541                  type: "checkbox",
23542                  checked: s.featured,
23543                  disabled: busy,
23544                  onChange: $event => (toggleSector(s,'featured'))
23545                }, null, 40, _hoisted_14)]),
23546                _createElementVNode("td", null, [_createElementVNode("input", {
23547                  type: "checkbox",
23548                  checked: s.search_enabled,
23549                  disabled: busy,
23550                  onChange: $event => (toggleSector(s,'search_enabled'))
23551                }, null, 40, _hoisted_15)]),
23552                _createElementVNode("td", null, [_createElementVNode("input", {
23553                  type: "checkbox",
23554                  checked: s.research_enabled,
23555                  disabled: busy,
23556                  onChange: $event => (toggleSector(s,'research_enabled'))
23557                }, null, 40, _hoisted_16)])
23558              ]))
23559            }), 128))])])])]))
23560          : _createCommentVNode("", true),
23561        (tab==='countries')
23562          ? (_openBlock(), _createElementBlock("section", _hoisted_17, [_createElementVNode("h3", null, "سجل الدول (" + _toDisplayString(countries.length) + ")", 1), _createElementVNode("div", _hoisted_18, [_createElementVNode("table", _hoisted_19, [_cache[3] || (_cache[3] = _createElementVNode("thead", null, [_createElementVNode("tr", null, [
23563              _createElementVNode("th", null, "الدولة"),
23564              _createElementVNode("th", null, "ISO"),
23565              _createElementVNode("th", null, "المنطقة"),
23566              _createElementVNode("th", null, "الأولوية"),
23567              _createElementVNode("th", null, "تجارة"),
23568              _createElementVNode("th", null, "شحن"),
23569              _createElementVNode("th", null, "أبحاث")
23570            ])], -1)), _createElementVNode("tbody", null, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(countries, (c) => {
23571              return (_openBlock(), _createElementBlock("tr", { key: c.code }, [
23572                _createElementVNode("td", null, [_createTextVNode(_toDisplayString(c.name_ar), 1), _createElementVNode("small", null, _toDisplayString(c.name_zh), 1)]),
23573                _createElementVNode("td", null, _toDisplayString(c.code) + " / " + _toDisplayString(c.iso3), 1),
23574                _createElementVNode("td", null, _toDisplayString(c.subregion||c.region_group), 1),
23575                _createElementVNode("td", null, _toDisplayString(c.priority), 1),
23576                _createElementVNode("td", null, [_createElementVNode("input", {
23577                  type: "checkbox",
23578                  checked: c.trade_enabled,
23579                  disabled: busy,
23580                  onChange: $event => (toggleCountry(c,'trade_enabled'))
23581                }, null, 40, _hoisted_20)]),
23582                _createElementVNode("td", null, [_createElementVNode("input", {
23583                  type: "checkbox",
23584                  checked: c.shipping_enabled,
23585                  disabled: busy,
23586                  onChange: $event => (toggleCountry(c,'shipping_enabled'))
23587                }, null, 40, _hoisted_21)]),
23588                _createElementVNode("td", null, [_createElementVNode("input", {
23589                  type: "checkbox",
23590                  checked: c.research_enabled,
23591                  disabled: busy,
23592                  onChange: $event => (toggleCountry(c,'research_enabled'))
23593                }, null, 40, _hoisted_22)])
23594              ]))
23595            }), 128))])])])]))
23596          : _createCommentVNode("", true),
23597        (tab==='routes')
23598          ? (_openBlock(), _createElementBlock("section", _hoisted_23, [
23599              _createElementVNode("h3", null, "المسارات (" + _toDisplayString(routes.length) + ")", 1),
23600              _createElementVNode("p", _hoisted_24, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(statusCounts, (c) => {
23601                return (_openBlock(), _createElementBlock("span", { key: c.coverage_status }, _toDisplayString(COVERAGE_AR[c.coverage_status]||c.coverage_status) + ": " + _toDisplayString(c.count) + " · ", 1))
23602              }), 128))]),
23603              _createElementVNode("div", _hoisted_25, [_createElementVNode("table", _hoisted_26, [_cache[4] || (_cache[4] = _createElementVNode("thead", null, [_createElementVNode("tr", null, [
23604                _createElementVNode("th", null, "المسار"),
23605                _createElementVNode("th", null, "الأولوية"),
23606                _createElementVNode("th", null, "خدمات متاحة"),
23607                _createElementVNode("th")
23608              ])], -1)), _createElementVNode("tbody", null, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(routes, (r) => {
23609                return (_openBlock(), _createElementBlock("tr", { key: r.route_id }, [
23610                  _createElementVNode("td", null, _toDisplayString(countryName(r.origin_country_code)) + " ← " + _toDisplayString(countryName(r.destination_country_code)), 1),
23611                  _createElementVNode("td", null, _toDisplayString(r.priority), 1),
23612                  _createElementVNode("td", null, _toDisplayString(r.available_services) + "/" + _toDisplayString(r.service_rows), 1),
23613                  _createElementVNode("td", null, [_createElementVNode("button", {
23614                    type: "button",
23615                    class: "smallbtn secondary",
23616                    onClick: $event => (showRoute(r))
23617                  }, "الخدمات", 8, _hoisted_27)])
23618                ]))
23619              }), 128))])])]),
23620              openRoute
23621                ? (_openBlock(), _createElementBlock("div", _hoisted_28, [_createElementVNode("h4", null, _toDisplayString(countryName(openRoute.origin_country_code)) + " ← " + _toDisplayString(countryName(openRoute.destination_country_code)), 1), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(routeServices, (svc) => {
23622                    return (_openBlock(), _createElementBlock("div", {
23623                      key: svc.service_type,
23624                      class: "row"
23625                    }, [_createElementVNode("b", null, _toDisplayString(svc.name_ar), 1), _createElementVNode("select", {
23626                      value: svc.coverage_status,
23627                      disabled: busy,
23628                      onChange: $event => (setCoverage(svc,$event.target.value))
23629                    }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(COVERAGE_KEYS, (k) => {
23630                      return (_openBlock(), _createElementBlock("option", {
23631                        key: k,
23632                        value: k
23633                      }, _toDisplayString(COVERAGE_AR[k]), 9, _hoisted_30))
23634                    }), 128))], 40, _hoisted_29), _createElementVNode("small", null, "مصادر: " + _toDisplayString(svc.source_count), 1)]))
23635                  }), 128))]))
23636                : _createCommentVNode("", true)
23637            ]))
23638          : _createCommentVNode("", true),
23639        (tab==='needs')
23640          ? (_openBlock(), _createElementBlock("section", _hoisted_31, [
23641              _cache[7] || (_cache[7] = _createElementVNode("h3", null, "عناصر تحتاج تصنيفاً", -1)),
23642              _createElementVNode("p", _hoisted_32, "بلا قسم: " + _toDisplayString(needs.totals.without_category||0) + " · شركات بلا قطاع: " + _toDisplayString(needs.totals.company_without_sector||0), 1),
23643              (!needs.items.length)
23644                ? (_openBlock(), _createElementBlock("div", _hoisted_33, "لا توجد عناصر تحتاج تصنيفاً."))
23645                : _createCommentVNode("", true),
23646              (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(needs.items, (i) => {
23647                return (_openBlock(), _createElementBlock("div", {
23648                  key: i.reason+i.id,
23649                  class: "row"
23650                }, [_createElementVNode("b", null, _toDisplayString(i.title_ar), 1), _createElementVNode("small", null, _toDisplayString(i.city) + " · " + _toDisplayString(i.reason==='no_category'?'بلا قسم':'شركة بلا قطاع'), 1), (i.reason==='company_without_sector')
23651                  ? (_openBlock(), _createElementBlock("select", {
23652                      key: 0,
23653                      disabled: busy,
23654                      onChange: $event => (classify(i,$event.target.value))
23655                    }, [_cache[5] || (_cache[5] = _createElementVNode("option", { value: "" }, "اختر القطاع", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(sectors, (s) => {
23656                      return (_openBlock(), _createElementBlock("option", {
23657                        key: s.sector_key,
23658                        value: s.sector_key
23659                      }, _toDisplayString(s.name_ar), 9, _hoisted_35))
23660                    }), 128))], 40, _hoisted_34))
23661                  : (_openBlock(), _createBlock(_component_router_link, {
23662                      key: 1,
23663                      class: "smallbtn secondary",
23664                      to: {path:'/admin/china-guide',query:{workspace:'items',item:i.id}}
23665                    }, {
23666                      default: _withCtx(() => _cache[6] || (_cache[6] = [_createTextVNode("فتح للتصنيف")])),
23667                      _: 2,
23668                      __: [6]
23669                    }, 1032, ["to"]))]))
23670              }), 128))
23671            ]))
23672          : _createCommentVNode("", true)
23673      ]),
23674      _: 1
23675    }))
23676  }
23677}
23678})()};
23679  const AdminCityCoveragePage={components:{AdminFrame},setup(){const store=useGzcStore(),router=useRouter(),data=ref(null),loading=ref(true),error=ref(''),filter=reactive({focus:'',state:''});
23680    let loadSequence=0;
23681    async function load(){const sequence=++loadSequence;loading.value=true;data.value=null;error.value='';
23682      const qs=new URLSearchParams();if(filter.focus)qs.set('focus',filter.focus);if(filter.state)qs.set('state',filter.state);
23683      try{if(!await store.requireAdmin(router))return;
23684      const r=await api('/api/admin/city-coverage'+(qs.toString()?'?'+qs.toString():''));
23685      if(sequence!==loadSequence)return;
23686      if(r&&r.ok)data.value=r;else error.value=(r&&r.message)||'تعذر تحميل تغطية المدن';
23687      }catch(_){if(sequence===loadSequence)error.value='تعذر تحميل تغطية المدن. أعد المحاولة.';}
23688      finally{if(sequence===loadSequence)loading.value=false;}}
23689    onUnmounted(()=>{loadSequence++;});
23690    onMounted(load);
23691    const cities=computed(()=>safeArray(data.value&&data.value.cities));
23692    const opportunities=computed(()=>safeArray(data.value&&data.value.opportunities));
23693    const summary=computed(()=>(data.value&&data.value.summary)||{total_cities:0,covered:0,starter:0,empty:0});
23694    function pct(city){return Math.round((Number(city.coverage_ratio)||0)*100);}
23695    function focusLabel(k){return k==='trade'?'تجارة':(k==='tourism'?'سياحة':(k==='trade_tourism'?'تجارة وسياحة':'عام'));}
23696    function stateLabel(k){return k==='covered'?'مغطاة':(k==='starter'?'بداية':'فارغة');}
23697    return{store,data,loading,error,filter,load,cities,opportunities,summary,pct,focusLabel,stateLabel};},
23698    render:(function(){
23699const _Vue = Vue
23700const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
23701
23702const _hoisted_1 = { class: "card" }
23703const _hoisted_2 = { class: "editGrid" }
23704const _hoisted_3 = ["onUpdate:modelValue", "onChange"]
23705const _hoisted_4 = ["onUpdate:modelValue", "onChange"]
23706const _hoisted_5 = {
23707  key: 0,
23708  class: "aiAutomationMetrics"
23709}
23710const _hoisted_6 = {
23711  key: 0,
23712  class: "card",
23713  role: "alert"
23714}
23715const _hoisted_7 = ["onClick", "disabled"]
23716const _hoisted_8 = {
23717  key: 1,
23718  class: "card loadingState",
23719  role: "status"
23720}
23721const _hoisted_9 = {
23722  key: 2,
23723  class: "card"
23724}
23725const _hoisted_10 = { class: "dailyList" }
23726const _hoisted_11 = { class: "profileLine" }
23727const _hoisted_12 = { class: "statusPill" }
23728const _hoisted_13 = { class: "hint" }
23729const _hoisted_14 = {
23730  key: 0,
23731  class: "hint"
23732}
23733const _hoisted_15 = {
23734  key: 1,
23735  class: "dailyList"
23736}
23737const _hoisted_16 = {
23738  key: 2,
23739  class: "hint"
23740}
23741const _hoisted_17 = { class: "memberCardTop" }
23742const _hoisted_18 = { class: "statusPill" }
23743const _hoisted_19 = { class: "profileLine" }
23744const _hoisted_20 = { class: "profileLine" }
23745const _hoisted_21 = { class: "profileLine" }
23746const _hoisted_22 = { class: "localCommunityGrid" }
23747const _hoisted_23 = {
23748  key: 3,
23749  class: "card"
23750}
23751
23752return function render(_ctx, _cache) {
23753  with (_ctx) {
23754    const { createElementVNode: _createElementVNode, vModelSelect: _vModelSelect, withDirectives: _withDirectives, createTextVNode: _createTextVNode, toDisplayString: _toDisplayString, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, renderList: _renderList, Fragment: _Fragment, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock, normalizeClass: _normalizeClass } = _Vue
23755
23756    const _component_router_link = _resolveComponent("router-link")
23757    const _component_AdminFrame = _resolveComponent("AdminFrame")
23758
23759    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "تغطية المدن" }, {
23760      default: _withCtx(() => [
23761        _cache[18] || (_cache[18] = _createElementVNode("section", { class: "card noticeCard compactNotice" }, [_createElementVNode("h3", null, "تغطية المدن"), _createElementVNode("p", null, "مشتقة من المحتوى المنشور والموثق فقط. تُظهر أين ينقص المحتوى الأساسي لكل مدينة حسب طابعها، ولا تنشئ أي مهمة بحث بنفسها.")], -1)),
23762        _createElementVNode("section", _hoisted_1, [_createElementVNode("div", _hoisted_2, [_createElementVNode("label", null, [_cache[1] || (_cache[1] = _createTextVNode("الطابع")), _withDirectives(_createElementVNode("select", {
23763          "onUpdate:modelValue": $event => ((filter.focus) = $event),
23764          onChange: load
23765        }, _cache[0] || (_cache[0] = [
23766          _createElementVNode("option", { value: "" }, "الكل", -1),
23767          _createElementVNode("option", { value: "trade" }, "تجارة", -1),
23768          _createElementVNode("option", { value: "tourism" }, "سياحة", -1),
23769          _createElementVNode("option", { value: "trade_tourism" }, "تجارة وسياحة", -1),
23770          _createElementVNode("option", { value: "general" }, "عام", -1)
23771        ]), 40, _hoisted_3), [[_vModelSelect, filter.focus]])]), _createElementVNode("label", null, [_cache[3] || (_cache[3] = _createTextVNode("الحالة")), _withDirectives(_createElementVNode("select", {
23772          "onUpdate:modelValue": $event => ((filter.state) = $event),
23773          onChange: load
23774        }, _cache[2] || (_cache[2] = [
23775          _createElementVNode("option", { value: "" }, "الكل", -1),
23776          _createElementVNode("option", { value: "empty" }, "فارغة", -1),
23777          _createElementVNode("option", { value: "starter" }, "بداية", -1),
23778          _createElementVNode("option", { value: "covered" }, "مغطاة", -1)
23779        ]), 40, _hoisted_4), [[_vModelSelect, filter.state]])])]), data
23780          ? (_openBlock(), _createElementBlock("div", _hoisted_5, [
23781              _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(summary.total_cities), 1), _cache[4] || (_cache[4] = _createTextVNode(" مدينة"))]),
23782              _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(summary.covered), 1), _cache[5] || (_cache[5] = _createTextVNode(" مغطاة"))]),
23783              _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(summary.starter), 1), _cache[6] || (_cache[6] = _createTextVNode(" بداية"))]),
23784              _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(summary.empty), 1), _cache[7] || (_cache[7] = _
23784createTextVNode(" فارغة"))])
23785            ]))
23786          : _createCommentVNode("", true)]),
23787        error
23788          ? (_openBlock(), _createElementBlock("section", _hoisted_6, [_createElementVNode("p", null, _toDisplayString(error), 1), _createElementVNode("button", {
23789              class: "smallbtn",
23790              onClick: load,
23791              disabled: loading
23792            }, "إعادة المحاولة", 8, _hoisted_7)]))
23793          : _createCommentVNode("", true),
23794        loading
23795          ? (_openBlock(), _createElementBlock("div", _hoisted_8, _cache[8] || (_cache[8] = [_createElementVNode("span", {
23796              class: "loadingSpinner",
23797              "aria-hidden": "true"
23798            }, null, -1), _createElementVNode("h3", null, "جاري التحميل...", -1)])))
23799          : _createCommentVNode("", true),
23800        (!loading && opportunities.length)
23801          ? (_openBlock(), _createElementBlock("section", _hoisted_9, [
23802              _cache[11] || (_cache[11] = _createElementVNode("h3", null, "أولويات التغطية المقترحة", -1)),
23803              _cache[12] || (_cache[12] = _createElementVNode("p", { class: "hint" }, "مرتبة حسب الأثر ومُوزّعة على المدن حتى لا تُستهلك التشغيلات على مدينة واحدة.", -1)),
23804              _cache[13] || (_cache[13] = _createElementVNode("p", { class: "hint" }, "الجاهزية تخص الهدف فقط؛ التنفيذ يخضع أيضاً لإعدادات التشغيل والميزانية وبقية الأولويات. تغيير الفلتر يحدّث الفجوات المعروضة.", -1)),
23805              _createElementVNode("div", _hoisted_10, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(opportunities, (o) => {
23806                return (_openBlock(), _createElementBlock("article", {
23807                  key: o.key,
23808                  class: "compactNotice"
23809                }, [
23810                  _createElementVNode("h4", null, _toDisplayString($cityLabel(o.city_name_ar)) + " · " + _toDisplayString(o.intent_label_ar), 1),
23811                  _createElementVNode("div", _hoisted_11, [_cache[9] || (_cache[9] = _createElementVNode("b", null, "أولوية التغطية", -1)), _createElementVNode("span", null, _toDisplayString(o.score), 1)]),
23812                  (o.research_readiness)
23813                    ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createElementVNode("p", _hoisted_12, _toDisplayString(o.research_readiness.label_ar), 1), _createElementVNode("p", _hoisted_13, _toDisplayString(o.research_readiness.attempts) + " محاولة مكتملة خلال ٩٠ يوماً · " + _toDisplayString(o.research_readiness.approved) + " معتمد · " + _toDisplayString(o.research_readiness.pending) + " ينتظر المراجعة", 1), (o.research_readiness.reason==='target_cooldown')
23814                        ? (_openBlock(), _createElementBlock("p", _hoisted_14, "المتبقي عند تحميل الصفحة: " + _toDisplayString(o.research_readiness.remaining_hours) + " ساعة", 1))
23815                        : _createCommentVNode("", true)], 64))
23816                    : _createCommentVNode("", true),
23817                  (o.review_links && o.review_links.length)
23818                    ? (_openBlock(), _createElementBlock("div", _hoisted_15, [_
23818cache[10] || (_cache[10] = _createElementVNode("p", { class: "hint" }, "أقدم المقترحات المنتظرة لهذا الهدف — حتى ٣ مقترحات، من كامل السجل.", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(o.review_links, (r) => {
23819                        return (_openBlock(), _createBlock(_component_router_link, {
23820                          key: r.id,
23821                          to: r.review_path,
23822                          class: "smallbtn secondary"
23823                        }, {
23824                          default: _withCtx(() => [_createTextVNode(" مراجعة: " + _toDisplayString(r.title) + " · " + _toDisplayString(r.status==='in_review'?'قيد المراجعة':'بانتظار المراجعة') + " · " + _toDisplayString(r.age_days) + " يوم ", 1)]),
23825                          _: 2
23826                        }, 1032, ["to"]))
23827                      }), 128))]))
23828                    : (o.research_readiness && o.research_readiness.pending)
23829                      ? (_openBlock(), _createElementBlock("p", _hoisted_16, "توجد مقترحات منتظرة؛ حدّث الصفحة لإعادة تحميل روابطها."))
23830                      : _createCommentVNode("", true)
23831                ]))
23832              }), 128))])
23833            ]))
23834          : _createCommentVNode("", true),
23835        (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(cities, (c) => {
23836          return (_openBlock(), _createElementBlock("section", {
23837            class: "card",
23838            key: c.city_key
23839          }, [
23840            _createElementVNode("div", _hoisted_17, [_createElementVNode("h4", null, _toDisplayString($cityLabel(c)), 1), _createElementVNode("span", _hoisted_18, _toDisplayString(stateLabel(c.state)), 1)]),
23841            _createElementVNode("div", _hoisted_19, [_cache[14] || (_cache[14] = _createElementVNode("b", null, "الطابع", -1)), _createElementVNode("span", null, _toDisplayString(focusLabel(c.focus_kind)), 1)]),
23842            _createElementVNode("div", _hoisted_20, [_cache[15] || (_cache[15] = _createElementVNode("b", null, "التغطية الأساسية", -1)), _createElementVNode("span", null, _toDisplayString(c.essential_covered) + " / " + _toDisplayString(c.essential_total) + " (" + _toDisplayString(pct(c)) + "%)", 1)]),
23843            _createElementVNode("div", _hoisted_21, [_cache[16] || (_cache[16] = _createElementVNode("b", null, "العناصر المنشورة", -1)), _createElementVNode("span", null, _toDisplayString(c.item_count), 1)]),
23844            _createElementVNode("div", _hoisted_22, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(c.intents, (i) => {
23845              return (_openBlock(), _createElementBlock("span", {
23846                key: i.intent_key,
23847                class: _normalizeClass(["statusPill", {danger:i.state==='empty'}])
23848              }, _toDisplayString(i.label_ar) + ": " + _toDisplayString(i.item_count), 3))
23849            }), 128))])
23850          ]))
23851        }), 128)),
23852        (!loading && data && !cities.length)
23853          ? (_openBlock(), _createElementBlock("section", _hoisted_23, _cache[17] || (_cache[17] = [_createElementVNode("p", { class: "hint" }, "لا توجد مدن مطابقة لهذا الفلتر.", -1)])))
23854          : _createCommentVNode("", true)
23855      ]),
23856      _: 1,
23857      __: [18]
23858    }))
23859  }
23860}
23861})()};
23862
23863  const AdminAiEfficiencyPage={components:{AdminFrame,AiAdminCenterNav},setup(){const store=useGzcStore(),router=useRouter(),route=useRoute(),data=ref(null),loading=ref(true),error=ref(''),hub=ref(['china_guide','trade_shipping'].includes(String((route.query||{}).hub||''))?String(route.query.hub):'china_guide');
23864    let loadSequence=0;
23865    async function load(){const sequence=++loadSequence;const requestedHub=hub.value;loading.value=true;data.value=null;error.value='';
23866      try{if(!await store.requireAdmin(router))return;
23867      const r=await api('/api/admin/ai-research/efficiency?hub='+encodeURIComponent(requestedHub));
23868      if(sequence!==loadSequence)return;
23869      if(r&&r.ok)data.value=r;else error.value=(r&&r.message)||'تعذر تحميل مؤشرات الكفاءة';
23870      }catch(_){if(sequence===loadSequence)error.value='تعذر تحميل مؤشرات الكفاءة. أعد المحاولة.';}
23871      finally{if(sequence===loadSequence)loading.value=false;}}
23872    onUnmounted(()=>{loadSequence++;});
23873    onMounted(load);
23874    const e=computed(()=>
23874(data.value&&data.value.efficiency)||null);
23875    const policy=computed(()=>(data.value&&data.value.policy)||{});
23876    const repeated=computed(()=>safeArray(e.value&&e.value.repeated_targets));
23877    const successRate=computed(()=>{const ok=Number(e.value&&e.value.completed_jobs||0),bad=Number(e.value&&e.value.failed_jobs||0),total=ok+bad;return total?Math.round(ok*100/total):null;});
23878    function pct(v){return Math.round((Number(v)||0)*100);}
23879    async function changeHub(){await router.replace({path:'/admin/ai-efficiency',query:{hub:hub.value}}).catch(()=>{});await load();}
23880    function usageReason(reason){return ({no_jobs:'لا توجد مهام في الفترة',awaiting_completion:'المهام لم تنتهِ بعد',incomplete:'بيانات الاستهلاك غير مكتملة',in_progress:'توجد مهام جارية',no_approvals:'لم يتحقق اعتماد بعد'})[reason]||'غير متاح';}
23881    return{store,data,loading,error,hub,load,e,policy,repeated,successRate,pct,usageReason,changeHub};},
23882    render:(function(){
23883const _Vue = Vue
23884const { createVNode: _createVNode, createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
23885
23886const _hoisted_1 = { class: "card noticeCard compactNotice aiEfficiencyHero" }
23887const _hoisted_2 = { class: "row" }
23888const _hoisted_3 = { class: "card aiEfficiencyScope" }
23889const _hoisted_4 = ["onUpdate:modelValue", "onChange"]
23890const _hoisted_5 = {
23891  key: 0,
23892  class: "card",
23893  role: "alert"
23894}
23895const _hoisted_6 = ["onClick", "disabled"]
23896const _hoisted_7 = {
23897  key: 1,
23898  class: "card loadingState",
23899  role: "status"
23900}
23901const _hoisted_8 = { class: "card aiEfficiencySummary" }
23902const _hoisted_9 = { class: "aiEfficiencySummaryHead" }
23903const _hoisted_10 = { class: "aiEfficiencySummaryGrid" }
23904const _hoisted_11 = {
23905  key: 0,
23906  class: "card"
23907}
23908const _hoisted_12 = { class: "memberCardTop" }
23909const _hoisted_13 = { class: "statusPill" }
23910const _hoisted_14 = { class: "profileLine" }
23911const _hoisted_15 = { class: "profileLine" }
23912const _hoisted_16 = {
23913  key: 0,
23914  class: "hint"
23915}
23916const _hoisted_17 = {
23917  class: "card aiAdminDisclosure",
23918  open: ""
23919}
23920const _hoisted_18 = { class: "aiDisclosureBody" }
23921const _hoisted_19 = { class: "profileLine" }
23922const _hoisted_20 = { class: "profileLine" }
23923const _hoisted_21 = { class: "profileLine" }
23924const _hoisted_22 = { class: "profileLine" }
23925const _hoisted_23 = { key: 0 }
23926const _hoisted_24 = { class: "card aiAdminDisclosure" }
23927const _hoisted_25 = { class: "aiDisclosureBody" }
23928const _hoisted_26 = { class: "profileLine" }
23929const _hoisted_27 = { class: "profileLine" }
23930const _hoisted_28 = { class: "profileLine" }
23931const _hoisted_29 = { class: "profileLine" }
23932const _hoisted_30 = { class: "profileLine" }
23933const _hoisted_31 = { key: 0 }
23934const _hoisted_32 = { class: "card aiAdminDisclosure" }
23935const _hoisted_33 = { class: "aiDisclosureBody" }
23936const _hoisted_34 = { class: "profileLine" }
23937const _hoisted_35 = { class: "profileLine" }
23938const _hoisted_36 = { class: "profileLine" }
23939
23940return function render(_ctx, _cache) {
23941  with (_ctx) {
23942    const { resolveComponent: _resolveComponent, createVNode: _createVNode, createElementVNode: _createElementVNode, createTextVNode: _createTextVNode, withCtx: _withCtx, vModelSelect: _vModelSelect, withDirectives: _withDirectives, toDisplayString: _toDisplayString, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, normalizeClass: _normalizeClass, renderList: _renderList, Fragment: _Fragment, createBlock: _createBlock } = _Vue
23943
23944    const _component_AiAdminCenterNav = _resolveComponent("AiAdminCenterNav")
23945    const _component_router_link = _resolveComponent("router-link")
23946    const _component_AdminFrame = _resolveComponent("AdminFrame")
23947
23948    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "مركز AI — الكفاءة والمردود" }, {
23949      default: _withCtx(() => [
23950        _createVNode(_component_AiAdminCenterNav),
23951        _createElementVNode("section", _hoisted_1, [_cache[2] || (_cache[2] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "قياس لا قرار"), _createElementVNode("h3", null, "كفاءة ومردود البحث"), _createElementVNode("p", null, "آخر 30 يوماً للاستهلاك والنتائج، و90 يوماً للأهداف المتكررة. المردود يقاس بما اعتمده البشر لا بحجم ما يولده النموذج.")], -1)), _createElementVNode("div", _hoisted_2, [_createVNode(_component_router_link, {
23952          class: "smallbtn",
23953          to: {path:'/admin/ai-operations',query:{hub:hub,workspace:'jobs'}}
23954        }, {
23955          default: _withCtx(() => _cache[0] || (_cache[0] = [_createTextVNode("تشغيل بحث جديد")])),
23956          _: 1,
23957          __: [0]
23958        }, 8, ["to"]), _createVNode(_component_router_link, {
23959          class: "smallbtn secondary",
23960          to: {path:'/admin/ai-research',query:{hub:hub,workspace:'review'}}
23961        }, {
23962          default: _withCtx(() => _cache[1] || (_cache[1] = [_createTextVNode("فتح المقترحات")])),
23963          _: 1,
23964          __: [1]
23965        }, 8, ["to"])])]),
23966        _createElementVNode("section", _hoisted_3, [_createElementVNode("label", null, [_cache[4] || (_cache[4] = _createTextVNode("القسم")), _withDirectives(_createElementVNode("select", {
23967          "onUpdate:modelValue": $event => ((hub) = $event),
23968          onChange: changeHub
23969        }, _cache[3] || (_cache[3] = [_createElementVNode("option", { value: "china_guide" }, "دليلك في الصين", -1), _createElementVNode("option", { value: "trade_shipping" }, "التجارة والشحن", -1)]), 40, _hoisted_4), [[_vModelSelect, hub]])])]),
23970        error
23971          ? (_openBlock(), _createElementBlock("section", _hoisted_5, [_createElementVNode("p", null, _toDisplayString(error), 1), _createElementVNode("button", {
23972              class: "smallbtn",
23973              onClick: load,
23974              disabled: loading
23975            }, "إعادة المحاولة", 8, _hoisted_6)]))
23976          : _createCommentVNode("", true),
23977        loading
23978          ? (_openBlock(), _createElementBlock("div", _hoisted_7, _cache[5] || (_cache[5] = [_createElementVNode("span", {
23979              class: "loadingSpinner",
23980              "aria-hidden": "true"
23981            }, null, -1), _createElementVNode("h3", null, "جاري التحميل...", -1)])))
23982          : _createCommentVNode("", true),
23983        (!loading && e)
23984          ? (_openBlock(), _createElementBlock(_Fragment, { key: 2 }, [
23985              _createElementVNode("section", _hoisted_8, [_createElementVNode("div", _hoisted_9, [_cache[6] || (_cache[6] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "آخر 30 يوماً"), _createElementVNode("h3", null, "ملخص التشغيل")], -1)), _createElementVNode("span", { class: _normalizeClass(["statusPill", {canaryPill:successRate!==null&&successRate>=90}]) }, _toDisplayString(successRate===null?'لا بيانات':successRate+'% نجاح'), 3)]), _createElementVNode("div", _hoisted_10, [
23986                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(e.completed_jobs||0), 1), _cache[7] || (_cache[7] = _
vendor: 2,017 bytes, lines 23986-23996
23986createElementVNode("small", null, "مهام مكتملة", -1))]),
23987                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(e.failed_jobs||0), 1), _cache[8] || (_cache[8] = _createElementVNode("small", null, "مهام فاشلة", -1))]),
23988                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(e.suggestions_generated||0), 1), _cache[9] || (_cache[9] = _createElementVNode("small", null, "مقترحات مولدة", -1))]),
23989                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(e.approved||0), 1), _cache[10] || (_cache[10] = _createElementVNode("small", null, "مقترحات معتمدة", -1))]),
23990                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(e.pending_review||0), 1), _cache[11] || (_cache[11] = _createElementVNode("small", null, "بانتظار المراجعة", -1))]),
23991                _createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(e.duplicates_discarded||0), 1), _cache[12] || (_cache[12] = _createElementVNode("small", null, "مكرر مستبعد", -1))])
23992              ])]),
23993              (e.review_backlog)
23994                ? (_openBlock(), _createElementBlock("section", _hoisted_11, [
23995                    _createElementVNode("div", _hoisted_12, [_cache[13] || (_cache[13] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "يحتاج قراراً بشرياً"), _createElementVNode("h3", null, "رصيد المراجعة")], -1)), _createElementVNode("span", _hoisted_13, _toDisplayString(e.review_backlog.total||0), 1)]),
23996                    _createElementVNode("div", _hoisted_14, [_cache[14] || (_cache[14] = _createElementVNode("b", null, "ينتظر التجهيز / قيد المراجعة", -1)), _createElementVNode("span", null, _toDisplayString(e.review_backlog.pending) + " / " + _toDisplayString(e.review_backlog.in_review), 1)]),
23997                    _createElementVNode("div", _hoisted_15, [_cache[15] || (_cache[15] = _createElementVNode("b", null, "أقدم من 7 أيام / 30 يوماً", -1)), _createElementVNode("span", null, _toDisplayString(e.review_backlog.aged_7_days) + " / " + _toDisplayString(e.review_backlog.aged_30_days), 1)]),
23998                    (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(e.review_backlog.oldest, (s) => {
23999                      return (_openBlock(), _createElementBlock("article", {
24000                        key: s.id,
24001                        class: "compactNotice"
24002                      }, [_createElementVNode("h4", null, _toDisplayString(s.title), 1), _createElementVNode("p", null, _toDisplayString(s.age_days) + " يوم · " + _toDisplayString(s.status==='in_review'?'قيد المراجعة':'ينتظر التجهيز'), 1), _createVNode(_component_router_link, {
24003                        class: "smallbtn",
24004                        to: s.review_path
24005                      }, {
24006                        default: _withCtx(() => _cache[16] || (_cache[16] = [_createTextVNode("فتح المقترح")])),
24007                        _: 2,
24008                        __: [16]
24009                      }, 1032, ["to"])]))
24010                    }), 128)),
24011                    (!e.review_backlog.total)
24012                      ? (_openBlock(), _createElementBlock("p", _hoisted_16, "لا توجد مقترحات معلّقة في هذا القسم."))
24013                      : _createCommentVNode("", true)
24014                  ]))
24015                : _createCommentVNode("", true),
24016              _createElementVNode("details", _hoisted_17, [_createElementVNode("summary", null, [_cache[17] || (_cache[17] = _createElementVNode("b", null, "الاستهلاك والمزوّد", -1)), _createElementVNode("span", null, _toDisplayString(e.total_tokens===null?'غير متاح':e.total_tokens+' token'), 1)]), _createElementVNode("div", _hoisted_18, [
24017                _cache[23] || (_cache[23] = _createElementVNode("p", { class: "hint" }, "توكن المزوّد الأساسي المسجل؛ لا يشمل استهلاك الصور أو المساعد الثانوي، وليس فاتورة مالية.", -1)),
24018                _createElementVNode("div", _hoisted_19, [_cache[18] || (_cache[18] = _createElementVNode("b", null, "اكتمال القياس", -1)), _createElementVNode("span", null, [_createTextVNode(_toDisplayString(e.measured_jobs) + " من " + _toDisplayString(e.terminal_jobs), 1), (e.usage_coverage!==null)
24019                  ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [_createTextVNode(" (" + _toDisplayString(pct(e.usage_coverage)) + "%)", 1)], 64))
24020                  : _createCommentVNode("", true)])]),
24021                _createElementVNode("div", _hoisted_20, [_cache[19] || (_cache[19] = _createElementVNode("b", null, "متوسط الإدخال", -1)), _createElementVNode("span", null, _toDisplayString(e.avg_input_tokens===null?'غير متاح':e.avg_input_tokens), 1)]),
24022                _createElementVNode("div", _hoisted_21, [_cache[20] || (_cache[20] = _createElementVNode("b", null, "متوسط المخرجات", -1)), _createElementVNode("span", null, _toDisplayString(e.avg_output_tokens===null?'غير متاح':e.avg_output_tokens), 1)]),
24023                _createElementVNode("div", _hoisted_22, [_cache[21] || (_cache[21] = _createElementVNode("b", null, "توكن لكل مقترح معتمد", -1)), _createElementVNode("span", null, _toDisplayString(e.tokens_per_approved===null?usageReason(e.tokens_per_approved_unavailable_reason):e.tokens_per_approved), 1)]),
24024                (e.provider_models&&e.provider_models.length)
24025                  ? (_openBlock(), _createElementBlock("div", _hoisted_23, [_cache[22] || (_cache[22] = _createElementVNode("h4", null, "حسب المزوّد والنموذج", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(e.provider_models, (p) => {
24026                      return (_openBlock(), _createElementBlock("div", {
24027                        class: "profileLine",
24028                        key: p.provider+':'+p.model
24029                      }, [_createElementVNode("b", null, _toDisplayString(p.provider) + " · " + _toDisplayString(p.model), 1), _createElementVNode("span", null, _toDisplayString(p.total_tokens===null?'غير متاح':p.total_tokens) + " إجمالي · قياس " + _toDisplayString(p.measured_jobs) + "/" + _toDisplayString(p.jobs), 1)]))
24030                    }), 128))]))
24031                  : _createCommentVNode("", true)
24032              ])]),
24033              _createElementVNode("details", _hoisted_24, [_createElementVNode("summary", null, [_cache[24] || (_cache[24] = _createElementVNode("b", null, "المردود والتكرار", -1)), _createElementVNode("span", null, _toDisplayString(pct(e.approval_rate)) + "% اعتماد", 1)]), _createElementVNode("div", _hoisted_25, [
24034                _createElementVNode("div", _hoisted_26, [_cache[25] || (_cache[25] = _createElementVNode("b", null, "مقترحات مولدة", -1)), _createElementVNode("span", null, _toDisplayString(e.suggestions_generated), 1)]),
24035                _createElementVNode("div", _hoisted_27, [_cache[26] || (_cache[26] = _createElementVNode("b", null, "مكررات مستبعدة", -1)), _createElementVNode("span", null, _toDisplayString(e.duplicates_discarded) + " (" + _toDisplayString(pct(e.duplicate_rate)) + "%)", 1)]),
24036                _createElementVNode("div", _hoisted_28, [_cache[27] || (_cache[27] = _
24036createElementVNode("b", null, "معتمدة", -1)), _createElementVNode("span", null, _toDisplayString(e.approved) + " من " + _toDisplayString(e.decided) + " تم البت فيها (" + _toDisplayString(pct(e.approval_rate)) + "%)", 1)]),
24037                _createElementVNode("div", _hoisted_29, [_cache[28] || (_cache[28] = _createElementVNode("b", null, "أهداف تنتظر قرار المراجعة", -1)), _createElementVNode("span", null, _toDisplayString(e.awaiting_review_targets), 1)]),
24038                _createElementVNode("div", _hoisted_30, [_cache[29] || (_cache[29] = _createElementVNode("b", null, "أهداف مجمدة", -1)), _createElementVNode("span", null, _toDisplayString(e.frozen_targets), 1)]),
24039                (repeated.length)
24040                  ? (_openBlock(), _createElementBlock("div", _hoisted_31, [_cache[30] || (_cache[30] = _createElementVNode("h4", null, "أهداف متكررة", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(repeated, (t) => {
24041                      return (_openBlock(), _createElementBlock("div", {
24042                        class: "profileLine",
24043                        key: t.target_key
24044                      }, [_createElementVNode("b", null, _toDisplayString(t.target_key), 1), _createElementVNode("span", null, _toDisplayString(t.attempts) + " محاولة · " + _toDisplayString(t.approved) + " معتمد · " + _toDisplayString(t.pending) + " ينتظر المراجعة", 1)]))
24045                    }), 128))]))
24046                  : _createCommentVNode("", true)
24047              ])]),
24048              _createElementVNode("details", _hoisted_32, [_cache[34] || (_cache[34] = _createElementVNode("summary", null, [_createElementVNode("b", null, "حدود التشغيل"), _createElementVNode("span", null, "سياسة المحرك")], -1)), _createElementVNode("div", _hoisted_33, [_createElementVNode("div", _hoisted_34, [_cache[31] || (_cache[31] = _createElementVNode("b", null, "سقف جرد البرومبت", -1)), _createElementVNode("span", null, _toDisplayString(policy.prompt_inventory_limit) + " سطراً", 1)]), _createElementVNode("div", _hoisted_35, [_cache[32] || (_cache[32] = _createElementVNode("b", null, "سقف مخرجات الاستدعاء", -1)), _createElementVNode("span", null, _toDisplayString(policy.max_output_tokens) + " توكن", 1)]), _createElementVNode("div", _hoisted_36, [_cache[33] || (_cache[33] = _createElementVNode("b", null, "ذاكرة المرفوضات", -1)), _createElementVNode("span", null, _toDisplayString(policy.negative_memory_days) + " يوماً", 1)])])])
24049            ], 64))
24050          : _createCommentVNode("", true)
24051      ]),
24052      _: 1
24053    }))
24054  }
24055}
24056})()};
24057
24058
24059  const CountryCommunitiesPage={components:{PublicFrame},setup(){const store=useGzcStore(),router=useRouter(),data=ref(null),loading=ref(true),showForm=ref(false),form=reactive({city_key:'',contact_person:'',contact_whatsapp:'',contact_email:'',contact_url:'',about_ar:'',request_note:''});
24060    async function load(){loading.value=true;if(!await store.requireMember(router,'/country-communities'))return;const r=await api('/api/country-communities');if(r&&r.ok)data.value=r;else store.state.msg=(r&&r.message)||'تعذر تحميل الجاليات';loading.value=false;}
24061    async function submit(){if(!form.city_key){store.state.msg='اختر المدينة';return;}if(!form.contact_whatsapp){store.state.msg='رقم واتساب للتواصل مطلوب';return;}store.state.busy=true;const r=await api('/api/country-communities/request',{method:'POST',body:JSON.stringify(form)});store.state.busy=false;store.state.msg=r.message||r.error||'';if(r&&r.ok){showForm.value=false;form.city_key='';form.contact_person='';form.contact_whatsapp='';form.contact_email='';form.contact_url='';form.about_ar='';form.request_note='';await load();}}
24062    function openCommunity(cc){if(cc&&cc.slug)router.push('/community/'+encodeURIComponent(cc.slug));}
24063    onMounted(load);
24064    const communities=computed(()=>safeArray(data.value&&data.value.communities));
24065    const pending=computed(()=>safeArray(data.value&&data.value.pending));
24066    const cities=computed(()=>safeArray(data.value&&data.value.cities));
24067    const country=computed(()=>(data.value&&data.value.country)||null);
24068    return{store,data,loading,showForm,form,submit,communities,pending,cities,country,openCommunity};},
24069    render:(function(){
24070const _Vue = Vue
24071const { createVNode: _createVNode, createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
24072
24073const _hoisted_1 = {
24074  key: 0,
24075  class: "card loadingState",
24076  role: "status"
24077}
24078const _hoisted_2 = {
24079  key: 1,
24080  class: "card"
24081}
24082const _hoisted_3 = {
24083  key: 0,
24084  class: "hint"
24085}
24086const _hoisted_4 = {
24087  key: 2,
24088  class: "card"
24089}
24090const _hoisted_5 = {
24091  key: 3,
24092  class: "card"
24093}
24094const _hoisted_6 = { class: "localCommunityGrid" }
24095const _hoisted_7 = ["onClick"]
24096const _hoisted_8 = { class: "memberCardTop" }
24097const _hoisted_9 = { key: 0 }
24098const _hoisted_10 = {
24099  key: 4,
24100  class: "card"
24101}
24102const _hoisted_11 = { class: "statusPill" }
24103const _hoisted_12 = {
24104  key: 5,
24105  class: "card"
24106}
24107const _hoisted_13 = ["onClick"]
24108const _hoisted_14 = {
24109  key: 0,
24110  class: "editGrid"
24111}
24112const _hoisted_15 = ["onUpdate:modelValue"]
24113const _hoisted_16 = ["value"]
24114const _hoisted_17 = ["onUpdate:modelValue"]
24115const _hoisted_18 = ["onUpdate:modelValue"]
24116const _hoisted_19 = ["onUpdate:modelValue"]
24117const _hoisted_20 = ["onUpdate:modelValue"]
24118const _hoisted_21 = ["onUpdate:modelValue"]
24119const _hoisted_22 = ["onUpdate:modelValue"]
24120const _hoisted_23 = ["onClick"]
24121
24122return function render(_ctx, _cache) {
24123  with (_ctx) {
24124    const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, createVNode: _createVNode, renderList: _renderList, Fragment: _Fragment, vModelSelect: _vModelSelect, withDirectives: _withDirectives, vModelText: _vModelText, createBlock: _createBlock } = _Vue
24125
24126    const _component_router_link = _resolveComponent("router-link")
24127    const _component_PublicFrame = _resolveComponent("PublicFrame")
24128
24129    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "جاليات دولتك" }, {
24130      default: _withCtx(() => [
24131        _cache[19] || (_cache[19] = _createElementVNode("section", { class: "card dailyHero" }, [_createElementVNode("span", { class: "adminEyebrow" }, "Country Communities"), _createElementVNode("h2", null, "جاليات دولتك في الصين"), _createElementVNode("p", null, "الجنسية صفة للعضو فقط. تظهر لك جاليات دولتك، وأي جالية تطلب تسجيل صفحتها ومعلومات التواصل معها ثم تُنشر بعد المراجعة.")], -1)),
24132        loading
24133          ? (_openBlock(), _createElementBlock("div", _hoisted_1, _c
24133ache[0] || (_cache[0] = [_createElementVNode("span", {
24134              class: "loadingSpinner",
24135              "aria-hidden": "true"
24136            }, null, -1), _createElementVNode("h3", null, "جاري التحميل...", -1)])))
24137          : _createCommentVNode("", true),
24138        (!loading && country)
24139          ? (_openBlock(), _createElementBlock("section", _hoisted_2, [_cache[2] || (_cache[2] = _createElementVNode("h3", null, "دولتك", -1)), _createElementVNode("p", null, [_createElementVNode("b", null, _toDisplayString(country.name_ar), 1), _cache[1] || (_cache[1] = _createTextVNode()), (country.demonym_ar)
24140              ? (_openBlock(), _createElementBlock("span", _hoisted_3, "(" + _toDisplayString(country.demonym_ar) + ")", 1))
24141              : _createCommentVNode("", true)])]))
24142          : _createCommentVNode("", true),
24143        (!loading && !country)
24144          ? (_openBlock(), _createElementBlock("section", _hoisted_4, [_cache[4] || (_cache[4] = _createElementVNode("h3", null, "حدد دولتك أولاً", -1)), _cache[5] || (_cache[5] = _createElementVNode("p", { class: "hint" }, "أضف دولتك في ملفك الشخصي حتى تظهر لك جاليات دولتك.", -1)), _createVNode(_component_router_link, {
24145              class: "btn secondary",
24146              to: "/account"
24147            }, {
24148              default: _withCtx(() => _cache[3] || (_cache[3] = [_createTextVNode("فتح ملفي")])),
24149              _: 1,
24150              __: [3]
24151            })]))
24152          : _createCommentVNode("", true),
24153        (!loading && communities.length)
24154          ? (_openBlock(), _createElementBlock("section", _hoisted_5, [_cache[9] || (_cache[9] = _createElementVNode("h3", null, "الجاليات المنشورة", -1)), _createElementVNode("div", _hoisted_6, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(communities, (cc) => {
24155              return (_openBlock(), _createElementBlock("button", {
24156                type: "button",
24157                class: "localCommunityPublicCard clickable",
24158                key: cc.id,
24159                onClick: $event => (openCommunity(cc))
24160              }, [
24161                _createElementVNode("span", _hoisted_8, [_createElementVNode("h4", null, _toDisplayString(cc.name_ar), 1)]),
24162                _createElementVNode("span", null, [_cache[6] || (_cache[6] = _createElementVNode("b", null, "المدينة:", -1)), _createTextVNode(" " + _toDisplayString($cityLabel(cc.main_city) || '-'), 1)]),
24163                (cc.contact_whatsapp)
24164                  ? (_openBlock(), _createElementBlock("span", _hoisted_9, [_cache[7] || (_cache[7] = _createElementVNode("b", null, "واتساب:", -1)), _createTextVNode(" " + _toDisplayString(cc.contact_whatsapp), 1)]))
24165                  : _createCommentVNode("", true),
24166                _cache[8] || (_cache[8] = _createElementVNode("small", { class: "openHint" }, "اضغط لفتح الصفحة", -1))
24167              ], 8, _hoisted_7))
24168            }), 128))])]))
24169          : _createCommentVNode("", true),
24170        (!loading && pending.length)
24171          ? (_openBlock(), _createElementBlock("section", _hoisted_10, [_cache[10] || (_cache[10] = _createElementVNode("h3", null, "طلبات قيد المراجعة", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(pending, (p) => {
24172              return (_openBlock(), _createElementBlock("div", {
24173                class: "profileLine",
24174                key: p.id
24175              }, [_createElementVNode("b", null, _toDisplayString(p.name_ar), 1), _createElementVNode("span", _hoisted_11, _toDisplayString(p.publication_status==='under_review'?'قيد المراجعة':'مستلم'), 1)]))
24176            }), 128))]))
24177          : _createCommentVNode("", true),
24178        (!loading && country)
24179          ? (_openBlock(), _createElementBlock("section", _hoisted_12, [
24180              _cache[17] || (_cache[17] = _createElementVNode("h3", null, "طلب تسجيل جالية", -1)),
24181              _cache[18] || (_cache[18] = _createElementVNode("p", { class: "hint" }, "يقدَّم الطلب من ممثل الجالية. تُراجع الإدارة البيانات قبل النشر.", -1)),
24182              _createElementVNode("button", {
24183                class: "btn secondary",
24184                onClick: $event => (showForm=!showForm)
24185              }, _toDisplayString(showForm?'إغلاق النموذج':'فتح نموذج الطلب'), 9, _hoisted_13),
24186              showForm
24187                ? (_openBlock(), _createElementBlock("div", _hoisted_14, [
24188                    _createElementVNode("label", null, [_cache[12] || (_cache[12] = _createTextVNode("المدينة")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((form.city_key) = $event) }, [_cache[11] || (_cache[11] = _createElementVNode("option", { value: "" }, "اختر المدينة", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(cities, (c) => {
24189                      return (_openBlock(), _createElementBlock("option", {
24190                        key: c.city_key,
24191                        value: c.city_key
24192                      }, _toDisplayString(c.name_ar), 9, _hoisted_16))
24193                    }), 128))], 8, _hoisted_15), [[_vModelSelect, form.city_key]])]),
24194                    _createElementVNode("label", null, [_cache[13] || (_cache[13] = _createTextVNode("اسم المسؤول")), _withDirectives(_createElementVNode("input", {
24195                      "onUpdate:modelValue": $event => ((form.contact_person) = $event),
24196                      placeholder: "اسم ممثل الجالية"
24197                    }, null, 8, _hoisted_17), [[_vModelText, form.contact_person]])]),
24198                    _createElementVNode("label", null, [_cache[14] || (_cache[14] = _createTextVNode("واتساب التواصل")), _withDirectives(_createElementVNode("input", {
24199                      "onUpdate:modelValue": $event => ((form.contact_whatsapp) = $event),
24200                      placeholder: "مثال: 8613000000000"
24201                    }, null, 8, _hoisted_18), [[_vModelText, form.contact_whatsapp]])]),
24202                    _createElementVNode("label", null, [_cache[15] || (_cache[15] = _createTextVNode("البريد الإلكتروني")), _withDirectives(_createElementVNode("input", {
24203                      "onUpdate:modelValue": $event => ((form.contact_email) = $event),
24204                      placeholder: "اختياري"
24205                    }, null, 8, _hoisted_19), [[_vModelText, form.contact_email]])]),
24206                    _createElementVNode("label", null, [_cache[16] || (_cache[16] = _createTextVNode("رابط رسمي")), _withDirectives(_createElementVNode("input", {
24207                      "onUpdate:modelValue": $event => ((form.contact_url) = $event),
24208                      placeholder: "اختياري"
24209                    }, null, 8, _hoisted_20), [[_vModelText, form.contact_url]])])
24210                  ]))
24211                : _createCommentVNode("", true),
24212              showForm
24213                ? _withDirectives((_openBlock(), _createElementBlock("textarea", {
24214                    key: 1,
24215                    "onUpdate:modelValue": $event => ((form.about_ar) = $event),
24216                    placeholder: "نبذة عن الجالية وخدماتها"
24217                  }, null, 8, _hoisted_21)), [[_vModelText, form.about_ar]])
24218                : _createCommentVNode("", true),
24219              showForm
24220                ? _withDirectives((_openBlock(), _createElementBlock("textarea", {
24221                    key: 2,
24222                    "onUpdate:modelValue": $event => ((form.request_note) = $event),
24223                    placeholder: "ملاحظات للإدارة (اختياري)"
24224                  }, null, 8, _hoisted_22)), [[_vModelText, form.request_note]])
24225                : _createCommentVNode("", true),
24226              showForm
24227                ? (_openBlock(), _createElementBlock("button", {
24228                    key: 3,
24229                    class: "btn",
24230                    onClick: submit
24231                  }, "إرسال الطلب", 8, _hoisted_23))
24232                : _createCommentVNode("", true)
24233            ]))
24234          : _createCommentVNode("", true)
24235      ]),
24236      _: 1,
24237      __: [19]
24238    }))
24239  }
24240}
24241})()};
24242
24243  const AdminCountryCommunitiesPage={components:{AdminFrame},setup(){const store=useGzcStore(),router=useRouter(),rows=ref([]),loading=ref(true),filter=reactive({status:'all'});
24244    async function load(){loading.value=true;if(!await store.requireAdmin(router))return;const r=await api('/api/admin/country-communities?status='+encodeURIComponent(filter.status));if(r&&r.ok)rows.value=safeArray(r.communities);else store.state.msg=(r&&r.message)||'تعذر التحميل';loading.value=false;}
24245    async function decide(row,status){store.state.busy=true;const r=await api('/api/admin/country-communities/'+encodeURIComponent(row.id)+'/decision',{method:'POST',body:JSON.stringify({publication_status:status})});store.state.busy=false;store.state.msg=r.message||r.error||'';await load();}
24246    onMounted(load);
24247    return{store,rows,loading,filter,load,decide};},
24248    render:(function(){
24249const _Vue = Vue
24250const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
24251
24252const _hoisted_1 = { class: "card" }
24253const _hoisted_2 = { class: "editGrid" }
24254const _hoisted_3 = ["onUpdate:modelValue", "onChange"]
24255const _hoisted_4 = {
24256  key: 0,
24257  class: "card loadingState",
24258  role: "status"
24259}
24260const _hoisted_5 = { class: "memberCardTop" }
24261const _hoisted_6 = { class: "statusPill" }
24262const _hoisted_7 = { class: "profileLine" }
24263const _hoisted_8 = { class: "profileLine" }
24264const _hoisted_9 = {
24265  key: 0,
24266  class: "profileLine"
24267}
24268const _hoisted_10 = {
24269  key: 1,
24270  class: "profileLine"
24271}
24272const _hoisted_11 = {
24273  key: 2,
24274  class: "profileLine"
24275}
24276const _hoisted_12 = {
24277  key: 3,
24278  class: "hint"
24279}
24280const _hoisted_13 = {
24281  key: 4,
24282  class: "hint"
24283}
24284const _hoisted_14 = { class: "row" }
24285const _hoisted_15 = ["onClick"]
24286const _hoisted_16 = ["onClick"]
24287const _hoisted_17 = ["onClick"]
24288const _hoisted_18 = {
24289  key: 1,
24290  class: "card"
24291}
24292
24293return function render(_ctx, _cache) {
24294  with (_ctx) {
24295    const { createElementVNode: _createElementVNode, vModelSelect: _vModelSelect, withDirectives: _withDirectives, createTextVNode: _createTextVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, renderList: _renderList, Fragment: _Fragment, toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
24296
24297    const _component_AdminFrame = _resolveComponent("AdminFrame")
24298
24299    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "جاليات الدول" }, {
24300      default: _withCtx(() => [
24301        _cache[10] || (_cache[10] = _createElementVNode("section", { class: "card noticeCard compactNotice" }, [_createElementVNode("h3", null, "جاليات الدول"), _createElementVNode("p", null, "كيان الجالية تعريفي فقط: صفحة ومعلومات تواصل تظهر لأعضاء نفس الدولة. لا يمنح أي صلاحية تشغيلية ولا يغيّر هوية المنصة.")], -1)),
24302        _createElementVNode("section", _hoisted_1, [_createElementVNode("div", _hoisted_2, [_createElementVNode("label", null, [_cache[1] || (_cache[1] = _createTextVNode("الحالة")), _withDirectives(_createElementVNode("select", {
24303          "onUpdate:modelValue": $event => ((filter.status) = $event),
24304          onChange: load
24305        }, _cache[0] || (_cache[0] = [
24306          _createElementVNode("option", { value: "all" }, "الكل", -1),
24307          _createElementVNode("option", { value: "requested" }, "مستلم", -1),
24308          _createElementVNode("option", { value: "under_review" }, "قيد المراجعة", -1),
24309          _createElementVNode("option", { value: "published" }, "منشور", -1),
24310          _createElementVNode("option", { value: "rejected" }, "مرفوض", -1)
24311        ]), 40, _hoisted_3), [[_vModelSelect, filter.status]])])])]),
24312        loading
24313          ? (_openBlock(), _createElementBlock("div", _hoisted_4, _cache[2] || (_cache[2] = [_createElementVNode("span", {
24314              class: "loadingSpinner",
24315              "aria-hidden": "true"
24316            }, null, -1), _createElementVNode("h3", null, "جاري التحميل...", -1)])))
24317          : _createCommentVNode("", true),
24318        (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(rows, (row) => {
24319          return (_openBlock(), _createElementBlock("section", {
24320            class: "card",
24321            key: row.id
24322          }, [
24323            _createElementVNode("div", _hoisted_5, [_createElementVNode("h4", null, _toDisplayString(row.name_ar), 1), _createElementVNode("span", _hoisted_6, _toDisplayString(row.publication_status), 1)]),
24324            _createElementVNode("div", _hoisted_7, [_cache[3] || (_cache[3] = _createElementVNode("b", null, "الدولة", -1)), _createElementVNode("span", null, _toDisplayString(row.country_name_ar || row.country_code), 1)]),
24325            _createElementVNode("div", _hoisted_8, [_cache[4] || (_cache[4] = _createElementVNode("b", null, "المدينة", -1)), _createElementVNode("span", null, _toDisplayString($cityLabel(row.city_key)), 1)]),
24326            (row.contact_person)
24327              ? (_openBlock(), _createElementBlock("div", _hoisted_9, [_cache[5] || (_cache[5] = _createElementVNode("b", null, "المسؤول", -1)), _createElementVNode("span", null, _toDisplayString(row.
24327contact_person), 1)]))
24328              : _createCommentVNode("", true),
24329            (row.contact_whatsapp)
24330              ? (_openBlock(), _createElementBlock("div", _hoisted_10, [_cache[6] || (_cache[6] = _createElementVNode("b", null, "واتساب", -1)), _createElementVNode("span", null, _toDisplayString(row.contact_whatsapp), 1)]))
24331              : _createCommentVNode("", true),
24332            (row.contact_email)
24333              ? (_openBlock(), _createElementBlock("div", _hoisted_11, [_cache[7] || (_cache[7] = _createElementVNode("b", null, "البريد", -1)), _createElementVNode("span", null, _toDisplayString(row.contact_email), 1)]))
24334              : _createCommentVNode("", true),
24335            (row.about_ar)
24336              ? (_openBlock(), _createElementBlock("p", _hoisted_12, _toDisplayString(row.about_ar), 1))
24337              : _createCommentVNode("", true),
24338            (row.request_note)
24339              ? (_openBlock(), _createElementBlock("p", _hoisted_13, [_cache[8] || (_cache[8] = _createElementVNode("b", null, "ملاحظة الطلب:", -1)), _createTextVNode(" " + _toDisplayString(row.request_note), 1)]))
24340              : _createCommentVNode("", true),
24341            _createElementVNode("div", _hoisted_14, [_createElementVNode("button", {
24342              class: "btn",
24343              onClick: $event => (decide(row,'published'))
24344            }, "نشر", 8, _hoisted_15), _createElementVNode("button", {
24345              class: "btn secondary",
24346              onClick: $event => (decide(row,'under_review'))
24347            }, "قيد المراجعة", 8, _hoisted_16), _createElementVNode("button", {
24348              class: "smallbtn danger",
24349              onClick: $event => (decide(row,'rejected'))
24350            }, "رفض", 8, _hoisted_17)])
24351          ]))
24352        }), 128)),
24353        (!loading && !rows.length)
24354          ? (_openBlock(), _createElementBlock("section", _hoisted_18, _cache[9] || (_cache[9] = [_createElementVNode("p", { class: "hint" }, "لا توجد جاليات مسجلة في هذه الحالة.", -1)])))
24355          : _createCommentVNode("", true)
24356      ]),
24357      _: 1,
24358      __: [10]
24359    }))
24360  }
24361}
24362})()};
24363
24364  const NotificationSettingsPage={components:{PublicFrame},setup(){const store=useGzcStore(),router=useRouter(),hubs=ref([]),countries=ref([]),p=reactive({city_key:'',country_code:'',official_circulars:true,city_updates:true,exhibitions:true,trade_shipping:true,emergency_only:false,digest_mode:'daily',whatsapp_digest:false});async function load(){if(!await store.requireMember(router,'/notification-settings'))return;const [r,h,c]=await Promise.all([api('/api/member/notification-preferences'),api('/api/city-hubs'),api('/api/platform/countries')]);if(r&&r.preferences)Object.assign(p,r.preferences);hubs.value=safeArray(h.hubs);countries.value=safeArray(c.countries);}async function save(){const r=await api('/api/member/notification-preferences',{method:'POST',body:JSON.stringify(p)});store.state.msg=r.message||r.error||'';}onMounted(load);return{store,p,hubs,countries,save};},render:(function(){
24365const _Vue = Vue
24366const { createElementVNode: _createElementVNode, createTextVNode: _createTextVNode } = _Vue
24367
24368const _hoisted_1 = { class: "card notificationPreferenceForm" }
24369const _hoisted_2 = { class: "formTwo" }
24370const _hoisted_3 = ["onUpdate:modelValue"]
24371const _hoisted_4 = ["value"]
24372const _hoisted_5 = ["onUpdate:modelValue"]
24373const _hoisted_6 = ["value"]
24374const _hoisted_7 = { class: "checkRow" }
24375const _hoisted_8 = ["onUpdate:modelValue"]
24376const _hoisted_9 = { class: "checkRow" }
24377const _hoisted_10 = ["onUpdate:modelValue"]
24378const _hoisted_11 = { class: "checkRow" }
24379const _hoisted_12 = ["onUpdate:modelValue"]
24380const _hoisted_13 = { class: "checkRow" }
24381const _hoisted_14 = ["onUpdate:modelValue"]
24382const _hoisted_15 = { class: "checkRow" }
24383const _hoisted_16 = ["onUpdate:modelValue"]
24384const _hoisted_17 = ["onUpdate:modelValue"]
24385const _hoisted_18 = { class: "checkRow" }
24386const _hoisted_19 = ["onUpdate:modelValue"]
24387const _hoisted_20 = ["onClick"]
24388
24389return function render(_ctx, _cache) {
24390  with (_ctx) {
24391    const { createElementVNode: _createElementVNode, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, toDisplayString: _toDisplayString, vModelSelect: _vModelSelect, withDirectives: _withDirectives, createTextVNode: _
24391createTextVNode, vModelCheckbox: _vModelCheckbox, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
24392
24393    const _component_PublicFrame = _resolveComponent("PublicFrame")
24394
24395    return (_openBlock(), _createBlock(_component_PublicFrame, { title: "تفضيلات الإشعارات" }, {
24396      default: _withCtx(() => [_cache[12] || (_cache[12] = _createElementVNode("section", { class: "card dailyHero" }, [_createElementVNode("span", { class: "adminEyebrow" }, "الإشعارات الذكية"), _createElementVNode("h2", null, "استلم المهم فقط"), _createElementVNode("p", null, "حدد بلدك ومدينتك والموضوعات التي تريد متابعتها. لا تغيّر هذه الإعدادات إشعارات الطوارئ أو أمان الحساب.")], -1)), _createElementVNode("section", _hoisted_1, [
24397        _createElementVNode("div", _hoisted_2, [_createElementVNode("label", null, [_cache[1] || (_cache[1] = _createTextVNode("مدينتي")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((p.city_key) = $event) }, [_cache[0] || (_cache[0] = _createElementVNode("option", { value: "" }, "غير محددة", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(hubs, (c) => {
24398          return (_openBlock(), _createElementBlock("option", {
24399            value: c.city_key,
24400            key: c.city_key
24401          }, _toDisplayString($cityLabel(c)), 9, _hoisted_4))
24402        }), 128))], 8, _hoisted_3), [[_vModelSelect, p.city_key]])]), _createElementVNode("label", null, [_cache[3] || (_cache[3] = _createTextVNode("دولتي")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((p.country_code) = $event) }, [_cache[2] || (_cache[2] = _createElementVNode("option", { value: "" }, "غير محددة", -1)), (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(countries, (c) => {
24403          return (_openBlock(), _createElementBlock("option", {
24404            value: c.code,
24405            key: c.code
24406          }, _toDisplayString(c.name_ar), 9, _hoisted_6))
24407        }), 128))], 8, _hoisted_5), [[_vModelSelect, p.country_code]])])]),
24408        _createElementVNode("label", _hoisted_7, [_withDirectives(_createElementVNode("input", {
24409          type: "checkbox",
24410          "onUpdate:modelValue": $event => ((p.official_circulars) = $event)
24411        }, null, 8, _hoisted_8), [[_vModelCheckbox, p.official_circulars]]), _cache[4] || (_cache[4] = _createTextVNode(" التعميمات الرسمية"))]),
24412        _createElementVNode("label", _hoisted_9, [_withDirectives(_createElementVNode("input", {
24413          type: "checkbox",
24414          "onUpdate:modelValue": $event => ((p.city_updates) = $event)
24415        }, null, 8, _hoisted_10), [[_vModelCheckbox, p.city_updates]]), _cache[5] || (_cache[5] = _createTextVNode(" تحديثات مدينتي"))]),
24416        _createElementVNode("label", _hoisted_11, [_withDirectives(_createElementVNode("input", {
24417          type: "checkbox",
24418          "onUpdate:modelValue": $event => ((p.exhibitions) = $event)
24419        }, null, 8, _hoisted_12), [[_vModelCheckbox, p.exhibitions]]), _cache[6] || (_cache[6] = _createTextVNode(" المعارض"))]),
24420        _createElementVNode("label", _hoisted_13, [_withDirectives(_createElementVNode("input", {
24421          type: "checkbox",
24422          "onUpdate:modelValue": $event => ((p.trade_shipping) = $event)
24423        }, null, 8, _hoisted_14), [[_vModelCheckbox, p.trade_shipping]]), _cache[7] || (_cache[7] = _createTextVNode(" التجارة والشحن"))]),
24424        _createElementVNode("label", _hoisted_15, [_withDirectives(_createElementVNode("input", {
24425          type: "checkbox",
24426          "onUpdate:modelValue": $event => ((p.emergency_only) = $event)
24427        }, null, 8, _hoisted_16), [[_vModelCheckbox, p.emergency_only]]), _cache[8] || (_cache[8] = _createTextVNode(" وضع الطوارئ فقط"))]),
24428        _createElementVNode("label", null, [_cache[10] || (_cache[10] = _createTextVNode("تجميع التنبيهات")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((p.digest_mode) = $event) }, _cache[9] || (_cache[9] = [
24429          _createElementVNode("option", { value: "instant" }, "فوري عند توفره", -1),
24430          _createElementVNode("option", { value: "daily" }, "ملخص يومي", -1),
24431          _createElementVNode("option", { value: "weekly" }, "ملخص أسبوعي", -1),
24432          _createElementVNode("option", { value: "off" }, "بدون ملخص", -1)
24433        ]), 8, _hoisted_17), [[_vModelSelect, p.digest_mode]])]),
24434        _createElementVNode("label", _hoisted_18, [_withDirectives(_createElementVNode("input", {
24435          type: "checkbox",
24436          "onUpdate:modelValue": $event => ((p.whatsapp_digest) = $event)
24437        }, null, 8, _hoisted_19), [[_vModelCheckbox, p.whatsapp_digest]]), _cache[11] || (_cache[11] = _createTextVNode(" السماح بملخص واتساب عند تفعيله تشغيلياً"))]),
24438        _createElementVNode("button", {
24439          class: "btn",
24440          onClick: save
24441        }, "حفظ التفضيلات", 8, _hoisted_20)
24442      ])]),
24443      _: 1,
24444      __: [12]
24445    }))
24446  }
24447}
24448})()};
24449
24450  const AdminDailyUtilityPage={components:{AdminFrame},setup(){const store=useGzcStore(),router=useRouter(),data=ref(null),loading=ref(true),processing=ref('');async function load(){loading.value=true;if(!await store.requireAdmin(router))return;const r=await api('/api/admin/daily-utility/overview');if(r&&r.ok)data.value=r;else store.state.msg=r.message||r.error||'تعذر تحميل التشغيل اليومي';loading.value=false;}async function processDigest(kind){processing.value=kind;const r=await api('/api/admin/daily-utility/digests/process',{method:'POST',body:JSON.stringify({kind})});processing.value='';store.state.msg=r.message||r.error||'';if(r.ok)load();}function severity(v){return v==='high'?'عاجل':'متابعة';}onMounted(load);return{store,router,data,loading,processing,load,processDigest,severity,shortDate};},render:(function(){
24451const _Vue = Vue
24452const { createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
24453
24454const _hoisted_1 = { class: "card dashboardHeaderCard dailyOpsHeader" }
24455const _hoisted_2 = ["onClick"]
24456const _hoisted_3 = {
24457  key: 0,
24458  class: "card loadingState"
24459}
24460const _hoisted_4 = { class: "dailyOpsMetrics" }
24461const _hoisted_5 = { class: "card" }
24462const _hoisted_6 = { class: "card" }
24463const _hoisted_7 = { class: "card" }
24464const _hoisted_8 = { class: "card" }
24465const _hoisted_9 = { class: "card" }
24466const _hoisted_10 = { class: "adminTwo dailyOpsColumns" }
24467const _hoisted_11 = { class: "card" }
24468const _hoisted_12 = { class: "dailyList" }
24469const _hoisted_13 = ["onClick"]
24470const _hoisted_14 = {
24471  key: 0,
24472  class: "successText"
24473}
24474const _hoisted_15 = { class: "card" }
24475const _hoisted_16 = { class: "row" }
24476const _hoisted_17 = ["disabled", "onClick"]
24477const _hoisted_18 = ["disabled", "onClick"]
24478const _hoisted_19 = { class: "dailyList digestRunList" }
24479const _hoisted_20 = { class: "card" }
24480const _hoisted_21 = { class: "memberSectionHead" }
24481const _hoisted_22 = ["onClick"]
24482const _hoisted_23 = { class: "cityCoverageGrid" }
24483const _hoisted_24 = ["onClick"]
24484const _hoisted_25 = { key: 0 }
24485const _hoisted_26 = { key: 1 }
24486
24487return function render(_ctx, _cache) {
24488  with (_ctx) {
24489    const { createElementVNode: _createElementVNode, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, toDisplayString: _toDisplayString, renderList: _renderList, Fragment: _Fragment, normalizeClass: _normalizeClass, createTextVNode: _createTextVNode, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
24490
24491    const _component_AdminFrame = _resolveComponent("AdminFrame")
24492
24493    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "تشغيل SMT China اليومي" }, {
24494      default: _withCtx(() => [_createElementVNode("section", _hoisted_1, [_cache[0] || (_cache[0] = _createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "Daily Utility Operations"), _createElementVNode("h3", null, "هل تجربة المستخدم اليومية سليمة؟"), _createElementVNode("p", { class: "hint" }, "مراكز المدن، التعميمات، المعارض، خطة الوصول والإشعارات الذكية في شاشة تشغيل واحدة.")], -1)), _createElementVNode("button", {
24495        class: "smallbtn secondary",
24496        onClick: load
24497      }, "تحديث", 8, _hoisted_2)]), loading
24498        ? (_openBlock(), _createElementBlock("section", _hoisted_3, "جارٍ قراءة مؤشرات التشغيل..."))
24499        : data
24500          ? (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [_createElementVNode("section", _hoisted_4, [
24501              _createElementVNode("article", _hoisted_5, [_cache[1] || (_cache[1] = _createElementVNode("span", null, "المدن النشطة", -1)), _createElementVNode("b", null, _toDisplayString(data.cities.filter(x=>x.status==='active').length), 1), _createElementVNode("small", null, _toDisplayString(data.cities.filter(x=>x.content_gap).length) + " تحتاج تغطية", 1)]),
24502              _createElementVNode("article", _hoisted_6, [_cache[2] || (_cache[2] = _createElementVNode("span", null, "تعميمات فعالة", -1)), _createElementVNode("b", null, _toDisplayString(data.circulars.active), 1), _createElementVNode("small", null, _toDisplayString(data.circulars.expiring_7d) + " تنتهي خلال 7 أيام", 1)]),
24503              _createElementVNode("article", _hoisted_7, [_cache[3] || (_cache[3] = _createElementVNode("span", null, "معارض قادمة", -1)), _createElementVNode("b", null, _toDisplayString(data.exhibitions.upcoming), 1), _createElementVNode("small", null, _toDisplayString(data.exhibitions.missing_registration) + " بلا رابط تسجيل", 1)]),
24504              _createElementVNode("article", _hoisted_8, [_cache[4] || (_cache[4] = _createElementVNode("span", null, "القادمون الجدد", -1)), _createElementVNode("b", null, _toDisplayString(data.onboarding.engaged_members), 1), _cache[5] || (_cache[5] = _createElementVNode("small", null, "نشطوا في الخطة خلال 30 يوماً", -1))]),
24505              _createElementVNode("article", _hoisted_9, [_cache[6] || (_cache[6] = _createElementVNode("span", null, "ملخصات جاهزة", -1)), _createElementVNode("b", null, _toDisplayString(data.digests.deliveries.ready), 1), _createElementVNode("small", null, _toDisplayString(data.digests.deliveries.failed) + " تعذّر التسليم", 1)])
24506            ]), _createElementVNode("section", _hoisted_10, [_createElementVNode("article", _hoisted_11, [_cache[8] || (_cache[8] = _createElementVNode("div", { class: "memberSectionHead" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "يحتاج قرار"), _createElementVNode("h3", null, "أولوية التشغيل")])], -1)), _createElementVNode("div", _hoisted_12, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(data.attention, (x) => {
24507              return (_openBlock(), _createElementBlock("button", {
24508                key: x.title,
24509                onClick: $event => (router.push(x.path))
24510              }, [_createElementVNode("span", null, [_createElementVNode("b", null, [_createElementVNode("i", { class: _normalizeClass(["opsSeverity", x.severity]) }
24510, _toDisplayString(severity(x.severity)), 3), _createTextVNode(" " + _toDisplayString(x.title), 1)]), _createElementVNode("small", null, _toDisplayString(x.summary), 1)]), _cache[7] || (_cache[7] = _createElementVNode("em", null, "←", -1))], 8, _hoisted_13))
24511            }), 128)), (!data.attention.length)
24512              ? (_openBlock(), _createElementBlock("p", _hoisted_14, "لا توجد أمور تشغيلية تتطلب تدخلاً الآن."))
24513              : _createCommentVNode("", true)])]), _createElementVNode("article", _hoisted_15, [
24514              _cache[9] || (_cache[9] = _createElementVNode("div", { class: "memberSectionHead" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "الإشعارات الذكية"), _createElementVNode("h3", null, "تشغيل الملخصات")])], -1)),
24515              _cache[10] || (_cache[10] = _createElementVNode("p", { class: "hint" }, "يمنع النظام تكرار الملخص للفترة نفسها، ويلتزم بإعدادات الإشعارات وواتساب.", -1)),
24516              _createElementVNode("div", _hoisted_16, [_createElementVNode("button", {
24517                class: "smallbtn",
24518                disabled: processing,
24519                onClick: $event => (processDigest('daily'))
24520              }, _toDisplayString(processing==='daily'?'جاري...':'تحديث اليومي'), 9, _hoisted_17), _createElementVNode("button", {
24521                class: "smallbtn secondary",
24522                disabled: processing,
24523                onClick: $event => (processDigest('weekly'))
24524              }, _toDisplayString(processing==='weekly'?'جاري...':'تحديث الأسبوعي'), 9, _hoisted_18)]),
24525              _createElementVNode("div", _hoisted_19, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(data.digests.runs.slice(0,4), (x) => {
24526                return (_openBlock(), _createElementBlock("div", { key: x.digest_kind+'-'+x.period_start }, [_createElementVNode("span", null, [_createElementVNode("b", null, _toDisplayString(x.digest_kind==='weekly'?'أسبوعي':'يومي') + " · " + _toDisplayString(x.status), 1), _createElementVNode("small", null, _toDisplayString(shortDate(x.period_start)) + " · " + _toDisplayString(x.deliveries_created) + " تسليم", 1)])]))
24527              }), 128))])
24528            ])]), _createElementVNode("section", _hoisted_20, [_createElementVNode("div", _hoisted_21, [_cache[11] || (_cache[11] = _createElementVNode("div", null, [_createElementVNode("span", { class: "adminEyebrow" }, "City Coverage"), _createElementVNode("h3", null, "تغطية مراكز المدن")], -1)), _createElementVNode("button", {
24529              class: "smallbtn secondary",
24530              onClick: $event => (router.push('/admin/city-hubs'))
24531            }, "إدارة المدن", 8, _hoisted_22)]), _createElementVNode("div", _hoisted_23, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(data.cities, (x) => {
24532              return (_openBlock(), _createElementBlock("button", {
24533                key: x.city_key,
24534                class: _normalizeClass(["cityCoverageCard", {gap:x.content_gap}]),
24535                onClick: $event => (router.push('/admin/china-guide'))
24536              }, [
24537                _createElementVNode("b", null, _toDisplayString($cityLabel(x)), 1),
24538                _createElementVNode("small", null, _toDisplayString(x.status) + " · " + _toDisplayString(x.verified_items) + " عنصر موثق", 1),
24539                _createElementVNode("div", null, [_createElementVNode("span", null, "خدمات " + _toDisplayString(x.services), 1), _createElementVNode("span", null, "معارض " + _toDisplayString(x.exhibitions), 1)]),
24540                (x.content_gap)
24541                  ? (_openBlock(), _createElementBlock("em", _hoisted_25, "تحتاج تغطية"))
24542                  : (_openBlock(), _createElementBlock("em", _hoisted_26, "تغطية أساسية متاحة"))
24543              ], 10, _hoisted_24))
24544            }), 128))])])], 64))
24545          : _createCommentVNode("", true)]),
24546      _: 1
24547    }))
24548  }
24549}
24550})()};
24551
24552  const AdminCityHubsPage={components:{AdminFrame},setup(){const store=useGzcStore(),hubs=ref([]),edit=reactive({city_key:'',name_ar:'',name_en:'',province_ar:'',province_en:'',hero_image_url:'',summary_ar:'',summary_en:'',status:'active',sort_order:100,featured:false});async function load(){const r=await api('/api/admin/city-hubs');hubs.value=safeArray(r.hubs);}function open(x){Object.assign(edit,x);}async function save(){if(!edit.city_key){store.state.msg='اختر مدينة موجودة أو اكتب مفتاحاً صالحاً';return;}const r=await api('/api/admin/city-hubs/'+encodeURIComponent(edit.city_key),{method:'POST',body:JSON.stringify(edit)});store.state.msg=r.message||r.error||'';if(r.ok)load();}onMounted(load);return{store,hubs,edit,open,save};},render:(function(){
24553const _Vue = Vue
24554const { createElementVNode: _createElementVNode, createTextVNode: _createTextVNode } = _Vue
24555
24556const _hoisted_1 = { class: "adminTwo" }
24557const _hoisted_2 = { class: "card adminGuideList" }
24558const _hoisted_3 = ["onClick"]
24559const _hoisted_4 = { class: "card dailyForm" }
24560const _hoisted_5 = ["onUpdate:modelValue"]
24561const _hoisted_6 = { class: "formTwo" }
24562const _hoisted_7 = ["onUpdate:modelValue"]
24563const _hoisted_8 = ["onUpdate:modelValue"]
24564const _hoisted_9 = { class: "formTwo" }
24565const _hoisted_10 = ["onUpdate:modelValue"]
24566const _hoisted_11 = ["onUpdate:modelValue"]
24567const _hoisted_12 = ["onUpdate:modelValue"]
24568const _hoisted_13 = ["onUpdate:modelValue"]
24569const _hoisted_14 = ["onUpdate:modelValue"]
24570const _hoisted_15 = { class: "checkRow" }
24571const _hoisted_16 = ["onUpdate:modelValue"]
24572const _hoisted_17 = ["onUpdate:modelValue"]
24573const _hoisted_18 = ["onClick"]
24574
24575return function render(_ctx, _cache) {
24576  with (_ctx) {
24577    const { createElementVNode: _createElementVNode, renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, toDisplayString: _toDisplayString, vModelText: _vModelText, withDirectives: _withDirectives, createTextVNode: _createTextVNode, vModelSelect: _vModelSelect, vModelCheckbox: _vModelCheckbox, resolveComponent: _resolveComponent, withCtx: _withCtx, createBlock: _createBlock } = _Vue
24578
24579    const _component_AdminFrame = _resolveComponent("AdminFrame")
24580
24581    return (_openBlock(), _createBlock(_component_AdminFrame, { title: "مراكز المدن" }, {
24582      default: _withCtx(() => [_cache[11] || (_cache[11] = _createElementVNode("section", { class: "card dashboardHeaderCard" }, [_createElementVNode("div", null, [_createElementVNode("span", { class: "vueBadge" }, "City Hubs"), _createElementVNode("h3", null, "إدارة واجهات المدن"), _createElementVNode("p", { class: "hint" }, "المحتوى الفعلي يُسحب من China Guide؛ هنا تتحكم في هوية وترتيب مركز المدينة.")])], -1)), _createElementVNode("section", _hoisted_1, [_createElementVNode("div", _hoisted_2, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(hubs, (x) => {
24583        return (_openBlock(), _createElementBlock("button", {
24584          class: "guideAdminItem",
24585          key: x.city_key,
24586          onClick: $event => (open(x))
24587        }, [_createElementVNode("b", null, _toDisplayString($cityLabel(x)), 1), _createElementVNode("small", null, " · " + _toDisplayString(x.status) + " · " + _toDisplayString(x.featured?'مميزة':'عادية'), 1)], 8, _hoisted_3))
24588      }), 128))]), _createElementVNode("div", _hoisted_4, [
24589        _createElementVNode("label", null, [_cache[0] || (_cache[0] = _createTextVNode("مفتاح المدينة")), _withDirectives(_createElementVNode("input", {
24590          "onUpdate:modelValue": $event => ((edit.city_key) = $event),
24591          placeholder: "guangzhou"
24592        }, null, 8, _hoisted_5), [[_vModelText, edit.city_key]])]),
24593        _createElementVNode("div", _hoisted_6, [_createElementVNode("label", null, [_cache[1] || (_cache[1] = _createTextVNode("الاسم العربي")), _withDirectives(_createElementVNode("input", { "onUpdate:modelValue": $event => ((edit.name_ar) = $event) }, null, 8, _hoisted_7), [[_vModelText, edit.name_ar]])]), _createElementVNode("label", null, [_cache[2] || (_cache[2] = _createTextVNode("English")), _withDirectives(_createElementVNode("input", { "onUpdate:modelValue": $event => ((edit.name_en) = $event) }, null, 8, _hoisted_8), [[_vModelText, edit.name_en]])])]),
24594        _createElementVNode("div", _hoisted_9, [_createElementVNode("label", null, [_cache[3] || (_cache[3] = _createTextVNode("المقاطعة عربي")), _withDirectives(_createElementVNode("input", { "onUpdate:modelValue": $event => ((edit.province_ar) = $event) }, null, 8, _hoisted_10), [[_vModelText, edit.province_ar]])]), _createElementVNode("label", null, [_cache[4] || (_cache[4] = _createTextVNode("Province")), _withDirectives(_createElementVNode("input", { "onUpdate:modelValue": $event => ((edit.province_en) = $event) }, null, 8, _hoisted_11), [[_vModelText, edit.province_en]])])]),
24595        _createElementVNode("label", null, [_cache[5] || (_cache[5] = _createTextVNode("رابط صورة الغلاف")), _withDirectives(_createElementVNode("input", {
24596          class: "ltr",
24597          "onUpdate:modelValue": $event => ((edit.hero_image_url) = $event)
24598        }, null, 8, _hoisted_12), [[_vModelText, edit.hero_image_url]])]),
24599        _createElementVNode("label", null, [_cache[6] || (_cache[6] = _createTextVNode("الوصف العربي")), _withDirectives(_createElementVNode("textarea", { "onUpdate:modelValue": $event => ((edit.summary_ar) = $event) }, null, 8, _hoisted_13), [[_vModelText, edit.summary_ar]])]),
24600        _createElementVNode("label", null, [_cache[8] || (_cache[8] = _createTextVNode("الحالة")), _withDirectives(_createElementVNode("select", { "onUpdate:modelValue": $event => ((edit.status) = $event) }, _cache[7] || (_cache[7] = [_createElementVNode("option", { value: "draft" }, "مسودة", -1), _createElementVNode("option", { value: "active" }, "مفعلة", -1), _createElementVNode("option", { value: "disabled" }, "معطلة", -1)]), 8, _hoisted_14), [[_vModelSelect, edit.status]])]),
24601        _createElementVNode("label", _hoisted_15, [_withDirectives(_createElementVNode("input", {
24602          type: "checkbox",
24603          "onUpdate:modelValue": $event => ((edit.featured) = $event)
24604        }, null, 8, _hoisted_16), [[_vModelCheckbox, edit.featured]]), _cache[9] || (_cache[9] = _createTextVNode(" مدينة مميزة"))]),
24605        _createElementVNode("label", null, [_cache[10] || (_cache[10] = _createTextVNode("الترتيب")), _withDirectives(_createElementVNode("input", {
24606          type: "number",
24607          "onUpdate:modelValue": $event => ((edit.sort_order) = $event)
24608        }, null, 8, _hoisted_17), [[
24609          _vModelText,
24610          edit.sort_order,
24611          void 0,
24612          { number: true }
24613        ]])]),
24614        _createElementVNode("button", {
24615          class: "btn",
24616          onClick: save
24617        }, "حفظ مركز المدينة", 8, _hoisted_18)
24618      ])])]),
24619      _: 1,
24620      __: [11]
24621    }))
24622  }
24623}
24624})()};
24625
24626
24627
24628  const routes=[
24629    {path:'/',component:PublicHomePage,meta:{title:'الرئيسية'}},
24630    {path:'/official/login',component:OfficialLoginPage},
24631    {path:'/official/tour',component:OfficialTourPage},
24632    {path:'/official',component:OfficialDashboardPage},
24633    {path:'/official/members',component:OfficialMembersPage},
24634    {path:'/official/member/:id',component:OfficialMemberDetailPage},
24635    {path:'/official/cases',component:OfficialCasesPage},
24636    {path:'/official/emergency',component:OfficialEmergencyPage},
24637    {path:'/official/events',component:OfficialEventsPage},
24638    {path:'/official/announcements',component:OfficialAnnouncementsPage},
24639    {path:'/official/publish',component:OfficialPublishAnnouncementPage},
24640    {path:'/official/about',component:AboutPage},
24641    {path:'/community/:slug',component:CommunityDetailPage,meta:{title:'المجتمعات والجاليات'}},
24642    {path:'/login',component:MemberLoginPage,meta:{title:'دخول العضوية'}},
24643    {path:'/register',component:MemberRegisterPage,meta:{title:'طلب عضوية'}},
24644    {path:'/demo',component:PublicDemoPage},
24645    {path:'/account',component:PublicAccountPage,meta:{requiresMember:true,title:'حسابي'}},
24646    {path:'/wallet',component:MemberWalletPage,meta:{requiresMember:true,title:'محفظتي'}},
24647    {path:'/orders',component:MemberOrdersPage,meta:{requiresMember:true,title:'طلباتي'}},
24648    {path:'/notifications',component:MemberNotificationsPage,meta:{requiresMember:true,title:'إشعاراتي'}},
24649    {path:'/procurement/new',component:MemberProcurementPage,meta:{requiresMember:true,title:'طلب جديد'}},
24650    {path:'/procurement',component:MemberProcurementPage,meta:{requiresMember:true,title:'تفاصيل طلب التوريد'}},
24651    {path:'/card',redirect:'/account'},
24652    {path:'/cities',component:CitiesPage,meta:{title:'مدن الصين'}},
24653    {path:'/city/:city',component:CityHubPage,meta:{title:'مركز المدينة'}},
24654    {path:'/new-to-china',component:NewToChinaPage,meta:{requiresMember:true,title:'أنا جديد في الصين'}},
24655    {path:'/ask',component:AskSmtPage,meta:{requiresMember:true,title:'اسأل SMT China'}},
24656    {path:'/official-circulars',component:OfficialCircularCenterPage,meta:{title:'التعميمات الرسمية'}},
24657    {path:'/services',component:ServicesDirectoryPage,meta:{title:'الخدمات الموثوقة'}},
24658    {path:'/toolkit',component:ToolkitPage,meta:{title:'أدوات الحياة في الصين'}},
24659    {path:'/apps-in-china',component:ChinaAppsPage,meta:{title:'تطبيقات مهمة في الصين'}},
24660    {path:'/exhibitions',component:ExhibitionsPage,meta:{title:'المعارض في الصين'}},
24661    {path:'/my-china',component:MyChinaPage,meta:{requiresMember:true,title:'My China'}},
24662    {path:'/notification-settings',component:NotificationSettingsPage,meta:{requiresMember:true,title:'تفضيلات الإشعارات'}},
24663    {path:'/china-guide/city/:city',component:ChinaGuidePage,meta:{title:'دليل المدينة في الصين'}},
24664    {path:'/china-guide/topic/:service',component:ChinaGuidePage,meta:{title:'موضوع في دليلك في الصين'}},
24665    {path:'/trade-shipping/topic/:service',component:ChinaGuidePage,meta:{title:'موضوع في التجارة والشحن'}},
24666    {path:'/china-guide/china-emergency',redirect:"/china-guide?category_key=emergency"},
24667    {path:'/china-guide/china-residence-immigration',redirect:"/china-guide?category_key=visa_residence"},
24668    {path:'/china-guide/china-health-pharmacies',redirect:"/china-guide?category_key=health"},
24669    {path:'/china-guide/china-transport',redirect:"/china-guide?category_key=transport"},
24670    {path:'/china-guide/china-payments-banking',redirect:"/china-guide?category_key=payments"},
24671    {path:'/china-guide/china-telecom-internet',redirect:"/china-guide?category_key=telecom"},
24672    {path:'/china-guide/china-education-universities',redirect:"/china-guide?category_key=education"},
24673    {path:'/china-guide/china-business-markets',redirect:"/china-guide?category_key=markets"},
24674    {path:'/china-guide/china-shipping-logistics',redirect:"/china-guide?category_key=logistics"},
24675    {path:'/china-guide/china-hotels-accommodation',redirect:"/china-guide?category_key=hotels"},
24676    {path:'/china-guide/china-government-services',redirect:"/china-guide?category_key=gov_consulate"},
24677    {path:'/china-guide/china-exhibitions-conferences',redirect:"/china-guide?category_key=exhibitions"},
24678    {path:'/china-guide/china-exhibitions',redirect:"/china-guide?category_key=exhibitions"},
24679    {path:'/china-guide/hospitals',redirect:"/china-guide?category_key=health"},
24680    {path:'/china-guide/business',redirect:"/china-guide?category_key=markets"},
24681    {path:'/china-guide/china-sudanese-services',redirect:"/china-guide?community=sudanese"},
24682    {path:'/china-guide/china-tourism-restaurants',redirect:"/china-guide"},
24683    {path:'/china-guide/topic/general',redirect:"/china-guide"},
24684    {path:'/china-guide/tourism',redirect:"/china-guide"},
24685    {path:'/china-guide/halal-food',redirect:"/china-guide?category_key=restaurants&diet=halal"},
24686    {path:'/china-guide/services',redirect:"/china-guide"},
24687    {path:'/china-guide/tips',redirect:"/china-guide"},
24688    {path:'/china-guide/guide-in-china',redirect:"/china-guide"},
24689    {path:'/china-guide/:id',component:ChinaGuideDetailPage,meta:{title:'تفاصيل دليلك في الصين'}},
24690    {path:'/trade-shipping/:id',component:ChinaGuideDetailPage,meta:{title:'تفاصيل التجارة والشحن'}},
24691    {path:'/china-guide',component:ChinaGuidePage,meta:{title:'دليلك في الصين'}},{path:'/sudan-digital/:pathMatch(.*)*',redirect:'/china-guide',meta:{title:'دليلك في الصين'}},{path:'/trade-shipping',component:ChinaGuidePage,meta:{title:'التجارة والشحن'}},{path:'/knowledge',redirect:'/china-guide'},
24692    {path:'/guide',redirect:'/china-guide'},
24693    {path:'/circulars/:channel/:id',component:AnnouncementDetailPage,meta:{requiresMember:true,title:'تفاصيل التعميم'}},
24694    {path:'/circulars/:channel',component:PublicOfficialCircularsPage,meta:{requiresMember:true,title:'التعميمات الرسمية'}},
24695    {path:'/announcements/:id',component:AnnouncementDetailPage,meta:{requiresMember:true,title:'تفاصيل الإعلان'}},
24696    {path:'/announcements',component:PublicAnnouncementsPage,meta:{requiresMember:true,title:'الإعلانات'}},
24697    {path:'/events',component:PublicEventsPage,meta:{title:'الفعاليات'}},
24698    {path:'/events/:id',component:PublicEventDetailPage,meta:{title:'تفاصيل الفعالية'}},
24699    {path:'/help',component:HelpPage,meta:{requiresMember:true,title:'طلب مساعدة'}},
24700    {path:'/feedback',component:FeedbackPage,meta:{requiresMember:true,title:'الملاحظات والاقتراحات'}},
24701    {path:'/emergency',component:EmergencyPage,meta:{requiresMember:true,title:'الطوارئ'}},
24702    {path:'/arrival',component:ArrivalPage},
24703    {path:'/country-communities',component:CountryCommunitiesPage,meta:{requiresMember:true,title:'جاليات دولتك'}},
24704    {path:'/about',component:AboutPage,meta:{title:'عن المنصة'}},
24705    {path:'/privacy',component:PrivacyPage,meta:{title:'سياسة الخصوصية'}},
24706    {path:'/terms',component:TermsPage,meta:{title:'شروط الاستخدام'}},
24707    {path:'/contact',component:ContactPage,meta:{title:'التواصل'}},
24708    {path:'/complete',component:CompleteProfilePage,meta:{requiresMember:true,title:'إكمال البيانات'}},
24709    {path:'/admin/login',component:LoginPage},
24710    {path:'/admin',component:DashboardPage},
24711    {path:'/admin/visitors',component:AdminVisitorAnalyticsPage,meta:{title:'الزوار والإحصائيات'}},
24712    {path:'/admin/daily-utility',component:AdminDailyUtilityPage,meta:{title:'تشغيل SMT China اليومي'}},
24713    {path:'/admin/search',component:AdminUniversalSearchPage},
24714    {path:'/admin/notifications',component:NotificationsPage},
24715    {path:'/admin/task/:id',component:AdminTaskWorkspacePage,meta:{title:'مساحة المهمة'}},
24716    {path:'/admin/register',component:RegisterPage},
24717    {path:'/admin/members',component:MembersPage},
24718    {path:'/admin/supervisors',component:AdminSupervisorsPage},
24719    {path:'/admin/committees',component:AdminCommitteesPage},
24720    {path:'/admin/communities',component:AdminCommunitiesPage},
24721    {path:'/admin/city-hubs',component:AdminCityHubsPage,meta:{title:'مراكز المدن'}},
24722    {path:'/admin/country-communities',component:AdminCountryCommunitiesPage,meta:{title:'جاليات الدول'}},
24723    {path:'/admin/city-coverage',component:AdminCityCoveragePage,meta:{title:'تغطية المدن'}},
24724    {path:'/admin/taxonomy',component:AdminTaxonomyPage,meta:{title:'التصنيفات والدول والمسارات'}},
24725    {path:'/admin/ai-efficiency',component:AdminAiEfficiencyPage,meta:{title:'كفاءة محرك AI'}},
24726    {path:'/admin/demo',component:AdminDemoPage},
24727    {path:'/admin/account',component:AdminAccountPage},
24728    {path:'/admin/member/:id',component:MemberDetailPage},
24729    {path:'/admin/arrivals',component:AdminCasesPage,props:{mode:'arrival'}},
24730    {path:'/admin/arrivals/:id',component:AdminCasesPage,props:{mode:'arrival'},meta:{title:'مساحة حالة وصول'}},
24731    {path:'/admin/help',component:AdminCasesPage,props:{mode:'help'}},
24732    {path:'/admin/help/:id',component:AdminCasesPage,props:{mode:'help'},meta:{title:'مساحة طلب مساعدة'}},
24733    {path:'/admin/emergency',component:AdminEmergencyPage},
24734    {path:'/admin/emergency/:id',component:AdminEmergencyPage,meta:{title:'مساحة بلاغ طوارئ'}},
24735    {path:'/admin/events',component:AdminEventsPage},
24736    {path:'/admin/events/:id',component:AdminEventsPage,meta:{title:'مساحة الفعالية'}},
24737    {path:'/admin/event/:id/album',component:AdminEventAlbumPage},
24738    {path:'/admin/media',component:AdminMediaLibraryPage},
24739    {path:'/admin/announcements',component:AdminAnnouncementsPage},
24740    {path:'/admin/announcements/:id',component:AdminAnnouncementsPage,meta:{title:'مسا
24740حة إعلان'}},
24741    {path:'/admin/content-intake',component:AdminContentIntakePage,meta:{title:'المحتوى الذكي'}},{path:'/admin/content-intake/:id',component:AdminContentIntakePage,meta:{title:'مراجعة مسودة AI'}},
24742    {path:'/admin/wallet',component:AdminWalletPage,meta:{title:'محفظة SMT'}},{path:'/admin/wallet/:id',component:AdminWalletPage,meta:{title:'سجل المحفظة'}},
24743    {path:'/admin/participation-points',component:AdminParticipationPointsPage,meta:{title:'نقاط المشاركة'}},{path:'/admin/participation-points/:id',component:AdminParticipationPointsPage,meta:{title:'سجل نقاط المشاركة'}},{path:'/admin/community-points',redirect:'/admin/participation-points'},{path:'/admin/community-points/:id',redirect:to=>'/admin/participation-points/'+encodeURIComponent(to.params.id)},
24744    {path:'/admin/orders',component:AdminOrdersPage},
24745    {path:'/admin/orders/:id',component:AdminOrdersPage,meta:{title:'مساحة طلب العميل'}},
24746    {path:'/admin/procurement',component:AdminProcurementPage},
24747    {path:'/admin/procurement/:id',component:AdminProcurementPage,meta:{title:'مساحة طلب التوريد'}},
24748    {path:'/admin/official-accounts',component:AdminOfficialAccountsPage},
24749    {path:'/admin/whatsapp',component:AdminWhatsappPage},
24750    {path:'/admin/whatsapp-settings',component:AdminWhatsappPage,meta:{title:'إعدادات واتساب التقنية'}},
24751    {path:'/admin/workflows',component:AdminWorkflowPage},
24752    {path:'/admin/audit',component:AdminAuditPage},
24753    {path:'/admin/system',component:AdminSystemPage},
24754    {path:'/admin/seo',component:AdminSeoPage},
24755    {path:'/admin/health',component:AdminHealthPage},
24756    {path:'/admin/backup-settings',component:AdminBackupSettingsPage,meta:{title:'النسخ الخارجية والتعافي'}},
24757    {path:'/admin/releases',component:AdminReleasePage},
24758    {path:'/admin/pwa',component:AdminPwaPage},
24759    {path:'/admin/platform',component:AdminPlatformBrandingPage},
24760    {path:'/admin/brand-assets',component:AdminBrandAssetsPage,meta:{title:'أصول الهوية البصرية'}},
24761    {path:'/admin/options',component:AdminOptionsPage},
24762    {path:'/admin/community',component:AdminCommunityPage},
24763    {path:'/admin/feedback',component:AdminFeedbackPage},
24764    {path:'/admin/engineering-advisor',component:AdminEngineeringAdvisorPage,meta:{title:'المستشار الهندسي AI'}},
24765    {path:'/admin/ai-research',component:AdminAiResearchPage,meta:{title:'إدارة محتوى AI'}},
24766    {path:'/admin/ai-operations',component:AdminAiResearchPage,meta:{title:'تشغيل وإعدادات AI'}},
24767    {path:'/admin/china-guide',component:AdminChinaGuidePage},{path:'/admin/sudan-digital',component:AdminChinaGuidePage},{path:'/admin/trade-shipping',component:AdminChinaGuidePage},
24768    {path:'/admin/:pathMatch(.*)*',component:AdminNotFoundPage},
24769    {path:'/:pathMatch(.*)*',redirect:'/'}
24770  ];
24771  const router=createRouter({history:createWebHistory('/'),routes,scrollBehavior(){return {top:0}}});
24772  const PROFILE_COMPLETE_ONLY_ALLOWED=new Set(['/complete','/admin/login','/official/login']);
24773  function isProfileCompletionBypassPath(path){return PROFILE_COMPLETE_ONLY_ALLOWED.has(String(path||''));}
24774  let __routeInteractionToken=0;let __routePerfStarted=0;
24775  router.beforeEach(async(to,from,next)=>{
24776    if(String(to.fullPath||'')!==String(from.fullPath||'')){__routePerfStarted=performance&&performance.now?performance.now():Date.now();finishGlobalInteraction(__routeInteractionToken);__routeInteractionToken=beginGlobalInteraction('جاري فتح الصفحة...','navigation');}
24777    try{
24778      const store=useGzcStore();
24779      const me=await store.loadMe();
24780      const m=me&&me.authenticated&&me.member?me.member:null;
24781      if(String(to.path||'').startsWith('/admin')&&to.path!=='/admin/login'){
24782        if(!me||!me.authenticated||!me.admin)return next('/admin/login');
24783        if(!adminCanPath(me.admin,to.path)){
24784          store.state.msg='هذا القسم غير متاح ضمن صلاحيات حسابك الإداري.';
24785          return next('/admin');
24786        }
24787      }
24788      if(to.meta&&to.meta.requiresMember&&!m){
24789        const target=safeMemberNext(to.fullPath||to.path,'/account');
24790        try{sessionStorage.setItem('gzc_vue_next',target);}catch(e){}
24791        store.state.msg=to.path==='/emergency'?'سجّل الدخول أولاً لفتح بلاغ الطوارئ، وبعد التحقق سنعيدك لهذه الصفحة.':'تسجيل الدخول مطلوب لفتح هذه الصفحة.';
24792        return next({path:'/login',query:{next:target}});
24793      }
24794      if(m && profileNeedsCompletion(m) && !isProfileCompletionBypassPath(to.path)){
24795        if(to.path!=='/complete'){
24796          store.state.msg='أكمل بياناتك أولاً. لا يمكن فتح أي صفحة أخرى قبل إكمال التسجيل.';
24797          return next({path:'/complete',query:{locked:'profile',from:to.fullPath}});
24798        }
24799      }
24800    }catch(e){
24801      if(to.meta&&to.meta.requiresMember){
24802        const target=safeMemberNext(to.fullPath||to.path,'/account');
24803        try{sessionStorage.setItem('gzc_vue_next',target);}catch(_){}
24804        return next({path:'/login',query:{next:target}});
24805      }
24806    }
24807    next();
24808  });
24809  function visitorAttributionPayload(){try{const key='gzc_visit_attribution_v2';let row=null;try{row=JSON.parse(sessionStorage.getItem(key)||'null')}catch(_){}if(!row){let referrer_host='';try{referrer_host=document.referrer?new URL(document.referrer).hostname:''}catch(_){}const qs=new URLSearchParams(location.search||'');const clean=v=>String(v||'').replace(/[^A-Za-z0-9._+:-]/g,'').slice(0,80);row={referrer_host:String(referrer_host||'').toLowerCase().replace(/^www\./,'').slice(0,120),utm_source:clean(qs.get('utm_source')),utm_medium:clean(qs.get('utm_medium'))};try{sessionStorage.setItem(key,JSON.stringify(row))}catch(_){}}return row||{};}catch(_){return{}}}
24810  function trackRouteVisit(path){try{fetch('/api/visitor/track',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({page:String(path||'/').split('?')[0],...visitorAttributionPayload()}),credentials:'same-origin',keepalive:true}).catch(()=>{});}catch(e){}}
24811  router.afterEach(to=>{finishGlobalInteraction(__routeInteractionToken);__routeInteractionToken=0;try{const seoMarker=document.querySelector('meta[name="gzc-seo-path"]');const serverPath=seoMarker&&seoMarker.getAttribute('content');if(seoMarker&&serverPath===String(to.path||'/'))seoMarker.remove();else document.title=((to.meta&&to.meta.title)||'منصة SMT')+' | SMT China';}catch(e){} trackRouteVisit(to&&to.path);try{if(__routePerfStarted){const now=performance&&performance.now?performance.now():Date.now();const ms=Math.max(0,Number(now-__routePerfStarted));__routePerfStarted=0;sendFrontendPerformanceTelemetry([{metric:'route_transition_ms',value_ms:ms}],safeRoutePattern(to));}}catch(_){__routePerfStarted=0;}});
24812  router.onError(()=>{finishGlobalInteraction(__routeInteractionToken);__routeInteractionToken=0;});
24813  const App={
24814    setup(){
24815      const store=useGzcStore();
24816      const route=useRoute();
24817      const online=ref(navigator.onLine);
24818      function syncViewportMode(){try{document.body.classList.toggle('adminDesktop',String(route.path||'').startsWith('/admin') && window.matchMedia('(min-width:1024px)').matches);document.body.classList.toggle('mobileMode',window.matchMedia('(max-width:767px)').matches);}catch(e){}}
24819      function syncOnline(){online.value=navigator.onLine;}
24820      onMounted(()=>{store.loadPublicOptions&&store.loadPublicOptions();syncViewportMode();syncOnline();setupInitialFrontendPerformanceTelemetry(route);window.addEventListener('resize',syncViewportMode);window.addEventListener('online',syncOnline);window.addEventListener('offline',syncOnline);setTimeout(syncCollapsibleSections,80);setInterval(()=>{const m=store.state.me&&store.state.me.member;if(m&&m.is_demo_member)api('/api/demo-member/touch',{method:'POST',feedback:false}).catch(()=>{});},60000);});
24821      onUnmounted(()=>{window.removeEventListener('resize',syncViewportMode);window.removeEventListener('online',syncOnline);window.removeEventListener('offline',syncOnline);});
24822      watch(()=>route.fullPath,()=>{syncViewportMode();setTimeout(syncCollapsibleSections,80);});
24823      watch(()=>store.state.msg,(v)=>{if(v) setTimeout(()=>{if(store.state.msg===v) store.state.msg='';},4500);});
24824      const isAdminRoute=computed(()=>String(route.path||'').startsWith('/admin'));
24825      return {store,online,VERSION,isAdminRoute};
24826    },
24827    render:(function(){
24828const _Vue = Vue
24829const { createVNode: _createVNode, createElementVNode: _createElementVNode, createCommentVNode: _createCommentVNode, createTextVNode: _createTextVNode } = _Vue
24830
24831const _hoisted_1 = {
24832  key: 0,
24833  class: "offlineBanner",
24834  role: "status"
24835}
24836const _hoisted_2 = {
24837  key: 1,
24838  class: "globalInteractionFeedback",
24839  role: "status",
24840  "aria-live": "polite"
24841}
24842const _hoisted_3 = { class: "globalInteractionPill" }
24843const _hoisted_4 = {
24844  key: 2,
24845  class: "busy"
24846}
24847const _hoisted_5 = {
24848  key: 3,
24849  class: "globalUploadProgress",
24850  role: "status",
24851  "aria-live": "polite"
24852}
24853const _hoisted_6 = { class: "globalUploadHead" }
24854const _hoisted_7 = { class: "globalUploadTrack" }
24855const _hoisted_8 = {
24856  key: 4,
24857  class: "toast"
24858}
24859const _hoisted_9 = {
24860  key: 5,
24861  class: "version"
24862}
24863
24864return function render(_ctx, _cache) {
24865  with (_ctx) {
24866    const { openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode, createElementVNode: _createElementVNode, toDisplayString: _toDisplayString, normalizeClass: _normalizeClass, normalizeStyle: _normalizeStyle, resolveComponent: _resolveComponent, createVNode: _createVNode, createTextVNode: _createTextVNode } = _Vue
24867
24868    const _component_router_view = _resolveComponent("router-view")
24869
24870    return (_openBlock(), _createElementBlock("main", { class: _normalizeClass(["app vue-shell", {adminApp:isAdminRoute}]) }, [
24871      (!online)
24872        ? (_openBlock(), _createElementBlock("div", _hoisted_1, "أنت غير متصل بالإنترنت. يمكنك تصفح الصفحات المحفوظة، لكن الإرسال والتحديث يحتاجان اتصالاً."))
24873        : _createCommentVNode("", true),
24874      (store.state.interaction&&store.state.interaction.active&&!(store.state.upload&&store.state.upload.active))
24875        ? (_openBlock(), _createElementBlock("div", _hoisted_2, [_cache[1] || (_cache[1] = _createElementVNode("div", { class: "globalInteractionTopBar" }, [_createElementVNode("i")], -1)), _createElementVNode("div", _hoisted_3, [_cache[0] || (_cache[0] = _createElementVNode("span", {
24876            class: "globalInteractionSpinner",
24877            "aria-hidden": "true"
24878          }, null, -1)), _createElementVNode("b", null, _toDisplayString(store.state.interaction.label||'جاري التنفيذ...'), 1)])]))
24879        : _createCommentVNode("", true),
24880      (store.state.busy&&!(store.state.interaction&&store.state.interaction.active)&&!(store.state.upload&&store.state.upload.active))
24881        ? (_openBlock(), _createElementBlock("div", _hoisted_4, "جاري التحميل..."))
24882        : _createCommentVNode("", true),
24883      (store.state.upload&&store.state.upload.active)
24884        ? (_openBlock(), _createElementBlock("div", _hoisted_5, [_createElementVNode("div", _hoisted_6, [_createElementVNode("span", null, _toDisplayString(store.state.upload.label||'جاري الرفع...'), 1), _createElementVNode("b", null, _toDisplayString(store.state.upload.progress>=0?store.state.upload.progress+'%':'...'), 1)]), _createElementVNode("div", _hoisted_7, [_createElementVNode("i", {
24885            class: _normalizeClass({indeterminate:store.state.upload.progress<0}),
24886            style: _normalizeStyle(store.state.upload.progress>=0?{width:store.state.upload.progress+'%'}:{})
24887          }, null, 6)])]))
24888        : _createCommentVNode("", true),
24889      (store.state.msg)
24890        ? (_openBlock(), _createElementBlock("div", _hoisted_8, _toDisplayString(store.state.msg), 1))
24891        : _createCommentVNode("", true),
24892      _createVNode(_component_router_view),
24893      (store.state.me&&store.state.me.admin)
24894        ? (_openBlock(), _createElementBlock("div", _hoisted_9, [_cache[2] || (_cache[2] = _createTextVNode("SMT v")), _createElementVNode("b", null, _toDisplayString(VERSION), 1)]))
24895        : _createCommentVNode("", true),
24896      _cache[3] || (_cache[3] = _createElementVNode("div", { class: "footerGap" }, null, -1))
24897    ], 2))
24898  }
24899}
24900})()
24901  };
24902  function runtimeErrorMessage(err){try{return String(err&&err.message||err&&err.reason&&err.reason.message||err||'خطأ غير معروف').slice(0,300);}catch(_){return 'خطأ غير معروف';}}
24903  function recordClientRuntimeError(kind,err,info){
24904    try{
24905      const row={at:new Date().toISOString(),route:String(location.pathname||''),kind:String(kind||'runtime'),info:String(info||''),message:runtimeErrorMessage(err)};
24906      console.error('GZC runtime error',row,err||'');
24907      const key='gzc_runtime_errors';const rows=JSON.parse(sessionStorage.getItem(key)||'[]');rows.push(row);sessionStorage.setItem(key,JSON.stringify(rows.slice(-20)));
24908      if(__gzcStore&&__gzcStore.state)__gzcStore.state.msg='حدث خطأ غير متوقع في هذا الإجراء. الصفحة ما زالت آمنة؛ أعد المحاولة.';
24909    }catch(_){ }
24910  }
24911  function renderAdminFatalError(err,info){
24912    try{
24913      if(!String(location.pathname||'').startsWith('/admin'))return;
24914      recordClientRuntimeError('vue-fatal',err,info);
24915      var el=document.getElementById('app');if(!el)return;
24916      var retry=String(location.pathname||'/admin')+String(location.search||'');
24917      el.innerHTML='<main class="app vue-shell"><div class="card errorCard"><h3>تعذر عرض هذه الصفحة</h3><p>حدثت مشكلة أثناء فتح الصفحة.</p><p class="hint">أعد المحاولة، وإذا استمرت المشكلة تواصل مع الدعم.</p><a class="btn secondary" href="/">الرئيسية</a><a class="btn secondary" href="'+retry.replace(/&/g,'&amp;').replace(/"/g,'&quot;').replace(/</g,'&lt;').replace(/>/g,'&gt;')+'">إعادة المحاولة</a></div></main>';
24918    }catch(_){ }
24919  }
24920  const LOCAL_MEDIA_FALLBACK='/brand/smt-gold-v1/smt-icon-192.png?v='+VERSION;
24921  function resourceTag(e){try{const t=e&&e.target;return t&&Number(t.nodeType)===1?String(t.tagName||'').toUpperCase():'';}catch(_){return '';}}
24922  function isResourceLoadErrorEvent(e){return ['IMG','VIDEO','AUDIO','SOURCE','LINK','SCRIPT','IFRAME'].includes(resourceTag(e));}
24923  function isMediaResourceLoadErrorEvent(e){return ['IMG','VIDEO','AUDIO','SOURCE'].includes(resourceTag(e));}
24924  function applyLocalMediaFallback(e){
24925    try{
24926      const t=e&&e.target,tag=resourceTag(e);if(!t||!isMediaResourceLoadErrorEvent(e))return false;
24927      if(t.dataset&&t.dataset.gzcFallbackApplied==='1')return true;
24928      if(t.dataset)t.dataset.gzcFallbackApplied='1';
24929      if(t.classList)t.classList.add('gzcResourceFallback');
24930      if(tag==='IMG'){t.removeAttribute&&t.removeAttribute('srcset');t.src=LOCAL_MEDIA_FALLBACK;t.alt=t.alt||'تعذر تحميل الصورة';}
24931      else if(tag==='VIDEO'){t.poster=LOCAL_MEDIA_FALLBACK;t.setAttribute&&t.setAttribute('data-resource-error','1');}
24932      else if(tag==='AUDIO'){t.setAttribute&&t.setAttribute('data-resource-error','1');}
24933      else if(tag==='SOURCE'){const p=t.parentElement;if(p&&String(p.tagName||'').toUpperCase()==='VIDEO')p.poster=LOCAL_MEDIA_FALLBACK;if(p&&p.setAttribute)p.setAttribute('data-resource-error','1');}
24934      return true;
24935    }catch(_){return false;}
24936  }
24937  function recordResourceLoadError(e){
24938    try{
24939      const tag=resourceTag(e),t=e&&e.target;
24940      const row={at:new Date().toISOString(),route:String(location.pathname||''),kind:'resource',info:tag,message:'resource load failed'};
24941      console.warn('GZC non-fatal resource/browser error',tag,t&&t.currentSrc||t&&t.src||'');
24942      const key='gzc_resource_errors';const rows=JSON.parse(sessionStorage.getItem(key)||'[]');rows.push(row);sessionStorage.setItem(key,JSON.stringify(rows.slice(-30)));
24943    }catch(_){ }
24944  }
24945  function isIgnorableWindowError(e){
24946    if(isResourceLoadErrorEvent(e))return true;
24947    const msg=String(e&&e.message||'');
24948    if(/ResizeObserver loop/i.test(msg))return true;
24949    return /Script error\.?$/i.test(msg);
24950  }
24951  function isFatalVuePhase(info){
24952    const phase=String(info||'').toLowerCase();
24953    return /render function|setup function|component update|scheduler flush|template ref function/.test(phase);
24954  }
24955  window.addEventListener('error',function(e){
24956    try{
24957      if(isIgnorableWindowError(e)){
24958        if(isResourceLoadErrorEvent(e)){if(isMediaResourceLoadErrorEvent(e))applyLocalMediaFallback(e);recordResourceLoadError(e);}
24959        return;
24960      }
24961      recordClientRuntimeError('window',e&&e.error||e&&e.message||e,'window.error');
24962    }catch(_){ }
24963  },true);
24964  window.addEventListener('unhandledrejection',function(e){try{recordClientRuntimeError('promise',e&&e.reason||e,'unhandledrejection');}catch(_){ }},true);
24965  const app=createApp(App);
24966  app.config.errorHandler=function(err,vm,info){try{if(isFatalVuePhase(info))renderAdminFatalError(err,info);else recordClientRuntimeError('vue',err,info);}catch(_){} };
24967  app.config.globalProperties.$memberPhoto=memberPhoto;
24968  app.config.globalProperties.$cityList=cityList;
24969  app.config.globalProperties.$cityLabel=cityLabel;
24970  app.config.globalProperties.$countryList=countryList;
24971  app.config.globalProperties.$districtList=districtList;
24972  app.config.globalProperties.$sudanCityList=sudanCityList;
24973  app.config.globalProperties.$professionList=professionList;
24974  app.config.globalProperties.$optionList=optionList;
24975  app.use(window.__GZC_PINIA); app.use(router);
24975 app.component('AdminFrame',AdminFrame);
24976  assertRuntimeRelease().then(function(reloading){if(!reloading)app.mount('#app');}).catch(function(){app.mount('#app');});
24977})();

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.