"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./main-BB7fFseo.cjs"),p=e.defineComponent({__name:"AntiCheating",setup(_){let r=null;const n=e.ref(0),i=e.ref(!1),s=e.computed(()=>e.FormSetting.value.test_setting.cut_screen_count_limit),o=e.computed(()=>n.value>s.value),v=e.computed(()=>o.value?`系统检测到你切出当前考试页面${n.value}次，将在${a.value}s后自动交卷.如有疑问,请联系考试管理员.`:`系统检测到你切出当前考试页面${n.value}次，超过${s.value}次将自动交卷，请保持在当前考试继续作答`),d=e.computed(()=>o.value?`自动交卷(${a.value}s)`:"确认"),u=()=>{if(!(!e.FormSetting.value.test_setting.is_anti_cheating||!e.FormSetting.value.test_setting.ban_cut_screen))if(document.visibilityState==="hidden")r=performance.now();else{const t=e.FormSetting.value.test_setting.cut_screen_second_limit*1e3;r&&performance.now()-r>t&&(n.value++,i.value=!0),o.value&&l()}};document.addEventListener("visibilitychange",u),e.onUnmounted(()=>{document.removeEventListener("visibilitychange",u)});const a=e.ref(5),l=()=>{if(a.value<=0){i.value=!1,document.dispatchEvent(new Event("form-render:autosubmit"));return}setTimeout(()=>{a.value--,l()},1e3)},c=t=>{e.FormSetting.value.test_setting.ban_paste_answer&&(e.ElMessage.error("禁止粘贴!"),t.preventDefault(),t.stopPropagation())};return document.addEventListener("paste",c),e.onUnmounted(()=>{document.removeEventListener("paste",c)}),(t,m)=>(e.openBlock(),e.createBlock(e.ConfirmDialog,{modelValue:i.value,"onUpdate:modelValue":m[0]||(m[0]=f=>i.value=f),type:"warn",title:"提示",content:v.value,"confirm-disabled":o.value,"show-cancel":!1,"confirm-text":d.value,width:400,transform:"translateY(0px)"},null,8,["modelValue","content","confirm-disabled","confirm-text"]))}});exports.default=p;
