1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[19054],{19054:(e,t,r)=>{r.r(t),r.d(t,{default:()=>u});var n=r(95818),o=r(16418),s=r(20449),i=r(41102),l=r(38721);function c(e){if(!/^\d+$/.test(e))throw Error("Gi\xe1 trá» kh\xf4ng hợp lá»: ".concat(e));return Number(e)}function a(e,t,r,n,o,s){if(n<=0)throw Error("Step phải lá»n hÆ¡n 0.");if(t<o||r>s||t>r)throw Error("Khoảng gi\xe1 trá» cron kh\xf4ng hợp lá».");for(let o=t;o<=r;o+=n)e.add(o)}function d(e,t,r){let n=e.trim();if(!n)throw Error("Thiếu trưá»ng cron.");let o=new Set;for(let e of n.split(",")){let n=e.trim();if(!n)throw Error("Danh s\xe1ch cron c\xf3 mục rá»ng.");let[s,i]=n.split("/");if(n.split("/").length>2)throw Error("Step cron kh\xf4ng hợp lá».");let l=i?c(i):1;if("*"===s){a(o,t,r,l,t,r);continue}if(s.includes("-")){let[e,n]=s.split("-");if(!e||!n)throw Error("Khoảng cron kh\xf4ng hợp lá».");a(o,c(e),c(n),l,t,r);continue}let d=c(s);if(d<t||d>r)throw Error("Gi\xe1 trá» cron vượt ngo\xe0i phạm vi cho ph\xe9p.");if(i){a(o,d,r,l,t,r);continue}o.add(d)}if(0===o.size)throw Error("Trưá»ng cron kh\xf4ng tạo ra gi\xe1 trá» n\xe0o.");return{values:o}}let h=new Intl.DateTimeFormat("vi-VN",{dateStyle:"medium",timeStyle:"short"});function u(){let[e,t]=(0,o.useState)("*/15 9-18 * * 1-5\n0 0 1 * *"),[r,c]=(0,o.useState)(""),a=(0,o.useMemo)(()=>e.split(/\r?\n/).map((e,t)=>({line:e.trim(),index:t})).filter(e=>e.line).map(e=>{let{line:t,index:r}=e;try{let e=(0,l.toString)(t),n=(function(e){let t=function(e){let t=e.trim().split(/\s+/);if(5!==t.length)throw Error("Cron phải c\xf3 Ä\xfang 5 trưá»ng: ph\xfat giá» ng\xe0y th\xe1ng thứ.");return{minute:d(t[0],0,59),hour:d(t[1],0,23),dayOfMonth:d(t[2],1,31),month:d(t[3],1,12),dayOfWeek:d(t[4],0,6)}}(e),r=[],n=new Date;n.setSeconds(0,0),n.setMinutes(n.getMinutes()+1);for(let e=0;e<1054080&&r.length<5;e+=1)t.minute.values.has(n.getMinutes())&&t.hour.values.has(n.getHours())&&t.dayOfMonth.values.has(n.getDate())&&t.month.values.has(n.getMonth()+1)&&t.dayOfWeek.values.has(n.getDay())&&r.push(new Date(n)),n.setMinutes(n.getMinutes()+1);if(0===r.length)throw Error("Kh\xf4ng t\xecm thấy lá»ch chạy hợp lá» trong v\xf2ng 2 nÄm tá»i.");return r})(t).map(e=>h.format(e));return{id:"".concat(r,"-").concat(t),expression:t,description:e,nextRuns:n,error:""}}catch(e){return{id:"".concat(r,"-").concat(t),expression:t,description:"",nextRuns:[],error:e instanceof Error?e.message:"Cron kh\xf4ng hợp lá»."}}}),[e]),u=async(e,t)=>{if(t)await (async()=>{try{if(navigator.clipboard&&document.hasFocus())await navigator.clipboard.writeText(t);else throw Error("Clipboard requires focused document")}catch(r){let e=document.createElement("textarea");e.value=t,e.setAttribute("readonly",""),e.style.position="fixed",e.style.left="-9999px",e.style.top="0",document.body.appendChild(e),e.focus(),e.select(),document.execCommand("copy"),document.body.removeChild(e)}})(),c(e),window.setTimeout(()=>c(""),1800)};return(0,n.jsxs)("div",{className:"grid gap-6 lg:grid-cols-[minmax(0,0.95fr)_minmax(0,1.05fr)]",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"cron-parser-input",className:"mb-3 block text-sm font-semibold text-foreground",children:"Cron expressions"}),(0,n.jsx)("textarea",{id:"cron-parser-input",value:e,onChange:e=>t(e.target.value),placeholder:"Má»i d\xf2ng l\xe0 má»t cron 5 trưá»ng",spellCheck:!1,className:"rounded-lg border border-border bg-background min-h-[360px] w-full px-4 py-3 font-mono text-sm text-foreground outline-none transition placeholder:text-muted-foreground focus:border-primary focus:ring-2 focus:ring-primary/20"}),(0,n.jsxs)("div",{className:"mt-4 rounded-3xl border border-border bg-background px-4 py-4 text-sm text-muted-foreground",children:[(0,n.jsx)("p",{className:"font-semibold text-foreground",children:"Bulk mode"}),(0,n.jsx)("p",{className:"mt-2",children:"Má»i d\xf2ng ÄÆ°á»£c ph\xe2n t\xedch Äá»c láºp Äá» lá»i kh\xf4ng ảnh hưá»ng c\xe1c d\xf2ng kh\xe1c."})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"text-lg font-bold text-foreground",children:"Kết quả"}),(0,n.jsx)("div",{className:"mt-6 space-y-4",children:0===a.length?(0,n.jsx)("div",{className:"rounded-3xl border border-border bg-background px-4 py-5 text-sm text-muted-foreground",children:"Nháºp \xedt nhất má»t cron expression Äá» xem m\xf4 tả v\xe0 5 lần chạy tiếp theo."}):a.map(e=>(0,n.jsxs)("div",{className:"rounded-3xl border border-border bg-background p-4",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"font-mono text-sm text-foreground",children:e.expression}),e.error?(0,n.jsx)("p",{className:"mt-3 text-sm text-destructive",children:e.error}):(0,n.jsx)("p",{className:"mt-3 text-sm text-muted-foreground",children:e.description})]}),e.error?null:(0,n.jsxs)("button",{type:"button",onClick:()=>void u(e.id,e.description),className:"inline-flex items-center gap-2 rounded-full border px-3 py-2 text-xs font-semibold transition ".concat(r===e.id?"border-success bg-success/25 text-success-foreground":"border-primary bg-accent text-primary hover:border-primary hover:bg-primary/20"),children:[r===e.id?(0,n.jsx)(s.A,{className:"h-3.5 w-3.5"}):(0,n.jsx)(i.A,{className:"h-3.5 w-3.5"}),r===e.id?"Ä\xe3 copy":"Copy m\xf4 tả"]})]}),e.error?null:(0,n.jsxs)("div",{className:"mt-4 px-4 py-4",children:[(0,n.jsx)("p",{className:"text-sm font-semibold text-foreground",children:"5 lần chạy tiếp theo"}),(0,n.jsx)("ul",{className:"mt-3 space-y-2 text-sm text-muted-foreground",children:e.nextRuns.map(e=>(0,n.jsx)("li",{className:"font-mono text-foreground",children:e},e))})]})]},e.id))})]})]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.