import{c as ee,r as z,d as J,j as e,i as _e,b as Ce,F as le,T as S,R as X,k as de,g as Q,C as A,l as ze,D as Se,m as je,n as Ae,W as F,a as he,S as T,e as pe,A as Te,o as Z,h as Re,p as me,q as ue}from"./index-D6TYVxCk.js";/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ee=ee("Battery",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pe=ee("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const De=ee("LifeBuoy",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]),L=l=>Array.isArray(l)?l:[],xe=()=>{var l,f;return((f=(l=globalThis.crypto)==null?void 0:l.randomUUID)==null?void 0:f.call(l))||`mock-${Date.now()}-${Math.random().toString(36).slice(2)}`},Oe=[{id:"rising_heat",icon:Ae,en:"Rising heat",ar:"ارتفاع الحرارة",enDetail:"Review protective changes",arDetail:"راجع إجراءات الحماية"},{id:"cooling_loss",icon:je,en:"Cooling loss",ar:"انخفاض التبريد",enDetail:"10 cooling places remain",arDetail:"تبقى ١٠ أماكن للتبريد"},{id:"sensor_dropout",icon:F,en:"Sensor dropout",ar:"انقطاع المستشعر",enDetail:"Station link unavailable",arDetail:"اتصال المحطة غير متاح"},{id:"recovery",icon:X,en:"Restore readings",ar:"استعادة القراءات",enDetail:"Fresh data; confirm the hold",arDetail:"بيانات جديدة؛ راجع التعليق"}],qe=[{id:"stale_packet",en:"Stale reading",ar:"قراءة قديمة"},{id:"invalid_packet",en:"Invalid reading",ar:"قراءة غير صالحة"},{id:"severe",en:"Severe conditions",ar:"ظروف شديدة"},{id:"baseline",en:"Baseline reading",ar:"قراءة أساسية"}],Ie={fresh:["Fresh mock reading","قراءة محاكاة جديدة"],disconnected:["Station disconnected","المحطة غير متصلة"],stale:["Stale mock reading","قراءة محاكاة قديمة"],invalid:["Reading rejected","رُفضت القراءة"],monitor:["Prepare protective controls","جهّز إجراءات الحماية"],action:["Protective changes required","يلزم تعديل إجراءات الحماية"],pause:["Pause affected work and escalate","أوقف العمل المتأثر وصعّد الأمر"],unknown:["Conditions unconfirmed","الظروف غير مؤكدة"],pending:["Pending — not delivered","قيد الانتظار — لم يُسلّم"],delivered:["Recorded in the lab","سُجّل في المختبر"],received:["Recorded in the lab","سُجّل في المختبر"],not_sent:["Not sent","لم يُرسل"],superseded:["Outdated — not delivered","قديم — لم يُسلّم"],retime:["Retime outdoor work","إعادة توقيت العمل الخارجي"],rotation:["Stagger work and cooling","توزيع أوقات العمل والتبريد"],session_started:["Mock session started","بدأت جلسة المحاكاة"],scenario_step:["Conditions changed","تغيرت الظروف"],plans_compared:["Plans compared","قورنت الخطط"],plan_approved:["Plan approved","اعتمدت الخطة"],worker_acknowledge:["Worker acknowledgement","تأكيد العامل"],worker_help:["Mock assistance request","طلب مساعدة محاكاة"],acknowledgement_sync:["Queued acknowledgement synced","زُومن التأكيد المنتظر"],acknowledgement_superseded:["Outdated acknowledgement withheld","حُجب التأكيد القديم"],approved:["Approved in the lab","معتمدة في المختبر"],online:["Mock phone connected","هاتف المحاكاة متصل"],offline:["Mock phone disconnected","هاتف المحاكاة غير متصل"],simulated:["Simulated lab record","سجل محاكاة في المختبر"],feasible:["Feasible under demo constraints","قابلة للتنفيذ وفق قيود العرض"],optimal:["Feasible under demo constraints","قابلة للتنفيذ وفق قيود العرض"],infeasible:["No feasible work plan","لا توجد خطة عمل قابلة للتنفيذ"],unavailable:["Conditions require verification","تتطلب الظروف التحقق"],timeout:["Search incomplete","البحث غير مكتمل"],scenario:["Conditions changed","تغيرت الظروف"],step:["Conditions changed","تغيرت الظروف"],acknowledge:["Worker acknowledgement","تأكيد العامل"],help:["Mock assistance request","طلب مساعدة محاكاة"],approve:["Plan approved","اعتمدت الخطة"],approval:["Plan approved","اعتمدت الخطة"],compare:["Plans compared","قورنت الخطط"],comparison:["Plans compared","قورنت الخطط"],recovery:["Recovery confirmed","أُكدت الاستعادة"],recovery_confirmed:["Recovery confirmed","أُكدت الاستعادة"],phone_connection:["Phone connection changed","تغير اتصال الهاتف"],started:["Mock session started","بدأت جلسة المحاكاة"],reset:["New mock session","جلسة محاكاة جديدة"]};function Me({language:l,onBack:f}){var re,te,oe,ce;const g=l==="ar",[n,M]=z.useState(null),[t,R]=z.useState(""),[se,k]=z.useState(""),[E,$]=z.useState("baseline"),s=(i,a)=>g?a:i,p=(i,a)=>{var r;return((r=Ie[i])==null?void 0:r[g?1:0])||a||s("Lab event","حدث في المختبر")},ve={"Each crew has 10 workers; fewer than 10 cooling places cannot support a required crew break.":"يتكون كل فريق من ١٠ عمال؛ لا تكفي أقل من ١٠ أماكن تبريد لاستراحة الفريق الإلزامية.","The current protection state requires affected work to pause and escalation to the site safety lead.":"تتطلب حالة الحماية الحالية إيقاف العمل المتأثر والتصعيد إلى مسؤول سلامة الموقع.","Current conditions or recovery are unconfirmed. Pause affected work and verify locally before planning.":"لم تُؤكد الظروف الحالية أو الاستعادة. أوقف العمل المتأثر وتحقق ميدانياً قبل التخطيط.","Current conditions cannot be confirmed. Verify locally before generating a new plan.":"لا يمكن تأكيد الظروف الحالية. تحقق ميدانياً قبل إنشاء خطة جديدة.","Required breaks, crew skills, task dependencies and available cooling capacity cannot all be satisfied.":"لا يمكن تلبية متطلبات الراحة ومهارات الفرق وتسلسل المهام وسعة التبريد المتاحة معاً.","The solver did not establish feasibility within its time limit; this is not proof of infeasibility.":"لم يثبت البحث إمكانية التنفيذ خلال المهلة؛ لا يثبت ذلك استحالة التخطيط."},ke=i=>g?ve[String(i)]||"راجع تفاصيل المدخلات لمعرفة القيد الذي منع التخطيط.":String(i),d=(i,a=0)=>typeof i=="number"&&Number.isFinite(i)?new Intl.NumberFormat(g?"ar-AE":"en-GB",{maximumFractionDigits:a}).format(i):"—",P=(i,a=!1)=>typeof i!="string"||!Number.isFinite(Date.parse(i))?"—":new Intl.DateTimeFormat(g?"ar-AE":"en-GB",{timeZone:"Asia/Dubai",...a?{day:"numeric",month:"short",year:"numeric"}:{},hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(new Date(i));z.useEffect(()=>{var a;(a=document.getElementById("main-content"))==null||a.focus({preventScroll:!0}),window.scrollTo({top:0,behavior:"instant"});let i=!0;return J("/simulator").then(r=>{i&&(M(r),$(r.scenario||"baseline"),k(""))}).catch(()=>{i&&k(s("The mock lab could not load. Retry when the local service is available.","تعذر تحميل مختبر المحاكاة. حاول مجدداً عند توفر الخدمة المحلية."))}),()=>{i=!1}},[]);const h=async(i,a,r={})=>{if(!t){R(i),k("");try{const o=await J(a,{...r&&typeof r=="object"?r:{},run_id:n==null?void 0:n.run_id});M(o),$(o.scenario||"baseline")}catch(o){k(o instanceof ue&&o.status===409?s("This action no longer matches the current mock plan or protective hold. Refresh the lab and review the current instructions.","لم يعد هذا الإجراء يطابق خطة المحاكاة الحالية أو تعليق الحماية. حدّث المختبر وراجع التعليمات الحالية."):o instanceof ue&&(o.status===401||o.status===403)?s("Sign in as a supervisor or administrator to use the mock lab.","سجّل الدخول كمشرف أو مسؤول لاستخدام مختبر المحاكاة."):s("The mock action was not confirmed. Refresh the lab to check its record before retrying.","لم يُؤكد إجراء المحاكاة. حدّث المختبر للتحقق من السجل قبل المحاولة مجدداً."))}finally{R("")}}},be=async()=>{if(!t){R("refresh");try{const i=await J("/simulator");M(i),$(i.scenario||"baseline"),k("")}catch{k(s("The local lab is unavailable. No receipt can be confirmed.","المختبر المحلي غير متاح. لا يمكن تأكيد الاستلام."))}finally{R("")}}},y=(n==null?void 0:n.device)||{},H=y.quality||{},B=y.last_accepted_packet||{},u=H.status==="fresh",b=(n==null?void 0:n.protection)||{},w=!!b.recovery_confirmation_required,x=b.control_level||b.level||"unknown",c=n==null?void 0:n.comparison,ie=L(c==null?void 0:c.alternatives).slice(0,2),m=n==null?void 0:n.active_plan,N=(n==null?void 0:n.worker)||{},j=N.phone_connected!==!1,D=!!m&&m.snapshot_version===(n==null?void 0:n.snapshot_version)&&m.approved===!0,_=N.phone_view||{},C=_.snapshot_version,V=_.protection||{},v=V.control_level||V.level||"unknown",W=_.active_plan,K=!!W&&W.snapshot_version===C&&W.approved===!0,O=_.ack_current===!0,U=L(N.pending_actions).filter(i=>i.status==="pending"&&i.plan_version===C),q=L(N.help_requests).at(-1),ne=L(n==null?void 0:n.events).slice(-8).reverse(),fe=!!n,Y=!!n&&u&&!w&&x!=="pause",ae=u&&w&&((re=n==null?void 0:n.site)==null?void 0:re.scenario)==="baseline",ge=x==="pause"||x==="unknown"?"danger":x==="action"?"warning":"monitor",ye=v==="pause"||v==="unknown"?"danger":v==="action"?"warning":"monitor",we=x==="pause"||x==="unknown"?s("Pause affected work and contact the site safety lead. Verify conditions in person.","أوقف العمل المتأثر وتواصل مع مسؤول سلامة الموقع. تحقق من الظروف شخصياً."):D?s("Follow the approved crew schedule and take the assigned cooling breaks.","اتبع جدول الفريق المعتمد وخذ فترات التبريد المحددة."):s("Ask the supervisor for current approved instructions before starting.","اطلب التعليمات الحالية المعتمدة من المشرف قبل بدء العمل."),Ne=v==="pause"||v==="unknown"?s("Pause affected work and contact the site safety lead. Verify conditions in person.","أوقف العمل المتأثر وتواصل مع مسؤول سلامة الموقع. تحقق من الظروف شخصياً."):K?s("Follow the approved crew schedule and take the assigned cooling breaks.","اتبع جدول الفريق المعتمد وخذ فترات التبريد المحددة."):s("Ask the supervisor for current approved instructions before starting.","اطلب التعليمات الحالية المعتمدة من المشرف قبل بدء العمل.");return e.jsxs("div",{className:"sim-page",children:[e.jsxs("header",{className:"page-heading sim-heading",children:[e.jsxs("div",{children:[e.jsx("div",{className:"eyebrow",children:s("LOCAL MOCK DEVICE LAB","مختبر أجهزة محاكاة محلي")}),e.jsx("h1",{children:s("A field rehearsal, at your desk.","تدرّب على الاستجابة، من مكتبك.")}),e.jsx("p",{children:s("Change the conditions. Choose a protective plan. See exactly what the mock worker receives.","غيّر الظروف. اختر خطة حماية. شاهد ما يصل إلى العامل في المحاكاة.")})]}),e.jsxs("div",{className:"sim-heading-actions",children:[f&&e.jsxs("button",{className:"text-button",onClick:f,children:[e.jsx(_e,{className:"sim-back",size:17}),s("Pilot readiness","التحضير للتجربة")]}),e.jsxs("a",{className:"button secondary",href:n?"/api/simulator/report":void 0,"aria-disabled":!n,download:"HeatShield-mock-device-report.json",children:[e.jsx(Ce,{size:18}),s("Export lab record","تنزيل سجل المختبر")]})]})]}),e.jsxs("div",{className:"sim-boundary",children:[e.jsx(le,{size:23}),e.jsxs("p",{children:[e.jsx("strong",{children:s("Every device and reading here is simulated.","كل جهاز وقراءة هنا في وضع المحاكاة.")})," ",s("This lab is separate from your site plan. No real team is notified, and no physical-device or field check is completed.","هذا المختبر منفصل عن خطة الموقع. لا يُبلّغ أي فريق حقيقي، ولا تُستكمل أي فحوص أجهزة فعلية أو ميدانية.")]}),e.jsx("span",{className:"sim-badge",children:s("MOCK ONLY","محاكاة فقط")})]}),se&&e.jsxs("div",{className:"sim-error",role:"alert",children:[e.jsx(S,{size:21}),e.jsx("p",{children:se}),e.jsxs("button",{className:"button secondary small",disabled:!!t,onClick:be,children:[e.jsx(X,{size:16}),s("Refresh lab","تحديث المختبر")]})]}),n?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"sim-run-strip",children:[e.jsxs("span",{children:[e.jsx(Q,{size:16}),s("Replay clock · Abu Dhabi","وقت المحاكاة · أبوظبي")," ",e.jsx("bdi",{children:P((te=n.virtual_clock)==null?void 0:te.current_at,!0)})]}),e.jsxs("div",{children:[e.jsxs("span",{children:[s("Snapshot","نسخة الظروف")," ",e.jsx("bdi",{children:d(n.snapshot_version)})]}),e.jsxs("button",{className:"text-button",disabled:!!t,onClick:()=>h("reset","/simulator/reset"),children:[e.jsx(X,{size:15}),s("New mock session","جلسة محاكاة جديدة")]})]})]}),e.jsxs("div",{className:"sim-layout",children:[e.jsxs("div",{className:"sim-console",children:[e.jsxs("section",{className:"card sim-station","aria-labelledby":"sim-station-title",children:[e.jsxs("div",{className:"sim-section-heading",children:[e.jsx("div",{className:"sim-step-number",children:"01"}),e.jsxs("div",{children:[e.jsx("div",{className:"eyebrow",children:s("CHANGE THE CONDITIONS","غيّر الظروف")}),e.jsx("h2",{id:"sim-station-title",children:s("Environmental station","المحطة البيئية")})]}),e.jsx(de,{size:23})]}),e.jsxs("div",{className:"sim-station-meta",children:[e.jsxs("span",{children:[e.jsx("bdi",{children:y.id||"MOCK-WS-01"})," · ",s("Synthetic source","مصدر اصطناعي")]}),e.jsxs("span",{children:[e.jsx(Ee,{size:16}),d(y.battery_pct),"% ",s("mock battery","بطارية محاكاة")]})]}),e.jsxs("div",{className:`sim-quality ${u?"fresh":"fault"}`,children:[e.jsxs("span",{children:[u?e.jsx(A,{size:17}):e.jsx(S,{size:17}),p(H.status||"unknown")]}),e.jsxs("span",{children:[s("Age","العمر")," ",e.jsx("bdi",{children:d(H.age_seconds)})," ",s("sec","ث")]})]}),e.jsxs("div",{className:`sim-readings ${u?"":"historical"}`,children:[e.jsxs("div",{children:[e.jsx(ze,{size:20}),e.jsx("span",{children:s("Air temperature","حرارة الهواء")}),e.jsx("strong",{children:e.jsxs("bdi",{children:[d(B.temperature,1),e.jsx("small",{children:"°C"})]})})]}),e.jsxs("div",{children:[e.jsx(Se,{size:20}),e.jsx("span",{children:s("Humidity","الرطوبة")}),e.jsx("strong",{children:e.jsxs("bdi",{children:[d(B.humidity),e.jsx("small",{children:"%"})]})})]}),e.jsxs("div",{children:[e.jsx(je,{size:20}),e.jsx("span",{children:s("Cooling places","أماكن التبريد")}),e.jsx("strong",{children:e.jsx("bdi",{children:d((oe=n.site)==null?void 0:oe.cooling_capacity)})})]})]}),e.jsxs("p",{className:"sim-reading-note",children:[u?s("Synthetic observation","قراءة اصطناعية"):s("Last accepted reading — historical context only","آخر قراءة مقبولة — للسياق التاريخي فقط")," · ",e.jsx("bdi",{children:P(B.observed_at)})," · ",s("Not a measured workplace heat assessment","ليست تقييماً مقاساً لحرارة مكان العمل")]}),e.jsx("div",{className:"sim-scenarios","aria-label":s("Change the mock conditions","تغيير ظروف المحاكاة"),children:Oe.map(({id:i,icon:a,en:r,ar:o,enDetail:I,arDetail:G})=>e.jsxs("button",{disabled:!!t,"aria-pressed":E===i,className:`sim-scenario ${E===i?"selected":""}`,onClick:()=>h(`step:${i}`,"/simulator/step",{preset:i}),children:[e.jsx(a,{size:20}),e.jsxs("span",{children:[e.jsx("strong",{children:s(r,o)}),e.jsx("small",{children:s(I,G)})]}),E===i&&e.jsx(A,{size:16})]},i))}),e.jsxs("details",{className:"sim-detail",children:[e.jsxs("summary",{children:[e.jsx(he,{size:17}),s("More fault scenarios","سيناريوهات أعطال إضافية")]}),e.jsx("div",{className:"sim-faults",children:qe.map(i=>e.jsx("button",{className:"button secondary small",disabled:!!t,"aria-pressed":E===i.id,onClick:()=>h(`step:${i.id}`,"/simulator/step",{preset:i.id}),children:s(i.en,i.ar)},i.id))})]})]}),e.jsxs("section",{className:`sim-protection ${ge}`,"aria-live":"polite","aria-atomic":"true",children:[e.jsx("div",{className:"sim-protection-icon",children:x==="monitor"?e.jsx(T,{size:25}):e.jsx(S,{size:25})}),e.jsxs("div",{children:[e.jsx("span",{className:"eyebrow",children:s("EFFECTIVE PROTECTIVE CONTROL","إجراء الحماية الساري")}),e.jsx("h2",{children:p(b.level||"unknown")}),e.jsx("p",{children:we}),w&&e.jsxs("p",{className:"sim-hold",children:[e.jsx(Le,{}),s("Protective hold retained. Fresh readings alone cannot clear it.","يبقى تعليق الحماية سارياً. لا تكفي قراءة جديدة لإلغائه.")]}),!u&&e.jsx("p",{className:"sim-hold",children:s("Data is unconfirmed; the fallback is pause and verify. Phone connectivity is controlled separately.","البيانات غير مؤكدة؛ الإجراء البديل هو التوقف والتحقق. يُضبط اتصال الهاتف بصورة مستقلة.")}),w&&e.jsxs("button",{className:"button secondary",disabled:!!t||!ae,onClick:()=>h("recovery","/simulator/recovery"),children:[e.jsx(T,{size:18}),s("Confirm mock recovery","تأكيد الاستعادة في المحاكاة")]}),w&&!ae&&e.jsx("small",{children:s("Restore a fresh baseline reading before confirming.","استعد قراءة أساسية جديدة قبل التأكيد.")})]})]}),e.jsxs("section",{className:"card sim-planner","aria-labelledby":"sim-planner-title",children:[e.jsxs("div",{className:"sim-section-heading",children:[e.jsx("div",{className:"sim-step-number",children:"02"}),e.jsxs("div",{children:[e.jsx("div",{className:"eyebrow",children:s("CHOOSE A PROTECTIVE PLAN","اختر خطة حماية")}),e.jsx("h2",{id:"sim-planner-title",children:s("Compare practical changes","قارن التغييرات العملية")})]})]}),e.jsx("p",{className:"sim-section-description",children:s("The same scheduling rules preserve cooling capacity, breaks, skills and protective equipment.","تحافظ قيود التخطيط نفسها على سعة التبريد والراحة والمهارات ومعدات الوقاية.")}),e.jsxs("button",{className:"button sim-compare",disabled:!!t||!fe,onClick:()=>h("compare","/simulator/compare"),children:[e.jsx(pe,{size:18}),t==="compare"?s("Comparing…","جارٍ المقارنة…"):s("Compare mock plans","مقارنة خطط المحاكاة"),e.jsx(Te,{className:"sim-forward",size:17})]}),!Y&&e.jsx("p",{className:"sim-planner-block",children:s("A work plan cannot be approved while current conditions are unconfirmed or a pause is required.","لا يمكن اعتماد خطة عمل عندما تكون الظروف الحالية غير مؤكدة أو يلزم التوقف.")}),c&&e.jsx("div",{className:"sim-plan-results","aria-live":"polite",children:ie.length?e.jsx(e.Fragment,{children:ie.map((i,a)=>{const r=D&&m.id===i.id,o=i.status==="feasible"||i.status==="optimal",I=i.title==="Stagger work and cooling",G=i.title==="Retime outdoor work"?p("retime"):I?p("rotation"):s("Protective alternative","خطة حماية بديلة");return e.jsxs("article",{className:`sim-plan ${r?"approved":""}`,children:[e.jsxs("div",{className:"sim-plan-top",children:[e.jsxs("span",{children:[s("OPTION","الخيار")," ",e.jsx("bdi",{children:d(a+1)})]}),r&&e.jsxs("span",{children:[e.jsx(Z,{size:16}),s("Approved in lab","معتمدة في المختبر")]})]}),e.jsx("h3",{children:G}),e.jsx("p",{children:I?s("Stagger crew work and cooling within the available capacity.","وزّع أوقات العمل والتبريد ضمن السعة المتاحة."):i.title==="Retime outdoor work"?s("Move outdoor tasks away from hotter forecast hours.","انقل المهام الخارجية بعيداً عن الساعات الأشد حرارة المتوقعة."):s("Preserve configured breaks, cooling capacity, skills and protective equipment.","حافظ على الراحة وسعة التبريد والمهارات ومعدات الوقاية المحددة.")}),e.jsxs("div",{className:"sim-exposure",children:[e.jsx("strong",{children:e.jsx("bdi",{children:d(i.exposure_minutes)})}),e.jsx("span",{children:s("simulated exposure · worker-minutes","تعرض محاكاة · دقيقة عامل")})]}),e.jsxs("button",{className:`button ${r?"secondary":""}`,disabled:!!t||!Y||!o||D,onClick:()=>h(`approve:${i.id}`,"/simulator/approve",{plan_id:i.id,snapshot_version:n.snapshot_version}),children:[r?e.jsx(A,{size:17}):e.jsx(pe,{size:17}),r?s("Current mock plan","خطة المحاكاة الحالية"):D?s("Change conditions to replan","غيّر الظروف لإعادة التخطيط"):s("Approve this mock plan","اعتماد خطة المحاكاة")]})]},i.id)})}):e.jsxs("div",{className:"sim-no-plan",children:[e.jsx(S,{size:21}),e.jsxs("div",{children:[e.jsx("strong",{children:c.status==="timeout"?s("Search incomplete","البحث غير مكتمل"):c.status==="unavailable"?s("Conditions require verification","تتطلب الظروف التحقق"):s("Pause affected work and escalate","أوقف العمل المتأثر وصعّد الأمر")}),e.jsx("p",{children:c.status==="timeout"?s("The search did not establish a feasible plan in time. This is not proof that no plan exists.","لم يثبت البحث وجود خطة قابلة للتنفيذ في الوقت المتاح. لا يثبت ذلك استحالة التخطيط."):s("No approvable work alternative is available under the current protective controls.","لا يتوفر بديل عمل قابل للاعتماد وفق إجراءات الحماية الحالية.")}),Array.isArray(c.blocking_constraints)&&c.blocking_constraints.map((i,a)=>e.jsx("p",{className:"sim-planner-block",children:ke(i)},a))]})]})}),!c&&Y&&e.jsx("p",{className:"sim-plan-hint",children:s("Compare alternatives, then approve one to send instructions to the mock phone when connected.","قارن البدائل، ثم اعتمد إحداها لإرسال التعليمات إلى هاتف المحاكاة عند اتصاله.")})]})]}),e.jsxs("aside",{className:"sim-worker-column","aria-labelledby":"sim-worker-title",children:[e.jsxs("div",{className:"sim-worker-label",children:[e.jsx("div",{className:"sim-step-number",children:"03"}),e.jsxs("div",{children:[e.jsx("div",{className:"eyebrow",children:s("CONFIRM THE RESPONSE","تأكد من الاستجابة")}),e.jsx("h2",{id:"sim-worker-title",children:s("Worker phone","هاتف العامل")})]}),e.jsx(Re,{size:22})]}),e.jsxs("div",{className:"sim-phone",children:[e.jsx("div",{className:"sim-phone-speaker","aria-hidden":"true"}),e.jsxs("div",{className:"sim-phone-screen",children:[e.jsxs("div",{className:"sim-phone-top",children:[e.jsxs("span",{children:[e.jsx(T,{size:17}),"HeatShield"]}),e.jsxs("span",{children:[j?e.jsx(me,{size:17}):e.jsx(F,{size:17}),s("MOCK","محاكاة")]})]}),e.jsxs("div",{className:"sim-phone-identity",children:[e.jsx("span",{children:s("SYNTHETIC WORKER 01","عامل اصطناعي ٠١")}),e.jsx("h3",{children:s("Your next action.","إجراؤك التالي.")}),e.jsx("p",{children:s("Falcon crew · Abu Dhabi","فريق الصقر · أبوظبي")})]}),!j&&e.jsxs("div",{className:"sim-phone-offline",role:"status",children:[e.jsx(F,{size:18}),e.jsxs("p",{children:[e.jsx("strong",{children:s("Cached mock instructions. Current conditions are unconfirmed on this phone.","تعليمات محاكاة محفوظة. الظروف الحالية غير مؤكدة على هذا الهاتف.")})," ",s("Verify in person. Acknowledgements may wait; help requests are not sent.","تحقق شخصياً. قد تنتظر التأكيدات؛ لا تُرسل طلبات المساعدة."),e.jsxs("span",{children:[s("Last received","آخر استلام")," ",e.jsx("bdi",{children:P(_.received_at)})]})]})]}),e.jsxs("div",{className:`sim-phone-instruction ${ye}`,children:[e.jsxs("span",{children:[j?"":s("CACHED · ","محفوظة · "),p(V.level||"unknown")]}),e.jsx("p",{children:Ne}),e.jsxs("small",{children:[s("Mock version","إصدار المحاكاة")," ",e.jsx("bdi",{children:d(C)})]})]}),e.jsxs("button",{className:"button sim-ack",disabled:!!t||!K||O||U.length>0||v==="pause"||v==="unknown",onClick:()=>h("acknowledge","/simulator/action",{kind:"acknowledge",event_id:xe(),plan_version:C}),children:[O?e.jsx(Z,{size:20}):e.jsx(A,{size:20}),O?s("Acknowledgement recorded","سُجّل التأكيد"):U.length?s("Pending — not delivered","قيد الانتظار — لم يُسلّم"):s("I understand this instruction","فهمت هذه التعليمات")]}),!K&&e.jsx("p",{className:"sim-phone-hint",children:s("No approved mock plan has reached this phone.","لم تصل خطة محاكاة معتمدة إلى هذا الهاتف.")}),O&&e.jsxs("p",{className:"sim-receipt",role:"status",children:[e.jsx(Z,{size:16}),s("Lab receipt for this displayed version only. Physical action is unconfirmed.","استلام في المختبر للإصدار المعروض فقط. التنفيذ الفعلي غير مؤكد.")]}),U.length>0&&e.jsxs("p",{className:"sim-pending",role:"status",children:[e.jsx(Q,{size:17}),s("Will sync once when this mock phone reconnects, if the plan is still current.","سيُزامن مرة واحدة عند اتصال هاتف المحاكاة، إن بقيت الخطة حالية.")]}),e.jsx("div",{className:"sim-phone-divider"}),e.jsx("p",{className:"sim-fixed-guidance",children:s("If you feel unwell, stop the task and seek the site first aider. Do not wait for this app.","إذا شعرت بتوعك، أوقف المهمة واطلب مساعدة مسعف الموقع. لا تنتظر هذا التطبيق.")}),e.jsxs("button",{className:"button sim-help",disabled:!!t,onClick:()=>h("help","/simulator/action",{kind:"help",event_id:xe(),plan_version:C}),children:[e.jsx(De,{size:20}),s("Try mock help request","تجربة طلب مساعدة محاكاة")]}),q&&e.jsxs("div",{className:`sim-help-receipt ${q.status==="not_sent"?"not-sent":""}`,role:"status",children:[e.jsx("strong",{children:p(q.status)}),e.jsx("p",{children:q.status==="not_sent"?s("Not queued. Reconnecting will not send it. Use established site communications or ask for help in person.","لم يُضف إلى الانتظار، ولن يُرسل عند عودة الاتصال. استخدم وسائل اتصال الموقع المعتمدة أو اطلب المساعدة شخصياً."):s("Only the mock lab recorded this event. No real person or service was notified.","سجّل مختبر المحاكاة هذا الحدث فقط. لم يُبلّغ أي شخص أو خدمة حقيقية.")})]}),e.jsxs("div",{className:"sim-phone-footer",children:[e.jsx(le,{size:15}),s("Software preview · No real notifications","معاينة برمجية · لا توجد بلاغات حقيقية")]})]})]}),e.jsxs("div",{className:"sim-phone-controls",children:[e.jsxs("div",{children:[e.jsx("strong",{children:s("Mock phone connection","اتصال هاتف المحاكاة")}),e.jsx("p",{children:s("Independent of the station link","مستقل عن اتصال المحطة")})]}),e.jsxs("button",{className:"button secondary small",disabled:!!t,"aria-pressed":!j,onClick:()=>h("phone","/simulator/phone",{connected:!j}),children:[j?e.jsx(F,{size:17}):e.jsx(me,{size:17}),j?s("Disconnect","قطع الاتصال"):s("Reconnect","إعادة الاتصال")]})]}),e.jsx("p",{className:"sim-phone-note",children:s("This toggle simulates the worker phone only. It does not disconnect your laptop or test real network delivery.","يحاكي هذا الزر اتصال هاتف العامل فقط. لا يقطع اتصال الحاسوب ولا يختبر تسليماً فعلياً عبر الشبكة.")})]})]}),e.jsxs("section",{className:"card sim-history",children:[e.jsxs("div",{className:"card-heading",children:[e.jsxs("div",{children:[e.jsx("div",{className:"eyebrow",children:s("TRACEABLE, LAB-ONLY RECORD","سجل قابل للتتبع داخل المختبر فقط")}),e.jsxs("h2",{children:[e.jsx(Pe,{size:21}),s("What happened","ما الذي حدث")]})]}),e.jsx("span",{className:"sim-badge",children:s("SIMULATED","محاكاة")})]}),e.jsx("div",{className:"sim-events",children:ne.length?ne.map((i,a)=>{const r=["not_sent","superseded","invalid","stale","disconnected","infeasible","unavailable","timeout","offline"].includes(i.status);return e.jsxs("div",{className:"sim-event",children:[e.jsx("span",{className:`sim-event-marker ${r?"caution":""}`,children:r?e.jsx(S,{size:14}):i.status==="pending"?e.jsx(Q,{size:14}):e.jsx(A,{size:14})}),e.jsxs("div",{children:[e.jsx("strong",{children:p(i.kind)}),e.jsx("p",{children:i.status?p(i.status,s("Recorded in the mock lab","سُجّل في مختبر المحاكاة")):s("Recorded in the mock lab","سُجّل في مختبر المحاكاة")})]}),e.jsx("time",{children:e.jsx("bdi",{children:P(i.created_at)})})]},i.id||i.event_id||a)}):e.jsx("p",{className:"sim-section-description",children:s("Change a scenario to begin the lab record.","غيّر سيناريو لبدء سجل المختبر.")})}),e.jsxs("details",{className:"sim-detail",children:[e.jsxs("summary",{children:[e.jsx(he,{size:17}),s("Inspect synthetic inputs and event details","فحص المدخلات الاصطناعية وتفاصيل الأحداث")]}),e.jsx("pre",{dir:"ltr",children:JSON.stringify({scope:n.scope,run_id:n.run_id,is_simulated:n.is_simulated,field_approved:n.field_approved,snapshot_version:n.snapshot_version,policy_version:((ce=n.site)==null?void 0:ce.policy_version)||b.policy_version,virtual_clock:n.virtual_clock,device:y,protection:b,active_plan:m?{id:m.id,snapshot_version:m.snapshot_version,approved:m.approved}:null,worker:N,events:n.events},null,2)})]}),e.jsxs("p",{className:"sim-evidence-limit",children:[e.jsx(T,{size:18}),s("This proves a software rehearsal only. Real phone delivery, calibrated sensors, field conditions and qualified safety-language review remain pending.","يثبت هذا تدريباً برمجياً فقط. تبقى اختبارات تسليم الهاتف الفعلي ومعايرة المستشعرات والظروف الميدانية ومراجعة لغة السلامة المختصة معلّقة.")]})]})]}):e.jsxs("div",{className:"card sim-loading",role:"status",children:[e.jsx(de,{size:28}),e.jsx("p",{children:s("Preparing your simulated station and phone…","جارٍ إعداد المحطة والهاتف في المحاكاة…")})]})]})}function Le(){return e.jsx(T,{size:17,"aria-hidden":"true"})}export{Me as default};