PageSourceSearch

https://living-corporate.com/assets/org-embed-learning-BWcgFtEa.js

js living-corporate.com collected 2026-10-02 05:00:46 UTC 23,584 bytes, 2 lines download raw bytes

1import{e as W,D as ge,v as je,p as fe,r as D,f as ae,i as te,j as e,o as z,L as be,B as p,I as se,aQ as ve,aO as ne}from"./index-QiiZ-xPT.js";import{N as ie}from"./Navigation-r93ZBuy6.js";import{A as R,b as $,a as E}from"./alert-CinvxAKn.js";import{B as we}from"./badge-IOHUIid2.js";import{C as j,b as f,c as b,d as v,a as w}from"./card-DkXabqFf.js";import{D as ye,a as Ne,b as Ce,c as ke,d as De}from"./dialog-D2VXyQJN.js";import{L as ce}from"./label-BA9Xin3m.js";import{S as Ie}from"./switch-RlnlRyqa.js";import{T as Le,a as Se,b as M,c as _}from"./tabs-DPcdb2bX.js";import{T as le}from"./triangle-alert-DWVhHdgr.js";import{P as Pe}from"./plus-BG3Uc6gN.js";import{T as Ae}from"./trash-2-D3MslYjV.js";import{M as Te}from"./monitor-BV5YuFDA.js";import{C as ue}from"./clipboard-B1QPr3a2.js";import{C as Oe}from"./check-KTa2Xihg.js";import"./checkbox-CrGTwbPu.js";import"./index-DqZlRfV5.js";import"./select-B1P2Vx_w.js";import"./index-BMyKsIJE.js";import"./Combination-TP2Egp2x.js";import"./chevron-down-BWOHa16b.js";import"./save-BsB7cS8F.js";import"./dropdown-menu-D4zjGRmc.js";import"./index-Bj3iuRQR.js";import"./chevron-right-f4G5e4zR.js";import"./circle-2nw1jhuN.js";import"./useTranslation-XedzLvcK.js";import"./globe-3tsuvpPT.js";import"./log-out-CqAuLeet.js";import"./building-2-Bz-h5bHH.js";const Re=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],$e=W("key-round",Re);const Ee=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],Me=W("laptop",Ee);const _e=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],ze=W("smartphone",_e),re={enabled:!1,mode:"authenticated",embedId:"",allowedOrigins:[],defaultDestination:"assigned",contentRestriction:"assigned",allowedContentIds:[],allowedPathIds:[],allowedModuleSlugs:[],allowJitProvisioning:!1,display:{showHeader:!0,showProgress:!0,compactNavigation:!1}};async function oe(s){const n=await s.json().catch(()=>null);return n?.message||n?.error||`Request failed (${s.status})`}function Ue(s){try{const n=new URL(s.trim()),l=n.hostname==="localhost"||n.hostname==="127.0.0.1";return n.protocol!=="https:"&&!(l&&n.protocol==="http:")||n.pathname!=="/"||n.search||n.hash||n.username||n.password?null:n.origin}catch{return null}}function B(s){if(!s)return"Never";const n=new Date(s);return Number.isNaN(n.valueOf())?"Never":n.toLocaleString()}function fa(){const{slug:s}=ge(),n=je(),{toast:l}=fe(),[d,c]=D.useState(null),[x,y]=D.useState(""),[i,u]=D.useState("desktop"),[N,S]=D.useState(null),[P,U]=D.useState(null),H=["/api/org",s,"embed-learning"],C=ae({queryKey:H,queryFn:async()=>{const[a,r]=await Promise.all([fetch(`/api/org/${s}/embed-config`,{credentials:"include"}),fetch(`/api/org/${s}/embed-config/operations`,{credentials:"include"})]);if(!a.ok)throw new Error(await oe(a));const o=await a.json(),g=r.ok?await r.json():{aggregates:[]},k=Q=>(g.aggregates||[]).filter(F=>F.eventType===Q).reduce((F,xe)=>F+Number(xe.count||0),0),pe=(g.aggregates||[]).map(Q=>Q.lastSeenAt).filter(Boolean).sort().at(-1);return{...re,enabled:o.enabled,mode:o.mode,embedId:o.embedId,allowedOrigins:o.allowedOrigins||[],defaultDestination:o.defaultDestination,contentRestriction:(o.allowedContentIds||[]).length?"selected":o.mode==="anonymous"?"public_only":"assigned",defaultDestinationId:o.defaultDestinationId||null,allowedContentIds:o.allowedContentIds||[],allowedPathIds:o.allowedPathIds||[],allowedModuleSlugs:o.allowedModuleSlugs||[],allowJitProvisioning:o.jitProvisioningEnabled,display:{...re.display,...o.theme||{}},credential:{status:o.hasCredential?"active":"not_created",lastUsedAt:g.credentialLastUsedAt,rotatedAt:o.updatedAt},analytics:{launches:k("launch_created")+k("launch_failed"),successfulLaunches:k("exch
1ange_succeeded"),errors:k("launch_failed")+k("exchange_failed"),lastLaunchAt:pe}}},enabled:!!s}),t=d||C.data,h=ae({queryKey:["/api/org",s,"embed-learning-options"],queryFn:async()=>{const a=await fetch(`/api/org/${s}/embed-config/options`,{credentials:"include"});if(!a.ok)throw new Error(await oe(a));return a.json()},enabled:!!s}),q=te({mutationFn:async a=>(await ne("PUT",`/api/org/${s}/embed-config`,{enabled:a.enabled,mode:a.mode,allowedOrigins:a.allowedOrigins,defaultDestination:a.defaultDestination,defaultDestinationId:a.defaultDestination==="path"?a.defaultDestinationId:null,allowedPathIds:a.mode==="authenticated"?a.allowedPathIds||[]:[],allowedModuleSlugs:a.mode==="authenticated"?a.allowedModuleSlugs||[]:[],allowedContentIds:a.mode==="anonymous"?(a.allowedContentIds||[]).filter(o=>h.data?.content.some(g=>g.id===o&&g.isPublic&&g.isPublished)):a.contentRestriction==="selected"?a.allowedContentIds||[]:[],jitProvisioningEnabled:a.mode==="authenticated"&&a.allowJitProvisioning,theme:a.display})).json(),onSuccess:()=>{n.invalidateQueries({queryKey:H}),c(null),l({title:"Embed settings saved"})},onError:a=>l({title:"Could not save settings",description:a.message,variant:"destructive"})}),A=te({mutationFn:async a=>(await ne("POST",a==="rotate"?`/api/org/${s}/embed-config/credential`:`/api/org/${s}/embed-config/revoke`)).json(),onSuccess:(a,r)=>{n.invalidateQueries({queryKey:H}),r==="rotate"&&typeof a.credential=="string"&&U(a.credential),l({title:r==="rotate"?"Credential rotated":"Credential revoked"})},onError:a=>l({title:"Credential action failed",description:a.message,variant:"destructive"})}),V=typeof window>"u"?"":window.location.origin,T=t?.embedId?`${V}/embed/learning/${encodeURIComponent(t.embedId)}`:"",Y=`<iframe src="${T}" title="${t?.display.portalName||"Organization learning portal"}" width="100%" height="720" style="border:0;min-height:640px" allow="fullscreen" loading="lazy" referrerpolicy="strict-origin-when-cross-origin"></iframe>`,G=`<div data-lc-learning data-embed-id="${t?.embedId||""}" data-src="${T}" data-title="${t?.display.portalName||"Organization learning portal"}"></div>
2<script async src="${V}/embed-learning-loader.v1.js"><\/script>`,he=i==="desktop"?1120:i==="tablet"?768:390,me=t?.defaultDestination==="path"&&t.defaultDestinationId?`path:${t.defaultDestinationId}`:t?.defaultDestination||"assigned",X=t?.defaultDestination==="path"&&(!t.defaultDestinationId||!!h.data&&!h.data.paths.some(a=>a.id===t.defaultDestinationId));function m(a){t&&c({...t,...a})}function O(a){t&&c({...t,display:{...t.display,...a}})}async function Z(a,r){try{await navigator.clipboard.writeText(a),S(r),window.setTimeout(()=>S(null),1800)}catch{l({title:"Copy failed",description:"Select the code and copy it manually.",variant:"destructive"})}}function ee(){if(!t)return;const a=Ue(x);if(!a){l({title:"Enter an exact HTTPS origin",description:"Example: https://learning.example.com. Paths and wildcards are not allowed.",variant:"destructive"});return}t.allowedOrigins.includes(a)||m({allowedOrigins:[...t.allowedOrigins,a]}),y("")}return C.isLoading?e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsx(z,{className:"h-8 w-8 animate-spin","aria-label":"Loading embed settings"})}):C.error||!t?e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(ie,{}),e.jsx("main",{className:"mx-auto max-w-2xl px-4 pt-28",children:e.jsxs(R,{variant:"destructive",children:[e.jsx(le,{className:"h-4 w-4"}),e.jsx($,{children:"Embed settings unavailable"}),e.jsx(E,{children:C.error instanceof Error?C.error.message:"Try again later."})]})})]}):e.jsxs("div",{className:"min-h-screen bg-background","data-testid":"org-embed-learning-page",children:[e.jsx(ie,{}),e.jsxs("main",{className:"mx-auto max-w-7xl space-y-6 px-4 pb-16 pt-24 sm:px-6",children:[e.jsxs("div",{className:"flex flex-col justify-between gap-4 sm:flex-row sm:items-end",children:[e.jsxs("div",{children:[e.jsx(be,{href:`/org/${s}/dashboard`,className:"text-sm text-muted-foreground hover:text-foreground",children:"Organization dashboard"}),e.jsx("h1",{className:"mt-2 text-3xl font-bold",children:"Embed Learning Portal"}),e.jsx("p",{className:"mt-1 text-muted-foreground",children:"Offer your branded learning portal securely on approved websites."})]}),e.jsxs(p,{onClick:()=>q.mutate(t),disabled:q.isPending||!d||X,children:[q.isPending&&e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}),"Save changes"]})]}),e.jsxs(R,{children:[e.jsx($e,{className:"h-4 w-4"}),e.jsx($,{children:"Keep launch credentials server-side"}),e.jsx(E,{children:"Authenticated hosts must create a short-lived, single-use launch on their server. Never put a reusable credential in HTML, JavaScript, URLs, analytics, or browser storage."})]}),e.jsxs(Le,{defaultValue:"settings",children:[e.jsxs(Se,{className:"h-auto flex-wrap",children:[e.jsx(M,{value:"settings",children:"Configuration"}),e.jsx(M,{value:"installation",children:"Installation"}),e.jsx(M,{value:"preview",children:"Responsive preview"}),e.jsx(M,{value:"operations",children:"Credentials and activity"})]}),e.jsxs(_,{value:"settings",className:"grid gap-6 lg:grid-cols-2",children:[e.jsxs(j,{children:[e.jsxs(f,{children:[e.jsx(b,{children:"Availability and access"}),e.jsx(v,{children:"Embedding is disabled by default and can be stopped immediately."})]}),e.jsxs(w,{className:"space-y-5",children:[e.jsx(L,{label:"Enable learning portal embed",checked:t.enabled,onCheckedChange:a=>m({enabled:a})}),e.jsx(I,{label:"Mode",children:e.jsxs("select",{className:"w-full rounded-md border bg-background p-2",value:t.mode,onCh
2ange:a=>{const r=a.target.value;m(r==="anonymous"?{mode:r,defaultDestination:"content",defaultDestinationId:null,allowedPathIds:[],allowedModuleSlugs:[]}:{mode:r})},children:[e.jsx("option",{value:"authenticated",children:"Authenticated learner"}),e.jsx("option",{value:"anonymous",children:"Anonymous showcase"})]})}),t.mode==="authenticated"?e.jsx(L,{label:"Allow just-in-time learner provisioning",description:"Only provision validated learners from approved launch flows.",checked:t.allowJitProvisioning,onCheckedChange:a=>m({allowJitProvisioning:a})}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Anonymous visitors can only access content explicitly marked public. Learner progress is not associated with an account."}),e.jsx(I,{label:"Default destination",children:e.jsxs("select",{className:"w-full rounded-md border bg-background p-2",value:t.defaultDestination,onChange:a=>m({defaultDestination:a.target.value,defaultDestinationId:a.target.value==="path"?t.defaultDestinationId:null}),children:[e.jsx("option",{value:"assigned",children:"Assigned learning"}),e.jsx("option",{value:"path",children:"Specific learning path"}),e.jsx("option",{value:"catalog",children:"Curated catalog"}),e.jsx("option",{value:"progress",children:"Learner progress"}),e.jsx("option",{value:"content",children:"Selected content"})]})}),t.defaultDestination==="path"&&e.jsxs(I,{label:"Default learning path",children:[h.isLoading?e.jsxs("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(z,{className:"h-4 w-4 animate-spin"}),"Loading organization paths…"]}):h.data?.paths.length?e.jsxs("select",{className:"w-full rounded-md border bg-background p-2",value:t.defaultDestinationId||"",onChange:a=>m({defaultDestinationId:a.target.value||null}),children:[e.jsx("option",{value:"",children:"Choose a path"}),h.data.paths.map(a=>e.jsx("option",{value:a.id,children:a.title},a.id))]}):e.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:"No organization learning paths are available. Choose another default destination."}),X&&e.jsx("p",{className:"text-sm text-destructive",children:"Choose an available learning path before saving."})]}),e.jsx(I,{label:"Content restriction",children:e.jsxs("select",{className:"w-full rounded-md border bg-background p-2",value:t.mode==="anonymous"?"public_only":t.contentRestriction,disabled:t.mode==="anonymous",onChange:a=>m({contentRestriction:a.target.value}),children:[e.jsx("option",{value:"public_only",children:"Public content only"}),e.jsx("option",{value:"assigned",children:"Assigned and entitled content"}),e.jsx("option",{value:"selected",children:"Selected content only"})]})}),e.jsx(He,{config:t,update:m,options:h.data,loading:h.isLoading,error:h.error})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(j,{children:[e.jsxs(f,{children:[e.jsx(b,{children:"Approved website origins"}),e.jsx(v,{children:"Exact origins only. Wildcards, paths, and insecure production origins are rejected."})]}),e.jsxs(w,{className:"space-y-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(se,{"aria-label":"Website origin",placeholder:"https://learning.example.com",value:x,onChange:a=>y(a.target.value),onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),ee())}}),e.jsxs(p,{variant:"outline",onClick:ee,children:[e.jsx(Pe,{className:"mr-2 h-4 w-4"}),"Add"]})]}),t.allowedOrigins.length===0&&e.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:"Add an origin before enabling this embed."}),e.jsx("ul",{className:"space-y-2",children:t.allowedOrigins.map(a=>e.jsxs("li",{className:"flex items-center justify-between rounded-md border p-2 text-sm",children:[e.jsx("span",{className:"truncate",children:a}),e.jsx(p,{size:"icon",variant:"ghost","aria-label":`Remove ${a}`,onClick:()=>m({allowedOrigins:t.allowedOrigins.filter(r=>r!==a)}),children:e.jsx(Ae,{className:"h-4 w-4"})})]},a))})]})]}),e.jsxs(j,{children:[e.jsxs(f,{children:[e.jsx(b,{children:"Display"}),e.jsx(v,{children:"Organization colors and logo are applied automatically. Accessibility contrast is always preserved."})]}),e.jsxs(w,{className:"space-y-5",children:[e.jsx(I,{label:"Portal name",children:e.jsx(se,{value:t.display.portalName||"",placeholder:"Learning portal",onChange:a=>O({portalName:a.target.value})})}),e.jsx(L,{label:"Show branded header",checked:t.display.showHeader,onCheckedChange:a=>O({showHeader:a})}),e.jsx(L,{label:"Show learner progress",checked:t.display.showProgress,onCheckedChange:a=>O({showProgress:a})}),e.jsx(L,{label:"Compact navigation",checked:t.display.compactNavigation,onCheckedChange:a=>O({compactNavigation:a})})]})]})]})]}),e.jsxs(_,{value:"installation",className:"space-y-6",children:[!t.embedId&&e.jsxs(R,{variant:"destructive",children:[e.jsx(le,{className:"h-4 w-4"}),e.jsx($,{children:"No public embed identifier"}),e.jsx(E,{children:"Save the configuration before copying installation code."})]}),e.jsx(de,{title:"Plain iframe",description:"Use a meaningful title and keep the frame at least 320px wide and 400px tall.",value:Y,copied:N==="iframe",onCopy:()=>Z(Y,"iframe")}),e.jsx(de,{title:"Secure loader with automatic resizing",description:"The frame emits lclearning:ready after its safe unauthenticated handshake. Listen for that event, have your server create a short-lived launch token, then call container.lcLearning.launch(token). The loader validates protocol version, message source, embed ID, and Living Corporate origin.",value:G,copied:N==="loader",onCopy:()=>Z(G,"loader")}),t.mode==="authenticated"&&e.jsxs(R,{children:[e.jsx($,{children:"Authenticated launch flow"}),e.jsxs(E,{children:["Your server creates a short-lived launch token, then passes it to ",e.jsx("code",{children:"container.lcLearning.launch(token)"}),". The token may also be supplied in the URL fragment as ",e.jsx("code",{children:"#launch=..."}),"; it is immediately removed and exchanged. Never put the reusable server credential in client code."]})]})]}),e.jsx(_,{value:"preview",children:e.jsxs(j,{children:[e.jsx(f,{children:e.jsxs("div",{className:"flex flex-col justify-between gap-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{children:[e.jsx(b,{children:"Responsive preview"}),e.jsx(v,{children:"The real portal is rendered at the selected host width."})]}),e.jsx("div",{className:"flex gap-1",role:"group","aria-label":"Preview width",children:[{key:"desktop",icon:Te},{key:"tablet",icon:Me},{key:"mobile",icon:ze}].map(({key:a,icon:r})=>e.jsxs(p,{size:"sm",variant:i===a?"default":"outline","aria-pressed":i===a,onClick:()=>u(a),children:[e.jsx(r,{className:"mr-2 h-4 w-4"}),a[0].toUpperCase()+a.slice(1)]},a))})]})}),e.jsx(w,{className:"overflow-x-auto rounded-md bg-muted p-3",children:e.jsx("div",{className:"mx-auto overflow-hidden rounded-md border bg-background transition-[width] duration-200",style:{width:he,maxWidth:"100%"},children:T?e.jsx("iframe",{src:`${T}
2?destination=${encodeURIComponent(me)}&preview=1`,title:`${t.display.portalName||"Learning portal"} preview`,className:"h-[680px] w-full border-0"}):e.jsx("div",{className:"flex h-96 items-center justify-center text-muted-foreground",children:"Save to create a preview."})})})]})}),e.jsxs(_,{value:"operations",className:"grid gap-6 lg:grid-cols-2",children:[e.jsxs(j,{children:[e.jsxs(f,{children:[e.jsx(b,{children:"Launch credential"}),e.jsx(v,{children:"Credentials are only used by your server and are never included in embed snippets."})]}),e.jsxs(w,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Status"}),e.jsx(we,{variant:t.credential?.status==="active"?"default":"secondary",children:t.credential?.status||"not created"})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[e.jsxs("p",{children:["Last used: ",B(t.credential?.lastUsedAt)]}),e.jsxs("p",{children:["Last rotated: ",B(t.credential?.rotatedAt)]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(p,{onClick:()=>A.mutate("rotate"),disabled:A.isPending,children:[e.jsx(ve,{className:"mr-2 h-4 w-4"}),"Rotate credential"]}),e.jsx(p,{variant:"destructive",onClick:()=>A.mutate("revoke"),disabled:A.isPending||t.credential?.status!=="active",children:"Revoke"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Rotation immediately invalidates the prior credential and launch version. Store the replacement in your server's secret manager through the secure response workflow."})]})]}),e.jsxs(j,{children:[e.jsxs(f,{children:[e.jsx(b,{children:"Launch health"}),e.jsx(v,{children:"Aggregate operational activity. No additional learner details are shown."})]}),e.jsxs(w,{children:[e.jsxs("div",{className:"grid grid-cols-3 gap-3 text-center",children:[e.jsx(K,{label:"Launches",value:t.analytics?.launches||0}),e.jsx(K,{label:"Successful",value:t.analytics?.successfulLaunches||0}),e.jsx(K,{label:"Errors",value:t.analytics?.errors||0})]}),e.jsxs("p",{className:"mt-4 text-sm text-muted-foreground",children:["Last launch: ",B(t.analytics?.lastLaunchAt)]})]})]})]})]})]}),e.jsx(ye,{open:!!P,onOpenChange:a=>{a||U(null)},children:e.jsxs(Ne,{"aria-describedby":"embed-credential-warning",children:[e.jsxs(Ce,{children:[e.jsx(ke,{children:"Save the new server credential now"}),e.jsx(De,{id:"embed-credential-warning",children:"This credential is shown once and cannot be recovered. Store it only in your server-side secret manager. Do not put it in browser code, iframe HTML, URLs, or analytics."})]}),e.jsx("pre",{className:"max-h-32 overflow-auto whitespace-pre-wrap break-all rounded-md bg-muted p-3 text-xs",children:e.jsx("code",{children:P})}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(p,{onClick:async()=>{if(P)try{await navigator.clipboard.writeText(P),l({title:"Credential copied",description:"Paste it into your server-side secret manager."})}catch{l({title:"Copy failed",description:"Copy the credential manually before closing.",variant:"destructive"})}},children:[e.jsx(ue,{className:"mr-2 h-4 w-4"}),"Copy credential"]}),e.jsx(p,{variant:"outline",onClick:()=>U(null),children:"I stored it securely"})]})]})})]})}function I({label:s,hint:n,children:l}){return e.jsxs("div",{className:"space-y-2",children:[e.jsxs(ce,{className:"block",children:[e.jsx("span",{className:"mb-2 block",children:s}),l]}),n&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n})]})}function L({label:s,description:n,checked:l,onCheckedChange:d}){return e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(ce,{children:s}),n&&e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:n})]}),e.jsx(Ie,{checked:l,onCheckedChange:d,"aria-label":s})]})}function He({config:s,update:n,options:l,loading:d,error:c}){if(d)return e.jsxs("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(z,{className:"h-4 w-4 animate-spin"}),"Loading available learning…"]});if(c)return e.jsx("p",{className:"text-sm text-destructive",children:"Available learning could not be loaded. Refresh before changing restrictions."});if(!l)return null;const x=(i,u)=>{const N=s[i]||[];n({[i]:N.includes(u)?N.filter(S=>S!==u):[...N,u]})},y=s.mode==="anonymous"?l.content.filter(i=>i.isPublished&&i.isPublic):l.content;return e.jsxs("div",{className:"space-y-4 border-t pt-4",children:[s.mode==="anonymous"?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Anonymous embeds are limited to published public custom content. Select the public items to include; leaving this empty makes all published public items available."}):e.jsxs(e.Fragment,{children:[e.jsx(J,{label:"Allowed learning paths",empty:"No organization learning paths are available.",items:l.paths,selected:s.allowedPathIds||[],getId:i=>i.id,getLabel:i=>i.title,onToggle:i=>x("allowedPathIds",i)}),e.jsx(J,{label:"Allowed catalog modules",empty:"No catalog modules are available.",items:l.modules,selected:s.allowedModuleSlugs||[],getId:i=>i.slug,getLabel:i=>i.title,onToggle:i=>x("allowedModuleSlugs",i)})]}),(s.mode==="anonymous"||s.contentRestriction==="selected")&&e.jsx(J,{label:s.mode==="anonymous"?"Public custom content":"Allowed custom content",empty:s.mode==="anonymous"?"No published public custom content is available.":"No custom content is available.",items:y,selected:s.allowedContentIds||[],getId:i=>i.id,getLabel:i=>`${i.title}
2 (${i.contentType})`,onToggle:i=>x("allowedContentIds",i)})]})}function J({label:s,empty:n,items:l,selected:d,getId:c,getLabel:x,onToggle:y}){return e.jsxs("fieldset",{children:[e.jsx("legend",{className:"mb-2 text-sm font-medium",children:s}),l.length?e.jsx("div",{className:"max-h-44 space-y-2 overflow-y-auto rounded-md border p-2",children:l.map(i=>{const u=c(i);return e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded px-1 py-0.5 text-sm",children:[e.jsx("input",{type:"checkbox",checked:d.includes(u),onChange:()=>y(u)}),x(i)]},u)})}):e.jsx("p",{className:"text-sm text-muted-foreground",children:n})]})}function de({title:s,description:n,value:l,copied:d,onCopy:c}){return e.jsxs(j,{children:[e.jsxs(f,{children:[e.jsx(b,{children:s}),e.jsx(v,{children:n})]}),e.jsxs(w,{children:[e.jsx("pre",{className:"max-h-48 overflow-auto whitespace-pre-wrap break-all rounded-md bg-muted p-4 text-xs",children:e.jsx("code",{children:l})}),e.jsxs(p,{className:"mt-3",variant:"outline",onClick:c,disabled:!l,children:[d?e.jsx(Oe,{className:"mr-2 h-4 w-4"}):e.jsx(ue,{className:"mr-2 h-4 w-4"}),d?"Copied":"Copy code"]})]})]})}function K({label:s,value:n}){return e.jsxs("div",{className:"rounded-md border p-3",children:[e.jsx("div",{className:"text-2xl font-semibold",children:n.toLocaleString()}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s})]})}export{fa as default};

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.