bettertend/frontend/dist/assets/AssetsListView-CX_TFbT7.js

62 lines
106 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{r as k,c as Q,o as Me,b4 as Ot,_ as dt,m as st,a as j,g as $,b as u,j as Z,t as q,d as _,w as H,k as W,e as T,F as ee,ac as Dn,h as Pn,s as On,v as _n,ad as Ln,i as Ue,n as pe,Q as Fn,ae as Bn,aU as Vn,af as Mt,aQ as Tt}from"./index-BUdRbiwj.js";import{u as Un,A as he,C as zn,a as Hn,b as $n,S as Yn}from"./assets-eZiqmOvX.js";import{u as jn}from"./locations-IQR_pcEX.js";import{u as Gn,W as qn,C as Qn}from"./CustomFieldsForm-BQBEtYs0.js";import{F as Wn,a as Jn}from"./FPPageHeader-CTG2L28r.js";import{F as re}from"./FPInput-CzR_dWoe.js";import{F as ue}from"./FPSelect-C7p47Ma2.js";import{F as Kn}from"./FPStats-BGfZcDZc.js";import{F as Xn}from"./FPTable-CU8C_NYc.js";import{F as Nt}from"./FPModal-DWGF1LV8.js";import{F as et}from"./FPBadge-BKY5dPnL.js";import{F as xt}from"./FPTabs-R71V25QN.js";import{F as kt}from"./FPFileUpload-D2coSbjN.js";import{_ as Zn}from"./FormRestoreNotification-DYBlXhOP.js";import"./FPCheckbox-Bu8jNAEW.js";import"./FPCard-qHzcEQAE.js";function ea(){const e=k({}),t=k([]),o=k([]),r=k([]),n=k([]),a=k([]),c=k(!1),l=k(null),d=Q(()=>{if(!e.value.healthMetrics)return 0;const p=e.value.healthMetrics,s={availability:.3,reliability:.25,performance:.2,quality:.15,safety:.1};let m=0;return Object.entries(s).forEach(([v,D])=>{m+=(p[v]||0)*D}),Math.round(m)}),h=Q(()=>t.value.filter(p=>p.healthScore<60||p.downtime>20)),w=Q(()=>t.value.filter(p=>p.healthScore>=90).sort((p,s)=>s.healthScore-p.healthScore).slice(0,10)),V=Q(()=>{if(!n.value.length)return{};const p=n.value[n.value.length-1],s=n.value[n.value.length-2];if(!s)return{trend:"stable",change:0};const m=(p.total-s.total)/s.total*100;return{trend:m>5?"increasing":m<-5?"decreasing":"stable",change:Math.round(m*100)/100,current:p.total,previous:s.total}}),E=[{id:"availability",name:"Asset Availability",description:"Percentage of time asset is operational",unit:"%",target:95,formula:"(Uptime / Total Time) × 100"},{id:"reliability",name:"Asset Reliability",description:"Mean time between failures",unit:"hours",target:1e3,formula:"Operating Time / Number of Failures"},{id:"performance",name:"Performance Efficiency",description:"Actual vs designed performance",unit:"%",target:90,formula:"(Actual Output / Designed Output) × 100"},{id:"oee",name:"Overall Equipment Effectiveness",description:"Combined availability, performance, and quality",unit:"%",target:85,formula:"Availability × Performance × Quality"},{id:"mtbf",name:"Mean Time Between Failures",description:"Average time between breakdowns",unit:"hours",target:2e3,formula:"Total Operating Time / Number of Failures"},{id:"mttr",name:"Mean Time To Repair",description:"Average time to restore after failure",unit:"hours",target:4,formula:"Total Repair Time / Number of Repairs"}],P=[{id:"asset_performance",name:"Asset Performance Report",description:"Comprehensive performance analysis",frequency:["DAILY","WEEKLY","MONTHLY","QUARTERLY"],metrics:["availability","reliability","performance","oee"]},{id:"maintenance_summary",name:"Maintenance Summary",description:"Maintenance activities and costs",frequency:["WEEKLY","MONTHLY","QUARTERLY"],metrics:["maintenance_cost","work_orders","compliance"]},{id:"cost_analysis",name:"Cost Analysis Report",description:"Financial analysis of asset operations",frequency:["MONTHLY","QUARTERLY","ANNUAL"],metrics:["total_cost","maintenance_cost","parts_cost","labor_cost"]},{id:"compliance_audit",name:"Compliance Audit",description:"Regulatory compliance status",frequency:["MONTHLY","QUARTERLY","ANNUAL"],metrics:["inspections","certifications","violations"]},{id:"lifecycle_analysis",name:"Asset Lifecycle Analysis",description:"Asset age, depreciation, and replacement planning",frequency:["QUARTERLY","ANNUAL"],metrics:["age","depreciation","replacement_cost","eol_prediction"]}],O=async(p,s="30d")=>{try{c.value=!0,l.value=null;const[m,v,D,F,Y]=await Promise.all([analyticsRepository.getAssetAnalytics(p,s),analyticsRepository.getPerformanceMetrics(p,s),analyticsRepository.getTrendData(p,s),analyticsRepository.getComplianceData(p,s),analyticsRepository.getCostAnalysis(p,s)]);e.value=m.data||m,t.value=v.data||v,o.value=D.data||D,r.value=F.data||F,n.value=Y.data||Y}catch(m){l.value=m.message||"Failed to load asset analytics",console.error("Error loading asset analytics:",m)}finally{c.value=!1}},L=async(p,s,m,v={})=>{try{c.value=!0;const D={templateId:p,assetIds:Array.isArray(s)?s:[s],startDate:m.start,endDate:m.end,parameters:v,format:"JSON",generatedAt:new Date().toISOString()},F=await reportRepository.generate(D),Y=F.data||F;return a.value.push(Y),Y}catch(D){throw l.value=D.message||"Failed to generate report",D}finally{c.value=!1}},G=(p,s)=>{var Y,K;const m=E.find(z=>z.id===p);if(!m||!s)return null;let v=0;switch(p){case"availability":v=s.uptime&&s.totalTime?s.uptime/s.totalTime*100:0;break;case"reliability":v=s.operatingTime&&s.failures?s.operatingTime/s.failures:0;break;case"performance":v=s.actualOutput&&s.designedOutput?s.actualOutput/s.designedOutput*100:0;break;case"oee":const z=((Y=G("availability",s))==null?void 0:Y.value)||0,f=((K=G("performance",s))==null?void 0:K.value)||0,b=s.qualityRate||100;v=z/100*(f/100)*(b/100)*100;break;case"mtbf":v=s.operatingTime&&s.failures?s.operatingTime/s.failures:0;break;case"mttr":v=s.repairTime&&s.repairs?s.repairTime/s.repairs:0;break;default:v=s[p]||0}const D=m.target,F=(v-D)/D*100;return{value:Math.round(v*100)/100,target:D,variance:Math.round(F*100)/100,status:Math.abs(F)<=5?"on_target":F>0?"above_target":"below_target",trend:N(p,s)}},N=(p,s)=>{if(!s.historical||s.historical.length<2)return"stable";const v=s.historical.slice(-3).map(Y=>Y[p]||0),D=v[v.length-1]-v[0],F=v[0]*.05;return Math.abs(D)<=F?"stable":D>0?"improving":"declining"},y=p=>{const s=[];return p.availability<90&&s.push({type:"warning",category:"availability",message:"Asset availability is below target",recommendation:"Review maintenance schedule and identify recurring issues",priority:"high"}),p.mtbf<500&&s.push({type:"alert",category:"reliability",message:"Mean time between failures is critically low",recommendation:"Investigate root causes and consider preventive maintenance",priority:"critical"}),p.maintenanceCost>p.replacementThreshold*.7&&s.push({type:"info",category:"cost",message:"Maintenance costs approaching replacement threshold",recommendation:"Evaluate asset lifecycle and replacement options",priority:"medium"}),p.performance<80&&s.push({type:"warning",category:"performance",message:"Asset performance is declining",recommendation:"Schedule performance assessment and calibration",priority:"high"}),s.sort((m,v)=>{const D={critical:4,high:3,medium:2,low:1};return D[v.priority]-D[m.priority]})},R=p=>{const s={age:p.age||0,utilization:p.utilizationRate||0,maintenanceCompliance:p.maintenanceCompliance||100,performance:p.performance||100,failures:p.recentFailures||0},m={age:.2,utilization:.2,maintenanceCompliance:.3,performance:.2,failures:.1};let v=0;v+=Math.min(s.age/20,1)*m.age*100;const D=s.utilization>90||s.utilization<10?1:0;v+=D*m.utilization*100,v+=(100-s.maintenanceCompliance)*m.maintenanceCompliance,v+=(100-s.performance)*m.performance,v+=Math.min(s.failures*10,100)*m.failures;const F=Math.min(v,100);return{riskScore:Math.round(F),riskLevel:F>=80?"high":F>=60?"medium":"low",timeToFailure:F>=80?"1-3 months":F>=60?"3-6 months":"6+ months",confidence:M(s),factors:Object.entries(s).map(([Y,K])=>({name:Y,value:K,impact:m[Y]*100}))}},M=p=>{const s=Object.values(p).filter(m=>m!=null).length/Object.keys(p).length;return Math.round(s*100)},U=(p,s)=>{if(!p.length)return[];const v=[...p.map(F=>F[s]||0)].sort((F,Y)=>Y-F),D={p90:v[Math.floor(v.length*.1)],p75:v[Math.floor(v.length*.25)],p50:v[Math.floor(v.length*.5)],p25:v[Math.floor(v.length*.75)],p10:v[Math.floor(v.length*.9)]};return p.map(F=>{const Y=F[s]||0;let K="bottom";return Y>=D.p90?K="top":Y>=D.p75?K="high":Y>=D.p50?K="medium":Y>=D.p25&&(K="low"),{...F,benchmark:{value:Y,ranking:K,percentile:x(Y,v)}}})},x=(p,s)=>{const m=s.findIndex(v=>v<=p);return m===-1?100:Math.round(m/s.length*100)},S=(p,s="csv")=>{switch(s.toLowerCase()){case"csv":return C(p);case"json":return JSON.stringify(p,null,2);case"excel":return B(p);default:return JSON.stringify(p,null,2)}},C=p=>{if(!Array.isArray(p)||p.length===0)return"";const s=Object.keys(p[0]);return[s.join(","),...p.map(v=>s.map(D=>`"${v[D]||""}"`).join(","))].join(`
`)},B=p=>C(p);return{analyticsData:e,performanceMetrics:t,trendData:o,complianceData:r,costAnalysis:n,reports:a,loading:c,error:l,assetHealthScore:d,criticalAssets:h,topPerformers:w,costTrends:V,kpiDefinitions:E,reportTemplates:P,loadAssetAnalytics:O,generateReport:L,calculateKPI:G,calculateTrend:N,getAssetHealthInsights:y,predictAssetFailure:R,calculatePredictionConfidence:M,benchmarkAssets:U,calculatePercentile:x,exportReportData:S,exportToCSV:C,exportToExcel:B}}function ta(){const e=k(!1),t=k({}),o=k([]),r=k([]),n=k([]),a=k([]),c=k(null),l={FAILURE_PREDICTION:"failure_prediction",MAINTENANCE_OPTIMIZATION:"maintenance_optimization",COST_FORECASTING:"cost_forecasting",PERFORMANCE_ANALYSIS:"performance_analysis",ANOMALY_DETECTION:"anomaly_detection"},d=Q(()=>o.value.length>0),h=Q(()=>r.value.filter(x=>x.severity==="CRITICAL")),w=Q(()=>n.value.filter(x=>x.priority==="HIGH")),V=async(x,S=30)=>{try{e.value=!0,await new Promise(p=>setTimeout(p,2e3));const C={assetId:x,failureProbability:Math.random()*.3+.1,predictedFailureDate:new Date(Date.now()+Math.random()*30*24*60*60*1e3),confidence:Math.random()*.3+.7,riskFactors:[{factor:"Operating hours exceeding recommended limits",weight:.3},{factor:"Temperature anomalies detected",weight:.25},{factor:"Vibration patterns indicate wear",weight:.2},{factor:"Maintenance intervals exceeded",weight:.15},{factor:"Historical failure patterns",weight:.1}],recommendedActions:["Schedule immediate inspection","Replace critical components","Increase monitoring frequency"],timeframe:S,generatedAt:new Date},B=o.value.findIndex(p=>p.assetId===x);return B>=0?o.value[B]=C:o.value.push(C),C}catch(C){throw console.error("Failed to predict asset failure:",C),c.value="Failed to generate failure prediction",C}finally{e.value=!1}},E=async x=>{try{e.value=!0,await new Promise(C=>setTimeout(C,1500));const S=x.map(C=>({assetId:C.id,currentInterval:C.maintenanceInterval||90,optimizedInterval:Math.floor(Math.random()*30)+75,potentialSavings:Math.floor(Math.random()*5e3)+1e3,riskReduction:Math.random()*.2+.1,reasoning:["Historical performance data analysis","Similar asset benchmarking","Operating condition factors","Cost-benefit optimization"],implementationDate:new Date(Date.now()+7*24*60*60*1e3)}));return n.value.push({id:`maintenance_opt_${Date.now()}`,type:"MAINTENANCE_OPTIMIZATION",title:"Optimized Maintenance Schedules",description:"AI-recommended maintenance schedule adjustments",optimizations:S,totalSavings:S.reduce((C,B)=>C+B.potentialSavings,0),priority:"MEDIUM",confidence:.85,generatedAt:new Date}),S}catch(S){throw console.error("Failed to optimize maintenance schedule:",S),c.value="Failed to optimize maintenance schedule",S}finally{e.value=!1}},P=async x=>{try{e.value=!0,await new Promise(C=>setTimeout(C,1e3));const S=[{id:`anomaly_${Date.now()}_1`,assetId:x.id,type:"PERFORMANCE",severity:"HIGH",metric:"Operating Temperature",normalRange:"18-22°C",currentValue:"26°C",deviation:.18,detectedAt:new Date,description:"Operating temperature significantly above normal range",potentialCauses:["Cooling system malfunction","Blocked air filters","Refrigerant leak"],recommendedActions:["Inspect cooling system immediately","Check and replace air filters","Schedule refrigerant level check"]},{id:`anomaly_${Date.now()}_2`,assetId:x.id,type:"VIBRATION",severity:"MEDIUM",metric:"Vibration Level",normalRange:"0.1-0.3 mm/s",currentValue:"0.45 mm/s",deviation:.12,detectedAt:new Date,description:"Vibration levels elevated above normal operating range",potentialCauses:["Bearing wear","Misalignment","Imbalanced components"],recommendedActions:["Schedule vibration analysis","Inspect bearings and alignment","Plan preventive maintenance"]}];return r.value.push(...S),S}catch(S){throw console.error("Failed to detect anomalies:",S),c.value="Failed to detect anomalies",S}finally{e.value=!1}},O=async(x,S=365)=>{try{e.value=!0,await new Promise(p=>setTimeout(p,1500));const C=Math.random()*1e4+5e3;return{assetId:x,timeframe:S,totalForecast:C,breakdown:{maintenance:C*.6,repairs:C*.25,replacements:C*.1,energy:C*.05},monthlyTrend:Array.from({length:12},(p,s)=>({month:s+1,projected:C/12*(1+Math.random()*.2-.1),confidence:Math.random()*.2+.8})),riskFactors:[{factor:"Asset age",impact:.15},{factor:"Operating conditions",impact:.1},{factor:"Historical patterns",impact:.2},{factor:"Market trends",impact:.05}],generatedAt:new Date}}catch(C){throw console.error("Failed to forecast costs:",C),c.value="Failed to forecast costs",C}finally{e.value=!1}},L=async(x,S=[])=>{try{e.value=!0,await new Promise(p=>setTimeout(p,1200));const C={assetId:x,overallScore:Math.random()*30+70,metrics:{efficiency:Math.random()*20+80,reliability:Math.random()*25+75,availability:Math.random()*15+85,performance:Math.random()*20+80},trends:{last30Days:Math.random()*10-5,last90Days:Math.random()*15-7.5,last365Days:Math.random()*20-10},benchmarking:{industryAverage:Math.random()*20+75,peerAssets:Math.random()*25+70,bestInClass:Math.random()*15+85},insights:["Performance consistently above industry average","Slight degradation in efficiency over last quarter","Reliability metrics excellent compared to similar assets","Opportunity for improvement in energy efficiency"],recommendations:["Continue current maintenance strategy","Investigate efficiency degradation causes","Consider energy optimization upgrades","Monitor performance trends closely"],generatedAt:new Date},B=a.value.findIndex(p=>p.assetId===x);return B>=0?a.value[B]=C:a.value.push(C),C}catch(C){throw console.error("Failed to analyze performance:",C),c.value="Failed to analyze performance",C}finally{e.value=!1}},G=async x=>{try{e.value=!0,await new Promise(C=>setTimeout(C,1e3));const S=[{id:`rec_${Date.now()}_1`,type:"ENERGY_OPTIMIZATION",title:"Energy Efficiency Improvement",description:"Upgrade HVAC controls to reduce energy consumption by 15%",priority:"HIGH",estimatedSavings:12e3,implementationCost:25e3,paybackPeriod:24,affectedAssets:x.filter(C=>C.category==="HVAC").map(C=>C.id),confidence:.87,actions:["Install smart thermostats","Upgrade building automation system","Implement demand-response controls"],timeline:"3-6 months",generatedAt:new Date},{id:`rec_${Date.now()}_2`,type:"PREDICTIVE_MAINTENANCE",title:"Implement Condition-Based Monitoring",description:"Deploy IoT sensors for real-time asset monitoring",priority:"MEDIUM",estimatedSavings:8e3,implementationCost:15e3,paybackPeriod:18,affectedAssets:x.filter(C=>C.criticality==="HIGH").map(C=>C.id),confidence:.92,actions:["Install vibration sensors","Deploy temperature monitoring","Set up data analytics platform"],timeline:"2-4 months",generatedAt:new Date}];return n.value.push(...S),S}catch(S){throw console.error("Failed to generate recommendations:",S),c.value="Failed to generate recommendations",S}finally{e.value=!1}},N=x=>{let S=100;const C=x.age||0;if(S-=Math.min(C*2,20),x.lastMaintenance){const s=Math.floor((new Date-new Date(x.lastMaintenance))/864e5);S-=Math.min(s*.1,15)}return S-={OPERATIONAL:0,MAINTENANCE:10,DOWN:30,DECOMMISSIONED:100}[x.status]||0,S*={LOW:1,MEDIUM:1.1,HIGH:1.2,CRITICAL:1.3}[x.criticality]||1,Math.max(0,Math.min(100,Math.round(S)))},y=x=>{const S=N(x),C=x.age||0,B=x.criticality||"LOW";let p=0;S<50?p+=40:S<70?p+=25:S<85&&(p+=10),C>15?p+=30:C>10?p+=20:C>5&&(p+=10),p*={CRITICAL:1.5,HIGH:1.3,MEDIUM:1.1,LOW:1}[B];const m=Math.min(100,Math.round(p));return m>=70?"HIGH":m>=40?"MEDIUM":"LOW"},R=(x,S,C,B)=>{t.value[x]={accuracy:S,precision:C,recall:B,f1Score:2*(C*B)/(C+B),lastUpdated:new Date}},M=()=>{o.value=[],r.value=[],n.value=[],a.value=[],c.value=null},U=()=>({predictions:o.value,anomalies:r.value,recommendations:n.value,performanceInsights:a.value,modelMetrics:t.value,exportedAt:new Date().toISOString()});return Me(()=>{R(l.FAILURE_PREDICTION,.87,.85,.89),R(l.MAINTENANCE_OPTIMIZATION,.92,.9,.94),R(l.ANOMALY_DETECTION,.84,.88,.82),R(l.COST_FORECASTING,.79,.81,.78),R(l.PERFORMANCE_ANALYSIS,.91,.89,.93)}),{isProcessing:e,modelMetrics:t,predictions:o,anomalies:r,recommendations:n,performanceInsights:a,error:c,hasActivePredictions:d,criticalAnomalies:h,highPriorityRecommendations:w,AI_MODELS:l,predictAssetFailure:V,optimizeMaintenanceSchedule:E,detectAnomalies:P,forecastCosts:O,analyzePerformance:L,generateRecommendations:G,calculateHealthScore:N,assessRisk:y,updateModelMetrics:R,clearAnalytics:M,exportAnalytics:U}}function na(){const e=k(navigator.onLine),t=k([]),o=k(new Map),r=k(!1),n=k(null),a=k(null),c=Q(()=>t.value.length>0),l=Q(()=>r.value?"syncing":e.value?c.value?"pending":"synced":"offline"),d=Q(()=>e.value&&!r.value),h={CACHED_ASSETS:"cmms_cached_assets",PENDING_ACTIONS:"cmms_pending_actions",LAST_SYNC:"cmms_last_sync",APP_VERSION:"cmms_app_version"},w={CREATE_ASSET:"CREATE_ASSET",UPDATE_ASSET:"UPDATE_ASSET",DELETE_ASSET:"DELETE_ASSET",CREATE_WORK_ORDER:"CREATE_WORK_ORDER",UPDATE_MAINTENANCE:"UPDATE_MAINTENANCE",CONSUME_PART:"CONSUME_PART",UPDATE_VENDOR:"UPDATE_VENDOR"},V=()=>{try{const f=localStorage.getItem(h.PENDING_ACTIONS);f&&(t.value=JSON.parse(f));const b=localStorage.getItem(h.LAST_SYNC);b&&(n.value=new Date(b));const J=localStorage.getItem(h.CACHED_ASSETS);if(J){const X=JSON.parse(J);o.value=new Map(Object.entries(X))}}catch(f){console.error("Failed to initialize offline storage:",f),a.value="Failed to initialize offline storage"}},E=()=>{try{localStorage.setItem(h.PENDING_ACTIONS,JSON.stringify(t.value));const f=Object.fromEntries(o.value);localStorage.setItem(h.CACHED_ASSETS,JSON.stringify(f)),n.value&&localStorage.setItem(h.LAST_SYNC,n.value.toISOString())}catch(f){console.error("Failed to save to storage:",f),a.value="Failed to save offline data"}},P=(f,b)=>{o.value.set(`asset_${f}`,{data:b,timestamp:new Date().toISOString(),type:"asset"}),E()},O=f=>{const b=o.value.get(`asset_${f}`);if(!b)return null;const J=new Date(b.timestamp);return(new Date-J)/(1e3*60*60)>24?(o.value.delete(`asset_${f}`),E(),null):b.data},L=(f,b,J="normal")=>{const X={id:G(),type:f,data:b,timestamp:new Date().toISOString(),priority:J,retryCount:0,maxRetries:3};return J==="high"?t.value.unshift(X):t.value.push(X),E(),X.id},G=()=>`action_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,N=async()=>{if(!d.value||t.value.length===0)return{success:!0,processed:0,failed:0};r.value=!0;let f=0,b=0;try{const J=[...t.value];for(const X of J)try{await y(X);const te=t.value.findIndex(ie=>ie.id===X.id);te!==-1&&t.value.splice(te,1),f++}catch(te){if(console.error("Failed to process action:",X,te),X.retryCount++,X.retryCount>=X.maxRetries){const ie=t.value.findIndex(ae=>ae.id===X.id);ie!==-1&&t.value.splice(ie,1)}b++}n.value=new Date,E()}catch(J){console.error("Sync error:",J),a.value="Sync failed"}finally{r.value=!1}return{success:!0,processed:f,failed:b}},y=async f=>{switch(f.type){case w.CREATE_ASSET:return await R(f.data);case w.UPDATE_ASSET:return await M(f.data);case w.DELETE_ASSET:return await U(f.data);case w.CREATE_WORK_ORDER:return await x(f.data);case w.UPDATE_MAINTENANCE:return await S(f.data);case w.CONSUME_PART:return await C(f.data);case w.UPDATE_VENDOR:return await B(f.data);default:throw new Error(`Unknown action type: ${f.type}`)}},R=async f=>(await new Promise(b=>setTimeout(b,1e3)),{success:!0,id:Date.now()}),M=async f=>(await new Promise(b=>setTimeout(b,1e3)),{success:!0}),U=async f=>(await new Promise(b=>setTimeout(b,1e3)),{success:!0}),x=async f=>(await new Promise(b=>setTimeout(b,1e3)),{success:!0,id:Date.now()}),S=async f=>(await new Promise(b=>setTimeout(b,1e3)),{success:!0}),C=async f=>(await new Promise(b=>setTimeout(b,1e3)),{success:!0}),B=async f=>(await new Promise(b=>setTimeout(b,1e3)),{success:!0}),p=()=>{t.value=[],E()},s=f=>{const b=t.value.findIndex(J=>J.id===f);b!==-1&&(t.value.splice(b,1),E())},m=()=>{try{let f=0;return Object.values(h).forEach(b=>{const J=localStorage.getItem(b);J&&(f+=new Blob([J]).size)}),{used:f,usedMB:(f/(1024*1024)).toFixed(2),maxSize:5*1024*1024,percentage:(f/(5*1024*1024)*100).toFixed(1)}}catch{return{used:0,usedMB:"0",maxSize:0,percentage:"0"}}},v=()=>{o.value.clear(),Object.values(h).forEach(f=>{localStorage.removeItem(f)})},D=()=>({pendingActions:t.value,cachedData:Object.fromEntries(o.value),lastSyncTime:n.value,exportedAt:new Date().toISOString()}),F=f=>{try{return f.pendingActions&&(t.value=f.pendingActions),f.cachedData&&(o.value=new Map(Object.entries(f.cachedData))),f.lastSyncTime&&(n.value=new Date(f.lastSyncTime)),E(),!0}catch(b){return console.error("Failed to import offline data:",b),!1}},Y=()=>{e.value=!0,c.value&&setTimeout(()=>{N()},1e3)},K=()=>{e.value=!1},z=f=>{"serviceWorker"in navigator&&"sync"in window.ServiceWorkerRegistration.prototype&&navigator.serviceWorker.ready.then(b=>b.sync.register(f)).catch(b=>{console.error("Background sync registration failed:",b)})};return Me(()=>{V(),window.addEventListener("online",Y),window.addEventListener("offline",K)}),Ot(()=>{window.removeEventListener("online",Y),window.removeEventListener("offline",K)}),{isOnline:e,pendingActions:t,cachedData:o,syncInProgress:r,lastSyncTime:n,error:a,hasPendingActions:c,syncStatus:l,canSync:d,ACTION_TYPES:w,initializeOfflineStorage:V,cacheAssetData:P,getCachedAssetData:O,queueAction:L,syncPendingActions:N,clearPendingActions:p,removeAction:s,getStorageUsage:m,clearCache:v,exportOfflineData:D,importOfflineData:F,requestBackgroundSync:z}}function aa(){const e=k(!1),t=k(!1),o=k({width:0,height:0}),r=k("portrait"),n=k("desktop"),a=k(!1),c=k(null),l=k(!1),d=Q(()=>o.value.width<768),h=Q(()=>o.value.width>=768&&o.value.width<1024),w=Q(()=>o.value.width>=1024),V=Q(()=>d.value?"layout-mobile":h.value?"layout-tablet":"layout-desktop"),E=Q(()=>d.value?"grid-cols-1":h.value?"grid-cols-2":"grid-cols-3"),P=Q(()=>d.value?5:h.value?10:20),O={xs:320,sm:640,md:768,lg:1024,xl:1280,"2xl":1536},L=()=>{o.value={width:window.innerWidth,height:window.innerHeight},e.value=o.value.width<O.md,t.value=o.value.width>=O.md&&o.value.width<O.lg,e.value?n.value="mobile":t.value?n.value="tablet":n.value="desktop",r.value=o.value.width>o.value.height?"landscape":"portrait"},G=()=>{a.value="ontouchstart"in window||navigator.maxTouchPoints>0},N=()=>{L()},y=()=>{setTimeout(L,100)},R=z=>{z.preventDefault(),c.value=z},M=async()=>{if(!c.value)return!1;try{const z=await c.value.prompt();return console.log("Install prompt result:",z),z.outcome==="accepted"?(c.value=null,l.value=!0,!0):!1}catch(z){return console.error("Failed to install app:",z),!1}},U=()=>{l.value=window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone===!0},x=(z,f={})=>{if(!a.value)return;let b=0,J=0,X=0;const te=ae=>{const fe=ae.touches[0];b=fe.clientX,J=fe.clientY,X=Date.now()},ie=ae=>{var Le,we,Fe,Be,Te,Ne;const fe=ae.changedTouches[0],Pe=fe.clientX,We=fe.clientY,Oe=Date.now(),ge=Pe-b,ve=We-J,ye=Oe-X,_e=50,le=300;Math.abs(ge)>Math.abs(ve)&&Math.abs(ge)>_e&&ye<le?ge>0?(Le=f.onSwipeRight)==null||Le.call(f,ae):(we=f.onSwipeLeft)==null||we.call(f,ae):Math.abs(ve)>_e&&ye<le&&(ve>0?(Fe=f.onSwipeDown)==null||Fe.call(f,ae):(Be=f.onSwipeUp)==null||Be.call(f,ae)),Math.abs(ge)<10&&Math.abs(ve)<10&&ye<300&&((Te=f.onTap)==null||Te.call(f,ae)),ye>500&&Math.abs(ge)<10&&Math.abs(ve)<10&&((Ne=f.onLongPress)==null||Ne.call(f,ae))};return z.addEventListener("touchstart",te,{passive:!0}),z.addEventListener("touchend",ie,{passive:!0}),()=>{z.removeEventListener("touchstart",te),z.removeEventListener("touchend",ie)}},S=z=>{if(!e.value)return z;const f=z.filter(b=>b.priority==="high"||b.essential);return f.length===0?z.slice(0,3):f},C=z=>({items:z,collapsed:!0,toggle(){this.collapsed=!this.collapsed},close(){this.collapsed=!0}}),B=()=>{e.value&&(document.documentElement.style.setProperty("--animation-duration","0.2s"),document.body.classList.add("mobile-optimized"),a.value&&document.body.classList.add("touch-device"))},p=(z,f="medium")=>{const J={small:e.value?"_mobile":"_small",medium:e.value?"_mobile":"_medium",large:e.value?"_tablet":"_large"}[f]||"_medium",[X,te]=z.split(".");return`${X}${J}.${te}`},s=(z="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no")=>{let f=document.querySelector("meta[name=viewport]");f||(f=document.createElement("meta"),f.name="viewport",document.head.appendChild(f)),f.content=z},m=()=>{const z=getComputedStyle(document.documentElement);return{top:z.getPropertyValue("--safe-area-inset-top")||"0px",right:z.getPropertyValue("--safe-area-inset-right")||"0px",bottom:z.getPropertyValue("--safe-area-inset-bottom")||"0px",left:z.getPropertyValue("--safe-area-inset-left")||"0px"}},v=(z=100)=>{"vibrate"in navigator&&navigator.vibrate(z)},D=async()=>{if("wakeLock"in navigator)try{const z=await navigator.wakeLock.request("screen");return console.log("Screen wake lock acquired"),z}catch(z){console.error("Failed to acquire wake lock:",z)}return null},F=z=>{if(!e.value)return;z.querySelectorAll("input, select, textarea").forEach(b=>{(b.type==="text"||b.type==="email"||b.type==="password")&&(b.style.fontSize="16px"),b.name==="email"&&b.setAttribute("autocomplete","email"),b.type==="number"&&b.setAttribute("inputmode","numeric"),b.type==="tel"&&b.setAttribute("inputmode","tel")})},Y=()=>({cardSpacing:e.value?"space-y-3":"space-y-4",padding:e.value?"p-4":"p-6",margin:e.value?"m-2":"m-4",fontSize:e.value?"text-sm":"text-base",buttonSize:e.value?"sm":"md",modalSize:e.value?"full":"lg"}),K=()=>{var z,f;if("performance"in window){const b=performance.getEntriesByType("navigation")[0],J=performance.getEntriesByType("paint");return{loadTime:b.loadEventEnd-b.loadEventStart,domContentLoaded:b.domContentLoadedEventEnd-b.domContentLoadedEventStart,firstPaint:(z=J.find(X=>X.name==="first-paint"))==null?void 0:z.startTime,firstContentfulPaint:(f=J.find(X=>X.name==="first-contentful-paint"))==null?void 0:f.startTime}}return null};return Me(()=>{L(),G(),U(),B(),s(),window.addEventListener("resize",N),window.addEventListener("orientationchange",y),window.addEventListener("beforeinstallprompt",R),window.matchMedia("(display-mode: standalone)").addListener(f=>{l.value=f.matches})}),Ot(()=>{window.removeEventListener("resize",N),window.removeEventListener("orientationchange",y),window.removeEventListener("beforeinstallprompt",R)}),{isMobile:e,isTablet:t,screenSize:o,orientation:r,deviceType:n,touchSupport:a,installPrompt:c,isInstalled:l,isSmallScreen:d,isMediumScreen:h,isLargeScreen:w,layoutClass:V,cardGridCols:E,tablePageSize:P,breakpoints:O,updateScreenInfo:L,installApp:M,setupTouchGestures:x,optimizeTableForMobile:S,createMobileMenu:C,getResponsiveImageSrc:p,getSafeAreaInsets:m,vibrate:v,requestWakeLock:D,optimizeFormForMobile:F,getMobileLayoutConfig:Y,measurePerformance:K}}function oa(){const e=k(!1),t=k([]),o=k([]),r=k([]),n=k([]),a=k([]),c=k([]),l=k(null),d={SAFETY:"SAFETY",ENVIRONMENTAL:"ENVIRONMENTAL",ENERGY:"ENERGY",FIRE:"FIRE",ACCESSIBILITY:"ACCESSIBILITY",BUILDING_CODE:"BUILDING_CODE",INSURANCE:"INSURANCE",ISO:"ISO",OSHA:"OSHA",EPA:"EPA"},h={COMPLIANT:"COMPLIANT",NON_COMPLIANT:"NON_COMPLIANT",PENDING:"PENDING",EXPIRED:"EXPIRED",EXPIRING_SOON:"EXPIRING_SOON"},w=Q(()=>a.value.filter(s=>s.status==="OPEN")),V=Q(()=>{const s=new Date;return s.setDate(s.getDate()+30),o.value.filter(m=>new Date(m.expiryDate)<=s&&m.status==="ACTIVE")}),E=Q(()=>{if(t.value.length===0)return 0;const s=t.value.filter(m=>m.status===h.COMPLIANT).length;return Math.round(s/t.value.length*100)}),P=Q(()=>c.value.filter(s=>s.priority==="CRITICAL"&&!s.dismissed)),O=async(s=null)=>{try{e.value=!0,await new Promise(v=>setTimeout(v,1e3));const m=[{id:1,assetId:s||1,category:d.FIRE,requirement:"Fire Safety Inspection",description:"Annual fire safety system inspection and certification",status:h.COMPLIANT,lastInspection:"2024-01-15",nextInspection:"2025-01-15",inspector:"City Fire Department",certificateNumber:"FS-2024-001",notes:"All systems operational, minor recommendations implemented"},{id:2,assetId:s||1,category:d.ELEVATOR,requirement:"Elevator Safety Inspection",description:"State-mandated elevator safety inspection",status:h.EXPIRING_SOON,lastInspection:"2024-02-20",nextInspection:"2024-08-20",inspector:"State Elevator Inspector",certificateNumber:"EL-2024-045",notes:"Certificate expires soon, schedule renewal inspection"},{id:3,assetId:s||1,category:d.ENVIRONMENTAL,requirement:"EPA Refrigerant Compliance",description:"EPA Section 608 refrigerant handling compliance",status:h.NON_COMPLIANT,lastInspection:"2023-06-10",nextInspection:"2024-06-10",inspector:"EPA Certified Technician",certificateNumber:"EPA-608-2023",notes:"Refrigerant leak detected, repair required for compliance"}];t.value=s?m.filter(v=>v.assetId===s):m}catch(m){console.error("Failed to load compliance data:",m),l.value="Failed to load compliance data"}finally{e.value=!1}},L=async(s=null)=>{try{const m=[{id:1,assetId:s||1,name:"HVAC Certification",issuingBody:"ASHRAE",certificateNumber:"ASHRAE-2024-HVAC-001",issueDate:"2024-01-15",expiryDate:"2025-01-15",status:"ACTIVE",renewalRequired:!0,renewalNotificationDays:60,cost:2500,attachments:["certificate.pdf","inspection_report.pdf"]},{id:2,assetId:s||2,name:"Elevator Operating License",issuingBody:"State Department of Labor",certificateNumber:"DOL-EL-2024-789",issueDate:"2024-02-20",expiryDate:"2024-08-20",status:"EXPIRING_SOON",renewalRequired:!0,renewalNotificationDays:30,cost:1200,attachments:["license.pdf"]}];o.value=s?m.filter(v=>v.assetId===s):m}catch(m){console.error("Failed to load certifications:",m),l.value="Failed to load certifications"}},G=async(s,m)=>{try{e.value=!0,await new Promise(D=>setTimeout(D,1e3));const v=t.value.find(D=>D.id===s);return v&&(v.nextInspection=m,v.status=h.PENDING,U({type:"INSPECTION",message:`${v.requirement} scheduled for ${m}`,dueDate:m,priority:"HIGH",assetId:v.assetId})),!0}catch(v){return console.error("Failed to schedule inspection:",v),l.value="Failed to schedule inspection",!1}finally{e.value=!1}},N=async(s,m)=>{try{e.value=!0;const v=t.value.find(D=>D.id===s);return v&&(v.lastInspection=m.inspectionDate,v.status=m.passed?h.COMPLIANT:h.NON_COMPLIANT,v.inspector=m.inspector,v.notes=m.notes,m.nextInspectionDate&&(v.nextInspection=m.nextInspectionDate),m.certificateNumber&&(v.certificateNumber=m.certificateNumber),m.passed||a.value.push({id:Date.now(),complianceRecordId:s,assetId:v.assetId,category:v.category,violation:m.violations||["Inspection failed"],severity:m.severity||"MEDIUM",status:"OPEN",discoveredDate:m.inspectionDate,description:m.notes,correctiveActions:m.correctiveActions||[]})),!0}catch(v){return console.error("Failed to record inspection result:",v),l.value="Failed to record inspection result",!1}finally{e.value=!1}},y=async(s,m)=>{try{e.value=!0;const v=o.value.find(D=>D.id===s);return v&&(v.issueDate=m.issueDate,v.expiryDate=m.expiryDate,v.certificateNumber=m.certificateNumber||v.certificateNumber,v.status="ACTIVE",v.cost=m.cost||v.cost,m.attachments&&v.attachments.push(...m.attachments),c.value=c.value.filter(D=>!(D.type==="CERTIFICATION_RENEWAL"&&D.certificationId===s))),!0}catch(v){return console.error("Failed to renew certification:",v),l.value="Failed to renew certification",!1}finally{e.value=!1}},R=s=>{const m={id:Date.now(),assetId:s.assetId,category:s.category,violation:s.violation,severity:s.severity||"MEDIUM",status:"OPEN",discoveredDate:new Date().toISOString(),description:s.description||"",correctiveActions:s.correctiveActions||[],dueDate:s.dueDate,assignedTo:s.assignedTo,estimatedCost:s.estimatedCost||0};return a.value.push(m),(m.severity==="HIGH"||m.severity==="CRITICAL")&&U({type:"VIOLATION",message:`Critical compliance violation: ${m.violation}`,dueDate:m.dueDate,priority:"CRITICAL",assetId:m.assetId,violationId:m.id}),m},M=async(s,m)=>{try{const v=a.value.find(D=>D.id===s);return v&&(v.status="RESOLVED",v.resolvedDate=new Date().toISOString(),v.resolution=m.resolution,v.resolvedBy=m.resolvedBy,v.actualCost=m.actualCost,c.value=c.value.filter(D=>D.violationId!==s)),!0}catch(v){return console.error("Failed to resolve violation:",v),l.value="Failed to resolve violation",!1}},U=s=>{const m={id:Date.now(),type:s.type,message:s.message,dueDate:s.dueDate,priority:s.priority||"MEDIUM",assetId:s.assetId,dismissed:!1,createdAt:new Date().toISOString(),...s};return c.value.push(m),m},x=s=>{const m=c.value.find(v=>v.id===s);m&&(m.dismissed=!0,m.dismissedAt=new Date().toISOString())},S=async(s=[],m=null)=>{try{e.value=!0,await new Promise(F=>setTimeout(F,1500));const v=s.length>0?t.value.filter(F=>s.includes(F.assetId)):t.value,D={generatedAt:new Date().toISOString(),dateRange:m,summary:{totalRecords:v.length,compliant:v.filter(F=>F.status===h.COMPLIANT).length,nonCompliant:v.filter(F=>F.status===h.NON_COMPLIANT).length,pending:v.filter(F=>F.status===h.PENDING).length,expiring:v.filter(F=>F.status===h.EXPIRING_SOON).length},complianceScore:E.value,byCategory:{},violations:w.value,upcomingRenewals:V.value,recommendations:["Schedule immediate inspection for expired certifications","Implement preventive maintenance for critical assets","Review compliance procedures quarterly","Train staff on regulatory requirements"]};return Object.values(d).forEach(F=>{const Y=v.filter(K=>K.category===F);Y.length>0&&(D.byCategory[F]={total:Y.length,compliant:Y.filter(K=>K.status===h.COMPLIANT).length,nonCompliant:Y.filter(K=>K.status===h.NON_COMPLIANT).length,score:Math.round(Y.filter(K=>K.status===h.COMPLIANT).length/Y.length*100)})}),D}catch(v){return console.error("Failed to generate compliance report:",v),l.value="Failed to generate compliance report",null}finally{e.value=!1}},C=async()=>{try{await new Promise(m=>setTimeout(m,1e3));const s=[{regulation:"OSHA Safety Standards",category:d.SAFETY,effectiveDate:"2024-07-01",description:"Updated workplace safety requirements for industrial equipment",impact:"MEDIUM",actionRequired:"Review safety procedures and update documentation"},{regulation:"EPA Refrigerant Regulations",category:d.ENVIRONMENTAL,effectiveDate:"2024-09-01",description:"New reporting requirements for refrigerant usage",impact:"LOW",actionRequired:"Update reporting procedures"}];return n.value.push(...s),s.forEach(m=>{(m.impact==="HIGH"||m.impact==="CRITICAL")&&U({type:"REGULATORY_UPDATE",message:`New regulation: ${m.regulation}`,dueDate:m.effectiveDate,priority:m.impact==="CRITICAL"?"CRITICAL":"HIGH",regulation:m.regulation})}),s}catch(s){return console.error("Failed to check regulatory updates:",s),l.value="Failed to check regulatory updates",[]}},B=()=>({complianceRecords:t.value,certifications:o.value,violations:a.value,reminders:c.value,complianceScore:E.value,exportedAt:new Date().toISOString()}),p=()=>{const s=new Date;o.value.forEach(m=>{const v=new Date(m.expiryDate),D=Math.ceil((v-s)/(1e3*60*60*24));D<=m.renewalNotificationDays&&m.status==="ACTIVE"&&(m.status="EXPIRING_SOON",c.value.find(Y=>Y.type==="CERTIFICATION_RENEWAL"&&Y.certificationId===m.id)||U({type:"CERTIFICATION_RENEWAL",message:`${m.name} expires in ${D} days`,dueDate:m.expiryDate,priority:D<=7?"CRITICAL":"HIGH",assetId:m.assetId,certificationId:m.id}))}),t.value.forEach(m=>{m.nextInspection&&new Date(m.nextInspection)<s&&m.status!==h.NON_COMPLIANT&&(m.status=h.EXPIRED,U({type:"OVERDUE_INSPECTION",message:`${m.requirement} is overdue`,dueDate:m.nextInspection,priority:"CRITICAL",assetId:m.assetId,complianceRecordId:m.id}))})};return Me(()=>{p(),setInterval(p,60*60*1e3)}),{loading:e,complianceRecords:t,certifications:o,audits:r,regulations:n,violations:a,reminders:c,error:l,activeViolations:w,upcomingRenewals:V,complianceScore:E,criticalReminders:P,COMPLIANCE_CATEGORIES:d,COMPLIANCE_STATUS:h,loadComplianceData:O,loadCertifications:L,scheduleInspection:G,recordInspectionResult:N,renewCertification:y,createViolation:R,resolveViolation:M,createReminder:U,dismissReminder:x,generateComplianceReport:S,checkRegulatoryUpdates:C,exportComplianceData:B,performComplianceCheck:p}}const ra={class:"asset-id-generator"},sa={class:"mb-4 p-4 bg-green-50 border border-green-200 rounded-lg"},ia={class:"flex items-center justify-between"},la={class:"text-lg font-bold text-green-900 font-mono"},ca={class:"flex items-center space-x-2"},ua={key:0,class:"mb-4 p-4 bg-yellow-50 border border-yellow-200 rounded-lg"},da={class:"flex items-center space-x-3"},ma={key:1,class:"mb-4 p-4 bg-gray-50 border border-gray-200 rounded-lg"},fa={class:"grid grid-cols-1 md:grid-cols-3 gap-4"},ga={class:"mt-3 flex items-center justify-between"},va={class:"text-xs text-gray-500"},pa={class:"font-mono font-bold"},ha={class:"flex space-x-2"},ya={key:2,class:"mt-2 text-sm text-red-600"},wa={__name:"AssetIdGenerator",props:{modelValue:{type:String,default:""},disabled:{type:Boolean,default:!1},error:{type:String,default:null}},emits:["update:modelValue"],setup(e,{expose:t,emit:o}){const r=e,n=o,a=k(""),c=k(""),l=k(!1),d=k(!1),h=k(!1),w=k("AST"),V=k("TIMESTAMP"),E=k(3),P=[{value:"TIMESTAMP",label:"Timestamp"},{value:"YYYYMMDD",label:"YYYY-MM-DD"},{value:"YYMMDD",label:"YY-MM-DD"},{value:"YYYY",label:"Year Only"}],O=[{value:2,label:"2 chars"},{value:3,label:"3 chars"},{value:4,label:"4 chars"},{value:5,label:"5 chars"}],L=Q(()=>!h.value),G=Q(()=>N(w.value,V.value,E.value)),N=(p,s,m)=>{let v="";const D=new Date;switch(s){case"TIMESTAMP":v=Date.now().toString().slice(-6);break;case"YYYYMMDD":v=D.toISOString().slice(0,10).replace(/-/g,"");break;case"YYMMDD":v=D.toISOString().slice(2,10).replace(/-/g,"");break;case"YYYY":v=D.getFullYear().toString();break}const F=Math.random().toString(36).substring(2,2+m).toUpperCase();return`${p}-${v}-${F}`},y=()=>{const p=N(w.value,V.value,E.value);a.value=p,h.value=!1,n("update:modelValue",p)},R=()=>{h.value||y()},M=()=>{d.value=!d.value,d.value||(l.value=!1)},U=()=>{c.value.trim()&&(a.value=c.value.trim(),h.value=!0,l.value=!1,d.value=!1,n("update:modelValue",c.value.trim()))},x=()=>{c.value="",l.value=!1},S=()=>{},C=()=>{y(),d.value=!1},B=()=>{w.value="AST",V.value="TIMESTAMP",E.value=3};return st(()=>d.value,p=>{p&&(l.value=!0)}),st(()=>r.modelValue,p=>{p!==a.value&&(a.value=p)}),Me(()=>{r.modelValue?(a.value=r.modelValue,h.value=!0):y()}),t({generateId:y,regenerateId:R}),(p,s)=>($(),j("div",ra,[u("div",sa,[u("div",ia,[u("div",null,[s[4]||(s[4]=u("h4",{class:"text-sm font-medium text-green-900"},"Asset ID",-1)),u("p",la,q(a.value||"Auto-generated"),1)]),u("div",ca,[_(T(ee),{variant:"outline",size:"sm",onClick:R,disabled:e.disabled||!L.value},{default:H(()=>s[5]||(s[5]=[u("svg",{class:"w-4 h-4 mr-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})],-1),W(" Regenerate ",-1)])),_:1,__:[5]},8,["disabled"]),_(T(ee),{variant:"ghost",size:"sm",onClick:M},{default:H(()=>s[6]||(s[6]=[u("svg",{class:"w-4 h-4 mr-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})],-1),W(" Customize ",-1)])),_:1,__:[6]})])])]),l.value?($(),j("div",ua,[s[9]||(s[9]=u("h4",{class:"text-sm font-medium text-yellow-900 mb-2"},"Manual ID Entry",-1)),u("div",da,[_(T(re),{modelValue:c.value,"onUpdate:modelValue":s[0]||(s[0]=m=>c.value=m),placeholder:"Enter custom asset ID...",disabled:e.disabled,class:"flex-1"},null,8,["modelValue","disabled"]),_(T(ee),{onClick:U,disabled:!c.value||e.disabled},{default:H(()=>s[7]||(s[7]=[W(" Use ID ",-1)])),_:1,__:[7]},8,["disabled"]),_(T(ee),{variant:"ghost",onClick:x},{default:H(()=>s[8]||(s[8]=[W(" Cancel ",-1)])),_:1,__:[8]})]),s[10]||(s[10]=u("p",{class:"text-xs text-yellow-700 mt-2"}," Enter a custom asset ID according to your company's asset register format ",-1))])):Z("",!0),d.value?($(),j("div",ma,[s[17]||(s[17]=u("h4",{class:"text-sm font-medium text-gray-700 mb-3"},"ID Format Customization",-1)),u("div",fa,[u("div",null,[s[11]||(s[11]=u("label",{class:"block text-xs font-medium text-gray-600 mb-1"},"Prefix",-1)),_(T(re),{modelValue:w.value,"onUpdate:modelValue":s[1]||(s[1]=m=>w.value=m),placeholder:"AST",disabled:e.disabled,onInput:S},null,8,["modelValue","disabled"])]),u("div",null,[s[12]||(s[12]=u("label",{class:"block text-xs font-medium text-gray-600 mb-1"},"Date Format",-1)),_(T(ue),{modelValue:V.value,"onUpdate:modelValue":s[2]||(s[2]=m=>V.value=m),options:P,disabled:e.disabled,onChange:S},null,8,["modelValue","disabled"])]),u("div",null,[s[13]||(s[13]=u("label",{class:"block text-xs font-medium text-gray-600 mb-1"},"Suffix Length",-1)),_(T(ue),{modelValue:E.value,"onUpdate:modelValue":s[3]||(s[3]=m=>E.value=m),options:O,disabled:e.disabled,onChange:S},null,8,["modelValue","disabled"])])]),u("div",ga,[u("p",va,[s[14]||(s[14]=W(" Preview: ",-1)),u("span",pa,q(G.value),1)]),u("div",ha,[_(T(ee),{size:"sm",onClick:C},{default:H(()=>s[15]||(s[15]=[W("Apply",-1)])),_:1,__:[15]}),_(T(ee),{size:"sm",variant:"ghost",onClick:B},{default:H(()=>s[16]||(s[16]=[W("Reset",-1)])),_:1,__:[16]})])])])):Z("",!0),e.error?($(),j("div",ya,q(e.error),1)):Z("",!0)]))}},Aa=dt(wa,[["__scopeId","data-v-11fdeccb"]]);var Re={},Ca=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},_t={},oe={};let mt;const ba=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];oe.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return t*4+17};oe.getSymbolTotalCodewords=function(t){return ba[t]};oe.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t};oe.setToSJISFunction=function(t){if(typeof t!="function")throw new Error('"toSJISFunc" is not a valid function.');mt=t};oe.isKanjiModeEnabled=function(){return typeof mt<"u"};oe.toSJIS=function(t){return mt(t)};var je={};(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(o){if(typeof o!="string")throw new Error("Param is not a string");switch(o.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+o)}}e.isValid=function(r){return r&&typeof r.bit<"u"&&r.bit>=0&&r.bit<4},e.from=function(r,n){if(e.isValid(r))return r;try{return t(r)}catch{return n}}})(je);function Lt(){this.buffer=[],this.length=0}Lt.prototype={get:function(e){const t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)===1},put:function(e,t){for(let o=0;o<t;o++)this.putBit((e>>>t-o-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var Ia=Lt;function De(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}De.prototype.set=function(e,t,o,r){const n=e*this.size+t;this.data[n]=o,r&&(this.reservedBit[n]=!0)};De.prototype.get=function(e,t){return this.data[e*this.size+t]};De.prototype.xor=function(e,t,o){this.data[e*this.size+t]^=o};De.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var Ea=De,Ft={};(function(e){const t=oe.getSymbolSize;e.getRowColCoords=function(r){if(r===1)return[];const n=Math.floor(r/7)+2,a=t(r),c=a===145?26:Math.ceil((a-13)/(2*n-2))*2,l=[a-7];for(let d=1;d<n-1;d++)l[d]=l[d-1]-c;return l.push(6),l.reverse()},e.getPositions=function(r){const n=[],a=e.getRowColCoords(r),c=a.length;for(let l=0;l<c;l++)for(let d=0;d<c;d++)l===0&&d===0||l===0&&d===c-1||l===c-1&&d===0||n.push([a[l],a[d]]);return n}})(Ft);var Bt={};const Sa=oe.getSymbolSize,Rt=7;Bt.getPositions=function(t){const o=Sa(t);return[[0,0],[o-Rt,0],[0,o-Rt]]};var Vt={};(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(n){return n!=null&&n!==""&&!isNaN(n)&&n>=0&&n<=7},e.from=function(n){return e.isValid(n)?parseInt(n,10):void 0},e.getPenaltyN1=function(n){const a=n.size;let c=0,l=0,d=0,h=null,w=null;for(let V=0;V<a;V++){l=d=0,h=w=null;for(let E=0;E<a;E++){let P=n.get(V,E);P===h?l++:(l>=5&&(c+=t.N1+(l-5)),h=P,l=1),P=n.get(E,V),P===w?d++:(d>=5&&(c+=t.N1+(d-5)),w=P,d=1)}l>=5&&(c+=t.N1+(l-5)),d>=5&&(c+=t.N1+(d-5))}return c},e.getPenaltyN2=function(n){const a=n.size;let c=0;for(let l=0;l<a-1;l++)for(let d=0;d<a-1;d++){const h=n.get(l,d)+n.get(l,d+1)+n.get(l+1,d)+n.get(l+1,d+1);(h===4||h===0)&&c++}return c*t.N2},e.getPenaltyN3=function(n){const a=n.size;let c=0,l=0,d=0;for(let h=0;h<a;h++){l=d=0;for(let w=0;w<a;w++)l=l<<1&2047|n.get(h,w),w>=10&&(l===1488||l===93)&&c++,d=d<<1&2047|n.get(w,h),w>=10&&(d===1488||d===93)&&c++}return c*t.N3},e.getPenaltyN4=function(n){let a=0;const c=n.data.length;for(let d=0;d<c;d++)a+=n.data[d];return Math.abs(Math.ceil(a*100/c/5)-10)*t.N4};function o(r,n,a){switch(r){case e.Patterns.PATTERN000:return(n+a)%2===0;case e.Patterns.PATTERN001:return n%2===0;case e.Patterns.PATTERN010:return a%3===0;case e.Patterns.PATTERN011:return(n+a)%3===0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(a/3))%2===0;case e.Patterns.PATTERN101:return n*a%2+n*a%3===0;case e.Patterns.PATTERN110:return(n*a%2+n*a%3)%2===0;case e.Patterns.PATTERN111:return(n*a%3+(n+a)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}e.applyMask=function(n,a){const c=a.size;for(let l=0;l<c;l++)for(let d=0;d<c;d++)a.isReserved(d,l)||a.xor(d,l,o(n,d,l))},e.getBestMask=function(n,a){const c=Object.keys(e.Patterns).length;let l=0,d=1/0;for(let h=0;h<c;h++){a(h),e.applyMask(h,n);const w=e.getPenaltyN1(n)+e.getPenaltyN2(n)+e.getPenaltyN3(n)+e.getPenaltyN4(n);e.applyMask(h,n),w<d&&(d=w,l=h)}return l}})(Vt);var Ge={};const de=je,ze=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],He=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];Ge.getBlocksCount=function(t,o){switch(o){case de.L:return ze[(t-1)*4+0];case de.M:return ze[(t-1)*4+1];case de.Q:return ze[(t-1)*4+2];case de.H:return ze[(t-1)*4+3];default:return}};Ge.getTotalCodewordsCount=function(t,o){switch(o){case de.L:return He[(t-1)*4+0];case de.M:return He[(t-1)*4+1];case de.Q:return He[(t-1)*4+2];case de.H:return He[(t-1)*4+3];default:return}};var Ut={},qe={};const xe=new Uint8Array(512),$e=new Uint8Array(256);(function(){let t=1;for(let o=0;o<255;o++)xe[o]=t,$e[t]=o,t<<=1,t&256&&(t^=285);for(let o=255;o<512;o++)xe[o]=xe[o-255]})();qe.log=function(t){if(t<1)throw new Error("log("+t+")");return $e[t]};qe.exp=function(t){return xe[t]};qe.mul=function(t,o){return t===0||o===0?0:xe[$e[t]+$e[o]]};(function(e){const t=qe;e.mul=function(r,n){const a=new Uint8Array(r.length+n.length-1);for(let c=0;c<r.length;c++)for(let l=0;l<n.length;l++)a[c+l]^=t.mul(r[c],n[l]);return a},e.mod=function(r,n){let a=new Uint8Array(r);for(;a.length-n.length>=0;){const c=a[0];for(let d=0;d<n.length;d++)a[d]^=t.mul(n[d],c);let l=0;for(;l<a.length&&a[l]===0;)l++;a=a.slice(l)}return a},e.generateECPolynomial=function(r){let n=new Uint8Array([1]);for(let a=0;a<r;a++)n=e.mul(n,new Uint8Array([1,t.exp(a)]));return n}})(Ut);const zt=Ut;function ft(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}ft.prototype.initialize=function(t){this.degree=t,this.genPoly=zt.generateECPolynomial(this.degree)};ft.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");const o=new Uint8Array(t.length+this.degree);o.set(t);const r=zt.mod(o,this.genPoly),n=this.degree-r.length;if(n>0){const a=new Uint8Array(this.degree);return a.set(r,n),a}return r};var Ma=ft,Ht={},me={},gt={};gt.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40};var se={};const $t="[0-9]+",Ta="[A-Z $%*+\\-./:]+";let ke="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";ke=ke.replace(/u/g,"\\u");const Na="(?:(?![A-Z0-9 $%*+\\-./:]|"+ke+`)(?:.|[\r
]))+`;se.KANJI=new RegExp(ke,"g");se.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");se.BYTE=new RegExp(Na,"g");se.NUMERIC=new RegExp($t,"g");se.ALPHANUMERIC=new RegExp(Ta,"g");const xa=new RegExp("^"+ke+"$"),ka=new RegExp("^"+$t+"$"),Ra=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");se.testKanji=function(t){return xa.test(t)};se.testNumeric=function(t){return ka.test(t)};se.testAlphanumeric=function(t){return Ra.test(t)};(function(e){const t=gt,o=se;e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(a,c){if(!a.ccBits)throw new Error("Invalid mode: "+a);if(!t.isValid(c))throw new Error("Invalid version: "+c);return c>=1&&c<10?a.ccBits[0]:c<27?a.ccBits[1]:a.ccBits[2]},e.getBestModeForData=function(a){return o.testNumeric(a)?e.NUMERIC:o.testAlphanumeric(a)?e.ALPHANUMERIC:o.testKanji(a)?e.KANJI:e.BYTE},e.toString=function(a){if(a&&a.id)return a.id;throw new Error("Invalid mode")},e.isValid=function(a){return a&&a.bit&&a.ccBits};function r(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+n)}}e.from=function(a,c){if(e.isValid(a))return a;try{return r(a)}catch{return c}}})(me);(function(e){const t=oe,o=Ge,r=je,n=me,a=gt,c=7973,l=t.getBCHDigit(c);function d(E,P,O){for(let L=1;L<=40;L++)if(P<=e.getCapacity(L,O,E))return L}function h(E,P){return n.getCharCountIndicator(E,P)+4}function w(E,P){let O=0;return E.forEach(function(L){const G=h(L.mode,P);O+=G+L.getBitsLength()}),O}function V(E,P){for(let O=1;O<=40;O++)if(w(E,O)<=e.getCapacity(O,P,n.MIXED))return O}e.from=function(P,O){return a.isValid(P)?parseInt(P,10):O},e.getCapacity=function(P,O,L){if(!a.isValid(P))throw new Error("Invalid QR Code version");typeof L>"u"&&(L=n.BYTE);const G=t.getSymbolTotalCodewords(P),N=o.getTotalCodewordsCount(P,O),y=(G-N)*8;if(L===n.MIXED)return y;const R=y-h(L,P);switch(L){case n.NUMERIC:return Math.floor(R/10*3);case n.ALPHANUMERIC:return Math.floor(R/11*2);case n.KANJI:return Math.floor(R/13);case n.BYTE:default:return Math.floor(R/8)}},e.getBestVersionForData=function(P,O){let L;const G=r.from(O,r.M);if(Array.isArray(P)){if(P.length>1)return V(P,G);if(P.length===0)return 1;L=P[0]}else L=P;return d(L.mode,L.getLength(),G)},e.getEncodedBits=function(P){if(!a.isValid(P)||P<7)throw new Error("Invalid QR Code version");let O=P<<12;for(;t.getBCHDigit(O)-l>=0;)O^=c<<t.getBCHDigit(O)-l;return P<<12|O}})(Ht);var Yt={};const it=oe,jt=1335,Da=21522,Dt=it.getBCHDigit(jt);Yt.getEncodedBits=function(t,o){const r=t.bit<<3|o;let n=r<<10;for(;it.getBCHDigit(n)-Dt>=0;)n^=jt<<it.getBCHDigit(n)-Dt;return(r<<10|n)^Da};var Gt={};const Pa=me;function be(e){this.mode=Pa.NUMERIC,this.data=e.toString()}be.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)};be.prototype.getLength=function(){return this.data.length};be.prototype.getBitsLength=function(){return be.getBitsLength(this.data.length)};be.prototype.write=function(t){let o,r,n;for(o=0;o+3<=this.data.length;o+=3)r=this.data.substr(o,3),n=parseInt(r,10),t.put(n,10);const a=this.data.length-o;a>0&&(r=this.data.substr(o),n=parseInt(r,10),t.put(n,a*3+1))};var Oa=be;const _a=me,tt=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function Ie(e){this.mode=_a.ALPHANUMERIC,this.data=e}Ie.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)};Ie.prototype.getLength=function(){return this.data.length};Ie.prototype.getBitsLength=function(){return Ie.getBitsLength(this.data.length)};Ie.prototype.write=function(t){let o;for(o=0;o+2<=this.data.length;o+=2){let r=tt.indexOf(this.data[o])*45;r+=tt.indexOf(this.data[o+1]),t.put(r,11)}this.data.length%2&&t.put(tt.indexOf(this.data[o]),6)};var La=Ie;const Fa=me;function Ee(e){this.mode=Fa.BYTE,typeof e=="string"?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}Ee.getBitsLength=function(t){return t*8};Ee.prototype.getLength=function(){return this.data.length};Ee.prototype.getBitsLength=function(){return Ee.getBitsLength(this.data.length)};Ee.prototype.write=function(e){for(let t=0,o=this.data.length;t<o;t++)e.put(this.data[t],8)};var Ba=Ee;const Va=me,Ua=oe;function Se(e){this.mode=Va.KANJI,this.data=e}Se.getBitsLength=function(t){return t*13};Se.prototype.getLength=function(){return this.data.length};Se.prototype.getBitsLength=function(){return Se.getBitsLength(this.data.length)};Se.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let o=Ua.toSJIS(this.data[t]);if(o>=33088&&o<=40956)o-=33088;else if(o>=57408&&o<=60351)o-=49472;else throw new Error("Invalid SJIS character: "+this.data[t]+`
Make sure your charset is UTF-8`);o=(o>>>8&255)*192+(o&255),e.put(o,13)}};var za=Se,qt={exports:{}};(function(e){var t={single_source_shortest_paths:function(o,r,n){var a={},c={};c[r]=0;var l=t.PriorityQueue.make();l.push(r,0);for(var d,h,w,V,E,P,O,L,G;!l.empty();){d=l.pop(),h=d.value,V=d.cost,E=o[h]||{};for(w in E)E.hasOwnProperty(w)&&(P=E[w],O=V+P,L=c[w],G=typeof c[w]>"u",(G||L>O)&&(c[w]=O,l.push(w,O),a[w]=h))}if(typeof n<"u"&&typeof c[n]>"u"){var N=["Could not find a path from ",r," to ",n,"."].join("");throw new Error(N)}return a},extract_shortest_path_from_predecessor_list:function(o,r){for(var n=[],a=r;a;)n.push(a),o[a],a=o[a];return n.reverse(),n},find_path:function(o,r,n){var a=t.single_source_shortest_paths(o,r,n);return t.extract_shortest_path_from_predecessor_list(a,n)},PriorityQueue:{make:function(o){var r=t.PriorityQueue,n={},a;o=o||{};for(a in r)r.hasOwnProperty(a)&&(n[a]=r[a]);return n.queue=[],n.sorter=o.sorter||r.default_sorter,n},default_sorter:function(o,r){return o.cost-r.cost},push:function(o,r){var n={value:o,cost:r};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(qt);var Ha=qt.exports;(function(e){const t=me,o=Oa,r=La,n=Ba,a=za,c=se,l=oe,d=Ha;function h(N){return unescape(encodeURIComponent(N)).length}function w(N,y,R){const M=[];let U;for(;(U=N.exec(R))!==null;)M.push({data:U[0],index:U.index,mode:y,length:U[0].length});return M}function V(N){const y=w(c.NUMERIC,t.NUMERIC,N),R=w(c.ALPHANUMERIC,t.ALPHANUMERIC,N);let M,U;return l.isKanjiModeEnabled()?(M=w(c.BYTE,t.BYTE,N),U=w(c.KANJI,t.KANJI,N)):(M=w(c.BYTE_KANJI,t.BYTE,N),U=[]),y.concat(R,M,U).sort(function(S,C){return S.index-C.index}).map(function(S){return{data:S.data,mode:S.mode,length:S.length}})}function E(N,y){switch(y){case t.NUMERIC:return o.getBitsLength(N);case t.ALPHANUMERIC:return r.getBitsLength(N);case t.KANJI:return a.getBitsLength(N);case t.BYTE:return n.getBitsLength(N)}}function P(N){return N.reduce(function(y,R){const M=y.length-1>=0?y[y.length-1]:null;return M&&M.mode===R.mode?(y[y.length-1].data+=R.data,y):(y.push(R),y)},[])}function O(N){const y=[];for(let R=0;R<N.length;R++){const M=N[R];switch(M.mode){case t.NUMERIC:y.push([M,{data:M.data,mode:t.ALPHANUMERIC,length:M.length},{data:M.data,mode:t.BYTE,length:M.length}]);break;case t.ALPHANUMERIC:y.push([M,{data:M.data,mode:t.BYTE,length:M.length}]);break;case t.KANJI:y.push([M,{data:M.data,mode:t.BYTE,length:h(M.data)}]);break;case t.BYTE:y.push([{data:M.data,mode:t.BYTE,length:h(M.data)}])}}return y}function L(N,y){const R={},M={start:{}};let U=["start"];for(let x=0;x<N.length;x++){const S=N[x],C=[];for(let B=0;B<S.length;B++){const p=S[B],s=""+x+B;C.push(s),R[s]={node:p,lastCount:0},M[s]={};for(let m=0;m<U.length;m++){const v=U[m];R[v]&&R[v].node.mode===p.mode?(M[v][s]=E(R[v].lastCount+p.length,p.mode)-E(R[v].lastCount,p.mode),R[v].lastCount+=p.length):(R[v]&&(R[v].lastCount=p.length),M[v][s]=E(p.length,p.mode)+4+t.getCharCountIndicator(p.mode,y))}}U=C}for(let x=0;x<U.length;x++)M[U[x]].end=0;return{map:M,table:R}}function G(N,y){let R;const M=t.getBestModeForData(N);if(R=t.from(y,M),R!==t.BYTE&&R.bit<M.bit)throw new Error('"'+N+'" cannot be encoded with mode '+t.toString(R)+`.
Suggested mode is: `+t.toString(M));switch(R===t.KANJI&&!l.isKanjiModeEnabled()&&(R=t.BYTE),R){case t.NUMERIC:return new o(N);case t.ALPHANUMERIC:return new r(N);case t.KANJI:return new a(N);case t.BYTE:return new n(N)}}e.fromArray=function(y){return y.reduce(function(R,M){return typeof M=="string"?R.push(G(M,null)):M.data&&R.push(G(M.data,M.mode)),R},[])},e.fromString=function(y,R){const M=V(y,l.isKanjiModeEnabled()),U=O(M),x=L(U,R),S=d.find_path(x.map,"start","end"),C=[];for(let B=1;B<S.length-1;B++)C.push(x.table[S[B]].node);return e.fromArray(P(C))},e.rawSplit=function(y){return e.fromArray(V(y,l.isKanjiModeEnabled()))}})(Gt);const Qe=oe,nt=je,$a=Ia,Ya=Ea,ja=Ft,Ga=Bt,lt=Vt,ct=Ge,qa=Ma,Ye=Ht,Qa=Yt,Wa=me,at=Gt;function Ja(e,t){const o=e.size,r=Ga.getPositions(t);for(let n=0;n<r.length;n++){const a=r[n][0],c=r[n][1];for(let l=-1;l<=7;l++)if(!(a+l<=-1||o<=a+l))for(let d=-1;d<=7;d++)c+d<=-1||o<=c+d||(l>=0&&l<=6&&(d===0||d===6)||d>=0&&d<=6&&(l===0||l===6)||l>=2&&l<=4&&d>=2&&d<=4?e.set(a+l,c+d,!0,!0):e.set(a+l,c+d,!1,!0))}}function Ka(e){const t=e.size;for(let o=8;o<t-8;o++){const r=o%2===0;e.set(o,6,r,!0),e.set(6,o,r,!0)}}function Xa(e,t){const o=ja.getPositions(t);for(let r=0;r<o.length;r++){const n=o[r][0],a=o[r][1];for(let c=-2;c<=2;c++)for(let l=-2;l<=2;l++)c===-2||c===2||l===-2||l===2||c===0&&l===0?e.set(n+c,a+l,!0,!0):e.set(n+c,a+l,!1,!0)}}function Za(e,t){const o=e.size,r=Ye.getEncodedBits(t);let n,a,c;for(let l=0;l<18;l++)n=Math.floor(l/3),a=l%3+o-8-3,c=(r>>l&1)===1,e.set(n,a,c,!0),e.set(a,n,c,!0)}function ot(e,t,o){const r=e.size,n=Qa.getEncodedBits(t,o);let a,c;for(a=0;a<15;a++)c=(n>>a&1)===1,a<6?e.set(a,8,c,!0):a<8?e.set(a+1,8,c,!0):e.set(r-15+a,8,c,!0),a<8?e.set(8,r-a-1,c,!0):a<9?e.set(8,15-a-1+1,c,!0):e.set(8,15-a-1,c,!0);e.set(r-8,8,1,!0)}function eo(e,t){const o=e.size;let r=-1,n=o-1,a=7,c=0;for(let l=o-1;l>0;l-=2)for(l===6&&l--;;){for(let d=0;d<2;d++)if(!e.isReserved(n,l-d)){let h=!1;c<t.length&&(h=(t[c]>>>a&1)===1),e.set(n,l-d,h),a--,a===-1&&(c++,a=7)}if(n+=r,n<0||o<=n){n-=r,r=-r;break}}}function to(e,t,o){const r=new $a;o.forEach(function(d){r.put(d.mode.bit,4),r.put(d.getLength(),Wa.getCharCountIndicator(d.mode,e)),d.write(r)});const n=Qe.getSymbolTotalCodewords(e),a=ct.getTotalCodewordsCount(e,t),c=(n-a)*8;for(r.getLengthInBits()+4<=c&&r.put(0,4);r.getLengthInBits()%8!==0;)r.putBit(0);const l=(c-r.getLengthInBits())/8;for(let d=0;d<l;d++)r.put(d%2?17:236,8);return no(r,e,t)}function no(e,t,o){const r=Qe.getSymbolTotalCodewords(t),n=ct.getTotalCodewordsCount(t,o),a=r-n,c=ct.getBlocksCount(t,o),l=r%c,d=c-l,h=Math.floor(r/c),w=Math.floor(a/c),V=w+1,E=h-w,P=new qa(E);let O=0;const L=new Array(c),G=new Array(c);let N=0;const y=new Uint8Array(e.buffer);for(let S=0;S<c;S++){const C=S<d?w:V;L[S]=y.slice(O,O+C),G[S]=P.encode(L[S]),O+=C,N=Math.max(N,C)}const R=new Uint8Array(r);let M=0,U,x;for(U=0;U<N;U++)for(x=0;x<c;x++)U<L[x].length&&(R[M++]=L[x][U]);for(U=0;U<E;U++)for(x=0;x<c;x++)R[M++]=G[x][U];return R}function ao(e,t,o,r){let n;if(Array.isArray(e))n=at.fromArray(e);else if(typeof e=="string"){let h=t;if(!h){const w=at.rawSplit(e);h=Ye.getBestVersionForData(w,o)}n=at.fromString(e,h||40)}else throw new Error("Invalid data");const a=Ye.getBestVersionForData(n,o);if(!a)throw new Error("The amount of data is too big to be stored in a QR Code");if(!t)t=a;else if(t<a)throw new Error(`
The chosen QR Code version cannot contain this amount of data.
Minimum version required to store current data is: `+a+`.
`);const c=to(t,o,n),l=Qe.getSymbolSize(t),d=new Ya(l);return Ja(d,t),Ka(d),Xa(d,t),ot(d,o,0),t>=7&&Za(d,t),eo(d,c),isNaN(r)&&(r=lt.getBestMask(d,ot.bind(null,d,o))),lt.applyMask(r,d),ot(d,o,r),{modules:d,version:t,errorCorrectionLevel:o,maskPattern:r,segments:n}}_t.create=function(t,o){if(typeof t>"u"||t==="")throw new Error("No input text");let r=nt.M,n,a;return typeof o<"u"&&(r=nt.from(o.errorCorrectionLevel,nt.M),n=Ye.from(o.version),a=lt.from(o.maskPattern),o.toSJISFunc&&Qe.setToSJISFunction(o.toSJISFunc)),ao(t,n,r,a)};var Qt={},vt={};(function(e){function t(o){if(typeof o=="number"&&(o=o.toString()),typeof o!="string")throw new Error("Color should be defined as hex string");let r=o.slice().replace("#","").split("");if(r.length<3||r.length===5||r.length>8)throw new Error("Invalid hex color: "+o);(r.length===3||r.length===4)&&(r=Array.prototype.concat.apply([],r.map(function(a){return[a,a]}))),r.length===6&&r.push("F","F");const n=parseInt(r.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:"#"+r.slice(0,6).join("")}}e.getOptions=function(r){r||(r={}),r.color||(r.color={});const n=typeof r.margin>"u"||r.margin===null||r.margin<0?4:r.margin,a=r.width&&r.width>=21?r.width:void 0,c=r.scale||4;return{width:a,scale:a?4:c,margin:n,color:{dark:t(r.color.dark||"#000000ff"),light:t(r.color.light||"#ffffffff")},type:r.type,rendererOpts:r.rendererOpts||{}}},e.getScale=function(r,n){return n.width&&n.width>=r+n.margin*2?n.width/(r+n.margin*2):n.scale},e.getImageWidth=function(r,n){const a=e.getScale(r,n);return Math.floor((r+n.margin*2)*a)},e.qrToImageData=function(r,n,a){const c=n.modules.size,l=n.modules.data,d=e.getScale(c,a),h=Math.floor((c+a.margin*2)*d),w=a.margin*d,V=[a.color.light,a.color.dark];for(let E=0;E<h;E++)for(let P=0;P<h;P++){let O=(E*h+P)*4,L=a.color.light;if(E>=w&&P>=w&&E<h-w&&P<h-w){const G=Math.floor((E-w)/d),N=Math.floor((P-w)/d);L=V[l[G*c+N]?1:0]}r[O++]=L.r,r[O++]=L.g,r[O++]=L.b,r[O]=L.a}}})(vt);(function(e){const t=vt;function o(n,a,c){n.clearRect(0,0,a.width,a.height),a.style||(a.style={}),a.height=c,a.width=c,a.style.height=c+"px",a.style.width=c+"px"}function r(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(a,c,l){let d=l,h=c;typeof d>"u"&&(!c||!c.getContext)&&(d=c,c=void 0),c||(h=r()),d=t.getOptions(d);const w=t.getImageWidth(a.modules.size,d),V=h.getContext("2d"),E=V.createImageData(w,w);return t.qrToImageData(E.data,a,d),o(V,h,w),V.putImageData(E,0,0),h},e.renderToDataURL=function(a,c,l){let d=l;typeof d>"u"&&(!c||!c.getContext)&&(d=c,c=void 0),d||(d={});const h=e.render(a,c,d),w=d.type||"image/png",V=d.rendererOpts||{};return h.toDataURL(w,V.quality)}})(Qt);var Wt={};const oo=vt;function Pt(e,t){const o=e.a/255,r=t+'="'+e.hex+'"';return o<1?r+" "+t+'-opacity="'+o.toFixed(2).slice(1)+'"':r}function rt(e,t,o){let r=e+t;return typeof o<"u"&&(r+=" "+o),r}function ro(e,t,o){let r="",n=0,a=!1,c=0;for(let l=0;l<e.length;l++){const d=Math.floor(l%t),h=Math.floor(l/t);!d&&!a&&(a=!0),e[l]?(c++,l>0&&d>0&&e[l-1]||(r+=a?rt("M",d+o,.5+h+o):rt("m",n,0),n=0,a=!1),d+1<t&&e[l+1]||(r+=rt("h",c),c=0)):n++}return r}Wt.render=function(t,o,r){const n=oo.getOptions(o),a=t.modules.size,c=t.modules.data,l=a+n.margin*2,d=n.color.light.a?"<path "+Pt(n.color.light,"fill")+' d="M0 0h'+l+"v"+l+'H0z"/>':"",h="<path "+Pt(n.color.dark,"stroke")+' d="'+ro(c,a,n.margin)+'"/>',w='viewBox="0 0 '+l+" "+l+'"',E='<svg xmlns="http://www.w3.org/2000/svg" '+(n.width?'width="'+n.width+'" height="'+n.width+'" ':"")+w+' shape-rendering="crispEdges">'+d+h+`</svg>
`;return typeof r=="function"&&r(null,E),E};const so=Ca,ut=_t,Jt=Qt,io=Wt;function pt(e,t,o,r,n){const a=[].slice.call(arguments,1),c=a.length,l=typeof a[c-1]=="function";if(!l&&!so())throw new Error("Callback required as last argument");if(l){if(c<2)throw new Error("Too few arguments provided");c===2?(n=o,o=t,t=r=void 0):c===3&&(t.getContext&&typeof n>"u"?(n=r,r=void 0):(n=r,r=o,o=t,t=void 0))}else{if(c<1)throw new Error("Too few arguments provided");return c===1?(o=t,t=r=void 0):c===2&&!t.getContext&&(r=o,o=t,t=void 0),new Promise(function(d,h){try{const w=ut.create(o,r);d(e(w,t,r))}catch(w){h(w)}})}try{const d=ut.create(o,r);n(null,e(d,t,r))}catch(d){n(d)}}Re.create=ut.create;Re.toCanvas=pt.bind(null,Jt.render);Re.toDataURL=pt.bind(null,Jt.renderToDataURL);Re.toString=pt.bind(null,function(e,t,o){return io.render(e,o)});function lo(){const e=k(""),t=k(!1),o=k(null);return{qrCode:e,generating:t,error:o,generateQRCode:async l=>{if(!(l!=null&&l.name)&&!(l!=null&&l.assetNumber))throw new Error("Asset must have a name or asset number to generate QR code");t.value=!0,o.value=null;try{const d={id:l.assetNumber||`ASSET-${Date.now()}`,name:l.name||"Unnamed Asset",category:l.category||"Unspecified",location:l.location||"No location",status:l.status||"Unknown",criticality:l.criticality||"Not set",purchaseDate:l.purchaseDate||null,value:l.currentValue||l.purchasePrice||null,vendor:l.vendor||null,lastMaintenance:l.lastMaintenance||null,nextMaintenance:l.nextMaintenance||null,generatedAt:new Date().toISOString(),system:"Atlas CMMS",url:`${window.location.origin}/assets/${l.assetNumber||"new"}`},h=JSON.stringify(d),w=await Re.toDataURL(h,{width:300,margin:2,color:{dark:"#000000",light:"#FFFFFF"},errorCorrectionLevel:"H"});e.value=w;const V={qrCode:w,data:d};return console.log("✅ QR Code generated with data:",d),V}catch(d){throw o.value=d.message,console.error("❌ Failed to generate QR code:",d),d}finally{t.value=!1}},clearQRCode:()=>{e.value="",o.value=null},canGenerateQRCode:l=>!!(l!=null&&l.name||l!=null&&l.assetNumber),generatePrintContent:(l,d)=>{const h=l.name||"Asset",w=l.assetNumber||"TBD",V=l.location||"No Location",E=new Date().toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"});return`
<!DOCTYPE html>
<html>
<head>
<title>Asset QR Label - ${h}</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
text-align: center;
}
.label {
border: 2px solid #000;
padding: 10px;
display: inline-block;
page-break-inside: avoid;
}
img {
width: 128px;
height: 128px;
margin-bottom: 8px;
}
.asset-info {
font-size: 10px;
line-height: 1.2;
}
.asset-name {
font-weight: bold;
font-size: 12px;
margin-bottom: 4px;
}
@media print {
body { margin: 0; padding: 10px; }
.label { page-break-inside: avoid; }
}
</style>
</head>
<body>
<div class="label">
<div>
<img src="${d}" alt="Asset QR Code" />
</div>
<div class="asset-info">
<div class="asset-name">${h}</div>
<div>ID: ${w}</div>
<div>${V}</div>
<div>${E}</div>
</div>
</div>
</body>
</html>
`}}}const co={class:"asset-qr-generator"},uo={class:"flex items-center justify-between mb-4"},mo={class:"flex space-x-2"},fo={key:0,class:"mb-4 p-4 bg-red-50 border border-red-200 rounded-lg"},go={class:"text-sm text-red-600"},vo={class:"bg-white p-6 rounded-lg border-2 border-gray-200 text-center"},po={key:0,class:"py-8"},ho={key:1,class:"space-y-4"},yo={class:"flex justify-center"},wo=["src"],Ao={class:"text-left bg-gray-50 p-4 rounded border"},Co={class:"grid grid-cols-2 gap-2 text-sm"},bo={key:2,class:"py-8 text-gray-500"},Io={class:"flex min-h-full items-center justify-center p-4"},Eo={class:"p-6"},So={id:"qr-print-content",class:"border p-4 bg-white text-center"},Mo={class:"mb-3"},To=["src"],No={class:"text-xs space-y-1"},xo={class:"font-bold"},ko={class:"mt-4 flex justify-end space-x-3"},Ro={__name:"AssetQRGenerator",props:{assetData:{type:Object,required:!0},autoGenerate:{type:Boolean,default:!0}},emits:["qr-generated"],setup(e,{emit:t}){const o=e,r=t,{qrCode:n,generating:a,error:c,generateQRCode:l,canGenerateQRCode:d,generatePrintContent:h}=lo(),w=k(!1),V=async()=>{if(d(o.assetData))try{const N=await l(o.assetData);r("qr-generated",N)}catch(N){console.error("QR generation failed:",N.message)}},E=()=>{V()},P=()=>{w.value=!0},O=()=>{w.value=!1},L=()=>{const N=h(o.assetData,n.value),y=window.open("","_blank");y.document.write(N),y.document.close(),y.print(),y.close(),O()},G=N=>N?new Date(N).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"Not set";return o.autoGenerate&&Dn(()=>{V()}),(N,y)=>($(),j("div",co,[u("div",uo,[y[3]||(y[3]=u("div",null,[u("h4",{class:"text-lg font-medium text-gray-900"},"Asset QR Code"),u("p",{class:"text-sm text-gray-600"},"Automatically generated QR code with asset details")],-1)),u("div",mo,[_(T(ee),{variant:"outline",size:"sm",onClick:E,loading:T(a)},{default:H(()=>y[1]||(y[1]=[u("svg",{class:"w-4 h-4 mr-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})],-1),W(" Regenerate ",-1)])),_:1,__:[1]},8,["loading"]),_(T(ee),{variant:"primary",size:"sm",onClick:P,disabled:!T(n)},{default:H(()=>y[2]||(y[2]=[u("svg",{class:"w-4 h-4 mr-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H9.414a1 1 0 01-.707-.293l-1.414-1.414A1 1 0 006.586 7H4a2 2 0 00-2 2v6a2 2 0 002 2h2m5 5v-5a1.5 1.5 0 011.5-1.5h9A1.5 1.5 0 0122 15.5v5a1.5 1.5 0 01-1.5 1.5h-9A1.5 1.5 0 0111 20.5z"})],-1),W(" Print QR Label ",-1)])),_:1,__:[2]},8,["disabled"])])]),T(c)?($(),j("div",fo,[u("p",go,q(T(c)),1)])):Z("",!0),u("div",vo,[T(a)?($(),j("div",po,y[4]||(y[4]=[u("div",{class:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary-600 mx-auto"},null,-1),u("p",{class:"text-sm text-gray-600 mt-2"},"Generating QR code...",-1)]))):T(n)?($(),j("div",ho,[u("div",yo,[u("img",{src:T(n),alt:"Asset QR Code",class:"max-w-xs"},null,8,wo)]),u("div",Ao,[y[13]||(y[13]=u("h5",{class:"font-medium text-gray-900 mb-2"},"QR Code Contains:",-1)),u("div",Co,[u("div",null,[y[5]||(y[5]=u("strong",null,"Asset ID:",-1)),W(" "+q(e.assetData.assetNumber||"Auto-generated"),1)]),u("div",null,[y[6]||(y[6]=u("strong",null,"Name:",-1)),W(" "+q(e.assetData.name||"Unnamed Asset"),1)]),u("div",null,[y[7]||(y[7]=u("strong",null,"Category:",-1)),W(" "+q(e.assetData.category||"Unspecified"),1)]),u("div",null,[y[8]||(y[8]=u("strong",null,"Location:",-1)),W(" "+q(e.assetData.location||"No location"),1)]),u("div",null,[y[9]||(y[9]=u("strong",null,"Status:",-1)),W(" "+q(e.assetData.status||"Unknown"),1)]),u("div",null,[y[10]||(y[10]=u("strong",null,"Criticality:",-1)),W(" "+q(e.assetData.criticality||"Not set"),1)]),u("div",null,[y[11]||(y[11]=u("strong",null,"Last Maintenance:",-1)),W(" "+q(G(e.assetData.lastMaintenance)),1)]),u("div",null,[y[12]||(y[12]=u("strong",null,"Next Maintenance:",-1)),W(" "+q(G(e.assetData.nextMaintenance)),1)])])])])):($(),j("div",bo,y[14]||(y[14]=[u("svg",{class:"w-16 h-16 mx-auto mb-2 text-gray-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1",d:"M12 4v1m6 11h2m-6 0h-2v4m0-11v3m0 0h.01M12 12h4.01M16 16h4m-4 0v4m-4-4h4"})],-1),u("p",null,"QR code will be generated automatically",-1)])))]),w.value?($(),j("div",{key:1,class:"fixed inset-0 z-50 overflow-y-auto",onClick:O},[u("div",Io,[y[19]||(y[19]=u("div",{class:"fixed inset-0 bg-black bg-opacity-50"},null,-1)),u("div",{class:"relative bg-white rounded-lg shadow-xl max-w-md w-full",onClick:y[0]||(y[0]=Pn(()=>{},["stop"]))},[u("div",Eo,[u("div",{class:"flex items-center justify-between mb-4"},[y[16]||(y[16]=u("h3",{class:"text-lg font-medium text-gray-900"},"Print QR Label",-1)),u("button",{onClick:O,class:"text-gray-400 hover:text-gray-600"},y[15]||(y[15]=[u("svg",{class:"w-6 h-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),u("div",So,[u("div",Mo,[u("img",{src:T(n),alt:"Asset QR Code",class:"w-32 h-32 mx-auto"},null,8,To)]),u("div",No,[u("div",xo,q(e.assetData.name||"Asset"),1),u("div",null,"ID: "+q(e.assetData.assetNumber||"TBD"),1),u("div",null,q(e.assetData.location||"No Location"),1),u("div",null,q(G(new Date)),1)])]),u("div",ko,[_(T(ee),{variant:"secondary",onClick:O},{default:H(()=>y[17]||(y[17]=[W("Cancel",-1)])),_:1,__:[17]}),_(T(ee),{variant:"primary",onClick:L},{default:H(()=>y[18]||(y[18]=[W("Print Label",-1)])),_:1,__:[18]})])])])])])):Z("",!0)]))}},Do=dt(Ro,[["__scopeId","data-v-f7f02383"]]),Po={class:"p-6"},Oo={class:"mb-6 grid grid-cols-1 md:grid-cols-4 gap-4"},_o={key:0,class:"mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-lg flex items-center"},Lo={class:"text-yellow-800"},Fo={class:"flex items-center"},Bo={class:"font-medium text-gray-900"},Vo={class:"text-sm text-gray-600"},Uo={class:"flex items-center"},zo={class:"w-12 h-2 bg-gray-200 rounded-full mr-2"},Ho={key:0,class:"w-3 h-3 mr-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},$o={key:1,class:"w-3 h-3 mr-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},Yo={key:2,class:"w-3 h-3 mr-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},jo={key:0,class:"text-sm text-gray-900"},Go={key:1,class:"text-sm text-gray-400"},qo={key:1,class:"text-sm text-gray-400"},Qo={class:"text-sm font-medium text-gray-900"},Wo={class:"flex items-center space-x-2"},Jo={key:0},Ko={key:0},Xo={key:0},Zo={key:0},er={key:0,class:"mb-4 p-4 bg-blue-50 border border-blue-200 rounded-lg"},tr={class:"flex items-center justify-between"},nr={class:"text-sm text-blue-700 mt-1"},ar={class:"flex space-x-2"},or={class:"border-b border-gray-200 mb-6"},rr={key:1,class:"space-y-6"},sr={class:"col-span-full"},ir={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},lr={key:0,class:"mt-1 text-sm text-red-600"},cr={key:2,class:"space-y-4"},ur={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},dr={key:3,class:"space-y-4"},mr={key:4,class:"space-y-4"},fr={key:5,class:"space-y-6"},gr={class:"border-2 border-dashed border-gray-300 rounded-lg p-6 text-center hover:border-gray-400 transition-colors"},vr={class:"mt-4"},pr={class:"cursor-pointer"},hr={key:0,class:"mt-4 space-y-2"},yr={class:"flex items-center"},wr={class:"text-sm font-medium text-gray-900"},Ar={class:"text-xs text-gray-500"},Cr={class:"mt-2 text-xs text-gray-500"},br={class:"mt-2"},Ir={key:6,class:"space-y-4"},Er={class:"flex items-center justify-between"},Sr={class:"flex items-center space-x-4"},Mr={key:0,class:"flex items-center text-sm text-gray-500"},Tr={key:0,class:"w-4 h-4 mr-2 text-amber-500 animate-pulse",fill:"currentColor",viewBox:"0 0 20 20"},Nr={key:1,class:"w-4 h-4 mr-2 text-green-500",fill:"currentColor",viewBox:"0 0 20 20"},xr={key:2},kr={key:3},Rr={class:"flex space-x-3"},Dr={key:0,class:"space-y-6"},Pr={class:"bg-gray-50 rounded-lg p-4"},Or={class:"grid grid-cols-2 md:grid-cols-4 gap-4"},_r={class:"text-center"},Lr={class:"text-center"},Fr={class:"text-2xl font-bold text-blue-600"},Br={class:"text-center"},Vr={class:"text-2xl font-bold text-green-600"},Ur={class:"text-center"},zr={key:0},Hr={class:"space-y-2"},$r={class:"text-blue-800"},Ce="atlas_asset_form_data",Yr={__name:"AssetsListView",setup(e){const t=_n(),o=On(),r=Un(),n=jn(),{calculateHealthScore:a,assessRisk:c}=ta(),{analyzePerformance:l}=ea(),{loadAssetHierarchy:d}=Gn(),{isOnline:h,syncStatus:w,syncPendingActions:V}=na(),{isMobile:E,layoutClass:P,optimizeTableForMobile:O}=aa(),{complianceScore:L,activeViolations:G,upcomingRenewals:N}=oa(),y=k(!1),R=k(!1),M=k(null),U=k("all"),x=k(!1),S=k("create"),C=k(null),B=k("basic"),p=k(!1),s=k({}),m=k(!1),v=k(null),D=k(!1),F=k(null),Y=k(!1),K=k(!1),z=k(0),f=k({name:"",assetNumber:"",description:"",category:"",status:"",criticality:"",location:"",purchasePrice:0,currentValue:0,purchaseDate:null,installationDate:null,vendor:"",model:"",lastMaintenance:null,nextMaintenance:null,warranty:{isWarrantyActive:!1,warrantyStartDate:null,warrantyEndDate:null,warrantyProvider:"",status:"NOT_APPLICABLE"},customFields:{},image:null,files:[],qrCode:null,qrData:null}),b=k({search:"",status:"",category:"",location:"",criticality:""}),J=k(new Map),X=k({currentPage:1,pageSize:10,total:0}),te=Q(()=>r.assets),ie=Q(()=>r.loading),ae=Q(()=>[{key:"all",label:"All Assets",badge:te.value.length},{key:"operational",label:"Operational",badge:te.value.filter(g=>g.status===he.OPERATIONAL).length},{key:"maintenance",label:"Maintenance",badge:te.value.filter(g=>g.status===he.MAINTENANCE).length},{key:"down",label:"Down",badge:te.value.filter(g=>g.status===he.DOWN).length},{key:"critical_violations",label:"Compliance Issues",badge:G.value.length}]),fe=Q(()=>O([{key:"name",label:"Asset",sortable:!0,essential:!0,priority:"high"},{key:"status",label:"Status",sortable:!0,essential:!0,priority:"high"},{key:"healthScore",label:"Health",sortable:!0,priority:"high"},{key:"location",label:"Location",sortable:!0,priority:"medium"},{key:"criticality",label:"Criticality",sortable:!0,priority:"high"},{key:"lastMaintenance",label:"Last Maintenance",sortable:!0,priority:"medium"},{key:"nextMaintenance",label:"Next Maintenance",sortable:!0,priority:"medium"},{key:"complianceStatus",label:"Compliance",sortable:!0,priority:"low"},{key:"value",label:"Value",sortable:!0,priority:"low"}])),Pe=Q(()=>Object.entries(zn).map(([g,i])=>({title:i.label,value:g}))),We=Q(()=>(n.locations.value||{content:[]}).content.map(i=>({title:i.name,value:i.id}))),Oe=Q(()=>Object.entries(Hn).map(([g,i])=>({title:i.label,value:g}))),ge=Q(()=>{const g=te.value.length,i=te.value.filter(I=>I.status===he.OPERATIONAL).length;te.value.filter(I=>I.criticality===$n.CRITICAL).length,te.value.reduce((I,ne)=>I+(ne.value||0),0);const A=g>0?Math.round(te.value.reduce((I,ne)=>I+a(ne),0)/g):0;return[{name:"Total Assets",value:g,subtitle:h.value?"Live data":"Offline mode",icon:"building",iconBg:"bg-blue-100",iconColor:"text-blue-600",change:8},{name:"Operational",value:i,subtitle:`${g>0?Math.round(i/g*100):0}% uptime`,icon:"check-circle",iconBg:"bg-green-100",iconColor:"text-green-600",change:5},{name:"Health Score",value:`${A}%`,subtitle:"Average asset health",icon:"heart",iconBg:A>=80?"bg-green-100":A>=60?"bg-yellow-100":"bg-red-100",iconColor:A>=80?"text-green-600":A>=60?"text-yellow-600":"text-red-600",change:3},{name:"Compliance",value:`${L.value}%`,subtitle:G.value.length>0?`${G.value.length} violations`:"All compliant",icon:"shield-check",iconBg:L.value>=90?"bg-green-100":L.value>=70?"bg-yellow-100":"bg-red-100",iconColor:L.value>=90?"text-green-600":L.value>=70?"text-yellow-600":"text-red-600",change:-2}]}),ve=Q(()=>{let g=te.value;if(U.value!=="all"){const i={operational:he.OPERATIONAL,maintenance:he.MAINTENANCE,down:he.DOWN,critical_violations:null};if(U.value==="critical_violations"){const A=G.value.map(I=>I.assetId);g=g.filter(I=>A.includes(I.id))}else g=g.filter(A=>A.status===i[U.value])}if(b.value.search){const i=b.value.search.toLowerCase();g=g.filter(A=>{var I,ne,Ae,St;return A.name.toLowerCase().includes(i)||((I=A.model)==null?void 0:I.toLowerCase().includes(i))||((ne=A.location)==null?void 0:ne.toLowerCase().includes(i))||((Ae=A.serialNumber)==null?void 0:Ae.toLowerCase().includes(i))||((St=A.assetNumber)==null?void 0:St.toLowerCase().includes(i))})}return b.value.category&&(g=g.filter(i=>i.category===b.value.category)),b.value.location&&(g=g.filter(i=>i.location===b.value.location)),b.value.criticality&&(g=g.filter(i=>i.criticality===b.value.criticality)),g.map(i=>({...i,healthScore:a(i),riskLevel:c(i),complianceStatus:tn(i.id)}))}),ye=Q(()=>{const g=S.value==="create"?"Create New Asset":"Edit Asset";return D.value?`${g} (Unsaved Changes)`:g}),_e=Q(()=>{if(!F.value)return"";const g=new Date,i=new Date(F.value),A=g-i,I=Math.floor(A/(60*1e3));return I<1?"just now":I===1?"1 minute ago":I<60?`${I} minutes ago`:i.toLocaleTimeString()}),le=[{key:"basic",label:"Basic Information"},{key:"financial",label:"Financial Information"},{key:"warranty",label:"Warranty"},{key:"custom",label:"Custom Fields"},{key:"attachments",label:"Attachments"},{key:"qr",label:"QR Code"}],Le=Q(()=>Object.entries(Yn).map(([g,i])=>({title:i.label,value:g}))),we=async()=>{y.value=!0;try{await Promise.all([r.loadAssets(),n.refreshLocations(),d(),V()])}catch(g){console.error("Failed to refresh data:",g)}finally{y.value=!1}},Fe=()=>{console.log("Exporting assets...")},Be=()=>{S.value="create",C.value=null,B.value="basic",Rn(),Ze()||(Ke(),Et()),x.value=!0},Te=g=>{const i=te.value.find(A=>A.id===g);i&&(S.value="edit",C.value=g,B.value="basic",Object.assign(f.value,i),setTimeout(()=>{Y.value=!1},100),x.value=!0)},Ne=g=>{t.push(`/assets/${g}`)},Kt=g=>{t.push(`/work-orders?create=true&assetId=${g}`)},Xt=async g=>{try{if(y.value=!0,J.value.has(g))M.value=J.value.get(g);else{const i=te.value.find(ne=>ne.id===g),I={...await l(g,[]),healthScore:a(i),riskLevel:c(i),recommendations:["Schedule preventive maintenance within 2 weeks","Monitor temperature sensors more frequently","Consider component replacement for optimal performance","Update maintenance procedures based on usage patterns"]};J.value.set(g,I),M.value=I}R.value=!0}catch(i){console.error("Failed to analyze asset:",i)}finally{y.value=!1}},Zt=()=>{R.value=!1,M.value=null},en=()=>{console.log("Generating detailed report for asset:",M.value)},tn=g=>{const i=G.value.filter(I=>I.assetId===g),A=N.value.filter(I=>I.assetId===g);return i.length>0?"NON_COMPLIANT":A.length>0?"EXPIRING_SOON":"COMPLIANT"},nn=g=>{U.value=g},an=()=>{},Je=()=>{},on=({column:g,direction:i})=>{console.log("Sort:",g,i)},rn=g=>{X.value.currentPage=g},sn=({row:g})=>{Ne(g.id)},ln=g=>({OPERATIONAL:"success",MAINTENANCE:"warning",DOWN:"error",DECOMMISSIONED:"secondary"})[g]||"default",cn=g=>({LOW:"secondary",MEDIUM:"info",HIGH:"warning",CRITICAL:"error"})[g]||"default",un=g=>g.toLowerCase().replace(/\b\w/g,i=>i.toUpperCase()),dn=g=>g.toLowerCase().replace(/\b\w/g,i=>i.toUpperCase()),ht=g=>new Date(g).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),mn=g=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0}).format(g),fn=g=>{const i=new Date(g),I=Math.ceil((i-new Date)/(1e3*60*60*24));return I<0?"text-red-600":I<=7?"text-orange-600":"text-gray-900"},gn=g=>g>=80?"bg-green-500":g>=60?"bg-yellow-500":"bg-red-500",yt=g=>g>=80?"text-green-600":g>=60?"text-yellow-600":"text-red-600",vn=g=>({COMPLIANT:"success",NON_COMPLIANT:"error",EXPIRING_SOON:"warning"})[g]||"secondary",pn=g=>({COMPLIANT:"Compliant",NON_COMPLIANT:"Issues",EXPIRING_SOON:"Expiring"})[g]||g,hn=g=>g==="HIGH"?"text-red-600":g==="MEDIUM"?"text-yellow-600":"text-green-600",Ke=()=>{f.value={name:"",assetNumber:"",description:"",category:"",status:"OPERATIONAL",criticality:"MEDIUM",location:"",purchasePrice:0,currentValue:0,purchaseDate:null,installationDate:null,vendor:"",model:"",warranty:{isWarrantyActive:!1,warrantyStartDate:null,warrantyEndDate:null,warrantyProvider:"",status:"NOT_APPLICABLE"},customFields:{}},s.value={},Y.value=!1,D.value=!1},wt=g=>{const i=le.findIndex(A=>A.key===B.value);g==="next"&&i<le.length-1?B.value=le[i+1].key:g==="previous"&&i>0&&(B.value=le[i-1].key)},yn=async g=>{console.log("Primary image uploaded:",g)},wn=async g=>{console.log("Additional files uploaded:",g)},An=g=>{const i=Array.from(g.target.files);if(!i.length)return;const A=i.map(I=>({...I,id:Date.now()+Math.random(),uploadedAt:new Date().toISOString(),uploadedBy:null}));f.files||(f.files=[]),f.files.push(...A),g.target.value=""},Cn=g=>{f.files&&f.files[g]&&f.files.splice(g,1)},bn=g=>{if(!g)return"0 B";const i=["B","KB","MB","GB"],A=Math.floor(Math.log(g)/Math.log(1024));return`${Math.round(g/Math.pow(1024,A)*100)/100} ${i[A]}`},In=g=>{if(!g)return"just now";const i=new Date(g),I=new Date-i,ne=Math.floor(I/(1e3*60));if(ne<1)return"just now";if(ne<60)return`${ne}m ago`;const Ae=Math.floor(ne/60);return Ae<24?`${Ae}h ago`:i.toLocaleDateString()},En=g=>{B.value=g,ce()},Sn=()=>{var g;return s.value={},(g=f.value.name)!=null&&g.trim()||(s.value.name="Asset name is required"),f.value.category||(s.value.category="Category is required"),f.value.status||(s.value.status="Status is required"),f.value.criticality||(s.value.criticality="Criticality is required"),Object.keys(s.value).length===0},Mn=g=>{console.log("Warranty validation:",g)},Tn=g=>{console.log("Custom fields validation:",g)},Nn=g=>{f.value.qrCode=g.qrCode,f.value.qrData=g.data,console.log("✅ QR Code generated and stored:",g)},Xe=()=>{Ve(),x.value=!1,Ke(),m.value=!1},At=async()=>{if(Sn())try{p.value=!0,S.value==="create"?await r.createAsset(f.value):await r.updateAsset(C.value,f.value),Ve(),Xe(),await we()}catch(g){console.error("Failed to save asset:",g)}finally{p.value=!1}};st(()=>{const{qrCode:g,qrData:i,...A}=f.value;return A},()=>{Y.value&&ce()},{deep:!0}),Me(async()=>{await we();const g=o.query.edit;g&&setTimeout(()=>{Te(parseInt(g)),t.replace({path:"/assets"})},500);try{await Promise.all([...te.value.map(i=>Promise.resolve())])}catch(i){console.error("Failed to load compliance data:",i)}});const Ze=()=>{try{return localStorage.getItem(Ce)!==null}catch{return!1}},Ct=()=>{try{const g=localStorage.getItem(Ce);if(!g)return null;const i=JSON.parse(g);return{timestamp:i.timestamp,formData:i.formData}}catch{return null}},xn=()=>{if(console.log("💾 saveAssetFormData called, userInteracted:",Y.value),!Y.value){console.log("❌ Not saving - user has not interacted");return}try{const g={timestamp:new Date().toISOString(),formData:{...f.value}};delete g.formData.image,delete g.formData.files,console.log("📝 Saving to localStorage:",Ce,g),localStorage.setItem(Ce,JSON.stringify(g)),F.value=g.timestamp,D.value=!1,console.log("✅ Asset form auto-saved successfully at",g.timestamp)}catch(g){console.warn("❌ Failed to save asset form:",g)}},kn=()=>{try{const g=localStorage.getItem(Ce);if(!g)return!1;const i=JSON.parse(g);return Object.assign(f.value,i.formData),F.value=i.timestamp,console.log("Asset form data restored"),!0}catch(g){return console.warn("Failed to restore asset form:",g),!1}},Ve=()=>{try{localStorage.removeItem(Ce),F.value=null,D.value=!1,console.log("Asset saved data cleared")}catch(g){console.warn("Failed to clear asset saved data:",g)}},ce=()=>{console.log("🔥 User interaction detected!"),Y.value=!0,D.value=!0,setTimeout(()=>{D.value&&Y.value&&(console.log("💾 Triggering auto-save..."),xn())},3e3)},Rn=()=>{console.log("=== Checking for asset saved data ==="),console.log("Modal mode:",S.value),console.log("Has saved data:",Ze()),console.log("Saved data info:",Ct()),S.value==="create"&&Ze()?(v.value=Ct(),m.value=!0,console.log("✅ Found saved asset data, showing restore notification"),console.log("Notification visible:",m.value)):console.log("❌ No saved data or not in create mode")},bt=()=>{kn()&&(m.value=!1,console.log("Asset form data restored successfully"))},It=()=>{m.value=!1,Ve(),Ke(),Et(),console.log("Asset auto-saved data dismissed")},Et=()=>{f.value.status||(f.value.status="OPERATIONAL"),f.value.files||(f.value.files=[]),f.value.customFields||(f.value.customFields={})};return Ln(()=>{Ve()}),(g,i)=>($(),Ue(Wn,null,{header:H(()=>[_(Jn,{title:"Assets",description:"Manage and track all facility assets and equipment",breadcrumbs:[{text:"Assets",to:null}]},{actions:H(()=>[_(T(ee),{variant:"outline",size:"sm",onClick:Fe},{default:H(()=>i[27]||(i[27]=[u("svg",{class:"w-4 h-4 mr-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})],-1),W(" Export ",-1)])),_:1,__:[27]}),_(T(ee),{variant:"outline",size:"sm",onClick:we},{default:H(()=>i[28]||(i[28]=[u("svg",{class:"w-4 h-4 mr-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})],-1),W(" Refresh ",-1)])),_:1,__:[28]}),_(T(ee),{variant:"primary",size:"sm",onClick:Be},{default:H(()=>i[29]||(i[29]=[u("svg",{class:"w-4 h-4 mr-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})],-1),W(" Add Asset ",-1)])),_:1,__:[29]})]),stats:H(()=>[_(T(Kn),{stats:ge.value},null,8,["stats"])]),tabs:H(()=>[_(T(xt),{modelValue:U.value,"onUpdate:modelValue":i[0]||(i[0]=A=>U.value=A),tabs:ae.value,onTabChange:nn},null,8,["modelValue","tabs"])]),_:1})]),default:H(()=>[u("div",Po,[u("div",Oo,[_(T(re),{modelValue:b.value.search,"onUpdate:modelValue":i[1]||(i[1]=A=>b.value.search=A),placeholder:"Search assets...",onInput:an},{prepend:H(()=>i[30]||(i[30]=[u("svg",{class:"w-4 h-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})],-1)])),_:1},8,["modelValue"]),_(T(ue),{modelValue:b.value.category,"onUpdate:modelValue":[i[2]||(i[2]=A=>b.value.category=A),Je],placeholder:"Filter by Category",options:Pe.value},null,8,["modelValue","options"]),_(T(ue),{modelValue:b.value.location,"onUpdate:modelValue":[i[3]||(i[3]=A=>b.value.location=A),Je],placeholder:"Filter by Location",options:We.value},null,8,["modelValue","options"]),_(T(ue),{modelValue:b.value.criticality,"onUpdate:modelValue":[i[4]||(i[4]=A=>b.value.criticality=A),Je],placeholder:"Filter by Criticality",options:Oe.value},null,8,["modelValue","options"])]),T(h)?Z("",!0):($(),j("div",_o,[i[31]||(i[31]=u("svg",{class:"w-5 h-5 text-yellow-600 mr-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.728-.833-2.498 0L4.316 16.5c-.77.833.192 2.5 1.732 2.5z"})],-1)),u("span",Lo,"Working offline - "+q(T(w))+" mode active",1)])),u("div",{class:pe(T(P))},[_(T(Xn),{columns:fe.value,data:ve.value,loading:ie.value,pagination:X.value,"empty-message":"No assets found",onSortChange:on,onPageChange:rn,onRowClick:sn},{"column-name":H(({row:A})=>[u("div",Fo,[i[32]||(i[32]=u("div",{class:"w-10 h-10 rounded bg-primary-100 flex items-center justify-center mr-3"},[u("svg",{class:"w-5 h-5 text-primary-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 10V3L4 14h7v7l9-11h-7z"})])],-1)),u("div",null,[u("h4",Bo,q(A.name),1),u("p",Vo,q(A.model||"No model specified"),1)])])]),"column-status":H(({row:A})=>[_(T(et),{variant:ln(A.status)},{default:H(()=>[W(q(un(A.status)),1)]),_:2},1032,["variant"])]),"column-healthScore":H(({row:A})=>[u("div",Uo,[u("div",zo,[u("div",{class:pe(["h-2 rounded-full transition-all duration-300",gn(A.healthScore)]),style:Fn({width:`${A.healthScore}%`})},null,6)]),u("span",{class:pe(["text-sm font-medium",yt(A.healthScore)])},q(A.healthScore)+"% ",3)])]),"column-criticality":H(({row:A})=>[_(T(et),{variant:cn(A.criticality)},{default:H(()=>[W(q(dn(A.criticality)),1)]),_:2},1032,["variant"])]),"column-complianceStatus":H(({row:A})=>[_(T(et),{variant:vn(A.complianceStatus)},{default:H(()=>[A.complianceStatus==="NON_COMPLIANT"?($(),j("svg",Ho,i[33]||(i[33]=[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.728-.833-2.498 0L4.316 16.5c-.77.833.192 2.5 1.732 2.5z"},null,-1)]))):A.complianceStatus==="EXPIRING_SOON"?($(),j("svg",$o,i[34]||(i[34]=[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)]))):($(),j("svg",Yo,i[35]||(i[35]=[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)]))),W(" "+q(pn(A.complianceStatus)),1)]),_:2},1032,["variant"])]),"column-lastMaintenance":H(({row:A})=>[A.lastMaintenance?($(),j("div",jo,q(ht(A.lastMaintenance)),1)):($(),j("span",Go,"Never"))]),"column-nextMaintenance":H(({row:A})=>[A.nextMaintenance?($(),j("div",{key:0,class:pe(["text-sm",fn(A.nextMaintenance)])},q(ht(A.nextMaintenance)),3)):($(),j("span",qo,"Not scheduled"))]),"column-value":H(({row:A})=>[u("div",Qo,q(mn(A.value)),1)]),"row-actions":H(({row:A})=>[u("div",Wo,[_(T(ee),{variant:"ghost",size:"sm",onClick:I=>Ne(A.id),title:"View Details"},{default:H(()=>[i[36]||(i[36]=u("svg",{class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})],-1)),T(E)?Z("",!0):($(),j("span",Jo,"View"))]),_:2,__:[36]},1032,["onClick"]),_(T(ee),{variant:"ghost",size:"sm",onClick:I=>Te(A.id),title:"Edit Asset"},{default:H(()=>[i[37]||(i[37]=u("svg",{class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})],-1)),T(E)?Z("",!0):($(),j("span",Ko,"Edit"))]),_:2,__:[37]},1032,["onClick"]),_(T(ee),{variant:"ghost",size:"sm",onClick:I=>Kt(A.id),title:"Create Work Order"},{default:H(()=>[i[38]||(i[38]=u("svg",{class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})],-1)),T(E)?Z("",!0):($(),j("span",Xo,"Work Order"))]),_:2,__:[38]},1032,["onClick"]),A.riskLevel==="HIGH"?($(),Ue(T(ee),{key:0,variant:"ghost",size:"sm",onClick:I=>Xt(A.id),title:"AI Analysis",class:"text-orange-600 hover:text-orange-700"},{default:H(()=>[i[39]||(i[39]=u("svg",{class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})],-1)),T(E)?Z("",!0):($(),j("span",Zo,"Analyze"))]),_:2,__:[39]},1032,["onClick"])):Z("",!0)])]),_:1},8,["columns","data","loading","pagination"])],2)]),_(T(Nt),{modelValue:x.value,"onUpdate:modelValue":i[25]||(i[25]=A=>x.value=A),title:ye.value,size:"xl",onConfirm:At,onCancel:Xe},{footer:H(()=>[u("div",Er,[u("div",Sr,[D.value||F.value?($(),j("div",Mr,[D.value?($(),j("svg",Tr,i[54]||(i[54]=[u("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z","clip-rule":"evenodd"},null,-1)]))):($(),j("svg",Nr,i[55]||(i[55]=[u("path",{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"},null,-1)]))),D.value?($(),j("span",xr,"Auto-saving...")):F.value?($(),j("span",kr,"Last saved "+q(_e.value),1)):Z("",!0)])):Z("",!0),B.value!=="basic"?($(),Ue(T(ee),{key:1,variant:"outline",size:"sm",onClick:i[23]||(i[23]=A=>wt("previous"))},{default:H(()=>i[56]||(i[56]=[W(" ← Previous ",-1)])),_:1,__:[56]})):Z("",!0)]),u("div",Rr,[_(T(ee),{variant:"secondary",onClick:Xe},{default:H(()=>i[57]||(i[57]=[W(" Cancel ",-1)])),_:1,__:[57]}),B.value!=="qr"?($(),Ue(T(ee),{key:0,variant:"outline",onClick:i[24]||(i[24]=A=>wt("next"))},{default:H(()=>i[58]||(i[58]=[W(" Next → ",-1)])),_:1,__:[58]})):Z("",!0),_(T(ee),{variant:"primary",loading:p.value,onClick:At},{default:H(()=>[W(q(S.value==="create"?"Create Asset":"Update Asset"),1)]),_:1},8,["loading"])])])]),default:H(()=>{var A;return[m.value?($(),j("div",er,[u("div",tr,[u("div",null,[i[40]||(i[40]=u("h4",{class:"text-sm font-medium text-blue-900"},"Restore Previous Data",-1)),u("p",nr," You have unsaved changes from "+q(new Date((A=v.value)==null?void 0:A.timestamp).toLocaleString())+". Would you like to restore them? ",1)]),u("div",ar,[_(T(ee),{size:"sm",variant:"primary",onClick:bt},{default:H(()=>i[41]||(i[41]=[W(" Restore ",-1)])),_:1,__:[41]}),_(T(ee),{size:"sm",variant:"secondary",onClick:It},{default:H(()=>i[42]||(i[42]=[W(" Dismiss ",-1)])),_:1,__:[42]})])])])):Z("",!0),_(T(Zn),{visible:m.value,"saved-data-info":v.value,onRestore:bt,onDismiss:It},null,8,["visible","saved-data-info"]),u("div",or,[_(T(xt),{modelValue:B.value,"onUpdate:modelValue":i[5]||(i[5]=I=>B.value=I),tabs:le,onTabChange:En},null,8,["modelValue"])]),B.value==="basic"?($(),j("div",rr,[u("div",sr,[_(Aa,{modelValue:f.value.assetNumber,"onUpdate:modelValue":i[6]||(i[6]=I=>f.value.assetNumber=I),error:s.value.assetNumber},null,8,["modelValue","error"])]),u("div",ir,[_(T(re),{modelValue:f.value.name,"onUpdate:modelValue":i[7]||(i[7]=I=>f.value.name=I),label:"Asset Name",placeholder:"Enter asset name",required:"",error:s.value.name,onInput:ce},null,8,["modelValue","error"]),_(T(ue),{modelValue:f.value.category,"onUpdate:modelValue":i[8]||(i[8]=I=>f.value.category=I),label:"Category",placeholder:"Select category",options:Pe.value,required:"",error:s.value.category,onChange:ce},null,8,["modelValue","options","error"]),_(T(ue),{modelValue:f.value.status,"onUpdate:modelValue":i[9]||(i[9]=I=>f.value.status=I),label:"Status",placeholder:"Select status",options:Le.value,required:"",error:s.value.status,onChange:ce},null,8,["modelValue","options","error"]),_(T(ue),{modelValue:f.value.criticality,"onUpdate:modelValue":i[10]||(i[10]=I=>f.value.criticality=I),label:"Criticality",placeholder:"Select criticality",options:Oe.value,required:"",error:s.value.criticality,onChange:ce},null,8,["modelValue","options","error"]),_(T(re),{modelValue:f.value.location,"onUpdate:modelValue":i[11]||(i[11]=I=>f.value.location=I),label:"Location",placeholder:"Enter location",error:s.value.location,onInput:ce},null,8,["modelValue","error"])]),u("div",null,[i[43]||(i[43]=u("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Description",-1)),Bn(u("textarea",{"onUpdate:modelValue":i[12]||(i[12]=I=>f.value.description=I),class:pe(["w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary-500 focus:border-primary-500",{"border-red-300":s.value.description}]),placeholder:"Describe the asset's purpose and characteristics",rows:"3",onInput:ce},null,34),[[Vn,f.value.description]]),s.value.description?($(),j("p",lr,q(s.value.description),1)):Z("",!0)])])):Z("",!0),B.value==="financial"?($(),j("div",cr,[u("div",ur,[_(T(re),{modelValue:f.value.purchasePrice,"onUpdate:modelValue":i[13]||(i[13]=I=>f.value.purchasePrice=I),modelModifiers:{number:!0},type:"number",label:"Purchase Price",placeholder:"0.00",step:"0.01",min:"0",error:s.value.purchasePrice},null,8,["modelValue","error"]),_(T(re),{modelValue:f.value.currentValue,"onUpdate:modelValue":i[14]||(i[14]=I=>f.value.currentValue=I),modelModifiers:{number:!0},type:"number",label:"Current Value",placeholder:"0.00",step:"0.01",min:"0",error:s.value.currentValue},null,8,["modelValue","error"]),_(T(re),{modelValue:f.value.purchaseDate,"onUpdate:modelValue":i[15]||(i[15]=I=>f.value.purchaseDate=I),type:"date",label:"Purchase Date",error:s.value.purchaseDate},null,8,["modelValue","error"]),_(T(re),{modelValue:f.value.installationDate,"onUpdate:modelValue":i[16]||(i[16]=I=>f.value.installationDate=I),type:"date",label:"Installation Date",error:s.value.installationDate},null,8,["modelValue","error"]),_(T(re),{modelValue:f.value.vendor,"onUpdate:modelValue":i[17]||(i[17]=I=>f.value.vendor=I),label:"Vendor/Supplier",placeholder:"Enter vendor name",error:s.value.vendor},null,8,["modelValue","error"]),_(T(re),{modelValue:f.value.model,"onUpdate:modelValue":i[18]||(i[18]=I=>f.value.model=I),label:"Model/Part Number",placeholder:"Enter model number",error:s.value.model},null,8,["modelValue","error"])])])):Z("",!0),B.value==="warranty"?($(),j("div",dr,[_(qn,{modelValue:f.value.warranty,"onUpdate:modelValue":i[19]||(i[19]=I=>f.value.warranty=I),onValidationChange:Mn},null,8,["modelValue"])])):Z("",!0),B.value==="custom"?($(),j("div",mr,[_(Qn,{modelValue:f.value.customFields,"onUpdate:modelValue":i[20]||(i[20]=I=>f.value.customFields=I),onValidationChange:Tn},null,8,["modelValue"])])):Z("",!0),B.value==="attachments"?($(),j("div",fr,[u("div",null,[i[44]||(i[44]=u("label",{class:"block text-sm font-medium text-gray-700 mb-2"}," Primary Image ",-1)),i[45]||(i[45]=u("p",{class:"text-sm text-gray-500 mb-3"}," Upload a main image that represents this asset (equipment photos, identification images, etc.) ",-1)),_(T(kt),{modelValue:f.value.image,"onUpdate:modelValue":i[21]||(i[21]=I=>f.value.image=I),accept:"image/*",multiple:!1,uploading:K.value,"upload-progress":z.value,onFilesAdded:yn},null,8,["modelValue","uploading","upload-progress"])]),u("div",null,[i[52]||(i[52]=u("label",{class:"block text-sm font-medium text-gray-700 mb-2"}," Additional Files ",-1)),i[53]||(i[53]=u("p",{class:"text-sm text-gray-500 mb-3"}," Upload manuals, documentation, additional photos, or other relevant files ",-1)),u("div",gr,[i[47]||(i[47]=u("svg",{class:"mx-auto h-12 w-12 text-gray-400",stroke:"currentColor",fill:"none",viewBox:"0 0 48 48"},[u("path",{d:"M28 8H12a4 4 0 00-4 4v20m32-12v8m0 0v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-4l-3.172-3.172a4 4 0 00-5.656 0L28 28M8 32l9.172-9.172a4 4 0 015.656 0L28 28m0 0l4 4m4-24h8m-4-4v8m-12 4h.02","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)),u("div",vr,[u("label",pr,[i[46]||(i[46]=u("span",{class:"mt-2 block text-sm font-medium text-gray-900"}," Drop files here or click to upload ",-1)),u("input",{type:"file",class:"sr-only",multiple:"",accept:"image/*,application/pdf,.doc,.docx,.txt",onChange:An},null,32)])]),i[48]||(i[48]=u("p",{class:"mt-2 text-xs text-gray-500"}," PNG, JPG, PDF, DOC, TXT up to 10MB each (max 10 files) ",-1))]),f.value.files&&f.value.files.length>0?($(),j("div",hr,[($(!0),j(Mt,null,Tt(f.value.files,(I,ne)=>($(),j("div",{key:ne,class:"flex items-center justify-between p-3 bg-gray-50 rounded-lg border"},[u("div",yr,[i[49]||(i[49]=u("svg",{class:"w-5 h-5 text-gray-400 mr-3",fill:"currentColor",viewBox:"0 0 20 20"},[u("path",{"fill-rule":"evenodd",d:"M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4zm2 6a1 1 0 011-1h6a1 1 0 110 2H7a1 1 0 01-1-1zm1 3a1 1 0 100 2h6a1 1 0 100-2H7z","clip-rule":"evenodd"})],-1)),u("div",null,[u("span",wr,q(I.name||"Untitled File"),1),u("div",Ar,q(bn(I.size||0))+" • Uploaded "+q(In(I.uploadedAt)),1)])]),_(T(ee),{variant:"ghost",size:"sm",onClick:Ae=>Cn(ne),class:"text-red-600 hover:text-red-800"},{default:H(()=>i[50]||(i[50]=[u("svg",{class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})],-1)])),_:2,__:[50]},1032,["onClick"])]))),128))])):Z("",!0),u("div",Cr,[u("details",null,[i[51]||(i[51]=u("summary",{class:"cursor-pointer hover:text-gray-700"},"Alternative Upload Method",-1)),u("div",br,[_(T(kt),{modelValue:f.value.files,"onUpdate:modelValue":i[22]||(i[22]=I=>f.value.files=I),accept:"image/*,application/pdf,.doc,.docx,.txt",multiple:!0,"max-files":10,uploading:K.value,"upload-progress":z.value,onFilesAdded:wn},null,8,["modelValue","uploading","upload-progress"])])])])])])):Z("",!0),B.value==="qr"?($(),j("div",Ir,[_(Do,{"asset-data":f.value,"auto-generate":!0,onQrGenerated:Nn},null,8,["asset-data"])])):Z("",!0)]}),_:1},8,["modelValue","title"]),_(T(Nt),{modelValue:R.value,"onUpdate:modelValue":i[26]||(i[26]=A=>R.value=A),title:"Asset AI Analysis",size:"xl"},{content:H(()=>[M.value?($(),j("div",Dr,[u("div",Pr,[i[63]||(i[63]=u("h3",{class:"text-lg font-medium text-gray-900 mb-3"},"Health Assessment",-1)),u("div",Or,[u("div",_r,[u("div",{class:pe(["text-2xl font-bold",yt(M.value.healthScore)])},q(M.value.healthScore)+"% ",3),i[59]||(i[59]=u("div",{class:"text-sm text-gray-600"},"Overall Health",-1))]),u("div",Lr,[u("div",Fr,q(M.value.efficiency||"N/A")+"% ",1),i[60]||(i[60]=u("div",{class:"text-sm text-gray-600"},"Efficiency",-1))]),u("div",Br,[u("div",Vr,q(M.value.reliability||"N/A")+"% ",1),i[61]||(i[61]=u("div",{class:"text-sm text-gray-600"},"Reliability",-1))]),u("div",Ur,[u("div",{class:pe(["text-2xl font-bold",hn(M.value.riskLevel)])},q(M.value.riskLevel),3),i[62]||(i[62]=u("div",{class:"text-sm text-gray-600"},"Risk Level",-1))])])]),M.value.recommendations?($(),j("div",zr,[i[65]||(i[65]=u("h3",{class:"text-lg font-medium text-gray-900 mb-3"},"AI Recommendations",-1)),u("div",Hr,[($(!0),j(Mt,null,Tt(M.value.recommendations,(A,I)=>($(),j("div",{key:I,class:"flex items-start p-3 bg-blue-50 rounded-lg"},[i[64]||(i[64]=u("svg",{class:"w-5 h-5 text-blue-600 mt-0.5 mr-2 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})],-1)),u("span",$r,q(A),1)]))),128))])])):Z("",!0)])):Z("",!0)]),actions:H(()=>[_(T(ee),{variant:"secondary",onClick:Zt},{default:H(()=>i[66]||(i[66]=[W(" Close ",-1)])),_:1,__:[66]}),_(T(ee),{onClick:en},{default:H(()=>i[67]||(i[67]=[W(" Generate Full Report ",-1)])),_:1,__:[67]})]),_:1},8,["modelValue"])]),_:1}))}},is=dt(Yr,[["__scopeId","data-v-188477a9"]]);export{is as default};