1import{Q as j}from"./QueryBuilder-BOALnQiw.js";import{T as E}from"./TimeRangeDropdown-BEfJ1omW.js";import{b1 as g}from"./errorReporter-DfyzkI_c.js";import{r as u}from"./metricSparkline-CNhWV4HC.js";/* empty css */import"./app-CJXIyde0.js";/* empty css */import"./apexcharts.esm-vLmBYRlw.js";import"./helper-apexcharts-DkRanvda.js";try{let e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f4ad586b-f831-4e6e-aecb-2e07a60ab5fa",e._sentryDebugIdIdentifier="sentry-dbid-f4ad586b-f831-4e6e-aecb-2e07a60ab5fa")}catch{}const x=["total","success-rate","failed","processing","wait"];let f=[];const m=e=>e<1?Math.round(e*1e3)+"ms":Math.round(e*100)/100+"s";function P(){const e=document.getElementById("job-query-builder"),t=document.getElementById("job-query-fields");if(e&&t)try{window.__jobQb=new j({container:e,fields:JSON.parse(t.textContent),paramName:"qb",resetParams:["page","search_in","search_term","statuses[]","date_from","date_to","date_column"],rangeSelect:"reset"})}catch(n){console.error("QueryBuilder init failed:",n)}const o=document.getElementById("time-range-dropdown");o&&new E({dropdownEl:o,qbInstance:()=>window.__jobQb,dateFieldKey:"datetime",maxRetentionDays:90}),C()}function S(e){const t=document.getElementById("job-list-scroll");t&&(t.style.opacity="0.5",t.style.pointerEvents="none",fetch(e,{headers:{Accept:"text/html","X-QB-Partial":"true"}}).then(o=>o.text()).then(o=>{var i,s,l;t.innerHTML=o,t.style.opacity="",t.style.pointerEvents="",t.scrollTop=0,b(!1),(i=document.getElementById("job-detail-content"))==null||i.classList.add("hidden"),(s=document.getElementById("job-detail-error"))==null||s.classList.add("hidden"),(l=document.getElementById("job-detail-empty"))==null||l.classList.remove("hidden");const n=t.querySelector(".job-log-row");if(n){n.classList.add("border-l-blue-500","bg-blue-50/50");const r=n.getAttribute("data-job-uuid");r&&p(r)}}).catch(o=>{t.style.opacity="",t.style.pointerEvents="",console.warn("Failed to refresh log list",o)}))}function _(){const e=document.getElementById("job-list-scroll");!e||e._qbWired||(e._qbWired=!0,e.addEventListener("click",function(t){const o=document.getElementById("job-log-rows"),n=t.target.closest(".job-log-row");if(!n)return;const i=n.getAttribute("data-job-uuid");if(i){if(o.querySelectorAll(".job-log-row").forEach(s=>s.classList.remove("border-l-blue-500","bg-blue-50/50")),n.classList.add("border-l-blue-500","bg-blue-50/50"),window.history.replaceState(null,"",`#${i}`),window.innerWidth<1024){const s=document.getElementById("job-detail-overlay");s&&typeof HSOverlay<"u"&&HSOverlay.open(s)}p(i)}}))}function I(){const e=document.getElementById("job-columns-dropdown");if(!e)return;const t=e.closest(".hs-dropdown");t&&new MutationObserver(()=>{if(!t.classList.contains("open")){const o=document.getElementById("column-prefs-form");if(!o)return;let n=!1;o.querySelectorAll(".column-checkbox").forEach(i=>{i.checked!==(i.dataset.original==="1")&&(n=!0)}),n&&o.submit()}}).observe(t,{attributes:!0,attributeFilter:["class"]})}function J(){var o;_(),I(),window.__jobStatsBaseUrl=((o=window.__jobStatsUrl)==null?void 0:o.split("?")[0])||window.__jobStatsUrl,w();const e=document.getElementById("job-log-rows");if(e){const n=window.location.hash?window.location.hash.substring(1):null,i=n?e.querySelector(`.job-log-row[data-job-uuid="${CSS.escape(n)}"]`):e.querySelector(".job-log-row");if(i){i.classList.add("border-l-blue-500","bg-blue-50/50");const s=i.getAttribute("data-job-uuid");s&&(p(s),n&&i.scrollIntoView({block:"center"}))}}const t=document.getElementById("job-query-builder");t&&t.addEventListener("qb:filter",n=>{S(n.detail.url),L()}),v()}function v(){document.addEventListener("click",function(e){const t=e.target.closest("#job-show-more");if(!t)return;e.preventDefault();const o=t.getAttribute("data-next-url");if(!o)return;const n=document.getElementById("job-log-rows");n&&(t.disabled=!0,t.innerHTML=` 2 <svg class="animate-spin w-4 h-4" fill="none" viewBox="0 0 24 24"> 3 <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle> 4 <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path> 5 </svg> 6 Loading... 7 `,fetch(o,{headers:{Accept:"text/html","X-Requested-With":"XMLHttpRequest"}}).then(i=>i.text()).then(i=>{const s=new DOMParser().parseFromString(i,"text/html"),l=s.querySelectorAll("#job-log-rows .job-log-row"),r=s.querySelector("#job-show-more");l.forEach(h=>n.appendChild(h));
7const c=document.getElementById("job-showing-end");c&&(c.textContent=n.querySelectorAll(".job-log-row").length);const a=document.getElementById("job-show-more-container");r?(t.disabled=!1,t.innerHTML=` 8 <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"> 9 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 14l-7 7m0 0l-7-7m7 7V3"/> 10 </svg> 11 Load more 12 `,t.setAttribute("data-next-url",r.getAttribute("data-next-url"))):a&&a.remove()}).catch(i=>{t.disabled=!1,t.textContent="Failed to load â try again",g(i,{op:"showMore",component:"JobLogsController"})}))})}function b(e){const t=document.getElementById("job-detail"),o=document.getElementById("job-detail-progress");t&&(e?(t.style.opacity="0.3",t.style.pointerEvents="none",t.style.transition="opacity 150ms ease",o==null||o.classList.remove("hidden")):(t.style.opacity="",t.style.pointerEvents="",o==null||o.classList.add("hidden")))}function p(e){var s;const t=document.getElementById("job-detail-error"),o=document.getElementById("job-detail-content");if(!t||!o)return;(s=document.getElementById("job-detail-empty"))==null||s.classList.add("hidden"),t.classList.add("hidden"),b(!0);const i=`${window.location.pathname.replace(/\/+$/,"")}/${encodeURIComponent(e)}`;fetch(i,{method:"GET",headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest"}}).then(l=>{if(!l.ok)throw new Error(`HTTP ${l.status}`);return l.json()}).then(l=>{B(l),o.classList.remove("hidden"),b(!1),k()}).catch(l=>{b(!1),t.classList.remove("hidden");const r=document.getElementById("job-detail-error-message");r&&(r.textContent=l.message||"Failed to load job details."),g(l,{op:"loadDetail",component:"JobLogsController",extra:{uuid:e,url:i}})})}function B(e){var s;d("job-detail-class",e.class),d("job-detail-uuid",e.uuid),d("job-detail-connection",e.connection),d("job-detail-queue",e.queue),d("job-detail-attempts",e.attempts),d("job-detail-max-tries",e.max_tries),d("job-detail-max-exceptions",e.max_exceptions),d("job-detail-timeout",e.timeout!==null&&e.timeout!==void 0?e.timeout+"s":null),d("job-detail-queries",e.queries_count),d("job-detail-processing",e.processing_time),d("job-detail-wait",e.wait_time),d("job-detail-queued",e.queued_at),d("job-detail-started",e.started_at),d("job-detail-ended",e.ended_at);const t=document.getElementById("job-detail-status");if(t){const l=!!e.has_failed||!!e.failed_at,r=l?"bg-red-100 text-red-800":"bg-green-100 text-green-800",c=l?"bg-red-800":"bg-green-500",a=l?"Failed":e.status?e.status.charAt(0).toUpperCase()+e.status.slice(1):"OK";t.innerHTML=`<span class="inline-flex items-center gap-x-1.5 py-1 px-2.5 rounded-full text-xs font-medium ${r}"><span class="size-1.5 shrink-0 inline-block rounded-full ${c}"></span>${a}</span>`}y("job-detail-failed-label","job-detail-failed",e.failed_at),d("job-detail-failed",e.failed_at);const o=document.getElementById("job-detail-event"),n=e.event_id&&e.event_type;if(y("job-detail-event-label","job-detail-event-dd",n),o&&n){const l=((s=document.getElementById("job-detail"))==null?void 0:s.getAttribute("data-events-url"))||"";o.textContent=e.event_type,o.href=`${l}#${encodeURIComponent(e.event_id)}`}const i=document.getElementById("job-detail-exception-section");if(i){const l=e.has_failed||e.exception_class||e.exception_message;if(i.classList.toggle("hidden",!l),l){d("job-detail-exception-class",e.exception_class);const r=[e.exception_file,e.exception_line].filter(Boolean).join(":");d("job-detail-exception-location",r||null);const c=document.getElementById("job-detail-exception-message");c&&(c.textContent=e.exception_message||"â")}}}function L(){q();const e=window.__jobStatsBaseUrl||window.__jobStatsUrl;if(!e)return;const t=new URL(window.location).searchParams.get("qb"),o=new URL(e,window.location.origin);t?o.searchParams.set("qb",t):o.searchParams.delete("qb"),window.__jobStatsUrl=o.toString(),w()}function q(){f.forEach(e=>{var t;return(t=e==null?void 0:e.destroy)==null?void 0:t.call(e)}
12),f=[],x.forEach(e=>{var n;const t=document.getElementById("stat-"+e);t&&(t.className="text-2xl font-semibold text-gray-900 leading-none shrink-0",t.innerHTML='<div class="h-7 w-12 bg-gray-200 rounded animate-pulse"></div>');const o=(n=t==null?void 0:t.closest(".metric-card"))==null?void 0:n.querySelector(".sparkline-wrapper");o&&(o.innerHTML=`<div id="chart-${e}" class="min-h-[30px] border-b border-gray-200"></div>`)})}function w(){const e=window.__jobStatsUrl;e&&fetch(e,{headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest"}}).then(t=>t.json()).then(t=>{var s,l;document.getElementById("stat-total").textContent=t.total.toLocaleString(),document.getElementById("stat-success-rate").textContent=t.success_rate+"%",document.getElementById("stat-failed").textContent=t.failed_count.toLocaleString(),document.getElementById("stat-processing").textContent=m(t.avg_processing),document.getElementById("stat-wait").textContent=m(t.avg_wait),t.failed_count>0&&document.getElementById("stat-failed").classList.add("text-red-600");const o=t.daily.labels||[],n=r=>o.map((c,a)=>({date:c,value:(r||[])[a]??0})),i=t.daily.total.map((r,c)=>r>0?Math.round(t.daily.ok[c]/r*1e3)/10:0);f.push(u("#chart-total",n(t.daily.total),{gradientShading:!0}),u("#chart-success-rate",n(i),{gradientShading:!0,valueFormatter:r=>r+"%"}),u("#chart-failed",n(t.daily.failed),{gradientShading:!0}),u("#chart-processing",n(t.daily.processing),{gradientShading:!0,valueFormatter:m}),u("#chart-wait",n(t.daily.wait),{gradientShading:!0,valueFormatter:m})),(l=(s=window.HSStaticMethods)==null?void 0:s.autoInit)==null||l.call(s)}).catch(t=>{var o;g(t,{op:"loadJobStats",component:"JobLogsController"}),(o=document.getElementById("job-stats-bar"))==null||o.remove()})}function d(e,t){const o=document.getElementById(e);o&&(o.textContent=t!=null&&t!==""?t:"â")}function y(e,t,o){const n=document.getElementById(e),i=document.getElementById(t),s=o?"":"none";n&&(n.style.display=s),i&&(i.style.display=s)}function C(){if(!window.HSDatepicker)return;const e=window.HSDatepicker.prototype.formatDate;window.HSDatepicker.prototype.formatDate=function(t,o){var i;return(o||((i=this.dataOptions)==null?void 0:i.dateFormat))==="YYYY-MM-DD"&&typeof t=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(t)?t:e.call(this,t,o)}}function k(){typeof window.ClipboardJS>"u"||document.querySelectorAll(".js-clipboard").forEach(e=>{new window.ClipboardJS(e,{text:function(o){const n=o.getAttribute("data-clipboard-target"),i=document.querySelector(n);return i?i.textContent.trim():""}}).on("success",function(o){const n=o.trigger.querySelector(".js-clipboard-default"),i=o.trigger.querySelector(".js-clipboard-success");n&&i&&(n.classList.add("hidden"),i.classList.remove("hidden")),setTimeout(()=>{n&&i&&(n.classList.remove("hidden"),i.classList.add("hidden"))},2e3)})})}function O(){}export{O as finalize,J as indexAction,P as init};
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.