PageSourceSearch

https://app.aarpdriversafety.org/assets/index-CxJKUFrI.js

js aarpdriversafety.org collected 2026-10-02 06:00:56 UTC 8,541 bytes, 2 lines download raw bytes

1import{G as s,V as l,b7 as F,d_ as I,W as A,D as c,bV as D,y as x,R as y,aG as P,x as z,a2 as B,z as O,dr as U,U as _,a_ as G}from"./index-CL22zKs4.js";import{u as M,d as K,F as h,e as W,c as $}from"./FoafScreen-uYWr1CYq.js";import{S as q}from"./checkmark-line-BjCskq5R.js";import{p as v,i as V,f as H,F as X}from"./utils-BWbARsJW.js";import"./useComponentLog-B5pYe_aL.js";import"./useIdleLogout-BvWFhy3C.js";import"./index-D0wfr2HN.js";import"./index-CsVBjJRA.js";import"./index-CXqPUuxc.js";import"./ProgressBar-ByVSh6R2.js";import"./index-B7vlcZQO.js";import"./index-C0S4806m.js";import"./chevron-DvJAmwsf.js";import"./skip-forward-BTWa4vjC.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"[email protected]"};var r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="5e3d2605-cf41-4a83-8aa0-a7254844b44f",e._sentryDebugIdIdentifier="sentry-dbid-5e3d2605-cf41-4a83-8aa0-a7254844b44f")}catch{}})();const Z=({onAnswer:e,category:r,isKeyboardKeyShown:t,keyboardKey:a,isDebugHighlighted:f=!1,"data-test":g})=>{const u=(i,n)=>n<i.descriptorList.length-i.remainingDescriptors.length;return s.jsxs("button",{"data-test":g,className:l("flex w-full justify-between items-center gap-4 p-6 mb-2","bg-controls-answer-button-old rounded-lg text-left cursor-pointer shadow-floating-old","hover:bg-controls-answer-button-hover-old","active:bg-controls-answer-button-active-old active:shadow-none","focus-visible:shadow-focus-old",A({variant:"field-answer",weight:"semibold"}),f?"border-4 border-solid border-fields-border-positive-old":"border-0"),"aria-label":`Answer Button with title ${r.title}`,onClick:i=>{e(i,r)},children:[t&&s.jsx("span",{className:l("flex size-6 px-2 py-[5.5px] justify-center items-center shrink-0","border-2 border-subdued-old rounded text-subdued-old uppercase","text-[13px] leading-[21px] font-bold"),children:a}),s.jsx("span",{className:"grow shrink-0 basis-0",children:r.title}),s.jsx("span",{className:"flex",children:r.descriptorList.map((i,n)=>u(r,n)?s.jsx(F,{width:16,height:16,"data-test":"bucketDotComplete","aria-hidden":!0,className:l("block","m-0 text-content-positive-old")},`${i.description}-${n}`):s.jsx(I,{width:8,height:8,"data-test":"bucketDot","aria-hidden":!0,className:l("block","m-1 text-subdued-old")},`${i.description}-${n}`))})]})},Q=e=>c.createElement("svg",{width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},c.createElement("g",{clipPath:"url(#clip0_1651_49519)"},c.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 16C4 9.37258 9.37258 4 16 4C22.6274 4 28 9.37258 28 16C28 22.6274 22.6274 28 16 28C9.37258 28 4 22.6274 4 16ZM16 0C7.16344 0 0 7.16344 0 16C0 24.8366 7.16344 32 16 32C24.8366 32 32 24.8366 32 16C32 7.16344 24.8366 0 16 0ZM12.4142 9.58579C11.6332 8.80474 10.3668 8.80474 9.58579 9.58579C8.80474 10.3668 8.80474 11.6332 9.58579 12.4142L13.1716 16L9.58579 19.5858C8.80474 20.3668 8.80474 21.6332 9.58579 22.4142C10.3668 23.1953 11.6332 23.1953 12.4142 22.4142L16 18.8284L19.5858 22.4142C20.3668 23.1953 21.6332 23.1953 22.4142 22.4142C23.1953 21.6332 23.1953 20.3668 22.4142 19.5858L18.8284 16L22.4142 12.4142C23.1953 11.6332 23.1953 10.3668 22.4142 9.58579C21.6332 8.80474 20.3668 8.80474 19.5858 9.58579L16 13.1716L12.4142 9.58579Z",fill:"currentColor"})),c.createElement("defs",null,c.createElement("clipPath",{id:"clip0_1651_49519"},c.createElement("rect",{width:32,height:32,fill:"currentColor"}))));function Y(e,r=750){const t=c.useRef(void 0),a=c.useCallback(()=>{clearTimeout(t.current),t.current=window.setTimeout(()=>{e({type:"FEEDBACK_RESET"})},r)},[e,r]);return c.useEffect(()=>()=>{clearTimeout(t.current)},[]),a}function J(e,r){switch(r.type){case"SHOW_CORRECT_FEEDBACK":return{...e,feedback:{phase:"correct",message:"Correct! Nice job!"}};case"ANSWER_INCORRECT":{const t=v(e.categoryList);return{...e,currentDescriptor:t?.descriptor??e.currentDescriptor,correctCategory:t?.category??e.correctCategory,feedback:{phase:"incorrect",message:"Incorrect. Try again!"}}}case"UPDATE_GAME_STATE":{const t=r.updatedFoaf.bucketivityProgress.categoryList,a=v(t);return{...e,categoryList:t,currentDescriptor:a?.descriptor??"",correctCategory:a?.category??""}}case"FEEDBACK_RESET":return{...e,feedback:{phase:"idle",message:""}};default:return e}}function ee(e){const r=e.bucketivityProgress?.categoryList??[],t=v(r);return{categoryList:r,currentDescriptor:t?.descriptor??"",correctCategory:t?.category??"",feedback:{phase:"idle",message:""}}}const he=()=>{M("FoafCategorize");const e=D(),{bucketivityProgressId:r}=e,{data:t,isLoading:a,isError:f,queryKey:g}=K(r??""),u=c.useRef(!1);if(f)return x.dispatch({type:y,payload:{url:"dash.index"}}),null;if(a||!t?.bucketivityProgress)return s.jsx(h.Root,{children:s.jsx(h.Content,{children:s.jsx(P,{})})});const i=t.bucketivityProgress.categoryList.flatMap(n=>n.remainingDescriptors).length===0;return!u.current&&(i||t.bucketivityProgress.is?.complete)?(x.dispatch({type:y,payload:{url:"foaf.results",params:{...e,bucketivityProgressId:r}}}),null):(u.current=!0,s.jsx(te,{initialFoaf:t,queryKey:g},t.bucketivityProgress._id))},te=({initialFoaf:e,queryKey:r})=>{const t=D(),{bucketivityProgressId:a}=t,f=z(),g=B(),u=W(),i=O(U),[n,m]=c.useReducer(J,e,ee),R=Y(m),{categoryList:j,currentDescriptor:C,correctCategory:w,feedback:o}=n,T=e.bucketivity?.isSkippable??!1,L=d=>{d.flatMap(b=>b.remainingDescriptors).length===0&&setTimeout(()=>{f({type:y,payload:{url:"foaf.results",params:{...t}}})},750)},S=(d,p)=>{if(d.preventDefault(),o.phase!=="idle")return;const b=V(p.title,w);if(m(b?{type:"SHOW_CORRECT_FEEDBACK"}:{type:"ANSWER_INCORRECT"}),R(),p.remainingDescriptors.length===0)return;const N=H("categorize",b,{promptCategory:null,promptDescriptor:C,selectedCategory:p.title});
1u.mutate({bucketivityProgressId:a??"",data:{eventList:[N]}},{onSuccess:k=>{const E=k.data;g.setQueryData(r,k),b&&m({type:"UPDATE_GAME_STATE",updatedFoaf:E}),L(E.bucketivityProgress.categoryList)}})};return s.jsxs(h.Root,{children:[s.jsxs(h.Content,{className:l("grit categorize flex-1 flex flex-col items-center gap-6 mb-[var(--course-nav-offset-mobile)] desktop:mb-[var(--course-nav-offset-desktop)]",o.phase==="correct"&&"background--foaf-correct",o.phase==="incorrect"&&"background--foaf-incorrect"),children:[s.jsx("div",{className:l("w-full flex justify-center flex-[2] bg-secondary-old shadow-hovering-old border-b-[3px] border-brand-1-old",o.phase==="correct"&&"border-content-positive-old bg-positive-old",o.phase==="incorrect"&&"border-content-negative-old bg-negative-old"),children:s.jsxs("div",{className:l("px-10 py-6 flex items-center basis-full justify-center max-w-[1024px] relative",o.phase!=="idle"&&"[&>.icon]:animate-[fadeInUp_0.2s_both]",o.phase==="idle"&&"[&>p.categorize__descriptor]:animate-[fadeInUp_0.2s_both]"),children:[s.jsx(_,{"data-test":"optionToCategorize",variant:"paragraph-question",weight:"bold",className:"categorize__descriptor opacity-100 translate-y-0","aria-live":"polite","aria-atomic":"true",children:o.phase!=="idle"?s.jsx("span",{className:"sr-only",children:o.message}):C}),o.phase==="correct"&&s.jsx(q,{width:32,height:32,"data-test":"foafResultIconCorrect",className:"absolute text-content-positive-old"}),o.phase==="incorrect"&&s.jsx(Q,{width:32,height:32,"data-test":"foafResultIconIncorrect",className:"absolute text-content-negative-old","aria-hidden":!0})]})}),s.jsx(_,{variant:"paragraph-question",weight:"bold",className:"px-6 text-content-subtle text-center",children:"Choose the category below that the above fact relates to."}),s.jsx("div",{className:l("flex flex-wrap gap-2 w-full px-6 pb-10 max-w-[1024px] [&>button]:flex-[1_0_calc(50%-4px)] max-[600px]:[&>button]:flex-[1_0_100%]",o.phase!=="idle"&&"opacity-50 pointer-events-none"),children:j.map(d=>{const p=d.title===w;return s.jsx(Z,{category:d,isDebugHighlighted:p&&!!i,onAnswer:S,"data-test":p?"foaf-correct-answer":"foaf-incorrect-answer"},d.title)})})]}),s.jsx(re,{isSkippable:T})]})};function re({isSkippable:e}){const{isDebug:r,urlParams:t}=$(),a=r||e;return s.jsx(h.Navigation,{backButton:{text:"Exit Game",callback:()=>x.dispatch({type:y,payload:{url:"foaf.ready",params:{...t}}}),"data-test":"icon-arrow-prev",id:"icon-arrow-prev"},forwardButton:{text:a?X:"",callback:()=>x.dispatch({type:G}),disabled:!a,id:"results-continue-btn",...r?{"data-test":"foaf-skip-game-button"}:{}}})}export{he as default};
2//# sourceMappingURL=index-CxJKUFrI.js.map

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.