1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5664],{15664:function(e,r,t){t.r(r),t.d(r,{ScormLessonEditor:function(){return c}});var a=t(42620),s=t(40740),l=t(29012),n=t(25634);function c(e){var r;let{lessonId:t,initialContent:c,onContentChange:o}=e,d=(0,l.T)("builderMain"),i=(0,s.useRef)(null),[u,m]=(0,s.useState)(null!=c?c:{}),[x,h]=(0,s.useState)(!1),[b,f]=(0,s.useState)(null),[v,p]=(0,s.useState)(null),g=async e=>{h(!0),f(null),p(null);try{let r=new FormData;r.append("file",e);let a=await fetch("/api/lessons/".concat(t,"/scorm"),{method:"POST",body:r}),s=await a.json().catch(()=>null);if(!a.ok||!(null==s?void 0:s.data))throw Error((null==s?void 0:s.error)||d("scormUploadError"));let l={launchPath:s.data.launchPath,version:s.data.version,fileCount:s.data.files};m(l),null==o||o(l,"ready"),p(d("scormImported",{files:s.data.files}))}catch(e){f(e instanceof Error?e.message:d("scormUploadError"))}finally{h(!1),i.current&&(i.current.value="")}};return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("p",{className:"text-sm text-[rgb(var(--text-muted))]",children:d("scormIntro")}),u.launchPath?(0,a.jsxs)("dl",{className:"grid gap-x-6 gap-y-1 rounded-md border border-[rgb(var(--border-default))] bg-[rgb(var(--surface-raised))] p-4 text-sm sm:grid-cols-[auto_1fr]",children:[(0,a.jsx)("dt",{className:"font-medium text-[rgb(var(--text-secondary))]",children:d("scormLaunchFile")}),(0,a.jsx)("dd",{className:"font-mono text-[rgb(var(--text-primary))]",children:u.launchPath}),(0,a.jsx)("dt",{className:"font-medium text-[rgb(var(--text-secondary))]",children:d("scormVersion")}),(0,a.jsxs)("dd",{className:"text-[rgb(var(--text-primary))]",children:["SCORM ",null!==(r=u.version)&&void 0!==r?r:"1.2"]}),"number"==typeof u.fileCount?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("dt",{className:"font-medium text-[rgb(var(--text-secondary))]",children:d("scormFiles")}),(0,a.jsx)("dd",{className:"text-[rgb(var(--text-primary))]",children:u.fileCount})]}):null]}):null,(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"scorm-".concat(t),className:"mb-1 block text-sm font-medium text-[rgb(var(--text-secondary))]",children:u.launchPath?d("scormReplaceLabel"):d("scormUploadLabel")}),(0,a.jsx)("input",{ref:i,id:"scorm-".concat(t),type:"file",accept:".zip,application/zip",disabled:x,"aria-describedby":"scorm-hint-".concat(t),className:"block w-full rounded-md border border-[rgb(var(--border-default))] bg-[rgb(var(--surface-base))] px-3 py-2 text-sm focus:border-[rgb(var(--focus-ring))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--focus-ring))]/30",onChange:e=>{var r;let t=null===(r=e.target.files)||void 0===r?void 0:r[0];t&&g(t)}}),(0,a.jsx)("p",{id:"scorm-hint-".concat(t),className:"mt-1 text-xs text-[rgb(var(--text-muted))]",children:d("scormUploadHint")})]}),x?(0,a.jsx)("p",{role:"status",className:"text-sm text-[rgb(var(--text-secondary))]",children:d("scormUploading")}):null,v?(0,a.jsx)("p",{role:"status",className:"text-sm font-medium text-[rgb(var(--success))]",children:v}):null,b?(0,a.jsx)("p",{role:"alert",className:"text-sm text-[rgb(var(--danger))]",children:b}):null,u.launchPath?null:(0,a.jsx)(n.z,{size:"sm",variant:"secondary",disabled:x,onClick:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.click()},children:d("scormChooseFile")})]})}}}]);
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.