diff --git a/dist/assets/AccountSettings-761ab97b.js b/dist/assets/AccountSettings-caa967b3.js similarity index 94% rename from dist/assets/AccountSettings-761ab97b.js rename to dist/assets/AccountSettings-caa967b3.js index 32820780ff..c4d3369ec8 100644 --- a/dist/assets/AccountSettings-761ab97b.js +++ b/dist/assets/AccountSettings-caa967b3.js @@ -1 +1 @@ -import{R as f,p,r as c,b as x,c as v,d as w,j as e,a as i,F as d,B as u}from"./index-61b6fc23.js";function k(l){var a;const o=f(p),[r,g]=c.useState(null);let s=c.useRef(!1);const n=x(v);if(n.state==="loading")return null;if(n.state==="hasError")return console.error(n.contents),null;let h=(a=n==null?void 0:n.contents)==null?void 0:a.email;if(s.current||(s.current=!0,w().then(({cookieRemoved:m})=>{g(m)})),r==null)return null;let t=null;return r?t=i(d,{children:[e("h2",{children:"You are NOT signed in"}),e(u,{value:"Sign in",onClick:()=>{o({page:"signout",tool:"",view:""}),window.location.href="/signin"}})]}):t=i(d,{children:[e("h2",{children:"You are signed in"}),i("p",{children:["Email: ",h]}),e(u,{dataTest:"sign out button",value:"Sign out",onClick:()=>{o({page:"signout",tool:"",view:""})}})]}),e("div",{style:l.style,children:e("div",{style:{...l.style,border:"1px solid var(--mainGray)",borderRadius:"20px",margin:"auto",marginTop:"10%",padding:"10px",width:"50%"},children:e("div",{style:{display:"flex",flexDirection:"column",textAlign:"center",alignItems:"center",marginBottom:"20px"},children:t})})})}export{k as default}; +import{R as f,p,r as c,b as x,c as v,d as w,j as e,a as i,F as d,B as u}from"./index-9d63439d.js";function k(l){var a;const o=f(p),[r,g]=c.useState(null);let s=c.useRef(!1);const n=x(v);if(n.state==="loading")return null;if(n.state==="hasError")return console.error(n.contents),null;let h=(a=n==null?void 0:n.contents)==null?void 0:a.email;if(s.current||(s.current=!0,w().then(({cookieRemoved:m})=>{g(m)})),r==null)return null;let t=null;return r?t=i(d,{children:[e("h2",{children:"You are NOT signed in"}),e(u,{value:"Sign in",onClick:()=>{o({page:"signout",tool:"",view:""}),window.location.href="/signin"}})]}):t=i(d,{children:[e("h2",{children:"You are signed in"}),i("p",{children:["Email: ",h]}),e(u,{dataTest:"sign out button",value:"Sign out",onClick:()=>{o({page:"signout",tool:"",view:""})}})]}),e("div",{style:l.style,children:e("div",{style:{...l.style,border:"1px solid var(--mainGray)",borderRadius:"20px",margin:"auto",marginTop:"10%",padding:"10px",width:"50%"},children:e("div",{style:{display:"flex",flexDirection:"column",textAlign:"center",alignItems:"center",marginBottom:"20px"},children:t})})})}export{k as default}; diff --git a/dist/assets/ActionButton-be9a12e7.js b/dist/assets/ActionButton-056b08c3.js similarity index 97% rename from dist/assets/ActionButton-be9a12e7.js rename to dist/assets/ActionButton-056b08c3.js index c8cdd71674..ced51a0e1f 100644 --- a/dist/assets/ActionButton-be9a12e7.js +++ b/dist/assets/ActionButton-056b08c3.js @@ -1,4 +1,4 @@ -import{j as o,F as h,a as u,s as d}from"./index-61b6fc23.js";const c=d.button` +import{j as o,F as h,a as u,s as d}from"./index-9d63439d.js";const c=d.button` margin: ${e=>e.theme.margin}; height: 24px; width: ${e=>e.width}; diff --git a/dist/assets/ActionButtonGroup-f3a36748.js b/dist/assets/ActionButtonGroup-9e9bafb3.js similarity index 97% rename from dist/assets/ActionButtonGroup-f3a36748.js rename to dist/assets/ActionButtonGroup-9e9bafb3.js index 0c88c0fc8f..8e9fb62b46 100644 --- a/dist/assets/ActionButtonGroup-f3a36748.js +++ b/dist/assets/ActionButtonGroup-9e9bafb3.js @@ -1,4 +1,4 @@ -import{s as r,av as l,j as a,F as f,a as m,aw as p}from"./index-61b6fc23.js";const h=r.div` +import{s as r,av as l,j as a,F as f,a as m,aw as p}from"./index-9d63439d.js";const h=r.div` /* margin-left: 3px; */ display: ${e=>e.vertical?"static":"flex"}; overflow: auto; diff --git a/dist/assets/ActivityDates-af3c7273.js b/dist/assets/ActivityDates-80b1c5c1.js similarity index 54% rename from dist/assets/ActivityDates-af3c7273.js rename to dist/assets/ActivityDates-80b1c5c1.js index e0084da49e..027851a757 100644 --- a/dist/assets/ActivityDates-af3c7273.js +++ b/dist/assets/ActivityDates-80b1c5c1.js @@ -1 +1 @@ -import{l as r,m as A,w as h,j as e,F as o,a as t}from"./index-61b6fc23.js";import{u as g}from"./SettingComponents-d7858e0f.js";import{e as y}from"./RoleDropdown-c9fff172.js";import"./DateTime-3ab576fc.js";import"./moment-b216ba57.js";import"./IncrementMenu-5203e1b9.js";import"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";import"./RelatedItems-33d92928.js";import"./ActionButtonGroup-f3a36748.js";import"./ActionButton-be9a12e7.js";import"./Textfield-637f7b37.js";import"./useSaveDraft-fc810696.js";import"./EditorViewerRecoil-fde09b36.js";function M(){const n=r(A("doenetId")),i=r(h);return e(o,{children:e(D,{doenetId:n,courseId:i})})}function D({doenetId:n,courseId:i}){const{canModifyActivitySettings:v,canViewActivitySettings:p}=r(y(i)),{value:{numberOfAttemptsAllowed:f,timeLimit:l,assignedDate:m,dueDate:a}}=g(i,n);if(p==="1")return e(o,{});let s=f;s===null&&(s="unlimited");let d=null;l!==null&&(d=t("p",{children:["Time Limit: ",l," minutes"]}));let c=null;m!==null&&(c=t("p",{style:{content:"A"},children:["Assigned: ",m]}));let u=e("p",{children:"No Due Date"});return a!==null&&(u=t("p",{children:["Due: ",a]})),e(o,{children:t("div",{children:[c,u,d,t("p",{children:["Attempts Allowed: ",s]})]})})}export{D as AssignmentSettings,M as default}; +import{l as r,m as A,w as h,j as e,F as o,a as t}from"./index-9d63439d.js";import{u as g}from"./SettingComponents-d432c822.js";import{e as y}from"./RoleDropdown-2d4e4388.js";import"./DateTime-b5df08e4.js";import"./moment-a2107d39.js";import"./IncrementMenu-999b207e.js";import"./DropdownMenu-421d3462.js";import"./setPrototypeOf-51e8cf87.js";import"./RelatedItems-23ef0ca1.js";import"./ActionButtonGroup-9e9bafb3.js";import"./ActionButton-056b08c3.js";import"./Textfield-381b1f5a.js";import"./useSaveDraft-50a40c9b.js";import"./EditorViewerRecoil-4f9a7d1d.js";function M(){const n=r(A("doenetId")),i=r(h);return e(o,{children:e(D,{doenetId:n,courseId:i})})}function D({doenetId:n,courseId:i}){const{canModifyActivitySettings:v,canViewActivitySettings:p}=r(y(i)),{value:{numberOfAttemptsAllowed:f,timeLimit:l,assignedDate:m,dueDate:a}}=g(i,n);if(p==="1")return e(o,{});let s=f;s===null&&(s="unlimited");let d=null;l!==null&&(d=t("p",{children:["Time Limit: ",l," minutes"]}));let c=null;m!==null&&(c=t("p",{style:{content:"A"},children:["Assigned: ",m]}));let u=e("p",{children:"No Due Date"});return a!==null&&(u=t("p",{children:["Due: ",a]})),e(o,{children:t("div",{children:[c,u,d,t("p",{children:["Attempts Allowed: ",s]})]})})}export{D as AssignmentSettings,M as default}; diff --git a/dist/assets/ActivityNavigationButtons-dbb0cd4d.js b/dist/assets/ActivityNavigationButtons-93b2dd3c.js similarity index 83% rename from dist/assets/ActivityNavigationButtons-dbb0cd4d.js rename to dist/assets/ActivityNavigationButtons-93b2dd3c.js index 61fb9f30bd..1078e93d13 100644 --- a/dist/assets/ActivityNavigationButtons-dbb0cd4d.js +++ b/dist/assets/ActivityNavigationButtons-93b2dd3c.js @@ -1 +1 @@ -import{r as m,l as d,w as I,m as g,R as f,p as x,a as B,j as v,B as y,az as p,b5 as O,b6 as C,G as l,H as b}from"./index-61b6fc23.js";import{B as P}from"./ButtonGroup-6d856500.js";import{e as h}from"./RoleDropdown-c9fff172.js";import"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";const A=p({key:"itemOrderbyCourseId",get:r=>({get:o})=>{const{canViewUnassignedContent:a}=o(h(r));return o(a==="1"?O(r):C(r))}}),F=p({key:"activityOrderByCourseId",get:r=>({get:o,getCallback:a})=>{const s=o(A(r)).filter(e=>{const t=o(l(e));return(t==null?void 0:t.type)==="activity"&&!t.proctorMakesAvailable}),n=a(({snapshot:e})=>t=>t<0||t>=s.length?{}:e.getLoadable(l(s[t])).getValue()),i=a(({snapshot:e})=>t=>{var c;return t<0||t>=s.length?null:b(((c=e.getLoadable(l(s[t])).getValue())==null?void 0:c.content)??[])});return{value:s,getInfoFromIndex:n,getFirstPageFromIndex:i}}});function j(){const[r,o]=m.useState({previous:null,next:null}),a=d(I),u=d(g("doenetId")),s=f(x),{value:n,getFirstPageFromIndex:i}=d(F(a));return m.useLayoutEffect(()=>{const e=n.indexOf(u);o(e===-1?{previous:null,next:null}:{previous:e>0?{doenetId:n[e-1],pageId:i(e-1)}:null,next:e{s(e=>({...e,params:{...e.params,...r.previous}}))},disabled:r.previous===null}),v(y,{"data-test":"Next Activity Button",value:"Next",onClick:()=>{s(e=>({...e,params:{...e.params,...r.next}}))},disabled:r.next===null})]})}export{j as default}; +import{r as m,l as d,w as I,m as g,R as f,p as x,a as B,j as v,B as y,az as p,b5 as O,b6 as C,G as l,H as b}from"./index-9d63439d.js";import{B as P}from"./ButtonGroup-ec02b3e9.js";import{e as h}from"./RoleDropdown-2d4e4388.js";import"./DropdownMenu-421d3462.js";import"./setPrototypeOf-51e8cf87.js";const A=p({key:"itemOrderbyCourseId",get:r=>({get:o})=>{const{canViewUnassignedContent:a}=o(h(r));return o(a==="1"?O(r):C(r))}}),F=p({key:"activityOrderByCourseId",get:r=>({get:o,getCallback:a})=>{const s=o(A(r)).filter(e=>{const t=o(l(e));return(t==null?void 0:t.type)==="activity"&&!t.proctorMakesAvailable}),n=a(({snapshot:e})=>t=>t<0||t>=s.length?{}:e.getLoadable(l(s[t])).getValue()),i=a(({snapshot:e})=>t=>{var c;return t<0||t>=s.length?null:b(((c=e.getLoadable(l(s[t])).getValue())==null?void 0:c.content)??[])});return{value:s,getInfoFromIndex:n,getFirstPageFromIndex:i}}});function j(){const[r,o]=m.useState({previous:null,next:null}),a=d(I),u=d(g("doenetId")),s=f(x),{value:n,getFirstPageFromIndex:i}=d(F(a));return m.useLayoutEffect(()=>{const e=n.indexOf(u);o(e===-1?{previous:null,next:null}:{previous:e>0?{doenetId:n[e-1],pageId:i(e-1)}:null,next:e{s(e=>({...e,params:{...e.params,...r.previous}}))},disabled:r.previous===null}),v(y,{"data-test":"Next Activity Button",value:"Next",onClick:()=>{s(e=>({...e,params:{...e.params,...r.next}}))},disabled:r.next===null})]})}export{j as default}; diff --git a/dist/assets/ActivityVariant-41db56a8.js b/dist/assets/ActivityVariant-548f5f24.js similarity index 75% rename from dist/assets/ActivityVariant-41db56a8.js rename to dist/assets/ActivityVariant-548f5f24.js index 3bb71c8160..37e46ba94f 100644 --- a/dist/assets/ActivityVariant-41db56a8.js +++ b/dist/assets/ActivityVariant-548f5f24.js @@ -1 +1 @@ -import{g as l,O as u,R as d,p,j as r}from"./index-61b6fc23.js";import{I as c}from"./IncrementMenu-5203e1b9.js";function V(o){const[n,s]=l(u),m=d(p);function t(){m(a=>{let e={...a};return e.params?e.params={...e.params}:e.params={},e.params.requestedVariant=n.index&&Number.isFinite(Number(n.index))?Number(n.index):1,e})}return r("div",{style:o.style,children:r(c,{min:1,value:n.index,onBlur:()=>t(),onKeyDown:a=>{a.key==="Enter"&&t()},onChange:a=>{s(e=>{let i={...e};return i.index=a,i})}})})}export{V as default}; +import{g as l,O as u,R as d,p,j as r}from"./index-9d63439d.js";import{I as c}from"./IncrementMenu-999b207e.js";function V(o){const[n,s]=l(u),m=d(p);function t(){m(a=>{let e={...a};return e.params?e.params={...e.params}:e.params={},e.params.requestedVariant=n.index&&Number.isFinite(Number(n.index))?Number(n.index):1,e})}return r("div",{style:o.style,children:r(c,{min:1,value:n.index,onBlur:()=>t(),onKeyDown:a=>{a.key==="Enter"&&t()},onChange:a=>{s(e=>{let i={...e};return i.index=a,i})}})})}export{V as default}; diff --git a/dist/assets/ActivityViewer-5e9601b2.js b/dist/assets/ActivityViewer-90c65d6d.js similarity index 98% rename from dist/assets/ActivityViewer-5e9601b2.js rename to dist/assets/ActivityViewer-90c65d6d.js index 56a4619c9b..55cf6d8279 100644 --- a/dist/assets/ActivityViewer-5e9601b2.js +++ b/dist/assets/ActivityViewer-90c65d6d.js @@ -1 +1 @@ -import{y as ut,R as G,p as dt,r,g as We,ab as ft,u as gt,e as mt,ad as Be,v as vt,ae as Le,af as K,k as p,z as N,a as A,j as f,P as It,ag as Y,ah as je,ac as yt,ai as Je,i as St,aj as ht,B as T}from"./index-61b6fc23.js";import{p as ve,c as Ct}from"./activityUtils-3e149527.js";import{V as wt}from"./visibility-sensor-398e690f.js";import{A as bt}from"./ActionButton-be9a12e7.js";import{B as At}from"./ButtonGroup-6d856500.js";const Ie=Y({key:"saveStateToDBTimerIdAtom",default:null}),xt=Y({key:"currentPageAtom",default:0}),Pt=Y({key:"activityAttemptNumberSetUpAtom",default:0}),Et=Y({key:"itemWeightsAtom",default:[]});function Ot(t){var Fe;const x=ut(),Me=G(dt),[ye,I]=r.useState(null),[{cidFromProps:h,activityDefinitionFromProps:C,attemptNumber:g,requestedVariantIndex:L},ze]=r.useState({cidFromProps:null,activityDefinitionFromProps:null,attemptNumber:null,requestedVariantIndex:null}),k=r.useRef(null);k.current=g;const[m,H]=r.useState(null),O=r.useRef(null);O.current=m;const Q=r.useRef(null),[P,X]=r.useState(null),[V,Z]=r.useState(null),ee=r.useRef(null);ee.current=V;const[j,w]=r.useState("initial"),Se=r.useRef(null);Se.current=j;const te=r.useRef(!0),[_e,he]=r.useState(!1),[J,ae]=r.useState(null),[ne,Ue]=r.useState(t.flags),[c,E]=r.useState(0),R=G(xt),b=r.useRef(c);b.current=c;const Ce=G(Pt),[u,ie]=r.useState(0),[M,re]=r.useState(null),[se,oe]=We(Et),$=r.useRef([]),ce=r.useRef(null),le=r.useRef(null),ue=r.useRef(!1),we=G(Ie),[qe,Ge]=We(ft),y=r.useRef(null),z=r.useRef(null),be=r.useRef(null),Ae=r.useRef(null),[S,de]=r.useState({pageIsVisible:[],pageIsActive:[],pageCoreWorker:[],waitingForPagesCore:null}),[Ke,Ye]=r.useState([]),fe=r.useRef(!1),F=r.useRef(null),ge=r.useRef(!1),D=r.useRef(null);let v=gt(),d=v.hash;const W=r.useRef({}),_=r.useRef(null),xe=r.useRef(!1),[He,Pe]=r.useState(!1),[Ee,Qe]=r.useState(!1);let Xe=mt();r.useEffect(()=>()=>{U({overrideThrottle:!0}),xe.current=!0},[]),r.useEffect(()=>{let e={...t.flags};t.userId?(e.allowLocalState=!1,e.allowSaveState=!1):e.allowSaveState&&(e.allowLoadState=!0),Ue(e)},[t.userId,t.flags]),r.useEffect(()=>{window.returnActivityData=function(){return{activityDefinition:P,requestedVariantIndex:L,variantIndex:V,cid:m,order:J,currentPage:c,nPages:u,variantsByPage:M,itemWeights:se}}},[P,L,V,m,J,c,u,M,se]),r.useEffect(()=>{if(F.current){let e=F.current.parentNode.id==="mainPanel"?F.current.parentNode:window;Ge(e),!t.paginate&&u>1&&e.addEventListener("scroll",a=>{if(ge.current)ge.current=!1;else{let i;for(let s=0;s{var e;(e=t.pageChangedCallback)==null||e.call(t,c)},[c]),r.useEffect(()=>{if(d&&u){let e=d.match(/^#page(\d+)/);if(e){let a=Math.max(1,Math.min(u,e[1]));a!==c&&(E(a),R(a))}}},[d,u]),r.useEffect(()=>{var e,a;if(c>0&&u>1){if(Number((e=d==null?void 0:d.match(/^#page(\d+)/))==null?void 0:e[1])!==c){let s=`#page${c}`,n={replace:!0};t.paginate||(n.state={doNotScroll:!0}),Xe(v.search+s,n)}D.current&&((a=document.getElementById(D.current))==null||a.scrollIntoView(),D.current=null)}},[c,u]),r.useEffect(()=>{var e;fe.current&&!t.paginate&&(d!=null&&d.match(/^#page(\d+)$/))&&(ge.current=!0,(e=document.getElementById(Be(d.slice(1))))==null||e.scrollIntoView())},[fe.current]),r.useEffect(()=>{var a,i,s,n,o;let e=!1;if(_.current!==v.key&&(((a=v.state)==null?void 0:a.previousScrollPosition)!==void 0&&_.current&&(W.current[_.current].lastScrollPosition=v.state.previousScrollPosition),W.current[v.key]&&(e=!0,((i=W.current[v.key])==null?void 0:i.lastScrollPosition)!==void 0&&qe.scroll({top:W.current[v.key].lastScrollPosition})),W.current[v.key]={...v},_.current=v.key),D.current=null,!((s=v.state)!=null&&s.doNotScroll)&&(v.key==="default"||!e)){let l=Be(d.slice(1));t.paginate&&d.match(/^#page(\d+)$/)&&(l="activityTop"),t.paginate&&Number((n=d.match(/^#page(\d+)/))==null?void 0:n[1])!==c?D.current=l:(o=document.getElementById(l))==null||o.scrollIntoView()}},[v]);const Ze=vt(({snapshot:e})=>async()=>await e.getPromise(Ie),[Ie]);function Re({changedOnDevice:e,newCid:a,newAttemptNumber:i}){console.log("resetActivity",e,a,i),i!==g?t.updateAttemptNumber?(x("Reverted activity as attempt number changed on other device",N.ERROR),t.updateAttemptNumber(i)):(t.setIsInErrorState&&t.setIsInErrorState(!0),I("how to reset attempt number when not given updateAttemptNumber function?")):a!==m&&(t.setIsInErrorState&&t.setIsInErrorState(!0),I("Content changed unexpectedly!"))}function et(){C?h?je(JSON.stringify(C)).then(e=>{if(e===h){H(h),Q.current=C;let a=ve(C);a.success?(X(a.activityJSON),w("continue")):(t.setIsInErrorState&&t.setIsInErrorState(!0),I(a.message))}else t.setIsInErrorState&&t.setIsInErrorState(!0),I(`activity definition did not match specified cid: ${h}`)}):je(JSON.stringify(C)).then(e=>{H(e),Q.current=C;let a=ve(C);a.success?(X(a.activityJSON),w("continue")):(t.setIsInErrorState&&t.setIsInErrorState(!0),I(a.message))}):yt(h,"doenet").then(e=>{H(h),Q.current=e;let a=ve(e);a.success?(X(a.activityJSON),w("continue")):(t.setIsInErrorState&&t.setIsInErrorState(!0),I(a.message))}).catch(e=>{t.setIsInErrorState&&t.setIsInErrorState(!0),I(`activity definition not found for cid: ${h}`)})}async function tt(){let e=!1,a,i,s=!1;if(t.flags.allowLocalState){let n;try{n=await Je(`${t.doenetId}|${g}|${m}`)}catch{}if(n){if(t.flags.allowSaveState){let l=await at(n);if(l.changedOnDevice){if(Number(l.newAttemptNumber)!==g){Re({changedOnDevice:l.changedOnDevice,newCid:l.newCid,newAttemptNumber:Number(l.newAttemptNumber)});return}else l.newCid!==m&&(t.setIsInErrorState&&t.setIsInErrorState(!0),I("content changed unexpectedly!"));n=l.newLocalInfo}}ce.current=n.saveId,d!=null&&d.match(/^#page(\d+)/)||(E(n.activityState.currentPage),R(n.activityState.currentPage));let o=n.activityInfo;i=n.variantIndex,Z(i),ie(o.orderWithCids.length),ae(o.orderWithCids),re(o.variantsByPage),oe(o.itemWeights),a=o.itemWeights,$.current=o.previousComponentTypeCounts||[],y.current=o,z.current=JSON.stringify(y.current),e=!0}}if(!e){const n={params:{cid:m,attemptNumber:g,doenetId:t.doenetId,userId:t.userId,allowLoadState:t.flags.allowLoadState}};let o;try{if(o=await p.get("/api/loadActivityState.php",n),!o.data.success&&t.flags.allowLoadState){t.setIsInErrorState&&t.setIsInErrorState(!0),I(`Error loading activity state: ${o.data.message}`);return}}catch(l){if(t.flags.allowLoadState){t.setIsInErrorState&&t.setIsInErrorState(!0),I(`Error loading activity state: ${l.message}`);return}}if(o.data.loadedState){let l=JSON.parse(o.data.activityInfo),De=JSON.parse(o.data.activityState);d!=null&&d.match(/^#page(\d+)/)||(E(De.currentPage),R(De.currentPage)),i=o.data.variantIndex,Z(i),ie(l.orderWithCids.length),ae(l.orderWithCids),re(l.variantsByPage),oe(l.itemWeights),a=l.itemWeights,$.current=l.previousComponentTypeCounts||[],y.current=l,z.current=JSON.stringify(y.current)}else{s=!0,d!=null&&d.match(/^#page(\d+)/)||(E(1),R(1));let l;if(l=await Ct({activityDefinition:P,requestedVariantIndex:L}),!l.success){t.setIsInErrorState&&t.setIsInErrorState(!0),I(`Error initializing activity state: ${l.message}`);return}i=l.variantIndex,Z(i),ie(l.order.length),ae(l.order),re(l.variantsByPage),oe(l.itemWeights),a=l.itemWeights,$.current=l.previousComponentTypeCounts||[],y.current=l.activityInfo,z.current=JSON.stringify(y.current)}}return{newItemWeights:a,newVariantIndex:i,loadedFromInitialState:s}}async function at(e){let a=await Je(`${t.doenetId}|${g}|${m}|ServerSaveId`),i={cid:m,activityInfo:JSON.stringify(e.activityInfo),activityState:JSON.stringify(e.activityState),variantIndex:e.variantIndex,attemptNumber:g,doenetId:t.doenetId,saveId:e.saveId,serverSaveId:a,updateDataOnContentChange:t.updateDataOnContentChange},s;try{console.log("first one saveActivityState activityStateToBeSavedToDatabase",i),s=await p.post("/api/saveActivityState.php",i)}catch{return{localInfo:e,cid:m,attemptNumber:g}}s.data.cidChanged===!0&&t.cidChangedCallback();let n=s.data;if(!n.success)return{localInfo:e,cid:m,attemptNumber:g};if(await K(`${t.doenetId}|${g}|${m}|ServerSaveId`,n.saveId),n.stateOverwritten){let o={activityState:JSON.parse(n.activityState),activityInfo:JSON.parse(n.activityInfo),saveId:n.saveId,variantIndex:n.variantIndex};return await K(`${t.doenetId}|${n.attemptNumber}|${n.cid}`,o),{changedOnDevice:n.device,newLocalInfo:o,newCid:n.cid,newAttemptNumber:n.attemptNumber}}return{localInfo:e,cid:m,attemptNumber:g}}async function U({overrideThrottle:e=!1,overrideStage:a=!1}={}){if(!t.flags.allowSaveState&&!t.flags.allowLocalState||Se.current!=="saving"&&!a||!e&&b.current===be.current||e&&b.current===Ae.current)return;be.current=b.current;let i=Le();t.flags.allowLocalState&&await K(`${t.doenetId}|${k.current}|${O.current}`,{activityInfo:y.current,activityState:{currentPage:b.current},saveId:i,variantIndex:ee.current}),t.flags.allowSaveState&&(le.current={cid:O.current,activityInfo:z.current,activityState:JSON.stringify({currentPage:b.current}),variantIndex:ee.current,attemptNumber:k.current,doenetId:t.doenetId,saveId:i,serverSaveId:ce.current,updateDataOnContentChange:t.updateDataOnContentChange},ue.current=!0,await pe(e))}async function pe(e){if(!ue.current)return;let a=await Ze();if(a!==null)if(e)clearTimeout(a);else return;ue.current=!1,Ae.current=b.current;let i=setTimeout(()=>{we(null),pe()},6e4);we(i);let s;try{console.log("activity state params",le.current),s=await p.post("/api/saveActivityState.php",le.current)}catch{console.log("sending toast: Error synchronizing data. Changes not saved to the server."),x("Error synchronizing data. Changes not saved to the server.",N.ERROR);return}if(console.log("result from saving activity to database:",s.data),s.status===null){console.log("sending toast: Error synchronizing data. Changes not saved to the server. Are you connected to the internet?"),x("Error synchronizing data. Changes not saved to the server. Are you connected to the internet?",N.ERROR);return}let n=s.data;if(!n.success){console.log(`sending toast: ${n.message}`),x(n.message,N.ERROR);return}if(ce.current=n.saveId,t.flags.allowLocalState&&await K(`${t.doenetId}|${k.current}|${O.current}|ServerSaveId`,n.saveId),n.stateOverwritten){if(k.current!==Number(n.attemptNumber))Re({changedOnDevice:n.device,newCid:n.cid,newAttemptNumber:Number(n.attemptNumber)});else if(O.current!==n.cid){t.setIsInErrorState&&t.setIsInErrorState(!0),I("Content changed unexpectedly!");return}}}async function nt(e){if(ne.allowSaveSubmissions)try{let a=await p.post("/api/initAssignmentAttempt.php",{doenetId:t.doenetId,weights:e,attemptNumber:g});a.status===null?x("Could not initialize assignment tables. Are you connected to the internet?",N.ERROR):a.data.success||x(`Could not initialize assignment tables: ${a.data.message}.`,N.ERROR)}catch(a){x(`Could not initialize assignment tables: ${a.message}.`,N.ERROR)}}async function it(){j!=="saving"&&!te.current&&w("saving");try{(await p.get("/api/checkForChangedAssignment.php",{params:{currentCid:m,doenetId:t.doenetId}})).data.cidChanged===!0&&t.cidChangedCallback()}catch{}xe.current&&await U({overrideThrottle:!0,overrideStage:!0})}function Ne(){E(a=>Math.min(u,a+1)),R(a=>Math.min(u,a+1));let e={verb:"interacted",object:{objectType:"button",objectname:"next page button"},result:{newPage:Math.min(u,c+1)},context:{oldPage:c}};ke(e)}function Te(){E(a=>Math.max(1,a-1)),R(a=>Math.max(1,a-1));let e={verb:"interacted",object:{objectType:"button",objectname:"previous page button"},result:{newPage:Math.max(1,c-1)},context:{oldPage:c}};ke(e)}function ke(e){if(!ne.allowSaveEvents)return;const a={doenetId:t.doenetId,activityCid:m,attemptNumber:g,activityVariantIndex:V,timestamp:new Date().toISOString().slice(0,19).replace("T"," "),version:"0.1.1",verb:e.verb,object:JSON.stringify(e.object),result:JSON.stringify(e.result),context:JSON.stringify(e.context)};p.post("/api/recordEvent.php",a).then(i=>{}).catch(i=>{console.error(`Error saving event: ${i.message}`)})}function rt(e,a){t.paginate||de(i=>{let s={...i},n=[...s.pageIsVisible];if(n[a]=e,s.pageIsVisible=n,!e&&s.pageIsActive[a]){let o=[...s.pageIsActive];o[a]=!1,s.pageIsActive=o,s.waitingForPagesCore===a&&(s.waitingForPagesCore=null)}return s})}function st(e,a){de(i=>{let s={...i};s.waitingForPagesCore===e&&(s.waitingForPagesCore=null);let n=[...s.pageCoreWorker];return n[e]=a,s.pageCoreWorker=n,s})}function ot(e){let a;Ye(i=>(a=[...i],a[e]=!0,a)),(a==null?void 0:a.length)===u&&a.every(i=>i)&&(fe.current=!0)}async function ct(){Qe(!0);let e=[];for(let i of S.pageCoreWorker)if(i){let s=Le(),n;e.push(new Promise((o,l)=>{n=o})),i.onmessage=function(o){o.data.messageType==="resolveAction"&&o.data.args.actionId===s?i.postMessage({messageType:"terminate"}):o.data.messageType==="terminated"&&n()},i.postMessage({messageType:"submitAllAnswers",args:{actionId:s}})}await Promise.all(e),await U({overrideThrottle:!0}),y.canViewAfterCompleted,(await p.get("/api/saveCompleted.php",{params:{doenetId:t.doenetId,isCompleted:!0}})).data.success&&(t==null||t.setActivityAsCompleted(),Me(i=>({page:i.page,tool:"endExam",view:"",params:{doenetId:t.doenetId,attemptNumber:g,itemWeights:se.join(",")}})))}if(ye!==null)return A("div",{style:{fontSize:"1.3em",marginLeft:"20px",marginTop:"20px"},children:[f("span",{style:{fontSize:"1em",color:"#C1292E"},children:f(St,{icon:ht})})," ",ye]});if(S.waitingForPagesCore===null&&c){for(let e of[c-1,...Array(u).keys()])if((S.pageIsVisible[e]||c===e+1)&&!S.pageIsActive[e]){let i=!S.pageCoreWorker[e];if(de(s=>{let n={...s},o=[...n.pageIsActive];return o[e]=!0,n.pageIsActive=o,n.pageCoreWorker[e]||(n.waitingForPagesCore=e),n}),i)break}}let B=t.attemptNumber;B===void 0&&(B=1);let q=t.requestedVariantIndex;if(q===void 0&&(q=B),C!==t.activityDefinition||h!==t.cid||B!==g||L!==q)return te.current=!0,ze({activityDefinitionFromProps:t.activityDefinition,cidFromProps:t.cid,attemptNumber:B,requestedVariantIndex:q}),w("recalcParams"),he(!0),null;if(j==="wait")return null;if(j==="recalcParams")return w("wait"),et(),null;if(((Fe=P==null?void 0:P.type)==null?void 0:Fe.toLowerCase())!=="activity")return t.setIsInErrorState&&t.setIsInErrorState(!0),I("Invalid activity definition: type is not activity"),null;if(_e)return he(!1),Ce(0),$.current=[],w("wait"),tt().then(async e=>{var a;e&&(e.loadedFromInitialState&&await nt(e.newItemWeights),w("continue"),Ce(g),(a=t.generatedVariantCallback)==null||a.call(t,e.newVariantIndex,y.current.numberOfVariants)),te.current=!1}),null;U();let lt=f("h1",{children:P.title}),Oe=[];if(J&&M)for(let[e,a]of J.entries()){let i=!1;t.paginate?(e===c-1||S.pageCoreWorker[c-1]&&e===c||S.pageCoreWorker[c-1]&&(c===u||S.pageCoreWorker[c])&&e===c-2)&&(i=!0):i=S.pageIsActive[e];let s=u>1?`page${e+1}`:"",n=f(It,{userId:t.userId,doenetId:t.doenetId,activityCid:m,cid:a.cid,doenetML:a.doenetML,pageNumber:(e+1).toString(),previousComponentTypeCounts:$.current[e],pageIsActive:i,pageIsCurrent:e===c-1,itemNumber:e+1,attemptNumber:g,forceDisable:t.forceDisable,forceShowCorrectness:t.forceShowCorrectness,forceShowSolution:t.forceShowSolution,forceUnsuppressCheckwork:t.forceUnsuppressCheckwork,flags:ne,activityVariantIndex:V,requestedVariantIndex:M[e],unbundledCore:t.unbundledCore,updateCreditAchievedCallback:t.updateCreditAchievedCallback,setIsInErrorState:t.setIsInErrorState,updateAttemptNumber:t.updateAttemptNumber,saveStateCallback:it,updateDataOnContentChange:t.updateDataOnContentChange,coreCreatedCallback:o=>st(e,o),renderersInitializedCallback:()=>ot(e),hideWhenNotCurrent:t.paginate,prefixForIds:s});t.paginate||(n=f(wt,{partialVisibility:!0,offset:{top:-200,bottom:-200},requireContentsSize:!1,onChange:o=>rt(o,e),children:f("div",{children:n})})),Oe.push(f("div",{id:`page${e+1}`,children:n},`page${e+1}`))}let Ve=null,$e=null;t.paginate&&u>1&&(Ve=A("div",{style:{display:"flex",alignItems:"center",marginLeft:"5px"},children:[f(T,{dataTest:"previous",disabled:c===1,onClick:Te,value:"Previous page"}),A("p",{style:{margin:"5px"},children:[" Page ",c," of ",u," "]}),f(T,{dataTest:"next",disabled:c===u,onClick:Ne,value:"Next page"})]}),Ke[c-1]&&($e=A("div",{style:{display:"flex",alignItems:"center",marginLeft:"5px"},children:[f(T,{dataTest:"previous-bottom",disabled:c===1,onClick:Te,value:"Previous page"}),A("p",{style:{margin:"5px"},children:[" Page ",c," of ",u," "]}),f(T,{dataTest:"next-bottom",disabled:c===u,onClick:Ne,value:"Next page"})]})));let me=null;return t.showFinishButton&&(He?me=A("div",{style:{marginLeft:"1px",marginRight:"5px",marginBottom:"5px",marginTop:"80px",border:"var(--mainBorder)",borderRadius:"var(--mainBorderRadius)",padding:"5px",display:"flex",flexFlow:"column wrap"},children:[f("div",{style:{display:"flex",justifyContent:"center",padding:"5px"},children:"Are you sure you want to finish this assessment?"}),f("div",{style:{display:"flex",justifyContent:"center",padding:"5px"},children:A(At,{children:[f(T,{onClick:ct,dataTest:"ConfirmFinishAssessment",value:"Yes",disabled:Ee}),f(T,{onClick:()=>Pe(!1),dataTest:"CancelFinishAssessment",value:"No",alert:!0,disabled:Ee})]})})]}):me=f("div",{style:{marginLeft:"1px",marginRight:"5px",marginBottom:"5px",marginTop:"80px"},children:f("div",{"data-test":"centerone",style:{display:"flex",justifyContent:"center"},children:f("div",{style:{width:"240px"},children:f(bt,{onClick:()=>Pe(!0),"data-test":"FinishAssessmentPrompt",value:"Finish assessment"})})})})),A("div",{style:{paddingBottom:"50vh"},id:"activityTop",ref:F,children:[Ve,lt,Oe,$e,me]})}export{Ot as A,Pt as a,xt as c,Et as i,Ie as s}; +import{y as ut,R as G,p as dt,r,g as We,ab as ft,u as gt,e as mt,ad as Be,v as vt,ae as Le,af as K,k as p,z as N,a as A,j as f,P as It,ag as Y,ah as je,ac as yt,ai as Je,i as St,aj as ht,B as T}from"./index-9d63439d.js";import{p as ve,c as Ct}from"./activityUtils-5d3d0ed0.js";import{V as wt}from"./visibility-sensor-aefdbbd5.js";import{A as bt}from"./ActionButton-056b08c3.js";import{B as At}from"./ButtonGroup-ec02b3e9.js";const Ie=Y({key:"saveStateToDBTimerIdAtom",default:null}),xt=Y({key:"currentPageAtom",default:0}),Pt=Y({key:"activityAttemptNumberSetUpAtom",default:0}),Et=Y({key:"itemWeightsAtom",default:[]});function Ot(t){var Fe;const x=ut(),Me=G(dt),[ye,I]=r.useState(null),[{cidFromProps:h,activityDefinitionFromProps:C,attemptNumber:g,requestedVariantIndex:L},ze]=r.useState({cidFromProps:null,activityDefinitionFromProps:null,attemptNumber:null,requestedVariantIndex:null}),k=r.useRef(null);k.current=g;const[m,H]=r.useState(null),O=r.useRef(null);O.current=m;const Q=r.useRef(null),[P,X]=r.useState(null),[V,Z]=r.useState(null),ee=r.useRef(null);ee.current=V;const[j,w]=r.useState("initial"),Se=r.useRef(null);Se.current=j;const te=r.useRef(!0),[_e,he]=r.useState(!1),[J,ae]=r.useState(null),[ne,Ue]=r.useState(t.flags),[c,E]=r.useState(0),R=G(xt),b=r.useRef(c);b.current=c;const Ce=G(Pt),[u,ie]=r.useState(0),[M,re]=r.useState(null),[se,oe]=We(Et),$=r.useRef([]),ce=r.useRef(null),le=r.useRef(null),ue=r.useRef(!1),we=G(Ie),[qe,Ge]=We(ft),y=r.useRef(null),z=r.useRef(null),be=r.useRef(null),Ae=r.useRef(null),[S,de]=r.useState({pageIsVisible:[],pageIsActive:[],pageCoreWorker:[],waitingForPagesCore:null}),[Ke,Ye]=r.useState([]),fe=r.useRef(!1),F=r.useRef(null),ge=r.useRef(!1),D=r.useRef(null);let v=gt(),d=v.hash;const W=r.useRef({}),_=r.useRef(null),xe=r.useRef(!1),[He,Pe]=r.useState(!1),[Ee,Qe]=r.useState(!1);let Xe=mt();r.useEffect(()=>()=>{U({overrideThrottle:!0}),xe.current=!0},[]),r.useEffect(()=>{let e={...t.flags};t.userId?(e.allowLocalState=!1,e.allowSaveState=!1):e.allowSaveState&&(e.allowLoadState=!0),Ue(e)},[t.userId,t.flags]),r.useEffect(()=>{window.returnActivityData=function(){return{activityDefinition:P,requestedVariantIndex:L,variantIndex:V,cid:m,order:J,currentPage:c,nPages:u,variantsByPage:M,itemWeights:se}}},[P,L,V,m,J,c,u,M,se]),r.useEffect(()=>{if(F.current){let e=F.current.parentNode.id==="mainPanel"?F.current.parentNode:window;Ge(e),!t.paginate&&u>1&&e.addEventListener("scroll",a=>{if(ge.current)ge.current=!1;else{let i;for(let s=0;s{var e;(e=t.pageChangedCallback)==null||e.call(t,c)},[c]),r.useEffect(()=>{if(d&&u){let e=d.match(/^#page(\d+)/);if(e){let a=Math.max(1,Math.min(u,e[1]));a!==c&&(E(a),R(a))}}},[d,u]),r.useEffect(()=>{var e,a;if(c>0&&u>1){if(Number((e=d==null?void 0:d.match(/^#page(\d+)/))==null?void 0:e[1])!==c){let s=`#page${c}`,n={replace:!0};t.paginate||(n.state={doNotScroll:!0}),Xe(v.search+s,n)}D.current&&((a=document.getElementById(D.current))==null||a.scrollIntoView(),D.current=null)}},[c,u]),r.useEffect(()=>{var e;fe.current&&!t.paginate&&(d!=null&&d.match(/^#page(\d+)$/))&&(ge.current=!0,(e=document.getElementById(Be(d.slice(1))))==null||e.scrollIntoView())},[fe.current]),r.useEffect(()=>{var a,i,s,n,o;let e=!1;if(_.current!==v.key&&(((a=v.state)==null?void 0:a.previousScrollPosition)!==void 0&&_.current&&(W.current[_.current].lastScrollPosition=v.state.previousScrollPosition),W.current[v.key]&&(e=!0,((i=W.current[v.key])==null?void 0:i.lastScrollPosition)!==void 0&&qe.scroll({top:W.current[v.key].lastScrollPosition})),W.current[v.key]={...v},_.current=v.key),D.current=null,!((s=v.state)!=null&&s.doNotScroll)&&(v.key==="default"||!e)){let l=Be(d.slice(1));t.paginate&&d.match(/^#page(\d+)$/)&&(l="activityTop"),t.paginate&&Number((n=d.match(/^#page(\d+)/))==null?void 0:n[1])!==c?D.current=l:(o=document.getElementById(l))==null||o.scrollIntoView()}},[v]);const Ze=vt(({snapshot:e})=>async()=>await e.getPromise(Ie),[Ie]);function Re({changedOnDevice:e,newCid:a,newAttemptNumber:i}){console.log("resetActivity",e,a,i),i!==g?t.updateAttemptNumber?(x("Reverted activity as attempt number changed on other device",N.ERROR),t.updateAttemptNumber(i)):(t.setIsInErrorState&&t.setIsInErrorState(!0),I("how to reset attempt number when not given updateAttemptNumber function?")):a!==m&&(t.setIsInErrorState&&t.setIsInErrorState(!0),I("Content changed unexpectedly!"))}function et(){C?h?je(JSON.stringify(C)).then(e=>{if(e===h){H(h),Q.current=C;let a=ve(C);a.success?(X(a.activityJSON),w("continue")):(t.setIsInErrorState&&t.setIsInErrorState(!0),I(a.message))}else t.setIsInErrorState&&t.setIsInErrorState(!0),I(`activity definition did not match specified cid: ${h}`)}):je(JSON.stringify(C)).then(e=>{H(e),Q.current=C;let a=ve(C);a.success?(X(a.activityJSON),w("continue")):(t.setIsInErrorState&&t.setIsInErrorState(!0),I(a.message))}):yt(h,"doenet").then(e=>{H(h),Q.current=e;let a=ve(e);a.success?(X(a.activityJSON),w("continue")):(t.setIsInErrorState&&t.setIsInErrorState(!0),I(a.message))}).catch(e=>{t.setIsInErrorState&&t.setIsInErrorState(!0),I(`activity definition not found for cid: ${h}`)})}async function tt(){let e=!1,a,i,s=!1;if(t.flags.allowLocalState){let n;try{n=await Je(`${t.doenetId}|${g}|${m}`)}catch{}if(n){if(t.flags.allowSaveState){let l=await at(n);if(l.changedOnDevice){if(Number(l.newAttemptNumber)!==g){Re({changedOnDevice:l.changedOnDevice,newCid:l.newCid,newAttemptNumber:Number(l.newAttemptNumber)});return}else l.newCid!==m&&(t.setIsInErrorState&&t.setIsInErrorState(!0),I("content changed unexpectedly!"));n=l.newLocalInfo}}ce.current=n.saveId,d!=null&&d.match(/^#page(\d+)/)||(E(n.activityState.currentPage),R(n.activityState.currentPage));let o=n.activityInfo;i=n.variantIndex,Z(i),ie(o.orderWithCids.length),ae(o.orderWithCids),re(o.variantsByPage),oe(o.itemWeights),a=o.itemWeights,$.current=o.previousComponentTypeCounts||[],y.current=o,z.current=JSON.stringify(y.current),e=!0}}if(!e){const n={params:{cid:m,attemptNumber:g,doenetId:t.doenetId,userId:t.userId,allowLoadState:t.flags.allowLoadState}};let o;try{if(o=await p.get("/api/loadActivityState.php",n),!o.data.success&&t.flags.allowLoadState){t.setIsInErrorState&&t.setIsInErrorState(!0),I(`Error loading activity state: ${o.data.message}`);return}}catch(l){if(t.flags.allowLoadState){t.setIsInErrorState&&t.setIsInErrorState(!0),I(`Error loading activity state: ${l.message}`);return}}if(o.data.loadedState){let l=JSON.parse(o.data.activityInfo),De=JSON.parse(o.data.activityState);d!=null&&d.match(/^#page(\d+)/)||(E(De.currentPage),R(De.currentPage)),i=o.data.variantIndex,Z(i),ie(l.orderWithCids.length),ae(l.orderWithCids),re(l.variantsByPage),oe(l.itemWeights),a=l.itemWeights,$.current=l.previousComponentTypeCounts||[],y.current=l,z.current=JSON.stringify(y.current)}else{s=!0,d!=null&&d.match(/^#page(\d+)/)||(E(1),R(1));let l;if(l=await Ct({activityDefinition:P,requestedVariantIndex:L}),!l.success){t.setIsInErrorState&&t.setIsInErrorState(!0),I(`Error initializing activity state: ${l.message}`);return}i=l.variantIndex,Z(i),ie(l.order.length),ae(l.order),re(l.variantsByPage),oe(l.itemWeights),a=l.itemWeights,$.current=l.previousComponentTypeCounts||[],y.current=l.activityInfo,z.current=JSON.stringify(y.current)}}return{newItemWeights:a,newVariantIndex:i,loadedFromInitialState:s}}async function at(e){let a=await Je(`${t.doenetId}|${g}|${m}|ServerSaveId`),i={cid:m,activityInfo:JSON.stringify(e.activityInfo),activityState:JSON.stringify(e.activityState),variantIndex:e.variantIndex,attemptNumber:g,doenetId:t.doenetId,saveId:e.saveId,serverSaveId:a,updateDataOnContentChange:t.updateDataOnContentChange},s;try{console.log("first one saveActivityState activityStateToBeSavedToDatabase",i),s=await p.post("/api/saveActivityState.php",i)}catch{return{localInfo:e,cid:m,attemptNumber:g}}s.data.cidChanged===!0&&t.cidChangedCallback();let n=s.data;if(!n.success)return{localInfo:e,cid:m,attemptNumber:g};if(await K(`${t.doenetId}|${g}|${m}|ServerSaveId`,n.saveId),n.stateOverwritten){let o={activityState:JSON.parse(n.activityState),activityInfo:JSON.parse(n.activityInfo),saveId:n.saveId,variantIndex:n.variantIndex};return await K(`${t.doenetId}|${n.attemptNumber}|${n.cid}`,o),{changedOnDevice:n.device,newLocalInfo:o,newCid:n.cid,newAttemptNumber:n.attemptNumber}}return{localInfo:e,cid:m,attemptNumber:g}}async function U({overrideThrottle:e=!1,overrideStage:a=!1}={}){if(!t.flags.allowSaveState&&!t.flags.allowLocalState||Se.current!=="saving"&&!a||!e&&b.current===be.current||e&&b.current===Ae.current)return;be.current=b.current;let i=Le();t.flags.allowLocalState&&await K(`${t.doenetId}|${k.current}|${O.current}`,{activityInfo:y.current,activityState:{currentPage:b.current},saveId:i,variantIndex:ee.current}),t.flags.allowSaveState&&(le.current={cid:O.current,activityInfo:z.current,activityState:JSON.stringify({currentPage:b.current}),variantIndex:ee.current,attemptNumber:k.current,doenetId:t.doenetId,saveId:i,serverSaveId:ce.current,updateDataOnContentChange:t.updateDataOnContentChange},ue.current=!0,await pe(e))}async function pe(e){if(!ue.current)return;let a=await Ze();if(a!==null)if(e)clearTimeout(a);else return;ue.current=!1,Ae.current=b.current;let i=setTimeout(()=>{we(null),pe()},6e4);we(i);let s;try{console.log("activity state params",le.current),s=await p.post("/api/saveActivityState.php",le.current)}catch{console.log("sending toast: Error synchronizing data. Changes not saved to the server."),x("Error synchronizing data. Changes not saved to the server.",N.ERROR);return}if(console.log("result from saving activity to database:",s.data),s.status===null){console.log("sending toast: Error synchronizing data. Changes not saved to the server. Are you connected to the internet?"),x("Error synchronizing data. Changes not saved to the server. Are you connected to the internet?",N.ERROR);return}let n=s.data;if(!n.success){console.log(`sending toast: ${n.message}`),x(n.message,N.ERROR);return}if(ce.current=n.saveId,t.flags.allowLocalState&&await K(`${t.doenetId}|${k.current}|${O.current}|ServerSaveId`,n.saveId),n.stateOverwritten){if(k.current!==Number(n.attemptNumber))Re({changedOnDevice:n.device,newCid:n.cid,newAttemptNumber:Number(n.attemptNumber)});else if(O.current!==n.cid){t.setIsInErrorState&&t.setIsInErrorState(!0),I("Content changed unexpectedly!");return}}}async function nt(e){if(ne.allowSaveSubmissions)try{let a=await p.post("/api/initAssignmentAttempt.php",{doenetId:t.doenetId,weights:e,attemptNumber:g});a.status===null?x("Could not initialize assignment tables. Are you connected to the internet?",N.ERROR):a.data.success||x(`Could not initialize assignment tables: ${a.data.message}.`,N.ERROR)}catch(a){x(`Could not initialize assignment tables: ${a.message}.`,N.ERROR)}}async function it(){j!=="saving"&&!te.current&&w("saving");try{(await p.get("/api/checkForChangedAssignment.php",{params:{currentCid:m,doenetId:t.doenetId}})).data.cidChanged===!0&&t.cidChangedCallback()}catch{}xe.current&&await U({overrideThrottle:!0,overrideStage:!0})}function Ne(){E(a=>Math.min(u,a+1)),R(a=>Math.min(u,a+1));let e={verb:"interacted",object:{objectType:"button",objectname:"next page button"},result:{newPage:Math.min(u,c+1)},context:{oldPage:c}};ke(e)}function Te(){E(a=>Math.max(1,a-1)),R(a=>Math.max(1,a-1));let e={verb:"interacted",object:{objectType:"button",objectname:"previous page button"},result:{newPage:Math.max(1,c-1)},context:{oldPage:c}};ke(e)}function ke(e){if(!ne.allowSaveEvents)return;const a={doenetId:t.doenetId,activityCid:m,attemptNumber:g,activityVariantIndex:V,timestamp:new Date().toISOString().slice(0,19).replace("T"," "),version:"0.1.1",verb:e.verb,object:JSON.stringify(e.object),result:JSON.stringify(e.result),context:JSON.stringify(e.context)};p.post("/api/recordEvent.php",a).then(i=>{}).catch(i=>{console.error(`Error saving event: ${i.message}`)})}function rt(e,a){t.paginate||de(i=>{let s={...i},n=[...s.pageIsVisible];if(n[a]=e,s.pageIsVisible=n,!e&&s.pageIsActive[a]){let o=[...s.pageIsActive];o[a]=!1,s.pageIsActive=o,s.waitingForPagesCore===a&&(s.waitingForPagesCore=null)}return s})}function st(e,a){de(i=>{let s={...i};s.waitingForPagesCore===e&&(s.waitingForPagesCore=null);let n=[...s.pageCoreWorker];return n[e]=a,s.pageCoreWorker=n,s})}function ot(e){let a;Ye(i=>(a=[...i],a[e]=!0,a)),(a==null?void 0:a.length)===u&&a.every(i=>i)&&(fe.current=!0)}async function ct(){Qe(!0);let e=[];for(let i of S.pageCoreWorker)if(i){let s=Le(),n;e.push(new Promise((o,l)=>{n=o})),i.onmessage=function(o){o.data.messageType==="resolveAction"&&o.data.args.actionId===s?i.postMessage({messageType:"terminate"}):o.data.messageType==="terminated"&&n()},i.postMessage({messageType:"submitAllAnswers",args:{actionId:s}})}await Promise.all(e),await U({overrideThrottle:!0}),y.canViewAfterCompleted,(await p.get("/api/saveCompleted.php",{params:{doenetId:t.doenetId,isCompleted:!0}})).data.success&&(t==null||t.setActivityAsCompleted(),Me(i=>({page:i.page,tool:"endExam",view:"",params:{doenetId:t.doenetId,attemptNumber:g,itemWeights:se.join(",")}})))}if(ye!==null)return A("div",{style:{fontSize:"1.3em",marginLeft:"20px",marginTop:"20px"},children:[f("span",{style:{fontSize:"1em",color:"#C1292E"},children:f(St,{icon:ht})})," ",ye]});if(S.waitingForPagesCore===null&&c){for(let e of[c-1,...Array(u).keys()])if((S.pageIsVisible[e]||c===e+1)&&!S.pageIsActive[e]){let i=!S.pageCoreWorker[e];if(de(s=>{let n={...s},o=[...n.pageIsActive];return o[e]=!0,n.pageIsActive=o,n.pageCoreWorker[e]||(n.waitingForPagesCore=e),n}),i)break}}let B=t.attemptNumber;B===void 0&&(B=1);let q=t.requestedVariantIndex;if(q===void 0&&(q=B),C!==t.activityDefinition||h!==t.cid||B!==g||L!==q)return te.current=!0,ze({activityDefinitionFromProps:t.activityDefinition,cidFromProps:t.cid,attemptNumber:B,requestedVariantIndex:q}),w("recalcParams"),he(!0),null;if(j==="wait")return null;if(j==="recalcParams")return w("wait"),et(),null;if(((Fe=P==null?void 0:P.type)==null?void 0:Fe.toLowerCase())!=="activity")return t.setIsInErrorState&&t.setIsInErrorState(!0),I("Invalid activity definition: type is not activity"),null;if(_e)return he(!1),Ce(0),$.current=[],w("wait"),tt().then(async e=>{var a;e&&(e.loadedFromInitialState&&await nt(e.newItemWeights),w("continue"),Ce(g),(a=t.generatedVariantCallback)==null||a.call(t,e.newVariantIndex,y.current.numberOfVariants)),te.current=!1}),null;U();let lt=f("h1",{children:P.title}),Oe=[];if(J&&M)for(let[e,a]of J.entries()){let i=!1;t.paginate?(e===c-1||S.pageCoreWorker[c-1]&&e===c||S.pageCoreWorker[c-1]&&(c===u||S.pageCoreWorker[c])&&e===c-2)&&(i=!0):i=S.pageIsActive[e];let s=u>1?`page${e+1}`:"",n=f(It,{userId:t.userId,doenetId:t.doenetId,activityCid:m,cid:a.cid,doenetML:a.doenetML,pageNumber:(e+1).toString(),previousComponentTypeCounts:$.current[e],pageIsActive:i,pageIsCurrent:e===c-1,itemNumber:e+1,attemptNumber:g,forceDisable:t.forceDisable,forceShowCorrectness:t.forceShowCorrectness,forceShowSolution:t.forceShowSolution,forceUnsuppressCheckwork:t.forceUnsuppressCheckwork,flags:ne,activityVariantIndex:V,requestedVariantIndex:M[e],unbundledCore:t.unbundledCore,updateCreditAchievedCallback:t.updateCreditAchievedCallback,setIsInErrorState:t.setIsInErrorState,updateAttemptNumber:t.updateAttemptNumber,saveStateCallback:it,updateDataOnContentChange:t.updateDataOnContentChange,coreCreatedCallback:o=>st(e,o),renderersInitializedCallback:()=>ot(e),hideWhenNotCurrent:t.paginate,prefixForIds:s});t.paginate||(n=f(wt,{partialVisibility:!0,offset:{top:-200,bottom:-200},requireContentsSize:!1,onChange:o=>rt(o,e),children:f("div",{children:n})})),Oe.push(f("div",{id:`page${e+1}`,children:n},`page${e+1}`))}let Ve=null,$e=null;t.paginate&&u>1&&(Ve=A("div",{style:{display:"flex",alignItems:"center",marginLeft:"5px"},children:[f(T,{dataTest:"previous",disabled:c===1,onClick:Te,value:"Previous page"}),A("p",{style:{margin:"5px"},children:[" Page ",c," of ",u," "]}),f(T,{dataTest:"next",disabled:c===u,onClick:Ne,value:"Next page"})]}),Ke[c-1]&&($e=A("div",{style:{display:"flex",alignItems:"center",marginLeft:"5px"},children:[f(T,{dataTest:"previous-bottom",disabled:c===1,onClick:Te,value:"Previous page"}),A("p",{style:{margin:"5px"},children:[" Page ",c," of ",u," "]}),f(T,{dataTest:"next-bottom",disabled:c===u,onClick:Ne,value:"Next page"})]})));let me=null;return t.showFinishButton&&(He?me=A("div",{style:{marginLeft:"1px",marginRight:"5px",marginBottom:"5px",marginTop:"80px",border:"var(--mainBorder)",borderRadius:"var(--mainBorderRadius)",padding:"5px",display:"flex",flexFlow:"column wrap"},children:[f("div",{style:{display:"flex",justifyContent:"center",padding:"5px"},children:"Are you sure you want to finish this assessment?"}),f("div",{style:{display:"flex",justifyContent:"center",padding:"5px"},children:A(At,{children:[f(T,{onClick:ct,dataTest:"ConfirmFinishAssessment",value:"Yes",disabled:Ee}),f(T,{onClick:()=>Pe(!1),dataTest:"CancelFinishAssessment",value:"No",alert:!0,disabled:Ee})]})})]}):me=f("div",{style:{marginLeft:"1px",marginRight:"5px",marginBottom:"5px",marginTop:"80px"},children:f("div",{"data-test":"centerone",style:{display:"flex",justifyContent:"center"},children:f("div",{style:{width:"240px"},children:f(bt,{onClick:()=>Pe(!0),"data-test":"FinishAssessmentPrompt",value:"Finish assessment"})})})})),A("div",{style:{paddingBottom:"50vh"},id:"activityTop",ref:F,children:[Ve,lt,Oe,$e,me]})}export{Ot as A,Pt as a,xt as c,Et as i,Ie as s}; diff --git a/dist/assets/AddDriveItems-17579aeb.js b/dist/assets/AddDriveItems-6860e932.js similarity index 82% rename from dist/assets/AddDriveItems-17579aeb.js rename to dist/assets/AddDriveItems-6860e932.js index 452e56a789..ec197cb983 100644 --- a/dist/assets/AddDriveItems-17579aeb.js +++ b/dist/assets/AddDriveItems-6860e932.js @@ -1 +1 @@ -import{l as o,m as n,a6 as c,y as s,j as t,F as r,a as l,B as a}from"./index-61b6fc23.js";import{B as u}from"./ButtonGroup-6d856500.js";function v(){const d=o(n("courseId")),{create:e}=c(d),i=s();return t(r,{children:l(u,{vertical:!0,children:[t(a,{width:"menu",dataTest:"Add Activity Button",onClick:()=>e({itemType:"activity"},()=>{i("Activity Created!")}),value:"Add Activity",children:"Add Activity"}),t(a,{width:"menu",dataTest:"Add Collection Button",onClick:()=>e({itemType:"bank"},()=>{i("Collection Created!")}),value:"Add Collection"}),t(a,{width:"menu",dataTest:"Add Section Button",onClick:()=>e({itemType:"section"},()=>{i("Section Created!")}),value:"Add Section",children:"Add Section"})]})})}export{v as default}; +import{l as o,m as n,a6 as c,y as s,j as t,F as r,a as l,B as a}from"./index-9d63439d.js";import{B as u}from"./ButtonGroup-ec02b3e9.js";function v(){const d=o(n("courseId")),{create:e}=c(d),i=s();return t(r,{children:l(u,{vertical:!0,children:[t(a,{width:"menu",dataTest:"Add Activity Button",onClick:()=>e({itemType:"activity"},()=>{i("Activity Created!")}),value:"Add Activity",children:"Add Activity"}),t(a,{width:"menu",dataTest:"Add Collection Button",onClick:()=>e({itemType:"bank"},()=>{i("Collection Created!")}),value:"Add Collection"}),t(a,{width:"menu",dataTest:"Add Section Button",onClick:()=>e({itemType:"section"},()=>{i("Section Created!")}),value:"Add Section",children:"Add Section"})]})})}export{v as default}; diff --git a/dist/assets/AssignmentBreadCrumb-315c8384.js b/dist/assets/AssignmentBreadCrumb-315c8384.js deleted file mode 100644 index 80389bb0fb..0000000000 --- a/dist/assets/AssignmentBreadCrumb-315c8384.js +++ /dev/null @@ -1 +0,0 @@ -import{l as a,w as u,m as i,j as s,r as c}from"./index-61b6fc23.js";import{B as d}from"./BreadCrumb-593a3cf1.js";import{u as b,a as C,b as p,g as f}from"./breadcrumbUtil-59c43d86.js";import"./RoleDropdown-c9fff172.js";import"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";import"./Gradebook-bd1a82d1.js";function v(){const r=a(u),o=a(i("doenetId")),e=b(),m=C(r),t=p(r,o),n=f({doenetId:o});return s(c.Suspense,{fallback:s("div",{children:"Loading Breadcrumb..."}),children:s(d,{crumbs:[e,m,...t,n],offset:226})})}export{v as default}; diff --git a/dist/assets/AssignmentBreadCrumb-7ae15ea8.js b/dist/assets/AssignmentBreadCrumb-7ae15ea8.js new file mode 100644 index 0000000000..91ac4f94d4 --- /dev/null +++ b/dist/assets/AssignmentBreadCrumb-7ae15ea8.js @@ -0,0 +1 @@ +import{l as a,w as u,m as i,j as s,r as c}from"./index-9d63439d.js";import{B as d}from"./BreadCrumb-56e53fc8.js";import{u as b,a as C,b as p,g as f}from"./breadcrumbUtil-379dd524.js";import"./RoleDropdown-2d4e4388.js";import"./DropdownMenu-421d3462.js";import"./setPrototypeOf-51e8cf87.js";import"./Gradebook-8ee8571a.js";function v(){const r=a(u),o=a(i("doenetId")),e=b(),m=C(r),t=p(r,o),n=f({doenetId:o});return s(c.Suspense,{fallback:s("div",{children:"Loading Breadcrumb..."}),children:s(d,{crumbs:[e,m,...t,n],offset:226})})}export{v as default}; diff --git a/dist/assets/AssignmentInfoCap-b64f95e4.js b/dist/assets/AssignmentInfoCap-79691cd2.js similarity index 90% rename from dist/assets/AssignmentInfoCap-b64f95e4.js rename to dist/assets/AssignmentInfoCap-79691cd2.js index ccd8fc7ce1..50c75584cb 100644 --- a/dist/assets/AssignmentInfoCap-b64f95e4.js +++ b/dist/assets/AssignmentInfoCap-79691cd2.js @@ -1 +1 @@ -import{l as n,w as l,I as a,a as c,j as s}from"./index-61b6fc23.js";import{f as d,a as u}from"./util-85d105b8.js";import"./util-38d8e238.js";function b(){const t=n(l);let o=n(a(t));if(!o||Object.keys(o).length==0)return null;let e=o.color,i=o.image,r="course";return i!="none"&&(r=d(i),i="url(./drive_pictures/"+i+")"),e!="none"&&(r=u(e),e="#"+e),c("div",{children:[s("div",{style:{position:"relative",width:"100%",height:"165px",overflow:"hidden"},children:s("img",{"aria-label":r,style:{position:"absolute",width:"100%",height:"100%",backgroundSize:"cover",backgroundPosition:"center",backgroundImage:i,backgroundColor:e}})}),s("b",{children:"Assignment"})]})}export{b as default}; +import{l as n,w as l,I as a,a as c,j as s}from"./index-9d63439d.js";import{f as d,a as u}from"./util-85d105b8.js";import"./util-38d8e238.js";function b(){const t=n(l);let o=n(a(t));if(!o||Object.keys(o).length==0)return null;let e=o.color,i=o.image,r="course";return i!="none"&&(r=d(i),i="url(./drive_pictures/"+i+")"),e!="none"&&(r=u(e),e="#"+e),c("div",{children:[s("div",{style:{position:"relative",width:"100%",height:"165px",overflow:"hidden"},children:s("img",{"aria-label":r,style:{position:"absolute",width:"100%",height:"100%",backgroundSize:"cover",backgroundPosition:"center",backgroundImage:i,backgroundColor:e}})}),s("b",{children:"Assignment"})]})}export{b as default}; diff --git a/dist/assets/AssignmentNewAttempt-77a38c6d.js b/dist/assets/AssignmentNewAttempt-e7dfb8cf.js similarity index 50% rename from dist/assets/AssignmentNewAttempt-77a38c6d.js rename to dist/assets/AssignmentNewAttempt-e7dfb8cf.js index 2d61b44ea4..cf9732e2b9 100644 --- a/dist/assets/AssignmentNewAttempt-77a38c6d.js +++ b/dist/assets/AssignmentNewAttempt-e7dfb8cf.js @@ -1 +1 @@ -import{l as m,m as A,g as s,j as u,B as c,k as f}from"./index-61b6fc23.js";import{l as b}from"./CourseToolHandler-d3da4c3a.js";import{numberOfAttemptsAllowedAdjustmentAtom as w,currentAttemptNumber as N,cidChangedAtom as g}from"./AssignmentViewer-ce09819c.js";import"./index-1380c04c.js";import"./index-fcf36459.js";import"./index-47ca4f11.js";import"./index.esm-d246f4c9.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./ButtonGroup-6d856500.js";import"./ActivityViewer-5e9601b2.js";import"./activityUtils-3e149527.js";import"./visibility-sensor-398e690f.js";import"./ActionButton-be9a12e7.js";import"./RoleDropdown-c9fff172.js";import"./DropdownMenu-5673dfd7.js";function q(){const o=m(A("doenetId")),[i,p]=s(w),[l,a]=s(N),{numberOfAttemptsAllowed:n}=m(b(o)),d=m(g);let e=null;n!==null&&(e=Number(n)+Number(i));const r=e===null||lt+1)}}})}export{q as default}; +import{l as m,m as A,g as s,j as u,B as c,k as f}from"./index-9d63439d.js";import{l as b}from"./CourseToolHandler-d3661515.js";import{numberOfAttemptsAllowedAdjustmentAtom as w,currentAttemptNumber as N,cidChangedAtom as g}from"./AssignmentViewer-07288d77.js";import"./index-df71c5ec.js";import"./index-fcf36459.js";import"./index-47ca4f11.js";import"./index.esm-d6b6ff57.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./ButtonGroup-ec02b3e9.js";import"./ActivityViewer-90c65d6d.js";import"./activityUtils-5d3d0ed0.js";import"./visibility-sensor-aefdbbd5.js";import"./ActionButton-056b08c3.js";import"./RoleDropdown-2d4e4388.js";import"./DropdownMenu-421d3462.js";function q(){const o=m(A("doenetId")),[i,p]=s(w),[l,a]=s(N),{numberOfAttemptsAllowed:n}=m(b(o)),d=m(g);let e=null;n!==null&&(e=Number(n)+Number(i));const r=e===null||lt+1)}}})}export{q as default}; diff --git a/dist/assets/AssignmentSettingsMenu-65e6c736.js b/dist/assets/AssignmentSettingsMenu-65e6c736.js deleted file mode 100644 index b0f65701ce..0000000000 --- a/dist/assets/AssignmentSettingsMenu-65e6c736.js +++ /dev/null @@ -1 +0,0 @@ -import{l as r,m,w as s,a as e,j as t}from"./index-61b6fc23.js";import{AssignmentSettings as n}from"./SelectedActivity-416f6fd9.js";import{A as p}from"./SettingComponents-d7858e0f.js";import"./ActionButton-be9a12e7.js";import"./ActionButtonGroup-f3a36748.js";import"./ButtonGroup-6d856500.js";import"./RoleDropdown-c9fff172.js";import"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";import"./Textfield-637f7b37.js";import"./DateTime-3ab576fc.js";import"./moment-b216ba57.js";import"./IncrementMenu-5203e1b9.js";import"./RelatedItems-33d92928.js";import"./useSaveDraft-fc810696.js";import"./EditorViewerRecoil-fde09b36.js";function _(){const o=r(m("doenetId")),i=r(s);return e("div",{style:{paddingTop:"6px",paddingBottom:"6px"},children:[t(p,{doenetId:o,courseId:i}),t("br",{}),t(n,{effectiveRole:"instructor",doenetId:o,courseId:i})]})}export{_ as default}; diff --git a/dist/assets/AssignmentSettingsMenu-9de82708.js b/dist/assets/AssignmentSettingsMenu-9de82708.js new file mode 100644 index 0000000000..e6efca72ce --- /dev/null +++ b/dist/assets/AssignmentSettingsMenu-9de82708.js @@ -0,0 +1 @@ +import{l as r,m,w as s,a as e,j as t}from"./index-9d63439d.js";import{AssignmentSettings as n}from"./SelectedActivity-ceb05ae5.js";import{A as p}from"./SettingComponents-d432c822.js";import"./ActionButton-056b08c3.js";import"./ActionButtonGroup-9e9bafb3.js";import"./ButtonGroup-ec02b3e9.js";import"./RoleDropdown-2d4e4388.js";import"./DropdownMenu-421d3462.js";import"./setPrototypeOf-51e8cf87.js";import"./Textfield-381b1f5a.js";import"./DateTime-b5df08e4.js";import"./moment-a2107d39.js";import"./IncrementMenu-999b207e.js";import"./RelatedItems-23ef0ca1.js";import"./useSaveDraft-50a40c9b.js";import"./EditorViewerRecoil-4f9a7d1d.js";function _(){const o=r(m("doenetId")),i=r(s);return e("div",{style:{paddingTop:"6px",paddingBottom:"6px"},children:[t(p,{doenetId:o,courseId:i}),t("br",{}),t(n,{effectiveRole:"instructor",doenetId:o,courseId:i})]})}export{_ as default}; diff --git a/dist/assets/AssignmentViewer-ce09819c.js b/dist/assets/AssignmentViewer-07288d77.js similarity index 96% rename from dist/assets/AssignmentViewer-ce09819c.js rename to dist/assets/AssignmentViewer-07288d77.js index 446f1fcb09..9f94fb39d1 100644 --- a/dist/assets/AssignmentViewer-ce09819c.js +++ b/dist/assets/AssignmentViewer-07288d77.js @@ -1 +1 @@ -import{r as f,a as y,j as a,i as Me,aP as Ee,l as Q,m as ze,w as Le,R as qe,E as Ge,g as $,v as D,Q as He,S as Ue,G as de,u as Ye,e as We,b as Je,c as Ke,p as Qe,k as g,F as X,B as Z,ag as j,ac as Xe}from"./index-61b6fc23.js";import{s as ue,A as Ze}from"./ActivityViewer-5e9601b2.js";import{a as et,p as tt,d as at}from"./activityUtils-3e149527.js";import{A as st}from"./ActionButton-be9a12e7.js";import{B as nt}from"./ButtonGroup-6d856500.js";import{e as it}from"./RoleDropdown-c9fff172.js";import"./visibility-sensor-398e690f.js";import"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";function ce(r){const[u,d]=f.useState("flex");var m={padding:"10px",display:`${u}`,alignItems:"center"},i={flexGrow:"1",lineHeight:"1.4",fontFamily:"Open Sans",fontSize:"16px"},h={background:"none",border:"0px",marginLeft:"5px",padding:"0px",value:"Label:",fontFamily:"Open Sans",fontSize:"14px",cursor:"pointer"},e={};switch(r.type){case"ERROR":e.backgroundColor="var(--mainRed)",e.color="var(--canvas)",h.color="var(--canvas)";break;case"ALERT":e.backgroundColor="var(--lightYellow)";break;case"ACTION":e.backgroundColor="var(--lightBlue)";break;case"SUCCESS":e.backgroundColor="var(--lightGreen)";break;default:e.backgroundColor="var(--mainGreen)";break}function A(){d("none")}return r.allowClose&&(e.closeButton=a("button",{"aria-label":"Close banner",style:h,onClick:()=>{A()},children:a(Me,{icon:Ee})})),y("div",{"aria-labelledby":"banner-text",children:[a("div",{style:e,children:y("div",{style:m,children:[a("div",{style:i,id:"banner-text",children:r.value}),e.closeButton]})}),a("div",{style:{padding:"5px"}})]})}const me=j({key:"currentAttemptNumber",default:null}),rt=j({key:"creditAchievedAtom",default:{creditByItem:[],creditForAttempt:0,creditForAssignment:0,totalPointsOrPercent:0}}),pe=j({key:"numberOfAttemptsAllowedAdjustment",default:0}),lt=j({key:"cidChanged",default:!1});function ee({previousVariants:r,allPossibleVariants:u,individualize:d,userId:m,doenetId:i,attemptNumber:h}){let e=[],A=(h-1)%u.length,v=[];if(A>0)for(let c=h-A;casync()=>await s.getPromise(ue),[ue]);He(r),Ue(u);const N=Q(it(u));let[b,Ve]=$(de(r)),q=b.label,{search:Ie,hash:ae}=Ye(),ke=We();f.useEffect(()=>{const s=document.title;return q&&(document.title=`${q} - Doenet`),()=>{document.title=s}},[q]),f.useEffect(()=>{Object.keys(b).length>0&&Object.keys(N).length>0&&Se(r,b)},[b,r,N]);const Oe=Je(Ke);L.current=Oe.contents.userId;const Se=D(({snapshot:s,set:l})=>async(n,{type:p,timeLimit:o,assignedDate:V,dueDate:P,showCorrectness:R,showCreditAchievedMenu:H,paginate:w,showFinishButton:se,showFeedback:ne,showHints:ie,autoSubmit:re,showSolution:_e,proctorMakesAvailable:$e,numberOfAttemptsAllowed:le})=>{if(p===void 0)return;let U=[];o===null&&U.push("TimerMenu"),(!R||!H||N.canViewUnassignedContent!=="0")&&U.push("CreditAchieved"),d(U);let Y="button";if(!_e&&N.canViewUnassignedContent==="0"&&(Y="none"),$e){const{page:K}=await s.getPromise(Qe);if(K!=="exam"){i("Problem"),e("Assignment only available in a proctored setting.");return}else{const{data:je}=await g.get("/api/checkSEBheaders.php",{params:{doenetId:n}});if(Number(je.legitAccessKey)!==1){i("Problem"),e("Browser not configured properly to take an exam.");return}}}let _=null,t=await g.get("/api/getCidForAssignment.php",{params:{doenetId:n,latestAttemptOverrides:!0}});if(t.data.success)if(t.data.cid)_=t.data.cid;else{i("Problem"),e("Assignment is not assigned.");return}else{i("Problem"),e(`Error loading assignment: ${t.data.message}`);return}if(k(t.data.cidChanged),t=await g.get("/api/loadTakenVariants.php",{params:{doenetId:n}}),!t.data.success){i("Problem"),t.data.message?e(`Could not load assignment: ${t.data.message}`):e(`Could not load assignment: ${t.data}`);return}let I=t.data.variants.map(Number),C=Math.max(...t.data.attemptNumbers.map(Number)),W=!1;if(C<1?(C=1,W=!0):t.data.variants[t.data.variants.length-1]===null&&(W=!0),l(me,C),t=await g.get("/api/loadAttemptsAllowedAdjustment.php",{params:{doenetId:n}}),!t.data.success){i("Problem"),t.data.message?e(`Could not load assignment: ${t.data.message}`):e(`Could not load assignment: ${t.data}`);return}let De=Number(t.data.numberOfAttemptsAllowedAdjustment);l(pe,De);let J=await ot(_);if(!J.success){E({requestedVariantIndex:0,attemptNumber:C,showCorrectness:R,paginate:w,showFinishButton:se,showFeedback:ne,showHints:ie,autoSubmit:re,cid:_,doenetId:n,solutionDisplayMode:Y,baseNumberOfAttemptsAllowed:le}),i("Problem"),e(J.message);return}if(z.current=[...Array(J.numberOfVariants).keys()].map(K=>K+1),W){if(t=await g.get("/api/getIndividualizeForAssignment.php",{params:{doenetId:n}}),!t.data.success){i("Problem"),t.data.message?e(`Could not load assignment: ${t.data.message}`):e(`Could not load assignment: ${t.data}`);return}O.current=t.data.individualize==="1",I=I.slice(0,C-1),I.push(ee({previousVariants:I,allPossibleVariants:z.current,individualize:O.current,userId:L.current,doenetId:n,attemptNumber:C}))}let oe=I[I.length-1];console.log(`requestedVariantIndex: ${oe}`),E({requestedVariantIndex:oe,attemptNumber:C,showCorrectness:R,paginate:w,showFinishButton:se,showFeedback:ne,showHints:ie,autoSubmit:re,cid:_,doenetId:n,solutionDisplayMode:Y,baseNumberOfAttemptsAllowed:le}),i("Ready")},[d,N]),Pe=D(({set:s})=>async()=>{s(de(x),l=>{let n={...l};return n.completed=!0,n.completedDate=new Date,n})},[x]);async function Re(s,l){ae&&ae!=="#page1"&&ke(Ie,{replace:!0});let n=await Ne();n!==null&&clearTimeout(n);let p=null,o=await g.get("/api/getCidForAssignment.php",{params:{doenetId:l,latestAttemptOverrides:!1}});if(o.data.success)if(o.data.cid)p=o.data.cid;else{i("Problem"),e("Assignment is not assigned.");return}else{i("Problem"),e(`Error loading assignment: ${o.data.message}`);return}console.log(`retrieved cid: ${p}`);const{data:V}=await g.get("/api/loadTakenVariants.php",{params:{doenetId:l}});if(!V.success){i("Problem"),V.message?e(`Could not load assignment: ${V.message}`):e(`Could not load assignment: ${V}`);return}let P=V.variants.map(Number).slice(0,s-1);if(O.current===null){if(o=await g.get("/api/getIndividualizeForAssignment.php",{params:{doenetId:l}}),!o.data.success){i("Problem"),o.data.message?e(`Could not load assignment: ${o.data.message}`):e(`Could not load assignment: ${o.data}`);return}O.current=o.data.individualize==="1",i("Ready")}P.push(ee({previousVariants:P,allPossibleVariants:z.current,individualize:O.current,userId:L.current,doenetId:l,attemptNumber:s}));let R=P[P.length-1];E(H=>{let w={...H};return w.attemptNumber=s,w.requestedVariantIndex=R,w.cid=p,w}),k(!1)}const Be=D(({set:s})=>async({creditByItem:l,creditForAssignment:n,creditForAttempt:p,totalPointsOrPercent:o})=>{s(rt,{creditByItem:l,creditForAssignment:n,creditForAttempt:p,totalPointsOrPercent:o})});function Fe(s){console.log(`page changed to ${s}`)}async function Te(){let s=await g.post("/api/incrementAttemptsAllowedIfCidChanged.php",{doenetId:x});s.data.cidChanged&&(ye(Number(s.data.newNumberOfAttemptsAllowedAdjustment)),v(l=>l+1))}if(r==="")return null;if(console.log("stage",m),u==="__not_found__")return a("h1",{children:"Content not found or no permission to view content"});if(m==="Initializing")return null;if(A>F)return Re(A,r),null;if(m==="Problem")return a("h1",{children:h});if(!(b!=null&&b.canViewAfterCompleted)&&b.completed)return Number(b.numberOfAttemptsAllowed)+Number(Ce)>F?a(X,{children:y("div",{style:{margin:"15px"},children:[a("h1",{children:"Assessment Complete"}),a("p",{children:"You have completed this assessment. Would you like to begin another attempt?"}),a("p",{children:a(Z,{value:"Begin New Attempt",onClick:async()=>{const{data:l}=await g.get("/api/saveCompleted.php",{params:{doenetId:x}});l.success?(v(n=>n+1),Ve(n=>{let p={...n};return p.completed=!1,p})):(i("Problem"),e("Internal Error"))}})})]})}):a(X,{children:y("div",{style:{margin:"15px"},children:[a("h1",{children:"Assessment Complete"}),a("p",{children:"You have already completed this assessment and no additional attempts are available."})]})});let G=null;if(B)if(xe){let s=null;we>1&&(s=" and the number of available attempts"),G=a(ce,{type:"ACTION",value:y("div",{style:{border:"var(--mainBorder)",borderRadius:"var(--mainBorderRadius)",padding:"5px",margin:"5px",display:"flex",flexFlow:"column wrap"},children:["A new version of this activity is available. Do you want to start a new attempt using the new version? (This will reset the activity",s,".)",a("div",{style:{display:"flex",justifyContent:"center",padding:"5px"},children:y(nt,{children:[a(Z,{onClick:Te,dataTest:"ConfirmNewVersion",value:"Yes"}),a(Z,{onClick:()=>te(!1),dataTest:"CancelNewVersion",value:"No",alert:!0})]})})]})})}else G=a(ce,{type:"ACTION",value:a("div",{style:{marginLeft:"1px",marginRight:"5px"},children:a(st,{onClick:()=>te(!0),dataTest:"NewVersionAvailable",value:"New version available!"})})});const S=N.canViewUnassignedContent==="0";return y(X,{children:[G,a(Ze,{cid:Ae,doenetId:x,flags:{showCorrectness:c,readOnly:!1,solutionDisplayMode:ve,showFeedback:fe,showHints:he,autoSubmit:be,allowLoadState:S,allowSaveState:S,allowLocalState:S,allowSaveSubmissions:S,allowSaveEvents:S},attemptNumber:F,requestedVariantIndex:M,updateCreditAchievedCallback:Be,updateAttemptNumber:v,pageChangedCallback:Fe,paginate:T,showFinishButton:ge,cidChangedCallback:()=>k(!0),setActivityAsCompleted:Pe},`activityViewer${x}`)]})}async function ot(r){let u;try{u=await Xe(r)}catch{return{success:!1,message:"Could not retrieve file"}}let d=tt(u);if(!d.success)return d;try{d=await at(d.activityJSON)}catch(m){return{success:!1,message:m.message}}return{success:!0,numberOfVariants:d.numberOfVariants}}export{lt as cidChangedAtom,rt as creditAchievedAtom,me as currentAttemptNumber,At as default,pe as numberOfAttemptsAllowedAdjustmentAtom}; +import{r as f,a as y,j as a,i as Me,aP as Ee,l as Q,m as ze,w as Le,R as qe,E as Ge,g as $,v as D,Q as He,S as Ue,G as de,u as Ye,e as We,b as Je,c as Ke,p as Qe,k as g,F as X,B as Z,ag as j,ac as Xe}from"./index-9d63439d.js";import{s as ue,A as Ze}from"./ActivityViewer-90c65d6d.js";import{a as et,p as tt,d as at}from"./activityUtils-5d3d0ed0.js";import{A as st}from"./ActionButton-056b08c3.js";import{B as nt}from"./ButtonGroup-ec02b3e9.js";import{e as it}from"./RoleDropdown-2d4e4388.js";import"./visibility-sensor-aefdbbd5.js";import"./DropdownMenu-421d3462.js";import"./setPrototypeOf-51e8cf87.js";function ce(r){const[u,d]=f.useState("flex");var m={padding:"10px",display:`${u}`,alignItems:"center"},i={flexGrow:"1",lineHeight:"1.4",fontFamily:"Open Sans",fontSize:"16px"},h={background:"none",border:"0px",marginLeft:"5px",padding:"0px",value:"Label:",fontFamily:"Open Sans",fontSize:"14px",cursor:"pointer"},e={};switch(r.type){case"ERROR":e.backgroundColor="var(--mainRed)",e.color="var(--canvas)",h.color="var(--canvas)";break;case"ALERT":e.backgroundColor="var(--lightYellow)";break;case"ACTION":e.backgroundColor="var(--lightBlue)";break;case"SUCCESS":e.backgroundColor="var(--lightGreen)";break;default:e.backgroundColor="var(--mainGreen)";break}function A(){d("none")}return r.allowClose&&(e.closeButton=a("button",{"aria-label":"Close banner",style:h,onClick:()=>{A()},children:a(Me,{icon:Ee})})),y("div",{"aria-labelledby":"banner-text",children:[a("div",{style:e,children:y("div",{style:m,children:[a("div",{style:i,id:"banner-text",children:r.value}),e.closeButton]})}),a("div",{style:{padding:"5px"}})]})}const me=j({key:"currentAttemptNumber",default:null}),rt=j({key:"creditAchievedAtom",default:{creditByItem:[],creditForAttempt:0,creditForAssignment:0,totalPointsOrPercent:0}}),pe=j({key:"numberOfAttemptsAllowedAdjustment",default:0}),lt=j({key:"cidChanged",default:!1});function ee({previousVariants:r,allPossibleVariants:u,individualize:d,userId:m,doenetId:i,attemptNumber:h}){let e=[],A=(h-1)%u.length,v=[];if(A>0)for(let c=h-A;casync()=>await s.getPromise(ue),[ue]);He(r),Ue(u);const N=Q(it(u));let[b,Ve]=$(de(r)),q=b.label,{search:Ie,hash:ae}=Ye(),ke=We();f.useEffect(()=>{const s=document.title;return q&&(document.title=`${q} - Doenet`),()=>{document.title=s}},[q]),f.useEffect(()=>{Object.keys(b).length>0&&Object.keys(N).length>0&&Se(r,b)},[b,r,N]);const Oe=Je(Ke);L.current=Oe.contents.userId;const Se=D(({snapshot:s,set:l})=>async(n,{type:p,timeLimit:o,assignedDate:V,dueDate:P,showCorrectness:R,showCreditAchievedMenu:H,paginate:w,showFinishButton:se,showFeedback:ne,showHints:ie,autoSubmit:re,showSolution:_e,proctorMakesAvailable:$e,numberOfAttemptsAllowed:le})=>{if(p===void 0)return;let U=[];o===null&&U.push("TimerMenu"),(!R||!H||N.canViewUnassignedContent!=="0")&&U.push("CreditAchieved"),d(U);let Y="button";if(!_e&&N.canViewUnassignedContent==="0"&&(Y="none"),$e){const{page:K}=await s.getPromise(Qe);if(K!=="exam"){i("Problem"),e("Assignment only available in a proctored setting.");return}else{const{data:je}=await g.get("/api/checkSEBheaders.php",{params:{doenetId:n}});if(Number(je.legitAccessKey)!==1){i("Problem"),e("Browser not configured properly to take an exam.");return}}}let _=null,t=await g.get("/api/getCidForAssignment.php",{params:{doenetId:n,latestAttemptOverrides:!0}});if(t.data.success)if(t.data.cid)_=t.data.cid;else{i("Problem"),e("Assignment is not assigned.");return}else{i("Problem"),e(`Error loading assignment: ${t.data.message}`);return}if(k(t.data.cidChanged),t=await g.get("/api/loadTakenVariants.php",{params:{doenetId:n}}),!t.data.success){i("Problem"),t.data.message?e(`Could not load assignment: ${t.data.message}`):e(`Could not load assignment: ${t.data}`);return}let I=t.data.variants.map(Number),C=Math.max(...t.data.attemptNumbers.map(Number)),W=!1;if(C<1?(C=1,W=!0):t.data.variants[t.data.variants.length-1]===null&&(W=!0),l(me,C),t=await g.get("/api/loadAttemptsAllowedAdjustment.php",{params:{doenetId:n}}),!t.data.success){i("Problem"),t.data.message?e(`Could not load assignment: ${t.data.message}`):e(`Could not load assignment: ${t.data}`);return}let De=Number(t.data.numberOfAttemptsAllowedAdjustment);l(pe,De);let J=await ot(_);if(!J.success){E({requestedVariantIndex:0,attemptNumber:C,showCorrectness:R,paginate:w,showFinishButton:se,showFeedback:ne,showHints:ie,autoSubmit:re,cid:_,doenetId:n,solutionDisplayMode:Y,baseNumberOfAttemptsAllowed:le}),i("Problem"),e(J.message);return}if(z.current=[...Array(J.numberOfVariants).keys()].map(K=>K+1),W){if(t=await g.get("/api/getIndividualizeForAssignment.php",{params:{doenetId:n}}),!t.data.success){i("Problem"),t.data.message?e(`Could not load assignment: ${t.data.message}`):e(`Could not load assignment: ${t.data}`);return}O.current=t.data.individualize==="1",I=I.slice(0,C-1),I.push(ee({previousVariants:I,allPossibleVariants:z.current,individualize:O.current,userId:L.current,doenetId:n,attemptNumber:C}))}let oe=I[I.length-1];console.log(`requestedVariantIndex: ${oe}`),E({requestedVariantIndex:oe,attemptNumber:C,showCorrectness:R,paginate:w,showFinishButton:se,showFeedback:ne,showHints:ie,autoSubmit:re,cid:_,doenetId:n,solutionDisplayMode:Y,baseNumberOfAttemptsAllowed:le}),i("Ready")},[d,N]),Pe=D(({set:s})=>async()=>{s(de(x),l=>{let n={...l};return n.completed=!0,n.completedDate=new Date,n})},[x]);async function Re(s,l){ae&&ae!=="#page1"&&ke(Ie,{replace:!0});let n=await Ne();n!==null&&clearTimeout(n);let p=null,o=await g.get("/api/getCidForAssignment.php",{params:{doenetId:l,latestAttemptOverrides:!1}});if(o.data.success)if(o.data.cid)p=o.data.cid;else{i("Problem"),e("Assignment is not assigned.");return}else{i("Problem"),e(`Error loading assignment: ${o.data.message}`);return}console.log(`retrieved cid: ${p}`);const{data:V}=await g.get("/api/loadTakenVariants.php",{params:{doenetId:l}});if(!V.success){i("Problem"),V.message?e(`Could not load assignment: ${V.message}`):e(`Could not load assignment: ${V}`);return}let P=V.variants.map(Number).slice(0,s-1);if(O.current===null){if(o=await g.get("/api/getIndividualizeForAssignment.php",{params:{doenetId:l}}),!o.data.success){i("Problem"),o.data.message?e(`Could not load assignment: ${o.data.message}`):e(`Could not load assignment: ${o.data}`);return}O.current=o.data.individualize==="1",i("Ready")}P.push(ee({previousVariants:P,allPossibleVariants:z.current,individualize:O.current,userId:L.current,doenetId:l,attemptNumber:s}));let R=P[P.length-1];E(H=>{let w={...H};return w.attemptNumber=s,w.requestedVariantIndex=R,w.cid=p,w}),k(!1)}const Be=D(({set:s})=>async({creditByItem:l,creditForAssignment:n,creditForAttempt:p,totalPointsOrPercent:o})=>{s(rt,{creditByItem:l,creditForAssignment:n,creditForAttempt:p,totalPointsOrPercent:o})});function Fe(s){console.log(`page changed to ${s}`)}async function Te(){let s=await g.post("/api/incrementAttemptsAllowedIfCidChanged.php",{doenetId:x});s.data.cidChanged&&(ye(Number(s.data.newNumberOfAttemptsAllowedAdjustment)),v(l=>l+1))}if(r==="")return null;if(console.log("stage",m),u==="__not_found__")return a("h1",{children:"Content not found or no permission to view content"});if(m==="Initializing")return null;if(A>F)return Re(A,r),null;if(m==="Problem")return a("h1",{children:h});if(!(b!=null&&b.canViewAfterCompleted)&&b.completed)return Number(b.numberOfAttemptsAllowed)+Number(Ce)>F?a(X,{children:y("div",{style:{margin:"15px"},children:[a("h1",{children:"Assessment Complete"}),a("p",{children:"You have completed this assessment. Would you like to begin another attempt?"}),a("p",{children:a(Z,{value:"Begin New Attempt",onClick:async()=>{const{data:l}=await g.get("/api/saveCompleted.php",{params:{doenetId:x}});l.success?(v(n=>n+1),Ve(n=>{let p={...n};return p.completed=!1,p})):(i("Problem"),e("Internal Error"))}})})]})}):a(X,{children:y("div",{style:{margin:"15px"},children:[a("h1",{children:"Assessment Complete"}),a("p",{children:"You have already completed this assessment and no additional attempts are available."})]})});let G=null;if(B)if(xe){let s=null;we>1&&(s=" and the number of available attempts"),G=a(ce,{type:"ACTION",value:y("div",{style:{border:"var(--mainBorder)",borderRadius:"var(--mainBorderRadius)",padding:"5px",margin:"5px",display:"flex",flexFlow:"column wrap"},children:["A new version of this activity is available. Do you want to start a new attempt using the new version? (This will reset the activity",s,".)",a("div",{style:{display:"flex",justifyContent:"center",padding:"5px"},children:y(nt,{children:[a(Z,{onClick:Te,dataTest:"ConfirmNewVersion",value:"Yes"}),a(Z,{onClick:()=>te(!1),dataTest:"CancelNewVersion",value:"No",alert:!0})]})})]})})}else G=a(ce,{type:"ACTION",value:a("div",{style:{marginLeft:"1px",marginRight:"5px"},children:a(st,{onClick:()=>te(!0),dataTest:"NewVersionAvailable",value:"New version available!"})})});const S=N.canViewUnassignedContent==="0";return y(X,{children:[G,a(Ze,{cid:Ae,doenetId:x,flags:{showCorrectness:c,readOnly:!1,solutionDisplayMode:ve,showFeedback:fe,showHints:he,autoSubmit:be,allowLoadState:S,allowSaveState:S,allowLocalState:S,allowSaveSubmissions:S,allowSaveEvents:S},attemptNumber:F,requestedVariantIndex:M,updateCreditAchievedCallback:Be,updateAttemptNumber:v,pageChangedCallback:Fe,paginate:T,showFinishButton:ge,cidChangedCallback:()=>k(!0),setActivityAsCompleted:Pe},`activityViewer${x}`)]})}async function ot(r){let u;try{u=await Xe(r)}catch{return{success:!1,message:"Could not retrieve file"}}let d=tt(u);if(!d.success)return d;try{d=await at(d.activityJSON)}catch(m){return{success:!1,message:m.message}}return{success:!0,numberOfVariants:d.numberOfVariants}}export{lt as cidChangedAtom,rt as creditAchievedAtom,me as currentAttemptNumber,At as default,pe as numberOfAttemptsAllowedAdjustmentAtom}; diff --git a/dist/assets/AutoSaves-22f2365a.js b/dist/assets/AutoSaves-78d41737.js similarity index 58% rename from dist/assets/AutoSaves-22f2365a.js rename to dist/assets/AutoSaves-78d41737.js index 93f5f9616b..f845f740b8 100644 --- a/dist/assets/AutoSaves-22f2365a.js +++ b/dist/assets/AutoSaves-78d41737.js @@ -1 +1 @@ -import{j as e}from"./index-61b6fc23.js";function s(t){return e("div",{style:t.style,children:e("div",{children:"Autosaves here"})})}export{s as default}; +import{j as e}from"./index-9d63439d.js";function s(t){return e("div",{style:t.style,children:e("div",{children:"Autosaves here"})})}export{s as default}; diff --git a/dist/assets/BackButton-d0af0861.js b/dist/assets/BackButton-757dc0d9.js similarity index 56% rename from dist/assets/BackButton-d0af0861.js rename to dist/assets/BackButton-757dc0d9.js index 7be8a6a3e5..e7904ae287 100644 --- a/dist/assets/BackButton-d0af0861.js +++ b/dist/assets/BackButton-757dc0d9.js @@ -1 +1 @@ -import{e as t,j as e,B as n}from"./index-61b6fc23.js";function s(){const a=t();return e(n,{onClick:()=>a(-1),value:"Back"})}export{s as default}; +import{e as t,j as e,B as n}from"./index-9d63439d.js";function s(){const a=t();return e(n,{onClick:()=>a(-1),value:"Back"})}export{s as default}; diff --git a/dist/assets/BreadCrumb-593a3cf1.js b/dist/assets/BreadCrumb-56e53fc8.js similarity index 99% rename from dist/assets/BreadCrumb-593a3cf1.js rename to dist/assets/BreadCrumb-56e53fc8.js index 7fae2990d2..b1a1a04dad 100644 --- a/dist/assets/BreadCrumb-593a3cf1.js +++ b/dist/assets/BreadCrumb-56e53fc8.js @@ -1,4 +1,4 @@ -import{s as y,r as i,l as P,b4 as V,av as W,j as d,F as _,a as J}from"./index-61b6fc23.js";const N=y.ul` +import{s as y,r as i,l as P,b4 as V,av as W,j as d,F as _,a as J}from"./index-9d63439d.js";const N=y.ul` list-style: none; overflow: hidden; height: 21px; diff --git a/dist/assets/ButtonGroup-6d856500.js b/dist/assets/ButtonGroup-ec02b3e9.js similarity index 88% rename from dist/assets/ButtonGroup-6d856500.js rename to dist/assets/ButtonGroup-ec02b3e9.js index 970bfaf8ad..e807d018e2 100644 --- a/dist/assets/ButtonGroup-6d856500.js +++ b/dist/assets/ButtonGroup-ec02b3e9.js @@ -1,4 +1,4 @@ -import{s as p,av as x,j as i,aw as n}from"./index-61b6fc23.js";const d=p.div` +import{s as p,av as x,j as i,aw as n}from"./index-9d63439d.js";const d=p.div` display: ${t=>t.vertical?"static":"flex"}; width: ${t=>t.width=="menu"?"var(--menuWidth)":""}; /* flex-wrap: wrap; */ diff --git a/dist/assets/ChooseLearnerPanel-3c24f42f.js b/dist/assets/ChooseLearnerPanel-dfc6c714.js similarity index 98% rename from dist/assets/ChooseLearnerPanel-3c24f42f.js rename to dist/assets/ChooseLearnerPanel-dfc6c714.js index de221a81ec..36d8a71a2c 100644 --- a/dist/assets/ChooseLearnerPanel-3c24f42f.js +++ b/dist/assets/ChooseLearnerPanel-dfc6c714.js @@ -1,4 +1,4 @@ -import{l as A,m as D,r as l,y as H,v as _,k as I,p as Q,a,j as e,F as B,B as p,N as W,a7 as T,a8 as ee,s as te,D as ae,d as re}from"./index-61b6fc23.js";import{B as F}from"./ButtonGroup-6d856500.js";const ne=te.div` +import{l as A,m as D,r as l,y as H,v as _,k as I,p as Q,a,j as e,F as B,B as p,N as W,a7 as T,a8 as ee,s as te,D as ae,d as re}from"./index-9d63439d.js";import{B as F}from"./ButtonGroup-ec02b3e9.js";const ne=te.div` padding: 1rem; table { /* border-collapse: collapse; */ diff --git a/dist/assets/ChooserBreadCrumb-5cdc1dba.js b/dist/assets/ChooserBreadCrumb-5cdc1dba.js deleted file mode 100644 index a53a6812c1..0000000000 --- a/dist/assets/ChooserBreadCrumb-5cdc1dba.js +++ /dev/null @@ -1 +0,0 @@ -import{j as r,r as s}from"./index-61b6fc23.js";import{B as e}from"./BreadCrumb-593a3cf1.js";import{u as m}from"./breadcrumbUtil-59c43d86.js";import"./RoleDropdown-c9fff172.js";import"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";import"./Gradebook-bd1a82d1.js";function n(){const o=m();return r(s.Suspense,{fallback:r("div",{children:"loading Breadcrumbs..."}),children:r(e,{crumbs:[o]})})}export{n as default}; diff --git a/dist/assets/ChooserBreadCrumb-6675d364.js b/dist/assets/ChooserBreadCrumb-6675d364.js new file mode 100644 index 0000000000..a101095700 --- /dev/null +++ b/dist/assets/ChooserBreadCrumb-6675d364.js @@ -0,0 +1 @@ +import{j as r,r as s}from"./index-9d63439d.js";import{B as e}from"./BreadCrumb-56e53fc8.js";import{u as m}from"./breadcrumbUtil-379dd524.js";import"./RoleDropdown-2d4e4388.js";import"./DropdownMenu-421d3462.js";import"./setPrototypeOf-51e8cf87.js";import"./Gradebook-8ee8571a.js";function n(){const o=m();return r(s.Suspense,{fallback:r("div",{children:"loading Breadcrumbs..."}),children:r(e,{crumbs:[o]})})}export{n as default}; diff --git a/dist/assets/ClassTimes-434dec98.js b/dist/assets/ClassTimes-fa9e96c2.js similarity index 86% rename from dist/assets/ClassTimes-434dec98.js rename to dist/assets/ClassTimes-fa9e96c2.js index aa00b5037d..8542a9ccb0 100644 --- a/dist/assets/ClassTimes-434dec98.js +++ b/dist/assets/ClassTimes-fa9e96c2.js @@ -1 +1 @@ -import{l as g,m as j,v as w,k as f,a as c,F as y,j as a,B as C,i as D,bm as _,aP as k}from"./index-61b6fc23.js";import{c as m}from"./Next7Days-938d1df1.js";import{D as B}from"./DropdownMenu-5673dfd7.js";import{D as v}from"./DateTime-3ab576fc.js";import"./CourseToolHandler-d3da4c3a.js";import"./index-1380c04c.js";import"./index-fcf36459.js";import"./index-47ca4f11.js";import"./index.esm-d246f4c9.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./ButtonGroup-6d856500.js";import"./RoleDropdown-c9fff172.js";import"./moment-b216ba57.js";function E(){const A=g(m),u=g(j("courseId")),P=w(({set:t,snapshot:e})=>async n=>{let r=[...await e.getPromise(m)];r.push({dotwIndex:1,startTime:"09:00",endTime:"10:00"}),t(m,r);let d=[],s=[],i=[];for(let l of r)d.push(l.dotwIndex),s.push(l.startTime),i.push(l.endTime);await f.post("/api/updateClassTimes.php",{courseId:n,dotwIndexes:d,startTimes:s,endTimes:i})}),T=w(({set:t,snapshot:e})=>async({index:n,nextClassTime:o,courseId:r})=>{let s=[...await e.getPromise(m)];s[n]={...o},t(m,s);let i=[],l=[],p=[];for(let x of s)i.push(x.dotwIndex),l.push(x.startTime),p.push(x.endTime);await f.post("/api/updateClassTimes.php",{courseId:r,dotwIndexes:i,startTimes:l,endTimes:p})}),S=w(({set:t,snapshot:e})=>async({index:n,courseId:o})=>{let d=[...await e.getPromise(m)];d.splice(n,1),t(m,d);let s=[],i=[],l=[];for(let p of d)s.push(p.dotwIndex),i.push(p.startTime),l.push(p.endTime);await f.post("/api/updateClassTimes.php",{courseId:o,dotwIndexes:s,startTimes:i,endTimes:l})}),b=[[1,"Monday"],[2,"Tuesday"],[3,"Wednesday"],[4,"Thursday"],[5,"Friday"],[6,"Saturday"],[0,"Sunday"]];let h=[];for(let[t,e]of Object.entries(A)){const n=new Date;n.setHours(e.startTime.split(":")[0]),n.setMinutes(e.startTime.split(":")[1]);const o=new Date;o.setHours(e.endTime.split(":")[0]),o.setMinutes(e.endTime.split(":")[1]);let r=e.dotwIndex;e.dotwIndex==0&&(r=7),h.push(c(y,{children:[c("tr",{children:[a("td",{style:{width:"190px"},children:a(B,{dataTest:`DOTW Dropdown ${t}`,width:"180px",items:b,valueIndex:r,onChange:({value:d})=>{let s={...e};s.dotwIndex=d,T({courseId:u,index:t,nextClassTime:s})}})}),a(C,{dataTest:`Classtime Delete Button ${t}`,icon:a(D,{icon:k}),alert:!0,onClick:()=>{S({index:t,courseId:u})}})]}),c("tr",{style:{width:"190px",display:"flex",alignItems:"center"},children:[a("td",{children:a(v,{dataTest:`Classtime start time ${t}`,datePicker:!1,width:"74px",value:n,onBlur:(d,s)=>{let i={...e};i.startTime=new Date(d.value._d).toLocaleString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"}),T({courseId:u,index:t,nextClassTime:i})}})}),a("td",{style:{marginLeft:"6px",marginRight:"6px"},children:"-"}),a("td",{style:{["--menuPanelMargin"]:"-62px"},children:a(v,{dataTest:`Classtime end time ${t}`,datePicker:!1,width:"74px",value:o,onBlur:(d,s)=>{let i={...e};i.endTime=new Date(d.value._d).toLocaleString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"}),T({courseId:u,index:t,nextClassTime:i})}})})]}),a("div",{style:{margin:"10px"}})]}))}let I=a("div",{children:"No times set."});return h.length>0&&(I=a("table",{style:{width:"230px",margins:"5px"},children:h})),c(y,{children:[I,a(C,{dataTest:"Add Classtime",icon:a(D,{icon:_}),style:{margin:"auto"},onClick:()=>P(u)})]})}export{E as default}; +import{l as g,m as j,v as w,k as f,a as c,F as y,j as a,B as C,i as D,bm as _,aP as k}from"./index-9d63439d.js";import{c as m}from"./Next7Days-1ee7c537.js";import{D as B}from"./DropdownMenu-421d3462.js";import{D as v}from"./DateTime-b5df08e4.js";import"./CourseToolHandler-d3661515.js";import"./index-df71c5ec.js";import"./index-fcf36459.js";import"./index-47ca4f11.js";import"./index.esm-d6b6ff57.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./ButtonGroup-ec02b3e9.js";import"./RoleDropdown-2d4e4388.js";import"./moment-a2107d39.js";function E(){const A=g(m),u=g(j("courseId")),P=w(({set:t,snapshot:e})=>async n=>{let r=[...await e.getPromise(m)];r.push({dotwIndex:1,startTime:"09:00",endTime:"10:00"}),t(m,r);let d=[],s=[],i=[];for(let l of r)d.push(l.dotwIndex),s.push(l.startTime),i.push(l.endTime);await f.post("/api/updateClassTimes.php",{courseId:n,dotwIndexes:d,startTimes:s,endTimes:i})}),T=w(({set:t,snapshot:e})=>async({index:n,nextClassTime:o,courseId:r})=>{let s=[...await e.getPromise(m)];s[n]={...o},t(m,s);let i=[],l=[],p=[];for(let x of s)i.push(x.dotwIndex),l.push(x.startTime),p.push(x.endTime);await f.post("/api/updateClassTimes.php",{courseId:r,dotwIndexes:i,startTimes:l,endTimes:p})}),S=w(({set:t,snapshot:e})=>async({index:n,courseId:o})=>{let d=[...await e.getPromise(m)];d.splice(n,1),t(m,d);let s=[],i=[],l=[];for(let p of d)s.push(p.dotwIndex),i.push(p.startTime),l.push(p.endTime);await f.post("/api/updateClassTimes.php",{courseId:o,dotwIndexes:s,startTimes:i,endTimes:l})}),b=[[1,"Monday"],[2,"Tuesday"],[3,"Wednesday"],[4,"Thursday"],[5,"Friday"],[6,"Saturday"],[0,"Sunday"]];let h=[];for(let[t,e]of Object.entries(A)){const n=new Date;n.setHours(e.startTime.split(":")[0]),n.setMinutes(e.startTime.split(":")[1]);const o=new Date;o.setHours(e.endTime.split(":")[0]),o.setMinutes(e.endTime.split(":")[1]);let r=e.dotwIndex;e.dotwIndex==0&&(r=7),h.push(c(y,{children:[c("tr",{children:[a("td",{style:{width:"190px"},children:a(B,{dataTest:`DOTW Dropdown ${t}`,width:"180px",items:b,valueIndex:r,onChange:({value:d})=>{let s={...e};s.dotwIndex=d,T({courseId:u,index:t,nextClassTime:s})}})}),a(C,{dataTest:`Classtime Delete Button ${t}`,icon:a(D,{icon:k}),alert:!0,onClick:()=>{S({index:t,courseId:u})}})]}),c("tr",{style:{width:"190px",display:"flex",alignItems:"center"},children:[a("td",{children:a(v,{dataTest:`Classtime start time ${t}`,datePicker:!1,width:"74px",value:n,onBlur:(d,s)=>{let i={...e};i.startTime=new Date(d.value._d).toLocaleString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"}),T({courseId:u,index:t,nextClassTime:i})}})}),a("td",{style:{marginLeft:"6px",marginRight:"6px"},children:"-"}),a("td",{style:{["--menuPanelMargin"]:"-62px"},children:a(v,{dataTest:`Classtime end time ${t}`,datePicker:!1,width:"74px",value:o,onBlur:(d,s)=>{let i={...e};i.endTime=new Date(d.value._d).toLocaleString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"}),T({courseId:u,index:t,nextClassTime:i})}})})]}),a("div",{style:{margin:"10px"}})]}))}let I=a("div",{children:"No times set."});return h.length>0&&(I=a("table",{style:{width:"230px",margins:"5px"},children:h})),c(y,{children:[I,a(C,{dataTest:"Add Classtime",icon:a(D,{icon:_}),style:{margin:"auto"},onClick:()=>P(u)})]})}export{E as default}; diff --git a/dist/assets/CodeMirror-d3d9f7d1.js b/dist/assets/CodeMirror-af01bb34.js similarity index 99% rename from dist/assets/CodeMirror-d3d9f7d1.js rename to dist/assets/CodeMirror-af01bb34.js index 494fe9f95f..1f266f1de8 100644 --- a/dist/assets/CodeMirror-d3d9f7d1.js +++ b/dist/assets/CodeMirror-af01bb34.js @@ -1,4 +1,4 @@ -import{aQ as xt,aR as le,aS as Si,aT as Ih,aU as tl,aV as Nh,aW as il,aX as $h,l as Vh,r as ye,j as dr,F as Wh,ag as zh,aY as Hh}from"./index-61b6fc23.js";let kt="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(n=>n?parseInt(n,36):1);for(let n=1;nn)return kt[e-1]<=n;return!1}function pr(n){return n>=127462&&n<=127487}const mr=8205;function ce(n,e,t=!0,i=!0){return(t?nl:qh)(n,e,i)}function nl(n,e,t){if(e==n.length)return e;e&&sl(n.charCodeAt(e))&&rl(n.charCodeAt(e-1))&&e--;let i=Y(n,e);for(e+=de(i);e=0&&pr(Y(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function qh(n,e,t){for(;e>0;){let i=nl(n,e-2,t);if(i=56320&&n<57344}function rl(n){return n>=55296&&n<56320}function Y(n,e){let t=n.charCodeAt(e);if(!rl(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return sl(i)?(t-55296<<10)+(i-56320)+65536:t}function Ns(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function de(n){return n<65536?1:2}function ti(n,e,t=n.length){let i=0;for(let s=0;s=e)return s;if(s==n.length)break;r+=n.charCodeAt(s)==9?t-r%t:1,s=ce(n,s)}return i===!0?-1:n.length}class E{constructor(){}lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),Oe.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){let i=[];return this.decompose(e,t,i,0),Oe.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new qt(this),r=new qt(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new qt(this,e)}iterRange(e,t=this.length){return new ol(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new ll(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?E.empty:e.length<=32?new z(e):Oe.from(z.split(e,[]))}}class z extends E{constructor(e,t=Uh(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new Gh(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new z(gr(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=Ci(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new z(l,o.length+r.length));else{let a=l.length>>1;i.push(new z(l.slice(0,a)),new z(l.slice(a)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof z))return super.replace(e,t,i);let s=Ci(this.text,Ci(i.text,gr(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new z(s,r):Oe.from(z.split(s,[]),r)}sliceString(e,t=this.length,i=` +import{aQ as xt,aR as le,aS as Si,aT as Ih,aU as tl,aV as Nh,aW as il,aX as $h,l as Vh,r as ye,j as dr,F as Wh,ag as zh,aY as Hh}from"./index-9d63439d.js";let kt="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(n=>n?parseInt(n,36):1);for(let n=1;nn)return kt[e-1]<=n;return!1}function pr(n){return n>=127462&&n<=127487}const mr=8205;function ce(n,e,t=!0,i=!0){return(t?nl:qh)(n,e,i)}function nl(n,e,t){if(e==n.length)return e;e&&sl(n.charCodeAt(e))&&rl(n.charCodeAt(e-1))&&e--;let i=Y(n,e);for(e+=de(i);e=0&&pr(Y(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function qh(n,e,t){for(;e>0;){let i=nl(n,e-2,t);if(i=56320&&n<57344}function rl(n){return n>=55296&&n<56320}function Y(n,e){let t=n.charCodeAt(e);if(!rl(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return sl(i)?(t-55296<<10)+(i-56320)+65536:t}function Ns(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function de(n){return n<65536?1:2}function ti(n,e,t=n.length){let i=0;for(let s=0;s=e)return s;if(s==n.length)break;r+=n.charCodeAt(s)==9?t-r%t:1,s=ce(n,s)}return i===!0?-1:n.length}class E{constructor(){}lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),Oe.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){let i=[];return this.decompose(e,t,i,0),Oe.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new qt(this),r=new qt(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new qt(this,e)}iterRange(e,t=this.length){return new ol(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new ll(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?E.empty:e.length<=32?new z(e):Oe.from(z.split(e,[]))}}class z extends E{constructor(e,t=Uh(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new Gh(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new z(gr(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=Ci(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new z(l,o.length+r.length));else{let a=l.length>>1;i.push(new z(l.slice(0,a)),new z(l.slice(a)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof z))return super.replace(e,t,i);let s=Ci(this.text,Ci(i.text,gr(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new z(s,r):Oe.from(z.split(s,[]),r)}sliceString(e,t=this.length,i=` `){let s="";for(let r=0,o=0;r<=t&&oe&&o&&(s+=i),er&&(s+=l.slice(Math.max(0,e-r),t-r)),r=a+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],s=-1;for(let r of e)i.push(r),s+=r.length+1,i.length==32&&(t.push(new z(i,s)),i=[],s=-1);return s>-1&&t.push(new z(i,s)),t}}class Oe extends E{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.children[r],l=s+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,s);s=l+1,i=a+1}}decompose(e,t,i,s){for(let r=0,o=0;o<=t&&r=o){let h=s&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if(i.lines=r&&t<=l){let a=o.replace(e-r,t-r,i),h=this.lines-o.lines+a.lines;if(a.lines>5-1&&a.lines>h>>5+1){let c=this.children.slice();return c[s]=a,new Oe(c,this.length-(t-e)+i.length)}return super.replace(r,l,a)}r=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=` `){let s="";for(let r=0,o=0;re&&r&&(s+=i),eo&&(s+=l.sliceString(e-o,t-o,i)),o=a+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Oe))return 0;let i=0,[s,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,r+=t){if(s==o||r==l)return i;let a=this.children[s],h=e.children[r];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let p of e)p.flatten(d);return new z(d,t)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1,l=[],a=0,h=-1,c=[];function f(d){let p;if(d.lines>r&&d instanceof Oe)for(let m of d.children)f(m);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof z&&a&&(p=c[c.length-1])instanceof z&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new z(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>s&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:Oe.from(c,h)),h=-1,a=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new Oe(l,t)}}E.empty=new z([""],0);function Uh(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Ci(n,e,t=0,i=1e9){for(let s=0,r=0,o=!0;r=t&&(a>i&&(l=l.slice(0,i-s)),s0?1:(e instanceof z?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],r=this.offsets[i],o=r>>1,l=s instanceof z?s.text.length:s.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=` `,this;e--}else if(s instanceof z){let a=s.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=s.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof z?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class ol{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new qt(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class ll{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=this.inner.next(e);return t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(E.prototype[Symbol.iterator]=function(){return this.iter()},qt.prototype[Symbol.iterator]=ol.prototype[Symbol.iterator]=ll.prototype[Symbol.iterator]=function(){return this});class Gh{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}}const Un=/\r\n?|\n/;var ee=function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n}(ee||(ee={}));class Ee{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return r+(e-s);r+=l}else{if(i!=ee.Simple&&h>=e&&(i==ee.TrackDel&&se||i==ee.TrackBefore&&se))return null;if(h>e||h==e&&t<0&&!l)return e==s||t<0?r:r+a;r+=a}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return r}touchesRange(e,t=e){for(let i=0,s=0;i=0&&s<=t&&l>=e)return st?"cover":!0;s=l}return!1}toString(){let e="";for(let t=0;t=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ee(e)}}class q extends Ee{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Gn(this,(t,i,s,r,o)=>e=e.replace(s,s+(i-t),o),!1),e}mapDesc(e,t=!1){return jn(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let s=0,r=0;s=0){t[s]=l,t[s+1]=o;let a=s>>1;for(;i.length0&&st(i,t,r.text),r.forward(c),l+=c}let h=e[o++];for(;l>1].toJSON()))}return e}static of(e,t,i){let s=[],r=[],o=0,l=null;function a(c=!1){if(!c&&!s.length)return;ou||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let p=d?typeof d=="string"?E.of(d.split(i||Un)):d:E.empty,m=p.length;if(f==u&&m==0)return;fo&&Z(s,f-o,-1),Z(s,u-f,m),st(r,s,p),o=u}}return h(e),a(!l),l}static empty(e){return new q(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let s=0;sl&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)t.push(r[0],0);else{for(;i.length=0&&t<=0&&t==n[s+1]?n[s]+=e:e==0&&n[s]==0?n[s+1]+=t:i?(n[s]+=e,n[s+1]+=t):n.push(e,t)}function st(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(s,h,r,c,f),s=h,r=c}}}function jn(n,e,t,i=!1){let s=[],r=i?[]:null,o=new Kt(n),l=new Kt(e);for(let a=0,h=0;;)if(o.ins==-1)a+=o.len,o.next();else if(l.ins==-1&&h=0&&(o.done||hh&&!o.done&&a+o.len=0){let c=0,f=a+o.len;for(;;)if(l.ins>=0&&h>a&&h+l.lena||o.ins>=0&&o.len>a)&&(l||i.length>h),r.forward2(a),o.forward(a)}}}}class Kt{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?E.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?E.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class bt{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&16?this.to:this.from}get head(){return this.flags&16?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&4?-1:this.flags&8?1:0}get bidiLevel(){let e=this.flags&3;return e==3?null:e}get goalColumn(){let e=this.flags>>5;return e==33554431?void 0:e}map(e,t=-1){let i,s;return this.empty?i=s=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new bt(i,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return g.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return g.range(this.anchor,i)}eq(e){return this.anchor==e.anchor&&this.head==e.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return g.range(e.anchor,e.head)}}class g{constructor(e,t=0){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:g.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let t=0;te.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new g(e.ranges.map(t=>bt.fromJSON(t)),e.main)}static single(e,t=e){return new g([g.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;se?4:0))}}function jh(n,e=0){let t=n[e];n.sort((i,s)=>i.from-s.from),e=n.indexOf(t);for(let i=1;is.head?g.range(l,o):g.range(o,l))}}return new g(n,e)}function hl(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let $s=0;class k{constructor(e,t,i,s,r){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=s,this.extensions=r,this.id=$s++,this.default=e([])}static define(e={}){return new k(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:Vs),!!e.static,e.enables)}of(e){return new Ai([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ai(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ai(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function Vs(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class Ai{constructor(e,t,i,s){this.dependencies=e,this.facet=t,this.type=i,this.value=s,this.id=$s++}dynamicSlot(e){var t;let i=this.value,s=this.facet.compareInput,r=this.id,o=e[r]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:((t=e[f.id])!==null&&t!==void 0?t:1)&1||c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||c.some(d=>(lt(f,d)&1)>0)){let d=i(f);if(l?!yr(d,f.values[o],s):!s(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure(f,u){let d=i(f),p=u.config.address[r];if(p!=null){let m=Ei(u,p);if(l?yr(d,m,s):s(d,m))return f.values[o]=m,0}return f.values[o]=d,1}}}}function yr(n,e,t){if(n.length!=e.length)return!1;for(let i=0;in[a.id]),s=t.map(a=>a.type),r=i.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let h=[];for(let c=0;clt(a,f)&1))return 0;let c=l(a);return e.compare(c,a.values[o])?0:(a.values[o]=c,1)},reconfigure(a,h){let c=i.some(p=>lt(a,p)&1),f=h.config.facets[e.id],u=h.facet(e);if(f&&!c&&Vs(t,f))return a.values[o]=u,0;let d=l(a);return e.compare(d,u)?(a.values[o]=u,0):(a.values[o]=d,1)}}}const br=k.define({static:!0});class _{constructor(e,t,i,s,r){this.id=e,this.createF=t,this.updateF=i,this.compareF=s,this.spec=r,this.provides=void 0}static define(e){let t=new _($s++,e.create,e.update,e.compare||((i,s)=>i===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(br).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,s)=>{let r=i.values[t],o=this.updateF(r,s);return this.compareF(r,o)?0:(i.values[t]=o,1)},reconfigure:(i,s)=>s.config.address[this.id]!=null?(i.values[t]=s.field(this),0):(i.values[t]=this.create(i),1)}}init(e){return[this,br.of({field:this,create:e})]}get extension(){return this}}const Pe={lowest:4,low:3,default:2,high:1,highest:0};function We(n){return e=>new cl(e,n)}const ii={lowest:We(Pe.lowest),low:We(Pe.low),default:We(Pe.default),high:We(Pe.high),highest:We(Pe.highest),fallback:We(Pe.lowest),extend:We(Pe.high),override:We(Pe.highest)};class cl{constructor(e,t){this.inner=e,this.prec=t}}class Zi{of(e){return new Kn(this,e)}reconfigure(e){return Zi.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Kn{constructor(e,t){this.compartment=e,this.inner=t}}class Ri{constructor(e,t,i,s,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,i){let s=[],r=Object.create(null),o=new Map;for(let u of Qh(e,t,o))u instanceof _?s.push(u):(r[u.facet.id]||(r[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of s)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let c=i==null?void 0:i.config.facets;for(let u in r){let d=r[u],p=d[0].facet,m=c&&c[u]||[];if(d.every(y=>y.type==0))if(l[p.id]=a.length<<1|1,Vs(m,d))a.push(i.facet(p));else{let y=p.combine(d.map(b=>b.value));a.push(i&&p.compare(y,i.facet(p))?i.facet(p):y)}else{for(let y of d)y.type==0?(l[y.id]=a.length<<1|1,a.push(y.value)):(l[y.id]=h.length<<1,h.push(b=>y.dynamicSlot(b)));l[p.id]=h.length<<1,h.push(y=>Kh(y,p,d))}}let f=h.map(u=>u(l));return new Ri(e,o,f,l,a,r)}}function Qh(n,e,t){let i=[[],[],[],[],[]],s=new Map;function r(o,l){let a=s.get(o);if(a!=null){if(a>=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof Kn&&t.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let h of o)r(h,l);else if(o instanceof Kn){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),r(h,l)}else if(o instanceof cl)r(o.inner,o.prec);else if(o instanceof _)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof Ai)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,l);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(h,l)}}return r(n,Pe.default),i.reduce((o,l)=>o.concat(l))}function lt(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let s=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|s}function Ei(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const fl=k.define(),ul=k.define({combine:n=>n.some(e=>e),static:!0}),dl=k.define({combine:n=>n.length?n[0]:void 0,static:!0}),pl=k.define(),ml=k.define(),gl=k.define(),yl=k.define({combine:n=>n.length?n[0]:!1});class Je{constructor(e,t){this.type=e,this.value=t}static define(){return new Xh}}class Xh{of(e){return new Je(this,e)}}class Yh{constructor(e){this.map=e}of(e){return new A(this,e)}}class A{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new A(this.type,t)}is(e){return this.type==e}static define(e={}){return new Yh(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let s of e){let r=s.map(t);r&&i.push(r)}return i}}A.reconfigure=A.define();A.appendConfig=A.define();class H{constructor(e,t,i,s,r,o){this.startState=e,this.changes=t,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&hl(i,t.newLength),r.some(l=>l.type==H.time)||(this.annotations=r.concat(H.time.of(Date.now())))}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(H.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}H.time=Je.define();H.userEvent=Je.define();H.addToHistory=Je.define();H.remote=Je.define();function Jh(n,e){let t=[];for(let i=0,s=0;;){let r,o;if(i=n[i]))r=n[i++],o=n[i++];else if(s=0;s--){let r=i[s](n);r instanceof H?n=r:Array.isArray(r)&&r.length==1&&r[0]instanceof H?n=r[0]:n=wl(e,Ot(r),!1)}return n}function Zh(n){let e=n.startState,t=e.facet(gl),i=n;for(let s=t.length-1;s>=0;s--){let r=t[s](n);r&&Object.keys(r).length&&(i=bl(n,Qn(e,r,n.changes.newLength),!0))}return i==n?n:new H(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const ec=[];function Ot(n){return n==null?ec:Array.isArray(n)?n:[n]}var te=function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n}(te||(te={}));const tc=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Xn;try{Xn=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function ic(n){if(Xn)return Xn.test(n);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||tc.test(t)))return!0}return!1}function nc(n){return e=>{if(!/\S/.test(e))return te.Space;if(ic(e))return te.Word;for(let t=0;t-1)return te.Word;return te.Other}}class P{constructor(e,t,i,s,r,o){this.config=e,this.doc=t,this.selection=i,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;ls.set(a,l)),t=null),s.set(o.value.compartment,o.value.extension)):o.is(A.reconfigure)?(t=null,i=o.value):o.is(A.appendConfig)&&(t=null,i=Ot(i).concat(o.value));let r;t?r=e.startState.values.slice():(t=Ri.resolve(i,s,this),r=new P(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(l,a)=>a.reconfigure(l,this),null).values),new P(t,e.newDoc,e.newSelection,r,(o,l)=>l.update(o,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:g.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),s=this.changes(i.changes),r=[i.range],o=Ot(i.effects);for(let l=1;lo.spec.fromJSON(l,a)))}return P.create({doc:e.doc,selection:g.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=Ri.resolve(e.extensions||[],new Map),i=e.doc instanceof E?e.doc:E.of((e.doc||"").split(t.staticFacet(P.lineSeparator)||Un)),s=e.selection?e.selection instanceof g?e.selection:g.single(e.selection.anchor,e.selection.head):g.single(0);return hl(s,i.length),t.staticFacet(ul)||(s=s.asSingle()),new P(t,i,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(P.tabSize)}get lineBreak(){return this.facet(P.lineSeparator)||` diff --git a/dist/assets/CollapseSection-2629b821.js b/dist/assets/CollapseSection-3723ca05.js similarity index 94% rename from dist/assets/CollapseSection-2629b821.js rename to dist/assets/CollapseSection-3723ca05.js index 90b014f824..cf3179150a 100644 --- a/dist/assets/CollapseSection-2629b821.js +++ b/dist/assets/CollapseSection-3723ca05.js @@ -1,4 +1,4 @@ -import{r as g,a as s,j as i,i as v,b2 as y,s as l}from"./index-61b6fc23.js";const f=l.div` +import{r as g,a as s,j as i,i as v,b2 as y,s as l}from"./index-9d63439d.js";const f=l.div` transition: height .25s; border-radius: .5em; margin: 0px 4px 0px 4px; diff --git a/dist/assets/ContentInfoCap-a4e0cbe4.js b/dist/assets/ContentInfoCap-cd73424d.js similarity index 93% rename from dist/assets/ContentInfoCap-a4e0cbe4.js rename to dist/assets/ContentInfoCap-cd73424d.js index dcaedb37d7..b556f74502 100644 --- a/dist/assets/ContentInfoCap-a4e0cbe4.js +++ b/dist/assets/ContentInfoCap-cd73424d.js @@ -1 +1 @@ -import{l as r,w as p,m as g,a6 as u,G as h,a as n,F as l,j as i}from"./index-61b6fc23.js";import{f as x,a as b}from"./util-85d105b8.js";import"./util-38d8e238.js";function _(){const s=r(p),d=r(g("doenetId"));let{color:o,image:e,label:c}=u(s);const t=r(h(d));let a="course";if(!e)return null;e!="none"&&(a=x(e),e="url(./drive_pictures/"+e+")"),o!="none"&&(a=b(o),o="#"+o);let m=n(l,{children:[i("div",{style:{marginBottom:"1px",marginTop:"5px"},children:"Activity"}),i("div",{style:{marginBottom:"5px",padding:"1px 5px"},children:t==null?void 0:t.label})]});return n(l,{children:[i("div",{style:{position:"relative",width:"100%",height:"165px",overflow:"hidden"},children:i("img",{"aria-label":a,style:{position:"absolute",width:"100%",height:"100%",backgroundSize:"cover",backgroundPosition:"center",backgroundImage:e,backgroundColor:o}})}),i("div",{style:{marginBottom:"1px",marginTop:"5px"},children:"Course"}),i("div",{style:{marginBottom:"5px",padding:"1px 5px"},children:c}),m]})}export{_ as default}; +import{l as r,w as p,m as g,a6 as u,G as h,a as n,F as l,j as i}from"./index-9d63439d.js";import{f as x,a as b}from"./util-85d105b8.js";import"./util-38d8e238.js";function _(){const s=r(p),d=r(g("doenetId"));let{color:o,image:e,label:c}=u(s);const t=r(h(d));let a="course";if(!e)return null;e!="none"&&(a=x(e),e="url(./drive_pictures/"+e+")"),o!="none"&&(a=b(o),o="#"+o);let m=n(l,{children:[i("div",{style:{marginBottom:"1px",marginTop:"5px"},children:"Activity"}),i("div",{style:{marginBottom:"5px",padding:"1px 5px"},children:t==null?void 0:t.label})]});return n(l,{children:[i("div",{style:{position:"relative",width:"100%",height:"165px",overflow:"hidden"},children:i("img",{"aria-label":a,style:{position:"absolute",width:"100%",height:"100%",backgroundSize:"cover",backgroundPosition:"center",backgroundImage:e,backgroundColor:o}})}),i("div",{style:{marginBottom:"1px",marginTop:"5px"},children:"Course"}),i("div",{style:{marginBottom:"5px",padding:"1px 5px"},children:c}),m]})}export{_ as default}; diff --git a/dist/assets/CourseCards-a2430c3c.js b/dist/assets/CourseCards-25c0dcb5.js similarity index 96% rename from dist/assets/CourseCards-a2430c3c.js rename to dist/assets/CourseCards-25c0dcb5.js index 8168cec3eb..9f739e2d86 100644 --- a/dist/assets/CourseCards-a2430c3c.js +++ b/dist/assets/CourseCards-25c0dcb5.js @@ -1,4 +1,4 @@ -import{r as m,s as L,a as T,j as b,l as N,n as V,R as M,o as W,q as P,g as q,p as F,t as U,v as X,w as Y,x as G}from"./index-61b6fc23.js";import{d as H}from"./CourseToolHandler-d3da4c3a.js";import"./index-1380c04c.js";import"./index-fcf36459.js";import"./index-47ca4f11.js";import"./index.esm-d246f4c9.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./ButtonGroup-6d856500.js";function _(e,t,a){var o,c,d,h,p;t==null&&(t=100);function r(){var g=Date.now()-h;g=0?o=setTimeout(r,t-g):(o=null,a||(p=e.apply(d,c),d=c=null))}var w=function(){d=this,c=arguments,h=Date.now();var g=a&&!o;return o||(o=setTimeout(r,t)),g&&(p=e.apply(d,c),d=c=null),p};return w.clear=function(){o&&(clearTimeout(o),o=null)},w.flush=function(){o&&(p=e.apply(d,c),d=c=null,clearTimeout(o),o=null)},w}_.debounce=_;var $=_;function J(e){let{debounce:t,scroll:a,polyfill:o,offsetSize:c}=e===void 0?{debounce:0,scroll:!1,offsetSize:!1}:e;const d=o||(typeof window>"u"?class{}:window.ResizeObserver);if(!d)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[h,p]=m.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),r=m.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:h}),w=t?typeof t=="number"?t:t.scroll:null,g=t?typeof t=="number"?t:t.resize:null,C=m.useRef(!1);m.useEffect(()=>(C.current=!0,()=>void(C.current=!1)));const[R,y,S]=m.useMemo(()=>{const u=()=>{if(!r.current.element)return;const{left:K,top:n,width:i,height:s,bottom:f,right:v,x:l,y:A}=r.current.element.getBoundingClientRect(),z={left:K,top:n,width:i,height:s,bottom:f,right:v,x:l,y:A};r.current.element instanceof HTMLElement&&c&&(z.height=r.current.element.offsetHeight,z.width=r.current.element.offsetWidth),Object.freeze(z),C.current&&!te(r.current.lastBounds,z)&&p(r.current.lastBounds=z)};return[u,g?$(u,g):u,w?$(u,w):u]},[p,c,w,g]);function I(){r.current.scrollContainers&&(r.current.scrollContainers.forEach(u=>u.removeEventListener("scroll",S,!0)),r.current.scrollContainers=null),r.current.resizeObserver&&(r.current.resizeObserver.disconnect(),r.current.resizeObserver=null)}function k(){r.current.element&&(r.current.resizeObserver=new d(S),r.current.resizeObserver.observe(r.current.element),a&&r.current.scrollContainers&&r.current.scrollContainers.forEach(u=>u.addEventListener("scroll",S,{capture:!0,passive:!0})))}const O=u=>{!u||u===r.current.element||(I(),r.current.element=u,r.current.scrollContainers=j(u),k())};return Z(S,!!a),Q(y),m.useEffect(()=>{I(),k()},[a,S,y]),m.useEffect(()=>I,[]),[O,h,R]}function Q(e){m.useEffect(()=>{const t=e;return window.addEventListener("resize",t),()=>void window.removeEventListener("resize",t)},[e])}function Z(e,t){m.useEffect(()=>{if(t){const a=e;return window.addEventListener("scroll",a,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",a,!0)}},[e,t])}function j(e){const t=[];if(!e||e===document.body)return t;const{overflow:a,overflowX:o,overflowY:c}=window.getComputedStyle(e);return[a,o,c].some(d=>d==="auto"||d==="scroll")&&t.push(e),[...t,...j(e.parentElement)]}const ee=["x","y","top","bottom","left","right","width","height"],te=(e,t)=>ee.every(a=>e[a]===t[a]),re=L.figure` +import{r as m,s as L,a as T,j as b,l as N,n as V,R as M,o as W,q as P,g as q,p as F,t as U,v as X,w as Y,x as G}from"./index-9d63439d.js";import{d as H}from"./CourseToolHandler-d3661515.js";import"./index-df71c5ec.js";import"./index-fcf36459.js";import"./index-47ca4f11.js";import"./index.esm-d6b6ff57.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./ButtonGroup-ec02b3e9.js";function _(e,t,a){var o,c,d,h,p;t==null&&(t=100);function r(){var g=Date.now()-h;g=0?o=setTimeout(r,t-g):(o=null,a||(p=e.apply(d,c),d=c=null))}var w=function(){d=this,c=arguments,h=Date.now();var g=a&&!o;return o||(o=setTimeout(r,t)),g&&(p=e.apply(d,c),d=c=null),p};return w.clear=function(){o&&(clearTimeout(o),o=null)},w.flush=function(){o&&(p=e.apply(d,c),d=c=null,clearTimeout(o),o=null)},w}_.debounce=_;var $=_;function J(e){let{debounce:t,scroll:a,polyfill:o,offsetSize:c}=e===void 0?{debounce:0,scroll:!1,offsetSize:!1}:e;const d=o||(typeof window>"u"?class{}:window.ResizeObserver);if(!d)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[h,p]=m.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),r=m.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:h}),w=t?typeof t=="number"?t:t.scroll:null,g=t?typeof t=="number"?t:t.resize:null,C=m.useRef(!1);m.useEffect(()=>(C.current=!0,()=>void(C.current=!1)));const[R,y,S]=m.useMemo(()=>{const u=()=>{if(!r.current.element)return;const{left:K,top:n,width:i,height:s,bottom:f,right:v,x:l,y:A}=r.current.element.getBoundingClientRect(),z={left:K,top:n,width:i,height:s,bottom:f,right:v,x:l,y:A};r.current.element instanceof HTMLElement&&c&&(z.height=r.current.element.offsetHeight,z.width=r.current.element.offsetWidth),Object.freeze(z),C.current&&!te(r.current.lastBounds,z)&&p(r.current.lastBounds=z)};return[u,g?$(u,g):u,w?$(u,w):u]},[p,c,w,g]);function I(){r.current.scrollContainers&&(r.current.scrollContainers.forEach(u=>u.removeEventListener("scroll",S,!0)),r.current.scrollContainers=null),r.current.resizeObserver&&(r.current.resizeObserver.disconnect(),r.current.resizeObserver=null)}function k(){r.current.element&&(r.current.resizeObserver=new d(S),r.current.resizeObserver.observe(r.current.element),a&&r.current.scrollContainers&&r.current.scrollContainers.forEach(u=>u.addEventListener("scroll",S,{capture:!0,passive:!0})))}const O=u=>{!u||u===r.current.element||(I(),r.current.element=u,r.current.scrollContainers=j(u),k())};return Z(S,!!a),Q(y),m.useEffect(()=>{I(),k()},[a,S,y]),m.useEffect(()=>I,[]),[O,h,R]}function Q(e){m.useEffect(()=>{const t=e;return window.addEventListener("resize",t),()=>void window.removeEventListener("resize",t)},[e])}function Z(e,t){m.useEffect(()=>{if(t){const a=e;return window.addEventListener("scroll",a,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",a,!0)}},[e,t])}function j(e){const t=[];if(!e||e===document.body)return t;const{overflow:a,overflowX:o,overflowY:c}=window.getComputedStyle(e);return[a,o,c].some(d=>d==="auto"||d==="scroll")&&t.push(e),[...t,...j(e.parentElement)]}const ee=["x","y","top","bottom","left","right","width","height"],te=(e,t)=>ee.every(a=>e[a]===t[a]),re=L.figure` margin: 0px; position: relative; background-size: cover; diff --git a/dist/assets/CourseChooserLeave-57eb280d.js b/dist/assets/CourseChooserLeave-57eb280d.js deleted file mode 100644 index 17142bac18..0000000000 --- a/dist/assets/CourseChooserLeave-57eb280d.js +++ /dev/null @@ -1 +0,0 @@ -import{v as o,q as t}from"./index-61b6fc23.js";import{g as r,d as i}from"./CourseToolHandler-d3da4c3a.js";import"./index-1380c04c.js";import"./index-fcf36459.js";import"./index-47ca4f11.js";import"./index.esm-d246f4c9.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./ButtonGroup-6d856500.js";function S(){return o(({set:e})=>()=>{e(t,""),e(r,[]),e(i,[])})(),null}export{S as default}; diff --git a/dist/assets/CourseChooserLeave-fa36f4fc.js b/dist/assets/CourseChooserLeave-fa36f4fc.js new file mode 100644 index 0000000000..967fca0cf2 --- /dev/null +++ b/dist/assets/CourseChooserLeave-fa36f4fc.js @@ -0,0 +1 @@ +import{v as o,q as t}from"./index-9d63439d.js";import{g as r,d as i}from"./CourseToolHandler-d3661515.js";import"./index-df71c5ec.js";import"./index-fcf36459.js";import"./index-47ca4f11.js";import"./index.esm-d6b6ff57.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./ButtonGroup-ec02b3e9.js";function S(){return o(({set:e})=>()=>{e(t,""),e(r,[]),e(i,[])})(),null}export{S as default}; diff --git a/dist/assets/CourseEnroll-c7e6f0e7.js b/dist/assets/CourseEnroll-19514ec8.js similarity index 65% rename from dist/assets/CourseEnroll-c7e6f0e7.js rename to dist/assets/CourseEnroll-19514ec8.js index cbceb58b00..a9204a042b 100644 --- a/dist/assets/CourseEnroll-c7e6f0e7.js +++ b/dist/assets/CourseEnroll-19514ec8.js @@ -1 +1 @@ -import{y as e,a as l,j as t,B as n,z as s}from"./index-61b6fc23.js";import{B as a}from"./ButtonGroup-6d856500.js";function c(o){const r=e();return l("div",{style:o.style,children:[t("div",{children:"Enter Enrollment code"}),t(a,{vertical:!0,children:t(n,{onClick:()=>r("Stub Enrolled in Course!",s.SUCCESS),value:"Enroll",children:"Enroll"})})]})}export{c as default}; +import{y as e,a as l,j as t,B as n,z as s}from"./index-9d63439d.js";import{B as a}from"./ButtonGroup-ec02b3e9.js";function c(o){const r=e();return l("div",{style:o.style,children:[t("div",{children:"Enter Enrollment code"}),t(a,{vertical:!0,children:t(n,{onClick:()=>r("Stub Enrolled in Course!",s.SUCCESS),value:"Enroll",children:"Enroll"})})]})}export{c as default}; diff --git a/dist/assets/CourseNavigator-ee468584.js b/dist/assets/CourseNavigator-f7abeab6.js similarity index 98% rename from dist/assets/CourseNavigator-ee468584.js rename to dist/assets/CourseNavigator-f7abeab6.js index 9388ae63f8..6d28f75102 100644 --- a/dist/assets/CourseNavigator-ee468584.js +++ b/dist/assets/CourseNavigator-f7abeab6.js @@ -1,4 +1,4 @@ -import{l as R,m as I,S as xe,r as _,R as ce,o as Be,v as W,T as H,q as se,G as g,j as i,s as $e,V as de,a as B,F as A,W as Y,X as U,Y as Q,Z as ne,_ as le,J as we,$ as pe,i as E,B as ie,a0 as N,a1 as Ce,a2 as De}from"./index-61b6fc23.js";import{M as Re}from"./index.esm-d246f4c9.js";/* empty css */import{e as Ae}from"./RoleDropdown-c9fff172.js";import{B as Te}from"./ButtonGroup-6d856500.js";const ae=$e.button` +import{l as R,m as I,S as xe,r as _,R as ce,o as Be,v as W,T as H,q as se,G as g,j as i,s as $e,V as de,a as B,F as A,W as Y,X as U,Y as Q,Z as ne,_ as le,J as we,$ as pe,i as E,B as ie,a0 as N,a1 as Ce,a2 as De}from"./index-9d63439d.js";import{M as Re}from"./index.esm-d6b6ff57.js";/* empty css */import{e as Ae}from"./RoleDropdown-2d4e4388.js";import{B as Te}from"./ButtonGroup-ec02b3e9.js";const ae=$e.button` border: none; border-radius: 35px; &:focus { diff --git a/dist/assets/CourseToolHandler-d3da4c3a.js b/dist/assets/CourseToolHandler-d3661515.js similarity index 99% rename from dist/assets/CourseToolHandler-d3da4c3a.js rename to dist/assets/CourseToolHandler-d3661515.js index 90445ad81f..4fdb70a98c 100644 --- a/dist/assets/CourseToolHandler-d3da4c3a.js +++ b/dist/assets/CourseToolHandler-d3661515.js @@ -1,4 +1,4 @@ -import{r as B,av as _e,j as E,a as oe,v as K,ag as he,ax as Ne,ay as Y,az as q,y as Ke,aA as xt,ae as ce,k as P,z as j,N as ke,U as Lt,s as fe,l as Ie,g as ct,i as ae,J as Tt,b as Rt,a0 as Pe,F as me,B as xe,aB as _t}from"./index-61b6fc23.js";import{l as Je}from"./index-1380c04c.js";import{f as We}from"./index-47ca4f11.js";import"./index.esm-d246f4c9.js";/* empty css */import{B as Nt}from"./ButtonGroup-6d856500.js";const Ae=96,Se=123,Ft=97,Pt=98,Bt=122;function Ut(n,e){let t,i,r=0,s="";for(;t==i;)t=r{s===n&&t(!1)};return B.useEffect(()=>(window.addEventListener("keydown",i),window.addEventListener("keyup",r),()=>{window.removeEventListener("keydown",i),window.removeEventListener("keyup",r)}),[]),e}const $t=_e.createContext(),qt=({children:n,id:e,registerDropTarget:t,unregisterDropTarget:i,dropCallbacks:r})=>{const s=B.useRef(),{onDragOver:o,onDragHover:a,onDrop:c,onDragEnter:d,onDragExit:l}=r;return B.useEffect(()=>(t({id:e,ref:s.current,onDragOver:o,onDragHover:a,onDragEnter:d,onDragExit:l,onDrop:c}),()=>{i(e)}),[e,t,i]),E("div",{ref:s,children:n})},Xe={x:0,y:0},Vt=({children:n,id:e,className:t="",onDragStart:i,onDrag:r,onDragEnd:s,ghostElement:o=null})=>{const[a,c]=B.useState({isDragging:!1,origin:Xe,translation:Xe,actionType:null}),d=B.useRef(null),l=B.useRef(null),[v,u]=B.useState(!1),k=B.useCallback(m=>{m.button===0&&(u(!0),l.current={...m},d.current=setTimeout(()=>{var b,S;let w=l.current,p=w.clientX,f=w.clientY,D="mouse";w.type==="touchstart"&&(p=(b=w.touches[0])==null?void 0:b.clientX,f=(S=w.touches[0])==null?void 0:S.clientY,D="touch"),c(L=>({...L,isDragging:!0,origin:{x:p,y:f},actionType:D})),i==null||i({ev:l.current}),d.current=null},300))},[i,e]),y=B.useCallback(()=>{d.current?clearTimeout(d.current):(c(m=>({...m,isDragging:!1,actionType:null})),s==null||s()),u(!1)},[s]),g=B.useCallback(m=>{var D,b;if(!a.isDragging)return;let w=m.clientX,p=m.clientY;m.type==="touchmove"&&(w=(D=m.touches[0])==null?void 0:D.clientX,p=(b=m.touches[0])==null?void 0:b.clientY);const f={x:w-a.origin.x,y:p-a.origin.y};c(S=>({...S,translation:f})),r==null||r({clientX:w,clientY:p,translation:f,id:e,ev:m})},[a.origin,r,e]);B.useEffect(()=>(v?(window.addEventListener("mouseup",y),window.addEventListener("touchend",y)):(window.removeEventListener("mouseup",y),window.removeEventListener("touchend",y)),()=>{window.removeEventListener("mouseup",y),window.removeEventListener("touchend",y)}),[v,y]),B.useEffect(()=>(a.isDragging?(window.addEventListener("mousemove",g),window.addEventListener("touchmove",g)):(window.removeEventListener("mousemove",g),window.removeEventListener("touchmove",g),c(m=>({...m,translation:{x:0,y:0}}))),()=>{window.removeEventListener("mousemove",g),window.removeEventListener("touchmove",g)}),[a.isDragging,g]);const I={cursor:a.isDragging?"-webkit-grabbing":"-webkit-grab",transition:a.isDragging?"none":"transform 500ms"},A={cursor:a.isDragging?"-webkit-grabbing":"-webkit-grab",transform:a.isDragging?`translate(${a.translation.x}px, ${a.translation.y}px)`:"",transition:a.isDragging?"visibility 0s, opacity 0.2s linear":"visibility 0s, opacity 0.2s linear, transform 500ms",zIndex:a.isDragging?2:1,opacity:a.isDragging?1:0,visibility:a.isDragging?"visible":"hidden",height:a.isDragging?"auto":"0",position:a.isDragging?"absolute":"relative",left:a.origin.x,top:a.origin.y};return oe("div",{className:t,style:I,onMouseDown:k,onTouchStart:k,children:[n,E("div",{style:A,children:o})]},`draggable${e}`)},X="dragShadow",dt=()=>{const n=K(({snapshot:r})=>async()=>{const{dragShadowDriveId:s,dragShadowParentId:o}=await r.getPromise(ee),a=await r.getPromise(M);if(!s||!o)return;let c=null;s&&o&&(c=await r.getPromise(R({driveId:s,folderId:o})));let d=c==null?void 0:c.contentIds[x.DEFAULT],l=d==null?void 0:d.indexOf(X);return l<0?{}:{targetDriveId:s,targetFolderId:o,index:l,numItems:a.length}}),e=K(({snapshot:r,set:s})=>async({driveIdFolderId:o,position:a,parentId:c,itemId:d})=>{const{dragShadowDriveId:l,dragShadowParentId:v,draggedItemsId:u,copyMode:k}=await r.getPromise(ee);if(!k&&u&&(u!=null&&u.has(d))){t();return}const y={assignmentId:null,doenetId:null,cid:null,creationDate:"",isPublished:"0",itemId:X,itemType:"DragShadow",label:"",parentFolderId:c,url:null,urlDescription:null,urlId:null},g=a,I=c;let A=null;if(l&&v&&(A=await r.getPromise(R({driveId:l,folderId:v}))),A&&s(R({driveId:l,folderId:v}),m=>{let w={...m},p=[...w.contentIds[x.DEFAULT]];p=p.filter(D=>D!==X);const f={[x.DEFAULT]:p};return w.contentIds=f,w}),g==="intoCurrent"){if(u&&(u!=null&&u.has(o.folderId)))return;s(R(o),m=>{let w={...m},p={...m.contentsDictionary},f=[...w.contentIds[x.DEFAULT]];p[X]=y,v===I&&(f=f.filter(b=>b!==X)),f.splice(0,0,X);const D={[x.DEFAULT]:f};return w.contentIds=D,w.contentsDictionary=p,w}),s(ee,m=>({...m,dragShadowDriveId:o.driveId,dragShadowParentId:o.folderId}))}else{const m=({draggedItemsId:p,contentIdsArr:f,index:D})=>{if((p==null?void 0:p.size)>1)return!0;let b=!0,S=null,L=null;return f.length!==0&&(D<=0?S=f[0]:D>=f.length?L=f[f.length-1]:(L=f[D-1],S=f[D]),L&&(p!=null&&p.has(L))&&(b=!1),S&&(p!=null&&p.has(S))&&(b=!1)),b};let w=!0;s(R({driveId:o.driveId,folderId:I}),p=>{let f={...p},D={...p.contentsDictionary},b=[...f.contentIds[x.DEFAULT]];D[X]=y,v===I&&(b=b.filter(T=>T!==X));let S=b.indexOf(d);g==="afterCurrent"&&(S+=1),w=k||m({draggedItemsId:u,contentIdsArr:b,index:S}),w&&b.splice(S,0,X);const L={[x.DEFAULT]:b};return f.contentIds=L,f.contentsDictionary=D,f}),w&&s(ee,p=>({...p,dragShadowDriveId:o.driveId,dragShadowParentId:I}))}}),t=K(({snapshot:r,set:s})=>async()=>{const{dragShadowDriveId:o,dragShadowParentId:a}=await r.getPromise(ee);!o||!a||(s(R({driveId:o,folderId:a}),c=>{let d={...c},l=[...d.contentIds[x.DEFAULT]];l=l.filter(u=>u!==X);const v={[x.DEFAULT]:l};return d.contentIds=v,d}),s(ee,c=>({...c,dragShadowDriveId:null,dragShadowParentId:null})))}),i=K(({snapshot:r,set:s})=>async()=>{const{dragShadowDriveId:o,dragShadowParentId:a,openedFoldersInfo:c}=await r.getPromise(ee);let d=[...c],l=[];if(o&&a){let v=await r.getPromise($n({driveId:o,folderId:a})),u=new Set(v.map(k=>k.folderId));for(let k of d)!(k.driveId===o&&u.has(k.itemId))&&l.push(k)}else l=d;for(let v of l)s(ve(v),!1)});return{insertDragShadow:e,removeDragShadow:t,replaceDragShadow:n,cleanUpDragShadow:i}},Z=Object.create(null);Z.open="0";Z.close="1";Z.ping="2";Z.pong="3";Z.message="4";Z.upgrade="5";Z.noop="6";const Le=Object.create(null);Object.keys(Z).forEach(n=>{Le[Z[n]]=n});const Ht={type:"error",data:"parser error"},zt=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Kt=typeof ArrayBuffer=="function",Yt=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,lt=({type:n,data:e},t,i)=>zt&&e instanceof Blob?t?i(e):je(e,i):Kt&&(e instanceof ArrayBuffer||Yt(e))?t?i(e):je(new Blob([e]),i):i(Z[n]+(e||"")),je=(n,e)=>{const t=new FileReader;return t.onload=function(){const i=t.result.split(",")[1];e("b"+i)},t.readAsDataURL(n)},Qe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ge=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n{let e=n.length*.75,t=n.length,i,r=0,s,o,a,c;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const d=new ArrayBuffer(e),l=new Uint8Array(d);for(i=0;i>4,l[r++]=(o&15)<<4|a>>2,l[r++]=(a&3)<<6|c&63;return d},Jt=typeof ArrayBuffer=="function",ht=(n,e)=>{if(typeof n!="string")return{type:"message",data:ft(n,e)};const t=n.charAt(0);return t==="b"?{type:"message",data:Wt(n.substring(1),e)}:Le[t]?n.length>1?{type:Le[t],data:n.substring(1)}:{type:Le[t]}:Ht},Wt=(n,e)=>{if(Jt){const t=Gt(n);return ft(t,e)}else return{base64:!0,data:n}},ft=(n,e)=>{switch(e){case"blob":return n instanceof ArrayBuffer?new Blob([n]):n;case"arraybuffer":default:return n}},ut=String.fromCharCode(30),Xt=(n,e)=>{const t=n.length,i=new Array(t);let r=0;n.forEach((s,o)=>{lt(s,!1,a=>{i[o]=a,++r===t&&e(i.join(ut))})})},jt=(n,e)=>{const t=n.split(ut),i=[];for(let r=0;rtypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function mt(n,...e){return e.reduce((t,i)=>(n.hasOwnProperty(i)&&(t[i]=n[i]),t),{})}const Zt=setTimeout,en=clearTimeout;function Fe(n,e){e.useNativeTimers?(n.setTimeoutFn=Zt.bind(ie),n.clearTimeoutFn=en.bind(ie)):(n.setTimeoutFn=setTimeout.bind(ie),n.clearTimeoutFn=clearTimeout.bind(ie))}const tn=1.33;function nn(n){return typeof n=="string"?rn(n):Math.ceil((n.byteLength||n.size)*tn)}function rn(n){let e=0,t=0;for(let i=0,r=n.length;i=57344?t+=3:(i++,t+=4);return t}class sn extends Error{constructor(e,t,i){super(e),this.description=t,this.context=i,this.type="TransportError"}}class yt extends ${constructor(e){super(),this.writable=!1,Fe(this,e),this.opts=e,this.query=e.query,this.readyState="",this.socket=e.socket}onError(e,t,i){return super.emitReserved("error",new sn(e,t,i)),this}open(){return(this.readyState==="closed"||this.readyState==="")&&(this.readyState="opening",this.doOpen()),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=ht(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}}const gt="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),$e=64,on={};let Ze=0,Oe=0,et;function tt(n){let e="";do e=gt[n%$e]+e,n=Math.floor(n/$e);while(n>0);return e}function It(){const n=tt(+new Date);return n!==et?(Ze=0,et=n):n+"."+tt(Ze++)}for(;Oe<$e;Oe++)on[gt[Oe]]=Oe;function vt(n){let e="";for(let t in n)n.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e}function an(n){let e={},t=n.split("&");for(let i=0,r=t.length;i{this.readyState="paused",e()};if(this.polling||!this.writable){let i=0;this.polling&&(i++,this.once("pollComplete",function(){--i||t()})),this.writable||(i++,this.once("drain",function(){--i||t()}))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};jt(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,Xt(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.query||{};const t=this.opts.secure?"https":"http";let i="";this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=It()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.opts.port&&(t==="https"&&Number(this.opts.port)!==443||t==="http"&&Number(this.opts.port)!==80)&&(i=":"+this.opts.port);const r=vt(e),s=this.opts.hostname.indexOf(":")!==-1;return t+"://"+(s?"["+this.opts.hostname+"]":this.opts.hostname)+i+this.opts.path+(r.length?"?"+r:"")}request(e={}){return Object.assign(e,{xd:this.xd,xs:this.xs},this.opts),new Q(this.uri(),e)}doWrite(e,t){const i=this.request({method:"POST",data:e});i.on("success",t),i.on("error",(r,s)=>{this.onError("xhr post error",r,s)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,i)=>{this.onError("xhr poll error",t,i)}),this.pollXhr=e}}class Q extends ${constructor(e,t){super(),Fe(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.async=t.async!==!1,this.data=t.data!==void 0?t.data:null,this.create()}create(){const e=mt(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;const t=this.xhr=new bt(e);try{t.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0);for(let i in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(i)&&t.setRequestHeader(i,this.opts.extraHeaders[i])}}catch{}if(this.method==="POST")try{t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{t.setRequestHeader("Accept","*/*")}catch{}"withCredentials"in t&&(t.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(t.timeout=this.opts.requestTimeout),t.onreadystatechange=()=>{t.readyState===4&&(t.status===200||t.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof t.status=="number"?t.status:0)},0))},t.send(this.data)}catch(i){this.setTimeoutFn(()=>{this.onError(i)},0);return}typeof document<"u"&&(this.index=Q.requestsCount++,Q.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=dn,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Q.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}Q.requestsCount=0;Q.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",nt);else if(typeof addEventListener=="function"){const n="onpagehide"in ie?"pagehide":"unload";addEventListener(n,nt,!1)}}function nt(){for(let n in Q.requests)Q.requests.hasOwnProperty(n)&&Q.requests[n].abort()}const Dt=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0))(),Ee=ie.WebSocket||ie.MozWebSocket,it=!0,fn="arraybuffer",rt=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class un extends yt{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,i=rt?{}:mt(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=it&&!rt?t?new Ee(e,t):new Ee(e):new Ee(e,t,i)}catch(r){return this.emitReserved("error",r)}this.ws.binaryType=this.socket.binaryType||fn,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t{const o={};try{it&&this.ws.send(s)}catch{}r&&Dt(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){let e=this.query||{};const t=this.opts.secure?"wss":"ws";let i="";this.opts.port&&(t==="wss"&&Number(this.opts.port)!==443||t==="ws"&&Number(this.opts.port)!==80)&&(i=":"+this.opts.port),this.opts.timestampRequests&&(e[this.opts.timestampParam]=It()),this.supportsBinary||(e.b64=1);const r=vt(e),s=this.opts.hostname.indexOf(":")!==-1;return t+"://"+(s?"["+this.opts.hostname+"]":this.opts.hostname)+i+this.opts.path+(r.length?"?"+r:"")}check(){return!!Ee}}const pn={websocket:un,polling:hn},mn=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,yn=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function qe(n){const e=n,t=n.indexOf("["),i=n.indexOf("]");t!=-1&&i!=-1&&(n=n.substring(0,t)+n.substring(t,i).replace(/:/g,";")+n.substring(i,n.length));let r=mn.exec(n||""),s={},o=14;for(;o--;)s[yn[o]]=r[o]||"";return t!=-1&&i!=-1&&(s.source=e,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=gn(s,s.path),s.queryKey=In(s,s.query),s}function gn(n,e){const t=/\/{2,9}/g,i=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&i.splice(0,1),e.slice(-1)=="/"&&i.splice(i.length-1,1),i}function In(n,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,r,s){r&&(t[r]=s)}),t}let kt=class le extends ${constructor(e,t={}){super(),e&&typeof e=="object"&&(t=e,e=null),e?(e=qe(e),t.hostname=e.host,t.secure=e.protocol==="https"||e.protocol==="wss",t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=qe(t.host).host),Fe(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},t),this.opts.path=this.opts.path.replace(/\/$/,"")+"/",typeof this.opts.query=="string"&&(this.opts.query=an(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=pt,t.transport=e,this.id&&(t.sid=this.id);const i=Object.assign({},this.opts.transportOptions[e],this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new pn[e](i)}open(){let e;if(this.opts.rememberUpgrade&&le.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch{this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",t=>this.onClose("transport close",t))}probe(e){let t=this.createTransport(e),i=!1;le.priorWebsocketSuccess=!1;const r=()=>{i||(t.send([{type:"ping",data:"probe"}]),t.once("packet",v=>{if(!i)if(v.type==="pong"&&v.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;le.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(l(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const u=new Error("probe error");u.transport=t.name,this.emitReserved("upgradeError",u)}}))};function s(){i||(i=!0,l(),t.close(),t=null)}const o=v=>{const u=new Error("probe error: "+v);u.transport=t.name,s(),this.emitReserved("upgradeError",u)};function a(){o("transport closed")}function c(){o("socket closed")}function d(v){t&&v.name!==t.name&&s()}const l=()=>{t.removeListener("open",r),t.removeListener("error",o),t.removeListener("close",a),this.off("close",c),this.off("upgrading",d)};t.once("open",r),t.once("error",o),t.once("close",a),this.once("close",c),this.once("upgrading",d),t.open()}onOpen(){if(this.readyState="open",le.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade&&this.transport.pause){let e=0;const t=this.upgrades.length;for(;e{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let i=0;i0&&t>this.maxPayload)return this.writeBuffer.slice(0,i);t+=2}return this.writeBuffer}write(e,t,i){return this.sendPacket("message",e,t,i),this}send(e,t,i){return this.sendPacket("message",e,t,i),this}sendPacket(e,t,i,r){if(typeof t=="function"&&(r=t,t=void 0),typeof i=="function"&&(r=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const s={type:e,data:t,options:i};this.emitReserved("packetCreate",s),this.writeBuffer.push(s),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},i=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():e()}):this.upgrading?i():e()),this}onError(e){le.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let i=0;const r=e.length;for(;itypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,At=Object.prototype.toString,Dn=typeof Blob=="function"||typeof Blob<"u"&&At.call(Blob)==="[object BlobConstructor]",kn=typeof File=="function"||typeof File<"u"&&At.call(File)==="[object FileConstructor]";function Ye(n){return wn&&(n instanceof ArrayBuffer||bn(n))||Dn&&n instanceof Blob||kn&&n instanceof File}function Te(n,e){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let t=0,i=n.length;t=0&&n.num0;case C.ACK:case C.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&this.reconstructor.finishedReconstruction()}}class Cn{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=Sn(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const xn=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Ge,Encoder:En,get PacketType(){return C},protocol:On},Symbol.toStringTag,{value:"Module"}));function G(n,e,t){return n.on(e,t),function(){n.off(e,t)}}const Ln=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class St extends ${constructor(e,t,i){super(),this.connected=!1,this.receiveBuffer=[],this.sendBuffer=[],this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,i&&i.auth&&(this.auth=i.auth),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[G(e,"open",this.onopen.bind(this)),G(e,"packet",this.onpacket.bind(this)),G(e,"error",this.onerror.bind(this)),G(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(Ln.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');t.unshift(e);const i={type:C.EVENT,data:t};if(i.options={},i.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const o=this.ids++,a=t.pop();this._registerAckCallback(o,a),i.id=o}const r=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!r||!this.connected)||(this.connected?(this.notifyOutgoingListeners(i),this.packet(i)):this.sendBuffer.push(i)),this.flags={},this}_registerAckCallback(e,t){const i=this.flags.timeout;if(i===void 0){this.acks[e]=t;return}const r=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let s=0;s{this.io.clearTimeoutFn(r),t.apply(this,[null,...s])}}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this.packet({type:C.CONNECT,data:e})}):this.packet({type:C.CONNECT,data:this.auth})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case C.CONNECT:if(e.data&&e.data.sid){const r=e.data.sid;this.onconnect(r)}else this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case C.EVENT:case C.BINARY_EVENT:this.onevent(e);break;case C.ACK:case C.BINARY_ACK:this.onack(e);break;case C.DISCONNECT:this.ondisconnect();break;case C.CONNECT_ERROR:this.destroy();const i=new Error(e.data.message);i.data=e.data.data,this.emitReserved("connect_error",i);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const i of t)i.apply(this,e)}super.emit.apply(this,e)}ack(e){const t=this;let i=!1;return function(...r){i||(i=!0,t.packet({type:C.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e){this.id=e,this.connected=!0,this.emitBuffered(),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:C.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let i=0;i0&&n.jitter<=1?n.jitter:0,this.attempts=0}ue.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*n);n=Math.floor(e*10)&1?n+t:n-t}return Math.min(n,this.max)|0};ue.prototype.reset=function(){this.attempts=0};ue.prototype.setMin=function(n){this.ms=n};ue.prototype.setMax=function(n){this.max=n};ue.prototype.setJitter=function(n){this.jitter=n};class Re extends ${constructor(e,t){var i;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,Fe(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((i=t.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new ue({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||xn;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new kt(this.uri,this.opts);const t=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const r=G(t,"open",function(){i.onopen(),e&&e()}),s=G(t,"error",o=>{i.cleanup(),i._readyState="closed",this.emitReserved("error",o),e?e(o):i.maybeReconnectOnOpen()});if(this._timeout!==!1){const o=this._timeout;o===0&&r();const a=this.setTimeoutFn(()=>{r(),t.close(),t.emit("error",new Error("timeout"))},o);this.opts.autoUnref&&a.unref(),this.subs.push(function(){clearTimeout(a)})}return this.subs.push(r),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(G(e,"ping",this.onping.bind(this)),G(e,"data",this.ondata.bind(this)),G(e,"error",this.onerror.bind(this)),G(e,"close",this.onclose.bind(this)),G(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){Dt(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let i=this.nsps[e];return i||(i=new St(this,e,t),this.nsps[e]=i),i}_destroy(e){const t=Object.keys(this.nsps);for(const i of t)if(this.nsps[i].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let i=0;ie()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const i=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(r=>{r?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",r)):e.onreconnect()}))},t);this.opts.autoUnref&&i.unref(),this.subs.push(function(){clearTimeout(i)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const ye={};function Be(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const t=vn(n,e.path||"/socket.io"),i=t.source,r=t.id,s=t.path,o=ye[r]&&s in ye[r].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let c;return a?c=new Re(i,e):(ye[r]||(ye[r]=new Re(i,e)),c=ye[r]),t.query&&!e.query&&(e.query=t.queryKey),c.socket(t.path,e)}Object.assign(Be,{Manager:Re,Socket:St,io:Be,connect:Be});const Tn=he({key:"socketManger",default:Ne({key:"socketManger/Default",get:()=>new Re("http://localhost:81",{withCredentials:!0}),dangerouslyAllowMutability:!0}),dangerouslyAllowMutability:!0});Y({key:"socketStore",default:q({key:"socketStore/Default",get:n=>({get:e})=>e(Tn).socket(`/${n}`),dangerouslyAllowMutability:!0}),dangerouslyAllowMutability:!0});const Ue=Object.freeze({FOLDER:"Folder",DOENETML:"DoenetML",URL:"Url",COLLECTION:"Collection"});function Rn(n){const e=Ke(),t="dragShadow",{acceptAddItem:i,acceptDeleteItem:r,acceptMoveItems:s,acceptRenameItem:o}=_n(),a=K(({snapshot:y})=>async({driveIdFolderId:g,type:I,label:A="Untitled",selectedItemId:m=null,url:w=null})=>{const f=xt(new Date),D=ce(),b=ce(),S=ce(),L=await y.getPromise(R(g));let T=JSON.parse(JSON.stringify(L)),U=[...T.contentIds[x.DEFAULT]],V=U.indexOf(m);const N=Me({index:V,nodeObjs:T.contentsDictionary,defaultFolderChildrenIds:U});let h={driveId:g.driveId,parentFolderId:g.folderId,doenetId:b,itemId:D,versionId:S,type:I,label:A,sortOrder:N,selectedItemId:m,creationDate:f,url:w};I==="DoenetML"&&(h={...h,assignedDate:null,attemptAggregation:"m",dueDate:null,gradeCategory:"",individualize:!0,isAssigned:"0",isPublished:"0",cid:"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",numberOfAttemptsAllowed:"1",showFinishButton:!1,proctorMakesAvailable:!1,autoSubmit:!1,showCorrectness:!0,showFeedback:!0,showHints:!0,showSolution:!0,showSolutionInGradebook:!0,timeLimit:null,totalPointsOrPercent:"10",assignment_isPublished:"0"}),I===Ue.COLLECTION&&(h={...h,assignedDate:null,attemptAggregation:"m",dueDate:null,gradeCategory:"",individualize:!0,isAssigned:"0",isPublished:"0",cid:"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",numberOfAttemptsAllowed:"1",showFinishButton:!1,proctorMakesAvailable:!1,autoSubmit:!1,showCorrectness:!0,showFeedback:!0,showHints:!0,showSolution:!0,showSolutionInGradebook:!0,timeLimit:null,totalPointsOrPercent:"10",assignment_isPublished:"0"});try{const O=await P.post("/api/addItem.php",h);console.log("resp from add item",O),O.data.success?i(h):e(`Add item error: ${O.data.message}`,j.ERROR)}catch(O){console.error(O)}}),c=K(()=>async({driveIdFolderId:y,driveInstanceId:g=null,itemId:I,label:A})=>{const m={driveId:y.driveId,parentFolderId:y.folderId,itemId:I,label:A,driveInstanceId:g};try{const w=await P.get("/api/deleteItem.php",{params:m});w.data.success?r(m):e(`Delete item error: ${w.data.message}`,j.ERROR)}catch(w){console.log(w)}}),d=K(({snapshot:y,set:g})=>async({targetDriveId:I,targetFolderId:A,index:m})=>{var V,N;const w=await y.getPromise(M);let p=await y.getPromise(R({driveId:I,folderId:A}));if(w.length===0)throw"No items selected";for(let h of w){const O=await y.getPromise(R({driveId:h.driveId,folderId:h.parentFolderId}));if(h.itemId===A)throw"Cannot move folder into itself";if(p.folderInfo.itemType===Ue.COLLECTION&&O.contentsDictionary[h.itemId].itemType!==Ue.DOENETML)throw e(`Can not ${O.contentsDictionary[h.itemId].itemType}s into a Collection`,j.ERROR),`Can not ${O.contentsDictionary[h.itemId].itemType}s into a Collection`}let f=JSON.parse(JSON.stringify(p)),D={},b=[];const S=m??0;let L="";for(let h of w){let O={driveId:h.driveId,driveInstanceId:h.driveInstanceId,itemId:h.itemId};g(z(O),!1);const H=await y.getPromise(R({driveId:h.driveId,folderId:h.parentFolderId}));let F=(V=D[h.driveId])==null?void 0:V[h.parentFolderId];if(F||(F=JSON.parse(JSON.stringify(H))),h.parentFolderId!==A){let _=F.contentIds.defaultOrder.indexOf(h.itemId);F.contentIds.defaultOrder.splice(_,1),f.contentsDictionary[h.itemId]={...F.contentsDictionary[h.itemId]},f.contentsDictionaryByDoenetId||(f.contentsDictionaryByDoenetId={}),f.contentsDictionaryByDoenetId[F.contentsDictionary[h.itemId].doenetId]={...F.contentsDictionary[h.itemId]},delete F.contentsDictionaryByDoenetId[F.contentsDictionary[h.itemId].doenetId],delete F.contentsDictionary[h.itemId],D[h.driveId]||(D[h.driveId]={}),D[h.driveId][h.parentFolderId]=F,f.contentIds.defaultOrder.splice(S,0,h.itemId)}else f.contentIds.defaultOrder.splice(S,0,t),f.contentIds.defaultOrder=f.contentIds.defaultOrder.filter(_=>_!==h.itemId),f.contentIds.defaultOrder.splice(f.contentIds.defaultOrder.indexOf(t),1,h.itemId);const re=f.contentIds.defaultOrder.filter(_=>_!==t);if(L=Me({index:S,nodeObjs:f.contentsDictionary,defaultFolderChildrenIds:re}),f.contentsDictionary[h.itemId].sortOrder=L,f.contentsDictionary[h.itemId].parentFolderId=A,H.contentsDictionary[h.itemId].itemType==="Folder"){const _=await y.getPromise(R({driveId:h.driveId,folderId:h.itemId}));g(R({driveId:I,folderId:h.itemId}),()=>{let J={..._};return J.folderInfo={..._.folderInfo},J.folderInfo.parentFolderId=A,J})}if(h.driveId!==I&&(b.push(h.itemId),H.contentsDictionary[h.itemId].itemType==="Folder")){let _=[],J=[h.itemId];for(;J.length;){let be=J.length;for(let te=0;teasync({driveIdFolderId:y,itemId:g,itemType:I,newLabel:A})=>{const m={instruction:"rename",driveId:y.driveId,folderId:y.folderId,itemId:g,label:A,type:I};try{const w=await P.get("/api/updateItem.php",{params:m});w.data.success?o(m):e(`Rename item error: ${w.data.message}`,j.ERROR)}catch(w){console.log(w)}}),v=K(({snapshot:y,set:g})=>async({items:I=[],targetDriveId:A,targetFolderId:m,index:w})=>{if(I.length===0)throw"No items to be copied";let p=await y.getPromise(R({driveId:A,folderId:m})),f=JSON.parse(JSON.stringify(p));const D=w??0;let b="";const L=Nn(new Date);let T={},U={};for(let h of I){if(!h.driveId||!h.driveInstanceId||!h.itemId)throw"Invalid arguments error";let O={driveId:h.driveId,driveInstanceId:h.driveInstanceId,itemId:h.itemId};g(z(O),!1);const{newItemId:H,newItem:F}=await u({snapshot:y,globalDictionary:T,globalContentIds:U,creationTimestamp:L,item:h,targetDriveId:A,targetFolderId:m});if(h.driveId===A){const _=`Copy of ${F.label}`;F.label=_}const re=f.contentIds.defaultOrder.filter(_=>_!==t);b=Me({index:D,nodeObjs:f.contentsDictionary,defaultFolderChildrenIds:re}),F.sortOrder=b,f.contentsDictionary[H]=F,f.contentIds.defaultOrder.splice(D,0,H)}g(M,[]);let V=[];for(let h of Object.keys(T)){let O=T[h];const H={driveId:A,parentFolderId:O.parentFolderId,itemId:h,doenetId:O.doenetId,versionId:O.versionId,label:O.label,type:O.itemType,sortOrder:O.sortOrder,isNewCopy:"1"};if(O.itemType==="DoenetML"){const re=k({item:O,timestamp:L});V.push(P.post("/api/saveNewVersion.php",re))}const F=P.get("/api/addItem.php",{params:H});V.push(F)}return Promise.allSettled(V).then(([h])=>{var O,H;if((H=(O=h.value)==null?void 0:O.data)!=null&&H.success){g(R({driveId:A,folderId:m}),f);for(let F of Object.keys(T))if(T[F].itemType==="Folder"){let _=[F];for(;_.length;){const J=_.length;for(let be=0;be{console.error(h)}),await Promise.allSettled(V)}),u=async({snapshot:y,globalDictionary:g={},globalContentIds:I={},creationTimestamp:A,item:m,targetDriveId:w,targetFolderId:p})=>{const D=(await y.getPromise(R({driveId:m.driveId,folderId:m.parentFolderId}))).contentsDictionary[m.itemId],b={...D},S=ce();if(b.itemId=S,b.doenetId=ce(),b.versionId=ce(),b.previousDoenetId=D.doenetId,D.itemType==="Folder"){const{contentIds:L}=await y.getPromise(R({driveId:m.driveId,folderId:m.itemId}));I[S]=[];for(let T of L[x.DEFAULT]){let U={...m,parentFolderId:m.itemId,itemId:T};const N=(await u({snapshot:y,globalDictionary:g,globalContentIds:I,creationTimestamp:A,item:U,targetFolderId:S,targetDriveId:w})).newItemId;I[S].push(N)}}return b.parentFolderId=p,b.creationDate=A,g[S]=b,{newItemId:S,newItem:b}},k=({item:y,timestamp:g})=>({title:y.label,doenetId:y.doenetId,cid:y.cid,versionId:y.versionId,timestamp:g,isDraft:"0",isNamed:"1",isNewCopy:"1",doenetML:y.doenetML,previousDoenetId:y.previousDoenetId});return{addItem:a,deleteItem:c,moveItems:d,renameItem:l,copyItems:v}}function _n(){const n=Ke(),e=K(({snapshot:s,set:o})=>async({driveId:a,parentFolderId:c,doenetId:d,versionId:l,itemId:v,type:u,label:k,sortOrder:y,creationDate:g,url:I,selectedItemId:A})=>{const m={parentFolderId:c,doenetId:d,versionId:l,itemId:v,itemType:u,label:k,sortOrder:y,creationDate:g,isPublished:"0",url:I,urlDescription:null,urlId:null},w=await s.getPromise(R({driveId:a,folderId:c}));let p=JSON.parse(JSON.stringify(w)),f=[...p.contentIds[x.DEFAULT]],D=f.indexOf(A);f.splice(D+1,0,v),p.contentIds[x.DEFAULT]=f,p.contentsDictionary[v]=m,p.contentsDictionaryByDoenetId[d]=m,o(R({driveId:a,folderId:c}),p),(u==="Folder"||u==="Collection")&&o(R({driveId:a,folderId:v}),{folderInfo:m,contentsDictionary:{},contentIds:{[x.DEFAULT]:[]}}),n("Add new item 'Untitled'",j.SUCCESS)},[n]),t=K(({snapshot:s,set:o})=>async({driveId:a,parentFolderId:c,itemId:d,driveInstanceId:l,label:v})=>{const u=await s.getPromise(R({driveId:a,folderId:c})),k=await s.getPromise(M),y={driveId:a,driveInstanceId:l,itemId:d};if(await s.getPromise(z(y))){o(z(y),!1);let m=[];for(let w of k)w.itemId!==d&&m.push(w);o(M,m)}let I={...u};I.contentsDictionary={...u.contentsDictionary},I.contentsDictionaryByDoenetId={...u.contentsDictionaryByDoenetId},delete I.contentsDictionaryByDoenetId[I.contentsDictionary[d].doenetId],delete I.contentsDictionary[d],I.folderInfo={...u.folderInfo},I.contentIds={},I.contentIds[x.DEFAULT]=[...u.contentIds[x.DEFAULT]];const A=I.contentIds[x.DEFAULT].indexOf(d);I.contentIds[x.DEFAULT].splice(A,1),o(R({driveId:a,folderId:c}),I),n(`Deleted item '${v}'`,j.SUCCESS)}),i=K(({set:s})=>(o,a,c)=>{s(M,[]),s(R({driveId:o.destinationDriveId,folderId:o.destinationItemId}),a);for(let d of Object.keys(c))for(let l of Object.keys(c[d]))s(R({driveId:d,folderId:l}),c[d][l]),s(ze({driveId:d,folderId:l}),!0);s(ze({driveId:o.destinationDriveId,folderId:o.destinationItemId}),!0)},[]),r=K(({snapshot:s,set:o})=>async({driveId:a,folderId:c,itemId:d,label:l,type:v})=>{const u=await s.getPromise(R({driveId:a,folderId:c}));let k={...u};k.contentsDictionary={...u.contentsDictionary},k.contentsDictionaryByDoenetId={...u.contentsDictionaryByDoenetId},k.contentsDictionary[d]={...u.contentsDictionary[d]},k.contentsDictionary[d].label=l,k.contentsDictionaryByDoenetId[k.contentsDictionary[d].doenetId]={...u.contentsDictionary[d]},k.contentsDictionaryByDoenetId[k.contentsDictionary[d].doenetId].label=l,o(R({driveId:a,folderId:c}),k),(v==="Folder"||v==="Collection")&&o(R({driveId:a,folderId:d}),y=>{let g={...y};return g.folderInfo={...y.folderInfo},g.folderInfo.label=l,g}),n(`Renamed item to '${l}'`,j.SUCCESS)});return{acceptAddItem:e,acceptDeleteItem:t,acceptMoveItems:i,acceptRenameItem:r}}const Nn=n=>`${n.getFullYear().toString().padStart(2,"0")}-${(n.getMonth()+1).toString().padStart(2,"0")}-${n.getDate().toString().padStart(2,"0")} ${n.getHours().toString().padStart(2,"0")}:${n.getMinutes().toString().padStart(2,"0")}:${n.getSeconds().toString().padStart(2,"0")}`;B.createContext({});const st=Y({key:"loadAssignmentAtomFamily",default:q({key:"loadAssignmentAtomFamily/Default",get:n=>async()=>{const{data:e}=await P.get("/api/getAllAssignmentSettings.php",{params:{doenetId:n}});let t={...e.assignment};return t.assignedDate&&(t.assignedDate=ke(t.assignedDate).toLocaleString()),t.dueDate&&(t.dueDate=ke(t.dueDate).toLocaleString()),t.pinnedAfterDate&&(t.pinnedAfterDate=ke(t.pinnedAfterDate).toLocaleString()),t.pinnedUntilDate&&(t.pinnedUntilDate=ke(t.pinnedUntilDate).toLocaleString()),t}})}),Ot=q({key:"loadAssignmentSelector",get:n=>async({get:e})=>await e(st(n)),set:n=>({set:e},t)=>{e(st(n),t)}}),ot=Object.freeze({DOENETML:"DoenetML",FOLDER:"Folder",COLLECTION:"Collection"}),de=Y({key:"fetchDriveUsersQuery",default:q({key:"fetchDriveUsersQuery/Default",get:n=>async()=>{const e={params:{driveId:n}},{data:t}=await P.get("/api/loadDriveUsers.php",e);return t}})});q({key:"fetchDriveUsers",get:n=>({get:e})=>e(de(n)),set:n=>({get:e,set:t},i)=>{let r={params:{email:i.email,type:i.type,driveId:n,userId:i.userId}};switch(i.type){case"Add Owner":P.get("/api/saveUserToDrive.php",r).then(s=>{i.callback(s.data)});break;case"Add Owner step 2":t(de(n),s=>{let o={...s},a=[...s.owners];return a.push({email:i.email,isUser:!1,screenName:i.screenName,userId:i.userId}),o.owners=a,o});break;case"Add Admin":P.get("/api/saveUserToDrive.php",r).then(s=>{i.callback(s.data)});break;case"Add Admin step 2":t(de(n),s=>{let o={...s},a=[...s.admins];return a.push({email:i.email,isUser:!1,screenName:i.screenName,userId:i.userId}),o.admins=a,o});break;case"Remove User":t(de(n),s=>{let o={...s};if(i.userRole==="owner"){let a=[...s.owners];for(let c=0;c{let o={...s},a=[],c=[...s.admins];for(let l=0;l{let o={...s},a=[],c=[...s.owners];for(let l=0;l{s===n&&t(!1)};return B.useEffect(()=>(window.addEventListener("keydown",i),window.addEventListener("keyup",r),()=>{window.removeEventListener("keydown",i),window.removeEventListener("keyup",r)}),[]),e}const $t=_e.createContext(),qt=({children:n,id:e,registerDropTarget:t,unregisterDropTarget:i,dropCallbacks:r})=>{const s=B.useRef(),{onDragOver:o,onDragHover:a,onDrop:c,onDragEnter:d,onDragExit:l}=r;return B.useEffect(()=>(t({id:e,ref:s.current,onDragOver:o,onDragHover:a,onDragEnter:d,onDragExit:l,onDrop:c}),()=>{i(e)}),[e,t,i]),E("div",{ref:s,children:n})},Xe={x:0,y:0},Vt=({children:n,id:e,className:t="",onDragStart:i,onDrag:r,onDragEnd:s,ghostElement:o=null})=>{const[a,c]=B.useState({isDragging:!1,origin:Xe,translation:Xe,actionType:null}),d=B.useRef(null),l=B.useRef(null),[v,u]=B.useState(!1),k=B.useCallback(m=>{m.button===0&&(u(!0),l.current={...m},d.current=setTimeout(()=>{var b,S;let w=l.current,p=w.clientX,f=w.clientY,D="mouse";w.type==="touchstart"&&(p=(b=w.touches[0])==null?void 0:b.clientX,f=(S=w.touches[0])==null?void 0:S.clientY,D="touch"),c(L=>({...L,isDragging:!0,origin:{x:p,y:f},actionType:D})),i==null||i({ev:l.current}),d.current=null},300))},[i,e]),y=B.useCallback(()=>{d.current?clearTimeout(d.current):(c(m=>({...m,isDragging:!1,actionType:null})),s==null||s()),u(!1)},[s]),g=B.useCallback(m=>{var D,b;if(!a.isDragging)return;let w=m.clientX,p=m.clientY;m.type==="touchmove"&&(w=(D=m.touches[0])==null?void 0:D.clientX,p=(b=m.touches[0])==null?void 0:b.clientY);const f={x:w-a.origin.x,y:p-a.origin.y};c(S=>({...S,translation:f})),r==null||r({clientX:w,clientY:p,translation:f,id:e,ev:m})},[a.origin,r,e]);B.useEffect(()=>(v?(window.addEventListener("mouseup",y),window.addEventListener("touchend",y)):(window.removeEventListener("mouseup",y),window.removeEventListener("touchend",y)),()=>{window.removeEventListener("mouseup",y),window.removeEventListener("touchend",y)}),[v,y]),B.useEffect(()=>(a.isDragging?(window.addEventListener("mousemove",g),window.addEventListener("touchmove",g)):(window.removeEventListener("mousemove",g),window.removeEventListener("touchmove",g),c(m=>({...m,translation:{x:0,y:0}}))),()=>{window.removeEventListener("mousemove",g),window.removeEventListener("touchmove",g)}),[a.isDragging,g]);const I={cursor:a.isDragging?"-webkit-grabbing":"-webkit-grab",transition:a.isDragging?"none":"transform 500ms"},A={cursor:a.isDragging?"-webkit-grabbing":"-webkit-grab",transform:a.isDragging?`translate(${a.translation.x}px, ${a.translation.y}px)`:"",transition:a.isDragging?"visibility 0s, opacity 0.2s linear":"visibility 0s, opacity 0.2s linear, transform 500ms",zIndex:a.isDragging?2:1,opacity:a.isDragging?1:0,visibility:a.isDragging?"visible":"hidden",height:a.isDragging?"auto":"0",position:a.isDragging?"absolute":"relative",left:a.origin.x,top:a.origin.y};return oe("div",{className:t,style:I,onMouseDown:k,onTouchStart:k,children:[n,E("div",{style:A,children:o})]},`draggable${e}`)},X="dragShadow",dt=()=>{const n=K(({snapshot:r})=>async()=>{const{dragShadowDriveId:s,dragShadowParentId:o}=await r.getPromise(ee),a=await r.getPromise(M);if(!s||!o)return;let c=null;s&&o&&(c=await r.getPromise(R({driveId:s,folderId:o})));let d=c==null?void 0:c.contentIds[x.DEFAULT],l=d==null?void 0:d.indexOf(X);return l<0?{}:{targetDriveId:s,targetFolderId:o,index:l,numItems:a.length}}),e=K(({snapshot:r,set:s})=>async({driveIdFolderId:o,position:a,parentId:c,itemId:d})=>{const{dragShadowDriveId:l,dragShadowParentId:v,draggedItemsId:u,copyMode:k}=await r.getPromise(ee);if(!k&&u&&(u!=null&&u.has(d))){t();return}const y={assignmentId:null,doenetId:null,cid:null,creationDate:"",isPublished:"0",itemId:X,itemType:"DragShadow",label:"",parentFolderId:c,url:null,urlDescription:null,urlId:null},g=a,I=c;let A=null;if(l&&v&&(A=await r.getPromise(R({driveId:l,folderId:v}))),A&&s(R({driveId:l,folderId:v}),m=>{let w={...m},p=[...w.contentIds[x.DEFAULT]];p=p.filter(D=>D!==X);const f={[x.DEFAULT]:p};return w.contentIds=f,w}),g==="intoCurrent"){if(u&&(u!=null&&u.has(o.folderId)))return;s(R(o),m=>{let w={...m},p={...m.contentsDictionary},f=[...w.contentIds[x.DEFAULT]];p[X]=y,v===I&&(f=f.filter(b=>b!==X)),f.splice(0,0,X);const D={[x.DEFAULT]:f};return w.contentIds=D,w.contentsDictionary=p,w}),s(ee,m=>({...m,dragShadowDriveId:o.driveId,dragShadowParentId:o.folderId}))}else{const m=({draggedItemsId:p,contentIdsArr:f,index:D})=>{if((p==null?void 0:p.size)>1)return!0;let b=!0,S=null,L=null;return f.length!==0&&(D<=0?S=f[0]:D>=f.length?L=f[f.length-1]:(L=f[D-1],S=f[D]),L&&(p!=null&&p.has(L))&&(b=!1),S&&(p!=null&&p.has(S))&&(b=!1)),b};let w=!0;s(R({driveId:o.driveId,folderId:I}),p=>{let f={...p},D={...p.contentsDictionary},b=[...f.contentIds[x.DEFAULT]];D[X]=y,v===I&&(b=b.filter(T=>T!==X));let S=b.indexOf(d);g==="afterCurrent"&&(S+=1),w=k||m({draggedItemsId:u,contentIdsArr:b,index:S}),w&&b.splice(S,0,X);const L={[x.DEFAULT]:b};return f.contentIds=L,f.contentsDictionary=D,f}),w&&s(ee,p=>({...p,dragShadowDriveId:o.driveId,dragShadowParentId:I}))}}),t=K(({snapshot:r,set:s})=>async()=>{const{dragShadowDriveId:o,dragShadowParentId:a}=await r.getPromise(ee);!o||!a||(s(R({driveId:o,folderId:a}),c=>{let d={...c},l=[...d.contentIds[x.DEFAULT]];l=l.filter(u=>u!==X);const v={[x.DEFAULT]:l};return d.contentIds=v,d}),s(ee,c=>({...c,dragShadowDriveId:null,dragShadowParentId:null})))}),i=K(({snapshot:r,set:s})=>async()=>{const{dragShadowDriveId:o,dragShadowParentId:a,openedFoldersInfo:c}=await r.getPromise(ee);let d=[...c],l=[];if(o&&a){let v=await r.getPromise($n({driveId:o,folderId:a})),u=new Set(v.map(k=>k.folderId));for(let k of d)!(k.driveId===o&&u.has(k.itemId))&&l.push(k)}else l=d;for(let v of l)s(ve(v),!1)});return{insertDragShadow:e,removeDragShadow:t,replaceDragShadow:n,cleanUpDragShadow:i}},Z=Object.create(null);Z.open="0";Z.close="1";Z.ping="2";Z.pong="3";Z.message="4";Z.upgrade="5";Z.noop="6";const Le=Object.create(null);Object.keys(Z).forEach(n=>{Le[Z[n]]=n});const Ht={type:"error",data:"parser error"},zt=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Kt=typeof ArrayBuffer=="function",Yt=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,lt=({type:n,data:e},t,i)=>zt&&e instanceof Blob?t?i(e):je(e,i):Kt&&(e instanceof ArrayBuffer||Yt(e))?t?i(e):je(new Blob([e]),i):i(Z[n]+(e||"")),je=(n,e)=>{const t=new FileReader;return t.onload=function(){const i=t.result.split(",")[1];e("b"+i)},t.readAsDataURL(n)},Qe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ge=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n{let e=n.length*.75,t=n.length,i,r=0,s,o,a,c;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const d=new ArrayBuffer(e),l=new Uint8Array(d);for(i=0;i>4,l[r++]=(o&15)<<4|a>>2,l[r++]=(a&3)<<6|c&63;return d},Jt=typeof ArrayBuffer=="function",ht=(n,e)=>{if(typeof n!="string")return{type:"message",data:ft(n,e)};const t=n.charAt(0);return t==="b"?{type:"message",data:Wt(n.substring(1),e)}:Le[t]?n.length>1?{type:Le[t],data:n.substring(1)}:{type:Le[t]}:Ht},Wt=(n,e)=>{if(Jt){const t=Gt(n);return ft(t,e)}else return{base64:!0,data:n}},ft=(n,e)=>{switch(e){case"blob":return n instanceof ArrayBuffer?new Blob([n]):n;case"arraybuffer":default:return n}},ut=String.fromCharCode(30),Xt=(n,e)=>{const t=n.length,i=new Array(t);let r=0;n.forEach((s,o)=>{lt(s,!1,a=>{i[o]=a,++r===t&&e(i.join(ut))})})},jt=(n,e)=>{const t=n.split(ut),i=[];for(let r=0;rtypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function mt(n,...e){return e.reduce((t,i)=>(n.hasOwnProperty(i)&&(t[i]=n[i]),t),{})}const Zt=setTimeout,en=clearTimeout;function Fe(n,e){e.useNativeTimers?(n.setTimeoutFn=Zt.bind(ie),n.clearTimeoutFn=en.bind(ie)):(n.setTimeoutFn=setTimeout.bind(ie),n.clearTimeoutFn=clearTimeout.bind(ie))}const tn=1.33;function nn(n){return typeof n=="string"?rn(n):Math.ceil((n.byteLength||n.size)*tn)}function rn(n){let e=0,t=0;for(let i=0,r=n.length;i=57344?t+=3:(i++,t+=4);return t}class sn extends Error{constructor(e,t,i){super(e),this.description=t,this.context=i,this.type="TransportError"}}class yt extends ${constructor(e){super(),this.writable=!1,Fe(this,e),this.opts=e,this.query=e.query,this.readyState="",this.socket=e.socket}onError(e,t,i){return super.emitReserved("error",new sn(e,t,i)),this}open(){return(this.readyState==="closed"||this.readyState==="")&&(this.readyState="opening",this.doOpen()),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=ht(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}}const gt="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),$e=64,on={};let Ze=0,Oe=0,et;function tt(n){let e="";do e=gt[n%$e]+e,n=Math.floor(n/$e);while(n>0);return e}function It(){const n=tt(+new Date);return n!==et?(Ze=0,et=n):n+"."+tt(Ze++)}for(;Oe<$e;Oe++)on[gt[Oe]]=Oe;function vt(n){let e="";for(let t in n)n.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e}function an(n){let e={},t=n.split("&");for(let i=0,r=t.length;i{this.readyState="paused",e()};if(this.polling||!this.writable){let i=0;this.polling&&(i++,this.once("pollComplete",function(){--i||t()})),this.writable||(i++,this.once("drain",function(){--i||t()}))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};jt(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,Xt(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.query||{};const t=this.opts.secure?"https":"http";let i="";this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=It()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.opts.port&&(t==="https"&&Number(this.opts.port)!==443||t==="http"&&Number(this.opts.port)!==80)&&(i=":"+this.opts.port);const r=vt(e),s=this.opts.hostname.indexOf(":")!==-1;return t+"://"+(s?"["+this.opts.hostname+"]":this.opts.hostname)+i+this.opts.path+(r.length?"?"+r:"")}request(e={}){return Object.assign(e,{xd:this.xd,xs:this.xs},this.opts),new Q(this.uri(),e)}doWrite(e,t){const i=this.request({method:"POST",data:e});i.on("success",t),i.on("error",(r,s)=>{this.onError("xhr post error",r,s)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,i)=>{this.onError("xhr poll error",t,i)}),this.pollXhr=e}}class Q extends ${constructor(e,t){super(),Fe(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.async=t.async!==!1,this.data=t.data!==void 0?t.data:null,this.create()}create(){const e=mt(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;const t=this.xhr=new bt(e);try{t.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0);for(let i in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(i)&&t.setRequestHeader(i,this.opts.extraHeaders[i])}}catch{}if(this.method==="POST")try{t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{t.setRequestHeader("Accept","*/*")}catch{}"withCredentials"in t&&(t.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(t.timeout=this.opts.requestTimeout),t.onreadystatechange=()=>{t.readyState===4&&(t.status===200||t.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof t.status=="number"?t.status:0)},0))},t.send(this.data)}catch(i){this.setTimeoutFn(()=>{this.onError(i)},0);return}typeof document<"u"&&(this.index=Q.requestsCount++,Q.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=dn,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Q.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}Q.requestsCount=0;Q.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",nt);else if(typeof addEventListener=="function"){const n="onpagehide"in ie?"pagehide":"unload";addEventListener(n,nt,!1)}}function nt(){for(let n in Q.requests)Q.requests.hasOwnProperty(n)&&Q.requests[n].abort()}const Dt=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0))(),Ee=ie.WebSocket||ie.MozWebSocket,it=!0,fn="arraybuffer",rt=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class un extends yt{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,i=rt?{}:mt(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=it&&!rt?t?new Ee(e,t):new Ee(e):new Ee(e,t,i)}catch(r){return this.emitReserved("error",r)}this.ws.binaryType=this.socket.binaryType||fn,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t{const o={};try{it&&this.ws.send(s)}catch{}r&&Dt(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){let e=this.query||{};const t=this.opts.secure?"wss":"ws";let i="";this.opts.port&&(t==="wss"&&Number(this.opts.port)!==443||t==="ws"&&Number(this.opts.port)!==80)&&(i=":"+this.opts.port),this.opts.timestampRequests&&(e[this.opts.timestampParam]=It()),this.supportsBinary||(e.b64=1);const r=vt(e),s=this.opts.hostname.indexOf(":")!==-1;return t+"://"+(s?"["+this.opts.hostname+"]":this.opts.hostname)+i+this.opts.path+(r.length?"?"+r:"")}check(){return!!Ee}}const pn={websocket:un,polling:hn},mn=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,yn=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function qe(n){const e=n,t=n.indexOf("["),i=n.indexOf("]");t!=-1&&i!=-1&&(n=n.substring(0,t)+n.substring(t,i).replace(/:/g,";")+n.substring(i,n.length));let r=mn.exec(n||""),s={},o=14;for(;o--;)s[yn[o]]=r[o]||"";return t!=-1&&i!=-1&&(s.source=e,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=gn(s,s.path),s.queryKey=In(s,s.query),s}function gn(n,e){const t=/\/{2,9}/g,i=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&i.splice(0,1),e.slice(-1)=="/"&&i.splice(i.length-1,1),i}function In(n,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,r,s){r&&(t[r]=s)}),t}let kt=class le extends ${constructor(e,t={}){super(),e&&typeof e=="object"&&(t=e,e=null),e?(e=qe(e),t.hostname=e.host,t.secure=e.protocol==="https"||e.protocol==="wss",t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=qe(t.host).host),Fe(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},t),this.opts.path=this.opts.path.replace(/\/$/,"")+"/",typeof this.opts.query=="string"&&(this.opts.query=an(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=pt,t.transport=e,this.id&&(t.sid=this.id);const i=Object.assign({},this.opts.transportOptions[e],this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new pn[e](i)}open(){let e;if(this.opts.rememberUpgrade&&le.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch{this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",t=>this.onClose("transport close",t))}probe(e){let t=this.createTransport(e),i=!1;le.priorWebsocketSuccess=!1;const r=()=>{i||(t.send([{type:"ping",data:"probe"}]),t.once("packet",v=>{if(!i)if(v.type==="pong"&&v.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;le.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(l(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const u=new Error("probe error");u.transport=t.name,this.emitReserved("upgradeError",u)}}))};function s(){i||(i=!0,l(),t.close(),t=null)}const o=v=>{const u=new Error("probe error: "+v);u.transport=t.name,s(),this.emitReserved("upgradeError",u)};function a(){o("transport closed")}function c(){o("socket closed")}function d(v){t&&v.name!==t.name&&s()}const l=()=>{t.removeListener("open",r),t.removeListener("error",o),t.removeListener("close",a),this.off("close",c),this.off("upgrading",d)};t.once("open",r),t.once("error",o),t.once("close",a),this.once("close",c),this.once("upgrading",d),t.open()}onOpen(){if(this.readyState="open",le.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade&&this.transport.pause){let e=0;const t=this.upgrades.length;for(;e{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let i=0;i0&&t>this.maxPayload)return this.writeBuffer.slice(0,i);t+=2}return this.writeBuffer}write(e,t,i){return this.sendPacket("message",e,t,i),this}send(e,t,i){return this.sendPacket("message",e,t,i),this}sendPacket(e,t,i,r){if(typeof t=="function"&&(r=t,t=void 0),typeof i=="function"&&(r=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const s={type:e,data:t,options:i};this.emitReserved("packetCreate",s),this.writeBuffer.push(s),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},i=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():e()}):this.upgrading?i():e()),this}onError(e){le.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let i=0;const r=e.length;for(;itypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,At=Object.prototype.toString,Dn=typeof Blob=="function"||typeof Blob<"u"&&At.call(Blob)==="[object BlobConstructor]",kn=typeof File=="function"||typeof File<"u"&&At.call(File)==="[object FileConstructor]";function Ye(n){return wn&&(n instanceof ArrayBuffer||bn(n))||Dn&&n instanceof Blob||kn&&n instanceof File}function Te(n,e){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let t=0,i=n.length;t=0&&n.num0;case C.ACK:case C.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&this.reconstructor.finishedReconstruction()}}class Cn{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=Sn(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const xn=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Ge,Encoder:En,get PacketType(){return C},protocol:On},Symbol.toStringTag,{value:"Module"}));function G(n,e,t){return n.on(e,t),function(){n.off(e,t)}}const Ln=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class St extends ${constructor(e,t,i){super(),this.connected=!1,this.receiveBuffer=[],this.sendBuffer=[],this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,i&&i.auth&&(this.auth=i.auth),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[G(e,"open",this.onopen.bind(this)),G(e,"packet",this.onpacket.bind(this)),G(e,"error",this.onerror.bind(this)),G(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(Ln.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');t.unshift(e);const i={type:C.EVENT,data:t};if(i.options={},i.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const o=this.ids++,a=t.pop();this._registerAckCallback(o,a),i.id=o}const r=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!r||!this.connected)||(this.connected?(this.notifyOutgoingListeners(i),this.packet(i)):this.sendBuffer.push(i)),this.flags={},this}_registerAckCallback(e,t){const i=this.flags.timeout;if(i===void 0){this.acks[e]=t;return}const r=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let s=0;s{this.io.clearTimeoutFn(r),t.apply(this,[null,...s])}}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this.packet({type:C.CONNECT,data:e})}):this.packet({type:C.CONNECT,data:this.auth})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case C.CONNECT:if(e.data&&e.data.sid){const r=e.data.sid;this.onconnect(r)}else this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case C.EVENT:case C.BINARY_EVENT:this.onevent(e);break;case C.ACK:case C.BINARY_ACK:this.onack(e);break;case C.DISCONNECT:this.ondisconnect();break;case C.CONNECT_ERROR:this.destroy();const i=new Error(e.data.message);i.data=e.data.data,this.emitReserved("connect_error",i);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const i of t)i.apply(this,e)}super.emit.apply(this,e)}ack(e){const t=this;let i=!1;return function(...r){i||(i=!0,t.packet({type:C.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e){this.id=e,this.connected=!0,this.emitBuffered(),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:C.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let i=0;i0&&n.jitter<=1?n.jitter:0,this.attempts=0}ue.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*n);n=Math.floor(e*10)&1?n+t:n-t}return Math.min(n,this.max)|0};ue.prototype.reset=function(){this.attempts=0};ue.prototype.setMin=function(n){this.ms=n};ue.prototype.setMax=function(n){this.max=n};ue.prototype.setJitter=function(n){this.jitter=n};class Re extends ${constructor(e,t){var i;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,Fe(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((i=t.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new ue({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||xn;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new kt(this.uri,this.opts);const t=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const r=G(t,"open",function(){i.onopen(),e&&e()}),s=G(t,"error",o=>{i.cleanup(),i._readyState="closed",this.emitReserved("error",o),e?e(o):i.maybeReconnectOnOpen()});if(this._timeout!==!1){const o=this._timeout;o===0&&r();const a=this.setTimeoutFn(()=>{r(),t.close(),t.emit("error",new Error("timeout"))},o);this.opts.autoUnref&&a.unref(),this.subs.push(function(){clearTimeout(a)})}return this.subs.push(r),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(G(e,"ping",this.onping.bind(this)),G(e,"data",this.ondata.bind(this)),G(e,"error",this.onerror.bind(this)),G(e,"close",this.onclose.bind(this)),G(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){Dt(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let i=this.nsps[e];return i||(i=new St(this,e,t),this.nsps[e]=i),i}_destroy(e){const t=Object.keys(this.nsps);for(const i of t)if(this.nsps[i].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let i=0;ie()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const i=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(r=>{r?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",r)):e.onreconnect()}))},t);this.opts.autoUnref&&i.unref(),this.subs.push(function(){clearTimeout(i)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const ye={};function Be(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const t=vn(n,e.path||"/socket.io"),i=t.source,r=t.id,s=t.path,o=ye[r]&&s in ye[r].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let c;return a?c=new Re(i,e):(ye[r]||(ye[r]=new Re(i,e)),c=ye[r]),t.query&&!e.query&&(e.query=t.queryKey),c.socket(t.path,e)}Object.assign(Be,{Manager:Re,Socket:St,io:Be,connect:Be});const Tn=he({key:"socketManger",default:Ne({key:"socketManger/Default",get:()=>new Re("http://localhost:81",{withCredentials:!0}),dangerouslyAllowMutability:!0}),dangerouslyAllowMutability:!0});Y({key:"socketStore",default:q({key:"socketStore/Default",get:n=>({get:e})=>e(Tn).socket(`/${n}`),dangerouslyAllowMutability:!0}),dangerouslyAllowMutability:!0});const Ue=Object.freeze({FOLDER:"Folder",DOENETML:"DoenetML",URL:"Url",COLLECTION:"Collection"});function Rn(n){const e=Ke(),t="dragShadow",{acceptAddItem:i,acceptDeleteItem:r,acceptMoveItems:s,acceptRenameItem:o}=_n(),a=K(({snapshot:y})=>async({driveIdFolderId:g,type:I,label:A="Untitled",selectedItemId:m=null,url:w=null})=>{const f=xt(new Date),D=ce(),b=ce(),S=ce(),L=await y.getPromise(R(g));let T=JSON.parse(JSON.stringify(L)),U=[...T.contentIds[x.DEFAULT]],V=U.indexOf(m);const N=Me({index:V,nodeObjs:T.contentsDictionary,defaultFolderChildrenIds:U});let h={driveId:g.driveId,parentFolderId:g.folderId,doenetId:b,itemId:D,versionId:S,type:I,label:A,sortOrder:N,selectedItemId:m,creationDate:f,url:w};I==="DoenetML"&&(h={...h,assignedDate:null,attemptAggregation:"m",dueDate:null,gradeCategory:"",individualize:!0,isAssigned:"0",isPublished:"0",cid:"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",numberOfAttemptsAllowed:"1",showFinishButton:!1,proctorMakesAvailable:!1,autoSubmit:!1,showCorrectness:!0,showFeedback:!0,showHints:!0,showSolution:!0,showSolutionInGradebook:!0,timeLimit:null,totalPointsOrPercent:"10",assignment_isPublished:"0"}),I===Ue.COLLECTION&&(h={...h,assignedDate:null,attemptAggregation:"m",dueDate:null,gradeCategory:"",individualize:!0,isAssigned:"0",isPublished:"0",cid:"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",numberOfAttemptsAllowed:"1",showFinishButton:!1,proctorMakesAvailable:!1,autoSubmit:!1,showCorrectness:!0,showFeedback:!0,showHints:!0,showSolution:!0,showSolutionInGradebook:!0,timeLimit:null,totalPointsOrPercent:"10",assignment_isPublished:"0"});try{const O=await P.post("/api/addItem.php",h);console.log("resp from add item",O),O.data.success?i(h):e(`Add item error: ${O.data.message}`,j.ERROR)}catch(O){console.error(O)}}),c=K(()=>async({driveIdFolderId:y,driveInstanceId:g=null,itemId:I,label:A})=>{const m={driveId:y.driveId,parentFolderId:y.folderId,itemId:I,label:A,driveInstanceId:g};try{const w=await P.get("/api/deleteItem.php",{params:m});w.data.success?r(m):e(`Delete item error: ${w.data.message}`,j.ERROR)}catch(w){console.log(w)}}),d=K(({snapshot:y,set:g})=>async({targetDriveId:I,targetFolderId:A,index:m})=>{var V,N;const w=await y.getPromise(M);let p=await y.getPromise(R({driveId:I,folderId:A}));if(w.length===0)throw"No items selected";for(let h of w){const O=await y.getPromise(R({driveId:h.driveId,folderId:h.parentFolderId}));if(h.itemId===A)throw"Cannot move folder into itself";if(p.folderInfo.itemType===Ue.COLLECTION&&O.contentsDictionary[h.itemId].itemType!==Ue.DOENETML)throw e(`Can not ${O.contentsDictionary[h.itemId].itemType}s into a Collection`,j.ERROR),`Can not ${O.contentsDictionary[h.itemId].itemType}s into a Collection`}let f=JSON.parse(JSON.stringify(p)),D={},b=[];const S=m??0;let L="";for(let h of w){let O={driveId:h.driveId,driveInstanceId:h.driveInstanceId,itemId:h.itemId};g(z(O),!1);const H=await y.getPromise(R({driveId:h.driveId,folderId:h.parentFolderId}));let F=(V=D[h.driveId])==null?void 0:V[h.parentFolderId];if(F||(F=JSON.parse(JSON.stringify(H))),h.parentFolderId!==A){let _=F.contentIds.defaultOrder.indexOf(h.itemId);F.contentIds.defaultOrder.splice(_,1),f.contentsDictionary[h.itemId]={...F.contentsDictionary[h.itemId]},f.contentsDictionaryByDoenetId||(f.contentsDictionaryByDoenetId={}),f.contentsDictionaryByDoenetId[F.contentsDictionary[h.itemId].doenetId]={...F.contentsDictionary[h.itemId]},delete F.contentsDictionaryByDoenetId[F.contentsDictionary[h.itemId].doenetId],delete F.contentsDictionary[h.itemId],D[h.driveId]||(D[h.driveId]={}),D[h.driveId][h.parentFolderId]=F,f.contentIds.defaultOrder.splice(S,0,h.itemId)}else f.contentIds.defaultOrder.splice(S,0,t),f.contentIds.defaultOrder=f.contentIds.defaultOrder.filter(_=>_!==h.itemId),f.contentIds.defaultOrder.splice(f.contentIds.defaultOrder.indexOf(t),1,h.itemId);const re=f.contentIds.defaultOrder.filter(_=>_!==t);if(L=Me({index:S,nodeObjs:f.contentsDictionary,defaultFolderChildrenIds:re}),f.contentsDictionary[h.itemId].sortOrder=L,f.contentsDictionary[h.itemId].parentFolderId=A,H.contentsDictionary[h.itemId].itemType==="Folder"){const _=await y.getPromise(R({driveId:h.driveId,folderId:h.itemId}));g(R({driveId:I,folderId:h.itemId}),()=>{let J={..._};return J.folderInfo={..._.folderInfo},J.folderInfo.parentFolderId=A,J})}if(h.driveId!==I&&(b.push(h.itemId),H.contentsDictionary[h.itemId].itemType==="Folder")){let _=[],J=[h.itemId];for(;J.length;){let be=J.length;for(let te=0;teasync({driveIdFolderId:y,itemId:g,itemType:I,newLabel:A})=>{const m={instruction:"rename",driveId:y.driveId,folderId:y.folderId,itemId:g,label:A,type:I};try{const w=await P.get("/api/updateItem.php",{params:m});w.data.success?o(m):e(`Rename item error: ${w.data.message}`,j.ERROR)}catch(w){console.log(w)}}),v=K(({snapshot:y,set:g})=>async({items:I=[],targetDriveId:A,targetFolderId:m,index:w})=>{if(I.length===0)throw"No items to be copied";let p=await y.getPromise(R({driveId:A,folderId:m})),f=JSON.parse(JSON.stringify(p));const D=w??0;let b="";const L=Nn(new Date);let T={},U={};for(let h of I){if(!h.driveId||!h.driveInstanceId||!h.itemId)throw"Invalid arguments error";let O={driveId:h.driveId,driveInstanceId:h.driveInstanceId,itemId:h.itemId};g(z(O),!1);const{newItemId:H,newItem:F}=await u({snapshot:y,globalDictionary:T,globalContentIds:U,creationTimestamp:L,item:h,targetDriveId:A,targetFolderId:m});if(h.driveId===A){const _=`Copy of ${F.label}`;F.label=_}const re=f.contentIds.defaultOrder.filter(_=>_!==t);b=Me({index:D,nodeObjs:f.contentsDictionary,defaultFolderChildrenIds:re}),F.sortOrder=b,f.contentsDictionary[H]=F,f.contentIds.defaultOrder.splice(D,0,H)}g(M,[]);let V=[];for(let h of Object.keys(T)){let O=T[h];const H={driveId:A,parentFolderId:O.parentFolderId,itemId:h,doenetId:O.doenetId,versionId:O.versionId,label:O.label,type:O.itemType,sortOrder:O.sortOrder,isNewCopy:"1"};if(O.itemType==="DoenetML"){const re=k({item:O,timestamp:L});V.push(P.post("/api/saveNewVersion.php",re))}const F=P.get("/api/addItem.php",{params:H});V.push(F)}return Promise.allSettled(V).then(([h])=>{var O,H;if((H=(O=h.value)==null?void 0:O.data)!=null&&H.success){g(R({driveId:A,folderId:m}),f);for(let F of Object.keys(T))if(T[F].itemType==="Folder"){let _=[F];for(;_.length;){const J=_.length;for(let be=0;be{console.error(h)}),await Promise.allSettled(V)}),u=async({snapshot:y,globalDictionary:g={},globalContentIds:I={},creationTimestamp:A,item:m,targetDriveId:w,targetFolderId:p})=>{const D=(await y.getPromise(R({driveId:m.driveId,folderId:m.parentFolderId}))).contentsDictionary[m.itemId],b={...D},S=ce();if(b.itemId=S,b.doenetId=ce(),b.versionId=ce(),b.previousDoenetId=D.doenetId,D.itemType==="Folder"){const{contentIds:L}=await y.getPromise(R({driveId:m.driveId,folderId:m.itemId}));I[S]=[];for(let T of L[x.DEFAULT]){let U={...m,parentFolderId:m.itemId,itemId:T};const N=(await u({snapshot:y,globalDictionary:g,globalContentIds:I,creationTimestamp:A,item:U,targetFolderId:S,targetDriveId:w})).newItemId;I[S].push(N)}}return b.parentFolderId=p,b.creationDate=A,g[S]=b,{newItemId:S,newItem:b}},k=({item:y,timestamp:g})=>({title:y.label,doenetId:y.doenetId,cid:y.cid,versionId:y.versionId,timestamp:g,isDraft:"0",isNamed:"1",isNewCopy:"1",doenetML:y.doenetML,previousDoenetId:y.previousDoenetId});return{addItem:a,deleteItem:c,moveItems:d,renameItem:l,copyItems:v}}function _n(){const n=Ke(),e=K(({snapshot:s,set:o})=>async({driveId:a,parentFolderId:c,doenetId:d,versionId:l,itemId:v,type:u,label:k,sortOrder:y,creationDate:g,url:I,selectedItemId:A})=>{const m={parentFolderId:c,doenetId:d,versionId:l,itemId:v,itemType:u,label:k,sortOrder:y,creationDate:g,isPublished:"0",url:I,urlDescription:null,urlId:null},w=await s.getPromise(R({driveId:a,folderId:c}));let p=JSON.parse(JSON.stringify(w)),f=[...p.contentIds[x.DEFAULT]],D=f.indexOf(A);f.splice(D+1,0,v),p.contentIds[x.DEFAULT]=f,p.contentsDictionary[v]=m,p.contentsDictionaryByDoenetId[d]=m,o(R({driveId:a,folderId:c}),p),(u==="Folder"||u==="Collection")&&o(R({driveId:a,folderId:v}),{folderInfo:m,contentsDictionary:{},contentIds:{[x.DEFAULT]:[]}}),n("Add new item 'Untitled'",j.SUCCESS)},[n]),t=K(({snapshot:s,set:o})=>async({driveId:a,parentFolderId:c,itemId:d,driveInstanceId:l,label:v})=>{const u=await s.getPromise(R({driveId:a,folderId:c})),k=await s.getPromise(M),y={driveId:a,driveInstanceId:l,itemId:d};if(await s.getPromise(z(y))){o(z(y),!1);let m=[];for(let w of k)w.itemId!==d&&m.push(w);o(M,m)}let I={...u};I.contentsDictionary={...u.contentsDictionary},I.contentsDictionaryByDoenetId={...u.contentsDictionaryByDoenetId},delete I.contentsDictionaryByDoenetId[I.contentsDictionary[d].doenetId],delete I.contentsDictionary[d],I.folderInfo={...u.folderInfo},I.contentIds={},I.contentIds[x.DEFAULT]=[...u.contentIds[x.DEFAULT]];const A=I.contentIds[x.DEFAULT].indexOf(d);I.contentIds[x.DEFAULT].splice(A,1),o(R({driveId:a,folderId:c}),I),n(`Deleted item '${v}'`,j.SUCCESS)}),i=K(({set:s})=>(o,a,c)=>{s(M,[]),s(R({driveId:o.destinationDriveId,folderId:o.destinationItemId}),a);for(let d of Object.keys(c))for(let l of Object.keys(c[d]))s(R({driveId:d,folderId:l}),c[d][l]),s(ze({driveId:d,folderId:l}),!0);s(ze({driveId:o.destinationDriveId,folderId:o.destinationItemId}),!0)},[]),r=K(({snapshot:s,set:o})=>async({driveId:a,folderId:c,itemId:d,label:l,type:v})=>{const u=await s.getPromise(R({driveId:a,folderId:c}));let k={...u};k.contentsDictionary={...u.contentsDictionary},k.contentsDictionaryByDoenetId={...u.contentsDictionaryByDoenetId},k.contentsDictionary[d]={...u.contentsDictionary[d]},k.contentsDictionary[d].label=l,k.contentsDictionaryByDoenetId[k.contentsDictionary[d].doenetId]={...u.contentsDictionary[d]},k.contentsDictionaryByDoenetId[k.contentsDictionary[d].doenetId].label=l,o(R({driveId:a,folderId:c}),k),(v==="Folder"||v==="Collection")&&o(R({driveId:a,folderId:d}),y=>{let g={...y};return g.folderInfo={...y.folderInfo},g.folderInfo.label=l,g}),n(`Renamed item to '${l}'`,j.SUCCESS)});return{acceptAddItem:e,acceptDeleteItem:t,acceptMoveItems:i,acceptRenameItem:r}}const Nn=n=>`${n.getFullYear().toString().padStart(2,"0")}-${(n.getMonth()+1).toString().padStart(2,"0")}-${n.getDate().toString().padStart(2,"0")} ${n.getHours().toString().padStart(2,"0")}:${n.getMinutes().toString().padStart(2,"0")}:${n.getSeconds().toString().padStart(2,"0")}`;B.createContext({});const st=Y({key:"loadAssignmentAtomFamily",default:q({key:"loadAssignmentAtomFamily/Default",get:n=>async()=>{const{data:e}=await P.get("/api/getAllAssignmentSettings.php",{params:{doenetId:n}});let t={...e.assignment};return t.assignedDate&&(t.assignedDate=ke(t.assignedDate).toLocaleString()),t.dueDate&&(t.dueDate=ke(t.dueDate).toLocaleString()),t.pinnedAfterDate&&(t.pinnedAfterDate=ke(t.pinnedAfterDate).toLocaleString()),t.pinnedUntilDate&&(t.pinnedUntilDate=ke(t.pinnedUntilDate).toLocaleString()),t}})}),Ot=q({key:"loadAssignmentSelector",get:n=>async({get:e})=>await e(st(n)),set:n=>({set:e},t)=>{e(st(n),t)}}),ot=Object.freeze({DOENETML:"DoenetML",FOLDER:"Folder",COLLECTION:"Collection"}),de=Y({key:"fetchDriveUsersQuery",default:q({key:"fetchDriveUsersQuery/Default",get:n=>async()=>{const e={params:{driveId:n}},{data:t}=await P.get("/api/loadDriveUsers.php",e);return t}})});q({key:"fetchDriveUsers",get:n=>({get:e})=>e(de(n)),set:n=>({get:e,set:t},i)=>{let r={params:{email:i.email,type:i.type,driveId:n,userId:i.userId}};switch(i.type){case"Add Owner":P.get("/api/saveUserToDrive.php",r).then(s=>{i.callback(s.data)});break;case"Add Owner step 2":t(de(n),s=>{let o={...s},a=[...s.owners];return a.push({email:i.email,isUser:!1,screenName:i.screenName,userId:i.userId}),o.owners=a,o});break;case"Add Admin":P.get("/api/saveUserToDrive.php",r).then(s=>{i.callback(s.data)});break;case"Add Admin step 2":t(de(n),s=>{let o={...s},a=[...s.admins];return a.push({email:i.email,isUser:!1,screenName:i.screenName,userId:i.userId}),o.admins=a,o});break;case"Remove User":t(de(n),s=>{let o={...s};if(i.userRole==="owner"){let a=[...s.owners];for(let c=0;c{let o={...s},a=[],c=[...s.admins];for(let l=0;l{let o={...s},a=[],c=[...s.owners];for(let l=0;l{const{createCourse:t}=s();return e("div",{style:r.style,children:e(a,{vertical:!0,children:e(o,{width:"menu",value:"Create New Course",onClick:t,"data-test":"createCourse",children:"Create New Course"})})})};export{n as default}; +import{bk as s,j as e,B as o}from"./index-9d63439d.js";import{B as a}from"./ButtonGroup-ec02b3e9.js";const n=r=>{const{createCourse:t}=s();return e("div",{style:r.style,children:e(a,{vertical:!0,children:e(o,{width:"menu",value:"Create New Course",onClick:t,"data-test":"createCourse",children:"Create New Course"})})})};export{n as default}; diff --git a/dist/assets/CreditAchieved-ca85b1d4.js b/dist/assets/CreditAchieved-9610e115.js similarity index 86% rename from dist/assets/CreditAchieved-ca85b1d4.js rename to dist/assets/CreditAchieved-9610e115.js index 19aeafcafb..c988977a6a 100644 --- a/dist/assets/CreditAchieved-ca85b1d4.js +++ b/dist/assets/CreditAchieved-9610e115.js @@ -1,4 +1,4 @@ -import{l as t,m as h,G as z,u as W,e as J,r as P,v as V,k as M,j as r,a as i,s as O,y as X,g as q,R as H,B as k,z as K}from"./index-61b6fc23.js";import{currentAttemptNumber as Q,creditAchievedAtom as B}from"./AssignmentViewer-ce09819c.js";import{i as Y,c as Z,a as ee}from"./ActivityViewer-5e9601b2.js";import{e as te}from"./RoleDropdown-c9fff172.js";import{B as re}from"./ButtonGroup-6d856500.js";import{T as ie}from"./Textfield-637f7b37.js";import{overviewData as se}from"./Gradebook-bd1a82d1.js";import"./activityUtils-3e149527.js";import"./ActionButton-be9a12e7.js";import"./visibility-sensor-398e690f.js";import"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";const ne=O.div` +import{l as t,m as h,G as z,u as W,e as J,r as P,v as V,k as M,j as r,a as i,s as O,y as X,g as q,R as H,B as k,z as K}from"./index-9d63439d.js";import{currentAttemptNumber as Q,creditAchievedAtom as B}from"./AssignmentViewer-07288d77.js";import{i as Y,c as Z,a as ee}from"./ActivityViewer-90c65d6d.js";import{e as te}from"./RoleDropdown-2d4e4388.js";import{B as re}from"./ButtonGroup-ec02b3e9.js";import{T as ie}from"./Textfield-381b1f5a.js";import{overviewData as se}from"./Gradebook-8ee8571a.js";import"./activityUtils-5d3d0ed0.js";import"./ActionButton-056b08c3.js";import"./visibility-sensor-aefdbbd5.js";import"./DropdownMenu-421d3462.js";import"./setPrototypeOf-51e8cf87.js";const ne=O.div` border-bottom: 2px solid var(--canvastext); height: 2px; width: 230px; diff --git a/dist/assets/CurrentContent-3a31b183.js b/dist/assets/CurrentContent-3a31b183.js new file mode 100644 index 0000000000..2981b012dc --- /dev/null +++ b/dist/assets/CurrentContent-3a31b183.js @@ -0,0 +1 @@ +import{g as r,a as e,j as i,A as m}from"./index-9d63439d.js";import{s as n,a as c}from"./Next7Days-1ee7c537.js";import"./CourseToolHandler-d3661515.js";import"./index-df71c5ec.js";import"./index-fcf36459.js";import"./index-47ca4f11.js";import"./index.esm-d6b6ff57.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./ButtonGroup-ec02b3e9.js";import"./RoleDropdown-2d4e4388.js";import"./DropdownMenu-421d3462.js";function A(){const[o,p]=r(n),[t,s]=r(c);return e("div",{children:[e("div",{children:[i(m,{style:{marginRight:"2px"},checked:t,onClick:d=>{s(!t)}}),"Show Completed"," "]}),e("div",{children:[i(m,{style:{marginRight:"2px"},checked:o,onClick:d=>{p(!o)}}),"Show Overdue"," "]})]})}export{A as default}; diff --git a/dist/assets/CurrentContent-eb8543fb.js b/dist/assets/CurrentContent-eb8543fb.js deleted file mode 100644 index 2b4055ab52..0000000000 --- a/dist/assets/CurrentContent-eb8543fb.js +++ /dev/null @@ -1 +0,0 @@ -import{g as r,a as e,j as i,A as m}from"./index-61b6fc23.js";import{s as n,a as c}from"./Next7Days-938d1df1.js";import"./CourseToolHandler-d3da4c3a.js";import"./index-1380c04c.js";import"./index-fcf36459.js";import"./index-47ca4f11.js";import"./index.esm-d246f4c9.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./ButtonGroup-6d856500.js";import"./RoleDropdown-c9fff172.js";import"./DropdownMenu-5673dfd7.js";function A(){const[o,p]=r(n),[t,s]=r(c);return e("div",{children:[e("div",{children:[i(m,{style:{marginRight:"2px"},checked:t,onClick:d=>{s(!t)}}),"Show Completed"," "]}),e("div",{children:[i(m,{style:{marginRight:"2px"},checked:o,onClick:d=>{p(!o)}}),"Show Overdue"," "]})]})}export{A as default}; diff --git a/dist/assets/CutCopyPasteMenu-6ba7d6e1.js b/dist/assets/CutCopyPasteMenu-9197df89.js similarity index 72% rename from dist/assets/CutCopyPasteMenu-6ba7d6e1.js rename to dist/assets/CutCopyPasteMenu-9197df89.js index bf898e8126..c2011d998e 100644 --- a/dist/assets/CutCopyPasteMenu-6ba7d6e1.js +++ b/dist/assets/CutCopyPasteMenu-9197df89.js @@ -1 +1 @@ -import{l as e,m as p,a6 as b,y as f,ba as I,bb as h,T as k,j as s,F as j,a as y,z as u}from"./index-61b6fc23.js";import{A as o}from"./ActionButton-be9a12e7.js";import{A}from"./ActionButtonGroup-f3a36748.js";function S(){const n=e(p("courseId")),{copyItems:F,cutItems:r,pasteItems:i}=b(n),a=f();let m=e(I),d=e(h),C=e(k),l=!0,c=!0;return m.length==0&&d.length==0&&(c=!1),C.length==0&&(l=!1),s(j,{children:y(A,{width:"menu",children:[s(o,{width:"menu",value:"Cut",disabled:!l,onClick:()=>{r({successCallback:()=>{},failureCallback:t=>{a(t,u.INFO)}})}}),s(o,{width:"menu",value:"Paste",disabled:!c,onClick:()=>{i({successCallback:()=>{},failureCallback:t=>{a(t,u.INFO)}})}})]})})}export{S as default}; +import{l as e,m as p,a6 as b,y as f,ba as I,bb as h,T as k,j as s,F as j,a as y,z as u}from"./index-9d63439d.js";import{A as o}from"./ActionButton-056b08c3.js";import{A}from"./ActionButtonGroup-9e9bafb3.js";function S(){const n=e(p("courseId")),{copyItems:F,cutItems:r,pasteItems:i}=b(n),a=f();let m=e(I),d=e(h),C=e(k),l=!0,c=!0;return m.length==0&&d.length==0&&(c=!1),C.length==0&&(l=!1),s(j,{children:y(A,{width:"menu",children:[s(o,{width:"menu",value:"Cut",disabled:!l,onClick:()=>{r({successCallback:()=>{},failureCallback:t=>{a(t,u.INFO)}})}}),s(o,{width:"menu",value:"Paste",disabled:!c,onClick:()=>{i({successCallback:()=>{},failureCallback:t=>{a(t,u.INFO)}})}})]})})}export{S as default}; diff --git a/dist/assets/Dashboard-e9a21901.js b/dist/assets/Dashboard-c8b632ce.js similarity index 89% rename from dist/assets/Dashboard-e9a21901.js rename to dist/assets/Dashboard-c8b632ce.js index c32e905f0f..56fd66e4d5 100644 --- a/dist/assets/Dashboard-e9a21901.js +++ b/dist/assets/Dashboard-c8b632ce.js @@ -1,4 +1,4 @@ -import{j as a,a as c,s as p,R as x,p as y,l as g,m as C,E as k,b as w,c as A,r as P,I as T,i as s,J as D,K as I,L as S,M as h}from"./index-61b6fc23.js";import{N as G}from"./Next7Days-938d1df1.js";import{e as R}from"./RoleDropdown-c9fff172.js";import"./CourseToolHandler-d3da4c3a.js";import"./index-1380c04c.js";import"./index-fcf36459.js";import"./index-47ca4f11.js";import"./index.esm-d246f4c9.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./ButtonGroup-6d856500.js";import"./DropdownMenu-5673dfd7.js";const M=p.button` +import{j as a,a as c,s as p,R as x,p as y,l as g,m as C,E as k,b as w,c as A,r as P,I as T,i as s,J as D,K as I,L as S,M as h}from"./index-9d63439d.js";import{N as G}from"./Next7Days-1ee7c537.js";import{e as R}from"./RoleDropdown-2d4e4388.js";import"./CourseToolHandler-d3661515.js";import"./index-df71c5ec.js";import"./index-fcf36459.js";import"./index-47ca4f11.js";import"./index.esm-d6b6ff57.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./ButtonGroup-ec02b3e9.js";import"./DropdownMenu-421d3462.js";const M=p.button` background-image: linear-gradient(to bottom left, var(--canvas), var(--canvas), var(--canvas), var(--solidLightBlue)); border-radius: 5px; width: 190px; diff --git a/dist/assets/DashboardBreadCrumb-3dd48300.js b/dist/assets/DashboardBreadCrumb-3dd48300.js deleted file mode 100644 index f5a2523949..0000000000 --- a/dist/assets/DashboardBreadCrumb-3dd48300.js +++ /dev/null @@ -1 +0,0 @@ -import{l as e,m,j as r,r as u}from"./index-61b6fc23.js";import{B as t}from"./BreadCrumb-593a3cf1.js";import{u as c,a as d}from"./breadcrumbUtil-59c43d86.js";import"./RoleDropdown-c9fff172.js";import"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";import"./Gradebook-bd1a82d1.js";function f(){const o=e(m("courseId")),s=c(),a=d(o);return r(u.Suspense,{fallback:r("div",{children:"loading Breadcrumbs..."}),children:r(t,{crumbs:[s,a]})})}export{f as default}; diff --git a/dist/assets/DashboardBreadCrumb-637e9e68.js b/dist/assets/DashboardBreadCrumb-637e9e68.js new file mode 100644 index 0000000000..f193c5624d --- /dev/null +++ b/dist/assets/DashboardBreadCrumb-637e9e68.js @@ -0,0 +1 @@ +import{l as e,m,j as r,r as u}from"./index-9d63439d.js";import{B as t}from"./BreadCrumb-56e53fc8.js";import{u as c,a as d}from"./breadcrumbUtil-379dd524.js";import"./RoleDropdown-2d4e4388.js";import"./DropdownMenu-421d3462.js";import"./setPrototypeOf-51e8cf87.js";import"./Gradebook-8ee8571a.js";function f(){const o=e(m("courseId")),s=c(),a=d(o);return r(u.Suspense,{fallback:r("div",{children:"loading Breadcrumbs..."}),children:r(t,{crumbs:[s,a]})})}export{f as default}; diff --git a/dist/assets/DashboardLeave-36c0097b.js b/dist/assets/DashboardLeave-36c0097b.js new file mode 100644 index 0000000000..739c05f03d --- /dev/null +++ b/dist/assets/DashboardLeave-36c0097b.js @@ -0,0 +1 @@ +import{v as o,q as t}from"./index-9d63439d.js";import{c as r,g as i}from"./CourseToolHandler-d3661515.js";import"./index-df71c5ec.js";import"./index-fcf36459.js";import"./index-47ca4f11.js";import"./index.esm-d6b6ff57.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./ButtonGroup-ec02b3e9.js";function S(){return o(({set:e})=>()=>{e(r,null),e(i,[]),e(t,"")})(),null}export{S as default}; diff --git a/dist/assets/DashboardLeave-c20e7b28.js b/dist/assets/DashboardLeave-c20e7b28.js deleted file mode 100644 index 28fef1f33e..0000000000 --- a/dist/assets/DashboardLeave-c20e7b28.js +++ /dev/null @@ -1 +0,0 @@ -import{v as o,q as t}from"./index-61b6fc23.js";import{c as r,g as i}from"./CourseToolHandler-d3da4c3a.js";import"./index-1380c04c.js";import"./index-fcf36459.js";import"./index-47ca4f11.js";import"./index.esm-d246f4c9.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./ButtonGroup-6d856500.js";function S(){return o(({set:e})=>()=>{e(r,null),e(i,[]),e(t,"")})(),null}export{S as default}; diff --git a/dist/assets/DataBreadCrumb-965135e5.js b/dist/assets/DataBreadCrumb-965135e5.js new file mode 100644 index 0000000000..d7fbb365f1 --- /dev/null +++ b/dist/assets/DataBreadCrumb-965135e5.js @@ -0,0 +1 @@ +import{l as o,m as e,j as a,r as c}from"./index-9d63439d.js";import{B as d}from"./BreadCrumb-56e53fc8.js";import{u as i,a as n,d as b}from"./breadcrumbUtil-379dd524.js";import"./RoleDropdown-2d4e4388.js";import"./DropdownMenu-421d3462.js";import"./setPrototypeOf-51e8cf87.js";import"./Gradebook-8ee8571a.js";function I(){const r=o(e("courseId"));let s=o(e("sectionId"));s==""&&(s=r);const m=i(),t=n(r),u=b(r,s);return a(c.Suspense,{fallback:a("div",{children:"loading Breadcrumbs..."}),children:a(d,{crumbs:[m,t,...u]})})}export{I as default}; diff --git a/dist/assets/DataBreadCrumb-db1a366b.js b/dist/assets/DataBreadCrumb-db1a366b.js deleted file mode 100644 index 96ef166288..0000000000 --- a/dist/assets/DataBreadCrumb-db1a366b.js +++ /dev/null @@ -1 +0,0 @@ -import{l as o,m as e,j as a,r as c}from"./index-61b6fc23.js";import{B as d}from"./BreadCrumb-593a3cf1.js";import{u as i,a as n,d as b}from"./breadcrumbUtil-59c43d86.js";import"./RoleDropdown-c9fff172.js";import"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";import"./Gradebook-bd1a82d1.js";function I(){const r=o(e("courseId"));let s=o(e("sectionId"));s==""&&(s=r);const m=i(),t=n(r),u=b(r,s);return a(c.Suspense,{fallback:a("div",{children:"loading Breadcrumbs..."}),children:a(d,{crumbs:[m,t,...u]})})}export{I as default}; diff --git a/dist/assets/DataCap-44eb6c65.js b/dist/assets/DataCap-d09a1607.js similarity index 86% rename from dist/assets/DataCap-44eb6c65.js rename to dist/assets/DataCap-d09a1607.js index 54c2bdc765..84048a5134 100644 --- a/dist/assets/DataCap-44eb6c65.js +++ b/dist/assets/DataCap-d09a1607.js @@ -1 +1 @@ -import{l as s,m as n,I as u,a as d,F as g,j as i}from"./index-61b6fc23.js";import{f as b,a as h}from"./util-85d105b8.js";import"./util-38d8e238.js";function v(){const c=s(n("courseId")),l=s(n("tool"));let e=s(u(c));if(!e||Object.keys(e).length==0)return null;let o=e.color,a=e.image,m=e.label,r="course";a!="none"&&(r=b(a),a="url(./drive_pictures/"+a+")"),o!="none"&&(r=h(o),o="#"+o);let t="";return l=="navigation"?t="Course Navigation":l=="dashboard"?t="Dashboard":l=="data"&&(t="Data"),d(g,{children:[i("div",{style:{position:"relative",width:"100%",height:"165px",overflow:"hidden"},children:i("img",{"aria-label":r,style:{position:"absolute",width:"100%",height:"100%",backgroundSize:"cover",backgroundPosition:"center",backgroundImage:a,backgroundColor:o}})}),i("b",{children:t}),d("div",{style:{padding:"16px 12px"},children:[i("span",{style:{marginBottom:"15px"},children:m})," ",i("br",{})]})]})}export{v as default}; +import{l as s,m as n,I as u,a as d,F as g,j as i}from"./index-9d63439d.js";import{f as b,a as h}from"./util-85d105b8.js";import"./util-38d8e238.js";function v(){const c=s(n("courseId")),l=s(n("tool"));let e=s(u(c));if(!e||Object.keys(e).length==0)return null;let o=e.color,a=e.image,m=e.label,r="course";a!="none"&&(r=b(a),a="url(./drive_pictures/"+a+")"),o!="none"&&(r=h(o),o="#"+o);let t="";return l=="navigation"?t="Course Navigation":l=="dashboard"?t="Dashboard":l=="data"&&(t="Data"),d(g,{children:[i("div",{style:{position:"relative",width:"100%",height:"165px",overflow:"hidden"},children:i("img",{"aria-label":r,style:{position:"absolute",width:"100%",height:"100%",backgroundSize:"cover",backgroundPosition:"center",backgroundImage:a,backgroundColor:o}})}),i("b",{children:t}),d("div",{style:{padding:"16px 12px"},children:[i("span",{style:{marginBottom:"15px"},children:m})," ",i("br",{})]})]})}export{v as default}; diff --git a/dist/assets/DataPanel-2e0e6e03.js b/dist/assets/DataPanel-9cb3d814.js similarity index 89% rename from dist/assets/DataPanel-2e0e6e03.js rename to dist/assets/DataPanel-9cb3d814.js index 438bb5c02e..e5c8e2790b 100644 --- a/dist/assets/DataPanel-2e0e6e03.js +++ b/dist/assets/DataPanel-9cb3d814.js @@ -1,4 +1,4 @@ -import{v as x,q as u,G as y,p as T,k as f,j as a,r as k,a as t,U as w,s as i}from"./index-61b6fc23.js";import{C as v}from"./CourseNavigator-ee468584.js";import"./index.esm-d246f4c9.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./RoleDropdown-c9fff172.js";import"./DropdownMenu-5673dfd7.js";import"./ButtonGroup-6d856500.js";const N=w` +import{v as x,q as u,G as y,p as T,k as f,j as a,r as k,a as t,U as w,s as i}from"./index-9d63439d.js";import{C as v}from"./CourseNavigator-f7abeab6.js";import"./index.esm-d6b6ff57.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./RoleDropdown-2d4e4388.js";import"./DropdownMenu-421d3462.js";import"./ButtonGroup-ec02b3e9.js";const N=w` 0% { background-position: -250px 0; } 100% { background-position: 250px 0; } `,S=i.table` diff --git a/dist/assets/DateTime-3ab576fc.js b/dist/assets/DateTime-b5df08e4.js similarity index 99% rename from dist/assets/DateTime-3ab576fc.js rename to dist/assets/DateTime-b5df08e4.js index 5c6c07727b..cd21a97df0 100644 --- a/dist/assets/DateTime-3ab576fc.js +++ b/dist/assets/DateTime-b5df08e4.js @@ -1,4 +1,4 @@ -import{r as F,au as it,s as Re,a as Ne,j as L}from"./index-61b6fc23.js";import{r as st}from"./moment-b216ba57.js";var ct=function(l){var O={};function d(h){if(O[h])return O[h].exports;var g=O[h]={i:h,l:!1,exports:{}};return l[h].call(g.exports,g,g.exports,d),g.l=!0,g.exports}return d.m=l,d.c=O,d.d=function(h,g,C){d.o(h,g)||Object.defineProperty(h,g,{enumerable:!0,get:C})},d.r=function(h){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(h,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(h,"__esModule",{value:!0})},d.t=function(h,g){if(1&g&&(h=d(h)),8&g||4&g&&typeof h=="object"&&h&&h.__esModule)return h;var C=Object.create(null);if(d.r(C),Object.defineProperty(C,"default",{enumerable:!0,value:h}),2&g&&typeof h!="string")for(var v in h)d.d(C,v,function(_){return h[_]}.bind(null,v));return C},d.n=function(h){var g=h&&h.__esModule?function(){return h.default}:function(){return h};return d.d(g,"a",g),g},d.o=function(h,g){return Object.prototype.hasOwnProperty.call(h,g)},d.p="",d(d.s=4)}([function(l,O){l.exports=F},function(l,O){l.exports=st},function(l,O){l.exports=it},function(l,O,d){l.exports=d(5)()},function(l,O,d){l.exports=d(7)},function(l,O,d){var h=d(6);function g(){}function C(){}C.resetWarningCache=g,l.exports=function(){function v(Y,T,R,H,B,x){if(x!==h){var S=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw S.name="Invariant Violation",S}}function _(){return v}v.isRequired=v;var u={array:v,bigint:v,bool:v,func:v,number:v,object:v,string:v,symbol:v,any:v,arrayOf:_,element:v,elementType:v,instanceOf:_,node:v,objectOf:_,oneOf:_,oneOfType:_,shape:_,exact:_,checkPropTypes:C,resetWarningCache:g};return u.PropTypes=u,u}},function(l,O,d){l.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(l,O,d){d.r(O);var h=d(3),g=d.n(h),C=d(1),v=d.n(C),_=d(0),u=d.n(_);function Y(){return(Y=Object.assign?Object.assign.bind():function(r){for(var t=1;t"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var i,n=j(r);if(t){var o=j(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return q(this,i)}}function q(r,t){if(t&&(R(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return U(r)}function U(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function j(r){return(j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(r)}function I(r,t,i){return t in r?Object.defineProperty(r,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[t]=i,r}var W=function(r){(function(e,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(a&&a.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),a&&x(e,a)})(o,r);var t,i,n=S(o);function o(){var e;H(this,o);for(var a=arguments.length,s=new Array(a),c=0;c"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var i,n=G(r);if(t){var o=G(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Ye(this,i)}}function Ye(r,t){if(t&&(ue(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return fe(r)}function fe(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function G(r){return(G=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(r)}function Be(r,t,i){return t in r?Object.defineProperty(r,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[t]=i,r}I(W,"defaultProps",{isValidDate:function(){return!0},renderDay:function(r,t){return u.a.createElement("td",r,t.date())}});var Ae=function(r){(function(e,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(a&&a.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),a&&le(e,a)})(o,r);var t,i,n=Le(o);function o(){var e;Ie(this,o);for(var a=arguments.length,s=new Array(a),c=0;c1;)if(a(s.date(c)))return!1;return!0}},{key:"getMonthText",value:function(e){var a,s=this.props.viewDate,c=s.localeData().monthsShort(s.month(e));return(a=c.substring(0,3)).charAt(0).toUpperCase()+a.slice(1)}}])&&Me(t.prototype,i),Object.defineProperty(t,"prototype",{writable:!1}),o}(u.a.Component);function He(r,t){return t<4?r[0]:t<8?r[1]:r[2]}function pe(r){return(pe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(r)}function Ue(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}function We(r,t){for(var i=0;i"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var i,n=J(r);if(t){var o=J(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return ze(this,i)}}function ze(r,t){if(t&&(pe(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return X(r)}function X(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function J(r){return(J=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(r)}function Q(r,t,i){return t in r?Object.defineProperty(r,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[t]=i,r}var he=function(r){(function(e,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(a&&a.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),a&&de(e,a)})(o,r);var t,i,n=Ze(o);function o(){var e;Ue(this,o);for(var a=arguments.length,s=new Array(a),c=0;c1;)if(s(c.dayOfYear(f)))return a[e]=!1,!1;return a[e]=!0,!0}}])&&We(t.prototype,i),Object.defineProperty(t,"prototype",{writable:!1}),o}(u.a.Component);function Ke(r,t){return t<3?r[0]:t<7?r[1]:r[2]}function me(r){return(me=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(r)}function $e(r,t){for(var i=0;i"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var i,n=ee(r);if(t){var o=ee(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Ge(this,i)}}function Ge(r,t){if(t&&(me(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}(r)}function ee(r){return(ee=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(r)}function ve(r,t){var i=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(r,o).enumerable})),i.push.apply(i,n)}return i}function be(r){for(var t=1;t=12?e-=12:e+=12,this.props.setTime("hours",e)}},{key:"increase",value:function(e){var a=this.constraints[e],s=parseInt(this.state[e],10)+a.step;return s>a.max&&(s=a.min+(s-(a.max+1))),M(e,s)}},{key:"decrease",value:function(e){var a=this.constraints[e],s=parseInt(this.state[e],10)-a.step;return s=0||(A[E]=w[E]);return A}(y,["excludeScrollbar"]);return r.prototype&&r.prototype.isReactComponent?p.ref=this.getRef:p.wrappedRef=this.getRef,p.disableOnClickOutside=this.disableOnClickOutside,p.enableOnClickOutside=this.enableOnClickOutside,Object(_.createElement)(r,p)},c}(_.Component),i.displayName="OnClickOutside("+o+")",i.defaultProps={eventTypes:["mousedown","touchstart"],excludeScrollbar:t&&t.excludeScrollbar||!1,outsideClickIgnoreClass:"ignore-react-onclickoutside",preventDefault:!1,stopPropagation:!1},i.getClass=function(){return r.getClass?r.getClass():r},n};function De(r){return(De=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(r)}function Ce(r,t){var i=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(r,o).enumerable})),i.push.apply(i,n)}return i}function Pe(r){for(var t=1;t"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var i,n=oe(r);if(t){var o=oe(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return ot(this,i)}}function ot(r,t){if(t&&(De(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return P(r)}function P(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function oe(r){return(oe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(r)}function k(r,t,i){return t in r?Object.defineProperty(r,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[t]=i,r}d.d(O,"default",function(){return K});var ae="years",ie="months",z="days",xe="time",m=g.a,N=function(){},se=m.oneOfType([m.instanceOf(v.a),m.instanceOf(Date),m.string]),K=function(r){Se(i,r);var t=Te(i);function i(n){var o;return _e(this,i),k(P(o=t.call(this,n)),"_renderCalendar",function(){var e=o.props,a=o.state,s={viewDate:a.viewDate.clone(),selectedDate:o.getSelectedDate(),isValidDate:e.isValidDate,updateDate:o._updateDate,navigate:o._viewNavigate,moment:v.a,showView:o._showView};switch(a.currentView){case ae:return s.renderYear=e.renderYear,u.a.createElement(he,s);case ie:return s.renderMonth=e.renderMonth,u.a.createElement(Ae,s);case z:return s.renderDay=e.renderDay,s.timeFormat=o.getFormat("time"),u.a.createElement(W,s);default:return s.dateFormat=o.getFormat("date"),s.timeFormat=o.getFormat("time"),s.timeConstraints=e.timeConstraints,s.setTime=o._setTime,u.a.createElement(Je,s)}}),k(P(o),"_showView",function(e,a){var s=(a||o.state.viewDate).clone(),c=o.props.onBeforeNavigate(e,o.state.currentView,s);c&&o.state.currentView!==c&&(o.props.onNavigate(c),o.setState({currentView:c}))}),k(P(o),"viewToMethod",{days:"date",months:"month",years:"year"}),k(P(o),"nextView",{days:"time",months:"days",years:"months"}),k(P(o),"_updateDate",function(e){var a=o.state.currentView,s=o.getUpdateOn(o.getFormat("date")),c=o.state.viewDate.clone();c[o.viewToMethod[a]](parseInt(e.target.getAttribute("data-value"),10)),a==="days"&&(c.month(parseInt(e.target.getAttribute("data-month"),10)),c.year(parseInt(e.target.getAttribute("data-year"),10)));var f={viewDate:c};a===s?(f.selectedDate=c.clone(),f.inputValue=c.format(o.getFormat("datetime")),o.props.open===void 0&&o.props.input&&o.props.closeOnSelect&&o._closeCalendar(),o.props.onChange(c.clone())):o._showView(o.nextView[a],c),o.setState(f)}),k(P(o),"_viewNavigate",function(e,a){var s=o.state.viewDate.clone();s.add(e,a),e>0?o.props.onNavigateForward(e,a):o.props.onNavigateBack(-e,a),o.setState({viewDate:s})}),k(P(o),"_setTime",function(e,a){var s=(o.getSelectedDate()||o.state.viewDate).clone();s[e](a),o.props.value||o.setState({selectedDate:s,viewDate:s.clone(),inputValue:s.format(o.getFormat("datetime"))}),o.props.onChange(s)}),k(P(o),"_openCalendar",function(){o.isOpen()||o.setState({open:!0},o.props.onOpen)}),k(P(o),"_closeCalendar",function(){o.isOpen()&&o.setState({open:!1},function(){o.props.onClose(o.state.selectedDate||o.state.inputValue)})}),k(P(o),"_handleClickOutside",function(){var e=o.props;e.input&&o.state.open&&e.open===void 0&&e.closeOnClickOutside&&o._closeCalendar()}),k(P(o),"_onInputFocus",function(e){o.callHandler(o.props.inputProps.onFocus,e)&&o._openCalendar()}),k(P(o),"_onInputChange",function(e){if(o.callHandler(o.props.inputProps.onChange,e)){var a=e.target?e.target.value:e,s=o.localMoment(a,o.getFormat("datetime")),c={inputValue:a};s.isValid()?(c.selectedDate=s,c.viewDate=s.clone().startOf("month")):c.selectedDate=null,o.setState(c,function(){o.props.onChange(s.isValid()?s:o.state.inputValue)})}}),k(P(o),"_onInputKeyDown",function(e){o.callHandler(o.props.inputProps.onKeyDown,e)&&e.which===9&&o.props.closeOnTab&&o._closeCalendar()}),k(P(o),"_onInputClick",function(e){o.callHandler(o.props.inputProps.onClick,e)&&o._openCalendar()}),o.state=o.getInitialState(),o}return je(i,[{key:"render",value:function(){return u.a.createElement(at,{className:this.getClassName(),onClickOut:this._handleClickOutside},this.renderInput(),u.a.createElement("div",{className:"rdtPicker"},this.renderView()))}},{key:"renderInput",value:function(){if(this.props.input){var n=Pe(Pe({type:"text",className:"form-control",value:this.getInputValue()},this.props.inputProps),{},{onFocus:this._onInputFocus,onChange:this._onInputChange,onKeyDown:this._onInputKeyDown,onClick:this._onInputClick});return this.props.renderInput?u.a.createElement("div",null,this.props.renderInput(n,this._openCalendar,this._closeCalendar)):u.a.createElement("input",n)}}},{key:"renderView",value:function(){return this.props.renderView(this.state.currentView,this._renderCalendar)}},{key:"getInitialState",value:function(){var n=this.props,o=this.getFormat("datetime"),e=this.parseDate(n.value||n.initialValue,o);return this.checkTZ(),{open:!n.input,currentView:n.initialViewMode||this.getInitialView(),viewDate:this.getInitialViewDate(e),selectedDate:e&&e.isValid()?e:void 0,inputValue:this.getInitialInputValue(e)}}},{key:"getInitialViewDate",value:function(n){var o,e=this.props.initialViewDate;if(e){if((o=this.parseDate(e,this.getFormat("datetime")))&&o.isValid())return o;ce('The initialViewDated given "'+e+'" is not valid. Using current date instead.')}else if(n&&n.isValid())return n.clone();return this.getInitialDate()}},{key:"getInitialDate",value:function(){var n=this.localMoment();return n.hour(0).minute(0).second(0).millisecond(0),n}},{key:"getInitialView",value:function(){var n=this.getFormat("date");return n?this.getUpdateOn(n):xe}},{key:"parseDate",value:function(n,o){var e;return n&&typeof n=="string"?e=this.localMoment(n,o):n&&(e=this.localMoment(n)),e&&!e.isValid()&&(e=null),e}},{key:"getClassName",value:function(){var n="rdt",o=this.props,e=o.className;return Array.isArray(e)?n+=" "+e.join(" "):e&&(n+=" "+e),o.input||(n+=" rdtStatic"),this.isOpen()&&(n+=" rdtOpen"),n}},{key:"isOpen",value:function(){return!this.props.input||(this.props.open===void 0?this.state.open:this.props.open)}},{key:"getUpdateOn",value:function(n){return this.props.updateOnView?this.props.updateOnView:n.match(/[lLD]/)?z:n.indexOf("M")!==-1?ie:n.indexOf("Y")!==-1?ae:z}},{key:"getLocaleData",value:function(){var n=this.props;return this.localMoment(n.value||n.defaultValue||new Date).localeData()}},{key:"getDateFormat",value:function(){var n=this.getLocaleData(),o=this.props.dateFormat;return o===!0?n.longDateFormat("L"):o||""}},{key:"getTimeFormat",value:function(){var n=this.getLocaleData(),o=this.props.timeFormat;return o===!0?n.longDateFormat("LT"):o||""}},{key:"getFormat",value:function(n){if(n==="date")return this.getDateFormat();if(n==="time")return this.getTimeFormat();var o=this.getDateFormat(),e=this.getTimeFormat();return o&&e?o+" "+e:o||e}},{key:"updateTime",value:function(n,o,e,a){var s={},c=a?"selectedDate":"viewDate";s[c]=this.state[c].clone()[n](o,e),this.setState(s)}},{key:"localMoment",value:function(n,o,e){var a=null;return a=(e=e||this.props).utc?v.a.utc(n,o,e.strictParsing):e.displayTimeZone?v.a.tz(n,o,e.displayTimeZone):v()(n,o,e.strictParsing),e.locale&&a.locale(e.locale),a}},{key:"checkTZ",value:function(){var n=this.props.displayTimeZone;!n||this.tzWarning||v.a.tz||(this.tzWarning=!0,ce('displayTimeZone prop with value "'+n+'" is used but moment.js timezone is not loaded.',"error"))}},{key:"componentDidUpdate",value:function(n){if(n!==this.props){var o=!1,e=this.props;["locale","utc","displayZone","dateFormat","timeFormat"].forEach(function(a){n[a]!==e[a]&&(o=!0)}),o&&this.regenerateDates(),e.value&&e.value!==n.value&&this.setViewDate(e.value),this.checkTZ()}}},{key:"regenerateDates",value:function(){var n=this.props,o=this.state.viewDate.clone(),e=this.state.selectedDate&&this.state.selectedDate.clone();n.locale&&(o.locale(n.locale),e&&e.locale(n.locale)),n.utc?(o.utc(),e&&e.utc()):n.displayTimeZone?(o.tz(n.displayTimeZone),e&&e.tz(n.displayTimeZone)):(o.locale(),e&&e.locale());var a={viewDate:o,selectedDate:e};e&&e.isValid()&&(a.inputValue=e.format(this.getFormat("datetime"))),this.setState(a)}},{key:"getSelectedDate",value:function(){if(this.props.value===void 0)return this.state.selectedDate;var n=this.parseDate(this.props.value,this.getFormat("datetime"));return!(!n||!n.isValid())&&n}},{key:"getInitialInputValue",value:function(n){var o=this.props;return o.inputProps.value?o.inputProps.value:n&&n.isValid()?n.format(this.getFormat("datetime")):o.value&&typeof o.value=="string"?o.value:o.initialValue&&typeof o.initialValue=="string"?o.initialValue:""}},{key:"getInputValue",value:function(){var n=this.getSelectedDate();return n?n.format(this.getFormat("datetime")):this.state.inputValue}},{key:"setViewDate",value:function(n){var o,e=function(){return ce("Invalid date passed to the `setViewDate` method: "+n)};return n&&(o=typeof n=="string"?this.localMoment(n,this.getFormat("datetime")):this.localMoment(n))&&o.isValid()?void this.setState({viewDate:o}):e()}},{key:"navigate",value:function(n){this._showView(n)}},{key:"callHandler",value:function(n,o){return!n||n(o)!==!1}}]),i}(u.a.Component);function ce(r,t){var i=typeof window<"u"&&window.console;i&&(t||(t="warn"),i[t]("***react-datetime:"+r))}k(K,"propTypes",{value:se,initialValue:se,initialViewDate:se,initialViewMode:m.oneOf([ae,ie,z,xe]),onOpen:m.func,onClose:m.func,onChange:m.func,onNavigate:m.func,onBeforeNavigate:m.func,onNavigateBack:m.func,onNavigateForward:m.func,updateOnView:m.string,locale:m.string,utc:m.bool,displayTimeZone:m.string,input:m.bool,dateFormat:m.oneOfType([m.string,m.bool]),timeFormat:m.oneOfType([m.string,m.bool]),inputProps:m.object,timeConstraints:m.object,isValidDate:m.func,open:m.bool,strictParsing:m.bool,closeOnSelect:m.bool,closeOnTab:m.bool,renderView:m.func,renderInput:m.func,renderDay:m.func,renderMonth:m.func,renderYear:m.func}),k(K,"defaultProps",{onOpen:N,onClose:N,onCalendarOpen:N,onCalendarClose:N,onChange:N,onNavigate:N,onBeforeNavigate:function(r){return r},onNavigateBack:N,onNavigateForward:N,dateFormat:!0,timeFormat:!0,utc:!1,className:"",input:!0,inputProps:{},timeConstraints:{},isValidDate:function(){return!0},strictParsing:!0,closeOnSelect:!1,closeOnTab:!0,closeOnClickOutside:!0,renderView:function(r,t){return t()}}),k(K,"moment",v.a);var at=rt(function(r){Se(i,r);var t=Te(i);function i(){var n;_e(this,i);for(var o=arguments.length,e=new Array(o),a=0;a"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var i,n=j(r);if(t){var o=j(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return q(this,i)}}function q(r,t){if(t&&(R(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return U(r)}function U(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function j(r){return(j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(r)}function I(r,t,i){return t in r?Object.defineProperty(r,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[t]=i,r}var W=function(r){(function(e,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(a&&a.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),a&&x(e,a)})(o,r);var t,i,n=S(o);function o(){var e;H(this,o);for(var a=arguments.length,s=new Array(a),c=0;c"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var i,n=G(r);if(t){var o=G(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Ye(this,i)}}function Ye(r,t){if(t&&(ue(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return fe(r)}function fe(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function G(r){return(G=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(r)}function Be(r,t,i){return t in r?Object.defineProperty(r,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[t]=i,r}I(W,"defaultProps",{isValidDate:function(){return!0},renderDay:function(r,t){return u.a.createElement("td",r,t.date())}});var Ae=function(r){(function(e,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(a&&a.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),a&&le(e,a)})(o,r);var t,i,n=Le(o);function o(){var e;Ie(this,o);for(var a=arguments.length,s=new Array(a),c=0;c1;)if(a(s.date(c)))return!1;return!0}},{key:"getMonthText",value:function(e){var a,s=this.props.viewDate,c=s.localeData().monthsShort(s.month(e));return(a=c.substring(0,3)).charAt(0).toUpperCase()+a.slice(1)}}])&&Me(t.prototype,i),Object.defineProperty(t,"prototype",{writable:!1}),o}(u.a.Component);function He(r,t){return t<4?r[0]:t<8?r[1]:r[2]}function pe(r){return(pe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(r)}function Ue(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}function We(r,t){for(var i=0;i"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var i,n=J(r);if(t){var o=J(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return ze(this,i)}}function ze(r,t){if(t&&(pe(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return X(r)}function X(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function J(r){return(J=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(r)}function Q(r,t,i){return t in r?Object.defineProperty(r,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[t]=i,r}var he=function(r){(function(e,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(a&&a.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),a&&de(e,a)})(o,r);var t,i,n=Ze(o);function o(){var e;Ue(this,o);for(var a=arguments.length,s=new Array(a),c=0;c1;)if(s(c.dayOfYear(f)))return a[e]=!1,!1;return a[e]=!0,!0}}])&&We(t.prototype,i),Object.defineProperty(t,"prototype",{writable:!1}),o}(u.a.Component);function Ke(r,t){return t<3?r[0]:t<7?r[1]:r[2]}function me(r){return(me=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(r)}function $e(r,t){for(var i=0;i"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var i,n=ee(r);if(t){var o=ee(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Ge(this,i)}}function Ge(r,t){if(t&&(me(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}(r)}function ee(r){return(ee=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(r)}function ve(r,t){var i=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(r,o).enumerable})),i.push.apply(i,n)}return i}function be(r){for(var t=1;t=12?e-=12:e+=12,this.props.setTime("hours",e)}},{key:"increase",value:function(e){var a=this.constraints[e],s=parseInt(this.state[e],10)+a.step;return s>a.max&&(s=a.min+(s-(a.max+1))),M(e,s)}},{key:"decrease",value:function(e){var a=this.constraints[e],s=parseInt(this.state[e],10)-a.step;return s=0||(A[E]=w[E]);return A}(y,["excludeScrollbar"]);return r.prototype&&r.prototype.isReactComponent?p.ref=this.getRef:p.wrappedRef=this.getRef,p.disableOnClickOutside=this.disableOnClickOutside,p.enableOnClickOutside=this.enableOnClickOutside,Object(_.createElement)(r,p)},c}(_.Component),i.displayName="OnClickOutside("+o+")",i.defaultProps={eventTypes:["mousedown","touchstart"],excludeScrollbar:t&&t.excludeScrollbar||!1,outsideClickIgnoreClass:"ignore-react-onclickoutside",preventDefault:!1,stopPropagation:!1},i.getClass=function(){return r.getClass?r.getClass():r},n};function De(r){return(De=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(r)}function Ce(r,t){var i=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(r,o).enumerable})),i.push.apply(i,n)}return i}function Pe(r){for(var t=1;t"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var i,n=oe(r);if(t){var o=oe(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return ot(this,i)}}function ot(r,t){if(t&&(De(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return P(r)}function P(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function oe(r){return(oe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(r)}function k(r,t,i){return t in r?Object.defineProperty(r,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[t]=i,r}d.d(O,"default",function(){return K});var ae="years",ie="months",z="days",xe="time",m=g.a,N=function(){},se=m.oneOfType([m.instanceOf(v.a),m.instanceOf(Date),m.string]),K=function(r){Se(i,r);var t=Te(i);function i(n){var o;return _e(this,i),k(P(o=t.call(this,n)),"_renderCalendar",function(){var e=o.props,a=o.state,s={viewDate:a.viewDate.clone(),selectedDate:o.getSelectedDate(),isValidDate:e.isValidDate,updateDate:o._updateDate,navigate:o._viewNavigate,moment:v.a,showView:o._showView};switch(a.currentView){case ae:return s.renderYear=e.renderYear,u.a.createElement(he,s);case ie:return s.renderMonth=e.renderMonth,u.a.createElement(Ae,s);case z:return s.renderDay=e.renderDay,s.timeFormat=o.getFormat("time"),u.a.createElement(W,s);default:return s.dateFormat=o.getFormat("date"),s.timeFormat=o.getFormat("time"),s.timeConstraints=e.timeConstraints,s.setTime=o._setTime,u.a.createElement(Je,s)}}),k(P(o),"_showView",function(e,a){var s=(a||o.state.viewDate).clone(),c=o.props.onBeforeNavigate(e,o.state.currentView,s);c&&o.state.currentView!==c&&(o.props.onNavigate(c),o.setState({currentView:c}))}),k(P(o),"viewToMethod",{days:"date",months:"month",years:"year"}),k(P(o),"nextView",{days:"time",months:"days",years:"months"}),k(P(o),"_updateDate",function(e){var a=o.state.currentView,s=o.getUpdateOn(o.getFormat("date")),c=o.state.viewDate.clone();c[o.viewToMethod[a]](parseInt(e.target.getAttribute("data-value"),10)),a==="days"&&(c.month(parseInt(e.target.getAttribute("data-month"),10)),c.year(parseInt(e.target.getAttribute("data-year"),10)));var f={viewDate:c};a===s?(f.selectedDate=c.clone(),f.inputValue=c.format(o.getFormat("datetime")),o.props.open===void 0&&o.props.input&&o.props.closeOnSelect&&o._closeCalendar(),o.props.onChange(c.clone())):o._showView(o.nextView[a],c),o.setState(f)}),k(P(o),"_viewNavigate",function(e,a){var s=o.state.viewDate.clone();s.add(e,a),e>0?o.props.onNavigateForward(e,a):o.props.onNavigateBack(-e,a),o.setState({viewDate:s})}),k(P(o),"_setTime",function(e,a){var s=(o.getSelectedDate()||o.state.viewDate).clone();s[e](a),o.props.value||o.setState({selectedDate:s,viewDate:s.clone(),inputValue:s.format(o.getFormat("datetime"))}),o.props.onChange(s)}),k(P(o),"_openCalendar",function(){o.isOpen()||o.setState({open:!0},o.props.onOpen)}),k(P(o),"_closeCalendar",function(){o.isOpen()&&o.setState({open:!1},function(){o.props.onClose(o.state.selectedDate||o.state.inputValue)})}),k(P(o),"_handleClickOutside",function(){var e=o.props;e.input&&o.state.open&&e.open===void 0&&e.closeOnClickOutside&&o._closeCalendar()}),k(P(o),"_onInputFocus",function(e){o.callHandler(o.props.inputProps.onFocus,e)&&o._openCalendar()}),k(P(o),"_onInputChange",function(e){if(o.callHandler(o.props.inputProps.onChange,e)){var a=e.target?e.target.value:e,s=o.localMoment(a,o.getFormat("datetime")),c={inputValue:a};s.isValid()?(c.selectedDate=s,c.viewDate=s.clone().startOf("month")):c.selectedDate=null,o.setState(c,function(){o.props.onChange(s.isValid()?s:o.state.inputValue)})}}),k(P(o),"_onInputKeyDown",function(e){o.callHandler(o.props.inputProps.onKeyDown,e)&&e.which===9&&o.props.closeOnTab&&o._closeCalendar()}),k(P(o),"_onInputClick",function(e){o.callHandler(o.props.inputProps.onClick,e)&&o._openCalendar()}),o.state=o.getInitialState(),o}return je(i,[{key:"render",value:function(){return u.a.createElement(at,{className:this.getClassName(),onClickOut:this._handleClickOutside},this.renderInput(),u.a.createElement("div",{className:"rdtPicker"},this.renderView()))}},{key:"renderInput",value:function(){if(this.props.input){var n=Pe(Pe({type:"text",className:"form-control",value:this.getInputValue()},this.props.inputProps),{},{onFocus:this._onInputFocus,onChange:this._onInputChange,onKeyDown:this._onInputKeyDown,onClick:this._onInputClick});return this.props.renderInput?u.a.createElement("div",null,this.props.renderInput(n,this._openCalendar,this._closeCalendar)):u.a.createElement("input",n)}}},{key:"renderView",value:function(){return this.props.renderView(this.state.currentView,this._renderCalendar)}},{key:"getInitialState",value:function(){var n=this.props,o=this.getFormat("datetime"),e=this.parseDate(n.value||n.initialValue,o);return this.checkTZ(),{open:!n.input,currentView:n.initialViewMode||this.getInitialView(),viewDate:this.getInitialViewDate(e),selectedDate:e&&e.isValid()?e:void 0,inputValue:this.getInitialInputValue(e)}}},{key:"getInitialViewDate",value:function(n){var o,e=this.props.initialViewDate;if(e){if((o=this.parseDate(e,this.getFormat("datetime")))&&o.isValid())return o;ce('The initialViewDated given "'+e+'" is not valid. Using current date instead.')}else if(n&&n.isValid())return n.clone();return this.getInitialDate()}},{key:"getInitialDate",value:function(){var n=this.localMoment();return n.hour(0).minute(0).second(0).millisecond(0),n}},{key:"getInitialView",value:function(){var n=this.getFormat("date");return n?this.getUpdateOn(n):xe}},{key:"parseDate",value:function(n,o){var e;return n&&typeof n=="string"?e=this.localMoment(n,o):n&&(e=this.localMoment(n)),e&&!e.isValid()&&(e=null),e}},{key:"getClassName",value:function(){var n="rdt",o=this.props,e=o.className;return Array.isArray(e)?n+=" "+e.join(" "):e&&(n+=" "+e),o.input||(n+=" rdtStatic"),this.isOpen()&&(n+=" rdtOpen"),n}},{key:"isOpen",value:function(){return!this.props.input||(this.props.open===void 0?this.state.open:this.props.open)}},{key:"getUpdateOn",value:function(n){return this.props.updateOnView?this.props.updateOnView:n.match(/[lLD]/)?z:n.indexOf("M")!==-1?ie:n.indexOf("Y")!==-1?ae:z}},{key:"getLocaleData",value:function(){var n=this.props;return this.localMoment(n.value||n.defaultValue||new Date).localeData()}},{key:"getDateFormat",value:function(){var n=this.getLocaleData(),o=this.props.dateFormat;return o===!0?n.longDateFormat("L"):o||""}},{key:"getTimeFormat",value:function(){var n=this.getLocaleData(),o=this.props.timeFormat;return o===!0?n.longDateFormat("LT"):o||""}},{key:"getFormat",value:function(n){if(n==="date")return this.getDateFormat();if(n==="time")return this.getTimeFormat();var o=this.getDateFormat(),e=this.getTimeFormat();return o&&e?o+" "+e:o||e}},{key:"updateTime",value:function(n,o,e,a){var s={},c=a?"selectedDate":"viewDate";s[c]=this.state[c].clone()[n](o,e),this.setState(s)}},{key:"localMoment",value:function(n,o,e){var a=null;return a=(e=e||this.props).utc?v.a.utc(n,o,e.strictParsing):e.displayTimeZone?v.a.tz(n,o,e.displayTimeZone):v()(n,o,e.strictParsing),e.locale&&a.locale(e.locale),a}},{key:"checkTZ",value:function(){var n=this.props.displayTimeZone;!n||this.tzWarning||v.a.tz||(this.tzWarning=!0,ce('displayTimeZone prop with value "'+n+'" is used but moment.js timezone is not loaded.',"error"))}},{key:"componentDidUpdate",value:function(n){if(n!==this.props){var o=!1,e=this.props;["locale","utc","displayZone","dateFormat","timeFormat"].forEach(function(a){n[a]!==e[a]&&(o=!0)}),o&&this.regenerateDates(),e.value&&e.value!==n.value&&this.setViewDate(e.value),this.checkTZ()}}},{key:"regenerateDates",value:function(){var n=this.props,o=this.state.viewDate.clone(),e=this.state.selectedDate&&this.state.selectedDate.clone();n.locale&&(o.locale(n.locale),e&&e.locale(n.locale)),n.utc?(o.utc(),e&&e.utc()):n.displayTimeZone?(o.tz(n.displayTimeZone),e&&e.tz(n.displayTimeZone)):(o.locale(),e&&e.locale());var a={viewDate:o,selectedDate:e};e&&e.isValid()&&(a.inputValue=e.format(this.getFormat("datetime"))),this.setState(a)}},{key:"getSelectedDate",value:function(){if(this.props.value===void 0)return this.state.selectedDate;var n=this.parseDate(this.props.value,this.getFormat("datetime"));return!(!n||!n.isValid())&&n}},{key:"getInitialInputValue",value:function(n){var o=this.props;return o.inputProps.value?o.inputProps.value:n&&n.isValid()?n.format(this.getFormat("datetime")):o.value&&typeof o.value=="string"?o.value:o.initialValue&&typeof o.initialValue=="string"?o.initialValue:""}},{key:"getInputValue",value:function(){var n=this.getSelectedDate();return n?n.format(this.getFormat("datetime")):this.state.inputValue}},{key:"setViewDate",value:function(n){var o,e=function(){return ce("Invalid date passed to the `setViewDate` method: "+n)};return n&&(o=typeof n=="string"?this.localMoment(n,this.getFormat("datetime")):this.localMoment(n))&&o.isValid()?void this.setState({viewDate:o}):e()}},{key:"navigate",value:function(n){this._showView(n)}},{key:"callHandler",value:function(n,o){return!n||n(o)!==!1}}]),i}(u.a.Component);function ce(r,t){var i=typeof window<"u"&&window.console;i&&(t||(t="warn"),i[t]("***react-datetime:"+r))}k(K,"propTypes",{value:se,initialValue:se,initialViewDate:se,initialViewMode:m.oneOf([ae,ie,z,xe]),onOpen:m.func,onClose:m.func,onChange:m.func,onNavigate:m.func,onBeforeNavigate:m.func,onNavigateBack:m.func,onNavigateForward:m.func,updateOnView:m.string,locale:m.string,utc:m.bool,displayTimeZone:m.string,input:m.bool,dateFormat:m.oneOfType([m.string,m.bool]),timeFormat:m.oneOfType([m.string,m.bool]),inputProps:m.object,timeConstraints:m.object,isValidDate:m.func,open:m.bool,strictParsing:m.bool,closeOnSelect:m.bool,closeOnTab:m.bool,renderView:m.func,renderInput:m.func,renderDay:m.func,renderMonth:m.func,renderYear:m.func}),k(K,"defaultProps",{onOpen:N,onClose:N,onCalendarOpen:N,onCalendarClose:N,onChange:N,onNavigate:N,onBeforeNavigate:function(r){return r},onNavigateBack:N,onNavigateForward:N,dateFormat:!0,timeFormat:!0,utc:!1,className:"",input:!0,inputProps:{},timeConstraints:{},isValidDate:function(){return!0},strictParsing:!0,closeOnSelect:!1,closeOnTab:!0,closeOnClickOutside:!0,renderView:function(r,t){return t()}}),k(K,"moment",v.a);var at=rt(function(r){Se(i,r);var t=Te(i);function i(){var n;_e(this,i);for(var o=arguments.length,e=new Array(o),a=0;al.offset?l.offset:"-50px"}; } diff --git a/dist/assets/DoenetMLEditor-146edab3.js b/dist/assets/DoenetMLEditor-e9b9ebf8.js similarity index 83% rename from dist/assets/DoenetMLEditor-146edab3.js rename to dist/assets/DoenetMLEditor-e9b9ebf8.js index 905ebc44d3..cdfaff1b02 100644 --- a/dist/assets/DoenetMLEditor-146edab3.js +++ b/dist/assets/DoenetMLEditor-e9b9ebf8.js @@ -1 +1 @@ -import{a4 as E,R as L,l as a,m,w as M,r as n,j as p}from"./index-61b6fc23.js";import{C as R}from"./CodeMirror-d3d9f7d1.js";import{u as k}from"./useSaveDraft-fc810696.js";import{t as A,u as h,v as T,e as b}from"./EditorViewerRecoil-fde09b36.js";function y(){let i=E();const s=i==null?void 0:i.pageDoenetId,I=L(A),g=a(h),D=a(T),P=a(m("pageId")),d=a(m("linkPageId"));let c=P,f=!1;d&&(f=!0,c=d),s&&(c=s);const o=a(M),t=a(b);let v=n.useRef(null),e=n.useRef(null),r=n.useRef(!0);const{saveDraft:u}=k();return n.useEffect(()=>()=>{t!==""&&(u({pageId:t,courseId:o,backup:r.current}),e.current!==null&&clearTimeout(e.current),e.current=null)},[t,u,o]),n.useEffect(()=>{t!==""&&(u({pageId:t,courseId:o,backup:r.current}).then(({success:l})=>{l&&(r.current=!1)}),e.current!==null&&clearTimeout(e.current),e.current=null)},[D]),c!==t?(r.current=!0,null):p("div",{children:p(R,{readOnly:f,editorRef:v,setInternalValue:g,onBeforeChange:l=>{I(l),clearTimeout(e.current),e.current=setTimeout(function(){u({pageId:t,courseId:o,backup:r.current}).then(({success:x})=>{x&&(r.current=!1)}),e.current=null},3e3)}},"codemirror")})}export{y as default}; +import{a4 as E,R as L,l as a,m,w as M,r as n,j as p}from"./index-9d63439d.js";import{C as R}from"./CodeMirror-af01bb34.js";import{u as k}from"./useSaveDraft-50a40c9b.js";import{t as A,u as h,v as T,e as b}from"./EditorViewerRecoil-4f9a7d1d.js";function y(){let i=E();const s=i==null?void 0:i.pageDoenetId,I=L(A),g=a(h),D=a(T),P=a(m("pageId")),d=a(m("linkPageId"));let c=P,f=!1;d&&(f=!0,c=d),s&&(c=s);const o=a(M),t=a(b);let v=n.useRef(null),e=n.useRef(null),r=n.useRef(!0);const{saveDraft:u}=k();return n.useEffect(()=>()=>{t!==""&&(u({pageId:t,courseId:o,backup:r.current}),e.current!==null&&clearTimeout(e.current),e.current=null)},[t,u,o]),n.useEffect(()=>{t!==""&&(u({pageId:t,courseId:o,backup:r.current}).then(({success:l})=>{l&&(r.current=!1)}),e.current!==null&&clearTimeout(e.current),e.current=null)},[D]),c!==t?(r.current=!0,null):p("div",{children:p(R,{readOnly:f,editorRef:v,setInternalValue:g,onBeforeChange:l=>{I(l),clearTimeout(e.current),e.current=setTimeout(function(){u({pageId:t,courseId:o,backup:r.current}).then(({success:x})=>{x&&(r.current=!1)}),e.current=null},3e3)}},"codemirror")})}export{y as default}; diff --git a/dist/assets/DoenetMLSettings-15261dfe.js b/dist/assets/DoenetMLSettings-d588689f.js similarity index 84% rename from dist/assets/DoenetMLSettings-15261dfe.js rename to dist/assets/DoenetMLSettings-d588689f.js index 7d75615850..729f60f6a2 100644 --- a/dist/assets/DoenetMLSettings-15261dfe.js +++ b/dist/assets/DoenetMLSettings-d588689f.js @@ -1 +1 @@ -import{l as a,y as r,m as l,j as o,a as t,z as c,i as d,aB as m}from"./index-61b6fc23.js";import{l as p}from"./index-1380c04c.js";import{f as h}from"./index-47ca4f11.js";import{e as f}from"./EditorViewerRecoil-fde09b36.js";import"./index-fcf36459.js";function v(e){const i=a(f),n=`http://${window.location.host}/content/#/?doenetId=${i}`,s=r();return a(l("doenetId"))!==i?o("div",{style:e.style}):t("div",{style:e.style,children:[o("div",{children:"DonetML Name (soon)"}),o("div",{children:"Load time (soon) "}),o("div",{children:"Most recent release "}),t("div",{children:[o(p.CopyToClipboard,{onCopy:()=>s("Link copied to clipboard!",c.SUCCESS),text:n,children:t("button",{onClick:()=>{},children:["copy link ",o(d,{icon:h})]})}),t("button",{onClick:()=>window.open(n,"_blank"),children:["visit ",o(d,{icon:m})]})]})]})}export{v as default}; +import{l as a,y as r,m as l,j as o,a as t,z as c,i as d,aB as m}from"./index-9d63439d.js";import{l as p}from"./index-df71c5ec.js";import{f as h}from"./index-47ca4f11.js";import{e as f}from"./EditorViewerRecoil-4f9a7d1d.js";import"./index-fcf36459.js";function v(e){const i=a(f),n=`http://${window.location.host}/content/#/?doenetId=${i}`,s=r();return a(l("doenetId"))!==i?o("div",{style:e.style}):t("div",{style:e.style,children:[o("div",{children:"DonetML Name (soon)"}),o("div",{children:"Load time (soon) "}),o("div",{children:"Most recent release "}),t("div",{children:[o(p.CopyToClipboard,{onCopy:()=>s("Link copied to clipboard!",c.SUCCESS),text:n,children:t("button",{onClick:()=>{},children:["copy link ",o(d,{icon:h})]})}),t("button",{onClick:()=>window.open(n,"_blank"),children:["visit ",o(d,{icon:m})]})]})]})}export{v as default}; diff --git a/dist/assets/DraftActivityCap-99d68a54.js b/dist/assets/DraftActivityCap-6e6d34f3.js similarity index 89% rename from dist/assets/DraftActivityCap-99d68a54.js rename to dist/assets/DraftActivityCap-6e6d34f3.js index d9b2b7c2c8..76e38d035c 100644 --- a/dist/assets/DraftActivityCap-99d68a54.js +++ b/dist/assets/DraftActivityCap-6e6d34f3.js @@ -1 +1 @@ -import{l as s,w as l,I as n,a as c,j as r}from"./index-61b6fc23.js";import{f as d,a as f}from"./util-85d105b8.js";import"./util-38d8e238.js";function h(){const a=s(l);let i=s(n(a));if(!i||Object.keys(i).length==0)return null;let t=i.color,e=i.image,o="course";return e!="none"&&(o=d(e),e="./drive_pictures/"+e),t!="none"&&(o=f(t),t="#"+t),c("div",{children:[r("div",{style:{position:"relative",width:"100%",height:"165px",overflow:"hidden"},children:r("img",{"aria-label":o,src:e,style:{position:"absolute",width:"100%",top:"50%",transform:"translateY(-50%)"}})}),r("b",{children:"Draft Activity"})]})}export{h as default}; +import{l as s,w as l,I as n,a as c,j as r}from"./index-9d63439d.js";import{f as d,a as f}from"./util-85d105b8.js";import"./util-38d8e238.js";function h(){const a=s(l);let i=s(n(a));if(!i||Object.keys(i).length==0)return null;let t=i.color,e=i.image,o="course";return e!="none"&&(o=d(e),e="./drive_pictures/"+e),t!="none"&&(o=f(t),t="#"+t),c("div",{children:[r("div",{style:{position:"relative",width:"100%",height:"165px",overflow:"hidden"},children:r("img",{"aria-label":o,src:e,style:{position:"absolute",width:"100%",top:"50%",transform:"translateY(-50%)"}})}),r("b",{children:"Draft Activity"})]})}export{h as default}; diff --git a/dist/assets/DraftAssignmentViewer-34ee9c14.js b/dist/assets/DraftAssignmentViewer-cbb79d23.js similarity index 88% rename from dist/assets/DraftAssignmentViewer-34ee9c14.js rename to dist/assets/DraftAssignmentViewer-cbb79d23.js index 5f2b5dc7dc..5f177128bb 100644 --- a/dist/assets/DraftAssignmentViewer-34ee9c14.js +++ b/dist/assets/DraftAssignmentViewer-cbb79d23.js @@ -1 +1 @@ -import{l as i,m as v,w as $,R as B,O as G,r as e,Q,S as T,G as J,v as K,k as U,j as n,F as W}from"./index-61b6fc23.js";import{A as X}from"./ActivityViewer-5e9601b2.js";import{r as Y}from"./activityUtils-3e149527.js";import"./visibility-sensor-398e690f.js";import"./ActionButton-be9a12e7.js";import"./ButtonGroup-6d856500.js";function de(){const t=i(v("doenetId")),m=i($),o=i(v("requestedVariant")),S=o&&Number.isFinite(Number(o))?Number(o):1,y=B(G);let[f,r]=e.useState("Initializing"),[I,p]=e.useState("");const[{showCorrectness:V,paginate:A,showFeedback:C,showHints:D,autoSubmit:_,cid:F,doenetId:b,solutionDisplayMode:x},k]=e.useState({});let P=e.useRef([]);Q(t),T(m);let l=i(J(t)),u=l.label;e.useEffect(()=>{const a=document.title;return u&&(document.title=`${u} - Doenet`),()=>{document.title=a}},[u]),e.useEffect(()=>{O(t,l)},[l,t]);function M(a,g){y({index:a,numberOfVariants:g})}const O=K(({snapshot:a,set:g})=>async(w,{type:R,timeLimit:Z,assignedDate:ee,dueDate:te,showCorrectness:E,showCreditAchievedMenu:ae,paginate:L,showFeedback:N,showHints:j,autoSubmit:q,showSolution:z,proctorMakesAvailable:se})=>{if(R===void 0)return;let h="button";z||(h="none");let d=null,s=await U.get("/api/getCidForAssignment.php",{params:{doenetId:w,latestAttemptOverrides:!1,getDraft:!0}});if(!s.data.success||!s.data.cid){r("Problem"),p(`Error loading assignment: ${s.data.message}`);return}else d=s.data.cid;let c=await Y(d);if(!c.success){r("Problem"),p(c.message);return}P.current=[...Array(c.numberOfVariants).keys()].map(H=>H+1),k({showCorrectness:E,paginate:L,showFeedback:N,showHints:j,autoSubmit:q,cid:d,doenetId:w,solutionDisplayMode:h}),r("Ready")},[]);return t===""?null:m==="__not_found__"?n("h1",{children:"Content not found or no permission to view content"}):f==="Initializing"?null:f==="Problem"?n("h1",{children:I}):n(W,{children:n(X,{cid:F,doenetId:b,flags:{showCorrectness:V,readOnly:!1,solutionDisplayMode:x,showFeedback:C,showHints:D,autoSubmit:_,allowLoadState:!1,allowSaveState:!1,allowLocalState:!1,allowSaveSubmissions:!1,allowSaveEvents:!1},requestedVariantIndex:S,generatedVariantCallback:M,paginate:A},`activityViewer${b}`)})}export{de as default}; +import{l as i,m as v,w as $,R as B,O as G,r as e,Q,S as T,G as J,v as K,k as U,j as n,F as W}from"./index-9d63439d.js";import{A as X}from"./ActivityViewer-90c65d6d.js";import{r as Y}from"./activityUtils-5d3d0ed0.js";import"./visibility-sensor-aefdbbd5.js";import"./ActionButton-056b08c3.js";import"./ButtonGroup-ec02b3e9.js";function de(){const t=i(v("doenetId")),m=i($),o=i(v("requestedVariant")),S=o&&Number.isFinite(Number(o))?Number(o):1,y=B(G);let[f,r]=e.useState("Initializing"),[I,p]=e.useState("");const[{showCorrectness:V,paginate:A,showFeedback:C,showHints:D,autoSubmit:_,cid:F,doenetId:b,solutionDisplayMode:x},k]=e.useState({});let P=e.useRef([]);Q(t),T(m);let l=i(J(t)),u=l.label;e.useEffect(()=>{const a=document.title;return u&&(document.title=`${u} - Doenet`),()=>{document.title=a}},[u]),e.useEffect(()=>{O(t,l)},[l,t]);function M(a,g){y({index:a,numberOfVariants:g})}const O=K(({snapshot:a,set:g})=>async(w,{type:R,timeLimit:Z,assignedDate:ee,dueDate:te,showCorrectness:E,showCreditAchievedMenu:ae,paginate:L,showFeedback:N,showHints:j,autoSubmit:q,showSolution:z,proctorMakesAvailable:se})=>{if(R===void 0)return;let h="button";z||(h="none");let d=null,s=await U.get("/api/getCidForAssignment.php",{params:{doenetId:w,latestAttemptOverrides:!1,getDraft:!0}});if(!s.data.success||!s.data.cid){r("Problem"),p(`Error loading assignment: ${s.data.message}`);return}else d=s.data.cid;let c=await Y(d);if(!c.success){r("Problem"),p(c.message);return}P.current=[...Array(c.numberOfVariants).keys()].map(H=>H+1),k({showCorrectness:E,paginate:L,showFeedback:N,showHints:j,autoSubmit:q,cid:d,doenetId:w,solutionDisplayMode:h}),r("Ready")},[]);return t===""?null:m==="__not_found__"?n("h1",{children:"Content not found or no permission to view content"}):f==="Initializing"?null:f==="Problem"?n("h1",{children:I}):n(W,{children:n(X,{cid:F,doenetId:b,flags:{showCorrectness:V,readOnly:!1,solutionDisplayMode:x,showFeedback:C,showHints:D,autoSubmit:_,allowLoadState:!1,allowSaveState:!1,allowLocalState:!1,allowSaveSubmissions:!1,allowSaveEvents:!1},requestedVariantIndex:S,generatedVariantCallback:M,paginate:A},`activityViewer${b}`)})}export{de as default}; diff --git a/dist/assets/DriveInfoCap-66332bea.js b/dist/assets/DriveInfoCap-4ef4b8d9.js similarity index 84% rename from dist/assets/DriveInfoCap-66332bea.js rename to dist/assets/DriveInfoCap-4ef4b8d9.js index e8f8f17455..70ab712fcc 100644 --- a/dist/assets/DriveInfoCap-66332bea.js +++ b/dist/assets/DriveInfoCap-4ef4b8d9.js @@ -1 +1 @@ -import{l as s,m as d,I as b,g as h,a as c,F as v,j as e}from"./index-61b6fc23.js";import{a as I,R as x}from"./RoleDropdown-c9fff172.js";import{f as _,a as y}from"./util-85d105b8.js";import"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";import"./util-38d8e238.js";function D(){const n=s(d("courseId")),r=s(d("tool"));let o=s(b(n));const[m,u]=h(I(n));if(!o||Object.keys(o).length==0)return null;let f=o.roleLabel,a=o.color,i=o.image,g=o.label,t="course";i!="none"&&(t=_(i),i="url(./drive_pictures/"+i+")"),a!="none"&&(t=y(a),a="#"+a);let l="";return r=="navigation"?l="Course Navigation":r=="dashboard"?l="Dashboard":r=="data"&&(l="Data"),c(v,{children:[e("div",{style:{position:"relative",width:"100%",height:"165px",overflow:"hidden"},children:e("img",{"aria-label":t,style:{position:"absolute",width:"100%",height:"100%",backgroundSize:"cover",backgroundPosition:"center",backgroundImage:i,backgroundColor:a}})}),e("b",{children:l}),c("div",{style:{padding:"16px 12px"},children:[e("span",{style:{marginBottom:"15px"},children:g})," ",e("br",{}),e("span",{style:{marginBottom:"15px"},children:f})," ",e("br",{}),e(x,{label:"View as",onChange:({value:p})=>u(p),valueRoleId:m??o.roleId,vertical:!0})]})]})}export{D as default}; +import{l as s,m as d,I as b,g as h,a as c,F as v,j as e}from"./index-9d63439d.js";import{a as I,R as x}from"./RoleDropdown-2d4e4388.js";import{f as _,a as y}from"./util-85d105b8.js";import"./DropdownMenu-421d3462.js";import"./setPrototypeOf-51e8cf87.js";import"./util-38d8e238.js";function D(){const n=s(d("courseId")),r=s(d("tool"));let o=s(b(n));const[m,u]=h(I(n));if(!o||Object.keys(o).length==0)return null;let f=o.roleLabel,a=o.color,i=o.image,g=o.label,t="course";i!="none"&&(t=_(i),i="url(./drive_pictures/"+i+")"),a!="none"&&(t=y(a),a="#"+a);let l="";return r=="navigation"?l="Course Navigation":r=="dashboard"?l="Dashboard":r=="data"&&(l="Data"),c(v,{children:[e("div",{style:{position:"relative",width:"100%",height:"165px",overflow:"hidden"},children:e("img",{"aria-label":t,style:{position:"absolute",width:"100%",height:"100%",backgroundSize:"cover",backgroundPosition:"center",backgroundImage:i,backgroundColor:a}})}),e("b",{children:l}),c("div",{style:{padding:"16px 12px"},children:[e("span",{style:{marginBottom:"15px"},children:g})," ",e("br",{}),e("span",{style:{marginBottom:"15px"},children:f})," ",e("br",{}),e(x,{label:"View as",onChange:({value:p})=>u(p),valueRoleId:m??o.roleId,vertical:!0})]})]})}export{D as default}; diff --git a/dist/assets/DropdownMenu-5673dfd7.js b/dist/assets/DropdownMenu-421d3462.js similarity index 99% rename from dist/assets/DropdownMenu-5673dfd7.js rename to dist/assets/DropdownMenu-421d3462.js index aa93f652fc..3170e93d04 100644 --- a/dist/assets/DropdownMenu-5673dfd7.js +++ b/dist/assets/DropdownMenu-421d3462.js @@ -1,4 +1,4 @@ -import{r as f,aH as Bt,aI as E,aE as C,au as kt,aJ as Je,s as Ze,a as Ht,j as Ie}from"./index-61b6fc23.js";import{a as $t,_ as _t}from"./setPrototypeOf-51e8cf87.js";function ne(n,e,r){return e in n?Object.defineProperty(n,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[e]=r,n}function Pe(n,e){var r=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})),r.push.apply(r,i)}return r}function S(n){for(var e=1;en.length)&&(e=n.length);for(var r=0,i=new Array(e);rn.length)&&(e=n.length);for(var r=0,i=new Array(e);r=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(r[i]=n[i])}return r}var jt=["defaultInputValue","defaultMenuIsOpen","defaultValue","inputValue","menuIsOpen","onChange","onInputChange","onMenuClose","onMenuOpen","value"];function Wt(n){var e=n.defaultInputValue,r=e===void 0?"":e,i=n.defaultMenuIsOpen,t=i===void 0?!1:i,a=n.defaultValue,s=a===void 0?null:a,u=n.inputValue,o=n.menuIsOpen,l=n.onChange,c=n.onInputChange,d=n.onMenuClose,p=n.onMenuOpen,g=n.value,m=Q(n,jt),b=f.useState(u!==void 0?u:r),v=W(b,2),h=v[0],D=v[1],y=f.useState(o!==void 0?o:t),F=W(y,2),A=F[0],O=F[1],V=f.useState(g!==void 0?g:s),x=W(V,2),I=x[0],B=x[1],H=f.useCallback(function(U,G){typeof l=="function"&&l(U,G),B(U)},[l]),R=f.useCallback(function(U,G){var Y;typeof c=="function"&&(Y=c(U,G)),D(Y!==void 0?Y:U)},[c]),$=f.useCallback(function(){typeof p=="function"&&p(),O(!0)},[p]),P=f.useCallback(function(){typeof d=="function"&&d(),O(!1)},[d]),w=u!==void 0?u:h,k=o!==void 0?o:A,_=g!==void 0?g:I;return S(S({},m),{},{inputValue:w,menuIsOpen:k,onChange:H,onInputChange:R,onMenuClose:P,onMenuOpen:$,value:_})}function Gt(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function we(n,e){for(var r=0;r"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ce(n){return ce=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ce(n)}function Kt(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function Jt(n,e){if(e&&(ce(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Kt(n)}function Zt(n){var e=Xt();return function(){var i=le(n),t;if(e){var a=le(this).constructor;t=Reflect.construct(i,arguments,a)}else t=i.apply(this,arguments);return Jt(this,t)}}function Qt(n){if(Array.isArray(n))return Fe(n)}function en(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function tn(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function et(n){return Qt(n)||en(n)||Qe(n)||tn()}function nn(n,e){return e||(e=n.slice(0)),Object.freeze(Object.defineProperties(n,{raw:{value:Object.freeze(e)}}))}function rn(n){return{...n,top:n.y,left:n.x,right:n.x+n.width,bottom:n.y+n.height}}const un=["top","right","bottom","left"];un.reduce((n,e)=>n.concat(e,e+"-start",e+"-end"),[]);function j(n){var e;return((e=n.ownerDocument)==null?void 0:e.defaultView)||window}function tt(n){return j(n).getComputedStyle(n)}function nt(n){return n instanceof j(n).Node}function rt(n){return nt(n)?(n.nodeName||"").toLowerCase():""}let ie;function an(){if(ie)return ie;const n=navigator.userAgentData;return n&&Array.isArray(n.brands)?(ie=n.brands.map(e=>e.brand+"/"+e.version).join(" "),ie):navigator.userAgent}function De(n){return n instanceof j(n).HTMLElement}function Z(n){return n instanceof j(n).Element}function Le(n){return typeof ShadowRoot>"u"?!1:n instanceof j(n).ShadowRoot||n instanceof ShadowRoot}function it(n){const{overflow:e,overflowX:r,overflowY:i,display:t}=tt(n);return/auto|scroll|overlay|hidden|clip/.test(e+i+r)&&!["inline","contents"].includes(t)}function on(){return/^((?!chrome|android).)*safari/i.test(an())}function sn(n){return["html","body","#document"].includes(rt(n))}const de=Math.round;function ln(n){const e=tt(n);let r=parseFloat(e.width),i=parseFloat(e.height);const t=De(n),a=t?n.offsetWidth:r,s=t?n.offsetHeight:i,u=de(r)!==a||de(i)!==s;return u&&(r=a,i=s),{width:r,height:i,fallback:u}}function ut(n){return Z(n)?n:n.contextElement}const at={x:1,y:1};function he(n){const e=ut(n);if(!De(e))return at;const r=e.getBoundingClientRect(),{width:i,height:t,fallback:a}=ln(e);let s=(a?de(r.width):r.width)/i,u=(a?de(r.height):r.height)/t;return s&&Number.isFinite(s)||(s=1),u&&Number.isFinite(u)||(u=1),{x:s,y:u}}function Re(n,e,r,i){var t,a;e===void 0&&(e=!1),r===void 0&&(r=!1);const s=n.getBoundingClientRect(),u=ut(n);let o=at;e&&(i?Z(i)&&(o=he(i)):o=he(n));const l=u?j(u):window,c=on()&&r;let d=(s.left+(c&&((t=l.visualViewport)==null?void 0:t.offsetLeft)||0))/o.x,p=(s.top+(c&&((a=l.visualViewport)==null?void 0:a.offsetTop)||0))/o.y,g=s.width/o.x,m=s.height/o.y;if(u){const b=j(u),v=i&&Z(i)?j(i):i;let h=b.frameElement;for(;h&&i&&v!==b;){const D=he(h),y=h.getBoundingClientRect(),F=getComputedStyle(h);y.x+=(h.clientLeft+parseFloat(F.paddingLeft))*D.x,y.y+=(h.clientTop+parseFloat(F.paddingTop))*D.y,d*=D.x,p*=D.y,g*=D.x,m*=D.y,d+=y.x,p+=y.y,h=j(h).frameElement}}return rn({width:g,height:m,x:d,y:p})}function cn(n){return((nt(n)?n.ownerDocument:n.document)||window.document).documentElement}function dn(n){if(rt(n)==="html")return n;const e=n.assignedSlot||n.parentNode||Le(n)&&n.host||cn(n);return Le(e)?e.host:e}function ot(n){const e=dn(n);return sn(e)?e.ownerDocument.body:De(e)&&it(e)?e:ot(e)}function se(n,e){var r;e===void 0&&(e=[]);const i=ot(n),t=i===((r=n.ownerDocument)==null?void 0:r.body),a=j(i);return t?e.concat(a,a.visualViewport||[],it(i)?i:[]):e.concat(i,se(i))}function fn(n,e,r,i){i===void 0&&(i={});const{ancestorScroll:t=!0,ancestorResize:a=!0,elementResize:s=!0,animationFrame:u=!1}=i,o=t&&!u,l=o||a?[...Z(n)?se(n):n.contextElement?se(n.contextElement):[],...se(e)]:[];l.forEach(g=>{o&&g.addEventListener("scroll",r,{passive:!0}),a&&g.addEventListener("resize",r)});let c,d=null;if(s){let g=!0;d=new ResizeObserver(()=>{g||r(),g=!1}),Z(n)&&!u&&d.observe(n),Z(n)||!n.contextElement||u||d.observe(n.contextElement),d.observe(e)}let p=u?Re(n):null;return u&&function g(){const m=Re(n);!p||m.x===p.x&&m.y===p.y&&m.width===p.width&&m.height===p.height||r(),p=m,c=requestAnimationFrame(g)}(),r(),()=>{var g;l.forEach(m=>{o&&m.removeEventListener("scroll",r),a&&m.removeEventListener("resize",r)}),(g=d)==null||g.disconnect(),d=null,u&&cancelAnimationFrame(c)}}var ye=f.useLayoutEffect,pn=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],fe=function(){};function vn(n,e){return e?e[0]==="-"?n+e:n+"__"+e:n}function mn(n,e){for(var r=arguments.length,i=new Array(r>2?r-2:0),t=2;t-1}function hn(n){return me(n)?window.innerHeight:n.clientHeight}function lt(n){return me(n)?window.pageYOffset:n.scrollTop}function pe(n,e){if(me(n)){window.scrollTo(0,e);return}n.scrollTop=e}function gn(n){var e=getComputedStyle(n),r=e.position==="absolute",i=/(auto|scroll)/;if(e.position==="fixed")return document.documentElement;for(var t=n;t=t.parentElement;)if(e=getComputedStyle(t),!(r&&e.position==="static")&&i.test(e.overflow+e.overflowY+e.overflowX))return t;return document.documentElement}function bn(n,e,r,i){return r*((n=n/i-1)*n*n+1)+e}function ue(n,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:200,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:fe,t=lt(n),a=e-t,s=10,u=0;function o(){u+=s;var l=bn(u,t,a,r);pe(n,l),ur.bottom?pe(n,Math.min(e.offsetTop+e.clientHeight-n.offsetHeight+t,n.scrollHeight)):i.top-t1?r-1:0),t=1;t=m)return{placement:"bottom",maxHeight:e};if(I>=m&&!s)return a&&ue(o,B,R),{placement:"bottom",maxHeight:e};if(!s&&I>=i||s&&V>=i){a&&ue(o,B,R);var $=s?V-F:I-F;return{placement:"bottom",maxHeight:$}}if(t==="auto"||s){var P=e,w=s?O:x;return w>=i&&(P=Math.min(w-F-u,e)),{placement:"top",maxHeight:P}}if(t==="bottom")return a&&pe(o,B),{placement:"bottom",maxHeight:e};break;case"top":if(O>=m)return{placement:"top",maxHeight:e};if(x>=m&&!s)return a&&ue(o,H,R),{placement:"top",maxHeight:e};if(!s&&x>=i||s&&O>=i){var k=e;return(!s&&x>=i||s&&O>=i)&&(k=s?O-A:x-A),a&&ue(o,H,R),{placement:"top",maxHeight:k}}return{placement:"bottom",maxHeight:e};default:throw new Error('Invalid placement provided "'.concat(t,'".'))}return l}function Vn(n){var e={bottom:"top",top:"bottom"};return n?e[n]:"bottom"}var dt=function(e){return e==="auto"?"bottom":e},An=function(e,r){var i,t=e.placement,a=e.theme,s=a.borderRadius,u=a.spacing,o=a.colors;return S((i={label:"menu"},ne(i,Vn(t),"100%"),ne(i,"position","absolute"),ne(i,"width","100%"),ne(i,"zIndex",1),i),r?{}:{backgroundColor:o.neutral0,borderRadius:s,boxShadow:"0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",marginBottom:u.menuGutter,marginTop:u.menuGutter})},ft=f.createContext(null),Mn=function(e){var r=e.children,i=e.minMenuHeight,t=e.maxMenuHeight,a=e.menuPlacement,s=e.menuPosition,u=e.menuShouldScrollIntoView,o=e.theme,l=f.useContext(ft)||{},c=l.setPortalPlacement,d=f.useRef(null),p=f.useState(t),g=W(p,2),m=g[0],b=g[1],v=f.useState(null),h=W(v,2),D=h[0],y=h[1],F=o.spacing.controlHeight;return ye(function(){var A=d.current;if(A){var O=s==="fixed",V=u&&!O,x=xn({maxHeight:t,menuEl:A,minHeight:i,placement:a,shouldScroll:V,isFixedPosition:O,controlHeight:F});b(x.maxHeight),y(x.placement),c==null||c(x.placement)}},[t,a,s,u,i,c,F]),r({ref:d,placerProps:S(S({},e),{},{placement:D||dt(a),maxHeight:m})})},In=function(e){var r=e.children,i=e.innerRef,t=e.innerProps;return E("div",C({},M(e,"menu",{menu:!0}),{ref:i},t),r)},Pn=function(e,r){var i=e.maxHeight,t=e.theme.spacing.baseUnit;return S({maxHeight:i,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},r?{}:{paddingBottom:t,paddingTop:t})},wn=function(e){var r=e.children,i=e.innerProps,t=e.innerRef,a=e.isMulti;return E("div",C({},M(e,"menuList",{"menu-list":!0,"menu-list--is-multi":a}),{ref:t},i),r)},pt=function(e,r){var i=e.theme,t=i.spacing.baseUnit,a=i.colors;return S({textAlign:"center"},r?{}:{color:a.neutral40,padding:"".concat(t*2,"px ").concat(t*3,"px")})},Ln=pt,Rn=pt,vt=function(e){var r=e.children,i=e.innerProps;return E("div",C({},M(e,"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),i),r)};vt.defaultProps={children:"No options"};var mt=function(e){var r=e.children,i=e.innerProps;return E("div",C({},M(e,"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),i),r)};mt.defaultProps={children:"Loading..."};var Tn=function(e){var r=e.rect,i=e.offset,t=e.position;return{left:r.left,position:t,top:i,width:r.width,zIndex:1}},Bn=function(e){var r=e.appendTo,i=e.children,t=e.controlElement,a=e.innerProps,s=e.menuPlacement,u=e.menuPosition,o=f.useRef(null),l=f.useRef(null),c=f.useState(dt(s)),d=W(c,2),p=d[0],g=d[1],m=f.useMemo(function(){return{setPortalPlacement:g}},[]),b=f.useState(null),v=W(b,2),h=v[0],D=v[1],y=f.useCallback(function(){if(t){var V=En(t),x=u==="fixed"?0:window.pageYOffset,I=V[p]+x;(I!==(h==null?void 0:h.offset)||V.left!==(h==null?void 0:h.rect.left)||V.width!==(h==null?void 0:h.rect.width))&&D({offset:I,rect:V})}},[t,u,p,h==null?void 0:h.offset,h==null?void 0:h.rect.left,h==null?void 0:h.rect.width]);ye(function(){y()},[y]);var F=f.useCallback(function(){typeof l.current=="function"&&(l.current(),l.current=null),t&&o.current&&(l.current=fn(t,o.current,y,{elementResize:"ResizeObserver"in window}))},[t,y]);ye(function(){F()},[F]);var A=f.useCallback(function(V){o.current=V,F()},[F]);if(!r&&u!=="fixed"||!h)return null;var O=E("div",C({ref:A},M(S(S({},e),{},{offset:h.offset,position:u,rect:h.rect}),"menuPortal",{"menu-portal":!0}),a),i);return E(ft.Provider,{value:m},r?kt.createPortal(O,r):O)},kn=function(e){var r=e.isDisabled,i=e.isRtl;return{label:"container",direction:i?"rtl":void 0,pointerEvents:r?"none":void 0,position:"relative"}},Hn=function(e){var r=e.children,i=e.innerProps,t=e.isDisabled,a=e.isRtl;return E("div",C({},M(e,"container",{"--is-disabled":t,"--is-rtl":a}),i),r)},$n=function(e,r){var i=e.theme.spacing,t=e.isMulti,a=e.hasValue,s=e.selectProps.controlShouldRenderValue;return S({alignItems:"center",display:t&&a&&s?"flex":"grid",flex:1,flexWrap:"wrap",WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"},r?{}:{padding:"".concat(i.baseUnit/2,"px ").concat(i.baseUnit*2,"px")})},_n=function(e){var r=e.children,i=e.innerProps,t=e.isMulti,a=e.hasValue;return E("div",C({},M(e,"valueContainer",{"value-container":!0,"value-container--is-multi":t,"value-container--has-value":a}),i),r)},Un=function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},Nn=function(e){var r=e.children,i=e.innerProps;return E("div",C({},M(e,"indicatorsContainer",{indicators:!0}),i),r)},He,zn=["size"],jn={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},ht=function(e){var r=e.size,i=Q(e,zn);return E("svg",C({height:r,width:r,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:jn},i))},xe=function(e){return E(ht,C({size:20},e),E("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"}))},gt=function(e){return E(ht,C({size:20},e),E("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},bt=function(e,r){var i=e.isFocused,t=e.theme,a=t.spacing.baseUnit,s=t.colors;return S({label:"indicatorContainer",display:"flex",transition:"color 150ms"},r?{}:{color:i?s.neutral60:s.neutral20,padding:a*2,":hover":{color:i?s.neutral80:s.neutral40}})},Wn=bt,Gn=function(e){var r=e.children,i=e.innerProps;return E("div",C({},M(e,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),i),r||E(gt,null))},Yn=bt,qn=function(e){var r=e.children,i=e.innerProps;return E("div",C({},M(e,"clearIndicator",{indicator:!0,"clear-indicator":!0}),i),r||E(xe,null))},Xn=function(e,r){var i=e.isDisabled,t=e.theme,a=t.spacing.baseUnit,s=t.colors;return S({label:"indicatorSeparator",alignSelf:"stretch",width:1},r?{}:{backgroundColor:i?s.neutral10:s.neutral20,marginBottom:a*2,marginTop:a*2})},Kn=function(e){var r=e.innerProps;return E("span",C({},r,M(e,"indicatorSeparator",{"indicator-separator":!0})))},Jn=Bt(He||(He=nn([` 0%, 80%, 100% { opacity: 0; } diff --git a/dist/assets/EditorBreadCrumb-a1000e9a.js b/dist/assets/EditorBreadCrumb-a1000e9a.js new file mode 100644 index 0000000000..c5d4ec21cd --- /dev/null +++ b/dist/assets/EditorBreadCrumb-a1000e9a.js @@ -0,0 +1 @@ +import{l as r,w as c,m as o,j as s,r as b}from"./index-9d63439d.js";import{B as p}from"./BreadCrumb-56e53fc8.js";import{u as C,a as l,b as f,e as I}from"./breadcrumbUtil-379dd524.js";import"./RoleDropdown-2d4e4388.js";import"./DropdownMenu-421d3462.js";import"./setPrototypeOf-51e8cf87.js";import"./Gradebook-8ee8571a.js";function P(){const a=r(c),e=r(o("doenetId")),t=r(o("pageId")),m=r(o("linkPageId")),d=C(),i=l(a),u=f(a,e),n=I({doenetId:e,pageId:t,linkPageId:m});return s(b.Suspense,{fallback:s("div",{children:"Loading Breadcrumb..."}),children:s(p,{crumbs:[d,i,...u,...n],offset:68})})}export{P as default}; diff --git a/dist/assets/EditorBreadCrumb-f495a97f.js b/dist/assets/EditorBreadCrumb-f495a97f.js deleted file mode 100644 index 9b9c5e799d..0000000000 --- a/dist/assets/EditorBreadCrumb-f495a97f.js +++ /dev/null @@ -1 +0,0 @@ -import{l as r,w as c,m as o,j as s,r as b}from"./index-61b6fc23.js";import{B as p}from"./BreadCrumb-593a3cf1.js";import{u as C,a as l,b as f,e as I}from"./breadcrumbUtil-59c43d86.js";import"./RoleDropdown-c9fff172.js";import"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";import"./Gradebook-bd1a82d1.js";function P(){const a=r(c),e=r(o("doenetId")),t=r(o("pageId")),m=r(o("linkPageId")),d=C(),i=l(a),u=f(a,e),n=I({doenetId:e,pageId:t,linkPageId:m});return s(b.Suspense,{fallback:s("div",{children:"Loading Breadcrumb..."}),children:s(p,{crumbs:[d,i,...u,...n],offset:68})})}export{P as default}; diff --git a/dist/assets/EditorInfoCap-cfe76eda.js b/dist/assets/EditorInfoCap-0e66e0c4.js similarity index 96% rename from dist/assets/EditorInfoCap-cfe76eda.js rename to dist/assets/EditorInfoCap-0e66e0c4.js index 5310a4a908..20eca7c778 100644 --- a/dist/assets/EditorInfoCap-cfe76eda.js +++ b/dist/assets/EditorInfoCap-0e66e0c4.js @@ -1 +1 @@ -import{l as n,w as v,m as s,a6 as y,G as m,a,F as l,j as i}from"./index-61b6fc23.js";import{f as u,a as b}from"./util-85d105b8.js";import"./util-38d8e238.js";function _(){const c=n(v),g=n(s("doenetId")),x=n(s("pageId"));let{color:t,image:e,label:h}=y(c);const r=n(m(x)),o=n(m(g));let d="course";if(!r||!e)return null;e!="none"&&(d=u(e),e="url(./drive_pictures/"+e+")"),t!="none"&&(d=b(t),t="#"+t);let p=a(l,{children:[i("div",{style:{marginBottom:"1px",marginTop:"5px"},children:"Activity"}),i("div",{style:{marginBottom:"5px",padding:"1px 5px"},children:o.label}),i("div",{style:{marginBottom:"1px",marginTop:"5px"},children:"Page"}),i("div",{style:{marginBottom:"5px",padding:"1px 5px"},children:r.label})]});return o.isSinglePage&&(p=a(l,{children:[i("div",{style:{marginBottom:"1px",marginTop:"5px"},children:"Activity"}),i("div",{style:{marginBottom:"5px",padding:"1px 5px"},children:o.label})]})),o.type=="bank"&&(p=a(l,{children:[i("div",{style:{marginBottom:"1px",marginTop:"5px"},children:"Collection"}),i("div",{style:{marginBottom:"5px",padding:"1px 5px"},children:o.label}),i("div",{style:{marginBottom:"1px",marginTop:"5px"},children:"Page"}),i("div",{style:{marginBottom:"5px",padding:"1px 5px"},children:r.label})]})),a(l,{children:[i("div",{style:{position:"relative",width:"100%",height:"165px",overflow:"hidden"},children:i("img",{"aria-label":d,style:{position:"absolute",width:"100%",height:"100%",backgroundSize:"cover",backgroundPosition:"center",backgroundImage:e,backgroundColor:t}})}),i("b",{children:"Editor"}),i("div",{style:{marginBottom:"1px",marginTop:"5px"},children:"Course"}),i("div",{style:{marginBottom:"5px",padding:"1px 5px"},children:h}),p]})}export{_ as default}; +import{l as n,w as v,m as s,a6 as y,G as m,a,F as l,j as i}from"./index-9d63439d.js";import{f as u,a as b}from"./util-85d105b8.js";import"./util-38d8e238.js";function _(){const c=n(v),g=n(s("doenetId")),x=n(s("pageId"));let{color:t,image:e,label:h}=y(c);const r=n(m(x)),o=n(m(g));let d="course";if(!r||!e)return null;e!="none"&&(d=u(e),e="url(./drive_pictures/"+e+")"),t!="none"&&(d=b(t),t="#"+t);let p=a(l,{children:[i("div",{style:{marginBottom:"1px",marginTop:"5px"},children:"Activity"}),i("div",{style:{marginBottom:"5px",padding:"1px 5px"},children:o.label}),i("div",{style:{marginBottom:"1px",marginTop:"5px"},children:"Page"}),i("div",{style:{marginBottom:"5px",padding:"1px 5px"},children:r.label})]});return o.isSinglePage&&(p=a(l,{children:[i("div",{style:{marginBottom:"1px",marginTop:"5px"},children:"Activity"}),i("div",{style:{marginBottom:"5px",padding:"1px 5px"},children:o.label})]})),o.type=="bank"&&(p=a(l,{children:[i("div",{style:{marginBottom:"1px",marginTop:"5px"},children:"Collection"}),i("div",{style:{marginBottom:"5px",padding:"1px 5px"},children:o.label}),i("div",{style:{marginBottom:"1px",marginTop:"5px"},children:"Page"}),i("div",{style:{marginBottom:"5px",padding:"1px 5px"},children:r.label})]})),a(l,{children:[i("div",{style:{position:"relative",width:"100%",height:"165px",overflow:"hidden"},children:i("img",{"aria-label":d,style:{position:"absolute",width:"100%",height:"100%",backgroundSize:"cover",backgroundPosition:"center",backgroundImage:e,backgroundColor:t}})}),i("b",{children:"Editor"}),i("div",{style:{marginBottom:"1px",marginTop:"5px"},children:"Course"}),i("div",{style:{marginBottom:"5px",padding:"1px 5px"},children:h}),p]})}export{_ as default}; diff --git a/dist/assets/EditorViewer-e9155b9a.js b/dist/assets/EditorViewer-34bd5cb9.js similarity index 95% rename from dist/assets/EditorViewer-e9155b9a.js rename to dist/assets/EditorViewer-34bd5cb9.js index 043ac0a2b6..f18cbe3dc5 100644 --- a/dist/assets/EditorViewer-e9155b9a.js +++ b/dist/assets/EditorViewer-34bd5cb9.js @@ -1 +1 @@ -import{r as i,a4 as ne,l,m as k,g as D,w as oe,h as se,R as w,f as ae,G as b,E as re,c as ie,ab as le,u as ue,Q as ce,S as de,v as F,k as fe,j as O,P as me}from"./index-61b6fc23.js";import{v as _,e as x,r as N,a as $,u as pe,t as B}from"./EditorViewerRecoil-fde09b36.js";function ge(t,s,n=window){const a=i.useRef(s);i.useEffect(()=>{a.current=s},[s]),i.useEffect(()=>{if(n==null)return;const c=p=>a.current(p);return n.addEventListener(t,c),()=>n.removeEventListener(t,c)},[t,n])}const K=()=>F(({snapshot:s,set:n})=>async()=>{const a=await s.getPromise(B),c=await s.getPromise($);n(_,a),c&&n(N,p=>p+1)});function Ie(){let t=ne();const s=t==null?void 0:t.courseId,n=t==null?void 0:t.doenetId,a=t==null?void 0:t.pageDoenetId,c=l(_),p=l(k("pageId")),P=l(k("linkPageId")),y=l(k("doenetId"));let u=p,v=y;P&&(u=P,v=P),n&&(u=a,v=n);const[A,M]=D(oe),U=l(x),[z,G]=D(se),J=w(ae),V=w(x),q=l(N),H=w($),[h,Q]=D(b(u)),d=l(b(y)),C=w(re),{canUpload:T}=l(ie),W=K(),X=w(le);let o=ue();const g=i.useRef({}),E=i.useRef(null);ce(v),de(A);let L=!1,I=null;Object.keys(h).length>0&&(L=!0,d!=null&&d.isSinglePage&&!P?I=d==null?void 0:d.label:I=h.label),i.useEffect(()=>{const e=document.title;return I&&(document.title=`${I} - Doenet`),()=>{document.title=e}},[I]);let R=F(({snapshot:e,set:r})=>async f=>{let{data:S}=await fe.get(`/media/byPageId/${f}.doenet`);S=S.toString();let j=await e.getPromise(b(f)),te=await e.getPromise(b(j.containingDoenetId));r(pe,S),r(B,S),r(_,S),r(x,f);let m=[];te.type=="bank"&&m.push("AssignmentSettingsMenu"),j.type=="pageLink"&&(m.push("AssignmentSettingsMenu"),m.push("PageLink"),m.push("SupportingFilesMenu")),T!=="1"&&m.push("SupportingFilesMenu"),C(m)},[C]);if(i.useEffect(()=>(u!==""&&L?R(u):a&&(M(s),Q({containingDoenetId:n,doenetId:a,isSelected:!1,label:"Untitled",parentDoenetId:n,type:"page"})),()=>{V("")}),[s,M,R,V,a,u,L]),ge("keydown",e=>{(e.keyCode===83&&e.metaKey||e.keyCode===83&&e.ctrlKey)&&(e.preventDefault(),W())}),i.useEffect(()=>{var e,r;E.current!==o.key&&(((e=o.state)==null?void 0:e.previousScrollPosition)!==void 0&&E.current&&(g.current[E.current].lastScrollPosition=o.state.previousScrollPosition),g.current[o.key]&&((r=g.current[o.key])==null?void 0:r.lastScrollPosition)!==void 0&&document.getElementById("mainPanel").scroll({top:g.current[o.key].lastScrollPosition}),g.current[o.key]={...o},E.current=o.key)},[o]),i.useEffect(()=>{const e=document.getElementById("mainPanel");X(e)},[]),A==="__not_found__")return O("h1",{children:"Content not found or no permission to view content"});if(u!==U)return null;let Y=1,Z="button";function ee(e,r){const f=JSON.parse(JSON.stringify(e));J({index:f.index,allPossibleVariants:r}),G({index:f.index})}return O(me,{doenetML:c,flags:{showCorrectness:!0,solutionDisplayMode:Z,showFeedback:!0,showHints:!0,autoSubmit:!1,allowLoadState:!1,allowSaveState:!1,allowLocalState:!1,allowSaveSubmissions:!1,allowSaveEvents:!1},doenetId:y,attemptNumber:Y,generatedVariantCallback:ee,requestedVariantIndex:z.index,setIsInErrorState:H,pageIsActive:!0},`pageViewer${q}`)}const Pe=Object.freeze(Object.defineProperty({__proto__:null,default:Ie,useUpdateViewer:K},Symbol.toStringTag,{value:"Module"}));export{Pe as E,ge as a,K as u}; +import{r as i,a4 as ne,l,m as k,g as D,w as oe,h as se,R as w,f as ae,G as b,E as re,c as ie,ab as le,u as ue,Q as ce,S as de,v as F,k as fe,j as O,P as me}from"./index-9d63439d.js";import{v as _,e as x,r as N,a as $,u as pe,t as B}from"./EditorViewerRecoil-4f9a7d1d.js";function ge(t,s,n=window){const a=i.useRef(s);i.useEffect(()=>{a.current=s},[s]),i.useEffect(()=>{if(n==null)return;const c=p=>a.current(p);return n.addEventListener(t,c),()=>n.removeEventListener(t,c)},[t,n])}const K=()=>F(({snapshot:s,set:n})=>async()=>{const a=await s.getPromise(B),c=await s.getPromise($);n(_,a),c&&n(N,p=>p+1)});function Ie(){let t=ne();const s=t==null?void 0:t.courseId,n=t==null?void 0:t.doenetId,a=t==null?void 0:t.pageDoenetId,c=l(_),p=l(k("pageId")),P=l(k("linkPageId")),y=l(k("doenetId"));let u=p,v=y;P&&(u=P,v=P),n&&(u=a,v=n);const[A,M]=D(oe),U=l(x),[z,G]=D(se),J=w(ae),V=w(x),q=l(N),H=w($),[h,Q]=D(b(u)),d=l(b(y)),C=w(re),{canUpload:T}=l(ie),W=K(),X=w(le);let o=ue();const g=i.useRef({}),E=i.useRef(null);ce(v),de(A);let L=!1,I=null;Object.keys(h).length>0&&(L=!0,d!=null&&d.isSinglePage&&!P?I=d==null?void 0:d.label:I=h.label),i.useEffect(()=>{const e=document.title;return I&&(document.title=`${I} - Doenet`),()=>{document.title=e}},[I]);let R=F(({snapshot:e,set:r})=>async f=>{let{data:S}=await fe.get(`/media/byPageId/${f}.doenet`);S=S.toString();let j=await e.getPromise(b(f)),te=await e.getPromise(b(j.containingDoenetId));r(pe,S),r(B,S),r(_,S),r(x,f);let m=[];te.type=="bank"&&m.push("AssignmentSettingsMenu"),j.type=="pageLink"&&(m.push("AssignmentSettingsMenu"),m.push("PageLink"),m.push("SupportingFilesMenu")),T!=="1"&&m.push("SupportingFilesMenu"),C(m)},[C]);if(i.useEffect(()=>(u!==""&&L?R(u):a&&(M(s),Q({containingDoenetId:n,doenetId:a,isSelected:!1,label:"Untitled",parentDoenetId:n,type:"page"})),()=>{V("")}),[s,M,R,V,a,u,L]),ge("keydown",e=>{(e.keyCode===83&&e.metaKey||e.keyCode===83&&e.ctrlKey)&&(e.preventDefault(),W())}),i.useEffect(()=>{var e,r;E.current!==o.key&&(((e=o.state)==null?void 0:e.previousScrollPosition)!==void 0&&E.current&&(g.current[E.current].lastScrollPosition=o.state.previousScrollPosition),g.current[o.key]&&((r=g.current[o.key])==null?void 0:r.lastScrollPosition)!==void 0&&document.getElementById("mainPanel").scroll({top:g.current[o.key].lastScrollPosition}),g.current[o.key]={...o},E.current=o.key)},[o]),i.useEffect(()=>{const e=document.getElementById("mainPanel");X(e)},[]),A==="__not_found__")return O("h1",{children:"Content not found or no permission to view content"});if(u!==U)return null;let Y=1,Z="button";function ee(e,r){const f=JSON.parse(JSON.stringify(e));J({index:f.index,allPossibleVariants:r}),G({index:f.index})}return O(me,{doenetML:c,flags:{showCorrectness:!0,solutionDisplayMode:Z,showFeedback:!0,showHints:!0,autoSubmit:!1,allowLoadState:!1,allowSaveState:!1,allowLocalState:!1,allowSaveSubmissions:!1,allowSaveEvents:!1},doenetId:y,attemptNumber:Y,generatedVariantCallback:ee,requestedVariantIndex:z.index,setIsInErrorState:H,pageIsActive:!0},`pageViewer${q}`)}const Pe=Object.freeze(Object.defineProperty({__proto__:null,default:Ie,useUpdateViewer:K},Symbol.toStringTag,{value:"Module"}));export{Pe as E,ge as a,K as u}; diff --git a/dist/assets/EditorViewerRecoil-fde09b36.js b/dist/assets/EditorViewerRecoil-4f9a7d1d.js similarity index 83% rename from dist/assets/EditorViewerRecoil-fde09b36.js rename to dist/assets/EditorViewerRecoil-4f9a7d1d.js index 0447025f9b..a8c788ed34 100644 --- a/dist/assets/EditorViewerRecoil-fde09b36.js +++ b/dist/assets/EditorViewerRecoil-4f9a7d1d.js @@ -1 +1 @@ -import{ag as e}from"./index-61b6fc23.js";const o=e({key:"viewerDoenetMLAtom",default:""}),r=e({key:"textEditorDoenetMLAtom",default:""}),a=e({key:"updateTextEditorDoenetMLAtom",default:""}),d=e({key:"editorPageIdInitAtom",default:""}),i=e({key:"refreshNumberAtom",default:0}),m=e({key:"editorViewerErrorStateAtom",default:!1});export{m as a,d as e,i as r,r as t,a as u,o as v}; +import{ag as e}from"./index-9d63439d.js";const o=e({key:"viewerDoenetMLAtom",default:""}),r=e({key:"textEditorDoenetMLAtom",default:""}),a=e({key:"updateTextEditorDoenetMLAtom",default:""}),d=e({key:"editorPageIdInitAtom",default:""}),i=e({key:"refreshNumberAtom",default:0}),m=e({key:"editorViewerErrorStateAtom",default:!1});export{m as a,d as e,i as r,r as t,a as u,o as v}; diff --git a/dist/assets/Empty-c2716eb1.js b/dist/assets/Empty-c2716eb1.js deleted file mode 100644 index 4746f3f58f..0000000000 --- a/dist/assets/Empty-c2716eb1.js +++ /dev/null @@ -1 +0,0 @@ -import{j as e}from"./index-61b6fc23.js";function s(t){return e("div",{style:t.style})}export{s as default}; diff --git a/dist/assets/Empty-f2fdb837.js b/dist/assets/Empty-f2fdb837.js new file mode 100644 index 0000000000..fd83793b8d --- /dev/null +++ b/dist/assets/Empty-f2fdb837.js @@ -0,0 +1 @@ +import{j as e}from"./index-9d63439d.js";function s(t){return e("div",{style:t.style})}export{s as default}; diff --git a/dist/assets/EndExamPanel-3c93a6d3.js b/dist/assets/EndExamPanel-f757516f.js similarity index 98% rename from dist/assets/EndExamPanel-3c93a6d3.js rename to dist/assets/EndExamPanel-f757516f.js index 981c00ae41..3602da0049 100644 --- a/dist/assets/EndExamPanel-3c93a6d3.js +++ b/dist/assets/EndExamPanel-f757516f.js @@ -1,4 +1,4 @@ -import{l as c,m,r as y,k as b,a as e,j as t,s as p}from"./index-61b6fc23.js";const I=p.div` +import{l as c,m,r as y,k as b,a as e,j as t,s as p}from"./index-9d63439d.js";const I=p.div` border-bottom: 2px solid var(--canvastext); height: 2px; width: 230px; diff --git a/dist/assets/EndPlacementExamPanel-cf6a1a3f.js b/dist/assets/EndPlacementExamPanel-c8e29e90.js similarity index 90% rename from dist/assets/EndPlacementExamPanel-cf6a1a3f.js rename to dist/assets/EndPlacementExamPanel-c8e29e90.js index a35256df77..da1964c0ad 100644 --- a/dist/assets/EndPlacementExamPanel-cf6a1a3f.js +++ b/dist/assets/EndPlacementExamPanel-c8e29e90.js @@ -1 +1 @@ -import{a as t,j as e}from"./index-61b6fc23.js";function a(){return t("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",justifyContent:"center",alignItems:"center",margin:"20"},children:[e("div",{style:{display:"flex",alignItems:"center"},children:e("h1",{children:"Exam is finished"})}),e("div",{style:{alignItems:"center",maxWidth:"400px"},children:e("p",{children:"You have completed the MathPlacementExam. It may take 24 hours for your results to show on the New Student Orientation Checklist. Further information about the math placement process can be found on the New Student Orientation Checklist."})})]})}export{a as default}; +import{a as t,j as e}from"./index-9d63439d.js";function a(){return t("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",justifyContent:"center",alignItems:"center",margin:"20"},children:[e("div",{style:{display:"flex",alignItems:"center"},children:e("h1",{children:"Exam is finished"})}),e("div",{style:{alignItems:"center",maxWidth:"400px"},children:e("p",{children:"You have completed the MathPlacementExam. It may take 24 hours for your results to show on the New Student Orientation Checklist. Further information about the math placement process can be found on the New Student Orientation Checklist."})})]})}export{a as default}; diff --git a/dist/assets/EnrollStudents-17ca2355.js b/dist/assets/EnrollStudents-daea38ea.js similarity index 64% rename from dist/assets/EnrollStudents-17ca2355.js rename to dist/assets/EnrollStudents-daea38ea.js index b0dfd9f76a..c859933f14 100644 --- a/dist/assets/EnrollStudents-17ca2355.js +++ b/dist/assets/EnrollStudents-daea38ea.js @@ -1 +1 @@ -import{R as a,p as r,l,m as s,j as o,B as i}from"./index-61b6fc23.js";import{B as n}from"./ButtonGroup-6d856500.js";function p(){const e=a(r),t=l(s("courseId"));return o(n,{vertical:!0,children:o(i,{width:"menu",onClick:()=>e({page:"course",tool:"people",view:"",params:{courseId:t}}),value:"Go to People",children:"Go to People"})})}export{p as default}; +import{R as a,p as r,l,m as s,j as o,B as i}from"./index-9d63439d.js";import{B as n}from"./ButtonGroup-ec02b3e9.js";function p(){const e=a(r),t=l(s("courseId"));return o(n,{vertical:!0,children:o(i,{width:"menu",onClick:()=>e({page:"course",tool:"people",view:"",params:{courseId:t}}),value:"Go to People",children:"Go to People"})})}export{p as default}; diff --git a/dist/assets/GradeDownload-dc857bc9.js b/dist/assets/GradeDownload-e5fe741a.js similarity index 91% rename from dist/assets/GradeDownload-dc857bc9.js rename to dist/assets/GradeDownload-e5fe741a.js index 53858a5df5..c75e54a15e 100644 --- a/dist/assets/GradeDownload-dc857bc9.js +++ b/dist/assets/GradeDownload-e5fe741a.js @@ -1,3 +1,3 @@ -import{l as k,m as E,v as F,I as G,a5 as L,aF as M,j as N,B as U}from"./index-61b6fc23.js";import{assignmentData as W,overviewData as X,gradeCategories as q}from"./Gradebook-bd1a82d1.js";import"./RoleDropdown-c9fff172.js";import"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";function Y(){const R=k(E("courseId")),D=F(({snapshot:d})=>async g=>{var h,x,S,A,T,B;const{label:O}=await d.getPromise(G(g));let V=`${O}.csv`,f,l=await d.getPromise(W),_=await d.getPromise(X);const{value:j}=await d.getPromise(L(g));let t={},I="Name,Email,External Id,Section,Withdrew,",a="Possible Points,,,,,";for(const{userId:o,email:i,roleId:v,withdrew:P,externalId:m,section:w,firstName:b,lastName:e}of j){const{isIncludedInGradebook:s}=await d.getPromise(M({courseId:g,roleId:v}));if(s!=="1")continue;const $=`${b} ${e}`.replaceAll('"','""');t[o]={courseTotal:0,csv:`"${$}",${i},${m},${w},${P==="1"?"X":""},`}}let y=0,C=Object.entries(l);C.sort((o,i)=>o[1].sortOrders-e).slice(0,v);let w=m.reduce((e,s)=>e+s,0)*i,b=Math.min(w,P);y+=b,I+=`${o} Total,`,a=`${a}${b},`;for(const e in t){let s=t[e][o];s=s.sort((r,c)=>c-r).slice(0,v);let $=s.reduce((r,c)=>r+c,0)*i,n=Math.min($,P);t[e].csv=`${t[e].csv}${n},`,t[e].courseTotal+=n}}I+="Course Total",a=`${a}${y}`,f=`${I} +import{l as k,m as E,v as F,I as G,a5 as L,aF as M,j as N,B as U}from"./index-9d63439d.js";import{assignmentData as W,overviewData as X,gradeCategories as q}from"./Gradebook-8ee8571a.js";import"./RoleDropdown-2d4e4388.js";import"./DropdownMenu-421d3462.js";import"./setPrototypeOf-51e8cf87.js";function Y(){const R=k(E("courseId")),D=F(({snapshot:d})=>async g=>{var h,x,S,A,T,B;const{label:O}=await d.getPromise(G(g));let V=`${O}.csv`,f,l=await d.getPromise(W),_=await d.getPromise(X);const{value:j}=await d.getPromise(L(g));let t={},I="Name,Email,External Id,Section,Withdrew,",a="Possible Points,,,,,";for(const{userId:o,email:i,roleId:v,withdrew:P,externalId:m,section:w,firstName:b,lastName:e}of j){const{isIncludedInGradebook:s}=await d.getPromise(M({courseId:g,roleId:v}));if(s!=="1")continue;const $=`${b} ${e}`.replaceAll('"','""');t[o]={courseTotal:0,csv:`"${$}",${i},${m},${w},${P==="1"?"X":""},`}}let y=0,C=Object.entries(l);C.sort((o,i)=>o[1].sortOrders-e).slice(0,v);let w=m.reduce((e,s)=>e+s,0)*i,b=Math.min(w,P);y+=b,I+=`${o} Total,`,a=`${a}${b},`;for(const e in t){let s=t[e][o];s=s.sort((r,c)=>c-r).slice(0,v);let $=s.reduce((r,c)=>r+c,0)*i,n=Math.min($,P);t[e].csv=`${t[e].csv}${n},`,t[e].courseTotal+=n}}I+="Course Total",a=`${a}${y}`,f=`${I} ${a}`;for(const o in t)f=`${f} ${t[o].csv}${t[o].courseTotal}`;var u=document.createElement("a");u.setAttribute("href","data:text/plain;charset=utf-8, "+encodeURIComponent(f)),u.setAttribute("download",V),document.body.appendChild(u),u.click(),document.body.removeChild(u)},[]);return N("div",{children:N(U,{value:"Download CSV",onClick:()=>{D(R)}})})}export{Y as default}; diff --git a/dist/assets/GradeSettings-5114f8c7.js b/dist/assets/GradeSettings-8ae63bf8.js similarity index 93% rename from dist/assets/GradeSettings-5114f8c7.js rename to dist/assets/GradeSettings-8ae63bf8.js index 72158b7711..a139c70498 100644 --- a/dist/assets/GradeSettings-5114f8c7.js +++ b/dist/assets/GradeSettings-8ae63bf8.js @@ -1,4 +1,4 @@ -import{s as G,bd as N,be as z,r as c,j as l,i as J,l as b,m as O,y as P,a as f,k as v,bf as w,N as T,z as D,F as g,b0 as S,aA as X}from"./index-61b6fc23.js";import{D as Z}from"./DateTime-3ab576fc.js";import{I as _}from"./IncrementMenu-5203e1b9.js";import"./moment-b216ba57.js";const M="var(--mainBlue)",W=G.button` +import{s as G,bd as N,be as z,r as c,j as l,i as J,l as b,m as O,y as P,a as f,k as v,bf as w,N as T,z as D,F as g,b0 as S,aA as X}from"./index-9d63439d.js";import{D as Z}from"./DateTime-b5df08e4.js";import{I as _}from"./IncrementMenu-999b207e.js";import"./moment-a2107d39.js";const M="var(--mainBlue)",W=G.button` height: 24px; border: 2px solid; border-color: ${s=>s.color}; diff --git a/dist/assets/GradeUpload-0a2ff6c2.js b/dist/assets/GradeUpload-eeb366c7.js similarity index 76% rename from dist/assets/GradeUpload-0a2ff6c2.js rename to dist/assets/GradeUpload-eeb366c7.js index 3cfc3d35c9..d46f148345 100644 --- a/dist/assets/GradeUpload-0a2ff6c2.js +++ b/dist/assets/GradeUpload-eeb366c7.js @@ -1 +1 @@ -import{R as i,r as h,b1 as u,a as r,j as e,B as f}from"./index-61b6fc23.js";import{p as g}from"./index-e425ea7e.js";import{processGradesAtom as b,headersGradesAtom as v,entriesGradesAtom as w}from"./GradebookAssignment-b8c6c0f7.js";import{B as x}from"./ButtonGroup-6d856500.js";import{C as A}from"./CollapseSection-2629b821.js";import"./Gradebook-bd1a82d1.js";import"./RoleDropdown-c9fff172.js";import"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";function P(){const t=i(b),n=i(v),a=i(w),c=h.useCallback(m=>{const o=new FileReader;o.onabort=()=>{},o.onerror=()=>{},o.onload=()=>{g(o.result,{comment:"#"},function(C,s){n(s[0]),s.shift(),a(s),t("Upload Choice Table")})},o.readAsText(m[0])},[a,n,t]),{getRootProps:p,getInputProps:d,isDragActive:l}=u({onDrop:c});return l&&t("Assignment Table"),r("div",{children:[r("div",{...p(),children:[e("input",{...d()}),l?e("p",{children:"Drop the files here"}):e(x,{vertical:!0,children:e(f,{width:"menu",value:"Import CSV file",onClick:()=>t("Assignment Table")})})]},"drop"),e("br",{}),r(A,{title:"Formatting Instructions",collapsed:!0,children:[e("p",{children:"Your file needs to contain a Email column. The parser will ignore columns where the points do not match the points possible. e.g. if a assignment has 30 points possible you can only select from columns with 30 points in their second row. This is done to match canvas export formatting."}),e("div",{children:e("b",{children:"Email (required)"})}),r("div",{children:["First column is ",e("strong",{children:"Name"})]}),r("div",{children:["Second row is ",e("strong",{children:"points possible"})]})]})]})}export{P as default}; +import{R as i,r as h,b1 as u,a as r,j as e,B as f}from"./index-9d63439d.js";import{p as g}from"./index-0a95af27.js";import{processGradesAtom as b,headersGradesAtom as v,entriesGradesAtom as w}from"./GradebookAssignment-ebb55feb.js";import{B as x}from"./ButtonGroup-ec02b3e9.js";import{C as A}from"./CollapseSection-3723ca05.js";import"./Gradebook-8ee8571a.js";import"./RoleDropdown-2d4e4388.js";import"./DropdownMenu-421d3462.js";import"./setPrototypeOf-51e8cf87.js";function P(){const t=i(b),n=i(v),a=i(w),c=h.useCallback(m=>{const o=new FileReader;o.onabort=()=>{},o.onerror=()=>{},o.onload=()=>{g(o.result,{comment:"#"},function(C,s){n(s[0]),s.shift(),a(s),t("Upload Choice Table")})},o.readAsText(m[0])},[a,n,t]),{getRootProps:p,getInputProps:d,isDragActive:l}=u({onDrop:c});return l&&t("Assignment Table"),r("div",{children:[r("div",{...p(),children:[e("input",{...d()}),l?e("p",{children:"Drop the files here"}):e(x,{vertical:!0,children:e(f,{width:"menu",value:"Import CSV file",onClick:()=>t("Assignment Table")})})]},"drop"),e("br",{}),r(A,{title:"Formatting Instructions",collapsed:!0,children:[e("p",{children:"Your file needs to contain a Email column. The parser will ignore columns where the points do not match the points possible. e.g. if a assignment has 30 points possible you can only select from columns with 30 points in their second row. This is done to match canvas export formatting."}),e("div",{children:e("b",{children:"Email (required)"})}),r("div",{children:["First column is ",e("strong",{children:"Name"})]}),r("div",{children:["Second row is ",e("strong",{children:"points possible"})]})]})]})}export{P as default}; diff --git a/dist/assets/Gradebook-bd1a82d1.js b/dist/assets/Gradebook-8ee8571a.js similarity index 99% rename from dist/assets/Gradebook-bd1a82d1.js rename to dist/assets/Gradebook-8ee8571a.js index 361ee77d6a..f5fc5b6048 100644 --- a/dist/assets/Gradebook-bd1a82d1.js +++ b/dist/assets/Gradebook-8ee8571a.js @@ -1,4 +1,4 @@ -import{r as Zt,aa as Or,s as zr,ag as et,ax as Se,m as Ee,k as Ce,ay as tt,az as Fe,j as X,av as Kt,a as Be,i as Je,aM as Dr,aN as Mr,aO as Nr,l as Ye,R as Ut,p as jr,b as Ze,E as Lr,I as _r}from"./index-61b6fc23.js";import{e as Vr}from"./RoleDropdown-c9fff172.js";import"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";var be={},Qr={get exports(){return be},set exports(E){be=E}},De={},Xr={get exports(){return De},set exports(E){De=E}};(function(E,H){(function(m,p){p(H,Zt)})(Or,function(m,p){function D(e,t,n,r,i,o,u){try{var a=e[o](u),l=a.value}catch(d){return void n(d)}a.done?t(l):Promise.resolve(l).then(r,i)}function M(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function u(l){D(o,r,i,u,a,"next",l)}function a(l){D(o,r,i,u,a,"throw",l)}u(void 0)})}}function c(){return(c=Object.assign||function(e){for(var t=1;t=0||(i[n]=e[n]);return i}function U(e){var t=function(n,r){if(typeof n!="object"||n===null)return n;var i=n[Symbol.toPrimitive];if(i!==void 0){var o=i.call(n,r||"default");if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(n)}(e,"string");return typeof t=="symbol"?t:String(t)}p=p&&Object.prototype.hasOwnProperty.call(p,"default")?p.default:p;var s={init:"init"},J=function(e){var t=e.value;return t===void 0?"":t},Y=function(){return p.createElement(p.Fragment,null," ")},q={Cell:J,width:150,minWidth:0,maxWidth:Number.MAX_SAFE_INTEGER};function ce(){for(var e=arguments.length,t=new Array(e),n=0;n(o=typeof o=="number"?o:1/0)){var u=i;i=o,o=u}return e.filter(function(a){return t.some(function(l){var d=a.values[l];return d>=i&&d<=o})})};wt.autoRemove=function(e){return!e||typeof e[0]!="number"&&typeof e[1]!="number"};var Pe=Object.freeze({__proto__:null,text:ct,exactText:dt,exactTextCase:ft,includes:pt,includesAll:gt,includesSome:mt,includesValue:vt,exact:ht,equals:yt,between:wt});s.resetFilters="resetFilters",s.setFilter="setFilter",s.setAllFilters="setAllFilters";var Rt=function(e){e.stateReducers.push(Gn),e.useInstance.push(kn)};function Gn(e,t,n,r){if(t.type===s.init)return c({filters:[]},e);if(t.type===s.resetFilters)return c({},e,{filters:r.initialState.filters||[]});if(t.type===s.setFilter){var i=t.columnId,o=t.filterValue,u=r.allColumns,a=r.filterTypes,l=u.find(function(R){return R.id===i});if(!l)throw new Error("React-Table: Could not find a column with id: "+i);var d=xe(l.filter,a||{},Pe),y=e.filters.find(function(R){return R.id===i}),g=le(o,y&&y.value);return Ne(d.autoRemove,g,l)?c({},e,{filters:e.filters.filter(function(R){return R.id!==i})}):c({},e,y?{filters:e.filters.map(function(R){return R.id===i?{id:i,value:g}:R})}:{filters:[].concat(e.filters,[{id:i,value:g}])})}if(t.type===s.setAllFilters){var v=t.filters,f=r.allColumns,h=r.filterTypes;return c({},e,{filters:le(v,e.filters).filter(function(R){var b=f.find(function(x){return x.id===R.id});return!Ne(xe(b.filter,h||{},Pe).autoRemove,R.value,b)})})}}function kn(e){var t=e.data,n=e.rows,r=e.flatRows,i=e.rowsById,o=e.allColumns,u=e.filterTypes,a=e.manualFilters,l=e.defaultCanFilter,d=l!==void 0&&l,y=e.disableFilters,g=e.state.filters,v=e.dispatch,f=e.autoResetFilters,h=f===void 0||f,R=p.useCallback(function(S,G){v({type:s.setFilter,columnId:S,filterValue:G})},[v]),b=p.useCallback(function(S){v({type:s.setAllFilters,filters:S})},[v]);o.forEach(function(S){var G=S.id,W=S.accessor,I=S.defaultCanFilter,F=S.disableFilters;S.canFilter=W?he(F!==!0&&void 0,y!==!0&&void 0,!0):he(I,d,!1),S.setFilter=function(k){return R(S.id,k)};var j=g.find(function(k){return k.id===G});S.filterValue=j&&j.value});var x=p.useMemo(function(){if(a||!g.length)return[n,r,i];var S=[],G={};return[function W(I,F){F===void 0&&(F=0);var j=I;return(j=g.reduce(function(k,N){var z=N.id,V=N.value,P=o.find(function(K){return K.id===z});if(!P)return k;F===0&&(P.preFilteredRows=k);var O=xe(P.filter,u||{},Pe);return O?(P.filteredRows=O(k,[z],V),P.filteredRows):(console.warn("Could not find a valid 'column.filter' for column with the ID: "+P.id+"."),k)},I)).forEach(function(k){S.push(k),G[k.id]=k,k.subRows&&(k.subRows=k.subRows&&k.subRows.length>0?W(k.subRows,F+1):k.subRows)}),j}(n),S,G]},[a,g,n,r,i,o,u]),T=x[0],C=x[1],w=x[2];p.useMemo(function(){o.filter(function(S){return!g.find(function(G){return G.id===S.id})}).forEach(function(S){S.preFilteredRows=T,S.filteredRows=T})},[T,g,o]);var A=_(h);ee(function(){A()&&v({type:s.resetFilters})},[v,a?null:t]),Object.assign(e,{preFilteredRows:n,preFilteredFlatRows:r,preFilteredRowsById:i,filteredRows:T,filteredFlatRows:C,filteredRowsById:w,rows:T,flatRows:C,rowsById:w,setFilter:R,setAllFilters:b})}Rt.pluginName="useFilters",s.resetGlobalFilter="resetGlobalFilter",s.setGlobalFilter="setGlobalFilter";var bt=function(e){e.stateReducers.push(An),e.useInstance.push(Hn)};function An(e,t,n,r){if(t.type===s.resetGlobalFilter)return c({},e,{globalFilter:r.initialState.globalFilter||void 0});if(t.type===s.setGlobalFilter){var i=t.filterValue,o=r.userFilterTypes,u=xe(r.globalFilter,o||{},Pe),a=le(i,e.globalFilter);return Ne(u.autoRemove,a)?(e.globalFilter,Z(e,["globalFilter"])):c({},e,{globalFilter:a})}}function Hn(e){var t=e.data,n=e.rows,r=e.flatRows,i=e.rowsById,o=e.allColumns,u=e.filterTypes,a=e.globalFilter,l=e.manualGlobalFilter,d=e.state.globalFilter,y=e.dispatch,g=e.autoResetGlobalFilter,v=g===void 0||g,f=e.disableGlobalFilter,h=p.useCallback(function(w){y({type:s.setGlobalFilter,filterValue:w})},[y]),R=p.useMemo(function(){if(l||d===void 0)return[n,r,i];var w=[],A={},S=xe(a,u||{},Pe);if(!S)return console.warn("Could not find a valid 'globalFilter' option."),n;o.forEach(function(W){var I=W.disableGlobalFilter;W.canFilter=he(I!==!0&&void 0,f!==!0&&void 0,!0)});var G=o.filter(function(W){return W.canFilter===!0});return[function W(I){return(I=S(I,G.map(function(F){return F.id}),d)).forEach(function(F){w.push(F),A[F.id]=F,F.subRows=F.subRows&&F.subRows.length?W(F.subRows):F.subRows}),I}(n),w,A]},[l,d,a,u,o,n,r,i,f]),b=R[0],x=R[1],T=R[2],C=_(v);ee(function(){C()&&y({type:s.resetGlobalFilter})},[y,l?null:t]),Object.assign(e,{preGlobalFilteredRows:n,preGlobalFilteredFlatRows:r,preGlobalFilteredRowsById:i,globalFilteredRows:b,globalFilteredFlatRows:x,globalFilteredRowsById:T,rows:b,flatRows:x,rowsById:T,setGlobalFilter:h,disableGlobalFilter:f})}function St(e,t){return t.reduce(function(n,r){return n+(typeof r=="number"?r:0)},0)}bt.pluginName="useGlobalFilter";var Ct=Object.freeze({__proto__:null,sum:St,min:function(e){var t=e[0]||0;return e.forEach(function(n){typeof n=="number"&&(t=Math.min(t,n))}),t},max:function(e){var t=e[0]||0;return e.forEach(function(n){typeof n=="number"&&(t=Math.max(t,n))}),t},minMax:function(e){var t=e[0]||0,n=e[0]||0;return e.forEach(function(r){typeof r=="number"&&(t=Math.min(t,r),n=Math.max(n,r))}),t+".."+n},average:function(e){return St(0,e)/e.length},median:function(e){if(!e.length)return null;var t=Math.floor(e.length/2),n=[].concat(e).sort(function(r,i){return r-i});return e.length%2!=0?n[t]:(n[t-1]+n[t])/2},unique:function(e){return Array.from(new Set(e).values())},uniqueCount:function(e){return new Set(e).size},count:function(e){return e.length}}),Tn=[],Wn={};s.resetGroupBy="resetGroupBy",s.setGroupBy="setGroupBy",s.toggleGroupBy="toggleGroupBy";var xt=function(e){e.getGroupByToggleProps=[On],e.stateReducers.push(zn),e.visibleColumnsDeps.push(function(t,n){var r=n.instance;return[].concat(t,[r.state.groupBy])}),e.visibleColumns.push(Dn),e.useInstance.push(Nn),e.prepareRow.push(jn)};xt.pluginName="useGroupBy";var On=function(e,t){var n=t.header;return[e,{onClick:n.canGroupBy?function(r){r.persist(),n.toggleGroupBy()}:void 0,style:{cursor:n.canGroupBy?"pointer":void 0},title:"Toggle GroupBy"}]};function zn(e,t,n,r){if(t.type===s.init)return c({groupBy:[]},e);if(t.type===s.resetGroupBy)return c({},e,{groupBy:r.initialState.groupBy||[]});if(t.type===s.setGroupBy)return c({},e,{groupBy:t.value});if(t.type===s.toggleGroupBy){var i=t.columnId,o=t.value,u=o!==void 0?o:!e.groupBy.includes(i);return c({},e,u?{groupBy:[].concat(e.groupBy,[i])}:{groupBy:e.groupBy.filter(function(a){return a!==i})})}}function Dn(e,t){var n=t.instance.state.groupBy,r=n.map(function(o){return e.find(function(u){return u.id===o})}).filter(Boolean),i=e.filter(function(o){return!n.includes(o.id)});return(e=[].concat(r,i)).forEach(function(o){o.isGrouped=n.includes(o.id),o.groupedIndex=n.indexOf(o.id)}),e}var Mn={};function Nn(e){var t=e.data,n=e.rows,r=e.flatRows,i=e.rowsById,o=e.allColumns,u=e.flatHeaders,a=e.groupByFn,l=a===void 0?Pt:a,d=e.manualGroupBy,y=e.aggregations,g=y===void 0?Mn:y,v=e.plugins,f=e.state.groupBy,h=e.dispatch,R=e.autoResetGroupBy,b=R===void 0||R,x=e.disableGroupBy,T=e.defaultCanGroupBy,C=e.getHooks;ie(v,["useColumnOrder","useFilters"],"useGroupBy");var w=_(e);o.forEach(function(P){var O=P.accessor,K=P.defaultGroupBy,ue=P.disableGroupBy;P.canGroupBy=O?he(P.canGroupBy,ue!==!0&&void 0,x!==!0&&void 0,!0):he(P.canGroupBy,K,T,!1),P.canGroupBy&&(P.toggleGroupBy=function(){return e.toggleGroupBy(P.id)}),P.Aggregated=P.Aggregated||P.Cell});var A=p.useCallback(function(P,O){h({type:s.toggleGroupBy,columnId:P,value:O})},[h]),S=p.useCallback(function(P){h({type:s.setGroupBy,value:P})},[h]);u.forEach(function(P){P.getGroupByToggleProps=L(C().getGroupByToggleProps,{instance:w(),header:P})});var G=p.useMemo(function(){if(d||!f.length)return[n,r,i,Tn,Wn,r,i];var P=f.filter(function(oe){return o.find(function(we){return we.id===oe})}),O=[],K={},ue=[],B={},Q=[],te={},se=function oe(we,ye,_t){if(ye===void 0&&(ye=0),ye===P.length)return we.map(function(He){return c({},He,{depth:ye})});var $e=P[ye],Fr=l(we,$e);return Object.entries(Fr).map(function(He,Gr){var Vt=He[0],Te=He[1],We=$e+":"+Vt,Qt=oe(Te,ye+1,We=_t?_t+">"+We:We),Xt=ye?ot(Te,"leafRows"):Te,kr=function(pe,Ke,Hr){var Oe={};return o.forEach(function(ne){if(P.includes(ne.id))Oe[ne.id]=Ke[0]?Ke[0].values[ne.id]:null;else{var qt=typeof ne.aggregate=="function"?ne.aggregate:g[ne.aggregate]||Ct[ne.aggregate];if(qt){var Tr=Ke.map(function(ze){return ze.values[ne.id]}),Wr=pe.map(function(ze){var Ue=ze.values[ne.id];if(!Hr&&ne.aggregateValue){var $t=typeof ne.aggregateValue=="function"?ne.aggregateValue:g[ne.aggregateValue]||Ct[ne.aggregateValue];if(!$t)throw console.info({column:ne}),new Error("React Table: Invalid column.aggregateValue option for column listed above");Ue=$t(Ue,ze,ne)}return Ue});Oe[ne.id]=qt(Wr,Tr)}else{if(ne.aggregate)throw console.info({column:ne}),new Error("React Table: Invalid column.aggregate option for column listed above");Oe[ne.id]=null}}}),Oe}(Xt,Te,ye),Ar={id:We,isGrouped:!0,groupByID:$e,groupByVal:Vt,values:kr,subRows:Qt,leafRows:Xt,depth:ye,index:Gr};return Qt.forEach(function(pe){O.push(pe),K[pe.id]=pe,pe.isGrouped?(ue.push(pe),B[pe.id]=pe):(Q.push(pe),te[pe.id]=pe)}),Ar})}(n);return se.forEach(function(oe){O.push(oe),K[oe.id]=oe,oe.isGrouped?(ue.push(oe),B[oe.id]=oe):(Q.push(oe),te[oe.id]=oe)}),[se,O,K,ue,B,Q,te]},[d,f,n,r,i,o,g,l]),W=G[0],I=G[1],F=G[2],j=G[3],k=G[4],N=G[5],z=G[6],V=_(b);ee(function(){V()&&h({type:s.resetGroupBy})},[h,d?null:t]),Object.assign(e,{preGroupedRows:n,preGroupedFlatRow:r,preGroupedRowsById:i,groupedRows:W,groupedFlatRows:I,groupedRowsById:F,onlyGroupedFlatRows:j,onlyGroupedRowsById:k,nonGroupedFlatRows:N,nonGroupedRowsById:z,rows:W,flatRows:I,rowsById:F,toggleGroupBy:A,setGroupBy:S})}function jn(e){e.allCells.forEach(function(t){var n;t.isGrouped=t.column.isGrouped&&t.column.id===e.groupByID,t.isPlaceholder=!t.isGrouped&&t.column.isGrouped,t.isAggregated=!t.isGrouped&&!t.isPlaceholder&&((n=e.subRows)==null?void 0:n.length)})}function Pt(e,t){return e.reduce(function(n,r,i){var o=""+r.values[t];return n[o]=Array.isArray(n[o])?n[o]:[],n[o].push(r),n},{})}var It=/([0-9]+)/gm;function Le(e,t){return e===t?0:e>t?1:-1}function Ie(e,t,n){return[e.values[n],t.values[n]]}function Bt(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}var Ln=Object.freeze({__proto__:null,alphanumeric:function(e,t,n){var r=Ie(e,t,n),i=r[0],o=r[1];for(i=Bt(i),o=Bt(o),i=i.split(It).filter(Boolean),o=o.split(It).filter(Boolean);i.length&&o.length;){var u=i.shift(),a=o.shift(),l=parseInt(u,10),d=parseInt(a,10),y=[l,d].sort();if(isNaN(y[0])){if(u>a)return 1;if(a>u)return-1}else{if(isNaN(y[1]))return isNaN(l)?-1:1;if(l>d)return 1;if(d>l)return-1}}return i.length-o.length},datetime:function(e,t,n){var r=Ie(e,t,n),i=r[0],o=r[1];return Le(i=i.getTime(),o=o.getTime())},basic:function(e,t,n){var r=Ie(e,t,n);return Le(r[0],r[1])},string:function(e,t,n){var r=Ie(e,t,n),i=r[0],o=r[1];for(i=i.split("").filter(Boolean),o=o.split("").filter(Boolean);i.length&&o.length;){var u=i.shift(),a=o.shift(),l=u.toLowerCase(),d=a.toLowerCase();if(l>d)return 1;if(d>l)return-1;if(u>a)return 1;if(a>u)return-1}return i.length-o.length},number:function(e,t,n){var r=Ie(e,t,n),i=r[0],o=r[1],u=/[^0-9.]/gi;return Le(i=Number(String(i).replace(u,"")),o=Number(String(o).replace(u,"")))}});s.resetSortBy="resetSortBy",s.setSortBy="setSortBy",s.toggleSortBy="toggleSortBy",s.clearSortBy="clearSortBy",q.sortType="alphanumeric",q.sortDescFirst=!1;var Et=function(e){e.getSortByToggleProps=[_n],e.stateReducers.push(Vn),e.useInstance.push(Qn)};Et.pluginName="useSortBy";var _n=function(e,t){var n=t.instance,r=t.column,i=n.isMultiSortEvent,o=i===void 0?function(u){return u.shiftKey}:i;return[e,{onClick:r.canSort?function(u){u.persist(),r.toggleSortBy(void 0,!n.disableMultiSort&&o(u))}:void 0,style:{cursor:r.canSort?"pointer":void 0},title:r.canSort?"Toggle SortBy":void 0}]};function Vn(e,t,n,r){if(t.type===s.init)return c({sortBy:[]},e);if(t.type===s.resetSortBy)return c({},e,{sortBy:r.initialState.sortBy||[]});if(t.type===s.clearSortBy)return c({},e,{sortBy:e.sortBy.filter(function(w){return w.id!==t.columnId})});if(t.type===s.setSortBy)return c({},e,{sortBy:t.sortBy});if(t.type===s.toggleSortBy){var i,o=t.columnId,u=t.desc,a=t.multi,l=r.allColumns,d=r.disableMultiSort,y=r.disableSortRemove,g=r.disableMultiRemove,v=r.maxMultiSortColCount,f=v===void 0?Number.MAX_SAFE_INTEGER:v,h=e.sortBy,R=l.find(function(w){return w.id===o}).sortDescFirst,b=h.find(function(w){return w.id===o}),x=h.findIndex(function(w){return w.id===o}),T=u!=null,C=[];return(i=!d&&a?b?"toggle":"add":x!==h.length-1||h.length!==1?"replace":b?"toggle":"replace")!="toggle"||y||T||a&&g||!(b&&b.desc&&!R||!b.desc&&R)||(i="remove"),i==="replace"?C=[{id:o,desc:T?u:R}]:i==="add"?(C=[].concat(h,[{id:o,desc:T?u:R}])).splice(0,C.length-f):i==="toggle"?C=h.map(function(w){return w.id===o?c({},w,{desc:T?u:!b.desc}):w}):i==="remove"&&(C=h.filter(function(w){return w.id!==o})),c({},e,{sortBy:C})}}function Qn(e){var t=e.data,n=e.rows,r=e.flatRows,i=e.allColumns,o=e.orderByFn,u=o===void 0?Ft:o,a=e.sortTypes,l=e.manualSortBy,d=e.defaultCanSort,y=e.disableSortBy,g=e.flatHeaders,v=e.state.sortBy,f=e.dispatch,h=e.plugins,R=e.getHooks,b=e.autoResetSortBy,x=b===void 0||b;ie(h,["useFilters","useGlobalFilter","useGroupBy","usePivotColumns"],"useSortBy");var T=p.useCallback(function(I){f({type:s.setSortBy,sortBy:I})},[f]),C=p.useCallback(function(I,F,j){f({type:s.toggleSortBy,columnId:I,desc:F,multi:j})},[f]),w=_(e);g.forEach(function(I){var F=I.accessor,j=I.canSort,k=I.disableSortBy,N=I.id,z=F?he(k!==!0&&void 0,y!==!0&&void 0,!0):he(d,j,!1);I.canSort=z,I.canSort&&(I.toggleSortBy=function(P,O){return C(I.id,P,O)},I.clearSortBy=function(){f({type:s.clearSortBy,columnId:I.id})}),I.getSortByToggleProps=L(R().getSortByToggleProps,{instance:w(),column:I});var V=v.find(function(P){return P.id===N});I.isSorted=!!V,I.sortedIndex=v.findIndex(function(P){return P.id===N}),I.isSortedDesc=I.isSorted?V.desc:void 0});var A=p.useMemo(function(){if(l||!v.length)return[n,r];var I=[],F=v.filter(function(j){return i.find(function(k){return k.id===j.id})});return[function j(k){var N=u(k,F.map(function(z){var V=i.find(function(K){return K.id===z.id});if(!V)throw new Error("React-Table: Could not find a column with id: "+z.id+" while sorting");var P=V.sortType,O=rt(P)||(a||{})[P]||Ln[P];if(!O)throw new Error("React-Table: Could not find a valid sortType of '"+P+"' for column '"+z.id+"'.");return function(K,ue){return O(K,ue,z.id,z.desc)}}),F.map(function(z){var V=i.find(function(P){return P.id===z.id});return V&&V.sortInverted?z.desc:!z.desc}));return N.forEach(function(z){I.push(z),z.subRows&&z.subRows.length!==0&&(z.subRows=j(z.subRows))}),N}(n),I]},[l,v,n,r,i,u,a]),S=A[0],G=A[1],W=_(x);ee(function(){W()&&f({type:s.resetSortBy})},[l?null:t]),Object.assign(e,{preSortedRows:n,preSortedFlatRows:r,sortedRows:S,sortedFlatRows:G,rows:S,flatRows:G,setSortBy:T,toggleSortBy:C})}function Ft(e,t,n){return[].concat(e).sort(function(r,i){for(var o=0;oe.pageIndex?a=i===-1?o.length>=e.pageSize:u-1),a?c({},e,{pageIndex:u}):e}if(t.type===s.setPageSize){var l=t.pageSize,d=e.pageSize*e.pageIndex;return c({},e,{pageIndex:Math.floor(d/l),pageSize:l})}}function qn(e){var t=e.rows,n=e.autoResetPage,r=n===void 0||n,i=e.manualExpandedKey,o=i===void 0?"expanded":i,u=e.plugins,a=e.pageCount,l=e.paginateExpandedRows,d=l===void 0||l,y=e.expandSubRows,g=y===void 0||y,v=e.state,f=v.pageSize,h=v.pageIndex,R=v.expanded,b=v.globalFilter,x=v.filters,T=v.groupBy,C=v.sortBy,w=e.dispatch,A=e.data,S=e.manualPagination;ie(u,["useGlobalFilter","useFilters","useGroupBy","useSortBy","useExpanded"],"usePagination");var G=_(r);ee(function(){G()&&w({type:s.resetPage})},[w,S?null:A,b,x,T,C]);var W=S?a:Math.ceil(t.length/f),I=p.useMemo(function(){return W>0?[].concat(new Array(W)).fill(null).map(function(O,K){return K}):[]},[W]),F=p.useMemo(function(){var O;if(S)O=t;else{var K=f*h,ue=K+f;O=t.slice(K,ue)}return d?O:it(O,{manualExpandedKey:o,expanded:R,expandSubRows:g})},[g,R,o,S,h,f,d,t]),j=h>0,k=W===-1?F.length>=f:h-1&&o.push(i.splice(l,1)[0])};i.length&&r.length;)u();return[].concat(o,i)}function vr(e){var t=e.dispatch;e.setColumnOrder=p.useCallback(function(n){return t({type:s.setColumnOrder,columnOrder:n})},[t])}zt.pluginName="useColumnOrder",q.canResize=!0,s.columnStartResizing="columnStartResizing",s.columnResizing="columnResizing",s.columnDoneResizing="columnDoneResizing",s.resetResize="resetResize";var Dt=function(e){e.getResizerProps=[hr],e.getHeaderProps.push({style:{position:"relative"}}),e.stateReducers.push(yr),e.useInstance.push(Rr),e.useInstanceBeforeDimensions.push(wr)},hr=function(e,t){var n=t.instance,r=t.header,i=n.dispatch,o=function(u,a){var l=!1;if(u.type==="touchstart"){if(u.touches&&u.touches.length>1)return;l=!0}var d,y,g=function(C){var w=[];return function A(S){S.columns&&S.columns.length&&S.columns.map(A),w.push(S)}(C),w}(a).map(function(C){return[C.id,C.totalWidth]}),v=l?Math.round(u.touches[0].clientX):u.clientX,f=function(){window.cancelAnimationFrame(d),d=null,i({type:s.columnDoneResizing})},h=function(){window.cancelAnimationFrame(d),d=null,i({type:s.columnResizing,clientX:y})},R=function(C){y=C,d||(d=window.requestAnimationFrame(h))},b={mouse:{moveEvent:"mousemove",moveHandler:function(C){return R(C.clientX)},upEvent:"mouseup",upHandler:function(C){document.removeEventListener("mousemove",b.mouse.moveHandler),document.removeEventListener("mouseup",b.mouse.upHandler),f()}},touch:{moveEvent:"touchmove",moveHandler:function(C){return C.cancelable&&(C.preventDefault(),C.stopPropagation()),R(C.touches[0].clientX),!1},upEvent:"touchend",upHandler:function(C){document.removeEventListener(b.touch.moveEvent,b.touch.moveHandler),document.removeEventListener(b.touch.upEvent,b.touch.moveHandler),f()}}},x=l?b.touch:b.mouse,T=!!function(){if(typeof je=="boolean")return je;var C=!1;try{var w={get passive(){return C=!0,!1}};window.addEventListener("test",null,w),window.removeEventListener("test",null,w)}catch{C=!1}return je=C}()&&{passive:!1};document.addEventListener(x.moveEvent,x.moveHandler,T),document.addEventListener(x.upEvent,x.upHandler,T),i({type:s.columnStartResizing,columnId:a.id,columnWidth:a.totalWidth,headerIdWidths:g,clientX:v})};return[e,{onMouseDown:function(u){return u.persist()||o(u,r)},onTouchStart:function(u){return u.persist()||o(u,r)},style:{cursor:"col-resize"},draggable:!1,role:"separator"}]};function yr(e,t){if(t.type===s.init)return c({columnResizing:{columnWidths:{}}},e);if(t.type===s.resetResize)return c({},e,{columnResizing:{columnWidths:{}}});if(t.type===s.columnStartResizing){var n=t.clientX,r=t.columnId,i=t.columnWidth,o=t.headerIdWidths;return c({},e,{columnResizing:c({},e.columnResizing,{startX:n,headerIdWidths:o,columnWidth:i,isResizingColumn:r})})}if(t.type===s.columnResizing){var u=t.clientX,a=e.columnResizing,l=a.startX,d=a.columnWidth,y=a.headerIdWidths,g=(u-l)/d,v={};return(y===void 0?[]:y).forEach(function(f){var h=f[0],R=f[1];v[h]=Math.max(R+R*g,0)}),c({},e,{columnResizing:c({},e.columnResizing,{columnWidths:c({},e.columnResizing.columnWidths,{},v)})})}return t.type===s.columnDoneResizing?c({},e,{columnResizing:c({},e.columnResizing,{startX:null,isResizingColumn:null})}):void 0}Dt.pluginName="useResizeColumns";var wr=function(e){var t=e.flatHeaders,n=e.disableResizing,r=e.getHooks,i=e.state.columnResizing,o=_(e);t.forEach(function(u){var a=he(u.disableResizing!==!0&&void 0,n!==!0&&void 0,!0);u.canResize=a,u.width=i.columnWidths[u.id]||u.originalWidth||u.width,u.isResizing=i.isResizingColumn===u.id,a&&(u.getResizerProps=L(r().getResizerProps,{instance:o(),header:u}))})};function Rr(e){var t=e.plugins,n=e.dispatch,r=e.autoResetResize,i=r===void 0||r,o=e.columns;ie(t,["useAbsoluteLayout"],"useResizeColumns");var u=_(i);ee(function(){u()&&n({type:s.resetResize})},[o]);var a=p.useCallback(function(){return n({type:s.resetResize})},[n]);Object.assign(e,{resetResizing:a})}var _e={position:"absolute",top:0},Mt=function(e){e.getTableBodyProps.push(Ae),e.getRowProps.push(Ae),e.getHeaderGroupProps.push(Ae),e.getFooterGroupProps.push(Ae),e.getHeaderProps.push(function(t,n){var r=n.column;return[t,{style:c({},_e,{left:r.totalLeft+"px",width:r.totalWidth+"px"})}]}),e.getCellProps.push(function(t,n){var r=n.cell;return[t,{style:c({},_e,{left:r.column.totalLeft+"px",width:r.column.totalWidth+"px"})}]}),e.getFooterProps.push(function(t,n){var r=n.column;return[t,{style:c({},_e,{left:r.totalLeft+"px",width:r.totalWidth+"px"})}]})};Mt.pluginName="useAbsoluteLayout";var Ae=function(e,t){return[e,{style:{position:"relative",width:t.instance.totalColumnsWidth+"px"}}]},Ve={display:"inline-block",boxSizing:"border-box"},Qe=function(e,t){return[e,{style:{display:"flex",width:t.instance.totalColumnsWidth+"px"}}]},Nt=function(e){e.getRowProps.push(Qe),e.getHeaderGroupProps.push(Qe),e.getFooterGroupProps.push(Qe),e.getHeaderProps.push(function(t,n){var r=n.column;return[t,{style:c({},Ve,{width:r.totalWidth+"px"})}]}),e.getCellProps.push(function(t,n){var r=n.cell;return[t,{style:c({},Ve,{width:r.column.totalWidth+"px"})}]}),e.getFooterProps.push(function(t,n){var r=n.column;return[t,{style:c({},Ve,{width:r.totalWidth+"px"})}]})};function jt(e){e.getTableProps.push(br),e.getRowProps.push(Xe),e.getHeaderGroupProps.push(Xe),e.getFooterGroupProps.push(Xe),e.getHeaderProps.push(Sr),e.getCellProps.push(Cr),e.getFooterProps.push(xr)}Nt.pluginName="useBlockLayout",jt.pluginName="useFlexLayout";var br=function(e,t){return[e,{style:{minWidth:t.instance.totalColumnsMinWidth+"px"}}]},Xe=function(e,t){return[e,{style:{display:"flex",flex:"1 0 auto",minWidth:t.instance.totalColumnsMinWidth+"px"}}]},Sr=function(e,t){var n=t.column;return[e,{style:{boxSizing:"border-box",flex:n.totalFlexWidth?n.totalFlexWidth+" 0 auto":void 0,minWidth:n.totalMinWidth+"px",width:n.totalWidth+"px"}}]},Cr=function(e,t){var n=t.cell;return[e,{style:{boxSizing:"border-box",flex:n.column.totalFlexWidth+" 0 auto",minWidth:n.column.totalMinWidth+"px",width:n.column.totalWidth+"px"}}]},xr=function(e,t){var n=t.column;return[e,{style:{boxSizing:"border-box",flex:n.totalFlexWidth?n.totalFlexWidth+" 0 auto":void 0,minWidth:n.totalMinWidth+"px",width:n.totalWidth+"px"}}]};function Lt(e){e.stateReducers.push(Er),e.getTableProps.push(Pr),e.getHeaderProps.push(Ir),e.getRowProps.push(Br)}s.columnStartResizing="columnStartResizing",s.columnResizing="columnResizing",s.columnDoneResizing="columnDoneResizing",s.resetResize="resetResize",Lt.pluginName="useGridLayout";var Pr=function(e,t){var n=t.instance;return[e,{style:{display:"grid",gridTemplateColumns:n.visibleColumns.map(function(r){var i;return n.state.gridLayout.columnWidths[r.id]?n.state.gridLayout.columnWidths[r.id]+"px":(i=n.state.columnResizing)!=null&&i.isResizingColumn?n.state.gridLayout.startWidths[r.id]+"px":typeof r.width=="number"?r.width+"px":r.width}).join(" ")}}]},Ir=function(e,t){var n=t.column;return[e,{id:"header-cell-"+n.id,style:{position:"sticky",gridColumn:"span "+n.totalVisibleHeaderCount}}]},Br=function(e,t){var n=t.row;return n.isExpanded?[e,{style:{gridColumn:"1 / "+(n.cells.length+1)}}]:[e,{}]};function Er(e,t,n,r){if(t.type===s.init)return c({gridLayout:{columnWidths:{}}},e);if(t.type===s.resetResize)return c({},e,{gridLayout:{columnWidths:{}}});if(t.type===s.columnStartResizing){var i=t.columnId,o=t.headerIdWidths,u=qe(i);if(u!==void 0){var a=r.visibleColumns.reduce(function(w,A){var S;return c({},w,((S={})[A.id]=qe(A.id),S))},{}),l=r.visibleColumns.reduce(function(w,A){var S;return c({},w,((S={})[A.id]=A.minWidth,S))},{}),d=r.visibleColumns.reduce(function(w,A){var S;return c({},w,((S={})[A.id]=A.maxWidth,S))},{}),y=o.map(function(w){var A=w[0];return[A,qe(A)]});return c({},e,{gridLayout:c({},e.gridLayout,{startWidths:a,minWidths:l,maxWidths:d,headerIdGridWidths:y,columnWidth:u})})}return e}if(t.type===s.columnResizing){var g=t.clientX,v=e.columnResizing.startX,f=e.gridLayout,h=f.columnWidth,R=f.minWidths,b=f.maxWidths,x=f.headerIdGridWidths,T=(g-v)/h,C={};return(x===void 0?[]:x).forEach(function(w){var A=w[0],S=w[1];C[A]=Math.min(Math.max(R[A],S+S*T),b[A])}),c({},e,{gridLayout:c({},e.gridLayout,{columnWidths:c({},e.gridLayout.columnWidths,{},C)})})}return t.type===s.columnDoneResizing?c({},e,{gridLayout:c({},e.gridLayout,{startWidths:{},minWidths:{},maxWidths:{}})}):void 0}function qe(e){var t,n=(t=document.getElementById("header-cell-"+e))==null?void 0:t.offsetWidth;if(n!==void 0)return n}m._UNSTABLE_usePivotColumns=kt,m.actions=s,m.defaultColumn=q,m.defaultGroupByFn=Pt,m.defaultOrderByFn=Ft,m.defaultRenderer=J,m.emptyRenderer=Y,m.ensurePluginOrder=ie,m.flexRender=de,m.functionalUpdate=le,m.loopHooks=ae,m.makePropGetter=L,m.makeRenderer=re,m.reduceHooks=$,m.safeUseLayoutEffect=me,m.useAbsoluteLayout=Mt,m.useAsyncDebounce=function(e,t){t===void 0&&(t=0);var n=p.useRef({}),r=_(e),i=_(t);return p.useCallback(function(){var o=M(regeneratorRuntime.mark(function u(){var a,l,d,y=arguments;return regeneratorRuntime.wrap(function(g){for(;;)switch(g.prev=g.next){case 0:for(a=y.length,l=new Array(a),d=0;d1?t-1:0),r=1;r=0||(i[n]=e[n]);return i}function U(e){var t=function(n,r){if(typeof n!="object"||n===null)return n;var i=n[Symbol.toPrimitive];if(i!==void 0){var o=i.call(n,r||"default");if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(n)}(e,"string");return typeof t=="symbol"?t:String(t)}p=p&&Object.prototype.hasOwnProperty.call(p,"default")?p.default:p;var s={init:"init"},J=function(e){var t=e.value;return t===void 0?"":t},Y=function(){return p.createElement(p.Fragment,null," ")},q={Cell:J,width:150,minWidth:0,maxWidth:Number.MAX_SAFE_INTEGER};function ce(){for(var e=arguments.length,t=new Array(e),n=0;n(o=typeof o=="number"?o:1/0)){var u=i;i=o,o=u}return e.filter(function(a){return t.some(function(l){var d=a.values[l];return d>=i&&d<=o})})};wt.autoRemove=function(e){return!e||typeof e[0]!="number"&&typeof e[1]!="number"};var Pe=Object.freeze({__proto__:null,text:ct,exactText:dt,exactTextCase:ft,includes:pt,includesAll:gt,includesSome:mt,includesValue:vt,exact:ht,equals:yt,between:wt});s.resetFilters="resetFilters",s.setFilter="setFilter",s.setAllFilters="setAllFilters";var Rt=function(e){e.stateReducers.push(Gn),e.useInstance.push(kn)};function Gn(e,t,n,r){if(t.type===s.init)return c({filters:[]},e);if(t.type===s.resetFilters)return c({},e,{filters:r.initialState.filters||[]});if(t.type===s.setFilter){var i=t.columnId,o=t.filterValue,u=r.allColumns,a=r.filterTypes,l=u.find(function(R){return R.id===i});if(!l)throw new Error("React-Table: Could not find a column with id: "+i);var d=xe(l.filter,a||{},Pe),y=e.filters.find(function(R){return R.id===i}),g=le(o,y&&y.value);return Ne(d.autoRemove,g,l)?c({},e,{filters:e.filters.filter(function(R){return R.id!==i})}):c({},e,y?{filters:e.filters.map(function(R){return R.id===i?{id:i,value:g}:R})}:{filters:[].concat(e.filters,[{id:i,value:g}])})}if(t.type===s.setAllFilters){var v=t.filters,f=r.allColumns,h=r.filterTypes;return c({},e,{filters:le(v,e.filters).filter(function(R){var b=f.find(function(x){return x.id===R.id});return!Ne(xe(b.filter,h||{},Pe).autoRemove,R.value,b)})})}}function kn(e){var t=e.data,n=e.rows,r=e.flatRows,i=e.rowsById,o=e.allColumns,u=e.filterTypes,a=e.manualFilters,l=e.defaultCanFilter,d=l!==void 0&&l,y=e.disableFilters,g=e.state.filters,v=e.dispatch,f=e.autoResetFilters,h=f===void 0||f,R=p.useCallback(function(S,G){v({type:s.setFilter,columnId:S,filterValue:G})},[v]),b=p.useCallback(function(S){v({type:s.setAllFilters,filters:S})},[v]);o.forEach(function(S){var G=S.id,W=S.accessor,I=S.defaultCanFilter,F=S.disableFilters;S.canFilter=W?he(F!==!0&&void 0,y!==!0&&void 0,!0):he(I,d,!1),S.setFilter=function(k){return R(S.id,k)};var j=g.find(function(k){return k.id===G});S.filterValue=j&&j.value});var x=p.useMemo(function(){if(a||!g.length)return[n,r,i];var S=[],G={};return[function W(I,F){F===void 0&&(F=0);var j=I;return(j=g.reduce(function(k,N){var z=N.id,V=N.value,P=o.find(function(K){return K.id===z});if(!P)return k;F===0&&(P.preFilteredRows=k);var O=xe(P.filter,u||{},Pe);return O?(P.filteredRows=O(k,[z],V),P.filteredRows):(console.warn("Could not find a valid 'column.filter' for column with the ID: "+P.id+"."),k)},I)).forEach(function(k){S.push(k),G[k.id]=k,k.subRows&&(k.subRows=k.subRows&&k.subRows.length>0?W(k.subRows,F+1):k.subRows)}),j}(n),S,G]},[a,g,n,r,i,o,u]),T=x[0],C=x[1],w=x[2];p.useMemo(function(){o.filter(function(S){return!g.find(function(G){return G.id===S.id})}).forEach(function(S){S.preFilteredRows=T,S.filteredRows=T})},[T,g,o]);var A=_(h);ee(function(){A()&&v({type:s.resetFilters})},[v,a?null:t]),Object.assign(e,{preFilteredRows:n,preFilteredFlatRows:r,preFilteredRowsById:i,filteredRows:T,filteredFlatRows:C,filteredRowsById:w,rows:T,flatRows:C,rowsById:w,setFilter:R,setAllFilters:b})}Rt.pluginName="useFilters",s.resetGlobalFilter="resetGlobalFilter",s.setGlobalFilter="setGlobalFilter";var bt=function(e){e.stateReducers.push(An),e.useInstance.push(Hn)};function An(e,t,n,r){if(t.type===s.resetGlobalFilter)return c({},e,{globalFilter:r.initialState.globalFilter||void 0});if(t.type===s.setGlobalFilter){var i=t.filterValue,o=r.userFilterTypes,u=xe(r.globalFilter,o||{},Pe),a=le(i,e.globalFilter);return Ne(u.autoRemove,a)?(e.globalFilter,Z(e,["globalFilter"])):c({},e,{globalFilter:a})}}function Hn(e){var t=e.data,n=e.rows,r=e.flatRows,i=e.rowsById,o=e.allColumns,u=e.filterTypes,a=e.globalFilter,l=e.manualGlobalFilter,d=e.state.globalFilter,y=e.dispatch,g=e.autoResetGlobalFilter,v=g===void 0||g,f=e.disableGlobalFilter,h=p.useCallback(function(w){y({type:s.setGlobalFilter,filterValue:w})},[y]),R=p.useMemo(function(){if(l||d===void 0)return[n,r,i];var w=[],A={},S=xe(a,u||{},Pe);if(!S)return console.warn("Could not find a valid 'globalFilter' option."),n;o.forEach(function(W){var I=W.disableGlobalFilter;W.canFilter=he(I!==!0&&void 0,f!==!0&&void 0,!0)});var G=o.filter(function(W){return W.canFilter===!0});return[function W(I){return(I=S(I,G.map(function(F){return F.id}),d)).forEach(function(F){w.push(F),A[F.id]=F,F.subRows=F.subRows&&F.subRows.length?W(F.subRows):F.subRows}),I}(n),w,A]},[l,d,a,u,o,n,r,i,f]),b=R[0],x=R[1],T=R[2],C=_(v);ee(function(){C()&&y({type:s.resetGlobalFilter})},[y,l?null:t]),Object.assign(e,{preGlobalFilteredRows:n,preGlobalFilteredFlatRows:r,preGlobalFilteredRowsById:i,globalFilteredRows:b,globalFilteredFlatRows:x,globalFilteredRowsById:T,rows:b,flatRows:x,rowsById:T,setGlobalFilter:h,disableGlobalFilter:f})}function St(e,t){return t.reduce(function(n,r){return n+(typeof r=="number"?r:0)},0)}bt.pluginName="useGlobalFilter";var Ct=Object.freeze({__proto__:null,sum:St,min:function(e){var t=e[0]||0;return e.forEach(function(n){typeof n=="number"&&(t=Math.min(t,n))}),t},max:function(e){var t=e[0]||0;return e.forEach(function(n){typeof n=="number"&&(t=Math.max(t,n))}),t},minMax:function(e){var t=e[0]||0,n=e[0]||0;return e.forEach(function(r){typeof r=="number"&&(t=Math.min(t,r),n=Math.max(n,r))}),t+".."+n},average:function(e){return St(0,e)/e.length},median:function(e){if(!e.length)return null;var t=Math.floor(e.length/2),n=[].concat(e).sort(function(r,i){return r-i});return e.length%2!=0?n[t]:(n[t-1]+n[t])/2},unique:function(e){return Array.from(new Set(e).values())},uniqueCount:function(e){return new Set(e).size},count:function(e){return e.length}}),Tn=[],Wn={};s.resetGroupBy="resetGroupBy",s.setGroupBy="setGroupBy",s.toggleGroupBy="toggleGroupBy";var xt=function(e){e.getGroupByToggleProps=[On],e.stateReducers.push(zn),e.visibleColumnsDeps.push(function(t,n){var r=n.instance;return[].concat(t,[r.state.groupBy])}),e.visibleColumns.push(Dn),e.useInstance.push(Nn),e.prepareRow.push(jn)};xt.pluginName="useGroupBy";var On=function(e,t){var n=t.header;return[e,{onClick:n.canGroupBy?function(r){r.persist(),n.toggleGroupBy()}:void 0,style:{cursor:n.canGroupBy?"pointer":void 0},title:"Toggle GroupBy"}]};function zn(e,t,n,r){if(t.type===s.init)return c({groupBy:[]},e);if(t.type===s.resetGroupBy)return c({},e,{groupBy:r.initialState.groupBy||[]});if(t.type===s.setGroupBy)return c({},e,{groupBy:t.value});if(t.type===s.toggleGroupBy){var i=t.columnId,o=t.value,u=o!==void 0?o:!e.groupBy.includes(i);return c({},e,u?{groupBy:[].concat(e.groupBy,[i])}:{groupBy:e.groupBy.filter(function(a){return a!==i})})}}function Dn(e,t){var n=t.instance.state.groupBy,r=n.map(function(o){return e.find(function(u){return u.id===o})}).filter(Boolean),i=e.filter(function(o){return!n.includes(o.id)});return(e=[].concat(r,i)).forEach(function(o){o.isGrouped=n.includes(o.id),o.groupedIndex=n.indexOf(o.id)}),e}var Mn={};function Nn(e){var t=e.data,n=e.rows,r=e.flatRows,i=e.rowsById,o=e.allColumns,u=e.flatHeaders,a=e.groupByFn,l=a===void 0?Pt:a,d=e.manualGroupBy,y=e.aggregations,g=y===void 0?Mn:y,v=e.plugins,f=e.state.groupBy,h=e.dispatch,R=e.autoResetGroupBy,b=R===void 0||R,x=e.disableGroupBy,T=e.defaultCanGroupBy,C=e.getHooks;ie(v,["useColumnOrder","useFilters"],"useGroupBy");var w=_(e);o.forEach(function(P){var O=P.accessor,K=P.defaultGroupBy,ue=P.disableGroupBy;P.canGroupBy=O?he(P.canGroupBy,ue!==!0&&void 0,x!==!0&&void 0,!0):he(P.canGroupBy,K,T,!1),P.canGroupBy&&(P.toggleGroupBy=function(){return e.toggleGroupBy(P.id)}),P.Aggregated=P.Aggregated||P.Cell});var A=p.useCallback(function(P,O){h({type:s.toggleGroupBy,columnId:P,value:O})},[h]),S=p.useCallback(function(P){h({type:s.setGroupBy,value:P})},[h]);u.forEach(function(P){P.getGroupByToggleProps=L(C().getGroupByToggleProps,{instance:w(),header:P})});var G=p.useMemo(function(){if(d||!f.length)return[n,r,i,Tn,Wn,r,i];var P=f.filter(function(oe){return o.find(function(we){return we.id===oe})}),O=[],K={},ue=[],B={},Q=[],te={},se=function oe(we,ye,_t){if(ye===void 0&&(ye=0),ye===P.length)return we.map(function(He){return c({},He,{depth:ye})});var $e=P[ye],Fr=l(we,$e);return Object.entries(Fr).map(function(He,Gr){var Vt=He[0],Te=He[1],We=$e+":"+Vt,Qt=oe(Te,ye+1,We=_t?_t+">"+We:We),Xt=ye?ot(Te,"leafRows"):Te,kr=function(pe,Ke,Hr){var Oe={};return o.forEach(function(ne){if(P.includes(ne.id))Oe[ne.id]=Ke[0]?Ke[0].values[ne.id]:null;else{var qt=typeof ne.aggregate=="function"?ne.aggregate:g[ne.aggregate]||Ct[ne.aggregate];if(qt){var Tr=Ke.map(function(ze){return ze.values[ne.id]}),Wr=pe.map(function(ze){var Ue=ze.values[ne.id];if(!Hr&&ne.aggregateValue){var $t=typeof ne.aggregateValue=="function"?ne.aggregateValue:g[ne.aggregateValue]||Ct[ne.aggregateValue];if(!$t)throw console.info({column:ne}),new Error("React Table: Invalid column.aggregateValue option for column listed above");Ue=$t(Ue,ze,ne)}return Ue});Oe[ne.id]=qt(Wr,Tr)}else{if(ne.aggregate)throw console.info({column:ne}),new Error("React Table: Invalid column.aggregate option for column listed above");Oe[ne.id]=null}}}),Oe}(Xt,Te,ye),Ar={id:We,isGrouped:!0,groupByID:$e,groupByVal:Vt,values:kr,subRows:Qt,leafRows:Xt,depth:ye,index:Gr};return Qt.forEach(function(pe){O.push(pe),K[pe.id]=pe,pe.isGrouped?(ue.push(pe),B[pe.id]=pe):(Q.push(pe),te[pe.id]=pe)}),Ar})}(n);return se.forEach(function(oe){O.push(oe),K[oe.id]=oe,oe.isGrouped?(ue.push(oe),B[oe.id]=oe):(Q.push(oe),te[oe.id]=oe)}),[se,O,K,ue,B,Q,te]},[d,f,n,r,i,o,g,l]),W=G[0],I=G[1],F=G[2],j=G[3],k=G[4],N=G[5],z=G[6],V=_(b);ee(function(){V()&&h({type:s.resetGroupBy})},[h,d?null:t]),Object.assign(e,{preGroupedRows:n,preGroupedFlatRow:r,preGroupedRowsById:i,groupedRows:W,groupedFlatRows:I,groupedRowsById:F,onlyGroupedFlatRows:j,onlyGroupedRowsById:k,nonGroupedFlatRows:N,nonGroupedRowsById:z,rows:W,flatRows:I,rowsById:F,toggleGroupBy:A,setGroupBy:S})}function jn(e){e.allCells.forEach(function(t){var n;t.isGrouped=t.column.isGrouped&&t.column.id===e.groupByID,t.isPlaceholder=!t.isGrouped&&t.column.isGrouped,t.isAggregated=!t.isGrouped&&!t.isPlaceholder&&((n=e.subRows)==null?void 0:n.length)})}function Pt(e,t){return e.reduce(function(n,r,i){var o=""+r.values[t];return n[o]=Array.isArray(n[o])?n[o]:[],n[o].push(r),n},{})}var It=/([0-9]+)/gm;function Le(e,t){return e===t?0:e>t?1:-1}function Ie(e,t,n){return[e.values[n],t.values[n]]}function Bt(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}var Ln=Object.freeze({__proto__:null,alphanumeric:function(e,t,n){var r=Ie(e,t,n),i=r[0],o=r[1];for(i=Bt(i),o=Bt(o),i=i.split(It).filter(Boolean),o=o.split(It).filter(Boolean);i.length&&o.length;){var u=i.shift(),a=o.shift(),l=parseInt(u,10),d=parseInt(a,10),y=[l,d].sort();if(isNaN(y[0])){if(u>a)return 1;if(a>u)return-1}else{if(isNaN(y[1]))return isNaN(l)?-1:1;if(l>d)return 1;if(d>l)return-1}}return i.length-o.length},datetime:function(e,t,n){var r=Ie(e,t,n),i=r[0],o=r[1];return Le(i=i.getTime(),o=o.getTime())},basic:function(e,t,n){var r=Ie(e,t,n);return Le(r[0],r[1])},string:function(e,t,n){var r=Ie(e,t,n),i=r[0],o=r[1];for(i=i.split("").filter(Boolean),o=o.split("").filter(Boolean);i.length&&o.length;){var u=i.shift(),a=o.shift(),l=u.toLowerCase(),d=a.toLowerCase();if(l>d)return 1;if(d>l)return-1;if(u>a)return 1;if(a>u)return-1}return i.length-o.length},number:function(e,t,n){var r=Ie(e,t,n),i=r[0],o=r[1],u=/[^0-9.]/gi;return Le(i=Number(String(i).replace(u,"")),o=Number(String(o).replace(u,"")))}});s.resetSortBy="resetSortBy",s.setSortBy="setSortBy",s.toggleSortBy="toggleSortBy",s.clearSortBy="clearSortBy",q.sortType="alphanumeric",q.sortDescFirst=!1;var Et=function(e){e.getSortByToggleProps=[_n],e.stateReducers.push(Vn),e.useInstance.push(Qn)};Et.pluginName="useSortBy";var _n=function(e,t){var n=t.instance,r=t.column,i=n.isMultiSortEvent,o=i===void 0?function(u){return u.shiftKey}:i;return[e,{onClick:r.canSort?function(u){u.persist(),r.toggleSortBy(void 0,!n.disableMultiSort&&o(u))}:void 0,style:{cursor:r.canSort?"pointer":void 0},title:r.canSort?"Toggle SortBy":void 0}]};function Vn(e,t,n,r){if(t.type===s.init)return c({sortBy:[]},e);if(t.type===s.resetSortBy)return c({},e,{sortBy:r.initialState.sortBy||[]});if(t.type===s.clearSortBy)return c({},e,{sortBy:e.sortBy.filter(function(w){return w.id!==t.columnId})});if(t.type===s.setSortBy)return c({},e,{sortBy:t.sortBy});if(t.type===s.toggleSortBy){var i,o=t.columnId,u=t.desc,a=t.multi,l=r.allColumns,d=r.disableMultiSort,y=r.disableSortRemove,g=r.disableMultiRemove,v=r.maxMultiSortColCount,f=v===void 0?Number.MAX_SAFE_INTEGER:v,h=e.sortBy,R=l.find(function(w){return w.id===o}).sortDescFirst,b=h.find(function(w){return w.id===o}),x=h.findIndex(function(w){return w.id===o}),T=u!=null,C=[];return(i=!d&&a?b?"toggle":"add":x!==h.length-1||h.length!==1?"replace":b?"toggle":"replace")!="toggle"||y||T||a&&g||!(b&&b.desc&&!R||!b.desc&&R)||(i="remove"),i==="replace"?C=[{id:o,desc:T?u:R}]:i==="add"?(C=[].concat(h,[{id:o,desc:T?u:R}])).splice(0,C.length-f):i==="toggle"?C=h.map(function(w){return w.id===o?c({},w,{desc:T?u:!b.desc}):w}):i==="remove"&&(C=h.filter(function(w){return w.id!==o})),c({},e,{sortBy:C})}}function Qn(e){var t=e.data,n=e.rows,r=e.flatRows,i=e.allColumns,o=e.orderByFn,u=o===void 0?Ft:o,a=e.sortTypes,l=e.manualSortBy,d=e.defaultCanSort,y=e.disableSortBy,g=e.flatHeaders,v=e.state.sortBy,f=e.dispatch,h=e.plugins,R=e.getHooks,b=e.autoResetSortBy,x=b===void 0||b;ie(h,["useFilters","useGlobalFilter","useGroupBy","usePivotColumns"],"useSortBy");var T=p.useCallback(function(I){f({type:s.setSortBy,sortBy:I})},[f]),C=p.useCallback(function(I,F,j){f({type:s.toggleSortBy,columnId:I,desc:F,multi:j})},[f]),w=_(e);g.forEach(function(I){var F=I.accessor,j=I.canSort,k=I.disableSortBy,N=I.id,z=F?he(k!==!0&&void 0,y!==!0&&void 0,!0):he(d,j,!1);I.canSort=z,I.canSort&&(I.toggleSortBy=function(P,O){return C(I.id,P,O)},I.clearSortBy=function(){f({type:s.clearSortBy,columnId:I.id})}),I.getSortByToggleProps=L(R().getSortByToggleProps,{instance:w(),column:I});var V=v.find(function(P){return P.id===N});I.isSorted=!!V,I.sortedIndex=v.findIndex(function(P){return P.id===N}),I.isSortedDesc=I.isSorted?V.desc:void 0});var A=p.useMemo(function(){if(l||!v.length)return[n,r];var I=[],F=v.filter(function(j){return i.find(function(k){return k.id===j.id})});return[function j(k){var N=u(k,F.map(function(z){var V=i.find(function(K){return K.id===z.id});if(!V)throw new Error("React-Table: Could not find a column with id: "+z.id+" while sorting");var P=V.sortType,O=rt(P)||(a||{})[P]||Ln[P];if(!O)throw new Error("React-Table: Could not find a valid sortType of '"+P+"' for column '"+z.id+"'.");return function(K,ue){return O(K,ue,z.id,z.desc)}}),F.map(function(z){var V=i.find(function(P){return P.id===z.id});return V&&V.sortInverted?z.desc:!z.desc}));return N.forEach(function(z){I.push(z),z.subRows&&z.subRows.length!==0&&(z.subRows=j(z.subRows))}),N}(n),I]},[l,v,n,r,i,u,a]),S=A[0],G=A[1],W=_(x);ee(function(){W()&&f({type:s.resetSortBy})},[l?null:t]),Object.assign(e,{preSortedRows:n,preSortedFlatRows:r,sortedRows:S,sortedFlatRows:G,rows:S,flatRows:G,setSortBy:T,toggleSortBy:C})}function Ft(e,t,n){return[].concat(e).sort(function(r,i){for(var o=0;oe.pageIndex?a=i===-1?o.length>=e.pageSize:u-1),a?c({},e,{pageIndex:u}):e}if(t.type===s.setPageSize){var l=t.pageSize,d=e.pageSize*e.pageIndex;return c({},e,{pageIndex:Math.floor(d/l),pageSize:l})}}function qn(e){var t=e.rows,n=e.autoResetPage,r=n===void 0||n,i=e.manualExpandedKey,o=i===void 0?"expanded":i,u=e.plugins,a=e.pageCount,l=e.paginateExpandedRows,d=l===void 0||l,y=e.expandSubRows,g=y===void 0||y,v=e.state,f=v.pageSize,h=v.pageIndex,R=v.expanded,b=v.globalFilter,x=v.filters,T=v.groupBy,C=v.sortBy,w=e.dispatch,A=e.data,S=e.manualPagination;ie(u,["useGlobalFilter","useFilters","useGroupBy","useSortBy","useExpanded"],"usePagination");var G=_(r);ee(function(){G()&&w({type:s.resetPage})},[w,S?null:A,b,x,T,C]);var W=S?a:Math.ceil(t.length/f),I=p.useMemo(function(){return W>0?[].concat(new Array(W)).fill(null).map(function(O,K){return K}):[]},[W]),F=p.useMemo(function(){var O;if(S)O=t;else{var K=f*h,ue=K+f;O=t.slice(K,ue)}return d?O:it(O,{manualExpandedKey:o,expanded:R,expandSubRows:g})},[g,R,o,S,h,f,d,t]),j=h>0,k=W===-1?F.length>=f:h-1&&o.push(i.splice(l,1)[0])};i.length&&r.length;)u();return[].concat(o,i)}function vr(e){var t=e.dispatch;e.setColumnOrder=p.useCallback(function(n){return t({type:s.setColumnOrder,columnOrder:n})},[t])}zt.pluginName="useColumnOrder",q.canResize=!0,s.columnStartResizing="columnStartResizing",s.columnResizing="columnResizing",s.columnDoneResizing="columnDoneResizing",s.resetResize="resetResize";var Dt=function(e){e.getResizerProps=[hr],e.getHeaderProps.push({style:{position:"relative"}}),e.stateReducers.push(yr),e.useInstance.push(Rr),e.useInstanceBeforeDimensions.push(wr)},hr=function(e,t){var n=t.instance,r=t.header,i=n.dispatch,o=function(u,a){var l=!1;if(u.type==="touchstart"){if(u.touches&&u.touches.length>1)return;l=!0}var d,y,g=function(C){var w=[];return function A(S){S.columns&&S.columns.length&&S.columns.map(A),w.push(S)}(C),w}(a).map(function(C){return[C.id,C.totalWidth]}),v=l?Math.round(u.touches[0].clientX):u.clientX,f=function(){window.cancelAnimationFrame(d),d=null,i({type:s.columnDoneResizing})},h=function(){window.cancelAnimationFrame(d),d=null,i({type:s.columnResizing,clientX:y})},R=function(C){y=C,d||(d=window.requestAnimationFrame(h))},b={mouse:{moveEvent:"mousemove",moveHandler:function(C){return R(C.clientX)},upEvent:"mouseup",upHandler:function(C){document.removeEventListener("mousemove",b.mouse.moveHandler),document.removeEventListener("mouseup",b.mouse.upHandler),f()}},touch:{moveEvent:"touchmove",moveHandler:function(C){return C.cancelable&&(C.preventDefault(),C.stopPropagation()),R(C.touches[0].clientX),!1},upEvent:"touchend",upHandler:function(C){document.removeEventListener(b.touch.moveEvent,b.touch.moveHandler),document.removeEventListener(b.touch.upEvent,b.touch.moveHandler),f()}}},x=l?b.touch:b.mouse,T=!!function(){if(typeof je=="boolean")return je;var C=!1;try{var w={get passive(){return C=!0,!1}};window.addEventListener("test",null,w),window.removeEventListener("test",null,w)}catch{C=!1}return je=C}()&&{passive:!1};document.addEventListener(x.moveEvent,x.moveHandler,T),document.addEventListener(x.upEvent,x.upHandler,T),i({type:s.columnStartResizing,columnId:a.id,columnWidth:a.totalWidth,headerIdWidths:g,clientX:v})};return[e,{onMouseDown:function(u){return u.persist()||o(u,r)},onTouchStart:function(u){return u.persist()||o(u,r)},style:{cursor:"col-resize"},draggable:!1,role:"separator"}]};function yr(e,t){if(t.type===s.init)return c({columnResizing:{columnWidths:{}}},e);if(t.type===s.resetResize)return c({},e,{columnResizing:{columnWidths:{}}});if(t.type===s.columnStartResizing){var n=t.clientX,r=t.columnId,i=t.columnWidth,o=t.headerIdWidths;return c({},e,{columnResizing:c({},e.columnResizing,{startX:n,headerIdWidths:o,columnWidth:i,isResizingColumn:r})})}if(t.type===s.columnResizing){var u=t.clientX,a=e.columnResizing,l=a.startX,d=a.columnWidth,y=a.headerIdWidths,g=(u-l)/d,v={};return(y===void 0?[]:y).forEach(function(f){var h=f[0],R=f[1];v[h]=Math.max(R+R*g,0)}),c({},e,{columnResizing:c({},e.columnResizing,{columnWidths:c({},e.columnResizing.columnWidths,{},v)})})}return t.type===s.columnDoneResizing?c({},e,{columnResizing:c({},e.columnResizing,{startX:null,isResizingColumn:null})}):void 0}Dt.pluginName="useResizeColumns";var wr=function(e){var t=e.flatHeaders,n=e.disableResizing,r=e.getHooks,i=e.state.columnResizing,o=_(e);t.forEach(function(u){var a=he(u.disableResizing!==!0&&void 0,n!==!0&&void 0,!0);u.canResize=a,u.width=i.columnWidths[u.id]||u.originalWidth||u.width,u.isResizing=i.isResizingColumn===u.id,a&&(u.getResizerProps=L(r().getResizerProps,{instance:o(),header:u}))})};function Rr(e){var t=e.plugins,n=e.dispatch,r=e.autoResetResize,i=r===void 0||r,o=e.columns;ie(t,["useAbsoluteLayout"],"useResizeColumns");var u=_(i);ee(function(){u()&&n({type:s.resetResize})},[o]);var a=p.useCallback(function(){return n({type:s.resetResize})},[n]);Object.assign(e,{resetResizing:a})}var _e={position:"absolute",top:0},Mt=function(e){e.getTableBodyProps.push(Ae),e.getRowProps.push(Ae),e.getHeaderGroupProps.push(Ae),e.getFooterGroupProps.push(Ae),e.getHeaderProps.push(function(t,n){var r=n.column;return[t,{style:c({},_e,{left:r.totalLeft+"px",width:r.totalWidth+"px"})}]}),e.getCellProps.push(function(t,n){var r=n.cell;return[t,{style:c({},_e,{left:r.column.totalLeft+"px",width:r.column.totalWidth+"px"})}]}),e.getFooterProps.push(function(t,n){var r=n.column;return[t,{style:c({},_e,{left:r.totalLeft+"px",width:r.totalWidth+"px"})}]})};Mt.pluginName="useAbsoluteLayout";var Ae=function(e,t){return[e,{style:{position:"relative",width:t.instance.totalColumnsWidth+"px"}}]},Ve={display:"inline-block",boxSizing:"border-box"},Qe=function(e,t){return[e,{style:{display:"flex",width:t.instance.totalColumnsWidth+"px"}}]},Nt=function(e){e.getRowProps.push(Qe),e.getHeaderGroupProps.push(Qe),e.getFooterGroupProps.push(Qe),e.getHeaderProps.push(function(t,n){var r=n.column;return[t,{style:c({},Ve,{width:r.totalWidth+"px"})}]}),e.getCellProps.push(function(t,n){var r=n.cell;return[t,{style:c({},Ve,{width:r.column.totalWidth+"px"})}]}),e.getFooterProps.push(function(t,n){var r=n.column;return[t,{style:c({},Ve,{width:r.totalWidth+"px"})}]})};function jt(e){e.getTableProps.push(br),e.getRowProps.push(Xe),e.getHeaderGroupProps.push(Xe),e.getFooterGroupProps.push(Xe),e.getHeaderProps.push(Sr),e.getCellProps.push(Cr),e.getFooterProps.push(xr)}Nt.pluginName="useBlockLayout",jt.pluginName="useFlexLayout";var br=function(e,t){return[e,{style:{minWidth:t.instance.totalColumnsMinWidth+"px"}}]},Xe=function(e,t){return[e,{style:{display:"flex",flex:"1 0 auto",minWidth:t.instance.totalColumnsMinWidth+"px"}}]},Sr=function(e,t){var n=t.column;return[e,{style:{boxSizing:"border-box",flex:n.totalFlexWidth?n.totalFlexWidth+" 0 auto":void 0,minWidth:n.totalMinWidth+"px",width:n.totalWidth+"px"}}]},Cr=function(e,t){var n=t.cell;return[e,{style:{boxSizing:"border-box",flex:n.column.totalFlexWidth+" 0 auto",minWidth:n.column.totalMinWidth+"px",width:n.column.totalWidth+"px"}}]},xr=function(e,t){var n=t.column;return[e,{style:{boxSizing:"border-box",flex:n.totalFlexWidth?n.totalFlexWidth+" 0 auto":void 0,minWidth:n.totalMinWidth+"px",width:n.totalWidth+"px"}}]};function Lt(e){e.stateReducers.push(Er),e.getTableProps.push(Pr),e.getHeaderProps.push(Ir),e.getRowProps.push(Br)}s.columnStartResizing="columnStartResizing",s.columnResizing="columnResizing",s.columnDoneResizing="columnDoneResizing",s.resetResize="resetResize",Lt.pluginName="useGridLayout";var Pr=function(e,t){var n=t.instance;return[e,{style:{display:"grid",gridTemplateColumns:n.visibleColumns.map(function(r){var i;return n.state.gridLayout.columnWidths[r.id]?n.state.gridLayout.columnWidths[r.id]+"px":(i=n.state.columnResizing)!=null&&i.isResizingColumn?n.state.gridLayout.startWidths[r.id]+"px":typeof r.width=="number"?r.width+"px":r.width}).join(" ")}}]},Ir=function(e,t){var n=t.column;return[e,{id:"header-cell-"+n.id,style:{position:"sticky",gridColumn:"span "+n.totalVisibleHeaderCount}}]},Br=function(e,t){var n=t.row;return n.isExpanded?[e,{style:{gridColumn:"1 / "+(n.cells.length+1)}}]:[e,{}]};function Er(e,t,n,r){if(t.type===s.init)return c({gridLayout:{columnWidths:{}}},e);if(t.type===s.resetResize)return c({},e,{gridLayout:{columnWidths:{}}});if(t.type===s.columnStartResizing){var i=t.columnId,o=t.headerIdWidths,u=qe(i);if(u!==void 0){var a=r.visibleColumns.reduce(function(w,A){var S;return c({},w,((S={})[A.id]=qe(A.id),S))},{}),l=r.visibleColumns.reduce(function(w,A){var S;return c({},w,((S={})[A.id]=A.minWidth,S))},{}),d=r.visibleColumns.reduce(function(w,A){var S;return c({},w,((S={})[A.id]=A.maxWidth,S))},{}),y=o.map(function(w){var A=w[0];return[A,qe(A)]});return c({},e,{gridLayout:c({},e.gridLayout,{startWidths:a,minWidths:l,maxWidths:d,headerIdGridWidths:y,columnWidth:u})})}return e}if(t.type===s.columnResizing){var g=t.clientX,v=e.columnResizing.startX,f=e.gridLayout,h=f.columnWidth,R=f.minWidths,b=f.maxWidths,x=f.headerIdGridWidths,T=(g-v)/h,C={};return(x===void 0?[]:x).forEach(function(w){var A=w[0],S=w[1];C[A]=Math.min(Math.max(R[A],S+S*T),b[A])}),c({},e,{gridLayout:c({},e.gridLayout,{columnWidths:c({},e.gridLayout.columnWidths,{},C)})})}return t.type===s.columnDoneResizing?c({},e,{gridLayout:c({},e.gridLayout,{startWidths:{},minWidths:{},maxWidths:{}})}):void 0}function qe(e){var t,n=(t=document.getElementById("header-cell-"+e))==null?void 0:t.offsetWidth;if(n!==void 0)return n}m._UNSTABLE_usePivotColumns=kt,m.actions=s,m.defaultColumn=q,m.defaultGroupByFn=Pt,m.defaultOrderByFn=Ft,m.defaultRenderer=J,m.emptyRenderer=Y,m.ensurePluginOrder=ie,m.flexRender=de,m.functionalUpdate=le,m.loopHooks=ae,m.makePropGetter=L,m.makeRenderer=re,m.reduceHooks=$,m.safeUseLayoutEffect=me,m.useAbsoluteLayout=Mt,m.useAsyncDebounce=function(e,t){t===void 0&&(t=0);var n=p.useRef({}),r=_(e),i=_(t);return p.useCallback(function(){var o=M(regeneratorRuntime.mark(function u(){var a,l,d,y=arguments;return regeneratorRuntime.wrap(function(g){for(;;)switch(g.prev=g.next){case 0:for(a=y.length,l=new Array(a),d=0;d1?t-1:0),r=1;r{for(let r in i)if(i[r].firstName+" "+i[r].lastName==n)return r;return-1};function ge({doenetId:i,maxAttempts:n}){var x,G;let r=C(he),d=C(be);const c=se(),m=H(L);let _=O(K),[y,k]=D.useState(null),[f,S]=D.useState(1),[o,A]=D.useState(null),[u,w]=D.useState(1);const U=ne(({set:e,snapshot:l})=>async({doenetId:b,addToast:I})=>{const j=await l.getPromise(Q("courseId")),{data:{assignmentAttemptsData:W}}=await M.get("/api/loadGradebookAssignmentAttempts.php",{params:{courseId:j,doenetId:b}}),{data:{gradebookEnrollment:X}}=await M.get("/api/loadGradebookEnrollment.php",{params:{courseId:j}}),{data:{overview:Y}}=await M.get("/api/loadGradebookOverview.php",{params:{courseId:j}});e(de(b),W),e(ce,X),e(me,Y),I("Updated scores!"),e(L,"Assignment Table")});if(_.state!=="hasValue")return null;const v=(G=(x=_.contents)==null?void 0:x[i])==null?void 0:G.totalPointsOrPercent;if(!r.includes("Email"))return c("Need a column header named 'Email' ",B.ERROR),m("Assignment Table"),null;let P=[],p=r.filter((e,l)=>{var I;let b=Number((I=d==null?void 0:d[0])==null?void 0:I[l]);return b==v&&P.push(l),b==v});if(p.length<1)return c(`Need a column with an assignment worth ${v} points in the second row`,B.ERROR),m("Assignment Table"),null;y||k(P[0]);let T=r.indexOf("Student"),V=r.indexOf("Email"),s=[],h=[],R=[];for(let e of d){let l=T===-1?null:e[T],b=e[V],I=e[y];b!==""&&(h.push(b),R.push(I),s.push(a("tr",{children:[" ",t("td",{children:l}),t("td",{children:b}),t("td",{children:I})]},b)))}let g=a("table",{children:[a("tr",{children:[t("th",{style:{width:"200px"},children:"Student"}),t("th",{style:{width:"200px"},children:"Email"}),t("th",{style:{width:"50px"},children:"Score"})]}),s]}),F=[];for(let[e,l]of Object.entries(p))F.push([e,l]);let N=[];o===null&&N.push([0,"Select Attempt Number"]);for(let e=1;e<=n;e++)N.push([e,`Attempt Number ${e}`]);N.push([Number(n)+1,"New Attempt Number"]);let E=null;return o&&(Number(n)+1===o?E=a("div",{children:["Use column ",t("b",{children:p[Number(f)-1]})," to insert a new ",a("b",{children:["Attempt Number ",o]}),"?"]}):E=a("div",{children:["Use column ",t("b",{children:p[Number(f)-1]})," to change ",a("b",{children:["Attempt Number ",o]})," scores?"]})),o&&(p[Number(f)-1],Number(n)+1),a(J,{children:[a("div",{children:[p.length," column",p.length>1?"s":null," match"," ",v," total points"," "]}),t("div",{children:t(q,{items:F,valueIndex:f,width:"400px",onChange:({value:e})=>{S(Number(e)+1),k(P[e])}})}),t("br",{}),t("div",{children:t(q,{items:N,valueIndex:u,width:"400px",onChange:({value:e})=>{w(e),A(e)}})}),t("br",{}),E,a(ue,{children:[t(z,{alert:!0,value:"Cancel",onClick:()=>{c("Override Cancelled"),m("Assignment Table")}}),o?t(z,{value:"Accept",onClick:()=>{let e={doenetId:i,attemptNumber:o,emails:h,scores:R};M.post("/api/saveOverrideGrades.php",e).catch(l=>{c(l,B.ERROR),m("Assignment Table")}).then(({data:l})=>{l.success?U({doenetId:i,addToast:c}):c(l.message,B.ERROR)})}}):null]}),t("br",{}),g]})}function Ce(){var U,v,P,p,T,V;const i=H(Z);let n=C(Q("doenetId")),r=C(Q("courseId")),d=O(ae(n)),c=O(re),m=O(le),_=C(L);const y=H(ee);let{canViewAndModifyGrades:k}=C(pe(r)),f=O(K);D.useEffect(()=>{y(k==="1"?[]:["GradeUpload"])},[k,y]);let S=C(te(r));if((S==null?void 0:S.canViewCourse)=="0")return t("h1",{children:"No Access to view this page."});if(d.state!=="hasValue"||m.state!=="hasValue"||f.state!=="hasValue")return null;const o=f.contents[n].label,A=Number((U=f.contents[n])==null?void 0:U.totalPointsOrPercent);let u={},w=0;for(let s in d.contents)if((v=d.contents[s])!=null&&v.attempts){let h=Math.max(...Object.keys(d.contents[s].attempts).map(Number));h>w&&(w=h)}if(_==="Upload Choice Table")return t(ge,{doenetId:n,maxAttempts:w});u.headers=[],u.headers.push({Header:"Student",Footer:"Possible Points",accessor:"student"});for(let s=1;s<=w;s++)u.headers.push({Header:"Attempt "+s,Footer:A,accessor:"a"+s,disableFilters:!0,Cell:h=>t("a",{onClick:()=>{let R=h.cell.row.cells[0].value.props.children,g=fe(m.contents,R);i({page:"course",tool:"gradebookStudentAssignment",view:"",params:{courseId:r,doenetId:n,userId:g,attemptNumber:s,previousCrumb:"assignment"}})},children:h.value})});u.headers.push({Header:"Assignment Total",Footer:A,accessor:"grade",disableFilters:!0}),u.rows=[];for(let s in m.contents){let h=m.contents[s].firstName,R=m.contents[s].lastName,g={},F=h+" "+R;g.student=t("a",{onClick:()=>{i({page:"course",tool:"gradebookStudentAssignment",view:"",params:{courseId:r,doenetId:n,userId:s,previousCrumb:"assignment"}})},children:F});for(let x=1;x<=w;x++){let G=(P=d.contents[s])==null?void 0:P.attempts[x],e=Math.round(G*A*100)/100;g["a"+x]=G===void 0?"":e}let N=(V=(T=(p=c==null?void 0:c.contents)==null?void 0:p[s])==null?void 0:T.assignments)==null?void 0:V[n],E=Math.round(N*A*100)/100;g.grade=N?E:"0",u.rows.push(g)}return a(J,{children:[t("div",{style:{paddingLeft:"8px"},children:t("b",{children:o})}),a("div",{style:{paddingLeft:"8px"},children:[A," Points Possible"]}),t(oe,{children:t(ie,{columns:u.headers,data:u.rows})})]})}export{Ce as default,be as entriesGradesAtom,he as headersGradesAtom,L as processGradesAtom}; +import{ag as $,R as H,p as Z,l as C,m as Q,b as O,E as ee,r as D,I as te,j as t,a,F as J,y as se,v as ne,k as M,z as B,B as z}from"./index-9d63439d.js";import{attemptData as ae,overviewData as re,studentData as le,assignmentData as K,Styles as oe,Table as ie,attemptDataQuery as de,studentDataQuery as ce,overviewDataQuery as me}from"./Gradebook-8ee8571a.js";import{B as ue}from"./ButtonGroup-ec02b3e9.js";import{D as q}from"./DropdownMenu-421d3462.js";import{e as pe}from"./RoleDropdown-2d4e4388.js";import"./setPrototypeOf-51e8cf87.js";const L=$({key:"processGradesAtom",default:"Assignment Table"}),he=$({key:"headersGradesAtom",default:[]}),be=$({key:"entriesGradesAtom",default:[]}),fe=(i,n)=>{for(let r in i)if(i[r].firstName+" "+i[r].lastName==n)return r;return-1};function ge({doenetId:i,maxAttempts:n}){var x,G;let r=C(he),d=C(be);const c=se(),m=H(L);let _=O(K),[y,k]=D.useState(null),[f,S]=D.useState(1),[o,A]=D.useState(null),[u,w]=D.useState(1);const U=ne(({set:e,snapshot:l})=>async({doenetId:b,addToast:I})=>{const j=await l.getPromise(Q("courseId")),{data:{assignmentAttemptsData:W}}=await M.get("/api/loadGradebookAssignmentAttempts.php",{params:{courseId:j,doenetId:b}}),{data:{gradebookEnrollment:X}}=await M.get("/api/loadGradebookEnrollment.php",{params:{courseId:j}}),{data:{overview:Y}}=await M.get("/api/loadGradebookOverview.php",{params:{courseId:j}});e(de(b),W),e(ce,X),e(me,Y),I("Updated scores!"),e(L,"Assignment Table")});if(_.state!=="hasValue")return null;const v=(G=(x=_.contents)==null?void 0:x[i])==null?void 0:G.totalPointsOrPercent;if(!r.includes("Email"))return c("Need a column header named 'Email' ",B.ERROR),m("Assignment Table"),null;let P=[],p=r.filter((e,l)=>{var I;let b=Number((I=d==null?void 0:d[0])==null?void 0:I[l]);return b==v&&P.push(l),b==v});if(p.length<1)return c(`Need a column with an assignment worth ${v} points in the second row`,B.ERROR),m("Assignment Table"),null;y||k(P[0]);let T=r.indexOf("Student"),V=r.indexOf("Email"),s=[],h=[],R=[];for(let e of d){let l=T===-1?null:e[T],b=e[V],I=e[y];b!==""&&(h.push(b),R.push(I),s.push(a("tr",{children:[" ",t("td",{children:l}),t("td",{children:b}),t("td",{children:I})]},b)))}let g=a("table",{children:[a("tr",{children:[t("th",{style:{width:"200px"},children:"Student"}),t("th",{style:{width:"200px"},children:"Email"}),t("th",{style:{width:"50px"},children:"Score"})]}),s]}),F=[];for(let[e,l]of Object.entries(p))F.push([e,l]);let N=[];o===null&&N.push([0,"Select Attempt Number"]);for(let e=1;e<=n;e++)N.push([e,`Attempt Number ${e}`]);N.push([Number(n)+1,"New Attempt Number"]);let E=null;return o&&(Number(n)+1===o?E=a("div",{children:["Use column ",t("b",{children:p[Number(f)-1]})," to insert a new ",a("b",{children:["Attempt Number ",o]}),"?"]}):E=a("div",{children:["Use column ",t("b",{children:p[Number(f)-1]})," to change ",a("b",{children:["Attempt Number ",o]})," scores?"]})),o&&(p[Number(f)-1],Number(n)+1),a(J,{children:[a("div",{children:[p.length," column",p.length>1?"s":null," match"," ",v," total points"," "]}),t("div",{children:t(q,{items:F,valueIndex:f,width:"400px",onChange:({value:e})=>{S(Number(e)+1),k(P[e])}})}),t("br",{}),t("div",{children:t(q,{items:N,valueIndex:u,width:"400px",onChange:({value:e})=>{w(e),A(e)}})}),t("br",{}),E,a(ue,{children:[t(z,{alert:!0,value:"Cancel",onClick:()=>{c("Override Cancelled"),m("Assignment Table")}}),o?t(z,{value:"Accept",onClick:()=>{let e={doenetId:i,attemptNumber:o,emails:h,scores:R};M.post("/api/saveOverrideGrades.php",e).catch(l=>{c(l,B.ERROR),m("Assignment Table")}).then(({data:l})=>{l.success?U({doenetId:i,addToast:c}):c(l.message,B.ERROR)})}}):null]}),t("br",{}),g]})}function Ce(){var U,v,P,p,T,V;const i=H(Z);let n=C(Q("doenetId")),r=C(Q("courseId")),d=O(ae(n)),c=O(re),m=O(le),_=C(L);const y=H(ee);let{canViewAndModifyGrades:k}=C(pe(r)),f=O(K);D.useEffect(()=>{y(k==="1"?[]:["GradeUpload"])},[k,y]);let S=C(te(r));if((S==null?void 0:S.canViewCourse)=="0")return t("h1",{children:"No Access to view this page."});if(d.state!=="hasValue"||m.state!=="hasValue"||f.state!=="hasValue")return null;const o=f.contents[n].label,A=Number((U=f.contents[n])==null?void 0:U.totalPointsOrPercent);let u={},w=0;for(let s in d.contents)if((v=d.contents[s])!=null&&v.attempts){let h=Math.max(...Object.keys(d.contents[s].attempts).map(Number));h>w&&(w=h)}if(_==="Upload Choice Table")return t(ge,{doenetId:n,maxAttempts:w});u.headers=[],u.headers.push({Header:"Student",Footer:"Possible Points",accessor:"student"});for(let s=1;s<=w;s++)u.headers.push({Header:"Attempt "+s,Footer:A,accessor:"a"+s,disableFilters:!0,Cell:h=>t("a",{onClick:()=>{let R=h.cell.row.cells[0].value.props.children,g=fe(m.contents,R);i({page:"course",tool:"gradebookStudentAssignment",view:"",params:{courseId:r,doenetId:n,userId:g,attemptNumber:s,previousCrumb:"assignment"}})},children:h.value})});u.headers.push({Header:"Assignment Total",Footer:A,accessor:"grade",disableFilters:!0}),u.rows=[];for(let s in m.contents){let h=m.contents[s].firstName,R=m.contents[s].lastName,g={},F=h+" "+R;g.student=t("a",{onClick:()=>{i({page:"course",tool:"gradebookStudentAssignment",view:"",params:{courseId:r,doenetId:n,userId:s,previousCrumb:"assignment"}})},children:F});for(let x=1;x<=w;x++){let G=(P=d.contents[s])==null?void 0:P.attempts[x],e=Math.round(G*A*100)/100;g["a"+x]=G===void 0?"":e}let N=(V=(T=(p=c==null?void 0:c.contents)==null?void 0:p[s])==null?void 0:T.assignments)==null?void 0:V[n],E=Math.round(N*A*100)/100;g.grade=N?E:"0",u.rows.push(g)}return a(J,{children:[t("div",{style:{paddingLeft:"8px"},children:t("b",{children:o})}),a("div",{style:{paddingLeft:"8px"},children:[A," Points Possible"]}),t(oe,{children:t(ie,{columns:u.headers,data:u.rows})})]})}export{Ce as default,be as entriesGradesAtom,he as headersGradesAtom,L as processGradesAtom}; diff --git a/dist/assets/GradebookAssignmentLeave-03ee1900.js b/dist/assets/GradebookAssignmentLeave-03ee1900.js deleted file mode 100644 index b6fb0e4ddd..0000000000 --- a/dist/assets/GradebookAssignmentLeave-03ee1900.js +++ /dev/null @@ -1 +0,0 @@ -import{v as e}from"./index-61b6fc23.js";import{processGradesAtom as r}from"./GradebookAssignment-b8c6c0f7.js";import"./Gradebook-bd1a82d1.js";import"./RoleDropdown-c9fff172.js";import"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";import"./ButtonGroup-6d856500.js";function l(){return e(({set:o})=>()=>{o(r,"Assignment Table")})(),null}export{l as default}; diff --git a/dist/assets/GradebookAssignmentLeave-e7ada5bd.js b/dist/assets/GradebookAssignmentLeave-e7ada5bd.js new file mode 100644 index 0000000000..9cef9e22d8 --- /dev/null +++ b/dist/assets/GradebookAssignmentLeave-e7ada5bd.js @@ -0,0 +1 @@ +import{v as e}from"./index-9d63439d.js";import{processGradesAtom as r}from"./GradebookAssignment-ebb55feb.js";import"./Gradebook-8ee8571a.js";import"./RoleDropdown-2d4e4388.js";import"./DropdownMenu-421d3462.js";import"./setPrototypeOf-51e8cf87.js";import"./ButtonGroup-ec02b3e9.js";function l(){return e(({set:o})=>()=>{o(r,"Assignment Table")})(),null}export{l as default}; diff --git a/dist/assets/GradebookAttempt-3ae08366.js b/dist/assets/GradebookAttempt-d9aa00d2.js similarity index 62% rename from dist/assets/GradebookAttempt-3ae08366.js rename to dist/assets/GradebookAttempt-d9aa00d2.js index 2c1513453f..ac3c20a52d 100644 --- a/dist/assets/GradebookAttempt-3ae08366.js +++ b/dist/assets/GradebookAttempt-d9aa00d2.js @@ -1 +1 @@ -import{l as e,m as o,b as m,j as a}from"./index-61b6fc23.js";import{specificAttemptData as n}from"./Gradebook-bd1a82d1.js";import"./RoleDropdown-c9fff172.js";import"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";function b(p){let r=e(o("doenetId")),s=e(o("userId")),i=e(o("attemptNumber")),t=m(n({doenetId:r,userId:s,attemptNumber:i}));return console.log(t.state,t.contents),t.state,t.state==="hasValue"?a("p",{children:t.contents.doenetML}):a("p",{children:t.state})}export{b as default}; +import{l as e,m as o,b as m,j as a}from"./index-9d63439d.js";import{specificAttemptData as n}from"./Gradebook-8ee8571a.js";import"./RoleDropdown-2d4e4388.js";import"./DropdownMenu-421d3462.js";import"./setPrototypeOf-51e8cf87.js";function b(p){let r=e(o("doenetId")),s=e(o("userId")),i=e(o("attemptNumber")),t=m(n({doenetId:r,userId:s,attemptNumber:i}));return console.log(t.state,t.contents),t.state,t.state==="hasValue"?a("p",{children:t.contents.doenetML}):a("p",{children:t.state})}export{b as default}; diff --git a/dist/assets/GradebookBreadCrumb-1b84d12c.js b/dist/assets/GradebookBreadCrumb-1b84d12c.js deleted file mode 100644 index 269eeee93f..0000000000 --- a/dist/assets/GradebookBreadCrumb-1b84d12c.js +++ /dev/null @@ -1 +0,0 @@ -import{l as m,m as u,j as r,r as t}from"./index-61b6fc23.js";import{B as d}from"./BreadCrumb-593a3cf1.js";import{u as b,a as c,f as i}from"./breadcrumbUtil-59c43d86.js";import"./RoleDropdown-c9fff172.js";import"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";import"./Gradebook-bd1a82d1.js";function x(){const o=m(u("courseId")),s=b(),a=c(o),e=i();return r(t.Suspense,{fallback:r("div",{children:"loading Breadcrumbs..."}),children:r(d,{crumbs:[s,a,...e]})})}export{x as default}; diff --git a/dist/assets/GradebookBreadCrumb-ca81a1ab.js b/dist/assets/GradebookBreadCrumb-ca81a1ab.js new file mode 100644 index 0000000000..38cf5dc8e7 --- /dev/null +++ b/dist/assets/GradebookBreadCrumb-ca81a1ab.js @@ -0,0 +1 @@ +import{l as m,m as u,j as r,r as t}from"./index-9d63439d.js";import{B as d}from"./BreadCrumb-56e53fc8.js";import{u as b,a as c,f as i}from"./breadcrumbUtil-379dd524.js";import"./RoleDropdown-2d4e4388.js";import"./DropdownMenu-421d3462.js";import"./setPrototypeOf-51e8cf87.js";import"./Gradebook-8ee8571a.js";function x(){const o=m(u("courseId")),s=b(),a=c(o),e=i();return r(t.Suspense,{fallback:r("div",{children:"loading Breadcrumbs..."}),children:r(d,{crumbs:[s,a,...e]})})}export{x as default}; diff --git a/dist/assets/GradebookStudent-573d91dc.js b/dist/assets/GradebookStudent-db8cf044.js similarity index 94% rename from dist/assets/GradebookStudent-573d91dc.js rename to dist/assets/GradebookStudent-db8cf044.js index ef98264874..ee7c251cbb 100644 --- a/dist/assets/GradebookStudent-573d91dc.js +++ b/dist/assets/GradebookStudent-db8cf044.js @@ -1 +1 @@ -import{l as x,m as L,R as J,p as K,b as D,I as Q,j as d,N as W,a as P,F as X}from"./index-61b6fc23.js";import{assignmentData as Y,studentData as ee,overviewData as te,gradeCategories as se,Styles as oe,Table as re}from"./Gradebook-bd1a82d1.js";import"./RoleDropdown-c9fff172.js";import"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";function ce(){var B,T;let C=x(L("courseId")),a=x(L("userId"));const k=J(K);let o=D(Y),v=D(ee),I=D(te),M=x(Q(C));if((M==null?void 0:M.canViewCourse)=="0")return d("h1",{children:"No Access to view this page."});let s={};s.headers=[{Header:"Assignment",Footer:"Course Total",accessor:"assignment",disableFilters:!0,disableSortBy:!0}],s.rows=[];let c=0,n=0;if(o.state=="hasValue"&&v.state==="hasValue"&&I.state==="hasValue"&&a!==null&&a!==""){let u=0,V=Object.entries(o.contents);V.sort((g,r)=>g[1].sortOrder0||q{k({page:"course",tool:"gradebookStudentAssignment",view:"",params:{courseId:C,userId:a,doenetId:e,previousCrumb:"student"}})},style:{paddingLeft:"15px"},children:o.contents[e].label});s.rows.push({assignment:E,possiblepoints:y,assignedpoints:j,score:F,percentage:Z})}let G=m.length;m=m.sort((e,t)=>t-e).slice(0,h),w=w.sort((e,t)=>t-e).slice(0,h);let z=m.reduce((e,t)=>e+t,0)*r,U=w.reduce((e,t)=>e+t,0)*r,b=Math.min(z,p),i=Math.min(U,p);N&&(i="-"),S=S.sort((e,t)=>t-e).slice(0,h);let _=S.reduce((e,t)=>e+t,0)*r,l=Math.min(_,p),$="0%";l!==0&&($=Math.round(b/l*1e3)/10+"%"),n+=b,u+=l,i!="-"&&(c+=i,i=Math.round(i*100)/100),b=Math.round(b*100)/100,l=Math.round(l*100)/100;let f=[];G>h&&f.push(`top ${h} scores`),r!==1&&f.push(`rescaling by ${r*100}%`),_>p&&f.push(`a cap of ${p} points`),s.rows.push({assignment:P("b",{children:[`Subtotal for ${g}`,f.length>0&&P("div",{style:{fontSize:".7em"},children:["Based on ",f.join(",")]})]}),score:b,possiblepoints:l,assignedpoints:i,percentage:$})}let R=Math.round(n/u*1e3)/10+"%";n=Math.round(n*100)/100,u=Math.round(u*100)/100,c=Math.round(c*100)/100,s.headers.push({Header:"Possible Points",Footer:u,accessor:"possiblepoints",disableFilters:!0,disableSortBy:!0},{Header:"Assigned Points",Footer:c,accessor:"assignedpoints",disableFilters:!0,disableSortBy:!0},{Header:"Score",Footer:n,accessor:"score",disableFilters:!0,disableSortBy:!0},{Header:"Percentage",Footer:R,accessor:"percentage",disableFilters:!0,disableSortBy:!0})}let O=`${(B=v.contents[a])==null?void 0:B.firstName} ${(T=v.contents[a])==null?void 0:T.lastName}`;return P(X,{children:[d("div",{style:{marginLeft:"18px"},children:P("b",{children:["Gradebook for ",O]})}),d("div",{style:{marginLeft:"18px"},children:P("b",{children:["Current Score ",n,"/",c]})}),d(oe,{children:d(re,{disableSortBy:!0,columns:s.headers,data:s.rows})})]})}export{ce as default}; +import{l as x,m as L,R as J,p as K,b as D,I as Q,j as d,N as W,a as P,F as X}from"./index-9d63439d.js";import{assignmentData as Y,studentData as ee,overviewData as te,gradeCategories as se,Styles as oe,Table as re}from"./Gradebook-8ee8571a.js";import"./RoleDropdown-2d4e4388.js";import"./DropdownMenu-421d3462.js";import"./setPrototypeOf-51e8cf87.js";function ce(){var B,T;let C=x(L("courseId")),a=x(L("userId"));const k=J(K);let o=D(Y),v=D(ee),I=D(te),M=x(Q(C));if((M==null?void 0:M.canViewCourse)=="0")return d("h1",{children:"No Access to view this page."});let s={};s.headers=[{Header:"Assignment",Footer:"Course Total",accessor:"assignment",disableFilters:!0,disableSortBy:!0}],s.rows=[];let c=0,n=0;if(o.state=="hasValue"&&v.state==="hasValue"&&I.state==="hasValue"&&a!==null&&a!==""){let u=0,V=Object.entries(o.contents);V.sort((g,r)=>g[1].sortOrder0||q{k({page:"course",tool:"gradebookStudentAssignment",view:"",params:{courseId:C,userId:a,doenetId:e,previousCrumb:"student"}})},style:{paddingLeft:"15px"},children:o.contents[e].label});s.rows.push({assignment:E,possiblepoints:y,assignedpoints:j,score:F,percentage:Z})}let G=m.length;m=m.sort((e,t)=>t-e).slice(0,h),w=w.sort((e,t)=>t-e).slice(0,h);let z=m.reduce((e,t)=>e+t,0)*r,U=w.reduce((e,t)=>e+t,0)*r,b=Math.min(z,p),i=Math.min(U,p);N&&(i="-"),S=S.sort((e,t)=>t-e).slice(0,h);let _=S.reduce((e,t)=>e+t,0)*r,l=Math.min(_,p),$="0%";l!==0&&($=Math.round(b/l*1e3)/10+"%"),n+=b,u+=l,i!="-"&&(c+=i,i=Math.round(i*100)/100),b=Math.round(b*100)/100,l=Math.round(l*100)/100;let f=[];G>h&&f.push(`top ${h} scores`),r!==1&&f.push(`rescaling by ${r*100}%`),_>p&&f.push(`a cap of ${p} points`),s.rows.push({assignment:P("b",{children:[`Subtotal for ${g}`,f.length>0&&P("div",{style:{fontSize:".7em"},children:["Based on ",f.join(",")]})]}),score:b,possiblepoints:l,assignedpoints:i,percentage:$})}let R=Math.round(n/u*1e3)/10+"%";n=Math.round(n*100)/100,u=Math.round(u*100)/100,c=Math.round(c*100)/100,s.headers.push({Header:"Possible Points",Footer:u,accessor:"possiblepoints",disableFilters:!0,disableSortBy:!0},{Header:"Assigned Points",Footer:c,accessor:"assignedpoints",disableFilters:!0,disableSortBy:!0},{Header:"Score",Footer:n,accessor:"score",disableFilters:!0,disableSortBy:!0},{Header:"Percentage",Footer:R,accessor:"percentage",disableFilters:!0,disableSortBy:!0})}let O=`${(B=v.contents[a])==null?void 0:B.firstName} ${(T=v.contents[a])==null?void 0:T.lastName}`;return P(X,{children:[d("div",{style:{marginLeft:"18px"},children:P("b",{children:["Gradebook for ",O]})}),d("div",{style:{marginLeft:"18px"},children:P("b",{children:["Current Score ",n,"/",c]})}),d(oe,{children:d(re,{disableSortBy:!0,columns:s.headers,data:s.rows})})]})}export{ce as default}; diff --git a/dist/assets/GradebookStudentAssignment-a1c9a735.js b/dist/assets/GradebookStudentAssignment-ff3c95c3.js similarity index 88% rename from dist/assets/GradebookStudentAssignment-a1c9a735.js rename to dist/assets/GradebookStudentAssignment-ff3c95c3.js index 6e951bd381..8272e1a2cf 100644 --- a/dist/assets/GradebookStudentAssignment-a1c9a735.js +++ b/dist/assets/GradebookStudentAssignment-ff3c95c3.js @@ -1 +1 @@ -import{R as C,p as ie,l as c,m as h,b as A,E as de,r as I,I as ce,j as n,a as m,F as W,k as Z}from"./index-61b6fc23.js";import{attemptData as me,studentData as ue,assignmentData as pe,overviewData as fe,Styles as be,Table as he}from"./Gradebook-bd1a82d1.js";import{currentAttemptNumber as ge}from"./AssignmentViewer-ce09819c.js";import{e as we}from"./RoleDropdown-c9fff172.js";import{A as ve}from"./ActivityViewer-5e9601b2.js";import"./activityUtils-3e149527.js";import"./ActionButton-be9a12e7.js";import"./ButtonGroup-6d856500.js";import"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";import"./visibility-sensor-398e690f.js";function Le(){var O,R,j,G,H,_,$,B,U;const ee=C(ie);let g=c(h("courseId")),o=c(h("doenetId")),s=c(h("userId")),w=c(h("attemptNumber")),te=c(h("previousCrumb")),u=A(me(o)),S=A(ue);const L=C(ge);let T=A(pe),{canViewAndModifyGrades:D}=c(we(g));const N=C(de);let se=A(fe);const b=Number((O=T.contents[o])==null?void 0:O.totalPointsOrPercent),ae=(R=T.contents[o])==null?void 0:R.label,x=(G=(j=u==null?void 0:u.contents)==null?void 0:j[s])==null?void 0:G.attempts;let[a,E]=I.useState(null),[l,oe]=I.useState(null),r={},y=0;I.useEffect(()=>{if(x){let e=Object.keys(x).map(Number),t=Math.max(0,...e);w&&w>>>TODO TELL THEM YOU HAVENT TAKEN YET")},[x,E,L,w]),I.useEffect(()=>{N(D!=="1"?["GradeSettings"]:[])},[D,N]);let M=c(ce(g));if((M==null?void 0:M.canViewCourse)=="0")return n("h1",{children:"No Access to view this page."});if(!o||!s)return null;async function re(e,t,i){const{data:{success:v,message:Y,foundAttempt:p,attemptInfo:f,showSolutionInGradebook:le,paginate:q}}=await Z.get("/api/getGradebookAssignmentAttempts.php",{params:{courseId:e,doenetId:t,userId:i}});let k={},J={},P="none";le==="1"&&(P="button");for(let d of f){let K=d.attemptNumber,X=d.variantIndex,z=J[d.cid];if(z)k[K]={cid:d.cid,variantIndex:X,doenetML:z,solutionDisplayMode:P,paginate:q};else{const{data:Q}=await Z.get(`/media/${d.cid}.doenet`);J[d.cid]=Q,k[K]={cid:d.cid,variantIndex:X,doenetML:Q,solutionDisplayMode:P,paginate:q}}}oe(k)}if(l===null)return re(g,o,s),null;if(u.state=="hasValue"&&s!==null&&s!==""&&(y=Math.max(0,...Object.keys(l).map(Number))),r.headers=[{Header:"Score",Footer:"Possible Points",accessor:"score",disableFilters:!0}],r.rows=[],S.state=="hasValue"&&s!==null&&s!==""){let e={},t={};if(e.score="Percentage",t.score="Score",u.state=="hasValue"){for(let p=1;p<=y;p++){let f=u.contents[s].attempts[p];e["a"+p]=f?Math.round(f*1e3)/10+"%":"",t["a"+p]=f?Math.round(f*100*b)/100:""}let i=($=(_=(H=se.contents)==null?void 0:H[s])==null?void 0:_.assignments)==null?void 0:$[o],v=b*i,Y=Math.round(i*1e3)/10+"%";t.total=v,e.total=Y}r.rows.push(t),r.rows.push(e)}r.headers.push({Header:"Assignment Total",Footer:b,accessor:"total",disableFilters:!0});for(let e=1;e<=y;e++)r.headers.push({Header:"Attempt "+e,Footer:b,accessor:"a"+e,disableFilters:!0,Cell:t=>m("a",{onClick:()=>{ee({page:"course",tool:"gradebookStudentAssignment",view:"",params:{courseId:g,doenetId:o,userId:s,attemptNumber:e,previousCrumb:te}})},children:[" ",t.value," "]})});let F=null,V=null;if(a>0&&l[a]){let e=l[a].cid,t=l[a].variantIndex,i=l[a].solutionDisplayMode,v=l[a].paginate;F=n(ve,{cid:e,doenetId:o,userId:s,forceDisable:!0,forceShowCorrectness:!0,forceShowSolution:i!=="none",forceUnsuppressCheckwork:!0,flags:{showCorrectness:!0,readOnly:!0,solutionDisplayMode:i,showFeedback:!0,showHints:!0,autoSubmit:!1,allowLoadState:!0,allowSaveState:!1,allowLocalState:!1,allowSaveSubmissions:!1,allowSaveEvents:!1},attemptNumber:a,requestedVariantIndex:t,paginate:v},`activityViewer${o}`),V=m("div",{style:{paddingLeft:"8px"},children:["Viewing attempt number ",a]})}else V=m("div",{style:{paddingLeft:"8px"},children:["No content available for attempt number ",a]});let ne=`${(B=S.contents[s])==null?void 0:B.firstName} ${(U=S.contents[s])==null?void 0:U.lastName}`;return m(W,{children:[n("div",{style:{marginLeft:"18px"},children:m("b",{children:["Gradebook for ",ne]})}),n("div",{style:{paddingLeft:"18px"},children:n("b",{children:ae})}),m("div",{style:{paddingLeft:"18px"},children:[b," Points Possible"]}),n(be,{children:n(he,{columns:r.headers,data:r.rows})}),a>0?m(W,{children:[V,F]}):n("div",{children:"Click an attempt's grade to see your attempt"})]})}export{Le as default}; +import{R as C,p as ie,l as c,m as h,b as A,E as de,r as I,I as ce,j as n,a as m,F as W,k as Z}from"./index-9d63439d.js";import{attemptData as me,studentData as ue,assignmentData as pe,overviewData as fe,Styles as be,Table as he}from"./Gradebook-8ee8571a.js";import{currentAttemptNumber as ge}from"./AssignmentViewer-07288d77.js";import{e as we}from"./RoleDropdown-2d4e4388.js";import{A as ve}from"./ActivityViewer-90c65d6d.js";import"./activityUtils-5d3d0ed0.js";import"./ActionButton-056b08c3.js";import"./ButtonGroup-ec02b3e9.js";import"./DropdownMenu-421d3462.js";import"./setPrototypeOf-51e8cf87.js";import"./visibility-sensor-aefdbbd5.js";function Le(){var O,R,j,G,H,_,$,B,U;const ee=C(ie);let g=c(h("courseId")),o=c(h("doenetId")),s=c(h("userId")),w=c(h("attemptNumber")),te=c(h("previousCrumb")),u=A(me(o)),S=A(ue);const L=C(ge);let T=A(pe),{canViewAndModifyGrades:D}=c(we(g));const N=C(de);let se=A(fe);const b=Number((O=T.contents[o])==null?void 0:O.totalPointsOrPercent),ae=(R=T.contents[o])==null?void 0:R.label,x=(G=(j=u==null?void 0:u.contents)==null?void 0:j[s])==null?void 0:G.attempts;let[a,E]=I.useState(null),[l,oe]=I.useState(null),r={},y=0;I.useEffect(()=>{if(x){let e=Object.keys(x).map(Number),t=Math.max(0,...e);w&&w>>>TODO TELL THEM YOU HAVENT TAKEN YET")},[x,E,L,w]),I.useEffect(()=>{N(D!=="1"?["GradeSettings"]:[])},[D,N]);let M=c(ce(g));if((M==null?void 0:M.canViewCourse)=="0")return n("h1",{children:"No Access to view this page."});if(!o||!s)return null;async function re(e,t,i){const{data:{success:v,message:Y,foundAttempt:p,attemptInfo:f,showSolutionInGradebook:le,paginate:q}}=await Z.get("/api/getGradebookAssignmentAttempts.php",{params:{courseId:e,doenetId:t,userId:i}});let k={},J={},P="none";le==="1"&&(P="button");for(let d of f){let K=d.attemptNumber,X=d.variantIndex,z=J[d.cid];if(z)k[K]={cid:d.cid,variantIndex:X,doenetML:z,solutionDisplayMode:P,paginate:q};else{const{data:Q}=await Z.get(`/media/${d.cid}.doenet`);J[d.cid]=Q,k[K]={cid:d.cid,variantIndex:X,doenetML:Q,solutionDisplayMode:P,paginate:q}}}oe(k)}if(l===null)return re(g,o,s),null;if(u.state=="hasValue"&&s!==null&&s!==""&&(y=Math.max(0,...Object.keys(l).map(Number))),r.headers=[{Header:"Score",Footer:"Possible Points",accessor:"score",disableFilters:!0}],r.rows=[],S.state=="hasValue"&&s!==null&&s!==""){let e={},t={};if(e.score="Percentage",t.score="Score",u.state=="hasValue"){for(let p=1;p<=y;p++){let f=u.contents[s].attempts[p];e["a"+p]=f?Math.round(f*1e3)/10+"%":"",t["a"+p]=f?Math.round(f*100*b)/100:""}let i=($=(_=(H=se.contents)==null?void 0:H[s])==null?void 0:_.assignments)==null?void 0:$[o],v=b*i,Y=Math.round(i*1e3)/10+"%";t.total=v,e.total=Y}r.rows.push(t),r.rows.push(e)}r.headers.push({Header:"Assignment Total",Footer:b,accessor:"total",disableFilters:!0});for(let e=1;e<=y;e++)r.headers.push({Header:"Attempt "+e,Footer:b,accessor:"a"+e,disableFilters:!0,Cell:t=>m("a",{onClick:()=>{ee({page:"course",tool:"gradebookStudentAssignment",view:"",params:{courseId:g,doenetId:o,userId:s,attemptNumber:e,previousCrumb:te}})},children:[" ",t.value," "]})});let F=null,V=null;if(a>0&&l[a]){let e=l[a].cid,t=l[a].variantIndex,i=l[a].solutionDisplayMode,v=l[a].paginate;F=n(ve,{cid:e,doenetId:o,userId:s,forceDisable:!0,forceShowCorrectness:!0,forceShowSolution:i!=="none",forceUnsuppressCheckwork:!0,flags:{showCorrectness:!0,readOnly:!0,solutionDisplayMode:i,showFeedback:!0,showHints:!0,autoSubmit:!1,allowLoadState:!0,allowSaveState:!1,allowLocalState:!1,allowSaveSubmissions:!1,allowSaveEvents:!1},attemptNumber:a,requestedVariantIndex:t,paginate:v},`activityViewer${o}`),V=m("div",{style:{paddingLeft:"8px"},children:["Viewing attempt number ",a]})}else V=m("div",{style:{paddingLeft:"8px"},children:["No content available for attempt number ",a]});let ne=`${(B=S.contents[s])==null?void 0:B.firstName} ${(U=S.contents[s])==null?void 0:U.lastName}`;return m(W,{children:[n("div",{style:{marginLeft:"18px"},children:m("b",{children:["Gradebook for ",ne]})}),n("div",{style:{paddingLeft:"18px"},children:n("b",{children:ae})}),m("div",{style:{paddingLeft:"18px"},children:[b," Points Possible"]}),n(be,{children:n(he,{columns:r.headers,data:r.rows})}),a>0?m(W,{children:[V,F]}):n("div",{children:"Click an attempt's grade to see your attempt"})]})}export{Le as default}; diff --git a/dist/assets/GroupSettings-950698d0.js b/dist/assets/GroupSettings-b3cf24de.js similarity index 94% rename from dist/assets/GroupSettings-950698d0.js rename to dist/assets/GroupSettings-b3cf24de.js index 074c57c952..291afac1a2 100644 --- a/dist/assets/GroupSettings-950698d0.js +++ b/dist/assets/GroupSettings-b3cf24de.js @@ -1 +1 @@ -import{l as N,m as j,bl as q,y as L,r as b,k as y,z as v,v as V,b1 as z,a as l,j as a,B as G,ay as J}from"./index-61b6fc23.js";import{p as U}from"./index-e425ea7e.js";import{B as I}from"./ButtonGroup-6d856500.js";import{C as Y}from"./CollapseSection-2629b821.js";function $(e,r){switch(r.type){case"mount":return{...r.payload};case"min":return{...e,min:r.payload.min>1?r.payload.min:1,max:e.max{try{const{data:{entries:o}}=await y.get("/api/loadCollection.php",{params:{doenetId:n}});if((o==null?void 0:o.length)>0){const p=S(o),c=S([...m]);y.post("/api/assignCollection.php",{doenetId:n,groups:JSON.stringify(c),entries:JSON.stringify(p)}),t({type:"isReleased",payload:{isReleased:"1"}})}else s("Please add at least one entry to the collection before assigning",v.ERROR)}catch(o){console.error(o)}},[s]);b.useCallback(()=>{},[]);const _=V(({set:n})=>m=>{const o=new FileReader;o.onabort=()=>{},o.onerror=()=>{},o.onload=()=>{U(o.result,{comment:"#"},function(p,c){if(p)console.error(p),s(`CSV invalid – Error: ${p}`,v.ERROR);else{const g=c.shift(),C=g.indexOf("Email"),B=g.indexOf("Group Number"),P=g.indexOf("First Name"),M=g.indexOf("Last Name"),i={namesByGroup:[],emailsByGroup:[]};if(C===-1)s('File missing "Email" column header',v.ERROR);else if(B===-1)s('File missing "Group Number" column header',v.ERROR);else for(let u in c){let x=c[u],h=x[B]-1;i.emailsByGroup[h]||(i.emailsByGroup[h]=[],i.namesByGroup[h]=[]),i.emailsByGroup[h].push(x[C]),i.namesByGroup[h].push({firstName:x[P]??"",lastName:x[M]??""})}for(let u=0;u{let n=!0;async function m(o){try{const p=await y.get("/api/loadGroupSettings.php",{params:{doenetId:o}});n&&t({type:"mount",payload:p.data})}catch(p){console.error(p)}}return e!==""&&m(e),()=>{n=!1,d()}},[e,d]),l("div",{children:[l("label",{children:["Pre-Assigned Groups:",a("input",{type:"checkbox",checked:f==="1",value:f==="1",onChange:n=>{t({type:"preAssigned",payload:{preAssigned:n.target.checked?"1":"0",doenetId:e}})}})]}),a("br",{}),f==="1"?l("div",{children:[l("div",{...F(),children:[a("input",{...T()}),D?a("p",{children:"Drop files here"}):a(I,{children:a(G,{value:"Upload CSV",width:"menu"})})]},"drop"),a("br",{}),l(Y,{title:"Formatting Instructions",collapsed:!0,children:[a("p",{children:"Your file needs to contain email address and group number columns. They can be in any order, but the headers are case sensitive."}),a("p",{children:"Name fields are displayed for convenience – only required data is used to assign the Collection"}),a("div",{children:a("b",{children:"First Name"})}),a("div",{children:a("b",{children:"Last Name"})}),a("div",{children:a("b",{children:"Email (required)"})}),a("div",{children:a("b",{children:"Group Number (required)"})}),a("p",{children:"NOTE: The parser will ignore columns which are not listed."})]})]}):l("div",{children:[l("label",{children:["Min Studnets:",a("input",{type:"number",value:A,onChange:n=>{t({type:"min",payload:{min:n.target.value}})}})]},"min"),a("br",{}),l("label",{children:["Max Students:",a("input",{type:"number",value:w,onChange:n=>{t({type:"max",payload:{max:n.target.value}})}})]},"max"),a("br",{}),l("label",{children:["Preferred Students:",a("input",{type:"number",value:E,onChange:n=>{t({type:"pref",payload:{pref:n.target.value}})}})]},"pref"),a("br",{})]}),a("br",{}),l(I,{vertical:!0,children:[f==="1"?null:a(G,{width:"menu",value:"Save",onClick:()=>{t({type:"save",payload:{doenetId:e}})}}),a(G,{alert:!0,disabled:O==="1",width:"menu",value:"Assign Collection",onClick:()=>{k(e,r)}})]})]})}export{R as csvGroups,X as default}; +import{l as N,m as j,bl as q,y as L,r as b,k as y,z as v,v as V,b1 as z,a as l,j as a,B as G,ay as J}from"./index-9d63439d.js";import{p as U}from"./index-0a95af27.js";import{B as I}from"./ButtonGroup-ec02b3e9.js";import{C as Y}from"./CollapseSection-3723ca05.js";function $(e,r){switch(r.type){case"mount":return{...r.payload};case"min":return{...e,min:r.payload.min>1?r.payload.min:1,max:e.max{try{const{data:{entries:o}}=await y.get("/api/loadCollection.php",{params:{doenetId:n}});if((o==null?void 0:o.length)>0){const p=S(o),c=S([...m]);y.post("/api/assignCollection.php",{doenetId:n,groups:JSON.stringify(c),entries:JSON.stringify(p)}),t({type:"isReleased",payload:{isReleased:"1"}})}else s("Please add at least one entry to the collection before assigning",v.ERROR)}catch(o){console.error(o)}},[s]);b.useCallback(()=>{},[]);const _=V(({set:n})=>m=>{const o=new FileReader;o.onabort=()=>{},o.onerror=()=>{},o.onload=()=>{U(o.result,{comment:"#"},function(p,c){if(p)console.error(p),s(`CSV invalid – Error: ${p}`,v.ERROR);else{const g=c.shift(),C=g.indexOf("Email"),B=g.indexOf("Group Number"),P=g.indexOf("First Name"),M=g.indexOf("Last Name"),i={namesByGroup:[],emailsByGroup:[]};if(C===-1)s('File missing "Email" column header',v.ERROR);else if(B===-1)s('File missing "Group Number" column header',v.ERROR);else for(let u in c){let x=c[u],h=x[B]-1;i.emailsByGroup[h]||(i.emailsByGroup[h]=[],i.namesByGroup[h]=[]),i.emailsByGroup[h].push(x[C]),i.namesByGroup[h].push({firstName:x[P]??"",lastName:x[M]??""})}for(let u=0;u{let n=!0;async function m(o){try{const p=await y.get("/api/loadGroupSettings.php",{params:{doenetId:o}});n&&t({type:"mount",payload:p.data})}catch(p){console.error(p)}}return e!==""&&m(e),()=>{n=!1,d()}},[e,d]),l("div",{children:[l("label",{children:["Pre-Assigned Groups:",a("input",{type:"checkbox",checked:f==="1",value:f==="1",onChange:n=>{t({type:"preAssigned",payload:{preAssigned:n.target.checked?"1":"0",doenetId:e}})}})]}),a("br",{}),f==="1"?l("div",{children:[l("div",{...F(),children:[a("input",{...T()}),D?a("p",{children:"Drop files here"}):a(I,{children:a(G,{value:"Upload CSV",width:"menu"})})]},"drop"),a("br",{}),l(Y,{title:"Formatting Instructions",collapsed:!0,children:[a("p",{children:"Your file needs to contain email address and group number columns. They can be in any order, but the headers are case sensitive."}),a("p",{children:"Name fields are displayed for convenience – only required data is used to assign the Collection"}),a("div",{children:a("b",{children:"First Name"})}),a("div",{children:a("b",{children:"Last Name"})}),a("div",{children:a("b",{children:"Email (required)"})}),a("div",{children:a("b",{children:"Group Number (required)"})}),a("p",{children:"NOTE: The parser will ignore columns which are not listed."})]})]}):l("div",{children:[l("label",{children:["Min Studnets:",a("input",{type:"number",value:A,onChange:n=>{t({type:"min",payload:{min:n.target.value}})}})]},"min"),a("br",{}),l("label",{children:["Max Students:",a("input",{type:"number",value:w,onChange:n=>{t({type:"max",payload:{max:n.target.value}})}})]},"max"),a("br",{}),l("label",{children:["Preferred Students:",a("input",{type:"number",value:E,onChange:n=>{t({type:"pref",payload:{pref:n.target.value}})}})]},"pref"),a("br",{})]}),a("br",{}),l(I,{vertical:!0,children:[f==="1"?null:a(G,{width:"menu",value:"Save",onClick:()=>{t({type:"save",payload:{doenetId:e}})}}),a(G,{alert:!0,disabled:O==="1",width:"menu",value:"Assign Collection",onClick:()=>{k(e,r)}})]})]})}export{R as csvGroups,X as default}; diff --git a/dist/assets/GuestDoenetMLEditor-d3fb52c1.js b/dist/assets/GuestDoenetMLEditor-d3fb52c1.js new file mode 100644 index 0000000000..206fabc0a6 --- /dev/null +++ b/dist/assets/GuestDoenetMLEditor-d3fb52c1.js @@ -0,0 +1 @@ +import{R as a,l as i,r as s,j as e}from"./index-9d63439d.js";import{t as d,u as l}from"./EditorViewerRecoil-4f9a7d1d.js";import{C as u}from"./CodeMirror-af01bb34.js";function x(m){const t=a(d),o=i(l);let r=s.useRef(null);return e("div",{children:e(u,{editorRef:r,setInternalValue:o,onBeforeChange:n=>{t(n)}},"codemirror")})}export{x as default}; diff --git a/dist/assets/GuestDoenetMLEditor-f4597794.js b/dist/assets/GuestDoenetMLEditor-f4597794.js deleted file mode 100644 index a2200857c9..0000000000 --- a/dist/assets/GuestDoenetMLEditor-f4597794.js +++ /dev/null @@ -1 +0,0 @@ -import{R as a,l as i,r as s,j as e}from"./index-61b6fc23.js";import{t as d,u as l}from"./EditorViewerRecoil-fde09b36.js";import{C as u}from"./CodeMirror-d3d9f7d1.js";function x(m){const t=a(d),o=i(l);let r=s.useRef(null);return e("div",{children:e(u,{editorRef:r,setInternalValue:o,onBeforeChange:n=>{t(n)}},"codemirror")})}export{x as default}; diff --git a/dist/assets/GuestEditorViewer-5820e563.js b/dist/assets/GuestEditorViewer-51c16816.js similarity index 90% rename from dist/assets/GuestEditorViewer-5820e563.js rename to dist/assets/GuestEditorViewer-51c16816.js index 3691e9055e..4a5bacd671 100644 --- a/dist/assets/GuestEditorViewer-5820e563.js +++ b/dist/assets/GuestEditorViewer-51c16816.js @@ -1 +1 @@ -import{l as y,m as F,g as _,h as N,R as f,f as T,r,ab as J,u as O,v as $,ac as S,j as w,P as K,k as B,H}from"./index-61b6fc23.js";import{u as q,a as G}from"./EditorViewer-e9155b9a.js";import{p as U}from"./activityUtils-3e149527.js";import{v as E,e as z,r as Q,a as W,u as X,t as Y}from"./EditorViewerRecoil-fde09b36.js";function ie(){const i=y(E),o=y(F("doenetId")),[u,x]=_(N),P=f(T),h=f(z),A=y(Q),I=f(W),[m,C]=r.useState(null),V=q(),[p,l]=r.useState(null),L=f(J);let a=O();const c=r.useRef({}),d=r.useRef(null);r.useEffect(()=>{const e=document.title;return(async()=>{let t=await B.get("/api/getCidForAssignment.php",{params:{doenetId:o,latestAttemptOverrides:!1,publicOnly:!0,userCanViewSourceOnly:!0}}),s;if(!t.data.success||!t.data.cid){t.data.cid?l(`Error loading activity: ${t.data.message}`):l("Error loading activity: public content with public source not found");return}else s=t.data.cid;let g;try{g=await S(s,"doenet")}catch{l("Error loading activity: activity file not found");return}let v=U(g);if(!v.success){l(`Invalid activity definition: ${v.message}`);return}let R=v.activityJSON;C(Z(R.order)),p&&l(null),document.title=`${t.data.label} - Doenet`})().catch(console.error),()=>{document.title=e}},[o]),r.useEffect(()=>{var e,n;d.current!==a.key&&(((e=a.state)==null?void 0:e.previousScrollPosition)!==void 0&&d.current&&(c.current[d.current].lastScrollPosition=a.state.previousScrollPosition),c.current[a.key]&&((n=c.current[a.key])==null?void 0:n.lastScrollPosition)!==void 0&&document.getElementById("mainPanel").scroll({top:c.current[a.key].lastScrollPosition}),c.current[a.key]={...a},d.current=a.key)},[a]),r.useEffect(()=>{const e=document.getElementById("mainPanel");L(e)},[]);let k=$(({snapshot:e,set:n})=>async t=>{const s=await S(t,"doenet");n(X,s),n(Y,s),n(E,s)},[]);if(r.useEffect(()=>(m&&k(m),()=>{h("")}),[m]),G("keydown",e=>{e.keyCode===83&&(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)&&(e.preventDefault(),V())}),p)return w("h1",{children:p});let M=1,b="button";function D(e,n){const t=JSON.parse(JSON.stringify(e));P({index:t.index,allPossibleVariants:n}),x({index:t.index})}return i?w(K,{doenetML:i,flags:{showCorrectness:!0,readOnly:!1,solutionDisplayMode:b,showFeedback:!0,showHints:!0,autoSubmit:!1,allowLoadState:!1,allowSaveState:!1,allowLocalState:!1,allowSaveSubmissions:!1,allowSaveEvents:!1},doenetId:o,attemptNumber:M,generatedVariantCallback:D,requestedVariantIndex:u.index,setIsInErrorState:I,pageIsActive:!0},`pageViewer${A}`):null}function Z(i){if(!(i!=null&&i.content)||i.content.length==0)return null;for(let o of i.content){if(o.type==="page")return o.cid;{let u=H(o.content);if(u)return u}}return null}export{ie as default}; +import{l as y,m as F,g as _,h as N,R as f,f as T,r,ab as J,u as O,v as $,ac as S,j as w,P as K,k as B,H}from"./index-9d63439d.js";import{u as q,a as G}from"./EditorViewer-34bd5cb9.js";import{p as U}from"./activityUtils-5d3d0ed0.js";import{v as E,e as z,r as Q,a as W,u as X,t as Y}from"./EditorViewerRecoil-4f9a7d1d.js";function ie(){const i=y(E),o=y(F("doenetId")),[u,x]=_(N),P=f(T),h=f(z),A=y(Q),I=f(W),[m,C]=r.useState(null),V=q(),[p,l]=r.useState(null),L=f(J);let a=O();const c=r.useRef({}),d=r.useRef(null);r.useEffect(()=>{const e=document.title;return(async()=>{let t=await B.get("/api/getCidForAssignment.php",{params:{doenetId:o,latestAttemptOverrides:!1,publicOnly:!0,userCanViewSourceOnly:!0}}),s;if(!t.data.success||!t.data.cid){t.data.cid?l(`Error loading activity: ${t.data.message}`):l("Error loading activity: public content with public source not found");return}else s=t.data.cid;let g;try{g=await S(s,"doenet")}catch{l("Error loading activity: activity file not found");return}let v=U(g);if(!v.success){l(`Invalid activity definition: ${v.message}`);return}let R=v.activityJSON;C(Z(R.order)),p&&l(null),document.title=`${t.data.label} - Doenet`})().catch(console.error),()=>{document.title=e}},[o]),r.useEffect(()=>{var e,n;d.current!==a.key&&(((e=a.state)==null?void 0:e.previousScrollPosition)!==void 0&&d.current&&(c.current[d.current].lastScrollPosition=a.state.previousScrollPosition),c.current[a.key]&&((n=c.current[a.key])==null?void 0:n.lastScrollPosition)!==void 0&&document.getElementById("mainPanel").scroll({top:c.current[a.key].lastScrollPosition}),c.current[a.key]={...a},d.current=a.key)},[a]),r.useEffect(()=>{const e=document.getElementById("mainPanel");L(e)},[]);let k=$(({snapshot:e,set:n})=>async t=>{const s=await S(t,"doenet");n(X,s),n(Y,s),n(E,s)},[]);if(r.useEffect(()=>(m&&k(m),()=>{h("")}),[m]),G("keydown",e=>{e.keyCode===83&&(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)&&(e.preventDefault(),V())}),p)return w("h1",{children:p});let M=1,b="button";function D(e,n){const t=JSON.parse(JSON.stringify(e));P({index:t.index,allPossibleVariants:n}),x({index:t.index})}return i?w(K,{doenetML:i,flags:{showCorrectness:!0,readOnly:!1,solutionDisplayMode:b,showFeedback:!0,showHints:!0,autoSubmit:!1,allowLoadState:!1,allowSaveState:!1,allowLocalState:!1,allowSaveSubmissions:!1,allowSaveEvents:!1},doenetId:o,attemptNumber:M,generatedVariantCallback:D,requestedVariantIndex:u.index,setIsInErrorState:I,pageIsActive:!0},`pageViewer${A}`):null}function Z(i){if(!(i!=null&&i.content)||i.content.length==0)return null;for(let o of i.content){if(o.type==="page")return o.cid;{let u=H(o.content);if(u)return u}}return null}export{ie as default}; diff --git a/dist/assets/HomeIntroVideo-0d4b59aa.js b/dist/assets/HomeIntroVideo-c749ef29.js similarity index 88% rename from dist/assets/HomeIntroVideo-0d4b59aa.js rename to dist/assets/HomeIntroVideo-c749ef29.js index 9c686bfcb6..18611d3a62 100644 --- a/dist/assets/HomeIntroVideo-0d4b59aa.js +++ b/dist/assets/HomeIntroVideo-c749ef29.js @@ -1,4 +1,4 @@ -import{r as t,j as o,s as a}from"./index-61b6fc23.js";const i=a.video` +import{r as t,j as o,s as a}from"./index-9d63439d.js";const i=a.video` height: 350px; @media (max-width: 780px) { height: 240px; diff --git a/dist/assets/HomePanel-b8b5d089.js b/dist/assets/HomePanel-2c43f60b.js similarity index 99% rename from dist/assets/HomePanel-b8b5d089.js rename to dist/assets/HomePanel-2c43f60b.js index 9df6d893cd..7e5679e57b 100644 --- a/dist/assets/HomePanel-b8b5d089.js +++ b/dist/assets/HomePanel-2c43f60b.js @@ -1,4 +1,4 @@ -import{r as a,e as $,R as V,f as H,g as L,h as P,d as B,a as t,j as e,B as d,C as h,P as E,s as i,i as v,k as j}from"./index-61b6fc23.js";const N=i.div` +import{r as a,e as $,R as V,f as H,g as L,h as P,d as B,a as t,j as e,B as d,C as h,P as E,s as i,i as v,k as j}from"./index-9d63439d.js";const N=i.div` text-align: center; max-width: 800px; display: inline-block; diff --git a/dist/assets/IncrementMenu-5203e1b9.js b/dist/assets/IncrementMenu-999b207e.js similarity index 98% rename from dist/assets/IncrementMenu-5203e1b9.js rename to dist/assets/IncrementMenu-999b207e.js index 75d09c9c77..eb4c2744aa 100644 --- a/dist/assets/IncrementMenu-5203e1b9.js +++ b/dist/assets/IncrementMenu-999b207e.js @@ -1,4 +1,4 @@ -import{r,a as y,j as c,s as u,i as w,bg as N,bh as j}from"./index-61b6fc23.js";const o=[8,9,10,11,12,14,18,24,30,36,48,60,72,96],E=u.div` +import{r,a as y,j as c,s as u,i as w,bg as N,bh as j}from"./index-9d63439d.js";const o=[8,9,10,11,12,14,18,24,30,36,48,60,72,96],E=u.div` display: ${e=>e.label&&!e.vertical&&"flex"}; align-items: ${e=>e.label&&!e.vertical&&"center"}; `,F=u.div` diff --git a/dist/assets/LoadPeople-6c6c8356.js b/dist/assets/LoadPeople-09ed85e1.js similarity index 92% rename from dist/assets/LoadPeople-6c6c8356.js rename to dist/assets/LoadPeople-09ed85e1.js index 3616e8a01e..d85985b88a 100644 --- a/dist/assets/LoadPeople-6c6c8356.js +++ b/dist/assets/LoadPeople-09ed85e1.js @@ -1 +1 @@ -import{y as P,R as c,l as k,m as C,a6 as T,r as d,v as S,k as L,n as _,b1 as D,a as n,j as e,B as w,A as F,ag as l,z as N}from"./index-61b6fc23.js";import{p as j}from"./index-e425ea7e.js";import{B}from"./ButtonGroup-6d856500.js";import{C as z}from"./CollapseSection-2629b821.js";const J=l({key:"peopleTableDataAtom",default:[]}),V=l({key:"processAtom",default:"Idle"}),K=Object.freeze({Email:"Email",FirstName:"FirstName",LastName:"LastName",Section:"Section",ExternalId:"ExternalId"}),O=l({key:"headersAtom",default:[]}),H=l({key:"entriesAtom",default:[]}),M=l({key:"enrolllearnerAtom",default:""}),W=Object.freeze({IDLE:"idle",SELECT:"select",PREVIEW:"preview"});function Q({style:A}){const x=P(),u=c(V),m=c(O),p=c(H),h=k(C("courseId"));let{canAutoEnroll:r}=T(h);const[i,f]=d.useState(r);d.useEffect(()=>{let s=!1;r=="1"&&(s=!0),f(s)},[r]);const v=S(s=>async(t,a)=>{let o=0;a&&(o=1),await L.post("/api/modifyCourse.php",{courseId:t,canAutoEnroll:o}),s(_,R=>{let E={...R};return E.canAutoEnroll=o,E})}),y=d.useCallback(s=>{const t=new FileReader;t.onabort=()=>{},t.onerror=()=>{},t.onload=()=>{j(t.result,{comment:"#"},function(a,o){a!=null&&a.message?x(`${a.message}. Please reformat and try again`,N.ERROR):(m(o[0]),o.shift(),p(o),u(W.PREVIEW))})},t.readAsText(s[0])},[p,m,u]),{getRootProps:I,getInputProps:b,isDragActive:g}=D({onDrop:y});return n("div",{style:A,children:[n("div",{...I(),children:[e("input",{...b(),"data-test":"Import CSV file"}),g?e("p",{children:"Drop the files here"}):e(B,{vertical:!0,children:e(w,{width:"menu",value:"Import CSV file"})})]},"drop"),e("div",{style:{height:"4px"}}),n(z,{title:"Formatting Instructions",collapsed:!0,style:{marginTop:"12px"},children:[e("p",{children:"Your file needs to contain an email address. The parser will ignore columns which are not listed."}),e("div",{children:e("b",{children:"Email (required)"})}),e("div",{children:e("b",{children:"ExternalId"})}),e("div",{children:e("b",{children:"FirstName"})}),e("div",{children:e("b",{children:"LastName"})}),e("div",{children:e("b",{children:"Section"})})]}),n("p",{style:{display:"flex"},children:[e(F,{dataTest:"Auto Enroll",checked:i,onClick:()=>{f(!i),v(h,!i)}})," ",e("span",{style:{marginLeft:"10px"},children:"Auto Enrollment"})," "]})]})}export{W as csvPeopleProcess,Q as default,M as enrolllearnerAtom,H as entriesAtom,O as headersAtom,J as peopleTableDataAtom,V as processAtom,K as validHeaders}; +import{y as P,R as c,l as k,m as C,a6 as T,r as d,v as S,k as L,n as _,b1 as D,a as n,j as e,B as w,A as F,ag as l,z as N}from"./index-9d63439d.js";import{p as j}from"./index-0a95af27.js";import{B}from"./ButtonGroup-ec02b3e9.js";import{C as z}from"./CollapseSection-3723ca05.js";const J=l({key:"peopleTableDataAtom",default:[]}),V=l({key:"processAtom",default:"Idle"}),K=Object.freeze({Email:"Email",FirstName:"FirstName",LastName:"LastName",Section:"Section",ExternalId:"ExternalId"}),O=l({key:"headersAtom",default:[]}),H=l({key:"entriesAtom",default:[]}),M=l({key:"enrolllearnerAtom",default:""}),W=Object.freeze({IDLE:"idle",SELECT:"select",PREVIEW:"preview"});function Q({style:A}){const x=P(),u=c(V),m=c(O),p=c(H),h=k(C("courseId"));let{canAutoEnroll:r}=T(h);const[i,f]=d.useState(r);d.useEffect(()=>{let s=!1;r=="1"&&(s=!0),f(s)},[r]);const v=S(s=>async(t,a)=>{let o=0;a&&(o=1),await L.post("/api/modifyCourse.php",{courseId:t,canAutoEnroll:o}),s(_,R=>{let E={...R};return E.canAutoEnroll=o,E})}),y=d.useCallback(s=>{const t=new FileReader;t.onabort=()=>{},t.onerror=()=>{},t.onload=()=>{j(t.result,{comment:"#"},function(a,o){a!=null&&a.message?x(`${a.message}. Please reformat and try again`,N.ERROR):(m(o[0]),o.shift(),p(o),u(W.PREVIEW))})},t.readAsText(s[0])},[p,m,u]),{getRootProps:I,getInputProps:b,isDragActive:g}=D({onDrop:y});return n("div",{style:A,children:[n("div",{...I(),children:[e("input",{...b(),"data-test":"Import CSV file"}),g?e("p",{children:"Drop the files here"}):e(B,{vertical:!0,children:e(w,{width:"menu",value:"Import CSV file"})})]},"drop"),e("div",{style:{height:"4px"}}),n(z,{title:"Formatting Instructions",collapsed:!0,style:{marginTop:"12px"},children:[e("p",{children:"Your file needs to contain an email address. The parser will ignore columns which are not listed."}),e("div",{children:e("b",{children:"Email (required)"})}),e("div",{children:e("b",{children:"ExternalId"})}),e("div",{children:e("b",{children:"FirstName"})}),e("div",{children:e("b",{children:"LastName"})}),e("div",{children:e("b",{children:"Section"})})]}),n("p",{style:{display:"flex"},children:[e(F,{dataTest:"Auto Enroll",checked:i,onClick:()=>{f(!i),v(h,!i)}})," ",e("span",{style:{marginLeft:"10px"},children:"Auto Enrollment"})," "]})]})}export{W as csvPeopleProcess,Q as default,M as enrolllearnerAtom,H as entriesAtom,O as headersAtom,J as peopleTableDataAtom,V as processAtom,K as validHeaders}; diff --git a/dist/assets/ManageUsersMenu-d49bd6ae.js b/dist/assets/ManageUsersMenu-d49bd6ae.js new file mode 100644 index 0000000000..95393e16e0 --- /dev/null +++ b/dist/assets/ManageUsersMenu-d49bd6ae.js @@ -0,0 +1 @@ +import{l as o,m,j as t}from"./index-9d63439d.js";import{d as i}from"./SettingComponents-aff33cd0.js";import"./CourseToolHandler-d3661515.js";import"./index-df71c5ec.js";import"./index-fcf36459.js";import"./index-47ca4f11.js";import"./index.esm-d6b6ff57.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./ButtonGroup-ec02b3e9.js";import"./CollapseSection-3723ca05.js";import"./util-38d8e238.js";import"./DateTime-b5df08e4.js";import"./moment-a2107d39.js";import"./DropdownMenu-421d3462.js";import"./RelatedItems-23ef0ca1.js";import"./RoleDropdown-2d4e4388.js";import"./Textfield-381b1f5a.js";function y(){const r=o(m("courseId"));return t(i,{courseId:r})}export{y as default}; diff --git a/dist/assets/ManageUsersMenu-efb71d9d.js b/dist/assets/ManageUsersMenu-efb71d9d.js deleted file mode 100644 index 42f631de3c..0000000000 --- a/dist/assets/ManageUsersMenu-efb71d9d.js +++ /dev/null @@ -1 +0,0 @@ -import{l as o,m,j as t}from"./index-61b6fc23.js";import{d as i}from"./SettingComponents-b208ef07.js";import"./CourseToolHandler-d3da4c3a.js";import"./index-1380c04c.js";import"./index-fcf36459.js";import"./index-47ca4f11.js";import"./index.esm-d246f4c9.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./ButtonGroup-6d856500.js";import"./CollapseSection-2629b821.js";import"./util-38d8e238.js";import"./DateTime-3ab576fc.js";import"./moment-b216ba57.js";import"./DropdownMenu-5673dfd7.js";import"./RelatedItems-33d92928.js";import"./RoleDropdown-c9fff172.js";import"./Textfield-637f7b37.js";function y(){const r=o(m("courseId"));return t(i,{courseId:r})}export{y as default}; diff --git a/dist/assets/ManualEnrollment-135fa9ee.js b/dist/assets/ManualEnrollment-b6712969.js similarity index 70% rename from dist/assets/ManualEnrollment-135fa9ee.js rename to dist/assets/ManualEnrollment-b6712969.js index 966b45e744..f74006260b 100644 --- a/dist/assets/ManualEnrollment-135fa9ee.js +++ b/dist/assets/ManualEnrollment-b6712969.js @@ -1 +1 @@ -import{R as t,g as u,l as x,m as h,j as a,a as i,B as v,ae as y,k as E}from"./index-61b6fc23.js";import{processAtom as f,enrolllearnerAtom as _,peopleTableDataAtom as g}from"./LoadPeople-6c6c8356.js";import"./index-e425ea7e.js";import"./ButtonGroup-6d856500.js";import"./CollapseSection-2629b821.js";function b(s){t(f);const[l,m]=u(_);t(g);const o=x(h("driveId")),n=(e,p)=>{if(e){let r={email:e,userId:y(),driveId:p};console.log(">>>>payload",r),E.post("/api/manualEnrollment.php",r).then(c=>{console.log(">>>>resp",c.data)})}};let d=i("div",{children:[i("label",{children:["Email",a("input",{required:!0,type:"email",name:"email",value:l,placeholder:"example@example.com",onChange:e=>m(e.currentTarget.value),onKeyDown:e=>{e.key==="Enter"&&n(l,o)}})]}),a(v,{value:"Enroll",onClick:()=>n(l,o)})]});return a("div",{style:s.style,children:d})}export{b as default}; +import{R as t,g as u,l as x,m as h,j as a,a as i,B as v,ae as y,k as E}from"./index-9d63439d.js";import{processAtom as f,enrolllearnerAtom as _,peopleTableDataAtom as g}from"./LoadPeople-09ed85e1.js";import"./index-0a95af27.js";import"./ButtonGroup-ec02b3e9.js";import"./CollapseSection-3723ca05.js";function b(s){t(f);const[l,m]=u(_);t(g);const o=x(h("driveId")),n=(e,p)=>{if(e){let r={email:e,userId:y(),driveId:p};console.log(">>>>payload",r),E.post("/api/manualEnrollment.php",r).then(c=>{console.log(">>>>resp",c.data)})}};let d=i("div",{children:[i("label",{children:["Email",a("input",{required:!0,type:"email",name:"email",value:l,placeholder:"example@example.com",onChange:e=>m(e.currentTarget.value),onKeyDown:e=>{e.key==="Enter"&&n(l,o)}})]}),a(v,{value:"Enroll",onClick:()=>n(l,o)})]});return a("div",{style:s.style,children:d})}export{b as default}; diff --git a/dist/assets/MathInputKeyboard-9ed12169.js b/dist/assets/MathInputKeyboard-02e2fda4.js similarity index 98% rename from dist/assets/MathInputKeyboard-9ed12169.js rename to dist/assets/MathInputKeyboard-02e2fda4.js index 3f00f2552d..89201bd10f 100644 --- a/dist/assets/MathInputKeyboard-9ed12169.js +++ b/dist/assets/MathInputKeyboard-02e2fda4.js @@ -1,4 +1,4 @@ -import{r as C,l as E,R as V,y as W,j as i,a,i as h,b7 as J,b8 as u,b9 as r,s as d}from"./index-61b6fc23.js";import{T as y}from"./ToggleButton-0b55a995.js";import{T as Q}from"./ToggleButtonGroup-e9ff9889.js";import{f as ii,a as ei,p as ri}from"./MathInputSelector-84e903aa.js";const M=d.div` +import{r as C,l as E,R as V,y as W,j as i,a,i as h,b7 as J,b8 as u,b9 as r,s as d}from"./index-9d63439d.js";import{T as y}from"./ToggleButton-fffa6800.js";import{T as Q}from"./ToggleButtonGroup-0ab38e3a.js";import{f as ii,a as ei,p as ri}from"./MathInputSelector-fa50f67b.js";const M=d.div` height: 240px; // position: fixed; bottom: 0; diff --git a/dist/assets/MathInputSelector-84e903aa.js b/dist/assets/MathInputSelector-fa50f67b.js similarity index 78% rename from dist/assets/MathInputSelector-84e903aa.js rename to dist/assets/MathInputSelector-fa50f67b.js index 23fc752925..94d669ebb1 100644 --- a/dist/assets/MathInputSelector-84e903aa.js +++ b/dist/assets/MathInputSelector-fa50f67b.js @@ -1 +1 @@ -import{ag as e}from"./index-61b6fc23.js";const a=e({key:"focusedMathField",default:()=>{}}),t=e({key:"focusedMathFieldReturn",default:()=>{}}),d=e({key:"palletRef",default:null}),f=e({key:"handleRef",default:null});e({key:"footerPanelToggle",default:!0});export{t as a,a as f,f as h,d as p}; +import{ag as e}from"./index-9d63439d.js";const a=e({key:"focusedMathField",default:()=>{}}),t=e({key:"focusedMathFieldReturn",default:()=>{}}),d=e({key:"palletRef",default:null}),f=e({key:"handleRef",default:null});e({key:"footerPanelToggle",default:!0});export{t as a,a as f,f as h,d as p}; diff --git a/dist/assets/NavigationBreadCrumb-9442e86e.js b/dist/assets/NavigationBreadCrumb-9442e86e.js deleted file mode 100644 index 353e95c802..0000000000 --- a/dist/assets/NavigationBreadCrumb-9442e86e.js +++ /dev/null @@ -1 +0,0 @@ -import{l as s,m as a,j as r,r as u}from"./index-61b6fc23.js";import{B as c}from"./BreadCrumb-593a3cf1.js";import{u as n,a as d,b}from"./breadcrumbUtil-59c43d86.js";import"./RoleDropdown-c9fff172.js";import"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";import"./Gradebook-bd1a82d1.js";function x(){const o=s(a("courseId")),e=s(a("sectionId")),m=n(),t=d(o),i=b(o,e);return r(u.Suspense,{fallback:r("div",{children:"Loading Breadcrumb..."}),children:r(c,{crumbs:[m,t,...i]})})}export{x as default}; diff --git a/dist/assets/NavigationBreadCrumb-dc2c0cfb.js b/dist/assets/NavigationBreadCrumb-dc2c0cfb.js new file mode 100644 index 0000000000..39acf0096c --- /dev/null +++ b/dist/assets/NavigationBreadCrumb-dc2c0cfb.js @@ -0,0 +1 @@ +import{l as s,m as a,j as r,r as u}from"./index-9d63439d.js";import{B as c}from"./BreadCrumb-56e53fc8.js";import{u as n,a as d,b}from"./breadcrumbUtil-379dd524.js";import"./RoleDropdown-2d4e4388.js";import"./DropdownMenu-421d3462.js";import"./setPrototypeOf-51e8cf87.js";import"./Gradebook-8ee8571a.js";function x(){const o=s(a("courseId")),e=s(a("sectionId")),m=n(),t=d(o),i=b(o,e);return r(u.Suspense,{fallback:r("div",{children:"Loading Breadcrumb..."}),children:r(c,{crumbs:[m,t,...i]})})}export{x as default}; diff --git a/dist/assets/NavigationLeave-d3da91ff.js b/dist/assets/NavigationLeave-4b0618a6.js similarity index 83% rename from dist/assets/NavigationLeave-d3da91ff.js rename to dist/assets/NavigationLeave-4b0618a6.js index fc7471ea88..432fafdc0e 100644 --- a/dist/assets/NavigationLeave-d3da91ff.js +++ b/dist/assets/NavigationLeave-4b0618a6.js @@ -1 +1 @@ -import{v as u,T as n,G as s,q as d,ba as r,bb as f}from"./index-61b6fc23.js";function b(){return u(({set:e,snapshot:l})=>async()=>{let i=await l.getPromise(n);for(let o of i)e(s(o),a=>{let t={...a};return t.isSelected=!1,t});e(n,[]),e(d,"");let c=await l.getPromise(r);for(let o of c)e(s(o.doenetId),a=>{let t={...a};return t.isBeingCut=!1,t});e(r,[]),e(f,[])})(),null}export{b as default}; +import{v as u,T as n,G as s,q as d,ba as r,bb as f}from"./index-9d63439d.js";function b(){return u(({set:e,snapshot:l})=>async()=>{let i=await l.getPromise(n);for(let o of i)e(s(o),a=>{let t={...a};return t.isSelected=!1,t});e(n,[]),e(d,"");let c=await l.getPromise(r);for(let o of c)e(s(o.doenetId),a=>{let t={...a};return t.isBeingCut=!1,t});e(r,[]),e(f,[])})(),null}export{b as default}; diff --git a/dist/assets/NavigationPanel-011bc13a.js b/dist/assets/NavigationPanel-09d99c8d.js similarity index 89% rename from dist/assets/NavigationPanel-011bc13a.js rename to dist/assets/NavigationPanel-09d99c8d.js index e28dca6acc..0de3ce5c10 100644 --- a/dist/assets/NavigationPanel-011bc13a.js +++ b/dist/assets/NavigationPanel-09d99c8d.js @@ -1,4 +1,4 @@ -import{l as m,m as A,R as N,E,y as L,r as w,v as b,q as t,G as _,p as d,H as B,I as G,j as i,a as l,U as M,s}from"./index-61b6fc23.js";import{C as D}from"./CourseNavigator-ee468584.js";import{e as k}from"./RoleDropdown-c9fff172.js";import"./index.esm-d246f4c9.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./ButtonGroup-6d856500.js";import"./DropdownMenu-5673dfd7.js";const I=M` +import{l as m,m as A,R as N,E,y as L,r as w,v as b,q as t,G as _,p as d,H as B,I as G,j as i,a as l,U as M,s}from"./index-9d63439d.js";import{C as D}from"./CourseNavigator-f7abeab6.js";import{e as k}from"./RoleDropdown-2d4e4388.js";import"./index.esm-d6b6ff57.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./ButtonGroup-ec02b3e9.js";import"./DropdownMenu-421d3462.js";const I=M` 0% { background-position: -250px 0; } 100% { background-position: 250px 0; } `,R=s.table` diff --git a/dist/assets/Next7Days-938d1df1.js b/dist/assets/Next7Days-1ee7c537.js similarity index 97% rename from dist/assets/Next7Days-938d1df1.js rename to dist/assets/Next7Days-1ee7c537.js index 9e0c5eff5e..feffef4a14 100644 --- a/dist/assets/Next7Days-938d1df1.js +++ b/dist/assets/Next7Days-1ee7c537.js @@ -1 +1 @@ -import{R as ne,p as ae,l as j,S as oe,r as R,v as q,o as se,q as le,k as J,G as ie,H as re,j as t,N as L,a as f,F as de,B as _,i as H,aK as ce,a2 as ue,ag as E,A as ge,aL as me}from"./index-61b6fc23.js";import{g as pe,c as he}from"./CourseToolHandler-d3da4c3a.js";import{B as fe}from"./ButtonGroup-6d856500.js";import{e as be}from"./RoleDropdown-c9fff172.js";const K=E({key:"classTimesAtom",default:[]}),we=E({key:"showCompletedAtom",default:!0}),ye=E({key:"showOverdueAtom",default:!1});function xe(e,b,r,p){if(e=="Invalid Date"||e==null)return null;let u=e.getDay();for(let g of b)if(g.dotwIndex==u){let s=new Date(e.getTime());const[i,h]=g.startTime.split(":");s.setHours(i,h,0,0);let D=new Date(e.getTime());const[$,a]=g.endTime.split(":");if(D.setHours($,a,0,0),e>=s&&el&&e0){let D=!0,$=0;for(let a of r){let n=u.includes(a.doenetId);(i||!i&&!n)&&$++}for(let a=0;a{x.stopPropagation(),p({courseId:n.courseId,doenetId:n.doenetId})},O=u.includes(n.doenetId);if(!i&&O)continue;let C="";if(n.gradeCategory){const x=Number(n.totalPointsOrPercent);let A=Math.round(n.credit*x*100)/100;n.creditOverride&&(A=Math.round(n.creditOverride*x*100)/100),C=`${A}/${x}`}let P=t(ge,{checked:O,onClick:x=>{x.stopPropagation(),l(O?A=>{let M=[...A];return M.splice(M.indexOf(n.doenetId),1),M}:A=>[n.doenetId,...A]),J.get("/api/saveCompleted.php",{params:{doenetId:n.doenetId}})}});D?(D=!1,h.push(f("tr",{"data-test":`cbw row ${a}`,children:[t("td",{"data-test":`cbw row label ${a}`,style:{borderBottom:"2px solid black",padding:"8px"},rowSpan:$,children:B}),t("td",{"data-test":`cbw assignment label ${a}`,style:{backgroundColor:d,padding:"8px",borderBottom:"2px solid black",cursor:"pointer"},onClick:y,children:n.label}),t("td",{"data-test":`cbw assigned date ${a}`,style:{backgroundColor:d,padding:"8px",borderBottom:"2px solid black",cursor:"pointer"},onClick:y,children:v}),t("td",{"data-test":`cbw due date ${a}`,style:{backgroundColor:d,padding:"8px",borderBottom:"2px solid black",cursor:"pointer"},onClick:y,children:T}),t("td",{"data-test":`cbw score ${a}`,style:{backgroundColor:d,padding:"8px",borderBottom:"2px solid black",textAlign:"center"},children:C}),t("td",{"data-test":`cbw completed ${a}`,style:{backgroundColor:d,padding:"8px",borderBottom:"2px solid black",textAlign:"center"},children:P})]},`${B}${n.doenetId}`))):h.push(f("tr",{"data-test":`cbw row ${a}`,children:[t("td",{"data-test":`cbw assignment label ${a}`,style:{backgroundColor:d,padding:"8px",borderBottom:"2px solid black",cursor:"pointer"},onClick:y,children:n.label}),t("td",{"data-test":`cbw assigned date ${a}`,style:{backgroundColor:d,padding:"8px",borderBottom:"2px solid black",cursor:"pointer"},onClick:y,children:v}),t("td",{"data-test":`cbw due date ${a}`,style:{backgroundColor:d,padding:"8px",borderBottom:"2px solid black",cursor:"pointer"},onClick:y,children:T}),t("td",{"data-test":`cbw score ${a}`,style:{backgroundColor:d,padding:"8px",borderBottom:"2px solid black",textAlign:"center"},children:C}),t("td",{"data-test":`cbw completed ${a}`,style:{backgroundColor:d,padding:"8px",borderBottom:"2px solid black",textAlign:"center"},children:P})]},`${B}${n.doenetId}${a}`))}}return h}function Ie({courseId:e}){var G;const b=ne(ae),r=j(we),p=j(ye);oe(e);let[u,l]=R.useState([]),[w,g]=R.useState([]),[s,i]=R.useState([]),[h,D]=R.useState(!1),[$,a]=R.useState(""),[n,k]=R.useState(0),v=j(K),S=j(pe),T=null;((G=S[0])==null?void 0:G.driveInstanceId)==="currentContent"&&(T=S[0].itemId);let B=q(({set:c})=>async m=>{c(se,I=>[...I,{atom:he,value:null},{atom:le,value:null}]);const{data:o}=await J.get("/api/loadTODO.php",{params:{courseId:m}});if(!o.success){a(o.message);return}o.assignments&&(l(o.assignments),g(o.pinned)),o.classTimes&&c(K,o.classTimes),o.completed&&i(o.completed)});const d=q(({set:c,snapshot:m})=>async o=>{const I=o.courseId,W=o.doenetId;let{canEditContent:Z}=await m.getPromise(be(I));if(Z==="1"){let ee=await m.getPromise(ie(W)),te=re(ee.content);b({page:"course",tool:"editor",view:"",params:{doenetId:W,pageId:te}})}else b({page:"course",tool:"assignment",view:"",params:{doenetId:W}})},[]);if(!h&&e!=="")return D(!0),B(e),null;if($!=="")return t("div",{children:t("h2",{children:$})});let y=new Date,O=1-y.getDay();O===1&&(O=-6);let C=new Date(y.getTime()+1e3*60*60*24*O+1e3*60*60*24*n*7),P=new Date(C.getTime()+1e3*60*60*24*6),x=`${C.getMonth()+1}/${C.getDate()}`,A=`${P.getMonth()+1}/${P.getDate()}`,M=[],V=[],Q=f("p",{children:[t(H,{icon:me})," Pinned"]});if(n==0&&(M.push(...N({rowLabel:Q,assignments:w,clickCallback:d,completedArray:s,setCompletedArray:i,classTimes:v,weekShift:n,selectedItemId:T,showCompleted:r})),p)){const c=new Date;let m=[];for(let o of u){const I=L(o.dueDate);if(!I||I>c)break;s.includes(o.doenetId)||m.push(o)}V.push(...N({rowLabel:"Overdue",assignments:m,clickCallback:d,completedArray:s,setCompletedArray:i,classTimes:v,weekShift:n,selectedItemId:T,showCompleted:r}))}let Y=[],z=new Date(C.getTime());z.setHours(0,0,0,0);let U=new Date(P.getTime());U.setHours(23,59,59,999);let F=[[],[],[],[],[],[],[]];for(let c=0;cU)break;let I=o.getDay();F[I].push({...m})}F.push(F.shift());const X=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];for(let[c,m]of Object.entries(F))Y.push(...N({dotw:X[c],assignments:m,clickCallback:d,completedArray:s,setCompletedArray:i,classTimes:v,weekShift:n,selectedItemId:T,showCompleted:r}));return f(de,{children:[f("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-evenly",width:"850px",height:"70px"},children:[f("span",{children:[t(_,{onClick:()=>k(0),value:"This Week"})," "]}),t("h1",{children:"Content by Week"}),f("span",{style:{fontSize:"1.4em"},children:[x," - ",A]}),f(fe,{children:[t("span",{children:t(_,{dataTest:"previous week button",onClick:()=>k(c=>c-1),icon:t(H,{icon:ce})})}),t("span",{children:t(_,{dataTest:"next week button",onClick:()=>k(c=>c+1),icon:t(H,{icon:ue})})})]})]}),f("table",{style:{width:"850px",borderSpacing:"0em .2em"},children:[f("tr",{children:[t("th",{style:{width:"100px",padding:"8px",textAlign:"left",borderBottom:"2px solid black"},children:"Day"}),t("th",{style:{width:"200px",padding:"8px",textAlign:"left",borderBottom:"2px solid black"},children:"Name"}),t("th",{style:{width:"200px",padding:"8px",textAlign:"left",borderBottom:"2px solid black"},children:"Assigned"}),t("th",{style:{width:"200px",padding:"8px",textAlign:"left",borderBottom:"2px solid black"},children:"Due"}),t("th",{style:{width:"50px",padding:"8px",textAlign:"left",borderBottom:"2px solid black"},children:"Score"}),t("th",{style:{width:"100px",padding:"8px",textAlign:"center",borderBottom:"2px solid black"},children:"Completed"})]}),M,V,Y]})]})}export{Ie as N,we as a,K as c,ye as s}; +import{R as ne,p as ae,l as j,S as oe,r as R,v as q,o as se,q as le,k as J,G as ie,H as re,j as t,N as L,a as f,F as de,B as _,i as H,aK as ce,a2 as ue,ag as E,A as ge,aL as me}from"./index-9d63439d.js";import{g as pe,c as he}from"./CourseToolHandler-d3661515.js";import{B as fe}from"./ButtonGroup-ec02b3e9.js";import{e as be}from"./RoleDropdown-2d4e4388.js";const K=E({key:"classTimesAtom",default:[]}),we=E({key:"showCompletedAtom",default:!0}),ye=E({key:"showOverdueAtom",default:!1});function xe(e,b,r,p){if(e=="Invalid Date"||e==null)return null;let u=e.getDay();for(let g of b)if(g.dotwIndex==u){let s=new Date(e.getTime());const[i,h]=g.startTime.split(":");s.setHours(i,h,0,0);let D=new Date(e.getTime());const[$,a]=g.endTime.split(":");if(D.setHours($,a,0,0),e>=s&&el&&e0){let D=!0,$=0;for(let a of r){let n=u.includes(a.doenetId);(i||!i&&!n)&&$++}for(let a=0;a{x.stopPropagation(),p({courseId:n.courseId,doenetId:n.doenetId})},O=u.includes(n.doenetId);if(!i&&O)continue;let C="";if(n.gradeCategory){const x=Number(n.totalPointsOrPercent);let A=Math.round(n.credit*x*100)/100;n.creditOverride&&(A=Math.round(n.creditOverride*x*100)/100),C=`${A}/${x}`}let P=t(ge,{checked:O,onClick:x=>{x.stopPropagation(),l(O?A=>{let M=[...A];return M.splice(M.indexOf(n.doenetId),1),M}:A=>[n.doenetId,...A]),J.get("/api/saveCompleted.php",{params:{doenetId:n.doenetId}})}});D?(D=!1,h.push(f("tr",{"data-test":`cbw row ${a}`,children:[t("td",{"data-test":`cbw row label ${a}`,style:{borderBottom:"2px solid black",padding:"8px"},rowSpan:$,children:B}),t("td",{"data-test":`cbw assignment label ${a}`,style:{backgroundColor:d,padding:"8px",borderBottom:"2px solid black",cursor:"pointer"},onClick:y,children:n.label}),t("td",{"data-test":`cbw assigned date ${a}`,style:{backgroundColor:d,padding:"8px",borderBottom:"2px solid black",cursor:"pointer"},onClick:y,children:v}),t("td",{"data-test":`cbw due date ${a}`,style:{backgroundColor:d,padding:"8px",borderBottom:"2px solid black",cursor:"pointer"},onClick:y,children:T}),t("td",{"data-test":`cbw score ${a}`,style:{backgroundColor:d,padding:"8px",borderBottom:"2px solid black",textAlign:"center"},children:C}),t("td",{"data-test":`cbw completed ${a}`,style:{backgroundColor:d,padding:"8px",borderBottom:"2px solid black",textAlign:"center"},children:P})]},`${B}${n.doenetId}`))):h.push(f("tr",{"data-test":`cbw row ${a}`,children:[t("td",{"data-test":`cbw assignment label ${a}`,style:{backgroundColor:d,padding:"8px",borderBottom:"2px solid black",cursor:"pointer"},onClick:y,children:n.label}),t("td",{"data-test":`cbw assigned date ${a}`,style:{backgroundColor:d,padding:"8px",borderBottom:"2px solid black",cursor:"pointer"},onClick:y,children:v}),t("td",{"data-test":`cbw due date ${a}`,style:{backgroundColor:d,padding:"8px",borderBottom:"2px solid black",cursor:"pointer"},onClick:y,children:T}),t("td",{"data-test":`cbw score ${a}`,style:{backgroundColor:d,padding:"8px",borderBottom:"2px solid black",textAlign:"center"},children:C}),t("td",{"data-test":`cbw completed ${a}`,style:{backgroundColor:d,padding:"8px",borderBottom:"2px solid black",textAlign:"center"},children:P})]},`${B}${n.doenetId}${a}`))}}return h}function Ie({courseId:e}){var G;const b=ne(ae),r=j(we),p=j(ye);oe(e);let[u,l]=R.useState([]),[w,g]=R.useState([]),[s,i]=R.useState([]),[h,D]=R.useState(!1),[$,a]=R.useState(""),[n,k]=R.useState(0),v=j(K),S=j(pe),T=null;((G=S[0])==null?void 0:G.driveInstanceId)==="currentContent"&&(T=S[0].itemId);let B=q(({set:c})=>async m=>{c(se,I=>[...I,{atom:he,value:null},{atom:le,value:null}]);const{data:o}=await J.get("/api/loadTODO.php",{params:{courseId:m}});if(!o.success){a(o.message);return}o.assignments&&(l(o.assignments),g(o.pinned)),o.classTimes&&c(K,o.classTimes),o.completed&&i(o.completed)});const d=q(({set:c,snapshot:m})=>async o=>{const I=o.courseId,W=o.doenetId;let{canEditContent:Z}=await m.getPromise(be(I));if(Z==="1"){let ee=await m.getPromise(ie(W)),te=re(ee.content);b({page:"course",tool:"editor",view:"",params:{doenetId:W,pageId:te}})}else b({page:"course",tool:"assignment",view:"",params:{doenetId:W}})},[]);if(!h&&e!=="")return D(!0),B(e),null;if($!=="")return t("div",{children:t("h2",{children:$})});let y=new Date,O=1-y.getDay();O===1&&(O=-6);let C=new Date(y.getTime()+1e3*60*60*24*O+1e3*60*60*24*n*7),P=new Date(C.getTime()+1e3*60*60*24*6),x=`${C.getMonth()+1}/${C.getDate()}`,A=`${P.getMonth()+1}/${P.getDate()}`,M=[],V=[],Q=f("p",{children:[t(H,{icon:me})," Pinned"]});if(n==0&&(M.push(...N({rowLabel:Q,assignments:w,clickCallback:d,completedArray:s,setCompletedArray:i,classTimes:v,weekShift:n,selectedItemId:T,showCompleted:r})),p)){const c=new Date;let m=[];for(let o of u){const I=L(o.dueDate);if(!I||I>c)break;s.includes(o.doenetId)||m.push(o)}V.push(...N({rowLabel:"Overdue",assignments:m,clickCallback:d,completedArray:s,setCompletedArray:i,classTimes:v,weekShift:n,selectedItemId:T,showCompleted:r}))}let Y=[],z=new Date(C.getTime());z.setHours(0,0,0,0);let U=new Date(P.getTime());U.setHours(23,59,59,999);let F=[[],[],[],[],[],[],[]];for(let c=0;cU)break;let I=o.getDay();F[I].push({...m})}F.push(F.shift());const X=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];for(let[c,m]of Object.entries(F))Y.push(...N({dotw:X[c],assignments:m,clickCallback:d,completedArray:s,setCompletedArray:i,classTimes:v,weekShift:n,selectedItemId:T,showCompleted:r}));return f(de,{children:[f("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-evenly",width:"850px",height:"70px"},children:[f("span",{children:[t(_,{onClick:()=>k(0),value:"This Week"})," "]}),t("h1",{children:"Content by Week"}),f("span",{style:{fontSize:"1.4em"},children:[x," - ",A]}),f(fe,{children:[t("span",{children:t(_,{dataTest:"previous week button",onClick:()=>k(c=>c-1),icon:t(H,{icon:ce})})}),t("span",{children:t(_,{dataTest:"next week button",onClick:()=>k(c=>c+1),icon:t(H,{icon:ue})})})]})]}),f("table",{style:{width:"850px",borderSpacing:"0em .2em"},children:[f("tr",{children:[t("th",{style:{width:"100px",padding:"8px",textAlign:"left",borderBottom:"2px solid black"},children:"Day"}),t("th",{style:{width:"200px",padding:"8px",textAlign:"left",borderBottom:"2px solid black"},children:"Name"}),t("th",{style:{width:"200px",padding:"8px",textAlign:"left",borderBottom:"2px solid black"},children:"Assigned"}),t("th",{style:{width:"200px",padding:"8px",textAlign:"left",borderBottom:"2px solid black"},children:"Due"}),t("th",{style:{width:"50px",padding:"8px",textAlign:"left",borderBottom:"2px solid black"},children:"Score"}),t("th",{style:{width:"100px",padding:"8px",textAlign:"center",borderBottom:"2px solid black"},children:"Completed"})]}),M,V,Y]})]})}export{Ie as N,we as a,K as c,ye as s}; diff --git a/dist/assets/NotFound-36641b62.js b/dist/assets/NotFound-dedd3d97.js similarity index 76% rename from dist/assets/NotFound-36641b62.js rename to dist/assets/NotFound-dedd3d97.js index aa10c5237f..978c62b9b3 100644 --- a/dist/assets/NotFound-36641b62.js +++ b/dist/assets/NotFound-dedd3d97.js @@ -1 +1 @@ -import{u as s,j as n,a}from"./index-61b6fc23.js";function c(o){const e=s();let t=Object.fromEntries(new URLSearchParams(e.search));return n("div",{style:o.style,children:a("h1",{children:['Sorry! "',t==null?void 0:t.path,'" was not found.']})})}export{c as default}; +import{u as s,j as n,a}from"./index-9d63439d.js";function c(o){const e=s();let t=Object.fromEntries(new URLSearchParams(e.search));return n("div",{style:o.style,children:a("h1",{children:['Sorry! "',t==null?void 0:t.path,'" was not found.']})})}export{c as default}; diff --git a/dist/assets/PageLink-b488e3e3.js b/dist/assets/PageLink-35890666.js similarity index 71% rename from dist/assets/PageLink-b488e3e3.js rename to dist/assets/PageLink-35890666.js index 5a9a70a3d7..646eb903ee 100644 --- a/dist/assets/PageLink-b488e3e3.js +++ b/dist/assets/PageLink-35890666.js @@ -1 +1 @@ -import{y as u,l as o,m as t,w as l,j as g,k as y,z as L}from"./index-61b6fc23.js";import{c as f}from"./index-fcf36459.js";import{A as I}from"./ActionButton-be9a12e7.js";import{v as k}from"./EditorViewerRecoil-fde09b36.js";function w(){const s=u(),a=o(t("pageId")),n=o(t("doenetId")),i=o(l),d=o(k);async function r(){let c={doenetML:d,pageId:a,courseId:i,saveAsCid:!0};const{data:e}=await y.post("/api/saveDoenetML.php",c);if(!e.success){console.error(e.message),s(e.message,L.ERROR);return}let p=e.cid,m=``;f(m)}return g(I,{width:"menu",dataTest:"Copy Page Link",value:"Copy Page Link",onClick:r})}export{w as default}; +import{y as u,l as o,m as t,w as l,j as g,k as y,z as L}from"./index-9d63439d.js";import{c as f}from"./index-fcf36459.js";import{A as I}from"./ActionButton-056b08c3.js";import{v as k}from"./EditorViewerRecoil-4f9a7d1d.js";function w(){const s=u(),a=o(t("pageId")),n=o(t("doenetId")),i=o(l),d=o(k);async function r(){let c={doenetML:d,pageId:a,courseId:i,saveAsCid:!0};const{data:e}=await y.post("/api/saveDoenetML.php",c);if(!e.success){console.error(e.message),s(e.message,L.ERROR);return}let p=e.cid,m=``;f(m)}return g(I,{width:"menu",dataTest:"Copy Page Link",value:"Copy Page Link",onClick:r})}export{w as default}; diff --git a/dist/assets/PageVariant-43e029f7.js b/dist/assets/PageVariant-7671ba27.js similarity index 94% rename from dist/assets/PageVariant-43e029f7.js rename to dist/assets/PageVariant-7671ba27.js index 09c694946b..00a36c4465 100644 --- a/dist/assets/PageVariant-43e029f7.js +++ b/dist/assets/PageVariant-7671ba27.js @@ -1 +1 @@ -import{g as d,h as f,f as m,j as r,a as i}from"./index-61b6fc23.js";function p(u){const[c,o]=d(f),[n,v]=d(m);function s(){n.index!==c.index&&o(e=>{let a={...e};return a.index=Number.isFinite(Number(n.index))?Number(n.index):0,a})}let l=[];n.allPossibleVariants&&(l=n.allPossibleVariants);let x=l.map(function(e,a){return r("option",{value:a+1,children:e},a+1)}),b={...u.style};return i("div",{style:b,children:[i("div",{children:["Number of variants: ",l.length]}),r("div",{children:i("label",{children:["Select variant Index ",r("input",{"data-test":"Variant Index Input",type:"text",value:n.index,onKeyDown:e=>{e.key==="Enter"&&s()},onBlur:()=>s(),onChange:e=>{v(a=>{let t={...a};return t.index=e.target.value,t})}})]})}),r("div",{children:i("label",{children:["Select variant name",r("select",{"data-test":"Variant Name Input",style:{backgroundColor:"var(--canvas)",color:"var(--canvastext)",border:"var(--mainBorder)",borderRadius:"var(--mainBorderRadius)"},value:n.index,onChange:e=>{o(a=>{let t={...a};return t.index=e.target.value,t})},children:x})]})})]})}export{p as default}; +import{g as d,h as f,f as m,j as r,a as i}from"./index-9d63439d.js";function p(u){const[c,o]=d(f),[n,v]=d(m);function s(){n.index!==c.index&&o(e=>{let a={...e};return a.index=Number.isFinite(Number(n.index))?Number(n.index):0,a})}let l=[];n.allPossibleVariants&&(l=n.allPossibleVariants);let x=l.map(function(e,a){return r("option",{value:a+1,children:e},a+1)}),b={...u.style};return i("div",{style:b,children:[i("div",{children:["Number of variants: ",l.length]}),r("div",{children:i("label",{children:["Select variant Index ",r("input",{"data-test":"Variant Index Input",type:"text",value:n.index,onKeyDown:e=>{e.key==="Enter"&&s()},onBlur:()=>s(),onChange:e=>{v(a=>{let t={...a};return t.index=e.target.value,t})}})]})}),r("div",{children:i("label",{children:["Select variant name",r("select",{"data-test":"Variant Name Input",style:{backgroundColor:"var(--canvas)",color:"var(--canvastext)",border:"var(--mainBorder)",borderRadius:"var(--mainBorderRadius)"},value:n.index,onChange:e=>{o(a=>{let t={...a};return t.index=e.target.value,t})},children:x})]})})]})}export{p as default}; diff --git a/dist/assets/People-155b4d87.js b/dist/assets/People-27f6f91c.js similarity index 87% rename from dist/assets/People-155b4d87.js rename to dist/assets/People-27f6f91c.js index 9ea790fe09..13abdf88fe 100644 --- a/dist/assets/People-155b4d87.js +++ b/dist/assets/People-27f6f91c.js @@ -1,4 +1,4 @@ -import{l as R,m as F,a5 as J,a6 as X,r as w,g as G,a as h,j as e,B as P,A as q,s as f}from"./index-61b6fc23.js";import{A as K}from"./SettingComponents-b208ef07.js";import{M as L}from"./index.esm-d246f4c9.js";import{R as E}from"./RoleDropdown-c9fff172.js";import{processAtom as Q,headersAtom as Y,entriesAtom as Z,csvPeopleProcess as W,validHeaders as m}from"./LoadPeople-6c6c8356.js";import{B as C}from"./ButtonGroup-6d856500.js";import"./CourseToolHandler-d3da4c3a.js";import"./index-1380c04c.js";import"./index-fcf36459.js";import"./index-47ca4f11.js";/* empty css */import"./CollapseSection-2629b821.js";import"./util-38d8e238.js";import"./DateTime-3ab576fc.js";import"./moment-b216ba57.js";import"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";import"./RelatedItems-33d92928.js";import"./Textfield-637f7b37.js";import"./index-e425ea7e.js";const N=f.div` +import{l as R,m as F,a5 as J,a6 as X,r as w,g as G,a as h,j as e,B as P,A as q,s as f}from"./index-9d63439d.js";import{A as K}from"./SettingComponents-aff33cd0.js";import{M as L}from"./index.esm-d6b6ff57.js";import{R as E}from"./RoleDropdown-2d4e4388.js";import{processAtom as Q,headersAtom as Y,entriesAtom as Z,csvPeopleProcess as W,validHeaders as m}from"./LoadPeople-09ed85e1.js";import{B as C}from"./ButtonGroup-ec02b3e9.js";import"./CourseToolHandler-d3661515.js";import"./index-df71c5ec.js";import"./index-fcf36459.js";import"./index-47ca4f11.js";/* empty css */import"./CollapseSection-3723ca05.js";import"./util-38d8e238.js";import"./DateTime-b5df08e4.js";import"./moment-a2107d39.js";import"./DropdownMenu-421d3462.js";import"./setPrototypeOf-51e8cf87.js";import"./RelatedItems-23ef0ca1.js";import"./Textfield-381b1f5a.js";import"./index-0a95af27.js";const N=f.div` margin: 0 5px 10px 5px; display: ${t=>t.flex?"flex":"block"}; align-items: ${t=>t.flex&&"center"}; diff --git a/dist/assets/PeopleBreadCrumb-01e59fc2.js b/dist/assets/PeopleBreadCrumb-01e59fc2.js new file mode 100644 index 0000000000..f9e68bb401 --- /dev/null +++ b/dist/assets/PeopleBreadCrumb-01e59fc2.js @@ -0,0 +1 @@ +import{l as m,m as u,j as r,r as t}from"./index-9d63439d.js";import{B as c}from"./BreadCrumb-56e53fc8.js";import{u as i,a as d,c as p}from"./breadcrumbUtil-379dd524.js";import"./RoleDropdown-2d4e4388.js";import"./DropdownMenu-421d3462.js";import"./setPrototypeOf-51e8cf87.js";import"./Gradebook-8ee8571a.js";function B(){const o=m(u("courseId")),s=i(),e=d(o),a=p(o);return r(t.Suspense,{fallback:r("div",{children:"loading Breadcrumbs..."}),children:r(c,{crumbs:[s,e,a]})})}export{B as default}; diff --git a/dist/assets/PeopleBreadCrumb-d799c6ff.js b/dist/assets/PeopleBreadCrumb-d799c6ff.js deleted file mode 100644 index 16f742a02a..0000000000 --- a/dist/assets/PeopleBreadCrumb-d799c6ff.js +++ /dev/null @@ -1 +0,0 @@ -import{l as m,m as u,j as r,r as t}from"./index-61b6fc23.js";import{B as c}from"./BreadCrumb-593a3cf1.js";import{u as i,a as d,c as p}from"./breadcrumbUtil-59c43d86.js";import"./RoleDropdown-c9fff172.js";import"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";import"./Gradebook-bd1a82d1.js";function B(){const o=m(u("courseId")),s=i(),e=d(o),a=p(o);return r(t.Suspense,{fallback:r("div",{children:"loading Breadcrumbs..."}),children:r(c,{crumbs:[s,e,a]})})}export{B as default}; diff --git a/dist/assets/PortfolioBreadCrumb-6606c534.js b/dist/assets/PortfolioBreadCrumb-b9513dfa.js similarity index 68% rename from dist/assets/PortfolioBreadCrumb-6606c534.js rename to dist/assets/PortfolioBreadCrumb-b9513dfa.js index d301e90737..e5a033fc7e 100644 --- a/dist/assets/PortfolioBreadCrumb-6606c534.js +++ b/dist/assets/PortfolioBreadCrumb-b9513dfa.js @@ -1 +1 @@ -import{e as s,a4 as l,j as a,r as i}from"./index-61b6fc23.js";import{B as n}from"./BreadCrumb-593a3cf1.js";function u(){const o=s();let e=l();const{label:r,courseId:t}=e;return a(i.Suspense,{fallback:a("div",{children:"Loading Breadcrumb..."}),children:a(n,{crumbs:[{label:"Portfolio",onClick:()=>{o(`/portfolio/${t}`)}},{label:r,onClick:()=>{console.log("Rename?")}}],offset:68})})}export{u as default}; +import{e as s,a4 as l,j as a,r as i}from"./index-9d63439d.js";import{B as n}from"./BreadCrumb-56e53fc8.js";function u(){const o=s();let e=l();const{label:r,courseId:t}=e;return a(i.Suspense,{fallback:a("div",{children:"Loading Breadcrumb..."}),children:a(n,{crumbs:[{label:"Portfolio",onClick:()=>{o(`/portfolio/${t}`)}},{label:r,onClick:()=>{console.log("Rename?")}}],offset:68})})}export{u as default}; diff --git a/dist/assets/PublicActivityViewer-527e45ef.js b/dist/assets/PublicActivityViewer-c7720a07.js similarity index 71% rename from dist/assets/PublicActivityViewer-527e45ef.js rename to dist/assets/PublicActivityViewer-c7720a07.js index 4152a68f8b..07d7b56704 100644 --- a/dist/assets/PublicActivityViewer-527e45ef.js +++ b/dist/assets/PublicActivityViewer-c7720a07.js @@ -1 +1 @@ -import{l as c,m as u,r as s,j as l,F as d,k as m}from"./index-61b6fc23.js";import{A as p}from"./ActivityViewer-5e9601b2.js";import"./activityUtils-3e149527.js";import"./visibility-sensor-398e690f.js";import"./ActionButton-be9a12e7.js";import"./ButtonGroup-6d856500.js";function E(f){const e=c(u("doenetId")),[i,r]=s.useState(null),[o,a]=s.useState(null);return s.useEffect(()=>{const n=document.title;return(async()=>{let t=await m.get("/api/getCidForAssignment.php",{params:{doenetId:e,latestAttemptOverrides:!1,publicOnly:!0}});!t.data.success||!t.data.cid?(r(null),t.data.cid?a(`Error loading activity: ${t.data.message}`):a("Error loading activity: public content not found")):(r(t.data.cid),a(null),document.title=`${t.data.label} - Doenet`)})().catch(console.error),()=>{document.title=n}},e),o?l("h1",{children:o}):i?l(d,{children:l(p,{cid:i,doenetId:e,flags:{showCorrectness:!0,readOnly:!1,solutionDisplayMode:"button",showFeedback:!0,showHints:!0,autoSubmit:!1,allowLoadState:!1,allowSaveState:!1,allowLocalState:!1,allowSaveSubmissions:!1,allowSaveEvents:!1},paginate:!0},`activityViewer${e}`)}):null}export{E as default}; +import{l as c,m as u,r as s,j as l,F as d,k as m}from"./index-9d63439d.js";import{A as p}from"./ActivityViewer-90c65d6d.js";import"./activityUtils-5d3d0ed0.js";import"./visibility-sensor-aefdbbd5.js";import"./ActionButton-056b08c3.js";import"./ButtonGroup-ec02b3e9.js";function E(f){const e=c(u("doenetId")),[i,r]=s.useState(null),[o,a]=s.useState(null);return s.useEffect(()=>{const n=document.title;return(async()=>{let t=await m.get("/api/getCidForAssignment.php",{params:{doenetId:e,latestAttemptOverrides:!1,publicOnly:!0}});!t.data.success||!t.data.cid?(r(null),t.data.cid?a(`Error loading activity: ${t.data.message}`):a("Error loading activity: public content not found")):(r(t.data.cid),a(null),document.title=`${t.data.label} - Doenet`)})().catch(console.error),()=>{document.title=n}},e),o?l("h1",{children:o}):i?l(d,{children:l(p,{cid:i,doenetId:e,flags:{showCorrectness:!0,readOnly:!1,solutionDisplayMode:"button",showFeedback:!0,showHints:!0,autoSubmit:!1,allowLoadState:!1,allowSaveState:!1,allowLocalState:!1,allowSaveSubmissions:!1,allowSaveEvents:!1},paginate:!0},`activityViewer${e}`)}):null}export{E as default}; diff --git a/dist/assets/RelatedItems-33d92928.js b/dist/assets/RelatedItems-23ef0ca1.js similarity index 96% rename from dist/assets/RelatedItems-33d92928.js rename to dist/assets/RelatedItems-23ef0ca1.js index dd8a2f4824..df632bd0a9 100644 --- a/dist/assets/RelatedItems-33d92928.js +++ b/dist/assets/RelatedItems-23ef0ca1.js @@ -1,4 +1,4 @@ -import{a as g,j as d,s as a}from"./index-61b6fc23.js";const x=a.div` +import{a as g,j as d,s as a}from"./index-9d63439d.js";const x=a.div` display: ${e=>e.align}; width: auto; align-items: center; diff --git a/dist/assets/RoleDropdown-c9fff172.js b/dist/assets/RoleDropdown-2d4e4388.js similarity index 83% rename from dist/assets/RoleDropdown-c9fff172.js rename to dist/assets/RoleDropdown-2d4e4388.js index 968ef46e10..222795bf21 100644 --- a/dist/assets/RoleDropdown-c9fff172.js +++ b/dist/assets/RoleDropdown-2d4e4388.js @@ -1 +1 @@ -import{ay as x,az as y,aF as R,I as p,l as t,m as _,aG as v,j as B}from"./index-61b6fc23.js";import{D as C}from"./DropdownMenu-5673dfd7.js";const D=x({key:"effectiveRoleId",default:null}),j=y({key:"effectivePermissions",get:e=>({get:s})=>{const n=s(D(e));return s(n!==null?R({courseId:e,roleId:n}):p(e))}});function k({label:e,width:s="menu",maxMenuHeight:n="200px",defaultRoleId:a,valueRoleId:i,onChange:d=()=>{},vertical:l,disabled:u}){const c=t(_("courseId"))??"",r=t(v(c)),f=i?r.findIndex(({roleId:o})=>o===i):null,m=a?r.findIndex(({roleId:o})=>o===a):null;return B(C,{width:s,maxMenuHeight:n,items:r.map(({roleLabel:o,roleId:I})=>[I,o]),label:e,defaultIndex:m+1,valueIndex:f+1,onChange:d,vertical:l,disabled:u,dataTest:"RoleDropDown"})}export{k as R,D as a,j as e}; +import{ay as x,az as y,aF as R,I as p,l as t,m as _,aG as v,j as B}from"./index-9d63439d.js";import{D as C}from"./DropdownMenu-421d3462.js";const D=x({key:"effectiveRoleId",default:null}),j=y({key:"effectivePermissions",get:e=>({get:s})=>{const n=s(D(e));return s(n!==null?R({courseId:e,roleId:n}):p(e))}});function k({label:e,width:s="menu",maxMenuHeight:n="200px",defaultRoleId:a,valueRoleId:i,onChange:d=()=>{},vertical:l,disabled:u}){const c=t(_("courseId"))??"",r=t(v(c)),f=i?r.findIndex(({roleId:o})=>o===i):null,m=a?r.findIndex(({roleId:o})=>o===a):null;return B(C,{width:s,maxMenuHeight:n,items:r.map(({roleLabel:o,roleId:I})=>[I,o]),label:e,defaultIndex:m+1,valueIndex:f+1,onChange:d,vertical:l,disabled:u,dataTest:"RoleDropDown"})}export{k as R,D as a,j as e}; diff --git a/dist/assets/RoleEditor-29021e6b.js b/dist/assets/RoleEditor-29021e6b.js new file mode 100644 index 0000000000..3f0ac7257d --- /dev/null +++ b/dist/assets/RoleEditor-29021e6b.js @@ -0,0 +1,3 @@ +import{l as r,m as t,I as m,a as e,j as i,s as p}from"./index-9d63439d.js";import{a as n,M as a}from"./SettingComponents-aff33cd0.js";import"./CourseToolHandler-d3661515.js";import"./index-df71c5ec.js";import"./index-fcf36459.js";import"./index-47ca4f11.js";import"./index.esm-d6b6ff57.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./ButtonGroup-ec02b3e9.js";import"./CollapseSection-3723ca05.js";import"./util-38d8e238.js";import"./DateTime-b5df08e4.js";import"./moment-a2107d39.js";import"./DropdownMenu-421d3462.js";import"./RelatedItems-23ef0ca1.js";import"./RoleDropdown-2d4e4388.js";import"./Textfield-381b1f5a.js";const d=p.div` + padding: 10px; +`;function B(){const o=r(t("courseId")),{isAdmin:s}=r(m(o));return s!=="1"?null:e(d,{children:[i("h2",{children:"Edit Role Permissions"}),i(n,{courseId:o}),i(a,{courseId:o})]})}export{B as default}; diff --git a/dist/assets/RoleEditor-94b29764.js b/dist/assets/RoleEditor-94b29764.js deleted file mode 100644 index 8c3b0355f8..0000000000 --- a/dist/assets/RoleEditor-94b29764.js +++ /dev/null @@ -1,3 +0,0 @@ -import{l as r,m as t,I as m,a as e,j as i,s as p}from"./index-61b6fc23.js";import{a as n,M as a}from"./SettingComponents-b208ef07.js";import"./CourseToolHandler-d3da4c3a.js";import"./index-1380c04c.js";import"./index-fcf36459.js";import"./index-47ca4f11.js";import"./index.esm-d246f4c9.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./ButtonGroup-6d856500.js";import"./CollapseSection-2629b821.js";import"./util-38d8e238.js";import"./DateTime-3ab576fc.js";import"./moment-b216ba57.js";import"./DropdownMenu-5673dfd7.js";import"./RelatedItems-33d92928.js";import"./RoleDropdown-c9fff172.js";import"./Textfield-637f7b37.js";const d=p.div` - padding: 10px; -`;function B(){const o=r(t("courseId")),{isAdmin:s}=r(m(o));return s!=="1"?null:e(d,{children:[i("h2",{children:"Edit Role Permissions"}),i(n,{courseId:o}),i(a,{courseId:o})]})}export{B as default}; diff --git a/dist/assets/SelectedActivity-416f6fd9.js b/dist/assets/SelectedActivity-ceb05ae5.js similarity index 84% rename from dist/assets/SelectedActivity-416f6fd9.js rename to dist/assets/SelectedActivity-ceb05ae5.js index 30f9b95b96..1ed813120d 100644 --- a/dist/assets/SelectedActivity-416f6fd9.js +++ b/dist/assets/SelectedActivity-ceb05ae5.js @@ -1 +1 @@ -import{l as u,m as k,T as I,R as D,p as S,G as L,a6 as x,r as b,y as F,H as V,a as s,F as h,j as e,z as B,B as f,i as O,X as R,ag as E}from"./index-61b6fc23.js";import{A as G,u as M,a as _,b as j,D as X,T as J,c as N,d as z,e as H,G as U,I as q,f as K,S as W,g as Q,h as Y,i as Z,j as $,k as ee,P as te,l as ie,m as ae,n as se,M as ne,o as oe,C as le,p as re}from"./SettingComponents-d7858e0f.js";import{A as g}from"./ActionButton-be9a12e7.js";import{A as de}from"./ActionButtonGroup-f3a36748.js";import{B as ce}from"./ButtonGroup-6d856500.js";import{e as P}from"./RoleDropdown-c9fff172.js";import{T as me}from"./Textfield-637f7b37.js";import"./DateTime-3ab576fc.js";import"./moment-b216ba57.js";import"./IncrementMenu-5203e1b9.js";import"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";import"./RelatedItems-33d92928.js";import"./useSaveDraft-fc810696.js";import"./EditorViewerRecoil-fde09b36.js";function Ie(){const o=u(k("courseId")),i=u(I)[0],r=D(S),{canEditContent:w}=u(P(o)),{label:n,content:p}=u(L(i)),{renameItem:A,create:d,compileActivity:y,deleteItem:t}=x(o),[l,c]=b.useState(n),v=F();b.useEffect(()=>{c(n)},[n]);const m=()=>{let a=l;l===""&&(a=n,n===""&&(a="Untitled"),c(a)),n!==a&&A(i,a)};if(i==null)return null;let T=V(p),C=s("h2",{"data-test":"infoPanelItemLabel",style:{margin:"16px 5px"},children:[e(O,{icon:R})," ",n]});return w==="1"?s(h,{children:[C,s(de,{vertical:!0,children:[e(g,{width:"menu",value:"Edit Activity",dataTest:"Edit Activity",onClick:()=>{T==null?v("ERROR: No page found in activity",B.INFO):r(a=>({page:"course",tool:"editor",view:a.view,params:{doenetId:i,pageId:T}}))}}),e(g,{width:"menu",value:"View Draft Activity",dataTest:"View Draft Activity",onClick:()=>{y({activityDoenetId:i,courseId:o,successCallback:()=>{r({page:"course",tool:"draftactivity",view:"",params:{doenetId:i,requestedVariant:1}})}})}}),e(g,{width:"menu",value:"View Assigned Activity",dataTest:"View Assigned Activity",onClick:()=>{r({page:"course",tool:"assignment",view:"",params:{doenetId:i}})}})]}),e("br",{}),e(G,{doenetId:i,courseId:o}),e(me,{label:"Label",dataTest:"Label Activity",vertical:!0,width:"menu",value:l,onChange:a=>c(a.target.value),onKeyDown:a=>{a.keyCode===13&&m()},onBlur:m}),e("br",{}),s(ce,{vertical:!0,children:[e(f,{width:"menu",onClick:()=>d({itemType:"page"}),value:"Add Page",dataTest:"Add Page"}),e(f,{width:"menu",onClick:()=>d({itemType:"order"}),value:"Add Order",dataTest:"Add Order"}),e(f,{width:"menu",onClick:()=>d({itemType:"collectionLink"}),dataTest:"Add Collection Link",value:"Add Collection Link"})]}),e("br",{}),e(ue,{doenetId:i,courseId:o}),e(f,{width:"menu",value:"Delete Activity",dataTest:"Delete Activity",alert:!0,onClick:a=>{a.preventDefault(),a.stopPropagation(),t({doenetId:i})}})]}):s(h,{children:[C,e(g,{width:"menu",dataTest:"View Activity",value:"View Activity",onClick:()=>{r({page:"course",tool:"assignment",view:"",params:{doenetId:i}})}})]})}E({key:"temporaryRestrictToAtom",default:[]});function ue({doenetId:o,courseId:i}){const{canModifyActivitySettings:r,canViewActivitySettings:w}=u(P(i)),{value:{numberOfAttemptsAllowed:n,timeLimit:p,assignedDate:A,dueDate:d,totalPointsOrPercent:y}}=M(i,o);D(S);const t={courseId:i,doenetId:o,editable:r??"0"};if(w==="1")return s(h,{children:[e(_,{...t}),e("br",{}),e(j,{...t}),e(X,{...t}),e(J,{...t}),e(N,{...t}),e(z,{...t}),e(H,{...t}),e(U,{...t}),e(q,{...t}),s("div",{style:{margin:"16px 0"},children:[e(K,{...t}),e(W,{...t}),e(Q,{...t}),e(Y,{...t}),e(Z,{...t}),e($,{...t}),e(ee,{...t}),e(te,{...t}),e(ie,{...t}),e(ae,{...t}),e(se,{...t}),e(ne,{...t}),e(oe,{...t}),e(le,{...t})]}),e(re,{...t})]});let l=n;l===null&&(l="unlimited");let c=null;p!==null&&(c=s("p",{children:["Time Limit: ",p," minutes"]}));let v=null;A!==null&&(v=s("p",{children:["Assigned: ",A]}));let m=e("p",{children:"No Due Date"});return d!==null&&(m=s("p",{children:["Due: ",d]})),e(h,{children:s("div",{children:[v,m,c,s("p",{children:["Attempts Allowed: ",l]}),s("p",{children:["Points: ",y]})]})})}export{ue as AssignmentSettings,Ie as default}; +import{l as u,m as k,T as I,R as D,p as S,G as L,a6 as x,r as b,y as F,H as V,a as s,F as h,j as e,z as B,B as f,i as O,X as R,ag as E}from"./index-9d63439d.js";import{A as G,u as M,a as _,b as j,D as X,T as J,c as N,d as z,e as H,G as U,I as q,f as K,S as W,g as Q,h as Y,i as Z,j as $,k as ee,P as te,l as ie,m as ae,n as se,M as ne,o as oe,C as le,p as re}from"./SettingComponents-d432c822.js";import{A as g}from"./ActionButton-056b08c3.js";import{A as de}from"./ActionButtonGroup-9e9bafb3.js";import{B as ce}from"./ButtonGroup-ec02b3e9.js";import{e as P}from"./RoleDropdown-2d4e4388.js";import{T as me}from"./Textfield-381b1f5a.js";import"./DateTime-b5df08e4.js";import"./moment-a2107d39.js";import"./IncrementMenu-999b207e.js";import"./DropdownMenu-421d3462.js";import"./setPrototypeOf-51e8cf87.js";import"./RelatedItems-23ef0ca1.js";import"./useSaveDraft-50a40c9b.js";import"./EditorViewerRecoil-4f9a7d1d.js";function Ie(){const o=u(k("courseId")),i=u(I)[0],r=D(S),{canEditContent:w}=u(P(o)),{label:n,content:p}=u(L(i)),{renameItem:A,create:d,compileActivity:y,deleteItem:t}=x(o),[l,c]=b.useState(n),v=F();b.useEffect(()=>{c(n)},[n]);const m=()=>{let a=l;l===""&&(a=n,n===""&&(a="Untitled"),c(a)),n!==a&&A(i,a)};if(i==null)return null;let T=V(p),C=s("h2",{"data-test":"infoPanelItemLabel",style:{margin:"16px 5px"},children:[e(O,{icon:R})," ",n]});return w==="1"?s(h,{children:[C,s(de,{vertical:!0,children:[e(g,{width:"menu",value:"Edit Activity",dataTest:"Edit Activity",onClick:()=>{T==null?v("ERROR: No page found in activity",B.INFO):r(a=>({page:"course",tool:"editor",view:a.view,params:{doenetId:i,pageId:T}}))}}),e(g,{width:"menu",value:"View Draft Activity",dataTest:"View Draft Activity",onClick:()=>{y({activityDoenetId:i,courseId:o,successCallback:()=>{r({page:"course",tool:"draftactivity",view:"",params:{doenetId:i,requestedVariant:1}})}})}}),e(g,{width:"menu",value:"View Assigned Activity",dataTest:"View Assigned Activity",onClick:()=>{r({page:"course",tool:"assignment",view:"",params:{doenetId:i}})}})]}),e("br",{}),e(G,{doenetId:i,courseId:o}),e(me,{label:"Label",dataTest:"Label Activity",vertical:!0,width:"menu",value:l,onChange:a=>c(a.target.value),onKeyDown:a=>{a.keyCode===13&&m()},onBlur:m}),e("br",{}),s(ce,{vertical:!0,children:[e(f,{width:"menu",onClick:()=>d({itemType:"page"}),value:"Add Page",dataTest:"Add Page"}),e(f,{width:"menu",onClick:()=>d({itemType:"order"}),value:"Add Order",dataTest:"Add Order"}),e(f,{width:"menu",onClick:()=>d({itemType:"collectionLink"}),dataTest:"Add Collection Link",value:"Add Collection Link"})]}),e("br",{}),e(ue,{doenetId:i,courseId:o}),e(f,{width:"menu",value:"Delete Activity",dataTest:"Delete Activity",alert:!0,onClick:a=>{a.preventDefault(),a.stopPropagation(),t({doenetId:i})}})]}):s(h,{children:[C,e(g,{width:"menu",dataTest:"View Activity",value:"View Activity",onClick:()=>{r({page:"course",tool:"assignment",view:"",params:{doenetId:i}})}})]})}E({key:"temporaryRestrictToAtom",default:[]});function ue({doenetId:o,courseId:i}){const{canModifyActivitySettings:r,canViewActivitySettings:w}=u(P(i)),{value:{numberOfAttemptsAllowed:n,timeLimit:p,assignedDate:A,dueDate:d,totalPointsOrPercent:y}}=M(i,o);D(S);const t={courseId:i,doenetId:o,editable:r??"0"};if(w==="1")return s(h,{children:[e(_,{...t}),e("br",{}),e(j,{...t}),e(X,{...t}),e(J,{...t}),e(N,{...t}),e(z,{...t}),e(H,{...t}),e(U,{...t}),e(q,{...t}),s("div",{style:{margin:"16px 0"},children:[e(K,{...t}),e(W,{...t}),e(Q,{...t}),e(Y,{...t}),e(Z,{...t}),e($,{...t}),e(ee,{...t}),e(te,{...t}),e(ie,{...t}),e(ae,{...t}),e(se,{...t}),e(ne,{...t}),e(oe,{...t}),e(le,{...t})]}),e(re,{...t})]});let l=n;l===null&&(l="unlimited");let c=null;p!==null&&(c=s("p",{children:["Time Limit: ",p," minutes"]}));let v=null;A!==null&&(v=s("p",{children:["Assigned: ",A]}));let m=e("p",{children:"No Due Date"});return d!==null&&(m=s("p",{children:["Due: ",d]})),e(h,{children:s("div",{children:[v,m,c,s("p",{children:["Attempts Allowed: ",l]}),s("p",{children:["Points: ",y]})]})})}export{ue as AssignmentSettings,Ie as default}; diff --git a/dist/assets/SelectedBank-ac016b19.js b/dist/assets/SelectedBank-3fb5c91d.js similarity index 78% rename from dist/assets/SelectedBank-ac016b19.js rename to dist/assets/SelectedBank-3fb5c91d.js index 21a0440086..3bcd298052 100644 --- a/dist/assets/SelectedBank-ac016b19.js +++ b/dist/assets/SelectedBank-3fb5c91d.js @@ -1 +1 @@ -import{l as o,m as x,T as C,G as g,a6 as c,r as d,y as v,a as m,F as y,j as a,B as u,i as T,Z as B}from"./index-61b6fc23.js";import{e as L}from"./RoleDropdown-c9fff172.js";import{T as F}from"./Textfield-637f7b37.js";import{B as P}from"./ButtonGroup-6d856500.js";import"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";function G(){const l=o(x("courseId")),n=o(C)[0],{canEditContent:f}=o(L(l)),{label:t}=o(g(n)),{renameItem:p}=c(l),[s,r]=d.useState(t);let{create:I,deleteItem:b}=c(l);d.useEffect(()=>{r(t)},[t]);const i=()=>{let e=s;s===""&&(e=t,t===""&&(e="Untitled"),r(e)),t!==e&&p(n,e)};v();let h=m("h2",{"data-test":"infoPanelItemLabel",style:{margin:"16px 5px"},children:[a(T,{icon:B})," ",t]});return f==="1"?m(y,{children:[h,a(F,{label:"Label",vertical:!0,width:"menu",value:s,onChange:e=>r(e.target.value),onKeyDown:e=>{e.keyCode===13&&i()},onBlur:i}),a("br",{}),a(P,{vertical:!0,children:a(u,{width:"menu",onClick:()=>I({itemType:"page"}),value:"Add Page",dataTest:"Add Page"})}),a("br",{}),a(u,{width:"menu",value:"Delete Collection",dataTest:"Delete Collection",alert:!0,onClick:e=>{e.preventDefault(),e.stopPropagation(),b({doenetId:n})}})]}):null}export{G as default}; +import{l as o,m as x,T as C,G as g,a6 as c,r as d,y as v,a as m,F as y,j as a,B as u,i as T,Z as B}from"./index-9d63439d.js";import{e as L}from"./RoleDropdown-2d4e4388.js";import{T as F}from"./Textfield-381b1f5a.js";import{B as P}from"./ButtonGroup-ec02b3e9.js";import"./DropdownMenu-421d3462.js";import"./setPrototypeOf-51e8cf87.js";function G(){const l=o(x("courseId")),n=o(C)[0],{canEditContent:f}=o(L(l)),{label:t}=o(g(n)),{renameItem:p}=c(l),[s,r]=d.useState(t);let{create:I,deleteItem:b}=c(l);d.useEffect(()=>{r(t)},[t]);const i=()=>{let e=s;s===""&&(e=t,t===""&&(e="Untitled"),r(e)),t!==e&&p(n,e)};v();let h=m("h2",{"data-test":"infoPanelItemLabel",style:{margin:"16px 5px"},children:[a(T,{icon:B})," ",t]});return f==="1"?m(y,{children:[h,a(F,{label:"Label",vertical:!0,width:"menu",value:s,onChange:e=>r(e.target.value),onKeyDown:e=>{e.keyCode===13&&i()},onBlur:i}),a("br",{}),a(P,{vertical:!0,children:a(u,{width:"menu",onClick:()=>I({itemType:"page"}),value:"Add Page",dataTest:"Add Page"})}),a("br",{}),a(u,{width:"menu",value:"Delete Collection",dataTest:"Delete Collection",alert:!0,onClick:e=>{e.preventDefault(),e.stopPropagation(),b({doenetId:n})}})]}):null}export{G as default}; diff --git a/dist/assets/SelectedCollectionLink-2abf6605.js b/dist/assets/SelectedCollectionLink-97faf7ed.js similarity index 89% rename from dist/assets/SelectedCollectionLink-2abf6605.js rename to dist/assets/SelectedCollectionLink-97faf7ed.js index faaefa90e9..ee5e3609de 100644 --- a/dist/assets/SelectedCollectionLink-2abf6605.js +++ b/dist/assets/SelectedCollectionLink-97faf7ed.js @@ -1 +1 @@ -import{l as r,T as L,G as C,m as k,r as y,a6 as x,y as M,a as m,j as t,i as S,$ as O,F as f,A,B as I,bj as B}from"./index-61b6fc23.js";import"./ActionButton-be9a12e7.js";import{T}from"./Textfield-637f7b37.js";import{R as h}from"./RelatedItems-33d92928.js";import{e as j}from"./RoleDropdown-c9fff172.js";import"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";function w({courseId:n,selectedDoenetId:e}){let o=r(B(n)),i=[];for(let[s,a]of o.entries())e==a.doenetId?i.push(t("option",{selected:!0,value:a.doenetId,children:a.label},`CollectionOptions${s}`)):i.push(t("option",{value:a.doenetId,children:a.label},`CollectionOptions${s}`));return t(f,{children:i})}function R({selected:n,i:e,pageId:o}){let i=r(C(o));return n?t("option",{selected:!0,value:o,children:i.label},`PagesInACollection${e}`):t("option",{value:o,children:i.label},`PagesInACollection${e}`)}function K(){const n=r(L)[0],e=r(C(n)),o=r(k("courseId")),{canEditContent:i}=r(j(o)),[s,a]=y.useState(e.label);let{deleteItem:F,updateCollectionLink:c,updateContentLinksToSources:v}=x(o);y.useEffect(()=>{s!==e.label&&a(e.label)},[n]);const b=()=>{let l=s;s===""&&(l=e.label,e.label===""&&(l="Untitled Collection Link"),a(l)),e.label!==l&&(console.log("Rename",n,l),c({courseId:o,doenetId:n,label:l,collectionDoenetId:e.collectionDoenetId,isManuallyFiltered:e.isManuallyFiltered,manuallyFilteredPages:e.manuallyFilteredPages}))};M();let P=m("h2",{"data-test":"infoPanelItemLabel",style:{margin:"16px 5px"},children:[t(S,{icon:O})," ",e.label]});if(i!=="1")return null;let D=t(w,{courseId:o,selectedDoenetId:e.collectionDoenetId}),g=null;if(e.collectionDoenetId){let l=[];for(let[p,d]of Object.entries(e.pagesByCollectionSource[e.collectionDoenetId])){let u=!1;e!=null&&e.manuallyFilteredPages&&e.manuallyFilteredPages.includes(d)&&(u=!0),l.push(t(R,{selected:u,i:p,pageId:d}))}g=m(f,{children:[m("div",{style:{display:"flex"},children:[t(A,{style:{marginRight:"5px"},checked:e.isManuallyFiltered,onClick:()=>{c({courseId:o,doenetId:n,collectionDoenetId:e.collectionDoenetId,isManuallyFiltered:!e.isManuallyFiltered,manuallyFilteredPages:e.manuallyFilteredPages})}}),"Filter Page Links"]}),t(h,{width:"menu",options:l,disabled:!e.isManuallyFiltered,onChange:p=>{let d=Array.from(p.target.selectedOptions,u=>u.value);c({courseId:o,doenetId:n,collectionDoenetId:e.collectionDoenetId,isManuallyFiltered:e.isManuallyFiltered,manuallyFilteredPages:d})},multiple:!0}),t("br",{})]})}return m(f,{children:[P,t(T,{label:"Label",vertical:!0,width:"menu",dataTest:"Label Collection",value:s,onChange:l=>a(l.target.value),onKeyDown:l=>{l.keyCode===13&&b()},onBlur:b}),t("br",{}),t("br",{}),t("div",{children:"collection"}),t(h,{width:"menu",options:D,onChange:l=>{c({courseId:o,doenetId:n,collectionDoenetId:l.target.value,isManuallyFiltered:!1,manuallyFilteredPages:[]})}}),t("br",{}),g,t("br",{}),t(I,{width:"menu",value:"Update Content to Sources",onClick:l=>{l.preventDefault(),l.stopPropagation(),v({collectionLinkObj:e,pages:e.pages})}}),t("br",{}),t(I,{width:"menu",value:"Delete Collection Link",alert:!0,onClick:l=>{l.preventDefault(),l.stopPropagation(),F({doenetId:n})}})]})}export{K as default}; +import{l as r,T as L,G as C,m as k,r as y,a6 as x,y as M,a as m,j as t,i as S,$ as O,F as f,A,B as I,bj as B}from"./index-9d63439d.js";import"./ActionButton-056b08c3.js";import{T}from"./Textfield-381b1f5a.js";import{R as h}from"./RelatedItems-23ef0ca1.js";import{e as j}from"./RoleDropdown-2d4e4388.js";import"./DropdownMenu-421d3462.js";import"./setPrototypeOf-51e8cf87.js";function w({courseId:n,selectedDoenetId:e}){let o=r(B(n)),i=[];for(let[s,a]of o.entries())e==a.doenetId?i.push(t("option",{selected:!0,value:a.doenetId,children:a.label},`CollectionOptions${s}`)):i.push(t("option",{value:a.doenetId,children:a.label},`CollectionOptions${s}`));return t(f,{children:i})}function R({selected:n,i:e,pageId:o}){let i=r(C(o));return n?t("option",{selected:!0,value:o,children:i.label},`PagesInACollection${e}`):t("option",{value:o,children:i.label},`PagesInACollection${e}`)}function K(){const n=r(L)[0],e=r(C(n)),o=r(k("courseId")),{canEditContent:i}=r(j(o)),[s,a]=y.useState(e.label);let{deleteItem:F,updateCollectionLink:c,updateContentLinksToSources:v}=x(o);y.useEffect(()=>{s!==e.label&&a(e.label)},[n]);const b=()=>{let l=s;s===""&&(l=e.label,e.label===""&&(l="Untitled Collection Link"),a(l)),e.label!==l&&(console.log("Rename",n,l),c({courseId:o,doenetId:n,label:l,collectionDoenetId:e.collectionDoenetId,isManuallyFiltered:e.isManuallyFiltered,manuallyFilteredPages:e.manuallyFilteredPages}))};M();let P=m("h2",{"data-test":"infoPanelItemLabel",style:{margin:"16px 5px"},children:[t(S,{icon:O})," ",e.label]});if(i!=="1")return null;let D=t(w,{courseId:o,selectedDoenetId:e.collectionDoenetId}),g=null;if(e.collectionDoenetId){let l=[];for(let[p,d]of Object.entries(e.pagesByCollectionSource[e.collectionDoenetId])){let u=!1;e!=null&&e.manuallyFilteredPages&&e.manuallyFilteredPages.includes(d)&&(u=!0),l.push(t(R,{selected:u,i:p,pageId:d}))}g=m(f,{children:[m("div",{style:{display:"flex"},children:[t(A,{style:{marginRight:"5px"},checked:e.isManuallyFiltered,onClick:()=>{c({courseId:o,doenetId:n,collectionDoenetId:e.collectionDoenetId,isManuallyFiltered:!e.isManuallyFiltered,manuallyFilteredPages:e.manuallyFilteredPages})}}),"Filter Page Links"]}),t(h,{width:"menu",options:l,disabled:!e.isManuallyFiltered,onChange:p=>{let d=Array.from(p.target.selectedOptions,u=>u.value);c({courseId:o,doenetId:n,collectionDoenetId:e.collectionDoenetId,isManuallyFiltered:e.isManuallyFiltered,manuallyFilteredPages:d})},multiple:!0}),t("br",{})]})}return m(f,{children:[P,t(T,{label:"Label",vertical:!0,width:"menu",dataTest:"Label Collection",value:s,onChange:l=>a(l.target.value),onKeyDown:l=>{l.keyCode===13&&b()},onBlur:b}),t("br",{}),t("br",{}),t("div",{children:"collection"}),t(h,{width:"menu",options:D,onChange:l=>{c({courseId:o,doenetId:n,collectionDoenetId:l.target.value,isManuallyFiltered:!1,manuallyFilteredPages:[]})}}),t("br",{}),g,t("br",{}),t(I,{width:"menu",value:"Update Content to Sources",onClick:l=>{l.preventDefault(),l.stopPropagation(),v({collectionLinkObj:e,pages:e.pages})}}),t("br",{}),t(I,{width:"menu",value:"Delete Collection Link",alert:!0,onClick:l=>{l.preventDefault(),l.stopPropagation(),F({doenetId:n})}})]})}export{K as default}; diff --git a/dist/assets/SelectedCourse-fc5475aa.js b/dist/assets/SelectedCourse-f436f785.js similarity index 71% rename from dist/assets/SelectedCourse-fc5475aa.js rename to dist/assets/SelectedCourse-f436f785.js index 112e2980cb..a92fc7392e 100644 --- a/dist/assets/SelectedCourse-fc5475aa.js +++ b/dist/assets/SelectedCourse-f436f785.js @@ -1,4 +1,4 @@ -import{s as r,g as u,j as o,a as i,F as d,B as p,a6 as m,l as x,R as g,p as v,i as h,bc as f}from"./index-61b6fc23.js";import{B as b}from"./ButtonGroup-6d856500.js";import{d as C}from"./CourseToolHandler-d3da4c3a.js";import{E as w,b as A,D,c as P}from"./SettingComponents-b208ef07.js";import{e as k}from"./RoleDropdown-c9fff172.js";import{A as S}from"./ActionButton-be9a12e7.js";import{A as B}from"./ActionButtonGroup-f3a36748.js";import"./index-1380c04c.js";import"./index-fcf36459.js";import"./index-47ca4f11.js";import"./index.esm-d246f4c9.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./CollapseSection-2629b821.js";import"./util-38d8e238.js";import"./DateTime-3ab576fc.js";import"./moment-b216ba57.js";import"./DropdownMenu-5673dfd7.js";import"./RelatedItems-33d92928.js";import"./Textfield-637f7b37.js";r.button` +import{s as r,g as u,j as o,a as i,F as d,B as p,a6 as m,l as x,R as g,p as v,i as h,bc as f}from"./index-9d63439d.js";import{B as b}from"./ButtonGroup-ec02b3e9.js";import{d as C}from"./CourseToolHandler-d3661515.js";import{E as w,b as A,D,c as P}from"./SettingComponents-aff33cd0.js";import{e as k}from"./RoleDropdown-2d4e4388.js";import{A as S}from"./ActionButton-056b08c3.js";import{A as B}from"./ActionButtonGroup-9e9bafb3.js";import"./index-df71c5ec.js";import"./index-fcf36459.js";import"./index-47ca4f11.js";import"./index.esm-d6b6ff57.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./CollapseSection-3723ca05.js";import"./util-38d8e238.js";import"./DateTime-b5df08e4.js";import"./moment-a2107d39.js";import"./DropdownMenu-421d3462.js";import"./RelatedItems-23ef0ca1.js";import"./Textfield-381b1f5a.js";r.button` width: 20px; height: 20px; background: ${e=>`${e.color}`}; diff --git a/dist/assets/SelectedDataSources-e17305c7.js b/dist/assets/SelectedDataSources-54943a22.js similarity index 88% rename from dist/assets/SelectedDataSources-e17305c7.js rename to dist/assets/SelectedDataSources-54943a22.js index e402ca4f50..f963e1657c 100644 --- a/dist/assets/SelectedDataSources-e17305c7.js +++ b/dist/assets/SelectedDataSources-54943a22.js @@ -1 +1 @@ -import{r as u,l as h,T as p,m as y,v as f,G as D,V as w,y as x,a as g,F as S,j as c,z as A,k as v}from"./index-61b6fc23.js";import{A as C}from"./ActionButton-be9a12e7.js";function B(){const[s,r]=u.useState([]),n=h(p),i=h(y("courseId")),l=f(({snapshot:t})=>async o=>{let e=[];for(let d of o){let a=await t.getPromise(D(d));if(a.type=="activity"&&a.isAssigned)e.push(d);else if(a.type=="section"&&a.isAssigned){let I=await t.getPromise(w({courseId:i,sectionId:d}));e=[...await l(I),...e]}}return e=[...new Set(e)],e},[i]);u.useEffect(()=>{n.length>0?l(n).then(t=>{r(t)}):r([])},[n]);const m=x();return g(S,{children:[c("h2",{"data-test":"selectedDataSourcesHeading",style:{margin:"16px 5px"},children:"Event Data"}),g("div",{children:[s.length," ",s.length==1?"Activity":"Activities"]}),c("br",{}),c(C,{width:"menu",value:"View on Shiny",disabled:s.length==0,onClick:async()=>{if(s.length==0)m("No activities found",A.INFO);else{let t=s.join("&data=");const o=await v.get(`/api/createSecretCode.php?courseId=${i}`),{secretCode:e}=o.data;window.open(`https://doenet.shinyapps.io/analyzer/?data=${t}&code=${e}`,"_blank")}}})]})}export{B as default}; +import{r as u,l as h,T as p,m as y,v as f,G as D,V as w,y as x,a as g,F as S,j as c,z as A,k as v}from"./index-9d63439d.js";import{A as C}from"./ActionButton-056b08c3.js";function B(){const[s,r]=u.useState([]),n=h(p),i=h(y("courseId")),l=f(({snapshot:t})=>async o=>{let e=[];for(let d of o){let a=await t.getPromise(D(d));if(a.type=="activity"&&a.isAssigned)e.push(d);else if(a.type=="section"&&a.isAssigned){let I=await t.getPromise(w({courseId:i,sectionId:d}));e=[...await l(I),...e]}}return e=[...new Set(e)],e},[i]);u.useEffect(()=>{n.length>0?l(n).then(t=>{r(t)}):r([])},[n]);const m=x();return g(S,{children:[c("h2",{"data-test":"selectedDataSourcesHeading",style:{margin:"16px 5px"},children:"Event Data"}),g("div",{children:[s.length," ",s.length==1?"Activity":"Activities"]}),c("br",{}),c(C,{width:"menu",value:"View on Shiny",disabled:s.length==0,onClick:async()=>{if(s.length==0)m("No activities found",A.INFO);else{let t=s.join("&data=");const o=await v.get(`/api/createSecretCode.php?courseId=${i}`),{secretCode:e}=o.data;window.open(`https://doenet.shinyapps.io/analyzer/?data=${t}&code=${e}`,"_blank")}}})]})}export{B as default}; diff --git a/dist/assets/SelectedOrder-658a390f.js b/dist/assets/SelectedOrder-088234de.js similarity index 87% rename from dist/assets/SelectedOrder-658a390f.js rename to dist/assets/SelectedOrder-088234de.js index a9d85bc452..cb3a08a763 100644 --- a/dist/assets/SelectedOrder-658a390f.js +++ b/dist/assets/SelectedOrder-088234de.js @@ -1,4 +1,4 @@ -import{l as s,T as S,G as C,m as y,r as c,a6 as B,a as m,j as e,i as R,_ as A,F as I,A as D,B as u,s as N}from"./index-61b6fc23.js";import{B as O}from"./ButtonGroup-6d856500.js";import{I as j}from"./IncrementMenu-5203e1b9.js";import{D as F}from"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";const L=N.span` +import{l as s,T as S,G as C,m as y,r as c,a6 as B,a as m,j as e,i as R,_ as A,F as I,A as D,B as u,s as N}from"./index-9d63439d.js";import{B as O}from"./ButtonGroup-ec02b3e9.js";import{I as j}from"./IncrementMenu-999b207e.js";import{D as F}from"./DropdownMenu-421d3462.js";import"./setPrototypeOf-51e8cf87.js";const L=N.span` font-size: 15px; line-height: 1.1 `;function z(){const r=s(S)[0],t=s(C(r));s(C(t.parentDoenetId));const k=s(y("courseId")),[a,p]=c.useState(t.behavior),[l,b]=c.useState(t.numberToSelect),[i,f]=c.useState(t.withReplacement);let{create:d,updateOrderBehavior:h,deleteItem:T}=B(k);c.useEffect(()=>{t.behavior!=a&&p(t.behavior),t.numberToSelect!=l&&b(t.numberToSelect),t.withReplacement!=i&&f(t.withReplacement)},[t.doenetId]);let g=m("h2",{"data-test":"infoPanelItemLabel",style:{margin:"16px 5px"},children:[e(R,{icon:A})," ",t.label]}),x=[["sequence","sequence"],["shuffle","shuffle"],["select","select"]],v=0;for(let[n,o]of Object.entries(x))if(o[0]===a){v=Number(n)+1;break}let w=null;return a=="select"&&(w=m(I,{children:[e(j,{min:0,label:"Number to select",vertical:!0,value:l,onChange:n=>{let o=Number(n);isNaN(n)&&(o=0),b(o),h({doenetId:r,behavior:a,numberToSelect:o,withReplacement:i})}}),e(D,{style:{marginRight:"5px"},checked:i,onClick:n=>{f(o=>!o),h({doenetId:r,behavior:a,numberToSelect:l,withReplacement:!i})}}),e(L,{children:"with replacement"}),e("br",{}),e("br",{})]})),m(I,{children:[g,e(F,{width:"menu",items:x,defaultIndex:v,onChange:({value:n})=>{p(n),h({doenetId:r,behavior:n,numberToSelect:l,withReplacement:i})}}),e("br",{}),w,m(O,{vertical:!0,children:[e(u,{width:"menu",onClick:()=>d({itemType:"page"}),value:"Add Page"}),e(u,{width:"menu",onClick:()=>d({itemType:"order"}),value:"Add Order"}),e(u,{width:"menu",onClick:()=>d({itemType:"collectionLink"}),value:"Add Collection Link",dataTest:"Add Collection Link"})]}),e("br",{}),e(u,{width:"menu",value:"Delete Order",alert:!0,onClick:n=>{n.preventDefault(),n.stopPropagation(),T({doenetId:r})}})]})}export{z as default}; diff --git a/dist/assets/SelectedPage-e3d66e05.js b/dist/assets/SelectedPage-f34483f1.js similarity index 79% rename from dist/assets/SelectedPage-e3d66e05.js rename to dist/assets/SelectedPage-f34483f1.js index 956af74a30..e1827cfe9e 100644 --- a/dist/assets/SelectedPage-e3d66e05.js +++ b/dist/assets/SelectedPage-f34483f1.js @@ -1 +1 @@ -import{R as v,p as y,l as i,T as A,G as u,m as P,a6 as x,r as p,y as w,a as d,j as t,i as C,J as B,F as D,B as r}from"./index-61b6fc23.js";import{T as L}from"./Textfield-637f7b37.js";import{B as F}from"./ButtonGroup-6d856500.js";import{A as j}from"./ActionButton-be9a12e7.js";import{A as k}from"./ActionButtonGroup-f3a36748.js";function K(){const g=v(y),o=i(A)[0],a=i(u(o)),n=i(u(a.containingDoenetId));n.parentDoenetId;const f=n.doenetId,b=i(P("courseId")),{create:c,renameItem:I,compileActivity:E,deleteItem:T,copyItems:O,cutItems:_}=x(b),[l,s]=p.useState(a.label);w(),p.useEffect(()=>{l!==a.label&&s(a.label)},[o]);const m=()=>{let e=l;l===""&&(e=a.label,a.label===""&&(e="Untitled"),s(e)),a.label!==e&&I(o,e)};let h=d("h2",{"data-test":"infoPanelItemLabel",style:{margin:"16px 5px"},children:[t(C,{icon:B})," ",a.label]});return d(D,{children:[h,t(k,{vertical:!0,children:t(j,{width:"menu",value:"Edit Page",dataTest:"Edit Page",onClick:()=>{g({page:"course",tool:"editor",view:"",params:{pageId:o,doenetId:f}})}})}),t(L,{label:"Label",dataTest:"Label Page",vertical:!0,width:"menu",value:l,onChange:e=>s(e.target.value),onKeyDown:e=>{e.keyCode===13&&m()},onBlur:m}),t("br",{}),d(F,{vertical:!0,children:[t(r,{width:"menu",onClick:()=>c({itemType:"page"}),value:"Add Page",dataTest:"Add Page"}),n.type=="activity"?t(r,{width:"menu",onClick:()=>c({itemType:"order"}),value:"Add Order",dataTest:"Add Order"}):null]}),t("br",{}),t(r,{width:"menu",value:"Delete Page",dataTest:"Delete Page",alert:!0,onClick:e=>{e.preventDefault(),e.stopPropagation(),T({doenetId:o})}})]})}export{K as default}; +import{R as v,p as y,l as i,T as A,G as u,m as P,a6 as x,r as p,y as w,a as d,j as t,i as C,J as B,F as D,B as r}from"./index-9d63439d.js";import{T as L}from"./Textfield-381b1f5a.js";import{B as F}from"./ButtonGroup-ec02b3e9.js";import{A as j}from"./ActionButton-056b08c3.js";import{A as k}from"./ActionButtonGroup-9e9bafb3.js";function K(){const g=v(y),o=i(A)[0],a=i(u(o)),n=i(u(a.containingDoenetId));n.parentDoenetId;const f=n.doenetId,b=i(P("courseId")),{create:c,renameItem:I,compileActivity:E,deleteItem:T,copyItems:O,cutItems:_}=x(b),[l,s]=p.useState(a.label);w(),p.useEffect(()=>{l!==a.label&&s(a.label)},[o]);const m=()=>{let e=l;l===""&&(e=a.label,a.label===""&&(e="Untitled"),s(e)),a.label!==e&&I(o,e)};let h=d("h2",{"data-test":"infoPanelItemLabel",style:{margin:"16px 5px"},children:[t(C,{icon:B})," ",a.label]});return d(D,{children:[h,t(k,{vertical:!0,children:t(j,{width:"menu",value:"Edit Page",dataTest:"Edit Page",onClick:()=>{g({page:"course",tool:"editor",view:"",params:{pageId:o,doenetId:f}})}})}),t(L,{label:"Label",dataTest:"Label Page",vertical:!0,width:"menu",value:l,onChange:e=>s(e.target.value),onKeyDown:e=>{e.keyCode===13&&m()},onBlur:m}),t("br",{}),d(F,{vertical:!0,children:[t(r,{width:"menu",onClick:()=>c({itemType:"page"}),value:"Add Page",dataTest:"Add Page"}),n.type=="activity"?t(r,{width:"menu",onClick:()=>c({itemType:"order"}),value:"Add Order",dataTest:"Add Order"}):null]}),t("br",{}),t(r,{width:"menu",value:"Delete Page",dataTest:"Delete Page",alert:!0,onClick:e=>{e.preventDefault(),e.stopPropagation(),T({doenetId:o})}})]})}export{K as default}; diff --git a/dist/assets/SelectedPageLink-8bd53def.js b/dist/assets/SelectedPageLink-5fbaef9b.js similarity index 81% rename from dist/assets/SelectedPageLink-8bd53def.js rename to dist/assets/SelectedPageLink-5fbaef9b.js index d0ab72b5ef..972b5173f9 100644 --- a/dist/assets/SelectedPageLink-8bd53def.js +++ b/dist/assets/SelectedPageLink-5fbaef9b.js @@ -1 +1 @@ -import{R as b,p as h,l as s,m as L,T as w,G as l,r as c,a6 as P,v as A,k as v,a as u,j as e,i as C,$ as F,F as T,B as _}from"./index-61b6fc23.js";import{A as B}from"./ActionButton-be9a12e7.js";import{A as j}from"./ActionButtonGroup-f3a36748.js";import"./Textfield-637f7b37.js";function D(){const d=b(h),m=s(L("courseId")),t=s(w)[0],a=s(l(t)),[p,g]=c.useState(a.label);let{updateContentLinksToSources:x}=P(m);A(({set:o})=>async(k,n,i)=>{await v.get("/api/renamePageLink.php",{params:{courseId:k,doenetId:n,label:i}}),o(l(n),I=>{let r={...I};return r.label=i,r})}),c.useEffect(()=>{p!==a.label&&g(a.label)},[t]);let f=u("h2",{"data-test":"infoPanelItemLabel",style:{margin:"16px 5px"},children:[e(C,{icon:F})," Link to ",a.label]});return u(T,{children:[f,e(j,{vertical:!0,children:e(B,{width:"menu",value:"View Page Link",onClick:()=>{d({page:"course",tool:"editor",view:"",params:{linkPageId:t}})}})}),e("br",{}),e(_,{width:"menu",value:"Update Content to Source",onClick:o=>{o.preventDefault(),o.stopPropagation(),x({pages:[t]})}})]})}export{D as default}; +import{R as b,p as h,l as s,m as L,T as w,G as l,r as c,a6 as P,v as A,k as v,a as u,j as e,i as C,$ as F,F as T,B as _}from"./index-9d63439d.js";import{A as B}from"./ActionButton-056b08c3.js";import{A as j}from"./ActionButtonGroup-9e9bafb3.js";import"./Textfield-381b1f5a.js";function D(){const d=b(h),m=s(L("courseId")),t=s(w)[0],a=s(l(t)),[p,g]=c.useState(a.label);let{updateContentLinksToSources:x}=P(m);A(({set:o})=>async(k,n,i)=>{await v.get("/api/renamePageLink.php",{params:{courseId:k,doenetId:n,label:i}}),o(l(n),I=>{let r={...I};return r.label=i,r})}),c.useEffect(()=>{p!==a.label&&g(a.label)},[t]);let f=u("h2",{"data-test":"infoPanelItemLabel",style:{margin:"16px 5px"},children:[e(C,{icon:F})," Link to ",a.label]});return u(T,{children:[f,e(j,{vertical:!0,children:e(B,{width:"menu",value:"View Page Link",onClick:()=>{d({page:"course",tool:"editor",view:"",params:{linkPageId:t}})}})}),e("br",{}),e(_,{width:"menu",value:"Update Content to Source",onClick:o=>{o.preventDefault(),o.stopPropagation(),x({pages:[t]})}})]})}export{D as default}; diff --git a/dist/assets/SelectedSection-3c9495fa.js b/dist/assets/SelectedSection-ffa8c49b.js similarity index 80% rename from dist/assets/SelectedSection-3c9495fa.js rename to dist/assets/SelectedSection-ffa8c49b.js index 893494f9e2..0c1bed9657 100644 --- a/dist/assets/SelectedSection-3c9495fa.js +++ b/dist/assets/SelectedSection-ffa8c49b.js @@ -1 +1 @@ -import{l as n,m as S,T as A,G as C,a6 as u,r as f,y as v,a as p,F as g,j as s,z as y,B as F,i as L,W as B}from"./index-61b6fc23.js";import{A as w}from"./ActionButton-be9a12e7.js";import{e as k}from"./RoleDropdown-c9fff172.js";import{T as D}from"./Textfield-637f7b37.js";import"./DropdownMenu-5673dfd7.js";import"./setPrototypeOf-51e8cf87.js";function G(){const o=n(S("courseId")),a=n(A)[0],{canEditContent:I}=n(k(o)),{label:t,isAssigned:i}=n(C(a)),{renameItem:b,deleteItem:x}=u(o),[l,r]=f.useState(t),{updateAssignItem:T}=u(o);let c="Assign Section";i&&(c="Unassign Section"),f.useEffect(()=>{r(t)},[t]);const d=()=>{let e=l;l===""&&(e=t,t===""&&(e="Untitled"),r(e)),t!==e&&b(a,e)},h=v();let m=p("h2",{"data-test":"infoPanelItemLabel",style:{margin:"16px 5px"},children:[s(L,{icon:B})," ",t]});return I==="1"?p(g,{children:[m,s(w,{width:"menu",value:c,onClick:()=>{let e="Section Assigned.";i&&(e="Section Unassigned."),T({doenetId:a,isAssigned:!i,successCallback:()=>{h(e,y.INFO)}})}}),s(D,{label:"Label",vertical:!0,dataTest:"Label Section",width:"menu",value:l,onChange:e=>r(e.target.value),onKeyDown:e=>{e.keyCode===13&&d()},onBlur:d}),s("br",{}),s(F,{width:"menu",value:"Delete Section",alert:!0,onClick:e=>{e.preventDefault(),e.stopPropagation(),x({doenetId:a})}})]}):s(g,{children:m})}export{G as default}; +import{l as n,m as S,T as A,G as C,a6 as u,r as f,y as v,a as p,F as g,j as s,z as y,B as F,i as L,W as B}from"./index-9d63439d.js";import{A as w}from"./ActionButton-056b08c3.js";import{e as k}from"./RoleDropdown-2d4e4388.js";import{T as D}from"./Textfield-381b1f5a.js";import"./DropdownMenu-421d3462.js";import"./setPrototypeOf-51e8cf87.js";function G(){const o=n(S("courseId")),a=n(A)[0],{canEditContent:I}=n(k(o)),{label:t,isAssigned:i}=n(C(a)),{renameItem:b,deleteItem:x}=u(o),[l,r]=f.useState(t),{updateAssignItem:T}=u(o);let c="Assign Section";i&&(c="Unassign Section"),f.useEffect(()=>{r(t)},[t]);const d=()=>{let e=l;l===""&&(e=t,t===""&&(e="Untitled"),r(e)),t!==e&&b(a,e)},h=v();let m=p("h2",{"data-test":"infoPanelItemLabel",style:{margin:"16px 5px"},children:[s(L,{icon:B})," ",t]});return I==="1"?p(g,{children:[m,s(w,{width:"menu",value:c,onClick:()=>{let e="Section Assigned.";i&&(e="Section Unassigned."),T({doenetId:a,isAssigned:!i,successCallback:()=>{h(e,y.INFO)}})}}),s(D,{label:"Label",vertical:!0,dataTest:"Label Section",width:"menu",value:l,onChange:e=>r(e.target.value),onKeyDown:e=>{e.keyCode===13&&d()},onBlur:d}),s("br",{}),s(F,{width:"menu",value:"Delete Section",alert:!0,onClick:e=>{e.preventDefault(),e.stopPropagation(),x({doenetId:a})}})]}):s(g,{children:m})}export{G as default}; diff --git a/dist/assets/SettingComponents-b208ef07.js b/dist/assets/SettingComponents-aff33cd0.js similarity index 96% rename from dist/assets/SettingComponents-b208ef07.js rename to dist/assets/SettingComponents-aff33cd0.js index 32400a2da3..82290e3246 100644 --- a/dist/assets/SettingComponents-b208ef07.js +++ b/dist/assets/SettingComponents-aff33cd0.js @@ -1,4 +1,4 @@ -import{s as y,a_ as O,r as f,j as t,a as w,a6 as I,l as S,aG as E,a$ as _,B as x,y as D,a5 as $,F as N,b as U,aF as z,A as j,z as G,R as W,b0 as T}from"./index-61b6fc23.js";import{d as q}from"./CourseToolHandler-d3da4c3a.js";import{B as A}from"./ButtonGroup-6d856500.js";import{C as H}from"./CollapseSection-2629b821.js";import{d as R,a as L}from"./util-38d8e238.js";import{D as P}from"./DateTime-3ab576fc.js";import{D as B}from"./DropdownMenu-5673dfd7.js";import{R as J}from"./RelatedItems-33d92928.js";import{R as V}from"./RoleDropdown-c9fff172.js";import{T as k}from"./Textfield-637f7b37.js";const Q=y.button` +import{s as y,a_ as O,r as f,j as t,a as w,a6 as I,l as S,aG as E,a$ as _,B as x,y as D,a5 as $,F as N,b as U,aF as z,A as j,z as G,R as W,b0 as T}from"./index-9d63439d.js";import{d as q}from"./CourseToolHandler-d3661515.js";import{B as A}from"./ButtonGroup-ec02b3e9.js";import{C as H}from"./CollapseSection-3723ca05.js";import{d as R,a as L}from"./util-38d8e238.js";import{D as P}from"./DateTime-b5df08e4.js";import{D as B}from"./DropdownMenu-421d3462.js";import{R as J}from"./RelatedItems-23ef0ca1.js";import{R as V}from"./RoleDropdown-2d4e4388.js";import{T as k}from"./Textfield-381b1f5a.js";const Q=y.button` border-radius: var(--mainBorderRadius); border: none; height: 36px; diff --git a/dist/assets/SettingComponents-d7858e0f.js b/dist/assets/SettingComponents-d432c822.js similarity index 97% rename from dist/assets/SettingComponents-d7858e0f.js rename to dist/assets/SettingComponents-d432c822.js index e79d852977..43ca0ec6b3 100644 --- a/dist/assets/SettingComponents-d7858e0f.js +++ b/dist/assets/SettingComponents-d432c822.js @@ -1,4 +1,4 @@ -import{y as x,b as H,G as P,v as G,aA as M,bi as Y,k as C,s as L,ay as q,l as V,m as J,a6 as Q,r as m,g as X,a as h,j as o,A as w,i as b,bd as R,be as z,b0 as D,a5 as Z,F as K}from"./index-61b6fc23.js";import{D as N}from"./DateTime-3ab576fc.js";import{I as B}from"./IncrementMenu-5203e1b9.js";import{D as j}from"./DropdownMenu-5673dfd7.js";import{R as ee}from"./RelatedItems-33d92928.js";import{A as te}from"./ActionButtonGroup-f3a36748.js";import{A as U}from"./ActionButton-be9a12e7.js";import{T as ae}from"./Textfield-637f7b37.js";import{u as ie}from"./useSaveDraft-fc810696.js";const A=(e,n)=>{const d=x(),u=H(P(n)).getValue(),p=G(({set:t})=>async(...l)=>{const a=l.reduce((c,{keyToUpdate:g,value:v})=>(c[g]=v,c),{});let i={...a};if(i.assignedDate!==void 0&&i.assignedDate!==null&&(i.assignedDate=M(new Date(i.assignedDate))),i.dueDate!==void 0&&i.dueDate!==null&&(i.dueDate=Y(new Date(i.dueDate))),i.pinnedAfterDate!==void 0&&i.pinnedAfterDate!==null&&(i.pinnedAfterDate=M(new Date(i.pinnedAfterDate))),i.pinnedUntilDate!==void 0&&i.pinnedUntilDate!==null&&(i.pinnedUntilDate=M(new Date(i.pinnedUntilDate))),(await C.post("/api/updateAssignmentSettings.php",{...i,courseId:e,doenetId:n})).data.success){t(P(n),c=>({...c,...a}));for(const{description:c,valueDescription:g,value:v,keyToUpdate:f}of l);}},[d,e,n]),s=G(({set:t})=>async(...l)=>{const a=l.reduce((r,{keyToUpdate:c,value:g})=>(r[c]=g,r),{});if((await C.post("/api/updateContentFlags.php",{...a,courseId:e,doenetId:n})).data.success){t(P(n),r=>({...r,...a}));for(const{description:r,valueDescription:c,value:g,keyToUpdate:v}of l);}},[d,e,n]);return{value:u,updateAssignmentSettings:p,updateActivityFlags:s}};function ne({cid:e,doenetId:n,flags:d}){let u=new Worker("/_utils/prerenderWorker.js",{type:"module"});return u.postMessage({messageType:"prerenderActivity",args:{cid:e,doenetId:n,flags:d}}),u.onmessage=function(p){p.data.messageType==="finished"?u.terminate():p.data.messageType==="error"&&(console.error(p.data.message),u.terminate())},u}const k=L.div` +import{y as x,b as H,G as P,v as G,aA as M,bi as Y,k as C,s as L,ay as q,l as V,m as J,a6 as Q,r as m,g as X,a as h,j as o,A as w,i as b,bd as R,be as z,b0 as D,a5 as Z,F as K}from"./index-9d63439d.js";import{D as N}from"./DateTime-b5df08e4.js";import{I as B}from"./IncrementMenu-999b207e.js";import{D as j}from"./DropdownMenu-421d3462.js";import{R as ee}from"./RelatedItems-23ef0ca1.js";import{A as te}from"./ActionButtonGroup-9e9bafb3.js";import{A as U}from"./ActionButton-056b08c3.js";import{T as ae}from"./Textfield-381b1f5a.js";import{u as ie}from"./useSaveDraft-50a40c9b.js";const A=(e,n)=>{const d=x(),u=H(P(n)).getValue(),p=G(({set:t})=>async(...l)=>{const a=l.reduce((c,{keyToUpdate:g,value:v})=>(c[g]=v,c),{});let i={...a};if(i.assignedDate!==void 0&&i.assignedDate!==null&&(i.assignedDate=M(new Date(i.assignedDate))),i.dueDate!==void 0&&i.dueDate!==null&&(i.dueDate=Y(new Date(i.dueDate))),i.pinnedAfterDate!==void 0&&i.pinnedAfterDate!==null&&(i.pinnedAfterDate=M(new Date(i.pinnedAfterDate))),i.pinnedUntilDate!==void 0&&i.pinnedUntilDate!==null&&(i.pinnedUntilDate=M(new Date(i.pinnedUntilDate))),(await C.post("/api/updateAssignmentSettings.php",{...i,courseId:e,doenetId:n})).data.success){t(P(n),c=>({...c,...a}));for(const{description:c,valueDescription:g,value:v,keyToUpdate:f}of l);}},[d,e,n]),s=G(({set:t})=>async(...l)=>{const a=l.reduce((r,{keyToUpdate:c,value:g})=>(r[c]=g,r),{});if((await C.post("/api/updateContentFlags.php",{...a,courseId:e,doenetId:n})).data.success){t(P(n),r=>({...r,...a}));for(const{description:r,valueDescription:c,value:g,keyToUpdate:v}of l);}},[d,e,n]);return{value:u,updateAssignmentSettings:p,updateActivityFlags:s}};function ne({cid:e,doenetId:n,flags:d}){let u=new Worker("/_utils/prerenderWorker.js",{type:"module"});return u.postMessage({messageType:"prerenderActivity",args:{cid:e,doenetId:n,flags:d}}),u.onmessage=function(p){p.data.messageType==="finished"?u.terminate():p.data.messageType==="error"&&(console.error(p.data.message),u.terminate())},u}const k=L.div` margin: 0 5px 10px 5px; display: ${e=>e.flex?"flex":"block"}; align-items: ${e=>e.flex&&"center"}; diff --git a/dist/assets/SignIn-fbf50818.js b/dist/assets/SignIn-d0bccc38.js similarity index 98% rename from dist/assets/SignIn-fbf50818.js rename to dist/assets/SignIn-d0bccc38.js index 3472f98c1e..6f3b6ab685 100644 --- a/dist/assets/SignIn-fbf50818.js +++ b/dist/assets/SignIn-d0bccc38.js @@ -1,4 +1,4 @@ -import{r as a,y as K,k as U,z as D,j as e,a as R,B as L,A as M}from"./index-61b6fc23.js";import{T as $}from"./Textfield-637f7b37.js";var N={},V={get exports(){return N},set exports(m){N=m}};/*! +import{r as a,y as K,k as U,z as D,j as e,a as R,B as L,A as M}from"./index-9d63439d.js";import{T as $}from"./Textfield-381b1f5a.js";var N={},V={get exports(){return N},set exports(m){N=m}};/*! * JavaScript Cookie v2.2.1 * https://github.com/js-cookie/js-cookie * diff --git a/dist/assets/SignInRedirector-8329e62b.js b/dist/assets/SignInRedirector-9f531e33.js similarity index 75% rename from dist/assets/SignInRedirector-8329e62b.js rename to dist/assets/SignInRedirector-9f531e33.js index a4ebd50235..4acc3a46e0 100644 --- a/dist/assets/SignInRedirector-8329e62b.js +++ b/dist/assets/SignInRedirector-9f531e33.js @@ -1 +1 @@ -import{l,m as s,R as n,p as i,k as r,a9 as t}from"./index-61b6fc23.js";function c(){const o=l(s("doenetId")),a=n(i);return r.get("/api/umn/shibToJWT.php",{params:{doenetId:o}}).then(({data:e})=>{if(console.log("data",e),e.success){if(!e.isEnrolled)return console.log("ERROR!"),null;e.needToClearOutPreviousUser?(localStorage.clear(),t().then(()=>{a({page:"placementexam",tool:"exam",view:"",params:{doenetId:o}})})):a({page:"placementexam",tool:"exam",view:"",params:{doenetId:o}})}}),null}export{c as default}; +import{l,m as s,R as n,p as i,k as r,a9 as t}from"./index-9d63439d.js";function c(){const o=l(s("doenetId")),a=n(i);return r.get("/api/umn/shibToJWT.php",{params:{doenetId:o}}).then(({data:e})=>{if(console.log("data",e),e.success){if(!e.isEnrolled)return console.log("ERROR!"),null;e.needToClearOutPreviousUser?(localStorage.clear(),t().then(()=>{a({page:"placementexam",tool:"exam",view:"",params:{doenetId:o}})})):a({page:"placementexam",tool:"exam",view:"",params:{doenetId:o}})}}),null}export{c as default}; diff --git a/dist/assets/SignOut-fdfc9f92.js b/dist/assets/SignOut-e3aea9bd.js similarity index 96% rename from dist/assets/SignOut-fdfc9f92.js rename to dist/assets/SignOut-e3aea9bd.js index e2902252c5..ebbb7611ba 100644 --- a/dist/assets/SignOut-fdfc9f92.js +++ b/dist/assets/SignOut-e3aea9bd.js @@ -1 +1 @@ -import{r as o,R as h,p,D as m,j as e,a as t,B as f,d as y}from"./index-61b6fc23.js";function v(){const[a,s]=o.useState(!1),[n,l]=o.useState(""),c=h(p);return o.useEffect(()=>{async function i(){let{userInformationIsCompletelyRemoved:r,messageArray:d}=await y();s(r),l(d.map((g,u)=>e("p",{children:g},`error ${u}`)))}m().then(()=>{i()}).catch(r=>{i()})},[]),a?e("div",{children:t("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",display:"flex",justifyContent:"center",alignItems:"center",margin:"20"},children:[e("img",{style:{width:"250px",height:"250px"},src:"/Doenet_Logo_Frontpage.png",alt:"Chocolate glazed donut on a white cartoon cloud, sitting on a sky blue circle background"}),t("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:[e("h2",{children:"You are Signed Out!"}),e(f,{dataTest:"homepage button",value:"Homepage",onClick:()=>{c({page:"home",tool:"",view:""})}})]})]})}):n!=""?e("div",{children:t("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",display:"flex",justifyContent:"center",alignItems:"center",margin:"20"},children:[e("img",{style:{width:"250px",height:"250px"},src:"/Doenet_Logo_Frontpage.png",alt:"Chocolate glazed donut on a white cartoon cloud, sitting on a sky blue circle background"}),t("div",{children:[e("h2",{children:"FAILED SIGN OUT"}),e("p",{children:n}),e("p",{children:"Please manually remove your cookies."})]})]})}):e("div",{children:t("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",display:"flex",justifyContent:"center",alignItems:"center",margin:"20"},children:[e("img",{style:{width:"250px",height:"250px"},src:"/Doenet_Logo_Frontpage.png",alt:"Chocolate glazed donut on a white cartoon cloud, sitting on a sky blue circle background"}),e("div",{children:e("h2",{children:"Signing you out..."})})]})})}export{v as default}; +import{r as o,R as h,p,D as m,j as e,a as t,B as f,d as y}from"./index-9d63439d.js";function v(){const[a,s]=o.useState(!1),[n,l]=o.useState(""),c=h(p);return o.useEffect(()=>{async function i(){let{userInformationIsCompletelyRemoved:r,messageArray:d}=await y();s(r),l(d.map((g,u)=>e("p",{children:g},`error ${u}`)))}m().then(()=>{i()}).catch(r=>{i()})},[]),a?e("div",{children:t("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",display:"flex",justifyContent:"center",alignItems:"center",margin:"20"},children:[e("img",{style:{width:"250px",height:"250px"},src:"/Doenet_Logo_Frontpage.png",alt:"Chocolate glazed donut on a white cartoon cloud, sitting on a sky blue circle background"}),t("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:[e("h2",{children:"You are Signed Out!"}),e(f,{dataTest:"homepage button",value:"Homepage",onClick:()=>{c({page:"home",tool:"",view:""})}})]})]})}):n!=""?e("div",{children:t("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",display:"flex",justifyContent:"center",alignItems:"center",margin:"20"},children:[e("img",{style:{width:"250px",height:"250px"},src:"/Doenet_Logo_Frontpage.png",alt:"Chocolate glazed donut on a white cartoon cloud, sitting on a sky blue circle background"}),t("div",{children:[e("h2",{children:"FAILED SIGN OUT"}),e("p",{children:n}),e("p",{children:"Please manually remove your cookies."})]})]})}):e("div",{children:t("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",display:"flex",justifyContent:"center",alignItems:"center",margin:"20"},children:[e("img",{style:{width:"250px",height:"250px"},src:"/Doenet_Logo_Frontpage.png",alt:"Chocolate glazed donut on a white cartoon cloud, sitting on a sky blue circle background"}),e("div",{children:e("h2",{children:"Signing you out..."})})]})})}export{v as default}; diff --git a/dist/assets/SupportingFilesMenu-807b8c52.js b/dist/assets/SupportingFilesMenu-4e2d504e.js similarity index 94% rename from dist/assets/SupportingFilesMenu-807b8c52.js rename to dist/assets/SupportingFilesMenu-4e2d504e.js index ec67824e13..c11c7b5704 100644 --- a/dist/assets/SupportingFilesMenu-807b8c52.js +++ b/dist/assets/SupportingFilesMenu-4e2d504e.js @@ -1 +1 @@ -import{y as se,l as re,m as ne,g as pe,r as x,v as N,k as b,z as f,b1 as de,a as u,F as ue,j as t,B as ce,ay as ge,az as K,i as Q}from"./index-61b6fc23.js";import{A as q}from"./ActionButtonGroup-f3a36748.js";import{A as C}from"./ActionButton-be9a12e7.js";import{B as he}from"./ButtonGroup-6d856500.js";import{C as me}from"./CollapseSection-2629b821.js";import{l as G}from"./index-1380c04c.js";import{f as H}from"./index-47ca4f11.js";import"./index-fcf36459.js";function L(n){var a=["Bytes","KB","MB","GB","TB"];if(n==0)return"0 Byte";var l=parseInt(Math.floor(Math.log(n)/Math.log(1024)));return Math.round(n/Math.pow(1024,l),2)+" "+a[l]}const J=ge({key:"supportingFilesAndPermissionByDoenetId",default:K({key:"supportingFilesAndPermissionByDoenetId/Default",get:n=>async()=>{let{data:a}=await b.get("/api/loadSupprtingFileInfo.php",{params:{doenetId:n}});return a}})}),A=K({get:n=>({get:a})=>a(J(n)),set:n=>({set:a},l)=>{a(J(n),l)}});function T({text:n,submit:a}){a||(a=()=>{});let[l,F]=x.useState(!1),[y,S]=x.useState(n),v=n;l||(v=y);let $={width:"110px",display:"inline-block",textOverflow:"ellipsis",whiteSpace:"nowrap"};return v===""&&(v=" *Required",$.border="solid 2px var(--mainRed)"),l?t("input",{autoFocus:!0,type:"text",style:{width:"116px"},value:y,onChange:w=>S(w.target.value),onBlur:w=>{F(!1),a(y)},onKeyDown:w=>{w.key==="Enter"&&(F(!1),a(y))}}):t("span",{style:$,onClick:()=>F(!0),children:v})}function Be(n){const a=se(),l=re(ne("doenetId")),[{canUpload:F,userQuotaBytesAvailable:y,supportingFiles:S,quotaBytes:v,canEditContent:$},w]=pe(A(l));let X=["text/csv","image/jpeg","image/png"],[V,D]=x.useState([]),R=x.useRef(0);const W=N(({set:i})=>async(r,s)=>{await b.get("/api/updateFileDescription.php",{params:{doenetId:l,cid:s,description:r}}),i(A(l),c=>{let g={...c},e=[...c.supportingFiles];return e.map((p,o)=>{p.cid===s&&(e[o]={...e[o]},e[o].description=r)}),g.supportingFiles=e,g})},[l]),_=N(({set:i})=>async(r,s)=>{await b.get("/api/updateFileAsFileName.php",{params:{doenetId:l,cid:s,asFileName:r}}),i(A(l),c=>{let g={...c},e=[...c.supportingFiles];return e.map((p,o)=>{p.cid===s&&(e[o]={...e[o]},e[o].asFileName=r)}),g.supportingFiles=e,g})},[l]),z=N(({set:i})=>async r=>{var s,c,g;try{let e=await b.get("/api/deleteFile.php",{params:{doenetId:l,cid:r}});if(e.status<300&&((s=e==null?void 0:e.data)!=null&&s.success)){a("File deleted.");let{userQuotaBytesAvailable:p}=e.data;i(A(l),o=>{let h={...o};return h.supportingFiles=o.supportingFiles.filter(d=>d.cid!==r),h.userQuotaBytesAvailable=p,h})}else if(((c=e==null?void 0:e.data)==null?void 0:c.success)==!1)a((g=e==null?void 0:e.data)==null?void 0:g.message,f.ERROR);else throw new Error(`response code: ${e.status}`)}catch(e){throw new Error(`Error deleting file ${e}`)}},[l]),Y=x.useCallback(i=>{let r=!0,s=0;i.map(e=>{X.includes(e.type)||(a(`File '${e.name}' of type '${e.type}' is not allowed. No files uploaded.`,f.ERROR),r=!1),s+=e.size});let c=L(s),g=L(s-y);s>y&&(a(`Upload size ${c} exceeds quota by ${g}. No files uploaded.`,f.ERROR),r=!1),R.current>0&&(a("Already uploading files. Please wait before sending more.",f.ERROR),r=!1),i.map(e=>{e.size>=1e6&&(a(`File '${e.name}' is larger than 1MB. No files uploaded.`,f.ERROR),r=!1)}),r&&(R.current=i.length,i.map(e=>{let p={fileName:e.name,size:e.size,progressPercent:0};D(o=>[...o,p])}),i.map((e,p)=>{const o=new FileReader;o.readAsDataURL(e),o.onabort=()=>{},o.onerror=()=>{},o.onload=()=>{const h=new FormData;h.append("file",e),h.append("doenetId",l),b.post("/api/upload.php",h,{onUploadProgress:d=>{const m=d.lengthComputable?d.total:d.target.getResponseHeader("content-length")||d.target.getResponseHeader("x-decompressed-content-length");if(m!==null){let I=Math.round(d.loaded*100/m);D(O=>{let B=[...O];return B[p].progressPercent=I,B})}}}).then(({data:d})=>{R.current=R.current-1,R.current<1&&D([]);let{success:m,fileName:I,cid:O,asFileName:B,width:ae,height:oe,msg:E,userQuotaBytesAvailable:le}=d;E&&(m?a(E,f.INFO):a(E,f.ERROR)),m&&w(U=>{let M={...U},k=[...U.supportingFiles];return k.push({cid:O,fileName:I,fileType:e.type,width:ae,height:oe,description:"",asFileName:B}),M.supportingFiles=k,M.userQuotaBytesAvailable=le,M})})}}))},[]),{getRootProps:Z,getInputProps:ee,isDragActive:te}=de({onDrop:Y});let ie=V.map(i=>u("div",{children:[i.fileName," - ",i.progressPercent,"%"]},`${i.fileName}`)),j=null;F&&(j=u(ue,{children:[u("div",{children:[y,"/",v," Bytes"]}),u("div",{...Z(),children:[t("input",{...ee()}),te?t("p",{children:"Drop the files here"}):t(he,{vertical:!0,children:t(ce,{width:"menu",value:"Upload files"})})]},"drop"),t(me,{title:"Accepted File Types",collapsed:!0,children:u("div",{children:[t("b",{children:"Image"}),".jpg .png .csv"]})}),ie]}));let P=[];return S.map(({cid:i,fileName:r,fileType:s,width:c,height:g,description:e,asFileName:p})=>{let o="Error",h=`doenet:cid=${i}`;if(s==="image/jpeg"||s==="image/png"){o=``;let d={};P.push(u("div",{children:[u("div",{children:[t("span",{style:{width:"116px"},children:"asFileName:"}),t(T,{text:p,submit:m=>{_(m,i)}})]}),u("div",{style:d,children:[t("span",{style:{width:"116px"},children:"description:"}),t(T,{text:e,submit:m=>{W(m,i)}})]}),t("div",{children:u(q,{width:"menu",children:[F?t(C,{alert:!0,value:"Delete",onClick:()=>{z(i)}}):null,t(G.CopyToClipboard,{onCopy:()=>a("Code copied to clipboard!",f.SUCCESS),text:o,children:t(C,{disabled:e=="",icon:t(Q,{icon:H}),value:"Copy Code"})})]})}),t("hr",{})]},`${i}`))}else s==="text/csv"&&(o=``,P.push(u("div",{children:[t("div",{children:u("span",{style:{width:"116px"},children:["fileName: ",t(T,{text:p,submit:d=>{_(d,i)}})]})}),t("div",{children:u(q,{width:"menu",children:[F?t(C,{alert:!0,value:"Delete",onClick:()=>{z(i)}}):null,t(G.CopyToClipboard,{onCopy:()=>a("Code copied to clipboard!",f.SUCCESS),text:o,children:t(C,{icon:t(Q,{icon:H}),value:"Copy Code"})})]})}),t("hr",{})]},`${i}`)))}),u("div",{children:[j,t("br",{}),P]})}export{Be as default}; +import{y as se,l as re,m as ne,g as pe,r as x,v as N,k as b,z as f,b1 as de,a as u,F as ue,j as t,B as ce,ay as ge,az as K,i as Q}from"./index-9d63439d.js";import{A as q}from"./ActionButtonGroup-9e9bafb3.js";import{A as C}from"./ActionButton-056b08c3.js";import{B as he}from"./ButtonGroup-ec02b3e9.js";import{C as me}from"./CollapseSection-3723ca05.js";import{l as G}from"./index-df71c5ec.js";import{f as H}from"./index-47ca4f11.js";import"./index-fcf36459.js";function L(n){var a=["Bytes","KB","MB","GB","TB"];if(n==0)return"0 Byte";var l=parseInt(Math.floor(Math.log(n)/Math.log(1024)));return Math.round(n/Math.pow(1024,l),2)+" "+a[l]}const J=ge({key:"supportingFilesAndPermissionByDoenetId",default:K({key:"supportingFilesAndPermissionByDoenetId/Default",get:n=>async()=>{let{data:a}=await b.get("/api/loadSupprtingFileInfo.php",{params:{doenetId:n}});return a}})}),A=K({get:n=>({get:a})=>a(J(n)),set:n=>({set:a},l)=>{a(J(n),l)}});function T({text:n,submit:a}){a||(a=()=>{});let[l,F]=x.useState(!1),[y,S]=x.useState(n),v=n;l||(v=y);let $={width:"110px",display:"inline-block",textOverflow:"ellipsis",whiteSpace:"nowrap"};return v===""&&(v=" *Required",$.border="solid 2px var(--mainRed)"),l?t("input",{autoFocus:!0,type:"text",style:{width:"116px"},value:y,onChange:w=>S(w.target.value),onBlur:w=>{F(!1),a(y)},onKeyDown:w=>{w.key==="Enter"&&(F(!1),a(y))}}):t("span",{style:$,onClick:()=>F(!0),children:v})}function Be(n){const a=se(),l=re(ne("doenetId")),[{canUpload:F,userQuotaBytesAvailable:y,supportingFiles:S,quotaBytes:v,canEditContent:$},w]=pe(A(l));let X=["text/csv","image/jpeg","image/png"],[V,D]=x.useState([]),R=x.useRef(0);const W=N(({set:i})=>async(r,s)=>{await b.get("/api/updateFileDescription.php",{params:{doenetId:l,cid:s,description:r}}),i(A(l),c=>{let g={...c},e=[...c.supportingFiles];return e.map((p,o)=>{p.cid===s&&(e[o]={...e[o]},e[o].description=r)}),g.supportingFiles=e,g})},[l]),_=N(({set:i})=>async(r,s)=>{await b.get("/api/updateFileAsFileName.php",{params:{doenetId:l,cid:s,asFileName:r}}),i(A(l),c=>{let g={...c},e=[...c.supportingFiles];return e.map((p,o)=>{p.cid===s&&(e[o]={...e[o]},e[o].asFileName=r)}),g.supportingFiles=e,g})},[l]),z=N(({set:i})=>async r=>{var s,c,g;try{let e=await b.get("/api/deleteFile.php",{params:{doenetId:l,cid:r}});if(e.status<300&&((s=e==null?void 0:e.data)!=null&&s.success)){a("File deleted.");let{userQuotaBytesAvailable:p}=e.data;i(A(l),o=>{let h={...o};return h.supportingFiles=o.supportingFiles.filter(d=>d.cid!==r),h.userQuotaBytesAvailable=p,h})}else if(((c=e==null?void 0:e.data)==null?void 0:c.success)==!1)a((g=e==null?void 0:e.data)==null?void 0:g.message,f.ERROR);else throw new Error(`response code: ${e.status}`)}catch(e){throw new Error(`Error deleting file ${e}`)}},[l]),Y=x.useCallback(i=>{let r=!0,s=0;i.map(e=>{X.includes(e.type)||(a(`File '${e.name}' of type '${e.type}' is not allowed. No files uploaded.`,f.ERROR),r=!1),s+=e.size});let c=L(s),g=L(s-y);s>y&&(a(`Upload size ${c} exceeds quota by ${g}. No files uploaded.`,f.ERROR),r=!1),R.current>0&&(a("Already uploading files. Please wait before sending more.",f.ERROR),r=!1),i.map(e=>{e.size>=1e6&&(a(`File '${e.name}' is larger than 1MB. No files uploaded.`,f.ERROR),r=!1)}),r&&(R.current=i.length,i.map(e=>{let p={fileName:e.name,size:e.size,progressPercent:0};D(o=>[...o,p])}),i.map((e,p)=>{const o=new FileReader;o.readAsDataURL(e),o.onabort=()=>{},o.onerror=()=>{},o.onload=()=>{const h=new FormData;h.append("file",e),h.append("doenetId",l),b.post("/api/upload.php",h,{onUploadProgress:d=>{const m=d.lengthComputable?d.total:d.target.getResponseHeader("content-length")||d.target.getResponseHeader("x-decompressed-content-length");if(m!==null){let I=Math.round(d.loaded*100/m);D(O=>{let B=[...O];return B[p].progressPercent=I,B})}}}).then(({data:d})=>{R.current=R.current-1,R.current<1&&D([]);let{success:m,fileName:I,cid:O,asFileName:B,width:ae,height:oe,msg:E,userQuotaBytesAvailable:le}=d;E&&(m?a(E,f.INFO):a(E,f.ERROR)),m&&w(U=>{let M={...U},k=[...U.supportingFiles];return k.push({cid:O,fileName:I,fileType:e.type,width:ae,height:oe,description:"",asFileName:B}),M.supportingFiles=k,M.userQuotaBytesAvailable=le,M})})}}))},[]),{getRootProps:Z,getInputProps:ee,isDragActive:te}=de({onDrop:Y});let ie=V.map(i=>u("div",{children:[i.fileName," - ",i.progressPercent,"%"]},`${i.fileName}`)),j=null;F&&(j=u(ue,{children:[u("div",{children:[y,"/",v," Bytes"]}),u("div",{...Z(),children:[t("input",{...ee()}),te?t("p",{children:"Drop the files here"}):t(he,{vertical:!0,children:t(ce,{width:"menu",value:"Upload files"})})]},"drop"),t(me,{title:"Accepted File Types",collapsed:!0,children:u("div",{children:[t("b",{children:"Image"}),".jpg .png .csv"]})}),ie]}));let P=[];return S.map(({cid:i,fileName:r,fileType:s,width:c,height:g,description:e,asFileName:p})=>{let o="Error",h=`doenet:cid=${i}`;if(s==="image/jpeg"||s==="image/png"){o=``;let d={};P.push(u("div",{children:[u("div",{children:[t("span",{style:{width:"116px"},children:"asFileName:"}),t(T,{text:p,submit:m=>{_(m,i)}})]}),u("div",{style:d,children:[t("span",{style:{width:"116px"},children:"description:"}),t(T,{text:e,submit:m=>{W(m,i)}})]}),t("div",{children:u(q,{width:"menu",children:[F?t(C,{alert:!0,value:"Delete",onClick:()=>{z(i)}}):null,t(G.CopyToClipboard,{onCopy:()=>a("Code copied to clipboard!",f.SUCCESS),text:o,children:t(C,{disabled:e=="",icon:t(Q,{icon:H}),value:"Copy Code"})})]})}),t("hr",{})]},`${i}`))}else s==="text/csv"&&(o=``,P.push(u("div",{children:[t("div",{children:u("span",{style:{width:"116px"},children:["fileName: ",t(T,{text:p,submit:d=>{_(d,i)}})]})}),t("div",{children:u(q,{width:"menu",children:[F?t(C,{alert:!0,value:"Delete",onClick:()=>{z(i)}}):null,t(G.CopyToClipboard,{onCopy:()=>a("Code copied to clipboard!",f.SUCCESS),text:o,children:t(C,{icon:t(Q,{icon:H}),value:"Copy Code"})})]})}),t("hr",{})]},`${i}`)))}),u("div",{children:[j,t("br",{}),P]})}export{Be as default}; diff --git a/dist/assets/SurveyDataViewer-f4e3b1dc.js b/dist/assets/SurveyDataViewer-0d99a85c.js similarity index 95% rename from dist/assets/SurveyDataViewer-f4e3b1dc.js rename to dist/assets/SurveyDataViewer-0d99a85c.js index c4349f32e2..0c389236a7 100644 --- a/dist/assets/SurveyDataViewer-f4e3b1dc.js +++ b/dist/assets/SurveyDataViewer-0d99a85c.js @@ -1 +1 @@ -import{l as m,m as p,r as u,a3 as b,j as a,a as v,k as I}from"./index-61b6fc23.js";function O(){let n=m(p("doenetId")),y=m(p("driveId")),[o,S]=u.useState(null);if(u.useEffect(()=>{async function l(t){let{data:r}=await I.get("/api/getSurveyData.php",{params:{doenetId:t}});S(r.responses)}n&&l(n)},[n]),!y||!o)return null;let i=["User's Name","Email","Student Id"];for(let l of o){let t=JSON.parse(l.stateVariables,b);for(let r of Object.keys(t))if(!i.includes(r)){let e=t[r];(e!=null&&e.immediateValue||e!=null&&e.value||e!=null&&e.allSelectedIndices)&&i.push(r)}}let c=[];for(let[l,t]of Object.entries(o)){let r=JSON.parse(t.stateVariables,b),e=[];for(let[h,x]of Object.entries(i))if(h>2){let s=r[x],d="N/A";s!=null&&s.immediateValue?d=s.immediateValue:s!=null&&s.value?d=s.value:s!=null&&s.allSelectedIndices&&(d=s.allSelectedIndices[0]),e.push(a("td",{children:d},`survey${l}-${h}`))}e.unshift(a("td",{children:t.studentId})),e.unshift(a("td",{children:t.email})),e.unshift(a("td",{children:`${t.firstName} ${t.lastName}`})),c.push(a("tr",{style:{borderBottom:"1pt solid var(--canvastext)"},children:e}))}let f=[];for(let[l,t]of Object.entries(i))f.push(a("th",{style:{width:"150px"},children:t},`surveyHead${l}`));return a("div",{style:{margin:"5px"},children:v("table",{style:{borderCollapse:"collapse"},children:[a("thead",{children:a("tr",{style:{borderBottom:"2pt solid var(--canvastext)"},children:f})}),a("tbody",{children:c})]})})}export{O as default}; +import{l as m,m as p,r as u,a3 as b,j as a,a as v,k as I}from"./index-9d63439d.js";function O(){let n=m(p("doenetId")),y=m(p("driveId")),[o,S]=u.useState(null);if(u.useEffect(()=>{async function l(t){let{data:r}=await I.get("/api/getSurveyData.php",{params:{doenetId:t}});S(r.responses)}n&&l(n)},[n]),!y||!o)return null;let i=["User's Name","Email","Student Id"];for(let l of o){let t=JSON.parse(l.stateVariables,b);for(let r of Object.keys(t))if(!i.includes(r)){let e=t[r];(e!=null&&e.immediateValue||e!=null&&e.value||e!=null&&e.allSelectedIndices)&&i.push(r)}}let c=[];for(let[l,t]of Object.entries(o)){let r=JSON.parse(t.stateVariables,b),e=[];for(let[h,x]of Object.entries(i))if(h>2){let s=r[x],d="N/A";s!=null&&s.immediateValue?d=s.immediateValue:s!=null&&s.value?d=s.value:s!=null&&s.allSelectedIndices&&(d=s.allSelectedIndices[0]),e.push(a("td",{children:d},`survey${l}-${h}`))}e.unshift(a("td",{children:t.studentId})),e.unshift(a("td",{children:t.email})),e.unshift(a("td",{children:`${t.firstName} ${t.lastName}`})),c.push(a("tr",{style:{borderBottom:"1pt solid var(--canvastext)"},children:e}))}let f=[];for(let[l,t]of Object.entries(i))f.push(a("th",{style:{width:"150px"},children:t},`surveyHead${l}`));return a("div",{style:{margin:"5px"},children:v("table",{style:{borderCollapse:"collapse"},children:[a("thead",{children:a("tr",{style:{borderBottom:"2pt solid var(--canvastext)"},children:f})}),a("tbody",{children:c})]})})}export{O as default}; diff --git a/dist/assets/Textfield-637f7b37.js b/dist/assets/Textfield-381b1f5a.js similarity index 96% rename from dist/assets/Textfield-637f7b37.js rename to dist/assets/Textfield-381b1f5a.js index 0804ff571f..f1cfb6a2dc 100644 --- a/dist/assets/Textfield-637f7b37.js +++ b/dist/assets/Textfield-381b1f5a.js @@ -1,4 +1,4 @@ -import{r as l,j as u,F as y,a as w,s as $}from"./index-61b6fc23.js";const S=$.input` +import{r as l,j as u,F as y,a as w,s as $}from"./index-9d63439d.js";const S=$.input` /* margin: 0px 4px 0px 0px; */ height: 24px; width: ${e=>e.width}; // Menu prop diff --git a/dist/assets/TimerMenu-8c34bf1e.js b/dist/assets/TimerMenu-54867514.js similarity index 58% rename from dist/assets/TimerMenu-8c34bf1e.js rename to dist/assets/TimerMenu-54867514.js index edd439deb5..8d2d999749 100644 --- a/dist/assets/TimerMenu-8c34bf1e.js +++ b/dist/assets/TimerMenu-54867514.js @@ -1 +1 @@ -import{l as n,m as d,r as t,k as D,N as S,j as h}from"./index-61b6fc23.js";import{l as w}from"./CourseToolHandler-d3da4c3a.js";import{currentAttemptNumber as x}from"./AssignmentViewer-ce09819c.js";import"./index-1380c04c.js";import"./index-fcf36459.js";import"./index-47ca4f11.js";import"./index.esm-d246f4c9.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./ButtonGroup-6d856500.js";import"./ActivityViewer-5e9601b2.js";import"./activityUtils-3e149527.js";import"./visibility-sensor-398e690f.js";import"./ActionButton-be9a12e7.js";import"./RoleDropdown-c9fff172.js";import"./DropdownMenu-5673dfd7.js";function C(){const m=n(d("doenetId")),a=n(x),{timeLimit:o}=n(w(m));let[u,r]=t.useState("Unlimited");const[s,l]=t.useState(null),[c,f]=t.useState(new Date);let p=t.useRef(null);return t.useEffect(()=>{let i=new Date;D.get("/api/loadAttemptStartTime.php",{params:{doenetId:m,attemptNumber:a}}).then(({data:e})=>{e.attemptStart!==null&&(i=S(e.attemptStart));let T=new Date(i.getTime()+o*6e4*e.timeLimitMultiplier);l(T)}).catch(console.error)},[a,o,m,l]),t.useEffect(()=>{if(clearTimeout(p.current),o>0){let i=Math.floor((s-new Date)/6e4),e=(s-new Date)/6e4;e<=0?r("Time's Up"):(e<1?r("< 1 Min"):r(i===1?"1 Min":`${i} Mins`),p.current=setTimeout(()=>{e>=0&&f(new Date)},1e4))}},[c,s]),h("div",{style:{fontSize:"40px",textAlign:"center"},children:u})}export{C as default}; +import{l as n,m as d,r as t,k as D,N as S,j as h}from"./index-9d63439d.js";import{l as w}from"./CourseToolHandler-d3661515.js";import{currentAttemptNumber as x}from"./AssignmentViewer-07288d77.js";import"./index-df71c5ec.js";import"./index-fcf36459.js";import"./index-47ca4f11.js";import"./index.esm-d6b6ff57.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./ButtonGroup-ec02b3e9.js";import"./ActivityViewer-90c65d6d.js";import"./activityUtils-5d3d0ed0.js";import"./visibility-sensor-aefdbbd5.js";import"./ActionButton-056b08c3.js";import"./RoleDropdown-2d4e4388.js";import"./DropdownMenu-421d3462.js";function C(){const m=n(d("doenetId")),a=n(x),{timeLimit:o}=n(w(m));let[u,r]=t.useState("Unlimited");const[s,l]=t.useState(null),[c,f]=t.useState(new Date);let p=t.useRef(null);return t.useEffect(()=>{let i=new Date;D.get("/api/loadAttemptStartTime.php",{params:{doenetId:m,attemptNumber:a}}).then(({data:e})=>{e.attemptStart!==null&&(i=S(e.attemptStart));let T=new Date(i.getTime()+o*6e4*e.timeLimitMultiplier);l(T)}).catch(console.error)},[a,o,m,l]),t.useEffect(()=>{if(clearTimeout(p.current),o>0){let i=Math.floor((s-new Date)/6e4),e=(s-new Date)/6e4;e<=0?r("Time's Up"):(e<1?r("< 1 Min"):r(i===1?"1 Min":`${i} Mins`),p.current=setTimeout(()=>{e>=0&&f(new Date)},1e4))}},[c,s]),h("div",{style:{fontSize:"40px",textAlign:"center"},children:u})}export{C as default}; diff --git a/dist/assets/ToggleButton-0b55a995.js b/dist/assets/ToggleButton-fffa6800.js similarity index 96% rename from dist/assets/ToggleButton-0b55a995.js rename to dist/assets/ToggleButton-fffa6800.js index 3053d45abc..6a74c0e130 100644 --- a/dist/assets/ToggleButton-0b55a995.js +++ b/dist/assets/ToggleButton-fffa6800.js @@ -1,4 +1,4 @@ -import{r as u,j as t,F as m,a as r,s as g,b9 as h}from"./index-61b6fc23.js";const c=g.button` +import{r as u,j as t,F as m,a as r,s as g,b9 as h}from"./index-9d63439d.js";const c=g.button` margin: ${e=>e.theme.margin}; height: 24px; border: ${e=>e.alert?"2px solid var(--mainRed)":e.disabled?"2px solid var(--mainGray)":"2px solid var(--mainBlue)"}; diff --git a/dist/assets/ToggleButtonGroup-e9ff9889.js b/dist/assets/ToggleButtonGroup-0ab38e3a.js similarity index 90% rename from dist/assets/ToggleButtonGroup-e9ff9889.js rename to dist/assets/ToggleButtonGroup-0ab38e3a.js index ef7058d85e..240ab1d6be 100644 --- a/dist/assets/ToggleButtonGroup-e9ff9889.js +++ b/dist/assets/ToggleButtonGroup-0ab38e3a.js @@ -1,4 +1,4 @@ -import{s as g,r as h,av as a,j as n,aw as u}from"./index-61b6fc23.js";const m=g.div` +import{s as g,r as h,av as a,j as n,aw as u}from"./index-9d63439d.js";const m=g.div` display: ${t=>t.vertical?"static":"flex"}; width: ${t=>t.width=="menu"?"var(--menuWidth)":""}; // height: 'fit-content'; diff --git a/dist/assets/VersionHistory-01744f87.js b/dist/assets/VersionHistory-b747a86e.js similarity index 93% rename from dist/assets/VersionHistory-01744f87.js rename to dist/assets/VersionHistory-b747a86e.js index a226f763ac..a20f446ecb 100644 --- a/dist/assets/VersionHistory-01744f87.js +++ b/dist/assets/VersionHistory-b747a86e.js @@ -1 +1 @@ -import{l as x,m as J,b as re,y as de,v as B,k as b,z as g,ae as k,ah as T,aA as ce,j as c,a as E,F as le,B as A,ag as X}from"./index-61b6fc23.js";import{i as w,f as K,b as P,C as me,R as fe}from"./CourseToolHandler-d3da4c3a.js";import{R as Q}from"./RelatedItems-33d92928.js";import{e as De,t as _}from"./EditorViewerRecoil-fde09b36.js";import"./index-1380c04c.js";import"./index-fcf36459.js";import"./index-47ca4f11.js";import"./index.esm-d246f4c9.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./ButtonGroup-6d856500.js";const O=X({key:"currentDraftSelectedAtom",default:!0}),j=X({key:"selectedVersionIdAtom",default:null});function Se(Y){var q;console.log(">>>===VersionHistory");const R=x(J("doenetId")),Z=decodeURIComponent(x(J("path"))),S=re(w(R)),ee=x(De),te=x(j),h=de(),V=x(O),[F,L,U]=Z.split(":"),ne=B(({set:t,snapshot:l})=>async({doenetId:e,versionId:I,driveId:m,folderId:r,itemId:d})=>{const{data:o}=await b.get("/api/releaseVersion.php",{params:{doenetId:e,versionId:I}}),{success:f,message:u,isReleased:D,title:p}=o;let y="Retracted";D==="1"&&(y="Released"),f?h(`"${p}" is ${y}`,g.SUCCESS):h(u,g.ERROR),t(w(e),a=>{let n={...a},s=[...a.named];for(const[v,N]of s.entries()){let C={...N};N.versionId===I?(C.isReleased=D,s[v]=C):(C.isReleased="0",s[v]=C)}return n.named=s,n}),t(K({driveId:m,folderId:r}),a=>{let n={...a};for(let s of n.contentIds.defaultOrder)if(n.contentsDictionary[s].doenetId===e){d=s;break}return n.contentsDictionary={...a.contentsDictionary},n.contentsDictionary[d]={...a.contentsDictionary[d]},n.contentsDictionary[d].isReleased=D,n.contentsDictionaryByDoenetId={...a.contentsDictionaryByDoenetId},n.contentsDictionaryByDoenetId[e]={...a.contentsDictionaryByDoenetId[e]},n.contentsDictionaryByDoenetId[e].isReleased=D,n})}),ie=B(({snapshot:t,set:l})=>async({doenetId:e,versionId:I})=>{const m=await t.getPromise(w(e));let r={...m.draft};r.isDraft="0";const d=`Save (current) ${m.named.length+1}`;r.title=d,r.timestamp=P();let o={};for(let p of m.named)p.versionId===I&&(o={...p});const f=k();o.versionId=f,o.isDraft="1",o.isNamed="0",o.isReleased="0";let u={...m};u.named=[r,...m.named],u.draft=o,l(w(e),u),l(O,!0),l(j,f);let D={...o,isSetAsCurrent:"1",newDraftVersionId:f,newDraftContentId:o.cid,doenetId:e,newTitle:d};b.post("/api/saveNewVersion.php",D)}),se=B(({snapshot:t,set:l})=>async e=>{const I=await t.getPromise(_),m=P(),r=await T(I),d=k(),o=await t.getPromise(w(e));let f={...o},D={title:`Save ${o.named.length+1}`,versionId:d,timestamp:m,isReleased:"0",isDraft:"0",isNamed:"1",cid:r},p={...D,doenetML:I,doenetId:e};f.named=[D,...o.named],l(w(e),f),b.post("/api/saveNewVersion.php",p).then(y=>{var a,n;(a=y==null?void 0:y.data)!=null&&a.success?h("New Version Saved!",g.SUCCESS):(h("Version NOT Saved!",g.ERROR),console.error((n=y.data)==null?void 0:n.message))}).catch(y=>{h("Version NOT Saved!",g.ERROR)})}),oe=B(({snapshot:t,set:l})=>async({doenetId:e,driveId:I,folderId:m,itemId:r})=>{const d=await t.getPromise(_),o=ce(new Date),f=await T(d),u=k(),{data:D}=await b.post("/api/releaseDraft.php",{doenetId:e,doenetML:d,timestamp:o,versionId:u}),{success:p,message:y,title:a}=D;p?h(`"${a}" is Released.`,g.SUCCESS):h(y,g.ERROR),l(w(e),n=>{let s={...n},v=[...n.named];for(const[C,ae]of v.entries()){let G={...ae};G.isReleased="0",v[C]=G}let N={title:a,versionId:u,timestamp:o,isReleased:"1",isDraft:"0",isNamed:"1",cid:f};return v.unshift(N),s.named=v,s}),l(K({driveId:I,folderId:m}),n=>{let s={...n};for(let v of s.contentIds.defaultOrder)if(s.contentsDictionary[v].doenetId===e){r=v;break}return s.contentsDictionary={...n.contentsDictionary},s.contentsDictionary[r]={...n.contentsDictionary[r]},s.contentsDictionary[r].isReleased="1",s.contentsDictionaryByDoenetId={...n.contentsDictionaryByDoenetId},s.contentsDictionaryByDoenetId[e]={...n.contentsDictionaryByDoenetId[e]},s.contentsDictionaryByDoenetId[e].isReleased="1",s})}),$=B(({snapshot:t,set:l})=>async({doenetId:e,versionId:I,isCurrentDraft:m})=>{l(j,I),l(O,m);const r=await t.getPromise(w(e));let d={...r},o=r.draft.cid;if(!m&&await t.getPromise(O)){const u=await t.getPromise(_),D=await T(u);if(D!==o){let p={...r.draft};p.cid=D,p.timestamp=P(),d.draft=p,l(w(e),d);let y={...p,doenetML:u,doenetId:e};try{const{data:a}=await b.post("/api/saveNewVersion.php",y);a.success||console.log("ERROR",a.message)}catch(a){console.log("ERROR",a)}}}d.draft.cid;for(let f of d.named)if(f.versionId===I){f.cid;break}});if(ee!==R)return c("div",{style:Y.style});if(!((q=S==null?void 0:S.contents)!=null&&q.named))return null;let M=[],z={},H=te;for(let t of S.contents.named){z[t.versionId]=t;let l=!1;t.versionId===H&&(l=!0);let e="";t.isReleased==="1"&&(e="(Released)"),M.push(E("option",{value:t.versionId,selected:l,children:[e," ",t.title]},`option${t.versionId}`))}const i=z[H];let W="Release";return(i==null?void 0:i.isReleased)==="1"&&(W="Retract"),E(le,{children:[c("div",{style:{padding:"6px 0px 6px 0px"},children:c(Q,{size:"2",width:"menu",onChange:t=>{$({doenetId:R,versionId:t.target.value,isCurrentDraft:!0})},options:c("option",{value:S.contents.draft.versionId,selected:V,children:"Current Draft"})})}),c("div",{style:{margin:"0px 0px 6px 0px"},children:c(A,{disabled:!V,width:"menu",value:"Save Version",onClick:()=>se(R)})}),c("div",{style:{margin:"6px 0px 6px 0px"},children:c(A,{disabled:!V,width:"menu",value:"Release Current",onClick:()=>{oe({doenetId:R,driveId:F,folderId:L,itemId:U})}})}),c("div",{children:"History"}),c(Q,{size:"8",width:"menu",onChange:t=>{$({doenetId:R,versionId:t.target.value,isCurrentDraft:!1})},options:M}),E("div",{children:["Name: ",i==null?void 0:i.title]}),c(me,{disabled:V,cid:i==null?void 0:i.cid,doenetId:R}),c("div",{children:c(fe,{disabled:V,doenetId:R,title:i==null?void 0:i.title,versionId:i==null?void 0:i.versionId},i==null?void 0:i.versionId)}),c("div",{children:c(A,{disabled:V,onClick:()=>ie({doenetId:R,versionId:i.versionId}),value:"Set As Current"})}),c("div",{children:c(A,{disabled:V,onClick:()=>ne({doenetId:R,versionId:i.versionId,driveId:F,folderId:L,itemId:U}),value:W})})]})}export{O as currentDraftSelectedAtom,Se as default,j as selectedVersionIdAtom}; +import{l as x,m as J,b as re,y as de,v as B,k as b,z as g,ae as k,ah as T,aA as ce,j as c,a as E,F as le,B as A,ag as X}from"./index-9d63439d.js";import{i as w,f as K,b as P,C as me,R as fe}from"./CourseToolHandler-d3661515.js";import{R as Q}from"./RelatedItems-23ef0ca1.js";import{e as De,t as _}from"./EditorViewerRecoil-4f9a7d1d.js";import"./index-df71c5ec.js";import"./index-fcf36459.js";import"./index-47ca4f11.js";import"./index.esm-d6b6ff57.js";import"./setPrototypeOf-51e8cf87.js";/* empty css */import"./ButtonGroup-ec02b3e9.js";const O=X({key:"currentDraftSelectedAtom",default:!0}),j=X({key:"selectedVersionIdAtom",default:null});function Se(Y){var q;console.log(">>>===VersionHistory");const R=x(J("doenetId")),Z=decodeURIComponent(x(J("path"))),S=re(w(R)),ee=x(De),te=x(j),h=de(),V=x(O),[F,L,U]=Z.split(":"),ne=B(({set:t,snapshot:l})=>async({doenetId:e,versionId:I,driveId:m,folderId:r,itemId:d})=>{const{data:o}=await b.get("/api/releaseVersion.php",{params:{doenetId:e,versionId:I}}),{success:f,message:u,isReleased:D,title:p}=o;let y="Retracted";D==="1"&&(y="Released"),f?h(`"${p}" is ${y}`,g.SUCCESS):h(u,g.ERROR),t(w(e),a=>{let n={...a},s=[...a.named];for(const[v,N]of s.entries()){let C={...N};N.versionId===I?(C.isReleased=D,s[v]=C):(C.isReleased="0",s[v]=C)}return n.named=s,n}),t(K({driveId:m,folderId:r}),a=>{let n={...a};for(let s of n.contentIds.defaultOrder)if(n.contentsDictionary[s].doenetId===e){d=s;break}return n.contentsDictionary={...a.contentsDictionary},n.contentsDictionary[d]={...a.contentsDictionary[d]},n.contentsDictionary[d].isReleased=D,n.contentsDictionaryByDoenetId={...a.contentsDictionaryByDoenetId},n.contentsDictionaryByDoenetId[e]={...a.contentsDictionaryByDoenetId[e]},n.contentsDictionaryByDoenetId[e].isReleased=D,n})}),ie=B(({snapshot:t,set:l})=>async({doenetId:e,versionId:I})=>{const m=await t.getPromise(w(e));let r={...m.draft};r.isDraft="0";const d=`Save (current) ${m.named.length+1}`;r.title=d,r.timestamp=P();let o={};for(let p of m.named)p.versionId===I&&(o={...p});const f=k();o.versionId=f,o.isDraft="1",o.isNamed="0",o.isReleased="0";let u={...m};u.named=[r,...m.named],u.draft=o,l(w(e),u),l(O,!0),l(j,f);let D={...o,isSetAsCurrent:"1",newDraftVersionId:f,newDraftContentId:o.cid,doenetId:e,newTitle:d};b.post("/api/saveNewVersion.php",D)}),se=B(({snapshot:t,set:l})=>async e=>{const I=await t.getPromise(_),m=P(),r=await T(I),d=k(),o=await t.getPromise(w(e));let f={...o},D={title:`Save ${o.named.length+1}`,versionId:d,timestamp:m,isReleased:"0",isDraft:"0",isNamed:"1",cid:r},p={...D,doenetML:I,doenetId:e};f.named=[D,...o.named],l(w(e),f),b.post("/api/saveNewVersion.php",p).then(y=>{var a,n;(a=y==null?void 0:y.data)!=null&&a.success?h("New Version Saved!",g.SUCCESS):(h("Version NOT Saved!",g.ERROR),console.error((n=y.data)==null?void 0:n.message))}).catch(y=>{h("Version NOT Saved!",g.ERROR)})}),oe=B(({snapshot:t,set:l})=>async({doenetId:e,driveId:I,folderId:m,itemId:r})=>{const d=await t.getPromise(_),o=ce(new Date),f=await T(d),u=k(),{data:D}=await b.post("/api/releaseDraft.php",{doenetId:e,doenetML:d,timestamp:o,versionId:u}),{success:p,message:y,title:a}=D;p?h(`"${a}" is Released.`,g.SUCCESS):h(y,g.ERROR),l(w(e),n=>{let s={...n},v=[...n.named];for(const[C,ae]of v.entries()){let G={...ae};G.isReleased="0",v[C]=G}let N={title:a,versionId:u,timestamp:o,isReleased:"1",isDraft:"0",isNamed:"1",cid:f};return v.unshift(N),s.named=v,s}),l(K({driveId:I,folderId:m}),n=>{let s={...n};for(let v of s.contentIds.defaultOrder)if(s.contentsDictionary[v].doenetId===e){r=v;break}return s.contentsDictionary={...n.contentsDictionary},s.contentsDictionary[r]={...n.contentsDictionary[r]},s.contentsDictionary[r].isReleased="1",s.contentsDictionaryByDoenetId={...n.contentsDictionaryByDoenetId},s.contentsDictionaryByDoenetId[e]={...n.contentsDictionaryByDoenetId[e]},s.contentsDictionaryByDoenetId[e].isReleased="1",s})}),$=B(({snapshot:t,set:l})=>async({doenetId:e,versionId:I,isCurrentDraft:m})=>{l(j,I),l(O,m);const r=await t.getPromise(w(e));let d={...r},o=r.draft.cid;if(!m&&await t.getPromise(O)){const u=await t.getPromise(_),D=await T(u);if(D!==o){let p={...r.draft};p.cid=D,p.timestamp=P(),d.draft=p,l(w(e),d);let y={...p,doenetML:u,doenetId:e};try{const{data:a}=await b.post("/api/saveNewVersion.php",y);a.success||console.log("ERROR",a.message)}catch(a){console.log("ERROR",a)}}}d.draft.cid;for(let f of d.named)if(f.versionId===I){f.cid;break}});if(ee!==R)return c("div",{style:Y.style});if(!((q=S==null?void 0:S.contents)!=null&&q.named))return null;let M=[],z={},H=te;for(let t of S.contents.named){z[t.versionId]=t;let l=!1;t.versionId===H&&(l=!0);let e="";t.isReleased==="1"&&(e="(Released)"),M.push(E("option",{value:t.versionId,selected:l,children:[e," ",t.title]},`option${t.versionId}`))}const i=z[H];let W="Release";return(i==null?void 0:i.isReleased)==="1"&&(W="Retract"),E(le,{children:[c("div",{style:{padding:"6px 0px 6px 0px"},children:c(Q,{size:"2",width:"menu",onChange:t=>{$({doenetId:R,versionId:t.target.value,isCurrentDraft:!0})},options:c("option",{value:S.contents.draft.versionId,selected:V,children:"Current Draft"})})}),c("div",{style:{margin:"0px 0px 6px 0px"},children:c(A,{disabled:!V,width:"menu",value:"Save Version",onClick:()=>se(R)})}),c("div",{style:{margin:"6px 0px 6px 0px"},children:c(A,{disabled:!V,width:"menu",value:"Release Current",onClick:()=>{oe({doenetId:R,driveId:F,folderId:L,itemId:U})}})}),c("div",{children:"History"}),c(Q,{size:"8",width:"menu",onChange:t=>{$({doenetId:R,versionId:t.target.value,isCurrentDraft:!1})},options:M}),E("div",{children:["Name: ",i==null?void 0:i.title]}),c(me,{disabled:V,cid:i==null?void 0:i.cid,doenetId:R}),c("div",{children:c(fe,{disabled:V,doenetId:R,title:i==null?void 0:i.title,versionId:i==null?void 0:i.versionId},i==null?void 0:i.versionId)}),c("div",{children:c(A,{disabled:V,onClick:()=>ie({doenetId:R,versionId:i.versionId}),value:"Set As Current"})}),c("div",{children:c(A,{disabled:V,onClick:()=>ne({doenetId:R,versionId:i.versionId,driveId:F,folderId:L,itemId:U}),value:W})})]})}export{O as currentDraftSelectedAtom,Se as default,j as selectedVersionIdAtom}; diff --git a/dist/assets/ViewerUpdateButton-9d2b5cf6.js b/dist/assets/ViewerUpdateButton-9d2b5cf6.js deleted file mode 100644 index f7f1031ba2..0000000000 --- a/dist/assets/ViewerUpdateButton-9d2b5cf6.js +++ /dev/null @@ -1 +0,0 @@ -import{j as t,B as r}from"./index-61b6fc23.js";import{u as o}from"./EditorViewer-e9155b9a.js";import"./EditorViewerRecoil-fde09b36.js";function d(e){const a=o();return t("div",{style:e.style,children:t(r,{"data-test":"Viewer Update Button",value:"Update",onClick:a})})}export{d as default}; diff --git a/dist/assets/ViewerUpdateButton-cefc1561.js b/dist/assets/ViewerUpdateButton-cefc1561.js new file mode 100644 index 0000000000..19ffd9f541 --- /dev/null +++ b/dist/assets/ViewerUpdateButton-cefc1561.js @@ -0,0 +1 @@ +import{j as t,B as r}from"./index-9d63439d.js";import{u as o}from"./EditorViewer-34bd5cb9.js";import"./EditorViewerRecoil-4f9a7d1d.js";function d(e){const a=o();return t("div",{style:e.style,children:t(r,{"data-test":"Viewer Update Button",value:"Update",onClick:a})})}export{d as default}; diff --git a/dist/assets/WelcomePlacementExam-5f31a01d.js b/dist/assets/WelcomePlacementExam-54d3df1c.js similarity index 99% rename from dist/assets/WelcomePlacementExam-5f31a01d.js rename to dist/assets/WelcomePlacementExam-54d3df1c.js index 81b10b3952..881d4cffc0 100644 --- a/dist/assets/WelcomePlacementExam-5f31a01d.js +++ b/dist/assets/WelcomePlacementExam-54d3df1c.js @@ -1,4 +1,4 @@ -import{aa as ae,R as a_,p as c_,l as cl,m as hl,r as Mt,j as un,F as gl,a as Ut,B as Oi,k as h_}from"./index-61b6fc23.js";import{B as g_}from"./ButtonGroup-6d856500.js";var Wi={},p_={get exports(){return Wi},set exports(ft){Wi=ft}};/** +import{aa as ae,R as a_,p as c_,l as cl,m as hl,r as Mt,j as un,F as gl,a as Ut,B as Oi,k as h_}from"./index-9d63439d.js";import{B as g_}from"./ButtonGroup-ec02b3e9.js";var Wi={},p_={get exports(){return Wi},set exports(ft){Wi=ft}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors diff --git a/dist/assets/activityUtils-3e149527.js b/dist/assets/activityUtils-5d3d0ed0.js similarity index 99% rename from dist/assets/activityUtils-3e149527.js rename to dist/assets/activityUtils-5d3d0ed0.js index c71a6c11ab..a2b0213308 100644 --- a/dist/assets/activityUtils-3e149527.js +++ b/dist/assets/activityUtils-5d3d0ed0.js @@ -1 +1 @@ -import{ak as M,al as R,ac as I,ah as $,am as L,an as x,ao as z,ap as W,aq as j,ar as q,as as F}from"./index-61b6fc23.js";function P(){let n=M(),t=R(),e={};for(let a in n)e[a.toLowerCase()]=a;let s={};for(let a in n)Object.defineProperty(s,a,{get:function(){let u=n[a].returnStateVariableInfo();return delete s[a],s[a]=u}.bind(this),configurable:!0});let l={};for(let a in n)Object.defineProperty(l,a,{get:function(){let u=n[a].returnStateVariableInfo({onlyPublic:!0});return delete l[a],l[a]=u}.bind(this),configurable:!0});function o({inheritedComponentType:a,baseComponentType:u}){if(a===u)return!0;if(a==="string")return u==="_base"||u==="_inline";if(u==="string")return!1;let r=n[u];return r?r.isPrototypeOf(n[a]):!1}function i({componentType:a,includeNonStandard:u=!0}){let r=n[a];return r?o({inheritedComponentType:a,baseComponentType:"_composite"})&&(u||!r.treatAsComponentForRecursiveReplacements):!1}let c=(a,u)=>o({inheritedComponentType:a,baseComponentType:u});return{allComponentClasses:n,componentTypesCreatingVariants:t,componentTypeLowerCaseMapping:e,isInheritedComponentType:o,isCompositeComponent:i,stateVariableInfo:s,publicStateVariableInfo:l,componentIsSpecifiedType:(a,u)=>{var r,p;return c(a.componentType,u)||c((p=(r=a.attributes)==null?void 0:r.createComponentOfType)==null?void 0:p.primitive,u)}}}async function T({cid:n,doenetML:t}){t===void 0?t=await I(n,"doenet"):n||(n=await $(t));let e=P(),{fullSerializedComponents:s}=await L({contentIds:[n],doenetMLs:[t],componentInfoObjects:e}),l=s[0];x(l);let o=l[0],i=z({serializedComponent:o,componentInfoObjects:e}),c=i.numberOfVariants,f;if(i.variantNames){let a=[...i.variantNames];if(a.length>=c)a=a.slice(0,c);else{let u=[...a],r=a.length,p=r,d;for(;rO(a+1));return{allPossibleVariants:f,doenetML:t,cid:n}}function O(n){return W(n,!0)}function k(n,t,e){let s=e&&e.state;s&&(typeof s=="object"&&t.copy(s,t),n.state=()=>t.copy(t,{}))}function _(n,t){let e=new B(n),s=()=>e.next();return s.double=()=>s()+(s()*2097152|0)*11102230246251565e-32,s.int32=()=>e.next()*4294967296|0,s.quick=s,k(s,e,t),s}class B{constructor(t){t==null&&(t=+new Date);let e=4022871197;this.c=1,this.s0=s(" "),this.s1=s(" "),this.s2=s(" "),this.s0-=s(t),this.s0<0&&(this.s0+=1),this.s1-=s(t),this.s1<0&&(this.s1+=1),this.s2-=s(t),this.s2<0&&(this.s2+=1);function s(l){l=String(l);for(let o=0;o>>0,i-=e,i*=e,e=i>>>0,i-=e,e+=i*4294967296}return(e>>>0)*23283064365386963e-26}}next(){let{c:t,s0:e,s1:s,s2:l}=this,o=2091639*e+t*23283064365386963e-26;return this.s0=s,this.s1=l,this.s2=o-(this.c=o|0)}copy(t,e){return e.c=t.c,e.s0=t.s0,e.s1=t.s1,e.s2=t.s2,e}}let E=_;function U(n){let t=j(n).filter(i=>typeof i!="string"||/\S/.test(i));if(t.length!==1||t[0].componentType!=="document")return{success:!1,message:"Invalid activity definition"};t=t[0];let e={};for(let i in t.props){let c=i.toLowerCase();if(c in e)return{success:!1,message:`Invalid activity definition: duplicate attribute ${c}`};e[i.toLowerCase()]=t.props[i]}let s;if(e.type.toLowerCase()==="activity"){let i={type:"activity"};if(delete e.type,e.itemweights){if(typeof e.itemweights!="string")return{success:!1,message:"Invalid activity definition: invalid itemWeights"};i.itemWeights=e.itemweights.split(/\s+/).filter(a=>a).map(Number),delete e.itemweights}if(i.shuffleItemWeights=e.shuffleitemweights!==void 0&&(e.shuffleitemweights===!0||e.shuffleitemweights.toLowerCase()==="true"),delete e.shuffleitemweights,i.isSinglePage=e.issinglepage!==void 0&&(e.issinglepage===!0||e.issinglepage.toLowerCase()==="true"),delete e.issinglepage,e.xmlns)if(e.xmlns.slice(0,34)==="https://doenet.org/spec/doenetml/v")i.version=e.xmlns.slice(34),s=e.xmlns,delete e.xmlns;else return{success:!1,message:"Invalid activity definition: unrecognized xmlns"};else console.warn("no xmlns of activity!");if(e.numberofvariants&&(i.numberOfVariants=Number(e.numberofvariants),delete e.numberofvariants),Object.keys(e).length>0)return{success:!1,message:`Invalid activity definition: invalid document attributes: ${Object.keys(e).join(", ")}`};let c={type:"order",behavior:"sequence",children:t.children},f=l(c);return f.success?(i.order=f.order,{success:!0,activityJSON:i}):{success:!1,message:`Invalid activity definition: ${f.message}`}}else if(e.type.toLowerCase()==="page"){let c={type:"activity",order:{type:"order",behavior:"sequence",content:[{type:"page",doenetML:n}]}};if(e.xmlns)if(e.xmlns.slice(0,34)==="https://doenet.org/spec/doenetml/v")c.version=e.xmlns.slice(34),delete e.xmlns;else return{success:!1,message:"Invalid activity definition: unrecognized xmlns"};else console.warn("no xmlns of activity!");return{success:!0,activityJSON:c}}else return{success:!1,message:"Invalid activity definition"};function l(i){let c={type:"order"},f={};for(let r in i.props){let p=r.toLowerCase();if(p in f)return{success:!1,message:`duplicate attribute of order ${p}`};f[r.toLowerCase()]=i.props[r]}for(let r in f)if(r==="behavior")c.behavior=f.behavior;else if(r=="numbertoselect")c.numberToSelect=Number(f.numbertoselect);else if(r=="withreplacement")c.withReplacement=f.withreplacement!==void 0&&(f.withreplacement===!0||f.withreplacement.toLowerCase()==="true");else return{success:!1,message:`invalid order attribute: ${r}`};let a=i.children.filter(r=>typeof r!="string"||/\S/.test(r)),u=[];for(let r of a)if(r.componentType.toLowerCase()==="order"){let p=l(r);if(p.success)u.push(p.order);else return p}else if(r.componentType.toLowerCase()=="page"){let p=o(r);if(p.success)u.push(p.page);else return p}else return{success:!1,message:`invalid child of order, found type: ${r.componentType}`};return c.content=u,{success:!0,order:c}}function o(i){var a;let c={type:"page"},f={};for(let u in i.props){let r=u.toLowerCase();if(r in f)return{success:!1,message:`duplicate attribute of page ${r}`};f[u.toLowerCase()]=i.props[u]}for(let u in f)if(u==="cid")c.cid=f.cid,delete f.cid;else return{success:!1,message:`invalid page attribute: ${u}`};if(i.children.length>0){let u=n.slice(i.range.openEnd,i.range.closeBegin);if(((a=i.children[0].componentType)==null?void 0:a.toLowerCase())!=="document"){let r="";s&&(r=` xmlns="${s}"`),u=`${u}`}c.doenetML=u}return{success:!0,page:c}}}async function X({activityDefinition:n,requestedVariantIndex:t}){let e=await S(n),s=(t-1)%e.numberOfVariants+1;if(s<1&&(s+=e.numberOfVariants),!Number.isFinite(s))return{success:!1,message:"Invalid requested variant index"};let l=new E(s.toString()),o=C(n.order,l);if(!o.success)return o;let i=o.pages,c=n.itemWeights||[];if(!Array.isArray(c)||!c.every(m=>m>=0))return{success:!1,message:"Invalid itemWeights"};let f=i.length;c=c.slice(0,f),c.lengthm+g);a>0&&(c=c.map(m=>m/a));let u;if(e.pageVariants)u=[e.pageVariants];else{let m=[];for(let g of i)m.push(T({cid:g.cid,doenetML:g.doenetML}));try{u=await Promise.all(m)}catch(g){return{success:!1,message:`Error retrieving content for activity. ${g.message}`}}}let r,p=[],d=[];for(let m of u)p.push(m.allPossibleVariants),d.push(m.allPossibleVariants.length);let y=d.reduce((m,g)=>m*g,1);if(y<=e.numberOfVariants){let m=(s-1)%y+1;r=q({numberOfOptionsByIndex:d,maxNumber:m})[m-1].map(g=>g+1)}else r=[...Array(f).keys()].map(m=>Math.floor(l()*d[m])+1);let h=[],v=[];for(let[m,g]of u.entries()){let N=r[m];h.push(N);let b=i[m];b.doenetML===void 0?(b={...b},b.doenetML=g.doenetML):b.cid||(b={...b},b.cid=g.cid),v.push(b)}let w=[...i];v.forEach((m,g)=>w[g].cid=m.cid);let V=await K(v),A={orderWithCids:w,variantsByPage:h,itemWeights:c,numberOfVariants:e.numberOfVariants,previousComponentTypeCounts:V};return{success:!0,order:v,itemWeights:c,variantsByPage:h,variantIndex:s,activityInfo:A,previousComponentTypeCounts:V}}async function S(n){let t=1e3,e=null;if(n.numberOfVariants!==void 0)t=n.numberOfVariants,Number.isInteger(t)&&t>=1||(t=1e3);else if((n.order.behavior===void 0||n.order.behavior==="sequence")&&n.order.content.every(s=>s.type==="page")){let s=[];for(let l of n.order.content)s.push(T({cid:l.cid,doenetML:l.doenetML}));e=await Promise.all(s),t=e.reduce((l,o)=>l*o.allPossibleVariants.length,1),t=Math.min(1e3,t)}return{numberOfVariants:t,pageVariantsResult:e}}async function Y(n){let t=await I(n),e=U(t);return e.success?(e=await S(e.activityJSON),{success:!0,numberOfVariants:e.numberOfVariants}):e}function C(n,t){var s,l;if(((s=n==null?void 0:n.type)==null?void 0:s.toLowerCase())!=="order")return{success:!1,message:"invalid order"};let e=(l=n.behavior)==null?void 0:l.toLowerCase();switch(e===void 0&&(e="sequence"),e){case"sequence":return J(n,t);case"select":return G(n,t);case"shuffle":return H(n,t);default:return{success:!1,message:`Have not implemented behavior: ${e}`}}}function J(n,t){let e=[];for(let s of n.content){let l=s.type.toLowerCase();if(l==="page")e.push(s);else if(l==="order"){let o=C(s,t);if(o.success)e.push(...o.pages);else return o}else return{success:!1,message:"Unrecognized item in order."}}return{success:!0,pages:e}}function G(n,t){let e=n.numberToSelect,s=n.content.length;Number.isInteger(e)&&e>0||(e=1);let l=1;if(n.withReplacement||(l=e),l>s)return{success:!1,message:"Cannot select "+l+" components from only "+s};let o=n.selectWeights||[];if(!Array.isArray(o)||!o.every(r=>r>=0))return{success:!1,message:"Invalid selectWeights"};o=o.slice(0,s),o.lengthr+p);o=o.map(r=>r/i);let c=o.reduce((r,p,d)=>[...r,p+(r[d-1]||0)],[]),f=[...Array(c.length).keys()],a=[];for(let r=0;rp?y=h:d=h}a.push(n.content[f[y]]),!n.withReplacement&&rh+v),o=o.map(h=>h/i),c=o.reduce((h,v,w)=>[...h,v+(h[w-1]||0)],[]))}let u=[];for(let r of a){let p=r.type.toLowerCase();if(p==="page")u.push(r);else if(p==="order"){let d=C(r);if(d.success)u.push(...d.pages);else return d}else return{success:!1,message:"Unrecognized item in order."}}return{success:!0,pages:u}}function H(n,t){let e=[...n.content];for(let l=n.content.length-1;l>0;l--){const o=t(),i=Math.floor(o*(l+1));[e[l],e[i]]=[e[i],e[l]]}let s=[];for(let l of e){let o=l.type.toLowerCase();if(o==="page")s.push(l);else if(o==="order"){let i=C(l,t);if(i.success)s.push(...i.pages);else return i}else return{success:!1,message:"Unrecognized item in order."}}return{success:!0,pages:s}}async function K(n){let t=[{}],e=P();for(let[s,l]of n.slice(0,n.length-1).entries()){let{fullSerializedComponents:o}=await L({contentIds:[l.cid],doenetMLs:[l.doenetML],componentInfoObjects:e}),i=o[0];x(i);let c=i[0].children,f=F(c),a=t[s];for(let u in a)u in f?f[u]+=a[u]:f[u]=a[u];t.push(f)}return t}export{_ as a,X as c,S as d,U as p,Y as r}; +import{ak as M,al as R,ac as I,ah as $,am as L,an as x,ao as z,ap as W,aq as j,ar as q,as as F}from"./index-9d63439d.js";function P(){let n=M(),t=R(),e={};for(let a in n)e[a.toLowerCase()]=a;let s={};for(let a in n)Object.defineProperty(s,a,{get:function(){let u=n[a].returnStateVariableInfo();return delete s[a],s[a]=u}.bind(this),configurable:!0});let l={};for(let a in n)Object.defineProperty(l,a,{get:function(){let u=n[a].returnStateVariableInfo({onlyPublic:!0});return delete l[a],l[a]=u}.bind(this),configurable:!0});function o({inheritedComponentType:a,baseComponentType:u}){if(a===u)return!0;if(a==="string")return u==="_base"||u==="_inline";if(u==="string")return!1;let r=n[u];return r?r.isPrototypeOf(n[a]):!1}function i({componentType:a,includeNonStandard:u=!0}){let r=n[a];return r?o({inheritedComponentType:a,baseComponentType:"_composite"})&&(u||!r.treatAsComponentForRecursiveReplacements):!1}let c=(a,u)=>o({inheritedComponentType:a,baseComponentType:u});return{allComponentClasses:n,componentTypesCreatingVariants:t,componentTypeLowerCaseMapping:e,isInheritedComponentType:o,isCompositeComponent:i,stateVariableInfo:s,publicStateVariableInfo:l,componentIsSpecifiedType:(a,u)=>{var r,p;return c(a.componentType,u)||c((p=(r=a.attributes)==null?void 0:r.createComponentOfType)==null?void 0:p.primitive,u)}}}async function T({cid:n,doenetML:t}){t===void 0?t=await I(n,"doenet"):n||(n=await $(t));let e=P(),{fullSerializedComponents:s}=await L({contentIds:[n],doenetMLs:[t],componentInfoObjects:e}),l=s[0];x(l);let o=l[0],i=z({serializedComponent:o,componentInfoObjects:e}),c=i.numberOfVariants,f;if(i.variantNames){let a=[...i.variantNames];if(a.length>=c)a=a.slice(0,c);else{let u=[...a],r=a.length,p=r,d;for(;rO(a+1));return{allPossibleVariants:f,doenetML:t,cid:n}}function O(n){return W(n,!0)}function k(n,t,e){let s=e&&e.state;s&&(typeof s=="object"&&t.copy(s,t),n.state=()=>t.copy(t,{}))}function _(n,t){let e=new B(n),s=()=>e.next();return s.double=()=>s()+(s()*2097152|0)*11102230246251565e-32,s.int32=()=>e.next()*4294967296|0,s.quick=s,k(s,e,t),s}class B{constructor(t){t==null&&(t=+new Date);let e=4022871197;this.c=1,this.s0=s(" "),this.s1=s(" "),this.s2=s(" "),this.s0-=s(t),this.s0<0&&(this.s0+=1),this.s1-=s(t),this.s1<0&&(this.s1+=1),this.s2-=s(t),this.s2<0&&(this.s2+=1);function s(l){l=String(l);for(let o=0;o>>0,i-=e,i*=e,e=i>>>0,i-=e,e+=i*4294967296}return(e>>>0)*23283064365386963e-26}}next(){let{c:t,s0:e,s1:s,s2:l}=this,o=2091639*e+t*23283064365386963e-26;return this.s0=s,this.s1=l,this.s2=o-(this.c=o|0)}copy(t,e){return e.c=t.c,e.s0=t.s0,e.s1=t.s1,e.s2=t.s2,e}}let E=_;function U(n){let t=j(n).filter(i=>typeof i!="string"||/\S/.test(i));if(t.length!==1||t[0].componentType!=="document")return{success:!1,message:"Invalid activity definition"};t=t[0];let e={};for(let i in t.props){let c=i.toLowerCase();if(c in e)return{success:!1,message:`Invalid activity definition: duplicate attribute ${c}`};e[i.toLowerCase()]=t.props[i]}let s;if(e.type.toLowerCase()==="activity"){let i={type:"activity"};if(delete e.type,e.itemweights){if(typeof e.itemweights!="string")return{success:!1,message:"Invalid activity definition: invalid itemWeights"};i.itemWeights=e.itemweights.split(/\s+/).filter(a=>a).map(Number),delete e.itemweights}if(i.shuffleItemWeights=e.shuffleitemweights!==void 0&&(e.shuffleitemweights===!0||e.shuffleitemweights.toLowerCase()==="true"),delete e.shuffleitemweights,i.isSinglePage=e.issinglepage!==void 0&&(e.issinglepage===!0||e.issinglepage.toLowerCase()==="true"),delete e.issinglepage,e.xmlns)if(e.xmlns.slice(0,34)==="https://doenet.org/spec/doenetml/v")i.version=e.xmlns.slice(34),s=e.xmlns,delete e.xmlns;else return{success:!1,message:"Invalid activity definition: unrecognized xmlns"};else console.warn("no xmlns of activity!");if(e.numberofvariants&&(i.numberOfVariants=Number(e.numberofvariants),delete e.numberofvariants),Object.keys(e).length>0)return{success:!1,message:`Invalid activity definition: invalid document attributes: ${Object.keys(e).join(", ")}`};let c={type:"order",behavior:"sequence",children:t.children},f=l(c);return f.success?(i.order=f.order,{success:!0,activityJSON:i}):{success:!1,message:`Invalid activity definition: ${f.message}`}}else if(e.type.toLowerCase()==="page"){let c={type:"activity",order:{type:"order",behavior:"sequence",content:[{type:"page",doenetML:n}]}};if(e.xmlns)if(e.xmlns.slice(0,34)==="https://doenet.org/spec/doenetml/v")c.version=e.xmlns.slice(34),delete e.xmlns;else return{success:!1,message:"Invalid activity definition: unrecognized xmlns"};else console.warn("no xmlns of activity!");return{success:!0,activityJSON:c}}else return{success:!1,message:"Invalid activity definition"};function l(i){let c={type:"order"},f={};for(let r in i.props){let p=r.toLowerCase();if(p in f)return{success:!1,message:`duplicate attribute of order ${p}`};f[r.toLowerCase()]=i.props[r]}for(let r in f)if(r==="behavior")c.behavior=f.behavior;else if(r=="numbertoselect")c.numberToSelect=Number(f.numbertoselect);else if(r=="withreplacement")c.withReplacement=f.withreplacement!==void 0&&(f.withreplacement===!0||f.withreplacement.toLowerCase()==="true");else return{success:!1,message:`invalid order attribute: ${r}`};let a=i.children.filter(r=>typeof r!="string"||/\S/.test(r)),u=[];for(let r of a)if(r.componentType.toLowerCase()==="order"){let p=l(r);if(p.success)u.push(p.order);else return p}else if(r.componentType.toLowerCase()=="page"){let p=o(r);if(p.success)u.push(p.page);else return p}else return{success:!1,message:`invalid child of order, found type: ${r.componentType}`};return c.content=u,{success:!0,order:c}}function o(i){var a;let c={type:"page"},f={};for(let u in i.props){let r=u.toLowerCase();if(r in f)return{success:!1,message:`duplicate attribute of page ${r}`};f[u.toLowerCase()]=i.props[u]}for(let u in f)if(u==="cid")c.cid=f.cid,delete f.cid;else return{success:!1,message:`invalid page attribute: ${u}`};if(i.children.length>0){let u=n.slice(i.range.openEnd,i.range.closeBegin);if(((a=i.children[0].componentType)==null?void 0:a.toLowerCase())!=="document"){let r="";s&&(r=` xmlns="${s}"`),u=`${u}`}c.doenetML=u}return{success:!0,page:c}}}async function X({activityDefinition:n,requestedVariantIndex:t}){let e=await S(n),s=(t-1)%e.numberOfVariants+1;if(s<1&&(s+=e.numberOfVariants),!Number.isFinite(s))return{success:!1,message:"Invalid requested variant index"};let l=new E(s.toString()),o=C(n.order,l);if(!o.success)return o;let i=o.pages,c=n.itemWeights||[];if(!Array.isArray(c)||!c.every(m=>m>=0))return{success:!1,message:"Invalid itemWeights"};let f=i.length;c=c.slice(0,f),c.lengthm+g);a>0&&(c=c.map(m=>m/a));let u;if(e.pageVariants)u=[e.pageVariants];else{let m=[];for(let g of i)m.push(T({cid:g.cid,doenetML:g.doenetML}));try{u=await Promise.all(m)}catch(g){return{success:!1,message:`Error retrieving content for activity. ${g.message}`}}}let r,p=[],d=[];for(let m of u)p.push(m.allPossibleVariants),d.push(m.allPossibleVariants.length);let y=d.reduce((m,g)=>m*g,1);if(y<=e.numberOfVariants){let m=(s-1)%y+1;r=q({numberOfOptionsByIndex:d,maxNumber:m})[m-1].map(g=>g+1)}else r=[...Array(f).keys()].map(m=>Math.floor(l()*d[m])+1);let h=[],v=[];for(let[m,g]of u.entries()){let N=r[m];h.push(N);let b=i[m];b.doenetML===void 0?(b={...b},b.doenetML=g.doenetML):b.cid||(b={...b},b.cid=g.cid),v.push(b)}let w=[...i];v.forEach((m,g)=>w[g].cid=m.cid);let V=await K(v),A={orderWithCids:w,variantsByPage:h,itemWeights:c,numberOfVariants:e.numberOfVariants,previousComponentTypeCounts:V};return{success:!0,order:v,itemWeights:c,variantsByPage:h,variantIndex:s,activityInfo:A,previousComponentTypeCounts:V}}async function S(n){let t=1e3,e=null;if(n.numberOfVariants!==void 0)t=n.numberOfVariants,Number.isInteger(t)&&t>=1||(t=1e3);else if((n.order.behavior===void 0||n.order.behavior==="sequence")&&n.order.content.every(s=>s.type==="page")){let s=[];for(let l of n.order.content)s.push(T({cid:l.cid,doenetML:l.doenetML}));e=await Promise.all(s),t=e.reduce((l,o)=>l*o.allPossibleVariants.length,1),t=Math.min(1e3,t)}return{numberOfVariants:t,pageVariantsResult:e}}async function Y(n){let t=await I(n),e=U(t);return e.success?(e=await S(e.activityJSON),{success:!0,numberOfVariants:e.numberOfVariants}):e}function C(n,t){var s,l;if(((s=n==null?void 0:n.type)==null?void 0:s.toLowerCase())!=="order")return{success:!1,message:"invalid order"};let e=(l=n.behavior)==null?void 0:l.toLowerCase();switch(e===void 0&&(e="sequence"),e){case"sequence":return J(n,t);case"select":return G(n,t);case"shuffle":return H(n,t);default:return{success:!1,message:`Have not implemented behavior: ${e}`}}}function J(n,t){let e=[];for(let s of n.content){let l=s.type.toLowerCase();if(l==="page")e.push(s);else if(l==="order"){let o=C(s,t);if(o.success)e.push(...o.pages);else return o}else return{success:!1,message:"Unrecognized item in order."}}return{success:!0,pages:e}}function G(n,t){let e=n.numberToSelect,s=n.content.length;Number.isInteger(e)&&e>0||(e=1);let l=1;if(n.withReplacement||(l=e),l>s)return{success:!1,message:"Cannot select "+l+" components from only "+s};let o=n.selectWeights||[];if(!Array.isArray(o)||!o.every(r=>r>=0))return{success:!1,message:"Invalid selectWeights"};o=o.slice(0,s),o.lengthr+p);o=o.map(r=>r/i);let c=o.reduce((r,p,d)=>[...r,p+(r[d-1]||0)],[]),f=[...Array(c.length).keys()],a=[];for(let r=0;rp?y=h:d=h}a.push(n.content[f[y]]),!n.withReplacement&&rh+v),o=o.map(h=>h/i),c=o.reduce((h,v,w)=>[...h,v+(h[w-1]||0)],[]))}let u=[];for(let r of a){let p=r.type.toLowerCase();if(p==="page")u.push(r);else if(p==="order"){let d=C(r);if(d.success)u.push(...d.pages);else return d}else return{success:!1,message:"Unrecognized item in order."}}return{success:!0,pages:u}}function H(n,t){let e=[...n.content];for(let l=n.content.length-1;l>0;l--){const o=t(),i=Math.floor(o*(l+1));[e[l],e[i]]=[e[i],e[l]]}let s=[];for(let l of e){let o=l.type.toLowerCase();if(o==="page")s.push(l);else if(o==="order"){let i=C(l,t);if(i.success)s.push(...i.pages);else return i}else return{success:!1,message:"Unrecognized item in order."}}return{success:!0,pages:s}}async function K(n){let t=[{}],e=P();for(let[s,l]of n.slice(0,n.length-1).entries()){let{fullSerializedComponents:o}=await L({contentIds:[l.cid],doenetMLs:[l.doenetML],componentInfoObjects:e}),i=o[0];x(i);let c=i[0].children,f=F(c),a=t[s];for(let u in a)u in f?f[u]+=a[u]:f[u]=a[u];t.push(f)}return t}export{_ as a,X as c,S as d,U as p,Y as r}; diff --git a/dist/assets/alert-2aac55be.js b/dist/assets/alert-c226fd9a.js similarity index 71% rename from dist/assets/alert-2aac55be.js rename to dist/assets/alert-c226fd9a.js index d6f3b0ed2f..09203b83e2 100644 --- a/dist/assets/alert-2aac55be.js +++ b/dist/assets/alert-c226fd9a.js @@ -1 +1 @@ -import{av as t,bn as s,a as l,j as o}from"./index-61b6fc23.js";const u=t.memo(function(n){let{name:i,id:e,SVs:r,children:a}=s(n);return r.hidden?null:l("strong",{id:e,children:[o("a",{name:e}),a]})});export{u as default}; +import{av as t,bn as s,a as l,j as o}from"./index-9d63439d.js";const u=t.memo(function(n){let{name:i,id:e,SVs:r,children:a}=s(n);return r.hidden?null:l("strong",{id:e,children:[o("a",{name:e}),a]})});export{u as default}; diff --git a/dist/assets/angle-16184609.js b/dist/assets/angle-c70c4c3b.js similarity index 93% rename from dist/assets/angle-16184609.js rename to dist/assets/angle-c70c4c3b.js index b1adf9218e..8a4d938e19 100644 --- a/dist/assets/angle-16184609.js +++ b/dist/assets/angle-c70c4c3b.js @@ -1 +1 @@ -import{av as y,bn as C,r as i,j as o,F as f,a as v,b9 as x}from"./index-61b6fc23.js";import{BoardContext as G,LINE_LAYER_OFFSET as b}from"./graph-1ff63df5.js";import"./css-14ccef8c.js";import"./visibility-sensor-398e690f.js";const L=y.memo(function(P){let{name:S,id:m,SVs:e}=C(P);const l=i.useContext(G);let a=i.useRef(null),s=i.useRef(null),c=i.useRef(null),r=i.useRef(null),h=i.useRef(null);i.useEffect(()=>()=>{p()},[]);function p(){a.current!==null&&(l.removeObject(r.current),r.current=null,l.removeObject(a.current),a.current=null,l.removeObject(s.current),s.current=null,l.removeObject(c.current),c.current=null)}function R(){if(e.numericalPoints.length!==3||e.numericalPoints.some(u=>u.length!==2)||!(Number.isFinite(e.numericalRadius)&&e.numericalRadius>0))return null;var t={name:e.labelForGraph,visible:!e.hidden,withLabel:e.showLabel&&e.labelForGraph!=="",fixed:!0,layer:10*e.layer+b,radius:e.numericalRadius,fillColor:e.selectedStyle.fillColor,strokeColor:e.selectedStyle.lineColor,highlight:!1,orthoType:e.emphasizeRightAngle?"square":"sector"};t.label={highlight:!1},e.labelHasLatex&&(t.label.useMathJax=!0),h.current=e.showLabel&&e.labelForGraph!=="";let n;e.swapPointOrder?n=[[...e.numericalPoints[2]],[...e.numericalPoints[1]],[...e.numericalPoints[0]]]:n=[[...e.numericalPoints[0]],[...e.numericalPoints[1]],[...e.numericalPoints[2]]];let d={visible:!1};return a.current=l.create("point",n[0],d),s.current=l.create("point",n[1],d),c.current=l.create("point",n[2],d),l.create("angle",[a.current,s.current,c.current],t)}if(e.hidden)return null;if(l){if(r.current===null)r.current=R();else if(e.numericalPoints.length!==3||e.numericalPoints.some(t=>t.length!==2)||!(Number.isFinite(e.numericalRadius)&&e.numericalRadius>0))p();else{let t;e.swapPointOrder?t=[[...e.numericalPoints[2]],[...e.numericalPoints[1]],[...e.numericalPoints[0]]]:t=[[...e.numericalPoints[0]],[...e.numericalPoints[1]],[...e.numericalPoints[2]]],r.current.point2.coords.setCoordinates(JXG.COORDS_BY_USER,t[0]),r.current.point1.coords.setCoordinates(JXG.COORDS_BY_USER,t[1]),r.current.point3.coords.setCoordinates(JXG.COORDS_BY_USER,t[2]),r.current.setAttribute({radius:e.numericalRadius,visible:!e.hidden});let n=10*e.layer+b;r.current.visProp.layer!==n&&r.current.setAttribute({layer:n}),r.current.visProp.fillcolor!==e.selectedStyle.fillColor&&(r.current.visProp.fillcolor=e.selectedStyle.fillColor),r.current.visProp.strokecolor!==e.selectedStyle.lineColor&&(r.current.visProp.strokecolor=e.selectedStyle.lineColor),r.current.name=e.labelForGraph;let u=e.showLabel&&e.labelForGraph!=="";u!=h.current&&(r.current.setAttribute({withlabel:u}),h.current=u),r.current.visProp.orthotype=e.emphasizeRightAngle?"square":"sector",r.current.needsUpdate=!0,r.current.update(),r.current.hasLabel&&(r.current.label.needsUpdate=!0,r.current.label.update()),l.updateRenderer()}return o(f,{children:o("a",{name:m})})}let g="\\("+e.latexForRenderer+"\\)";return v(f,{children:[o("a",{name:m}),o("span",{id:m,children:o(x.MathJax,{hideUntilTypeset:"first",inline:!0,dynamic:!0,children:g})})]})});export{L as default}; +import{av as y,bn as C,r as i,j as o,F as f,a as v,b9 as x}from"./index-9d63439d.js";import{BoardContext as G,LINE_LAYER_OFFSET as b}from"./graph-0c612329.js";import"./css-14ccef8c.js";import"./visibility-sensor-aefdbbd5.js";const L=y.memo(function(P){let{name:S,id:m,SVs:e}=C(P);const l=i.useContext(G);let a=i.useRef(null),s=i.useRef(null),c=i.useRef(null),r=i.useRef(null),h=i.useRef(null);i.useEffect(()=>()=>{p()},[]);function p(){a.current!==null&&(l.removeObject(r.current),r.current=null,l.removeObject(a.current),a.current=null,l.removeObject(s.current),s.current=null,l.removeObject(c.current),c.current=null)}function R(){if(e.numericalPoints.length!==3||e.numericalPoints.some(u=>u.length!==2)||!(Number.isFinite(e.numericalRadius)&&e.numericalRadius>0))return null;var t={name:e.labelForGraph,visible:!e.hidden,withLabel:e.showLabel&&e.labelForGraph!=="",fixed:!0,layer:10*e.layer+b,radius:e.numericalRadius,fillColor:e.selectedStyle.fillColor,strokeColor:e.selectedStyle.lineColor,highlight:!1,orthoType:e.emphasizeRightAngle?"square":"sector"};t.label={highlight:!1},e.labelHasLatex&&(t.label.useMathJax=!0),h.current=e.showLabel&&e.labelForGraph!=="";let n;e.swapPointOrder?n=[[...e.numericalPoints[2]],[...e.numericalPoints[1]],[...e.numericalPoints[0]]]:n=[[...e.numericalPoints[0]],[...e.numericalPoints[1]],[...e.numericalPoints[2]]];let d={visible:!1};return a.current=l.create("point",n[0],d),s.current=l.create("point",n[1],d),c.current=l.create("point",n[2],d),l.create("angle",[a.current,s.current,c.current],t)}if(e.hidden)return null;if(l){if(r.current===null)r.current=R();else if(e.numericalPoints.length!==3||e.numericalPoints.some(t=>t.length!==2)||!(Number.isFinite(e.numericalRadius)&&e.numericalRadius>0))p();else{let t;e.swapPointOrder?t=[[...e.numericalPoints[2]],[...e.numericalPoints[1]],[...e.numericalPoints[0]]]:t=[[...e.numericalPoints[0]],[...e.numericalPoints[1]],[...e.numericalPoints[2]]],r.current.point2.coords.setCoordinates(JXG.COORDS_BY_USER,t[0]),r.current.point1.coords.setCoordinates(JXG.COORDS_BY_USER,t[1]),r.current.point3.coords.setCoordinates(JXG.COORDS_BY_USER,t[2]),r.current.setAttribute({radius:e.numericalRadius,visible:!e.hidden});let n=10*e.layer+b;r.current.visProp.layer!==n&&r.current.setAttribute({layer:n}),r.current.visProp.fillcolor!==e.selectedStyle.fillColor&&(r.current.visProp.fillcolor=e.selectedStyle.fillColor),r.current.visProp.strokecolor!==e.selectedStyle.lineColor&&(r.current.visProp.strokecolor=e.selectedStyle.lineColor),r.current.name=e.labelForGraph;let u=e.showLabel&&e.labelForGraph!=="";u!=h.current&&(r.current.setAttribute({withlabel:u}),h.current=u),r.current.visProp.orthotype=e.emphasizeRightAngle?"square":"sector",r.current.needsUpdate=!0,r.current.update(),r.current.hasLabel&&(r.current.label.needsUpdate=!0,r.current.label.update()),l.updateRenderer()}return o(f,{children:o("a",{name:m})})}let g="\\("+e.latexForRenderer+"\\)";return v(f,{children:[o("a",{name:m}),o("span",{id:m,children:o(x.MathJax,{hideUntilTypeset:"first",inline:!0,dynamic:!0,children:g})})]})});export{L as default}; diff --git a/dist/assets/answer-4e2755f1.js b/dist/assets/answer-8c02c18e.js similarity index 97% rename from dist/assets/answer-4e2755f1.js rename to dist/assets/answer-8c02c18e.js index 52b231e260..e2c595507c 100644 --- a/dist/assets/answer-4e2755f1.js +++ b/dist/assets/answer-8c02c18e.js @@ -1,4 +1,4 @@ -import{av as y,bn as A,a as n,j as a,i as s,bp as x,a0 as v,aP as w,bq as L,F as m,s as S}from"./index-61b6fc23.js";const l=S.button` +import{av as y,bn as A,a as n,j as a,i as s,bp as x,a0 as v,aP as w,bq as L,F as m,s as S}from"./index-9d63439d.js";const l=S.button` position: relative; height: 24px; display: inline-block; diff --git a/dist/assets/asList-282c8072.js b/dist/assets/asList-0efae1ec.js similarity index 80% rename from dist/assets/asList-282c8072.js rename to dist/assets/asList-0efae1ec.js index 63d2384217..9bf732e9d6 100644 --- a/dist/assets/asList-282c8072.js +++ b/dist/assets/asList-0efae1ec.js @@ -1 +1 @@ -import{av as t,bn as d,j as s,a as o}from"./index-61b6fc23.js";const h=t.memo(function(a){let{name:c,id:e,SVs:r,children:n}=d(a);if(r.hidden)return null;if(n.length===0)return s(t.Fragment,{},e);let i=n.slice(1).reduce((m,l)=>[...m,", ",l],[n[0]]);return o(t.Fragment,{children:[s("a",{name:e}),i]},e)});export{h as default}; +import{av as t,bn as d,j as s,a as o}from"./index-9d63439d.js";const h=t.memo(function(a){let{name:c,id:e,SVs:r,children:n}=d(a);if(r.hidden)return null;if(n.length===0)return s(t.Fragment,{},e);let i=n.slice(1).reduce((m,l)=>[...m,", ",l],[n[0]]);return o(t.Fragment,{children:[s("a",{name:e}),i]},e)});export{h as default}; diff --git a/dist/assets/boolean-37db2c5b.js b/dist/assets/boolean-37db2c5b.js deleted file mode 100644 index 6f58708c73..0000000000 --- a/dist/assets/boolean-37db2c5b.js +++ /dev/null @@ -1 +0,0 @@ -import{av as t,bn as r,a as o,F as l,j as n}from"./index-61b6fc23.js";const u=t.memo(function(s){let{name:i,id:e,SVs:a}=r(s,!1);return a.hidden?null:o(l,{children:[n("a",{name:e}),n("span",{id:e,children:a.text})]})});export{u as default}; diff --git a/dist/assets/boolean-a3d2d482.js b/dist/assets/boolean-a3d2d482.js new file mode 100644 index 0000000000..da8302f250 --- /dev/null +++ b/dist/assets/boolean-a3d2d482.js @@ -0,0 +1 @@ +import{av as t,bn as r,a as o,F as l,j as n}from"./index-9d63439d.js";const u=t.memo(function(s){let{name:i,id:e,SVs:a}=r(s,!1);return a.hidden?null:o(l,{children:[n("a",{name:e}),n("span",{id:e,children:a.text})]})});export{u as default}; diff --git a/dist/assets/booleanInput-3b0c7c6a.js b/dist/assets/booleanInput-102cb271.js similarity index 97% rename from dist/assets/booleanInput-3b0c7c6a.js rename to dist/assets/booleanInput-102cb271.js index 249743ceb2..9d30c20ced 100644 --- a/dist/assets/booleanInput-3b0c7c6a.js +++ b/dist/assets/booleanInput-102cb271.js @@ -1,4 +1,4 @@ -import{av as A,bn as j,r as w,R as E,br as F,j as t,i as m,bp as I,a0 as O,aP as P,bq as T,a as l,F as k,s as N,b9 as W}from"./index-61b6fc23.js";import{T as H}from"./ToggleButton-0b55a995.js";const s=N.button` +import{av as A,bn as j,r as w,R as E,br as F,j as t,i as m,bp as I,a0 as O,aP as P,bq as T,a as l,F as k,s as N,b9 as W}from"./index-9d63439d.js";import{T as H}from"./ToggleButton-fffa6800.js";const s=N.button` position: relative; width: 24px; height: 24px; diff --git a/dist/assets/breadcrumbUtil-59c43d86.js b/dist/assets/breadcrumbUtil-379dd524.js similarity index 96% rename from dist/assets/breadcrumbUtil-59c43d86.js rename to dist/assets/breadcrumbUtil-379dd524.js index 6b3940118a..d5b1d71942 100644 --- a/dist/assets/breadcrumbUtil-59c43d86.js +++ b/dist/assets/breadcrumbUtil-379dd524.js @@ -1 +1 @@ -import{R as f,p as a,l,I as w,az as p,G as k,H as m,g}from"./index-61b6fc23.js";import{e as y}from"./RoleDropdown-c9fff172.js";import{studentData as I,assignmentData as _}from"./Gradebook-bd1a82d1.js";function V(){const e=f(a);return{label:"Courses",onClick:()=>{e({page:"course",tool:"courseChooser",view:""})}}}function D(e){const t=f(a),n=l(w(e));return{label:n==null?void 0:n.label,onClick:()=>{t({page:"course",tool:"dashboard",view:"",params:{courseId:e}})}}}const v=p({key:"navigationSelectorFamily/Default",get:({courseId:e,parentDoenetId:t})=>async({get:n})=>{async function s({courseId:u,parentDoenetId:o}){if(o===""||o===void 0)return[];const{label:c,parentDoenetId:r,type:b}=await n(k(o));return u===r?[{label:c,parentDoenetId:o,type:b}]:[...await s({courseId:u,parentDoenetId:r}),{label:c,parentDoenetId:o,type:b}]}return await s({courseId:e,parentDoenetId:t})}});function N(e,t){const n=f(a),s=l(v({courseId:e,parentDoenetId:t})),u=[{label:"Content",onClick:()=>{n({page:"course",tool:"navigation",view:"",params:{courseId:e}})}}];for(let{label:o,parentDoenetId:c,type:r}of s)switch(r){case"section":u.push({label:o,onClick:()=>{n({page:"course",tool:"navigation",view:"",params:{courseId:e,sectionId:c}})}});break;default:console.warn(`Unsupported navigration crumb type: ${r}`)}return u}function $({pageId:e,doenetId:t,linkPageId:n}){const s=f(a),u=l(k(e));let{label:o}=u;const c=l(k(n));n&&({label:o}=c);const r=l(k(t));let{label:b}=r,i=[{label:b??"_",onClick:()=>{s({page:"course",tool:"editor",view:"",params:{doenetId:t,pageId:e}})}}];if(!r.isSinglePage&&r.type!="bank"&&!n){let d=m(r.content);i=[{label:b??"_",onClick:()=>{s({page:"course",tool:"editor",view:"",params:{doenetId:t,pageId:d}})}},{label:o??"_",onClick:()=>{s({page:"course",tool:"editor",view:"",params:{doenetId:t,pageId:e}})}}]}return r.type=="bank"&&(i=[{label:o??"_",onClick:()=>{s({page:"course",tool:"editor",view:"",params:{doenetId:t,pageId:e}})}}]),n&&(i=[{label:o??"_",onClick:()=>{s({page:"course",tool:"editor",view:"",params:{linkPageId:n}})}}]),i}function x({doenetId:e}){const t=f(a),{label:n}=l(k(e));return{label:n??"_",onClick:()=>{t({page:"course",tool:"assignment",view:"",params:{doenetId:e}})}}}function G(e){const t=f(a);return{label:"People",onClick:()=>{t({page:"course",tool:"people",view:"",params:{courseId:e}})}}}function R(e,t){const n=f(a),s=l(v({courseId:e,parentDoenetId:t})),u=[{label:"Data",onClick:()=>{n({page:"course",tool:"data",view:"",params:{courseId:e}})}}];for(let{label:o,parentDoenetId:c,type:r}of s)switch(r){case"section":u.push({label:o,onClick:()=>{n({page:"course",tool:"data",view:"",params:{courseId:e,sectionId:c}})}});break;default:console.warn(`Unsupported navigration crumb type: ${r}`)}return u}function O(){var r,b;const[{params:e,tool:t},n]=g(a);let s=[];const{canViewAndModifyGrades:u}=l(y(e==null?void 0:e.courseId)),o=l(I),c=l(_);if(u=="1"){let i={courseId:e==null?void 0:e.courseId};s.push({label:"Gradebook",onClick:()=>{n({page:"course",tool:"gradebook",view:"",params:i})}})}if(t=="gradebook")return s;if(t=="gradebookStudent"||u!="1"&&t=="gradebookStudentAssignment"||(e==null?void 0:e.previousCrumb)=="student"&&t=="gradebookStudentAssignment"){let i="Gradebook";if(u=="1"){const C=o[e==null?void 0:e.userId];i=`${C.firstName} ${C.lastName}`}let d={courseId:e==null?void 0:e.courseId,userId:e==null?void 0:e.userId};s.push({label:i,onClick:()=>{n({page:"course",tool:"gradebookStudent",view:"",params:d})}})}if(t=="gradebookStudent")return s;if(t=="gradebookAssignment"||(e==null?void 0:e.previousCrumb)=="assignment"&&t=="gradebookStudentAssignment")if(u!="1")s.push({label:"Not Available"});else{let i=(r=c==null?void 0:c[e==null?void 0:e.doenetId])==null?void 0:r.label;i||(i="_");let d={courseId:e==null?void 0:e.courseId,doenetId:e==null?void 0:e.doenetId};s.push({label:i,onClick:()=>{n({page:"course",tool:"gradebookAssignment",view:"",params:d})}})}if(t=="gradebookAssignment")return s;if(u!="1"){let i=(b=c==null?void 0:c[e==null?void 0:e.doenetId])==null?void 0:b.label;i||(i="_");let d={courseId:e==null?void 0:e.courseId,userId:e==null?void 0:e.userId,doenetId:e==null?void 0:e.doenetId};s.push({label:i,onClick:()=>{n({page:"course",tool:"gradebookStudentAssignment",view:"",params:d})}})}else{let i="_";if((e==null?void 0:e.previousCrumb)=="student"&&(i=c[e==null?void 0:e.doenetId].label),(e==null?void 0:e.previousCrumb)=="assignment"){const C=o[e==null?void 0:e.userId];i=`${C.firstName} ${C.lastName}`}let d={courseId:e==null?void 0:e.courseId,userId:e==null?void 0:e.userId,doenetId:e==null?void 0:e.doenetId,previousCrumb:e==null?void 0:e.previousCrumb};s.push({label:i,onClick:()=>{n({page:"course",tool:"gradebookStudentAssignment",view:"",params:d})}})}return s}export{D as a,N as b,G as c,R as d,$ as e,O as f,x as g,V as u}; +import{R as f,p as a,l,I as w,az as p,G as k,H as m,g}from"./index-9d63439d.js";import{e as y}from"./RoleDropdown-2d4e4388.js";import{studentData as I,assignmentData as _}from"./Gradebook-8ee8571a.js";function V(){const e=f(a);return{label:"Courses",onClick:()=>{e({page:"course",tool:"courseChooser",view:""})}}}function D(e){const t=f(a),n=l(w(e));return{label:n==null?void 0:n.label,onClick:()=>{t({page:"course",tool:"dashboard",view:"",params:{courseId:e}})}}}const v=p({key:"navigationSelectorFamily/Default",get:({courseId:e,parentDoenetId:t})=>async({get:n})=>{async function s({courseId:u,parentDoenetId:o}){if(o===""||o===void 0)return[];const{label:c,parentDoenetId:r,type:b}=await n(k(o));return u===r?[{label:c,parentDoenetId:o,type:b}]:[...await s({courseId:u,parentDoenetId:r}),{label:c,parentDoenetId:o,type:b}]}return await s({courseId:e,parentDoenetId:t})}});function N(e,t){const n=f(a),s=l(v({courseId:e,parentDoenetId:t})),u=[{label:"Content",onClick:()=>{n({page:"course",tool:"navigation",view:"",params:{courseId:e}})}}];for(let{label:o,parentDoenetId:c,type:r}of s)switch(r){case"section":u.push({label:o,onClick:()=>{n({page:"course",tool:"navigation",view:"",params:{courseId:e,sectionId:c}})}});break;default:console.warn(`Unsupported navigration crumb type: ${r}`)}return u}function $({pageId:e,doenetId:t,linkPageId:n}){const s=f(a),u=l(k(e));let{label:o}=u;const c=l(k(n));n&&({label:o}=c);const r=l(k(t));let{label:b}=r,i=[{label:b??"_",onClick:()=>{s({page:"course",tool:"editor",view:"",params:{doenetId:t,pageId:e}})}}];if(!r.isSinglePage&&r.type!="bank"&&!n){let d=m(r.content);i=[{label:b??"_",onClick:()=>{s({page:"course",tool:"editor",view:"",params:{doenetId:t,pageId:d}})}},{label:o??"_",onClick:()=>{s({page:"course",tool:"editor",view:"",params:{doenetId:t,pageId:e}})}}]}return r.type=="bank"&&(i=[{label:o??"_",onClick:()=>{s({page:"course",tool:"editor",view:"",params:{doenetId:t,pageId:e}})}}]),n&&(i=[{label:o??"_",onClick:()=>{s({page:"course",tool:"editor",view:"",params:{linkPageId:n}})}}]),i}function x({doenetId:e}){const t=f(a),{label:n}=l(k(e));return{label:n??"_",onClick:()=>{t({page:"course",tool:"assignment",view:"",params:{doenetId:e}})}}}function G(e){const t=f(a);return{label:"People",onClick:()=>{t({page:"course",tool:"people",view:"",params:{courseId:e}})}}}function R(e,t){const n=f(a),s=l(v({courseId:e,parentDoenetId:t})),u=[{label:"Data",onClick:()=>{n({page:"course",tool:"data",view:"",params:{courseId:e}})}}];for(let{label:o,parentDoenetId:c,type:r}of s)switch(r){case"section":u.push({label:o,onClick:()=>{n({page:"course",tool:"data",view:"",params:{courseId:e,sectionId:c}})}});break;default:console.warn(`Unsupported navigration crumb type: ${r}`)}return u}function O(){var r,b;const[{params:e,tool:t},n]=g(a);let s=[];const{canViewAndModifyGrades:u}=l(y(e==null?void 0:e.courseId)),o=l(I),c=l(_);if(u=="1"){let i={courseId:e==null?void 0:e.courseId};s.push({label:"Gradebook",onClick:()=>{n({page:"course",tool:"gradebook",view:"",params:i})}})}if(t=="gradebook")return s;if(t=="gradebookStudent"||u!="1"&&t=="gradebookStudentAssignment"||(e==null?void 0:e.previousCrumb)=="student"&&t=="gradebookStudentAssignment"){let i="Gradebook";if(u=="1"){const C=o[e==null?void 0:e.userId];i=`${C.firstName} ${C.lastName}`}let d={courseId:e==null?void 0:e.courseId,userId:e==null?void 0:e.userId};s.push({label:i,onClick:()=>{n({page:"course",tool:"gradebookStudent",view:"",params:d})}})}if(t=="gradebookStudent")return s;if(t=="gradebookAssignment"||(e==null?void 0:e.previousCrumb)=="assignment"&&t=="gradebookStudentAssignment")if(u!="1")s.push({label:"Not Available"});else{let i=(r=c==null?void 0:c[e==null?void 0:e.doenetId])==null?void 0:r.label;i||(i="_");let d={courseId:e==null?void 0:e.courseId,doenetId:e==null?void 0:e.doenetId};s.push({label:i,onClick:()=>{n({page:"course",tool:"gradebookAssignment",view:"",params:d})}})}if(t=="gradebookAssignment")return s;if(u!="1"){let i=(b=c==null?void 0:c[e==null?void 0:e.doenetId])==null?void 0:b.label;i||(i="_");let d={courseId:e==null?void 0:e.courseId,userId:e==null?void 0:e.userId,doenetId:e==null?void 0:e.doenetId};s.push({label:i,onClick:()=>{n({page:"course",tool:"gradebookStudentAssignment",view:"",params:d})}})}else{let i="_";if((e==null?void 0:e.previousCrumb)=="student"&&(i=c[e==null?void 0:e.doenetId].label),(e==null?void 0:e.previousCrumb)=="assignment"){const C=o[e==null?void 0:e.userId];i=`${C.firstName} ${C.lastName}`}let d={courseId:e==null?void 0:e.courseId,userId:e==null?void 0:e.userId,doenetId:e==null?void 0:e.doenetId,previousCrumb:e==null?void 0:e.previousCrumb};s.push({label:i,onClick:()=>{n({page:"course",tool:"gradebookStudentAssignment",view:"",params:d})}})}return s}export{D as a,N as b,G as c,R as d,$ as e,O as f,x as g,V as u}; diff --git a/dist/assets/c-e2b89d31.js b/dist/assets/c-8d620809.js similarity index 73% rename from dist/assets/c-e2b89d31.js rename to dist/assets/c-8d620809.js index 4ce9aef37c..c2d1988b1c 100644 --- a/dist/assets/c-e2b89d31.js +++ b/dist/assets/c-8d620809.js @@ -1 +1 @@ -import{av as s,bn as t,a as d,j as i}from"./index-61b6fc23.js";const m=s.memo(function(n){let{name:c,id:e,SVs:a,children:r}=t(n);return a.hidden?null:d("code",{id:e,style:{margin:"12px 0"},children:[i("a",{name:e}),r]})});export{m as default}; +import{av as s,bn as t,a as d,j as i}from"./index-9d63439d.js";const m=s.memo(function(n){let{name:c,id:e,SVs:a,children:r}=t(n);return a.hidden?null:d("code",{id:e,style:{margin:"12px 0"},children:[i("a",{name:e}),r]})});export{m as default}; diff --git a/dist/assets/callAction-c6bb5e7a.js b/dist/assets/callAction-275a57a5.js similarity index 68% rename from dist/assets/callAction-c6bb5e7a.js rename to dist/assets/callAction-275a57a5.js index f88c8b11c0..e65f18c5a2 100644 --- a/dist/assets/callAction-c6bb5e7a.js +++ b/dist/assets/callAction-275a57a5.js @@ -1 +1 @@ -import{av as s,bn as o,a as c,j as l,B as d}from"./index-61b6fc23.js";const m=s.memo(function(n){let{name:u,id:e,SVs:a,actions:t,callAction:i}=o(n);return a.hidden?null:c("div",{id:e,style:{margin:"12px 0",display:"inline-block"},children:[l("a",{name:e}),l(d,{id:e+"_button",onClick:()=>i({action:t.callAction}),disabled:a.disabled,value:a.label,valueHasLatex:a.labelHasLatex})]})});export{m as default}; +import{av as s,bn as o,a as c,j as l,B as d}from"./index-9d63439d.js";const m=s.memo(function(n){let{name:u,id:e,SVs:a,actions:t,callAction:i}=o(n);return a.hidden?null:c("div",{id:e,style:{margin:"12px 0",display:"inline-block"},children:[l("a",{name:e}),l(d,{id:e+"_button",onClick:()=>i({action:t.callAction}),disabled:a.disabled,value:a.label,valueHasLatex:a.labelHasLatex})]})});export{m as default}; diff --git a/dist/assets/cell-8f0e6a31.js b/dist/assets/cell-ea3cd2d6.js similarity index 91% rename from dist/assets/cell-8f0e6a31.js rename to dist/assets/cell-ea3cd2d6.js index 5463b629b5..1ba7424361 100644 --- a/dist/assets/cell-8f0e6a31.js +++ b/dist/assets/cell-ea3cd2d6.js @@ -1 +1 @@ -import{av as d,bn as s,j as o}from"./index-61b6fc23.js";const f=d.memo(function(r){let{name:m,id:l,SVs:e,children:n}=s(r);if(e.hidden)return null;let t={style:{padding:"3px 10px"}};e.colSpan!==1&&(t.colSpan=e.colSpan),e.halign!==null&&(t.style.textAlign=e.halign),e.bottom!=="none"&&(t.style.borderBottomStyle="solid",e.bottom==="minor"?t.style.borderBottomWidth="thin":e.bottom==="medium"?t.style.borderBottomWidth="medium":t.style.borderBottomWidth="thick"),e.right!=="none"&&(t.style.borderRightStyle="solid",e.right==="minor"?t.style.borderRightWidth="thin":e.right==="medium"?t.style.borderRightWidth="medium":t.style.borderRightWidth="thick");let i=n;return i.length===0&&(i=e.text),e.inHeader?o("th",{id:l,...t,children:i}):o("td",{id:l,...t,children:i})});export{f as default}; +import{av as d,bn as s,j as o}from"./index-9d63439d.js";const f=d.memo(function(r){let{name:m,id:l,SVs:e,children:n}=s(r);if(e.hidden)return null;let t={style:{padding:"3px 10px"}};e.colSpan!==1&&(t.colSpan=e.colSpan),e.halign!==null&&(t.style.textAlign=e.halign),e.bottom!=="none"&&(t.style.borderBottomStyle="solid",e.bottom==="minor"?t.style.borderBottomWidth="thin":e.bottom==="medium"?t.style.borderBottomWidth="medium":t.style.borderBottomWidth="thick"),e.right!=="none"&&(t.style.borderRightStyle="solid",e.right==="minor"?t.style.borderRightWidth="thin":e.right==="medium"?t.style.borderRightWidth="medium":t.style.borderRightWidth="thick");let i=n;return i.length===0&&(i=e.text),e.inHeader?o("th",{id:l,...t,children:i}):o("td",{id:l,...t,children:i})});export{f as default}; diff --git a/dist/assets/chart-ce435d1f.js b/dist/assets/chart-82ac9578.js similarity index 75% rename from dist/assets/chart-ce435d1f.js rename to dist/assets/chart-82ac9578.js index b41021194f..8323cf5d80 100644 --- a/dist/assets/chart-ce435d1f.js +++ b/dist/assets/chart-82ac9578.js @@ -1 +1 @@ -import{av as c,bn as l,r,a as d,F as m,j as e}from"./index-61b6fc23.js";import{V as h}from"./visibility-sensor-398e690f.js";const C=r.createContext(),x=c.memo(function(s){let{name:b,id:i,SVs:f,actions:t,callAction:a}=l(s),n=o=>{a({action:t.recordVisibilityChange,args:{isVisible:o}})};return r.useEffect(()=>()=>{a({action:t.recordVisibilityChange,args:{isVisible:!1}})},[]),d(m,{children:[e("a",{name:i}),e(h,{partialVisibility:!0,onChange:n,children:e("div",{id:i})})]})});export{C as BoardContext,x as default}; +import{av as c,bn as l,r,a as d,F as m,j as e}from"./index-9d63439d.js";import{V as h}from"./visibility-sensor-aefdbbd5.js";const C=r.createContext(),x=c.memo(function(s){let{name:b,id:i,SVs:f,actions:t,callAction:a}=l(s),n=o=>{a({action:t.recordVisibilityChange,args:{isVisible:o}})};return r.useEffect(()=>()=>{a({action:t.recordVisibilityChange,args:{isVisible:!1}})},[]),d(m,{children:[e("a",{name:i}),e(h,{partialVisibility:!0,onChange:n,children:e("div",{id:i})})]})});export{C as BoardContext,x as default}; diff --git a/dist/assets/choiceInput-af5757a7.js b/dist/assets/choiceInput-5e85a5a2.js similarity index 98% rename from dist/assets/choiceInput-af5757a7.js rename to dist/assets/choiceInput-5e85a5a2.js index 09539f7c6c..f14cf48f6f 100644 --- a/dist/assets/choiceInput-af5757a7.js +++ b/dist/assets/choiceInput-5e85a5a2.js @@ -1,4 +1,4 @@ -import{av as S,bn as D,r as I,R as W,br as M,j as r,i as f,bp as _,a0 as w,aP as L,bq as O,a as l,F as k,s as T}from"./index-61b6fc23.js";const p=T.button` +import{av as S,bn as D,r as I,R as W,br as M,j as r,i as f,bp as _,a0 as w,aP as L,bq as O,a as l,F as k,s as T}from"./index-9d63439d.js";const p=T.button` position: relative; /* width: 24px; */ height: 24px; diff --git a/dist/assets/circle-6641f664.js b/dist/assets/circle-0a5606a6.js similarity index 96% rename from dist/assets/circle-6641f664.js rename to dist/assets/circle-0a5606a6.js index 726a9a58d2..5c186c745e 100644 --- a/dist/assets/circle-6641f664.js +++ b/dist/assets/circle-0a5606a6.js @@ -1 +1 @@ -import{av as _,bn as M,r as l,l as X,bs as E,j as J}from"./index-61b6fc23.js";import{BoardContext as N,LINE_LAYER_OFFSET as L}from"./graph-1ff63df5.js";import"./css-14ccef8c.js";import"./visibility-sensor-398e690f.js";const I=_.memo(function u(F){let{name:Y,id:P,SVs:e,actions:h,callAction:p}=M(F);u.ignoreActionsWithoutCore=!0;const o=l.useContext(N);let r=l.useRef(null),C=l.useRef(!1),d=l.useRef(!1),g=l.useRef(!1),b=l.useRef(!1),v=l.useRef(!1),S=l.useRef(!1),m=l.useRef(null),R=l.useRef(null),w=l.useRef(null);R.current=e.numericalCenter,w.current=e.throughAngles;const y=X(E);l.useEffect(()=>()=>{r.current&&O()},[]);function D(){if(!(Number.isFinite(e.numericalCenter[0])&&Number.isFinite(e.numericalCenter[1])&&e.numericalRadius>0))return null;let a=!e.draggable||e.fixed,i=y==="dark"?e.selectedStyle.lineColorDarkMode:e.selectedStyle.lineColor;i=i.toLowerCase();let c=y==="dark"?e.selectedStyle.fillColorDarkMode:e.selectedStyle.fillColor;c=e.filled?c.toLowerCase():"none";var n={name:e.labelForGraph,visible:!e.hidden,withLabel:e.showLabel&&e.labelForGraph!=="",fixed:a,layer:10*e.layer+L,strokeColor:i,strokeOpacity:e.selectedStyle.lineOpacity,highlightStrokeColor:i,strokeWidth:e.selectedStyle.lineWidth,highlightStrokeWidth:e.selectedStyle.lineWidth,highlightStrokeOpacity:e.selectedStyle.lineOpacity*.5,dash:A(e.selectedStyle.lineStyle),fillColor:c,fillOpacity:e.selectedStyle.fillOpacity,highlightFillColor:c,highlightFillOpacity:e.selectedStyle.fillOpacity*.5,highlight:!a};e.filled&&(n.hasInnerPoints=!0),n.label={highlight:!1},e.labelHasLatex&&(n.label.useMathJax=!0),e.showLabel&&e.labelForGraph!==""&&(e.applyStyleToLabel?n.label.strokeColor=i:n.label.strokeColor="var(--canvastext)");let s=o.create("circle",[[...e.numericalCenter],e.numericalRadius],n);return s.on("drag",function(t){(Math.abs(t.x-d.current[0])>.1||Math.abs(t.y-d.current[1])>.1)&&(C.current=!0),m.current=G(t),p({action:h.moveCircle,args:{center:m.current,radius:b.current,throughAngles:v.current,transient:!0,skippable:!0}}),s.center.coords.setCoordinates(JXG.COORDS_BY_USER,[...R.current])}),s.on("up",function(t){C.current?p({action:h.moveCircle,args:{center:m.current,radius:b.current,throughAngles:v.current}}):p({action:h.circleClicked})}),s.on("down",function(t){C.current=!1,d.current=[t.x,t.y],g.current=[...s.center.coords.scrCoords],b.current=s.radius,v.current=[...w.current],p({action:h.mouseDownOnCircle})}),S.current=e.showLabel&&e.labelForGraph!=="",s}function G(a){var i=o.origin.scrCoords;let c=(g.current[1]+a.x-d.current[0]-i[1])/o.unitX,n=(i[2]-(g.current[2]+a.y-d.current[1]))/o.unitY;return[c,n]}function O(){r.current.off("drag"),r.current.off("down"),r.current.off("up"),o.removeObject(r.current),r.current=null}if(o)if(!r.current)r.current=D();else if(!(Number.isFinite(e.numericalCenter[0])&&Number.isFinite(e.numericalCenter[1])&&e.numericalRadius>0))O();else{o.updateQuality===o.BOARD_QUALITY_LOW&&(o.itemsRenderedLowQuality[P]=r.current);let a=e.numericalCenter.every(W=>Number.isFinite(W));r.current.center.coords.setCoordinates(JXG.COORDS_BY_USER,[...e.numericalCenter]),r.current.setRadius(e.numericalRadius);let i=!e.hidden;a?(r.current.visProp.visible=i,r.current.visPropCalc.visible=i):(r.current.visProp.visible=!1,r.current.visPropCalc.visible=!1);let c=!e.draggable||e.fixed;r.current.visProp.fixed=c,r.current.visProp.highlight=!c;let n=10*e.layer+L;r.current.visProp.layer!==n&&r.current.setAttribute({layer:n});let t=y==="dark"?e.selectedStyle.lineColorDarkMode:e.selectedStyle.lineColor;t=t.toLowerCase();let f=y==="dark"?e.selectedStyle.fillColorDarkMode:e.selectedStyle.fillColor;f=e.filled?f.toLowerCase():"none",r.current.visProp.strokecolor!==t&&(r.current.visProp.strokecolor=t,r.current.visProp.highlightstrokecolor=t),r.current.visProp.strokeopacity!==e.selectedStyle.lineOpacity&&(r.current.visProp.strokeopacity=e.selectedStyle.lineOpacity,r.current.visProp.highlightstrokeopacity=e.selectedStyle.lineOpacity*.5);let x=A(e.selectedStyle.lineStyle);r.current.visProp.dash!==x&&(r.current.visProp.dash=x),r.current.visProp.strokewidth!==e.selectedStyle.lineWidth&&(r.current.visProp.strokewidth=e.selectedStyle.lineWidth,r.current.visProp.highlightstrokewidth=e.selectedStyle.lineWidth),r.current.visProp.fillcolor!==f&&(r.current.visProp.fillcolor=f,r.current.visProp.highlightfillcolor=f,r.current.visProp.hasinnerpoints=e.filled),r.current.visProp.fillopacity!==e.selectedStyle.fillOpacity&&(r.current.visProp.fillopacity=e.selectedStyle.fillOpacity,r.current.visProp.highlightfillopacity=e.selectedStyle.fillOpacity*.5),r.current.name=e.labelForGraph;let k=e.showLabel&&e.labelForGraph!=="";k!=S.current&&(r.current.setAttribute({withlabel:k}),S.current=k),r.current.needsUpdate=!0,r.current.update(),r.current.hasLabel&&(e.applyStyleToLabel?r.current.label.visProp.strokecolor=t:r.current.label.visProp.strokecolor="var(--canvastext)",r.current.label.needsUpdate=!0,r.current.label.update()),o.updateRenderer()}return e.hidden?null:J("a",{name:P})});function A(u){return u==="solid"?0:u==="dashed"?2:u==="dotted"?1:0}export{I as default}; +import{av as _,bn as M,r as l,l as X,bs as E,j as J}from"./index-9d63439d.js";import{BoardContext as N,LINE_LAYER_OFFSET as L}from"./graph-0c612329.js";import"./css-14ccef8c.js";import"./visibility-sensor-aefdbbd5.js";const I=_.memo(function u(F){let{name:Y,id:P,SVs:e,actions:h,callAction:p}=M(F);u.ignoreActionsWithoutCore=!0;const o=l.useContext(N);let r=l.useRef(null),C=l.useRef(!1),d=l.useRef(!1),g=l.useRef(!1),b=l.useRef(!1),v=l.useRef(!1),S=l.useRef(!1),m=l.useRef(null),R=l.useRef(null),w=l.useRef(null);R.current=e.numericalCenter,w.current=e.throughAngles;const y=X(E);l.useEffect(()=>()=>{r.current&&O()},[]);function D(){if(!(Number.isFinite(e.numericalCenter[0])&&Number.isFinite(e.numericalCenter[1])&&e.numericalRadius>0))return null;let a=!e.draggable||e.fixed,i=y==="dark"?e.selectedStyle.lineColorDarkMode:e.selectedStyle.lineColor;i=i.toLowerCase();let c=y==="dark"?e.selectedStyle.fillColorDarkMode:e.selectedStyle.fillColor;c=e.filled?c.toLowerCase():"none";var n={name:e.labelForGraph,visible:!e.hidden,withLabel:e.showLabel&&e.labelForGraph!=="",fixed:a,layer:10*e.layer+L,strokeColor:i,strokeOpacity:e.selectedStyle.lineOpacity,highlightStrokeColor:i,strokeWidth:e.selectedStyle.lineWidth,highlightStrokeWidth:e.selectedStyle.lineWidth,highlightStrokeOpacity:e.selectedStyle.lineOpacity*.5,dash:A(e.selectedStyle.lineStyle),fillColor:c,fillOpacity:e.selectedStyle.fillOpacity,highlightFillColor:c,highlightFillOpacity:e.selectedStyle.fillOpacity*.5,highlight:!a};e.filled&&(n.hasInnerPoints=!0),n.label={highlight:!1},e.labelHasLatex&&(n.label.useMathJax=!0),e.showLabel&&e.labelForGraph!==""&&(e.applyStyleToLabel?n.label.strokeColor=i:n.label.strokeColor="var(--canvastext)");let s=o.create("circle",[[...e.numericalCenter],e.numericalRadius],n);return s.on("drag",function(t){(Math.abs(t.x-d.current[0])>.1||Math.abs(t.y-d.current[1])>.1)&&(C.current=!0),m.current=G(t),p({action:h.moveCircle,args:{center:m.current,radius:b.current,throughAngles:v.current,transient:!0,skippable:!0}}),s.center.coords.setCoordinates(JXG.COORDS_BY_USER,[...R.current])}),s.on("up",function(t){C.current?p({action:h.moveCircle,args:{center:m.current,radius:b.current,throughAngles:v.current}}):p({action:h.circleClicked})}),s.on("down",function(t){C.current=!1,d.current=[t.x,t.y],g.current=[...s.center.coords.scrCoords],b.current=s.radius,v.current=[...w.current],p({action:h.mouseDownOnCircle})}),S.current=e.showLabel&&e.labelForGraph!=="",s}function G(a){var i=o.origin.scrCoords;let c=(g.current[1]+a.x-d.current[0]-i[1])/o.unitX,n=(i[2]-(g.current[2]+a.y-d.current[1]))/o.unitY;return[c,n]}function O(){r.current.off("drag"),r.current.off("down"),r.current.off("up"),o.removeObject(r.current),r.current=null}if(o)if(!r.current)r.current=D();else if(!(Number.isFinite(e.numericalCenter[0])&&Number.isFinite(e.numericalCenter[1])&&e.numericalRadius>0))O();else{o.updateQuality===o.BOARD_QUALITY_LOW&&(o.itemsRenderedLowQuality[P]=r.current);let a=e.numericalCenter.every(W=>Number.isFinite(W));r.current.center.coords.setCoordinates(JXG.COORDS_BY_USER,[...e.numericalCenter]),r.current.setRadius(e.numericalRadius);let i=!e.hidden;a?(r.current.visProp.visible=i,r.current.visPropCalc.visible=i):(r.current.visProp.visible=!1,r.current.visPropCalc.visible=!1);let c=!e.draggable||e.fixed;r.current.visProp.fixed=c,r.current.visProp.highlight=!c;let n=10*e.layer+L;r.current.visProp.layer!==n&&r.current.setAttribute({layer:n});let t=y==="dark"?e.selectedStyle.lineColorDarkMode:e.selectedStyle.lineColor;t=t.toLowerCase();let f=y==="dark"?e.selectedStyle.fillColorDarkMode:e.selectedStyle.fillColor;f=e.filled?f.toLowerCase():"none",r.current.visProp.strokecolor!==t&&(r.current.visProp.strokecolor=t,r.current.visProp.highlightstrokecolor=t),r.current.visProp.strokeopacity!==e.selectedStyle.lineOpacity&&(r.current.visProp.strokeopacity=e.selectedStyle.lineOpacity,r.current.visProp.highlightstrokeopacity=e.selectedStyle.lineOpacity*.5);let x=A(e.selectedStyle.lineStyle);r.current.visProp.dash!==x&&(r.current.visProp.dash=x),r.current.visProp.strokewidth!==e.selectedStyle.lineWidth&&(r.current.visProp.strokewidth=e.selectedStyle.lineWidth,r.current.visProp.highlightstrokewidth=e.selectedStyle.lineWidth),r.current.visProp.fillcolor!==f&&(r.current.visProp.fillcolor=f,r.current.visProp.highlightfillcolor=f,r.current.visProp.hasinnerpoints=e.filled),r.current.visProp.fillopacity!==e.selectedStyle.fillOpacity&&(r.current.visProp.fillopacity=e.selectedStyle.fillOpacity,r.current.visProp.highlightfillopacity=e.selectedStyle.fillOpacity*.5),r.current.name=e.labelForGraph;let k=e.showLabel&&e.labelForGraph!=="";k!=S.current&&(r.current.setAttribute({withlabel:k}),S.current=k),r.current.needsUpdate=!0,r.current.update(),r.current.hasLabel&&(e.applyStyleToLabel?r.current.label.visProp.strokecolor=t:r.current.label.visProp.strokecolor="var(--canvastext)",r.current.label.needsUpdate=!0,r.current.label.update()),o.updateRenderer()}return e.hidden?null:J("a",{name:P})});function A(u){return u==="solid"?0:u==="dashed"?2:u==="dotted"?1:0}export{I as default}; diff --git a/dist/assets/cobwebPolyline-579fad3e.js b/dist/assets/cobwebPolyline-29cb610e.js similarity index 96% rename from dist/assets/cobwebPolyline-579fad3e.js rename to dist/assets/cobwebPolyline-29cb610e.js index 39834cfd00..2e80573fc6 100644 --- a/dist/assets/cobwebPolyline-579fad3e.js +++ b/dist/assets/cobwebPolyline-29cb610e.js @@ -1 +1 @@ -import{av as J,bn as L,r as u,bt as X,j as A,F as N}from"./index-61b6fc23.js";import{BoardContext as I,LINE_LAYER_OFFSET as k,VERTEX_LAYER_OFFSET as U}from"./graph-1ff63df5.js";import"./css-14ccef8c.js";import"./visibility-sensor-398e690f.js";const M=J.memo(function f(V){let{name:R,id:j,SVs:e,actions:E,sourceOfUpdate:S,callAction:_}=L(V);f.ignoreActionsWithoutCore=!0;const o=u.useContext(I);let h=u.useRef(null),x=u.useRef(null),l=u.useRef(null),t=u.useRef(null),P=u.useRef(null),C=u.useRef(null),p=u.useRef(null),c=u.useRef(null),$=u.useRef(null);$.current=e.numericalVertices,u.useEffect(()=>()=>{l.current&&D()},[]);function G(){let n={visible:!e.hidden,withLabel:!1,fixed:!0,layer:10*e.layer+k,strokeColor:"green",highlightStrokeColor:"green",strokeWidth:3,dash:F("solid")},g=X(e.fDefinition);h.current=o.create("functiongraph",[g],n);let b={visible:!e.hidden,withLabel:!1,fixed:!0,layer:10*e.layer+k,strokeColor:"gray",highlightStrokeColor:"gray",strokeWidth:2,dash:F("solid")};x.current=o.create("line",[[0,0],[1,1]],b);let m=!0;for(let i of e.numericalVertices)Number.isFinite(i[0])||(m=!1),Number.isFinite(i[1])||(m=!1);let v={name:e.labelForGraph,visible:!e.hidden&&m,withLabel:e.showLabel&&e.labelForGraph!=="",fixed:!0,layer:10*e.layer+k,strokeColor:e.selectedStyle.lineColor,highlightStrokeColor:e.selectedStyle.lineColor,strokeWidth:e.selectedStyle.lineWidth,highlightStrokeWidth:e.selectedStyle.lineWidth,dash:F(e.selectedStyle.lineStyle)};v.label={highlight:!1},e.labelHasLatex&&(v.label.useMathJax=!0),c.current={fixed:!e.draggable||e.fixed,visible:!e.hidden&&m&&e.draggable,withLabel:!0,name:"A",layer:10*e.layer+U,fillColor:e.selectedStyle.markerColor,strokeColor:e.selectedStyle.markerColor,size:e.selectedStyle.markerSize,face:Y(e.selectedStyle.markerStyle)},e.draggable?(c.current.highlightFillColor="#EEEEEE",c.current.highlightStrokeColor="#C3D9FF",c.current.showInfoBox=!0):(c.current.highlightFillColor=e.selectedStyle.markerColor,c.current.highlightStrokeColor=e.selectedStyle.markerColor,c.current.showInfoBox=!1),t.current=[];let a=e.variable.toString();for(let i=0;i{r.push(i[0]),s.push(i[1])});let y=o.create("curve",[r,s],v);for(let i=0;iw(i)),t.current[i].on("up",d=>O(i)),t.current[i].on("down",d=>C.current=null);return p.current=e.nPoints,y}function D(){o.removeObject(l.current),l.current=null,o.removeObject(h.current),h.current=null,o.removeObject(x.current),x.current=null;for(let n=0;np.current)for(let r=p.current;rw(r)),t.current[r].on("up",y=>O(r)),t.current[r].on("down",y=>C.current=null)}else if(e.nPoints0&&e.draggable&&(t.current[e.nPoints-1].visProp.visible=a,t.current[e.nPoints-1].visPropCalc.visible=a)}else{l.current.visProp.visible=!1,l.current.visPropCalc.visible=!1;for(let r=0;r0&&(t.current[e.nPoints-1].setAttribute({withlabel:!0}),t.current[e.nPoints-1].label.needsUpdate=!0,t.current[e.nPoints-1].label.update()),o.updateRenderer()}return e.hidden?null:A(N,{children:A("a",{name:j})})});function F(f){return f==="solid"?0:f==="dashed"?2:f==="dotted"?1:0}function Y(f){return f==="triangle"?"triangleup":f}export{M as default}; +import{av as J,bn as L,r as u,bt as X,j as A,F as N}from"./index-9d63439d.js";import{BoardContext as I,LINE_LAYER_OFFSET as k,VERTEX_LAYER_OFFSET as U}from"./graph-0c612329.js";import"./css-14ccef8c.js";import"./visibility-sensor-aefdbbd5.js";const M=J.memo(function f(V){let{name:R,id:j,SVs:e,actions:E,sourceOfUpdate:S,callAction:_}=L(V);f.ignoreActionsWithoutCore=!0;const o=u.useContext(I);let h=u.useRef(null),x=u.useRef(null),l=u.useRef(null),t=u.useRef(null),P=u.useRef(null),C=u.useRef(null),p=u.useRef(null),c=u.useRef(null),$=u.useRef(null);$.current=e.numericalVertices,u.useEffect(()=>()=>{l.current&&D()},[]);function G(){let n={visible:!e.hidden,withLabel:!1,fixed:!0,layer:10*e.layer+k,strokeColor:"green",highlightStrokeColor:"green",strokeWidth:3,dash:F("solid")},g=X(e.fDefinition);h.current=o.create("functiongraph",[g],n);let b={visible:!e.hidden,withLabel:!1,fixed:!0,layer:10*e.layer+k,strokeColor:"gray",highlightStrokeColor:"gray",strokeWidth:2,dash:F("solid")};x.current=o.create("line",[[0,0],[1,1]],b);let m=!0;for(let i of e.numericalVertices)Number.isFinite(i[0])||(m=!1),Number.isFinite(i[1])||(m=!1);let v={name:e.labelForGraph,visible:!e.hidden&&m,withLabel:e.showLabel&&e.labelForGraph!=="",fixed:!0,layer:10*e.layer+k,strokeColor:e.selectedStyle.lineColor,highlightStrokeColor:e.selectedStyle.lineColor,strokeWidth:e.selectedStyle.lineWidth,highlightStrokeWidth:e.selectedStyle.lineWidth,dash:F(e.selectedStyle.lineStyle)};v.label={highlight:!1},e.labelHasLatex&&(v.label.useMathJax=!0),c.current={fixed:!e.draggable||e.fixed,visible:!e.hidden&&m&&e.draggable,withLabel:!0,name:"A",layer:10*e.layer+U,fillColor:e.selectedStyle.markerColor,strokeColor:e.selectedStyle.markerColor,size:e.selectedStyle.markerSize,face:Y(e.selectedStyle.markerStyle)},e.draggable?(c.current.highlightFillColor="#EEEEEE",c.current.highlightStrokeColor="#C3D9FF",c.current.showInfoBox=!0):(c.current.highlightFillColor=e.selectedStyle.markerColor,c.current.highlightStrokeColor=e.selectedStyle.markerColor,c.current.showInfoBox=!1),t.current=[];let a=e.variable.toString();for(let i=0;i{r.push(i[0]),s.push(i[1])});let y=o.create("curve",[r,s],v);for(let i=0;iw(i)),t.current[i].on("up",d=>O(i)),t.current[i].on("down",d=>C.current=null);return p.current=e.nPoints,y}function D(){o.removeObject(l.current),l.current=null,o.removeObject(h.current),h.current=null,o.removeObject(x.current),x.current=null;for(let n=0;np.current)for(let r=p.current;rw(r)),t.current[r].on("up",y=>O(r)),t.current[r].on("down",y=>C.current=null)}else if(e.nPoints0&&e.draggable&&(t.current[e.nPoints-1].visProp.visible=a,t.current[e.nPoints-1].visPropCalc.visible=a)}else{l.current.visProp.visible=!1,l.current.visPropCalc.visible=!1;for(let r=0;r0&&(t.current[e.nPoints-1].setAttribute({withlabel:!0}),t.current[e.nPoints-1].label.needsUpdate=!0,t.current[e.nPoints-1].label.update()),o.updateRenderer()}return e.hidden?null:A(N,{children:A("a",{name:j})})});function F(f){return f==="solid"?0:f==="dashed"?2:f==="dotted"?1:0}function Y(f){return f==="triangle"?"triangleup":f}export{M as default}; diff --git a/dist/assets/codeEditor-35261aaa.js b/dist/assets/codeEditor-1054a77f.js similarity index 89% rename from dist/assets/codeEditor-35261aaa.js rename to dist/assets/codeEditor-1054a77f.js index 24fb3cb4aa..02a09da05a 100644 --- a/dist/assets/codeEditor-35261aaa.js +++ b/dist/assets/codeEditor-1054a77f.js @@ -1 +1 @@ -import{av as C,bn as T,r as l,a as s,F as S,j as a}from"./index-61b6fc23.js";import{s as n}from"./css-14ccef8c.js";import{C as W}from"./CodeMirror-d3d9f7d1.js";import{V as B}from"./visibility-sensor-398e690f.js";const H=C.memo(function(p){let{name:j,id:d,SVs:e,children:g,actions:i,callAction:r}=T(p),u=l.useRef(e.immediateValue),t=l.useRef(null),y=l.useRef(null),c=l.useRef(e.immediateValue),x={...e.height},m={...e.height};e.showResults&&(m.size*=1-e.viewerRatio);let R=o=>{r({action:i.recordVisibilityChange,args:{isVisible:o}})};if(l.useEffect(()=>()=>{r({action:i.recordVisibilityChange,args:{isVisible:!1}}),t.current!==null&&(clearTimeout(t.current),r({action:i.updateValue}))},[]),e.hidden)return null;const h=d+"_editor";e.immediateValue!==u.current&&(u.current=e.immediateValue,c.current=e.immediateValue);let f=null,w=e.width,V=e.width,b={width:n(w),height:n(m),maxWidth:"100%",padding:"0px",overflowX:"hidden",overflowY:"scroll"};e.showResults&&(f=s(S,{children:[a("hr",{style:{width:n(V),maxWidth:"100%"}}),a("div",{children:g})]}));let v=a("div",{id:h,style:b,children:a(W,{editorRef:y,setInternalValue:c.current,readOnly:e.disabled,onBlur:()=>{clearTimeout(t.current),r({action:i.updateValue}),t.current=null},onFocus:()=>{},onBeforeChange:o=>{u.current=o,r({action:i.updateImmediateValue,args:{text:o}}),clearTimeout(t.current),t.current=setTimeout(function(){r({action:i.updateValue}),t.current=null},3e3)}})},h);return a(B,{partialVisibility:!0,onChange:R,children:s("div",{style:{margin:"12px 0"},children:[a("a",{name:d}),s("div",{style:{padding:"0",border:"var(--mainBorder)",borderRadius:"var(--mainBorderRadius)",height:n(x),width:n(V),maxWidth:"100%",display:"flex",flexDirection:"column"},id:d,children:[v,f]})]})})});export{H as default}; +import{av as C,bn as T,r as l,a as s,F as S,j as a}from"./index-9d63439d.js";import{s as n}from"./css-14ccef8c.js";import{C as W}from"./CodeMirror-af01bb34.js";import{V as B}from"./visibility-sensor-aefdbbd5.js";const H=C.memo(function(p){let{name:j,id:d,SVs:e,children:g,actions:i,callAction:r}=T(p),u=l.useRef(e.immediateValue),t=l.useRef(null),y=l.useRef(null),c=l.useRef(e.immediateValue),x={...e.height},m={...e.height};e.showResults&&(m.size*=1-e.viewerRatio);let R=o=>{r({action:i.recordVisibilityChange,args:{isVisible:o}})};if(l.useEffect(()=>()=>{r({action:i.recordVisibilityChange,args:{isVisible:!1}}),t.current!==null&&(clearTimeout(t.current),r({action:i.updateValue}))},[]),e.hidden)return null;const h=d+"_editor";e.immediateValue!==u.current&&(u.current=e.immediateValue,c.current=e.immediateValue);let f=null,w=e.width,V=e.width,b={width:n(w),height:n(m),maxWidth:"100%",padding:"0px",overflowX:"hidden",overflowY:"scroll"};e.showResults&&(f=s(S,{children:[a("hr",{style:{width:n(V),maxWidth:"100%"}}),a("div",{children:g})]}));let v=a("div",{id:h,style:b,children:a(W,{editorRef:y,setInternalValue:c.current,readOnly:e.disabled,onBlur:()=>{clearTimeout(t.current),r({action:i.updateValue}),t.current=null},onFocus:()=>{},onBeforeChange:o=>{u.current=o,r({action:i.updateImmediateValue,args:{text:o}}),clearTimeout(t.current),t.current=setTimeout(function(){r({action:i.updateValue}),t.current=null},3e3)}})},h);return a(B,{partialVisibility:!0,onChange:R,children:s("div",{style:{margin:"12px 0"},children:[a("a",{name:d}),s("div",{style:{padding:"0",border:"var(--mainBorder)",borderRadius:"var(--mainBorderRadius)",height:n(x),width:n(V),maxWidth:"100%",display:"flex",flexDirection:"column"},id:d,children:[v,f]})]})})});export{H as default}; diff --git a/dist/assets/codeViewer-0faccbae.js b/dist/assets/codeViewer-c243d08a.js similarity index 89% rename from dist/assets/codeViewer-0faccbae.js rename to dist/assets/codeViewer-c243d08a.js index 8d7c5070bc..e9b15f473e 100644 --- a/dist/assets/codeViewer-0faccbae.js +++ b/dist/assets/codeViewer-c243d08a.js @@ -1 +1 @@ -import{av as p,bn as f,r as v,a as l,j as i,B as w}from"./index-61b6fc23.js";import{s as t}from"./css-14ccef8c.js";import{V as x}from"./visibility-sensor-398e690f.js";const S=p.memo(function(h){let{name:V,id:r,SVs:e,children:c,actions:a,callAction:n}=f(h,!1),u=g=>{n({action:a.recordVisibilityChange,args:{isVisible:g}})};if(v.useEffect(()=>()=>{n({action:a.recordVisibilityChange,args:{isVisible:!1}})},[]),e.hidden)return null;let s={...e.height};s.size=s.size-30;let d={...e.width};d.size=d.size-4;let o={width:t(e.width),maxWidth:"100%"};e.hasCodeEditorParent||(o.border="var(--mainBorder)",o.borderRadius="var(--mainBorderRadius)");let m=l("div",{style:{width:t(e.width),height:t(e.height),maxWidth:"100%",padding:"12px"},children:[i("div",{style:{height:"28px"},children:i(w,{onClick:()=>n({action:a.updateComponents}),value:"update",id:r+"_updateButton"})}),i("div",{style:{overflowY:"scroll",width:t(d),maxWidth:"100%",height:t(s)},id:r+"_content",children:c})]});return i(x,{partialVisibility:!0,onChange:u,children:l("div",{style:{margin:"12px 0"},children:[i("a",{name:r}),i("div",{style:o,className:"codeViewerSurroundingBox",id:r,children:m})]})})});export{S as default}; +import{av as p,bn as f,r as v,a as l,j as i,B as w}from"./index-9d63439d.js";import{s as t}from"./css-14ccef8c.js";import{V as x}from"./visibility-sensor-aefdbbd5.js";const S=p.memo(function(h){let{name:V,id:r,SVs:e,children:c,actions:a,callAction:n}=f(h,!1),u=g=>{n({action:a.recordVisibilityChange,args:{isVisible:g}})};if(v.useEffect(()=>()=>{n({action:a.recordVisibilityChange,args:{isVisible:!1}})},[]),e.hidden)return null;let s={...e.height};s.size=s.size-30;let d={...e.width};d.size=d.size-4;let o={width:t(e.width),maxWidth:"100%"};e.hasCodeEditorParent||(o.border="var(--mainBorder)",o.borderRadius="var(--mainBorderRadius)");let m=l("div",{style:{width:t(e.width),height:t(e.height),maxWidth:"100%",padding:"12px"},children:[i("div",{style:{height:"28px"},children:i(w,{onClick:()=>n({action:a.updateComponents}),value:"update",id:r+"_updateButton"})}),i("div",{style:{overflowY:"scroll",width:t(d),maxWidth:"100%",height:t(s)},id:r+"_content",children:c})]});return i(x,{partialVisibility:!0,onChange:u,children:l("div",{style:{margin:"12px 0"},children:[i("a",{name:r}),i("div",{style:o,className:"codeViewerSurroundingBox",id:r,children:m})]})})});export{S as default}; diff --git a/dist/assets/containerBlock-87e84c0a.js b/dist/assets/containerBlock-d44a5ce6.js similarity index 76% rename from dist/assets/containerBlock-87e84c0a.js rename to dist/assets/containerBlock-d44a5ce6.js index 21b10f55bf..ed61183647 100644 --- a/dist/assets/containerBlock-87e84c0a.js +++ b/dist/assets/containerBlock-d44a5ce6.js @@ -1 +1 @@ -import{av as c,bn as d,r as f,j as n,a as h}from"./index-61b6fc23.js";import{V}from"./visibility-sensor-398e690f.js";const y=c.memo(function(a){let{name:u,id:e,SVs:t,children:s,actions:i,callAction:r}=d(a),o=l=>{i.recordVisibilityChange&&r({action:i.recordVisibilityChange,args:{isVisible:l}})};return f.useEffect(()=>()=>{i.recordVisibilityChange&&r({action:i.recordVisibilityChange,args:{isVisible:!1}})},[]),t.hidden?null:n(V,{partialVisibility:!0,onChange:o,children:h("div",{id:e,children:[n("a",{name:e}),s]})})});export{y as default}; +import{av as c,bn as d,r as f,j as n,a as h}from"./index-9d63439d.js";import{V}from"./visibility-sensor-aefdbbd5.js";const y=c.memo(function(a){let{name:u,id:e,SVs:t,children:s,actions:i,callAction:r}=d(a),o=l=>{i.recordVisibilityChange&&r({action:i.recordVisibilityChange,args:{isVisible:l}})};return f.useEffect(()=>()=>{i.recordVisibilityChange&&r({action:i.recordVisibilityChange,args:{isVisible:!1}})},[]),t.hidden?null:n(V,{partialVisibility:!0,onChange:o,children:h("div",{id:e,children:[n("a",{name:e}),s]})})});export{y as default}; diff --git a/dist/assets/containerInline-54e6bb2d.js b/dist/assets/containerInline-f5a5681b.js similarity index 70% rename from dist/assets/containerInline-54e6bb2d.js rename to dist/assets/containerInline-f5a5681b.js index f4b2449482..9554471a59 100644 --- a/dist/assets/containerInline-54e6bb2d.js +++ b/dist/assets/containerInline-f5a5681b.js @@ -1 +1 @@ -import{av as s,bn as t,a as i,j as o}from"./index-61b6fc23.js";const m=s.memo(function(e){let{name:d,id:n,SVs:a,children:r}=t(e);return a.hidden?null:i("span",{id:n,children:[o("a",{name:n}),r]})});export{m as default}; +import{av as s,bn as t,a as i,j as o}from"./index-9d63439d.js";const m=s.memo(function(e){let{name:d,id:n,SVs:a,children:r}=t(e);return a.hidden?null:i("span",{id:n,children:[o("a",{name:n}),r]})});export{m as default}; diff --git a/dist/assets/curve-da578ee9.js b/dist/assets/curve-249cdae7.js similarity index 98% rename from dist/assets/curve-da578ee9.js rename to dist/assets/curve-249cdae7.js index 24e1f6b293..604687f64e 100644 --- a/dist/assets/curve-da578ee9.js +++ b/dist/assets/curve-249cdae7.js @@ -1 +1 @@ -import{av as ye,bn as xe,r as d,l as we,bs as Re,bt as P,j as R,F as B}from"./index-61b6fc23.js";import{BoardContext as Te,LINE_LAYER_OFFSET as ge,VERTEX_LAYER_OFFSET as N,CONTROL_POINT_LAYER_OFFSET as me}from"./graph-1ff63df5.js";import"./css-14ccef8c.js";import"./visibility-sensor-398e690f.js";const De=ye.memo(function A(Q){let{name:T,id:F,SVs:e,actions:x,sourceOfUpdate:V,callAction:w}=xe(Q);A.ignoreActionsWithoutCore=!0;const l=d.useContext(Te);let o=d.useRef(null),p=d.useRef(null),i=d.useRef(null),H=d.useRef(null),O=d.useRef(null),k=d.useRef(null),Y=d.useRef(!1),oe=d.useRef(null),S=d.useRef(null),I=d.useRef(null),_=d.useRef(null),q=d.useRef(null),D=d.useRef(null),C=d.useRef(null),a=d.useRef([]),M=d.useRef(null),j=d.useRef(null),K=d.useRef(null),J=d.useRef(null),Z=d.useRef([]),U=d.useRef([]);K.current=e.vectorControlDirections;let le=d.useRef(null);le.current=e.numericalThroughPoints;let ie=d.useRef(null);ie.current=e.numericalControlPoints;const ue=we(Re);d.useEffect(()=>()=>{o.current&&$()},[]);function ce(){if(e.curveType==="bezier"&&e.numericalThroughPoints.length<2)return null;let r=ue==="dark"?e.selectedStyle.lineColorDarkMode:e.selectedStyle.lineColor;r=r.toLowerCase();var t={name:e.labelForGraph,visible:!e.hidden,withLabel:e.showLabel&&e.labelForGraph!=="",fixed:!0,layer:10*e.layer+ge,strokeColor:r,strokeOpacity:e.selectedStyle.lineOpacity,strokeWidth:e.selectedStyle.lineWidth,dash:ve(e.selectedStyle.lineStyle,e.dashed),highlight:!1,lineCap:"butt"};if(e.showLabel&&e.labelForGraph!==""){let u,c,h;e.labelPosition==="upperright"?(h="urt",c=[-5,-10],u="right"):e.labelPosition==="upperleft"?(h="ulft",c=[5,-10],u="left"):e.labelPosition==="lowerright"?(h="lrt",c=[-5,10],u="right"):e.labelPosition==="lowerleft"?(h="llft",c=[5,10],u="left"):e.labelPosition==="top"?(h="top",c=[0,-10],u="left"):e.labelPosition==="bottom"?(h="bot",c=[0,10],u="left"):e.labelPosition==="left"?(h="lft",c=[10,0],u="left"):(h="rt",c=[-10,0],u="right"),t.label={offset:c,position:h,anchorx:u,highlight:!1},e.labelHasLatex&&(t.label.useMathJax=!0),e.applyStyleToLabel?t.label.strokeColor=r:t.label.strokeColor="var(canvastext)"}else t.label={highlight:!1},e.labelHasLatex&&(t.label.useMathJax=!0);let g;if(e.curveType==="parameterization"){let u=P(e.fDefinitions[0]),c=P(e.fDefinitions[1]);g=l.create("curve",[u,c,e.parMin,e.parMax],t)}else if(e.curveType==="bezier"){let u=P(e.fDefinitions[0]),c=P(e.fDefinitions[1]);g=l.create("curve",[u,c,e.parMin,e.parMax],t)}else{let u=P(e.fDefinitions[0]);if(e.flipFunction){let c=e.graphYmin,h=e.graphYmax,m=Math.max(c-(h-c)*.1,e.parMin),L=Math.min(h+(h-c)*.1,e.parMax);g=l.create("curve",[u,re=>re,m,L],t)}else{let c=e.graphXmin,h=e.graphXmax,m=Math.max(c-(h-c)*.1,e.parMin),L=Math.min(h+(h-c)*.1,e.parMax);g=l.create("functiongraph",[u,m,L],t)}oe.current=e.flipFunction}return H.current=e.curveType,O.current=null,k.current=null,g.on("up",function(u){!Y.current&&O.current===null&&k.current===null&&(e.switchable&&!e.fixed&&w({action:x.switchCurve}),w({action:x.curveClicked,args:{name:T}}))}),e.curveType==="bezier"?(l.on("up",he),g.on("down",()=>{y(),w({action:x.mouseDownOnCurve,args:{name:T}})}),S.current={visible:!1,withLabel:!1,fixed:!0,strokeColor:"var(--mainGray)",highlightStrokeColor:"var(--mainGray)",layer:10*e.layer+N,strokeWidth:1,highlightStrokeWidth:1},I.current={visible:!e.hidden,withLabel:!1,fixed:!1,fillColor:"none",strokeColor:"none",highlightFillColor:"var(--mainGray)",highlightStrokeColor:"var(--mainGray)",strokeWidth:1,highlightStrokeWidth:1,layer:10*e.layer+N,size:3},_.current={fillcolor:"var(--mainGray)",strokecolor:"var(--mainGray)"},q.current={fillcolor:"none",strokecolor:"none"},D.current={visible:!1,withLabel:!1,fixed:!1,fillColor:"var(--mainGray)",strokeColor:"var(--mainGray)",highlightFillColor:"var(--mainGray)",highlightStrokeColor:"var(--mainGray)",strokeWidth:1,highlightStrokeWidth:1,layer:10*e.layer+me,size:2},e.draggable&&!e.fixed&&(ae(),e.bezierControlsAlwaysVisible&&(ee(),Ce()),l.updateRenderer(),C.current=e.numericalThroughPoints.length,J.current=[...e.vectorControlDirections])):g.on("down",function(u){Y.current=!1,w({action:x.mouseDownOnCurve,args:{name:T}})}),g}function $(){l.off("up",he),o.current.off("down"),o.current.off("up"),l.removeObject(o.current),o.current=null,se()}function ae(){p.current=[],i.current=[],a.current=[];for(let r=0;rfe(r)),t.on("down",m=>pe(r)),t.on("up",m=>de(r)),g.on("drag",m=>W(r,0)),u.on("drag",m=>W(r,1)),g.on("down",y),u.on("down",y),c.on("down",y),c.on("down",y),g.on("up",m=>z(r,0)),u.on("up",m=>z(r,1))}M.current=[]}function se(){a.current.length>0&&(a.current.forEach(r=>r.forEach(t=>{t&&(t.off("down"),l.removeObject(t))})),a.current=[],i.current.forEach(r=>r.forEach(t=>{t&&(t.off("drag"),t.off("down"),t.off("up"),l.removeObject(t))})),i.current=[],p.current.forEach(r=>{r.off("drag"),r.off("down"),r.off("up"),l.removeObject(r)}),p.current=[])}function fe(r){k.current=r,Z.current[r]=[p.current[r].X(),p.current[r].Y()],w({action:x.moveThroughPoint,args:{throughPoint:Z.current[r],throughPointInd:r,transient:!0,skippable:!0}}),p.current[r].coords.setCoordinates(JXG.COORDS_BY_USER,le.current[r]),l.updateInfobox(p.current[r])}function de(r){k.current===r&&w({action:x.moveThroughPoint,args:{throughPoint:Z.current[r],throughPointInd:r}})}function W(r,t){O.current=r+"_"+t,U.current[r]||(U.current[r]={}),U.current[r][t]=[i.current[r][t].X()-p.current[r].X(),i.current[r][t].Y()-p.current[r].Y()],w({action:x.moveControlVector,args:{controlVector:U.current[r][t],controlVectorInds:[r,t],transient:!0,skippable:!0}}),i.current[r][t].coords.setCoordinates(JXG.COORDS_BY_USER,[...ie.current[r][t]]),l.updateInfobox(i.current[r][t])}function z(r,t){O.current===r+"_"+t&&w({action:x.moveControlVector,args:{controlVector:U.current[r][t],controlVectorInds:[r,t]}})}function ee(){for(let r of p.current){for(let t in _.current)r.visProp[t]=_.current[t];r.needsUpdate=!0,r.update()}}function be(){for(let r of p.current){for(let t in q.current)r.visProp[t]=q.current[t];r.needsUpdate=!0,r.update()}}function Pe(){for(let r of i.current)for(let t of r)t&&(t.visProp.visible=!1,t.needsUpdate=!0,t.update());for(let r of a.current)for(let t of r)t&&(t.visProp.visible=!1,t.needsUpdate=!0,t.update());M.current=[]}function Ce(){for(let r in i.current)E(r)}function he(){!e.draggable||e.fixed||(j.current!==!0&&!e.bezierControlsAlwaysVisible&&(be(),Pe(),l.updateRenderer()),j.current=!1)}function pe(r,t){!e.draggable||e.fixed||(k.current=null,O.current=null,j.current=!0,ee(),E(r),l.updateRenderer())}function E(r){if(!e.hiddenControls[r]){if(i.current[r][0]){let t=(r>0||e.extrapolateBackward)&&["symmetric","both","previous"].includes(K.current[r]);i.current[r][0].visProp.visible=t,i.current[r][0].visPropCalc.visible=t,i.current[r][0].needsUpdate=!0,i.current[r][0].update(),a.current[r][0].visProp.visible=t,a.current[r][0].visPropCalc.visible=t,a.current[r][0].needsUpdate=!0,a.current[r][0].update()}if(i.current[r][1]){let t=(re.parMin,o.current.maxX=()=>e.parMax}else if(e.curveType==="bezier")o.current.X=P(e.fDefinitions[0]),o.current.Y=P(e.fDefinitions[1]),o.current.minX=()=>e.parMin,o.current.maxX=()=>e.parMax;else{let n=P(e.fDefinitions[0]);if(e.flipFunction){o.current.X=n;let s=e.graphYmin,f=e.graphYmax,v=Math.max(s-(f-s)*.1,e.parMin),b=Math.min(f+(f-s)*.1,e.parMax);o.current.minX=()=>v,o.current.maxX=()=>b}else{o.current.Y=n;let s=e.graphXmin,f=e.graphXmax,v=Math.max(s-(f-s)*.1,e.parMin),b=Math.min(f+(f-s)*.1,e.parMax);o.current.minX=()=>v,o.current.maxX=()=>b}}if(o.current.needsUpdate=!0,o.current.updateCurve(),o.current.hasLabel&&(o.current.label.needsUpdate=!0,o.current.label.visPropCalc.visible=e.showLabel&&e.labelForGraph!=="",e.applyStyleToLabel?o.current.label.visProp.strokecolor=m:o.current.label.visProp.strokecolor="var(canvastext)",o.current.label.update()),e.curveType!=="bezier")return l.updateRenderer(),R(B,{children:R("a",{name:F})});if(!e.draggable||e.fixed)return a.current.length>0&&se(),l.updateRenderer(),R(B,{children:R("a",{name:F})});if(a.current.length===0)return ae(),C.current=e.numericalThroughPoints.length,J.current=[...e.vectorControlDirections],l.updateRenderer(),R(B,{children:R("a",{name:F})});if(e.numericalThroughPoints.length>C.current){let n=C.current-1,s=Object.assign({},I.current);p.current[n].visProp.fillcolor===_.current.fillcolor&&Object.assign(s,_.current);for(let f=C.current;ffe(f)),v.on("down",G=>pe(f)),v.on("up",G=>de(f)),b.on("drag",G=>W(f,0)),b.on("down",y),b.on("up",G=>z(f,0)),X.on("drag",G=>W(f,1)),X.on("down",y),X.on("up",G=>z(f,1)),te.on("down",y),ne.on("down",y)}M.current[n]&&E(n)}else if(e.numericalThroughPoints.length=e.numericalThroughPoints.length;s--){a.current[s][0].off("down"),a.current[s][1].off("down"),l.removeObject(a.current[s][0]),l.removeObject(a.current[s][1]),a.current.pop(),i.current[s][0].off("drag"),i.current[s][0].off("down"),i.current[s][0].off("up"),i.current[s][1].off("drag"),i.current[s][1].off("down"),i.current[s][1].off("up"),l.removeObject(i.current[s][0]),l.removeObject(i.current[s][1]),i.current.pop();let f=p.current.pop();f.off("drag"),f.off("down"),f.off("up"),l.removeObject(f)}let n=e.numericalThroughPoints.length-1;M.current[n]&&E(n)}let re=Math.min(e.numericalThroughPoints.length,C.current);for(let n=0;n()=>{o.current&&$()},[]);function ce(){if(e.curveType==="bezier"&&e.numericalThroughPoints.length<2)return null;let r=ue==="dark"?e.selectedStyle.lineColorDarkMode:e.selectedStyle.lineColor;r=r.toLowerCase();var t={name:e.labelForGraph,visible:!e.hidden,withLabel:e.showLabel&&e.labelForGraph!=="",fixed:!0,layer:10*e.layer+ge,strokeColor:r,strokeOpacity:e.selectedStyle.lineOpacity,strokeWidth:e.selectedStyle.lineWidth,dash:ve(e.selectedStyle.lineStyle,e.dashed),highlight:!1,lineCap:"butt"};if(e.showLabel&&e.labelForGraph!==""){let u,c,h;e.labelPosition==="upperright"?(h="urt",c=[-5,-10],u="right"):e.labelPosition==="upperleft"?(h="ulft",c=[5,-10],u="left"):e.labelPosition==="lowerright"?(h="lrt",c=[-5,10],u="right"):e.labelPosition==="lowerleft"?(h="llft",c=[5,10],u="left"):e.labelPosition==="top"?(h="top",c=[0,-10],u="left"):e.labelPosition==="bottom"?(h="bot",c=[0,10],u="left"):e.labelPosition==="left"?(h="lft",c=[10,0],u="left"):(h="rt",c=[-10,0],u="right"),t.label={offset:c,position:h,anchorx:u,highlight:!1},e.labelHasLatex&&(t.label.useMathJax=!0),e.applyStyleToLabel?t.label.strokeColor=r:t.label.strokeColor="var(canvastext)"}else t.label={highlight:!1},e.labelHasLatex&&(t.label.useMathJax=!0);let g;if(e.curveType==="parameterization"){let u=P(e.fDefinitions[0]),c=P(e.fDefinitions[1]);g=l.create("curve",[u,c,e.parMin,e.parMax],t)}else if(e.curveType==="bezier"){let u=P(e.fDefinitions[0]),c=P(e.fDefinitions[1]);g=l.create("curve",[u,c,e.parMin,e.parMax],t)}else{let u=P(e.fDefinitions[0]);if(e.flipFunction){let c=e.graphYmin,h=e.graphYmax,m=Math.max(c-(h-c)*.1,e.parMin),L=Math.min(h+(h-c)*.1,e.parMax);g=l.create("curve",[u,re=>re,m,L],t)}else{let c=e.graphXmin,h=e.graphXmax,m=Math.max(c-(h-c)*.1,e.parMin),L=Math.min(h+(h-c)*.1,e.parMax);g=l.create("functiongraph",[u,m,L],t)}oe.current=e.flipFunction}return H.current=e.curveType,O.current=null,k.current=null,g.on("up",function(u){!Y.current&&O.current===null&&k.current===null&&(e.switchable&&!e.fixed&&w({action:x.switchCurve}),w({action:x.curveClicked,args:{name:T}}))}),e.curveType==="bezier"?(l.on("up",he),g.on("down",()=>{y(),w({action:x.mouseDownOnCurve,args:{name:T}})}),S.current={visible:!1,withLabel:!1,fixed:!0,strokeColor:"var(--mainGray)",highlightStrokeColor:"var(--mainGray)",layer:10*e.layer+N,strokeWidth:1,highlightStrokeWidth:1},I.current={visible:!e.hidden,withLabel:!1,fixed:!1,fillColor:"none",strokeColor:"none",highlightFillColor:"var(--mainGray)",highlightStrokeColor:"var(--mainGray)",strokeWidth:1,highlightStrokeWidth:1,layer:10*e.layer+N,size:3},_.current={fillcolor:"var(--mainGray)",strokecolor:"var(--mainGray)"},q.current={fillcolor:"none",strokecolor:"none"},D.current={visible:!1,withLabel:!1,fixed:!1,fillColor:"var(--mainGray)",strokeColor:"var(--mainGray)",highlightFillColor:"var(--mainGray)",highlightStrokeColor:"var(--mainGray)",strokeWidth:1,highlightStrokeWidth:1,layer:10*e.layer+me,size:2},e.draggable&&!e.fixed&&(ae(),e.bezierControlsAlwaysVisible&&(ee(),Ce()),l.updateRenderer(),C.current=e.numericalThroughPoints.length,J.current=[...e.vectorControlDirections])):g.on("down",function(u){Y.current=!1,w({action:x.mouseDownOnCurve,args:{name:T}})}),g}function $(){l.off("up",he),o.current.off("down"),o.current.off("up"),l.removeObject(o.current),o.current=null,se()}function ae(){p.current=[],i.current=[],a.current=[];for(let r=0;rfe(r)),t.on("down",m=>pe(r)),t.on("up",m=>de(r)),g.on("drag",m=>W(r,0)),u.on("drag",m=>W(r,1)),g.on("down",y),u.on("down",y),c.on("down",y),c.on("down",y),g.on("up",m=>z(r,0)),u.on("up",m=>z(r,1))}M.current=[]}function se(){a.current.length>0&&(a.current.forEach(r=>r.forEach(t=>{t&&(t.off("down"),l.removeObject(t))})),a.current=[],i.current.forEach(r=>r.forEach(t=>{t&&(t.off("drag"),t.off("down"),t.off("up"),l.removeObject(t))})),i.current=[],p.current.forEach(r=>{r.off("drag"),r.off("down"),r.off("up"),l.removeObject(r)}),p.current=[])}function fe(r){k.current=r,Z.current[r]=[p.current[r].X(),p.current[r].Y()],w({action:x.moveThroughPoint,args:{throughPoint:Z.current[r],throughPointInd:r,transient:!0,skippable:!0}}),p.current[r].coords.setCoordinates(JXG.COORDS_BY_USER,le.current[r]),l.updateInfobox(p.current[r])}function de(r){k.current===r&&w({action:x.moveThroughPoint,args:{throughPoint:Z.current[r],throughPointInd:r}})}function W(r,t){O.current=r+"_"+t,U.current[r]||(U.current[r]={}),U.current[r][t]=[i.current[r][t].X()-p.current[r].X(),i.current[r][t].Y()-p.current[r].Y()],w({action:x.moveControlVector,args:{controlVector:U.current[r][t],controlVectorInds:[r,t],transient:!0,skippable:!0}}),i.current[r][t].coords.setCoordinates(JXG.COORDS_BY_USER,[...ie.current[r][t]]),l.updateInfobox(i.current[r][t])}function z(r,t){O.current===r+"_"+t&&w({action:x.moveControlVector,args:{controlVector:U.current[r][t],controlVectorInds:[r,t]}})}function ee(){for(let r of p.current){for(let t in _.current)r.visProp[t]=_.current[t];r.needsUpdate=!0,r.update()}}function be(){for(let r of p.current){for(let t in q.current)r.visProp[t]=q.current[t];r.needsUpdate=!0,r.update()}}function Pe(){for(let r of i.current)for(let t of r)t&&(t.visProp.visible=!1,t.needsUpdate=!0,t.update());for(let r of a.current)for(let t of r)t&&(t.visProp.visible=!1,t.needsUpdate=!0,t.update());M.current=[]}function Ce(){for(let r in i.current)E(r)}function he(){!e.draggable||e.fixed||(j.current!==!0&&!e.bezierControlsAlwaysVisible&&(be(),Pe(),l.updateRenderer()),j.current=!1)}function pe(r,t){!e.draggable||e.fixed||(k.current=null,O.current=null,j.current=!0,ee(),E(r),l.updateRenderer())}function E(r){if(!e.hiddenControls[r]){if(i.current[r][0]){let t=(r>0||e.extrapolateBackward)&&["symmetric","both","previous"].includes(K.current[r]);i.current[r][0].visProp.visible=t,i.current[r][0].visPropCalc.visible=t,i.current[r][0].needsUpdate=!0,i.current[r][0].update(),a.current[r][0].visProp.visible=t,a.current[r][0].visPropCalc.visible=t,a.current[r][0].needsUpdate=!0,a.current[r][0].update()}if(i.current[r][1]){let t=(re.parMin,o.current.maxX=()=>e.parMax}else if(e.curveType==="bezier")o.current.X=P(e.fDefinitions[0]),o.current.Y=P(e.fDefinitions[1]),o.current.minX=()=>e.parMin,o.current.maxX=()=>e.parMax;else{let n=P(e.fDefinitions[0]);if(e.flipFunction){o.current.X=n;let s=e.graphYmin,f=e.graphYmax,v=Math.max(s-(f-s)*.1,e.parMin),b=Math.min(f+(f-s)*.1,e.parMax);o.current.minX=()=>v,o.current.maxX=()=>b}else{o.current.Y=n;let s=e.graphXmin,f=e.graphXmax,v=Math.max(s-(f-s)*.1,e.parMin),b=Math.min(f+(f-s)*.1,e.parMax);o.current.minX=()=>v,o.current.maxX=()=>b}}if(o.current.needsUpdate=!0,o.current.updateCurve(),o.current.hasLabel&&(o.current.label.needsUpdate=!0,o.current.label.visPropCalc.visible=e.showLabel&&e.labelForGraph!=="",e.applyStyleToLabel?o.current.label.visProp.strokecolor=m:o.current.label.visProp.strokecolor="var(canvastext)",o.current.label.update()),e.curveType!=="bezier")return l.updateRenderer(),R(B,{children:R("a",{name:F})});if(!e.draggable||e.fixed)return a.current.length>0&&se(),l.updateRenderer(),R(B,{children:R("a",{name:F})});if(a.current.length===0)return ae(),C.current=e.numericalThroughPoints.length,J.current=[...e.vectorControlDirections],l.updateRenderer(),R(B,{children:R("a",{name:F})});if(e.numericalThroughPoints.length>C.current){let n=C.current-1,s=Object.assign({},I.current);p.current[n].visProp.fillcolor===_.current.fillcolor&&Object.assign(s,_.current);for(let f=C.current;ffe(f)),v.on("down",G=>pe(f)),v.on("up",G=>de(f)),b.on("drag",G=>W(f,0)),b.on("down",y),b.on("up",G=>z(f,0)),X.on("drag",G=>W(f,1)),X.on("down",y),X.on("up",G=>z(f,1)),te.on("down",y),ne.on("down",y)}M.current[n]&&E(n)}else if(e.numericalThroughPoints.length=e.numericalThroughPoints.length;s--){a.current[s][0].off("down"),a.current[s][1].off("down"),l.removeObject(a.current[s][0]),l.removeObject(a.current[s][1]),a.current.pop(),i.current[s][0].off("drag"),i.current[s][0].off("down"),i.current[s][0].off("up"),i.current[s][1].off("drag"),i.current[s][1].off("down"),i.current[s][1].off("up"),l.removeObject(i.current[s][0]),l.removeObject(i.current[s][1]),i.current.pop();let f=p.current.pop();f.off("drag"),f.off("down"),f.off("up"),l.removeObject(f)}let n=e.numericalThroughPoints.length-1;M.current[n]&&E(n)}let re=Math.min(e.numericalThroughPoints.length,C.current);for(let n=0;n{c({action:n.recordVisibilityChange,args:{isVisible:l}})};if(g.useEffect(()=>()=>{c({action:n.recordVisibilityChange,args:{isVisible:!1}})},[]),g.useEffect(()=>{if(e.encodedGeogebraContent){let l=e,f=o(t),p=s(e.width),m=s(e.height);window.MathJax.Hub.Register.StartupHook("End",function(){let w={id:f,width:p,height:m,showResetIcon:!1,enableLabelDrags:!1,useBrowserForJS:!0,showMenubar:!1,errorDialogsActive:!0,showToolbar:!1,showAlgebraicInput:!1,enableShiftDragZoom:!0,enableRightClick:!0,showToolBarHelp:!1,ggbBase64:l.encodedGeogebraContent.trim(),language:"en",country:"US",isPreloader:!1,screenshotGenerator:!1,preventFocus:!1,fixApplet:!1,prerelease:!1,playButtonAutoDecide:!0,playButton:!1,canary:!1,allowUpscale:!1},h=new window.GGBApplet(w,!0);h.setHTML5Codebase("/geogebra/HTML5/5.0/web/","true"),h.inject("container_"+f,"preferhtml5")})}},[]),e.hidden)return null;let i=s(e.width),r=s(e.height);return e.geogebra?a(b,{partialVisibility:!0,onChange:d,children:S("div",{className:"geogebra",id:t,children:[a("a",{name:t}),a("iframe",{scrolling:"no",title:"",src:`https://www.geogebra.org/material/iframe/id/${e.geogebra}/width/${i}/height/${r}/border/888888/sfsb/true/smb/false/stb/false/stbh/false/ai/false/asb/false/sri/false/rc/false/ld/false/sdz/false/ctl/false`,width:i,height:r,style:{border:"0px"},children:" "})]})}):e.encodedGeogebraContent?a(b,{partialVisibility:!0,onChange:d,children:a("div",{className:"javascriptapplet",id:o(t),children:a("div",{className:"geogebrawebapplet",id:"container_"+o(t),style:{minWidth:i,minHeight:r}})})}):(console.warn("Nothing specified to embed"),null)});export{D as default}; +import{av as y,bn as C,r as g,ad as o,j as a,a as S}from"./index-9d63439d.js";import{s}from"./css-14ccef8c.js";import{V as b}from"./visibility-sensor-aefdbbd5.js";const D=y.memo(function(u){let{name:v,id:t,SVs:e,actions:n,callAction:c}=C(u),d=l=>{c({action:n.recordVisibilityChange,args:{isVisible:l}})};if(g.useEffect(()=>()=>{c({action:n.recordVisibilityChange,args:{isVisible:!1}})},[]),g.useEffect(()=>{if(e.encodedGeogebraContent){let l=e,f=o(t),p=s(e.width),m=s(e.height);window.MathJax.Hub.Register.StartupHook("End",function(){let w={id:f,width:p,height:m,showResetIcon:!1,enableLabelDrags:!1,useBrowserForJS:!0,showMenubar:!1,errorDialogsActive:!0,showToolbar:!1,showAlgebraicInput:!1,enableShiftDragZoom:!0,enableRightClick:!0,showToolBarHelp:!1,ggbBase64:l.encodedGeogebraContent.trim(),language:"en",country:"US",isPreloader:!1,screenshotGenerator:!1,preventFocus:!1,fixApplet:!1,prerelease:!1,playButtonAutoDecide:!0,playButton:!1,canary:!1,allowUpscale:!1},h=new window.GGBApplet(w,!0);h.setHTML5Codebase("/geogebra/HTML5/5.0/web/","true"),h.inject("container_"+f,"preferhtml5")})}},[]),e.hidden)return null;let i=s(e.width),r=s(e.height);return e.geogebra?a(b,{partialVisibility:!0,onChange:d,children:S("div",{className:"geogebra",id:t,children:[a("a",{name:t}),a("iframe",{scrolling:"no",title:"",src:`https://www.geogebra.org/material/iframe/id/${e.geogebra}/width/${i}/height/${r}/border/888888/sfsb/true/smb/false/stb/false/stbh/false/ai/false/asb/false/sri/false/rc/false/ld/false/sdz/false/ctl/false`,width:i,height:r,style:{border:"0px"},children:" "})]})}):e.encodedGeogebraContent?a(b,{partialVisibility:!0,onChange:d,children:a("div",{className:"javascriptapplet",id:o(t),children:a("div",{className:"geogebrawebapplet",id:"container_"+o(t),style:{minWidth:i,minHeight:r}})})}):(console.warn("Nothing specified to embed"),null)});export{D as default}; diff --git a/dist/assets/feedback-13937dc4.js b/dist/assets/feedback-83b2c508.js similarity index 89% rename from dist/assets/feedback-13937dc4.js rename to dist/assets/feedback-83b2c508.js index 3eba7ec006..09eaeaf9b5 100644 --- a/dist/assets/feedback-13937dc4.js +++ b/dist/assets/feedback-83b2c508.js @@ -1,4 +1,4 @@ -import{av as p,bn as x,r as b,j as e,a as i,F as u,s as n,i as f}from"./index-61b6fc23.js";import{a as m}from"./index-47ca4f11.js";import{V as g}from"./visibility-sensor-398e690f.js";const h=n.aside` +import{av as p,bn as x,r as b,j as e,a as i,F as u,s as n,i as f}from"./index-9d63439d.js";import{a as m}from"./index-47ca4f11.js";import{V as g}from"./visibility-sensor-aefdbbd5.js";const h=n.aside` background-color: white; margin: 0px 4px 12px 4px; padding: 1em; diff --git a/dist/assets/figure-0b18cdc0.js b/dist/assets/figure-51094dce.js similarity index 88% rename from dist/assets/figure-0b18cdc0.js rename to dist/assets/figure-51094dce.js index b49bc0ec25..2acd419344 100644 --- a/dist/assets/figure-0b18cdc0.js +++ b/dist/assets/figure-51094dce.js @@ -1 +1 @@ -import{av as V,bn as A,r as u,j as n,a as h}from"./index-61b6fc23.js";import{V as H}from"./visibility-sensor-398e690f.js";import{M as E}from"./index.esm-d246f4c9.js";import"./setPrototypeOf-51e8cf87.js";const j=V.memo(function(g){var m;let{name:R,id:r,SVs:a,children:l,actions:c,callAction:d}=A(g),y=e=>{d({action:c.recordVisibilityChange,args:{isVisible:e}})};if(u.useEffect(()=>()=>{d({action:c.recordVisibilityChange,args:{isVisible:!1}})},[]),a.hidden||!l)return null;let f=l,s=null,o=null;if(a.captionChildName){let e;for(let[i,t]of l.entries())if(((m=t==null?void 0:t.props)==null?void 0:m.componentInstructions.componentName)===a.captionChildName){e=i;break}o=l[e],f.splice(e,1)}if(a.suppressFigureNameInCaption)o&&(s=n("div",{children:o}));else{let e=n("strong",{children:a.figureName});o?s=h("div",{children:[e,": ",o]}):s=n("div",{children:e})}const[C,p]=u.useState("center");function v(e){var i=document.createElement(e.nodeName),t;return i.setAttribute("style","margin:0; padding:0; font-family:"+(e.style.fontFamily||"inherit")+"; font-size:"+(e.style.fontSize||"inherit")),i.innerHTML="A",e.parentNode.appendChild(i),t=i.clientHeight,i.parentNode.removeChild(i),t}function b(){var e=document.getElementById(r+"_caption"),i=e.offsetHeight,t=v(document.getElementById(r+"_caption")),x=Math.round(i/t);return x}function N(){b()>=2?p("left"):p("center")}return n(H,{partialVisibility:!0,onChange:y,children:h("figure",{id:r,style:{margin:"12px 0"},children:[n("a",{name:r}),f,n("figcaption",{id:r+"_caption",children:n(E,{onResize:N,children:({measureRef:e})=>n("div",{ref:e,style:{textAlign:C},children:s})})})]})})});export{j as default}; +import{av as V,bn as A,r as u,j as n,a as h}from"./index-9d63439d.js";import{V as H}from"./visibility-sensor-aefdbbd5.js";import{M as E}from"./index.esm-d6b6ff57.js";import"./setPrototypeOf-51e8cf87.js";const j=V.memo(function(g){var m;let{name:R,id:r,SVs:a,children:l,actions:c,callAction:d}=A(g),y=e=>{d({action:c.recordVisibilityChange,args:{isVisible:e}})};if(u.useEffect(()=>()=>{d({action:c.recordVisibilityChange,args:{isVisible:!1}})},[]),a.hidden||!l)return null;let f=l,s=null,o=null;if(a.captionChildName){let e;for(let[i,t]of l.entries())if(((m=t==null?void 0:t.props)==null?void 0:m.componentInstructions.componentName)===a.captionChildName){e=i;break}o=l[e],f.splice(e,1)}if(a.suppressFigureNameInCaption)o&&(s=n("div",{children:o}));else{let e=n("strong",{children:a.figureName});o?s=h("div",{children:[e,": ",o]}):s=n("div",{children:e})}const[C,p]=u.useState("center");function v(e){var i=document.createElement(e.nodeName),t;return i.setAttribute("style","margin:0; padding:0; font-family:"+(e.style.fontFamily||"inherit")+"; font-size:"+(e.style.fontSize||"inherit")),i.innerHTML="A",e.parentNode.appendChild(i),t=i.clientHeight,i.parentNode.removeChild(i),t}function b(){var e=document.getElementById(r+"_caption"),i=e.offsetHeight,t=v(document.getElementById(r+"_caption")),x=Math.round(i/t);return x}function N(){b()>=2?p("left"):p("center")}return n(H,{partialVisibility:!0,onChange:y,children:h("figure",{id:r,style:{margin:"12px 0"},children:[n("a",{name:r}),f,n("figcaption",{id:r+"_caption",children:n(E,{onResize:N,children:({measureRef:e})=>n("div",{ref:e,style:{textAlign:C},children:s})})})]})})});export{j as default}; diff --git a/dist/assets/footnote-4a0bce52.js b/dist/assets/footnote-a071a0ab.js similarity index 90% rename from dist/assets/footnote-4a0bce52.js rename to dist/assets/footnote-a071a0ab.js index 57a559a071..6a5ffd8631 100644 --- a/dist/assets/footnote-4a0bce52.js +++ b/dist/assets/footnote-a071a0ab.js @@ -1 +1 @@ -import{av as u,bn as b,r as h,j as t,a as o,F as p}from"./index-61b6fc23.js";const y=u.memo(function(a){let{name:g,id:n,SVs:e}=b(a,!1),[r,l]=h.useState(!1);if(e.hidden)return null;const i={padding:"10px",borderRadius:"5px",backgroundColor:"#e2e2e2",display:"static"};let s="";r&&(s=t("div",{style:i,children:e.text}));const d={backgroundColor:"white",border:"none"},c={textDecoration:"none",color:"#1A5A99"};return o(p,{children:[o("span",{id:n,children:[t("a",{name:n}),t("sup",{children:t("button",{style:d,onClick:()=>l(f=>!f),children:o("a",{href:"#",title:e.text,style:c,children:["[",e.footnoteTag,"]"]})})})]}),s]})});export{y as default}; +import{av as u,bn as b,r as h,j as t,a as o,F as p}from"./index-9d63439d.js";const y=u.memo(function(a){let{name:g,id:n,SVs:e}=b(a,!1),[r,l]=h.useState(!1);if(e.hidden)return null;const i={padding:"10px",borderRadius:"5px",backgroundColor:"#e2e2e2",display:"static"};let s="";r&&(s=t("div",{style:i,children:e.text}));const d={backgroundColor:"white",border:"none"},c={textDecoration:"none",color:"#1A5A99"};return o(p,{children:[o("span",{id:n,children:[t("a",{name:n}),t("sup",{children:t("button",{style:d,onClick:()=>l(f=>!f),children:o("a",{href:"#",title:e.text,style:c,children:["[",e.footnoteTag,"]"]})})})]}),s]})});export{y as default}; diff --git a/dist/assets/graph-1ff63df5.js b/dist/assets/graph-0c612329.js similarity index 98% rename from dist/assets/graph-1ff63df5.js rename to dist/assets/graph-0c612329.js index 1c610dcd0f..e181bff700 100644 --- a/dist/assets/graph-1ff63df5.js +++ b/dist/assets/graph-0c612329.js @@ -1 +1 @@ -import{av as I,bn as q,r as f,a as F,F as W,j as m,bo as Y,ad as Q}from"./index-61b6fc23.js";import{s as E}from"./css-14ccef8c.js";import{V as D}from"./visibility-sensor-398e690f.js";function G(b){return b=Q(b,{isIdentifier:!0}),b.slice(0,2)==="\\#"&&(b=b.slice(1)),b}const K=f.createContext(),it=I.memo(function(N){let{name:Z,id:g,SVs:t,children:X,actions:L,callAction:P}=q(N);const[n,J]=f.useState(null),A=f.useRef(null),v=f.useRef(null),o=f.useRef(null),c=f.useRef(null),S=f.useRef(!1),C=f.useRef(!1),y=f.useRef(!1);let O=f.useRef(null),R=f.useRef(null),_=t.showNavigation&&!t.fixAxes,B=d=>{P({action:L.recordVisibilityChange,args:{isVisible:d}})};if(f.useEffect(()=>{if(!t.haveGraphParent)return()=>{P({action:L.recordVisibilityChange,args:{isVisible:!1}})}},[]),f.useEffect(()=>{if(t.haveGraphParent)return;let d=[t.xmin,t.ymax,t.xmax,t.ymin];v.current=d,JXG.Options.layer.numlayers=100,JXG.Options.navbar.highlightFillColor="var(--canvastext)",JXG.Options.navbar.strokeColor="var(--canvastext)";let a=!1;Array.isArray(t.grid)&&(a=!0,JXG.Options.grid.gridX=t.grid[0],JXG.Options.grid.gridY=t.grid[1]);let s=window.JXG.JSXGraph.initBoard(g,{boundingbox:d,axis:!1,showCopyright:!1,showNavigation:!1,zoom:{wheel:!t.fixAxes},pan:{enabled:!t.fixAxes},grid:a});return s.itemsRenderedLowQuality={},s.on("boundingbox",()=>{if(!S.current){let i=s.getBoundingBox(),[e,u,l,r]=i,h=Math.abs(l-e),x=Math.abs(u-r),T=i.map((z,V)=>Math.abs(z-v.current[V]));Math.max(T[0]/h,T[1]/x,T[2]/h,T[3]/x)>1e-12&&(v.current=i,P({action:L.changeAxisLimits,args:{xmin:e,xmax:l,ymin:r,ymax:u}}))}}),J(s),A.current={width:parseFloat(E(t.width)),aspectRatio:t.aspectRatio},t.displayXAxis&&j(s),t.displayYAxis&&M(s),C.current=!0,y.current=_,()=>{s.off("boundingbox")}},[]),f.useEffect(()=>{n&&_&&H()},[n]),t.haveGraphParent)return F(W,{children:[m("a",{name:g}),X]});const p={width:E(t.width),aspectRatio:String(t.aspectRatio),maxWidth:"100%"};let w={};if(t.hidden?p.display="none":t.displayMode==="inline"?w={display:"inline-block",verticalAlign:"middle"}:w={display:"flex",justifyContent:t.horizontalAlign},t.showBorder?p.border="2px solid var(--canvastext)":p.border="none",p.marginBottom="12px",p.marginTop="12px",p.backgroundColor="var(--canvas)",p.color="var(--canvastext)",!n)return m(D,{partialVisibility:!0,onChange:B,children:F("div",{style:w,children:[m("a",{name:g}),m("div",{id:g,className:"jxgbox",style:p})]})});if(C.current)C.current=!1;else{Array.isArray(t.grid)?((JXG.Options.grid.gridX!==t.grid[0]||JXG.Options.grid.gridY!==t.grid[1])&&(JXG.Options.grid.gridX=t.grid[0],JXG.Options.grid.gridY=t.grid[1],n.grids.length>0&&(n.removeObject(n.grids[0]),n.grids=[])),n.grids.length===0&&n.create("grid",[],{gridX:t.grid[0],gridY:t.grid[1]})):n.grids.length>0&&(n.removeObject(n.grids[0]),n.grids=[]),t.grid==="dense"?(o.current&&(o.current.defaultTicks.setAttribute({majorHeight:-1}),o.current.defaultTicks.setAttribute({minorHeight:-1})),c.current&&(c.current.defaultTicks.setAttribute({majorHeight:-1}),c.current.defaultTicks.setAttribute({minorHeight:-1}))):t.grid==="medium"?(o.current&&(o.current.defaultTicks.setAttribute({majorHeight:-1}),o.current.defaultTicks.setAttribute({minorHeight:10})),c.current&&(c.current.defaultTicks.setAttribute({majorHeight:-1}),c.current.defaultTicks.setAttribute({minorHeight:10}))):(o.current&&(o.current.defaultTicks.setAttribute({majorHeight:20}),o.current.defaultTicks.setAttribute({minorHeight:10})),c.current&&(c.current.defaultTicks.setAttribute({majorHeight:20}),c.current.defaultTicks.setAttribute({minorHeight:10})));let d=t.displayXAxis?!o.current:!!o.current,a=t.displayYAxis?!c.current:!!c.current;if(a&&!d&&t.displayXAxis&&(n.removeObject(o.current),o.current=null),d&&!a&&t.displayYAxis&&(n.removeObject(c.current),c.current=null),t.displayXAxis)if(o.current){let e=!!t.xlabel;if(e!==O.current&&(o.current.setAttribute({withlabel:e}),O.current=e),o.current.name=t.xlabel,o.current.defaultTicks.setAttribute({drawLabels:t.displayXAxisTickLabels}),o.current.hasLabel){let u="rt",l=[5,10],r="right";t.xlabelPosition==="left"&&(u="lft",r="left",l=[-5,10]),o.current.label.visProp.position=u,o.current.label.visProp.anchorx=r,o.current.label.visProp.offset=l,o.current.label.needsUpdate=!0,o.current.label.fullUpdate()}}else j(n);else o.current&&(n.removeObject(o.current),o.current=null);if(t.displayYAxis)if(c.current){let e=!!t.ylabel;if(e!==R.current&&(c.current.setAttribute({withlabel:e}),R.current=e),c.current.name=t.ylabel,c.current.defaultTicks.setAttribute({drawLabels:t.displayYAxisTickLabels}),c.current.hasLabel){let u="rt",l=[-10,-5],r="right";t.ylabelPosition==="bottom"&&(u="lft",l[1]=5),t.ylabelAlignment==="right"&&(r="left",l[0]=10),c.current.label.visProp.position=u,c.current.label.visProp.offset=l,c.current.label.visProp.anchorx=r,c.current.label.needsUpdate=!0,c.current.label.fullUpdate()}}else M(n);else c.current&&(n.removeObject(c.current),c.current=null);_?y.current||(H(),y.current=!0):y.current&&(U(),y.current=!1);let s={width:parseFloat(E(t.width)),aspectRatio:t.aspectRatio};(s.width!==A.current.width||s.aspectRatio!==A.current.aspectRatio)&&Number.isFinite(s.width)&&Number.isFinite(s.aspectRatio)&&(A.current=s);let i=[t.xmin,t.ymax,t.xmax,t.ymin];i.some((e,u)=>e!==v.current[u])&&(S.current=!0,n.setBoundingBox(i),S.current=!1,n.fullUpdate(),n.updateQuality===n.BOARD_QUALITY_LOW&&(n.itemsRenderedLowQuality[g]=n),v.current=i)}return m(D,{partialVisibility:!0,onChange:B,children:F("div",{style:w,children:[m("a",{name:g}),m("div",{id:g,className:"jxgbox",style:p}),m(K.Provider,{value:n,children:X})]})});function M(d){let a={highlight:!1,fixed:!0};if(t.ylabel){let s="rt",i=[-10,-5],e="right";t.ylabelPosition==="bottom"&&(s="lft",i[1]=5),t.ylabelAlignment==="right"&&(e="left",i[0]=10),a.name=t.ylabel,a.withLabel=!0,a.label={position:s,offset:i,anchorx:e,strokeColor:"var(--canvastext)",highlight:!1},t.ylabelHasLatex&&(a.label.useMathJax=!0)}if(R.current=!!t.ylabel,a.strokeColor="var(--canvastext)",a.highlight=!1,a.ticks={ticksDistance:2,label:{offset:[12,-2],layer:2,strokeColor:"var(--canvastext)",highlightStrokeColor:"var(--canvastext)",highlightStrokeOpacity:1},strokeColor:"var(--canvastext)",strokeOpacity:.5,precision:4,drawLabels:t.displayYAxisTickLabels},t.yTickScaleFactor!==null){let s=Y.fromAst(t.yTickScaleFactor),i=s.evaluate_to_constant();if(i>0){let e=s.toString();a.ticks.scale=i,a.ticks.scaleSymbol=e}}t.grid==="dense"?(a.ticks.majorHeight=-1,a.ticks.minorHeight=-1):t.grid==="medium"?(a.ticks.majorHeight=-1,a.ticks.minorHeight=10):(a.ticks.majorHeight=20,a.ticks.minorHeight=10),t.displayXAxis||(a.ticks.drawZero=!0),d.suspendUpdate(),c.current=d.create("axis",[[0,0],[0,1]],a),c.current.defaultTicks.ticksFunction=function(){var s,i,e;return i=this.getLowerAndUpperBounds(this.getZeroCoordinates(),"ticksdistance"),e=i.upper-i.lower,s=Math.pow(10,Math.floor(Math.log(.2*e)/Math.LN10)),e<=6*s&&(s*=.5),s},c.current.defaultTicks.generateEquidistantTicks=function(s,i){var e,u=1e-6,l,r=this.equidistant?this.ticksFunction(1):this.ticksDelta,h=4;if(this.visProp.minorticks=4,l=this.getXandYdeltas(),r*=this.visProp.scale,this.minTicksDistance>1e-6){r=this.adjustTickDistance(r,s,l);let x=10**Math.floor(Math.log10(r))*this.visProp.scale;Math.abs(r/x-2)<1e-14&&(h=3,this.visProp.minorticks=3),r/=h+1}if(this.ticksDelta=r,!(r<1e-6)){for(e=0,this.visProp.drawzero||(e=r);e<=i.upper+u&&(e>=i.lower-u&&this.processTickPosition(s,e,r,l),e+=r,!(i.upper-e>r*1e4)););for(e=-r;e>=i.lower-u&&(e<=i.upper+u&&this.processTickPosition(s,e,r,l),e-=r,!(e-i.lower>r*1e4)););}},d.unsuspendUpdate()}function j(d){let a={highlight:!1,fixed:!0};if(t.xlabel){let s="rt",i=[5,10],e="right";t.xlabelPosition==="left"&&(s="lft",e="left",i=[-5,10]),a.name=t.xlabel,a.withLabel=!0,a.label={position:s,offset:i,anchorx:e,strokeColor:"var(--canvastext)",highlight:!1},t.xlabelHasLatex&&(a.label.useMathJax=!0)}if(O.current=!!t.xlabel,a.ticks={ticksDistance:2,label:{offset:[-5,-15],layer:2,strokeColor:"var(--canvastext)",highlightStrokeColor:"var(--canvastext)",highlightStrokeOpacity:1},strokeColor:"var(--canvastext)",strokeOpacity:.5,precision:4,drawLabels:t.displayXAxisTickLabels},t.xTickScaleFactor!==null){let s=Y.fromAst(t.xTickScaleFactor),i=s.evaluate_to_constant();if(i>0){let e=s.toString();a.ticks.scale=i,a.ticks.scaleSymbol=e}}a.strokeColor="var(--canvastext)",a.highlight=!1,t.grid==="dense"?(a.ticks.majorHeight=-1,a.ticks.minorHeight=-1):t.grid==="medium"?(a.ticks.majorHeight=-1,a.ticks.minorHeight=10):(a.ticks.majorHeight=20,a.ticks.minorHeight=10),t.displayYAxis||(a.ticks.drawZero=!0),d.suspendUpdate(),o.current=d.create("axis",[[0,0],[1,0]],a),o.current.defaultTicks.ticksFunction=function(){var s,i,e;return i=this.getLowerAndUpperBounds(this.getZeroCoordinates(),"ticksdistance"),e=i.upper-i.lower,s=Math.pow(10,Math.floor(Math.log(.2*e)/Math.LN10)),e<=6*s&&(s*=.5),s},o.current.defaultTicks.generateEquidistantTicks=function(s,i){this.minTicksDistance=2*Math.max(2.5,Math.log10(Math.abs(i.lower)),Math.log10(Math.abs(i.upper)));var e,u=1e-6,l,r=this.equidistant?this.ticksFunction(1):this.ticksDelta,h=4;if(this.visProp.minorticks=4,l=this.getXandYdeltas(),r*=this.visProp.scale,this.minTicksDistance>1e-6){r=this.adjustTickDistance(r,s,l);let x=10**Math.floor(Math.log10(r))*this.visProp.scale;Math.abs(r/x-2)<1e-14&&(h=3,this.visProp.minorticks=3),r/=h+1}if(this.ticksDelta=r,!(r<1e-6)){for(e=0,this.visProp.drawzero||(e=r);e<=i.upper+u&&(e>=i.lower-u&&this.processTickPosition(s,e,r,l),e+=r,!(i.upper-e>r*1e4)););for(e=-r;e>=i.lower-u&&(e<=i.upper+u&&this.processTickPosition(s,e,r,l),e-=r,!(e-i.lower>r*1e4)););}},d.unsuspendUpdate()}function H(){let d=document.querySelector("#"+G(g)+"_navigationbar"),a=function(e,u,l){var r=function(){return l.apply(n,arguments)};n["x_internal"+u]=n["x_internal"+u]||[],n["x_internal"+u].push(r),e.addEventListener(u,r,!1)},s=function(e){e||(e=window.event),e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},i=function(e,u){var l;l=document.createElement("span"),d.appendChild(l);let r=document.createElement("span");r.setAttribute("style","color: var(--canvastext); opacity: 0.7");let h=document.createTextNode(e);l.appendChild(r),r.appendChild(h),l.style.paddingLeft="7px",l.style.paddingRight="7px",l.classList!==void 0&&l.classList.add("JXG_navigation_button"),a(l,"click",function(x){return u.bind(n)(),!1}),a(l,"mouseup",s),a(l,"mousedown",s),a(l,"touchend",s),a(l,"touchstart",s)};n.attr.showzoom&&(i("–",n.zoomOut),i("o",n.zoom100),i("+",n.zoomIn)),i("←",n.clickLeftArrow),i("↓",n.clickUpArrow),i("↑",n.clickDownArrow),i("→",n.clickRightArrow)}function U(){for(let d=7;d>=1;d--)document.querySelector("#"+G(g)+"_navigationbar > :first-child").remove();n.internalclick=[],n.internalmousedown=[],n.internalmouseup=[],n.internaltouchend=[],n.internaltouchstart=[]}});let k=0;const rt=k++,at=k++,st=k++,nt=k++,lt=k++,ot=k++,ct=k++;export{rt as BASE_LAYER_OFFSET,K as BoardContext,lt as CONTROL_POINT_LAYER_OFFSET,at as IMAGE_LAYER_OFFSET,st as LINE_LAYER_OFFSET,ot as POINT_LAYER_OFFSET,ct as TEXT_LAYER_OFFSET,nt as VERTEX_LAYER_OFFSET,it as default}; +import{av as I,bn as q,r as f,a as F,F as W,j as m,bo as Y,ad as Q}from"./index-9d63439d.js";import{s as E}from"./css-14ccef8c.js";import{V as D}from"./visibility-sensor-aefdbbd5.js";function G(b){return b=Q(b,{isIdentifier:!0}),b.slice(0,2)==="\\#"&&(b=b.slice(1)),b}const K=f.createContext(),it=I.memo(function(N){let{name:Z,id:g,SVs:t,children:X,actions:L,callAction:P}=q(N);const[n,J]=f.useState(null),A=f.useRef(null),v=f.useRef(null),o=f.useRef(null),c=f.useRef(null),S=f.useRef(!1),C=f.useRef(!1),y=f.useRef(!1);let O=f.useRef(null),R=f.useRef(null),_=t.showNavigation&&!t.fixAxes,B=d=>{P({action:L.recordVisibilityChange,args:{isVisible:d}})};if(f.useEffect(()=>{if(!t.haveGraphParent)return()=>{P({action:L.recordVisibilityChange,args:{isVisible:!1}})}},[]),f.useEffect(()=>{if(t.haveGraphParent)return;let d=[t.xmin,t.ymax,t.xmax,t.ymin];v.current=d,JXG.Options.layer.numlayers=100,JXG.Options.navbar.highlightFillColor="var(--canvastext)",JXG.Options.navbar.strokeColor="var(--canvastext)";let a=!1;Array.isArray(t.grid)&&(a=!0,JXG.Options.grid.gridX=t.grid[0],JXG.Options.grid.gridY=t.grid[1]);let s=window.JXG.JSXGraph.initBoard(g,{boundingbox:d,axis:!1,showCopyright:!1,showNavigation:!1,zoom:{wheel:!t.fixAxes},pan:{enabled:!t.fixAxes},grid:a});return s.itemsRenderedLowQuality={},s.on("boundingbox",()=>{if(!S.current){let i=s.getBoundingBox(),[e,u,l,r]=i,h=Math.abs(l-e),x=Math.abs(u-r),T=i.map((z,V)=>Math.abs(z-v.current[V]));Math.max(T[0]/h,T[1]/x,T[2]/h,T[3]/x)>1e-12&&(v.current=i,P({action:L.changeAxisLimits,args:{xmin:e,xmax:l,ymin:r,ymax:u}}))}}),J(s),A.current={width:parseFloat(E(t.width)),aspectRatio:t.aspectRatio},t.displayXAxis&&j(s),t.displayYAxis&&M(s),C.current=!0,y.current=_,()=>{s.off("boundingbox")}},[]),f.useEffect(()=>{n&&_&&H()},[n]),t.haveGraphParent)return F(W,{children:[m("a",{name:g}),X]});const p={width:E(t.width),aspectRatio:String(t.aspectRatio),maxWidth:"100%"};let w={};if(t.hidden?p.display="none":t.displayMode==="inline"?w={display:"inline-block",verticalAlign:"middle"}:w={display:"flex",justifyContent:t.horizontalAlign},t.showBorder?p.border="2px solid var(--canvastext)":p.border="none",p.marginBottom="12px",p.marginTop="12px",p.backgroundColor="var(--canvas)",p.color="var(--canvastext)",!n)return m(D,{partialVisibility:!0,onChange:B,children:F("div",{style:w,children:[m("a",{name:g}),m("div",{id:g,className:"jxgbox",style:p})]})});if(C.current)C.current=!1;else{Array.isArray(t.grid)?((JXG.Options.grid.gridX!==t.grid[0]||JXG.Options.grid.gridY!==t.grid[1])&&(JXG.Options.grid.gridX=t.grid[0],JXG.Options.grid.gridY=t.grid[1],n.grids.length>0&&(n.removeObject(n.grids[0]),n.grids=[])),n.grids.length===0&&n.create("grid",[],{gridX:t.grid[0],gridY:t.grid[1]})):n.grids.length>0&&(n.removeObject(n.grids[0]),n.grids=[]),t.grid==="dense"?(o.current&&(o.current.defaultTicks.setAttribute({majorHeight:-1}),o.current.defaultTicks.setAttribute({minorHeight:-1})),c.current&&(c.current.defaultTicks.setAttribute({majorHeight:-1}),c.current.defaultTicks.setAttribute({minorHeight:-1}))):t.grid==="medium"?(o.current&&(o.current.defaultTicks.setAttribute({majorHeight:-1}),o.current.defaultTicks.setAttribute({minorHeight:10})),c.current&&(c.current.defaultTicks.setAttribute({majorHeight:-1}),c.current.defaultTicks.setAttribute({minorHeight:10}))):(o.current&&(o.current.defaultTicks.setAttribute({majorHeight:20}),o.current.defaultTicks.setAttribute({minorHeight:10})),c.current&&(c.current.defaultTicks.setAttribute({majorHeight:20}),c.current.defaultTicks.setAttribute({minorHeight:10})));let d=t.displayXAxis?!o.current:!!o.current,a=t.displayYAxis?!c.current:!!c.current;if(a&&!d&&t.displayXAxis&&(n.removeObject(o.current),o.current=null),d&&!a&&t.displayYAxis&&(n.removeObject(c.current),c.current=null),t.displayXAxis)if(o.current){let e=!!t.xlabel;if(e!==O.current&&(o.current.setAttribute({withlabel:e}),O.current=e),o.current.name=t.xlabel,o.current.defaultTicks.setAttribute({drawLabels:t.displayXAxisTickLabels}),o.current.hasLabel){let u="rt",l=[5,10],r="right";t.xlabelPosition==="left"&&(u="lft",r="left",l=[-5,10]),o.current.label.visProp.position=u,o.current.label.visProp.anchorx=r,o.current.label.visProp.offset=l,o.current.label.needsUpdate=!0,o.current.label.fullUpdate()}}else j(n);else o.current&&(n.removeObject(o.current),o.current=null);if(t.displayYAxis)if(c.current){let e=!!t.ylabel;if(e!==R.current&&(c.current.setAttribute({withlabel:e}),R.current=e),c.current.name=t.ylabel,c.current.defaultTicks.setAttribute({drawLabels:t.displayYAxisTickLabels}),c.current.hasLabel){let u="rt",l=[-10,-5],r="right";t.ylabelPosition==="bottom"&&(u="lft",l[1]=5),t.ylabelAlignment==="right"&&(r="left",l[0]=10),c.current.label.visProp.position=u,c.current.label.visProp.offset=l,c.current.label.visProp.anchorx=r,c.current.label.needsUpdate=!0,c.current.label.fullUpdate()}}else M(n);else c.current&&(n.removeObject(c.current),c.current=null);_?y.current||(H(),y.current=!0):y.current&&(U(),y.current=!1);let s={width:parseFloat(E(t.width)),aspectRatio:t.aspectRatio};(s.width!==A.current.width||s.aspectRatio!==A.current.aspectRatio)&&Number.isFinite(s.width)&&Number.isFinite(s.aspectRatio)&&(A.current=s);let i=[t.xmin,t.ymax,t.xmax,t.ymin];i.some((e,u)=>e!==v.current[u])&&(S.current=!0,n.setBoundingBox(i),S.current=!1,n.fullUpdate(),n.updateQuality===n.BOARD_QUALITY_LOW&&(n.itemsRenderedLowQuality[g]=n),v.current=i)}return m(D,{partialVisibility:!0,onChange:B,children:F("div",{style:w,children:[m("a",{name:g}),m("div",{id:g,className:"jxgbox",style:p}),m(K.Provider,{value:n,children:X})]})});function M(d){let a={highlight:!1,fixed:!0};if(t.ylabel){let s="rt",i=[-10,-5],e="right";t.ylabelPosition==="bottom"&&(s="lft",i[1]=5),t.ylabelAlignment==="right"&&(e="left",i[0]=10),a.name=t.ylabel,a.withLabel=!0,a.label={position:s,offset:i,anchorx:e,strokeColor:"var(--canvastext)",highlight:!1},t.ylabelHasLatex&&(a.label.useMathJax=!0)}if(R.current=!!t.ylabel,a.strokeColor="var(--canvastext)",a.highlight=!1,a.ticks={ticksDistance:2,label:{offset:[12,-2],layer:2,strokeColor:"var(--canvastext)",highlightStrokeColor:"var(--canvastext)",highlightStrokeOpacity:1},strokeColor:"var(--canvastext)",strokeOpacity:.5,precision:4,drawLabels:t.displayYAxisTickLabels},t.yTickScaleFactor!==null){let s=Y.fromAst(t.yTickScaleFactor),i=s.evaluate_to_constant();if(i>0){let e=s.toString();a.ticks.scale=i,a.ticks.scaleSymbol=e}}t.grid==="dense"?(a.ticks.majorHeight=-1,a.ticks.minorHeight=-1):t.grid==="medium"?(a.ticks.majorHeight=-1,a.ticks.minorHeight=10):(a.ticks.majorHeight=20,a.ticks.minorHeight=10),t.displayXAxis||(a.ticks.drawZero=!0),d.suspendUpdate(),c.current=d.create("axis",[[0,0],[0,1]],a),c.current.defaultTicks.ticksFunction=function(){var s,i,e;return i=this.getLowerAndUpperBounds(this.getZeroCoordinates(),"ticksdistance"),e=i.upper-i.lower,s=Math.pow(10,Math.floor(Math.log(.2*e)/Math.LN10)),e<=6*s&&(s*=.5),s},c.current.defaultTicks.generateEquidistantTicks=function(s,i){var e,u=1e-6,l,r=this.equidistant?this.ticksFunction(1):this.ticksDelta,h=4;if(this.visProp.minorticks=4,l=this.getXandYdeltas(),r*=this.visProp.scale,this.minTicksDistance>1e-6){r=this.adjustTickDistance(r,s,l);let x=10**Math.floor(Math.log10(r))*this.visProp.scale;Math.abs(r/x-2)<1e-14&&(h=3,this.visProp.minorticks=3),r/=h+1}if(this.ticksDelta=r,!(r<1e-6)){for(e=0,this.visProp.drawzero||(e=r);e<=i.upper+u&&(e>=i.lower-u&&this.processTickPosition(s,e,r,l),e+=r,!(i.upper-e>r*1e4)););for(e=-r;e>=i.lower-u&&(e<=i.upper+u&&this.processTickPosition(s,e,r,l),e-=r,!(e-i.lower>r*1e4)););}},d.unsuspendUpdate()}function j(d){let a={highlight:!1,fixed:!0};if(t.xlabel){let s="rt",i=[5,10],e="right";t.xlabelPosition==="left"&&(s="lft",e="left",i=[-5,10]),a.name=t.xlabel,a.withLabel=!0,a.label={position:s,offset:i,anchorx:e,strokeColor:"var(--canvastext)",highlight:!1},t.xlabelHasLatex&&(a.label.useMathJax=!0)}if(O.current=!!t.xlabel,a.ticks={ticksDistance:2,label:{offset:[-5,-15],layer:2,strokeColor:"var(--canvastext)",highlightStrokeColor:"var(--canvastext)",highlightStrokeOpacity:1},strokeColor:"var(--canvastext)",strokeOpacity:.5,precision:4,drawLabels:t.displayXAxisTickLabels},t.xTickScaleFactor!==null){let s=Y.fromAst(t.xTickScaleFactor),i=s.evaluate_to_constant();if(i>0){let e=s.toString();a.ticks.scale=i,a.ticks.scaleSymbol=e}}a.strokeColor="var(--canvastext)",a.highlight=!1,t.grid==="dense"?(a.ticks.majorHeight=-1,a.ticks.minorHeight=-1):t.grid==="medium"?(a.ticks.majorHeight=-1,a.ticks.minorHeight=10):(a.ticks.majorHeight=20,a.ticks.minorHeight=10),t.displayYAxis||(a.ticks.drawZero=!0),d.suspendUpdate(),o.current=d.create("axis",[[0,0],[1,0]],a),o.current.defaultTicks.ticksFunction=function(){var s,i,e;return i=this.getLowerAndUpperBounds(this.getZeroCoordinates(),"ticksdistance"),e=i.upper-i.lower,s=Math.pow(10,Math.floor(Math.log(.2*e)/Math.LN10)),e<=6*s&&(s*=.5),s},o.current.defaultTicks.generateEquidistantTicks=function(s,i){this.minTicksDistance=2*Math.max(2.5,Math.log10(Math.abs(i.lower)),Math.log10(Math.abs(i.upper)));var e,u=1e-6,l,r=this.equidistant?this.ticksFunction(1):this.ticksDelta,h=4;if(this.visProp.minorticks=4,l=this.getXandYdeltas(),r*=this.visProp.scale,this.minTicksDistance>1e-6){r=this.adjustTickDistance(r,s,l);let x=10**Math.floor(Math.log10(r))*this.visProp.scale;Math.abs(r/x-2)<1e-14&&(h=3,this.visProp.minorticks=3),r/=h+1}if(this.ticksDelta=r,!(r<1e-6)){for(e=0,this.visProp.drawzero||(e=r);e<=i.upper+u&&(e>=i.lower-u&&this.processTickPosition(s,e,r,l),e+=r,!(i.upper-e>r*1e4)););for(e=-r;e>=i.lower-u&&(e<=i.upper+u&&this.processTickPosition(s,e,r,l),e-=r,!(e-i.lower>r*1e4)););}},d.unsuspendUpdate()}function H(){let d=document.querySelector("#"+G(g)+"_navigationbar"),a=function(e,u,l){var r=function(){return l.apply(n,arguments)};n["x_internal"+u]=n["x_internal"+u]||[],n["x_internal"+u].push(r),e.addEventListener(u,r,!1)},s=function(e){e||(e=window.event),e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},i=function(e,u){var l;l=document.createElement("span"),d.appendChild(l);let r=document.createElement("span");r.setAttribute("style","color: var(--canvastext); opacity: 0.7");let h=document.createTextNode(e);l.appendChild(r),r.appendChild(h),l.style.paddingLeft="7px",l.style.paddingRight="7px",l.classList!==void 0&&l.classList.add("JXG_navigation_button"),a(l,"click",function(x){return u.bind(n)(),!1}),a(l,"mouseup",s),a(l,"mousedown",s),a(l,"touchend",s),a(l,"touchstart",s)};n.attr.showzoom&&(i("–",n.zoomOut),i("o",n.zoom100),i("+",n.zoomIn)),i("←",n.clickLeftArrow),i("↓",n.clickUpArrow),i("↑",n.clickDownArrow),i("→",n.clickRightArrow)}function U(){for(let d=7;d>=1;d--)document.querySelector("#"+G(g)+"_navigationbar > :first-child").remove();n.internalclick=[],n.internalmousedown=[],n.internalmouseup=[],n.internaltouchend=[],n.internaltouchstart=[]}});let k=0;const rt=k++,at=k++,st=k++,nt=k++,lt=k++,ot=k++,ct=k++;export{rt as BASE_LAYER_OFFSET,K as BoardContext,lt as CONTROL_POINT_LAYER_OFFSET,at as IMAGE_LAYER_OFFSET,st as LINE_LAYER_OFFSET,ot as POINT_LAYER_OFFSET,ct as TEXT_LAYER_OFFSET,nt as VERTEX_LAYER_OFFSET,it as default}; diff --git a/dist/assets/hint-5302af12.js b/dist/assets/hint-b4ad3e8b.js similarity index 92% rename from dist/assets/hint-5302af12.js rename to dist/assets/hint-b4ad3e8b.js index 181e42da67..8109276554 100644 --- a/dist/assets/hint-5302af12.js +++ b/dist/assets/hint-b4ad3e8b.js @@ -1,4 +1,4 @@ -import{av as k,bn as C,r as R,j as n,a as m,s as V,i as h,bu as v}from"./index-61b6fc23.js";import{b as H}from"./index-47ca4f11.js";import{V as B}from"./visibility-sensor-398e690f.js";const L=V.span` +import{av as k,bn as C,r as R,j as n,a as m,s as V,i as h,bu as v}from"./index-9d63439d.js";import{b as H}from"./index-47ca4f11.js";import{V as B}from"./visibility-sensor-aefdbbd5.js";const L=V.span` &: focus { outline: 2px solid var(--canvastext); outline-offset: 2px; diff --git a/dist/assets/image-8c34613a.js b/dist/assets/image-b7690ea0.js similarity index 96% rename from dist/assets/image-8c34613a.js rename to dist/assets/image-b7690ea0.js index b44dc426eb..73d7c502d8 100644 --- a/dist/assets/image-8c34613a.js +++ b/dist/assets/image-b7690ea0.js @@ -1 +1 @@ -import{k as te,bv as k,av as re,bn as ie,r as o,bo as T,j as w,a as ne}from"./index-61b6fc23.js";import{BoardContext as oe,IMAGE_LAYER_OFFSET as $}from"./graph-1ff63df5.js";import{s as ae}from"./css-14ccef8c.js";import{V as se}from"./visibility-sensor-398e690f.js";async function le(n,m){try{return await ce(n)}catch{}if(!m){let{data:b}=await te.get("/api/getMimeType.php",{params:{cid:n}});m=b["mime-type"]}return ue(n,m)}async function ce(n){let m=new AbortController,b=m.signal,p=setTimeout(()=>{m.abort()},1e3);try{let e=await fetch(`https://${n}.ipfs.dweb.link/`,{signal:b});if(clearTimeout(p),e.ok){let h=await e.blob();if(await k(await h.arrayBuffer())===n){let S=URL.createObjectURL(h);return{mediaBlob:h,mediaURL:S}}else return Promise.reject(new Error("cid mismatch"))}else return Promise.reject(new Error(`cid not found: ${n}`))}catch{return Promise.reject(new Error(`cid not found: ${n}`))}}async function ue(n,m){try{let b=fe(m),p=await fetch(`/media/${n}.${b}`);if(p.ok){let e=await p.blob();if(await k(await e.arrayBuffer())===n){let R=URL.createObjectURL(e);return{mediaBlob:e,mediaURL:R}}else return Promise.reject(new Error("cid mismatch"))}else return Promise.reject(new Error(`cid not found: ${n}`))}catch{return Promise.reject(new Error(`cid not found: ${n}`))}}function fe(n){return n==="image/png"?"png":n==="image/jpeg"?"jpg":n==="text/csv"?"csv":"txt"}const ge=re.memo(function(m){var D;let{name:b,id:p,SVs:e,actions:h,callAction:R}=ie(m,!1),[S,W]=o.useState(null),i=o.useRef(null),_=o.useRef(null);const c=o.useContext(oe);let A=o.useRef(!1),U=o.useRef(!1),j=o.useRef(!1),C=o.useRef(null),F=o.useRef(null),Y=o.useRef(null),B=o.useRef(null),x=o.useRef(null),v=o.useRef(null),V=o.useRef(null),M=o.useRef(e.rotate);const P=(e.cid?S:e.source)||"";let H=s=>{R({action:h.recordVisibilityChange,args:{isVisible:s}})};o.useEffect(()=>()=>{R({action:h.recordVisibilityChange,args:{isVisible:!1}})},[]),o.useEffect(()=>{e.cid&&le(e.cid,e.mimeType).then(s=>{W(s.mediaURL)}).catch(s=>{})},[]);function q(){var z;let s=!e.draggable||e.fixed,l={visible:!e.hidden,fixed:s,layer:10*e.layer+$,highlight:!s},g;try{let d=T.fromAst(e.anchor),y=[d.get_component(0).evaluate_to_constant(),d.get_component(1).evaluate_to_constant()];Number.isFinite(y[0])||(y[0]=0,l.visible=!1),Number.isFinite(y[1])||(y[1]=0,l.visible=!1),g=c.create("point",y,{visible:!1})}catch{l.visible=!1,g=c.create("point",[0,0],{visible:!1})}l.anchor=g;let f=((z=e.widthForGraph)==null?void 0:z.size)||1,u=f/(e.aspectRatio||1);Number.isFinite(f)&&Number.isFinite(u)||(f=0,u=0);let r;e.positionFromAnchor==="center"?r=[-f/2,-u/2]:e.positionFromAnchor==="lowerleft"?r=[-f,-u]:e.positionFromAnchor==="lowerright"?r=[0,-u]:e.positionFromAnchor==="upperleft"?r=[-f,0]:e.positionFromAnchor==="upperright"?r=[0,0]:e.positionFromAnchor==="bottom"?r=[-f/2,-u]:e.positionFromAnchor==="top"?r=[-f/2,0]:e.positionFromAnchor==="right"?r=[0,-u/2]:r=[-f,-u/2],v.current=r;let t=c.create("image",[P,r,[f,u]],l);var O=c.create("transform",[function(){return-t.X()-t.W()*.5},function(){return-t.Y()-t.H()*.5}],{type:"translate"}),a=c.create("transform",[function(){return t.X()+t.W()*.5},function(){return t.Y()+t.H()*.5}],{type:"translate"}),L=c.create("transform",[e.rotate],{type:"rotate"});O.bindTo(t),L.bindTo(t),a.bindTo(t),V.current=L,M.current=e.rotate,t.on("down",function(d){A.current=[d.x,d.y],U.current=[...g.coords.scrCoords],j.current=!1}),t.on("up",function(d){j.current&&R({action:h.moveImage,args:{x:C.current,y:F.current}}),j.current=!1}),t.on("drag",function(d){var y=c.origin.scrCoords;let[G,N,I,J]=c.getBoundingBox(),K=G+.01*(I-G)-v.current[0]-x.current[0],Q=I-.01*(I-G)-v.current[0],Z=J+.01*(N-J)-v.current[1]-x.current[1],ee=N-.01*(N-J)-v.current[1];C.current=(U.current[1]+d.x-A.current[0]-y[1])/c.unitX,C.current=Math.min(Q,Math.max(K,C.current)),F.current=(y[2]-(U.current[2]+d.y-A.current[1]))/c.unitY,F.current=Math.min(ee,Math.max(Z,F.current)),R({action:h.moveImage,args:{x:C.current,y:F.current,transient:!0,skippable:!0}}),t.relativeCoords.setCoordinates(JXG.COORDS_BY_USER,v.current),g.coords.setCoordinates(JXG.COORDS_BY_USER,Y.current),(Math.abs(d.x-A.current[0])>.1||Math.abs(d.y-A.current[1])>.1)&&(j.current=!0)}),i.current=t,_.current=g,B.current=e.positionFromAnchor,x.current=[f,u],i.current.fullUpdate()}if(c){let s;try{let l=T.fromAst(e.anchor);s=[l.get_component(0).evaluate_to_constant(),l.get_component(1).evaluate_to_constant()]}catch{s=[NaN,NaN]}if(Y.current=s,i.current===null){if(e.cid&&!S)return null;q()}else{_.current.coords.setCoordinates(JXG.COORDS_BY_USER,s);let l=!e.hidden;if(Number.isFinite(s[0])&&Number.isFinite(s[1])){let a=i.current.visProp.visible!==l;i.current.visProp.visible=l,i.current.visPropCalc.visible=l,a&&i.current.setAttribute({visible:l})}else i.current.visProp.visible=!1,i.current.visPropCalc.visible=!1;let g=10*e.layer+$;i.current.visProp.layer!==g&&i.current.setAttribute({layer:g});let u=!e.draggable||e.fixed;i.current.visProp.highlight=!u,i.current.visProp.fixed=u,i.current.needsUpdate=!0;let r=((D=e.widthForGraph)==null?void 0:D.size)||1,t=r/(e.aspectRatio||1);Number.isFinite(r)&&Number.isFinite(t)||(r=0,t=0);let O=r!==x.current[0]||t!==x.current[1];if(O&&(i.current.setSize(r,t),x.current=[r,t]),e.rotate!=M.current&&(V.current.setMatrix(c,"rotate",[e.rotate]),M.current=e.rotate),e.positionFromAnchor!==B.current||O){let a;e.positionFromAnchor==="center"?a=[-r/2,-t/2]:e.positionFromAnchor==="lowerleft"?a=[-r,-t]:e.positionFromAnchor==="lowerright"?a=[0,-t]:e.positionFromAnchor==="upperleft"?a=[-r,0]:e.positionFromAnchor==="upperright"?a=[0,0]:e.positionFromAnchor==="bottom"?a=[-r/2,-t]:e.positionFromAnchor==="top"?a=[-r/2,0]:e.positionFromAnchor==="right"?a=[0,-t/2]:a=[-r,-t/2],i.current.relativeCoords.setCoordinates(JXG.COORDS_BY_USER,a),B.current=e.positionFromAnchor,v.current=a,i.current.fullUpdate()}else i.current.relativeCoords.setCoordinates(JXG.COORDS_BY_USER,v.current),i.current.update();_.current.needsUpdate=!0,_.current.update(),c.updateRenderer()}return w("a",{name:p})}if(e.hidden)return null;let X={};e.displayMode==="inline"?X={display:"inline-block",verticalAlign:"middle",margin:"12px 0"}:X={display:"flex",justifyContent:e.horizontalAlign,margin:"12px 0"};let E={maxWidth:"100%",width:ae(e.width)};return e.aspectRatio>0&&(E.aspectRatio=String(e.aspectRatio)),P||(E.border="var(--mainBorder)"),w(se,{partialVisibility:!0,onChange:H,children:ne("div",{style:X,children:[w("a",{name:p}),P?w("img",{id:p,src:P,style:E,alt:e.description}):w("div",{id:p,style:E,children:e.description})]})})});export{ge as default}; +import{k as te,bv as k,av as re,bn as ie,r as o,bo as T,j as w,a as ne}from"./index-9d63439d.js";import{BoardContext as oe,IMAGE_LAYER_OFFSET as $}from"./graph-0c612329.js";import{s as ae}from"./css-14ccef8c.js";import{V as se}from"./visibility-sensor-aefdbbd5.js";async function le(n,m){try{return await ce(n)}catch{}if(!m){let{data:b}=await te.get("/api/getMimeType.php",{params:{cid:n}});m=b["mime-type"]}return ue(n,m)}async function ce(n){let m=new AbortController,b=m.signal,p=setTimeout(()=>{m.abort()},1e3);try{let e=await fetch(`https://${n}.ipfs.dweb.link/`,{signal:b});if(clearTimeout(p),e.ok){let h=await e.blob();if(await k(await h.arrayBuffer())===n){let S=URL.createObjectURL(h);return{mediaBlob:h,mediaURL:S}}else return Promise.reject(new Error("cid mismatch"))}else return Promise.reject(new Error(`cid not found: ${n}`))}catch{return Promise.reject(new Error(`cid not found: ${n}`))}}async function ue(n,m){try{let b=fe(m),p=await fetch(`/media/${n}.${b}`);if(p.ok){let e=await p.blob();if(await k(await e.arrayBuffer())===n){let R=URL.createObjectURL(e);return{mediaBlob:e,mediaURL:R}}else return Promise.reject(new Error("cid mismatch"))}else return Promise.reject(new Error(`cid not found: ${n}`))}catch{return Promise.reject(new Error(`cid not found: ${n}`))}}function fe(n){return n==="image/png"?"png":n==="image/jpeg"?"jpg":n==="text/csv"?"csv":"txt"}const ge=re.memo(function(m){var D;let{name:b,id:p,SVs:e,actions:h,callAction:R}=ie(m,!1),[S,W]=o.useState(null),i=o.useRef(null),_=o.useRef(null);const c=o.useContext(oe);let A=o.useRef(!1),U=o.useRef(!1),j=o.useRef(!1),C=o.useRef(null),F=o.useRef(null),Y=o.useRef(null),B=o.useRef(null),x=o.useRef(null),v=o.useRef(null),V=o.useRef(null),M=o.useRef(e.rotate);const P=(e.cid?S:e.source)||"";let H=s=>{R({action:h.recordVisibilityChange,args:{isVisible:s}})};o.useEffect(()=>()=>{R({action:h.recordVisibilityChange,args:{isVisible:!1}})},[]),o.useEffect(()=>{e.cid&&le(e.cid,e.mimeType).then(s=>{W(s.mediaURL)}).catch(s=>{})},[]);function q(){var z;let s=!e.draggable||e.fixed,l={visible:!e.hidden,fixed:s,layer:10*e.layer+$,highlight:!s},g;try{let d=T.fromAst(e.anchor),y=[d.get_component(0).evaluate_to_constant(),d.get_component(1).evaluate_to_constant()];Number.isFinite(y[0])||(y[0]=0,l.visible=!1),Number.isFinite(y[1])||(y[1]=0,l.visible=!1),g=c.create("point",y,{visible:!1})}catch{l.visible=!1,g=c.create("point",[0,0],{visible:!1})}l.anchor=g;let f=((z=e.widthForGraph)==null?void 0:z.size)||1,u=f/(e.aspectRatio||1);Number.isFinite(f)&&Number.isFinite(u)||(f=0,u=0);let r;e.positionFromAnchor==="center"?r=[-f/2,-u/2]:e.positionFromAnchor==="lowerleft"?r=[-f,-u]:e.positionFromAnchor==="lowerright"?r=[0,-u]:e.positionFromAnchor==="upperleft"?r=[-f,0]:e.positionFromAnchor==="upperright"?r=[0,0]:e.positionFromAnchor==="bottom"?r=[-f/2,-u]:e.positionFromAnchor==="top"?r=[-f/2,0]:e.positionFromAnchor==="right"?r=[0,-u/2]:r=[-f,-u/2],v.current=r;let t=c.create("image",[P,r,[f,u]],l);var O=c.create("transform",[function(){return-t.X()-t.W()*.5},function(){return-t.Y()-t.H()*.5}],{type:"translate"}),a=c.create("transform",[function(){return t.X()+t.W()*.5},function(){return t.Y()+t.H()*.5}],{type:"translate"}),L=c.create("transform",[e.rotate],{type:"rotate"});O.bindTo(t),L.bindTo(t),a.bindTo(t),V.current=L,M.current=e.rotate,t.on("down",function(d){A.current=[d.x,d.y],U.current=[...g.coords.scrCoords],j.current=!1}),t.on("up",function(d){j.current&&R({action:h.moveImage,args:{x:C.current,y:F.current}}),j.current=!1}),t.on("drag",function(d){var y=c.origin.scrCoords;let[G,N,I,J]=c.getBoundingBox(),K=G+.01*(I-G)-v.current[0]-x.current[0],Q=I-.01*(I-G)-v.current[0],Z=J+.01*(N-J)-v.current[1]-x.current[1],ee=N-.01*(N-J)-v.current[1];C.current=(U.current[1]+d.x-A.current[0]-y[1])/c.unitX,C.current=Math.min(Q,Math.max(K,C.current)),F.current=(y[2]-(U.current[2]+d.y-A.current[1]))/c.unitY,F.current=Math.min(ee,Math.max(Z,F.current)),R({action:h.moveImage,args:{x:C.current,y:F.current,transient:!0,skippable:!0}}),t.relativeCoords.setCoordinates(JXG.COORDS_BY_USER,v.current),g.coords.setCoordinates(JXG.COORDS_BY_USER,Y.current),(Math.abs(d.x-A.current[0])>.1||Math.abs(d.y-A.current[1])>.1)&&(j.current=!0)}),i.current=t,_.current=g,B.current=e.positionFromAnchor,x.current=[f,u],i.current.fullUpdate()}if(c){let s;try{let l=T.fromAst(e.anchor);s=[l.get_component(0).evaluate_to_constant(),l.get_component(1).evaluate_to_constant()]}catch{s=[NaN,NaN]}if(Y.current=s,i.current===null){if(e.cid&&!S)return null;q()}else{_.current.coords.setCoordinates(JXG.COORDS_BY_USER,s);let l=!e.hidden;if(Number.isFinite(s[0])&&Number.isFinite(s[1])){let a=i.current.visProp.visible!==l;i.current.visProp.visible=l,i.current.visPropCalc.visible=l,a&&i.current.setAttribute({visible:l})}else i.current.visProp.visible=!1,i.current.visPropCalc.visible=!1;let g=10*e.layer+$;i.current.visProp.layer!==g&&i.current.setAttribute({layer:g});let u=!e.draggable||e.fixed;i.current.visProp.highlight=!u,i.current.visProp.fixed=u,i.current.needsUpdate=!0;let r=((D=e.widthForGraph)==null?void 0:D.size)||1,t=r/(e.aspectRatio||1);Number.isFinite(r)&&Number.isFinite(t)||(r=0,t=0);let O=r!==x.current[0]||t!==x.current[1];if(O&&(i.current.setSize(r,t),x.current=[r,t]),e.rotate!=M.current&&(V.current.setMatrix(c,"rotate",[e.rotate]),M.current=e.rotate),e.positionFromAnchor!==B.current||O){let a;e.positionFromAnchor==="center"?a=[-r/2,-t/2]:e.positionFromAnchor==="lowerleft"?a=[-r,-t]:e.positionFromAnchor==="lowerright"?a=[0,-t]:e.positionFromAnchor==="upperleft"?a=[-r,0]:e.positionFromAnchor==="upperright"?a=[0,0]:e.positionFromAnchor==="bottom"?a=[-r/2,-t]:e.positionFromAnchor==="top"?a=[-r/2,0]:e.positionFromAnchor==="right"?a=[0,-t/2]:a=[-r,-t/2],i.current.relativeCoords.setCoordinates(JXG.COORDS_BY_USER,a),B.current=e.positionFromAnchor,v.current=a,i.current.fullUpdate()}else i.current.relativeCoords.setCoordinates(JXG.COORDS_BY_USER,v.current),i.current.update();_.current.needsUpdate=!0,_.current.update(),c.updateRenderer()}return w("a",{name:p})}if(e.hidden)return null;let X={};e.displayMode==="inline"?X={display:"inline-block",verticalAlign:"middle",margin:"12px 0"}:X={display:"flex",justifyContent:e.horizontalAlign,margin:"12px 0"};let E={maxWidth:"100%",width:ae(e.width)};return e.aspectRatio>0&&(E.aspectRatio=String(e.aspectRatio)),P||(E.border="var(--mainBorder)"),w(se,{partialVisibility:!0,onChange:H,children:ne("div",{style:X,children:[w("a",{name:p}),P?w("img",{id:p,src:P,style:E,alt:e.description}):w("div",{id:p,style:E,children:e.description})]})})});export{ge as default}; diff --git a/dist/assets/index-e425ea7e.js b/dist/assets/index-0a95af27.js similarity index 99% rename from dist/assets/index-e425ea7e.js rename to dist/assets/index-0a95af27.js index 559e764cc1..80a07aa613 100644 --- a/dist/assets/index-e425ea7e.js +++ b/dist/assets/index-0a95af27.js @@ -1,4 +1,4 @@ -import{aC as We}from"./index-61b6fc23.js";var ie=typeof We<"u"?We:typeof self<"u"?self:typeof window<"u"?window:{},k=[],M=[],Qt=typeof Uint8Array<"u"?Uint8Array:Array,Pe=!1;function at(){Pe=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,r=t.length;e0)throw new Error("Invalid string. Length must be a multiple of 4");o=t[f-2]==="="?2:t[f-1]==="="?1:0,s=new Qt(f*3/4-o),n=o>0?f-4:f;var u=0;for(e=0,r=0;e>16&255,s[u++]=i>>8&255,s[u++]=i&255;return o===2?(i=M[t.charCodeAt(e)]<<2|M[t.charCodeAt(e+1)]>>4,s[u++]=i&255):o===1&&(i=M[t.charCodeAt(e)]<<10|M[t.charCodeAt(e+1)]<<4|M[t.charCodeAt(e+2)]>>2,s[u++]=i>>8&255,s[u++]=i&255),s}function Gt(t){return k[t>>18&63]+k[t>>12&63]+k[t>>6&63]+k[t&63]}function Zt(t,e,r){for(var n,i=[],o=e;ou?u:f+s));return n===1?(e=t[r-1],i+=k[e>>2],i+=k[e<<4&63],i+="=="):n===2&&(e=(t[r-2]<<8)+t[r-1],i+=k[e>>10],i+=k[e>>4&63],i+=k[e<<2&63],i+="="),o.push(i),o.join("")}function ye(t,e,r,n,i){var o,s,f=i*8-n-1,u=(1<>1,h=-7,c=r?i-1:0,v=r?-1:1,b=t[e+c];for(c+=v,o=b&(1<<-h)-1,b>>=-h,h+=f;h>0;o=o*256+t[e+c],c+=v,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=s*256+t[e+c],c+=v,h-=8);if(o===0)o=1-l;else{if(o===u)return s?NaN:(b?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-l}return(b?-1:1)*s*Math.pow(2,o-n)}function ut(t,e,r,n,i,o){var s,f,u,l=o*8-i-1,h=(1<>1,v=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,b=n?0:o-1,O=n?1:-1,x=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+c>=1?e+=v/u:e+=v*Math.pow(2,1-c),e*u>=2&&(s++,u/=2),s+c>=h?(f=0,s=h):s+c>=1?(f=(e*u-1)*Math.pow(2,i),s=s+c):(f=e*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;t[r+b]=f&255,b+=O,f/=256,i-=8);for(s=s<0;t[r+b]=s&255,b+=O,s/=256,l-=8);t[r+b-O]|=x*128}var Xt={}.toString,lt=Array.isArray||function(t){return Xt.call(t)=="[object Array]"},Kt=50;a.TYPED_ARRAY_SUPPORT=ie.TYPED_ARRAY_SUPPORT!==void 0?ie.TYPED_ARRAY_SUPPORT:!0;me();function me(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function j(t,e){if(me()=me())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+me().toString(16)+" bytes");return t|0}a.isBuffer=T;function P(t){return!!(t!=null&&t._isBuffer)}a.compare=function(e,r){if(!P(e)||!P(r))throw new TypeError("Arguments must be Buffers");if(e===r)return 0;for(var n=e.length,i=r.length,o=0,s=Math.min(n,i);o>>1;case"base64":return vt(t).length;default:if(n)return _e(t).length;e=(""+e).toLowerCase(),n=!0}}a.byteLength=dt;function ir(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return pr(this,e,r);case"utf8":case"utf-8":return mt(this,e,r);case"ascii":return cr(this,e,r);case"latin1":case"binary":return dr(this,e,r);case"base64":return lr(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return gr(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}a.prototype._isBuffer=!0;function Z(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}a.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""};a.prototype.compare=function(e,r,n,i,o){if(!P(e))throw new TypeError("Argument must be a Buffer");if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;for(var s=o-i,f=n-r,u=Math.min(s,f),l=this.slice(i,o),h=e.slice(r,n),c=0;c2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=a.from(e,n)),P(e))return e.length===0?-1:He(t,e,r,n,i);if(typeof e=="number")return e=e&255,a.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):He(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function He(t,e,r,n,i){var o=1,s=t.length,f=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;o=2,s/=2,f/=2,r/=2}function u(b,O){return o===1?b[O]:b.readUInt16BE(O*o)}var l;if(i){var h=-1;for(l=r;ls&&(r=s-f),l=r;l>=0;l--){for(var c=!0,v=0;vi&&(n=i)):n=i;var o=e.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;so)&&(n=o),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return or(this,e,r,n);case"utf8":case"utf-8":return sr(this,e,r,n);case"ascii":return gt(this,e,r,n);case"latin1":case"binary":return fr(this,e,r,n);case"base64":return ar(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ur(this,e,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function lr(t,e,r){return e===0&&r===t.length?Qe(t):Qe(t.slice(e,r))}function mt(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:o>223?3:o>191?2:1;if(i+f<=r){var u,l,h,c;switch(f){case 1:o<128&&(s=o);break;case 2:u=t[i+1],(u&192)===128&&(c=(o&31)<<6|u&63,c>127&&(s=c));break;case 3:u=t[i+1],l=t[i+2],(u&192)===128&&(l&192)===128&&(c=(o&15)<<12|(u&63)<<6|l&63,c>2047&&(c<55296||c>57343)&&(s=c));break;case 4:u=t[i+1],l=t[i+2],h=t[i+3],(u&192)===128&&(l&192)===128&&(h&192)===128&&(c=(o&15)<<18|(u&63)<<12|(l&63)<<6|h&63,c>65535&&c<1114112&&(s=c))}}s===null?(s=65533,f=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),i+=f}return hr(n)}var Ge=4096;function hr(t){var e=t.length;if(e<=Ge)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",o=e;on&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUIntLE=function(e,r,n){e=e|0,r=r|0,n||I(e,r,this.length);for(var i=this[e],o=1,s=0;++s0&&(o*=256);)i+=this[e+--r]*o;return i};a.prototype.readUInt8=function(e,r){return r||I(e,1,this.length),this[e]};a.prototype.readUInt16LE=function(e,r){return r||I(e,2,this.length),this[e]|this[e+1]<<8};a.prototype.readUInt16BE=function(e,r){return r||I(e,2,this.length),this[e]<<8|this[e+1]};a.prototype.readUInt32LE=function(e,r){return r||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};a.prototype.readUInt32BE=function(e,r){return r||I(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};a.prototype.readIntLE=function(e,r,n){e=e|0,r=r|0,n||I(e,r,this.length);for(var i=this[e],o=1,s=0;++s=o&&(i-=Math.pow(2,8*r)),i};a.prototype.readIntBE=function(e,r,n){e=e|0,r=r|0,n||I(e,r,this.length);for(var i=r,o=1,s=this[e+--i];i>0&&(o*=256);)s+=this[e+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*r)),s};a.prototype.readInt8=function(e,r){return r||I(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};a.prototype.readInt16LE=function(e,r){r||I(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};a.prototype.readInt16BE=function(e,r){r||I(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};a.prototype.readInt32LE=function(e,r){return r||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};a.prototype.readInt32BE=function(e,r){return r||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};a.prototype.readFloatLE=function(e,r){return r||I(e,4,this.length),ye(this,e,!0,23,4)};a.prototype.readFloatBE=function(e,r){return r||I(e,4,this.length),ye(this,e,!1,23,4)};a.prototype.readDoubleLE=function(e,r){return r||I(e,8,this.length),ye(this,e,!0,52,8)};a.prototype.readDoubleBE=function(e,r){return r||I(e,8,this.length),ye(this,e,!1,52,8)};function N(t,e,r,n,i,o){if(!P(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}a.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;N(this,e,r,n,o,0)}var s=1,f=0;for(this[r]=e&255;++f=0&&(f*=256);)this[r+s]=e/f&255;return r+n};a.prototype.writeUInt8=function(e,r,n){return e=+e,r=r|0,n||N(this,e,r,1,255,0),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[r]=e&255,r+1};function ve(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i>>(n?i:1-i)*8}a.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r|0,n||N(this,e,r,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8):ve(this,e,r,!0),r+2};a.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r|0,n||N(this,e,r,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=e&255):ve(this,e,r,!1),r+2};function be(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i>>(n?i:3-i)*8&255}a.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r|0,n||N(this,e,r,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255):be(this,e,r,!0),r+4};a.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r|0,n||N(this,e,r,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255):be(this,e,r,!1),r+4};a.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r|0,!i){var o=Math.pow(2,8*n-1);N(this,e,r,n,o-1,-o)}var s=0,f=1,u=0;for(this[r]=e&255;++s>0)-u&255;return r+n};a.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r|0,!i){var o=Math.pow(2,8*n-1);N(this,e,r,n,o-1,-o)}var s=n-1,f=1,u=0;for(this[r+s]=e&255;--s>=0&&(f*=256);)e<0&&u===0&&this[r+s+1]!==0&&(u=1),this[r+s]=(e/f>>0)-u&255;return r+n};a.prototype.writeInt8=function(e,r,n){return e=+e,r=r|0,n||N(this,e,r,1,127,-128),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[r]=e&255,r+1};a.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r|0,n||N(this,e,r,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8):ve(this,e,r,!0),r+2};a.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r|0,n||N(this,e,r,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=e&255):ve(this,e,r,!1),r+2};a.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r|0,n||N(this,e,r,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24):be(this,e,r,!0),r+4};a.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r|0,n||N(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),a.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255):be(this,e,r,!1),r+4};function _t(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function wt(t,e,r,n,i){return i||_t(t,e,r,4),ut(t,e,r,n,23,4),r+4}a.prototype.writeFloatLE=function(e,r,n){return wt(this,e,r,!0,n)};a.prototype.writeFloatBE=function(e,r,n){return wt(this,e,r,!1,n)};function yt(t,e,r,n,i){return i||_t(t,e,r,8),ut(t,e,r,n,52,8),r+8}a.prototype.writeDoubleLE=function(e,r,n){return yt(this,e,r,!0,n)};a.prototype.writeDoubleBE=function(e,r,n){return yt(this,e,r,!1,n)};a.prototype.copy=function(e,r,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r=0;--s)e[s+r]=this[s+n];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(s=0;s>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var s;if(typeof e=="number")for(s=r;s55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function vr(t){for(var e=[],r=0;r>8,i=r%256,o.push(i),o.push(n);return o}function vt(t){return Ht(_r(t))}function xe(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function xr(t){return t!==t}function T(t){return t!=null&&(!!t._isBuffer||bt(t)||Er(t))}function bt(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Er(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&bt(t.slice(0,0))}var Sr;function Q(){}Q.prototype=Object.create(null);function p(){p.init.call(this)}p.EventEmitter=p;p.usingDomains=!1;p.prototype.domain=void 0;p.prototype._events=void 0;p.prototype._maxListeners=void 0;p.defaultMaxListeners=10;p.init=function(){this.domain=null,p.usingDomains&&Sr.active,(!this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=new Q,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};p.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this};function xt(t){return t._maxListeners===void 0?p.defaultMaxListeners:t._maxListeners}p.prototype.getMaxListeners=function(){return xt(this)};function Rr(t,e,r){if(e)t.call(r);else for(var n=t.length,i=ue(t,n),o=0;o0&&s.length>i)){s.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+e+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=t,f.type=e,f.count=s.length,Lr(f)}return t}function Lr(t){typeof console.warn=="function"?console.warn(t):console.log(t)}p.prototype.addListener=function(e,r){return Et(this,e,r,!1)};p.prototype.on=p.prototype.addListener;p.prototype.prependListener=function(e,r){return Et(this,e,r,!0)};function St(t,e,r){var n=!1;function i(){t.removeListener(e,i),n||(n=!0,r.apply(t,arguments))}return i.listener=r,i}p.prototype.once=function(e,r){if(typeof r!="function")throw new TypeError('"listener" argument must be a function');return this.on(e,St(this,e,r)),this};p.prototype.prependOnceListener=function(e,r){if(typeof r!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(e,St(this,e,r)),this};p.prototype.removeListener=function(e,r){var n,i,o,s,f;if(typeof r!="function")throw new TypeError('"listener" argument must be a function');if(i=this._events,!i)return this;if(n=i[e],!n)return this;if(n===r||n.listener&&n.listener===r)--this._eventsCount===0?this._events=new Q:(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(o=-1,s=n.length;s-- >0;)if(n[s]===r||n[s].listener&&n[s].listener===r){f=n[s].listener,o=s;break}if(o<0)return this;if(n.length===1){if(n[0]=void 0,--this._eventsCount===0)return this._events=new Q,this;delete i[e]}else Tr(n,o);i.removeListener&&this.emit("removeListener",e,f||r)}return this};p.prototype.removeAllListeners=function(e){var r,n;if(n=this._events,!n)return this;if(!n.removeListener)return arguments.length===0?(this._events=new Q,this._eventsCount=0):n[e]&&(--this._eventsCount===0?this._events=new Q:delete n[e]),this;if(arguments.length===0){for(var i=Object.keys(n),o=0,s;o0?Reflect.ownKeys(this._events):[]};function Tr(t,e){for(var r=e,n=r+1,i=t.length;n1)for(var r=1;r=i)return f;switch(f){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch{return"[Circular]"}default:return f}}),s=n[r];r=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),Nt(e)?r.showHidden=e:e&&_n(r,e),W(r.showHidden)&&(r.showHidden=!1),W(r.depth)&&(r.depth=2),W(r.colors)&&(r.colors=!1),W(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=un),we(r,t,r.depth)}H.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};H.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function un(t,e){var r=H.styles[e];return r?"\x1B["+H.colors[r][0]+"m"+t+"\x1B["+H.colors[r][1]+"m":t}function ln(t,e){return t}function hn(t){var e={};return t.forEach(function(r,n){e[r]=!0}),e}function we(t,e,r){if(t.customInspect&&e&&Te(e.inspect)&&e.inspect!==H&&!(e.constructor&&e.constructor.prototype===e)){var n=e.inspect(r,t);return ze(n)||(n=we(t,n,r)),n}var i=cn(t,e);if(i)return i;var o=Object.keys(e),s=hn(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),Le(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return Ce(e);if(o.length===0){if(Te(e)){var f=e.name?": "+e.name:"";return t.stylize("[Function"+f+"]","special")}if(Ae(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(Ze(e))return t.stylize(Date.prototype.toString.call(e),"date");if(Le(e))return Ce(e)}var u="",l=!1,h=["{","}"];if(gn(e)&&(l=!0,h=["[","]"]),Te(e)){var c=e.name?": "+e.name:"";u=" [Function"+c+"]"}if(Ae(e)&&(u=" "+RegExp.prototype.toString.call(e)),Ze(e)&&(u=" "+Date.prototype.toUTCString.call(e)),Le(e)&&(u=" "+Ce(e)),o.length===0&&(!l||e.length==0))return h[0]+u+h[1];if(r<0)return Ae(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var v;return l?v=dn(t,e,r,s,o):v=o.map(function(b){return Ue(t,e,r,s,b,l)}),t.seen.pop(),pn(v,u,h)}function cn(t,e){if(W(e))return t.stylize("undefined","undefined");if(ze(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(mn(e))return t.stylize(""+e,"number");if(Nt(e))return t.stylize(""+e,"boolean");if($e(e))return t.stylize("null","null")}function Ce(t){return"["+Error.prototype.toString.call(t)+"]"}function dn(t,e,r,n,i){for(var o=[],s=0,f=e.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");o=t[f-2]==="="?2:t[f-1]==="="?1:0,s=new Qt(f*3/4-o),n=o>0?f-4:f;var u=0;for(e=0,r=0;e>16&255,s[u++]=i>>8&255,s[u++]=i&255;return o===2?(i=M[t.charCodeAt(e)]<<2|M[t.charCodeAt(e+1)]>>4,s[u++]=i&255):o===1&&(i=M[t.charCodeAt(e)]<<10|M[t.charCodeAt(e+1)]<<4|M[t.charCodeAt(e+2)]>>2,s[u++]=i>>8&255,s[u++]=i&255),s}function Gt(t){return k[t>>18&63]+k[t>>12&63]+k[t>>6&63]+k[t&63]}function Zt(t,e,r){for(var n,i=[],o=e;ou?u:f+s));return n===1?(e=t[r-1],i+=k[e>>2],i+=k[e<<4&63],i+="=="):n===2&&(e=(t[r-2]<<8)+t[r-1],i+=k[e>>10],i+=k[e>>4&63],i+=k[e<<2&63],i+="="),o.push(i),o.join("")}function ye(t,e,r,n,i){var o,s,f=i*8-n-1,u=(1<>1,h=-7,c=r?i-1:0,v=r?-1:1,b=t[e+c];for(c+=v,o=b&(1<<-h)-1,b>>=-h,h+=f;h>0;o=o*256+t[e+c],c+=v,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=s*256+t[e+c],c+=v,h-=8);if(o===0)o=1-l;else{if(o===u)return s?NaN:(b?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-l}return(b?-1:1)*s*Math.pow(2,o-n)}function ut(t,e,r,n,i,o){var s,f,u,l=o*8-i-1,h=(1<>1,v=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,b=n?0:o-1,O=n?1:-1,x=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+c>=1?e+=v/u:e+=v*Math.pow(2,1-c),e*u>=2&&(s++,u/=2),s+c>=h?(f=0,s=h):s+c>=1?(f=(e*u-1)*Math.pow(2,i),s=s+c):(f=e*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;t[r+b]=f&255,b+=O,f/=256,i-=8);for(s=s<0;t[r+b]=s&255,b+=O,s/=256,l-=8);t[r+b-O]|=x*128}var Xt={}.toString,lt=Array.isArray||function(t){return Xt.call(t)=="[object Array]"},Kt=50;a.TYPED_ARRAY_SUPPORT=ie.TYPED_ARRAY_SUPPORT!==void 0?ie.TYPED_ARRAY_SUPPORT:!0;me();function me(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function j(t,e){if(me()=me())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+me().toString(16)+" bytes");return t|0}a.isBuffer=T;function P(t){return!!(t!=null&&t._isBuffer)}a.compare=function(e,r){if(!P(e)||!P(r))throw new TypeError("Arguments must be Buffers");if(e===r)return 0;for(var n=e.length,i=r.length,o=0,s=Math.min(n,i);o>>1;case"base64":return vt(t).length;default:if(n)return _e(t).length;e=(""+e).toLowerCase(),n=!0}}a.byteLength=dt;function ir(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return pr(this,e,r);case"utf8":case"utf-8":return mt(this,e,r);case"ascii":return cr(this,e,r);case"latin1":case"binary":return dr(this,e,r);case"base64":return lr(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return gr(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}a.prototype._isBuffer=!0;function Z(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}a.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""};a.prototype.compare=function(e,r,n,i,o){if(!P(e))throw new TypeError("Argument must be a Buffer");if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;for(var s=o-i,f=n-r,u=Math.min(s,f),l=this.slice(i,o),h=e.slice(r,n),c=0;c2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=a.from(e,n)),P(e))return e.length===0?-1:He(t,e,r,n,i);if(typeof e=="number")return e=e&255,a.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):He(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function He(t,e,r,n,i){var o=1,s=t.length,f=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;o=2,s/=2,f/=2,r/=2}function u(b,O){return o===1?b[O]:b.readUInt16BE(O*o)}var l;if(i){var h=-1;for(l=r;ls&&(r=s-f),l=r;l>=0;l--){for(var c=!0,v=0;vi&&(n=i)):n=i;var o=e.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;so)&&(n=o),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return or(this,e,r,n);case"utf8":case"utf-8":return sr(this,e,r,n);case"ascii":return gt(this,e,r,n);case"latin1":case"binary":return fr(this,e,r,n);case"base64":return ar(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ur(this,e,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function lr(t,e,r){return e===0&&r===t.length?Qe(t):Qe(t.slice(e,r))}function mt(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:o>223?3:o>191?2:1;if(i+f<=r){var u,l,h,c;switch(f){case 1:o<128&&(s=o);break;case 2:u=t[i+1],(u&192)===128&&(c=(o&31)<<6|u&63,c>127&&(s=c));break;case 3:u=t[i+1],l=t[i+2],(u&192)===128&&(l&192)===128&&(c=(o&15)<<12|(u&63)<<6|l&63,c>2047&&(c<55296||c>57343)&&(s=c));break;case 4:u=t[i+1],l=t[i+2],h=t[i+3],(u&192)===128&&(l&192)===128&&(h&192)===128&&(c=(o&15)<<18|(u&63)<<12|(l&63)<<6|h&63,c>65535&&c<1114112&&(s=c))}}s===null?(s=65533,f=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),i+=f}return hr(n)}var Ge=4096;function hr(t){var e=t.length;if(e<=Ge)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",o=e;on&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUIntLE=function(e,r,n){e=e|0,r=r|0,n||I(e,r,this.length);for(var i=this[e],o=1,s=0;++s0&&(o*=256);)i+=this[e+--r]*o;return i};a.prototype.readUInt8=function(e,r){return r||I(e,1,this.length),this[e]};a.prototype.readUInt16LE=function(e,r){return r||I(e,2,this.length),this[e]|this[e+1]<<8};a.prototype.readUInt16BE=function(e,r){return r||I(e,2,this.length),this[e]<<8|this[e+1]};a.prototype.readUInt32LE=function(e,r){return r||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};a.prototype.readUInt32BE=function(e,r){return r||I(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};a.prototype.readIntLE=function(e,r,n){e=e|0,r=r|0,n||I(e,r,this.length);for(var i=this[e],o=1,s=0;++s=o&&(i-=Math.pow(2,8*r)),i};a.prototype.readIntBE=function(e,r,n){e=e|0,r=r|0,n||I(e,r,this.length);for(var i=r,o=1,s=this[e+--i];i>0&&(o*=256);)s+=this[e+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*r)),s};a.prototype.readInt8=function(e,r){return r||I(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};a.prototype.readInt16LE=function(e,r){r||I(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};a.prototype.readInt16BE=function(e,r){r||I(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};a.prototype.readInt32LE=function(e,r){return r||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};a.prototype.readInt32BE=function(e,r){return r||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};a.prototype.readFloatLE=function(e,r){return r||I(e,4,this.length),ye(this,e,!0,23,4)};a.prototype.readFloatBE=function(e,r){return r||I(e,4,this.length),ye(this,e,!1,23,4)};a.prototype.readDoubleLE=function(e,r){return r||I(e,8,this.length),ye(this,e,!0,52,8)};a.prototype.readDoubleBE=function(e,r){return r||I(e,8,this.length),ye(this,e,!1,52,8)};function N(t,e,r,n,i,o){if(!P(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}a.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;N(this,e,r,n,o,0)}var s=1,f=0;for(this[r]=e&255;++f=0&&(f*=256);)this[r+s]=e/f&255;return r+n};a.prototype.writeUInt8=function(e,r,n){return e=+e,r=r|0,n||N(this,e,r,1,255,0),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[r]=e&255,r+1};function ve(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i>>(n?i:1-i)*8}a.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r|0,n||N(this,e,r,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8):ve(this,e,r,!0),r+2};a.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r|0,n||N(this,e,r,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=e&255):ve(this,e,r,!1),r+2};function be(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i>>(n?i:3-i)*8&255}a.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r|0,n||N(this,e,r,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255):be(this,e,r,!0),r+4};a.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r|0,n||N(this,e,r,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255):be(this,e,r,!1),r+4};a.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r|0,!i){var o=Math.pow(2,8*n-1);N(this,e,r,n,o-1,-o)}var s=0,f=1,u=0;for(this[r]=e&255;++s>0)-u&255;return r+n};a.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r|0,!i){var o=Math.pow(2,8*n-1);N(this,e,r,n,o-1,-o)}var s=n-1,f=1,u=0;for(this[r+s]=e&255;--s>=0&&(f*=256);)e<0&&u===0&&this[r+s+1]!==0&&(u=1),this[r+s]=(e/f>>0)-u&255;return r+n};a.prototype.writeInt8=function(e,r,n){return e=+e,r=r|0,n||N(this,e,r,1,127,-128),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[r]=e&255,r+1};a.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r|0,n||N(this,e,r,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8):ve(this,e,r,!0),r+2};a.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r|0,n||N(this,e,r,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=e&255):ve(this,e,r,!1),r+2};a.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r|0,n||N(this,e,r,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24):be(this,e,r,!0),r+4};a.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r|0,n||N(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),a.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255):be(this,e,r,!1),r+4};function _t(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function wt(t,e,r,n,i){return i||_t(t,e,r,4),ut(t,e,r,n,23,4),r+4}a.prototype.writeFloatLE=function(e,r,n){return wt(this,e,r,!0,n)};a.prototype.writeFloatBE=function(e,r,n){return wt(this,e,r,!1,n)};function yt(t,e,r,n,i){return i||_t(t,e,r,8),ut(t,e,r,n,52,8),r+8}a.prototype.writeDoubleLE=function(e,r,n){return yt(this,e,r,!0,n)};a.prototype.writeDoubleBE=function(e,r,n){return yt(this,e,r,!1,n)};a.prototype.copy=function(e,r,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r=0;--s)e[s+r]=this[s+n];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(s=0;s>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var s;if(typeof e=="number")for(s=r;s55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function vr(t){for(var e=[],r=0;r>8,i=r%256,o.push(i),o.push(n);return o}function vt(t){return Ht(_r(t))}function xe(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function xr(t){return t!==t}function T(t){return t!=null&&(!!t._isBuffer||bt(t)||Er(t))}function bt(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Er(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&bt(t.slice(0,0))}var Sr;function Q(){}Q.prototype=Object.create(null);function p(){p.init.call(this)}p.EventEmitter=p;p.usingDomains=!1;p.prototype.domain=void 0;p.prototype._events=void 0;p.prototype._maxListeners=void 0;p.defaultMaxListeners=10;p.init=function(){this.domain=null,p.usingDomains&&Sr.active,(!this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=new Q,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};p.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this};function xt(t){return t._maxListeners===void 0?p.defaultMaxListeners:t._maxListeners}p.prototype.getMaxListeners=function(){return xt(this)};function Rr(t,e,r){if(e)t.call(r);else for(var n=t.length,i=ue(t,n),o=0;o0&&s.length>i)){s.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+e+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=t,f.type=e,f.count=s.length,Lr(f)}return t}function Lr(t){typeof console.warn=="function"?console.warn(t):console.log(t)}p.prototype.addListener=function(e,r){return Et(this,e,r,!1)};p.prototype.on=p.prototype.addListener;p.prototype.prependListener=function(e,r){return Et(this,e,r,!0)};function St(t,e,r){var n=!1;function i(){t.removeListener(e,i),n||(n=!0,r.apply(t,arguments))}return i.listener=r,i}p.prototype.once=function(e,r){if(typeof r!="function")throw new TypeError('"listener" argument must be a function');return this.on(e,St(this,e,r)),this};p.prototype.prependOnceListener=function(e,r){if(typeof r!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(e,St(this,e,r)),this};p.prototype.removeListener=function(e,r){var n,i,o,s,f;if(typeof r!="function")throw new TypeError('"listener" argument must be a function');if(i=this._events,!i)return this;if(n=i[e],!n)return this;if(n===r||n.listener&&n.listener===r)--this._eventsCount===0?this._events=new Q:(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(o=-1,s=n.length;s-- >0;)if(n[s]===r||n[s].listener&&n[s].listener===r){f=n[s].listener,o=s;break}if(o<0)return this;if(n.length===1){if(n[0]=void 0,--this._eventsCount===0)return this._events=new Q,this;delete i[e]}else Tr(n,o);i.removeListener&&this.emit("removeListener",e,f||r)}return this};p.prototype.removeAllListeners=function(e){var r,n;if(n=this._events,!n)return this;if(!n.removeListener)return arguments.length===0?(this._events=new Q,this._eventsCount=0):n[e]&&(--this._eventsCount===0?this._events=new Q:delete n[e]),this;if(arguments.length===0){for(var i=Object.keys(n),o=0,s;o0?Reflect.ownKeys(this._events):[]};function Tr(t,e){for(var r=e,n=r+1,i=t.length;n1)for(var r=1;r=i)return f;switch(f){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch{return"[Circular]"}default:return f}}),s=n[r];r=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),Nt(e)?r.showHidden=e:e&&_n(r,e),W(r.showHidden)&&(r.showHidden=!1),W(r.depth)&&(r.depth=2),W(r.colors)&&(r.colors=!1),W(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=un),we(r,t,r.depth)}H.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};H.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function un(t,e){var r=H.styles[e];return r?"\x1B["+H.colors[r][0]+"m"+t+"\x1B["+H.colors[r][1]+"m":t}function ln(t,e){return t}function hn(t){var e={};return t.forEach(function(r,n){e[r]=!0}),e}function we(t,e,r){if(t.customInspect&&e&&Te(e.inspect)&&e.inspect!==H&&!(e.constructor&&e.constructor.prototype===e)){var n=e.inspect(r,t);return ze(n)||(n=we(t,n,r)),n}var i=cn(t,e);if(i)return i;var o=Object.keys(e),s=hn(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),Le(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return Ce(e);if(o.length===0){if(Te(e)){var f=e.name?": "+e.name:"";return t.stylize("[Function"+f+"]","special")}if(Ae(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(Ze(e))return t.stylize(Date.prototype.toString.call(e),"date");if(Le(e))return Ce(e)}var u="",l=!1,h=["{","}"];if(gn(e)&&(l=!0,h=["[","]"]),Te(e)){var c=e.name?": "+e.name:"";u=" [Function"+c+"]"}if(Ae(e)&&(u=" "+RegExp.prototype.toString.call(e)),Ze(e)&&(u=" "+Date.prototype.toUTCString.call(e)),Le(e)&&(u=" "+Ce(e)),o.length===0&&(!l||e.length==0))return h[0]+u+h[1];if(r<0)return Ae(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var v;return l?v=dn(t,e,r,s,o):v=o.map(function(b){return Ue(t,e,r,s,b,l)}),t.seen.pop(),pn(v,u,h)}function cn(t,e){if(W(e))return t.stylize("undefined","undefined");if(ze(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(mn(e))return t.stylize(""+e,"number");if(Nt(e))return t.stylize(""+e,"boolean");if($e(e))return t.stylize("null","null")}function Ce(t){return"["+Error.prototype.toString.call(t)+"]"}function dn(t,e,r,n,i){for(var o=[],s=0,f=e.length;s-1&&(o?f=f.split(` `).map(function(l){return" "+l}).join(` `).substr(2):f=` diff --git a/dist/assets/index-61b6fc23.js b/dist/assets/index-9d63439d.js similarity index 99% rename from dist/assets/index-61b6fc23.js rename to dist/assets/index-9d63439d.js index d481e5b7c2..446a884eaa 100644 --- a/dist/assets/index-61b6fc23.js +++ b/dist/assets/index-9d63439d.js @@ -1168,7 +1168,7 @@ z-index: 2; font-size: 2em; width: 100vw; height: 100vh; -`;function MenuPanel({hide:as,menuPanelCap:rs="",menusTitles:ns=[],currentMenus:ss=[],initOpen:os=[],setMenusOpen:ls,displayProfile:us}){const cs=Recoil_index_20(searchParamAtomFamily("hideLinks")),[ds,ps]=Recoil_index_22(darkModeAtom),fs=Recoil_index_20(selectedMenuPanelAtom),hs=Recoil_index_24(pageToolViewAtom);let gs=[];const ys=reactExports.useRef({DriveInfoCap:reactExports.lazy(()=>__vitePreload(()=>import("./DriveInfoCap-66332bea.js"),["assets/DriveInfoCap-66332bea.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js","assets/util-85d105b8.js","assets/util-38d8e238.js"])),DataCap:reactExports.lazy(()=>__vitePreload(()=>import("./DataCap-44eb6c65.js"),["assets/DataCap-44eb6c65.js","assets/util-85d105b8.js","assets/util-38d8e238.js"])),EditorInfoCap:reactExports.lazy(()=>__vitePreload(()=>import("./EditorInfoCap-cfe76eda.js"),["assets/EditorInfoCap-cfe76eda.js","assets/util-85d105b8.js","assets/util-38d8e238.js"])),PortfilioEditorInfoCap:reactExports.lazy(()=>__vitePreload(()=>Promise.resolve().then(()=>PortfilioEditorInfoCap$1),void 0)),AssignmentInfoCap:reactExports.lazy(()=>__vitePreload(()=>import("./AssignmentInfoCap-b64f95e4.js"),["assets/AssignmentInfoCap-b64f95e4.js","assets/util-85d105b8.js","assets/util-38d8e238.js"])),DraftActivityCap:reactExports.lazy(()=>__vitePreload(()=>import("./DraftActivityCap-99d68a54.js"),["assets/DraftActivityCap-99d68a54.js","assets/util-85d105b8.js","assets/util-38d8e238.js"])),ContentInfoCap:reactExports.lazy(()=>__vitePreload(()=>import("./ContentInfoCap-a4e0cbe4.js"),["assets/ContentInfoCap-a4e0cbe4.js","assets/util-85d105b8.js","assets/util-38d8e238.js"]))}).current,bs=reactExports.useRef({SelectedCourse:reactExports.lazy(()=>__vitePreload(()=>import("./SelectedCourse-fc5475aa.js"),["assets/SelectedCourse-fc5475aa.js","assets/ButtonGroup-6d856500.js","assets/CourseToolHandler-d3da4c3a.js","assets/index-1380c04c.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/index.esm-d246f4c9.js","assets/setPrototypeOf-51e8cf87.js","assets/util-10e10a40.css","assets/SettingComponents-b208ef07.js","assets/CollapseSection-2629b821.js","assets/util-38d8e238.js","assets/DateTime-3ab576fc.js","assets/moment-b216ba57.js","assets/DateTime-adf9b6b7.css","assets/DropdownMenu-5673dfd7.js","assets/RelatedItems-33d92928.js","assets/RoleDropdown-c9fff172.js","assets/Textfield-637f7b37.js","assets/ActionButton-be9a12e7.js","assets/ActionButtonGroup-f3a36748.js"])),GradeSettings:reactExports.lazy(()=>__vitePreload(()=>import("./GradeSettings-5114f8c7.js"),["assets/GradeSettings-5114f8c7.js","assets/DateTime-3ab576fc.js","assets/moment-b216ba57.js","assets/DateTime-adf9b6b7.css","assets/IncrementMenu-5203e1b9.js"])),SelectedSection:reactExports.lazy(()=>__vitePreload(()=>import("./SelectedSection-3c9495fa.js"),["assets/SelectedSection-3c9495fa.js","assets/ActionButton-be9a12e7.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js","assets/Textfield-637f7b37.js"])),SelectedBank:reactExports.lazy(()=>__vitePreload(()=>import("./SelectedBank-ac016b19.js"),["assets/SelectedBank-ac016b19.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js","assets/Textfield-637f7b37.js","assets/ButtonGroup-6d856500.js"])),SelectedDataSources:reactExports.lazy(()=>__vitePreload(()=>import("./SelectedDataSources-e17305c7.js"),["assets/SelectedDataSources-e17305c7.js","assets/ActionButton-be9a12e7.js"])),SelectedActivity:reactExports.lazy(()=>__vitePreload(()=>import("./SelectedActivity-416f6fd9.js"),["assets/SelectedActivity-416f6fd9.js","assets/SettingComponents-d7858e0f.js","assets/DateTime-3ab576fc.js","assets/moment-b216ba57.js","assets/DateTime-adf9b6b7.css","assets/IncrementMenu-5203e1b9.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js","assets/RelatedItems-33d92928.js","assets/ActionButtonGroup-f3a36748.js","assets/ActionButton-be9a12e7.js","assets/Textfield-637f7b37.js","assets/useSaveDraft-fc810696.js","assets/EditorViewerRecoil-fde09b36.js","assets/ButtonGroup-6d856500.js","assets/RoleDropdown-c9fff172.js"])),SelectedOrder:reactExports.lazy(()=>__vitePreload(()=>import("./SelectedOrder-658a390f.js"),["assets/SelectedOrder-658a390f.js","assets/ButtonGroup-6d856500.js","assets/IncrementMenu-5203e1b9.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js"])),SelectedPage:reactExports.lazy(()=>__vitePreload(()=>import("./SelectedPage-e3d66e05.js"),["assets/SelectedPage-e3d66e05.js","assets/Textfield-637f7b37.js","assets/ButtonGroup-6d856500.js","assets/ActionButton-be9a12e7.js","assets/ActionButtonGroup-f3a36748.js"])),SelectedPageLink:reactExports.lazy(()=>__vitePreload(()=>import("./SelectedPageLink-8bd53def.js"),["assets/SelectedPageLink-8bd53def.js","assets/ActionButton-be9a12e7.js","assets/ActionButtonGroup-f3a36748.js","assets/Textfield-637f7b37.js"])),SelectedCollectionLink:reactExports.lazy(()=>__vitePreload(()=>import("./SelectedCollectionLink-2abf6605.js"),["assets/SelectedCollectionLink-2abf6605.js","assets/ActionButton-be9a12e7.js","assets/Textfield-637f7b37.js","assets/RelatedItems-33d92928.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js"])),CreateCourse:reactExports.lazy(()=>__vitePreload(()=>import("./CreateCourse-ffe6df7d.js"),["assets/CreateCourse-ffe6df7d.js","assets/ButtonGroup-6d856500.js"])),CourseEnroll:reactExports.lazy(()=>__vitePreload(()=>import("./CourseEnroll-c7e6f0e7.js"),["assets/CourseEnroll-c7e6f0e7.js","assets/ButtonGroup-6d856500.js"])),AddDriveItems:reactExports.lazy(()=>__vitePreload(()=>import("./AddDriveItems-17579aeb.js"),["assets/AddDriveItems-17579aeb.js","assets/ButtonGroup-6d856500.js"])),CutCopyPasteMenu:reactExports.lazy(()=>__vitePreload(()=>import("./CutCopyPasteMenu-6ba7d6e1.js"),["assets/CutCopyPasteMenu-6ba7d6e1.js","assets/ActionButton-be9a12e7.js","assets/ActionButtonGroup-f3a36748.js"])),EnrollStudents:reactExports.lazy(()=>__vitePreload(()=>import("./EnrollStudents-17ca2355.js"),["assets/EnrollStudents-17ca2355.js","assets/ButtonGroup-6d856500.js"])),DoenetMLSettings:reactExports.lazy(()=>__vitePreload(()=>import("./DoenetMLSettings-15261dfe.js"),["assets/DoenetMLSettings-15261dfe.js","assets/index-1380c04c.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/EditorViewerRecoil-fde09b36.js"])),VersionHistory:reactExports.lazy(()=>__vitePreload(()=>import("./VersionHistory-01744f87.js"),["assets/VersionHistory-01744f87.js","assets/CourseToolHandler-d3da4c3a.js","assets/index-1380c04c.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/index.esm-d246f4c9.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-6d856500.js","assets/util-10e10a40.css","assets/RelatedItems-33d92928.js","assets/EditorViewerRecoil-fde09b36.js"])),PageVariant:reactExports.lazy(()=>__vitePreload(()=>import("./PageVariant-43e029f7.js"),[])),PageLink:reactExports.lazy(()=>__vitePreload(()=>import("./PageLink-b488e3e3.js"),["assets/PageLink-b488e3e3.js","assets/index-fcf36459.js","assets/ActionButton-be9a12e7.js","assets/EditorViewerRecoil-fde09b36.js"])),ActivityVariant:reactExports.lazy(()=>__vitePreload(()=>import("./ActivityVariant-41db56a8.js"),["assets/ActivityVariant-41db56a8.js","assets/IncrementMenu-5203e1b9.js"])),AutoSaves:reactExports.lazy(()=>__vitePreload(()=>import("./AutoSaves-22f2365a.js"),[])),LoadPeople:reactExports.lazy(()=>__vitePreload(()=>import("./LoadPeople-6c6c8356.js"),["assets/LoadPeople-6c6c8356.js","assets/index-e425ea7e.js","assets/ButtonGroup-6d856500.js","assets/CollapseSection-2629b821.js"])),GradeUpload:reactExports.lazy(()=>__vitePreload(()=>import("./GradeUpload-0a2ff6c2.js"),["assets/GradeUpload-0a2ff6c2.js","assets/index-e425ea7e.js","assets/GradebookAssignment-b8c6c0f7.js","assets/Gradebook-bd1a82d1.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-6d856500.js","assets/CollapseSection-2629b821.js"])),GradeDownload:reactExports.lazy(()=>__vitePreload(()=>import("./GradeDownload-dc857bc9.js"),["assets/GradeDownload-dc857bc9.js","assets/Gradebook-bd1a82d1.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js"])),ManualEnrollment:reactExports.lazy(()=>__vitePreload(()=>import("./ManualEnrollment-135fa9ee.js"),["assets/ManualEnrollment-135fa9ee.js","assets/LoadPeople-6c6c8356.js","assets/index-e425ea7e.js","assets/ButtonGroup-6d856500.js","assets/CollapseSection-2629b821.js"])),AssignmentSettingsMenu:reactExports.lazy(()=>__vitePreload(()=>import("./AssignmentSettingsMenu-65e6c736.js"),["assets/AssignmentSettingsMenu-65e6c736.js","assets/SelectedActivity-416f6fd9.js","assets/SettingComponents-d7858e0f.js","assets/DateTime-3ab576fc.js","assets/moment-b216ba57.js","assets/DateTime-adf9b6b7.css","assets/IncrementMenu-5203e1b9.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js","assets/RelatedItems-33d92928.js","assets/ActionButtonGroup-f3a36748.js","assets/ActionButton-be9a12e7.js","assets/Textfield-637f7b37.js","assets/useSaveDraft-fc810696.js","assets/EditorViewerRecoil-fde09b36.js","assets/ButtonGroup-6d856500.js","assets/RoleDropdown-c9fff172.js"])),SupportingFilesMenu:reactExports.lazy(()=>__vitePreload(()=>import("./SupportingFilesMenu-807b8c52.js"),["assets/SupportingFilesMenu-807b8c52.js","assets/ActionButtonGroup-f3a36748.js","assets/ActionButton-be9a12e7.js","assets/ButtonGroup-6d856500.js","assets/CollapseSection-2629b821.js","assets/index-1380c04c.js","assets/index-fcf36459.js","assets/index-47ca4f11.js"])),GroupSettings:reactExports.lazy(()=>__vitePreload(()=>import("./GroupSettings-950698d0.js"),["assets/GroupSettings-950698d0.js","assets/index-e425ea7e.js","assets/ButtonGroup-6d856500.js","assets/CollapseSection-2629b821.js"])),TimerMenu:reactExports.lazy(()=>__vitePreload(()=>import("./TimerMenu-8c34bf1e.js"),["assets/TimerMenu-8c34bf1e.js","assets/CourseToolHandler-d3da4c3a.js","assets/index-1380c04c.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/index.esm-d246f4c9.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-6d856500.js","assets/util-10e10a40.css","assets/AssignmentViewer-ce09819c.js","assets/ActivityViewer-5e9601b2.js","assets/activityUtils-3e149527.js","assets/visibility-sensor-398e690f.js","assets/ActionButton-be9a12e7.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js"])),CreditAchieved:reactExports.lazy(()=>__vitePreload(()=>import("./CreditAchieved-ca85b1d4.js"),["assets/CreditAchieved-ca85b1d4.js","assets/AssignmentViewer-ce09819c.js","assets/ActivityViewer-5e9601b2.js","assets/activityUtils-3e149527.js","assets/visibility-sensor-398e690f.js","assets/ActionButton-be9a12e7.js","assets/ButtonGroup-6d856500.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js","assets/Textfield-637f7b37.js","assets/Gradebook-bd1a82d1.js"])),ActivityDates:reactExports.lazy(()=>__vitePreload(()=>import("./ActivityDates-af3c7273.js"),["assets/ActivityDates-af3c7273.js","assets/SettingComponents-d7858e0f.js","assets/DateTime-3ab576fc.js","assets/moment-b216ba57.js","assets/DateTime-adf9b6b7.css","assets/IncrementMenu-5203e1b9.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js","assets/RelatedItems-33d92928.js","assets/ActionButtonGroup-f3a36748.js","assets/ActionButton-be9a12e7.js","assets/Textfield-637f7b37.js","assets/useSaveDraft-fc810696.js","assets/EditorViewerRecoil-fde09b36.js","assets/RoleDropdown-c9fff172.js"])),ClassTimes:reactExports.lazy(()=>__vitePreload(()=>import("./ClassTimes-434dec98.js"),["assets/ClassTimes-434dec98.js","assets/Next7Days-938d1df1.js","assets/CourseToolHandler-d3da4c3a.js","assets/index-1380c04c.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/index.esm-d246f4c9.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-6d856500.js","assets/util-10e10a40.css","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js","assets/DateTime-3ab576fc.js","assets/moment-b216ba57.js","assets/DateTime-adf9b6b7.css"])),CurrentContent:reactExports.lazy(()=>__vitePreload(()=>import("./CurrentContent-eb8543fb.js"),["assets/CurrentContent-eb8543fb.js","assets/Next7Days-938d1df1.js","assets/CourseToolHandler-d3da4c3a.js","assets/index-1380c04c.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/index.esm-d246f4c9.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-6d856500.js","assets/util-10e10a40.css","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js"])),ManageUsersMenu:reactExports.lazy(()=>__vitePreload(()=>import("./ManageUsersMenu-efb71d9d.js"),["assets/ManageUsersMenu-efb71d9d.js","assets/SettingComponents-b208ef07.js","assets/CourseToolHandler-d3da4c3a.js","assets/index-1380c04c.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/index.esm-d246f4c9.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-6d856500.js","assets/util-10e10a40.css","assets/CollapseSection-2629b821.js","assets/util-38d8e238.js","assets/DateTime-3ab576fc.js","assets/moment-b216ba57.js","assets/DateTime-adf9b6b7.css","assets/DropdownMenu-5673dfd7.js","assets/RelatedItems-33d92928.js","assets/RoleDropdown-c9fff172.js","assets/Textfield-637f7b37.js"]))}).current;let vs=null;if(fs){const Ts=bs[fs];if(Ts){const Ss=`SelectionMenu${fs}`;vs=jsx$1(SelectionMenu,{children:jsx$1(reactExports.Suspense,{fallback:jsx$1(LoadingFallback$1,{children:"loading..."}),children:React.createElement(Ts,{key:Ss})})},Ss)}}let xs=null;rs!==""&&(xs=jsx$1(MenuPanelsCapComponent,{children:jsx$1(reactExports.Suspense,{fallback:jsx$1(LoadingFallback$1,{children:"loading..."}),children:React.createElement(ys[rs])})}));for(let[Ts,Ss]of Object.entries(ss)){const Ns=`${Ss}`,As=ns[Ts];let ws=os[Ts];gs.push(jsx$1(Menu$1,{title:As,isInitOpen:ws,type:Ss,children:jsx$1(reactExports.Suspense,{fallback:jsx$1(LoadingFallback$1,{children:"loading..."}),children:React.createElement(bs[Ss],{mKey:Ns})})},Ns))}let Cs=null;return cs!="true"&&(Cs=jsx$1(SettingsButton,{onClick:()=>hs({page:"settings",tool:"",view:""}),children:jsx$1(FontAwesomeIcon,{icon:faCog})})),jsxs(MenuPanelsWrapper,{hide:as,"aria-label":"menus",children:[jsxs(MenuPanelsCap,{fix:as,role:"banner",children:[jsxs(Branding$1,{style:{marginLeft:"5px"},children:[jsx$1(Logo,{hasLink:cs!="true"}),jsx$1("p",{children:"Doenet"})]}),jsxs(IconsGroup,{children:[jsx$1(CheckboxButton,{checked:ds==="dark",onClick:()=>ps(ds==="dark"?"light":"dark"),checkedIcon:jsx$1(FontAwesomeIcon,{icon:faSun}),uncheckedIcon:jsx$1(FontAwesomeIcon,{icon:faMoon})}),Cs]}),jsx$1("span",{children:jsx$1(CloseButton$1,{onClick:()=>ls(!1),children:jsx$1(FontAwesomeIcon,{icon:faChevronLeft})})})]}),xs,vs,jsx$1("div",{children:gs})]})}function UTCDateStringToDate(as){if(!as||typeof as!="string")return null;let rs=as.split(/[- :]/);return new Date(Date.UTC(rs[0],rs[1]-1,rs[2],rs[3],rs[4],rs[5]))}function formatAMPM(as){var rs=as.getHours(),ns=as.getMinutes(),ss=rs>=12?"PM":"AM";rs=rs%12,rs=rs||12,ns=ns<10?"0"+ns:ns;var os=rs+":"+ns+" "+ss;return os}function DateToUTCDateString(as){var rs=function(ns){return("00"+ns).slice(-2)};return as.getUTCFullYear()+"-"+rs(as.getUTCMonth()+1)+"-"+rs(as.getUTCDate())+" "+rs(as.getUTCHours())+":"+rs(as.getUTCMinutes())+":"+rs(as.getUTCSeconds())}function DateToUTCDateWithoutSecondsString(as){var rs=function(ns){return("00"+ns).slice(-2)};return as.getUTCFullYear()+"-"+rs(as.getUTCMonth()+1)+"-"+rs(as.getUTCDate())+" "+rs(as.getUTCHours())+":"+rs(as.getUTCMinutes())}function DateToDateString(as){var rs=function(ns){return("00"+ns).slice(-2)};return as.getFullYear()+"-"+rs(as.getMonth()+1)+"-"+rs(as.getDate())+" "+rs(as.getHours())+":"+rs(as.getMinutes())+":"+rs(as.getSeconds())}function DateToDisplayDateString(as){var rs=function(ns){return("00"+ns).slice(-2)};return rs(as.getMonth()+1)+"/"+rs(as.getDate())+"/"+as.getFullYear()+" "+formatAMPM(as)}function useValidateEmail(){return reactExports.useCallback(rs=>/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(String(rs).toLowerCase()),[])}const fileByCid=Recoil_index_10({key:"fileByCid",default:Recoil_index_11({key:"fileByCid/Default",get:as=>async()=>{if(!as)return"";try{return(await axios.get(`/media/${as}.doenet`)).data}catch(rs){return rs.response?(console.log(rs.response.data),console.log(rs.response.status),console.log(rs.response.headers)):rs.request?console.log(rs.request):console.log("Error",rs.message),"Error Loading"}}})}),fileByPageId=Recoil_index_10({key:"fileByPageId",default:Recoil_index_11({key:"fileByPageId/Default",get:as=>async()=>{if(!as)return"";try{return(await axios.get(`/media/byPageId/${as}.doenet`)).data}catch(rs){return rs.response?(console.log(rs.response.data),console.log(rs.response.status),console.log(rs.response.headers)):rs.request?console.log(rs.request):console.log("Error",rs.message),"Error Loading"}}})}),peopleAtomByCourseId=Recoil_index_10({key:"peopleAtomByCourseId",default:Recoil_index_11({key:"peopleAtomByCourseId/Default",get:as=>async()=>{const{data:rs}=await axios.get("/api/loadCoursePeople.php",{params:{courseId:as}});return rs.success?rs.peopleArray:[]}})}),peopleByCourseId=Recoil_index_11({key:"peopleByCourseId",get:as=>({get:rs,getCallback:ns})=>{const ss=ns(({set:us})=>async cs=>{let ds={email:cs,courseId:as};try{let ps=await axios.post("/api/withDrawStudents.php",ds);if(ps.status<300)us(peopleAtomByCourseId(as),fs=>{let hs=[...fs];const gs=hs.findIndex(ys=>ys.email==cs);return hs[gs]={...fs[gs],withdrew:"1"},hs});else throw new Error(`response code: ${ps.status}`)}catch{}}),os=ns(({set:us})=>async cs=>{let ds={email:cs,courseId:as};try{let ps=await axios.post("/api/unWithDrawStudents.php",ds);if(ps.status<300)us(peopleAtomByCourseId(as),fs=>{let hs=[...fs];const gs=hs.findIndex(ys=>ys.email==cs);return hs[gs]={...fs[gs],withdrew:"0"},hs});else throw new Error(`response code: ${ps.status}`)}catch{}}),ls=ns(({set:us})=>async(cs,ds)=>{try{let{data:{success:ps,peopleArray:fs,message:hs}}=await axios.post("/api/mergePeopleData.php",{...cs,courseId:as});if(ps)us(peopleAtomByCourseId(as),fs),ds==null||ds();else throw new Error(hs)}catch{}});return{value:rs(peopleAtomByCourseId(as)),recoilWithdraw:ss,recoilUnWithdraw:os,recoilMergeData:ls}}});function buildDoenetIdToParentDoenetIdObj(as,rs=null){let ns={};for(let ss of as)(ss==null?void 0:ss.type)=="order"?ns={...buildDoenetIdToParentDoenetIdObj(ss.content,ss.doenetId),...ns}:rs!==null&&(ns[ss]=rs);return ns}function findFirstPageOfActivity(as=[]){let rs=null;for(let ns of as)if(typeof ns=="string"||ns instanceof String){rs=ns;break}else{let ss=findFirstPageOfActivity(ns.content);if(typeof ss=="string"||ss instanceof String){rs=ss;break}}return rs}function findOrderAndPageDoenetIdsAndSetOrderObjs({set:as,contentArray:rs,assignmentDoenetId:ns,orderDoenetId:ss=null}){let os=[];for(let ls of rs)if((ls==null?void 0:ls.type)=="order"){let us=ls.numberToSelect;us==null&&(us=1);let cs=ls.withReplacement;cs==null&&(cs=!1);let ds=ss;ss==null&&(ds=ns),as(itemByDoenetId(ls.doenetId),{type:"order",doenetId:ls.doenetId,behavior:ls.behavior,numberToSelect:us,withReplacement:cs,containingDoenetId:ns,isOpen:!1,isSelected:!1,parentDoenetId:ds}),os.push(ls.doenetId);let ps=findOrderAndPageDoenetIdsAndSetOrderObjs({set:as,contentArray:ls.content,assignmentDoenetId:ns,orderDoenetId:ls.doenetId});os=[...os,...ps]}else if((ls==null?void 0:ls.type)=="collectionLink"){let us=ss;ss==null&&(us=ns),as(itemByDoenetId(ls.doenetId),{type:"collectionLink",doenetId:ls.doenetId,containingDoenetId:ns,collectionDoenetId:ls.collectionDoenetId,isManuallyFiltered:ls.isManuallyFiltered,pages:ls.pages,pagesByCollectionSource:ls.pagesByCollectionSource,manuallyFilteredPages:ls.manuallyFilteredPages,timeOfLastUpdate:ls.timeOfLastUpdate,label:ls.label,isOpen:!1,isSelected:!1,parentDoenetId:us}),os.push(ls.doenetId);let cs=[...ls.pages];ls.isManuallyFiltered&&(cs=[...ls.manuallyFilteredPages]),os=[...os,...cs]}else os=[...os,ls];return os}function findPageDoenetIdsInAnOrder({content:as,needleOrderDoenetId:rs,foundNeedle:ns=!1}){let ss=[];for(let os of as)if((os==null?void 0:os.type)=="order"){let ls;ns||os.doenetId==rs?ls=findPageDoenetIdsInAnOrder({content:os.content,needleOrderDoenetId:rs,foundNeedle:!0}):ls=findPageDoenetIdsInAnOrder({content:os.content,needleOrderDoenetId:rs,foundNeedle:ns}),ss=[...ss,...ls]}else ns&&ss.push(os);return ss}function findCollectionLinksAndPageLinksInContentArray({content:as,needleOrderDoenentId:rs,foundNeedle:ns=!1}){let ss=[],os=[];for(let ls of as)if((ls==null?void 0:ls.type)=="order"){ls.doenetId==rs&&(ns=!0);let{pageLinkDoenetIds:us,collectionLinkDoenetIds:cs}=findCollectionLinksAndPageLinksInContentArray({content:ls.content,needleOrderDoenentId:rs,foundNeedle:ns});ss=[...ss,...us],os=[...os,...cs]}else(ls==null?void 0:ls.type)=="collectionLink"&&ns&&(ss=[...ss,...ls.pages],os=[...os,ls.doenetId]);return{pageLinkDoenetIds:ss,collectionLinkDoenetIds:os}}function findPageIdsInContentArray({content:as,needleOrderDoenetId:rs,foundNeedle:ns=!1}){let ss=[];for(let os of as)if((os==null?void 0:os.type)=="order"){let ls;ns||os.doenetId==rs?ls=findPageIdsInContentArray({content:os.content,needleOrderDoenetId:rs,foundNeedle:!0}):ls=findPageIdsInContentArray({content:os.content,needleOrderDoenetId:rs,foundNeedle:ns}),ss=[...ss,...ls]}else(os==null?void 0:os.type)!="collectionLink"&&ns&&ss.push(os);return ss}function localizeDates(as,rs){for(let ns of rs)as[ns]&&(as[ns]=UTCDateStringToDate(as[ns]).toLocaleString());return as}let dateKeys=["assignedDate","dueDate","pinnedAfterDate","pinnedUntilDate"];function useInitCourseItems(as){const rs=Recoil_index_31(({snapshot:ns,set:ss})=>async os=>{if(!os)return;if((await ns.getPromise(authorCourseItemOrderByCourseId(os))).length==0){ss(courseIdAtom,os);const{data:us}=await axios.get("/api/getCourseItems.php",{params:{courseId:os}});if(us.success){let cs={},ds=us.items.reduce((ps,fs)=>{if(fs.type!=="page"&&fs.type!=="pageLink"&&ps.push(fs.doenetId),fs.type==="activity"){let hs=buildDoenetIdToParentDoenetIdObj(fs.content,fs.doenetId);cs={...cs,...hs};let gs=findOrderAndPageDoenetIdsAndSetOrderObjs({set:ss,contentArray:fs.content,assignmentDoenetId:fs.doenetId});fs.isSinglePage||(ps=[...ps,...gs])}else fs.type==="bank"?(fs.pages.map(hs=>{cs[hs]=fs.doenetId}),ps=[...ps,...fs.pages]):fs.type==="page"&&(fs.parentDoenetId=cs[fs.doenetId]);return ss(itemByDoenetId(fs.doenetId),localizeDates(fs,dateKeys)),ps},[]);ss(authorCourseItemOrderByCourseId(os),ds)}}},[]);reactExports.useEffect(()=>{as&&rs(as)},[rs,as])}function useSetCourseIdFromDoenetId(as){const[rs,ns]=Recoil_index_22(itemByDoenetId(as)),ss=Recoil_index_24(courseIdAtom);reactExports.useEffect(()=>{Object.keys(rs).length>0||axios.get("/api/getCourseIdFromDoenetId.php",{params:{doenetId:as}}).then(({data:os})=>{os.success?(os.item&&ns(os.item),ss(os.courseId)):ss("__not_found__")}).catch(console.error)},[as])}const courseIdAtom=Recoil_index_8({key:"courseIdAtom",default:null}),authorCollectionsByCourseId=Recoil_index_11({key:"authorCollectionsByCourseId",get:as=>({get:rs})=>{let ns=rs(authorCourseItemOrderByCourseId(as)),ss=[];for(let os of ns){let ls=rs(itemByDoenetId(os));ls.type=="bank"&&ss.push({label:ls.label,doenetId:os})}return ss}}),authorCourseItemOrderByCourseId=Recoil_index_10({key:"authorCourseItemOrderByCourseId",default:[]}),authorCourseItemOrderByCourseIdBySection=Recoil_index_11({key:"authorCourseItemOrderByCourseIdBySection",get:({courseId:as,sectionId:rs})=>({get:ns})=>{let ss=ns(authorCourseItemOrderByCourseId(as));if(rs==as||!rs)return ss;let os=[],ls=!1,us=[rs];for(let cs of ss){if(cs==rs){ls=!0;continue}if(ls){let ds=ns(itemByDoenetId(cs));if(us.includes(ds.parentDoenetId))os.push(cs),ds.type!=="page"&&us.push(cs);else break}}return os}}),studentCourseItemOrderByCourseId=Recoil_index_11({key:"studentCourseItemOrderByCourseId",get:as=>({get:rs})=>rs(authorCourseItemOrderByCourseId(as)).filter(os=>{let ls=rs(itemByDoenetId(os));return ls.isAssigned&&(ls.type=="activity"||ls.type=="section")})}),studentCourseItemOrderByCourseIdBySection=Recoil_index_11({key:"studentCourseItemOrderByCourseId",get:({courseId:as,sectionId:rs})=>({get:ns})=>{let ss=ns(studentCourseItemOrderByCourseId(as)),os=[],ls=!1,us=[rs];(as==rs||!rs)&&(us=[as],ls=!0);for(let cs of ss){if(cs==rs){ls=!0;continue}if(ls){let ds=ns(itemByDoenetId(cs));if(ds.isAssigned&&us.includes(ds.parentDoenetId))os.push(cs),ds.type=="section"&&us.push(cs);else continue}}return os}}),itemByDoenetId=Recoil_index_10({key:"itemByDoenetId",default:{}}),coursePermissionsAndSettings=Recoil_index_8({key:"coursePermissionsAndSettings",default:[],effects:[async({setSelf:as,trigger:rs})=>{if(rs==="get"){const{data:ns}=await axios.get("/api/getCoursePermissionsAndSettings.php");as(ns.permissionsAndSettings)}}]}),coursePermissionsAndSettingsByCourseId=Recoil_index_11({key:"coursePermissionsAndSettingsByCourseId/Default",get:as=>({get:rs})=>rs(coursePermissionsAndSettings).find(ss=>ss.courseId==as)??{},set:as=>({set:rs},ns)=>{rs(coursePermissionsAndSettings,ss=>{const os=[...ss],ls=ss.findIndex(us=>us.courseId===as);return os[ls]={...ss[ls],...ns},os})}}),unfilteredCourseRolesByCourseId=Recoil_index_10({key:"unfilteredCourseRolesByCourseId",effects:as=>[async({setSelf:rs,trigger:ns})=>{if(ns==="get"){const{data:{roles:ss}}=await axios.get("/api/loadCourseRoles.php",{params:{courseId:as}});rs(ss)}}]}),courseRolesByCourseId=Recoil_index_11({key:"filteredCourseRolesByCourseId",get:as=>({get:rs})=>{const ns=rs(coursePermissionsAndSettingsByCourseId(as)),ss=rs(unfilteredCourseRolesByCourseId(as)),os=["isIncludedInGradebook","sectionPermissionOnly","dataAccessPermission","roleId","roleLabel"];return(ss==null?void 0:ss.filter(us=>us.roleId===ns.roleId||!Object.keys(us).every(ds=>(us[ds]??"0")===ns[ds]||os.includes(ds)||(us[ds]??"0")==="1"&&ns[ds]==="0")))??[]}}),courseRolePermissionsByCourseIdRoleId=Recoil_index_11({key:"courseRoleByCourseIdRoleId",get:({courseId:as,roleId:rs})=>({get:ns})=>{var ss;return((ss=ns(unfilteredCourseRolesByCourseId(as)))==null?void 0:ss.find(({roleId:os})=>os===rs))??{}}}),useCreateCourse=()=>({createCourse:Recoil_index_31(({set:rs})=>async()=>{let{data:{permissionsAndSettings:ns,courseId:ss,image:os,color:ls,...us}}=await axios.get("/api/createCourse.php");rs(coursePermissionsAndSettings,ns)})});Recoil_index_10({key:"courseOrderDataByCourseId",default:{completeOrder:[],orderingDataLookup:{}},effects:as=>[({setSelf:rs,onSet:ns,trigger:ss})=>{ns(({completeOrder:os},ls)=>{})}]});const selectedCourseItems=Recoil_index_8({key:"selectedCourseItems",default:[]}),copiedCourseItems=Recoil_index_8({key:"copiedCourseItems",default:[]}),cutCourseItems=Recoil_index_8({key:"cutCourseItems",default:[]});function findContentsChildIds(as){let rs=[];for(let ns of as)if((ns==null?void 0:ns.type)=="order"){let ss=findContentsChildIds(ns.content);rs=[...rs,ns.doenetId,...ss]}else if((ns==null?void 0:ns.type)=="collectionLink"){let ss=[];rs=[...rs,ns.doenetId,...ss]}else rs.push(ns);return rs}const useCourse=as=>{const{label:rs,color:ns,image:ss,defaultRoleId:os,canAutoEnroll:ls}=Recoil_index_20(coursePermissionsAndSettingsByCourseId(as)),us=useToast();function cs({content:Us,needleOrderDoenetId:js,createdItemType:Ls,createdPageDonenetId:Gs=null,createdOrderObj:Hs=null,createdCollectionLink:Ys=null}){let Xs=[...Us],Nl;for(let[xl,Dl]of Object.entries(Us)){if((Dl==null?void 0:Dl.doenetId)==js){let Rl={...Dl};if(Nl=Rl.doenetId,Rl.content.length>0&&(Nl=Rl.content[Rl.content.length-1]),(Nl==null?void 0:Nl.type)=="order"){let Ml=findContentsChildIds(Dl.content);Nl=Nl.doenetId,Ml.length>0&&(Nl=Ml[Ml.length-1])}return Ls=="page"?Rl.content=[...Rl.content,Gs]:Ls=="order"?Rl.content=[...Rl.content,{...Hs}]:Ls=="collectionLink"&&(Rl.content=[...Rl.content,{...Ys}]),Xs.splice(xl,1,Rl),{newContent:Xs,insertedAfterDoenetId:Nl}}if((Dl==null?void 0:Dl.type)=="order"){let{newContent:Rl,insertedAfterDoenetId:Ml}=cs({content:Dl.content,needleOrderDoenetId:js,createdItemType:Ls,createdPageDonenetId:Gs,createdOrderObj:Hs,createdCollectionLink:Ys});if(Rl!=null){let Zs={...Dl};return Zs.content=Rl,Xs.splice(xl,1,Zs),{newContent:Xs,insertedAfterDoenetId:Ml}}}}return{newContent:null,insertedAfterDoenetId:null}}function ds({activityOrOrderObj:Us,needleOrderOrActivityId:js,itemToAdd:Ls}){let Gs=[...Us.content];if(Us.doenetId==js){let Hs=Us.doenetId;return Us.content.length>0&&(Hs=Gs[Gs.length-1],(Hs==null?void 0:Hs.type)=="order"&&(Hs=Hs.doenetId)),Gs=[...Gs,Ls],{content:Gs,previousDoenetId:Hs}}for(let[Hs,Ys]of Object.entries(Us.content))if((Ys==null?void 0:Ys.type)=="order"){let{content:Xs,previousDoenetId:Nl}=ds({activityOrOrderObj:Ys,needleOrderOrActivityId:js,itemToAdd:Ls});if(Xs!=null){let xl={...Ys};return xl.content=Xs,Gs.splice(Hs,1,xl),{content:Gs,previousDoenetId:Nl}}}return{content:null,previousDoenetId:null}}const ps=reactExports.useCallback(Us=>{us(`${Us}`,toastType.ERROR)},[us]),fs=Recoil_index_31(({set:Us,snapshot:js})=>async({itemType:Ls,parentDoenetId:Gs,previousDoenetId:Hs,previousContainingDoenetId:Ys},Xs,Nl=ps)=>{let Dl=[...await js.getPromise(authorCourseItemOrderByCourseId(as))],Rl=await js.getPromise(searchParamAtomFamily("sectionId"));Rl==""&&(Rl=as);let Ml=await js.getPromise(selectedCourseItems);if(Ml.length==1){let Qs=Ml[0],Js=await js.getPromise(itemByDoenetId(Qs));if(Js.type=="section"){let El=await js.getPromise(authorCourseItemOrderByCourseIdBySection({courseId:as,sectionId:Qs})),_l=El[El.length-1];if(Gs=Qs,Hs=_l,!_l)Hs=Qs,Ys=Qs;else{let Ks=await js.getPromise(itemByDoenetId(_l));Hs=_l,Ks.type=="page"||Ks.type=="order"?Ys=Ks.containingDoenetId:(Ks.type=="bank"||Ks.type=="section")&&(Ys=_l)}}else if(Js.type=="activity"||Js.type=="bank"){Gs=Js.parentDoenetId,Ls=="page"&&Js.type=="bank"&&(Gs=Js.doenetId,console.log("page in a bank parentDoenetId:",Gs));let El=await js.getPromise(authorCourseItemOrderByCourseIdBySection({courseId:as,sectionId:Gs})),_l=Gs;if(El.length>0){_l=El[El.length-1];let Ks=await js.getPromise(itemByDoenetId(_l));Hs=_l,Ks.type=="page"||Ks.type=="order"?Ys=Ks.containingDoenetId:(Ks.type=="bank"||Ks.type=="section")&&(Ys=_l)}else Hs=Gs,Ys=Js.parentDoenetId}else if(Js.type=="page"||Js.type=="order"){Gs=(await js.getPromise(itemByDoenetId(Js.containingDoenetId))).parentDoenetId;let _l=await js.getPromise(authorCourseItemOrderByCourseIdBySection({courseId:as,sectionId:Gs})),Ks=_l[_l.length-1],yl=await js.getPromise(itemByDoenetId(Ks));Hs=Ks,yl.type=="page"||yl.type=="order"?Ys=yl.containingDoenetId:(yl.type=="bank"||yl.type=="section")&&(Ys=Ks)}}if(Hs==null){console.log("not a single selection!!!!!");let Qs=await js.getPromise(authorCourseItemOrderByCourseIdBySection({courseId:as,sectionId:Rl})),Js=Qs[Qs.length-1];if(Gs=Rl,Js==null)Hs=Rl,Ys=Rl;else{Hs=Js;let El=await js.getPromise(itemByDoenetId(Js));El.type=="page"||El.type=="order"||El.type=="collectionLink"||El.type=="pageLink"?Ys=El.containingDoenetId:(El.type=="activity"||El.type=="bank"||El.type=="section")&&(Ys=El.doenetId)}}console.log("WHERE IS IT GOING?"),console.log("itemType",Ls),console.log("parentDoenetId",Gs),console.log("previousDoenetId",Hs),console.log("previousContainingDoenetId",Ys);let Zs;if((await js.getPromise(coursePermissionsAndSettingsByCourseId(as))).canEditContent!="1")return null;if(Ls=="activity"){let{data:Qs}=await axios.post("/api/createCourseItem.php",{previousContainingDoenetId:Ys,courseId:as,itemType:Ls,parentDoenetId:Gs}),Js=Qs.doenetId;Zs=Js;let El={timeLimit:null,numberOfAttemptsAllowed:null,totalPointsOrPercent:null,individualize:!1,showSolution:!0,showSolutionInGradebook:!0,showFeedback:!0,showHints:!0,showCorrectness:!0,showCreditAchievedMenu:!0,paginate:!0,showFinishButton:!1,proctorMakesAvailable:!1,autoSubmit:!1,pinnedAfterDate:null,pinnedUntilDate:null,canViewAfterCompleted:"1",...Qs.itemEntered};Us(itemByDoenetId(Js),El);let _l={...Qs.pageEntered,parentDoenetId:Js};Us(itemByDoenetId(Qs.pageDoenetId),_l);let Ks=Dl.indexOf(Hs);Ks==-1?Dl.push(Js):Dl.splice(Ks+1,0,Js),Us(authorCourseItemOrderByCourseId(as),Dl)}else if(Ls=="bank"){let{data:Qs}=await axios.post("/api/createCourseItem.php",{previousContainingDoenetId:Ys,courseId:as,itemType:Ls,parentDoenetId:Gs});console.log("bankData",Qs),Zs=Qs.doenetId,Us(itemByDoenetId(Qs.doenetId),Qs.itemEntered);let Js=Dl.indexOf(Hs);Js==-1?Dl.push(Qs.doenetId):Dl.splice(Js+1,0,Qs.doenetId),Us(authorCourseItemOrderByCourseId(as),Dl)}else if(Ls=="section"){let{data:Qs}=await axios.post("/api/createCourseItem.php",{previousContainingDoenetId:Ys,courseId:as,itemType:Ls,parentDoenetId:Gs});Zs=Qs.doenetId,Us(itemByDoenetId(Qs.doenetId),Qs.itemEntered);let Js=Dl.indexOf(Hs);Js==-1?Dl.push(Qs.doenetId):Dl.splice(Js+1,0,Qs.doenetId),Us(authorCourseItemOrderByCourseId(as),Dl)}else if(Ls=="page"||Ls=="order"||Ls=="collectionLink"){let Qs=(await js.getPromise(selectedCourseItems))[0];const Js=await js.getPromise(itemByDoenetId(Qs));let El;Js.type=="activity"||Js.type=="bank"?El=Js.doenetId:(Js.type=="order"||Js.type=="page")&&(El=Js.containingDoenetId);let{data:_l}=await axios.get("/api/createPageOrOrder.php",{params:{courseId:as,itemType:Ls,containingDoenetId:El}}),{pageThatWasCreated:Ks,orderDoenetIdThatWasCreated:yl,collectionAliasDoenetIdThatWasCreated:Al}=_l,Fs={type:"order",behavior:"sequence",numberToSelect:1,withReplacement:!1,content:[],doenetId:yl},Cl={type:"collectionLink",doenetId:Al,collectionDoenetId:null,isManuallyFiltered:!1,pages:[],manuallyFilteredPages:[],pagesByCollectionSource:{object:!0},timeOfLastUpdate:null,label:"Untitled Collection Link"};if(Js.type=="activity"){let Tl={...Js.content};Ls=="page"?(Ks.parentDoenetId=Js.doenetId,Tl=[...Js.content,Ks.doenetId]):Ls=="order"?Tl=[...Js.content,Fs]:Ls=="collectionLink"&&(Tl=[...Js.content,Cl]);let zl={...Js};zl.content=Tl;let Xl=!1;zl.isSinglePage&&(Xl=!0,zl.isSinglePage=!1),await axios.post("/api/updateActivityStructure.php",{courseId:as,doenetId:zl.doenetId,newJSON:Tl,makeMultiPage:Xl}),Us(itemByDoenetId(zl.doenetId),zl),Ls=="page"?Us(itemByDoenetId(Ks.doenetId),Ks):Ls=="order"?(Fs={...Fs,isOpen:!1,isSelected:!1,containingDoenetId:Js.doenetId,parentDoenetId:Js.doenetId},Us(itemByDoenetId(Fs.doenetId),Fs)):Ls=="collectionLink"&&(Cl={...Cl,isOpen:!1,isSelected:!1,containingDoenetId:Js.doenetId,parentDoenetId:Js.doenetId},Us(itemByDoenetId(Cl.doenetId),Cl));let Pl=findContentsChildIds(Js.content),Bl=findContentsChildIds(Tl);Us(authorCourseItemOrderByCourseId(as),Wl=>{let Ll=[...Wl];return Xl||Ll.splice(Ll.indexOf(Js.doenetId)+1,Pl.length),Ll.splice(Ll.indexOf(Js.doenetId)+1,0,...Bl),Ll})}else if(Js.type=="bank"){let Tl=Js.pages[Js.pages.length-1];Js.pages.length==0&&(Tl=Js.doenetId),Ks.parentDoenetId=Js.doenetId;let zl=[...Js.pages,Ks.doenetId],Xl={...Js};Xl.pages=zl,await axios.post("/api/updateCollectionStructure.php",{courseId:as,doenetId:Xl.doenetId,newJSON:zl}),Us(itemByDoenetId(Ks.doenetId),Ks),Us(itemByDoenetId(Xl.doenetId),Xl),Us(authorCourseItemOrderByCourseId(as),Pl=>{let Bl=[...Pl];return Bl.splice(Bl.indexOf(Tl)+1,0,Ks.doenetId),Bl})}else if(Js.type=="order"){let Tl=Js.doenetId,zl=null;Ls=="page"?Ks&&(Ks.parentDoenetId=Tl):Ls=="collectionLink"&&(zl=Cl);const Xl=await js.getPromise(itemByDoenetId(Js.containingDoenetId));let{newContent:Pl,insertedAfterDoenetId:Bl}=cs({content:Xl.content,needleOrderDoenetId:Tl,createdItemType:Ls,createdPageDonenetId:Ks==null?void 0:Ks.doenetId,createdOrderObj:Fs,createdCollectionLink:zl}),Wl={...Xl};Wl.content=Pl,await axios.post("/api/updateActivityStructure.php",{courseId:as,doenetId:Wl.doenetId,newJSON:Pl}),Us(itemByDoenetId(Wl.doenetId),Wl);let Ll;Ls=="page"?(Us(itemByDoenetId(Ks.doenetId),Ks),Ll=Ks.doenetId):Ls=="order"?(Fs.isOpen=!1,Fs.isSelected=!1,Fs.containingDoenetId=Js==null?void 0:Js.containingDoenetId,Fs.parentDoenetId=Js==null?void 0:Js.doenetId,Us(itemByDoenetId(Fs.doenetId),Fs),Ll=yl):Ls=="collectionLink"&&(Cl.isOpen=!1,Cl.isSelected=!1,Cl.containingDoenetId=Js==null?void 0:Js.containingDoenetId,Cl.parentDoenetId=Js==null?void 0:Js.doenetId,Us(itemByDoenetId(Cl.doenetId),Cl),Ll=Al),Us(authorCourseItemOrderByCourseId(as),Hl=>{let Ql=[...Hl];return Ql.splice(Ql.indexOf(Bl)+1,0,Ll),Ql})}else if(Js.type=="page"){Ks&&(Ks.parentDoenetId=Js.parentDoenetId);const Tl=await js.getPromise(itemByDoenetId(Js.containingDoenetId));if(Tl.type=="bank"){let zl=Tl.pages[Tl.pages.length-1],Xl=[...Tl.pages,Ks.doenetId],Pl={...Tl};Pl.pages=Xl,await axios.post("/api/updateCollectionStructure.php",{courseId:as,doenetId:Pl.doenetId,newJSON:Xl}),Us(itemByDoenetId(Ks.doenetId),Ks),Us(itemByDoenetId(Pl.doenetId),Pl),Us(authorCourseItemOrderByCourseId(as),Bl=>{let Wl=[...Bl];return Wl.splice(Wl.indexOf(zl)+1,0,Ks.doenetId),Wl})}else if(Tl.type=="activity"){let zl,Xl;Ls=="page"?{content:Xl,previousDoenetId:zl}=ds({activityOrOrderObj:Tl,needleOrderOrActivityId:Js.parentDoenetId,itemToAdd:Ks==null?void 0:Ks.doenetId}):Ls=="order"&&({content:Xl,previousDoenetId:zl}=ds({activityOrOrderObj:Tl,needleOrderOrActivityId:Js.parentDoenetId,itemToAdd:Fs})),await axios.post("/api/updateActivityStructure.php",{courseId:as,doenetId:Tl.doenetId,newJSON:Xl});let Pl={...Tl};Pl.content=Xl,Fs.isOpen=!1,Fs.isSelected=!1,Fs.containingDoenetId=Js==null?void 0:Js.containingDoenetId,Fs.parentDoenetId=Js==null?void 0:Js.parentDoenetId;let Bl;Ls=="page"?(Us(itemByDoenetId(Ks.doenetId),Ks),Bl=Ks.doenetId):Ls=="order"&&(Us(itemByDoenetId(Fs.doenetId),Fs),Bl=yl),Us(itemByDoenetId(Pl.doenetId),Pl),Us(authorCourseItemOrderByCourseId(as),Wl=>{let Ll=[...Wl];return Ll.splice(Ll.indexOf(zl)+1,0,Bl),Ll})}}}return Zs}),hs=Recoil_index_31(({set:Us})=>async(js,Ls,Gs=ps)=>{try{let Hs=await axios.post("/api/modifyCourse.php",{courseId:as,...js});if(Hs.status<300)Us(coursePermissionsAndSettingsByCourseId(as),({prev:Ys})=>({...Ys,...js})),Ls==null||Ls();else throw new Error(`response code: ${Hs.status}`)}catch(Hs){Gs(Hs.message)}}),gs=useValidateEmail(),ys=Recoil_index_31(({set:Us})=>async(js,Ls,Gs,Hs=ps)=>{try{if(!gs(js))throw new Error("Invalid email, try again");const{data:{success:Ys,message:Xs,userData:Nl}}=await axios.post("/api/addCourseUser.php",{courseId:as,email:js,...Ls});if(Ys)Us(peopleAtomByCourseId(as),xl=>[...xl,{...Nl}]),Gs(Xs);else throw new Error(Xs)}catch(Ys){Hs(Ys.message)}}),bs=Recoil_index_31(({set:Us})=>async(js,Ls,Gs,Hs=ps)=>{try{const{data:{success:Ys,message:Xs}}=await axios.post("/api/updateUserRole.php",{courseId:as,userEmail:js,roleId:Ls});if(Ys)Us(peopleAtomByCourseId(as),Nl=>{const xl=Nl.slice(0),Dl=Nl.findIndex(({email:Rl})=>Rl===js);return xl[Dl]={...Nl[Dl],roleId:Ls},xl}),Gs();else throw new Error(Xs)}catch(Ys){Hs(Ys.message)}}),vs=Recoil_index_31(({set:Us})=>async(js,Ls,Gs,Hs=ps)=>{try{const{data:{success:Ys,message:Xs,actionType:Nl,roleId:xl,updatedPermissions:Dl}}=await axios.post("/api/updateRolePermissions.php",{courseId:as,roleId:js,permissions:{...Ls,label:Ls==null?void 0:Ls.roleLabel}});if(Ys)Us(unfilteredCourseRolesByCourseId(as),Rl=>{const Ml=[...Rl],Zs=Rl.findIndex(({roleId:Qs})=>Qs===xl);let{label:qs}=Dl;switch(qs===void 0&&(qs=Rl[Zs].roleLabel),Nl){case"add":Ml.push({...Dl,roleLabel:qs,roleId:xl});break;case"update":Ml.splice(Zs,1,{...Rl[Zs],...Dl,roleLabel:qs});break;case"delete":Ml.splice(Zs,1);break}return Ml}),Gs();else throw new Error(Xs)}catch(Ys){Hs(Ys.message)}},[as,ps]),xs=Recoil_index_31(({set:Us})=>async(js,Ls=ps)=>{try{let Gs=await axios.post("/api/deleteCourse.php",{courseId:as});if(Gs.status<300)Us(coursePermissionsAndSettings,Hs=>Hs.filter(Ys=>Ys.courseId!==as)),js==null||js();else throw new Error(`response code: ${Gs.status}`)}catch(Gs){Ls(Gs.message)}},[as,ps]),Cs=Recoil_index_31(({set:Us})=>async({dateDifference:js,newLabel:Ls},Gs,Hs=ps)=>{try{let Ys=await axios.post("/api/duplicateCourse.php",{courseId:as,dateDifference:js,newLabel:Ls});if(Ys.status<300)Us(coursePermissionsAndSettings,Ys.data.permissionsAndSettings),Gs==null||Gs();else throw new Error(`response code: ${Ys.status}`)}catch(Ys){Hs(Ys.message)}},[as,ps]),Ts=Recoil_index_31(({snapshot:Us,set:js})=>async(Ls,Gs,Hs,Ys=ps)=>{try{let Xs=await Us.getPromise(cutCourseItems);for(let Dl of Xs)js(itemByDoenetId(Dl.doenetId),Rl=>{let Ml={...Rl};return Ml.isBeingCut=!1,Ml});js(cutCourseItems,[]),js(copiedCourseItems,[]);let Nl=await Us.getPromise(itemByDoenetId(Ls)),xl=await axios.get("/api/renameCourseItem.php",{params:{courseId:as,doenetId:Ls,newLabel:Gs,type:Nl.type}});if(xl.status<300){let Dl=xl.data.item;Nl.type!=="page"&&(Dl.isOpen=Nl.isOpen),js(itemByDoenetId(Ls),Rl=>{let Ml={...Rl};return Ml.label=Dl.label,Ml}),Hs==null||Hs()}else throw new Error(`response code: ${xl.status}`)}catch(Xs){Ys(Xs.message)}},[as,ps]),Ss=Recoil_index_31(({set:Us})=>async({doenetId:js,isAssigned:Ls,successCallback:Gs,failureCallback:Hs=ps})=>{try{let Ys=await axios.get("/api/updateIsAssignedOnAnItem.php",{params:{courseId:as,doenetId:js,isAssigned:Ls}});if(Ys.status<300)Us(itemByDoenetId(js),Xs=>{let Nl={...Xs};return Nl.isAssigned=Ls,Nl}),Gs==null||Gs();else throw new Error(`response code: ${Ys.status}`)}catch(Ys){Hs(Ys.message)}},[as,ps]),Ns=Recoil_index_31(({set:Us,snapshot:js})=>async({activityDoenetId:Ls,successCallback:Gs,isAssigned:Hs=!1,courseId:Ys,failureCallback:Xs=ps})=>{async function Nl({order:Qs,indentLevel:Js=1}){let _l=["behavior","numberToSelect","withReplacement"].filter(Al=>Al in Qs).map(Al=>`${Al}="${Qs[Al]}"`).join(" "),Ks=(await Promise.all(Qs.content.map(Al=>xl({content:Al,indentLevel:Js+1})))).join(""),yl=" ".repeat(Js);return`${yl} +`;function MenuPanel({hide:as,menuPanelCap:rs="",menusTitles:ns=[],currentMenus:ss=[],initOpen:os=[],setMenusOpen:ls,displayProfile:us}){const cs=Recoil_index_20(searchParamAtomFamily("hideLinks")),[ds,ps]=Recoil_index_22(darkModeAtom),fs=Recoil_index_20(selectedMenuPanelAtom),hs=Recoil_index_24(pageToolViewAtom);let gs=[];const ys=reactExports.useRef({DriveInfoCap:reactExports.lazy(()=>__vitePreload(()=>import("./DriveInfoCap-4ef4b8d9.js"),["assets/DriveInfoCap-4ef4b8d9.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js","assets/util-85d105b8.js","assets/util-38d8e238.js"])),DataCap:reactExports.lazy(()=>__vitePreload(()=>import("./DataCap-d09a1607.js"),["assets/DataCap-d09a1607.js","assets/util-85d105b8.js","assets/util-38d8e238.js"])),EditorInfoCap:reactExports.lazy(()=>__vitePreload(()=>import("./EditorInfoCap-0e66e0c4.js"),["assets/EditorInfoCap-0e66e0c4.js","assets/util-85d105b8.js","assets/util-38d8e238.js"])),PortfilioEditorInfoCap:reactExports.lazy(()=>__vitePreload(()=>Promise.resolve().then(()=>PortfilioEditorInfoCap$1),void 0)),AssignmentInfoCap:reactExports.lazy(()=>__vitePreload(()=>import("./AssignmentInfoCap-79691cd2.js"),["assets/AssignmentInfoCap-79691cd2.js","assets/util-85d105b8.js","assets/util-38d8e238.js"])),DraftActivityCap:reactExports.lazy(()=>__vitePreload(()=>import("./DraftActivityCap-6e6d34f3.js"),["assets/DraftActivityCap-6e6d34f3.js","assets/util-85d105b8.js","assets/util-38d8e238.js"])),ContentInfoCap:reactExports.lazy(()=>__vitePreload(()=>import("./ContentInfoCap-cd73424d.js"),["assets/ContentInfoCap-cd73424d.js","assets/util-85d105b8.js","assets/util-38d8e238.js"]))}).current,bs=reactExports.useRef({SelectedCourse:reactExports.lazy(()=>__vitePreload(()=>import("./SelectedCourse-f436f785.js"),["assets/SelectedCourse-f436f785.js","assets/ButtonGroup-ec02b3e9.js","assets/CourseToolHandler-d3661515.js","assets/index-df71c5ec.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/index.esm-d6b6ff57.js","assets/setPrototypeOf-51e8cf87.js","assets/util-10e10a40.css","assets/SettingComponents-aff33cd0.js","assets/CollapseSection-3723ca05.js","assets/util-38d8e238.js","assets/DateTime-b5df08e4.js","assets/moment-a2107d39.js","assets/DateTime-adf9b6b7.css","assets/DropdownMenu-421d3462.js","assets/RelatedItems-23ef0ca1.js","assets/RoleDropdown-2d4e4388.js","assets/Textfield-381b1f5a.js","assets/ActionButton-056b08c3.js","assets/ActionButtonGroup-9e9bafb3.js"])),GradeSettings:reactExports.lazy(()=>__vitePreload(()=>import("./GradeSettings-8ae63bf8.js"),["assets/GradeSettings-8ae63bf8.js","assets/DateTime-b5df08e4.js","assets/moment-a2107d39.js","assets/DateTime-adf9b6b7.css","assets/IncrementMenu-999b207e.js"])),SelectedSection:reactExports.lazy(()=>__vitePreload(()=>import("./SelectedSection-ffa8c49b.js"),["assets/SelectedSection-ffa8c49b.js","assets/ActionButton-056b08c3.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js","assets/Textfield-381b1f5a.js"])),SelectedBank:reactExports.lazy(()=>__vitePreload(()=>import("./SelectedBank-3fb5c91d.js"),["assets/SelectedBank-3fb5c91d.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js","assets/Textfield-381b1f5a.js","assets/ButtonGroup-ec02b3e9.js"])),SelectedDataSources:reactExports.lazy(()=>__vitePreload(()=>import("./SelectedDataSources-54943a22.js"),["assets/SelectedDataSources-54943a22.js","assets/ActionButton-056b08c3.js"])),SelectedActivity:reactExports.lazy(()=>__vitePreload(()=>import("./SelectedActivity-ceb05ae5.js"),["assets/SelectedActivity-ceb05ae5.js","assets/SettingComponents-d432c822.js","assets/DateTime-b5df08e4.js","assets/moment-a2107d39.js","assets/DateTime-adf9b6b7.css","assets/IncrementMenu-999b207e.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js","assets/RelatedItems-23ef0ca1.js","assets/ActionButtonGroup-9e9bafb3.js","assets/ActionButton-056b08c3.js","assets/Textfield-381b1f5a.js","assets/useSaveDraft-50a40c9b.js","assets/EditorViewerRecoil-4f9a7d1d.js","assets/ButtonGroup-ec02b3e9.js","assets/RoleDropdown-2d4e4388.js"])),SelectedOrder:reactExports.lazy(()=>__vitePreload(()=>import("./SelectedOrder-088234de.js"),["assets/SelectedOrder-088234de.js","assets/ButtonGroup-ec02b3e9.js","assets/IncrementMenu-999b207e.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js"])),SelectedPage:reactExports.lazy(()=>__vitePreload(()=>import("./SelectedPage-f34483f1.js"),["assets/SelectedPage-f34483f1.js","assets/Textfield-381b1f5a.js","assets/ButtonGroup-ec02b3e9.js","assets/ActionButton-056b08c3.js","assets/ActionButtonGroup-9e9bafb3.js"])),SelectedPageLink:reactExports.lazy(()=>__vitePreload(()=>import("./SelectedPageLink-5fbaef9b.js"),["assets/SelectedPageLink-5fbaef9b.js","assets/ActionButton-056b08c3.js","assets/ActionButtonGroup-9e9bafb3.js","assets/Textfield-381b1f5a.js"])),SelectedCollectionLink:reactExports.lazy(()=>__vitePreload(()=>import("./SelectedCollectionLink-97faf7ed.js"),["assets/SelectedCollectionLink-97faf7ed.js","assets/ActionButton-056b08c3.js","assets/Textfield-381b1f5a.js","assets/RelatedItems-23ef0ca1.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js"])),CreateCourse:reactExports.lazy(()=>__vitePreload(()=>import("./CreateCourse-a2c1fdb1.js"),["assets/CreateCourse-a2c1fdb1.js","assets/ButtonGroup-ec02b3e9.js"])),CourseEnroll:reactExports.lazy(()=>__vitePreload(()=>import("./CourseEnroll-19514ec8.js"),["assets/CourseEnroll-19514ec8.js","assets/ButtonGroup-ec02b3e9.js"])),AddDriveItems:reactExports.lazy(()=>__vitePreload(()=>import("./AddDriveItems-6860e932.js"),["assets/AddDriveItems-6860e932.js","assets/ButtonGroup-ec02b3e9.js"])),CutCopyPasteMenu:reactExports.lazy(()=>__vitePreload(()=>import("./CutCopyPasteMenu-9197df89.js"),["assets/CutCopyPasteMenu-9197df89.js","assets/ActionButton-056b08c3.js","assets/ActionButtonGroup-9e9bafb3.js"])),EnrollStudents:reactExports.lazy(()=>__vitePreload(()=>import("./EnrollStudents-daea38ea.js"),["assets/EnrollStudents-daea38ea.js","assets/ButtonGroup-ec02b3e9.js"])),DoenetMLSettings:reactExports.lazy(()=>__vitePreload(()=>import("./DoenetMLSettings-d588689f.js"),["assets/DoenetMLSettings-d588689f.js","assets/index-df71c5ec.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/EditorViewerRecoil-4f9a7d1d.js"])),VersionHistory:reactExports.lazy(()=>__vitePreload(()=>import("./VersionHistory-b747a86e.js"),["assets/VersionHistory-b747a86e.js","assets/CourseToolHandler-d3661515.js","assets/index-df71c5ec.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/index.esm-d6b6ff57.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-ec02b3e9.js","assets/util-10e10a40.css","assets/RelatedItems-23ef0ca1.js","assets/EditorViewerRecoil-4f9a7d1d.js"])),PageVariant:reactExports.lazy(()=>__vitePreload(()=>import("./PageVariant-7671ba27.js"),[])),PageLink:reactExports.lazy(()=>__vitePreload(()=>import("./PageLink-35890666.js"),["assets/PageLink-35890666.js","assets/index-fcf36459.js","assets/ActionButton-056b08c3.js","assets/EditorViewerRecoil-4f9a7d1d.js"])),ActivityVariant:reactExports.lazy(()=>__vitePreload(()=>import("./ActivityVariant-548f5f24.js"),["assets/ActivityVariant-548f5f24.js","assets/IncrementMenu-999b207e.js"])),AutoSaves:reactExports.lazy(()=>__vitePreload(()=>import("./AutoSaves-78d41737.js"),[])),LoadPeople:reactExports.lazy(()=>__vitePreload(()=>import("./LoadPeople-09ed85e1.js"),["assets/LoadPeople-09ed85e1.js","assets/index-0a95af27.js","assets/ButtonGroup-ec02b3e9.js","assets/CollapseSection-3723ca05.js"])),GradeUpload:reactExports.lazy(()=>__vitePreload(()=>import("./GradeUpload-eeb366c7.js"),["assets/GradeUpload-eeb366c7.js","assets/index-0a95af27.js","assets/GradebookAssignment-ebb55feb.js","assets/Gradebook-8ee8571a.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-ec02b3e9.js","assets/CollapseSection-3723ca05.js"])),GradeDownload:reactExports.lazy(()=>__vitePreload(()=>import("./GradeDownload-e5fe741a.js"),["assets/GradeDownload-e5fe741a.js","assets/Gradebook-8ee8571a.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js"])),ManualEnrollment:reactExports.lazy(()=>__vitePreload(()=>import("./ManualEnrollment-b6712969.js"),["assets/ManualEnrollment-b6712969.js","assets/LoadPeople-09ed85e1.js","assets/index-0a95af27.js","assets/ButtonGroup-ec02b3e9.js","assets/CollapseSection-3723ca05.js"])),AssignmentSettingsMenu:reactExports.lazy(()=>__vitePreload(()=>import("./AssignmentSettingsMenu-9de82708.js"),["assets/AssignmentSettingsMenu-9de82708.js","assets/SelectedActivity-ceb05ae5.js","assets/SettingComponents-d432c822.js","assets/DateTime-b5df08e4.js","assets/moment-a2107d39.js","assets/DateTime-adf9b6b7.css","assets/IncrementMenu-999b207e.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js","assets/RelatedItems-23ef0ca1.js","assets/ActionButtonGroup-9e9bafb3.js","assets/ActionButton-056b08c3.js","assets/Textfield-381b1f5a.js","assets/useSaveDraft-50a40c9b.js","assets/EditorViewerRecoil-4f9a7d1d.js","assets/ButtonGroup-ec02b3e9.js","assets/RoleDropdown-2d4e4388.js"])),SupportingFilesMenu:reactExports.lazy(()=>__vitePreload(()=>import("./SupportingFilesMenu-4e2d504e.js"),["assets/SupportingFilesMenu-4e2d504e.js","assets/ActionButtonGroup-9e9bafb3.js","assets/ActionButton-056b08c3.js","assets/ButtonGroup-ec02b3e9.js","assets/CollapseSection-3723ca05.js","assets/index-df71c5ec.js","assets/index-fcf36459.js","assets/index-47ca4f11.js"])),GroupSettings:reactExports.lazy(()=>__vitePreload(()=>import("./GroupSettings-b3cf24de.js"),["assets/GroupSettings-b3cf24de.js","assets/index-0a95af27.js","assets/ButtonGroup-ec02b3e9.js","assets/CollapseSection-3723ca05.js"])),TimerMenu:reactExports.lazy(()=>__vitePreload(()=>import("./TimerMenu-54867514.js"),["assets/TimerMenu-54867514.js","assets/CourseToolHandler-d3661515.js","assets/index-df71c5ec.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/index.esm-d6b6ff57.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-ec02b3e9.js","assets/util-10e10a40.css","assets/AssignmentViewer-07288d77.js","assets/ActivityViewer-90c65d6d.js","assets/activityUtils-5d3d0ed0.js","assets/visibility-sensor-aefdbbd5.js","assets/ActionButton-056b08c3.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js"])),CreditAchieved:reactExports.lazy(()=>__vitePreload(()=>import("./CreditAchieved-9610e115.js"),["assets/CreditAchieved-9610e115.js","assets/AssignmentViewer-07288d77.js","assets/ActivityViewer-90c65d6d.js","assets/activityUtils-5d3d0ed0.js","assets/visibility-sensor-aefdbbd5.js","assets/ActionButton-056b08c3.js","assets/ButtonGroup-ec02b3e9.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js","assets/Textfield-381b1f5a.js","assets/Gradebook-8ee8571a.js"])),ActivityDates:reactExports.lazy(()=>__vitePreload(()=>import("./ActivityDates-80b1c5c1.js"),["assets/ActivityDates-80b1c5c1.js","assets/SettingComponents-d432c822.js","assets/DateTime-b5df08e4.js","assets/moment-a2107d39.js","assets/DateTime-adf9b6b7.css","assets/IncrementMenu-999b207e.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js","assets/RelatedItems-23ef0ca1.js","assets/ActionButtonGroup-9e9bafb3.js","assets/ActionButton-056b08c3.js","assets/Textfield-381b1f5a.js","assets/useSaveDraft-50a40c9b.js","assets/EditorViewerRecoil-4f9a7d1d.js","assets/RoleDropdown-2d4e4388.js"])),ClassTimes:reactExports.lazy(()=>__vitePreload(()=>import("./ClassTimes-fa9e96c2.js"),["assets/ClassTimes-fa9e96c2.js","assets/Next7Days-1ee7c537.js","assets/CourseToolHandler-d3661515.js","assets/index-df71c5ec.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/index.esm-d6b6ff57.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-ec02b3e9.js","assets/util-10e10a40.css","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js","assets/DateTime-b5df08e4.js","assets/moment-a2107d39.js","assets/DateTime-adf9b6b7.css"])),CurrentContent:reactExports.lazy(()=>__vitePreload(()=>import("./CurrentContent-3a31b183.js"),["assets/CurrentContent-3a31b183.js","assets/Next7Days-1ee7c537.js","assets/CourseToolHandler-d3661515.js","assets/index-df71c5ec.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/index.esm-d6b6ff57.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-ec02b3e9.js","assets/util-10e10a40.css","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js"])),ManageUsersMenu:reactExports.lazy(()=>__vitePreload(()=>import("./ManageUsersMenu-d49bd6ae.js"),["assets/ManageUsersMenu-d49bd6ae.js","assets/SettingComponents-aff33cd0.js","assets/CourseToolHandler-d3661515.js","assets/index-df71c5ec.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/index.esm-d6b6ff57.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-ec02b3e9.js","assets/util-10e10a40.css","assets/CollapseSection-3723ca05.js","assets/util-38d8e238.js","assets/DateTime-b5df08e4.js","assets/moment-a2107d39.js","assets/DateTime-adf9b6b7.css","assets/DropdownMenu-421d3462.js","assets/RelatedItems-23ef0ca1.js","assets/RoleDropdown-2d4e4388.js","assets/Textfield-381b1f5a.js"]))}).current;let vs=null;if(fs){const Ts=bs[fs];if(Ts){const Ss=`SelectionMenu${fs}`;vs=jsx$1(SelectionMenu,{children:jsx$1(reactExports.Suspense,{fallback:jsx$1(LoadingFallback$1,{children:"loading..."}),children:React.createElement(Ts,{key:Ss})})},Ss)}}let xs=null;rs!==""&&(xs=jsx$1(MenuPanelsCapComponent,{children:jsx$1(reactExports.Suspense,{fallback:jsx$1(LoadingFallback$1,{children:"loading..."}),children:React.createElement(ys[rs])})}));for(let[Ts,Ss]of Object.entries(ss)){const Ns=`${Ss}`,As=ns[Ts];let ws=os[Ts];gs.push(jsx$1(Menu$1,{title:As,isInitOpen:ws,type:Ss,children:jsx$1(reactExports.Suspense,{fallback:jsx$1(LoadingFallback$1,{children:"loading..."}),children:React.createElement(bs[Ss],{mKey:Ns})})},Ns))}let Cs=null;return cs!="true"&&(Cs=jsx$1(SettingsButton,{onClick:()=>hs({page:"settings",tool:"",view:""}),children:jsx$1(FontAwesomeIcon,{icon:faCog})})),jsxs(MenuPanelsWrapper,{hide:as,"aria-label":"menus",children:[jsxs(MenuPanelsCap,{fix:as,role:"banner",children:[jsxs(Branding$1,{style:{marginLeft:"5px"},children:[jsx$1(Logo,{hasLink:cs!="true"}),jsx$1("p",{children:"Doenet"})]}),jsxs(IconsGroup,{children:[jsx$1(CheckboxButton,{checked:ds==="dark",onClick:()=>ps(ds==="dark"?"light":"dark"),checkedIcon:jsx$1(FontAwesomeIcon,{icon:faSun}),uncheckedIcon:jsx$1(FontAwesomeIcon,{icon:faMoon})}),Cs]}),jsx$1("span",{children:jsx$1(CloseButton$1,{onClick:()=>ls(!1),children:jsx$1(FontAwesomeIcon,{icon:faChevronLeft})})})]}),xs,vs,jsx$1("div",{children:gs})]})}function UTCDateStringToDate(as){if(!as||typeof as!="string")return null;let rs=as.split(/[- :]/);return new Date(Date.UTC(rs[0],rs[1]-1,rs[2],rs[3],rs[4],rs[5]))}function formatAMPM(as){var rs=as.getHours(),ns=as.getMinutes(),ss=rs>=12?"PM":"AM";rs=rs%12,rs=rs||12,ns=ns<10?"0"+ns:ns;var os=rs+":"+ns+" "+ss;return os}function DateToUTCDateString(as){var rs=function(ns){return("00"+ns).slice(-2)};return as.getUTCFullYear()+"-"+rs(as.getUTCMonth()+1)+"-"+rs(as.getUTCDate())+" "+rs(as.getUTCHours())+":"+rs(as.getUTCMinutes())+":"+rs(as.getUTCSeconds())}function DateToUTCDateWithoutSecondsString(as){var rs=function(ns){return("00"+ns).slice(-2)};return as.getUTCFullYear()+"-"+rs(as.getUTCMonth()+1)+"-"+rs(as.getUTCDate())+" "+rs(as.getUTCHours())+":"+rs(as.getUTCMinutes())}function DateToDateString(as){var rs=function(ns){return("00"+ns).slice(-2)};return as.getFullYear()+"-"+rs(as.getMonth()+1)+"-"+rs(as.getDate())+" "+rs(as.getHours())+":"+rs(as.getMinutes())+":"+rs(as.getSeconds())}function DateToDisplayDateString(as){var rs=function(ns){return("00"+ns).slice(-2)};return rs(as.getMonth()+1)+"/"+rs(as.getDate())+"/"+as.getFullYear()+" "+formatAMPM(as)}function useValidateEmail(){return reactExports.useCallback(rs=>/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(String(rs).toLowerCase()),[])}const fileByCid=Recoil_index_10({key:"fileByCid",default:Recoil_index_11({key:"fileByCid/Default",get:as=>async()=>{if(!as)return"";try{return(await axios.get(`/media/${as}.doenet`)).data}catch(rs){return rs.response?(console.log(rs.response.data),console.log(rs.response.status),console.log(rs.response.headers)):rs.request?console.log(rs.request):console.log("Error",rs.message),"Error Loading"}}})}),fileByPageId=Recoil_index_10({key:"fileByPageId",default:Recoil_index_11({key:"fileByPageId/Default",get:as=>async()=>{if(!as)return"";try{return(await axios.get(`/media/byPageId/${as}.doenet`)).data}catch(rs){return rs.response?(console.log(rs.response.data),console.log(rs.response.status),console.log(rs.response.headers)):rs.request?console.log(rs.request):console.log("Error",rs.message),"Error Loading"}}})}),peopleAtomByCourseId=Recoil_index_10({key:"peopleAtomByCourseId",default:Recoil_index_11({key:"peopleAtomByCourseId/Default",get:as=>async()=>{const{data:rs}=await axios.get("/api/loadCoursePeople.php",{params:{courseId:as}});return rs.success?rs.peopleArray:[]}})}),peopleByCourseId=Recoil_index_11({key:"peopleByCourseId",get:as=>({get:rs,getCallback:ns})=>{const ss=ns(({set:us})=>async cs=>{let ds={email:cs,courseId:as};try{let ps=await axios.post("/api/withDrawStudents.php",ds);if(ps.status<300)us(peopleAtomByCourseId(as),fs=>{let hs=[...fs];const gs=hs.findIndex(ys=>ys.email==cs);return hs[gs]={...fs[gs],withdrew:"1"},hs});else throw new Error(`response code: ${ps.status}`)}catch{}}),os=ns(({set:us})=>async cs=>{let ds={email:cs,courseId:as};try{let ps=await axios.post("/api/unWithDrawStudents.php",ds);if(ps.status<300)us(peopleAtomByCourseId(as),fs=>{let hs=[...fs];const gs=hs.findIndex(ys=>ys.email==cs);return hs[gs]={...fs[gs],withdrew:"0"},hs});else throw new Error(`response code: ${ps.status}`)}catch{}}),ls=ns(({set:us})=>async(cs,ds)=>{try{let{data:{success:ps,peopleArray:fs,message:hs}}=await axios.post("/api/mergePeopleData.php",{...cs,courseId:as});if(ps)us(peopleAtomByCourseId(as),fs),ds==null||ds();else throw new Error(hs)}catch{}});return{value:rs(peopleAtomByCourseId(as)),recoilWithdraw:ss,recoilUnWithdraw:os,recoilMergeData:ls}}});function buildDoenetIdToParentDoenetIdObj(as,rs=null){let ns={};for(let ss of as)(ss==null?void 0:ss.type)=="order"?ns={...buildDoenetIdToParentDoenetIdObj(ss.content,ss.doenetId),...ns}:rs!==null&&(ns[ss]=rs);return ns}function findFirstPageOfActivity(as=[]){let rs=null;for(let ns of as)if(typeof ns=="string"||ns instanceof String){rs=ns;break}else{let ss=findFirstPageOfActivity(ns.content);if(typeof ss=="string"||ss instanceof String){rs=ss;break}}return rs}function findOrderAndPageDoenetIdsAndSetOrderObjs({set:as,contentArray:rs,assignmentDoenetId:ns,orderDoenetId:ss=null}){let os=[];for(let ls of rs)if((ls==null?void 0:ls.type)=="order"){let us=ls.numberToSelect;us==null&&(us=1);let cs=ls.withReplacement;cs==null&&(cs=!1);let ds=ss;ss==null&&(ds=ns),as(itemByDoenetId(ls.doenetId),{type:"order",doenetId:ls.doenetId,behavior:ls.behavior,numberToSelect:us,withReplacement:cs,containingDoenetId:ns,isOpen:!1,isSelected:!1,parentDoenetId:ds}),os.push(ls.doenetId);let ps=findOrderAndPageDoenetIdsAndSetOrderObjs({set:as,contentArray:ls.content,assignmentDoenetId:ns,orderDoenetId:ls.doenetId});os=[...os,...ps]}else if((ls==null?void 0:ls.type)=="collectionLink"){let us=ss;ss==null&&(us=ns),as(itemByDoenetId(ls.doenetId),{type:"collectionLink",doenetId:ls.doenetId,containingDoenetId:ns,collectionDoenetId:ls.collectionDoenetId,isManuallyFiltered:ls.isManuallyFiltered,pages:ls.pages,pagesByCollectionSource:ls.pagesByCollectionSource,manuallyFilteredPages:ls.manuallyFilteredPages,timeOfLastUpdate:ls.timeOfLastUpdate,label:ls.label,isOpen:!1,isSelected:!1,parentDoenetId:us}),os.push(ls.doenetId);let cs=[...ls.pages];ls.isManuallyFiltered&&(cs=[...ls.manuallyFilteredPages]),os=[...os,...cs]}else os=[...os,ls];return os}function findPageDoenetIdsInAnOrder({content:as,needleOrderDoenetId:rs,foundNeedle:ns=!1}){let ss=[];for(let os of as)if((os==null?void 0:os.type)=="order"){let ls;ns||os.doenetId==rs?ls=findPageDoenetIdsInAnOrder({content:os.content,needleOrderDoenetId:rs,foundNeedle:!0}):ls=findPageDoenetIdsInAnOrder({content:os.content,needleOrderDoenetId:rs,foundNeedle:ns}),ss=[...ss,...ls]}else ns&&ss.push(os);return ss}function findCollectionLinksAndPageLinksInContentArray({content:as,needleOrderDoenentId:rs,foundNeedle:ns=!1}){let ss=[],os=[];for(let ls of as)if((ls==null?void 0:ls.type)=="order"){ls.doenetId==rs&&(ns=!0);let{pageLinkDoenetIds:us,collectionLinkDoenetIds:cs}=findCollectionLinksAndPageLinksInContentArray({content:ls.content,needleOrderDoenentId:rs,foundNeedle:ns});ss=[...ss,...us],os=[...os,...cs]}else(ls==null?void 0:ls.type)=="collectionLink"&&ns&&(ss=[...ss,...ls.pages],os=[...os,ls.doenetId]);return{pageLinkDoenetIds:ss,collectionLinkDoenetIds:os}}function findPageIdsInContentArray({content:as,needleOrderDoenetId:rs,foundNeedle:ns=!1}){let ss=[];for(let os of as)if((os==null?void 0:os.type)=="order"){let ls;ns||os.doenetId==rs?ls=findPageIdsInContentArray({content:os.content,needleOrderDoenetId:rs,foundNeedle:!0}):ls=findPageIdsInContentArray({content:os.content,needleOrderDoenetId:rs,foundNeedle:ns}),ss=[...ss,...ls]}else(os==null?void 0:os.type)!="collectionLink"&&ns&&ss.push(os);return ss}function localizeDates(as,rs){for(let ns of rs)as[ns]&&(as[ns]=UTCDateStringToDate(as[ns]).toLocaleString());return as}let dateKeys=["assignedDate","dueDate","pinnedAfterDate","pinnedUntilDate"];function useInitCourseItems(as){const rs=Recoil_index_31(({snapshot:ns,set:ss})=>async os=>{if(!os)return;if((await ns.getPromise(authorCourseItemOrderByCourseId(os))).length==0){ss(courseIdAtom,os);const{data:us}=await axios.get("/api/getCourseItems.php",{params:{courseId:os}});if(us.success){let cs={},ds=us.items.reduce((ps,fs)=>{if(fs.type!=="page"&&fs.type!=="pageLink"&&ps.push(fs.doenetId),fs.type==="activity"){let hs=buildDoenetIdToParentDoenetIdObj(fs.content,fs.doenetId);cs={...cs,...hs};let gs=findOrderAndPageDoenetIdsAndSetOrderObjs({set:ss,contentArray:fs.content,assignmentDoenetId:fs.doenetId});fs.isSinglePage||(ps=[...ps,...gs])}else fs.type==="bank"?(fs.pages.map(hs=>{cs[hs]=fs.doenetId}),ps=[...ps,...fs.pages]):fs.type==="page"&&(fs.parentDoenetId=cs[fs.doenetId]);return ss(itemByDoenetId(fs.doenetId),localizeDates(fs,dateKeys)),ps},[]);ss(authorCourseItemOrderByCourseId(os),ds)}}},[]);reactExports.useEffect(()=>{as&&rs(as)},[rs,as])}function useSetCourseIdFromDoenetId(as){const[rs,ns]=Recoil_index_22(itemByDoenetId(as)),ss=Recoil_index_24(courseIdAtom);reactExports.useEffect(()=>{Object.keys(rs).length>0||axios.get("/api/getCourseIdFromDoenetId.php",{params:{doenetId:as}}).then(({data:os})=>{os.success?(os.item&&ns(os.item),ss(os.courseId)):ss("__not_found__")}).catch(console.error)},[as])}const courseIdAtom=Recoil_index_8({key:"courseIdAtom",default:null}),authorCollectionsByCourseId=Recoil_index_11({key:"authorCollectionsByCourseId",get:as=>({get:rs})=>{let ns=rs(authorCourseItemOrderByCourseId(as)),ss=[];for(let os of ns){let ls=rs(itemByDoenetId(os));ls.type=="bank"&&ss.push({label:ls.label,doenetId:os})}return ss}}),authorCourseItemOrderByCourseId=Recoil_index_10({key:"authorCourseItemOrderByCourseId",default:[]}),authorCourseItemOrderByCourseIdBySection=Recoil_index_11({key:"authorCourseItemOrderByCourseIdBySection",get:({courseId:as,sectionId:rs})=>({get:ns})=>{let ss=ns(authorCourseItemOrderByCourseId(as));if(rs==as||!rs)return ss;let os=[],ls=!1,us=[rs];for(let cs of ss){if(cs==rs){ls=!0;continue}if(ls){let ds=ns(itemByDoenetId(cs));if(us.includes(ds.parentDoenetId))os.push(cs),ds.type!=="page"&&us.push(cs);else break}}return os}}),studentCourseItemOrderByCourseId=Recoil_index_11({key:"studentCourseItemOrderByCourseId",get:as=>({get:rs})=>rs(authorCourseItemOrderByCourseId(as)).filter(os=>{let ls=rs(itemByDoenetId(os));return ls.isAssigned&&(ls.type=="activity"||ls.type=="section")})}),studentCourseItemOrderByCourseIdBySection=Recoil_index_11({key:"studentCourseItemOrderByCourseId",get:({courseId:as,sectionId:rs})=>({get:ns})=>{let ss=ns(studentCourseItemOrderByCourseId(as)),os=[],ls=!1,us=[rs];(as==rs||!rs)&&(us=[as],ls=!0);for(let cs of ss){if(cs==rs){ls=!0;continue}if(ls){let ds=ns(itemByDoenetId(cs));if(ds.isAssigned&&us.includes(ds.parentDoenetId))os.push(cs),ds.type=="section"&&us.push(cs);else continue}}return os}}),itemByDoenetId=Recoil_index_10({key:"itemByDoenetId",default:{}}),coursePermissionsAndSettings=Recoil_index_8({key:"coursePermissionsAndSettings",default:[],effects:[async({setSelf:as,trigger:rs})=>{if(rs==="get"){const{data:ns}=await axios.get("/api/getCoursePermissionsAndSettings.php");as(ns.permissionsAndSettings)}}]}),coursePermissionsAndSettingsByCourseId=Recoil_index_11({key:"coursePermissionsAndSettingsByCourseId/Default",get:as=>({get:rs})=>rs(coursePermissionsAndSettings).find(ss=>ss.courseId==as)??{},set:as=>({set:rs},ns)=>{rs(coursePermissionsAndSettings,ss=>{const os=[...ss],ls=ss.findIndex(us=>us.courseId===as);return os[ls]={...ss[ls],...ns},os})}}),unfilteredCourseRolesByCourseId=Recoil_index_10({key:"unfilteredCourseRolesByCourseId",effects:as=>[async({setSelf:rs,trigger:ns})=>{if(ns==="get"){const{data:{roles:ss}}=await axios.get("/api/loadCourseRoles.php",{params:{courseId:as}});rs(ss)}}]}),courseRolesByCourseId=Recoil_index_11({key:"filteredCourseRolesByCourseId",get:as=>({get:rs})=>{const ns=rs(coursePermissionsAndSettingsByCourseId(as)),ss=rs(unfilteredCourseRolesByCourseId(as)),os=["isIncludedInGradebook","sectionPermissionOnly","dataAccessPermission","roleId","roleLabel"];return(ss==null?void 0:ss.filter(us=>us.roleId===ns.roleId||!Object.keys(us).every(ds=>(us[ds]??"0")===ns[ds]||os.includes(ds)||(us[ds]??"0")==="1"&&ns[ds]==="0")))??[]}}),courseRolePermissionsByCourseIdRoleId=Recoil_index_11({key:"courseRoleByCourseIdRoleId",get:({courseId:as,roleId:rs})=>({get:ns})=>{var ss;return((ss=ns(unfilteredCourseRolesByCourseId(as)))==null?void 0:ss.find(({roleId:os})=>os===rs))??{}}}),useCreateCourse=()=>({createCourse:Recoil_index_31(({set:rs})=>async()=>{let{data:{permissionsAndSettings:ns,courseId:ss,image:os,color:ls,...us}}=await axios.get("/api/createCourse.php");rs(coursePermissionsAndSettings,ns)})});Recoil_index_10({key:"courseOrderDataByCourseId",default:{completeOrder:[],orderingDataLookup:{}},effects:as=>[({setSelf:rs,onSet:ns,trigger:ss})=>{ns(({completeOrder:os},ls)=>{})}]});const selectedCourseItems=Recoil_index_8({key:"selectedCourseItems",default:[]}),copiedCourseItems=Recoil_index_8({key:"copiedCourseItems",default:[]}),cutCourseItems=Recoil_index_8({key:"cutCourseItems",default:[]});function findContentsChildIds(as){let rs=[];for(let ns of as)if((ns==null?void 0:ns.type)=="order"){let ss=findContentsChildIds(ns.content);rs=[...rs,ns.doenetId,...ss]}else if((ns==null?void 0:ns.type)=="collectionLink"){let ss=[];rs=[...rs,ns.doenetId,...ss]}else rs.push(ns);return rs}const useCourse=as=>{const{label:rs,color:ns,image:ss,defaultRoleId:os,canAutoEnroll:ls}=Recoil_index_20(coursePermissionsAndSettingsByCourseId(as)),us=useToast();function cs({content:Us,needleOrderDoenetId:js,createdItemType:Ls,createdPageDonenetId:Gs=null,createdOrderObj:Hs=null,createdCollectionLink:Ys=null}){let Xs=[...Us],Nl;for(let[xl,Dl]of Object.entries(Us)){if((Dl==null?void 0:Dl.doenetId)==js){let Rl={...Dl};if(Nl=Rl.doenetId,Rl.content.length>0&&(Nl=Rl.content[Rl.content.length-1]),(Nl==null?void 0:Nl.type)=="order"){let Ml=findContentsChildIds(Dl.content);Nl=Nl.doenetId,Ml.length>0&&(Nl=Ml[Ml.length-1])}return Ls=="page"?Rl.content=[...Rl.content,Gs]:Ls=="order"?Rl.content=[...Rl.content,{...Hs}]:Ls=="collectionLink"&&(Rl.content=[...Rl.content,{...Ys}]),Xs.splice(xl,1,Rl),{newContent:Xs,insertedAfterDoenetId:Nl}}if((Dl==null?void 0:Dl.type)=="order"){let{newContent:Rl,insertedAfterDoenetId:Ml}=cs({content:Dl.content,needleOrderDoenetId:js,createdItemType:Ls,createdPageDonenetId:Gs,createdOrderObj:Hs,createdCollectionLink:Ys});if(Rl!=null){let Zs={...Dl};return Zs.content=Rl,Xs.splice(xl,1,Zs),{newContent:Xs,insertedAfterDoenetId:Ml}}}}return{newContent:null,insertedAfterDoenetId:null}}function ds({activityOrOrderObj:Us,needleOrderOrActivityId:js,itemToAdd:Ls}){let Gs=[...Us.content];if(Us.doenetId==js){let Hs=Us.doenetId;return Us.content.length>0&&(Hs=Gs[Gs.length-1],(Hs==null?void 0:Hs.type)=="order"&&(Hs=Hs.doenetId)),Gs=[...Gs,Ls],{content:Gs,previousDoenetId:Hs}}for(let[Hs,Ys]of Object.entries(Us.content))if((Ys==null?void 0:Ys.type)=="order"){let{content:Xs,previousDoenetId:Nl}=ds({activityOrOrderObj:Ys,needleOrderOrActivityId:js,itemToAdd:Ls});if(Xs!=null){let xl={...Ys};return xl.content=Xs,Gs.splice(Hs,1,xl),{content:Gs,previousDoenetId:Nl}}}return{content:null,previousDoenetId:null}}const ps=reactExports.useCallback(Us=>{us(`${Us}`,toastType.ERROR)},[us]),fs=Recoil_index_31(({set:Us,snapshot:js})=>async({itemType:Ls,parentDoenetId:Gs,previousDoenetId:Hs,previousContainingDoenetId:Ys},Xs,Nl=ps)=>{let Dl=[...await js.getPromise(authorCourseItemOrderByCourseId(as))],Rl=await js.getPromise(searchParamAtomFamily("sectionId"));Rl==""&&(Rl=as);let Ml=await js.getPromise(selectedCourseItems);if(Ml.length==1){let Qs=Ml[0],Js=await js.getPromise(itemByDoenetId(Qs));if(Js.type=="section"){let El=await js.getPromise(authorCourseItemOrderByCourseIdBySection({courseId:as,sectionId:Qs})),_l=El[El.length-1];if(Gs=Qs,Hs=_l,!_l)Hs=Qs,Ys=Qs;else{let Ks=await js.getPromise(itemByDoenetId(_l));Hs=_l,Ks.type=="page"||Ks.type=="order"?Ys=Ks.containingDoenetId:(Ks.type=="bank"||Ks.type=="section")&&(Ys=_l)}}else if(Js.type=="activity"||Js.type=="bank"){Gs=Js.parentDoenetId,Ls=="page"&&Js.type=="bank"&&(Gs=Js.doenetId,console.log("page in a bank parentDoenetId:",Gs));let El=await js.getPromise(authorCourseItemOrderByCourseIdBySection({courseId:as,sectionId:Gs})),_l=Gs;if(El.length>0){_l=El[El.length-1];let Ks=await js.getPromise(itemByDoenetId(_l));Hs=_l,Ks.type=="page"||Ks.type=="order"?Ys=Ks.containingDoenetId:(Ks.type=="bank"||Ks.type=="section")&&(Ys=_l)}else Hs=Gs,Ys=Js.parentDoenetId}else if(Js.type=="page"||Js.type=="order"){Gs=(await js.getPromise(itemByDoenetId(Js.containingDoenetId))).parentDoenetId;let _l=await js.getPromise(authorCourseItemOrderByCourseIdBySection({courseId:as,sectionId:Gs})),Ks=_l[_l.length-1],yl=await js.getPromise(itemByDoenetId(Ks));Hs=Ks,yl.type=="page"||yl.type=="order"?Ys=yl.containingDoenetId:(yl.type=="bank"||yl.type=="section")&&(Ys=Ks)}}if(Hs==null){console.log("not a single selection!!!!!");let Qs=await js.getPromise(authorCourseItemOrderByCourseIdBySection({courseId:as,sectionId:Rl})),Js=Qs[Qs.length-1];if(Gs=Rl,Js==null)Hs=Rl,Ys=Rl;else{Hs=Js;let El=await js.getPromise(itemByDoenetId(Js));El.type=="page"||El.type=="order"||El.type=="collectionLink"||El.type=="pageLink"?Ys=El.containingDoenetId:(El.type=="activity"||El.type=="bank"||El.type=="section")&&(Ys=El.doenetId)}}console.log("WHERE IS IT GOING?"),console.log("itemType",Ls),console.log("parentDoenetId",Gs),console.log("previousDoenetId",Hs),console.log("previousContainingDoenetId",Ys);let Zs;if((await js.getPromise(coursePermissionsAndSettingsByCourseId(as))).canEditContent!="1")return null;if(Ls=="activity"){let{data:Qs}=await axios.post("/api/createCourseItem.php",{previousContainingDoenetId:Ys,courseId:as,itemType:Ls,parentDoenetId:Gs}),Js=Qs.doenetId;Zs=Js;let El={timeLimit:null,numberOfAttemptsAllowed:null,totalPointsOrPercent:null,individualize:!1,showSolution:!0,showSolutionInGradebook:!0,showFeedback:!0,showHints:!0,showCorrectness:!0,showCreditAchievedMenu:!0,paginate:!0,showFinishButton:!1,proctorMakesAvailable:!1,autoSubmit:!1,pinnedAfterDate:null,pinnedUntilDate:null,canViewAfterCompleted:"1",...Qs.itemEntered};Us(itemByDoenetId(Js),El);let _l={...Qs.pageEntered,parentDoenetId:Js};Us(itemByDoenetId(Qs.pageDoenetId),_l);let Ks=Dl.indexOf(Hs);Ks==-1?Dl.push(Js):Dl.splice(Ks+1,0,Js),Us(authorCourseItemOrderByCourseId(as),Dl)}else if(Ls=="bank"){let{data:Qs}=await axios.post("/api/createCourseItem.php",{previousContainingDoenetId:Ys,courseId:as,itemType:Ls,parentDoenetId:Gs});console.log("bankData",Qs),Zs=Qs.doenetId,Us(itemByDoenetId(Qs.doenetId),Qs.itemEntered);let Js=Dl.indexOf(Hs);Js==-1?Dl.push(Qs.doenetId):Dl.splice(Js+1,0,Qs.doenetId),Us(authorCourseItemOrderByCourseId(as),Dl)}else if(Ls=="section"){let{data:Qs}=await axios.post("/api/createCourseItem.php",{previousContainingDoenetId:Ys,courseId:as,itemType:Ls,parentDoenetId:Gs});Zs=Qs.doenetId,Us(itemByDoenetId(Qs.doenetId),Qs.itemEntered);let Js=Dl.indexOf(Hs);Js==-1?Dl.push(Qs.doenetId):Dl.splice(Js+1,0,Qs.doenetId),Us(authorCourseItemOrderByCourseId(as),Dl)}else if(Ls=="page"||Ls=="order"||Ls=="collectionLink"){let Qs=(await js.getPromise(selectedCourseItems))[0];const Js=await js.getPromise(itemByDoenetId(Qs));let El;Js.type=="activity"||Js.type=="bank"?El=Js.doenetId:(Js.type=="order"||Js.type=="page")&&(El=Js.containingDoenetId);let{data:_l}=await axios.get("/api/createPageOrOrder.php",{params:{courseId:as,itemType:Ls,containingDoenetId:El}}),{pageThatWasCreated:Ks,orderDoenetIdThatWasCreated:yl,collectionAliasDoenetIdThatWasCreated:Al}=_l,Fs={type:"order",behavior:"sequence",numberToSelect:1,withReplacement:!1,content:[],doenetId:yl},Cl={type:"collectionLink",doenetId:Al,collectionDoenetId:null,isManuallyFiltered:!1,pages:[],manuallyFilteredPages:[],pagesByCollectionSource:{object:!0},timeOfLastUpdate:null,label:"Untitled Collection Link"};if(Js.type=="activity"){let Tl={...Js.content};Ls=="page"?(Ks.parentDoenetId=Js.doenetId,Tl=[...Js.content,Ks.doenetId]):Ls=="order"?Tl=[...Js.content,Fs]:Ls=="collectionLink"&&(Tl=[...Js.content,Cl]);let zl={...Js};zl.content=Tl;let Xl=!1;zl.isSinglePage&&(Xl=!0,zl.isSinglePage=!1),await axios.post("/api/updateActivityStructure.php",{courseId:as,doenetId:zl.doenetId,newJSON:Tl,makeMultiPage:Xl}),Us(itemByDoenetId(zl.doenetId),zl),Ls=="page"?Us(itemByDoenetId(Ks.doenetId),Ks):Ls=="order"?(Fs={...Fs,isOpen:!1,isSelected:!1,containingDoenetId:Js.doenetId,parentDoenetId:Js.doenetId},Us(itemByDoenetId(Fs.doenetId),Fs)):Ls=="collectionLink"&&(Cl={...Cl,isOpen:!1,isSelected:!1,containingDoenetId:Js.doenetId,parentDoenetId:Js.doenetId},Us(itemByDoenetId(Cl.doenetId),Cl));let Pl=findContentsChildIds(Js.content),Bl=findContentsChildIds(Tl);Us(authorCourseItemOrderByCourseId(as),Wl=>{let Ll=[...Wl];return Xl||Ll.splice(Ll.indexOf(Js.doenetId)+1,Pl.length),Ll.splice(Ll.indexOf(Js.doenetId)+1,0,...Bl),Ll})}else if(Js.type=="bank"){let Tl=Js.pages[Js.pages.length-1];Js.pages.length==0&&(Tl=Js.doenetId),Ks.parentDoenetId=Js.doenetId;let zl=[...Js.pages,Ks.doenetId],Xl={...Js};Xl.pages=zl,await axios.post("/api/updateCollectionStructure.php",{courseId:as,doenetId:Xl.doenetId,newJSON:zl}),Us(itemByDoenetId(Ks.doenetId),Ks),Us(itemByDoenetId(Xl.doenetId),Xl),Us(authorCourseItemOrderByCourseId(as),Pl=>{let Bl=[...Pl];return Bl.splice(Bl.indexOf(Tl)+1,0,Ks.doenetId),Bl})}else if(Js.type=="order"){let Tl=Js.doenetId,zl=null;Ls=="page"?Ks&&(Ks.parentDoenetId=Tl):Ls=="collectionLink"&&(zl=Cl);const Xl=await js.getPromise(itemByDoenetId(Js.containingDoenetId));let{newContent:Pl,insertedAfterDoenetId:Bl}=cs({content:Xl.content,needleOrderDoenetId:Tl,createdItemType:Ls,createdPageDonenetId:Ks==null?void 0:Ks.doenetId,createdOrderObj:Fs,createdCollectionLink:zl}),Wl={...Xl};Wl.content=Pl,await axios.post("/api/updateActivityStructure.php",{courseId:as,doenetId:Wl.doenetId,newJSON:Pl}),Us(itemByDoenetId(Wl.doenetId),Wl);let Ll;Ls=="page"?(Us(itemByDoenetId(Ks.doenetId),Ks),Ll=Ks.doenetId):Ls=="order"?(Fs.isOpen=!1,Fs.isSelected=!1,Fs.containingDoenetId=Js==null?void 0:Js.containingDoenetId,Fs.parentDoenetId=Js==null?void 0:Js.doenetId,Us(itemByDoenetId(Fs.doenetId),Fs),Ll=yl):Ls=="collectionLink"&&(Cl.isOpen=!1,Cl.isSelected=!1,Cl.containingDoenetId=Js==null?void 0:Js.containingDoenetId,Cl.parentDoenetId=Js==null?void 0:Js.doenetId,Us(itemByDoenetId(Cl.doenetId),Cl),Ll=Al),Us(authorCourseItemOrderByCourseId(as),Hl=>{let Ql=[...Hl];return Ql.splice(Ql.indexOf(Bl)+1,0,Ll),Ql})}else if(Js.type=="page"){Ks&&(Ks.parentDoenetId=Js.parentDoenetId);const Tl=await js.getPromise(itemByDoenetId(Js.containingDoenetId));if(Tl.type=="bank"){let zl=Tl.pages[Tl.pages.length-1],Xl=[...Tl.pages,Ks.doenetId],Pl={...Tl};Pl.pages=Xl,await axios.post("/api/updateCollectionStructure.php",{courseId:as,doenetId:Pl.doenetId,newJSON:Xl}),Us(itemByDoenetId(Ks.doenetId),Ks),Us(itemByDoenetId(Pl.doenetId),Pl),Us(authorCourseItemOrderByCourseId(as),Bl=>{let Wl=[...Bl];return Wl.splice(Wl.indexOf(zl)+1,0,Ks.doenetId),Wl})}else if(Tl.type=="activity"){let zl,Xl;Ls=="page"?{content:Xl,previousDoenetId:zl}=ds({activityOrOrderObj:Tl,needleOrderOrActivityId:Js.parentDoenetId,itemToAdd:Ks==null?void 0:Ks.doenetId}):Ls=="order"&&({content:Xl,previousDoenetId:zl}=ds({activityOrOrderObj:Tl,needleOrderOrActivityId:Js.parentDoenetId,itemToAdd:Fs})),await axios.post("/api/updateActivityStructure.php",{courseId:as,doenetId:Tl.doenetId,newJSON:Xl});let Pl={...Tl};Pl.content=Xl,Fs.isOpen=!1,Fs.isSelected=!1,Fs.containingDoenetId=Js==null?void 0:Js.containingDoenetId,Fs.parentDoenetId=Js==null?void 0:Js.parentDoenetId;let Bl;Ls=="page"?(Us(itemByDoenetId(Ks.doenetId),Ks),Bl=Ks.doenetId):Ls=="order"&&(Us(itemByDoenetId(Fs.doenetId),Fs),Bl=yl),Us(itemByDoenetId(Pl.doenetId),Pl),Us(authorCourseItemOrderByCourseId(as),Wl=>{let Ll=[...Wl];return Ll.splice(Ll.indexOf(zl)+1,0,Bl),Ll})}}}return Zs}),hs=Recoil_index_31(({set:Us})=>async(js,Ls,Gs=ps)=>{try{let Hs=await axios.post("/api/modifyCourse.php",{courseId:as,...js});if(Hs.status<300)Us(coursePermissionsAndSettingsByCourseId(as),({prev:Ys})=>({...Ys,...js})),Ls==null||Ls();else throw new Error(`response code: ${Hs.status}`)}catch(Hs){Gs(Hs.message)}}),gs=useValidateEmail(),ys=Recoil_index_31(({set:Us})=>async(js,Ls,Gs,Hs=ps)=>{try{if(!gs(js))throw new Error("Invalid email, try again");const{data:{success:Ys,message:Xs,userData:Nl}}=await axios.post("/api/addCourseUser.php",{courseId:as,email:js,...Ls});if(Ys)Us(peopleAtomByCourseId(as),xl=>[...xl,{...Nl}]),Gs(Xs);else throw new Error(Xs)}catch(Ys){Hs(Ys.message)}}),bs=Recoil_index_31(({set:Us})=>async(js,Ls,Gs,Hs=ps)=>{try{const{data:{success:Ys,message:Xs}}=await axios.post("/api/updateUserRole.php",{courseId:as,userEmail:js,roleId:Ls});if(Ys)Us(peopleAtomByCourseId(as),Nl=>{const xl=Nl.slice(0),Dl=Nl.findIndex(({email:Rl})=>Rl===js);return xl[Dl]={...Nl[Dl],roleId:Ls},xl}),Gs();else throw new Error(Xs)}catch(Ys){Hs(Ys.message)}}),vs=Recoil_index_31(({set:Us})=>async(js,Ls,Gs,Hs=ps)=>{try{const{data:{success:Ys,message:Xs,actionType:Nl,roleId:xl,updatedPermissions:Dl}}=await axios.post("/api/updateRolePermissions.php",{courseId:as,roleId:js,permissions:{...Ls,label:Ls==null?void 0:Ls.roleLabel}});if(Ys)Us(unfilteredCourseRolesByCourseId(as),Rl=>{const Ml=[...Rl],Zs=Rl.findIndex(({roleId:Qs})=>Qs===xl);let{label:qs}=Dl;switch(qs===void 0&&(qs=Rl[Zs].roleLabel),Nl){case"add":Ml.push({...Dl,roleLabel:qs,roleId:xl});break;case"update":Ml.splice(Zs,1,{...Rl[Zs],...Dl,roleLabel:qs});break;case"delete":Ml.splice(Zs,1);break}return Ml}),Gs();else throw new Error(Xs)}catch(Ys){Hs(Ys.message)}},[as,ps]),xs=Recoil_index_31(({set:Us})=>async(js,Ls=ps)=>{try{let Gs=await axios.post("/api/deleteCourse.php",{courseId:as});if(Gs.status<300)Us(coursePermissionsAndSettings,Hs=>Hs.filter(Ys=>Ys.courseId!==as)),js==null||js();else throw new Error(`response code: ${Gs.status}`)}catch(Gs){Ls(Gs.message)}},[as,ps]),Cs=Recoil_index_31(({set:Us})=>async({dateDifference:js,newLabel:Ls},Gs,Hs=ps)=>{try{let Ys=await axios.post("/api/duplicateCourse.php",{courseId:as,dateDifference:js,newLabel:Ls});if(Ys.status<300)Us(coursePermissionsAndSettings,Ys.data.permissionsAndSettings),Gs==null||Gs();else throw new Error(`response code: ${Ys.status}`)}catch(Ys){Hs(Ys.message)}},[as,ps]),Ts=Recoil_index_31(({snapshot:Us,set:js})=>async(Ls,Gs,Hs,Ys=ps)=>{try{let Xs=await Us.getPromise(cutCourseItems);for(let Dl of Xs)js(itemByDoenetId(Dl.doenetId),Rl=>{let Ml={...Rl};return Ml.isBeingCut=!1,Ml});js(cutCourseItems,[]),js(copiedCourseItems,[]);let Nl=await Us.getPromise(itemByDoenetId(Ls)),xl=await axios.get("/api/renameCourseItem.php",{params:{courseId:as,doenetId:Ls,newLabel:Gs,type:Nl.type}});if(xl.status<300){let Dl=xl.data.item;Nl.type!=="page"&&(Dl.isOpen=Nl.isOpen),js(itemByDoenetId(Ls),Rl=>{let Ml={...Rl};return Ml.label=Dl.label,Ml}),Hs==null||Hs()}else throw new Error(`response code: ${xl.status}`)}catch(Xs){Ys(Xs.message)}},[as,ps]),Ss=Recoil_index_31(({set:Us})=>async({doenetId:js,isAssigned:Ls,successCallback:Gs,failureCallback:Hs=ps})=>{try{let Ys=await axios.get("/api/updateIsAssignedOnAnItem.php",{params:{courseId:as,doenetId:js,isAssigned:Ls}});if(Ys.status<300)Us(itemByDoenetId(js),Xs=>{let Nl={...Xs};return Nl.isAssigned=Ls,Nl}),Gs==null||Gs();else throw new Error(`response code: ${Ys.status}`)}catch(Ys){Hs(Ys.message)}},[as,ps]),Ns=Recoil_index_31(({set:Us,snapshot:js})=>async({activityDoenetId:Ls,successCallback:Gs,isAssigned:Hs=!1,courseId:Ys,failureCallback:Xs=ps})=>{async function Nl({order:Qs,indentLevel:Js=1}){let _l=["behavior","numberToSelect","withReplacement"].filter(Al=>Al in Qs).map(Al=>`${Al}="${Qs[Al]}"`).join(" "),Ks=(await Promise.all(Qs.content.map(Al=>xl({content:Al,indentLevel:Js+1})))).join(""),yl=" ".repeat(Js);return`${yl} ${Ks}${yl} `}async function xl({content:Qs,indentLevel:Js=1}){if(Qs.type==="order")return await Nl({order:Qs,indentLevel:Js});if(Qs.type==="collectionLink")return(await Promise.all(Qs.pages.map(El=>Dl({pageDoenetId:El,indentLevel:Js+1})))).join("");if(typeof Qs=="string")return await Dl({pageDoenetId:Qs,indentLevel:Js});throw Error("Invalid activity definition: content must be an order or a doenetId specifying a page")}async function Dl({pageDoenetId:Qs,indentLevel:Js=1}){let El=" ".repeat(Js),{data:_l}=await axios.get(`/media/byPageId/${Qs}.doenet`);_l=_l.toString();let Ks={doenetML:_l,pageId:Qs,courseId:Ys,saveAsCid:!0};const{data:yl}=await axios.post("/api/saveDoenetML.php",Ks);if(!yl.success)throw Error(yl.message);let Al=yl.cid;return Us(fileByCid(Al),_l),`${El} `}let Rl=await js.getPromise(itemByDoenetId(Ls)),Ml=` xmlns="https://doenet.org/spec/doenetml/v${Rl.version}" type="activity"`;Rl.itemWeights&&(Ml+=` itemWeights = "${Rl.itemWeights.join(" ")}"`),Rl.shuffleItemWeights&&(Ml+=" shuffleItemWeights"),Rl.numberOfVariants!==void 0&&(Ml+=` numberOfVariants="${Rl.numberOfVariants}"`),Rl.isSinglePage&&(Ml+=" isSinglePage");let Zs="";try{Zs=(await Promise.all(Rl.content.map(Qs=>xl({content:Qs,indentLevel:1})))).join("")}catch(Qs){Xs(Qs.message)}let qs=` @@ -1228,7 +1228,7 @@ ${Zs}`;try{let Qs=await axios.post("/api/saveCompiledActivity.php",{c box-sizing: border-box; border: var(--canvastext); color: var(--canvastext); -`,profileAtom=Recoil_index_8({key:"profileAtom",default:Recoil_index_9({key:"profileAtom/Default",get:async()=>{try{const{data:as}=await axios.get("/api/loadProfile.php");return as.profile}catch(as){return console.error("Error loading user profile",as.message),{}}}})}),searchParamAtomFamily=Recoil_index_10({key:"searchParamAtomFamily",default:""});Recoil_index_8({key:"paramObjAtom",default:{}});function ToolRoot(){const[as,rs]=reactExports.useState({pageName:"init",menuPanelCap:"",currentMenus:[],menusTitles:[],menusInitOpen:[],currentMainPanel:"Empty",supportPanelOptions:[],supportPanelTitles:[],supportPanelIndex:0,hasNoMenuPanel:!1,hasNoHeaderPanel:!1,headerControls:[],displaySettings:!0,footer:null});let ns=null,ss=jsx$1(SupportPanel,{hide:!0,children:"null"});const[os,ls]=reactExports.useState(!0),us=reactExports.useRef({Empty:reactExports.lazy(()=>__vitePreload(()=>import("./Empty-c2716eb1.js"),[])),NotFound:reactExports.lazy(()=>__vitePreload(()=>import("./NotFound-36641b62.js"),[])),AccountSettings:reactExports.lazy(()=>__vitePreload(()=>import("./AccountSettings-761ab97b.js"),["assets/AccountSettings-761ab97b.js","assets/AccountSettings-0a946905.css"])),HomePanel:reactExports.lazy(()=>__vitePreload(()=>import("./HomePanel-b8b5d089.js"),["assets/HomePanel-b8b5d089.js","assets/HomePanel-91e1d724.css"])),PublicActivityViewer:reactExports.lazy(()=>__vitePreload(()=>import("./PublicActivityViewer-527e45ef.js"),["assets/PublicActivityViewer-527e45ef.js","assets/ActivityViewer-5e9601b2.js","assets/activityUtils-3e149527.js","assets/visibility-sensor-398e690f.js","assets/ActionButton-be9a12e7.js","assets/ButtonGroup-6d856500.js"])),CourseCards:reactExports.lazy(()=>__vitePreload(()=>import("./CourseCards-a2430c3c.js"),["assets/CourseCards-a2430c3c.js","assets/CourseToolHandler-d3da4c3a.js","assets/index-1380c04c.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/index.esm-d246f4c9.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-6d856500.js","assets/util-10e10a40.css","assets/CourseCards-d970b417.css"])),SignIn:reactExports.lazy(()=>__vitePreload(()=>import("./SignIn-fbf50818.js"),["assets/SignIn-fbf50818.js","assets/Textfield-637f7b37.js"])),SignOut:reactExports.lazy(()=>__vitePreload(()=>import("./SignOut-fdfc9f92.js"),[])),NavigationPanel:reactExports.lazy(()=>__vitePreload(()=>import("./NavigationPanel-011bc13a.js"),["assets/NavigationPanel-011bc13a.js","assets/CourseNavigator-ee468584.js","assets/index.esm-d246f4c9.js","assets/setPrototypeOf-51e8cf87.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js","assets/ButtonGroup-6d856500.js","assets/util-10e10a40.css"])),Dashboard:reactExports.lazy(()=>__vitePreload(()=>import("./Dashboard-e9a21901.js"),["assets/Dashboard-e9a21901.js","assets/Next7Days-938d1df1.js","assets/CourseToolHandler-d3da4c3a.js","assets/index-1380c04c.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/index.esm-d246f4c9.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-6d856500.js","assets/util-10e10a40.css","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js"])),Gradebook:reactExports.lazy(()=>__vitePreload(()=>import("./Gradebook-bd1a82d1.js"),["assets/Gradebook-bd1a82d1.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js"])),GradebookAssignment:reactExports.lazy(()=>__vitePreload(()=>import("./GradebookAssignment-b8c6c0f7.js"),["assets/GradebookAssignment-b8c6c0f7.js","assets/Gradebook-bd1a82d1.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-6d856500.js"])),GradebookStudent:reactExports.lazy(()=>__vitePreload(()=>import("./GradebookStudent-573d91dc.js"),["assets/GradebookStudent-573d91dc.js","assets/Gradebook-bd1a82d1.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js"])),GradebookStudentAssignment:reactExports.lazy(()=>__vitePreload(()=>import("./GradebookStudentAssignment-a1c9a735.js"),["assets/GradebookStudentAssignment-a1c9a735.js","assets/Gradebook-bd1a82d1.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js","assets/AssignmentViewer-ce09819c.js","assets/ActivityViewer-5e9601b2.js","assets/activityUtils-3e149527.js","assets/visibility-sensor-398e690f.js","assets/ActionButton-be9a12e7.js","assets/ButtonGroup-6d856500.js"])),GradebookAttempt:reactExports.lazy(()=>__vitePreload(()=>import("./GradebookAttempt-3ae08366.js"),["assets/GradebookAttempt-3ae08366.js","assets/Gradebook-bd1a82d1.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js"])),EditorViewer:reactExports.lazy(()=>__vitePreload(()=>import("./EditorViewer-e9155b9a.js").then(bs=>bs.E),["assets/EditorViewer-e9155b9a.js","assets/EditorViewerRecoil-fde09b36.js"])),AssignmentViewer:reactExports.lazy(()=>__vitePreload(()=>import("./AssignmentViewer-ce09819c.js"),["assets/AssignmentViewer-ce09819c.js","assets/ActivityViewer-5e9601b2.js","assets/activityUtils-3e149527.js","assets/visibility-sensor-398e690f.js","assets/ActionButton-be9a12e7.js","assets/ButtonGroup-6d856500.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js"])),DraftAssignmentViewer:reactExports.lazy(()=>__vitePreload(()=>import("./DraftAssignmentViewer-34ee9c14.js"),["assets/DraftAssignmentViewer-34ee9c14.js","assets/ActivityViewer-5e9601b2.js","assets/activityUtils-3e149527.js","assets/visibility-sensor-398e690f.js","assets/ActionButton-be9a12e7.js","assets/ButtonGroup-6d856500.js"])),DataPanel:reactExports.lazy(()=>__vitePreload(()=>import("./DataPanel-2e0e6e03.js"),["assets/DataPanel-2e0e6e03.js","assets/CourseNavigator-ee468584.js","assets/index.esm-d246f4c9.js","assets/setPrototypeOf-51e8cf87.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js","assets/ButtonGroup-6d856500.js","assets/util-10e10a40.css"])),SurveyDataViewer:reactExports.lazy(()=>__vitePreload(()=>import("./SurveyDataViewer-f4e3b1dc.js"),[])),DoenetMLEditor:reactExports.lazy(()=>__vitePreload(()=>import("./DoenetMLEditor-146edab3.js"),["assets/DoenetMLEditor-146edab3.js","assets/CodeMirror-d3d9f7d1.js","assets/useSaveDraft-fc810696.js","assets/EditorViewerRecoil-fde09b36.js"])),People:reactExports.lazy(()=>__vitePreload(()=>import("./People-155b4d87.js"),["assets/People-155b4d87.js","assets/SettingComponents-b208ef07.js","assets/CourseToolHandler-d3da4c3a.js","assets/index-1380c04c.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/index.esm-d246f4c9.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-6d856500.js","assets/util-10e10a40.css","assets/CollapseSection-2629b821.js","assets/util-38d8e238.js","assets/DateTime-3ab576fc.js","assets/moment-b216ba57.js","assets/DateTime-adf9b6b7.css","assets/DropdownMenu-5673dfd7.js","assets/RelatedItems-33d92928.js","assets/RoleDropdown-c9fff172.js","assets/Textfield-637f7b37.js","assets/LoadPeople-6c6c8356.js","assets/index-e425ea7e.js"])),ChooseLearnerPanel:reactExports.lazy(()=>__vitePreload(()=>import("./ChooseLearnerPanel-3c24f42f.js"),["assets/ChooseLearnerPanel-3c24f42f.js","assets/ButtonGroup-6d856500.js"])),SignInRedirector:reactExports.lazy(()=>__vitePreload(()=>import("./SignInRedirector-8329e62b.js"),[])),EndExamPanel:reactExports.lazy(()=>__vitePreload(()=>import("./EndExamPanel-3c93a6d3.js"),[])),EndPlacementExamPanel:reactExports.lazy(()=>__vitePreload(()=>import("./EndPlacementExamPanel-cf6a1a3f.js"),[])),WelcomePlacementExam:reactExports.lazy(()=>__vitePreload(()=>import("./WelcomePlacementExam-5f31a01d.js"),["assets/WelcomePlacementExam-5f31a01d.js","assets/ButtonGroup-6d856500.js"])),GuestDoenetMLEditor:reactExports.lazy(()=>__vitePreload(()=>import("./GuestDoenetMLEditor-f4597794.js"),["assets/GuestDoenetMLEditor-f4597794.js","assets/EditorViewerRecoil-fde09b36.js","assets/CodeMirror-d3d9f7d1.js"])),GuestEditorViewer:reactExports.lazy(()=>__vitePreload(()=>import("./GuestEditorViewer-5820e563.js"),["assets/GuestEditorViewer-5820e563.js","assets/EditorViewer-e9155b9a.js","assets/EditorViewerRecoil-fde09b36.js","assets/activityUtils-3e149527.js"])),RolesEditor:reactExports.lazy(()=>__vitePreload(()=>import("./RoleEditor-94b29764.js"),["assets/RoleEditor-94b29764.js","assets/SettingComponents-b208ef07.js","assets/CourseToolHandler-d3da4c3a.js","assets/index-1380c04c.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/index.esm-d246f4c9.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-6d856500.js","assets/util-10e10a40.css","assets/CollapseSection-2629b821.js","assets/util-38d8e238.js","assets/DateTime-3ab576fc.js","assets/moment-b216ba57.js","assets/DateTime-adf9b6b7.css","assets/DropdownMenu-5673dfd7.js","assets/RelatedItems-33d92928.js","assets/RoleDropdown-c9fff172.js","assets/Textfield-637f7b37.js"]))}).current,cs=reactExports.useRef({BackButton:reactExports.lazy(()=>__vitePreload(()=>import("./BackButton-d0af0861.js"),[])),ViewerUpdateButton:reactExports.lazy(()=>__vitePreload(()=>import("./ViewerUpdateButton-9d2b5cf6.js"),["assets/ViewerUpdateButton-9d2b5cf6.js","assets/EditorViewer-e9155b9a.js","assets/EditorViewerRecoil-fde09b36.js"])),NavigationBreadCrumb:reactExports.lazy(()=>__vitePreload(()=>import("./NavigationBreadCrumb-9442e86e.js"),["assets/NavigationBreadCrumb-9442e86e.js","assets/BreadCrumb-593a3cf1.js","assets/breadcrumbUtil-59c43d86.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js","assets/Gradebook-bd1a82d1.js"])),ChooserBreadCrumb:reactExports.lazy(()=>__vitePreload(()=>import("./ChooserBreadCrumb-5cdc1dba.js"),["assets/ChooserBreadCrumb-5cdc1dba.js","assets/BreadCrumb-593a3cf1.js","assets/breadcrumbUtil-59c43d86.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js","assets/Gradebook-bd1a82d1.js"])),DashboardBreadCrumb:reactExports.lazy(()=>__vitePreload(()=>import("./DashboardBreadCrumb-3dd48300.js"),["assets/DashboardBreadCrumb-3dd48300.js","assets/BreadCrumb-593a3cf1.js","assets/breadcrumbUtil-59c43d86.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js","assets/Gradebook-bd1a82d1.js"])),PeopleBreadCrumb:reactExports.lazy(()=>__vitePreload(()=>import("./PeopleBreadCrumb-d799c6ff.js"),["assets/PeopleBreadCrumb-d799c6ff.js","assets/BreadCrumb-593a3cf1.js","assets/breadcrumbUtil-59c43d86.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js","assets/Gradebook-bd1a82d1.js"])),DataBreadCrumb:reactExports.lazy(()=>__vitePreload(()=>import("./DataBreadCrumb-db1a366b.js"),["assets/DataBreadCrumb-db1a366b.js","assets/BreadCrumb-593a3cf1.js","assets/breadcrumbUtil-59c43d86.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js","assets/Gradebook-bd1a82d1.js"])),EditorBreadCrumb:reactExports.lazy(()=>__vitePreload(()=>import("./EditorBreadCrumb-f495a97f.js"),["assets/EditorBreadCrumb-f495a97f.js","assets/BreadCrumb-593a3cf1.js","assets/breadcrumbUtil-59c43d86.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js","assets/Gradebook-bd1a82d1.js"])),PortfolioBreadCrumb:reactExports.lazy(()=>__vitePreload(()=>import("./PortfolioBreadCrumb-6606c534.js"),["assets/PortfolioBreadCrumb-6606c534.js","assets/BreadCrumb-593a3cf1.js"])),GradebookBreadCrumb:reactExports.lazy(()=>__vitePreload(()=>import("./GradebookBreadCrumb-1b84d12c.js"),["assets/GradebookBreadCrumb-1b84d12c.js","assets/BreadCrumb-593a3cf1.js","assets/breadcrumbUtil-59c43d86.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js","assets/Gradebook-bd1a82d1.js"])),AssignmentBreadCrumb:reactExports.lazy(()=>__vitePreload(()=>import("./AssignmentBreadCrumb-315c8384.js"),["assets/AssignmentBreadCrumb-315c8384.js","assets/BreadCrumb-593a3cf1.js","assets/breadcrumbUtil-59c43d86.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js","assets/Gradebook-bd1a82d1.js"])),AssignmentNewAttempt:reactExports.lazy(()=>__vitePreload(()=>import("./AssignmentNewAttempt-77a38c6d.js"),["assets/AssignmentNewAttempt-77a38c6d.js","assets/CourseToolHandler-d3da4c3a.js","assets/index-1380c04c.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/index.esm-d246f4c9.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-6d856500.js","assets/util-10e10a40.css","assets/AssignmentViewer-ce09819c.js","assets/ActivityViewer-5e9601b2.js","assets/activityUtils-3e149527.js","assets/visibility-sensor-398e690f.js","assets/ActionButton-be9a12e7.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js"])),ActivityNavigationButtons:reactExports.lazy(()=>__vitePreload(()=>import("./ActivityNavigationButtons-dbb0cd4d.js"),["assets/ActivityNavigationButtons-dbb0cd4d.js","assets/ButtonGroup-6d856500.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js"]))}).current,ds=reactExports.useRef({MathInputKeyboard:reactExports.lazy(()=>__vitePreload(()=>import("./MathInputKeyboard-9ed12169.js"),["assets/MathInputKeyboard-9ed12169.js","assets/ToggleButton-0b55a995.js","assets/ToggleButtonGroup-e9ff9889.js","assets/MathInputSelector-84e903aa.js"]))}).current;let ps=`${as.pageName}-${as.currentMainPanel}`;if(ns=jsx$1(reactExports.Suspense,{fallback:jsxs(LoadingFallback,{children:[jsx$1(Svg,{viewBox:"0 0 130 140",children:jsxs(DonutG1,{children:[jsx$1(Circle$2,{id:"donut",fill:"var(--donutBody)",r:"60"}),jsx$1(Circle$2,{id:"donut-topping",fill:"var(--donutTopping)",r:"48"}),jsx$1(Circle$2,{id:"donut-hole",fill:"var(--canvas)",r:"19"})]})}),jsx$1(Svg,{viewBox:"0 0 130 140",children:jsxs(DonutG2,{children:[jsx$1(Circle$2,{id:"donut",fill:"var(--donutBody)",r:"60"}),jsx$1(Circle$2,{id:"donut-topping",fill:"var(--donutTopping)",r:"48"}),jsx$1(Circle$2,{id:"donut-hole",fill:"var(--canvas)",r:"19"})]})}),jsx$1(Svg,{viewBox:"0 0 130 140",children:jsxs(DonutG3,{children:[jsx$1(Circle$2,{id:"donut",fill:"var(--donutBody)",r:"60"}),jsx$1(Circle$2,{id:"donut-topping",fill:"var(--donutTopping)",r:"48"}),jsx$1(Circle$2,{id:"donut-hole",fill:"var(--canvas)",r:"19"})]})})]}),children:React.createElement(us[as.currentMainPanel],{MainPanelKey:ps})},ps),as!=null&&as.supportPanelOptions&&(as==null?void 0:as.supportPanelOptions.length)>0){const bs=as.supportPanelOptions[as.supportPanelIndex],vs=`${as.pageName}-${as.supportPanelOptions[as.supportPanelIndex]}-${as.supportPanelIndex}`;ss=jsx$1(SupportPanel,{hide:!1,panelTitles:as.supportPanelTitles,panelIndex:as.supportPanelIndex,children:jsx$1(reactExports.Suspense,{fallback:jsx$1(LoadingFallback,{display:"static",children:jsx$1(Table$2,{children:jsxs(TBody,{children:[jsxs(Tr$1,{children:[jsx$1(Td$1,{className:"Td2"}),jsx$1(Td$1,{className:"Td3",children:jsx$1(Td3Span,{})})]}),jsxs(Tr$1,{children:[jsx$1(Td$1,{className:"Td2"}),jsx$1(Td$1,{className:"Td3",children:jsx$1(Td3Span,{})})]}),jsxs(Tr$1,{children:[jsx$1(Td$1,{className:"Td2"}),jsx$1(Td$1,{className:"Td3",children:jsx$1(Td3Span,{})})]}),jsxs(Tr$1,{children:[jsx$1(Td$1,{className:"Td2"}),jsx$1(Td$1,{className:"Td3",children:jsx$1(Td3Span,{})})]}),jsxs(Tr$1,{children:[jsx$1(Td$1,{className:"Td2"}),jsx$1(Td$1,{className:"Td3",children:jsx$1(Td3Span,{})})]})]})})}),children:React.createElement(us[bs],{SupportPanelKey:vs})},vs)})}let fs=null;if(as.headerControls){fs=[];for(const[,bs]of Object.entries(as.headerControls)){const vs=cs[bs];if(vs){const xs=`headerControls${ps}`;fs.push(jsx$1(reactExports.Suspense,{fallback:jsx$1(LoadingFallback,{children:jsx$1(BreadcrumbContainer,{children:jsx$1(BreadcrumbOutline,{})})}),children:React.createElement(vs,{key:{key:xs}})},xs))}}}let hs=jsx$1(MenuPanel,{hide:!0},"menuPanel");os&&!as.hasNoMenuPanel&&(hs=jsx$1(MenuPanel,{hide:!1,setMenusOpen:ls,menusOpen:os,menuPanelCap:as.menuPanelCap,menusTitles:as.menusTitles,currentMenus:as.currentMenus,initOpen:as.menusInitOpen,displaySettings:as.displaySettings},"menuPanel"));let gs=!os;as.hasNoMenuPanel&&(gs=!1);let ys=null;if(as.footer){let bs="footer";ys=jsx$1(NavPanel,{id:"keyboard",isInitOpen:as.footer.open,height:as.footer.height,"aria-label":"keyboard",children:jsx$1(reactExports.Suspense,{fallback:jsx$1(LoadingFallback,{children:"loading..."}),children:React.createElement(ds[as.footer.component],{key:{footerKey:bs}})},bs)})}return jsxs(Fragment,{children:[jsxs(ToolContainer,{children:[hs,jsx$1(ContentPanel,{main:jsx$1(MainPanel,{headerControls:fs,setMenusOpen:ls,openMenuButton:gs,displaySettings:as.displaySettings,hasNoHeaderPanel:as.hasNoHeaderPanel,children:ns}),hasNoHeaderPanel:as.hasNoHeaderPanel,support:ss}),ys]}),jsx$1(Toast$1,{}),jsx$1(MemoizedRootController,{setToolRootMenusAndPanels:rs},"root_controller"),jsx$1(MemoizedOnLeave,{},"MemoizedOnLeave")]})}let navigationObj={placementexam:{default:{defaultTool:"exam"},exam:{pageName:"exam",currentMainPanel:"AssignmentViewer",currentMenus:["TimerMenu"],menusTitles:["Time Remaining"],menusInitOpen:[!0],headerControls:[],displaySettings:!1,hasNoMenuPanel:!0,hasNoHeaderPanel:!0,waitForMenuSuppression:!0,footer:{height:250,open:!1,component:"MathInputKeyboard"}},endExam:{pageName:"endExam",currentMainPanel:"EndPlacementExamPanel",displaySettings:!1,hasNoMenuPanel:!0}},umn:{default:{defaultTool:"signIn"},signIn:{pageName:"signIn",currentMainPanel:"SignInRedirector",displaySettings:!1,hasNoMenuPanel:!0}},portfolioeditor:{editor:{pageName:"PortfolioEditor",menuPanelCap:"PortfilioEditorInfoCap",currentMainPanel:"EditorViewer",currentMenus:["PageVariant","PageLink","SupportingFilesMenu"],menusTitles:["Page Variant","Page Link","Supporting Files"],menusInitOpen:[!1,!1],supportPanelOptions:["DoenetMLEditor"],supportPanelTitles:["DoenetML Editor"],supportPanelIndex:0,headerControls:["PortfolioBreadCrumb","ViewerUpdateButton"],footer:{height:250,open:!1,component:"MathInputKeyboard"},waitForMenuSuppression:!0}},exam:{default:{defaultTool:"chooseLearner"},chooseLearner:{pageName:"chooseLearner",currentMainPanel:"ChooseLearnerPanel",displaySettings:!1},assessment:{pageName:"Assessment",menuPanelCap:"AssignmentInfoCap",currentMainPanel:"AssignmentViewer",currentMenus:["TimerMenu"],menusTitles:["Time Remaining"],menusInitOpen:[!0],headerControls:[],displaySettings:!1,waitForMenuSuppression:!0,footer:{height:250,open:!1,component:"MathInputKeyboard"}},endExam:{pageName:"endExam",currentMainPanel:"EndExamPanel",displaySettings:!1,hasNoMenuPanel:!0}},course:{default:{defaultTool:"courseChooser"},assignment:{pageName:"Assignment",menuPanelCap:"AssignmentInfoCap",currentMainPanel:"AssignmentViewer",currentMenus:["CreditAchieved","TimerMenu","ActivityDates"],menusTitles:["Credit Achieved","Time Remaining","Details"],menusInitOpen:[!0,!0,!1],headerControls:["AssignmentBreadCrumb","AssignmentNewAttempt","ActivityNavigationButtons"],waitForMenuSuppression:!0,footer:{height:250,open:!1,component:"MathInputKeyboard"}},courseChooser:{pageName:"Course",currentMainPanel:"CourseCards",currentMenus:["CreateCourse"],menusTitles:["Create Course"],menusInitOpen:[!0],headerControls:["ChooserBreadCrumb"],onLeave:"CourseChooserLeave"},dashboard:{pageName:"Dashboards",currentMainPanel:"Dashboard",menuPanelCap:"DriveInfoCap",currentMenus:["ClassTimes","CurrentContent"],menusTitles:["Class Times","Content by week settings"],menusInitOpen:[!1,!1],headerControls:["DashboardBreadCrumb"],onLeave:"DashboardLeave",waitForMenuSuppression:!0,color:"var(--canvastext)"},draftactivity:{pageName:"DraftActivity",menuPanelCap:"DraftActivityCap",currentMainPanel:"DraftAssignmentViewer",currentMenus:["ActivityVariant"],menusTitles:["Activity Variant"],menusInitOpen:[],headerControls:["AssignmentBreadCrumb"],footer:{height:250,open:!1,component:"MathInputKeyboard"}},endExam:{pageName:"endExam",currentMainPanel:"EndExamPanel",menuPanelCap:"AssignmentInfoCap",currentMenus:["CreditAchieved"],menusTitles:["Credit Achieved"],menusInitOpen:[!0],headerControls:["AssignmentBreadCrumb"]},gradebook:{pageName:"Gradebook",currentMainPanel:"Gradebook",menuPanelCap:"DriveInfoCap",currentMenus:["GradeDownload"],menusTitles:["Download"],menusInitOpen:[!1],headerControls:["GradebookBreadCrumb"],waitForMenuSuppression:!0},gradebookAssignment:{pageName:"Gradebook",currentMainPanel:"GradebookAssignment",currentMenus:["GradeUpload"],menusTitles:["Upload"],menusInitOpen:[!1],menuPanelCap:"DriveInfoCap",headerControls:["GradebookBreadCrumb"],waitForMenuSuppression:!0,onLeave:"GradebookAssignmentLeave"},gradebookStudent:{pageName:"Gradebook",currentMainPanel:"GradebookStudent",currentMenus:[],menuPanelCap:"DriveInfoCap",menusTitles:[],menusInitOpen:[],headerControls:["GradebookBreadCrumb"]},gradebookStudentAssignment:{pageName:"Gradebook",currentMainPanel:"GradebookStudentAssignment",menuPanelCap:"DriveInfoCap",currentMenus:["CreditAchieved","GradeSettings"],menusTitles:["Credit Achieved","Settings"],menusInitOpen:[!0,!1],headerControls:["GradebookBreadCrumb"],waitForMenuSuppression:!0},navigation:{pageName:"Course",currentMainPanel:"NavigationPanel",menuPanelCap:"DriveInfoCap",currentMenus:["CutCopyPasteMenu","AddDriveItems"],menusTitles:["Cut, Copy and Paste","Add Items"],menusInitOpen:[!0,!0],headerControls:["NavigationBreadCrumb"],onLeave:"NavigationLeave",waitForMenuSuppression:!0},editor:{pageName:"Course",menuPanelCap:"EditorInfoCap",currentMainPanel:"EditorViewer",currentMenus:["PageVariant","PageLink","AssignmentSettingsMenu","SupportingFilesMenu"],menusTitles:["Page Variant","Page Link","Assignment Settings","Supporting Files"],menusInitOpen:[!1,!1],supportPanelOptions:["DoenetMLEditor"],supportPanelTitles:["DoenetML Editor"],supportPanelIndex:0,headerControls:["EditorBreadCrumb","ViewerUpdateButton"],footer:{height:250,open:!1,component:"MathInputKeyboard"},waitForMenuSuppression:!0},people:{pageName:"People",menuPanelCap:"DriveInfoCap",currentMenus:["LoadPeople"],menusTitles:["Import Learners"],menusInitOpen:[!1],currentMainPanel:"People",supportPanelOptions:["RolesEditor"],supportPanelTitles:["Roles Editor"],supportPanelIndex:0,headerControls:["PeopleBreadCrumb"],initialProportion:1},data:{pageName:"data",menuPanelCap:"DataCap",currentMainPanel:"DataPanel",headerControls:["DataBreadCrumb"]}},home:{default:{pageName:"Home",currentMenus:[],menusTitles:[],menusInitOpen:[],currentMainPanel:"HomePanel",supportPanelOptions:[],supportPanelTitles:[],supportPanelIndex:0,hasNoMenuPanel:!0,hasNoHeaderPanel:!0,displaySettings:!1}},notfound:{default:{pageName:"Notfound",currentMenus:[],menusInitOpen:[],currentMainPanel:"NotFound",supportPanelOptions:[],hasNoMenuPanel:!0}},public:{default:{pageName:"PublicActivityViewer",currentMenus:[],menusTitles:[],menusInitOpen:[],currentMainPanel:"PublicActivityViewer",supportPanelOptions:[],supportPanelTitles:[],supportPanelIndex:0,hasNoMenuPanel:!0},editor:{pageName:"GuestEditor",currentMainPanel:"GuestEditorViewer",currentMenus:["PageVariant"],menusTitles:["Page Variant"],menusInitOpen:[!1],supportPanelOptions:["GuestDoenetMLEditor"],supportPanelTitles:["DoenetML Editor"],supportPanelIndex:0,headerControls:["ViewerUpdateButton"],footer:{height:250,open:!1,component:"MathInputKeyboard"}}},settings:{default:{pageName:"Settings",currentMenus:[],menusTitles:[],menusInitOpen:[],currentMainPanel:"AccountSettings",supportPanelOptions:[],supportPanelTitles:[],supportPanelIndex:0,hasNoMenuPanel:!0,headerControls:["BackButton"],displaySettings:!1}},signin:{default:{pageName:"SignIn",currentMenus:[],menusTitles:[],menusInitOpen:[],currentMainPanel:"SignIn",supportPanelOptions:[],supportPanelTitles:[],supportPanelIndex:0,hasNoMenuPanel:!0,displaySettings:!1}},signout:{default:{pageName:"SignOut",currentMenus:[],menusTitles:[],menusInitOpen:[],currentMainPanel:"SignOut",supportPanelOptions:[],supportPanelTitles:[],supportPanelIndex:0,hasNoMenuPanel:!0,displaySettings:!1}}},encodeParams=as=>Object.entries(as).map(rs=>rs.map(encodeURIComponent).join("=")).join("&");const pageToolViewAtom=Recoil_index_8({key:"pageToolViewAtom",default:{page:"init",tool:"",view:""}}),onLeaveComponentStr=Recoil_index_8({key:"onLeaveComponentStr",default:{str:null,updateNum:0}});Recoil_index_8({key:"finishedOnLeave",default:null});const MemoizedOnLeave=React.memo(OnLeave);function OnLeave(){const rs=Recoil_index_20(onLeaveComponentStr).str;let ns=null;const ss=reactExports.useRef({NavigationLeave:reactExports.lazy(()=>__vitePreload(()=>import("./NavigationLeave-d3da91ff.js"),[])),CourseChooserLeave:reactExports.lazy(()=>__vitePreload(()=>import("./CourseChooserLeave-57eb280d.js"),["assets/CourseChooserLeave-57eb280d.js","assets/CourseToolHandler-d3da4c3a.js","assets/index-1380c04c.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/index.esm-d246f4c9.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-6d856500.js","assets/util-10e10a40.css"])),DashboardLeave:reactExports.lazy(()=>__vitePreload(()=>import("./DashboardLeave-c20e7b28.js"),["assets/DashboardLeave-c20e7b28.js","assets/CourseToolHandler-d3da4c3a.js","assets/index-1380c04c.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/index.esm-d246f4c9.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-6d856500.js","assets/util-10e10a40.css"])),GradebookAssignmentLeave:reactExports.lazy(()=>__vitePreload(()=>import("./GradebookAssignmentLeave-03ee1900.js"),["assets/GradebookAssignmentLeave-03ee1900.js","assets/GradebookAssignment-b8c6c0f7.js","assets/Gradebook-bd1a82d1.js","assets/RoleDropdown-c9fff172.js","assets/DropdownMenu-5673dfd7.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-6d856500.js"]))}).current;if(rs){const os=`leave${rs}`;ns=jsx$1(reactExports.Suspense,{fallback:null,children:React.createElement(ss[rs])},os)}return jsx$1(Fragment,{children:ns})}const suppressMenusAtom=Recoil_index_8({key:"suppressMenusAtom",default:null});function arraysEqual(as,rs){if(as===rs)return!0;if(as==null||rs==null||as.length!==rs.length)return!1;for(var ns=0;nsks=>{for(const[Ps,Bs]of Object.entries(ks))bs.current[Ps]!==Bs&&Vs(searchParamAtomFamily(Ps),Bs);for(const Ps of Object.keys(bs.current))ks[Ps]||Vs(searchParamAtomFamily(Ps),"")});let xs=reactExports.useRef(null),Cs=reactExports.useRef([]),Ts=`${gs.pathname}${gs.search}`,Ss={page:"",tool:"",view:""},Ns=null,As=(Ds=(Os=navigationObj[rs.page])==null?void 0:Os[rs.tool])==null?void 0:Ds.initialProportion;reactExports.useEffect(()=>{let Vs=As;Vs||(Vs=.5),us(ks=>{let Ps={...ks};return Ps.proportion=Vs,Ps})},[As]);let ws=!arraysEqual(os,Cs.current);if(Cs.current=os,ws&&os!==null){if(Ns={...navigationObj[rs.page][rs.tool]},Ns.currentMenus=[...navigationObj[rs.page][rs.tool].currentMenus],Ns.menusTitles=[...navigationObj[rs.page][rs.tool].menusTitles],Ns.menusInitOpen=[...navigationObj[rs.page][rs.tool].menusInitOpen],os.length>0)for(let Vs of os)for(let[ks,Ps]of Object.entries(Ns.currentMenus))Ps===Vs&&(Ns.currentMenus.splice(ks,1),Ns.menusTitles.splice(ks,1),Ns.menusInitOpen.splice(ks,1));return as.setToolRootMenusAndPanels(Ns),null}let Es=!1;if(Ts!==hs.current){if(Es=!0,Ss.page=gs.pathname.split("/")[1].toLowerCase(),Ss.page===""){Ss.page="home";const ks=window.location.origin+window.location.pathname+"home";window.history.replaceState("","",ks)}let Vs=Object.fromEntries(new URLSearchParams(gs.search));Ss.tool=Vs.tool,Ss.tool||(Ss.tool="")}let _s=!1;if(JSON.stringify(cs.current)!==JSON.stringify(rs)){if(_s=!0,rs.back){ds.current.page==="init"&&(ds.current.page="home");let Vs={...ds.current,params:ps.current};return ns(Vs),null}Ss={...rs}}if(!Es&&!_s)return hs.current=Ts,null;let $s=!1,Rs=!1;cs.current.page!==Ss.page?($s=!0,Ss.tool===""?(Ns=navigationObj[Ss.page].default,Object.keys(Ns).includes("defaultTool")&&(window.location.pathname+gs.pathname+""+encodeParams({tool:Ns.defaultTool}),Ns=navigationObj[Ss.page][Ns.defaultTool])):Ns=navigationObj[Ss.page][Ss.tool]):cs.current.tool!==Ss.tool?(Rs=!0,Ns=navigationObj[Ss.page][Ss.tool]):cs.current.view!==Ss.view&&(Ns={...navigationObj[Ss.page][Ss.tool]});let Is={};if(Es&&(Is=Object.fromEntries(new URLSearchParams(gs.search)),vs(Is),Ss.params={...Is},delete Ss.params.tool,ns(Ss)),($s||Rs)&&(xs.current&&ss(Vs=>({str:xs.current,updateNum:Vs.updateNum+1})),xs.current=null,Ns&&Ns.onLeave&&(xs.current=Ns.onLeave),ls(null)),Ns&&Ns.displaySettings===void 0&&(Ns.displaySettings=!0),Ns&&JSON.stringify(Ss)!==JSON.stringify(cs.current)){ds.current=cs.current;let Vs={};if(Es?Vs=Is:_s&&(Vs=rs.params),ps.current=fs.current,fs.current=Vs,Ns.waitForMenuSuppression){let ks={...Ns};ks.currentMenus=[],ks.menusInitOpen=[],ks.menusTitles=[],ks.headerControls=[],as.setToolRootMenusAndPanels(ks)}else as.setToolRootMenusAndPanels(Ns)}if(_s){let Vs=Ss.tool,ks="/"+rs.page;Is={...rs.params},Vs!==""&&Vs!==void 0&&(Is={tool:Vs,...rs.params});let Ps="";Object.keys(Is).length>0&&(Ps="?"+encodeParams(Is));const Bs=ks+Ps;gs.search!==Ps&&vs(Is),(gs.pathname!==ks||gs.search!==Ps)&&ys(Bs)}return bs.current=Is,hs.current=Ts,cs.current=Ss,null}const LoadingFallback=styled$1.div` +`,profileAtom=Recoil_index_8({key:"profileAtom",default:Recoil_index_9({key:"profileAtom/Default",get:async()=>{try{const{data:as}=await axios.get("/api/loadProfile.php");return as.profile}catch(as){return console.error("Error loading user profile",as.message),{}}}})}),searchParamAtomFamily=Recoil_index_10({key:"searchParamAtomFamily",default:""});Recoil_index_8({key:"paramObjAtom",default:{}});function ToolRoot(){const[as,rs]=reactExports.useState({pageName:"init",menuPanelCap:"",currentMenus:[],menusTitles:[],menusInitOpen:[],currentMainPanel:"Empty",supportPanelOptions:[],supportPanelTitles:[],supportPanelIndex:0,hasNoMenuPanel:!1,hasNoHeaderPanel:!1,headerControls:[],displaySettings:!0,footer:null});let ns=null,ss=jsx$1(SupportPanel,{hide:!0,children:"null"});const[os,ls]=reactExports.useState(!0),us=reactExports.useRef({Empty:reactExports.lazy(()=>__vitePreload(()=>import("./Empty-f2fdb837.js"),[])),NotFound:reactExports.lazy(()=>__vitePreload(()=>import("./NotFound-dedd3d97.js"),[])),AccountSettings:reactExports.lazy(()=>__vitePreload(()=>import("./AccountSettings-caa967b3.js"),["assets/AccountSettings-caa967b3.js","assets/AccountSettings-0a946905.css"])),HomePanel:reactExports.lazy(()=>__vitePreload(()=>import("./HomePanel-2c43f60b.js"),["assets/HomePanel-2c43f60b.js","assets/HomePanel-91e1d724.css"])),PublicActivityViewer:reactExports.lazy(()=>__vitePreload(()=>import("./PublicActivityViewer-c7720a07.js"),["assets/PublicActivityViewer-c7720a07.js","assets/ActivityViewer-90c65d6d.js","assets/activityUtils-5d3d0ed0.js","assets/visibility-sensor-aefdbbd5.js","assets/ActionButton-056b08c3.js","assets/ButtonGroup-ec02b3e9.js"])),CourseCards:reactExports.lazy(()=>__vitePreload(()=>import("./CourseCards-25c0dcb5.js"),["assets/CourseCards-25c0dcb5.js","assets/CourseToolHandler-d3661515.js","assets/index-df71c5ec.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/index.esm-d6b6ff57.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-ec02b3e9.js","assets/util-10e10a40.css","assets/CourseCards-d970b417.css"])),SignIn:reactExports.lazy(()=>__vitePreload(()=>import("./SignIn-d0bccc38.js"),["assets/SignIn-d0bccc38.js","assets/Textfield-381b1f5a.js"])),SignOut:reactExports.lazy(()=>__vitePreload(()=>import("./SignOut-e3aea9bd.js"),[])),NavigationPanel:reactExports.lazy(()=>__vitePreload(()=>import("./NavigationPanel-09d99c8d.js"),["assets/NavigationPanel-09d99c8d.js","assets/CourseNavigator-f7abeab6.js","assets/index.esm-d6b6ff57.js","assets/setPrototypeOf-51e8cf87.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js","assets/ButtonGroup-ec02b3e9.js","assets/util-10e10a40.css"])),Dashboard:reactExports.lazy(()=>__vitePreload(()=>import("./Dashboard-c8b632ce.js"),["assets/Dashboard-c8b632ce.js","assets/Next7Days-1ee7c537.js","assets/CourseToolHandler-d3661515.js","assets/index-df71c5ec.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/index.esm-d6b6ff57.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-ec02b3e9.js","assets/util-10e10a40.css","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js"])),Gradebook:reactExports.lazy(()=>__vitePreload(()=>import("./Gradebook-8ee8571a.js"),["assets/Gradebook-8ee8571a.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js"])),GradebookAssignment:reactExports.lazy(()=>__vitePreload(()=>import("./GradebookAssignment-ebb55feb.js"),["assets/GradebookAssignment-ebb55feb.js","assets/Gradebook-8ee8571a.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-ec02b3e9.js"])),GradebookStudent:reactExports.lazy(()=>__vitePreload(()=>import("./GradebookStudent-db8cf044.js"),["assets/GradebookStudent-db8cf044.js","assets/Gradebook-8ee8571a.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js"])),GradebookStudentAssignment:reactExports.lazy(()=>__vitePreload(()=>import("./GradebookStudentAssignment-ff3c95c3.js"),["assets/GradebookStudentAssignment-ff3c95c3.js","assets/Gradebook-8ee8571a.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js","assets/AssignmentViewer-07288d77.js","assets/ActivityViewer-90c65d6d.js","assets/activityUtils-5d3d0ed0.js","assets/visibility-sensor-aefdbbd5.js","assets/ActionButton-056b08c3.js","assets/ButtonGroup-ec02b3e9.js"])),GradebookAttempt:reactExports.lazy(()=>__vitePreload(()=>import("./GradebookAttempt-d9aa00d2.js"),["assets/GradebookAttempt-d9aa00d2.js","assets/Gradebook-8ee8571a.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js"])),EditorViewer:reactExports.lazy(()=>__vitePreload(()=>import("./EditorViewer-34bd5cb9.js").then(bs=>bs.E),["assets/EditorViewer-34bd5cb9.js","assets/EditorViewerRecoil-4f9a7d1d.js"])),AssignmentViewer:reactExports.lazy(()=>__vitePreload(()=>import("./AssignmentViewer-07288d77.js"),["assets/AssignmentViewer-07288d77.js","assets/ActivityViewer-90c65d6d.js","assets/activityUtils-5d3d0ed0.js","assets/visibility-sensor-aefdbbd5.js","assets/ActionButton-056b08c3.js","assets/ButtonGroup-ec02b3e9.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js"])),DraftAssignmentViewer:reactExports.lazy(()=>__vitePreload(()=>import("./DraftAssignmentViewer-cbb79d23.js"),["assets/DraftAssignmentViewer-cbb79d23.js","assets/ActivityViewer-90c65d6d.js","assets/activityUtils-5d3d0ed0.js","assets/visibility-sensor-aefdbbd5.js","assets/ActionButton-056b08c3.js","assets/ButtonGroup-ec02b3e9.js"])),DataPanel:reactExports.lazy(()=>__vitePreload(()=>import("./DataPanel-9cb3d814.js"),["assets/DataPanel-9cb3d814.js","assets/CourseNavigator-f7abeab6.js","assets/index.esm-d6b6ff57.js","assets/setPrototypeOf-51e8cf87.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js","assets/ButtonGroup-ec02b3e9.js","assets/util-10e10a40.css"])),SurveyDataViewer:reactExports.lazy(()=>__vitePreload(()=>import("./SurveyDataViewer-0d99a85c.js"),[])),DoenetMLEditor:reactExports.lazy(()=>__vitePreload(()=>import("./DoenetMLEditor-e9b9ebf8.js"),["assets/DoenetMLEditor-e9b9ebf8.js","assets/CodeMirror-af01bb34.js","assets/useSaveDraft-50a40c9b.js","assets/EditorViewerRecoil-4f9a7d1d.js"])),People:reactExports.lazy(()=>__vitePreload(()=>import("./People-27f6f91c.js"),["assets/People-27f6f91c.js","assets/SettingComponents-aff33cd0.js","assets/CourseToolHandler-d3661515.js","assets/index-df71c5ec.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/index.esm-d6b6ff57.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-ec02b3e9.js","assets/util-10e10a40.css","assets/CollapseSection-3723ca05.js","assets/util-38d8e238.js","assets/DateTime-b5df08e4.js","assets/moment-a2107d39.js","assets/DateTime-adf9b6b7.css","assets/DropdownMenu-421d3462.js","assets/RelatedItems-23ef0ca1.js","assets/RoleDropdown-2d4e4388.js","assets/Textfield-381b1f5a.js","assets/LoadPeople-09ed85e1.js","assets/index-0a95af27.js"])),ChooseLearnerPanel:reactExports.lazy(()=>__vitePreload(()=>import("./ChooseLearnerPanel-dfc6c714.js"),["assets/ChooseLearnerPanel-dfc6c714.js","assets/ButtonGroup-ec02b3e9.js"])),SignInRedirector:reactExports.lazy(()=>__vitePreload(()=>import("./SignInRedirector-9f531e33.js"),[])),EndExamPanel:reactExports.lazy(()=>__vitePreload(()=>import("./EndExamPanel-f757516f.js"),[])),EndPlacementExamPanel:reactExports.lazy(()=>__vitePreload(()=>import("./EndPlacementExamPanel-c8e29e90.js"),[])),WelcomePlacementExam:reactExports.lazy(()=>__vitePreload(()=>import("./WelcomePlacementExam-54d3df1c.js"),["assets/WelcomePlacementExam-54d3df1c.js","assets/ButtonGroup-ec02b3e9.js"])),GuestDoenetMLEditor:reactExports.lazy(()=>__vitePreload(()=>import("./GuestDoenetMLEditor-d3fb52c1.js"),["assets/GuestDoenetMLEditor-d3fb52c1.js","assets/EditorViewerRecoil-4f9a7d1d.js","assets/CodeMirror-af01bb34.js"])),GuestEditorViewer:reactExports.lazy(()=>__vitePreload(()=>import("./GuestEditorViewer-51c16816.js"),["assets/GuestEditorViewer-51c16816.js","assets/EditorViewer-34bd5cb9.js","assets/EditorViewerRecoil-4f9a7d1d.js","assets/activityUtils-5d3d0ed0.js"])),RolesEditor:reactExports.lazy(()=>__vitePreload(()=>import("./RoleEditor-29021e6b.js"),["assets/RoleEditor-29021e6b.js","assets/SettingComponents-aff33cd0.js","assets/CourseToolHandler-d3661515.js","assets/index-df71c5ec.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/index.esm-d6b6ff57.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-ec02b3e9.js","assets/util-10e10a40.css","assets/CollapseSection-3723ca05.js","assets/util-38d8e238.js","assets/DateTime-b5df08e4.js","assets/moment-a2107d39.js","assets/DateTime-adf9b6b7.css","assets/DropdownMenu-421d3462.js","assets/RelatedItems-23ef0ca1.js","assets/RoleDropdown-2d4e4388.js","assets/Textfield-381b1f5a.js"]))}).current,cs=reactExports.useRef({BackButton:reactExports.lazy(()=>__vitePreload(()=>import("./BackButton-757dc0d9.js"),[])),ViewerUpdateButton:reactExports.lazy(()=>__vitePreload(()=>import("./ViewerUpdateButton-cefc1561.js"),["assets/ViewerUpdateButton-cefc1561.js","assets/EditorViewer-34bd5cb9.js","assets/EditorViewerRecoil-4f9a7d1d.js"])),NavigationBreadCrumb:reactExports.lazy(()=>__vitePreload(()=>import("./NavigationBreadCrumb-dc2c0cfb.js"),["assets/NavigationBreadCrumb-dc2c0cfb.js","assets/BreadCrumb-56e53fc8.js","assets/breadcrumbUtil-379dd524.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js","assets/Gradebook-8ee8571a.js"])),ChooserBreadCrumb:reactExports.lazy(()=>__vitePreload(()=>import("./ChooserBreadCrumb-6675d364.js"),["assets/ChooserBreadCrumb-6675d364.js","assets/BreadCrumb-56e53fc8.js","assets/breadcrumbUtil-379dd524.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js","assets/Gradebook-8ee8571a.js"])),DashboardBreadCrumb:reactExports.lazy(()=>__vitePreload(()=>import("./DashboardBreadCrumb-637e9e68.js"),["assets/DashboardBreadCrumb-637e9e68.js","assets/BreadCrumb-56e53fc8.js","assets/breadcrumbUtil-379dd524.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js","assets/Gradebook-8ee8571a.js"])),PeopleBreadCrumb:reactExports.lazy(()=>__vitePreload(()=>import("./PeopleBreadCrumb-01e59fc2.js"),["assets/PeopleBreadCrumb-01e59fc2.js","assets/BreadCrumb-56e53fc8.js","assets/breadcrumbUtil-379dd524.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js","assets/Gradebook-8ee8571a.js"])),DataBreadCrumb:reactExports.lazy(()=>__vitePreload(()=>import("./DataBreadCrumb-965135e5.js"),["assets/DataBreadCrumb-965135e5.js","assets/BreadCrumb-56e53fc8.js","assets/breadcrumbUtil-379dd524.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js","assets/Gradebook-8ee8571a.js"])),EditorBreadCrumb:reactExports.lazy(()=>__vitePreload(()=>import("./EditorBreadCrumb-a1000e9a.js"),["assets/EditorBreadCrumb-a1000e9a.js","assets/BreadCrumb-56e53fc8.js","assets/breadcrumbUtil-379dd524.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js","assets/Gradebook-8ee8571a.js"])),PortfolioBreadCrumb:reactExports.lazy(()=>__vitePreload(()=>import("./PortfolioBreadCrumb-b9513dfa.js"),["assets/PortfolioBreadCrumb-b9513dfa.js","assets/BreadCrumb-56e53fc8.js"])),GradebookBreadCrumb:reactExports.lazy(()=>__vitePreload(()=>import("./GradebookBreadCrumb-ca81a1ab.js"),["assets/GradebookBreadCrumb-ca81a1ab.js","assets/BreadCrumb-56e53fc8.js","assets/breadcrumbUtil-379dd524.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js","assets/Gradebook-8ee8571a.js"])),AssignmentBreadCrumb:reactExports.lazy(()=>__vitePreload(()=>import("./AssignmentBreadCrumb-7ae15ea8.js"),["assets/AssignmentBreadCrumb-7ae15ea8.js","assets/BreadCrumb-56e53fc8.js","assets/breadcrumbUtil-379dd524.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js","assets/Gradebook-8ee8571a.js"])),AssignmentNewAttempt:reactExports.lazy(()=>__vitePreload(()=>import("./AssignmentNewAttempt-e7dfb8cf.js"),["assets/AssignmentNewAttempt-e7dfb8cf.js","assets/CourseToolHandler-d3661515.js","assets/index-df71c5ec.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/index.esm-d6b6ff57.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-ec02b3e9.js","assets/util-10e10a40.css","assets/AssignmentViewer-07288d77.js","assets/ActivityViewer-90c65d6d.js","assets/activityUtils-5d3d0ed0.js","assets/visibility-sensor-aefdbbd5.js","assets/ActionButton-056b08c3.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js"])),ActivityNavigationButtons:reactExports.lazy(()=>__vitePreload(()=>import("./ActivityNavigationButtons-93b2dd3c.js"),["assets/ActivityNavigationButtons-93b2dd3c.js","assets/ButtonGroup-ec02b3e9.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js"]))}).current,ds=reactExports.useRef({MathInputKeyboard:reactExports.lazy(()=>__vitePreload(()=>import("./MathInputKeyboard-02e2fda4.js"),["assets/MathInputKeyboard-02e2fda4.js","assets/ToggleButton-fffa6800.js","assets/ToggleButtonGroup-0ab38e3a.js","assets/MathInputSelector-fa50f67b.js"]))}).current;let ps=`${as.pageName}-${as.currentMainPanel}`;if(ns=jsx$1(reactExports.Suspense,{fallback:jsxs(LoadingFallback,{children:[jsx$1(Svg,{viewBox:"0 0 130 140",children:jsxs(DonutG1,{children:[jsx$1(Circle$2,{id:"donut",fill:"var(--donutBody)",r:"60"}),jsx$1(Circle$2,{id:"donut-topping",fill:"var(--donutTopping)",r:"48"}),jsx$1(Circle$2,{id:"donut-hole",fill:"var(--canvas)",r:"19"})]})}),jsx$1(Svg,{viewBox:"0 0 130 140",children:jsxs(DonutG2,{children:[jsx$1(Circle$2,{id:"donut",fill:"var(--donutBody)",r:"60"}),jsx$1(Circle$2,{id:"donut-topping",fill:"var(--donutTopping)",r:"48"}),jsx$1(Circle$2,{id:"donut-hole",fill:"var(--canvas)",r:"19"})]})}),jsx$1(Svg,{viewBox:"0 0 130 140",children:jsxs(DonutG3,{children:[jsx$1(Circle$2,{id:"donut",fill:"var(--donutBody)",r:"60"}),jsx$1(Circle$2,{id:"donut-topping",fill:"var(--donutTopping)",r:"48"}),jsx$1(Circle$2,{id:"donut-hole",fill:"var(--canvas)",r:"19"})]})})]}),children:React.createElement(us[as.currentMainPanel],{MainPanelKey:ps})},ps),as!=null&&as.supportPanelOptions&&(as==null?void 0:as.supportPanelOptions.length)>0){const bs=as.supportPanelOptions[as.supportPanelIndex],vs=`${as.pageName}-${as.supportPanelOptions[as.supportPanelIndex]}-${as.supportPanelIndex}`;ss=jsx$1(SupportPanel,{hide:!1,panelTitles:as.supportPanelTitles,panelIndex:as.supportPanelIndex,children:jsx$1(reactExports.Suspense,{fallback:jsx$1(LoadingFallback,{display:"static",children:jsx$1(Table$2,{children:jsxs(TBody,{children:[jsxs(Tr$1,{children:[jsx$1(Td$1,{className:"Td2"}),jsx$1(Td$1,{className:"Td3",children:jsx$1(Td3Span,{})})]}),jsxs(Tr$1,{children:[jsx$1(Td$1,{className:"Td2"}),jsx$1(Td$1,{className:"Td3",children:jsx$1(Td3Span,{})})]}),jsxs(Tr$1,{children:[jsx$1(Td$1,{className:"Td2"}),jsx$1(Td$1,{className:"Td3",children:jsx$1(Td3Span,{})})]}),jsxs(Tr$1,{children:[jsx$1(Td$1,{className:"Td2"}),jsx$1(Td$1,{className:"Td3",children:jsx$1(Td3Span,{})})]}),jsxs(Tr$1,{children:[jsx$1(Td$1,{className:"Td2"}),jsx$1(Td$1,{className:"Td3",children:jsx$1(Td3Span,{})})]})]})})}),children:React.createElement(us[bs],{SupportPanelKey:vs})},vs)})}let fs=null;if(as.headerControls){fs=[];for(const[,bs]of Object.entries(as.headerControls)){const vs=cs[bs];if(vs){const xs=`headerControls${ps}`;fs.push(jsx$1(reactExports.Suspense,{fallback:jsx$1(LoadingFallback,{children:jsx$1(BreadcrumbContainer,{children:jsx$1(BreadcrumbOutline,{})})}),children:React.createElement(vs,{key:{key:xs}})},xs))}}}let hs=jsx$1(MenuPanel,{hide:!0},"menuPanel");os&&!as.hasNoMenuPanel&&(hs=jsx$1(MenuPanel,{hide:!1,setMenusOpen:ls,menusOpen:os,menuPanelCap:as.menuPanelCap,menusTitles:as.menusTitles,currentMenus:as.currentMenus,initOpen:as.menusInitOpen,displaySettings:as.displaySettings},"menuPanel"));let gs=!os;as.hasNoMenuPanel&&(gs=!1);let ys=null;if(as.footer){let bs="footer";ys=jsx$1(NavPanel,{id:"keyboard",isInitOpen:as.footer.open,height:as.footer.height,"aria-label":"keyboard",children:jsx$1(reactExports.Suspense,{fallback:jsx$1(LoadingFallback,{children:"loading..."}),children:React.createElement(ds[as.footer.component],{key:{footerKey:bs}})},bs)})}return jsxs(Fragment,{children:[jsxs(ToolContainer,{children:[hs,jsx$1(ContentPanel,{main:jsx$1(MainPanel,{headerControls:fs,setMenusOpen:ls,openMenuButton:gs,displaySettings:as.displaySettings,hasNoHeaderPanel:as.hasNoHeaderPanel,children:ns}),hasNoHeaderPanel:as.hasNoHeaderPanel,support:ss}),ys]}),jsx$1(Toast$1,{}),jsx$1(MemoizedRootController,{setToolRootMenusAndPanels:rs},"root_controller"),jsx$1(MemoizedOnLeave,{},"MemoizedOnLeave")]})}let navigationObj={placementexam:{default:{defaultTool:"exam"},exam:{pageName:"exam",currentMainPanel:"AssignmentViewer",currentMenus:["TimerMenu"],menusTitles:["Time Remaining"],menusInitOpen:[!0],headerControls:[],displaySettings:!1,hasNoMenuPanel:!0,hasNoHeaderPanel:!0,waitForMenuSuppression:!0,footer:{height:250,open:!1,component:"MathInputKeyboard"}},endExam:{pageName:"endExam",currentMainPanel:"EndPlacementExamPanel",displaySettings:!1,hasNoMenuPanel:!0}},umn:{default:{defaultTool:"signIn"},signIn:{pageName:"signIn",currentMainPanel:"SignInRedirector",displaySettings:!1,hasNoMenuPanel:!0}},portfolioeditor:{editor:{pageName:"PortfolioEditor",menuPanelCap:"PortfilioEditorInfoCap",currentMainPanel:"EditorViewer",currentMenus:["PageVariant","PageLink","SupportingFilesMenu"],menusTitles:["Page Variant","Page Link","Supporting Files"],menusInitOpen:[!1,!1],supportPanelOptions:["DoenetMLEditor"],supportPanelTitles:["DoenetML Editor"],supportPanelIndex:0,headerControls:["PortfolioBreadCrumb","ViewerUpdateButton"],footer:{height:250,open:!1,component:"MathInputKeyboard"},waitForMenuSuppression:!0}},exam:{default:{defaultTool:"chooseLearner"},chooseLearner:{pageName:"chooseLearner",currentMainPanel:"ChooseLearnerPanel",displaySettings:!1},assessment:{pageName:"Assessment",menuPanelCap:"AssignmentInfoCap",currentMainPanel:"AssignmentViewer",currentMenus:["TimerMenu"],menusTitles:["Time Remaining"],menusInitOpen:[!0],headerControls:[],displaySettings:!1,waitForMenuSuppression:!0,footer:{height:250,open:!1,component:"MathInputKeyboard"}},endExam:{pageName:"endExam",currentMainPanel:"EndExamPanel",displaySettings:!1,hasNoMenuPanel:!0}},course:{default:{defaultTool:"courseChooser"},assignment:{pageName:"Assignment",menuPanelCap:"AssignmentInfoCap",currentMainPanel:"AssignmentViewer",currentMenus:["CreditAchieved","TimerMenu","ActivityDates"],menusTitles:["Credit Achieved","Time Remaining","Details"],menusInitOpen:[!0,!0,!1],headerControls:["AssignmentBreadCrumb","AssignmentNewAttempt","ActivityNavigationButtons"],waitForMenuSuppression:!0,footer:{height:250,open:!1,component:"MathInputKeyboard"}},courseChooser:{pageName:"Course",currentMainPanel:"CourseCards",currentMenus:["CreateCourse"],menusTitles:["Create Course"],menusInitOpen:[!0],headerControls:["ChooserBreadCrumb"],onLeave:"CourseChooserLeave"},dashboard:{pageName:"Dashboards",currentMainPanel:"Dashboard",menuPanelCap:"DriveInfoCap",currentMenus:["ClassTimes","CurrentContent"],menusTitles:["Class Times","Content by week settings"],menusInitOpen:[!1,!1],headerControls:["DashboardBreadCrumb"],onLeave:"DashboardLeave",waitForMenuSuppression:!0,color:"var(--canvastext)"},draftactivity:{pageName:"DraftActivity",menuPanelCap:"DraftActivityCap",currentMainPanel:"DraftAssignmentViewer",currentMenus:["ActivityVariant"],menusTitles:["Activity Variant"],menusInitOpen:[],headerControls:["AssignmentBreadCrumb"],footer:{height:250,open:!1,component:"MathInputKeyboard"}},endExam:{pageName:"endExam",currentMainPanel:"EndExamPanel",menuPanelCap:"AssignmentInfoCap",currentMenus:["CreditAchieved"],menusTitles:["Credit Achieved"],menusInitOpen:[!0],headerControls:["AssignmentBreadCrumb"]},gradebook:{pageName:"Gradebook",currentMainPanel:"Gradebook",menuPanelCap:"DriveInfoCap",currentMenus:["GradeDownload"],menusTitles:["Download"],menusInitOpen:[!1],headerControls:["GradebookBreadCrumb"],waitForMenuSuppression:!0},gradebookAssignment:{pageName:"Gradebook",currentMainPanel:"GradebookAssignment",currentMenus:["GradeUpload"],menusTitles:["Upload"],menusInitOpen:[!1],menuPanelCap:"DriveInfoCap",headerControls:["GradebookBreadCrumb"],waitForMenuSuppression:!0,onLeave:"GradebookAssignmentLeave"},gradebookStudent:{pageName:"Gradebook",currentMainPanel:"GradebookStudent",currentMenus:[],menuPanelCap:"DriveInfoCap",menusTitles:[],menusInitOpen:[],headerControls:["GradebookBreadCrumb"]},gradebookStudentAssignment:{pageName:"Gradebook",currentMainPanel:"GradebookStudentAssignment",menuPanelCap:"DriveInfoCap",currentMenus:["CreditAchieved","GradeSettings"],menusTitles:["Credit Achieved","Settings"],menusInitOpen:[!0,!1],headerControls:["GradebookBreadCrumb"],waitForMenuSuppression:!0},navigation:{pageName:"Course",currentMainPanel:"NavigationPanel",menuPanelCap:"DriveInfoCap",currentMenus:["CutCopyPasteMenu","AddDriveItems"],menusTitles:["Cut, Copy and Paste","Add Items"],menusInitOpen:[!0,!0],headerControls:["NavigationBreadCrumb"],onLeave:"NavigationLeave",waitForMenuSuppression:!0},editor:{pageName:"Course",menuPanelCap:"EditorInfoCap",currentMainPanel:"EditorViewer",currentMenus:["PageVariant","PageLink","AssignmentSettingsMenu","SupportingFilesMenu"],menusTitles:["Page Variant","Page Link","Assignment Settings","Supporting Files"],menusInitOpen:[!1,!1],supportPanelOptions:["DoenetMLEditor"],supportPanelTitles:["DoenetML Editor"],supportPanelIndex:0,headerControls:["EditorBreadCrumb","ViewerUpdateButton"],footer:{height:250,open:!1,component:"MathInputKeyboard"},waitForMenuSuppression:!0},people:{pageName:"People",menuPanelCap:"DriveInfoCap",currentMenus:["LoadPeople"],menusTitles:["Import Learners"],menusInitOpen:[!1],currentMainPanel:"People",supportPanelOptions:["RolesEditor"],supportPanelTitles:["Roles Editor"],supportPanelIndex:0,headerControls:["PeopleBreadCrumb"],initialProportion:1},data:{pageName:"data",menuPanelCap:"DataCap",currentMainPanel:"DataPanel",headerControls:["DataBreadCrumb"]}},home:{default:{pageName:"Home",currentMenus:[],menusTitles:[],menusInitOpen:[],currentMainPanel:"HomePanel",supportPanelOptions:[],supportPanelTitles:[],supportPanelIndex:0,hasNoMenuPanel:!0,hasNoHeaderPanel:!0,displaySettings:!1}},notfound:{default:{pageName:"Notfound",currentMenus:[],menusInitOpen:[],currentMainPanel:"NotFound",supportPanelOptions:[],hasNoMenuPanel:!0}},public:{default:{pageName:"PublicActivityViewer",currentMenus:[],menusTitles:[],menusInitOpen:[],currentMainPanel:"PublicActivityViewer",supportPanelOptions:[],supportPanelTitles:[],supportPanelIndex:0,hasNoMenuPanel:!0},editor:{pageName:"GuestEditor",currentMainPanel:"GuestEditorViewer",currentMenus:["PageVariant"],menusTitles:["Page Variant"],menusInitOpen:[!1],supportPanelOptions:["GuestDoenetMLEditor"],supportPanelTitles:["DoenetML Editor"],supportPanelIndex:0,headerControls:["ViewerUpdateButton"],footer:{height:250,open:!1,component:"MathInputKeyboard"}}},settings:{default:{pageName:"Settings",currentMenus:[],menusTitles:[],menusInitOpen:[],currentMainPanel:"AccountSettings",supportPanelOptions:[],supportPanelTitles:[],supportPanelIndex:0,hasNoMenuPanel:!0,headerControls:["BackButton"],displaySettings:!1}},signin:{default:{pageName:"SignIn",currentMenus:[],menusTitles:[],menusInitOpen:[],currentMainPanel:"SignIn",supportPanelOptions:[],supportPanelTitles:[],supportPanelIndex:0,hasNoMenuPanel:!0,displaySettings:!1}},signout:{default:{pageName:"SignOut",currentMenus:[],menusTitles:[],menusInitOpen:[],currentMainPanel:"SignOut",supportPanelOptions:[],supportPanelTitles:[],supportPanelIndex:0,hasNoMenuPanel:!0,displaySettings:!1}}},encodeParams=as=>Object.entries(as).map(rs=>rs.map(encodeURIComponent).join("=")).join("&");const pageToolViewAtom=Recoil_index_8({key:"pageToolViewAtom",default:{page:"init",tool:"",view:""}}),onLeaveComponentStr=Recoil_index_8({key:"onLeaveComponentStr",default:{str:null,updateNum:0}});Recoil_index_8({key:"finishedOnLeave",default:null});const MemoizedOnLeave=React.memo(OnLeave);function OnLeave(){const rs=Recoil_index_20(onLeaveComponentStr).str;let ns=null;const ss=reactExports.useRef({NavigationLeave:reactExports.lazy(()=>__vitePreload(()=>import("./NavigationLeave-4b0618a6.js"),[])),CourseChooserLeave:reactExports.lazy(()=>__vitePreload(()=>import("./CourseChooserLeave-fa36f4fc.js"),["assets/CourseChooserLeave-fa36f4fc.js","assets/CourseToolHandler-d3661515.js","assets/index-df71c5ec.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/index.esm-d6b6ff57.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-ec02b3e9.js","assets/util-10e10a40.css"])),DashboardLeave:reactExports.lazy(()=>__vitePreload(()=>import("./DashboardLeave-36c0097b.js"),["assets/DashboardLeave-36c0097b.js","assets/CourseToolHandler-d3661515.js","assets/index-df71c5ec.js","assets/index-fcf36459.js","assets/index-47ca4f11.js","assets/index.esm-d6b6ff57.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-ec02b3e9.js","assets/util-10e10a40.css"])),GradebookAssignmentLeave:reactExports.lazy(()=>__vitePreload(()=>import("./GradebookAssignmentLeave-e7ada5bd.js"),["assets/GradebookAssignmentLeave-e7ada5bd.js","assets/GradebookAssignment-ebb55feb.js","assets/Gradebook-8ee8571a.js","assets/RoleDropdown-2d4e4388.js","assets/DropdownMenu-421d3462.js","assets/setPrototypeOf-51e8cf87.js","assets/ButtonGroup-ec02b3e9.js"]))}).current;if(rs){const os=`leave${rs}`;ns=jsx$1(reactExports.Suspense,{fallback:null,children:React.createElement(ss[rs])},os)}return jsx$1(Fragment,{children:ns})}const suppressMenusAtom=Recoil_index_8({key:"suppressMenusAtom",default:null});function arraysEqual(as,rs){if(as===rs)return!0;if(as==null||rs==null||as.length!==rs.length)return!1;for(var ns=0;nsks=>{for(const[Ps,Bs]of Object.entries(ks))bs.current[Ps]!==Bs&&Vs(searchParamAtomFamily(Ps),Bs);for(const Ps of Object.keys(bs.current))ks[Ps]||Vs(searchParamAtomFamily(Ps),"")});let xs=reactExports.useRef(null),Cs=reactExports.useRef([]),Ts=`${gs.pathname}${gs.search}`,Ss={page:"",tool:"",view:""},Ns=null,As=(Ds=(Os=navigationObj[rs.page])==null?void 0:Os[rs.tool])==null?void 0:Ds.initialProportion;reactExports.useEffect(()=>{let Vs=As;Vs||(Vs=.5),us(ks=>{let Ps={...ks};return Ps.proportion=Vs,Ps})},[As]);let ws=!arraysEqual(os,Cs.current);if(Cs.current=os,ws&&os!==null){if(Ns={...navigationObj[rs.page][rs.tool]},Ns.currentMenus=[...navigationObj[rs.page][rs.tool].currentMenus],Ns.menusTitles=[...navigationObj[rs.page][rs.tool].menusTitles],Ns.menusInitOpen=[...navigationObj[rs.page][rs.tool].menusInitOpen],os.length>0)for(let Vs of os)for(let[ks,Ps]of Object.entries(Ns.currentMenus))Ps===Vs&&(Ns.currentMenus.splice(ks,1),Ns.menusTitles.splice(ks,1),Ns.menusInitOpen.splice(ks,1));return as.setToolRootMenusAndPanels(Ns),null}let Es=!1;if(Ts!==hs.current){if(Es=!0,Ss.page=gs.pathname.split("/")[1].toLowerCase(),Ss.page===""){Ss.page="home";const ks=window.location.origin+window.location.pathname+"home";window.history.replaceState("","",ks)}let Vs=Object.fromEntries(new URLSearchParams(gs.search));Ss.tool=Vs.tool,Ss.tool||(Ss.tool="")}let _s=!1;if(JSON.stringify(cs.current)!==JSON.stringify(rs)){if(_s=!0,rs.back){ds.current.page==="init"&&(ds.current.page="home");let Vs={...ds.current,params:ps.current};return ns(Vs),null}Ss={...rs}}if(!Es&&!_s)return hs.current=Ts,null;let $s=!1,Rs=!1;cs.current.page!==Ss.page?($s=!0,Ss.tool===""?(Ns=navigationObj[Ss.page].default,Object.keys(Ns).includes("defaultTool")&&(window.location.pathname+gs.pathname+""+encodeParams({tool:Ns.defaultTool}),Ns=navigationObj[Ss.page][Ns.defaultTool])):Ns=navigationObj[Ss.page][Ss.tool]):cs.current.tool!==Ss.tool?(Rs=!0,Ns=navigationObj[Ss.page][Ss.tool]):cs.current.view!==Ss.view&&(Ns={...navigationObj[Ss.page][Ss.tool]});let Is={};if(Es&&(Is=Object.fromEntries(new URLSearchParams(gs.search)),vs(Is),Ss.params={...Is},delete Ss.params.tool,ns(Ss)),($s||Rs)&&(xs.current&&ss(Vs=>({str:xs.current,updateNum:Vs.updateNum+1})),xs.current=null,Ns&&Ns.onLeave&&(xs.current=Ns.onLeave),ls(null)),Ns&&Ns.displaySettings===void 0&&(Ns.displaySettings=!0),Ns&&JSON.stringify(Ss)!==JSON.stringify(cs.current)){ds.current=cs.current;let Vs={};if(Es?Vs=Is:_s&&(Vs=rs.params),ps.current=fs.current,fs.current=Vs,Ns.waitForMenuSuppression){let ks={...Ns};ks.currentMenus=[],ks.menusInitOpen=[],ks.menusTitles=[],ks.headerControls=[],as.setToolRootMenusAndPanels(ks)}else as.setToolRootMenusAndPanels(Ns)}if(_s){let Vs=Ss.tool,ks="/"+rs.page;Is={...rs.params},Vs!==""&&Vs!==void 0&&(Is={tool:Vs,...rs.params});let Ps="";Object.keys(Is).length>0&&(Ps="?"+encodeParams(Is));const Bs=ks+Ps;gs.search!==Ps&&vs(Is),(gs.pathname!==ks||gs.search!==Ps)&&ys(Bs)}return bs.current=Is,hs.current=Ts,cs.current=Ss,null}const LoadingFallback=styled$1.div` background-color: var(--canvas); border-radius: 4px; display: ${as=>as.display?as.display:"flex"}; @@ -1984,7 +1984,7 @@ let ns=poly_div(as,[rs]),ss=0,os=ns[0].length;for(var ls=0;lslocation.pathname==="/"||ns?"active":ss?"pending":"",children:rs})}function SiteHeader(as){let rs=useNavigate(),ns=useLoaderData();const ss=Recoil_index_24(pageToolViewAtom);let os=jsx$1(Button$2,{dataTest:"Nav to course",size:"medium",onClick:()=>{ss({page:"course",tool:"",view:"",params:{}}),rs("/course")},value:"Go to Course"});return ns.signedIn||(os=jsx$1(Button$2,{dataTest:"Nav to signin",onClick:()=>rs("/SignIn"),size:"medium",value:"Sign In"})),jsx$1(Fragment,{children:jsxs(TopContainer,{children:[jsxs(Box,{as:"header",gridRow:"1 / 2",backgroundColor:"#fff",color:"#000",height:"40px",position:"fixed",top:"0",width:"100%",margin:"0",display:"flex",justifyContent:"space-between",borderBottom:"1px solid var(--mainGray)",zIndex:"1200",children:[jsxs(Branding,{children:[jsx$1(RouterLogo,{}),jsx$1("p",{children:"Doenet"})]}),jsxs(BarMenu,{children:[jsx$1(MenuItem,{to:"/",children:"Home"}),jsx$1(MenuItem,{to:"community",children:"Community"}),ns.signedIn?jsx$1(MenuItem,{to:`portfolio/${ns.portfolioCourseId}`,children:"Portfolio"}):null]}),jsx$1(SignInButtonContainer,{children:os})]}),jsx$1(ContentContainer,{children:jsx$1(Outlet,{context:{signedIn:ns.signedIn}})})]})})}const __variableDynamicImportRuntimeHelper=(as,rs)=>{const ns=as[rs];return ns?typeof ns=="function"?ns():Promise.resolve(ns):new Promise((ss,os)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(os.bind(null,new Error("Unknown variable dynamic import: "+rs)))})};let nanoid=(as=21)=>crypto.getRandomValues(new Uint8Array(as)).reduce((rs,ns)=>(ns&=63,ns<36?rs+=ns.toString(36):ns<62?rs+=(ns-26).toString(36).toUpperCase():ns>62?rs+="-":rs+="_",rs),"");var sha1Exports={},sha1={get exports(){return sha1Exports},set exports(as){sha1Exports=as}},coreExports={},core={get exports(){return coreExports},set exports(as){coreExports=as}},hasRequiredCore;function requireCore(){return hasRequiredCore||(hasRequiredCore=1,function(as,rs){(function(ns,ss){as.exports=ss()})(commonjsGlobal$1,function(){var ns=ns||function(ss,os){var ls=Object.create||function(){function xs(){}return function(Cs){var Ts;return xs.prototype=Cs,Ts=new xs,xs.prototype=null,Ts}}(),us={},cs=us.lib={},ds=cs.Base=function(){return{extend:function(xs){var Cs=ls(this);return xs&&Cs.mixIn(xs),(!Cs.hasOwnProperty("init")||this.init===Cs.init)&&(Cs.init=function(){Cs.$super.init.apply(this,arguments)}),Cs.init.prototype=Cs,Cs.$super=this,Cs},create:function(){var xs=this.extend();return xs.init.apply(xs,arguments),xs},init:function(){},mixIn:function(xs){for(var Cs in xs)xs.hasOwnProperty(Cs)&&(this[Cs]=xs[Cs]);xs.hasOwnProperty("toString")&&(this.toString=xs.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),ps=cs.WordArray=ds.extend({init:function(xs,Cs){xs=this.words=xs||[],Cs!=os?this.sigBytes=Cs:this.sigBytes=xs.length*4},toString:function(xs){return(xs||hs).stringify(this)},concat:function(xs){var Cs=this.words,Ts=xs.words,Ss=this.sigBytes,Ns=xs.sigBytes;if(this.clamp(),Ss%4)for(var As=0;As>>2]>>>24-As%4*8&255;Cs[Ss+As>>>2]|=ws<<24-(Ss+As)%4*8}else for(var As=0;As>>2]=Ts[As>>>2];return this.sigBytes+=Ns,this},clamp:function(){var xs=this.words,Cs=this.sigBytes;xs[Cs>>>2]&=4294967295<<32-Cs%4*8,xs.length=ss.ceil(Cs/4)},clone:function(){var xs=ds.clone.call(this);return xs.words=this.words.slice(0),xs},random:function(xs){for(var Cs=[],Ts=function(Es){var Es=Es,_s=987654321,$s=4294967295;return function(){_s=36969*(_s&65535)+(_s>>16)&$s,Es=18e3*(Es&65535)+(Es>>16)&$s;var Rs=(_s<<16)+Es&$s;return Rs/=4294967296,Rs+=.5,Rs*(ss.random()>.5?1:-1)}},Ss=0,Ns;Ss>>2]>>>24-Ns%4*8&255;Ss.push((As>>>4).toString(16)),Ss.push((As&15).toString(16))}return Ss.join("")},parse:function(xs){for(var Cs=xs.length,Ts=[],Ss=0;Ss>>3]|=parseInt(xs.substr(Ss,2),16)<<24-Ss%8*4;return new ps.init(Ts,Cs/2)}},gs=fs.Latin1={stringify:function(xs){for(var Cs=xs.words,Ts=xs.sigBytes,Ss=[],Ns=0;Ns>>2]>>>24-Ns%4*8&255;Ss.push(String.fromCharCode(As))}return Ss.join("")},parse:function(xs){for(var Cs=xs.length,Ts=[],Ss=0;Ss>>2]|=(xs.charCodeAt(Ss)&255)<<24-Ss%4*8;return new ps.init(Ts,Cs)}},ys=fs.Utf8={stringify:function(xs){try{return decodeURIComponent(escape(gs.stringify(xs)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(xs){return gs.parse(unescape(encodeURIComponent(xs)))}},bs=cs.BufferedBlockAlgorithm=ds.extend({reset:function(){this._data=new ps.init,this._nDataBytes=0},_append:function(xs){typeof xs=="string"&&(xs=ys.parse(xs)),this._data.concat(xs),this._nDataBytes+=xs.sigBytes},_process:function(xs){var Cs=this._data,Ts=Cs.words,Ss=Cs.sigBytes,Ns=this.blockSize,As=Ns*4,ws=Ss/As;xs?ws=ss.ceil(ws):ws=ss.max((ws|0)-this._minBufferSize,0);var Es=ws*Ns,_s=ss.min(Es*4,Ss);if(Es){for(var $s=0;$s>>31}var Ns=(ys<<5|ys>>>27)+Cs+ds[Ts];Ts<20?Ns+=(bs&vs|~bs&xs)+1518500249:Ts<40?Ns+=(bs^vs^xs)+1859775393:Ts<60?Ns+=(bs&vs|bs&xs|vs&xs)-1894007588:Ns+=(bs^vs^xs)-899497514,Cs=xs,xs=vs,vs=bs<<30|bs>>>2,bs=ys,ys=Ns}gs[0]=gs[0]+ys|0,gs[1]=gs[1]+bs|0,gs[2]=gs[2]+vs|0,gs[3]=gs[3]+xs|0,gs[4]=gs[4]+Cs|0},_doFinalize:function(){var fs=this._data,hs=fs.words,gs=this._nDataBytes*8,ys=fs.sigBytes*8;return hs[ys>>>5]|=128<<24-ys%32,hs[(ys+64>>>9<<4)+14]=Math.floor(gs/4294967296),hs[(ys+64>>>9<<4)+15]=gs,fs.sigBytes=hs.length*4,this._process(),this._hash},clone:function(){var fs=us.clone.call(this);return fs._hash=this._hash.clone(),fs}});ss.SHA1=us._createHelper(ps),ss.HmacSHA1=us._createHmacHelper(ps)}(),ns.SHA1})})(sha1);var encBase64Exports={},encBase64={get exports(){return encBase64Exports},set exports(as){encBase64Exports=as}};(function(as,rs){(function(ns,ss){as.exports=ss(requireCore())})(commonjsGlobal$1,function(ns){return function(){var ss=ns,os=ss.lib,ls=os.WordArray,us=ss.enc;us.Base64={stringify:function(ds){var ps=ds.words,fs=ds.sigBytes,hs=this._map;ds.clamp();for(var gs=[],ys=0;ys>>2]>>>24-ys%4*8&255,vs=ps[ys+1>>>2]>>>24-(ys+1)%4*8&255,xs=ps[ys+2>>>2]>>>24-(ys+2)%4*8&255,Cs=bs<<16|vs<<8|xs,Ts=0;Ts<4&&ys+Ts*.75>>6*(3-Ts)&63));var Ss=hs.charAt(64);if(Ss)for(;gs.length%4;)gs.push(Ss);return gs.join("")},parse:function(ds){var ps=ds.length,fs=this._map,hs=this._reverseMap;if(!hs){hs=this._reverseMap=[];for(var gs=0;gs>>6-ys%4*2;hs[gs>>>2]|=(bs|vs)<<24-gs%4*8,gs++}return ls.create(hs,gs)}}(),ns.enc.Base64})})(encBase64);let rePlus=/\+/g,reSlash=/\//g;function createUniqueName(as,rs){let ns=encBase64Exports.stringify(sha1Exports(rs)).slice(0,10).replace(rePlus,"_").replace(reSlash,"-");return"__"+as+"_"+ns}function getUniqueIdentifierFromBase(as,rs){let ns=1,ss=as+ns;for(;rs.includes(ss);)ns+=1,ss=as+ns;return rs.push(ss),ss}function getNamespaceFromName(as){let rs=as.lastIndexOf("/");if(rs===-1)throw Error(`Encountered name ${as} that doesn't include a slash`);return as.slice(0,rs+1)}function flattenDeep(as){return as.reduce((rs,ns)=>Array.isArray(ns)?rs.concat(flattenDeep(ns)):rs.concat(ns),[])}function flattenLevels(as,rs){return console.log(`levels: ${rs}`),as.reduce((ns,ss)=>Array.isArray(ss)&&rs>1?ns.concat(flattenLevels(ss,rs-1)):ns.concat(ss),[])}class Subset{union(rs){return this.complement().intersect(rs.complement()).complement()}intersectWithOpenInterval(rs){return this.intersect(rs)}setMinus(rs){return this.intersect(rs.complement())}symmetricDifference(rs){return this.setMinus(rs).union(rs.setMinus(this))}equals(rs){return this.symmetricDifference(rs).isEmpty()}toJSON(){return{objectType:"subset",data:Object.assign({},this),subsetType:this.constructor.subsetType}}static reviver(rs,ns){if(ns&&ns.objectType==="subset"&&ns.subsetType!==void 0){if(ns.subsetType==="emptySet")return new EmptySet;if(ns.subsetType==="realLine")return new RealLine;if(ns.subsetType==="singleton")return new Singleton(ns.data.element);if(ns.subsetType==="union")return new Union(ns.data.subsets);if(ns.subsetType==="openInterval")return new OpenInterval(ns.data.left,ns.data.right)}return ns}copy(){return this.constructor.reviver(null,this.toJSON())}}const hp=class extends Subset{union(rs){return rs}intersect(){return new hp}contains(){return!1}isEmpty(){return!0}complement(){return new RealLine}toString(){return"∅"}toMathExpression(){return Context.fromAst("∅")}};let EmptySet=hp;zs(EmptySet,"subsetType","emptySet");const gp=class extends Subset{union(){return new gp}intersect(rs){return rs}contains(){return!0}complement(){return new EmptySet}isEmpty(){return!1}toString(){return"ℝ"}toMathExpression(){return Context.fromAst("R")}};let RealLine=gp;zs(RealLine,"subsetType","realLine");const yp=class extends Subset{constructor(rs){if(super(),!Number.isFinite(rs))return new EmptySet;this.element=rs}union(rs){return rs.contains(this.element)?rs:new Union([rs,this])}intersect(rs){return rs.contains(this.element)?new yp(this.element):new EmptySet}isEmpty(){return!1}contains(rs){return rs===this.element}complement(){return new Union([new OpenInterval(-1/0,this.element),new OpenInterval(this.element,1/0)])}toString(){return`{${this.element}}`}toMathExpression(){return Context.fromAst(["set",this.element])}};let Singleton=yp;zs(Singleton,"subsetType","singleton");const Ju=class extends Subset{intersect(rs){return new Ju(this.subsets.map(ns=>rs.intersect(ns)))}toString(){return this.subsets.map(rs=>rs.toString()).join(" U ")}toMathExpression(){return Context.fromAst(["union",...this.subsets.map(rs=>rs.toMathExpression().tree)])}constructor(rs){super();let ns=rs.filter(ss=>!ss.isEmpty());if(ns.length===0)return new EmptySet;ns=ns.reduce((ss,os)=>os instanceof Ju?ss.concat(os.subsets):ss.concat(os),[]),this.subsets=[];for(let ss=0;ssus&&ps.elementds.left&&usns.contains(rs))}isEmpty(){return this.subsets.every(rs=>rs.isEmpty())}complement(){return this.subsets.map(rs=>rs.complement()).reduce((rs,ns)=>rs.intersect(ns))}};let Union=Ju;zs(Union,"subsetType","union");let Interval$1=class extends Subset{constructor(rs,ns){return super(),this.left=rs,this.right=ns,this.left<=this.right?this.left===-1/0&&this.right===1/0?new RealLine:this:new EmptySet}};const bp=class extends Interval$1{constructor(rs,ns){return super(rs,ns),rs===ns?new EmptySet:this}intersect(rs){return rs.intersectWithOpenInterval(this)}intersectWithOpenInterval(rs){return new bp(Math.max(this.left,rs.left),Math.min(this.right,rs.right))}complement(){return new Union([new OpenClosedInterval(-1/0,this.left),new ClosedOpenInterval(this.right,1/0)])}isEmpty(){return this.left>=this.right}contains(rs){return rs>this.left&&rsbuildSubsetFromIntervals(os,rs)).filter(os=>os);return ss.length===0?new EmptySet:ss.length===1?ss[0]:new Union(ss)}else if(ns==="intersect"||ns==="and"){let ss=as.slice(1).map(os=>buildSubsetFromIntervals(os,rs)).filter(os=>os);return ss.length===0?new RealLine:ss.reduce((os,ls)=>os.intersect(ls))}else if(ns==="set"){let ss=as.slice(1).map(os=>buildSubsetFromIntervals(os,rs)).filter(os=>os);return ss.length===0?new EmptySet:ss.length===1?ss[0]:new Union(ss)}else if(["<","le",">","ge","=","ne"].includes(ns)){let ss=as[1],os=!1;if(!Number.isFinite(ss)){if(deepCompare(ss,rs))os=!0;else if(ss=Context.fromAst(ss).evaluate_to_constant(),!(Number.isFinite(ss)||ss===1/0||ss===-1/0))return new EmptySet}let ls=as[2],us=!1;if(!Number.isFinite(ls)){if(deepCompare(ls,rs))us=!0;else if(ls=Context.fromAst(ls).evaluate_to_constant(),!(Number.isFinite(ls)||ls===1/0||ls===-1/0))return new EmptySet}return os?us?new EmptySet:ns==="<"?new OpenInterval(-1/0,ls):ns==="le"?new OpenClosedInterval(-1/0,ls):ns===">"?new OpenInterval(ls,1/0):ns==="ge"?new ClosedOpenInterval(ls,1/0):ns==="="?Number.isFinite(ls)?new Singleton(ls):new EmptySet:Number.isFinite(ls)?new Union([new OpenInterval(-1/0,ls),new OpenInterval(ls,1/0)]):new RealLine:us?ns==="<"?new OpenInterval(ss,1/0):ns==="le"?new ClosedOpenInterval(ss,1/0):ns===">"?new OpenInterval(-1/0,ss):ns==="ge"?new OpenClosedInterval(-1/0,ss):ns==="="?Number.isFinite(ss)?new Singleton(ss):new EmptySet:Number.isFinite(ss)?new Union([new OpenInterval(-1/0,ss),new OpenInterval(ss,1/0)]):new RealLine:new EmptySet}else if(["lts","gts"].includes(ns)){let ss=as[1].slice(1),os=as[2].slice(1);if(ss.length!==3||!deepCompare(ss[1],rs))return new EmptySet;ns==="gts"&&(ss.reverse(),os.reverse());let ls=ss[0];if(!Number.isFinite(ls)&&(ls=Context.fromAst(ls).evaluate_to_constant(),!(Number.isFinite(ls)||ls===1/0||ls===-1/0)))return new EmptySet;let us=ss[2];return!Number.isFinite(us)&&(us=Context.fromAst(us).evaluate_to_constant(),!(Number.isFinite(us)||us===1/0||us===-1/0))?new EmptySet:os[0]?os[1]?new OpenInterval(ls,us):new OpenClosedInterval(ls,us):os[1]?new ClosedOpenInterval(ls,us):new ClosedInterval(ls,us)}else if(ns==="|"){let ss=as[1];return buildSubsetFromIntervals(as[2],ss)}else if(ns==="^"&&(as[2]==="C"||as[2]==="c")){let ss=buildSubsetFromIntervals(as[1],rs);return ss?ss.complement():new EmptySet}else{if(ns==="in")return deepCompare(as[1],rs)?buildSubsetFromIntervals(as[2],rs):new EmptySet;if(ns==="ni")return deepCompare(as[2],rs)?buildSubsetFromIntervals(as[1],rs):new EmptySet;if(ns==="notin"){if(deepCompare(as[1],rs)){let ss=buildSubsetFromIntervals(as[2],rs);if(ss)return ss.complement()}return new EmptySet}else if(ns==="notni"){if(deepCompare(as[2],rs)){let ss=buildSubsetFromIntervals(as[1],rs);if(ss)return ss.complement()}return new EmptySet}else{let ss=Context.fromAst(as).evaluate_to_constant();return Number.isFinite(ss)?new Singleton(ss):new EmptySet}}}function buildSubsetFromMathExpression(as,rs){return buildSubsetFromIntervals(as.to_intervals().tree,rs.tree)}function deepClone(as,rs,ns){if(Object(as)!==as||as instanceof Function||rs!==void 0&&as instanceof rs)return as;if(as instanceof Context.class||as instanceof theModule.Subset)return as.copy();if(ns===void 0&&(ns=new WeakMap),Array.isArray(as))return[...as.map(os=>deepClone(os,rs,ns))];if(as.constructor===Object&&Object.entries(as).length===0)return{};if(ns.has(as))return ns.get(as);try{var ss=new as.constructor}catch{ss=Object.create(Object.getPrototypeOf(as))}return as instanceof Map?Array.from(as,([os,ls])=>ss.set(deepClone(os,rs,ns),deepClone(ls,rs,ns))):as instanceof Set&&Array.from(as,os=>ss.add(deepClone(os,rs,ns))),ns.set(as,ss),Object.assign(ss,...Object.keys(as).map(os=>({[os]:deepClone(as[os],rs,ns)})))}function deepCompare(as,rs,ns){var ss,os;function ls(us,cs){var ds;if(Number.isNaN(us)&&Number.isNaN(cs)||us===cs)return!0;if(ns!==void 0&&us instanceof ns&&cs instanceof ns)return us.componentName===cs.componentName;if(us instanceof Context.class&&cs instanceof Context.class)return ls(us.tree,cs.tree);if(typeof us=="function"&&typeof cs=="function"||us instanceof Date&&cs instanceof Date||us instanceof RegExp&&cs instanceof RegExp||us instanceof String&&cs instanceof String||us instanceof Number&&cs instanceof Number)return us.toString()===cs.toString();if(!(us instanceof Object&&cs instanceof Object)||us.isPrototypeOf(cs)||cs.isPrototypeOf(us)||us.constructor!==cs.constructor||us.prototype!==cs.prototype||ss.indexOf(us)>-1||os.indexOf(cs)>-1)return!1;for(ds in cs){if(cs.hasOwnProperty(ds)!==us.hasOwnProperty(ds))return!1;if(typeof cs[ds]!=typeof us[ds])return!1}for(ds in us){if(cs.hasOwnProperty(ds)!==us.hasOwnProperty(ds))return!1;if(typeof cs[ds]!=typeof us[ds])return!1;switch(typeof us[ds]){case"object":case"function":if(ss.push(us),os.push(cs),!ls(us[ds],cs[ds]))return!1;ss.pop(),os.pop();break;default:if(us[ds]!==cs[ds]&&!(Number.isNaN(us[ds])&&Number.isNaN(cs[ds])))return!1;break}}return!0}return ss=[],os=[],ls(as,rs)}function breakStringsAndOthersIntoComponentsByStringCommas(as){return null}function returnBreakStringsSugarFunction({childrenToComponentFunction:as,mustStripOffOuterParentheses:rs=!1}){return function({matchedChildren:ns}){let ss=0,os=[],ls=[],us=!1,cs=ns.length;if(rs){let ps=ns[0];if(typeof ps!="string"||ps.trimLeft()[0]!=="(")return{success:!1}}for(let[ps,fs]of ns.entries()){if(typeof fs!="string"){ls.push(fs);continue}let hs=fs.trim();if(ps===0&&rs&&hs[0]==="("){let ys=ns[cs-1];if(typeof ys=="string"){let bs=ys.trimRight();bs[bs.length-1]===")"&&(us=!0,hs=hs.substring(1))}}let gs=0;for(let ys=0;ysgs&&ls.push(hs.substring(gs,ys)),os.push(ls),ls=[],gs=ys+1)}hs.length>gs&&ls.push(hs.substring(gs,hs.length))}return ss!==0?{success:!1}:(os.push(ls),{success:!0,newChildren:os.map(as)})}}function breakEmbeddedStringByCommas({childrenList:as}){let rs=0,ns=[],ss=[];for(let os of as){if(typeof os!="string"){ss.push(os);continue}let ls=os.trim(),us=0;for(let cs=0;csus){let ps=ls.substring(us,cs).trim();ss.push(ps)}ns.push(ss),ss=[],us=cs+1}}if(ls.length>us){let cs=ls.substring(us,ls.length).trim();ss.push(cs)}}return rs!==0?{success:!1}:(ns.push(ss),{success:!0,pieces:ns})}function breakEmbeddedStringsIntoParensPieces({componentList:as,removeParens:rs=!1}){let ns=0,ss=[],os=[];for(let ls of as){if(typeof ls!="string"){ns===0?ss.push([ls]):os.push(ls);continue}let us=ls.trim(),cs=0;for(let ds=0;dscs){let fs=rs?ds:ds+1,hs=us.substring(cs,fs).trim();hs.length>0&&os.push(hs)}ss.push(os),os=[],cs=ds+1}ns--}else if(ns===0&&!ps.match(/\s/))return{success:!1}}if(us.length>cs){let ds=us.substring(cs,us.length).trim();os.push(ds)}}return ns!==0?{success:!1}:(os.length>0&&ss.push(os),{success:!0,pieces:ss})}const DefaultBufferLength=1024;let nextPropID=0;class Range{constructor(rs,ns){this.from=rs,this.to=ns}}class NodeProp{constructor(rs={}){this.id=nextPropID++,this.perNode=!!rs.perNode,this.deserialize=rs.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(rs){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof rs!="function"&&(rs=NodeType.match(rs)),ns=>{let ss=rs(ns);return ss===void 0?null:[this,ss]}}}NodeProp.closedBy=new NodeProp({deserialize:as=>as.split(" ")});NodeProp.openedBy=new NodeProp({deserialize:as=>as.split(" ")});NodeProp.group=new NodeProp({deserialize:as=>as.split(" ")});NodeProp.contextHash=new NodeProp({perNode:!0});NodeProp.lookAhead=new NodeProp({perNode:!0});NodeProp.mounted=new NodeProp({perNode:!0});const noProps=Object.create(null);class NodeType{constructor(rs,ns,ss,os=0){this.name=rs,this.props=ns,this.id=ss,this.flags=os}static define(rs){let ns=rs.props&&rs.props.length?Object.create(null):noProps,ss=(rs.top?1:0)|(rs.skipped?2:0)|(rs.error?4:0)|(rs.name==null?8:0),os=new NodeType(rs.name||"",ns,rs.id,ss);if(rs.props){for(let ls of rs.props)if(Array.isArray(ls)||(ls=ls(os)),ls){if(ls[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");ns[ls[0].id]=ls[1]}}return os}prop(rs){return this.props[rs.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(rs){if(typeof rs=="string"){if(this.name==rs)return!0;let ns=this.prop(NodeProp.group);return ns?ns.indexOf(rs)>-1:!1}return this.id==rs}static match(rs){let ns=Object.create(null);for(let ss in rs)for(let os of ss.split(" "))ns[os]=rs[ss];return ss=>{for(let os=ss.prop(NodeProp.group),ls=-1;ls<(os?os.length:0);ls++){let us=ns[ls<0?ss.name:os[ls]];if(us)return us}}}}NodeType.none=new NodeType("",Object.create(null),0,8);class NodeSet{constructor(rs){this.types=rs;for(let ns=0;nsus.node;;){let ds=!1;if(us.from<=ls&&us.to>=os&&(us.type.isAnonymous||ns(us.type,us.from,us.to,cs)!==!1)){if(us.firstChild())continue;us.type.isAnonymous||(ds=!0)}for(;ds&&ss&&ss(us.type,us.from,us.to,cs),ds=us.type.isAnonymous,!us.nextSibling();){if(!us.parent())return;ds=!0}}}prop(rs){return rs.perNode?this.props?this.props[rs.id]:void 0:this.type.prop(rs)}get propValues(){let rs=[];if(this.props)for(let ns in this.props)rs.push([+ns,this.props[ns]]);return rs}balance(rs={}){return this.children.length<=8?this:balanceRange(NodeType.none,this.children,this.positions,0,this.children.length,0,this.length,(ns,ss,os)=>new Tree(this.type,ns,ss,os,this.propValues),rs.makeTree||((ns,ss,os)=>new Tree(NodeType.none,ns,ss,os)))}static build(rs){return buildTree(rs)}}Tree.empty=new Tree(NodeType.none,[],[],0);class FlatBufferCursor{constructor(rs,ns){this.buffer=rs,this.index=ns}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new FlatBufferCursor(this.buffer,this.index)}}class TreeBuffer{constructor(rs,ns,ss){this.buffer=rs,this.length=ns,this.set=ss}get type(){return NodeType.none}toString(){let rs=[];for(let ns=0;ns0));ds=us[ds+3]);return cs}slice(rs,ns,ss,os){let ls=this.buffer,us=new Uint16Array(ns-rs);for(let cs=rs,ds=0;cs=rs&&nsrs;case 1:return ns<=rs&&ss>rs;case 2:return ss>rs;case 4:return!0}}function enterUnfinishedNodesBefore(as,rs){let ns=as.childBefore(rs);for(;ns;){let ss=ns.lastChild;if(!ss||ss.to!=ns.to)break;ss.type.isError&&ss.from==ss.to?(as=ns,ns=ss.prevSibling):ns=ss}return as}function resolveNode(as,rs,ns,ss){for(var os;as.from==as.to||(ns<1?as.from>=rs:as.from>rs)||(ns>-1?as.to<=rs:as.to0?cs.length:-1;rs!=ps;rs+=ns){let fs=cs[rs],hs=ds[rs]+us._from;if(checkSide(os,ss,hs,hs+fs.length)){if(fs instanceof TreeBuffer){if(ls&2)continue;let gs=fs.findChild(0,fs.buffer.length,ns,ss-hs,os);if(gs>-1)return new BufferNode(new BufferContext(us,fs,rs,hs),null,gs)}else if(ls&1||!fs.type.isAnonymous||hasChild(fs)){let gs;if(!(ls&1)&&fs.props&&(gs=fs.prop(NodeProp.mounted))&&!gs.overlay)return new TreeNode(gs.tree,hs,rs,us);let ys=new TreeNode(fs,hs,rs,us);return ls&1||!ys.type.isAnonymous?ys:ys.nextChild(ns<0?fs.children.length-1:0,ns,ss,os)}}}if(ls&1||!us.type.isAnonymous||(us.index>=0?rs=us.index+ns:rs=ns<0?-1:us._parent.node.children.length,us=us._parent,!us))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this.node.children.length-1,-1,0,4)}childAfter(rs){return this.nextChild(0,1,rs,2)}childBefore(rs){return this.nextChild(this.node.children.length-1,-1,rs,-2)}enter(rs,ns,ss=!0,os=!0){let ls;if(ss&&(ls=this.node.prop(NodeProp.mounted))&&ls.overlay){let us=rs-this.from;for(let{from:cs,to:ds}of ls.overlay)if((ns>0?cs<=us:cs=us:ds>us))return new TreeNode(ls.tree,ls.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,rs,ns,os?0:2)}nextSignificantParent(){let rs=this;for(;rs.type.isAnonymous&&rs._parent;)rs=rs._parent;return rs}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get cursor(){return new TreeCursor(this)}get tree(){return this.node}toTree(){return this.node}resolve(rs,ns=0){return resolveNode(this,rs,ns,!1)}resolveInner(rs,ns=0){return resolveNode(this,rs,ns,!0)}enterUnfinishedNodesBefore(rs){return enterUnfinishedNodesBefore(this,rs)}getChild(rs,ns=null,ss=null){let os=getChildren(this,rs,ns,ss);return os.length?os[0]:null}getChildren(rs,ns=null,ss=null){return getChildren(this,rs,ns,ss)}toString(){return this.node.toString()}}function getChildren(as,rs,ns,ss){let os=as.cursor,ls=[];if(!os.firstChild())return ls;if(ns!=null){for(;!os.type.is(ns);)if(!os.nextSibling())return ls}for(;;){if(ss!=null&&os.type.is(ss))return ls;if(os.type.is(rs)&&ls.push(os.node),!os.nextSibling())return ss==null?ls:[]}}class BufferContext{constructor(rs,ns,ss,os){this.parent=rs,this.buffer=ns,this.index=ss,this.start=os}}class BufferNode{constructor(rs,ns,ss){this.context=rs,this._parent=ns,this.index=ss,this.type=rs.buffer.set.types[rs.buffer.buffer[ss]]}get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}child(rs,ns,ss){let{buffer:os}=this.context,ls=os.findChild(this.index+4,os.buffer[this.index+3],rs,ns-this.context.start,ss);return ls<0?null:new BufferNode(this.context,this,ls)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(rs){return this.child(1,rs,2)}childBefore(rs){return this.child(-1,rs,-2)}enter(rs,ns,ss,os=!0){if(!os)return null;let{buffer:ls}=this.context,us=ls.findChild(this.index+4,ls.buffer[this.index+3],ns>0?1:-1,rs-this.context.start,ns);return us<0?null:new BufferNode(this.context,this,us)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(rs){return this._parent?null:this.context.parent.nextChild(this.context.index+rs,rs,0,4)}get nextSibling(){let{buffer:rs}=this.context,ns=rs.buffer[this.index+3];return ns<(this._parent?rs.buffer[this._parent.index+3]:rs.buffer.length)?new BufferNode(this.context,this._parent,ns):this.externalSibling(1)}get prevSibling(){let{buffer:rs}=this.context,ns=this._parent?this._parent.index+4:0;return this.index==ns?this.externalSibling(-1):new BufferNode(this.context,this._parent,rs.findChild(ns,this.index,-1,0,4))}get cursor(){return new TreeCursor(this)}get tree(){return null}toTree(){let rs=[],ns=[],{buffer:ss}=this.context,os=this.index+4,ls=ss.buffer[this.index+3];if(ls>os){let us=ss.buffer[this.index+1],cs=ss.buffer[this.index+2];rs.push(ss.slice(os,ls,us,cs)),ns.push(0)}return new Tree(this.type,rs,ns,this.to-this.from)}resolve(rs,ns=0){return resolveNode(this,rs,ns,!1)}resolveInner(rs,ns=0){return resolveNode(this,rs,ns,!0)}enterUnfinishedNodesBefore(rs){return enterUnfinishedNodesBefore(this,rs)}toString(){return this.context.buffer.childString(this.index)}getChild(rs,ns=null,ss=null){let os=getChildren(this,rs,ns,ss);return os.length?os[0]:null}getChildren(rs,ns=null,ss=null){return getChildren(this,rs,ns,ss)}}class TreeCursor{constructor(rs,ns=0){if(this.mode=ns,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,rs instanceof TreeNode)this.yieldNode(rs);else{this._tree=rs.context.parent,this.buffer=rs.context;for(let ss=rs._parent;ss;ss=ss._parent)this.stack.unshift(ss.index);this.bufferNode=rs,this.yieldBuf(rs.index)}}get name(){return this.type.name}yieldNode(rs){return rs?(this._tree=rs,this.type=rs.type,this.from=rs.from,this.to=rs.to,!0):!1}yieldBuf(rs,ns){this.index=rs;let{start:ss,buffer:os}=this.buffer;return this.type=ns||os.set.types[os.buffer[rs]],this.from=ss+os.buffer[rs+1],this.to=ss+os.buffer[rs+2],!0}yield(rs){return rs?rs instanceof TreeNode?(this.buffer=null,this.yieldNode(rs)):(this.buffer=rs.context,this.yieldBuf(rs.index,rs.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(rs,ns,ss){if(!this.buffer)return this.yield(this._tree.nextChild(rs<0?this._tree.node.children.length-1:0,rs,ns,ss,this.mode));let{buffer:os}=this.buffer,ls=os.findChild(this.index+4,os.buffer[this.index+3],rs,ns-this.buffer.start,ss);return ls<0?!1:(this.stack.push(this.index),this.yieldBuf(ls))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(rs){return this.enterChild(1,rs,2)}childBefore(rs){return this.enterChild(-1,rs,-2)}enter(rs,ns,ss=!0,os=!0){return this.buffer?os?this.enterChild(1,rs,ns):!1:this.yield(this._tree.enter(rs,ns,ss&&!(this.mode&1),os))}parent(){if(!this.buffer)return this.yieldNode(this.mode&1?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let rs=this.mode&1?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(rs)}sibling(rs){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+rs,rs,0,4,this.mode)):!1;let{buffer:ns}=this.buffer,ss=this.stack.length-1;if(rs<0){let os=ss<0?0:this.stack[ss]+4;if(this.index!=os)return this.yieldBuf(ns.findChild(os,this.index,-1,0,4))}else{let os=ns.buffer[this.index+3];if(os<(ss<0?ns.buffer.length:ns.buffer[this.stack[ss]+3]))return this.yieldBuf(os)}return ss<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+rs,rs,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(rs){let ns,ss,{buffer:os}=this;if(os){if(rs>0){if(this.index-1)for(let ls=ns+rs,us=rs<0?-1:ss.node.children.length;ls!=us;ls+=rs){let cs=ss.node.children[ls];if(this.mode&1||cs instanceof TreeBuffer||!cs.type.isAnonymous||hasChild(cs))return!1}return!0}move(rs,ns){if(ns&&this.enterChild(rs,0,4))return!0;for(;;){if(this.sibling(rs))return!0;if(this.atLastNode(rs)||!this.parent())return!1}}next(rs=!0){return this.move(1,rs)}prev(rs=!0){return this.move(-1,rs)}moveTo(rs,ns=0){for(;(this.from==this.to||(ns<1?this.from>=rs:this.from>rs)||(ns>-1?this.to<=rs:this.to=0;){for(let us=rs;us;us=us._parent)if(us.index==os){if(os==this.index)return us;ns=us,ss=ls+1;break e}os=this.stack[--ls]}for(let os=ss;osrs instanceof TreeBuffer||!rs.type.isAnonymous||hasChild(rs))}function buildTree(as){var rs;let{buffer:ns,nodeSet:ss,maxBufferLength:os=DefaultBufferLength,reused:ls=[],minRepeatType:us=ss.types.length}=as,cs=Array.isArray(ns)?new FlatBufferCursor(ns,ns.length):ns,ds=ss.types,ps=0,fs=0;function hs(Ns,As,ws,Es,_s){let{id:$s,start:Rs,end:Is,size:Os}=cs,Ds=fs;for(;Os<0;)if(cs.next(),Os==-1){let Ms=ls[$s];ws.push(Ms),Es.push(Rs-Ns);return}else if(Os==-3){ps=$s;return}else if(Os==-4){fs=$s;return}else throw new RangeError(`Unrecognized record size: ${Os}`);let Vs=ds[$s],ks,Ps,Bs=Rs-Ns;if(Is-Rs<=os&&(Ps=vs(cs.pos-As,_s))){let Ms=new Uint16Array(Ps.size-Ps.skip),Ws=cs.pos-Ps.size,Us=Ms.length;for(;cs.pos>Ws;)Us=xs(Ps.start,Ms,Us);ks=new TreeBuffer(Ms,Is-Ps.start,ss),Bs=Ps.start-Ns}else{let Ms=cs.pos-Os;cs.next();let Ws=[],Us=[],js=$s>=us?$s:-1,Ls=0,Gs=Is;for(;cs.pos>Ms;)js>=0&&cs.id==js&&cs.size>=0?(cs.end<=Gs-os&&(ys(Ws,Us,Rs,Ls,cs.end,Gs,js,Ds),Ls=Ws.length,Gs=cs.end),cs.next()):hs(Rs,Ms,Ws,Us,js);if(js>=0&&Ls>0&&Ls-1&&Ls>0){let Hs=gs(Vs);ks=balanceRange(Vs,Ws,Us,0,Ws.length,0,Is-Rs,Hs,Hs)}else ks=bs(Vs,Ws,Us,Is-Rs,Ds-Is)}ws.push(ks),Es.push(Bs)}function gs(Ns){return(As,ws,Es)=>{let _s=0,$s=As.length-1,Rs,Is;if($s>=0&&(Rs=As[$s])instanceof Tree){if(!$s&&Rs.type==Ns&&Rs.length==Es)return Rs;(Is=Rs.prop(NodeProp.lookAhead))&&(_s=ws[$s]+Rs.length+Is)}return bs(Ns,As,ws,Es,_s)}}function ys(Ns,As,ws,Es,_s,$s,Rs,Is){let Os=[],Ds=[];for(;Ns.length>Es;)Os.push(Ns.pop()),Ds.push(As.pop()+ws-_s);Ns.push(bs(ss.types[Rs],Os,Ds,$s-_s,Is-$s)),As.push(_s-ws)}function bs(Ns,As,ws,Es,_s=0,$s){if(ps){let Rs=[NodeProp.contextHash,ps];$s=$s?[Rs].concat($s):[Rs]}if(_s>25){let Rs=[NodeProp.lookAhead,_s];$s=$s?[Rs].concat($s):[Rs]}return new Tree(Ns,As,ws,Es,$s)}function vs(Ns,As){let ws=cs.fork(),Es=0,_s=0,$s=0,Rs=ws.end-os,Is={size:0,start:0,skip:0};e:for(let Os=ws.pos-Ns;ws.pos>Os;){let Ds=ws.size;if(ws.id==As&&Ds>=0){Is.size=Es,Is.start=_s,Is.skip=$s,$s+=4,Es+=4,ws.next();continue}let Vs=ws.pos-Ds;if(Ds<0||Vs=us?4:0,Ps=ws.start;for(ws.next();ws.pos>Vs;){if(ws.size<0)if(ws.size==-3)ks+=4;else break e;else ws.id>=us&&(ks+=4);ws.next()}_s=Ps,Es+=Ds,$s+=ks}return(As<0||Es==Ns)&&(Is.size=Es,Is.start=_s,Is.skip=$s),Is.size>4?Is:void 0}function xs(Ns,As,ws){let{id:Es,start:_s,end:$s,size:Rs}=cs;if(cs.next(),Rs>=0&&Es4){let Os=cs.pos-(Rs-4);for(;cs.pos>Os;)ws=xs(Ns,As,ws)}As[--ws]=Is,As[--ws]=$s-Ns,As[--ws]=_s-Ns,As[--ws]=Es}else Rs==-3?ps=Es:Rs==-4&&(fs=Es);return ws}let Cs=[],Ts=[];for(;cs.pos>0;)hs(as.start||0,as.bufferStart||0,Cs,Ts,-1);let Ss=(rs=as.length)!==null&&rs!==void 0?rs:Cs.length?Ts[0]+Cs[0].length:0;return new Tree(ds[as.topID],Cs.reverse(),Ts.reverse(),Ss)}const nodeSizeCache=new WeakMap;function nodeSize(as,rs){if(!as.isAnonymous||rs instanceof TreeBuffer||rs.type!=as)return 1;let ns=nodeSizeCache.get(rs);if(ns==null){ns=1;for(let ss of rs.children){if(ss.type!=as||!(ss instanceof Tree)){ns=1;break}ns+=nodeSize(as,ss)}nodeSizeCache.set(rs,ns)}return ns}function balanceRange(as,rs,ns,ss,os,ls,us,cs,ds){let ps=0;for(let bs=ss;bs=fs)break;ws+=Es}if(Ss==Ns+1){if(ws>fs){let Es=bs[Ns];ys(Es.children,Es.positions,0,Es.children.length,vs[Ns]+Ts);continue}hs.push(bs[Ns])}else{let Es=vs[Ss-1]+bs[Ss-1].length-As;hs.push(balanceRange(as,bs,vs,Ns,Ss,As,Es,null,ds))}gs.push(As+Ts-ls)}}return ys(rs,ns,ss,os,0),(cs||ds)(hs,gs,us)}class TreeFragment{constructor(rs,ns,ss,os,ls=!1,us=!1){this.from=rs,this.to=ns,this.tree=ss,this.offset=os,this.open=(ls?1:0)|(us?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(rs,ns=[],ss=!1){let os=[new TreeFragment(0,rs.length,rs,0,!1,ss)];for(let ls of ns)ls.to>rs.length&&os.push(ls);return os}static applyChanges(rs,ns,ss=128){if(!ns.length)return rs;let os=[],ls=1,us=rs.length?rs[0]:null;for(let cs=0,ds=0,ps=0;;cs++){let fs=cs=ss)for(;us&&us.from=gs.from||hs<=gs.to||ps){let ys=Math.max(gs.from,ds)-ps,bs=Math.min(gs.to,hs)-ps;gs=ys>=bs?null:new TreeFragment(ys,bs,gs.tree,gs.offset+ps,cs>0,!!fs)}if(gs&&os.push(gs),us.to>hs)break;us=lsnew Range(os.from,os.to)):[new Range(0,0)]:[new Range(0,rs.length)],this.createParse(rs,ns||[],ss)}parse(rs,ns,ss){let os=this.startParse(rs,ns,ss);for(;;){let ls=os.advance();if(ls)return ls}}};class StringInput{constructor(rs){this.string=rs}get length(){return this.string.length}chunk(rs){return this.string.slice(rs)}get lineChunks(){return!1}read(rs,ns){return this.string.slice(rs,ns)}}new NodeProp({perNode:!0});let Stack$1=class mp{constructor(rs,ns,ss,os,ls,us,cs,ds,ps,fs=0,hs){this.p=rs,this.stack=ns,this.state=ss,this.reducePos=os,this.pos=ls,this.score=us,this.buffer=cs,this.bufferBase=ds,this.curContext=ps,this.lookAhead=fs,this.parent=hs}toString(){return`[${this.stack.filter((rs,ns)=>ns%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(rs,ns,ss=0){let os=rs.parser.context;return new mp(rs,[],ns,ss,ss,0,[],0,os?new StackContext(os,os.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(rs,ns){this.stack.push(this.state,ns,this.bufferBase+this.buffer.length),this.state=rs}reduce(rs){let ns=rs>>19,ss=rs&65535,{parser:os}=this.p,ls=os.dynamicPrecedence(ss);if(ls&&(this.score+=ls),ns==0){this.pushState(os.getGoto(this.state,ss,!0),this.reducePos),ssus;)this.stack.pop();this.reduceContext(ss,cs)}storeNode(rs,ns,ss,os=4,ls=!1){if(rs==0){let us=this,cs=this.buffer.length;if(cs==0&&us.parent&&(cs=us.bufferBase-us.parent.bufferBase,us=us.parent),cs>0&&us.buffer[cs-4]==0&&us.buffer[cs-1]>-1){if(ns==ss)return;if(us.buffer[cs-2]>=ns){us.buffer[cs-2]=ss;return}}}if(!ls||this.pos==ss)this.buffer.push(rs,ns,ss,os);else{let us=this.buffer.length;if(us>0&&this.buffer[us-4]!=0)for(;us>0&&this.buffer[us-2]>ss;)this.buffer[us]=this.buffer[us-4],this.buffer[us+1]=this.buffer[us-3],this.buffer[us+2]=this.buffer[us-2],this.buffer[us+3]=this.buffer[us-1],us-=4,os>4&&(os-=4);this.buffer[us]=rs,this.buffer[us+1]=ns,this.buffer[us+2]=ss,this.buffer[us+3]=os}}shift(rs,ns,ss){let os=this.pos;if(rs&131072)this.pushState(rs&65535,this.pos);else if(rs&262144)this.pos=ss,this.shiftContext(ns,os),ns<=this.p.parser.maxNode&&this.buffer.push(ns,os,ss,4);else{let ls=rs,{parser:us}=this.p;(ss>this.pos||ns<=us.maxNode)&&(this.pos=ss,us.stateFlag(ls,1)||(this.reducePos=ss)),this.pushState(ls,os),this.shiftContext(ns,os),ns<=us.maxNode&&this.buffer.push(ns,os,ss,4)}}apply(rs,ns,ss){rs&65536?this.reduce(rs):this.shift(rs,ns,ss)}useNode(rs,ns){let ss=this.p.reused.length-1;(ss<0||this.p.reused[ss]!=rs)&&(this.p.reused.push(rs),ss++);let os=this.pos;this.reducePos=this.pos=os+rs.length,this.pushState(ns,os),this.buffer.push(ss,os,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,rs,this,this.p.stream.reset(this.pos-rs.length)))}split(){let rs=this,ns=rs.buffer.length;for(;ns>0&&rs.buffer[ns-2]>rs.reducePos;)ns-=4;let ss=rs.buffer.slice(ns),os=rs.bufferBase+ns;for(;rs&&os==rs.bufferBase;)rs=rs.parent;return new mp(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,ss,os,this.curContext,this.lookAhead,rs)}recoverByDelete(rs,ns){let ss=rs<=this.p.parser.maxNode;ss&&this.storeNode(rs,this.pos,ns,4),this.storeNode(0,this.pos,ns,ss?8:4),this.pos=this.reducePos=ns,this.score-=190}canShift(rs){for(let ns=new SimulatedStack(this);;){let ss=this.p.parser.stateSlot(ns.state,4)||this.p.parser.hasAction(ns.state,rs);if(!(ss&65536))return!0;if(ss==0)return!1;ns.reduce(ss)}}recoverByInsert(rs){if(this.stack.length>=300)return[];let ns=this.p.parser.nextStates(this.state);if(ns.length>4<<1||this.stack.length>=120){let os=[];for(let ls=0,us;lsds&1&&cs==us)||os.push(ns[ls],us)}ns=os}let ss=[];for(let os=0;os>19,os=rs&65535,ls=this.stack.length-ss*3;if(ls<0||ns.getGoto(this.stack[ls],os,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reduce(rs),!0}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:rs}=this.p;return rs.data[rs.stateSlot(this.state,1)]==65535&&!rs.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(rs){if(this.state!=rs.state||this.stack.length!=rs.stack.length)return!1;for(let ns=0;nsthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=rs)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}};class StackContext{constructor(rs,ns){this.tracker=rs,this.context=ns,this.hash=rs.strict?rs.hash(ns):0}}var Recover;(function(as){as[as.Insert=200]="Insert",as[as.Delete=190]="Delete",as[as.Reduce=100]="Reduce",as[as.MaxNext=4]="MaxNext",as[as.MaxInsertStackDepth=300]="MaxInsertStackDepth",as[as.DampenInsertStackDepth=120]="DampenInsertStackDepth"})(Recover||(Recover={}));class SimulatedStack{constructor(rs){this.start=rs,this.state=rs.state,this.stack=rs.stack,this.base=this.stack.length}reduce(rs){let ns=rs&65535,ss=rs>>19;ss==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(ss-1)*3;let os=this.start.p.parser.getGoto(this.stack[this.base-3],ns,!0);this.state=os}}class StackBufferCursor{constructor(rs,ns,ss){this.stack=rs,this.pos=ns,this.index=ss,this.buffer=rs.buffer,this.index==0&&this.maybeNext()}static create(rs,ns=rs.bufferBase+rs.buffer.length){return new StackBufferCursor(rs,ns,ns-rs.bufferBase)}maybeNext(){let rs=this.stack.parent;rs!=null&&(this.index=this.stack.bufferBase-rs.bufferBase,this.stack=rs,this.buffer=rs.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new StackBufferCursor(this.stack,this.pos,this.index)}}class CachedToken{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const nullToken=new CachedToken;class InputStream{constructor(rs,ns){this.input=rs,this.ranges=ns,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=nullToken,this.rangeIndex=0,this.pos=this.chunkPos=ns[0].from,this.range=ns[0],this.end=ns[ns.length-1].to,this.readNext()}resolveOffset(rs,ns){let ss=this.range,os=this.rangeIndex,ls=this.pos+rs;for(;lsss.to:ls>=ss.to;){if(os==this.ranges.length-1)return null;let us=this.ranges[++os];ls+=us.from-ss.to,ss=us}return ls}peek(rs){let ns=this.chunkOff+rs,ss,os;if(ns>=0&&ns=this.chunk2Pos&&sscs.to&&(this.chunk2=this.chunk2.slice(0,cs.to-ss)),os=this.chunk2.charCodeAt(0)}}return ss>=this.token.lookAhead&&(this.token.lookAhead=ss+1),os}acceptToken(rs,ns=0){let ss=ns?this.resolveOffset(ns,-1):this.pos;if(ss==null||ss=this.chunk2Pos&&this.posthis.range.to?rs.slice(0,this.range.to-this.pos):rs,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(rs=1){for(this.chunkOff+=rs;this.pos+rs>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();rs-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=rs,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(rs,ns){if(ns?(this.token=ns,ns.start=rs,ns.lookAhead=rs+1,ns.value=ns.extended=-1):this.token=nullToken,this.pos!=rs){if(this.pos=rs,rs==this.end)return this.setDone(),this;for(;rs=this.range.to;)this.range=this.ranges[++this.rangeIndex];rs>=this.chunkPos&&rs=this.chunkPos&&ns<=this.chunkPos+this.chunk.length)return this.chunk.slice(rs-this.chunkPos,ns-this.chunkPos);if(rs>=this.chunk2Pos&&ns<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(rs-this.chunk2Pos,ns-this.chunk2Pos);if(rs>=this.range.from&&ns<=this.range.to)return this.input.read(rs,ns);let ss="";for(let os of this.ranges){if(os.from>=ns)break;os.to>rs&&(ss+=this.input.read(Math.max(os.from,rs),Math.min(os.to,ns)))}return ss}}class TokenGroup{constructor(rs,ns){this.data=rs,this.id=ns}token(rs,ns){readToken(this.data,rs,ns,this.id)}}TokenGroup.prototype.contextual=TokenGroup.prototype.fallback=TokenGroup.prototype.extend=!1;class ExternalTokenizer{constructor(rs,ns={}){this.token=rs,this.contextual=!!ns.contextual,this.fallback=!!ns.fallback,this.extend=!!ns.extend}}function readToken(as,rs,ns,ss){let os=0,ls=1<0){let fs=as[ps];if(cs.allows(fs)&&(rs.token.value==-1||rs.token.value==fs||us.overrides(fs,rs.token.value))){rs.acceptToken(fs);break}}for(let ps=rs.next,fs=0,hs=as[os+2];fs>1,ys=ds+gs+(gs<<1),bs=as[ys],vs=as[ys+1];if(ps=vs)fs=gs+1;else{os=as[ys+2],rs.advance();continue e}}break}}function decodeArray(as,rs=Uint16Array){if(typeof as!="string")return as;let ns=null;for(let ss=0,os=0;ss=92&&us--,us>=34&&us--;let ds=us-32;if(ds>=46&&(ds-=46,cs=!0),ls+=ds,cs)break;ls*=46}ns?ns[os++]=ls:ns=new rs(ls)}return ns}const verbose=typeof browser$1$2<"u"&&/\bparse\b/.test({}.LOG);let stackIDs=null;var Safety;(function(as){as[as.Margin=25]="Margin"})(Safety||(Safety={}));function cutAt(as,rs,ns){let ss=as.fullCursor();for(ss.moveTo(rs);;)if(!(ns<0?ss.childBefore(rs):ss.childAfter(rs)))for(;;){if((ns<0?ss.tors)&&!ss.type.isError)return ns<0?Math.max(0,Math.min(ss.to-1,rs-25)):Math.min(as.length,Math.max(ss.from+1,rs+25));if(ns<0?ss.prevSibling():ss.nextSibling())break;if(!ss.parent())return ns<0?0:as.length}}class FragmentCursor{constructor(rs,ns){this.fragments=rs,this.nodeSet=ns,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let rs=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(rs){for(this.safeFrom=rs.openStart?cutAt(rs.tree,rs.from+rs.offset,1)-rs.offset:rs.from,this.safeTo=rs.openEnd?cutAt(rs.tree,rs.to+rs.offset,-1)-rs.offset:rs.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(rs.tree),this.start.push(-rs.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(rs){if(rsrs)return this.nextStart=us,null;if(ls instanceof Tree){if(us==rs){if(us=Math.max(this.safeFrom,rs)&&(this.trees.push(ls),this.start.push(us),this.index.push(0))}else this.index[ns]++,this.nextStart=us+ls.length}}}class TokenCache{constructor(rs,ns){this.stream=ns,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=rs.tokenizers.map(ss=>new CachedToken)}getActions(rs){let ns=0,ss=null,{parser:os}=rs.p,{tokenizers:ls}=os,us=os.stateSlot(rs.state,3),cs=rs.curContext?rs.curContext.hash:0,ds=0;for(let ps=0;pshs.end+25&&(ds=Math.max(hs.lookAhead,ds)),hs.value!=0)){let gs=ns;if(hs.extended>-1&&(ns=this.addActions(rs,hs.extended,hs.end,ns)),ns=this.addActions(rs,hs.value,hs.end,ns),!fs.extend&&(ss=hs,ns>gs))break}}for(;this.actions.length>ns;)this.actions.pop();return ds&&rs.setLookAhead(ds),!ss&&rs.pos==this.stream.end&&(ss=new CachedToken,ss.value=rs.p.parser.eofTerm,ss.start=ss.end=rs.pos,ns=this.addActions(rs,ss.value,ss.end,ns)),this.mainToken=ss,this.actions}getMainToken(rs){if(this.mainToken)return this.mainToken;let ns=new CachedToken,{pos:ss,p:os}=rs;return ns.start=ss,ns.end=Math.min(ss+1,os.stream.end),ns.value=ss==os.stream.end?os.parser.eofTerm:0,ns}updateCachedToken(rs,ns,ss){if(ns.token(this.stream.reset(ss.pos,rs),ss),rs.value>-1){let{parser:os}=ss.p;for(let ls=0;ls=0&&ss.p.parser.dialect.allows(us>>1)){us&1?rs.extended=us>>1:rs.value=us>>1;break}}}else rs.value=0,rs.end=Math.min(ss.p.stream.end,ss.pos+1)}putAction(rs,ns,ss,os){for(let ls=0;lsrs.bufferLength*4?new FragmentCursor(ss,rs.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let rs=this.stacks,ns=this.minStackPos,ss=this.stacks=[],os,ls;for(let us=0;usns)ss.push(cs);else{if(this.advanceStack(cs,ss,rs))continue;{os||(os=[],ls=[]),os.push(cs);let ds=this.tokens.getMainToken(cs);ls.push(ds.value,ds.end)}}break}}if(!ss.length){let us=os&&findFinished(os);if(us)return this.stackToTree(us);if(this.parser.strict)throw verbose&&os&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+ns);this.recovering||(this.recovering=5)}if(this.recovering&&os){let us=this.stoppedAt!=null&&os[0].pos>this.stoppedAt?os[0]:this.runRecovery(os,ls,ss);if(us)return this.stackToTree(us.forceAll())}if(this.recovering){let us=this.recovering==1?1:this.recovering*3;if(ss.length>us)for(ss.sort((cs,ds)=>ds.score-cs.score);ss.length>us;)ss.pop();ss.some(cs=>cs.reducePos>ns)&&this.recovering--}else if(ss.length>1)e:for(let us=0;us500&&ps.buffer.length>500)if((cs.score-ps.score||cs.buffer.length-ps.buffer.length)>0)ss.splice(ds--,1);else{ss.splice(us--,1);continue e}}}this.minStackPos=ss[0].pos;for(let us=1;us ":"";if(this.stoppedAt!=null&&os>this.stoppedAt)return rs.forceReduce()?rs:null;if(this.fragments){let ps=rs.curContext&&rs.curContext.tracker.strict,fs=ps?rs.curContext.hash:0;for(let hs=this.fragments.nodeAt(os);hs;){let gs=this.parser.nodeSet.types[hs.type.id]==hs.type?ls.getGoto(rs.state,hs.type.id):-1;if(gs>-1&&hs.length&&(!ps||(hs.prop(NodeProp.contextHash)||0)==fs))return rs.useNode(hs,gs),verbose&&console.log(us+this.stackID(rs)+` (via reuse of ${ls.getName(hs.type.id)})`),!0;if(!(hs instanceof Tree)||hs.children.length==0||hs.positions[0]>0)break;let ys=hs.children[0];if(ys instanceof Tree&&hs.positions[0]==0)hs=ys;else break}}let cs=ls.stateSlot(rs.state,4);if(cs>0)return rs.reduce(cs),verbose&&console.log(us+this.stackID(rs)+` (via always-reduce ${ls.getName(cs&65535)})`),!0;if(rs.stack.length>=15e3)for(;rs.stack.length>9e3&&rs.forceReduce(););let ds=this.tokens.getActions(rs);for(let ps=0;psos?ns.push(bs):ss.push(bs)}return!1}advanceFully(rs,ns){let ss=rs.pos;for(;;){if(!this.advanceStack(rs,null,null))return!1;if(rs.pos>ss)return pushStackDedup(rs,ns),!0}}runRecovery(rs,ns,ss){let os=null,ls=!1;for(let us=0;us ":"";if(cs.deadEnd&&(ls||(ls=!0,cs.restart(),verbose&&console.log(fs+this.stackID(cs)+" (restarted)"),this.advanceFully(cs,ss))))continue;let hs=cs.split(),gs=fs;for(let ys=0;hs.forceReduce()&&ys<10&&(verbose&&console.log(gs+this.stackID(hs)+" (via force-reduce)"),!this.advanceFully(hs,ss));ys++)verbose&&(gs=this.stackID(hs)+" -> ");for(let ys of cs.recoverByInsert(ds))verbose&&console.log(fs+this.stackID(ys)+" (via recover-insert)"),this.advanceFully(ys,ss);this.stream.end>cs.pos?(ps==cs.pos&&(ps++,ds=0),cs.recoverByDelete(ds,ps),verbose&&console.log(fs+this.stackID(cs)+` (via recover-delete ${this.parser.getName(ds)})`),pushStackDedup(cs,ss)):(!os||os.scoreas;class ContextTracker{constructor(rs){this.start=rs.start,this.shift=rs.shift||id,this.reduce=rs.reduce||id,this.reuse=rs.reuse||id,this.hash=rs.hash||(()=>0),this.strict=rs.strict!==!1}}class LRParser extends Parser$1{constructor(rs){if(super(),this.wrappers=[],rs.version!=13)throw new RangeError(`Parser version (${rs.version}) doesn't match runtime version (13)`);let ns=rs.nodeNames.split(" ");this.minRepeatTerm=ns.length;for(let cs=0;csrs.topRules[cs][1]),os=[];for(let cs=0;cs=0)ls(fs,ds,cs[ps++]);else{let hs=cs[ps+-fs];for(let gs=-fs;gs>0;gs--)ls(cs[ps++],ds,hs);ps++}}}this.nodeSet=new NodeSet(ns.map((cs,ds)=>NodeType.define({name:ds>=this.minRepeatTerm?void 0:cs,id:ds,props:os[ds],top:ss.indexOf(ds)>-1,error:ds==0,skipped:rs.skippedNodes&&rs.skippedNodes.indexOf(ds)>-1}))),this.strict=!1,this.bufferLength=DefaultBufferLength;let us=decodeArray(rs.tokenData);if(this.context=rs.context,this.specialized=new Uint16Array(rs.specialized?rs.specialized.length:0),this.specializers=[],rs.specialized)for(let cs=0;cstypeof cs=="number"?new TokenGroup(us,cs):cs),this.topRules=rs.topRules,this.dialects=rs.dialects||{},this.dynamicPrecedences=rs.dynamicPrecedences||null,this.tokenPrecTable=rs.tokenPrec,this.termNames=rs.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(rs,ns,ss){let os=new Parse(this,rs,ns,ss);for(let ls of this.wrappers)os=ls(os,rs,ns,ss);return os}getGoto(rs,ns,ss=!1){let os=this.goto;if(ns>=os[0])return-1;for(let ls=os[ns+1];;){let us=os[ls++],cs=us&1,ds=os[ls++];if(cs&&ss)return ds;for(let ps=ls+(us>>1);ls0}validAction(rs,ns){if(ns==this.stateSlot(rs,4))return!0;for(let ss=this.stateSlot(rs,1);;ss+=3){if(this.data[ss]==65535)if(this.data[ss+1]==1)ss=pair(this.data,ss+2);else return!1;if(ns==pair(this.data,ss+1))return!0}}nextStates(rs){let ns=[];for(let ss=this.stateSlot(rs,1);;ss+=3){if(this.data[ss]==65535)if(this.data[ss+1]==1)ss=pair(this.data,ss+2);else break;if(!(this.data[ss+2]&1)){let os=this.data[ss+1];ns.some((ls,us)=>us&1&&ls==os)||ns.push(this.data[ss],os)}}return ns}overrides(rs,ns){let ss=findOffset(this.data,this.tokenPrecTable,ns);return ss<0||findOffset(this.data,this.tokenPrecTable,rs){let os=rs.tokenizers.find(ls=>ls.from==ss);return os?os.to:ss})),rs.contextTracker&&(ns.context=rs.contextTracker),rs.dialect&&(ns.dialect=this.parseDialect(rs.dialect)),rs.strict!=null&&(ns.strict=rs.strict),rs.wrap&&(ns.wrappers=ns.wrappers.concat(rs.wrap)),rs.bufferLength!=null&&(ns.bufferLength=rs.bufferLength),ns}getName(rs){return this.termNames?this.termNames[rs]:String(rs<=this.maxNode&&this.nodeSet.types[rs].name||rs)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(rs){let ns=this.dynamicPrecedences;return ns==null?0:ns[rs]||0}parseDialect(rs){let ns=Object.keys(this.dialects),ss=ns.map(()=>!1);if(rs)for(let ls of rs.split(" ")){let us=ns.indexOf(ls);us>=0&&(ss[us]=!0)}let os=null;for(let ls=0;lsss)&&ns.p.parser.stateFlag(ns.state,2)&&(!rs||rs.score=65&&as<=90||as==95||as>=97&&as<=122||as>=161}function isSpace(as){return as==9||as==10||as==13||as==32}let cachedName=null,cachedInput=null,cachedPos=0;function tagNameAfter(as,rs){let ns=as.pos+rs;if(cachedInput==as&&cachedPos==ns)return cachedName;for(;isSpace(as.peek(rs));)rs++;let ss="";for(;;){let os=as.peek(rs);if(!nameChar(os))break;ss+=String.fromCharCode(os),rs++}return cachedInput=as,cachedPos=ns,cachedName=ss||null}function ElementContext(as,rs){this.name=as,this.parent=rs,this.hash=rs?rs.hash:0;for(let ns=0;ns{if(as.next==60){if(as.advance(),as.next==47){as.advance();let ns=tagNameAfter(as,0);if(!ns)return as.acceptToken(incompleteStartCloseTag);if(rs.context&&ns.toLowerCase()==rs.context.name.toLowerCase())return as.acceptToken(StartCloseTag);for(let ss=rs.context;ss;ss=ss.parent)if(ss.name==ns)return as.acceptToken(MissingCloseTag,-2);as.acceptToken(mismatchedStartCloseTag)}else if(as.next!=33&&as.next!=63&&!isSpace(as.next))return as.acceptToken(StartTag)}},{contextual:!0});function scanTo(as,rs){return new ExternalTokenizer(ns=>{for(let ss=0,os=0;;os++){if(ns.next<0){os&&ns.acceptToken(as);break}if(ns.next==rs.charCodeAt(ss)){if(ss++,ss==rs.length){os>rs.length&&ns.acceptToken(as,1-rs.length);break}}else ss=0;ns.advance()}})}const commentContent=scanTo(commentContent$1,"-->"),parser=LRParser.deserialize({version:13,states:"*[OQOTOOO]OYO'#CdOeO`O'#CfO!OOTO'#CeOOOP'#Ce'#CeOOOP'#Cx'#CxOOOP'#Co'#CoQQOTOOOOOQ'#Cp'#CpO!VOYO,59OOOOP,59O,59OO!_OpO,59QO!mO`O'#ClOOOP'#DT'#DTOOOP'#Cu'#CuO!rOTO,59PO!yO`O'#CmOOOP,59P,59POOOP-E6m-E6mOOOQ-E6n-E6nOOOP1G.j1G.jOOOO'#Cq'#CqO#ROpO1G.lO#aOpO'#ChOOOO'#Cr'#CrO#rOpO1G.lOOOP1G.l1G.lOOOP1G.t1G.tO#}OWO,59WOOOP-E6s-E6sOOOP1G.k1G.kO$SO`O,59XO$[OWO,59XOOOO-E6o-E6oO$dOpO7+$WOOOP7+$W7+$WOOOP7+$`7+$`O$oOpO,59SO%QOWO,59SOOOO-E6p-E6pOOOP1G.r1G.rO%]OWO1G.sO%]OWO1G.sOOOP1G.s1G.sOOOP< tag. Found ${as.slice(ds-1,bs)}`)}us.firstChild();let gs=as.substring(us.from,us.to);if(us.nextSibling()===!1){if(gs in ps)throw Error(`Duplicate attribute ${gs}. Found in component of type ${cs} at indices ${us.from}-${us.to}`);ps[gs]=!0}else{us.nextSibling();let ys=as.substring(us.from+1,us.to-1);if(gs in ps)throw Error(`Duplicate attribute ${gs}. Found in component of type ${cs} at indices ${us.from}-${us.to}`);ps[gs]=ys}us.parent()}us.parent();let fs=us.to,hs={componentType:cs,props:{...ps},children:[]};for(;us.nextSibling();)if(us.name==="Text"){let gs=as.substring(us.from,us.to);gs!==""&&hs.children.push(gs)}else if(us.name==="Element")hs.children.push(rs(us.node.cursor));else{if(us.name==="CloseTag")break;if(us.name==="Comment")continue;throw us.name==="MismatchedCloseTag"?Error(`Invalid DoenetML at position ${us.from}. Mismatched closing tag. Expected . Found ${as.slice(us.from,us.to)}.`):Error(`Invalid DoenetML at position ${us.from}. Expected a closing tag. Instead found ${as.slice(us.from,us.to)}.`)}return hs.range={openBegin:ds,openEnd:fs,closeBegin:us.from,closeEnd:us.to},hs}else if(us.name==="SelfClosingTag"){us.firstChild(),us.nextSibling();let cs=as.substring(us.from,us.to),ds=us.from,ps={};for(;us.nextSibling();){if(us.name!=="Attribute")throw Error(`Invalid DoenetML at positions ${us.from} to ${us.to}. Error in self-closing <${cs}/> tag.`);us.firstChild();let hs=as.substring(us.from,us.to);if(us.nextSibling()===!1){if(hs in ps)throw Error(`Duplicate attribute ${hs}. Found in component of type ${cs} at indices ${us.from}-${us.to}`);ps[hs]=!0}else{if(us.nextSibling(),hs in ps)throw Error(`Duplicate attribute ${hs}. Found in component of type ${cs} at indices ${us.from}-${us.to}`);let gs=as.substring(us.from+1,us.to-1);ps[hs]=gs}us.parent()}let fs={selfCloseBegin:ds,selfCloseEnd:us.to+3};return{componentType:cs,props:{...ps},children:[],range:fs}}else throw Error("Non SelfClosingTag/OpenTag in Element. How did you do that?")}function ns(us){if(us.node.name==="Element")return rs(us.node.cursor);if(us.node.name==="Comment")return null;if(us.node.name==="Text"){let cs=as.substring(us.node.from,us.node.to);if(cs!=="")return cs}else throw Error(`Invalid DoenetML at positions ${us.node.from} to ${us.node.to}. Found ${as.substring(us.node.from,us.node.to)}`)}if(!as)return[];let ss=parse(as),os=[];if(!ss.firstChild())return os;let ls=ns(ss);for(ls!=null&&os.push(ls);ss.nextSibling();){let us=ns(ss);us!=null&&os.push(us)}return os}var base32Exports={},base32$1={get exports(){return base32Exports},set exports(as){base32Exports=as}};(function(as){(function(){var rs=typeof window=="object"?window:{},ns=!rs.HI_BASE32_NO_NODE_JS&&typeof browser$1$2=="object"&&browser$1$2.versions&&browser$1$2.versions.node;ns&&(rs=commonjsGlobal$1);var ss=!rs.HI_BASE32_NO_COMMON_JS&&!0&&as.exports,os="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".split(""),ls={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,2:26,3:27,4:28,5:29,6:30,7:31},us=[0,0,0,0,0,0,0,0],cs=function(xs,Cs){Cs.length>10&&(Cs="..."+Cs.substr(-10));var Ts=new Error("Decoded data is not valid UTF-8. Maybe try base32.decode.asBytes()? Partial data after reading "+xs+" bytes: "+Cs+" <-");throw Ts.position=xs,Ts},ds=function(xs){for(var Cs="",Ts=xs.length,Ss=0,Ns=0,As,ws;Ss191&&As<=223?(ws=As&31,Ns=1):As<=239?(ws=As&15,Ns=2):As<=247?(ws=As&7,Ns=3):cs(Ss,Cs);for(var Es=0;Es191)&&cs(Ss,Cs),ws<<=6,ws+=As&63;ws>=55296&&ws<=57343&&cs(Ss,Cs),ws>1114111&&cs(Ss,Cs),ws<=65535?Cs+=String.fromCharCode(ws):(ws-=65536,Cs+=String.fromCharCode((ws>>10)+55296),Cs+=String.fromCharCode((ws&1023)+56320))}return Cs},ps=function(xs){if(xs==="")return[];if(!/^[A-Z2-7=]+$/.test(xs))throw new Error("Invalid base32 characters");xs=xs.replace(/=/g,"");for(var Cs,Ts,Ss,Ns,As,ws,Es,_s,$s=[],Rs=0,Is=xs.length,Os=0,Ds=Is>>3<<3;Os>>2)&255,$s[Rs++]=(Ts<<6|Ss<<1|Ns>>>4)&255,$s[Rs++]=(Ns<<4|As>>>1)&255,$s[Rs++]=(As<<7|ws<<2|Es>>>3)&255,$s[Rs++]=(Es<<5|_s)&255;var Vs=Is-Ds;return Vs===2?(Cs=ls[xs.charAt(Os++)],Ts=ls[xs.charAt(Os++)],$s[Rs++]=(Cs<<3|Ts>>>2)&255):Vs===4?(Cs=ls[xs.charAt(Os++)],Ts=ls[xs.charAt(Os++)],Ss=ls[xs.charAt(Os++)],Ns=ls[xs.charAt(Os++)],$s[Rs++]=(Cs<<3|Ts>>>2)&255,$s[Rs++]=(Ts<<6|Ss<<1|Ns>>>4)&255):Vs===5?(Cs=ls[xs.charAt(Os++)],Ts=ls[xs.charAt(Os++)],Ss=ls[xs.charAt(Os++)],Ns=ls[xs.charAt(Os++)],As=ls[xs.charAt(Os++)],$s[Rs++]=(Cs<<3|Ts>>>2)&255,$s[Rs++]=(Ts<<6|Ss<<1|Ns>>>4)&255,$s[Rs++]=(Ns<<4|As>>>1)&255):Vs===7&&(Cs=ls[xs.charAt(Os++)],Ts=ls[xs.charAt(Os++)],Ss=ls[xs.charAt(Os++)],Ns=ls[xs.charAt(Os++)],As=ls[xs.charAt(Os++)],ws=ls[xs.charAt(Os++)],Es=ls[xs.charAt(Os++)],$s[Rs++]=(Cs<<3|Ts>>>2)&255,$s[Rs++]=(Ts<<6|Ss<<1|Ns>>>4)&255,$s[Rs++]=(Ns<<4|As>>>1)&255,$s[Rs++]=(As<<7|ws<<2|Es>>>3)&255),$s},fs=function(xs){for(var Cs,Ts,Ss,Ns,As,ws="",Es=xs.length,_s=0,$s=parseInt(Es/5)*5;_s<$s;)Cs=xs.charCodeAt(_s++),Ts=xs.charCodeAt(_s++),Ss=xs.charCodeAt(_s++),Ns=xs.charCodeAt(_s++),As=xs.charCodeAt(_s++),ws+=os[Cs>>>3]+os[(Cs<<2|Ts>>>6)&31]+os[Ts>>>1&31]+os[(Ts<<4|Ss>>>4)&31]+os[(Ss<<1|Ns>>>7)&31]+os[Ns>>>2&31]+os[(Ns<<3|As>>>5)&31]+os[As&31];var Rs=Es-$s;return Rs===1?(Cs=xs.charCodeAt(_s),ws+=os[Cs>>>3]+os[Cs<<2&31]+"======"):Rs===2?(Cs=xs.charCodeAt(_s++),Ts=xs.charCodeAt(_s),ws+=os[Cs>>>3]+os[(Cs<<2|Ts>>>6)&31]+os[Ts>>>1&31]+os[Ts<<4&31]+"===="):Rs===3?(Cs=xs.charCodeAt(_s++),Ts=xs.charCodeAt(_s++),Ss=xs.charCodeAt(_s),ws+=os[Cs>>>3]+os[(Cs<<2|Ts>>>6)&31]+os[Ts>>>1&31]+os[(Ts<<4|Ss>>>4)&31]+os[Ss<<1&31]+"==="):Rs===4&&(Cs=xs.charCodeAt(_s++),Ts=xs.charCodeAt(_s++),Ss=xs.charCodeAt(_s++),Ns=xs.charCodeAt(_s),ws+=os[Cs>>>3]+os[(Cs<<2|Ts>>>6)&31]+os[Ts>>>1&31]+os[(Ts<<4|Ss>>>4)&31]+os[(Ss<<1|Ns>>>7)&31]+os[Ns>>>2&31]+os[Ns<<3&31]+"="),ws},hs=function(xs){var Cs,Ts,Ss,Ns,As,ws,Es=!1,_s="",$s=0,Rs,Is=0,Os=xs.length;if(xs==="")return _s;do{for(us[0]=us[5],us[1]=us[6],us[2]=us[7],Rs=Is;$s>6,us[Rs++]=128|ws&63):ws<55296||ws>=57344?(us[Rs++]=224|ws>>12,us[Rs++]=128|ws>>6&63,us[Rs++]=128|ws&63):(ws=65536+((ws&1023)<<10|xs.charCodeAt(++$s)&1023),us[Rs++]=240|ws>>18,us[Rs++]=128|ws>>12&63,us[Rs++]=128|ws>>6&63,us[Rs++]=128|ws&63);Is=Rs-5,$s===Os&&++$s,$s>Os&&Rs<6&&(Es=!0),Cs=us[0],Rs>4?(Ts=us[1],Ss=us[2],Ns=us[3],As=us[4],_s+=os[Cs>>>3]+os[(Cs<<2|Ts>>>6)&31]+os[Ts>>>1&31]+os[(Ts<<4|Ss>>>4)&31]+os[(Ss<<1|Ns>>>7)&31]+os[Ns>>>2&31]+os[(Ns<<3|As>>>5)&31]+os[As&31]):Rs===1?_s+=os[Cs>>>3]+os[Cs<<2&31]+"======":Rs===2?(Ts=us[1],_s+=os[Cs>>>3]+os[(Cs<<2|Ts>>>6)&31]+os[Ts>>>1&31]+os[Ts<<4&31]+"===="):Rs===3?(Ts=us[1],Ss=us[2],_s+=os[Cs>>>3]+os[(Cs<<2|Ts>>>6)&31]+os[Ts>>>1&31]+os[(Ts<<4|Ss>>>4)&31]+os[Ss<<1&31]+"==="):(Ts=us[1],Ss=us[2],Ns=us[3],_s+=os[Cs>>>3]+os[(Cs<<2|Ts>>>6)&31]+os[Ts>>>1&31]+os[(Ts<<4|Ss>>>4)&31]+os[(Ss<<1|Ns>>>7)&31]+os[Ns>>>2&31]+os[Ns<<3&31]+"=")}while(!Es);return _s},gs=function(xs){for(var Cs,Ts,Ss,Ns,As,ws="",Es=xs.length,_s=0,$s=parseInt(Es/5)*5;_s<$s;)Cs=xs[_s++],Ts=xs[_s++],Ss=xs[_s++],Ns=xs[_s++],As=xs[_s++],ws+=os[Cs>>>3]+os[(Cs<<2|Ts>>>6)&31]+os[Ts>>>1&31]+os[(Ts<<4|Ss>>>4)&31]+os[(Ss<<1|Ns>>>7)&31]+os[Ns>>>2&31]+os[(Ns<<3|As>>>5)&31]+os[As&31];var Rs=Es-$s;return Rs===1?(Cs=xs[_s],ws+=os[Cs>>>3]+os[Cs<<2&31]+"======"):Rs===2?(Cs=xs[_s++],Ts=xs[_s],ws+=os[Cs>>>3]+os[(Cs<<2|Ts>>>6)&31]+os[Ts>>>1&31]+os[Ts<<4&31]+"===="):Rs===3?(Cs=xs[_s++],Ts=xs[_s++],Ss=xs[_s],ws+=os[Cs>>>3]+os[(Cs<<2|Ts>>>6)&31]+os[Ts>>>1&31]+os[(Ts<<4|Ss>>>4)&31]+os[Ss<<1&31]+"==="):Rs===4&&(Cs=xs[_s++],Ts=xs[_s++],Ss=xs[_s++],Ns=xs[_s],ws+=os[Cs>>>3]+os[(Cs<<2|Ts>>>6)&31]+os[Ts>>>1&31]+os[(Ts<<4|Ss>>>4)&31]+os[(Ss<<1|Ns>>>7)&31]+os[Ns>>>2&31]+os[Ns<<3&31]+"="),ws},ys=function(xs,Cs){var Ts=typeof xs!="string";return Ts&&xs.constructor===ArrayBuffer&&(xs=new Uint8Array(xs)),Ts?gs(xs):Cs?fs(xs):hs(xs)},bs=function(xs,Cs){if(!Cs)return ds(ps(xs));if(xs==="")return"";if(!/^[A-Z2-7=]+$/.test(xs))throw new Error("Invalid base32 characters");var Ts,Ss,Ns,As,ws,Es,_s,$s,Rs="",Is=xs.indexOf("=");Is===-1&&(Is=xs.length);for(var Os=0,Ds=Is>>3<<3;Os>>2)&255)+String.fromCharCode((Ss<<6|Ns<<1|As>>>4)&255)+String.fromCharCode((As<<4|ws>>>1)&255)+String.fromCharCode((ws<<7|Es<<2|_s>>>3)&255)+String.fromCharCode((_s<<5|$s)&255);var Vs=Is-Ds;return Vs===2?(Ts=ls[xs.charAt(Os++)],Ss=ls[xs.charAt(Os++)],Rs+=String.fromCharCode((Ts<<3|Ss>>>2)&255)):Vs===4?(Ts=ls[xs.charAt(Os++)],Ss=ls[xs.charAt(Os++)],Ns=ls[xs.charAt(Os++)],As=ls[xs.charAt(Os++)],Rs+=String.fromCharCode((Ts<<3|Ss>>>2)&255)+String.fromCharCode((Ss<<6|Ns<<1|As>>>4)&255)):Vs===5?(Ts=ls[xs.charAt(Os++)],Ss=ls[xs.charAt(Os++)],Ns=ls[xs.charAt(Os++)],As=ls[xs.charAt(Os++)],ws=ls[xs.charAt(Os++)],Rs+=String.fromCharCode((Ts<<3|Ss>>>2)&255)+String.fromCharCode((Ss<<6|Ns<<1|As>>>4)&255)+String.fromCharCode((As<<4|ws>>>1)&255)):Vs===7&&(Ts=ls[xs.charAt(Os++)],Ss=ls[xs.charAt(Os++)],Ns=ls[xs.charAt(Os++)],As=ls[xs.charAt(Os++)],ws=ls[xs.charAt(Os++)],Es=ls[xs.charAt(Os++)],_s=ls[xs.charAt(Os++)],Rs+=String.fromCharCode((Ts<<3|Ss>>>2)&255)+String.fromCharCode((Ss<<6|Ns<<1|As>>>4)&255)+String.fromCharCode((As<<4|ws>>>1)&255)+String.fromCharCode((ws<<7|Es<<2|_s>>>3)&255)),Rs},vs={encode:ys,decode:bs};bs.asBytes=ps,ss?as.exports=vs:rs.base32=vs})()})(base32$1);const base32=base32Exports;async function cidFromText(as){let ns=new TextEncoder().encode(as);return await cidFromArrayBuffer(ns)}async function cidFromArrayBuffer(as){let rs=await crypto.subtle.digest("SHA-256",as),ns=new Uint8Array(36);return ns.set([1,85,18,32]),ns.set(new Uint8Array(rs),4),"b"+base32.encode(ns).toLowerCase().replace(/=+/,"")}const textByCid={};function retrieveTextFileForCid(as,rs="doenet"){return textByCid[as]!==void 0?Promise.resolve(textByCid[as]):new Promise((ns,ss)=>{let os=retrieveTextFileFromIPFS(as),ls=os.promise,us=os.controller,cs,ds=!1,ps=!1,fs;ls.then(hs=>{clearTimeout(fs),cs&&!ps&&cs.abort(),textByCid[as]=hs,ns(hs)}).catch(hs=>{ds=!0,ps&&(clearTimeout(fs),ss(hs))}),fs=setTimeout(()=>{let hs=retrieveTextFileFromServer(as,rs),gs=hs.promise;cs=hs.controller,gs.then(ys=>{ds||us.abort(),textByCid[as]=ys,ns(ys)}).catch(ys=>{ps=!0,ds?ss(ys):fs=setTimeout(()=>{us.abort(),ss(ys)},5e3)})},100)})}function retrieveTextFileFromIPFS(as){let rs=new AbortController,ns=rs.signal;return{promise:async function(){try{let ls=await fetch(`https://${as}.ipfs.dweb.link/`,{signal:ns});if(ls.ok){let us=await ls.text();return await cidFromText(us)===as?us:Promise.reject(new Error("cid mismatch"))}else return Promise.reject(new Error(`cid not found: ${as}`))}catch{return Promise.reject(new Error(`cid not found: ${as}`))}}(),controller:rs}}function retrieveTextFileFromServer(as,rs){let ns=new AbortController,ss=ns.signal;return{promise:async function(){try{let us=await fetch(`/media/${as}.${rs}`,{signal:ss});if(us.ok){let cs=await us.text(),ds=await cidFromText(cs);return ds===as?cs:(console.warn(`cid mismatch, ${as}, ${ds}`),Promise.reject(new Error("cid mismatch")))}else return Promise.reject(new Error(`cid not found: ${as}`))}catch{return Promise.reject(new Error(`cid not found: ${as}`))}}(),controller:ns}}async function expandDoenetMLsToFullSerializedComponents({cids:as,doenetMLs:rs,componentInfoObjects:ns}){var us,cs;let ss=[],os={};for(let ds of rs){let ps=parseAndCompile(ds);ps=cleanIfHaveJustDocument(ps),substituteDeprecations(ps),temporarilyRenameSourceBackToTarget(ps),correctComponentTypeCapitalization(ps,ns.componentTypeLowerCaseMapping),copyTargetOrFromURIAttributeCreatesCopyComponent(ps,ns.isCompositeComponent),createAttributesFromProps(ps,ns),breakUpTargetIntoPropsAndIndices(ps,ns),applyMacros(ps,ns),removeBlankStringChildren(ps,ns),decodeXMLEntities(ps),applySugar({serializedComponents:ps,componentInfoObjects:ns}),ss.push(ps);let fs=findContentCopies({serializedComponents:ps});for(let hs in fs.cidComponents)os[hs]===void 0&&(os[hs]=[]),os[hs].push(...fs.cidComponents[hs])}let ls=Object.keys(os);if(ls.length>0){let{newDoenetMLs:ds,newCids:ps}=await cidsToDoenetMLs(ls);for(let[gs,ys]of ls.entries())if(ps[gs]&&ps[gs].substring(0,ys.length)!==ys)return Promise.reject(new Error(`Requested cid ${ys} but got back ${ps[gs]}!`));let fs=ls.length;for(let gs=0;gstypeof Ns!="string"||Ns.trim()),Ts=Cs.length===1&&typeof Cs[0]=="object",Ss=(us=vs.doenetAttributes)==null?void 0:us.fromCopyFromURI;if(Ss||Ts)if(Ss&&!Ts)console.warn("ignoring copyFromURI as it was not a single component");else{let Ns=Cs[0];Ns.attributes||(Ns.attributes={}),vs.doenetAttributes||(vs.doenetAttributes={}),vs.doenetAttributes.keptNewNamespaceOfLastChild=!!((cs=Ns.attributes.newNamespace)!=null&&cs.primitive),Ns.attributes.newNamespace={primitive:!0},vs.children=[Ns,...vs.children],vs.doenetAttributes.nameFirstChildIndependently=!0}else{let Ns={componentType:"externalContent",children:JSON.parse(JSON.stringify(bs)),attributes:{newNamespace:{primitive:!0}},doenetAttributes:{createUniqueName:!0}};vs.children=[Ns,...vs.children]}}}}return{cids:as,fullSerializedComponents:ss}}function cidsToDoenetMLs(as){let rs=[],ns=as;for(let ss of as)rs.push(retrieveTextFileForCid(ss,"doenet"));return Promise.all(rs).then(ss=>Promise.resolve({newDoenetMLs:ss,newCids:ns})).catch(ss=>{let os;return ns.length===1?os=`Could not retrieve cid ${ns[0]}`:os=`Could not retrieve cids ${ns.join(",")}`,os+=": "+ss.message,console.error(os),Promise.reject(new Error(os))})}function removeBlankStringChildren(as,rs){for(let ns of as){if(ns.children){let ss=rs.allComponentClasses[ns.componentType];ss&&!ss.includeBlankStringChildren&&(ns.children=ns.children.filter(os=>typeof os!="string"||os.trim()!=="")),removeBlankStringChildren(ns.children,rs)}for(let ss in ns.attributes){let os=ns.attributes[ss].component;os&&os.children&&removeBlankStringChildren([os],rs)}}}function findContentCopies({serializedComponents:as}){let rs={};for(let ns of as)if(ns.componentType==="copy"){if(ns.attributes&&ns.attributes.uri){let ss=ns.attributes.uri.primitive;if(ss&&ss.substring(0,7).toLowerCase()==="doenet:"){let os=ss.match(/[:&]cid=([^&]+)/i);if(os){let ls=os[1];rs[ls]===void 0&&(rs[ls]=[]),rs[ls].push(ns)}}}}else if(ns.children!==void 0){let ss=findContentCopies({serializedComponents:ns.children});for(let os in ss.cidComponents)rs[os]===void 0&&(rs[os]=[]),rs[os].push(...ss.cidComponents[os])}return{cidComponents:rs}}function addDocumentIfItsMissing(as){if(as.length!==1||as[0].componentType!=="document"){let rs=as.splice(0);as.push({componentType:"document",children:rs})}}function substituteDeprecations(as){let rs={tname:"target",triggerwithtnames:"triggerWith",updatewithtname:"updateWith",paginatortname:"paginator",randomizeorder:"shuffleOrder",copytarget:"copySource",triggerwithtargets:"triggerWith",triggerwhentargetsclicked:"triggerWhenObjectsClicked",fortarget:"forObject",targetattributestoignore:"sourceAttributesToIgnore",targetattributestoignorerecursively:"sourceAttributesToIgnoreRecursively",targetsareresponses:"sourcesAreResponses",updatewithtarget:"updateWith",targetsarefunctionsymbols:"sourcesAreFunctionSymbols",selectforvariantnames:"selectForVariants"},ns={copy:{target:"source",tname:"source"},collect:{target:"source",tname:"source"},summarystatistics:{target:"source"}};for(let ss of as)if(typeof ss=="object"){if(ss.props){let os=ss.componentType,ls=ns[os.toLowerCase()];ls||(ls={});let us=!0;for(;us;){us=!1;for(let cs in ss.props){let ds=cs.toLowerCase();if(ds in ls){let ps=ls[ds];console.warn(`Attribute ${cs} of component type ${os} is deprecated. Use ${ps} instead.`),ss.props[ps]=ss.props[cs],delete ss.props[cs],us=!0;break}else if(ds in rs){let ps=rs[ds];console.warn(`Attribute ${cs} is deprecated. Use ${ps} instead.`),ss.props[ps]=ss.props[cs],delete ss.props[cs],us=!0;break}}}}ss.children&&substituteDeprecations(ss.children)}}function temporarilyRenameSourceBackToTarget(as){let rs={copysource:"copyTarget"},ns={copy:{source:"target"},collect:{source:"target"}};for(let ss of as)if(typeof ss=="object"){if(ss.props){let os=ss.componentType,ls=ns[os.toLowerCase()];ls||(ls={});let us=!0;for(;us;){us=!1;for(let cs in ss.props){let ds=cs.toLowerCase();if(ds in ls){let ps=ls[ds];ss.props[ps]=ss.props[cs],delete ss.props[cs],us=!0;break}else if(ds in rs){let ps=rs[ds];ss.props[ps]=ss.props[cs],delete ss.props[cs],us=!0;break}}}}ss.children&&temporarilyRenameSourceBackToTarget(ss.children)}}function cleanIfHaveJustDocument(as){let rs=as.filter(ns=>typeof ns!="string"||ns.trim()!=="");return rs.length===1&&rs[0].componentType==="document"?rs:as}function correctComponentTypeCapitalization(as,rs){for(let ns of as){if(typeof ns!="object")continue;let ss=rs[ns.componentType.toLowerCase()];if(ss)ns.componentType=ss;else throw Error(`Invalid component type${indexRangeString(ns)}: ${ns.componentType}`);ns.children&&correctComponentTypeCapitalization(ns.children,rs)}}function copyTargetOrFromURIAttributeCreatesCopyComponent(as,rs){for(let ns of as){if(ns.props){let ss=!1,os=!1,ls=!1,us=ns.componentType,cs=rs({componentType:us,includeNonStandard:!1}),ds=rs({componentType:us,includeNonStandard:!0});for(let ps of Object.keys(ns.props)){let fs=ps.toLowerCase();if(fs==="copytarget"){if(ss)throw Error(`Cannot repeat attribute ${ps}. Found in component type ${us}${indexRangeString(ns)}`);if(os)throw Error(`Cannot combine copyTarget and copyFromURI attribiutes. For in component of type ${us}${indexRangeString(ns)}`);if(ls)throw Error(ds?`A component of type ${us} cannot have both assignNames and copyTarget. Found${indexRangeString(ns)}.`:`Invalid attribute assignNames for component of type ${us}${indexRangeString(ns)}`);if(ss=!0,ns.doenetAttributes||(ns.doenetAttributes={}),cs||(ns.props.createComponentOfType=us,ns.doenetAttributes.nameBecomesAssignNames=!0),ns.componentType="copy",ns.props.target=ns.props[ps],typeof ns.props.target!="string")throw Error(`Must specify value for copyTarget. Found in component of type ${us}${indexRangeString(ns)}`);delete ns.props[ps],ns.doenetAttributes.fromCopyTarget=!0,ns.doenetAttributes.createNameFromComponentType=us,ns.props.assignNamesSkip="1"}else if(fs==="copyfromuri"){if(os)throw Error(`Cannot repeat attribute ${ps}. Found in component type ${us}${indexRangeString(ns)}`);if(ss)throw Error(`Cannot combine copyTarget and copyFromURI attribiutes. For in component of type ${us}${indexRangeString(ns)}`);if(ls)throw Error(ds?`A component of type ${us} cannot have both assignNames and copyFromURI. Found${indexRangeString(ns)}.`:`Invalid attribute assignNames for component of type ${us}${indexRangeString(ns)}`);if(os=!0,ns.doenetAttributes||(ns.doenetAttributes={}),cs||(ns.props.createComponentOfType=us,ns.doenetAttributes.nameBecomesAssignNames=!0),ns.componentType="copy",ns.props.uri=ns.props[ps],typeof ns.props.uri!="string")throw Error(`Must specify value for copyFromURI. Found in component of type ${us}${indexRangeString(ns)}`);delete ns.props[ps],ns.doenetAttributes.fromCopyFromURI=!0,ns.doenetAttributes.createNameFromComponentType=us,ns.props.assignNamesSkip="1"}else if(fs==="assignnames"&&!cs){if(ss||os)throw Error(ds?`A component of type ${us} cannot have both assignNames and copyTarget. Found${indexRangeString(ns)}.`:`Invalid attribute assignNames for component of type ${us}${indexRangeString(ns)}`);ls=!0}}if(ss){for(let fs of Object.keys(ns.props))if(fs.toLowerCase()==="prop")throw Error(`Invalid attribute prop for component of type ${us}${indexRangeString(ns)}`);let ps=!1;for(let fs of Object.keys(ns.props))if(fs.toLowerCase()==="copyprop"){if(ps)throw Error(`Cannot repeat attribute ${fs}. Found in component type ${us}${indexRangeString(ns)}`);ns.props.prop=ns.props[fs],delete ns.props[fs],ps=!0}}}ns.children&©TargetOrFromURIAttributeCreatesCopyComponent(ns.children,rs)}}function breakUpTargetIntoPropsAndIndices(as,rs,ns=""){for(let[ss,os]of as.entries()){if(os.props&&["copy","updateValue","animateFromSequence"].includes(os.componentType)){let ls,us,cs,ds,ps,fs,hs;for(let gs of Object.keys(os.props))if(gs.toLowerCase()==="target"){if(ls)throw Error(`Cannot repeat attribute ${gs}. Found in component type ${os.componentType}${indexRangeString(os)}`);ls=gs,hs=os.props[gs];let bs=buildSourcePieces(hs,!0);bs.success&&bs.matchLength===hs.length&&(us=bs.sourceName,cs=bs.componentIndex,ds=bs.componentAttributes,ps=bs.propArray,fs=bs.subNames)}if(ls&&us)if(cs||ds||ps.length>0){if(os.attributes.prop)throw Error(`Cannot combine the prop attribute with an extended source attribute. Found in component type ${os.componentType}${indexRangeString(os)}`);if(os.attributes.propIndex)throw Error(`Cannot combine the propIndex attribute with an extended source attribute. Found in component type ${os.componentType}${indexRangeString(os)}`);if(os.attributes.componentIndex)throw Error(`Cannot combine the componentIndex attribute with an extended source attribute. Found in component type ${os.componentType}${indexRangeString(os)}`);let gs=createComponentFromExtendedSource({sourceName:us,componentIndex:cs,subNames:fs,componentAttributes:ds,propArray:ps,componentInfoObjects:rs});if(gs.success){let ys=gs.newComponent;if(os.componentType==="copy")delete os.props[ls],Object.assign(os.attributes,ys.attributes),os.doenetAttributes||(os.doenetAttributes={}),Object.assign(os.doenetAttributes,ys.doenetAttributes),os.doenetAttributes.createNameFromComponentType||(os.doenetAttributes.createNameFromComponentType=os.componentType),os.componentType=ys.componentType,ps.length===0&&!(os.attributes.prop||os.attributes.propIndex)&&(os.doenetAttributes.isPlainCopy=!0),ys.children&&(os.children=ys.children);else if(ys.componentType==="copy")delete os.props[ls],Object.assign(os.attributes,ys.attributes),os.doenetAttributes||(os.doenetAttributes={}),Object.assign(os.doenetAttributes,ys.doenetAttributes);else{let bs="fromExtendedSource"+ns+"|"+ss,vs=createUniqueName("extract",bs);ys.doenetAttributes.prescribedName=vs,ys.doenetAttributes.createdFromMacro=!0;let xs={componentType:"setup",children:[ys],doenetAttributes:{createdFromMacro:!0}};as.push(xs),delete os.props[ls],os.doenetAttributes||(os.doenetAttributes={}),os.doenetAttributes.target=vs,os.doenetAttributes.allowDoubleUnderscoreTarget=!0}}else os.componentType==="copy"?console.warn(`invalid copy source: ${hs}`):console.warn(`invalid target: ${hs}`)}else os.componentType==="copy"&&!(os.attributes.prop||os.attributes.propIndex)&&(os.doenetAttributes||(os.doenetAttributes={}),os.doenetAttributes.isPlainCopy=!0)}os.children&&breakUpTargetIntoPropsAndIndices(os.children,rs,ns+"|"+ss)}}function createAttributesFromProps(as,rs){for(let ns of as){if(typeof ns!="object")continue;let ss=rs.allComponentClasses[ns.componentType],os=ss.createAttributesObject(),ls={};for(let ds in os)ls[ds.toLowerCase()]=ds;let us={},cs=Object.assign({},ns.props);if(ns.props)for(let ds in ns.props){let ps=ls[ds.toLowerCase()],fs=os[ps];if(fs){if(ps in us)throw Error(`Cannot repeat attribute ${ps}. Found in component type ${ns.componentType}${indexRangeString(ns)}`);us[ps]=componentFromAttribute({attrObj:fs,value:ns.props[ds],originalComponentProps:cs,componentInfoObjects:rs}),delete ns.props[ds]}else if(!["name","assignnames","target"].includes(ds.toLowerCase()))if(ss.acceptAnyAttribute)us[ds]=componentFromAttribute({value:ns.props[ds],originalComponentProps:cs,componentInfoObjects:rs}),delete ns.props[ds];else throw Error(`Invalid attribute ${ds} for component of type ${ns.componentType}${indexRangeString(ns)}`)}for(let ds in os){let ps=os[ds];ps.createPrimitiveOfType&&"defaultPrimitiveValue"in ps&&!(ds in us)&&(us[ds]=componentFromAttribute({attrObj:ps,originalComponentProps:cs,value:ps.defaultPrimitiveValue.toString(),componentInfoObjects:rs}))}ns.attributes=us,ns.children!==void 0&&createAttributesFromProps(ns.children,rs)}}function componentFromAttribute({attrObj:as,value:rs,originalComponentProps:ns,componentInfoObjects:ss}){if(typeof rs!="object"?rs={rawString:rs.toString()}:rs===null&&(rs={rawString:""}),as&&as.createComponentOfType){let os,ls=rs.rawString.trim().toLowerCase();if(ls==="true"&&as.valueForTrue!==void 0)os={componentType:as.createComponentOfType,state:{value:as.valueForTrue}};else if(ls==="false"&&as.valueForFalse!==void 0)os={componentType:as.createComponentOfType,state:{value:as.valueForFalse}};else if(ss.isInheritedComponentType({inheritedComponentType:as.createComponentOfType,baseComponentType:"boolean"})&&["true","false"].includes(ls))os={componentType:as.createComponentOfType,state:{value:ls==="true"}};else{let cs=rs.childrenForComponent;cs?cs=JSON.parse(JSON.stringify(cs)):cs=[rs.rawString],os={componentType:as.createComponentOfType,children:cs},removeBlankStringChildren([os],ss)}if(as.attributesForCreatedComponent||as.copyComponentAttributesForCreatedComponent){if(as.attributesForCreatedComponent?os.props=as.attributesForCreatedComponent:os.props={},as.copyComponentAttributesForCreatedComponent)for(let cs of as.copyComponentAttributesForCreatedComponent)ns[cs]&&(os.props[cs]=JSON.parse(JSON.stringify(ns[cs])));createAttributesFromProps([os],ss)}let us={component:os};return as.ignoreFixed&&(us.ignoreFixed=!0),us}else if(as&&as.createPrimitiveOfType){let os;return as.createPrimitiveOfType==="boolean"?os=rs.rawString.trim().toLowerCase()==="true":as.createPrimitiveOfType==="number"?os=Number(rs.rawString):as.createPrimitiveOfType==="integer"?os=Math.round(Number(rs.rawString)):as.createPrimitiveOfType==="stringArray"?os=rs.rawString.trim().split(/\s+/):as.createPrimitiveOfType==="numberArray"?os=rs.rawString.trim().split(/\s+/).map(Number):os=rs.rawString,as.validationFunction&&(os=as.validationFunction(os)),{primitive:os}}else return as&&as.createTargetComponentNames?{targetComponentNames:rs.rawString.trim().split(/\s+/).map(ls=>(ls[0]==="$"&&ls[1]!=="$"&&(ls=ls.slice(1),ls[0]==="("&&ls[ls.length-1]===")"&&(ls=ls.slice(1,ls.length-1))),{relativeName:ls}))}:(rs.childrenForComponent||(rs.childrenForComponent=[rs.rawString]),rs)}function findPreSugarIndsAndMarkFromSugar(as){let rs=[];for(let ns of as)if(typeof ns=="object"){if(ns.preSugarInd!==void 0)rs.push(ns.preSugarInd);else if(ns.doenetAttributes||(ns.doenetAttributes={}),ns.doenetAttributes.createdFromSugar=!0,ns.children){let ss=findPreSugarIndsAndMarkFromSugar(ns.children);rs.push(...ss)}}return rs}function applyMacros(as,rs){for(let ns of as)if(ns.children&&applyMacros(ns.children,rs),ns.attributes)for(let ss in ns.attributes){let os=ns.attributes[ss];os.component?applyMacros([os.component],rs):os.childrenForComponent&&applyMacros(os.childrenForComponent,rs)}substituteMacros(as,rs)}function substituteMacros(as,rs){for(let ns=0;ns0&&as[ns-1].range){let Ts=as[ns-1].range;Ts.closeEnd?Cs+=Ts.closeEnd:Ts.selfCloseEnd&&(Cs+=Ts.selfCloseBegin)}throw Error(`${hs.message}. At indices ${Cs}-${Cs+ds}. Found: ${xs}`)}markCreatedFromMacro([gs]),us.propArray.length===0&&(gs.doenetAttributes.isPlainMacro=!0),fs=[gs];let ys=1,bs=ls.substring(cs+ds);if(ps===2){let xs=ls.slice(cs+ds).match(/^\s*\(/);if(!xs){os=cs+2;continue}let Cs=ds+xs[0].length,Ts=[],Ss=!1;ls.length>cs+Cs&&(Ss=!0,Ts.push(ls.substring(cs+Cs))),Ts.push(...as.slice(ns+1));let Ns=createEvaluateIfFindMatchedClosingParens({componentsFromMacro:fs,remainingComponents:Ts,includeFirstInRemaining:Ss,componentInfoObjects:rs});if(!Ns.success){os=cs+2;continue}fs=Ns.componentsFromMacro,ys=Ns.lastComponentIndMatched+1,Ss||ys++,bs=""}let vs=[];cs>0&&vs.push(ls.substring(0,cs)),vs.push(...fs),bs.length>0&&vs.push(bs),as.splice(ns,ys,...vs),cs>0&&ns++;break}}}}function createComponentFromExtendedSource({sourceName:as,componentIndex:rs,componentAttributes:ns,propArray:ss,subNames:os,componentInfoObjects:ls}){let us={componentType:"copy",doenetAttributes:{target:as},attributes:{}};if(rs){let ds=[rs];applyMacros(ds,ls),us.attributes.componentIndex={component:{componentType:"integer",children:ds}}}if((os==null?void 0:os.length)>0){let ds=[],ps=[];for(let fs of os)ds.push(fs.subName),fs.subNameComponentIndex!==void 0&&(ps.length0){let fs=[ps.join(" ")];applyMacros(fs,ls),us.attributes.sourceSubnamesComponentIndex={component:{componentType:"numberList",children:fs}}}}let cs=!1;if(ns){cs=!0;let ds=createAttributesFromString(ns,ls);if(!ds.success)return ds;Object.assign(us.attributes,ds.newAttributes),ds.assignNames&&(us.props={assignNames:ds.assignNames})}for(let ds of ss){if(cs&&(us.doenetAttributes.createdFromMacro=!0,us={componentType:"extract",attributes:{},doenetAttributes:{},children:[us]}),us.attributes.prop={primitive:ds.prop},ds.propIndex){let ps=[ds.propIndex.join(" ")];applyMacros(ps,ls),us.attributes.propIndex={component:{componentType:"numberList",children:ps}}}if(ds.attributes){let ps=createAttributesFromString(ds.attributes,ls);if(!ps.success)return ps;Object.assign(us.attributes,ps.newAttributes),ps.assignNames&&(us.props={assignNames:ps.assignNames})}cs=!0}return{success:!0,newComponent:us}}function createAttributesFromString(as,rs){let ns=``,ss;try{ss=parseAndCompile(ns)}catch{return{success:!1,message:"Error in macro"}}createAttributesFromProps(ss,rs),markCreatedFromMacro(ss),applyMacros(ss,rs);let os=ss[0].attributes;if(os.prop||os.propIndex||os.componentIndex)return{success:!1,message:"Error in macro: macro cannot directly add attributes prop, propIndex, or componentIndex"};let ls;if(ss[0].props){for(let us in ss[0].props)if(us.toLowerCase()==="assignnames"){if(ls)return{success:!1,message:"Error in macro: cannot repeat assignNames"};ls=ss[0].props[us]}}return{success:!0,newAttributes:os,assignNames:ls}}function findFirstFullMacroInString(as){let rs=0,ns;for(;;){let ss=as.substring(rs).match(/(\$+)(.?)/);if(!ss)return{success:!1};if(ns=ss[1].length,rs+=ss.index+ns,ns<=2){let os=!1,ls=as.substring(rs),us=0,cs=findWordOrDelimitedGroup(ls,os);cs.startDelim==="("&&(os=!0,ls=cs.group,us=cs.group.length);let ds=buildSourcePieces(ls,os);if(ds.success){if(os){if(ds.matchLength!==us)return{success:!1};ds.matchLength+=2}return ds.nDollarSigns=ns,ds.firstIndMatched=rs-ns,ds.matchLength+=ns,ds}}}}function buildSourcePieces(as,rs){let ns=findWordOrDelimitedGroup(as,rs),ss=0;if(ns.withPeriod||!ns.word)return{success:!1};let os={sourceName:(ns.withSlash?"/":"")+ns.word};ss+=ns.matchLength,as=as.substring(ns.matchLength),ns=findWordOrDelimitedGroup(as,rs),ns.startDelim==="["&&(os.componentIndex=ns.group,ss+=ns.matchLength,as=as.substring(ns.matchLength),ns=findWordOrDelimitedGroup(as,rs));let ls=[];for(;ns.withSlash;){let cs={subName:ns.word};ss+=ns.matchLength,as=as.substring(ns.matchLength),ns=findWordOrDelimitedGroup(as,rs),ns.startDelim==="["&&(cs.subNameComponentIndex=ns.group,ss+=ns.matchLength,as=as.substring(ns.matchLength),ns=findWordOrDelimitedGroup(as,rs)),ls.push(cs)}os.subNames=ls,ns.startDelim==="{"&&(os.componentAttributes=ns.group,ss+=ns.matchLength,as=as.substring(ns.matchLength),ns=findWordOrDelimitedGroup(as,rs));let us=[];for(;ns.withPeriod;){let cs={prop:ns.word};ss+=ns.matchLength,as=as.substring(ns.matchLength),ns=findWordOrDelimitedGroup(as,rs);let ds=[];for(;ns.startDelim==="[";)ds.push(ns.group),ss+=ns.matchLength,as=as.substring(ns.matchLength),ns=findWordOrDelimitedGroup(as,rs);ds.length>0&&(cs.propIndex=ds),ns.startDelim==="{"&&(cs.attributes=ns.group,ss+=ns.matchLength,as=as.substring(ns.matchLength),ns=findWordOrDelimitedGroup(as,rs)),us.push(cs)}return os.propArray=us,os.matchLength=ss,os.success=!0,os}function findWordOrDelimitedGroup(as,rs=!1){let ns=!1,ss=!1;as[0]==="."&&as[1]!=="."&&(ns=!0,as=as.substring(1));let os;rs?ns?os=/^[\w-]+/:(as[0]==="/"&&as[1].match(/\w/)&&(ss=!0,as=as.substring(1)),os=/^([\w\/-]|\.\.\/)+/):os=/^[a-zA-Z_]\w*/;let ls=as.match(os);if(ls)return{success:!0,withPeriod:ns,withSlash:ss,word:ls[0],matchLength:ls[0].length+(ns?1:0)+(ss?1:0)};if(ns||ss)return{success:!1};let us=[],cs={"(":")","{":"}","[":"]"},ds=Object.values(cs),ps=as[0],fs=cs[ps];if(!fs)return{success:!1};us.push(fs);for(let hs=1;hs0?rs[ls]=us.substring(0,os.charInd):rs=rs.slice(0,ls);let ds=breakEmbeddedStringByCommas({childrenList:rs});ds.pieces.forEach(gs=>applyMacros(gs,ss));let ps=ds.pieces.map(gs=>gs.length===1&&typeof gs[0]!="string"?gs[0]:{componentType:"math",doenetAttributes:{createdFromMacro:!0},children:gs}),hs=[{componentType:"evaluate",doenetAttributes:{createdFromMacro:!0},attributes:{function:{component:{componentType:"function",doenetAttributes:{createdFromMacro:!0},children:as}},input:{component:{componentType:"mathList",doenetAttributes:{createdFromMacro:!0},children:ps}}}}];return cs.length>0&&hs.push(cs),{success:!0,componentsFromMacro:hs,lastComponentIndMatched:ls}}function findFirstUnmatchedClosingParens(as){let rs=0;for(let[ns,ss]of as.entries())if(typeof ss=="string"){let os=ss;for(let ls=0;ls").replace(/</g,"<").replace(/$/g,"$").replace(/&/g,"&")}for(let[ns,ss]of as.entries())if(typeof ss=="string")as[ns]=rs(ss);else if(ss.children&&decodeXMLEntities(ss.children),ss.attributes)for(let os in ss.attributes){let ls=ss.attributes[os];ls.component?decodeXMLEntities([ls.component]):ls.primitive?typeof ls.primitive=="string"&&(ls.primitive=rs(ls.primitive)):(ls.childrenForComponent&&decodeXMLEntities(ls.childrenForComponent),ls.rawString&&(ls.rawString=rs(ls.rawString)))}}function applySugar({serializedComponents:as,parentParametersFromSugar:rs={},parentAttributes:ns={},componentInfoObjects:ss,parentUniqueId:os="",isAttributeComponent:ls=!1}){for(let[us,cs]of as.entries()){if(typeof cs!="object")continue;let ds=cs.componentType,ps=ss.allComponentClasses[ds];if(!ps)throw Error(`Unrecognized component type ${ds}`);let fs=os+"|"+ds+us,hs={};for(let gs in cs.attributes){let ys=cs.attributes[gs];ys.primitive!==void 0&&(hs[gs]=ys.primitive)}if(cs.children){let gs={};if(!cs.skipSugar)for(let[ys,bs]of ps.returnSugarInstructions().entries()){let vs=cs.children.map(Ns=>typeof Ns=="string"?"s":"n").join("");if(bs.childrenRegex){let Ns=vs.match(bs.childrenRegex);if(!Ns||Ns[0].length!==cs.children.length)continue}let xs=deepClone(cs.children),Cs=0;for(let Ns of xs)typeof Ns!="string"&&(Ns.preSugarInd=Cs,Cs++);let Ts=!1;cs.doenetAttributes&&cs.doenetAttributes.createdFromMacro&&(Ts=!0);let Ss=bs.replacementFunction({matchedChildren:xs,parentParametersFromSugar:rs,parentAttributes:ns,componentAttributes:hs,uniqueId:fs+"|sugar"+ys,componentInfoObjects:ss,isAttributeComponent:ls,createdFromMacro:Ts});if(Ss.success){let Ns=Ss.newChildren,As=Ss.newAttributes,ws=[],Es=[];if(Ns&&(ws=findPreSugarIndsAndMarkFromSugar(Ns)),As)for(let $s in As){let Rs=As[$s].component;Rs&&Es.push(...findPreSugarIndsAndMarkFromSugar(Rs.children))}let _s=[...ws,...Es];if(_s.length!==Cs||!_s.sort(($s,Rs)=>$s-Rs).every(($s,Rs)=>$s===Rs))throw Error(`Invalid sugar for ${ds} as didn't return set of original components`);if(ws.length>0&&![...ws].sort((Rs,Is)=>Rs-Is).every((Rs,Is)=>Rs===ws[Is]))throw Error(`Invalid sugar for ${ds} as didn't return original components in order`);Ss.parametersForChildrenSugar&&Object.assign(gs,Ss.parametersForChildrenSugar),Ns?cs.children=Ns:cs.children=[],As&&(cs.attributes||(cs.attributes={}),Object.assign(cs.attributes,As))}}ps.removeBlankStringChildrenPostSugar&&(cs.children=cs.children.filter(ys=>typeof ys!="string"||/\S/.test(ys))),applySugar({serializedComponents:cs.children,parentParametersFromSugar:gs,parentAttributes:hs,componentInfoObjects:ss,parentUniqueId:fs})}if(cs.attributes)for(let gs in cs.attributes){let ys=cs.attributes[gs];ys.component&&applySugar({serializedComponents:[ys.component],parentAttributes:hs,componentInfoObjects:ss,parentUniqueId:fs,isAttributeComponent:!0})}}}function breakStringInPiecesBySpacesOrParens(as){if(typeof as!="string")return{success:!1};let rs=0,ns=[];as=as.trim();let ss=0;for(let ls=0;ls0&&ns.push(cs),ss=ls}rs++}else if(us===")"){if(rs===0)return{success:!1};if(rs===1){let cs=as.substring(ss+1,ls).trim();if(cs.length>0){let ds=breakStringInPiecesBySpacesOrParens(cs);ds.success===!0?ns.push(ds.pieces):ns.push(cs)}ss=ls+1}rs--}else if(rs===0&&us.match(/\s/)){let cs=as.substring(ss,ls).trim();cs.length>0&&ns.push(cs),ss=ls}}if(rs!==0)return{success:!1};let os=as.substring(ss,as.length).trim();return os.length>0&&ns.push(os),{success:!0,pieces:ns}}function countRegularComponentTypesInNamespace(as,rs={}){var ns,ss;for(let os of as)if(typeof os=="object"){let ls=os.componentType,us=rs[ls];us===void 0&&(us=0);let cs=os.doenetAttributes;cs!=null&&cs.isAttributeChild||cs!=null&&cs.createdFromSugar||cs!=null&&cs.createdFromMacro||(rs[ls]=++us),os.children&&!((ss=(ns=os.attributes)==null?void 0:ns.newNamespace)!=null&&ss.primitive)&&(rs=countRegularComponentTypesInNamespace(os.children,rs))}return rs}function renameAutonameBasedOnNewCounts(as,rs={}){var ss,os;let ns={...rs};for(let ls of as)if(typeof ls=="object"){let us=ls.componentType,cs=ns[us];cs===void 0&&(cs=0);let ds=ls.doenetAttributes;if(!(ds!=null&&ds.isAttributeChild||ds!=null&&ds.createdFromSugar||ds!=null&&ds.createdFromMacro)&&(ns[us]=++cs,ls.componentName)){let ps=ls.componentName.lastIndexOf("/"),fs=ls.componentName.substring(ps+1),hs="_"+us.toLowerCase();fs.substring(0,hs.length)===hs&&(ls.componentName=ls.componentName.substring(0,ps+1)+hs+cs)}ls.children&&!((os=(ss=ls.attributes)==null?void 0:ss.newNamespace)!=null&&os.primitive)&&(ns=renameAutonameBasedOnNewCounts(ls.children,ns))}return ns}function createComponentNames({serializedComponents:as,namespaceStack:rs=[],componentInfoObjects:ns,parentDoenetAttributes:ss={},parentName:os,useOriginalNames:ls=!1,attributesByTargetComponentName:us,indOffset:cs=0,createNameContext:ds="",initWithoutShadowingComposite:ps=!1}){var gs,ys,bs;rs.length===0&&rs.push({namespace:"",componentCounts:{},namesUsed:{}});let fs=rs.length-1,hs=rs[fs];for(let[vs,xs]of as.entries()){if(typeof xs!="object")continue;let Cs=xs.componentType,Ts=ns.allComponentClasses[Cs],Ss=xs.doenetAttributes;Ss===void 0&&(Ss=xs.doenetAttributes={});let Ns=xs.attributes;Ns||(Ns=xs.attributes={}),Ss.createNameFromComponentType&&(Cs=Ss.createNameFromComponentType);let As=Ss.prescribedName,ws=Ss.assignNames,Es=Ss.target,_s=Ss.isAttributeChild||Ss.createdFromSugar||Ss.createdFromMacro||Ss.createUniqueName,$s;((gs=Ns.newNamespace)!=null&&gs.primitive||ls&&xs.originalAttributes&&xs.originalAttributes.newNamespace)&&($s=!0);let Rs=As!==void 0,Is=xs.props;if(Is===void 0)Is=xs.props={};else for(let Vs in Is){let ks=Vs.toLowerCase();if(ks==="name")if(As===void 0)As=Is[Vs],delete Is[Vs];else throw Error(`Cannot define name twice. Found in component of type ${Cs}${indexRangeString(xs)}`);else if(ks==="assignnames")if(ws===void 0){let Ps=breakStringInPiecesBySpacesOrParens(Is[Vs]);if(Ps.success)ws=Ps.pieces;else throw Error(`Invalid format for assignnames. Found in component of type ${Cs}${indexRangeString(xs)}`);delete Is[Vs]}else throw Error(`Cannot define assignNames twice for a component. Found in component of type ${Cs}${indexRangeString(xs)}`);else if(ks==="target")if(Es===void 0){if(typeof Is[Vs]!="string")throw Error(`Must specify value for target. Found in component of type ${Cs}${indexRangeString(xs)}`);Es=Is[Vs].trim(),delete Is[Vs]}else throw Error(`Cannot define target twice for a component. Found in component of type ${Cs}${indexRangeString(xs)}`)}if(As){if(!Rs&&!Ss.createdFromSugar){if(!/[a-zA-Z]/.test(As.substring(0,1)))throw Error(`Invalid component name: ${As}. Component name must begin with a letter. Found in component of type ${Cs}${indexRangeString(xs)}`);if(!/^[a-zA-Z0-9_\-]+$/.test(As))throw Error(`Invalid component name: ${As}. Component name can contain only letters, numbers, hyphens, and underscores. Found in component of type ${Cs}${indexRangeString(xs)}`)}Ss.prescribedName=As}else if(_s){let Vs=os+"|createUniqueName|";xs.downstreamDependencies?Vs+=JSON.stringify(xs.downstreamDependencies):Vs+=vs+"|"+cs+"|"+ds,As=createUniqueName(Cs.toLowerCase(),Vs)}if(!ws&&ls&&xs.originalDoenetAttributes&&xs.originalDoenetAttributes.assignNames&&(ws=xs.originalDoenetAttributes.assignNames),ws){if(!Ts.assignNamesToReplacements)throw Error(`Cannot assign names for component type ${Cs}${indexRangeString(xs)}`);if(Ss.assignNames=ws,!Ss.createUniqueAssignNames){let ks=flattenDeep(ws);if(!Ss.fromCopyTarget&&!Ss.fromCopyFromURI)for(let Ps of ks){if(!/[a-zA-Z]/.test(Ps.substring(0,1)))throw Error(`All assigned names must begin with a letter. Found in component of type ${Cs}${indexRangeString(xs)}`);if(!/^[a-zA-Z0-9_\-]+$/.test(Ps))throw Error(`Assigned names can contain only letters, numbers, hyphens, and underscores. Found in component of type ${Cs}${indexRangeString(xs)}`)}if(ks.length!==new Set(ks).size)throw Error(`Duplicate assigned names. Found in component of type ${Cs}${indexRangeString(xs)}`)}}$s&&(Ns.newNamespace={primitive:$s});let Os=hs.componentCounts[Cs];Os===void 0&&(Os=0),Ss.isAttributeChild||Ss.createdFromSugar||Ss.createdFromMacro||(hs.componentCounts[Cs]=++Os);let Ds="";for(let Vs=0;Vs<=fs;Vs++)Ds+=rs[Vs].namespace+"/";if(!As){if(ls&&xs.originalName){let Vs=xs.originalName.lastIndexOf("/");As=xs.originalName.substring(Vs+1)}As||(As="_"+Cs.toLowerCase()+Os)}if(Ss.nameBecomesAssignNames){$s&&(Ns.assignNewNamespaces={primitive:!0},delete Ns.newNamespace,$s=!1),ws=Ss.assignNames=[As],delete Ss.nameBecomesAssignNames;let Vs=os+"|createUniqueName|";Ss.createUniqueName=!0,delete Ss.prescribedName,xs.downstreamDependencies?Vs+=JSON.stringify(xs.downstreamDependencies):Vs+=vs+"|"+cs+"|"+ds,As=createUniqueName("copy",Vs)}if(Ds+=As,xs.componentName=Ds,As){if(As in hs.namesUsed)throw Error(`Duplicate component name ${Ds}. Found in component of type ${Cs}${indexRangeString(xs)}`);hs.namesUsed[As]=!0}if(!$s&&ws)for(let Vs of flattenDeep(ws)){if(Vs in hs.namesUsed)throw Error(`Duplicate component name ${Vs} (from assignNames of ${Ds}). Found in component of type ${Cs}${indexRangeString(xs)}`);hs.namesUsed[Vs]=!0}if(xs.doenetAttributes.createUniqueAssignNames&&xs.originalName){let Vs=xs.doenetAttributes.assignNames;Vs||(Vs=xs.doenetAttributes.originalAssignNames);let ks=Ds+"|createUniqueName|assignNames|",Ps="",Bs;if($s)Ps=Ds+"/",Bs=xs.originalName+"/";else{for(let Us=0;Us<=fs;Us++)Ps+=rs[Us].namespace+"/";let Ws=xs.originalName.lastIndexOf("/");Bs=xs.originalName.slice(0,Ws+1)}let Ms=createNewAssignNamesAndrenameMatchingTargetNames({originalAssignNames:Vs,longNameIdBase:ks,namespace:Ps,oldNamespace:Bs,attributesByTargetComponentName:us});ws=xs.doenetAttributes.assignNames=Ms}if(renameMatchingTargetNames(xs,us),Es){if(!Ts.acceptTarget)throw Error(`Component type ${Cs} does not accept a target attribute. Found in component ${Ds}${indexRangeString(xs)}`);if(Es.includes("|"))throw Error(`target cannot include |. Found in component of type ${Cs}${indexRangeString(xs)}`);Ss.target=Es,Ss.targetComponentName=convertComponentTarget({relativeName:Es,oldAbsoluteName:Ss.targetComponentName,namespaceStack:rs,acceptDoubleUnderscore:Ss.createdFromSugar||Ss.allowDoubleUnderscoreTarget})}for(let Vs in Ns){let ks=Ns[Vs];if(ks.targetComponentNames)for(let Ps of ks.targetComponentNames)Ps.absoluteName=convertComponentTarget({relativeName:Ps.relativeName,oldAbsoluteName:Ps.absoluteName,namespaceStack:rs,acceptDoubleUnderscore:Ss.createdFromSugar||Ss.allowDoubleUnderscoreTarget})}if(xs.children)if($s||(ys=Ns.assignNewNamespaces)!=null&&ys.primitive){let Vs={};ws&&flattenDeep(ws).forEach(Bs=>Vs[Bs]=!0);let ks=xs.children;if(Ss.nameFirstChildIndependently&&xs.children.length>0){ks=ks.slice(1);let Bs={namespace:As,componentCounts:{},namesUsed:{}};rs.push(Bs),createComponentNames({serializedComponents:[xs.children[0]],namespaceStack:rs,componentInfoObjects:ns,parentDoenetAttributes:Ss,parentName:Ds,useOriginalNames:ls,attributesByTargetComponentName:us}),rs.pop()}let Ps={namespace:As,componentCounts:{},namesUsed:Vs};if(Ss.haveNewNamespaceOnlyFromShadow){let Bs=!0,Ms=[...ks];for(;Ms.length>0;){let Ws=[];for(let Us of Ms){if(!!((bs=Us.doenetAttributes)!=null&&bs.ignoreParentNewNamespace)===Bs)break;Ws.push(Us)}Ms.splice(0,Ws.length),Bs?rs.push(Ps):ps&&Ws.forEach(Us=>Us.doenetAttributes.createUniqueName=!0),createComponentNames({serializedComponents:Ws,namespaceStack:rs,componentInfoObjects:ns,parentDoenetAttributes:Ss,parentName:Ds,useOriginalNames:ls,attributesByTargetComponentName:us}),Bs&&rs.pop(),Bs=!Bs}}else rs.push(Ps),createComponentNames({serializedComponents:ks,namespaceStack:rs,componentInfoObjects:ns,parentDoenetAttributes:Ss,parentName:Ds,useOriginalNames:ls,attributesByTargetComponentName:us}),rs.pop()}else{let Vs=xs.children;if(Ss.nameFirstChildIndependently&&Vs.length>0){Vs=Vs.slice(1);let ks=hs.namesUsed,Ps=hs.componentCounts;hs.namesUsed={},hs.componentCounts={},createComponentNames({serializedComponents:[xs.children[0]],namespaceStack:rs,componentInfoObjects:ns,parentDoenetAttributes:Ss,parentName:Ds,useOriginalNames:ls,attributesByTargetComponentName:us}),hs.namesUsed=ks,hs.componentCounts=Ps}createComponentNames({serializedComponents:Vs,namespaceStack:rs,componentInfoObjects:ns,parentDoenetAttributes:Ss,parentName:Ds,useOriginalNames:ls,attributesByTargetComponentName:us})}if(xs.attributes)for(let Vs in xs.attributes){let ks=xs.attributes[Vs];if(ks.component){let Ps=ks.component;Ps.doenetAttributes||(Ps.doenetAttributes={}),Ps.doenetAttributes.isAttributeChild=!0,ks.ignoreFixed&&(Ps.doenetAttributes.ignoreParentFixed=!0),createComponentNames({serializedComponents:[Ps],namespaceStack:rs,componentInfoObjects:ns,parentDoenetAttributes:Ss,parentName:Ds,useOriginalNames:ls,attributesByTargetComponentName:us,createNameContext:Vs})}else ks.childrenForComponent&&createComponentNames({serializedComponents:ks.childrenForComponent,namespaceStack:rs,componentInfoObjects:ns,parentDoenetAttributes:Ss,parentName:Ds,useOriginalNames:ls,attributesByTargetComponentName:us,createNameContext:Vs})}}return as}function createNewAssignNamesAndrenameMatchingTargetNames({originalAssignNames:as,longNameIdBase:rs,namespace:ns,oldNamespace:ss,attributesByTargetComponentName:os}){let ls=[];for(let[us,cs]of as.entries())if(Array.isArray(cs)){let ds=createNewAssignNamesAndrenameMatchingTargetNames({originalAssignNames:cs,longNameIdBase:rs+us+"_",namespace:ns,oldNamespace:ss,attributesByTargetComponentName:os});ls.push(ds)}else{let ds=rs+us,ps=createUniqueName("fromAssignNames",ds);ls.push(ps);let fs={componentName:ns+ps,originalName:ss+cs};renameMatchingTargetNames(fs,os,!0)}return ls}function convertComponentTarget({relativeName:as,oldAbsoluteName:rs,namespaceStack:ns,acceptDoubleUnderscore:ss}){if(!rs&&/__/.test(as)&&!ss)throw Error("Invalid reference target: "+as);let os;if(as.substring(0,1)==="/")os=as;else{let ls=ns.length-1;for(;as.substring(0,3)==="../";)as=as.substring(3),ls--;ls<0&&(ls=0),os="";for(let us=0;us<=ls;us++)os+=ns[us].namespace+"/";os+=as}return os}function serializedComponentsReplacer(as,rs){return rs!==rs?{objectType:"special-numeric",stringValue:"NaN"}:rs===1/0?{objectType:"special-numeric",stringValue:"Infinity"}:rs===-1/0?{objectType:"special-numeric",stringValue:"-Infinity"}:rs}let nanInfinityReviver=function(as,rs){if(rs&&rs.objectType==="special-numeric"){if(rs.stringValue==="NaN")return NaN;if(rs.stringValue==="Infinity")return 1/0;if(rs.stringValue==="-Infinity")return-1/0}return rs};function serializedComponentsReviver(as,rs){return Context.reviver(as,theModule.Subset.reviver(as,nanInfinityReviver(as,rs)))}function processAssignNames({assignNames:as=[],assignNewNamespaces:rs=!1,serializedComponents:ns,parentName:ss,parentCreatesNewNamespace:os,componentInfoObjects:ls,indOffset:us=0,originalNamesAreConsistent:cs=!1,shadowingComposite:ds=!1}){var bs,vs;let ps=ns.length;moveComponentNamesToOriginalNames(ns);let fs={},hs=null;if(cs){if(ps>0){let xs=ns.filter(Cs=>typeof Cs=="object")[0];if(xs&&xs.originalName){let Cs=xs.originalName.lastIndexOf("/");hs=xs.originalName.substring(0,Cs)}}if(hs!==null)for(let xs of ns)setTargetsOutsideNamespaceToAbsoluteAndRecordAllTargetComponentNames({namespace:hs,components:[xs],attributesByTargetComponentName:fs})}else for(let xs=0;xs0&&Cs.originalName){let Ts=Cs.originalName.lastIndexOf("/");hs=Cs.originalName.substring(0,Ts)}hs!==null&&setTargetsOutsideNamespaceToAbsoluteAndRecordAllTargetComponentNames({namespace:hs,components:[Cs],attributesByTargetComponentName:fs})}}let gs=[],ys=0;for(let xs=0;xs0&&Ts.originalName)){let Ns=Ts.originalName.lastIndexOf("/");hs=Ts.originalName.substring(0,Ns)}if(Ss){if(ls.allComponentClasses[Ts.componentType].assignNamesSkipOver)Ss=[Ss];else if((bs=Ts.attributes)!=null&&bs.assignNamesSkip){let Ns=Ts.attributes.assignNamesSkip.primitive;if(Ns>0)for(let As=0;As({namespace:gs,componentCounts:{},namesUsed:{}}));as[0]!=="/"&&ps.splice(0,0,{componentCounts:{},namesUsed:{},namespace:""}),rs.doenetAttributes||(rs.doenetAttributes={}),rs.attributes||(rs.attributes={});let fs;(hs=rs.attributes.newNamespace)!=null&&hs.primitive||us?fs=!0:(fs=!1,rs.children&&markToCreateAllUniqueNames(rs.children));for(let gs in rs.attributes){let ys=rs.attributes[gs];ys.component?markToCreateAllUniqueNames([ys.component]):ys.childrenForComponent&&markToCreateAllUniqueNames(ys.childrenForComponent)}createComponentNames({serializedComponents:[rs],namespaceStack:ps,componentInfoObjects:os,parentName:as,useOriginalNames:fs,attributesByTargetComponentName:ls,indOffset:ns,initWithoutShadowingComposite:!cs})}function setTargetsOutsideNamespaceToAbsoluteAndRecordAllTargetComponentNames({namespace:as,components:rs,attributesByTargetComponentName:ns}){let ss=as.length;for(let os of rs)if(typeof os=="object"){if(os.doenetAttributes&&os.doenetAttributes.target){let ls=os.doenetAttributes.targetComponentName;ls!==void 0&&(ls.substring(0,ss)!==as&&(os.doenetAttributes.target=ls),ns[ls]||(ns[ls]=[]),ns[ls].push(os.doenetAttributes))}for(let ls in os.attributes){let us=os.attributes[ls];if(us.targetComponentNames)for(let cs of us.targetComponentNames){let ds=cs.absoluteName;ds!==void 0&&(ds.substring(0,ss)!==as&&(cs.relativeName=ds),ns[ds]||(ns[ds]=[]),ns[ds].push(cs))}}if(os.children&&setTargetsOutsideNamespaceToAbsoluteAndRecordAllTargetComponentNames({namespace:as,components:os.children,attributesByTargetComponentName:ns}),os.attributes)for(let ls in os.attributes){let us=os.attributes[ls];us.component?setTargetsOutsideNamespaceToAbsoluteAndRecordAllTargetComponentNames({namespace:as,components:[us.component],attributesByTargetComponentName:ns}):us.childrenForComponent&&setTargetsOutsideNamespaceToAbsoluteAndRecordAllTargetComponentNames({namespace:as,components:us.childrenForComponent,attributesByTargetComponentName:ns})}}}function renameMatchingTargetNames(as,rs,ns=!1){if(as.originalName&&rs&&as.componentName!==as.originalName){if(rs[as.originalName])for(let ss of rs[as.originalName])ss.relativeName?(ss.relativeName=as.componentName,ss.absoluteName=as.componentName):(ss.target=as.componentName,ss.targetComponentName=as.componentName);if(ns){let ss=as.originalName+"/",os=ss.length;for(let ls in rs)if(ls.substring(0,os)===ss){let us=ls.substring(os);for(let cs of rs[ls])cs.relativeName?(cs.relativeName=as.componentName+"/"+us,cs.absoluteName=as.componentName+"/"+us):(cs.target=as.componentName+"/"+us,cs.targetComponentName=as.componentName+"/"+us)}}}}function moveComponentNamesToOriginalNames(as){for(let rs of as)if(rs.componentName&&(rs.originalName=rs.componentName,delete rs.componentName),rs.children&&moveComponentNamesToOriginalNames(rs.children),rs.attributes)for(let ns in rs.attributes){let ss=rs.attributes[ns];ss.component?moveComponentNamesToOriginalNames([ss.component]):ss.childrenForComponent&&moveComponentNamesToOriginalNames(ss.childrenForComponent)}}function markToCreateAllUniqueNames(as){var rs,ns;for(let ss of as)if(typeof ss=="object"&&(ss.doenetAttributes||(ss.doenetAttributes={}),ss.doenetAttributes.createUniqueName=!0,delete ss.doenetAttributes.prescribedName,(ns=(rs=ss.attributes)==null?void 0:rs.newNamespace)!=null&&ns.primitive||(ss.doenetAttributes.assignNames?(ss.doenetAttributes.createUniqueAssignNames=!0,ss.doenetAttributes.originalAssignNames=ss.doenetAttributes.assignNames,delete ss.doenetAttributes.assignNames):ss.originalDoenetAttributes&&ss.originalDoenetAttributes.assignNames&&(ss.doenetAttributes.createUniqueAssignNames=!0,ss.doenetAttributes.originalAssignNames=ss.originalDoenetAttributes.assignNames),ss.children&&markToCreateAllUniqueNames(ss.children)),ss.attributes))for(let os in ss.attributes){let ls=ss.attributes[os];ls.component?markToCreateAllUniqueNames([ls.component]):ls.childrenForComponent&&markToCreateAllUniqueNames(ls.childrenForComponent)}}function setTNamesToAbsolute(as){for(let rs of as){if(rs.doenetAttributes&&rs.doenetAttributes.target){let ns=rs.doenetAttributes.targetComponentName;ns!==void 0&&(rs.doenetAttributes.target=ns)}if(rs.children&&setTNamesToAbsolute(rs.children),rs.attributes)for(let ns in rs.attributes){let ss=rs.attributes[ns];ss.component?setTNamesToAbsolute([ss.component]):ss.childrenForComponent&&setTNamesToAbsolute(ss.childrenForComponent)}}}function restrictTNamesToNamespace({components:as,namespace:rs,parentNamespace:ns,parentIsCopy:ss=!1,invalidateReferencesToBaseNamespace:os=!1}){var us;ns===void 0&&(ns=rs);let ls=rs.length;for(let cs of as){if(cs.doenetAttributes&&cs.doenetAttributes.target){let ds=cs.doenetAttributes.target;if(ds[0]==="/"){if(ds.substring(0,ls)!==rs){let ps=rs.split("/").slice(1),fs=ds.split("/").slice(1),hs=!1,gs=rs+ds.slice(1);for(;ps.length>0&&ps[0]===fs[0];)ps=ps.slice(1),fs=fs.slice(1),hs=!0;if(hs)gs=rs+fs.join("/");else{let ys=rs.split("/").slice(1);for(let bs=1;bs0||(cs=1)),us in rs?rs[us]+=cs:rs[us]=cs}return rs}const rendererState=Recoil_index_10({key:"rendererState",default:{stateValues:{},sourceOfUpdate:{},ignoreUpdate:!1,childrenInstructions:[],prefixForIds:""}});function useDoenetRenderer(as,rs=!0){let ns=as.componentInstructions.actions,ss=as.componentInstructions.componentName,os=as.componentInstructions.effectiveName,ls=as.coreId+ss,[us,cs]=reactExports.useState({}),{stateValues:ds,sourceOfUpdate:ps={},ignoreUpdate:fs,childrenInstructions:hs,prefixForIds:gs}=Recoil_index_20(rendererState(ls)),ys=[];const bs=Object.keys(us).length===0;for(let Ts of hs){let Ss=vs(Ts,bs);ys.push(Ss)}reactExports.useEffect(()=>{Object.keys(us).length>0&&renderersloadComponent(Object.values(us),Object.keys(us)).then(Ts=>{Object.assign(as.rendererClasses,Ts),cs({})})},[us,as.rendererClasses]);function vs(Ts,Ss){if(typeof Ts=="string")return Ts;let Ns={key:as.coreId+Ts.componentName,componentInstructions:Ts,rendererClasses:as.rendererClasses,flags:as.flags,coreId:as.coreId,callAction:as.callAction},As=as.rendererClasses[Ts.rendererType];return As?React.createElement(As,Ns):(Ss&&cs(Es=>{let _s={...Es};return Ts.rendererType in _s||(_s[Ts.rendererType]=__variableDynamicImportRuntimeHelper(Object.assign({"./renderers/alert.jsx":()=>__vitePreload(()=>import("./alert-2aac55be.js"),[]),"./renderers/angle.jsx":()=>__vitePreload(()=>import("./angle-16184609.js"),["assets/angle-16184609.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/answer.jsx":()=>__vitePreload(()=>import("./answer-4e2755f1.js"),[]),"./renderers/asList.jsx":()=>__vitePreload(()=>import("./asList-282c8072.js"),[]),"./renderers/boolean.jsx":()=>__vitePreload(()=>import("./boolean-37db2c5b.js"),[]),"./renderers/booleanInput.jsx":()=>__vitePreload(()=>import("./booleanInput-3b0c7c6a.js"),["assets/booleanInput-3b0c7c6a.js","assets/ToggleButton-0b55a995.js","assets/booleanInput-01650bf1.css"]),"./renderers/c.jsx":()=>__vitePreload(()=>import("./c-e2b89d31.js"),[]),"./renderers/callAction.jsx":()=>__vitePreload(()=>import("./callAction-c6bb5e7a.js"),[]),"./renderers/cell.jsx":()=>__vitePreload(()=>import("./cell-8f0e6a31.js"),[]),"./renderers/chart.jsx":()=>__vitePreload(()=>import("./chart-ce435d1f.js"),["assets/chart-ce435d1f.js","assets/visibility-sensor-398e690f.js"]),"./renderers/choiceInput.jsx":()=>__vitePreload(()=>import("./choiceInput-af5757a7.js"),["assets/choiceInput-af5757a7.js","assets/choiceInput-92287600.css"]),"./renderers/circle.jsx":()=>__vitePreload(()=>import("./circle-6641f664.js"),["assets/circle-6641f664.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/cobwebPolyline.jsx":()=>__vitePreload(()=>import("./cobwebPolyline-579fad3e.js"),["assets/cobwebPolyline-579fad3e.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/codeEditor.jsx":()=>__vitePreload(()=>import("./codeEditor-35261aaa.js"),["assets/codeEditor-35261aaa.js","assets/css-14ccef8c.js","assets/CodeMirror-d3d9f7d1.js","assets/visibility-sensor-398e690f.js"]),"./renderers/codeViewer.jsx":()=>__vitePreload(()=>import("./codeViewer-0faccbae.js"),["assets/codeViewer-0faccbae.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/containerBlock.jsx":()=>__vitePreload(()=>import("./containerBlock-87e84c0a.js"),["assets/containerBlock-87e84c0a.js","assets/visibility-sensor-398e690f.js"]),"./renderers/containerInline.jsx":()=>__vitePreload(()=>import("./containerInline-54e6bb2d.js"),[]),"./renderers/curve.jsx":()=>__vitePreload(()=>import("./curve-da578ee9.js"),["assets/curve-da578ee9.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/ellipsis.jsx":()=>__vitePreload(()=>import("./ellipsis-f2d5fc3f.js"),[]),"./renderers/em.jsx":()=>__vitePreload(()=>import("./em-d5d3f25f.js"),[]),"./renderers/embed.jsx":()=>__vitePreload(()=>import("./embed-51d0f72d.js"),["assets/embed-51d0f72d.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/feedback.jsx":()=>__vitePreload(()=>import("./feedback-13937dc4.js"),["assets/feedback-13937dc4.js","assets/index-47ca4f11.js","assets/visibility-sensor-398e690f.js"]),"./renderers/figure.jsx":()=>__vitePreload(()=>import("./figure-0b18cdc0.js"),["assets/figure-0b18cdc0.js","assets/visibility-sensor-398e690f.js","assets/index.esm-d246f4c9.js","assets/setPrototypeOf-51e8cf87.js"]),"./renderers/footnote.jsx":()=>__vitePreload(()=>import("./footnote-4a0bce52.js"),[]),"./renderers/graph.jsx":()=>__vitePreload(()=>import("./graph-1ff63df5.js"),["assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/hint.jsx":()=>__vitePreload(()=>import("./hint-5302af12.js"),["assets/hint-5302af12.js","assets/index-47ca4f11.js","assets/visibility-sensor-398e690f.js"]),"./renderers/image.jsx":()=>__vitePreload(()=>import("./image-8c34613a.js"),["assets/image-8c34613a.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/label.jsx":()=>__vitePreload(()=>import("./label-0082a454.js"),["assets/label-0082a454.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/legend.jsx":()=>__vitePreload(()=>import("./legend-b70946f9.js"),["assets/legend-b70946f9.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/line.jsx":()=>__vitePreload(()=>import("./line-967c1dc1.js"),["assets/line-967c1dc1.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/lineSegment.jsx":()=>__vitePreload(()=>import("./lineSegment-bdbc44a3.js"),["assets/lineSegment-bdbc44a3.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/list.jsx":()=>__vitePreload(()=>import("./list-6e9609f2.js"),["assets/list-6e9609f2.js","assets/visibility-sensor-398e690f.js"]),"./renderers/math.jsx":()=>__vitePreload(()=>import("./math-4022ba18.js"),["assets/math-4022ba18.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/mathInput.jsx":()=>__vitePreload(()=>import("./mathInput-9baa2704.js"),["assets/mathInput-9baa2704.js","assets/MathInputSelector-84e903aa.js","assets/mathInput-cbd86307.css"]),"./renderers/mathList.jsx":()=>__vitePreload(()=>import("./mathList-438e20fc.js"),[]),"./renderers/matrixInput.jsx":()=>__vitePreload(()=>import("./matrixInput-520e93f2.js"),["assets/matrixInput-520e93f2.js","assets/ActionButton-be9a12e7.js","assets/ActionButtonGroup-f3a36748.js","assets/mathInput-cbd86307.css"]),"./renderers/mdash.jsx":()=>__vitePreload(()=>import("./mdash-c7488048.js"),[]),"./renderers/nbsp.jsx":()=>__vitePreload(()=>import("./nbsp-be2f0b5b.js"),[]),"./renderers/ndash.jsx":()=>__vitePreload(()=>import("./ndash-6a81221e.js"),[]),"./renderers/number.jsx":()=>__vitePreload(()=>import("./number-9f233528.js"),[]),"./renderers/numberList.jsx":()=>__vitePreload(()=>import("./numberList-430714f6.js"),[]),"./renderers/orbitalDiagram.jsx":()=>__vitePreload(()=>import("./orbitalDiagram-668225b9.js"),["assets/orbitalDiagram-668225b9.js","assets/visibility-sensor-398e690f.js"]),"./renderers/orbitalDiagramInput.jsx":()=>__vitePreload(()=>import("./orbitalDiagramInput-667388be.js"),["assets/orbitalDiagramInput-667388be.js","assets/visibility-sensor-398e690f.js"]),"./renderers/p.jsx":()=>__vitePreload(()=>import("./p-6db7a549.js"),["assets/p-6db7a549.js","assets/visibility-sensor-398e690f.js"]),"./renderers/paginatorControls.jsx":()=>__vitePreload(()=>import("./paginatorControls-3d3c1544.js"),[]),"./renderers/pegboard.jsx":()=>__vitePreload(()=>import("./pegboard-0651b50e.js"),["assets/pegboard-0651b50e.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/point.jsx":()=>__vitePreload(()=>import("./point-7d0d29c6.js"),["assets/point-7d0d29c6.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/polygon.jsx":()=>__vitePreload(()=>import("./polygon-45e4e0cc.js"),["assets/polygon-45e4e0cc.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/polyline.jsx":()=>__vitePreload(()=>import("./polyline-0b825c88.js"),["assets/polyline-0b825c88.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/pre.jsx":()=>__vitePreload(()=>import("./pre-1272c629.js"),["assets/pre-1272c629.js","assets/visibility-sensor-398e690f.js"]),"./renderers/q.jsx":()=>__vitePreload(()=>import("./q-199e8b0b.js"),[]),"./renderers/ray.jsx":()=>__vitePreload(()=>import("./ray-41a10f15.js"),["assets/ray-41a10f15.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/ref.jsx":()=>__vitePreload(()=>import("./ref-ee7f7b38.js"),[]),"./renderers/regionBetweenCurveXAxis.jsx":()=>__vitePreload(()=>import("./regionBetweenCurveXAxis-ce0800c5.js"),["assets/regionBetweenCurveXAxis-ce0800c5.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/row.jsx":()=>__vitePreload(()=>import("./row-4df1652c.js"),[]),"./renderers/section.jsx":()=>__vitePreload(()=>import("./section-209bdcaa.js"),["assets/section-209bdcaa.js","assets/visibility-sensor-398e690f.js"]),"./renderers/sideBySide.jsx":()=>__vitePreload(()=>import("./sideBySide-b357db24.js"),["assets/sideBySide-b357db24.js","assets/visibility-sensor-398e690f.js"]),"./renderers/slider.jsx":()=>__vitePreload(()=>import("./slider-71d66f00.js"),["assets/slider-71d66f00.js","assets/ActionButton-be9a12e7.js","assets/ActionButtonGroup-f3a36748.js"]),"./renderers/solution.jsx":()=>__vitePreload(()=>import("./solution-87ce998d.js"),["assets/solution-87ce998d.js","assets/visibility-sensor-398e690f.js"]),"./renderers/spreadsheet.jsx":()=>__vitePreload(()=>import("./spreadsheet-fc3aeca1.js"),["assets/spreadsheet-fc3aeca1.js","assets/moment-b216ba57.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js","assets/spreadsheet-f0a2a11b.css"]),"./renderers/sq.jsx":()=>__vitePreload(()=>import("./sq-beafee12.js"),[]),"./renderers/subsetOfRealsInput.jsx":()=>__vitePreload(()=>import("./subsetOfRealsInput-b0dea720.js"),["assets/subsetOfRealsInput-b0dea720.js","assets/ActionButton-be9a12e7.js","assets/ActionButtonGroup-f3a36748.js","assets/ToggleButton-0b55a995.js","assets/ToggleButtonGroup-e9ff9889.js","assets/visibility-sensor-398e690f.js"]),"./renderers/summaryStatistics.jsx":()=>__vitePreload(()=>import("./summaryStatistics-6e0d6adb.js"),["assets/summaryStatistics-6e0d6adb.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/table.jsx":()=>__vitePreload(()=>import("./table-6cd432a0.js"),["assets/table-6cd432a0.js","assets/visibility-sensor-398e690f.js"]),"./renderers/tabular.jsx":()=>__vitePreload(()=>import("./tabular-efc5101f.js"),["assets/tabular-efc5101f.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/tag.jsx":()=>__vitePreload(()=>import("./tag-b10b024c.js"),[]),"./renderers/text.jsx":()=>__vitePreload(()=>import("./text-1978288a.js"),["assets/text-1978288a.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/textInput.jsx":()=>__vitePreload(()=>import("./textInput-b488d15c.js"),["assets/textInput-b488d15c.js","assets/css-14ccef8c.js"]),"./renderers/textList.jsx":()=>__vitePreload(()=>import("./textList-ce45fad3.js"),[]),"./renderers/triggerSet.jsx":()=>__vitePreload(()=>import("./triggerSet-5593c809.js"),[]),"./renderers/updateValue.jsx":()=>__vitePreload(()=>import("./updateValue-cc05d70f.js"),[]),"./renderers/vector.jsx":()=>__vitePreload(()=>import("./vector-e1829ec2.js"),["assets/vector-e1829ec2.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/video.jsx":()=>__vitePreload(()=>import("./video-9bb16c8c.js"),["assets/video-9bb16c8c.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"])}),`./renderers/${Ts.rendererType}.jsx`)),_s}),null)}let xs=as.componentInstructions.rendererType;const Cs=Ts=>(Ts.componentName||(Ts={...Ts},Ts.componentName=ss),Ts.rendererType||(Ts={...Ts},Ts.rendererType=xs),as.callAction(Ts));return{name:os,id:gs+os,SVs:ds,actions:ns,children:ys,sourceOfUpdate:ps,ignoreUpdate:fs,rendererName:ls,initializeChildren:()=>{},callAction:Cs}}function returnStandardSequenceAttributes(){return{type:{createPrimitiveOfType:"string",createStateVariable:"type",defaultPrimitiveValue:"number",toLowerCase:!0,validValues:["number","math","letters"]},from:{createComponentOfType:"_componentWithSelectableType"},to:{createComponentOfType:"_componentWithSelectableType"},step:{createComponentOfType:"math"},length:{createComponentOfType:"number"},exclude:{createComponentOfType:"_componentListWithSelectableType"}}}function returnStandardSequenceStateVariableDefinitions(){let as={};return as.specifiedFrom={returnDependencies:()=>({fromAttr:{dependencyType:"attributeComponent",attributeName:"from",variableNames:["value"]}}),defaultValue:null,hasEssential:!0,essentialVarName:"from",definition:function({dependencyValues:rs}){return rs.fromAttr===null?{useEssentialOrDefaultValue:{specifiedFrom:!0}}:rs.fromAttr.stateValues.value===null?{setValue:{specifiedFrom:NaN}}:{setValue:{specifiedFrom:rs.fromAttr.stateValues.value}}}},as.specifiedTo={returnDependencies:()=>({toAttr:{dependencyType:"attributeComponent",attributeName:"to",variableNames:["value"]}}),defaultValue:null,hasEssential:!0,essentialVarName:"to",definition:function({dependencyValues:rs}){return rs.toAttr===null?{useEssentialOrDefaultValue:{specifiedTo:!0}}:rs.toAttr.stateValues.value===null?{setValue:{specifiedTo:NaN}}:{setValue:{specifiedTo:rs.toAttr.stateValues.value}}}},as.specifiedLength={returnDependencies:()=>({lengthAttr:{dependencyType:"attributeComponent",attributeName:"length",variableNames:["value"]}}),defaultValue:null,hasEssential:!0,essentialVarName:"length",definition:function({dependencyValues:rs}){return rs.lengthAttr===null?{useEssentialOrDefaultValue:{specifiedLength:!0}}:rs.lengthAttr.stateValues.value===null?{setValue:{specifiedLength:NaN}}:{setValue:{specifiedLength:rs.lengthAttr.stateValues.value}}}},as.specifiedStep={returnDependencies:()=>({stepAttr:{dependencyType:"attributeComponent",attributeName:"step",variableNames:["value"]},type:{dependencyType:"stateVariable",variableName:"type"}}),defaultValue:null,hasEssential:!0,essentialVarName:"step",definition:function({dependencyValues:rs}){if(rs.stepAttr===null)return{useEssentialOrDefaultValue:{specifiedStep:!0}};let ns=rs.stepAttr.stateValues.value;return ns===null?{setValue:{specifiedStep:NaN}}:{setValue:{specifiedStep:ns}}}},as.specifiedExclude={returnDependencies:()=>({excludeAttr:{dependencyType:"attributeComponent",attributeName:"exclude",variableNames:["values"]}}),defaultValue:[],hasEssential:!0,essentialVarName:"exclude",definition:function({dependencyValues:rs}){return rs.excludeAttr===null?{useEssentialOrDefaultValue:{specifiedExclude:!0}}:{setValue:{specifiedExclude:rs.excludeAttr.stateValues.values}}}},as.lowercase={returnDependencies:()=>({specifiedTo:{dependencyType:"stateVariable",variableName:"specifiedTo"},specifiedFrom:{dependencyType:"stateVariable",variableName:"specifiedFrom"}}),definition:function({dependencyValues:rs}){let ns=/^[A-Z]*$/,ss=!0;return rs.specifiedFrom!==null?ns.test(rs.specifiedFrom)&&(ss=!1):rs.specifiedTo!==null&&ns.test(rs.specifiedTo)&&(ss=!1),{setValue:{lowercase:ss}}}},as.validSequence={returnDependencies:()=>({specifiedLength:{dependencyType:"stateVariable",variableName:"specifiedLength"},specifiedStep:{dependencyType:"stateVariable",variableName:"specifiedStep"},specifiedFrom:{dependencyType:"stateVariable",variableName:"specifiedFrom"},specifiedTo:{dependencyType:"stateVariable",variableName:"specifiedTo"},type:{dependencyType:"stateVariable",variableName:"type"},lowercase:{dependencyType:"stateVariable",variableName:"lowercase"}}),definition:function({dependencyValues:rs}){let ns=!0;if(rs.specifiedLength!==null&&(!Number.isInteger(rs.specifiedLength)||rs.specifiedLength<0)&&(console.warn("Invalid length of sequence. Must be a non-negative integer."),ns=!1),rs.specifiedStep!==null&&rs.type!=="math"){let ss=findFiniteNumericalValue(rs.specifiedStep);Number.isFinite(ss)||(console.warn("Invalid step of sequence. Must be a number for sequence of type "+rs.type+"."),ns=!1)}if(rs.specifiedFrom!==null)if(rs.type==="number"){let ss=findFiniteNumericalValue(rs.specifiedFrom);Number.isFinite(ss)||(console.warn("Invalid from of number sequence. Must be a number"),ns=!1)}else Number.isNaN(rs.specifiedFrom)&&(console.warn("Invalid from of sequence"),ns=!1);if(rs.specifiedTo!==null)if(rs.type==="number"){let ss=findFiniteNumericalValue(rs.specifiedTo);Number.isFinite(ss)||(console.warn("Invalid to of number sequence. Must be a number"),ns=!1)}else Number.isNaN(rs.specifiedTo)&&(console.warn("Invalid to of sequence"),ns=!1);return{setValue:{validSequence:ns}}}},as.from={additionalStateVariablesDefined:["step","length","exclude"],returnDependencies:()=>({specifiedFrom:{dependencyType:"stateVariable",variableName:"specifiedFrom"},specifiedTo:{dependencyType:"stateVariable",variableName:"specifiedTo"},specifiedLength:{dependencyType:"stateVariable",variableName:"specifiedLength"},specifiedStep:{dependencyType:"stateVariable",variableName:"specifiedStep"},type:{dependencyType:"stateVariable",variableName:"type"},specifiedExclude:{dependencyType:"stateVariable",variableName:"specifiedExclude"},validSequence:{dependencyType:"stateVariable",variableName:"validSequence"}}),definition:function({dependencyValues:rs}){let ns=rs.specifiedFrom,ss=rs.specifiedTo,os=rs.specifiedStep,ls=rs.specifiedLength,us=[...rs.specifiedExclude],cs=rs.type;if(rs.type==="math")ss!==null&&(ss instanceof Context.class||(ss=Context.fromAst(ss))),ns!==null&&(ns instanceof Context.class||(ns=Context.fromAst(ns))),os!==null&&(os instanceof Context.class||(os=Context.fromAst(os)));else if(os!==null&&os instanceof Context.class&&(os=os.evaluate_to_constant()),rs.type==="letters")ns!==null&&(ns=lettersToNumber$1(ns)),ss!==null&&(ss=lettersToNumber$1(ss)),us=us.map(lettersToNumber$1);else if(rs.type==="number"){ss!==null&&(ss instanceof Context.class?ss=ss.evaluate_to_constant():ss=Number(ss)),ns!==null&&(ns instanceof Context.class?ns=ns.evaluate_to_constant():ns=Number(ns));for(let[ds,ps]of us.entries())ps instanceof Context.class?us[ds]=ps.evaluate_to_constant():us[ds]=Number(ps)}if(rs.validSequence){let ds=calculateSequenceParameters({from:ns,to:ss,step:os,length:ls,type:cs});return ds.exclude=us,{setValue:ds}}return(!Number.isInteger(ls)||ls<0)&&(ls=0),{setValue:{from:ns,step:os,length:ls,exclude:us}}}},as}function calculateSequenceParameters({from:as,to:rs,step:ns,length:ss,type:os}){if(as===null)rs===null?(os==="math"?as=Context.fromAst(1):as=1,ns===null&&(os==="math"?ns=Context.fromAst(1):ns=1),ss===null&&(ss=10)):(ns===null&&(os==="math"?ns=Context.fromAst(1):ns=1),ss===null&&(os==="math"?ss=Math.floor((rs.subtract(1).divide(ns).evaluate_to_constant()+1)*(1+1e-14)):ss=Math.floor(((rs-1)/ns+1)*(1+1e-14))),os==="math"?as=rs.subtract(ns.multiply(ss-1)).simplify():(as=rs-ns*(ss-1),os==="letters"&&as<1&&(ss=Math.floor(((rs-1)/ns+1)*(1+1e-14)),as=rs-ns*(ss-1))));else if(rs===null)ns===null&&(os==="math"?ns=Context.fromAst(1):ns=1),ss===null&&(ss=10);else if(ns===null)ss===null?os==="math"?(ns=Context.fromAst(1),ss=Math.floor(rs.subtract(as).add(1).evaluate_to_constant()*(1+1e-14))):(ns=1,ss=Math.floor((rs-as+1)*(1+1e-14))):os==="math"?ns=rs.subtract(as).divide(ss-1):(ns=(rs-as)/(ss-1),os==="letters"&&(ns=Math.floor(ns)));else if(ss===null)os==="math"?ss=Math.floor(rs.subtract(as).divide(ns).add(1).evaluate_to_constant()*(1+1e-14)):ss=Math.floor(((rs-as)/ns+1)*(1+1e-14));else throw Error("Can't define from, to, step, and length for sequence");return(!Number.isInteger(ss)||ss<0)&&(console.warn("Invalid length of sequence. Must be a non-negative integer."),ss=0),{from:as,step:ns,length:ss}}function returnSequenceValues({from:as,step:rs,length:ns,exclude:ss,type:os,lowercase:ls,maxNum:us},cs=!1){let ds=[],ps=0;for(let fs=0;fs0&&(os==="math"?hs=hs.add(rs.multiply(Context.fromAst(fs))).expand().simplify():hs+=rs*fs),os==="math"){if(ss.some(gs=>gs&&gs.equals(hs)))continue}else if(os==="number"){if(ss.some(gs=>Math.abs(gs-hs)<=1e-14*Math.max(Math.abs(gs),Math.abs(hs))))continue}else if(ss.includes(hs))continue;if(os==="letters"&&(hs=numberToLetters(hs,ls)),cs?ds.push({value:hs,originalIndex:fs}):ds.push(hs),ps++,ps===us)break}return ds}function returnSequenceValueForIndex({index:as,from:rs,step:ns,length:ss,exclude:os,type:ls,lowercase:us}){if(!(as>=0&&(ss===void 0||as0&&(ls==="math"?cs=cs.add(ns.multiply(Context.fromAst(as))).expand().simplify():cs+=ns*as),ls==="math"){if(os.some(ds=>ds&&ds.equals(cs)))return null}else if(ls==="number"){if(os.some(ds=>Math.abs(ds-cs)<=1e-14*Math.max(Math.abs(ds),Math.abs(cs))))return null}else if(os.includes(cs))return null;return ls==="letters"&&(cs=numberToLetters(cs,us)),cs}function lettersToNumber$1(as){try{as=as.toUpperCase()}catch{console.warn("Cannot convert "+as+" to a number");return}let rs=0,ns=as.length,ss=ns;for(;(ss-=1)>-1;){let os=as.charCodeAt(ss)-64;if(os<1||os>26){console.warn("Cannot convert "+as+" to a number");return}rs+=os*Math.pow(26,ns-1-ss)}return rs}function numberToLetters(as,rs){as--;let ns=65;rs&&(ns=97);let ss="";for(;;){let os=as%26;if(ss=String.fromCharCode(ns+os)+ss,as<26)break;as=Math.floor(as/26)-1}return ss}let styleAttributes={lineColor:{componentType:"text"},lineColorWord:{componentType:"text"},lineColorDarkMode:{componentType:"text"},lineColorWordDarkMode:{componentType:"text"},lineOpacity:{componentType:"number"},lineWidth:{componentType:"number"},lineWidthWord:{componentType:"text"},lineStyle:{componentType:"text"},lineStyleWord:{componentType:"text"},markerColor:{componentType:"text"},markerColorWord:{componentType:"text"},markerColorDarkMode:{componentType:"text"},markerColorWordDarkMode:{componentType:"text"},markerStyle:{componentType:"text"},markerStyleWord:{componentType:"text"},markerSize:{componentType:"number"},fillColor:{componentType:"text"},fillColorWord:{componentType:"text"},fillColorDarkMode:{componentType:"text"},fillColorWordDarkMode:{componentType:"text"},fillOpacity:{componentType:"number"}},defaultStyle={lineColor:"#648FFF",lineColorWord:"blue",lineColorDarkMode:"#648FFF",lineColorWordDarkMode:"blue",lineOpacity:.7,lineWidth:4,lineWidthWord:"thick",lineStyle:"solid",lineStyleWord:"",markerColor:"#648FFF",markerColorWord:"blue",markerColorDarkMode:"#648FFF",markerColorWordDarkMode:"blue",markerStyle:"circle",markerStyleWord:"point",markerSize:5,fillColor:"#648FFF",fillColorWord:"blue",fillColorDarkMode:"#648FFF",fillColorWordDarkMode:"blue",fillOpacity:.3};function returnDefaultStyleDefinitions(){return{1:{lineColor:"#648FFF",lineColorWord:"blue",lineColorDarkMode:"#648FFF",lineColorWordDarkMode:"blue",lineOpacity:.7,lineWidth:4,lineWidthWord:"thick",lineStyle:"solid",lineStyleWord:"",markerColor:"#648FFF",markerColorWord:"blue",markerColorDarkMode:"#648FFF",markerColorWordDarkMode:"blue",markerStyle:"circle",markerStyleWord:"point",markerSize:5,fillColor:"#648FFF",fillColorWord:"blue",fillColorDarkMode:"#648FFF",fillColorWordDarkMode:"blue",fillOpacity:.3},2:{lineColor:"#D4042D",lineColorWord:"red",lineColorDarkMode:"#D4042D",lineColorWordDarkMode:"red",lineOpacity:.7,lineWidth:2,lineWidthWord:"",lineStyle:"solid",lineStyleWord:"",markerColor:"#D4042D",markerColorWord:"red",markerColorDarkMode:"#D4042D",markerColorWordDarkMode:"red",markerStyle:"square",markerStyleWord:"square",markerSize:5,fillColor:"#D4042D",fillColorWord:"red",fillColorDarkMode:"#D4042D",fillColorWordDarkMode:"red",fillOpacity:.3},3:{lineColor:"#F19143",lineColorWord:"orange",lineColorDarkMode:"#F19143",lineColorWordDarkMode:"orange",lineOpacity:.7,lineWidth:3,lineWidthWord:"",lineStyle:"solid",lineStyleWord:"",markerColor:"#F19143",markerColorWord:"orange",markerColorDarkMode:"#F19143",markerColorWordDarkMode:"orange",markerStyle:"triangle",markerStyleWord:"triangle",markerSize:5,fillColor:"#F19143",fillColorWord:"orange",fillColorDarkMode:"#F19143",fillColorWordDarkMode:"orange",fillOpacity:.3},4:{lineColor:"#644CD6",lineColorWord:"purple",lineColorDarkMode:"#644CD6",lineColorWordDarkMode:"purple",lineOpacity:.7,lineWidth:2,lineWidthWord:"",lineStyle:"solid",lineStyleWord:"",markerColor:"#644CD6",markerColorWord:"purple",markerColorDarkMode:"#644CD6",markerColorWordDarkMode:"purple",markerStyle:"diamond",markerStyleWord:"diamond",markerSize:5,fillColor:"#644CD6",fillColorWord:"purple",fillColorDarkMode:"#644CD6",fillColorWordDarkMode:"purple",fillOpacity:.3},5:{lineColor:"black",lineColorWord:"black",lineColorDarkMode:"white",lineColorWordDarkMode:"white",lineOpacity:.7,lineWidth:1,lineWidthWord:"thin",lineStyle:"solid",lineStyleWord:"",markerColor:"black",markerColorWord:"black",markerColorDarkMode:"white",markerColorWordDarkMode:"white",markerStyle:"circle",markerStyleWord:"point",markerSize:5,fillColor:"black",fillColorWord:"black",fillColorDarkMode:"white",fillColorWordDarkMode:"white",fillOpacity:.3},6:{lineColor:"gray",lineColorWord:"gray",lineColorDarkMode:"gray",lineColorWordDarkMode:"gray",lineOpacity:.7,lineWidth:1,lineWidthWord:"thin",lineStyle:"dotted",lineStyleWord:"dotted",markerColor:"gray",markerColorWord:"gray",markerColorDarkMode:"gray",markerColorWordDarkMode:"gray",markerStyle:"circle",markerStyleWord:"point",markerSize:5,fillColor:"gray",fillColorWord:"gray",fillColorDarkMode:"gray",fillColorWordDarkMode:"gray",fillOpacity:.3}}}function returnStyleDefinitionStateVariables(){let as={};return as.setupChildren={returnDependencies:()=>({setupChildren:{dependencyType:"child",childGroups:["setups"],proceedIfAllChildrenNotMatched:!0}}),definition({dependencyValues:rs}){return{setValue:{setupChildren:rs.setupChildren}}}},as.styleDefinitions={stateVariablesDeterminingDependencies:["setupChildren"],returnDependencies({stateValues:rs}){let ns={ancestorWithStyle:{dependencyType:"ancestor",variableNames:["styleDefinitions"]},setupChildren:{dependencyType:"child",childGroups:["setups"],proceedIfAllChildrenNotMatched:!0}};for(let ss of rs.setupChildren)ns[`styleDefinitionsOf${ss.componentName}`]={dependencyType:"child",parentName:ss.componentName,childGroups:["styleDefinitions"],variableNames:["value"]};return ns},definition({dependencyValues:rs}){let ns={},ss;rs.ancestorWithStyle&&(ss=rs.ancestorWithStyle.stateValues.styleDefinitions),ss||(ss=returnDefaultStyleDefinitions());for(let ls in ss)ns[ls]=Object.assign({},ss[ls]);let os=[];for(let ls of rs.setupChildren)os.push(...rs[`styleDefinitionsOf${ls.componentName}`]);for(let ls of os){let us=ls.stateValues.value;for(let cs in us){let ds=ns[cs];ds||(ds=ns[cs]=Object.assign({},defaultStyle));let ps=Object.assign({},us[cs]);"markerColor"in ps&&!("markerColorWord"in ps)&&(ps.markerColorWord=ps.markerColor),"markerColorDarkMode"in ps&&!("markerColorWordDarkMode"in ps)&&(ps.markerColorWordDarkMode=ps.markerColorDarkMode),"markerColor"in ps&&!("markerColorDarkMode"in ps)&&(ps.markerColorDarkMode=ps.markerColor,ps.markerColorWordDarkMode=ps.markerWordColor),"markerStyle"in ps&&!("markerStyleWord"in ps)&&(ps.markerStyleWord=ps.markerStyle,ps.markerStyleWord==="circle"?ps.markerStyleWord="point":ps.markerStyleWord.slice(0,8)==="triangle"&&(ps.markerStyleWord="triangle")),"lineColor"in ps&&!("lineColorWord"in ps)&&(ps.lineColorWord=ps.lineColor),"lineColorDarkMode"in ps&&!("lineColorWordDarkMode"in ps)&&(ps.lineColorWordDarkMode=ps.lineColorDarkMode),"lineColor"in ps&&!("lineColorDarkMode"in ps)&&(ps.lineColorDarkMode=ps.lineColor,ps.lineColorWordDarkMode=ps.lineWordColor),"fillColor"in ps&&!("fillColorWord"in ps)&&(ps.fillColorWord=ps.fillColor),"fillColorDarkMode"in ps&&!("fillColorWordDarkMode"in ps)&&(ps.fillColorWordDarkMode=ps.fillColorDarkMode),"fillColor"in ps&&!("fillColorDarkMode"in ps)&&(ps.fillColorDarkMode=ps.fillColor,ps.fillColorWordDarkMode=ps.fillWordColor),"lineWidth"in ps&&!("lineWidthWord"in ps)&&(ps.lineWidth>=4?ps.lineWidthWord="thick":ps.lineWidth<=1?ps.lineWidthWord="thin":ps.lineWidthWord=""),"lineStyle"in ps&&!("lineStyleWord"in ps)&&(ps.lineStyle==="dashed"?ps.lineStyleWord="dashed":ps.lineStyle==="dotted"?ps.lineStyleWord="dotted":ps.lineStyleWord=""),Object.assign(ds,ps)}}return{setValue:{styleDefinitions:ns}}}},as}function returnSelectedStyleStateVariableDefinition(){return{selectedStyle:{forRenderer:!0,willNeverBeEssential:!0,returnDependencies:()=>({styleNumber:{dependencyType:"stateVariable",variableName:"styleNumber"},ancestorWithStyle:{dependencyType:"ancestor",variableNames:["styleDefinitions"]}}),definition:function({dependencyValues:as}){let rs=as.ancestorWithStyle.stateValues.styleDefinitions;rs||(rs=returnDefaultStyleDefinitions());let ns=rs[as.styleNumber];return ns===void 0&&(ns=defaultStyle),{setValue:{selectedStyle:ns}}}}}}function createStateProxyHandler(){return{get:function(as,rs){let ns=as[rs];return ns!==void 0&&(ns.isArray&&(ns.public||ns.trackChanges)?ns=new Proxy(ns.value,createArrayProxyHandler({variable:rs,nDimensions:ns.nDimensions})):ns=ns.value),ns},set:function(as,rs,ns){throw Error("Property "+rs+" is read-only")},deleteProperty:function(as,rs){throw Error("Property "+rs+" is read-only")}}}function createArrayProxyHandler({variable:as,nDimensions:rs,indicesSoFar:ns=[]}){return{variable:as,nDimensions:rs,indicesSoFar:ns,get:function(ss,os){if(os==="then"&&ss instanceof Promise)return us=>ss.then.bind(ss)(cs=>us(cs!==null&&typeof cs=="object"?new Proxy(cs,createArrayProxyHandler({variable:this.variable,nDimensions:this.nDimensions,indicesSoFar:this.indicesSoFar})):cs));let ls=ss[os];return ls!==null&&typeof ls=="object"&&rs>1&&(ls=new Proxy(ls,createArrayProxyHandler({variable:this.variable,nDimensions:this.nDimensions-1,indicesSoFar:[...this.indicesSoFar,os]}))),ls},set:function(ss,os,ls){throw Error("Property "+os+" is read-only")},deleteProperty:function(ss,os){throw Error("Property "+os+" is read-only")}}}function enumerateSelectionCombinations({numberOfIndices:as,numberOfOptions:rs,maxNumber:ns=1/0,withReplacement:ss=!1,skipZero:os=!1}){if(as===1){let ds=[...Array(rs).keys()];return ds=ds.slice(1),os||(ds=[...ds,0]),ds=ds.slice(0,ns),ds=ds.map(ps=>[ps]),ds}let ls=enumerateSelectionCombinations({numberOfIndices:as-1,numberOfOptions:rs,maxNumber:ns,withReplacement:ss,skipZero:!ss}),us=[],cs=0;for(let ds of ls)for(let ps=1;ps<=rs;ps++){let fs=[ps%rs,...ds.map(hs=>(ps+hs)%rs)];if(!(os&&fs.includes(0))&&(us.push(fs),cs++,cs>=ns))return us}return us}function enumerateCombinations({numberOfOptionsByIndex:as,maxNumber:rs=1/0}){let ns=as.length;if(ns===0)return[];let ss=[];for(let bs=0;bs[...vs,...bs],[]).reduce((bs,vs)=>Math.max(bs,vs),1);if(os===1){let bs=as.reduce((xs,Cs)=>xs*Cs);bs=Math.min(bs,rs);let vs=[];for(let xs=0;xsxs%Ts);vs.push(Cs)}return vs}if(ns===2){let bs=os,vs=Context.math.lcm(...as),xs=[],Cs=0;for(let Ts=0;Ts=rs)return xs}return xs}let ls=[];for(let bs=0;bs1?vs.push(Context.math.lcm(as[bs],as[xs])):vs.push(null);ls.push(vs)}let us=ls.reduce((bs,vs)=>[...vs,...bs],[]).filter(bs=>bs!==null).reduce((bs,vs)=>Math.min(bs,vs),1/0),cs;for(let bs=0;bs{if(os.length===0)ns.push(ls);else for(let us=0;us=rs)return}};return ss(as),ns}function getVariantsForDescendantsForUniqueVariants({variantIndex:as,serializedComponent:rs,componentInfoObjects:ns}){var cs;let ss=(cs=rs.variants)==null?void 0:cs.descendantVariantComponents;if(ss===void 0)return{success:!1};let os=ss.map(ds=>ds.variants.numberOfVariants),ls=enumerateCombinations({numberOfOptionsByIndex:os,maxNumber:as})[as-1],us=[];for(let[ds,ps]of ss.entries()){let hs=ns.allComponentClasses[ps.componentType].getUniqueVariant({serializedComponent:ps,variantIndex:ls[ds]+1,componentInfoObjects:ns});if(hs.success)us.push(hs.desiredVariant);else return{succss:!1}}return{success:!0,desiredVariants:us}}function setUpVariantSeedAndRng({serializedComponent:as,sharedParameters:rs,descendantVariantComponents:ns,useSubpartVariantRng:ss=!1}){let os,ls;if(as.variants&&(ls=as.variants.desiredVariant),(ls==null?void 0:ls.seed)!==void 0?os=ls.seed.toString():ss?os=rs.subpartVariantRng().toString().slice(2):os=rs.variantRng().toString().slice(2),rs.variantSeed=os,rs.variantRng=new rs.rngClass(rs.variantSeed),rs.subpartVariantRng=new rs.rngClass(rs.variantSeed+"s"),ls!=null&&ls.subvariants&&ns)for(let us in ls.subvariants){let cs=ls.subvariants[us],ds=ns[us];if(ds===void 0)break;ds.variants.desiredVariant=cs}}function gatherVariantComponents({serializedComponents:as,componentInfoObjects:rs}){let ns=[];for(let ss of as){if(typeof ss!="object")continue;if(ss.variants||(ss.variants={}),ss.variants.isVariantComponent){ns.push(ss);continue}if(ss.componentType in rs.componentTypesCreatingVariants){ss.variants.isVariantComponent=!0,ns.push(ss);continue}if(!ss.children)continue;if(ss.children.some(us=>us.componentType==="variantControl")){ss.variants.isVariantComponent=!0,ns.push(ss);continue}let ls=gatherVariantComponents({serializedComponents:ss.children,componentInfoObjects:rs});ls.length>0&&(ss.variants.descendantVariantComponents=ls,ns.push(...ls))}return ns}function getNumberOfVariants({serializedComponent:as,componentInfoObjects:rs}){as.variants||(as.variants={});let ns;for(let os of as.children)if(os.componentType==="variantControl"){ns=os;break}let ss=as.componentType==="document";if(!ns){if(!ss)return{success:!1};let os=as.children.filter(ls=>ls.componentType||ls.trim()!=="");if(os.length===1&&rs.isInheritedComponentType({inheritedComponentType:os[0].componentType,baseComponentType:"_sectioningComponent"})){let ls=os[0],us=getNumberOfVariants({serializedComponent:ls,componentInfoObjects:rs});if(us.success)return as.variants.descendantVariantComponents=gatherVariantComponents({serializedComponents:as.children,componentInfoObjects:rs}),as.variants.uniqueVariants=!0,as.variants.numberOfVariants=ls.variants.numberOfVariants,as.variants.allPossibleVariants=ls.variants.allPossibleVariants,as.variants.allVariantNames=ls.variants.allVariantNames,as.variants.allPossibleVariantUniqueIndices=[...ls.variants.allPossibleVariants.keys()].map(cs=>cs+1),as.variants.allPossibleVariantSeeds=[...ls.variants.allPossibleVariants.keys()].map(cs=>(cs+1).toString()),us}}return determineVariantsForSection({serializedComponent:as,componentInfoObjects:rs,isDocument:ss})}function determineVariantsForSection({serializedComponent:as,componentInfoObjects:rs,isDocument:ns=!1}){var Ns,As,ws,Es;as.variants===void 0&&(as.variants={});let ss;for(let _s of as.children)if(_s.componentType==="variantControl"){ss=_s;break}if(!ss&&!ns)return rs.allComponentClasses._base.determineNumberOfUniqueVariants({serializedComponent:as,componentInfoObjects:rs});let os=[];if(ss!=null&&ss.attributes.variantNames&&(os=ss.attributes.variantNames.component.children.map(_s=>_s.toLowerCase())),os.length!==[...new Set(os)].length)throw Error("Duplicate variant names specified");let ls=(Ns=ss==null?void 0:ss.attributes.nVariants)==null?void 0:Ns.primitive;Number.isFinite(ls)||(ls=100),ls=Math.min(Math.max(ls,1),1e3);let us=[...os];if(us.length_s.toLowerCase()),cs=[...new Set(cs)];for(let _s of cs)if(!us.includes(_s))throw Error(`Cannot include variant ${_s} as ${_s} is a not variant name`)}let ds=(ws=ss==null?void 0:ss.attributes.variantsToExclude)==null?void 0:ws.component.children;if(ds){ds=ds.map(_s=>_s.toLowerCase());for(let _s of ds)if(!us.includes(_s))throw Error(`Cannot exclude variant ${_s} as ${_s} is not a variant name`)}else ds=[];cs?cs=cs.filter(_s=>!ds.includes(_s)):cs=[...us].filter(_s=>!ds.includes(_s));let ps=cs.map(_s=>us.indexOf(_s)+1),fs=[];ss!=null&&ss.attributes.seeds&&(fs=ss.attributes.seeds.component.children);let hs=[...fs];if(hs.lengthhs[_s-1]),ys=(ss==null?void 0:ss.attributes.uniqueVariants)!==void 0,bs=(Es=ss==null?void 0:ss.attributes.uniqueVariants)==null?void 0:Es.primitive,vs;(bs||!ys)&&(vs=rs.allComponentClasses._base.determineNumberOfUniqueVariants({serializedComponent:as,componentInfoObjects:rs}),vs.success?bs=bs||vs.numberOfVariants<=ls:bs=!1);let xs=[],Cs=[],Ts=[];if(bs)for(let[_s,$s]of ps.entries())$s<=vs.numberOfVariants&&(Cs.push($s),xs.push(cs[_s]),Ts.push(gs[_s]));else xs=cs,Cs=ps,Ts=gs;let Ss=xs.length;if(Ss===0)throw Error("No variants selected based on variantsToInclude, variantsToExclude, and the number of variants available");return as.variants.uniqueVariants=bs,as.variants.numberOfVariants=Ss,as.variants.allPossibleVariants=xs,as.variants.allVariantNames=us,as.variants.allPossibleVariantUniqueIndices=Cs,as.variants.allPossibleVariantSeeds=Ts,{success:!0,numberOfVariants:Ss}}function indexToLowercaseLetters(as){return numberToLetters(as,!0)}function renameStateVariable({stateVariableDefinitions:as,oldName:rs,newName:ns}){let ss=as[ns]=as[rs];if(delete as[rs],ss.additionalStateVariablesDefined){let ds=ss.additionalStateVariablesDefined.indexOf(rs);ds!==-1&&(ss.additionalStateVariablesDefined[ds]=ns)}let os=ss.definition,ls=["setValue","useEssentialOrDefaultValue","setEssentialValue"],us=["noChanges"];ss.definition=function(ds){let ps=os(ds);for(let fs of ls)ps[fs]&&rs in ps[fs]&&(ps[fs][ns]=ps[fs][rs],delete ps[fs][rs]);for(let fs of us)if(ps[fs]){let hs=ps[fs].indexOf(rs);hs!==-1&&(ps[fs][hs]=ns)}return ps};let cs=ss.inverseDefinition;cs&&(ss.inverseDefinition=async function(ds){let ps=ds.desiredStateVariableValues;ps[rs]=ps[ns],delete ps[ns];let fs=await cs(ds);if(fs.success)for(let hs of fs.instructions)hs.setEssentialValue===rs&&(hs.setEssentialValue=ns);return fs})}function returnDefaultGetArrayKeysFromVarName(as){return as>1?function({arrayEntryPrefix:rs,varEnding:ns,arraySize:ss,nDimensions:os}){let ls=ns.split("_").map(us=>Number(us)-1);return ls.length===os&&ls.every((us,cs)=>Number.isInteger(us)&&us>=0)?ss?ls.every((us,cs)=>us=0?ss?ostypeof ls=="object"?ls.componentType:ls));for(let ls of os){let us=this.componentInfoObjects.allComponentClasses[ls];if(us){let cs=us.rendererType;cs&&!rs.includes(cs)&&rs.push(cs)}}}}if(this.constructor.adapters)for(let ns of this.constructor.adapters){let ss;typeof ns=="string"?ss=ns:ss=ns.componentType;let os=this.componentInfoObjects.allComponentClasses[ss];if(os){let ls=os.rendererType;ls&&!rs.includes(ls)&&rs.push(ls)}}if(!this.rendererType)return rs;for(let ns in this.allChildren){let ss=this.allChildren[ns].component;if(typeof ss=="object")for(let os of ss.allPotentialRendererTypes)rs.includes(os)||rs.push(os)}return rs}potentialRendererTypesFromSerializedComponents(rs){var ss;let ns=[];for(let os of rs){let ls=this.componentInfoObjects.allComponentClasses[os.componentType];if(ls){let us=ls.rendererType;us&&!ns.includes(us)&&ns.push(us);let cs=ls.returnStateVariableInfo({onlyPublic:!0}).stateVariableDescriptions;for(let ds in cs){let ps=cs[ds],fs=(ss=ps.shadowingInstructions)==null?void 0:ss.createComponentOfType;Array.isArray(fs)||(fs=[fs]),ps.wrappingComponents&&fs.push(...flattenDeep(ps.wrappingComponents).map(hs=>typeof hs=="object"?hs.componentType:hs));for(let hs of fs){let gs=this.componentInfoObjects.allComponentClasses[hs];if(gs){let ys=gs.rendererType;ys&&!ns.includes(ys)&&ns.push(ys)}}}if(ls.adapters)for(let ds of ls.adapters){let ps;typeof ds=="string"?ps=ds:ps=ds.componentType;let fs=this.componentInfoObjects.allComponentClasses[ps];if(fs){let hs=fs.rendererType;hs&&!ns.includes(hs)&&ns.push(hs)}}}if(os.children){let us=this.potentialRendererTypesFromSerializedComponents(os.children);for(let cs of us)ns.includes(cs)||ns.push(cs)}}return ns}get childrenMatched(){return this.childrenMatchedWithPlaceholders&&!this.placeholderActiveChildrenIndices}static createAttributesObject(){return{hide:{createComponentOfType:"boolean",createStateVariable:"hide",defaultValue:!1,public:!0},disabled:{createComponentOfType:"boolean"},fixed:{createComponentOfType:"boolean",ignoreFixed:!0},modifyIndirectly:{createComponentOfType:"boolean",createStateVariable:"modifyIndirectly",defaultValue:!0,public:!0,propagateToProps:!0},styleNumber:{createComponentOfType:"number",createStateVariable:"styleNumber",defaultValue:1,public:!0,fallBackToParentStateVariable:"styleNumber"},isResponse:{createPrimitiveOfType:"boolean",createStateVariable:"isResponse",defaultValue:!1,public:!0},newNamespace:{createPrimitiveOfType:"boolean",createStateVariable:"newNamespace",defaultValue:!1,public:!0}}}static returnSugarInstructions(){return[]}static returnChildGroups(){return[]}static get childGroups(){return this.hasOwnProperty("childGroupsData")?this.childGroupsData:(this.childGroupsData=this.returnChildGroups(),this.childGroupsData)}static get childGroupOfComponentType(){return this.hasOwnProperty("childGroupOfComponentTypeData")?this.childGroupOfComponentTypeData:(this.childGroupOfComponentTypeData={},this.childGroupOfComponentTypeData)}static get childGroupIndsByName(){if(this.hasOwnProperty("childGroupIndsByNameData"))return Object.assign({},this.childGroupIndsByNameData);this.childGroupIndsByNameData={};for(let[rs,ns]of this.childGroups.entries()){if(ns.group in this.childGroupIndsByNameData)throw Error(`Invalid childGroups for componentClass ${this.componentType}: ${ns} is repeated`);this.childGroupIndsByNameData[ns.group]=rs}return Object.assign({},this.childGroupIndsByNameData)}returnMatchedChildIndices(rs){let ns=[];for(let ss of rs){let os=this.childMatchesByGroup[ss];if(!os)return;ns.push(...os)}return ns.sort((ss,os)=>ss-os)}static returnStateVariableDefinitions(){let rs={};return rs.hidden={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},forRenderer:!0,returnDependencies:()=>({hide:{dependencyType:"stateVariable",variableName:"hide",variablesOptional:!0},parentHidden:{dependencyType:"parentStateVariable",variableName:"hidden"},sourceCompositeHidden:{dependencyType:"sourceCompositeStateVariable",variableName:"hidden"},adapterSourceHidden:{dependencyType:"adapterSourceStateVariable",variableName:"hidden"}}),definition:({dependencyValues:ns})=>({setValue:{hidden:!!(ns.parentHidden||ns.sourceCompositeHidden||ns.adapterSourceHidden||ns.hide)}}),markStale:()=>({updateParentRenderedChildren:!0}),inverseDefinition({desiredStateVariableValues:ns}){return{success:!0,instructions:[{setDependency:"hide",desiredValue:ns.hidden}]}}},rs.disabled={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},forRenderer:!0,hasEssential:!0,doNotShadowEssential:!0,defaultValue:!1,provideEssentialValuesInDefinition:!0,returnDependencies:()=>({disabledAttr:{dependencyType:"attributeComponent",attributeName:"disabled",variableNames:["value"]},readOnly:{dependencyType:"flag",flagName:"readOnly"},parentDisabled:{dependencyType:"parentStateVariable",variableName:"disabled"},sourceCompositeDisabled:{dependencyType:"sourceCompositeStateVariable",variableName:"disabled"},adapterSourceDisabled:{dependencyType:"adapterSourceStateVariable",variableName:"disabled"}}),definition({dependencyValues:ns,usedDefault:ss,essentialValues:os}){if(ns.readOnly)return{setValue:{disabled:!0}};if(ns.disabledAttr!==null)return{setValue:{disabled:ns.disabledAttr.stateValues.value}};if(os.disabled!==void 0)return{useEssentialOrDefaultValue:{disabled:!0}};let ls=!1,us=!0;return ns.parentDisabled!==null&&!ss.parentDisabled&&(ls=ls||ns.parentDisabled,us=!1),ns.sourceCompositeDisabled!==null&&!ss.sourceCompositeDisabled&&(ls=ls||ns.sourceCompositeDisabled,us=!1),ns.adapterSourceDisabled!==null&&!ss.adapterSourceDisabled&&(ls=ls||ns.adapterSourceDisabled,us=!1),us?{useEssentialOrDefaultValue:{disabled:!0}}:{setValue:{disabled:ls}}},inverseDefinition({dependencyValues:ns,desiredStateVariableValues:ss}){return ns.disabledAttr!==null?{success:!0,instructions:[{setDependency:"disabledAttr",desiredValue:ss.disabled,variableIndex:0}]}:{success:!0,instructions:[{setEssentialValue:"disabled",value:ss.disabled}]}}},rs.fixed={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},forRenderer:!0,defaultValue:!1,hasEssential:!0,doNotShadowEssential:!0,ignoreFixed:!0,provideEssentialValuesInDefinition:!0,returnDependencies:()=>({fixedAttr:{dependencyType:"attributeComponent",attributeName:"fixed",variableNames:["value"]},parentFixed:{dependencyType:"parentStateVariable",variableName:"fixed"},sourceCompositeFixed:{dependencyType:"sourceCompositeStateVariable",variableName:"fixed"},adapterSourceFixed:{dependencyType:"adapterSourceStateVariable",variableName:"fixed"},ignoreParentFixed:{dependencyType:"doenetAttribute",attributeName:"ignoreParentFixed"}}),definition({dependencyValues:ns,usedDefault:ss,essentialValues:os}){if(ns.fixedAttr!==null)return{setValue:{fixed:ns.fixedAttr.stateValues.value}};if(os.fixed!==void 0)return{useEssentialOrDefaultValue:{fixed:!0}};let ls=!1,us=!0;return ns.parentFixed!==null&&!ss.parentFixed&&!ns.ignoreParentFixed&&(ls=ls||ns.parentFixed,us=!1),ns.sourceCompositeFixed!==null&&!ss.sourceCompositeFixed&&(ls=ls||ns.sourceCompositeFixed,us=!1),ns.adapterSourceFixed!==null&&!ss.adapterSourceFixed&&(ls=ls||ns.adapterSourceFixed,us=!1),us?{useEssentialOrDefaultValue:{fixed:!0}}:{setValue:{fixed:ls}}},inverseDefinition({dependencyValues:ns,desiredStateVariableValues:ss}){return ns.fixedAttr!==null?{success:!0,instructions:[{setDependency:"fixedAttr",desiredValue:ss.fixed,variableIndex:0}]}:{success:!0,instructions:[{setEssentialValue:"fixed",value:ss.fixed}]}}},rs.isInactiveCompositeReplacement={defaultValue:!1,hasEssential:!0,returnDependencies:()=>({}),definition:()=>({useEssentialOrDefaultValue:{isInactiveCompositeReplacement:!0}}),inverseDefinition({desiredStateVariableValues:ns}){return{success:!0,instructions:[{setEssentialValue:{variableName:"isInactiveCompositeReplacement",value:ns.isInactiveCompositeReplacement}}]}}},rs.doenetML={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({doenetML:{dependencyType:"doenetML"}}),definition({dependencyValues:ns}){let ss=ns.doenetML;return ss||(ss=""),{setValue:{doenetML:ss}}}},rs}static returnNormalizedStateVariableDefinitions({attributeNames:rs,numerics:ns}){let ss=this.returnStateVariableDefinitions({attributeNames:rs,numerics:ns});if(!ss)throw Error(`Error in state variable definitions of ${this.componentType}: returnStateVariableDefinitions did not return anything`);let os=function(cs){for(let[ds,ps]of cs.entries())typeof ps=="object"&&(cs[ds]=ps.variableName)},ls=["returnDependencies","definition","inverseDefinition","stateVariablesDeterminingDependencies","stateVariablesDeterminingArraySizeDependencies","isArray","nDimensions","returnArraySizeDependencies","returnArraySize","returnArrayDependenciesByKey","arrayDefinitionByKey","inverseArrayDefinitionByKey","basedOnArrayKeyStateVariables","markStale","getPreviousDependencyValuesForMarkStale","determineDependenciesImmediately","createWorkspace","workspace","provideEssentialValuesInDefinition","providePreviousValuesInDefinition"],us={};for(let cs in ss){let ds=ss[cs];if(us[cs]=ds,ds.createWorkspace&&(ds.workspace={}),ds.additionalStateVariablesDefined){for(let[ps,fs]of ds.additionalStateVariablesDefined.entries()){let hs={};for(let ys of ls)ys in ds&&(hs[ys]=ds[ys]);hs.additionalStateVariablesDefined=[...ds.additionalStateVariablesDefined],hs.additionalStateVariablesDefined[ps]=cs,os(hs.additionalStateVariablesDefined);let gs=fs;typeof fs=="object"&&(gs=fs.variableName,fs=Object.assign({},fs),delete fs.variableName,Object.assign(hs,fs)),us[gs]=hs}os(ds.additionalStateVariablesDefined)}}return us}static returnStateVariableInfo({onlyPublic:rs=!1,onlyForRenderer:ns=!1}={}){var ds,ps;let ss=this.createAttributesObject(),os={},ls={},us={};for(let fs in ss){let hs=ss[fs],gs=hs.createStateVariable;if(gs&&(!rs||hs.public)&&(!ns||hs.forRenderer))if(hs.public){let ys=!hs.createComponentOfType,bs;ys?(bs=hs.createPrimitiveOfType,bs==="string"&&(bs="text")):bs=hs.createComponentOfType,os[gs]={createComponentOfType:bs,public:!0}}else os[gs]={}}let cs=this.returnNormalizedStateVariableDefinitions({attributeNames:Object.keys(os)});for(let fs in cs){let hs=cs[fs];if(hs.isAlias){us[fs]=hs.targetVariableName;continue}if((!rs||hs.public)&&(!ns||hs.forRenderer)&&(hs.public?os[fs]={createComponentOfType:hs.shadowingInstructions.createComponentOfType,public:!0}:os[fs]={},hs.isArray)){os[fs].isArray=!0,os[fs].nDimensions=hs.nDimensions===void 0?1:hs.nDimensions,os[fs].wrappingComponents=(ds=hs.shadowingInstructions)!=null&&ds.returnWrappingComponents?hs.shadowingInstructions.returnWrappingComponents():[];let gs;hs.entryPrefixes?gs=hs.entryPrefixes:gs=[fs];for(let ys of gs)ls[ys]={arrayVariableName:fs,nDimensions:hs.returnEntryDimensions?hs.returnEntryDimensions(ys):1,wrappingComponents:(ps=hs.shadowingInstructions)!=null&&ps.returnWrappingComponents?hs.shadowingInstructions.returnWrappingComponents(ys):[]};hs.getArrayKeysFromVarName?os[fs].getArrayKeysFromVarName=hs.getArrayKeysFromVarName:os[fs].getArrayKeysFromVarName=returnDefaultGetArrayKeysFromVarName(os[fs].nDimensions)}}return{stateVariableDescriptions:os,arrayEntryPrefixes:ls,aliases:us}}get parentName(){if(!(this.ancestors===void 0||this.ancestors.length===0))return this.ancestors[0].componentName}getAllChildrenDownstreamComponentNames(rs=!1){const ns=Object.keys(this.allChildren);let ss=Object.keys(this.downstreamDependencies);return rs!==!0&&(ss=ss.filter(os=>this.downstreamDependencies[os].inactive!==!0)),[...ns,...ss]}get allDescendants(){let rs=[];for(let ns in this.allChildren){let ss=this.allChildren[ns].component;rs=[...rs,ns,...ss.allDescendants]}return rs}async serialize(rs={}){let ns={componentType:this.componentType},ss=[],os={...rs},ls;rs.sourceAttributesToIgnoreRecursively?ls=[...rs.sourceAttributesToIgnoreRecursively]:ls=[],rs.sourceAttributesToIgnore&&(ls.push(...rs.sourceAttributesToIgnore),delete os.sourceAttributesToIgnore);{for(let us of this.definingChildren)typeof us!="object"?ss.push(us):ss.push(await us.serialize(os));if(this.serializedChildren!==void 0)for(let us of this.serializedChildren)ss.push(this.copySerializedComponent(us));ss.length>0&&(ns.children=ss)}ns.attributes={};for(let us in this.attributes){let cs=this.attributes[us];cs.component?rs.copyAll&&(ns.attributes[us]={component:await cs.component.serialize(os)}):(!ls.includes(us)||rs.copyAll)&&(ns.attributes[us]=JSON.parse(JSON.stringify(cs)))}return this.essentialState&&Object.keys(this.essentialState).length>0&&(ns.state=deepClone(this.essentialState)),rs.copyVariants&&this.state.generatedVariantInfo&&(ns.variants={desiredVariant:await this.stateValues.generatedVariantInfo}),ns.originalName=this.componentName,ns.originalDoenetAttributes=deepClone(this.doenetAttributes),ns.doenetAttributes=deepClone(this.doenetAttributes),ns.originalAttributes=deepClone(ns.attributes),delete ns.doenetAttributes.prescribedName,delete ns.doenetAttributes.assignNames,ns}copySerializedComponent(rs){if(typeof rs!="object")return rs;let ns=[];if(rs.children!==void 0)for(let os of rs.children)ns.push(this.copySerializedComponent(os));let ss={componentType:rs.componentType,originalName:rs.componentName,originalNameFromSerializedComponent:!0,children:ns,state:{},doenetAttributes:{}};return rs.doenetAttributes!==void 0&&(ss.originalDoenetAttributes=deepClone(rs.doenetAttributes),ss.doenetAttributes=deepClone(rs.doenetAttributes),ss.originalAttributes=deepClone(rs.attributes),ss.attributes=deepClone(rs.attributes),delete ss.doenetAttributes.prescribedName,delete ss.doenetAttributes.assignNames),rs.state!==void 0&&Object.assign(ss.state,rs.state),ss}static get nAdapters(){return this.adapters.length}getAdapter(rs){if(rs>=this.constructor.adapters.length)return;let ns=this.constructor.adapters[rs],ss,os,ls,us;typeof ns=="string"?ss=ns:(ss=ns.stateVariable,os=ns.componentType,ls=ns.substituteForPrimaryStateVariable,us=ns.stateVariablesToShadow);let cs=this.state[ss];if(cs===void 0||!cs.public&&!os)throw Error("Invalid adapter "+ss+" in "+this.componentType);return os===void 0&&(os=cs.shadowingInstructions.createComponentOfType),{componentType:os,downstreamDependencies:{[this.componentName]:[{dependencyType:"adapter",adapterVariable:ss,adapterTargetIdentity:{componentName:this.componentName,componentType:this.componentType},substituteForPrimaryStateVariable:ls,stateVariablesToShadow:us}]}}}static getAdapterComponentType(rs,ns){if(rs>=this.adapters.length)return;let ss=this.adapters[rs],os,ls;if(typeof ss=="string"?os=ss:(os=ss.stateVariable,ls=ss.componentType),ls===void 0){let cs=ns[this.componentType].stateVariableDescriptions[os];if(!cs)throw Error("Invalid adapter "+os+" in "+this.componentType);if(ls=cs.createComponentOfType,!ls)throw Error(`Couldn't get adapter component type for ${os} of componentType ${this.componentType}`)}return ls}static determineNumberOfUniqueVariants({serializedComponent:rs,componentInfoObjects:ns}){var us;let ss=(us=rs.variants)==null?void 0:us.numberOfVariants;if(ss!==void 0)return{success:!0,numberOfVariants:ss};let os=[];rs.children&&(os=gatherVariantComponents({serializedComponents:rs.children,componentInfoObjects:ns})),rs.variants===void 0&&(rs.variants={}),rs.variants.descendantVariantComponents=os,ss=1;let ls=[];for(let cs of os){let ps=ns.allComponentClasses[cs.componentType].determineNumberOfUniqueVariants({serializedComponent:cs,componentInfoObjects:ns});if(!ps.success)return{success:!1};ls.push(ps.numberOfVariants),ss*=ps.numberOfVariants}return rs.variants.numberOfVariants=ss,rs.variants.uniqueVariantData={numberOfVariantsByDescendant:ls},{success:!0,numberOfVariants:ss}}static getUniqueVariant({serializedComponent:rs,variantIndex:ns,componentInfoObjects:ss}){var fs;let os=(fs=rs.variants)==null?void 0:fs.numberOfVariants;if(os===void 0)return{success:!1};if(!Number.isInteger(ns)||ns<1||ns>os)return{success:!1};let ls=!1,us=rs.variants.uniqueVariantData.numberOfVariantsByDescendant,cs=rs.variants.descendantVariantComponents,ds=[];if(cs.length>0){let hs=enumerateCombinations({numberOfOptionsByIndex:us,maxNumber:ns})[ns-1].map(gs=>gs+1);for(let gs=0;gs1){let ys=cs[gs],vs=ss.allComponentClasses[ys.componentType].getUniqueVariant({serializedComponent:ys,variantIndex:hs[gs],componentInfoObjects:ss});if(!vs.success)return{success:!1};ds.push(vs.desiredVariant),ls=!0}else ds.push({})}let ps={index:ns};return ls&&(ps.subvariants=ds),{success:!0,desiredVariant:ps}}async copyDoenetMLToClipboard({actionId:rs}){let ns=await this.stateValues.doenetML;ns?this.coreFunctions.copyToClipboard(ns,rs):this.coreFunctions.resolveAction({actionId:rs})}}zs(BaseComponent,"componentType","_base"),zs(BaseComponent,"childGroupOfComponentTypeData"),zs(BaseComponent,"childGroupIndsByNameData"),zs(BaseComponent,"adapters",[]);class InlineComponent extends BaseComponent{}zs(InlineComponent,"componentType","_inline");class Text extends InlineComponent{constructor(rs){super(rs),Object.assign(this.actions,{moveText:this.moveText.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.draggable={createComponentOfType:"boolean",createStateVariable:"draggable",defaultValue:!0,public:!0,forRenderer:!0},rs.layer={createComponentOfType:"number",createStateVariable:"layer",defaultValue:0,public:!0,forRenderer:!0},rs.anchor={createComponentOfType:"point"},rs.positionFromAnchor={createComponentOfType:"text",createStateVariable:"positionFromAnchor",defaultValue:"center",public:!0,forRenderer:!0,toLowerCase:!0,validValues:["upperright","upperleft","lowerright","lowerleft","top","bottom","left","right","center"]},rs.styleNumber.defaultValue=0,rs}static returnChildGroups(){return[{group:"textLike",componentTypes:["string","text","_singleCharacterInline","_inlineRenderInlineChildren"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions(),ns=returnSelectedStyleStateVariableDefinition();return Object.assign(rs,ns),rs.value={public:!0,shadowingInstructions:{createComponentOfType:this.componentType,addAttributeComponentsShadowingStateVariables:{fixed:{stateVariableToShadow:"fixed"}}},hasEssential:!0,returnDependencies:()=>({textLikeChildren:{dependencyType:"child",childGroups:["textLike"],variableNames:["text"]}}),defaultValue:"",set:ss=>ss===null?"":String(ss),definition:function({dependencyValues:ss}){if(ss.textLikeChildren.length===0)return{useEssentialOrDefaultValue:{value:!0}};let os="";for(let ls of ss.textLikeChildren)typeof ls=="string"?os+=ls:os+=ls.stateValues.text;return{setValue:{value:os}}},inverseDefinition:function({desiredStateVariableValues:ss,dependencyValues:os}){let ls=os.textLikeChildren.length;return ls>1?{success:!1}:ls===1?{success:!0,instructions:[{setDependency:"textLikeChildren",desiredValue:ss.value,childIndex:0,variableIndex:0}]}:{success:!0,instructions:[{setEssentialValue:"value",value:ss.value===null?"":String(ss.value)}]}}},rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},forRenderer:!0,returnDependencies:()=>({value:{dependencyType:"stateVariable",variableName:"value"}}),definition:({dependencyValues:ss})=>({setValue:{text:ss.value}}),inverseDefinition:({desiredStateVariableValues:ss})=>({success:!0,instructions:[{setDependency:"value",desiredValue:ss.text}]})},rs.anchor={defaultValue:Context.fromText("(0,0)"),public:!0,forRenderer:!0,hasEssential:!0,shadowingInstructions:{createComponentOfType:"point"},returnDependencies:()=>({anchorAttr:{dependencyType:"attributeComponent",attributeName:"anchor",variableNames:["coords"]}}),definition({dependencyValues:ss}){return ss.anchorAttr?{setValue:{anchor:ss.anchorAttr.stateValues.coords}}:{useEssentialOrDefaultValue:{anchor:!0}}},async inverseDefinition({desiredStateVariableValues:ss,dependencyValues:os,stateValues:ls,initialChange:us}){return us&&!await ls.draggable?{success:!1}:os.anchorAttr?{success:!0,instructions:[{setDependency:"anchorAttr",desiredValue:ss.anchor,variableIndex:0}]}:{success:!0,instructions:[{setEssentialValue:"anchor",value:ss.anchor}]}}},rs}async moveText({x:rs,y:ns,z:ss,transient:os,actionId:ls,sourceInformation:us={},skipRendererUpdate:cs=!1}){let ds=["vector"];return rs!==void 0&&(ds[1]=rs),ns!==void 0&&(ds[2]=ns),ss!==void 0&&(ds[3]=ss),os?await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"anchor",value:Context.fromAst(ds)}],transient:os,actionId:ls,sourceInformation:us,skipRendererUpdate:cs}):await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"anchor",value:Context.fromAst(ds)}],actionId:ls,sourceInformation:us,skipRendererUpdate:cs,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{x:rs,y:ns,z:ss}}})}}zs(Text,"componentType","text"),zs(Text,"includeBlankStringChildren",!0),zs(Text,"variableForPlainMacro","value"),zs(Text,"descendantCompositesMustHaveAReplacement",!1);class TextOrInline extends InlineComponent{static returnChildGroups(){return[{group:"inlines",componentTypes:["_inline"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.value={public:!0,shadowingInstructions:{createComponentOfType:this.componentType},returnDependencies:()=>({inlineChildren:{dependencyType:"child",childGroups:["inlines"],variableNames:["text"],variablesOptional:!0}}),definition:function({dependencyValues:ns}){let ss="";for(let os of ns.inlineChildren)typeof os!="object"?ss+=os.toString():typeof os.stateValues.text=="string"&&(ss+=os.stateValues.text);return{setValue:{value:ss}}}},rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({value:{dependencyType:"stateVariable",variableName:"value"}}),definition:({dependencyValues:ns})=>({setValue:{text:ns.value}})},rs}}zs(TextOrInline,"componentType","_textOrInline"),zs(TextOrInline,"renderChildren",!0),zs(TextOrInline,"rendererType","containerInline"),zs(TextOrInline,"includeBlankStringChildren",!0);class CompositeComponent extends BaseComponent{constructor(ns){super(ns);zs(this,"replacements",[]);zs(this,"replacementsToWithhold",0);this.replacementsWorkspace={}}static returnStateVariableDefinitions(){let ns=super.returnStateVariableDefinitions();return ns.replacements={returnDependencies:()=>({replacements:{dependencyType:"replacement"}}),definition:({dependencyValues:ss})=>({setValue:{replacements:ss.replacements}})},ns.recursiveReplacements={returnDependencies:()=>({recursiveReplacements:{dependencyType:"replacement",recursive:!0}}),definition:({dependencyValues:ss})=>({setValue:{recursiveReplacements:ss.recursiveReplacements}})},ns.fullRecursiveReplacements={returnDependencies:()=>({recursiveReplacements:{dependencyType:"replacement",recursive:!0,recurseNonStandardComposites:!0}}),definition:({dependencyValues:ss})=>({setValue:{fullRecursiveReplacements:ss.recursiveReplacements}})},ns}static createSerializedReplacements(){return{replacements:[]}}static calculateReplacementChanges(){return[]}get allPotentialRendererTypes(){let ns=super.allPotentialRendererTypes;for(let ss in this.allChildren){let os=this.allChildren[ss].component;for(let ls of os.allPotentialRendererTypes)ns.includes(ls)||ns.push(ls)}if(this.replacements){for(let ss of this.replacements)if(typeof ss=="object")for(let os of ss.allPotentialRendererTypes)ns.includes(os)||ns.push(os)}return ns}}zs(CompositeComponent,"componentType","_composite"),zs(CompositeComponent,"rendererType");function postProcessCopy({serializedComponents:as,componentName:rs,addShadowDependencies:ns=!0,markAsPrimaryShadow:ss=!1,uniqueIdentifiersUsed:os=[],identifierPrefix:ls="",unlinkExternalCopies:us=!1,copiesByTargetComponentName:cs={},componentNamesFound:ds=[],assignNamesFound:ps=[],activeAliases:fs=[],init:hs=!0}){var gs;for(let ys in as){let bs=as[ys];if(typeof bs!="object")continue;let vs;if(bs.originalName){if(us){if(ds.push(bs.originalName),bs.originalDoenetAttributes&&bs.originalDoenetAttributes.assignNames){let xs;if((gs=bs.attributes.newNamespace)!=null&&gs.primitive)xs=bs.originalName;else{let Cs=bs.originalName.lastIndexOf("/");xs=bs.originalName.substring(0,Cs)}for(let Cs of bs.originalDoenetAttributes.assignNames)ds.push(xs+"/"+Cs),ps.push(xs+"/"+Cs)}bs.attributes&&(bs.attributes.alias&&fs.push(bs.attributes.alias.primitive),bs.attributes.indexAlias&&fs.push(bs.attributes.indexAlias.primitive))}if(vs=ls+bs.originalName+"|shadow",!bs.originalNameFromSerializedComponent)if(ns){let xs={[bs.originalName]:[{dependencyType:"referenceShadow",compositeName:rs}]};if(hs&&(xs[bs.originalName][0].firstLevelReplacement=!0),ss&&(xs[bs.originalName][0].isPrimaryShadow=!0),bs.state){let Cs=Object.keys(bs.state);xs[bs.originalName].downstreamStateVariables=Cs,xs[bs.originalName].upstreamStateVariables=Cs}bs.downstreamDependencies=xs}else bs.unlinkedCopySource=bs.originalName}else vs=ls+bs.componentType+"|shadowUnnamed";if(bs.componentType==="copy"&&us){let xs=bs.doenetAttributes.targetComponentName;if(xs)fs.includes(bs.doenetAttributes.target)?bs.doenetAttributes.targetComponentName=bs.doenetAttributes.target:(cs[xs]===void 0&&(cs[xs]=[]),cs[xs].push(bs));else if(!bs.attributes.uri)throw Error("we need to create a targetComponentName here, then.")}bs.uniqueIdentifier=getUniqueIdentifierFromBase(vs,os)}for(let ys in as){let bs=as[ys];if(typeof bs=="object"){postProcessCopy({serializedComponents:bs.children,componentName:rs,addShadowDependencies:ns,markAsPrimaryShadow:ss,uniqueIdentifiersUsed:os,identifierPrefix:ls,unlinkExternalCopies:us,copiesByTargetComponentName:cs,componentNamesFound:ds,assignNamesFound:ps,activeAliases:[...fs],init:!1});for(let vs in bs.attributes){let xs=bs.attributes[vs];xs.component&&(xs.component=postProcessCopy({serializedComponents:[xs.component],componentName:rs,addShadowDependencies:ns,markAsPrimaryShadow:ss,uniqueIdentifiersUsed:os,identifierPrefix:ls,unlinkExternalCopies:us,copiesByTargetComponentName:cs,componentNamesFound:ds,assignNamesFound:ps,activeAliases:[...fs],init:!1})[0])}bs.replacements&&postProcessCopy({serializedComponents:bs.replacements,componentName:rs,addShadowDependencies:ns,markAsPrimaryShadow:ss,uniqueIdentifiersUsed:os,identifierPrefix:ls,unlinkExternalCopies:us,copiesByTargetComponentName:cs,componentNamesFound:ds,assignNamesFound:ps,activeAliases:[...fs],init:!1})}}if(hs&&us){for(let ys in cs)if(!ds.includes(ys)){let bs=!1;for(let vs of ps){let xs=vs+"/",Cs=xs.length;if(ys.substring(0,Cs)===xs){bs=!0;break}}if(!bs)for(let vs of cs[ys])vs.attributes||(vs.attributes={}),vs.attributes.link={primitive:!1},vs.doenetAttributes.target=vs.doenetAttributes.targetComponentName}}return as}function convertAttributesForComponentType({attributes:as,componentType:rs,componentInfoObjects:ns,compositeAttributesObj:ss={},compositeCreatesNewNamespace:os,flags:ls}){var fs;let us=ns.allComponentClasses[rs],cs=us.createAttributesObject(),ds={};for(let hs in cs)ds[hs.toLowerCase()]=hs;let ps={};for(let hs in as){if(hs in ss&&!ss[hs].leaveRaw)continue;let gs=ds[hs.toLowerCase()],ys=cs[gs];if(ys){if(gs in ps)throw Error(`Cannot repeat prop ${gs}`);if(ps[gs]=componentFromAttribute({attrObj:ys,value:JSON.parse(JSON.stringify(as[hs])),componentInfoObjects:ns}),(fs=ps[gs].component)!=null&&fs.children){let bs=[ps[gs].component];if(applyMacros(bs,ns),removeBlankStringChildren(bs,ns),applySugar({serializedComponents:bs,componentInfoObjects:ns,isAttributeComponent:!0}),os){for(let vs of ps[gs].component.children)if(vs.componentType==="copy"){let xs=vs.doenetAttributes.target;/[a-zA-Z_]/.test(xs[0])&&(vs.doenetAttributes.target="../"+xs)}}}}else us.acceptAnyAttribute&&(ps[hs]=JSON.parse(JSON.stringify(as[hs])))}return ps}async function verifyReplacementsMatchSpecifiedType({component:as,replacements:rs,replacementChanges:ns,assignNames:ss,workspace:os={},componentInfoObjects:ls,compositeAttributesObj:us,flags:cs}){var gs,ys,bs,vs,xs;if(!((gs=as.attributes.createComponentOfType)!=null&&gs.primitive)&&!as.sharedParameters.compositesMustHaveAReplacement)return{replacements:rs,replacementChanges:ns};let ds=as.replacementsToWithhold,ps;if(!ns)ls.isInheritedComponentType({inheritedComponentType:as.componentType,baseComponentType:"template"})&&(rs=rs.filter(Cs=>Cs.componentType||Cs.trim().length>0)),ps=rs.map(Cs=>Cs.componentType),ps.length===1&&ps[0]==="externalContent"&&(ps=rs[0].children.filter(Cs=>Cs.componentType||Cs.trim().length>0).map(Cs=>Cs.componentType));else{ps=as.replacements.map(Cs=>Cs.componentType);for(let Cs of ns)if(Cs.changeType==="add"){if(Cs.replacementsToWithhold!==void 0&&(ds=Cs.replacementsToWithhold),!Cs.changeTopLevelReplacements)continue;if(Cs.serializedReplacements){let Ts=Cs.numberReplacementsToReplace;Ts>0||(Ts=0);let Ss=Cs.firstReplacementInd,Ns=Cs.serializedReplacements.map(As=>As.componentType);ps.splice(Ss,Ts,...Ns)}}else if(Cs.changeType==="delete"){if(Cs.replacementsToWithhold!==void 0&&(ds=Cs.replacementsToWithhold),Cs.changeTopLevelReplacements){let Ts=Cs.firstReplacementInd,Ss=Cs.numberReplacementsToDelete;ps.splice(Ts,Ss)}}else Cs.changeType==="changeReplacementsToWithhold"&&Cs.replacementsToWithhold!==void 0&&(ds=Cs.replacementsToWithhold)}if(ds>0&&(ps=ps.slice(0,ps.length-ds)),!((ys=as.attributes.createComponentOfType)!=null&&ys.primitive)&&as.sharedParameters.compositesMustHaveAReplacement&&ps.length>0)return{replacements:rs,replacementChanges:ns};let fs=(bs=as.attributes.createComponentOfType)==null?void 0:bs.primitive,hs=await as.stateValues.nComponentsSpecified;if(!fs){if(fs=as.sharedParameters.compositesDefaultReplacementType,!fs)throw Error("A component class specified descendantCompositesMustHaveAReplacement but didn't specify descendantCompositesDefaultReplacementType");hs=1}if(fs=ls.componentTypeLowerCaseMapping[fs.toLowerCase()],ps.length!==hs||!ps.every(Cs=>Cs===fs)){if((rs==null?void 0:rs.length)===1&&ls.isInheritedComponentType({inheritedComponentType:rs[0].componentType,baseComponentType:"template"}))return rs[0].attributes||(rs[0].attributes={}),rs[0].attributes.createComponentOfType={primitive:fs},rs[0].attributes.nComponents={primitive:hs},{replacements:rs,replacementChanges:ns};let Cs=ps.length===hs&&!(ds>0)&&((vs=os.sourceNames)==null?void 0:vs.length)===hs,Ts;Cs&&ns&&(ns.length===1&&ns[0].numberReplacementsToReplace===hs?Ts=ns[0].serializedReplacements:Cs=!1),Cs?Ts||(Ts=rs):(os.numReplacementsBySource=[],os.numNonStringReplacementsBySource=[],os.propVariablesCopiedBySource=[],os.sourceNames=[],os.uniqueIdentifiersUsedBySource={},os.uniqueIdentifiersUsedBySource[0]=[]);let Ss=(xs=as.attributes.newNamespace)==null?void 0:xs.primitive;rs=[];for(let As=0;Astypeof As!="string").length),ns){ns=[],as.replacementsToWithhold>0&&ns.push({changeType:"changeReplacementsToWithhold",replacementsToWithhold:0});let As=0;as.replacements&&(As=as.replacements.length),ns.push({changeType:"add",changeTopLevelReplacements:!0,firstReplacementInd:0,numberReplacementsToReplace:As,serializedReplacements:rs})}}return{replacements:rs,replacementChanges:ns}}class Template extends CompositeComponent{static keepChildrenSerialized({serializedComponent:rs}){return rs.children===void 0?[]:Object.keys(rs.children)}static createAttributesObject(){let rs=super.createAttributesObject();return rs.rendered={createComponentOfType:"boolean",createStateVariable:"rendered",defaultValue:this.renderedDefault,public:!0},rs.isResponse={leaveRaw:!0},rs.createComponentOfType={createPrimitiveOfType:"string"},rs.nComponents={createPrimitiveOfType:"number"},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions(),ns=this;return rs.serializedChildren={returnDependencies:()=>({serializedChildren:{dependencyType:"serializedChildren",doNotProxy:!0}}),definition:function({dependencyValues:ss}){return{setValue:{serializedChildren:ss.serializedChildren}}}},rs.newNamespace={returnDependencies:()=>({newNamespace:{dependencyType:"attributePrimitive",attributeName:"newNamespace"}}),definition({dependencyValues:ss}){return{setValue:{newNamespace:ss.newNamespace}}}},rs.readyToExpandWhenResolved={returnDependencies:()=>({}),definition:function(){return{setValue:{readyToExpandWhenResolved:!0}}}},rs.isVariantComponent={returnDependencies:()=>({}),definition:()=>({setValue:{isVariantComponent:!0}})},rs.generatedVariantInfo={returnDependencies:({sharedParameters:ss,componentInfoObjects:os})=>({variantSeed:{dependencyType:"value",value:ss.variantSeed},variantDescendants:{dependencyType:"descendant",componentTypes:Object.keys(os.componentTypesCreatingVariants),variableNames:["isVariantComponent","generatedVariantInfo"],useReplacementsForComposites:!0,recurseToMatchedChildren:!1,variablesOptional:!0,includeNonActiveChildren:!0,ignoreReplacementsOfEncounteredComposites:!0}}),definition({dependencyValues:ss,componentName:os}){let ls={seed:ss.variantSeed,meta:{createdBy:os}},us=ls.subvariants=[];for(let cs of ss.variantDescendants)cs.stateValues.isVariantComponent?us.push(cs.stateValues.generatedVariantInfo):cs.stateValues.generatedVariantInfo&&us.push(...cs.stateValues.generatedVariantInfo.subvariants);return{setValue:{generatedVariantInfo:ls}}}},rs.nComponentsSpecified={returnDependencies:()=>({nComponentsAttr:{dependencyType:"attributePrimitive",attributeName:"nComponents"},typeAttr:{dependencyType:"attributePrimitive",attributeName:"createComponentOfType"}}),definition({dependencyValues:ss,componentInfoObjects:os}){let ls;if(ss.typeAttr){if(!(os.componentTypeLowerCaseMapping[ss.typeAttr.toLowerCase()]in os.allComponentClasses))throw Error(`Invalid componentType ${ss.typeAttr} of copy.`);ss.nComponentsAttr!==null?ls=ss.nComponentsAttr:ls=1}else{if(ss.nComponentsAttr!==null)throw Error(`You must specify createComponentOfType when specifying nComponents for a ${ns.componentType}.`);ls=null}return{setValue:{nComponentsSpecified:ls}}}},rs}static async createSerializedReplacements({component:rs,componentInfoObjects:ns,alwaysCreateReplacements:ss,flags:os}){var ls;if(await rs.stateValues.nComponentsSpecified,await rs.stateValues.rendered||ss){let us=deepClone(await rs.state.serializedChildren.value),cs=(ls=rs.attributes.newNamespace)==null?void 0:ls.primitive;if("isResponse"in rs.attributes)for(let fs of us){if(typeof fs!="object")continue;let hs=convertAttributesForComponentType({attributes:{isResponse:rs.attributes.isResponse},componentType:fs.componentType,componentInfoObjects:ns,compositeCreatesNewNamespace:cs,flags:os});fs.attributes||(fs.attributes={}),Object.assign(fs.attributes,hs)}let ds=processAssignNames({assignNames:rs.doenetAttributes.assignNames,serializedComponents:us,parentName:rs.componentName,parentCreatesNewNamespace:cs,componentInfoObjects:ns,originalNamesAreConsistent:!0});return{replacements:(await verifyReplacementsMatchSpecifiedType({component:rs,replacements:ds.serializedComponents,assignNames:rs.doenetAttributes.assignNames,componentInfoObjects:ns,compositeAttributesObj:this.createAttributesObject(),flags:os})).replacements}}else return{replacements:[]}}static setUpVariant({serializedComponent:rs,sharedParameters:ns,descendantVariantComponents:ss}){setUpVariantSeedAndRng({serializedComponent:rs,sharedParameters:ns,descendantVariantComponents:ss,useSubpartVariantRng:!0})}get allPotentialRendererTypes(){let rs=super.allPotentialRendererTypes,ns=this.potentialRendererTypesFromSerializedComponents(this.serializedChildren);for(let ss of ns)rs.includes(ss)||rs.push(ss);return rs}}zs(Template,"componentType","template"),zs(Template,"treatAsComponentForRecursiveReplacements",!0),zs(Template,"includeBlankStringChildren",!0),zs(Template,"renderedDefault",!1),zs(Template,"assignNamesToReplacements",!0),zs(Template,"createsVariants",!0);const vectorAndListOperators=["list",...vectorOperators];class MathComponent extends InlineComponent{constructor(rs){super(rs),Object.assign(this.actions,{moveMath:this.moveMath.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.format={createComponentOfType:"text",createStateVariable:"format",defaultValue:"text",public:!0,toLowerCase:!0,validValues:["text","latex"]},rs.simplify={createComponentOfType:"text",createStateVariable:"simplify",defaultValue:"none",public:!0,toLowerCase:!0,valueTransformations:{"":"full",true:"full",false:"none"},validValues:["none","full","numbers","numberspreserveorder"]},rs.expand={createComponentOfType:"boolean",createStateVariable:"expand",defaultValue:!1,public:!0},rs.displayDigits={createComponentOfType:"integer"},rs.displayDecimals={createComponentOfType:"integer"},rs.displaySmallAsZero={createComponentOfType:"number",valueForTrue:1e-14,valueForFalse:0},rs.padZeros={createComponentOfType:"boolean"},rs.renderMode={createComponentOfType:"text",createStateVariable:"renderMode",defaultValue:"inline",public:!0,forRenderer:!0},rs.unordered={createComponentOfType:"boolean"},rs.createVectors={createComponentOfType:"boolean",createStateVariable:"createVectors",defaultValue:!1,public:!0},rs.createIntervals={createComponentOfType:"boolean",createStateVariable:"createIntervals",defaultValue:!1,public:!0},rs.functionSymbols={createComponentOfType:"textList",createStateVariable:"functionSymbols",defaultValue:["f","g"],public:!0},rs.sourcesAreFunctionSymbols={createComponentOfType:"textList",createStateVariable:"sourcesAreFunctionSymbols",defaultValue:[]},rs.splitSymbols={createComponentOfType:"boolean",createStateVariable:"splitSymbols",defaultValue:!0,public:!0,fallBackToParentStateVariable:"splitSymbols"},rs.parseScientificNotation={createComponentOfType:"boolean",createStateVariable:"parseScientificNotation",defaultValue:!1,public:!0,fallBackToParentStateVariable:"parseScientificNotation"},rs.groupCompositeReplacements={createPrimitiveOfType:"boolean",createStateVariable:"groupCompositeReplacements",defaultValue:!0},rs.displayBlanks={createComponentOfType:"boolean",createStateVariable:"displayBlanks",defaultValue:!0,public:!0},rs.draggable={createComponentOfType:"boolean",createStateVariable:"draggable",defaultValue:!0,public:!0,forRenderer:!0},rs.layer={createComponentOfType:"number",createStateVariable:"layer",defaultValue:0,public:!0,forRenderer:!0},rs.anchor={createComponentOfType:"point"},rs.positionFromAnchor={createComponentOfType:"text",createStateVariable:"positionFromAnchor",defaultValue:"center",public:!0,forRenderer:!0,toLowerCase:!0,validValues:["upperright","upperleft","lowerright","lowerleft","top","bottom","left","right","center"]},rs.styleNumber.defaultValue=0,rs}static returnChildGroups(){return[{group:"maths",componentTypes:["math"]},{group:"strings",componentTypes:["string"]},{group:"displayedMaths",componentTypes:["m","me","men"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions(),ns=returnSelectedStyleStateVariableDefinition();return Object.assign(rs,ns),rs.displayDigits={public:!0,shadowingInstructions:{createComponentOfType:"integer"},hasEssential:!0,defaultValue:10,returnDependencies:()=>({mathListParentDisplayDigits:{dependencyType:"parentStateVariable",parentComponentType:"mathList",variableName:"displayDigits"},numberListParentDisplayDigits:{dependencyType:"parentStateVariable",parentComponentType:"numberList",variableName:"displayDigits"},mathListParentDisplayDecimals:{dependencyType:"parentStateVariable",parentComponentType:"mathList",variableName:"displayDecimals"},numberListParentDisplayDecimals:{dependencyType:"parentStateVariable",parentComponentType:"numberList",variableName:"displayDecimals"},displayDigitsAttr:{dependencyType:"attributeComponent",attributeName:"displayDigits",variableNames:["value"]},displayDecimalsAttr:{dependencyType:"attributeComponent",attributeName:"displayDecimals",variableNames:["value"]},mathChildren:{dependencyType:"child",childGroups:["maths"],variableNames:["displayDigits"]},stringChildren:{dependencyType:"child",childGroups:["strings"]}}),definition({dependencyValues:ss,usedDefault:os}){let ls=!1,us;if(ss.mathListParentDisplayDigits!==null)if(os.mathListParentDisplayDigits)ls=!0,us=ss.mathListParentDisplayDigits;else return{setValue:{displayDigits:ss.mathListParentDisplayDigits}};if(ss.numberListParentDisplayDigits!==null)if(os.numberListParentDisplayDigits)ls=!0,us=ss.numberListParentDisplayDigits;else return{setValue:{displayDigits:ss.numberListParentDisplayDigits}};let cs=ss.numberListParentDisplayDecimals!==null&&!os.numberListParentDisplayDecimals||ss.mathListParentDisplayDecimals!==null&&!os.mathListParentDisplayDecimals,ds=ss.displayDigitsAttr===null||os.displayDigitsAttr,ps=ss.displayDecimalsAttr===null||os.displayDecimalsAttr;if(!(ds||ps)){let fs=ss.displayDigitsAttr.shadowDepth;ss.displayDecimalsAttr.shadowDepth({mathListParentDisplayDecimals:{dependencyType:"parentStateVariable",parentComponentType:"mathList",variableName:"displayDecimals"},numberListParentDisplayDecimals:{dependencyType:"parentStateVariable",parentComponentType:"numberList",variableName:"displayDecimals"},displayDecimalsAttr:{dependencyType:"attributeComponent",attributeName:"displayDecimals",variableNames:["value"]},mathChildren:{dependencyType:"child",childGroups:["maths"],variableNames:["displayDecimals"]},stringChildren:{dependencyType:"child",childGroups:["strings"]}}),definition({dependencyValues:ss,usedDefault:os}){let ls=!1,us;if(ss.mathListParentDisplayDecimals!==null)if(os.mathListParentDisplayDecimals)ls=!0,us=ss.mathListParentDisplayDecimals;else return{setValue:{displayDecimals:ss.mathListParentDisplayDecimals}};if(ss.numberListParentDisplayDecimals!==null)if(os.numberListParentDisplayDecimals)ls=!0,us=ss.numberListParentDisplayDecimals;else return{setValue:{displayDecimals:ss.numberListParentDisplayDecimals}};if(ss.displayDecimalsAttr!==null)if(os.displayDecimalsAttr)ls=!0,us=ss.displayDecimalsAttr.stateValues.value;else return{setValue:{displayDecimals:ss.displayDecimalsAttr.stateValues.value}};if(ss.mathChildren.length===1&&ss.stringChildren.length===0)if(os.mathChildren[0]&&os.mathChildren[0].displayDecimals)ls=!0,us=ss.mathChildren[0].stateValues.displayDecimals;else return{setValue:{displayDecimals:ss.mathChildren[0].stateValues.displayDecimals}};return ls?{useEssentialOrDefaultValue:{displayDecimals:{defaultValue:us}}}:{useEssentialOrDefaultValue:{displayDecimals:!0}}}},rs.displaySmallAsZero={public:!0,shadowingInstructions:{createComponentOfType:"number"},hasEssential:!0,defaultValue:0,returnDependencies:()=>({mathListParentDisplaySmallAsZero:{dependencyType:"parentStateVariable",parentComponentType:"mathList",variableName:"displaySmallAsZero"},numberListParentDisplaySmallAsZero:{dependencyType:"parentStateVariable",parentComponentType:"numberList",variableName:"displaySmallAsZero"},displaySmallAsZeroAttr:{dependencyType:"attributeComponent",attributeName:"displaySmallAsZero",variableNames:["value"]},mathChildren:{dependencyType:"child",childGroups:["maths"],variableNames:["displaySmallAsZero"]},stringChildren:{dependencyType:"child",childGroups:["strings"]}}),definition({dependencyValues:ss,usedDefault:os}){let ls=!1,us;if(ss.mathListParentDisplaySmallAsZero!==null)if(os.mathListParentDisplaySmallAsZero)ls=!0,us=ss.mathListParentDisplaySmallAsZero;else return{setValue:{displaySmallAsZero:ss.mathListParentDisplaySmallAsZero}};if(ss.numberListParentDisplaySmallAsZero!==null)if(os.numberListParentDisplaySmallAsZero)ls=!0,us=ss.numberListParentDisplaySmallAsZero;else return{setValue:{displaySmallAsZero:ss.numberListParentDisplaySmallAsZero}};if(ss.displaySmallAsZeroAttr!==null)if(os.displaySmallAsZeroAttr)ls=!0,us=ss.displaySmallAsZeroAttr.stateValues.value;else return{setValue:{displaySmallAsZero:ss.displaySmallAsZeroAttr.stateValues.value}};if(ss.mathChildren.length===1&&ss.stringChildren.length===0)if(os.mathChildren[0]&&os.mathChildren[0].displaySmallAsZero)ls=!0,us=ss.mathChildren[0].stateValues.displaySmallAsZero;else return{setValue:{displaySmallAsZero:ss.mathChildren[0].stateValues.displaySmallAsZero}};return ls?{useEssentialOrDefaultValue:{displaySmallAsZero:{defaultValue:us}}}:{useEssentialOrDefaultValue:{displaySmallAsZero:!0}}}},rs.padZeros={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},hasEssential:!0,defaultValue:!1,returnDependencies:()=>({mathListParentPadZeros:{dependencyType:"parentStateVariable",parentComponentType:"mathList",variableName:"padZeros"},numberListParentPadZeros:{dependencyType:"parentStateVariable",parentComponentType:"numberList",variableName:"padZeros"},padZerosAttr:{dependencyType:"attributeComponent",attributeName:"padZeros",variableNames:["value"]},displayDecimalsAttr:{dependencyType:"attributeComponent",attributeName:"displayDecimals",variableNames:["value"]},mathChildren:{dependencyType:"child",childGroups:["maths"],variableNames:["padZeros"]},stringChildren:{dependencyType:"child",childGroups:["strings"]}}),definition({dependencyValues:ss,usedDefault:os}){let ls=!1,us;if(ss.mathListParentPadZeros!==null)if(os.mathListParentPadZeros)ls=!0,us=ss.mathListParentPadZeros;else return{setValue:{padZeros:ss.mathListParentPadZeros}};if(ss.numberListParentPadZeros!==null)if(os.numberListParentPadZeros)ls=!0,us=ss.numberListParentPadZeros;else return{setValue:{padZeros:ss.numberListParentPadZeros}};if(ss.padZerosAttr!==null)if(os.padZerosAttr)ls=!0,us=ss.padZerosAttr.stateValues.value;else return{setValue:{padZeros:ss.padZerosAttr.stateValues.value}};if(ss.mathChildren.length===1&&ss.stringChildren.length==0)if(os.mathChildren[0]&&os.mathChildren[0].padZeros)ls=!0,us=ss.mathChildren[0].stateValues.padZeros;else return{setValue:{padZeros:ss.mathChildren[0].stateValues.padZeros}};return ls?{useEssentialOrDefaultValue:{padZeros:{defaultValue:us}}}:{useEssentialOrDefaultValue:{padZeros:!0}}}},rs.valueShadow={defaultValue:Context.fromAst("_"),hasEssential:!0,essentialVarName:"value",returnDependencies:()=>({}),definition:()=>({useEssentialOrDefaultValue:{valueShadow:!0}}),inverseDefinition:function({desiredStateVariableValues:ss}){return{success:!0,instructions:[{setEssentialValue:"valueShadow",value:ss.valueShadow}]}}},rs.unordered={defaultValue:!1,public:!0,shadowingInstructions:{createComponentOfType:"boolean"},hasEssential:!0,returnDependencies:()=>({unorderedAttr:{dependencyType:"attributeComponent",attributeName:"unordered",variableNames:["value"]},mathChildren:{dependencyType:"child",childGroups:["maths"],variableNames:["unordered"]}}),definition({dependencyValues:ss}){return ss.unorderedAttr===null?ss.mathChildren.length>0?{setValue:{unordered:ss.mathChildren.every(ls=>ls.stateValues.unordered)}}:{useEssentialOrDefaultValue:{unordered:!0}}:{setValue:{unordered:ss.unorderedAttr.stateValues.value}}}},rs.codePre={returnDependencies:()=>({stringChildren:{dependencyType:"child",childGroups:["strings"]}}),definition({dependencyValues:ss}){let os="math",ls=!1;do{ls=!1;for(let us of ss.stringChildren)if(us.includes(os)===!0){ls=!0,os+="m";break}}while(ls);return{setValue:{codePre:os}}}},rs.mathChildrenFunctionSymbols={returnDependencies:()=>({sourcesAreFunctionSymbols:{dependencyType:"stateVariable",variableName:"sourcesAreFunctionSymbols"},mathChildren:{dependencyType:"child",childGroups:["maths"]}}),definition({dependencyValues:ss}){let os=[];if(ss.mathChildren.compositeReplacementRange){for(let ls of ss.mathChildren.compositeReplacementRange)if(ss.sourcesAreFunctionSymbols.includes(ls.target))for(let us=ls.firstInd;us<=ls.lastInd;us++)os.push(us)}return{setValue:{mathChildrenFunctionSymbols:os}}}},rs.expressionWithCodes={hasEssential:!0,doNotShadowEssential:!0,returnDependencies:()=>({stringMathChildren:{dependencyType:"child",childGroups:["strings","maths"]},stringChildren:{dependencyType:"child",childGroups:["strings"]},mathChildren:{dependencyType:"child",childGroups:["maths"]},displayedMathChildren:{dependencyType:"child",childGroups:["displayedMaths"],variableNames:["latex"]},format:{dependencyType:"stateVariable",variableName:"format"},codePre:{dependencyType:"stateVariable",variableName:"codePre"},functionSymbols:{dependencyType:"stateVariable",variableName:"functionSymbols"},mathChildrenFunctionSymbols:{dependencyType:"stateVariable",variableName:"mathChildrenFunctionSymbols"},splitSymbols:{dependencyType:"stateVariable",variableName:"splitSymbols"},parseScientificNotation:{dependencyType:"stateVariable",variableName:"parseScientificNotation"},groupCompositeReplacements:{dependencyType:"stateVariable",variableName:"groupCompositeReplacements"}}),set:ss=>ss===null?null:convertValueToMathExpression(ss),definition:calculateExpressionWithCodes,async inverseDefinition({desiredStateVariableValues:ss,dependencyValues:os,stateValues:ls}){let us=ss.expressionWithCodes,cs=[{setEssentialValue:"expressionWithCodes",value:us}],ds=os.stringChildren.length;if(ds===0)return{success:!1};if(os.mathChildren.length===0){let ps;await ls.format==="latex"?ps=us.toLatex():ps=us.toString(),cs.push({setDependency:"stringChildren",desiredValue:ps,childIndex:0,variableIndex:0,ignoreChildChangeForComponent:!0});for(let fs=1;fs({mathChildren:{dependencyType:"child",childGroups:["maths"],variableNames:["value","canBeModified"]}}),definition:({dependencyValues:ss})=>({setValue:{mathChildrenWithCanBeModified:ss.mathChildren}})},rs.unnormalizedValue={returnDependencies:()=>({mathChildren:{dependencyType:"child",childGroups:["maths"],variableNames:["value"]},stringChildren:{dependencyType:"child",childGroups:["strings"],variableNames:["value"]},expressionWithCodes:{dependencyType:"stateVariable",variableName:"expressionWithCodes"},codePre:{dependencyType:"stateVariable",variableName:"codePre"},valueShadow:{dependencyType:"stateVariable",variableName:"valueShadow"}}),set:convertValueToMathExpression,defaultValue:Context.fromAst("_"),definition:calculateMathValue,inverseDefinition:invertMath},rs.value={public:!0,shadowingInstructions:{createComponentOfType:this.componentType,attributesToShadow:["unordered","displayDigits","displayDecimals","displaySmallAsZero","padZeros","simplify","expand"],addAttributeComponentsShadowingStateVariables:{fixed:{stateVariableToShadow:"fixed"}}},returnDependencies:()=>({unnormalizedValue:{dependencyType:"stateVariable",variableName:"unnormalizedValue"},simplify:{dependencyType:"stateVariable",variableName:"simplify"},expand:{dependencyType:"stateVariable",variableName:"expand"},createVectors:{dependencyType:"stateVariable",variableName:"createVectors"},createIntervals:{dependencyType:"stateVariable",variableName:"createIntervals"}}),definition:function({dependencyValues:ss}){let os=ss.unnormalizedValue,{simplify:ls,expand:us,createVectors:cs,createIntervals:ds}=ss;return os=normalizeMathExpression({value:os,simplify:ls,expand:us,createVectors:cs,createIntervals:ds}),{setValue:{value:os}}},inverseDefinition:function({desiredStateVariableValues:ss}){return{success:!0,instructions:[{setDependency:"unnormalizedValue",desiredValue:ss.value}]}}},rs.number={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"]},returnDependencies:()=>({value:{dependencyType:"stateVariable",variableName:"value"}}),definition:function({dependencyValues:ss}){return{setValue:{number:ss.value.evaluate_to_constant()}}},inverseDefinition:function({desiredStateVariableValues:ss}){return{success:!0,instructions:[{setDependency:"value",desiredValue:Context.fromAst(ss.number)}]}}},rs.isNumber={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},returnDependencies:()=>({value:{dependencyType:"stateVariable",variableName:"value"}}),definition:function({dependencyValues:ss}){return{setValue:{isNumber:Number.isFinite(ss.value.tree)}}}},rs.isNumeric={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},returnDependencies:()=>({number:{dependencyType:"stateVariable",variableName:"number"}}),definition:function({dependencyValues:ss}){return{setValue:{isNumeric:Number.isFinite(ss.number)}}}},rs.valueForDisplay={returnDependencies:()=>({value:{dependencyType:"stateVariable",variableName:"value"},displayDigits:{dependencyType:"stateVariable",variableName:"displayDigits"},displayDecimals:{dependencyType:"stateVariable",variableName:"displayDecimals"},displaySmallAsZero:{dependencyType:"stateVariable",variableName:"displaySmallAsZero"},simplify:{dependencyType:"stateVariable",variableName:"simplify"},expand:{dependencyType:"stateVariable",variableName:"expand"}}),definition:function({dependencyValues:ss,usedDefault:os}){let ls=roundForDisplay({value:ss.value,dependencyValues:ss,usedDefault:os});return{setValue:{valueForDisplay:normalizeMathExpression({value:ls,simplify:ss.simplify,expand:ss.expand})}}},inverseDefinition({desiredStateVariableValues:ss}){return{success:!0,instructions:[{setDependency:"value",desiredValue:ss.valueForDisplay}]}}},rs.latex={public:!0,forRenderer:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({valueForDisplay:{dependencyType:"stateVariable",variableName:"valueForDisplay"},padZeros:{dependencyType:"stateVariable",variableName:"padZeros"},displayDigits:{dependencyType:"stateVariable",variableName:"displayDigits"},displayDecimals:{dependencyType:"stateVariable",variableName:"displayDecimals"},displayBlanks:{dependencyType:"stateVariable",variableName:"displayBlanks"}}),definition:function({dependencyValues:ss,usedDefault:os}){let ls,us={};ss.padZeros&&(os.displayDigits&&!os.displayDecimals?Number.isFinite(ss.displayDecimals)&&(us.padToDecimals=ss.displayDecimals):ss.displayDigits>=1&&(us.padToDigits=ss.displayDigits)),ss.displayBlanks||(us.showBlanks=!1);try{ls=ss.valueForDisplay.toLatex(us)}catch{ss.displayBlanks?ls="_":ls=""}return{setValue:{latex:ls}}},inverseDefinition({desiredStateVariableValues:ss}){let os;try{os=Context.fromLatex(ss.latex)}catch{return{success:!1}}return{success:!0,instructions:[{setDependency:"valueForDisplay",desiredValue:os}]}}},rs.latexWithInputChildren={forRenderer:!0,returnDependencies:()=>({latex:{dependencyType:"stateVariable",variableName:"latex"}}),definition:function({dependencyValues:ss}){return{setValue:{latexWithInputChildren:[ss.latex]}}}},rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({valueForDisplay:{dependencyType:"stateVariable",variableName:"valueForDisplay"},padZeros:{dependencyType:"stateVariable",variableName:"padZeros"},displayDigits:{dependencyType:"stateVariable",variableName:"displayDigits"},displayDecimals:{dependencyType:"stateVariable",variableName:"displayDecimals"},value:{dependencyType:"stateVariable",variableName:"value"},displayBlanks:{dependencyType:"stateVariable",variableName:"displayBlanks"}}),definition:function({dependencyValues:ss,usedDefault:os}){let ls,us={};ss.padZeros&&(os.displayDigits&&!os.displayDecimals?Number.isFinite(ss.displayDecimals)&&(us.padToDecimals=ss.displayDecimals):ss.displayDigits>=1&&(us.padToDigits=ss.displayDigits)),ss.displayBlanks||(us.showBlanks=!1);try{ls=ss.valueForDisplay.toString(us)}catch{ss.displayBlanks?ls="_":ls=""}return{setValue:{text:superSubscriptsToUnicode(ls.toString())}}},async inverseDefinition({desiredStateVariableValues:ss,stateValues:os}){let ls=getFromText({functionSymbols:await os.functionSymbols,splitSymbols:await os.splitSymbols,parseScientificNotation:await os.parseScientificNotation}),us;try{us=ls(unicodeToSuperSubscripts(ss.text))}catch{return{success:!1}}return{success:!0,instructions:[{setDependency:"value",desiredValue:us}]}}},rs.codesAdjacentToStrings={returnDependencies:()=>({stringMathChildren:{dependencyType:"child",childGroups:["strings","maths"]},codePre:{dependencyType:"stateVariable",variableName:"codePre"},format:{dependencyType:"stateVariable",variableName:"format"}}),definition:calculateCodesAdjacentToStrings},rs.canBeModified={additionalStateVariablesDefined:["constantChildIndices","codeForExpression","inverseMaps","template","mathChildrenMapped"],returnDependencies:()=>({mathChildrenModifiable:{dependencyType:"child",childGroups:["maths"],variableNames:["canBeModified"]},displayedMathChildren:{dependencyType:"child",childGroups:["displayedMaths"]},expressionWithCodes:{dependencyType:"stateVariable",variableName:"expressionWithCodes"},modifyIndirectly:{dependencyType:"stateVariable",variableName:"modifyIndirectly"},fixed:{dependencyType:"stateVariable",variableName:"fixed"},codePre:{dependencyType:"stateVariable",variableName:"codePre"}}),definition:determineCanBeModified},rs.mathChildrenByVectorComponent={returnDependencies:()=>({codePre:{dependencyType:"stateVariable",variableName:"codePre"},mathChildren:{dependencyType:"child",childGroups:["maths"]},expressionWithCodes:{dependencyType:"stateVariable",variableName:"expressionWithCodes"}}),definition:function({dependencyValues:ss}){if(ss.expressionWithCodes===null)return{setValue:{mathChildrenByVectorComponent:null}};let os=ss.expressionWithCodes.tree,ls=ss.mathChildren.length;if(ls===0||!Array.isArray(os)||!vectorOperators.includes(os[0]))return{setValue:{mathChildrenByVectorComponent:null}};let us={},cs=0,ds=ss.codePre+cs;for(let ps=1;ps=ls)break}return{setValue:{mathChildrenByVectorComponent:us}}}},rs.nDimensions={public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies:()=>({value:{dependencyType:"stateVariable",variableName:"value"}}),definition({dependencyValues:ss}){let os=1,ls=ss.value.tree;if(Array.isArray(ls))if(vectorAndListOperators.includes(ls[0]))os=ls.length-1;else if(ls[0]==="matrix"){let us=ls[1].slice(1);us[0]===1?os=us[1]:us[1]===1&&(os=us[0])}else vectorOperators.includes(ls[1][0])&&(ls[0]==="^"&&ls[2]==="T"||ls[0]==="prime")&&(os=ls[1].length-1);return{setValue:{nDimensions:os}}}},rs.vector={public:!0,shadowingInstructions:{createComponentOfType:"math",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"],returnWrappingComponents(ss){return ss==="x"?[]:[["vector",{componentType:"mathList",isAttribute:"xs"}]]}},isArray:!0,entryPrefixes:["x"],returnArraySizeDependencies:()=>({nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),returnArraySize({dependencyValues:ss}){return[ss.nDimensions]},returnArrayDependenciesByKey(){return{globalDependencies:{value:{dependencyType:"stateVariable",variableName:"value"}}}},arrayDefinitionByKey({globalDependencyValues:ss,arraySize:os}){let ls=ss.value.tree,us=!1,cs={};if(Array.isArray(ls)){if(vectorAndListOperators.includes(ls[0])){for(let ds=0;dshs.tree)]);else if(ps[0]==="matrix"){let hs=ps[1].slice(1);if(hs[0]===1){let gs=["tuple"];for(let ys=0;yshs.tree)]],ps[2]&&ds.push(ps[2]),ds=Context.fromAst(ds));return ds||(ds=us.desiredVector[0]),{success:!0,instructions:[{setDependency:"value",desiredValue:ds}]}}},rs.x={isAlias:!0,targetVariableName:"x1"},rs.y={isAlias:!0,targetVariableName:"x2"},rs.z={isAlias:!0,targetVariableName:"x3"},rs.matrixSize={public:!0,shadowingInstructions:{createComponentOfType:"numberList"},returnDependencies:()=>({value:{dependencyType:"stateVariable",variableName:"value"}}),definition({dependencyValues:ss}){let os=[1,1],ls=ss.value.tree;return Array.isArray(ls)&&(vectorAndListOperators.includes(ls[0])?os=[ls.length-1,1]:ls[0]==="matrix"?os=ls[1].slice(1):vectorOperators.includes(ls[1][0])&&(ls[0]==="^"&&ls[2]==="T"||ls[0]==="prime")&&(os=[1,ls[1].length-1])),{setValue:{matrixSize:os}}}},rs.nRows={public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies:()=>({matrixSize:{dependencyType:"stateVariable",variableName:"matrixSize"}}),definition({dependencyValues:ss}){return{setValue:{nRows:ss.matrixSize[0]}}}},rs.nColumns={public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies:()=>({matrixSize:{dependencyType:"stateVariable",variableName:"matrixSize"}}),definition({dependencyValues:ss}){return{setValue:{nColumns:ss.matrixSize[1]}}}},rs.matrix={public:!0,shadowingInstructions:{createComponentOfType:"math",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"],returnWrappingComponents(ss){return ss==="matrixEntry"?[]:ss==="row"?[["matrix","matrixRow"]]:ss==="column"?[["matrix","matrixColumn"]]:[["matrixRow"],["matrix"]]}},isArray:!0,nDimensions:2,entryPrefixes:["matrixEntry","row","column","rows","columns"],getArrayKeysFromVarName({arrayEntryPrefix:ss,varEnding:os,arraySize:ls}){if(ss==="matrixEntry"){let us=os.split("_").map(cs=>Number(cs)-1);return us.length===2&&us.every(cs=>Number.isInteger(cs)&&cs>=0)?ls?us.every((cs,ds)=>cs=0?ls?usus+","+ds):[]:[us+",0"]:[]}else if(ss==="column"){let us=Number(os)-1;return Number.isInteger(us)&&us>=0?ls?usds+","+us):[]:["0,"+us]:[]}else if(ss==="rows"||ss==="columns"){if(!ls)return["0,0"];let us=[];for(let cs=0;cscs+","+ps));return us}},arrayVarNameFromPropIndex(ss,os){if(os==="matrix"||os==="rows")return ss.length===1?"row"+ss[0]:`matrixEntry${ss[0]}_${ss[1]}`;if(os==="columns")return ss.length===1?"column"+ss[0]:`matrixEntry${ss[1]}_${ss[0]}`;if(os.slice(0,3)==="row"){let ls=Number(os.slice(3));if(Number.isInteger(ls)&&ls>0)return`matrixEntry${ls}_${ss[0]}`}if(os.slice(0,6)==="column"){let ls=Number(os.slice(6));if(Number.isInteger(ls)&&ls>0)return`matrixEntry${ss[0]}_${ls}`}return null},returnArraySizeDependencies:()=>({matrixSize:{dependencyType:"stateVariable",variableName:"matrixSize"}}),returnArraySize({dependencyValues:ss}){return ss.matrixSize},returnArrayDependenciesByKey(){return{globalDependencies:{value:{dependencyType:"stateVariable",variableName:"value"}}}},arrayDefinitionByKey({globalDependencyValues:ss,arraySize:os}){let ls=ss.value.tree,us=!1,cs={};if(Array.isArray(ls)){if(vectorAndListOperators.includes(ls[0])){for(let ds=0;ds({anchorAttr:{dependencyType:"attributeComponent",attributeName:"anchor",variableNames:["coords"]}}),definition({dependencyValues:ss}){return ss.anchorAttr?{setValue:{anchor:ss.anchorAttr.stateValues.coords}}:{useEssentialOrDefaultValue:{anchor:!0}}},async inverseDefinition({desiredStateVariableValues:ss,dependencyValues:os,stateValues:ls,initialChange:us}){return us&&!await ls.draggable?{success:!1}:os.anchorAttr?{success:!0,instructions:[{setDependency:"anchorAttr",desiredValue:ss.anchor,variableIndex:0}]}:{success:!0,instructions:[{setEssentialValue:"anchor",value:ss.anchor}]}}},rs}async moveMath({x:rs,y:ns,z:ss,transient:os,actionId:ls,sourceInformation:us={},skipRendererUpdate:cs=!1}){let ds=["vector"];return rs!==void 0&&(ds[1]=rs),ns!==void 0&&(ds[2]=ns),ss!==void 0&&(ds[3]=ss),os?await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"anchor",value:Context.fromAst(ds)}],transient:os,actionId:ls,sourceInformation:us,skipRendererUpdate:cs}):await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"anchor",value:Context.fromAst(ds)}],actionId:ls,sourceInformation:us,skipRendererUpdate:cs,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{x:rs,y:ns,z:ss}}})}}zs(MathComponent,"componentType","math"),zs(MathComponent,"primaryStateVariableForDefinition","unnormalizedValue"),zs(MathComponent,"primaryEssentialStateVariable","value"),zs(MathComponent,"variableForPlainMacro","value"),zs(MathComponent,"descendantCompositesMustHaveAReplacement",!0),zs(MathComponent,"descendantCompositesDefaultReplacementType","math"),zs(MathComponent,"adapters",[{stateVariable:"number",stateVariablesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"]},"text",{componentType:"subsetOfReals",stateVariable:"value",substituteForPrimaryStateVariable:"subsetValue"}]);function calculateExpressionWithCodes({dependencyValues:as,changes:rs}){if(!("stringMathChildren"in rs&&rs.stringMathChildren.componentIdentitiesChanged||"displayedMathChildren"in rs||"format"in rs||"splitSymbols"in rs||"parseScientificNotation"in rs||"functionSymbols"in rs||"mathChildrenFunctionSymbols"in rs))return{useEssentialOrDefaultValue:{expressionWithCodes:!0}};if(as.stringMathChildren.length===0)if(as.displayedMathChildren.length>0){let gs;try{gs=Context.fromLatex(as.displayedMathChildren[0].stateValues.latex)}catch{gs=Context.fromAst("_")}return{setValue:{expressionWithCodes:gs},setEssentialValue:{expressionWithCodes:gs}}}else return{setValue:{expressionWithCodes:null},setEssentialValue:{expressionWithCodes:null}};let ns="",ss=0,os="",ls=as.stringMathChildren.compositeReplacementRange,us,cs,ds,ps;as.groupCompositeReplacements&&ls.length>0&&(ds=0,ps=ls[ds].firstInd);for(let[gs,ys]of as.stringMathChildren.entries()){if(us===void 0&&gs===ps){us=ds,cs=ls[ds].lastInd,os="";let bs=cs===gs;if(!bs){for(let vs=gs;vs<=cs;vs++)if(typeof as.stringMathChildren[vs]=="string"){bs=!0;break}}bs&&(ls.length>us+1?(ds=us+1,ps=ls[ds].firstInd):(ds=void 0,ps=void 0),us=void 0,cs=void 0)}if(typeof ys=="string")ns+=" "+ys+" ";else{let bs=as.codePre+ss;ss++;let vs;as.format==="latex"?vs="\\operatorname{"+bs+"}":vs=" "+bs+" ",us!==void 0?(os&&(os+=","),os+=vs):ns+=vs}if(gs===cs){let bs=ns.trimEnd(),vs=!1;if(bs.length===0)vs=!0;else{let xs=bs[bs.length-1];if(!["{","[","(","|",","].includes(xs))vs=!0;else{let Cs=as.stringMathChildren[gs+1];if(typeof Cs!="string")vs=!0;else{let Ts=Cs.trimStart();if(Ts.length===0)vs=!0;else{let Ss=Ts[0];as.format==="latex"&&Ss==="\\"&&Ts.length>1&&(Ss=Ts[1]),["}","]",")","|",","].includes(Ss)||(vs=!0)}}}}vs&&(os="("+os+")"),ns+=os,os="",ls.length>us+1?(ds=us+1,ps=ls[ds].firstInd):(ds=void 0,ps=void 0),us=void 0,cs=void 0}}let fs=null,hs=[...as.functionSymbols];if(hs.push(...as.mathChildrenFunctionSymbols.map(gs=>as.codePre+gs)),ns==="")fs=Context.fromAst("_");else if(as.format==="text"){let gs=getFromText({functionSymbols:hs,splitSymbols:as.splitSymbols,parseScientificNotation:as.parseScientificNotation});try{fs=gs(ns)}catch{fs=Context.fromAst("_"),console.log("Invalid value for a math of text format: "+ns)}}else if(as.format==="latex"){let gs=getFromLatex({functionSymbols:hs,splitSymbols:as.splitSymbols,parseScientificNotation:as.parseScientificNotation});try{fs=gs(ns)}catch{fs=Context.fromAst("_"),console.log("Invalid value for a math of latex format: "+ns)}}return{setValue:{expressionWithCodes:fs},setEssentialValue:{expressionWithCodes:fs}}}function calculateMathValue({dependencyValues:as}={}){if(as.expressionWithCodes===null)return{setValue:{unnormalizedValue:as.valueShadow}};let rs={};for(let[ss,os]of as.mathChildren.entries())rs[as.codePre+ss]=os.stateValues.value;let ns=as.expressionWithCodes;return as.mathChildren.length>0&&(ns=ns.substitute(rs)),ns=Context.fromAst(mergeListsWithOtherContainers(ns.tree)),{setValue:{unnormalizedValue:ns}}}function calculateCodesAdjacentToStrings({dependencyValues:as}){let rs=[],ns;for(let[ss,os]of as.stringMathChildren.entries())if(typeof os=="string"){let ls=as.stringMathChildren[ss+1];if(ls!==void 0&&typeof ls=="string")continue;let us={};if(ns!==void 0&&(as.format==="latex"?us.prevCode="\\operatorname{"+as.codePre+ns+"}":us.prevCode=as.codePre+ns),ls!==void 0){let cs=0;ns!==void 0&&(cs=ns+1),as.format==="latex"?us.nextCode="\\operatorname{"+as.codePre+cs+"}":us.nextCode=as.codePre+cs}rs.push(us)}else ns===void 0?ns=0:ns++;return{setValue:{codesAdjacentToStrings:rs}}}function determineCanBeModified({dependencyValues:as}){if(!as.modifyIndirectly||as.fixed)return{setValue:{canBeModified:!1,constantChildIndices:null,codeForExpression:null,inverseMaps:null,template:null,mathChildrenMapped:null}};if(as.mathChildrenModifiable.length===0)return as.displayedMathChildren.length>0?{setValue:{canBeModified:!1,constantChildIndices:null,codeForExpression:null,inverseMaps:null,template:null,mathChildrenMapped:null}}:{setValue:{canBeModified:!0,constantChildIndices:null,codeForExpression:null,inverseMaps:null,template:null,mathChildrenMapped:null}};let rs=[],ns=[],ss=[],os={};for(let[ds,ps]of as.mathChildrenModifiable.entries()){let fs=as.codePre+ds;ps.stateValues.canBeModified===!0?(rs.push(ds),ns.push(fs)):(ss.push(fs),os[fs]=ds)}let ls=as.codePre+"expr",us=Context.utils.unflattenLeft(as.expressionWithCodes.tree),cs=checkForLinearExpression(us,ns,ls,ss);if(cs.foundLinear){let ds={},ps=cs.template,fs=new Set;for(let hs in cs.mappings){ds[hs]=cs.mappings[hs];let gs=ds[hs].mathChildSub;if(gs){let ys=rs[ns.indexOf(gs)];ds[hs].mathChildInd=ys,fs.add(Number(ys))}}return fs.has=fs.has.bind(fs),{setValue:{canBeModified:!0,constantChildIndices:os,codeForExpression:ls,inverseMaps:ds,template:ps,mathChildrenMapped:fs}}}return{setValue:{canBeModified:!1,constantChildIndices:null,codeForExpression:null,inverseMaps:null,template:null,mathChildrenMapped:null}}}function checkForLinearExpression(as,rs,ns,ss=[],os=[]){let ls=Context.variables(as);if(ls.every(ds=>!rs.includes(ds))&&ls.every(ds=>!ss.includes(ds))){let ds={},ps="x"+os.join("_");return ds[ps]={result:Context.fromAst(ns).simplify(),components:os},{foundLinear:!0,mappings:ds,template:ps}}if(!Array.isArray(as))return checkForScalarLinearExpression(as,rs,ns,os);let us=as[0],cs=as.slice(1);if(vectorAndListOperators.includes(us)){let ds={mappings:{},template:[us]},ps=0;for(let fs=0;fs!rs.includes(us))?(ns=["+",ns,["-",ls[0]]],checkForScalarLinearExpression(ls[1],rs,ns,ss)):Context.variables(ls[1]).every(us=>!rs.includes(us))?(ns=["+",ns,["-",ls[1]]],checkForScalarLinearExpression(ls[0],rs,ns,ss)):{foundLinear:!1}:os==="*"?Context.variables(ls[0]).every(us=>!rs.includes(us))?(ns=["/",ns,ls[0]],checkForScalarLinearExpression(ls[1],rs,ns,ss)):Context.variables(ls[1]).every(us=>!rs.includes(us))?(ns=["/",ns,ls[1]],checkForScalarLinearExpression(ls[0],rs,ns,ss)):{foundLinear:!1}:os==="/"?Context.variables(ls[1]).every(us=>!rs.includes(us))?(ns=["*",ns,ls[1]],checkForScalarLinearExpression(ls[0],rs,ns,ss)):{foundLinear:!1}:{foundLinear:!1}}async function invertMath({desiredStateVariableValues:as,dependencyValues:rs,stateValues:ns,workspace:ss,overrideFixed:os}){if(!await ns.canBeModified&&!os)return{success:!1};let ls=rs.mathChildren,us=rs.stringChildren.length;if(ls.length===1&&us===0)return{success:!0,instructions:[{setDependency:"mathChildren",desiredValue:as.unnormalizedValue,childIndex:0,variableIndex:0}]};let cs=convertValueToMathExpression(as.unnormalizedValue),ds=await preprocessMathInverseDefinition({desiredValue:cs,stateValues:ns,variableName:"value",workspace:ss}),ps=ds.vectorComponentsNotAffected;if(cs=ds.desiredValue,ls.length===0){let bs=[];return us>0?bs.push({setDependency:"expressionWithCodes",desiredValue:cs}):bs.push({setDependency:"valueShadow",desiredValue:cs}),{success:!0,instructions:bs}}let fs=await getExpressionPieces({expression:cs,stateValues:ns});if(!fs)return{success:!1};let hs=[],gs=[];if(ps&&await ns.mathChildrenByVectorComponent){let bs=await ns.mathChildrenByVectorComponent;for(let vs of ps)bs[vs]&&gs.push(...bs[vs])}let ys=await ns.mathChildrenWithCanBeModified;for(let[bs,vs]of ls.entries())if(ns.mathChildrenMapped.has(bs)&&ys[bs].stateValues.canBeModified){if(!gs.includes(bs)){let xs=fs[bs],Cs={},Ts=!1,Ss=await ns.constantChildIndices;for(let Ns in Ss){let As=Ss[Ns];Cs[Ns]=ls[As].stateValues.value,Ts=!0}Ts&&(xs=xs.substitute(Cs)),xs=xs.simplify(),hs.push({setDependency:"mathChildren",desiredValue:xs,childIndex:bs,variableIndex:0})}delete fs[bs]}if(us>0){let Cs=function(Ss){return typeof Ss=="string"&&Ss.substring(0,xs)===vs},Ts=function(Ss){return Array.isArray(Ss)?flattenDeep(Ss.slice(1)).some(Cs):Cs(Ss)},bs=rs.expressionWithCodes,vs=rs.codePre,xs=vs.length;if(vectorAndListOperators.includes(bs.tree[0])&&!bs.tree.slice(1).every(Ts)){let Ss=await ns.inverseMaps;for(let Ns in fs){let As=Ss[Ns];if(As.mathChildInd!==void 0)continue;let ws=As.components;bs=bs.substitute_component(ws,fs[Ns])}hs.push({setDependency:"expressionWithCodes",desiredValue:bs})}}return{success:!0,instructions:hs}}async function getExpressionPieces({expression:as,stateValues:rs}){let ns=await rs.template,ss=Context.utils.match(as.tree,ns);if(!ss&&(ss=Context.utils.match(as.tuples_to_vectors().tree,Context.fromAst(ns).tuples_to_vectors().tree),!ss&&(ss=Context.utils.match(as.to_intervals().tree,Context.fromAst(ns).to_intervals().tree),!ss&&(ss=Context.utils.match(as.tuples_to_vectors().to_intervals().tree,Context.fromAst(ns).tuples_to_vectors().to_intervals().tree),!ss))))return!1;let os={};for(let ls in ss){let us={};us[await rs.codeForExpression]=ss[ls];let cs=(await rs.inverseMaps)[ls];if(cs!==void 0){let ds=ls;cs.mathChildInd!==void 0&&(ds=cs.mathChildInd),os[ds]=cs.result.substitute(us),os[ds]=normalizeMathExpression({value:os[ds],simplify:await rs.simplify,expand:await rs.expand,createVectors:await rs.createVectors,createIntervals:await rs.createIntervals})}}return os}var Vu;let Label$1=(Vu=class extends InlineComponent{constructor(rs){super(rs),Object.assign(this.actions,{moveLabel:this.moveLabel.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.forObject={createTargetComponentNames:!0},rs.draggable={createComponentOfType:"boolean",createStateVariable:"draggable",defaultValue:!0,public:!0,forRenderer:!0},rs.layer={createComponentOfType:"number",createStateVariable:"layer",defaultValue:0,public:!0,forRenderer:!0},rs.anchor={createComponentOfType:"point"},rs.positionFromAnchor={createComponentOfType:"text",createStateVariable:"positionFromAnchor",defaultValue:"center",public:!0,forRenderer:!0,toLowerCase:!0,validValues:["upperright","upperleft","lowerright","lowerleft","top","bottom","left","right","center"]},rs.styleNumber.defaultValue=0,rs}static returnChildGroups(){return[{group:"inlines",componentTypes:["_inline"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions(),ns=returnSelectedStyleStateVariableDefinition();return Object.assign(rs,ns),rs.valueShadow={hasEssential:!0,defaultValue:null,returnDependencies:()=>({}),definition(){return{useEssentialOrDefaultValue:{valueShadow:!0}}},inverseDefinition({desiredStateVariableValues:ss}){return{success:!0,instructions:[{setEssentialValue:"valueShadow",value:ss.valueShadow}]}}},rs.hasLatex={public:!0,forRenderer:!0,shadowingInstructions:{createComponentOfType:"boolean"},returnDependencies:()=>({inlineChildren:{dependencyType:"child",childGroups:["inlines"],variableNames:["text","latex","value","hasLatex","renderAsMath"],variablesOptional:!0},valueShadow:{dependencyType:"stateVariable",variableName:"valueShadow"}}),definition:function({dependencyValues:ss}){if(ss.inlineChildren.length===0&&ss.valueShadow!==null){let ls=ss.valueShadow;return{setValue:{hasLatex:!!/\\\(.*\\\)/.exec(ls)}}}let os=!1;for(let ls of ss.inlineChildren)if(typeof ls=="object"){if(typeof ls.stateValues.hasLatex=="boolean"&&typeof ls.stateValues.value=="string"&&typeof ls.stateValues.text=="string"){if(ls.stateValues.hasLatex)return{setValue:{hasLatex:!0}}}else if(typeof ls.stateValues.renderAsMath=="boolean"&&typeof ls.stateValues.latex=="string"&&typeof ls.stateValues.text=="string"){if(ls.stateValues.renderAsMath)return{setValue:{hasLatex:!0}}}else if(typeof ls.stateValues.latex=="string")return{setValue:{hasLatex:!0}}}return{setValue:{hasLatex:os}}}},rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},additionalStateVariablesDefined:[{variableName:"latex",public:!0,shadowingInstructions:{createComponentOfType:"text"}},{variableName:"value",public:!0,forRenderer:!0,shadowingInstructions:{createComponentOfType:"label",addStateVariablesShadowingStateVariables:{hasLatex:{stateVariableToShadow:"hasLatex"}}}}],returnDependencies:()=>({inlineChildren:{dependencyType:"child",childGroups:["inlines"],variableNames:["text","latex","value","hasLatex","renderAsMath"],variablesOptional:!0},valueShadow:{dependencyType:"stateVariable",variableName:"valueShadow"},hasLatex:{dependencyType:"stateVariable",variableName:"hasLatex"}}),definition:function({dependencyValues:ss}){if(ss.inlineChildren.length===0&&ss.valueShadow!==null){let us=ss.valueShadow,cs=us;return ss.hasLatex&&(cs=cs.replace(/\\\(/g,""),cs=cs.replace(/\\\)/g,"")),{setValue:{text:cs,latex:cs,value:us}}}let os="",ls="";for(let us of ss.inlineChildren)if(typeof us!="object"){let cs=us.toString();os+=cs,ls+=cs}else typeof us.stateValues.hasLatex=="boolean"&&typeof us.stateValues.value=="string"&&typeof us.stateValues.text=="string"?(os+=us.stateValues.text,ls+=us.stateValues.value):typeof us.stateValues.renderAsMath=="boolean"&&typeof us.stateValues.latex=="string"&&typeof us.stateValues.text=="string"?us.stateValues.renderAsMath?(os+=us.stateValues.latex,ls+="\\("+us.stateValues.latex+"\\)"):(os+=us.stateValues.text,ls+=us.stateValues.text):typeof us.stateValues.latex=="string"?(os+=us.stateValues.latex,ls+="\\("+us.stateValues.latex+"\\)"):typeof us.stateValues.text=="string"&&(os+=us.stateValues.text,ls+=us.stateValues.text);return{setValue:{text:os,latex:os,value:ls}}},inverseDefinition:function({desiredStateVariableValues:ss,dependencyValues:os}){let ls;if(typeof ss.value=="string")ls=ss.value;else if(typeof ss.text=="string")ls=ss.text;else if(typeof ss.latex=="string")ls=ss.latex;else return{success:!1};if(os.inlineChildren.length===0&&os.valueShadow!==null)return{success:!0,instructions:[{setDependency:"valueShadow",desiredValue:ls}]};if(os.inlineChildren.length===1){let us=os.inlineChildren[0],cs=ss.value;if(typeof us!="object")return{success:!0,instructions:[{setDependency:"inlineChildren",desiredValue:cs,childIndex:0}]};if(typeof us.stateValues.hasLatex=="boolean"&&typeof us.stateValues.value=="string"&&typeof us.stateValues.text=="string")return{success:!0,instructions:[{setDependency:"inlineChildren",desiredValue:cs,childIndex:0,variableIndex:2}]};if(typeof us.stateValues.renderAsMath=="boolean"&&typeof us.stateValues.latex=="string"&&typeof us.stateValues.text=="string")if(us.stateValues.renderAsMath){let ds=cs.match(/^\\\((.*)\\\)/);return ds&&(cs=ds[1]),{success:!0,instructions:[{setDependency:"inlineChildren",desiredValue:cs,childIndex:0,variableIndex:1}]}}else return{success:!0,instructions:[{setDependency:"inlineChildren",desiredValue:cs,childIndex:0,variableIndex:0}]};else if(typeof us.stateValues.latex=="string"){let ds=cs.match(/^\\\((.*)\\\)/);return ds&&(cs=ds[1]),{success:!0,instructions:[{setDependency:"inlineChildren",desiredValue:cs,childIndex:0,variableIndex:1}]}}else return typeof us.stateValues.text=="string"?{success:!0,instructions:[{setDependency:"inlineChildren",desiredValue:cs,childIndex:0,variableIndex:0}]}:{success:!1}}else return{success:!1}}},rs.forObjectComponentName={returnDependencies:()=>({forObject:{dependencyType:"attributeTargetComponentNames",attributeName:"forObject"}}),definition({dependencyValues:ss}){var ls;let os;return((ls=ss.forObject)==null?void 0:ls.length)===1?os=ss.forObject[0].absoluteName:os=null,{setValue:{forObjectComponentName:os}}}},rs.anchor={defaultValue:Context.fromText("(0,0)"),public:!0,forRenderer:!0,hasEssential:!0,shadowingInstructions:{createComponentOfType:"point"},returnDependencies:()=>({anchorAttr:{dependencyType:"attributeComponent",attributeName:"anchor",variableNames:["coords"]}}),definition({dependencyValues:ss}){return ss.anchorAttr?{setValue:{anchor:ss.anchorAttr.stateValues.coords}}:{useEssentialOrDefaultValue:{anchor:!0}}},async inverseDefinition({desiredStateVariableValues:ss,dependencyValues:os,stateValues:ls,initialChange:us}){return us&&!await ls.draggable?{success:!1}:os.anchorAttr?{success:!0,instructions:[{setDependency:"anchorAttr",desiredValue:ss.anchor,variableIndex:0}]}:{success:!0,instructions:[{setEssentialValue:"anchor",value:ss.anchor}]}}},rs}async moveLabel({x:rs,y:ns,z:ss,transient:os,actionId:ls,sourceInformation:us={},skipRendererUpdate:cs=!1}){let ds=["vector"];return rs!==void 0&&(ds[1]=rs),ns!==void 0&&(ds[2]=ns),ss!==void 0&&(ds[3]=ss),os?await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"anchor",value:Context.fromAst(ds)}],transient:os,actionId:ls,sourceInformation:us,skipRendererUpdate:cs}):await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"anchor",value:Context.fromAst(ds)}],actionId:ls,sourceInformation:us,skipRendererUpdate:cs,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{x:rs,y:ns,z:ss}}})}},zs(Vu,"componentType","label"),zs(Vu,"renderChildren",!0),zs(Vu,"rendererType","label"),zs(Vu,"includeBlankStringChildren",!0),zs(Vu,"primaryStateVariableForDefinition","valueShadow"),zs(Vu,"adapters",["text"]),Vu);function returnGroupIntoComponentTypeSeparatedBySpaces({componentType:as,forceComponentType:rs=!1}){return function({matchedChildren:ns,componentInfoObjects:ss}){let os=[],ls=[];function us(){var ds;let cs=!1;if(rs){if(ls.length===1){let ps=ls[0],fs=ps.componentType;fs==="copy"&&((ds=ps.attributes)!=null&&ds.createComponentOfType)&&(!ps.attributes.nComponents||ps.attributes.nComponents.primitive===1)&&(fs=ps.attributes.createComponentOfType.primitive),ss.isInheritedComponentType({inheritedComponentType:fs,baseComponentType:as})&&(os.push(ps),cs=!0)}}else ls.length===1&&typeof ls[0]!="string"&&(os.push(ls[0]),cs=!0);!cs&&ls.length>0&&os.push({componentType:as,children:ls}),ls=[]}for(let cs of ns)if(typeof cs!="string")ls.push(cs);else{let ds=cs.split(/\s+/),ps=ds[0];ps===""?us():ls.push(ps);for(let fs of ds.slice(1))us(),fs!==""&&ls.push(fs)}return us(),{success:!0,newChildren:os}}}function returnBreakStringsIntoComponentTypeBySpaces({componentType:as}){return function({matchedChildren:rs}){return{success:!0,newChildren:rs.reduce(function(ss,os){return typeof os=="string"?[...ss,...os.split(/\s+/).filter(ls=>ls).map(ls=>({componentType:as,children:[ls]}))]:[...ss,os]},[])}}}class MathList extends InlineComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.unordered={createComponentOfType:"boolean",createStateVariable:"unordered",defaultValue:!1,public:!0},rs.maximumNumber={createComponentOfType:"number",createStateVariable:"maximumNumber",defaultValue:null,public:!0},rs.mergeMathLists={createComponentOfType:"boolean"},rs.displayDigits={createComponentOfType:"integer"},rs.displayDecimals={createComponentOfType:"integer",createStateVariable:"displayDecimals",defaultValue:null,public:!0},rs.displaySmallAsZero={createComponentOfType:"number",createStateVariable:"displaySmallAsZero",valueForTrue:1e-14,valueForFalse:0,defaultValue:0,public:!0},rs.padZeros={createComponentOfType:"boolean",createStateVariable:"padZeros",defaultValue:!1,public:!0},rs}static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=returnGroupIntoComponentTypeSeparatedBySpaces({componentType:"math"}),ss=returnBreakStringsIntoComponentTypeBySpaces({componentType:"math"});return rs.push({replacementFunction:function({matchedChildren:os,isAttributeComponent:ls=!1,createdFromMacro:us=!1}){return ls&&!us?ns({matchedChildren:os}):ss({matchedChildren:os})}}),rs}static returnChildGroups(){return[{group:"maths",componentTypes:["math"]},{group:"mathLists",componentTypes:["mathList"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.overrideChildHide={returnDependencies:()=>({}),definition:()=>({setValue:{overrideChildHide:!0}})},rs.displayDigits={public:!0,shadowingInstructions:{createComponentOfType:"integer"},hasEssential:!0,defaultValue:10,returnDependencies:()=>({displayDigitsAttr:{dependencyType:"attributeComponent",attributeName:"displayDigits",variableNames:["value"]},displayDecimalsAttr:{dependencyType:"attributeComponent",attributeName:"displayDecimals",variableNames:["value"]}}),definition({dependencyValues:ns,usedDefault:ss}){if(ns.displayDigitsAttr!==null){let os=ss.displayDigitsAttr,ls=ns.displayDecimalsAttr===null||ss.displayDecimalsAttr;if(!(os||ls)){let us=ns.displayDigitsAttr.shadowDepth;ns.displayDecimalsAttr.shadowDepth({}),definition:()=>({useEssentialOrDefaultValue:{mathsShadow:!0}})},rs.mergeMathLists={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},returnDependencies:()=>({mergeMathListsAttr:{dependencyType:"attributeComponent",attributeName:"mergeMathLists",variableNames:["value"]},mathListChildren:{dependencyType:"child",childGroups:["mathLists"],skipComponentNames:!0},mathChildren:{dependencyType:"child",childGroups:["maths"],skipComponentNames:!0}}),definition({dependencyValues:ns}){var os;return{setValue:{mergeMathLists:((os=ns.mergeMathListsAttr)==null?void 0:os.stateValues.value)||ns.mathListChildren.length===0&&ns.mathChildren.length===1}}}},rs.nComponents={public:!0,shadowingInstructions:{createComponentOfType:"number"},stateVariablesDeterminingDependencies:["mergeMathLists"],additionalStateVariablesDefined:["childIndexByArrayKey"],returnDependencies({stateValues:ns}){let ss={maximumNumber:{dependencyType:"stateVariable",variableName:"maximumNumber"},mergeMathLists:{dependencyType:"stateVariable",variableName:"mergeMathLists"},mathsShadow:{dependencyType:"stateVariable",variableName:"mathsShadow"}};return ns.mergeMathLists?ss.mathAndMathListChildren={dependencyType:"child",childGroups:["maths","mathLists"],variableNames:["value","nComponents"],variablesOptional:!0}:(ss.mathListChildren={dependencyType:"child",childGroups:["mathLists"],variableNames:["nComponents"]},ss.mathAndMathListChildren={dependencyType:"child",childGroups:["maths","mathLists"],skipComponentNames:!0}),ss},definition:function({dependencyValues:ns,componentInfoObjects:ss}){let os=0,ls=[];if(ns.mathAndMathListChildren.length>0)if(ns.mergeMathLists)for(let[cs,ds]of ns.mathAndMathListChildren.entries())if(ss.isInheritedComponentType({inheritedComponentType:ds.componentType,baseComponentType:"mathList"})){for(let ps=0;psus&&(os=us,ls=ls.slice(0,us)),{setValue:{nComponents:os,childIndexByArrayKey:ls},checkForActualChange:{nComponents:!0}}}},rs.maths={public:!0,shadowingInstructions:{createComponentOfType:"math",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"]},isArray:!0,entryPrefixes:["math"],stateVariablesDeterminingDependencies:["mergeMathLists","childIndexByArrayKey"],returnArraySizeDependencies:()=>({nComponents:{dependencyType:"stateVariable",variableName:"nComponents"}}),returnArraySize({dependencyValues:ns}){return[ns.nComponents]},returnArrayDependenciesByKey({arrayKeys:ns,stateValues:ss}){let os={},ls={mergeMathLists:{dependencyType:"stateVariable",variableName:"mergeMathLists"},childIndexByArrayKey:{dependencyType:"stateVariable",variableName:"childIndexByArrayKey"},mathsShadow:{dependencyType:"stateVariable",variableName:"mathsShadow"}};for(let us of ns){let cs=[],ds="1";ss.childIndexByArrayKey[us]&&(cs=[ss.childIndexByArrayKey[us][0]],ds=ss.childIndexByArrayKey[us][1]+1),os[us]={mathAndMathListChildren:{dependencyType:"child",childGroups:["maths","mathLists"],variableNames:["value","math"+ds],variablesOptional:!0,childIndices:cs}}}return{globalDependencies:ls,dependenciesByKey:os}},arrayDefinitionByKey({globalDependencyValues:ns,dependencyValuesByKey:ss,arrayKeys:os}){let ls={};for(let us of os){let cs=ss[us].mathAndMathListChildren[0];if(cs)if(cs.stateValues.value!==void 0){let ds=cs.stateValues.value;if(ns.mergeMathLists&&Array.isArray(ds.tree)&&ds.tree[0]==="list"){let ps=ns.childIndexByArrayKey[us][1];ls[us]=ds.get_component(ps)}else ls[us]=ds}else{let ds=ns.childIndexByArrayKey[us][1]+1;ls[us]=cs.stateValues["math"+ds]}else ns.mathsShadow!==null&&(ls[us]=ns.mathsShadow[us])}return{setValue:{maths:ls}}},async inverseArrayDefinitionByKey({desiredStateVariableValues:ns,globalDependencyValues:ss,dependencyValuesByKey:os,dependencyNamesByKey:ls,stateValues:us,workspace:cs}){if(ss.mergeMathLists){let ps=[],fs=await us.childIndexByArrayKey,hs=[];for(let gs in ns.maths){if(!os[gs]||hs.includes(gs))continue;let ys;if(fs[gs][2]!==void 0){let vs=Number(gs)-fs[gs][1],xs=vs+fs[gs][2]-1;cs.desiredMaths||(cs.desiredMaths=[]);let Cs=["list"];for(let Ts=vs;Ts<=xs;Ts++)ns.maths[Ts]!==void 0?cs.desiredMaths[Ts]=convertValueToMathExpression(ns.maths[Ts]):cs.desiredMaths[Ts]===void 0&&(cs.desiredMaths[Ts]=(await us.maths)[Ts]),Cs.push(cs.desiredMaths[Ts].tree),hs.push(Ts.toString());ys=Context.fromAst(Cs)}else ys=ns.maths[gs];let bs=os[gs].mathAndMathListChildren[0];bs&&(bs.stateValues.value!==void 0?ps.push({setDependency:ls[gs].mathAndMathListChildren,desiredValue:ys,childIndex:0,variableIndex:0}):ps.push({setDependency:ls[gs].mathAndMathListChildren,desiredValue:ys,childIndex:0,variableIndex:1}))}return{success:!0,instructions:ps}}let ds=[];for(let ps in ns.maths){if(!os[ps])continue;let fs=os[ps].mathAndMathListChildren[0];fs&&(fs.stateValues.value!==void 0?ds.push({setDependency:ls[ps].mathAndMathListChildren,desiredValue:ns.maths[ps],childIndex:0,variableIndex:0}):ds.push({setDependency:ls[ps].mathAndMathListChildren,desiredValue:ns.maths[ps],childIndex:0,variableIndex:1}))}return{success:!0,instructions:ds}}},rs.math={public:!0,shadowingInstructions:{createComponentOfType:"math",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"]},returnDependencies:()=>({maths:{dependencyType:"stateVariable",variableName:"maths"}}),definition({dependencyValues:ns}){let ss;return ns.maths.length===0?ss=Context.fromAst("_"):ns.maths.length===1?ss=ns.maths[0]:ss=Context.fromAst(["list",...ns.maths.map(os=>os.tree)]),{setValue:{math:ss}}}},rs.nValues={isAlias:!0,targetVariableName:"nComponents"},rs.values={isAlias:!0,targetVariableName:"maths"},rs.latex={additionalStateVariablesDefined:["latexs"],public:!0,shadowingInstructions:{createComponentOfType:"text"},forRenderer:!0,returnDependencies:()=>({mathAndMathListChildren:{dependencyType:"child",childGroups:["maths","mathLists"],variableNames:["valueForDisplay","latex","latexs"],variablesOptional:!0},maximumNumber:{dependencyType:"stateVariable",variableName:"maximumNumber"},mergeMathLists:{dependencyType:"stateVariable",variableName:"mergeMathLists"},mathsShadow:{dependencyType:"stateVariable",variableName:"mathsShadow"},displayDigits:{dependencyType:"stateVariable",variableName:"displayDigits"},displayDecimals:{dependencyType:"stateVariable",variableName:"displayDecimals"},displaySmallAsZero:{dependencyType:"stateVariable",variableName:"displaySmallAsZero"},padZeros:{dependencyType:"stateVariable",variableName:"padZeros"}}),definition:function({dependencyValues:ns,usedDefault:ss}){let os=[],ls={};if(ns.padZeros&&(ss.displayDigits&&!ss.displayDecimals?Number.isFinite(ns.displayDecimals)&&(ls.padToDecimals=ns.displayDecimals):ns.displayDigits>=1&&(ls.padToDigits=ns.displayDigits)),ns.mathAndMathListChildren.length>0)for(let ds of ns.mathAndMathListChildren)if(ds.stateValues.valueForDisplay){let ps=ds.stateValues.valueForDisplay;if(ns.mergeMathLists&&Array.isArray(ps.tree)&&ps.tree[0]==="list")for(let fs=0;fsroundForDisplay({value:ds,dependencyValues:ns,usedDefault:ss}).toLatex(ls)));let us=ns.maximumNumber;return us!==null&&os.length>us&&(us=Math.max(0,Math.floor(us)),os=os.slice(0,us)),{setValue:{latex:os.join(", "),latexs:os}}}},rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},additionalStateVariablesDefined:["texts"],returnDependencies:()=>({mathAndMathListChildren:{dependencyType:"child",childGroups:["maths","mathLists"],variableNames:["valueForDisplay","text","texts"],variablesOptional:!0},maximumNumber:{dependencyType:"stateVariable",variableName:"maximumNumber"},mergeMathLists:{dependencyType:"stateVariable",variableName:"mergeMathLists"},mathsShadow:{dependencyType:"stateVariable",variableName:"mathsShadow"}}),definition:function({dependencyValues:ns}){let ss=[];if(ns.mathAndMathListChildren.length>0)for(let us of ns.mathAndMathListChildren)if(us.stateValues.valueForDisplay){let cs=us.stateValues.valueForDisplay;if(ns.mergeMathLists&&Array.isArray(cs.tree)&&cs.tree[0]==="list")for(let ds=0;dsus.toString()));let os=ns.maximumNumber;return os!==null&&ss.length>os&&(os=Math.max(0,Math.floor(os)),ss=ss.slice(0,os)),{setValue:{text:ss.join(", "),texts:ss}}}},rs.componentNamesInList={returnDependencies:()=>({mathAndMathListChildren:{dependencyType:"child",childGroups:["maths","mathLists"],variableNames:["componentNamesInList"],variablesOptional:!0},maximumNumber:{dependencyType:"stateVariable",variableName:"maximumNumber"}}),definition:function({dependencyValues:ns,componentInfoObjects:ss}){let os=[];for(let us of ns.mathAndMathListChildren)ss.isInheritedComponentType({inheritedComponentType:us.componentType,baseComponentType:"mathList"})?os.push(...us.stateValues.componentNamesInList):os.push(us.componentName);let ls=ns.maximumNumber;return ls!==null&&os.length>ls&&(ls=Math.max(0,Math.floor(ls)),os=os.slice(0,ls)),{setValue:{componentNamesInList:os}}}},rs.nComponentsToDisplayByChild={additionalStateVariablesDefined:["nChildrenToRender"],returnDependencies:()=>({nComponents:{dependencyType:"stateVariable",variableName:"nComponents"},mathListChildren:{dependencyType:"child",childGroups:["mathLists"],variableNames:["nComponents"]},mathAndMathListChildren:{dependencyType:"child",childGroups:["maths","mathLists"],skipComponentNames:!0},parentNComponentsToDisplayByChild:{dependencyType:"parentStateVariable",parentComponentType:"mathList",variableName:"nComponentsToDisplayByChild"}}),definition:function({dependencyValues:ns,componentInfoObjects:ss,componentName:os}){let ls=ns.nComponents;ns.parentNComponentsToDisplayByChild!==null&&(ls=ns.parentNComponentsToDisplayByChild[os]);let us={},cs=0,ds=0,ps=0;for(let fs of ns.mathAndMathListChildren){let hs=Math.max(0,ls-cs);if(hs>0&&ds++,ss.isInheritedComponentType({inheritedComponentType:fs.componentType,baseComponentType:"mathList"})){let gs=ns.mathListChildren[ps];ps++;let ys=Math.min(hs,gs.stateValues.nComponents);us[gs.componentName]=ys,cs+=ys}else cs+=1}return{setValue:{nComponentsToDisplayByChild:us,nChildrenToRender:ds}}},markStale:()=>({updateRenderedChildren:!0})},rs}}zs(MathList,"componentType","mathList"),zs(MathList,"renderChildren",!0),zs(MathList,"includeBlankStringChildren",!0),zs(MathList,"removeBlankStringChildrenPostSugar",!0),zs(MathList,"stateVariableForAttributeValue","maths"),zs(MathList,"primaryStateVariableForDefinition","mathsShadow"),zs(MathList,"descendantCompositesMustHaveAReplacement",!1),zs(MathList,"adapters",[{stateVariable:"math",stateVariablesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"]},"text"]);class Columns extends Text{}zs(Columns,"componentType","columns"),zs(Columns,"rendererType","text");class Title extends TextOrInline{}zs(Title,"componentType","title");class RightHandSide extends MathComponent{}zs(RightHandSide,"componentType","rightHandSide"),zs(RightHandSide,"rendererType","math");class Description extends TextOrInline{}zs(Description,"componentType","description"),zs(Description,"rendererType");class Else extends Template{}zs(Else,"componentType","else");class Xlabel extends Label$1{}zs(Xlabel,"componentType","xlabel"),zs(Xlabel,"rendererType","label");class Ylabel extends Label$1{}zs(Ylabel,"componentType","ylabel"),zs(Ylabel,"rendererType","label");class MatrixRow extends MathList{}zs(MatrixRow,"componentType","matrixRow"),zs(MatrixRow,"rendererType","mathList");class MatrixColumn extends MathList{}zs(MatrixColumn,"componentType","matrixColumn"),zs(MatrixColumn,"rendererType","mathList");const Aliases=Object.freeze(Object.defineProperty({__proto__:null,Columns,Description,Else,MatrixColumn,MatrixRow,RightHandSide,Title,Xlabel,Ylabel},Symbol.toStringTag,{value:"Module"}));var Mu;let M$3=(Mu=class extends InlineComponent{constructor(rs){super(rs),Object.assign(this.actions,{moveMath:this.moveMath.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.draggable={createComponentOfType:"boolean",createStateVariable:"draggable",defaultValue:!0,public:!0,forRenderer:!0},rs.layer={createComponentOfType:"number",createStateVariable:"layer",defaultValue:0,public:!0,forRenderer:!0},rs.anchor={createComponentOfType:"point"},rs.positionFromAnchor={createComponentOfType:"text",createStateVariable:"positionFromAnchor",defaultValue:"center",public:!0,forRenderer:!0,toLowerCase:!0,validValues:["upperright","upperleft","lowerright","lowerleft","top","bottom","left","right","center"]},rs.styleNumber.defaultValue=0,rs}static returnChildGroups(){return[{group:"inline",componentTypes:["_inline"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions(),ns=returnSelectedStyleStateVariableDefinition();return Object.assign(rs,ns),rs.latex={public:!0,shadowingInstructions:{createComponentOfType:"text"},defaultValue:"",hasEssential:!0,forRenderer:!0,returnDependencies:()=>({inlineChildren:{dependencyType:"child",childGroups:["inline"],variableNames:["latex","text"],variablesOptional:!0}}),definition:function({dependencyValues:ss}){if(ss.inlineChildren.length===0)return{useEssentialOrDefaultValue:{latex:!0}};let os="";for(let ls of ss.inlineChildren)typeof ls!="object"?os+=ls:typeof ls.stateValues.latex=="string"?os+=ls.stateValues.latex:typeof ls.stateValues.text=="string"&&(os+=ls.stateValues.text);return{setValue:{latex:os}}},inverseDefinition({desiredStateVariableValues:ss,dependencyValues:os}){if(typeof ss.latex!="string")return{success:!1};if(os.inlineChildren.length===0)return{success:!0,instructions:[{setEssentialValue:"latex",value:ss.latex}]};if(os.inlineChildren.length===1){let ls=os.inlineChildren[0];return typeof ls!="object"?{success:!0,instructions:[{setDependency:"inlineChildren",desiredValue:ss.latex,childIndex:0}]}:typeof ls.stateValues.latex=="string"?{success:!0,instructions:[{setDependency:"inlineChildren",desiredValue:ss.latex,childIndex:0,variableIndex:0}]}:typeof ls.stateValues.text=="string"?{success:!0,instructions:[{setDependency:"inlineChildren",desiredValue:ss.latex,childIndex:0,variableIndex:1}]}:{success:!1}}else return{success:!1}}},rs.latexWithInputChildren={forRenderer:!0,returnDependencies:()=>({inlineChildren:{dependencyType:"child",childGroups:["inline"],variableNames:["latex","text"],variablesOptional:!0},latex:{dependencyType:"stateVariable",variableName:"latex"}}),definition:function({dependencyValues:ss,componentInfoObjects:os}){if(ss.inlineChildren.length===0)return{setValue:{latexWithInputChildren:[ss.latex]}};let ls=[],us="",cs=0;for(let ds of ss.inlineChildren)typeof ds!="object"?us+=ds:os.isInheritedComponentType({inheritedComponentType:ds.componentType,baseComponentType:"input"})?(us.length>0&&(ls.push(us),us=""),ls.push(cs),cs++):typeof ds.stateValues.latex=="string"?us+=ds.stateValues.latex:typeof ds.stateValues.text=="string"&&(us+=ds.stateValues.text);return us.length>0&&ls.push(us),{setValue:{latexWithInputChildren:ls}}}},rs.renderMode={forRenderer:!0,returnDependencies:()=>({}),definition:()=>({setValue:{renderMode:"inline"}})},rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({latex:{dependencyType:"stateVariable",variableName:"latex"}}),definition:function({dependencyValues:ss}){let os;try{os=Context.fromAst(latexToAst.convert(ss.latex))}catch{return{setValue:{text:ss.latex}}}return{setValue:{text:superSubscriptsToUnicode(os.toString())}}}},rs.anchor={defaultValue:Context.fromText("(0,0)"),public:!0,forRenderer:!0,hasEssential:!0,shadowingInstructions:{createComponentOfType:"point"},returnDependencies:()=>({anchorAttr:{dependencyType:"attributeComponent",attributeName:"anchor",variableNames:["coords"]}}),definition({dependencyValues:ss}){return ss.anchorAttr?{setValue:{anchor:ss.anchorAttr.stateValues.coords}}:{useEssentialOrDefaultValue:{anchor:!0}}},async inverseDefinition({desiredStateVariableValues:ss,dependencyValues:os,stateValues:ls,initialChange:us}){return us&&!await ls.draggable?{success:!1}:os.anchorAttr?{success:!0,instructions:[{setDependency:"anchorAttr",desiredValue:ss.anchor,variableIndex:0}]}:{success:!0,instructions:[{setEssentialValue:"anchor",value:ss.anchor}]}}},rs}async moveMath({x:rs,y:ns,z:ss,transient:os,actionId:ls,sourceInformation:us={},skipRendererUpdate:cs=!1}){let ds=["vector"];return rs!==void 0&&(ds[1]=rs),ns!==void 0&&(ds[2]=ns),ss!==void 0&&(ds[3]=ss),os?await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"anchor",value:Context.fromAst(ds)}],transient:os,actionId:ls,sourceInformation:us,skipRendererUpdate:cs}):await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"anchor",value:Context.fromAst(ds)}],actionId:ls,sourceInformation:us,skipRendererUpdate:cs,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{x:rs,y:ns,z:ss}}})}},zs(Mu,"componentType","m"),zs(Mu,"rendererType","math"),zs(Mu,"includeBlankStringChildren",!0),zs(Mu,"primaryStateVariableForDefinition","latex"),Mu);var cp;let Me$2=(cp=class extends M$3{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.renderMode.definition=()=>({setValue:{renderMode:"display"}}),rs}},zs(cp,"componentType","me"),cp);class Men extends M$3{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.renderMode.definition=()=>({setValue:{renderMode:"numbered"}}),rs.equationTag={public:!0,shadowingInstructions:{createComponentOfType:"text"},forRenderer:!0,returnDependencies:()=>({equationCounter:{dependencyType:"counter",counterName:"equation"}}),definition({dependencyValues:ns}){return{setValue:{equationTag:String(ns.equationCounter)}}}},rs}}zs(Men,"componentType","men");const MMeMen=Object.freeze(Object.defineProperty({__proto__:null,M:M$3,Me:Me$2,Men},Symbol.toStringTag,{value:"Module"}));class Md extends InlineComponent{constructor(rs){super(rs),Object.assign(this.actions,{moveMath:this.moveMath.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.draggable={createComponentOfType:"boolean",createStateVariable:"draggable",defaultValue:!0,public:!0,forRenderer:!0},rs.layer={createComponentOfType:"number",createStateVariable:"layer",defaultValue:0,public:!0,forRenderer:!0},rs.anchor={createComponentOfType:"point"},rs.positionFromAnchor={createComponentOfType:"text",createStateVariable:"positionFromAnchor",defaultValue:"center",public:!0,forRenderer:!0,toLowerCase:!0,validValues:["upperright","upperleft","lowerright","lowerleft","top","bottom","left","right","center"]},rs.styleNumber.defaultValue=0,rs}static returnChildGroups(){return[{group:"mrows",componentTypes:["mrow"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions(),ns=returnSelectedStyleStateVariableDefinition();return Object.assign(rs,ns),rs.mrowChildNames={forRenderer:!0,returnDependencies:()=>({mrowChildren:{dependencyType:"child",childGroups:["mrows"]}}),definition:({dependencyValues:ss})=>({setValue:{mrowChildNames:ss.mrowChildren.map(os=>os.componentName)}})},rs.latex={public:!0,shadowingInstructions:{createComponentOfType:"text"},defaultValue:"",hasEssential:!0,shadowVariable:!0,forRenderer:!0,returnDependencies:()=>({mrowChildren:{dependencyType:"child",childGroups:["mrows"],variableNames:["latex","hide","equationTag","numbered"]}}),definition:function({dependencyValues:ss}){if(ss.mrowChildren.length>0){let os="";for(let ls of ss.mrowChildren)ls.stateValues.hide||(os.length>0&&(os+="\\\\"),ls.stateValues.numbered?os+=`\\tag{${ls.stateValues.equationTag}}`:os+="\\notag ",os+=ls.stateValues.latex);return{setValue:{latex:os}}}else return{useEssentialOrDefaultValue:{latex:!0}}}},rs.latexWithInputChildren={forRenderer:!0,returnDependencies:()=>({mrowChildren:{dependencyType:"child",childGroups:["mrows"],variableNames:["latexWithInputChildren","hide","equationTag","numbered"]},latex:{dependencyType:"stateVariable",variableName:"latex"}}),definition:function({dependencyValues:ss}){if(ss.mrowChildren.length>0){let os=[],ls=0,us="";for(let cs of ss.mrowChildren)if(!cs.stateValues.hide){us.length>0&&(us+="\\\\"),cs.stateValues.numbered?us+=`\\tag{${cs.stateValues.equationTag}}`:us+="\\notag ";for(let ds of cs.stateValues.latexWithInputChildren)typeof ds=="number"?(us.length>0&&(os.push(us),us=""),os.push(ls),ls++):us+=ds}return us.length>0&&os.push(us),{setValue:{latexWithInputChildren:os}}}else return{setValue:{latexWithInputChildren:[ss.latex]}}}},rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({latex:{dependencyType:"stateVariable",variableName:"latex"}}),definition:function({dependencyValues:ss}){let os;try{os=ss.latex.replaceAll("\\notag","").replaceAll("\\amp","").split("\\\\").map(ls=>Context.fromAst(latexToAst.convert(ls)).toString()).join(`\\\\ +`;function MenuItem({to:as,children:rs}){return jsx$1(StyledMenuItem,{to:as,className:({isActive:ns,isPending:ss})=>location.pathname==="/"||ns?"active":ss?"pending":"",children:rs})}function SiteHeader(as){let rs=useNavigate(),ns=useLoaderData();const ss=Recoil_index_24(pageToolViewAtom);let os=jsx$1(Button$2,{dataTest:"Nav to course",size:"medium",onClick:()=>{ss({page:"course",tool:"",view:"",params:{}}),rs("/course")},value:"Go to Course"});return ns.signedIn||(os=jsx$1(Button$2,{dataTest:"Nav to signin",onClick:()=>rs("/SignIn"),size:"medium",value:"Sign In"})),jsx$1(Fragment,{children:jsxs(TopContainer,{children:[jsxs(Box,{as:"header",gridRow:"1 / 2",backgroundColor:"#fff",color:"#000",height:"40px",position:"fixed",top:"0",width:"100%",margin:"0",display:"flex",justifyContent:"space-between",borderBottom:"1px solid var(--mainGray)",zIndex:"1200",children:[jsxs(Branding,{children:[jsx$1(RouterLogo,{}),jsx$1("p",{children:"Doenet"})]}),jsxs(BarMenu,{children:[jsx$1(MenuItem,{to:"/",children:"Home"}),jsx$1(MenuItem,{to:"community",children:"Community"}),ns.signedIn?jsx$1(MenuItem,{to:`portfolio/${ns.portfolioCourseId}`,children:"Portfolio"}):null]}),jsx$1(SignInButtonContainer,{children:os})]}),jsx$1(ContentContainer,{children:jsx$1(Outlet,{context:{signedIn:ns.signedIn}})})]})})}const __variableDynamicImportRuntimeHelper=(as,rs)=>{const ns=as[rs];return ns?typeof ns=="function"?ns():Promise.resolve(ns):new Promise((ss,os)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(os.bind(null,new Error("Unknown variable dynamic import: "+rs)))})};let nanoid=(as=21)=>crypto.getRandomValues(new Uint8Array(as)).reduce((rs,ns)=>(ns&=63,ns<36?rs+=ns.toString(36):ns<62?rs+=(ns-26).toString(36).toUpperCase():ns>62?rs+="-":rs+="_",rs),"");var sha1Exports={},sha1={get exports(){return sha1Exports},set exports(as){sha1Exports=as}},coreExports={},core={get exports(){return coreExports},set exports(as){coreExports=as}},hasRequiredCore;function requireCore(){return hasRequiredCore||(hasRequiredCore=1,function(as,rs){(function(ns,ss){as.exports=ss()})(commonjsGlobal$1,function(){var ns=ns||function(ss,os){var ls=Object.create||function(){function xs(){}return function(Cs){var Ts;return xs.prototype=Cs,Ts=new xs,xs.prototype=null,Ts}}(),us={},cs=us.lib={},ds=cs.Base=function(){return{extend:function(xs){var Cs=ls(this);return xs&&Cs.mixIn(xs),(!Cs.hasOwnProperty("init")||this.init===Cs.init)&&(Cs.init=function(){Cs.$super.init.apply(this,arguments)}),Cs.init.prototype=Cs,Cs.$super=this,Cs},create:function(){var xs=this.extend();return xs.init.apply(xs,arguments),xs},init:function(){},mixIn:function(xs){for(var Cs in xs)xs.hasOwnProperty(Cs)&&(this[Cs]=xs[Cs]);xs.hasOwnProperty("toString")&&(this.toString=xs.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),ps=cs.WordArray=ds.extend({init:function(xs,Cs){xs=this.words=xs||[],Cs!=os?this.sigBytes=Cs:this.sigBytes=xs.length*4},toString:function(xs){return(xs||hs).stringify(this)},concat:function(xs){var Cs=this.words,Ts=xs.words,Ss=this.sigBytes,Ns=xs.sigBytes;if(this.clamp(),Ss%4)for(var As=0;As>>2]>>>24-As%4*8&255;Cs[Ss+As>>>2]|=ws<<24-(Ss+As)%4*8}else for(var As=0;As>>2]=Ts[As>>>2];return this.sigBytes+=Ns,this},clamp:function(){var xs=this.words,Cs=this.sigBytes;xs[Cs>>>2]&=4294967295<<32-Cs%4*8,xs.length=ss.ceil(Cs/4)},clone:function(){var xs=ds.clone.call(this);return xs.words=this.words.slice(0),xs},random:function(xs){for(var Cs=[],Ts=function(Es){var Es=Es,_s=987654321,$s=4294967295;return function(){_s=36969*(_s&65535)+(_s>>16)&$s,Es=18e3*(Es&65535)+(Es>>16)&$s;var Rs=(_s<<16)+Es&$s;return Rs/=4294967296,Rs+=.5,Rs*(ss.random()>.5?1:-1)}},Ss=0,Ns;Ss>>2]>>>24-Ns%4*8&255;Ss.push((As>>>4).toString(16)),Ss.push((As&15).toString(16))}return Ss.join("")},parse:function(xs){for(var Cs=xs.length,Ts=[],Ss=0;Ss>>3]|=parseInt(xs.substr(Ss,2),16)<<24-Ss%8*4;return new ps.init(Ts,Cs/2)}},gs=fs.Latin1={stringify:function(xs){for(var Cs=xs.words,Ts=xs.sigBytes,Ss=[],Ns=0;Ns>>2]>>>24-Ns%4*8&255;Ss.push(String.fromCharCode(As))}return Ss.join("")},parse:function(xs){for(var Cs=xs.length,Ts=[],Ss=0;Ss>>2]|=(xs.charCodeAt(Ss)&255)<<24-Ss%4*8;return new ps.init(Ts,Cs)}},ys=fs.Utf8={stringify:function(xs){try{return decodeURIComponent(escape(gs.stringify(xs)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(xs){return gs.parse(unescape(encodeURIComponent(xs)))}},bs=cs.BufferedBlockAlgorithm=ds.extend({reset:function(){this._data=new ps.init,this._nDataBytes=0},_append:function(xs){typeof xs=="string"&&(xs=ys.parse(xs)),this._data.concat(xs),this._nDataBytes+=xs.sigBytes},_process:function(xs){var Cs=this._data,Ts=Cs.words,Ss=Cs.sigBytes,Ns=this.blockSize,As=Ns*4,ws=Ss/As;xs?ws=ss.ceil(ws):ws=ss.max((ws|0)-this._minBufferSize,0);var Es=ws*Ns,_s=ss.min(Es*4,Ss);if(Es){for(var $s=0;$s>>31}var Ns=(ys<<5|ys>>>27)+Cs+ds[Ts];Ts<20?Ns+=(bs&vs|~bs&xs)+1518500249:Ts<40?Ns+=(bs^vs^xs)+1859775393:Ts<60?Ns+=(bs&vs|bs&xs|vs&xs)-1894007588:Ns+=(bs^vs^xs)-899497514,Cs=xs,xs=vs,vs=bs<<30|bs>>>2,bs=ys,ys=Ns}gs[0]=gs[0]+ys|0,gs[1]=gs[1]+bs|0,gs[2]=gs[2]+vs|0,gs[3]=gs[3]+xs|0,gs[4]=gs[4]+Cs|0},_doFinalize:function(){var fs=this._data,hs=fs.words,gs=this._nDataBytes*8,ys=fs.sigBytes*8;return hs[ys>>>5]|=128<<24-ys%32,hs[(ys+64>>>9<<4)+14]=Math.floor(gs/4294967296),hs[(ys+64>>>9<<4)+15]=gs,fs.sigBytes=hs.length*4,this._process(),this._hash},clone:function(){var fs=us.clone.call(this);return fs._hash=this._hash.clone(),fs}});ss.SHA1=us._createHelper(ps),ss.HmacSHA1=us._createHmacHelper(ps)}(),ns.SHA1})})(sha1);var encBase64Exports={},encBase64={get exports(){return encBase64Exports},set exports(as){encBase64Exports=as}};(function(as,rs){(function(ns,ss){as.exports=ss(requireCore())})(commonjsGlobal$1,function(ns){return function(){var ss=ns,os=ss.lib,ls=os.WordArray,us=ss.enc;us.Base64={stringify:function(ds){var ps=ds.words,fs=ds.sigBytes,hs=this._map;ds.clamp();for(var gs=[],ys=0;ys>>2]>>>24-ys%4*8&255,vs=ps[ys+1>>>2]>>>24-(ys+1)%4*8&255,xs=ps[ys+2>>>2]>>>24-(ys+2)%4*8&255,Cs=bs<<16|vs<<8|xs,Ts=0;Ts<4&&ys+Ts*.75>>6*(3-Ts)&63));var Ss=hs.charAt(64);if(Ss)for(;gs.length%4;)gs.push(Ss);return gs.join("")},parse:function(ds){var ps=ds.length,fs=this._map,hs=this._reverseMap;if(!hs){hs=this._reverseMap=[];for(var gs=0;gs>>6-ys%4*2;hs[gs>>>2]|=(bs|vs)<<24-gs%4*8,gs++}return ls.create(hs,gs)}}(),ns.enc.Base64})})(encBase64);let rePlus=/\+/g,reSlash=/\//g;function createUniqueName(as,rs){let ns=encBase64Exports.stringify(sha1Exports(rs)).slice(0,10).replace(rePlus,"_").replace(reSlash,"-");return"__"+as+"_"+ns}function getUniqueIdentifierFromBase(as,rs){let ns=1,ss=as+ns;for(;rs.includes(ss);)ns+=1,ss=as+ns;return rs.push(ss),ss}function getNamespaceFromName(as){let rs=as.lastIndexOf("/");if(rs===-1)throw Error(`Encountered name ${as} that doesn't include a slash`);return as.slice(0,rs+1)}function flattenDeep(as){return as.reduce((rs,ns)=>Array.isArray(ns)?rs.concat(flattenDeep(ns)):rs.concat(ns),[])}function flattenLevels(as,rs){return console.log(`levels: ${rs}`),as.reduce((ns,ss)=>Array.isArray(ss)&&rs>1?ns.concat(flattenLevels(ss,rs-1)):ns.concat(ss),[])}class Subset{union(rs){return this.complement().intersect(rs.complement()).complement()}intersectWithOpenInterval(rs){return this.intersect(rs)}setMinus(rs){return this.intersect(rs.complement())}symmetricDifference(rs){return this.setMinus(rs).union(rs.setMinus(this))}equals(rs){return this.symmetricDifference(rs).isEmpty()}toJSON(){return{objectType:"subset",data:Object.assign({},this),subsetType:this.constructor.subsetType}}static reviver(rs,ns){if(ns&&ns.objectType==="subset"&&ns.subsetType!==void 0){if(ns.subsetType==="emptySet")return new EmptySet;if(ns.subsetType==="realLine")return new RealLine;if(ns.subsetType==="singleton")return new Singleton(ns.data.element);if(ns.subsetType==="union")return new Union(ns.data.subsets);if(ns.subsetType==="openInterval")return new OpenInterval(ns.data.left,ns.data.right)}return ns}copy(){return this.constructor.reviver(null,this.toJSON())}}const hp=class extends Subset{union(rs){return rs}intersect(){return new hp}contains(){return!1}isEmpty(){return!0}complement(){return new RealLine}toString(){return"∅"}toMathExpression(){return Context.fromAst("∅")}};let EmptySet=hp;zs(EmptySet,"subsetType","emptySet");const gp=class extends Subset{union(){return new gp}intersect(rs){return rs}contains(){return!0}complement(){return new EmptySet}isEmpty(){return!1}toString(){return"ℝ"}toMathExpression(){return Context.fromAst("R")}};let RealLine=gp;zs(RealLine,"subsetType","realLine");const yp=class extends Subset{constructor(rs){if(super(),!Number.isFinite(rs))return new EmptySet;this.element=rs}union(rs){return rs.contains(this.element)?rs:new Union([rs,this])}intersect(rs){return rs.contains(this.element)?new yp(this.element):new EmptySet}isEmpty(){return!1}contains(rs){return rs===this.element}complement(){return new Union([new OpenInterval(-1/0,this.element),new OpenInterval(this.element,1/0)])}toString(){return`{${this.element}}`}toMathExpression(){return Context.fromAst(["set",this.element])}};let Singleton=yp;zs(Singleton,"subsetType","singleton");const Ju=class extends Subset{intersect(rs){return new Ju(this.subsets.map(ns=>rs.intersect(ns)))}toString(){return this.subsets.map(rs=>rs.toString()).join(" U ")}toMathExpression(){return Context.fromAst(["union",...this.subsets.map(rs=>rs.toMathExpression().tree)])}constructor(rs){super();let ns=rs.filter(ss=>!ss.isEmpty());if(ns.length===0)return new EmptySet;ns=ns.reduce((ss,os)=>os instanceof Ju?ss.concat(os.subsets):ss.concat(os),[]),this.subsets=[];for(let ss=0;ssus&&ps.elementds.left&&usns.contains(rs))}isEmpty(){return this.subsets.every(rs=>rs.isEmpty())}complement(){return this.subsets.map(rs=>rs.complement()).reduce((rs,ns)=>rs.intersect(ns))}};let Union=Ju;zs(Union,"subsetType","union");let Interval$1=class extends Subset{constructor(rs,ns){return super(),this.left=rs,this.right=ns,this.left<=this.right?this.left===-1/0&&this.right===1/0?new RealLine:this:new EmptySet}};const bp=class extends Interval$1{constructor(rs,ns){return super(rs,ns),rs===ns?new EmptySet:this}intersect(rs){return rs.intersectWithOpenInterval(this)}intersectWithOpenInterval(rs){return new bp(Math.max(this.left,rs.left),Math.min(this.right,rs.right))}complement(){return new Union([new OpenClosedInterval(-1/0,this.left),new ClosedOpenInterval(this.right,1/0)])}isEmpty(){return this.left>=this.right}contains(rs){return rs>this.left&&rsbuildSubsetFromIntervals(os,rs)).filter(os=>os);return ss.length===0?new EmptySet:ss.length===1?ss[0]:new Union(ss)}else if(ns==="intersect"||ns==="and"){let ss=as.slice(1).map(os=>buildSubsetFromIntervals(os,rs)).filter(os=>os);return ss.length===0?new RealLine:ss.reduce((os,ls)=>os.intersect(ls))}else if(ns==="set"){let ss=as.slice(1).map(os=>buildSubsetFromIntervals(os,rs)).filter(os=>os);return ss.length===0?new EmptySet:ss.length===1?ss[0]:new Union(ss)}else if(["<","le",">","ge","=","ne"].includes(ns)){let ss=as[1],os=!1;if(!Number.isFinite(ss)){if(deepCompare(ss,rs))os=!0;else if(ss=Context.fromAst(ss).evaluate_to_constant(),!(Number.isFinite(ss)||ss===1/0||ss===-1/0))return new EmptySet}let ls=as[2],us=!1;if(!Number.isFinite(ls)){if(deepCompare(ls,rs))us=!0;else if(ls=Context.fromAst(ls).evaluate_to_constant(),!(Number.isFinite(ls)||ls===1/0||ls===-1/0))return new EmptySet}return os?us?new EmptySet:ns==="<"?new OpenInterval(-1/0,ls):ns==="le"?new OpenClosedInterval(-1/0,ls):ns===">"?new OpenInterval(ls,1/0):ns==="ge"?new ClosedOpenInterval(ls,1/0):ns==="="?Number.isFinite(ls)?new Singleton(ls):new EmptySet:Number.isFinite(ls)?new Union([new OpenInterval(-1/0,ls),new OpenInterval(ls,1/0)]):new RealLine:us?ns==="<"?new OpenInterval(ss,1/0):ns==="le"?new ClosedOpenInterval(ss,1/0):ns===">"?new OpenInterval(-1/0,ss):ns==="ge"?new OpenClosedInterval(-1/0,ss):ns==="="?Number.isFinite(ss)?new Singleton(ss):new EmptySet:Number.isFinite(ss)?new Union([new OpenInterval(-1/0,ss),new OpenInterval(ss,1/0)]):new RealLine:new EmptySet}else if(["lts","gts"].includes(ns)){let ss=as[1].slice(1),os=as[2].slice(1);if(ss.length!==3||!deepCompare(ss[1],rs))return new EmptySet;ns==="gts"&&(ss.reverse(),os.reverse());let ls=ss[0];if(!Number.isFinite(ls)&&(ls=Context.fromAst(ls).evaluate_to_constant(),!(Number.isFinite(ls)||ls===1/0||ls===-1/0)))return new EmptySet;let us=ss[2];return!Number.isFinite(us)&&(us=Context.fromAst(us).evaluate_to_constant(),!(Number.isFinite(us)||us===1/0||us===-1/0))?new EmptySet:os[0]?os[1]?new OpenInterval(ls,us):new OpenClosedInterval(ls,us):os[1]?new ClosedOpenInterval(ls,us):new ClosedInterval(ls,us)}else if(ns==="|"){let ss=as[1];return buildSubsetFromIntervals(as[2],ss)}else if(ns==="^"&&(as[2]==="C"||as[2]==="c")){let ss=buildSubsetFromIntervals(as[1],rs);return ss?ss.complement():new EmptySet}else{if(ns==="in")return deepCompare(as[1],rs)?buildSubsetFromIntervals(as[2],rs):new EmptySet;if(ns==="ni")return deepCompare(as[2],rs)?buildSubsetFromIntervals(as[1],rs):new EmptySet;if(ns==="notin"){if(deepCompare(as[1],rs)){let ss=buildSubsetFromIntervals(as[2],rs);if(ss)return ss.complement()}return new EmptySet}else if(ns==="notni"){if(deepCompare(as[2],rs)){let ss=buildSubsetFromIntervals(as[1],rs);if(ss)return ss.complement()}return new EmptySet}else{let ss=Context.fromAst(as).evaluate_to_constant();return Number.isFinite(ss)?new Singleton(ss):new EmptySet}}}function buildSubsetFromMathExpression(as,rs){return buildSubsetFromIntervals(as.to_intervals().tree,rs.tree)}function deepClone(as,rs,ns){if(Object(as)!==as||as instanceof Function||rs!==void 0&&as instanceof rs)return as;if(as instanceof Context.class||as instanceof theModule.Subset)return as.copy();if(ns===void 0&&(ns=new WeakMap),Array.isArray(as))return[...as.map(os=>deepClone(os,rs,ns))];if(as.constructor===Object&&Object.entries(as).length===0)return{};if(ns.has(as))return ns.get(as);try{var ss=new as.constructor}catch{ss=Object.create(Object.getPrototypeOf(as))}return as instanceof Map?Array.from(as,([os,ls])=>ss.set(deepClone(os,rs,ns),deepClone(ls,rs,ns))):as instanceof Set&&Array.from(as,os=>ss.add(deepClone(os,rs,ns))),ns.set(as,ss),Object.assign(ss,...Object.keys(as).map(os=>({[os]:deepClone(as[os],rs,ns)})))}function deepCompare(as,rs,ns){var ss,os;function ls(us,cs){var ds;if(Number.isNaN(us)&&Number.isNaN(cs)||us===cs)return!0;if(ns!==void 0&&us instanceof ns&&cs instanceof ns)return us.componentName===cs.componentName;if(us instanceof Context.class&&cs instanceof Context.class)return ls(us.tree,cs.tree);if(typeof us=="function"&&typeof cs=="function"||us instanceof Date&&cs instanceof Date||us instanceof RegExp&&cs instanceof RegExp||us instanceof String&&cs instanceof String||us instanceof Number&&cs instanceof Number)return us.toString()===cs.toString();if(!(us instanceof Object&&cs instanceof Object)||us.isPrototypeOf(cs)||cs.isPrototypeOf(us)||us.constructor!==cs.constructor||us.prototype!==cs.prototype||ss.indexOf(us)>-1||os.indexOf(cs)>-1)return!1;for(ds in cs){if(cs.hasOwnProperty(ds)!==us.hasOwnProperty(ds))return!1;if(typeof cs[ds]!=typeof us[ds])return!1}for(ds in us){if(cs.hasOwnProperty(ds)!==us.hasOwnProperty(ds))return!1;if(typeof cs[ds]!=typeof us[ds])return!1;switch(typeof us[ds]){case"object":case"function":if(ss.push(us),os.push(cs),!ls(us[ds],cs[ds]))return!1;ss.pop(),os.pop();break;default:if(us[ds]!==cs[ds]&&!(Number.isNaN(us[ds])&&Number.isNaN(cs[ds])))return!1;break}}return!0}return ss=[],os=[],ls(as,rs)}function breakStringsAndOthersIntoComponentsByStringCommas(as){return null}function returnBreakStringsSugarFunction({childrenToComponentFunction:as,mustStripOffOuterParentheses:rs=!1}){return function({matchedChildren:ns}){let ss=0,os=[],ls=[],us=!1,cs=ns.length;if(rs){let ps=ns[0];if(typeof ps!="string"||ps.trimLeft()[0]!=="(")return{success:!1}}for(let[ps,fs]of ns.entries()){if(typeof fs!="string"){ls.push(fs);continue}let hs=fs.trim();if(ps===0&&rs&&hs[0]==="("){let ys=ns[cs-1];if(typeof ys=="string"){let bs=ys.trimRight();bs[bs.length-1]===")"&&(us=!0,hs=hs.substring(1))}}let gs=0;for(let ys=0;ysgs&&ls.push(hs.substring(gs,ys)),os.push(ls),ls=[],gs=ys+1)}hs.length>gs&&ls.push(hs.substring(gs,hs.length))}return ss!==0?{success:!1}:(os.push(ls),{success:!0,newChildren:os.map(as)})}}function breakEmbeddedStringByCommas({childrenList:as}){let rs=0,ns=[],ss=[];for(let os of as){if(typeof os!="string"){ss.push(os);continue}let ls=os.trim(),us=0;for(let cs=0;csus){let ps=ls.substring(us,cs).trim();ss.push(ps)}ns.push(ss),ss=[],us=cs+1}}if(ls.length>us){let cs=ls.substring(us,ls.length).trim();ss.push(cs)}}return rs!==0?{success:!1}:(ns.push(ss),{success:!0,pieces:ns})}function breakEmbeddedStringsIntoParensPieces({componentList:as,removeParens:rs=!1}){let ns=0,ss=[],os=[];for(let ls of as){if(typeof ls!="string"){ns===0?ss.push([ls]):os.push(ls);continue}let us=ls.trim(),cs=0;for(let ds=0;dscs){let fs=rs?ds:ds+1,hs=us.substring(cs,fs).trim();hs.length>0&&os.push(hs)}ss.push(os),os=[],cs=ds+1}ns--}else if(ns===0&&!ps.match(/\s/))return{success:!1}}if(us.length>cs){let ds=us.substring(cs,us.length).trim();os.push(ds)}}return ns!==0?{success:!1}:(os.length>0&&ss.push(os),{success:!0,pieces:ss})}const DefaultBufferLength=1024;let nextPropID=0;class Range{constructor(rs,ns){this.from=rs,this.to=ns}}class NodeProp{constructor(rs={}){this.id=nextPropID++,this.perNode=!!rs.perNode,this.deserialize=rs.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(rs){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof rs!="function"&&(rs=NodeType.match(rs)),ns=>{let ss=rs(ns);return ss===void 0?null:[this,ss]}}}NodeProp.closedBy=new NodeProp({deserialize:as=>as.split(" ")});NodeProp.openedBy=new NodeProp({deserialize:as=>as.split(" ")});NodeProp.group=new NodeProp({deserialize:as=>as.split(" ")});NodeProp.contextHash=new NodeProp({perNode:!0});NodeProp.lookAhead=new NodeProp({perNode:!0});NodeProp.mounted=new NodeProp({perNode:!0});const noProps=Object.create(null);class NodeType{constructor(rs,ns,ss,os=0){this.name=rs,this.props=ns,this.id=ss,this.flags=os}static define(rs){let ns=rs.props&&rs.props.length?Object.create(null):noProps,ss=(rs.top?1:0)|(rs.skipped?2:0)|(rs.error?4:0)|(rs.name==null?8:0),os=new NodeType(rs.name||"",ns,rs.id,ss);if(rs.props){for(let ls of rs.props)if(Array.isArray(ls)||(ls=ls(os)),ls){if(ls[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");ns[ls[0].id]=ls[1]}}return os}prop(rs){return this.props[rs.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(rs){if(typeof rs=="string"){if(this.name==rs)return!0;let ns=this.prop(NodeProp.group);return ns?ns.indexOf(rs)>-1:!1}return this.id==rs}static match(rs){let ns=Object.create(null);for(let ss in rs)for(let os of ss.split(" "))ns[os]=rs[ss];return ss=>{for(let os=ss.prop(NodeProp.group),ls=-1;ls<(os?os.length:0);ls++){let us=ns[ls<0?ss.name:os[ls]];if(us)return us}}}}NodeType.none=new NodeType("",Object.create(null),0,8);class NodeSet{constructor(rs){this.types=rs;for(let ns=0;nsus.node;;){let ds=!1;if(us.from<=ls&&us.to>=os&&(us.type.isAnonymous||ns(us.type,us.from,us.to,cs)!==!1)){if(us.firstChild())continue;us.type.isAnonymous||(ds=!0)}for(;ds&&ss&&ss(us.type,us.from,us.to,cs),ds=us.type.isAnonymous,!us.nextSibling();){if(!us.parent())return;ds=!0}}}prop(rs){return rs.perNode?this.props?this.props[rs.id]:void 0:this.type.prop(rs)}get propValues(){let rs=[];if(this.props)for(let ns in this.props)rs.push([+ns,this.props[ns]]);return rs}balance(rs={}){return this.children.length<=8?this:balanceRange(NodeType.none,this.children,this.positions,0,this.children.length,0,this.length,(ns,ss,os)=>new Tree(this.type,ns,ss,os,this.propValues),rs.makeTree||((ns,ss,os)=>new Tree(NodeType.none,ns,ss,os)))}static build(rs){return buildTree(rs)}}Tree.empty=new Tree(NodeType.none,[],[],0);class FlatBufferCursor{constructor(rs,ns){this.buffer=rs,this.index=ns}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new FlatBufferCursor(this.buffer,this.index)}}class TreeBuffer{constructor(rs,ns,ss){this.buffer=rs,this.length=ns,this.set=ss}get type(){return NodeType.none}toString(){let rs=[];for(let ns=0;ns0));ds=us[ds+3]);return cs}slice(rs,ns,ss,os){let ls=this.buffer,us=new Uint16Array(ns-rs);for(let cs=rs,ds=0;cs=rs&&nsrs;case 1:return ns<=rs&&ss>rs;case 2:return ss>rs;case 4:return!0}}function enterUnfinishedNodesBefore(as,rs){let ns=as.childBefore(rs);for(;ns;){let ss=ns.lastChild;if(!ss||ss.to!=ns.to)break;ss.type.isError&&ss.from==ss.to?(as=ns,ns=ss.prevSibling):ns=ss}return as}function resolveNode(as,rs,ns,ss){for(var os;as.from==as.to||(ns<1?as.from>=rs:as.from>rs)||(ns>-1?as.to<=rs:as.to0?cs.length:-1;rs!=ps;rs+=ns){let fs=cs[rs],hs=ds[rs]+us._from;if(checkSide(os,ss,hs,hs+fs.length)){if(fs instanceof TreeBuffer){if(ls&2)continue;let gs=fs.findChild(0,fs.buffer.length,ns,ss-hs,os);if(gs>-1)return new BufferNode(new BufferContext(us,fs,rs,hs),null,gs)}else if(ls&1||!fs.type.isAnonymous||hasChild(fs)){let gs;if(!(ls&1)&&fs.props&&(gs=fs.prop(NodeProp.mounted))&&!gs.overlay)return new TreeNode(gs.tree,hs,rs,us);let ys=new TreeNode(fs,hs,rs,us);return ls&1||!ys.type.isAnonymous?ys:ys.nextChild(ns<0?fs.children.length-1:0,ns,ss,os)}}}if(ls&1||!us.type.isAnonymous||(us.index>=0?rs=us.index+ns:rs=ns<0?-1:us._parent.node.children.length,us=us._parent,!us))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this.node.children.length-1,-1,0,4)}childAfter(rs){return this.nextChild(0,1,rs,2)}childBefore(rs){return this.nextChild(this.node.children.length-1,-1,rs,-2)}enter(rs,ns,ss=!0,os=!0){let ls;if(ss&&(ls=this.node.prop(NodeProp.mounted))&&ls.overlay){let us=rs-this.from;for(let{from:cs,to:ds}of ls.overlay)if((ns>0?cs<=us:cs=us:ds>us))return new TreeNode(ls.tree,ls.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,rs,ns,os?0:2)}nextSignificantParent(){let rs=this;for(;rs.type.isAnonymous&&rs._parent;)rs=rs._parent;return rs}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get cursor(){return new TreeCursor(this)}get tree(){return this.node}toTree(){return this.node}resolve(rs,ns=0){return resolveNode(this,rs,ns,!1)}resolveInner(rs,ns=0){return resolveNode(this,rs,ns,!0)}enterUnfinishedNodesBefore(rs){return enterUnfinishedNodesBefore(this,rs)}getChild(rs,ns=null,ss=null){let os=getChildren(this,rs,ns,ss);return os.length?os[0]:null}getChildren(rs,ns=null,ss=null){return getChildren(this,rs,ns,ss)}toString(){return this.node.toString()}}function getChildren(as,rs,ns,ss){let os=as.cursor,ls=[];if(!os.firstChild())return ls;if(ns!=null){for(;!os.type.is(ns);)if(!os.nextSibling())return ls}for(;;){if(ss!=null&&os.type.is(ss))return ls;if(os.type.is(rs)&&ls.push(os.node),!os.nextSibling())return ss==null?ls:[]}}class BufferContext{constructor(rs,ns,ss,os){this.parent=rs,this.buffer=ns,this.index=ss,this.start=os}}class BufferNode{constructor(rs,ns,ss){this.context=rs,this._parent=ns,this.index=ss,this.type=rs.buffer.set.types[rs.buffer.buffer[ss]]}get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}child(rs,ns,ss){let{buffer:os}=this.context,ls=os.findChild(this.index+4,os.buffer[this.index+3],rs,ns-this.context.start,ss);return ls<0?null:new BufferNode(this.context,this,ls)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(rs){return this.child(1,rs,2)}childBefore(rs){return this.child(-1,rs,-2)}enter(rs,ns,ss,os=!0){if(!os)return null;let{buffer:ls}=this.context,us=ls.findChild(this.index+4,ls.buffer[this.index+3],ns>0?1:-1,rs-this.context.start,ns);return us<0?null:new BufferNode(this.context,this,us)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(rs){return this._parent?null:this.context.parent.nextChild(this.context.index+rs,rs,0,4)}get nextSibling(){let{buffer:rs}=this.context,ns=rs.buffer[this.index+3];return ns<(this._parent?rs.buffer[this._parent.index+3]:rs.buffer.length)?new BufferNode(this.context,this._parent,ns):this.externalSibling(1)}get prevSibling(){let{buffer:rs}=this.context,ns=this._parent?this._parent.index+4:0;return this.index==ns?this.externalSibling(-1):new BufferNode(this.context,this._parent,rs.findChild(ns,this.index,-1,0,4))}get cursor(){return new TreeCursor(this)}get tree(){return null}toTree(){let rs=[],ns=[],{buffer:ss}=this.context,os=this.index+4,ls=ss.buffer[this.index+3];if(ls>os){let us=ss.buffer[this.index+1],cs=ss.buffer[this.index+2];rs.push(ss.slice(os,ls,us,cs)),ns.push(0)}return new Tree(this.type,rs,ns,this.to-this.from)}resolve(rs,ns=0){return resolveNode(this,rs,ns,!1)}resolveInner(rs,ns=0){return resolveNode(this,rs,ns,!0)}enterUnfinishedNodesBefore(rs){return enterUnfinishedNodesBefore(this,rs)}toString(){return this.context.buffer.childString(this.index)}getChild(rs,ns=null,ss=null){let os=getChildren(this,rs,ns,ss);return os.length?os[0]:null}getChildren(rs,ns=null,ss=null){return getChildren(this,rs,ns,ss)}}class TreeCursor{constructor(rs,ns=0){if(this.mode=ns,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,rs instanceof TreeNode)this.yieldNode(rs);else{this._tree=rs.context.parent,this.buffer=rs.context;for(let ss=rs._parent;ss;ss=ss._parent)this.stack.unshift(ss.index);this.bufferNode=rs,this.yieldBuf(rs.index)}}get name(){return this.type.name}yieldNode(rs){return rs?(this._tree=rs,this.type=rs.type,this.from=rs.from,this.to=rs.to,!0):!1}yieldBuf(rs,ns){this.index=rs;let{start:ss,buffer:os}=this.buffer;return this.type=ns||os.set.types[os.buffer[rs]],this.from=ss+os.buffer[rs+1],this.to=ss+os.buffer[rs+2],!0}yield(rs){return rs?rs instanceof TreeNode?(this.buffer=null,this.yieldNode(rs)):(this.buffer=rs.context,this.yieldBuf(rs.index,rs.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(rs,ns,ss){if(!this.buffer)return this.yield(this._tree.nextChild(rs<0?this._tree.node.children.length-1:0,rs,ns,ss,this.mode));let{buffer:os}=this.buffer,ls=os.findChild(this.index+4,os.buffer[this.index+3],rs,ns-this.buffer.start,ss);return ls<0?!1:(this.stack.push(this.index),this.yieldBuf(ls))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(rs){return this.enterChild(1,rs,2)}childBefore(rs){return this.enterChild(-1,rs,-2)}enter(rs,ns,ss=!0,os=!0){return this.buffer?os?this.enterChild(1,rs,ns):!1:this.yield(this._tree.enter(rs,ns,ss&&!(this.mode&1),os))}parent(){if(!this.buffer)return this.yieldNode(this.mode&1?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let rs=this.mode&1?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(rs)}sibling(rs){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+rs,rs,0,4,this.mode)):!1;let{buffer:ns}=this.buffer,ss=this.stack.length-1;if(rs<0){let os=ss<0?0:this.stack[ss]+4;if(this.index!=os)return this.yieldBuf(ns.findChild(os,this.index,-1,0,4))}else{let os=ns.buffer[this.index+3];if(os<(ss<0?ns.buffer.length:ns.buffer[this.stack[ss]+3]))return this.yieldBuf(os)}return ss<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+rs,rs,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(rs){let ns,ss,{buffer:os}=this;if(os){if(rs>0){if(this.index-1)for(let ls=ns+rs,us=rs<0?-1:ss.node.children.length;ls!=us;ls+=rs){let cs=ss.node.children[ls];if(this.mode&1||cs instanceof TreeBuffer||!cs.type.isAnonymous||hasChild(cs))return!1}return!0}move(rs,ns){if(ns&&this.enterChild(rs,0,4))return!0;for(;;){if(this.sibling(rs))return!0;if(this.atLastNode(rs)||!this.parent())return!1}}next(rs=!0){return this.move(1,rs)}prev(rs=!0){return this.move(-1,rs)}moveTo(rs,ns=0){for(;(this.from==this.to||(ns<1?this.from>=rs:this.from>rs)||(ns>-1?this.to<=rs:this.to=0;){for(let us=rs;us;us=us._parent)if(us.index==os){if(os==this.index)return us;ns=us,ss=ls+1;break e}os=this.stack[--ls]}for(let os=ss;osrs instanceof TreeBuffer||!rs.type.isAnonymous||hasChild(rs))}function buildTree(as){var rs;let{buffer:ns,nodeSet:ss,maxBufferLength:os=DefaultBufferLength,reused:ls=[],minRepeatType:us=ss.types.length}=as,cs=Array.isArray(ns)?new FlatBufferCursor(ns,ns.length):ns,ds=ss.types,ps=0,fs=0;function hs(Ns,As,ws,Es,_s){let{id:$s,start:Rs,end:Is,size:Os}=cs,Ds=fs;for(;Os<0;)if(cs.next(),Os==-1){let Ms=ls[$s];ws.push(Ms),Es.push(Rs-Ns);return}else if(Os==-3){ps=$s;return}else if(Os==-4){fs=$s;return}else throw new RangeError(`Unrecognized record size: ${Os}`);let Vs=ds[$s],ks,Ps,Bs=Rs-Ns;if(Is-Rs<=os&&(Ps=vs(cs.pos-As,_s))){let Ms=new Uint16Array(Ps.size-Ps.skip),Ws=cs.pos-Ps.size,Us=Ms.length;for(;cs.pos>Ws;)Us=xs(Ps.start,Ms,Us);ks=new TreeBuffer(Ms,Is-Ps.start,ss),Bs=Ps.start-Ns}else{let Ms=cs.pos-Os;cs.next();let Ws=[],Us=[],js=$s>=us?$s:-1,Ls=0,Gs=Is;for(;cs.pos>Ms;)js>=0&&cs.id==js&&cs.size>=0?(cs.end<=Gs-os&&(ys(Ws,Us,Rs,Ls,cs.end,Gs,js,Ds),Ls=Ws.length,Gs=cs.end),cs.next()):hs(Rs,Ms,Ws,Us,js);if(js>=0&&Ls>0&&Ls-1&&Ls>0){let Hs=gs(Vs);ks=balanceRange(Vs,Ws,Us,0,Ws.length,0,Is-Rs,Hs,Hs)}else ks=bs(Vs,Ws,Us,Is-Rs,Ds-Is)}ws.push(ks),Es.push(Bs)}function gs(Ns){return(As,ws,Es)=>{let _s=0,$s=As.length-1,Rs,Is;if($s>=0&&(Rs=As[$s])instanceof Tree){if(!$s&&Rs.type==Ns&&Rs.length==Es)return Rs;(Is=Rs.prop(NodeProp.lookAhead))&&(_s=ws[$s]+Rs.length+Is)}return bs(Ns,As,ws,Es,_s)}}function ys(Ns,As,ws,Es,_s,$s,Rs,Is){let Os=[],Ds=[];for(;Ns.length>Es;)Os.push(Ns.pop()),Ds.push(As.pop()+ws-_s);Ns.push(bs(ss.types[Rs],Os,Ds,$s-_s,Is-$s)),As.push(_s-ws)}function bs(Ns,As,ws,Es,_s=0,$s){if(ps){let Rs=[NodeProp.contextHash,ps];$s=$s?[Rs].concat($s):[Rs]}if(_s>25){let Rs=[NodeProp.lookAhead,_s];$s=$s?[Rs].concat($s):[Rs]}return new Tree(Ns,As,ws,Es,$s)}function vs(Ns,As){let ws=cs.fork(),Es=0,_s=0,$s=0,Rs=ws.end-os,Is={size:0,start:0,skip:0};e:for(let Os=ws.pos-Ns;ws.pos>Os;){let Ds=ws.size;if(ws.id==As&&Ds>=0){Is.size=Es,Is.start=_s,Is.skip=$s,$s+=4,Es+=4,ws.next();continue}let Vs=ws.pos-Ds;if(Ds<0||Vs=us?4:0,Ps=ws.start;for(ws.next();ws.pos>Vs;){if(ws.size<0)if(ws.size==-3)ks+=4;else break e;else ws.id>=us&&(ks+=4);ws.next()}_s=Ps,Es+=Ds,$s+=ks}return(As<0||Es==Ns)&&(Is.size=Es,Is.start=_s,Is.skip=$s),Is.size>4?Is:void 0}function xs(Ns,As,ws){let{id:Es,start:_s,end:$s,size:Rs}=cs;if(cs.next(),Rs>=0&&Es4){let Os=cs.pos-(Rs-4);for(;cs.pos>Os;)ws=xs(Ns,As,ws)}As[--ws]=Is,As[--ws]=$s-Ns,As[--ws]=_s-Ns,As[--ws]=Es}else Rs==-3?ps=Es:Rs==-4&&(fs=Es);return ws}let Cs=[],Ts=[];for(;cs.pos>0;)hs(as.start||0,as.bufferStart||0,Cs,Ts,-1);let Ss=(rs=as.length)!==null&&rs!==void 0?rs:Cs.length?Ts[0]+Cs[0].length:0;return new Tree(ds[as.topID],Cs.reverse(),Ts.reverse(),Ss)}const nodeSizeCache=new WeakMap;function nodeSize(as,rs){if(!as.isAnonymous||rs instanceof TreeBuffer||rs.type!=as)return 1;let ns=nodeSizeCache.get(rs);if(ns==null){ns=1;for(let ss of rs.children){if(ss.type!=as||!(ss instanceof Tree)){ns=1;break}ns+=nodeSize(as,ss)}nodeSizeCache.set(rs,ns)}return ns}function balanceRange(as,rs,ns,ss,os,ls,us,cs,ds){let ps=0;for(let bs=ss;bs=fs)break;ws+=Es}if(Ss==Ns+1){if(ws>fs){let Es=bs[Ns];ys(Es.children,Es.positions,0,Es.children.length,vs[Ns]+Ts);continue}hs.push(bs[Ns])}else{let Es=vs[Ss-1]+bs[Ss-1].length-As;hs.push(balanceRange(as,bs,vs,Ns,Ss,As,Es,null,ds))}gs.push(As+Ts-ls)}}return ys(rs,ns,ss,os,0),(cs||ds)(hs,gs,us)}class TreeFragment{constructor(rs,ns,ss,os,ls=!1,us=!1){this.from=rs,this.to=ns,this.tree=ss,this.offset=os,this.open=(ls?1:0)|(us?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(rs,ns=[],ss=!1){let os=[new TreeFragment(0,rs.length,rs,0,!1,ss)];for(let ls of ns)ls.to>rs.length&&os.push(ls);return os}static applyChanges(rs,ns,ss=128){if(!ns.length)return rs;let os=[],ls=1,us=rs.length?rs[0]:null;for(let cs=0,ds=0,ps=0;;cs++){let fs=cs=ss)for(;us&&us.from=gs.from||hs<=gs.to||ps){let ys=Math.max(gs.from,ds)-ps,bs=Math.min(gs.to,hs)-ps;gs=ys>=bs?null:new TreeFragment(ys,bs,gs.tree,gs.offset+ps,cs>0,!!fs)}if(gs&&os.push(gs),us.to>hs)break;us=lsnew Range(os.from,os.to)):[new Range(0,0)]:[new Range(0,rs.length)],this.createParse(rs,ns||[],ss)}parse(rs,ns,ss){let os=this.startParse(rs,ns,ss);for(;;){let ls=os.advance();if(ls)return ls}}};class StringInput{constructor(rs){this.string=rs}get length(){return this.string.length}chunk(rs){return this.string.slice(rs)}get lineChunks(){return!1}read(rs,ns){return this.string.slice(rs,ns)}}new NodeProp({perNode:!0});let Stack$1=class mp{constructor(rs,ns,ss,os,ls,us,cs,ds,ps,fs=0,hs){this.p=rs,this.stack=ns,this.state=ss,this.reducePos=os,this.pos=ls,this.score=us,this.buffer=cs,this.bufferBase=ds,this.curContext=ps,this.lookAhead=fs,this.parent=hs}toString(){return`[${this.stack.filter((rs,ns)=>ns%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(rs,ns,ss=0){let os=rs.parser.context;return new mp(rs,[],ns,ss,ss,0,[],0,os?new StackContext(os,os.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(rs,ns){this.stack.push(this.state,ns,this.bufferBase+this.buffer.length),this.state=rs}reduce(rs){let ns=rs>>19,ss=rs&65535,{parser:os}=this.p,ls=os.dynamicPrecedence(ss);if(ls&&(this.score+=ls),ns==0){this.pushState(os.getGoto(this.state,ss,!0),this.reducePos),ssus;)this.stack.pop();this.reduceContext(ss,cs)}storeNode(rs,ns,ss,os=4,ls=!1){if(rs==0){let us=this,cs=this.buffer.length;if(cs==0&&us.parent&&(cs=us.bufferBase-us.parent.bufferBase,us=us.parent),cs>0&&us.buffer[cs-4]==0&&us.buffer[cs-1]>-1){if(ns==ss)return;if(us.buffer[cs-2]>=ns){us.buffer[cs-2]=ss;return}}}if(!ls||this.pos==ss)this.buffer.push(rs,ns,ss,os);else{let us=this.buffer.length;if(us>0&&this.buffer[us-4]!=0)for(;us>0&&this.buffer[us-2]>ss;)this.buffer[us]=this.buffer[us-4],this.buffer[us+1]=this.buffer[us-3],this.buffer[us+2]=this.buffer[us-2],this.buffer[us+3]=this.buffer[us-1],us-=4,os>4&&(os-=4);this.buffer[us]=rs,this.buffer[us+1]=ns,this.buffer[us+2]=ss,this.buffer[us+3]=os}}shift(rs,ns,ss){let os=this.pos;if(rs&131072)this.pushState(rs&65535,this.pos);else if(rs&262144)this.pos=ss,this.shiftContext(ns,os),ns<=this.p.parser.maxNode&&this.buffer.push(ns,os,ss,4);else{let ls=rs,{parser:us}=this.p;(ss>this.pos||ns<=us.maxNode)&&(this.pos=ss,us.stateFlag(ls,1)||(this.reducePos=ss)),this.pushState(ls,os),this.shiftContext(ns,os),ns<=us.maxNode&&this.buffer.push(ns,os,ss,4)}}apply(rs,ns,ss){rs&65536?this.reduce(rs):this.shift(rs,ns,ss)}useNode(rs,ns){let ss=this.p.reused.length-1;(ss<0||this.p.reused[ss]!=rs)&&(this.p.reused.push(rs),ss++);let os=this.pos;this.reducePos=this.pos=os+rs.length,this.pushState(ns,os),this.buffer.push(ss,os,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,rs,this,this.p.stream.reset(this.pos-rs.length)))}split(){let rs=this,ns=rs.buffer.length;for(;ns>0&&rs.buffer[ns-2]>rs.reducePos;)ns-=4;let ss=rs.buffer.slice(ns),os=rs.bufferBase+ns;for(;rs&&os==rs.bufferBase;)rs=rs.parent;return new mp(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,ss,os,this.curContext,this.lookAhead,rs)}recoverByDelete(rs,ns){let ss=rs<=this.p.parser.maxNode;ss&&this.storeNode(rs,this.pos,ns,4),this.storeNode(0,this.pos,ns,ss?8:4),this.pos=this.reducePos=ns,this.score-=190}canShift(rs){for(let ns=new SimulatedStack(this);;){let ss=this.p.parser.stateSlot(ns.state,4)||this.p.parser.hasAction(ns.state,rs);if(!(ss&65536))return!0;if(ss==0)return!1;ns.reduce(ss)}}recoverByInsert(rs){if(this.stack.length>=300)return[];let ns=this.p.parser.nextStates(this.state);if(ns.length>4<<1||this.stack.length>=120){let os=[];for(let ls=0,us;lsds&1&&cs==us)||os.push(ns[ls],us)}ns=os}let ss=[];for(let os=0;os>19,os=rs&65535,ls=this.stack.length-ss*3;if(ls<0||ns.getGoto(this.stack[ls],os,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reduce(rs),!0}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:rs}=this.p;return rs.data[rs.stateSlot(this.state,1)]==65535&&!rs.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(rs){if(this.state!=rs.state||this.stack.length!=rs.stack.length)return!1;for(let ns=0;nsthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=rs)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}};class StackContext{constructor(rs,ns){this.tracker=rs,this.context=ns,this.hash=rs.strict?rs.hash(ns):0}}var Recover;(function(as){as[as.Insert=200]="Insert",as[as.Delete=190]="Delete",as[as.Reduce=100]="Reduce",as[as.MaxNext=4]="MaxNext",as[as.MaxInsertStackDepth=300]="MaxInsertStackDepth",as[as.DampenInsertStackDepth=120]="DampenInsertStackDepth"})(Recover||(Recover={}));class SimulatedStack{constructor(rs){this.start=rs,this.state=rs.state,this.stack=rs.stack,this.base=this.stack.length}reduce(rs){let ns=rs&65535,ss=rs>>19;ss==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(ss-1)*3;let os=this.start.p.parser.getGoto(this.stack[this.base-3],ns,!0);this.state=os}}class StackBufferCursor{constructor(rs,ns,ss){this.stack=rs,this.pos=ns,this.index=ss,this.buffer=rs.buffer,this.index==0&&this.maybeNext()}static create(rs,ns=rs.bufferBase+rs.buffer.length){return new StackBufferCursor(rs,ns,ns-rs.bufferBase)}maybeNext(){let rs=this.stack.parent;rs!=null&&(this.index=this.stack.bufferBase-rs.bufferBase,this.stack=rs,this.buffer=rs.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new StackBufferCursor(this.stack,this.pos,this.index)}}class CachedToken{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const nullToken=new CachedToken;class InputStream{constructor(rs,ns){this.input=rs,this.ranges=ns,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=nullToken,this.rangeIndex=0,this.pos=this.chunkPos=ns[0].from,this.range=ns[0],this.end=ns[ns.length-1].to,this.readNext()}resolveOffset(rs,ns){let ss=this.range,os=this.rangeIndex,ls=this.pos+rs;for(;lsss.to:ls>=ss.to;){if(os==this.ranges.length-1)return null;let us=this.ranges[++os];ls+=us.from-ss.to,ss=us}return ls}peek(rs){let ns=this.chunkOff+rs,ss,os;if(ns>=0&&ns=this.chunk2Pos&&sscs.to&&(this.chunk2=this.chunk2.slice(0,cs.to-ss)),os=this.chunk2.charCodeAt(0)}}return ss>=this.token.lookAhead&&(this.token.lookAhead=ss+1),os}acceptToken(rs,ns=0){let ss=ns?this.resolveOffset(ns,-1):this.pos;if(ss==null||ss=this.chunk2Pos&&this.posthis.range.to?rs.slice(0,this.range.to-this.pos):rs,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(rs=1){for(this.chunkOff+=rs;this.pos+rs>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();rs-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=rs,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(rs,ns){if(ns?(this.token=ns,ns.start=rs,ns.lookAhead=rs+1,ns.value=ns.extended=-1):this.token=nullToken,this.pos!=rs){if(this.pos=rs,rs==this.end)return this.setDone(),this;for(;rs=this.range.to;)this.range=this.ranges[++this.rangeIndex];rs>=this.chunkPos&&rs=this.chunkPos&&ns<=this.chunkPos+this.chunk.length)return this.chunk.slice(rs-this.chunkPos,ns-this.chunkPos);if(rs>=this.chunk2Pos&&ns<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(rs-this.chunk2Pos,ns-this.chunk2Pos);if(rs>=this.range.from&&ns<=this.range.to)return this.input.read(rs,ns);let ss="";for(let os of this.ranges){if(os.from>=ns)break;os.to>rs&&(ss+=this.input.read(Math.max(os.from,rs),Math.min(os.to,ns)))}return ss}}class TokenGroup{constructor(rs,ns){this.data=rs,this.id=ns}token(rs,ns){readToken(this.data,rs,ns,this.id)}}TokenGroup.prototype.contextual=TokenGroup.prototype.fallback=TokenGroup.prototype.extend=!1;class ExternalTokenizer{constructor(rs,ns={}){this.token=rs,this.contextual=!!ns.contextual,this.fallback=!!ns.fallback,this.extend=!!ns.extend}}function readToken(as,rs,ns,ss){let os=0,ls=1<0){let fs=as[ps];if(cs.allows(fs)&&(rs.token.value==-1||rs.token.value==fs||us.overrides(fs,rs.token.value))){rs.acceptToken(fs);break}}for(let ps=rs.next,fs=0,hs=as[os+2];fs>1,ys=ds+gs+(gs<<1),bs=as[ys],vs=as[ys+1];if(ps=vs)fs=gs+1;else{os=as[ys+2],rs.advance();continue e}}break}}function decodeArray(as,rs=Uint16Array){if(typeof as!="string")return as;let ns=null;for(let ss=0,os=0;ss=92&&us--,us>=34&&us--;let ds=us-32;if(ds>=46&&(ds-=46,cs=!0),ls+=ds,cs)break;ls*=46}ns?ns[os++]=ls:ns=new rs(ls)}return ns}const verbose=typeof browser$1$2<"u"&&/\bparse\b/.test({}.LOG);let stackIDs=null;var Safety;(function(as){as[as.Margin=25]="Margin"})(Safety||(Safety={}));function cutAt(as,rs,ns){let ss=as.fullCursor();for(ss.moveTo(rs);;)if(!(ns<0?ss.childBefore(rs):ss.childAfter(rs)))for(;;){if((ns<0?ss.tors)&&!ss.type.isError)return ns<0?Math.max(0,Math.min(ss.to-1,rs-25)):Math.min(as.length,Math.max(ss.from+1,rs+25));if(ns<0?ss.prevSibling():ss.nextSibling())break;if(!ss.parent())return ns<0?0:as.length}}class FragmentCursor{constructor(rs,ns){this.fragments=rs,this.nodeSet=ns,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let rs=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(rs){for(this.safeFrom=rs.openStart?cutAt(rs.tree,rs.from+rs.offset,1)-rs.offset:rs.from,this.safeTo=rs.openEnd?cutAt(rs.tree,rs.to+rs.offset,-1)-rs.offset:rs.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(rs.tree),this.start.push(-rs.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(rs){if(rsrs)return this.nextStart=us,null;if(ls instanceof Tree){if(us==rs){if(us=Math.max(this.safeFrom,rs)&&(this.trees.push(ls),this.start.push(us),this.index.push(0))}else this.index[ns]++,this.nextStart=us+ls.length}}}class TokenCache{constructor(rs,ns){this.stream=ns,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=rs.tokenizers.map(ss=>new CachedToken)}getActions(rs){let ns=0,ss=null,{parser:os}=rs.p,{tokenizers:ls}=os,us=os.stateSlot(rs.state,3),cs=rs.curContext?rs.curContext.hash:0,ds=0;for(let ps=0;pshs.end+25&&(ds=Math.max(hs.lookAhead,ds)),hs.value!=0)){let gs=ns;if(hs.extended>-1&&(ns=this.addActions(rs,hs.extended,hs.end,ns)),ns=this.addActions(rs,hs.value,hs.end,ns),!fs.extend&&(ss=hs,ns>gs))break}}for(;this.actions.length>ns;)this.actions.pop();return ds&&rs.setLookAhead(ds),!ss&&rs.pos==this.stream.end&&(ss=new CachedToken,ss.value=rs.p.parser.eofTerm,ss.start=ss.end=rs.pos,ns=this.addActions(rs,ss.value,ss.end,ns)),this.mainToken=ss,this.actions}getMainToken(rs){if(this.mainToken)return this.mainToken;let ns=new CachedToken,{pos:ss,p:os}=rs;return ns.start=ss,ns.end=Math.min(ss+1,os.stream.end),ns.value=ss==os.stream.end?os.parser.eofTerm:0,ns}updateCachedToken(rs,ns,ss){if(ns.token(this.stream.reset(ss.pos,rs),ss),rs.value>-1){let{parser:os}=ss.p;for(let ls=0;ls=0&&ss.p.parser.dialect.allows(us>>1)){us&1?rs.extended=us>>1:rs.value=us>>1;break}}}else rs.value=0,rs.end=Math.min(ss.p.stream.end,ss.pos+1)}putAction(rs,ns,ss,os){for(let ls=0;lsrs.bufferLength*4?new FragmentCursor(ss,rs.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let rs=this.stacks,ns=this.minStackPos,ss=this.stacks=[],os,ls;for(let us=0;usns)ss.push(cs);else{if(this.advanceStack(cs,ss,rs))continue;{os||(os=[],ls=[]),os.push(cs);let ds=this.tokens.getMainToken(cs);ls.push(ds.value,ds.end)}}break}}if(!ss.length){let us=os&&findFinished(os);if(us)return this.stackToTree(us);if(this.parser.strict)throw verbose&&os&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+ns);this.recovering||(this.recovering=5)}if(this.recovering&&os){let us=this.stoppedAt!=null&&os[0].pos>this.stoppedAt?os[0]:this.runRecovery(os,ls,ss);if(us)return this.stackToTree(us.forceAll())}if(this.recovering){let us=this.recovering==1?1:this.recovering*3;if(ss.length>us)for(ss.sort((cs,ds)=>ds.score-cs.score);ss.length>us;)ss.pop();ss.some(cs=>cs.reducePos>ns)&&this.recovering--}else if(ss.length>1)e:for(let us=0;us500&&ps.buffer.length>500)if((cs.score-ps.score||cs.buffer.length-ps.buffer.length)>0)ss.splice(ds--,1);else{ss.splice(us--,1);continue e}}}this.minStackPos=ss[0].pos;for(let us=1;us ":"";if(this.stoppedAt!=null&&os>this.stoppedAt)return rs.forceReduce()?rs:null;if(this.fragments){let ps=rs.curContext&&rs.curContext.tracker.strict,fs=ps?rs.curContext.hash:0;for(let hs=this.fragments.nodeAt(os);hs;){let gs=this.parser.nodeSet.types[hs.type.id]==hs.type?ls.getGoto(rs.state,hs.type.id):-1;if(gs>-1&&hs.length&&(!ps||(hs.prop(NodeProp.contextHash)||0)==fs))return rs.useNode(hs,gs),verbose&&console.log(us+this.stackID(rs)+` (via reuse of ${ls.getName(hs.type.id)})`),!0;if(!(hs instanceof Tree)||hs.children.length==0||hs.positions[0]>0)break;let ys=hs.children[0];if(ys instanceof Tree&&hs.positions[0]==0)hs=ys;else break}}let cs=ls.stateSlot(rs.state,4);if(cs>0)return rs.reduce(cs),verbose&&console.log(us+this.stackID(rs)+` (via always-reduce ${ls.getName(cs&65535)})`),!0;if(rs.stack.length>=15e3)for(;rs.stack.length>9e3&&rs.forceReduce(););let ds=this.tokens.getActions(rs);for(let ps=0;psos?ns.push(bs):ss.push(bs)}return!1}advanceFully(rs,ns){let ss=rs.pos;for(;;){if(!this.advanceStack(rs,null,null))return!1;if(rs.pos>ss)return pushStackDedup(rs,ns),!0}}runRecovery(rs,ns,ss){let os=null,ls=!1;for(let us=0;us ":"";if(cs.deadEnd&&(ls||(ls=!0,cs.restart(),verbose&&console.log(fs+this.stackID(cs)+" (restarted)"),this.advanceFully(cs,ss))))continue;let hs=cs.split(),gs=fs;for(let ys=0;hs.forceReduce()&&ys<10&&(verbose&&console.log(gs+this.stackID(hs)+" (via force-reduce)"),!this.advanceFully(hs,ss));ys++)verbose&&(gs=this.stackID(hs)+" -> ");for(let ys of cs.recoverByInsert(ds))verbose&&console.log(fs+this.stackID(ys)+" (via recover-insert)"),this.advanceFully(ys,ss);this.stream.end>cs.pos?(ps==cs.pos&&(ps++,ds=0),cs.recoverByDelete(ds,ps),verbose&&console.log(fs+this.stackID(cs)+` (via recover-delete ${this.parser.getName(ds)})`),pushStackDedup(cs,ss)):(!os||os.scoreas;class ContextTracker{constructor(rs){this.start=rs.start,this.shift=rs.shift||id,this.reduce=rs.reduce||id,this.reuse=rs.reuse||id,this.hash=rs.hash||(()=>0),this.strict=rs.strict!==!1}}class LRParser extends Parser$1{constructor(rs){if(super(),this.wrappers=[],rs.version!=13)throw new RangeError(`Parser version (${rs.version}) doesn't match runtime version (13)`);let ns=rs.nodeNames.split(" ");this.minRepeatTerm=ns.length;for(let cs=0;csrs.topRules[cs][1]),os=[];for(let cs=0;cs=0)ls(fs,ds,cs[ps++]);else{let hs=cs[ps+-fs];for(let gs=-fs;gs>0;gs--)ls(cs[ps++],ds,hs);ps++}}}this.nodeSet=new NodeSet(ns.map((cs,ds)=>NodeType.define({name:ds>=this.minRepeatTerm?void 0:cs,id:ds,props:os[ds],top:ss.indexOf(ds)>-1,error:ds==0,skipped:rs.skippedNodes&&rs.skippedNodes.indexOf(ds)>-1}))),this.strict=!1,this.bufferLength=DefaultBufferLength;let us=decodeArray(rs.tokenData);if(this.context=rs.context,this.specialized=new Uint16Array(rs.specialized?rs.specialized.length:0),this.specializers=[],rs.specialized)for(let cs=0;cstypeof cs=="number"?new TokenGroup(us,cs):cs),this.topRules=rs.topRules,this.dialects=rs.dialects||{},this.dynamicPrecedences=rs.dynamicPrecedences||null,this.tokenPrecTable=rs.tokenPrec,this.termNames=rs.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(rs,ns,ss){let os=new Parse(this,rs,ns,ss);for(let ls of this.wrappers)os=ls(os,rs,ns,ss);return os}getGoto(rs,ns,ss=!1){let os=this.goto;if(ns>=os[0])return-1;for(let ls=os[ns+1];;){let us=os[ls++],cs=us&1,ds=os[ls++];if(cs&&ss)return ds;for(let ps=ls+(us>>1);ls0}validAction(rs,ns){if(ns==this.stateSlot(rs,4))return!0;for(let ss=this.stateSlot(rs,1);;ss+=3){if(this.data[ss]==65535)if(this.data[ss+1]==1)ss=pair(this.data,ss+2);else return!1;if(ns==pair(this.data,ss+1))return!0}}nextStates(rs){let ns=[];for(let ss=this.stateSlot(rs,1);;ss+=3){if(this.data[ss]==65535)if(this.data[ss+1]==1)ss=pair(this.data,ss+2);else break;if(!(this.data[ss+2]&1)){let os=this.data[ss+1];ns.some((ls,us)=>us&1&&ls==os)||ns.push(this.data[ss],os)}}return ns}overrides(rs,ns){let ss=findOffset(this.data,this.tokenPrecTable,ns);return ss<0||findOffset(this.data,this.tokenPrecTable,rs){let os=rs.tokenizers.find(ls=>ls.from==ss);return os?os.to:ss})),rs.contextTracker&&(ns.context=rs.contextTracker),rs.dialect&&(ns.dialect=this.parseDialect(rs.dialect)),rs.strict!=null&&(ns.strict=rs.strict),rs.wrap&&(ns.wrappers=ns.wrappers.concat(rs.wrap)),rs.bufferLength!=null&&(ns.bufferLength=rs.bufferLength),ns}getName(rs){return this.termNames?this.termNames[rs]:String(rs<=this.maxNode&&this.nodeSet.types[rs].name||rs)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(rs){let ns=this.dynamicPrecedences;return ns==null?0:ns[rs]||0}parseDialect(rs){let ns=Object.keys(this.dialects),ss=ns.map(()=>!1);if(rs)for(let ls of rs.split(" ")){let us=ns.indexOf(ls);us>=0&&(ss[us]=!0)}let os=null;for(let ls=0;lsss)&&ns.p.parser.stateFlag(ns.state,2)&&(!rs||rs.score=65&&as<=90||as==95||as>=97&&as<=122||as>=161}function isSpace(as){return as==9||as==10||as==13||as==32}let cachedName=null,cachedInput=null,cachedPos=0;function tagNameAfter(as,rs){let ns=as.pos+rs;if(cachedInput==as&&cachedPos==ns)return cachedName;for(;isSpace(as.peek(rs));)rs++;let ss="";for(;;){let os=as.peek(rs);if(!nameChar(os))break;ss+=String.fromCharCode(os),rs++}return cachedInput=as,cachedPos=ns,cachedName=ss||null}function ElementContext(as,rs){this.name=as,this.parent=rs,this.hash=rs?rs.hash:0;for(let ns=0;ns{if(as.next==60){if(as.advance(),as.next==47){as.advance();let ns=tagNameAfter(as,0);if(!ns)return as.acceptToken(incompleteStartCloseTag);if(rs.context&&ns.toLowerCase()==rs.context.name.toLowerCase())return as.acceptToken(StartCloseTag);for(let ss=rs.context;ss;ss=ss.parent)if(ss.name==ns)return as.acceptToken(MissingCloseTag,-2);as.acceptToken(mismatchedStartCloseTag)}else if(as.next!=33&&as.next!=63&&!isSpace(as.next))return as.acceptToken(StartTag)}},{contextual:!0});function scanTo(as,rs){return new ExternalTokenizer(ns=>{for(let ss=0,os=0;;os++){if(ns.next<0){os&&ns.acceptToken(as);break}if(ns.next==rs.charCodeAt(ss)){if(ss++,ss==rs.length){os>rs.length&&ns.acceptToken(as,1-rs.length);break}}else ss=0;ns.advance()}})}const commentContent=scanTo(commentContent$1,"-->"),parser=LRParser.deserialize({version:13,states:"*[OQOTOOO]OYO'#CdOeO`O'#CfO!OOTO'#CeOOOP'#Ce'#CeOOOP'#Cx'#CxOOOP'#Co'#CoQQOTOOOOOQ'#Cp'#CpO!VOYO,59OOOOP,59O,59OO!_OpO,59QO!mO`O'#ClOOOP'#DT'#DTOOOP'#Cu'#CuO!rOTO,59PO!yO`O'#CmOOOP,59P,59POOOP-E6m-E6mOOOQ-E6n-E6nOOOP1G.j1G.jOOOO'#Cq'#CqO#ROpO1G.lO#aOpO'#ChOOOO'#Cr'#CrO#rOpO1G.lOOOP1G.l1G.lOOOP1G.t1G.tO#}OWO,59WOOOP-E6s-E6sOOOP1G.k1G.kO$SO`O,59XO$[OWO,59XOOOO-E6o-E6oO$dOpO7+$WOOOP7+$W7+$WOOOP7+$`7+$`O$oOpO,59SO%QOWO,59SOOOO-E6p-E6pOOOP1G.r1G.rO%]OWO1G.sO%]OWO1G.sOOOP1G.s1G.sOOOP< tag. Found ${as.slice(ds-1,bs)}`)}us.firstChild();let gs=as.substring(us.from,us.to);if(us.nextSibling()===!1){if(gs in ps)throw Error(`Duplicate attribute ${gs}. Found in component of type ${cs} at indices ${us.from}-${us.to}`);ps[gs]=!0}else{us.nextSibling();let ys=as.substring(us.from+1,us.to-1);if(gs in ps)throw Error(`Duplicate attribute ${gs}. Found in component of type ${cs} at indices ${us.from}-${us.to}`);ps[gs]=ys}us.parent()}us.parent();let fs=us.to,hs={componentType:cs,props:{...ps},children:[]};for(;us.nextSibling();)if(us.name==="Text"){let gs=as.substring(us.from,us.to);gs!==""&&hs.children.push(gs)}else if(us.name==="Element")hs.children.push(rs(us.node.cursor));else{if(us.name==="CloseTag")break;if(us.name==="Comment")continue;throw us.name==="MismatchedCloseTag"?Error(`Invalid DoenetML at position ${us.from}. Mismatched closing tag. Expected . Found ${as.slice(us.from,us.to)}.`):Error(`Invalid DoenetML at position ${us.from}. Expected a closing tag. Instead found ${as.slice(us.from,us.to)}.`)}return hs.range={openBegin:ds,openEnd:fs,closeBegin:us.from,closeEnd:us.to},hs}else if(us.name==="SelfClosingTag"){us.firstChild(),us.nextSibling();let cs=as.substring(us.from,us.to),ds=us.from,ps={};for(;us.nextSibling();){if(us.name!=="Attribute")throw Error(`Invalid DoenetML at positions ${us.from} to ${us.to}. Error in self-closing <${cs}/> tag.`);us.firstChild();let hs=as.substring(us.from,us.to);if(us.nextSibling()===!1){if(hs in ps)throw Error(`Duplicate attribute ${hs}. Found in component of type ${cs} at indices ${us.from}-${us.to}`);ps[hs]=!0}else{if(us.nextSibling(),hs in ps)throw Error(`Duplicate attribute ${hs}. Found in component of type ${cs} at indices ${us.from}-${us.to}`);let gs=as.substring(us.from+1,us.to-1);ps[hs]=gs}us.parent()}let fs={selfCloseBegin:ds,selfCloseEnd:us.to+3};return{componentType:cs,props:{...ps},children:[],range:fs}}else throw Error("Non SelfClosingTag/OpenTag in Element. How did you do that?")}function ns(us){if(us.node.name==="Element")return rs(us.node.cursor);if(us.node.name==="Comment")return null;if(us.node.name==="Text"){let cs=as.substring(us.node.from,us.node.to);if(cs!=="")return cs}else throw Error(`Invalid DoenetML at positions ${us.node.from} to ${us.node.to}. Found ${as.substring(us.node.from,us.node.to)}`)}if(!as)return[];let ss=parse(as),os=[];if(!ss.firstChild())return os;let ls=ns(ss);for(ls!=null&&os.push(ls);ss.nextSibling();){let us=ns(ss);us!=null&&os.push(us)}return os}var base32Exports={},base32$1={get exports(){return base32Exports},set exports(as){base32Exports=as}};(function(as){(function(){var rs=typeof window=="object"?window:{},ns=!rs.HI_BASE32_NO_NODE_JS&&typeof browser$1$2=="object"&&browser$1$2.versions&&browser$1$2.versions.node;ns&&(rs=commonjsGlobal$1);var ss=!rs.HI_BASE32_NO_COMMON_JS&&!0&&as.exports,os="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".split(""),ls={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,2:26,3:27,4:28,5:29,6:30,7:31},us=[0,0,0,0,0,0,0,0],cs=function(xs,Cs){Cs.length>10&&(Cs="..."+Cs.substr(-10));var Ts=new Error("Decoded data is not valid UTF-8. Maybe try base32.decode.asBytes()? Partial data after reading "+xs+" bytes: "+Cs+" <-");throw Ts.position=xs,Ts},ds=function(xs){for(var Cs="",Ts=xs.length,Ss=0,Ns=0,As,ws;Ss191&&As<=223?(ws=As&31,Ns=1):As<=239?(ws=As&15,Ns=2):As<=247?(ws=As&7,Ns=3):cs(Ss,Cs);for(var Es=0;Es191)&&cs(Ss,Cs),ws<<=6,ws+=As&63;ws>=55296&&ws<=57343&&cs(Ss,Cs),ws>1114111&&cs(Ss,Cs),ws<=65535?Cs+=String.fromCharCode(ws):(ws-=65536,Cs+=String.fromCharCode((ws>>10)+55296),Cs+=String.fromCharCode((ws&1023)+56320))}return Cs},ps=function(xs){if(xs==="")return[];if(!/^[A-Z2-7=]+$/.test(xs))throw new Error("Invalid base32 characters");xs=xs.replace(/=/g,"");for(var Cs,Ts,Ss,Ns,As,ws,Es,_s,$s=[],Rs=0,Is=xs.length,Os=0,Ds=Is>>3<<3;Os>>2)&255,$s[Rs++]=(Ts<<6|Ss<<1|Ns>>>4)&255,$s[Rs++]=(Ns<<4|As>>>1)&255,$s[Rs++]=(As<<7|ws<<2|Es>>>3)&255,$s[Rs++]=(Es<<5|_s)&255;var Vs=Is-Ds;return Vs===2?(Cs=ls[xs.charAt(Os++)],Ts=ls[xs.charAt(Os++)],$s[Rs++]=(Cs<<3|Ts>>>2)&255):Vs===4?(Cs=ls[xs.charAt(Os++)],Ts=ls[xs.charAt(Os++)],Ss=ls[xs.charAt(Os++)],Ns=ls[xs.charAt(Os++)],$s[Rs++]=(Cs<<3|Ts>>>2)&255,$s[Rs++]=(Ts<<6|Ss<<1|Ns>>>4)&255):Vs===5?(Cs=ls[xs.charAt(Os++)],Ts=ls[xs.charAt(Os++)],Ss=ls[xs.charAt(Os++)],Ns=ls[xs.charAt(Os++)],As=ls[xs.charAt(Os++)],$s[Rs++]=(Cs<<3|Ts>>>2)&255,$s[Rs++]=(Ts<<6|Ss<<1|Ns>>>4)&255,$s[Rs++]=(Ns<<4|As>>>1)&255):Vs===7&&(Cs=ls[xs.charAt(Os++)],Ts=ls[xs.charAt(Os++)],Ss=ls[xs.charAt(Os++)],Ns=ls[xs.charAt(Os++)],As=ls[xs.charAt(Os++)],ws=ls[xs.charAt(Os++)],Es=ls[xs.charAt(Os++)],$s[Rs++]=(Cs<<3|Ts>>>2)&255,$s[Rs++]=(Ts<<6|Ss<<1|Ns>>>4)&255,$s[Rs++]=(Ns<<4|As>>>1)&255,$s[Rs++]=(As<<7|ws<<2|Es>>>3)&255),$s},fs=function(xs){for(var Cs,Ts,Ss,Ns,As,ws="",Es=xs.length,_s=0,$s=parseInt(Es/5)*5;_s<$s;)Cs=xs.charCodeAt(_s++),Ts=xs.charCodeAt(_s++),Ss=xs.charCodeAt(_s++),Ns=xs.charCodeAt(_s++),As=xs.charCodeAt(_s++),ws+=os[Cs>>>3]+os[(Cs<<2|Ts>>>6)&31]+os[Ts>>>1&31]+os[(Ts<<4|Ss>>>4)&31]+os[(Ss<<1|Ns>>>7)&31]+os[Ns>>>2&31]+os[(Ns<<3|As>>>5)&31]+os[As&31];var Rs=Es-$s;return Rs===1?(Cs=xs.charCodeAt(_s),ws+=os[Cs>>>3]+os[Cs<<2&31]+"======"):Rs===2?(Cs=xs.charCodeAt(_s++),Ts=xs.charCodeAt(_s),ws+=os[Cs>>>3]+os[(Cs<<2|Ts>>>6)&31]+os[Ts>>>1&31]+os[Ts<<4&31]+"===="):Rs===3?(Cs=xs.charCodeAt(_s++),Ts=xs.charCodeAt(_s++),Ss=xs.charCodeAt(_s),ws+=os[Cs>>>3]+os[(Cs<<2|Ts>>>6)&31]+os[Ts>>>1&31]+os[(Ts<<4|Ss>>>4)&31]+os[Ss<<1&31]+"==="):Rs===4&&(Cs=xs.charCodeAt(_s++),Ts=xs.charCodeAt(_s++),Ss=xs.charCodeAt(_s++),Ns=xs.charCodeAt(_s),ws+=os[Cs>>>3]+os[(Cs<<2|Ts>>>6)&31]+os[Ts>>>1&31]+os[(Ts<<4|Ss>>>4)&31]+os[(Ss<<1|Ns>>>7)&31]+os[Ns>>>2&31]+os[Ns<<3&31]+"="),ws},hs=function(xs){var Cs,Ts,Ss,Ns,As,ws,Es=!1,_s="",$s=0,Rs,Is=0,Os=xs.length;if(xs==="")return _s;do{for(us[0]=us[5],us[1]=us[6],us[2]=us[7],Rs=Is;$s>6,us[Rs++]=128|ws&63):ws<55296||ws>=57344?(us[Rs++]=224|ws>>12,us[Rs++]=128|ws>>6&63,us[Rs++]=128|ws&63):(ws=65536+((ws&1023)<<10|xs.charCodeAt(++$s)&1023),us[Rs++]=240|ws>>18,us[Rs++]=128|ws>>12&63,us[Rs++]=128|ws>>6&63,us[Rs++]=128|ws&63);Is=Rs-5,$s===Os&&++$s,$s>Os&&Rs<6&&(Es=!0),Cs=us[0],Rs>4?(Ts=us[1],Ss=us[2],Ns=us[3],As=us[4],_s+=os[Cs>>>3]+os[(Cs<<2|Ts>>>6)&31]+os[Ts>>>1&31]+os[(Ts<<4|Ss>>>4)&31]+os[(Ss<<1|Ns>>>7)&31]+os[Ns>>>2&31]+os[(Ns<<3|As>>>5)&31]+os[As&31]):Rs===1?_s+=os[Cs>>>3]+os[Cs<<2&31]+"======":Rs===2?(Ts=us[1],_s+=os[Cs>>>3]+os[(Cs<<2|Ts>>>6)&31]+os[Ts>>>1&31]+os[Ts<<4&31]+"===="):Rs===3?(Ts=us[1],Ss=us[2],_s+=os[Cs>>>3]+os[(Cs<<2|Ts>>>6)&31]+os[Ts>>>1&31]+os[(Ts<<4|Ss>>>4)&31]+os[Ss<<1&31]+"==="):(Ts=us[1],Ss=us[2],Ns=us[3],_s+=os[Cs>>>3]+os[(Cs<<2|Ts>>>6)&31]+os[Ts>>>1&31]+os[(Ts<<4|Ss>>>4)&31]+os[(Ss<<1|Ns>>>7)&31]+os[Ns>>>2&31]+os[Ns<<3&31]+"=")}while(!Es);return _s},gs=function(xs){for(var Cs,Ts,Ss,Ns,As,ws="",Es=xs.length,_s=0,$s=parseInt(Es/5)*5;_s<$s;)Cs=xs[_s++],Ts=xs[_s++],Ss=xs[_s++],Ns=xs[_s++],As=xs[_s++],ws+=os[Cs>>>3]+os[(Cs<<2|Ts>>>6)&31]+os[Ts>>>1&31]+os[(Ts<<4|Ss>>>4)&31]+os[(Ss<<1|Ns>>>7)&31]+os[Ns>>>2&31]+os[(Ns<<3|As>>>5)&31]+os[As&31];var Rs=Es-$s;return Rs===1?(Cs=xs[_s],ws+=os[Cs>>>3]+os[Cs<<2&31]+"======"):Rs===2?(Cs=xs[_s++],Ts=xs[_s],ws+=os[Cs>>>3]+os[(Cs<<2|Ts>>>6)&31]+os[Ts>>>1&31]+os[Ts<<4&31]+"===="):Rs===3?(Cs=xs[_s++],Ts=xs[_s++],Ss=xs[_s],ws+=os[Cs>>>3]+os[(Cs<<2|Ts>>>6)&31]+os[Ts>>>1&31]+os[(Ts<<4|Ss>>>4)&31]+os[Ss<<1&31]+"==="):Rs===4&&(Cs=xs[_s++],Ts=xs[_s++],Ss=xs[_s++],Ns=xs[_s],ws+=os[Cs>>>3]+os[(Cs<<2|Ts>>>6)&31]+os[Ts>>>1&31]+os[(Ts<<4|Ss>>>4)&31]+os[(Ss<<1|Ns>>>7)&31]+os[Ns>>>2&31]+os[Ns<<3&31]+"="),ws},ys=function(xs,Cs){var Ts=typeof xs!="string";return Ts&&xs.constructor===ArrayBuffer&&(xs=new Uint8Array(xs)),Ts?gs(xs):Cs?fs(xs):hs(xs)},bs=function(xs,Cs){if(!Cs)return ds(ps(xs));if(xs==="")return"";if(!/^[A-Z2-7=]+$/.test(xs))throw new Error("Invalid base32 characters");var Ts,Ss,Ns,As,ws,Es,_s,$s,Rs="",Is=xs.indexOf("=");Is===-1&&(Is=xs.length);for(var Os=0,Ds=Is>>3<<3;Os>>2)&255)+String.fromCharCode((Ss<<6|Ns<<1|As>>>4)&255)+String.fromCharCode((As<<4|ws>>>1)&255)+String.fromCharCode((ws<<7|Es<<2|_s>>>3)&255)+String.fromCharCode((_s<<5|$s)&255);var Vs=Is-Ds;return Vs===2?(Ts=ls[xs.charAt(Os++)],Ss=ls[xs.charAt(Os++)],Rs+=String.fromCharCode((Ts<<3|Ss>>>2)&255)):Vs===4?(Ts=ls[xs.charAt(Os++)],Ss=ls[xs.charAt(Os++)],Ns=ls[xs.charAt(Os++)],As=ls[xs.charAt(Os++)],Rs+=String.fromCharCode((Ts<<3|Ss>>>2)&255)+String.fromCharCode((Ss<<6|Ns<<1|As>>>4)&255)):Vs===5?(Ts=ls[xs.charAt(Os++)],Ss=ls[xs.charAt(Os++)],Ns=ls[xs.charAt(Os++)],As=ls[xs.charAt(Os++)],ws=ls[xs.charAt(Os++)],Rs+=String.fromCharCode((Ts<<3|Ss>>>2)&255)+String.fromCharCode((Ss<<6|Ns<<1|As>>>4)&255)+String.fromCharCode((As<<4|ws>>>1)&255)):Vs===7&&(Ts=ls[xs.charAt(Os++)],Ss=ls[xs.charAt(Os++)],Ns=ls[xs.charAt(Os++)],As=ls[xs.charAt(Os++)],ws=ls[xs.charAt(Os++)],Es=ls[xs.charAt(Os++)],_s=ls[xs.charAt(Os++)],Rs+=String.fromCharCode((Ts<<3|Ss>>>2)&255)+String.fromCharCode((Ss<<6|Ns<<1|As>>>4)&255)+String.fromCharCode((As<<4|ws>>>1)&255)+String.fromCharCode((ws<<7|Es<<2|_s>>>3)&255)),Rs},vs={encode:ys,decode:bs};bs.asBytes=ps,ss?as.exports=vs:rs.base32=vs})()})(base32$1);const base32=base32Exports;async function cidFromText(as){let ns=new TextEncoder().encode(as);return await cidFromArrayBuffer(ns)}async function cidFromArrayBuffer(as){let rs=await crypto.subtle.digest("SHA-256",as),ns=new Uint8Array(36);return ns.set([1,85,18,32]),ns.set(new Uint8Array(rs),4),"b"+base32.encode(ns).toLowerCase().replace(/=+/,"")}const textByCid={};function retrieveTextFileForCid(as,rs="doenet"){return textByCid[as]!==void 0?Promise.resolve(textByCid[as]):new Promise((ns,ss)=>{let os=retrieveTextFileFromIPFS(as),ls=os.promise,us=os.controller,cs,ds=!1,ps=!1,fs;ls.then(hs=>{clearTimeout(fs),cs&&!ps&&cs.abort(),textByCid[as]=hs,ns(hs)}).catch(hs=>{ds=!0,ps&&(clearTimeout(fs),ss(hs))}),fs=setTimeout(()=>{let hs=retrieveTextFileFromServer(as,rs),gs=hs.promise;cs=hs.controller,gs.then(ys=>{ds||us.abort(),textByCid[as]=ys,ns(ys)}).catch(ys=>{ps=!0,ds?ss(ys):fs=setTimeout(()=>{us.abort(),ss(ys)},5e3)})},100)})}function retrieveTextFileFromIPFS(as){let rs=new AbortController,ns=rs.signal;return{promise:async function(){try{let ls=await fetch(`https://${as}.ipfs.dweb.link/`,{signal:ns});if(ls.ok){let us=await ls.text();return await cidFromText(us)===as?us:Promise.reject(new Error("cid mismatch"))}else return Promise.reject(new Error(`cid not found: ${as}`))}catch{return Promise.reject(new Error(`cid not found: ${as}`))}}(),controller:rs}}function retrieveTextFileFromServer(as,rs){let ns=new AbortController,ss=ns.signal;return{promise:async function(){try{let us=await fetch(`/media/${as}.${rs}`,{signal:ss});if(us.ok){let cs=await us.text(),ds=await cidFromText(cs);return ds===as?cs:(console.warn(`cid mismatch, ${as}, ${ds}`),Promise.reject(new Error("cid mismatch")))}else return Promise.reject(new Error(`cid not found: ${as}`))}catch{return Promise.reject(new Error(`cid not found: ${as}`))}}(),controller:ns}}async function expandDoenetMLsToFullSerializedComponents({cids:as,doenetMLs:rs,componentInfoObjects:ns}){var us,cs;let ss=[],os={};for(let ds of rs){let ps=parseAndCompile(ds);ps=cleanIfHaveJustDocument(ps),substituteDeprecations(ps),temporarilyRenameSourceBackToTarget(ps),correctComponentTypeCapitalization(ps,ns.componentTypeLowerCaseMapping),copyTargetOrFromURIAttributeCreatesCopyComponent(ps,ns.isCompositeComponent),createAttributesFromProps(ps,ns),breakUpTargetIntoPropsAndIndices(ps,ns),applyMacros(ps,ns),removeBlankStringChildren(ps,ns),decodeXMLEntities(ps),applySugar({serializedComponents:ps,componentInfoObjects:ns}),ss.push(ps);let fs=findContentCopies({serializedComponents:ps});for(let hs in fs.cidComponents)os[hs]===void 0&&(os[hs]=[]),os[hs].push(...fs.cidComponents[hs])}let ls=Object.keys(os);if(ls.length>0){let{newDoenetMLs:ds,newCids:ps}=await cidsToDoenetMLs(ls);for(let[gs,ys]of ls.entries())if(ps[gs]&&ps[gs].substring(0,ys.length)!==ys)return Promise.reject(new Error(`Requested cid ${ys} but got back ${ps[gs]}!`));let fs=ls.length;for(let gs=0;gstypeof Ns!="string"||Ns.trim()),Ts=Cs.length===1&&typeof Cs[0]=="object",Ss=(us=vs.doenetAttributes)==null?void 0:us.fromCopyFromURI;if(Ss||Ts)if(Ss&&!Ts)console.warn("ignoring copyFromURI as it was not a single component");else{let Ns=Cs[0];Ns.attributes||(Ns.attributes={}),vs.doenetAttributes||(vs.doenetAttributes={}),vs.doenetAttributes.keptNewNamespaceOfLastChild=!!((cs=Ns.attributes.newNamespace)!=null&&cs.primitive),Ns.attributes.newNamespace={primitive:!0},vs.children=[Ns,...vs.children],vs.doenetAttributes.nameFirstChildIndependently=!0}else{let Ns={componentType:"externalContent",children:JSON.parse(JSON.stringify(bs)),attributes:{newNamespace:{primitive:!0}},doenetAttributes:{createUniqueName:!0}};vs.children=[Ns,...vs.children]}}}}return{cids:as,fullSerializedComponents:ss}}function cidsToDoenetMLs(as){let rs=[],ns=as;for(let ss of as)rs.push(retrieveTextFileForCid(ss,"doenet"));return Promise.all(rs).then(ss=>Promise.resolve({newDoenetMLs:ss,newCids:ns})).catch(ss=>{let os;return ns.length===1?os=`Could not retrieve cid ${ns[0]}`:os=`Could not retrieve cids ${ns.join(",")}`,os+=": "+ss.message,console.error(os),Promise.reject(new Error(os))})}function removeBlankStringChildren(as,rs){for(let ns of as){if(ns.children){let ss=rs.allComponentClasses[ns.componentType];ss&&!ss.includeBlankStringChildren&&(ns.children=ns.children.filter(os=>typeof os!="string"||os.trim()!=="")),removeBlankStringChildren(ns.children,rs)}for(let ss in ns.attributes){let os=ns.attributes[ss].component;os&&os.children&&removeBlankStringChildren([os],rs)}}}function findContentCopies({serializedComponents:as}){let rs={};for(let ns of as)if(ns.componentType==="copy"){if(ns.attributes&&ns.attributes.uri){let ss=ns.attributes.uri.primitive;if(ss&&ss.substring(0,7).toLowerCase()==="doenet:"){let os=ss.match(/[:&]cid=([^&]+)/i);if(os){let ls=os[1];rs[ls]===void 0&&(rs[ls]=[]),rs[ls].push(ns)}}}}else if(ns.children!==void 0){let ss=findContentCopies({serializedComponents:ns.children});for(let os in ss.cidComponents)rs[os]===void 0&&(rs[os]=[]),rs[os].push(...ss.cidComponents[os])}return{cidComponents:rs}}function addDocumentIfItsMissing(as){if(as.length!==1||as[0].componentType!=="document"){let rs=as.splice(0);as.push({componentType:"document",children:rs})}}function substituteDeprecations(as){let rs={tname:"target",triggerwithtnames:"triggerWith",updatewithtname:"updateWith",paginatortname:"paginator",randomizeorder:"shuffleOrder",copytarget:"copySource",triggerwithtargets:"triggerWith",triggerwhentargetsclicked:"triggerWhenObjectsClicked",fortarget:"forObject",targetattributestoignore:"sourceAttributesToIgnore",targetattributestoignorerecursively:"sourceAttributesToIgnoreRecursively",targetsareresponses:"sourcesAreResponses",updatewithtarget:"updateWith",targetsarefunctionsymbols:"sourcesAreFunctionSymbols",selectforvariantnames:"selectForVariants"},ns={copy:{target:"source",tname:"source"},collect:{target:"source",tname:"source"},summarystatistics:{target:"source"}};for(let ss of as)if(typeof ss=="object"){if(ss.props){let os=ss.componentType,ls=ns[os.toLowerCase()];ls||(ls={});let us=!0;for(;us;){us=!1;for(let cs in ss.props){let ds=cs.toLowerCase();if(ds in ls){let ps=ls[ds];console.warn(`Attribute ${cs} of component type ${os} is deprecated. Use ${ps} instead.`),ss.props[ps]=ss.props[cs],delete ss.props[cs],us=!0;break}else if(ds in rs){let ps=rs[ds];console.warn(`Attribute ${cs} is deprecated. Use ${ps} instead.`),ss.props[ps]=ss.props[cs],delete ss.props[cs],us=!0;break}}}}ss.children&&substituteDeprecations(ss.children)}}function temporarilyRenameSourceBackToTarget(as){let rs={copysource:"copyTarget"},ns={copy:{source:"target"},collect:{source:"target"}};for(let ss of as)if(typeof ss=="object"){if(ss.props){let os=ss.componentType,ls=ns[os.toLowerCase()];ls||(ls={});let us=!0;for(;us;){us=!1;for(let cs in ss.props){let ds=cs.toLowerCase();if(ds in ls){let ps=ls[ds];ss.props[ps]=ss.props[cs],delete ss.props[cs],us=!0;break}else if(ds in rs){let ps=rs[ds];ss.props[ps]=ss.props[cs],delete ss.props[cs],us=!0;break}}}}ss.children&&temporarilyRenameSourceBackToTarget(ss.children)}}function cleanIfHaveJustDocument(as){let rs=as.filter(ns=>typeof ns!="string"||ns.trim()!=="");return rs.length===1&&rs[0].componentType==="document"?rs:as}function correctComponentTypeCapitalization(as,rs){for(let ns of as){if(typeof ns!="object")continue;let ss=rs[ns.componentType.toLowerCase()];if(ss)ns.componentType=ss;else throw Error(`Invalid component type${indexRangeString(ns)}: ${ns.componentType}`);ns.children&&correctComponentTypeCapitalization(ns.children,rs)}}function copyTargetOrFromURIAttributeCreatesCopyComponent(as,rs){for(let ns of as){if(ns.props){let ss=!1,os=!1,ls=!1,us=ns.componentType,cs=rs({componentType:us,includeNonStandard:!1}),ds=rs({componentType:us,includeNonStandard:!0});for(let ps of Object.keys(ns.props)){let fs=ps.toLowerCase();if(fs==="copytarget"){if(ss)throw Error(`Cannot repeat attribute ${ps}. Found in component type ${us}${indexRangeString(ns)}`);if(os)throw Error(`Cannot combine copyTarget and copyFromURI attribiutes. For in component of type ${us}${indexRangeString(ns)}`);if(ls)throw Error(ds?`A component of type ${us} cannot have both assignNames and copyTarget. Found${indexRangeString(ns)}.`:`Invalid attribute assignNames for component of type ${us}${indexRangeString(ns)}`);if(ss=!0,ns.doenetAttributes||(ns.doenetAttributes={}),cs||(ns.props.createComponentOfType=us,ns.doenetAttributes.nameBecomesAssignNames=!0),ns.componentType="copy",ns.props.target=ns.props[ps],typeof ns.props.target!="string")throw Error(`Must specify value for copyTarget. Found in component of type ${us}${indexRangeString(ns)}`);delete ns.props[ps],ns.doenetAttributes.fromCopyTarget=!0,ns.doenetAttributes.createNameFromComponentType=us,ns.props.assignNamesSkip="1"}else if(fs==="copyfromuri"){if(os)throw Error(`Cannot repeat attribute ${ps}. Found in component type ${us}${indexRangeString(ns)}`);if(ss)throw Error(`Cannot combine copyTarget and copyFromURI attribiutes. For in component of type ${us}${indexRangeString(ns)}`);if(ls)throw Error(ds?`A component of type ${us} cannot have both assignNames and copyFromURI. Found${indexRangeString(ns)}.`:`Invalid attribute assignNames for component of type ${us}${indexRangeString(ns)}`);if(os=!0,ns.doenetAttributes||(ns.doenetAttributes={}),cs||(ns.props.createComponentOfType=us,ns.doenetAttributes.nameBecomesAssignNames=!0),ns.componentType="copy",ns.props.uri=ns.props[ps],typeof ns.props.uri!="string")throw Error(`Must specify value for copyFromURI. Found in component of type ${us}${indexRangeString(ns)}`);delete ns.props[ps],ns.doenetAttributes.fromCopyFromURI=!0,ns.doenetAttributes.createNameFromComponentType=us,ns.props.assignNamesSkip="1"}else if(fs==="assignnames"&&!cs){if(ss||os)throw Error(ds?`A component of type ${us} cannot have both assignNames and copyTarget. Found${indexRangeString(ns)}.`:`Invalid attribute assignNames for component of type ${us}${indexRangeString(ns)}`);ls=!0}}if(ss){for(let fs of Object.keys(ns.props))if(fs.toLowerCase()==="prop")throw Error(`Invalid attribute prop for component of type ${us}${indexRangeString(ns)}`);let ps=!1;for(let fs of Object.keys(ns.props))if(fs.toLowerCase()==="copyprop"){if(ps)throw Error(`Cannot repeat attribute ${fs}. Found in component type ${us}${indexRangeString(ns)}`);ns.props.prop=ns.props[fs],delete ns.props[fs],ps=!0}}}ns.children&©TargetOrFromURIAttributeCreatesCopyComponent(ns.children,rs)}}function breakUpTargetIntoPropsAndIndices(as,rs,ns=""){for(let[ss,os]of as.entries()){if(os.props&&["copy","updateValue","animateFromSequence"].includes(os.componentType)){let ls,us,cs,ds,ps,fs,hs;for(let gs of Object.keys(os.props))if(gs.toLowerCase()==="target"){if(ls)throw Error(`Cannot repeat attribute ${gs}. Found in component type ${os.componentType}${indexRangeString(os)}`);ls=gs,hs=os.props[gs];let bs=buildSourcePieces(hs,!0);bs.success&&bs.matchLength===hs.length&&(us=bs.sourceName,cs=bs.componentIndex,ds=bs.componentAttributes,ps=bs.propArray,fs=bs.subNames)}if(ls&&us)if(cs||ds||ps.length>0){if(os.attributes.prop)throw Error(`Cannot combine the prop attribute with an extended source attribute. Found in component type ${os.componentType}${indexRangeString(os)}`);if(os.attributes.propIndex)throw Error(`Cannot combine the propIndex attribute with an extended source attribute. Found in component type ${os.componentType}${indexRangeString(os)}`);if(os.attributes.componentIndex)throw Error(`Cannot combine the componentIndex attribute with an extended source attribute. Found in component type ${os.componentType}${indexRangeString(os)}`);let gs=createComponentFromExtendedSource({sourceName:us,componentIndex:cs,subNames:fs,componentAttributes:ds,propArray:ps,componentInfoObjects:rs});if(gs.success){let ys=gs.newComponent;if(os.componentType==="copy")delete os.props[ls],Object.assign(os.attributes,ys.attributes),os.doenetAttributes||(os.doenetAttributes={}),Object.assign(os.doenetAttributes,ys.doenetAttributes),os.doenetAttributes.createNameFromComponentType||(os.doenetAttributes.createNameFromComponentType=os.componentType),os.componentType=ys.componentType,ps.length===0&&!(os.attributes.prop||os.attributes.propIndex)&&(os.doenetAttributes.isPlainCopy=!0),ys.children&&(os.children=ys.children);else if(ys.componentType==="copy")delete os.props[ls],Object.assign(os.attributes,ys.attributes),os.doenetAttributes||(os.doenetAttributes={}),Object.assign(os.doenetAttributes,ys.doenetAttributes);else{let bs="fromExtendedSource"+ns+"|"+ss,vs=createUniqueName("extract",bs);ys.doenetAttributes.prescribedName=vs,ys.doenetAttributes.createdFromMacro=!0;let xs={componentType:"setup",children:[ys],doenetAttributes:{createdFromMacro:!0}};as.push(xs),delete os.props[ls],os.doenetAttributes||(os.doenetAttributes={}),os.doenetAttributes.target=vs,os.doenetAttributes.allowDoubleUnderscoreTarget=!0}}else os.componentType==="copy"?console.warn(`invalid copy source: ${hs}`):console.warn(`invalid target: ${hs}`)}else os.componentType==="copy"&&!(os.attributes.prop||os.attributes.propIndex)&&(os.doenetAttributes||(os.doenetAttributes={}),os.doenetAttributes.isPlainCopy=!0)}os.children&&breakUpTargetIntoPropsAndIndices(os.children,rs,ns+"|"+ss)}}function createAttributesFromProps(as,rs){for(let ns of as){if(typeof ns!="object")continue;let ss=rs.allComponentClasses[ns.componentType],os=ss.createAttributesObject(),ls={};for(let ds in os)ls[ds.toLowerCase()]=ds;let us={},cs=Object.assign({},ns.props);if(ns.props)for(let ds in ns.props){let ps=ls[ds.toLowerCase()],fs=os[ps];if(fs){if(ps in us)throw Error(`Cannot repeat attribute ${ps}. Found in component type ${ns.componentType}${indexRangeString(ns)}`);us[ps]=componentFromAttribute({attrObj:fs,value:ns.props[ds],originalComponentProps:cs,componentInfoObjects:rs}),delete ns.props[ds]}else if(!["name","assignnames","target"].includes(ds.toLowerCase()))if(ss.acceptAnyAttribute)us[ds]=componentFromAttribute({value:ns.props[ds],originalComponentProps:cs,componentInfoObjects:rs}),delete ns.props[ds];else throw Error(`Invalid attribute ${ds} for component of type ${ns.componentType}${indexRangeString(ns)}`)}for(let ds in os){let ps=os[ds];ps.createPrimitiveOfType&&"defaultPrimitiveValue"in ps&&!(ds in us)&&(us[ds]=componentFromAttribute({attrObj:ps,originalComponentProps:cs,value:ps.defaultPrimitiveValue.toString(),componentInfoObjects:rs}))}ns.attributes=us,ns.children!==void 0&&createAttributesFromProps(ns.children,rs)}}function componentFromAttribute({attrObj:as,value:rs,originalComponentProps:ns,componentInfoObjects:ss}){if(typeof rs!="object"?rs={rawString:rs.toString()}:rs===null&&(rs={rawString:""}),as&&as.createComponentOfType){let os,ls=rs.rawString.trim().toLowerCase();if(ls==="true"&&as.valueForTrue!==void 0)os={componentType:as.createComponentOfType,state:{value:as.valueForTrue}};else if(ls==="false"&&as.valueForFalse!==void 0)os={componentType:as.createComponentOfType,state:{value:as.valueForFalse}};else if(ss.isInheritedComponentType({inheritedComponentType:as.createComponentOfType,baseComponentType:"boolean"})&&["true","false"].includes(ls))os={componentType:as.createComponentOfType,state:{value:ls==="true"}};else{let cs=rs.childrenForComponent;cs?cs=JSON.parse(JSON.stringify(cs)):cs=[rs.rawString],os={componentType:as.createComponentOfType,children:cs},removeBlankStringChildren([os],ss)}if(as.attributesForCreatedComponent||as.copyComponentAttributesForCreatedComponent){if(as.attributesForCreatedComponent?os.props=as.attributesForCreatedComponent:os.props={},as.copyComponentAttributesForCreatedComponent)for(let cs of as.copyComponentAttributesForCreatedComponent)ns[cs]&&(os.props[cs]=JSON.parse(JSON.stringify(ns[cs])));createAttributesFromProps([os],ss)}let us={component:os};return as.ignoreFixed&&(us.ignoreFixed=!0),us}else if(as&&as.createPrimitiveOfType){let os;return as.createPrimitiveOfType==="boolean"?os=rs.rawString.trim().toLowerCase()==="true":as.createPrimitiveOfType==="number"?os=Number(rs.rawString):as.createPrimitiveOfType==="integer"?os=Math.round(Number(rs.rawString)):as.createPrimitiveOfType==="stringArray"?os=rs.rawString.trim().split(/\s+/):as.createPrimitiveOfType==="numberArray"?os=rs.rawString.trim().split(/\s+/).map(Number):os=rs.rawString,as.validationFunction&&(os=as.validationFunction(os)),{primitive:os}}else return as&&as.createTargetComponentNames?{targetComponentNames:rs.rawString.trim().split(/\s+/).map(ls=>(ls[0]==="$"&&ls[1]!=="$"&&(ls=ls.slice(1),ls[0]==="("&&ls[ls.length-1]===")"&&(ls=ls.slice(1,ls.length-1))),{relativeName:ls}))}:(rs.childrenForComponent||(rs.childrenForComponent=[rs.rawString]),rs)}function findPreSugarIndsAndMarkFromSugar(as){let rs=[];for(let ns of as)if(typeof ns=="object"){if(ns.preSugarInd!==void 0)rs.push(ns.preSugarInd);else if(ns.doenetAttributes||(ns.doenetAttributes={}),ns.doenetAttributes.createdFromSugar=!0,ns.children){let ss=findPreSugarIndsAndMarkFromSugar(ns.children);rs.push(...ss)}}return rs}function applyMacros(as,rs){for(let ns of as)if(ns.children&&applyMacros(ns.children,rs),ns.attributes)for(let ss in ns.attributes){let os=ns.attributes[ss];os.component?applyMacros([os.component],rs):os.childrenForComponent&&applyMacros(os.childrenForComponent,rs)}substituteMacros(as,rs)}function substituteMacros(as,rs){for(let ns=0;ns0&&as[ns-1].range){let Ts=as[ns-1].range;Ts.closeEnd?Cs+=Ts.closeEnd:Ts.selfCloseEnd&&(Cs+=Ts.selfCloseBegin)}throw Error(`${hs.message}. At indices ${Cs}-${Cs+ds}. Found: ${xs}`)}markCreatedFromMacro([gs]),us.propArray.length===0&&(gs.doenetAttributes.isPlainMacro=!0),fs=[gs];let ys=1,bs=ls.substring(cs+ds);if(ps===2){let xs=ls.slice(cs+ds).match(/^\s*\(/);if(!xs){os=cs+2;continue}let Cs=ds+xs[0].length,Ts=[],Ss=!1;ls.length>cs+Cs&&(Ss=!0,Ts.push(ls.substring(cs+Cs))),Ts.push(...as.slice(ns+1));let Ns=createEvaluateIfFindMatchedClosingParens({componentsFromMacro:fs,remainingComponents:Ts,includeFirstInRemaining:Ss,componentInfoObjects:rs});if(!Ns.success){os=cs+2;continue}fs=Ns.componentsFromMacro,ys=Ns.lastComponentIndMatched+1,Ss||ys++,bs=""}let vs=[];cs>0&&vs.push(ls.substring(0,cs)),vs.push(...fs),bs.length>0&&vs.push(bs),as.splice(ns,ys,...vs),cs>0&&ns++;break}}}}function createComponentFromExtendedSource({sourceName:as,componentIndex:rs,componentAttributes:ns,propArray:ss,subNames:os,componentInfoObjects:ls}){let us={componentType:"copy",doenetAttributes:{target:as},attributes:{}};if(rs){let ds=[rs];applyMacros(ds,ls),us.attributes.componentIndex={component:{componentType:"integer",children:ds}}}if((os==null?void 0:os.length)>0){let ds=[],ps=[];for(let fs of os)ds.push(fs.subName),fs.subNameComponentIndex!==void 0&&(ps.length0){let fs=[ps.join(" ")];applyMacros(fs,ls),us.attributes.sourceSubnamesComponentIndex={component:{componentType:"numberList",children:fs}}}}let cs=!1;if(ns){cs=!0;let ds=createAttributesFromString(ns,ls);if(!ds.success)return ds;Object.assign(us.attributes,ds.newAttributes),ds.assignNames&&(us.props={assignNames:ds.assignNames})}for(let ds of ss){if(cs&&(us.doenetAttributes.createdFromMacro=!0,us={componentType:"extract",attributes:{},doenetAttributes:{},children:[us]}),us.attributes.prop={primitive:ds.prop},ds.propIndex){let ps=[ds.propIndex.join(" ")];applyMacros(ps,ls),us.attributes.propIndex={component:{componentType:"numberList",children:ps}}}if(ds.attributes){let ps=createAttributesFromString(ds.attributes,ls);if(!ps.success)return ps;Object.assign(us.attributes,ps.newAttributes),ps.assignNames&&(us.props={assignNames:ps.assignNames})}cs=!0}return{success:!0,newComponent:us}}function createAttributesFromString(as,rs){let ns=``,ss;try{ss=parseAndCompile(ns)}catch{return{success:!1,message:"Error in macro"}}createAttributesFromProps(ss,rs),markCreatedFromMacro(ss),applyMacros(ss,rs);let os=ss[0].attributes;if(os.prop||os.propIndex||os.componentIndex)return{success:!1,message:"Error in macro: macro cannot directly add attributes prop, propIndex, or componentIndex"};let ls;if(ss[0].props){for(let us in ss[0].props)if(us.toLowerCase()==="assignnames"){if(ls)return{success:!1,message:"Error in macro: cannot repeat assignNames"};ls=ss[0].props[us]}}return{success:!0,newAttributes:os,assignNames:ls}}function findFirstFullMacroInString(as){let rs=0,ns;for(;;){let ss=as.substring(rs).match(/(\$+)(.?)/);if(!ss)return{success:!1};if(ns=ss[1].length,rs+=ss.index+ns,ns<=2){let os=!1,ls=as.substring(rs),us=0,cs=findWordOrDelimitedGroup(ls,os);cs.startDelim==="("&&(os=!0,ls=cs.group,us=cs.group.length);let ds=buildSourcePieces(ls,os);if(ds.success){if(os){if(ds.matchLength!==us)return{success:!1};ds.matchLength+=2}return ds.nDollarSigns=ns,ds.firstIndMatched=rs-ns,ds.matchLength+=ns,ds}}}}function buildSourcePieces(as,rs){let ns=findWordOrDelimitedGroup(as,rs),ss=0;if(ns.withPeriod||!ns.word)return{success:!1};let os={sourceName:(ns.withSlash?"/":"")+ns.word};ss+=ns.matchLength,as=as.substring(ns.matchLength),ns=findWordOrDelimitedGroup(as,rs),ns.startDelim==="["&&(os.componentIndex=ns.group,ss+=ns.matchLength,as=as.substring(ns.matchLength),ns=findWordOrDelimitedGroup(as,rs));let ls=[];for(;ns.withSlash;){let cs={subName:ns.word};ss+=ns.matchLength,as=as.substring(ns.matchLength),ns=findWordOrDelimitedGroup(as,rs),ns.startDelim==="["&&(cs.subNameComponentIndex=ns.group,ss+=ns.matchLength,as=as.substring(ns.matchLength),ns=findWordOrDelimitedGroup(as,rs)),ls.push(cs)}os.subNames=ls,ns.startDelim==="{"&&(os.componentAttributes=ns.group,ss+=ns.matchLength,as=as.substring(ns.matchLength),ns=findWordOrDelimitedGroup(as,rs));let us=[];for(;ns.withPeriod;){let cs={prop:ns.word};ss+=ns.matchLength,as=as.substring(ns.matchLength),ns=findWordOrDelimitedGroup(as,rs);let ds=[];for(;ns.startDelim==="[";)ds.push(ns.group),ss+=ns.matchLength,as=as.substring(ns.matchLength),ns=findWordOrDelimitedGroup(as,rs);ds.length>0&&(cs.propIndex=ds),ns.startDelim==="{"&&(cs.attributes=ns.group,ss+=ns.matchLength,as=as.substring(ns.matchLength),ns=findWordOrDelimitedGroup(as,rs)),us.push(cs)}return os.propArray=us,os.matchLength=ss,os.success=!0,os}function findWordOrDelimitedGroup(as,rs=!1){let ns=!1,ss=!1;as[0]==="."&&as[1]!=="."&&(ns=!0,as=as.substring(1));let os;rs?ns?os=/^[\w-]+/:(as[0]==="/"&&as[1].match(/\w/)&&(ss=!0,as=as.substring(1)),os=/^([\w\/-]|\.\.\/)+/):os=/^[a-zA-Z_]\w*/;let ls=as.match(os);if(ls)return{success:!0,withPeriod:ns,withSlash:ss,word:ls[0],matchLength:ls[0].length+(ns?1:0)+(ss?1:0)};if(ns||ss)return{success:!1};let us=[],cs={"(":")","{":"}","[":"]"},ds=Object.values(cs),ps=as[0],fs=cs[ps];if(!fs)return{success:!1};us.push(fs);for(let hs=1;hs0?rs[ls]=us.substring(0,os.charInd):rs=rs.slice(0,ls);let ds=breakEmbeddedStringByCommas({childrenList:rs});ds.pieces.forEach(gs=>applyMacros(gs,ss));let ps=ds.pieces.map(gs=>gs.length===1&&typeof gs[0]!="string"?gs[0]:{componentType:"math",doenetAttributes:{createdFromMacro:!0},children:gs}),hs=[{componentType:"evaluate",doenetAttributes:{createdFromMacro:!0},attributes:{function:{component:{componentType:"function",doenetAttributes:{createdFromMacro:!0},children:as}},input:{component:{componentType:"mathList",doenetAttributes:{createdFromMacro:!0},children:ps}}}}];return cs.length>0&&hs.push(cs),{success:!0,componentsFromMacro:hs,lastComponentIndMatched:ls}}function findFirstUnmatchedClosingParens(as){let rs=0;for(let[ns,ss]of as.entries())if(typeof ss=="string"){let os=ss;for(let ls=0;ls").replace(/</g,"<").replace(/$/g,"$").replace(/&/g,"&")}for(let[ns,ss]of as.entries())if(typeof ss=="string")as[ns]=rs(ss);else if(ss.children&&decodeXMLEntities(ss.children),ss.attributes)for(let os in ss.attributes){let ls=ss.attributes[os];ls.component?decodeXMLEntities([ls.component]):ls.primitive?typeof ls.primitive=="string"&&(ls.primitive=rs(ls.primitive)):(ls.childrenForComponent&&decodeXMLEntities(ls.childrenForComponent),ls.rawString&&(ls.rawString=rs(ls.rawString)))}}function applySugar({serializedComponents:as,parentParametersFromSugar:rs={},parentAttributes:ns={},componentInfoObjects:ss,parentUniqueId:os="",isAttributeComponent:ls=!1}){for(let[us,cs]of as.entries()){if(typeof cs!="object")continue;let ds=cs.componentType,ps=ss.allComponentClasses[ds];if(!ps)throw Error(`Unrecognized component type ${ds}`);let fs=os+"|"+ds+us,hs={};for(let gs in cs.attributes){let ys=cs.attributes[gs];ys.primitive!==void 0&&(hs[gs]=ys.primitive)}if(cs.children){let gs={};if(!cs.skipSugar)for(let[ys,bs]of ps.returnSugarInstructions().entries()){let vs=cs.children.map(Ns=>typeof Ns=="string"?"s":"n").join("");if(bs.childrenRegex){let Ns=vs.match(bs.childrenRegex);if(!Ns||Ns[0].length!==cs.children.length)continue}let xs=deepClone(cs.children),Cs=0;for(let Ns of xs)typeof Ns!="string"&&(Ns.preSugarInd=Cs,Cs++);let Ts=!1;cs.doenetAttributes&&cs.doenetAttributes.createdFromMacro&&(Ts=!0);let Ss=bs.replacementFunction({matchedChildren:xs,parentParametersFromSugar:rs,parentAttributes:ns,componentAttributes:hs,uniqueId:fs+"|sugar"+ys,componentInfoObjects:ss,isAttributeComponent:ls,createdFromMacro:Ts});if(Ss.success){let Ns=Ss.newChildren,As=Ss.newAttributes,ws=[],Es=[];if(Ns&&(ws=findPreSugarIndsAndMarkFromSugar(Ns)),As)for(let $s in As){let Rs=As[$s].component;Rs&&Es.push(...findPreSugarIndsAndMarkFromSugar(Rs.children))}let _s=[...ws,...Es];if(_s.length!==Cs||!_s.sort(($s,Rs)=>$s-Rs).every(($s,Rs)=>$s===Rs))throw Error(`Invalid sugar for ${ds} as didn't return set of original components`);if(ws.length>0&&![...ws].sort((Rs,Is)=>Rs-Is).every((Rs,Is)=>Rs===ws[Is]))throw Error(`Invalid sugar for ${ds} as didn't return original components in order`);Ss.parametersForChildrenSugar&&Object.assign(gs,Ss.parametersForChildrenSugar),Ns?cs.children=Ns:cs.children=[],As&&(cs.attributes||(cs.attributes={}),Object.assign(cs.attributes,As))}}ps.removeBlankStringChildrenPostSugar&&(cs.children=cs.children.filter(ys=>typeof ys!="string"||/\S/.test(ys))),applySugar({serializedComponents:cs.children,parentParametersFromSugar:gs,parentAttributes:hs,componentInfoObjects:ss,parentUniqueId:fs})}if(cs.attributes)for(let gs in cs.attributes){let ys=cs.attributes[gs];ys.component&&applySugar({serializedComponents:[ys.component],parentAttributes:hs,componentInfoObjects:ss,parentUniqueId:fs,isAttributeComponent:!0})}}}function breakStringInPiecesBySpacesOrParens(as){if(typeof as!="string")return{success:!1};let rs=0,ns=[];as=as.trim();let ss=0;for(let ls=0;ls0&&ns.push(cs),ss=ls}rs++}else if(us===")"){if(rs===0)return{success:!1};if(rs===1){let cs=as.substring(ss+1,ls).trim();if(cs.length>0){let ds=breakStringInPiecesBySpacesOrParens(cs);ds.success===!0?ns.push(ds.pieces):ns.push(cs)}ss=ls+1}rs--}else if(rs===0&&us.match(/\s/)){let cs=as.substring(ss,ls).trim();cs.length>0&&ns.push(cs),ss=ls}}if(rs!==0)return{success:!1};let os=as.substring(ss,as.length).trim();return os.length>0&&ns.push(os),{success:!0,pieces:ns}}function countRegularComponentTypesInNamespace(as,rs={}){var ns,ss;for(let os of as)if(typeof os=="object"){let ls=os.componentType,us=rs[ls];us===void 0&&(us=0);let cs=os.doenetAttributes;cs!=null&&cs.isAttributeChild||cs!=null&&cs.createdFromSugar||cs!=null&&cs.createdFromMacro||(rs[ls]=++us),os.children&&!((ss=(ns=os.attributes)==null?void 0:ns.newNamespace)!=null&&ss.primitive)&&(rs=countRegularComponentTypesInNamespace(os.children,rs))}return rs}function renameAutonameBasedOnNewCounts(as,rs={}){var ss,os;let ns={...rs};for(let ls of as)if(typeof ls=="object"){let us=ls.componentType,cs=ns[us];cs===void 0&&(cs=0);let ds=ls.doenetAttributes;if(!(ds!=null&&ds.isAttributeChild||ds!=null&&ds.createdFromSugar||ds!=null&&ds.createdFromMacro)&&(ns[us]=++cs,ls.componentName)){let ps=ls.componentName.lastIndexOf("/"),fs=ls.componentName.substring(ps+1),hs="_"+us.toLowerCase();fs.substring(0,hs.length)===hs&&(ls.componentName=ls.componentName.substring(0,ps+1)+hs+cs)}ls.children&&!((os=(ss=ls.attributes)==null?void 0:ss.newNamespace)!=null&&os.primitive)&&(ns=renameAutonameBasedOnNewCounts(ls.children,ns))}return ns}function createComponentNames({serializedComponents:as,namespaceStack:rs=[],componentInfoObjects:ns,parentDoenetAttributes:ss={},parentName:os,useOriginalNames:ls=!1,attributesByTargetComponentName:us,indOffset:cs=0,createNameContext:ds="",initWithoutShadowingComposite:ps=!1}){var gs,ys,bs;rs.length===0&&rs.push({namespace:"",componentCounts:{},namesUsed:{}});let fs=rs.length-1,hs=rs[fs];for(let[vs,xs]of as.entries()){if(typeof xs!="object")continue;let Cs=xs.componentType,Ts=ns.allComponentClasses[Cs],Ss=xs.doenetAttributes;Ss===void 0&&(Ss=xs.doenetAttributes={});let Ns=xs.attributes;Ns||(Ns=xs.attributes={}),Ss.createNameFromComponentType&&(Cs=Ss.createNameFromComponentType);let As=Ss.prescribedName,ws=Ss.assignNames,Es=Ss.target,_s=Ss.isAttributeChild||Ss.createdFromSugar||Ss.createdFromMacro||Ss.createUniqueName,$s;((gs=Ns.newNamespace)!=null&&gs.primitive||ls&&xs.originalAttributes&&xs.originalAttributes.newNamespace)&&($s=!0);let Rs=As!==void 0,Is=xs.props;if(Is===void 0)Is=xs.props={};else for(let Vs in Is){let ks=Vs.toLowerCase();if(ks==="name")if(As===void 0)As=Is[Vs],delete Is[Vs];else throw Error(`Cannot define name twice. Found in component of type ${Cs}${indexRangeString(xs)}`);else if(ks==="assignnames")if(ws===void 0){let Ps=breakStringInPiecesBySpacesOrParens(Is[Vs]);if(Ps.success)ws=Ps.pieces;else throw Error(`Invalid format for assignnames. Found in component of type ${Cs}${indexRangeString(xs)}`);delete Is[Vs]}else throw Error(`Cannot define assignNames twice for a component. Found in component of type ${Cs}${indexRangeString(xs)}`);else if(ks==="target")if(Es===void 0){if(typeof Is[Vs]!="string")throw Error(`Must specify value for target. Found in component of type ${Cs}${indexRangeString(xs)}`);Es=Is[Vs].trim(),delete Is[Vs]}else throw Error(`Cannot define target twice for a component. Found in component of type ${Cs}${indexRangeString(xs)}`)}if(As){if(!Rs&&!Ss.createdFromSugar){if(!/[a-zA-Z]/.test(As.substring(0,1)))throw Error(`Invalid component name: ${As}. Component name must begin with a letter. Found in component of type ${Cs}${indexRangeString(xs)}`);if(!/^[a-zA-Z0-9_\-]+$/.test(As))throw Error(`Invalid component name: ${As}. Component name can contain only letters, numbers, hyphens, and underscores. Found in component of type ${Cs}${indexRangeString(xs)}`)}Ss.prescribedName=As}else if(_s){let Vs=os+"|createUniqueName|";xs.downstreamDependencies?Vs+=JSON.stringify(xs.downstreamDependencies):Vs+=vs+"|"+cs+"|"+ds,As=createUniqueName(Cs.toLowerCase(),Vs)}if(!ws&&ls&&xs.originalDoenetAttributes&&xs.originalDoenetAttributes.assignNames&&(ws=xs.originalDoenetAttributes.assignNames),ws){if(!Ts.assignNamesToReplacements)throw Error(`Cannot assign names for component type ${Cs}${indexRangeString(xs)}`);if(Ss.assignNames=ws,!Ss.createUniqueAssignNames){let ks=flattenDeep(ws);if(!Ss.fromCopyTarget&&!Ss.fromCopyFromURI)for(let Ps of ks){if(!/[a-zA-Z]/.test(Ps.substring(0,1)))throw Error(`All assigned names must begin with a letter. Found in component of type ${Cs}${indexRangeString(xs)}`);if(!/^[a-zA-Z0-9_\-]+$/.test(Ps))throw Error(`Assigned names can contain only letters, numbers, hyphens, and underscores. Found in component of type ${Cs}${indexRangeString(xs)}`)}if(ks.length!==new Set(ks).size)throw Error(`Duplicate assigned names. Found in component of type ${Cs}${indexRangeString(xs)}`)}}$s&&(Ns.newNamespace={primitive:$s});let Os=hs.componentCounts[Cs];Os===void 0&&(Os=0),Ss.isAttributeChild||Ss.createdFromSugar||Ss.createdFromMacro||(hs.componentCounts[Cs]=++Os);let Ds="";for(let Vs=0;Vs<=fs;Vs++)Ds+=rs[Vs].namespace+"/";if(!As){if(ls&&xs.originalName){let Vs=xs.originalName.lastIndexOf("/");As=xs.originalName.substring(Vs+1)}As||(As="_"+Cs.toLowerCase()+Os)}if(Ss.nameBecomesAssignNames){$s&&(Ns.assignNewNamespaces={primitive:!0},delete Ns.newNamespace,$s=!1),ws=Ss.assignNames=[As],delete Ss.nameBecomesAssignNames;let Vs=os+"|createUniqueName|";Ss.createUniqueName=!0,delete Ss.prescribedName,xs.downstreamDependencies?Vs+=JSON.stringify(xs.downstreamDependencies):Vs+=vs+"|"+cs+"|"+ds,As=createUniqueName("copy",Vs)}if(Ds+=As,xs.componentName=Ds,As){if(As in hs.namesUsed)throw Error(`Duplicate component name ${Ds}. Found in component of type ${Cs}${indexRangeString(xs)}`);hs.namesUsed[As]=!0}if(!$s&&ws)for(let Vs of flattenDeep(ws)){if(Vs in hs.namesUsed)throw Error(`Duplicate component name ${Vs} (from assignNames of ${Ds}). Found in component of type ${Cs}${indexRangeString(xs)}`);hs.namesUsed[Vs]=!0}if(xs.doenetAttributes.createUniqueAssignNames&&xs.originalName){let Vs=xs.doenetAttributes.assignNames;Vs||(Vs=xs.doenetAttributes.originalAssignNames);let ks=Ds+"|createUniqueName|assignNames|",Ps="",Bs;if($s)Ps=Ds+"/",Bs=xs.originalName+"/";else{for(let Us=0;Us<=fs;Us++)Ps+=rs[Us].namespace+"/";let Ws=xs.originalName.lastIndexOf("/");Bs=xs.originalName.slice(0,Ws+1)}let Ms=createNewAssignNamesAndrenameMatchingTargetNames({originalAssignNames:Vs,longNameIdBase:ks,namespace:Ps,oldNamespace:Bs,attributesByTargetComponentName:us});ws=xs.doenetAttributes.assignNames=Ms}if(renameMatchingTargetNames(xs,us),Es){if(!Ts.acceptTarget)throw Error(`Component type ${Cs} does not accept a target attribute. Found in component ${Ds}${indexRangeString(xs)}`);if(Es.includes("|"))throw Error(`target cannot include |. Found in component of type ${Cs}${indexRangeString(xs)}`);Ss.target=Es,Ss.targetComponentName=convertComponentTarget({relativeName:Es,oldAbsoluteName:Ss.targetComponentName,namespaceStack:rs,acceptDoubleUnderscore:Ss.createdFromSugar||Ss.allowDoubleUnderscoreTarget})}for(let Vs in Ns){let ks=Ns[Vs];if(ks.targetComponentNames)for(let Ps of ks.targetComponentNames)Ps.absoluteName=convertComponentTarget({relativeName:Ps.relativeName,oldAbsoluteName:Ps.absoluteName,namespaceStack:rs,acceptDoubleUnderscore:Ss.createdFromSugar||Ss.allowDoubleUnderscoreTarget})}if(xs.children)if($s||(ys=Ns.assignNewNamespaces)!=null&&ys.primitive){let Vs={};ws&&flattenDeep(ws).forEach(Bs=>Vs[Bs]=!0);let ks=xs.children;if(Ss.nameFirstChildIndependently&&xs.children.length>0){ks=ks.slice(1);let Bs={namespace:As,componentCounts:{},namesUsed:{}};rs.push(Bs),createComponentNames({serializedComponents:[xs.children[0]],namespaceStack:rs,componentInfoObjects:ns,parentDoenetAttributes:Ss,parentName:Ds,useOriginalNames:ls,attributesByTargetComponentName:us}),rs.pop()}let Ps={namespace:As,componentCounts:{},namesUsed:Vs};if(Ss.haveNewNamespaceOnlyFromShadow){let Bs=!0,Ms=[...ks];for(;Ms.length>0;){let Ws=[];for(let Us of Ms){if(!!((bs=Us.doenetAttributes)!=null&&bs.ignoreParentNewNamespace)===Bs)break;Ws.push(Us)}Ms.splice(0,Ws.length),Bs?rs.push(Ps):ps&&Ws.forEach(Us=>Us.doenetAttributes.createUniqueName=!0),createComponentNames({serializedComponents:Ws,namespaceStack:rs,componentInfoObjects:ns,parentDoenetAttributes:Ss,parentName:Ds,useOriginalNames:ls,attributesByTargetComponentName:us}),Bs&&rs.pop(),Bs=!Bs}}else rs.push(Ps),createComponentNames({serializedComponents:ks,namespaceStack:rs,componentInfoObjects:ns,parentDoenetAttributes:Ss,parentName:Ds,useOriginalNames:ls,attributesByTargetComponentName:us}),rs.pop()}else{let Vs=xs.children;if(Ss.nameFirstChildIndependently&&Vs.length>0){Vs=Vs.slice(1);let ks=hs.namesUsed,Ps=hs.componentCounts;hs.namesUsed={},hs.componentCounts={},createComponentNames({serializedComponents:[xs.children[0]],namespaceStack:rs,componentInfoObjects:ns,parentDoenetAttributes:Ss,parentName:Ds,useOriginalNames:ls,attributesByTargetComponentName:us}),hs.namesUsed=ks,hs.componentCounts=Ps}createComponentNames({serializedComponents:Vs,namespaceStack:rs,componentInfoObjects:ns,parentDoenetAttributes:Ss,parentName:Ds,useOriginalNames:ls,attributesByTargetComponentName:us})}if(xs.attributes)for(let Vs in xs.attributes){let ks=xs.attributes[Vs];if(ks.component){let Ps=ks.component;Ps.doenetAttributes||(Ps.doenetAttributes={}),Ps.doenetAttributes.isAttributeChild=!0,ks.ignoreFixed&&(Ps.doenetAttributes.ignoreParentFixed=!0),createComponentNames({serializedComponents:[Ps],namespaceStack:rs,componentInfoObjects:ns,parentDoenetAttributes:Ss,parentName:Ds,useOriginalNames:ls,attributesByTargetComponentName:us,createNameContext:Vs})}else ks.childrenForComponent&&createComponentNames({serializedComponents:ks.childrenForComponent,namespaceStack:rs,componentInfoObjects:ns,parentDoenetAttributes:Ss,parentName:Ds,useOriginalNames:ls,attributesByTargetComponentName:us,createNameContext:Vs})}}return as}function createNewAssignNamesAndrenameMatchingTargetNames({originalAssignNames:as,longNameIdBase:rs,namespace:ns,oldNamespace:ss,attributesByTargetComponentName:os}){let ls=[];for(let[us,cs]of as.entries())if(Array.isArray(cs)){let ds=createNewAssignNamesAndrenameMatchingTargetNames({originalAssignNames:cs,longNameIdBase:rs+us+"_",namespace:ns,oldNamespace:ss,attributesByTargetComponentName:os});ls.push(ds)}else{let ds=rs+us,ps=createUniqueName("fromAssignNames",ds);ls.push(ps);let fs={componentName:ns+ps,originalName:ss+cs};renameMatchingTargetNames(fs,os,!0)}return ls}function convertComponentTarget({relativeName:as,oldAbsoluteName:rs,namespaceStack:ns,acceptDoubleUnderscore:ss}){if(!rs&&/__/.test(as)&&!ss)throw Error("Invalid reference target: "+as);let os;if(as.substring(0,1)==="/")os=as;else{let ls=ns.length-1;for(;as.substring(0,3)==="../";)as=as.substring(3),ls--;ls<0&&(ls=0),os="";for(let us=0;us<=ls;us++)os+=ns[us].namespace+"/";os+=as}return os}function serializedComponentsReplacer(as,rs){return rs!==rs?{objectType:"special-numeric",stringValue:"NaN"}:rs===1/0?{objectType:"special-numeric",stringValue:"Infinity"}:rs===-1/0?{objectType:"special-numeric",stringValue:"-Infinity"}:rs}let nanInfinityReviver=function(as,rs){if(rs&&rs.objectType==="special-numeric"){if(rs.stringValue==="NaN")return NaN;if(rs.stringValue==="Infinity")return 1/0;if(rs.stringValue==="-Infinity")return-1/0}return rs};function serializedComponentsReviver(as,rs){return Context.reviver(as,theModule.Subset.reviver(as,nanInfinityReviver(as,rs)))}function processAssignNames({assignNames:as=[],assignNewNamespaces:rs=!1,serializedComponents:ns,parentName:ss,parentCreatesNewNamespace:os,componentInfoObjects:ls,indOffset:us=0,originalNamesAreConsistent:cs=!1,shadowingComposite:ds=!1}){var bs,vs;let ps=ns.length;moveComponentNamesToOriginalNames(ns);let fs={},hs=null;if(cs){if(ps>0){let xs=ns.filter(Cs=>typeof Cs=="object")[0];if(xs&&xs.originalName){let Cs=xs.originalName.lastIndexOf("/");hs=xs.originalName.substring(0,Cs)}}if(hs!==null)for(let xs of ns)setTargetsOutsideNamespaceToAbsoluteAndRecordAllTargetComponentNames({namespace:hs,components:[xs],attributesByTargetComponentName:fs})}else for(let xs=0;xs0&&Cs.originalName){let Ts=Cs.originalName.lastIndexOf("/");hs=Cs.originalName.substring(0,Ts)}hs!==null&&setTargetsOutsideNamespaceToAbsoluteAndRecordAllTargetComponentNames({namespace:hs,components:[Cs],attributesByTargetComponentName:fs})}}let gs=[],ys=0;for(let xs=0;xs0&&Ts.originalName)){let Ns=Ts.originalName.lastIndexOf("/");hs=Ts.originalName.substring(0,Ns)}if(Ss){if(ls.allComponentClasses[Ts.componentType].assignNamesSkipOver)Ss=[Ss];else if((bs=Ts.attributes)!=null&&bs.assignNamesSkip){let Ns=Ts.attributes.assignNamesSkip.primitive;if(Ns>0)for(let As=0;As({namespace:gs,componentCounts:{},namesUsed:{}}));as[0]!=="/"&&ps.splice(0,0,{componentCounts:{},namesUsed:{},namespace:""}),rs.doenetAttributes||(rs.doenetAttributes={}),rs.attributes||(rs.attributes={});let fs;(hs=rs.attributes.newNamespace)!=null&&hs.primitive||us?fs=!0:(fs=!1,rs.children&&markToCreateAllUniqueNames(rs.children));for(let gs in rs.attributes){let ys=rs.attributes[gs];ys.component?markToCreateAllUniqueNames([ys.component]):ys.childrenForComponent&&markToCreateAllUniqueNames(ys.childrenForComponent)}createComponentNames({serializedComponents:[rs],namespaceStack:ps,componentInfoObjects:os,parentName:as,useOriginalNames:fs,attributesByTargetComponentName:ls,indOffset:ns,initWithoutShadowingComposite:!cs})}function setTargetsOutsideNamespaceToAbsoluteAndRecordAllTargetComponentNames({namespace:as,components:rs,attributesByTargetComponentName:ns}){let ss=as.length;for(let os of rs)if(typeof os=="object"){if(os.doenetAttributes&&os.doenetAttributes.target){let ls=os.doenetAttributes.targetComponentName;ls!==void 0&&(ls.substring(0,ss)!==as&&(os.doenetAttributes.target=ls),ns[ls]||(ns[ls]=[]),ns[ls].push(os.doenetAttributes))}for(let ls in os.attributes){let us=os.attributes[ls];if(us.targetComponentNames)for(let cs of us.targetComponentNames){let ds=cs.absoluteName;ds!==void 0&&(ds.substring(0,ss)!==as&&(cs.relativeName=ds),ns[ds]||(ns[ds]=[]),ns[ds].push(cs))}}if(os.children&&setTargetsOutsideNamespaceToAbsoluteAndRecordAllTargetComponentNames({namespace:as,components:os.children,attributesByTargetComponentName:ns}),os.attributes)for(let ls in os.attributes){let us=os.attributes[ls];us.component?setTargetsOutsideNamespaceToAbsoluteAndRecordAllTargetComponentNames({namespace:as,components:[us.component],attributesByTargetComponentName:ns}):us.childrenForComponent&&setTargetsOutsideNamespaceToAbsoluteAndRecordAllTargetComponentNames({namespace:as,components:us.childrenForComponent,attributesByTargetComponentName:ns})}}}function renameMatchingTargetNames(as,rs,ns=!1){if(as.originalName&&rs&&as.componentName!==as.originalName){if(rs[as.originalName])for(let ss of rs[as.originalName])ss.relativeName?(ss.relativeName=as.componentName,ss.absoluteName=as.componentName):(ss.target=as.componentName,ss.targetComponentName=as.componentName);if(ns){let ss=as.originalName+"/",os=ss.length;for(let ls in rs)if(ls.substring(0,os)===ss){let us=ls.substring(os);for(let cs of rs[ls])cs.relativeName?(cs.relativeName=as.componentName+"/"+us,cs.absoluteName=as.componentName+"/"+us):(cs.target=as.componentName+"/"+us,cs.targetComponentName=as.componentName+"/"+us)}}}}function moveComponentNamesToOriginalNames(as){for(let rs of as)if(rs.componentName&&(rs.originalName=rs.componentName,delete rs.componentName),rs.children&&moveComponentNamesToOriginalNames(rs.children),rs.attributes)for(let ns in rs.attributes){let ss=rs.attributes[ns];ss.component?moveComponentNamesToOriginalNames([ss.component]):ss.childrenForComponent&&moveComponentNamesToOriginalNames(ss.childrenForComponent)}}function markToCreateAllUniqueNames(as){var rs,ns;for(let ss of as)if(typeof ss=="object"&&(ss.doenetAttributes||(ss.doenetAttributes={}),ss.doenetAttributes.createUniqueName=!0,delete ss.doenetAttributes.prescribedName,(ns=(rs=ss.attributes)==null?void 0:rs.newNamespace)!=null&&ns.primitive||(ss.doenetAttributes.assignNames?(ss.doenetAttributes.createUniqueAssignNames=!0,ss.doenetAttributes.originalAssignNames=ss.doenetAttributes.assignNames,delete ss.doenetAttributes.assignNames):ss.originalDoenetAttributes&&ss.originalDoenetAttributes.assignNames&&(ss.doenetAttributes.createUniqueAssignNames=!0,ss.doenetAttributes.originalAssignNames=ss.originalDoenetAttributes.assignNames),ss.children&&markToCreateAllUniqueNames(ss.children)),ss.attributes))for(let os in ss.attributes){let ls=ss.attributes[os];ls.component?markToCreateAllUniqueNames([ls.component]):ls.childrenForComponent&&markToCreateAllUniqueNames(ls.childrenForComponent)}}function setTNamesToAbsolute(as){for(let rs of as){if(rs.doenetAttributes&&rs.doenetAttributes.target){let ns=rs.doenetAttributes.targetComponentName;ns!==void 0&&(rs.doenetAttributes.target=ns)}if(rs.children&&setTNamesToAbsolute(rs.children),rs.attributes)for(let ns in rs.attributes){let ss=rs.attributes[ns];ss.component?setTNamesToAbsolute([ss.component]):ss.childrenForComponent&&setTNamesToAbsolute(ss.childrenForComponent)}}}function restrictTNamesToNamespace({components:as,namespace:rs,parentNamespace:ns,parentIsCopy:ss=!1,invalidateReferencesToBaseNamespace:os=!1}){var us;ns===void 0&&(ns=rs);let ls=rs.length;for(let cs of as){if(cs.doenetAttributes&&cs.doenetAttributes.target){let ds=cs.doenetAttributes.target;if(ds[0]==="/"){if(ds.substring(0,ls)!==rs){let ps=rs.split("/").slice(1),fs=ds.split("/").slice(1),hs=!1,gs=rs+ds.slice(1);for(;ps.length>0&&ps[0]===fs[0];)ps=ps.slice(1),fs=fs.slice(1),hs=!0;if(hs)gs=rs+fs.join("/");else{let ys=rs.split("/").slice(1);for(let bs=1;bs0||(cs=1)),us in rs?rs[us]+=cs:rs[us]=cs}return rs}const rendererState=Recoil_index_10({key:"rendererState",default:{stateValues:{},sourceOfUpdate:{},ignoreUpdate:!1,childrenInstructions:[],prefixForIds:""}});function useDoenetRenderer(as,rs=!0){let ns=as.componentInstructions.actions,ss=as.componentInstructions.componentName,os=as.componentInstructions.effectiveName,ls=as.coreId+ss,[us,cs]=reactExports.useState({}),{stateValues:ds,sourceOfUpdate:ps={},ignoreUpdate:fs,childrenInstructions:hs,prefixForIds:gs}=Recoil_index_20(rendererState(ls)),ys=[];const bs=Object.keys(us).length===0;for(let Ts of hs){let Ss=vs(Ts,bs);ys.push(Ss)}reactExports.useEffect(()=>{Object.keys(us).length>0&&renderersloadComponent(Object.values(us),Object.keys(us)).then(Ts=>{Object.assign(as.rendererClasses,Ts),cs({})})},[us,as.rendererClasses]);function vs(Ts,Ss){if(typeof Ts=="string")return Ts;let Ns={key:as.coreId+Ts.componentName,componentInstructions:Ts,rendererClasses:as.rendererClasses,flags:as.flags,coreId:as.coreId,callAction:as.callAction},As=as.rendererClasses[Ts.rendererType];return As?React.createElement(As,Ns):(Ss&&cs(Es=>{let _s={...Es};return Ts.rendererType in _s||(_s[Ts.rendererType]=__variableDynamicImportRuntimeHelper(Object.assign({"./renderers/alert.jsx":()=>__vitePreload(()=>import("./alert-c226fd9a.js"),[]),"./renderers/angle.jsx":()=>__vitePreload(()=>import("./angle-c70c4c3b.js"),["assets/angle-c70c4c3b.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/answer.jsx":()=>__vitePreload(()=>import("./answer-8c02c18e.js"),[]),"./renderers/asList.jsx":()=>__vitePreload(()=>import("./asList-0efae1ec.js"),[]),"./renderers/boolean.jsx":()=>__vitePreload(()=>import("./boolean-a3d2d482.js"),[]),"./renderers/booleanInput.jsx":()=>__vitePreload(()=>import("./booleanInput-102cb271.js"),["assets/booleanInput-102cb271.js","assets/ToggleButton-fffa6800.js","assets/booleanInput-01650bf1.css"]),"./renderers/c.jsx":()=>__vitePreload(()=>import("./c-8d620809.js"),[]),"./renderers/callAction.jsx":()=>__vitePreload(()=>import("./callAction-275a57a5.js"),[]),"./renderers/cell.jsx":()=>__vitePreload(()=>import("./cell-ea3cd2d6.js"),[]),"./renderers/chart.jsx":()=>__vitePreload(()=>import("./chart-82ac9578.js"),["assets/chart-82ac9578.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/choiceInput.jsx":()=>__vitePreload(()=>import("./choiceInput-5e85a5a2.js"),["assets/choiceInput-5e85a5a2.js","assets/choiceInput-92287600.css"]),"./renderers/circle.jsx":()=>__vitePreload(()=>import("./circle-0a5606a6.js"),["assets/circle-0a5606a6.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/cobwebPolyline.jsx":()=>__vitePreload(()=>import("./cobwebPolyline-29cb610e.js"),["assets/cobwebPolyline-29cb610e.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/codeEditor.jsx":()=>__vitePreload(()=>import("./codeEditor-1054a77f.js"),["assets/codeEditor-1054a77f.js","assets/css-14ccef8c.js","assets/CodeMirror-af01bb34.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/codeViewer.jsx":()=>__vitePreload(()=>import("./codeViewer-c243d08a.js"),["assets/codeViewer-c243d08a.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/containerBlock.jsx":()=>__vitePreload(()=>import("./containerBlock-d44a5ce6.js"),["assets/containerBlock-d44a5ce6.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/containerInline.jsx":()=>__vitePreload(()=>import("./containerInline-f5a5681b.js"),[]),"./renderers/curve.jsx":()=>__vitePreload(()=>import("./curve-249cdae7.js"),["assets/curve-249cdae7.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/ellipsis.jsx":()=>__vitePreload(()=>import("./ellipsis-9087eb4a.js"),[]),"./renderers/em.jsx":()=>__vitePreload(()=>import("./em-1b329239.js"),[]),"./renderers/embed.jsx":()=>__vitePreload(()=>import("./embed-f62ab46f.js"),["assets/embed-f62ab46f.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/feedback.jsx":()=>__vitePreload(()=>import("./feedback-83b2c508.js"),["assets/feedback-83b2c508.js","assets/index-47ca4f11.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/figure.jsx":()=>__vitePreload(()=>import("./figure-51094dce.js"),["assets/figure-51094dce.js","assets/visibility-sensor-aefdbbd5.js","assets/index.esm-d6b6ff57.js","assets/setPrototypeOf-51e8cf87.js"]),"./renderers/footnote.jsx":()=>__vitePreload(()=>import("./footnote-a071a0ab.js"),[]),"./renderers/graph.jsx":()=>__vitePreload(()=>import("./graph-0c612329.js"),["assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/hint.jsx":()=>__vitePreload(()=>import("./hint-b4ad3e8b.js"),["assets/hint-b4ad3e8b.js","assets/index-47ca4f11.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/image.jsx":()=>__vitePreload(()=>import("./image-b7690ea0.js"),["assets/image-b7690ea0.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/label.jsx":()=>__vitePreload(()=>import("./label-78ee8561.js"),["assets/label-78ee8561.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/legend.jsx":()=>__vitePreload(()=>import("./legend-55512da9.js"),["assets/legend-55512da9.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/line.jsx":()=>__vitePreload(()=>import("./line-b36a7b26.js"),["assets/line-b36a7b26.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/lineSegment.jsx":()=>__vitePreload(()=>import("./lineSegment-d511024e.js"),["assets/lineSegment-d511024e.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/list.jsx":()=>__vitePreload(()=>import("./list-3418a553.js"),["assets/list-3418a553.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/math.jsx":()=>__vitePreload(()=>import("./math-ffa3d1f6.js"),["assets/math-ffa3d1f6.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/mathInput.jsx":()=>__vitePreload(()=>import("./mathInput-b37ad8ec.js"),["assets/mathInput-b37ad8ec.js","assets/MathInputSelector-fa50f67b.js","assets/mathInput-cbd86307.css"]),"./renderers/mathList.jsx":()=>__vitePreload(()=>import("./mathList-25d30cec.js"),[]),"./renderers/matrixInput.jsx":()=>__vitePreload(()=>import("./matrixInput-688b8b02.js"),["assets/matrixInput-688b8b02.js","assets/ActionButton-056b08c3.js","assets/ActionButtonGroup-9e9bafb3.js","assets/mathInput-cbd86307.css"]),"./renderers/mdash.jsx":()=>__vitePreload(()=>import("./mdash-5a747c72.js"),[]),"./renderers/nbsp.jsx":()=>__vitePreload(()=>import("./nbsp-fdf85b3e.js"),[]),"./renderers/ndash.jsx":()=>__vitePreload(()=>import("./ndash-2b9718f9.js"),[]),"./renderers/number.jsx":()=>__vitePreload(()=>import("./number-30a5448d.js"),[]),"./renderers/numberList.jsx":()=>__vitePreload(()=>import("./numberList-95b4b851.js"),[]),"./renderers/orbitalDiagram.jsx":()=>__vitePreload(()=>import("./orbitalDiagram-df765f8c.js"),["assets/orbitalDiagram-df765f8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/orbitalDiagramInput.jsx":()=>__vitePreload(()=>import("./orbitalDiagramInput-e8842545.js"),["assets/orbitalDiagramInput-e8842545.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/p.jsx":()=>__vitePreload(()=>import("./p-2d693fae.js"),["assets/p-2d693fae.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/paginatorControls.jsx":()=>__vitePreload(()=>import("./paginatorControls-6e627977.js"),[]),"./renderers/pegboard.jsx":()=>__vitePreload(()=>import("./pegboard-8d7f035b.js"),["assets/pegboard-8d7f035b.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/point.jsx":()=>__vitePreload(()=>import("./point-568fc36e.js"),["assets/point-568fc36e.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/polygon.jsx":()=>__vitePreload(()=>import("./polygon-8718e4fd.js"),["assets/polygon-8718e4fd.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/polyline.jsx":()=>__vitePreload(()=>import("./polyline-19819420.js"),["assets/polyline-19819420.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/pre.jsx":()=>__vitePreload(()=>import("./pre-f047eef1.js"),["assets/pre-f047eef1.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/q.jsx":()=>__vitePreload(()=>import("./q-4058f1e9.js"),[]),"./renderers/ray.jsx":()=>__vitePreload(()=>import("./ray-fa809714.js"),["assets/ray-fa809714.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/ref.jsx":()=>__vitePreload(()=>import("./ref-d259f21d.js"),[]),"./renderers/regionBetweenCurveXAxis.jsx":()=>__vitePreload(()=>import("./regionBetweenCurveXAxis-0e1749d4.js"),["assets/regionBetweenCurveXAxis-0e1749d4.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/row.jsx":()=>__vitePreload(()=>import("./row-010cb0da.js"),[]),"./renderers/section.jsx":()=>__vitePreload(()=>import("./section-a358b9f5.js"),["assets/section-a358b9f5.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/sideBySide.jsx":()=>__vitePreload(()=>import("./sideBySide-1e910cfa.js"),["assets/sideBySide-1e910cfa.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/slider.jsx":()=>__vitePreload(()=>import("./slider-4e82f562.js"),["assets/slider-4e82f562.js","assets/ActionButton-056b08c3.js","assets/ActionButtonGroup-9e9bafb3.js"]),"./renderers/solution.jsx":()=>__vitePreload(()=>import("./solution-914435c0.js"),["assets/solution-914435c0.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/spreadsheet.jsx":()=>__vitePreload(()=>import("./spreadsheet-ffaf65b5.js"),["assets/spreadsheet-ffaf65b5.js","assets/moment-a2107d39.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js","assets/spreadsheet-f0a2a11b.css"]),"./renderers/sq.jsx":()=>__vitePreload(()=>import("./sq-20bc896e.js"),[]),"./renderers/subsetOfRealsInput.jsx":()=>__vitePreload(()=>import("./subsetOfRealsInput-59bd870f.js"),["assets/subsetOfRealsInput-59bd870f.js","assets/ActionButton-056b08c3.js","assets/ActionButtonGroup-9e9bafb3.js","assets/ToggleButton-fffa6800.js","assets/ToggleButtonGroup-0ab38e3a.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/summaryStatistics.jsx":()=>__vitePreload(()=>import("./summaryStatistics-bd1e35f8.js"),["assets/summaryStatistics-bd1e35f8.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/table.jsx":()=>__vitePreload(()=>import("./table-f1fe5d1a.js"),["assets/table-f1fe5d1a.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/tabular.jsx":()=>__vitePreload(()=>import("./tabular-bbf236ab.js"),["assets/tabular-bbf236ab.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/tag.jsx":()=>__vitePreload(()=>import("./tag-9ca120fd.js"),[]),"./renderers/text.jsx":()=>__vitePreload(()=>import("./text-af45da17.js"),["assets/text-af45da17.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/textInput.jsx":()=>__vitePreload(()=>import("./textInput-8b61e9c3.js"),["assets/textInput-8b61e9c3.js","assets/css-14ccef8c.js"]),"./renderers/textList.jsx":()=>__vitePreload(()=>import("./textList-63a95c8f.js"),[]),"./renderers/triggerSet.jsx":()=>__vitePreload(()=>import("./triggerSet-2a7a15cd.js"),[]),"./renderers/updateValue.jsx":()=>__vitePreload(()=>import("./updateValue-0c45c8c4.js"),[]),"./renderers/vector.jsx":()=>__vitePreload(()=>import("./vector-d3ac7f71.js"),["assets/vector-d3ac7f71.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/video.jsx":()=>__vitePreload(()=>import("./video-44f5e648.js"),["assets/video-44f5e648.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"])}),`./renderers/${Ts.rendererType}.jsx`)),_s}),null)}let xs=as.componentInstructions.rendererType;const Cs=Ts=>(Ts.componentName||(Ts={...Ts},Ts.componentName=ss),Ts.rendererType||(Ts={...Ts},Ts.rendererType=xs),as.callAction(Ts));return{name:os,id:gs+os,SVs:ds,actions:ns,children:ys,sourceOfUpdate:ps,ignoreUpdate:fs,rendererName:ls,initializeChildren:()=>{},callAction:Cs}}function returnStandardSequenceAttributes(){return{type:{createPrimitiveOfType:"string",createStateVariable:"type",defaultPrimitiveValue:"number",toLowerCase:!0,validValues:["number","math","letters"]},from:{createComponentOfType:"_componentWithSelectableType"},to:{createComponentOfType:"_componentWithSelectableType"},step:{createComponentOfType:"math"},length:{createComponentOfType:"number"},exclude:{createComponentOfType:"_componentListWithSelectableType"}}}function returnStandardSequenceStateVariableDefinitions(){let as={};return as.specifiedFrom={returnDependencies:()=>({fromAttr:{dependencyType:"attributeComponent",attributeName:"from",variableNames:["value"]}}),defaultValue:null,hasEssential:!0,essentialVarName:"from",definition:function({dependencyValues:rs}){return rs.fromAttr===null?{useEssentialOrDefaultValue:{specifiedFrom:!0}}:rs.fromAttr.stateValues.value===null?{setValue:{specifiedFrom:NaN}}:{setValue:{specifiedFrom:rs.fromAttr.stateValues.value}}}},as.specifiedTo={returnDependencies:()=>({toAttr:{dependencyType:"attributeComponent",attributeName:"to",variableNames:["value"]}}),defaultValue:null,hasEssential:!0,essentialVarName:"to",definition:function({dependencyValues:rs}){return rs.toAttr===null?{useEssentialOrDefaultValue:{specifiedTo:!0}}:rs.toAttr.stateValues.value===null?{setValue:{specifiedTo:NaN}}:{setValue:{specifiedTo:rs.toAttr.stateValues.value}}}},as.specifiedLength={returnDependencies:()=>({lengthAttr:{dependencyType:"attributeComponent",attributeName:"length",variableNames:["value"]}}),defaultValue:null,hasEssential:!0,essentialVarName:"length",definition:function({dependencyValues:rs}){return rs.lengthAttr===null?{useEssentialOrDefaultValue:{specifiedLength:!0}}:rs.lengthAttr.stateValues.value===null?{setValue:{specifiedLength:NaN}}:{setValue:{specifiedLength:rs.lengthAttr.stateValues.value}}}},as.specifiedStep={returnDependencies:()=>({stepAttr:{dependencyType:"attributeComponent",attributeName:"step",variableNames:["value"]},type:{dependencyType:"stateVariable",variableName:"type"}}),defaultValue:null,hasEssential:!0,essentialVarName:"step",definition:function({dependencyValues:rs}){if(rs.stepAttr===null)return{useEssentialOrDefaultValue:{specifiedStep:!0}};let ns=rs.stepAttr.stateValues.value;return ns===null?{setValue:{specifiedStep:NaN}}:{setValue:{specifiedStep:ns}}}},as.specifiedExclude={returnDependencies:()=>({excludeAttr:{dependencyType:"attributeComponent",attributeName:"exclude",variableNames:["values"]}}),defaultValue:[],hasEssential:!0,essentialVarName:"exclude",definition:function({dependencyValues:rs}){return rs.excludeAttr===null?{useEssentialOrDefaultValue:{specifiedExclude:!0}}:{setValue:{specifiedExclude:rs.excludeAttr.stateValues.values}}}},as.lowercase={returnDependencies:()=>({specifiedTo:{dependencyType:"stateVariable",variableName:"specifiedTo"},specifiedFrom:{dependencyType:"stateVariable",variableName:"specifiedFrom"}}),definition:function({dependencyValues:rs}){let ns=/^[A-Z]*$/,ss=!0;return rs.specifiedFrom!==null?ns.test(rs.specifiedFrom)&&(ss=!1):rs.specifiedTo!==null&&ns.test(rs.specifiedTo)&&(ss=!1),{setValue:{lowercase:ss}}}},as.validSequence={returnDependencies:()=>({specifiedLength:{dependencyType:"stateVariable",variableName:"specifiedLength"},specifiedStep:{dependencyType:"stateVariable",variableName:"specifiedStep"},specifiedFrom:{dependencyType:"stateVariable",variableName:"specifiedFrom"},specifiedTo:{dependencyType:"stateVariable",variableName:"specifiedTo"},type:{dependencyType:"stateVariable",variableName:"type"},lowercase:{dependencyType:"stateVariable",variableName:"lowercase"}}),definition:function({dependencyValues:rs}){let ns=!0;if(rs.specifiedLength!==null&&(!Number.isInteger(rs.specifiedLength)||rs.specifiedLength<0)&&(console.warn("Invalid length of sequence. Must be a non-negative integer."),ns=!1),rs.specifiedStep!==null&&rs.type!=="math"){let ss=findFiniteNumericalValue(rs.specifiedStep);Number.isFinite(ss)||(console.warn("Invalid step of sequence. Must be a number for sequence of type "+rs.type+"."),ns=!1)}if(rs.specifiedFrom!==null)if(rs.type==="number"){let ss=findFiniteNumericalValue(rs.specifiedFrom);Number.isFinite(ss)||(console.warn("Invalid from of number sequence. Must be a number"),ns=!1)}else Number.isNaN(rs.specifiedFrom)&&(console.warn("Invalid from of sequence"),ns=!1);if(rs.specifiedTo!==null)if(rs.type==="number"){let ss=findFiniteNumericalValue(rs.specifiedTo);Number.isFinite(ss)||(console.warn("Invalid to of number sequence. Must be a number"),ns=!1)}else Number.isNaN(rs.specifiedTo)&&(console.warn("Invalid to of sequence"),ns=!1);return{setValue:{validSequence:ns}}}},as.from={additionalStateVariablesDefined:["step","length","exclude"],returnDependencies:()=>({specifiedFrom:{dependencyType:"stateVariable",variableName:"specifiedFrom"},specifiedTo:{dependencyType:"stateVariable",variableName:"specifiedTo"},specifiedLength:{dependencyType:"stateVariable",variableName:"specifiedLength"},specifiedStep:{dependencyType:"stateVariable",variableName:"specifiedStep"},type:{dependencyType:"stateVariable",variableName:"type"},specifiedExclude:{dependencyType:"stateVariable",variableName:"specifiedExclude"},validSequence:{dependencyType:"stateVariable",variableName:"validSequence"}}),definition:function({dependencyValues:rs}){let ns=rs.specifiedFrom,ss=rs.specifiedTo,os=rs.specifiedStep,ls=rs.specifiedLength,us=[...rs.specifiedExclude],cs=rs.type;if(rs.type==="math")ss!==null&&(ss instanceof Context.class||(ss=Context.fromAst(ss))),ns!==null&&(ns instanceof Context.class||(ns=Context.fromAst(ns))),os!==null&&(os instanceof Context.class||(os=Context.fromAst(os)));else if(os!==null&&os instanceof Context.class&&(os=os.evaluate_to_constant()),rs.type==="letters")ns!==null&&(ns=lettersToNumber$1(ns)),ss!==null&&(ss=lettersToNumber$1(ss)),us=us.map(lettersToNumber$1);else if(rs.type==="number"){ss!==null&&(ss instanceof Context.class?ss=ss.evaluate_to_constant():ss=Number(ss)),ns!==null&&(ns instanceof Context.class?ns=ns.evaluate_to_constant():ns=Number(ns));for(let[ds,ps]of us.entries())ps instanceof Context.class?us[ds]=ps.evaluate_to_constant():us[ds]=Number(ps)}if(rs.validSequence){let ds=calculateSequenceParameters({from:ns,to:ss,step:os,length:ls,type:cs});return ds.exclude=us,{setValue:ds}}return(!Number.isInteger(ls)||ls<0)&&(ls=0),{setValue:{from:ns,step:os,length:ls,exclude:us}}}},as}function calculateSequenceParameters({from:as,to:rs,step:ns,length:ss,type:os}){if(as===null)rs===null?(os==="math"?as=Context.fromAst(1):as=1,ns===null&&(os==="math"?ns=Context.fromAst(1):ns=1),ss===null&&(ss=10)):(ns===null&&(os==="math"?ns=Context.fromAst(1):ns=1),ss===null&&(os==="math"?ss=Math.floor((rs.subtract(1).divide(ns).evaluate_to_constant()+1)*(1+1e-14)):ss=Math.floor(((rs-1)/ns+1)*(1+1e-14))),os==="math"?as=rs.subtract(ns.multiply(ss-1)).simplify():(as=rs-ns*(ss-1),os==="letters"&&as<1&&(ss=Math.floor(((rs-1)/ns+1)*(1+1e-14)),as=rs-ns*(ss-1))));else if(rs===null)ns===null&&(os==="math"?ns=Context.fromAst(1):ns=1),ss===null&&(ss=10);else if(ns===null)ss===null?os==="math"?(ns=Context.fromAst(1),ss=Math.floor(rs.subtract(as).add(1).evaluate_to_constant()*(1+1e-14))):(ns=1,ss=Math.floor((rs-as+1)*(1+1e-14))):os==="math"?ns=rs.subtract(as).divide(ss-1):(ns=(rs-as)/(ss-1),os==="letters"&&(ns=Math.floor(ns)));else if(ss===null)os==="math"?ss=Math.floor(rs.subtract(as).divide(ns).add(1).evaluate_to_constant()*(1+1e-14)):ss=Math.floor(((rs-as)/ns+1)*(1+1e-14));else throw Error("Can't define from, to, step, and length for sequence");return(!Number.isInteger(ss)||ss<0)&&(console.warn("Invalid length of sequence. Must be a non-negative integer."),ss=0),{from:as,step:ns,length:ss}}function returnSequenceValues({from:as,step:rs,length:ns,exclude:ss,type:os,lowercase:ls,maxNum:us},cs=!1){let ds=[],ps=0;for(let fs=0;fs0&&(os==="math"?hs=hs.add(rs.multiply(Context.fromAst(fs))).expand().simplify():hs+=rs*fs),os==="math"){if(ss.some(gs=>gs&&gs.equals(hs)))continue}else if(os==="number"){if(ss.some(gs=>Math.abs(gs-hs)<=1e-14*Math.max(Math.abs(gs),Math.abs(hs))))continue}else if(ss.includes(hs))continue;if(os==="letters"&&(hs=numberToLetters(hs,ls)),cs?ds.push({value:hs,originalIndex:fs}):ds.push(hs),ps++,ps===us)break}return ds}function returnSequenceValueForIndex({index:as,from:rs,step:ns,length:ss,exclude:os,type:ls,lowercase:us}){if(!(as>=0&&(ss===void 0||as0&&(ls==="math"?cs=cs.add(ns.multiply(Context.fromAst(as))).expand().simplify():cs+=ns*as),ls==="math"){if(os.some(ds=>ds&&ds.equals(cs)))return null}else if(ls==="number"){if(os.some(ds=>Math.abs(ds-cs)<=1e-14*Math.max(Math.abs(ds),Math.abs(cs))))return null}else if(os.includes(cs))return null;return ls==="letters"&&(cs=numberToLetters(cs,us)),cs}function lettersToNumber$1(as){try{as=as.toUpperCase()}catch{console.warn("Cannot convert "+as+" to a number");return}let rs=0,ns=as.length,ss=ns;for(;(ss-=1)>-1;){let os=as.charCodeAt(ss)-64;if(os<1||os>26){console.warn("Cannot convert "+as+" to a number");return}rs+=os*Math.pow(26,ns-1-ss)}return rs}function numberToLetters(as,rs){as--;let ns=65;rs&&(ns=97);let ss="";for(;;){let os=as%26;if(ss=String.fromCharCode(ns+os)+ss,as<26)break;as=Math.floor(as/26)-1}return ss}let styleAttributes={lineColor:{componentType:"text"},lineColorWord:{componentType:"text"},lineColorDarkMode:{componentType:"text"},lineColorWordDarkMode:{componentType:"text"},lineOpacity:{componentType:"number"},lineWidth:{componentType:"number"},lineWidthWord:{componentType:"text"},lineStyle:{componentType:"text"},lineStyleWord:{componentType:"text"},markerColor:{componentType:"text"},markerColorWord:{componentType:"text"},markerColorDarkMode:{componentType:"text"},markerColorWordDarkMode:{componentType:"text"},markerStyle:{componentType:"text"},markerStyleWord:{componentType:"text"},markerSize:{componentType:"number"},fillColor:{componentType:"text"},fillColorWord:{componentType:"text"},fillColorDarkMode:{componentType:"text"},fillColorWordDarkMode:{componentType:"text"},fillOpacity:{componentType:"number"}},defaultStyle={lineColor:"#648FFF",lineColorWord:"blue",lineColorDarkMode:"#648FFF",lineColorWordDarkMode:"blue",lineOpacity:.7,lineWidth:4,lineWidthWord:"thick",lineStyle:"solid",lineStyleWord:"",markerColor:"#648FFF",markerColorWord:"blue",markerColorDarkMode:"#648FFF",markerColorWordDarkMode:"blue",markerStyle:"circle",markerStyleWord:"point",markerSize:5,fillColor:"#648FFF",fillColorWord:"blue",fillColorDarkMode:"#648FFF",fillColorWordDarkMode:"blue",fillOpacity:.3};function returnDefaultStyleDefinitions(){return{1:{lineColor:"#648FFF",lineColorWord:"blue",lineColorDarkMode:"#648FFF",lineColorWordDarkMode:"blue",lineOpacity:.7,lineWidth:4,lineWidthWord:"thick",lineStyle:"solid",lineStyleWord:"",markerColor:"#648FFF",markerColorWord:"blue",markerColorDarkMode:"#648FFF",markerColorWordDarkMode:"blue",markerStyle:"circle",markerStyleWord:"point",markerSize:5,fillColor:"#648FFF",fillColorWord:"blue",fillColorDarkMode:"#648FFF",fillColorWordDarkMode:"blue",fillOpacity:.3},2:{lineColor:"#D4042D",lineColorWord:"red",lineColorDarkMode:"#D4042D",lineColorWordDarkMode:"red",lineOpacity:.7,lineWidth:2,lineWidthWord:"",lineStyle:"solid",lineStyleWord:"",markerColor:"#D4042D",markerColorWord:"red",markerColorDarkMode:"#D4042D",markerColorWordDarkMode:"red",markerStyle:"square",markerStyleWord:"square",markerSize:5,fillColor:"#D4042D",fillColorWord:"red",fillColorDarkMode:"#D4042D",fillColorWordDarkMode:"red",fillOpacity:.3},3:{lineColor:"#F19143",lineColorWord:"orange",lineColorDarkMode:"#F19143",lineColorWordDarkMode:"orange",lineOpacity:.7,lineWidth:3,lineWidthWord:"",lineStyle:"solid",lineStyleWord:"",markerColor:"#F19143",markerColorWord:"orange",markerColorDarkMode:"#F19143",markerColorWordDarkMode:"orange",markerStyle:"triangle",markerStyleWord:"triangle",markerSize:5,fillColor:"#F19143",fillColorWord:"orange",fillColorDarkMode:"#F19143",fillColorWordDarkMode:"orange",fillOpacity:.3},4:{lineColor:"#644CD6",lineColorWord:"purple",lineColorDarkMode:"#644CD6",lineColorWordDarkMode:"purple",lineOpacity:.7,lineWidth:2,lineWidthWord:"",lineStyle:"solid",lineStyleWord:"",markerColor:"#644CD6",markerColorWord:"purple",markerColorDarkMode:"#644CD6",markerColorWordDarkMode:"purple",markerStyle:"diamond",markerStyleWord:"diamond",markerSize:5,fillColor:"#644CD6",fillColorWord:"purple",fillColorDarkMode:"#644CD6",fillColorWordDarkMode:"purple",fillOpacity:.3},5:{lineColor:"black",lineColorWord:"black",lineColorDarkMode:"white",lineColorWordDarkMode:"white",lineOpacity:.7,lineWidth:1,lineWidthWord:"thin",lineStyle:"solid",lineStyleWord:"",markerColor:"black",markerColorWord:"black",markerColorDarkMode:"white",markerColorWordDarkMode:"white",markerStyle:"circle",markerStyleWord:"point",markerSize:5,fillColor:"black",fillColorWord:"black",fillColorDarkMode:"white",fillColorWordDarkMode:"white",fillOpacity:.3},6:{lineColor:"gray",lineColorWord:"gray",lineColorDarkMode:"gray",lineColorWordDarkMode:"gray",lineOpacity:.7,lineWidth:1,lineWidthWord:"thin",lineStyle:"dotted",lineStyleWord:"dotted",markerColor:"gray",markerColorWord:"gray",markerColorDarkMode:"gray",markerColorWordDarkMode:"gray",markerStyle:"circle",markerStyleWord:"point",markerSize:5,fillColor:"gray",fillColorWord:"gray",fillColorDarkMode:"gray",fillColorWordDarkMode:"gray",fillOpacity:.3}}}function returnStyleDefinitionStateVariables(){let as={};return as.setupChildren={returnDependencies:()=>({setupChildren:{dependencyType:"child",childGroups:["setups"],proceedIfAllChildrenNotMatched:!0}}),definition({dependencyValues:rs}){return{setValue:{setupChildren:rs.setupChildren}}}},as.styleDefinitions={stateVariablesDeterminingDependencies:["setupChildren"],returnDependencies({stateValues:rs}){let ns={ancestorWithStyle:{dependencyType:"ancestor",variableNames:["styleDefinitions"]},setupChildren:{dependencyType:"child",childGroups:["setups"],proceedIfAllChildrenNotMatched:!0}};for(let ss of rs.setupChildren)ns[`styleDefinitionsOf${ss.componentName}`]={dependencyType:"child",parentName:ss.componentName,childGroups:["styleDefinitions"],variableNames:["value"]};return ns},definition({dependencyValues:rs}){let ns={},ss;rs.ancestorWithStyle&&(ss=rs.ancestorWithStyle.stateValues.styleDefinitions),ss||(ss=returnDefaultStyleDefinitions());for(let ls in ss)ns[ls]=Object.assign({},ss[ls]);let os=[];for(let ls of rs.setupChildren)os.push(...rs[`styleDefinitionsOf${ls.componentName}`]);for(let ls of os){let us=ls.stateValues.value;for(let cs in us){let ds=ns[cs];ds||(ds=ns[cs]=Object.assign({},defaultStyle));let ps=Object.assign({},us[cs]);"markerColor"in ps&&!("markerColorWord"in ps)&&(ps.markerColorWord=ps.markerColor),"markerColorDarkMode"in ps&&!("markerColorWordDarkMode"in ps)&&(ps.markerColorWordDarkMode=ps.markerColorDarkMode),"markerColor"in ps&&!("markerColorDarkMode"in ps)&&(ps.markerColorDarkMode=ps.markerColor,ps.markerColorWordDarkMode=ps.markerWordColor),"markerStyle"in ps&&!("markerStyleWord"in ps)&&(ps.markerStyleWord=ps.markerStyle,ps.markerStyleWord==="circle"?ps.markerStyleWord="point":ps.markerStyleWord.slice(0,8)==="triangle"&&(ps.markerStyleWord="triangle")),"lineColor"in ps&&!("lineColorWord"in ps)&&(ps.lineColorWord=ps.lineColor),"lineColorDarkMode"in ps&&!("lineColorWordDarkMode"in ps)&&(ps.lineColorWordDarkMode=ps.lineColorDarkMode),"lineColor"in ps&&!("lineColorDarkMode"in ps)&&(ps.lineColorDarkMode=ps.lineColor,ps.lineColorWordDarkMode=ps.lineWordColor),"fillColor"in ps&&!("fillColorWord"in ps)&&(ps.fillColorWord=ps.fillColor),"fillColorDarkMode"in ps&&!("fillColorWordDarkMode"in ps)&&(ps.fillColorWordDarkMode=ps.fillColorDarkMode),"fillColor"in ps&&!("fillColorDarkMode"in ps)&&(ps.fillColorDarkMode=ps.fillColor,ps.fillColorWordDarkMode=ps.fillWordColor),"lineWidth"in ps&&!("lineWidthWord"in ps)&&(ps.lineWidth>=4?ps.lineWidthWord="thick":ps.lineWidth<=1?ps.lineWidthWord="thin":ps.lineWidthWord=""),"lineStyle"in ps&&!("lineStyleWord"in ps)&&(ps.lineStyle==="dashed"?ps.lineStyleWord="dashed":ps.lineStyle==="dotted"?ps.lineStyleWord="dotted":ps.lineStyleWord=""),Object.assign(ds,ps)}}return{setValue:{styleDefinitions:ns}}}},as}function returnSelectedStyleStateVariableDefinition(){return{selectedStyle:{forRenderer:!0,willNeverBeEssential:!0,returnDependencies:()=>({styleNumber:{dependencyType:"stateVariable",variableName:"styleNumber"},ancestorWithStyle:{dependencyType:"ancestor",variableNames:["styleDefinitions"]}}),definition:function({dependencyValues:as}){let rs=as.ancestorWithStyle.stateValues.styleDefinitions;rs||(rs=returnDefaultStyleDefinitions());let ns=rs[as.styleNumber];return ns===void 0&&(ns=defaultStyle),{setValue:{selectedStyle:ns}}}}}}function createStateProxyHandler(){return{get:function(as,rs){let ns=as[rs];return ns!==void 0&&(ns.isArray&&(ns.public||ns.trackChanges)?ns=new Proxy(ns.value,createArrayProxyHandler({variable:rs,nDimensions:ns.nDimensions})):ns=ns.value),ns},set:function(as,rs,ns){throw Error("Property "+rs+" is read-only")},deleteProperty:function(as,rs){throw Error("Property "+rs+" is read-only")}}}function createArrayProxyHandler({variable:as,nDimensions:rs,indicesSoFar:ns=[]}){return{variable:as,nDimensions:rs,indicesSoFar:ns,get:function(ss,os){if(os==="then"&&ss instanceof Promise)return us=>ss.then.bind(ss)(cs=>us(cs!==null&&typeof cs=="object"?new Proxy(cs,createArrayProxyHandler({variable:this.variable,nDimensions:this.nDimensions,indicesSoFar:this.indicesSoFar})):cs));let ls=ss[os];return ls!==null&&typeof ls=="object"&&rs>1&&(ls=new Proxy(ls,createArrayProxyHandler({variable:this.variable,nDimensions:this.nDimensions-1,indicesSoFar:[...this.indicesSoFar,os]}))),ls},set:function(ss,os,ls){throw Error("Property "+os+" is read-only")},deleteProperty:function(ss,os){throw Error("Property "+os+" is read-only")}}}function enumerateSelectionCombinations({numberOfIndices:as,numberOfOptions:rs,maxNumber:ns=1/0,withReplacement:ss=!1,skipZero:os=!1}){if(as===1){let ds=[...Array(rs).keys()];return ds=ds.slice(1),os||(ds=[...ds,0]),ds=ds.slice(0,ns),ds=ds.map(ps=>[ps]),ds}let ls=enumerateSelectionCombinations({numberOfIndices:as-1,numberOfOptions:rs,maxNumber:ns,withReplacement:ss,skipZero:!ss}),us=[],cs=0;for(let ds of ls)for(let ps=1;ps<=rs;ps++){let fs=[ps%rs,...ds.map(hs=>(ps+hs)%rs)];if(!(os&&fs.includes(0))&&(us.push(fs),cs++,cs>=ns))return us}return us}function enumerateCombinations({numberOfOptionsByIndex:as,maxNumber:rs=1/0}){let ns=as.length;if(ns===0)return[];let ss=[];for(let bs=0;bs[...vs,...bs],[]).reduce((bs,vs)=>Math.max(bs,vs),1);if(os===1){let bs=as.reduce((xs,Cs)=>xs*Cs);bs=Math.min(bs,rs);let vs=[];for(let xs=0;xsxs%Ts);vs.push(Cs)}return vs}if(ns===2){let bs=os,vs=Context.math.lcm(...as),xs=[],Cs=0;for(let Ts=0;Ts=rs)return xs}return xs}let ls=[];for(let bs=0;bs1?vs.push(Context.math.lcm(as[bs],as[xs])):vs.push(null);ls.push(vs)}let us=ls.reduce((bs,vs)=>[...vs,...bs],[]).filter(bs=>bs!==null).reduce((bs,vs)=>Math.min(bs,vs),1/0),cs;for(let bs=0;bs{if(os.length===0)ns.push(ls);else for(let us=0;us=rs)return}};return ss(as),ns}function getVariantsForDescendantsForUniqueVariants({variantIndex:as,serializedComponent:rs,componentInfoObjects:ns}){var cs;let ss=(cs=rs.variants)==null?void 0:cs.descendantVariantComponents;if(ss===void 0)return{success:!1};let os=ss.map(ds=>ds.variants.numberOfVariants),ls=enumerateCombinations({numberOfOptionsByIndex:os,maxNumber:as})[as-1],us=[];for(let[ds,ps]of ss.entries()){let hs=ns.allComponentClasses[ps.componentType].getUniqueVariant({serializedComponent:ps,variantIndex:ls[ds]+1,componentInfoObjects:ns});if(hs.success)us.push(hs.desiredVariant);else return{succss:!1}}return{success:!0,desiredVariants:us}}function setUpVariantSeedAndRng({serializedComponent:as,sharedParameters:rs,descendantVariantComponents:ns,useSubpartVariantRng:ss=!1}){let os,ls;if(as.variants&&(ls=as.variants.desiredVariant),(ls==null?void 0:ls.seed)!==void 0?os=ls.seed.toString():ss?os=rs.subpartVariantRng().toString().slice(2):os=rs.variantRng().toString().slice(2),rs.variantSeed=os,rs.variantRng=new rs.rngClass(rs.variantSeed),rs.subpartVariantRng=new rs.rngClass(rs.variantSeed+"s"),ls!=null&&ls.subvariants&&ns)for(let us in ls.subvariants){let cs=ls.subvariants[us],ds=ns[us];if(ds===void 0)break;ds.variants.desiredVariant=cs}}function gatherVariantComponents({serializedComponents:as,componentInfoObjects:rs}){let ns=[];for(let ss of as){if(typeof ss!="object")continue;if(ss.variants||(ss.variants={}),ss.variants.isVariantComponent){ns.push(ss);continue}if(ss.componentType in rs.componentTypesCreatingVariants){ss.variants.isVariantComponent=!0,ns.push(ss);continue}if(!ss.children)continue;if(ss.children.some(us=>us.componentType==="variantControl")){ss.variants.isVariantComponent=!0,ns.push(ss);continue}let ls=gatherVariantComponents({serializedComponents:ss.children,componentInfoObjects:rs});ls.length>0&&(ss.variants.descendantVariantComponents=ls,ns.push(...ls))}return ns}function getNumberOfVariants({serializedComponent:as,componentInfoObjects:rs}){as.variants||(as.variants={});let ns;for(let os of as.children)if(os.componentType==="variantControl"){ns=os;break}let ss=as.componentType==="document";if(!ns){if(!ss)return{success:!1};let os=as.children.filter(ls=>ls.componentType||ls.trim()!=="");if(os.length===1&&rs.isInheritedComponentType({inheritedComponentType:os[0].componentType,baseComponentType:"_sectioningComponent"})){let ls=os[0],us=getNumberOfVariants({serializedComponent:ls,componentInfoObjects:rs});if(us.success)return as.variants.descendantVariantComponents=gatherVariantComponents({serializedComponents:as.children,componentInfoObjects:rs}),as.variants.uniqueVariants=!0,as.variants.numberOfVariants=ls.variants.numberOfVariants,as.variants.allPossibleVariants=ls.variants.allPossibleVariants,as.variants.allVariantNames=ls.variants.allVariantNames,as.variants.allPossibleVariantUniqueIndices=[...ls.variants.allPossibleVariants.keys()].map(cs=>cs+1),as.variants.allPossibleVariantSeeds=[...ls.variants.allPossibleVariants.keys()].map(cs=>(cs+1).toString()),us}}return determineVariantsForSection({serializedComponent:as,componentInfoObjects:rs,isDocument:ss})}function determineVariantsForSection({serializedComponent:as,componentInfoObjects:rs,isDocument:ns=!1}){var Ns,As,ws,Es;as.variants===void 0&&(as.variants={});let ss;for(let _s of as.children)if(_s.componentType==="variantControl"){ss=_s;break}if(!ss&&!ns)return rs.allComponentClasses._base.determineNumberOfUniqueVariants({serializedComponent:as,componentInfoObjects:rs});let os=[];if(ss!=null&&ss.attributes.variantNames&&(os=ss.attributes.variantNames.component.children.map(_s=>_s.toLowerCase())),os.length!==[...new Set(os)].length)throw Error("Duplicate variant names specified");let ls=(Ns=ss==null?void 0:ss.attributes.nVariants)==null?void 0:Ns.primitive;Number.isFinite(ls)||(ls=100),ls=Math.min(Math.max(ls,1),1e3);let us=[...os];if(us.length_s.toLowerCase()),cs=[...new Set(cs)];for(let _s of cs)if(!us.includes(_s))throw Error(`Cannot include variant ${_s} as ${_s} is a not variant name`)}let ds=(ws=ss==null?void 0:ss.attributes.variantsToExclude)==null?void 0:ws.component.children;if(ds){ds=ds.map(_s=>_s.toLowerCase());for(let _s of ds)if(!us.includes(_s))throw Error(`Cannot exclude variant ${_s} as ${_s} is not a variant name`)}else ds=[];cs?cs=cs.filter(_s=>!ds.includes(_s)):cs=[...us].filter(_s=>!ds.includes(_s));let ps=cs.map(_s=>us.indexOf(_s)+1),fs=[];ss!=null&&ss.attributes.seeds&&(fs=ss.attributes.seeds.component.children);let hs=[...fs];if(hs.lengthhs[_s-1]),ys=(ss==null?void 0:ss.attributes.uniqueVariants)!==void 0,bs=(Es=ss==null?void 0:ss.attributes.uniqueVariants)==null?void 0:Es.primitive,vs;(bs||!ys)&&(vs=rs.allComponentClasses._base.determineNumberOfUniqueVariants({serializedComponent:as,componentInfoObjects:rs}),vs.success?bs=bs||vs.numberOfVariants<=ls:bs=!1);let xs=[],Cs=[],Ts=[];if(bs)for(let[_s,$s]of ps.entries())$s<=vs.numberOfVariants&&(Cs.push($s),xs.push(cs[_s]),Ts.push(gs[_s]));else xs=cs,Cs=ps,Ts=gs;let Ss=xs.length;if(Ss===0)throw Error("No variants selected based on variantsToInclude, variantsToExclude, and the number of variants available");return as.variants.uniqueVariants=bs,as.variants.numberOfVariants=Ss,as.variants.allPossibleVariants=xs,as.variants.allVariantNames=us,as.variants.allPossibleVariantUniqueIndices=Cs,as.variants.allPossibleVariantSeeds=Ts,{success:!0,numberOfVariants:Ss}}function indexToLowercaseLetters(as){return numberToLetters(as,!0)}function renameStateVariable({stateVariableDefinitions:as,oldName:rs,newName:ns}){let ss=as[ns]=as[rs];if(delete as[rs],ss.additionalStateVariablesDefined){let ds=ss.additionalStateVariablesDefined.indexOf(rs);ds!==-1&&(ss.additionalStateVariablesDefined[ds]=ns)}let os=ss.definition,ls=["setValue","useEssentialOrDefaultValue","setEssentialValue"],us=["noChanges"];ss.definition=function(ds){let ps=os(ds);for(let fs of ls)ps[fs]&&rs in ps[fs]&&(ps[fs][ns]=ps[fs][rs],delete ps[fs][rs]);for(let fs of us)if(ps[fs]){let hs=ps[fs].indexOf(rs);hs!==-1&&(ps[fs][hs]=ns)}return ps};let cs=ss.inverseDefinition;cs&&(ss.inverseDefinition=async function(ds){let ps=ds.desiredStateVariableValues;ps[rs]=ps[ns],delete ps[ns];let fs=await cs(ds);if(fs.success)for(let hs of fs.instructions)hs.setEssentialValue===rs&&(hs.setEssentialValue=ns);return fs})}function returnDefaultGetArrayKeysFromVarName(as){return as>1?function({arrayEntryPrefix:rs,varEnding:ns,arraySize:ss,nDimensions:os}){let ls=ns.split("_").map(us=>Number(us)-1);return ls.length===os&&ls.every((us,cs)=>Number.isInteger(us)&&us>=0)?ss?ls.every((us,cs)=>us=0?ss?ostypeof ls=="object"?ls.componentType:ls));for(let ls of os){let us=this.componentInfoObjects.allComponentClasses[ls];if(us){let cs=us.rendererType;cs&&!rs.includes(cs)&&rs.push(cs)}}}}if(this.constructor.adapters)for(let ns of this.constructor.adapters){let ss;typeof ns=="string"?ss=ns:ss=ns.componentType;let os=this.componentInfoObjects.allComponentClasses[ss];if(os){let ls=os.rendererType;ls&&!rs.includes(ls)&&rs.push(ls)}}if(!this.rendererType)return rs;for(let ns in this.allChildren){let ss=this.allChildren[ns].component;if(typeof ss=="object")for(let os of ss.allPotentialRendererTypes)rs.includes(os)||rs.push(os)}return rs}potentialRendererTypesFromSerializedComponents(rs){var ss;let ns=[];for(let os of rs){let ls=this.componentInfoObjects.allComponentClasses[os.componentType];if(ls){let us=ls.rendererType;us&&!ns.includes(us)&&ns.push(us);let cs=ls.returnStateVariableInfo({onlyPublic:!0}).stateVariableDescriptions;for(let ds in cs){let ps=cs[ds],fs=(ss=ps.shadowingInstructions)==null?void 0:ss.createComponentOfType;Array.isArray(fs)||(fs=[fs]),ps.wrappingComponents&&fs.push(...flattenDeep(ps.wrappingComponents).map(hs=>typeof hs=="object"?hs.componentType:hs));for(let hs of fs){let gs=this.componentInfoObjects.allComponentClasses[hs];if(gs){let ys=gs.rendererType;ys&&!ns.includes(ys)&&ns.push(ys)}}}if(ls.adapters)for(let ds of ls.adapters){let ps;typeof ds=="string"?ps=ds:ps=ds.componentType;let fs=this.componentInfoObjects.allComponentClasses[ps];if(fs){let hs=fs.rendererType;hs&&!ns.includes(hs)&&ns.push(hs)}}}if(os.children){let us=this.potentialRendererTypesFromSerializedComponents(os.children);for(let cs of us)ns.includes(cs)||ns.push(cs)}}return ns}get childrenMatched(){return this.childrenMatchedWithPlaceholders&&!this.placeholderActiveChildrenIndices}static createAttributesObject(){return{hide:{createComponentOfType:"boolean",createStateVariable:"hide",defaultValue:!1,public:!0},disabled:{createComponentOfType:"boolean"},fixed:{createComponentOfType:"boolean",ignoreFixed:!0},modifyIndirectly:{createComponentOfType:"boolean",createStateVariable:"modifyIndirectly",defaultValue:!0,public:!0,propagateToProps:!0},styleNumber:{createComponentOfType:"number",createStateVariable:"styleNumber",defaultValue:1,public:!0,fallBackToParentStateVariable:"styleNumber"},isResponse:{createPrimitiveOfType:"boolean",createStateVariable:"isResponse",defaultValue:!1,public:!0},newNamespace:{createPrimitiveOfType:"boolean",createStateVariable:"newNamespace",defaultValue:!1,public:!0}}}static returnSugarInstructions(){return[]}static returnChildGroups(){return[]}static get childGroups(){return this.hasOwnProperty("childGroupsData")?this.childGroupsData:(this.childGroupsData=this.returnChildGroups(),this.childGroupsData)}static get childGroupOfComponentType(){return this.hasOwnProperty("childGroupOfComponentTypeData")?this.childGroupOfComponentTypeData:(this.childGroupOfComponentTypeData={},this.childGroupOfComponentTypeData)}static get childGroupIndsByName(){if(this.hasOwnProperty("childGroupIndsByNameData"))return Object.assign({},this.childGroupIndsByNameData);this.childGroupIndsByNameData={};for(let[rs,ns]of this.childGroups.entries()){if(ns.group in this.childGroupIndsByNameData)throw Error(`Invalid childGroups for componentClass ${this.componentType}: ${ns} is repeated`);this.childGroupIndsByNameData[ns.group]=rs}return Object.assign({},this.childGroupIndsByNameData)}returnMatchedChildIndices(rs){let ns=[];for(let ss of rs){let os=this.childMatchesByGroup[ss];if(!os)return;ns.push(...os)}return ns.sort((ss,os)=>ss-os)}static returnStateVariableDefinitions(){let rs={};return rs.hidden={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},forRenderer:!0,returnDependencies:()=>({hide:{dependencyType:"stateVariable",variableName:"hide",variablesOptional:!0},parentHidden:{dependencyType:"parentStateVariable",variableName:"hidden"},sourceCompositeHidden:{dependencyType:"sourceCompositeStateVariable",variableName:"hidden"},adapterSourceHidden:{dependencyType:"adapterSourceStateVariable",variableName:"hidden"}}),definition:({dependencyValues:ns})=>({setValue:{hidden:!!(ns.parentHidden||ns.sourceCompositeHidden||ns.adapterSourceHidden||ns.hide)}}),markStale:()=>({updateParentRenderedChildren:!0}),inverseDefinition({desiredStateVariableValues:ns}){return{success:!0,instructions:[{setDependency:"hide",desiredValue:ns.hidden}]}}},rs.disabled={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},forRenderer:!0,hasEssential:!0,doNotShadowEssential:!0,defaultValue:!1,provideEssentialValuesInDefinition:!0,returnDependencies:()=>({disabledAttr:{dependencyType:"attributeComponent",attributeName:"disabled",variableNames:["value"]},readOnly:{dependencyType:"flag",flagName:"readOnly"},parentDisabled:{dependencyType:"parentStateVariable",variableName:"disabled"},sourceCompositeDisabled:{dependencyType:"sourceCompositeStateVariable",variableName:"disabled"},adapterSourceDisabled:{dependencyType:"adapterSourceStateVariable",variableName:"disabled"}}),definition({dependencyValues:ns,usedDefault:ss,essentialValues:os}){if(ns.readOnly)return{setValue:{disabled:!0}};if(ns.disabledAttr!==null)return{setValue:{disabled:ns.disabledAttr.stateValues.value}};if(os.disabled!==void 0)return{useEssentialOrDefaultValue:{disabled:!0}};let ls=!1,us=!0;return ns.parentDisabled!==null&&!ss.parentDisabled&&(ls=ls||ns.parentDisabled,us=!1),ns.sourceCompositeDisabled!==null&&!ss.sourceCompositeDisabled&&(ls=ls||ns.sourceCompositeDisabled,us=!1),ns.adapterSourceDisabled!==null&&!ss.adapterSourceDisabled&&(ls=ls||ns.adapterSourceDisabled,us=!1),us?{useEssentialOrDefaultValue:{disabled:!0}}:{setValue:{disabled:ls}}},inverseDefinition({dependencyValues:ns,desiredStateVariableValues:ss}){return ns.disabledAttr!==null?{success:!0,instructions:[{setDependency:"disabledAttr",desiredValue:ss.disabled,variableIndex:0}]}:{success:!0,instructions:[{setEssentialValue:"disabled",value:ss.disabled}]}}},rs.fixed={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},forRenderer:!0,defaultValue:!1,hasEssential:!0,doNotShadowEssential:!0,ignoreFixed:!0,provideEssentialValuesInDefinition:!0,returnDependencies:()=>({fixedAttr:{dependencyType:"attributeComponent",attributeName:"fixed",variableNames:["value"]},parentFixed:{dependencyType:"parentStateVariable",variableName:"fixed"},sourceCompositeFixed:{dependencyType:"sourceCompositeStateVariable",variableName:"fixed"},adapterSourceFixed:{dependencyType:"adapterSourceStateVariable",variableName:"fixed"},ignoreParentFixed:{dependencyType:"doenetAttribute",attributeName:"ignoreParentFixed"}}),definition({dependencyValues:ns,usedDefault:ss,essentialValues:os}){if(ns.fixedAttr!==null)return{setValue:{fixed:ns.fixedAttr.stateValues.value}};if(os.fixed!==void 0)return{useEssentialOrDefaultValue:{fixed:!0}};let ls=!1,us=!0;return ns.parentFixed!==null&&!ss.parentFixed&&!ns.ignoreParentFixed&&(ls=ls||ns.parentFixed,us=!1),ns.sourceCompositeFixed!==null&&!ss.sourceCompositeFixed&&(ls=ls||ns.sourceCompositeFixed,us=!1),ns.adapterSourceFixed!==null&&!ss.adapterSourceFixed&&(ls=ls||ns.adapterSourceFixed,us=!1),us?{useEssentialOrDefaultValue:{fixed:!0}}:{setValue:{fixed:ls}}},inverseDefinition({dependencyValues:ns,desiredStateVariableValues:ss}){return ns.fixedAttr!==null?{success:!0,instructions:[{setDependency:"fixedAttr",desiredValue:ss.fixed,variableIndex:0}]}:{success:!0,instructions:[{setEssentialValue:"fixed",value:ss.fixed}]}}},rs.isInactiveCompositeReplacement={defaultValue:!1,hasEssential:!0,returnDependencies:()=>({}),definition:()=>({useEssentialOrDefaultValue:{isInactiveCompositeReplacement:!0}}),inverseDefinition({desiredStateVariableValues:ns}){return{success:!0,instructions:[{setEssentialValue:{variableName:"isInactiveCompositeReplacement",value:ns.isInactiveCompositeReplacement}}]}}},rs.doenetML={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({doenetML:{dependencyType:"doenetML"}}),definition({dependencyValues:ns}){let ss=ns.doenetML;return ss||(ss=""),{setValue:{doenetML:ss}}}},rs}static returnNormalizedStateVariableDefinitions({attributeNames:rs,numerics:ns}){let ss=this.returnStateVariableDefinitions({attributeNames:rs,numerics:ns});if(!ss)throw Error(`Error in state variable definitions of ${this.componentType}: returnStateVariableDefinitions did not return anything`);let os=function(cs){for(let[ds,ps]of cs.entries())typeof ps=="object"&&(cs[ds]=ps.variableName)},ls=["returnDependencies","definition","inverseDefinition","stateVariablesDeterminingDependencies","stateVariablesDeterminingArraySizeDependencies","isArray","nDimensions","returnArraySizeDependencies","returnArraySize","returnArrayDependenciesByKey","arrayDefinitionByKey","inverseArrayDefinitionByKey","basedOnArrayKeyStateVariables","markStale","getPreviousDependencyValuesForMarkStale","determineDependenciesImmediately","createWorkspace","workspace","provideEssentialValuesInDefinition","providePreviousValuesInDefinition"],us={};for(let cs in ss){let ds=ss[cs];if(us[cs]=ds,ds.createWorkspace&&(ds.workspace={}),ds.additionalStateVariablesDefined){for(let[ps,fs]of ds.additionalStateVariablesDefined.entries()){let hs={};for(let ys of ls)ys in ds&&(hs[ys]=ds[ys]);hs.additionalStateVariablesDefined=[...ds.additionalStateVariablesDefined],hs.additionalStateVariablesDefined[ps]=cs,os(hs.additionalStateVariablesDefined);let gs=fs;typeof fs=="object"&&(gs=fs.variableName,fs=Object.assign({},fs),delete fs.variableName,Object.assign(hs,fs)),us[gs]=hs}os(ds.additionalStateVariablesDefined)}}return us}static returnStateVariableInfo({onlyPublic:rs=!1,onlyForRenderer:ns=!1}={}){var ds,ps;let ss=this.createAttributesObject(),os={},ls={},us={};for(let fs in ss){let hs=ss[fs],gs=hs.createStateVariable;if(gs&&(!rs||hs.public)&&(!ns||hs.forRenderer))if(hs.public){let ys=!hs.createComponentOfType,bs;ys?(bs=hs.createPrimitiveOfType,bs==="string"&&(bs="text")):bs=hs.createComponentOfType,os[gs]={createComponentOfType:bs,public:!0}}else os[gs]={}}let cs=this.returnNormalizedStateVariableDefinitions({attributeNames:Object.keys(os)});for(let fs in cs){let hs=cs[fs];if(hs.isAlias){us[fs]=hs.targetVariableName;continue}if((!rs||hs.public)&&(!ns||hs.forRenderer)&&(hs.public?os[fs]={createComponentOfType:hs.shadowingInstructions.createComponentOfType,public:!0}:os[fs]={},hs.isArray)){os[fs].isArray=!0,os[fs].nDimensions=hs.nDimensions===void 0?1:hs.nDimensions,os[fs].wrappingComponents=(ds=hs.shadowingInstructions)!=null&&ds.returnWrappingComponents?hs.shadowingInstructions.returnWrappingComponents():[];let gs;hs.entryPrefixes?gs=hs.entryPrefixes:gs=[fs];for(let ys of gs)ls[ys]={arrayVariableName:fs,nDimensions:hs.returnEntryDimensions?hs.returnEntryDimensions(ys):1,wrappingComponents:(ps=hs.shadowingInstructions)!=null&&ps.returnWrappingComponents?hs.shadowingInstructions.returnWrappingComponents(ys):[]};hs.getArrayKeysFromVarName?os[fs].getArrayKeysFromVarName=hs.getArrayKeysFromVarName:os[fs].getArrayKeysFromVarName=returnDefaultGetArrayKeysFromVarName(os[fs].nDimensions)}}return{stateVariableDescriptions:os,arrayEntryPrefixes:ls,aliases:us}}get parentName(){if(!(this.ancestors===void 0||this.ancestors.length===0))return this.ancestors[0].componentName}getAllChildrenDownstreamComponentNames(rs=!1){const ns=Object.keys(this.allChildren);let ss=Object.keys(this.downstreamDependencies);return rs!==!0&&(ss=ss.filter(os=>this.downstreamDependencies[os].inactive!==!0)),[...ns,...ss]}get allDescendants(){let rs=[];for(let ns in this.allChildren){let ss=this.allChildren[ns].component;rs=[...rs,ns,...ss.allDescendants]}return rs}async serialize(rs={}){let ns={componentType:this.componentType},ss=[],os={...rs},ls;rs.sourceAttributesToIgnoreRecursively?ls=[...rs.sourceAttributesToIgnoreRecursively]:ls=[],rs.sourceAttributesToIgnore&&(ls.push(...rs.sourceAttributesToIgnore),delete os.sourceAttributesToIgnore);{for(let us of this.definingChildren)typeof us!="object"?ss.push(us):ss.push(await us.serialize(os));if(this.serializedChildren!==void 0)for(let us of this.serializedChildren)ss.push(this.copySerializedComponent(us));ss.length>0&&(ns.children=ss)}ns.attributes={};for(let us in this.attributes){let cs=this.attributes[us];cs.component?rs.copyAll&&(ns.attributes[us]={component:await cs.component.serialize(os)}):(!ls.includes(us)||rs.copyAll)&&(ns.attributes[us]=JSON.parse(JSON.stringify(cs)))}return this.essentialState&&Object.keys(this.essentialState).length>0&&(ns.state=deepClone(this.essentialState)),rs.copyVariants&&this.state.generatedVariantInfo&&(ns.variants={desiredVariant:await this.stateValues.generatedVariantInfo}),ns.originalName=this.componentName,ns.originalDoenetAttributes=deepClone(this.doenetAttributes),ns.doenetAttributes=deepClone(this.doenetAttributes),ns.originalAttributes=deepClone(ns.attributes),delete ns.doenetAttributes.prescribedName,delete ns.doenetAttributes.assignNames,ns}copySerializedComponent(rs){if(typeof rs!="object")return rs;let ns=[];if(rs.children!==void 0)for(let os of rs.children)ns.push(this.copySerializedComponent(os));let ss={componentType:rs.componentType,originalName:rs.componentName,originalNameFromSerializedComponent:!0,children:ns,state:{},doenetAttributes:{}};return rs.doenetAttributes!==void 0&&(ss.originalDoenetAttributes=deepClone(rs.doenetAttributes),ss.doenetAttributes=deepClone(rs.doenetAttributes),ss.originalAttributes=deepClone(rs.attributes),ss.attributes=deepClone(rs.attributes),delete ss.doenetAttributes.prescribedName,delete ss.doenetAttributes.assignNames),rs.state!==void 0&&Object.assign(ss.state,rs.state),ss}static get nAdapters(){return this.adapters.length}getAdapter(rs){if(rs>=this.constructor.adapters.length)return;let ns=this.constructor.adapters[rs],ss,os,ls,us;typeof ns=="string"?ss=ns:(ss=ns.stateVariable,os=ns.componentType,ls=ns.substituteForPrimaryStateVariable,us=ns.stateVariablesToShadow);let cs=this.state[ss];if(cs===void 0||!cs.public&&!os)throw Error("Invalid adapter "+ss+" in "+this.componentType);return os===void 0&&(os=cs.shadowingInstructions.createComponentOfType),{componentType:os,downstreamDependencies:{[this.componentName]:[{dependencyType:"adapter",adapterVariable:ss,adapterTargetIdentity:{componentName:this.componentName,componentType:this.componentType},substituteForPrimaryStateVariable:ls,stateVariablesToShadow:us}]}}}static getAdapterComponentType(rs,ns){if(rs>=this.adapters.length)return;let ss=this.adapters[rs],os,ls;if(typeof ss=="string"?os=ss:(os=ss.stateVariable,ls=ss.componentType),ls===void 0){let cs=ns[this.componentType].stateVariableDescriptions[os];if(!cs)throw Error("Invalid adapter "+os+" in "+this.componentType);if(ls=cs.createComponentOfType,!ls)throw Error(`Couldn't get adapter component type for ${os} of componentType ${this.componentType}`)}return ls}static determineNumberOfUniqueVariants({serializedComponent:rs,componentInfoObjects:ns}){var us;let ss=(us=rs.variants)==null?void 0:us.numberOfVariants;if(ss!==void 0)return{success:!0,numberOfVariants:ss};let os=[];rs.children&&(os=gatherVariantComponents({serializedComponents:rs.children,componentInfoObjects:ns})),rs.variants===void 0&&(rs.variants={}),rs.variants.descendantVariantComponents=os,ss=1;let ls=[];for(let cs of os){let ps=ns.allComponentClasses[cs.componentType].determineNumberOfUniqueVariants({serializedComponent:cs,componentInfoObjects:ns});if(!ps.success)return{success:!1};ls.push(ps.numberOfVariants),ss*=ps.numberOfVariants}return rs.variants.numberOfVariants=ss,rs.variants.uniqueVariantData={numberOfVariantsByDescendant:ls},{success:!0,numberOfVariants:ss}}static getUniqueVariant({serializedComponent:rs,variantIndex:ns,componentInfoObjects:ss}){var fs;let os=(fs=rs.variants)==null?void 0:fs.numberOfVariants;if(os===void 0)return{success:!1};if(!Number.isInteger(ns)||ns<1||ns>os)return{success:!1};let ls=!1,us=rs.variants.uniqueVariantData.numberOfVariantsByDescendant,cs=rs.variants.descendantVariantComponents,ds=[];if(cs.length>0){let hs=enumerateCombinations({numberOfOptionsByIndex:us,maxNumber:ns})[ns-1].map(gs=>gs+1);for(let gs=0;gs1){let ys=cs[gs],vs=ss.allComponentClasses[ys.componentType].getUniqueVariant({serializedComponent:ys,variantIndex:hs[gs],componentInfoObjects:ss});if(!vs.success)return{success:!1};ds.push(vs.desiredVariant),ls=!0}else ds.push({})}let ps={index:ns};return ls&&(ps.subvariants=ds),{success:!0,desiredVariant:ps}}async copyDoenetMLToClipboard({actionId:rs}){let ns=await this.stateValues.doenetML;ns?this.coreFunctions.copyToClipboard(ns,rs):this.coreFunctions.resolveAction({actionId:rs})}}zs(BaseComponent,"componentType","_base"),zs(BaseComponent,"childGroupOfComponentTypeData"),zs(BaseComponent,"childGroupIndsByNameData"),zs(BaseComponent,"adapters",[]);class InlineComponent extends BaseComponent{}zs(InlineComponent,"componentType","_inline");class Text extends InlineComponent{constructor(rs){super(rs),Object.assign(this.actions,{moveText:this.moveText.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.draggable={createComponentOfType:"boolean",createStateVariable:"draggable",defaultValue:!0,public:!0,forRenderer:!0},rs.layer={createComponentOfType:"number",createStateVariable:"layer",defaultValue:0,public:!0,forRenderer:!0},rs.anchor={createComponentOfType:"point"},rs.positionFromAnchor={createComponentOfType:"text",createStateVariable:"positionFromAnchor",defaultValue:"center",public:!0,forRenderer:!0,toLowerCase:!0,validValues:["upperright","upperleft","lowerright","lowerleft","top","bottom","left","right","center"]},rs.styleNumber.defaultValue=0,rs}static returnChildGroups(){return[{group:"textLike",componentTypes:["string","text","_singleCharacterInline","_inlineRenderInlineChildren"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions(),ns=returnSelectedStyleStateVariableDefinition();return Object.assign(rs,ns),rs.value={public:!0,shadowingInstructions:{createComponentOfType:this.componentType,addAttributeComponentsShadowingStateVariables:{fixed:{stateVariableToShadow:"fixed"}}},hasEssential:!0,returnDependencies:()=>({textLikeChildren:{dependencyType:"child",childGroups:["textLike"],variableNames:["text"]}}),defaultValue:"",set:ss=>ss===null?"":String(ss),definition:function({dependencyValues:ss}){if(ss.textLikeChildren.length===0)return{useEssentialOrDefaultValue:{value:!0}};let os="";for(let ls of ss.textLikeChildren)typeof ls=="string"?os+=ls:os+=ls.stateValues.text;return{setValue:{value:os}}},inverseDefinition:function({desiredStateVariableValues:ss,dependencyValues:os}){let ls=os.textLikeChildren.length;return ls>1?{success:!1}:ls===1?{success:!0,instructions:[{setDependency:"textLikeChildren",desiredValue:ss.value,childIndex:0,variableIndex:0}]}:{success:!0,instructions:[{setEssentialValue:"value",value:ss.value===null?"":String(ss.value)}]}}},rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},forRenderer:!0,returnDependencies:()=>({value:{dependencyType:"stateVariable",variableName:"value"}}),definition:({dependencyValues:ss})=>({setValue:{text:ss.value}}),inverseDefinition:({desiredStateVariableValues:ss})=>({success:!0,instructions:[{setDependency:"value",desiredValue:ss.text}]})},rs.anchor={defaultValue:Context.fromText("(0,0)"),public:!0,forRenderer:!0,hasEssential:!0,shadowingInstructions:{createComponentOfType:"point"},returnDependencies:()=>({anchorAttr:{dependencyType:"attributeComponent",attributeName:"anchor",variableNames:["coords"]}}),definition({dependencyValues:ss}){return ss.anchorAttr?{setValue:{anchor:ss.anchorAttr.stateValues.coords}}:{useEssentialOrDefaultValue:{anchor:!0}}},async inverseDefinition({desiredStateVariableValues:ss,dependencyValues:os,stateValues:ls,initialChange:us}){return us&&!await ls.draggable?{success:!1}:os.anchorAttr?{success:!0,instructions:[{setDependency:"anchorAttr",desiredValue:ss.anchor,variableIndex:0}]}:{success:!0,instructions:[{setEssentialValue:"anchor",value:ss.anchor}]}}},rs}async moveText({x:rs,y:ns,z:ss,transient:os,actionId:ls,sourceInformation:us={},skipRendererUpdate:cs=!1}){let ds=["vector"];return rs!==void 0&&(ds[1]=rs),ns!==void 0&&(ds[2]=ns),ss!==void 0&&(ds[3]=ss),os?await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"anchor",value:Context.fromAst(ds)}],transient:os,actionId:ls,sourceInformation:us,skipRendererUpdate:cs}):await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"anchor",value:Context.fromAst(ds)}],actionId:ls,sourceInformation:us,skipRendererUpdate:cs,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{x:rs,y:ns,z:ss}}})}}zs(Text,"componentType","text"),zs(Text,"includeBlankStringChildren",!0),zs(Text,"variableForPlainMacro","value"),zs(Text,"descendantCompositesMustHaveAReplacement",!1);class TextOrInline extends InlineComponent{static returnChildGroups(){return[{group:"inlines",componentTypes:["_inline"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.value={public:!0,shadowingInstructions:{createComponentOfType:this.componentType},returnDependencies:()=>({inlineChildren:{dependencyType:"child",childGroups:["inlines"],variableNames:["text"],variablesOptional:!0}}),definition:function({dependencyValues:ns}){let ss="";for(let os of ns.inlineChildren)typeof os!="object"?ss+=os.toString():typeof os.stateValues.text=="string"&&(ss+=os.stateValues.text);return{setValue:{value:ss}}}},rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({value:{dependencyType:"stateVariable",variableName:"value"}}),definition:({dependencyValues:ns})=>({setValue:{text:ns.value}})},rs}}zs(TextOrInline,"componentType","_textOrInline"),zs(TextOrInline,"renderChildren",!0),zs(TextOrInline,"rendererType","containerInline"),zs(TextOrInline,"includeBlankStringChildren",!0);class CompositeComponent extends BaseComponent{constructor(ns){super(ns);zs(this,"replacements",[]);zs(this,"replacementsToWithhold",0);this.replacementsWorkspace={}}static returnStateVariableDefinitions(){let ns=super.returnStateVariableDefinitions();return ns.replacements={returnDependencies:()=>({replacements:{dependencyType:"replacement"}}),definition:({dependencyValues:ss})=>({setValue:{replacements:ss.replacements}})},ns.recursiveReplacements={returnDependencies:()=>({recursiveReplacements:{dependencyType:"replacement",recursive:!0}}),definition:({dependencyValues:ss})=>({setValue:{recursiveReplacements:ss.recursiveReplacements}})},ns.fullRecursiveReplacements={returnDependencies:()=>({recursiveReplacements:{dependencyType:"replacement",recursive:!0,recurseNonStandardComposites:!0}}),definition:({dependencyValues:ss})=>({setValue:{fullRecursiveReplacements:ss.recursiveReplacements}})},ns}static createSerializedReplacements(){return{replacements:[]}}static calculateReplacementChanges(){return[]}get allPotentialRendererTypes(){let ns=super.allPotentialRendererTypes;for(let ss in this.allChildren){let os=this.allChildren[ss].component;for(let ls of os.allPotentialRendererTypes)ns.includes(ls)||ns.push(ls)}if(this.replacements){for(let ss of this.replacements)if(typeof ss=="object")for(let os of ss.allPotentialRendererTypes)ns.includes(os)||ns.push(os)}return ns}}zs(CompositeComponent,"componentType","_composite"),zs(CompositeComponent,"rendererType");function postProcessCopy({serializedComponents:as,componentName:rs,addShadowDependencies:ns=!0,markAsPrimaryShadow:ss=!1,uniqueIdentifiersUsed:os=[],identifierPrefix:ls="",unlinkExternalCopies:us=!1,copiesByTargetComponentName:cs={},componentNamesFound:ds=[],assignNamesFound:ps=[],activeAliases:fs=[],init:hs=!0}){var gs;for(let ys in as){let bs=as[ys];if(typeof bs!="object")continue;let vs;if(bs.originalName){if(us){if(ds.push(bs.originalName),bs.originalDoenetAttributes&&bs.originalDoenetAttributes.assignNames){let xs;if((gs=bs.attributes.newNamespace)!=null&&gs.primitive)xs=bs.originalName;else{let Cs=bs.originalName.lastIndexOf("/");xs=bs.originalName.substring(0,Cs)}for(let Cs of bs.originalDoenetAttributes.assignNames)ds.push(xs+"/"+Cs),ps.push(xs+"/"+Cs)}bs.attributes&&(bs.attributes.alias&&fs.push(bs.attributes.alias.primitive),bs.attributes.indexAlias&&fs.push(bs.attributes.indexAlias.primitive))}if(vs=ls+bs.originalName+"|shadow",!bs.originalNameFromSerializedComponent)if(ns){let xs={[bs.originalName]:[{dependencyType:"referenceShadow",compositeName:rs}]};if(hs&&(xs[bs.originalName][0].firstLevelReplacement=!0),ss&&(xs[bs.originalName][0].isPrimaryShadow=!0),bs.state){let Cs=Object.keys(bs.state);xs[bs.originalName].downstreamStateVariables=Cs,xs[bs.originalName].upstreamStateVariables=Cs}bs.downstreamDependencies=xs}else bs.unlinkedCopySource=bs.originalName}else vs=ls+bs.componentType+"|shadowUnnamed";if(bs.componentType==="copy"&&us){let xs=bs.doenetAttributes.targetComponentName;if(xs)fs.includes(bs.doenetAttributes.target)?bs.doenetAttributes.targetComponentName=bs.doenetAttributes.target:(cs[xs]===void 0&&(cs[xs]=[]),cs[xs].push(bs));else if(!bs.attributes.uri)throw Error("we need to create a targetComponentName here, then.")}bs.uniqueIdentifier=getUniqueIdentifierFromBase(vs,os)}for(let ys in as){let bs=as[ys];if(typeof bs=="object"){postProcessCopy({serializedComponents:bs.children,componentName:rs,addShadowDependencies:ns,markAsPrimaryShadow:ss,uniqueIdentifiersUsed:os,identifierPrefix:ls,unlinkExternalCopies:us,copiesByTargetComponentName:cs,componentNamesFound:ds,assignNamesFound:ps,activeAliases:[...fs],init:!1});for(let vs in bs.attributes){let xs=bs.attributes[vs];xs.component&&(xs.component=postProcessCopy({serializedComponents:[xs.component],componentName:rs,addShadowDependencies:ns,markAsPrimaryShadow:ss,uniqueIdentifiersUsed:os,identifierPrefix:ls,unlinkExternalCopies:us,copiesByTargetComponentName:cs,componentNamesFound:ds,assignNamesFound:ps,activeAliases:[...fs],init:!1})[0])}bs.replacements&&postProcessCopy({serializedComponents:bs.replacements,componentName:rs,addShadowDependencies:ns,markAsPrimaryShadow:ss,uniqueIdentifiersUsed:os,identifierPrefix:ls,unlinkExternalCopies:us,copiesByTargetComponentName:cs,componentNamesFound:ds,assignNamesFound:ps,activeAliases:[...fs],init:!1})}}if(hs&&us){for(let ys in cs)if(!ds.includes(ys)){let bs=!1;for(let vs of ps){let xs=vs+"/",Cs=xs.length;if(ys.substring(0,Cs)===xs){bs=!0;break}}if(!bs)for(let vs of cs[ys])vs.attributes||(vs.attributes={}),vs.attributes.link={primitive:!1},vs.doenetAttributes.target=vs.doenetAttributes.targetComponentName}}return as}function convertAttributesForComponentType({attributes:as,componentType:rs,componentInfoObjects:ns,compositeAttributesObj:ss={},compositeCreatesNewNamespace:os,flags:ls}){var fs;let us=ns.allComponentClasses[rs],cs=us.createAttributesObject(),ds={};for(let hs in cs)ds[hs.toLowerCase()]=hs;let ps={};for(let hs in as){if(hs in ss&&!ss[hs].leaveRaw)continue;let gs=ds[hs.toLowerCase()],ys=cs[gs];if(ys){if(gs in ps)throw Error(`Cannot repeat prop ${gs}`);if(ps[gs]=componentFromAttribute({attrObj:ys,value:JSON.parse(JSON.stringify(as[hs])),componentInfoObjects:ns}),(fs=ps[gs].component)!=null&&fs.children){let bs=[ps[gs].component];if(applyMacros(bs,ns),removeBlankStringChildren(bs,ns),applySugar({serializedComponents:bs,componentInfoObjects:ns,isAttributeComponent:!0}),os){for(let vs of ps[gs].component.children)if(vs.componentType==="copy"){let xs=vs.doenetAttributes.target;/[a-zA-Z_]/.test(xs[0])&&(vs.doenetAttributes.target="../"+xs)}}}}else us.acceptAnyAttribute&&(ps[hs]=JSON.parse(JSON.stringify(as[hs])))}return ps}async function verifyReplacementsMatchSpecifiedType({component:as,replacements:rs,replacementChanges:ns,assignNames:ss,workspace:os={},componentInfoObjects:ls,compositeAttributesObj:us,flags:cs}){var gs,ys,bs,vs,xs;if(!((gs=as.attributes.createComponentOfType)!=null&&gs.primitive)&&!as.sharedParameters.compositesMustHaveAReplacement)return{replacements:rs,replacementChanges:ns};let ds=as.replacementsToWithhold,ps;if(!ns)ls.isInheritedComponentType({inheritedComponentType:as.componentType,baseComponentType:"template"})&&(rs=rs.filter(Cs=>Cs.componentType||Cs.trim().length>0)),ps=rs.map(Cs=>Cs.componentType),ps.length===1&&ps[0]==="externalContent"&&(ps=rs[0].children.filter(Cs=>Cs.componentType||Cs.trim().length>0).map(Cs=>Cs.componentType));else{ps=as.replacements.map(Cs=>Cs.componentType);for(let Cs of ns)if(Cs.changeType==="add"){if(Cs.replacementsToWithhold!==void 0&&(ds=Cs.replacementsToWithhold),!Cs.changeTopLevelReplacements)continue;if(Cs.serializedReplacements){let Ts=Cs.numberReplacementsToReplace;Ts>0||(Ts=0);let Ss=Cs.firstReplacementInd,Ns=Cs.serializedReplacements.map(As=>As.componentType);ps.splice(Ss,Ts,...Ns)}}else if(Cs.changeType==="delete"){if(Cs.replacementsToWithhold!==void 0&&(ds=Cs.replacementsToWithhold),Cs.changeTopLevelReplacements){let Ts=Cs.firstReplacementInd,Ss=Cs.numberReplacementsToDelete;ps.splice(Ts,Ss)}}else Cs.changeType==="changeReplacementsToWithhold"&&Cs.replacementsToWithhold!==void 0&&(ds=Cs.replacementsToWithhold)}if(ds>0&&(ps=ps.slice(0,ps.length-ds)),!((ys=as.attributes.createComponentOfType)!=null&&ys.primitive)&&as.sharedParameters.compositesMustHaveAReplacement&&ps.length>0)return{replacements:rs,replacementChanges:ns};let fs=(bs=as.attributes.createComponentOfType)==null?void 0:bs.primitive,hs=await as.stateValues.nComponentsSpecified;if(!fs){if(fs=as.sharedParameters.compositesDefaultReplacementType,!fs)throw Error("A component class specified descendantCompositesMustHaveAReplacement but didn't specify descendantCompositesDefaultReplacementType");hs=1}if(fs=ls.componentTypeLowerCaseMapping[fs.toLowerCase()],ps.length!==hs||!ps.every(Cs=>Cs===fs)){if((rs==null?void 0:rs.length)===1&&ls.isInheritedComponentType({inheritedComponentType:rs[0].componentType,baseComponentType:"template"}))return rs[0].attributes||(rs[0].attributes={}),rs[0].attributes.createComponentOfType={primitive:fs},rs[0].attributes.nComponents={primitive:hs},{replacements:rs,replacementChanges:ns};let Cs=ps.length===hs&&!(ds>0)&&((vs=os.sourceNames)==null?void 0:vs.length)===hs,Ts;Cs&&ns&&(ns.length===1&&ns[0].numberReplacementsToReplace===hs?Ts=ns[0].serializedReplacements:Cs=!1),Cs?Ts||(Ts=rs):(os.numReplacementsBySource=[],os.numNonStringReplacementsBySource=[],os.propVariablesCopiedBySource=[],os.sourceNames=[],os.uniqueIdentifiersUsedBySource={},os.uniqueIdentifiersUsedBySource[0]=[]);let Ss=(xs=as.attributes.newNamespace)==null?void 0:xs.primitive;rs=[];for(let As=0;Astypeof As!="string").length),ns){ns=[],as.replacementsToWithhold>0&&ns.push({changeType:"changeReplacementsToWithhold",replacementsToWithhold:0});let As=0;as.replacements&&(As=as.replacements.length),ns.push({changeType:"add",changeTopLevelReplacements:!0,firstReplacementInd:0,numberReplacementsToReplace:As,serializedReplacements:rs})}}return{replacements:rs,replacementChanges:ns}}class Template extends CompositeComponent{static keepChildrenSerialized({serializedComponent:rs}){return rs.children===void 0?[]:Object.keys(rs.children)}static createAttributesObject(){let rs=super.createAttributesObject();return rs.rendered={createComponentOfType:"boolean",createStateVariable:"rendered",defaultValue:this.renderedDefault,public:!0},rs.isResponse={leaveRaw:!0},rs.createComponentOfType={createPrimitiveOfType:"string"},rs.nComponents={createPrimitiveOfType:"number"},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions(),ns=this;return rs.serializedChildren={returnDependencies:()=>({serializedChildren:{dependencyType:"serializedChildren",doNotProxy:!0}}),definition:function({dependencyValues:ss}){return{setValue:{serializedChildren:ss.serializedChildren}}}},rs.newNamespace={returnDependencies:()=>({newNamespace:{dependencyType:"attributePrimitive",attributeName:"newNamespace"}}),definition({dependencyValues:ss}){return{setValue:{newNamespace:ss.newNamespace}}}},rs.readyToExpandWhenResolved={returnDependencies:()=>({}),definition:function(){return{setValue:{readyToExpandWhenResolved:!0}}}},rs.isVariantComponent={returnDependencies:()=>({}),definition:()=>({setValue:{isVariantComponent:!0}})},rs.generatedVariantInfo={returnDependencies:({sharedParameters:ss,componentInfoObjects:os})=>({variantSeed:{dependencyType:"value",value:ss.variantSeed},variantDescendants:{dependencyType:"descendant",componentTypes:Object.keys(os.componentTypesCreatingVariants),variableNames:["isVariantComponent","generatedVariantInfo"],useReplacementsForComposites:!0,recurseToMatchedChildren:!1,variablesOptional:!0,includeNonActiveChildren:!0,ignoreReplacementsOfEncounteredComposites:!0}}),definition({dependencyValues:ss,componentName:os}){let ls={seed:ss.variantSeed,meta:{createdBy:os}},us=ls.subvariants=[];for(let cs of ss.variantDescendants)cs.stateValues.isVariantComponent?us.push(cs.stateValues.generatedVariantInfo):cs.stateValues.generatedVariantInfo&&us.push(...cs.stateValues.generatedVariantInfo.subvariants);return{setValue:{generatedVariantInfo:ls}}}},rs.nComponentsSpecified={returnDependencies:()=>({nComponentsAttr:{dependencyType:"attributePrimitive",attributeName:"nComponents"},typeAttr:{dependencyType:"attributePrimitive",attributeName:"createComponentOfType"}}),definition({dependencyValues:ss,componentInfoObjects:os}){let ls;if(ss.typeAttr){if(!(os.componentTypeLowerCaseMapping[ss.typeAttr.toLowerCase()]in os.allComponentClasses))throw Error(`Invalid componentType ${ss.typeAttr} of copy.`);ss.nComponentsAttr!==null?ls=ss.nComponentsAttr:ls=1}else{if(ss.nComponentsAttr!==null)throw Error(`You must specify createComponentOfType when specifying nComponents for a ${ns.componentType}.`);ls=null}return{setValue:{nComponentsSpecified:ls}}}},rs}static async createSerializedReplacements({component:rs,componentInfoObjects:ns,alwaysCreateReplacements:ss,flags:os}){var ls;if(await rs.stateValues.nComponentsSpecified,await rs.stateValues.rendered||ss){let us=deepClone(await rs.state.serializedChildren.value),cs=(ls=rs.attributes.newNamespace)==null?void 0:ls.primitive;if("isResponse"in rs.attributes)for(let fs of us){if(typeof fs!="object")continue;let hs=convertAttributesForComponentType({attributes:{isResponse:rs.attributes.isResponse},componentType:fs.componentType,componentInfoObjects:ns,compositeCreatesNewNamespace:cs,flags:os});fs.attributes||(fs.attributes={}),Object.assign(fs.attributes,hs)}let ds=processAssignNames({assignNames:rs.doenetAttributes.assignNames,serializedComponents:us,parentName:rs.componentName,parentCreatesNewNamespace:cs,componentInfoObjects:ns,originalNamesAreConsistent:!0});return{replacements:(await verifyReplacementsMatchSpecifiedType({component:rs,replacements:ds.serializedComponents,assignNames:rs.doenetAttributes.assignNames,componentInfoObjects:ns,compositeAttributesObj:this.createAttributesObject(),flags:os})).replacements}}else return{replacements:[]}}static setUpVariant({serializedComponent:rs,sharedParameters:ns,descendantVariantComponents:ss}){setUpVariantSeedAndRng({serializedComponent:rs,sharedParameters:ns,descendantVariantComponents:ss,useSubpartVariantRng:!0})}get allPotentialRendererTypes(){let rs=super.allPotentialRendererTypes,ns=this.potentialRendererTypesFromSerializedComponents(this.serializedChildren);for(let ss of ns)rs.includes(ss)||rs.push(ss);return rs}}zs(Template,"componentType","template"),zs(Template,"treatAsComponentForRecursiveReplacements",!0),zs(Template,"includeBlankStringChildren",!0),zs(Template,"renderedDefault",!1),zs(Template,"assignNamesToReplacements",!0),zs(Template,"createsVariants",!0);const vectorAndListOperators=["list",...vectorOperators];class MathComponent extends InlineComponent{constructor(rs){super(rs),Object.assign(this.actions,{moveMath:this.moveMath.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.format={createComponentOfType:"text",createStateVariable:"format",defaultValue:"text",public:!0,toLowerCase:!0,validValues:["text","latex"]},rs.simplify={createComponentOfType:"text",createStateVariable:"simplify",defaultValue:"none",public:!0,toLowerCase:!0,valueTransformations:{"":"full",true:"full",false:"none"},validValues:["none","full","numbers","numberspreserveorder"]},rs.expand={createComponentOfType:"boolean",createStateVariable:"expand",defaultValue:!1,public:!0},rs.displayDigits={createComponentOfType:"integer"},rs.displayDecimals={createComponentOfType:"integer"},rs.displaySmallAsZero={createComponentOfType:"number",valueForTrue:1e-14,valueForFalse:0},rs.padZeros={createComponentOfType:"boolean"},rs.renderMode={createComponentOfType:"text",createStateVariable:"renderMode",defaultValue:"inline",public:!0,forRenderer:!0},rs.unordered={createComponentOfType:"boolean"},rs.createVectors={createComponentOfType:"boolean",createStateVariable:"createVectors",defaultValue:!1,public:!0},rs.createIntervals={createComponentOfType:"boolean",createStateVariable:"createIntervals",defaultValue:!1,public:!0},rs.functionSymbols={createComponentOfType:"textList",createStateVariable:"functionSymbols",defaultValue:["f","g"],public:!0},rs.sourcesAreFunctionSymbols={createComponentOfType:"textList",createStateVariable:"sourcesAreFunctionSymbols",defaultValue:[]},rs.splitSymbols={createComponentOfType:"boolean",createStateVariable:"splitSymbols",defaultValue:!0,public:!0,fallBackToParentStateVariable:"splitSymbols"},rs.parseScientificNotation={createComponentOfType:"boolean",createStateVariable:"parseScientificNotation",defaultValue:!1,public:!0,fallBackToParentStateVariable:"parseScientificNotation"},rs.groupCompositeReplacements={createPrimitiveOfType:"boolean",createStateVariable:"groupCompositeReplacements",defaultValue:!0},rs.displayBlanks={createComponentOfType:"boolean",createStateVariable:"displayBlanks",defaultValue:!0,public:!0},rs.draggable={createComponentOfType:"boolean",createStateVariable:"draggable",defaultValue:!0,public:!0,forRenderer:!0},rs.layer={createComponentOfType:"number",createStateVariable:"layer",defaultValue:0,public:!0,forRenderer:!0},rs.anchor={createComponentOfType:"point"},rs.positionFromAnchor={createComponentOfType:"text",createStateVariable:"positionFromAnchor",defaultValue:"center",public:!0,forRenderer:!0,toLowerCase:!0,validValues:["upperright","upperleft","lowerright","lowerleft","top","bottom","left","right","center"]},rs.styleNumber.defaultValue=0,rs}static returnChildGroups(){return[{group:"maths",componentTypes:["math"]},{group:"strings",componentTypes:["string"]},{group:"displayedMaths",componentTypes:["m","me","men"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions(),ns=returnSelectedStyleStateVariableDefinition();return Object.assign(rs,ns),rs.displayDigits={public:!0,shadowingInstructions:{createComponentOfType:"integer"},hasEssential:!0,defaultValue:10,returnDependencies:()=>({mathListParentDisplayDigits:{dependencyType:"parentStateVariable",parentComponentType:"mathList",variableName:"displayDigits"},numberListParentDisplayDigits:{dependencyType:"parentStateVariable",parentComponentType:"numberList",variableName:"displayDigits"},mathListParentDisplayDecimals:{dependencyType:"parentStateVariable",parentComponentType:"mathList",variableName:"displayDecimals"},numberListParentDisplayDecimals:{dependencyType:"parentStateVariable",parentComponentType:"numberList",variableName:"displayDecimals"},displayDigitsAttr:{dependencyType:"attributeComponent",attributeName:"displayDigits",variableNames:["value"]},displayDecimalsAttr:{dependencyType:"attributeComponent",attributeName:"displayDecimals",variableNames:["value"]},mathChildren:{dependencyType:"child",childGroups:["maths"],variableNames:["displayDigits"]},stringChildren:{dependencyType:"child",childGroups:["strings"]}}),definition({dependencyValues:ss,usedDefault:os}){let ls=!1,us;if(ss.mathListParentDisplayDigits!==null)if(os.mathListParentDisplayDigits)ls=!0,us=ss.mathListParentDisplayDigits;else return{setValue:{displayDigits:ss.mathListParentDisplayDigits}};if(ss.numberListParentDisplayDigits!==null)if(os.numberListParentDisplayDigits)ls=!0,us=ss.numberListParentDisplayDigits;else return{setValue:{displayDigits:ss.numberListParentDisplayDigits}};let cs=ss.numberListParentDisplayDecimals!==null&&!os.numberListParentDisplayDecimals||ss.mathListParentDisplayDecimals!==null&&!os.mathListParentDisplayDecimals,ds=ss.displayDigitsAttr===null||os.displayDigitsAttr,ps=ss.displayDecimalsAttr===null||os.displayDecimalsAttr;if(!(ds||ps)){let fs=ss.displayDigitsAttr.shadowDepth;ss.displayDecimalsAttr.shadowDepth({mathListParentDisplayDecimals:{dependencyType:"parentStateVariable",parentComponentType:"mathList",variableName:"displayDecimals"},numberListParentDisplayDecimals:{dependencyType:"parentStateVariable",parentComponentType:"numberList",variableName:"displayDecimals"},displayDecimalsAttr:{dependencyType:"attributeComponent",attributeName:"displayDecimals",variableNames:["value"]},mathChildren:{dependencyType:"child",childGroups:["maths"],variableNames:["displayDecimals"]},stringChildren:{dependencyType:"child",childGroups:["strings"]}}),definition({dependencyValues:ss,usedDefault:os}){let ls=!1,us;if(ss.mathListParentDisplayDecimals!==null)if(os.mathListParentDisplayDecimals)ls=!0,us=ss.mathListParentDisplayDecimals;else return{setValue:{displayDecimals:ss.mathListParentDisplayDecimals}};if(ss.numberListParentDisplayDecimals!==null)if(os.numberListParentDisplayDecimals)ls=!0,us=ss.numberListParentDisplayDecimals;else return{setValue:{displayDecimals:ss.numberListParentDisplayDecimals}};if(ss.displayDecimalsAttr!==null)if(os.displayDecimalsAttr)ls=!0,us=ss.displayDecimalsAttr.stateValues.value;else return{setValue:{displayDecimals:ss.displayDecimalsAttr.stateValues.value}};if(ss.mathChildren.length===1&&ss.stringChildren.length===0)if(os.mathChildren[0]&&os.mathChildren[0].displayDecimals)ls=!0,us=ss.mathChildren[0].stateValues.displayDecimals;else return{setValue:{displayDecimals:ss.mathChildren[0].stateValues.displayDecimals}};return ls?{useEssentialOrDefaultValue:{displayDecimals:{defaultValue:us}}}:{useEssentialOrDefaultValue:{displayDecimals:!0}}}},rs.displaySmallAsZero={public:!0,shadowingInstructions:{createComponentOfType:"number"},hasEssential:!0,defaultValue:0,returnDependencies:()=>({mathListParentDisplaySmallAsZero:{dependencyType:"parentStateVariable",parentComponentType:"mathList",variableName:"displaySmallAsZero"},numberListParentDisplaySmallAsZero:{dependencyType:"parentStateVariable",parentComponentType:"numberList",variableName:"displaySmallAsZero"},displaySmallAsZeroAttr:{dependencyType:"attributeComponent",attributeName:"displaySmallAsZero",variableNames:["value"]},mathChildren:{dependencyType:"child",childGroups:["maths"],variableNames:["displaySmallAsZero"]},stringChildren:{dependencyType:"child",childGroups:["strings"]}}),definition({dependencyValues:ss,usedDefault:os}){let ls=!1,us;if(ss.mathListParentDisplaySmallAsZero!==null)if(os.mathListParentDisplaySmallAsZero)ls=!0,us=ss.mathListParentDisplaySmallAsZero;else return{setValue:{displaySmallAsZero:ss.mathListParentDisplaySmallAsZero}};if(ss.numberListParentDisplaySmallAsZero!==null)if(os.numberListParentDisplaySmallAsZero)ls=!0,us=ss.numberListParentDisplaySmallAsZero;else return{setValue:{displaySmallAsZero:ss.numberListParentDisplaySmallAsZero}};if(ss.displaySmallAsZeroAttr!==null)if(os.displaySmallAsZeroAttr)ls=!0,us=ss.displaySmallAsZeroAttr.stateValues.value;else return{setValue:{displaySmallAsZero:ss.displaySmallAsZeroAttr.stateValues.value}};if(ss.mathChildren.length===1&&ss.stringChildren.length===0)if(os.mathChildren[0]&&os.mathChildren[0].displaySmallAsZero)ls=!0,us=ss.mathChildren[0].stateValues.displaySmallAsZero;else return{setValue:{displaySmallAsZero:ss.mathChildren[0].stateValues.displaySmallAsZero}};return ls?{useEssentialOrDefaultValue:{displaySmallAsZero:{defaultValue:us}}}:{useEssentialOrDefaultValue:{displaySmallAsZero:!0}}}},rs.padZeros={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},hasEssential:!0,defaultValue:!1,returnDependencies:()=>({mathListParentPadZeros:{dependencyType:"parentStateVariable",parentComponentType:"mathList",variableName:"padZeros"},numberListParentPadZeros:{dependencyType:"parentStateVariable",parentComponentType:"numberList",variableName:"padZeros"},padZerosAttr:{dependencyType:"attributeComponent",attributeName:"padZeros",variableNames:["value"]},displayDecimalsAttr:{dependencyType:"attributeComponent",attributeName:"displayDecimals",variableNames:["value"]},mathChildren:{dependencyType:"child",childGroups:["maths"],variableNames:["padZeros"]},stringChildren:{dependencyType:"child",childGroups:["strings"]}}),definition({dependencyValues:ss,usedDefault:os}){let ls=!1,us;if(ss.mathListParentPadZeros!==null)if(os.mathListParentPadZeros)ls=!0,us=ss.mathListParentPadZeros;else return{setValue:{padZeros:ss.mathListParentPadZeros}};if(ss.numberListParentPadZeros!==null)if(os.numberListParentPadZeros)ls=!0,us=ss.numberListParentPadZeros;else return{setValue:{padZeros:ss.numberListParentPadZeros}};if(ss.padZerosAttr!==null)if(os.padZerosAttr)ls=!0,us=ss.padZerosAttr.stateValues.value;else return{setValue:{padZeros:ss.padZerosAttr.stateValues.value}};if(ss.mathChildren.length===1&&ss.stringChildren.length==0)if(os.mathChildren[0]&&os.mathChildren[0].padZeros)ls=!0,us=ss.mathChildren[0].stateValues.padZeros;else return{setValue:{padZeros:ss.mathChildren[0].stateValues.padZeros}};return ls?{useEssentialOrDefaultValue:{padZeros:{defaultValue:us}}}:{useEssentialOrDefaultValue:{padZeros:!0}}}},rs.valueShadow={defaultValue:Context.fromAst("_"),hasEssential:!0,essentialVarName:"value",returnDependencies:()=>({}),definition:()=>({useEssentialOrDefaultValue:{valueShadow:!0}}),inverseDefinition:function({desiredStateVariableValues:ss}){return{success:!0,instructions:[{setEssentialValue:"valueShadow",value:ss.valueShadow}]}}},rs.unordered={defaultValue:!1,public:!0,shadowingInstructions:{createComponentOfType:"boolean"},hasEssential:!0,returnDependencies:()=>({unorderedAttr:{dependencyType:"attributeComponent",attributeName:"unordered",variableNames:["value"]},mathChildren:{dependencyType:"child",childGroups:["maths"],variableNames:["unordered"]}}),definition({dependencyValues:ss}){return ss.unorderedAttr===null?ss.mathChildren.length>0?{setValue:{unordered:ss.mathChildren.every(ls=>ls.stateValues.unordered)}}:{useEssentialOrDefaultValue:{unordered:!0}}:{setValue:{unordered:ss.unorderedAttr.stateValues.value}}}},rs.codePre={returnDependencies:()=>({stringChildren:{dependencyType:"child",childGroups:["strings"]}}),definition({dependencyValues:ss}){let os="math",ls=!1;do{ls=!1;for(let us of ss.stringChildren)if(us.includes(os)===!0){ls=!0,os+="m";break}}while(ls);return{setValue:{codePre:os}}}},rs.mathChildrenFunctionSymbols={returnDependencies:()=>({sourcesAreFunctionSymbols:{dependencyType:"stateVariable",variableName:"sourcesAreFunctionSymbols"},mathChildren:{dependencyType:"child",childGroups:["maths"]}}),definition({dependencyValues:ss}){let os=[];if(ss.mathChildren.compositeReplacementRange){for(let ls of ss.mathChildren.compositeReplacementRange)if(ss.sourcesAreFunctionSymbols.includes(ls.target))for(let us=ls.firstInd;us<=ls.lastInd;us++)os.push(us)}return{setValue:{mathChildrenFunctionSymbols:os}}}},rs.expressionWithCodes={hasEssential:!0,doNotShadowEssential:!0,returnDependencies:()=>({stringMathChildren:{dependencyType:"child",childGroups:["strings","maths"]},stringChildren:{dependencyType:"child",childGroups:["strings"]},mathChildren:{dependencyType:"child",childGroups:["maths"]},displayedMathChildren:{dependencyType:"child",childGroups:["displayedMaths"],variableNames:["latex"]},format:{dependencyType:"stateVariable",variableName:"format"},codePre:{dependencyType:"stateVariable",variableName:"codePre"},functionSymbols:{dependencyType:"stateVariable",variableName:"functionSymbols"},mathChildrenFunctionSymbols:{dependencyType:"stateVariable",variableName:"mathChildrenFunctionSymbols"},splitSymbols:{dependencyType:"stateVariable",variableName:"splitSymbols"},parseScientificNotation:{dependencyType:"stateVariable",variableName:"parseScientificNotation"},groupCompositeReplacements:{dependencyType:"stateVariable",variableName:"groupCompositeReplacements"}}),set:ss=>ss===null?null:convertValueToMathExpression(ss),definition:calculateExpressionWithCodes,async inverseDefinition({desiredStateVariableValues:ss,dependencyValues:os,stateValues:ls}){let us=ss.expressionWithCodes,cs=[{setEssentialValue:"expressionWithCodes",value:us}],ds=os.stringChildren.length;if(ds===0)return{success:!1};if(os.mathChildren.length===0){let ps;await ls.format==="latex"?ps=us.toLatex():ps=us.toString(),cs.push({setDependency:"stringChildren",desiredValue:ps,childIndex:0,variableIndex:0,ignoreChildChangeForComponent:!0});for(let fs=1;fs({mathChildren:{dependencyType:"child",childGroups:["maths"],variableNames:["value","canBeModified"]}}),definition:({dependencyValues:ss})=>({setValue:{mathChildrenWithCanBeModified:ss.mathChildren}})},rs.unnormalizedValue={returnDependencies:()=>({mathChildren:{dependencyType:"child",childGroups:["maths"],variableNames:["value"]},stringChildren:{dependencyType:"child",childGroups:["strings"],variableNames:["value"]},expressionWithCodes:{dependencyType:"stateVariable",variableName:"expressionWithCodes"},codePre:{dependencyType:"stateVariable",variableName:"codePre"},valueShadow:{dependencyType:"stateVariable",variableName:"valueShadow"}}),set:convertValueToMathExpression,defaultValue:Context.fromAst("_"),definition:calculateMathValue,inverseDefinition:invertMath},rs.value={public:!0,shadowingInstructions:{createComponentOfType:this.componentType,attributesToShadow:["unordered","displayDigits","displayDecimals","displaySmallAsZero","padZeros","simplify","expand"],addAttributeComponentsShadowingStateVariables:{fixed:{stateVariableToShadow:"fixed"}}},returnDependencies:()=>({unnormalizedValue:{dependencyType:"stateVariable",variableName:"unnormalizedValue"},simplify:{dependencyType:"stateVariable",variableName:"simplify"},expand:{dependencyType:"stateVariable",variableName:"expand"},createVectors:{dependencyType:"stateVariable",variableName:"createVectors"},createIntervals:{dependencyType:"stateVariable",variableName:"createIntervals"}}),definition:function({dependencyValues:ss}){let os=ss.unnormalizedValue,{simplify:ls,expand:us,createVectors:cs,createIntervals:ds}=ss;return os=normalizeMathExpression({value:os,simplify:ls,expand:us,createVectors:cs,createIntervals:ds}),{setValue:{value:os}}},inverseDefinition:function({desiredStateVariableValues:ss}){return{success:!0,instructions:[{setDependency:"unnormalizedValue",desiredValue:ss.value}]}}},rs.number={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"]},returnDependencies:()=>({value:{dependencyType:"stateVariable",variableName:"value"}}),definition:function({dependencyValues:ss}){return{setValue:{number:ss.value.evaluate_to_constant()}}},inverseDefinition:function({desiredStateVariableValues:ss}){return{success:!0,instructions:[{setDependency:"value",desiredValue:Context.fromAst(ss.number)}]}}},rs.isNumber={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},returnDependencies:()=>({value:{dependencyType:"stateVariable",variableName:"value"}}),definition:function({dependencyValues:ss}){return{setValue:{isNumber:Number.isFinite(ss.value.tree)}}}},rs.isNumeric={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},returnDependencies:()=>({number:{dependencyType:"stateVariable",variableName:"number"}}),definition:function({dependencyValues:ss}){return{setValue:{isNumeric:Number.isFinite(ss.number)}}}},rs.valueForDisplay={returnDependencies:()=>({value:{dependencyType:"stateVariable",variableName:"value"},displayDigits:{dependencyType:"stateVariable",variableName:"displayDigits"},displayDecimals:{dependencyType:"stateVariable",variableName:"displayDecimals"},displaySmallAsZero:{dependencyType:"stateVariable",variableName:"displaySmallAsZero"},simplify:{dependencyType:"stateVariable",variableName:"simplify"},expand:{dependencyType:"stateVariable",variableName:"expand"}}),definition:function({dependencyValues:ss,usedDefault:os}){let ls=roundForDisplay({value:ss.value,dependencyValues:ss,usedDefault:os});return{setValue:{valueForDisplay:normalizeMathExpression({value:ls,simplify:ss.simplify,expand:ss.expand})}}},inverseDefinition({desiredStateVariableValues:ss}){return{success:!0,instructions:[{setDependency:"value",desiredValue:ss.valueForDisplay}]}}},rs.latex={public:!0,forRenderer:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({valueForDisplay:{dependencyType:"stateVariable",variableName:"valueForDisplay"},padZeros:{dependencyType:"stateVariable",variableName:"padZeros"},displayDigits:{dependencyType:"stateVariable",variableName:"displayDigits"},displayDecimals:{dependencyType:"stateVariable",variableName:"displayDecimals"},displayBlanks:{dependencyType:"stateVariable",variableName:"displayBlanks"}}),definition:function({dependencyValues:ss,usedDefault:os}){let ls,us={};ss.padZeros&&(os.displayDigits&&!os.displayDecimals?Number.isFinite(ss.displayDecimals)&&(us.padToDecimals=ss.displayDecimals):ss.displayDigits>=1&&(us.padToDigits=ss.displayDigits)),ss.displayBlanks||(us.showBlanks=!1);try{ls=ss.valueForDisplay.toLatex(us)}catch{ss.displayBlanks?ls="_":ls=""}return{setValue:{latex:ls}}},inverseDefinition({desiredStateVariableValues:ss}){let os;try{os=Context.fromLatex(ss.latex)}catch{return{success:!1}}return{success:!0,instructions:[{setDependency:"valueForDisplay",desiredValue:os}]}}},rs.latexWithInputChildren={forRenderer:!0,returnDependencies:()=>({latex:{dependencyType:"stateVariable",variableName:"latex"}}),definition:function({dependencyValues:ss}){return{setValue:{latexWithInputChildren:[ss.latex]}}}},rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({valueForDisplay:{dependencyType:"stateVariable",variableName:"valueForDisplay"},padZeros:{dependencyType:"stateVariable",variableName:"padZeros"},displayDigits:{dependencyType:"stateVariable",variableName:"displayDigits"},displayDecimals:{dependencyType:"stateVariable",variableName:"displayDecimals"},value:{dependencyType:"stateVariable",variableName:"value"},displayBlanks:{dependencyType:"stateVariable",variableName:"displayBlanks"}}),definition:function({dependencyValues:ss,usedDefault:os}){let ls,us={};ss.padZeros&&(os.displayDigits&&!os.displayDecimals?Number.isFinite(ss.displayDecimals)&&(us.padToDecimals=ss.displayDecimals):ss.displayDigits>=1&&(us.padToDigits=ss.displayDigits)),ss.displayBlanks||(us.showBlanks=!1);try{ls=ss.valueForDisplay.toString(us)}catch{ss.displayBlanks?ls="_":ls=""}return{setValue:{text:superSubscriptsToUnicode(ls.toString())}}},async inverseDefinition({desiredStateVariableValues:ss,stateValues:os}){let ls=getFromText({functionSymbols:await os.functionSymbols,splitSymbols:await os.splitSymbols,parseScientificNotation:await os.parseScientificNotation}),us;try{us=ls(unicodeToSuperSubscripts(ss.text))}catch{return{success:!1}}return{success:!0,instructions:[{setDependency:"value",desiredValue:us}]}}},rs.codesAdjacentToStrings={returnDependencies:()=>({stringMathChildren:{dependencyType:"child",childGroups:["strings","maths"]},codePre:{dependencyType:"stateVariable",variableName:"codePre"},format:{dependencyType:"stateVariable",variableName:"format"}}),definition:calculateCodesAdjacentToStrings},rs.canBeModified={additionalStateVariablesDefined:["constantChildIndices","codeForExpression","inverseMaps","template","mathChildrenMapped"],returnDependencies:()=>({mathChildrenModifiable:{dependencyType:"child",childGroups:["maths"],variableNames:["canBeModified"]},displayedMathChildren:{dependencyType:"child",childGroups:["displayedMaths"]},expressionWithCodes:{dependencyType:"stateVariable",variableName:"expressionWithCodes"},modifyIndirectly:{dependencyType:"stateVariable",variableName:"modifyIndirectly"},fixed:{dependencyType:"stateVariable",variableName:"fixed"},codePre:{dependencyType:"stateVariable",variableName:"codePre"}}),definition:determineCanBeModified},rs.mathChildrenByVectorComponent={returnDependencies:()=>({codePre:{dependencyType:"stateVariable",variableName:"codePre"},mathChildren:{dependencyType:"child",childGroups:["maths"]},expressionWithCodes:{dependencyType:"stateVariable",variableName:"expressionWithCodes"}}),definition:function({dependencyValues:ss}){if(ss.expressionWithCodes===null)return{setValue:{mathChildrenByVectorComponent:null}};let os=ss.expressionWithCodes.tree,ls=ss.mathChildren.length;if(ls===0||!Array.isArray(os)||!vectorOperators.includes(os[0]))return{setValue:{mathChildrenByVectorComponent:null}};let us={},cs=0,ds=ss.codePre+cs;for(let ps=1;ps=ls)break}return{setValue:{mathChildrenByVectorComponent:us}}}},rs.nDimensions={public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies:()=>({value:{dependencyType:"stateVariable",variableName:"value"}}),definition({dependencyValues:ss}){let os=1,ls=ss.value.tree;if(Array.isArray(ls))if(vectorAndListOperators.includes(ls[0]))os=ls.length-1;else if(ls[0]==="matrix"){let us=ls[1].slice(1);us[0]===1?os=us[1]:us[1]===1&&(os=us[0])}else vectorOperators.includes(ls[1][0])&&(ls[0]==="^"&&ls[2]==="T"||ls[0]==="prime")&&(os=ls[1].length-1);return{setValue:{nDimensions:os}}}},rs.vector={public:!0,shadowingInstructions:{createComponentOfType:"math",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"],returnWrappingComponents(ss){return ss==="x"?[]:[["vector",{componentType:"mathList",isAttribute:"xs"}]]}},isArray:!0,entryPrefixes:["x"],returnArraySizeDependencies:()=>({nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),returnArraySize({dependencyValues:ss}){return[ss.nDimensions]},returnArrayDependenciesByKey(){return{globalDependencies:{value:{dependencyType:"stateVariable",variableName:"value"}}}},arrayDefinitionByKey({globalDependencyValues:ss,arraySize:os}){let ls=ss.value.tree,us=!1,cs={};if(Array.isArray(ls)){if(vectorAndListOperators.includes(ls[0])){for(let ds=0;dshs.tree)]);else if(ps[0]==="matrix"){let hs=ps[1].slice(1);if(hs[0]===1){let gs=["tuple"];for(let ys=0;yshs.tree)]],ps[2]&&ds.push(ps[2]),ds=Context.fromAst(ds));return ds||(ds=us.desiredVector[0]),{success:!0,instructions:[{setDependency:"value",desiredValue:ds}]}}},rs.x={isAlias:!0,targetVariableName:"x1"},rs.y={isAlias:!0,targetVariableName:"x2"},rs.z={isAlias:!0,targetVariableName:"x3"},rs.matrixSize={public:!0,shadowingInstructions:{createComponentOfType:"numberList"},returnDependencies:()=>({value:{dependencyType:"stateVariable",variableName:"value"}}),definition({dependencyValues:ss}){let os=[1,1],ls=ss.value.tree;return Array.isArray(ls)&&(vectorAndListOperators.includes(ls[0])?os=[ls.length-1,1]:ls[0]==="matrix"?os=ls[1].slice(1):vectorOperators.includes(ls[1][0])&&(ls[0]==="^"&&ls[2]==="T"||ls[0]==="prime")&&(os=[1,ls[1].length-1])),{setValue:{matrixSize:os}}}},rs.nRows={public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies:()=>({matrixSize:{dependencyType:"stateVariable",variableName:"matrixSize"}}),definition({dependencyValues:ss}){return{setValue:{nRows:ss.matrixSize[0]}}}},rs.nColumns={public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies:()=>({matrixSize:{dependencyType:"stateVariable",variableName:"matrixSize"}}),definition({dependencyValues:ss}){return{setValue:{nColumns:ss.matrixSize[1]}}}},rs.matrix={public:!0,shadowingInstructions:{createComponentOfType:"math",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"],returnWrappingComponents(ss){return ss==="matrixEntry"?[]:ss==="row"?[["matrix","matrixRow"]]:ss==="column"?[["matrix","matrixColumn"]]:[["matrixRow"],["matrix"]]}},isArray:!0,nDimensions:2,entryPrefixes:["matrixEntry","row","column","rows","columns"],getArrayKeysFromVarName({arrayEntryPrefix:ss,varEnding:os,arraySize:ls}){if(ss==="matrixEntry"){let us=os.split("_").map(cs=>Number(cs)-1);return us.length===2&&us.every(cs=>Number.isInteger(cs)&&cs>=0)?ls?us.every((cs,ds)=>cs=0?ls?usus+","+ds):[]:[us+",0"]:[]}else if(ss==="column"){let us=Number(os)-1;return Number.isInteger(us)&&us>=0?ls?usds+","+us):[]:["0,"+us]:[]}else if(ss==="rows"||ss==="columns"){if(!ls)return["0,0"];let us=[];for(let cs=0;cscs+","+ps));return us}},arrayVarNameFromPropIndex(ss,os){if(os==="matrix"||os==="rows")return ss.length===1?"row"+ss[0]:`matrixEntry${ss[0]}_${ss[1]}`;if(os==="columns")return ss.length===1?"column"+ss[0]:`matrixEntry${ss[1]}_${ss[0]}`;if(os.slice(0,3)==="row"){let ls=Number(os.slice(3));if(Number.isInteger(ls)&&ls>0)return`matrixEntry${ls}_${ss[0]}`}if(os.slice(0,6)==="column"){let ls=Number(os.slice(6));if(Number.isInteger(ls)&&ls>0)return`matrixEntry${ss[0]}_${ls}`}return null},returnArraySizeDependencies:()=>({matrixSize:{dependencyType:"stateVariable",variableName:"matrixSize"}}),returnArraySize({dependencyValues:ss}){return ss.matrixSize},returnArrayDependenciesByKey(){return{globalDependencies:{value:{dependencyType:"stateVariable",variableName:"value"}}}},arrayDefinitionByKey({globalDependencyValues:ss,arraySize:os}){let ls=ss.value.tree,us=!1,cs={};if(Array.isArray(ls)){if(vectorAndListOperators.includes(ls[0])){for(let ds=0;ds({anchorAttr:{dependencyType:"attributeComponent",attributeName:"anchor",variableNames:["coords"]}}),definition({dependencyValues:ss}){return ss.anchorAttr?{setValue:{anchor:ss.anchorAttr.stateValues.coords}}:{useEssentialOrDefaultValue:{anchor:!0}}},async inverseDefinition({desiredStateVariableValues:ss,dependencyValues:os,stateValues:ls,initialChange:us}){return us&&!await ls.draggable?{success:!1}:os.anchorAttr?{success:!0,instructions:[{setDependency:"anchorAttr",desiredValue:ss.anchor,variableIndex:0}]}:{success:!0,instructions:[{setEssentialValue:"anchor",value:ss.anchor}]}}},rs}async moveMath({x:rs,y:ns,z:ss,transient:os,actionId:ls,sourceInformation:us={},skipRendererUpdate:cs=!1}){let ds=["vector"];return rs!==void 0&&(ds[1]=rs),ns!==void 0&&(ds[2]=ns),ss!==void 0&&(ds[3]=ss),os?await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"anchor",value:Context.fromAst(ds)}],transient:os,actionId:ls,sourceInformation:us,skipRendererUpdate:cs}):await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"anchor",value:Context.fromAst(ds)}],actionId:ls,sourceInformation:us,skipRendererUpdate:cs,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{x:rs,y:ns,z:ss}}})}}zs(MathComponent,"componentType","math"),zs(MathComponent,"primaryStateVariableForDefinition","unnormalizedValue"),zs(MathComponent,"primaryEssentialStateVariable","value"),zs(MathComponent,"variableForPlainMacro","value"),zs(MathComponent,"descendantCompositesMustHaveAReplacement",!0),zs(MathComponent,"descendantCompositesDefaultReplacementType","math"),zs(MathComponent,"adapters",[{stateVariable:"number",stateVariablesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"]},"text",{componentType:"subsetOfReals",stateVariable:"value",substituteForPrimaryStateVariable:"subsetValue"}]);function calculateExpressionWithCodes({dependencyValues:as,changes:rs}){if(!("stringMathChildren"in rs&&rs.stringMathChildren.componentIdentitiesChanged||"displayedMathChildren"in rs||"format"in rs||"splitSymbols"in rs||"parseScientificNotation"in rs||"functionSymbols"in rs||"mathChildrenFunctionSymbols"in rs))return{useEssentialOrDefaultValue:{expressionWithCodes:!0}};if(as.stringMathChildren.length===0)if(as.displayedMathChildren.length>0){let gs;try{gs=Context.fromLatex(as.displayedMathChildren[0].stateValues.latex)}catch{gs=Context.fromAst("_")}return{setValue:{expressionWithCodes:gs},setEssentialValue:{expressionWithCodes:gs}}}else return{setValue:{expressionWithCodes:null},setEssentialValue:{expressionWithCodes:null}};let ns="",ss=0,os="",ls=as.stringMathChildren.compositeReplacementRange,us,cs,ds,ps;as.groupCompositeReplacements&&ls.length>0&&(ds=0,ps=ls[ds].firstInd);for(let[gs,ys]of as.stringMathChildren.entries()){if(us===void 0&&gs===ps){us=ds,cs=ls[ds].lastInd,os="";let bs=cs===gs;if(!bs){for(let vs=gs;vs<=cs;vs++)if(typeof as.stringMathChildren[vs]=="string"){bs=!0;break}}bs&&(ls.length>us+1?(ds=us+1,ps=ls[ds].firstInd):(ds=void 0,ps=void 0),us=void 0,cs=void 0)}if(typeof ys=="string")ns+=" "+ys+" ";else{let bs=as.codePre+ss;ss++;let vs;as.format==="latex"?vs="\\operatorname{"+bs+"}":vs=" "+bs+" ",us!==void 0?(os&&(os+=","),os+=vs):ns+=vs}if(gs===cs){let bs=ns.trimEnd(),vs=!1;if(bs.length===0)vs=!0;else{let xs=bs[bs.length-1];if(!["{","[","(","|",","].includes(xs))vs=!0;else{let Cs=as.stringMathChildren[gs+1];if(typeof Cs!="string")vs=!0;else{let Ts=Cs.trimStart();if(Ts.length===0)vs=!0;else{let Ss=Ts[0];as.format==="latex"&&Ss==="\\"&&Ts.length>1&&(Ss=Ts[1]),["}","]",")","|",","].includes(Ss)||(vs=!0)}}}}vs&&(os="("+os+")"),ns+=os,os="",ls.length>us+1?(ds=us+1,ps=ls[ds].firstInd):(ds=void 0,ps=void 0),us=void 0,cs=void 0}}let fs=null,hs=[...as.functionSymbols];if(hs.push(...as.mathChildrenFunctionSymbols.map(gs=>as.codePre+gs)),ns==="")fs=Context.fromAst("_");else if(as.format==="text"){let gs=getFromText({functionSymbols:hs,splitSymbols:as.splitSymbols,parseScientificNotation:as.parseScientificNotation});try{fs=gs(ns)}catch{fs=Context.fromAst("_"),console.log("Invalid value for a math of text format: "+ns)}}else if(as.format==="latex"){let gs=getFromLatex({functionSymbols:hs,splitSymbols:as.splitSymbols,parseScientificNotation:as.parseScientificNotation});try{fs=gs(ns)}catch{fs=Context.fromAst("_"),console.log("Invalid value for a math of latex format: "+ns)}}return{setValue:{expressionWithCodes:fs},setEssentialValue:{expressionWithCodes:fs}}}function calculateMathValue({dependencyValues:as}={}){if(as.expressionWithCodes===null)return{setValue:{unnormalizedValue:as.valueShadow}};let rs={};for(let[ss,os]of as.mathChildren.entries())rs[as.codePre+ss]=os.stateValues.value;let ns=as.expressionWithCodes;return as.mathChildren.length>0&&(ns=ns.substitute(rs)),ns=Context.fromAst(mergeListsWithOtherContainers(ns.tree)),{setValue:{unnormalizedValue:ns}}}function calculateCodesAdjacentToStrings({dependencyValues:as}){let rs=[],ns;for(let[ss,os]of as.stringMathChildren.entries())if(typeof os=="string"){let ls=as.stringMathChildren[ss+1];if(ls!==void 0&&typeof ls=="string")continue;let us={};if(ns!==void 0&&(as.format==="latex"?us.prevCode="\\operatorname{"+as.codePre+ns+"}":us.prevCode=as.codePre+ns),ls!==void 0){let cs=0;ns!==void 0&&(cs=ns+1),as.format==="latex"?us.nextCode="\\operatorname{"+as.codePre+cs+"}":us.nextCode=as.codePre+cs}rs.push(us)}else ns===void 0?ns=0:ns++;return{setValue:{codesAdjacentToStrings:rs}}}function determineCanBeModified({dependencyValues:as}){if(!as.modifyIndirectly||as.fixed)return{setValue:{canBeModified:!1,constantChildIndices:null,codeForExpression:null,inverseMaps:null,template:null,mathChildrenMapped:null}};if(as.mathChildrenModifiable.length===0)return as.displayedMathChildren.length>0?{setValue:{canBeModified:!1,constantChildIndices:null,codeForExpression:null,inverseMaps:null,template:null,mathChildrenMapped:null}}:{setValue:{canBeModified:!0,constantChildIndices:null,codeForExpression:null,inverseMaps:null,template:null,mathChildrenMapped:null}};let rs=[],ns=[],ss=[],os={};for(let[ds,ps]of as.mathChildrenModifiable.entries()){let fs=as.codePre+ds;ps.stateValues.canBeModified===!0?(rs.push(ds),ns.push(fs)):(ss.push(fs),os[fs]=ds)}let ls=as.codePre+"expr",us=Context.utils.unflattenLeft(as.expressionWithCodes.tree),cs=checkForLinearExpression(us,ns,ls,ss);if(cs.foundLinear){let ds={},ps=cs.template,fs=new Set;for(let hs in cs.mappings){ds[hs]=cs.mappings[hs];let gs=ds[hs].mathChildSub;if(gs){let ys=rs[ns.indexOf(gs)];ds[hs].mathChildInd=ys,fs.add(Number(ys))}}return fs.has=fs.has.bind(fs),{setValue:{canBeModified:!0,constantChildIndices:os,codeForExpression:ls,inverseMaps:ds,template:ps,mathChildrenMapped:fs}}}return{setValue:{canBeModified:!1,constantChildIndices:null,codeForExpression:null,inverseMaps:null,template:null,mathChildrenMapped:null}}}function checkForLinearExpression(as,rs,ns,ss=[],os=[]){let ls=Context.variables(as);if(ls.every(ds=>!rs.includes(ds))&&ls.every(ds=>!ss.includes(ds))){let ds={},ps="x"+os.join("_");return ds[ps]={result:Context.fromAst(ns).simplify(),components:os},{foundLinear:!0,mappings:ds,template:ps}}if(!Array.isArray(as))return checkForScalarLinearExpression(as,rs,ns,os);let us=as[0],cs=as.slice(1);if(vectorAndListOperators.includes(us)){let ds={mappings:{},template:[us]},ps=0;for(let fs=0;fs!rs.includes(us))?(ns=["+",ns,["-",ls[0]]],checkForScalarLinearExpression(ls[1],rs,ns,ss)):Context.variables(ls[1]).every(us=>!rs.includes(us))?(ns=["+",ns,["-",ls[1]]],checkForScalarLinearExpression(ls[0],rs,ns,ss)):{foundLinear:!1}:os==="*"?Context.variables(ls[0]).every(us=>!rs.includes(us))?(ns=["/",ns,ls[0]],checkForScalarLinearExpression(ls[1],rs,ns,ss)):Context.variables(ls[1]).every(us=>!rs.includes(us))?(ns=["/",ns,ls[1]],checkForScalarLinearExpression(ls[0],rs,ns,ss)):{foundLinear:!1}:os==="/"?Context.variables(ls[1]).every(us=>!rs.includes(us))?(ns=["*",ns,ls[1]],checkForScalarLinearExpression(ls[0],rs,ns,ss)):{foundLinear:!1}:{foundLinear:!1}}async function invertMath({desiredStateVariableValues:as,dependencyValues:rs,stateValues:ns,workspace:ss,overrideFixed:os}){if(!await ns.canBeModified&&!os)return{success:!1};let ls=rs.mathChildren,us=rs.stringChildren.length;if(ls.length===1&&us===0)return{success:!0,instructions:[{setDependency:"mathChildren",desiredValue:as.unnormalizedValue,childIndex:0,variableIndex:0}]};let cs=convertValueToMathExpression(as.unnormalizedValue),ds=await preprocessMathInverseDefinition({desiredValue:cs,stateValues:ns,variableName:"value",workspace:ss}),ps=ds.vectorComponentsNotAffected;if(cs=ds.desiredValue,ls.length===0){let bs=[];return us>0?bs.push({setDependency:"expressionWithCodes",desiredValue:cs}):bs.push({setDependency:"valueShadow",desiredValue:cs}),{success:!0,instructions:bs}}let fs=await getExpressionPieces({expression:cs,stateValues:ns});if(!fs)return{success:!1};let hs=[],gs=[];if(ps&&await ns.mathChildrenByVectorComponent){let bs=await ns.mathChildrenByVectorComponent;for(let vs of ps)bs[vs]&&gs.push(...bs[vs])}let ys=await ns.mathChildrenWithCanBeModified;for(let[bs,vs]of ls.entries())if(ns.mathChildrenMapped.has(bs)&&ys[bs].stateValues.canBeModified){if(!gs.includes(bs)){let xs=fs[bs],Cs={},Ts=!1,Ss=await ns.constantChildIndices;for(let Ns in Ss){let As=Ss[Ns];Cs[Ns]=ls[As].stateValues.value,Ts=!0}Ts&&(xs=xs.substitute(Cs)),xs=xs.simplify(),hs.push({setDependency:"mathChildren",desiredValue:xs,childIndex:bs,variableIndex:0})}delete fs[bs]}if(us>0){let Cs=function(Ss){return typeof Ss=="string"&&Ss.substring(0,xs)===vs},Ts=function(Ss){return Array.isArray(Ss)?flattenDeep(Ss.slice(1)).some(Cs):Cs(Ss)},bs=rs.expressionWithCodes,vs=rs.codePre,xs=vs.length;if(vectorAndListOperators.includes(bs.tree[0])&&!bs.tree.slice(1).every(Ts)){let Ss=await ns.inverseMaps;for(let Ns in fs){let As=Ss[Ns];if(As.mathChildInd!==void 0)continue;let ws=As.components;bs=bs.substitute_component(ws,fs[Ns])}hs.push({setDependency:"expressionWithCodes",desiredValue:bs})}}return{success:!0,instructions:hs}}async function getExpressionPieces({expression:as,stateValues:rs}){let ns=await rs.template,ss=Context.utils.match(as.tree,ns);if(!ss&&(ss=Context.utils.match(as.tuples_to_vectors().tree,Context.fromAst(ns).tuples_to_vectors().tree),!ss&&(ss=Context.utils.match(as.to_intervals().tree,Context.fromAst(ns).to_intervals().tree),!ss&&(ss=Context.utils.match(as.tuples_to_vectors().to_intervals().tree,Context.fromAst(ns).tuples_to_vectors().to_intervals().tree),!ss))))return!1;let os={};for(let ls in ss){let us={};us[await rs.codeForExpression]=ss[ls];let cs=(await rs.inverseMaps)[ls];if(cs!==void 0){let ds=ls;cs.mathChildInd!==void 0&&(ds=cs.mathChildInd),os[ds]=cs.result.substitute(us),os[ds]=normalizeMathExpression({value:os[ds],simplify:await rs.simplify,expand:await rs.expand,createVectors:await rs.createVectors,createIntervals:await rs.createIntervals})}}return os}var Vu;let Label$1=(Vu=class extends InlineComponent{constructor(rs){super(rs),Object.assign(this.actions,{moveLabel:this.moveLabel.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.forObject={createTargetComponentNames:!0},rs.draggable={createComponentOfType:"boolean",createStateVariable:"draggable",defaultValue:!0,public:!0,forRenderer:!0},rs.layer={createComponentOfType:"number",createStateVariable:"layer",defaultValue:0,public:!0,forRenderer:!0},rs.anchor={createComponentOfType:"point"},rs.positionFromAnchor={createComponentOfType:"text",createStateVariable:"positionFromAnchor",defaultValue:"center",public:!0,forRenderer:!0,toLowerCase:!0,validValues:["upperright","upperleft","lowerright","lowerleft","top","bottom","left","right","center"]},rs.styleNumber.defaultValue=0,rs}static returnChildGroups(){return[{group:"inlines",componentTypes:["_inline"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions(),ns=returnSelectedStyleStateVariableDefinition();return Object.assign(rs,ns),rs.valueShadow={hasEssential:!0,defaultValue:null,returnDependencies:()=>({}),definition(){return{useEssentialOrDefaultValue:{valueShadow:!0}}},inverseDefinition({desiredStateVariableValues:ss}){return{success:!0,instructions:[{setEssentialValue:"valueShadow",value:ss.valueShadow}]}}},rs.hasLatex={public:!0,forRenderer:!0,shadowingInstructions:{createComponentOfType:"boolean"},returnDependencies:()=>({inlineChildren:{dependencyType:"child",childGroups:["inlines"],variableNames:["text","latex","value","hasLatex","renderAsMath"],variablesOptional:!0},valueShadow:{dependencyType:"stateVariable",variableName:"valueShadow"}}),definition:function({dependencyValues:ss}){if(ss.inlineChildren.length===0&&ss.valueShadow!==null){let ls=ss.valueShadow;return{setValue:{hasLatex:!!/\\\(.*\\\)/.exec(ls)}}}let os=!1;for(let ls of ss.inlineChildren)if(typeof ls=="object"){if(typeof ls.stateValues.hasLatex=="boolean"&&typeof ls.stateValues.value=="string"&&typeof ls.stateValues.text=="string"){if(ls.stateValues.hasLatex)return{setValue:{hasLatex:!0}}}else if(typeof ls.stateValues.renderAsMath=="boolean"&&typeof ls.stateValues.latex=="string"&&typeof ls.stateValues.text=="string"){if(ls.stateValues.renderAsMath)return{setValue:{hasLatex:!0}}}else if(typeof ls.stateValues.latex=="string")return{setValue:{hasLatex:!0}}}return{setValue:{hasLatex:os}}}},rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},additionalStateVariablesDefined:[{variableName:"latex",public:!0,shadowingInstructions:{createComponentOfType:"text"}},{variableName:"value",public:!0,forRenderer:!0,shadowingInstructions:{createComponentOfType:"label",addStateVariablesShadowingStateVariables:{hasLatex:{stateVariableToShadow:"hasLatex"}}}}],returnDependencies:()=>({inlineChildren:{dependencyType:"child",childGroups:["inlines"],variableNames:["text","latex","value","hasLatex","renderAsMath"],variablesOptional:!0},valueShadow:{dependencyType:"stateVariable",variableName:"valueShadow"},hasLatex:{dependencyType:"stateVariable",variableName:"hasLatex"}}),definition:function({dependencyValues:ss}){if(ss.inlineChildren.length===0&&ss.valueShadow!==null){let us=ss.valueShadow,cs=us;return ss.hasLatex&&(cs=cs.replace(/\\\(/g,""),cs=cs.replace(/\\\)/g,"")),{setValue:{text:cs,latex:cs,value:us}}}let os="",ls="";for(let us of ss.inlineChildren)if(typeof us!="object"){let cs=us.toString();os+=cs,ls+=cs}else typeof us.stateValues.hasLatex=="boolean"&&typeof us.stateValues.value=="string"&&typeof us.stateValues.text=="string"?(os+=us.stateValues.text,ls+=us.stateValues.value):typeof us.stateValues.renderAsMath=="boolean"&&typeof us.stateValues.latex=="string"&&typeof us.stateValues.text=="string"?us.stateValues.renderAsMath?(os+=us.stateValues.latex,ls+="\\("+us.stateValues.latex+"\\)"):(os+=us.stateValues.text,ls+=us.stateValues.text):typeof us.stateValues.latex=="string"?(os+=us.stateValues.latex,ls+="\\("+us.stateValues.latex+"\\)"):typeof us.stateValues.text=="string"&&(os+=us.stateValues.text,ls+=us.stateValues.text);return{setValue:{text:os,latex:os,value:ls}}},inverseDefinition:function({desiredStateVariableValues:ss,dependencyValues:os}){let ls;if(typeof ss.value=="string")ls=ss.value;else if(typeof ss.text=="string")ls=ss.text;else if(typeof ss.latex=="string")ls=ss.latex;else return{success:!1};if(os.inlineChildren.length===0&&os.valueShadow!==null)return{success:!0,instructions:[{setDependency:"valueShadow",desiredValue:ls}]};if(os.inlineChildren.length===1){let us=os.inlineChildren[0],cs=ss.value;if(typeof us!="object")return{success:!0,instructions:[{setDependency:"inlineChildren",desiredValue:cs,childIndex:0}]};if(typeof us.stateValues.hasLatex=="boolean"&&typeof us.stateValues.value=="string"&&typeof us.stateValues.text=="string")return{success:!0,instructions:[{setDependency:"inlineChildren",desiredValue:cs,childIndex:0,variableIndex:2}]};if(typeof us.stateValues.renderAsMath=="boolean"&&typeof us.stateValues.latex=="string"&&typeof us.stateValues.text=="string")if(us.stateValues.renderAsMath){let ds=cs.match(/^\\\((.*)\\\)/);return ds&&(cs=ds[1]),{success:!0,instructions:[{setDependency:"inlineChildren",desiredValue:cs,childIndex:0,variableIndex:1}]}}else return{success:!0,instructions:[{setDependency:"inlineChildren",desiredValue:cs,childIndex:0,variableIndex:0}]};else if(typeof us.stateValues.latex=="string"){let ds=cs.match(/^\\\((.*)\\\)/);return ds&&(cs=ds[1]),{success:!0,instructions:[{setDependency:"inlineChildren",desiredValue:cs,childIndex:0,variableIndex:1}]}}else return typeof us.stateValues.text=="string"?{success:!0,instructions:[{setDependency:"inlineChildren",desiredValue:cs,childIndex:0,variableIndex:0}]}:{success:!1}}else return{success:!1}}},rs.forObjectComponentName={returnDependencies:()=>({forObject:{dependencyType:"attributeTargetComponentNames",attributeName:"forObject"}}),definition({dependencyValues:ss}){var ls;let os;return((ls=ss.forObject)==null?void 0:ls.length)===1?os=ss.forObject[0].absoluteName:os=null,{setValue:{forObjectComponentName:os}}}},rs.anchor={defaultValue:Context.fromText("(0,0)"),public:!0,forRenderer:!0,hasEssential:!0,shadowingInstructions:{createComponentOfType:"point"},returnDependencies:()=>({anchorAttr:{dependencyType:"attributeComponent",attributeName:"anchor",variableNames:["coords"]}}),definition({dependencyValues:ss}){return ss.anchorAttr?{setValue:{anchor:ss.anchorAttr.stateValues.coords}}:{useEssentialOrDefaultValue:{anchor:!0}}},async inverseDefinition({desiredStateVariableValues:ss,dependencyValues:os,stateValues:ls,initialChange:us}){return us&&!await ls.draggable?{success:!1}:os.anchorAttr?{success:!0,instructions:[{setDependency:"anchorAttr",desiredValue:ss.anchor,variableIndex:0}]}:{success:!0,instructions:[{setEssentialValue:"anchor",value:ss.anchor}]}}},rs}async moveLabel({x:rs,y:ns,z:ss,transient:os,actionId:ls,sourceInformation:us={},skipRendererUpdate:cs=!1}){let ds=["vector"];return rs!==void 0&&(ds[1]=rs),ns!==void 0&&(ds[2]=ns),ss!==void 0&&(ds[3]=ss),os?await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"anchor",value:Context.fromAst(ds)}],transient:os,actionId:ls,sourceInformation:us,skipRendererUpdate:cs}):await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"anchor",value:Context.fromAst(ds)}],actionId:ls,sourceInformation:us,skipRendererUpdate:cs,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{x:rs,y:ns,z:ss}}})}},zs(Vu,"componentType","label"),zs(Vu,"renderChildren",!0),zs(Vu,"rendererType","label"),zs(Vu,"includeBlankStringChildren",!0),zs(Vu,"primaryStateVariableForDefinition","valueShadow"),zs(Vu,"adapters",["text"]),Vu);function returnGroupIntoComponentTypeSeparatedBySpaces({componentType:as,forceComponentType:rs=!1}){return function({matchedChildren:ns,componentInfoObjects:ss}){let os=[],ls=[];function us(){var ds;let cs=!1;if(rs){if(ls.length===1){let ps=ls[0],fs=ps.componentType;fs==="copy"&&((ds=ps.attributes)!=null&&ds.createComponentOfType)&&(!ps.attributes.nComponents||ps.attributes.nComponents.primitive===1)&&(fs=ps.attributes.createComponentOfType.primitive),ss.isInheritedComponentType({inheritedComponentType:fs,baseComponentType:as})&&(os.push(ps),cs=!0)}}else ls.length===1&&typeof ls[0]!="string"&&(os.push(ls[0]),cs=!0);!cs&&ls.length>0&&os.push({componentType:as,children:ls}),ls=[]}for(let cs of ns)if(typeof cs!="string")ls.push(cs);else{let ds=cs.split(/\s+/),ps=ds[0];ps===""?us():ls.push(ps);for(let fs of ds.slice(1))us(),fs!==""&&ls.push(fs)}return us(),{success:!0,newChildren:os}}}function returnBreakStringsIntoComponentTypeBySpaces({componentType:as}){return function({matchedChildren:rs}){return{success:!0,newChildren:rs.reduce(function(ss,os){return typeof os=="string"?[...ss,...os.split(/\s+/).filter(ls=>ls).map(ls=>({componentType:as,children:[ls]}))]:[...ss,os]},[])}}}class MathList extends InlineComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.unordered={createComponentOfType:"boolean",createStateVariable:"unordered",defaultValue:!1,public:!0},rs.maximumNumber={createComponentOfType:"number",createStateVariable:"maximumNumber",defaultValue:null,public:!0},rs.mergeMathLists={createComponentOfType:"boolean"},rs.displayDigits={createComponentOfType:"integer"},rs.displayDecimals={createComponentOfType:"integer",createStateVariable:"displayDecimals",defaultValue:null,public:!0},rs.displaySmallAsZero={createComponentOfType:"number",createStateVariable:"displaySmallAsZero",valueForTrue:1e-14,valueForFalse:0,defaultValue:0,public:!0},rs.padZeros={createComponentOfType:"boolean",createStateVariable:"padZeros",defaultValue:!1,public:!0},rs}static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=returnGroupIntoComponentTypeSeparatedBySpaces({componentType:"math"}),ss=returnBreakStringsIntoComponentTypeBySpaces({componentType:"math"});return rs.push({replacementFunction:function({matchedChildren:os,isAttributeComponent:ls=!1,createdFromMacro:us=!1}){return ls&&!us?ns({matchedChildren:os}):ss({matchedChildren:os})}}),rs}static returnChildGroups(){return[{group:"maths",componentTypes:["math"]},{group:"mathLists",componentTypes:["mathList"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.overrideChildHide={returnDependencies:()=>({}),definition:()=>({setValue:{overrideChildHide:!0}})},rs.displayDigits={public:!0,shadowingInstructions:{createComponentOfType:"integer"},hasEssential:!0,defaultValue:10,returnDependencies:()=>({displayDigitsAttr:{dependencyType:"attributeComponent",attributeName:"displayDigits",variableNames:["value"]},displayDecimalsAttr:{dependencyType:"attributeComponent",attributeName:"displayDecimals",variableNames:["value"]}}),definition({dependencyValues:ns,usedDefault:ss}){if(ns.displayDigitsAttr!==null){let os=ss.displayDigitsAttr,ls=ns.displayDecimalsAttr===null||ss.displayDecimalsAttr;if(!(os||ls)){let us=ns.displayDigitsAttr.shadowDepth;ns.displayDecimalsAttr.shadowDepth({}),definition:()=>({useEssentialOrDefaultValue:{mathsShadow:!0}})},rs.mergeMathLists={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},returnDependencies:()=>({mergeMathListsAttr:{dependencyType:"attributeComponent",attributeName:"mergeMathLists",variableNames:["value"]},mathListChildren:{dependencyType:"child",childGroups:["mathLists"],skipComponentNames:!0},mathChildren:{dependencyType:"child",childGroups:["maths"],skipComponentNames:!0}}),definition({dependencyValues:ns}){var os;return{setValue:{mergeMathLists:((os=ns.mergeMathListsAttr)==null?void 0:os.stateValues.value)||ns.mathListChildren.length===0&&ns.mathChildren.length===1}}}},rs.nComponents={public:!0,shadowingInstructions:{createComponentOfType:"number"},stateVariablesDeterminingDependencies:["mergeMathLists"],additionalStateVariablesDefined:["childIndexByArrayKey"],returnDependencies({stateValues:ns}){let ss={maximumNumber:{dependencyType:"stateVariable",variableName:"maximumNumber"},mergeMathLists:{dependencyType:"stateVariable",variableName:"mergeMathLists"},mathsShadow:{dependencyType:"stateVariable",variableName:"mathsShadow"}};return ns.mergeMathLists?ss.mathAndMathListChildren={dependencyType:"child",childGroups:["maths","mathLists"],variableNames:["value","nComponents"],variablesOptional:!0}:(ss.mathListChildren={dependencyType:"child",childGroups:["mathLists"],variableNames:["nComponents"]},ss.mathAndMathListChildren={dependencyType:"child",childGroups:["maths","mathLists"],skipComponentNames:!0}),ss},definition:function({dependencyValues:ns,componentInfoObjects:ss}){let os=0,ls=[];if(ns.mathAndMathListChildren.length>0)if(ns.mergeMathLists)for(let[cs,ds]of ns.mathAndMathListChildren.entries())if(ss.isInheritedComponentType({inheritedComponentType:ds.componentType,baseComponentType:"mathList"})){for(let ps=0;psus&&(os=us,ls=ls.slice(0,us)),{setValue:{nComponents:os,childIndexByArrayKey:ls},checkForActualChange:{nComponents:!0}}}},rs.maths={public:!0,shadowingInstructions:{createComponentOfType:"math",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"]},isArray:!0,entryPrefixes:["math"],stateVariablesDeterminingDependencies:["mergeMathLists","childIndexByArrayKey"],returnArraySizeDependencies:()=>({nComponents:{dependencyType:"stateVariable",variableName:"nComponents"}}),returnArraySize({dependencyValues:ns}){return[ns.nComponents]},returnArrayDependenciesByKey({arrayKeys:ns,stateValues:ss}){let os={},ls={mergeMathLists:{dependencyType:"stateVariable",variableName:"mergeMathLists"},childIndexByArrayKey:{dependencyType:"stateVariable",variableName:"childIndexByArrayKey"},mathsShadow:{dependencyType:"stateVariable",variableName:"mathsShadow"}};for(let us of ns){let cs=[],ds="1";ss.childIndexByArrayKey[us]&&(cs=[ss.childIndexByArrayKey[us][0]],ds=ss.childIndexByArrayKey[us][1]+1),os[us]={mathAndMathListChildren:{dependencyType:"child",childGroups:["maths","mathLists"],variableNames:["value","math"+ds],variablesOptional:!0,childIndices:cs}}}return{globalDependencies:ls,dependenciesByKey:os}},arrayDefinitionByKey({globalDependencyValues:ns,dependencyValuesByKey:ss,arrayKeys:os}){let ls={};for(let us of os){let cs=ss[us].mathAndMathListChildren[0];if(cs)if(cs.stateValues.value!==void 0){let ds=cs.stateValues.value;if(ns.mergeMathLists&&Array.isArray(ds.tree)&&ds.tree[0]==="list"){let ps=ns.childIndexByArrayKey[us][1];ls[us]=ds.get_component(ps)}else ls[us]=ds}else{let ds=ns.childIndexByArrayKey[us][1]+1;ls[us]=cs.stateValues["math"+ds]}else ns.mathsShadow!==null&&(ls[us]=ns.mathsShadow[us])}return{setValue:{maths:ls}}},async inverseArrayDefinitionByKey({desiredStateVariableValues:ns,globalDependencyValues:ss,dependencyValuesByKey:os,dependencyNamesByKey:ls,stateValues:us,workspace:cs}){if(ss.mergeMathLists){let ps=[],fs=await us.childIndexByArrayKey,hs=[];for(let gs in ns.maths){if(!os[gs]||hs.includes(gs))continue;let ys;if(fs[gs][2]!==void 0){let vs=Number(gs)-fs[gs][1],xs=vs+fs[gs][2]-1;cs.desiredMaths||(cs.desiredMaths=[]);let Cs=["list"];for(let Ts=vs;Ts<=xs;Ts++)ns.maths[Ts]!==void 0?cs.desiredMaths[Ts]=convertValueToMathExpression(ns.maths[Ts]):cs.desiredMaths[Ts]===void 0&&(cs.desiredMaths[Ts]=(await us.maths)[Ts]),Cs.push(cs.desiredMaths[Ts].tree),hs.push(Ts.toString());ys=Context.fromAst(Cs)}else ys=ns.maths[gs];let bs=os[gs].mathAndMathListChildren[0];bs&&(bs.stateValues.value!==void 0?ps.push({setDependency:ls[gs].mathAndMathListChildren,desiredValue:ys,childIndex:0,variableIndex:0}):ps.push({setDependency:ls[gs].mathAndMathListChildren,desiredValue:ys,childIndex:0,variableIndex:1}))}return{success:!0,instructions:ps}}let ds=[];for(let ps in ns.maths){if(!os[ps])continue;let fs=os[ps].mathAndMathListChildren[0];fs&&(fs.stateValues.value!==void 0?ds.push({setDependency:ls[ps].mathAndMathListChildren,desiredValue:ns.maths[ps],childIndex:0,variableIndex:0}):ds.push({setDependency:ls[ps].mathAndMathListChildren,desiredValue:ns.maths[ps],childIndex:0,variableIndex:1}))}return{success:!0,instructions:ds}}},rs.math={public:!0,shadowingInstructions:{createComponentOfType:"math",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"]},returnDependencies:()=>({maths:{dependencyType:"stateVariable",variableName:"maths"}}),definition({dependencyValues:ns}){let ss;return ns.maths.length===0?ss=Context.fromAst("_"):ns.maths.length===1?ss=ns.maths[0]:ss=Context.fromAst(["list",...ns.maths.map(os=>os.tree)]),{setValue:{math:ss}}}},rs.nValues={isAlias:!0,targetVariableName:"nComponents"},rs.values={isAlias:!0,targetVariableName:"maths"},rs.latex={additionalStateVariablesDefined:["latexs"],public:!0,shadowingInstructions:{createComponentOfType:"text"},forRenderer:!0,returnDependencies:()=>({mathAndMathListChildren:{dependencyType:"child",childGroups:["maths","mathLists"],variableNames:["valueForDisplay","latex","latexs"],variablesOptional:!0},maximumNumber:{dependencyType:"stateVariable",variableName:"maximumNumber"},mergeMathLists:{dependencyType:"stateVariable",variableName:"mergeMathLists"},mathsShadow:{dependencyType:"stateVariable",variableName:"mathsShadow"},displayDigits:{dependencyType:"stateVariable",variableName:"displayDigits"},displayDecimals:{dependencyType:"stateVariable",variableName:"displayDecimals"},displaySmallAsZero:{dependencyType:"stateVariable",variableName:"displaySmallAsZero"},padZeros:{dependencyType:"stateVariable",variableName:"padZeros"}}),definition:function({dependencyValues:ns,usedDefault:ss}){let os=[],ls={};if(ns.padZeros&&(ss.displayDigits&&!ss.displayDecimals?Number.isFinite(ns.displayDecimals)&&(ls.padToDecimals=ns.displayDecimals):ns.displayDigits>=1&&(ls.padToDigits=ns.displayDigits)),ns.mathAndMathListChildren.length>0)for(let ds of ns.mathAndMathListChildren)if(ds.stateValues.valueForDisplay){let ps=ds.stateValues.valueForDisplay;if(ns.mergeMathLists&&Array.isArray(ps.tree)&&ps.tree[0]==="list")for(let fs=0;fsroundForDisplay({value:ds,dependencyValues:ns,usedDefault:ss}).toLatex(ls)));let us=ns.maximumNumber;return us!==null&&os.length>us&&(us=Math.max(0,Math.floor(us)),os=os.slice(0,us)),{setValue:{latex:os.join(", "),latexs:os}}}},rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},additionalStateVariablesDefined:["texts"],returnDependencies:()=>({mathAndMathListChildren:{dependencyType:"child",childGroups:["maths","mathLists"],variableNames:["valueForDisplay","text","texts"],variablesOptional:!0},maximumNumber:{dependencyType:"stateVariable",variableName:"maximumNumber"},mergeMathLists:{dependencyType:"stateVariable",variableName:"mergeMathLists"},mathsShadow:{dependencyType:"stateVariable",variableName:"mathsShadow"}}),definition:function({dependencyValues:ns}){let ss=[];if(ns.mathAndMathListChildren.length>0)for(let us of ns.mathAndMathListChildren)if(us.stateValues.valueForDisplay){let cs=us.stateValues.valueForDisplay;if(ns.mergeMathLists&&Array.isArray(cs.tree)&&cs.tree[0]==="list")for(let ds=0;dsus.toString()));let os=ns.maximumNumber;return os!==null&&ss.length>os&&(os=Math.max(0,Math.floor(os)),ss=ss.slice(0,os)),{setValue:{text:ss.join(", "),texts:ss}}}},rs.componentNamesInList={returnDependencies:()=>({mathAndMathListChildren:{dependencyType:"child",childGroups:["maths","mathLists"],variableNames:["componentNamesInList"],variablesOptional:!0},maximumNumber:{dependencyType:"stateVariable",variableName:"maximumNumber"}}),definition:function({dependencyValues:ns,componentInfoObjects:ss}){let os=[];for(let us of ns.mathAndMathListChildren)ss.isInheritedComponentType({inheritedComponentType:us.componentType,baseComponentType:"mathList"})?os.push(...us.stateValues.componentNamesInList):os.push(us.componentName);let ls=ns.maximumNumber;return ls!==null&&os.length>ls&&(ls=Math.max(0,Math.floor(ls)),os=os.slice(0,ls)),{setValue:{componentNamesInList:os}}}},rs.nComponentsToDisplayByChild={additionalStateVariablesDefined:["nChildrenToRender"],returnDependencies:()=>({nComponents:{dependencyType:"stateVariable",variableName:"nComponents"},mathListChildren:{dependencyType:"child",childGroups:["mathLists"],variableNames:["nComponents"]},mathAndMathListChildren:{dependencyType:"child",childGroups:["maths","mathLists"],skipComponentNames:!0},parentNComponentsToDisplayByChild:{dependencyType:"parentStateVariable",parentComponentType:"mathList",variableName:"nComponentsToDisplayByChild"}}),definition:function({dependencyValues:ns,componentInfoObjects:ss,componentName:os}){let ls=ns.nComponents;ns.parentNComponentsToDisplayByChild!==null&&(ls=ns.parentNComponentsToDisplayByChild[os]);let us={},cs=0,ds=0,ps=0;for(let fs of ns.mathAndMathListChildren){let hs=Math.max(0,ls-cs);if(hs>0&&ds++,ss.isInheritedComponentType({inheritedComponentType:fs.componentType,baseComponentType:"mathList"})){let gs=ns.mathListChildren[ps];ps++;let ys=Math.min(hs,gs.stateValues.nComponents);us[gs.componentName]=ys,cs+=ys}else cs+=1}return{setValue:{nComponentsToDisplayByChild:us,nChildrenToRender:ds}}},markStale:()=>({updateRenderedChildren:!0})},rs}}zs(MathList,"componentType","mathList"),zs(MathList,"renderChildren",!0),zs(MathList,"includeBlankStringChildren",!0),zs(MathList,"removeBlankStringChildrenPostSugar",!0),zs(MathList,"stateVariableForAttributeValue","maths"),zs(MathList,"primaryStateVariableForDefinition","mathsShadow"),zs(MathList,"descendantCompositesMustHaveAReplacement",!1),zs(MathList,"adapters",[{stateVariable:"math",stateVariablesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"]},"text"]);class Columns extends Text{}zs(Columns,"componentType","columns"),zs(Columns,"rendererType","text");class Title extends TextOrInline{}zs(Title,"componentType","title");class RightHandSide extends MathComponent{}zs(RightHandSide,"componentType","rightHandSide"),zs(RightHandSide,"rendererType","math");class Description extends TextOrInline{}zs(Description,"componentType","description"),zs(Description,"rendererType");class Else extends Template{}zs(Else,"componentType","else");class Xlabel extends Label$1{}zs(Xlabel,"componentType","xlabel"),zs(Xlabel,"rendererType","label");class Ylabel extends Label$1{}zs(Ylabel,"componentType","ylabel"),zs(Ylabel,"rendererType","label");class MatrixRow extends MathList{}zs(MatrixRow,"componentType","matrixRow"),zs(MatrixRow,"rendererType","mathList");class MatrixColumn extends MathList{}zs(MatrixColumn,"componentType","matrixColumn"),zs(MatrixColumn,"rendererType","mathList");const Aliases=Object.freeze(Object.defineProperty({__proto__:null,Columns,Description,Else,MatrixColumn,MatrixRow,RightHandSide,Title,Xlabel,Ylabel},Symbol.toStringTag,{value:"Module"}));var Mu;let M$3=(Mu=class extends InlineComponent{constructor(rs){super(rs),Object.assign(this.actions,{moveMath:this.moveMath.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.draggable={createComponentOfType:"boolean",createStateVariable:"draggable",defaultValue:!0,public:!0,forRenderer:!0},rs.layer={createComponentOfType:"number",createStateVariable:"layer",defaultValue:0,public:!0,forRenderer:!0},rs.anchor={createComponentOfType:"point"},rs.positionFromAnchor={createComponentOfType:"text",createStateVariable:"positionFromAnchor",defaultValue:"center",public:!0,forRenderer:!0,toLowerCase:!0,validValues:["upperright","upperleft","lowerright","lowerleft","top","bottom","left","right","center"]},rs.styleNumber.defaultValue=0,rs}static returnChildGroups(){return[{group:"inline",componentTypes:["_inline"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions(),ns=returnSelectedStyleStateVariableDefinition();return Object.assign(rs,ns),rs.latex={public:!0,shadowingInstructions:{createComponentOfType:"text"},defaultValue:"",hasEssential:!0,forRenderer:!0,returnDependencies:()=>({inlineChildren:{dependencyType:"child",childGroups:["inline"],variableNames:["latex","text"],variablesOptional:!0}}),definition:function({dependencyValues:ss}){if(ss.inlineChildren.length===0)return{useEssentialOrDefaultValue:{latex:!0}};let os="";for(let ls of ss.inlineChildren)typeof ls!="object"?os+=ls:typeof ls.stateValues.latex=="string"?os+=ls.stateValues.latex:typeof ls.stateValues.text=="string"&&(os+=ls.stateValues.text);return{setValue:{latex:os}}},inverseDefinition({desiredStateVariableValues:ss,dependencyValues:os}){if(typeof ss.latex!="string")return{success:!1};if(os.inlineChildren.length===0)return{success:!0,instructions:[{setEssentialValue:"latex",value:ss.latex}]};if(os.inlineChildren.length===1){let ls=os.inlineChildren[0];return typeof ls!="object"?{success:!0,instructions:[{setDependency:"inlineChildren",desiredValue:ss.latex,childIndex:0}]}:typeof ls.stateValues.latex=="string"?{success:!0,instructions:[{setDependency:"inlineChildren",desiredValue:ss.latex,childIndex:0,variableIndex:0}]}:typeof ls.stateValues.text=="string"?{success:!0,instructions:[{setDependency:"inlineChildren",desiredValue:ss.latex,childIndex:0,variableIndex:1}]}:{success:!1}}else return{success:!1}}},rs.latexWithInputChildren={forRenderer:!0,returnDependencies:()=>({inlineChildren:{dependencyType:"child",childGroups:["inline"],variableNames:["latex","text"],variablesOptional:!0},latex:{dependencyType:"stateVariable",variableName:"latex"}}),definition:function({dependencyValues:ss,componentInfoObjects:os}){if(ss.inlineChildren.length===0)return{setValue:{latexWithInputChildren:[ss.latex]}};let ls=[],us="",cs=0;for(let ds of ss.inlineChildren)typeof ds!="object"?us+=ds:os.isInheritedComponentType({inheritedComponentType:ds.componentType,baseComponentType:"input"})?(us.length>0&&(ls.push(us),us=""),ls.push(cs),cs++):typeof ds.stateValues.latex=="string"?us+=ds.stateValues.latex:typeof ds.stateValues.text=="string"&&(us+=ds.stateValues.text);return us.length>0&&ls.push(us),{setValue:{latexWithInputChildren:ls}}}},rs.renderMode={forRenderer:!0,returnDependencies:()=>({}),definition:()=>({setValue:{renderMode:"inline"}})},rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({latex:{dependencyType:"stateVariable",variableName:"latex"}}),definition:function({dependencyValues:ss}){let os;try{os=Context.fromAst(latexToAst.convert(ss.latex))}catch{return{setValue:{text:ss.latex}}}return{setValue:{text:superSubscriptsToUnicode(os.toString())}}}},rs.anchor={defaultValue:Context.fromText("(0,0)"),public:!0,forRenderer:!0,hasEssential:!0,shadowingInstructions:{createComponentOfType:"point"},returnDependencies:()=>({anchorAttr:{dependencyType:"attributeComponent",attributeName:"anchor",variableNames:["coords"]}}),definition({dependencyValues:ss}){return ss.anchorAttr?{setValue:{anchor:ss.anchorAttr.stateValues.coords}}:{useEssentialOrDefaultValue:{anchor:!0}}},async inverseDefinition({desiredStateVariableValues:ss,dependencyValues:os,stateValues:ls,initialChange:us}){return us&&!await ls.draggable?{success:!1}:os.anchorAttr?{success:!0,instructions:[{setDependency:"anchorAttr",desiredValue:ss.anchor,variableIndex:0}]}:{success:!0,instructions:[{setEssentialValue:"anchor",value:ss.anchor}]}}},rs}async moveMath({x:rs,y:ns,z:ss,transient:os,actionId:ls,sourceInformation:us={},skipRendererUpdate:cs=!1}){let ds=["vector"];return rs!==void 0&&(ds[1]=rs),ns!==void 0&&(ds[2]=ns),ss!==void 0&&(ds[3]=ss),os?await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"anchor",value:Context.fromAst(ds)}],transient:os,actionId:ls,sourceInformation:us,skipRendererUpdate:cs}):await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"anchor",value:Context.fromAst(ds)}],actionId:ls,sourceInformation:us,skipRendererUpdate:cs,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{x:rs,y:ns,z:ss}}})}},zs(Mu,"componentType","m"),zs(Mu,"rendererType","math"),zs(Mu,"includeBlankStringChildren",!0),zs(Mu,"primaryStateVariableForDefinition","latex"),Mu);var cp;let Me$2=(cp=class extends M$3{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.renderMode.definition=()=>({setValue:{renderMode:"display"}}),rs}},zs(cp,"componentType","me"),cp);class Men extends M$3{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.renderMode.definition=()=>({setValue:{renderMode:"numbered"}}),rs.equationTag={public:!0,shadowingInstructions:{createComponentOfType:"text"},forRenderer:!0,returnDependencies:()=>({equationCounter:{dependencyType:"counter",counterName:"equation"}}),definition({dependencyValues:ns}){return{setValue:{equationTag:String(ns.equationCounter)}}}},rs}}zs(Men,"componentType","men");const MMeMen=Object.freeze(Object.defineProperty({__proto__:null,M:M$3,Me:Me$2,Men},Symbol.toStringTag,{value:"Module"}));class Md extends InlineComponent{constructor(rs){super(rs),Object.assign(this.actions,{moveMath:this.moveMath.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.draggable={createComponentOfType:"boolean",createStateVariable:"draggable",defaultValue:!0,public:!0,forRenderer:!0},rs.layer={createComponentOfType:"number",createStateVariable:"layer",defaultValue:0,public:!0,forRenderer:!0},rs.anchor={createComponentOfType:"point"},rs.positionFromAnchor={createComponentOfType:"text",createStateVariable:"positionFromAnchor",defaultValue:"center",public:!0,forRenderer:!0,toLowerCase:!0,validValues:["upperright","upperleft","lowerright","lowerleft","top","bottom","left","right","center"]},rs.styleNumber.defaultValue=0,rs}static returnChildGroups(){return[{group:"mrows",componentTypes:["mrow"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions(),ns=returnSelectedStyleStateVariableDefinition();return Object.assign(rs,ns),rs.mrowChildNames={forRenderer:!0,returnDependencies:()=>({mrowChildren:{dependencyType:"child",childGroups:["mrows"]}}),definition:({dependencyValues:ss})=>({setValue:{mrowChildNames:ss.mrowChildren.map(os=>os.componentName)}})},rs.latex={public:!0,shadowingInstructions:{createComponentOfType:"text"},defaultValue:"",hasEssential:!0,shadowVariable:!0,forRenderer:!0,returnDependencies:()=>({mrowChildren:{dependencyType:"child",childGroups:["mrows"],variableNames:["latex","hide","equationTag","numbered"]}}),definition:function({dependencyValues:ss}){if(ss.mrowChildren.length>0){let os="";for(let ls of ss.mrowChildren)ls.stateValues.hide||(os.length>0&&(os+="\\\\"),ls.stateValues.numbered?os+=`\\tag{${ls.stateValues.equationTag}}`:os+="\\notag ",os+=ls.stateValues.latex);return{setValue:{latex:os}}}else return{useEssentialOrDefaultValue:{latex:!0}}}},rs.latexWithInputChildren={forRenderer:!0,returnDependencies:()=>({mrowChildren:{dependencyType:"child",childGroups:["mrows"],variableNames:["latexWithInputChildren","hide","equationTag","numbered"]},latex:{dependencyType:"stateVariable",variableName:"latex"}}),definition:function({dependencyValues:ss}){if(ss.mrowChildren.length>0){let os=[],ls=0,us="";for(let cs of ss.mrowChildren)if(!cs.stateValues.hide){us.length>0&&(us+="\\\\"),cs.stateValues.numbered?us+=`\\tag{${cs.stateValues.equationTag}}`:us+="\\notag ";for(let ds of cs.stateValues.latexWithInputChildren)typeof ds=="number"?(us.length>0&&(os.push(us),us=""),os.push(ls),ls++):us+=ds}return us.length>0&&os.push(us),{setValue:{latexWithInputChildren:os}}}else return{setValue:{latexWithInputChildren:[ss.latex]}}}},rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({latex:{dependencyType:"stateVariable",variableName:"latex"}}),definition:function({dependencyValues:ss}){let os;try{os=ss.latex.replaceAll("\\notag","").replaceAll("\\amp","").split("\\\\").map(ls=>Context.fromAst(latexToAst.convert(ls)).toString()).join(`\\\\ `)}catch{return{setValue:{text:ss.latex}}}return{setValue:{text:superSubscriptsToUnicode(os.toString())}}}},rs.renderMode={forRenderer:!0,returnDependencies:()=>({}),definition:()=>({setValue:{renderMode:"align"}})},rs.numbered={returnDependencies:()=>({}),definition:()=>({setValue:{numbered:!1}})},rs.anchor={defaultValue:Context.fromText("(0,0)"),public:!0,forRenderer:!0,hasEssential:!0,shadowingInstructions:{createComponentOfType:"point"},returnDependencies:()=>({anchorAttr:{dependencyType:"attributeComponent",attributeName:"anchor",variableNames:["coords"]}}),definition({dependencyValues:ss}){return ss.anchorAttr?{setValue:{anchor:ss.anchorAttr.stateValues.coords}}:{useEssentialOrDefaultValue:{anchor:!0}}},async inverseDefinition({desiredStateVariableValues:ss,dependencyValues:os,stateValues:ls,initialChange:us}){return us&&!await ls.draggable?{success:!1}:os.anchorAttr?{success:!0,instructions:[{setDependency:"anchorAttr",desiredValue:ss.anchor,variableIndex:0}]}:{success:!0,instructions:[{setEssentialValue:"anchor",value:ss.anchor}]}}},rs}async moveMath({x:rs,y:ns,z:ss,transient:os,actionId:ls,sourceInformation:us={},skipRendererUpdate:cs=!1}){let ds=["vector"];return rs!==void 0&&(ds[1]=rs),ns!==void 0&&(ds[2]=ns),ss!==void 0&&(ds[3]=ss),os?await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"anchor",value:Context.fromAst(ds)}],transient:os,actionId:ls,sourceInformation:us,skipRendererUpdate:cs}):await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"anchor",value:Context.fromAst(ds)}],actionId:ls,sourceInformation:us,skipRendererUpdate:cs,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{x:rs,y:ns,z:ss}}})}}zs(Md,"componentType","md"),zs(Md,"rendererType","math"),zs(Md,"primaryStateVariableForDefinition","latex");class Mdn extends Md{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.numbered={returnDependencies:()=>({}),definition:()=>({setValue:{numbered:!0}})},rs}}zs(Mdn,"componentType","mdn");class Mrow extends M$3{static createAttributesObject(){let rs=super.createAttributesObject();return rs.number={createComponentOfType:"boolean"},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.renderMode.definition=()=>({setValue:{renderMode:"display"}}),rs.numbered={forRenderer:!0,returnDependencies:()=>({parentNumbered:{dependencyType:"parentStateVariable",variableName:"numbered"},numberAttr:{dependencyType:"attributeComponent",attributeName:"number",variableNames:["value"]}}),definition({dependencyValues:ns}){let ss;return ns.numberAttr!==null?ss=ns.numberAttr.stateValues.value:ss=ns.parentNumbered,{setValue:{numbered:ss}}}},rs.equationTag={public:!0,shadowingInstructions:{createComponentOfType:"text"},forRenderer:!0,stateVariablesDeterminingDependencies:["numbered"],returnDependencies({stateValues:ns}){return ns.numbered?{equationCounter:{dependencyType:"counter",counterName:"equation"}}:{}},definition({dependencyValues:ns}){return ns.equationCounter!==void 0?{setValue:{equationTag:String(ns.equationCounter)}}:{setValue:{equationTag:null}}}},rs}}zs(Mrow,"componentType","mrow");const MdMdnMrow=Object.freeze(Object.defineProperty({__proto__:null,Md,Mdn,Mrow},Symbol.toStringTag,{value:"Module"}));function periodicSetEquality(as,rs,{min_elements_match:ns=3,match_partial:ss=!1}={}){if(!is_periodic_set(as))return!1;if(is_periodic_set(rs))if(ss){let os=contained_in(as.tree,rs.tree,ss);if(os===!1)return 0;let ls=contained_in(rs.tree,as.tree,ss);return ls===!1?0:os===!0?ls===!0?1:ls:ls===!0?os:Math.min(os,ls)}else return contained_in(as.tree,rs.tree,ss)&&contained_in(rs.tree,as.tree,ss);else{let os=as.tree.slice(1);if(os.length>1)return!1;let ls=Context.fromAst(os[0][1]).evaluate_to_constant(),us=Context.fromAst(["apply","abs",os[0][2]]).evaluate_to_constant();if(!Number.isFinite(ls)||!Number.isFinite(us))return!1;let cs=os[0][3],ds=os[0][4];if(cs!==-1/0||ds!==1/0||rs.tree[0]!=="list")return!1;let ps=rs.tree.slice(1),fs=0;if(ps[0][0]==="ldots")fs++,ps=ps.slice(1);else if(!ss)return!1;if(ps[ps.length-1][0]==="ldots")fs++,ps=ps.slice(0,ps.length-1);else if(!ss)return!1;let hs=ps.length;if(hs===0||!ss&&hsContext.fromAst(vs).evaluate_to_constant());let gs=Context.math.mod(ps[0]-ls,us);if(!(Context.math.min(gs,us-gs)<1e-10*us))return!1;let ys=1;for(let vs=1;vs=ns)return!0;let bs=ys/Math.max(hs,ns);return bs*=(9+fs/2)/10,bs}}function is_periodic_set(as){var rs=as.tree;if(!Array.isArray(rs)||rs[0]!=="periodic_set")return!1;var ns=rs.slice(1);for(var ss of ns)if(!Array.isArray(ss)||ss[0]!=="tuple"||ss.length!==5)return!1;return!0}function contained_in(as,rs,ns){if(as[0]==="periodic_set")if(ns){let hs=0;for(let ys of as.slice(1)){let bs=contained_in(ys,rs,ns);bs===!0?hs++:bs!==!1&&(hs+=bs)}let gs=as.length-1;return hs===gs?!0:hs===0?!1:hs/gs}else return as.slice(1).every(hs=>contained_in(hs,rs));var ss=as[1],os=as[2],ls=as[3],us=as[4];if(ls!==-1/0||us!==1/0)return!1;ss=Context.fromAst(["/",ss,os]).evaluate_to_constant();var cs=rs.slice(1),ds=[];for(let hs=0;hs1e3)return!1;let Ts=xs.d;ds.push([Cs,Ts,bs,vs])}for(ds.sort();ds[0][0]===1;){let gs=ds[0][2],ys=ds[0][3],bs=Context.fromAst(["+",gs,["-",ss]]).evaluate_to_constant();if(Number.isFinite(bs)&&Number.isFinite(ys)&&(bs=Context.math.mod(bs,ys),Context.math.min(bs,ys-bs)<1e-10*ys))return!0;if(ds.splice(0,1),ds.length===0)return!1}var ps=[...new Set(ds.map(hs=>hs[0]))];let fs=0;for(let hs of ps){let gs=ds.map(function(bs,vs){let xs=hs/bs[0];if(Number.isInteger(xs))return[bs[0],xs,vs]}).filter(bs=>bs),ys=[];for(let bs of gs){let vs=bs[0],xs=bs[1],Cs=bs[2],Ts=ds[Cs][2],Ss=ds[Cs][3];for(let Ns=0;Nsfs&&(fs=bs)}}return ns&&fs>0?fs:!1}const nonTupleVectorOperators=["vector","altvector"];function checkEquality({object1:as,object2:rs,isUnordered:ns=!1,partialMatches:ss=!1,matchByExactPositions:os=!1,symbolicEquality:ls=!1,simplify:us="none",expand:cs=!1,allowedErrorInNumbers:ds=0,includeErrorInNumberExponents:ps=!1,allowedErrorIsAbsolute:fs=!1,nSignErrorsMatched:hs=0,nPeriodicSetMatchesRequired:gs=3,caseInsensitiveMatch:ys=!1,matchBlanks:bs=!1}){let vs=!1;if(as instanceof Context.class){if(vs=!0,!(rs instanceof Context.class))if(typeof rs=="number"||typeof rs=="string")rs=Context.fromAst(rs);else return{fraction_equal:0}}else if(rs instanceof Context.class)if(vs=!0,typeof as=="number"||typeof as=="string")as=Context.fromAst(as);else return{fraction_equal:0};let xs=function($s,Rs=!1){$s instanceof Context.class||($s=Context.fromAst($s)),$s=$s.normalize_function_names().normalize_applied_functions(),ys&&($s=Context.fromAst(setStringsInTreeToLowerCase($s.tree)));let Is=us,Os=cs;return Rs&&(Is="full",Os=!0),Is==="none"?ds>0&&($s=$s.constants_to_floats()):Is==="numberspreserveorder"?$s=$s.evaluate_numbers({max_digits:1/0,skip_ordering:!0}):Is==="number"?$s=$s.evaluate_numbers({max_digits:1/0}):$s=$s.evaluate_numbers({max_digits:1/0,evaluate_functions:!0}),normalizeMathExpression({value:$s,simplify:Is,expand:Os})},Cs;vs?ls?Cs=function($s,Rs){let Is=$s,Os=Rs;if($s instanceof Context.class||(Is=Context.fromAst($s)),Rs instanceof Context.class||(Os=Context.fromAst(Rs)),hs>0){Os=JSON.parse(JSON.stringify(Os),Context.reviver);let Ds=function(ks,Ps){return ks.variables().includes("_")||Ps.variables().includes("_")?!1:(ks=xs(ks),ks.equalsViaSyntax(Ps,{allowed_error_in_numbers:ds,include_error_in_number_exponents:ps,allowed_error_is_absolute:fs,allow_blanks:bs}))};return Is.tree.im||Os.tree.im?{fraction_equal:0}:{fraction_equal:Context.equalSpecifiedSignErrors(Os,Is,{equalityFunction:Ds,n_sign_errors:hs})?1:0}}else return Is.variables().includes("_")||Os.variables().includes("_")?{fraction_equal:0}:Is.tree.im||Os.tree.im?{fraction_equal:0}:{fraction_equal:Is.equalsViaSyntax(Os,{allowed_error_in_numbers:ds,include_error_in_number_exponents:ps,allowed_error_is_absolute:fs,allow_blanks:bs})?1:0}}:Cs=function($s,Rs){let Is=$s,Os=Rs;if($s instanceof Context.class||(Is=Context.fromAst($s)),Rs instanceof Context.class||(Os=Context.fromAst(Rs)),ys&&(Is=Context.fromAst(setStringsInTreeToLowerCase(Is.tree)),Os=Context.fromAst(setStringsInTreeToLowerCase(Os.tree))),hs>0){Os=JSON.parse(JSON.stringify(Os),Context.reviver);let Ds=function(ks,Ps){return ks.equals(Ps,{allowed_error_in_numbers:ds,include_error_in_number_exponents:ps,allowed_error_is_absolute:fs,allow_blanks:bs})};return Is.tree.im||Os.tree.im?{fraction_equal:0}:{fraction_equal:Context.equalSpecifiedSignErrors(Os,Is,{equalityFunction:Ds,n_sign_errors:hs})?1:0}}else return Is.tree.im||Os.tree.im?{fraction_equal:0}:{fraction_equal:Is.equals(Os,{allowed_error_in_numbers:ds,include_error_in_number_exponents:ps,allowed_error_is_absolute:fs,allow_blanks:bs})?1:0}}:Cs=($s,Rs)=>(ys&&($s=convertStringsToLowerCase($s),Rs=convertStringsToLowerCase(Rs)),{fraction_equal:deepCompare($s,Rs)?1:0});let Ts=!1,Ss=!1;if(vs){as=xs(as,!ls),rs=xs(rs,!ls);let $s=as.tree[0],Rs=rs.tree[0];if($s==="periodic_set"||Rs==="periodic_set"){let Is=as,Os=rs;$s!=="periodic_set"&&(Is=rs,Os=as);let Ds=periodicSetEquality(Is,Os,{match_partial:ss,min_elements_match:gs});return Ds===!0?{fraction_equal:1}:Ds===!1?{fraction_equal:0}:{fraction_equal:Ds}}else if($s==="list")as=as.tree.slice(1),Rs==="list"?rs=rs.tree.slice(1):rs=[rs.tree];else if(Rs==="list")rs=rs.tree.slice(1),as=[as.tree];else if(nonTupleVectorOperators.includes($s)){if(as=as.tree.slice(1),Rs==="interval"||Rs==="matrix"||Rs==="array"||Rs==="set")return{fraction_equal:0};vectorOperators.includes(Rs)?rs=rs.tree.slice(1):rs=[rs.tree]}else if(nonTupleVectorOperators.includes(Rs)){if(rs=rs.tree.slice(1),$s==="interval"||$s==="matrix"||$s==="array"||$s==="set")return{fraction_equal:0};$s==="tuple"?as=as.tree.slice(1):as=[as.tree]}else if($s==="interval"){os=!0;let Is=as.tree[2],Os=Is[1],Ds=Is[2];if(as=as.tree[1].slice(1),Rs==="matrix"||Rs==="set")return{fraction_equal:0};if(Rs==="tuple"){let Vs=rs.tree.slice(1);if(Vs.length===2&&Os===!1&&Ds===!1)rs=Vs;else return{fraction_equal:0}}else if(Rs==="array"){let Vs=rs.tree.slice(1);if(Vs.length===2&&Os===!0&&Ds===!0)rs=Vs;else return{fraction_equal:0}}else if(Rs==="interval"){let Vs=rs.tree[2];if(Vs[1]!==Os||Vs[2]!==Ds)return{fraction_equal:0};rs=rs.tree[1].slice(1)}else return{fraction_equal:0}}else if(Rs==="interval"){os=!0;let Is=rs.tree[2],Os=Is[1],Ds=Is[2];if(rs=rs.tree[1].slice(1),$s==="matrix"||$s==="set")return{fraction_equal:0};if($s==="tuple"){let Vs=as.tree.slice(1);if(Vs.length===2&&Os===!1&&Ds===!1)as=Vs;else return{fraction_equal:0}}else if($s==="array"){let Vs=as.tree.slice(1);if(Vs.length===2&&Os===!0&&Ds===!0)as=Vs;else return{fraction_equal:0}}else return{fraction_equal:0}}else if($s==="matrix")if(Rs==="matrix")as=convertMatrixToArrayOfTuples(as.tree.slice(1)),rs=convertMatrixToArrayOfTuples(rs.tree.slice(1)),os=!0,Ss=!0,Ts=!0;else return{fraction_equal:0};else{if(Rs==="matrix")return{fraction_equal:0};if($s==="set"){let Is=[];for(let Os of as.tree.slice(1))Is.some(Ds=>Cs(Ds,Os).fraction_equal===1)||Is.push(Os);if(as=Is,ns=!0,Rs==="tuple"||Rs==="array")return{fraction_equal:0};if(Rs==="set"){Is=[];for(let Os of rs.tree.slice(1))Is.some(Ds=>Cs(Ds,Os).fraction_equal===1)||Is.push(Os);rs=Is}else rs=[rs.tree]}else if(Rs==="set"){let Is=[];for(let Os of rs.tree.slice(1))Is.some(Ds=>Cs(Ds,Os).fraction_equal===1)||Is.push(Os);if(rs=Is,ns=!0,$s==="tuple"||$s==="array")return{fraction_equal:0};as=[as.tree]}else if($s==="tuple"){if(as=as.tree.slice(1),Rs==="array")return{fraction_equal:0};Rs==="tuple"?rs=rs.tree.slice(1):rs=[rs.tree]}else if(Rs==="tuple"){if(rs=rs.tree.slice(1),$s==="array")return{fraction_equal:0};as=[as.tree]}else if($s==="array")as=as.tree.slice(1),Rs==="array"?rs=rs.tree.slice(1):rs=[rs.tree];else if(Rs==="array")rs=rs.tree.slice(1),as=[as.tree];else return Cs(as.tree,rs.tree)}}else if(Array.isArray(as))Array.isArray(rs)||(typeof rs=="string"&&as.every($s=>typeof $s=="string"&&!$s.includes(","))?rs=rs.split(",").map($s=>$s.trim()):rs=[rs]);else if(Array.isArray(rs))typeof as=="string"&&rs.every($s=>typeof $s=="string"&&!$s.includes(","))?as=as.split(",").map($s=>$s.trim()):as=[as];else return Cs(as,rs);let Ns=as.length,As=rs.length,ws={fraction_equal:0};if(os&&(ns=!1),!ns){let $s=0,Rs=Math.min(Ns,As);for(let Ds=0;DsArray(As+1).fill(0));for(let Ds=0;DsIs&&(Is=Vs.fraction_equal,Rs=Os)}Rs!==-1&&(_s+=Is,Es.add(Rs))}return Ns===As&&Ns===_s?(ws.fraction_equal=1,ws):(ss&&(ws.fraction_equal=_s/Math.max(Ns,As)),ws)}function setStringsInTreeToLowerCase(as){return typeof as=="string"?as.toLowerCase():Array.isArray(as)?[as[0],...as.slice(1).map(setStringsInTreeToLowerCase)]:as}function convertStringsToLowerCase(as){return typeof as=="string"?as.toLowerCase():Array.isArray(as)?as.map(convertStringsToLowerCase):as}function convertMatrixToArrayOfTuples(as){let rs=as[0][1],ns=as[0][2];if(!(Number.isInteger(rs)&&Number.isInteger(ns)))return as;let ss=[];for(let os=0;osevaluateLogic({logicTree:Ts,canOverrideUnorderedCompare:rs,dependencyValues:ns,valueOnInvalid:ss});if(!Array.isArray(as)){if(typeof as=="string"){let Ts=ns.booleanChildrenByCode[as];if(Ts)return ns.matchPartial&&Ts.stateValues.fractionSatisfied!==void 0?Ts.stateValues.fractionSatisfied:Ts.stateValues.value?1:0;{let Ss=ns.mathChildrenByCode[as];if(Ss){let Ns=Ss.stateValues.value.simplify().evaluate_to_constant();return Number.isFinite(Ns)&&Ns!==0?1:0}else{let Ns=ns.numberChildrenByCode[as];if(Ns){let As=Ns.stateValues.value;return Number.isFinite(As)&&As!==0?1:0}else{if(as.toLowerCase()==="true")return 1;if(as.toLowerCase()==="false")return 0}}}}else if(typeof as=="number")return as===0?0:1;return console.warn("Invalid format for boolean condition"),ss}let ls=as[0],us=as.slice(1);if(ls==="not")return us.length!==1?(console.warn("Invalid format for boolean condition"),ss):os(us[0])===0?1:0;if(ls==="and")return ns.matchPartial?us.reduce((Ts,Ss)=>Ts+os(Ss),0)/us.length:us.every(Ts=>os(Ts)===1)?1:0;if(ls==="or")return ns.matchPartial?us.reduce((Ts,Ss)=>Math.max(os(Ss),Ts),0):us.some(Ts=>os(Ts)===1)?1:0;let cs=!1,ds=!1,ps=!1,fs=!1;us.forEach(function(Ts){typeof Ts=="string"&&(Ts in ns.mathChildrenByCode||Ts in ns.mathListChildrenByCode||Ts in ns.numberChildrenByCode||Ts in ns.numberListChildrenByCode?cs=!0:Ts in ns.textChildrenByCode||Ts in ns.textListChildrenByCode?ds=!0:Ts in ns.booleanChildrenByCode||Ts in ns.booleanListChildrenByCode?ps=!0:Ts in ns.otherChildrenByCode&&(fs=!0))});let hs=function(Ts){if(typeof Ts=="string"){let Ss=ns.mathChildrenByCode[Ts];return Ss!==void 0?Ss.stateValues.value.tree:(Ss=ns.mathListChildrenByCode[Ts],Ss!==void 0?["list",...Ss.stateValues.maths.map(Ns=>Ns.tree)]:(Ss=ns.numberChildrenByCode[Ts],Ss!==void 0?numberToMathExpression(Ss.stateValues.value).tree:(Ss=ns.numberListChildrenByCode[Ts],Ss!==void 0?["list",...Ss.stateValues.numbers]:Ts)))}return Array.isArray(Ts)?[Ts[0],...Ts.slice(1).map(hs)]:Ts};if(ls==="apply"&&["isnumber","isinteger"].includes(us[0])){if(ds||ps||fs)return 0;let Ss=Context.fromAst(hs(us[1])).simplify().evaluate_to_constant();if(!Number.isFinite(Ss))return 0;if(us[0]==="isnumber")return 1;{let Ns=Math.round(Ss);return Math.abs(Ns-Ss)<=1e-15*Math.abs(Ss)?1:0}}if(!["=","ne","<",">","le","ge","lts","gts","in","notin"].includes(ls)){if(ds||ps||fs)return console.warn("Invalid format for boolean condition"),ss;let Ss=Context.fromAst(hs(as)).simplify().evaluate_to_constant();return Number.isFinite(Ss)&&Ss!==0?1:0}if(ps){if(cs||ds||fs)return console.warn("Invalid format for boolean condition"),ss;let Ts=!1,Ss=!1;if(us=us.map(function(As){if(typeof As=="string"){let ws=ns.booleanChildrenByCode[As];return ws!==void 0?ws.stateValues.value:(ws=ns.booleanListChildrenByCode[As],ws!==void 0?(ws.stateValues.unordered&&(Ss=!0),ws.stateValues.booleans):(As=As.toLowerCase().trim(),As==="true"||As==="t"?!0:As==="false"||As==="f"?!1:(console.warn("Invalid format for boolean condition"),Ts=!0,ss)))}return console.warn("Invalid format for boolean condition"),Ts=!0,ss}),Ts)return ss;let Ns=ns.unorderedCompare;if(rs&&Ss&&(Ns=!0),ls==="="){let As=us[0];if(ns.matchPartial){let ws=us.slice(1).map(_s=>checkEquality({object1:As,object2:_s,isUnordered:Ns,partialMatches:ns.matchPartial,matchByExactPositions:ns.matchByExactPositions}));return ws.reduce((_s,$s)=>_s+$s.fraction_equal,0)/ws.length}else return us.slice(1).every(ws=>checkEquality({object1:As,object2:ws,isUnordered:Ns,partialMatches:ns.matchPartial,matchByExactPositions:ns.matchByExactPositions}).fraction_equal===1)?1:0}else return ls==="ne"?us.length!==2?(console.warn("Invalid format for boolean condition"),ss):checkEquality({object1:us[0],object2:us[1],isUnordered:Ns,partialMatches:ns.matchPartial,matchByExactPositions:ns.matchByExactPositions}).fraction_equal===0?1:0:(console.warn("Invalid format for boolean condition"),ss)}else if(ds){if(cs||fs)return console.warn("Invalid format for boolean condition"),ss;let Ts=!1,Ss=!1,Ns=function(ws,Es=!1){if(typeof ws=="string"){let _s=ns.textChildrenByCode[ws];return _s!==void 0?_s.stateValues.value.trim().replace(/\s+/," "):(_s=ns.textListChildrenByCode[ws],_s!==void 0?(_s.stateValues.unordered&&(Ss=!0),_s.stateValues.texts.map($s=>$s.trim().replace(/\s+/," "))):ws.trim())}return typeof ws=="number"?ws.toString():Es&&Array.isArray(ws)&&ws[0]==="*"?ws.slice(1).map(Ns).join(" "):(console.warn("Invalid format for boolean condition"),Ts=!0,"")};if(us=us.map(ws=>Ns(ws,!0)),Ts)return ss;let As=ns.unorderedCompare;if(rs&&Ss&&(As=!0),ls==="="){let ws=us[0];if(ns.matchPartial){let Es=us.slice(1).map($s=>checkEquality({object1:ws,object2:$s,isUnordered:As,partialMatches:ns.matchPartial,matchByExactPositions:ns.matchByExactPositions,caseInsensitiveMatch:ns.caseInsensitiveMatch}));return Es.reduce(($s,Rs)=>$s+Rs.fraction_equal,0)/Es.length}else return us.slice(1).every(Es=>checkEquality({object1:ws,object2:Es,isUnordered:As,partialMatches:ns.matchPartial,matchByExactPositions:ns.matchByExactPositions,caseInsensitiveMatch:ns.caseInsensitiveMatch}).fraction_equal===1)?1:0}else return ls==="ne"?us.length!==2?(console.warn("Invalid format for boolean condition"),0):checkEquality({object1:us[0],object2:us[1],isUnordered:As,partialMatches:ns.matchPartial,matchByExactPositions:ns.matchByExactPositions,caseInsensitiveMatch:ns.caseInsensitiveMatch}).fraction_equal===0?1:0:(console.warn("Invalid format for boolean condition"),ss)}else if(fs){if(cs)return console.warn("Invalid format for boolean condition"),ss;let Ts=!1;return us=us.map(function(Ss){if(typeof Ss=="string"){let Ns=ns.otherChildrenByCode[Ss];if(Ns!==void 0)return Ns.stateValues.value}return console.warn("Invalid format for boolean condition"),Ts=!0,null}),Ts?ss:ls==="="?us.slice(1).every(Ss=>deepCompare(Ss,us[0]))?1:0:ls==="ne"?us.length!==2?(console.warn("Invalid format for boolean condition"),0):deepCompare(us[0],us[1])?0:1:(console.warn("Invalid format for boolean condition"),0)}let gs;(ls==="lts"||ls==="gts")&&(gs=us[1].slice(1),us=us[0].slice(1));let ys=!1,bs=function(Ts){if(typeof Ts=="string"){let Ss=ns.mathChildrenByCode[Ts];return Ss!==void 0?(Ss.stateValues.unordered&&(ys=!0),Ss.stateValues.value.tree):(Ss=ns.mathListChildrenByCode[Ts],Ss!==void 0?(Ss.stateValues.unordered&&(ys=!0),["list",...Ss.stateValues.maths.map(Ns=>Ns.tree)]):(Ss=ns.numberChildrenByCode[Ts],Ss!==void 0?numberToMathExpression(Ss.stateValues.value).tree:(Ss=ns.numberListChildrenByCode[Ts],Ss!==void 0?(Ss.stateValues.unordered&&(ys=!0),["list",...Ss.stateValues.numbers]):Ts)))}return Array.isArray(Ts)?[Ts[0],...Ts.slice(1).map(bs)]:Ts},vs=us.map(function(Ts){return Context.fromAst(bs(Ts))}),xs=ns.unorderedCompare;if(rs&&ys&&(xs=!0),ls==="="){let Ts=vs[0];if(Number.isNaN(Ts.tree))return vs.slice(1).every(Ss=>Number.isNaN(Ss.tree))?1:0;if(ns.matchPartial){let Ss=vs.slice(1).map(As=>checkEquality({object1:Ts,object2:As,isUnordered:xs,partialMatches:ns.matchPartial,matchByExactPositions:ns.matchByExactPositions,symbolicEquality:ns.symbolicEquality,simplify:ns.simplifyOnCompare,expand:ns.expandOnCompare,allowedErrorInNumbers:ns.allowedErrorInNumbers,includeErrorInNumberExponents:ns.includeErrorInNumberExponents,allowedErrorIsAbsolute:ns.allowedErrorIsAbsolute,nSignErrorsMatched:ns.nSignErrorsMatched,nPeriodicSetMatchesRequired:ns.nPeriodicSetMatchesRequired,caseInsensitiveMatch:ns.caseInsensitiveMatch,matchBlanks:ns.matchBlanks}));return Ss.reduce((As,ws)=>As+ws.fraction_equal,0)/Ss.length}else return vs.slice(1).every(Ss=>checkEquality({object1:Ts,object2:Ss,isUnordered:xs,partialMatches:ns.matchPartial,matchByExactPositions:ns.matchByExactPositions,symbolicEquality:ns.symbolicEquality,simplify:ns.simplifyOnCompare,expand:ns.expandOnCompare,allowedErrorInNumbers:ns.allowedErrorInNumbers,includeErrorInNumberExponents:ns.includeErrorInNumberExponents,allowedErrorIsAbsolute:ns.allowedErrorIsAbsolute,nSignErrorsMatched:ns.nSignErrorsMatched,nPeriodicSetMatchesRequired:ns.nPeriodicSetMatchesRequired,caseInsensitiveMatch:ns.caseInsensitiveMatch,matchBlanks:ns.matchBlanks}).fraction_equal===1)?1:0}if(ls==="ne")return checkEquality({object1:vs[0],object2:vs[1],isUnordered:xs,partialMatches:ns.matchPartial,matchByExactPositions:ns.matchByExactPositions,symbolicEquality:ns.symbolicEquality,simplify:ns.simplifyOnCompare,expand:ns.expandOnCompare,allowedErrorInNumbers:ns.allowedErrorInNumbers,includeErrorInNumberExponents:ns.includeErrorInNumberExponents,allowedErrorIsAbsolute:ns.allowedErrorIsAbsolute,nSignErrorsMatched:ns.nSignErrorsMatched,nPeriodicSetMatchesRequired:ns.nPeriodicSetMatchesRequired,caseInsensitiveMatch:ns.caseInsensitiveMatch,matchBlanks:ns.matchBlanks}).fraction_equal===0?1:0;if(ls==="in"||ls==="notin"){let Ts=vs[0],Ns=vs[1].tree;if(!(Array.isArray(Ns)&&Ns[0]==="set"))return console.warn("Invalid format for boolean condition"),ss;if(ns.matchPartial){let ws=Ns.slice(1).map(Es=>checkEquality({object1:Ts,object2:Context.fromAst(Es),isUnordered:xs,partialMatches:ns.matchPartial,matchByExactPositions:ns.matchByExactPositions,symbolicEquality:ns.symbolicEquality,simplify:ns.simplifyOnCompare,expand:ns.expandOnCompare,allowedErrorInNumbers:ns.allowedErrorInNumbers,includeErrorInNumberExponents:ns.includeErrorInNumberExponents,allowedErrorIsAbsolute:ns.allowedErrorIsAbsolute,nSignErrorsMatched:ns.nSignErrorsMatched,nPeriodicSetMatchesRequired:ns.nPeriodicSetMatchesRequired,caseInsensitiveMatch:ns.caseInsensitiveMatch,matchBlanks:ns.matchBlanks})).reduce((Es,_s)=>Math.max(Es,_s.fraction_equal),0);return ls==="in"?ws:1-ws}else{let As=Ns.slice(1).some(ws=>checkEquality({object1:Ts,object2:Context.fromAst(ws),isUnordered:xs,partialMatches:ns.matchPartial,matchByExactPositions:ns.matchByExactPositions,symbolicEquality:ns.symbolicEquality,simplify:ns.simplifyOnCompare,expand:ns.expandOnCompare,allowedErrorInNumbers:ns.allowedErrorInNumbers,includeErrorInNumberExponents:ns.includeErrorInNumberExponents,allowedErrorIsAbsolute:ns.allowedErrorIsAbsolute,nSignErrorsMatched:ns.nSignErrorsMatched,nPeriodicSetMatchesRequired:ns.nPeriodicSetMatchesRequired,caseInsensitiveMatch:ns.caseInsensitiveMatch,matchBlanks:ns.matchBlanks}).fraction_equal===1);return ls==="in"?As?1:0:As?0:1}}let Cs=vs.map(Ts=>Ts.simplify().evaluate_to_constant());if(Cs.some(Ts=>Number.isNaN(Ts)))return 0;if(ls==="<")return Cs[0]")return Cs[0]>Cs[1]?1:0;if(ls==="le")return Cs[0]<=Cs[1]?1:0;if(ls==="ge")return Cs[0]>=Cs[1]?1:0;for(let Ts=0;TsCs[Ts+1]))return 0}else if(!(Cs[Ts]>=Cs[Ts+1]))return 0;return 1}function splitSymbolsIfMath({logicTree:as,nonMathCodes:rs,foundNonMath:ns=!1,init:ss=!0}){if(!Array.isArray(as))return typeof as=="string"&&!ns&&!ss?fromTextSplit(as).tree:as;let os=as[0],ls=as.slice(1);if(["and","not","or"].includes(os))return[os,...ls.map(us=>splitSymbolsIfMath({logicTree:us,nonMathCodes:rs,foundNonMath:ns,init:ss}))];if(ls.some(us=>rs.includes(us))&&(ns=!0),os==="apply"){ls=[ls[0],...ls.slice(1).map(cs=>splitSymbolsIfMath({logicTree:cs,nonMathCodes:rs,foundNonMath:ns,init:!1}))];let us=!1;if(ls[0]==="int"?us=!0:Array.isArray(ls[0])&&(ls[0][0]==="^"?(ls[0][1]==="int"||Array.isArray(ls[0][1])&&ls[0][1][0]==="_"&&ls[0][1][1]==="int")&&(us=!0):ls[0][0]==="_"&&ls[0][1]==="int"&&(us=!0)),us){ls=Context.fromAst([os,...ls]).tree.slice(1);let cs=ls[1];if(Array.isArray(cs)&&cs[0]==="*"){let ds=[];for(let ps=0;pssplitSymbolsIfMath({logicTree:us,nonMathCodes:rs,foundNonMath:ns,init:!1}))]}class BooleanComponent extends InlineComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.symbolicEquality={createComponentOfType:"boolean",createStateVariable:"symbolicEquality",defaultValue:!1,public:!0},rs.expandOnCompare={createComponentOfType:"boolean",createStateVariable:"expandOnCompare",defaultValue:!1,public:!0},rs.simplifyOnCompare={createComponentOfType:"text",createStateVariable:"simplifyOnCompare",defaultValue:"none",toLowerCase:!0,valueTransformations:{"":"full",true:"full",false:"none"},validValues:["none","full","numbers","numbersepreserveorder"],public:!0},rs.unorderedCompare={createComponentOfType:"boolean",createStateVariable:"unorderedCompare",defaultValue:!1,public:!0},rs.matchByExactPositions={createComponentOfType:"boolean",createStateVariable:"matchByExactPositions",defaultValue:!1,public:!0},rs.allowedErrorInNumbers={createComponentOfType:"number",createStateVariable:"allowedErrorInNumbers",defaultValue:0,public:!0},rs.includeErrorInNumberExponents={createComponentOfType:"boolean",createStateVariable:"includeErrorInNumberExponents",defaultValue:!1,public:!0},rs.allowedErrorIsAbsolute={createComponentOfType:"boolean",createStateVariable:"allowedErrorIsAbsolute",defaultValue:!1,public:!0},rs.nSignErrorsMatched={createComponentOfType:"number",createStateVariable:"nSignErrorsMatched",defaultValue:0,public:!0},rs.nPeriodicSetMatchesRequired={createComponentOfType:"integer",createStateVariable:"nPeriodicSetMatchesRequired",defaultValue:3,public:!0},rs.caseInsensitiveMatch={createComponentOfType:"boolean",createStateVariable:"caseInsensitiveMatch",defaultValue:!1,public:!0},rs.matchBlanks={createComponentOfType:"boolean",createStateVariable:"matchBlanks",defaultValue:!1,public:!0},rs}static returnChildGroups(){return[{group:"strings",componentTypes:["string"]},{group:"comparableTypes",componentTypes:["math","mathList","number","numberList","text","textList","boolean","booleanList","orbitalDiagram"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.parsedExpression={additionalStateVariablesDefined:["codePre"],returnDependencies:()=>({allChildren:{dependencyType:"child",childGroups:["strings","comparableTypes"]},stringChildren:{dependencyType:"child",childGroups:["strings"],variableNames:["value"]}}),definition:buildParsedExpression},rs.mathChildrenByCode={additionalStateVariablesDefined:["mathListChildrenByCode","numberChildrenByCode","numberListChildrenByCode","textChildrenByCode","textListChildrenByCode","booleanChildrenByCode","booleanListChildrenByCode","otherChildrenByCode"],returnDependencies:()=>({allChildren:{dependencyType:"child",childGroups:["strings","comparableTypes"],variableNames:["value","texts","maths","numbers","booleans","fractionSatisfied","unordered"],variablesOptional:!0},codePre:{dependencyType:"stateVariable",variableName:"codePre"}}),definition({dependencyValues:ns,componentInfoObjects:ss}){let os={},ls={},us={},cs={},ds={},ps={},fs={},hs={},gs={},ys=0,bs=ns.codePre;for(let vs of ns.allChildren)if(typeof vs!="string"){let xs=bs+ys;ss.isInheritedComponentType({inheritedComponentType:vs.componentType,baseComponentType:"math"})?os[xs]=vs:ss.isInheritedComponentType({inheritedComponentType:vs.componentType,baseComponentType:"mathList"})?ls[xs]=vs:ss.isInheritedComponentType({inheritedComponentType:vs.componentType,baseComponentType:"number"})?us[xs]=vs:ss.isInheritedComponentType({inheritedComponentType:vs.componentType,baseComponentType:"numberList"})?cs[xs]=vs:ss.isInheritedComponentType({inheritedComponentType:vs.componentType,baseComponentType:"text"})?ds[xs]=vs:ss.isInheritedComponentType({inheritedComponentType:vs.componentType,baseComponentType:"textList"})?ps[xs]=vs:ss.isInheritedComponentType({inheritedComponentType:vs.componentType,baseComponentType:"boolean"})?fs[xs]=vs:ss.isInheritedComponentType({inheritedComponentType:vs.componentType,baseComponentType:"booleanList"})?hs[xs]=vs:gs[xs]=vs,ys+=1}return{setValue:{mathChildrenByCode:os,mathListChildrenByCode:ls,numberChildrenByCode:us,numberListChildrenByCode:cs,textChildrenByCode:ds,textListChildrenByCode:ps,booleanChildrenByCode:fs,booleanListChildrenByCode:hs,otherChildrenByCode:gs}}}},rs.value={public:!0,shadowingInstructions:{createComponentOfType:"boolean",attributesToShadow:["fixed"]},forRenderer:!0,hasEssential:!0,defaultValue:!1,set:Boolean,returnDependencies:()=>({symbolicEquality:{dependencyType:"stateVariable",variableName:"symbolicEquality"},expandOnCompare:{dependencyType:"stateVariable",variableName:"expandOnCompare"},simplifyOnCompare:{dependencyType:"stateVariable",variableName:"simplifyOnCompare"},unorderedCompare:{dependencyType:"stateVariable",variableName:"unorderedCompare"},matchByExactPositions:{dependencyType:"stateVariable",variableName:"matchByExactPositions"},allowedErrorInNumbers:{dependencyType:"stateVariable",variableName:"allowedErrorInNumbers"},includeErrorInNumberExponents:{dependencyType:"stateVariable",variableName:"includeErrorInNumberExponents"},allowedErrorIsAbsolute:{dependencyType:"stateVariable",variableName:"allowedErrorIsAbsolute"},nSignErrorsMatched:{dependencyType:"stateVariable",variableName:"nSignErrorsMatched"},nPeriodicSetMatchesRequired:{dependencyType:"stateVariable",variableName:"nPeriodicSetMatchesRequired"},caseInsensitiveMatch:{dependencyType:"stateVariable",variableName:"caseInsensitiveMatch"},matchBlanks:{dependencyType:"stateVariable",variableName:"matchBlanks"},parsedExpression:{dependencyType:"stateVariable",variableName:"parsedExpression"},allChildren:{dependencyType:"child",childGroups:["strings","comparableTypes"],variableNames:["value"],variablesOptional:!0},booleanChildrenByCode:{dependencyType:"stateVariable",variableName:"booleanChildrenByCode"},booleanListChildrenByCode:{dependencyType:"stateVariable",variableName:"booleanListChildrenByCode"},textChildrenByCode:{dependencyType:"stateVariable",variableName:"textChildrenByCode"},textListChildrenByCode:{dependencyType:"stateVariable",variableName:"textListChildrenByCode"},mathChildrenByCode:{dependencyType:"stateVariable",variableName:"mathChildrenByCode"},mathListChildrenByCode:{dependencyType:"stateVariable",variableName:"mathListChildrenByCode"},numberChildrenByCode:{dependencyType:"stateVariable",variableName:"numberChildrenByCode"},numberListChildrenByCode:{dependencyType:"stateVariable",variableName:"numberListChildrenByCode"},otherChildrenByCode:{dependencyType:"stateVariable",variableName:"otherChildrenByCode"}}),definition({dependencyValues:ns,usedDefault:ss}){if(ns.allChildren.length===0)return{useEssentialOrDefaultValue:{value:!0}};if(ns.parsedExpression===null)return{setValue:{value:!1}};let os=ss.unorderedCompare;return{setValue:{value:evaluateLogic({logicTree:ns.parsedExpression.tree,canOverrideUnorderedCompare:os,dependencyValues:ns})===1}}},inverseDefinition:function({desiredStateVariableValues:ns,dependencyValues:ss,componentInfoObjects:os}){if(ss.allChildren.length===0)return{success:!0,instructions:[{setEssentialValue:"value",value:!!ns.value}]};if(ss.allChildren.length===1){let ls=ss.allChildren[0];if(typeof ls=="string")return{success:!0,instructions:[{setDependency:"allChildren",desiredValue:ns.value.toString(),childIndex:0,variableIndex:0}]};if(os.isInheritedComponentType({inheritedComponentType:ls.componentType,baseComponentType:"boolean"}))return{success:!0,instructions:[{setDependency:"allChildren",desiredValue:ns.value,childIndex:0,variableIndex:0}]}}return{success:!1}}},rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},forRenderer:!0,returnDependencies:()=>({value:{dependencyType:"stateVariable",variableName:"value"}}),definition:function({dependencyValues:ns}){return{setValue:{text:ns.value?"true":"false"}}},inverseDefinition({desiredStateVariableValues:ns}){let ss=String(ns.text).toLowerCase(),os;return ss==="true"?os=!0:ss==="false"&&(os=!1),os!==void 0?{success:!0,instructions:[{setDependency:"value",desiredValue:os}]}:{success:!1}}},rs}}zs(BooleanComponent,"componentType","boolean"),zs(BooleanComponent,"variableForPlainMacro","value"),zs(BooleanComponent,"descendantCompositesMustHaveAReplacement",!0),zs(BooleanComponent,"descendantCompositesDefaultReplacementType","math"),zs(BooleanComponent,"adapters",["text"]);class BooleanOperator extends BooleanComponent{static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=function({matchedChildren:ss}){return{success:!0,newChildren:ss.reduce(function(ls,us){return typeof us=="string"?[...ls,...us.split(/\s+/).filter(cs=>cs).map(cs=>({componentType:"boolean",children:[cs]}))]:[...ls,us]},[])}};return rs.push({replacementFunction:ns}),rs}static returnChildGroups(){return[{group:"booleans",componentTypes:["boolean"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();delete rs.parsedExpression,delete rs.mathChildrenByCode;let ns=this;return rs.value={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},forRenderer:!0,returnDependencies:()=>({booleanChildren:{dependencyType:"child",childGroups:["booleans"],variableNames:["value"]}}),definition:function({dependencyValues:ss}){return{setValue:{value:ns.applyBooleanOperator(ss.booleanChildren.map(os=>os.stateValues.value))}}}},rs}}zs(BooleanOperator,"componentType","_booleanOperator"),zs(BooleanOperator,"rendererType","boolean"),zs(BooleanOperator,"descendantCompositesMustHaveAReplacement",!1);class BooleanOperatorOneInput extends BooleanComponent{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions(),ns=this;return renameStateVariable({stateVariableDefinitions:rs,oldName:"value",newName:"valuePreOperator"}),rs.value={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},forRenderer:!0,returnDependencies:()=>({value:{dependencyType:"stateVariable",variableName:"valuePreOperator"}}),definition:function({dependencyValues:ss}){return{setValue:{value:ns.applyBooleanOperator(ss.value)}}}},rs}}zs(BooleanOperatorOneInput,"componentType","_booleanOperatorOneInput"),zs(BooleanOperatorOneInput,"rendererType","boolean");class Not extends BooleanOperatorOneInput{static applyBooleanOperator(rs){return!rs}}zs(Not,"componentType","not");class And extends BooleanOperator{static applyBooleanOperator(rs){return rs.every(ns=>ns)}}zs(And,"componentType","and");var dp;let Or$1=(dp=class extends BooleanOperator{static applyBooleanOperator(rs){return rs.some(ns=>ns)}},zs(dp,"componentType","or"),dp);class Xor extends BooleanOperator{static applyBooleanOperator(rs){return rs.reduce((ss,os)=>ss+os,0)===1}}zs(Xor,"componentType","xor");const BooleanOperators=Object.freeze(Object.defineProperty({__proto__:null,And,Not,Or:Or$1,Xor},Symbol.toStringTag,{value:"Module"}));class BooleanBaseOperatorOfMath extends BooleanComponent{static returnSugarInstructions(){let rs=[],ns=function({matchedChildren:ss}){return ss.every(os=>typeof os=="string"||os.doenetAttributes&&os.doenetAttributes.createdFromMacro)?ss.length===1&&typeof ss[0]!="string"?{success:!1}:{success:!0,newChildren:[{componentType:"math",children:ss}]}:{success:!1}};return rs.push({replacementFunction:ns}),rs}static returnChildGroups(){return[{group:"maths",componentTypes:["math"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return delete rs.parsedExpression,delete rs.mathChildrenByCode,rs.booleanOperator={returnDependencies:()=>({}),definition:()=>({setValue:{booleanOperator:ns=>!1}})},rs.value={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},forRenderer:!0,returnDependencies:()=>({mathChildren:{dependencyType:"child",childGroups:["maths"],variableNames:["value"]},booleanOperator:{dependencyType:"stateVariable",variableName:"booleanOperator"}}),definition:function({dependencyValues:ns}){return{setValue:{value:ns.booleanOperator(ns.mathChildren.map(ss=>ss.stateValues.value))}}}},rs}}zs(BooleanBaseOperatorOfMath,"componentType","_booleanOperatorOfMath"),zs(BooleanBaseOperatorOfMath,"rendererType","boolean");class IsInteger extends BooleanBaseOperatorOfMath{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.booleanOperator.definition=()=>({setValue:{booleanOperator:function(ns){if(ns.length===0)return!1;if(ns.length!==1)return console.warn("IsInteger requires exactly one math child"),null;let ss=ns[0].evaluate_to_constant();if(!Number.isFinite(ss))return!1;let os=Math.round(ss);return Math.abs(os-ss)<=1e-15*Math.abs(ss)}}}),rs}}zs(IsInteger,"componentType","isInteger");class IsNumber extends BooleanBaseOperatorOfMath{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.booleanOperator.definition=()=>({setValue:{booleanOperator:function(ns){if(ns.length===0)return!1;if(ns.length!==1)return console.warn("IsNumber requires exactly one math child"),null;let ss=ns[0].evaluate_to_constant();return Number.isFinite(ss)}}}),rs}}zs(IsNumber,"componentType","isNumber");class IsBetween extends BooleanBaseOperatorOfMath{static createAttributesObject(){let rs=super.createAttributesObject();return rs.limits={createComponentOfType:"numberList",createStateVariable:"limits",defaultValue:[],public:!0},rs.strict={createComponentOfType:"boolean",createStateVariable:"strict",defaultValue:!1,public:!0},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.booleanOperator={returnDependencies:()=>({limits:{dependencyType:"stateVariable",variableName:"limits"},strict:{dependencyType:"stateVariable",variableName:"strict"}}),definition({dependencyValues:ns}){let ss,os,ls=ns.limits[0],us=ns.limits[1];if(ls!1}};let cs=ns.strict;return{setValue:{booleanOperator:function(ds){if(ds.length===0)return!1;if(ds.length!==1)return console.warn("IsBetween requires exactly one math child"),null;let ps=ds[0].evaluate_to_constant();return cs?ps>os&&ps=os&&ps<=ss}}}}},rs}}zs(IsBetween,"componentType","isBetween");const BooleanOperatorsOfMath=Object.freeze(Object.defineProperty({__proto__:null,IsBetween,IsInteger,IsNumber},Symbol.toStringTag,{value:"Module"}));class MathOperator extends MathComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.forceSymbolic={createComponentOfType:"boolean",createStateVariable:"forceSymbolic",defaultValue:!1,public:!0},rs.forceNumeric={createComponentOfType:"boolean",createStateVariable:"forceNumeric",defaultValue:!1,public:!0},rs}static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=function({matchedChildren:ss}){return{success:!0,newChildren:ss.reduce(function(ls,us){return typeof us=="string"?[...ls,...us.split(/\s+/).filter(cs=>cs).map(cs=>({componentType:Number.isFinite(Number(cs))?"number":"math",children:[cs]}))]:[...ls,us]},[])}};return rs.push({replacementFunction:ns}),rs}static returnChildGroups(){return[{group:"maths",componentTypes:["math"]},{group:"numbers",componentTypes:["number"]},{group:"mathLists",componentTypes:["mathList"]},{group:"numberLists",componentTypes:["numberList"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.displayDigits={public:!0,shadowingInstructions:{createComponentOfType:"integer"},hasEssential:!0,defaultValue:10,returnDependencies:()=>({displayDigitsAttr:{dependencyType:"attributeComponent",attributeName:"displayDigits",variableNames:["value"]},displayDecimalsAttr:{dependencyType:"attributeComponent",attributeName:"displayDecimals",variableNames:["value"]},mathLikeChildren:{dependencyType:"child",childGroups:["maths","numbers","mathLists","numberLists"],variableNames:["displayDigits"]}}),definition({dependencyValues:ns,usedDefault:ss}){return ns.displayDigitsAttr!==null?{setValue:{displayDigits:ns.displayDigitsAttr.stateValues.value}}:ns.displayDecimalsAttr===null&&ns.mathLikeChildren.length===1&&!(ss.mathLikeChildren[0]&&ss.mathLikeChildren[0].displayDigits)?{setValue:{displayDigits:ns.mathLikeChildren[0].stateValues.displayDigits}}:{useEssentialOrDefaultValue:{displayDigits:!0}}}},rs.displayDecimals={public:!0,shadowingInstructions:{createComponentOfType:"integer"},hasEssential:!0,defaultValue:null,returnDependencies:()=>({displayDecimalsAttr:{dependencyType:"attributeComponent",attributeName:"displayDecimals",variableNames:["value"]},mathLikeChildren:{dependencyType:"child",childGroups:["maths","numbers","mathLists","numberLists"],variableNames:["displayDecimals"]}}),definition({dependencyValues:ns,usedDefault:ss}){return ns.displayDecimalsAttr!==null?{setValue:{displayDecimals:ns.displayDecimalsAttr.stateValues.value}}:ns.mathLikeChildren.length===1&&!(ss.mathLikeChildren[0]&&ss.mathLikeChildren[0].displayDecimals)?{setValue:{displayDecimals:ns.mathLikeChildren[0].stateValues.displayDecimals}}:{useEssentialOrDefaultValue:{displayDecimals:!0}}}},rs.displaySmallAsZero={public:!0,shadowingInstructions:{createComponentOfType:"number"},hasEssential:!0,defaultValue:0,returnDependencies:()=>({displaySmallAsZeroAttr:{dependencyType:"attributeComponent",attributeName:"displaySmallAsZero",variableNames:["value"]},mathLikeChildren:{dependencyType:"child",childGroups:["maths","numbers","mathLists","numberLists"],variableNames:["displaySmallAsZero"]}}),definition({dependencyValues:ns,usedDefault:ss}){return ns.displaySmallAsZeroAttr!==null?{setValue:{displaySmallAsZero:ns.displaySmallAsZeroAttr.stateValues.value}}:ns.mathLikeChildren.length===1&&!(ss.mathLikeChildren[0]&&ss.mathLikeChildren[0].displaySmallAsZero)?{setValue:{displaySmallAsZero:ns.mathLikeChildren[0].stateValues.displaySmallAsZero}}:{useEssentialOrDefaultValue:{displaySmallAsZero:!0}}}},rs.padZeros={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},hasEssential:!0,defaultValue:!1,returnDependencies:()=>({padZerosAttr:{dependencyType:"attributeComponent",attributeName:"padZeros",variableNames:["value"]},mathLikeChildren:{dependencyType:"child",childGroups:["maths","numbers","mathLists","numberLists"],variableNames:["padZeros"]}}),definition({dependencyValues:ns,usedDefault:ss}){return ns.padZerosAttr!==null?{setValue:{padZeros:ns.padZerosAttr.stateValues.value}}:ns.mathLikeChildren.length===1&&!(ss.mathLikeChildren[0]&&ss.mathLikeChildren[0].padZeros)?{setValue:{padZeros:ns.mathLikeChildren[0].stateValues.padZeros}}:{useEssentialOrDefaultValue:{padZeros:!0}}}},rs.isNumericOperator={returnDependencies:()=>({forceNumeric:{dependencyType:"stateVariable",variableName:"forceNumeric"},forceSymbolic:{dependencyType:"stateVariable",variableName:"forceSymbolic"},mathChildren:{dependencyType:"child",childGroups:["maths"],variableNames:["isNumber"],variablesOptional:!0},mathListChildren:{dependencyType:"child",childGroups:["mathLists"],variableNames:["maths"]}}),definition({dependencyValues:ns}){let ss;return ns.forceNumeric?ss=!0:ns.forceSymbolic?ss=!1:ns.mathChildren.length===0&&ns.mathListChildren.length===0?ss=!0:ss=ns.mathChildren.every(os=>os.stateValues.isNumber)&&ns.mathListChildren.every(os=>os.stateValues.maths.every(ls=>Number.isFinite(ls.tree))),{setValue:{isNumericOperator:ss}}}},delete rs.codePre,delete rs.expressionWithCodes,delete rs.mathChildrenFunctionSymbols,delete rs.codesAdjacentToStrings,delete rs.mathChildrenByVectorComponent,rs.mathOperator={returnDependencies:()=>({}),definition:()=>({setValue:{mathOperator:ns=>Context.fromAst("_")}})},rs.numericOperator={returnDependencies:()=>({}),definition:()=>({setValue:{numericOperator:ns=>Context.fromAst("_")}})},rs.inverseMathOperator={returnDependencies:()=>({}),definition:()=>({setValue:{inverseMathOperator:null}})},rs.inverseNumericOperator={returnDependencies:()=>({}),definition:()=>({setValue:{inverseNumericOperator:null}})},rs.unnormalizedValue={returnDependencies:()=>({mathNumberChildren:{dependencyType:"child",childGroups:["maths","numbers","mathLists","numberLists"],variableNames:["value","maths","numbers","canBeModified"],variablesOptional:!0},isNumericOperator:{dependencyType:"stateVariable",variableName:"isNumericOperator"},mathOperator:{dependencyType:"stateVariable",variableName:"mathOperator"},numericOperator:{dependencyType:"stateVariable",variableName:"numericOperator"},inverseMathOperator:{dependencyType:"stateVariable",variableName:"inverseMathOperator"},inverseNumericOperator:{dependencyType:"stateVariable",variableName:"inverseNumericOperator"}}),definition:function({dependencyValues:ns,componentInfoObjects:ss}){if(ns.mathNumberChildren.length===0)return{setValue:{unnormalizedValue:Context.fromAst("_")}};if(ns.isNumericOperator){let os=[];for(let ls of ns.mathNumberChildren)if(ss.isInheritedComponentType({inheritedComponentType:ls.componentType,baseComponentType:"number"}))os.push(ls.stateValues.value);else if(ss.isInheritedComponentType({inheritedComponentType:ls.componentType,baseComponentType:"math"})){let us=ls.stateValues.value.evaluate_to_constant();os.push(us)}else if(ss.isInheritedComponentType({inheritedComponentType:ls.componentType,baseComponentType:"numberList"}))os.push(...ls.stateValues.numbers);else{let us=ls.stateValues.maths.map(cs=>{let ds=cs.evaluate_to_constant();return Number.isFinite(ds)||(ds=NaN),ds});os.push(...us)}return{setValue:{unnormalizedValue:Context.fromAst(ns.numericOperator(os))}}}else{let os=[];for(let ls of ns.mathNumberChildren)ss.isInheritedComponentType({inheritedComponentType:ls.componentType,baseComponentType:"number"})?os.push(Context.fromAst(ls.stateValues.value)):ss.isInheritedComponentType({inheritedComponentType:ls.componentType,baseComponentType:"math"})?os.push(ls.stateValues.value):ss.isInheritedComponentType({inheritedComponentType:ls.componentType,baseComponentType:"numberList"})?os.push(...ls.stateValues.numbers.map(us=>Context.fromAst(us))):os.push(...ls.stateValues.maths);return{setValue:{unnormalizedValue:ns.mathOperator(os)}}}},inverseDefinition:function({desiredStateVariableValues:ns,dependencyValues:ss,componentInfoObjects:os}){if(ss.mathNumberChildren.length===0)return{success:!1};if(ss.isNumericOperator)if(ss.inverseNumericOperator){let ls=[],us=[],cs=[];for(let[ps,fs]of ss.mathNumberChildren.entries())if(os.isInheritedComponentType({inheritedComponentType:fs.componentType,baseComponentType:"number"}))ls.push(fs.stateValues.value),us.push(fs.stateValues.canBeModified),cs.push(ps);else if(os.isInheritedComponentType({inheritedComponentType:fs.componentType,baseComponentType:"math"})){let hs=fs.stateValues.value.evaluate_to_constant();ls.push(hs),us.push(fs.stateValues.canBeModified),cs.push(ps)}else if(os.isInheritedComponentType({inheritedComponentType:fs.componentType,baseComponentType:"numberList"}))ls.push(...fs.stateValues.numbers),us.push(...Array(fs.stateValues.numbers.length).fill(fs.stateValues.canBeModified)),fs.stateValues.numbers.length===1?cs.push(ps):cs.push(...Array(fs.stateValues.numbers.length).fill(NaN));else{let hs=fs.stateValues.maths.map(gs=>gs.evaluate_to_constant());ls.push(...hs),us.push(...Array(fs.stateValues.maths.length).fill(fs.stateValues.canBeModified)),fs.stateValues.maths.length===1?cs.push(ps):cs.push(...Array(fs.stateValues.maths.length).fill(NaN))}let ds=ss.inverseNumericOperator({desiredValue:ns.unnormalizedValue.evaluate_to_constant(),inputs:ls,canBeModified:us,desiredMathValue:ns.unnormalizedValue});if(ds.success){let ps=cs[ds.inputNumber];if(Number.isFinite(ps)){let fs=ds.inputValue,hs=0,gs=ss.mathNumberChildren[ps];return os.isInheritedComponentType({inheritedComponentType:gs.componentType,baseComponentType:"numberList"})?(hs=2,fs={0:fs}):os.isInheritedComponentType({inheritedComponentType:gs.componentType,baseComponentType:"mathList"})&&(hs=1,fs={0:fs}),{success:!0,instructions:[{setDependency:"mathNumberChildren",desiredValue:fs,childIndex:ps,variableIndex:hs}]}}else return{success:!1}}else return{success:!1}}else return{success:!1};else if(ss.inverseMathOperator){let ls=[],us=[],cs=[];for(let[ps,fs]of ss.mathNumberChildren.entries())os.isInheritedComponentType({inheritedComponentType:fs.componentType,baseComponentType:"number"})?(ls.push(Context.fromAst(fs.stateValues.value)),us.push(fs.stateValues.canBeModified),cs.push(ps)):os.isInheritedComponentType({inheritedComponentType:fs.componentType,baseComponentType:"math"})?(ls.push(fs.stateValues.value),us.push(fs.stateValues.canBeModified),cs.push(ps)):os.isInheritedComponentType({inheritedComponentType:fs.componentType,baseComponentType:"numberList"})?(ls.push(...fs.stateValues.numbers.map(hs=>Context.fromAst(hs))),us.push(...Array(fs.stateValues.numbers.length).fill(fs.stateValues.canBeModified)),fs.stateValues.numbers.length===1?cs.push(ps):cs.push(...Array(fs.stateValues.numbers.length).fill(NaN))):(ls.push(...fs.stateValues.maths),us.push(...Array(fs.stateValues.maths.length).fill(fs.stateValues.canBeModified)),fs.stateValues.maths.length===1?cs.push(ps):cs.push(...Array(fs.stateValues.maths.length).fill(NaN)));let ds=ss.inverseMathOperator({desiredValue:ns.unnormalizedValue,inputs:ls,canBeModified:us});if(ds.success){let ps=cs[ds.inputNumber];if(Number.isFinite(ps)){let fs=ds.inputValue,hs=0,gs=ss.mathNumberChildren[ps];return os.isInheritedComponentType({inheritedComponentType:gs.componentType,baseComponentType:"numberList"})?(hs=2,fs={0:fs}):os.isInheritedComponentType({inheritedComponentType:gs.componentType,baseComponentType:"mathList"})&&(hs=1,fs={0:fs}),{success:!0,instructions:[{setDependency:"mathNumberChildren",desiredValue:fs,childIndex:ps,variableIndex:hs}]}}else return{success:!1}}else return{success:!1}}else return{success:!1}}},rs.canBeModified={returnDependencies:()=>({modifyIndirectly:{dependencyType:"stateVariable",variableName:"modifyIndirectly"},fixed:{dependencyType:"stateVariable",variableName:"fixed"},mathNumberChildren:{dependencyType:"child",childGroups:["maths","numbers"],variableNames:["canBeModified"]},mathNumberListChildren:{dependencyType:"child",childGroups:["mathLists","numberLists"],variableNames:["nComponents"]},isNumericOperator:{dependencyType:"stateVariable",variableName:"isNumericOperator"},inverseMathOperator:{dependencyType:"stateVariable",variableName:"mathOperator"},inverseNumericOperator:{dependencyType:"stateVariable",variableName:"inverseNumericOperator"}}),definition:function({dependencyValues:ns}){let ss=ns.modifyIndirectly&&!ns.fixed&&!!(ns.isNumericOperator?ns.inverseNumericOperator:ns.inverseMathOperator);return ss&&ns.mathNumberChildren.length+ns.mathNumberListChildren.length>0&&ns.mathNumberChildren.filter(ls=>ls.stateValues.canBeModified).length+ns.mathNumberListChildren.reduce((ls,us)=>ls+us.stateValues.nComponents,0)!==1&&(ss=!1),{setValue:{canBeModified:ss}}}},rs}}zs(MathOperator,"componentType","_mathOperator"),zs(MathOperator,"rendererType","math"),zs(MathOperator,"descendantCompositesMustHaveAReplacement",!1);class MathOperatorOneInput extends MathComponent{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.mathOperator={returnDependencies:()=>({}),definition:()=>({setValue:{mathOperator:ns=>me.fromAst("_")}})},rs.inverseMathOperator={returnDependencies:()=>({}),definition:()=>({setValue:{inverseMathOperator:null}})},renameStateVariable({stateVariableDefinitions:rs,oldName:"unnormalizedValue",newName:"unnormalizedValuePreOperator"}),rs.unnormalizedValue={returnDependencies:()=>({value:{dependencyType:"stateVariable",variableName:"unnormalizedValuePreOperator"},mathOperator:{dependencyType:"stateVariable",variableName:"mathOperator"},inverseMathOperator:{dependencyType:"stateVariable",variableName:"inverseMathOperator"}}),definition:function({dependencyValues:ns}){return{setValue:{unnormalizedValue:ns.mathOperator(ns.value)}}},inverseDefinition:function({desiredStateVariableValues:ns,dependencyValues:ss,componentName:os}){return ss.inverseMathOperator?{success:!0,instructions:[{setDependency:"value",desiredValue:ss.inverseMathOperator(ns.unnormalizedValue)}]}:{success:!1}}},renameStateVariable({stateVariableDefinitions:rs,oldName:"canBeModified",newName:"canBeModifiedPreOperator"}),rs.canBeModified={returnDependencies:()=>({canBeModifiedPreOperator:{dependencyType:"stateVariable",variableName:"canBeModifiedPreOperator"},inverseMathOperator:{dependencyType:"stateVariable",variableName:"mathOperator"}}),definition:function({dependencyValues:ns}){let ss=ns.canBeModifiedPreOperator;return ns.inverseMathOperator||(ss=!1),{setValue:{canBeModified:ss}}}},rs}}zs(MathOperatorOneInput,"componentType","_mathOperatorOneInput"),zs(MathOperatorOneInput,"rendererType","math");class Sum extends MathOperator{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.numericOperator={returnDependencies:()=>({}),definition:()=>({setValue:{numericOperator:function(ns){return ns.reduce((ss,os)=>ss+os)}}})},rs.mathOperator={returnDependencies:()=>({}),definition:()=>({setValue:{mathOperator:function(ns){return ns.reduce((ss,os)=>ss.add(os))}}})},rs}}zs(Sum,"componentType","sum");class Product extends MathOperator{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.numericOperator={returnDependencies:()=>({}),definition:()=>({setValue:{numericOperator:function(ns){return ns.reduce((ss,os)=>ss*os)}}})},rs.mathOperator={returnDependencies:()=>({}),definition:()=>({setValue:{mathOperator:function(ns){return ns.reduce((ss,os)=>ss.multiply(os))}}})},rs}}zs(Product,"componentType","product");class ClampNumber extends MathOperatorOneInput{static createAttributesObject(){let rs=super.createAttributesObject();return rs.lowerValue={createComponentOfType:"number",createStateVariable:"lowerValue",defaultValue:0,public:!0},rs.upperValue={createComponentOfType:"number",createStateVariable:"upperValue",defaultValue:1,public:!0},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.isNumericOperator={returnDependencies:()=>({}),definition:()=>({setValue:{isNumericOperator:!0}})},rs.mathOperator={returnDependencies:()=>({lowerValue:{dependencyType:"stateVariable",variableName:"lowerValue"},upperValue:{dependencyType:"stateVariable",variableName:"upperValue"}}),definition:({dependencyValues:ns})=>({setValue:{mathOperator:function(ss){return clamp({value:ss,lowerValue:ns.lowerValue,upperValue:ns.upperValue})}}})},rs.inverseMathOperator={returnDependencies:()=>({lowerValue:{dependencyType:"stateVariable",variableName:"lowerValue"},upperValue:{dependencyType:"stateVariable",variableName:"upperValue"}}),definition:({dependencyValues:ns})=>({setValue:{inverseMathOperator:function(ss){return clamp({value:ss,lowerValue:ns.lowerValue,upperValue:ns.upperValue})}}})},rs}}zs(ClampNumber,"componentType","clampNumber");function clamp({value:as,lowerValue:rs,upperValue:ns}){let ss=as;return ss instanceof Context.class&&(ss=ss.evaluate_to_constant()),Context.fromAst(Math.max(rs,Math.min(ns,ss)))}class WrapNumberPeriodic extends MathOperatorOneInput{static createAttributesObject(){let rs=super.createAttributesObject();return rs.lowerValue={createComponentOfType:"number",createStateVariable:"lowerValue",defaultValue:0,public:!0},rs.upperValue={createComponentOfType:"number",createStateVariable:"upperValue",defaultValue:1,public:!0},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.isNumericOperator={returnDependencies:()=>({}),definition:()=>({setValue:{isNumericOperator:!0}})},rs.mathOperator={returnDependencies:()=>({lowerValue:{dependencyType:"stateVariable",variableName:"lowerValue"},upperValue:{dependencyType:"stateVariable",variableName:"upperValue"}}),definition:({dependencyValues:ns})=>({setValue:{mathOperator:function(ss){return makePeriodic({value:ss,lowerValue:ns.lowerValue,upperValue:ns.upperValue})}}})},rs.inverseMathOperator={returnDependencies:()=>({lowerValue:{dependencyType:"stateVariable",variableName:"lowerValue"},upperValue:{dependencyType:"stateVariable",variableName:"upperValue"}}),definition:({dependencyValues:ns})=>({setValue:{inverseMathOperator:function(ss){return makePeriodic({value:ss,lowerValue:ns.lowerValue,upperValue:ns.upperValue})}}})},rs}}zs(WrapNumberPeriodic,"componentType","wrapNumberPeriodic");function makePeriodic({value:as,lowerValue:rs,upperValue:ns}){let ss=as;return ss instanceof Context.class&&(ss=ss.evaluate_to_constant()),Number.isFinite(ss)?rs===ns?Context.fromAst(rs):(rs>ns&&([ns,rs]=[rs,ns]),Context.fromAst(rs+Context.math.mod(ss-rs,ns-rs))):Context.fromAst(NaN)}class Round extends MathOperatorOneInput{static createAttributesObject(){let rs=super.createAttributesObject();return rs.numberDecimals={createComponentOfType:"number",createStateVariable:"numberDecimals",defaultValue:0,public:!0},rs.numberDigits={createComponentOfType:"number",createStateVariable:"numberDigits",defaultValue:null,public:!0},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.mathOperator={returnDependencies:()=>({numberDecimals:{dependencyType:"stateVariable",variableName:"numberDecimals"},numberDigits:{dependencyType:"stateVariable",variableName:"numberDigits"}}),definition:({dependencyValues:ns})=>({setValue:{mathOperator:function(ss){let os=ss.evaluate_numbers({max_digits:1/0,evaluate_functions:!0});return ns.numberDigits!==null?os.round_numbers_to_precision(ns.numberDigits):os.round_numbers_to_decimals(ns.numberDecimals)}}})},rs.inverseMathOperator={returnDependencies:()=>({}),definition:()=>({setValue:{inverseMathOperator:ns=>ns}})},rs}}zs(Round,"componentType","round");class setSmallToZero extends MathOperatorOneInput{static createAttributesObject(){let rs=super.createAttributesObject();return rs.threshold={createComponentOfType:"number",createStateVariable:"threshold",defaultValue:1e-14,public:!0},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.mathOperator={returnDependencies:()=>({threshold:{dependencyType:"stateVariable",variableName:"threshold"}}),definition:({dependencyValues:ns})=>({setValue:{mathOperator:function(ss){return ss.evaluate_numbers({skip_ordering:!0,set_small_zero:ns.threshold})}}})},rs.inverseMathOperator={returnDependencies:()=>({}),definition:()=>({setValue:{inverseMathOperator:ns=>ns}})},rs}}zs(setSmallToZero,"componentType","setSmallToZero");class ConvertSetToList extends MathOperatorOneInput{static createAttributesObject(){let rs=super.createAttributesObject();return delete rs.unordered,rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.unordered={returnDependencies:()=>({}),definition:()=>({setValue:{unordered:!0}})},rs.mathOperator={returnDependencies:()=>({}),definition:()=>({setValue:{mathOperator:function(ns){if(ns!==void 0&&Array.isArray(ns.tree)&&ns.tree[0]==="set"){let ss=[];for(let os of ns.tree.slice(1))ss.some(ls=>ns.context.equalsViaSyntax(ns.context.fromAst(ls),ns.context.fromAst(os)))||ss.push(os);return ns.context.fromAst(["list",...ss])}return ns}}})},rs}}zs(ConvertSetToList,"componentType","convertSetToList");class Ceil extends MathOperatorOneInput{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.mathOperator={returnDependencies:()=>({}),definition:()=>({setValue:{mathOperator:function(ns){let ss=ns.evaluate_to_constant();if(!Number.isFinite(ss))return Context.fromAst(["apply","ceil",ns.tree]);let os=Math.round(ss);return Math.abs((os-ss)/ss)<1e-15?Context.fromAst(os):Context.fromAst(Math.ceil(ss))}}})},rs.inverseMathOperator={returnDependencies:()=>({}),definition:()=>({setValue:{inverseMathOperator:ns=>ns}})},rs}}zs(Ceil,"componentType","ceil");class Floor extends MathOperatorOneInput{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.mathOperator={returnDependencies:()=>({}),definition:()=>({setValue:{mathOperator:function(ns){let ss=ns.evaluate_to_constant();if(!Number.isFinite(ss))return Context.fromAst(["apply","floor",ns.tree]);let os=Math.round(ss);return Math.abs((os-ss)/ss)<1e-15?Context.fromAst(os):Context.fromAst(Math.floor(ss))}}})},rs.inverseMathOperator={returnDependencies:()=>({}),definition:()=>({setValue:{inverseMathOperator:ns=>ns}})},rs}}zs(Floor,"componentType","floor");class Abs extends MathOperatorOneInput{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.mathOperator={returnDependencies:()=>({}),definition:()=>({setValue:{mathOperator:function(ns){let ss=ns.evaluate_to_constant();return Number.isFinite(ss)?Context.fromAst(Math.abs(ss)):Context.fromAst(["apply","abs",ns.tree])}}})},rs.inverseMathOperator={returnDependencies:()=>({}),definition:()=>({setValue:{inverseMathOperator:function(ns){let ss=ns,os=ns.evaluate_to_constant();return Number.isFinite(os)?os<0&&(ss=Context.fromAst(0)):Array.isArray(ns.tree)&&ns.tree[0]==="apply"&&ns.tree[1]==="abs"&&(ss=Context.fromAst(ns.tree[2])),ss}}})},rs}}zs(Abs,"componentType","abs");class Sign extends MathOperatorOneInput{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.mathOperator={returnDependencies:()=>({}),definition:()=>({setValue:{mathOperator:function(ns){let ss=ns.evaluate_to_constant();return Number.isFinite(ss)?Context.fromAst(Math.sign(ss)):Context.fromAst(["apply","sign",ns.tree])}}})},rs}}zs(Sign,"componentType","sign");class Mean extends MathOperator{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.numericOperator={returnDependencies:()=>({}),definition:()=>({setValue:{numericOperator:function(ns){let ss=ns.reduce((os,ls)=>os+ls);return ss/=ns.length,ss}}})},rs.mathOperator={returnDependencies:()=>({}),definition:()=>({setValue:{mathOperator:function(ns){return ns.reduce((ss,os)=>ss.add(os)).divide(ns.length)}}})},rs}}zs(Mean,"componentType","mean");class Variance extends MathOperator{static createAttributesObject(){let rs=super.createAttributesObject();return rs.population={createComponentOfType:"boolean",createStateVariable:"population",defaultValue:!1,public:!0},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.numericOperator={returnDependencies:()=>({population:{dependencyType:"stateVariable",variableName:"population"}}),definition:({dependencyValues:ns})=>({setValue:{numericOperator:function(ss){return calculateNumericVariance(ss,ns.population)}}})},rs.mathOperator={returnDependencies:()=>({population:{dependencyType:"stateVariable",variableName:"population"}}),definition:({dependencyValues:ns})=>({setValue:{mathOperator:function(ss){return calculateSymbolicVariance(ss,ns.population)}}})},rs}}zs(Variance,"componentType","variance");function calculateNumericVariance(as,rs){let ns=0,ss=0;for(let ls of as)ns+=ls,ss+=ls*ls;let os=as.length;return ss-=ns**2/os,rs?ss/=os:ss/=os-1,ss}function calculateSymbolicVariance(as,rs){let ns=as.length,ss=as.reduce((ls,us)=>ls.add(us)),os=as.slice(1).reduce((ls,us)=>ls.add(us.pow(2)),as[0].pow(2)).subtract(ss.pow(2).divide(ns));return rs?os=os.divide(ns):os=os.divide(ns-1),os}class StandardDeviation extends Variance{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.numericOperator.definition=({dependencyValues:ns})=>({setValue:{numericOperator:function(ss){return Math.sqrt(calculateNumericVariance(ss,ns.population))}}}),rs.mathOperator.definition=({dependencyValues:ns})=>({setValue:{mathOperator:function(ss){return Context.fromAst(["apply","sqrt",calculateSymbolicVariance(ss,ns.population).tree])}}}),rs}}zs(StandardDeviation,"componentType","standardDeviation");class Count extends MathOperator{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.isNumericOperator={returnDependencies:()=>({}),definition:()=>({setValue:{isNumericOperator:!0}})},rs.numericOperator={returnDependencies:()=>({}),definition:()=>({setValue:{numericOperator:function(ns){return ns.length}}})},rs}}zs(Count,"componentType","count");class Min extends MathOperator{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.numericOperator={returnDependencies:()=>({}),definition:()=>({setValue:{numericOperator:function(ns){return ns.reduce((ss,os)=>Math.min(ss,os),1/0)}}})},rs.mathOperator={returnDependencies:()=>({}),definition:()=>({setValue:{mathOperator:function(ns){return Context.fromAst(["apply","min",["tuple",...ns.map(ss=>ss.tree)]])}}})},rs.inverseMathOperator={returnDependencies:()=>({}),definition:()=>({setValue:{inverseMathOperator:function({desiredValue:ns,canBeModified:ss}){if(ss.filter(os=>os).length===1){let os=ss.indexOf(!0);if(os>=0)return{success:!0,inputValue:ns,inputNumber:os}}return{success:!1}}}})},rs.inverseNumericOperator={returnDependencies:()=>({}),definition:()=>({setValue:{inverseNumericOperator:function({desiredValue:ns,canBeModified:ss,desiredMathValue:os}){if(ss.filter(ls=>ls).length===1){let ls=ss.indexOf(!0);if(ls>=0)return Number.isFinite(ns)||(ns=os),{success:!0,inputValue:ns,inputNumber:ls}}return{success:!1}}}})},rs}}zs(Min,"componentType","min");class Max extends MathOperator{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.numericOperator={returnDependencies:()=>({}),definition:()=>({setValue:{numericOperator:function(ns){return ns.reduce((ss,os)=>Math.max(ss,os),-1/0)}}})},rs.mathOperator={returnDependencies:()=>({}),definition:()=>({setValue:{mathOperator:function(ns){return Context.fromAst(["apply","max",["tuple",...ns.map(ss=>ss.tree)]])}}})},rs.inverseMathOperator={returnDependencies:()=>({}),definition:()=>({setValue:{inverseMathOperator:function({desiredValue:ns,canBeModified:ss}){if(ss.filter(os=>os).length===1){let os=ss.indexOf(!0);if(os>=0)return{success:!0,inputValue:ns,inputNumber:os}}return{success:!1}}}})},rs.inverseNumericOperator={returnDependencies:()=>({}),definition:()=>({setValue:{inverseNumericOperator:function({desiredValue:ns,canBeModified:ss,desiredMathValue:os}){if(ss.filter(ls=>ls).length===1){let ls=ss.indexOf(!0);if(ls>=0)return Number.isFinite(ns)||(ns=os),{success:!0,inputValue:ns,inputNumber:ls}}return{success:!1}}}})},rs}}zs(Max,"componentType","max");class Mod extends MathOperator{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.numericOperator={returnDependencies:()=>({}),definition:()=>({setValue:{numericOperator:function(ns){return ns.length!==2?NaN:Context.math.mod(ns[0],ns[1])}}})},rs.mathOperator={returnDependencies:()=>({}),definition:()=>({setValue:{mathOperator:function(ns){return ns.length!==2?Context.fromAst("_"):Context.fromAst(["apply","mod",["tuple",...ns.map(ss=>ss.tree)]])}}})},rs}}zs(Mod,"componentType","mod");class Gcd extends MathOperator{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.numericOperator={returnDependencies:()=>({}),definition:()=>({setValue:{numericOperator:function(ns){return ns.every(Number.isInteger)?gcd(...ns):NaN}}})},rs.mathOperator={returnDependencies:()=>({}),definition:()=>({setValue:{mathOperator:function(ns){return Context.fromAst(["apply","gcd",["tuple",...ns.map(ss=>ss.tree)]])}}})},rs}}zs(Gcd,"componentType","gcd");class ExtractMath extends MathOperatorOneInput{static createAttributesObject(){let rs=super.createAttributesObject();return rs.type={createComponentOfType:"text",createStateVariable:"type",defaultValue:null,toLowerCase:!0,validValues:["operand","function","functionargument","numberofoperands"]},rs.operandNumber={createComponentOfType:"number",createStateVariable:"operandNumber",defaultValue:null,public:!0},rs.argumentNumber={createComponentOfType:"number",createStateVariable:"argumentNumber",defaultValue:null,public:!0},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.mathOperator={returnDependencies:()=>({type:{dependencyType:"stateVariable",variableName:"type"},operandNumber:{dependencyType:"stateVariable",variableName:"operandNumber"},argumentNumber:{dependencyType:"stateVariable",variableName:"argumentNumber"}}),definition({dependencyValues:ns}){return ns.type==="operand"?ns.operandNumber===null?(console.warn("Must specify a operandNumber when extracting a math operand"),{setValue:{mathOperator:ss=>Context.fromAst("_")}}):{setValue:{mathOperator:function(ss){let os=ss.tree;if(!Array.isArray(os)||os[0]==="apply")return ns.operandNumber===1?ss:Context.fromAst("_");let us=os[ns.operandNumber];return us===void 0?Context.fromAst("_"):Context.fromAst(us)}}}:ns.type==="function"?{setValue:{mathOperator:function(ss){let os=ss.tree;return!Array.isArray(os)||os[0]!=="apply"?Context.fromAst("_"):Context.fromAst(os[1])}}}:ns.type==="functionargument"?{setValue:{mathOperator:function(ss){let os=ss.tree;if(!Array.isArray(os)||os[0]!=="apply")return Context.fromAst("_");let us=os[2];if(ns.argumentNumber===null)return Context.fromAst(us);if(ns.argumentNumber===1)return Array.isArray(us)&&us[0]==="tuple"?Context.fromAst(us[1]):Context.fromAst(us);if(Array.isArray(us)&&us[0]==="tuple"){let cs=us[ns.argumentNumber];return cs===void 0?Context.fromAst("_"):Context.fromAst(cs)}else return Context.fromAst("_")}}}:ns.type==="numberofoperands"?{setValue:{mathOperator:function(ss){let os=ss.tree;return!Array.isArray(os)||os[0]==="apply"?Context.fromAst(1):Context.fromAst(os.length-1)}}}:{setValue:{mathOperator:ss=>Context.fromAst("_")}}}},rs}}zs(ExtractMath,"componentType","extractMath");function gcd(as,rs,...ns){return!rs&&ns.length>0?gcd(as,...ns):rs?gcd(rs,as%rs,...ns):as}const MathOperators=Object.freeze(Object.defineProperty({__proto__:null,Abs,Ceil,ClampNumber,ConvertSetToList,Count,ExtractMath,Floor,Gcd,Max,Mean,Min,Mod,Product,Round,Sign,StandardDeviation,Sum,Variance,WrapNumberPeriodic,setSmallToZero},Symbol.toStringTag,{value:"Module"}));function returnLabelStateVariableDefinitions(){let as={};return as.componentNameAndShadowSourceNames={returnDependencies:()=>({shadowSource:{dependencyType:"shadowSource",variableNames:["componentNameAndShadowSourceNames"]},unlinkedCopySource:{dependencyType:"unlinkedCopySource",variableNames:["componentNameAndShadowSourceNames"]}}),definition({dependencyValues:rs,componentName:ns}){var os,ls;let ss=[ns];return(os=rs.shadowSource)!=null&&os.stateValues.componentNameAndShadowSourceNames?ss.push(...rs.shadowSource.stateValues.componentNameAndShadowSourceNames):(ls=rs.unlinkedCopySource)!=null&&ls.stateValues.componentNameAndShadowSourceNames&&ss.push(...rs.unlinkedCopySource.stateValues.componentNameAndShadowSourceNames),{setValue:{componentNameAndShadowSourceNames:ss}}}},as.label={forRenderer:!0,public:!0,shadowingInstructions:{createComponentOfType:"label",addStateVariablesShadowingStateVariables:{hasLatex:{stateVariableToShadow:"labelHasLatex"}}},hasEssential:!0,doNotShadowEssential:!0,defaultValue:"",provideEssentialValuesInDefinition:!0,additionalStateVariablesDefined:[{variableName:"labelHasLatex",forRenderer:!0}],returnDependencies:()=>({labelChild:{dependencyType:"child",childGroups:["labels"],variableNames:["value","hasLatex"]},labelIsName:{dependencyType:"stateVariable",variableName:"labelIsName"},labelIsNameAttr:{dependencyType:"attributeComponent",attributeName:"labelIsName"},componentNameAndShadowSourceNames:{dependencyType:"stateVariable",variableName:"componentNameAndShadowSourceNames"},shadowSource:{dependencyType:"shadowSource",variableNames:["label","labelHasLatex"]}}),definition({dependencyValues:rs,essentialValues:ns}){var os;let ss=rs.labelChild[rs.labelChild.length-1];if(ss&&!ss.shadowDepth)return{setValue:{label:ss.stateValues.value,labelHasLatex:ss.stateValues.hasLatex}};if(ns.label!==void 0)return{useEssentialOrDefaultValue:{label:!0},setValue:{labelHasLatex:!1}};if(rs.labelIsName&&!rs.labelIsNameAttr.shadowDepth){let ls="__",us=rs.componentNameAndShadowSourceNames;for(let cs of us){let ds=cs.lastIndexOf("/");if(ls=cs.substring(ds+1),ls.slice(0,2)!=="__")break}return ls.slice(0,2)==="__"?{setValue:{label:"",labelHasLatex:!1}}:(ls[0]!=="_"&&(ls.includes("_")||ls.includes("-")?ls=ls.replace(/[_\-]/g," "):ls.match(/^[a-z]/)?ls.match(/[A-Z]/)&&(ls=ls.replace(/([A-Z])/g," $1").toLowerCase()):ls.match(/^[A-Z]/)&&ls.match(/[a-z]/)&&(ls=ls.replace(/([A-Z])/g," $1"),ls=ls.slice(1))),{setValue:{label:ls,labelHasLatex:!1}})}else return typeof((os=rs.shadowSource)==null?void 0:os.stateValues.label)=="string"?{setValue:{label:rs.shadowSource.stateValues.label,labelHasLatex:!!rs.shadowSource.stateValues.labelHasLatex}}:{useEssentialOrDefaultValue:{label:!0},setValue:{labelHasLatex:!1}}},inverseDefinition({desiredStateVariableValues:rs,dependencyValues:ns}){var ls;if(typeof rs.label!="string")return{success:!1};let ss=ns.labelChild.length-1,os=ns.labelChild[ss];return os&&!os.shadowDepth?{success:!0,instructions:[{setDependency:"labelChild",desiredValue:rs.label,childIndex:ss,variableIndex:0}]}:ns.labelIsName&&!ns.labelIsNameAttr.shadowDepth?{success:!0,instructions:[{setEssentialValue:"label",value:rs.label}]}:typeof((ls=ns.shadowSource)==null?void 0:ls.stateValues.label)=="string"?{success:!0,instructions:[{setDependency:"shadowSource",desiredValue:rs.label,variableIndex:0}]}:{success:!0,instructions:[{setEssentialValue:"label",value:rs.label}]}}},as.labelForGraph={forRenderer:!0,returnDependencies:()=>({label:{dependencyType:"stateVariable",variableName:"label"},labelHasLatex:{dependencyType:"stateVariable",variableName:"labelHasLatex"}}),definition({dependencyValues:rs}){let ns;if(rs.labelHasLatex){let ss=0;ns="";for(let os of rs.label)os==="("?ss++:os===")"?ss--:ss===0&&(os==="_"?os="_":os==="^"&&(os="^")),ns+=os}else ns=rs.label.replaceAll("_","_").replaceAll("^","^");return{setValue:{labelForGraph:ns}}}},as}class GraphicalComponent extends BaseComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.labelIsName={createComponentOfType:"boolean",createStateVariable:"labelIsName",defaultValue:!1,public:!0},rs.showLabel={createComponentOfType:"boolean",createStateVariable:"showLabel",defaultValue:!0,public:!0,forRenderer:!0},rs.applyStyleToLabel={createComponentOfType:"boolean",createStateVariable:"applyStyleToLabel",defaultValue:!1,public:!0,forRenderer:!0},rs.layer={createComponentOfType:"integer",createStateVariable:"layer",defaultValue:0,public:!0,forRenderer:!0,attributesForCreatedComponent:{valueOnNaN:0}},rs}static returnChildGroups(){return[{group:"labels",componentTypes:["label"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions(),ns=returnSelectedStyleStateVariableDefinition();Object.assign(rs,ns);let ss=returnLabelStateVariableDefinitions();return Object.assign(rs,ss),rs}}zs(GraphicalComponent,"componentType","_graphical");function createFunctionFromDefinition(as){if(as.functionType==="formula")return returnNumericalFunctionFromFormula({formula:Context.fromAst(as.formula),nInputs:as.nInputs,variables:as.variables.map(rs=>Context.fromAst(rs)),domain:as.domain?as.domain.map(rs=>Context.fromAst(rs)):null,component:as.component});if(as.functionType==="reevaluatedFormula"){let rs={};for(let ns in as.evaluateChildrenToReevaluate)rs[ns]={fReevaluate:createFunctionFromDefinition(as.evaluateChildrenToReevaluate[ns].fReevaluateDefinition),inputMathFs:as.evaluateChildrenToReevaluate[ns].inputMaths.map(ss=>Context.fromAst(ss).subscripts_to_strings().f())};return returnNumericalFunctionFromReevaluatedFormula({formulaExpressionWithCodes:Context.fromAst(as.formulaExpressionWithCodes),evaluateChildrenToReevaluate:rs,nInputs:as.nInputs,variables:as.variables.map(ns=>Context.fromAst(ns)),domain:as.domain?as.domain.map(ns=>Context.fromAst(ns)):null,component:as.component})}else return as.functionType==="numericForEvaluate"?returnNumericFunctionForEvaluate({nInputs:as.nInputs,numericalfs:as.fDefinitions.map(rs=>createFunctionFromDefinition(rs))}):as.functionType==="bezier"?returnBezierFunctions({nThroughPoints:as.nThroughPoints,numericalThroughPoints:as.numericalThroughPoints,splineCoeffs:as.splineCoeffs,extrapolateForward:as.extrapolateForward,extrapolateForwardCoeffs:as.extrapolateForwardCoeffs,extrapolateBackward:as.extrapolateBackward,extrapolateBackwardCoeffs:as.extrapolateBackwardCoeffs,component:as.component}):as.functionType==="interpolated"?returnInterpolatedFunction({xs:as.xs,coeffs:as.coeffs,interpolationPoints:as.interpolationPoints,domain:as.domain?as.domain.map(rs=>Context.fromAst(rs)):null}):as.functionType==="functionOperator"?returnFunctionOperatorFunction({componentType:as.componentType,functionOperatorArguments:as.functionOperatorArguments,operatorComposesWithOriginal:as.operatorComposesWithOriginal,originalFDefinition:as.originalFDefinition,nOutputs:as.nOutputs,component:as.component}):as.functionType==="ODESolution"?returnODESolutionFunction({nDimensions:as.nDimensions,t0:as.t0,x0s:as.x0s,chunkSize:as.chunkSize,tolerance:as.tolerance,numericalRHSfDefinitions:as.numericalRHSfDefinitions,maxIterations:as.maxIterations,component:as.component}):as.functionType==="piecewise"?returnPiecewiseNumericalFunctionFromChildren({numericalFsOfChildren:as.fDefinitionsOfChildren.map(rs=>createFunctionFromDefinition(rs)),numericalDomainsOfChildren:as.numericalDomainsOfChildren,domain:as.domain?as.domain.map(rs=>Context.fromAst(rs)):null,component:as.component}):()=>NaN}function returnNumericalFunctionFromFormula({formula:as,nInputs:rs,variables:ns,domain:ss,component:os=0}){if(os=Number(os),Array.isArray(as.tree)&&vectorOperators.includes(as.tree[0]))try{as=as.get_component(os)}catch{return()=>NaN}else if(os!==0)return()=>NaN;let us;try{us=as.subscripts_to_strings().f()}catch{return()=>NaN}if(rs===1){let hs=ns[0].subscripts_to_strings().tree,gs=-1/0,ys=1/0,bs=!1,vs=!1;if(ss!==null){let xs=ss[0];xs!==void 0&&(gs=Context.fromAst(xs.tree[1][1]).evaluate_to_constant(),typeof gs!="number"||Number.isNaN(gs)?gs=-1/0:bs=!xs.tree[2][1],ys=Context.fromAst(xs.tree[1][2]).evaluate_to_constant(),typeof ys!="number"||Number.isNaN(ys)?ys=1/0:vs=!xs.tree[2][2])}return function(xs,Cs=!1){if(Cs){if(isNaN(xs))return NaN}else if(!(xs>=gs)||!(xs<=ys)||bs&&xs===gs||vs&&xs===ys)return NaN;try{return us({[hs]:xs})}catch{return NaN}}}let cs=[];for(let hs=0;hs=vs)||!(bs<=xs)||Cs&&bs===vs||Ts&&bs===xs)return NaN}gs[cs[ys]]=bs}try{return us(gs)}catch{return NaN}}}function returnNumericalFunctionFromReevaluatedFormula({formulaExpressionWithCodes:as,evaluateChildrenToReevaluate:rs,nInputs:ns,variables:ss,domain:os,component:ls=0}){if(ls=Number(ls),Array.isArray(as.tree)&&vectorOperators.includes(as.tree[0]))try{as=as.get_component(Number(ls))}catch{return()=>NaN}else if(ls!==0)return()=>NaN;let cs;try{cs=as.subscripts_to_strings().f()}catch{return()=>NaN}if(ns===1){let gs=ss[0].subscripts_to_strings().tree,ys=-1/0,bs=1/0,vs=!1,xs=!1;if(os!==null){let Cs=os[0];Cs!==void 0&&(ys=Context.fromAst(Cs.tree[1][1]).evaluate_to_constant(),typeof ys!="number"||Number.isNaN(ys)?ys=-1/0:vs=!Cs.tree[2][1],bs=Context.fromAst(Cs.tree[1][2]).evaluate_to_constant(),typeof bs!="number"||Number.isNaN(bs)?bs=1/0:xs=!Cs.tree[2][2])}return function(Cs,Ts=!1){if(Ts){if(isNaN(Cs))return NaN}else if(!(Cs>=ys)||!(Cs<=bs)||vs&&Cs===ys||xs&&Cs===bs)return NaN;let Ss={[gs]:Cs},Ns={[gs]:Cs};for(let As in rs){let ws=rs[As].fReevaluate,Es=rs[As].inputMathFs;try{let _s=Es.map($s=>Context.fromAst($s(Ss)));Ns[As]=ws(_s).evaluate_to_constant()}catch{return NaN}}try{return cs(Ns)}catch{return NaN}}}let ds=[];for(let gs=0;gs=Cs)||!(xs<=Ts)||Ss&&xs===Cs||Ns&&xs===Ts)return NaN}ys[ds[vs]]=xs}let bs={...ys};for(let vs in rs){let xs=rs[vs].fReevaluate,Cs=rs[vs].inputMathFs;try{let Ts=Cs.map(Ss=>Context.fromAst(Ss(bs)));ys[vs]=xs(Ts).evaluate_to_constant()}catch{return NaN}}try{return cs(ys)}catch{return NaN}}}function returnPiecewiseNumericalFunctionFromChildren({numericalFsOfChildren:as,numericalDomainsOfChildren:rs,domain:ns,component:ss=0}){if(ss=Number(ss),ss!==0)return()=>NaN;let os=-1/0,ls=1/0,us=!1,cs=!1;if(ns!==null){let ds=ns[0];ds!==void 0&&(os=Context.fromAst(ds.tree[1][1]).evaluate_to_constant(),typeof os!="number"||Number.isNaN(os)?os=-1/0:us=!ds.tree[2][1],ls=Context.fromAst(ds.tree[1][2]).evaluate_to_constant(),typeof ls!="number"||Number.isNaN(ls)?ls=1/0:cs=!ds.tree[2][2])}return function(ds,ps=!1){if(ps){if(isNaN(ds))return NaN}else if(!(ds>=os)||!(ds<=ls)||us&&ds===os||cs&&ds===ls)return NaN;for(let[fs,hs]of rs.entries()){let gs=hs[0][0],ys=hs[0][1],bs=hs[1][0],vs=hs[1][1];if((ds>gs||bs&&ds===gs)&&(dsContext.fromAst("_")}else if(us!==0)return()=>Context.fromAst("_");let ds=as.subscripts_to_strings();if(os===1){let ys=ls[0].subscripts_to_strings().tree,bs=-1/0,vs=1/0,xs=!1,Cs=!1;if(ss!==null){let Ts=ss[0];Ts!==void 0&&(bs=Context.fromAst(Ts.tree[1][1]).evaluate_to_constant(),typeof bs!="number"||Number.isNaN(bs)?bs=-1/0:xs=!Ts.tree[2][1],vs=Context.fromAst(Ts.tree[1][2]).evaluate_to_constant(),typeof vs!="number"||Number.isNaN(vs)?vs=1/0:Cs=!Ts.tree[2][2])}return function(Ts,Ss=!1){if(!Ss){let Ns=Ts.evaluate_to_constant();if(!Number.isNaN(Ns)&&(!(Ns>=bs)||!(Ns<=vs)||xs&&Ns===bs||Cs&&Ns===vs))return Context.fromAst("_")}return normalizeMathExpression({value:ds.substitute({[ys]:Ts}).strings_to_subscripts(),simplify:rs,expand:ns})}}let ps=[];for(let ys=0;ys=Ns)||!(Ss<=As)||ws&&Ss===Ns||Es&&Ss===As)&&(vs=!0)}}bs[ps[Cs]]=Ts}return xs&&vs?Context.fromAst("_"):normalizeMathExpression({value:ds.substitute(bs).strings_to_subscripts(),simplify:rs,expand:ns})}}function returnSymbolicFunctionFromReevaluatedFormula({formulaExpressionWithCodes:as,evaluateChildrenToReevaluate:rs,simplify:ns,expand:ss,nInputs:os,variables:ls,domain:us,component:cs=0}){if(cs=Number(cs),Array.isArray(as.tree)&&vectorOperators.includes(as.tree[0]))try{as=as.get_component(cs)}catch{return()=>Context.fromAst("_")}else if(cs!==0)return()=>Context.fromAst("_");let ps=as.subscripts_to_strings();if(os===1){let bs=ls[0].subscripts_to_strings().tree,vs=-1/0,xs=1/0,Cs=!1,Ts=!1;if(us!==null){let Ss=us[0];Ss!==void 0&&(vs=Context.fromAst(Ss.tree[1][1]).evaluate_to_constant(),typeof vs!="number"||Number.isNaN(vs)?vs=-1/0:Cs=!Ss.tree[2][1],xs=Context.fromAst(Ss.tree[1][2]).evaluate_to_constant(),typeof xs!="number"||Number.isNaN(xs)?xs=1/0:Ts=!Ss.tree[2][2])}return function(Ss,Ns=!1){if(!Ns){let Es=Ss.evaluate_to_constant();if(!Number.isNaN(Es)&&(!(Es>=vs)||!(Es<=xs)||Cs&&Es===vs||Ts&&Es===xs))return Context.fromAst("_")}let As={[bs]:Ss.tree},ws={[bs]:Ss};for(let Es in rs){let _s=rs[Es].fReevaluate,$s=rs[Es].inputMathFs;try{let Rs=$s.map(Is=>Context.fromAst(Is(As)));ws[Es]=_s(Rs)}catch{return NaN}}return normalizeMathExpression({value:ps.substitute(ws).strings_to_subscripts(),simplify:ns,expand:ss})}}let fs=[];for(let bs=0;bs=ws)||!(As<=Es)||_s&&As===ws||$s&&As===Es)&&(Cs=!0)}}vs[fs[Ss]]=Ns,xs[fs[Ss]]=Ns.tree}if(Ts&&Cs)return Context.fromAst("_");for(let Ss in rs){let Ns=rs[Ss].fReevaluate,As=rs[Ss].inputMathFs;try{let ws=As.map(Es=>Context.fromAst(Es(xs)));vs[Ss]=Ns(ws)}catch{return NaN}}return normalizeMathExpression({value:ps.substitute(vs).strings_to_subscripts(),simplify:ns,expand:ss})}}function returnSymbolicFunctionForEvaluate({symbolicfs:as,nInputs:rs}){return function(ns){if(ns.length===1){let ls=ns[0].tree;Array.isArray(ls)&&vectorOperators.includes(ls[0])&&(ns=ls.slice(1).map(us=>Context.fromAst(us)))}if(ns.length!==rs)return Context.fromAst("_");let ss=as.map(ls=>ls(...ns).tree),os;return ss.length===1?os=Context.fromAst(ss[0]):os=Context.fromAst(["vector",...ss]),os}}function returnNumericFunctionForEvaluate({numericalfs:as,nInputs:rs}){return function(ns){if(ns.length===1){let us=ns[0].tree;Array.isArray(us)&&vectorOperators.includes(us[0])&&(ns=us.slice(1).map(cs=>Context.fromAst(cs)))}if(ns.length!==rs)return Context.fromAst("_");let ss=ns.map(us=>us.evaluate_to_constant()),os=as.map(us=>us(...ss)),ls;return os.length===1?ls=Context.fromAst(os[0]):ls=Context.fromAst(["vector",...os]),ls}}function returnBezierFunctions({nThroughPoints:as,numericalThroughPoints:rs,splineCoeffs:ns,extrapolateForward:ss,extrapolateForwardCoeffs:os,extrapolateBackward:ls,extrapolateBackwardCoeffs:us,component:cs}){if(as<1)return()=>NaN;let ds=as-1,ps=rs[ds][cs],fs=ns.map(ys=>ys[cs]),hs;ls&&(hs=us[cs]);let gs;return ss&&(gs=os[cs]),function(ys){if(isNaN(ys))return NaN;if(ys<0)return ls?(hs[2]*ys+hs[1])*ys+hs[0]:NaN;if(ys>=ds)return ss?(ys-=ds,(gs[2]*ys+gs[1])*ys+gs[0]):ys===ds?ps:NaN;let bs=Math.floor(ys);ys-=bs;let vs=fs[bs];return((vs[3]*ys+vs[2])*ys+vs[1])*ys+vs[0]}}function returnInterpolatedFunction({xs:as,coeffs:rs,interpolationPoints:ns,domain:ss}){let os=[];if(ns&&(os=ns.map(hs=>hs.y)),as===null)return()=>NaN;let ls=-1/0,us=1/0,cs=!1,ds=!1;if(ss!==null){let hs=ss[0];hs!==void 0&&(ls=Context.fromAst(hs.tree[1][1]).evaluate_to_constant(),typeof ls!="number"||Number.isNaN(ls)?ls=-1/0:cs=!hs.tree[2][1],us=Context.fromAst(hs.tree[1][2]).evaluate_to_constant(),typeof us!="number"||Number.isNaN(us)?us=1/0:ds=!hs.tree[2][2])}let ps=as[0],fs=as[as.length-1];return function(hs,gs=!1){if(gs){if(isNaN(hs))return NaN}else if(!(hs>=ls)||!(hs<=us)||cs&&hs===ls||ds&&hs===us)return NaN;if(hs<=ps){hs-=ps;let Ts=rs[0];return((Ts[3]*hs+Ts[2])*hs+Ts[1])*hs+Ts[0]}if(hs>=fs){let Ts=as.length-2;hs-=as[Ts];let Ss=rs[Ts];return((Ss[3]*hs+Ss[2])*hs+Ss[1])*hs+Ss[0]}for(var ys=0,bs,vs=as.length-1;ys<=vs;){bs=Math.floor(.5*(ys+vs));let Ts=as[bs];if(Tshs)vs=bs-1;else return os[bs]}let xs=Math.max(0,vs);hs-=as[xs];let Cs=rs[xs];return((Cs[3]*hs+Cs[2])*hs+Cs[1])*hs+Cs[0]}}function returnReturnDerivativesOfInterpolatedFunction({xs:as,coeffs:rs,variables:ns}){if(!as)return()=>NaN;let ss=ns[0].subscripts_to_strings().tree,os=as[0],ls=as[as.length-1];return function(us){let cs=us.map(ps=>ps.subscripts_to_strings().tree),ds=cs.length;return ds>3||!cs.every(ps=>ps===ss)||cs.includes("_")?()=>0:ds===0||as===null?()=>NaN:function(ps){if(isNaN(ps))return NaN;if(ps<=os){ps-=os;let vs=rs[0];return ds===1?(3*vs[3]*ps+2*vs[2])*ps+vs[1]:ds===2?6*vs[3]*ps+2*vs[2]:6*vs[3]}if(ps>=ls){let vs=as.length-2;ps-=as[vs];let xs=rs[vs];return ds===1?(3*xs[3]*ps+2*xs[2])*ps+xs[1]:ds===2?6*xs[3]*ps+2*xs[2]:6*xs[3]}for(var fs=0,hs,gs=as.length-1;fs<=gs;){hs=Math.floor(.5*(fs+gs));let vs=as[hs];if(vsps)gs=hs-1;else return ds===1?rs[hs][1]:ds===2?2*rs[hs][2]:6*rs[hs][3]}let ys=Math.max(0,gs);ps-=as[ys];let bs=rs[ys];return ds===1?(3*bs[3]*ps+2*bs[2])*ps+bs[1]:ds===2?6*bs[3]*ps+2*bs[2]:6*bs[3]}}}function returnFunctionOperatorFunction({componentType:as,functionOperatorArguments:rs,operatorComposesWithOriginal:ns,originalFDefinition:ss,nOutputs:os,component:ls}){if(ns){let us=[];for(let ds=0;dscs(...us.map(ps=>ps(...ds)))}else return functionOperatorDefinitions[as](...rs)}var functionOperatorDefinitions={clampFunction:function(as,rs){return function(ns){return Number.isFinite(ns)?Math.max(as,Math.min(rs,ns)):NaN}},wrapFunctionPeriodic:function(as,rs){return function(ns){if(!Number.isFinite(ns))return NaN;let ss=as,os=rs;return ss===os?ss:(ss>os&&([os,ss]=[ss,os]),ss+Context.math.mod(ns-ss,os-ss))}},derivative:function(as,rs){if(as.derivativeType==="interpolatedFunction"){let ns=returnReturnDerivativesOfInterpolatedFunction({xs:as.xs,coeffs:as.coeffs,variables:as.variables.map(convertValueToMathExpression)}),ss=rs.map(convertValueToMathExpression);if(as.additionalDerivVariables&&(ss=[...as.additionalDerivVariables.map(convertValueToMathExpression),...ss]),as.variableMappings)for(let ls of as.variableMappings){let us=[];for(let cs of ss){let ds=ls[cs.subscripts_to_strings().tree];ds?us.push(convertValueToMathExpression(ds)):us.push(Context.fromAst("_"))}ss=us}return ns(ss)}else return()=>NaN}};function returnODESolutionFunction({nDimensions:as,t0:rs,x0s:ns,chunkSize:ss,tolerance:os,numericalRHSfDefinitions:ls,maxIterations:us,component:cs}){var ds={};ds.calculatedNumericSolutions=[],ds.endingNumericalValues=[],ds.maxPossibleTime=void 0;let ps=ls.map(hs=>createFunctionFromDefinition(hs)),fs=function(hs,gs){let ys=[hs];Array.isArray(gs)?ys.push(...gs):ys.push(gs);try{return ps.map(bs=>bs(...ys))}catch{return NaN}};return function(gs){if(!Number.isFinite(gs))return NaN;if(gs===rs)return ns[cs];let ys=ds.calculatedNumericSolutions.length,bs=Math.ceil((gs-rs)/ss)-1;if(bs<0)return NaN;if(ds.maxPossibleTime===void 0&&bs>=ys)for(let xs=ys;xs<=bs;xs++){let Cs=ds.endingNumericalValues[xs-1];Cs===void 0&&(Cs=ns);let Ts=rs+xs*ss,Ss=Context.math.dopri(Ts,Ts+ss,Cs,fs,os,us);ds.endingNumericalValues.push(Ss.y[Ss.y.length-1]),ds.calculatedNumericSolutions.push(Ss.at.bind(Ss));let Ns=Ss.x[Ss.x.length-1];if(Ns<(Ts+ss)*(1-1e-6)){ds.maxPossibleTime=Ns;break}}return gs>ds.maxPossibleTime?NaN:ds.calculatedNumericSolutions[bs](gs)[cs]}}var ku;let Function$1=(ku=class extends InlineComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.simplify={createComponentOfType:"text",createStateVariable:"simplifySpecified",defaultValue:"full",toLowerCase:!0,valueTransformations:{"":"full",true:"full",false:"none"},validValues:["none","full","numbers","numberspreserveorder"]},rs.expand={createComponentOfType:"boolean",createStateVariable:"expandSpecified",defaultValue:!1,public:!0},rs.xscale={createComponentOfType:"number",createStateVariable:"xscale",defaultValue:1,public:!0},rs.yscale={createComponentOfType:"number",createStateVariable:"yscale",defaultValue:1,public:!0},rs.nInputs={createComponentOfType:"integer"},rs.nOutputs={createComponentOfType:"integer"},rs.domain={createComponentOfType:"_intervalListComponent"},rs.labelIsName={createComponentOfType:"boolean",createStateVariable:"labelIsName",defaultValue:!1,public:!0},rs.showLabel={createComponentOfType:"boolean",createStateVariable:"showLabel",defaultValue:!0,public:!0,forRenderer:!0},rs.applyStyleToLabel={createComponentOfType:"boolean",createStateVariable:"applyStyleToLabel",defaultValue:!1,public:!0,forRenderer:!0},rs.labelPosition={createComponentOfType:"text",createStateVariable:"labelPosition",defaultValue:"upperright",public:!0,forRenderer:!0,toLowerCase:!0,validValues:["upperright","upperleft","lowerright","lowerleft","top","bottom","left","right"]},rs.layer={createComponentOfType:"number",createStateVariable:"layer",defaultValue:0,public:!0,forRenderer:!0},rs.minima={createComponentOfType:"extrema"},rs.maxima={createComponentOfType:"extrema"},rs.extrema={createComponentOfType:"extrema"},rs.through={createComponentOfType:"_pointListComponent"},rs.throughSlopes={createComponentOfType:"mathList"},rs.variables={createComponentOfType:"variables"},rs.symbolic={createComponentOfType:"boolean"},rs.displayDigits={createComponentOfType:"integer"},rs.displayDecimals={createComponentOfType:"integer"},rs.displaySmallAsZero={createComponentOfType:"number",valueForTrue:1e-14,valueForFalse:0},rs.padZeros={createComponentOfType:"boolean"},rs.nearestPointAsCurve={createComponentOfType:"boolean",createStateVariable:"nearestPointAsCurve",defaultValue:!1},rs}static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=function({matchedChildren:ss,componentInfoObjects:os}){let ls=fs=>os.componentIsSpecifiedType(fs,"label"),us=ss.map(ls),cs=[],ds=[],ps=[];if(us.filter(fs=>fs).length===0)cs=ss;else{if(us[0]){let hs=us.indexOf(!1);hs!==-1&&(ds=ss.slice(0,hs),ss=ss.slice(hs),us=us.slice(hs))}let fs=us.indexOf(!0);fs===-1?cs=ss:(cs=ss.slice(0,fs),ps=ss.slice(fs))}return cs.length===1&&typeof cs[0]!="string"||cs.length===0?{success:!1}:{success:!0,newChildren:[...ds,{componentType:"math",children:cs},...ps]}};return rs.push({replacementFunction:ns}),rs}static returnChildGroups(){return[{group:"maths",componentTypes:["math"]},{group:"functions",componentTypes:["function"]},{group:"labels",componentTypes:["label"]}]}static returnStateVariableDefinitions({numerics:rs}){let ns=GraphicalComponent.returnStateVariableDefinitions();return ns.styleDescription={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({selectedStyle:{dependencyType:"stateVariable",variableName:"selectedStyle"},document:{dependencyType:"ancestor",componentType:"document",variableNames:["theme"]}}),definition:function({dependencyValues:ss}){var us;let os;((us=ss.document)==null?void 0:us.stateValues.theme)==="dark"?os=ss.selectedStyle.lineColorWordDarkMode:os=ss.selectedStyle.lineColorWord;let ls=ss.selectedStyle.lineWidthWord;return ss.selectedStyle.lineStyleWord&&(ls&&(ls+=" "),ls+=ss.selectedStyle.lineStyleWord),ls&&(ls+=" "),ls+=os,{setValue:{styleDescription:ls}}}},ns.styleDescriptionWithNoun={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({styleDescription:{dependencyType:"stateVariable",variableName:"styleDescription"}}),definition:function({dependencyValues:ss}){return{setValue:{styleDescriptionWithNoun:ss.styleDescription+" function"}}}},ns.displayDigits={public:!0,shadowingInstructions:{createComponentOfType:"integer"},defaultValue:10,hasEssential:!0,returnDependencies:()=>({displayDigitsAttr:{dependencyType:"attributeComponent",attributeName:"displayDigits",variableNames:["value"]},displayDecimalsAttr:{dependencyType:"attributeComponent",attributeName:"displayDecimals",variableNames:["value"]},functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["displayDigits"]}}),definition({dependencyValues:ss,usedDefault:os}){if(ss.displayDigitsAttr!==null){let ls=os.displayDigitsAttr,us=ss.displayDecimalsAttr===null||os.displayDecimalsAttr;if(!(ls||us)){let cs=ss.displayDigitsAttr.shadowDepth;ss.displayDecimalsAttr.shadowDepth0){let ls=os.functionChild[0],us=ss.displayDecimalsAttr===null||os.displayDecimalsAttr;return ls||us||(ls=!0),ls?{useEssentialOrDefaultValue:{displayDigits:{defaultValue:ss.functionChild[0].stateValues.displayDigits}}}:{setValue:{displayDigits:ss.functionChild[0].stateValues.displayDigits}}}else return{useEssentialOrDefaultValue:{displayDigits:!0}}}},ns.displayDecimals={public:!0,shadowingInstructions:{createComponentOfType:"integer"},defaultValue:null,hasEssential:!0,returnDependencies:()=>({displayDecimalsAttr:{dependencyType:"attributeComponent",attributeName:"displayDecimals",variableNames:["value"]},functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["displayDecimals"]}}),definition({dependencyValues:ss,usedDefault:os}){return ss.displayDecimalsAttr!==null?{setValue:{displayDecimals:ss.displayDecimalsAttr.stateValues.value}}:ss.functionChild.length>0&&!os.functionChild[0]?{setValue:{displayDecimals:ss.functionChild[0].stateValues.displayDecimals}}:{useEssentialOrDefaultValue:{displayDecimals:!0}}}},ns.displaySmallAsZero={public:!0,shadowingInstructions:{createComponentOfType:"number"},defaultValue:0,hasEssential:!0,returnDependencies:()=>({displaySmallAsZeroAttr:{dependencyType:"attributeComponent",attributeName:"displaySmallAsZero",variableNames:["value"]},functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["displaySmallAsZero"]}}),definition({dependencyValues:ss,usedDefault:os}){return ss.displaySmallAsZeroAttr!==null?{setValue:{displaySmallAsZero:ss.displaySmallAsZeroAttr.stateValues.value}}:ss.functionChild.length>0&&!os.functionChild[0]?{setValue:{displaySmallAsZero:ss.functionChild[0].stateValues.displaySmallAsZero}}:{useEssentialOrDefaultValue:{displaySmallAsZero:!0}}}},ns.padZeros={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},defaultValue:!1,hasEssential:!0,returnDependencies:()=>({padZerosAttr:{dependencyType:"attributeComponent",attributeName:"padZeros",variableNames:["value"]},functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["padZeros"]}}),definition({dependencyValues:ss,usedDefault:os}){return ss.padZerosAttr!==null?{setValue:{padZeros:ss.padZerosAttr.stateValues.value}}:ss.functionChild.length>0&&!os.functionChild[0]?{setValue:{padZeros:ss.functionChild[0].stateValues.padZeros}}:{useEssentialOrDefaultValue:{padZeros:!0}}}},ns.isInterpolatedFunction={returnDependencies:()=>({through:{dependencyType:"attributeComponent",attributeName:"through"},minima:{dependencyType:"attributeComponent",attributeName:"minima"},maxima:{dependencyType:"attributeComponent",attributeName:"maxima"},extrema:{dependencyType:"attributeComponent",attributeName:"extrema"}}),definition({dependencyValues:ss}){return{setValue:{isInterpolatedFunction:ss.through||ss.minima||ss.maxima||ss.extrema}}}},ns.nInputs={public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies:()=>({nInputsAttr:{dependencyType:"attributeComponent",attributeName:"nInputs",variableNames:["value"]},functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["nInputs"]},variablesAttr:{dependencyType:"attributeComponent",attributeName:"variables",variableNames:["nComponents"]},isInterpolatedFunction:{dependencyType:"stateVariable",variableName:"isInterpolatedFunction"}}),definition({dependencyValues:ss}){if(ss.isInterpolatedFunction)return{setValue:{nInputs:1}};if(ss.nInputsAttr!==null){let os=ss.nInputsAttr.stateValues.value;return os>=0||(os=1),{setValue:{nInputs:os}}}else return ss.variablesAttr!==null?{setValue:{nInputs:Math.max(1,ss.variablesAttr.stateValues.nComponents)}}:ss.functionChild.length>0?{setValue:{nInputs:ss.functionChild[0].stateValues.nInputs}}:{setValue:{nInputs:1}}}},ns.nOutputs={defaultValue:1,hasEssential:!0,public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies:()=>({nOutputsAttr:{dependencyType:"attributeComponent",attributeName:"nOutputs",variableNames:["value"]},functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["nOutputs"]},mathChild:{dependencyType:"child",childGroups:["maths"],variableNames:["value"]}}),definition({dependencyValues:ss}){if(ss.functionChild.length>0)return{setValue:{nOutputs:ss.functionChild[0].stateValues.nOutputs}};if(ss.nOutputsAttr!==null){let os=ss.nOutputsAttr.stateValues.value;return os>=0||(os=1),{setValue:{nOutputs:os}}}else if(ss.mathChild.length>0){let os=ss.mathChild[0].stateValues.value,ls=Array.isArray(os.tree)&&vectorOperators.includes(os.tree[0]),us=1;return ls&&(us=os.tree.length-1),{setValue:{nOutputs:us}}}else return{useEssentialOrDefaultValue:{nOutputs:!0}}}},ns.domain={returnDependencies:()=>({domainAttr:{dependencyType:"attributeComponent",attributeName:"domain",variableNames:["intervals"]},functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["domain"]},nInputs:{dependencyType:"stateVariable",variableName:"nInputs"}}),definition({dependencyValues:ss}){if(ss.domainAttr!==null){let os=ss.nInputs,ls=ss.domainAttr.stateValues.intervals.slice(0,os);return ls.length!==os?{setValue:{domain:null}}:ls.every(us=>Array.isArray(us.tree)&&us.tree[0]==="interval")?{setValue:{domain:ls}}:{setValue:{domain:null}}}else return ss.functionChild.length>0?{setValue:{domain:ss.functionChild[0].stateValues.domain}}:{setValue:{domain:null}}}},ns.simplify={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({simplifySpecified:{dependencyType:"stateVariable",variableName:"simplifySpecified"},functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["simplify"]}}),definition({dependencyValues:ss,usedDefault:os}){return os.simplifySpecified&&ss.functionChild.length>0?{setValue:{simplify:ss.functionChild[0].stateValues.simplify}}:{setValue:{simplify:ss.simplifySpecified}}},inverseDefinition({desiredStateVariableValues:ss,dependencyValues:os,usedDefault:ls}){return ls.simplifySpecified&&os.functionChild.length>0?{success:!0,instructions:[{setDependency:"functionChild",desiredValue:ss.simplify,childIndex:0,variableIndex:0}]}:{success:!0,instructions:[{setDependency:"simplifySpecified",desiredValue:ss.simplify}]}}},ns.expand={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({expandSpecified:{dependencyType:"stateVariable",variableName:"expandSpecified"},functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["expand"]}}),definition({dependencyValues:ss,usedDefault:os}){return os.expandSpecified&&ss.functionChild.length>0?{setValue:{expand:ss.functionChild[0].stateValues.expand}}:{setValue:{expand:ss.expandSpecified}}},inverseDefinition({desiredStateVariableValues:ss,dependencyValues:os,usedDefault:ls}){return ls.expandSpecified&&os.functionChild.length>0?{success:!0,instructions:[{setDependency:"functionChild",desiredValue:ss.expand,childIndex:0,variableIndex:0}]}:{success:!0,instructions:[{setDependency:"expandSpecified",desiredValue:ss.expand}]}}},ns.numericalfShadow={defaultValue:null,hasEssential:!0,returnDependencies:()=>({}),definition:()=>({useEssentialOrDefaultValue:{numericalfShadow:!0}})},ns.symbolicfShadow={defaultValue:null,hasEssential:!0,returnDependencies:()=>({}),definition:()=>({useEssentialOrDefaultValue:{symbolicfShadow:!0}})},ns.symbolic={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},defaultValue:!0,hasEssential:!0,returnDependencies:()=>({symbolicAttr:{dependencyType:"attributeComponent",attributeName:"symbolic",variableNames:["value"]},functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["symbolic"]},numericalfShadow:{dependencyType:"stateVariable",variableName:"numericalfShadow"},symbolicfShadow:{dependencyType:"stateVariable",variableName:"symbolicfShadow"}}),definition({dependencyValues:ss}){return ss.symbolicAttr!==null?{setValue:{symbolic:ss.symbolicAttr.stateValues.value}}:ss.functionChild.length>0?{setValue:{symbolic:ss.functionChild[0].stateValues.symbolic}}:ss.numericalfShadow?{setValue:{symbolic:!1}}:ss.symbolicfShadow?{setValue:{symbolic:!0}}:{useEssentialOrDefaultValue:{symbolic:!0}}}},ns.variables={isArray:!0,public:!0,shadowingInstructions:{createComponentOfType:"variable"},entryPrefixes:["variable"],returnArraySizeDependencies:()=>({nInputs:{dependencyType:"stateVariable",variableName:"nInputs"}}),returnArraySize({dependencyValues:ss}){return[ss.nInputs]},returnArrayDependenciesByKey({arrayKeys:ss}){let os={variablesAttr:{dependencyType:"attributeComponent",attributeName:"variables",variableNames:["variables"]},parentVariableForChild:{dependencyType:"parentStateVariable",variableName:"variableForChild"},functionChild:{dependencyType:"child",childGroups:["functions"]}},ls={};for(let us of ss)ls[us]={functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["variable"+(Number(us)+1)]}};return{globalDependencies:os,dependenciesByKey:ls}},arrayDefinitionByKey({globalDependencyValues:ss,dependencyValuesByKey:os,arraySize:ls,arrayKeys:us,usedDefault:cs}){if(ss.variablesAttr!==null){let ds=ss.variablesAttr.stateValues.variables;return{setValue:{variables:returnNVariables(ls[0],ds)}}}else if(ss.functionChild.length>0){let ds={};for(let ps of us)ds[ps]=os[ps].functionChild[0].stateValues["variable"+(Number(ps)+1)];return{setValue:{variables:ds}}}else return ss.parentVariableForChild&&!cs.parentVariableForChild?{setValue:{variables:Array(ls[0]).fill(ss.parentVariableForChild)}}:{setValue:{variables:returnNVariables(ls[0],[])}}}},ns.variable={isAlias:!0,targetVariableName:"variable1"},ns.formula={public:!0,shadowingInstructions:{createComponentOfType:"math",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"]},defaultValue:Context.fromAst(0),hasEssential:!0,returnDependencies:()=>({mathChild:{dependencyType:"child",childGroups:["maths"],variableNames:["value","formula"],variablesOptional:!0},functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["formula"]},isInterpolatedFunction:{dependencyType:"stateVariable",variableName:"isInterpolatedFunction"}}),definition:function({dependencyValues:ss,usedDefault:os}){return ss.isInterpolatedFunction?{setValue:{formula:Context.fromAst("_")}}:ss.mathChild.length>0?{setValue:{formula:ss.mathChild[0].stateValues.value}}:ss.functionChild.length>0&&!os.functionChild[0].formula?{setValue:{formula:ss.functionChild[0].stateValues.formula}}:{useEssentialOrDefaultValue:{formula:!0}}}},ns.nPrescribedPoints={returnDependencies:()=>({through:{dependencyType:"attributeComponent",attributeName:"through",variableNames:["nPoints"]}}),definition({dependencyValues:ss}){let os=0;return ss.through!==null&&(os=ss.through.stateValues.nPoints),{setValue:{nPrescribedPoints:os}}}},ns.prescribedPoints={isArray:!0,entryPrefixes:["prescribedPoint"],returnArraySizeDependencies:()=>({nPrescribedPoints:{dependencyType:"stateVariable",variableName:"nPrescribedPoints"}}),returnArraySize({dependencyValues:ss}){return[ss.nPrescribedPoints]},returnArrayDependenciesByKey({arrayKeys:ss}){let os={};for(let ls of ss){let us=Number(ls)+1;os[ls]={through:{dependencyType:"attributeComponent",attributeName:"through",variableNames:["point"+us]},throughSlopes:{dependencyType:"attributeComponent",attributeName:"throughSlopes",variableNames:["math"+us]}}}return{dependenciesByKey:os}},arrayDefinitionByKey({dependencyValuesByKey:ss,arrayKeys:os}){let ls={};for(let us of os){let cs=ss[us].through;if(cs!==null){let ds=Number(us)+1,ps=cs.stateValues["point"+ds],fs=null,hs=ss[us].throughSlopes;hs!==null&&(fs=hs.stateValues["math"+ds],fs===void 0&&(fs=null)),ls[us]={x:ps[0],y:ps[1],slope:fs}}}return{setValue:{prescribedPoints:ls}}}},ns.prescribedMinima={returnDependencies:()=>({minima:{dependencyType:"attributeComponent",attributeName:"minima",variableNames:["extrema"]}}),definition({dependencyValues:ss}){let os=[];return ss.minima!==null&&(os=ss.minima.stateValues.extrema.map(ls=>({x:ls[0],y:ls[1]}))),{setValue:{prescribedMinima:os}}}},ns.prescribedMaxima={returnDependencies:()=>({maxima:{dependencyType:"attributeComponent",attributeName:"maxima",variableNames:["extrema"]}}),definition({dependencyValues:ss}){let os=[];return ss.maxima!==null&&(os=ss.maxima.stateValues.extrema.map(ls=>({x:ls[0],y:ls[1]}))),{setValue:{prescribedMaxima:os}}}},ns.prescribedExtrema={returnDependencies:()=>({extrema:{dependencyType:"attributeComponent",attributeName:"extrema",variableNames:["extrema"]}}),definition({dependencyValues:ss}){let os=[];return ss.extrema!==null&&(os=ss.extrema.stateValues.extrema.map(ls=>({x:ls[0],y:ls[1]}))),{setValue:{prescribedExtrema:os}}}},ns.interpolationPoints={returnDependencies:()=>({xscale:{dependencyType:"stateVariable",variableName:"xscale"},yscale:{dependencyType:"stateVariable",variableName:"yscale"},prescribedPoints:{dependencyType:"stateVariable",variableName:"prescribedPoints"},prescribedMinima:{dependencyType:"stateVariable",variableName:"prescribedMinima"},prescribedMaxima:{dependencyType:"stateVariable",variableName:"prescribedMaxima"},prescribedExtrema:{dependencyType:"stateVariable",variableName:"prescribedExtrema"}}),definition:({dependencyValues:ss})=>calculateInterpolationPoints({dependencyValues:ss,numerics:rs})},ns.xs={additionalStateVariablesDefined:["coeffs"],returnDependencies:()=>({interpolationPoints:{dependencyType:"stateVariable",variableName:"interpolationPoints"}}),definition:computeSplineParamCoeffs},ns.mathChildName={returnDependencies(){return{mathChild:{dependencyType:"child",childGroups:["maths"]}}},definition({dependencyValues:ss}){return ss.mathChild.length>0?{setValue:{mathChildName:ss.mathChild[0].componentName}}:{setValue:{mathChildName:null}}}},ns.mathChildCreatedBySugar={stateVariablesDeterminingDependencies:["mathChildName"],returnDependencies({stateValues:ss}){return ss.mathChildName?{mathChildCreatedBySugar:{dependencyType:"doenetAttribute",componentName:ss.mathChildName,attributeName:"createdFromSugar"}}:{}},definition({dependencyValues:ss}){return{setValue:{mathChildCreatedBySugar:!!ss.mathChildCreatedBySugar}}}},ns.symbolicfs={isArray:!0,entryPrefixes:["symbolicf"],stateVariablesDeterminingDependencies:["isInterpolatedFunction","mathChildName","mathChildCreatedBySugar"],returnArraySizeDependencies:()=>({nOutputs:{dependencyType:"stateVariable",variableName:"nOutputs"}}),returnArraySize({dependencyValues:ss}){return[ss.nOutputs]},returnArrayDependenciesByKey({stateValues:ss}){if(ss.isInterpolatedFunction)return{globalDependencies:{xs:{dependencyType:"stateVariable",variableName:"xs"},coeffs:{dependencyType:"stateVariable",variableName:"coeffs"},interpolationPoints:{dependencyType:"stateVariable",variableName:"interpolationPoints"},isInterpolatedFunction:{dependencyType:"stateVariable",variableName:"isInterpolatedFunction"},domain:{dependencyType:"stateVariable",variableName:"domain"}}};{let os={formula:{dependencyType:"stateVariable",variableName:"formula"},variables:{dependencyType:"stateVariable",variableName:"variables"},nInputs:{dependencyType:"stateVariable",variableName:"nInputs"},functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["symbolicfs"]},simplify:{dependencyType:"stateVariable",variableName:"simplify"},expand:{dependencyType:"stateVariable",variableName:"expand"},isInterpolatedFunction:{dependencyType:"stateVariable",variableName:"isInterpolatedFunction"},symbolicfShadow:{dependencyType:"stateVariable",variableName:"symbolicfShadow"},numericalfShadow:{dependencyType:"stateVariable",variableName:"numericalfShadow"},domain:{dependencyType:"stateVariable",variableName:"domain"}};return ss.mathChildName&&(ss.mathChildCreatedBySugar?(os.mathChildExpressionWithCodes={dependencyType:"stateVariable",componentName:ss.mathChildName,variableName:"expressionWithCodes"},os.mathChildMathChildren={dependencyType:"child",parentName:ss.mathChildName,childGroups:["maths"],variableNames:["value","fReevaluate","inputMaths"],variablesOptional:!0},os.mathChildCodePre={dependencyType:"stateVariable",componentName:ss.mathChildName,variableName:"codePre"}):os.mathChild={dependencyType:"child",childGroups:["maths"],variableNames:["value","fReevaluate","inputMaths"],variablesOptional:!0}),{globalDependencies:os}}},arrayDefinitionByKey:function({globalDependencyValues:ss,usedDefault:os,arrayKeys:ls}){var us,cs;if(ss.isInterpolatedFunction){let ds={};for(let ps of ls)if(ps==="0"){let fs=returnInterpolatedFunction({xs:ss.xs,coeffs:ss.coeffs,interpolationPoints:ss.interpolationPoints,domain:ss.domain});ds[ps]=function(hs){let gs=hs.evaluate_to_constant();return Context.fromAst(fs(gs))}}else ds[ps]=fs=>Context.fromAst("_");return{setValue:{symbolicfs:ds}}}else if(ss.functionChild.length>0){let ds={};for(let ps of ls)ds[ps]=ss.functionChild[0].stateValues.symbolicfs[ps];return{setValue:{symbolicfs:ds}}}else if(os.formula)if(ss.symbolicfShadow){let ds={};for(let ps of ls)ps==="0"?ds[ps]=ss.symbolicfShadow:ds[ps]=fs=>Context.fromAst("_");return{setValue:{symbolicfs:ds}}}else if(ss.numericalfShadow){let ds={};for(let ps of ls)ps==="0"?ds[ps]=function(fs){let hs=fs.evaluate_to_constant();return Context.fromAst(ss.numericalfShadow(hs))}:ds[ps]=fs=>Context.fromAst("_");return{setValue:{symbolicfs:ds}}}else{let ds={};for(let ps of ls)ds[ps]=returnSymbolicFunctionFromFormula({formula:ss.formula,simplify:ss.simplify,expand:ss.expand,nInputs:ss.nInputs,variables:ss.variables,domain:ss.domain,component:ps});return{setValue:{symbolicfs:ds}}}else{if(((us=ss.mathChildMathChildren)==null?void 0:us.length)>0){let ps=ss.variables.map(bs=>bs.subscripts_to_strings().tree),fs={},hs=!1,gs=ss.mathChildCodePre,ys={};for(let[bs,vs]of ss.mathChildMathChildren.entries())vs.stateValues.fReevaluate&&vs.stateValues.inputMaths.reduce((Cs,Ts)=>[...Cs,...Ts.subscripts_to_strings().variables()],[]).some(Cs=>ps.includes(Cs))?(fs[gs+bs]={fReevaluate:vs.stateValues.fReevaluate,inputMathFs:vs.stateValues.inputMaths.map(Cs=>Cs.subscripts_to_strings().f())},hs=!0):ys[gs+bs]=vs.stateValues.value;if(hs){let bs=ss.mathChildExpressionWithCodes;Object.keys(ys).length>0&&(bs=bs.substitute(ys)),bs=Context.fromAst(mergeListsWithOtherContainers(bs.tree));let vs={};for(let xs of ls)vs[xs]=returnSymbolicFunctionFromReevaluatedFormula({formulaExpressionWithCodes:bs,evaluateChildrenToReevaluate:fs,simplify:ss.simplify,expand:ss.expand,nInputs:ss.nInputs,variables:ss.variables,domain:ss.domain,component:xs});return{setValue:{symbolicfs:vs}}}}else if((cs=ss.mathChild)!=null&&cs[0].stateValues.fReevaluate){let ps=ss.variables.map(gs=>gs.subscripts_to_strings().tree),fs=ss.mathChild[0];if(fs.stateValues.inputMaths.reduce((gs,ys)=>[...gs,...ys.subscripts_to_strings().variables()],[]).some(gs=>ps.includes(gs))){let gs=Context.fromAst("code"),ys={code:{fReevaluate:fs.stateValues.fReevaluate,inputMathFs:fs.stateValues.inputMaths.map(vs=>vs.subscripts_to_strings().f())}},bs={};for(let vs of ls)bs[vs]=returnSymbolicFunctionFromReevaluatedFormula({formulaExpressionWithCodes:gs,evaluateChildrenToReevaluate:ys,simplify:ss.simplify,expand:ss.expand,nInputs:ss.nInputs,variables:ss.variables,domain:ss.domain,component:vs});return{setValue:{symbolicfs:bs}}}}let ds={};for(let ps of ls)ds[ps]=returnSymbolicFunctionFromFormula({formula:ss.formula,simplify:ss.simplify,expand:ss.expand,nInputs:ss.nInputs,variables:ss.variables,domain:ss.domain,component:ps});return{setValue:{symbolicfs:ds}}}}},ns.symbolicf={isAlias:!0,targetVariableName:"symbolicf1"},ns.numericalfs={isArray:!0,entryPrefixes:["numericalf"],stateVariablesDeterminingDependencies:["isInterpolatedFunction","mathChildName","mathChildCreatedBySugar"],returnArraySizeDependencies:()=>({nOutputs:{dependencyType:"stateVariable",variableName:"nOutputs"}}),returnArraySize({dependencyValues:ss}){return[ss.nOutputs]},returnArrayDependenciesByKey({stateValues:ss}){if(ss.isInterpolatedFunction)return{globalDependencies:{xs:{dependencyType:"stateVariable",variableName:"xs"},coeffs:{dependencyType:"stateVariable",variableName:"coeffs"},interpolationPoints:{dependencyType:"stateVariable",variableName:"interpolationPoints"},isInterpolatedFunction:{dependencyType:"stateVariable",variableName:"isInterpolatedFunction"},domain:{dependencyType:"stateVariable",variableName:"domain"}}};{let os={formula:{dependencyType:"stateVariable",variableName:"formula"},variables:{dependencyType:"stateVariable",variableName:"variables"},nInputs:{dependencyType:"stateVariable",variableName:"nInputs"},functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["numericalfs"]},isInterpolatedFunction:{dependencyType:"stateVariable",variableName:"isInterpolatedFunction"},symbolicfShadow:{dependencyType:"stateVariable",variableName:"symbolicfShadow"},numericalfShadow:{dependencyType:"stateVariable",variableName:"numericalfShadow"},domain:{dependencyType:"stateVariable",variableName:"domain"}};return ss.mathChildName&&(ss.mathChildCreatedBySugar?(os.mathChildExpressionWithCodes={dependencyType:"stateVariable",componentName:ss.mathChildName,variableName:"expressionWithCodes"},os.mathChildMathChildren={dependencyType:"child",parentName:ss.mathChildName,childGroups:["maths"],variableNames:["value","fReevaluate","inputMaths"],variablesOptional:!0},os.mathChildCodePre={dependencyType:"stateVariable",componentName:ss.mathChildName,variableName:"codePre"}):os.mathChild={dependencyType:"child",childGroups:["maths"],variableNames:["value","fReevaluate","inputMaths"],variablesOptional:!0}),{globalDependencies:os}}},arrayDefinitionByKey:function({globalDependencyValues:ss,usedDefault:os,arrayKeys:ls}){var us,cs;if(ss.isInterpolatedFunction){let ds={};for(let ps of ls)ps==="0"?ds[ps]=returnInterpolatedFunction({xs:ss.xs,coeffs:ss.coeffs,interpolationPoints:ss.interpolationPoints,domain:ss.domain}):ds[ps]=fs=>Context.fromAst("_");return{setValue:{numericalfs:ds}}}else if(ss.functionChild.length>0){let ds={};for(let ps of ls)ds[ps]=ss.functionChild[0].stateValues.numericalfs[ps];return{setValue:{numericalfs:ds}}}else if(os.formula)if(ss.numericalfShadow){let ds={};for(let ps of ls)ps==="0"?ds[ps]=ss.numericalfShadow:ds[ps]=()=>NaN;return{setValue:{numericalfs:ds}}}else if(ss.symbolicfShadow){let ds={};for(let ps of ls)ps==="0"?ds[ps]=function(fs){return ss.symbolicfShadow(Context.fromAst(fs)).evaluate_to_constant()}:ds[ps]=()=>NaN;return{setValue:{numericalfs:ds}}}else{let ds={};for(let ps of ls)ds[ps]=returnNumericalFunctionFromFormula({formula:ss.formula,nInputs:ss.nInputs,variables:ss.variables,domain:ss.domain,component:ps});return{setValue:{numericalfs:ds}}}else{if(((us=ss.mathChildMathChildren)==null?void 0:us.length)>0){let ps=ss.variables.map(bs=>bs.subscripts_to_strings().tree),fs={},hs=!1,gs=ss.mathChildCodePre,ys={};for(let[bs,vs]of ss.mathChildMathChildren.entries())vs.stateValues.fReevaluate&&vs.stateValues.inputMaths.reduce((Cs,Ts)=>[...Cs,...Ts.subscripts_to_strings().variables()],[]).some(Cs=>ps.includes(Cs))?(fs[gs+bs]={fReevaluate:vs.stateValues.fReevaluate,inputMathFs:vs.stateValues.inputMaths.map(Cs=>Cs.subscripts_to_strings().f())},hs=!0):ys[gs+bs]=vs.stateValues.value;if(hs){let bs=ss.mathChildExpressionWithCodes;Object.keys(ys).length>0&&(bs=bs.substitute(ys)),bs=Context.fromAst(mergeListsWithOtherContainers(bs.tree));let vs={};for(let xs of ls)vs[xs]=returnNumericalFunctionFromReevaluatedFormula({formulaExpressionWithCodes:bs,evaluateChildrenToReevaluate:fs,nInputs:ss.nInputs,variables:ss.variables,domain:ss.domain,component:xs});return{setValue:{numericalfs:vs}}}}else if((cs=ss.mathChild)!=null&&cs[0].stateValues.fReevaluate){let ps=ss.variables.map(gs=>gs.subscripts_to_strings().tree),fs=ss.mathChild[0];if(fs.stateValues.inputMaths.reduce((gs,ys)=>[...gs,...ys.subscripts_to_strings().variables()],[]).some(gs=>ps.includes(gs))){let gs=Context.fromAst("code"),ys={code:{fReevaluate:fs.stateValues.fReevaluate,inputMathFs:fs.stateValues.inputMaths.map(vs=>vs.subscripts_to_strings().f())}},bs={};for(let vs of ls)bs[vs]=returnNumericalFunctionFromReevaluatedFormula({formulaExpressionWithCodes:gs,evaluateChildrenToReevaluate:ys,nInputs:ss.nInputs,variables:ss.variables,domain:ss.domain,component:vs});return{setValue:{numericalfs:bs}}}}let ds={};for(let ps of ls)ds[ps]=returnNumericalFunctionFromFormula({formula:ss.formula,nInputs:ss.nInputs,variables:ss.variables,domain:ss.domain,component:ps});return{setValue:{numericalfs:ds}}}}},ns.numericalf={returnDependencies:()=>({numericalf1:{dependencyType:"stateVariable",variableName:"numericalf1"}}),definition({dependencyValues:ss}){return{setValue:{numericalf:ss.numericalf1}}}},ns.fDefinitions={isArray:!0,entryPrefixes:["fDefinition"],stateVariablesDeterminingDependencies:["isInterpolatedFunction","mathChildName","mathChildCreatedBySugar"],returnArraySizeDependencies:()=>({nOutputs:{dependencyType:"stateVariable",variableName:"nOutputs"}}),returnArraySize({dependencyValues:ss}){return[ss.nOutputs]},returnArrayDependenciesByKey({stateValues:ss}){if(ss.isInterpolatedFunction)return{globalDependencies:{xs:{dependencyType:"stateVariable",variableName:"xs"},coeffs:{dependencyType:"stateVariable",variableName:"coeffs"},interpolationPoints:{dependencyType:"stateVariable",variableName:"interpolationPoints"},isInterpolatedFunction:{dependencyType:"stateVariable",variableName:"isInterpolatedFunction"},domain:{dependencyType:"stateVariable",variableName:"domain"}}};{let os={formula:{dependencyType:"stateVariable",variableName:"formula"},variables:{dependencyType:"stateVariable",variableName:"variables"},nInputs:{dependencyType:"stateVariable",variableName:"nInputs"},functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["fDefinitions"]},isInterpolatedFunction:{dependencyType:"stateVariable",variableName:"isInterpolatedFunction"},symbolicfShadow:{dependencyType:"stateVariable",variableName:"symbolicfShadow"},numericalfShadow:{dependencyType:"stateVariable",variableName:"numericalfShadow"},domain:{dependencyType:"stateVariable",variableName:"domain"}};return ss.mathChildName&&(ss.mathChildCreatedBySugar?(os.mathChildExpressionWithCodes={dependencyType:"stateVariable",componentName:ss.mathChildName,variableName:"expressionWithCodes"},os.mathChildMathChildren={dependencyType:"child",parentName:ss.mathChildName,childGroups:["maths"],variableNames:["value","fReevaluateDefinition","inputMaths"],variablesOptional:!0},os.mathChildCodePre={dependencyType:"stateVariable",componentName:ss.mathChildName,variableName:"codePre"}):os.mathChild={dependencyType:"child",childGroups:["maths"],variableNames:["value","fReevaluateDefinition","inputMaths"],variablesOptional:!0}),{globalDependencies:os}}},arrayDefinitionByKey:function({globalDependencyValues:ss,usedDefault:os,arrayKeys:ls}){var us,cs;if(ss.isInterpolatedFunction){let ds={};for(let ps of ls)ps==="0"?ds[ps]={functionType:"interpolated",xs:ss.xs,coeffs:ss.coeffs,interpolationPoints:ss.interpolationPoints,domain:ss.domain?ss.domain.map(fs=>fs.tree):null}:ds[ps]={};return{setValue:{fDefinitions:ds}}}else if(ss.functionChild.length>0){let ds={};for(let ps of ls)ds[ps]=ss.functionChild[0].stateValues.fDefinitions[ps];return{setValue:{fDefinitions:ds}}}else if(os.formula)if(ss.numericalfShadow){let ds={};for(let ps of ls)ds[ps]={};return{setValue:{fDefinitions:ds}}}else if(ss.symbolicfShadow){let ds={};for(let ps of ls)ds[ps]={};return{setValue:{fDefinitions:ds}}}else{let ds={};for(let ps of ls)ds[ps]={functionType:"formula",formula:ss.formula.tree,variables:ss.variables.map(fs=>fs.tree),nInputs:ss.nInputs,nOutputs:ss.nOutputs,domain:ss.domain?ss.domain.map(fs=>fs.tree):null,component:ps};return{setValue:{fDefinitions:ds}}}else{if(((us=ss.mathChildMathChildren)==null?void 0:us.length)>0){let ps=ss.variables.map(bs=>bs.subscripts_to_strings().tree),fs={},hs=!1,gs=ss.mathChildCodePre,ys={};for(let[bs,vs]of ss.mathChildMathChildren.entries())vs.stateValues.fReevaluateDefinition&&vs.stateValues.inputMaths.reduce((Cs,Ts)=>[...Cs,...Ts.subscripts_to_strings().variables()],[]).some(Cs=>ps.includes(Cs))?(fs[gs+bs]={fReevaluateDefinition:vs.stateValues.fReevaluateDefinition,inputMaths:vs.stateValues.inputMaths},hs=!0):ys[gs+bs]=vs.stateValues.value;if(hs){let bs=ss.mathChildExpressionWithCodes;Object.keys(ys).length>0&&(bs=bs.substitute(ys)),bs=Context.fromAst(mergeListsWithOtherContainers(bs.tree));let vs={};for(let xs of ls)vs[xs]={functionType:"reevaluatedFormula",formulaExpressionWithCodes:bs,evaluateChildrenToReevaluate:fs,nInputs:ss.nInputs,variables:ss.variables.map(Cs=>Cs.tree),domain:ss.domain?ss.domain.map(Cs=>Cs.tree):null,component:xs};return{setValue:{fDefinitions:vs}}}}else if((cs=ss.mathChild)!=null&&cs[0].stateValues.fReevaluateDefinition){let ps=ss.variables.map(gs=>gs.subscripts_to_strings().tree),fs=ss.mathChild[0];if(fs.stateValues.inputMaths.reduce((gs,ys)=>[...gs,...ys.subscripts_to_strings().variables()],[]).some(gs=>ps.includes(gs))){let gs=Context.fromAst("code"),ys={code:{fReevaluateDefinition:fs.stateValues.fReevaluateDefinition,inputMaths:fs.stateValues.inputMaths}},bs={};for(let vs of ls)bs[vs]={functionType:"reevaluatedFormula",formulaExpressionWithCodes:gs,evaluateChildrenToReevaluate:ys,nInputs:ss.nInputs,variables:ss.variables.map(xs=>xs.tree),domain:ss.domain?ss.domain.map(xs=>xs.tree):null,component:vs};return{setValue:{fDefinitions:bs}}}}let ds={};for(let ps of ls)ds[ps]={functionType:"formula",formula:ss.formula.tree,variables:ss.variables.map(fs=>fs.tree),nInputs:ss.nInputs,nOutputs:ss.nOutputs,domain:ss.domain?ss.domain.map(fs=>fs.tree):null,component:ps};return{setValue:{fDefinitions:ds}}}}},ns.fDefinition={isAlias:!0,targetVariableName:"fDefinition1"},ns.fs={isArray:!0,entryPrefixes:["f"],returnArraySizeDependencies:()=>({nOutputs:{dependencyType:"stateVariable",variableName:"nOutputs"}}),returnArraySize({dependencyValues:ss}){return[ss.nOutputs]},returnArrayDependenciesByKey({arrayKeys:ss}){let os={symbolic:{dependencyType:"stateVariable",variableName:"symbolic"}},ls={};for(let us of ss){let cs=Number(us)+1;ls[us]={symbolicf:{dependencyType:"stateVariable",variableName:"symbolicf"+cs},numericalf:{dependencyType:"stateVariable",variableName:"numericalf"+cs}}}return{globalDependencies:os,dependenciesByKey:ls}},arrayDefinitionByKey({globalDependencyValues:ss,dependencyValuesByKey:os,arrayKeys:ls}){let us={};if(ss.symbolic)for(let cs of ls)us[cs]=os[cs].symbolicf;else for(let cs of ls)us[cs]=os[cs].numericalf;return{setValue:{fs:us}}}},ns.f={isAlias:!0,targetVariableName:"f1"},ns.latex={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({formula:{dependencyType:"stateVariable",variableName:"formula"},displayDigits:{dependencyType:"stateVariable",variableName:"displayDigits"},displayDecimals:{dependencyType:"stateVariable",variableName:"displayDecimals"},displaySmallAsZero:{dependencyType:"stateVariable",variableName:"displaySmallAsZero"},padZeros:{dependencyType:"stateVariable",variableName:"padZeros"}}),definition:function({dependencyValues:ss,usedDefault:os}){let ls={};return ss.padZeros&&(os.displayDigits&&!os.displayDecimals?Number.isFinite(ss.displayDecimals)&&(ls.padToDecimals=ss.displayDecimals):ss.displayDigits>=1&&(ls.padToDigits=ss.displayDigits)),{setValue:{latex:roundForDisplay({value:ss.formula,dependencyValues:ss,usedDefault:os}).toLatex(ls)}}}},ns.latexWithInputChildren={forRenderer:!0,returnDependencies:()=>({latex:{dependencyType:"stateVariable",variableName:"latex"}}),definition:function({dependencyValues:ss}){return{setValue:{latexWithInputChildren:[ss.latex]}}}},ns.allMinima={stateVariablesDeterminingDependencies:["isInterpolatedFunction"],returnDependencies({stateValues:ss}){return ss.isInterpolatedFunction?{xs:{dependencyType:"stateVariable",variableName:"xs"},coeffs:{dependencyType:"stateVariable",variableName:"coeffs"},isInterpolatedFunction:{dependencyType:"stateVariable",variableName:"isInterpolatedFunction"},domain:{dependencyType:"stateVariable",variableName:"domain"}}:{numericalf:{dependencyType:"stateVariable",variableName:"numericalf"},formula:{dependencyType:"stateVariable",variableName:"formula"},variables:{dependencyType:"stateVariable",variableName:"variables"},xscale:{dependencyType:"stateVariable",variableName:"xscale"},functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["allMinima"]},isInterpolatedFunction:{dependencyType:"stateVariable",variableName:"isInterpolatedFunction"},nInputs:{dependencyType:"stateVariable",variableName:"nInputs"},nOutputs:{dependencyType:"stateVariable",variableName:"nOutputs"},domain:{dependencyType:"stateVariable",variableName:"domain"}}},definition:function({dependencyValues:ss}){if(ss.isInterpolatedFunction){let os=ss.xs,ls=ss.coeffs,us=rs.eps,cs=[];if(os===null)return{setValue:{allMinima:cs}};let ds=!1,ps=-1/0,fs=1/0,hs=!1,gs=!1;if(ss.domain!==null){let xs=ss.domain[0];xs!==void 0&&(ps=Context.fromAst(xs.tree[1][1]).evaluate_to_constant(),Number.isFinite(ps)?hs=!xs.tree[2][1]:ps=-1/0,fs=Context.fromAst(xs.tree[1][2]).evaluate_to_constant(),Number.isFinite(fs)?gs=!xs.tree[2][2]:fs=1/0)}let ys=1e-14*Math.max(Math.abs(ps),Math.abs(fs)),bs=ls[0],vs=os[1]-os[0];if(bs[3]===0){if(bs[2]>0){let xs=-bs[1]/(2*bs[2]);xs+os[0]>=ps-ys&&xs+os[0]<=fs+ys&&(xs<=vs-us?hs&&Math.abs(xs+os[0]-ps)0){let Cs=Math.sqrt(xs),Ts=(-2*bs[2]+Cs)/(6*bs[3]);Ts+os[0]>=ps-ys&&Ts+os[0]<=fs+ys&&(Ts<=vs-us?hs&&Math.abs(Ts+os[0]-ps)0){let Cs=-bs[1]/(2*bs[2]);if(Cs+os[xs]>=ps-ys)if(Cs+os[xs]<=fs+ys)Math.abs(Cs)=us&&Cs<=vs-us&&(hs&&Math.abs(Cs+os[xs]-ps)0){let Ts=Math.sqrt(Cs),Ss=(-2*bs[2]+Ts)/(6*bs[3]);if(Ss+os[xs]>=ps-ys)if(Ss+os[xs]<=fs+ys)Math.abs(Ss)=us&&Ss<=vs-us&&(hs&&Math.abs(Ss+os[xs]-ps)0){let xs=-bs[1]/(2*bs[2]);xs+os[os.length-2]>=ps-ys&&xs+os[os.length-2]<=fs+ys&&(Math.abs(xs)=us&&(hs&&Math.abs(xs+os[os.length-2]-ps)0){let Cs=Math.sqrt(xs),Ts=(-2*bs[2]+Cs)/(6*bs[3]);Ts+os[os.length-2]>=ps-ys&&Ts+os[os.length-2]<=fs+ys&&(Ts>=us?hs&&Math.abs(Ts+os[os.length-2]-ps)0)return{setValue:{allMinima:ss.functionChild[0].stateValues.allMinima}};if(!(ss.nInputs===1&&ss.nOutputs===1))return{setValue:{allMinima:[]}};let os=ss.variables[0].subscripts_to_strings().tree,ls=ss.formula.subscripts_to_strings().derivative(os),us,cs=!0,ds;try{us=ls.subscripts_to_strings().f()}catch{cs=!1,ds=()=>NaN}cs&&(ds=function(ws){try{return us({[os]:ws})}catch{return NaN}});let ps=ws=>ss.numericalf(ws,!0),fs=-100*ss.xscale,hs=100*ss.xscale,gs=!1,ys=!1;if(ss.domain!==null){let ws=ss.domain[0];ws!==void 0&&(fs=Context.fromAst(ws.tree[1][1]).evaluate_to_constant(),Number.isFinite(fs)?gs=!ws.tree[2][1]:fs=-100*ss.xscale,hs=Context.fromAst(ws.tree[1][2]).evaluate_to_constant(),Number.isFinite(hs)?ys=!ws.tree[2][2]:hs=100*ss.xscale)}let bs=1e3,vs=(hs-fs)/bs,xs=1e-10*Math.max(Math.abs(fs),Math.abs(hs)),Cs=[],Ts=!1,Ss=!1,Ns=ps(fs-vs),As=ds(fs-vs);for(let ws=-1;ws0&&(Is=!0,Ts=!1,Os>=fs-xs&&Os<=hs+xs&&!(gs&&Math.abs(Os-fs)({allMinima:{dependencyType:"stateVariable",variableName:"allMinima"}}),definition({dependencyValues:ss}){return{setValue:{numberMinima:ss.allMinima.length},checkForActualChange:{numberMinima:!0}}}},ns.minima={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"],returnWrappingComponents(ss){return ss==="minimum"||ss===void 0?[["point",{componentType:"mathList",isAttribute:"xs"}]]:[]}},isArray:!0,nDimensions:2,entryPrefixes:["minimum","minimumLocations","minimumLocation","minimumValues","minimumValue"],getArrayKeysFromVarName({arrayEntryPrefix:ss,varEnding:os,arraySize:ls}){if(["minimum","minimumLocation","minimumValue"].includes(ss)){let us=Number(os)-1;return Number.isInteger(us)&&us>=0?!ls||uscs+",0"):["0,0"]:ss==="minimumValues"?os!==""?[]:ls?Array.from(Array(ls[0]),(us,cs)=>cs+",1"):["0,1"]:[]},arrayVarNameFromArrayKey(ss){let[os,ls]=ss.split(",");return ls==="0"?"minimumLocation"+(Number(os)+1):"minimumValue"+(Number(os)+1)},arrayVarNameFromPropIndex(ss,os){if(os==="minima"){if(ss.length===1)return"minimum"+ss[0];{let ls=Number(ss[0]);if(Number.isInteger(ls)&&ls>0){if(ss[1]===1)return"minimumLocation"+ls;if(ss[1]===2)return"minimumValue"+ls}return null}}if(os==="minimumLocations")return"minimumLocation"+ss[0];if(os==="minimumValues")return"minimumValue"+ss[0];if(os.slice(0,7)==="minimum"){let ls=Number(os.slice(7));if(Number.isInteger(ls)&&ls>0){if(ss[0]===1)return"minimumLocation"+ls;if(ss[0]===2)return"minimumValue"+ls}}return null},returnArraySizeDependencies:()=>({numberMinima:{dependencyType:"stateVariable",variableName:"numberMinima"}}),returnArraySize({dependencyValues:ss}){return[ss.numberMinima,2]},returnArrayDependenciesByKey(){return{globalDependencies:{allMinima:{dependencyType:"stateVariable",variableName:"allMinima"}}}},arrayDefinitionByKey({globalDependencyValues:ss}){let os={};for(let ls=0;ls=ps-ys&&xs+os[0]<=fs+ys&&(xs<=vs-us?hs&&Math.abs(xs+os[0]-ps)0){let Cs=Math.sqrt(xs),Ts=(-2*bs[2]-Cs)/(6*bs[3]);Ts+os[0]>=ps-ys&&Ts+os[0]<=fs+ys&&(Ts<=vs-us?hs&&Math.abs(Ts+os[0]-ps)=ps-ys)if(Cs+os[xs]<=fs+ys)Math.abs(Cs)=us&&Cs<=vs-us&&(hs&&Math.abs(Cs+os[xs]-ps)0){let Ts=Math.sqrt(Cs),Ss=(-2*bs[2]-Ts)/(6*bs[3]);if(Ss+os[xs]>=ps-ys)if(Ss+os[xs]<=fs+ys)Math.abs(Ss)=us&&Ss<=vs-us&&(hs&&Math.abs(Ss+os[xs]-ps)=ps-ys&&xs+os[os.length-2]<=fs+ys&&(Math.abs(xs)=us&&(hs&&Math.abs(xs+os[os.length-2]-ps)0){let Cs=Math.sqrt(xs),Ts=(-2*bs[2]-Cs)/(6*bs[3]);Ts+os[os.length-2]>=ps-ys&&Ts+os[os.length-2]<=fs+ys&&(Ts>=us?hs&&Math.abs(Ts+os[os.length-2]-ps)0)return{setValue:{allMaxima:ss.functionChild[0].stateValues.allMaxima}};if(!(ss.nInputs===1&&ss.nOutputs===1))return{setValue:{allMaxima:[]}};let os=ss.variables[0].subscripts_to_strings().tree,ls=ss.formula.subscripts_to_strings().derivative(os),us,cs=!0,ds;try{us=ls.subscripts_to_strings().f()}catch{cs=!1,ds=()=>NaN}cs&&(ds=function(ws){try{return us({[os]:ws})}catch{return NaN}});let ps=ws=>-ss.numericalf(ws,!0),fs=-100*ss.xscale,hs=100*ss.xscale,gs=!1,ys=!1;if(ss.domain!==null){let ws=ss.domain[0];ws!==void 0&&(fs=Context.fromAst(ws.tree[1][1]).evaluate_to_constant(),Number.isFinite(fs)?gs=!ws.tree[2][1]:fs=-100*ss.xscale,hs=Context.fromAst(ws.tree[1][2]).evaluate_to_constant(),Number.isFinite(hs)?ys=!ws.tree[2][2]:hs=100*ss.xscale)}let bs=1e3,vs=(hs-fs)/bs,xs=1e-10*Math.max(Math.abs(fs),Math.abs(hs)),Cs=[],Ts=!1,Ss=!1,Ns=ps(fs-vs),As=ds(fs-vs);for(let ws=-1;ws0&&ds(Os+Vs)<0&&(Is=!0,Ts=!1,Os>=fs-xs&&Os<=hs+xs&&!(gs&&Math.abs(Os-fs)({allMaxima:{dependencyType:"stateVariable",variableName:"allMaxima"}}),definition({dependencyValues:ss}){return{setValue:{numberMaxima:ss.allMaxima.length},checkForActualChange:{numberMaxima:!0}}}},ns.maxima={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"],returnWrappingComponents(ss){return ss==="maximum"||ss===void 0?[["point",{componentType:"mathList",isAttribute:"xs"}]]:[]}},isArray:!0,nDimensions:2,entryPrefixes:["maximum","maximumLocations","maximumLocation","maximumValues","maximumValue"],getArrayKeysFromVarName({arrayEntryPrefix:ss,varEnding:os,arraySize:ls}){if(["maximum","maximumLocation","maximumValue"].includes(ss)){let us=Number(os)-1;return Number.isInteger(us)&&us>=0?!ls||uscs+",0"):["0,0"]:ss==="maximumValues"?os!==""?[]:ls?Array.from(Array(ls[0]),(us,cs)=>cs+",1"):["0,1"]:[]},arrayVarNameFromArrayKey(ss){let[os,ls]=ss.split(",");return ls==="0"?"maximumLocation"+(Number(os)+1):"maximumValue"+(Number(os)+1)},arrayVarNameFromPropIndex(ss,os){if(os==="maxima"){if(ss.length===1)return"maximum"+ss[0];{let ls=Number(ss[0]);if(Number.isInteger(ls)&&ls>0){if(ss[1]===1)return"maximumLocation"+ls;if(ss[1]===2)return"maximumValue"+ls}return null}}if(os==="maximumLocations")return"maximumLocation"+ss[0];if(os==="maximumValues")return"maximumValue"+ss[0];if(os.slice(0,7)==="maximum"){let ls=Number(os.slice(7));if(Number.isInteger(ls)&&ls>0){if(ss[0]===1)return"maximumLocation"+ls;if(ss[0]===2)return"maximumValue"+ls}}return null},returnArraySizeDependencies:()=>({numberMaxima:{dependencyType:"stateVariable",variableName:"numberMaxima"}}),returnArraySize({dependencyValues:ss}){return[ss.numberMaxima,2]},returnArrayDependenciesByKey(){return{globalDependencies:{allMaxima:{dependencyType:"stateVariable",variableName:"allMaxima"}}}},arrayDefinitionByKey({globalDependencyValues:ss}){let os={};for(let ls=0;ls({numberMinima:{dependencyType:"stateVariable",variableName:"numberMinima"},numberMaxima:{dependencyType:"stateVariable",variableName:"numberMaxima"}}),definition:function({dependencyValues:ss}){return{setValue:{numberExtrema:ss.numberMinima+ss.numberMaxima},checkForActualChange:{numberExtrema:!0}}}},ns.allExtrema={returnDependencies:()=>({allMinima:{dependencyType:"stateVariable",variableName:"allMinima"},allMaxima:{dependencyType:"stateVariable",variableName:"allMaxima"}}),definition({dependencyValues:ss}){return{setValue:{allExtrema:[...ss.allMinima,...ss.allMaxima].sort((ls,us)=>ls[0]-us[0])}}}},ns.extrema={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"],returnWrappingComponents(ss){return ss==="extremum"||ss===void 0?[["point",{componentType:"mathList",isAttribute:"xs"}]]:[]}},isArray:!0,nDimensions:2,entryPrefixes:["extremum","extremumLocations","extremumLocation","extremumValues","extremumValue"],getArrayKeysFromVarName({arrayEntryPrefix:ss,varEnding:os,arraySize:ls}){if(["extremum","extremumLocation","extremumValue"].includes(ss)){let us=Number(os)-1;return Number.isInteger(us)&&us>=0?!ls||uscs+",0"):["0,0"]:ss==="extremumValues"?os!==""?[]:ls?Array.from(Array(ls[0]),(us,cs)=>cs+",1"):["0,1"]:[]},arrayVarNameFromArrayKey(ss){let[os,ls]=ss.split(",");return ls==="0"?"extremumLocation"+(Number(os)+1):"extremumValue"+(Number(os)+1)},arrayVarNameFromPropIndex(ss,os){if(os==="extrema"){if(ss.length===1)return"extremum"+ss[0];{let ls=Number(ss[0]);if(Number.isInteger(ls)&&ls>0){if(ss[1]===1)return"extremumLocation"+ls;if(ss[1]===2)return"extremumValue"+ls}return null}}if(os==="extremumLocations")return"extremumLocation"+ss[0];if(os==="extremumValues")return"extremumValue"+ss[0];if(os.slice(0,8)==="extremum"){let ls=Number(os.slice(8));if(Number.isInteger(ls)&&ls>0){if(ss[0]===1)return"extremumLocation"+ls;if(ss[0]===2)return"extremumValue"+ls}}return null},returnArraySizeDependencies:()=>({numberExtrema:{dependencyType:"stateVariable",variableName:"numberExtrema"}}),returnArraySize({dependencyValues:ss}){return[ss.numberExtrema,2]},returnArrayDependenciesByKey(){return{globalDependencies:{allExtrema:{dependencyType:"stateVariable",variableName:"allExtrema"}}}},arrayDefinitionByKey({globalDependencyValues:ss}){let os={};for(let ls=0;ls0&&ss.functionChild[0].stateValues.returnNumericalDerivatives){let os=ss.variables.map(ds=>ds.subscripts_to_strings().tree),ls=ss.functionChild[0].stateValues.variables,us=ls.map(ds=>ds.subscripts_to_strings().tree),cs={};for(let[ds,ps]of os.entries())us[ds]&&us[ds]!==ps&&(cs[ps]=ls[ds]);return Object.keys(cs).length===0?{setValue:{returnNumericalDerivatives:ss.functionChild[0].stateValues.returnNumericalDerivatives}}:{setValue:{returnNumericalDerivatives:function(ps){let fs=[];for(let hs of ps){let gs=cs[hs.subscripts_to_strings().tree];gs?fs.push(gs):fs.push(Context.fromAst("_"))}return ss.functionChild[0].stateValues.returnNumericalDerivatives(fs)}}}}else return{setValue:{returnNumericalDerivatives:null}}}},ns.numericalDerivativesDefinition={stateVariablesDeterminingDependencies:["isInterpolatedFunction"],returnDependencies({stateValues:ss}){return ss.isInterpolatedFunction?{xs:{dependencyType:"stateVariable",variableName:"xs"},coeffs:{dependencyType:"stateVariable",variableName:"coeffs"},isInterpolatedFunction:{dependencyType:"stateVariable",variableName:"isInterpolatedFunction"},variables:{dependencyType:"stateVariable",variableName:"variables"}}:{functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["numericalDerivativesDefinition","variables"]},isInterpolatedFunction:{dependencyType:"stateVariable",variableName:"isInterpolatedFunction"},variables:{dependencyType:"stateVariable",variableName:"variables"}}},definition:function({dependencyValues:ss}){if(ss.isInterpolatedFunction)return{setValue:{numericalDerivativesDefinition:{derivativeType:"interpolatedFunction",xs:ss.xs,coeffs:ss.coeffs,variables:ss.variables}}};if(ss.functionChild.length>0&&ss.functionChild[0].stateValues.numericalDerivativesDefinition){let os=ss.variables.map(ds=>ds.subscripts_to_strings().tree),ls=ss.functionChild[0].stateValues.variables,us=ls.map(ds=>ds.subscripts_to_strings().tree),cs={};for(let[ds,ps]of os.entries())us[ds]&&us[ds]!==ps&&(cs[ps]=ls[ds]);if(Object.keys(cs).length===0)return{setValue:{numericalDerivativesDefinition:ss.functionChild[0].stateValues.numericalDerivativesDefinition}};{let ds={...ss.functionChild[0].stateValues.numericalDerivativesDefinition};return ds.variableMappings?ds.variableMappings=[cs,...ds.variableMappings]:ds.variableMappings=[cs],{setValue:{numericalDerivativesDefinition:ds}}}}else return{setValue:{numericalDerivativesDefinition:{}}}}},ns}},zs(ku,"componentType","function"),zs(ku,"rendererType","math"),zs(ku,"primaryStateVariableForDefinition","numericalfShadow"),zs(ku,"adapters",[{stateVariable:"numericalf",componentType:"curve",stateVariablesToShadow:["label","labelHasLatex"]},{stateVariable:"formula",componentType:"math",stateVariablesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"]}]),ku);function calculateInterpolationPoints({dependencyValues:as,numerics:rs}){let ns=[],ss=[],os={maximum:as.prescribedMaxima,minimum:as.prescribedMinima,extremum:as.prescribedExtrema,point:as.prescribedPoints};for(let As in os)for(let ws of os[As]){let Es=null,_s=null,$s=null;if(ws.x!==null&&(Es=ws.x.evaluate_to_constant(),!Number.isFinite(Es))){console.warn(`Ignoring non-numerical ${As}`);continue}if(ws.y!==null&&(_s=ws.y.evaluate_to_constant(),!Number.isFinite(_s))){console.warn(`Ignoring non-numerical ${As}`);continue}if(ws.slope!==null&&ws.slope!==void 0&&($s=ws.slope.evaluate_to_constant(),Number.isFinite($s)||(console.warn("Ignoring non-numerical slope"),$s=null)),Es===null){if(_s===null){console.warn(`Ignoring empty ${As}`);continue}ss.push({type:As,y:_s,slope:$s})}else ns.push({type:As,x:Es,y:_s,slope:$s})}ns.sort((As,ws)=>As.x-ws.x),ss.sort((As,ws)=>As.y-ws.y);let ls=-1/0,us=rs.eps;for(let As=0;As0;){let As;fs===void 0?As=Ns({allowedTypes:["maximum","minimum","extremum"],comparison:"atLeast",value:-1/0}):fs==="maximum"?As=Ns({allowedTypes:["minimum","extremum"],comparison:"atMost",value:ps-ds}):fs==="minimum"?As=Ns({allowedTypes:["maximum","extremum"],comparison:"atLeast",value:ps+ds}):fs==="point"&&(As=Ns({allowedTypes:["maximum","extremum"],comparison:"atLeast",value:ps+ds}),As.success!==!0&&(As=Ns({allowedTypes:["minimum","extremum"],comparison:"atMost",value:ps-ds})));let ws;As.success===!0?(ws=As.point,ss.splice(As.ind,1),ys?(ws.x=0,ys=!1):ws.x=ls+cs):(ws=ss.pop(),ys?(ws.x=0,ys=!1):ws.x=ls+2*cs);let Es=xs({p:ws,typePrev:fs,xPrev:ls,yPrev:ps});fs=Es.type,ls=Es.x,ps=Es.y}if(hs.length===0&&hs.push({type:"point",x:0,y:0,slope:0}),ys=hs[0],ys.type==="maximum"){let As={type:"point",x:ys.x-cs,y:ys.y-ds,slope:2*ds/cs};hs.splice(0,0,As)}else if(ys.type==="minimum"){let As={type:"point",x:ys.x-cs,y:ys.y+ds,slope:-2*ds/cs};hs.splice(0,0,As)}else if(ys.type==="point")if(hs.length===1)ys.slope===null&&(ys.slope=0);else{let As=hs[1],ws=(As.y-ys.y)/(As.x-ys.x);if(As.type==="maximum"||As.type==="minimum")ys.slope===null&&(ys.slope=2*ws);else{hs.length===2?ys.slope===null&&(ys.slope=ws):(As.slope===null&&(As.slope=vs({point:As,prevPoint:ys,nextPoint:hs[2]})),ys.slope===null&&(ys.slope=2*(ys.y-As.y)/(ys.x-As.x)-As.slope));let Es={x:ys.x-cs,y:ys.y-cs*ys.slope,slope:ys.slope};hs.splice(0,0,Es)}}let bs=hs[hs.length-1];if(bs.type==="maximum"){let As={type:"point",x:bs.x+cs,y:bs.y-ds,slope:-2*ds/cs};hs.push(As)}else if(bs.type==="minimum"){let As={type:"point",x:bs.x+cs,y:bs.y+ds,slope:2*ds/cs};hs.push(As)}else if(bs.type==="point")if(hs.length===1){let As={type:"point",x:bs.x+cs,y:bs.y+ys.slope*cs,slope:ys.slope};hs.push(As)}else{let As=hs[hs.length-2],ws=(As.y-bs.y)/(As.x-bs.x);if(As.type==="maximum"||As.type==="minimum")bs.slope===null&&(bs.slope=2*ws);else{hs.length===2?bs.slope===null&&(bs.slope=ws):(As.slope===null&&(As.slope=vs({point:As,prevPoint:hs[hs.length-3],nextPoint:bs})),bs.slope===null&&(bs.slope=2*(As.y-bs.y)/(As.x-bs.x)-As.slope));let Es={x:bs.x+cs,y:bs.y+cs*bs.slope,slope:bs.slope};hs.push(Es)}}for(let As=1;As$s-ds?Cs({x:As.x,y:As.y,typePrev:Es,xPrev:_s,yPrev:$s,yNext:Rs,pNext:ws}):Is!==void 0&&As.y!==null&&As.y>ws.y-ds?Cs({x:As.x,y:As.y,typePrev:Es,xPrev:_s,yPrev:$s,yNext:Rs,pNext:ws}):Ts({x:As.x,y:As.y,typePrev:Es,xPrev:_s,yPrev:$s,yNext:Rs,pNext:ws});if(Es==="minimum"||Is==="minimum")return As.y!==null&&As.y<$s+ds?Ts({x:As.x,y:As.y,typePrev:Es,xPrev:_s,yPrev:$s,yNext:Rs,pNext:ws}):Is!==void 0&&As.y!==null&&As.y>ws.y+ds?Ts({x:As.x,y:As.y,typePrev:Es,xPrev:_s,yPrev:$s,yNext:Rs,pNext:ws}):Cs({x:As.x,y:As.y,typePrev:Es,xPrev:_s,yPrev:$s,yNext:Rs,pNext:ws});if(Es==="point"||Is==="point"){let Os="maximum";return(As.y===null&&ws!==void 0&&ws.type===maximum||As.y!==null&&As.y<=$s-ds||Is!==void 0&&As.y!==null&&As.y>=ws.y-ds)&&(Os="minimum"),Os==="minimum"?Ts({x:As.x,y:As.y,typePrev:Es,xPrev:_s,yPrev:$s,yNext:Rs,pNext:ws}):Cs({x:As.x,y:As.y,typePrev:Es,xPrev:_s,yPrev:$s,yNext:Rs,pNext:ws})}else return As.y!==null&&As.y$s-ds){let Ds=[(2*_s+As)/3,(_s+2*As)/3],Vs=[$s-ds,ws+ds],ks=["atMost","atLeast"],Ps=[["minimum","extremum"],["maximum","extremum"]];for(let Bs=0;Bs<2;Bs++){let Ms=Ds[Bs],Ws,Us,js=null,Ls=Ns({allowedTypes:Ps[Bs],comparison:ks[Bs],value:Vs[Bs]});Ls.success===!0?(Us=Ps[Bs][0],Ws=Ls.point.y,ss.splice(Ls.ind,1),js=0):(Us="point",Ws=Vs[Bs],js=null),hs.push({type:Us,x:Ms,y:Ws,slope:js})}}}else if(Es==="minimum"){ws===null&&(Rs===void 0?ws=$s:Is.type==="minimum"?ws=Math.min($s,Rs):ws=Math.min($s,Rs-ds));let Ds=Math.max($s,ws)+ds,Vs=(As+_s)/2,ks,Ps,Bs=null,Ms=Ns({allowedTypes:["maximum","extremum"],comparison:"atLeast",value:Ds});Ms.success===!0?(Ps="maximum",ks=Ms.point.y,ss.splice(Ms.ind,1),Bs=0):(Ps="point",ks=Ds),hs.push({type:Ps,x:Vs,y:ks,slope:Bs})}else if(Es==="point"){if(ws===null)Rs===void 0?ws=$s-ds:Is.type==="minimum"?ws=Math.min($s-ds,Rs):ws=Math.min($s,Rs)-ds;else if(ws>$s-ds){let Ds=(As+_s)/2,Vs,ks,Ps=null,Bs=Ns({allowedTypes:["maximum","extremum"],comparison:"atLeast",value:ws+ds});Bs.success===!0?(ks="maximum",Vs=Bs.point.y,ss.splice(Bs.ind,1),Ps=0):(ks="point",Vs=ws+ds),hs.push({type:ks,x:Ds,y:Vs,slope:Ps})}}let Os={type:"minimum",x:As,y:ws,slope:0};return hs.push(Os),Os}function Ss({x:As,y:ws,slope:Es,typePrev:_s,xPrev:$s,yPrev:Rs,yNext:Is,pNext:Os}){if(_s==="maximum"){if(ws>Rs-ds){let Vs=Math.min(Rs,ws)-ds,ks=(As+$s)/2,Ps,Bs,Ms=null,Ws=Ns({allowedTypes:["minimum","extremum"],comparison:"atMost",value:Vs});Ws.success===!0?(Bs="minimum",Ps=Ws.point.y,ss.splice(Ws.ind,1),Ms=0):(Bs="point",Ps=Rs-ds),hs.push({type:Bs,x:ks,y:Ps,slope:Ms})}}else if(_s==="minimum"&&ws=Es)return{success:!0,ind:Rs,point:Is}}}return{success:!1}}}function computeSplineParamCoeffs({dependencyValues:as}){let rs=function(cs,ds,ps,fs,hs){return[cs,ps,(-3*cs/hs+3*ds/hs-2*ps-fs)/hs,(2*cs/hs-2*ds/hs+ps+fs)/(hs*hs)]},ns=as.interpolationPoints;if(ns===null)return{setValue:{xs:null,coeffs:null}};let ss=[],os=[],ls,us=ns[0];os.push(us.x);for(let cs=1;csos.componentIsSpecifiedType(fs,"label");if(ss.length===0||!ss.every(fs=>{var hs;return typeof fs=="string"||((hs=fs.doenetAttributes)==null?void 0:hs.createdFromMacro)||ls(fs)}))return{success:!1};let us=ss.map(ls),cs=[],ds=[],ps=[];if(us.filter(fs=>fs).length===0)cs=ss;else{if(us[0]){let hs=us.indexOf(!1);hs!==-1&&(ds=ss.slice(0,hs),ss=ss.slice(hs),us=us.slice(hs))}let fs=us.indexOf(!0);fs===-1?cs=ss:(cs=ss.slice(0,fs),ps=ss.slice(fs))}return cs.length===0?{success:!1}:cs.length===1&&typeof cs[0]!="string"?{success:!1}:{success:!0,newChildren:[...ds,{componentType:"math",children:cs},...ps]}};return rs.push({replacementFunction:ns}),rs}static returnStateVariableDefinitions({numerics:rs}){let ns=super.returnStateVariableDefinitions({numerics:rs}),ss=this.componentType;ns.isInterpolatedFunction={returnDependencies:()=>({}),definition:()=>({setValue:{isInterpolatedFunction:!1}})},delete ns.nPrescribedPoints,delete ns.prescribedPoints,delete ns.prescribedMinima,delete ns.prescribedMaxima,delete ns.prescribedExtrema,delete ns.interpolationPoints,delete ns.xs,ns.operatorBasedOnFormulaIfAvailable={returnDependencies:()=>({}),definition:()=>({setValue:{operatorBasedOnFormulaIfAvailable:!1}})},ns.formula.returnDependencies=()=>({}),ns.formula.definition=()=>({setValue:{formula:Context.fromAst("_")}}),ns.operatorComposesWithOriginal={returnDependencies:()=>({}),definition:()=>({setValue:{operatorComposesWithOriginal:!0}})},ns.symbolicFunctionOperator={returnDependencies:()=>({}),definition:()=>({setValue:{symbolicFunctionOperator:us=>Context.fromAst("_")}})},ns.numericalFunctionOperator={additionalStateVariablesDefined:["numericalFunctionOperatorArguments"],returnDependencies:()=>({}),definition:()=>({setValue:{numericalFunctionOperator:us=>NaN,numericalFunctionOperatorArguments:[]}})},ns.formulaOperator={returnDependencies:()=>({}),definition:()=>({setValue:{formulaOperator:us=>Context.fromAst("_")}})},ns.returnNumericalDerivatives={returnDependencies:()=>({}),definition:()=>({setValue:{returnNumericalDerivatives:null}})},ns.formula={public:!0,shadowingInstructions:{createComponentOfType:"math"},additionalStateVariablesDefined:["operatorBasedOnFormula"],returnDependencies:()=>({operatorBasedOnFormulaIfAvailable:{dependencyType:"stateVariable",variableName:"operatorBasedOnFormulaIfAvailable"},functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["formula"]},mathChild:{dependencyType:"child",childGroups:["maths"],variableNames:["value"]},formulaOperator:{dependencyType:"stateVariable",variableName:"formulaOperator"}}),definition:function({dependencyValues:us}){if(!us.operatorBasedOnFormulaIfAvailable||(us.functionChild.length===0||us.functionChild[0].stateValues.formula.tree==="_")&&(us.mathChild.length===0||us.mathChild[0].stateValues.value.tree==="_"))return{setValue:{formula:Context.fromAst("_"),operatorBasedOnFormula:!1}};let cs;return us.functionChild.length===0?cs=us.mathChild[0].stateValues.value:cs=us.functionChild[0].stateValues.formula,{setValue:{formula:us.formulaOperator(cs),operatorBasedOnFormula:!0}}}},ns.symbolicfs={isArray:!0,entryPrefixes:["symbolicf"],returnArraySizeDependencies:()=>({nOutputs:{dependencyType:"stateVariable",variableName:"nOutputs"}}),returnArraySize({dependencyValues:us}){return[us.nOutputs]},returnArrayDependenciesByKey:()=>({globalDependencies:{operatorBasedOnFormula:{dependencyType:"stateVariable",variableName:"operatorBasedOnFormula"},formula:{dependencyType:"stateVariable",variableName:"formula"},variables:{dependencyType:"stateVariable",variableName:"variables"},nInputs:{dependencyType:"stateVariable",variableName:"nInputs"},simplify:{dependencyType:"stateVariable",variableName:"simplify"},expand:{dependencyType:"stateVariable",variableName:"expand"},functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["symbolicfs"]},mathChild:{dependencyType:"child",childGroups:["maths"],variableNames:["value"]},symbolicFunctionOperator:{dependencyType:"stateVariable",variableName:"symbolicFunctionOperator"},operatorComposesWithOriginal:{dependencyType:"stateVariable",variableName:"operatorComposesWithOriginal"},domain:{dependencyType:"stateVariable",variableName:"domain"}}}),arrayDefinitionByKey:function({globalDependencyValues:us,usedDefault:cs,arrayKeys:ds,arraySize:ps}){if(us.operatorBasedOnFormula){let fs={};for(let hs of ds)return fs[hs]=returnSymbolicFunctionFromFormula({formula:us.formula,simplify:us.simplify,expand:us.expand,nInputs:us.nInputs,variables:us.variables,domain:us.domain,component:hs}),{setValue:{symbolicfs:fs}}}else if(us.operatorComposesWithOriginal)if(us.functionChild.length===0)if(us.mathChild.length===0){let fs={};for(let hs of ds)fs[hs]=gs=>Context.fromAst("_");return{setValue:{symbolicfs:fs}}}else{let fs=Object.assign({},us);fs.formula=us.mathChild[0].stateValues.value;let hs=[];for(let ys=0;ysus.symbolicFunctionOperator(...hs.map(vs=>vs(...bs)));return{setValue:{symbolicfs:gs}}}else{let fs=[];for(let gs=0;gsus.symbolicFunctionOperator(...fs.map(bs=>bs(...ys)));return{setValue:{symbolicfs:hs}}}else{let fs={};for(let hs of ds)fs[hs]=(...gs)=>us.symbolicFunctionOperator(...gs);return{setValue:{symbolicfs:fs}}}}},ns.numericalfs={isArray:!0,entryPrefixes:["numericalf"],returnArraySizeDependencies:()=>({nOutputs:{dependencyType:"stateVariable",variableName:"nOutputs"}}),returnArraySize({dependencyValues:us}){return[us.nOutputs]},returnArrayDependenciesByKey:()=>({globalDependencies:{operatorBasedOnFormula:{dependencyType:"stateVariable",variableName:"operatorBasedOnFormula"},formula:{dependencyType:"stateVariable",variableName:"formula"},variables:{dependencyType:"stateVariable",variableName:"variables"},nInputs:{dependencyType:"stateVariable",variableName:"nInputs"},functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["numericalfs"]},mathChild:{dependencyType:"child",childGroups:["maths"],variableNames:["value"]},numericalFunctionOperator:{dependencyType:"stateVariable",variableName:"numericalFunctionOperator"},operatorComposesWithOriginal:{dependencyType:"stateVariable",variableName:"operatorComposesWithOriginal"},domain:{dependencyType:"stateVariable",variableName:"domain"}}}),arrayDefinitionByKey:function({globalDependencyValues:us,usedDefault:cs,arrayKeys:ds,arraySize:ps}){if(us.operatorBasedOnFormula){let fs={};for(let hs of ds)return fs[hs]=returnNumericalFunctionFromFormula({formula:us.formula,nInputs:us.nInputs,variables:us.variables,domain:us.domain,component:hs}),{setValue:{numericalfs:fs}}}else if(us.operatorComposesWithOriginal)if(us.functionChild.length===0)if(us.mathChild.length===0){let fs={};for(let hs of ds)fs[hs]=gs=>NaN;return{setValue:{numericalfs:fs}}}else{let fs=Object.assign({},us);fs.formula=us.mathChild[0].stateValues.value;let hs=[];for(let ys=0;ysus.numericalFunctionOperator(...hs.map(vs=>vs(...bs)));return{setValue:{numericalfs:gs}}}else{let fs=[];for(let gs=0;gsus.numericalFunctionOperator(...fs.map(bs=>bs(...ys)));return{setValue:{numericalfs:hs}}}else{let fs={};for(let hs of ds)fs[hs]=(...gs)=>us.numericalFunctionOperator(...gs);return{setValue:{numericalfs:fs}}}}},ns.fDefinitions={isArray:!0,entryPrefixes:["fDefinition"],returnArraySizeDependencies:()=>({nOutputs:{dependencyType:"stateVariable",variableName:"nOutputs"}}),returnArraySize({dependencyValues:us}){return[us.nOutputs]},returnArrayDependenciesByKey:()=>({globalDependencies:{operatorBasedOnFormula:{dependencyType:"stateVariable",variableName:"operatorBasedOnFormula"},formula:{dependencyType:"stateVariable",variableName:"formula"},variables:{dependencyType:"stateVariable",variableName:"variables"},nInputs:{dependencyType:"stateVariable",variableName:"nInputs"},nOutputs:{dependencyType:"stateVariable",variableName:"nOutputs"},functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["fDefinitions"]},mathChild:{dependencyType:"child",childGroups:["maths"],variableNames:["value"]},numericalFunctionOperator:{dependencyType:"stateVariable",variableName:"numericalFunctionOperator"},numericalFunctionOperatorArguments:{dependencyType:"stateVariable",variableName:"numericalFunctionOperatorArguments"},operatorComposesWithOriginal:{dependencyType:"stateVariable",variableName:"operatorComposesWithOriginal"},domain:{dependencyType:"stateVariable",variableName:"domain"}}}),arrayDefinitionByKey:function({globalDependencyValues:us,usedDefault:cs,arrayKeys:ds,arraySize:ps}){if(us.operatorBasedOnFormula){let fs={};for(let hs of ds)fs[hs]={functionType:"formula",formula:us.formula.tree,variables:us.variables.map(gs=>gs.tree),nInputs:us.nInputs,nOutputs:us.nOutputs,domain:us.domain,component:hs};return{setValue:{fDefinitions:fs}}}else if(us.operatorComposesWithOriginal)if(us.functionChild.length===0)if(us.mathChild.length===0){let fs={};for(let hs of ds)fs[hs]={functionType:"formula",formula:"_",variables:us.variables.map(gs=>gs.tree),nInputs:us.nInputs,nOutputs:us.nOutputs,domain:us.domain};return{setValue:{fDefinitions:fs}}}else throw Error("function operator with math child not implemented yet");else{let fs={};for(let hs of ds)fs[hs]={functionType:"functionOperator",componentType:ss,nOutputs:us.nOutputs,functionOperatorArguments:us.numericalFunctionOperatorArguments,operatorComposesWithOriginal:!0,originalFDefinition:us.functionChild[0].stateValues.fDefinitions[hs]};return{setValue:{fDefinitions:fs}}}else if(us.functionChild.length===0)if(us.mathChild.length===0){let fs={};for(let hs of ds)fs[hs]={functionType:"formula",formula:"_",variables:us.variables.map(gs=>gs.tree),nInputs:us.nInputs,nOutputs:us.nOutputs,domain:us.domain};return{setValue:{fDefinitions:fs}}}else throw Error("function operator with math child not implemented yet");else{let fs={};for(let hs of ds)fs[hs]={functionType:"functionOperator",componentType:ss,nOutputs:us.nOutputs,functionOperatorArguments:us.numericalFunctionOperatorArguments,operatorComposesWithOriginal:!1,originalFDefinition:us.functionChild[0].stateValues.fDefinitions[hs]};return{setValue:{fDefinitions:fs}}}}};let os=ns.allMinima.returnDependencies;ns.allMinima.returnDependencies=function(us){let cs=os(us);return delete cs.functionChild,cs};let ls=ns.allMaxima.returnDependencies;return ns.allMaxima.returnDependencies=function(us){let cs=ls(us);return delete cs.functionChild,cs},ns}}zs(FunctionOperator,"componentType","_functionOperator");class ClampFunction extends FunctionOperator{static createAttributesObject(){let rs=super.createAttributesObject();return rs.lowerValue={createComponentOfType:"number",createStateVariable:"lowerValue",defaultValue:0,public:!0},rs.upperValue={createComponentOfType:"number",createStateVariable:"upperValue",defaultValue:1,public:!0},rs}static returnStateVariableDefinitions({numerics:rs}){let ns=super.returnStateVariableDefinitions({numerics:rs});return ns.numericalFunctionOperator={additionalStateVariablesDefined:["numericalFunctionOperatorArguments"],returnDependencies:()=>({lowerValue:{dependencyType:"stateVariable",variableName:"lowerValue"},upperValue:{dependencyType:"stateVariable",variableName:"upperValue"}}),definition:function({dependencyValues:ss}){return{setValue:{numericalFunctionOperator:functionOperatorDefinitions.clampFunction(ss.lowerValue,ss.upperValue),numericalFunctionOperatorArguments:[ss.lowerValue,ss.upperValue]}}}},ns.symbolicFunctionOperator={returnDependencies:()=>({numericalFunctionOperator:{dependencyType:"stateVariable",variableName:"numericalFunctionOperator"}}),definition({dependencyValues:ss}){return{setValue:{symbolicFunctionOperator:os=>Context.fromAst(ss.numericalFunctionOperator(os.evaluate_to_constant()))}}}},ns}}zs(ClampFunction,"componentType","clampFunction");class WrapFunctionPeriodic extends FunctionOperator{static createAttributesObject(){let rs=super.createAttributesObject();return rs.lowerValue={createComponentOfType:"number",createStateVariable:"lowerValue",defaultValue:0,public:!0},rs.upperValue={createComponentOfType:"number",createStateVariable:"upperValue",defaultValue:1,public:!0},rs}static returnStateVariableDefinitions({numerics:rs}){let ns=super.returnStateVariableDefinitions({numerics:rs});return ns.numericalFunctionOperator={additionalStateVariablesDefined:["numericalFunctionOperatorArguments"],returnDependencies:()=>({lowerValue:{dependencyType:"stateVariable",variableName:"lowerValue"},upperValue:{dependencyType:"stateVariable",variableName:"upperValue"}}),definition:function({dependencyValues:ss}){return{setValue:{numericalFunctionOperator:functionOperatorDefinitions.wrapFunctionPeriodic(ss.lowerValue,ss.upperValue),numericalFunctionOperatorArguments:[ss.lowerValue,ss.upperValue]}}}},ns.symbolicFunctionOperator={returnDependencies:()=>({numericalFunctionOperator:{dependencyType:"stateVariable",variableName:"numericalFunctionOperator"}}),definition({dependencyValues:ss}){return{setValue:{symbolicFunctionOperator:os=>Context.fromAst(ss.numericalFunctionOperator(os.evaluate_to_constant()))}}}},ns}}zs(WrapFunctionPeriodic,"componentType","wrapFunctionPeriodic");class Derivative extends FunctionOperator{static createAttributesObject(){let rs=super.createAttributesObject();return rs.derivVariables={createComponentOfType:"variables"},rs}static returnStateVariableDefinitions({numerics:rs}){let ns=super.returnStateVariableDefinitions({numerics:rs});return ns.operatorBasedOnFormulaIfAvailable={returnDependencies:()=>({}),definition:()=>({setValue:{operatorBasedOnFormulaIfAvailable:!0}})},ns.operatorComposesWithOriginal={returnDependencies:()=>({}),definition:()=>({setValue:{operatorComposesWithOriginal:!1}})},ns.haveFunctionChild={returnDependencies:()=>({functionChild:{dependencyType:"child",childGroups:["functions"]}}),definition({dependencyValues:ss}){return{setValue:{haveFunctionChild:ss.functionChild.length>0}}}},ns.nInputs={defaultValue:1,hasEssential:!0,public:!0,shadowingInstructions:{createComponentOfType:"integer"},stateVariablesDeterminingDependencies:["haveFunctionChild"],returnDependencies({stateValues:ss}){let os={nInputsAttr:{dependencyType:"attributeComponent",attributeName:"nInputs",variableNames:["value"]},functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["nInputs"]},variablesAttr:{dependencyType:"attributeComponent",attributeName:"variables",variableNames:["nComponents"]}};return ss.haveFunctionChild||(os.derivVariablesAttr={dependencyType:"attributeComponent",attributeName:"derivVariables",variableNames:["variables"]}),os},definition({dependencyValues:ss}){if(ss.nInputsAttr!==null){let os=ss.nInputsAttr.stateValues.value;return os>=0||(os=1),{setValue:{nInputs:os}}}else return ss.variablesAttr!==null?{setValue:{nInputs:Math.max(1,ss.variablesAttr.stateValues.nComponents)}}:ss.functionChild.length>0?{setValue:{nInputs:ss.functionChild[0].stateValues.nInputs}}:ss.derivVariablesAttr!==null?{setValue:{nInputs:[...new Set(ss.derivVariablesAttr.stateValues.variables.map(ls=>ls.subscripts_to_strings().tree))].length}}:{useEssentialOrDefaultValue:{nInputs:!0}}}},ns.variables={isArray:!0,public:!0,shadowingInstructions:{createComponentOfType:"variable"},entryPrefixes:["variable"],returnArraySizeDependencies:()=>({nInputs:{dependencyType:"stateVariable",variableName:"nInputs"}}),returnArraySize({dependencyValues:ss}){return[ss.nInputs]},stateVariablesDeterminingDependencies:["haveFunctionChild"],returnArrayDependenciesByKey({arrayKeys:ss,stateValues:os}){let ls={variablesAttr:{dependencyType:"attributeComponent",attributeName:"variables",variableNames:["variables"]},parentVariableForChild:{dependencyType:"parentStateVariable",variableName:"variableForChild"},isInterpolatedFunction:{dependencyType:"stateVariable",variableName:"isInterpolatedFunction"},haveFunctionChild:{dependencyType:"stateVariable",variableName:"haveFunctionChild"}},us={};if(os.haveFunctionChild)for(let cs of ss)us[cs]={functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["variable"+(Number(cs)+1)]}};else ls.derivVariablesAttr={dependencyType:"attributeComponent",attributeName:"derivVariables",variableNames:["variables"]};return{globalDependencies:ls,dependenciesByKey:us}},arrayDefinitionByKey({globalDependencyValues:ss,dependencyValuesByKey:os,arraySize:ls,arrayKeys:us,usedDefault:cs}){if(ss.variablesAttr!==null){let ds=ss.variablesAttr.stateValues.variables;return{setValue:{variables:returnNVariables(ls[0],ds)}}}else if(ss.haveFunctionChild){let ds={};for(let ps of us)ds[ps]=os[ps].functionChild[0].stateValues["variable"+(Number(ps)+1)];return{setValue:{variables:ds}}}else if(ss.derivVariablesAttr!==null){let ds=[],ps=[];for(let fs of ss.derivVariablesAttr.stateValues.variables){let hs=fs.subscripts_to_strings().tree;ps.includes(hs)||(ds.push(fs),ps.push(hs))}return{setValue:{variables:returnNVariables(ls[0],ds)}}}else return ss.parentVariableForChild&&!cs.parentVariableForChild?{setValue:{variables:Array(ls[0]).fill(ss.parentVariableForChild)}}:{setValue:{variables:returnNVariables(ls[0],[])}}}},ns.nDerivatives={public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies(){return{derivVariablesAttr:{dependencyType:"attributeComponent",attributeName:"derivVariables",variableNames:["nComponents"]}}},definition({dependencyValues:ss}){return ss.derivVariablesAttr!==null?{setValue:{nDerivatives:ss.derivVariablesAttr.stateValues.nComponents}}:{setValue:{nDerivatives:1}}}},ns.derivVariables={isArray:!0,public:!0,shadowingInstructions:{createComponentOfType:"variable"},entryPrefixes:["derivVariable"],returnArraySizeDependencies:()=>({nDerivatives:{dependencyType:"stateVariable",variableName:"nDerivatives"}}),returnArraySize({dependencyValues:ss}){return[ss.nDerivatives]},returnArrayDependenciesByKey(){return{globalDependencies:{derivVariablesAttr:{dependencyType:"attributeComponent",attributeName:"derivVariables",variableNames:["variables"]},variable1:{dependencyType:"stateVariable",variableName:"variable1"}}}},arrayDefinitionByKey({globalDependencyValues:ss}){return ss.derivVariablesAttr!==null?{setValue:{derivVariables:ss.derivVariablesAttr.stateValues.variables}}:{setValue:{derivVariables:{0:ss.variable1}}}}},ns.formulaOperator={returnDependencies:()=>({derivVariables:{dependencyType:"stateVariable",variableName:"derivVariables"}}),definition({dependencyValues:ss}){return{setValue:{formulaOperator:function(os){let ls=os.subscripts_to_strings();for(let us of ss.derivVariables)ls=ls.derivative(us.subscripts_to_strings().tree);return ls.strings_to_subscripts()}}}}},ns.numericalFunctionOperator={returnDependencies:()=>({functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["returnNumericalDerivatives"],variablesOptional:!0},derivVariables:{dependencyType:"stateVariable",variableName:"derivVariables"}}),additionalStateVariablesDefined:["returnNumericalDerivatives"],definition:function({dependencyValues:ss}){return ss.functionChild.length===0||!ss.functionChild[0].stateValues.returnNumericalDerivatives?{setValue:{numericalFunctionOperator:us=>NaN,returnNumericalDerivatives:null}}:{setValue:{numericalFunctionOperator:ss.functionChild[0].stateValues.returnNumericalDerivatives(ss.derivVariables),returnNumericalDerivatives:function(us){let cs=[...ss.derivVariables,...us];return ss.functionChild[0].stateValues.returnNumericalDerivatives(cs)}}}}},ns.numericalFunctionOperatorArguments={returnDependencies:()=>({functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["numericalDerivativesDefinition"],variablesOptional:!0},derivVariables:{dependencyType:"stateVariable",variableName:"derivVariables"}}),additionalStateVariablesDefined:["numericalDerivativesDefinition"],definition:function({dependencyValues:ss}){if(ss.functionChild.length===0||!ss.functionChild[0].stateValues.numericalDerivativesDefinition)return{setValue:{numericalFunctionOperatorArguments:[],numericalDerivativesDefinition:{}}};let os=ss.functionChild[0].stateValues.numericalDerivativesDefinition,ls={...os};return ls.additionalDerivVariables?ls.additionalDerivVariables=[...ss.derivVariables,...ls.additionalDerivVariables]:ls.additionalDerivVariables=[...ss.derivVariables],{setValue:{numericalFunctionOperatorArguments:[os,ss.derivVariables],numericalDerivativesDefinition:ls}}}},ns.symbolicFunctionOperator={returnDependencies:()=>({numericalFunctionOperator:{dependencyType:"stateVariable",variableName:"numericalFunctionOperator"}}),definition({dependencyValues:ss}){return{setValue:{symbolicFunctionOperator:os=>Context.fromAst(ss.numericalFunctionOperator(os.evaluate_to_constant()))}}}},ns}}zs(Derivative,"componentType","derivative");const FunctionOperators=Object.freeze(Object.defineProperty({__proto__:null,ClampFunction,Derivative,WrapFunctionPeriodic},Symbol.toStringTag,{value:"Module"}));class TextBaseOperatorOfMath extends Text{static returnChildGroups(){return[{group:"maths",componentTypes:["math"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions(),ns=this;return rs.value={public:!0,shadowingInstructions:{createComponentOfType:"text"},forRenderer:!0,returnDependencies:()=>({mathChildren:{dependencyType:"child",childGroups:["maths"],variableNames:["value"]}}),definition:function({dependencyValues:ss}){return{setValue:{value:ns.applyTextOperator(ss.mathChildren.map(os=>os.stateValues.value))}}}},rs}}zs(TextBaseOperatorOfMath,"componentType","_textOperatorOfMath"),zs(TextBaseOperatorOfMath,"rendererType","text");class ExtractMathOperator extends TextBaseOperatorOfMath{static applyTextOperator(rs){return rs.length===0?"":rs.length!==1?(console.warn("MathOperator requires exactly one math child"),""):Array.isArray(rs[0].tree)?rs[0].tree[0]:""}}zs(ExtractMathOperator,"componentType","extractMathOperator");const TextOperatorsOfMath=Object.freeze(Object.defineProperty({__proto__:null,ExtractMathOperator},Symbol.toStringTag,{value:"Module"}));class Extremum extends BaseComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.location={createComponentOfType:"math"},rs.value={createComponentOfType:"math"},rs}static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=function({matchedChildren:ss}){let us=returnBreakStringsSugarFunction({childrenToComponentFunction:cs=>({componentType:"math",children:cs}),mustStripOffOuterParentheses:!0})({matchedChildren:ss});if(!us.success&&ss.length===1)return{success:!0,newAttributes:{value:{component:{componentType:"math",children:ss}}}};if(us.success){if(us.newChildren.length===1)return{success:!0,newAttributes:{value:{component:us.newChildren[0]}}};if(us.newChildren.length===2){let cs=us.newChildren[0],ds=us.newChildren[1],ps={location:{component:cs},value:{component:ds}};return(cs.children.length===0||cs.children.length===1&&typeof cs.children[0]=="string"&&cs.children[0].trim()==="")&&delete ps.location,(ds.children.length===0||ds.children.length===1&&typeof ds.children[0]=="string"&&ds.children[0].trim()==="")&&delete ps.value,{success:!0,newAttributes:ps}}else return{success:!1}}return us};return rs.push({childrenRegex:/s+(.*s)?/,replacementFunction:ns}),rs}static returnChildGroups(){return[{group:"points",componentTypes:["point"]}]}static returnStateVariableDefinitions({numerics:rs}){let ns=super.returnStateVariableDefinitions({numerics:rs}),ss=this;return ns.value={public:!0,shadowingInstructions:{createComponentOfType:"math"},defaultValue:null,hasEssential:!0,additionalStateVariablesDefined:[{variableName:"location",public:!0,shadowingInstructions:{createComponentOfType:"math"},defaultValue:null,hasEssential:!0}],returnDependencies:()=>({extremumChild:{dependencyType:"child",childGroups:["points"],variableNames:["nDimensions","xs"]},location:{dependencyType:"attributeComponent",attributeName:"location",variableNames:["value"]},value:{dependencyType:"attributeComponent",attributeName:"value",variableNames:["value"]}}),definition:function({dependencyValues:os}){let ls,us;if(os.extremumChild.length>0){let gs=os.extremumChild[0];gs.stateValues.nDimensions!==2?(console.log("Cannot determine "+ss.componentType+" from a point that isn't 2D"),ls=null,us=null):(ls=gs.stateValues.xs[0],us=gs.stateValues.xs[1])}else os.location!==null&&(ls=os.location.stateValues.value),os.value!==null&&(us=os.value.stateValues.value);let cs={},ds={},ps=!1,fs=!1;ls===void 0?(ds.location=!0,fs=!0):(cs.location=ls,ps=!0),us===void 0?(ds.value=!0,fs=!0):(cs.value=us,ps=!0);let hs={};return ps&&(hs.setValue=cs),fs&&(hs.useEssentialOrDefaultValue=ds),hs}},ns}}zs(Extremum,"componentType","extremum"),zs(Extremum,"rendererType");class Extrema extends BaseComponent{static get componentTypeCapitalized(){return this.componentType.charAt(0).toUpperCase()+this.componentType.slice(1)}static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=this,ss=function({matchedChildren:os}){let ls=breakEmbeddedStringsIntoParensPieces({componentList:os});return ls.success!==!0?{success:!1}:{success:!0,newChildren:ls.pieces.map(function(us){return us.length>1||typeof us[0]=="string"?{componentType:ns.componentTypeSingular,children:us}:us[0]})}};return rs.push({replacementFunction:ss}),rs}static returnChildGroups(){return[{group:"extrema",componentTypes:[this.componentTypeSingular]},{group:"points",componentTypes:["point"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions(),ns=this;return rs["n"+ns.componentTypeCapitalized]={additionalStateVariablesDefined:["childIdentities"],returnDependencies:()=>({children:{dependencyType:"child",childGroups:["extrema","points"]}}),definition:function({dependencyValues:ss}){return{setValue:{["n"+ns.componentTypeCapitalized]:ss.children.length,childIdentities:ss.children}}}},rs[ns.componentType]={isArray:!0,nDimensions:2,entryPrefixes:[ns.componentTypeSingular,ns.componentTypeSingular+"Locations",ns.componentTypeSingular+"Location",ns.componentTypeSingular+"Values",ns.componentTypeSingular+"Value"],stateVariablesDeterminingDependencies:["childIdentities"],getArrayKeysFromVarName({arrayEntryPrefix:ss,varEnding:os,arraySize:ls}){if([ns.componentTypeSingular,ns.componentTypeSingular+"Location",ns.componentTypeSingular+"Value"].includes(ss)){let us=Number(os)-1;return Number.isInteger(us)&&us>=0?!ls||uscs+",0"):["0,0"]:ss===ns.componentTypeSingular+"Values"?os!==""?[]:ls?Array.from(Array(ls[0]),(us,cs)=>cs+",1"):["0,1"]:[]},arrayVarNameFromArrayKey(ss){let[os,ls]=ss.split(",");return ls==="0"?ns.componentTypeSingular+"Location"+(Number(os)+1):ns.componentTypeSingular+"Value"+(Number(os)+1)},arrayVarNameFromPropIndex(ss,os){if(os===ns.componentType){if(ss.length===1)return ns.componentTypeSingular+ss[0];{let us=Number(ss[0]);if(Number.isInteger(us)&&us>0){if(ss[1]===1)return ns.componentTypeSingular+"Location"+us;if(ss[1]===2)return ns.componentTypeSingular+"Value"+us}return null}}if(os===ns.componentTypeSingular+"Locations")return ns.componentTypeSingular+"Location"+ss[0];if(os===ns.componentTypeSingular+"Values")return ns.componentTypeSingular+"Value"+ss[0];let ls=ns.componentTypeSingular.length;if(os.slice(0,ls)===ns.componentTypeSingular){let us=Number(os.slice(ls));if(Number.isInteger(us)&&us>0){if(ss[0]===1)return ns.componentTypeSingular+"Location"+us;if(ss[0]===2)return ns.componentTypeSingular+"Value"+us}}return null},returnArraySizeDependencies:()=>({nChildren:{dependencyType:"stateVariable",variableName:"n"+ns.componentTypeCapitalized}}),returnArraySize({dependencyValues:ss}){return[ss.nChildren,2]},returnArrayDependenciesByKey({arrayKeys:ss,stateValues:os}){let ls={};for(let us of ss){let[cs,ds]=us.split(","),ps;os.childIdentities[cs].componentType===ns.componentTypeSingular?ps=Number(ds)===0?"location":"value":ps="x"+(Number(ds)+1),ls[us]={child:{dependencyType:"child",childGroups:["extrema","points"],variableNames:[ps],childIndices:[cs]}}}return{dependenciesByKey:ls}},arrayDefinitionByKey({dependencyValuesByKey:ss,arrayKeys:os}){let ls={};for(let us of os){let cs=ss[us].child[0];if(cs){let ds=us.split(",")[1],ps=Number(ds)===0?"location":"value";ps in cs.stateValues?ls[us]=cs.stateValues[ps]:ls[us]=cs.stateValues["x"+(Number(ds)+1)]}}return{setValue:{[ns.componentType]:ls}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ss,dependencyNamesByKey:os}){let ls=[];for(let us in ss[ns.componentType])ls.push({setDependency:os[us].extremumChild,desiredValue:ss[ns.componentType][us],childIndex:0,variableIndex:0});return{success:!0,instructions:ls}}},rs}}zs(Extrema,"componentType","extrema"),zs(Extrema,"rendererType"),zs(Extrema,"componentTypeSingular","extremum");const Extrema$1=Object.freeze(Object.defineProperty({__proto__:null,Extrema,Extremum},Symbol.toStringTag,{value:"Module"}));class InlineRenderInlineChildren extends InlineComponent{static returnChildGroups(){return[{group:"inlines",componentTypes:["_inline"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions(),ns=this;return rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({inlineChildren:{dependencyType:"child",childGroups:["inlines"],variableNames:["text"],variablesOptional:!0}}),definition:function({dependencyValues:ss}){let os="";for(let ls of ss.inlineChildren)typeof ls!="object"?os+=ls.toString():typeof ls.stateValues.text=="string"?os+=ls.stateValues.text:os+=" ";return os=ns.beginTextDelimiter+os+ns.endTextDelimiter,{setValue:{text:os}}}},rs}}zs(InlineRenderInlineChildren,"componentType","_inlineRenderInlineChildren"),zs(InlineRenderInlineChildren,"renderChildren",!0),zs(InlineRenderInlineChildren,"includeBlankStringChildren",!0),zs(InlineRenderInlineChildren,"beginTextDelimiter",""),zs(InlineRenderInlineChildren,"endTextDelimiter","");class Em extends InlineRenderInlineChildren{}zs(Em,"componentType","em");class Alert extends InlineRenderInlineChildren{}zs(Alert,"componentType","alert");var Uu;let Q$2=(Uu=class extends InlineRenderInlineChildren{},zs(Uu,"componentType","q"),zs(Uu,"beginTextDelimiter",'"'),zs(Uu,"endTextDelimiter",'"'),Uu);class SQ extends InlineRenderInlineChildren{}zs(SQ,"componentType","sq"),zs(SQ,"beginTextDelimiter","'"),zs(SQ,"endTextDelimiter","'");class Term extends InlineRenderInlineChildren{}zs(Term,"componentType","term"),zs(Term,"rendererType","alert");var pp;let C$2=(pp=class extends InlineRenderInlineChildren{},zs(pp,"componentType","c"),pp);class Tag extends InlineRenderInlineChildren{}zs(Tag,"componentType","tag"),zs(Tag,"rendererType","tag"),zs(Tag,"beginTextDelimiter","<"),zs(Tag,"endTextDelimiter",">");class Tage extends InlineRenderInlineChildren{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.selfClosed={forRenderer:!0,returnDependencies:()=>({}),definition:()=>({setValue:{selfClosed:!0}})},rs}}zs(Tage,"componentType","tage"),zs(Tage,"rendererType","tag"),zs(Tage,"beginTextDelimiter","<"),zs(Tage,"endTextDelimiter","/>");class Attr extends InlineRenderInlineChildren{}zs(Attr,"componentType","attr"),zs(Attr,"rendererType","c");const ParagraphMarkup=Object.freeze(Object.defineProperty({__proto__:null,Alert,Attr,C:C$2,Em,Q:Q$2,SQ,Tag,Tage,Term},Symbol.toStringTag,{value:"Module"}));class SingleCharacter extends InlineComponent{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({}),definition:()=>({setValue:{text:this.unicodeCharacter}})},rs}}zs(SingleCharacter,"componentType","_singleCharacterInline"),zs(SingleCharacter,"unicodeCharacter","");class Ndash extends SingleCharacter{}zs(Ndash,"componentType","ndash"),zs(Ndash,"unicodeCharacter","–");class Mdash extends SingleCharacter{}zs(Mdash,"componentType","mdash"),zs(Mdash,"unicodeCharacter","—");class NBSP extends SingleCharacter{}zs(NBSP,"componentType","nbsp"),zs(NBSP,"unicodeCharacter"," ");class Ellipsis extends SingleCharacter{}zs(Ellipsis,"componentType","ellipsis"),zs(Ellipsis,"unicodeCharacter","…");const SingleCharacterComponents=Object.freeze(Object.defineProperty({__proto__:null,Ellipsis,Mdash,NBSP,Ndash},Symbol.toStringTag,{value:"Module"}));class BlockComponent extends BaseComponent{}zs(BlockComponent,"componentType","_block");function returnDefaultFeedbackDefinitions(){return{numericalerror:"Credit reduced because numbers in your answer weren't quite right. Did you round too much?",goodjob:"Good job!",onesignerror:"Credit reduced because it appears that you made a sign error.",twosignerrors:"Credit reduced because it appears that you made two sign errors."}}function returnFeedbackDefinitionStateVariables(){let as={};return as.setupChildren={returnDependencies:()=>({setupChildren:{dependencyType:"child",childGroups:["setups"],proceedIfAllChildrenNotMatched:!0}}),definition({dependencyValues:rs}){return{setValue:{setupChildren:rs.setupChildren}}}},as.feedbackDefinitions={stateVariablesDeterminingDependencies:["setupChildren"],returnDependencies({stateValues:rs}){let ns={ancestorWithFeedback:{dependencyType:"ancestor",variableNames:["feedbackDefinitions"]},setupChildren:{dependencyType:"child",childGroups:["setups"],proceedIfAllChildrenNotMatched:!0}};for(let ss of rs.setupChildren)ns[`feedbackDefinitionsOf${ss.componentName}`]={dependencyType:"child",parentName:ss.componentName,childGroups:["feedbackDefinitions"],variableNames:["value"]};return ns},definition({dependencyValues:rs}){let ns={},ss;rs.ancestorWithFeedback&&(ss=rs.ancestorWithFeedback.stateValues.feedbackDefinitions),ss||(ss=returnDefaultFeedbackDefinitions()),Object.assign(ns,ss);let os=[];for(let ls of rs.setupChildren)os.push(...rs[`feedbackDefinitionsOf${ls.componentName}`]);for(let ls of os)Object.assign(ns,ls.stateValues.value);return{setValue:{feedbackDefinitions:ns}}}},as}class SectioningComponent extends BlockComponent{constructor(rs){super(rs),Object.assign(this.actions,{submitAllAnswers:this.submitAllAnswers.bind(this),revealSection:this.revealSection.bind(this),closeSection:this.closeSection.bind(this),recordVisibilityChange:this.recordVisibilityChange.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.aggregateScores={createComponentOfType:"boolean",createStateVariable:"aggregateScores",defaultValue:!1,public:!0},rs.weight={createComponentOfType:"number",createStateVariable:"weight",defaultValue:1,public:!0},rs.sectionWideCheckWork={createComponentOfType:"boolean",createStateVariable:"sectionWideCheckWork",defaultValue:!1,public:!0},rs.submitLabel={createComponentOfType:"text",createStateVariable:"submitLabel",defaultValue:"Check Work",public:!0,forRenderer:!0},rs.submitLabelNoCorrectness={createComponentOfType:"text",createStateVariable:"submitLabelNoCorrectness",defaultValue:"Submit Response",public:!0,forRenderer:!0},rs.boxed={createComponentOfType:"boolean",createStateVariable:"boxed",defaultValue:!1,public:!0,forRenderer:!0},rs.suppressAutoName={createComponentOfType:"boolean",createStateVariable:"suppressAutoName",defaultValue:!1,public:!0},rs.suppressAutoNumber={createComponentOfType:"boolean",createStateVariable:"suppressAutoNumber",defaultValue:!1,public:!0},rs.includeAutoName={createComponentOfType:"boolean",createStateVariable:"includeAutoName",defaultValue:!1,public:!0},rs.includeAutoNumber={createComponentOfType:"boolean",createStateVariable:"includeAutoNumber",defaultValue:!1,public:!0},rs.includeAutoNameNumberIfNoTitle={createComponentOfType:"boolean",createStateVariable:"includeAutoNameNumberIfNoTitle",defaultValue:!0,public:!0},rs.includeParentNumber={createComponentOfType:"boolean",createStateVariable:"includeParentNumber",defaultValue:!1,public:!0},rs.level={createComponentOfType:"integer"},rs}static returnChildGroups(){return[{group:"variantControls",componentTypes:["variantControl"]},{group:"titles",componentTypes:["title"]},{group:"setups",componentTypes:["setup"]},{group:"anything",componentTypes:["_base"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions(),ns=returnStyleDefinitionStateVariables();Object.assign(rs,ns);let ss=returnFeedbackDefinitionStateVariables();return Object.assign(rs,ss),rs.enumeration={additionalStateVariablesDefined:[{variableName:"sectionNumber",public:!0,shadowingInstructions:{createComponentOfType:"text"}}],returnDependencies:()=>({countAmongSiblings:{dependencyType:"countAmongSiblingsOfSameType"},sectionAncestor:{dependencyType:"ancestor",componentType:"_sectioningComponent",variableNames:["enumeration"]},includeParentNumber:{dependencyType:"stateVariable",variableName:"includeParentNumber"}}),definition({dependencyValues:os}){let ls=[];return os.includeParentNumber&&os.sectionAncestor&&ls.push(...os.sectionAncestor.stateValues.enumeration),ls.push(os.countAmongSiblings),{setValue:{enumeration:ls,sectionNumber:ls.join(".")}}}},rs.sectionName={returnDependencies:()=>({}),definition:()=>({setValue:{sectionName:"Section"}})},rs.titleChildName={forRenderer:!0,returnDependencies:()=>({titleChild:{dependencyType:"child",childGroups:["titles"]}}),definition({dependencyValues:os}){let ls=null;return os.titleChild.length>0&&(ls=os.titleChild[os.titleChild.length-1].componentName),{setValue:{titleChildName:ls}}}},rs.childIndicesToRender={returnDependencies:()=>({titleChildren:{dependencyType:"child",childGroups:["titles"]},allChildren:{dependencyType:"child",childGroups:["anything","variantControls","titles","setups"]},titleChildName:{dependencyType:"stateVariable",variableName:"titleChildName"}}),definition({dependencyValues:os}){let ls=[],us=os.titleChildren.map(cs=>cs.componentName);for(let[cs,ds]of os.allChildren.entries())(typeof ds!="object"||!us.includes(ds.componentName)||ds.componentName===os.titleChildName)&&ls.push(cs);return{setValue:{childIndicesToRender:ls}}}},rs.title={additionalStateVariablesDefined:[{variableName:"titlePrefix",forRenderer:!0,alwaysUpdateRenderer:!0}],public:!0,shadowingInstructions:{createComponentOfType:"text"},forRenderer:!0,alwaysUpdateRenderer:!0,returnDependencies:({sharedParameters:os})=>({titleChild:{dependencyType:"child",childGroups:["titles"],variableNames:["text"]},sectionName:{dependencyType:"stateVariable",variableName:"sectionName"},sectionNumber:{dependencyType:"stateVariable",variableName:"sectionNumber"},includeAutoName:{dependencyType:"stateVariable",variableName:"includeAutoName"},includeAutoNumber:{dependencyType:"stateVariable",variableName:"includeAutoNumber"},prerender:{dependencyType:"value",value:os.prerender},includeAutoNameNumberIfNoTitle:{dependencyType:"stateVariable",variableName:"includeAutoNameNumberIfNoTitle"}}),definition({dependencyValues:os}){let ls="",us="";const cs=os.titleChild.length>0;let ds=(os.includeAutoNumber||!cs&&os.includeAutoNameNumberIfNoTitle)&&!os.prerender,ps=os.includeAutoName||!cs&&os.includeAutoNameNumberIfNoTitle;return ds?(ps&&(ls=os.sectionName+" "),ls+=os.sectionNumber):ps&&(ls=os.sectionName),cs?(ls&&(os.includeAutoName?ls+=": ":ls+=". "),us=os.titleChild[os.titleChild.length-1].stateValues.text):us=ls,{setValue:{title:us,titlePrefix:ls}}}},rs.containerTag={forRenderer:!0,returnDependencies:()=>({}),definition:()=>({setValue:{containerTag:"section"}})},rs.level={forRenderer:!0,returnDependencies:()=>({ancestorLevel:{dependencyType:"ancestor",componentType:"_sectioningComponent",variableNames:["level"]},levelAttr:{dependencyType:"attributeComponent",attributeName:"level",variableNames:["value"]}}),definition({dependencyValues:os}){var us,cs;let ls=(us=os.levelAttr)==null?void 0:us.stateValues.value;return ls>0||(ls=(((cs=os.ancestorLevel)==null?void 0:cs.stateValues.level)||0)+1),{setValue:{level:ls}}}},rs.viewedSolution={defaultValue:!1,hasEssential:!0,returnDependencies:()=>({}),definition:()=>({useEssentialOrDefaultValue:{viewedSolution:!0}}),inverseDefinition({desiredStateVariableValues:os}){return{success:!0,instructions:[{setEssentialValue:"viewedSolution",value:os.viewedSolution}]}}},rs.scoredDescendants={returnDependencies:()=>({scoredDescendants:{dependencyType:"descendant",componentTypes:["_sectioningComponent","answer","setup"],variableNames:["scoredDescendants","aggregateScores","weight"],recurseToMatchedChildren:!1,variablesOptional:!0}}),definition({dependencyValues:os}){let ls=[];for(let us of os.scoredDescendants)us.componentType!=="setup"&&(us.stateValues.aggregateScores||us.stateValues.scoredDescendants===void 0?ls.push(us):ls.push(...us.stateValues.scoredDescendants));return{setValue:{scoredDescendants:ls}}}},rs.answerDescendants={returnDependencies:()=>({answerDescendants:{dependencyType:"descendant",componentTypes:["answer"],variableNames:["justSubmitted"],recurseToMatchedChildren:!1}}),definition({dependencyValues:os}){return{setValue:{answerDescendants:os.answerDescendants}}}},rs.justSubmitted={forRenderer:!0,returnDependencies:()=>({answerDescendants:{dependencyType:"stateVariable",variableName:"answerDescendants"}}),definition({dependencyValues:os}){return{setValue:{justSubmitted:os.answerDescendants.every(ls=>ls.stateValues.justSubmitted)}}}},rs.showCorrectness={forRenderer:!0,returnDependencies:()=>({showCorrectnessFlag:{dependencyType:"flag",flagName:"showCorrectness"}}),definition({dependencyValues:os}){return{setValue:{showCorrectness:os.showCorrectnessFlag!==!1}}}},rs.displayDigitsForCreditAchieved={returnDependencies:()=>({}),definition:()=>({setValue:{displayDigitsForCreditAchieved:3}})},rs.creditAchieved={public:!0,shadowingInstructions:{createComponentOfType:"number",addAttributeComponentsShadowingStateVariables:{displayDigits:{stateVariableToShadow:"displayDigitsForCreditAchieved"}}},forRenderer:!0,defaultValue:0,hasEssential:!0,additionalStateVariablesDefined:[{variableName:"percentCreditAchieved",public:!0,shadowingInstructions:{createComponentOfType:"number",addAttributeComponentsShadowingStateVariables:{displayDigits:{stateVariableToShadow:"displayDigitsForCreditAchieved"}}},defaultValue:0,hasEssential:!0}],stateVariablesDeterminingDependencies:["aggregateScores","scoredDescendants"],returnDependencies({stateValues:os}){let ls={aggregateScores:{dependencyType:"stateVariable",variableName:"aggregateScores"}};if(os.aggregateScores){ls.scoredDescendants={dependencyType:"stateVariable",variableName:"scoredDescendants"};for(let[us,cs]of os.scoredDescendants.entries())ls["creditAchieved"+us]={dependencyType:"stateVariable",componentName:cs.componentName,variableName:"creditAchieved"}}return ls},definition({dependencyValues:os}){if(!os.aggregateScores)return{setValue:{creditAchieved:0,percentCreditAchieved:0}};let ls=0,us=0;for(let[ps,fs]of os.scoredDescendants.entries()){let hs=fs.stateValues.weight;ls+=os["creditAchieved"+ps]*hs,us+=hs}let cs;us>0?cs=ls/us:cs=1;let ds=cs*100;return{setValue:{creditAchieved:cs,percentCreditAchieved:ds}}}},rs.creditAchievedIfSubmit={defaultValue:0,stateVariablesDeterminingDependencies:["aggregateScores","scoredDescendants"],returnDependencies({stateValues:os}){let ls={aggregateScores:{dependencyType:"stateVariable",variableName:"aggregateScores"}};if(os.aggregateScores){ls.scoredDescendants={dependencyType:"stateVariable",variableName:"scoredDescendants"};for(let[us,cs]of os.scoredDescendants.entries())ls["creditAchievedIfSubmit"+us]={dependencyType:"stateVariable",componentName:cs.componentName,variableName:"creditAchievedIfSubmit"}}return ls},definition({dependencyValues:os}){if(!os.aggregateScores)return{setValue:{creditAchievedIfSubmit:0}};let ls=0,us=0;for(let[ds,ps]of os.scoredDescendants.entries()){let fs=ps.stateValues.weight;ls+=os["creditAchievedIfSubmit"+ds]*fs,us+=fs}return{setValue:{creditAchievedIfSubmit:ls/us}}}},rs.generatedVariantInfo={additionalStateVariablesDefined:["isVariantComponent"],returnDependencies:({sharedParameters:os,componentInfoObjects:ls})=>({variantSeed:{dependencyType:"value",value:os.variantSeed},variantIndex:{dependencyType:"value",value:os.variantIndex},variantName:{dependencyType:"value",value:os.variantName},variantDescendants:{dependencyType:"descendant",componentTypes:Object.keys(ls.componentTypesCreatingVariants),variableNames:["isVariantComponent","generatedVariantInfo"],recurseToMatchedChildren:!1,variablesOptional:!0,includeNonActiveChildren:!0,ignoreReplacementsOfEncounteredComposites:!0}}),definition({dependencyValues:os,componentName:ls}){let us={};os.variantName?(us.index=os.variantIndex,us.name=os.variantName):us.seed=os.variantSeed,us.meta={createdBy:ls};let cs=us.subvariants=[];for(let ds of os.variantDescendants)ds.stateValues.isVariantComponent?cs.push(ds.stateValues.generatedVariantInfo):ds.stateValues.generatedVariantInfo&&cs.push(...ds.stateValues.generatedVariantInfo.subvariants);return{setValue:{generatedVariantInfo:us,isVariantComponent:!0}}}},rs.collapsible={forRenderer:!0,returnDependencies:()=>({}),definition(){return{setValue:{collapsible:!1}}}},rs.open={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},forRenderer:!0,defaultValue:!0,hasEssential:!0,returnDependencies:()=>({}),definition(){return{useEssentialOrDefaultValue:{open:!0}}},inverseDefinition({desiredStateVariableValues:os}){return{success:!0,instructions:[{setEssentialValue:"open",value:os.open}]}}},rs.createSubmitAllButton={forRenderer:!0,additionalStateVariablesDefined:[{variableName:"suppressAnswerSubmitButtons",forRenderer:!0}],returnDependencies:()=>({sectionWideCheckWork:{dependencyType:"stateVariable",variableName:"sectionWideCheckWork"},aggregateScores:{dependencyType:"stateVariable",variableName:"aggregateScores"},sectionAncestor:{dependencyType:"ancestor",componentType:"_sectioningComponent",variableNames:["suppressAnswerSubmitButtons"]},documentAncestor:{dependencyType:"ancestor",componentType:"document",variableNames:["suppressAnswerSubmitButtons"]}}),definition({dependencyValues:os,componentName:ls}){let us=!1,cs=!1;return os.documentAncestor.stateValues.suppressAnswerSubmitButtons||os.sectionAncestor&&os.sectionAncestor.stateValues.suppressAnswerSubmitButtons?cs=!0:os.sectionWideCheckWork&&(os.aggregateScores?(us=!0,cs=!0):console.warn(`Cannot create submit all button for ${ls} because it doesn't aggegrate scores`)),{setValue:{createSubmitAllButton:us,suppressAnswerSubmitButtons:cs}}}},rs.suppressCheckwork={forRenderer:!0,returnDependencies:()=>({autoSubmit:{dependencyType:"flag",flagName:"autoSubmit"}}),definition({dependencyValues:os}){return{setValue:{suppressCheckwork:os.autoSubmit}}}},rs}async submitAllAnswers({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){this.coreFunctions.requestRecordEvent({verb:"submitted",object:{componentName:this.componentName,componentType:this.componentType},result:{creditAchieved:await this.stateValues.creditAchievedIfSubmit}});let os=await this.stateValues.answerDescendants;for(let[ls,us]of await this.stateValues.answerDescendants.entries())await us.stateValues.justSubmitted||await this.coreFunctions.performAction({componentName:us.componentName,actionName:"submitAnswer",args:{actionId:rs,sourceInformation:ns,skipRendererUpdate:ss||ls({setValue:{level:4}}),rs.sectionName.definition=()=>({setValue:{sectionName:"Paragraphs"}}),rs}}zs(Paragraphs,"componentType","paragraphs"),zs(Paragraphs,"rendererType","section");class Aside extends SectioningComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.collapsible={createComponentOfType:"boolean",createStateVariable:"collapsible",defaultValue:!0,public:!0,forRenderer:!0},rs.startOpen={createComponentOfType:"boolean",createStateVariable:"startOpen",defaultValue:!1},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return delete rs.collapsible,rs.open.returnDependencies=()=>({startOpen:{dependencyType:"stateVariable",variableName:"startOpen"}}),rs.open.definition=({dependencyValues:ns})=>({useEssentialOrDefaultValue:{open:{defaultValue:ns.startOpen}}}),rs.level.definition=()=>({setValue:{level:3}}),rs.containerTag.definition=()=>({setValue:{containerTag:"aside"}}),rs.sectionName.definition=()=>({setValue:{sectionName:"Aside"}}),rs}}zs(Aside,"componentType","aside"),zs(Aside,"rendererType","section");class Problem extends SectioningComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.aggregateScores.defaultValue=!0,rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.sectionName.definition=()=>({setValue:{sectionName:"Problem"}}),rs}}zs(Problem,"componentType","problem"),zs(Problem,"rendererType","section");class Exercise extends Problem{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.sectionName.definition=()=>({setValue:{sectionName:"Exercise"}}),rs}}zs(Exercise,"componentType","exercise"),zs(Exercise,"rendererType","section");class Example extends SectioningComponent{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.sectionName.definition=()=>({setValue:{sectionName:"Example"}}),rs}}zs(Example,"componentType","example"),zs(Example,"rendererType","section");class StandinForFutureLayoutTag extends SectioningComponent{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.level.definition=()=>({setValue:{level:3}}),rs.containerTag.definition=()=>({setValue:{containerTag:"aside"}}),rs}}zs(StandinForFutureLayoutTag,"componentType","standinForFutureLayoutTag"),zs(StandinForFutureLayoutTag,"rendererType","section");class externalContent extends SectioningComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.includeAutoNameNumberIfNoTitle.defaultValue=!1,rs}}zs(externalContent,"componentType","externalContent"),zs(externalContent,"rendererType","section");const Sectioning=Object.freeze(Object.defineProperty({__proto__:null,Aside,Example,Exercise,Paragraphs,Problem,Section,StandinForFutureLayoutTag,Subsection,Subsubsection,externalContent},Symbol.toStringTag,{value:"Module"}));class Ol extends BlockComponent{constructor(rs){super(rs),Object.assign(this.actions,{recordVisibilityChange:this.recordVisibilityChange.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.label={createComponentOfType:"text",createStateVariable:"label",defaultValue:null,public:!0,forRenderer:!0},rs.level={createComponentOfType:"integer"},rs}static returnChildGroups(){return[{group:"lis",componentTypes:["li"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.numbered={forRenderer:!0,returnDependencies:()=>({}),definition:()=>({setValue:{numbered:!0}})},rs.level={forRenderer:!0,returnDependencies:()=>({ancestorLevel:{dependencyType:"ancestor",componentType:"ol",variableNames:["level"]},levelAttr:{dependencyType:"attributeComponent",attributeName:"level",variableNames:["value"]}}),definition({dependencyValues:ns}){var os,ls;let ss=(os=ns.levelAttr)==null?void 0:os.stateValues.value;return ss>0||(ss=(((ls=ns.ancestorLevel)==null?void 0:ls.stateValues.level)||0)+1),{setValue:{level:ss}}}},rs}recordVisibilityChange({isVisible:rs,actionId:ns}){this.coreFunctions.requestRecordEvent({verb:"visibilityChanged",object:{componentName:this.componentName,componentType:this.componentType},result:{isVisible:rs}}),this.coreFunctions.resolveAction({actionId:ns})}}zs(Ol,"componentType","ol"),zs(Ol,"rendererType","list"),zs(Ol,"renderChildren",!0);class Ul extends Ol{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.numbered={forRenderer:!0,returnDependencies:()=>({}),definition:()=>({setValue:{numbered:!1}})},rs}}zs(Ul,"componentType","ul"),zs(Ul,"rendererType","list");var Fu;let Li$1=(Fu=class extends BaseComponent{constructor(rs){super(rs),Object.assign(this.actions,{recordVisibilityChange:this.recordVisibilityChange.bind(this)})}static returnChildGroups(){return[{group:"anything",componentTypes:["_base"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.item={forRenderer:!0,returnDependencies:()=>({}),definition:()=>({setValue:{item:!0}})},rs}recordVisibilityChange({isVisible:rs,actionId:ns}){this.coreFunctions.requestRecordEvent({verb:"visibilityChanged",object:{componentName:this.componentName,componentType:this.componentType},result:{isVisible:rs}}),this.coreFunctions.resolveAction({actionId:ns})}},zs(Fu,"componentType","li"),zs(Fu,"rendererType","list"),zs(Fu,"renderChildren",!0),zs(Fu,"includeBlankStringChildren",!0),Fu);const Lists=Object.freeze(Object.defineProperty({__proto__:null,Li:Li$1,Ol,Ul},Symbol.toStringTag,{value:"Module"}));class ODESystem extends InlineComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.independentVariable={createComponentOfType:"variable",createStateVariable:"independentVariable",defaultValue:Context.fromAst("t"),public:!0},rs.initialIndependentVariableValue={createComponentOfType:"math",createStateVariable:"initialIndependentVariableValue",defaultValue:Context.fromAst(0),public:!0},rs.displayDigits={createComponentOfType:"integer",createStateVariable:"displayDigits",defaultValue:14,public:!0},rs.displayDecimals={createComponentOfType:"integer",createStateVariable:"displayDecimals",defaultValue:null,public:!0},rs.displaySmallAsZero={createComponentOfType:"number",createStateVariable:"displaySmallAsZero",valueForTrue:1e-14,valueForFalse:0,defaultValue:0,public:!0},rs.padZeros={createComponentOfType:"boolean",createStateVariable:"padZeros",defaultValue:!1,public:!0},rs.renderMode={createComponentOfType:"text",createStateVariable:"renderMode",defaultValue:"align",public:!0,forRenderer:!0},rs.chunkSize={createComponentOfType:"number",createStateVariable:"chunkSize",defaultValue:10,public:!0},rs.tolerance={createComponentOfType:"number",createStateVariable:"tolerance",defaultValue:1e-6,public:!0},rs.maxIterations={createComponentOfType:"number",createStateVariable:"maxIterations",defaultValue:1e3,public:!0},rs.hideInitialCondition={createComponentOfType:"boolean",createStateVariable:"hideInitialCondition",defaultValue:!1,public:!0},rs.initialConditions={createComponentOfType:"mathList"},rs.variables={createComponentOfType:"variables"},rs.number={createComponentOfType:"boolean",createStateVariable:"number",defaultValue:!1,public:!0},rs}static returnChildGroups(){return[{group:"rightHandSides",componentTypes:["rightHandSide"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.validIndependentVariable={returnDependencies:()=>({independentVarAttr:{dependencyType:"attributeComponent",attributeName:"independentVariable",variableNames:["validVariable"]}}),definition({dependencyValues:ns}){let ss=!0;return ns.independentVarAttr&&(ss=ns.independentVarAttr.stateValues.validVariable),{setValue:{validIndependentVariable:ss}}}},rs.nDimensions={returnDependencies:()=>({rhsChildren:{dependencyType:"child",childGroups:["rightHandSides"],skipComponentNames:!0}}),definition:function({dependencyValues:ns}){return{setValue:{nDimensions:ns.rhsChildren.length},checkForActualChange:{nDimensions:!0}}}},rs.variables={additionalStateVariablesDefined:[{variableName:"validVariables",isArray:!0,entryPrefixes:["validVar"]}],isArray:!0,public:!0,shadowingInstructions:{createComponentOfType:"variable"},entryPrefixes:["var"],returnArraySizeDependencies:()=>({nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),returnArraySize({dependencyValues:ns}){return[ns.nDimensions]},returnArrayDependenciesByKey(){return{globalDependencies:{nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"},variables:{dependencyType:"attributeComponent",attributeName:"variables",variableNames:["variables","validVariables"]},independentVariable:{dependencyType:"stateVariable",variableName:"independentVariable"}}}},arrayDefinitionByKey({globalDependencyValues:ns}){let ss=[],os=[],ls=ns.nDimensions;ns.variables!==null&&(ss=ns.variables.stateValues.variables,os=[...ns.variables.stateValues.validVariables].slice(0,ls));let us=returnNVariables(ls,ss);return us.some(cs=>cs.equals(ns.independentVariable))&&console.warn("Variables of odesystem must be different than independent variable."),os.length({nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),returnArraySize({dependencyValues:ns}){return[ns.nDimensions]},returnArrayDependenciesByKey({arrayKeys:ns}){let ss={};for(let os of ns)ss[os]={rhsChild:{dependencyType:"child",childGroups:["rightHandSides"],variableNames:["value"],childIndices:[os]}};return{dependenciesByKey:ss}},arrayDefinitionByKey({dependencyValuesByKey:ns,arrayKeys:ss}){let os={};for(let ls of ss)os[ls]=ns[ls].rhsChild[0].stateValues.value;return{setValue:{rhss:os}}}},rs.rhs={isAlias:!0,targetVariableName:"rhs1"},rs.righthandside={isAlias:!0,targetVariableName:"rhs1"},rs.righthandsides={isAlias:!0,targetVariableName:"rhss"},rs.initialConditions={isArray:!0,public:!0,shadowingInstructions:{createComponentOfType:"math"},entryPrefixes:["initialCondition"],defaultValueByArrayKey:()=>Context.fromAst(0),returnArraySizeDependencies:()=>({nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),returnArraySize({dependencyValues:ns}){return[ns.nDimensions]},returnArrayDependenciesByKey({arrayKeys:ns}){let ss={};for(let os of ns)ss[os]={initialConditionAttr:{dependencyType:"attributeComponent",attributeName:"initialConditions",variableNames:[`math${Number(os)+1}`]}};return{dependenciesByKey:ss}},arrayDefinitionByKey({dependencyValuesByKey:ns,arrayKeys:ss}){let os={},ls={};for(let cs of ss){let ds=!1;if(ns[cs].initialConditionAttr){let ps=ns[cs].initialConditionAttr.stateValues[`math${Number(cs)+1}`];ps!==void 0&&(ds=!0,os[cs]=ps)}ds||(ls[cs]=!0)}let us={};return Object.keys(os).length>0&&(us.setValue={initialConditions:os}),Object.keys(ls).length>0&&(us.useEssentialOrDefaultValue={initialConditions:ls}),us}},rs.initialCondition={isAlias:!0,targetVariableName:"initialCondition1"},rs.equationTag={public:!0,shadowingInstructions:{createComponentOfType:"text"},forRenderer:!0,stateVariablesDeterminingDependencies:["number"],returnDependencies({stateValues:ns}){return ns.number?{equationCounter:{dependencyType:"counter",counterName:"equation"}}:{}},definition({dependencyValues:ns}){return ns.equationCounter!==void 0?{setValue:{equationTag:String(ns.equationCounter)}}:{setValue:{equationTag:null}}}},rs.latex={public:!0,shadowingInstructions:{createComponentOfType:"text"},forRenderer:!0,returnDependencies(){return{nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"},variables:{dependencyType:"stateVariable",variableName:"variables"},initialConditions:{dependencyType:"stateVariable",variableName:"initialConditions"},hideInitialCondition:{dependencyType:"stateVariable",variableName:"hideInitialCondition"},displayDigits:{dependencyType:"stateVariable",variableName:"displayDigits"},displayDecimals:{dependencyType:"stateVariable",variableName:"displayDecimals"},displaySmallAsZero:{dependencyType:"stateVariable",variableName:"displaySmallAsZero"},padZeros:{dependencyType:"stateVariable",variableName:"padZeros"},independentVariable:{dependencyType:"stateVariable",variableName:"independentVariable"},initialIndependentVariableValue:{dependencyType:"stateVariable",variableName:"initialIndependentVariableValue"},rhss:{dependencyType:"stateVariable",variableName:"rhss"},number:{dependencyType:"stateVariable",variableName:"number"},equationTag:{dependencyType:"stateVariable",variableName:"equationTag"}}},definition({dependencyValues:ns,usedDefault:ss}){let os={};ns.padZeros&&(ss.displayDigits&&!ss.displayDecimals?Number.isFinite(ns.displayDecimals)&&(os.padToDecimals=ns.displayDecimals):ns.displayDigits>=1&&(os.padToDigits=ns.displayDigits));let ls=[],us=ns.independentVariable.toLatex();for(let ds=0;ds({latex:{dependencyType:"stateVariable",variableName:"latex"}}),definition:function({dependencyValues:ns}){return{setValue:{latexWithInputChildren:[ns.latex]}}}},rs.numericalRHSf={additionalStateVariablesDefined:["numericalRHSfDefinitions"],returnDependencies:()=>({validIndependentVariable:{dependencyType:"stateVariable",variableName:"validIndependentVariable"},independentVariable:{dependencyType:"stateVariable",variableName:"independentVariable"},validVariables:{dependencyType:"stateVariable",variableName:"validVariables"},variables:{dependencyType:"stateVariable",variableName:"variables"},rhss:{dependencyType:"stateVariable",variableName:"rhss"}}),definition({dependencyValues:ns}){let ss=!0;ns.validIndependentVariable||(console.warn("Can't define ODE RHS functions with invalid independent variable."),ss=!1),ns.validVariables.every(cs=>cs)||(console.warn("Can't define ODE RHS functions with an invalid variable."),ss=!1);let os=ns.independentVariable.subscripts_to_strings().tree,ls=ns.variables.map(cs=>cs.subscripts_to_strings().tree);ls.includes(os)&&(console.warn("Can't define ODE RHS functions when independent variable is a dependent variable"),ss=!1),[...new Set(ls)].length!==ls.length&&(console.warn("Can't define ODE RHS functions with duplicate dependent variable names"),ss=!1);let us;try{us=ns.rhss.map(cs=>cs.subscripts_to_strings().f())}catch{console.warn("Cannot define ODE RHS function. Error creating mathjs function"),ss=!1}if(!ss){let cs=ns.rhss.length;return{setValue:{numericalRHSf:()=>NaN,numericalRHSfDefinitions:Array(cs).fill({})}}}return{setValue:{numericalRHSf:function(cs,ds){let ps={[os]:cs};Array.isArray(ds)?ds.forEach((fs,hs)=>ps[ls[hs]]=fs):ps[ls[0]]=ds;try{return us.map(fs=>fs(ps))}catch{return NaN}},numericalRHSfDefinitions:ns.rhss.map(cs=>({functionType:"formula",formula:cs,nInputs:ls.length+1,variables:[os,...ls]}))}}}},rs.haveNumericalInitialConditions={additionalStateVariablesDefined:["t0","x0s"],returnDependencies:()=>({initialIndependentVariableValue:{dependencyType:"stateVariable",variableName:"initialIndependentVariableValue"},initialConditions:{dependencyType:"stateVariable",variableName:"initialConditions"}}),definition({dependencyValues:ns}){let ss=ns.initialIndependentVariableValue.evaluate_to_constant(),os=ns.initialConditions.map(us=>us.evaluate_to_constant()),ls=Number.isFinite(ss)&&os.every(us=>Number.isFinite(us));return{setValue:{t0:ss,x0s:os,haveNumericalInitialConditions:ls}}}},rs.numericalSolutions={isArray:!0,entryPrefixes:["numericalSolution"],public:!0,shadowingInstructions:{createComponentOfType:"function",addStateVariablesShadowingStateVariables:{fDefinitions:{stateVariableToShadow:"numericalSolutionFDefinitions"}}},createWorkspace:!0,returnArraySizeDependencies:()=>({nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),returnArraySize({dependencyValues:ns}){return[ns.nDimensions]},returnArrayDependenciesByKey(){return{globalDependencies:{nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"},validIndependentVariable:{dependencyType:"stateVariable",variableName:"validIndependentVariable"},independentVariable:{dependencyType:"stateVariable",variableName:"independentVariable"},validVariables:{dependencyType:"stateVariable",variableName:"validVariables"},variables:{dependencyType:"stateVariable",variableName:"variables"},chunkSize:{dependencyType:"stateVariable",variableName:"chunkSize"},tolerance:{dependencyType:"stateVariable",variableName:"tolerance"},maxIterations:{dependencyType:"stateVariable",variableName:"maxIterations"},haveNumericalInitialConditions:{dependencyType:"stateVariable",variableName:"haveNumericalInitialConditions"},t0:{dependencyType:"stateVariable",variableName:"t0"},x0s:{dependencyType:"stateVariable",variableName:"x0s"},numericalRHSf:{dependencyType:"stateVariable",variableName:"numericalRHSf"}}}},arrayDefinitionByKey({globalDependencyValues:ns,workspace:ss,componentName:os}){let ls={};if(ss.calculatedNumericSolutions=[],ss.endingNumericalValues=[],ss.maxPossibleTime=void 0,!ns.haveNumericalInitialConditions){for(let gs=0;gsNaN;return{setValue:{numericalSolutions:ls}}}let us=ns.t0,cs=ns.x0s,ds=ns.chunkSize,ps=ns.tolerance,fs=ns.numericalRHSf,hs=ns.maxIterations;for(let gs=0;gs=vs)for(let Ts=vs;Ts<=xs;Ts++){let Ss=ss.endingNumericalValues[Ts-1];Ss===void 0&&(Ss=cs);let Ns=us+Ts*ds,As=Context.math.dopri(Ns,Ns+ds,Ss,fs,ps,hs);ss.endingNumericalValues.push(As.y[As.y.length-1]),ss.calculatedNumericSolutions.push(As.at.bind(As));let ws=As.x[As.x.length-1];if(ws<(Ns+ds)*(1-1e-6)){ss.maxPossibleTime=ws;let Es="For chunksize "+ds+" and tolerance "+ps+", odesystem";os!==void 0&&(Es+=" ("+os+")"),Es+=" hit maxiterations ("+hs+") at t = "+ss.maxPossibleTime+". Will not calculate solution beyond that time. Decrease chunksize, increase maxiterations, or increase tolerance to calculate further.";break}}return bs>ss.maxPossibleTime?NaN:ss.calculatedNumericSolutions[xs](bs)[gs]};return{setValue:{numericalSolutions:ls}}}},rs.numericalSolution={isAlias:!0,targetVariableName:"numericalSolution1"},rs.numericalSolutionFDefinitions={forRenderer:!0,isArray:!0,entryPrefixes:["numericalSolutionFDefinition"],returnArraySizeDependencies:()=>({nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),returnArraySize({dependencyValues:ns}){return[ns.nDimensions]},returnArrayDependenciesByKey(){return{globalDependencies:{nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"},validIndependentVariable:{dependencyType:"stateVariable",variableName:"validIndependentVariable"},independentVariable:{dependencyType:"stateVariable",variableName:"independentVariable"},validVariables:{dependencyType:"stateVariable",variableName:"validVariables"},variables:{dependencyType:"stateVariable",variableName:"variables"},chunkSize:{dependencyType:"stateVariable",variableName:"chunkSize"},tolerance:{dependencyType:"stateVariable",variableName:"tolerance"},maxIterations:{dependencyType:"stateVariable",variableName:"maxIterations"},haveNumericalInitialConditions:{dependencyType:"stateVariable",variableName:"haveNumericalInitialConditions"},t0:{dependencyType:"stateVariable",variableName:"t0"},x0s:{dependencyType:"stateVariable",variableName:"x0s"},numericalRHSfDefinitions:{dependencyType:"stateVariable",variableName:"numericalRHSfDefinitions"}}}},arrayDefinitionByKey({globalDependencyValues:ns}){return ns.haveNumericalInitialConditions?{setValue:{numericalSolutionFDefinitions:[...Array(ns.nDimensions).keys()].map(ss=>({functionType:"ODESolution",nDimensions:ns.nDimensions,t0:ns.t0,x0s:ns.x0s,chunkSize:ns.chunkSize,tolerance:ns.tolerance,numericalRHSfDefinitions:ns.numericalRHSfDefinitions,maxIterations:ns.maxIterations,component:ss}))}}:{setValue:{numericalSolutionFDefinitions:Array(ns.nDimensions).fill({})}}}},rs}}zs(ODESystem,"componentType","odesystem"),zs(ODESystem,"rendererType","math");class Polyline extends GraphicalComponent{constructor(rs){super(rs),Object.assign(this.actions,{movePolyline:this.movePolyline.bind(this),finalizePolylinePosition:this.finalizePolylinePosition.bind(this),polylineClicked:this.polylineClicked.bind(this),mouseDownOnPolyline:this.mouseDownOnPolyline.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.draggable={createComponentOfType:"boolean",createStateVariable:"draggable",defaultValue:!0,public:!0,forRenderer:!0},rs.verticesDraggable={createComponentOfType:"boolean"},rs.vertices={createComponentOfType:"_pointListComponent"},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.styleDescription={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({selectedStyle:{dependencyType:"stateVariable",variableName:"selectedStyle"},document:{dependencyType:"ancestor",componentType:"document",variableNames:["theme"]}}),definition:function({dependencyValues:ns}){var ls;let ss;((ls=ns.document)==null?void 0:ls.stateValues.theme)==="dark"?ss=ns.selectedStyle.lineColorWordDarkMode:ss=ns.selectedStyle.lineColorWord;let os=ns.selectedStyle.lineWidthWord;return ns.selectedStyle.lineStyleWord&&(os&&(os+=" "),os+=ns.selectedStyle.lineStyleWord),os&&(os+=" "),os+=ss,{setValue:{styleDescription:os}}}},rs.styleDescriptionWithNoun={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({styleDescription:{dependencyType:"stateVariable",variableName:"styleDescription"}}),definition:function({dependencyValues:ns}){return{setValue:{styleDescriptionWithNoun:ns.styleDescription+" polyline"}}}},rs.verticesDraggable={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},hasEssential:!0,forRenderer:!0,returnDependencies:()=>({verticesDraggableAttr:{dependencyType:"attributeComponent",attributeName:"verticesDraggable",variableNames:["value"]},draggable:{dependencyType:"stateVariable",variableName:"draggable"}}),definition({dependencyValues:ns}){return ns.verticesDraggableAttr?{setValue:{verticesDraggable:ns.verticesDraggableAttr.stateValues.value}}:{useEssentialOrDefaultValue:{verticesDraggable:{defaultValue:ns.draggable}}}}},rs.nVertices={public:!0,shadowingInstructions:{createComponentOfType:"number"},forRenderer:!0,returnDependencies:()=>({vertices:{dependencyType:"attributeComponent",attributeName:"vertices",variableNames:["nPoints"]}}),definition:function({dependencyValues:ns}){return ns.vertices!==null?{setValue:{nVertices:ns.vertices.stateValues.nPoints}}:{setValue:{nVertices:0}}}},rs.nDimensions={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies(){return{vertices:{dependencyType:"attributeComponent",attributeName:"vertices",variableNames:["nDimensions"]}}},definition:function({dependencyValues:ns}){return ns.vertices!==null?{setValue:{nDimensions:ns.vertices.stateValues.nDimensions},checkForActualChange:{nDimensions:!0}}:{setValue:{nDimensions:2}}}},rs.vertices={public:!0,shadowingInstructions:{createComponentOfType:"math",returnWrappingComponents(ns){return ns==="vertexX"?[]:[["point",{componentType:"mathList",isAttribute:"xs"}]]}},isArray:!0,nDimensions:2,entryPrefixes:["vertexX","vertex"],getArrayKeysFromVarName({arrayEntryPrefix:ns,varEnding:ss,arraySize:os}){if(ns==="vertexX"){let ls=ss.split("_").map(us=>Number(us)-1);return ls.length===2&&ls.every((us,cs)=>Number.isInteger(us)&&us>=0)?os?ls.every((us,cs)=>us=0?os?lsls+","+cs):[]:[ls+",0"]:[]}},getAllArrayKeys(ns,ss=!0,os){function ls(us){if(us.length===1)return Array.from(Array(us[0]),(cs,ds)=>String(ds));{let cs=us[0],ds=ls(us.slice(1)),ps=[];for(let fs=0;fsfs+","+hs)):ps.push(ds.map(hs=>fs+","+hs));return ps}}if(os){if(os.length===0||!ns)return[];{let us=[...ns];return us[0]=os[0],ls(us)}}else return!ns||ns.length===0?[]:ls(ns)},arrayVarNameFromPropIndex(ns,ss){if(ss==="vertices")return ns.length===1?"vertex"+ns[0]:`vertexX${ns[0]}_${ns[1]}`;if(ss.slice(0,6)==="vertex"){let os=Number(ss.slice(6));if(Number.isInteger(os)&&os>0)return`vertexX${os}_${ns[0]}`}return null},returnArraySizeDependencies:()=>({nVertices:{dependencyType:"stateVariable",variableName:"nVertices"},nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),returnArraySize({dependencyValues:ns}){return[ns.nVertices,ns.nDimensions]},returnArrayDependenciesByKey({arrayKeys:ns}){let ss={};for(let os of ns){let[ls,us]=os.split(","),cs=Number(ls)+1+"_"+(Number(us)+1);ss[os]={vertices:{dependencyType:"attributeComponent",attributeName:"vertices",variableNames:["pointX"+cs]}}}return{dependenciesByKey:ss}},arrayDefinitionByKey({dependencyValuesByKey:ns,arrayKeys:ss}){let os={};for(let ls of ss){let[us,cs]=ls.split(","),ds=Number(us)+1+"_"+(Number(cs)+1),ps=ns[ls].vertices;ps!==null&&ps.stateValues["pointX"+ds]?os[ls]=ps.stateValues["pointX"+ds]:os[ls]=Context.fromAst("_")}return{setValue:{vertices:os}}},async inverseArrayDefinitionByKey({desiredStateVariableValues:ns,dependencyValuesByKey:ss,dependencyNamesByKey:os,initialChange:ls,stateValues:us}){let cs=[];for(let ds in ns.vertices){let[ps,fs]=ds.split(","),hs=Number(ps)+1+"_"+(Number(fs)+1);if(ss[ds].vertices!==null&&ss[ds].vertices.stateValues["pointX"+hs])cs.push({setDependency:os[ds].vertices,desiredValue:ns.vertices[ds],variableIndex:0});else return{success:!1}}return{success:!0,instructions:cs}}},rs.numericalVertices={isArray:!0,entryPrefixes:["numericalVertex"],forRenderer:!0,returnArraySizeDependencies:()=>({nVertices:{dependencyType:"stateVariable",variableName:"nVertices"}}),returnArraySize({dependencyValues:ns}){return[ns.nVertices]},returnArrayDependenciesByKey({arrayKeys:ns}){let ss={};for(let os of ns)ss[os]={vertex:{dependencyType:"stateVariable",variableName:"vertex"+(Number(os)+1)}};return{dependenciesByKey:ss}},arrayDefinitionByKey({dependencyValuesByKey:ns,arrayKeys:ss}){let os={};for(let ls of ss){let us=ns[ls].vertex.map(cs=>cs.evaluate_to_constant());us.every(cs=>Number.isFinite(cs))||(us=Array(us.length).fill(NaN)),os[ls]=us}return{setValue:{numericalVertices:os}}}},rs.nearestPoint={returnDependencies:()=>({nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"},numericalVertices:{dependencyType:"stateVariable",variableName:"numericalVertices"},nVertices:{dependencyType:"stateVariable",variableName:"nVertices"}}),definition({dependencyValues:ns}){var hs,gs,ys,bs;let ss=ns.nDimensions,os=ns.nVertices,ls=ns.numericalVertices,us=[],cs,ds,ps=(hs=ls[0])==null?void 0:hs[0],fs=(gs=ls[0])==null?void 0:gs[1];for(let vs=1;vs=1?Ws={x1:$s,x2:Rs}:Ws={x1:Es+Ms*ks*Cs,x2:_s+Ms*Ps*Ts};let Us=Math.pow((As-Ws.x1)/Cs,2)+Math.pow((ws-Ws.x2)/Ts,2);Us0&&(Ns.x3=0),Ns}}}}},rs}async movePolyline({pointCoords:rs,transient:ns,sourceDetails:ss,actionId:os,sourceInformation:ls={},skipRendererUpdate:us=!1}){if(Object.keys(rs).length===1){if(!await this.stateValues.verticesDraggable)return await this.coreFunctions.resolveAction({actionId:os})}else if(!await this.stateValues.draggable)return await this.coreFunctions.resolveAction({actionId:os});let ds={};for(let ps in rs)ds[ps+",0"]=Context.fromAst(rs[ps][0]),ds[ps+",1"]=Context.fromAst(rs[ps][1]);return ns?await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"vertices",value:ds,sourceDetails:ss}],transient:ns,actionId:os,sourceInformation:ls,skipRendererUpdate:us}):await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"vertices",value:ds,sourceDetails:ss}],actionId:os,sourceInformation:ls,skipRendererUpdate:us,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{pointCoordinates:rs}}})}async finalizePolylinePosition({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){return await this.actions.movePolyline({pointCoords:await this.stateValues.numericalVertices,transient:!1,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss})}async polylineClicked({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){await this.coreFunctions.triggerChainedActions({triggeringAction:"click",componentName:this.componentName,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss}),this.coreFunctions.resolveAction({actionId:rs})}async mouseDownOnPolyline({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){await this.coreFunctions.triggerChainedActions({triggeringAction:"down",componentName:this.componentName,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss}),this.coreFunctions.resolveAction({actionId:rs})}}zs(Polyline,"componentType","polyline");class CobwebPolyline extends Polyline{static createAttributesObject(){let rs=super.createAttributesObject();return rs.attractThreshold={createComponentOfType:"number",createStateVariable:"attractThreshold",defaultValue:.5,public:!0},rs.nPoints={createComponentOfType:"number",createStateVariable:"nPoints",defaultValue:1,public:!0,clamp:[0,1/0],forRenderer:!0},rs.variable={createComponentOfType:"variable",createStateVariable:"variable",defaultValue:Context.fromAst("x"),public:!0,forRenderer:!0},rs.nIterationsRequired={createComponentOfType:"number",createStateVariable:"nIterationsRequired",defaultValue:0,public:!0},rs.initialPoint={createComponentOfType:"point"},rs.function={createComponentOfType:"function"},rs.lockToSolution={createComponentOfType:"boolean",createStateVariable:"lockToSolution",defaultValue:!1},rs.defaultPoint={createComponentOfType:"point"},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.nDimensions.returnDependencies=()=>({}),rs.nDimensions.definition=()=>({setValue:{nDimensions:2}}),rs.initialPoint={isArray:!0,public:!0,shadowingInstructions:{createComponentOfType:"math",returnWrappingComponents(ns){return ns==="initialPointX"?[]:[["point",{componentType:"mathList",isAttribute:"xs"}]]}},entryPrefixes:["initialPointX"],defaultValueByArrayKey:()=>Context.fromAst(0),hasEssential:!0,returnArraySizeDependencies:()=>({}),returnArraySize:()=>[2],returnArrayDependenciesByKey({arrayKeys:ns}){let ss={};for(let os of ns){let ls=Number(os)+1;ss[os]={initialPointAttr:{dependencyType:"attributeComponent",attributeName:"initialPoint",variableNames:["x"+ls]}}}return{dependenciesByKey:ss}},arrayDefinitionByKey({dependencyValuesByKey:ns,arrayKeys:ss}){let os={},ls={};for(let cs of ss){let ds=Number(cs)+1;ns[cs].initialPointAttr?os[cs]=ns[cs].initialPointAttr.stateValues["x"+ds]:ls[cs]=!0}let us={};return Object.keys(os).length>0&&(us.setValue={initialPoint:os}),Object.keys(ls).length>0&&(us.useEssentialOrDefaultValue={initialPoint:ls}),us},inverseArrayDefinitionByKey({desiredStateVariableValues:ns,dependencyValuesByKey:ss,dependencyNamesByKey:os}){let ls=[];for(let us in ns.initialPoint)ss[us].initialPointAttr&&ss[us].initialPointAttr.stateValues["x"+(Number(us)+1)]?ls.push({setDependency:os[us].initialPointAttr,desiredValue:ns.initialPoint[us],variableIndex:0}):ls.push({setEssentialValue:"initialPoint",value:{[us]:ns.initialPoint[us]}});return{success:!0,instructions:ls}}},rs.f={additionalStateVariablesDefined:[{variableName:"fDefinition",forRenderer:!0}],returnDependencies:()=>({functionAttr:{dependencyType:"attributeComponent",attributeName:"function",variableNames:["numericalf","fDefinition"]}}),definition({dependencyValues:ns}){return ns.functionAttr?{setValue:{f:ns.functionAttr.stateValues.numericalf,fDefinition:ns.functionAttr.stateValues.fDefinition}}:{setValue:{f:null,fDefinition:null}}}},rs.nVertices={isAlias:!0,targetVariableName:"nPoints"},rs.nOriginalVertices={providePreviousValuesInDefinition:!0,returnDependencies:()=>({nVertices:{dependencyType:"stateVariable",variableName:"nVertices"}}),definition({dependencyValues:ns,previousValues:ss}){let os=ns.nVertices;return ss.nOriginalVertices>os&&(os=ss.nOriginalVertices),{setValue:{nOriginalVertices:os}}}},rs.originalVertices={isArray:!0,nDimensions:2,hasEssential:!0,entryPrefixes:["originalVertexX","originalVertex"],getArrayKeysFromVarName({arrayEntryPrefix:ns,varEnding:ss,arraySize:os}){if(ns==="originalVertexX"){let ls=ss.split("_").map(us=>Number(us)-1);return ls.length===2&&ls.every((us,cs)=>Number.isInteger(us)&&us>=0)?os?ls.every((us,cs)=>us=0?os?lsls+","+cs):[]:[ls+",0"]:[]}},arrayVarNameFromPropIndex(ns,ss){if(ss==="originalVertices")return ns.length===1?"originalVertex"+ns[0]:`originalVertexX${ns[0]}_${ns[1]}`;if(ss.slice(0,14)==="originalVertex"){let os=Number(ss.slice(14));if(Number.isInteger(os)&&os>0)return`originalVertexX${os}_${ns[0]}`}return null},returnArraySizeDependencies:()=>({nOriginalVertices:{dependencyType:"stateVariable",variableName:"nOriginalVertices"},nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),returnArraySize({dependencyValues:ns}){return[ns.nOriginalVertices-1,ns.nDimensions]},returnArrayDependenciesByKey:()=>({globalDependencies:{graphAncestor:{dependencyType:"ancestor",componentType:"graph",variableNames:["xmin","xmax","ymin","ymax"]},defaultPoint:{dependencyType:"attributeComponent",attributeName:"defaultPoint",variableNames:["xs"]}}}),arrayDefinitionByKey({globalDependencyValues:ns,arrayKeys:ss}){let os={};for(let ls of ss){let us=ls.split(",").map(Number);os[ls]={get defaultValue(){if(ns.defaultPoint){let cs=ns.defaultPoint.stateValues.xs;if(cs.length===2&&us[1]<2)return cs[us[1]]}if(ns.graphAncestor){if(us[1]===0){let cs=ns.graphAncestor.stateValues.xmin,ds=ns.graphAncestor.stateValues.xmax;return Context.fromAst((cs+ds)/2)}else if(us[1]===1){let cs=ns.graphAncestor.stateValues.ymin,ds=ns.graphAncestor.stateValues.ymax;return Context.fromAst((cs+ds)/2)}}return Context.fromAst(0)}}}return{useEssentialOrDefaultValue:{originalVertices:os}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ns}){let ss=[];for(let os in ns.originalVertices)ss.push({setEssentialValue:"originalVertices",value:{[os]:ns.originalVertices[os]}});return{success:!0,instructions:ss}}},rs.vertices.additionalStateVariablesDefined=[{variableName:"prelimCorrectVertices",entryPrefixes:["prelimCorrectVertexX","prelimCorrectVertex"],getArrayKeysFromVarName:function({arrayEntryPrefix:ns,varEnding:ss,arraySize:os}){if(ns==="prelimCorrectVertexX"){let ls=ss.split("_").map(us=>Number(us)-1);return ls.length===2&&ls.every((us,cs)=>Number.isInteger(us)&&us>=0)?os?ls.every((us,cs)=>us=0?os?lsls+","+cs):[]:[ls+",0"]:[]}}}],rs.vertices.basedOnArrayKeyStateVariables=!0,rs.vertices.returnArrayDependenciesByKey=function({arrayKeys:ns}){let ss={f:{dependencyType:"stateVariable",variableName:"f"},attractThreshold:{dependencyType:"stateVariable",variableName:"attractThreshold"},lockToSolution:{dependencyType:"stateVariable",variableName:"lockToSolution"}},os={};for(let ls of ns){let[us,cs]=ls.split(",");us==="0"?os[ls]={initialPoint:{dependencyType:"stateVariable",variableName:"initialPointX"+(Number(cs)+1)}}:os[ls]={originalVertexX1:{dependencyType:"stateVariable",variableName:"originalVertexX"+us+"_1"},originalVertexX2:{dependencyType:"stateVariable",variableName:"originalVertexX"+us+"_2"},previousVertexX1:{dependencyType:"stateVariable",variableName:"vertexX"+us+"_1"},previousVertexX2:{dependencyType:"stateVariable",variableName:"vertexX"+us+"_2"}}}return{globalDependencies:ss,dependenciesByKey:os}},rs.vertices.arrayDefinitionByKey=function({globalDependencyValues:ns,dependencyValuesByKey:ss,arrayKeys:os}){let ls={},us={};for(let cs of os){let[ds,ps]=cs.split(",");if(ds==="0")ls[cs]=ss[cs].initialPoint,us[cs]=null;else{let fs,hs;try{fs=[ss[cs].originalVertexX1.evaluate_to_constant(),ss[cs].originalVertexX2.evaluate_to_constant()],hs=[ss[cs].previousVertexX1.evaluate_to_constant(),ss[cs].previousVertexX2.evaluate_to_constant()]}catch{ls[ds+",0"]=Context.fromAst(0),ls[ds+",1"]=Context.fromAst(0),us[ds+",0"]=!1;continue}let gs;if(Number(ds)%2===1){let bs=ns.f(hs[0]);gs=[hs[0],bs]}else gs=[hs[1],hs[1]];Math.pow(fs[0]-gs[0],2)+Math.pow(fs[1]-gs[1],2)({nVertices:{dependencyType:"stateVariable",variableName:"nVertices"}}),returnArraySize({dependencyValues:ns}){return[ns.nVertices-1]},returnArrayDependenciesByKey({arrayKeys:ns}){let ss={};for(let os of ns)ss[os]={prelimCorrectVertex:{dependencyType:"stateVariable",variableName:"prelimCorrectVertexX"+(Number(os)+2)+"_1"}};return{dependenciesByKey:ss}},arrayDefinitionByKey({dependencyValuesByKey:ns,arrayKeys:ss}){let os={};for(let ls of ss)os[ls]=ns[ls].prelimCorrectVertex;return{setValue:{correctVertices:os}}}},rs.fractionCorrectVertices={public:!0,shadowingInstructions:{createComponentOfType:"number"},additionalStateVariablesDefined:[{variableName:"nGradedVertices",public:!0,shadowingInstructions:{createComponentOfType:"number"}},{variableName:"nCorrectVertices",public:!0,shadowingInstructions:{createComponentOfType:"number"}}],returnDependencies:()=>({correctVertices:{dependencyType:"stateVariable",variableName:"correctVertices"}}),definition({dependencyValues:ns}){let ss=ns.correctVertices.length,os,ls;return ss===0?(os=0,ls=0):(ls=ns.correctVertices.reduce((us,cs)=>us+cs,0),os=ls/ss),{setValue:{fractionCorrectVertices:os,nGradedVertices:ss,nCorrectVertices:ls}}}},rs.fractionCorrectVerticesAdjusted={public:!0,shadowingInstructions:{createComponentOfType:"number"},additionalStateVariablesDefined:[{variableName:"nGradedVerticesAdjusted",public:!0,shadowingInstructions:{createComponentOfType:"number"}}],returnDependencies:()=>({nCorrectVertices:{dependencyType:"stateVariable",variableName:"nCorrectVertices"},nGradedVertices:{dependencyType:"stateVariable",variableName:"nGradedVertices"},nIterationsRequired:{dependencyType:"stateVariable",variableName:"nIterationsRequired"}}),definition({dependencyValues:ns}){let ss=0;ns.nIterationsRequired>0&&(ss=2*ns.nIterationsRequired-1);let os=Math.max(ns.nGradedVertices,ss),ls;return os===0?ls=0:ls=ns.nCorrectVertices/os,{setValue:{fractionCorrectVerticesAdjusted:ls,nGradedVerticesAdjusted:os}}}},rs.nIterateValues={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({nVertices:{dependencyType:"stateVariable",variableName:"nVertices"}}),definition:({dependencyValues:ns})=>({setValue:{nIterateValues:Math.ceil((ns.nVertices+1)/2)}})},rs.iterateValues={isArray:!0,public:!0,shadowingInstructions:{createComponentOfType:"math"},entryPrefixes:["iterateValue"],returnArraySizeDependencies:()=>({nIterateValues:{dependencyType:"stateVariable",variableName:"nIterateValues"}}),returnArraySize({dependencyValues:ns}){return[ns.nIterateValues]},returnArrayDependenciesByKey({arrayKeys:ns}){let ss={};for(let os of ns)os==="0"?ss[os]={iterateValue:{dependencyType:"stateVariable",variableName:"vertexX1_1"}}:ss[os]={iterateValue:{dependencyType:"stateVariable",variableName:"vertexX"+2*Number(os)+"_2"}};return{dependenciesByKey:ss}},arrayDefinitionByKey({dependencyValuesByKey:ns,arrayKeys:ss}){let os={};for(let ls of ss)os[ls]=ns[ls].iterateValue;return{setValue:{iterateValues:os}}}},rs}}zs(CobwebPolyline,"componentType","cobwebPolyline"),zs(CobwebPolyline,"rendererType","cobwebPolyline");class Point extends GraphicalComponent{constructor(rs){super(rs),Object.assign(this.actions,{movePoint:this.movePoint.bind(this),switchPoint:this.switchPoint.bind(this),pointClicked:this.pointClicked.bind(this),mouseDownOnPoint:this.mouseDownOnPoint.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.draggable={createComponentOfType:"boolean",createStateVariable:"draggable",defaultValue:!0,public:!0,forRenderer:!0},rs.x={createComponentOfType:"math"},rs.y={createComponentOfType:"math"},rs.z={createComponentOfType:"math"},rs.xs={createComponentOfType:"mathList"},rs.coords={createComponentOfType:"coords"},rs.displayDigits={createComponentOfType:"integer"},rs.displayDecimals={createComponentOfType:"integer",createStateVariable:"displayDecimals",defaultValue:null,public:!0},rs.displaySmallAsZero={createComponentOfType:"number",createStateVariable:"displaySmallAsZero",valueForTrue:1e-14,valueForFalse:0,defaultValue:0,public:!0},rs.padZeros={createComponentOfType:"boolean",createStateVariable:"padZeros",defaultValue:!1,public:!0},rs.labelPosition={createComponentOfType:"text",createStateVariable:"labelPosition",defaultValue:"upperright",public:!0,forRenderer:!0,toLowerCase:!0,validValues:["upperright","upperleft","lowerright","lowerleft","top","bottom","left","right"]},rs.showCoordsWhenDragging={createComponentOfType:"boolean",createStateVariable:"showCoordsWhenDragging",defaultValue:!0,public:!0,forRenderer:!0},rs}static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=function({matchedChildren:ss,componentInfoObjects:os}){let us=returnBreakStringsSugarFunction({childrenToComponentFunction:gs=>({componentType:"math",children:gs}),mustStripOffOuterParentheses:!0}),cs=ss.map(gs=>typeof gs),ds=cs.indexOf("string"),ps=cs.lastIndexOf("string");if(ds===-1){let gs=os.componentIsSpecifiedType,ys=ss.filter(bs=>!(gs(bs,"point")||gs(bs,"vector")||gs(bs,"constraints")||gs(bs,"label")));if(ys.length===1){let bs=ys[0],vs=ss.indexOf(bs),xs=[...ss.slice(0,vs),...ss.slice(vs+1)];return{success:!0,newAttributes:{coords:{component:{componentType:"math",children:ys}}},newChildren:xs}}else return{success:!1}}let fs=[...ss.slice(0,ds),...ss.slice(ps+1)];ss=ss.slice(ds,ps+1);let hs=us({matchedChildren:ss});return!hs.success&&ss.length===1?{success:!0,newAttributes:{xs:{component:{componentType:"mathList",children:[{componentType:"math",children:ss}]}}},newChildren:fs}:hs.success?{success:!0,newAttributes:{xs:{component:{componentType:"mathList",children:hs.newChildren,skipSugar:!0}}},newChildren:fs}:{success:!1}};return rs.push({replacementFunction:ns}),rs}static returnChildGroups(){let rs=super.returnChildGroups();return rs.push({group:"points",componentTypes:["point"]},{group:"vectors",componentTypes:["vector"]},{group:"constraints",componentTypes:["constraints"]}),rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.styleDescription={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({selectedStyle:{dependencyType:"stateVariable",variableName:"selectedStyle"},document:{dependencyType:"ancestor",componentType:"document",variableNames:["theme"]}}),definition:function({dependencyValues:ns}){var os;let ss;return((os=ns.document)==null?void 0:os.stateValues.theme)==="dark"?ss=ns.selectedStyle.markerColorWordDarkMode:ss=ns.selectedStyle.markerColorWord,{setValue:{styleDescription:ss}}}},rs.styleDescriptionWithNoun={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({selectedStyle:{dependencyType:"stateVariable",variableName:"selectedStyle"},styleDescription:{dependencyType:"stateVariable",variableName:"styleDescription"}}),definition:function({dependencyValues:ns}){return{setValue:{styleDescriptionWithNoun:ns.styleDescription+" "+ns.selectedStyle.markerStyleWord}}}},rs.displayDigits={public:!0,shadowingInstructions:{createComponentOfType:"integer"},hasEssential:!0,defaultValue:10,returnDependencies:()=>({displayDigitsAttr:{dependencyType:"attributeComponent",attributeName:"displayDigits",variableNames:["value"]},displayDecimalsAttr:{dependencyType:"attributeComponent",attributeName:"displayDecimals",variableNames:["value"]}}),definition({dependencyValues:ns,usedDefault:ss}){if(ns.displayDigitsAttr!==null){let os=ns.displayDigitsAttr===null||ss.displayDigitsAttr,ls=ns.displayDecimalsAttr===null||ss.displayDecimalsAttr;if(!(os||ls)){let us=ns.displayDigitsAttr.shadowDepth;ns.displayDecimalsAttr.shadowDepth({}),definition:()=>({useEssentialOrDefaultValue:{coordsShadow:!0}}),inverseDefinition:async function({desiredStateVariableValues:ns,stateValues:ss,workspace:os}){return{success:!0,instructions:[{setEssentialValue:"coordsShadow",value:ns.coordsShadow}]}}},rs.nDimensions={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({coordsShadow:{dependencyType:"stateVariable",variableName:"coordsShadow"},coords:{dependencyType:"attributeComponent",attributeName:"coords",variableNames:["value"]},x:{dependencyType:"attributeComponent",attributeName:"x"},y:{dependencyType:"attributeComponent",attributeName:"y"},z:{dependencyType:"attributeComponent",attributeName:"z"},xs:{dependencyType:"attributeComponent",attributeName:"xs",variableNames:["nComponents"]},pointChild:{dependencyType:"child",childGroups:["points"],variableNames:["nDimensions"]},vectorChild:{dependencyType:"child",childGroups:["vectors"],variableNames:["nDimensions"]}}),definition:function({dependencyValues:ns}){let ss=!1,os,ls;if(ns.z!==null?ls=3:ns.y!==null?ls=2:ls=0,ns.coords!==null?(ss=!0,os=ns.coords.stateValues.value):ns.coordsShadow&&(ss=!0,os=ns.coordsShadow),ss){let us=os.tree;return Array.isArray(us)&&vectorOperators.includes(us[0])?ls=Math.max(us.length-1,ls):ls=Math.max(1,ls),{setValue:{nDimensions:ls},checkForActualChange:{nDimensions:!0}}}else return ns.xs!==null?{setValue:{nDimensions:Math.max(ns.xs.stateValues.nComponents,ls)}}:ns.pointChild.length>0?{setValue:{nDimensions:Math.max(ns.pointChild[0].stateValues.nDimensions,ls)}}:ns.vectorChild.length>0?{setValue:{nDimensions:Math.max(ns.vectorChild[0].stateValues.nDimensions,ls)}}:(ls===0&&(ls=2),{setValue:{nDimensions:ls},checkForActualChange:{nDimensions:!0}})}},rs.arrayVariableForConstraints={returnDependencies:()=>({}),definition:()=>({setValue:{arrayVariableForConstraints:"unconstrainedXs"}})},rs.arrayEntryPrefixForConstraints={returnDependencies:()=>({}),definition:()=>({setValue:{arrayEntryPrefixForConstraints:"unconstrainedX"}})},rs.nDimensionsForConstraints={isAlias:!0,targetVariableName:"nDimensions"},rs.unconstrainedXs={isArray:!0,entryPrefixes:["unconstrainedX"],defaultValueByArrayKey:()=>Context.fromAst(0),hasEssential:!0,returnArraySizeDependencies:()=>({nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),returnArraySize({dependencyValues:ns}){return[ns.nDimensions]},returnArrayDependenciesByKey({arrayKeys:ns}){let ss={coordsShadow:{dependencyType:"stateVariable",variableName:"coordsShadow"},coords:{dependencyType:"attributeComponent",attributeName:"coords",variableNames:["value"]}},os={};for(let ls of ns){let us=Number(ls)+1;os[ls]={xs:{dependencyType:"attributeComponent",attributeName:"xs",variableNames:["math"+us]},pointChild:{dependencyType:"child",childGroups:["points"],variableNames:["x"+us]},vectorChild:{dependencyType:"child",childGroups:["vectors"],variableNames:["x"+us]}},ls==="0"?os[ls].component={dependencyType:"attributeComponent",attributeName:"x",variableNames:["value"]}:ls==="1"?os[ls].component={dependencyType:"attributeComponent",attributeName:"y",variableNames:["value"]}:ls==="2"&&(os[ls].component={dependencyType:"attributeComponent",attributeName:"z",variableNames:["value"]})}return{globalDependencies:ss,dependenciesByKey:os}},arrayDefinitionByKey({globalDependencyValues:ns,dependencyValuesByKey:ss,arrayKeys:os}){let ls={},us={},cs=!1,ds;if(ns.coords!==null?(cs=!0,ds=ns.coords.stateValues.value):ns.coordsShadow&&(cs=!0,ds=ns.coordsShadow),cs){let fs=ds.tree;if(Array.isArray(fs)&&vectorOperators.includes(fs[0]))for(let hs of os){let gs=Number(hs);(gs>=0||gs0)ls[fs]=ys[0].stateValues["x"+hs];else{let bs=ss[fs].vectorChild;bs.length>0&&(ls[fs]=bs[0].stateValues["x"+hs])}}}for(let fs of os){let hs=ss[fs].component;hs?ls[fs]=hs.stateValues.value.simplify():ls[fs]===void 0&&(us[fs]=!0)}let ps={};return Object.keys(ls).length>0&&(ps.setValue={unconstrainedXs:ls}),Object.keys(us).length>0&&(ps.useEssentialOrDefaultValue={unconstrainedXs:us}),ps},inverseArrayDefinitionByKey({desiredStateVariableValues:ns,globalDependencyValues:ss,dependencyValuesByKey:os,dependencyNamesByKey:ls,arraySize:us}){let cs=[],ds=!1,ps,fs,hs=!1;ss.coords!==null?(ds=!0,ps="coords",fs=Array(us[0]+1)):ss.coordsShadow!==null&&(ds=!0,ps="coordsShadow",fs=Array(us[0]+1));for(let gs of Object.keys(ns.unconstrainedXs).reverse()){let ys=convertValueToMathExpression(ns.unconstrainedXs[gs]);os[gs].component!==null?cs.push({setDependency:ls[gs].component,desiredValue:ys,childIndex:0,variableIndex:0}):ds?(fs[Number(gs)+1]=ys.tree,hs=!0):os[gs].xs!==null?cs.push({setDependency:ls[gs].xs,desiredValue:ys,childIndex:0,variableIndex:0}):os[gs].pointChild.length>0?cs.push({setDependency:ls[gs].pointChild,desiredValue:ys,childIndex:0,variableIndex:0}):os[gs].vectorChild.length>0?cs.push({setDependency:ls[gs].vectorChild,desiredValue:ys,childIndex:0,variableIndex:0}):cs.push({setEssentialValue:"unconstrainedXs",value:{[gs]:ys}})}if(hs){let gs;us[0]===1?gs=Context.fromAst(fs[1]):(fs[0]="vector",gs=Context.fromAst(fs));let ys={setDependency:ps,desiredValue:gs};ps==="coords"&&(ys.childIndex=0,ys.variableIndex=0),cs.push(ys)}return{success:!0,instructions:cs}}},rs.xs={public:!0,shadowingInstructions:{createComponentOfType:"math",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"]},isArray:!0,entryPrefixes:["x"],returnArraySizeDependencies:()=>({nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),returnArraySize({dependencyValues:ns}){return[ns.nDimensions]},returnArrayDependenciesByKey({arrayKeys:ns}){let ss={};for(let os of ns){let ls=Number(os)+1,us={};us.unconstrainedX={dependencyType:"stateVariable",variableName:`unconstrainedX${ls}`},us.constraintsChild={dependencyType:"child",childGroups:["constraints"],variableNames:[`constraintResult${ls}`]},ss[os]=us}return{dependenciesByKey:ss}},arrayDefinitionByKey({dependencyValuesByKey:ns,arrayKeys:ss}){let os={};for(let ls of ss)if(ns[ls].constraintsChild.length>0){let us=Number(ls)+1;os[ls]=convertValueToMathExpression(ns[ls].constraintsChild[0].stateValues["constraintResult"+us])}else os[ls]=convertValueToMathExpression(ns[ls].unconstrainedX);return ss.length>0?{setValue:{xs:os}}:{}},async inverseArrayDefinitionByKey({desiredStateVariableValues:ns,dependencyValuesByKey:ss,dependencyNamesByKey:os,initialChange:ls,stateValues:us}){if(ls&&!await us.draggable)return{success:!1};let cs=[];for(let ds of Object.keys(ns.xs).reverse())ss[ds]&&(ss[ds].constraintsChild.length>0?cs.push({setDependency:os[ds].constraintsChild,desiredValue:ns.xs[ds],childIndex:0,variableIndex:0}):cs.push({setDependency:os[ds].unconstrainedX,desiredValue:ns.xs[ds]}));return{success:!0,instructions:cs}}},rs.x={isAlias:!0,targetVariableName:"x1"},rs.y={isAlias:!0,targetVariableName:"x2"},rs.z={isAlias:!0,targetVariableName:"x3"},rs.coords={public:!0,shadowingInstructions:{createComponentOfType:"coords",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"]},returnDependencies:()=>({xs:{dependencyType:"stateVariable",variableName:"xs"}}),definition:function({dependencyValues:ns}){let ss=[];for(let os of ns.xs)os?ss.push(os.tree):ss.push("_");return ss.length>1?ss=["vector",...ss]:ss.length===1?ss=ss[0]:ss="_",{setValue:{coords:Context.fromAst(ss)}}},inverseDefinition:async function({desiredStateVariableValues:ns,stateValues:ss,initialChange:os}){if(os&&!await ss.draggable)return{success:!1};let ls=[],us={},cs=ns.coords.tree;if(!(Array.isArray(cs)&&vectorOperators.includes(cs[0])))us[0]=ns.coords;else for(let ds=0;ds({coords:{dependencyType:"stateVariable",variableName:"coords"},displayDigits:{dependencyType:"stateVariable",variableName:"displayDigits"},displayDecimals:{dependencyType:"stateVariable",variableName:"displayDecimals"},displaySmallAsZero:{dependencyType:"stateVariable",variableName:"displaySmallAsZero"},padZeros:{dependencyType:"stateVariable",variableName:"padZeros"}}),definition:function({dependencyValues:ns,usedDefault:ss}){let os={};return ns.padZeros&&(ss.displayDigits&&!ss.displayDecimals?Number.isFinite(ns.displayDecimals)&&(os.padToDecimals=ns.displayDecimals):ns.displayDigits>=1&&(os.padToDigits=ns.displayDigits)),{setValue:{latex:roundForDisplay({value:ns.coords,dependencyValues:ns,usedDefault:ss}).toLatex(os)}}}},rs.value={isAlias:!0,targetVariableName:"coords"},rs.constraintUsed={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},returnDependencies:()=>({constraintsChild:{dependencyType:"child",childGroups:["constraints"],variableNames:["constraintUsed"]}}),definition:function({dependencyValues:ns}){return ns.constraintsChild.length===0?{setValue:{constraintUsed:!1}}:{setValue:{constraintUsed:ns.constraintsChild[0].stateValues.constraintUsed}}}},rs.numericalXs={isArray:!0,entryPrefixes:["numericalX"],forRenderer:!0,returnArraySizeDependencies:()=>({nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),returnArraySize({dependencyValues:ns}){return[ns.nDimensions]},returnArrayDependenciesByKey({arrayKeys:ns}){let ss={};for(let os of ns){let ls=Number(os)+1;ss[os]={x:{dependencyType:"stateVariable",variableName:`x${ls}`}}}return{dependenciesByKey:ss}},arrayDefinitionByKey({dependencyValuesByKey:ns,arrayKeys:ss}){let os={};for(let ls of ss){let us=ns[ls].x;us?(us=ns[ls].x.evaluate_to_constant(),os[ls]=us):os[ls]=NaN}return{setValue:{numericalXs:os}}},async inverseArrayDefinitionByKey({desiredStateVariableValues:ns,dependencyNamesByKey:ss,initialChange:os,stateValues:ls}){if(os&&!await ls.draggable)return{success:!1};let us=[];for(let cs in ns.numericalXs)dependencyValuesByKey[cs]&&us.push({setDependency:ss[cs].xs,desiredValue:ns.numericalXs[cs]});return{success:!0,instructions:us}}},rs.nearestPoint={returnDependencies:()=>({nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"},numericalXs:{dependencyType:"stateVariable",variableName:"numericalXs"}}),definition:({dependencyValues:ns})=>({setValue:{nearestPoint:function(){let ss={};for(let os=1;os<=ns.nDimensions;os++){let ls=ns.numericalXs[os-1];if(!Number.isFinite(ls))return{};ss["x"+os]=ls}return ss}}})},rs}async movePoint({x:rs,y:ns,z:ss,transient:os,actionId:ls,sourceInformation:us={},skipRendererUpdate:cs=!1}){let ds={};return rs!==void 0&&(ds[0]=Context.fromAst(rs)),ns!==void 0&&(ds[1]=Context.fromAst(ns)),ss!==void 0&&(ds[2]=Context.fromAst(ss)),os?await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"xs",value:ds}],transient:os,actionId:ls,sourceInformation:us,skipRendererUpdate:cs}):await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"xs",value:ds}],actionId:ls,sourceInformation:us,skipRendererUpdate:cs,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{x:rs,y:ns,z:ss}}})}switchPoint(){}async pointClicked({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){await this.coreFunctions.triggerChainedActions({triggeringAction:"click",componentName:this.componentName,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss}),this.coreFunctions.resolveAction({actionId:rs})}async mouseDownOnPoint({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){await this.coreFunctions.triggerChainedActions({triggeringAction:"down",componentName:this.componentName,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss}),this.coreFunctions.resolveAction({actionId:rs})}}zs(Point,"componentType","point"),zs(Point,"primaryStateVariableForDefinition","coordsShadow"),zs(Point,"stateVariableForAttributeValue","coords"),zs(Point,"adapters",[{stateVariable:"coords",stateVariablesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"]}]);class EquilibriumPoint extends Point{static createAttributesObject(){let rs=super.createAttributesObject();return rs.stable={createComponentOfType:"boolean",createStateVariable:"stable",defaultValue:!0,public:!0},rs.switchable={createComponentOfType:"boolean",createStateVariable:"switchable",defaultValue:!1,public:!0,forRenderer:!0},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.open={forRenderer:!0,returnDependencies:()=>({stable:{dependencyType:"stateVariable",variableName:"stable"}}),definition({dependencyValues:ns}){return{setValue:{open:!ns.stable}}},inverseDefinition({desiredStateVariableValues:ns}){return{success:!0,instructions:[{setDependency:"stable",desiredValue:!ns.open}]}}},rs}async switchPoint({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){if(await this.stateValues.switchable)return await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"stable",value:!this.stateValues.stable}],actionId:rs,sourceInformation:ns,skipRendererUpdate:ss,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{stable:!this.stateValues.stable}}});this.coreFunctions.resolveAction({actionId:rs})}}zs(EquilibriumPoint,"componentType","equilibriumPoint"),zs(EquilibriumPoint,"rendererType","point");class Line extends GraphicalComponent{constructor(rs){super(rs),Object.assign(this.actions,{moveLine:this.moveLine.bind(this),switchLine:this.switchLine.bind(this),lineClicked:this.lineClicked.bind(this),mouseDownOnLine:this.mouseDownOnLine.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.draggable={createComponentOfType:"boolean",createStateVariable:"draggable",defaultValue:!0,public:!0,forRenderer:!0},rs.equation={createComponentOfType:"math"},rs.through={createComponentOfType:"_pointListComponent"},rs.slope={createComponentOfType:"number"},rs.variables={createComponentOfType:"variables"},rs.displayDigits={createComponentOfType:"integer"},rs.displayDecimals={createComponentOfType:"integer",createStateVariable:"displayDecimals",defaultValue:null,public:!0},rs.displaySmallAsZero={createComponentOfType:"number",createStateVariable:"displaySmallAsZero",valueForTrue:1e-14,valueForFalse:0,defaultValue:0,public:!0},rs.padZeros={createComponentOfType:"boolean",createStateVariable:"padZeros",defaultValue:!1,public:!0},rs.labelPosition={createComponentOfType:"text",createStateVariable:"labelPosition",defaultValue:"upperright",public:!0,forRenderer:!0,toLowerCase:!0,validValues:["upperright","upperleft","lowerright","lowerleft"]},rs}static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=function({matchedChildren:ss,componentInfoObjects:os}){if(ss.length===0)return{success:!1};let ls=ps=>os.componentIsSpecifiedType(ps,"label"),us=ss.map(ls),cs=[],ds=[];if(us.filter(ps=>ps).length===0)cs=ss;else{if(us[0]){let fs=us.indexOf(!1);fs!==-1&&(ds.push(...ss.slice(0,fs)),ss=ss.slice(fs),us=us.slice(fs))}let ps=us.indexOf(!0);ps===-1?cs=ss:(cs=ss.slice(0,ps),ds.push(...ss.slice(ps)))}return cs.length===0?{success:!1}:{success:!0,newAttributes:{equation:{component:{componentType:"math",children:cs}}},newChildren:ds}};return rs.push({replacementFunction:ns}),rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.styleDescription={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({selectedStyle:{dependencyType:"stateVariable",variableName:"selectedStyle"},document:{dependencyType:"ancestor",componentType:"document",variableNames:["theme"]}}),definition:function({dependencyValues:ns}){var ls;let ss;((ls=ns.document)==null?void 0:ls.stateValues.theme)==="dark"?ss=ns.selectedStyle.lineColorWordDarkMode:ss=ns.selectedStyle.lineColorWord;let os=ns.selectedStyle.lineWidthWord;return ns.selectedStyle.lineStyleWord&&(os&&(os+=" "),os+=ns.selectedStyle.lineStyleWord),os&&(os+=" "),os+=ss,{setValue:{styleDescription:os}}}},rs.styleDescriptionWithNoun={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({styleDescription:{dependencyType:"stateVariable",variableName:"styleDescription"}}),definition:function({dependencyValues:ns}){return{setValue:{styleDescriptionWithNoun:ns.styleDescription+" line"}}}},rs.displayDigits={public:!0,shadowingInstructions:{createComponentOfType:"integer"},hasEssential:!0,defaultValue:10,returnDependencies:()=>({displayDigitsAttr:{dependencyType:"attributeComponent",attributeName:"displayDigits",variableNames:["value"]},displayDecimalsAttr:{dependencyType:"attributeComponent",attributeName:"displayDecimals",variableNames:["value"]}}),definition({dependencyValues:ns,usedDefault:ss}){let os=ns.displayDigitsAttr===null||ss.displayDigitsAttr,ls=ns.displayDecimalsAttr===null||ss.displayDecimalsAttr;if(!(os||ls)){let us=ns.displayDigitsAttr.shadowDepth;ns.displayDecimalsAttr.shadowDepth({throughAttr:{dependencyType:"attributeComponent",attributeName:"through",variableNames:["nPoints"]}}),definition:function({dependencyValues:ns}){return ns.throughAttr===null?{setValue:{nPointsPrescribed:0}}:{setValue:{nPointsPrescribed:ns.throughAttr.stateValues.nPoints}}}},rs.basedOnSlope={returnDependencies:()=>({slopeAttr:{dependencyType:"attributeComponent",attributeName:"slope"},nPointsPrescribed:{dependencyType:"stateVariable",variableName:"nPointsPrescribed"},nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),definition({dependencyValues:ns}){return{setValue:{basedOnSlope:ns.nPointsPrescribed<2&&ns.slopeAttr!==null&&ns.nDimensions===2}}}},rs.dForSlope={defaultValue:1,hasEssential:!0,returnDependencies:()=>({}),definition:()=>({useEssentialOrDefaultValue:{dForSlope:!0}}),inverseDefinition({desiredStateVariableValues:ns}){return{success:!0,instructions:[{setEssentialValue:"dForSlope",value:ns.dForSlope}]}}},rs.variables={isArray:!0,public:!0,shadowingInstructions:{createComponentOfType:"variable"},entryPrefixes:["var"],returnArraySizeDependencies:()=>({nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),returnArraySize({dependencyValues:ns}){return[ns.nDimensions]},returnArrayDependenciesByKey(){return{globalDependencies:{variables:{dependencyType:"attributeComponent",attributeName:"variables",variableNames:["variables"]}}}},arrayDefinitionByKey({globalDependencyValues:ns,arraySize:ss}){let os=[];return ns.variables!==null&&(os=ns.variables.stateValues.variables),{setValue:{variables:returnNVariables(ss[0],os)}}}},rs.equationIdentity={returnDependencies:()=>({equation:{dependencyType:"attributeComponent",attributeName:"equation"}}),definition:function({dependencyValues:ns}){return ns.equation!==null?{setValue:{equationIdentity:ns.equation}}:{setValue:{equationIdentity:null}}}},rs.essentialPoints={isArray:!0,nDimensions:"2",hasEssential:!0,entryPrefixes:["essentialPointX","essentialPoint"],set:convertValueToMathExpression,defaultValueByArrayKey:ns=>Context.fromAst(ns==="0,0"?1:0),getArrayKeysFromVarName({arrayEntryPrefix:ns,varEnding:ss,arraySize:os}){if(ns==="essentialPointX"){let ls=ss.split("_").map(us=>Number(us)-1);return ls.length===2&&ls.every((us,cs)=>Number.isInteger(us)&&us>=0)?os?ls.every((us,cs)=>us=0?os?lsls+","+cs):[]:[ls+",0"]:[]}},returnArraySizeDependencies:()=>({nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),returnArraySize({dependencyValues:ns}){return[2,ns.nDimensions]},returnArrayDependenciesByKey:()=>({}),arrayDefinitionByKey({arrayKeys:ns}){let ss={};for(let os of ns)ss[os]=!0;return{useEssentialOrDefaultValue:{essentialPoints:ss}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ns}){let ss=[];for(let os in ns.essentialPoints)ss.push({setEssentialValue:"essentialPoints",value:{[os]:convertValueToMathExpression(ns.essentialPoints[os])}});return{success:!0,instructions:ss}}},rs.points={public:!0,shadowingInstructions:{createComponentOfType:"math",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"],returnWrappingComponents(ns){return ns==="pointX"?[]:[["point",{componentType:"mathList",isAttribute:"xs"}]]}},isArray:!0,nDimensions:2,entryPrefixes:["pointX","point"],getArrayKeysFromVarName({arrayEntryPrefix:ns,varEnding:ss,arraySize:os}){if(ns==="pointX"){let ls=ss.split("_").map(us=>Number(us)-1);return ls.length===2&&ls.every((us,cs)=>Number.isInteger(us)&&us>=0)?os?ls.every((us,cs)=>us=0?os?lsls+","+cs):[]:[ls+",0"]:[]}},arrayVarNameFromPropIndex(ns,ss){if(ss==="points")return ns.length===1?"point"+ns[0]:`pointX${ns[0]}_${ns[1]}`;if(ss.slice(0,5)==="point"){let os=Number(ss.slice(5));if(Number.isInteger(os)&&os>0)return`pointX${os}_${ns[0]}`}return null},stateVariablesDeterminingDependencies:["equationIdentity","nPointsPrescribed","basedOnSlope"],returnArraySizeDependencies:()=>({nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),returnArraySize({dependencyValues:ns}){return[2,ns.nDimensions]},returnArrayDependenciesByKey({stateValues:ns,arrayKeys:ss}){if(ns.equationIdentity===null){let os={};for(let us of ss){let[cs,ds]=us.split(","),ps=Number(cs)+1+"_"+(Number(ds)+1);os[us]={through:{dependencyType:"attributeComponent",attributeName:"through",variableNames:["pointX"+ps]}},ns.basedOnSlope?(cs==="1"&&(ns.nPointsPrescribed===1&&os[us].through.variableNames.push("pointX1_"+(Number(ds)+1)),os[us].dForSlope={dependencyType:"stateVariable",variableName:"dForSlope"},os[us].slopeAttr={dependencyType:"attributeComponent",attributeName:"slope",variableNames:["value"]}),ns.nPointsPrescribed===0&&(os[us].essentialPoint={dependencyType:"stateVariable",variableName:"essentialPointX2_"+(Number(ds)+1)})):os[us].essentialPoint={dependencyType:"stateVariable",variableName:"essentialPointX"+ps}}return{dependenciesByKey:os,globalDependencies:{nPointsPrescribed:{dependencyType:"stateVariable",variableName:"nPointsPrescribed"},nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"},basedOnSlope:{dependencyType:"stateVariable",variableName:"basedOnSlope"}}}}else return{globalDependencies:{coeff0:{dependencyType:"stateVariable",variableName:"coeff0"},coeffvar1:{dependencyType:"stateVariable",variableName:"coeffvar1"},coeffvar2:{dependencyType:"stateVariable",variableName:"coeffvar2"},variables:{dependencyType:"stateVariable",variableName:"variables"},lastPointsFromInverting:{dependencyType:"stateVariable",variableName:"lastPointsFromInverting"}}}},arrayDefinitionByKey({globalDependencyValues:ns,dependencyValuesByKey:ss,arrayKeys:os,arraySize:ls,componentName:us}){if("coeff0"in ns){let cs=calculatePointsFromCoeffs(ns);if(cs.success)return{setValue:{points:cs.points}};{let ds={};for(let ps=0;psvs.toString())];for(let vs=0;vs({nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),returnArraySize({dependencyValues:ns}){return Number.isNaN(ns.nDimensions)?[0]:[2]},returnArrayDependenciesByKey({arrayKeys:ns}){let ss={nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}},os={};for(let ls of ns)os[ls]={point:{dependencyType:"stateVariable",variableName:"point"+(Number(ls)+1)}};return{globalDependencies:ss,dependenciesByKey:os}},arrayDefinitionByKey({globalDependencyValues:ns,dependencyValuesByKey:ss,arrayKeys:os,componentName:ls}){if(Number.isNaN(ns.nDimensions))return{};let us={};for(let cs of os){let ds=ss[cs].point;Array.isArray(ds)||(ds=[ds]);let ps=[];for(let fs=0;fs({coeff0:{dependencyType:"stateVariable",variableName:"coeff0"},coeffvar1:{dependencyType:"stateVariable",variableName:"coeffvar1"},coeffvar2:{dependencyType:"stateVariable",variableName:"coeffvar2"}}),definition:function({dependencyValues:ns}){let ss=ns.coeff0.evaluate_to_constant(),os=ns.coeffvar1.evaluate_to_constant(),ls=ns.coeffvar2.evaluate_to_constant();return{setValue:{numericalCoeff0:ss,numericalCoeffvar1:os,numericalCoeffvar2:ls}}}},rs.slope={public:!0,shadowingInstructions:{createComponentOfType:"math",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"]},returnDependencies:()=>({coeffvar1:{dependencyType:"stateVariable",variableName:"coeffvar1"},coeffvar2:{dependencyType:"stateVariable",variableName:"coeffvar2"}}),definition:function({dependencyValues:ns}){return{setValue:{slope:Context.fromAst(["-",["/","a","b"]]).substitute({a:ns.coeffvar1,b:ns.coeffvar2}).simplify()}}}},rs.xintercept={public:!0,shadowingInstructions:{createComponentOfType:"math",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"]},returnDependencies:()=>({coeff0:{dependencyType:"stateVariable",variableName:"coeff0"},coeffvar1:{dependencyType:"stateVariable",variableName:"coeffvar1"}}),definition:({dependencyValues:ns})=>({setValue:{xintercept:Context.fromAst(["-",["/","a","b"]]).substitute({a:ns.coeff0,b:ns.coeffvar1}).simplify()}})},rs.yintercept={public:!0,shadowingInstructions:{createComponentOfType:"math",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"]},returnDependencies:()=>({coeff0:{dependencyType:"stateVariable",variableName:"coeff0"},coeffvar2:{dependencyType:"stateVariable",variableName:"coeffvar2"}}),definition:({dependencyValues:ns})=>({setValue:{yintercept:Context.fromAst(["-",["/","a","b"]]).substitute({a:ns.coeff0,b:ns.coeffvar2}).simplify()}})},rs.lastPointsFromInverting={defaultValue:null,hasEssential:!0,returnDependencies:()=>({}),definition:()=>({useEssentialOrDefaultValue:{lastPointsFromInverting:!0}}),inverseDefinition:({desiredStateVariableValues:ns})=>({success:!0,instructions:[{setEssentialValue:"lastPointsFromInverting",value:ns.lastPointsFromInverting}]})},rs.latex={forRenderer:!0,public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({equation:{dependencyType:"stateVariable",variableName:"equation"},displayDigits:{dependencyType:"stateVariable",variableName:"displayDigits"},displayDecimals:{dependencyType:"stateVariable",variableName:"displayDecimals"},displaySmallAsZero:{dependencyType:"stateVariable",variableName:"displaySmallAsZero"},padZeros:{dependencyType:"stateVariable",variableName:"padZeros"}}),definition:function({dependencyValues:ns,usedDefault:ss}){let os={};return ns.padZeros&&(ss.displayDigits&&!ss.displayDecimals?Number.isFinite(ns.displayDecimals)&&(os.padToDecimals=ns.displayDecimals):ns.displayDigits>=1&&(os.padToDigits=ns.displayDigits)),{setValue:{latex:roundForDisplay({value:ns.equation,dependencyValues:ns,usedDefault:ss}).toLatex(os)}}}},rs.nearestPoint={returnDependencies:()=>({nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"},numericalCoeff0:{dependencyType:"stateVariable",variableName:"numericalCoeff0"},numericalCoeffvar1:{dependencyType:"stateVariable",variableName:"numericalCoeffvar1"},numericalCoeffvar2:{dependencyType:"stateVariable",variableName:"numericalCoeffvar2"}}),definition({dependencyValues:ns}){let ss=ns.numericalCoeffvar1,os=ns.numericalCoeffvar2,ls=ns.numericalCoeff0,us=Number.isFinite(ss)&&Number.isFinite(os)&&Number.isFinite(ls),cs=ns.nDimensions!==2||!us||ss===0&&os===0;return{setValue:{nearestPoint:function({variables:ds,scales:ps=[1,1]}){var Ns,As;if(cs)return{};let fs=ps[0],hs=ps[1],gs=ss*fs,ys=os*hs,bs=gs*gs+ys*ys,vs=(Ns=ds.x1)==null?void 0:Ns.evaluate_to_constant(),xs=(As=ds.x2)==null?void 0:As.evaluate_to_constant();if(!(Number.isFinite(vs)&&Number.isFinite(xs)))return{};let Cs=vs/fs,Ts=xs/hs,Ss={};return Ss.x1=(ys*(ys*Cs-gs*Ts)-gs*ls)*fs/bs,Ss.x2=(gs*(-ys*Cs+gs*Ts)-ys*ls)*hs/bs,ds.x3!==void 0&&(Ss.x3=0),Ss}}}}},rs}async moveLine({point1coords:rs,point2coords:ns,transient:ss,actionId:os,sourceInformation:ls={},skipRendererUpdate:us=!1}){let cs={"0,0":Context.fromAst(rs[0]),"0,1":Context.fromAst(rs[1])};return await this.stateValues.basedOnSlope||(cs["1,0"]=Context.fromAst(ns[0]),cs["1,1"]=Context.fromAst(ns[1])),ss?await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"points",value:cs}],transient:!0,actionId:os,sourceInformation:ls,skipRendererUpdate:us}):await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"points",value:cs}],actionId:os,sourceInformation:ls,skipRendererUpdate:us,event:{verb:"interacted",object:{componentId:this.componentName},result:{point1:rs,point2:ns}}})}switchLine(){}async lineClicked({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){await this.coreFunctions.triggerChainedActions({triggeringAction:"click",componentName:this.componentName,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss}),this.coreFunctions.resolveAction({actionId:rs})}async mouseDownOnLine({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){await this.coreFunctions.triggerChainedActions({triggeringAction:"down",componentName:this.componentName,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss}),this.coreFunctions.resolveAction({actionId:rs})}}zs(Line,"componentType","line"),zs(Line,"adapters",[{stateVariable:"equation",stateVariablesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"]}]);function calculateCoeffsFromEquation({equation:as,variables:rs}){let ns=rs[0],ss=rs[1],os=ns.toString(),ls=ss.toString();if(as=as.expand().simplify(),!(Array.isArray(as.tree)&&as.tree[0]==="="&&as.tree.length===3))return{success:!1};let us=Context.fromAst(["+",as.tree[2],["-",as.tree[1]]]).expand().simplify(),cs=[];Array.isArray(us.tree)&&us.tree[0]==="+"?cs=us.tree.slice(1):cs=[us.tree];let ds=Context.fromAst(0),ps=Context.fromAst(0),fs=Context.fromAst(0);for(let gs of cs){let ys=hs(gs);if(!ys.success)return{success:!1};ds=ds.add(ys.coeffvar1),ps=ps.add(ys.coeffvar2),fs=fs.add(ys.coeff0)}return ds=ds.simplify(),ps=ps.simplify(),fs=fs.simplify(),{success:!0,coeff0:fs,coeffvar1:ds,coeffvar2:ps};function hs(gs){let ys=0,bs=0,vs=0;if(typeof gs=="string")gs===os?ys=1:gs===ls?bs=1:vs=gs;else if(typeof gs=="number")vs=gs;else if(Array.isArray(gs)){let xs=gs[0],Cs=gs.slice(1);if(xs==="-"){let Ts=hs(Cs[0]);if(!Ts.success)return{success:!1};ys=["-",Ts.coeffvar1.tree],bs=["-",Ts.coeffvar2.tree],vs=["-",Ts.coeff0.tree]}else{if(xs==="+")return console.warn("Invalid format for equation of line in variables "+ns+" and "+ss),{success:!1};if(xs==="*"){let Ts=-1,Ss=-1;for(let Ns=0;Ns({stable:{dependencyType:"stateVariable",variableName:"stable"}}),definition({dependencyValues:ns}){return{setValue:{dashed:!ns.stable}}},inverseDefinition({desiredStateVariableValues:ns}){return{success:!0,instructions:[{setDependency:"stable",desiredValue:!ns.dashed}]}}},rs}async switchLine({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){if(await this.stateValues.switchable)return await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"stable",value:!this.stateValues.stable}],actionId:rs,sourceInformation:ns,skipRendererUpdate:ss,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{stable:!this.stateValues.stable}}});this.coreFunctions.resolveAction({actionId:rs})}}zs(EquilibriumLine,"componentType","equilibriumLine"),zs(EquilibriumLine,"rendererType","line");class Curve extends GraphicalComponent{constructor(rs){super(rs),Object.assign(this.actions,{moveControlVector:this.moveControlVector.bind(this),moveThroughPoint:this.moveThroughPoint.bind(this),changeVectorControlDirection:this.changeVectorControlDirection.bind(this),switchCurve:this.switchCurve.bind(this),curveClicked:this.curveClicked.bind(this),mouseDownOnCurve:this.mouseDownOnCurve.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.draggable={createComponentOfType:"boolean",createStateVariable:"draggable",defaultValue:!0,public:!0,forRenderer:!0},rs.labelPosition={createComponentOfType:"text",createStateVariable:"labelPosition",defaultValue:"upperright",public:!0,forRenderer:!0,toLowerCase:!0,validValues:["upperright","upperleft","lowerright","lowerleft","top","bottom","left","right"]},rs.flipFunction={createComponentOfType:"boolean",createStateVariable:"flipFunction",defaultValue:!1,public:!0,forRenderer:!0},rs.nDiscretizationPoints={createComponentOfType:"number",createStateVariable:"nDiscretizationPoints",defaultValue:1e3,public:!0},rs.periodic={createComponentOfType:"boolean",createStateVariable:"periodic",defaultValue:!1,public:!0},rs.splineTension={createComponentOfType:"number",createStateVariable:"splineTension",defaultValue:.8,clamp:[0,1],public:!0},rs.extrapolateBackward={createComponentOfType:"boolean",createStateVariable:"extrapolateBackward",defaultValue:!1,public:!0,forRenderer:!0},rs.extrapolateForward={createComponentOfType:"boolean",createStateVariable:"extrapolateForward",defaultValue:!1,public:!0,forRenderer:!0},rs.splineForm={createComponentOfType:"text",createStateVariable:"splineForm",defaultValue:"centripetal",public:!0,toLowerCase:!0,validValues:["centripetal","uniform"]},rs.variable={createComponentOfType:"variable",createStateVariable:"variableForChild",defaultValue:Context.fromAst("x")},rs.through={createComponentOfType:"_pointListComponent"},rs.parMin={createComponentOfType:"math"},rs.parMax={createComponentOfType:"math"},rs.nearestPointAsCurve={createComponentOfType:"boolean",createStateVariable:"nearestPointAsCurvePrelim",defaultValue:!1},rs}static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=function({matchedChildren:ss,componentInfoObjects:os}){let ls=bs=>os.componentIsSpecifiedType(bs,"label");if(ss.length===0||!ss.every(bs=>{var vs;return typeof bs=="string"||((vs=bs.doenetAttributes)==null?void 0:vs.createdFromMacro)||ls(bs)}))return{success:!1};let us=ss.map(ls),cs=[],ds=[],ps=[];if(us.filter(bs=>bs).length===0)cs=ss;else{if(us[0]){let vs=us.indexOf(!1);vs!==-1&&(ds=ss.slice(0,vs),ss=ss.slice(vs),us=us.slice(vs))}let bs=us.indexOf(!0);bs===-1?cs=ss:(cs=ss.slice(0,bs),ps=ss.slice(bs))}if(cs.length===0)return{success:!1};let gs=returnBreakStringsSugarFunction({childrenToComponentFunction:bs=>({componentType:"function",children:bs}),mustStripOffOuterParentheses:!0})({matchedChildren:cs}),ys=[];return gs.success?ys=gs.newChildren:ys=[{componentType:"function",children:cs}],{success:!0,newChildren:[...ds,...ys,...ps]}};return rs.push({replacementFunction:ns}),rs}static returnChildGroups(){let rs=super.returnChildGroups();return rs.push({group:"functions",componentTypes:["function"]},{group:"bezierControls",componentTypes:["bezierControls"]}),rs}static returnStateVariableDefinitions({numerics:rs}){let ns=super.returnStateVariableDefinitions({numerics:rs});return ns.styleDescription={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({selectedStyle:{dependencyType:"stateVariable",variableName:"selectedStyle"},document:{dependencyType:"ancestor",componentType:"document",variableNames:["theme"]}}),definition:function({dependencyValues:ss}){var us;let os;((us=ss.document)==null?void 0:us.stateValues.theme)==="dark"?os=ss.selectedStyle.lineColorWordDarkMode:os=ss.selectedStyle.lineColorWord;let ls=ss.selectedStyle.lineWidthWord;return ss.selectedStyle.lineStyleWord&&(ls&&(ls+=" "),ls+=ss.selectedStyle.lineStyleWord),ls&&(ls+=" "),ls+=os,{setValue:{styleDescription:ls}}}},ns.styleDescriptionWithNoun={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({styleDescription:{dependencyType:"stateVariable",variableName:"styleDescription"}}),definition:function({dependencyValues:ss}){return{setValue:{styleDescriptionWithNoun:ss.styleDescription+" curve"}}}},ns.curveType={forRenderer:!0,returnDependencies:()=>({functionChildren:{dependencyType:"child",childGroups:["functions"]},through:{dependencyType:"attributeComponent",attributeName:"through"}}),definition({dependencyValues:ss}){let os="function";return ss.through!==null?os="bezier":ss.functionChildren.length>1&&(os="parameterization"),{setValue:{curveType:os}}}},ns.fShadow={defaultValue:null,hasEssential:!0,returnDependencies:()=>({}),definition:()=>({useEssentialOrDefaultValue:{fShadow:!0}})},ns.graphXmin={forRenderer:!0,additionalStateVariablesDefined:[{variableName:"graphXmax",forRenderer:!0},{variableName:"graphYmin",forRenderer:!0},{variableName:"graphYmax",forRenderer:!0}],returnDependencies:()=>({graphAncestor:{dependencyType:"ancestor",componentType:"graph",variableNames:["xmin","xmax","ymin","ymax"]}}),definition({dependencyValues:ss}){return ss.graphAncestor?{setValue:{graphXmin:ss.graphAncestor.stateValues.xmin,graphXmax:ss.graphAncestor.stateValues.xmax,graphYmin:ss.graphAncestor.stateValues.ymin,graphYmax:ss.graphAncestor.stateValues.ymax}}:{setValue:{graphXmin:null,graphXmax:null,graphYmin:null,graphYmax:null}}}},ns.parMax={public:!0,shadowingInstructions:{createComponentOfType:"number"},forRenderer:!0,returnDependencies:()=>({curveType:{dependencyType:"stateVariable",variableName:"curveType"},parMaxAttr:{dependencyType:"attributeComponent",attributeName:"parMax",variableNames:["value"]},nThroughPoints:{dependencyType:"stateVariable",variableName:"nThroughPoints"},extrapolateForward:{dependencyType:"stateVariable",variableName:"extrapolateForward"},functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["domain"]},adapterSourceDomain:{dependencyType:"adapterSourceStateVariable",variableName:"domain"},graphXmin:{dependencyType:"stateVariable",variableName:"graphXmin"},graphXmax:{dependencyType:"stateVariable",variableName:"graphXmax"},graphYmin:{dependencyType:"stateVariable",variableName:"graphYmin"},graphYmax:{dependencyType:"stateVariable",variableName:"graphYmax"},flipFunction:{dependencyType:"stateVariable",variableName:"flipFunction"}}),definition:function({dependencyValues:ss}){let os;if(ss.curveType==="bezier")os=ss.nThroughPoints-1,ss.extrapolateForward&&(os*=2);else if(ss.parMaxAttr!==null)os=ss.parMaxAttr.stateValues.value.evaluate_to_constant();else if(ss.curveType==="function"){let ls=null;ss.functionChild.length===1?ls=ss.functionChild[0].stateValues.domain:ls=ss.adapterSourceDomain,ls!==null&&(ls=ls[0],os=Context.fromAst(ls.tree[1][2]).evaluate_to_constant());let us,cs;ss.flipFunction?(cs=ss.graphYmax,us=ss.graphYmin):(cs=ss.graphXmax,us=ss.graphXmin),cs!==null&&us!==null&&(os===void 0?os=cs+.1*(cs-us):os=Math.min(os,cs+.1*(cs-us))),os===void 0&&(os=1/0)}else os=10;return{setValue:{parMax:os}}}},ns.parMin={forRenderer:!0,public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({curveType:{dependencyType:"stateVariable",variableName:"curveType"},parMinAttr:{dependencyType:"attributeComponent",attributeName:"parMin",variableNames:["value"]},nThroughPoints:{dependencyType:"stateVariable",variableName:"nThroughPoints"},extrapolateBackward:{dependencyType:"stateVariable",variableName:"extrapolateBackward"},functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["domain"]},adapterSourceDomain:{dependencyType:"adapterSourceStateVariable",variableName:"domain"},graphXmin:{dependencyType:"stateVariable",variableName:"graphXmin"},graphXmax:{dependencyType:"stateVariable",variableName:"graphXmax"},graphYmin:{dependencyType:"stateVariable",variableName:"graphYmin"},graphYmax:{dependencyType:"stateVariable",variableName:"graphYmax"},flipFunction:{dependencyType:"stateVariable",variableName:"flipFunction"}}),definition:function({dependencyValues:ss}){let os;if(ss.curveType==="bezier")os=0,ss.extrapolateBackward&&(os=-(ss.nThroughPoints-1));else if(ss.parMinAttr!==null)os=ss.parMinAttr.stateValues.value.evaluate_to_constant();else if(ss.curveType==="function"){let ls=null;ss.functionChild.length===1?ls=ss.functionChild[0].stateValues.domain:ls=ss.adapterSourceDomain,ls!==null&&(ls=ls[0],os=Context.fromAst(ls.tree[1][1]).evaluate_to_constant());let us,cs;ss.flipFunction?(cs=ss.graphYmax,us=ss.graphYmin):(cs=ss.graphXmax,us=ss.graphXmin),cs!==null&&us!==null&&(os===void 0?os=us+.1*(us-cs):os=Math.max(os,us+.1*(us-cs))),os===void 0&&(os=-1/0)}else os=-10;return{setValue:{parMin:os}}}},ns.domainForFunctions={returnDependencies:()=>({parMin:{dependencyType:"stateVariable",variableName:"parMin"},parMax:{dependencyType:"stateVariable",variableName:"parMax"}}),definition({dependencyValues:ss}){return{setValue:{domainForFunctions:[Context.fromAst(["interval",["tuple",ss.parMin,ss.parMax],["tuple",!0,!0]])]}}}},ns.nThroughPoints={returnDependencies:()=>({through:{dependencyType:"attributeComponent",attributeName:"through",variableNames:["nPoints"]}}),definition({dependencyValues:ss}){let os=0;return ss.through!==null&&(os=ss.through.stateValues.nPoints),{setValue:{nThroughPoints:os}}}},ns.nDimensions={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies(){return{through:{dependencyType:"attributeComponent",attributeName:"through",variableNames:["nDimensions"]}}},definition:function({dependencyValues:ss}){return ss.through!==null?{setValue:{nDimensions:ss.through.stateValues.nDimensions},checkForActualChange:{nDimensions:!0}}:{setValue:{nDimensions:2}}}},ns.throughPoints={public:!0,shadowingInstructions:{createComponentOfType:"math",returnWrappingComponents(ss){return ss==="throughPointX"?[]:[["point",{componentType:"mathList",isAttribute:"xs"}]]}},isArray:!0,nDimensions:2,entryPrefixes:["throughPointX","throughPoint"],getArrayKeysFromVarName({arrayEntryPrefix:ss,varEnding:os,arraySize:ls}){if(ss==="throughPointX"){let us=os.split("_").map(cs=>Number(cs)-1);return us.length===2&&us.every((cs,ds)=>Number.isInteger(cs)&&cs>=0)?ls?us.every((cs,ds)=>cs=0?ls?usus+","+ds):[]:[us+",0"]:[]}},arrayVarNameFromPropIndex(ss,os){if(os==="throughPoints")return ss.length===1?"throughPoint"+ss[0]:`throughPointX${ss[0]}_${ss[1]}`;if(os.slice(0,12)==="throughPoint"){let ls=Number(os.slice(12));if(Number.isInteger(ls)&&ls>0)return`throughPointX${ls}_${ss[0]}`}return null},returnArraySizeDependencies:()=>({nThroughPoints:{dependencyType:"stateVariable",variableName:"nThroughPoints"},nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),returnArraySize({dependencyValues:ss}){return[ss.nThroughPoints,ss.nDimensions]},returnArrayDependenciesByKey({arrayKeys:ss}){let os={};for(let ls of ss){let[us,cs]=ls.split(","),ds=Number(us)+1+"_"+(Number(cs)+1);os[ls]={through:{dependencyType:"attributeComponent",attributeName:"through",variableNames:["pointX"+ds]}}}return{dependenciesByKey:os}},arrayDefinitionByKey({dependencyValuesByKey:ss,arrayKeys:os}){let ls={};for(let us of os){let[cs,ds]=us.split(","),ps=Number(cs)+1+"_"+(Number(ds)+1),fs=ss[us].through;fs!==null&&fs.stateValues["pointX"+ps]?ls[us]=fs.stateValues["pointX"+ps]:ls[us]=Context.fromAst(0)}return{setValue:{throughPoints:ls}}},async inverseArrayDefinitionByKey({desiredStateVariableValues:ss,dependencyValuesByKey:os,dependencyNamesByKey:ls,initialChange:us,stateValues:cs}){if(us&&!await cs.draggable)return{success:!1};let ds=[];for(let ps in ss.throughPoints){let[fs,hs]=ps.split(","),gs=Number(fs)+1+"_"+(Number(hs)+1);if(os[ps].through!==null&&os[ps].through.stateValues["pointX"+gs])ds.push({setDependency:ls[ps].through,desiredValue:ss.throughPoints[ps],childIndex:0,variableIndex:0});else return{success:!1}}return{success:!0,instructions:ds}}},ns.numericalThroughPoints={isArray:!0,entryPrefixes:["numericalThroughPoint"],forRenderer:!0,returnArraySizeDependencies:()=>({nThroughPoints:{dependencyType:"stateVariable",variableName:"nThroughPoints"}}),returnArraySize({dependencyValues:ss}){return[ss.nThroughPoints]},returnArrayDependenciesByKey({arrayKeys:ss}){let os={};for(let ls of ss)os[ls]={throughPoint:{dependencyType:"stateVariable",variableName:"throughPoint"+(Number(ls)+1)}};return{dependenciesByKey:os}},arrayDefinitionByKey({dependencyValuesByKey:ss,arrayKeys:os}){let ls={};for(let us of os){let cs=ss[us].throughPoint.map(ds=>ds.evaluate_to_constant());cs.every(ds=>Number.isFinite(ds))||(cs=Array(cs.length).fill(NaN)),ls[us]=cs}return{setValue:{numericalThroughPoints:ls}}}},ns.haveBezierControls={forRenderer:!0,returnDependencies:()=>({controlChild:{dependencyType:"child",childGroups:["bezierControls"]}}),definition({dependencyValues:ss}){return{setValue:{haveBezierControls:ss.controlChild.length>0}}}},ns.bezierControlsAlwaysVisible={forRenderer:!0,returnDependencies:()=>({controlChild:{dependencyType:"child",childGroups:["bezierControls"],variableNames:["alwaysVisible"]}}),definition({dependencyValues:ss}){return{setValue:{bezierControlsAlwaysVisible:ss.controlChild.length>0&&ss.controlChild[0].stateValues.alwaysVisible}}}},ns.vectorControlDirections={public:!0,shadowingInstructions:{createComponentOfType:"text"},isArray:!0,entryPrefixes:["vectorControlDirection"],forRenderer:!0,returnArraySizeDependencies:()=>({nThroughPoints:{dependencyType:"stateVariable",variableName:"nThroughPoints"}}),returnArraySize({dependencyValues:ss}){return[ss.nThroughPoints]},returnArrayDependenciesByKey({arrayKeys:ss}){let os={};for(let us of ss)os[us]={controlChild:{dependencyType:"child",childGroups:["bezierControls"],variableNames:["direction"+(Number(us)+1)]}};return{dependenciesByKey:os,globalDependencies:{haveBezierControls:{dependencyType:"stateVariable",variableName:"haveBezierControls"}}}},arrayDefinitionByKey({dependencyValuesByKey:ss,arrayKeys:os}){let ls={};for(let us of os){let cs=ss[us].controlChild;cs&&cs.length>0?ls[us]=cs[0].stateValues["direction"+(Number(us)+1)]:ls[us]="none"}return{setValue:{vectorControlDirections:ls}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ss,dependencyNamesByKey:os,dependencyValuesByKey:ls,globalDependencyValues:us}){if(!us.haveBezierControls)return{success:!1};let cs=[];for(let ds in ss.vectorControlDirections){let ps=ls[ds].controlChild;ps&&ps.length>0&&cs.push({setDependency:os[ds].controlChild,desiredValue:ss.vectorControlDirections[ds],childIndex:0,variableIndex:0})}return{success:!0,instructions:cs}}},ns.hiddenControls={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},isArray:!0,entryPrefixes:["hiddenControl"],forRenderer:!0,returnArraySizeDependencies:()=>({nThroughPoints:{dependencyType:"stateVariable",variableName:"nThroughPoints"}}),returnArraySize({dependencyValues:ss}){return[ss.nThroughPoints]},returnArrayDependenciesByKey({arrayKeys:ss}){let os={};for(let us of ss)os[us]={controlChild:{dependencyType:"child",childGroups:["bezierControls"],variableNames:["hiddenControl"+(Number(us)+1)]}};return{dependenciesByKey:os,globalDependencies:{haveBezierControls:{dependencyType:"stateVariable",variableName:"haveBezierControls"}}}},arrayDefinitionByKey({dependencyValuesByKey:ss,arrayKeys:os}){let ls={};for(let us of os){let cs=ss[us].controlChild;cs&&cs.length>0?ls[us]=cs[0].stateValues["hiddenControl"+(Number(us)+1)]:ls[us]=!1}return{setValue:{hiddenControls:ls}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ss,dependencyNamesByKey:os,dependencyValuesByKey:ls,globalDependencyValues:us}){if(!us.haveBezierControls)return{success:!1};let cs=[];for(let ds in ss.hiddenControls){let ps=ls[ds].controlChild;ps&&ps.length>0&&cs.push({setDependency:os[ds].controlChild,desiredValue:ss.hiddenControls[ds],childIndex:0,variableIndex:0})}return{success:!0,instructions:cs}}},ns.controlVectors={isArray:!0,public:!0,shadowingInstructions:{createComponentOfType:"math",returnWrappingComponents(ss){return ss==="controlVectorX"?[]:[["vector",{componentType:"mathList",isAttribute:"xs"}]]}},entryPrefixes:["controlVectorX","controlVector"],nDimensions:3,stateVariablesDeterminingDependencies:["vectorControlDirections","nThroughPoints"],getArrayKeysFromVarName({arrayEntryPrefix:ss,varEnding:os,arraySize:ls}){if(ss==="controlVectorX"){let us=os.split("_").map(cs=>Number(cs)-1);return us.length===3&&us.every((cs,ds)=>Number.isInteger(cs)&&cs>=0)?ls?us.every((cs,ds)=>csNumber(cs)-1);return us.length===2&&us.every(cs=>Number.isInteger(cs)&&cs>=0)?ls?us.every((cs,ds)=>csString(us)+","+ds):[]:[String(us)+",0"]:[]}},returnArraySizeDependencies:()=>({nThroughPoints:{dependencyType:"stateVariable",variableName:"nThroughPoints"},nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),returnArraySize({dependencyValues:ss}){return[ss.nThroughPoints,2,ss.nDimensions]},returnArrayDependenciesByKey({arrayKeys:ss,stateValues:os}){let ls={haveBezierControls:{dependencyType:"stateVariable",variableName:"haveBezierControls"},nThroughPoints:{dependencyType:"stateVariable",variableName:"nThroughPoints"},nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"},splineTension:{dependencyType:"stateVariable",variableName:"splineTension"},splineForm:{dependencyType:"stateVariable",variableName:"splineForm"}},us={};for(let cs of ss){let ds=cs.split(",").map(bs=>Number(bs)),ps=ds.map(bs=>bs+1),fs=ps.join("_");us[cs]={direction:{dependencyType:"stateVariable",variableName:"vectorControlDirection"+ps[0]},controlChild:{dependencyType:"child",childGroups:["bezierControls"],variableNames:["control"+fs]}};let hs=ds[0],gs=os.vectorControlDirections[hs],ys=[];gs==="none"?ys=[hs-1,hs,hs+1]:gs==="previous"?ys=[hs,hs+1]:gs==="next"&&(ys=[hs-1,hs]);for(let bs of ys)bs>=0&&bsNumber(bs)),fs=ds.map(bs=>bs+1).join("_"),hs=ds[0],gs=ds[1],ys=os[cs].direction;if(ys==="none"){let bs=os[cs]["throughPoint"+(hs+1)],vs,xs;hs>0&&(vs=os[cs]["throughPoint"+hs]),hsNumber(ys)).map(ys=>ys+1).join("_"),gs=ls[ds].controlChild;gs.length>0&&gs[0].stateValues["control"+hs]&&cs.push({setDependency:os[ds].controlChild,desiredValue:ss.controlVectors[ds],childIndex:0,variableIndex:0})}return{success:!0,instructions:cs}}},ns.numericalControlVectors={isArray:!0,entryPrefixes:["numericalControlVector"],forRenderer:!0,nDimensions:2,returnArraySizeDependencies:()=>({nThroughPoints:{dependencyType:"stateVariable",variableName:"nThroughPoints"}}),returnArraySize({dependencyValues:ss}){return[ss.nThroughPoints,2]},returnArrayDependenciesByKey({arrayKeys:ss}){let os={};for(let ls of ss){let ds=ls.split(",").map(ps=>Number(ps)).map(ps=>ps+1).join("_");os[ls]={controlVector:{dependencyType:"stateVariable",variableName:"controlVector"+ds}}}return{dependenciesByKey:os}},arrayDefinitionByKey({dependencyValuesByKey:ss,arrayKeys:os}){let ls={};for(let us of os){let cs=ss[us].controlVector.map(ds=>ds.tree);ls[us]=cs}return{setValue:{numericalControlVectors:ls}}}},ns.controlPoints={isArray:!0,public:!0,shadowingInstructions:{createComponentOfType:"math",returnWrappingComponents(ss){return ss==="controlPointX"?[]:[["point",{componentType:"mathList",isAttribute:"xs"}]]}},entryPrefixes:["controlPointX","controlPoint"],nDimensions:3,getArrayKeysFromVarName({arrayEntryPrefix:ss,varEnding:os,arraySize:ls}){if(ss==="controlPointX"){let us=os.split("_").map(cs=>Number(cs)-1);return us.length===3&&us.every((cs,ds)=>Number.isInteger(cs)&&cs>=0)?ls?us.every((cs,ds)=>csNumber(cs)-1);return us.length===2&&us.every(cs=>Number.isInteger(cs)&&cs>=0)?ls?us.every((cs,ds)=>csString(us)+","+ds):[]:[String(us)+",0"]:[]}},returnArraySizeDependencies:()=>({nThroughPoints:{dependencyType:"stateVariable",variableName:"nThroughPoints"},nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),returnArraySize({dependencyValues:ss}){return[ss.nThroughPoints,2,ss.nDimensions]},returnArrayDependenciesByKey({arrayKeys:ss}){let os={haveBezierControls:{dependencyType:"stateVariable",variableName:"haveBezierControls"},nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}},ls={};for(let us of ss){let ds=us.split(",").map(fs=>Number(fs)).map(fs=>fs+1),ps=ds.join("_");ls[us]={throughPointX:{dependencyType:"stateVariable",variableName:"throughPointX"+ds[0]+"_"+ds[2]},controlVectorX:{dependencyType:"stateVariable",variableName:"controlVectorX"+ps}}}return{globalDependencies:os,dependenciesByKey:ls}},arrayDefinitionByKey({globalDependencyValues:ss,dependencyValuesByKey:os,arrayKeys:ls}){let us={};for(let cs of ls)if(ss.nDimensions!==2)us[cs]=Context.fromAst(NaN);else{let ds=os[cs].controlVectorX;if(ds){let ps=os[cs].throughPointX.evaluate_to_constant();us[cs]=Context.fromAst(ps+ds.tree)}else us[cs]=null}return{setValue:{controlPoints:us}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ss,dependencyNamesByKey:os,dependencyValuesByKey:ls,globalDependencyValues:us}){if(!us.haveBezierControls||us.nDimensions!==2)return{success:!1};let cs=[];for(let ds in ss.controlPoints)if(ls[ds].controlVectorX){let fs=ls[ds].throughPointX,hs=ss.controlPoints[ds];hs.tree&&(hs=hs.tree);let gs=Context.fromAst(["+",hs,["-",fs.tree]]);cs.push({setDependency:os[ds].controlVectorX,desiredValue:gs})}return{success:!0,instructions:cs}}},ns.numericalControlPoints={isArray:!0,entryPrefixes:["numericalControlPoint"],forRenderer:!0,nDimensions:2,returnArraySizeDependencies:()=>({nThroughPoints:{dependencyType:"stateVariable",variableName:"nThroughPoints"}}),returnArraySize({dependencyValues:ss}){return[ss.nThroughPoints,2]},returnArrayDependenciesByKey({arrayKeys:ss}){let os={};for(let ls of ss){let ds=ls.split(",").map(ps=>Number(ps)).map(ps=>ps+1).join("_");os[ls]={controlPoint:{dependencyType:"stateVariable",variableName:"controlPoint"+ds}}}return{dependenciesByKey:os}},arrayDefinitionByKey({dependencyValuesByKey:ss,arrayKeys:os}){let ls={};for(let us of os){let cs=ss[us].controlPoint.map(ds=>ds.tree);ls[us]=cs}return{setValue:{numericalControlPoints:ls}}}},ns.splineCoeffs={isArray:!0,returnArraySizeDependencies:()=>({nThroughPoints:{dependencyType:"stateVariable",variableName:"nThroughPoints"}}),returnArraySize({dependencyValues:ss}){return[ss.nThroughPoints-1]},returnArrayDependenciesByKey({arrayKeys:ss}){let os={};for(let ls of ss){let us=Number(ls)+1,cs=us+1;os[ls]={previousPoint:{dependencyType:"stateVariable",variableName:"numericalThroughPoint"+us},nextPoint:{dependencyType:"stateVariable",variableName:"numericalThroughPoint"+cs},previousVector:{dependencyType:"stateVariable",variableName:"numericalControlVector"+us+"_2"},nextVector:{dependencyType:"stateVariable",variableName:"numericalControlVector"+cs+"_1"}}}return{dependenciesByKey:os}},arrayDefinitionByKey({dependencyValuesByKey:ss,arrayKeys:os}){let ls={};for(let us of os){let cs=ss[us].previousPoint,ds=ss[us].nextPoint,ps=ss[us].previousVector,fs=ss[us].nextVector,hs=[];for(let gs=0;gs<2;gs++)hs.push(initCubicPoly(cs[gs],ds[gs],3*ps[gs],-3*fs[gs]));ls[us]=hs}return{setValue:{splineCoeffs:ls}}}},ns.extrapolateBackwardCoeffs={stateVariablesDeterminingDependencies:["extrapolateBackward"],additionalStateVariablesDefined:[{variableName:"extrapolateBackwardMode",public:!0,shadowingInstructions:{createComponentOfType:"text"}}],returnDependencies({stateValues:ss}){let os={extrapolateBackward:{dependencyType:"stateVariable",variableName:"extrapolateBackward"},nThroughPoints:{dependencyType:"stateVariable",variableName:"nThroughPoints"}};return ss.extrapolateBackward&&(os.firstSplineCoeffs={dependencyType:"stateVariable",variableName:"splineCoeffs1"},os.graphXmin={dependencyType:"stateVariable",variableName:"graphXmin"},os.graphXmax={dependencyType:"stateVariable",variableName:"graphXmax"},os.graphYmin={dependencyType:"stateVariable",variableName:"graphYmin"},os.graphYmax={dependencyType:"stateVariable",variableName:"graphYmax"}),os},definition({dependencyValues:ss}){if(!ss.extrapolateBackward||!ss.firstSplineCoeffs)return{setValue:{extrapolateBackwardCoeffs:null,extrapolateBackwardMode:""}};let os=ss.firstSplineCoeffs[0],ls=ss.firstSplineCoeffs[1],us=os[0],cs=os[1],ds=2*os[2],ps=ls[0],fs=ls[1],hs=2*ls[2],gs=cs*cs+fs*fs,ys=(fs*ds-cs*hs)/(gs*gs);if(Math.abs(ys)<1e-12||Math.abs(cs)<1e-12||Math.abs(fs)<1e-12){let xs=cs,Cs=fs;if(ss.graphXmin!==null&&ss.graphXmax!==null&&ss.graphYmin!==null&&ss.graphYmax!==null){let Ss=ss.graphXmax-ss.graphXmin,Ns=ss.graphYmax-ss.graphYmin,As=ss.nThroughPoints-1,ws=Ss/As/Math.abs(xs),Es=Ns/As/Math.abs(Cs),_s=Math.min(ws,Es);_s>1&&(xs*=_s,Cs*=_s)}return{setValue:{extrapolateBackwardCoeffs:[[us,xs,0],[ps,Cs,0]],extrapolateBackwardMode:"line"}}}let bs=fs*ys,vs=-cs*ys;if(bs*cs>0){let xs=bs/vs,Cs=(1+xs*xs)**2,Ts=cs;if(ss.graphXmin!==null&&ss.graphXmax!==null&&ss.graphYmin!==null&&ss.graphYmax!==null){let ws=ss.graphXmax-ss.graphXmin,Es=ss.graphYmax-ss.graphYmin,_s=ss.nThroughPoints-1,$s=ws/_s,Rs=1/0;if(vs!==0){let Os=vs*Cs/2*_s*_s,Ds=-xs*_s,Vs=Math.sqrt(Ds*Ds+4*Math.abs(Os)*Es);Rs=(Math.abs(Ds)+Vs)/(2*Math.abs(Os))}let Is=Math.min($s,Rs);Is>Math.abs(Ts)&&(Ts*=Is/Math.abs(Ts))}let Ss=-Ts*xs,Ns=vs*Ts*Ts*Cs;return{setValue:{extrapolateBackwardCoeffs:[[us,Ts,0],[ps,Ss,Ns/2]],extrapolateBackwardMode:"parabolaVertical"}}}else{let xs=vs/bs,Cs=(1+xs*xs)**2,Ts=fs;if(ss.graphXmin!==null&&ss.graphXmax!==null&&ss.graphYmin!==null&&ss.graphYmax!==null){let ws=ss.graphXmax-ss.graphXmin,Es=ss.graphYmax-ss.graphYmin,_s=ss.nThroughPoints-1,$s=Es/_s,Rs=1/0;if(bs!==0){let Os=bs*Cs/2*_s*_s,Ds=-xs*_s,Vs=Math.sqrt(Ds*Ds+4*Math.abs(Os)*ws);Rs=(Math.abs(Ds)+Vs)/(2*Math.abs(Os))}let Is=Math.min(Rs,$s);Is>Math.abs(Ts)&&(Ts*=Is/Math.abs(Ts))}let Ss=-Ts*xs,Ns=bs*Ts*Ts*Cs;return{setValue:{extrapolateBackwardCoeffs:[[us,Ss,Ns/2],[ps,Ts,0]],extrapolateBackwardMode:"parabolaHorizontal"}}}}},ns.extrapolateForwardCoeffs={stateVariablesDeterminingDependencies:["nThroughPoints","extrapolateForward"],additionalStateVariablesDefined:[{variableName:"extrapolateForwardMode",public:!0,shadowingInstructions:{createComponentOfType:"text"}}],returnDependencies({stateValues:ss}){let os={extrapolateForward:{dependencyType:"stateVariable",variableName:"extrapolateForward"},nThroughPoints:{dependencyType:"stateVariable",variableName:"nThroughPoints"}};return ss.extrapolateForward&&ss.nThroughPoints>=2&&(os.lastSplineCoeffs={dependencyType:"stateVariable",variableName:"splineCoeffs"+(ss.nThroughPoints-1)},os.graphXmin={dependencyType:"stateVariable",variableName:"graphXmin"},os.graphXmax={dependencyType:"stateVariable",variableName:"graphXmax"},os.graphYmin={dependencyType:"stateVariable",variableName:"graphYmin"},os.graphYmax={dependencyType:"stateVariable",variableName:"graphYmax"}),os},definition({dependencyValues:ss}){if(!ss.extrapolateForward||!ss.lastSplineCoeffs)return{setValue:{extrapolateForwardCoeffs:null,extrapolateForwardMode:""}};let os=ss.lastSplineCoeffs[0],ls=ss.lastSplineCoeffs[1],us=os[0]+os[1]+os[2]+os[3],cs=os[1]+2*os[2]+3*os[3],ds=2*os[2]+6*os[3],ps=ls[0]+ls[1]+ls[2]+ls[3],fs=ls[1]+2*ls[2]+3*ls[3],hs=2*ls[2]+6*ls[3],gs=cs*cs+fs*fs,ys=(fs*ds-cs*hs)/(gs*gs);if(Math.abs(ys)<1e-12||Math.abs(cs)<1e-12||Math.abs(fs)<1e-12){let xs=cs,Cs=fs;if(ss.graphXmin!==null&&ss.graphXmax!==null&&ss.graphYmin!==null&&ss.graphYmax!==null){let Ss=ss.graphXmax-ss.graphXmin,Ns=ss.graphYmax-ss.graphYmin,As=ss.nThroughPoints-1,ws=Ss/As/Math.abs(xs),Es=Ns/As/Math.abs(Cs),_s=Math.min(ws,Es);_s>1&&(xs*=_s,Cs*=_s)}return{setValue:{extrapolateForwardCoeffs:[[us,xs,0],[ps,Cs,0]],extrapolateForwardMode:"line"}}}let bs=fs*ys,vs=-cs*ys;if(bs*cs<0){let xs=bs/vs,Cs=(1+xs*xs)**2,Ts=cs;if(ss.graphXmin!==null&&ss.graphXmax!==null&&ss.graphYmin!==null&&ss.graphYmax!==null){let ws=ss.graphXmax-ss.graphXmin,Es=ss.graphYmax-ss.graphYmin,_s=ss.nThroughPoints-1,$s=ws/_s,Rs=1/0;if(vs!==0){let Os=vs*Cs/2*_s*_s,Ds=-xs*_s,Vs=Math.sqrt(Ds*Ds+4*Math.abs(Os)*Es);Rs=(Math.abs(Ds)+Vs)/(2*Math.abs(Os))}let Is=Math.min($s,Rs);Is>Math.abs(Ts)&&(Ts*=Is/Math.abs(Ts))}let Ss=-Ts*xs,Ns=vs*Ts*Ts*Cs;return{setValue:{extrapolateForwardCoeffs:[[us,Ts,0],[ps,Ss,Ns/2]],extrapolateForwardMode:"parabolaVertical"}}}else{let xs=vs/bs,Cs=(1+xs*xs)**2,Ts=fs;if(ss.graphXmin!==null&&ss.graphXmax!==null&&ss.graphYmin!==null&&ss.graphYmax!==null){let ws=ss.graphXmax-ss.graphXmin,Es=ss.graphYmax-ss.graphYmin,_s=ss.nThroughPoints-1,$s=Es/_s,Rs=1/0;if(bs!==0){let Os=bs*Cs/2*_s*_s,Ds=-xs*_s,Vs=Math.sqrt(Ds*Ds+4*Math.abs(Os)*ws);Rs=(Math.abs(Ds)+Vs)/(2*Math.abs(Os))}let Is=Math.min(Rs,$s);Is>Math.abs(Ts)&&(Ts*=Is/Math.abs(Ts))}let Ss=-Ts*xs,Ns=bs*Ts*Ts*Cs;return{setValue:{extrapolateForwardCoeffs:[[us,Ss,Ns/2],[ps,Ts,0]],extrapolateForwardMode:"parabolaHorizontal"}}}}},ns.fs={isArray:!0,entryPrefixes:["f"],additionalStateVariablesDefined:[{variableName:"fDefinitions",isArray:!0,forRenderer:!0,entryPrefixes:["fDefinition"]}],public:!0,shadowingInstructions:{createComponentOfType:"function",addStateVariablesShadowingStateVariables:{fDefinitions:{stateVariableToShadow:"fDefinitions"},domain:{stateVariableToShadow:"domainForFunctions"}}},returnArraySizeDependencies:()=>({functionChildren:{dependencyType:"child",childGroups:["functions"]},curveType:{dependencyType:"stateVariable",variableName:"curveType"}}),returnArraySize({dependencyValues:ss}){return ss.curveType==="bezier"?[2]:[Math.max(1,ss.functionChildren.length)]},returnArrayDependenciesByKey({arrayKeys:ss}){let os={curveType:{dependencyType:"stateVariable",variableName:"curveType"},numericalThroughPoints:{dependencyType:"stateVariable",variableName:"numericalThroughPoints"},splineCoeffs:{dependencyType:"stateVariable",variableName:"splineCoeffs"},nThroughPoints:{dependencyType:"stateVariable",variableName:"nThroughPoints"},extrapolateBackward:{dependencyType:"stateVariable",variableName:"extrapolateBackward"},extrapolateBackwardCoeffs:{dependencyType:"stateVariable",variableName:"extrapolateBackwardCoeffs"},extrapolateForward:{dependencyType:"stateVariable",variableName:"extrapolateForward"},extrapolateForwardCoeffs:{dependencyType:"stateVariable",variableName:"extrapolateForwardCoeffs"}},ls={};for(let us of ss)ls[us]={functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["numericalf","fDefinition"],childIndices:[us]}},Number(us)===0&&(ls[us].fShadow={dependencyType:"stateVariable",variableName:"fShadow"},ls[us].fDefinitionAdapted={dependencyType:"adapterSourceStateVariable",variableName:"fDefinition"});return{globalDependencies:os,dependenciesByKey:ls}},arrayDefinitionByKey({globalDependencyValues:ss,dependencyValuesByKey:os,arrayKeys:ls}){if(ss.curveType==="bezier"){let ds={functionType:"bezier",nThroughPoints:ss.nThroughPoints,numericalThroughPoints:ss.numericalThroughPoints,splineCoeffs:ss.splineCoeffs,extrapolateForward:ss.extrapolateForward,extrapolateForwardCoeffs:ss.extrapolateForwardCoeffs,extrapolateBackward:ss.extrapolateBackward,extrapolateBackwardCoeffs:ss.extrapolateBackwardCoeffs},ps={},fs={};return ds.component=0,ps[0]=returnBezierFunctions(ds),fs[0]=ds,ds={...ds},ds.component=1,ps[1]=returnBezierFunctions(ds),fs[1]=ds,{setValue:{fs:ps,fDefinitions:fs}}}let us={},cs={};for(let ds of ls){let ps=os[ds].functionChild;ps.length===1?(us[ds]=ps[0].stateValues.numericalf,cs[ds]=ps[0].stateValues.fDefinition):Number(ds)===0&&os[ds].fShadow?(us[ds]=os[ds].fShadow,cs[ds]=os[ds].fDefinitionAdapted):(us[ds]=()=>0,cs[ds]={functionType:"zero"})}return{setValue:{fs:us,fDefinitions:cs}}}},ns.f={isAlias:!0,targetVariableName:"f1"},ns.allXCriticalPoints={returnDependencies:()=>({splineCoeffs:{dependencyType:"stateVariable",variableName:"splineCoeffs"},fs:{dependencyType:"stateVariable",variableName:"fs"},curveType:{dependencyType:"stateVariable",variableName:"curveType"}}),definition({dependencyValues:ss}){let os=[];if(ss.curveType!=="bezier")return{setValue:{allXCriticalPoints:os}};let ls=ss.fs[0],us=ss.fs[1],cs=[],ds=!1;for(let[ps,fs]of ss.splineCoeffs.entries()){let hs=fs[0],gs=3*hs[3],ys=2*hs[2],bs=hs[1];if(Math.abs(gs)<1e-14){let vs=-bs/ys;ds=addTimePointBezier({t:vs,ind:ps,ts:cs,ignoreLeft:ds})}else{let vs=ys*ys-4*gs*bs;if(vs==0){let xs=-ys/(2*gs);ds=addTimePointBezier({t:xs,ind:ps,ts:cs,ignoreLeft:ds})}else if(vs>0){let xs=Math.sqrt(vs),Cs=[(-ys-xs)/(2*gs),(-ys+xs)/(2*gs)];gs<0&&(Cs=[Cs[1],Cs[0]]);let Ts=!1;for(let Ss of Cs)addTimePointBezier({t:Ss,ind:ps,ts:cs,ignoreLeft:ds})&&(Ts=!0);ds=Ts}else ds=!1}}for(let ps of cs)os.push([ls(ps),us(ps)]);return{setValue:{allXCriticalPoints:os}}}},ns.nXCriticalPoints={public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies:()=>({allXCriticalPoints:{dependencyType:"stateVariable",variableName:"allXCriticalPoints"}}),definition({dependencyValues:ss}){return{setValue:{nXCriticalPoints:ss.allXCriticalPoints.length}}}},ns.xCriticalPoints={public:!0,shadowingInstructions:{createComponentOfType:"number",returnWrappingComponents(ss){return ss==="xCriticalPointX"?[]:[["point",{componentType:"mathList",isAttribute:"xs"}]]}},isArray:!0,nDimensions:2,entryPrefixes:["xCriticalPointX","xCriticalPoint"],getArrayKeysFromVarName({arrayEntryPrefix:ss,varEnding:os,arraySize:ls}){if(ss==="xCriticalPointX"){let us=os.split("_").map(cs=>Number(cs)-1);return us.length===2&&us.every((cs,ds)=>Number.isInteger(cs)&&cs>=0)?ls?us.every((cs,ds)=>cs=0?ls?usus+","+ds):[]:[us+",0"]:[]}},arrayVarNameFromPropIndex(ss,os){if(os==="xCriticalPoints")return ss.length===1?"xCriticalPoint"+ss[0]:`xCriticalPointX${ss[0]}_${ss[1]}`;if(os.slice(0,14)==="xCriticalPoint"){let ls=Number(os.slice(14));if(Number.isInteger(ls)&&ls>0)return`xCriticalPointX${ls}_${ss[0]}`}return null},returnArraySizeDependencies:()=>({nXCriticalPoints:{dependencyType:"stateVariable",variableName:"nXCriticalPoints"}}),returnArraySize({dependencyValues:ss}){return[ss.nXCriticalPoints,2]},returnArrayDependenciesByKey(){return{globalDependencies:{allXCriticalPoints:{dependencyType:"stateVariable",variableName:"allXCriticalPoints"}}}},arrayDefinitionByKey({globalDependencyValues:ss}){let os={};for(let ls=0;ls({splineCoeffs:{dependencyType:"stateVariable",variableName:"splineCoeffs"},fs:{dependencyType:"stateVariable",variableName:"fs"},curveType:{dependencyType:"stateVariable",variableName:"curveType"}}),definition({dependencyValues:ss}){let os=[];if(ss.curveType!=="bezier")return{setValue:{allYCriticalPoints:os}};let ls=ss.fs[0],us=ss.fs[1],cs=[],ds=!1;for(let[ps,fs]of ss.splineCoeffs.entries()){let hs=fs[1],gs=3*hs[3],ys=2*hs[2],bs=hs[1];if(Math.abs(gs)<1e-14){let vs=-bs/ys;ds=addTimePointBezier({t:vs,ind:ps,ts:cs,ignoreLeft:ds})}else{let vs=ys*ys-4*gs*bs;if(vs==0){let xs=-ys/(2*gs);ds=addTimePointBezier({t:xs,ind:ps,ts:cs,ignoreLeft:ds})}else if(vs>0){let xs=Math.sqrt(vs),Cs=[(-ys-xs)/(2*gs),(-ys+xs)/(2*gs)];gs<0&&(Cs=[Cs[1],Cs[0]]);let Ts=!1;for(let Ss of Cs)addTimePointBezier({t:Ss,ind:ps,ts:cs,ignoreLeft:ds})&&(Ts=!0);ds=Ts}else ds=!1}}for(let ps of cs)os.push([ls(ps),us(ps)]);return{setValue:{allYCriticalPoints:os}}}},ns.nYCriticalPoints={public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies:()=>({allYCriticalPoints:{dependencyType:"stateVariable",variableName:"allYCriticalPoints"}}),definition({dependencyValues:ss}){return{setValue:{nYCriticalPoints:ss.allYCriticalPoints.length}}}},ns.yCriticalPoints={public:!0,shadowingInstructions:{createComponentOfType:"number",returnWrappingComponents(ss){return ss==="yCriticalPointX"?[]:[["point",{componentType:"mathList",isAttribute:"xs"}]]}},isArray:!0,nDimensions:2,entryPrefixes:["yCriticalPointX","yCriticalPoint"],getArrayKeysFromVarName({arrayEntryPrefix:ss,varEnding:os,arraySize:ls}){if(ss==="yCriticalPointX"){let us=os.split("_").map(cs=>Number(cs)-1);return us.length===2&&us.every((cs,ds)=>Number.isInteger(cs)&&cs>=0)?ls?us.every((cs,ds)=>cs=0?ls?usus+","+ds):[]:[us+",0"]:[]}},arrayVarNameFromPropIndex(ss,os){if(os==="yCriticalPoints")return ss.length===1?"yCriticalPoint"+ss[0]:`yCriticalPointX${ss[0]}_${ss[1]}`;if(os.slice(0,14)==="yCriticalPoint"){let ls=Number(os.slice(14));if(Number.isInteger(ls)&&ls>0)return`yCriticalPointX${ls}_${ss[0]}`}return null},returnArraySizeDependencies:()=>({nYCriticalPoints:{dependencyType:"stateVariable",variableName:"nYCriticalPoints"}}),returnArraySize({dependencyValues:ss}){return[ss.nYCriticalPoints,2]},returnArrayDependenciesByKey(){return{globalDependencies:{allYCriticalPoints:{dependencyType:"stateVariable",variableName:"allYCriticalPoints"}}}},arrayDefinitionByKey({globalDependencyValues:ss}){let os={};for(let ls=0;ls({splineCoeffs:{dependencyType:"stateVariable",variableName:"splineCoeffs"},fs:{dependencyType:"stateVariable",variableName:"fs"},curveType:{dependencyType:"stateVariable",variableName:"curveType"}}),definition({dependencyValues:ss}){let os=[];if(ss.curveType!=="bezier")return{setValue:{allCurvatureChangePoints:os}};let ls=ss.fs[0],us=ss.fs[1],cs=[],ds=!1;for(let[ps,fs]of ss.splineCoeffs.entries()){let[hs,gs,ys,bs]=fs[0],[vs,xs,Cs,Ts]=fs[1],Ss=3*(ys*Ts-Cs*bs),Ns=3*(gs*Ts-xs*bs),As=gs*Cs-xs*ys;if(Math.abs(Ss)<1e-14){let ws=-As/Ns;ds=addTimePointBezier({t:ws,ind:ps,ts:cs,ignoreLeft:ds})}else{let ws=Ns*Ns-4*Ss*As;if(ws==0){let Es=-Ns/(2*Ss);ds=addTimePointBezier({t:Es,ind:ps,ts:cs,ignoreLeft:ds})}else if(ws>0){let Es=Math.sqrt(ws),_s=[(-Ns-Es)/(2*Ss),(-Ns+Es)/(2*Ss)];Ss<0&&(_s=[_s[1],_s[0]]);let $s=!1;for(let Rs of _s)addTimePointBezier({t:Rs,ind:ps,ts:cs,ignoreLeft:ds})&&($s=!0);ds=$s}else ds=!1}}for(let ps of cs)os.push([ls(ps),us(ps)]);return{setValue:{allCurvatureChangePoints:os}}}},ns.nCurvatureChangePoints={public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies:()=>({allCurvatureChangePoints:{dependencyType:"stateVariable",variableName:"allCurvatureChangePoints"}}),definition({dependencyValues:ss}){return{setValue:{nCurvatureChangePoints:ss.allCurvatureChangePoints.length}}}},ns.curvatureChangePoints={public:!0,shadowingInstructions:{createComponentOfType:"number",returnWrappingComponents(ss){return ss==="curvatureChangePointX"?[]:[["point",{componentType:"mathList",isAttribute:"xs"}]]}},isArray:!0,nDimensions:2,entryPrefixes:["curvatureChangePointX","curvatureChangePoint"],getArrayKeysFromVarName({arrayEntryPrefix:ss,varEnding:os,arraySize:ls}){if(ss==="curvatureChangePointX"){let us=os.split("_").map(cs=>Number(cs)-1);return us.length===2&&us.every((cs,ds)=>Number.isInteger(cs)&&cs>=0)?ls?us.every((cs,ds)=>cs=0?ls?usus+","+ds):[]:[us+",0"]:[]}},arrayVarNameFromPropIndex(ss,os){if(os==="curvatureChangePoints")return ss.length===1?"curvatureChangePoint"+ss[0]:`curvatureChangePointX${ss[0]}_${ss[1]}`;if(os.slice(0,20)==="curvatureChangePoint"){let ls=Number(os.slice(20));if(Number.isInteger(ls)&&ls>0)return`curvatureChangePointX${ls}_${ss[0]}`}return null},returnArraySizeDependencies:()=>({nCurvatureChangePoints:{dependencyType:"stateVariable",variableName:"nCurvatureChangePoints"}}),returnArraySize({dependencyValues:ss}){return[ss.nCurvatureChangePoints,2]},returnArrayDependenciesByKey(){return{globalDependencies:{allCurvatureChangePoints:{dependencyType:"stateVariable",variableName:"allCurvatureChangePoints"}}}},arrayDefinitionByKey({globalDependencyValues:ss}){let os={};for(let ls=0;ls({nearestPointAsCurvePrelim:{dependencyType:"stateVariable",variableName:"nearestPointAsCurvePrelim"},functionChild:{dependencyType:"child",childGroups:["functions"],variableNames:["nearestPointAsCurve"]},adapterSourceValue:{dependencyType:"adapterSourceStateVariable",variableName:"nearestPointAsCurve"}}),definition({dependencyValues:ss,usedDefault:os}){let ls=ss.nearestPointAsCurvePrelim;return os.nearestPointAsCurvePrelim&&(ss.functionChild.length>0?ls=ss.functionChild[0].stateValues.nearestPointAsCurve:ss.adapterSourceValue!==null&&(ls=ss.adapterSourceValue)),{setValue:{nearestPointAsCurve:ls}}}},ns.nearestPoint={returnDependencies:()=>({curveType:{dependencyType:"stateVariable",variableName:"curveType"},fs:{dependencyType:"stateVariable",variableName:"fs"},flipFunction:{dependencyType:"stateVariable",variableName:"flipFunction"},nDiscretizationPoints:{dependencyType:"stateVariable",variableName:"nDiscretizationPoints"},parMin:{dependencyType:"stateVariable",variableName:"parMin"},parMax:{dependencyType:"stateVariable",variableName:"parMax"},periodic:{dependencyType:"stateVariable",variableName:"periodic"},graphXmin:{dependencyType:"stateVariable",variableName:"graphXmin"},graphXmax:{dependencyType:"stateVariable",variableName:"graphXmax"},graphYmin:{dependencyType:"stateVariable",variableName:"graphYmin"},graphYmax:{dependencyType:"stateVariable",variableName:"graphYmax"},nearestPointAsCurve:{dependencyType:"stateVariable",variableName:"nearestPointAsCurve"}}),definition({dependencyValues:ss}){let os=null;return ss.curveType==="function"?os=getNearestPointFunctionCurve({dependencyValues:ss,numerics:rs}):["parameterization","bezier"].includes(ss.curveType)&&(os=getNearestPointParametrizedCurve({dependencyValues:ss,numerics:rs})),{setValue:{nearestPoint:os}}}},ns}async moveControlVector({controlVector:rs,controlVectorInds:ns,transient:ss,actionId:os,sourceInformation:ls={},skipRendererUpdate:us=!1}){let cs={[ns+",0"]:Context.fromAst(rs[0]),[ns+",1"]:Context.fromAst(rs[1])};return ss?await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"controlVectors",value:cs,sourceDetails:{controlVectorMoved:ns}}],transient:ss,actionId:os,sourceInformation:ls,skipRendererUpdate:us}):await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"controlVectors",value:cs,sourceDetails:{controlVectorMoved:ns}}],actionId:os,sourceInformation:ls,skipRendererUpdate:us,event:{verb:"interacted",object:{componentId:this.componentName},result:{["controlVector"+ns.join("_")]:rs}}})}async moveThroughPoint({throughPoint:rs,throughPointInd:ns,transient:ss,actionId:os,sourceInformation:ls={},skipRendererUpdate:us=!1}){let cs={[ns+",0"]:Context.fromAst(rs[0]),[ns+",1"]:Context.fromAst(rs[1])};return ss?await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"throughPoints",value:cs,sourceDetails:{throughPointMoved:ns}}],transient:ss,actionId:os,sourceInformation:ls,skipRendererUpdate:us}):await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"throughPoints",value:cs,sourceDetails:{throughPointMoved:ns}}],actionId:os,sourceInformation:ls,skipRendererUpdate:us,event:{verb:"interacted",object:{componentId:this.componentName},result:{["throughPoint"+ns]:rs}}})}async changeVectorControlDirection({direction:rs,throughPointInd:ns,actionId:ss,sourceInformation:os={},skipRendererUpdate:ls=!1}){return await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"vectorControlDirection",value:{[ns]:rs}}],actionId:ss,sourceInformation:os,skipRendererUpdate:ls})}switchCurve(){}async curveClicked({actionId:rs,name:ns,sourceInformation:ss={},skipRendererUpdate:os=!1}){await this.coreFunctions.triggerChainedActions({triggeringAction:"click",componentName:ns,actionId:rs,sourceInformation:ss,skipRendererUpdate:os}),this.coreFunctions.resolveAction({actionId:rs})}async mouseDownOnCurve({actionId:rs,name:ns,sourceInformation:ss={},skipRendererUpdate:os=!1}){await this.coreFunctions.triggerChainedActions({triggeringAction:"down",componentName:ns,actionId:rs,sourceInformation:ss,skipRendererUpdate:os}),this.coreFunctions.resolveAction({actionId:rs})}}zs(Curve,"componentType","curve"),zs(Curve,"rendererType","curve"),zs(Curve,"primaryStateVariableForDefinition","fShadow");function getNearestPointFunctionCurve({dependencyValues:as,numerics:rs}){let ns=as.flipFunction,ss=as.fs[0],os=as.nDiscretizationPoints,ls=as.parMax,us=as.parMin;return function({variables:cs,scales:ds}){var Bs,Ms;let ps=(Bs=cs.x1)==null?void 0:Bs.evaluate_to_constant(),fs=(Ms=cs.x2)==null?void 0:Ms.evaluate_to_constant(),hs=ds[0],gs=ds[1],ys,bs;if(us!==-1/0){if(ys=us,bs=ss(us),!Number.isFinite(bs)){let Ws=us*.99999+ls*1e-5,Us=ss(Ws);Number.isFinite(Us)&&(ys=Ws,bs=Us)}if(ns){let Ws=ys;ys=bs,bs=Ws}}let vs,xs;if(ls!==1/0){if(vs=ls,xs=ss(ls),!Number.isFinite(xs)){let Ws=us*1e-5+ls*.99999,Us=ss(Ws);Number.isFinite(Us)&&(vs=Ws,xs=Us)}if(ns){let Ws=vs;vs=xs,xs=Ws}}if(!as.nearestPointAsCurve||!(Number.isFinite(ps)&&Number.isFinite(fs))){let Ws,Us;if(ns?(Us=fs,Ws=ss(Us)):(Ws=ps,Us=ss(Ws)),!(Number.isFinite(Ws)&&Number.isFinite(Us))){let js,Ls;ns?(js=Math.abs(us-fs),Ls=Math.abs(ls-fs)):(js=Math.abs(us-ps),Ls=Math.abs(ls-ps)),jsys.evaluate_to_constant());else return{coordsNumeric:[Context.fromAst(NaN),Context.fromAst(NaN)],numericEntries:!1};if(os)ps=os.map(ys=>ys.evaluate_to_constant()),ns?cs=ns.map(ys=>ys.evaluate_to_constant()):cs=[2*ds[0]-ps[0],2*ds[1]-ps[1]];else if(ns)cs=ns.map(ys=>ys.evaluate_to_constant()),ps=[2*ds[0]-cs[0],2*ds[1]-cs[1]];else return{coordsNumeric:[Context.fromAst(NaN),Context.fromAst(NaN)],numericEntries:!1};let fs=[];if(ls==="centripetal"){let ys=us(cs,ds),bs=us(ds,ps);ys=Math.sqrt(ys),bs=Math.sqrt(bs),bsContext.fromAst(ys)),gs=Number.isFinite(fs[0])&&Number.isFinite(fs[1]);return{coordsNumeric:hs,numericEntries:gs}}function initCubicPoly(as,rs,ns,ss){return[as,ns,-3*as+3*rs-2*ns-ss,2*as-2*rs+ns+ss]}function addTimePointBezier({t:as,ind:rs,ts:ns,ignoreLeft:ss=!1}){const ls=1.00000000000001,us=1-1e-14;let cs=!1;return as>=1e-14?as<=us?ns.push(rs+as):as-1e-14&&!ss&&ns.push(rs),cs}class EquilibriumCurve extends Curve{static createAttributesObject(){let rs=super.createAttributesObject();return rs.stable={createComponentOfType:"boolean",createStateVariable:"stable",defaultValue:!0,public:!0},rs.switchable={createComponentOfType:"boolean",createStateVariable:"switchable",defaultValue:!1,public:!0,forRenderer:!0},rs}static returnStateVariableDefinitions({numerics:rs}){let ns=super.returnStateVariableDefinitions({numerics:rs});return ns.dashed={forRenderer:!0,returnDependencies:()=>({stable:{dependencyType:"stateVariable",variableName:"stable"}}),definition({dependencyValues:ss}){return{setValue:{dashed:!ss.stable}}},inverseDefinition({desiredStateVariableValues:ss}){return{success:!0,instructions:[{setDependency:"stable",desiredValue:!ss.dashed}]}}},ns}async switchCurve({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){if(await this.stateValues.switchable)return await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"stable",value:!this.stateValues.stable}],actionId:rs,sourceInformation:ns,skipRendererUpdate:ss,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{stable:!this.stateValues.stable}}});this.coreFunctions.resolveAction({actionId:rs})}}zs(EquilibriumCurve,"componentType","equilibriumCurve"),zs(EquilibriumCurve,"rendererType","curve");const DynamicalSystems=Object.freeze(Object.defineProperty({__proto__:null,CobwebPolyline,EquilibriumCurve,EquilibriumLine,EquilibriumPoint,ODESystem},Symbol.toStringTag,{value:"Module"}));class Atom extends InlineComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.symbol={createComponentOfType:"text"},rs.atomicNumber={createComponentOfType:"integer"},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.atomicNumberShadow={defaultValue:null,hasEssential:!0,essentialVarName:"atomicNumber",returnDependencies:()=>({}),definition:()=>({useEssentialOrDefaultValue:{atomicNumberShadow:!0}}),inverseDefinition:async function({desiredStateVariableValues:ns}){return{success:!0,instructions:[{setEssentialValue:"atomicNumberShadow",value:ns.atomicNumberShadow}]}}},rs.dataForAtom={returnDependencies:()=>({fileContents:{dependencyType:"file",cid:"bafkreibilal4glrbpo7p7oodtwtnzkfhiylfoqa2td4ij6h6iqva57kzcy",fileType:"csv"},symbolAttr:{dependencyType:"attributeComponent",attributeName:"symbol",variableNames:["value"]},atomicNumberAttr:{dependencyType:"attributeComponent",attributeName:"atomicNumber",variableNames:["value"]},atomicNumberShadow:{dependencyType:"stateVariable",variableName:"atomicNumberShadow"}}),definition:function({dependencyValues:ns}){let ss=null,os=null;if(ns.symbolAttr)ss=ns.symbolAttr.stateValues.value.toLowerCase();else if(ns.atomicNumberAttr)os=ns.atomicNumberAttr.stateValues.value;else if(ns.atomicNumberShadow)os=ns.atomicNumberShadow;else return{setValue:{dataForAtom:null}};let ls=ns.fileContents.trim().split(` `),us;os!==null?us=os-1:us=["h","he","li","be","b","c","n","o","f","ne","na","mg","al","si","p","s","cl","ar","k","ca","sc","ti","v","cr","mn","fe","co","ni","cu","zn","ga","ge","as","se","br","kr","rb","sr","y","zr","nb","mo","tc","ru","rh","pd","ag","cd","in","sn","sb","te","i","xe","cs","ba","la","ce","pr","nd","pm","sm","eu","gd","tb","dy","ho","er","tm","yb","lu","hf","ta","w","re","os","ir","pt","au","hg","tl","pb","bi","po","at","rn","fr","ra","ac","th","pa","u","np","pu","am","cm","bk","cf","es","fm","md","no","lr","rf","db","sg","bh","hs","mt","ds","rg","cn","nh","fl","mc","lv","ts","og"].indexOf(ss==null?void 0:ss.toLowerCase());let cs=ls.slice(1)[us];if(!cs)return{setValue:{dataForAtom:null}};cs=cs.trim().split(",").map(gs=>gs.trim());let ds=ls[0].trim().split(",").map(gs=>gs.trim()).map(gs=>(['"',"'"].includes(gs[0])&&gs[gs.length-1]===gs[0]&&(gs=gs.substring(1,gs.length-1).trim()),gs)),ps=ds.length,fs=["number","string","string","number","number","string","number","string","string","number","number","number","number","number","number","number","string"],hs={};for(let gs=0;gs({dataForAtom:{dependencyType:"stateVariable",variableName:"dataForAtom"}}),definition({dependencyValues:ns}){let ss;return ns.dataForAtom?ss=ns.dataForAtom["Atomic Number"]:ss=null,{setValue:{atomicNumber:ss}}}},rs.symbol={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({dataForAtom:{dependencyType:"stateVariable",variableName:"dataForAtom"}}),definition({dependencyValues:ns}){let ss;return ns.dataForAtom?ss=ns.dataForAtom.Symbol:ss=null,{setValue:{symbol:ss}}}},rs.name={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({dataForAtom:{dependencyType:"stateVariable",variableName:"dataForAtom"}}),definition({dependencyValues:ns}){let ss;return ns.dataForAtom?ss=ns.dataForAtom.Name:ss=null,{setValue:{name:ss}}}},rs.group={public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies:()=>({dataForAtom:{dependencyType:"stateVariable",variableName:"dataForAtom"}}),definition({dependencyValues:ns}){let ss;return ns.dataForAtom?ss=ns.dataForAtom.Group:ss=null,{setValue:{group:ss}}}},rs.atomicMass={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({dataForAtom:{dependencyType:"stateVariable",variableName:"dataForAtom"}}),definition({dependencyValues:ns}){let ss;return ns.dataForAtom?ss=ns.dataForAtom["Atomic Mass"]:ss=null,{setValue:{atomicMass:ss}}}},rs.phaseAtSTP={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({dataForAtom:{dependencyType:"stateVariable",variableName:"dataForAtom"}}),definition({dependencyValues:ns}){let ss;return ns.dataForAtom?ss=ns.dataForAtom["Phase at STP"]:ss=null,{setValue:{phaseAtSTP:ss}}}},rs.chargeOfCommonIon={public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies:()=>({dataForAtom:{dependencyType:"stateVariable",variableName:"dataForAtom"}}),definition({dependencyValues:ns}){let ss;return ns.dataForAtom?ss=ns.dataForAtom["Charge of Common Ion"]:ss=null,{setValue:{chargeOfCommonIon:ss}}}},rs.metalCategory={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({dataForAtom:{dependencyType:"stateVariable",variableName:"dataForAtom"}}),definition({dependencyValues:ns}){let ss;return ns.dataForAtom?ss=ns.dataForAtom["Metal/Nonmetal/Metalloid"]:ss=null,{setValue:{metalCategory:ss}}}},rs.groupName={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({dataForAtom:{dependencyType:"stateVariable",variableName:"dataForAtom"}}),definition({dependencyValues:ns}){let ss;return ns.dataForAtom?ss=ns.dataForAtom["Group Name"]:ss=null,{setValue:{groupName:ss}}}},rs.period={public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies:()=>({dataForAtom:{dependencyType:"stateVariable",variableName:"dataForAtom"}}),definition({dependencyValues:ns}){let ss;return ns.dataForAtom?ss=ns.dataForAtom.Period:ss=null,{setValue:{period:ss}}}},rs.ionizationEnergy={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({dataForAtom:{dependencyType:"stateVariable",variableName:"dataForAtom"}}),definition({dependencyValues:ns}){let ss;return ns.dataForAtom?ss=ns.dataForAtom["Ionization Energy"]:ss=null,{setValue:{ionizationEnergy:ss}}}},rs.meltingPoint={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({dataForAtom:{dependencyType:"stateVariable",variableName:"dataForAtom"}}),definition({dependencyValues:ns}){let ss;return ns.dataForAtom?ss=ns.dataForAtom["Melting Point"]:ss=null,{setValue:{meltingPoint:ss}}}},rs.boilingPoint={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({dataForAtom:{dependencyType:"stateVariable",variableName:"dataForAtom"}}),definition({dependencyValues:ns}){let ss;return ns.dataForAtom?ss=ns.dataForAtom["Boiling Point"]:ss=null,{setValue:{boilingPoint:ss}}}},rs.atomicRadius={public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies:()=>({dataForAtom:{dependencyType:"stateVariable",variableName:"dataForAtom"}}),definition({dependencyValues:ns}){let ss;return ns.dataForAtom?ss=ns.dataForAtom["Atomic Radius"]:ss=null,{setValue:{atomicRadius:ss}}}},rs.density={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({dataForAtom:{dependencyType:"stateVariable",variableName:"dataForAtom"}}),definition({dependencyValues:ns}){let ss;return ns.dataForAtom?ss=ns.dataForAtom.Density:ss=null,{setValue:{density:ss}}}},rs.electronegativity={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({dataForAtom:{dependencyType:"stateVariable",variableName:"dataForAtom"}}),definition({dependencyValues:ns}){let ss;return ns.dataForAtom?ss=ns.dataForAtom.Electronegativity:ss=null,{setValue:{electronegativity:ss}}}},rs.electronConfiguration={public:!0,shadowingInstructions:{createComponentOfType:"electronConfiguration"},returnDependencies:()=>({dataForAtom:{dependencyType:"stateVariable",variableName:"dataForAtom"}}),definition({dependencyValues:ns}){let ss;return ns.dataForAtom?ss=ns.dataForAtom["Electron Configuration"]:ss=null,{setValue:{electronConfiguration:ss}}}},rs.orbitalDiagram={public:!0,shadowingInstructions:{createComponentOfType:"orbitalDiagram"},returnDependencies:()=>({electronConfiguration:{dependencyType:"stateVariable",variableName:"electronConfiguration"}}),definition({dependencyValues:ns}){let ss;return ns.electronConfiguration?ss=electronConfigurationToOrbitalDiagram(ns.electronConfiguration):ss=null,{setValue:{orbitalDiagram:ss}}}},rs.math={public:!0,shadowingInstructions:{createComponentOfType:"math"},returnDependencies:()=>({symbol:{dependencyType:"stateVariable",variableName:"symbol"}}),definition({dependencyValues:ns}){let ss;return ns.symbol?ss=["^",ns.symbol]:ss="_",{setValue:{math:Context.fromAst(ss)}}}},rs.latex={additionalStateVariablesDefined:[{variableName:"latexWithInputChildren",forRenderer:!0}],returnDependencies:()=>({symbol:{dependencyType:"stateVariable",variableName:"symbol"}}),definition({dependencyValues:ns}){let ss;return ns.symbol?ss=`\\text{${ns.symbol}}`:ss="[\\text{Invalid Chemical Symbol}]",{setValue:{latex:ss,latexWithInputChildren:[ss]}}}},rs}}zs(Atom,"componentType","atom"),zs(Atom,"rendererType","math"),zs(Atom,"primaryStateVariableForDefinition","atomicNumberShadow"),zs(Atom,"adapters",["math","name",{stateVariable:"atomicNumber",componentType:"ion"}]);function electronConfigurationToOrbitalDiagram(as){let rs=as.tree;if(!(Array.isArray(rs)&&rs[0]==="*"))return null;rs=rs.slice(1);let ns=rs.length/2;if(!Number.isInteger(ns))return null;let ss=[];for(let os=0;os0))return null;let us=rs[2*os+1];if(!(Array.isArray(us)&&us[0]==="^"))return null;let cs=us[1],ds=us[2];if(!(["s","p","d","f"].includes(cs)&&Number.isInteger(ds)&&ds>0))return null;let ps=`${ls}${cs}`,fs;cs==="s"?fs=1:cs==="p"?fs=3:cs==="d"?fs=5:fs=7;let hs=Array(fs).fill("");for(let gs=0;gs({}),definition:()=>({useEssentialOrDefaultValue:{atomicNumberShadow:!0}}),inverseDefinition:async function({desiredStateVariableValues:ns}){return{success:!0,instructions:[{setEssentialValue:"atomicNumberShadow",value:ns.atomicNumberShadow}]}}},rs.dataForAtom={returnDependencies:()=>({fileContents:{dependencyType:"file",cid:"bafkreibilal4glrbpo7p7oodtwtnzkfhiylfoqa2td4ij6h6iqva57kzcy",fileType:"csv"},symbolAttr:{dependencyType:"attributeComponent",attributeName:"symbol",variableNames:["value"]},atomicNumberAttr:{dependencyType:"attributeComponent",attributeName:"atomicNumber",variableNames:["value"]},atomChild:{dependencyType:"child",childGroups:["atoms"],variableNames:["atomicNumber"]},atomicNumberShadow:{dependencyType:"stateVariable",variableName:"atomicNumberShadow"}}),definition:function({dependencyValues:ns}){let ss=null,os=null;if(ns.atomChild.length>0)os=ns.atomChild[0].stateValues.atomicNumber;else if(ns.symbolAttr)ss=ns.symbolAttr.stateValues.value.toLowerCase();else if(ns.atomicNumberAttr)os=ns.atomicNumberAttr.stateValues.value;else if(ns.atomicNumberShadow)os=ns.atomicNumberShadow;else return{setValue:{dataForAtom:null}};let ls=ns.fileContents.trim().split(` `),us;os!==null?us=os-1:us=["h","he","li","be","b","c","n","o","f","ne","na","mg","al","si","p","s","cl","ar","k","ca","sc","ti","v","cr","mn","fe","co","ni","cu","zn","ga","ge","as","se","br","kr","rb","sr","y","zr","nb","mo","tc","ru","rh","pd","ag","cd","in","sn","sb","te","i","xe","cs","ba","la","ce","pr","nd","pm","sm","eu","gd","tb","dy","ho","er","tm","yb","lu","hf","ta","w","re","os","ir","pt","au","hg","tl","pb","bi","po","at","rn","fr","ra","ac","th","pa","u","np","pu","am","cm","bk","cf","es","fm","md","no","lr","rf","db","sg","bh","hs","mt","ds","rg","cn","nh","fl","mc","lv","ts","og"].indexOf(ss==null?void 0:ss.toLowerCase());let cs=ls.slice(1)[us];if(!cs)return{setValue:{dataForAtom:null}};cs=cs.trim().split(",").map(gs=>gs.trim());let ds=ls[0].trim().split(",").map(gs=>gs.trim()).map(gs=>(['"',"'"].includes(gs[0])&&gs[gs.length-1]===gs[0]&&(gs=gs.substring(1,gs.length-1).trim()),gs)),ps=ds.length,fs=["number","string","string","number","number","string","number","string","string","number","number","number","number","number","number","number","string"],hs={};for(let gs=0;gs({dataForAtom:{dependencyType:"stateVariable",variableName:"dataForAtom"}}),definition({dependencyValues:ns}){let ss;return ns.dataForAtom?ss=ns.dataForAtom["Atomic Number"]:ss=null,{setValue:{atomicNumber:ss}}}},rs.symbol={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({dataForAtom:{dependencyType:"stateVariable",variableName:"dataForAtom"}}),definition({dependencyValues:ns}){let ss;return ns.dataForAtom?ss=ns.dataForAtom.Symbol:ss=null,{setValue:{symbol:ss}}}},rs.charge={public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies:()=>({dataForAtom:{dependencyType:"stateVariable",variableName:"dataForAtom"},chargeAttr:{dependencyType:"attributeComponent",attributeName:"charge",variableNames:["value"]}}),definition({dependencyValues:ns}){let ss;return ns.chargeAttr?(ss=ns.chargeAttr.stateValues.value,Number.isFinite(ss)||(ss=0)):ns.dataForAtom?ss=ns.dataForAtom["Charge of Common Ion"]||0:ss=0,{setValue:{charge:ss}}}},rs.name={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({dataForAtom:{dependencyType:"stateVariable",variableName:"dataForAtom"},charge:{dependencyType:"stateVariable",variableName:"charge"},group:{dependencyType:"stateVariable",variableName:"group"},atomicNumber:{dependencyType:"stateVariable",variableName:"atomicNumber"}}),definition({dependencyValues:ns}){let ss;if(ns.dataForAtom){if(ss=ns.dataForAtom.Name,ns.charge<0){let os={Hydrogen:"Hydride",Oxygen:"Oxide",Sulfur:"Sulfide",Nitrogen:"Nitride",Phosphorus:"Phosphide",Carbon:"Carbide"},ls=ss.length;ss.substring(ls-3,ls)==="ine"?ss=ss.substring(0,ls-3)+"ide":ss in os&&(ss=os[ss])}else if(ns.charge>0&&(ns.group>=3&&ns.group<=12||ns.group===101||ns.group===102||[13,31,49,50,81,82,83,84].includes(ns.atomicNumber))){let os="";switch(ns.charge){case 1:os=" (I)";break;case 2:os=" (II)";break;case 3:os=" (III)";break;case 4:os=" (IV)";break;case 5:os=" (V)";break;case 6:os=" (VI)";break;case 7:os=" (VII)";break;case 8:os=" (VIII)";break}ss+=os}}else ss=null;return{setValue:{name:ss}}}},rs.group={public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies:()=>({dataForAtom:{dependencyType:"stateVariable",variableName:"dataForAtom"}}),definition({dependencyValues:ns}){let ss;return ns.dataForAtom?ss=ns.dataForAtom.Group:ss=null,{setValue:{group:ss}}}},rs.metalCategory={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({dataForAtom:{dependencyType:"stateVariable",variableName:"dataForAtom"}}),definition({dependencyValues:ns}){let ss;return ns.dataForAtom?ss=ns.dataForAtom["Metal/Nonmetal/Metalloid"]:ss=null,{setValue:{metalCategory:ss}}}},rs.groupName={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({dataForAtom:{dependencyType:"stateVariable",variableName:"dataForAtom"}}),definition({dependencyValues:ns}){let ss;return ns.dataForAtom?ss=ns.dataForAtom["Group Name"]:ss=null,{setValue:{groupName:ss}}}},rs.period={public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies:()=>({dataForAtom:{dependencyType:"stateVariable",variableName:"dataForAtom"}}),definition({dependencyValues:ns}){let ss;return ns.dataForAtom?ss=ns.dataForAtom.Period:ss=null,{setValue:{period:ss}}}},rs.math={public:!0,shadowingInstructions:{createComponentOfType:"math"},returnDependencies:()=>({symbol:{dependencyType:"stateVariable",variableName:"symbol"},charge:{dependencyType:"stateVariable",variableName:"charge"}}),definition({dependencyValues:ns}){let ss;return ns.symbol?(ss=["^",ns.symbol],ns.charge===-1?ss.push("-"):ns.charge===1?ss.push("+"):ns.charge<0?ss.push(Math.abs(ns.charge)+"-"):ns.charge>0&&ss.push(Math.abs(ns.charge)+"+")):ss="_",{setValue:{math:Context.fromAst(ss)}}}},rs.latex={additionalStateVariablesDefined:[{variableName:"latexWithInputChildren",forRenderer:!0}],returnDependencies:()=>({symbol:{dependencyType:"stateVariable",variableName:"symbol"},charge:{dependencyType:"stateVariable",variableName:"charge"}}),definition({dependencyValues:ns}){let ss;return ns.symbol?(ss=`\\text{${ns.symbol}}`,ns.charge===-1?ss=ss+"^-":ns.charge===1?ss=ss+"^+":ns.charge<0?ss=ss+`^{${Math.abs(ns.charge)}-}`:ns.charge>0&&(ss=ss+`^{${Math.abs(ns.charge)}+}`)):ss="[\\text{Invalid Chemical Symbol}]",{setValue:{latex:ss,latexWithInputChildren:[ss]}}}},rs}}zs(Ion,"componentType","ion"),zs(Ion,"rendererType","math"),zs(Ion,"primaryStateVariableForDefinition","atomicNumberShadow"),zs(Ion,"adapters",["math","name"]);class IonicCompound extends InlineComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.symbol={createComponentOfType:"text"},rs.atomicNumber={createComponentOfType:"integer"},rs.charge={createComponentOfType:"integer"},rs}static returnChildGroups(){return[{group:"ions",componentTypes:["ion"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.ionicCompound={returnDependencies:()=>({ionChildren:{dependencyType:"child",childGroups:["ions"],variableNames:["symbol","charge","atomicNumber","name"]}}),definition({dependencyValues:ns}){let ss=ns.ionChildren.map(ds=>ds.stateValues.charge);if(ss.length!==2)return console.warn("have not implemented ionic compound for anything other than two ions"),{setValue:{ionicCompound:null}};if(!(ss[0]*ss[1]<0))return console.warn("ionic compound implemented only for one cation and one anion"),{setValue:{ionicCompound:null}};let os=Math.abs(ss[1]),ls=Math.abs(ss[0]),us=Context.math.gcd(os,ls);return os/=us,ls/=us,{setValue:{ionicCompound:[{symbol:ns.ionChildren[0].stateValues.symbol,atomicNumber:ns.ionChildren[0].stateValues.atomicNumber,name:ns.ionChildren[0].stateValues.name,charge:ss[0],count:os},{symbol:ns.ionChildren[1].stateValues.symbol,atomicNumber:ns.ionChildren[1].stateValues.atomicNumber,name:ns.ionChildren[1].stateValues.name,charge:ss[1],count:ls}]}}}},rs.math={public:!0,shadowingInstructions:{createComponentOfType:"math"},returnDependencies:()=>({ionicCompound:{dependencyType:"stateVariable",variableName:"ionicCompound"}}),definition({dependencyValues:ns}){let ss;if(ns.ionicCompound){ss=[];for(let os of ns.ionicCompound){let ls=os.symbol;os.count>1&&(ls=["_",ls,os.count]),ss.push(ls)}ss.length>1?ss=["*",...ss]:ss.length===1?ss=ss[0]:ss="_"}else ss="_";return{setValue:{math:Context.fromAst(ss)}}}},rs.latex={additionalStateVariablesDefined:[{variableName:"latexWithInputChildren",forRenderer:!0}],returnDependencies:()=>({ionicCompound:{dependencyType:"stateVariable",variableName:"ionicCompound"}}),definition({dependencyValues:ns}){let ss;if(ns.ionicCompound){ss="";for(let os of ns.ionicCompound)ss+=`\\text{${os.symbol}}`,os.count>1&&(ss+=`_{${os.count}}`)}else ss="[\\text{Invalid Ionic Compound}]";return{setValue:{latex:ss,latexWithInputChildren:[ss]}}}},rs}}zs(IonicCompound,"componentType","ionicCompound"),zs(IonicCompound,"rendererType","math"),zs(IonicCompound,"adapters",["math"]);class ElectronConfiguration extends MathComponent{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.latex={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({valueForDisplay:{dependencyType:"stateVariable",variableName:"valueForDisplay"}}),definition:function({dependencyValues:ns,usedDefault:ss}){let os;try{os=ns.valueForDisplay.toLatex()}catch{os="_"}return os=os.replaceAll("\\,",""),os=os.replaceAll("\\cdot","~"),{setValue:{latex:os}}}},rs}}zs(ElectronConfiguration,"componentType","electronConfiguration"),zs(ElectronConfiguration,"rendererType","math");class OrbitalDiagram extends BlockComponent{constructor(rs){super(rs),Object.assign(this.actions,{recordVisibilityChange:this.recordVisibilityChange.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.labels={createComponentOfType:"textList",createStateVariable:"labels",defaultValue:[]},rs}static returnSugarInstructions(){return[{replacementFunction:function({matchedChildren:ns}){return ns.length===1&&typeof ns[0]!="string"?{success:!1}:{success:!0,newChildren:[{componentType:"tupleList",children:ns}]}}}]}static returnChildGroups(){return[{group:"tupleLists",componentTypes:["tupleList"]},{group:"orbitalDiagrams",componentTypes:["orbitalDiagram"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.value={defaultValue:[{orbitalText:"",boxes:[]}],public:!0,shadowingInstructions:{createComponentOfType:"orbitalDiagram"},forRenderer:!0,returnDependencies:()=>({orbitalDiagramChildren:{dependencyType:"child",childGroups:["orbitalDiagrams"],variableNames:["value"]},tupleListChildren:{dependencyType:"child",childGroups:["tupleLists"],variableNames:["maths"]},labels:{dependencyType:"stateVariable",variableName:"labels"}}),definition:function({dependencyValues:ns}){function ss(){var us;function os(cs){if(cs==="u"||cs==="U")return"U";if(cs==="d"||cs==="D")return"D";if(cs==="e"||cs==="E")return"";if(Array.isArray(cs)&&cs[0]==="*"){let ds="";for(let ps of cs.slice(1))if(ps==="u"||ps==="U")ds+="U";else if(ps==="d"||ps==="D")ds+="D";else return"";return ds}else return""}if(ns.orbitalDiagramChildren.length===1)return ns.orbitalDiagramChildren[0].stateValues.value;let ls=[];if(((us=ns.tupleListChildren[0])==null?void 0:us.stateValues.maths.length)>0){let cs=ns.tupleListChildren[0].stateValues.maths;for(let[ds,ps]of cs.entries()){let fs="";ns.labels[ds]&&(fs=ns.labels[ds]);let hs=[];if(Array.isArray(ps.tree)&&ps.tree[0]==="tuple")for(let gs of ps.tree.slice(1))hs.push(os(gs));else hs.push(os(ps.tree));ls.push({orbitalText:fs,boxes:hs})}return ls}else return[{orbitalText:"",boxes:[]}]}return{setValue:{value:ss()}}}},rs}recordVisibilityChange({isVisible:rs,actionId:ns}){this.coreFunctions.requestRecordEvent({verb:"visibilityChanged",object:{componentName:this.componentName,componentType:this.componentType},result:{isVisible:rs}}),this.coreFunctions.resolveAction({actionId:ns})}}zs(OrbitalDiagram,"componentType","orbitalDiagram"),zs(OrbitalDiagram,"variableForPlainMacro","value");class OrbitalDiagramInput extends BlockComponent{constructor(rs){super(rs),Object.assign(this.actions,{addRow:this.addRow.bind(this),removeRow:this.removeRow.bind(this),addBox:this.addBox.bind(this),removeBox:this.removeBox.bind(this),addUpArrow:this.addUpArrow.bind(this),addDownArrow:this.addDownArrow.bind(this),removeArrow:this.removeArrow.bind(this),updateRowText:this.updateRowText.bind(this),selectRow:this.selectRow.bind(this),selectBox:this.selectBox.bind(this),recordVisibilityChange:this.recordVisibilityChange.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.prefill={createComponentOfType:"orbitalDiagram",createStateVariable:"prefill",defaultValue:[]},rs.prefillLabel={createComponentOfType:"textList",createStateVariable:"prefillLabel",defaultValue:[]},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.value={defaultValue:[{orbitalText:"",boxes:[]}],hasEssential:!0,forRenderer:!0,public:!0,shadowingInstructions:{createComponentOfType:"orbitalDiagram"},returnDependencies:()=>({prefill:{dependencyType:"stateVariable",variableName:"prefill"},prefillLabel:{dependencyType:"stateVariable",variableName:"prefillLabel"}}),definition:function({dependencyValues:ns}){function ss(){var os;if(((os=ns.prefill)==null?void 0:os.length)>0){let ls=JSON.parse(JSON.stringify(ns.prefill));for(let[us,cs]of ls.entries())ns.prefillLabel[us]&&(cs.orbitalText=ns.prefillLabel[us]);return ls}else return[{orbitalText:"",boxes:[]}]}return{useEssentialOrDefaultValue:{value:{get defaultValue(){return ss()}}}}},inverseDefinition({desiredStateVariableValues:ns}){return{success:!0,instructions:[{setEssentialValue:"value",value:ns.value}]}}},rs.rows={public:!0,shadowingInstructions:{createComponentOfType:"orbitalDiagram"},forRenderer:!0,returnDependencies:()=>({value:{dependencyType:"stateVariable",variableName:"value"}}),definition({dependencyValues:ns}){return{setValue:{rows:[...ns.value].reverse()}}},inverseDefinition({desiredStateVariableValues:ns}){return{success:!0,instructions:[{setDependency:"value",desiredValue:[...ns.rows].reverse()}]}}},rs.numRows={public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies:()=>({rows:{dependencyType:"stateVariable",variableName:"rows"}}),definition:function({dependencyValues:ns}){return{setValue:{numRows:ns.rows.length}}}},rs.selectedRowIndex={defaultValue:0,hasEssential:!0,forRenderer:!0,public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies:()=>({}),definition:function(){return{useEssentialOrDefaultValue:{selectedRowIndex:!0}}},async inverseDefinition({desiredStateVariableValues:ns,stateValues:ss}){let os=await ss.numRows,ls=ns.selectedRowIndex;return Number.isFinite(ls)?ls=Math.min(os,Math.max(0,Math.round(ls))):ls=0,{success:!0,instructions:[{setEssentialValue:"selectedRowIndex",value:ls}]}}},rs.selectedBoxIndex={defaultValue:0,hasEssential:!0,forRenderer:!0,public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies:()=>({}),definition:function(){return{useEssentialOrDefaultValue:{selectedBoxIndex:!0}}},async inverseDefinition({desiredStateVariableValues:ns}){let ss=ns.selectedBoxIndex;return Number.isFinite(ss)?ss=Math.max(0,Math.round(ss)):ss=0,{success:!0,instructions:[{setEssentialValue:"selectedBoxIndex",value:ss}]}}},rs}async addRow({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){let os=await this.stateValues.rows,ls=JSON.parse(JSON.stringify(os));os.length<20&&(ls=[{orbitalText:"",boxes:[]},...os]);let us=[{updateType:"updateValue",componentName:this.componentName,stateVariable:"rows",value:ls}];return await this.stateValues.selectedRowIndex-1!==-1&&us.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"selectedRowIndex",value:0}),await this.stateValues.selectedBoxIndex-1!==-1&&us.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"selectedBoxIndex",value:0}),await this.coreFunctions.performUpdate({updateInstructions:us,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{rows:ls}}})}async removeRow({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){let os=await this.stateValues.rows,ls=await this.stateValues.selectedRowIndex-1,us=JSON.parse(JSON.stringify(os));if(os.length>1){let cs=os.length-1-ls;ls===-1&&(cs=0),us.splice(cs,1)}return await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"rows",value:us},{updateType:"updateValue",componentName:this.componentName,stateVariable:"selectedRowIndex",value:0},{updateType:"updateValue",componentName:this.componentName,stateVariable:"selectedBoxIndex",value:0}],actionId:rs,sourceInformation:ns,skipRendererUpdate:ss,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{rows:us}}})}async addBox({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){let os=await this.stateValues.rows,ls=JSON.parse(JSON.stringify(os)),us=await this.stateValues.selectedRowIndex-1,cs=os.length-us-1;us===-1&&(cs=0),ls[cs].boxes.length<17&&ls[cs].boxes.push("");let ds=[{updateType:"updateValue",componentName:this.componentName,stateVariable:"rows",value:ls}];if(us!==-1){let ps=0;ds.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"selectedBoxIndex",value:ps})}return await this.coreFunctions.performUpdate({updateInstructions:ds,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{rows:ls}}})}async removeBox({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){let os=await this.stateValues.rows,ls=JSON.parse(JSON.stringify(os)),us=await this.stateValues.selectedRowIndex-1,cs=os.length-us-1;us===-1&&(cs=0);let ds=await this.stateValues.selectedBoxIndex-1,ps=ds;ds===-1&&(ps=ls[cs].boxes.length-1),ls[cs].boxes.splice(ps,1);let fs=[{updateType:"updateValue",componentName:this.componentName,stateVariable:"rows",value:ls}];return ds!==-1&&fs.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"selectedBoxIndex",value:0}),await this.coreFunctions.performUpdate({updateInstructions:fs,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{rows:ls}}})}async addUpArrow({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){let os=await this.stateValues.rows,ls=JSON.parse(JSON.stringify(os)),us=await this.stateValues.selectedRowIndex-1,cs=os.length-us-1;us===-1&&(cs=0);let ds=await this.stateValues.selectedBoxIndex-1,ps=ds;ds===-1&&(ps=ls[cs].boxes.length-1),ls[cs].boxes.length>0&&ls[cs].boxes[ps].length<3&&(ls[cs].boxes[ps]=ls[cs].boxes[ps]+"U");let fs=[{updateType:"updateValue",componentName:this.componentName,stateVariable:"rows",value:ls}];return await this.coreFunctions.performUpdate({updateInstructions:fs,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{rows:ls}}})}async addDownArrow({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){let os=await this.stateValues.rows,ls=JSON.parse(JSON.stringify(os)),us=await this.stateValues.selectedRowIndex-1,cs=os.length-us-1;us===-1&&(cs=0);let ds=await this.stateValues.selectedBoxIndex-1,ps=ds;ds===-1&&(ps=ls[cs].boxes.length-1),ls[cs].boxes.length>0&&ls[cs].boxes[ps].length<3&&(ls[cs].boxes[ps]=ls[cs].boxes[ps]+"D");let fs=[{updateType:"updateValue",componentName:this.componentName,stateVariable:"rows",value:ls}];return await this.coreFunctions.performUpdate({updateInstructions:fs,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{rows:ls}}})}async removeArrow({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){let os=await this.stateValues.rows,ls=JSON.parse(JSON.stringify(os)),us=await this.stateValues.selectedRowIndex-1,cs=os.length-us-1;us===-1&&(cs=0);let ds=await this.stateValues.selectedBoxIndex-1,ps=ds;ds===-1&&(ps=ls[cs].boxes.length-1),ls[cs].boxes.length>0&&ls[cs].boxes[ps].length>0&&(ls[cs].boxes[ps]=ls[cs].boxes[ps].slice(0,-1));let fs=[{updateType:"updateValue",componentName:this.componentName,stateVariable:"rows",value:ls}];return await this.coreFunctions.performUpdate({updateInstructions:fs,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{rows:ls}}})}async updateRowText({newValue:rs,actionId:ns,sourceInformation:ss={},skipRendererUpdate:os=!1}){let ls=await this.stateValues.rows,us=JSON.parse(JSON.stringify(ls)),cs=await this.stateValues.selectedRowIndex-1,ds=ls.length-cs-1;cs===-1&&(ds=0),us[ds].orbitalText=rs;let ps=[{updateType:"updateValue",componentName:this.componentName,stateVariable:"rows",value:us}];return await this.coreFunctions.performUpdate({updateInstructions:ps,actionId:ns,sourceInformation:ss,skipRendererUpdate:os,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{rows:us}}})}async selectRow({index:rs,actionId:ns,sourceInformation:ss={},skipRendererUpdate:os=!1}){return await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"selectedRowIndex",value:rs}],actionId:ns,sourceInformation:ss,skipRendererUpdate:os,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{selectedRowIndex:rs}}})}async selectBox({index:rs,actionId:ns,sourceInformation:ss={},skipRendererUpdate:os=!1}){return await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"selectedBoxIndex",value:rs}],actionId:ns,sourceInformation:ss,skipRendererUpdate:os,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{selectedBoxIndex:rs}}})}recordVisibilityChange({isVisible:rs,actionId:ns}){this.coreFunctions.requestRecordEvent({verb:"visibilityChanged",object:{componentName:this.componentName,componentType:this.componentType},result:{isVisible:rs}}),this.coreFunctions.resolveAction({actionId:ns})}}zs(OrbitalDiagramInput,"componentType","orbitalDiagramInput"),zs(OrbitalDiagramInput,"variableForPlainMacro","value"),zs(OrbitalDiagramInput,"variableForPlainCopy","value");const Chemistry=Object.freeze(Object.defineProperty({__proto__:null,Atom,ElectronConfiguration,Ion,IonicCompound,OrbitalDiagram,OrbitalDiagramInput},Symbol.toStringTag,{value:"Module"}));class FeedbackDefinition extends BaseComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.code={createComponentOfType:"text"},rs.text={createComponentOfType:"text"},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.feedbackDefinition={returnDependencies:()=>({codeAttr:{dependencyType:"attributeComponent",attributeName:"code",variableNames:["value"]},textAttr:{dependencyType:"attributeComponent",attributeName:"text",variableNames:["value"]}}),definition({dependencyValues:ns}){return ns.codeAttr!==null&&ns.textAttr!==null?{setValue:{feedbackDefinition:{[ns.codeAttr.stateValues.value.toLowerCase()]:ns.textAttr.stateValues.value}}}:{setValue:{feedbackDefinition:null}}}},rs}}zs(FeedbackDefinition,"componentType","feedbackDefinition");class FeedbackDefinitions extends BaseComponent{static returnChildGroups(){return[{group:"feedbackDefinition",componentTypes:["feedbackDefinition"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.value={returnDependencies:()=>({feedbackDefinitionChildren:{dependencyType:"child",childGroups:["feedbackDefinition"],variableNames:["feedbackDefinition"]}}),definition({dependencyValues:ns}){let ss={};for(let os of ns.feedbackDefinitionChildren)os.stateValues.feedbackDefinition&&Object.assign(ss,os.stateValues.feedbackDefinition);return{setValue:{value:ss}}}},rs}}zs(FeedbackDefinitions,"componentType","feedbackDefinitions"),zs(FeedbackDefinitions,"rendererType");const FeedbackDefinitions$1=Object.freeze(Object.defineProperty({__proto__:null,FeedbackDefinition,FeedbackDefinitions},Symbol.toStringTag,{value:"Module"}));class StyleDefinition extends BaseComponent{static createAttributesObject(){let rs=super.createAttributesObject();rs.styleNumber={createPrimitiveOfType:"number",createStateVariable:"styleNumber",defaultValue:1};for(let ns in styleAttributes)rs[ns]={createComponentOfType:styleAttributes[ns].componentType};return rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.styleDefinition={returnDependencies:function(){let ns={};for(let ss in styleAttributes)ns[ss]={dependencyType:"attributeComponent",attributeName:ss,variableNames:["value"]};return ns},definition:function({dependencyValues:ns}){let ss={};for(let os in styleAttributes)ns[os]!==null&&(ss[os]=ns[os].stateValues.value,typeof ss[os]=="string"&&(ss[os]=ss[os].toLowerCase()));return{setValue:{styleDefinition:ss}}}},rs}}zs(StyleDefinition,"componentType","styleDefinition"),zs(StyleDefinition,"rendererType");class StyleDefinitions extends BaseComponent{static returnChildGroups(){return[{group:"styleDefinition",componentTypes:["styleDefinition"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.value={returnDependencies:()=>({styleDefinitionChildren:{dependencyType:"child",childGroups:["styleDefinition"],variableNames:["styleNumber","styleDefinition"]}}),definition({dependencyValues:ns}){let ss={};for(let os of ns.styleDefinitionChildren){let ls=os.stateValues.styleNumber,us=ss[ls];us||(us=ss[ls]={}),Object.assign(us,os.stateValues.styleDefinition)}return{setValue:{value:ss}}}},rs}}zs(StyleDefinitions,"componentType","styleDefinitions"),zs(StyleDefinitions,"rendererType");const StyleDefinitions$1=Object.freeze(Object.defineProperty({__proto__:null,StyleDefinition,StyleDefinitions},Symbol.toStringTag,{value:"Module"}));class ComponentWithSelectableType extends BaseComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.type={createPrimitiveOfType:"string"},rs}static returnSugarInstructions(){let rs=[];function ns({matchedChildren:ss,componentAttributes:os,parentAttributes:ls}){let us=os.type;us||(us=ls.type),us?["number","letters","math","text","boolean"].includes(us)||(console.warn(`Invalid type ${us}, setting type to number`),us="number"):us="number";let cs=us==="letters"?"text":us;return cs!=="text"&&(ss=ss.filter(ds=>typeof ds!="string"||ds.trim()!=="")),{success:!0,newChildren:[{componentType:cs,children:ss}]}}return rs.push({replacementFunction:ns}),rs}static returnChildGroups(){return[{group:"anything",componentTypes:["_base"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.type={shadowVariable:!0,returnDependencies:()=>({type:{dependencyType:"doenetAttribute",attributeName:"type"},parentType:{dependencyType:"parentStateVariable",variableName:"type"}}),definition:function({dependencyValues:ns,componentName:ss}){let os=ns.type;return os||(os=ns.parentType),os?["number","letters","math","text","boolean"].includes(os)||(console.warn(`Invalid type ${os}, setting type to number`),os="number"):os="number",{setValue:{type:os}}}},rs.value={public:!0,shadowingInstructions:{hasVariableComponentType:!0},shadowVariable:!0,returnDependencies:()=>({type:{dependencyType:"stateVariable",variableName:"type"},atMostOneChild:{dependencyType:"child",childGroups:["anything"],variableNames:["value"]}}),definition({dependencyValues:ns}){let ss;return ns.atMostOneChild.length>0?ss=ns.atMostOneChild[0].stateValues.value:ns.type==="text"||ns.type==="letters"?ss="":ns.type==="boolean"?ss=!1:ns.type==="number"?ss=NaN:ss=Context.fromAst("_"),{setValue:{value:ss},setCreateComponentOfType:{value:ns.type}}},inverseDefinition({desiredStateVariableValues:ns,dependencyValues:ss}){return ss.atMostOneChild.length>0?{success:!0,instructions:[{setDependency:"atMostOneChild",desiredValue:ns.value,childIndex:0,variableIndex:0}]}:{success:!1}}},rs}}zs(ComponentWithSelectableType,"componentType","_componentWithSelectableType"),zs(ComponentWithSelectableType,"rendererType"),zs(ComponentWithSelectableType,"includeBlankStringChildren",!0);class ComponentListWithSelectableType extends ComponentWithSelectableType{static createAttributesObject(){let rs=super.createAttributesObject();return rs.type={createPrimitiveOfType:"string"},rs}static returnSugarInstructions(){let rs=[];return rs.push({replacementFunction:function({matchedChildren:ns,componentAttributes:ss,parentAttributes:os,isAttributeComponent:ls=!1,createdFromMacro:us=!1,componentInfoObjects:cs}){let ds=ss.type;ds||(ds=os.type),ds?["number","letters","math","text","boolean"].includes(ds)||(console.warn(`Invalid type ${ds}, setting type to number`),ds="number"):ds="number";let ps=ds==="letters"?"text":ds;return ls&&!us?returnGroupIntoComponentTypeSeparatedBySpaces({componentType:ps})({matchedChildren:ns}):returnBreakStringsIntoComponentTypeBySpaces({componentType:ps})({matchedChildren:ns})}}),rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return delete rs.value,rs.nValues={additionalStateVariablesDefined:["childForValue"],returnDependencies:()=>({anythingForSelectedType:{dependencyType:"child",childGroups:["anything"],variableNames:["nValues"],variablesOptional:!0}}),definition({dependencyValues:ns}){let ss=0,os=[];for(let[ls,us]of ns.anythingForSelectedType.entries()){let cs=Number.isInteger(us.stateValues.nValues)?us.stateValues.nValues:1;ss+=cs;for(let ds=0;ds({nValues:{dependencyType:"stateVariable",variableName:"nValues"}}),returnArraySize({dependencyValues:ns}){return[ns.nValues]},returnArrayDependenciesByKey({arrayKeys:ns,stateValues:ss}){let os={type:{dependencyType:"stateVariable",variableName:"type"}},ls={};for(let us of ns){let cs=ss.childForValue[us];ls[us]={anythingForSelectedType:{dependencyType:"child",childGroups:["anything"],variableNames:["value","values"],childIndices:[cs.child],variablesOptional:!0},valueIndex:{dependencyType:"value",value:cs.valueIndex}}}return{globalDependencies:os,dependenciesByKey:ls}},arrayDefinitionByKey({globalDependencyValues:ns,dependencyValuesByKey:ss,arrayKeys:os,componentName:ls}){let us={};for(let cs of os)if(ss[cs].anythingForSelectedType&&ss[cs].anythingForSelectedType.length===1){let ds=ss[cs].anythingForSelectedType[0],ps;ds.stateValues.values?ps=ds.stateValues.values[ss[cs].valueIndex]:ps=ds.stateValues.value,us[cs]=convertValueToType(ps,ns.type)}return{setValue:{values:us},setCreateComponentOfType:{values:ns.type}}}},rs}}zs(ComponentListWithSelectableType,"componentType","_componentListWithSelectableType"),zs(ComponentListWithSelectableType,"includeBlankStringChildren",!0),zs(ComponentListWithSelectableType,"removeBlankStringChildrenPostSugar",!0);class ComponentListOfListsWithSelectableType extends ComponentWithSelectableType{static createAttributesObject(){let rs=super.createAttributesObject();return rs.type={createPrimitiveOfType:"string"},rs}static returnSugarInstructions(){let rs=[],ns=function({matchedChildren:ss,componentAttributes:os,parentAttributes:ls}){let us=breakEmbeddedStringsIntoParensPieces({componentList:ss,removeParens:!0});if(us.success!==!0)return{success:!1};let cs=os.type;return cs||(cs=ls.type),cs?["number","letters","math","text","boolean"].includes(cs)||(console.warn(`Invalid type ${cs}, setting type to number`),cs="number"):cs="number",{success:!0,newChildren:us.pieces.map(ds=>({componentType:"_componentListWithSelectableType",attributes:{type:{primitive:cs}},children:ds}))}};return rs.push({replacementFunction:ns}),rs}static returnChildGroups(){return[{group:"lists",componentTypes:["_componentListWithSelectableType"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return delete rs.value,rs.nLists={returnDependencies:()=>({listChildren:{dependencyType:"child",childGroups:["lists"]}}),definition({dependencyValues:ns}){return{setValue:{nLists:ns.listChildren.length}}}},rs.lists={isArray:!0,entryPrefixes:["list"],returnArraySizeDependencies:()=>({nLists:{dependencyType:"stateVariable",variableName:"nLists"}}),returnArraySize({dependencyValues:ns}){return[ns.nLists]},returnArrayDependenciesByKey({arrayKeys:ns}){let ss={type:{dependencyType:"stateVariable",variableName:"type"}},os={};for(let ls of ns)os[ls]={listChildren:{dependencyType:"child",childGroups:["lists"],variableNames:["values","type"],childIndices:[ls]}};return{globalDependencies:ss,dependenciesByKey:os}},arrayDefinitionByKey({globalDependencyValues:ns,dependencyValuesByKey:ss,arrayKeys:os}){let ls={};for(let us of os)if(ss[us].listChildren&&ss[us].listChildren.length===1){let cs=ss[us].listChildren[0];cs.stateValues.type===ns.type?ls[us]=cs.stateValues.values:ls[us]=cs.stateValues.values.map(ds=>convertValueToType(ds,ns.type))}return{setValue:{lists:ls}}}},rs}}zs(ComponentListOfListsWithSelectableType,"componentType","_componentListOfListsWithSelectableType");function convertValueToType(as,rs){if(Array.isArray(as)&&(as=as[0]),rs==="number")return as instanceof Context.class?as.evaluate_to_constant():Number(as);if(rs==="math"){if(typeof as=="string")try{return Context.fromAst(textToAst.convert(as))}catch{}return convertValueToMathExpression(as)}else return rs==="boolean"?!!as:String(as)}const ComponentWithSelectableType$1=Object.freeze(Object.defineProperty({__proto__:null,ComponentListOfListsWithSelectableType,ComponentListWithSelectableType,ComponentWithSelectableType},Symbol.toStringTag,{value:"Module"}));var Ku;let SideBySide$1=(Ku=class extends BlockComponent{constructor(rs){super(rs),Object.assign(this.actions,{recordVisibilityChange:this.recordVisibilityChange.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.width={createComponentOfType:"_componentSize"},rs.widths={createComponentOfType:"_componentSizeList"},rs.margins={createComponentOfType:"_componentSizeList"},rs.valign={createComponentOfType:"text"},rs.valigns={createComponentOfType:"textList"},rs}static returnChildGroups(){return[{group:"blocks",componentTypes:["_block"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.nPanels={forRenderer:!0,returnDependencies:()=>({blockChildren:{dependencyType:"child",childGroups:["blocks"],skipComponentNames:!0}}),definition({dependencyValues:ns}){return{setValue:{nPanels:ns.blockChildren.length},checkForActualChange:{nPanels:!0}}}},rs.essentialWidths={isArray:!0,entryPrefixes:["essentialWidth"],defaultValueByArrayKey:()=>null,hasEssential:!0,returnArraySizeDependencies:()=>({nPanels:{dependencyType:"stateVariable",variableName:"nPanels"}}),returnArraySize({dependencyValues:ns}){return[ns.nPanels]},returnArrayDependenciesByKey:()=>({}),arrayDefinitionByKey({arrayKeys:ns}){let ss={};for(let os of ns)ss[os]=!0;return{useEssentialOrDefaultValue:{essentialWidths:ss}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ns}){let ss={};for(let os in ns.essentialWidths)ss[os]=ns.essentialWidths[os];return{success:!0,instructions:[{setEssentialValue:"essentialWidths",value:ss}]}}},rs.allWidthsSpecified={additionalStateVariablesDefined:["widthsAbsolute"],returnDependencies(){return{nPanels:{dependencyType:"stateVariable",variableName:"nPanels"},widthAttr:{dependencyType:"attributeComponent",attributeName:"width",variableNames:["componentSize"]},widthsAttr:{dependencyType:"attributeComponent",attributeName:"widths",variableNames:["nComponents","componentSizes"]},parentWidths:{dependencyType:"parentStateVariable",parentComponentType:"sbsGroup",variableName:"specifiedWidths"},parentWidthsAbsolute:{dependencyType:"parentStateVariable",parentComponentType:"sbsGroup",variableName:"widthsAbsolute"},essentialWidth:{dependencyType:"stateVariable",variableName:"essentialWidths"}}},definition({dependencyValues:ns}){let ss=[],os=null,ls,us=!1;ns.widthsAttr!==null?ls=ns.widthsAttr.stateValues.nComponents:ns.widthAttr!==null?(ls=ns.nPanels,us=!0):ls=0;for(let cs=0;csNumber.isFinite(cs)?cs:null),{setValue:{allWidthsSpecified:ss,widthsAbsolute:os}}}},rs.essentialMargins={isArray:!0,entryPrefixes:["essentialMargin"],hasEssential:!0,defaultValueByArrayKey:()=>null,returnArraySizeDependencies:()=>({}),returnArraySize(){return[2]},returnArrayDependenciesByKey:()=>({}),arrayDefinitionByKey({arrayKeys:ns}){let ss={};for(let os of ns)ss[os]=!0;return{useEssentialOrDefaultValue:{essentialMargins:ss}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ns}){let ss={};for(let os in ns.essentialMargins)ss[os]=ns.essentialMargins[os];return{success:!0,instructions:[{setEssentialValue:"essentialMargins",value:ss}]}}},rs.allMarginsSpecified={additionalStateVariablesDefined:["marginsAbsolute"],returnDependencies(){return{nPanels:{dependencyType:"stateVariable",variableName:"nPanels"},marginsAttr:{dependencyType:"attributeComponent",attributeName:"margins",variableNames:["nComponents","componentSizes"]},parentMargins:{dependencyType:"parentStateVariable",parentComponentType:"sbsGroup",variableName:"specifiedMargins"},parentMarginsAbsolute:{dependencyType:"parentStateVariable",parentComponentType:"sbsGroup",variableName:"marginsAbsolute"},essentialMargins:{dependencyType:"stateVariable",variableName:"essentialMargins"}}},definition({dependencyValues:ns}){let ss=[],os=null;if(ns.marginsAttr===null)if(ns.parentMargins){os=ns.parentMarginsAbsolute;for(let ls=0;ls<2;ls++)ns.essentialMargins[ls]===null?ss[ls]=ns.parentMargins[ls]:ss[ls]=ns.essentialMargins[ls]}else for(let ls=0;ls<2;ls++)ss[ls]=ns.essentialMargins[ls];else if(ns.marginsAttr.stateValues.nComponents===0)for(let ls=0;ls<2;ls++)ss[ls]=ns.essentialMargins[ls];else if(ns.marginsAttr.stateValues.nComponents===1){let ls=null;ns.marginsAttr.stateValues.componentSizes[0]&&(ls=ns.marginsAttr.stateValues.componentSizes[0].size,Number.isFinite(ls)||(ls=null),os=!!ns.marginsAttr.stateValues.componentSizes[0].isAbsolute),ss=[ls,ls]}else{ns.marginsAttr.stateValues.componentSizes[0]?os=!!ns.marginsAttr.stateValues.componentSizes[0].isAbsolute:os=!1;let ls;if(ns.marginsAttr.stateValues.componentSizes[1]?ls=!!ns.marginsAttr.stateValues.componentSizes[1].isAbsolute:ls=!1,ls!==os)throw Error("SideBySide is not implemented for absolute measurements");ss=ns.marginsAttr.stateValues.componentSizes.slice(0,2).map(us=>us&&Number.isFinite(us.size)?us.size:null)}return{setValue:{allMarginsSpecified:ss,marginsAbsolute:os}}}},rs.absoluteMeasurements={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},forRenderer:!0,returnDependencies:()=>({widthsAbsolute:{dependencyType:"stateVariable",variableName:"widthsAbsolute"},marginsAbsolute:{dependencyType:"stateVariable",variableName:"marginsAbsolute"}}),definition({dependencyValues:ns}){let ss;if(ns.widthsAbsolute===null)ns.marginsAbsolute===null?ss=!1:ss=ns.marginsAbsolute;else if(ns.marginsAbsolute===null)ss=ns.widthsAbsolute;else{if(ns.widthsAbsolute!==ns.marginsAbsolute)throw Error("SideBySide is not implemented for absolute measurements");ss=ns.widthsAbsolute}if(ss===!0)throw Error("SideBySide is not implemented for absolute measurements");return{setValue:{absoluteMeasurements:ss}}}},rs.allWidths={additionalStateVariablesDefined:["allMargins",{variableName:"gapWidth",public:!0,shadowingInstructions:{createComponentOfType:"number"},forRenderer:!0}],returnDependencies:()=>({nPanels:{dependencyType:"stateVariable",variableName:"nPanels"},allWidthsSpecified:{dependencyType:"stateVariable",variableName:"allWidthsSpecified"},allMarginsSpecified:{dependencyType:"stateVariable",variableName:"allMarginsSpecified"},absoluteMeasurements:{dependencyType:"stateVariable",variableName:"absoluteMeasurements"}}),definition({dependencyValues:ns}){let ss=0,os=[...ns.allWidthsSpecified],ls=[...ns.allMarginsSpecified],us=0,cs=0;for(let fs=0;fs=100){let fs=100/(us+ds);for(let hs=0;hs0){let fs=(100-(us+ds))/cs;for(let hs=0;hs0){let fs=(100-(us+ds))/(ps*ns.nPanels);for(let hs=0;hs<2;hs++)ls[hs]===null&&(ls[hs]=fs)}else ns.nPanels>1?ss=(100-(us+ds))/(ns.nPanels-1):ns.nPanels===1?ls[1]=100-(ls[0]+os[0]):console.warn("Invalid sideBySide, as it must have at least one block child");return{setValue:{allWidths:os,allMargins:ls,gapWidth:ss}}}},rs.widths={public:!0,isArray:!0,shadowingInstructions:{createComponentOfType:"number"},entryPrefixes:["width"],forRenderer:!0,returnArraySizeDependencies:()=>({nPanels:{dependencyType:"stateVariable",variableName:"nPanels"}}),returnArraySize({dependencyValues:ns}){return[ns.nPanels]},returnArrayDependenciesByKey({arrayKeys:ns}){let ss={allWidths:{dependencyType:"stateVariable",variableName:"allWidths"},widthsAttr:{dependencyType:"attributeComponent",attributeName:"widths",variableNames:["nComponents"]},widthAttr:{dependencyType:"attributeComponent",attributeName:"width",variableNames:["componentSize"]},absoluteMeasurements:{dependencyType:"stateVariable",variableName:"absoluteMeasurements"}},os={};for(let ls of ns){let us=Number(ls)+1;os[ls]={widthsAttr:{dependencyType:"attributeComponent",attributeName:"widths",variableNames:[`componentSize${us}`]},essentialWidth:{dependencyType:"stateVariable",variableName:`essentialWidth${us}`}}}return{globalDependencies:ss,dependenciesByKey:os}},arrayDefinitionByKey({globalDependencyValues:ns,arrayKeys:ss}){let os={};for(let ls of ss)os[ls]=ns.allWidths[ls];return{setValue:{widths:os}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ns,dependencyNamesByKey:ss,dependencyValuesByKey:os,globalDependencyValues:ls,arraySize:us}){let cs,ds=!1;ls.widthsAttr!==null?cs=ls.widthsAttr.stateValues.nComponents:ls.widthAttr!==null?(cs=us[0],ds=!0):cs=0;let ps=[];for(let fs in ns.widths)Number(fs)({}),returnArraySize(){return[2]},returnArrayDependenciesByKey({arrayKeys:ns}){let ss={allMargins:{dependencyType:"stateVariable",variableName:"allMargins"},marginsAttr:{dependencyType:"attributeComponent",attributeName:"margins",variableNames:["componentSize1","componentSize2","nComponents"]},absoluteMeasurements:{dependencyType:"stateVariable",variableName:"absoluteMeasurements"}},os={};for(let ls of ns){let us=Number(ls)+1;os[ls]={essentialMargin:{dependencyType:"stateVariable",variableName:`essentialMargin${us}`}}}return{globalDependencies:ss,dependenciesByKey:os}},arrayDefinitionByKey({globalDependencyValues:ns,arrayKeys:ss}){let os={};for(let ls of ss)os[ls]=ns.allMargins[ls];return{setValue:{margins:os}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ns,globalDependencyValues:ss,dependencyNamesByKey:os}){let ls=[];if(ss.marginsAttr===null)for(let us in ns.margins)ls.push({setDependency:os[us].essentialMargin,desiredValue:ns.margins[us]});else if(!(ss.marginsAttr.stateValues.componentSize1&&Number.isFinite(ss.marginsAttr.stateValues.componentSize1.size)))"0"in ns.margins?ls.push({setDependency:"marginsAttr",desiredValue:{size:ns.margins[0],isAbsolute:ss.absoluteMeasurements},variableIndex:0}):ls.push({setDependency:"marginsAttr",desiredValue:{size:ns.margins[1],isAbsolute:ss.absoluteMeasurements},variableIndex:0}),"1"in ns.margins&&ss.marginsAttr.stateValues.nComponents>1&&ls.push({setDependency:"marginsAttr",desiredValue:{size:ns.margins[1],isAbsolute:ss.absoluteMeasurements},variableIndex:1});else{let us=ss.marginsAttr.stateValues.nComponents===1;for(let cs in ns.margins)us?ls.push({setDependency:"marginsAttr",desiredValue:{size:ns.margins[cs],isAbsolute:ss.absoluteMeasurements},variableIndex:0}):ls.push({setDependency:"marginsAttr",desiredValue:{size:ns.margins[cs],isAbsolute:ss.absoluteMeasurements},variableIndex:cs})}return{success:!0,instructions:ls}}},rs.essentialValigns={isArray:!0,entryPrefixes:["essentialValign"],defaultValueByArrayKey:()=>null,hasEssential:!0,returnArraySizeDependencies:()=>({nPanels:{dependencyType:"stateVariable",variableName:"nPanels"}}),returnArraySize({dependencyValues:ns}){return[ns.nPanels]},returnArrayDependenciesByKey:()=>({}),arrayDefinitionByKey({arrayKeys:ns}){let ss={};for(let os of ns)ss[os]=!0;return{useEssentialOrDefaultValue:{essentialValigns:ss}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ns}){let ss={};for(let os in ns.essentialValigns)ss[os]=ns.essentialValigns[os];return{success:!0,instructions:[{setEssentialValue:"essentialValigns",value:ss}]}}},rs.valigns={public:!0,isArray:!0,shadowingInstructions:{createComponentOfType:"text"},entryPrefixes:["valign"],forRenderer:!0,returnArraySizeDependencies:()=>({nPanels:{dependencyType:"stateVariable",variableName:"nPanels"}}),returnArraySize({dependencyValues:ns}){return[ns.nPanels]},returnArrayDependenciesByKey({arrayKeys:ns}){let ss={valignAttr:{dependencyType:"attributeComponent",attributeName:"valign",variableNames:["value"]},valignsAttr:{dependencyType:"attributeComponent",attributeName:"valigns",variableNames:["nComponents"]}},os={};for(let ls of ns){let us=Number(ls)+1;os[ls]={valignsAttr:{dependencyType:"attributeComponent",attributeName:"valigns",variableNames:[`text${us}`]},parentValign:{dependencyType:"parentStateVariable",parentComponentType:"sbsGroup",variableName:`valign${us}`},parentValignAbsolute:{dependencyType:"parentStateVariable",parentComponentType:"sbsGroup",variableName:`valignAbsolute${us}`},essentialValign:{dependencyType:"stateVariable",variableName:`essentialValign${us}`}}}return{globalDependencies:ss,dependenciesByKey:os}},arrayDefinitionByKey({globalDependencyValues:ns,dependencyValuesByKey:ss,arrayKeys:os,arraySize:ls}){let us={},cs,ds=!1;ns.valignsAttr!==null?cs=ns.valignsAttr.stateValues.nComponents:ns.valignAttr!==null?(cs=ls[0],ds=!0):cs=0;for(let ps of os){let fs=Number(ps);if(fs({sideBySideChildren:{dependencyType:"child",childGroups:["sideBySides"],variableNames:["nPanels"]}}),definition({dependencyValues:ns}){return{setValue:{maxNPanelsPerRow:Context.math.max(ns.sideBySideChildren.map(ss=>ss.stateValues.nPanels))},checkForActualChange:{maxNPanelsPerRow:!0}}}},rs.specifiedWidths={additionalStateVariablesDefined:[{variableName:"widthsAbsoluteArray",isArray:!0}],isArray:!0,entryPrefixes:["specifiedWidth"],hasEssential:!0,defaultValueByArrayKey:()=>null,returnArraySizeDependencies:()=>({maxNPanelsPerRow:{dependencyType:"stateVariable",variableName:"maxNPanelsPerRow"}}),returnArraySize({dependencyValues:ns}){return[ns.maxNPanelsPerRow]},returnArrayDependenciesByKey({arrayKeys:ns}){let ss={widthAttr:{dependencyType:"attributeComponent",attributeName:"width",variableNames:["componentSize"]},widthsAttr:{dependencyType:"attributeComponent",attributeName:"widths",variableNames:["nComponents"]}},os={};for(let ls of ns){let us=Number(ls)+1;os[ls]={widthsAttr:{dependencyType:"attributeComponent",attributeName:"widths",variableNames:[`componentSize${us}`]}}}return{globalDependencies:ss,dependenciesByKey:os}},arrayDefinitionByKey({globalDependencyValues:ns,dependencyValuesByKey:ss,arrayKeys:os,arraySize:ls}){let us={},cs={},ds={},ps,fs=!1;ns.widthsAttr!==null?ps=ns.widthsAttr.stateValues.nComponents:ns.widthAttr!==null?(ps=ls[0],fs=!0):ps=0;for(let gs of os){let ys=Number(gs);if(ys0&&(hs.useEssentialOrDefaultValue={specifiedWidths:cs}),hs},inverseArrayDefinitionByKey({desiredStateVariableValues:ns,dependencyNamesByKey:ss,globalDependencyValues:os,stateValues:ls,arraySize:us}){let cs,ds=!1;os.widthsAttr!==null?cs=os.widthsAttr.stateValues.nComponents:os.widthAttr!==null?(cs=us[0],ds=!0):cs=0;let ps=[];for(let fs in ns.specifiedWidths)Number(fs)({widthsAbsoluteArray:{dependencyType:"stateVariable",variableName:"widthsAbsoluteArray"}}),definition({dependencyValues:ns}){let ss=null;for(let os in ns.widthsAbsoluteArray){let ls=ns.widthsAbsoluteArray[os];if(ls!==null){if(ls=!!ls,ss===null)ss=ls;else if(ss!==ls)throw Error("SbsGroup is not implemented for absolute measurements")}}return{setValue:{widthsAbsolute:ss}}}},rs.specifiedMargins={additionalStateVariablesDefined:[{variableName:"marginsAbsoluteArray",isArray:!0,entryPrefixes:["marginAbsolute"]}],isArray:!0,entryPrefixes:["specifiedMargin"],hasEssential:!0,defaultValueByArrayKey:()=>null,returnArraySizeDependencies:()=>({}),returnArraySize(){return[2]},returnArrayDependenciesByKey({arrayKeys:ns}){return{globalDependencies:{marginsAttr:{dependencyType:"attributeComponent",attributeName:"margins",variableNames:["componentSize1","componentSize2","nComponents"]}}}},arrayDefinitionByKey({dependencyValuesByKey:ns,globalDependencyValues:ss,arrayKeys:os}){let ls={},us={},cs={};if(ss.marginsAttr===null||ss.marginsAttr.stateValues.nComponents===0)for(let ps of os)us[ps]=!0,cs[ps]=null;else if(ss.marginsAttr.stateValues.nComponents===1){let ps=null,fs=null;ss.marginsAttr.stateValues.componentSize1&&(ps=ss.marginsAttr.stateValues.componentSize1.size,Number.isFinite(ps)||(ps=null),fs=!!ss.marginsAttr.stateValues.componentSize1.isAbsolute);for(let hs of os)ls[hs]=ps,cs[hs]=fs}else for(let ps of os)if(ss.marginsAttr.stateValues[`componentSize${Number(ps)+1}`]){let fs=ss.marginsAttr.stateValues[`componentSize${Number(ps)+1}`].size;Number.isFinite(fs)||(fs=null);let hs=!!ss.marginsAttr.stateValues[`componentSize${Number(ps)+1}`].isAbsolute;ls[ps]=fs,cs[ps]=hs}let ds={setValue:{marginsAbsoluteArray:cs,specifiedMargins:ls}};return Object.keys(us).length>0&&(ds.useEssentialOrDefaultValue={specifiedMargins:us}),ds},async inverseArrayDefinitionByKey({desiredStateVariableValues:ns,dependencyNamesByKey:ss,globalDependencyValues:os,stateValues:ls}){let us=[];if(os.marginsAttr===null)us.push({setEssentialValue:"specifiedMargins",value:ns.specifiedMargins});else if(!(os.marginsAttr.stateValues.componentSize1&&Number.isFinite(os.marginsAttr.stateValues.componentSize1.size)))"0"in ns.specifiedMargins?us.push({setDependency:"marginsAttr",desiredValue:{size:ns.specifiedMargins[0],isAbsolute:await ls.marginsAbsolute},variableIndex:0}):us.push({setDependency:"marginsAttr",desiredValue:{size:ns.specifiedMargins[1],isAbsolute:await ls.marginsAbsolute},variableIndex:0}),"1"in ns.specifiedMargins&&os.marginsAttr.stateValues.nComponents>1&&us.push({setDependency:"marginsAttr",desiredValue:{size:ns.specifiedMargins[1],isAbsolute:await ls.marginsAbsolute},variableIndex:1});else{let cs=os.marginsAttr.stateValues.nComponents===1;for(let ds in ns.specifiedMargins)cs?us.push({setDependency:"marginsAttr",desiredValue:{size:ns.specifiedMargins[ds],isAbsolute:await ls.marginsAbsolute},variableIndex:0}):us.push({setDependency:"marginsAttr",desiredValue:{size:ns.specifiedMargins[ds],isAbsolute:await ls.marginsAbsolute},variableIndex:ds})}return{success:!0,instructions:us}}},rs.marginsAbsolute={returnDependencies:()=>({marginsAbsoluteArray:{dependencyType:"stateVariable",variableName:"marginsAbsoluteArray"}}),definition({dependencyValues:ns}){let ss=null;for(let os in ns.marginsAbsoluteArray){let ls=ns.marginsAbsoluteArray[os];if(ls!==null){if(ls=!!ls,ss===null)ss=ls;else if(ss!==ls)throw Error("SbsGroup is not implemented for absolute measurements")}}return{setValue:{marginsAbsolute:ss}}}},rs.absoluteMeasurements={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},returnDependencies:()=>({widthsAbsolute:{dependencyType:"stateVariable",variableName:"widthsAbsolute"},marginsAbsolute:{dependencyType:"stateVariable",variableName:"marginsAbsolute"}}),definition({dependencyValues:ns}){let ss;if(ns.widthsAbsolute===null)ns.marginsAbsolute===null?ss=!1:ss=ns.marginsAbsolute;else if(ns.marginsAbsolute===null)ss=ns.widthsAbsolute;else{if(ns.widthsAbsolute!==ns.marginsAbsolute)throw Error("SbsGroup is not implemented for absolute measurements");ss=ns.widthsAbsolute}if(ss===!0)throw Error("SbsGroup is not implemented for absolute measurements");return{setValue:{absoluteMeasurements:ss}}}},rs.allWidths={additionalStateVariablesDefined:["allMargins",{variableName:"gapWidth",public:!0,shadowingInstructions:{createComponentOfType:"number"}}],returnDependencies:()=>({maxNPanelsPerRow:{dependencyType:"stateVariable",variableName:"maxNPanelsPerRow"},specifiedWidths:{dependencyType:"stateVariable",variableName:"specifiedWidths"},specifiedMargins:{dependencyType:"stateVariable",variableName:"specifiedMargins"},absoluteMeasurements:{dependencyType:"stateVariable",variableName:"absoluteMeasurements"}}),definition({dependencyValues:ns}){let ss=0,os=[...ns.specifiedWidths],ls=[...ns.specifiedMargins],us=0,cs=0;for(let fs=0;fs=100){let fs=100/(us+ds);for(let hs=0;hs0){let fs=(100-(us+ds))/cs;for(let hs=0;hs0){let fs=(100-(us+ds))/(ps*ns.maxNPanelsPerRow);for(let hs=0;hs<2;hs++)ls[hs]===null&&(ls[hs]=fs)}else ns.maxNPanelsPerRow>1?ss=(100-(us+ds))/(ns.maxNPanelsPerRow-1):ns.maxNPanelsPerRow===1?ls[1]=100-(ls[0]+os[0]):console.warn("Invalid sideBySide, as it must have at least one block child");return{setValue:{allWidths:os,allMargins:ls,gapWidth:ss}}}},rs.widths={public:!0,isArray:!0,shadowingInstructions:{createComponentOfType:"number"},entryPrefixes:["width"],returnArraySizeDependencies:()=>({maxNPanelsPerRow:{dependencyType:"stateVariable",variableName:"maxNPanelsPerRow"}}),returnArraySize({dependencyValues:ns}){return[ns.maxNPanelsPerRow]},returnArrayDependenciesByKey({arrayKeys:ns}){let ss={allWidths:{dependencyType:"stateVariable",variableName:"allWidths"}},os={};for(let ls of ns){let us=Number(ls)+1;os[ls]={specifiedWidth:{dependencyType:"stateVariable",variableName:`specifiedWidth${us}`}}}return{globalDependencies:ss,dependenciesByKey:os}},arrayDefinitionByKey({globalDependencyValues:ns,arrayKeys:ss}){let os={};for(let ls of ss)os[ls]=ns.allWidths[ls];return{setValue:{widths:os}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ns,dependencyNamesByKey:ss}){let os=[];for(let ls in ns.widths)os.push({setDependency:ss[ls].specifiedWidth,desiredValue:ns.widths[ls],variableIndex:0});return{success:!0,instructions:os}}},rs.margins={public:!0,isArray:!0,shadowingInstructions:{createComponentOfType:"number"},entryPrefixes:["margin"],returnArraySizeDependencies:()=>({}),returnArraySize(){return[2]},returnArrayDependenciesByKey({arrayKeys:ns}){let ss={allMargins:{dependencyType:"stateVariable",variableName:"allMargins"}},os={};for(let ls of ns){let us=Number(ls)+1;os[ls]={specifiedMargin:{dependencyType:"stateVariable",variableName:`specifiedMargin${us}`}}}return{globalDependencies:ss,dependenciesByKey:os}},arrayDefinitionByKey({globalDependencyValues:ns,arrayKeys:ss}){let os={};for(let ls of ss)os[ls]=ns.allMargins[ls];return{setValue:{margins:os}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ns,dependencyNamesByKey:ss}){let os=[];for(let ls in ns.margins)os.push({setDependency:ss[ls].specifiedMargin,desiredValue:ns.margins[ls],variableIndex:0});return{success:!0,instructions:os}}},rs.valigns={public:!0,isArray:!0,shadowingInstructions:{createComponentOfType:"text"},entryPrefixes:["valign"],hasEssential:!0,defaultValueByArrayKey:()=>"top",returnArraySizeDependencies:()=>({maxNPanelsPerRow:{dependencyType:"stateVariable",variableName:"maxNPanelsPerRow"}}),returnArraySize({dependencyValues:ns}){return[ns.maxNPanelsPerRow]},returnArrayDependenciesByKey({arrayKeys:ns}){let ss={valignAttr:{dependencyType:"attributeComponent",attributeName:"valign",variableNames:["value"]},valignsAttr:{dependencyType:"attributeComponent",attributeName:"valigns",variableNames:["nComponents"]}},os={};for(let ls of ns){let us=Number(ls)+1;os[ls]={valignsAttr:{dependencyType:"attributeComponent",attributeName:"valigns",variableNames:[`text${us}`]}}}return{globalDependencies:ss,dependenciesByKey:os}},arrayDefinitionByKey({globalDependencyValues:ns,dependencyValuesByKey:ss,arrayKeys:os,arraySize:ls}){let us={},cs={},ds,ps=!1;ns.valignsAttr!==null?ds=ns.valignsAttr.stateValues.nComponents:ns.valignAttr!==null?(ds=ls[0],ps=!0):ds=0;for(let hs of os){let gs=Number(hs);if(gs0&&(fs.setValue={valigns:us}),Object.keys(cs).length>0&&(fs.useEssentialOrDefaultValue={valigns:cs}),fs},inverseArrayDefinitionByKey({desiredStateVariableValues:ns,dependencyNamesByKey:ss,globalDependencyValues:os,arraySize:ls}){let us,cs=!1;os.valignsAttr!==null?us=os.valignsAttr.stateValues.nComponents:os.valignAttr!==null?(us=ls[0],cs=!0):us=0;let ds=[];for(let ps in ns.valigns){let fs=ns.valigns[ps].toLowerCase();if(!["top","middle","bottom"].includes(fs))continue;Number(ps)({stringTextChildren:{dependencyType:"child",childGroups:["stringsTexts"],variableNames:["value"]},hChildren:{dependencyType:"child",childGroups:["hs"],variableNames:["value"]}}),definition({dependencyValues:ns}){let ss;if(ns.hChildren.length>0)ss=ns.hChildren.map(os=>os.stateValues.value);else{let os="";for(let ls of ns.stringTextChildren)typeof ls=="string"?os+=ls:os+=ls.stateValues.value;ss=[os]}return{setValue:{terms:ss}}}},rs}}zs(Idx,"componentType","idx"),zs(Idx,"rendererType");const Indexing=Object.freeze(Object.defineProperty({__proto__:null,H:H$2,Idx},Symbol.toStringTag,{value:"Module"}));class Div extends BlockComponent{constructor(rs){super(rs),Object.assign(this.actions,{recordVisibilityChange:this.recordVisibilityChange.bind(this)})}static returnChildGroups(){return[{group:"anything",componentTypes:["_base"]}]}recordVisibilityChange({isVisible:rs,actionId:ns}){this.coreFunctions.requestRecordEvent({verb:"visibilityChanged",object:{componentName:this.componentName,componentType:this.componentType},result:{isVisible:rs}}),this.coreFunctions.resolveAction({actionId:ns})}}zs(Div,"componentType","div"),zs(Div,"rendererType","containerBlock"),zs(Div,"renderChildren",!0);class Span extends InlineComponent{static returnChildGroups(){return[{group:"anything",componentTypes:["_base"]}]}}zs(Span,"componentType","span"),zs(Span,"rendererType","containerInline"),zs(Span,"renderChildren",!0);const Divisions=Object.freeze(Object.defineProperty({__proto__:null,Div,Span},Symbol.toStringTag,{value:"Module"}));class Pre extends BlockComponent{constructor(rs){super(rs),Object.assign(this.actions,{recordVisibilityChange:this.recordVisibilityChange.bind(this)})}static returnChildGroups(){return[{group:"allChildren",componentTypes:["_base"]}]}recordVisibilityChange({isVisible:rs,actionId:ns}){this.coreFunctions.requestRecordEvent({verb:"visibilityChanged",object:{componentName:this.componentName,componentType:this.componentType},result:{isVisible:rs}}),this.coreFunctions.resolveAction({actionId:ns})}}zs(Pre,"componentType","pre"),zs(Pre,"renderChildren",!0),zs(Pre,"includeBlankStringChildren",!0);class DisplayDoenetML extends BlockComponent{constructor(rs){super(rs),Object.assign(this.actions,{recordVisibilityChange:this.recordVisibilityChange.bind(this)})}static returnChildGroups(){return[{group:"allChildren",componentTypes:["_base"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.value={returnDependencies:()=>({childrenDoenetML:{dependencyType:"doenetML",displayOnlyChildren:!0}}),definition({dependencyValues:ns}){return{setValue:{value:ns.childrenDoenetML}}}},rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},forRenderer:!0,returnDependencies:()=>({value:{dependencyType:"stateVariable",variableName:"value"}}),definition:({dependencyValues:ns})=>({setValue:{text:ns.value}})},rs}recordVisibilityChange({isVisible:rs,actionId:ns}){this.coreFunctions.requestRecordEvent({verb:"visibilityChanged",object:{componentName:this.componentName,componentType:this.componentType},result:{isVisible:rs}}),this.coreFunctions.resolveAction({actionId:ns})}}zs(DisplayDoenetML,"componentType","displayDoenetML"),zs(DisplayDoenetML,"rendererType","text"),zs(DisplayDoenetML,"includeBlankStringChildren",!0);const Verbatim=Object.freeze(Object.defineProperty({__proto__:null,DisplayDoenetML,Pre},Symbol.toStringTag,{value:"Module"}));class Paginator extends BlockComponent{constructor(rs){super(rs),Object.assign(this.actions,{setPage:this.setPage.bind(this),recordVisibilityChange:this.recordVisibilityChange.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.initialPage={createComponentOfType:"integer",createStateVariable:"initialPage",defaultValue:1},rs}static returnChildGroups(){return[{group:"anything",componentTypes:["_base"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.nPages={public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies:()=>({children:{dependencyType:"child",childGroups:["anything"]}}),definition({dependencyValues:ns}){return{setValue:{nPages:ns.children.length}}}},rs.currentPage={public:!0,shadowingInstructions:{createComponentOfType:"integer"},hasEssential:!0,returnDependencies:()=>({initialPage:{dependencyType:"stateVariable",variableName:"initialPage"},nPages:{dependencyType:"stateVariable",variableName:"nPages"}}),definition({dependencyValues:ns}){return{useEssentialOrDefaultValue:{currentPage:{get defaultValue(){let ss=ns.initialPage;return Number.isInteger(ss)?Math.max(1,Math.min(ns.nPages,ss)):1}}}}},async inverseDefinition({desiredStateVariableValues:ns,stateValues:ss,sourceDetails:os={}}){if(!os.fromSetPage)return{success:!1};let ls=Number(ns.currentPage);return Number.isInteger(ls)?(ls=Math.max(1,Math.min(await ss.nPages,ls)),{success:!0,instructions:[{setEssentialValue:"currentPage",value:ls}]}):{success:!1}}},rs.childIndicesToRender={returnDependencies:()=>({currentPage:{dependencyType:"stateVariable",variableName:"currentPage"}}),definition({dependencyValues:ns}){return{setValue:{childIndicesToRender:[ns.currentPage-1]}}},markStale:()=>({updateRenderedChildren:!0})},rs}async setPage({number:rs,actionId:ns,sourceInformation:ss={},skipRendererUpdate:os=!1}){if(!Number.isInteger(rs)){this.coreFunctions.resolveAction({actionId:ns});return}let ls=Math.max(1,Math.min(await this.stateValues.nPages,rs)),us=[{updateType:"updateValue",componentName:this.componentName,stateVariable:"currentPage",value:ls,sourceDetails:{fromSetPage:!0}}];await this.coreFunctions.performUpdate({updateInstructions:us,actionId:ns,sourceInformation:ss,skipRendererUpdate:os,event:{verb:"selected",object:{componentName:this.componentName,componentType:this.componentType},result:{response:ls,responseText:ls.toString()}}})}recordVisibilityChange({isVisible:rs,actionId:ns}){this.coreFunctions.requestRecordEvent({verb:"visibilityChanged",object:{componentName:this.componentName,componentType:this.componentType},result:{isVisible:rs}}),this.coreFunctions.resolveAction({actionId:ns})}}zs(Paginator,"componentType","paginator"),zs(Paginator,"rendererType","containerBlock"),zs(Paginator,"renderChildren",!0);class PaginatorControls extends BlockComponent{constructor(rs){super(rs),this.externalActions={},Object.defineProperty(this.externalActions,"setPage",{enumerable:!0,get:async function(){let ns=await this.stateValues.paginatorComponentName;if(ns)return{componentName:ns,actionName:"setPage"}}.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.previousLabel={createComponentOfType:"text",createStateVariable:"previousLabel",defaultValue:"Previous",forRenderer:!0,public:!0},rs.nextLabel={createComponentOfType:"text",createStateVariable:"nextLabel",defaultValue:"Next",forRenderer:!0,public:!0},rs.pageLabel={createComponentOfType:"text",createStateVariable:"pageLabel",defaultValue:"Page",forRenderer:!0,public:!0},rs.paginator={createTargetComponentNames:!0},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.paginatorComponentName={returnDependencies:()=>({paginator:{dependencyType:"attributeTargetComponentNames",attributeName:"paginator"}}),definition({dependencyValues:ns}){var os;let ss;return((os=ns.paginator)==null?void 0:os.length)===1?ss=ns.paginator[0].absoluteName:ss=null,{setValue:{paginatorComponentName:ss}}}},rs.currentPage={forRenderer:!0,stateVariablesDeterminingDependencies:["paginatorComponentName"],returnDependencies({stateValues:ns}){return ns.paginatorComponentName?{paginatorPage:{dependencyType:"stateVariable",componentName:ns.paginatorComponentName,variableName:"currentPage"}}:{}},definition({dependencyValues:ns}){return"paginatorPage"in ns?{setValue:{currentPage:ns.paginatorPage}}:{setValue:{currentPage:1}}}},rs.nPages={forRenderer:!0,stateVariablesDeterminingDependencies:["paginatorComponentName"],returnDependencies({stateValues:ns}){return ns.paginatorComponentName?{paginatorNPages:{dependencyType:"stateVariable",componentName:ns.paginatorComponentName,variableName:"nPages"}}:{}},definition({dependencyValues:ns}){return"paginatorNPages"in ns?{setValue:{nPages:ns.paginatorNPages}}:{setValue:{nPages:1}}}},rs}}zs(PaginatorControls,"componentType","paginatorControls"),zs(PaginatorControls,"renderChildren",!0);const Paginator$1=Object.freeze(Object.defineProperty({__proto__:null,Paginator,PaginatorControls},Symbol.toStringTag,{value:"Module"}));class Input extends InlineComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.collaborateGroups={createComponentOfType:"collaborateGroups",createStateVariable:"collaborateGroups",defaultValue:null,public:!0},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.nValues={returnDependencies:()=>({}),definition:()=>({setValue:{nValues:1}})},rs.answerAncestor={returnDependencies:()=>({answerAncestor:{dependencyType:"ancestor",componentType:"answer",variableNames:["delegateCheckWorkToInput","justSubmitted","creditAchieved","showCorrectness","numberOfAttemptsLeft"]}}),definition:function({dependencyValues:ns}){return{setValue:{answerAncestor:ns.answerAncestor}}}},rs.includeCheckWork={forRenderer:!0,returnDependencies:()=>({answerAncestor:{dependencyType:"stateVariable",variableName:"answerAncestor"}}),definition:function({dependencyValues:ns}){let ss=!1;return ns.answerAncestor&&(ss=ns.answerAncestor.stateValues.delegateCheckWorkToInput),{setValue:{includeCheckWork:ss}}}},rs.suppressCheckwork={forRenderer:!0,returnDependencies:()=>({autoSubmit:{dependencyType:"flag",flagName:"autoSubmit"}}),definition({dependencyValues:ns}){return{setValue:{suppressCheckwork:ns.autoSubmit}}}},rs.creditAchieved={defaultValue:0,public:!0,shadowingInstructions:{createComponentOfType:"number"},forRenderer:!0,returnDependencies:()=>({answerAncestor:{dependencyType:"stateVariable",variableName:"answerAncestor"}}),definition:function({dependencyValues:ns}){let ss=0;return ns.answerAncestor&&(ss=ns.answerAncestor.stateValues.creditAchieved),{setValue:{creditAchieved:ss}}}},rs.valueHasBeenValidated={forRenderer:!0,returnDependencies:()=>({answerAncestor:{dependencyType:"stateVariable",variableName:"answerAncestor"}}),definition:function({dependencyValues:ns}){let ss=!1;return ns.answerAncestor&&ns.answerAncestor.stateValues.justSubmitted&&(ss=!0),{setValue:{valueHasBeenValidated:ss}}}},rs.showCorrectness={forRenderer:!0,returnDependencies:()=>({showCorrectnessFlag:{dependencyType:"flag",flagName:"showCorrectness"},answerAncestor:{dependencyType:"stateVariable",variableName:"answerAncestor"}}),definition({dependencyValues:ns}){let ss;return ns.answerAncestor?ss=ns.answerAncestor.stateValues.showCorrectness:ss=ns.showCorrectnessFlag!==!1,{setValue:{showCorrectness:ss}}}},rs.numberOfAttemptsLeft={forRenderer:!0,returnDependencies:()=>({answerAncestor:{dependencyType:"stateVariable",variableName:"answerAncestor"}}),definition({dependencyValues:ns}){let ss;return ns.answerAncestor?ss=ns.answerAncestor.stateValues.numberOfAttemptsLeft:ss=1/0,{setValue:{numberOfAttemptsLeft:ss}}}},rs}}zs(Input,"componentType","_input");class MatrixInput extends Input{constructor(rs){super(rs),Object.assign(this.actions,{updateNumRows:this.updateNumRows.bind(this),updateNumColumns:this.updateNumColumns.bind(this)}),this.externalActions={},Object.defineProperty(this.externalActions,"submitAnswer",{enumerable:!0,get:async function(){let ns=await this.stateValues.answerAncestor;if(ns!==null)return{componentName:ns.componentName,actionName:"submitAnswer"}}.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.numRows={createComponentOfType:"integer",createStateVariable:"numRowsPreliminary",defaultValue:1,transformNonFiniteTo:0},rs.numColumns={createComponentOfType:"integer",createStateVariable:"numColumnsPreliminary",defaultValue:1,transformNonFiniteTo:0},rs.showSizeControls={createComponentOfType:"boolean",createStateVariable:"showSizeControls",defaultValue:!0,public:!0,forRenderer:!0},rs.defaultEntry={createComponentOfType:"math",createStateVariable:"defaultEntry",defaultValue:Context.fromAst("_")},rs.prefill={createComponentOfType:"math",createStateVariable:"prefill",defaultValue:Context.fromAst("_"),public:!0,copyComponentAttributesForCreatedComponent:["format","functionSymbols","splitSymbols","parseScientificNotation"]},rs.format={createComponentOfType:"text",createStateVariable:"format",defaultValue:"text",public:!0},rs.functionSymbols={createComponentOfType:"textList",createStateVariable:"functionSymbols",defaultValue:["f","g"],public:!0},rs.splitSymbols={createComponentOfType:"boolean",createStateVariable:"splitSymbols",defaultValue:!0,public:!0},rs.parseScientificNotation={createComponentOfType:"boolean",createStateVariable:"parseScientificNotation",defaultValue:!1,public:!0},rs.displayDigits={createComponentOfType:"integer",createStateVariable:"displayDigits",defaultValue:10,public:!0},rs.displayDecimals={createComponentOfType:"integer",createStateVariable:"displayDecimals",defaultValue:null,public:!0},rs.displaySmallAsZero={createComponentOfType:"number",createStateVariable:"displaySmallAsZero",valueForTrue:1e-14,valueForFalse:0,defaultValue:0,public:!0},rs.bindValueTo={createComponentOfType:"math"},rs.unionFromU={createComponentOfType:"boolean",createStateVariable:"unionFromU",defaultValue:!1,public:!0},rs}static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=function({matchedChildren:ss,componentAttributes:os}){return ss.length>0?{success:!1}:{success:!0,newChildren:[{componentType:"matrixInputGrid"}]}};return rs.push({replacementFunction:ns}),rs}static returnChildGroups(){return[{group:"matrixComponentInputs",componentTypes:["matrixComponentInput"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.valueOriginal={hasEssential:!0,shadowVariable:!0,returnDependencies:()=>({bindValueTo:{dependencyType:"attributeComponent",attributeName:"bindValueTo",variableNames:["value"]},prefill:{dependencyType:"stateVariable",variableName:"prefill"}}),set:convertValueToMathExpression,definition:function({dependencyValues:ns}){return ns.bindValueTo?{setValue:{valueOriginal:ns.bindValueTo.stateValues.value}}:{useEssentialOrDefaultValue:{valueOriginal:{defaultValue:ns.prefill}}}},inverseDefinition:function({desiredStateVariableValues:ns,dependencyValues:ss}){return ss.bindValueTo?{success:!0,instructions:[{setDependency:"bindValueTo",desiredValue:ns.valueOriginal,variableIndex:0}]}:{success:!0,instructions:[{setEssentialValue:"valueOriginal",value:ns.valueOriginal}]}}},rs.immediateValueOriginal={hasEssential:!0,shadowVariable:!0,returnDependencies:()=>({valueOriginal:{dependencyType:"stateVariable",variableName:"valueOriginal"}}),set:convertValueToMathExpression,definition:function({dependencyValues:ns,changes:ss,justUpdatedForNewComponent:os}){return ss.valueOriginal&&!os?{setValue:{immediateValueOriginal:ns.valueOriginal},setEssentialValue:{immediateValueOriginal:ns.valueOriginal}}:{useEssentialOrDefaultValue:{immediateValueOriginal:{defaultValue:ns.valueOriginal}}}},inverseDefinition:function({desiredStateVariableValues:ns,initialChange:ss,shadowedVariable:os}){let ls=[{setEssentialValue:"immediateValueOriginal",value:ns.immediateValueOriginal}];return ss||os||ls.push({setDependency:"valueOriginal",desiredValue:ns.immediateValueOriginal}),{success:!0,instructions:ls}}},rs.haveBoundValue={returnDependencies:()=>({bindValueTo:{dependencyType:"attributeComponent",attributeName:"bindValueTo"}}),definition({dependencyValues:ns}){return{setValue:{haveBoundValue:ns.bindValueTo!==null}}}},rs.numRows={public:!0,shadowingInstructions:{createComponentOfType:"integer"},forRenderer:!0,returnDependencies:()=>({numRowsPreliminary:{dependencyType:"stateVariable",variableName:"numRowsPreliminary"},valueOriginal:{dependencyType:"stateVariable",variableName:"valueOriginal"},haveBoundValue:{dependencyType:"stateVariable",variableName:"haveBoundValue"}}),definition({dependencyValues:ns,usedDefault:ss}){let os=ns.numRowsPreliminary;if(ss.numRowsPreliminary||ns.haveBoundValue){let ls=ns.valueOriginal.tree;if(os=1,Array.isArray(ls)){let us=ls[0];us==="matrix"?os=ls[1][1]:vectorOperators.includes(us)&&(os=ls.length-1)}}return{setValue:{numRows:os}}},async inverseDefinition({desiredStateVariableValues:ns,dependencyValues:ss,stateValues:os}){let ls=ns.numRows;if(!Number.isInteger(ls))return{success:!1};ls=Math.max(0,ls);let us=[{setDependency:"numRowsPreliminary",desiredValue:ls}];if(ss.haveBoundValue){let cs=ss.valueOriginal.tree,ds=(await os.defaultEntry).tree;if(await os.numColumns===1&&Array.isArray(cs)&&vectorOperators.includes(cs[0])){let ps=cs.length-1;if(lsps){let fs=deepClone(cs),hs=await os.accumulatedComponents;for(let gs=ps;gs({numColumnsPreliminary:{dependencyType:"stateVariable",variableName:"numColumnsPreliminary"},valueOriginal:{dependencyType:"stateVariable",variableName:"valueOriginal"},haveBoundValue:{dependencyType:"stateVariable",variableName:"haveBoundValue"}}),definition({dependencyValues:ns,usedDefault:ss}){let os=ns.numColumnsPreliminary;if(ss.numColumnsPreliminary||ns.haveBoundValue){let ls=ns.valueOriginal.tree;if(os=1,Array.isArray(ls)){let us=ls[0];us==="matrix"?os=ls[1][2]:Array.isArray(ls[1])&&vectorOperators.includes(ls[1][0])&&(us==="^"&&ls[2]==="T"||us==="prime")&&(os=ls[1].length-1)}}return{setValue:{numColumns:os}}},async inverseDefinition({desiredStateVariableValues:ns,dependencyValues:ss,stateValues:os}){let ls=ns.numColumns;if(!Number.isInteger(ls))return{success:!1};ls=Math.max(0,ls);let us=[{setDependency:"numColumnsPreliminary",desiredValue:ls}];if(ss.haveBoundValue){let cs=(await os.defaultEntry).tree,ds=ss.valueOriginal.tree,ps=ds[0];if(Array.isArray(ds[1])&&vectorOperators.includes(ds[1][0])&&(ps==="^"&&ds[2]==="T"||ps==="prime")){let fs=ds[1].length-1;if(lsfs){let hs=deepClone(ds),gs=(await os.accumulatedComponents)[0];gs||(gs=[]);for(let ys=fs;ys({valueOriginal:{dependencyType:"stateVariable",variableName:"valueOriginal"}}),definition({dependencyValues:ns,previousValues:ss}){let os=[];ss.accumulatedComponents&&(os=deepClone(ss.accumulatedComponents));let ls=ns.valueOriginal.tree;if(Array.isArray(ls)){let cs=ls[0];if(cs==="matrix"){let ds=ls[2];for(let[ps,fs]of ds.slice(1).entries()){let hs=os[ps];hs||(hs=os[ps]=[]);for(let[gs,ys]of fs.slice(1).entries())hs[gs]=ys}return{setValue:{accumulatedComponents:os}}}else if(vectorOperators.includes(cs)){for(let[ds,ps]of ls.slice(1).entries()){let fs=os[ds];fs||(fs=os[ds]=[]),fs[0]=ps}return{setValue:{accumulatedComponents:os}}}else if(Array.isArray(ls[1])&&vectorOperators.includes(ls[1][0])&&(cs==="^"&&ls[2]==="T"||cs==="prime")){let ds=os[0];ds||(ds=os[0]=[]);for(let[ps,fs]of ls[1].slice(1).entries())ds[ps]=fs;return{setValue:{accumulatedComponents:os}}}}let us=os[0];return us||(us=os[0]=[]),us[0]=ls,{setValue:{accumulatedComponents:os}}}},rs.componentValues={isArray:!0,entryPrefixes:["componentValue"],nDimensions:2,returnArraySizeDependencies:()=>({numRows:{dependencyType:"stateVariable",variableName:"numRows"},numColumns:{dependencyType:"stateVariable",variableName:"numColumns"}}),returnArraySize({dependencyValues:ns}){return[ns.numRows,ns.numColumns]},returnArrayDependenciesByKey(){return{globalDependencies:{valueOriginal:{dependencyType:"stateVariable",variableName:"valueOriginal"},numRows:{dependencyType:"stateVariable",variableName:"numRows"},numColumns:{dependencyType:"stateVariable",variableName:"numColumns"},accumulatedComponents:{dependencyType:"stateVariable",variableName:"accumulatedComponents"},defaultEntry:{dependencyType:"stateVariable",variableName:"defaultEntry"}}}},arrayDefinitionByKey({globalDependencyValues:ns,arrayKeys:ss}){let os=ns.valueOriginal.tree,ls=ns.accumulatedComponents,us=ns.numRows,cs=ns.numColumns;if(Array.isArray(os)){let ps=os[0];if(ps==="matrix"){if(os[1][1]===us&&os[1][2]===cs){let xs={},Cs=os[2];for(let Ts=0;Tshs)for(let xs=0;xsfs)for(let xs=fs;xs[...ys]);else{let ys=ss.valueOriginal.tree;if(ds){if(gs=ys.slice(1,1+us).map(bs=>[bs]),gs.length1)for(let bs=0;bs1)for(let bs=1;bsbs.slice(1,cs+1)),gs[0].length1&&gs[0].push(...Array(cs-1).fill("_")),us>1)for(let bs=1;bsvs[0])]),treatAsInitialChange:os}]}}else if(us===1&&ps){let ys=ss.valueOriginal.tree,bs=ys[0],vs=[ys[1][0],...gs[0]];return bs==="^"?vs=Context.fromAst(["^",vs,"T"]):vs=Context.fromAst(["prime",vs]),{success:!0,instructions:[{setDependency:"valueOriginal",desiredValue:vs,treatAsInitialChange:os}]}}else{let ys=["matrix",["tuple",ss.numRows,ss.numColumns],["tuple",...gs.map(bs=>["tuple",...bs])]];return{success:!0,instructions:[{setDependency:"valueOriginal",desiredValue:Context.fromAst(ys),treatAsInitialChange:os}]}}}},rs.componentImmediateValues={isArray:!0,entryPrefixes:["componentImmediateValue"],nDimensions:2,returnArraySizeDependencies:()=>({numRows:{dependencyType:"stateVariable",variableName:"numRows"},numColumns:{dependencyType:"stateVariable",variableName:"numColumns"}}),returnArraySize({dependencyValues:ns}){return[ns.numRows,ns.numColumns]},returnArrayDependenciesByKey(){return{globalDependencies:{immediateValueOriginal:{dependencyType:"stateVariable",variableName:"immediateValueOriginal"},numRows:{dependencyType:"stateVariable",variableName:"numRows"},numColumns:{dependencyType:"stateVariable",variableName:"numColumns"},accumulatedComponents:{dependencyType:"stateVariable",variableName:"accumulatedComponents"},defaultEntry:{dependencyType:"stateVariable",variableName:"defaultEntry"}}}},arrayDefinitionByKey({globalDependencyValues:ns,arrayKeys:ss}){let os=ns.immediateValueOriginal.tree,ls=ns.accumulatedComponents,us=ns.numRows,cs=ns.numColumns;if(Array.isArray(os)){let ps=os[0];if(ps==="matrix"){if(os[1][1]===us&&os[1][2]===cs){let xs={},Cs=os[2];for(let Ts=0;Tshs)for(let xs=0;xsfs)for(let xs=fs;xs[...ys]);else{let ys=ss.immediateValueOriginal.tree;if(ds){if(gs=ys.slice(1,1+us).map(bs=>[bs]),gs.length1)for(let bs=0;bs1)for(let bs=1;bsbs.slice(1,cs+1)),gs[0].length1&&gs[0].push(...Array(cs-1).fill("_")),us>1)for(let bs=1;bsvs[0])]),treatAsInitialChange:os}]}}else if(us===1&&ps){let ys=ss.immediateValueOriginal.tree,bs=ys[0],vs=[ys[1][0],...gs[0]];return bs==="^"?vs=Context.fromAst(["^",vs,"T"]):vs=Context.fromAst(["prime",vs]),{success:!0,instructions:[{setDependency:"immediateValueOriginal",desiredValue:vs,treatAsInitialChange:os}]}}else{let ys=["matrix",["tuple",ss.numRows,ss.numColumns],["tuple",...gs.map(bs=>["tuple",...bs])]];return{success:!0,instructions:[{setDependency:"immediateValueOriginal",desiredValue:Context.fromAst(ys),treatAsInitialChange:os}]}}}},rs.componentValuesForDisplay={isArray:!0,entryPrefixes:["componentValueForDisplay"],nDimensions:2,forRenderer:!0,returnArraySizeDependencies:()=>({numRows:{dependencyType:"stateVariable",variableName:"numRows"},numColumns:{dependencyType:"stateVariable",variableName:"numColumns"}}),returnArraySize({dependencyValues:ns}){return[ns.numRows,ns.numColumns]},returnArrayDependenciesByKey({arrayKeys:ns}){let ss={displayDigits:{dependencyType:"stateVariable",variableName:"displayDigits"},displayDecimals:{dependencyType:"stateVariable",variableName:"displayDecimals"},displaySmallAsZero:{dependencyType:"stateVariable",variableName:"displaySmallAsZero"}},os={};for(let ls of ns){let[us,cs]=ls.split(","),ds=Number(us)+1+"_"+(Number(cs)+1);os[ls]={componentValue:{dependencyType:"stateVariable",variableName:`componentValue${ds}`}}}return{globalDependencies:ss,dependenciesByKey:os}},arrayDefinitionByKey({globalDependencyValues:ns,dependencyValuesByKey:ss,arrayKeys:os,usedDefault:ls}){let us={};for(let cs of os){let ds=roundForDisplay({value:ss[cs].componentValue,dependencyValues:ns,usedDefault:ls});us[cs]=ds}return{setValue:{componentValuesForDisplay:us}}}},rs.value={public:!0,shadowingInstructions:{createComponentOfType:"math",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero"]},returnDependencies:()=>({componentValues:{dependencyType:"stateVariable",variableName:"componentValues"},numRows:{dependencyType:"stateVariable",variableName:"numRows"},numColumns:{dependencyType:"stateVariable",variableName:"numColumns"},valueOriginal:{dependencyType:"stateVariable",variableName:"valueOriginal"}}),definition({dependencyValues:ns}){let ss=ns.numRows,os=ns.numColumns,ls=["matrix",["tuple",ss,os]],us=ls[2]=["tuple"];for(let cs=0;csds[1])])}]}}}else if(ss.numRows===1){let ls=ss.valueOriginal.tree;if(Array.isArray(ls)){let us=ls[0];if(Array.isArray(ls[1])&&vectorOperators.includes(ls[1][0])&&(us==="^"&&ls[2]==="T"||us==="prime")){let cs=[ls[1][0],...os[2][1].slice(1)];return us==="^"?cs=Context.fromAst(["^",cs,"T"]):cs=Context.fromAst(["prime",cs]),{success:!0,instructions:[{setDependency:"valueOriginal",desiredValue:cs}]}}}}return{success:!0,instructions:[{setDependency:"valueOriginal",desiredValue:ns.value}]}}else return{success:!1}}},rs.immediateValue={public:!0,shadowingInstructions:{createComponentOfType:"math",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero"]},returnDependencies:()=>({componentImmediateValues:{dependencyType:"stateVariable",variableName:"componentImmediateValues"},numRows:{dependencyType:"stateVariable",variableName:"numRows"},numColumns:{dependencyType:"stateVariable",variableName:"numColumns"},immediateValueOriginal:{dependencyType:"stateVariable",variableName:"immediateValueOriginal"}}),definition({dependencyValues:ns}){let ss=ns.numRows,os=ns.numColumns,ls=["matrix",["tuple",ss,os]],us=ls[2]=["tuple"];for(let cs=0;csds[1])])}]}}}else if(ss.numRows===1){let ls=ss.immediateValueOriginal.tree;if(Array.isArray(ls)){let us=ls[0];if(Array.isArray(ls[1])&&vectorOperators.includes(ls[1][0])&&(us==="^"&&ls[2]==="T"||us==="prime")){let cs=[ls[1][0],...os[2][1].slice(1)];return us==="^"?cs=Context.fromAst(["^",cs,"T"]):cs=Context.fromAst(["prime",cs]),{success:!0,instructions:[{setDependency:"immediateValueOriginal",desiredValue:cs}]}}}}return{success:!0,instructions:[{setDependency:"immediateValueOriginal",desiredValue:ns.immediateValue}]}}else return{success:!1}}},rs.valueForDisplay={forRenderer:!0,returnDependencies:()=>({value:{dependencyType:"stateVariable",variableName:"value"},displayDigits:{dependencyType:"stateVariable",variableName:"displayDigits"},displayDecimals:{dependencyType:"stateVariable",variableName:"displayDecimals"},displaySmallAsZero:{dependencyType:"stateVariable",variableName:"displaySmallAsZero"}}),definition:function({dependencyValues:ns,usedDefault:ss}){return{setValue:{valueForDisplay:roundForDisplay({value:ns.value,dependencyValues:ns,usedDefault:ss})}}}},rs.componentType={returnDependencies:()=>({}),definition:()=>({setValue:{componentType:"matrix"}})},rs}async updateNumRows({numRows:rs,actionId:ns,sourceInformation:ss={},skipRendererUpdate:os=!1}){if(await this.stateValues.disabled)this.coreFunctions.resolveAction({actionId:ns});else return await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"numRows",value:rs}],actionId:ns,sourceInformation:ss,skipRendererUpdate:os})}async updateNumColumns({numColumns:rs,actionId:ns,sourceInformation:ss={},skipRendererUpdate:os=!1}){if(await this.stateValues.disabled)this.coreFunctions.resolveAction({actionId:ns});else return await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"numColumns",value:rs}],actionId:ns,sourceInformation:ss,skipRendererUpdate:os})}}zs(MatrixInput,"componentType","matrixInput"),zs(MatrixInput,"variableForPlainMacro","value"),zs(MatrixInput,"variableForPlainCopy","value"),zs(MatrixInput,"processWhenJustUpdatedForNewComponent",!0),zs(MatrixInput,"renderChildren",!0),zs(MatrixInput,"adapters",[{stateVariable:"value",stateVariablesToShadow:["displayDigits","displayDecimals","displaySmallAsZero"]}]);class MatrixInputGrid extends CompositeComponent{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.numRows={returnDependencies:()=>({parentNumRows:{dependencyType:"parentStateVariable",parentComponentType:"matrixInput",variableName:"numRows"}}),definition({dependencyValues:ns}){return{setValue:{numRows:ns.parentNumRows}}}},rs.numColumns={returnDependencies:()=>({parentNumColumns:{dependencyType:"parentStateVariable",parentComponentType:"matrixInput",variableName:"numColumns"}}),definition({dependencyValues:ns}){return{setValue:{numColumns:ns.parentNumColumns}}}},rs.readyToExpandWhenResolved={returnDependencies:()=>({numRows:{dependencyType:"stateVariable",variableName:"numRows"},numColumns:{dependencyType:"stateVariable",variableName:"numColumns"}}),markStale(){return{updateReplacements:!0}},definition(){return{setValue:{readyToExpandWhenResolved:!0}}}},rs}static async createSerializedReplacements({component:rs,componentInfoObjects:ns,flags:ss,workspace:os}){let ls=[],us=await rs.stateValues.numRows;os.previousNumRows=us;for(let cs=0;cscs&&(fs=ds-cs,rs.replacementsToWithhold>0))if(rs.replacementsToWithhold>=fs){ps=rs.replacementsToWithhold-fs,cs+=fs,fs=0;let hs={changeType:"changeReplacementsToWithhold",replacementsToWithhold:ps};us.push(hs)}else fs-=rs.replacementsToWithhold,cs+=rs.replacementsToWithhold,ps=0;if(fs>0){let hs=[];for(let ys=cs;ys({}),definition:()=>({useEssentialOrDefaultValue:{rowInd:!0}})},rs.numColumns={returnDependencies:()=>({parentNumColumns:{dependencyType:"parentStateVariable",parentComponentType:"matrixInput",variableName:"numColumns"}}),definition({dependencyValues:ns}){return{setValue:{numColumns:ns.parentNumColumns}}}},rs.readyToExpandWhenResolved={returnDependencies:()=>({numColumns:{dependencyType:"stateVariable",variableName:"numColumns"}}),markStale(){return{updateReplacements:!0}},definition(){return{setValue:{readyToExpandWhenResolved:!0}}}},rs}static async createSerializedReplacements({component:rs,componentInfoObjects:ns,flags:ss,workspace:os}){let ls=[],us=await rs.stateValues.numColumns,cs=await rs.stateValues.rowInd;os.previousNumColumns=us;for(let ds=0;dscs&&(hs=ds-cs,rs.replacementsToWithhold>0))if(rs.replacementsToWithhold>=hs){fs=rs.replacementsToWithhold-hs,cs+=hs,hs=0;let gs={changeType:"changeReplacementsToWithhold",replacementsToWithhold:fs};us.push(gs)}else hs-=rs.replacementsToWithhold,cs+=rs.replacementsToWithhold,fs=0;if(hs>0){let gs=[];for(let bs=cs;bs({}),definition:()=>({useEssentialOrDefaultValue:{rowInd:!0}})},rs.colInd={hasEssential:!0,defaultValue:null,returnDependencies:()=>({}),definition:()=>({useEssentialOrDefaultValue:{colInd:!0}})},rs.format={returnDependencies:()=>({parentFormat:{dependencyType:"parentStateVariable",parentComponentType:"matrixInput",variableName:"format"}}),definition({dependencyValues:ns}){return{setValue:{format:ns.parentFormat}}}},rs.functionSymbols={returnDependencies:()=>({parentFunctionSymbols:{dependencyType:"parentStateVariable",parentComponentType:"matrixInput",variableName:"functionSymbols"}}),definition({dependencyValues:ns}){return{setValue:{functionSymbols:ns.parentFunctionSymbols}}}},rs.splitSymbols={returnDependencies:()=>({parentSplitSymbols:{dependencyType:"parentStateVariable",parentComponentType:"matrixInput",variableName:"splitSymbols"}}),definition({dependencyValues:ns}){return{setValue:{splitSymbols:ns.parentSplitSymbols}}}},rs.parseScientificNotation={returnDependencies:()=>({parentParseScientificNotation:{dependencyType:"parentStateVariable",parentComponentType:"matrixInput",variableName:"parseScientificNotation"}}),definition({dependencyValues:ns}){return{setValue:{parseScientificNotation:ns.parentParseScientificNotation}}}},rs.displayDigits={returnDependencies:()=>({parentDisplayDigits:{dependencyType:"parentStateVariable",parentComponentType:"matrixInput",variableName:"displayDigits"}}),definition({dependencyValues:ns,usedDefault:ss}){let os={setValue:{displayDigits:ns.parentDisplayDigits}};return ss.parentDisplayDigits&&(os.markAsUsedDefault={displayDigits:!0}),os}},rs.displayDecimals={returnDependencies:()=>({parentDisplayDecimals:{dependencyType:"parentStateVariable",parentComponentType:"matrixInput",variableName:"displayDecimals"}}),definition({dependencyValues:ns,usedDefault:ss}){let os={setValue:{displayDecimals:ns.parentDisplayDecimals}};return ss.parentDisplayDecimals&&(os.markAsUsedDefault={displayDecimals:!0}),os}},rs.displaySmallAsZero={returnDependencies:()=>({parentDisplaySmallAsZero:{dependencyType:"parentStateVariable",parentComponentType:"matrixInput",variableName:"displaySmallAsZero"}}),definition({dependencyValues:ns}){return{setValue:{displaySmallAsZero:ns.parentDisplaySmallAsZero}}}},rs.unionFromU={returnDependencies:()=>({parentUnionFromU:{dependencyType:"parentStateVariable",parentComponentType:"matrixInput",variableName:"unionFromU"}}),definition({dependencyValues:ns}){return{setValue:{unionFromU:ns.parentUnionFromU}}}},rs.value={stateVariablesDeterminingDependencies:["rowInd","colInd"],returnDependencies:({stateValues:ns})=>{let ss="";return ns.rowInd!==null&&ns.colInd!==null&&(ss=`${ns.rowInd+1}_${ns.colInd+1}`),{parentComponentValue:{dependencyType:"parentStateVariable",parentComponentType:"matrixInput",variableName:`componentValue${ss}`}}},definition:function({dependencyValues:ns}){return ns.parentComponentValue?{setValue:{value:ns.parentComponentValue}}:{setValue:{value:Context.fromAst("_")}}},inverseDefinition:function({desiredStateVariableValues:ns,dependencyValues:ss}){return{success:!0,instructions:[{setDependency:"parentComponentValue",desiredValue:ns.value}]}}},rs.immediateValue={public:!0,shadowingInstructions:{createComponentOfType:"math",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero"]},stateVariablesDeterminingDependencies:["rowInd","colInd"],returnDependencies:({stateValues:ns})=>{let ss="";return ns.rowInd!==null&&ns.colInd!==null&&(ss=`${ns.rowInd+1}_${ns.colInd+1}`),{parentComponentImmediateValue:{dependencyType:"parentStateVariable",parentComponentType:"matrixInput",variableName:`componentImmediateValue${ss}`}}},definition:function({dependencyValues:ns}){return{setValue:{immediateValue:ns.parentComponentImmediateValue}}},inverseDefinition:function({desiredStateVariableValues:ns,initialChange:ss}){return{success:!0,instructions:[{setDependency:"parentComponentImmediateValue",desiredValue:ns.immediateValue,treatAsInitialChange:ss}]}}},rs.valueForDisplay={forRenderer:!0,returnDependencies:()=>({value:{dependencyType:"stateVariable",variableName:"value"},displayDigits:{dependencyType:"stateVariable",variableName:"displayDigits"},displayDecimals:{dependencyType:"stateVariable",variableName:"displayDecimals"},displaySmallAsZero:{dependencyType:"stateVariable",variableName:"displaySmallAsZero"}}),definition:function({dependencyValues:ns,usedDefault:ss}){return{setValue:{valueForDisplay:roundForDisplay({value:ns.value,dependencyValues:ns,usedDefault:ss})}}}},rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({valueForDisplay:{dependencyType:"stateVariable",variableName:"valueForDisplay"}}),definition:function({dependencyValues:ns}){return{setValue:{text:ns.valueForDisplay.toString()}}}},rs.rawRendererValue={forRenderer:!0,hasEssential:!0,shadowVariable:!0,defaultValue:"",provideEssentialValuesInDefinition:!0,public:!0,shadowingInstructions:{createComponentOfType:"text"},additionalStateVariablesDefined:[{variableName:"lastValueForDisplay",hasEssential:!0,shadowVariable:!0,defaultValue:null,set:convertValueToMathExpression}],returnDependencies:()=>({immediateValue:{dependencyType:"stateVariable",variableName:"immediateValue"},valueForDisplay:{dependencyType:"stateVariable",variableName:"valueForDisplay"}}),definition({dependencyValues:ns,essentialValues:ss}){if(ss.rawRendererValue===void 0||!deepCompare(ss.lastValueForDisplay.tree,ns.valueForDisplay.tree)){let os=stripLatex(ns.valueForDisplay.toLatex());return os==="_"&&(os=""),{setValue:{rawRendererValue:os,lastValueForDisplay:ns.valueForDisplay},setEssentialValue:{rawRendererValue:os,lastValueForDisplay:ns.valueForDisplay}}}else return{useEssentialOrDefaultValue:{rawRendererValue:!0,lastValueForDisplay:!0}}},async inverseDefinition({desiredStateVariableValues:ns,stateValues:ss,essentialValues:os}){const ls=async cs=>{let ds;cs=normalizeLatexString(cs,{unionFromU:await ss.unionFromU}),cs=cs.replace(/\^(\w)/g,"^{$1}");let ps=getFromLatex({functionSymbols:await ss.functionSymbols,splitSymbols:await ss.splitSymbols,parseScientificNotation:await ss.parseScientificNotation});try{ds=ps(cs)}catch{ds=Context.fromAst("_")}return ds};let us=[];if(typeof ns.rawRendererValue=="string"){let cs=os.rawRendererValue,ds=ns.rawRendererValue;cs!==ds&&us.push({setEssentialValue:"rawRendererValue",value:ds});let ps=await ls(cs),fs=await ls(ds);deepCompare(fs.tree,ps.tree)||us.push({setDependency:"immediateValue",desiredValue:fs,treatAsInitialChange:!0})}else{us.push({setEssentialValue:"lastValueForDisplay",value:ns.rawRendererValue});let cs=await ls(os.rawRendererValue);if(!deepCompare(ns.rawRendererValue.tree,cs.tree)){let ds=stripLatex(ns.rawRendererValue.toLatex());ds==="_"&&(ds=""),us.push({setEssentialValue:"rawRendererValue",value:ds})}}return{success:!0,instructions:us}}},rs.componentType={returnDependencies:()=>({}),definition:()=>({setValue:{componentType:"math"}})},rs}async updateRawValue({rawRendererValue:rs,actionId:ns,sourceInformation:ss={},skipRendererUpdate:os=!1}){if(await this.stateValues.disabled)this.coreFunctions.resolveAction({actionId:ns});else return await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"rawRendererValue",value:rs},{updateType:"setComponentNeedingUpdateValue",componentName:this.componentName}],actionId:ns,sourceInformation:ss,skipRendererUpdate:os})}async updateValue({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){if(await this.stateValues.disabled)this.coreFunctions.resolveAction({actionId:rs});else{let os=await this.stateValues.immediateValue;if(deepCompare((await this.stateValues.value).tree,os.tree))await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"rawRendererValue",valueOfStateVariable:"rawRendererValue"}],actionId:rs,sourceInformation:ns,skipRendererUpdate:ss});else{let ls=[{updateType:"updateValue",componentName:this.componentName,stateVariable:"value",value:os},{updateType:"executeUpdate"},{updateType:"updateValue",componentName:this.componentName,stateVariable:"immediateValue",valueOfStateVariable:"value"},{updateType:"unsetComponentNeedingUpdateValue"}];os.tree!=="_"&&ls.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"rawRendererValue",valueOfStateVariable:"valueForDisplay"});let us={verb:"answered",object:{componentName:this.componentName,componentType:this.componentType},result:{response:os,responseText:os.toString()}},cs=await this.stateValues.answerAncestor;return cs&&(us.context={answerAncestor:cs.componentName}),await this.coreFunctions.performUpdate({updateInstructions:ls,actionId:rs,sourceInformation:ns,skipRendererUpdate:!0,event:us}),await this.coreFunctions.triggerChainedActions({componentName:this.componentName,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss})}}}}zs(MatrixComponentInput,"componentType","matrixComponentInput"),zs(MatrixComponentInput,"rendererType","mathInput"),zs(MatrixComponentInput,"variableForPlainMacro","value"),zs(MatrixComponentInput,"variableForPlainCopy","value");const MatrixInput$1=Object.freeze(Object.defineProperty({__proto__:null,MatrixInput,MatrixInputGrid,MatrixInputRow,default:MatrixComponentInput},Symbol.toStringTag,{value:"Module"}));class Document extends BaseComponent{constructor(rs){super(rs),Object.assign(this.actions,{submitAllAnswers:this.submitAllAnswers.bind(this),recordVisibilityChange:this.recordVisibilityChange.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return delete rs.hide,delete rs.disabled,delete rs.modifyIndirectly,delete rs.fixed,delete rs.styleNumber,delete rs.isResponse,rs.documentWideCheckWork={createComponentOfType:"boolean",createStateVariable:"documentWideCheckWork",defaultValue:!1,public:!0},rs.submitLabel={createComponentOfType:"text",createStateVariable:"submitLabel",defaultValue:"Check Work",public:!0,forRenderer:!0},rs.submitLabelNoCorrectness={createComponentOfType:"text",createStateVariable:"submitLabelNoCorrectness",defaultValue:"Submit Response",public:!0,forRenderer:!0},rs.displayDigitsForCreditAchieved={createComponentOfType:"integer",createStateVariable:"displayDigitsForCreditAchieved",defaultValue:3,public:!0},rs.xmlns={createPrimitiveOfType:"string"},rs.type={createPrimitiveOfType:"string"},rs}static returnChildGroups(){return[{group:"variantControl",componentTypes:["variantControl"]},{group:"title",componentTypes:["title"]},{group:"description",componentTypes:["description"]},{group:"setups",componentTypes:["setup"]},{group:"anything",componentTypes:["_base"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions(),ns=returnStyleDefinitionStateVariables();Object.assign(rs,ns);let ss=returnFeedbackDefinitionStateVariables();return Object.assign(rs,ss),rs.titleChildName={forRenderer:!0,returnDependencies:()=>({titleChild:{dependencyType:"child",childGroups:["title"]}}),definition({dependencyValues:os}){let ls=null;return os.titleChild.length>0&&(ls=os.titleChild[0].componentName),{setValue:{titleChildName:ls}}}},rs.title={public:!0,shadowingInstructions:{createComponentOfType:"text"},forRenderer:!0,returnDependencies:()=>({titleChild:{dependencyType:"child",childGroups:["title"],variableNames:["text"]}}),definition({dependencyValues:os}){return os.titleChild.length===0?{setValue:{title:""}}:{setValue:{title:os.titleChild[0].stateValues.text}}}},rs.description={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({descriptionChild:{dependencyType:"child",childGroups:["description"],variableNames:["text"]}}),definition({dependencyValues:os}){return os.descriptionChild.length===0?{setValue:{description:""}}:{setValue:{description:os.descriptionChild[0].stateValues.text}}}},rs.theme={hasEssential:!0,defaultValue:"light",returnDependencies:()=>({documentAncestor:{dependencyType:"ancestor",componentType:"document",variableNames:["theme"]}}),definition({dependencyValues:os}){return os.documentAncestor?{setValue:{theme:os.documentAncestor.stateValues.theme}}:{useEssentialOrDefaultValue:{theme:!0}}},inverseDefinition({desiredStateVariableValues:os,dependencyValues:ls}){return ls.documentAncestor?{success:!0,instructions:[{setDependency:"documentAncestor",desiredValue:os.theme}]}:{success:!0,instructions:[{setEssentialValue:"theme",value:os.theme}]}}},rs.level={forRenderer:!0,returnDependencies:()=>({}),definition:()=>({setValue:{level:0}})},rs.viewedSolution={defaultValue:!1,hasEssential:!0,returnDependencies:()=>({}),definition:()=>({useEssentialOrDefaultValue:{viewedSolution:!0}}),inverseDefinition({desiredStateVariableValues:os}){return{success:!0,instructions:[{setEssentialValue:"viewedSolution",value:os.viewedSolution}]}}},rs.scoredDescendants={returnDependencies:()=>({scoredDescendants:{dependencyType:"descendant",componentTypes:["_sectioningComponent","answer","setup"],variableNames:["scoredDescendants","aggregateScores","weight"],recurseToMatchedChildren:!1,variablesOptional:!0}}),definition({dependencyValues:os}){let ls=[];for(let us of os.scoredDescendants)us.componentType!=="setup"&&(us.stateValues.aggregateScores||us.stateValues.scoredDescendants===void 0?ls.push(us):ls.push(...us.stateValues.scoredDescendants));return{setValue:{scoredDescendants:ls}}}},rs.nScoredDescendants={returnDependencies:()=>({scoredDescendants:{dependencyType:"stateVariable",variableName:"scoredDescendants"}}),definition({dependencyValues:os}){return{setValue:{nScoredDescendants:os.scoredDescendants.length}}}},rs.itemCreditAchieved={isArray:!0,returnArraySizeDependencies:()=>({nScoredDescendants:{dependencyType:"stateVariable",variableName:"nScoredDescendants"}}),returnArraySize({dependencyValues:os}){return[os.nScoredDescendants]},stateVariablesDeterminingDependencies:["scoredDescendants"],returnArrayDependenciesByKey({arrayKeys:os,stateValues:ls}){let us={};for(let cs of os){let ds=ls.scoredDescendants[cs];ds&&(us[cs]={creditAchieved:{dependencyType:"stateVariable",componentName:ds.componentName,variableName:"creditAchieved"}})}return{dependenciesByKey:us}},arrayDefinitionByKey({dependencyValuesByKey:os,arrayKeys:ls}){let us={};for(let cs of ls)us[cs]=os[cs].creditAchieved;return{setValue:{itemCreditAchieved:us}}}},rs.itemNumberByAnswerName={stateVariablesDeterminingDependencies:["scoredDescendants"],returnDependencies({stateValues:os}){let ls={scoredDescendants:{dependencyType:"stateVariable",variableName:"scoredDescendants"}};for(let us in os.scoredDescendants){let cs=os.scoredDescendants[us];ls[`descendantsOf${us}`]={dependencyType:"descendant",ancestorName:cs.componentName,componentTypes:["answer"],recurseToMatchedChildren:!1}}return ls},definition({dependencyValues:os,componentInfoObjects:ls}){let us={};for(let[cs,ds]of os.scoredDescendants.entries()){let ps=cs+1;for(let fs of os[`descendantsOf${cs}`])us[fs.componentName]=ps;ls.isInheritedComponentType({inheritedComponentType:ds.componentType,baseComponentType:"answer"})&&(us[ds.componentName]=ps)}return{setValue:{itemNumberByAnswerName:us}}}},rs.itemVariantInfo={isArray:!0,returnArraySizeDependencies:()=>({nScoredDescendants:{dependencyType:"stateVariable",variableName:"nScoredDescendants"}}),returnArraySize({dependencyValues:os}){return[os.nScoredDescendants]},stateVariablesDeterminingDependencies:["scoredDescendants"],returnArrayDependenciesByKey({arrayKeys:os,stateValues:ls}){let us={};for(let cs of os){let ds=ls.scoredDescendants[cs];ds&&(us[cs]={generatedVariantInfo:{dependencyType:"stateVariable",componentName:ds.componentName,variableName:"generatedVariantInfo",variablesOptional:!0}})}return{dependenciesByKey:us}},arrayDefinitionByKey({dependencyValuesByKey:os,arrayKeys:ls}){let us={};for(let cs of ls)us[cs]=os[cs].generatedVariantInfo;return{setValue:{itemVariantInfo:us}}}},rs.answerDescendants={returnDependencies:()=>({answerDescendants:{dependencyType:"descendant",componentTypes:["answer"],variableNames:["justSubmitted"],recurseToMatchedChildren:!1}}),definition({dependencyValues:os}){return{setValue:{answerDescendants:os.answerDescendants}}}},rs.justSubmitted={forRenderer:!0,returnDependencies:()=>({answerDescendants:{dependencyType:"stateVariable",variableName:"answerDescendants"}}),definition({dependencyValues:os}){return{setValue:{justSubmitted:os.answerDescendants.every(ls=>ls.stateValues.justSubmitted)}}}},rs.showCorrectness={forRenderer:!0,returnDependencies:()=>({showCorrectnessFlag:{dependencyType:"flag",flagName:"showCorrectness"}}),definition({dependencyValues:os}){return{setValue:{showCorrectness:os.showCorrectnessFlag!==!1}}}},rs.creditAchieved={public:!0,forRenderer:!0,defaultValue:0,shadowingInstructions:{createComponentOfType:"number",addAttributeComponentsShadowingStateVariables:{displayDigits:{stateVariableToShadow:"displayDigitsForCreditAchieved"}}},additionalStateVariablesDefined:[{variableName:"percentCreditAchieved",public:!0,shadowingInstructions:{createComponentOfType:"number",addAttributeComponentsShadowingStateVariables:{displayDigits:{stateVariableToShadow:"displayDigitsForCreditAchieved"}}}}],returnDependencies:()=>({scoredDescendants:{dependencyType:"stateVariable",variableName:"scoredDescendants"},itemCreditAchieved:{dependencyType:"stateVariable",variableName:"itemCreditAchieved"}}),definition({dependencyValues:os}){let ls=0,us=0;for(let[ps,fs]of os.scoredDescendants.entries()){let hs=fs.stateValues.weight;ls+=os.itemCreditAchieved[ps]*hs,us+=hs}let cs;us>0?cs=ls/us:cs=1;let ds=cs*100;return{setValue:{creditAchieved:cs,percentCreditAchieved:ds}}}},rs.creditAchievedIfSubmit={defaultValue:0,stateVariablesDeterminingDependencies:["scoredDescendants"],returnDependencies({stateValues:os}){let ls={scoredDescendants:{dependencyType:"stateVariable",variableName:"scoredDescendants"}};for(let[us,cs]of os.scoredDescendants.entries())ls["creditAchievedIfSubmit"+us]={dependencyType:"stateVariable",componentName:cs.componentName,variableName:"creditAchievedIfSubmit"};return ls},definition({dependencyValues:os}){let ls=0,us=0;for(let[ds,ps]of os.scoredDescendants.entries()){let fs=ps.stateValues.weight;ls+=os["creditAchievedIfSubmit"+ds]*fs,us+=fs}return{setValue:{creditAchievedIfSubmit:ls/us}}}},rs.generatedVariantInfo={providePreviousValuesInDefinition:!0,returnDependencies:({sharedParameters:os,componentInfoObjects:ls})=>({variantIndex:{dependencyType:"value",value:os.variantIndex},variantName:{dependencyType:"value",value:os.variantName},variantDescendants:{dependencyType:"descendant",componentTypes:Object.keys(ls.componentTypesCreatingVariants),variableNames:["isVariantComponent","generatedVariantInfo"],recurseToMatchedChildren:!1,variablesOptional:!0,includeNonActiveChildren:!0,ignoreReplacementsOfEncounteredComposites:!0}}),definition({dependencyValues:os,componentName:ls,previousValues:us}){var ps;let cs={index:os.variantIndex,name:os.variantName,meta:{createdBy:ls}},ds=cs.subvariants=[];for(let fs of os.variantDescendants)fs.stateValues.isVariantComponent?ds.push(fs.stateValues.generatedVariantInfo):fs.stateValues.generatedVariantInfo&&ds.push(...fs.stateValues.generatedVariantInfo.subvariants);for(let[fs,hs]of ds.entries())if(!hs.subvariants&&us.generatedVariantInfo){let gs=us.generatedVariantInfo.subvariants;(ps=gs[fs])!=null&&ps.subvariants&&(ds[fs]=Object.assign({},ds[fs]),ds[fs].subvariants=gs[fs].subvariants)}return{setValue:{generatedVariantInfo:cs}}}},rs.createSubmitAllButton={forRenderer:!0,additionalStateVariablesDefined:[{variableName:"suppressAnswerSubmitButtons",forRenderer:!0}],returnDependencies:()=>({documentWideCheckWork:{dependencyType:"stateVariable",variableName:"documentWideCheckWork"}}),definition({dependencyValues:os,componentName:ls}){let us=!1,cs=!1;return os.documentWideCheckWork&&(us=!0,cs=!0),{setValue:{createSubmitAllButton:us,suppressAnswerSubmitButtons:cs}}}},rs.suppressCheckwork={forRenderer:!0,returnDependencies:()=>({autoSubmit:{dependencyType:"flag",flagName:"autoSubmit"}}),definition({dependencyValues:os}){return{setValue:{suppressCheckwork:os.autoSubmit}}}},rs}async submitAllAnswers({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){this.coreFunctions.requestRecordEvent({verb:"submitted",object:{componentName:this.componentName,componentType:this.componentType}});let os=await this.stateValues.answerDescendants;for(let[ls,us]of await this.stateValues.answerDescendants.entries())await us.stateValues.justSubmitted||await this.coreFunctions.performAction({componentName:us.componentName,actionName:"submitAnswer",args:{actionId:rs,sourceInformation:ns,skipRendererUpdate:ss||ls({}),definition:()=>({setValue:{overrideChildHide:!0}})},rs.textsShadow={defaultValue:null,hasEssential:!0,returnDependencies:()=>({}),definition:()=>({useEssentialOrDefaultValue:{textsShadow:!0}})},rs.nComponents={public:!0,shadowingInstructions:{createComponentOfType:"number"},additionalStateVariablesDefined:["childIndexByArrayKey"],returnDependencies(){return{maximumNumber:{dependencyType:"stateVariable",variableName:"maximumNumber"},textListChildren:{dependencyType:"child",childGroups:["textLists"],variableNames:["nComponents"]},textAndTextListChildren:{dependencyType:"child",childGroups:["texts","textLists"],skipComponentNames:!0},textsShadow:{dependencyType:"stateVariable",variableName:"textsShadow"}}},definition:function({dependencyValues:ns,componentInfoObjects:ss}){let os=0,ls=[];if(ns.textAndTextListChildren.length>0){let cs=0;for(let[ds,ps]of ns.textAndTextListChildren.entries())if(ss.isInheritedComponentType({inheritedComponentType:ps.componentType,baseComponentType:"textList"})){let fs=ns.textListChildren[cs];cs++;for(let hs=0;hsus&&(os=us,ls=ls.slice(0,us)),{setValue:{nComponents:os,childIndexByArrayKey:ls},checkForActualChange:{nComponents:!0}}}},rs.texts={public:!0,shadowingInstructions:{createComponentOfType:"text"},isArray:!0,entryPrefixes:["text"],stateVariablesDeterminingDependencies:["childIndexByArrayKey"],returnArraySizeDependencies:()=>({nComponents:{dependencyType:"stateVariable",variableName:"nComponents"}}),returnArraySize({dependencyValues:ns}){return[ns.nComponents]},returnArrayDependenciesByKey({arrayKeys:ns,stateValues:ss}){let os={},ls={childIndexByArrayKey:{dependencyType:"stateVariable",variableName:"childIndexByArrayKey"},textsShadow:{dependencyType:"stateVariable",variableName:"textsShadow"}};for(let us of ns){let cs=[],ds="1";ss.childIndexByArrayKey[us]&&(cs=[ss.childIndexByArrayKey[us][0]],ds=ss.childIndexByArrayKey[us][1]+1),os[us]={textAndTextListChildren:{dependencyType:"child",childGroups:["texts","textLists"],variableNames:["value","text"+ds],variablesOptional:!0,childIndices:cs}}}return{globalDependencies:ls,dependenciesByKey:os}},arrayDefinitionByKey({globalDependencyValues:ns,dependencyValuesByKey:ss,arrayKeys:os}){let ls={};for(let us of os){let cs=ss[us].textAndTextListChildren[0];if(cs)if(cs.stateValues.value!==void 0)ls[us]=cs.stateValues.value;else{let ds=ns.childIndexByArrayKey[us][1]+1;ls[us]=cs.stateValues["text"+ds]}else ns.textsShadow!==null&&(ls[us]=ns.textsShadow[us])}return{setValue:{texts:ls}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ns,globalDependencyValues:ss,dependencyValuesByKey:os,dependencyNamesByKey:ls,arraySize:us}){let cs=[];for(let ds in ns.texts){if(!os[ds])continue;let ps=os[ds].textAndTextListChildren[0];ps&&(ps.stateValues.value!==void 0?cs.push({setDependency:ls[ds].textAndTextListChildren,desiredValue:ns.texts[ds],childIndex:0,variableIndex:0}):cs.push({setDependency:ls[ds].textAndTextListChildren,desiredValue:ns.texts[ds],childIndex:0,variableIndex:1}))}return{success:!0,instructions:cs}}},rs.nValues={isAlias:!0,targetVariableName:"nComponents"},rs.values={isAlias:!0,targetVariableName:"texts"},rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},forRenderer:!0,returnDependencies:()=>({texts:{dependencyType:"stateVariable",variableName:"texts"}}),definition:({dependencyValues:ns})=>({setValue:{text:ns.texts.join(", ")}})},rs.componentNamesInList={returnDependencies:()=>({textAndTextListChildren:{dependencyType:"child",childGroups:["texts","textLists"],variableNames:["componentNamesInList"],variablesOptional:!0},maximumNumber:{dependencyType:"stateVariable",variableName:"maximumNumber"}}),definition:function({dependencyValues:ns,componentInfoObjects:ss}){let os=[];for(let us of ns.textAndTextListChildren)ss.isInheritedComponentType({inheritedComponentType:us.componentType,baseComponentType:"textList"})?os.push(...us.stateValues.componentNamesInList):os.push(us.componentName);let ls=ns.maximumNumber;return ls!==null&&os.length>ls&&(ls=Math.max(0,Math.floor(ls)),os=os.slice(0,ls)),{setValue:{componentNamesInList:os}}}},rs.nComponentsToDisplayByChild={additionalStateVariablesDefined:["nChildrenToRender"],returnDependencies:()=>({nComponents:{dependencyType:"stateVariable",variableName:"nComponents"},textListChildren:{dependencyType:"child",childGroups:["textLists"],variableNames:["nComponents"]},textAndTextListChildren:{dependencyType:"child",childGroups:["texts","textLists"],skipComponentNames:!0},parentNComponentsToDisplayByChild:{dependencyType:"parentStateVariable",parentComponentType:"textList",variableName:"nComponentsToDisplayByChild"}}),definition:function({dependencyValues:ns,componentInfoObjects:ss,componentName:os}){let ls=ns.nComponents;ns.parentNComponentsToDisplayByChild!==null&&(ls=ns.parentNComponentsToDisplayByChild[os]);let us={},cs=0,ds=0,ps=0;for(let fs of ns.textAndTextListChildren){let hs=Math.max(0,ls-cs);if(hs>0&&ds++,ss.isInheritedComponentType({inheritedComponentType:fs.componentType,baseComponentType:"textList"})){let gs=ns.textListChildren[ps];ps++;let ys=Math.min(hs,gs.stateValues.nComponents);us[gs.componentName]=ys,cs+=ys}else cs+=1}return{setValue:{nComponentsToDisplayByChild:us,nChildrenToRender:ds}}},markStale:()=>({updateRenderedChildren:!0})},rs}},zs(Du,"componentType","textList"),zs(Du,"renderChildren",!0),zs(Du,"includeBlankStringChildren",!0),zs(Du,"removeBlankStringChildrenPostSugar",!0),zs(Du,"stateVariableForAttributeValue","texts"),zs(Du,"primaryStateVariableForDefinition","textsShadow"),zs(Du,"descendantCompositesMustHaveAReplacement",!1),zs(Du,"adapters",["text"]),Du);class TextList extends InlineComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.unordered={default:!1},rs.maximumNumber={default:null},rs}static returnChildLogic(rs){let ns=super.returnChildLogic(rs),ss=ns.newLeaf({name:"atLeastZeroTexts",componentType:"text",comparison:"atLeast",number:0}),os=ns.newLeaf({name:"atLeastZeroTextLists",componentType:"textList",comparison:"atLeast",number:0}),ls=function({dependencyValues:ds}){let ps=ds.stringChildren[0];return{success:!0,newChildren:ps.stateValues.value.split(",").map(hs=>({componentType:"text",state:{value:hs.trim()}})),toDelete:[ps.componentName]}},us=ns.newLeaf({name:"exactlyOneString",componentType:"string",number:1,isSugar:!0,returnSugarDependencies:()=>({stringChildren:{dependencyType:"child",childLogicName:"exactlyOneString",variableNames:["value"]}}),logicToWaitOnSugar:["atLeastZeroTexts"],replacementFunction:ls}),cs=ns.newOperator({name:"textAndTextLists",operator:"and",propositions:[ss,os]});return ns.newOperator({name:"TextsXorSugar",operator:"xor",propositions:[us,cs],setAsBase:!0}),ns}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.texts={public:!0,shadowingInstructions:{createComponentOfType:"text"},isArray:!0,entryPrefixes:["text"],returnDependencies:()=>({textAndTextListChildren:{dependencyType:"child",childLogicName:"textAndTextLists",variableNames:["value","texts"],variablesOptional:!0},maximumNumber:{dependencyType:"stateVariable",variableName:"maximumNumber"},childrenToRender:{dependencyType:"stateVariable",variableName:"childrenToRender"}}),definition:function({dependencyValues:ns}){let ss=[],os=ns.textAndTextListChildren.map(ls=>ls.componentName);for(let ls of ns.childrenToRender){let us=os.indexOf(ls),cs=ns.textAndTextListChildren[us];cs.stateValues.texts?ss.push(...cs.stateValues.texts):ss.push(cs.stateValues.value)}return{setValue:{texts:ss}}}},rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({texts:{dependencyType:"stateVariable",variableName:"texts"}}),definition:({dependencyValues:ns})=>({setValue:{text:ns.texts.join(", ")}})},rs.nComponents={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({texts:{dependencyType:"stateVariable",variableName:"texts"}}),definition:function({dependencyValues:ns}){return{setValue:{nComponents:ns.texts.length}}}},rs.childrenToRender={returnDependencies:({sharedParameters:ns})=>({textAndTextListChildren:{dependencyType:"child",childLogicName:"textAndTextLists",variableNames:["childrenToRender"],variablesOptional:!0},maximumNumber:{dependencyType:"stateVariable",variableName:"maximumNumber"},selectRng:{dependencyType:"value",value:ns.selectRng,doNotProxy:!0}}),definition:function({dependencyValues:ns}){let ss=[];for(let us of ns.textAndTextListChildren)us.stateValues.childrenToRender?ss.push(...us.stateValues.childrenToRender):ss.push(us.componentName);let os=ns.maximumNumber;os!==null&&ss.length>os&&(os=Math.max(0,Math.floor(os)),ss=ss.slice(0,os)),console.log("randomizing children");for(let us=ss.length-1;us>0;us--){const cs=ns.selectRng(),ds=Math.floor(cs*(us+1));[ss[us],ss[ds]]=[ss[ds],ss[us]]}let ls=Math.ceil(ns.selectRng()*ss.length);return console.log(`numChildren: ${ls}`),ss=ss.slice(0,ls),{setValue:{childrenToRender:ss}}}},rs}initializeRenderer(){this.renderer===void 0&&(this.renderer=new this.availableRenderers.aslist({key:this.componentName}))}}zs(TextList,"componentType","randomizedTextList"),zs(TextList,"stateVariableForAttributeValue","texts");class TupleList extends MathList{static returnSugarInstructions(){let rs=[],ns=function({matchedChildren:ss}){let os=breakEmbeddedStringsIntoParensPieces({componentList:ss});return os.success!==!0?{success:!1}:{success:!0,newChildren:os.pieces.map(function(ls){return ls.length>1||typeof ls[0]=="string"?{componentType:"math",children:ls}:ls[0]})}};return rs.push({replacementFunction:ns}),rs}}zs(TupleList,"componentType","tupleList"),zs(TupleList,"rendererType","mathList"),zs(TupleList,"includeBlankStringChildren",!1);class NumberList extends InlineComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.unordered={createComponentOfType:"boolean",createStateVariable:"unordered",defaultValue:!1,public:!0},rs.maximumNumber={createComponentOfType:"number",createStateVariable:"maximumNumber",defaultValue:null,public:!0},rs.displayDigits={createComponentOfType:"integer"},rs.displayDecimals={createComponentOfType:"integer",createStateVariable:"displayDecimals",defaultValue:null,public:!0},rs.displaySmallAsZero={createComponentOfType:"number",createStateVariable:"displaySmallAsZero",valueForTrue:1e-14,valueForFalse:0,defaultValue:0,public:!0},rs.padZeros={createComponentOfType:"boolean",createStateVariable:"padZeros",defaultValue:!1,public:!0},rs}static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=returnGroupIntoComponentTypeSeparatedBySpaces({componentType:"number"}),ss=returnBreakStringsIntoComponentTypeBySpaces({componentType:"number"});return rs.push({replacementFunction:function({matchedChildren:os,isAttributeComponent:ls=!1,createdFromMacro:us=!1}){return ls&&!us?ns({matchedChildren:os}):ss({matchedChildren:os})}}),rs}static returnChildGroups(){return[{group:"numbers",componentTypes:["number"]},{group:"numberLists",componentTypes:["numberList"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.overrideChildHide={returnDependencies:()=>({}),definition:()=>({setValue:{overrideChildHide:!0}})},rs.displayDigits={public:!0,shadowingInstructions:{createComponentOfType:"integer"},hasEssential:!0,defaultValue:10,returnDependencies:()=>({displayDigitsAttr:{dependencyType:"attributeComponent",attributeName:"displayDigits",variableNames:["value"]},displayDecimalsAttr:{dependencyType:"attributeComponent",attributeName:"displayDecimals",variableNames:["value"]}}),definition({dependencyValues:ns,usedDefault:ss}){if(ns.displayDigitsAttr!==null){let os=ss.displayDigitsAttr,ls=ns.displayDecimalsAttr===null||ss.displayDecimalsAttr;if(!(os||ls)){let us=ns.displayDigitsAttr.shadowDepth;ns.displayDecimalsAttr.shadowDepth({}),definition:()=>({useEssentialOrDefaultValue:{numbersShadow:!0}})},rs.nComponents={public:!0,shadowingInstructions:{createComponentOfType:"number"},additionalStateVariablesDefined:["childIndexByArrayKey"],returnDependencies:()=>({maximumNumber:{dependencyType:"stateVariable",variableName:"maximumNumber"},numberListChildren:{dependencyType:"child",childGroups:["numberLists"],variableNames:["nComponents"]},numberAndNumberListChildren:{dependencyType:"child",childGroups:["numbers","numberLists"],skipComponentNames:!0},numbersShadow:{dependencyType:"stateVariable",variableName:"numbersShadow"}}),definition:function({dependencyValues:ns,componentInfoObjects:ss}){let os=0,ls=[],us=0;if(ns.numberAndNumberListChildren.length>0)for(let[ds,ps]of ns.numberAndNumberListChildren.entries())if(ss.isInheritedComponentType({inheritedComponentType:ps.componentType,baseComponentType:"numberList"})){let fs=ns.numberListChildren[us];us++;for(let hs=0;hscs&&(os=cs,ls=ls.slice(0,cs)),{setValue:{nComponents:os,childIndexByArrayKey:ls},checkForActualChange:{nComponents:!0}}}},rs.numbers={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"]},isArray:!0,entryPrefixes:["number"],stateVariablesDeterminingDependencies:["childIndexByArrayKey"],returnArraySizeDependencies:()=>({nComponents:{dependencyType:"stateVariable",variableName:"nComponents"}}),returnArraySize({dependencyValues:ns}){return[ns.nComponents]},returnArrayDependenciesByKey({arrayKeys:ns,stateValues:ss}){let os={},ls={childIndexByArrayKey:{dependencyType:"stateVariable",variableName:"childIndexByArrayKey"},numbersShadow:{dependencyType:"stateVariable",variableName:"numbersShadow"}};for(let us of ns){let cs=[],ds="1";ss.childIndexByArrayKey[us]&&(cs=[ss.childIndexByArrayKey[us][0]],ds=ss.childIndexByArrayKey[us][1]+1),os[us]={numberAndNumberListChildren:{dependencyType:"child",childGroups:["numbers","numberLists"],variableNames:["value","number"+ds],variablesOptional:!0,childIndices:cs}}}return{globalDependencies:ls,dependenciesByKey:os}},arrayDefinitionByKey({globalDependencyValues:ns,dependencyValuesByKey:ss,arrayKeys:os}){let ls={};for(let us of os){let cs=ss[us].numberAndNumberListChildren[0];if(cs)if(cs.stateValues.value!==void 0)ls[us]=cs.stateValues.value;else{let ds=ns.childIndexByArrayKey[us][1]+1;ls[us]=cs.stateValues["number"+ds]}else ns.numbersShadow!==null&&(ls[us]=ns.numbersShadow[us])}return{setValue:{numbers:ls}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ns,globalDependencyValues:ss,dependencyValuesByKey:os,dependencyNamesByKey:ls,arraySize:us}){let cs=[];for(let ds in ns.numbers){if(!os[ds])continue;let ps=os[ds].numberAndNumberListChildren[0];ps&&(ps.stateValues.value!==void 0?cs.push({setDependency:ls[ds].numberAndNumberListChildren,desiredValue:ns.numbers[ds],childIndex:0,variableIndex:0}):cs.push({setDependency:ls[ds].numberAndNumberListChildren,desiredValue:ns.numbers[ds],childIndex:0,variableIndex:1}))}return{success:!0,instructions:cs}}},rs.nValues={isAlias:!0,targetVariableName:"nComponents"},rs.values={isAlias:!0,targetVariableName:"numbers"},rs.math={public:!0,shadowingInstructions:{createComponentOfType:"math",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"]},returnDependencies:()=>({numbers:{dependencyType:"stateVariable",variableName:"numbers"}}),definition({dependencyValues:ns}){let ss;return ns.numbers.length===0?ss=Context.fromAst("_"):ns.numbers.length===1?ss=Context.fromAst(ns.numbers[0]):ss=Context.fromAst(["list",...ns.numbers]),{setValue:{math:ss}}}},rs.text={public:!0,forRenderer:!0,shadowingInstructions:{createComponentOfType:"text"},additionalStateVariablesDefined:["texts"],returnDependencies:()=>({numberAndNumberListChildren:{dependencyType:"child",childGroups:["numbers","numberLists"],variableNames:["valueForDisplay","text","texts"],variablesOptional:!0},maximumNumber:{dependencyType:"stateVariable",variableName:"maximumNumber"},numbersShadow:{dependencyType:"stateVariable",variableName:"numbersShadow"},displayDigits:{dependencyType:"stateVariable",variableName:"displayDigits"},displayDecimals:{dependencyType:"stateVariable",variableName:"displayDecimals"},displaySmallAsZero:{dependencyType:"stateVariable",variableName:"displaySmallAsZero"},padZeros:{dependencyType:"stateVariable",variableName:"padZeros"}}),definition:function({dependencyValues:ns,usedDefault:ss}){let os=[],ls={};if(ns.padZeros&&(ss.displayDigits&&!ss.displayDecimals?Number.isFinite(ns.displayDecimals)&&(ls.padToDecimals=ns.displayDecimals):ns.displayDigits>=1&&(ls.padToDigits=ns.displayDigits)),ns.numberAndNumberListChildren.length>0)for(let ds of ns.numberAndNumberListChildren)ds.stateValues.valueForDisplay!==void 0?os.push(ds.stateValues.text):os.push(...ds.stateValues.texts);else ns.numbersShadow!==null&&(os=ns.numbersShadow.map(ds=>roundForDisplay({value:Context.fromAst(ds),dependencyValues:ns,usedDefault:ss}).toString(ls)));let us=ns.maximumNumber;return us!==null&&os.length>us&&(us=Math.max(0,Math.floor(us)),os=os.slice(0,us)),{setValue:{text:os.join(", "),texts:os}}}},rs.componentNamesInList={returnDependencies:()=>({numberAndNumberListChildren:{dependencyType:"child",childGroups:["numbers","numberLists"],variableNames:["componentNamesInList"],variablesOptional:!0},maximumNumber:{dependencyType:"stateVariable",variableName:"maximumNumber"}}),definition:function({dependencyValues:ns,componentInfoObjects:ss}){let os=[];for(let us of ns.numberAndNumberListChildren)ss.isInheritedComponentType({inheritedComponentType:us.componentType,baseComponentType:"numberList"})?os.push(...us.stateValues.componentNamesInList):os.push(us.componentName);let ls=ns.maximumNumber;return ls!==null&&os.length>ls&&(ls=Math.max(0,Math.floor(ls)),os=os.slice(0,ls)),{setValue:{componentNamesInList:os}}}},rs.nComponentsToDisplayByChild={additionalStateVariablesDefined:["nChildrenToRender"],returnDependencies:()=>({nComponents:{dependencyType:"stateVariable",variableName:"nComponents"},numberListChildren:{dependencyType:"child",childGroups:["numberLists"],variableNames:["nComponents"]},numberAndNumberListChildren:{dependencyType:"child",childGroups:["numbers","numberLists"],skipComponentNames:!0},parentNComponentsToDisplayByChild:{dependencyType:"parentStateVariable",parentComponentType:"numberList",variableName:"nComponentsToDisplayByChild"}}),definition:function({dependencyValues:ns,componentInfoObjects:ss,componentName:os}){let ls=ns.nComponents;ns.parentNComponentsToDisplayByChild!==null&&(ls=ns.parentNComponentsToDisplayByChild[os]);let us={},cs=0,ds=0,ps=0;for(let fs of ns.numberAndNumberListChildren){let hs=Math.max(0,ls-cs);if(hs>0&&ds++,ss.isInheritedComponentType({inheritedComponentType:fs.componentType,baseComponentType:"numberList"})){let gs=ns.numberListChildren[ps];ps++;let ys=Math.min(hs,gs.stateValues.nComponents);us[gs.componentName]=ys,cs+=ys}else cs+=1}return{setValue:{nComponentsToDisplayByChild:us,nChildrenToRender:ds}}},markStale:()=>({updateRenderedChildren:!0})},rs}}zs(NumberList,"componentType","numberList"),zs(NumberList,"renderChildren",!0),zs(NumberList,"includeBlankStringChildren",!0),zs(NumberList,"removeBlankStringChildrenPostSugar",!0),zs(NumberList,"stateVariableForAttributeValue","numbers"),zs(NumberList,"primaryStateVariableForDefinition","numbersShadow"),zs(NumberList,"adapters",[{stateVariable:"math",stateVariablesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"]},"text"]);class NumberListFromString extends InlineComponent{static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=function({matchedChildren:ss}){return{success:!0,newChildren:ss.reduce(function(ls,us){return typeof us=="string"?[...ls,...us.split(/\s+/).filter(cs=>cs)]:[...ls,us]},[])}};return rs.push({replacementFunction:ns}),rs}static returnChildGroups(){return[{group:"strings",componentTypes:["string"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.nComponents={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({stringChildren:{dependencyType:"child",childGroups:["strings"]}}),definition:function({dependencyValues:ns}){return{setValue:{nComponents:ns.stringChildren.length}}}},rs.numbers={public:!0,shadowingInstructions:{createComponentOfType:"number"},isArray:!0,entryPrefixes:["number"],returnArraySizeDependencies:()=>({nComponents:{dependencyType:"stateVariable",variableName:"nComponents"}}),returnArraySize({dependencyValues:ns}){return[ns.nComponents]},returnArrayDependenciesByKey(){return{globalDependencies:{stringChildren:{dependencyType:"child",childGroups:["strings"]}}}},arrayDefinitionByKey({globalDependencyValues:ns,arrayKeys:ss}){let os={};for(let[ls,us]of ns.stringChildren.entries())os[ls]=Number(us);return{setValue:{numbers:os}}}},rs.nValues={isAlias:!0,targetVariableName:"nComponents"},rs.values={isAlias:!0,targetVariableName:"numbers"},rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},additionalStateVariablesDefined:["texts"],returnDependencies:()=>({numbers:{dependencyType:"stateVariable",variableName:"numbers"}}),definition:function({dependencyValues:ns}){let ss=ns.numbers.map(ls=>ls.toString());return{setValue:{text:ss.join(", "),texts:ss}}}},rs}}zs(NumberListFromString,"componentType","numberListFromString"),zs(NumberListFromString,"rendererType","asList"),zs(NumberListFromString,"renderChildren",!0),zs(NumberListFromString,"stateVariableForAttributeValue","numbers");var ju;let P$2=(ju=class extends BlockComponent{constructor(rs){super(rs),Object.assign(this.actions,{recordVisibilityChange:this.recordVisibilityChange.bind(this)})}static returnChildGroups(){return[{group:"inlines",componentTypes:["_inline"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({inlineChildren:{dependencyType:"child",childGroups:["inlines"],variableNames:["text"],variablesOptional:!0}}),definition:function({dependencyValues:ns}){let ss="";for(let os of ns.inlineChildren)typeof os!="object"?ss+=os.toString():typeof os.stateValues.text=="string"?ss+=os.stateValues.text:ss+=" ";return{setValue:{text:ss}}}},rs}recordVisibilityChange({isVisible:rs,actionId:ns}){this.coreFunctions.requestRecordEvent({verb:"visibilityChanged",object:{componentName:this.componentName,componentType:this.componentType},result:{isVisible:rs}}),this.coreFunctions.resolveAction({actionId:ns})}},zs(ju,"componentType","p"),zs(ju,"renderChildren",!0),zs(ju,"includeBlankStringChildren",!0),ju);class BooleanList extends InlineComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.unordered={createComponentOfType:"boolean",createStateVariable:"unordered",defaultValue:!1,public:!0},rs.maximumNumber={createComponentOfType:"number",createStateVariable:"maximumNumber",defaultValue:null,public:!0},rs}static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=returnGroupIntoComponentTypeSeparatedBySpaces({componentType:"boolean"}),ss=returnBreakStringsIntoComponentTypeBySpaces({componentType:"boolean"});return rs.push({replacementFunction:function({matchedChildren:os,isAttributeComponent:ls=!1,createdFromMacro:us=!1}){return ls&&!us?ns({matchedChildren:os}):ss({matchedChildren:os})}}),rs}static returnChildGroups(){return[{group:"booleans",componentTypes:["boolean"]},{group:"booleanLists",componentTypes:["booleanList"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.overrideChildHide={returnDependencies:()=>({}),definition:()=>({setValue:{overrideChildHide:!0}})},rs.nComponents={public:!0,shadowingInstructions:{createComponentOfType:"number"},additionalStateVariablesDefined:["childIndexByArrayKey"],returnDependencies(){return{maximumNumber:{dependencyType:"stateVariable",variableName:"maximumNumber"},booleanListChildren:{dependencyType:"child",childGroups:["booleanLists"],variableNames:["nComponents"]},booleanAndBooleanListChildren:{dependencyType:"child",childGroups:["booleans","booleanLists"],skipComponentNames:!0}}},definition:function({dependencyValues:ns,componentInfoObjects:ss}){let os=0,ls=[],us=0;for(let[ds,ps]of ns.booleanAndBooleanListChildren.entries())if(ss.isInheritedComponentType({inheritedComponentType:ps.componentType,baseComponentType:"booleanList"})){let fs=ns.booleanListChildren[us];us++;for(let hs=0;hscs&&(os=cs,ls=ls.slice(0,cs)),{setValue:{nComponents:os,childIndexByArrayKey:ls},checkForActualChange:{nComponents:!0}}}},rs.booleans={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},isArray:!0,entryPrefixes:["boolean"],stateVariablesDeterminingDependencies:["childIndexByArrayKey"],returnArraySizeDependencies:()=>({nComponents:{dependencyType:"stateVariable",variableName:"nComponents"}}),returnArraySize({dependencyValues:ns}){return[ns.nComponents]},returnArrayDependenciesByKey({arrayKeys:ns,stateValues:ss}){let os={},ls={childIndexByArrayKey:{dependencyType:"stateVariable",variableName:"childIndexByArrayKey"}};for(let us of ns){let cs=[],ds="1";ss.childIndexByArrayKey[us]&&(cs=[ss.childIndexByArrayKey[us][0]],ds=ss.childIndexByArrayKey[us][1]+1),os[us]={booleanAndBooleanListChildren:{dependencyType:"child",childGroups:["booleans","booleanLists"],variableNames:["value","boolean"+ds],variablesOptional:!0,childIndices:cs}}}return{globalDependencies:ls,dependenciesByKey:os}},arrayDefinitionByKey({globalDependencyValues:ns,dependencyValuesByKey:ss,arrayKeys:os}){let ls={};for(let us of os){let cs=ss[us].booleanAndBooleanListChildren[0];if(cs)if(cs.stateValues.value!==void 0)ls[us]=cs.stateValues.value;else{let ds=ns.childIndexByArrayKey[us][1]+1;ls[us]=cs.stateValues["boolean"+ds]}}return{setValue:{booleans:ls}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ns,globalDependencyValues:ss,dependencyValuesByKey:os,dependencyNamesByKey:ls,arraySize:us}){let cs=[];for(let ds in ns.booleans){if(!os[ds])continue;let ps=os[ds].booleanAndBooleanListChildren[0];ps&&(ps.stateValues.value!==void 0?cs.push({setDependency:ls[ds].booleanAndBooleanListChildren,desiredValue:ns.booleans[ds],childIndex:0,variableIndex:0}):cs.push({setDependency:ls[ds].booleanAndBooleanListChildren,desiredValue:ns.booleans[ds],childIndex:0,variableIndex:1}))}return{success:!0,instructions:cs}}},rs.nValues={isAlias:!0,targetVariableName:"nComponents"},rs.values={isAlias:!0,targetVariableName:"booleans"},rs.componentNamesInList={returnDependencies:()=>({booleanAndBooleanListChildren:{dependencyType:"child",childGroups:["booleans","booleanLists"],variableNames:["componentNamesInList"],variablesOptional:!0},maximumNumber:{dependencyType:"stateVariable",variableName:"maximumNumber"}}),definition:function({dependencyValues:ns,componentInfoObjects:ss}){let os=[];for(let us of ns.booleanAndBooleanListChildren)ss.isInheritedComponentType({inheritedComponentType:us.componentType,baseComponentType:"booleanList"})?os.push(...us.stateValues.componentNamesInList):os.push(us.componentName);let ls=ns.maximumNumber;return ls!==null&&os.length>ls&&(ls=Math.max(0,Math.floor(ls)),os=os.slice(0,ls)),{setValue:{componentNamesInList:os}}}},rs.nComponentsToDisplayByChild={additionalStateVariablesDefined:["nChildrenToRender"],returnDependencies:()=>({nComponents:{dependencyType:"stateVariable",variableName:"nComponents"},booleanListChildren:{dependencyType:"child",childGroups:["booleanLists"],variableNames:["nComponents"]},booleanAndBooleanListChildren:{dependencyType:"child",childGroups:["booleans","booleanLists"],skipComponentNames:!0},parentNComponentsToDisplayByChild:{dependencyType:"parentStateVariable",parentComponentType:"booleanList",variableName:"nComponentsToDisplayByChild"}}),definition:function({dependencyValues:ns,componentInfoObjects:ss,componentName:os}){let ls=ns.nComponents;ns.parentNComponentsToDisplayByChild!==null&&(ls=ns.parentNComponentsToDisplayByChild[os]);let us={},cs=0,ds=0,ps=0;for(let fs of ns.booleanAndBooleanListChildren){let hs=Math.max(0,ls-cs);if(hs>0&&ds++,ss.isInheritedComponentType({inheritedComponentType:fs.componentType,baseComponentType:"booleanList"})){let gs=ns.booleanListChildren[ps];ps++;let ys=Math.min(hs,gs.stateValues.nComponents);us[gs.componentName]=ys,cs+=ys}else cs+=1}return{setValue:{nComponentsToDisplayByChild:us,nChildrenToRender:ds}}},markStale:()=>({updateRenderedChildren:!0})},rs}}zs(BooleanList,"componentType","booleanList"),zs(BooleanList,"rendererType","asList"),zs(BooleanList,"renderChildren",!0),zs(BooleanList,"includeBlankStringChildren",!0),zs(BooleanList,"removeBlankStringChildrenPostSugar",!0),zs(BooleanList,"stateVariableForAttributeValue","booleans"),zs(BooleanList,"descendantCompositesMustHaveAReplacement",!1);class Copy extends CompositeComponent{static createAttributesObject(){let rs=super.createAttributesObject();return delete rs.disabled,delete rs.modifyIndirectly,delete rs.fixed,delete rs.styleNumber,delete rs.isResponse,rs.assignNewNamespaces={createPrimitiveOfType:"boolean"},rs.assignNamesSkip={createPrimitiveOfType:"number"},rs.prop={createPrimitiveOfType:"string"},rs.obtainPropFromComposite={createPrimitiveOfType:"boolean",createStateVariable:"obtainPropFromComposite",defaultValue:!1,public:!0},rs.createComponentOfType={createPrimitiveOfType:"string"},rs.nComponents={createPrimitiveOfType:"number"},rs.componentIndex={createComponentOfType:"integer",createStateVariable:"componentIndex",defaultValue:null,public:!0},rs.sourceSubnames={createPrimitiveOfType:"stringArray",createStateVariable:"targetSubnames",defaultValue:null,public:!0},rs.sourceSubnamesComponentIndex={createComponentOfType:"numberList",createStateVariable:"targetSubnamesComponentIndex",defaultValue:null,public:!0},rs.propIndex={createComponentOfType:"numberList",createStateVariable:"propIndex",defaultValue:null,public:!0},rs.uri={createPrimitiveOfType:"string",createStateVariable:"uri",defaultValue:null,public:!0},rs.sourceAttributesToIgnore={createPrimitiveOfType:"stringArray",createStateVariable:"sourceAttributesToIgnore",defaultValue:["hide"],public:!0},rs.sourceAttributesToIgnoreRecursively={createPrimitiveOfType:"stringArray",createStateVariable:"sourceAttributesToIgnoreRecursively",defaultValue:["isResponse"],public:!0},rs.link={createPrimitiveOfType:"boolean"},rs.removeEmptyArrayEntries={createPrimitiveOfType:"boolean",createStateVariable:"removeEmptyArrayEntries",defaultValue:!1},rs}static keepChildrenSerialized({serializedComponent:rs}){return rs.children===void 0?[]:Object.keys(rs.children)}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.target={returnDependencies:()=>({target:{dependencyType:"doenetAttribute",attributeName:"target"}}),definition:({dependencyValues:ns})=>({setValue:{target:ns.target}})},rs.targetSourcesName={additionalStateVariablesDefined:[{variableName:"sourcesChildNumber",hasEssential:!0,shadowVariable:!0}],stateVariablesDeterminingDependencies:["target"],determineDependenciesImmediately:!0,hasEssential:!0,shadowVariable:!0,returnDependencies:function({stateValues:ns,sharedParameters:ss}){let os=ss.sourceNameMappings;if(!os)return{};let ls=os[ns.target];return ls?{targetSourcesName:{dependencyType:"value",value:ls.name},sourcesChildNumber:{dependencyType:"value",value:ls.childNumber}}:{}},definition:function({dependencyValues:ns}){let ss=ns.targetSourcesName,os=ns.sourcesChildNumber;return ss||(ss=null,os=null),{setValue:{targetSourcesName:ss,sourcesChildNumber:os},setEssentialValue:{targetSourcesName:ss,sourcesChildNumber:os}}}},rs.targetSources={stateVariablesDeterminingDependencies:["targetSourcesName"],determineDependenciesImmediately:!0,returnDependencies({stateValues:ns}){return ns.targetSourcesName?{targetSourcesComponent:{dependencyType:"componentIdentity",componentName:ns.targetSourcesName}}:{}},definition:function({dependencyValues:ns}){let ss=ns.targetSourcesComponent;return ss||(ss=null),{setValue:{targetSources:ss}}}},rs.sourceIndex={stateVariablesDeterminingDependencies:["target"],determineDependenciesImmediately:!0,hasEssential:!0,shadowVariable:!0,returnDependencies:function({stateValues:ns,sharedParameters:ss}){let os=ss.sourceIndexMappings;if(!os)return{};let ls=os[ns.target];return ls===void 0?{}:{sourceIndex:{dependencyType:"value",value:ls}}},definition:function({dependencyValues:ns}){let ss=ns.sourceIndex;return ss===void 0&&(ss=null),{setValue:{sourceIndex:ss},setEssentialValue:{sourceIndex:ss}}}},rs.targetComponent={shadowVariable:!0,stateVariablesDeterminingDependencies:["targetSources","sourceIndex"],determineDependenciesImmediately:!0,returnDependencies({stateValues:ns}){return ns.sourceIndex!==null?{}:ns.targetSources!==null?{targetSourcesChildren:{dependencyType:"stateVariable",componentName:ns.targetSources.componentName,variableName:"childIdentities"},sourcesChildNumber:{dependencyType:"stateVariable",variableName:"sourcesChildNumber"}}:{targetComponent:{dependencyType:"targetComponent"}}},definition:function({dependencyValues:ns}){let ss=null;return ns.targetSourcesChildren?(ss=ns.targetSourcesChildren[ns.sourcesChildNumber],ss||(ss=null)):ns.targetComponent&&(ss=ns.targetComponent),{setValue:{targetComponent:ss}}}},rs.targetInactive={stateVariablesDeterminingDependencies:["targetComponent"],returnDependencies({stateValues:ns}){return ns.targetComponent?{targetIsInactiveCompositeReplacement:{dependencyType:"stateVariable",componentName:ns.targetComponent.componentName,variableName:"isInactiveCompositeReplacement"}}:{}},definition:function({dependencyValues:ns}){return{setValue:{targetInactive:!!ns.targetIsInactiveCompositeReplacement}}}},rs.cid={additionalStateVariablesDefined:["doenetId"],returnDependencies:()=>({uri:{dependencyType:"stateVariable",variableName:"uri"}}),definition:function({dependencyValues:ns}){if(!ns.uri||ns.uri.substring(0,7).toLowerCase()!=="doenet:")return{setValue:{cid:null,doenetId:null}};let ss=null,os=null,ls=ns.uri.match(/[:&]cid=([^&]+)/i);return ls&&(ss=ls[1]),ls=ns.uri.match(/[:&]doenetid=([^&]+)/i),ls&&(os=ls[1]),{setValue:{cid:ss,doenetId:os}}}},rs.serializedComponentsForCid={returnDependencies:()=>({cid:{dependencyType:"stateVariable",variableName:"cid"},serializedChildren:{dependencyType:"serializedChildren",doNotProxy:!0}}),definition:function({dependencyValues:ns}){var ss;return ns.cid?((ss=ns.serializedChildren)==null?void 0:ss.length)>0?{setValue:{serializedComponentsForCid:ns.serializedChildren}}:{setValue:{serializedComponentsForCid:null}}:{setValue:{serializedComponentsForCid:null}}}},rs.propName={shadowVariable:!0,returnDependencies:()=>({propName:{dependencyType:"attributePrimitive",attributeName:"prop"}}),definition:function({dependencyValues:ns}){return{setValue:{propName:ns.propName}}}},rs.isPlainMacro={returnDependencies:()=>({isPlainMacro:{dependencyType:"doenetAttribute",attributeName:"isPlainMacro"},targetComponent:{dependencyType:"stateVariable",variableName:"targetComponent"},typeAttr:{dependencyType:"attributePrimitive",attributeName:"createComponentOfType"},targetSubnames:{dependencyType:"stateVariable",variableName:"targetSubnames"}}),definition:function({dependencyValues:ns,componentInfoObjects:ss}){var ls,us;let os=ns.isPlainMacro&&(!ss.isCompositeComponent({componentType:(ls=ns.targetComponent)==null?void 0:ls.componentType})||ns.targetSubnames);if(os&&ns.typeAttr){os=!1;let cs=ss.componentTypeLowerCaseMapping[ns.typeAttr.toLowerCase()],ds=ss.allComponentClasses[(us=ns.targetComponent)==null?void 0:us.componentType];if(ds){let ps=ss.publicStateVariableInfo[ds.componentType].stateVariableDescriptions[ds.variableForPlainMacro];cs!==ds.componentType&&ps&&(ps.createComponentOfType===void 0||ps.createComponentOfType===cs)&&(os=!0)}}return{setValue:{isPlainMacro:os}}}},rs.isPlainCopy={returnDependencies:()=>({isPlainCopy:{dependencyType:"doenetAttribute",attributeName:"isPlainCopy"},targetComponent:{dependencyType:"stateVariable",variableName:"targetComponent"},typeAttr:{dependencyType:"attributePrimitive",attributeName:"createComponentOfType"},targetSubnames:{dependencyType:"stateVariable",variableName:"targetSubnames"}}),definition:function({dependencyValues:ns,componentInfoObjects:ss}){var ls,us;let os=ns.isPlainCopy&&(!ss.isCompositeComponent({componentType:(ls=ns.targetComponent)==null?void 0:ls.componentType})||ns.targetSubnames);if(os&&ns.typeAttr){os=!1;let cs=ss.componentTypeLowerCaseMapping[ns.typeAttr.toLowerCase()],ds=ss.allComponentClasses[(us=ns.targetComponent)==null?void 0:us.componentType];if(ds){let ps=ss.publicStateVariableInfo[ds.componentType].stateVariableDescriptions[ds.variableForPlainCopy];cs!==ds.componentType&&ps&&(ps.createComponentOfType===void 0||ps.createComponentOfType===cs)&&(os=!0)}}return{setValue:{isPlainCopy:os}}}},rs.linkAttrForDetermineDeps={returnDependencies:()=>({linkAttr:{dependencyType:"attributePrimitive",attributeName:"link"}}),definition({dependencyValues:ns}){let ss;return ns.linkAttr===null?ss=!0:ss=ns.linkAttr,{setValue:{linkAttrForDetermineDeps:ss}}}},rs.replacementSourceIdentities={stateVariablesDeterminingDependencies:["targetComponent","componentIndex","propName","targetSubnames","targetSubnamesComponentIndex","obtainPropFromComposite","linkAttrForDetermineDeps"],additionalStateVariablesDefined:["addLevelToAssignNames"],returnDependencies:function({stateValues:ns,componentInfoObjects:ss}){let os={},ls=!1,us=!1;if(ns.targetComponent!==null){if(ss.isCompositeComponent({componentType:ns.targetComponent.componentType,includeNonStandard:!1})&&!(ns.propName&&ns.obtainPropFromComposite))if(ns.linkAttrForDetermineDeps){us=!0;let cs=ns.targetSubnamesComponentIndex;cs&&(cs=[...cs]),os.targets={dependencyType:"replacement",compositeName:ns.targetComponent.componentName,recursive:!0,componentIndex:ns.componentIndex,targetSubnames:ns.targetSubnames,targetSubnamesComponentIndex:cs}}else ls=!0;!us&&(ns.componentIndex===null||ns.componentIndex===1)&&(os.targets={dependencyType:"stateVariable",variableName:"targetComponent"})}return os.addLevelToAssignNames={dependencyType:"value",value:ls},os},definition({dependencyValues:ns}){let ss=null;return ns.targets&&(ss=ns.targets,Array.isArray(ss)||(ss=[ss])),{setValue:{replacementSourceIdentities:ss,addLevelToAssignNames:ns.addLevelToAssignNames}}}},rs.replacementSources={stateVariablesDeterminingDependencies:["replacementSourceIdentities","propName","propIndex","isPlainMacro","isPlainCopy"],additionalStateVariablesDefined:["effectivePropNameBySource"],returnDependencies:function({stateValues:ns,componentInfoObjects:ss}){let os={replacementSourceIdentities:{dependencyType:"stateVariable",variableName:"replacementSourceIdentities"},propIndex:{dependencyType:"stateVariable",variableName:"propIndex"}};if(!ns.propName&&ns.propIndex!==null)throw Error("You cannot specify a propIndex without specifying a prop.");if(ns.replacementSourceIdentities!==null)for(let[ls,us]of ns.replacementSourceIdentities.entries()){let cs=ns.propName;ns.isPlainMacro?cs=ss.allComponentClasses[us.componentType].variableForPlainMacro:ns.isPlainCopy&&(cs=ss.allComponentClasses[us.componentType].variableForPlainCopy);let ds;if(cs){os["propName"+ls]={dependencyType:"value",value:cs};let ps=ns.propIndex;ps&&(ps=[...ps]),ds={dependencyType:"stateVariable",componentName:us.componentName,variableName:cs,returnAsComponentObject:!0,variablesOptional:!0,propIndex:ps,caseInsensitiveVariableMatch:!0,publicStateVariablesOnly:!0,useMappedVariableNames:!0}}else ds={dependencyType:"componentIdentity",componentName:us.componentName};os["target"+ls]=ds}return os},definition({dependencyValues:ns}){let ss=null,os=null;if(ns.replacementSourceIdentities!==null){ss=[],os=[];for(let ls in ns.replacementSourceIdentities){let us=ns["target"+ls];if(us){ss.push(us);let cs;us.stateValues&&(cs=Object.keys(us.stateValues)[0]),!cs&&ns["propName"+ls]&&(cs="__prop_name_not_found"),os.push(cs)}}}return{setValue:{replacementSources:ss,effectivePropNameBySource:os}}}},rs.nComponentsSpecified={returnDependencies:()=>({nComponentsAttr:{dependencyType:"attributePrimitive",attributeName:"nComponents"},typeAttr:{dependencyType:"attributePrimitive",attributeName:"createComponentOfType"}}),definition({dependencyValues:ns,componentInfoObjects:ss}){let os;if(ns.typeAttr){if(!(ss.componentTypeLowerCaseMapping[ns.typeAttr.toLowerCase()]in ss.allComponentClasses))throw Error(`Invalid componentType ${ns.typeAttr} of copy.`);ns.nComponentsAttr!==null?os=ns.nComponentsAttr:os=1}else{if(ns.nComponentsAttr!==null)throw Error("You must specify createComponentOfType when specifying nComponents for a copy.");os=null}return{setValue:{nComponentsSpecified:os}}}},rs.link={returnDependencies:()=>({linkAttr:{dependencyType:"attributePrimitive",attributeName:"link"},serializedComponentsForCid:{dependencyType:"stateVariable",variableName:"serializedComponentsForCid"},replacementSourceIdentities:{dependencyType:"stateVariable",variableName:"replacementSourceIdentities"}}),definition({dependencyValues:ns,componentInfoObjects:ss}){let os;return ns.linkAttr===null?ns.serializedComponentsForCid||ns.replacementSourceIdentities&&ns.replacementSourceIdentities.some(ls=>ss.isInheritedComponentType({inheritedComponentType:ls.componentType,baseComponentType:"module"}))?os=!1:os=!0:os=ns.linkAttr!==!1,{setValue:{link:os}}}},rs.readyToExpandWhenResolved={stateVariablesDeterminingDependencies:["targetComponent","propName","obtainPropFromComposite","link"],returnDependencies({stateValues:ns,componentInfoObjects:ss}){let os={targetComponent:{dependencyType:"stateVariable",variableName:"targetComponent"},needsReplacementsUpdatedWhenStale:{dependencyType:"stateVariable",variableName:"needsReplacementsUpdatedWhenStale"},serializedComponentsForCid:{dependencyType:"stateVariable",variableName:"serializedComponentsForCid"},link:{dependencyType:"stateVariable",variableName:"link"}};return ns.targetComponent&&ss.isCompositeComponent({componentType:ns.targetComponent.componentType,includeNonStandard:!1})&&!(ns.propName&&ns.obtainPropFromComposite)&&(os.targetReadyToExpandWhenResolved={dependencyType:"stateVariable",componentName:ns.targetComponent.componentName,variableName:"readyToExpandWhenResolved"}),ns.link||(os.replacementSources={dependencyType:"stateVariable",variableName:"replacementSources"}),os},definition(){return{setValue:{readyToExpandWhenResolved:!0}}}},rs.needsReplacementsUpdatedWhenStale={stateVariablesDeterminingDependencies:["targetComponent","replacementSourceIdentities","effectivePropNameBySource","propName","obtainPropFromComposite","link","removeEmptyArrayEntries"],returnDependencies:function({stateValues:ns,componentInfoObjects:ss}){if(!ns.link)return{};let os={targetComponent:{dependencyType:"stateVariable",variableName:"targetComponent"},targetInactive:{dependencyType:"stateVariable",variableName:"targetInactive"},replacementSourceIdentities:{dependencyType:"stateVariable",variableName:"replacementSourceIdentities"},propIndex:{dependencyType:"stateVariable",variableName:"propIndex"}};if(ns.effectivePropNameBySource!==null){for(let[ls,us]of ns.effectivePropNameBySource.entries())if(us){let cs=ns.replacementSourceIdentities[ls];os["sourceArraySize"+ls]={dependencyType:"stateVariableArraySize",componentName:cs.componentName,variableName:us,variablesOptional:!0,caseInsensitiveVariableMatch:!0},os["sourceComponentType"+ls]={dependencyType:"stateVariableComponentType",componentName:cs.componentName,variableName:us,variablesOptional:!0,caseInsensitiveVariableMatch:!0}}}return ns.targetComponent!==null&&ss.isCompositeComponent({componentType:ns.targetComponent.componentType,includeNonStandard:!1})&&!(ns.propName&&ns.obtainPropFromComposite)&&(os.allReplacementIdentities={dependencyType:"replacement",compositeName:ns.targetComponent.componentName,recursive:!0,variableNames:["isInactiveCompositeReplacement"]}),ns.removeEmptyArrayEntries&&(os.replacementSources={dependencyType:"stateVariable",variableName:"replacementSources"}),os},markStale(){return{updateReplacements:!0}},definition:()=>({setValue:{needsReplacementsUpdatedWhenStale:!0}})},rs.effectiveAssignNames={returnDependencies:()=>({assignNames:{dependencyType:"doenetAttribute",attributeName:"assignNames"},addLevelToAssignNames:{dependencyType:"stateVariable",variableName:"addLevelToAssignNames"}}),definition({dependencyValues:ns}){let ss=ns.assignNames;return ss&&ns.addLevelToAssignNames&&(ss=[ss]),{setValue:{effectiveAssignNames:ss}}}},rs}static async createSerializedReplacements({component:rs,components:ns,workspace:ss,componentInfoObjects:os,flags:ls,resolveItem:us,publicCaseInsensitiveAliasSubstitutions:cs}){var ws,Es,_s,$s,Rs;await rs.stateValues.nComponentsSpecified,ss.numReplacementsBySource=[],ss.numNonStringReplacementsBySource=[],ss.propVariablesCopiedBySource=[],ss.sourceNames=[],ss.uniqueIdentifiersUsedBySource={};let ds=(ws=rs.attributes.newNamespace)==null?void 0:ws.primitive,ps=this.createAttributesObject(),fs=await rs.stateValues.effectiveAssignNames,hs=await rs.stateValues.serializedComponentsForCid;if(hs){let Is=deepClone([hs[0]]),Os=deepClone(hs.slice(1));if(Is[0].children){let ks;if(Is[0].componentName?ks=Is[0].componentName+"/":ks=Is[0].originalName+"/",rs.doenetAttributes.keptNewNamespaceOfLastChild){ks=ks.slice(0,ks.length-1);let Ps=ks.lastIndexOf("/");ks=ks.slice(0,Ps+1)}restrictTNamesToNamespace({components:Is[0].children,namespace:ks,invalidateReferencesToBaseNamespace:rs.doenetAttributes.keptNewNamespaceOfLastChild})}if(Is[0].componentType==="externalContent")for(let ks of Is[0].children){if(typeof ks!="object")continue;ks.attributes||(ks.attributes={});let Ps=convertAttributesForComponentType({attributes:rs.attributes,componentType:ks.componentType,componentInfoObjects:os,compositeAttributesObj:ps,compositeCreatesNewNamespace:ds,flags:ls});for(let Bs in Ps){let Ms=Ps[Bs];Ms.component?setTNamesToAbsolute([Ms.component]):Ms.childrenForComponent&&setTNamesToAbsolute(Ms.childrenForComponent)}Object.assign(ks.attributes,Ps)}else{Is[0].attributes||(Is[0].attributes={});let ks=convertAttributesForComponentType({attributes:rs.attributes,componentType:Is[0].componentType,componentInfoObjects:os,compositeAttributesObj:ps,compositeCreatesNewNamespace:ds,flags:ls});for(let Ps in ks){let Bs=ks[Ps];Bs.component?setTNamesToAbsolute([Bs.component]):Bs.childrenForComponent&&setTNamesToAbsolute(Bs.childrenForComponent)}Object.assign(Is[0].attributes,ks)}return Is=processAssignNames({assignNames:fs,assignNewNamespaces:(Es=rs.attributes.assignNewNamespaces)==null?void 0:Es.primitive,serializedComponents:Is,parentName:rs.componentName,parentCreatesNewNamespace:ds,componentInfoObjects:os}).serializedComponents,rs.doenetAttributes.fromCopyFromURI&&Os.length>0&&this.addChildrenFromComposite({replacements:Is,children:Os,assignNewNamespaces:(_s=rs.attributes.assignNewNamespaces)==null?void 0:_s.primitive,componentInfoObjects:os}),{replacements:(await verifyReplacementsMatchSpecifiedType({component:rs,replacements:Is,assignNames:fs,workspace:ss,componentInfoObjects:os,compositeAttributesObj:ps,flags:ls})).replacements}}let gs=await rs.stateValues.sourceIndex;if(gs!==null){let Os=[{componentType:"number",attributes:convertAttributesForComponentType({attributes:rs.attributes,componentType:"number",componentInfoObjects:os,compositeAttributesObj:ps,compositeCreatesNewNamespace:ds,flags:ls}),state:{value:gs,fixed:!0}}],Ds=processAssignNames({assignNames:fs,serializedComponents:Os,parentName:rs.componentName,parentCreatesNewNamespace:ds,componentInfoObjects:os});return{replacements:(await verifyReplacementsMatchSpecifiedType({component:rs,replacements:Ds.serializedComponents,assignNames:fs,workspace:ss,componentInfoObjects:os,compositeAttributesObj:ps,flags:ls})).replacements}}let ys=await rs.stateValues.replacementSourceIdentities;if(!await rs.stateValues.targetComponent||!ys){let Is=[];if(rs.doenetAttributes.fromCopyTarget){let Ds=os.componentTypeLowerCaseMapping[rs.attributes.createComponentOfType.primitive.toLowerCase()],Vs=os.allComponentClasses[Ds],ks=convertAttributesForComponentType({attributes:rs.attributes,componentType:Ds,componentInfoObjects:os,compositeAttributesObj:ps,compositeCreatesNewNamespace:ds,flags:ls});ss.uniqueIdentifiersUsedBySource[0]=[];let Ps=Ds+"|empty",Bs=getUniqueIdentifierFromBase(Ps,ss.uniqueIdentifiersUsedBySource[0]),Ms=deepClone(rs.serializedChildren);Vs.includeBlankStringChildren||(Ms=Ms.filter(js=>typeof js!="string"||js.trim()!==""));let Ws=ks;($s=rs.attributes.assignNewNamespaces)!=null&&$s.primitive&&(Ws.newNamespace={primitive:!0}),Is=[{componentType:Ds,attributes:Ws,children:Ms,uniqueIdentifier:Bs}],Is=processAssignNames({assignNames:fs,serializedComponents:Is,parentName:rs.componentName,componentInfoObjects:os,originalNamesAreConsistent:!0}).serializedComponents,ss.numReplacementsBySource.push(Is.length),ss.numNonStringReplacementsBySource.push(Is.filter(js=>typeof js!="string").length)}return{replacements:(await verifyReplacementsMatchSpecifiedType({component:rs,replacements:Is,assignNames:fs,workspace:ss,componentInfoObjects:os,compositeAttributesObj:ps})).replacements}}let bs=await us({componentName:rs.componentName,type:"determineDependencies",stateVariable:"replacementSources",dependency:"__determine_dependencies",expandComposites:!1});if(!bs.success)throw Error(`Couldn't resolve determineDependencies of replacementSources of ${rs.componentName}`);let vs=await rs.stateValues.effectivePropNameBySource;for(let Is in ys)if(vs[Is]&&(bs=await us({componentName:rs.componentName,type:"recalculateDownstreamComponents",stateVariable:"replacementSources",dependency:"target"+Is,expandComposites:!1}),!bs.success))throw Error(`Couldn't resolve recalculateDownstreamComponents for target${Is} of replacementSources of ${rs.componentName}`);let xs=[],Cs=[],Ts=[],Ss=0,Ns=0;for(let Is in ys){let Os=ss.uniqueIdentifiersUsedBySource[Is]=[],Ds;if((Rs=rs.attributes.createComponentOfType)!=null&&Rs.primitive){let Ps=await rs.stateValues.nComponentsSpecified,Bs=ys.length;Ds=Math.floor(Ps/Bs);let Ms=Ps%Bs;Istypeof Ps!="string").length,Ss+=Cs[Is],Ns+=Ts[Is],xs.push(...ks)}return ss.numReplacementsBySource=Cs,ss.numNonStringReplacementsBySource=Ts,ss.sourceNames=ys.map(Is=>Is.componentName),{replacements:(await verifyReplacementsMatchSpecifiedType({component:rs,replacements:xs,assignNames:fs,workspace:ss,componentInfoObjects:os,compositeAttributesObj:ps,flags:ls})).replacements}}static async createReplacementForSource({component:rs,sourceNum:ns,components:ss,numReplacementsSoFar:os,numNonStringReplacementsSoFar:ls,uniqueIdentifiersUsed:us,compositeAttributesObj:cs,componentInfoObjects:ds,nComponentsForSource:ps,publicCaseInsensitiveAliasSubstitutions:fs,flags:hs,fromCopyTarget:gs}){var Es,_s,$s,Rs,Is,Os;let ys=(await rs.stateValues.replacementSourceIdentities)[ns];if(typeof ys!="object")return{serializedReplacements:[ys]};let bs=ss[ys.componentName],vs=await rs.stateValues.link;(!vs||await rs.stateValues.removeEmptyArrayEntries)&&(ys=(await rs.stateValues.replacementSources)[ns]);let xs=(Es=rs.attributes.newNamespace)==null?void 0:Es.primitive,Cs=await rs.stateValues.effectiveAssignNames,Ts=(await rs.stateValues.effectivePropNameBySource)[ns];if(Ts){let Ds=await replacementFromProp({component:rs,components:ss,replacementSource:ys,propName:Ts,numReplacementsSoFar:os,numNonStringReplacementsSoFar:ls,uniqueIdentifiersUsed:us,compositeAttributesObj:cs,componentInfoObjects:ds,nComponentsForSource:ps,publicCaseInsensitiveAliasSubstitutions:fs,flags:hs});return{serializedReplacements:processAssignNames({assignNames:Cs,serializedComponents:Ds.serializedReplacements,parentName:rs.componentName,parentCreatesNewNamespace:xs,indOffset:ls,componentInfoObjects:ds}).serializedComponents,propVariablesCopiedByReplacement:Ds.propVariablesCopiedByReplacement}}let Ss=await rs.stateValues.sourceAttributesToIgnore,Ns=await rs.stateValues.sourceAttributesToIgnoreRecursively,As=[await bs.serialize({copyAll:!vs,copyVariants:!vs,sourceAttributesToIgnore:Ss,sourceAttributesToIgnoreRecursively:Ns})];!vs&&((_s=As[0].state)==null?void 0:_s.fixed)!==void 0&&delete As[0].state.fixed,As=postProcessCopy({serializedComponents:As,componentName:rs.componentName,uniqueIdentifiersUsed:us,addShadowDependencies:vs,unlinkExternalCopies:!vs}),As.length>0&&delete As[0].doenetAttributes.haveNewNamespaceOnlyFromShadow;for(let Ds of As){if(typeof Ds!="object")continue;Ds.attributes||(Ds.attributes={});let Vs=convertAttributesForComponentType({attributes:rs.attributes,componentType:Ds.componentType,componentInfoObjects:ds,compositeAttributesObj:cs,compositeCreatesNewNamespace:xs,flags:hs});Object.assign(Ds.attributes,Vs)}return($s=As[0].attributes.newNamespace)!=null&&$s.primitive&&!((Rs=rs.attributes.assignNewNamespaces)!=null&&Rs.primitive)&&(As[0].doenetAttributes.haveNewNamespaceOnlyFromShadow=!0),As=processAssignNames({assignNames:Cs,assignNewNamespaces:(Is=rs.attributes.assignNewNamespaces)==null?void 0:Is.primitive,serializedComponents:As,parentName:rs.componentName,parentCreatesNewNamespace:xs,indOffset:ls,componentInfoObjects:ds,originalNamesAreConsistent:xs&&!Cs}).serializedComponents,gs&&As.length===1&&rs.serializedChildren.length>0&&this.addChildrenFromComposite({replacements:As,children:rs.serializedChildren,assignNewNamespaces:(Os=rs.attributes.assignNewNamespaces)==null?void 0:Os.primitive,componentInfoObjects:ds}),{serializedReplacements:As}}static addChildrenFromComposite({replacements:rs,children:ns,assignNewNamespaces:ss,componentInfoObjects:os}){var ps,fs;let ls=rs[0];ls.children||(ls.children=[]);let us=deepClone(ns);if(os.allComponentClasses[ls.componentType].includeBlankStringChildren||(us=us.filter(hs=>typeof hs!="string"||hs.trim()!=="")),(ps=rs[0].attributes.newNamespace)!=null&&ps.primitive&&ss){let hs=countRegularComponentTypesInNamespace(ls.children);renameAutonameBasedOnNewCounts(us,hs)}let ds=processAssignNames({serializedComponents:us,parentName:rs[0].componentName,parentCreatesNewNamespace:ss,componentInfoObjects:os,originalNamesAreConsistent:!0});if((fs=rs[0].attributes.newNamespace)!=null&&fs.primitive&&!ss)for(let hs of ds.serializedComponents)typeof hs=="object"&&(hs.doenetAttributes.ignoreParentNewNamespace=!0);ls.children.push(...ds.serializedComponents)}static async calculateReplacementChanges({component:rs,componentChanges:ns,components:ss,workspace:os,componentInfoObjects:ls,flags:us,resolveItem:cs,publicCaseInsensitiveAliasSubstitutions:ds}){var _s;if(await rs.stateValues.serializedComponentsForCid)return[];if(await rs.stateValues.sourceIndex!==null)return[];let ps=this.createAttributesObject(),fs=await rs.stateValues.effectiveAssignNames,hs=await rs.stateValues.replacementSourceIdentities;if(!await rs.stateValues.targetComponent||!hs){if(await rs.stateValues.targetSources)return[];{let $s=[];if(rs.replacements.length>0){let Os={changeType:"delete",changeTopLevelReplacements:!0,firstReplacementInd:0,numberReplacementsToDelete:rs.replacements.length};$s.push(Os)}let Rs=os.sourceNames.length===0;os.sourceNames=[],os.numReplacementsBySource=[],os.numNonStringReplacementsBySource=[],os.propVariablesCopiedBySource=[];let Is=await verifyReplacementsMatchSpecifiedType({component:rs,replacementChanges:$s,assignNames:fs,workspace:os,componentInfoObjects:ls,compositeAttributesObj:ps,flags:us});return Rs?[]:Is.replacementChanges}}if(await rs.stateValues.targetInactive){let $s=[],Rs=rs.replacements.length;if(Rs>0){if(rs.replacementsToWithhold!==Rs){let Os={changeType:"changeReplacementsToWithhold",replacementsToWithhold:Rs};$s.push(Os)}$s=(await verifyReplacementsMatchSpecifiedType({component:rs,replacementChanges:$s,assignNames:fs,workspace:os,componentInfoObjects:ls,compositeAttributesObj:ps,flags:us})).replacementChanges}return $s}let gs=await cs({componentName:rs.componentName,type:"determineDependencies",stateVariable:"replacementSources",dependency:"__determine_dependencies",expandComposites:!1});if(!gs.success)throw Error(`Couldn't resolve determineDependencies of replacementSources of ${rs.componentName}`);let ys=await rs.stateValues.effectivePropNameBySource;for(let $s in hs)if(ys[$s]&&(gs=await cs({componentName:rs.componentName,type:"recalculateDownstreamComponents",stateVariable:"replacementSources",dependency:"target"+$s,expandComposites:!1}),!gs.success))throw Error(`Couldn't resolve recalculateDownstreamComponents for target${$s} of replacementSources of ${rs.componentName}`);let bs=[];if(rs.replacementsToWithhold>0){let $s={changeType:"changeReplacementsToWithhold",replacementsToWithhold:0};bs.push($s)}let vs=0,xs=0,Cs=[],Ts=[],Ss=[],Ns=Math.max(hs.length,os.numReplacementsBySource.length),As=!1;for(let $s=0;$s0){if(!As){let js=os.numReplacementsBySource.slice($s).reduce((Ls,Gs)=>Ls+Gs,0);if(js>0){let Ls={changeType:"delete",changeTopLevelReplacements:!0,firstReplacementInd:vs,numberReplacementsToDelete:js};bs.push(Ls)}As=!0,os.numReplacementsBySource.slice($s).forEach((Ls,Gs)=>os.numReplacementsBySource[Gs]=0),os.numNonStringReplacementsBySource.slice($s).forEach((Ls,Gs)=>os.numNonStringReplacementsBySource[Gs]=0)}os.uniqueIdentifiersUsedBySource[$s]=[]}Cs[$s]=0,Ts[$s]=0,Ss.push([]);continue}let Os=os.sourceNames[$s],Ds=Os===void 0||Is.componentName!==Os||As;if(!Ds)for(let js=0;jsNl+xl,0);Ys.numberReplacementsToReplace=Xs,As=!0,os.numReplacementsBySource.slice($s).forEach((Nl,xl)=>os.numReplacementsBySource[xl]=0),os.numNonStringReplacementsBySource.slice($s).forEach((Nl,xl)=>os.numNonStringReplacementsBySource[xl]=0)}bs.push(Ys);continue}if(!ys[$s]&&os.numReplacementsBySource[$s]>0){vs+=os.numReplacementsBySource[$s],xs+=os.numNonStringReplacementsBySource[$s],Cs[$s]=os.numReplacementsBySource[$s],Ts[$s]=os.numNonStringReplacementsBySource[$s];continue}let Vs=os.uniqueIdentifiersUsedBySource[$s]=[],ks=await this.createReplacementForSource({component:rs,sourceNum:$s,components:ss,numReplacementsSoFar:vs,numNonStringReplacementsSoFar:xs,uniqueIdentifiersUsed:Vs,compositeAttributesObj:ps,componentInfoObjects:ls,nComponentsForSource:Rs,publicCaseInsensitiveAliasSubstitutions:ds,flags:us}),Ps=ks.propVariablesCopiedByReplacement,Bs=ks.serializedReplacements,Ms=Bs.length,Ws=os.numReplacementsBySource[$s];if(Ms!==Ws){let js=os.numReplacementsBySource.slice($s).reduce((Gs,Hs)=>Gs+Hs,0),Ls={changeType:"add",changeTopLevelReplacements:!0,firstReplacementInd:vs,numberReplacementsToReplace:js,serializedReplacements:Bs,assignNamesOffset:xs};bs.push(Ls),As=!0,os.numReplacementsBySource.slice($s).forEach((Gs,Hs)=>os.numReplacementsBySource[Hs]=0),os.numNonStringReplacementsBySource.slice($s).forEach((Gs,Hs)=>os.numNonStringReplacementsBySource[Hs]=0)}else{let js=0;for(let Ls=0;LsYs!==Ps[Ls][Xs])?(Hs=!1,Gs=!0):rs.replacements[vs+Ls].componentType!==Bs[Ls].componentType&&(Gs=!0)),Ls==0&&Gs&&Hs&&await rs.stateValues.nComponentsSpecified===1&&Ms===1&&!(rs.replacementsToWithhold>0)&&os.sourceNames.length===1&&(Gs=!1),Gs){let Ys={changeType:"add",changeTopLevelReplacements:!0,firstReplacementInd:vs+Ls,numberReplacementsToReplace:1,serializedReplacements:[Bs[Ls]],assignNamesOffset:xs+js};bs.push(Ys)}typeof Bs[Ls]!="string"&&js++}}let Us=Bs.filter(js=>typeof js!="string").length;vs+=Ms,xs+=Us,Cs[$s]=Ms,Ts[$s]=Us,Ss[$s]=Ps}let ws=os.sourceNames.length===0;os.numReplacementsBySource=Cs,os.numNonStringReplacementsBySource=Ts,os.sourceNames=hs.map($s=>$s.componentName),os.propVariablesCopiedBySource=Ss;let Es=await verifyReplacementsMatchSpecifiedType({component:rs,replacementChanges:bs,assignNames:fs,workspace:os,componentInfoObjects:ls,compositeAttributesObj:ps,flags:us});return ws&&os.sourceNames.length===0?[]:Es.replacementChanges}static async recreateReplacements({component:rs,sourceNum:ns,numReplacementsSoFar:ss,numNonStringReplacementsSoFar:os,numReplacementsToDelete:ls,uniqueIdentifiersUsed:us,components:cs,compositeAttributesObj:ds,componentInfoObjects:ps,nComponentsForSource:fs,publicCaseInsensitiveAliasSubstitutions:hs,flags:gs}){let ys=await this.createReplacementForSource({component:rs,sourceNum:ns,numReplacementsSoFar:ss,numNonStringReplacementsSoFar:os,components:cs,uniqueIdentifiersUsed:us,compositeAttributesObj:ds,componentInfoObjects:ps,nComponentsForSource:fs,publicCaseInsensitiveAliasSubstitutions:hs,flags:gs}),bs=ys.propVariablesCopiedByReplacement,vs=ys.serializedReplacements,xs={changeType:"add",changeTopLevelReplacements:!0,firstReplacementInd:ss,numberReplacementsToReplace:ls,serializedReplacements:vs,assignNamesOffset:os};return{numReplacements:vs.length,numNonStringReplacements:vs.filter(Cs=>typeof Cs!="string").length,propVariablesCopiedByReplacement:bs,replacementInstruction:xs}}}zs(Copy,"componentType","copy"),zs(Copy,"assignNamesToReplacements",!0),zs(Copy,"acceptTarget",!0),zs(Copy,"acceptAnyAttribute",!0),zs(Copy,"includeBlankStringChildren",!0),zs(Copy,"stateVariableToEvaluateAfterReplacements","needsReplacementsUpdatedWhenStale");async function replacementFromProp({component:as,components:rs,replacementSource:ns,propName:ss,uniqueIdentifiersUsed:os,compositeAttributesObj:ls,componentInfoObjects:us,nComponentsForSource:cs,publicCaseInsensitiveAliasSubstitutions:ds,flags:ps}){var Ss,Ns,As,ws,Es,_s,$s,Rs,Is,Os;let fs=[],hs=[],gs=(Ss=as.attributes.newNamespace)==null?void 0:Ss.primitive,ys=-1,bs=rs[ns.componentName],vs=ds({stateVariables:[ss],componentClass:bs.constructor})[0];if(vs===void 0||vs.slice(0,12)==="__not_public")return ss!=="__prop_name_not_found"&&console.warn(`Could not find prop ${ss} on a component of type ${ns.componentType}`),{serializedReplacements:[],propVariablesCopiedByReplacement:[]};let xs=bs.state[vs],Cs=await xs.value,Ts=await as.stateValues.link;if(xs.isArray||xs.isArrayEntry){let Ds,Vs,ks,Ps;if(xs.isArray?(Ds=xs,ks=await xs.arraySize,Vs=xs.getAllArrayKeys(ks,!1)):(Ds=bs.state[xs.arrayStateVariable],Vs=await xs.unflattenedArrayKeys,Ps=await xs.arrayKeys),(Ns=Ds.shadowingInstructions)!=null&&Ns.hasVariableComponentType&&(await as.stateValues.replacementSources,!Ds.shadowingInstructions.createComponentOfType))return{serializedReplacements:[],propVariablesCopiedByReplacement:[]};let Bs=xs.wrappingComponents,Ms=Bs.length,Ws=cs;if(xs.isArray)Ws=ks.slice(0,ks.length-Ms).reduce((Us,js)=>Us*js,1);else if(Ps.length===0)Ws=0;else if(Ms===0)Ws=Ps.length;else if(Ms>=xs.nDimensions)Ws=1;else if(Ms===xs.nDimensions-1)Ws=Vs.length;else{let Us=xs.nDimensions-Ms-1;Ws=flattenLevels(Vs,Us).length}if(Ms===0){let Us=flattenDeep(Vs);for(let js=0;js1)for(let Ml of Gs){let Zs=await Us(Ml,Hs-1);Ys.push(...Zs.pieces),Xs.push(...Zs.propVariablesCopiedByPiece)}else for(let Ml of Gs){let Zs=Ds.arrayVarNameFromArrayKey(Ml),qs=[Zs],Qs=ns.componentName+"|shadow|"+Zs,Js=getUniqueIdentifierFromBase(Qs,os),El=Ds.shadowingInstructions.createComponentOfType;Array.isArray(El)&&(El=El[Ds.keyToIndex(Ml)]);let _l;if(Ds.shadowingInstructions.addAttributeComponentsShadowingStateVariables){_l={};for(let yl in Ds.shadowingInstructions.addAttributeComponentsShadowingStateVariables){let Al=Ds.shadowingInstructions.addAttributeComponentsShadowingStateVariables[yl].stateVariableToShadow,Sl=bs.state[Al];Sl.isArray&&(Al=Sl.arrayVarNameFromArrayKey(Ml)),_l[yl]={stateVariableToShadow:Al}}}let Ks;if(Ds.shadowingInstructions.addStateVariablesShadowingStateVariables){Ks={};for(let yl in Ds.shadowingInstructions.addStateVariablesShadowingStateVariables){let Al=Ds.shadowingInstructions.addStateVariablesShadowingStateVariables[yl].stateVariableToShadow,Sl=bs.state[Al];Sl.isArray&&(Al=Sl.arrayVarNameFromArrayKey(Ml)),Ks[yl]={stateVariableToShadow:Al}}}if(Ts){let yl={};if(_l){let Sl=us.allComponentClasses[El].createAttributesObject();for(let Vl in _l){let Fs=_l[Vl].stateVariableToShadow,Tl={componentType:Sl[Vl].createComponentOfType,downstreamDependencies:{[bs.componentName]:[{compositeName:as.componentName,dependencyType:"referenceShadow",propVariable:Fs}]}};yl[Vl]={component:Tl}}}Ys.push({componentType:El,attributes:yl,downstreamDependencies:{[ns.componentName]:[{dependencyType:"referenceShadow",compositeName:as.componentName,propVariable:Zs,additionalStateVariableShadowing:Ks}]},uniqueIdentifier:Js})}else{let yl={};if(_l){let Tl={};for(let Xl in _l){let Pl=_l[Xl].stateVariableToShadow,Bl=bs.state[Pl],Wl=await Bl.value;Bl.isArray&&(Wl=Wl[Bl.keyToIndex[Ml]]),bs.state[Pl].usedDefault||(Tl[Xl]=Wl)}let zl=convertAttributesForComponentType({attributes:Tl,componentType:El,componentInfoObjects:us,flags:ps});if(xs.shadowingInstructions.attributesToShadow)for(let Xl of xs.shadowingInstructions.attributesToShadow)(xl=bs.attributes[Xl])!=null&&xl.component?zl[Xl]={component:await((Dl=bs.attributes[Xl])==null?void 0:Dl.component.serialize({copyAll:!0,copyVariants:!0}))}:((Rl=bs.attributes[Xl])==null?void 0:Rl.primitive)!==void 0&&(zl[Xl]={primitive:JSON.parse(JSON.stringify(bs.attributes[Xl].primitive))});Object.assign(yl,zl)}let Al="value",Sl=us.allComponentClasses[El];Sl.primaryEssentialStateVariable?Al=Sl.primaryEssentialStateVariable:Sl.primaryStateVariableForDefinition&&(Al=Sl.primaryStateVariableForDefinition);let Vl=Ds.keyToIndex(Ml);Array.isArray(Vl)||(Vl=[Vl]);let Fs=await Ds.value;for(let Tl of Vl)Fs=Fs[Tl];let Cl={componentType:El,attributes:yl,state:{[Al]:Fs},uniqueIdentifier:Js};Ys.push(Cl)}Xs.push(qs)}let Nl=Bs[Hs-1];if(Ys.length>0&&Nl&&Nl.length>0){for(let Ml=Nl.length-1;Ml>=0;Ml--){let Zs=typeof Nl[Ml]=="object"?Nl[Ml].componentType:Nl[Ml],qs=Zs+"|wrapper",Qs=getUniqueIdentifierFromBase(qs,os),Js=[],El={};for(let _l of Ys)if(_l.isAttribute){let Ks=_l.isAttribute;delete _l.isAttribute,El[Ks]={component:_l}}else Js.push(_l);Ys=[{componentType:Zs,children:Js,attributes:El,uniqueIdentifier:Qs,skipSugar:!0}],typeof Nl[Ml]=="object"&&(Nl[Ml].doenetAttributes&&(Ys[0].doenetAttributes=Object.assign({},Nl[Ml].doenetAttributes)),Nl[Ml].isAttribute&&(Ys[0].isAttribute=Nl[Ml].isAttribute))}Xs=[flattenDeep(Xs)]}return{pieces:Ys,propVariablesCopiedByPiece:Xs}},js=await Us(Vs,xs.nDimensions),Ls=js.pieces;hs=js.propVariablesCopiedByPiece;for(let Gs of Ls){if(typeof Gs!="object")continue;Gs.attributes||(Gs.attributes={});let Hs=convertAttributesForComponentType({attributes:as.attributes,componentType:Gs.componentType,componentInfoObjects:us,compositeAttributesObj:ls,compositeCreatesNewNamespace:gs,flags:ps});Object.assign(Gs.attributes,Hs),Ts&&(Gs.downstreamDependencies={[ns.componentName]:[{dependencyType:"referenceShadow",compositeName:as.componentName,propVariable:vs,ignorePrimaryStateVariable:!0}]})}if(ys+=Ls.length,fs.push(...Ls),Ls.length0?typeof Ys[0]=="object"?(Hs=Ys[0].componentType,Xs=Object.assign({},Ys[0].doenetAttributes)):Hs=Ys[0]:(Hs=Ds.shadowingInstructions.createComponentOfType,Array.isArray(Hs)&&(xs.isArrayEntry?Hs=Hs[Ds.keyToIndex(Ps[Gs])]:Hs=Hs[Gs]));let Nl=Hs+"|empty",xl=getUniqueIdentifierFromBase(Nl,os),Dl={componentType:Hs,uniqueIdentifier:xl};Xs&&(Dl.doenetAttributes=Xs),fs.push(Dl)}else if(Ls>Ws)throw Error(`Something went wrong when creating replacements for ${as.componentName} as we ended up with too many replacements`)}}else{if((_s=xs.shadowingInstructions)!=null&&_s.hasVariableComponentType&&await xs.value,!(($s=xs.shadowingInstructions)!=null&&$s.createComponentOfType))return{serializedReplacements:[],propVariablesCopiedByReplacement:[]};ys++,(hs[ys]=[]).push(vs);let Vs=bs.componentName+"|shadow|"+vs,ks=getUniqueIdentifierFromBase(Vs,os);if(xs.shadowingInstructions.createComponentOfType==="string")fs.push(await xs.value);else{let Ps=convertAttributesForComponentType({attributes:as.attributes,componentType:xs.shadowingInstructions.createComponentOfType,componentInfoObjects:us,compositeAttributesObj:ls,compositeCreatesNewNamespace:gs,flags:ps});if(Ts){let Bs={};if(xs.shadowingInstructions.addAttributeComponentsShadowingStateVariables){let Ws=us.allComponentClasses[xs.shadowingInstructions.createComponentOfType].createAttributesObject();for(let Us in xs.shadowingInstructions.addAttributeComponentsShadowingStateVariables){let js=xs.shadowingInstructions.addAttributeComponentsShadowingStateVariables[Us].stateVariableToShadow,Gs={componentType:Ws[Us].createComponentOfType,downstreamDependencies:{[bs.componentName]:[{compositeName:as.componentName,dependencyType:"referenceShadow",propVariable:js}]}};Bs[Us]={component:Gs}}}Object.assign(Bs,Ps),fs.push({componentType:xs.shadowingInstructions.createComponentOfType,attributes:Bs,downstreamDependencies:{[bs.componentName]:[{dependencyType:"referenceShadow",compositeName:as.componentName,propVariable:vs,additionalStateVariableShadowing:xs.shadowingInstructions.addStateVariablesShadowingStateVariables}]},uniqueIdentifier:ks})}else{let Bs={};if(xs.shadowingInstructions.addAttributeComponentsShadowingStateVariables){let js={};for(let Gs in xs.shadowingInstructions.addAttributeComponentsShadowingStateVariables)if(Gs!=="fixed"){let Hs=xs.shadowingInstructions.addAttributeComponentsShadowingStateVariables[Gs].stateVariableToShadow,Ys=await bs.state[Hs].value;bs.state[Hs].usedDefault||(js[Gs]=Ys)}let Ls=convertAttributesForComponentType({attributes:js,componentType:xs.shadowingInstructions.createComponentOfType,componentInfoObjects:us,flags:ps});if(xs.shadowingInstructions.attributesToShadow)for(let Gs of xs.shadowingInstructions.attributesToShadow)(Rs=bs.attributes[Gs])!=null&&Rs.component?Ls[Gs]={component:await((Is=bs.attributes[Gs])==null?void 0:Is.component.serialize({copyAll:!0,copyVariants:!0}))}:((Os=bs.attributes[Gs])==null?void 0:Os.primitive)!==void 0&&(Ls[Gs]={primitive:JSON.parse(JSON.stringify(bs.attributes[Gs].primitive))});Object.assign(Bs,Ls)}Object.assign(Bs,Ps);let Ms="value",Ws=us.allComponentClasses[xs.shadowingInstructions.createComponentOfType];Ws.primaryEssentialStateVariable?Ms=Ws.primaryEssentialStateVariable:Ws.primaryStateVariableForDefinition&&(Ms=Ws.primaryStateVariableForDefinition);let Us={componentType:xs.shadowingInstructions.createComponentOfType,attributes:Bs,state:{[Ms]:Cs},uniqueIdentifier:ks};fs.push(Us)}}}return{serializedReplacements:fs,propVariablesCopiedByReplacement:hs}}class Extract extends CompositeComponent{static createAttributesObject(){let rs=super.createAttributesObject();return delete rs.disabled,delete rs.modifyIndirectly,delete rs.fixed,delete rs.styleNumber,delete rs.isResponse,rs.assignNamesSkip={createPrimitiveOfType:"number"},rs.prop={createPrimitiveOfType:"string"},rs.createComponentOfType={createPrimitiveOfType:"string"},rs.nComponents={createPrimitiveOfType:"number"},rs.componentIndex={createComponentOfType:"integer",createStateVariable:"componentIndex",defaultValue:null,public:!0},rs.propIndex={createComponentOfType:"numberList",createStateVariable:"propIndex",defaultValue:null,public:!0},rs}static returnChildGroups(){return[{group:"anything",componentTypes:["_base"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.nComponentsSpecified={returnDependencies:()=>({nComponentsAttr:{dependencyType:"attributePrimitive",attributeName:"nComponents"},typeAttr:{dependencyType:"attributePrimitive",attributeName:"createComponentOfType"}}),definition({dependencyValues:ns,componentInfoObjects:ss}){let os;if(ns.typeAttr){if(!(ss.componentTypeLowerCaseMapping[ns.typeAttr.toLowerCase()]in ss.allComponentClasses))throw Error(`Invalid componentType ${ns.typeAttr} of copy.`);ns.nComponentsAttr!==null?os=ns.nComponentsAttr:os=1}else{if(ns.nComponentsAttr!==null)throw Error("You must specify createComponentOfType when specifying nComponents for a copy.");os=null}return{setValue:{nComponentsSpecified:os}}}},rs.link={returnDependencies:()=>({}),definition:()=>({setValue:{link:!0}})},rs.propName={shadowVariable:!0,returnDependencies:()=>({propName:{dependencyType:"attributePrimitive",attributeName:"prop"}}),definition:function({dependencyValues:ns}){return{setValue:{propName:ns.propName}}}},rs.sourceComponents={stateVariablesDeterminingDependencies:["propName","componentIndex","propIndex"],additionalStateVariablesDefined:["effectivePropNameBySource"],returnDependencies:function({stateValues:ns}){let ss,os;ns.componentIndex!==null&&(os=Number(ns.componentIndex),Number.isInteger(os)?ss=[os-1]:ss=[]);let ls=ns.propIndex;return ls&&(ls=[...ls]),{children:{dependencyType:"child",childGroups:["anything"],variableNames:[ns.propName],variablesOptional:!0,childIndices:ss,propIndex:ls,caseInsensitiveVariableMatch:!0,publicStateVariablesOnly:!0,useMappedVariableNames:!0},propName:{dependencyType:"stateVariable",variableName:"propName"}}},definition:function({dependencyValues:ns}){let ss=ns.children,os=[];for(let ls of ss){let us;ls.stateValues&&(us=Object.keys(ls.stateValues)[0]),us||(us="__prop_name_not_found"),os.push(us)}return{setValue:{sourceComponents:ss,effectivePropNameBySource:os}}}},rs.readyToExpandWhenResolved={returnDependencies:()=>({replacementClasses:{dependencyType:"stateVariable",variableName:"sourceComponents"},needsReplacementsUpdatedWhenStale:{dependencyType:"stateVariable",variableName:"needsReplacementsUpdatedWhenStale"}}),definition(){return{setValue:{readyToExpandWhenResolved:!0}}}},rs.needsReplacementsUpdatedWhenStale={returnDependencies(){return{sourceComponents:{dependencyType:"stateVariable",variableName:"sourceComponents"}}},markStale:()=>({updateReplacements:!0}),definition:()=>({setValue:{needsReplacementsUpdatedWhenStale:!0}})},rs}static async createSerializedReplacements({component:rs,components:ns,workspace:ss,componentInfoObjects:os,flags:ls,publicCaseInsensitiveAliasSubstitutions:us}){let cs=[],ds=[],ps=0;ss.propVariablesCopiedBySource=[],ss.uniqueIdentifiersUsedBySource={};let fs=this.createAttributesObject(),hs=await rs.stateValues.sourceComponents;for(let ys=0;ysys.componentName),{replacements:(await verifyReplacementsMatchSpecifiedType({component:rs,replacements:cs,assignNames:rs.doenetAttributes.assignNames,workspace:ss,componentInfoObjects:os,compositeAttributesObj:fs,flags:ls})).replacements}}static async createReplacementForSource({component:rs,components:ns,sourceNum:ss,numReplacementsSoFar:os,uniqueIdentifiersUsed:ls,componentInfoObjects:us,compositeAttributesObj:cs,publicCaseInsensitiveAliasSubstitutions:ds}){var vs;let ps=(await rs.stateValues.effectivePropNameBySource)[ss],fs=await replacementFromProp({component:rs,components:ns,replacementSource:(await rs.stateValues.sourceComponents)[ss],propName:ps,uniqueIdentifiersUsed:ls,compositeAttributesObj:cs,componentInfoObjects:us,publicCaseInsensitiveAliasSubstitutions:ds}),hs=fs.serializedReplacements,gs=fs.propVariablesCopiedByReplacement,ys=(vs=rs.attributes.newNamespace)==null?void 0:vs.primitive;return hs=processAssignNames({assignNames:rs.doenetAttributes.assignNames,serializedComponents:hs,parentName:rs.componentName,indOffset:os,parentCreatesNewNamespace:ys,componentInfoObjects:us}).serializedComponents,{serializedReplacements:hs,propVariablesCopiedByReplacement:gs}}static async calculateReplacementChanges({component:rs,components:ns,workspace:ss,componentInfoObjects:os,flags:ls,publicCaseInsensitiveAliasSubstitutions:us}){let cs=[],ds=0,ps=[],fs=[],hs=this.createAttributesObject(),gs=await rs.stateValues.sourceComponents,ys=Math.max(gs.length,ss.numReplacementsBySource.length),bs=!1;for(let xs=0;xs0){if(!bs){let Rs=ss.numReplacementsBySource.slice(xs).reduce((Is,Os)=>Is+Os,0);if(Rs>0){let Is={changeType:"delete",changeTopLevelReplacements:!0,firstReplacementInd:ds,numberReplacementsToDelete:Rs};cs.push(Is)}bs=!0,ss.numReplacementsBySource.slice(xs).forEach((Is,Os)=>ss.numReplacementsBySource[Os]=0)}ss.uniqueIdentifiersUsedBySource[xs]=[]}ps[xs]=0,fs.push([]);continue}let Ts=ss.sourceNames[xs],Ss=Ts===void 0||Cs.componentName!==Ts||bs;if(!Ss){for(let Rs=0;RsPs+Bs,0);Vs.numberReplacementsToReplace=ks,bs=!0,ss.numReplacementsBySource.slice(xs).forEach((Ps,Bs)=>ss.numReplacementsBySource[Bs]=0)}cs.push(Vs);continue}let Ns=ss.uniqueIdentifiersUsedBySource[xs]=[],As=await this.createReplacementForSource({component:rs,sourceNum:xs,components:ns,numReplacementsSoFar:ds,uniqueIdentifiersUsed:Ns,componentInfoObjects:os,compositeAttributesObj:hs,publicCaseInsensitiveAliasSubstitutions:us}),ws=As.propVariablesCopiedByReplacement,Es=As.serializedReplacements,_s=Es.length,$s=ss.numReplacementsBySource[xs];if(_s!==$s){let Rs=ss.numReplacementsBySource.slice(xs).reduce((Os,Ds)=>Os+Ds,0),Is={changeType:"add",changeTopLevelReplacements:!0,firstReplacementInd:ds,numberReplacementsToReplace:Rs,serializedReplacements:Es,assignNamesOffset:ds};cs.push(Is),bs=!0,ss.numReplacementsBySource.slice(xs).forEach((Os,Ds)=>ss.numReplacementsBySource[Ds]=0)}else for(let Rs=0;Rs<_s;Rs++)if(ws[Rs].length!==ss.propVariablesCopiedBySource[xs][Rs].length||ss.propVariablesCopiedBySource[xs][Rs].some((Is,Os)=>Is!==ws[Rs][Os])){let Is={changeType:"add",changeTopLevelReplacements:!0,firstReplacementInd:ds+Rs,numberReplacementsToReplace:1,serializedReplacements:[Es[Rs]],assignNamesOffset:ds+Rs};cs.push(Is)}ds+=_s,ps[xs]=_s,fs[xs]=ws}return ss.numReplacementsBySource=ps,ss.numNonStringReplacementsBySource=[...ps],ss.sourceNames=gs.map(xs=>xs.componentName),ss.propVariablesCopiedBySource=fs,(await verifyReplacementsMatchSpecifiedType({component:rs,replacementChanges:cs,assignNames:rs.doenetAttributes.assignNames,workspace:ss,componentInfoObjects:os,compositeAttributesObj:hs,flags:ls})).replacementChanges}static async recreateReplacements({component:rs,sourceNum:ns,numReplacementsSoFar:ss,numReplacementsToDelete:os,uniqueIdentifiersUsed:ls,components:us,componentInfoObjects:cs,compositeAttributesObj:ds,publicCaseInsensitiveAliasSubstitutions:ps}){let fs=await this.createReplacementForSource({component:rs,sourceNum:ns,numReplacementsSoFar:ss,components:us,uniqueIdentifiersUsed:ls,componentInfoObjects:cs,compositeAttributesObj:ds,publicCaseInsensitiveAliasSubstitutions:ps}),hs=fs.propVariablesCopiedByReplacement,gs=fs.serializedReplacements,ys={changeType:"add",changeTopLevelReplacements:!0,firstReplacementInd:ss,numberReplacementsToReplace:os,serializedReplacements:gs,assignNamesOffset:ss};return{numReplacements:gs.length,propVariablesCopiedByReplacement:hs,replacementInstruction:ys}}}zs(Extract,"componentType","extract"),zs(Extract,"assignNamesToReplacements",!0),zs(Extract,"acceptAnyAttribute",!0),zs(Extract,"stateVariableToEvaluateAfterReplacements","needsReplacementsUpdatedWhenStale");class Collect extends CompositeComponent{static createAttributesObject(){let rs=super.createAttributesObject();return delete rs.disabled,delete rs.modifyIndirectly,delete rs.fixed,delete rs.styleNumber,delete rs.isResponse,rs.assignNamesSkip={createPrimitiveOfType:"number"},rs.prop={createPrimitiveOfType:"string"},rs.maximumNumber={createComponentOfType:"number",createStateVariable:"maximumNumber",defaultValue:null,public:!0},rs.componentIndex={createComponentOfType:"integer",createStateVariable:"componentIndex",defaultValue:null,public:!0},rs.propIndex={createComponentOfType:"numberList",createStateVariable:"propIndex",defaultValue:null,public:!0},rs.sourceAttributesToIgnore={createPrimitiveOfType:"stringArray",createStateVariable:"sourceAttributesToIgnore",defaultValue:[],public:!0},rs.sourceAttributesToIgnoreRecursively={createPrimitiveOfType:"stringArray",createStateVariable:"sourceAttributesToIgnoreRecursively",defaultValue:["isResponse"],public:!0},rs.componentTypes={createComponentOfType:"textList"},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.link={returnDependencies:()=>({}),definition:()=>({setValue:{link:!0}})},rs.targetComponent={shadowVariable:!0,returnDependencies:()=>({targetComponent:{dependencyType:"targetComponent"}}),definition:function({dependencyValues:ns}){return{setValue:{targetComponent:ns.targetComponent}}}},rs.targetInactive={stateVariablesDeterminingDependencies:["targetComponent"],returnDependencies({stateValues:ns}){return ns.targetComponent?{targetIsInactiveCompositeReplacement:{dependencyType:"stateVariable",componentName:ns.targetComponent.componentName,variableName:"isInactiveCompositeReplacement"}}:{}},definition:function({dependencyValues:ns}){return{setValue:{targetInactive:!!ns.targetIsInactiveCompositeReplacement}}}},rs.targetName={returnDependencies:()=>({targetComponent:{dependencyType:"stateVariable",variableName:"targetComponent"}}),definition:function({dependencyValues:ns}){return ns.targetComponent===null?(console.warn("No copy target"),{setValue:{targetName:""}}):{setValue:{targetName:ns.targetComponent.componentName}}}},rs.propName={shadowVariable:!0,returnDependencies:()=>({propName:{dependencyType:"attributePrimitive",attributeName:"prop"}}),definition:function({dependencyValues:ns}){return{setValue:{propName:ns.propName}}}},rs.componentTypesToCollect={shadowVariable:!0,additionalStateVariablesDefined:[{variableName:"componentClassesToCollect",shadowVariable:!0}],returnDependencies:()=>({componentTypesAttr:{dependencyType:"attributeComponent",attributeName:"componentTypes",variableNames:["texts"]}}),definition:function({dependencyValues:ns,componentInfoObjects:ss}){let os=[],ls=[];if(ns.componentTypesAttr!==null)for(let us of ns.componentTypesAttr.stateValues.texts){let cs=ss.componentTypeLowerCaseMapping[us.toLowerCase()],ds=ss.allComponentClasses[cs];if(ds)os.push(cs),ls.push(ds);else{let ps="Cannot collect component type "+us+". Component type not found.";console.warn(ps)}}return{setValue:{componentTypesToCollect:os,componentClassesToCollect:ls}}}},rs.collectedComponents={stateVariablesDeterminingDependencies:["componentTypesToCollect","targetName","propName","componentIndex","propIndex"],additionalStateVariablesDefined:["effectivePropNameByComponent"],returnDependencies:function({stateValues:ns}){if(!ns.targetName)return{};let ss={dependencyType:"descendant",ancestorName:ns.targetName,componentTypes:ns.componentTypesToCollect,useReplacementsForComposites:!0,includeNonActiveChildren:!0,recurseToMatchedChildren:!1,componentIndex:ns.componentIndex};if(ns.propName){let os=ns.propIndex;os&&(os=[...os]),ss.variableNames=[ns.propName],ss.variablesOptional=!0,ss.propIndex=os,ss.caseInsensitiveVariableMatch=!0,ss.publicStateVariablesOnly=!0,ss.useMappedVariableNames=!0}return{descendants:ss,maximumNumber:{dependencyType:"stateVariable",variableName:"maximumNumber"},propName:{dependencyType:"stateVariable",variableName:"propName"}}},definition:function({dependencyValues:ns}){let ss=ns.descendants;if(ss||(ss=[]),ns.maximumNumber!==null&&ss.length>ns.maximumNumber){let ls=Math.max(0,Math.floor(ns.maximumNumber));ss=ss.slice(0,ls)}let os=[];for(let ls of ss){let us;ls.stateValues&&(us=Object.keys(ls.stateValues)[0]),!us&&ns.propName&&(us="__prop_name_not_found"),os.push(us)}return{setValue:{collectedComponents:ss,effectivePropNameByComponent:os}}}},rs.readyToExpandWhenResolved={returnDependencies:()=>({collectedComponents:{dependencyType:"stateVariable",variableName:"collectedComponents"},needsReplacementsUpdatedWhenStale:{dependencyType:"stateVariable",variableName:"needsReplacementsUpdatedWhenStale"}}),definition:()=>({setValue:{readyToExpandWhenResolved:!0}})},rs.needsReplacementsUpdatedWhenStale={returnDependencies(){return{collectedComponents:{dependencyType:"stateVariable",variableName:"collectedComponents"}}},markStale(){return{updateReplacements:!0}},definition(){return{setValue:{needsReplacementsUpdatedWhenStale:!0}}}},rs}static async createSerializedReplacements({component:rs,components:ns,workspace:ss,componentInfoObjects:os,nComponentsForSource:ls,publicCaseInsensitiveAliasSubstitutions:us,flags:cs}){if(!await rs.stateValues.targetComponent)return{replacements:[]};let ds=[],ps=[],fs=0,hs=[];ss.propVariablesCopiedByCollected=[],ss.uniqueIdentifiersUsedByCollected={};let gs=this.createAttributesObject(),ys=await rs.stateValues.collectedComponents;for(let bs=0;bsTs.componentName)}else ps[bs]=0,hs[bs]=[],ss.propVariablesCopiedByCollected[bs]=[];return ss.numReplacementsByCollected=ps,ss.collectedNames=ys.map(bs=>bs.componentName),ss.replacementNamesByCollected=hs,{replacements:ds}}static async createReplacementForCollected({component:rs,components:ns,collectedNum:ss,numReplacementsSoFar:os,uniqueIdentifiersUsed:ls,componentInfoObjects:us,compositeAttributesObj:cs,nComponentsForSource:ds,publicCaseInsensitiveAliasSubstitutions:ps,flags:fs}){var Ss;let hs=(await rs.stateValues.collectedComponents)[ss],gs=hs.componentName,ys=ns[gs],bs=[],vs=[];if(!ys)return{serializedReplacements:bs,propVariablesCopiedByReplacement:vs};let xs=(Ss=rs.attributes.newNamespace)==null?void 0:Ss.primitive,Cs=(await rs.stateValues.effectivePropNameByComponent)[ss];if(Cs){let Ns=await replacementFromProp({component:rs,components:ns,replacementSource:hs,propName:Cs,uniqueIdentifiersUsed:ls,compositeAttributesObj:cs,componentInfoObjects:us,nComponentsForSource:ds,publicCaseInsensitiveAliasSubstitutions:ps});bs=Ns.serializedReplacements,vs=Ns.propVariablesCopiedByReplacement}else{let Ns=await rs.stateValues.sourceAttributesToIgnore,As=await rs.stateValues.sourceAttributesToIgnoreRecursively,ws=[await ys.serialize({sourceAttributesToIgnore:Ns,sourceAttributesToIgnoreRecursively:As})];bs=postProcessCopy({serializedComponents:ws,componentName:rs.componentName,uniqueIdentifiersUsed:ls,identifierPrefix:ss+"|"});for(let Es of bs){Es.attributes||(Es.attributes={});let _s=convertAttributesForComponentType({attributes:rs.attributes,componentType:Es.componentType,componentInfoObjects:us,compositeAttributesObj:cs,compositeCreatesNewNamespace:xs,flags:fs});Object.assign(Es.attributes,_s)}}return bs=processAssignNames({assignNames:rs.doenetAttributes.assignNames,serializedComponents:bs,parentName:rs.componentName,indOffset:os,parentCreatesNewNamespace:xs,componentInfoObjects:us}).serializedComponents,{serializedReplacements:bs,propVariablesCopiedByReplacement:vs}}static async calculateReplacementChanges({component:rs,componentChanges:ns,components:ss,workspace:os,componentInfoObjects:ls,nComponentsForSource:us,publicCaseInsensitiveAliasSubstitutions:cs,flags:ds}){let ps=0;for(let Ss=0;Ss0){if(!Cs){let Os=os.numReplacementsByCollected.slice(Ss).reduce((Ds,Vs)=>Ds+Vs,0);if(Os>0){let Ds={changeType:"delete",changeTopLevelReplacements:!0,firstReplacementInd:hs,numberReplacementsToDelete:Os};fs.push(Ds)}Cs=!0,os.numReplacementsByCollected.slice(Ss).forEach((Ds,Vs)=>os.numReplacementsByCollected[Vs]=0)}os.uniqueIdentifiersUsedByCollected[Ss]=[]}gs[Ss]=0,ys.push([]),bs.push([]);continue}let As=os.collectedNames[Ss];if(As===void 0||Ns.componentName!==As||Cs){let Os=0;As!==void 0&&(Os=os.numReplacementsByCollected[Ss]);let Ds=Os;Cs&&(Ds=0);let Vs=os.uniqueIdentifiersUsedByCollected[Ss]=[],ks=await this.recreateReplacements({component:rs,collectedNum:Ss,numReplacementsSoFar:hs,numReplacementsToDelete:Ds,components:ss,uniqueIdentifiersUsed:Vs,componentInfoObjects:ls,compositeAttributesObj:Ts,nComponentsForSource:us,publicCaseInsensitiveAliasSubstitutions:cs,flags:ds});hs+=ks.numReplacements,gs[Ss]=ks.numReplacements,ys[Ss]=ks.propVariablesCopiedByReplacement;let Ps=ks.replacementInstruction;if(bs[Ss]=Ps.serializedReplacements.map(Bs=>Bs.componentName),!Cs&&ks.numReplacements!==Os){let Bs=os.numReplacementsByCollected.slice(Ss).reduce((Ms,Ws)=>Ms+Ws,0);Ps.numberReplacementsToReplace=Bs,Cs=!0,os.numReplacementsByCollected.slice(Ss).forEach((Ms,Ws)=>os.numReplacementsByCollected[Ws]=0)}fs.push(Ps);continue}if(!await rs.stateValues.propName){hs+=os.numReplacementsByCollected[Ss],gs[Ss]=os.numReplacementsByCollected[Ss],bs[Ss]=os.replacementNamesByCollected[Ss],ys[Ss]=[];continue}let ws=os.uniqueIdentifiersUsedByCollected[Ss]=[],Es=await this.createReplacementForCollected({component:rs,collectedNum:Ss,components:ss,numReplacementsSoFar:hs,uniqueIdentifiersUsed:ws,componentInfoObjects:ls,compositeAttributesObj:Ts,nComponentsForSource:us,publicCaseInsensitiveAliasSubstitutions:cs,flags:ds}),_s=Es.propVariablesCopiedByReplacement,$s=Es.serializedReplacements,Rs=$s.length,Is=os.numReplacementsByCollected[Ss];if(Rs!==Is){let Os=os.numReplacementsByCollected.slice(Ss).reduce((Vs,ks)=>Vs+ks,0),Ds={changeType:"add",changeTopLevelReplacements:!0,firstReplacementInd:hs,numberReplacementsToReplace:Os,serializedReplacements:$s,assignNamesOffset:hs};fs.push(Ds),Cs=!0,os.numReplacementsByCollected.slice(Ss).forEach((Vs,ks)=>os.numReplacementsByCollected[ks]=0)}else for(let Os=0;OsDs!==_s[Os][Vs])){let Ds={changeType:"add",changeTopLevelReplacements:!0,firstReplacementInd:hs+Os,numberReplacementsToReplace:1,serializedReplacements:[$s[Os]],assignNamesOffset:hs+Os};fs.push(Ds)}hs+=Rs,gs[Ss]=Rs,ys[Ss]=_s,bs[Ss]=$s.map(Os=>Os.componentName)}return os.numReplacementsByCollected=gs,os.collectedNames=vs.map(Ss=>Ss.componentName),os.propVariablesCopiedByCollected=ys,os.replacementNamesByCollected=bs,fs}static async recreateReplacements({component:rs,collectedNum:ns,numReplacementsSoFar:ss,numReplacementsToDelete:os,uniqueIdentifiersUsed:ls,components:us,componentInfoObjects:cs,compositeAttributesObj:ds,nComponentsForSource:ps,publicCaseInsensitiveAliasSubstitutions:fs,flags:hs}){let gs=await this.createReplacementForCollected({component:rs,collectedNum:ns,components:us,numReplacementsSoFar:ss,uniqueIdentifiersUsed:ls,componentInfoObjects:cs,compositeAttributesObj:ds,nComponentsForSource:ps,publicCaseInsensitiveAliasSubstitutions:fs,flags:hs}),ys=gs.propVariablesCopiedByReplacement,bs=gs.serializedReplacements,vs={changeType:"add",changeTopLevelReplacements:!0,firstReplacementInd:ss,numberReplacementsToReplace:os,serializedReplacements:bs,assignNamesOffset:ss};return{numReplacements:bs.length,propVariablesCopiedByReplacement:ys,replacementInstruction:vs}}}zs(Collect,"componentType","collect"),zs(Collect,"assignNamesToReplacements",!0),zs(Collect,"acceptTarget",!0),zs(Collect,"acceptAnyAttribute",!0),zs(Collect,"stateVariableToEvaluateAfterReplacements","needsReplacementsUpdatedWhenStale");class Ref extends InlineComponent{constructor(rs){super(rs),Object.assign(this.actions,{navigateToTarget:this.navigateToTarget.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.textType={createComponentOfType:"text",createStateVariable:"textType",defaultValue:"type-global",public:!0},rs.uri={createPrimitiveOfType:"string",createStateVariable:"uri",defaultValue:null,public:!0,forRenderer:!0},rs.page={createPrimitiveOfType:"integer",createStateVariable:"page",defaultValue:null,public:!0,forRenderer:!0},rs.createButton={createComponentOfType:"boolean",createStateVariable:"createButton",defaultValue:!1,forRenderer:!0},rs}static returnChildGroups(){return[{group:"anything",componentTypes:["_base"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.targetComponent={returnDependencies:()=>({targetComponent:{dependencyType:"targetComponent"}}),definition:function({dependencyValues:ns}){return{setValue:{targetComponent:ns.targetComponent}}}},rs.targetInactive={stateVariablesDeterminingDependencies:["targetComponent"],returnDependencies({stateValues:ns}){return ns.targetComponent?{targetIsInactiveCompositeReplacement:{dependencyType:"stateVariable",componentName:ns.targetComponent.componentName,variableName:"isInactiveCompositeReplacement"}}:{}},definition:function({dependencyValues:ns}){return{setValue:{targetInactive:!!ns.targetIsInactiveCompositeReplacement}}}},rs.targetName={forRenderer:!0,returnDependencies:()=>({targetComponent:{dependencyType:"stateVariable",variableName:"targetComponent"},uri:{dependencyType:"stateVariable",variableName:"uri"},page:{dependencyType:"stateVariable",variableName:"page"},targetInactive:{dependencyType:"stateVariable",variableName:"targetInactive"},targetAttribute:{dependencyType:"doenetAttribute",attributeName:"target"}}),definition:function({dependencyValues:ns}){if(ns.uri||ns.page)if(ns.targetAttribute){let ss=ns.targetAttribute;return ss[0]!=="/"&&(ss="/"+ss),{setValue:{targetName:ss}}}else return{setValue:{targetName:""}};else return ns.targetComponent===null||ns.targetInactive?{setValue:{targetName:""}}:{setValue:{targetName:ns.targetComponent.componentName}}}},rs.cid={forRenderer:!0,additionalStateVariablesDefined:[{variableName:"doenetId",forRenderer:!0},{variableName:"variantIndex",forRenderer:!0},{variableName:"edit",forRenderer:!0},{variableName:"draft",forRenderer:!0},{variableName:"hash",forRenderer:!0}],returnDependencies:()=>({uri:{dependencyType:"stateVariable",variableName:"uri"}}),definition:function({dependencyValues:ns}){if(!ns.uri||ns.uri.substring(0,7).toLowerCase()!=="doenet:")return{setValue:{cid:null,doenetId:null,variantIndex:null,edit:null,draft:null,hash:null}};let ss=null,os=null,ls=null,us=null,cs=null,ds=null,ps=ns.uri.match(/[:&]cid=([^&^#]+)/i);return ps&&(ss=ps[1]),ps=ns.uri.match(/[:&]doenetid=([^&^#]+)/i),ps&&(os=ps[1]),ps=ns.uri.match(/[:&]variant=([^&^#]+)/i),ps&&(ls=Number(ps[1]),!Number.isInteger(ls)&&ls>=1&&(ls=1)),ps=ns.uri.match(/[:&]edit=([^&^#]+)/i),ps&&(ps[1].toLowerCase()==="true"?cs=!0:cs=!1),ps=ns.uri.match(/[:&]draft=([^&^#]+)/i),ps&&(ps[1].toLowerCase()==="true"?us=!0:us=!1),ps=ns.uri.match(/(#.+)/i),ps&&(ds=ps[1]),{setValue:{cid:ss,doenetId:os,variantIndex:ls,edit:cs,draft:us,hash:ds}}}},rs.linkText={public:!0,shadowingInstructions:{createComponentOfType:"text"},forRenderer:!0,stateVariablesDeterminingDependencies:["targetName"],returnDependencies({stateValues:ns}){let ss={allChildren:{dependencyType:"child",childGroups:["anything"],variableNames:["text"],variablesOptional:!0},uri:{dependencyType:"stateVariable",variableName:"uri"},targetInactive:{dependencyType:"stateVariable",variableName:"targetInactive"}};return ns.targetName&&(ss.equationTag={dependencyType:"stateVariable",componentName:ns.targetName,variableName:"equationTag",variablesOptional:!0},ss.title={dependencyType:"stateVariable",componentName:ns.targetName,variableName:"title",variablesOptional:!0}),ss},definition:function({dependencyValues:ns}){let ss="";if(ns.allChildren.length===0)ns.uri!==null?ss=ns.uri:ns.targetInactive||(ns.title!==null?ss=ns.title:ns.equationTag!==null&&(ss="("+ns.equationTag+")"));else for(let os of ns.allChildren)typeof os!="object"?ss+=os.toString():typeof os.stateValues.text=="string"&&(ss+=os.stateValues.text);return ss||(ss="???"),{setValue:{linkText:ss}}}},rs}async navigateToTarget({actionId:rs}){if(await this.stateValues.disabled)this.coreFunctions.resolveAction({actionId:rs});else{let ns=await this.stateValues.cid,ss=await this.stateValues.doenetId,os=await this.stateValues.variantIndex,ls=await this.stateValues.edit,us=await this.stateValues.hash,cs=await this.stateValues.page,ds=await this.stateValues.uri,ps=await this.stateValues.targetName,fs=this.componentOrAdaptedName;this.coreFunctions.navigateToTarget({cid:ns,doenetId:ss,variantIndex:os,edit:ls,hash:us,page:cs,uri:ds,targetName:ps,actionId:rs,componentName:this.componentName,effectiveName:fs})}}}zs(Ref,"componentType","ref"),zs(Ref,"renderChildren",!0),zs(Ref,"acceptTarget",!0);class Coords extends MathComponent{static createAttributesObject(){let rs=super.createAttributesObject();return delete rs.createVectors,rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.createVectors={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},returnDependencies:()=>({}),definition:()=>({setValue:{createVectors:!0}})},rs}}zs(Coords,"componentType","coords"),zs(Coords,"rendererType","math");class LineSegment extends GraphicalComponent{constructor(rs){super(rs),Object.assign(this.actions,{moveLineSegment:this.moveLineSegment.bind(this),lineSegmentClicked:this.lineSegmentClicked.bind(this),mouseDownOnLineSegment:this.mouseDownOnLineSegment.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.draggable={createComponentOfType:"boolean",createStateVariable:"draggable",defaultValue:!0,public:!0,forRenderer:!0},rs.endpointsDraggable={createComponentOfType:"boolean"},rs.endpoints={createComponentOfType:"_pointListComponent"},rs.showCoordsWhenDragging={createComponentOfType:"boolean",createStateVariable:"showCoordsWhenDragging",defaultValue:!0,public:!0,forRenderer:!0},rs.labelPosition={createComponentOfType:"text",createStateVariable:"labelPosition",defaultValue:"upperright",public:!0,forRenderer:!0,toLowerCase:!0,validValues:["upperright","upperleft","lowerright","lowerleft"]},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.styleDescription={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({selectedStyle:{dependencyType:"stateVariable",variableName:"selectedStyle"},document:{dependencyType:"ancestor",componentType:"document",variableNames:["theme"]}}),definition:function({dependencyValues:ns}){var ls;let ss;((ls=ns.document)==null?void 0:ls.stateValues.theme)==="dark"?ss=ns.selectedStyle.lineColorWordDarkMode:ss=ns.selectedStyle.lineColorWord;let os=ns.selectedStyle.lineWidthWord;return ns.selectedStyle.lineStyleWord&&(os&&(os+=" "),os+=ns.selectedStyle.lineStyleWord),os&&(os+=" "),os+=ss,{setValue:{styleDescription:os}}}},rs.styleDescriptionWithNoun={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({styleDescription:{dependencyType:"stateVariable",variableName:"styleDescription"}}),definition:function({dependencyValues:ns}){return{setValue:{styleDescriptionWithNoun:ns.styleDescription+" line segment"}}}},rs.endpointsDraggable={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},hasEssential:!0,forRenderer:!0,returnDependencies:()=>({endpointsDraggableAttr:{dependencyType:"attributeComponent",attributeName:"endpointsDraggable",variableNames:["value"]},draggable:{dependencyType:"stateVariable",variableName:"draggable"}}),definition({dependencyValues:ns}){return ns.endpointsDraggableAttr?{setValue:{endpointsDraggable:ns.endpointsDraggableAttr.stateValues.value}}:{useEssentialOrDefaultValue:{endpointsDraggable:{defaultValue:ns.draggable}}}}},rs.nDimensions={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({endpointsAttr:{dependencyType:"attributeComponent",attributeName:"endpoints",variableNames:["nDimensions"]}}),definition:function({dependencyValues:ns}){return ns.endpointsAttr!==null?{setValue:{nDimensions:ns.endpointsAttr.stateValues.nDimensions},checkForActualChange:{nDimensions:!0}}:{setValue:{nDimensions:2}}}},rs.endpoints={public:!0,shadowingInstructions:{createComponentOfType:"math",returnWrappingComponents(ns){return ns==="endpointX"?[]:[["point",{componentType:"mathList",isAttribute:"xs"}]]}},isArray:!0,nDimensions:2,entryPrefixes:["endpointX","endpoint"],hasEssential:!0,set:convertValueToMathExpression,defaultValueByArrayKey:ns=>Context.fromAst(ns==="0,0"?1:0),getArrayKeysFromVarName({arrayEntryPrefix:ns,varEnding:ss,arraySize:os}){if(ns==="endpointX"){let ls=ss.split("_").map(us=>Number(us)-1);return ls.length===2&&ls.every((us,cs)=>Number.isInteger(us)&&us>=0)?os?ls.every((us,cs)=>us=0?os?lsls+","+cs):[]:[ls+",0"]:[]}},arrayVarNameFromPropIndex(ns,ss){if(ss==="endpoints")return ns.length===1?"endpoint"+ns[0]:`endpointX${ns[0]}_${ns[1]}`;if(ss.slice(0,8)==="endpoint"){let os=Number(ss.slice(8));if(Number.isInteger(os)&&os>0)return`endpointX${os}_${ns[0]}`}return null},returnArraySizeDependencies:()=>({nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),returnArraySize({dependencyValues:ns}){return[2,ns.nDimensions]},returnArrayDependenciesByKey({arrayKeys:ns}){let ss={};for(let os of ns){let[ls,us]=os.split(","),cs=Number(ls)+1+"_"+(Number(us)+1);ss[os]={endpointsAttr:{dependencyType:"attributeComponent",attributeName:"endpoints",variableNames:["pointX"+cs]}}}return{dependenciesByKey:ss}},arrayDefinitionByKey({dependencyValuesByKey:ns,arrayKeys:ss,arraySize:os}){let ls={},us={};for(let ds of ss){let[ps,fs]=ds.split(","),hs=Number(ps)+1+"_"+(Number(fs)+1);ns[ds].endpointsAttr!==null&&ns[ds].endpointsAttr.stateValues["pointX"+hs]?ls[ds]=ns[ds].endpointsAttr.stateValues["pointX"+hs]:us[ds]=!0}let cs={};return Object.keys(ls).length>0&&(cs.setValue={endpoints:ls}),Object.keys(us).length>0&&(cs.useEssentialOrDefaultValue={endpoints:us}),cs},async inverseArrayDefinitionByKey({desiredStateVariableValues:ns,dependencyValuesByKey:ss,dependencyNamesByKey:os,initialChange:ls,stateValues:us}){let cs=[];for(let ds in ns.endpoints){let[ps,fs]=ds.split(","),hs=Number(ps)+1+"_"+(Number(fs)+1);ss[ds].endpointsAttr!==null&&ss[ds].endpointsAttr.stateValues["pointX"+hs]?cs.push({setDependency:os[ds].endpointsAttr,desiredValue:ns.endpoints[ds],childIndex:0,variableIndex:0}):cs.push({setEssentialValue:"endpoints",value:{[ds]:ns.endpoints[ds]}})}return{success:!0,instructions:cs}}},rs.length={public:!0,shadowingInstructions:{createComponentOfType:"math"},returnDependencies:()=>({nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"},endpoints:{dependencyType:"stateVariable",variableName:"endpoints"}}),definition({dependencyValues:ns}){let ss=0,os=ns.endpoints[0],ls=ns.endpoints[1],us=!0;for(let cs=0;csbs+vs*vs,0));ls=ls.map(bs=>bs/ps);let fs=ns.length.evaluate_to_constant();if(!Number.isFinite(fs)||fs<0)return{success:!1};let hs=[],gs=[],ys=fs/2;for(let bs=0;bs({nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),returnArraySize({dependencyValues:ns}){return Number.isNaN(ns.nDimensions)?[0]:[2]},returnArrayDependenciesByKey({arrayKeys:ns}){let ss={nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}},os={};for(let ls of ns)os[ls]={endpoint:{dependencyType:"stateVariable",variableName:"endpoint"+(Number(ls)+1)}};return{globalDependencies:ss,dependenciesByKey:os}},arrayDefinitionByKey({globalDependencyValues:ns,dependencyValuesByKey:ss,arrayKeys:os}){if(Number.isNaN(ns.nDimensions))return{};let ls={};for(let us of os){let cs=ss[us].endpoint,ds=[];for(let ps=0;ps({nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"},numericalEndpoints:{dependencyType:"stateVariable",variableName:"numericalEndpoints"}}),definition({dependencyValues:ns}){let ss=ns.numericalEndpoints[0][0],os=ns.numericalEndpoints[0][1],ls=ns.numericalEndpoints[1][0],us=ns.numericalEndpoints[1][1],cs=Number.isFinite(ss)&&Number.isFinite(os)&&Number.isFinite(ls)&&Number.isFinite(us),ds=ns.nDimensions!==2||!cs||ls===ss&&us===os;return{setValue:{nearestPoint:function({variables:ps,scales:fs}){if(ds)return{};let hs=fs[0],gs=fs[1],ys=(ls-ss)/hs,bs=(us-os)/gs,vs=ys*ys+bs*bs,xs=((ps.x1-ss)/hs*ys+(ps.x2-os)/gs*bs)/vs,Cs={};return xs<=0?Cs={x1:ss,x2:os}:xs>=1?Cs={x1:ls,x2:us}:Cs={x1:ss+xs*ys*hs,x2:os+xs*bs*gs},ps.x3!==void 0&&(Cs.x3=0),Cs}}}}},rs.slope={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({numericalEndpoints:{dependencyType:"stateVariable",variableName:"numericalEndpoints"},nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),definition({dependencyValues:ns}){if(ns.nDimensions!==2)return{setValue:{slope:NaN}};let ss=ns.numericalEndpoints;return{setValue:{slope:(ss[1][1]-ss[0][1])/(ss[1][0]-ss[0][0])}}}},rs}async moveLineSegment({point1coords:rs,point2coords:ns,transient:ss,actionId:os,sourceDetails:ls,sourceInformation:us={},skipRendererUpdate:cs=!1}){if(rs===void 0||ns===void 0){if(!await this.stateValues.endpointsDraggable)return await this.coreFunctions.resolveAction({actionId:os})}else if(!await this.stateValues.draggable)return await this.coreFunctions.resolveAction({actionId:os});let ds={};return rs!==void 0&&(ds["0,0"]=Context.fromAst(rs[0]),ds["0,1"]=Context.fromAst(rs[1])),ns!==void 0&&(ds["1,0"]=Context.fromAst(ns[0]),ds["1,1"]=Context.fromAst(ns[1])),ss?await this.coreFunctions.performUpdate({updateInstructions:[{componentName:this.componentName,updateType:"updateValue",stateVariable:"endpoints",value:ds,sourceDetails:ls}],transient:!0,actionId:os,sourceInformation:us,skipRendererUpdate:cs}):await this.coreFunctions.performUpdate({updateInstructions:[{componentName:this.componentName,updateType:"updateValue",stateVariable:"endpoints",value:ds,sourceDetails:ls}],actionId:os,sourceInformation:us,skipRendererUpdate:cs,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{point1:rs,point2:ns}}})}async lineSegmentClicked({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){await this.coreFunctions.triggerChainedActions({triggeringAction:"click",componentName:this.componentName,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss}),this.coreFunctions.resolveAction({actionId:rs})}async mouseDownOnLineSegment({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){await this.coreFunctions.triggerChainedActions({triggeringAction:"down",componentName:this.componentName,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss}),this.coreFunctions.resolveAction({actionId:rs})}}zs(LineSegment,"componentType","lineSegment");class Ray extends GraphicalComponent{constructor(rs){super(rs),Object.assign(this.actions,{moveRay:this.moveRay.bind(this),rayClicked:this.rayClicked.bind(this),mouseDownOnRay:this.mouseDownOnRay.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.draggable={createComponentOfType:"boolean",createStateVariable:"draggable",defaultValue:!0,public:!0,forRenderer:!0},rs.endpoint={createComponentOfType:"point"},rs.through={createComponentOfType:"point"},rs.direction={createComponentOfType:"vector"},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.styleDescription={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({selectedStyle:{dependencyType:"stateVariable",variableName:"selectedStyle"},document:{dependencyType:"ancestor",componentType:"document",variableNames:["theme"]}}),definition:function({dependencyValues:ns}){var ls;let ss;((ls=ns.document)==null?void 0:ls.stateValues.theme)==="dark"?ss=ns.selectedStyle.lineColorWordDarkMode:ss=ns.selectedStyle.lineColorWord;let os=ns.selectedStyle.lineWidthWord;return ns.selectedStyle.lineStyleWord&&(os&&(os+=" "),os+=ns.selectedStyle.lineStyleWord),os&&(os+=" "),os+=ss,{setValue:{styleDescription:os}}}},rs.styleDescriptionWithNoun={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({styleDescription:{dependencyType:"stateVariable",variableName:"styleDescription"}}),definition:function({dependencyValues:ns}){return{setValue:{styleDescriptionWithNoun:ns.styleDescription+" ray"}}}},rs.directionShadow={defaultValue:null,hasEssential:!0,essentialVarName:"direction",set:convertValueToMathExpression,returnDependencies:()=>({}),definition:()=>({useEssentialOrDefaultValue:{directionShadow:!0}}),inverseDefinition:function({desiredStateVariableValues:ns}){return{success:!0,instructions:[{setEssentialValue:"directionShadow",value:convertValueToMathExpression(ns.directionShadow)}]}}},rs.throughShadow={defaultValue:null,hasEssential:!0,essentialVarName:"through",set:convertValueToMathExpression,returnDependencies:()=>({}),definition:()=>({useEssentialOrDefaultValue:{throughShadow:!0}}),inverseDefinition:function({desiredStateVariableValues:ns}){return{success:!0,instructions:[{setEssentialValue:"throughShadow",value:convertValueToMathExpression(ns.throughShadow)}]}}},rs.endpointShadow={defaultValue:null,hasEssential:!0,essentialVarName:"endpoint",set:convertValueToMathExpression,returnDependencies:()=>({}),definition:()=>({useEssentialOrDefaultValue:{endpointShadow:!0}}),inverseDefinition:function({desiredStateVariableValues:ns}){return{success:!0,instructions:[{setEssentialValue:"endpointShadow",value:convertValueToMathExpression(ns.endpointShadow)}]}}},rs.basedOnThrough={returnDependencies:()=>({throughAttr:{dependencyType:"attributeComponent",attributeName:"through"},throughShadow:{dependencyType:"stateVariable",variableName:"throughShadow"},endpointAttr:{dependencyType:"attributeComponent",attributeName:"endpoint"},directionAttr:{dependencyType:"attributeComponent",attributeName:"direction"}}),definition:function({dependencyValues:ns}){return ns.endpointAttr!==null&&ns.directionAttr!==null?(ns.throughAttr!==null&&console.warn("Ray is prescribed by through, endpoint, and direction. Ignoring specified through."),{setValue:{basedOnThrough:!1},checkForActualChange:{basedOnThrough:!0}}):ns.throughAttr!==null?{setValue:{basedOnThrough:!0},checkForActualChange:{basedOnThrough:!0}}:{setValue:{basedOnThrough:ns.throughShadow!==null},checkForActualChange:{basedOnThrough:!0}}}},rs.basedOnEndpoint={returnDependencies:()=>({endpointAttr:{dependencyType:"attributeComponent",attributeName:"endpoint"},endpointShadow:{dependencyType:"stateVariable",variableName:"endpointShadow"}}),definition:function({dependencyValues:ns}){return ns.endpointAttr!==null?{setValue:{basedOnEndpoint:!0},checkForActualChange:{basedOnEndpoint:!0}}:{setValue:{basedOnEndpoint:ns.endpointShadow!==null},checkForActualChange:{basedOnEndpoint:!0}}}},rs.basedOnDirection={returnDependencies:()=>({directionAttr:{dependencyType:"attributeComponent",attributeName:"direction"},directionShadow:{dependencyType:"stateVariable",variableName:"directionShadow"}}),definition:function({dependencyValues:ns}){return ns.directionAttr!==null?{setValue:{basedOnDirection:!0},checkForActualChange:{basedOnDirection:!0}}:{setValue:{basedOnDirection:ns.directionShadow!==null},checkForActualChange:{basedOnDirection:!0}}}},rs.nDimDirection={stateVariablesDeterminingDependencies:["basedOnDirection","basedOnThrough","basedOnEndpoint"],returnDependencies({stateValues:ns}){let ss={basedOnThrough:{dependencyType:"stateVariable",variableName:"basedOnThrough"},basedOnEndpoint:{dependencyType:"stateVariable",variableName:"basedOnEndpoint"},basedOnDirection:{dependencyType:"stateVariable",variableName:"basedOnDirection"},directionShadow:{dependencyType:"stateVariable",variableName:"directionShadow"},directionAttr:{dependencyType:"attributeComponent",attributeName:"direction",variableNames:["nDimensions"]}};return ns.basedOnDirection||(ns.basedOnThrough&&(ss.nDimThrough={dependencyType:"stateVariable",variableName:"nDimThrough"}),ns.basedOnEndpoint&&(ss.nDimEndpoint={dependencyType:"stateVariable",variableName:"nDimEndpoint"})),ss},definition:function({dependencyValues:ns}){let ss;if(ns.basedOnDirection){if(ns.directionAttr!==null)ss=ns.directionAttr.stateValues.nDimensions;else if(ns.directionShadow){let os=ns.directionShadow.tree;Array.isArray(os)&&vectorOperators.includes(os[0])?ss=os.length-1:ss=2}}else ns.basedOnThrough?ns.basedOnEndpoint?ns.nDimThrough===ns.nDimEndpoint?ss=ns.nDimThrough:ss=NaN:ss=ns.nDimThrough:ns.basedOnEndpoint?ss=ns.nDimEndpoint:ss=2;return{setValue:{nDimDirection:ss},checkForActualChange:{nDimDirection:!0}}}},rs.nDimThrough={stateVariablesDeterminingDependencies:["basedOnDirection","basedOnThrough","basedOnEndpoint"],returnDependencies({stateValues:ns}){let ss={basedOnThrough:{dependencyType:"stateVariable",variableName:"basedOnThrough"},basedOnEndpoint:{dependencyType:"stateVariable",variableName:"basedOnEndpoint"},basedOnDirection:{dependencyType:"stateVariable",variableName:"basedOnDirection"},throughShadow:{dependencyType:"stateVariable",variableName:"throughShadow"},throughAttr:{dependencyType:"attributeComponent",attributeName:"through",variableNames:["nDimensions"]}};return ns.basedOnThrough||(ns.basedOnEndpoint&&(ss.nDimEndpoint={dependencyType:"stateVariable",variableName:"nDimEndpoint"}),ns.basedOnDirection&&(ss.nDimDirection={dependencyType:"stateVariable",variableName:"nDimDirection"})),ss},definition:function({dependencyValues:ns}){let ss;if(ns.basedOnThrough){if(ns.throughAttr!==null)ss=ns.throughAttr.stateValues.nDimensions;else if(ns.throughShadow){let os=ns.throughShadow.tree;Array.isArray(os)&&vectorOperators.includes(os[0])?ss=os.length-1:ss=2}}else ns.basedOnDirection?ns.basedOnEndpoint?ns.nDimDirection===ns.nDimEndpoint?ss=ns.nDimDirection:ss=NaN:ss=ns.nDimDirection:ns.basedOnEndpoint?ss=ns.nDimEndpoint:ss=2;return{setValue:{nDimThrough:ss},checkForActualChange:{nDimThrough:!0}}}},rs.nDimEndpoint={stateVariablesDeterminingDependencies:["basedOnDirection","basedOnThrough","basedOnEndpoint"],returnDependencies({stateValues:ns}){let ss={basedOnThrough:{dependencyType:"stateVariable",variableName:"basedOnThrough"},basedOnEndpoint:{dependencyType:"stateVariable",variableName:"basedOnEndpoint"},basedOnDirection:{dependencyType:"stateVariable",variableName:"basedOnDirection"},endpointShadow:{dependencyType:"stateVariable",variableName:"endpointShadow"},endpointAttr:{dependencyType:"attributeComponent",attributeName:"endpoint",variableNames:["nDimensions"]}};return ns.basedOnEndpoint||(ns.basedOnThrough&&(ss.nDimThrough={dependencyType:"stateVariable",variableName:"nDimThrough"}),ns.basedOnDirection&&(ss.nDimDirection={dependencyType:"stateVariable",variableName:"nDimDirection"})),ss},definition:function({dependencyValues:ns}){let ss;if(ns.basedOnEndpoint){if(ns.endpointAttr!==null)ss=ns.endpointAttr.stateValues.nDimensions;else if(ns.endpointShadow){let os=ns.endpointShadow.tree;Array.isArray(os)&&vectorOperators.includes(os[0])?ss=os.length-1:ss=2}}else ns.basedOnDirection?ns.basedOnThrough?ns.nDimDirection===ns.nDimThrough?ss=ns.nDimDirection:ss=NaN:ss=ns.nDimDirection:ns.basedOnThrough?ss=ns.nDimThrough:ss=2;return{setValue:{nDimEndpoint:ss},checkForActualChange:{nDimEndpoint:!0}}}},rs.nDimensions={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({basedOnThrough:{dependencyType:"stateVariable",variableName:"basedOnThrough"},basedOnEndpoint:{dependencyType:"stateVariable",variableName:"basedOnEndpoint"},basedOnDirection:{dependencyType:"stateVariable",variableName:"basedOnDirection"},nDimDirection:{dependencyType:"stateVariable",variableName:"nDimDirection"},nDimThrough:{dependencyType:"stateVariable",variableName:"nDimThrough"},nDimEndpoint:{dependencyType:"stateVariable",variableName:"nDimEndpoint"}}),definition:function({dependencyValues:ns}){let ss;if(ns.basedOnDirection){if(ns.basedOnEndpoint){if(ns.nDimDirection!==ns.nDimEndpoint)return console.warn("nDimensions mismatch in vector"),{setValue:{nDimensions:NaN}}}else if(ns.basedOnThrough&&ns.nDimDirection!==ns.nDimThrough)return console.warn("nDimensions mismatch in vector"),{setValue:{nDimensions:NaN}};ss=ns.nDimDirection}else if(ns.basedOnEndpoint){if(ns.basedOnThrough&&ns.nDimEndpoint!==ns.nDimThrough)return console.warn("nDimensions mismatch in vector"),{setValue:{nDimensions:NaN}};ss=ns.nDimEndpoint}else ns.basedOnThrough?ss=ns.nDimThrough:ss=2;return{setValue:{nDimensions:ss},checkForActualChange:{nDimensions:!0}}}},rs.direction={public:!0,shadowingInstructions:{createComponentOfType:"math",returnWrappingComponents(ns){return ns==="directionX"?[]:[["vector",{componentType:"mathList",isAttribute:"xs"}]]}},isArray:!0,entryPrefixes:["directionX"],hasEssential:!0,essentialVarName:"direction2",set:convertValueToMathExpression,stateVariablesDeterminingDependencies:["basedOnDirection","basedOnThrough"],returnArraySizeDependencies:()=>({nDimDirection:{dependencyType:"stateVariable",variableName:"nDimDirection"}}),returnArraySize({dependencyValues:ns}){return[ns.nDimDirection]},returnArrayDependenciesByKey({arrayKeys:ns,stateValues:ss}){let os={basedOnThrough:{dependencyType:"stateVariable",variableName:"basedOnThrough"},basedOnEndpoint:{dependencyType:"stateVariable",variableName:"basedOnEndpoint"},basedOnDirection:{dependencyType:"stateVariable",variableName:"basedOnDirection"},directionShadow:{dependencyType:"stateVariable",variableName:"directionShadow"}},ls={};for(let us of ns){let cs=Number(us)+1;ls[us]={directionAttr:{dependencyType:"attributeComponent",attributeName:"direction",variableNames:["x"+cs]}},!ss.basedOnDirection&&ss.basedOnThrough&&(ls[us].endpointX={dependencyType:"stateVariable",variableName:"endpointX"+cs},ls[us].throughX={dependencyType:"stateVariable",variableName:"throughX"+cs})}return{globalDependencies:os,dependenciesByKey:ls}},arrayDefinitionByKey:function({globalDependencyValues:ns,dependencyValuesByKey:ss,arrayKeys:os}){let ls={},us={};for(let ds of os){let ps=Number(ds)+1;ns.basedOnDirection?ss[ds].directionAttr!==null?ls[ds]=ss[ds].directionAttr.stateValues["x"+ps]:ns.directionShadow!==null&&(ls[ds]=ns.directionShadow.get_component(Number(ds))):ns.basedOnThrough?ls[ds]=ss[ds].throughX.subtract(ss[ds].endpointX).simplify():us[ds]={defaultValue:Context.fromAst(ds==="0"?1:0)}}let cs={};return Object.keys(ls).length>0&&(cs.setValue={direction:ls}),Object.keys(us).length>0&&(cs.useEssentialOrDefaultValue={direction:us}),cs},inverseArrayDefinitionByKey({desiredStateVariableValues:ns,globalDependencyValues:ss,dependencyValuesByKey:os,dependencyNamesByKey:ls,arraySize:us}){let cs=[],ds=!1;for(let ps in ns.direction)ss.basedOnDirection?os[ps].directionAttr!==null?cs.push({setDependency:ls[ps].directionAttr,desiredValue:ns.direction[ps],variableIndex:0}):ds=!0:ss.basedOnThrough?cs.push({setDependency:ls[ps].throughX,desiredValue:os[ps].endpointX.add(ns.direction[ps]).simplify()}):cs.push({setEssentialValue:"direction",value:{[ps]:convertValueToMathExpression(ns.direction[ps])}});if(ds)if(us[0]>1){let ps=["vector"];for(let fs in ns.direction)ps[Number(fs)+1]=ns.direction[fs].tree;ps.length=us[0]+1,cs.push({setDependency:"directionShadow",desiredValue:Context.fromAst(ps)})}else us[0]===1&&"0"in ns.direction&&cs.push({setDependency:"directionShadow",desiredValue:ns.direction[0]});return{success:!0,instructions:cs}}},rs.through={public:!0,shadowingInstructions:{createComponentOfType:"math",returnWrappingComponents(ns){return ns==="throughX"?[]:[["point",{componentType:"mathList",isAttribute:"xs"}]]}},isArray:!0,entryPrefixes:["throughX"],set:convertValueToMathExpression,stateVariablesDeterminingDependencies:["basedOnThrough"],returnArraySizeDependencies:()=>({nDimThrough:{dependencyType:"stateVariable",variableName:"nDimThrough"}}),returnArraySize({dependencyValues:ns}){return[ns.nDimThrough]},returnArrayDependenciesByKey({arrayKeys:ns,stateValues:ss}){let os={basedOnDirection:{dependencyType:"stateVariable",variableName:"basedOnDirection"},basedOnEndpoint:{dependencyType:"stateVariable",variableName:"basedOnEndpoint"},basedOnThrough:{dependencyType:"stateVariable",variableName:"basedOnThrough"},throughShadow:{dependencyType:"stateVariable",variableName:"throughShadow"}},ls={};for(let us of ns){let cs=Number(us)+1;ls[us]={throughAttr:{dependencyType:"attributeComponent",attributeName:"through",variableNames:["x"+cs]}},ss.basedOnThrough||(ls[us].endpointX={dependencyType:"stateVariable",variableName:"endpointX"+cs},ls[us].directionX={dependencyType:"stateVariable",variableName:"directionX"+cs})}return{globalDependencies:os,dependenciesByKey:ls}},arrayDefinitionByKey:function({globalDependencyValues:ns,dependencyValuesByKey:ss,arrayKeys:os}){let ls={};for(let us of os){let cs=Number(us)+1;ns.basedOnThrough?ss[us].throughAttr!==null?ls[us]=ss[us].throughAttr.stateValues["x"+cs]:ns.throughShadow!==null&&(ls[us]=ns.throughShadow.get_component(Number(us))):ls[us]=ss[us].endpointX.add(ss[us].directionX).simplify()}return{setValue:{through:ls}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ns,globalDependencyValues:ss,dependencyValuesByKey:os,dependencyNamesByKey:ls,arraySize:us}){let cs=[],ds=!1;for(let ps in ns.through)ss.basedOnThrough?os[ps].throughAttr&&os[ps].throughAttr!==null?cs.push({setDependency:ls[ps].throughAttr,desiredValue:ns.through[ps],variableIndex:0}):ss.throughShadow!==null&&(ds=!0):cs.push({setDependency:ls[ps].directionX,desiredValue:ns.through[ps].subtract(os[ps].endpointX).simplify()});if(ds)if(us[0]>1){let ps=["vector"];for(let fs in ns.through)ps[Number(fs)+1]=ns.through[fs].tree;ps.length=us[0]+1,cs.push({setDependency:"throughShadow",desiredValue:Context.fromAst(ps)})}else us[0]===1&&"0"in ns.through&&cs.push({setDependency:"throughShadow",desiredValue:ns.through[0]});return{success:!0,instructions:cs}}},rs.endpoint={public:!0,shadowingInstructions:{createComponentOfType:"math",returnWrappingComponents(ns){return ns==="endpointX"?[]:[["point",{componentType:"mathList",isAttribute:"xs"}]]}},isArray:!0,entryPrefixes:["endpointX"],hasEssential:!0,defaultValueByArrayKey:()=>Context.fromAst(0),essentialVarName:"endpoint2",set:convertValueToMathExpression,stateVariablesDeterminingDependencies:["basedOnEndpoint","basedOnThrough","basedOnDirection"],returnArraySizeDependencies:()=>({nDimEndpoint:{dependencyType:"stateVariable",variableName:"nDimEndpoint"}}),returnArraySize({dependencyValues:ns}){return[ns.nDimEndpoint]},returnArrayDependenciesByKey({arrayKeys:ns,stateValues:ss}){let os={basedOnDirection:{dependencyType:"stateVariable",variableName:"basedOnDirection"},basedOnThrough:{dependencyType:"stateVariable",variableName:"basedOnThrough"},endpointShadow:{dependencyType:"stateVariable",variableName:"endpointShadow"}},ls={};for(let us of ns){let cs=Number(us)+1;ls[us]={endpointAttr:{dependencyType:"attributeComponent",attributeName:"endpoint",variableNames:["x"+cs]}},ss.basedOnEndpoint||ss.basedOnThrough&&ss.basedOnDirection&&(ls[us].throughX={dependencyType:"stateVariable",variableName:"throughX"+cs},ls[us].directionX={dependencyType:"stateVariable",variableName:"directionX"+cs})}return{globalDependencies:os,dependenciesByKey:ls}},arrayDefinitionByKey:function({globalDependencyValues:ns,dependencyValuesByKey:ss,arrayKeys:os}){let ls={},us={};for(let ds of os){let ps=Number(ds)+1;ss[ds].endpointAttr!==null?ls[ds]=ss[ds].endpointAttr.stateValues["x"+ps]:ns.endpointShadow!==null?ls[ds]=ns.endpointShadow.get_component(Number(ds)):ns.basedOnThrough&&ns.basedOnDirection?ls[ds]=ss[ds].throughX.subtract(ss[ds].directionX).simplify():us[ds]=!0}let cs={};return Object.keys(ls).length>0&&(cs.setValue={endpoint:ls}),Object.keys(us).length>0&&(cs.useEssentialOrDefaultValue={endpoint:us}),cs},inverseArrayDefinitionByKey({desiredStateVariableValues:ns,globalDependencyValues:ss,dependencyValuesByKey:os,dependencyNamesByKey:ls,arraySize:us}){let cs=[],ds=!1;for(let ps in ns.endpoint)os[ps].endpointAttr&&os[ps].endpointAttr!==null?cs.push({setDependency:ls[ps].endpointAttr,desiredValue:ns.endpoint[ps],variableIndex:0}):ss.endpointShadow!==null?ds=!0:ss.basedOnThrough&&ss.basedOnDirection?cs.push({setDependency:ls[ps].directionX,desiredValue:os[ps].throughX.subtract(ns.endpoint[ps]).simplify()}):cs.push({setEssentialValue:"endpoint",value:{[ps]:convertValueToMathExpression(ns.endpoint[ps])}});if(ds)if(us[0]>1){let ps=["vector"];for(let fs in ns.endpoint)ps[Number(fs)+1]=ns.endpoint[fs].tree;ps.length=us[0]+1,cs.push({setDependency:"endpointShadow",desiredValue:Context.fromAst(ps)})}else us[0]===1&&"0"in ns.endpoint&&cs.push({setDependency:"endpointShadow",desiredValue:ns.endpoint[0]});return{success:!0,instructions:cs}}},rs.numericalEndpoint={forRenderer:!0,returnDependencies(){return{nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"},endpoint:{dependencyType:"stateVariable",variableName:"endpoint"}}},definition({dependencyValues:ns}){if(Number.isNaN(ns.nDimensions))return null;let ss=ns.endpoint,os=[];for(let ls=0;ls({nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"},numericalEndpoint:{dependencyType:"stateVariable",variableName:"numericalEndpoint"},numericalThroughpoint:{dependencyType:"stateVariable",variableName:"numericalThroughpoint"}}),definition({dependencyValues:ns}){let ss=ns.numericalEndpoint[0],os=ns.numericalEndpoint[1],ls=ns.numericalThroughpoint[0],us=ns.numericalThroughpoint[1],cs=Number.isFinite(ss)&&Number.isFinite(os)&&Number.isFinite(ls)&&Number.isFinite(us),ds=ns.nDimensions!==2||!cs||ls===ss&&us===os;return{setValue:{nearestPoint:function({variables:ps,scales:fs}){if(ds)return{};let hs=fs[0],gs=fs[1],ys=(ls-ss)/hs,bs=(us-os)/gs,vs=ys*ys+bs*bs,xs=((ps.x1-ss)/hs*ys+(ps.x2-os)/gs*bs)/vs,Cs={};return xs<=0?Cs={x1:ss,x2:os}:Cs={x1:ss+xs*ys*hs,x2:os+xs*bs*gs},ps.x3!==void 0&&(Cs.x3=0),Cs}}}}},rs}async moveRay({endpointcoords:rs,throughcoords:ns,transient:ss,skippable:os,actionId:ls,sourceInformation:us={},skipRendererUpdate:cs=!1}){let ds=[];if(rs!==void 0){if(await this.stateValues.basedOnThrough&&await this.stateValues.basedOnDirection){let ps;if(ns===void 0){let fs=await this.stateValues.numericalThroughpoint;ps=rs.map((hs,gs)=>fs[gs]-hs)}else ps=rs.map((fs,hs)=>ns[hs]-fs);ds.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"direction",value:ps.map(fs=>Context.fromAst(fs))})}else ds.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"endpoint",value:rs.map(ps=>Context.fromAst(ps))});if(ns===void 0&&!await this.stateValues.basedOnThrough){let ps=await this.stateValues.numericalThroughpoint,fs=rs.map((hs,gs)=>ps[gs]-hs);ds.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"direction",value:fs.map(hs=>Context.fromAst(hs))})}}if(ns!==void 0){if(await this.stateValues.basedOnThrough)ds.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"through",value:ns.map(ps=>Context.fromAst(ps))});else{rs==null&&(rs=await this.stateValues.numericalEndpoint);let ps=rs.map((fs,hs)=>ns[hs]-fs);ds.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"direction",value:ps.map(fs=>Context.fromAst(fs))})}if(rs===void 0&&await this.stateValues.basedOnThrough&&await this.stateValues.basedOnDirection){let ps=await this.stateValues.numericalEndpoint,fs=ns.map((hs,gs)=>hs-ps[gs]);ds.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"direction",value:fs.map(hs=>Context.fromAst(hs))})}}return ss?await this.coreFunctions.performUpdate({updateInstructions:ds,transient:ss,skippable:os,actionId:ls,sourceInformation:us,skipRendererUpdate:cs}):await this.coreFunctions.performUpdate({updateInstructions:ds,actionId:ls,sourceInformation:us,skipRendererUpdate:cs,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{through:ns,endpoint:rs}}})}async rayClicked({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){await this.coreFunctions.triggerChainedActions({triggeringAction:"click",componentName:this.componentName,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss}),this.coreFunctions.resolveAction({actionId:rs})}async mouseDownOnRay({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){await this.coreFunctions.triggerChainedActions({triggeringAction:"down",componentName:this.componentName,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss}),this.coreFunctions.resolveAction({actionId:rs})}}zs(Ray,"componentType","ray");class Polygon extends Polyline{constructor(rs){super(rs),Object.assign(this.actions,{movePolygon:this.movePolygon.bind(this),polygonClicked:this.polygonClicked.bind(this),mouseDownOnPolygon:this.mouseDownOnPolygon.bind(this)})}get movePolygon(){return this.movePolyline}get polygonClicked(){return this.polylineClicked}get mouseDownOnPolygon(){return this.mouseDownOnPolyline}static createAttributesObject(){let rs=super.createAttributesObject();return rs.filled={createComponentOfType:"boolean",createStateVariable:"filled",defaultValue:!1,public:!0,forRenderer:!0},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.styleDescription={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({selectedStyle:{dependencyType:"stateVariable",variableName:"selectedStyle"},filled:{dependencyType:"stateVariable",variableName:"filled"},document:{dependencyType:"ancestor",componentType:"document",variableNames:["theme"]}}),definition:function({dependencyValues:ns}){var us,cs;let ss;((us=ns.document)==null?void 0:us.stateValues.theme)==="dark"?ss=ns.selectedStyle.lineColorWordDarkMode:ss=ns.selectedStyle.lineColorWord;let os=ns.selectedStyle.lineWidthWord;ns.selectedStyle.lineStyleWord&&(os&&(os+=" "),os+=ns.selectedStyle.lineStyleWord),os&&(os+=" ");let ls;if(!ns.filled)ls=os+ss;else{let ds;((cs=ns.document)==null?void 0:cs.stateValues.theme)==="dark"?ds=ns.selectedStyle.fillColorWordDarkMode:ds=ns.selectedStyle.fillColorWord,ds===ss?(ls="filled "+ds,os&&(ls+=" with "+os+"border")):ls="filled "+ds+" with "+os+ss+" border"}return{setValue:{styleDescription:ls}}}},rs.styleDescriptionWithNoun={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({selectedStyle:{dependencyType:"stateVariable",variableName:"selectedStyle"},filled:{dependencyType:"stateVariable",variableName:"filled"},document:{dependencyType:"ancestor",componentType:"document",variableNames:["theme"]}}),definition:function({dependencyValues:ns}){var us,cs;let ss;((us=ns.document)==null?void 0:us.stateValues.theme)==="dark"?ss=ns.selectedStyle.lineColorWordDarkMode:ss=ns.selectedStyle.lineColorWord;let os=ns.selectedStyle.lineWidthWord;ns.selectedStyle.lineStyleWord&&(os&&(os+=" "),os+=ns.selectedStyle.lineStyleWord),os&&(os+=" ");let ls;if(!ns.filled)ls=os+ss+" polygon";else{let ds;((cs=ns.document)==null?void 0:cs.stateValues.theme)==="dark"?ds=ns.selectedStyle.fillColorWordDarkMode:ds=ns.selectedStyle.fillColorWord,ds===ss?(ls="filled "+ds+" polygon",os&&(ls+=" with a "+os+"border")):ls="filled "+ds+" polygon with a "+os+ss+" border"}return{setValue:{styleDescriptionWithNoun:ls}}}},rs.borderStyleDescription={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({selectedStyle:{dependencyType:"stateVariable",variableName:"selectedStyle"},document:{dependencyType:"ancestor",componentType:"document",variableNames:["theme"]}}),definition:function({dependencyValues:ns}){var ls;let ss;((ls=ns.document)==null?void 0:ls.stateValues.theme)==="dark"?ss=ns.selectedStyle.lineColorWordDarkMode:ss=ns.selectedStyle.lineColorWord;let os=ns.selectedStyle.lineWidthWord;return ns.selectedStyle.lineStyleWord&&(os&&(os+=" "),os+=ns.selectedStyle.lineStyleWord),os&&(os+=" "),os+=ss,{setValue:{borderStyleDescription:os}}}},rs.fillStyleDescription={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({selectedStyle:{dependencyType:"stateVariable",variableName:"selectedStyle"},filled:{dependencyType:"stateVariable",variableName:"filled"},document:{dependencyType:"ancestor",componentType:"document",variableNames:["theme"]}}),definition:function({dependencyValues:ns}){var ls;let ss;((ls=ns.document)==null?void 0:ls.stateValues.theme)==="dark"?ss=ns.selectedStyle.fillColorWordDarkMode:ss=ns.selectedStyle.fillColorWord;let os;return ns.filled?os=ss:os="unfilled",{setValue:{fillStyleDescription:os}}}},rs.nearestPoint={returnDependencies:()=>({nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"},numericalVertices:{dependencyType:"stateVariable",variableName:"numericalVertices"},nVertices:{dependencyType:"stateVariable",variableName:"nVertices"}}),definition({dependencyValues:ns}){var hs,gs,ys,bs;let ss=ns.nDimensions,os=ns.nVertices,ls=ns.numericalVertices,us=[],cs,ds,ps=(hs=ls[os-1])==null?void 0:hs[0],fs=(gs=ls[os-1])==null?void 0:gs[1];for(let vs=0;vs=1?Ws={x1:$s,x2:Rs}:Ws={x1:Es+Ms*ks*Cs,x2:_s+Ms*Ps*Ts};let Us=Math.pow((As-Ws.x1)/Cs,2)+Math.pow((ws-Ws.x2)/Ts,2);Us0&&(Ns.x3=0),Ns}}}}},rs}}zs(Polygon,"componentType","polygon"),zs(Polygon,"representsClosedPath",!0);class Triangle extends Polygon{static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions(),ns=rs.styleDescriptionWithNoun.definition;return rs.styleDescriptionWithNoun.definition=function({dependencyValues:ss}){let os=ns({dependencyValues:ss}).setValue.styleDescriptionWithNoun;return os=os.replaceAll("polygon","triangle"),{setValue:{styleDescriptionWithNoun:os}}},rs.vertices.hasEssential=!0,rs.vertices.defaultValueByArrayKey=function(ss){return["0,1","1,0"].includes(ss)?Context.fromAst(1):Context.fromAst(0)},rs.vertices.returnArraySizeDependencies=()=>({nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),rs.vertices.returnArraySize=function({dependencyValues:ss}){return[3,ss.nDimensions]},rs.vertices.arrayDefinitionByKey=function({dependencyValuesByKey:ss,arrayKeys:os}){let ls={},us={};for(let cs of os){let[ds,ps]=cs.split(","),fs=Number(ds)+1+"_"+(Number(ps)+1),hs=ss[cs].vertices;hs!==null&&hs.stateValues["pointX"+fs]?ls[cs]=hs.stateValues["pointX"+fs]:us[cs]=!0}return{setValue:{vertices:ls},useEssentialOrDefaultValue:{vertices:us}}},rs.vertices.inverseArrayDefinitionByKey=async function({desiredStateVariableValues:ss,dependencyValuesByKey:os,dependencyNamesByKey:ls,initialChange:us,stateValues:cs}){if(us&&!await cs.draggable)return{success:!1};let ds=[];for(let ps in ss.vertices){let[fs,hs]=ps.split(","),gs=Number(fs)+1+"_"+(Number(hs)+1);os[ps].vertices!==null&&os[ps].vertices.stateValues["pointX"+gs]?ds.push({setDependency:ls[ps].vertices,desiredValue:ss.vertices[ps],variableIndex:0}):ds.push({setEssentialValue:"vertices",value:{[ps]:ss.vertices[ps].simplify()}})}return{success:!0,instructions:ds}},rs.nVertices={public:!0,shadowingInstructions:{createComponentOfType:"number"},forRenderer:!0,returnDependencies:()=>({}),definition:()=>({setValue:{nVertices:3}})},rs}}zs(Triangle,"componentType","triangle"),zs(Triangle,"rendererType","polygon");class Rectangle extends Polygon{static createAttributesObject(){let rs=super.createAttributesObject();return rs.center={createComponentOfType:"point"},rs.width={createComponentOfType:"number"},rs.height={createComponentOfType:"number"},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions(),ns=rs.styleDescriptionWithNoun.definition;return rs.styleDescriptionWithNoun.definition=function({dependencyValues:ss}){let os=ns({dependencyValues:ss}).setValue.styleDescriptionWithNoun;return os=os.replaceAll("polygon","rectangle"),{setValue:{styleDescriptionWithNoun:os}}},rs.nVerticesSpecified={returnDependencies:()=>({verticesAttr:{dependencyType:"attributeComponent",attributeName:"vertices",variableNames:["nPoints"]}}),definition:function({dependencyValues:ss}){return ss.verticesAttr!==null?{setValue:{nVerticesSpecified:ss.verticesAttr.stateValues.nPoints}}:{setValue:{nVerticesSpecified:0}}}},rs.essentialVertex={isArray:!0,entryPrefixes:["essentialVertexX"],defaultValueByArrayKey:()=>Context.fromAst(0),hasEssential:!0,returnArraySizeDependencies:()=>({nVerticesSpecified:{dependencyType:"stateVariable",variableName:"nVerticesSpecified"}}),returnArraySize({dependencyValues:ss}){return[ss.nVerticesSpecified===0?2:0]},returnArrayDependenciesByKey(){return{}},arrayDefinitionByKey:function({arrayKeys:ss}){let os={};for(let ls of ss)os[ls]=!0;return{useEssentialOrDefaultValue:{essentialVertex:os}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ss}){let os=[];for(let ls in ss.essentialVertex)os.push({setEssentialValue:"essentialVertex",value:{[ls]:ss.essentialVertex[ls]}});return{success:!0,instructions:os}}},rs.haveSpecifiedCenter={returnDependencies:()=>({centerAttr:{dependencyType:"attributeComponent",attributeName:"center"}}),definition:({dependencyValues:ss})=>({setValue:{haveSpecifiedCenter:ss.centerAttr!==null}})},rs.specifiedCenter={isArray:!0,entryPrefixes:["specifiedCenterX"],returnArraySizeDependencies:()=>({haveSpecifiedCenter:{dependencyType:"stateVariable",variableName:"haveSpecifiedCenter"}}),returnArraySize({dependencyValues:ss}){return[ss.haveSpecifiedCenter?2:0]},returnArrayDependenciesByKey({arrayKeys:ss}){let os={};for(let ls of ss){let us=Number(ls)+1;os[ls]={centerAttr:{dependencyType:"attributeComponent",attributeName:"center",variableNames:["x"+us]}}}return{dependenciesByKey:os}},arrayDefinitionByKey:function({dependencyValuesByKey:ss,arrayKeys:os}){let ls={};for(let us of os){let cs=Number(us)+1;ss[us].centerAttr!==null&&(ls[us]=ss[us].centerAttr.stateValues["x"+cs])}return{setValue:{specifiedCenter:ls}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ss,dependencyValuesByKey:os,dependencyNamesByKey:ls}){let us=[];for(let cs in ss.specifiedCenter)os[cs].centerAttr&&os[cs].centerAttr!==null&&us.push({setDependency:ls[cs].centerAttr,desiredValue:ss.specifiedCenter[cs],variableIndex:0});return{success:!0,instructions:us}}},rs.specifiedWidth={defaultValue:1,hasEssential:!0,essentialVarName:"width",returnDependencies(){return{widthAttr:{dependencyType:"attributeComponent",attributeName:"width",variableNames:["value"]},nVerticesSpecified:{dependencyType:"stateVariable",variableName:"nVerticesSpecified"},haveSpecifiedCenter:{dependencyType:"stateVariable",variableName:"haveSpecifiedCenter"}}},definition({dependencyValues:ss}){return ss.widthAttr!==null?{setValue:{specifiedWidth:ss.widthAttr.stateValues.value}}:(ss.haveSpecifiedCenter?1:0)+ss.nVerticesSpecified<=1?{useEssentialOrDefaultValue:{specifiedWidth:!0}}:{setValue:{specifiedWidth:null}}},inverseDefinition({desiredStateVariableValues:ss,dependencyValues:os}){return os.widthAttr!==null?{success:!0,instructions:[{setDependency:"widthAttr",desiredValue:ss.specifiedWidth,childIndex:0,variableIndex:0}]}:{success:!0,instructions:[{setEssentialValue:"specifiedWidth",value:ss.specifiedWidth}]}}},rs.specifiedHeight={defaultValue:1,hasEssential:!0,essentialVarName:"height",returnDependencies(){return{heightAttr:{dependencyType:"attributeComponent",attributeName:"height",variableNames:["value"]},nVerticesSpecified:{dependencyType:"stateVariable",variableName:"nVerticesSpecified"},haveSpecifiedCenter:{dependencyType:"stateVariable",variableName:"haveSpecifiedCenter"}}},definition({dependencyValues:ss}){return ss.heightAttr!==null?{setValue:{specifiedHeight:ss.heightAttr.stateValues.value}}:(ss.haveSpecifiedCenter?1:0)+ss.nVerticesSpecified<=1?{useEssentialOrDefaultValue:{specifiedHeight:!0}}:{setValue:{specifiedHeight:null}}},inverseDefinition({desiredStateVariableValues:ss,dependencyValues:os}){return os.heightAttr!==null?{success:!0,instructions:[{setDependency:"heightAttr",desiredValue:ss.specifiedHeight,variableIndex:0}]}:{success:!0,instructions:[{setEssentialValue:"specifiedHeight",value:ss.specifiedHeight}]}}},rs.center={public:!0,isArray:!0,entryPrefixes:["centerX"],shadowingInstructions:{createComponentOfType:"math",returnWrappingComponents(ss){return ss==="centerX"?[]:[["point",{componentType:"mathList",isAttribute:"xs"}]]}},returnArraySizeDependencies:()=>({}),returnArraySize:()=>[2],returnArrayDependenciesByKey({arrayKeys:ss}){let os={};for(let ls of ss){let us=Number(ls)+1;os[ls]={vertex0:{dependencyType:"stateVariable",variableName:"vertexX1_"+us},vertex2:{dependencyType:"stateVariable",variableName:"vertexX3_"+us}}}return{dependenciesByKey:os}},arrayDefinitionByKey({dependencyValuesByKey:ss,arrayKeys:os}){let ls={};for(let us of os){let cs=ss[us].vertex0,ds=ss[us].vertex2;ls[us]=cs.add(ds).divide(2).simplify()}return{setValue:{center:ls}}},async inverseArrayDefinitionByKey({desiredStateVariableValues:ss,dependencyValuesByKey:os,dependencyNamesByKey:ls,stateValues:us}){let cs=[],ds=await us.center;for(let ps in ss.center){let fs=Number(ps),hs=os[ps].vertex0,gs=os[ps].vertex2,ys=ss.center[fs].subtract(ds[fs]),bs=hs.add(ys).simplify(),vs=gs.add(ys).simplify();cs.push({setDependency:ls[ps].vertex0,desiredValue:bs},{setDependency:ls[ps].vertex2,desiredValue:vs})}return{success:!0,instructions:cs}}},rs.width={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies({}){return{vertex0:{dependencyType:"stateVariable",variableName:"vertexX1_1"},vertex2:{dependencyType:"stateVariable",variableName:"vertexX3_1"}}},definition({dependencyValues:ss}){let os=ss.vertex0.evaluate_to_constant(),ls=ss.vertex2.evaluate_to_constant();return{setValue:{width:Math.abs(os-ls)}}},inverseDefinition({desiredStateVariableValues:ss,dependencyValues:os}){let ls=os.vertex0.evaluate_to_constant(),us=os.vertex2.evaluate_to_constant(),cs=(us+ls)/2,ps=(us-ls<0?-1:1)*Math.max(0,ss.width)/2,fs=Context.fromAst(cs-ps),hs=Context.fromAst(cs+ps);return{success:!0,instructions:[{setDependency:"vertex0",desiredValue:fs},{setDependency:"vertex2",desiredValue:hs}]}}},rs.height={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies({}){return{vertex0:{dependencyType:"stateVariable",variableName:"vertexX1_2"},vertex2:{dependencyType:"stateVariable",variableName:"vertexX3_2"}}},definition({dependencyValues:ss}){let os=ss.vertex0.evaluate_to_constant(),ls=ss.vertex2.evaluate_to_constant();return{setValue:{height:Math.abs(os-ls)}}},inverseDefinition({desiredStateVariableValues:ss,dependencyValues:os}){let ls=os.vertex0.evaluate_to_constant(),us=os.vertex2.evaluate_to_constant(),cs=(us+ls)/2,ps=(us-ls<0?-1:1)*Math.max(0,ss.height)/2,fs=Context.fromAst(cs-ps),hs=Context.fromAst(cs+ps);return{success:!0,instructions:[{setDependency:"vertex0",desiredValue:fs},{setDependency:"vertex2",desiredValue:hs}]}}},rs.vertices={public:!0,shadowingInstructions:{createComponentOfType:"math",returnWrappingComponents(ss){return ss==="vertexX"?[]:[["point",{componentType:"mathList",isAttribute:"xs"}]]}},isArray:!0,nDimensions:2,entryPrefixes:["vertexX","vertex"],getArrayKeysFromVarName({arrayEntryPrefix:ss,varEnding:os,arraySize:ls}){if(ss==="vertexX"){let us=os.split("_").map(cs=>Number(cs)-1);return us.length===2&&us.every((cs,ds)=>Number.isInteger(cs)&&cs>=0)?ls?us.every((cs,ds)=>cs=0?ls?usus+","+ds):[]:[us+",0"]:[]}},arrayVarNameFromPropIndex(ss,os){if(os==="vertices")return ss.length===1?"vertex"+ss[0]:`vertexX${ss[0]}_${ss[1]}`;if(os.slice(0,6)==="vertex"){let ls=Number(os.slice(6));if(Number.isInteger(ls)&&ls>0)return`vertexX${ls}_${ss[0]}`}return null},stateVariablesDeterminingDependencies:["nVerticesSpecified","haveSpecifiedCenter"],returnArraySizeDependencies:()=>({}),returnArraySize(){return[4,2]},returnArrayDependenciesByKey({arrayKeys:ss,stateValues:os}){let ls={},us={nVerticesSpecified:{dependencyType:"stateVariable",variableName:"nVerticesSpecified"}};if(os.nVerticesSpecified===0)if(us.haveSpecifiedCenter={dependencyType:"stateVariable",variableName:"haveSpecifiedCenter"},os.haveSpecifiedCenter)for(let cs of ss){let[ds,ps]=cs.split(",");ls[cs]={specifiedCenter:{dependencyType:"stateVariable",variableName:"specifiedCenterX"+(Number(ps)+1)}},ps==="0"?ls[cs].specifiedWidth={dependencyType:"stateVariable",variableName:"specifiedWidth"}:ls[cs].specifiedHeight={dependencyType:"stateVariable",variableName:"specifiedHeight"}}else for(let cs of ss){let[ds,ps]=cs.split(",");ls[cs]={essentialVertex:{dependencyType:"stateVariable",variableName:"essentialVertexX"+(Number(ps)+1)}},ps==="0"?(ds==="1"||ds==="2")&&(ls[cs].specifiedWidth={dependencyType:"stateVariable",variableName:"specifiedWidth"}):(ds==="2"||ds==="3")&&(ls[cs].specifiedHeight={dependencyType:"stateVariable",variableName:"specifiedHeight"})}else if(os.nVerticesSpecified===1)if(us.haveSpecifiedCenter={dependencyType:"stateVariable",variableName:"haveSpecifiedCenter"},os.haveSpecifiedCenter)for(let cs of ss){let[ds,ps]=cs.split(","),fs="1_"+(Number(ps)+1);ls[cs]={verticesAttr:{dependencyType:"attributeComponent",attributeName:"vertices",variableNames:["pointX"+fs]}},(ps==="0"&&ds==="1"||ds==="2"||ps==="1"&&ds==="2"||ds==="3")&&(ls[cs].specifiedCenter={dependencyType:"stateVariable",variableName:"specifiedCenterX"+(Number(ps)+1)})}else for(let cs of ss){let[ds,ps]=cs.split(","),fs="1_"+(Number(ps)+1);ls[cs]={verticesAttr:{dependencyType:"attributeComponent",attributeName:"vertices",variableNames:["pointX"+fs]}},ps==="0"?(ds==="1"||ds==="2")&&(ls[cs].specifiedWidth={dependencyType:"stateVariable",variableName:"specifiedWidth"}):(ds==="2"||ds==="3")&&(ls[cs].specifiedHeight={dependencyType:"stateVariable",variableName:"specifiedHeight"})}else for(let cs of ss){let[ds,ps]=cs.split(","),fs="1_"+(Number(ps)+1),hs="2_"+(Number(ps)+1),gs;ds==="0"?gs=fs:ds==="2"?gs=hs:ds==="1"?ps==="0"?gs=hs:gs=fs:ps==="0"?gs=fs:gs=hs,ls[cs]={verticesAttr:{dependencyType:"attributeComponent",attributeName:"vertices",variableNames:["pointX"+gs]}}}return{dependenciesByKey:ls,globalDependencies:us}},arrayDefinitionByKey({dependencyValuesByKey:ss,arrayKeys:os,globalDependencyValues:ls}){let us={};if(ls.nVerticesSpecified===0)if(ls.haveSpecifiedCenter)for(let cs of os){let[ds,ps]=cs.split(","),fs=ss[cs].specifiedCenter;if(ps==="0"){let hs=ss[cs].specifiedWidth;ds==="0"||ds==="3"?us[cs]=fs.subtract(hs/2):us[cs]=fs.add(hs/2)}else{let hs=ss[cs].specifiedHeight;ds==="0"||ds==="1"?us[cs]=fs.subtract(hs/2):us[cs]=fs.add(hs/2)}}else for(let cs of os){let[ds,ps]=cs.split(","),fs=ss[cs].essentialVertex;if(ps==="0")if(ds==="0"||ds==="3")us[cs]=fs;else{let hs=ss[cs].specifiedWidth;us[cs]=fs.add(hs)}else if(ds==="0"||ds==="1")us[cs]=fs;else{let hs=ss[cs].specifiedHeight;us[cs]=fs.add(hs)}}else if(ls.nVerticesSpecified===1)if(ls.haveSpecifiedCenter)for(let cs of os){let[ds,ps]=cs.split(","),fs=ss[cs].verticesAttr,hs;if(fs!==null&&Object.keys(fs.stateValues).length===1?hs=Object.values(fs.stateValues)[0]:hs=Context.fromAst("_"),ps==="0"&&(ds==="0"||ds==="3")||ps==="1"&&(ds==="0"||ds==="1"))us[cs]=hs;else{let gs=ss[cs].specifiedCenter;us[cs]=hs.add(gs.subtract(hs).multiply(2))}}else for(let cs of os){let[ds,ps]=cs.split(","),fs=ss[cs].verticesAttr,hs;if(fs!==null&&Object.keys(fs.stateValues).length===1?hs=Object.values(fs.stateValues)[0]:hs=Context.fromAst("_"),ps==="0")if(ds==="0"||ds==="3")us[cs]=hs;else{let gs=ss[cs].specifiedWidth;us[cs]=hs.add(gs)}else if(ds==="0"||ds==="1")us[cs]=hs;else{let gs=ss[cs].specifiedHeight;us[cs]=hs.add(gs)}}else for(let cs of os){let ds=ss[cs].verticesAttr;ds!==null&&Object.keys(ds.stateValues).length===1?us[cs]=Object.values(ds.stateValues)[0]:us[cs]=Context.fromAst("_")}return{setValue:{vertices:us}}},async inverseArrayDefinitionByKey({desiredStateVariableValues:ss,dependencyValuesByKey:os,globalDependencyValues:ls,stateValues:us,workspace:cs,initialChange:ds,dependencyNamesByKey:ps}){if(!cs.v0){let Cs=await us.vertices;cs.v0=[...Cs[0]],cs.v2=[...Cs[2]]}let fs,hs,gs,ys,bs,vs;for(let Cs in ss.vertices){let[Ts,Ss]=Cs.split(","),Ns=ss.vertices[Cs];Ts==="0"?cs.v0[Number(Ss)]=Ns:Ts==="2"?cs.v2[Number(Ss)]=Ns:Ts==="1"?Ss==="0"?cs.v2[Number(Ss)]=Ns:cs.v0[Number(Ss)]=Ns:Ss==="0"?cs.v0[Number(Ss)]=Ns:cs.v2[Number(Ss)]=Ns,Ss==="0"?(fs=Cs,Ts==="0"||Ts==="3"?gs=Cs:bs=Cs):(hs=Cs,Ts==="0"||Ts==="1"?ys=Cs:vs=Cs)}let xs=[];if(ls.nVerticesSpecified===0)if(ls.haveSpecifiedCenter){if(fs!==void 0){let Cs=cs.v2[0].subtract(cs.v0[0]).evaluate_to_constant(),Ts=cs.v2[0].add(cs.v0[0]).divide(2).simplify();xs.push({setDependency:ps[fs].specifiedWidth,desiredValue:Cs},{setDependency:ps[fs].specifiedCenter,desiredValue:Ts})}if(hs!==void 0){let Cs=cs.v2[1].subtract(cs.v0[1]).evaluate_to_constant(),Ts=cs.v2[1].add(cs.v0[1]).divide(2).simplify();xs.push({setDependency:ps[hs].specifiedHeight,desiredValue:Cs},{setDependency:ps[hs].specifiedCenter,desiredValue:Ts})}}else{if(gs!==void 0){let Cs=cs.v0[0].simplify();xs.push({setDependency:ps[gs].essentialVertex,desiredValue:Cs})}if(bs!==void 0){let Cs=cs.v2[0].subtract(cs.v0[0]).evaluate_to_constant();xs.push({setDependency:ps[bs].specifiedWidth,desiredValue:Cs})}if(ys!==void 0){let Cs=cs.v0[1].simplify();xs.push({setDependency:ps[ys].essentialVertex,desiredValue:Cs})}if(vs!==void 0){let Cs=cs.v2[1].subtract(cs.v0[1]).evaluate_to_constant();xs.push({setDependency:ps[vs].specifiedHeight,desiredValue:Cs})}}else if(ls.nVerticesSpecified===1)if(ls.haveSpecifiedCenter){if(gs!==void 0){let Cs=cs.v0[0].simplify();xs.push({setDependency:ps[gs].verticesAttr,desiredValue:Cs,variableIndex:0})}if(bs!==void 0){let Cs=cs.v2[0].add(cs.v0[0]).divide(2).simplify();xs.push({setDependency:ps[bs].specifiedCenter,desiredValue:Cs})}if(ys!==void 0){let Cs=cs.v0[1].simplify();xs.push({setDependency:ps[ys].verticesAttr,desiredValue:Cs,variableIndex:0})}if(vs!==void 0){let Cs=cs.v2[1].add(cs.v0[1]).divide(2).simplify();xs.push({setDependency:ps[vs].specifiedCenter,desiredValue:Cs})}}else{if(gs!==void 0){let Cs=cs.v0[0].simplify();xs.push({setDependency:ps[gs].verticesAttr,desiredValue:Cs,variableIndex:0})}if(bs!==void 0){let Cs=cs.v2[0].subtract(cs.v0[0]).evaluate_to_constant();xs.push({setDependency:ps[bs].specifiedWidth,desiredValue:Cs})}if(ys!==void 0){let Cs=cs.v0[1].simplify();xs.push({setDependency:ps[ys].verticesAttr,desiredValue:Cs,variableIndex:0})}if(vs!==void 0){let Cs=cs.v2[1].subtract(cs.v0[1]).evaluate_to_constant();xs.push({setDependency:ps[vs].specifiedHeight,desiredValue:Cs})}}else gs!==void 0&&xs.push({setDependency:ps[gs].verticesAttr,desiredValue:cs.v0[0],variableIndex:0}),bs!==void 0&&xs.push({setDependency:ps[bs].verticesAttr,desiredValue:cs.v2[0],variableIndex:0}),ys!==void 0&&xs.push({setDependency:ps[ys].verticesAttr,desiredValue:cs.v0[1],variableIndex:0}),vs!==void 0&&xs.push({setDependency:ps[vs].verticesAttr,desiredValue:cs.v2[1],variableIndex:0});return{success:!0,instructions:xs}}},rs.nVertices={public:!0,shadowingInstructions:{createComponentOfType:"number"},forRenderer:!0,returnDependencies:()=>({}),definition:()=>({setValue:{nVertices:4}})},rs}async movePolygon({pointCoords:rs,transient:ns,sourceDetails:ss,actionId:os,sourceInformation:ls={},skipRendererUpdate:us=!1}){if(Object.keys(rs).length===1){if(!await this.stateValues.verticesDraggable)return await this.coreFunctions.resolveAction({actionId:os})}else if(!await this.stateValues.draggable)return await this.coreFunctions.resolveAction({actionId:os});let ds=[],ps={};for(let fs in rs)ps[fs+",0"]=Context.fromAst(rs[fs][0]),ps[fs+",1"]=Context.fromAst(rs[fs][1]);if(ds.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"vertices",value:ps,sourceDetails:ss}),Object.keys(rs).length===1){let fs=Number(Object.keys(rs)[0]),hs=Context.fromAst(rs[fs][0]),gs=Context.fromAst(rs[fs][1]),ys=(fs+2)%4,bs=await this.stateValues.vertices,vs=bs[ys][0],xs=bs[ys][1];if(await this.stateValues.nVerticesSpecified<2)if(await this.stateValues.haveSpecifiedCenter){let Cs,Ts;fs===0?(Cs=hs.add(vs).divide(2),Ts=gs.add(xs).divide(2)):fs===1?Ts=gs.add(xs).divide(2):fs===3&&(Cs=hs.add(vs).divide(2)),Cs!==void 0&&ds.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"specifiedCenter",value:{0:Cs.simplify()}}),Ts!==void 0&&ds.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"specifiedCenter",value:{1:Ts.simplify()}})}else{let Cs,Ts;fs===0?(Cs=vs.subtract(hs),Ts=xs.subtract(gs)):fs===1?Ts=xs.subtract(gs):fs===3&&(Cs=vs.subtract(hs)),Cs!==void 0&&ds.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"specifiedWidth",value:Cs.simplify()}),Ts!==void 0&&ds.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"specifiedHeight",value:Ts.simplify()})}}return ns?await this.coreFunctions.performUpdate({updateInstructions:ds,transient:ns,actionId:os,sourceInformation:ls,skipRendererUpdate:us}):await this.coreFunctions.performUpdate({updateInstructions:ds,actionId:os,sourceInformation:ls,skipRendererUpdate:us,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{pointCoordinates:rs}}})}}zs(Rectangle,"componentType","rectangle"),zs(Rectangle,"rendererType","polygon");class RegularPolygon extends Polygon{static createAttributesObject(){let rs=super.createAttributesObject();return rs.nVertices={createComponentOfType:"number",createStateVariable:"nVertices",defaultValue:3,public:!0,forRenderer:!0},rs.center={createComponentOfType:"point"},rs.circumradius={createComponentOfType:"number"},rs.radius={createComponentOfType:"number"},rs.inradius={createComponentOfType:"number"},rs.apothem={createComponentOfType:"number"},rs.sideLength={createComponentOfType:"number"},rs.perimeter={createComponentOfType:"number"},rs.area={createComponentOfType:"number"},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();delete rs.nVertices;let ns=rs.styleDescriptionWithNoun.returnDependencies();ns.nSides={dependencyType:"stateVariable",variableName:"nSides"},rs.styleDescriptionWithNoun.returnDependencies=()=>ns;let ss=rs.styleDescriptionWithNoun.definition;return rs.styleDescriptionWithNoun.definition=function({dependencyValues:os}){let ls=ss({dependencyValues:os}).setValue.styleDescriptionWithNoun;return ls=ls.replaceAll("polygon",`${os.nSides}-sided regular polygon`),{setValue:{styleDescriptionWithNoun:ls}}},rs.nVerticesSpecified={returnDependencies:()=>({verticesAttr:{dependencyType:"attributeComponent",attributeName:"vertices",variableNames:["nPoints"]}}),definition:function({dependencyValues:os}){return os.verticesAttr!==null?{setValue:{nVerticesSpecified:os.verticesAttr.stateValues.nPoints}}:{setValue:{nVerticesSpecified:0}}}},rs.essentialDirection={isArray:!0,entryPrefixes:["essentialVertexX"],defaultValueByArrayKey:()=>0,hasEssential:!0,returnArraySizeDependencies:()=>({nVerticesSpecified:{dependencyType:"stateVariable",variableName:"nVerticesSpecified"},haveSpecifiedCenter:{dependencyType:"stateVariable",variableName:"haveSpecifiedCenter"}}),returnArraySize({dependencyValues:os}){return[(os.haveSpecifiedCenter?1:0)+os.nVerticesSpecified<=1?2:0]},returnArrayDependenciesByKey(){return{}},arrayDefinitionByKey:function({arrayKeys:os}){let ls={};for(let us of os)us==="0"?ls[us]={defaultValue:1}:ls[us]=!0;return{useEssentialOrDefaultValue:{essentialDirection:ls}}},inverseArrayDefinitionByKey({desiredStateVariableValues:os}){let ls=[];for(let us in os.essentialDirection)ls.push({setEssentialValue:"essentialDirection",value:{[us]:os.essentialDirection[us]}});return{success:!0,instructions:ls}}},rs.haveSpecifiedCenter={returnDependencies:()=>({centerAttr:{dependencyType:"attributeComponent",attributeName:"center"}}),definition:({dependencyValues:os})=>({setValue:{haveSpecifiedCenter:os.centerAttr!==null}})},rs.specifiedCenter={isArray:!0,entryPrefixes:["specifiedCenterX"],returnArraySizeDependencies:()=>({haveSpecifiedCenter:{dependencyType:"stateVariable",variableName:"haveSpecifiedCenter"}}),returnArraySize({dependencyValues:os}){return[os.haveSpecifiedCenter?2:0]},returnArrayDependenciesByKey({arrayKeys:os}){let ls={};for(let us of os){let cs=Number(us)+1;ls[us]={centerAttr:{dependencyType:"attributeComponent",attributeName:"center",variableNames:["x"+cs]}}}return{dependenciesByKey:ls}},arrayDefinitionByKey:function({dependencyValuesByKey:os,arrayKeys:ls}){let us={};for(let cs of ls){let ds=Number(cs)+1;os[cs].centerAttr!==null&&(us[cs]=os[cs].centerAttr.stateValues["x"+ds].evaluate_to_constant())}return{setValue:{specifiedCenter:us}}},inverseArrayDefinitionByKey({desiredStateVariableValues:os,dependencyValuesByKey:ls,dependencyNamesByKey:us}){let cs=[];for(let ds in os.specifiedCenter)ls[ds].centerAttr&&ls[ds].centerAttr!==null&&cs.push({setDependency:us[ds].centerAttr,desiredValue:Context.fromAst(os.specifiedCenter[ds]),variableIndex:0});return{success:!0,instructions:cs}}},rs.essentialCenter={isArray:!0,entryPrefixes:["essentialCenterX"],defaultValueByArrayKey:()=>0,hasEssential:!0,returnArraySizeDependencies:()=>({haveSpecifiedCenter:{dependencyType:"stateVariable",variableName:"haveSpecifiedCenter"}}),returnArraySize({dependencyValues:os}){return[os.haveSpecifiedCenter?0:2]},returnArrayDependenciesByKey(){return{}},arrayDefinitionByKey:function({arrayKeys:os}){let ls={};for(let us of os)ls[us]=!0;return{useEssentialOrDefaultValue:{essentialCenter:ls}}},inverseArrayDefinitionByKey({desiredStateVariableValues:os}){let ls=[];for(let us in os.essentialCenter)ls.push({setEssentialValue:"essentialCenter",value:{[us]:os.essentialCenter[us]}});return{success:!0,instructions:ls}}},rs.specifiedCircumradius={returnDependencies(){return{circumradiusAttr:{dependencyType:"attributeComponent",attributeName:"circumradius",variableNames:["value"]},radiusAttr:{dependencyType:"attributeComponent",attributeName:"radius",variableNames:["value"]},nVerticesSpecified:{dependencyType:"stateVariable",variableName:"nVerticesSpecified"},haveSpecifiedCenter:{dependencyType:"stateVariable",variableName:"haveSpecifiedCenter"}}},definition({dependencyValues:os}){return os.circumradiusAttr!==null?{setValue:{specifiedCircumradius:os.circumradiusAttr.stateValues.value}}:os.radiusAttr!==null?{setValue:{specifiedCircumradius:os.radiusAttr.stateValues.value}}:{setValue:{specifiedCircumradius:null}}},inverseDefinition({desiredStateVariableValues:os,dependencyValues:ls}){return ls.circumradiusAttr!==null?{success:!0,instructions:[{setDependency:"circumradiusAttr",desiredValue:os.specifiedCircumradius,childIndex:0,variableIndex:0}]}:ls.radiusAttr!==null?{success:!0,instructions:[{setDependency:"radiusAttr",desiredValue:os.specifiedCircumradius,childIndex:0,variableIndex:0}]}:{success:!1}}},rs.specifiedInradius={returnDependencies(){return{inradiusAttr:{dependencyType:"attributeComponent",attributeName:"inradius",variableNames:["value"]},apothemAttr:{dependencyType:"attributeComponent",attributeName:"apothem",variableNames:["value"]}}},definition({dependencyValues:os}){return os.inradiusAttr!==null?{setValue:{specifiedInradius:os.inradiusAttr.stateValues.value}}:os.apothemAttr!==null?{setValue:{specifiedInradius:os.apothemAttr.stateValues.value}}:{setValue:{specifiedInradius:null}}},inverseDefinition({desiredStateVariableValues:os,dependencyValues:ls}){return ls.inradiusAttr!==null?{success:!0,instructions:[{setDependency:"inradiusAttr",desiredValue:os.specifiedInradius,childIndex:0,variableIndex:0}]}:ls.apothemAttr!==null?{success:!0,instructions:[{setDependency:"apothemAttr",desiredValue:os.specifiedInradius,childIndex:0,variableIndex:0}]}:{sucess:!1}}},rs.specifiedSideLength={returnDependencies(){return{sideLengthAttr:{dependencyType:"attributeComponent",attributeName:"sideLength",variableNames:["value"]}}},definition({dependencyValues:os}){return os.sideLengthAttr!==null?{setValue:{specifiedSideLength:os.sideLengthAttr.stateValues.value}}:{setValue:{specifiedSideLength:null}}},inverseDefinition({desiredStateVariableValues:os,dependencyValues:ls}){return ls.sideLengthAttr!==null?{success:!0,instructions:[{setDependency:"sideLengthAttr",desiredValue:os.specifiedSideLength,childIndex:0,variableIndex:0}]}:{sucess:!1}}},rs.specifiedPerimeter={returnDependencies(){return{perimeterAttr:{dependencyType:"attributeComponent",attributeName:"perimeter",variableNames:["value"]}}},definition({dependencyValues:os}){return os.perimeterAttr!==null?{setValue:{specifiedPerimeter:os.perimeterAttr.stateValues.value}}:{setValue:{specifiedPerimeter:null}}},inverseDefinition({desiredStateVariableValues:os,dependencyValues:ls}){return ls.perimeterAttr!==null?{success:!0,instructions:[{setDependency:"perimeterAttr",desiredValue:os.specifiedPerimeter,childIndex:0,variableIndex:0}]}:{sucess:!1}}},rs.specifiedArea={returnDependencies(){return{areaAttr:{dependencyType:"attributeComponent",attributeName:"area",variableNames:["value"]}}},definition({dependencyValues:os}){return os.areaAttr!==null?{setValue:{specifiedArea:os.areaAttr.stateValues.value}}:{setValue:{specifiedArea:null}}},inverseDefinition({desiredStateVariableValues:os,dependencyValues:ls}){return ls.areaAttr!==null?{success:!0,instructions:[{setDependency:"areaAttr",desiredValue:os.specifiedArea,childIndex:0,variableIndex:0}]}:{sucess:!1}}},rs.essentialCircumradius={hasEssential:!0,defaultValue:1,returnDependencies:()=>({}),definition:()=>({useEssentialOrDefaultValue:{essentialCircumradius:!0}}),inverseDefinition({desiredStateVariableValues:os}){return{success:!0,instructions:[{setEssentialValue:"essentialCircumradius",value:os.essentialCircumradius}]}}},rs.centerComponents={additionalStateVariablesDefined:["directionWithRadius"],returnDependencies:()=>({nVertices:{dependencyType:"stateVariable",variableName:"nVertices"},nVerticesSpecified:{dependencyType:"stateVariable",variableName:"nVerticesSpecified"},haveSpecifiedCenter:{dependencyType:"stateVariable",variableName:"haveSpecifiedCenter"},specifiedCircumradius:{dependencyType:"stateVariable",variableName:"specifiedCircumradius"},specifiedInradius:{dependencyType:"stateVariable",variableName:"specifiedInradius"},specifiedSideLength:{dependencyType:"stateVariable",variableName:"specifiedSideLength"},specifiedPerimeter:{dependencyType:"stateVariable",variableName:"specifiedPerimeter"},specifiedArea:{dependencyType:"stateVariable",variableName:"specifiedArea"},essentialCircumradius:{dependencyType:"stateVariable",variableName:"essentialCircumradius"},essentialDirection:{dependencyType:"stateVariable",variableName:"essentialDirection"},verticesAttr:{dependencyType:"attributeComponent",attributeName:"vertices",variableNames:["points"]},specifiedCenter:{dependencyType:"stateVariable",variableName:"specifiedCenter"},essentialCenter:{dependencyType:"stateVariable",variableName:"essentialCenter"}}),definition({dependencyValues:os}){let ls=os.nVertices,us,cs;if(os.nVerticesSpecified===0){os.haveSpecifiedCenter?us=os.specifiedCenter:us=os.essentialCenter;let ds;os.specifiedCircumradius!==null?ds=os.specifiedCircumradius:os.specifiedInradius!==null?ds=os.specifiedInradius/Math.cos(Math.PI/ls):os.specifiedSideLength!==null?ds=os.specifiedSideLength/(2*Math.sin(Math.PI/ls)):os.specifiedPerimeter!==null?ds=os.specifiedPerimeter/(2*ls*Math.sin(Math.PI/ls)):os.specifiedArea!==null?ds=Math.sqrt(os.specifiedArea/(ls/2*Math.sin(2*Math.PI/ls))):ds=os.essentialCircumradius,cs=os.essentialDirection.map(ps=>ps*ds)}else if(os.haveSpecifiedCenter){us=os.specifiedCenter;let ds=os.verticesAttr.stateValues.points[0].map(ps=>ps.evaluate_to_constant());cs=[ds[0]-us[0],ds[1]-us[1]]}else if(os.nVerticesSpecified===1){let ds;os.specifiedCircumradius!==null?ds=os.specifiedCircumradius:os.specifiedInradius!==null?ds=os.specifiedInradius/Math.cos(Math.PI/ls):os.specifiedSideLength!==null?ds=os.specifiedSideLength/(2*Math.sin(Math.PI/ls)):os.specifiedPerimeter!==null?ds=os.specifiedPerimeter/(2*ls*Math.sin(Math.PI/ls)):os.specifiedArea!==null?ds=Math.sqrt(os.specifiedArea/(ls/2*Math.sin(2*Math.PI/ls))):ds=os.essentialCircumradius,cs=os.essentialDirection.map(fs=>fs*ds);let ps=os.verticesAttr.stateValues.points[0].map(fs=>fs.evaluate_to_constant());us=[ps[0]-cs[0],ps[1]-cs[1]]}else{let ds=os.verticesAttr.stateValues.points[0].map(vs=>vs.evaluate_to_constant()),ps=os.verticesAttr.stateValues.points[1].map(vs=>vs.evaluate_to_constant()),fs=[ps[0]-ds[0],ps[1]-ds[1]],hs=[(ds[0]+ps[0])/2,(ds[1]+ps[1])/2],gs=Math.sqrt(fs[0]**2+fs[1]**2),ys=gs/(2*Math.tan(Math.PI/ls)),bs=[-fs[1]/gs,fs[0]/gs];us=[hs[0]+bs[0]*ys,hs[1]+bs[1]*ys],cs=[ds[0]-us[0],ds[1]-us[1]]}return{setValue:{centerComponents:us,directionWithRadius:cs}}},async inverseDefinition({desiredStateVariableValues:os,dependencyValues:ls,workspace:us,stateValues:cs}){let ds=ls.nVertices,ps=[],fs=os.centerComponents;fs||(fs=us.desiredCenter),fs||(fs=(await cs.center).map(gs=>gs.evaluate_to_constant()));let hs=os.directionWithRadius;if(hs||(hs=us.desiredDirectionWithRadius),!hs){let gs=(await cs.center).map(bs=>bs.evaluate_to_constant()),ys=(await cs.vertices)[0].map(bs=>bs.evaluate_to_constant());hs=[ys[0]-gs[0],ys[1]-gs[1]]}if(us.desiredCenter=fs,us.desiredDirectionWithRadius=hs,ls.nVerticesSpecified===0){ls.haveSpecifiedCenter?ps.push({setDependency:"specifiedCenter",desiredValue:fs}):ps.push({setDependency:"essentialCenter",desiredValue:fs});let gs=Math.sqrt(hs[0]**2+hs[1]**2),ys=hs.map(bs=>bs/gs);ls.specifiedCircumradius!==null?ps.push({setDependency:"specifiedCircumradius",desiredValue:gs}):ls.specifiedInradius!==null?ps.push({setDependency:"specifiedInradius",desiredValue:gs*Math.cos(Math.PI/ds)}):ls.specifiedSideLength!==null?ps.push({setDependency:"specifiedSideLength",desiredValue:gs*(2*Math.sin(Math.PI/ds))}):ls.specifiedPerimeter!==null?ps.push({setDependency:"specifiedPerimeter",desiredValue:gs*(2*ds*Math.sin(Math.PI/ds))}):ls.specifiedArea!==null?ps.push({setDependency:"specifiedArea",desiredValue:gs**2*(ds/2*Math.sin(2*Math.PI/ds))}):ps.push({setDependency:"essentialCircumradius",desiredValue:gs}),ps.push({setDependency:"essentialDirection",desiredValue:ys})}else if(ls.haveSpecifiedCenter){ps.push({setDependency:"specifiedCenter",desiredValue:fs});let gs={"0,0":Context.fromAst(hs[0]+fs[0]),"0,1":Context.fromAst(hs[1]+fs[1])};ps.push({setDependency:"verticesAttr",desiredValue:gs,variableIndex:0})}else if(ls.nVerticesSpecified===1){let gs=Math.sqrt(hs[0]**2+hs[1]**2),ys=hs.map(vs=>vs/gs);ls.specifiedCircumradius!==null?ps.push({setDependency:"specifiedCircumradius",desiredValue:gs}):ls.specifiedInradius!==null?ps.push({setDependency:"specifiedInradius",desiredValue:gs*Math.cos(Math.PI/ds)}):ls.specifiedSideLength!==null?ps.push({setDependency:"specifiedSideLength",desiredValue:gs*(2*Math.sin(Math.PI/ds))}):ls.specifiedPerimeter!==null?ps.push({setDependency:"specifiedPerimeter",desiredValue:gs*(2*ds*Math.sin(Math.PI/ds))}):ls.specifiedArea!==null?ps.push({setDependency:"specifiedArea",desiredValue:gs**2*(ds/2*Math.sin(2*Math.PI/ds))}):ps.push({setDependency:"essentialCircumradius",desiredValue:gs}),ps.push({setDependency:"essentialDirection",desiredValue:ys});let bs={"0,0":Context.fromAst(hs[0]+fs[0]),"0,1":Context.fromAst(hs[1]+fs[1])};ps.push({setDependency:"verticesAttr",desiredValue:bs,variableIndex:0})}else{let gs=2*Math.PI/ds,ys=Math.cos(gs),bs=Math.sin(gs),vs=[hs[0]*ys-hs[1]*bs,hs[0]*bs+hs[1]*ys],xs={"0,0":Context.fromAst(hs[0]+fs[0]),"0,1":Context.fromAst(hs[1]+fs[1]),"1,0":Context.fromAst(vs[0]+fs[0]),"1,1":Context.fromAst(vs[1]+fs[1])};ps.push({setDependency:"verticesAttr",desiredValue:xs,variableIndex:0})}return{success:!0,instructions:ps}}},rs.vertices={public:!0,shadowingInstructions:{createComponentOfType:"math",returnWrappingComponents(os){return os==="vertexX"?[]:[["point",{componentType:"mathList",isAttribute:"xs"}]]}},isArray:!0,nDimensions:2,entryPrefixes:["vertexX","vertex"],getArrayKeysFromVarName({arrayEntryPrefix:os,varEnding:ls,arraySize:us}){if(os==="vertexX"){let cs=ls.split("_").map(ds=>Number(ds)-1);return cs.length===2&&cs.every((ds,ps)=>Number.isInteger(ds)&&ds>=0)?us?cs.every((ds,ps)=>ds=0?us?cscs+","+ps):[]:[cs+",0"]:[]}},arrayVarNameFromPropIndex(os,ls){if(ls==="vertices")return os.length===1?"vertex"+os[0]:`vertexX${os[0]}_${os[1]}`;if(ls.slice(0,6)==="vertex"){let us=Number(ls.slice(6));if(Number.isInteger(us)&&us>0)return`vertexX${us}_${os[0]}`}return null},returnArraySizeDependencies:()=>({nVertices:{dependencyType:"stateVariable",variableName:"nVertices"}}),returnArraySize({dependencyValues:os}){return[os.nVertices,2]},returnArrayDependenciesByKey(){return{globalDependencies:{nVertices:{dependencyType:"stateVariable",variableName:"nVertices"},centerComponents:{dependencyType:"stateVariable",variableName:"centerComponents"},directionWithRadius:{dependencyType:"stateVariable",variableName:"directionWithRadius"}}}},arrayDefinitionByKey({globalDependencyValues:os}){let ls=os.nVertices,us=os.centerComponents,cs=os.directionWithRadius,ds={};if(us.some(ps=>!Number.isFinite(ps))||cs.some(ps=>!Number.isFinite(ps)))for(let ps=0;psEs.split(",")[0]===fs),gs;if(hs)gs=(await us.center).map(Es=>Es.evaluate_to_constant());else{cs.allVertices||(cs.allVertices={}),Object.assign(cs.allVertices,cs.desiredVertices);let Es=0,_s=0;for(let $s=0;$s({}),returnArraySize:()=>[2],returnArrayDependenciesByKey(){return{globalDependencies:{centerComponents:{dependencyType:"stateVariable",variableName:"centerComponents"}}}},arrayDefinitionByKey({globalDependencyValues:os}){return{setValue:{center:os.centerComponents.map(ls=>Context.fromAst(ls))}}},async inverseArrayDefinitionByKey({desiredStateVariableValues:os,stateValues:ls,workspace:us}){let cs=os.center[0];cs||(cs=us.desired_center_x),cs||(cs=(await ls.center)[0]),us.desired_center_x=cs;let ds=os.center[1];return ds||(ds=us.desired_center_y),ds||(ds=(await ls.center)[1]),us.desired_center_y=ds,{success:!0,instructions:[{setDependency:"centerComponents",desiredValue:[cs.evaluate_to_constant(),ds.evaluate_to_constant()]}]}}},rs.circumradius={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({center:{dependencyType:"stateVariable",variableName:"center"},vertex1:{dependencyType:"stateVariable",variableName:"vertex1"}}),definition({dependencyValues:os}){let ls=os.center.map(ds=>ds.evaluate_to_constant()),us=os.vertex1.map(ds=>ds.evaluate_to_constant());return{setValue:{circumradius:Math.sqrt((us[0]-ls[0])**2+(us[1]-ls[1])**2)}}},inverseDefinition({desiredStateVariableValues:os,dependencyValues:ls}){let us=ls.center.map(ys=>ys.evaluate_to_constant()),cs=ls.vertex1.map(ys=>ys.evaluate_to_constant()),ds=[cs[0]-us[0],cs[1]-us[1]],ps=Math.sqrt(ds[0]**2+ds[1]**2),fs=os.circumradius,hs=ds.map(ys=>ys/ps*fs);return{success:!0,instructions:[{setDependency:"vertex1",desiredValue:[Context.fromAst(hs[0]+us[0]),Context.fromAst(hs[1]+us[1])]}]}}},rs.radius={isAlias:!0,targetVariableName:"circumradius"},rs.inradius={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({circumradius:{dependencyType:"stateVariable",variableName:"circumradius"},nVertices:{dependencyType:"stateVariable",variableName:"nVertices"}}),definition({dependencyValues:os}){let ls=os.circumradius,us=os.nVertices;return{setValue:{inradius:ls*Math.cos(Math.PI/us)}}},inverseDefinition({desiredStateVariableValues:os,dependencyValues:ls}){let us=os.inradius,cs=ls.nVertices;return{success:!0,instructions:[{setDependency:"circumradius",desiredValue:us/Math.cos(Math.PI/cs)}]}}},rs.apothem={isAlias:!0,targetVariableName:"inradius"},rs.sideLength={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({circumradius:{dependencyType:"stateVariable",variableName:"circumradius"},nVertices:{dependencyType:"stateVariable",variableName:"nVertices"}}),definition({dependencyValues:os}){let ls=os.circumradius,us=os.nVertices;return{setValue:{sideLength:ls*(2*Math.sin(Math.PI/us))}}},inverseDefinition({desiredStateVariableValues:os,dependencyValues:ls}){let us=os.sideLength,cs=ls.nVertices;return{success:!0,instructions:[{setDependency:"circumradius",desiredValue:us/(2*Math.sin(Math.PI/cs))}]}}},rs.perimeter={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({circumradius:{dependencyType:"stateVariable",variableName:"circumradius"},nVertices:{dependencyType:"stateVariable",variableName:"nVertices"}}),definition({dependencyValues:os}){let ls=os.circumradius,us=os.nVertices;return{setValue:{perimeter:ls*(2*us*Math.sin(Math.PI/us))}}},inverseDefinition({desiredStateVariableValues:os,dependencyValues:ls}){let us=os.perimeter,cs=ls.nVertices;return{success:!0,instructions:[{setDependency:"circumradius",desiredValue:us/(2*cs*Math.sin(Math.PI/cs))}]}}},rs.area={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({circumradius:{dependencyType:"stateVariable",variableName:"circumradius"},nVertices:{dependencyType:"stateVariable",variableName:"nVertices"}}),definition({dependencyValues:os}){let ls=os.circumradius,us=os.nVertices;return{setValue:{area:ls**2*(us/2*Math.sin(2*Math.PI/us))}}},inverseDefinition({desiredStateVariableValues:os,dependencyValues:ls}){let us=os.area,cs=ls.nVertices;return{success:!0,instructions:[{setDependency:"circumradius",desiredValue:Math.sqrt(us/(cs/2*Math.sin(2*Math.PI/cs)))}]}}},rs.nSides={isAlias:!0,targetVariableName:"nVertices"},rs}}zs(RegularPolygon,"componentType","regularPolygon"),zs(RegularPolygon,"rendererType","polygon");class Circle extends Curve{constructor(rs){super(rs),Object.assign(this.actions,{moveCircle:this.moveCircle.bind(this),circleClicked:this.circleClicked.bind(this),mouseDownOnCircle:this.mouseDownOnCircle.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.through={createComponentOfType:"_pointListComponent"},rs.center={createComponentOfType:"point"},rs.radius={createComponentOfType:"math"},rs.filled={createComponentOfType:"boolean",createStateVariable:"filled",defaultValue:!1,public:!0,forRenderer:!0},delete rs.parMin,delete rs.parMax,delete rs.variable,rs}static returnChildGroups(){return GraphicalComponent.returnChildGroups()}static returnStateVariableDefinitions(rs){let ns=GraphicalComponent.returnStateVariableDefinitions(rs);return ns.styleDescription={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({selectedStyle:{dependencyType:"stateVariable",variableName:"selectedStyle"},filled:{dependencyType:"stateVariable",variableName:"filled"},document:{dependencyType:"ancestor",componentType:"document",variableNames:["theme"]}}),definition:function({dependencyValues:ss}){var cs,ds;let os;((cs=ss.document)==null?void 0:cs.stateValues.theme)==="dark"?os=ss.selectedStyle.lineColorWordDarkMode:os=ss.selectedStyle.lineColorWord;let ls=ss.selectedStyle.lineWidthWord;ss.selectedStyle.lineStyleWord&&(ls&&(ls+=" "),ls+=ss.selectedStyle.lineStyleWord),ls&&(ls+=" ");let us;if(!ss.filled)us=ls+os;else{let ps;((ds=ss.document)==null?void 0:ds.stateValues.theme)==="dark"?ps=ss.selectedStyle.fillColorWordDarkMode:ps=ss.selectedStyle.fillColorWord,ps===os?(us="filled "+ps,ls&&(us+=" with "+ls+"border")):us="filled "+ps+" with "+ls+os+" border"}return{setValue:{styleDescription:us}}}},ns.styleDescriptionWithNoun={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({selectedStyle:{dependencyType:"stateVariable",variableName:"selectedStyle"},filled:{dependencyType:"stateVariable",variableName:"filled"},document:{dependencyType:"ancestor",componentType:"document",variableNames:["theme"]}}),definition:function({dependencyValues:ss}){var cs,ds;let os;((cs=ss.document)==null?void 0:cs.stateValues.theme)==="dark"?os=ss.selectedStyle.lineColorWordDarkMode:os=ss.selectedStyle.lineColorWord;let ls=ss.selectedStyle.lineWidthWord;ss.selectedStyle.lineStyleWord&&(ls&&(ls+=" "),ls+=ss.selectedStyle.lineStyleWord),ls&&(ls+=" ");let us;if(!ss.filled)us=ls+os+" circle";else{let ps;((ds=ss.document)==null?void 0:ds.stateValues.theme)==="dark"?ps=ss.selectedStyle.fillColorWordDarkMode:ps=ss.selectedStyle.fillColorWord,ps===os?(us="filled "+ps+" circle",ls&&(us+=" with a "+ls+"border")):us="filled "+ps+" circle with a "+ls+os+" border"}return{setValue:{styleDescriptionWithNoun:us}}}},ns.borderStyleDescription={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({selectedStyle:{dependencyType:"stateVariable",variableName:"selectedStyle"},document:{dependencyType:"ancestor",componentType:"document",variableNames:["theme"]}}),definition:function({dependencyValues:ss}){var us;let os;((us=ss.document)==null?void 0:us.stateValues.theme)==="dark"?os=ss.selectedStyle.lineColorWordDarkMode:os=ss.selectedStyle.lineColorWord;let ls=ss.selectedStyle.lineWidthWord;return ss.selectedStyle.lineStyleWord&&(ls&&(ls+=" "),ls+=ss.selectedStyle.lineStyleWord),ls&&(ls+=" "),ls+=os,{setValue:{borderStyleDescription:ls}}}},ns.fillStyleDescription={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({selectedStyle:{dependencyType:"stateVariable",variableName:"selectedStyle"},filled:{dependencyType:"stateVariable",variableName:"filled"},document:{dependencyType:"ancestor",componentType:"document",variableNames:["theme"]}}),definition:function({dependencyValues:ss}){var us;let os;((us=ss.document)==null?void 0:us.stateValues.theme)==="dark"?os=ss.selectedStyle.fillColorWordDarkMode:os=ss.selectedStyle.fillColorWord;let ls;return ss.filled?ls=os:ls="unfilled",{setValue:{fillStyleDescription:ls}}}},ns.curveType={forRenderer:!0,returnDependencies:()=>({}),definition:()=>({setValue:{curveType:"circle"}})},ns.parMax={public:!0,shadowingInstructions:{createComponentOfType:"number"},forRenderer:!0,returnDependencies:()=>({}),definition:()=>({setValue:{parMax:NaN}})},ns.parMin={public:!0,shadowingInstructions:{createComponentOfType:"number"},forRenderer:!0,returnDependencies:()=>({}),definition:()=>({setValue:{parMin:NaN}})},ns.fs={forRenderer:!0,isArray:!0,entryPrefixes:["f"],returnArraySizeDependencies:()=>({}),returnArraySize:()=>[0],returnArrayDependenciesByKey:()=>({}),arrayDefinitionByKey:()=>({setValue:{fs:{}}})},ns.nThroughPoints={returnDependencies:()=>({throughAttr:{dependencyType:"attributeComponent",attributeName:"through",variableNames:["nPoints"]}}),definition:function({dependencyValues:ss}){return ss.throughAttr!==null?{setValue:{nThroughPoints:ss.throughAttr.stateValues.nPoints}}:{setValue:{nThroughPoints:0}}}},ns.throughPoints={public:!0,shadowingInstructions:{createComponentOfType:"math",returnWrappingComponents(ss){return ss==="throughPointX"?[]:[["point",{componentType:"mathList",isAttribute:"xs"}]]}},isArray:!0,nDimensions:2,entryPrefixes:["throughPointX","throughPoint"],getArrayKeysFromVarName({arrayEntryPrefix:ss,varEnding:os,arraySize:ls}){if(ss==="throughPointX"){let us=os.split("_").map(cs=>Number(cs)-1);return us.length===2&&us.every((cs,ds)=>Number.isInteger(cs)&&cs>=0)?ls?us.every((cs,ds)=>cs=0?ls?usus+","+ds):[]:[us+",0"]:[]}},arrayVarNameFromPropIndex(ss,os){if(os==="throughPoints")return ss.length===1?"throughPoint"+ss[0]:`throughPointX${ss[0]}_${ss[1]}`;if(os.slice(0,12)==="throughPoint"){let ls=Number(os.slice(12));if(Number.isInteger(ls)&&ls>0)return`throughPointX${ls}_${ss[0]}`}return null},returnArraySizeDependencies:()=>({nThroughPoints:{dependencyType:"stateVariable",variableName:"nThroughPoints"}}),returnArraySize({dependencyValues:ss}){return[ss.nThroughPoints,2]},returnArrayDependenciesByKey({arrayKeys:ss}){let os={};for(let ls of ss){let[us,cs]=ls.split(","),ds=Number(us)+1+"_"+(Number(cs)+1);os[ls]={throughAttr:{dependencyType:"attributeComponent",attributeName:"through",variableNames:["pointX"+ds]}}}return{dependenciesByKey:os}},arrayDefinitionByKey({dependencyValuesByKey:ss,arrayKeys:os}){let ls={};for(let us of os){let[cs,ds]=us.split(","),ps=Number(cs)+1+"_"+(Number(ds)+1),fs=ss[us].throughAttr;fs!==null&&fs.stateValues["pointX"+ps]?ls[us]=fs.stateValues["pointX"+ps]:ls[us]=Context.fromAst("_")}return{setValue:{throughPoints:ls}}},async inverseArrayDefinitionByKey({desiredStateVariableValues:ss,dependencyValuesByKey:os,dependencyNamesByKey:ls,initialChange:us,stateValues:cs}){if(us&&!await cs.draggable)return{success:!1};let ds=[];for(let ps in ss.throughPoints){let[fs,hs]=ps.split(","),gs=Number(fs)+1+"_"+(Number(hs)+1);if(os[ps].throughAttr!==null&&os[ps].throughAttr.stateValues["pointX"+gs])ds.push({setDependency:ls[ps].throughAttr,desiredValue:ss.throughPoints[ps],variableIndex:0});else return{success:!1}}return{success:!0,instructions:ds}}},ns.havePrescribedCenter={returnDependencies:()=>({centerAttr:{dependencyType:"attributeComponent",attributeName:"center"}}),definition:({dependencyValues:ss})=>({setValue:{havePrescribedCenter:ss.centerAttr!==null},checkForActualChange:{havePrescribedCenter:!0}})},ns.prescribedCenter={isArray:!0,entryPrefixes:["prescribedCenterX"],returnArraySizeDependencies:()=>({havePrescribedCenter:{dependencyType:"stateVariable",variableName:"havePrescribedCenter"}}),returnArraySize({dependencyValues:ss}){return[ss.havePrescribedCenter?2:0]},returnArrayDependenciesByKey({arrayKeys:ss}){let os={};for(let ls of ss){let us=Number(ls)+1;os[ls]={centerAttr:{dependencyType:"attributeComponent",attributeName:"center",variableNames:["x"+us]}}}return{dependenciesByKey:os}},arrayDefinitionByKey:function({globalDependencyValues:ss,dependencyValuesByKey:os,arrayKeys:ls}){let us={};for(let cs of ls){let ds=Number(cs)+1;os[cs].centerAttr!==null&&(us[cs]=os[cs].centerAttr.stateValues["x"+ds],us[cs]||(us[cs]=Context.fromAst("_")))}return{setValue:{prescribedCenter:us}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ss,globalDependencyValues:os,dependencyValuesByKey:ls,dependencyNamesByKey:us,arraySize:cs}){let ds=[];for(let ps of Object.keys(ss.prescribedCenter).reverse())ls[ps].centerAttr!==null&&ds.push({setDependency:us[ps].centerAttr,desiredValue:ss.prescribedCenter[ps],variableIndex:0});return{success:!0,instructions:ds}}},ns.prescribedRadius={defaultValue:null,returnDependencies:()=>({radiusAttr:{dependencyType:"attributeComponent",attributeName:"radius",variableNames:["value"]}}),definition:function({dependencyValues:ss}){return ss.radiusAttr!==null?{setValue:{prescribedRadius:ss.radiusAttr.stateValues.value}}:{setValue:{prescribedRadius:null}}},inverseDefinition:function({desiredStateVariableValues:ss,dependencyValues:os}){return os.radiusAttr!==null?{success:!0,instructions:[{setDependency:"radiusAttr",desiredValue:ss.prescribedRadius,childIndex:0,variableIndex:0}]}:{success:!1}}},ns.havePrescribedRadius={returnDependencies:()=>({radiusAttr:{dependencyType:"attributeComponent",attributeName:"radius"}}),definition:({dependencyValues:ss})=>({setValue:{havePrescribedRadius:ss.radiusAttr!==null},checkForActualChange:{havePrescribedRadius:!0}})},ns.numericalPrescribedRadius={returnDependencies:()=>({prescribedRadius:{dependencyType:"stateVariable",variableName:"prescribedRadius"}}),additionalStateVariablesDefined:["haveNonNumericalPrescribedRadius"],definition:function({dependencyValues:ss}){let os=!1,ls;return ss.prescribedRadius===null?ls=null:(ls=ss.prescribedRadius.evaluate_to_constant(),Number.isFinite(ls)||(ls=NaN,os=!0)),{setValue:{haveNonNumericalPrescribedRadius:os,numericalPrescribedRadius:ls},checkForActualChange:{haveNonNumericalEntriesNumericalRadius:!0}}},inverseDefinition:async function({desiredStateVariableValues:ss,dependencyValues:os,stateValues:ls}){return await ls.haveNonNumericalPrescribedRadius?{success:!1}:ss.numericalPrescribedRadius!==void 0?os.prescribedRadius===null?{success:!1}:{success:!0,instructions:[{setDependency:"prescribedRadius",desiredValue:Context.fromAst(ss.numericalPrescribedRadius)}]}:{success:!1}}},ns.numericalPrescribedCenter={isArray:!0,entryPrefixes:["numericalPrescribedCenterX"],returnArraySizeDependencies:()=>({havePrescribedCenter:{dependencyType:"stateVariable",variableName:"havePrescribedCenter"}}),returnArraySize({dependencyValues:ss}){return[ss.havePrescribedCenter?2:0]},returnArrayDependenciesByKey({arrayKeys:ss}){let os={};for(let ls of ss){let us=Number(ls)+1;os[ls]={prescribedCenterX:{dependencyType:"stateVariable",variableName:"prescribedCenterX"+us}}}return{dependenciesByKey:os}},arrayDefinitionByKey:function({dependencyValuesByKey:ss,arrayKeys:os}){let ls={};for(let us of os){let cs=ss[us].prescribedCenterX;cs?ls[us]=cs.evaluate_to_constant():ls[us]=NaN}return{setValue:{numericalPrescribedCenter:ls}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ss,dependencyNamesByKey:os}){let ls=[];for(let us in ss.numericalPrescribedCenter)ls.push({setDependency:os[us].prescribedCenterX,desiredValue:Context.fromAst(ss.numericalPrescribedCenter[us])});return{success:!0,instructions:ls}}},ns.haveNonNumericalPrescribedCenter={returnDependencies:()=>({numericalPrescribedCenter:{dependencyType:"stateVariable",variableName:"numericalPrescribedCenter"}}),definition({dependencyValues:ss}){return{setValue:{haveNonNumericalPrescribedCenter:ss.numericalPrescribedCenter.some(ls=>!Number.isFinite(ls))},checkForActualChange:{haveNonNumericalPrescribedCenter:!0}}}},ns.numericalThroughPoints={returnDependencies:()=>({throughPoints:{dependencyType:"stateVariable",variableName:"throughPoints"}}),additionalStateVariablesDefined:["haveNonNumericalThroughPoints"],definition:function({dependencyValues:ss}){let os=!1,ls=[];for(let us of ss.throughPoints){let cs=[];for(let ds=0;ds<2;ds++){let ps;try{ps=us[ds].evaluate_to_constant()}catch{console.warn("Invalid point of circle"),os=!0,cs=[];break}if(Number.isFinite(ps))cs.push(ps);else{os=!0,cs=[];break}}if(cs.length>0)ls.push(cs);else{ls=[];break}}return{setValue:{haveNonNumericalThroughPoints:os,numericalThroughPoints:ls},checkForActualChange:{haveNonNumericalThroughPoints:!0}}},inverseDefinition:async function({desiredStateVariableValues:ss,dependencyValues:os,stateValues:ls}){if(await ls.haveNonNumericalThroughPoints)return{success:!1};if(ss.numericalThroughPoints!==void 0){let us={};for(let[cs,ds]of ss.numericalThroughPoints.entries())us[cs+",0"]=Context.fromAst(ds[0]),us[cs+",1"]=Context.fromAst(ds[1]);return{success:!0,instructions:[{setDependency:"throughPoints",desiredValue:us}]}}return{success:!1}}},ns.haveNumericalEntries={returnDependencies:()=>({haveNonNumericalPrescribedCenter:{dependencyType:"stateVariable",variableName:"haveNonNumericalPrescribedCenter"},haveNonNumericalPrescribedRadius:{dependencyType:"stateVariable",variableName:"haveNonNumericalPrescribedRadius"},haveNonNumericalThroughPoints:{dependencyType:"stateVariable",variableName:"haveNonNumericalThroughPoints"}}),definition:({dependencyValues:ss})=>({setValue:{haveNumericalEntries:!(ss.haveNonNumericalPrescribedCenter||ss.haveNonNumericalPrescribedRadius||ss.haveNonNumericalThroughPoints)}})},ns.numericalRadiusCalculatedWithCenter={additionalStateVariablesDefined:["numericalCenterCalculatedWithRadius"],returnDependencies:()=>({nThroughPoints:{dependencyType:"stateVariable",variableName:"nThroughPoints"},numericalThroughPoints:{dependencyType:"stateVariable",variableName:"numericalThroughPoints"},haveNumericalEntries:{dependencyType:"stateVariable",variableName:"haveNonNumericalThroughPoints"}}),definition:function({dependencyValues:ss}){if(ss.haveNonNumericalThroughPoints){let os="Haven't implemented circle through "+ss.nThroughPoints+" points";return os+=" in case where don't have numerical values.",console.warn(os),{setValue:{numericalRadiusCalculatedWithCenter:null,numericalCenterCalculatedWithRadius:null}}}if(ss.nThroughPoints===2){let{numericalCenter:os,numericalRadius:ls}=circleFromTwoNumericalPoints({point1:ss.numericalThroughPoints[0],point2:ss.numericalThroughPoints[1]});return{setValue:{numericalCenterCalculatedWithRadius:os,numericalRadiusCalculatedWithCenter:ls}}}else if(ss.nThroughPoints===3){let os=ss.numericalThroughPoints[0][0],ls=ss.numericalThroughPoints[1][0],us=ss.numericalThroughPoints[2][0],cs=ss.numericalThroughPoints[0][1],ds=ss.numericalThroughPoints[1][1],ps=ss.numericalThroughPoints[2][1],fs,hs;if(os===ls&&cs===ds)if(os===us&&cs===ps)fs=[os,cs],hs=0;else{let gs=circleFromTwoNumericalPoints({point1:[os,cs],point2:[us,ps]});fs=gs.numericalCenter,hs=gs.numericalRadius}else if(os===us&&cs===ps||ls===us&&ds===ps){let gs=circleFromTwoNumericalPoints({point1:[os,cs],point2:[ls,ds]});fs=gs.numericalCenter,hs=gs.numericalRadius}else{let gs=os*os+cs*cs,ys=ls*ls+ds*ds,bs=us*us+ps*ps,vs=os*(ds-ps)-cs*(ls-us)+ls*ps-us*ds,xs=gs*(ps-ds)+ys*(cs-ps)+bs*(ds-cs),Cs=gs*(ls-us)+ys*(us-os)+bs*(os-ls),Ts=gs*(us*ds-ls*ps)+ys*(os*ps-us*cs)+bs*(ls*cs-os*ds);vs!==0?(fs=[-xs/(2*vs),-Cs/(2*vs)],hs=Math.sqrt((xs*xs+Cs*Cs-4*vs*Ts)/(4*vs*vs))):(fs=[NaN,NaN],hs=NaN)}return{setValue:{numericalCenterCalculatedWithRadius:fs,numericalRadiusCalculatedWithCenter:hs}}}else return ss.nThroughPoints>3?(console.warn("Can't calculate circle through more than 3 points"),{setValue:{numericalRadiusCalculatedWithCenter:null,numericalCenterCalculatedWithRadius:null}}):{setValue:{numericalRadiusCalculatedWithCenter:null,numericalCenterCalculatedWithRadius:null}}}},ns.essentialRadius={defaultValue:1,hasEssential:!0,returnDependencies:()=>({}),definition:()=>({useEssentialOrDefaultValue:{essentialRadius:!0}}),inverseDefinition:function({desiredStateVariableValues:ss}){return{success:!0,instructions:[{setEssentialValue:"essentialRadius",value:ss.essentialRadius}]}}},ns.numericalRadius={forRenderer:!0,stateVariablesDeterminingDependencies:["nThroughPoints","havePrescribedCenter","havePrescribedRadius"],returnDependencies:function({stateValues:ss}){let os={haveNonNumericalPrescribedRadius:{dependencyType:"stateVariable",variableName:"haveNonNumericalPrescribedRadius"},nThroughPoints:{dependencyType:"stateVariable",variableName:"nThroughPoints"},essentialRadius:{dependencyType:"stateVariable",variableName:"essentialRadius"}};return ss.havePrescribedRadius?(os.numericalPrescribedRadius={dependencyType:"stateVariable",variableName:"numericalPrescribedRadius"},ss.havePrescribedCenter&&ss.nThroughPoints>0&&(os.haveCenterRadiusPoints={dependencyType:"value",value:!0})):ss.havePrescribedCenter?ss.nThroughPoints===1&&(os.haveNonNumericalPrescribedCenter={dependencyType:"stateVariable",variableName:"haveNonNumericalPrescribedCenter"},os.numericalPrescribedCenter={dependencyType:"stateVariable",variableName:"numericalPrescribedCenter"},os.haveNonNumericalThroughPoints={dependencyType:"stateVariable",variableName:"haveNonNumericalThroughPoints"},os.numericalThroughPoints={dependencyType:"stateVariable",variableName:"numericalThroughPoints"}):ss.nThroughPoints>1&&(os.numericalRadiusCalculatedWithCenter={dependencyType:"stateVariable",variableName:"numericalRadiusCalculatedWithCenter"},os.numericalThroughPoints={dependencyType:"stateVariable",variableName:"numericalThroughPoints"}),os},definition:function({dependencyValues:ss}){if(ss.haveNonNumericalPrescribedRadius||ss.haveNonNumericalPrescribedCenter||ss.haveNonNumericalThroughPoints)return{setValue:{numericalRadius:NaN}};if(ss.numericalPrescribedRadius!==void 0)return ss.haveCenterRadiusPoints?(console.warn("Can't calculate circle with specified radius and center and through points"),{setValue:{numericalRadius:NaN}}):{setValue:{numericalRadius:Math.max(0,ss.numericalPrescribedRadius)}};if(ss.numericalPrescribedCenter!==void 0)if(ss.nThroughPoints===0){let os=ss.essentialRadius;return os instanceof Context.class&&(os=os.evaluate_to_constant()),{setValue:{numericalRadius:os}}}else if(ss.nThroughPoints===1){let os=ss.numericalThroughPoints[0];return os===void 0?{setValue:{numericalRadius:NaN}}:{setValue:{numericalRadius:Math.sqrt(Math.pow(os[0]-ss.numericalPrescribedCenter[0],2)+Math.pow(os[1]-ss.numericalPrescribedCenter[1],2))}}}else return console.warn("Can't calculate circle with specified center through more than 1 point"),{setValue:{numericalRadius:NaN}};if(ss.nThroughPoints<2){let os=ss.essentialRadius;return os instanceof Context.class&&(os=os.evaluate_to_constant()),{setValue:{numericalRadius:os}}}else return{setValue:{numericalRadius:ss.numericalRadiusCalculatedWithCenter}}},inverseDefinition:async function({desiredStateVariableValues:ss,dependencyValues:os,stateValues:ls}){if(os.numericalPrescribedRadius!==void 0)return{success:!0,instructions:[{setDependency:"numericalPrescribedRadius",desiredValue:Math.max(0,ss.numericalRadius)}]};if(os.numericalPrescribedCenter!==void 0){if(os.nThroughPoints===0)return{success:!0,instructions:[{setDependency:"essentialRadius",desiredValue:Math.max(0,ss.numericalRadius)}]};if(os.nThroughPoints===1){let us=Math.max(0,ss.numericalRadius),cs=(await ls.throughAngles)[0];if(!Number.isFinite(cs))return{success:!1};let ds=await ls.numericalCenter;return{success:!0,instructions:[{setDependency:"numericalThroughPoints",desiredValue:[[ds[0]+us*Math.cos(cs),ds[1]+us*Math.sin(cs)]]}]}}else return{success:!1}}if(os.nThroughPoints<2)return{success:!0,instructions:[{setDependency:"essentialRadius",desiredValue:Math.max(0,ss.numericalRadius)}]};{let us=[],cs=Math.max(0,ss.numericalRadius);for(let ds=0;ds0,returnArraySizeDependencies:()=>({}),returnArraySize(){return[2]},returnArrayDependenciesByKey:()=>({}),arrayDefinitionByKey:function({arrayKeys:ss}){let os={};for(let ls of ss)os[ls]=!0;return{useEssentialOrDefaultValue:{essentialCenter:os}}},async inverseArrayDefinitionByKey({desiredStateVariableValues:ss,stateValues:os,workspace:ls}){let us=[];for(let cs in ss.essentialCenter)us.push({setEssentialValue:"essentialCenter",value:{[cs]:ss.essentialCenter[cs]}});return{success:!0,instructions:us}}},ns.numericalCenter={forRenderer:!0,isArray:!0,entryPrefixes:["numericalCenterX"],stateVariablesDeterminingDependencies:["nThroughPoints","havePrescribedCenter","havePrescribedRadius"],returnArraySizeDependencies:()=>({}),returnArraySize(){return[2]},returnArrayDependenciesByKey({arrayKeys:ss,stateValues:os}){let ls={},us={};if(os.havePrescribedCenter){for(let cs of ss){let ds=Number(cs)+1;us[cs]={numericalPrescribedCenterX:{dependencyType:"stateVariable",variableName:"numericalPrescribedCenterX"+ds}}}os.havePrescribedRadius&&os.nThroughPoints>0&&(ls.haveCenterRadiusPoints={dependencyType:"value",value:!0})}else{for(let cs of ss){let ds=Number(cs)+1;us[cs]={essentialCenterX:{dependencyType:"stateVariable",variableName:"essentialCenterX"+ds}}}ls.nThroughPoints={dependencyType:"stateVariable",variableName:"nThroughPoints"},ls.numericalThroughPoints={dependencyType:"stateVariable",variableName:"numericalThroughPoints"},ls.haveNonNumericalThroughPoints={dependencyType:"stateVariable",variableName:"haveNonNumericalThroughPoints"},os.havePrescribedRadius?ls.numericalRadius={dependencyType:"stateVariable",variableName:"numericalRadius"}:os.nThroughPoints==1?ls.numericalRadius={dependencyType:"stateVariable",variableName:"numericalRadius"}:os.nThroughPoints>1&&(ls.numericalCenterCalculatedWithRadius={dependencyType:"stateVariable",variableName:"numericalCenterCalculatedWithRadius"})}return{globalDependencies:ls,dependenciesByKey:us}},arrayDefinitionByKey:function({globalDependencyValues:ss,dependencyValuesByKey:os,arrayKeys:ls}){let us={};for(let cs of ls)if(os[cs].numericalPrescribedCenterX!==void 0){if(ss.haveCenterRadiusPoints)return console.warn("Can't calculate circle with specified radius and center and through points"),{setValue:{numericalCenter:[NaN,NaN]}};us[cs]=os[cs].numericalPrescribedCenterX}if(Object.keys(us).length>0)return{setValue:{numericalCenter:us}};if(ss.haveNonNumericalPrescribedRadius||ss.haveNonNumericalThroughPoints)return{setValue:{numericalCenter:[NaN,NaN]}};if(ss.numericalRadius!==void 0)if(ss.nThroughPoints===0){for(let cs of ls){let ds=os[cs].essentialCenterX;ds instanceof Context.class&&(ds=ds.evaluate_to_constant()),us[cs]=ds}return{setValue:{numericalCenter:us}}}else{if(ss.nThroughPoints===1)return ss.numericalThroughPoints.length<1?{setValue:{numericalCenter:[NaN,NaN]}}:{setValue:{numericalCenter:[ss.numericalThroughPoints[0][0],ss.numericalThroughPoints[0][1]-ss.numericalRadius]}};if(ss.nThroughPoints===2){if(ss.numericalThroughPoints.length<2)return{setValue:{numericalCenter:[NaN,NaN]}};let cs=ss.numericalRadius,ds=ss.numericalThroughPoints[0][0],ps=ss.numericalThroughPoints[1][0],fs=ss.numericalThroughPoints[0][1],hs=ss.numericalThroughPoints[1][1],gs=Math.pow(ds-ps,2)+Math.pow(fs-hs,2),ys=cs*cs;if(cs<0||4*ys0)return{success:!0,instructions:ps};if(os.nThroughPoints===0){for(let fs in ss.numericalCenter)ps.push({setDependency:us[fs].essentialCenterX,desiredValue:ss.numericalCenter[fs]});return{success:!0,instructions:ps}}else{ds.desiredCenter||(ds.desiredCenter={});for(let ys=0;ys<2;ys++)ss.numericalCenter[ys]!==void 0?ds.desiredCenter[ys]=ss.numericalCenter[ys]:ds.desiredCenter[ys]===void 0&&(ds.desiredCenter[ys]=cs.numericalCenter[ys]);let fs=[],hs=await cs.throughAngles,gs=await cs.numericalRadius;for(let ys=0;ys({haveNumericalEntries:{dependencyType:"stateVariable",variableName:"haveNumericalEntries"},nThroughPoints:{dependencyType:"stateVariable",variableName:"nThroughPoints"},numericalThroughPoints:{dependencyType:"stateVariable",variableName:"numericalThroughPoints"},numericalRadius:{dependencyType:"stateVariable",variableName:"numericalRadius"},numericalCenter:{dependencyType:"stateVariable",variableName:"numericalCenter"}}),definition:function({dependencyValues:ss}){if(!(ss.haveNumericalEntries&&ss.nThroughPoints>0&&ss.numericalRadius>0&&ss.numericalCenter.every(ls=>Number.isFinite(ls))))return{useEssentialOrDefaultValue:{throughAngles:!0}};let os=[];for(let ls of ss.numericalThroughPoints)os.push(Math.atan2(ls[1]-ss.numericalCenter[1],ls[0]-ss.numericalCenter[0]));return{setValue:{throughAngles:os},setEssentialValue:{throughAngles:os}}}},ns.radius={public:!0,shadowingInstructions:{createComponentOfType:"math"},stateVariablesDeterminingDependencies:["nThroughPoints","havePrescribedCenter","havePrescribedRadius"],returnDependencies:function({stateValues:ss}){let os={numericalRadius:{dependencyType:"stateVariable",variableName:"numericalRadius"},nThroughPoints:{dependencyType:"stateVariable",variableName:"nThroughPoints"},essentialRadius:{dependencyType:"stateVariable",variableName:"essentialRadius"}};return ss.havePrescribedRadius?(os.prescribedRadius={dependencyType:"stateVariable",variableName:"prescribedRadius"},ss.havePrescribedCenter&&ss.nThroughPoints>0&&(os.haveCenterRadiusPoints={dependencyType:"value",value:!0})):ss.havePrescribedCenter&&ss.nThroughPoints===1&&(os.prescribedCenter={dependencyType:"stateVariable",variableName:"prescribedCenter"},os.throughPoints={dependencyType:"stateVariable",variableName:"throughPoints"}),os},definition:function({dependencyValues:ss}){if(Number.isFinite(ss.numericalRadius))return{setValue:{radius:Context.fromAst(ss.numericalRadius)}};if(ss.prescribedRadius!==void 0)return ss.haveCenterRadiusPoints?(console.warn("Can't calculate circle with specified radius and center and through points"),{setValue:{radius:Context.fromAst("_")}}):{setValue:{radius:ss.prescribedRadius}};if(ss.prescribedCenter!==void 0)if(ss.nThroughPoints===0){let os=ss.essentialRadius;return os instanceof Context.class||(Number.isFinite(os)?os=Context.fromAst(os):os=Context.fromAst("_")),{setValue:{radius:os}}}else if(ss.nThroughPoints===1)try{let os=ss.throughPoints[0],ls=os[0],us=os[1],cs=ss.prescribedCenter[0],ds=ss.prescribedCenter[1];return{setValue:{radius:ls.subtract(cs).pow(2).add(us.subtract(ds).pow(2)).pow(.5).simplify()}}}catch{return console.warn("Invalid center or through points of circle"),{setValue:{radius:Context.fromAst("_")}}}else return console.warn("Can't calculate circle with specified center through more than 1 point"),{setValue:{radius:Context.fromAst("_")}};if(ss.nThroughPoints<2){let os=ss.essentialRadius;return os instanceof Context.class||(Number.isFinite(os)?os=Context.fromAst(os):os=Context.fromAst("_")),{setValue:{radius:os}}}else return console.warn(`Have not implemented circle through ${ss.nThroughPoints} points when non-numerical values`),{setValue:{radius:Context.fromAst("_")}}},inverseDefinition:function({desiredStateVariableValues:ss,dependencyValues:os}){let ls=ss.radius.evaluate_to_constant();return Number.isFinite(ls)&&Number.isFinite(os.numericalRadius)?{success:!0,instructions:[{setDependency:"numericalRadius",desiredValue:ls}]}:os.prescribedRadius!==void 0?{success:!0,instructions:[{setDependency:"prescribedRadius",desiredValue:ss.radius}]}:os.nThroughPoints===0?{success:!0,instructions:[{setDependency:"essentialRadius",desiredValue:ss.radius}]}:(console.warn("Can't change radius of circle with non-numerical values through points"),{success:!1})}},ns.diameter={public:!0,shadowingInstructions:{createComponentOfType:"math"},returnDependencies:()=>({radius:{dependencyType:"stateVariable",variableName:"radius"}}),definition({dependencyValues:ss}){return{setValue:{diameter:ss.radius.multiply(2).simplify()}}},inverseDefinition:function({desiredStateVariableValues:ss,dependencyValues:os}){return{success:!0,instructions:[{setDependency:"radius",desiredValue:ss.diameter.divide(2).simplify()}]}}},ns.center={forRenderer:!0,public:!0,shadowingInstructions:{createComponentOfType:"math",returnWrappingComponents(ss){return ss==="centerX"?[]:[["point",{componentType:"mathList",isAttribute:"xs"}]]}},isArray:!0,entryPrefixes:["centerX"],stateVariablesDeterminingDependencies:["nThroughPoints","havePrescribedCenter","havePrescribedRadius"],returnArraySizeDependencies:()=>({}),returnArraySize(){return[2]},returnArrayDependenciesByKey({arrayKeys:ss,stateValues:os}){let ls={},us={};if(os.havePrescribedCenter){ls.havePrescribedCenter={dependencyType:"value",value:!0};for(let cs of ss){let ds=Number(cs)+1;us[cs]={numericalCenterX:{dependencyType:"stateVariable",variableName:"numericalCenterX"+ds},prescribedCenterX:{dependencyType:"stateVariable",variableName:"prescribedCenterX"+ds}}}os.havePrescribedRadius&&os.nThroughPoints>0&&(ls.haveCenterRadiusPoints={dependencyType:"value",value:!0})}else{for(let cs of ss){let ds=Number(cs)+1;us[cs]={essentialCenterX:{dependencyType:"stateVariable",variableName:"essentialCenterX"+ds}}}ls.numericalCenter={dependencyType:"stateVariable",variableName:"numericalCenter"},ls.nThroughPoints={dependencyType:"stateVariable",variableName:"nThroughPoints"},ls.throughPoints={dependencyType:"stateVariable",variableName:"throughPoints"},os.havePrescribedRadius?ls.radius={dependencyType:"stateVariable",variableName:"prescribedRadius"}:os.nThroughPoints==1&&(ls.radius={dependencyType:"stateVariable",variableName:"radius"})}return{dependenciesByKey:us,globalDependencies:ls}},arrayDefinitionByKey:function({globalDependencyValues:ss,dependencyValuesByKey:os,arrayKeys:ls}){if(ss.havePrescribedCenter){if(ss.haveCenterRadiusPoints)return console.warn("Can't calculate circle with specified radius and center and through points"),{setValue:{center:[Context.fromAst("_"),Context.fromAst("_")]}};let us={};for(let cs of ls)Number.isFinite(os[cs].numericalCenterX)?us[cs]=Context.fromAst(os[cs].numericalCenterX):us[cs]=os[cs].prescribedCenterX;return{setValue:{center:us}}}if(ss.numericalCenter.every(us=>Number.isFinite(us)))return{setValue:{center:ss.numericalCenter.map(us=>Context.fromAst(us))}};if(ss.radius!==void 0)if(ss.nThroughPoints===0){let us={};for(let cs of ls){let ds=os[cs].essentialCenterX;ds instanceof Context.class||(Number.isFinite(ds)?ds=Context.fromAst(ds):ds=Context.fromAst("_")),us[cs]=ds}return{setValue:{center:us}}}else if(ss.nThroughPoints===1){let us;try{us=[ss.throughPoints[0][0],ss.throughPoints[0][1].subtract(ss.radius).simplify()]}catch{us=[Context.fromAst("_"),Context.fromAst("_")]}return{setValue:{center:us}}}else return console.warn("Can't create circle through more than one point with given radius when don't have numerical values"),{setValue:{center:[Context.fromAst("_"),Context.fromAst("_")]}};if(ss.nThroughPoints===0){let us={};for(let cs of ls){let ds=os[cs].essentialCenterX;ds instanceof Context.class||(Number.isFinite(ds)?ds=Context.fromAst(ds):ds=Context.fromAst("_")),us[cs]=ds}return{setValue:{center:us}}}else return console.warn("Can't create circle through more than one point when don't have numerical values"),{setValue:{center:[Context.fromAst("_"),Context.fromAst("_")]}}},async inverseArrayDefinitionByKey({desiredStateVariableValues:ss,globalDependencyValues:os,stateValues:ls,dependencyNamesByKey:us,workspace:cs}){if(os.havePrescribedCenter){let fs=[];for(let hs in ss.center)fs.push({setDependency:us[hs].prescribedCenterX,desiredValue:ss.center[hs],arrayKey:hs});return{success:!0,instructions:fs}}cs.desiredCenter||(cs.desiredCenter={});for(let fs=0;fs<2;fs++)ss.center[fs]!==void 0?cs.desiredCenter[fs]=ss.center[fs]:cs.desiredCenter[fs]===void 0&&(cs.desiredCenter[fs]=(await ls.center)[fs]);let ds=[],ps=!0;for(let fs=0;fs<2;fs++){let hs=cs.desiredCenter[fs].evaluate_to_constant();if(!Number.isFinite(hs)){ps=!1;break}ds.push(hs)}if(ps&&os.numericalCenter.every(fs=>Number.isFinite(fs)))return{success:!0,instructions:[{setDependency:"numericalCenter",desiredValue:ds}]};if(os.nThroughPoints===0){let fs=[];for(let hs in ss.center)fs.push({setDependency:us[hs].essentialCenterX,desiredValue:ss.center[hs],arrayKey:hs});return{success:!0,instructions:fs}}else return console.warn("Haven't implemented changing center of circle through points with non numerical values"),{success:!1}}},ns.nearestPoint={returnDependencies:()=>({numericalCenter:{dependencyType:"stateVariable",variableName:"numericalCenter"},numericalRadius:{dependencyType:"stateVariable",variableName:"numericalRadius"}}),definition({dependencyValues:ss}){let os=ss.numericalRadius,ls=ss.numericalCenter[0],us=ss.numericalCenter[1];return{setValue:{nearestPoint:function({variables:cs,scales:ds}){var ys,bs;let ps=(ys=cs.x1)==null?void 0:ys.evaluate_to_constant(),fs=(bs=cs.x2)==null?void 0:bs.evaluate_to_constant();if(!(Number.isFinite(ps)&&Number.isFinite(fs)))return{};if(!(Number.isFinite(ls)&&Number.isFinite(us)&&Number.isFinite(os)))return{};let hs=Math.atan2(fs-us,ps-ls),gs={x1:ls+os*Math.cos(hs),x2:us+os*Math.sin(hs)};return cs.x3!==void 0&&(gs.x3=0),gs}}}}},ns}async moveCircle({center:rs,radius:ns,throughAngles:ss,transient:os,actionId:ls,sourceInformation:us={},skipRendererUpdate:cs=!1}){let ds=[],ps=await this.stateValues.nThroughPoints,fs=await this.stateValues.numericalPrescribedCenter;if((ps<=1||fs!==null)&&ds.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"numericalCenter",value:rs}),ps>=1){let hs=[];ss===void 0&&(ss=await this.stateValues.throughAngles),ns===void 0&&(ns=await this.stateValues.numericalRadius);for(let gs=0;gs({styleDescription:{dependencyType:"stateVariable",variableName:"styleDescription"}}),definition:function({dependencyValues:os}){return{setValue:{styleDescriptionWithNoun:os.styleDescription+" parabola"}}}},ns.curveType={forRenderer:!0,returnDependencies:()=>({}),definition:()=>({setValue:{curveType:"function"}})},ns.parMax={public:!0,shadowingInstructions:{createComponentOfType:"number"},forRenderer:!0,returnDependencies:()=>({}),definition:()=>({setValue:{parMax:1/0}})},ns.parMin={public:!0,shadowingInstructions:{createComponentOfType:"number"},forRenderer:!0,returnDependencies:()=>({}),definition:()=>({setValue:{parMin:-1/0}})},ns.aShadow={defaultValue:1,hasEssential:!0,returnDependencies:()=>({}),definition:()=>({useEssentialOrDefaultValue:{aShadow:!0}}),inverseDefinition:function({desiredStateVariableValues:os}){return{success:!0,instructions:[{setEssentialValue:"aShadow",value:os.aShadow}]}}},ns.nThroughPoints={returnDependencies:()=>({throughAttr:{dependencyType:"attributeComponent",attributeName:"through",variableNames:["nPoints"]}}),definition:function({dependencyValues:os}){return os.throughAttr===null?{setValue:{nThroughPoints:0}}:{setValue:{nThroughPoints:os.throughAttr.stateValues.nPoints}}}},ns.throughPoints={public:!0,shadowingInstructions:{createComponentOfType:"math",returnWrappingComponents(os){return os==="throughPointX"?[]:[["point",{componentType:"mathList",isAttribute:"xs"}]]}},isArray:!0,nDimensions:2,entryPrefixes:["throughPointX","throughPoint"],getArrayKeysFromVarName({arrayEntryPrefix:os,varEnding:ls,arraySize:us}){if(os==="throughPointX"){let cs=ls.split("_").map(ds=>Number(ds)-1);return cs.length===2&&cs.every((ds,ps)=>Number.isInteger(ds)&&ds>=0)?us?cs.every((ds,ps)=>ds=0?us?cscs+","+ps):[]:[cs+",0"]:[]}},arrayVarNameFromPropIndex(os,ls){if(ls==="throughPoints")return os.length===1?"throughPoint"+os[0]:`throughPointX${os[0]}_${os[1]}`;if(ls.slice(0,12)==="throughPoint"){let us=Number(ls.slice(12));if(Number.isInteger(us)&&us>0)return`throughPointX${us}_${os[0]}`}return null},returnArraySizeDependencies:()=>({nThroughPoints:{dependencyType:"stateVariable",variableName:"nThroughPoints"}}),returnArraySize({dependencyValues:os}){return[os.nThroughPoints,2]},returnArrayDependenciesByKey({arrayKeys:os}){let ls={};for(let us of os){let[cs,ds]=us.split(","),ps=Number(cs)+1+"_"+(Number(ds)+1);ls[us]={throughAttr:{dependencyType:"attributeComponent",attributeName:"through",variableNames:["pointX"+ps]}}}return{dependenciesByKey:ls}},arrayDefinitionByKey({dependencyValuesByKey:os,arrayKeys:ls}){let us={};for(let cs of ls){let[ds,ps]=cs.split(","),fs=Number(ds)+1+"_"+(Number(ps)+1),hs=os[cs].throughAttr;if(hs!==null&&hs.stateValues["pointX"+fs]){let gs=hs.stateValues["pointX"+fs].evaluate_to_constant();Number.isFinite(gs)?us[cs]=Context.fromAst(gs):us[cs]=Context.fromAst("_")}else us[cs]=Context.fromAst("_")}return{setValue:{throughPoints:us}}},async inverseArrayDefinitionByKey({desiredStateVariableValues:os,dependencyValuesByKey:ls,dependencyNamesByKey:us,initialChange:cs,stateValues:ds}){if(cs&&!await ds.draggable)return{success:!1};let ps=[];for(let fs in os.throughPoints){let[hs,gs]=fs.split(","),ys=Number(hs)+1+"_"+(Number(gs)+1);if(ls[fs].throughAttr!==null&&ls[fs].throughAttr.stateValues["pointX"+ys])ps.push({setDependency:us[fs].throughAttr,desiredValue:os.throughPoints[fs],childIndex:0,variableIndex:0});else return{success:!1}}return{success:!0,instructions:ps}}},ns.numericalThroughPoints={isArray:!0,forRenderer:!0,returnArraySizeDependencies:()=>({nThroughPoints:{dependencyType:"stateVariable",variableName:"nThroughPoints"}}),returnArraySize({dependencyValues:os}){return[os.nThroughPoints]},returnArrayDependenciesByKey({arrayKeys:os}){let ls={};for(let us of os)ls[us]={throughPoint:{dependencyType:"stateVariable",variableName:"throughPoint"+(Number(us)+1)}};return{dependenciesByKey:ls}},arrayDefinitionByKey({dependencyValuesByKey:os,arrayKeys:ls}){let us={};for(let cs of ls){let ds=os[cs].throughPoint.map(ps=>ps.tree);ds.every(ps=>Number.isFinite(ps))||(ds=Array(ds.length).fill(NaN)),us[cs]=ds}return{setValue:{numericalThroughPoints:us}}},inverseArrayDefinitionByKey({desiredStateVariableValues:os,dependencyValuesByKey:ls,dependencyNamesByKey:us}){let cs=[];for(let ds in os.numericalThroughPoints)if(ls[ds].throughPoint)cs.push({setDependency:us[ds].throughPoint,desiredValue:os.numericalThroughPoints[ds].map(ps=>Context.fromAst(ps))});else return{success:!1};return{success:!0,instructions:cs}}},ns.numericalPrescribedVertex={returnDependencies:()=>({prescribedVertex:{dependencyType:"stateVariable",variableName:"prescribedVertex"}}),definition({dependencyValues:os}){if(os.prescribedVertex===null)return{setValue:{numericalPrescribedVertex:null}};let ls,us;try{ls=os.prescribedVertex.get_component(0).evaluate_to_constant(),us=os.prescribedVertex.get_component(1).evaluate_to_constant(),Number.isFinite(ls)&&Number.isFinite(us)||(ls=NaN,us=NaN)}catch{ls=NaN,us=NaN}return{setValue:{numericalPrescribedVertex:[ls,us]}}}},ns.pointsAreNumerical={returnDependencies:()=>({numericalThroughPoints:{dependencyType:"stateVariable",variableName:"numericalThroughPoints"},numericalPrescribedVertex:{dependencyType:"stateVariable",variableName:"numericalPrescribedVertex"}}),definition:({dependencyValues:os})=>({setValue:{pointsAreNumerical:os.numericalThroughPoints.every(ls=>Number.isFinite(ls[0]))&&(!os.numericalPrescribedVertex||Number.isFinite(os.numericalPrescribedVertex[0]))},checkForActualChange:{pointsAreNumerical:!0}})},ns.a={public:!0,shadowingInstructions:{createComponentOfType:"number"},additionalStateVariablesDefined:[{variableName:"b",public:!0,shadowingInstructions:{createComponentOfType:"number"},hasEssential:!0,defaultValue:0},{variableName:"c",public:!0,shadowingInstructions:{createComponentOfType:"number"},hasEssential:!0,defaultValue:0},"realValued"],returnDependencies:()=>({numericalThroughPoints:{dependencyType:"stateVariable",variableName:"numericalThroughPoints"},numericalPrescribedVertex:{dependencyType:"stateVariable",variableName:"numericalPrescribedVertex"},pointsAreNumerical:{dependencyType:"stateVariable",variableName:"pointsAreNumerical"},aShadow:{dependencyType:"stateVariable",variableName:"aShadow"}}),definition:function({dependencyValues:os,componentName:ls}){if(!os.pointsAreNumerical)return{setValue:{a:NaN,b:NaN,c:NaN,realValued:!1}};let us,cs,ds,ps=!0;if(os.numericalPrescribedVertex)if(os.numericalThroughPoints.length===0){let fs=os.numericalPrescribedVertex,hs=fs[0],gs=fs[1];return us=os.aShadow,cs=-2*us*hs,ds=us*hs*hs+gs,{setValue:{a:us,b:cs,c:ds,realValued:!0}}}else{let fs=os.numericalPrescribedVertex,hs=fs[0],gs=fs[1],ys=os.numericalThroughPoints[0],bs=ys[0];return us=(ys[1]-gs)/(bs-hs)**2,cs=-2*us*hs,ds=us*hs*hs+gs,{setValue:{a:us,b:cs,c:ds,realValued:!0}}}if(os.numericalThroughPoints.length===0)return{setValue:{a:os.aShadow,realValued:!0},useEssentialOrDefaultValue:{b:!0,c:!0}};if(os.numericalThroughPoints.length===1){let fs=os.numericalThroughPoints[0],hs=fs[0],gs=fs[1];return us=os.aShadow,cs=-2*us*hs,ds=us*hs*hs+gs,{setValue:{a:us,b:cs,c:ds,realValued:!0}}}else if(os.numericalThroughPoints.length===2){us=os.aShadow;let fs=os.numericalThroughPoints[0],hs=fs[0],gs=fs[1],ys=hs*hs,bs=os.numericalThroughPoints[1],vs=bs[0],xs=bs[1],Cs=vs*vs;return hs===vs?gs==xs?(cs=-2*us*hs,ds=us*ys+gs):(ps=!1,us=NaN,cs=NaN,ds=NaN):(cs=(gs-xs-us*(ys-Cs))/(hs-vs),ds=gs-us*ys-cs*hs),{setValue:{a:us,b:cs,c:ds,realValued:ps}}}else if(os.numericalThroughPoints.length===3){let fs=os.numericalThroughPoints[0],hs=fs[0],gs=fs[1],ys=hs*hs,bs=os.numericalThroughPoints[1],vs=bs[0],xs=bs[1],Cs=vs*vs,Ts=os.numericalThroughPoints[2],Ss=Ts[0],Ns=Ts[1],As=Ss*Ss,ws=ys-As,Es=Cs-As,_s=hs-Ss,$s=vs-Ss,Rs=gs-Ns,Is=xs-Ns,Os=ws*$s-Es*_s;if(Os===0){let Ds=!1,Vs,ks,Ps;hs===vs?gs===xs?hs===Ss?gs==Ns?Vs=1:Ds=!0:(Vs=2,ks=Ss,Ps=Ns):Ds=!0:hs===Ss?gs===Ns?(Vs=2,ks=vs,Ps=xs):Ds=!0:vs===Ss&&xs===Ns?(Vs=2,ks=vs,Ps=xs):Ds=!0,Ds?(ps=!1,us=NaN,cs=NaN,ds=NaN):Vs===1?(us=os.aShadow,cs=-2*us*hs,ds=us*hs*hs+gs):(us=os.aShadow,cs=(gs-Ps-us*(ys-ks*ks))/(hs-ks),ds=gs-us*ys-cs*hs)}else us=(Rs*$s-Is*_s)/Os,cs=(Is*ws-Rs*Es)/Os,ds=gs-cs*hs-us*ys;return{setValue:{a:us,b:cs,c:ds,realValued:ps}}}else return console.warn("Haven't implemented parabola through more than 3 points"),{setValue:{a:NaN,b:NaN,c:NaN,realValued:!1}}},inverseDefinition:async function({desiredStateVariableValues:os,dependencyValues:ls,stateValues:us,workspace:cs}){if(!ls.pointsAreNumerical)return{success:!1};let ds={},ps=function(hs){if(Number.isFinite(hs))return{success:!0,value:hs};if(hs instanceof Context.class){let gs=hs.evaluate_to_constant();if(Number.isFinite(gs))return{success:!0,value:gs}}return{success:!1}};if(os.a!==void 0){let hs=ps(os.a);if(hs.success)ds.a=hs.value;else return{success:!1}}if(os.b!==void 0){let hs=ps(os.b);if(hs.success)ds.b=hs.value;else return{success:!1}}if(os.c!==void 0){let hs=ps(os.c);if(hs.success)ds.c=hs.value;else return{success:!1}}Object.assign(cs,ds);let fs=async function(hs){return cs[hs]!==void 0?cs[hs]:await us[hs]};if(ls.numericalThroughPoints.length===0){let hs=[];return ds.a!==void 0&&hs.push({setDependency:"aShadow",desiredValue:ds.a}),ds.b!==void 0&&hs.push({setEssentialValue:"b",value:ds.b}),ds.c!==void 0&&hs.push({setEssentialValue:"c",value:ds.c}),{success:!0,instructions:hs}}else if(ls.numericalThroughPoints.length===1){let hs=await fs("a"),gs=await fs("b"),ys=await fs("c"),bs=-gs/(2*hs),vs=ys-gs*gs/(4*hs),xs=[{setDependency:"numericalThroughPoints",desiredValue:[[bs,vs]]}];return ds.a!==void 0&&xs.push({setDependency:"aShadow",desiredValue:ds.a}),{success:!0,instructions:xs}}else if(ls.numericalThroughPoints.length===2){let hs=await fs("a"),gs=await fs("b"),ys=await fs("c"),vs=ls.numericalThroughPoints[0][0],Cs=ls.numericalThroughPoints[1][0];if(vs===Cs){vs=-gs/(2*hs);let Ts=ys-gs*gs/(4*hs),Ss=[{setDependency:"numericalThroughPoints",desiredValue:[[vs,Ts],[vs,Ts]]}];return ds.a!==void 0&&Ss.push({setDependency:"aShadow",desiredValue:ds.a}),{success:!0,instructions:Ss}}else{let Ts=hs*vs*vs+gs*vs+ys,Ss=hs*Cs*Cs+gs*Cs+ys,Ns=[{setDependency:"numericalThroughPoints",desiredValue:[[vs,Ts],[Cs,Ss]]}];return ds.a!==void 0&&Ns.push({setDependency:"aShadow",desiredValue:ds.a}),{success:!0,instructions:Ns}}}else if(ls.numericalThroughPoints.length===3){let hs=await fs("a"),gs=await fs("b"),ys=await fs("c"),vs=ls.numericalThroughPoints[0][0],Cs=ls.numericalThroughPoints[1][0],Ss=ls.numericalThroughPoints[2][0],Ns=3,As;if(vs===Cs?vs===Ss?Ns=1:(Ns=2,As=3):vs===Ss?(Ns=2,As=2):Cs===Ss&&(Ns=2,As=1),Ns===3){let ws=hs*vs*vs+gs*vs+ys,Es=hs*Cs*Cs+gs*Cs+ys,_s=hs*Ss*Ss+gs*Ss+ys,$s=[{setDependency:"numericalThroughPoints",desiredValue:[[vs,ws],[Cs,Es],[Ss,_s]]}];return ds.a!==void 0&&$s.push({setDependency:"aShadow",desiredValue:ds.a}),{success:!0,instructions:$s}}else if(Ns===2)if(As===1){let ws=vs,Es=Cs,_s=hs*ws*ws+gs*ws+ys,$s=hs*Es*Es+gs*Es+ys,Rs=[{setDependency:"numericalThroughPoints",desiredValue:[[ws,_s],[Es,$s],[Es,$s]]}];return ds.a!==void 0&&Rs.push({setDependency:"aShadow",desiredValue:ds.a}),{success:!0,instructions:Rs}}else if(As===2){let ws=vs,Es=Cs,_s=hs*ws*ws+gs*ws+ys,$s=hs*Es*Es+gs*Es+ys,Rs=[{setDependency:"numericalThroughPoints",desiredValue:[[ws,_s],[Es,$s],[ws,_s]]}];return ds.a!==void 0&&Rs.push({setDependency:"aShadow",desiredValue:ds.a}),{success:!0,instructions:Rs}}else{let ws=vs,Es=Ss,_s=hs*ws*ws+gs*ws+ys,$s=hs*Es*Es+gs*Es+ys,Rs=[{setDependency:"numericalThroughPoints",desiredValue:[[ws,_s],[ws,_s],[Es,$s]]}];return ds.a!==void 0&&Rs.push({setDependency:"aShadow",desiredValue:ds.a}),{success:!0,instructions:Rs}}else{vs=-gs/(2*hs);let ws=ys-gs*gs/(4*hs),Es=[{setDependency:"numericalThroughPoints",desiredValue:[[vs,ws],[vs,ws],[vs,ws]]}];return ds.a!==void 0&&Es.push({setDependency:"aShadow",desiredValue:ds.a}),{success:!0,instructions:Es}}}else return{success:!1}}},ns.vertex={public:!0,shadowingInstructions:{createComponentOfType:"math",returnWrappingComponents(os){return os==="vertexX"?[]:[["point",{componentType:"mathList",isAttribute:"xs"}]]}},isArray:!0,entryPrefixes:["vertexX"],returnArraySizeDependencies:()=>({}),returnArraySize(){return[2]},returnArrayDependenciesByKey(){return{globalDependencies:{a:{dependencyType:"stateVariable",variableName:"a"},b:{dependencyType:"stateVariable",variableName:"b"},c:{dependencyType:"stateVariable",variableName:"c"},realValued:{dependencyType:"stateVariable",variableName:"realValued"}}}},arrayDefinitionByKey:function({globalDependencyValues:os}){let ls={};return os.realValued&&os.a!==0?(ls[0]=Context.fromAst(-os.b/(2*os.a)),ls[1]=Context.fromAst(os.c-os.b**2/(4*os.a))):(ls[0]=Context.fromAst("_"),ls[1]=Context.fromAst("_")),{setValue:{vertex:ls}}},inverseArrayDefinitionByKey:async function({desiredStateVariableValues:os,globalDependencyValues:ls,workspace:us,stateValues:cs}){let ds;if("0"in os.vertex?ds=os.vertex[0].evaluate_to_constant():us.x!==void 0?ds=us.x:ds=(await cs.vertex)[0].tree,Number.isFinite(ds))us.x=ds;else return{success:!1};let ps;if("1"in os.vertex?ps=os.vertex[1].evaluate_to_constant():us.y!==void 0?ps=us.y:ps=(await cs.vertex)[1].tree,Number.isFinite(ps))us.y=ps;else return{success:!1};let fs=ls.a,hs=-2*fs*ds,gs=ps+fs*ds*ds;return{success:!0,instructions:[{setDependency:"b",desiredValue:hs,additionalDependencyValues:{c:gs}}]}}},ns.equation={public:!0,shadowingInstructions:{createComponentOfType:"math"},additionalProperties:{simplify:"numberspreserveorder",displaysmallaszero:!0},returnDependencies:()=>({a:{dependencyType:"stateVariable",variableName:"a"},b:{dependencyType:"stateVariable",variableName:"b"},c:{dependencyType:"stateVariable",variableName:"c"}}),definition:function({dependencyValues:os}){let ls=["=","y",["+",["*",os.a,["^","x",2]],["*",os.b,"x"],os.c]];return{setValue:{equation:Context.fromAst(ls).evaluate_numbers({skip_ordering:!0})}}}},ns.fs={forRenderer:!0,isArray:!0,entryPrefixes:["f"],additionalStateVariablesDefined:[{variableName:"fDefinitions",isArray:!0,forRenderer:!0}],returnArraySizeDependencies:()=>({}),returnArraySize:()=>[1],returnArrayDependenciesByKey(){return{globalDependencies:{a:{dependencyType:"stateVariable",variableName:"a"},b:{dependencyType:"stateVariable",variableName:"b"},c:{dependencyType:"stateVariable",variableName:"c"}}}},arrayDefinitionByKey({globalDependencyValues:os}){return{setValue:{fs:[function(us){return os.a*us*us+os.b*us+os.c}],fDefinitions:[{functionType:"formula",formula:["+",["*",os.a,"x","x"],["*",os.b,"x"],os.c],variables:["x"],nInputs:1,nOutputs:1,domain:null}]}}}},ns.f={isAlias:!0,targetVariableName:"f1"},ns.nearestPoint={returnDependencies:()=>({f:{dependencyType:"stateVariable",variableName:"f"},a:{dependencyType:"stateVariable",variableName:"a"},b:{dependencyType:"stateVariable",variableName:"b"},c:{dependencyType:"stateVariable",variableName:"c"}}),definition({dependencyValues:os,componentName:ls}){let us=!(Number.isFinite(os.a)&&Number.isFinite(os.b)&&Number.isFinite(os.c));return{setValue:{nearestPoint:function({variables:cs,scales:ds}){var Rs,Is;if(us)return{};let ps=ds[0],fs=ds[1],hs=(Rs=cs.x1)==null?void 0:Rs.evaluate_to_constant(),gs=(Is=cs.x2)==null?void 0:Is.evaluate_to_constant();if(!(Number.isFinite(hs)&&Number.isFinite(gs)))return{};hs/=ps,gs/=fs;let ys=os.a*ps*ps/fs,bs=os.b*ps/fs,vs=os.c/fs;if(ys===0){let Os=bs*bs+1,Ds={};return Ds.x1=(hs+bs*gs-bs*vs)/Os*ps,Ds.x2=(bs*(hs+bs*gs)+vs)/Os*fs,cs.x3!==void 0&&(Ds.x3=0),Ds}let xs=vs-gs,Cs=2*ys**2,Ts=3*ys*bs/Cs,Ss=(2*ys*xs+bs**2+1)/Cs,Ns=(bs*xs-hs)/Cs,As=cardano(Ts,Ss,Ns,1e-14),ws=As[0],Es=os.f(ws*ps)/fs,_s=(hs-ws)**2+(gs-Es)**2;for(let Os of As.slice(1)){let Ds=Os,Vs=os.f(Ds*ps)/fs,ks=(hs-Ds)**2+(gs-Vs)**2;ks<_s&&(ws=Ds,Es=Vs,_s=ks)}let $s={x1:ws*ps,x2:Es*fs};return cs.x3!==void 0&&($s.x3=0),$s}}}}},ns}}zs(Parabola,"componentType","parabola"),zs(Parabola,"rendererType","curve");function cardano(as,rs,ns,ss=1e-10){const[os,ls]=[-.3333333333333333*as*as+rs,.07407407407407407*as*as*as-.3333333333333333*as*rs+ns];if(Math.abs(ls)<=ss){if(Math.abs(os)<=ss)return[-as/3];let hs=Math.sqrt(Math.abs(os));return os<0?[-hs-as/3,-as/3,hs-as/3]:[-as/3]}const us=-27*ls*ls-4*os*os*os;if(Math.abs(us)<=ss){const hs=Math.cbrt(-ls/2);return[2*hs-as/3,-hs-as/3]}if(us>0){const hs=Math.sqrt(us/108),gs=Math.sqrt(Math.cbrt(ls*ls/4+us/108))*2,ys=Math.atan2(hs,-ls/2);return[Math.cos(ys/3),Math.cos(ys/3+2*Math.PI/3),Math.cos(ys/3-2*Math.PI/3)].sort((bs,vs)=>bs-vs).map(bs=>gs*bs-as/3)}const cs=Math.sqrt(-us/108),ds=Math.cbrt(-ls/2+cs),ps=Math.cbrt(-ls/2-cs);return[ds+ps-as/3]}class BezierControls extends InlineComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.alwaysVisible={createComponentOfType:"boolean",createStateVariable:"alwaysVisible",defaultValue:!1,public:!0},rs}static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=function({matchedChildren:ss}){let os=breakEmbeddedStringsIntoParensPieces({componentList:ss});return os.success!==!0?{success:!1}:{success:!0,newChildren:os.pieces.map(function(ls){return ls.length>1||typeof ls[0]=="string"?{componentType:"controlVectors",children:[{componentType:"vector",children:ls}]}:ls[0]})}};return rs.push({replacementFunction:ns}),rs}static returnChildGroups(){return[{group:"controlVectors",componentTypes:["controlVectors"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.nControls={returnDependencies:()=>({nParentPoints:{dependencyType:"parentStateVariable",variableName:"nThroughPoints",skipComponentNames:!0}}),definition({dependencyValues:ns}){let ss=ns.nParentPoints;return Number.isInteger(ss)&&ss>=0||(ss=0),{setValue:{nControls:ss}}}},rs.pointIndMap={returnDependencies:()=>({controlChildren:{dependencyType:"child",childGroups:["controlVectors"],variableNames:["pointNumber"]}}),definition:function({dependencyValues:ns}){let ss=[],os=-1;for(let[ls,us]of ns.controlChildren.entries()){let cs=us.stateValues.pointNumber;Number.isFinite(cs)?os=Math.round(cs)-1:os+=1,ss[os]=ls}return{setValue:{pointIndMap:ss}}}},rs.directions={isArray:!0,entryPrefixes:["direction"],hasEssential:!0,defaultValueByArrayKey:()=>"none",stateVariablesDeterminingDependencies:["pointIndMap"],returnArraySizeDependencies:()=>({nControls:{dependencyType:"stateVariable",variableName:"nControls"}}),returnArraySize({dependencyValues:ns}){return[ns.nControls]},returnArrayDependenciesByKey({arrayKeys:ns,stateValues:ss}){let os={};for(let ls of ns){let us=ss.pointIndMap[ls];us!==void 0&&(os[ls]={controlChild:{dependencyType:"child",childGroups:["controlVectors"],variableNames:["direction"],childIndices:[us]}})}return{dependenciesByKey:os}},arrayDefinitionByKey({dependencyValuesByKey:ns,arrayKeys:ss}){let os={},ls={};for(let us of ss){let cs=ns[us].controlChild;cs&&cs.length===1?os[us]=cs[0].stateValues.direction:ls[us]=!0}return{setValue:{directions:os},useEssentialOrDefaultValue:{directions:ls}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ns,dependencyNamesByKey:ss,dependencyValuesByKey:os}){let ls=[],us={};for(let cs in ns.directions){let ds=os[cs].controlChild;ds&&ds.length===1?ls.push({setDependency:ss[cs].controlChild,desiredValue:ns.directions[cs],childIndex:0,variableIndex:0}):us[cs]=ns.directions[cs]}return Object.keys(us).length>0&&ls.push({setEssentialValue:"directions",value:us}),{success:!0,instructions:ls}}},rs.hiddenControls={isArray:!0,entryPrefixes:["hiddenControl"],hasEssential:!0,defaultValueByArrayKey:()=>!1,stateVariablesDeterminingDependencies:["pointIndMap"],returnArraySizeDependencies:()=>({nControls:{dependencyType:"stateVariable",variableName:"nControls"}}),returnArraySize({dependencyValues:ns}){return[ns.nControls]},returnArrayDependenciesByKey({arrayKeys:ns,stateValues:ss}){let os={};for(let ls of ns){let us=ss.pointIndMap[ls];us!==void 0&&(os[ls]={controlChild:{dependencyType:"child",childGroups:["controlVectors"],variableNames:["hide"],childIndices:[us]}})}return{dependenciesByKey:os}},arrayDefinitionByKey({dependencyValuesByKey:ns,arrayKeys:ss}){let os={},ls={};for(let us of ss){let cs=ns[us].controlChild;cs&&cs.length===1?os[us]=cs[0].stateValues.hide:ls[us]=!0}return{setValue:{hiddenControls:os},useEssentialOrDefaultValue:{hiddenControls:ls}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ns,dependencyNamesByKey:ss,dependencyValuesByKey:os}){let ls=[],us={};for(let cs in ns.hiddenControls){let ds=os[cs].controlChild;ds&&ds.length===1?ls.push({setDependency:ss[cs].controlChild,desiredValue:ns.hiddenControls[cs],childIndex:0,variableIndex:0}):us[cs]=ns.hiddenControls[cs]}return Object.keys(us).length>0&&ls.push({setEssentialValue:"hiddenControls",value:us}),{success:!0,instructions:ls}}},rs.nDimensions={returnDependencies(){return{nParentDimensions:{dependencyType:"parentStateVariable",variableName:"nDimensions"}}},definition:function({dependencyValues:ns}){let ss=ns.nParentDimensions;return Number.isInteger(ss)&&ss>=0||(ss=0),{setValue:{nDimensions:ss},checkForActualChange:{nDimensions:!0}}}},rs.essentialSymmetricControls={isArray:!0,entryPrefixes:["essentialSymmetricControl"],nDimensions:2,hasEssential:!0,defaultValueByArrayKey:()=>Context.fromAst(1),returnArraySizeDependencies:()=>({nControls:{dependencyType:"stateVariable",variableName:"nControls"},nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),returnArraySize({dependencyValues:ns}){return[ns.nControls,ns.nDimensions]},returnArrayDependenciesByKey:()=>({}),arrayDefinitionByKey({arrayKeys:ns}){let ss={};for(let os of ns)os.split(",").map(ls=>Number(ls)),ss[os]=!0;return{useEssentialOrDefaultValue:{essentialSymmetricControls:ss}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ns}){let ss=[],os={};for(let ls in ns.essentialSymmetricControls)os[ls]=ns.essentialSymmetricControls[ls];return Object.keys(os).length>0&&ss.push({setEssentialValue:"essentialSymmetricControls",value:os}),{success:!0,instructions:ss}}},rs.controls={isArray:!0,entryPrefixes:["control"],nDimensions:3,hasEssential:!0,shadowVariable:!0,defaultValueByArrayKey:()=>Context.fromAst(1),stateVariablesDeterminingDependencies:["pointIndMap","directions"],returnArraySizeDependencies:()=>({nControls:{dependencyType:"stateVariable",variableName:"nControls"},nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),returnArraySize({dependencyValues:ns}){return[ns.nControls,2,ns.nDimensions]},returnArrayDependenciesByKey({arrayKeys:ns,stateValues:ss}){let os={};for(let ls of ns){let us=ls.split(",").map(ps=>Number(ps)),cs=us.map(ps=>ps+1);os[ls]={direction:{dependencyType:"stateVariable",variableName:"direction"+cs[0]}};let ds=ss.directions[us[0]];if(ds!=="none"&&(us[1]===0||us[1]===1)){let ps=ss.pointIndMap[us[0]];ps!==void 0&&(ds==="symmetric"||ds==="previous"&&us[1]===0||ds==="next"&&us[1]===1?os[ls].controlChild={dependencyType:"child",childGroups:["controlVectors"],variableNames:["vectorX1_"+cs[2]],childIndices:[ps]}:ds==="both"&&(os[ls].controlChild={dependencyType:"child",childGroups:["controlVectors"],variableNames:["vectorX"+cs[1]+"_"+cs[2]],childIndices:[ps]})),ds==="symmetric"&&(os[ls].essentialSymmetricControl={dependencyType:"stateVariable",variableName:"essentialSymmetricControl"+cs[0]+"_"+cs[2]})}}return{dependenciesByKey:os}},arrayDefinitionByKey({dependencyValuesByKey:ns,arrayKeys:ss,componentName:os}){let ls={},us={};for(let cs of ss){let ds=cs.split(",").map(hs=>Number(hs)),ps=ds.map(hs=>hs+1),fs=ns[cs].direction;if(ds[1]===0)if(fs==="none"||fs==="next")ls[cs]=null;else{let hs=ns[cs].controlChild,gs=!0;if(hs&&hs.length===1){let ys=hs[0].stateValues["vectorX1_"+ps[2]];ys&&(gs=!1,ys=ys.evaluate_to_constant(),ls[cs]=Context.fromAst(ys))}gs&&(fs==="symmetric"?ls[cs]=ns[cs].essentialSymmetricControl:us[cs]=!0)}else if(ds[1]===1)if(fs==="none"||fs==="previous")ls[cs]=null;else{let hs=ns[cs].controlChild,gs=!0;if(hs&&hs.length===1)if(fs==="both"){let ys=hs[0].stateValues["vectorX2_"+ps[2]];ys&&(gs=!1,ys=ys.evaluate_to_constant(),ls[cs]=Context.fromAst(ys))}else{let ys=hs[0].stateValues["vectorX1_"+ps[2]];ys&&(gs=!1,ys=ys.evaluate_to_constant(),fs==="symmetric"?ls[cs]=Context.fromAst(-ys):ls[cs]=Context.fromAst(ys))}gs&&(fs==="symmetric"?ns[cs].essentialSymmetricControl&&(ls[cs]=Context.fromAst(-ns[cs].essentialSymmetricControl.tree)):us[cs]=!0)}}return{setValue:{controls:ls},useEssentialOrDefaultValue:{controls:us}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ns,dependencyNamesByKey:ss,dependencyValuesByKey:os}){let ls=[],us={};for(let cs in ns.controls){let ds=cs.split(",").map(hs=>Number(hs)),ps=ds.map(hs=>hs+1),fs=os[cs].direction;if(fs){if(ds[1]===0){if(!(fs==="none"||fs==="next")){let hs=os[cs].controlChild,gs=!0;if(hs&&hs.length===1&&hs[0].stateValues["vectorX1_"+ps[2]]&&(gs=!1,ls.push({setDependency:ss[cs].controlChild,desiredValue:ns.controls[cs],childIndex:0,variableIndex:0})),gs){let ys=Context.fromAst(ns.controls[cs].evaluate_to_constant());fs==="symmetric"?ls.push({setDependency:ss[cs].essentialSymmetricControl,desiredValue:ys}):us[cs]=ys}}}else if(ds[1]===1&&!(fs==="none"||fs==="previous")){let hs=os[cs].controlChild,gs=!0;hs&&hs.length===1&&(fs==="both"?hs[0].stateValues["vectorX2_"+ps[2]]&&(gs=!1):hs[0].stateValues["vectorX1_"+ps[2]]&&(gs=!1));let ys;fs==="symmetric"?ys=Context.fromAst(["-",ns.controls[cs].tree]):ys=ns.controls[cs],gs?(ys=Context.fromAst(ys.evaluate_to_constant()),fs==="symmetric"?ls.push({setDependency:ss[cs].essentialSymmetricControl,desiredValue:ys}):us[cs]=ys):ls.push({setDependency:ss[cs].controlChild,desiredValue:ys,childIndex:0,variableIndex:0})}}}return Object.keys(us).length>0&&ls.push({setEssentialValue:"controls",value:us}),{success:!0,instructions:ls}}},rs}}zs(BezierControls,"componentType","bezierControls"),zs(BezierControls,"rendererType","containerInline");class VectorListComponent extends BaseComponent{static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=function({matchedChildren:ss}){let os=breakEmbeddedStringsIntoParensPieces({componentList:ss});return os.success!==!0?{success:!1}:{success:!0,newChildren:os.pieces.map(function(ls){return ls.length>1||typeof ls[0]=="string"?{componentType:"vector",children:ls}:ls[0]})}};return rs.push({replacementFunction:ns}),rs}static returnChildGroups(){return[{group:"vectors",componentTypes:["vector"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.nVectors={returnDependencies:()=>({vectorChildren:{dependencyType:"child",childGroups:["vectors"],skipComponentNames:!0}}),definition:({dependencyValues:ns})=>({setValue:{nVectors:ns.vectorChildren.length},checkForActualChange:{nVectors:!0}})},rs.nDimensions={returnDependencies:()=>({vectorChildren:{dependencyType:"child",childGroups:["vectors"],variableNames:["nDimensions"],skipPlaceholders:!0}}),definition:function({dependencyValues:ns}){let ss;if(ns.vectorChildren.length===0)ss=2;else{ss=1;for(let os of ns.vectorChildren)Number.isFinite(os.stateValues.nDimensions)&&(ss=Math.max(ss,os.stateValues.nDimensions))}return{setValue:{nDimensions:ss},checkForActualChange:{nDimensions:!0}}}},rs.vectors={isArray:!0,nDimensions:2,entryPrefixes:["vectorX","vector"],getArrayKeysFromVarName({arrayEntryPrefix:ns,varEnding:ss,arraySize:os}){if(ns==="vectorX"){let ls=ss.split("_").map(us=>Number(us)-1);return ls.length===2&&ls.every((us,cs)=>Number.isInteger(us)&&us>=0)?os?ls.every((us,cs)=>us=0?os?lsls+","+cs):[]:[ls+",0"]:[]}},arrayVarNameFromPropIndex(ns,ss){if(ss==="vectors")return ns.length===1?"vector"+ns[0]:`vectorX${ns[0]}_${ns[1]}`;if(ss.slice(0,6)==="vector"){let os=Number(ss.slice(6));if(Number.isInteger(os)&&os>0)return`vectorX${os}_${ns[0]}`}return null},returnArraySizeDependencies:()=>({nVectors:{dependencyType:"stateVariable",variableName:"nVectors"},nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),returnArraySize({dependencyValues:ns}){return[ns.nVectors,ns.nDimensions]},returnArrayDependenciesByKey({arrayKeys:ns}){let ss={};for(let os of ns){let[ls,us]=os.split(",");ss[os]={vectorChild:{dependencyType:"child",childGroups:["vectors"],variableNames:["x"+(Number(us)+1)],childIndices:[ls]}}}return{dependenciesByKey:ss}},arrayDefinitionByKey({dependencyValuesByKey:ns,arrayKeys:ss}){let os={};for(let ls of ss){let us=ls.split(",")[1],cs=ns[ls].vectorChild[0];cs&&(os[ls]=cs.stateValues["x"+(Number(us)+1)])}return{setValue:{vectors:os}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ns,dependencyNamesByKey:ss}){let os=[];for(let ls in ns.vectors)os.push({setDependency:ss[ls].vectorChild,desiredValue:ns.vectors[ls],childIndex:0,variableIndex:0});return{success:!0,instructions:os}}},rs}}zs(VectorListComponent,"componentType","_vectorListComponent"),zs(VectorListComponent,"rendererType","containerInline"),zs(VectorListComponent,"renderChildren",!0);class ControlVectors extends VectorListComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.direction={createComponentOfType:"text",createStateVariable:"direction",defaultValue:"symmetric",public:!0,toLowerCase:!0,validValues:["symmetric","previous","next","both","none"]},rs.pointNumber={createComponentOfType:"number",createStateVariable:"pointNumber",defaultValue:null,public:!0},rs}}zs(ControlVectors,"componentType","controlVectors");class PointListComponent extends BaseComponent{static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=function({matchedChildren:ss}){let os=breakEmbeddedStringsIntoParensPieces({componentList:ss});return os.success!==!0?{success:!1}:{success:!0,newChildren:os.pieces.map(function(ls){return ls.length>1||typeof ls[0]=="string"?{componentType:"point",children:ls}:ls[0]})}};return rs.push({replacementFunction:ns}),rs}static returnChildGroups(){return[{group:"points",componentTypes:["point"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.nPoints={returnDependencies:()=>({pointChildren:{dependencyType:"child",childGroups:["points"],skipComponentNames:!0}}),definition:function({dependencyValues:ns}){return{setValue:{nPoints:ns.pointChildren.length},checkForActualChange:{nPoints:!0}}}},rs.nDimensions={returnDependencies:()=>({pointChildren:{dependencyType:"child",childGroups:["points"],variableNames:["nDimensions"],skipPlaceholders:!0}}),definition:function({dependencyValues:ns}){let ss;if(ns.pointChildren.length===0)ss=2;else{ss=1;for(let os of ns.pointChildren)Number.isFinite(os.stateValues.nDimensions)&&(ss=Math.max(ss,os.stateValues.nDimensions))}return{setValue:{nDimensions:ss},checkForActualChange:{nDimensions:!0}}}},rs.points={isArray:!0,nDimensions:2,entryPrefixes:["pointX","point"],getArrayKeysFromVarName({arrayEntryPrefix:ns,varEnding:ss,arraySize:os}){if(ns==="pointX"){let ls=ss.split("_").map(us=>Number(us)-1);return ls.length===2&&ls.every((us,cs)=>Number.isInteger(us)&&us>=0)?os?ls.every((us,cs)=>us=0?os?lsls+","+cs):[]:[ls+",0"]:[]}},arrayVarNameFromPropIndex(ns,ss){if(ss==="points")return ns.length===1?"point"+ns[0]:`pointX${ns[0]}_${ns[1]}`;if(ss.slice(0,5)==="point"){let os=Number(ss.slice(5));if(Number.isInteger(os)&&os>0)return`pointX${os}_${ns[0]}`}return null},returnArraySizeDependencies:()=>({nPoints:{dependencyType:"stateVariable",variableName:"nPoints"},nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),returnArraySize({dependencyValues:ns}){return[ns.nPoints,ns.nDimensions]},returnArrayDependenciesByKey({arrayKeys:ns}){let ss={};for(let os of ns){let[ls,us]=os.split(",");ss[os]={pointChild:{dependencyType:"child",childGroups:["points"],variableNames:["x"+(Number(us)+1)],childIndices:[ls]}}}return{dependenciesByKey:ss}},arrayDefinitionByKey({dependencyValuesByKey:ns,arrayKeys:ss}){let os={};for(let ls of ss){let us=ls.split(",")[1],cs=ns[ls].pointChild[0];cs&&(os[ls]=cs.stateValues["x"+(Number(us)+1)])}return{setValue:{points:os}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ns,dependencyNamesByKey:ss}){let os=[];for(let ls in ns.points)os.push({setDependency:ss[ls].pointChild,desiredValue:ns.points[ls],childIndex:0,variableIndex:0});return{success:!0,instructions:os}}},rs}}zs(PointListComponent,"componentType","_pointListComponent"),zs(PointListComponent,"rendererType","containerInline"),zs(PointListComponent,"renderChildren",!0);class IntervalListComponent extends BaseComponent{static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=function({matchedChildren:ss}){let os=breakEmbeddedStringsIntoIntervalPieces({componentList:ss});return os.success!==!0?{success:!1}:{success:!0,newChildren:os.pieces.map(function(ls){return ls.length>1||typeof ls[0]=="string"?{componentType:"interval",children:ls}:ls[0]})}};return rs.push({replacementFunction:ns}),rs}static returnChildGroups(){return[{group:"intervals",componentTypes:["interval"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.nIntervals={returnDependencies:()=>({intervalChildren:{dependencyType:"child",childGroups:["intervals"],skipComponentNames:!0}}),definition:function({dependencyValues:ns}){return{setValue:{nIntervals:ns.intervalChildren.length},checkForActualChange:{nIntervals:!0}}}},rs.intervals={isArray:!0,nDimensions:1,entryPrefixes:["interval"],returnArraySizeDependencies:()=>({nIntervals:{dependencyType:"stateVariable",variableName:"nIntervals"}}),returnArraySize({dependencyValues:ns}){return[ns.nIntervals]},returnArrayDependenciesByKey({arrayKeys:ns}){let ss={};for(let os of ns)ss[os]={intervalChild:{dependencyType:"child",childGroups:["intervals"],variableNames:["value"],childIndices:[os]}};return{dependenciesByKey:ss}},arrayDefinitionByKey({dependencyValuesByKey:ns,arrayKeys:ss}){let os={};for(let ls of ss){let us=ns[ls].intervalChild[0];us&&(os[ls]=us.stateValues.value)}return{setValue:{intervals:os}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ns,dependencyNamesByKey:ss}){let os=[];for(let ls in ns.intervals)os.push({setDependency:ss[ls].intervalChild,desiredValue:ns.intervals[ls],childIndex:0,variableIndex:0});return{success:!0,instructions:os}}},rs}}zs(IntervalListComponent,"componentType","_intervalListComponent"),zs(IntervalListComponent,"rendererType","containerInline"),zs(IntervalListComponent,"renderChildren",!0);function breakEmbeddedStringsIntoIntervalPieces({componentList:as}){let rs=0,ns=[],ss=[];for(let os of as){if(typeof os!="string"){if(rs===0)return{success:!1};ss.push(os);continue}let ls=os.trim(),us=0;for(let cs=0;csus){let ps=cs+1,fs=ls.substring(us,ps).trim();fs.length>0&&ss.push(fs)}ns.push(ss),ss=[],us=cs+1}rs--}else if(rs===0&&!ds.match(/\s/))return{success:!1}}if(ls.length>us){let cs=ls.substring(us,ls.length).trim();ss.push(cs)}}return rs!==0?{success:!1}:ss.length>0?{success:!1}:{success:!0,pieces:ns}}class LineListComponent extends BaseComponent{static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=function({matchedChildren:ss}){return{success:!0,newChildren:ss.reduce(function(ls,us){return typeof us=="string"?[...ls,...us.split(/\s+/).filter(cs=>cs).map(cs=>({componentType:"line",children:[cs]}))]:[...ls,us]},[])}};return rs.push({replacementFunction:ns}),rs}static returnChildGroups(){return[{group:"lines",componentTypes:["line"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.nLines={returnDependencies:()=>({lineChildren:{dependencyType:"child",childGroups:["lines"],skipComponentNames:!0}}),definition:function({dependencyValues:ns}){return{setValue:{nLines:ns.lineChildren.length},checkForActualChange:{nLines:!0}}}},rs.lineNames={isArray:!0,entryPrefixes:["lineName"],returnArraySizeDependencies:()=>({nLines:{dependencyType:"stateVariable",variableName:"nLines"}}),returnArraySize({dependencyValues:ns}){return[ns.nLines]},returnArrayDependenciesByKey({arrayKeys:ns}){let ss={};for(let os of ns)ss[os]={lineChild:{dependencyType:"child",childGroups:["lines"],childIndices:[os]}};return{dependenciesByKey:ss}},arrayDefinitionByKey({dependencyValuesByKey:ns,arrayKeys:ss}){let os={};for(let ls of ss){let us=ns[ls].lineChild[0];us&&(os[ls]=us.componentName)}return{setValue:{lineNames:os}}}},rs}}zs(LineListComponent,"componentType","_lineListComponent"),zs(LineListComponent,"rendererType","containerInline"),zs(LineListComponent,"renderChildren",!0);class AngleListComponent extends BaseComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.hide={default:!0},rs}static returnChildLogic(rs){let ns=super.returnChildLogic(rs),ss=ns.newLeaf({name:"AtLeastZeroAngles",componentType:"angle",comparison:"atLeast",number:0}),os=breakStringsAndOthersIntoComponentsByStringCommas(),ls=ns.newLeaf({name:"AtLeastOneString",componentType:"string",comparison:"atLeast",number:1}),us=ns.newLeaf({name:"AtLeastOneMath",componentType:"math",comparison:"atLeast",number:1}),cs=ns.newOperator({name:"StringsAndMaths",operator:"or",propositions:[ls,us],requireConsecutive:!0,isSugar:!0,replacementFunction:os});return ns.newOperator({name:"AnglesXorSugar",operator:"xor",propositions:[ss,cs],setAsBase:!0}),ns}updateState(rs={}){if(rs.init&&(this._state.angles={trackChanges:!0}),super.updateState(rs),!this.childLogicSatisfied){this.unresolvedState.angles=!0,this.unresolvedState.nAngles=!0;return}if(this.currentTracker.trackChanges.childrenChanged(this.componentName)){delete this.unresolvedState.angles,delete this.unresolvedState.nAngles;let os=this.childLogic.returnMatches("AtLeastZeroAngles");this.state.nAngles=os.length,this.state.angles=os.map(ls=>this.activeChildren[ls])}}initializeRenderer(){this.renderer===void 0&&(this.renderer=new this.availableRenderers.container({key:this.componentName}))}updateChildrenWhoRender(){this.childrenWhoRender=this.state.angles.map(rs=>rs.componentName)}}zs(AngleListComponent,"componentType","_angleListComponent");class Vector extends GraphicalComponent{constructor(rs){super(rs),Object.assign(this.actions,{moveVector:this.moveVector.bind(this),vectorClicked:this.vectorClicked.bind(this),mouseDownOnVector:this.mouseDownOnVector.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.draggable={createComponentOfType:"boolean",createStateVariable:"draggable",defaultValue:!0,public:!0,forRenderer:!0},rs.headDraggable={createComponentOfType:"boolean"},rs.tailDraggable={createComponentOfType:"boolean"},rs.x={createComponentOfType:"math"},rs.y={createComponentOfType:"math"},rs.z={createComponentOfType:"math"},rs.xs={createComponentOfType:"mathList"},rs.displacement={createComponentOfType:"vector"},rs.head={createComponentOfType:"point"},rs.tail={createComponentOfType:"point"},rs.displayDigits={createComponentOfType:"integer",createStateVariable:"displayDigits",defaultValue:10,public:!0},rs.displayDecimals={createComponentOfType:"integer",createStateVariable:"displayDecimals",defaultValue:null,public:!0},rs.displaySmallAsZero={createComponentOfType:"number",createStateVariable:"displaySmallAsZero",valueForTrue:1e-14,valueForFalse:0,defaultValue:0,public:!0},rs.padZeros={createComponentOfType:"boolean",createStateVariable:"padZeros",defaultValue:!1,public:!0},rs.displayWithAngleBrackets={createComponentOfType:"boolean",createStateVariable:"displayWithAngleBrackets",defaultValue:!1,public:!0},rs}static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=function({matchedChildren:ss,componentInfoObjects:os}){let us=returnBreakStringsSugarFunction({childrenToComponentFunction:gs=>({componentType:"math",children:gs}),mustStripOffOuterParentheses:!0}),cs=ss.map(gs=>typeof gs),ds=cs.indexOf("string"),ps=cs.lastIndexOf("string");if(ds===-1){let gs=os.componentIsSpecifiedType,ys=ss.filter(bs=>!(gs(bs,"point")||gs(bs,"vector")||gs(bs,"label")));if(ys.length===1){let bs=ys[0],vs=ss.indexOf(bs),xs=[...ss.slice(0,vs),...ss.slice(vs+1)];return{success:!0,newAttributes:{displacement:{component:{componentType:"math",children:ys}}},newChildren:xs}}else return{success:!1}}let fs=[...ss.slice(0,ds),...ss.slice(ps+1)];ss=ss.slice(ds,ps+1);let hs=us({matchedChildren:ss});return!hs.success&&ss.length===1?{success:!0,newAttributes:{x:{component:{componentType:"math",children:ss}}},newChildren:fs}:hs.success?{success:!0,newAttributes:{xs:{component:{componentType:"mathList",children:hs.newChildren,skipSugar:!0}}},newChildren:fs}:{success:!1}};return rs.push({replacementFunction:ns}),rs}static returnChildGroups(){let rs=super.returnChildGroups();return rs.push({group:"points",componentTypes:["point"]},{group:"vectors",componentTypes:["vector"]}),rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.styleDescription={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({selectedStyle:{dependencyType:"stateVariable",variableName:"selectedStyle"},document:{dependencyType:"ancestor",componentType:"document",variableNames:["theme"]}}),definition:function({dependencyValues:ns}){var ls;let ss;((ls=ns.document)==null?void 0:ls.stateValues.theme)==="dark"?ss=ns.selectedStyle.lineColorWordDarkMode:ss=ns.selectedStyle.lineColorWord;let os=ns.selectedStyle.lineWidthWord;return ns.selectedStyle.lineStyleWord&&(os&&(os+=" "),os+=ns.selectedStyle.lineStyleWord),os&&(os+=" "),os+=ss,{setValue:{styleDescription:os}}}},rs.styleDescriptionWithNoun={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({styleDescription:{dependencyType:"stateVariable",variableName:"styleDescription"}}),definition:function({dependencyValues:ns}){return{setValue:{styleDescriptionWithNoun:ns.styleDescription+" vector"}}}},rs.tailDraggable={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},hasEssential:!0,forRenderer:!0,returnDependencies:()=>({tailDraggableAttr:{dependencyType:"attributeComponent",attributeName:"tailDraggable",variableNames:["value"]},draggable:{dependencyType:"stateVariable",variableName:"draggable"}}),definition({dependencyValues:ns}){return ns.tailDraggableAttr?{setValue:{tailDraggable:ns.tailDraggableAttr.stateValues.value}}:{useEssentialOrDefaultValue:{tailDraggable:{defaultValue:ns.draggable}}}}},rs.headDraggable={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},hasEssential:!0,forRenderer:!0,returnDependencies:()=>({headDraggableAttr:{dependencyType:"attributeComponent",attributeName:"headDraggable",variableNames:["value"]},draggable:{dependencyType:"stateVariable",variableName:"draggable"}}),definition({dependencyValues:ns}){return ns.headDraggableAttr?{setValue:{headDraggable:ns.headDraggableAttr.stateValues.value}}:{useEssentialOrDefaultValue:{headDraggable:{defaultValue:ns.draggable}}}}},rs.displacementShadow={defaultValue:null,hasEssential:!0,essentialVarName:"displacement",set:convertValueToMathExpression,returnDependencies:()=>({}),definition:()=>({useEssentialOrDefaultValue:{displacementShadow:!0}}),inverseDefinition:function({desiredStateVariableValues:ns}){return{success:!0,instructions:[{setEssentialValue:"displacementShadow",value:convertValueToMathExpression(ns.displacementShadow)}]}}},rs.headShadow={defaultValue:null,hasEssential:!0,essentialVarName:"head",set:convertValueToMathExpression,returnDependencies:()=>({}),definition:()=>({useEssentialOrDefaultValue:{headShadow:!0}}),inverseDefinition:function({desiredStateVariableValues:ns}){return{success:!0,instructions:[{setEssentialValue:"headShadow",value:convertValueToMathExpression(ns.headShadow)}]}}},rs.tailShadow={defaultValue:null,hasEssential:!0,essentialVarName:"tail",set:convertValueToMathExpression,returnDependencies:()=>({}),definition:()=>({useEssentialOrDefaultValue:{tailShadow:!0}}),inverseDefinition:function({desiredStateVariableValues:ns}){return{success:!0,instructions:[{setEssentialValue:"tailShadow",value:convertValueToMathExpression(ns.tailShadow)}]}}},rs.sourceOfDisplacement={returnDependencies:()=>({xAttr:{dependencyType:"attributeComponent",attributeName:"x"},yAttr:{dependencyType:"attributeComponent",attributeName:"y"},zAttr:{dependencyType:"attributeComponent",attributeName:"z"},xsAttr:{dependencyType:"attributeComponent",attributeName:"xs"},displacementAttr:{dependencyType:"attributeComponent",attributeName:"displacement"},pointChild:{dependencyType:"child",childGroups:["points"]},vectorChild:{dependencyType:"child",childGroups:["vectors"]}}),definition({dependencyValues:ns}){let ss=null;return ns.vectorChild.length>0?ss="vectorChild":ns.pointChild.length>0?ss="pointChild":ns.displacementAttr!==null?ss="displacementAttr":ns.xsAttr!==null?ss="xsAttr":(ns.xAttr!==null||ns.yAttr!==null||ns.zAttr!==null)&&(ss="componentAttrs"),{setValue:{sourceOfDisplacement:ss}}}},rs.basedOnHead={returnDependencies:()=>({headAttr:{dependencyType:"attributeComponent",attributeName:"head"},headShadow:{dependencyType:"stateVariable",variableName:"headShadow"},tailAttr:{dependencyType:"attributeComponent",attributeName:"tail"},sourceOfDisplacement:{dependencyType:"stateVariable",variableName:"sourceOfDisplacement"}}),definition:function({dependencyValues:ns}){return ns.tailAttr!==null&&ns.sourceOfDisplacement!==null?(ns.headAttr!==null&&console.warn("Vector is prescribed by head, tail, and displacement. Ignoring specified head."),{setValue:{basedOnHead:!1},checkForActualChange:{basedOnHead:!0}}):ns.headAttr!==null?{setValue:{basedOnHead:!0},checkForActualChange:{basedOnHead:!0}}:{setValue:{basedOnHead:ns.headShadow!==null},checkForActualChange:{basedOnHead:!0}}}},rs.basedOnTail={returnDependencies:()=>({tailAttr:{dependencyType:"attributeComponent",attributeName:"tail"},tailShadow:{dependencyType:"stateVariable",variableName:"tailShadow"}}),definition:function({dependencyValues:ns}){return ns.tailAttr!==null?{setValue:{basedOnTail:!0},checkForActualChange:{basedOnTail:!0}}:{setValue:{basedOnTail:ns.tailShadow!==null},checkForActualChange:{basedOnTail:!0}}}},rs.basedOnDisplacement={returnDependencies:()=>({sourceOfDisplacement:{dependencyType:"stateVariable",variableName:"sourceOfDisplacement"},displacementShadow:{dependencyType:"stateVariable",variableName:"displacementShadow"}}),definition:function({dependencyValues:ns}){return ns.sourceOfDisplacement!==null?{setValue:{basedOnDisplacement:!0},checkForActualChange:{basedOnDisplacement:!0}}:{setValue:{basedOnDisplacement:ns.displacementShadow!==null},checkForActualChange:{basedOnDisplacement:!0}}}},rs.nDimDisplacement={stateVariablesDeterminingDependencies:["basedOnDisplacement","basedOnHead","basedOnTail"],returnDependencies({stateValues:ns}){let ss={basedOnHead:{dependencyType:"stateVariable",variableName:"basedOnHead"},basedOnTail:{dependencyType:"stateVariable",variableName:"basedOnTail"},basedOnDisplacement:{dependencyType:"stateVariable",variableName:"basedOnDisplacement"},sourceOfDisplacement:{dependencyType:"stateVariable",variableName:"sourceOfDisplacement"},displacementShadow:{dependencyType:"stateVariable",variableName:"displacementShadow"},displacementAttr:{dependencyType:"attributeComponent",attributeName:"displacement",variableNames:["nDimensions"]},vectorChild:{dependencyType:"child",childGroups:["vectors"],variableNames:["nDimensions"]},pointChild:{dependencyType:"child",childGroups:["points"],variableNames:["nDimensions"]},xAttr:{dependencyType:"attributeComponent",attributeName:"x"},yAttr:{dependencyType:"attributeComponent",attributeName:"y"},zAttr:{dependencyType:"attributeComponent",attributeName:"z"},xsAttr:{dependencyType:"attributeComponent",attributeName:"xs",variableNames:["nComponents"]}};return ns.basedOnDisplacement||(ns.basedOnHead&&(ss.nDimHead={dependencyType:"stateVariable",variableName:"nDimHead"}),ns.basedOnTail&&(ss.nDimTail={dependencyType:"stateVariable",variableName:"nDimTail"})),ss},definition:function({dependencyValues:ns}){let ss;if(ns.basedOnDisplacement)switch(ns.sourceOfDisplacement){case"vectorChild":ss=ns.vectorChild[0].stateValues.nDimensions;break;case"pointChild":ss=ns.pointChild[0].stateValues.nDimensions;break;case"displacementAttr":ss=ns.displacementAttr.stateValues.nDimensions;break;case"xsAttr":ss=ns.xsAttr.stateValues.nComponents;break;case"componentAttrs":ns.zAttr!==null?ss=3:ns.yAttr!==null?ss=2:ss=1;break;default:let os=ns.displacementShadow.tree;Array.isArray(os)&&vectorOperators.includes(os[0])?ss=os.length-1:ss=1}else ns.basedOnHead?ns.basedOnTail?ns.nDimHead===ns.nDimTail?ss=ns.nDimHead:ss=NaN:ss=ns.nDimHead:ns.basedOnTail?ss=ns.nDimTail:ss=2;return{setValue:{nDimDisplacement:ss},checkForActualChange:{nDimDisplacement:!0}}}},rs.nDimHead={stateVariablesDeterminingDependencies:["basedOnDisplacement","basedOnHead","basedOnTail"],returnDependencies({stateValues:ns}){let ss={basedOnHead:{dependencyType:"stateVariable",variableName:"basedOnHead"},basedOnTail:{dependencyType:"stateVariable",variableName:"basedOnTail"},basedOnDisplacement:{dependencyType:"stateVariable",variableName:"basedOnDisplacement"},headShadow:{dependencyType:"stateVariable",variableName:"headShadow"},headAttr:{dependencyType:"attributeComponent",attributeName:"head",variableNames:["nDimensions"]}};return ns.basedOnHead||(ns.basedOnTail&&(ss.nDimTail={dependencyType:"stateVariable",variableName:"nDimTail"}),ns.basedOnDisplacement&&(ss.nDimDisplacement={dependencyType:"stateVariable",variableName:"nDimDisplacement"})),ss},definition:function({dependencyValues:ns}){let ss;if(ns.basedOnHead){if(ns.headAttr!==null)ss=ns.headAttr.stateValues.nDimensions;else if(ns.headShadow){let os=ns.headShadow.tree;Array.isArray(os)&&vectorOperators.includes(os[0])?ss=os.length-1:ss=2}}else ns.basedOnDisplacement?ns.basedOnTail?ns.nDimDisplacement===ns.nDimTail?ss=ns.nDimDisplacement:ss=NaN:ss=ns.nDimDisplacement:ns.basedOnTail?ss=ns.nDimTail:ss=2;return{setValue:{nDimHead:ss},checkForActualChange:{nDimHead:!0}}}},rs.nDimTail={stateVariablesDeterminingDependencies:["basedOnDisplacement","basedOnHead","basedOnTail"],returnDependencies({stateValues:ns}){let ss={basedOnHead:{dependencyType:"stateVariable",variableName:"basedOnHead"},basedOnTail:{dependencyType:"stateVariable",variableName:"basedOnTail"},basedOnDisplacement:{dependencyType:"stateVariable",variableName:"basedOnDisplacement"},tailShadow:{dependencyType:"stateVariable",variableName:"tailShadow"},tailAttr:{dependencyType:"attributeComponent",attributeName:"tail",variableNames:["nDimensions"]}};return ns.basedOnTail||(ns.basedOnHead&&(ss.nDimHead={dependencyType:"stateVariable",variableName:"nDimHead"}),ns.basedOnDisplacement&&(ss.nDimDisplacement={dependencyType:"stateVariable",variableName:"nDimDisplacement"})),ss},definition:function({dependencyValues:ns}){let ss;if(ns.basedOnTail){if(ns.tailAttr!==null)ss=ns.tailAttr.stateValues.nDimensions;else if(ns.tailShadow){let os=ns.tailShadow.tree;Array.isArray(os)&&vectorOperators.includes(os[0])?ss=os.length-1:ss=2}}else ns.basedOnDisplacement?ns.basedOnHead?ns.nDimDisplacement===ns.nDimHead?ss=ns.nDimDisplacement:ss=NaN:ss=ns.nDimDisplacement:ns.basedOnHead?ss=ns.nDimHead:ss=2;return{setValue:{nDimTail:ss},checkForActualChange:{nDimTail:!0}}}},rs.nDimensions={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({basedOnHead:{dependencyType:"stateVariable",variableName:"basedOnHead"},basedOnTail:{dependencyType:"stateVariable",variableName:"basedOnTail"},basedOnDisplacement:{dependencyType:"stateVariable",variableName:"basedOnDisplacement"},nDimDisplacement:{dependencyType:"stateVariable",variableName:"nDimDisplacement"},nDimHead:{dependencyType:"stateVariable",variableName:"nDimHead"},nDimTail:{dependencyType:"stateVariable",variableName:"nDimTail"}}),definition:function({dependencyValues:ns}){let ss;if(ns.basedOnDisplacement){if(ns.basedOnTail){if(ns.nDimDisplacement!==ns.nDimTail)return console.warn("nDimensions mismatch in vector"),{setValue:{nDimensions:NaN}}}else if(ns.basedOnHead&&ns.nDimDisplacement!==ns.nDimHead)return console.warn("nDimensions mismatch in vector"),{setValue:{nDimensions:NaN}};ss=ns.nDimDisplacement}else if(ns.basedOnTail){if(ns.basedOnHead&&ns.nDimTail!==ns.nDimHead)return console.warn("nDimensions mismatch in vector"),{setValue:{nDimensions:NaN}};ss=ns.nDimTail}else ns.basedOnHead?ss=ns.nDimHead:ss=2;return{setValue:{nDimensions:ss},checkForActualChange:{nDimensions:!0}}}},rs.displacement={public:!0,shadowingInstructions:{createComponentOfType:"math",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros","displayWithAngleBrackets"],returnWrappingComponents(ns){return ns==="x"?[]:[["vector",{componentType:"mathList",isAttribute:"xs"}]]}},isArray:!0,entryPrefixes:["x"],hasEssential:!0,essentialVarName:"displacement2",set:convertValueToMathExpression,stateVariablesDeterminingDependencies:["basedOnDisplacement","basedOnHead","sourceOfDisplacement"],returnArraySizeDependencies:()=>({nDimDisplacement:{dependencyType:"stateVariable",variableName:"nDimDisplacement"}}),returnArraySize({dependencyValues:ns}){return[ns.nDimDisplacement]},returnArrayDependenciesByKey({arrayKeys:ns,stateValues:ss}){let os={basedOnHead:{dependencyType:"stateVariable",variableName:"basedOnHead"},basedOnTail:{dependencyType:"stateVariable",variableName:"basedOnTail"},basedOnDisplacement:{dependencyType:"stateVariable",variableName:"basedOnDisplacement"},displacementShadow:{dependencyType:"stateVariable",variableName:"displacementShadow"},sourceOfDisplacement:{dependencyType:"stateVariable",variableName:"sourceOfDisplacement"}},ls={};for(let us of ns){let cs=Number(us)+1;ls[us]={xsAttr:{dependencyType:"attributeComponent",attributeName:"xs",variableNames:["math"+cs]},displacementAttr:{dependencyType:"attributeComponent",attributeName:"displacement",variableNames:["x"+cs]},pointChild:{dependencyType:"child",childGroups:["points"],variableNames:["x"+cs]},vectorChild:{dependencyType:"child",childGroups:["vectors"],variableNames:["x"+cs]}},us==="0"?ls[us].componentAttr={dependencyType:"attributeComponent",attributeName:"x",variableNames:["value"]}:us==="1"?ls[us].componentAttr={dependencyType:"attributeComponent",attributeName:"y",variableNames:["value"]}:us==="2"&&(ls[us].componentAttr={dependencyType:"attributeComponent",attributeName:"z",variableNames:["value"]}),!ss.basedOnDisplacement&&ss.basedOnHead&&(ls[us].tailX={dependencyType:"stateVariable",variableName:"tailX"+cs},ls[us].headX={dependencyType:"stateVariable",variableName:"headX"+cs})}return{globalDependencies:os,dependenciesByKey:ls}},arrayDefinitionByKey:function({globalDependencyValues:ns,dependencyValuesByKey:ss,arrayKeys:os}){let ls={},us={};for(let ds of os){let ps=Number(ds)+1;if(ns.basedOnDisplacement)switch(ns.sourceOfDisplacement){case"vectorChild":ls[ds]=ss[ds].vectorChild[0].stateValues["x"+ps];break;case"pointChild":ls[ds]=ss[ds].pointChild[0].stateValues["x"+ps];break;case"displacementAttr":ls[ds]=ss[ds].displacementAttr.stateValues["x"+ps];break;case"xsAttr":ls[ds]=ss[ds].xsAttr.stateValues["math"+ps].simplify();break;case"componentAttrs":let fs=ss[ds].componentAttr;fs===null?us[ds]={defaultValue:Context.fromAst(0)}:ls[ds]=fs.stateValues.value.simplify();break;default:let hs=ns.displacementShadow.tree;Array.isArray(hs)&&vectorOperators.includes(hs[0])?ls[ds]=ns.displacementShadow.get_component(Number(ds)):ls[ds]=ns.displacementShadow}else ns.basedOnHead?ls[ds]=ss[ds].headX.subtract(ss[ds].tailX).simplify():us[ds]={defaultValue:Context.fromAst(ds==="0"?1:0)}}let cs={};return Object.keys(ls).length>0&&(cs.setValue={displacement:ls}),Object.keys(us).length>0&&(cs.useEssentialOrDefaultValue={displacement:us}),cs},inverseArrayDefinitionByKey({desiredStateVariableValues:ns,globalDependencyValues:ss,dependencyValuesByKey:os,dependencyNamesByKey:ls,arraySize:us}){let cs=[],ds=!1;for(let ps in ns.displacement)if(ss.basedOnDisplacement)switch(ss.sourceOfDisplacement){case"vectorChild":cs.push({setDependency:ls[ps].vectorChild,desiredValue:ns.displacement[ps],childIndex:0,variableIndex:0});break;case"pointChild":cs.push({setDependency:ls[ps].pointChild,desiredValue:ns.displacement[ps],childIndex:0,variableIndex:0});break;case"displacementAttr":cs.push({setDependency:ls[ps].displacementAttr,desiredValue:ns.displacement[ps],variableIndex:0});break;case"xsAttr":cs.push({setDependency:ls[ps].xsAttr,desiredValue:ns.displacement[ps],variableIndex:0});break;case"componentAttrs":os[ps].componentAttr===null?cs.push({setEssentialValue:"displacement",value:{[ps]:convertValueToMathExpression(ns.displacement[ps])}}):cs.push({setDependency:ls[ps].componentAttr,desiredValue:ns.displacement[ps],variableIndex:0});break;default:ds=!0}else ss.basedOnHead?cs.push({setDependency:ls[ps].headX,desiredValue:os[ps].tailX.add(ns.displacement[ps]).simplify()}):cs.push({setEssentialValue:"displacement",value:{[ps]:convertValueToMathExpression(ns.displacement[ps])}});if(ds)if(us[0]>1){let ps=["vector"];for(let fs in ns.displacement)ps[Number(fs)+1]=ns.displacement[fs].tree;ps.length=us[0]+1,cs.push({setDependency:"displacementShadow",desiredValue:Context.fromAst(ps)})}else us[0]===1&&"0"in ns.displacement&&cs.push({setDependency:"displacementShadow",desiredValue:ns.displacement[0]});return{success:!0,instructions:cs}}},rs.x={isAlias:!0,targetVariableName:"x1"},rs.y={isAlias:!0,targetVariableName:"x2"},rs.z={isAlias:!0,targetVariableName:"x3"},rs.head={public:!0,shadowingInstructions:{createComponentOfType:"math",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"],returnWrappingComponents(ns){return ns==="headX"?[]:[["point",{componentType:"mathList",isAttribute:"xs"}]]}},isArray:!0,entryPrefixes:["headX"],set:convertValueToMathExpression,stateVariablesDeterminingDependencies:["basedOnHead"],returnArraySizeDependencies:()=>({nDimHead:{dependencyType:"stateVariable",variableName:"nDimHead"}}),returnArraySize({dependencyValues:ns}){return[ns.nDimHead]},returnArrayDependenciesByKey({arrayKeys:ns,stateValues:ss}){let os={basedOnDisplacement:{dependencyType:"stateVariable",variableName:"basedOnDisplacement"},basedOnTail:{dependencyType:"stateVariable",variableName:"basedOnTail"},basedOnHead:{dependencyType:"stateVariable",variableName:"basedOnHead"},headShadow:{dependencyType:"stateVariable",variableName:"headShadow"}},ls={};for(let us of ns){let cs=Number(us)+1;ls[us]={headAttr:{dependencyType:"attributeComponent",attributeName:"head",variableNames:["x"+cs]}},ss.basedOnHead||(ls[us].tailX={dependencyType:"stateVariable",variableName:"tailX"+cs},ls[us].x={dependencyType:"stateVariable",variableName:"x"+cs})}return{globalDependencies:os,dependenciesByKey:ls}},arrayDefinitionByKey:function({globalDependencyValues:ns,dependencyValuesByKey:ss,arrayKeys:os}){let ls={};for(let us of os){let cs=Number(us)+1;ns.basedOnHead?ss[us].headAttr!==null?ls[us]=ss[us].headAttr.stateValues["x"+cs]:ns.headShadow!==null&&(ls[us]=ns.headShadow.get_component(Number(us))):ls[us]=ss[us].tailX.add(ss[us].x).simplify()}return{setValue:{head:ls}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ns,globalDependencyValues:ss,dependencyValuesByKey:os,dependencyNamesByKey:ls,arraySize:us}){let cs=[],ds=!1;for(let ps in ns.head)ss.basedOnHead?os[ps].headAttr&&os[ps].headAttr!==null?cs.push({setDependency:ls[ps].headAttr,desiredValue:ns.head[ps],variableIndex:0}):ss.headShadow!==null&&(ds=!0):cs.push({setDependency:ls[ps].x,desiredValue:ns.head[ps].subtract(os[ps].tailX).simplify()});if(ds)if(us[0]>1){let ps=["vector"];for(let fs in ns.head)ps[Number(fs)+1]=ns.head[fs].tree;ps.length=us[0]+1,cs.push({setDependency:"headShadow",desiredValue:Context.fromAst(ps)})}else us[0]===1&&"0"in ns.head&&cs.push({setDependency:"headShadow",desiredValue:ns.head[0]});return{success:!0,instructions:cs}}},rs.tail={public:!0,shadowingInstructions:{createComponentOfType:"math",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"],returnWrappingComponents(ns){return ns==="tailX"?[]:[["point",{componentType:"mathList",isAttribute:"xs"}]]}},isArray:!0,entryPrefixes:["tailX"],hasEssential:!0,defaultValueByArrayKey:()=>Context.fromAst(0),essentialVarName:"tail2",set:convertValueToMathExpression,stateVariablesDeterminingDependencies:["basedOnTail","basedOnHead","basedOnDisplacement"],returnArraySizeDependencies:()=>({nDimTail:{dependencyType:"stateVariable",variableName:"nDimTail"}}),returnArraySize({dependencyValues:ns}){return[ns.nDimTail]},returnArrayDependenciesByKey({arrayKeys:ns,stateValues:ss}){let os={basedOnDisplacement:{dependencyType:"stateVariable",variableName:"basedOnDisplacement"},basedOnHead:{dependencyType:"stateVariable",variableName:"basedOnHead"},tailShadow:{dependencyType:"stateVariable",variableName:"tailShadow"}},ls={};for(let us of ns){let cs=Number(us)+1;ls[us]={tailAttr:{dependencyType:"attributeComponent",attributeName:"tail",variableNames:["x"+cs]}},ss.basedOnTail||ss.basedOnHead&&ss.basedOnDisplacement&&(ls[us].headX={dependencyType:"stateVariable",variableName:"headX"+cs},ls[us].x={dependencyType:"stateVariable",variableName:"x"+cs})}return{globalDependencies:os,dependenciesByKey:ls}},arrayDefinitionByKey:function({globalDependencyValues:ns,dependencyValuesByKey:ss,arrayKeys:os}){let ls={},us={};for(let ds of os){let ps=Number(ds)+1;ss[ds].tailAttr!==null?ls[ds]=ss[ds].tailAttr.stateValues["x"+ps]:ns.tailShadow!==null?ls[ds]=ns.tailShadow.get_component(Number(ds)):ns.basedOnHead&&ns.basedOnDisplacement?ls[ds]=ss[ds].headX.subtract(ss[ds].x).simplify():us[ds]=!0}let cs={};return Object.keys(ls).length>0&&(cs.setValue={tail:ls}),Object.keys(us).length>0&&(cs.useEssentialOrDefaultValue={tail:us}),cs},inverseArrayDefinitionByKey({desiredStateVariableValues:ns,globalDependencyValues:ss,dependencyValuesByKey:os,dependencyNamesByKey:ls,arraySize:us}){let cs=[],ds=!1;for(let ps in ns.tail)os[ps].tailAttr&&os[ps].tailAttr!==null?cs.push({setDependency:ls[ps].tailAttr,desiredValue:ns.tail[ps],variableIndex:0}):ss.tailShadow!==null?ds=!0:ss.basedOnHead&&ss.basedOnDisplacement?cs.push({setDependency:ls[ps].x,desiredValue:os[ps].headX.subtract(ns.tail[ps]).simplify()}):cs.push({setEssentialValue:"tail",value:{[ps]:convertValueToMathExpression(ns.tail[ps])}});if(ds)if(us[0]>1){let ps=["vector"];for(let fs in ns.tail)ps[Number(fs)+1]=ns.tail[fs].tree;ps.length=us[0]+1,cs.push({setDependency:"tailShadow",desiredValue:Context.fromAst(ps)})}else us[0]===1&&"0"in ns.tail&&cs.push({setDependency:"tailShadow",desiredValue:ns.tail[0]});return{success:!0,instructions:cs}}},rs.magnitude={public:!0,shadowingInstructions:{createComponentOfType:"math"},returnDependencies:()=>({nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"},displacement:{dependencyType:"stateVariable",variableName:"displacement"}}),definition({dependencyValues:ns}){let ss=0,os=!0;for(let ls=0;lsfs/cs);let ds=ns.magnitude.evaluate_to_constant();if(!Number.isFinite(ds)||ds<0)return{success:!1};let ps=[];for(let fs=0;fs({head:{dependencyType:"stateVariable",variableName:"head"},tail:{dependencyType:"stateVariable",variableName:"tail"},nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"}}),definition:function({dependencyValues:ns}){let ss,os;if(ns.nDimensions===1)ss=ns.head[0].evaluate_to_constant(),os=ns.tail[0].evaluate_to_constant();else{ss=[],os=[];for(let ls=0;ls({displacement:{dependencyType:"stateVariable",variableName:"displacement"},displayWithAngleBrackets:{dependencyType:"stateVariable",variableName:"displayWithAngleBrackets"}}),definition({dependencyValues:ns}){let ss=[];for(let os of ns.displacement)os?ss.push(os.tree):ss.push("_");return ss.length>1?ss=[ns.displayWithAngleBrackets?"altvector":"vector",...ss]:ss.length===1?ss=ss[0]:ss="_",{setValue:{displacementCoords:Context.fromAst(ss)}}},inverseDefinition({desiredStateVariableValues:ns}){let ss=ns.displacementCoords.tree,os;return Array.isArray(ss)&&vectorOperators.includes(ss[0])?os=ss.slice(1).map(ls=>Context.fromAst(ls)):os=[ns.displacementCoords],{success:!0,instructions:[{setDependency:"displacement",desiredValue:os}]}}},rs.latex={forRenderer:!0,public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({displacementCoords:{dependencyType:"stateVariable",variableName:"displacementCoords"},displayDigits:{dependencyType:"stateVariable",variableName:"displayDigits"},displayDecimals:{dependencyType:"stateVariable",variableName:"displayDecimals"},displaySmallAsZero:{dependencyType:"stateVariable",variableName:"displaySmallAsZero"},padZeros:{dependencyType:"stateVariable",variableName:"padZeros"}}),definition:function({dependencyValues:ns,usedDefault:ss}){let os={};return ns.padZeros&&(ss.displayDigits&&!ss.displayDecimals?Number.isFinite(ns.displayDecimals)&&(os.padToDecimals=ns.displayDecimals):ns.displayDigits>=1&&(os.padToDigits=ns.displayDigits)),{setValue:{latex:roundForDisplay({value:ns.displacementCoords,dependencyValues:ns,usedDefault:ss}).toLatex(os)}}}},rs.nearestPoint={returnDependencies:()=>({nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"},numericalEndpoints:{dependencyType:"stateVariable",variableName:"numericalEndpoints"}}),definition({dependencyValues:ns}){var ps,fs,hs,gs;let ss=(ps=ns.numericalEndpoints[0])==null?void 0:ps[0],os=(fs=ns.numericalEndpoints[0])==null?void 0:fs[1],ls=(hs=ns.numericalEndpoints[1])==null?void 0:hs[0],us=(gs=ns.numericalEndpoints[1])==null?void 0:gs[1],cs=Number.isFinite(ss)&&Number.isFinite(os)&&Number.isFinite(ls)&&Number.isFinite(us),ds=ns.nDimensions!==2||!cs||ls===ss&&us===os;return{setValue:{nearestPoint:function({variables:ys,scales:bs}){if(ds)return{};let vs=bs[0],xs=bs[1],Cs=(ls-ss)/vs,Ts=(us-os)/xs,Ss=Cs*Cs+Ts*Ts,Ns=((ys.x1-ss)/vs*Cs+(ys.x2-os)/xs*Ts)/Ss,As={};return Ns<=0?As={x1:ss,x2:os}:Ns>=1?As={x1:ls,x2:us}:As={x1:ss+Ns*Cs*vs,x2:os+Ns*Ts*xs},ys.x3!==void 0&&(As.x3=0),As}}}}},rs}async moveVector({tailcoords:rs,headcoords:ns,transient:ss,skippable:os,sourceDetails:ls,actionId:us,sourceInformation:cs={},skipRendererUpdate:ds=!1}){if(rs!==void 0){if(ns!==void 0){if(!await this.stateValues.draggable)return await this.coreFunctions.resolveAction({actionId:us})}else if(!await this.stateValues.tailDraggable)return await this.coreFunctions.resolveAction({actionId:us})}else if(!await this.stateValues.headDraggable)return await this.coreFunctions.resolveAction({actionId:us});let ps=[];if(rs!==void 0){if(await this.stateValues.basedOnHead&&await this.stateValues.basedOnDisplacement){let fs;if(ns===void 0){let hs=await this.stateValues.numericalEndpoints;fs=rs.map((gs,ys)=>hs[1][ys]-gs)}else fs=rs.map((hs,gs)=>ns[gs]-hs);ps.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"displacement",value:fs.map(hs=>Context.fromAst(hs)),sourceDetails:ls})}else ps.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"tail",value:rs.map(fs=>Context.fromAst(fs)),sourceDetails:ls});if(ns===void 0&&!await this.stateValues.basedOnHead){let fs=await this.stateValues.numericalEndpoints,hs=rs.map((gs,ys)=>fs[1][ys]-gs);ps.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"displacement",value:hs.map(gs=>Context.fromAst(gs)),sourceDetails:ls})}}if(ns!==void 0){if(await this.stateValues.basedOnHead)ps.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"head",value:ns.map(fs=>Context.fromAst(fs)),sourceDetails:ls});else{rs==null&&(rs=(await this.stateValues.numericalEndpoints)[0]);let fs=rs.map((hs,gs)=>ns[gs]-hs);ps.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"displacement",value:fs.map(hs=>Context.fromAst(hs)),sourceDetails:ls})}if(rs===void 0&&await this.stateValues.basedOnHead&&await this.stateValues.basedOnDisplacement){let fs=await this.stateValues.numericalEndpoints,hs=ns.map((gs,ys)=>gs-fs[0][ys]);ps.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"displacement",value:hs.map(gs=>Context.fromAst(gs)),sourceDetails:ls})}}return ss?await this.coreFunctions.performUpdate({updateInstructions:ps,transient:ss,skippable:os,actionId:us,sourceInformation:cs,skipRendererUpdate:ds}):await this.coreFunctions.performUpdate({updateInstructions:ps,actionId:us,sourceInformation:cs,skipRendererUpdate:ds,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{head:ns,tail:rs}}})}async vectorClicked({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){await this.coreFunctions.triggerChainedActions({triggeringAction:"click",componentName:this.componentName,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss}),this.coreFunctions.resolveAction({actionId:rs})}async mouseDownOnVector({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){await this.coreFunctions.triggerChainedActions({triggeringAction:"down",componentName:this.componentName,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss}),this.coreFunctions.resolveAction({actionId:rs})}}zs(Vector,"componentType","vector"),zs(Vector,"primaryStateVariableForDefinition","displacementShadow"),zs(Vector,"adapters",[{stateVariable:"displacementCoords",componentType:"coords",stateVariablesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"]}]);class Angle extends GraphicalComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.draggable={createComponentOfType:"boolean",createStateVariable:"draggable",defaultValue:!0,public:!0,forRenderer:!0},rs.radius={createComponentOfType:"math",createStateVariable:"radius",defaultValue:Context.fromAst(1),public:!0},rs.chooseReflexAngle={createComponentOfType:"text",createStateVariable:"chooseReflexAngle",defaultValue:"never",public:!0,forRenderer:!0,toLowerCase:!0,validValues:["never","allowed","always"]},rs.inDegrees={createComponentOfType:"boolean",createStateVariable:"inDegrees",defaultValue:!1,public:!0,forRenderer:!0},rs.radians={createComponentOfType:"math"},rs.degrees={createComponentOfType:"math"},rs.through={createComponentOfType:"_pointListComponent"},rs.betweenLines={createComponentOfType:"_lineListComponent"},rs.displayDigits={createComponentOfType:"integer"},rs.displayDecimals={createComponentOfType:"integer",createStateVariable:"displayDecimals",defaultValue:null,public:!0},rs.displaySmallAsZero={createComponentOfType:"number",createStateVariable:"displaySmallAsZero",valueForTrue:1e-14,valueForFalse:0,defaultValue:0,public:!0},rs.padZeros={createComponentOfType:"boolean",createStateVariable:"padZeros",defaultValue:!1,public:!0},rs.emphasizeRightAngle={createComponentOfType:"boolean",createStateVariable:"emphasizeRightAngle",defaultValue:!0,public:!0,forRenderer:!0},rs}static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=function({matchedChildren:ss,componentInfoObjects:os}){let ls=ps=>os.componentIsSpecifiedType(ps,"label"),us=ss.map(ls),cs=[],ds=[];if(us.filter(ps=>ps).length===0)cs=ss;else{if(us[0]){let fs=us.indexOf(!1);fs!==-1&&(ds.push(...ss.slice(0,fs)),ss=ss.slice(fs),us=us.slice(fs))}let ps=us.indexOf(!0);ps===-1?cs=ss:(cs=ss.slice(0,ps),ds.push(...ss.slice(ps)))}return cs.length===0?{success:!1}:{success:!0,newAttributes:{radians:{component:{componentType:"math",children:cs}}},newChildren:ds}};return rs.push({replacementFunction:ns}),rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.displayDigits={public:!0,shadowingInstructions:{createComponentOfType:"integer"},hasEssential:!0,defaultValue:10,returnDependencies:()=>({displayDigitsAttr:{dependencyType:"attributeComponent",attributeName:"displayDigits",variableNames:["value"]},displayDecimalsAttr:{dependencyType:"attributeComponent",attributeName:"displayDecimals",variableNames:["value"]}}),definition({dependencyValues:ns,usedDefault:ss}){if(ns.displayDigitsAttr!==null){let os=ss.displayDigitsAttr,ls=ns.displayDecimalsAttr===null||ss.displayDecimalsAttr;if(!(os||ls)){let us=ns.displayDigitsAttr.shadowDepth;ns.displayDecimalsAttr.shadowDepth({betweenLines:{dependencyType:"attributeComponent",attributeName:"betweenLines"}}),definition({dependencyValues:ns}){let ss=null;return ns.betweenLines!==null&&(ss=ns.betweenLines.componentName),{setValue:{betweenLinesName:ss}}}},rs.nPointsSpecified={returnDependencies:()=>({through:{dependencyType:"attributeComponent",attributeName:"through",variableNames:["nPoints"]}}),definition({dependencyValues:ns}){return ns.through!==null?{setValue:{nPointsSpecified:ns.through.stateValues.nPoints}}:{setValue:{nPointsSpecified:0}}}},rs.points={isArray:!0,nDimensions:2,entryPrefixes:["pointX","point"],stateVariablesDeterminingDependencies:["betweenLinesName"],returnArraySizeDependencies:()=>({}),returnArraySize(){return[3,2]},getArrayKeysFromVarName({arrayEntryPrefix:ns,varEnding:ss,arraySize:os}){if(ns==="pointX"){let ls=ss.split("_").map(us=>Number(us)-1);return ls.length===2&&ls.every((us,cs)=>Number.isInteger(us)&&us>=0)?os?ls.every((us,cs)=>us=0?os?lsls+","+cs):[]:[ls+",0"]:[]}},returnArrayDependenciesByKey({stateValues:ns}){let ss={nPointsSpecified:{dependencyType:"stateVariable",variableName:"nPointsSpecified"},throughAttr:{dependencyType:"attributeComponent",attributeName:"through",variableNames:["points"]},radiansAttr:{dependencyType:"attributeComponent",attributeName:"radians",variableNames:["value"]},degreesAttr:{dependencyType:"attributeComponent",attributeName:"degrees",variableNames:["value"]}};return ns.betweenLinesName!==null&&(ss.lineChildren={dependencyType:"child",parentName:ns.betweenLinesName,childGroups:["lines"],variableNames:["points","nDimensions","coeff0","coeffvar1","coeffvar2","nearestPoint"]}),{globalDependencies:ss}},arrayDefinitionByKey({globalDependencyValues:ns}){if(ns.lineChildren)if(ns.lineChildren.length>2){console.warn(`Cannot define an angle between ${ns.lineChildren.length} line(s)`);let us={};for(let cs=0;cs<3;cs++)for(let ds=0;ds<2;ds++)us[cs+","+ds]=Context.fromAst("_");return{setValue:{points:us}}}else if(ns.lineChildren.length===1){let us=ns.lineChildren[0];if(us.stateValues.nDimensions!==2){let xs={};for(let Cs=0;Cs<3;Cs++)for(let Ts=0;Ts<2;Ts++)xs[Cs+","+Ts]=Context.fromAst("_");return{setValue:{points:xs}}}let cs=us.stateValues.nearestPoint({variables:{x1:Context.fromAst(0),x2:Context.fromAst(0)}}),ds=us.stateValues.points[0][0].evaluate_to_constant(),ps=us.stateValues.points[0][1].evaluate_to_constant(),fs=us.stateValues.points[1][0].evaluate_to_constant(),hs=us.stateValues.points[1][1].evaluate_to_constant(),gs=Math.atan2(hs-ps,fs-ds),ys={"0,0":Context.fromAst(cs.x1+Math.cos(gs)),"0,1":Context.fromAst(cs.x2+Math.sin(gs)),"1,0":Context.fromAst(cs.x1),"1,1":Context.fromAst(cs.x2)},bs=null;if(ns.radiansAttr){if(bs=ns.radiansAttr.stateValues.value.evaluate_to_constant(),!Number.isFinite(bs)){let xs={};return xs["2,0"]=Context.fromAst("_"),xs["2,1"]=Context.fromAst("_"),{setValue:{points:xs}}}}else if(ns.degreesAttr){let xs=ns.degreesAttr.stateValues.value.evaluate_to_constant();if(Number.isFinite(xs))bs=xs/180*Math.PI;else return ys["2,0"]=Context.fromAst("_"),ys["2,1"]=Context.fromAst("_"),{setValue:{points:ys}}}else bs=Math.PI/2;let vs=gs+bs;return ys["2,0"]=Context.fromAst(cs.x1+Math.cos(vs)),ys["2,1"]=Context.fromAst(cs.x2+Math.sin(vs)),{setValue:{points:ys}}}else{let us=ns.lineChildren[0],cs=ns.lineChildren[1],ds=calculateLineIntersection(us,cs);if(ds===void 0){let xs={};for(let Cs=0;Cs<3;Cs++)for(let Ts=0;Ts<2;Ts++)xs[Cs+","+Ts]=Context.fromAst("_");return{setValue:{points:xs}}}let ps=ds,fs=us.stateValues.points[0][0].evaluate_to_constant(),hs=us.stateValues.points[0][1].evaluate_to_constant(),gs=us.stateValues.points[1][0].evaluate_to_constant(),ys=us.stateValues.points[1][1].evaluate_to_constant(),bs=[Context.fromAst(ps[0].tree+gs-fs),Context.fromAst(ps[1].tree+ys-hs)];fs=cs.stateValues.points[0][0].evaluate_to_constant(),hs=cs.stateValues.points[0][1].evaluate_to_constant(),gs=cs.stateValues.points[1][0].evaluate_to_constant(),ys=cs.stateValues.points[1][1].evaluate_to_constant();let vs=[Context.fromAst(ps[0].tree+gs-fs),Context.fromAst(ps[1].tree+ys-hs)];return{setValue:{points:{"0,0":bs[0],"0,1":bs[1],"1,0":ps[0],"1,1":ps[1],"2,0":vs[0],"2,1":vs[1]}}}}let ss=ns.nPointsSpecified,os;ns.throughAttr?os=ns.throughAttr.stateValues.points:os=[];let ls={};for(let[us,cs]of os.entries())ls[us+",0"]=cs[0],ls[us+",1"]=cs[1];if(ss===0&&(ls["0,0"]=Context.fromAst(1),ls["0,1"]=Context.fromAst(0)),ss<2&&(ls["1,0"]=Context.fromAst(0),ls["1,1"]=Context.fromAst(0)),ss<3){let us=null;if(ns.radiansAttr){if(us=ns.radiansAttr.stateValues.value.evaluate_to_constant(),!Number.isFinite(us))return ls["2,0"]=Context.fromAst("_"),ls["2,1"]=Context.fromAst("_"),{setValue:{points:ls}}}else if(ns.degreesAttr){let ys=ns.degreesAttr.stateValues.value.evaluate_to_constant();if(Number.isFinite(ys))us=ys/180*Math.PI;else return ls["2,0"]=Context.fromAst("_"),ls["2,1"]=Context.fromAst("_"),{setValue:{points:ls}}}else us=Math.PI/2;let cs=ls["0,0"].evaluate_to_constant(),ds=ls["0,1"].evaluate_to_constant(),ps=ls["1,0"].evaluate_to_constant(),fs=ls["1,1"].evaluate_to_constant(),gs=Math.atan2(ds-fs,cs-ps)+us;ls["2,0"]=Context.fromAst(ps+Math.cos(gs)),ls["2,1"]=Context.fromAst(fs+Math.sin(gs))}return{setValue:{points:ls}}}},rs.radians={public:!0,shadowingInstructions:{createComponentOfType:"math",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"]},additionalStateVariablesDefined:[{variableName:"swapPointOrder",forRenderer:!0}],returnDependencies:()=>({radians:{dependencyType:"attributeComponent",attributeName:"radians",variableNames:["value"]},degrees:{dependencyType:"attributeComponent",attributeName:"degrees",variableNames:["value"]},points:{dependencyType:"stateVariable",variableName:"points"},chooseReflexAngle:{dependencyType:"stateVariable",variableName:"chooseReflexAngle"}}),definition({dependencyValues:ns}){let ss=!1;if(ns.radians!==null)return{setValue:{radians:ns.radians.stateValues.value.simplify(),swapPointOrder:ss}};if(ns.degrees!==null)return{setValue:{radians:ns.degrees.stateValues.value.divide(Context.fromAst(180)).simplify().multiply(Context.fromAst("pi")).simplify(),swapPointOrder:ss}};let os=[],ls=!1;for(let cs=0;cs<3;cs++)os.push([ns.points[cs][0].evaluate_to_constant(),ns.points[cs][1].evaluate_to_constant()]),(Number.isNaN(os[cs][0])||Number.isNaN(os[cs][1]))&&(ls=!0);let us;return ls?{setValue:{radians:Context.fromAst("_"),swapPointOrder:ss}}:(us=Math.atan2(os[2][1]-os[1][1],os[2][0]-os[1][0])-Math.atan2(os[0][1]-os[1][1],os[0][0]-os[1][0]),us<0&&(us+=2*Math.PI),us>Math.PI?ns.chooseReflexAngle==="never"&&(us=2*Math.PI-us,ss=!0):ns.chooseReflexAngle==="always"&&(us=2*Math.PI-us,ss=!0),{setValue:{radians:Context.fromAst(us),swapPointOrder:ss}})}},rs.value={isAlias:!0,targetVariableName:"radians"},rs.angle={isAlias:!0,targetVariableName:"radians"},rs.degrees={public:!0,shadowingInstructions:{createComponentOfType:"math",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero","padZeros"]},returnDependencies:()=>({radians:{dependencyType:"stateVariable",variableName:"radians"}}),definition({dependencyValues:ns}){let ss;if(ns.radians.tree==="_"||Number.isNaN(ns.radians.tree))ss=ns.radians;else{let os=ns.radians.evaluate_to_constant();Number.isFinite(os)?ss=Context.fromAst(os*180/Math.PI):ss=ns.radians.multiply(Context.fromAst(["/",180,"pi"])).simplify()}return{setValue:{degrees:ss}}}},rs.latexForRenderer={forRenderer:!0,returnDependencies:()=>({inDegrees:{dependencyType:"stateVariable",variableName:"inDegrees"},radians:{dependencyType:"stateVariable",variableName:"radians"},degrees:{dependencyType:"stateVariable",variableName:"degrees"},displayDigits:{dependencyType:"stateVariable",variableName:"displayDigits"},displayDecimals:{dependencyType:"stateVariable",variableName:"displayDecimals"},displaySmallAsZero:{dependencyType:"stateVariable",variableName:"displaySmallAsZero"},padZeros:{dependencyType:"stateVariable",variableName:"padZeros"}}),definition:function({dependencyValues:ns,usedDefault:ss}){let os={};ns.padZeros&&(ss.displayDigits&&!ss.displayDecimals?Number.isFinite(ns.displayDecimals)&&(os.padToDecimals=ns.displayDecimals):ns.displayDigits>=1&&(os.padToDigits=ns.displayDigits));let ls=ns.inDegrees?ns.degrees:ns.radians,us=roundForDisplay({value:ls,dependencyValues:ns,usedDefault:ss}).toLatex(os);return ns.inDegrees&&(us+="^\\circ"),{setValue:{latexForRenderer:us}}}},rs.numericalPoints={isArray:!0,entryPrefixes:["numericalPoint"],forRenderer:!0,returnArraySizeDependencies:()=>({}),returnArraySize(){return[3]},returnArrayDependenciesByKey({arrayKeys:ns}){let ss={};for(let os of ns)ss[os]={point:{dependencyType:"stateVariable",variableName:"point"+(Number(os)+1)}};return{dependenciesByKey:ss}},arrayDefinitionByKey({dependencyValuesByKey:ns,arrayKeys:ss}){let os={};for(let ls of ss){let us=ns[ls].point,cs=[];for(let ds=0;ds<2;ds++){let ps=us[ds].evaluate_to_constant();cs.push(ps)}os[ls]=cs}return{setValue:{numericalPoints:os}}}},rs.numericalRadius={forRenderer:!0,returnDependencies:()=>({radius:{dependencyType:"stateVariable",variableName:"radius"}}),definition({dependencyValues:ns}){return{setValue:{numericalRadius:ns.radius.evaluate_to_constant()}}}},rs}}zs(Angle,"componentType","angle"),zs(Angle,"adapters",["radians"]);function calculateLineIntersection(as,rs){if(as.stateValues.nDimensions!==2||rs.stateValues.nDimensions!==2){console.log("Calculating angle between two lines implemented only in 2D");return}let ns=as.stateValues.coeffvar1.evaluate_to_constant(),ss=as.stateValues.coeffvar2.evaluate_to_constant(),os=as.stateValues.coeff0.evaluate_to_constant(),ls=rs.stateValues.coeffvar1.evaluate_to_constant(),us=rs.stateValues.coeffvar2.evaluate_to_constant(),cs=rs.stateValues.coeff0.evaluate_to_constant();if(!(Number.isFinite(ns)&&Number.isFinite(ss)&&Number.isFinite(os)&&Number.isFinite(ls)&&Number.isFinite(us)&&Number.isFinite(cs))){console.log("Calculating angle between two lines implemented only for constant coefficients");return}let ds=ns*us-ls*ss;if(Math.abs(ds)<1e-14)if(Math.abs(cs*ns-os*ls)>1e-14){console.log("Cannot calculate angle between two parallel lines");return}else return ns===0&&ss===0&&os===0||ls===0&&us===0&&cs===0?void 0:ss!==0?[Context.fromAst(0),Context.fromAst(-os/ss)]:[Context.fromAst(-os/ns),Context.fromAst(0)];let ps=(cs*ss-os*us)/ds,fs=(os*ls-cs*ns)/ds;return[Context.fromAst(ps),Context.fromAst(fs)]}var defaults$1={space:"",cycles:!1,replacer:(as,rs)=>rs,stringify:JSON.stringify},util$1={isArray:Array.isArray,assign:Object.assign,isObject:as=>typeof as=="object",isFunction:as=>typeof as=="function",isBoolean:as=>typeof as=="boolean",isRegex:as=>as instanceof RegExp,keys:Object.keys};const DEFAULTS=defaults$1,isFunction$1=util$1.isFunction,isBoolean$1=util$1.isBoolean,isObject$2=util$1.isObject,isArray$1=util$1.isArray,isRegex=util$1.isRegex,assign$1=util$1.assign,keys$1=util$1.keys;function serialize(as){return as==null?as:isRegex(as)?as.toString():as.toJSON?as.toJSON():as}function stringifyDeterministic(as,rs){rs=rs||assign$1({},DEFAULTS),isFunction$1(rs)&&(rs={compare:rs});const ns=rs.space||DEFAULTS.space,ss=isBoolean$1(rs.cycles)?rs.cycles:DEFAULTS.cycles,os=rs.replacer||DEFAULTS.replacer,ls=rs.stringify||DEFAULTS.stringify,us=rs.compare&&function(ds){return function(ps){return function(fs,hs){const gs={key:fs,value:ps[fs]},ys={key:hs,value:ps[hs]};return ds(gs,ys)}}}(rs.compare);ss||ls(as);const cs=[];return function ds(ps,fs,hs,gs){const ys=ns?` @@ -2750,7 +2750,7 @@ Make sure that all grammar rule definitions are done before 'performSelfAnalysis `,WIN32:`\r `};lineEndings.LINE_ENDINGS=LINE_ENDINGS;var generator={},util={},capitalize={};(function(as){Object.defineProperty(as,"__esModule",{value:!0}),as.default=void 0;var rs=function(os){var ls=os.trim();return ls.charAt(0).toUpperCase()+ls.slice(1)},ns=rs;as.default=ns})(capitalize);var isNodeExports={},isNode={get exports(){return isNodeExports},set exports(as){isNodeExports=as}};(function(as,rs){Object.defineProperty(rs,"__esModule",{value:!0}),rs.default=void 0;var ns=function(){return!!as.exports},ss=ns;rs.default=ss})(isNode,isNodeExports);var isReactNative={};(function(as){Object.defineProperty(as,"__esModule",{value:!0}),as.default=void 0;var rs=function(){var os=!1;try{os=navigator.product==="ReactNative"}catch{os=!1}return os},ns=rs;as.default=ns})(isReactNative);var isWindows={},platforms={};Object.defineProperty(platforms,"__esModule",{value:!0});platforms.SUPPORTED_PLATFORMS=void 0;var SUPPORTED_PLATFORMS={DARWIN:"darwin",LINUX:"linux",WIN32:"win32"};platforms.SUPPORTED_PLATFORMS=SUPPORTED_PLATFORMS;(function(as){Object.defineProperty(as,"__esModule",{value:!0}),as.default=void 0;var rs=platforms,ns=function(){var ls=!1;try{ls=browser$1$2.platform===rs.SUPPORTED_PLATFORMS.WIN32}catch{ls=!1}return ls},ss=ns;as.default=ss})(isWindows);var makeArrayOfLength={};(function(as){Object.defineProperty(as,"__esModule",{value:!0}),as.default=void 0;var rs=function(){var os=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return Array.apply(null,Array(os)).map(function(ls,us){return us})},ns=rs;as.default=ns})(makeArrayOfLength);var makeArrayOfStrings={};(function(as){Object.defineProperty(as,"__esModule",{value:!0}),as.default=void 0;var rs=ns(makeArrayOfLength);function ns(ls){return ls&&ls.__esModule?ls:{default:ls}}var ss=function(us,cs){var ds=(0,rs.default)(us);return ds.map(function(){return cs()})},os=ss;as.default=os})(makeArrayOfStrings);(function(as){Object.defineProperty(as,"__esModule",{value:!0}),Object.defineProperty(as,"capitalize",{enumerable:!0,get:function(){return rs.default}}),Object.defineProperty(as,"isNode",{enumerable:!0,get:function(){return ns.default}}),Object.defineProperty(as,"isReactNative",{enumerable:!0,get:function(){return ss.default}}),Object.defineProperty(as,"isWindows",{enumerable:!0,get:function(){return os.default}}),Object.defineProperty(as,"makeArrayOfLength",{enumerable:!0,get:function(){return ls.default}}),Object.defineProperty(as,"makeArrayOfStrings",{enumerable:!0,get:function(){return us.default}});var rs=cs(capitalize),ns=cs(isNodeExports),ss=cs(isReactNative),os=cs(isWindows),ls=cs(makeArrayOfLength),us=cs(makeArrayOfStrings);function cs(ds){return ds&&ds.__esModule?ds:{default:ds}}})(util);(function(as){Object.defineProperty(as,"__esModule",{value:!0}),as.default=void 0;var rs=words,ns=util;function ss(ps,fs){if(!(ps instanceof fs))throw new TypeError("Cannot call a class as a function")}function os(ps,fs){for(var hs=0;hs0&&arguments[0]!==void 0?arguments[0]:{},hs=fs.sentencesPerParagraph,gs=hs===void 0?{max:7,min:3}:hs,ys=fs.wordsPerSentence,bs=ys===void 0?{max:15,min:5}:ys,vs=fs.random;fs.seed;var xs=fs.words,Cs=xs===void 0?rs.WORDS:xs;if(ss(this,ps),us(this,"sentencesPerParagraph",void 0),us(this,"wordsPerSentence",void 0),us(this,"random",void 0),us(this,"words",void 0),gs.min>gs.max)throw new Error("Minimum number of sentences per paragraph (".concat(gs.min,") cannot exceed maximum (").concat(gs.max,")."));if(bs.min>bs.max)throw new Error("Minimum number of words per sentence (".concat(bs.min,") cannot exceed maximum (").concat(bs.max,")."));this.sentencesPerParagraph=gs,this.words=Cs,this.wordsPerSentence=bs,this.random=vs||Math.random}return ls(ps,[{key:"generateRandomInteger",value:function(hs,gs){return Math.floor(this.random()*(gs-hs+1)+hs)}},{key:"generateRandomWords",value:function(hs){var gs=this,ys=this.wordsPerSentence,bs=ys.min,vs=ys.max,xs=hs||this.generateRandomInteger(bs,vs);return(0,ns.makeArrayOfLength)(xs).reduce(function(Cs,Ts){return"".concat(gs.pluckRandomWord()," ").concat(Cs)},"").trim()}},{key:"generateRandomSentence",value:function(hs){return"".concat((0,ns.capitalize)(this.generateRandomWords(hs)),".")}},{key:"generateRandomParagraph",value:function(hs){var gs=this,ys=this.sentencesPerParagraph,bs=ys.min,vs=ys.max,xs=hs||this.generateRandomInteger(bs,vs);return(0,ns.makeArrayOfLength)(xs).reduce(function(Cs,Ts){return"".concat(gs.generateRandomSentence()," ").concat(Cs)},"").trim()}},{key:"pluckRandomWord",value:function(){var hs=0,gs=this.words.length-1,ys=this.generateRandomInteger(hs,gs);return this.words[ys]}}]),ps}(),ds=cs;as.default=ds})(generator);(function(as){Object.defineProperty(as,"__esModule",{value:!0}),as.default=void 0;var rs=formats,ns=lineEndings,ss=ls(generator),os=util;function ls(gs){return gs&&gs.__esModule?gs:{default:gs}}function us(gs,ys){if(!(gs instanceof ys))throw new TypeError("Cannot call a class as a function")}function cs(gs,ys){for(var bs=0;bs0&&arguments[0]!==void 0?arguments[0]:{},bs=arguments.length>1&&arguments[1]!==void 0?arguments[1]:rs.FORMAT_PLAIN,vs=arguments.length>2?arguments[2]:void 0;if(us(this,gs),this.format=bs,this.suffix=vs,ps(this,"generator",void 0),rs.FORMATS.indexOf(bs.toLowerCase())===-1)throw new Error("".concat(bs," is an invalid format. Please use ").concat(rs.FORMATS.join(" or "),"."));this.generator=new ss.default(ys)}return ds(gs,[{key:"getLineEnding",value:function(){return this.suffix?this.suffix:!(0,os.isReactNative)()&&(0,os.isNode)()&&(0,os.isWindows)()?ns.LINE_ENDINGS.WIN32:ns.LINE_ENDINGS.POSIX}},{key:"formatString",value:function(bs){return this.format===rs.FORMAT_HTML?"

".concat(bs,"

"):bs}},{key:"formatStrings",value:function(bs){var vs=this;return bs.map(function(xs){return vs.formatString(xs)})}},{key:"generateWords",value:function(bs){return this.formatString(this.generator.generateRandomWords(bs))}},{key:"generateSentences",value:function(bs){return this.formatString(this.generator.generateRandomParagraph(bs))}},{key:"generateParagraphs",value:function(bs){var vs=this.generator.generateRandomParagraph.bind(this.generator);return this.formatStrings((0,os.makeArrayOfStrings)(bs,vs)).join(this.getLineEnding())}}]),gs}(),hs=fs;as.default=hs})(LoremIpsum);(function(as){Object.defineProperty(as,"__esModule",{value:!0}),Object.defineProperty(as,"LoremIpsum",{enumerable:!0,get:function(){return os.default}}),as.loremIpsum=void 0;var rs=formats,ns=units,ss=words,os=ls(LoremIpsum);function ls(cs){return cs&&cs.__esModule?cs:{default:cs}}var us=function(){var ds=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ps=ds.count,fs=ps===void 0?1:ps,hs=ds.format,gs=hs===void 0?rs.FORMAT_PLAIN:hs,ys=ds.paragraphLowerBound,bs=ys===void 0?3:ys,vs=ds.paragraphUpperBound,xs=vs===void 0?7:vs,Cs=ds.random,Ts=ds.sentenceLowerBound,Ss=Ts===void 0?5:Ts,Ns=ds.sentenceUpperBound,As=Ns===void 0?15:Ns,ws=ds.units,Es=ws===void 0?ns.UNIT_SENTENCES:ws,_s=ds.words,$s=_s===void 0?ss.WORDS:_s,Rs=ds.suffix,Is=Rs===void 0?"":Rs,Os={random:Cs,sentencesPerParagraph:{max:xs,min:bs},words:$s,wordsPerSentence:{max:As,min:Ss}},Ds=new os.default(Os,gs,Is);switch(Es){case ns.UNIT_PARAGRAPHS:case ns.UNIT_PARAGRAPH:return Ds.generateParagraphs(fs);case ns.UNIT_SENTENCES:case ns.UNIT_SENTENCE:return Ds.generateSentences(fs);case ns.UNIT_WORDS:case ns.UNIT_WORD:return Ds.generateWords(fs);default:return""}};as.loremIpsum=us})(dist);class Lorem extends CompositeComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.minSentencesPerParagraph={createComponentOfType:"number",createStateVariable:"minSentencesPerParagraph",defaultValue:4,public:!0},rs.maxSentencesPerParagraph={createComponentOfType:"number",createStateVariable:"maxSentencesPerParagraph",defaultValue:8,public:!0},rs.minWordsPerSentence={createComponentOfType:"number",createStateVariable:"minWordsPerSentence",defaultValue:4,public:!0},rs.maxWordsPerSentence={createComponentOfType:"number",createStateVariable:"maxWordsPerSentence",defaultValue:8,public:!0},rs.generateWords={createComponentOfType:"number",createStateVariable:"generateWords",defaultValue:null},rs.generateSentences={createComponentOfType:"number",createStateVariable:"generateSentences",defaultValue:null},rs.generateParagraphs={createComponentOfType:"number",createStateVariable:"generateParagraphs",defaultValue:null},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.readyToExpandWhenResolved={returnDependencies:()=>({minSentencesPerParagraph:{dependencyType:"stateVariable",variableName:"minSentencesPerParagraph"},maxSentencesPerParagraph:{dependencyType:"stateVariable",variableName:"maxSentencesPerParagraph"},minWordsPerSentence:{dependencyType:"stateVariable",variableName:"minWordsPerSentence"},maxWordsPerSentence:{dependencyType:"stateVariable",variableName:"maxWordsPerSentence"},generateWords:{dependencyType:"stateVariable",variableName:"generateWords"},generateSentences:{dependencyType:"stateVariable",variableName:"generateSentences"},generateParagraphs:{dependencyType:"stateVariable",variableName:"generateParagraphs"}}),markStale:()=>({updateReplacements:!0}),definition(){return{setValue:{readyToExpandWhenResolved:!0}}}},rs.isVariantComponent={returnDependencies:()=>({}),definition:()=>({setValue:{isVariantComponent:!0}})},rs.generatedVariantInfo={returnDependencies:({sharedParameters:ns,componentInfoObjects:ss})=>({variantSeed:{dependencyType:"value",value:ns.variantSeed}}),definition({dependencyValues:ns,componentName:ss}){return{setValue:{generatedVariantInfo:{seed:ns.variantSeed,meta:{createdBy:ss}}}}}},rs}static async createSerializedReplacements({component:rs,componentInfoObjects:ns}){var cs;const ss=new dist.LoremIpsum({sentencesPerParagraph:{max:await rs.stateValues.maxSentencesPerParagraph,min:await rs.stateValues.minSentencesPerParagraph},wordsPerSentence:{max:await rs.stateValues.maxWordsPerSentence,min:await rs.stateValues.minWordsPerSentence},random:rs.sharedParameters.variantRng});let os=[];if(await rs.stateValues.generateParagraphs!==null){let ds=await rs.stateValues.generateParagraphs;Number.isInteger(ds)&&ds>0&&(os=ss.generateParagraphs(ds).split(` `).map(fs=>({componentType:"p",children:[fs]})))}else if(await rs.stateValues.generateSentences!==null){let ds=await rs.stateValues.generateSentences;if(Number.isInteger(ds)&&ds>0){let ps=ss.generateSentences(ds).split(". ");for(let fs of ps.slice(0,ps.length-1))os.push({componentType:"text",children:[fs+"."]}),os.push(" ");os.push({componentType:"text",children:[ps[ps.length-1]]})}}else if(await rs.stateValues.generateWords!==null){let ds=await rs.stateValues.generateWords;if(Number.isInteger(ds)&&ds>0){let ps=ss.generateWords(ds).split(" ").map(fs=>({componentType:"text",children:[fs]}));os.push(ps[0]);for(let fs of ps.slice(1))os.push(" "),os.push(fs)}}let ls=(cs=rs.attributes.newNamespace)==null?void 0:cs.primitive;return{replacements:processAssignNames({assignNames:rs.doenetAttributes.assignNames,serializedComponents:os,parentName:rs.componentName,parentCreatesNewNamespace:ls,componentInfoObjects:ns}).serializedComponents}}static async calculateReplacementChanges({component:rs,componentInfoObjects:ns}){let ss=await this.createSerializedReplacements({component:rs,componentInfoObjects:ns});return[{changeType:"add",changeTopLevelReplacements:!0,firstReplacementInd:0,numberReplacementsToReplace:rs.replacements.length,serializedReplacements:ss.replacements}]}static setUpVariant({serializedComponent:rs,sharedParameters:ns,descendantVariantComponents:ss}){setUpVariantSeedAndRng({serializedComponent:rs,sharedParameters:ns,descendantVariantComponents:ss})}}zs(Lorem,"componentType","lorem"),zs(Lorem,"assignNamesToReplacements",!0),zs(Lorem,"createsVariants",!0),zs(Lorem,"stateVariableToEvaluateAfterReplacements","readyToExpandWhenResolved");function returnStandardTriggeringAttributes(as){return{triggerWhen:{createComponentOfType:"boolean",createStateVariable:"triggerWhen",defaultValue:!1,triggerActionOnChange:as},triggerWith:{createTargetComponentNames:!0},triggerWhenObjectsClicked:{createTargetComponentNames:!0},triggerWhenObjectsFocused:{createTargetComponentNames:!0}}}function addStandardTriggeringStateVariableDefinitions(as,rs){as.insideTriggerSet={returnDependencies:()=>({parentTriggerSet:{dependencyType:"parentStateVariable",parentComponentType:"triggerSet",variableName:"updateValueAndActionsToTrigger"}}),definition({dependencyValues:os}){return{setValue:{insideTriggerSet:os.parentTriggerSet!==null}}}},as.triggerWith={returnDependencies:()=>({triggerWith:{dependencyType:"attributeTargetComponentNames",attributeName:"triggerWith"},triggerWhenObjectsClicked:{dependencyType:"attributeTargetComponentNames",attributeName:"triggerWhenObjectsClicked"},triggerWhenObjectsFocused:{dependencyType:"attributeTargetComponentNames",attributeName:"triggerWhenObjectsFocused"},triggerWhen:{dependencyType:"attributeComponent",attributeName:"triggerWhen"},insideTriggerSet:{dependencyType:"stateVariable",variableName:"insideTriggerSet"}}),definition({dependencyValues:os}){if(os.triggerWhen||os.insideTriggerSet)return{setValue:{triggerWith:null}};{let ls=[];if(os.triggerWith!==null)for(let us of os.triggerWith)ls.push({target:us.absoluteName});if(os.triggerWhenObjectsClicked!==null)for(let us of os.triggerWhenObjectsClicked)ls.push({target:us.absoluteName,triggeringAction:"click"});if(os.triggerWhenObjectsFocused!==null)for(let us of os.triggerWhenObjectsFocused)ls.push({target:us.absoluteName,triggeringAction:"down"});return ls.length===0&&(ls=null),{setValue:{triggerWith:ls}}}}},as.triggerWithTargetIds={chainActionOnActionOfStateVariableTargets:{triggeredAction:rs},returnDependencies:()=>({triggerWith:{dependencyType:"stateVariable",variableName:"triggerWith"}}),definition({dependencyValues:os}){let ls=[];if(os.triggerWith)for(let us of os.triggerWith){let cs=us.target;us.triggeringAction&&(cs+="|"+us.triggeringAction),ls.includes(cs)||ls.push(cs)}return{setValue:{triggerWithTargetIds:ls}}},markStale(){return{updateActionChaining:!0}}};let ns=as.hidden.returnDependencies,ss=as.hidden.definition;as.hidden.returnDependencies=function(os){let ls=ns(os);return ls.triggerWhen={dependencyType:"attributeComponent",attributeName:"triggerWhen"},ls.triggerWith={dependencyType:"stateVariable",variableName:"triggerWith"},ls.insideTriggerSet={dependencyType:"stateVariable",variableName:"insideTriggerSet"},ls},as.hidden.definition=function(os){return os.dependencyValues.triggerWhen||os.dependencyValues.triggerWith||os.dependencyValues.insideTriggerSet?{setValue:{hidden:!0}}:ss(os)}}class UpdateValue extends InlineComponent{constructor(rs){super(rs),Object.assign(this.actions,{updateValue:this.updateValue.bind(this),updateValueIfTriggerNewlyTrue:this.updateValueIfTriggerNewlyTrue.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();rs.labelIsName={createComponentOfType:"boolean",createStateVariable:"labelIsName",defaultValue:!1,public:!0},rs.type={createPrimitiveOfType:"string",createStateVariable:"type",defaultPrimitiveValue:"math",toLowerCase:!0,validValues:["math","number","boolean","text"]},rs.prop={createPrimitiveOfType:"string"},rs.newValue={createComponentOfType:"_componentWithSelectableType"},rs.componentIndex={createComponentOfType:"integer",createStateVariable:"componentIndex",defaultValue:null,public:!0},rs.propIndex={createComponentOfType:"numberList",createStateVariable:"propIndex",defaultValue:null,public:!0};let ns=returnStandardTriggeringAttributes("updateValueIfTriggerNewlyTrue");return Object.assign(rs,ns),rs.simplify={createComponentOfType:"text",createStateVariable:"simplify",defaultValue:"none",public:!0,toLowerCase:!0,valueTransformations:{"":"full",true:"full",false:"none"},validValues:["none","full","numbers","numberspreserveorder"]},rs}static returnChildGroups(){return[{group:"labels",componentTypes:["label"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();addStandardTriggeringStateVariableDefinitions(rs,"updateValue");let ns=returnLabelStateVariableDefinitions();return Object.assign(rs,ns),rs.target={returnDependencies:()=>({target:{dependencyType:"doenetAttribute",attributeName:"target"}}),definition:({dependencyValues:ss})=>({setValue:{target:ss.target}})},rs.targetComponent={returnDependencies(){return{targetComponent:{dependencyType:"targetComponent"}}},definition:function({dependencyValues:ss}){let os=null;return ss.targetComponent&&(os=ss.targetComponent),{setValue:{targetComponent:os}}}},rs.propName={returnDependencies:()=>({propName:{dependencyType:"attributePrimitive",attributeName:"prop"}}),definition:function({dependencyValues:ss}){return{setValue:{propName:ss.propName}}}},rs.targetIdentities={stateVariablesDeterminingDependencies:["targetComponent","componentIndex"],returnDependencies:function({stateValues:ss,componentInfoObjects:os}){let ls={};return ss.targetComponent!==null&&(os.isCompositeComponent({componentType:ss.targetComponent.componentType,includeNonStandard:!1})?ls.targets={dependencyType:"replacement",compositeName:ss.targetComponent.componentName,recursive:!0,componentIndex:ss.componentIndex}:(ss.componentIndex===null||ss.componentIndex===1)&&(ls.targets={dependencyType:"stateVariable",variableName:"targetComponent"})),ls},definition({dependencyValues:ss}){let os=null;return ss.targets&&(os=ss.targets,Array.isArray(os)||(os=[os])),{setValue:{targetIdentities:os}}}},rs.targets={stateVariablesDeterminingDependencies:["targetIdentities","propName","propIndex"],returnDependencies:function({stateValues:ss}){let os={targetIdentities:{dependencyType:"stateVariable",variableName:"targetIdentities"}};if(ss.targetIdentities!==null)for(let[ls,us]of ss.targetIdentities.entries()){let cs;if(ss.propName){let ds=ss.propIndex;ds&&(ds=[...ds]),cs={dependencyType:"stateVariable",componentName:us.componentName,variableName:ss.propName,returnAsComponentObject:!0,variablesOptional:!0,propIndex:ds,caseInsensitiveVariableMatch:!0,publicStateVariablesOnly:!0,useMappedVariableNames:!0}}else cs={dependencyType:"componentIdentity",componentName:us.componentName};os["target"+ls]=cs}return os},definition({dependencyValues:ss}){let os=null;if(ss.targetIdentities!==null){os=[];for(let ls in ss.targetIdentities)ss["target"+ls]&&os.push(ss["target"+ls])}return{setValue:{targets:os}}}},rs.newValue={returnDependencies:()=>({newValueAttr:{dependencyType:"attributeComponent",attributeName:"newValue",variableNames:["value"]},type:{dependencyType:"stateVariable",variableName:"type"},simplify:{dependencyType:"stateVariable",variableName:"simplify"}}),definition:function({dependencyValues:ss}){if(ss.newValueAttr===null)return{setValue:{newValue:null}};let os=ss.newValueAttr.stateValues.value;return ss.type==="math"&&(os=normalizeMathExpression({value:os,simplify:ss.simplify})),{setValue:{newValue:os}}}},rs}async updateValue({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){let os=await this.stateValues.targets,ls=await this.stateValues.newValue;if(os===null||ls===null)return;let us=[];for(let cs of os){let ds="value";if(cs.stateValues&&(ds=Object.keys(cs.stateValues)[0],ds===void 0)){console.warn(`Cannot update prop="${await this.stateValues.propName}" of ${await this.stateValues.target} as could not find prop ${await this.stateValues.propName} on a component of type ${cs.componentType}`);continue}us.push({updateType:"updateValue",componentName:cs.componentName,stateVariable:ds,value:ls})}return await this.coreFunctions.performUpdate({updateInstructions:us,actionId:rs,sourceInformation:ns,skipRendererUpdate:!0,event:{verb:"selected",object:{componentName:this.componentName,componentType:this.componentType},result:{response:ls,responseText:ls.toString()}}}),await this.coreFunctions.triggerChainedActions({componentName:this.componentName,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss})}async updateValueIfTriggerNewlyTrue({stateValues:rs,previousValues:ns,actionId:ss}){if(await rs.triggerWhen&&ns.triggerWhen===!1&&!await this.stateValues.insideTriggerSet)return await this.updateValue({actionId:ss,skipRendererUpdate:!0});this.coreFunctions.resolveAction({actionId:ss})}}zs(UpdateValue,"componentType","updateValue"),zs(UpdateValue,"acceptTarget",!0);class CallAction extends InlineComponent{constructor(rs){super(rs),Object.assign(this.actions,{callAction:this.callAction.bind(this),callActionIfTriggerNewlyTrue:this.callActionIfTriggerNewlyTrue.bind(this)})}static keepChildrenSerialized({serializedComponent:rs,componentInfoObjects:ns}){if(rs.children===void 0)return[];{let ss=[];for(let[os,ls]of rs.children.entries())ns.componentIsSpecifiedType(ls,"label")||ss.push(os);return ss}}static createAttributesObject(){let rs=super.createAttributesObject();rs.labelIsName={createComponentOfType:"boolean",createStateVariable:"labelIsName",defaultValue:!1,public:!0},rs.actionName={createComponentOfType:"text",createStateVariable:"actionName",defaultValue:null,public:!0};let ns=returnStandardTriggeringAttributes("callActionIfTriggerNewlyTrue");return Object.assign(rs,ns),rs.numbers={createComponentOfType:"numberList"},rs.number={createComponentOfType:"number"},rs}static returnChildGroups(){return[{group:"labels",componentTypes:["label"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();addStandardTriggeringStateVariableDefinitions(rs,"callAction");let ns=returnLabelStateVariableDefinitions();return Object.assign(rs,ns),rs.target={returnDependencies:()=>({target:{dependencyType:"doenetAttribute",attributeName:"target"}}),definition:({dependencyValues:ss})=>({setValue:{target:ss.target}})},rs.targetComponent={returnDependencies(){return{targetComponent:{dependencyType:"targetComponent"}}},definition:function({dependencyValues:ss}){let os=null;return ss.targetComponent&&(os=ss.targetComponent),{setValue:{targetComponent:os}}}},rs.targetName={returnDependencies:()=>({targetComponent:{dependencyType:"stateVariable",variableName:"targetComponent"}}),definition({dependencyValues:ss}){let os=null;return ss.targetComponent&&(os=ss.targetComponent.componentName),{setValue:{targetName:os}}}},rs}async callAction({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){let os=await this.stateValues.targetName,ls=await this.stateValues.actionName;if(os!==null&&ls!==null){let us={sourceInformation:ns,skipRendererUpdate:!0};this.serializedChildren.length>0&&(us.serializedComponents=deepClone(this.serializedChildren)),this.attributes.number&&(us.number=await this.attributes.number.component.stateValues.value),this.attributes.numbers&&(us.numbers=await this.attributes.numbers.component.stateValues.numbers),rs&&(us.actionId=rs),await this.coreFunctions.performAction({componentName:os,actionName:ls,args:us,event:{verb:"selected",object:{componentName:this.componentName,componentType:this.componentType}},caseInsensitiveMatch:!0}),await this.coreFunctions.triggerChainedActions({componentName:this.componentName,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss})}else this.coreFunctions.resolveAction({actionId:rs})}async callActionIfTriggerNewlyTrue({stateValues:rs,previousValues:ns,actionId:ss}){if(rs.triggerWhen&&ns.triggerWhen===!1&&!await this.stateValues.insideTriggerSet)return await this.callAction({actionId:ss});this.coreFunctions.resolveAction({actionId:ss})}}zs(CallAction,"componentType","callAction"),zs(CallAction,"acceptTarget",!0);class triggerSet extends InlineComponent{constructor(rs){super(rs),Object.assign(this.actions,{triggerActions:this.triggerActions.bind(this),triggerActionsIfTriggerNewlyTrue:this.triggerActionsIfTriggerNewlyTrue.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();rs.labelIsName={createComponentOfType:"boolean",createStateVariable:"labelIsName",defaultValue:!1,public:!0};let ns=returnStandardTriggeringAttributes("triggerActionsIfTriggerNewlyTrue");return Object.assign(rs,ns),rs}static returnChildGroups(){return[{group:"updateValuesCallActions",componentTypes:["updateValue","callAction"]},{group:"labels",componentTypes:["label"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();addStandardTriggeringStateVariableDefinitions(rs,"triggerActions");let ns=returnLabelStateVariableDefinitions();return Object.assign(rs,ns),rs.updateValueAndActionsToTrigger={returnDependencies:()=>({updateValueAndCallActionChildren:{dependencyType:"child",childGroups:["updateValuesCallActions"]}}),definition({dependencyValues:ss}){return{setValue:{updateValueAndActionsToTrigger:ss.updateValueAndCallActionChildren}}}},rs}async triggerActions({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){for(let os of await this.stateValues.updateValueAndActionsToTrigger)this.componentInfoObjects.isInheritedComponentType({inheritedComponentType:os.componentType,baseComponentType:"updateValue"})?await this.coreFunctions.performAction({componentName:os.componentName,actionName:"updateValue",args:{actionId:rs,sourceInformation:ns,skipRendererUpdate:!0}}):this.componentInfoObjects.isInheritedComponentType({inheritedComponentType:os.componentType,baseComponentType:"callAction"})&&await this.coreFunctions.performAction({componentName:os.componentName,actionName:"callAction",args:{actionId:rs,sourceInformation:ns,skipRendererUpdate:!0}});return this.coreFunctions.resolveAction({actionId:rs}),await this.coreFunctions.triggerChainedActions({componentName:this.componentName,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss})}async triggerActionsIfTriggerNewlyTrue({stateValues:rs,previousValues:ns,actionId:ss}){if(rs.triggerWhen&&ns.triggerWhen===!1)return await this.triggerActions({actionId:ss,skipRendererUpdate:!0});this.coreFunctions.resolveAction({actionId:ss})}}zs(triggerSet,"componentType","triggerSet");class FunctionIterates extends InlineComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.nIterates={createComponentOfType:"integer",createStateVariable:"nIterates",defaultValue:0,public:!0},rs.forceSymbolic={createComponentOfType:"boolean",createStateVariable:"forceSymbolic",defaultValue:!1,public:!0},rs.forceNumeric={createComponentOfType:"boolean",createStateVariable:"forceNumeric",defaultValue:!1,public:!0},rs.initialValue={createComponentOfType:"math",createStateVariable:"initialValue",defaultValue:Context.fromAst("_")},rs.function={createComponentOfType:"function"},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.nDimensions={public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies:()=>({functionAttr:{dependencyType:"attributeComponent",attributeName:"function",variableNames:["nInputs","nOutputs"]}}),definition({dependencyValues:ns}){return ns.functionAttr?ns.functionAttr.stateValues.nInputs!==ns.functionAttr.stateValues.nOutputs?(console.warn("Function iterates are possible only if the number of inputs is equal to the number of outputs"),{setValue:{nDimensions:0}}):{setValue:{nDimensions:ns.functionAttr.stateValues.nInputs}}:{setValue:{nDimensions:0}}}},rs.allIterates={public:!0,shadowingInstructions:{createComponentOfType:"mathList"},returnDependencies:()=>({functionAttr:{dependencyType:"attributeComponent",attributeName:"function",variableNames:["symbolicfs","numericalfs","symbolic"]},forceSymbolic:{dependencyType:"stateVariable",variableName:"forceSymbolic"},forceNumeric:{dependencyType:"stateVariable",variableName:"forceNumeric"},nDimensions:{dependencyType:"stateVariable",variableName:"nDimensions"},initialValue:{dependencyType:"stateVariable",variableName:"initialValue"},nIterates:{dependencyType:"stateVariable",variableName:"nIterates"}}),definition({dependencyValues:ns}){let ss=[],os=ns.functionAttr,ls=ns.initialValue,us=!ns.forceNumeric&&(os.stateValues.symbolic||ns.forceSymbolic),cs=ns.nIterates;if(!os||ns.nDimensions===0||!(ns.nDimensions===1||Array.isArray(ls.tree)&&vectorOperators.includes(ls.tree[0])&&ls.tree.length===ns.nDimensions+1))return ss=Array(cs).fill(Context.fromAst("_")),{setValue:{allIterates:ss}};if(us)if(ns.nDimensions===1){let ds=os.stateValues.symbolicfs[0],ps=ls;for(let fs=0;fsContext.fromAst(fs).evaluate_to_constant());for(let fs=0;fs({initialValue:{dependencyType:"stateVariable",variableName:"initialValue"},allIterates:{dependencyType:"stateVariable",variableName:"allIterates"}}),definition({dependencyValues:ns}){return{setValue:{allIteratesWithInitial:[ns.initialValue,...ns.allIterates]}}}},rs.iterates={isArray:!0,public:!0,shadowingInstructions:{createComponentOfType:"math"},entryPrefixes:["iterate"],returnArraySizeDependencies:()=>({nIterates:{dependencyType:"stateVariable",variableName:"nIterates"}}),returnArraySize({dependencyValues:ns}){return[ns.nIterates]},returnArrayDependenciesByKey(){return{globalDependencies:{allIterates:{dependencyType:"stateVariable",variableName:"allIterates"}}}},arrayDefinitionByKey({globalDependencyValues:ns,arraySize:ss}){let os={};for(let ls=0;ls0?{finalIterate:{dependencyType:"stateVariable",variableName:`iterate${ns.nIterates}`}}:{finalIterate:{dependencyType:"stateVariable",variableName:"initialValue"}}},definition({dependencyValues:ns}){return{setValue:{finalIterate:ns.finalIterate}}}},rs}}zs(FunctionIterates,"componentType","functionIterates"),zs(FunctionIterates,"rendererType");class Module extends Template{static createAttributesObject(){let rs=super.createAttributesObject();return delete rs.styleNumber,rs}}zs(Module,"componentType","module"),zs(Module,"renderedDefault",!0),zs(Module,"acceptAnyAttribute",!0);class CustomAttribute extends CompositeComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.componentType={createPrimitiveOfType:"string"},rs.attribute={createPrimitiveOfType:"string"},rs.defaultValue={leaveRaw:!0},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.componentNameForAttributes={returnDependencies:()=>({parentVariableContainingName:{dependencyType:"parentStateVariable",variableName:"componentNameForAttributes"}}),definition({dependencyValues:ns}){return{setValue:{componentNameForAttributes:ns.parentVariableContainingName}}}},rs.attributeName={returnDependencies:()=>({attribute:{dependencyType:"attributePrimitive",attributeName:"attribute"}}),definition({dependencyValues:ns}){return{setValue:{attributeName:ns.attribute}}}},rs.readyToExpandWhenResolved={stateVariablesDeterminingDependencies:["componentNameForAttributes"],returnDependencies:({stateValues:ns})=>({componentIdentity:{dependencyType:"componentIdentity",componentName:ns.componentNameForAttributes}}),definition(){return{setValue:{readyToExpandWhenResolved:!0}}}},rs}static async createSerializedReplacements({component:rs,components:ns,workspace:ss,componentInfoObjects:os,flags:ls}){var Ss;let us=(Ss=rs.attributes.newNamespace)==null?void 0:Ss.primitive,cs=os.componentTypeLowerCaseMapping[rs.attributes.componentType.primitive.toLowerCase()];if(!os.allComponentClasses[cs])return console.warn(`Could not find component type ${cs}`),{replacements:[]};let ps=ns[await rs.stateValues.componentNameForAttributes],fs={};for(let Ns in ps.attributes)fs[Ns.toLowerCase()]=Ns;let hs=await rs.stateValues.attributeName,gs=fs[hs.toLowerCase()],ys=ps.attributes[gs];if(ys===void 0){if(rs.attributes.defaultValue===void 0)return console.warn("Cannot create component from attribute if neither attribute nor default value specified"),{replacements:[]};ys=rs.attributes.defaultValue}let bs=ps.constructor,vs=Object.keys(bs.createAttributesObject()).map(Ns=>Ns.toLowerCase());if(vs.push("name","target","assignnames"),vs.includes(hs.toLowerCase()))return console.warn(`Cannot add attribute ${hs} of a ${bs.componentType} as it already exists in ${bs.componentType} class`),{replacements:[]};let Cs=componentFromAttribute({attrObj:{createComponentOfType:cs},value:ys,componentInfoObjects:os}).component;if(Cs.children&&(applyMacros(Cs.children,os),us)){for(let Ns of Cs.children)if(Ns.componentType==="copy"){let As=Ns.doenetAttributes.target;/[a-zA-Z_]/.test(As[0])&&(Ns.doenetAttributes.target="../"+As)}}return applySugar({serializedComponents:[Cs],isAttributeComponent:!0,componentInfoObjects:os}),setTNamesToAbsolute([Cs]),{replacements:processAssignNames({assignNames:rs.doenetAttributes.assignNames,serializedComponents:[Cs],parentName:rs.componentName,parentCreatesNewNamespace:us,componentInfoObjects:os}).serializedComponents}}}zs(CustomAttribute,"componentType","customAttribute"),zs(CustomAttribute,"assignNamesToReplacements",!0);class Setup extends CompositeComponent{static returnChildGroups(){return[{group:"styleDefinitions",componentTypes:["styleDefinitions"]},{group:"feedbackDefinitions",componentTypes:["feedbackDefinitions"]},{group:"anything",componentTypes:["_base"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.componentNameForAttributes={returnDependencies:()=>({sourceCompositeIdentity:{dependencyType:"sourceCompositeIdentity"}}),definition({dependencyValues:ns}){let ss=null;return ns.sourceCompositeIdentity&&(ss=ns.sourceCompositeIdentity.componentName),{setValue:{componentNameForAttributes:ss}}}},rs.readyToExpandWhenResolved={returnDependencies:()=>({}),definition(){return{setValue:{readyToExpandWhenResolved:!0}}}},rs}}zs(Setup,"componentType","setup");class Footnote extends InlineComponent{static returnChildGroups(){return[{group:"inlines",componentTypes:["_inline"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},forRenderer:!0,returnDependencies:()=>({inlineChildren:{dependencyType:"child",childGroups:["inlines"],variableNames:["text"],variablesOptional:!0}}),definition:function({dependencyValues:ns}){let ss="";for(let os of ns.inlineChildren)typeof os!="object"?ss+=os.toString():typeof os.stateValues.text=="string"?ss+=os.stateValues.text:ss+=" ";return{setValue:{text:ss}}}},rs.footnoteTag={public:!0,shadowingInstructions:{createComponentOfType:"text"},forRenderer:!0,returnDependencies:()=>({footnoteCounter:{dependencyType:"counter",counterName:"footnote"}}),definition({dependencyValues:ns}){return{setValue:{footnoteTag:String(ns.footnoteCounter)}}}},rs}}zs(Footnote,"componentType","footnote"),zs(Footnote,"renderChildren",!0),zs(Footnote,"includeBlankStringChildren",!0);class Caption extends BlockComponent{constructor(rs){super(rs),Object.assign(this.actions,{recordVisibilityChange:this.recordVisibilityChange.bind(this)})}static returnChildGroups(){return[{group:"inlinesBlocks",componentTypes:["_inline","_block"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({inlineChildren:{dependencyType:"child",childGroups:["inlinesBlocks"],variableNames:["text"],variablesOptional:!0}}),definition:function({dependencyValues:ns}){let ss="";for(let os of ns.inlineChildren)typeof os!="object"?ss+=os.toString():typeof os.stateValues.text=="string"?ss+=os.stateValues.text:ss+=" ";return{setValue:{text:ss}}}},rs}recordVisibilityChange({isVisible:rs,actionId:ns}){this.coreFunctions.requestRecordEvent({verb:"visibilityChanged",object:{componentName:this.componentName,componentType:this.componentType},result:{isVisible:rs}}),this.coreFunctions.resolveAction({actionId:ns})}}zs(Caption,"componentType","caption"),zs(Caption,"rendererType","containerInline"),zs(Caption,"renderChildren",!0),zs(Caption,"includeBlankStringChildren",!0);class Endpoint extends Point{static createAttributesObject(){let rs=super.createAttributesObject();return rs.open={createComponentOfType:"boolean",createStateVariable:"open",defaultValue:!1,public:!0,forRenderer:!0},rs.switchable={createComponentOfType:"boolean",createStateVariable:"switchable",defaultValue:!1,public:!0,forRenderer:!0},rs}async switchPoint({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){if(await this.stateValues.switchable)return await this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"open",value:!await this.stateValues.open}],actionId:rs,sourceInformation:ns,skipRendererUpdate:ss,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{open:!await this.stateValues.open}}});this.coreFunctions.resolveAction({actionId:rs})}}zs(Endpoint,"componentType","endpoint"),zs(Endpoint,"rendererType","point");class Sort extends CompositeComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.assignNamesSkip={createPrimitiveOfType:"number"},rs.sortVectorsBy={createComponentOfType:"text",createStateVariable:"sortVectorsBy",defaultValue:"displacement",public:!0,toLowerCase:!0,validValues:["displacement","tail"]},rs.sortByComponent={createComponentOfType:"integer",createStateVariable:"sortByComponent",defaultValue:"1",public:!0},rs.sortByProp={createPrimitiveOfType:"string"},rs}static returnChildGroups(){return[{group:"anything",componentTypes:["_base"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.propName={returnDependencies:()=>({propName:{dependencyType:"attributePrimitive",attributeName:"sortByProp"}}),definition:function({dependencyValues:ns}){return{setValue:{propName:ns.propName}}}},rs.componentNamesForValues={returnDependencies:()=>({children:{dependencyType:"child",childGroups:["anything"],variableNames:["componentNamesInList"],variablesOptional:!0}}),definition({dependencyValues:ns}){let ss=[];for(let os of ns.children)os.stateValues.componentNamesInList?ss.push(...os.stateValues.componentNamesInList):ss.push(os.componentName);return{setValue:{componentNamesForValues:ss}}}},rs.sortedValues={stateVariablesDeterminingDependencies:["componentNamesForValues","sortByComponent","propName"],returnDependencies({stateValues:ns}){let ss={sortVectorsBy:{dependencyType:"stateVariable",variableName:"sortVectorsBy"},sortByComponent:{dependencyType:"stateVariable",variableName:"sortByComponent"},propName:{dependencyType:"stateVariable",variableName:"propName"}};if(ns.propName)for(let[os,ls]of ns.componentNamesForValues.entries())ss[`component${os}`]={dependencyType:"stateVariable",componentName:ls,variableName:ns.propName,variablesOptional:!0,caseInsensitiveVariableMatch:!0,publicStateVariablesOnly:!0,returnAsComponentObject:!0};else for(let[os,ls]of ns.componentNamesForValues.entries())ss[`component${os}`]={dependencyType:"multipleStateVariables",componentName:ls,variableNames:["value",`x${ns.sortByComponent}`,`tailX${ns.sortByComponent}`],variablesOptional:!0};return ss},definition({dependencyValues:ns,componentInfoObjects:ss}){let os=[],ls=!0;for(let us in ns){if(us.substring(0,9)!=="component")continue;let cs=ns[us];if(ns.propName){let ds=Object.values(cs.stateValues)[0];os.push({componentName:cs.componentName,numericalValue:Number(ds),textValue:String(ds)}),Number.isFinite(ds)||(ls=!1)}else if(ss.isInheritedComponentType({inheritedComponentType:cs.componentType,baseComponentType:"number"}))os.push({componentName:cs.componentName,numericalValue:cs.stateValues.value,textValue:String(cs.stateValues.value)});else if(ss.isInheritedComponentType({inheritedComponentType:cs.componentType,baseComponentType:"text"})){let ds=NaN,ps=cs.stateValues.value;os.push({componentName:cs.componentName,numericalValue:ds,textValue:ps}),ls=!1}else if(ss.isInheritedComponentType({inheritedComponentType:cs.componentType,baseComponentType:"math"})){let ds=cs.stateValues.value.evaluate_to_constant();Number.isNaN(ds)&&(ls=!1),os.push({componentName:cs.componentName,numericalValue:ds,textValue:cs.stateValues.value.toString()})}else if(ss.isInheritedComponentType({inheritedComponentType:cs.componentType,baseComponentType:"point"})){let ds=cs.stateValues[`x${ns.sortByComponent}`],ps=NaN,fs="";ds&&(ps=ds.evaluate_to_constant(),Number.isNaN(ps)&&(ls=!1),fs=ds.toString()),os.push({componentName:cs.componentName,numericalValue:ps,textValue:fs})}else if(ss.isInheritedComponentType({inheritedComponentType:cs.componentType,baseComponentType:"vector"})){let ds=NaN,ps="",fs=cs.stateValues[`x${ns.sortByComponent}`];ns.sortVectorsBy==="displacement"?fs=cs.stateValues[`x${ns.sortByComponent}`]:fs=cs.stateValues[`tailX${ns.sortByComponent}`],fs&&(ds=fs.evaluate_to_constant(),Number.isNaN(ds)&&(ls=!1),ps=fs.toString()),os.push({componentName:cs.componentName,numericalValue:ds,textValue:ps})}}return ls?os.sort((us,cs)=>us.numericalValue-cs.numericalValue):os.sort((us,cs)=>us.textValue>cs.textValue?1:us.textValue({sortedValues:{dependencyType:"stateVariable",variableName:"sortedValues"}}),markStale:()=>({updateReplacements:!0}),definition:function(){return{setValue:{readyToExpandWhenResolved:!0}}}},rs}static async createSerializedReplacements({component:rs,components:ns,componentInfoObjects:ss,workspace:os}){let ls=[],us=[];for(let ds of await rs.stateValues.sortedValues){let ps;ds.listInd===void 0?ps=ns[ds.componentName]:ps=ns[ds.componentName].activeChildren[ds.listInd],ps&&(us.push(ps.componentName),ls.push(await ps.serialize({sourceAttributesToIgnoreRecursively:["isResponse"]})))}os.uniqueIdentifiersUsed=[],ls=postProcessCopy({serializedComponents:ls,componentName:rs.componentName,uniqueIdentifiersUsed:os.uniqueIdentifiersUsed,addShadowDependencies:!0,markAsPrimaryShadow:!0});let cs=processAssignNames({assignNames:rs.doenetAttributes.assignNames,serializedComponents:ls,parentName:rs.componentName,parentCreatesNewNamespace:await rs.stateValues.newNamespace,componentInfoObjects:ss});return os.componentsCopied=us,{replacements:cs.serializedComponents}}static async calculateReplacementChanges({component:rs,components:ns,componentInfoObjects:ss,workspace:os}){let ls=[];for(let ds of await rs.stateValues.sortedValues){let ps;ds.listInd===void 0?ps=ns[ds.componentName]:ps=ns[ds.componentName].activeChildren[ds.listInd],ps&&ls.push(ps.componentName)}if(ls.length==os.componentsCopied.length&&os.componentsCopied.every((ds,ps)=>ds===ls[ps]))return[];let us=(await this.createSerializedReplacements({component:rs,components:ns,componentInfoObjects:ss,workspace:os})).replacements;return[{changeType:"add",changeTopLevelReplacements:!0,firstReplacementInd:0,numberReplacementsToReplace:rs.replacements.length,serializedReplacements:us}]}}zs(Sort,"componentType","sort"),zs(Sort,"stateVariableToEvaluateAfterReplacements","readyToExpandWhenResolved"),zs(Sort,"assignNamesToReplacements",!0);class Shuffle extends CompositeComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.assignNamesSkip={createPrimitiveOfType:"number"},rs}static returnChildGroups(){return[{group:"anything",componentTypes:["_base"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.originalComponentNames={additionalStateVariablesDefined:["nComponents"],returnDependencies:()=>({children:{dependencyType:"child",childGroups:["anything"],variableNames:["componentNamesInList"],variablesOptional:!0}}),definition({dependencyValues:ns}){let ss=[];for(let os of ns.children)os.stateValues.componentNamesInList?ss.push(...os.stateValues.componentNamesInList):ss.push(os.componentName);return{setValue:{originalComponentNames:ss,nComponents:ss.length}}}},rs.componentOrder={returnDependencies({sharedParameters:ns}){return{variantSeed:{dependencyType:"value",value:ns.variantSeed},rngClass:{dependencyType:"value",value:ns.rngClass,doNotProxy:!0},nComponents:{dependencyType:"stateVariable",variableName:"nComponents"},variants:{dependencyType:"variants"}}},definition({dependencyValues:ns}){var cs,ds;let ss=ns.nComponents,os=(ds=(cs=ns.variants)==null?void 0:cs.desiredVariant)==null?void 0:ds.indices;if(os!==void 0)if(os.length!==ss)console.warn("Ignoring indices specified for shuffle as number of indices doesn't match number of components.");else{if(os=os.map(Number),!os.every(Number.isInteger))throw Error("All indices specified for shuffle must be integers");if(!os.every(ps=>ps>=1&&ps<=ss))console.warn("Ignoring indices specified for shuffle as some indices out of range.");else return{setValue:{componentOrder:os}}}let ls=ns.rngClass(ns.variantSeed+"co"),us=[...Array(ss).keys()].map(ps=>ps+1);for(let ps=ss-1;ps>0;ps--){const fs=ls(),hs=Math.floor(fs*(ps+1));[us[ps],us[hs]]=[us[hs],us[ps]]}return{setValue:{componentOrder:us}}}},rs.readyToExpandWhenResolved={returnDependencies:()=>({sortedValues:{dependencyType:"stateVariable",variableName:"componentOrder"}}),markStale:()=>({updateReplacements:!0}),definition:function(){return{setValue:{readyToExpandWhenResolved:!0}}}},rs.generatedVariantInfo={additionalStateVariablesDefined:["isVariantComponent"],returnDependencies:({componentInfoObjects:ns,sharedParameters:ss})=>({variantSeed:{dependencyType:"value",value:ss.variantSeed},componentOrder:{dependencyType:"stateVariable",variableName:"componentOrder"},variantDescendants:{dependencyType:"descendant",componentTypes:Object.keys(ns.componentTypesCreatingVariants),variableNames:["isVariantComponent","generatedVariantInfo"],useReplacementsForComposites:!0,recurseToMatchedChildren:!1,variablesOptional:!0,includeNonActiveChildren:!0,ignoreReplacementsOfEncounteredComposites:!0}}),definition({dependencyValues:ns,componentName:ss}){let os={seed:ns.variantSeed,meta:{createdBy:ss},indices:ns.componentOrder},ls=os.subvariants=[];for(let us of ns.variantDescendants)us.stateValues.isVariantComponent?ls.push(us.stateValues.generatedVariantInfo):us.stateValues.generatedVariantInfo&&ls.push(...us.stateValues.generatedVariantInfo.subvariants);return{setValue:{generatedVariantInfo:os,isVariantComponent:!0}}}},rs}static setUpVariant({serializedComponent:rs,sharedParameters:ns,descendantVariantComponents:ss}){setUpVariantSeedAndRng({serializedComponent:rs,sharedParameters:ns,descendantVariantComponents:ss})}static async createSerializedReplacements({component:rs,components:ns,componentInfoObjects:ss,workspace:os}){let ls=[],us=[],cs=await rs.stateValues.originalComponentNames;for(let ps of await rs.stateValues.componentOrder){let fs=ns[cs[ps-1]];fs&&(us.push(fs.componentName),ls.push(await fs.serialize({sourceAttributesToIgnoreRecursively:["isResponse"]})))}os.uniqueIdentifiersUsed=[],ls=postProcessCopy({serializedComponents:ls,componentName:rs.componentName,uniqueIdentifiersUsed:os.uniqueIdentifiersUsed,addShadowDependencies:!0,markAsPrimaryShadow:!0});let ds=processAssignNames({assignNames:rs.doenetAttributes.assignNames,serializedComponents:ls,parentName:rs.componentName,parentCreatesNewNamespace:await rs.stateValues.newNamespace,componentInfoObjects:ss});return os.componentsCopied=us,{replacements:ds.serializedComponents}}static async calculateReplacementChanges({component:rs,components:ns,componentInfoObjects:ss,workspace:os}){let ls=[],us=await rs.stateValues.originalComponentNames;for(let ps of await rs.stateValues.componentOrder){let fs=ns[us[ps-1]];fs&&ls.push(fs.componentName)}if(ls.length==os.componentsCopied.length&&os.componentsCopied.every((ps,fs)=>ps===ls[fs]))return[];let cs=(await this.createSerializedReplacements({component:rs,components:ns,componentInfoObjects:ss,workspace:os})).replacements;return[{changeType:"add",changeTopLevelReplacements:!0,firstReplacementInd:0,numberReplacementsToReplace:rs.replacements.length,serializedReplacements:cs}]}static determineNumberOfUniqueVariants({serializedComponent:rs,componentInfoObjects:ns}){var cs,ds,ps;let ss=0;for(let fs of rs.children)if(ns.isInheritedComponentType({inheritedComponentType:fs.componentType,baseComponentType:"_composite"}))if((cs=fs.attributes.createComponentOfType)!=null&&cs.primitive)if(((ds=fs.attributes.nComponents)==null?void 0:ds.primitive)!==void 0){let hs=Number((ps=fs.attributes.nComponents)==null?void 0:ps.primitive);if(Number.isInteger(hs)&&hs>=0)ss+=hs;else return{success:!1}}else ss++;else return{success:!1};else ss++;let os=1;for(let fs=2;fs<=ss;fs++)os*=fs;let ls=super.determineNumberOfUniqueVariants({serializedComponent:rs,componentInfoObjects:ns});if(!ls.success)return{success:!1};let us=ls.numberOfVariants*os;return rs.variants.numberOfVariants=us,rs.variants.uniqueVariantData={numberOfVariantsByDescendant:rs.variants.uniqueVariantData.numberOfVariantsByDescendant,numberOfPermutations:os,nComponents:ss},{success:!0,numberOfVariants:us}}static getUniqueVariant({serializedComponent:rs,variantIndex:ns,componentInfoObjects:ss}){var Ts;let os=(Ts=rs.variants)==null?void 0:Ts.numberOfVariants;if(os===void 0)return{success:!1};if(!Number.isInteger(ns)||ns<1||ns>os)return{success:!1};let ls=rs.variants.uniqueVariantData.numberOfVariantsByDescendant,us=rs.variants.descendantVariantComponents,cs=rs.variants.uniqueVariantData.numberOfPermutations,ds=rs.variants.uniqueVariantData.nComponents,ps=[...ls];ps.push(cs);let fs=enumerateCombinations({numberOfOptionsByIndex:ps,maxNumber:ns})[ns-1].map(Ss=>Ss+1),hs=fs.pop(),gs=fs,ys=[...Array(ds).keys()].map(Ss=>Ss+1),bs=enumeratePermutations({values:ys,maxNumber:hs})[hs-1],vs=!1,xs=[];for(let Ss=0;Ss1){let Ns=us[Ss],ws=ss.allComponentClasses[Ns.componentType].getUniqueVariant({serializedComponent:Ns,variantIndex:gs[Ss],componentInfoObjects:ss});if(!ws.success)return{success:!1};xs.push(ws.desiredVariant),vs=!0}else xs.push({});let Cs={indices:bs};return vs&&(Cs.subvariants=xs),{success:!0,desiredVariant:Cs}}}zs(Shuffle,"componentType","shuffle"),zs(Shuffle,"createsVariants",!0),zs(Shuffle,"stateVariableToEvaluateAfterReplacements","readyToExpandWhenResolved"),zs(Shuffle,"assignNamesToReplacements",!0);class SolveEquations extends InlineComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.variables={createComponentOfType:"variables"},rs.nDiscretizationPoints={createComponentOfType:"number",createStateVariable:"nDiscretizationPoints",defaultValue:100,public:!0},rs.minVar={createComponentOfType:"number",createStateVariable:"minVar",defaultValue:null},rs.maxVar={createComponentOfType:"number",createStateVariable:"maxVar",defaultValue:null},rs}static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=function({matchedChildren:ss}){return ss.every(os=>typeof os=="string"||os.doenetAttributes&&os.doenetAttributes.createdFromMacro)?ss.length===1&&typeof ss[0]!="string"?{success:!1}:{success:!0,newChildren:[{componentType:"math",children:ss}]}:{success:!1}};return rs.push({replacementFunction:ns}),rs}static returnChildGroups(){return[{group:"maths",componentTypes:["math"]},{group:"strings",componentTypes:["string"]}]}static returnStateVariableDefinitions({numerics:rs}){let ns=super.returnStateVariableDefinitions({numerics:rs});return ns.variables={isArray:!0,public:!0,shadowingInstructions:{createComponentOfType:"variable"},entryPrefixes:["variable"],returnArraySizeDependencies:()=>({}),returnArraySize({dependencyValues:ss}){return[1]},returnArrayDependenciesByKey({arrayKeys:ss}){return{globalDependencies:{variablesAttr:{dependencyType:"attributeComponent",attributeName:"variables",variableNames:["variables"]}}}},arrayDefinitionByKey({globalDependencyValues:ss,arraySize:os,arrayKeys:ls,usedDefault:us}){let cs=[];return ss.variablesAttr!==null&&(cs=ss.variablesAttr.stateValues.variables),{setValue:{variables:returnNVariables(os[0],cs)}}}},ns.variable={isAlias:!0,targetVariableName:"variable1"},ns.allSolutions={returnDependencies:()=>({mathChild:{dependencyType:"child",childGroups:["maths"],variableNames:["value"]},variables:{dependencyType:"stateVariable",variableName:"variables"},minVar:{dependencyType:"stateVariable",variableName:"minVar"},maxVar:{dependencyType:"stateVariable",variableName:"maxVar"},nDiscretizationPoints:{dependencyType:"stateVariable",variableName:"nDiscretizationPoints"}}),definition({dependencyValues:ss}){if(ss.mathChild.length===0)return{setValue:{allSolutions:[]}};let os=ss.mathChild[0].stateValues.value;if(!(Array.isArray(os.tree)&&os.tree.length===3&&os.tree[0]==="="))return{setValue:{allSolutions:[]}};let ls=ss.minVar,us=ss.maxVar,cs=[],ds=ss.variables[0].subscripts_to_strings().tree,ps=Context.fromAst(["+",os.tree[1],["-",os.tree[2]]]).subscripts_to_strings(),fs=ps.f(),hs=Es=>fs({[ds]:Es}),gs=Es=>normalizeMathExpression({value:ps.substitute({[ds]:Es}).strings_to_subscripts(),simplify:!0,expand:!0}).evaluate_to_constant(),ys=function(Es){try{return hs(Es)}catch{return NaN}},bs=function(Es){try{return hs(Es)}catch{let $s=gs(Es);return $s!==null?$s:NaN}};if(Number.isFinite(ls)||(ls=-10),Number.isFinite(us)||(us=10),ls>us)return{setValue:{allSolutions:[]}};let vs=[ls,us],xs=[ls];for(let Es=0;Es0){for(let ks=0;ks<10;ks++)if(Ns=.1*Ns+.9*_s,Is=.1*Is+.9*_s,As=ys(Ns),Os=ys(Is),As*Os<0){As*Vs<0?(cs.push(rs.fzero(ys,[Ds,Ns])),cs.push(_s)):(cs.includes(_s)||cs.push(_s),_s=Is,$s=Os),Rs=!0;break}}}!Rs&&!cs.includes(_s)&&cs.push(_s)}else if($s*As<0)cs.push(rs.fzero(ys,[Ns,_s]));else if(As!==0&&Es0&&($s>0&&As>$s||$s<0&&As<$s)){let Os;As>$s?Os=ys:Os=Vs=>-ys(Vs);let Ds=rs.fminbr(Os,[Ns,Rs],void 0,1e-10);if(Ds.success){let Vs=Ds.x,ks=ys(Vs);ks*As<0?(cs.push(rs.fzero(ys,[Ns,Vs])),_s=Vs,$s=ks):ks===0&&cs.push(Vs)}}}Ns=_s,As=$s}return cs=cs.filter(Es=>Es>=ls&&Es<=us),{setValue:{allSolutions:cs.map(Es=>Context.fromAst(Es))}}}},ns.numberSolutions={public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies:()=>({allSolutions:{dependencyType:"stateVariable",variableName:"allSolutions"}}),definition({dependencyValues:ss}){return{setValue:{numberSolutions:ss.allSolutions.length}}}},ns.solutions={public:!0,shadowingInstructions:{createComponentOfType:"math"},isArray:!0,entryPrefixes:["solution"],returnArraySizeDependencies:()=>({numberSolutions:{dependencyType:"stateVariable",variableName:"numberSolutions"}}),returnArraySize({dependencyValues:ss}){return[ss.numberSolutions]},returnArrayDependenciesByKey(){return{globalDependencies:{allSolutions:{dependencyType:"stateVariable",variableName:"allSolutions"}}}},arrayDefinitionByKey({globalDependencyValues:ss}){let os={};for(let ls=0;ls({parentOpen:{dependencyType:"parentStateVariable",variableName:"open"}}),markStale:()=>({updateReplacements:!0}),definition({dependencyValues:ns}){return{setValue:{rendered:!!ns.parentOpen}}}},rs}static async calculateReplacementChanges({component:rs,componentInfoObjects:ns}){if(await rs.stateValues.rendered&&rs.replacements.length===0){let ss=(await this.createSerializedReplacements({component:rs,componentInfoObjects:ns})).replacements;return ss.length>0?[{changeType:"add",changeTopLevelReplacements:!0,firstReplacementInd:0,numberReplacementsToReplace:0,serializedReplacements:ss}]:[]}else return[]}}zs(SolutionContainer,"componentType","_solutionContainer"),zs(SolutionContainer,"stateVariableToEvaluateAfterReplacements","open");class SubsetOfRealsInput extends BlockComponent{constructor(rs){super(rs),Object.assign(this.actions,{addPoint:this.addPoint.bind(this),deletePoint:this.deletePoint.bind(this),movePoint:this.movePoint.bind(this),togglePoint:this.togglePoint.bind(this),toggleInterval:this.toggleInterval.bind(this),clear:this.clear.bind(this),setToR:this.setToR.bind(this),recordVisibilityChange:this.recordVisibilityChange.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.xmin={createComponentOfType:"number",createStateVariable:"xmin",defaultValue:-10,public:!0,forRenderer:!0},rs.xmax={createComponentOfType:"number",createStateVariable:"xmax",defaultValue:10,public:!0,forRenderer:!0},rs.width={createComponentOfType:"_componentSize",createStateVariable:"width",defaultValue:800,public:!0,forRenderer:!0},rs.height={createComponentOfType:"_componentSize",createStateVariable:"height",defaultValue:300,public:!0,forRenderer:!0},rs.xlabel={createComponentOfType:"text",createStateVariable:"xlabel",defaultValue:"",public:!0,forRenderer:!0},rs.dx={createComponentOfType:"number",createStateVariable:"dx",defaultValue:.5,public:!0},rs.variable={createComponentOfType:"variable",createStateVariable:"variable",defaultValue:Context.fromAst("x"),public:!0},rs.format={createComponentOfType:"text",createStateVariable:"format",defaultValue:"text",public:!0},rs.prefill={createComponentOfType:"text",createStateVariable:"prefill",defaultValue:"",public:!0},rs.bindValueTo={createComponentOfType:"subsetOfReals"},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.subsetValue={public:!0,shadowingInstructions:{createComponentOfType:"subsetOfReals"},hasEssential:!0,returnDependencies:()=>({bindValueTo:{dependencyType:"attributeComponent",attributeName:"bindValueTo",variableNames:["subsetValue"]},prefill:{dependencyType:"stateVariable",variableName:"prefill"},variable:{dependencyType:"stateVariable",variableName:"variable"},format:{dependencyType:"stateVariable",variableName:"format"}}),definition:function({dependencyValues:ns}){return ns.bindValueTo?{setValue:{subsetValue:ns.bindValueTo.stateValues.subsetValue}}:{useEssentialOrDefaultValue:{subsetValue:{get defaultValue(){return parseValueIntoSubset({inputString:ns.prefill,format:ns.format,variable:ns.variable})}}}}},inverseDefinition({desiredStateVariableValues:ns,dependencyValues:ss}){return ss.bindValueTo?{success:!0,instructions:[{setDependency:"bindValueTo",desiredValue:ns.subsetValue,variableIndex:0}]}:{success:!0,instructions:[{setEssentialValue:"subsetValue",value:ns.subsetValue}]}}},rs.pointsFromSubset={additionalStateVariablesDefined:["intervalsFromSubset"],returnDependencies:()=>({subsetValue:{dependencyType:"stateVariable",variableName:"subsetValue"}}),definition({dependencyValues:ns}){function ss(ps,fs){var ys;let hs=[],gs=[];if(ps.points&&(hs=ps.points),ps.intervals&&(gs=ps.intervals),fs.points){let bs=hs.map(vs=>vs.value);for(let vs of fs.points){let xs=bs.indexOf(vs.value);xs===-1?hs.push(vs):(ys=hs[xs]).inSubset||(ys.inSubset=vs.inSubset)}}return fs.intervals&&gs.push(...fs.intervals),{points:hs,intervals:gs}}function os(ps){if(ps===null||ps.isEmpty())return{};if(ps instanceof theModule.Union){let fs=[],hs=[];for(let gs of ps.subsets){let ys=os(gs);({points:fs,intervals:hs}=ss({points:fs,intervals:hs},ys))}return{points:fs,intervals:hs}}else{if(ps instanceof theModule.RealLine)return{intervals:[[-1/0,1/0]]};if(ps instanceof theModule.Singleton)return{points:[{value:ps.element,inSubset:!0}]};if(ps instanceof theModule.OpenInterval){let fs=[[ps.left,ps.right]],hs=[];return Number.isFinite(ps.left)&&hs.push({value:ps.left,inSubset:!1}),Number.isFinite(ps.right)&&hs.push({value:ps.right,inSubset:!1}),{intervals:fs,points:hs}}}return{}}let{points:ls,intervals:us}=os(ns.subsetValue),cs=ls||[],ds=us||[];return cs.sort((ps,fs)=>ps.value-fs.value),ds.sort((ps,fs)=>ps[0]-fs[0]),{setValue:{pointsFromSubset:cs,intervalsFromSubset:ds}}}},rs.additionalPoints={defaultValue:[],hasEssential:!0,returnDependencies:()=>({}),definition(){return{useEssentialOrDefaultValue:{additionalPoints:!0}}},inverseDefinition({desiredStateVariableValues:ns}){return ns.additionalPoints.every(Number.isFinite)?{success:!0,instructions:[{setEssentialValue:"additionalPoints",value:[...ns.additionalPoints].sort((ss,os)=>ss-os)}]}:{success:!1}}},rs.points={additionalStateVariablesDefined:[{variableName:"intervals",forRenderer:!0}],forRenderer:!0,returnDependencies:()=>({pointsFromSubset:{dependencyType:"stateVariable",variableName:"pointsFromSubset"},intervalsFromSubset:{dependencyType:"stateVariable",variableName:"intervalsFromSubset"},additionalPoints:{dependencyType:"stateVariable",variableName:"additionalPoints"}}),definition({dependencyValues:ns}){let ss=[...ns.pointsFromSubset],os=[...ns.intervalsFromSubset],ls=[...ns.additionalPoints].sort((ys,bs)=>ys-bs),us=[],cs=[],ds=0,ps=1/0,fs=0;ls.length>0&&(ps=ls[0]);let hs=os[0],gs=-1/0;ss.push({value:1/0,inSubset:!1});for(let ys of ss){let bs=!1;for(hs&&hs[0]hs.value).includes(us)){let hs=!1;for(let gs of ds)if(gs[0]us){hs=!0;break}if(hs)return ps.push(us),await this.coreFunctions.performUpdate({updateInstructions:[{componentName:this.componentName,updateType:"updateValue",stateVariable:"additionalPoints",value:ps}],actionId:ns,sourceInformation:ss,skipRendererUpdate:os,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{addedPoint:us,intervalsFromSubset:ds,pointsFromSubset:cs,additionalPoints:ps}}});{cs.push({value:us,inSubset:!0});let gs=await this.createUpdateInstructions({intervalsFromSubset:ds,pointsFromSubset:cs,modifiedAdditionalPoints:!1,additionalPoints:ps});return await this.coreFunctions.performUpdate({updateInstructions:gs,actionId:ns,sourceInformation:ss,skipRendererUpdate:os,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{addedPoint:us,intervalsFromSubset:ds,pointsFromSubset:cs,additionalPoints:ps}}})}}this.coreFunctions.resolveAction({actionId:ns})}async deletePoint({pointInd:rs,actionId:ns,sourceInformation:ss={},skipRendererUpdate:os=!1}){let ls=await this.stateValues.points[rs],us=[...await this.stateValues.additionalPoints],cs=[...await this.stateValues.pointsFromSubset],ds=[...await this.stateValues.intervalsFromSubset];if(ls.isAdditional)return us.splice(ls.additionalPointInd,1),await this.coreFunctions.performUpdate({updateInstructions:[{componentName:this.componentName,updateType:"updateValue",stateVariable:"additionalPoints",value:us}],actionId:ns,sourceInformation:ss,skipRendererUpdate:os,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{deletedPoint:ls.value,intervalsFromSubset:ds,pointsFromSubset:cs,additionalPoints:us}}});{let ps=!1,fs=cs.map(bs=>bs.value).indexOf(ls.value),hs=ds.map(bs=>bs[1]).indexOf(ls.value),gs=ds.map(bs=>bs[0]).indexOf(ls.value);if(hs!==-1)if(gs!==-1)ds[hs]=[ds[hs][0],ds[gs][1]],ds.splice(gs,1),cs.splice(fs,1);else{let bs=(await this.stateValues.points)[rs-1];bs&&bs.isAdditional?(ds[hs]=[ds[hs][0],bs.value],us.splice(ls.additionalPointInd,1),ps=!0,cs.splice(fs,1,bs)):(ds.splice(hs,1),cs.splice(fs,1),bs&&!bs.inSubset&&ds.map(xs=>xs[1]).indexOf(bs.value)===-1&&(us.push(bs.value),ps=!0))}else if(gs!==-1){let bs=(await this.stateValues.points)[rs+1];bs&&bs.isAdditional?(ds[gs]=[bs.value,ds[gs][1]],us.splice(ls.additionalPointInd,1),ps=!0,cs.splice(fs,1,bs)):(ds.splice(gs,1),cs.splice(fs,1),bs&&!bs.inSubset&&ds.map(xs=>xs[0]).indexOf(bs.value)===-1&&(us.push(bs.value),ps=!0))}else cs.splice(fs,1);let ys=await this.createUpdateInstructions({intervalsFromSubset:ds,pointsFromSubset:cs,modifiedAdditionalPoints:ps,additionalPoints:us});return await this.coreFunctions.performUpdate({updateInstructions:ys,actionId:ns,sourceInformation:ss,skipRendererUpdate:os,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{deletedPoint:ls.value,intervalsFromSubset:ds,pointsFromSubset:cs,additionalPoints:us}}})}}async createUpdateInstructions({intervalsFromSubset:rs,pointsFromSubset:ns,modifiedAdditionalPoints:ss,additionalPoints:os}){let ls=await this.stateValues.dx,us=fs=>Math.round(fs/ls)*ls,cs=[];for(let fs of rs)cs.push(new theModule.OpenInterval(us(fs[0]),us(fs[1])));for(let fs of ns)fs.inSubset&&cs.push(new theModule.Singleton(us(fs.value)));let ds;cs.length===0?ds=new theModule.EmptySet:cs.length===1?ds=cs[0]:ds=new theModule.Union(cs);let ps=[{componentName:this.componentName,updateType:"updateValue",stateVariable:"subsetValue",value:ds}];return ss&&ps.push({componentName:this.componentName,updateType:"updateValue",stateVariable:"additionalPoints",value:os.map(us)}),ps}async movePoint({pointInd:rs,value:ns,transient:ss,actionId:os,sourceInformation:ls={},skipRendererUpdate:us=!1}){let cs=await this.stateValues.dx,ds=Math.round(Math.max(await this.stateValues.xmin,Math.min(await this.stateValues.xmax,ns))/cs)*cs,ps=await this.stateValues.points,fs=ps[rs],hs=ps[rs-1];hs&&(ds=Math.max(ds,hs.value+cs));let gs=ps[rs+1];gs&&(ds=Math.min(ds,gs.value-cs));let ys=[...await this.stateValues.additionalPoints],bs=[...await this.stateValues.pointsFromSubset],vs=[...await this.stateValues.intervalsFromSubset];if(fs.isAdditional)return ys[fs.additionalPointInd]=ds,ss?await this.coreFunctions.performUpdate({updateInstructions:[{componentName:this.componentName,updateType:"updateValue",stateVariable:"additionalPoints",value:ys}],transient:!0,actionId:os,sourceInformation:ls,skipRendererUpdate:us}):await this.coreFunctions.performUpdate({updateInstructions:[{componentName:this.componentName,updateType:"updateValue",stateVariable:"additionalPoints",value:ys}],actionId:os,sourceInformation:ls,skipRendererUpdate:us,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{movedPoint:ds,intervalsFromSubset:vs,pointsFromSubset:bs,additionalPoints:ys}}});{let xs=bs.map(Ns=>Ns.value).indexOf(fs.value),Cs=vs.map(Ns=>Ns[1]).indexOf(fs.value),Ts=vs.map(Ns=>Ns[0]).indexOf(fs.value);bs[xs]={value:ds,inSubset:bs[xs].inSubset},Cs!==-1&&(vs[Cs]=[vs[Cs][0],ds]),Ts!==-1&&(vs[Ts]=[ds,vs[Ts][1]]);let Ss=await this.createUpdateInstructions({intervalsFromSubset:vs,pointsFromSubset:bs,modifiedAdditionalPoints:!1});return ss?await this.coreFunctions.performUpdate({updateInstructions:Ss,transient:!0,actionId:os,sourceInformation:ls,skipRendererUpdate:us}):await this.coreFunctions.performUpdate({updateInstructions:Ss,actionId:os,sourceInformation:ls,skipRendererUpdate:us,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{movedPoint:ds,intervalsFromSubset:vs,pointsFromSubset:bs,additionalPoints:ys}}})}}async togglePoint({pointInd:rs,actionId:ns,sourceInformation:ss={},skipRendererUpdate:os=!1}){let ls=(await this.stateValues.points)[rs],us=[...await this.stateValues.pointsFromSubset],cs=[...await this.stateValues.intervalsFromSubset],ds=[...await this.stateValues.additionalPoints],ps=!1;if(ls.isAdditional)if(ds.splice(ls.additionalPointInd,1),ps=!0,ls.inSubset){for(let[hs,gs]of cs.entries())if(gs[0]ls.value){let ys=[[gs[0],ls.value],[ls.value,gs[1]]];cs.splice(hs,1,...ys);break}}else us.push({value:ls.value,inSubset:!0});else{let hs=us.map(bs=>bs.value).indexOf(ls.value),gs=cs.map(bs=>bs[1]).indexOf(ls.value),ys=cs.map(bs=>bs[0]).indexOf(ls.value);gs!==-1?ys!==-1?(cs[gs]=[cs[gs][0],cs[ys][1]],cs.splice(ys,1),us.splice(hs,1),ds.push(ls.value),ps=!0):us[hs]={value:ls.value,inSubset:!ls.inSubset}:ys!==-1?us[hs]={value:ls.value,inSubset:!ls.inSubset}:(us.splice(hs,1),ds.push(ls.value),ps=!0)}let fs=await this.createUpdateInstructions({intervalsFromSubset:cs,pointsFromSubset:us,modifiedAdditionalPoints:ps,additionalPoints:ds});return await this.coreFunctions.performUpdate({updateInstructions:fs,actionId:ns,sourceInformation:ss,skipRendererUpdate:os,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{toggledPoint:ls.value,intervalsFromSubset:cs,pointsFromSubset:us,additionalPoints:ds}}})}async toggleInterval({intervalInd:rs,actionId:ns,sourceInformation:ss={},skipRendererUpdate:os=!1}){let ls=(await this.stateValues.intervals)[rs],us=await this.stateValues.points,cs=us[rs-1],ds=us[rs],ps=[...await this.stateValues.pointsFromSubset],fs=[...await this.stateValues.intervalsFromSubset],hs=[...await this.stateValues.additionalPoints],gs=!1;if(ls.inSubset){let bs,vs;for(let[xs,Cs]of fs.entries())if(Cs[0]<=ls.left&&Cs[1]>=ls.right){vs=Cs,bs=xs;break}if(ls.left===vs[0])if(ls.right===vs[1]){if(fs.splice(bs,1),cs&&!cs.inSubset&&fs.map(Cs=>Cs[1]).indexOf(cs.value)===-1){let Cs=ps.map(Ts=>Ts.value).indexOf(cs.value);ps.splice(Cs,1),hs.push(cs.value),gs=!0}if(ds&&!ds.inSubset&&fs.map(Cs=>Cs[0]).indexOf(ds.value)===-1){let Cs=ps.map(Ts=>Ts.value).indexOf(ds.value);ps.splice(Cs,1),hs.push(ds.value),gs=!0}}else{if(fs[bs]=[ls.right,vs[1]],cs&&!cs.inSubset&&fs.map(Cs=>Cs[1]).indexOf(cs.value)===-1){let Cs=ps.map(Ts=>Ts.value).indexOf(cs.value);ps.splice(Cs,1),hs.push(cs.value),gs=!0}ps.push({value:ds.value,inSubset:!0}),hs.splice(ds.additionalPointInd,1),gs=!0}else if(ls.right===vs[1]){if(fs[bs]=[vs[0],ls.left],ds&&!ds.inSubset&&fs.map(Cs=>Cs[0]).indexOf(ds.value)===-1){let Cs=ps.map(Ts=>Ts.value).indexOf(ds.value);ps.splice(Cs,1),hs.push(ds.value),gs=!0}ps.push({value:cs.value,inSubset:!0}),hs.splice(cs.additionalPointInd,1),gs=!0}else{let xs=[[vs[0],ls.left],[ls.right,vs[1]]];fs.splice(bs,1,...xs),ps.push({value:cs.value,inSubset:!0}),ps.push({value:ds.value,inSubset:!0}),hs.splice(ds.additionalPointInd,1),hs.splice(cs.additionalPointInd,1),gs=!0}}else{let bs=fs.map(xs=>xs[1]).indexOf(ls.left),vs=fs.map(xs=>xs[0]).indexOf(ls.right);if(bs===-1)vs===-1?(fs.push([ls.left,ls.right]),ds&&ds.isAdditional&&(hs.splice(ds.additionalPointInd,1),gs=!0),cs&&cs.isAdditional&&(hs.splice(cs.additionalPointInd,1),gs=!0)):(ds.inSubset?(fs[vs]=[ls.left,fs[vs][1]],hs.push(ds.value),gs=!0):fs.push([ls.left,ls.right]),cs&&cs.isAdditional&&(hs.splice(cs.additionalPointInd,1),gs=!0));else if(vs===-1)cs.inSubset?(fs[bs]=[fs[bs][0],ls.right],hs.push(cs.value),gs=!0):fs.push([ls.left,ls.right]),ds&&ds.isAdditional&&(hs.splice(ds.additionalPointInd,1),gs=!0);else if(cs.inSubset)if(ds.inSubset){let xs=[fs[bs][0],fs[vs][1]];fs.splice(bs,2,xs),hs.push(cs.value),hs.push(ds.value),gs=!0}else fs[bs]=[fs[bs][0],ls.right],hs.push(cs.value),gs=!0;else ds.inSubset?(fs[vs]=[ls.left,fs[vs][1]],hs.push(ds.value),gs=!0):fs.push([ls.left,ls.right])}let ys=await this.createUpdateInstructions({intervalsFromSubset:fs,pointsFromSubset:ps,modifiedAdditionalPoints:gs,additionalPoints:hs});return await this.coreFunctions.performUpdate({updateInstructions:ys,actionId:ns,sourceInformation:ss,skipRendererUpdate:os,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{toggledInterval:[ls.left,ls.right],intervalsFromSubset:fs,pointsFromSubset:ps,additionalPoints:hs}}})}async clear({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){let os=await this.createUpdateInstructions({intervalsFromSubset:[],pointsFromSubset:[],modifiedAdditionalPoints:!0,additionalPoints:[]});return await this.coreFunctions.performUpdate({updateInstructions:os,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{cleared:!0,intervalsFromSubset:[],pointsFromSubset:[],additionalPoints:[]}}})}async setToR({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){let os=await this.createUpdateInstructions({intervalsFromSubset:[[-1/0,1/0]],pointsFromSubset:[],modifiedAdditionalPoints:!0,additionalPoints:[]});return await this.coreFunctions.performUpdate({updateInstructions:os,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{setToR:!0,intervalsFromSubset:[[-1/0,1/0]],pointsFromSubset:[],additionalPoints:[]}}})}recordVisibilityChange({isVisible:rs,actionId:ns}){this.coreFunctions.requestRecordEvent({verb:"visibilityChanged",object:{componentName:this.componentName,componentType:this.componentType},result:{isVisible:rs}}),this.coreFunctions.resolveAction({actionId:ns})}}zs(SubsetOfRealsInput,"componentType","subsetOfRealsInput"),zs(SubsetOfRealsInput,"variableForPlainMacro","subsetValue"),zs(SubsetOfRealsInput,"variableForPlainCopy","subsetValue");function parseValueIntoSubset({inputString:as,format:rs,variable:ns}){if(!as)return new theModule.EmptySet;let ss;if(rs==="latex")try{ss=Context.fromLatex(as)}catch{return console.warn(`Invalid latex for subsetOfRealsInput: ${as}`),new theModule.EmptySet}else if(rs==="text")try{ss=Context.fromText(as)}catch{return console.warn(`Invalid text for subsetOfRealsInput: ${as}`),new theModule.EmptySet}return buildSubsetFromMathExpression(ss,ns)}class SubsetOfReals extends MathComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.createIntervals.defaultValue=!0,rs.variable={createComponentOfType:"variable",createStateVariable:"variable",defaultValue:Context.fromAst("x")},rs.displayMode={createComponentOfType:"text",createStateVariable:"displayMode",defaultValue:"intervals",public:!0,toLowerCase:!0,validValues:["intervals","inequalities"]},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return renameStateVariable({stateVariableDefinitions:rs,oldName:"unnormalizedValue",newName:"unnormalizedValuePreliminary"}),rs.value.shadowingInstructions.createComponentOfType="math",rs.haveSingleSubsetChild={returnDependencies:()=>({mathChildren:{dependencyType:"child",childGroups:["maths"]}}),definition({dependencyValues:ns,componentInfoObjects:ss}){return{setValue:{haveSingleSubsetChild:ns.mathChildren.length===1&&ns.mathChildren.filter(ls=>ss.isInheritedComponentType({inheritedComponentType:ls.componentType,baseComponentType:"subsetOfReals"})).length===1}}}},rs.subsetValue={stateVariablesDeterminingDependencies:["haveSingleSubsetChild"],returnDependencies({stateValues:ns}){let ss={haveSingleSubsetChild:{dependencyType:"stateVariable",variableName:"haveSingleSubsetChild"}};return ns.haveSingleSubsetChild?ss.subsetChild={dependencyType:"child",childGroups:["maths"],variableNames:["subsetValue"]}:(ss.unnormalizedValuePreliminary={dependencyType:"stateVariable",variableName:"unnormalizedValuePreliminary"},ss.variable={dependencyType:"stateVariable",variableName:"variable"}),ss},definition({dependencyValues:ns}){let ss;return ns.haveSingleSubsetChild?ss=ns.subsetChild[0].stateValues.subsetValue:ss=buildSubsetFromMathExpression(ns.unnormalizedValuePreliminary,ns.variable),{setValue:{subsetValue:ss}}},async inverseDefinition({desiredStateVariableValues:ns,dependencyValues:ss,stateValues:os}){return ss.haveSingleSubsetChild?{success:!0,instructions:[{setDependency:"subsetChild",desiredValue:ns.subsetValue,childIndex:0,variableIndex:0}]}:{success:!0,instructions:[{setDependency:"unnormalizedValuePreliminary",desiredValue:mathExpressionFromSubsetValue({subsetValue:ns.subsetValue,variable:ss.variable,displayMode:await os.displayMode})}]}}},rs.unnormalizedValue={returnDependencies:()=>({subsetValue:{dependencyType:"stateVariable",variableName:"subsetValue"},displayMode:{dependencyType:"stateVariable",variableName:"displayMode"},variable:{dependencyType:"stateVariable",variableName:"variable"}}),definition({dependencyValues:ns}){return{setValue:{unnormalizedValue:mathExpressionFromSubsetValue(ns)}}},inverseDefinition({desiredStateVariableValues:ns,dependencyValues:ss}){return{success:!0,instructions:[{setDependency:"subsetValue",desiredValue:buildSubsetFromMathExpression(ns.unnormalizedValue,ss.variable)}]}}},rs}}zs(SubsetOfReals,"componentType","subsetOfReals"),zs(SubsetOfReals,"rendererType","math"),zs(SubsetOfReals,"primaryStateVariableForDefinition","subsetValue");function mathExpressionFromSubsetValue({subsetValue:as,variable:rs,displayMode:ns="intervals"}){function ss(ls){return ls===null?"_":ns==="intervals"?ls.closedInterval?["interval",["tuple",ls.left,ls.right],["tuple",!0,!0]]:ls.openClosedInterval?["interval",["tuple",ls.left,ls.right],["tuple",!1,!0]]:ls.closedOpenInterval?["interval",["tuple",ls.left,ls.right],["tuple",!0,!1]]:ls.toMathExpression().tree:ls.closedInterval?["lts",["tuple",ls.left,rs,ls.right],["tuple",!1,!1]]:ls.openClosedInterval?ls.left===-1/0?["le",rs,ls.right]:["lts",["tuple",ls.left,rs,ls.right],["tuple",!0,!1]]:ls.closedOpenInterval?ls.right===1/0?["ge",rs,ls.left]:["lts",["tuple",ls.left,rs,ls.right],["tuple",!1,!0]]:ls instanceof theModule.OpenInterval?ls.left===-1/0?["<",rs,ls.right]:ls.right===1/0?[">",rs,ls.left]:["lts",["tuple",ls.left,rs,ls.right],["tuple",!0,!0]]:ls instanceof theModule.Singleton?["=",rs,ls.element]:ls.isEmpty()?["in",rs,"∅"]:ls instanceof theModule.RealLine?["in",rs,"R"]:null}let os;if(as instanceof theModule.Union){let ls=as.subsets.filter(ds=>ds instanceof theModule.Singleton),us=as.subsets.filter(ds=>ds instanceof theModule.OpenInterval);for(let ds=0;ds(ds.left===void 0?ds.element:ds.left)-(ps.left===void 0?ps.element:ps.left)).map(ds=>ss(ds));cs.length>1?ns==="intervals"?os=Context.fromAst(["union",...cs]):os=Context.fromAst(["or",...cs]):os=Context.fromAst(cs[0])}else os=Context.fromAst(ss(as));return os}class Split extends CompositeComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.assignNamesSkip={createPrimitiveOfType:"number"},rs.type={createPrimitiveOfType:"string",createStateVariable:"type",defaultPrimitiveValue:"text",toLowerCase:!0,validValues:["text"]},rs.splitBy={createComponentOfType:"text",createStateVariable:"splitBy",defaultValue:"letter",toLowerCase:!0,validValues:["letter","word","comma"]},rs}static returnSugarInstructions(){let rs=[];function ns({matchedChildren:ss,componentAttributes:os}){let ls=os.type;return["text"].includes(ls)||(ls="text"),{success:!0,newChildren:[{componentType:ls,children:ss}]}}return rs.push({replacementFunction:ns}),rs}static returnChildGroups(){return[{group:"anything",componentTypes:["_base"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.originalValue={returnDependencies:()=>({child:{dependencyType:"child",childGroups:["anything"],variableNames:["value"]}}),definition({dependencyValues:ns}){return ns.child.length>0?{setValue:{originalValue:ns.child[0].stateValues.value}}:{setValue:{originalValue:null}}},inverseDefinition({desiredStateVariableValues:ns,dependencyValues:ss}){return ss.child.length>0?{success:!0,instructions:[{setDependency:"child",desiredValue:ns.originalValue,childIndex:0,variableIndex:0}]}:{success:!1}}},rs.splitValues={returnDependencies:()=>({type:{dependencyType:"stateVariable",variableName:"type"},originalValue:{dependencyType:"stateVariable",variableName:"originalValue"},splitBy:{dependencyType:"stateVariable",variableName:"splitBy"}}),definition({dependencyValues:ns}){if(ns.originalValue===null)return{setValue:{splitValues:[]}};let ss=[];return ns.splitBy==="letter"?ss=[...ns.originalValue]:ns.splitBy==="word"?ss=ns.originalValue.split(/\s+/):ns.splitBy==="comma"?ss=ns.originalValue.split(/\s*,\s*/):ss=[ns.originalValue],{setValue:{splitValues:ss}}}},rs.readyToExpandWhenResolved={returnDependencies:()=>({splitValues:{dependencyType:"stateVariable",variableName:"splitValues"}}),markStale:()=>({updateReplacements:!0}),definition:function(){return{setValue:{readyToExpandWhenResolved:!0}}}},rs}static async createSerializedReplacements({component:rs,componentInfoObjects:ns}){var us;let ss=(us=rs.attributes.newNamespace)==null?void 0:us.primitive,os={componentType:"textList",state:{textsShadow:await rs.stateValues.splitValues},downstreamDependencies:{[rs.componentName]:[{dependencyType:"referenceShadow",compositeName:rs.componentName,propVariable:"splitValues"}]}};return{replacements:processAssignNames({assignNames:rs.doenetAttributes.assignNames,serializedComponents:[os],parentName:rs.componentName,parentCreatesNewNamespace:ss,componentInfoObjects:ns}).serializedComponents}}}zs(Split,"componentType","split"),zs(Split,"assignNamesToReplacements",!0),zs(Split,"stateVariableToEvaluateAfterReplacements","readyToExpandWhenResolved");class BestFitLine extends Line{static createAttributesObject(){let rs=super.createAttributesObject();return delete rs.draggable,delete rs.equation,delete rs.through,delete rs.slope,rs.points={createComponentOfType:"_pointListComponent"},rs}static returnSugarInstructions(){return[]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.draggable={shadowingInstructions:{createComponentOfType:"boolean"},public:!0,forRenderer:!0,returnDependencies:()=>({}),definition:()=>({setValue:{draggable:!1}})},rs.nDimensions={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({}),definition:()=>({setValue:{nDimensions:2}})},delete rs.nPointsPrescribed,delete rs.basedOnSlope,delete rs.dForSlope,delete rs.essentialPoint1x,delete rs.essentialPoint1y,delete rs.equationIdentity,delete rs.equation.stateVariablesDeterminingDependencies,rs.equation.returnDependencies=()=>({points:{dependencyType:"attributeComponent",attributeName:"points",variableNames:["points","nDimensions"]},variables:{dependencyType:"stateVariable",variableName:"variables"}}),rs.equation.definition=function({dependencyValues:ns}){if(!ns.points||ns.points.stateValues.nDimensions<2||ns.points.stateValues.points.length<1){let vs=Context.fromAst("_");return{setValue:{equation:vs,coeff0:vs,coeffvar1:vs,coeffvar2:vs}}}let ss=[],os=[];for(let vs of ns.points.stateValues.points){let xs=vs.slice(0,2).map(Cs=>Cs&&Cs.evaluate_to_constant());xs.every(Number.isFinite)&&(ss.push([1,xs[0]]),os.push([xs[1]]))}if(ss.length===0){let vs=Context.fromAst("_");return{setValue:{equation:vs,coeff0:vs,coeffvar1:vs,coeffvar2:vs}}}ss=Context.math.matrix(ss),os=Context.math.matrix(os);let ls=Context.math.transpose(ss),us=Context.math.multiply(ls,os),cs=Context.math.multiply(ls,ss),ds=Context.math.lusolve(cs,us),ps=Context.fromAst(Context.math.subset(ds,Context.math.index(0,0))),fs=Context.fromAst(Context.math.subset(ds,Context.math.index(1,0))),hs=Context.fromAst(-1),gs=ns.variables,ys=Context.fromAst(["+",["*","a","x"],"c"]).substitute({a:fs,c:ps,x:gs[0],y:gs[1]}).simplify();return{setValue:{equation:Context.fromAst(["=","y","r"]).substitute({r:ys}),coeff0:ps,coeffvar1:fs,coeffvar2:hs}}},delete rs.equation.inverseDefinition,delete rs.points.stateVariablesDeterminingDependencies,rs.points.returnArrayDependenciesByKey=function(){return{globalDependencies:{coeff0:{dependencyType:"stateVariable",variableName:"coeff0"},coeffvar1:{dependencyType:"stateVariable",variableName:"coeffvar1"},coeffvar2:{dependencyType:"stateVariable",variableName:"coeffvar2"},variables:{dependencyType:"stateVariable",variableName:"variables"},lastPointsFromInverting:{dependencyType:"stateVariable",variableName:"lastPointsFromInverting"}}}},rs}}zs(BestFitLine,"componentType","bestFitLine"),zs(BestFitLine,"rendererType","line");class RegionBetweenCurveXAxis extends GraphicalComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.boundaryValues={createComponentOfType:"numberList",createStateVariable:"boundaryValues",defaultValue:[0,1],forRenderer:!0,public:!0},rs.function={createComponentOfType:"function"},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.styleDescription={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({selectedStyle:{dependencyType:"stateVariable",variableName:"selectedStyle"},document:{dependencyType:"ancestor",componentType:"document",variableNames:["theme"]}}),definition:function({dependencyValues:ns}){var os;let ss;return((os=ns.document)==null?void 0:os.stateValues.theme)==="dark"?ss=ns.selectedStyle.fillColorWordDarkMode:ss=ns.selectedStyle.fillColorWord,{setValue:{styleDescription:ss}}}},rs.styleDescriptionWithNoun={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({styleDescription:{dependencyType:"stateVariable",variableName:"styleDescription"}}),definition:function({dependencyValues:ns}){return{setValue:{styleDescriptionWithNoun:ns.styleDescription+" region"}}}},rs.function={additionalStateVariablesDefined:[{variableName:"haveFunction",forRenderer:!0},{variableName:"fDefinition",forRenderer:!0}],returnDependencies:()=>({functionAttr:{dependencyType:"attributeComponent",attributeName:"function",variableNames:["numericalfs","nInputs","nOutputs","fDefinition"]}}),definition({dependencyValues:ns}){return ns.functionAttr===null||ns.functionAttr.stateValues.nInputs!==1||ns.functionAttr.stateValues.nOutputs!==1?{setValue:{function:()=>NaN,haveFunction:!1,fDefinition:{}}}:{setValue:{function:ns.functionAttr.stateValues.numericalfs[0],haveFunction:!0,fDefinition:ns.functionAttr.stateValues.fDefinition}}}},rs}}zs(RegionBetweenCurveXAxis,"componentType","regionBetweenCurveXAxis");class RegionHalfPlane extends GraphicalComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.horizontal={createComponentOfType:"boolean",createStateVariable:"horizontal",defaultValue:!0,public:!0},rs.boundaryValue={createComponentOfType:"number",createStateVariable:"boundaryValue",defaultValue:0,public:!0},rs.greaterThan={createComponentOfType:"boolean",createStateVariable:"greaterThan",defaultValue:!0,public:!0},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.nearestPoint={returnDependencies:()=>({horizontal:{dependencyType:"stateVariable",variableName:"horizontal"},boundaryValue:{dependencyType:"stateVariable",variableName:"boundaryValue"},greaterThan:{dependencyType:"stateVariable",variableName:"greaterThan"}}),definition({dependencyValues:ns}){let ss=ns.boundaryValue;return{setValue:{nearestPoint:function({variables:os,scales:ls}){if(!Number.isFinite(ss))return{};if(ns.horizontal)if(ns.greaterThan)if(os.x1ss){let us=Object.assign({},os);return us.x1=ss,us}else return{};else if(ns.greaterThan)if(os.x2ss){let us=Object.assign({},os);return us.x2=ss,us}else return{}}}}}},rs}}zs(RegionHalfPlane,"componentType","regionHalfPlane"),zs(RegionHalfPlane,"rendererType");class CodeEditor extends BlockComponent{constructor(rs){super(rs),Object.assign(this.actions,{updateImmediateValue:this.updateImmediateValue.bind(this),updateValue:this.updateValue.bind(this),updateComponents:this.updateComponents.bind(this),recordVisibilityChange:this.recordVisibilityChange.bind(this)})}static get stateVariablesShadowedForReference(){return["value"]}static createAttributesObject(){let rs=super.createAttributesObject();return rs.prefill={createComponentOfType:"text",createStateVariable:"prefill",defaultValue:"",public:!0},rs.bindValueTo={createComponentOfType:"text"},rs.width={createComponentOfType:"_componentSize",createStateVariable:"width",defaultValue:{size:600,isAbsolute:!0},forRenderer:!0,public:!0},rs.height={createComponentOfType:"_componentSize",createStateVariable:"height",defaultValue:{size:400,isAbsolute:!0},forRenderer:!0,public:!0},rs.viewerRatio={createComponentOfType:"number",createStateVariable:"viewerRatio",defaultValue:.5,forRenderer:!0,public:!0},rs.showResults={createComponentOfType:"boolean",createStateVariable:"showResults",defaultValue:!1,forRenderer:!0,public:!0},rs.renderedName={createPrimitiveOfType:"string"},rs.staticName={createPrimitiveOfType:"string"},rs}static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=function({matchedChildren:ss,componentAttributes:os}){if(ss.length>0)return{success:!1};let ls={componentType:"codeViewer",children:[{componentType:"renderDoenetML"}]},us=[ls];if(os.renderedName&&(ls.attributes={renderedName:{primitive:os.renderedName}},ls.children[0].props={name:os.renderedName}),os.staticName){let cs={componentType:"codeViewer",attributes:{hide:{component:{componentType:"boolean",state:{value:!0}}}},children:[{componentType:"renderDoenetML",props:{name:os.staticName}}]};us.push(cs)}return{success:!0,newChildren:us}};return rs.push({replacementFunction:ns}),rs}static returnChildGroups(){return[{group:"codeViewers",componentTypes:["codeViewer"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.viewerHeight={returnDependencies:()=>({height:{dependencyType:"stateVariable",variableName:"height"},viewerRatio:{dependencyType:"stateVariable",variableName:"viewerRatio"}}),definition:function({dependencyValues:ns}){if(!ns.height.isAbsolute)throw Error("Codeeditor relative height not implemented");return{setValue:{viewerHeight:{size:ns.height.size*ns.viewerRatio,isAbsolute:!0}}}}},rs.value={public:!0,shadowingInstructions:{createComponentOfType:"text"},hasEssential:!0,forRenderer:!0,returnDependencies:()=>({bindValueTo:{dependencyType:"attributeComponent",attributeName:"bindValueTo",variableNames:["value"]},prefill:{dependencyType:"stateVariable",variableName:"prefill"}}),definition:function({dependencyValues:ns}){return ns.bindValueTo?{setValue:{value:ns.bindValueTo.stateValues.value}}:{useEssentialOrDefaultValue:{value:{variablesToCheck:"value",defaultValue:ns.prefill}}}},inverseDefinition:function({desiredStateVariableValues:ns,dependencyValues:ss}){return ss.bindValueTo?{success:!0,instructions:[{setDependency:"bindValueTo",desiredValue:ns.value,variableIndex:0}]}:{success:!0,instructions:[{setEssentialValue:"value",value:ns.value}]}}},rs.immediateValue={public:!0,shadowingInstructions:{createComponentOfType:"text"},hasEssential:!0,forRenderer:!0,returnDependencies:()=>({value:{dependencyType:"stateVariable",variableName:"value"}}),definition:function({dependencyValues:ns,changes:ss,justUpdatedForNewComponent:os}){return ss.value&&!os?{setValue:{immediateValue:ns.value},makeEssential:{immediateValue:!0}}:{useEssentialOrDefaultValue:{immediateValue:{variablesToCheck:"immediateValue",defaultValue:ns.value}}}},inverseDefinition:function({desiredStateVariableValues:ns,initialChange:ss,shadowedVariable:os}){let ls=[{setEssentialValue:"immediateValue",value:ns.immediateValue}];return ss||os||ls.push({setDependency:"value",desiredValue:ns.immediateValue}),{success:!0,instructions:ls}}},rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},returnDependencies:()=>({value:{dependencyType:"stateVariable",variableName:"value"}}),definition:function({dependencyValues:ns}){return{setValue:{text:ns.value}}}},rs.componentType={returnDependencies:()=>({}),definition:()=>({setValue:{componentType:"text"}})},rs.viewerChild={returnDependencies:()=>({viewerChild:{dependencyType:"child",childGroups:["codeViewers"]}}),definition({dependencyValues:ns}){return ns.viewerChild.length>0?{setValue:{viewerChild:ns.viewerChild}}:{setValue:{viewerChild:null}}}},rs}updateImmediateValue({text:rs,actionId:ns,sourceInformation:ss={},skipRendererUpdate:os=!1}){if(this.stateValues.disabled)this.coreFunctions.resolveAction({actionId:ns});else return this.coreFunctions.performUpdate({updateInstructions:[{updateType:"updateValue",componentName:this.componentName,stateVariable:"immediateValue",value:rs},{updateType:"setComponentNeedingUpdateValue",componentName:this.componentName}],actionId:ns,sourceInformation:ss,skipRendererUpdate:os})}updateValue({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){if(!this.stateValues.disabled&&this.stateValues.immediateValue!==this.stateValues.value){let os=[{updateType:"updateValue",componentName:this.componentName,stateVariable:"value",value:this.stateValues.immediateValue},{updateType:"executeUpdate"},{updateType:"updateValue",componentName:this.componentName,stateVariable:"immediateValue",valueOfStateVariable:"value"},{updateType:"unsetComponentNeedingUpdateValue"}],ls={verb:"answered",object:{componentName:this.componentName,componentType:this.componentType},result:{response:this.stateValues.immediateValue,responseText:this.stateValues.immediateValue}};return this.stateValues.answerAncestor&&(ls.context={answerAncestor:this.stateValues.answerAncestor.componentName}),this.coreFunctions.performUpdate({updateInstructions:os,actionId:rs,sourceInformation:ns,skipRendererUpdate:!0,event:ls}).then(()=>{this.coreFunctions.triggerChainedActions({componentName:this.componentName,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss}),this.attributes.staticName&&this.definingChildren.length===2&&this.definingChildren[1].componentType==="codeViewer"&&this.coreFunctions.performAction({componentName:this.definingChildren[1].componentName,actionName:"updateComponents",args:{sourceInformation:ns,skipRendererUpdate:ss}})})}else this.coreFunctions.resolveAction({actionId:rs})}async updateComponents(){this.definingChildren.length===1&&this.definingChildren[0].componentType==="codeViewer"&&await this.coreFunctions.performAction({componentName:this.definingChildren[0].componentName,actionName:"updateComponents"})}recordVisibilityChange({isVisible:rs,actionId:ns}){this.coreFunctions.requestRecordEvent({verb:"visibilityChanged",object:{componentName:this.componentName,componentType:this.componentType},result:{isVisible:rs}}),this.coreFunctions.resolveAction({actionId:ns})}}zs(CodeEditor,"componentType","codeEditor"),zs(CodeEditor,"variableForPlainMacro","value"),zs(CodeEditor,"variableForPlainCopy","value"),zs(CodeEditor,"renderChildren",!0),zs(CodeEditor,"processWhenJustUpdatedForNewComponent",!0);class CodeViewer extends BlockComponent{constructor(rs){super(rs),Object.assign(this.actions,{updateComponents:this.updateComponents.bind(this),recordVisibilityChange:this.recordVisibilityChange.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.codeSource={createTargetComponentNames:!0},rs.width={createComponentOfType:"_componentSize"},rs.height={createComponentOfType:"_componentSize"},rs.hasCodeEditorParent={createComponentOfType:"boolean"},rs.renderedName={createPrimitiveOfType:"string"},rs}static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=function({matchedChildren:ss,componentAttributes:os}){if(ss.length>0)return{success:!1};let ls={componentType:"renderDoenetML"};return os.codeSource&&(ls.attributes={codeSource:{targetComponentNames:os.codeSource}}),os.renderedName&&(ls.props={name:os.renderedName}),{success:!0,newChildren:[ls]}};return rs.push({replacementFunction:ns}),rs}static returnChildGroups(){return[{group:"children",componentTypes:["_base"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.hasCodeEditorParent={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},forRenderer:!0,returnDependencies:()=>({codeEditorParent:{dependencyType:"parentIdentity",parentComponentType:"codeEditor"}}),definition:function({dependencyValues:ns}){return ns.codeEditorParent?{setValue:{hasCodeEditorParent:!0}}:{setValue:{hasCodeEditorParent:!1}}}},rs.width={public:!0,shadowingInstructions:{createComponentOfType:"_componentSize"},hasEssential:!0,forRenderer:!0,defaultValue:{size:600,isAbsolute:!0},returnDependencies:()=>({widthAttr:{dependencyType:"attributeComponent",attributeName:"width",variableNames:["componentSize"]},parentWidth:{dependencyType:"parentStateVariable",variableName:"width",parentComponentType:"codeEditor"}}),definition:function({dependencyValues:ns}){return ns.widthAttr?{setValue:{width:ns.widthAttr.stateValues.componentSize}}:ns.parentWidth?{setValue:{width:ns.parentWidth}}:{useEssentialOrDefaultValue:{width:!0}}}},rs.height={public:!0,shadowingInstructions:{createComponentOfType:"_componentSize"},hasEssential:!0,forRenderer:!0,defaultValue:{size:400,isAbsolute:!0},returnDependencies:()=>({heightAttr:{dependencyType:"attributeComponent",attributeName:"height",variableNames:["componentSize"]},parentViewerHeight:{dependencyType:"parentStateVariable",variableName:"viewerHeight",parentComponentType:"codeEditor"}}),definition:function({dependencyValues:ns}){return ns.heightAttr?{setValue:{height:ns.heightAttr.stateValues.componentSize}}:ns.parentViewerHeight?{setValue:{height:ns.parentViewerHeight}}:{useEssentialOrDefaultValue:{height:!0}}}},rs.codeSourceComponentName={returnDependencies:()=>({codeSource:{dependencyType:"attributeTargetComponentNames",attributeName:"codeSource"}}),definition({dependencyValues:ns}){var os;let ss;return((os=ns.codeSource)==null?void 0:os.length)===1?ss=ns.codeSource[0].absoluteName:ss=null,{setValue:{codeSourceComponentName:ss}}}},rs.codeSource={returnDependencies:()=>({codeSourceComponentName:{dependencyType:"stateVariable",variableName:"codeSourceComponentName"},codeEditorParent:{dependencyType:"parentIdentity",parentComponentType:"codeEditor"}}),definition:function({dependencyValues:ns}){return ns.codeSourceComponentName?{setValue:{codeSource:ns.codeSourceComponentName}}:ns.codeEditorParent?{setValue:{codeSource:ns.codeEditorParent.componentName}}:{setValue:{codeSource:null}}}},rs}async updateComponents(){this.definingChildren.length===1&&this.definingChildren[0].componentType==="renderDoenetML"&&await this.coreFunctions.performAction({componentName:this.definingChildren[0].componentName,actionName:"updateComponents"})}recordVisibilityChange({isVisible:rs,actionId:ns}){this.coreFunctions.requestRecordEvent({verb:"visibilityChanged",object:{componentName:this.componentName,componentType:this.componentType},result:{isVisible:rs}}),this.coreFunctions.resolveAction({actionId:ns})}}zs(CodeViewer,"componentType","codeViewer"),zs(CodeViewer,"renderChildren",!0),zs(CodeViewer,"includeBlankStringChildren",!0);class RenderDoenetML extends CompositeComponent{constructor(rs){super(rs),Object.assign(this.actions,{updateComponents:this.updateComponents.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.assignNamesSkip={createPrimitiveOfType:"number"},rs.codeSource={createTargetComponentNames:!0},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.codeSourceComponentName={returnDependencies:()=>({codeSource:{dependencyType:"attributeTargetComponentNames",attributeName:"codeSource"}}),definition({dependencyValues:ns}){var os;let ss;return((os=ns.codeSource)==null?void 0:os.length)===1?ss=ns.codeSource[0].absoluteName:ss=null,{setValue:{codeSourceComponentName:ss}}}},rs.codeSource={returnDependencies:()=>({codeSourceComponentName:{dependencyType:"stateVariable",variableName:"codeSourceComponentName"},parentCodeSource:{dependencyType:"parentStateVariable",parentComponentType:"codeViewer",variableName:"codeSource"}}),definition:function({dependencyValues:ns}){return ns.codeSourceComponentName?{setValue:{codeSource:ns.codeSourceComponentName}}:ns.parentCodeSource?{setValue:{codeSource:ns.parentCodeSource}}:{setValue:{codeSource:null}}}},rs.doenetML={stateVariablesDeterminingDependencies:["codeSource"],returnDependencies:({stateValues:ns})=>({doenetML:{dependencyType:"stateVariable",componentName:ns.codeSource,variableName:"text",variablesOptional:!0}}),definition({dependencyValues:ns}){let ss="";return ns.doenetML&&(ss=ns.doenetML,typeof ss!="string"&&(ss="")),{setValue:{doenetML:ss}}}},rs.readyToExpandWhenResolved={returnDependencies:()=>({doenetML:{dependencyType:"stateVariable",variableName:"doenetML"}}),definition(){return{setValue:{readyToExpandWhenResolved:!0}}}},rs.triggerUpdates={defaultValue:!0,hasEssential:!0,returnDependencies:()=>({}),markStale(){return{updateReplacements:!0}},definition(){return{useEssentialOrDefaultValue:{triggerUpdates:{}}}},inverseDefinition({desiredStateVariableValues:ns}){return{success:!0,instructions:[{setEssentialValue:"triggerUpdates",value:ns.triggerUpdates}]}}},rs.isVariantComponent={returnDependencies:()=>({}),definition:()=>({setValue:{isVariantComponent:!0}})},rs.generatedVariantInfo={returnDependencies:({sharedParameters:ns,componentInfoObjects:ss})=>({variantSeed:{dependencyType:"value",value:ns.variantSeed},variantDescendants:{dependencyType:"descendant",componentTypes:Object.keys(ss.componentTypesCreatingVariants),variableNames:["isVariantComponent","generatedVariantInfo"],useReplacementsForComposites:!0,recurseToMatchedChildren:!1,variablesOptional:!0,includeNonActiveChildren:!0,ignoreReplacementsOfEncounteredComposites:!0}}),definition({dependencyValues:ns,componentName:ss}){let os={seed:ns.variantSeed,meta:{createdBy:ss}},ls=os.subvariants=[];for(let us of ns.variantDescendants)us.stateValues.isVariantComponent?ls.push(us.stateValues.generatedVariantInfo):us.stateValues.generatedVariantInfo&&ls.push(...us.stateValues.generatedVariantInfo.subvariants);return{setValue:{generatedVariantInfo:os}}}},rs}static async createSerializedReplacements({component:rs,componentInfoObjects:ns,flags:ss,workspace:os}){let ls=[],us=(await rs.stateValues.doenetML).trim();os.previousDoenetML=us;try{ls=(await expandDoenetMLsToFullSerializedComponents({cids:[],doenetMLs:[us],componentInfoObjects:ns,flags:ss})).fullSerializedComponents[0]}catch(ps){return console.warn("error in user entered doenetML"),console.warn(ps.message),{replacements:[]}}let cs=rs.componentName.split("/").map(ps=>({namespace:ps,componentCounts:{},namesUsed:{}}));return createComponentNames({serializedComponents:ls,componentInfoObjects:ns,namespaceStack:cs}),restrictTNamesToNamespace({components:ls,namespace:`${rs.componentName}/`}),{replacements:processAssignNames({assignNames:rs.doenetAttributes.assignNames,serializedComponents:ls,parentName:rs.componentName,parentCreatesNewNamespace:!0,componentInfoObjects:ns,originalNamesAreConsistent:!0}).serializedComponents}}static async calculateReplacementChanges({component:rs,componentChanges:ns,componentInfoObjects:ss,flags:os,workspace:ls}){let us=(await rs.stateValues.doenetML).trim();if(ls.previousDoenetML===us)return[];ls.previousDoenetML=us;let cs=(await this.createSerializedReplacements({component:rs,componentInfoObjects:ss,flags:os,workspace:ls})).replacements;return[{changeType:"add",changeTopLevelReplacements:!0,firstReplacementInd:0,numberReplacementsToReplace:rs.replacements.length,serializedReplacements:cs}]}static setUpVariant({serializedComponent:rs,sharedParameters:ns,descendantVariantComponents:ss}){setUpVariantSeedAndRng({serializedComponent:rs,sharedParameters:ns,descendantVariantComponents:ss,useSubpartVariantRng:!0})}async updateComponents({actionId:rs,sourceInformation:ns={},skipRendererUpdate:ss=!1}){let os=[{updateType:"updateValue",componentName:this.componentName,stateVariable:"triggerUpdates",value:!0}];await this.coreFunctions.performUpdate({updateInstructions:os,actionId:rs,sourceInformation:ns,skipRendererUpdate:ss})}}zs(RenderDoenetML,"componentType","renderDoenetML"),zs(RenderDoenetML,"assignNamesToReplacements",!0),zs(RenderDoenetML,"createsVariants",!0),zs(RenderDoenetML,"stateVariableToEvaluateAfterReplacements","triggerUpdates");class HasSameFactoring extends BooleanComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.variable={createComponentOfType:"variable",createStateVariable:"variable",defaultValue:Context.fromAst("x")},rs.restrictDivision={createComponentOfType:"boolean",createStateVariable:"restrictDivision",defaultValue:!1},rs.monomialFactorMustMatch={createComponentOfType:"boolean",createStateVariable:"monomialFactorMustMatch",defaultValue:!1},rs.allowOnlySignDifferences={createComponentOfType:"boolean",createStateVariable:"allowOnlySignDifferences",defaultValue:!1},rs}static returnChildGroups(){return[{group:"maths",componentTypes:["math"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return delete rs.parsedExpression,delete rs.mathChildrenByCode,rs.value={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},forRenderer:!0,returnDependencies:()=>({mathChildren:{dependencyType:"child",childGroups:["maths"],variableNames:["value"]},allowedErrorInNumbers:{dependencyType:"stateVariable",variableName:"allowedErrorInNumbers"},includeErrorInNumberExponents:{dependencyType:"stateVariable",variableName:"includeErrorInNumberExponents"},allowedErrorIsAbsolute:{dependencyType:"stateVariable",variableName:"allowedErrorIsAbsolute"},nSignErrorsMatched:{dependencyType:"stateVariable",variableName:"nSignErrorsMatched"},variable:{dependencyType:"stateVariable",variableName:"variable"},restrictDivision:{dependencyType:"stateVariable",variableName:"restrictDivision"},monomialFactorMustMatch:{dependencyType:"stateVariable",variableName:"monomialFactorMustMatch"},allowOnlySignDifferences:{dependencyType:"stateVariable",variableName:"allowOnlySignDifferences"}}),definition:function({dependencyValues:ns}){if(ns.mathChildren.length!==2)return{setValue:{value:!1}};let ss=ns.mathChildren[0].stateValues.value,os=ns.mathChildren[1].stateValues.value;if(checkEquality({object1:ss,object2:os,isUnordered:!1,partialMatches:!1,symbolicEquality:!1,allowedErrorInNumbers:ns.allowedErrorInNumbers,includeErrorInNumberExponents:ns.includeErrorInNumberExponents,allowedErrorIsAbsolute:ns.allowedErrorIsAbsolute,nSignErrorsMatched:ns.nSignErrorsMatched}).fraction_equal!==1)return{setValue:{value:!1}};if(Array.isArray(ss.tree)&&ss.tree[0]==="-"&&(ss=Context.fromAst(ss.tree[1])),Array.isArray(os.tree)&&os.tree[0]==="-"&&(os=Context.fromAst(os.tree[1])),!ns.restrictDivision&&!ns.monomialFactorMustMatch&&!ns.allowOnlySignDifferences&&(Array.isArray(ss.tree)&&ss.tree[0]==="/"&&Context.fromAst(ss.tree[2]).variables().length===0&&(ss=Context.fromAst(ss.tree[1]),Array.isArray(ss.tree)&&ss.tree[0]==="-"&&(ss=Context.fromAst(ss.tree[1]))),Array.isArray(os.tree)&&os.tree[0]==="/"&&Context.fromAst(os.tree[2]).variables().length===0&&(os=Context.fromAst(os.tree[1]),Array.isArray(os.tree)&&os.tree[0]==="-"&&(os=Context.fromAst(os.tree[1])))),ss=Context.fromAst(expandPositiveIntegerPowers(ss.tree)),os=Context.fromAst(expandPositiveIntegerPowers(os.tree)),Array.isArray(ss.tree)&&ss.tree[0]==="*"){if(!(Array.isArray(os.tree)&&os.tree[0]==="*"))return{setValue:{value:!1}}}else return Array.isArray(os.tree)&&os.tree[0]==="*"?{setValue:{value:!1}}:{setValue:{value:!0}};if(ns.monomialFactorMustMatch||ns.allowOnlySignDifferences){let bs=findMonomialFromFactors(ss.tree.slice(1)),vs=findMonomialFromFactors(os.tree.slice(1));if(!bs.equals(vs)){let xs=Context.fromAst(["-",vs.tree]);if(!bs.equals(xs))return{setValue:{value:!1}}}}if(ns.allowOnlySignDifferences){let bs=normalizeFactorSigns(ss),vs=normalizeFactorSigns(os);return{setValue:{value:bs.equalsViaSyntax(vs,{allowed_error_in_numbers:ns.allowedErrorInNumbers,include_error_in_number_exponents:ns.includeErrorInNumberExponents,allowed_error_is_absolute:ns.allowedErrorIsAbsolute})}}}let us=ss.tree.slice(1).filter(bs=>Context.fromAst(bs).variables().length>0),cs=os.tree.slice(1).filter(bs=>Context.fromAst(bs).variables().length>0);if(us.length!==cs.length)return{setValue:{value:!1}};let ds=0,ps=0,fs=0,hs=0,gs=ns.variable.subscripts_to_strings().tree;for(let bs of us){let vs=Context.fromAst(bs).subscripts_to_strings().derivative(gs).derivative(gs).simplify();if(vs.tree===0)ps++;else if(vs.variables().length===0)ds++;else return{setValue:{value:!1}}}for(let bs of cs){let vs=Context.fromAst(bs).subscripts_to_strings().derivative(gs).derivative(gs).simplify();if(vs.tree===0)hs++;else if(vs.variables().length===0)fs++;else return{setValue:{value:!1}}}return{setValue:{value:ps===hs&&ds===fs}}}},rs}}zs(HasSameFactoring,"componentType","hasSameFactoring"),zs(HasSameFactoring,"rendererType","boolean");function expandPositiveIntegerPowers(as){if(!Array.isArray(as))return as;if(as[0]==="^"){let rs=as[1],ns=as[2];Number.isInteger(ns)&&ns>0&&(as=["*",...Array(ns).fill(rs)])}if(as[0]==="*"){let rs=as;as=["*"];for(let ns of rs.slice(1))if(Array.isArray(ns)&&ns[0]==="^"){let ss=ns[1],os=ns[2];Number.isInteger(os)&&os>0?as.push(...Array(os).fill(ss)):as.push(ns)}else as.push(ns)}return as}function findMonomialFromFactors(as){let rs=[],ns=!1;for(let os of as)if(typeof os=="string"||Context.fromAst(os).variables().length===0){if(!ns){if(rs.length>0)return Context.fromAst("_");ns=!0}rs.push(os)}else ns=!1;let ss;return rs.length===0?ss=1:rs.length===1?ss=rs[0]:ss=["*",...rs],Context.fromAst(ss)}function normalizeFactorSigns(as){let rs=as.simplify().tree;if(rs[0]==="-"&&(rs=rs[1]),rs[0]!=="*")return Context.fromAst(rs).simplify();let ns=["*"];for(let ss of rs.slice(1))if(typeof ss=="number")ss<0?ns.push(-ss):ns.push(ss);else if(!Array.isArray(ss))ns.push(ss);else if(ss[0]==="-")ns.push(ss[1]);else if(ss[0]==="+"){let os=!1,ls=ss[1];if(typeof ls=="number")ls<0&&(os=!0);else if(Array.isArray(ls)){if(ls[0]==="-")os=!0;else if(ls[0]==="*"){let us=ls[1];typeof us=="number"?us<0&&(os=!0):Array.isArray(us)&&us[0]==="-"&&(os=!0)}}os?ns.push(Context.fromAst(["-",ss]).simplify().tree):ns.push(ss)}else ns.push(ss);return Context.fromAst(ns).simplify()}class DataFrame extends BaseComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.source={createComponentOfType:"text",createStateVariable:"source",required:!0,public:!0,forRenderer:!0},rs.hasHeader={createComponentOfType:"boolean",createStateVariable:"hasHeader",defaultValue:!0,public:!0},rs.columnTypes={createComponentOfType:"textList",createStateVariable:"columnTypesPrelim",defaultValue:[]},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.cid={forRenderer:!0,returnDependencies:()=>({source:{dependencyType:"stateVariable",variableName:"source"}}),definition:function({dependencyValues:ns}){if(!ns.source||ns.source.substring(0,7).toLowerCase()!=="doenet:")return{setValue:{cid:null}};let ss=null,os=ns.source.match(/[:&]cid=([^&]+)/i);return os&&(ss=os[1]),{setValue:{cid:ss}}}},rs.dataFrame={stateVariablesDeterminingDependencies:["cid","source"],additionalStateVariablesDefined:[{variableName:"numRows",public:!0,shadowingInstructions:{createComponentOfType:"integer"}},{variableName:"numColumns",public:!0,shadowingInstructions:{createComponentOfType:"integer"}},{variableName:"columnTypes",public:!0,shadowingInstructions:{createComponentOfType:"textList"}},{variableName:"columnNames",public:!0,shadowingInstructions:{createComponentOfType:"textList"}}],returnDependencies:({stateValues:ns})=>({fileContents:{dependencyType:"file",cid:ns.cid,uri:ns.source,fileType:"csv"},hasHeader:{dependencyType:"stateVariable",variableName:"hasHeader"},columnTypesPrelim:{dependencyType:"stateVariable",variableName:"columnTypesPrelim"}}),definition:function({dependencyValues:ns,componentName:ss}){var gs,ys;let os=[],ls=[],us=ns.fileContents.trim().split(` -`).map(bs=>bs.trim().split(",").map(vs=>vs.trim())),cs=(gs=us[0])==null?void 0:gs.length,ds=!1;for(let bs of us.slice(1))if(bs.length!==cs){ds=!0;break}if(ds)return console.warn(`Data has invalid shape. Rows has inconsistent lengths. Found in componentName :${ss}`),{setValue:{dataFrame:null,numRows:hs,numColumns:cs,columnTypes:os,columnNames:ls}};let ps={},fs=[];if(ns.hasHeader?(ps.columnNames=us[0].map(bs=>(['"',"'"].includes(bs[0])&&bs[bs.length-1]===bs[0]&&(bs=bs.substring(1,bs.length-1)),bs)),fs=us.slice(1)):(ps.columnNames=[...Array(cs).keys()].map(bs=>`col${bs+1}`),fs=us),[...new Set(ps.columnNames)].length({numColumns:{dependencyType:"stateVariable",variableName:"numColumns"}}),returnArraySize({dependencyValues:ns}){return[ns.numColumns]},returnArrayDependenciesByKey(){return{globalDependencies:{dataFrame:{dependencyType:"stateVariable",variableName:"dataFrame"},numColumns:{dependencyType:"stateVariable",variableName:"numColumns"},numRows:{dependencyType:"stateVariable",variableName:"numRows"},columnTypes:{dependencyType:"stateVariable",variableName:"columnTypes"}}}},arrayDefinitionByKey({globalDependencyValues:ns,arrayKeys:ss}){let os={};for(let ls of ss){let us=0,cs=0;if(ns.columnTypes[ls]==="number"){for(let ds=0;ds({displayDigitsAttr:{dependencyType:"attributeComponent",attributeName:"displayDigits",variableNames:["value"]},displayDecimalsAttr:{dependencyType:"attributeComponent",attributeName:"displayDecimals",variableNames:["value"]}}),definition({dependencyValues:ns,usedDefault:ss}){if(ns.displayDigitsAttr!==null){let os=ss.displayDigitsAttr,ls=ns.displayDecimalsAttr===null||ss.displayDecimalsAttr;if(!(os||ls)){let us=ns.displayDigitsAttr.shadowDepth;ns.displayDecimalsAttr.shadowDepth({statisticsToDisplayPrelim:{dependencyType:"stateVariable",variableName:"statisticsToDisplayPrelim"}}),definition:function({dependencyValues:ns}){let ss=["mean","stdev","variance","stderr","count","minimum","quartile1","median","quartile3","maximum","range","sum"],os=[],ls=ns.statisticsToDisplayPrelim.map(us=>us.toLowerCase());if(ls.includes("default"))os=["mean","stdev","count","minimum","quartile1","median","quartile3","maximum"];else if(ls.includes("all"))os=[...ss];else for(let us of ss)ls.includes(us)&&os.push(us);return{setValue:{statisticsToDisplay:os}}}},rs.sourceName={returnDependencies:()=>({source:{dependencyType:"attributeTargetComponentNames",attributeName:"source"}}),definition({dependencyValues:ns}){var os;let ss;return((os=ns.source)==null?void 0:os.length)===1?ss=ns.source[0].absoluteName:ss=null,{setValue:{sourceName:ss}}}},rs.dataColumn={stateVariablesDeterminingDependencies:["sourceName"],additionalStateVariablesDefined:[{variableName:"columnName",public:!0,shadowingInstructions:{createComponentOfType:"text"},forRenderer:!0}],returnDependencies({stateValues:ns}){return{dataFrame:{dependencyType:"stateVariable",componentName:ns.sourceName,variableName:"dataFrame",variableOptional:!0},desiredColumn:{dependencyType:"stateVariable",variableName:"desiredColumn"}}},definition({dependencyValues:ns}){let ss=null,os=null;if(ns.dataFrame){let ls=ns.dataFrame,us=ls.columnNames.indexOf(ns.desiredColumn);if(us!==-1){os=ns.desiredColumn,ss=[];for(let cs of ls.data)cs[us]!==null&&ss.push(cs[us])}}return{setValue:{dataColumn:ss,columnName:os}}}},rs.count={public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies:()=>({dataColumn:{dependencyType:"stateVariable",variableName:"dataColumn"}}),definition({dependencyValues:ns}){let ss=null;return ns.dataColumn&&(ss=ns.dataColumn.length),{setValue:{count:ss}}}},rs.sum={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero"]},returnDependencies:()=>({dataColumn:{dependencyType:"stateVariable",variableName:"dataColumn"}}),definition({dependencyValues:ns}){let ss=null;return ns.dataColumn&&(ss=ns.dataColumn.reduce((os,ls)=>os+ls)),{setValue:{sum:ss}}}},rs.mean={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero"]},returnDependencies:()=>({dataColumn:{dependencyType:"stateVariable",variableName:"dataColumn"}}),definition({dependencyValues:ns}){let ss=null;return ns.dataColumn!==null&&(ss=Context.math.mean(ns.dataColumn)),{setValue:{mean:ss}}}},rs.stdev={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero"]},returnDependencies:()=>({dataColumn:{dependencyType:"stateVariable",variableName:"dataColumn"}}),definition({dependencyValues:ns}){let ss=null;return ns.dataColumn&&(ss=Context.math.std(ns.dataColumn)),{setValue:{stdev:ss}}}},rs.variance={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero"]},returnDependencies:()=>({dataColumn:{dependencyType:"stateVariable",variableName:"dataColumn"}}),definition({dependencyValues:ns}){let ss=null;return ns.dataColumn&&(ss=Context.math.variance(ns.dataColumn)),{setValue:{variance:ss}}}},rs.stderr={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero"]},returnDependencies:()=>({stdev:{dependencyType:"stateVariable",variableName:"stdev"},count:{dependencyType:"stateVariable",variableName:"count"}}),definition({dependencyValues:ns}){let ss=null;return ns.stdev!==null&&(ss=ns.stdev/Math.sqrt(ns.count)),{setValue:{stderr:ss}}}},rs.minimum={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero"]},returnDependencies:()=>({dataColumn:{dependencyType:"stateVariable",variableName:"dataColumn"}}),definition({dependencyValues:ns}){let ss=null;return ns.dataColumn&&(ss=Math.min(...ns.dataColumn)),{setValue:{minimum:ss}}}},rs.maximum={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero"]},returnDependencies:()=>({dataColumn:{dependencyType:"stateVariable",variableName:"dataColumn"}}),definition({dependencyValues:ns}){let ss=null;return ns.dataColumn&&(ss=Math.max(...ns.dataColumn)),{setValue:{maximum:ss}}}},rs.median={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero"]},returnDependencies:()=>({dataColumn:{dependencyType:"stateVariable",variableName:"dataColumn"}}),definition({dependencyValues:ns}){let ss=null;return ns.dataColumn&&(ss=Context.math.median(ns.dataColumn)),{setValue:{median:ss}}}},rs.quartile1={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero"]},returnDependencies:()=>({dataColumn:{dependencyType:"stateVariable",variableName:"dataColumn"}}),definition({dependencyValues:ns}){let ss=null;return ns.dataColumn&&(ss=Context.math.quantileSeq(ns.dataColumn,.25)),{setValue:{quartile1:ss}}}},rs.quartile3={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero"]},returnDependencies:()=>({dataColumn:{dependencyType:"stateVariable",variableName:"dataColumn"}}),definition({dependencyValues:ns}){let ss=null;return ns.dataColumn&&(ss=Context.math.quantileSeq(ns.dataColumn,.75)),{setValue:{quartile3:ss}}}},rs.range={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero"]},returnDependencies:()=>({minimum:{dependencyType:"stateVariable",variableName:"minimum"},maximum:{dependencyType:"stateVariable",variableName:"maximum"}}),definition({dependencyValues:ns}){let ss=null;return ns.minimum!==null&&(ss=ns.maximum-ns.minimum),{setValue:{range:ss}}}},rs.summaryStatistics={forRenderer:!0,stateVariablesDeterminingDependencies:["statisticsToDisplay"],returnDependencies({stateValues:ns}){let ss={displayDigits:{dependencyType:"stateVariable",variableName:"displayDigits"},displayDecimals:{dependencyType:"stateVariable",variableName:"displayDecimals"},displaySmallAsZero:{dependencyType:"stateVariable",variableName:"displaySmallAsZero"}};return ns.statisticsToDisplay.includes("mean")&&(ss.mean={dependencyType:"stateVariable",variableName:"mean"}),ns.statisticsToDisplay.includes("stdev")&&(ss.stdev={dependencyType:"stateVariable",variableName:"stdev"}),ns.statisticsToDisplay.includes("variance")&&(ss.variance={dependencyType:"stateVariable",variableName:"variance"}),ns.statisticsToDisplay.includes("stderr")&&(ss.stderr={dependencyType:"stateVariable",variableName:"stderr"}),ns.statisticsToDisplay.includes("count")&&(ss.count={dependencyType:"stateVariable",variableName:"count"}),ns.statisticsToDisplay.includes("minimum")&&(ss.minimum={dependencyType:"stateVariable",variableName:"minimum"}),ns.statisticsToDisplay.includes("quartile1")&&(ss.quartile1={dependencyType:"stateVariable",variableName:"quartile1"}),ns.statisticsToDisplay.includes("median")&&(ss.median={dependencyType:"stateVariable",variableName:"median"}),ns.statisticsToDisplay.includes("quartile3")&&(ss.quartile3={dependencyType:"stateVariable",variableName:"quartile3"}),ns.statisticsToDisplay.includes("maximum")&&(ss.maximum={dependencyType:"stateVariable",variableName:"maximum"}),ns.statisticsToDisplay.includes("range")&&(ss.range={dependencyType:"stateVariable",variableName:"range"}),ns.statisticsToDisplay.includes("sum")&&(ss.sum={dependencyType:"stateVariable",variableName:"sum"}),ss},definition({dependencyValues:ns,usedDefault:ss}){let os={};return ns.mean!==void 0&&(os.mean=roundForDisplay({value:ns.mean,dependencyValues:ns,usedDefault:ss})),ns.stdev!==void 0&&(os.stdev=roundForDisplay({value:ns.stdev,dependencyValues:ns,usedDefault:ss})),ns.variance!==void 0&&(os.variance=roundForDisplay({value:ns.variance,dependencyValues:ns,usedDefault:ss})),ns.stderr!==void 0&&(os.stderr=roundForDisplay({value:ns.stderr,dependencyValues:ns,usedDefault:ss})),ns.count!==void 0&&(os.count=roundForDisplay({value:ns.count,dependencyValues:ns,usedDefault:ss})),ns.minimum!==void 0&&(os.minimum=roundForDisplay({value:ns.minimum,dependencyValues:ns,usedDefault:ss})),ns.quartile1!==void 0&&(os.quartile1=roundForDisplay({value:ns.quartile1,dependencyValues:ns,usedDefault:ss})),ns.median!==void 0&&(os.median=roundForDisplay({value:ns.median,dependencyValues:ns,usedDefault:ss})),ns.quartile3!==void 0&&(os.quartile3=roundForDisplay({value:ns.quartile3,dependencyValues:ns,usedDefault:ss})),ns.maximum!==void 0&&(os.maximum=roundForDisplay({value:ns.maximum,dependencyValues:ns,usedDefault:ss})),ns.range!==void 0&&(os.range=roundForDisplay({value:ns.range,dependencyValues:ns,usedDefault:ss})),ns.sum!==void 0&&(os.sum=roundForDisplay({value:ns.sum,dependencyValues:ns,usedDefault:ss})),{setValue:{summaryStatistics:os}}}},rs}recordVisibilityChange({isVisible:rs,actionId:ns}){this.coreFunctions.requestRecordEvent({verb:"visibilityChanged",object:{componentName:this.componentName,componentType:this.componentType},result:{isVisible:rs}}),this.coreFunctions.resolveAction({actionId:ns})}}zs(SummaryStatistics,"componentType","summaryStatistics");class Chart extends BlockComponent{constructor(rs){super(rs),Object.assign(this.actions,{changeAxisLimits:this.changeAxisLimits.bind(this),recordVisibilityChange:this.recordVisibilityChange.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.type={createComponentOfType:"text",createStateVariable:"type",defaultValue:"histogram",toLowerCase:!0,validValues:["histogram","dotplot","frequencytable","box","bar"],forRenderer:!0},rs.column={createComponentOfType:"text",createStateVariable:"desiredColumn",defaultValue:null},rs.xmin={createComponentOfType:"number",createStateVariable:"xminPrelim",defaultValue:-10},rs.xmax={createComponentOfType:"number",createStateVariable:"xmaxPrelim",defaultValue:10},rs.ymin={createComponentOfType:"number",createStateVariable:"yminPrelim",defaultValue:-10},rs.ymax={createComponentOfType:"number",createStateVariable:"ymaxPrelim",defaultValue:10},rs.width={createComponentOfType:"_componentSize",createStateVariable:"width",defaultValue:{size:300,isAbsolute:!0},public:!0,forRenderer:!0},rs.height={createComponentOfType:"_componentSize",createStateVariable:"height",defaultValue:{size:300,isAbsolute:!0},public:!0,forRenderer:!0},rs.identicalAxisScales={createComponentOfType:"boolean",createStateVariable:"identicalAxisScales",defaultValue:!1,public:!0,forRenderer:!0},rs.displayXAxis={createComponentOfType:"boolean",createStateVariable:"displayXAxis",defaultValue:!0,public:!0,forRenderer:!0},rs.displayYAxis={createComponentOfType:"boolean",createStateVariable:"displayYAxis",defaultValue:!0,public:!0,forRenderer:!0},rs.displayXAxisTickLabels={createComponentOfType:"boolean",createStateVariable:"displayXAxisTickLabels",defaultValue:!0,public:!0,forRenderer:!0},rs.displayYAxisTickLabels={createComponentOfType:"boolean",createStateVariable:"displayYAxisTickLabels",defaultValue:!0,public:!0,forRenderer:!0},rs.xlabel={createComponentOfType:"text",createStateVariable:"xlabel",defaultValue:"",public:!0,forRenderer:!0},rs.xlabelPosition={createComponentOfType:"text",createStateVariable:"xlabelPosition",defaultValue:"right",public:!0,forRenderer:!0,toLowerCase:!0,validValues:["right","left"]},rs.ylabel={createComponentOfType:"text",createStateVariable:"ylabel",defaultValue:"",public:!0,forRenderer:!0},rs.ylabelPosition={createComponentOfType:"text",createStateVariable:"ylabelPosition",defaultValue:"top",public:!0,forRenderer:!0,toLowerCase:!0,validValues:["top","bottom"]},rs.ylabelAlignment={createComponentOfType:"text",createStateVariable:"ylabelAlignment",defaultValue:"left",public:!0,forRenderer:!0,toLowerCase:!0,validValues:["left","right"]},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.dataFrame={forRenderer:!0,returnDependencies(){return{targetComponent:{dependencyType:"targetComponent",variableNames:["dataFrame"],variablesOptional:!0}}},definition({dependencyValues:ns}){var os;console.log("definition of dataFrame",ns);let ss=null;return(os=ns.targetComponent)!=null&&os.stateValues.dataFrame&&(ss=ns.targetComponent.stateValues.dataFrame),{setValue:{dataFrame:ss}}}},rs.columnName={public:!0,shadowingInstructions:{createComponentOfType:"text"},additionalStateVariablesDefined:[{variableName:"colInd",forRenderer:!0}],returnDependencies(){return{desiredColumn:{dependencyType:"stateVariable",variableName:"desiredColumn"},dataFrame:{dependencyType:"stateVariable",variableName:"dataFrame"}}},definition({dependencyValues:ns}){let ss=null,os=null;return ns.dataFrame&&(os=ns.dataFrame.columnNames.indexOf(ns.desiredColumn),os!==-1?ss=ns.desiredColumn:os=null),{setValue:{columnName:ss,colInd:os}}}},rs.xmin={stateVariablesDeterminingDependencies:["identicalAxisScales"],defaultValue:-10,public:!0,shadowingInstructions:{createComponentOfType:"number"},forRenderer:!0,returnDependencies({stateValues:ns}){let ss={identicalAxisScales:{dependencyType:"stateVariable",variableName:"identicalAxisScales"},xminPrelim:{dependencyType:"stateVariable",variableName:"xminPrelim"}};return ns.identicalAxisScales&&(ss.xmaxPrelim={dependencyType:"stateVariable",variableName:"xmaxPrelim"},ss.yminPrelim={dependencyType:"stateVariable",variableName:"yminPrelim"},ss.ymaxPrelim={dependencyType:"stateVariable",variableName:"ymaxPrelim"},ss.width={dependencyType:"stateVariable",variableName:"width"},ss.height={dependencyType:"stateVariable",variableName:"height"}),ss},definition({dependencyValues:ns,usedDefault:ss}){if(!ns.identicalAxisScales)return{setValue:{xmin:ns.xminPrelim}};if(!ss.xminPrelim)return{setValue:{xmin:ns.xminPrelim}};let ls=!ss.xmaxPrelim,us=!ss.yminPrelim,cs=!ss.ymaxPrelim;if(us&&cs){let ps=ns.width.size/ns.height.size,fs=(ns.ymaxPrelim-ns.yminPrelim)*ps;return ls?{setValue:{xmin:ns.xmaxPrelim-fs}}:{setValue:{xmin:-fs/2}}}else return ls?{setValue:{xmin:ns.xmaxPrelim-20}}:{setValue:{xmin:-10}}},async inverseDefinition({desiredStateVariableValues:ns,stateValues:ss}){return await ss.fixAxes?{success:!1}:{success:!0,instructions:[{setDependency:"xminPrelim",desiredValue:ns.xmin}]}}},rs.xmax={stateVariablesDeterminingDependencies:["identicalAxisScales"],defaultValue:-10,public:!0,shadowingInstructions:{createComponentOfType:"number"},forRenderer:!0,returnDependencies({stateValues:ns}){let ss={identicalAxisScales:{dependencyType:"stateVariable",variableName:"identicalAxisScales"},xmaxPrelim:{dependencyType:"stateVariable",variableName:"xmaxPrelim"}};return ns.identicalAxisScales&&(ss.xminPrelim={dependencyType:"stateVariable",variableName:"xminPrelim"},ss.yminPrelim={dependencyType:"stateVariable",variableName:"yminPrelim"},ss.ymaxPrelim={dependencyType:"stateVariable",variableName:"ymaxPrelim"},ss.width={dependencyType:"stateVariable",variableName:"width"},ss.height={dependencyType:"stateVariable",variableName:"height"}),ss},definition({dependencyValues:ns,usedDefault:ss}){if(!ns.identicalAxisScales)return{setValue:{xmax:ns.xmaxPrelim}};let os=!ss.xminPrelim,ls=!ss.xmaxPrelim,us=!ss.yminPrelim,cs=!ss.ymaxPrelim,ds=us&&cs,ps=os&&ls,fs=ns.xminPrelim;if(ds){let hs=ns.width.size/ns.height.size,gs=(ns.ymaxPrelim-ns.yminPrelim)*hs;if(ps){let ys=ns.xmaxPrelim-fs,bs=Math.max(ys,gs);return{setValue:{xmax:fs+bs}}}else return os?{setValue:{xmax:fs+gs}}:ls?{setValue:{xmax:ns.xmaxPrelim}}:{setValue:{xmax:gs/2}}}else return ls?{setValue:{xmax:ns.xmaxPrelim}}:os?{setValue:{xmax:fs+20}}:{setValue:{xmax:10}}},async inverseDefinition({desiredStateVariableValues:ns,stateValues:ss}){return await ss.fixAxes?{success:!1}:{success:!0,instructions:[{setDependency:"xmaxPrelim",desiredValue:ns.xmax}]}}},rs.ymin={stateVariablesDeterminingDependencies:["identicalAxisScales"],defaultValue:-10,public:!0,shadowingInstructions:{createComponentOfType:"number"},forRenderer:!0,returnDependencies({stateValues:ns}){let ss={identicalAxisScales:{dependencyType:"stateVariable",variableName:"identicalAxisScales"},yminPrelim:{dependencyType:"stateVariable",variableName:"yminPrelim"}};return ns.identicalAxisScales&&(ss.xmaxPrelim={dependencyType:"stateVariable",variableName:"xmaxPrelim"},ss.xminPrelim={dependencyType:"stateVariable",variableName:"xminPrelim"},ss.ymaxPrelim={dependencyType:"stateVariable",variableName:"ymaxPrelim"},ss.width={dependencyType:"stateVariable",variableName:"width"},ss.height={dependencyType:"stateVariable",variableName:"height"}),ss},definition({dependencyValues:ns,usedDefault:ss}){if(!ns.identicalAxisScales)return{setValue:{ymin:ns.yminPrelim}};if(!ss.yminPrelim)return{setValue:{ymin:ns.yminPrelim}};let ls=!ss.ymaxPrelim,us=!ss.xminPrelim,cs=!ss.xmaxPrelim,ds=us&&cs,ps=ns.width.size/ns.height.size;if(ds){let fs=(ns.xmaxPrelim-ns.xminPrelim)/ps;return ls?{setValue:{ymin:ns.ymaxPrelim-fs}}:{setValue:{ymin:-fs/2}}}else return ls?{setValue:{ymin:ns.ymaxPrelim-20/ps}}:{setValue:{ymin:-10/ps}}},async inverseDefinition({desiredStateVariableValues:ns,stateValues:ss}){return await ss.fixAxes?{success:!1}:{success:!0,instructions:[{setDependency:"yminPrelim",desiredValue:ns.ymin}]}}},rs.ymax={stateVariablesDeterminingDependencies:["identicalAxisScales"],defaultValue:-10,public:!0,shadowingInstructions:{createComponentOfType:"number"},forRenderer:!0,returnDependencies({stateValues:ns}){let ss={identicalAxisScales:{dependencyType:"stateVariable",variableName:"identicalAxisScales"},ymaxPrelim:{dependencyType:"stateVariable",variableName:"ymaxPrelim"}};return ns.identicalAxisScales&&(ss.xminPrelim={dependencyType:"stateVariable",variableName:"xminPrelim"},ss.yminPrelim={dependencyType:"stateVariable",variableName:"yminPrelim"},ss.xmaxPrelim={dependencyType:"stateVariable",variableName:"xmaxPrelim"},ss.width={dependencyType:"stateVariable",variableName:"width"},ss.height={dependencyType:"stateVariable",variableName:"height"}),ss},definition({dependencyValues:ns,usedDefault:ss}){if(!ns.identicalAxisScales)return{setValue:{ymax:ns.ymaxPrelim}};let os=!ss.xminPrelim,ls=!ss.xmaxPrelim,us=!ss.yminPrelim,cs=!ss.ymaxPrelim,ds=us&&cs,ps=os&&ls,fs=ns.yminPrelim,hs=ns.width.size/ns.height.size;if(ps){let gs=(ns.xmaxPrelim-ns.xminPrelim)/hs;if(ds){let ys=ns.ymaxPrelim-fs,bs=Math.max(ys,gs);return{setValue:{ymax:fs+bs}}}else return us?{setValue:{ymax:fs+gs}}:cs?{setValue:{ymax:ns.ymaxPrelim}}:{setValue:{ymax:gs/2}}}else return cs?{setValue:{ymax:ns.ymaxPrelim}}:us?{setValue:{ymax:fs+20/hs}}:{setValue:{ymax:10/hs}}},async inverseDefinition({desiredStateVariableValues:ns,stateValues:ss}){return await ss.fixAxes?{success:!1}:{success:!0,instructions:[{setDependency:"ymaxPrelim",desiredValue:ns.ymax}]}}},rs.xscale={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({xmin:{dependencyType:"stateVariable",variableName:"xmin"},xmax:{dependencyType:"stateVariable",variableName:"xmax"}}),definition({dependencyValues:ns}){return{setValue:{xscale:ns.xmax-ns.xmin}}}},rs.yscale={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({ymin:{dependencyType:"stateVariable",variableName:"ymin"},ymax:{dependencyType:"stateVariable",variableName:"ymax"}}),definition({dependencyValues:ns}){return{setValue:{yscale:ns.ymax-ns.ymin}}}},rs}async changeAxisLimits({xmin:rs,xmax:ns,ymin:ss,ymax:os,actionId:ls,sourceInformation:us={},skipRendererUpdate:cs=!1}){let ds=[];return rs!==void 0&&ds.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"xmin",value:rs}),ns!==void 0&&ds.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"xmax",value:ns}),ss!==void 0&&ds.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"ymin",value:ss}),os!==void 0&&ds.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"ymax",value:os}),await this.coreFunctions.performUpdate({updateInstructions:ds,actionId:ls,sourceInformation:us,skipRendererUpdate:cs,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{xmin:rs,xmax:ns,ymin:ss,ymax:os}}})}recordVisibilityChange({isVisible:rs,actionId:ns}){this.coreFunctions.requestRecordEvent({verb:"visibilityChanged",object:{componentName:this.componentName,componentType:this.componentType},result:{isVisible:rs}}),this.coreFunctions.resolveAction({actionId:ns})}}zs(Chart,"componentType","chart"),zs(Chart,"acceptTarget",!0);class Legend extends GraphicalComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.position={createComponentOfType:"text",createStateVariable:"position",defaultValue:"upperright",public:!0,forRenderer:!0,toLowerCase:!0,validValues:["upperright","upperleft","lowerright","lowerleft"]},rs.displayClosedSwatches={createComponentOfType:"boolean",createStateVariable:"displayClosedSwatches",defaultValue:!1,public:!0},rs}static returnChildGroups(){return[{group:"labels",componentTypes:["label"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.graphicalElementNames={returnDependencies:()=>({graphAncestor:{dependencyType:"ancestor",componentType:"graph",variableNames:["graphicalDescendants"]}}),definition({dependencyValues:ns}){return ns.graphAncestor?{setValue:{graphicalElementNames:ns.graphAncestor.stateValues.graphicalDescendants.map(ss=>ss.componentName)}}:{setValue:{graphicalElementNames:null}}}},rs.legendElements={forRenderer:!0,stateVariablesDeterminingDependencies:["graphicalElementNames"],returnDependencies:({stateValues:ns})=>{let ss={labelChildren:{dependencyType:"child",childGroups:["labels"],variableNames:["value","hasLatex","forObjectComponentName"]},displayClosedSwatches:{dependencyType:"stateVariable",variableName:"displayClosedSwatches"}};if(ns.graphicalElementNames){ss.numGraphicalElements={dependencyType:"value",value:ns.graphicalElementNames.length};for(let[os,ls]of ns.graphicalElementNames.entries())ss[`graphicalElement${os}`]={dependencyType:"multipleStateVariables",componentName:ls,variableNames:["selectedStyle","styleNumber","filled"],variablesOptional:!0},ss[`graphicalElement${os}AdapterSource`]={dependencyType:"adapterSource",componentName:ls},ss[`graphicalElement${os}ShadowSource`]={dependencyType:"shadowSource",componentName:ls}}return ss},definition({dependencyValues:ns,componentInfoObjects:ss}){let os=[];if(ns.numGraphicalElements>0){let ls=[],us=[],cs=[],ds=[];for(let gs=0;gsgs.componentName),fs=[],hs={};for(let gs of ns.labelChildren){let ys={value:gs.stateValues.value,hasLatex:gs.stateValues.hasLatex};if(gs.stateValues.forObjectComponentName){hs[gs.stateValues.forObjectComponentName]=ys;let bs=ps.indexOf(gs.stateValues.forObjectComponentName);if(bs!==-1){let vs=ds[bs];ss.isInheritedComponentType({inheritedComponentType:vs.componentType,baseComponentType:"point"})?ls.push(vs.stateValues.styleNumber):ns.displayClosedSwatches&&ss.allComponentClasses[vs.componentType].representsClosedPath?us.push(vs.stateValues.styleNumber):vs.componentType!=="legend"&&cs.push(vs.stateValues.styleNumber)}}fs.push({labelInfo:ys,forObject:gs.stateValues.forObjectComponentName})}for(let gs of fs){let ys;if(gs.forObject){let bs=ps.indexOf(gs.forObject);bs!==-1&&(ys=ds[bs],ds.splice(bs,1),ps.splice(bs,1))}else for(let bs=0;bs({graphAncestor:{dependencyType:"ancestor",componentType:"graph",variableNames:["xmin","xmax","ymin","ymax"]}}),definition({dependencyValues:ns}){return ns.graphAncestor?{setValue:{graphLimits:ns.graphAncestor.stateValues}}:{setValue:{graphLimits:null}}}},rs}}zs(Legend,"componentType","legend");class MatchesPattern extends BooleanComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.pattern={createComponentOfType:"math"},rs.allowImplicitIdentities={createComponentOfType:"boolean",createStateVariable:"allowImplicitIdentities",defaultValue:!1,public:!0},rs.allowPermutations={createComponentOfType:"boolean",createStateVariable:"allowPermutations",defaultValue:!0,public:!0},rs.requireNumericMatches={createComponentOfType:"boolean",createStateVariable:"requireNumericMatches",defaultValue:!1,public:!0},rs.requireVariableMatches={createComponentOfType:"boolean",createStateVariable:"requireVariableMatches",defaultValue:!1,public:!0},rs.excludeMatches={createComponentOfType:"mathList",createStateVariable:"excludeMatches",defaultValue:[],public:!0},rs.matchExpressionWithBlanks={createComponentOfType:"boolean",createStateVariable:"matchExpressionWithBlanks",defaultValue:!1,public:!0},rs}static returnSugarInstructions(){let rs=[],ns=function({matchedChildren:ss,componentInfoObjects:os}){return ss.length===0||ss.length===1&&os.componentIsSpecifiedType(ss[0],"math")?{success:!1}:{success:!0,newChildren:[{componentType:"math",children:ss}]}};return rs.push({replacementFunction:ns}),rs}static returnChildGroups(){return[{group:"maths",componentTypes:["math"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return delete rs.parsedExpression,delete rs.mathChildrenByCode,rs.pattern={additionalStateVariablesDefined:["patternVariables"],returnDependencies:()=>({patternAttr:{dependencyType:"attributeComponent",attributeName:"pattern",variableNames:["value"]}}),definition({dependencyValues:ns}){let ss=[];if(!ns.patternAttr)return{setValue:{pattern:"_",patternVariables:ss}};let os=ns.patternAttr.stateValues.value.variables(),ls=26*27+1;function us(ds){if(ds==="_"){let ps=numberToLetters(ls);for(ls++;os.includes(ps);)ps=numberToLetters(ls),ls++;return ss.push(ps),ps}else return Array.isArray(ds)?[ds[0],...ds.slice(1).map(us)]:ds}return{setValue:{pattern:us(ns.patternAttr.stateValues.value.tree),patternVariables:ss}}}},rs.value={additionalStateVariablesDefined:[{variableName:"allPatternMatches"}],public:!0,shadowingInstructions:{createComponentOfType:"boolean"},forRenderer:!0,returnDependencies:()=>({pattern:{dependencyType:"stateVariable",variableName:"pattern"},patternVariables:{dependencyType:"stateVariable",variableName:"patternVariables"},mathChildren:{dependencyType:"child",childGroups:["maths"],variableNames:["value"]},allowImplicitIdentities:{dependencyType:"stateVariable",variableName:"allowImplicitIdentities"},allowPermutations:{dependencyType:"stateVariable",variableName:"allowPermutations"},requireNumericMatches:{dependencyType:"stateVariable",variableName:"requireNumericMatches"},requireVariableMatches:{dependencyType:"stateVariable",variableName:"requireVariableMatches"},excludeMatches:{dependencyType:"stateVariable",variableName:"excludeMatches"},matchExpressionWithBlanks:{dependencyType:"stateVariable",variableName:"matchExpressionWithBlanks"}}),definition:function({dependencyValues:ns}){if(ns.mathChildren.length===0)return{setValue:{value:!1,allPatternMatches:[]}};let ss=ns.mathChildren[0].stateValues.value;if(ss.variables().includes("_")&&!ns.matchExpressionWithBlanks)return{setValue:{value:!1,allPatternMatches:[]}};let os={};if(ns.requireNumericMatches){let ps=fs=>!Number.isNaN(Context.fromAst(fs).evaluate_to_constant());ns.patternVariables.forEach(fs=>os[fs]=ps)}else if(ns.requireVariableMatches){let ps=fs=>typeof fs=="string";ns.patternVariables.forEach(fs=>os[fs]=ps)}else ns.patternVariables.forEach(ps=>os[ps]=!0);let ls={variables:os,allow_permutations:ns.allowPermutations};ns.allowImplicitIdentities&&(ls.allow_implicit_identities=ns.patternVariables);let us=ss.match(ns.pattern,ls),cs=!1,ds=[];return us&&(Object.values(us).map(ps=>Context.fromAst(ps)).some(ps=>ns.excludeMatches.some(fs=>ps.variables().some(hs=>fs.equalsViaSyntax(Context.fromAst(hs)))))||(cs=!0,ds=ns.patternVariables.map(ps=>Context.fromAst(us[ps])))),{setValue:{value:cs,allPatternMatches:ds}}}},rs.nMatches={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({allPatternMatches:{dependencyType:"stateVariable",variableName:"allPatternMatches"}}),definition({dependencyValues:ns}){return{setValue:{nMatches:ns.allPatternMatches.length},checkForActualChange:{nMatches:!0}}}},rs.patternMatches={public:!0,shadowingInstructions:{createComponentOfType:"math"},isArray:!0,nDimensions:1,entryPrefixes:["patternMatch"],returnArraySizeDependencies:()=>({nMatches:{dependencyType:"stateVariable",variableName:"nMatches"}}),returnArraySize({dependencyValues:ns}){return[ns.nMatches]},returnArrayDependenciesByKey(){return{globalDependencies:{allPatternMatches:{dependencyType:"stateVariable",variableName:"allPatternMatches"}}}},arrayDefinitionByKey({globalDependencyValues:ns}){let ss={};for(let os=0;os({displayDigitsAttr:{dependencyType:"attributeComponent",attributeName:"displayDigits",variableNames:["value"]},displayDecimalsAttr:{dependencyType:"attributeComponent",attributeName:"displayDecimals",variableNames:["value"]}}),definition({dependencyValues:ns,usedDefault:ss}){if(ns.displayDigitsAttr!==null){let os=ss.displayDigitsAttr,ls=ns.displayDecimalsAttr===null||ss.displayDecimalsAttr;if(!(os||ls)){let us=ns.displayDigitsAttr.shadowDepth;ns.displayDecimalsAttr.shadowDepth({}),definition(){return{setValue:{unordered:!1}}}},rs.matrixSizePre={returnDependencies:()=>({rowChildren:{dependencyType:"child",childGroups:["rows"],variableNames:["nComponents"]},colChildren:{dependencyType:"child",childGroups:["columns"],variableNames:["nComponents"]},mathChildren:{dependencyType:"child",childGroups:["maths"],variableNames:["matrixSize"]},nRowsAttr:{dependencyType:"attributeComponent",attributeName:"nRows",variableNames:["value"]},nColumnsAttr:{dependencyType:"attributeComponent",attributeName:"nColumns",variableNames:["value"]}}),definition({dependencyValues:ns}){let ss=null,os=null;return ns.nRowsAttr&&(ss=ns.nRowsAttr.stateValues.value,Number.isFinite(ss)&&ss>0||(ss=null)),ns.nColumnsAttr&&(os=ns.nColumnsAttr.stateValues.value,Number.isFinite(os)&&os>0||(os=null)),ns.rowChildren.length>0?(ss===null&&(ss=ns.rowChildren.length),os===null&&(os=Math.max(1,...ns.rowChildren.map(ls=>ls.stateValues.nComponents)))):ns.colChildren.length>0?(os===null&&(os=ns.colChildren.length),ss===null&&(ss=Math.max(1,...ns.colChildren.map(ls=>ls.stateValues.nComponents)))):ns.mathChildren.length===1?(ss===null&&(ss=ns.mathChildren[0].stateValues.matrixSize[0]),os===null&&(os=ns.mathChildren[0].stateValues.matrixSize[1])):ss===null?os===null?(ss=0,os=0):ss=1:os===null&&(os=1),{setValue:{matrixSizePre:[ss,os]}}}},rs.matrixPre={isArray:!0,nDimensions:2,hasEssential:!0,returnArraySizeDependencies:()=>({matrixSizePre:{dependencyType:"stateVariable",variableName:"matrixSizePre"}}),returnArraySize({dependencyValues:ns}){return ns.matrixSizePre},returnArrayDependenciesByKey:({arrayKeys:ns})=>{let ss={defaultEntry:{dependencyType:"stateVariable",variableName:"defaultEntry"},rowChildIdentities:{dependencyType:"child",childGroups:["rows"]},colChildIdentities:{dependencyType:"child",childGroups:["columns"]}},os={};for(let ls of ns){let[us,cs]=ls.split(",");os[ls]={rowChild:{dependencyType:"child",childGroups:["rows"],childIndices:[us],variableNames:["math"+(Number(cs)+1)]},colChild:{dependencyType:"child",childGroups:["columns"],childIndices:[cs],variableNames:["math"+(Number(us)+1)]},mathChild:{dependencyType:"child",childGroups:["maths"],childIndices:[0],variableNames:["matrixEntry"+(Number(us)+1)+"_"+(Number(cs)+1)]}}}return{globalDependencies:ss,dependenciesByKey:os}},arrayDefinitionByKey({globalDependencyValues:ns,dependencyValuesByKey:ss,arrayKeys:os,arraySize:ls}){var fs,hs,gs;let us={},cs={},ds=ns.rowChildIdentities.length>0,ps=ns.colChildIdentities.length>0;for(let ys of os){let[bs,vs]=ys.split(","),xs;ds?xs=(fs=ss[ys].rowChild[0])==null?void 0:fs.stateValues["math"+(Number(vs)+1)]:ps?xs=(hs=ss[ys].colChild[0])==null?void 0:hs.stateValues["math"+(Number(bs)+1)]:xs=(gs=ss[ys].mathChild[0])==null?void 0:gs.stateValues["matrixEntry"+(Number(bs)+1)+"_"+(Number(vs)+1)],xs===void 0?cs[ys]={defaultValue:ns.defaultEntry}:us[ys]=xs}return{setValue:{matrixPre:us},useEssentialOrDefaultValue:{matrixPre:cs}}},async inverseArrayDefinitionByKey({desiredStateVariableValues:ns,globalDependencyValues:ss,dependencyValuesByKey:os,dependencyNamesByKey:ls}){var fs,hs,gs;let us=[],cs={},ds=ss.rowChildIdentities.length>0,ps=ss.colChildIdentities.length>0;for(let ys in ns.matrixPre){let[bs,vs]=ys.split(",");ds?((fs=os[ys].rowChild[0])==null?void 0:fs.stateValues["math"+(Number(vs)+1)])===void 0?cs[ys]=ns.matrixPre[ys]:us.push({setDependency:ls[ys].rowChild,desiredValue:ns.matrixPre[ys],childIndex:0,variableIndex:0}):ps?((hs=os[ys].colChild[0])==null?void 0:hs.stateValues["math"+(Number(bs)+1)])===void 0?cs[ys]=ns.matrixPre[ys]:us.push({setDependency:ls[ys].colChild,desiredValue:ns.matrixPre[ys],childIndex:0,variableIndex:0}):((gs=os[ys].mathChild[0])==null?void 0:gs.stateValues["matrixEntry"+(Number(bs)+1)+"_"+(Number(vs)+1)])===void 0?cs[ys]=ns.matrixPre[ys]:us.push({setDependency:ls[ys].mathChild,desiredValue:ns.matrixPre[ys],childIndex:0,variableIndex:0})}return Object.keys(cs).length>0&&us.push({setEssentialValue:"matrixPre",value:cs}),{success:!0,instructions:us}}},rs.unnormalizedValue={returnDependencies:()=>({matrixPre:{dependencyType:"stateVariable",variableName:"matrixPre"},matrixSizePre:{dependencyType:"stateVariable",variableName:"matrixSizePre"}}),definition({dependencyValues:ns}){let ss=["tuple"];for(let ls=0;lsus.tree)]);return{setValue:{unnormalizedValue:Context.fromAst(["matrix",["tuple",...ns.matrixSizePre],ss])}}},inverseDefinition({dependencyValues:ns,desiredStateVariableValues:ss}){var us,cs;let os=ss.unnormalizedValue.tree;if(!(Array.isArray(os)&&os[0]==="matrix"&&((us=os[1])==null?void 0:us[1])===ns.matrixSizePre[0]&&((cs=os[1])==null?void 0:cs[2])===ns.matrixSizePre[1]))return{success:!1};let ls={};for(let ds=0;ds({modifyIndirectly:{dependencyType:"stateVariable",variableName:"modifyIndirectly"},fixed:{dependencyType:"stateVariable",variableName:"fixed"}}),definition({dependencyValues:ns}){return{setValue:{canBeModified:ns.modifyIndirectly&&!ns.fixed}}}},rs}}zs(Matrix,"componentType","matrix"),zs(Matrix,"rendererType","math");class EigenDecomposition extends BaseComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.displayDigits={createComponentOfType:"integer",createStateVariable:"displayDigits",defaultValue:14,public:!0},rs.displayDecimals={createComponentOfType:"integer",createStateVariable:"displayDecimals",defaultValue:null,public:!0},rs.displaySmallAsZero={createComponentOfType:"number",createStateVariable:"displaySmallAsZero",valueForTrue:1e-14,valueForFalse:0,defaultValue:0,public:!0},rs.padZeros={createComponentOfType:"boolean",createStateVariable:"padZeros",defaultValue:!1,public:!0},rs}static returnChildGroups(){return[{group:"maths",componentTypes:["math"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.decomposition={returnDependencies:()=>({mathChild:{dependencyType:"child",childGroups:["maths"],variableNames:["value"]}}),definition({dependencyValues:ns}){if(ns.mathChild.length===0)return{setValue:{decomposition:null}};let ss=ns.mathChild[0].stateValues.value.tree;if(!Array.isArray(ss)||ss[0]!=="matrix")return{setValue:{decomposition:null}};let os=ss[1][1],ls=ss[1][2];if(!(Number.isInteger(os)&&ls===os))return{setValue:{decomposition:null}};let us=[];for(let ds=0;ds({decomposition:{dependencyType:"stateVariable",variableName:"decomposition"}}),returnArraySize({dependencyValues:ns}){let ss;return ns.decomposition?ss=ns.decomposition.values.length:ss=0,[ss]},returnArrayDependenciesByKey(){return{globalDependencies:{decomposition:{dependencyType:"stateVariable",variableName:"decomposition"}}}},arrayDefinitionByKey({globalDependencyValues:ns,arraySize:ss}){let os=[];for(let ls=0;lsNumber(us)-1);return ls.length===2&&ls.every((us,cs)=>Number.isInteger(us)&&us>=0)?os?ls.every((us,cs)=>us=0?os?lsls+","+cs):[]:[ls+",0"]:[]}},arrayVarNameFromPropIndex(ns,ss){if(ss==="eigenvectors")return ns.length===1?"eigenvector"+ns[0]:`eigenvectorX${ns[0]}_${ns[1]}`;if(ss.slice(0,11)==="eigenvector"){let os=Number(ss.slice(11));if(Number.isInteger(os)&&os>0)return`eigenvectorX${os}_${ns[0]}`}return null},entryPrefixes:["eigenvectorX","eigenvector"],returnArraySizeDependencies:()=>({decomposition:{dependencyType:"stateVariable",variableName:"decomposition"}}),returnArraySize({dependencyValues:ns}){let ss;return ns.decomposition?ss=ns.decomposition.values.length:ss=0,[ss,ss]},returnArrayDependenciesByKey(){return{globalDependencies:{decomposition:{dependencyType:"stateVariable",variableName:"decomposition"}}}},arrayDefinitionByKey({globalDependencyValues:ns,arraySize:ss}){let os={};for(let ls=0;lsContext.math.divide(ds,cs));for(let ds=0;ds({mathTextLikeChildren:{dependencyType:"child",childGroups:["mathTextLike"],variableNames:["text","latex"]}}),rs.value.definition=function({dependencyValues:ns}){if(ns.mathTextLikeChildren.length===0)return{useEssentialOrDefaultValue:{value:!0}};let ss="";for(let os of ns.mathTextLikeChildren)typeof os=="string"?ss+=os:os.stateValues.latex!==void 0?ss+=os.stateValues.latex:ss+=os.stateValues.text;return{setValue:{value:ss}}},rs.value.inverseDefinition=function({desiredStateVariableValues:ns,dependencyValues:ss}){var ls;let os=ss.mathTextLikeChildren.length;return os>1?{success:!1}:os===1?{success:!0,instructions:[{setDependency:"textLikeChildren",desiredValue:ns.value,childIndex:0,variableIndex:((ls=ss.textLikeChildren[0].stateValues)==null?void 0:ls.latex)===void 0?0:1}]}:{success:!0,instructions:[{setEssentialValue:"value",value:ns.value===null?"":String(ns.value)}]}},rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},forRenderer:!0,returnDependencies:()=>({value:{dependencyType:"stateVariable",variableName:"value"}}),definition:({dependencyValues:ns})=>({setValue:{text:ns.value}}),inverseDefinition:({desiredStateVariableValues:ns})=>({success:!0,instructions:[{setDependency:"value",desiredValue:ns.text}]})},rs.latex={isAlias:!0,targetVariableName:"value"},rs}}zs(Latex,"componentType","latex"),zs(Latex,"rendererType","text");const unitConversions={"":1,px:1,pixel:1,pixels:1,"%":1,em:100,in:96,inch:96,inches:96,pt:1.333333333333,mm:3.7795296,millimeter:3.7795296,millimeters:3.7795296,cm:37.795296,centimeter:37.795296,centimeters:37.795296};class ComponentSize extends InlineComponent{static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=function({matchedChildren:ss}){let os=ss[ss.length-1];if(typeof os=="string"){let ls=/([a-zA-z]+|%)$/,us=os.trim(),cs=us.match(ls);if(cs){let ds=cs[1];if(ds in unitConversions){let ps=us.slice(0,cs.index),fs=ss.slice(0,ss.length-1);return ps.length>0&&fs.push(ps),{success:!0,newChildren:[{componentType:"number",children:fs},ds]}}}}return{success:!0,newChildren:[{componentType:"number",children:ss}]}};return rs.push({childrenRegex:/..+/,replacementFunction:ns}),rs}static returnChildGroups(){return[{group:"strings",componentTypes:["string"]},{group:"numbers",componentTypes:["number"]},{group:"componentSizes",componentTypes:["_componentSize"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.componentSize={public:!0,shadowingInstructions:{createComponentOfType:"_componentSize"},hasEssential:!0,returnDependencies:()=>({componentSizeChild:{dependencyType:"child",childGroups:["componentSizes"],variableNames:["componentSize"]},numberChild:{dependencyType:"child",childGroups:["numbers"],variableNames:["value"]},stringChild:{dependencyType:"child",childGroups:["strings"],variableNames:["value"]},parentDefaultAbsoluteSize:{dependencyType:"parentStateVariable",variableName:"defaultAbsoluteSize"}}),definition({dependencyValues:ns}){let ss=ns.parentDefaultAbsoluteSize===void 0?!1:ns.parentDefaultAbsoluteSize;if(ns.stringChild.length===0)return ns.numberChild.length===0?ns.componentSizeChild.length===0?{useEssentialOrDefaultValue:{componentSize:{defaultValue:{size:100,isAbsolute:ss}}}}:{setValue:{componentSize:ns.componentSizeChild[0].stateValues.componentSize}}:{setValue:{componentSize:{size:ns.numberChild[0].stateValues.value,isAbsolute:!0}}};{let os,ls;if(ns.numberChild.length>0)os=ns.numberChild[0].stateValues.value,ls=ns.stringChild[0].trim();else{let ps=ns.stringChild[0].trim().match(/^(-?[\d.]+)\s*(.*)$/);if(ps===null)return{setValue:{componentSize:null}};os=ps[1],ls=ps[2].trim()}if(os=Number(os),!Number.isFinite(os))return{setValue:{componentSize:null}};let us=!(ls==="%"||ls==="em"),cs=unitConversions[ls];return cs===void 0&&(cs=1),{setValue:{componentSize:{size:cs*os,isAbsolute:us}}}}},inverseDefinition({desiredStateVariableValues:ns,dependencyValues:ss}){if(ss.stringChild.length===0)return ss.numberChild.length===0?ss.componentSizeChild.length===0?{success:!0,instructions:[{setEssentialValue:"componentSize",value:ns.componentSize}]}:{success:!0,instructions:[{setDependency:"componentSizeChild",desiredValue:ns.componentSize,childIndex:0,variableIndex:0}]}:ns.componentSize.isAbsolute?{success:!0,instructions:[{setDependency:"numberChild",desiredValue:ns.componentSize.size,childIndex:0,variableIndex:0}]}:{success:!1};if(ss.numberChild.length>0){let os=ss.stringChild[0].trim(),ls=!(os==="%"||os==="em");if(ns.componentSize.isAbsolute!==ls)return{success:!1};let us=unitConversions[os];return us===void 0&&(us=1),{success:!0,instructions:[{setDependency:"numberChild",desiredValue:ns.componentSize.size/us,childIndex:0,variableIndex:0}]}}else{let os=ns.componentSize.size;return ns.componentSize.isAbsolute?os+="px":os+="%",{success:!0,instructions:[{setDependency:"stringChild",desiredValue:os,childIndex:0,variableIndex:0}]}}}},rs.number={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({componentSize:{dependencyType:"stateVariable",variableName:"componentSize"}}),definition({dependencyValues:ns}){let ss=null;return ns.componentSize&&(ss=ns.componentSize.size),{setValue:{number:ss}}},inverseDefinition({desiredStateVariableValues:ns,dependencyValues:ss}){return ss.componentSize?{success:!0,instructions:[{setDependency:"componentSize",desiredValue:{size:ns.number,isAbsolute:ss.componentSize.isAbsolute}}]}:{success:!1}}},rs.math=mathStateVariableFromNumberStateVariable({numberVariableName:"number",mathVariableName:"math",isPublic:!0}),rs.isAbsolute={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},returnDependencies:()=>({componentSize:{dependencyType:"stateVariable",variableName:"componentSize"}}),definition({dependencyValues:ns}){let ss=null;return ns.componentSize&&(ss=ns.componentSize.isAbsolute),{setValue:{isAbsolute:ss}}}},rs.text={forRenderer:!0,returnDependencies:()=>({componentSize:{dependencyType:"stateVariable",variableName:"componentSize"}}),definition({dependencyValues:ns}){let ss="";return ns.componentSize&&(ss=ns.componentSize.size,ns.componentSize.isAbsolute?ss+="px":ss+="%"),{setValue:{text:ss}}}},rs}}zs(ComponentSize,"componentType","_componentSize"),zs(ComponentSize,"rendererType","text"),zs(ComponentSize,"primaryStateVariableForDefinition","componentSize"),zs(ComponentSize,"stateVariableForAttributeValue","componentSize"),zs(ComponentSize,"adapters",["number","math"]);class ComponentSizeList extends BaseComponent{static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=function({matchedChildren:ss}){let os=[],ls=[],us=function(){ls.length>0&&(os.push({componentType:"_componentSize",children:ls}),ls=[])};for(let cs of ss)if(typeof cs=="string"){let ds=cs.split(/\s+/);ds[0].length===0&&(us(),ds=ds.slice(1));for(let[ps,fs]of ds.entries())fs.length>0?(ls.push(fs),ps({}),definition:()=>({setValue:{overrideChildHide:!0}})},rs.nComponents={public:!0,shadowingInstructions:{createComponentOfType:"number"},additionalStateVariablesDefined:["childIndexByArrayKey"],returnDependencies(){return{componentSizeListChildren:{dependencyType:"child",childGroups:["componentSizeLists"],variableNames:["nComponents"]},componentSizeAndComponentSizeListChildren:{dependencyType:"child",childGroups:["componentSizes","componentSizeLists"],skipComponentNames:!0}}},definition:function({dependencyValues:ns,componentInfoObjects:ss}){let os=0,ls=[],us=0;for(let[cs,ds]of ns.componentSizeAndComponentSizeListChildren.entries())if(ss.isInheritedComponentType({inheritedComponentType:ds.componentType,baseComponentType:"_componentSizeList"})){let ps=ns.componentSizeListChildren[us];us++;for(let fs=0;fs({nComponents:{dependencyType:"stateVariable",variableName:"nComponents"}}),returnArraySize({dependencyValues:ns}){return[ns.nComponents]},returnArrayDependenciesByKey({arrayKeys:ns,stateValues:ss}){let os={},ls={childIndexByArrayKey:{dependencyType:"stateVariable",variableName:"childIndexByArrayKey"}};for(let us of ns){let cs=[],ds="1";ss.childIndexByArrayKey[us]&&(cs=[ss.childIndexByArrayKey[us][0]],ds=ss.childIndexByArrayKey[us][1]+1),os[us]={componentSizeAndComponentSizeListChildren:{dependencyType:"child",childGroups:["componentSizes","componentSizeLists"],variableNames:["componentSize","componentSize"+ds],variablesOptional:!0,childIndices:cs}}}return{globalDependencies:ls,dependenciesByKey:os}},arrayDefinitionByKey({globalDependencyValues:ns,dependencyValuesByKey:ss,arrayKeys:os,componentInfoObjects:ls}){let us={};for(let cs of os){let ds=ss[cs].componentSizeAndComponentSizeListChildren[0];if(ds)if(ls.isInheritedComponentType({inheritedComponentType:ds.componentType,baseComponentType:"_componentSizeList"})){let ps=ns.childIndexByArrayKey[cs][1]+1;us[cs]=ds.stateValues["componentSize"+ps]}else us[cs]=ds.stateValues.componentSize}return{setValue:{componentSizes:us}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ns,globalDependencyValues:ss,dependencyValuesByKey:os,dependencyNamesByKey:ls,arraySize:us,componentInfoObjects:cs}){let ds=[];for(let ps in ns.componentSizes){if(!os[ps])continue;let fs=os[ps].componentSizeAndComponentSizeListChildren[0];fs&&(cs.isInheritedComponentType({inheritedComponentType:fs.componentType,baseComponentType:"_componentSizeList"})?ds.push({setDependency:ls[ps].componentSizeAndComponentSizeListChildren,desiredValue:ns.componentSizes[ps],childIndex:0,variableIndex:1}):ds.push({setDependency:ls[ps].componentSizeAndComponentSizeListChildren,desiredValue:ns.componentSizes[ps],childIndex:0,variableIndex:0}))}return{success:!0,instructions:ds}}},rs.nValues={isAlias:!0,targetVariableName:"nComponents"},rs.values={isAlias:!0,targetVariableName:"componentSizes"},rs}}zs(ComponentSizeList,"componentType","_componentSizeList"),zs(ComponentSizeList,"rendererType","asList"),zs(ComponentSizeList,"renderChildren",!0),zs(ComponentSizeList,"stateVariableForAttributeValue","componentSizes");const ComponentSize$1=Object.freeze(Object.defineProperty({__proto__:null,ComponentSize,ComponentSizeList},Symbol.toStringTag,{value:"Module"})),componentTypeArray=[...Object.values(Aliases),...Object.values(MMeMen),...Object.values(MdMdnMrow),...Object.values(BooleanOperators),...Object.values(BooleanOperatorsOfMath),...Object.values(MathOperators),...Object.values(FunctionOperators),...Object.values(TextOperatorsOfMath),...Object.values(Extrema$1),...Object.values(ParagraphMarkup),...Object.values(SingleCharacterComponents),...Object.values(Sectioning),...Object.values(Lists),...Object.values(DynamicalSystems),...Object.values(Chemistry),...Object.values(FeedbackDefinitions$1),...Object.values(StyleDefinitions$1),...Object.values(SideBySide$2),...Object.values(ComponentWithSelectableType$1),...Object.values(Indexing),...Object.values(Divisions),...Object.values(Verbatim),...Object.values(Paginator$1),...Object.values(MatrixInput$1),Document,Text,TextList$1,TextList,P$2,BooleanComponent,BooleanList,MathComponent,MathList,TupleList,NumberList,NumberListFromString,Copy,Extract,Collect,Ref,Point,Coords,Line,LineSegment,Ray,Polyline,Polygon,Triangle,Rectangle,RegularPolygon,Circle,Parabola,Curve,BezierControls,ControlVectors,Vector,Angle,Answer,Award,When,MathInput,Textinput,BooleanInput,Choiceinput,Choice,NumberComponent,Integer,Graph$1,Variables,Variable,Function$1,PiecewiseFunction,Interval,Template,Option$1,Sequence,Slider,Spreadsheet,DiscreteSimulationResultList,DiscreteSimulationResultPolyline,Cell,Row,Column,CellBlock,Tabular,Table$1,Figure,Markers,Panel,Map$1,Sources,Pegboard,Constraints,ConstrainToGrid,ConstrainToGraph,AttractToGrid,ConstrainTo,AttractTo,ConstraintUnion,AttractToConstraint,Intersection,ConstrainToAngles,AttractToAngles,ConditionalContent,AsList,VariantControl,TextListFromString,SelectFromSequence,Select,Group,AnimateFromSequence,Evaluate,SelectRandomNumbers,SampleRandomNumbers,Substitute,PeriodicSet,Image$1,Video,Embed,Hint,Solution,IntComma,Pluralize,Feedback,CollaborateGroups,CollaborateGroupSetup,ConsiderAsResponses,Case,Lorem,UpdateValue,CallAction,triggerSet,FunctionIterates,Module,CustomAttribute,Setup,Footnote,Caption,Endpoint,Sort,Shuffle,SolveEquations,SolutionContainer,SubsetOfRealsInput,SubsetOfReals,Split,BestFitLine,RegionBetweenCurveXAxis,RegionHalfPlane,CodeEditor,CodeViewer,RenderDoenetML,HasSameFactoring,DataFrame,SummaryStatistics,Chart,Legend,Label$1,MatchesPattern,Matrix,EigenDecomposition,Latex,BaseComponent,InlineComponent,BlockComponent,GraphicalComponent,ConstraintComponent,Input,CompositeComponent,PointListComponent,IntervalListComponent,LineListComponent,VectorListComponent,AngleListComponent,BooleanOperator,BooleanBaseOperatorOfMath,MathOperator,MathOperatorOneInput,FunctionOperator,...Object.values(ComponentSize$1),SectioningComponent,InlineRenderInlineChildren,TextOrInline,SingleCharacter];function allComponentClasses(){const as={},rs=new Set;for(let ns of componentTypeArray){let ss=ns.componentType;if(ss===void 0)throw Error("Cannot create component as componentType is undefined for class "+ns);let os=ss.toLowerCase();if(rs.has(os))throw Error("component type "+ss+" defined in two classes");as[ss]=ns,rs.add(os)}return as}function componentTypesCreatingVariants(){const as={},rs=new Set;for(let ns of componentTypeArray)if(ns.createsVariants){let ss=ns.componentType;if(ss===void 0)throw Error("Cannot create component as componentType is undefined for class "+ns);let os=ss.toLowerCase();if(rs.has(os))throw Error("component type "+ss+" defined in two classes");as[ss]=ns,rs.add(os)}return as}/*! https://mths.be/cssesc v3.0.0 by @mathias */var object={},hasOwnProperty$1=object.hasOwnProperty,merge=function as(rs,ns){if(!rs)return ns;var ss={};for(var os in ns)ss[os]=hasOwnProperty$1.call(rs,os)?rs[os]:ns[os];return ss},regexAnySingleEscape=/[ -,\.\/:-@\[-\^`\{-~]/,regexSingleEscape=/[ -,\.\/:-@\[\]\^`\{-~]/,regexExcessiveSpaces=/(^|\\+)?(\\[A-F0-9]{1,6})\x20(?![a-fA-F0-9\x20])/g,cssesc=function as(rs,ns){ns=merge(ns,as.options),ns.quotes!="single"&&ns.quotes!="double"&&(ns.quotes="single");for(var ss=ns.quotes=="double"?'"':"'",os=ns.isIdentifier,ls=rs.charAt(0),us="",cs=0,ds=rs.length;cs126){if(fs>=55296&&fs<=56319&&csasync({coreId:Ql,componentName:Kl,stateValues:Il,childrenInstructions:$l,sourceOfUpdate:Yl,baseStateVariable:Zl,actionId:eu})=>{let tu=!1,nu=Ql+Kl;if(Zl){let iu=Ll.getLoadable(rendererUpdatesToIgnore(nu)).contents;if(Object.keys(iu).length>0){let su=iu[eu],lu=Il[Zl];su===lu||Array.isArray(su)&&Array.isArray(lu)&&su.length==lu.length&&su.every((fu,ou)=>lu[ou]===fu)?(tu=!0,Hl(rendererUpdatesToIgnore(nu),fu=>{let ou={...fu};return delete ou[eu],ou})):Hl(rendererUpdatesToIgnore(nu),{})}}let ru={stateValues:Il,childrenInstructions:$l,sourceOfUpdate:Yl,ignoreUpdate:tu,prefixForIds:js};if($l===void 0){let iu=Ll.getLoadable(rendererState(nu)).contents;ru.childrenInstructions=iu.childrenInstructions}Hl(rendererState(nu),ru)}),ss=Recoil_index_31(({snapshot:Ll,set:Hl})=>async({coreId:Ql,componentName:Kl,baseVariableValue:Il,actionId:$l})=>{let Yl=Ql+Kl;Hl(rendererUpdatesToIgnore(Yl),Zl=>{let eu={...Zl};return eu[$l]=Il,eu})}),[os,ls]=reactExports.useState(null),[us,cs]=reactExports.useState(null),[ds,ps]=reactExports.useState(null),[fs,hs]=reactExports.useState(null),[gs,ys]=reactExports.useState(null),[bs,vs]=reactExports.useState(null),[xs,Cs]=reactExports.useState(null),[Ts,Ss]=reactExports.useState(null),[Ns,As]=reactExports.useState("initial"),[ws,Es]=reactExports.useState(!1),[_s,$s]=reactExports.useState(null),Rs=reactExports.useRef({}),Is=reactExports.useRef({}),Os=reactExports.useRef(null),Ds=reactExports.useRef(!1),Vs=reactExports.useRef(null),ks=reactExports.useRef(null),Ps=reactExports.useRef([]),Bs=reactExports.useRef(null),Ms=reactExports.useRef(!1),Ws=reactExports.useRef({}),Us=reactExports.useRef({}),js=as.prefixForIds||"",Ls=reactExports.useRef([]),Gs=Recoil_index_20(darkModeAtom),Hs=Recoil_index_20(pageToolViewAtom),Ys=Recoil_index_20(itemByDoenetId(as.doenetId));Recoil_index_20(scrollableContainerAtom);let Xs=useNavigate(),Nl=useLocation(),xl=Nl.hash;reactExports.useEffect(()=>{Bs.current&&(Bs.current.onmessage=function(Ll){var Hl,Ql,Kl;Ll.data.messageType==="updateRenderers"?Ll.data.init&&Os.current||qs(Ll.data.args):Ll.data.messageType==="requestAnimationFrame"?Al(Ll.data.args):Ll.data.messageType==="cancelAnimationFrame"?Vl(Ll.data.args):Ll.data.messageType==="coreCreated"?(Ds.current=!0,Ms.current=!1,As("coreCreated"),(Hl=as.coreCreatedCallback)==null||Hl.call(as,Bs.current)):Ll.data.messageType==="initializeRenderers"?Os.current&&JSON.stringify(Os.current)===JSON.stringify(Ll.data.args.coreInfo)||Zs(Ll.data.args):Ll.data.messageType==="updateCreditAchieved"?(Ql=as.updateCreditAchievedCallback)==null||Ql.call(as,Ll.data.args):Ll.data.messageType==="savedState"?(Kl=as.saveStateCallback)==null||Kl.call(as):Ll.data.messageType==="sendToast"?(console.log(`Sending toast message: ${Ll.data.args.message}`),rs(Ll.data.args.message,Ll.data.args.toastType)):Ll.data.messageType==="resolveAction"?Qs(Ll.data.args):Ll.data.messageType==="returnAllStateVariables"?(console.log(Ll.data.args),ks.current(Ll.data.args)):Ll.data.messageType==="componentRangePieces"?window["componentRangePieces"+bs]=Ll.data.args.componentRangePieces:Ll.data.messageType==="inErrorState"?(as.setIsInErrorState&&as.setIsInErrorState(!0),ls(Ll.data.args.errMsg)):Ll.data.messageType==="resetPage"?Js(Ll.data.args):Ll.data.messageType==="copyToClipboard"?Fs(Ll.data.args):Ll.data.messageType==="navigateToTarget"?Cl(Ll.data.args):Ll.data.messageType==="terminated"&&Dl()})},[Bs.current]),reactExports.useEffect(()=>()=>{Bs.current&&Bs.current.postMessage({messageType:"terminate"})},[]),reactExports.useEffect(()=>{bs!==null&&(window["returnAllStateVariables"+bs]=function(){return Bs.current.postMessage({messageType:"returnAllStateVariables"}),new Promise((Ll,Hl)=>{ks.current=Ll})},window["callAction"+bs]=async function({actionName:Ll,componentName:Hl,args:Ql}){await Rl({action:{actionName:Ll,componentName:Hl},args:Ql})})},[bs]),reactExports.useEffect(()=>()=>{Ms.current=!0;for(let Ll in Ws.current)Vl(Ll);Ws.current={}},[]),reactExports.useEffect(()=>{document.addEventListener("visibilitychange",()=>{Bs.current&&Bs.current.postMessage({messageType:"visibilityChange",args:{visible:document.visibilityState==="visible"}})})},[]),reactExports.useEffect(()=>{if(xl&&Ds.current&&Bs.current){let Ll=xl.slice(1);Ll.substring(0,js.length)===js&&Bs.current.postMessage({messageType:"navigatingToComponent",args:{componentName:Ll.substring(js.length)}})}},[Nl,xl,Ds.current,Bs.current]),reactExports.useEffect(()=>{var Ll;if(xl&&_s&&as.pageIsActive){let Hl=xl.slice(1);(!Ls.current.includes(Nl.key)||Nl.key==="default")&&Hl.length>js.length&&Hl.substring(0,js.length)===js&&((Ll=document.getElementById(cssesc_1(Hl)))==null||Ll.scrollIntoView()),Ls.current.push(Nl.key)}},[Nl,xl,_s,as.pageIsActive]),reactExports.useEffect(()=>{Rl({action:{actionName:"setTheme"},args:{theme:Gs}})},[Gs]);function Dl(){Ms.current=!0,Bs.current.terminate(),Bs.current=null;for(let Ll in Ws.current)Vl(Ll);Ws.current={}}async function Rl({action:Ll,args:Hl,baseVariableValue:Ql,componentName:Kl,rendererType:Il}){var $l,Yl;if(Ds.current||!(($l=Is.current[Il])!=null&&$l.ignoreActionsWithoutCore)){let Zl=nanoid();Hl={...Hl},Hl.actionId=Zl,Ql!==void 0&&Kl&&ss({coreId:Vs.current,componentName:Kl,baseVariableValue:Ql,actionId:Zl});let eu={actionName:Ll.actionName,componentName:Ll.componentName,args:Hl};return(Yl=Bs.current)==null||Yl.postMessage({messageType:"requestAction",args:eu}),Ds.current||Ps.current.push(eu),new Promise((tu,nu)=>{Us.current[Zl]=tu})}}function Ml({rendererState:Ll,forceDisable:Hl,forceShowCorrectness:Ql,forceShowSolution:Kl,forceUnsuppressCheckwork:Il}){var $l;for(let Yl in Ll){let Zl=Ll[Yl].stateValues;if(Hl&&Zl.disabled===!1&&(Zl.disabled=!0),Ql&&Zl.showCorrectness===!1&&(Zl.showCorrectness=!0),Il&&Zl.suppressCheckwork===!0&&(Zl.suppressCheckwork=!1),Kl&&(($l=Ll[Yl].childrenInstructions)==null?void 0:$l.length)>0){for(let eu of Ll[Yl].childrenInstructions)if(eu.componentType==="solution"){let tu=eu.componentName;Ll[tu].stateValues.hidden&&(Ll[tu].stateValues.hidden=!1)}}}}function Zs(Ll){if(Ll.rendererState){delete Ll.rendererState.__componentNeedingUpdateValue,(as.forceDisable||as.forceShowCorrectness||as.forceShowSolution||as.forceUnsuppressCheckwork)&&Ml({rendererState:Ll.rendererState,...as});for(let Il in Ll.rendererState)ns({coreId:Vs.current,componentName:Il,stateValues:Ll.rendererState[Il].stateValues,childrenInstructions:Ll.rendererState[Il].childrenInstructions})}Os.current=Ll.coreInfo,as.generatedVariantCallback&&as.generatedVariantCallback(JSON.parse(Os.current.generatedVariantString,serializedComponentsReviver),Os.current.allPossibleVariants);let Hl=[],Ql=[];for(let Il of Os.current.rendererTypesInDocument)Ql.push(Il),Hl.push(__variableDynamicImportRuntimeHelper(Object.assign({"./renderers/alert.jsx":()=>__vitePreload(()=>import("./alert-2aac55be.js"),[]),"./renderers/angle.jsx":()=>__vitePreload(()=>import("./angle-16184609.js"),["assets/angle-16184609.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/answer.jsx":()=>__vitePreload(()=>import("./answer-4e2755f1.js"),[]),"./renderers/asList.jsx":()=>__vitePreload(()=>import("./asList-282c8072.js"),[]),"./renderers/boolean.jsx":()=>__vitePreload(()=>import("./boolean-37db2c5b.js"),[]),"./renderers/booleanInput.jsx":()=>__vitePreload(()=>import("./booleanInput-3b0c7c6a.js"),["assets/booleanInput-3b0c7c6a.js","assets/ToggleButton-0b55a995.js","assets/booleanInput-01650bf1.css"]),"./renderers/c.jsx":()=>__vitePreload(()=>import("./c-e2b89d31.js"),[]),"./renderers/callAction.jsx":()=>__vitePreload(()=>import("./callAction-c6bb5e7a.js"),[]),"./renderers/cell.jsx":()=>__vitePreload(()=>import("./cell-8f0e6a31.js"),[]),"./renderers/chart.jsx":()=>__vitePreload(()=>import("./chart-ce435d1f.js"),["assets/chart-ce435d1f.js","assets/visibility-sensor-398e690f.js"]),"./renderers/choiceInput.jsx":()=>__vitePreload(()=>import("./choiceInput-af5757a7.js"),["assets/choiceInput-af5757a7.js","assets/choiceInput-92287600.css"]),"./renderers/circle.jsx":()=>__vitePreload(()=>import("./circle-6641f664.js"),["assets/circle-6641f664.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/cobwebPolyline.jsx":()=>__vitePreload(()=>import("./cobwebPolyline-579fad3e.js"),["assets/cobwebPolyline-579fad3e.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/codeEditor.jsx":()=>__vitePreload(()=>import("./codeEditor-35261aaa.js"),["assets/codeEditor-35261aaa.js","assets/css-14ccef8c.js","assets/CodeMirror-d3d9f7d1.js","assets/visibility-sensor-398e690f.js"]),"./renderers/codeViewer.jsx":()=>__vitePreload(()=>import("./codeViewer-0faccbae.js"),["assets/codeViewer-0faccbae.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/containerBlock.jsx":()=>__vitePreload(()=>import("./containerBlock-87e84c0a.js"),["assets/containerBlock-87e84c0a.js","assets/visibility-sensor-398e690f.js"]),"./renderers/containerInline.jsx":()=>__vitePreload(()=>import("./containerInline-54e6bb2d.js"),[]),"./renderers/curve.jsx":()=>__vitePreload(()=>import("./curve-da578ee9.js"),["assets/curve-da578ee9.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/ellipsis.jsx":()=>__vitePreload(()=>import("./ellipsis-f2d5fc3f.js"),[]),"./renderers/em.jsx":()=>__vitePreload(()=>import("./em-d5d3f25f.js"),[]),"./renderers/embed.jsx":()=>__vitePreload(()=>import("./embed-51d0f72d.js"),["assets/embed-51d0f72d.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/feedback.jsx":()=>__vitePreload(()=>import("./feedback-13937dc4.js"),["assets/feedback-13937dc4.js","assets/index-47ca4f11.js","assets/visibility-sensor-398e690f.js"]),"./renderers/figure.jsx":()=>__vitePreload(()=>import("./figure-0b18cdc0.js"),["assets/figure-0b18cdc0.js","assets/visibility-sensor-398e690f.js","assets/index.esm-d246f4c9.js","assets/setPrototypeOf-51e8cf87.js"]),"./renderers/footnote.jsx":()=>__vitePreload(()=>import("./footnote-4a0bce52.js"),[]),"./renderers/graph.jsx":()=>__vitePreload(()=>import("./graph-1ff63df5.js"),["assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/hint.jsx":()=>__vitePreload(()=>import("./hint-5302af12.js"),["assets/hint-5302af12.js","assets/index-47ca4f11.js","assets/visibility-sensor-398e690f.js"]),"./renderers/image.jsx":()=>__vitePreload(()=>import("./image-8c34613a.js"),["assets/image-8c34613a.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/label.jsx":()=>__vitePreload(()=>import("./label-0082a454.js"),["assets/label-0082a454.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/legend.jsx":()=>__vitePreload(()=>import("./legend-b70946f9.js"),["assets/legend-b70946f9.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/line.jsx":()=>__vitePreload(()=>import("./line-967c1dc1.js"),["assets/line-967c1dc1.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/lineSegment.jsx":()=>__vitePreload(()=>import("./lineSegment-bdbc44a3.js"),["assets/lineSegment-bdbc44a3.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/list.jsx":()=>__vitePreload(()=>import("./list-6e9609f2.js"),["assets/list-6e9609f2.js","assets/visibility-sensor-398e690f.js"]),"./renderers/math.jsx":()=>__vitePreload(()=>import("./math-4022ba18.js"),["assets/math-4022ba18.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/mathInput.jsx":()=>__vitePreload(()=>import("./mathInput-9baa2704.js"),["assets/mathInput-9baa2704.js","assets/MathInputSelector-84e903aa.js","assets/mathInput-cbd86307.css"]),"./renderers/mathList.jsx":()=>__vitePreload(()=>import("./mathList-438e20fc.js"),[]),"./renderers/matrixInput.jsx":()=>__vitePreload(()=>import("./matrixInput-520e93f2.js"),["assets/matrixInput-520e93f2.js","assets/ActionButton-be9a12e7.js","assets/ActionButtonGroup-f3a36748.js","assets/mathInput-cbd86307.css"]),"./renderers/mdash.jsx":()=>__vitePreload(()=>import("./mdash-c7488048.js"),[]),"./renderers/nbsp.jsx":()=>__vitePreload(()=>import("./nbsp-be2f0b5b.js"),[]),"./renderers/ndash.jsx":()=>__vitePreload(()=>import("./ndash-6a81221e.js"),[]),"./renderers/number.jsx":()=>__vitePreload(()=>import("./number-9f233528.js"),[]),"./renderers/numberList.jsx":()=>__vitePreload(()=>import("./numberList-430714f6.js"),[]),"./renderers/orbitalDiagram.jsx":()=>__vitePreload(()=>import("./orbitalDiagram-668225b9.js"),["assets/orbitalDiagram-668225b9.js","assets/visibility-sensor-398e690f.js"]),"./renderers/orbitalDiagramInput.jsx":()=>__vitePreload(()=>import("./orbitalDiagramInput-667388be.js"),["assets/orbitalDiagramInput-667388be.js","assets/visibility-sensor-398e690f.js"]),"./renderers/p.jsx":()=>__vitePreload(()=>import("./p-6db7a549.js"),["assets/p-6db7a549.js","assets/visibility-sensor-398e690f.js"]),"./renderers/paginatorControls.jsx":()=>__vitePreload(()=>import("./paginatorControls-3d3c1544.js"),[]),"./renderers/pegboard.jsx":()=>__vitePreload(()=>import("./pegboard-0651b50e.js"),["assets/pegboard-0651b50e.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/point.jsx":()=>__vitePreload(()=>import("./point-7d0d29c6.js"),["assets/point-7d0d29c6.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/polygon.jsx":()=>__vitePreload(()=>import("./polygon-45e4e0cc.js"),["assets/polygon-45e4e0cc.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/polyline.jsx":()=>__vitePreload(()=>import("./polyline-0b825c88.js"),["assets/polyline-0b825c88.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/pre.jsx":()=>__vitePreload(()=>import("./pre-1272c629.js"),["assets/pre-1272c629.js","assets/visibility-sensor-398e690f.js"]),"./renderers/q.jsx":()=>__vitePreload(()=>import("./q-199e8b0b.js"),[]),"./renderers/ray.jsx":()=>__vitePreload(()=>import("./ray-41a10f15.js"),["assets/ray-41a10f15.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/ref.jsx":()=>__vitePreload(()=>import("./ref-ee7f7b38.js"),[]),"./renderers/regionBetweenCurveXAxis.jsx":()=>__vitePreload(()=>import("./regionBetweenCurveXAxis-ce0800c5.js"),["assets/regionBetweenCurveXAxis-ce0800c5.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/row.jsx":()=>__vitePreload(()=>import("./row-4df1652c.js"),[]),"./renderers/section.jsx":()=>__vitePreload(()=>import("./section-209bdcaa.js"),["assets/section-209bdcaa.js","assets/visibility-sensor-398e690f.js"]),"./renderers/sideBySide.jsx":()=>__vitePreload(()=>import("./sideBySide-b357db24.js"),["assets/sideBySide-b357db24.js","assets/visibility-sensor-398e690f.js"]),"./renderers/slider.jsx":()=>__vitePreload(()=>import("./slider-71d66f00.js"),["assets/slider-71d66f00.js","assets/ActionButton-be9a12e7.js","assets/ActionButtonGroup-f3a36748.js"]),"./renderers/solution.jsx":()=>__vitePreload(()=>import("./solution-87ce998d.js"),["assets/solution-87ce998d.js","assets/visibility-sensor-398e690f.js"]),"./renderers/spreadsheet.jsx":()=>__vitePreload(()=>import("./spreadsheet-fc3aeca1.js"),["assets/spreadsheet-fc3aeca1.js","assets/moment-b216ba57.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js","assets/spreadsheet-f0a2a11b.css"]),"./renderers/sq.jsx":()=>__vitePreload(()=>import("./sq-beafee12.js"),[]),"./renderers/subsetOfRealsInput.jsx":()=>__vitePreload(()=>import("./subsetOfRealsInput-b0dea720.js"),["assets/subsetOfRealsInput-b0dea720.js","assets/ActionButton-be9a12e7.js","assets/ActionButtonGroup-f3a36748.js","assets/ToggleButton-0b55a995.js","assets/ToggleButtonGroup-e9ff9889.js","assets/visibility-sensor-398e690f.js"]),"./renderers/summaryStatistics.jsx":()=>__vitePreload(()=>import("./summaryStatistics-6e0d6adb.js"),["assets/summaryStatistics-6e0d6adb.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/table.jsx":()=>__vitePreload(()=>import("./table-6cd432a0.js"),["assets/table-6cd432a0.js","assets/visibility-sensor-398e690f.js"]),"./renderers/tabular.jsx":()=>__vitePreload(()=>import("./tabular-efc5101f.js"),["assets/tabular-efc5101f.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/tag.jsx":()=>__vitePreload(()=>import("./tag-b10b024c.js"),[]),"./renderers/text.jsx":()=>__vitePreload(()=>import("./text-1978288a.js"),["assets/text-1978288a.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/textInput.jsx":()=>__vitePreload(()=>import("./textInput-b488d15c.js"),["assets/textInput-b488d15c.js","assets/css-14ccef8c.js"]),"./renderers/textList.jsx":()=>__vitePreload(()=>import("./textList-ce45fad3.js"),[]),"./renderers/triggerSet.jsx":()=>__vitePreload(()=>import("./triggerSet-5593c809.js"),[]),"./renderers/updateValue.jsx":()=>__vitePreload(()=>import("./updateValue-cc05d70f.js"),[]),"./renderers/vector.jsx":()=>__vitePreload(()=>import("./vector-e1829ec2.js"),["assets/vector-e1829ec2.js","assets/graph-1ff63df5.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"]),"./renderers/video.jsx":()=>__vitePreload(()=>import("./video-9bb16c8c.js"),["assets/video-9bb16c8c.js","assets/css-14ccef8c.js","assets/visibility-sensor-398e690f.js"])}),`./renderers/${Il}.jsx`));let Kl=Os.current.documentToRender;renderersloadComponent(Hl,Ql).then(Il=>{var Yl;Is.current=Il;let $l=Il[Kl.rendererType];$s(React.createElement($l,{key:Vs.current+Kl.componentName,componentInstructions:Kl,rendererClasses:Il,flags:as.flags,coreId:Vs.current,callAction:Rl})),(Yl=as.renderersInitializedCallback)==null||Yl.call(as)})}function qs({updateInstructions:Ll,actionId:Hl}){var Ql;for(let Kl of Ll)if(Kl.instructionType==="updateRendererStates")for(let{componentName:Il,stateValues:$l,rendererType:Yl,childrenInstructions:Zl}of Kl.rendererStatesToUpdate)ns({coreId:Vs.current,componentName:Il,stateValues:$l,childrenInstructions:Zl,sourceOfUpdate:Kl.sourceOfUpdate,baseStateVariable:(Ql=Is.current[Yl])==null?void 0:Ql.baseStateVariable,actionId:Hl});Qs({actionId:Hl})}function Qs({actionId:Ll}){var Hl,Ql;Ll&&((Ql=(Hl=Us.current)[Ll])==null||Ql.call(Hl),delete Us.current[Ll])}function Js({changedOnDevice:Ll,newCid:Hl,newAttemptNumber:Ql}){Ql!==xs?(rs("Reverted activity as attempt number changed on other device",toastType.ERROR),as.updateAttemptNumber?as.updateAttemptNumber(Ql):(as.setIsInErrorState&&as.setIsInErrorState(!0),ls("how to reset attempt number when not given updateAttemptNumber function?"))):(rs(`Reverted page to state saved on device ${Ll}`,toastType.ERROR),Vs.current=nanoid(),Es(!0))}function El(){const Ll=Vs.current;ds!==void 0?us?cidFromText(ds).then(Hl=>{Ll===Vs.current&&(Hl===us?(ys(ds),hs(us),As("continue")):(as.setIsInErrorState&&as.setIsInErrorState(!0),ls(`doenetML did not match specified cid: ${us}`)))}):cidFromText(ds).then(Hl=>{Ll===Vs.current&&(ys(ds),hs(Hl),As("continue"))}):retrieveTextFileForCid(us,"doenet").then(Hl=>{Ll===Vs.current&&(ys(Hl),hs(us),As("continue"))}).catch(Hl=>{Ll===Vs.current&&(as.setIsInErrorState&&as.setIsInErrorState(!0),ls(`doenetML not found for cid: ${us}`))})}async function _l(){const Ll=Vs.current;let Hl=!1;if(as.flags.allowLocalState){let Ql;try{Ql=await get(`${as.doenetId}|${bs}|${xs}|${fs}`)}catch{}if(Ql){if(as.flags.allowSaveState){let Kl=await Ks(Ql);if(Kl.changedOnDevice){if(Number(Kl.newAttemptNumber)!==xs){Js({changedOnDevice:Kl.changedOnDevice,newCid:Kl.newCid,newAttemptNumber:Number(Kl.newAttemptNumber)});return}else Kl.newCid!==fs&&(as.setIsInErrorState&&as.setIsInErrorState(!0),ls("content changed unexpectedly!"));Ql=Kl.newLocalInfo,console.log(`sending toast: Reverted page to state saved on device ${Kl.changedOnDevice}`),rs(`Reverted page to state saved on device ${Kl.changedOnDevice}`,toastType.ERROR)}}Ql.rendererState.__componentNeedingUpdateValue&&Rl({action:{actionName:"updateValue",componentName:Ql.rendererState.__componentNeedingUpdateValue}}),Zs({rendererState:Ql.rendererState,coreInfo:Ql.coreInfo}),Rs.current={coreState:Ql.coreState,serverSaveId:Ql.saveId,requestedVariant:JSON.parse(Ql.coreInfo.generatedVariantString,serializedComponentsReviver)},Hl=!0}}if(!Hl){const Ql={params:{cid:fs,pageNumber:bs,attemptNumber:xs,doenetId:as.doenetId,userId:as.userId,requestedVariantIndex:Ts,allowLoadState:as.flags.allowLoadState,showCorrectness:as.flags.showCorrectness,solutionDisplayMode:as.flags.solutionDisplayMode,showFeedback:as.flags.showFeedback,showHints:as.flags.showHints,autoSubmit:as.flags.autoSubmit}};try{let Kl=await axios.get("/api/loadPageState.php",Ql);if(!Kl.data.success&&as.flags.allowLoadState){as.setIsInErrorState&&as.setIsInErrorState(!0),ls(`Error loading page state: ${Kl.data.message}`);return}if(Kl.data.loadedState){let Il=JSON.parse(Kl.data.coreInfo,serializedComponentsReviver),$l=JSON.parse(Kl.data.rendererState,serializedComponentsReviver);$l.__componentNeedingUpdateValue&&Rl({action:{actionName:"updateValue",componentName:$l.__componentNeedingUpdateValue}}),Zs({rendererState:$l,coreInfo:Il}),Rs.current={coreState:JSON.parse(Kl.data.coreState,serializedComponentsReviver),serverSaveId:Kl.data.saveId,requestedVariant:JSON.parse(Il.generatedVariantString,serializedComponentsReviver)}}}catch(Kl){if(as.flags.allowLoadState){as.setIsInErrorState&&as.setIsInErrorState(!0),ls(`Error loading page state: ${Kl.message}`);return}}}Ll===Vs.current&&(as.pageIsActive?yl():As("readyToCreateCore"))}async function Ks(Ll){let Hl=await get(`${as.doenetId}|${bs}|${xs}|${fs}|ServerSaveId`),Ql={cid:fs,coreInfo:JSON.stringify(Ll.coreInfo,serializedComponentsReplacer),coreState:JSON.stringify(Ll.coreState,serializedComponentsReplacer),rendererState:JSON.stringify(Ll.rendererState,serializedComponentsReplacer),pageNumber:bs,attemptNumber:xs,doenetId:as.doenetId,saveId:Ll.saveId,serverSaveId:Hl,updateDataOnContentChange:as.updateDataOnContentChange},Kl;try{Kl=await axios.post("/api/savePageState.php",Ql)}catch{return{localInfo:Ll,cid:fs,attemptNumber:xs}}let Il=Kl.data;if(!Il.success)return{localInfo:Ll,cid:fs,attemptNumber:xs};if(await set(`${as.doenetId}|${bs}|${xs}|${fs}|ServerSaveId`,Il.saveId),Il.stateOverwritten){let $l={coreState:JSON.parse(Il.coreState,serializedComponentsReviver),rendererState:JSON.parse(Il.rendererState,serializedComponentsReviver),coreInfo:JSON.parse(Il.coreInfo,serializedComponentsReviver),saveId:Il.saveId};return await set(`${as.doenetId}|${bs}|${Il.attemptNumber}|${Il.cid}`,$l),{changedOnDevice:Il.device,newLocalInfo:$l,newCid:Il.cid,newAttemptNumber:Il.attemptNumber}}return{localInfo:Ll,cid:fs,attemptNumber:xs}}function yl(){var Ll;Bs.current&&Dl(),Bs.current=new Worker(new URL("/assets/CoreWorker-94b9bfba.js",self.location),{type:"module"}),Bs.current.postMessage({messageType:"createCore",args:{coreId:Vs.current,userId:as.userId,doenetML:gs,doenetId:as.doenetId,previousComponentTypeCounts:as.previousComponentTypeCounts,activityCid:as.activityCid,flags:as.flags,theme:Gs,requestedVariantIndex:Ts,pageNumber:bs,attemptNumber:xs,itemNumber:as.itemNumber,updateDataOnContentChange:as.updateDataOnContentChange,serverSaveId:Rs.current.serverSaveId,activityVariantIndex:as.activityVariantIndex,requestedVariant:Rs.current.requestedVariant,stateVariableChanges:Rs.current.coreState?Rs.current.coreState:void 0}}),As("waitingOnCore");for(let Hl of Ps.current)(Ll=Bs.current)==null||Ll.postMessage({messageType:"requestAction",args:Hl})}function Al({action:Ll,actionArgs:Hl,delay:Ql,animationId:Kl}){if(!Ms.current)if(Ql){let Il=window.setTimeout(()=>Sl({action:Ll,actionArgs:Hl,animationId:Kl}),Ql);Ws.current[Kl]={timeoutId:Il}}else Ws.current[Kl]={},Sl({action:Ll,actionArgs:Hl,animationId:Kl})}function Sl({action:Ll,actionArgs:Hl,animationId:Ql}){let Kl=window.requestAnimationFrame(()=>Rl({action:Ll,args:Hl})),Il=Ws.current[Ql];delete Il.timeoutId,Il.animationFrameID=Kl}async function Vl(Ll){let Hl=Ws.current[Ll],Ql=Hl==null?void 0:Hl.timeoutId;Ql!==void 0&&window.clearTimeout(Ql);let Kl=Hl==null?void 0:Hl.animationFrameID;Kl!==void 0&&window.cancelAnimationFrame(Kl),delete Ws.current[Ll]}async function Fs({text:Ll,actionId:Hl}){await navigator.clipboard.writeText(Ll),Qs({actionId:Hl})}async function Cl({cid:Ll,doenetId:Hl,variantIndex:Ql,edit:Kl,hash:Il,page:$l,uri:Yl,targetName:Zl,actionId:eu,componentName:tu,effectiveName:nu}){let ru=js+nu,{targetForATag:iu,url:su,haveValidTarget:lu,externalUri:fu}=getURLFromRef({cid:Ll,doenetId:Hl,variantIndex:Ql,edit:Kl,hash:Il,page:$l,givenUri:Yl,targetName:Zl,pageToolView:Hs,inCourse:Object.keys(Ys).length>0,search:Nl.search,id:ru});lu&&(iu==="_blank"?window.open(su,iu):Xs(su)),Qs({actionId:eu})}if(os!==null)return jsxs("div",{style:{fontSize:"1.3em",marginLeft:"20px",marginTop:"20px"},children:[jsx$1("span",{style:{fontSize:"1em",color:"#C1292E"},children:jsx$1(FontAwesomeIcon,{icon:faExclamationCircle})})," ",os]});let Tl=!1;ds!==as.doenetML&&(ps(as.doenetML),Tl=!0),us!==as.cid&&(cs(as.cid),Tl=!0);let zl=as.pageNumber;zl===void 0&&(zl="1"),zl!==bs&&(vs(zl),Tl=!0);let Xl=as.attemptNumber;Xl===void 0&&(Xl=1),Xl!==xs&&(Cs(Xl),Tl=!0);let Pl=as.requestedVariantIndex;if(Pl===void 0&&(Pl=Xl),Ts!==Pl&&(Ss(Pl),Tl=!0),Tl)return Bs.current&&Dl(),As("recalcParams"),Vs.current=nanoid(),Rs.current={},Es(!0),null;if(Ns==="wait")return null;if(Ns=="recalcParams")return As("wait"),El(),null;if(ws)return Es(!1),Os.current=null,$s(null),Ds.current=!1,As("wait"),_l(),null;if(Ns==="readyToCreateCore"&&as.pageIsActive?yl():Ns==="waitingOnCore"&&!as.pageIsActive&&(Dl(),As("readyToCreateCore")),as.hideWhenNotCurrent&&!as.pageIsCurrent)return null;let Bl=null,Wl={maxWidth:"850px",paddingLeft:"20px",paddingRight:"20px"};return Ds.current||(_s||(Bl=jsx$1("div",{style:{backgroundColor:"lightCyan",padding:"10px"},children:jsx$1("p",{children:"Initializing...."})})),Wl.backgroundColor="#F0F0F0"),jsxs(ErrorBoundary,{setIsInErrorState:as.setIsInErrorState,children:[Bl,jsx$1("div",{style:Wl,children:_s})]})}async function renderersloadComponent(as,rs){var ns={};for(let[ss,os]of as.entries())try{let ls=await os;ns[rs[ss]]=ls.default}catch(ls){throw console.log("here:",ls),Error(`loading ${rs[ss]} failed.`)}return ns}class ErrorBoundary extends React.Component{constructor(rs){super(rs),this.state={hasError:!1}}static getDerivedStateFromError(rs){return{hasError:!0}}componentDidCatch(rs,ns){var ss,os;(os=(ss=this.props).setIsInErrorState)==null||os.call(ss,!0)}render(){return this.state.hasError?jsx$1("h1",{children:"Something went wrong."}):this.props.children}}function getURLFromRef({cid:as,doenetId:rs,variantIndex:ns,edit:ss,hash:os,page:ls,givenUri:us,targetName:cs="",pageToolView:ds={},inCourse:ps=!1,search:fs="",id:hs=""}){let gs="",ys="_blank",bs=!1,vs=!1;if(as||rs){as?gs=`cid=${as}`:gs=`doenetId=${rs}`,ns&&(gs+=`&variant=${ns}`);let xs=!1;ds.page==="public"?xs=!0:ps||(xs=!0),xs?((ss===!0||ss===null&&ds.page==="public"&&ds.tool==="editor")&&(gs=`tool=editor&${gs}`),gs=`/public?${gs}`):ds.page==="placementexam"?gs=`?tool=exam&${gs}`:gs=`?tool=assignment&${gs}`,bs=!0,os?gs+=os:ls?(gs+=`#page${ls}`,cs&&(gs+=cs)):cs&&(gs+="#"+cs)}else if(us)gs=us,(gs.substring(0,8)==="https://"||gs.substring(0,7)==="http://"||gs.substring(0,7)==="mailto:")&&(bs=!0,vs=!0);else{if(gs+=fs,ls)gs+=`#page${ls}`;else{let xs=hs.indexOf("/"),Cs=hs.substring(0,xs);gs+="#"+Cs}gs+=cs,ys=null,bs=!0}return{targetForATag:ys,url:gs,haveValidTarget:bs,externalUri:vs}}const pageVariantInfoAtom=Recoil_index_8({key:"pageVariantInfoAtom",default:{index:1}}),pageVariantPanelAtom=Recoil_index_8({key:"pageVariantPanelAtom",default:{index:1,allPossibleVariants:[]}}),activityVariantPanelAtom=Recoil_index_8({key:"activityVariantPanelAtom",default:{index:1,numberOfVariants:0}});async function loader$5(){return await(await fetch("/api/getHPCarouselData.php")).json()}const HomeIntroVideo=reactExports.lazy(()=>__vitePreload(()=>import("./HomeIntroVideo-0d4b59aa.js"),[])),SectionText=styled$1.div` +`).map(bs=>bs.trim().split(",").map(vs=>vs.trim())),cs=(gs=us[0])==null?void 0:gs.length,ds=!1;for(let bs of us.slice(1))if(bs.length!==cs){ds=!0;break}if(ds)return console.warn(`Data has invalid shape. Rows has inconsistent lengths. Found in componentName :${ss}`),{setValue:{dataFrame:null,numRows:hs,numColumns:cs,columnTypes:os,columnNames:ls}};let ps={},fs=[];if(ns.hasHeader?(ps.columnNames=us[0].map(bs=>(['"',"'"].includes(bs[0])&&bs[bs.length-1]===bs[0]&&(bs=bs.substring(1,bs.length-1)),bs)),fs=us.slice(1)):(ps.columnNames=[...Array(cs).keys()].map(bs=>`col${bs+1}`),fs=us),[...new Set(ps.columnNames)].length({numColumns:{dependencyType:"stateVariable",variableName:"numColumns"}}),returnArraySize({dependencyValues:ns}){return[ns.numColumns]},returnArrayDependenciesByKey(){return{globalDependencies:{dataFrame:{dependencyType:"stateVariable",variableName:"dataFrame"},numColumns:{dependencyType:"stateVariable",variableName:"numColumns"},numRows:{dependencyType:"stateVariable",variableName:"numRows"},columnTypes:{dependencyType:"stateVariable",variableName:"columnTypes"}}}},arrayDefinitionByKey({globalDependencyValues:ns,arrayKeys:ss}){let os={};for(let ls of ss){let us=0,cs=0;if(ns.columnTypes[ls]==="number"){for(let ds=0;ds({displayDigitsAttr:{dependencyType:"attributeComponent",attributeName:"displayDigits",variableNames:["value"]},displayDecimalsAttr:{dependencyType:"attributeComponent",attributeName:"displayDecimals",variableNames:["value"]}}),definition({dependencyValues:ns,usedDefault:ss}){if(ns.displayDigitsAttr!==null){let os=ss.displayDigitsAttr,ls=ns.displayDecimalsAttr===null||ss.displayDecimalsAttr;if(!(os||ls)){let us=ns.displayDigitsAttr.shadowDepth;ns.displayDecimalsAttr.shadowDepth({statisticsToDisplayPrelim:{dependencyType:"stateVariable",variableName:"statisticsToDisplayPrelim"}}),definition:function({dependencyValues:ns}){let ss=["mean","stdev","variance","stderr","count","minimum","quartile1","median","quartile3","maximum","range","sum"],os=[],ls=ns.statisticsToDisplayPrelim.map(us=>us.toLowerCase());if(ls.includes("default"))os=["mean","stdev","count","minimum","quartile1","median","quartile3","maximum"];else if(ls.includes("all"))os=[...ss];else for(let us of ss)ls.includes(us)&&os.push(us);return{setValue:{statisticsToDisplay:os}}}},rs.sourceName={returnDependencies:()=>({source:{dependencyType:"attributeTargetComponentNames",attributeName:"source"}}),definition({dependencyValues:ns}){var os;let ss;return((os=ns.source)==null?void 0:os.length)===1?ss=ns.source[0].absoluteName:ss=null,{setValue:{sourceName:ss}}}},rs.dataColumn={stateVariablesDeterminingDependencies:["sourceName"],additionalStateVariablesDefined:[{variableName:"columnName",public:!0,shadowingInstructions:{createComponentOfType:"text"},forRenderer:!0}],returnDependencies({stateValues:ns}){return{dataFrame:{dependencyType:"stateVariable",componentName:ns.sourceName,variableName:"dataFrame",variableOptional:!0},desiredColumn:{dependencyType:"stateVariable",variableName:"desiredColumn"}}},definition({dependencyValues:ns}){let ss=null,os=null;if(ns.dataFrame){let ls=ns.dataFrame,us=ls.columnNames.indexOf(ns.desiredColumn);if(us!==-1){os=ns.desiredColumn,ss=[];for(let cs of ls.data)cs[us]!==null&&ss.push(cs[us])}}return{setValue:{dataColumn:ss,columnName:os}}}},rs.count={public:!0,shadowingInstructions:{createComponentOfType:"integer"},returnDependencies:()=>({dataColumn:{dependencyType:"stateVariable",variableName:"dataColumn"}}),definition({dependencyValues:ns}){let ss=null;return ns.dataColumn&&(ss=ns.dataColumn.length),{setValue:{count:ss}}}},rs.sum={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero"]},returnDependencies:()=>({dataColumn:{dependencyType:"stateVariable",variableName:"dataColumn"}}),definition({dependencyValues:ns}){let ss=null;return ns.dataColumn&&(ss=ns.dataColumn.reduce((os,ls)=>os+ls)),{setValue:{sum:ss}}}},rs.mean={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero"]},returnDependencies:()=>({dataColumn:{dependencyType:"stateVariable",variableName:"dataColumn"}}),definition({dependencyValues:ns}){let ss=null;return ns.dataColumn!==null&&(ss=Context.math.mean(ns.dataColumn)),{setValue:{mean:ss}}}},rs.stdev={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero"]},returnDependencies:()=>({dataColumn:{dependencyType:"stateVariable",variableName:"dataColumn"}}),definition({dependencyValues:ns}){let ss=null;return ns.dataColumn&&(ss=Context.math.std(ns.dataColumn)),{setValue:{stdev:ss}}}},rs.variance={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero"]},returnDependencies:()=>({dataColumn:{dependencyType:"stateVariable",variableName:"dataColumn"}}),definition({dependencyValues:ns}){let ss=null;return ns.dataColumn&&(ss=Context.math.variance(ns.dataColumn)),{setValue:{variance:ss}}}},rs.stderr={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero"]},returnDependencies:()=>({stdev:{dependencyType:"stateVariable",variableName:"stdev"},count:{dependencyType:"stateVariable",variableName:"count"}}),definition({dependencyValues:ns}){let ss=null;return ns.stdev!==null&&(ss=ns.stdev/Math.sqrt(ns.count)),{setValue:{stderr:ss}}}},rs.minimum={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero"]},returnDependencies:()=>({dataColumn:{dependencyType:"stateVariable",variableName:"dataColumn"}}),definition({dependencyValues:ns}){let ss=null;return ns.dataColumn&&(ss=Math.min(...ns.dataColumn)),{setValue:{minimum:ss}}}},rs.maximum={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero"]},returnDependencies:()=>({dataColumn:{dependencyType:"stateVariable",variableName:"dataColumn"}}),definition({dependencyValues:ns}){let ss=null;return ns.dataColumn&&(ss=Math.max(...ns.dataColumn)),{setValue:{maximum:ss}}}},rs.median={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero"]},returnDependencies:()=>({dataColumn:{dependencyType:"stateVariable",variableName:"dataColumn"}}),definition({dependencyValues:ns}){let ss=null;return ns.dataColumn&&(ss=Context.math.median(ns.dataColumn)),{setValue:{median:ss}}}},rs.quartile1={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero"]},returnDependencies:()=>({dataColumn:{dependencyType:"stateVariable",variableName:"dataColumn"}}),definition({dependencyValues:ns}){let ss=null;return ns.dataColumn&&(ss=Context.math.quantileSeq(ns.dataColumn,.25)),{setValue:{quartile1:ss}}}},rs.quartile3={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero"]},returnDependencies:()=>({dataColumn:{dependencyType:"stateVariable",variableName:"dataColumn"}}),definition({dependencyValues:ns}){let ss=null;return ns.dataColumn&&(ss=Context.math.quantileSeq(ns.dataColumn,.75)),{setValue:{quartile3:ss}}}},rs.range={public:!0,shadowingInstructions:{createComponentOfType:"number",attributesToShadow:["displayDigits","displayDecimals","displaySmallAsZero"]},returnDependencies:()=>({minimum:{dependencyType:"stateVariable",variableName:"minimum"},maximum:{dependencyType:"stateVariable",variableName:"maximum"}}),definition({dependencyValues:ns}){let ss=null;return ns.minimum!==null&&(ss=ns.maximum-ns.minimum),{setValue:{range:ss}}}},rs.summaryStatistics={forRenderer:!0,stateVariablesDeterminingDependencies:["statisticsToDisplay"],returnDependencies({stateValues:ns}){let ss={displayDigits:{dependencyType:"stateVariable",variableName:"displayDigits"},displayDecimals:{dependencyType:"stateVariable",variableName:"displayDecimals"},displaySmallAsZero:{dependencyType:"stateVariable",variableName:"displaySmallAsZero"}};return ns.statisticsToDisplay.includes("mean")&&(ss.mean={dependencyType:"stateVariable",variableName:"mean"}),ns.statisticsToDisplay.includes("stdev")&&(ss.stdev={dependencyType:"stateVariable",variableName:"stdev"}),ns.statisticsToDisplay.includes("variance")&&(ss.variance={dependencyType:"stateVariable",variableName:"variance"}),ns.statisticsToDisplay.includes("stderr")&&(ss.stderr={dependencyType:"stateVariable",variableName:"stderr"}),ns.statisticsToDisplay.includes("count")&&(ss.count={dependencyType:"stateVariable",variableName:"count"}),ns.statisticsToDisplay.includes("minimum")&&(ss.minimum={dependencyType:"stateVariable",variableName:"minimum"}),ns.statisticsToDisplay.includes("quartile1")&&(ss.quartile1={dependencyType:"stateVariable",variableName:"quartile1"}),ns.statisticsToDisplay.includes("median")&&(ss.median={dependencyType:"stateVariable",variableName:"median"}),ns.statisticsToDisplay.includes("quartile3")&&(ss.quartile3={dependencyType:"stateVariable",variableName:"quartile3"}),ns.statisticsToDisplay.includes("maximum")&&(ss.maximum={dependencyType:"stateVariable",variableName:"maximum"}),ns.statisticsToDisplay.includes("range")&&(ss.range={dependencyType:"stateVariable",variableName:"range"}),ns.statisticsToDisplay.includes("sum")&&(ss.sum={dependencyType:"stateVariable",variableName:"sum"}),ss},definition({dependencyValues:ns,usedDefault:ss}){let os={};return ns.mean!==void 0&&(os.mean=roundForDisplay({value:ns.mean,dependencyValues:ns,usedDefault:ss})),ns.stdev!==void 0&&(os.stdev=roundForDisplay({value:ns.stdev,dependencyValues:ns,usedDefault:ss})),ns.variance!==void 0&&(os.variance=roundForDisplay({value:ns.variance,dependencyValues:ns,usedDefault:ss})),ns.stderr!==void 0&&(os.stderr=roundForDisplay({value:ns.stderr,dependencyValues:ns,usedDefault:ss})),ns.count!==void 0&&(os.count=roundForDisplay({value:ns.count,dependencyValues:ns,usedDefault:ss})),ns.minimum!==void 0&&(os.minimum=roundForDisplay({value:ns.minimum,dependencyValues:ns,usedDefault:ss})),ns.quartile1!==void 0&&(os.quartile1=roundForDisplay({value:ns.quartile1,dependencyValues:ns,usedDefault:ss})),ns.median!==void 0&&(os.median=roundForDisplay({value:ns.median,dependencyValues:ns,usedDefault:ss})),ns.quartile3!==void 0&&(os.quartile3=roundForDisplay({value:ns.quartile3,dependencyValues:ns,usedDefault:ss})),ns.maximum!==void 0&&(os.maximum=roundForDisplay({value:ns.maximum,dependencyValues:ns,usedDefault:ss})),ns.range!==void 0&&(os.range=roundForDisplay({value:ns.range,dependencyValues:ns,usedDefault:ss})),ns.sum!==void 0&&(os.sum=roundForDisplay({value:ns.sum,dependencyValues:ns,usedDefault:ss})),{setValue:{summaryStatistics:os}}}},rs}recordVisibilityChange({isVisible:rs,actionId:ns}){this.coreFunctions.requestRecordEvent({verb:"visibilityChanged",object:{componentName:this.componentName,componentType:this.componentType},result:{isVisible:rs}}),this.coreFunctions.resolveAction({actionId:ns})}}zs(SummaryStatistics,"componentType","summaryStatistics");class Chart extends BlockComponent{constructor(rs){super(rs),Object.assign(this.actions,{changeAxisLimits:this.changeAxisLimits.bind(this),recordVisibilityChange:this.recordVisibilityChange.bind(this)})}static createAttributesObject(){let rs=super.createAttributesObject();return rs.type={createComponentOfType:"text",createStateVariable:"type",defaultValue:"histogram",toLowerCase:!0,validValues:["histogram","dotplot","frequencytable","box","bar"],forRenderer:!0},rs.column={createComponentOfType:"text",createStateVariable:"desiredColumn",defaultValue:null},rs.xmin={createComponentOfType:"number",createStateVariable:"xminPrelim",defaultValue:-10},rs.xmax={createComponentOfType:"number",createStateVariable:"xmaxPrelim",defaultValue:10},rs.ymin={createComponentOfType:"number",createStateVariable:"yminPrelim",defaultValue:-10},rs.ymax={createComponentOfType:"number",createStateVariable:"ymaxPrelim",defaultValue:10},rs.width={createComponentOfType:"_componentSize",createStateVariable:"width",defaultValue:{size:300,isAbsolute:!0},public:!0,forRenderer:!0},rs.height={createComponentOfType:"_componentSize",createStateVariable:"height",defaultValue:{size:300,isAbsolute:!0},public:!0,forRenderer:!0},rs.identicalAxisScales={createComponentOfType:"boolean",createStateVariable:"identicalAxisScales",defaultValue:!1,public:!0,forRenderer:!0},rs.displayXAxis={createComponentOfType:"boolean",createStateVariable:"displayXAxis",defaultValue:!0,public:!0,forRenderer:!0},rs.displayYAxis={createComponentOfType:"boolean",createStateVariable:"displayYAxis",defaultValue:!0,public:!0,forRenderer:!0},rs.displayXAxisTickLabels={createComponentOfType:"boolean",createStateVariable:"displayXAxisTickLabels",defaultValue:!0,public:!0,forRenderer:!0},rs.displayYAxisTickLabels={createComponentOfType:"boolean",createStateVariable:"displayYAxisTickLabels",defaultValue:!0,public:!0,forRenderer:!0},rs.xlabel={createComponentOfType:"text",createStateVariable:"xlabel",defaultValue:"",public:!0,forRenderer:!0},rs.xlabelPosition={createComponentOfType:"text",createStateVariable:"xlabelPosition",defaultValue:"right",public:!0,forRenderer:!0,toLowerCase:!0,validValues:["right","left"]},rs.ylabel={createComponentOfType:"text",createStateVariable:"ylabel",defaultValue:"",public:!0,forRenderer:!0},rs.ylabelPosition={createComponentOfType:"text",createStateVariable:"ylabelPosition",defaultValue:"top",public:!0,forRenderer:!0,toLowerCase:!0,validValues:["top","bottom"]},rs.ylabelAlignment={createComponentOfType:"text",createStateVariable:"ylabelAlignment",defaultValue:"left",public:!0,forRenderer:!0,toLowerCase:!0,validValues:["left","right"]},rs}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.dataFrame={forRenderer:!0,returnDependencies(){return{targetComponent:{dependencyType:"targetComponent",variableNames:["dataFrame"],variablesOptional:!0}}},definition({dependencyValues:ns}){var os;console.log("definition of dataFrame",ns);let ss=null;return(os=ns.targetComponent)!=null&&os.stateValues.dataFrame&&(ss=ns.targetComponent.stateValues.dataFrame),{setValue:{dataFrame:ss}}}},rs.columnName={public:!0,shadowingInstructions:{createComponentOfType:"text"},additionalStateVariablesDefined:[{variableName:"colInd",forRenderer:!0}],returnDependencies(){return{desiredColumn:{dependencyType:"stateVariable",variableName:"desiredColumn"},dataFrame:{dependencyType:"stateVariable",variableName:"dataFrame"}}},definition({dependencyValues:ns}){let ss=null,os=null;return ns.dataFrame&&(os=ns.dataFrame.columnNames.indexOf(ns.desiredColumn),os!==-1?ss=ns.desiredColumn:os=null),{setValue:{columnName:ss,colInd:os}}}},rs.xmin={stateVariablesDeterminingDependencies:["identicalAxisScales"],defaultValue:-10,public:!0,shadowingInstructions:{createComponentOfType:"number"},forRenderer:!0,returnDependencies({stateValues:ns}){let ss={identicalAxisScales:{dependencyType:"stateVariable",variableName:"identicalAxisScales"},xminPrelim:{dependencyType:"stateVariable",variableName:"xminPrelim"}};return ns.identicalAxisScales&&(ss.xmaxPrelim={dependencyType:"stateVariable",variableName:"xmaxPrelim"},ss.yminPrelim={dependencyType:"stateVariable",variableName:"yminPrelim"},ss.ymaxPrelim={dependencyType:"stateVariable",variableName:"ymaxPrelim"},ss.width={dependencyType:"stateVariable",variableName:"width"},ss.height={dependencyType:"stateVariable",variableName:"height"}),ss},definition({dependencyValues:ns,usedDefault:ss}){if(!ns.identicalAxisScales)return{setValue:{xmin:ns.xminPrelim}};if(!ss.xminPrelim)return{setValue:{xmin:ns.xminPrelim}};let ls=!ss.xmaxPrelim,us=!ss.yminPrelim,cs=!ss.ymaxPrelim;if(us&&cs){let ps=ns.width.size/ns.height.size,fs=(ns.ymaxPrelim-ns.yminPrelim)*ps;return ls?{setValue:{xmin:ns.xmaxPrelim-fs}}:{setValue:{xmin:-fs/2}}}else return ls?{setValue:{xmin:ns.xmaxPrelim-20}}:{setValue:{xmin:-10}}},async inverseDefinition({desiredStateVariableValues:ns,stateValues:ss}){return await ss.fixAxes?{success:!1}:{success:!0,instructions:[{setDependency:"xminPrelim",desiredValue:ns.xmin}]}}},rs.xmax={stateVariablesDeterminingDependencies:["identicalAxisScales"],defaultValue:-10,public:!0,shadowingInstructions:{createComponentOfType:"number"},forRenderer:!0,returnDependencies({stateValues:ns}){let ss={identicalAxisScales:{dependencyType:"stateVariable",variableName:"identicalAxisScales"},xmaxPrelim:{dependencyType:"stateVariable",variableName:"xmaxPrelim"}};return ns.identicalAxisScales&&(ss.xminPrelim={dependencyType:"stateVariable",variableName:"xminPrelim"},ss.yminPrelim={dependencyType:"stateVariable",variableName:"yminPrelim"},ss.ymaxPrelim={dependencyType:"stateVariable",variableName:"ymaxPrelim"},ss.width={dependencyType:"stateVariable",variableName:"width"},ss.height={dependencyType:"stateVariable",variableName:"height"}),ss},definition({dependencyValues:ns,usedDefault:ss}){if(!ns.identicalAxisScales)return{setValue:{xmax:ns.xmaxPrelim}};let os=!ss.xminPrelim,ls=!ss.xmaxPrelim,us=!ss.yminPrelim,cs=!ss.ymaxPrelim,ds=us&&cs,ps=os&&ls,fs=ns.xminPrelim;if(ds){let hs=ns.width.size/ns.height.size,gs=(ns.ymaxPrelim-ns.yminPrelim)*hs;if(ps){let ys=ns.xmaxPrelim-fs,bs=Math.max(ys,gs);return{setValue:{xmax:fs+bs}}}else return os?{setValue:{xmax:fs+gs}}:ls?{setValue:{xmax:ns.xmaxPrelim}}:{setValue:{xmax:gs/2}}}else return ls?{setValue:{xmax:ns.xmaxPrelim}}:os?{setValue:{xmax:fs+20}}:{setValue:{xmax:10}}},async inverseDefinition({desiredStateVariableValues:ns,stateValues:ss}){return await ss.fixAxes?{success:!1}:{success:!0,instructions:[{setDependency:"xmaxPrelim",desiredValue:ns.xmax}]}}},rs.ymin={stateVariablesDeterminingDependencies:["identicalAxisScales"],defaultValue:-10,public:!0,shadowingInstructions:{createComponentOfType:"number"},forRenderer:!0,returnDependencies({stateValues:ns}){let ss={identicalAxisScales:{dependencyType:"stateVariable",variableName:"identicalAxisScales"},yminPrelim:{dependencyType:"stateVariable",variableName:"yminPrelim"}};return ns.identicalAxisScales&&(ss.xmaxPrelim={dependencyType:"stateVariable",variableName:"xmaxPrelim"},ss.xminPrelim={dependencyType:"stateVariable",variableName:"xminPrelim"},ss.ymaxPrelim={dependencyType:"stateVariable",variableName:"ymaxPrelim"},ss.width={dependencyType:"stateVariable",variableName:"width"},ss.height={dependencyType:"stateVariable",variableName:"height"}),ss},definition({dependencyValues:ns,usedDefault:ss}){if(!ns.identicalAxisScales)return{setValue:{ymin:ns.yminPrelim}};if(!ss.yminPrelim)return{setValue:{ymin:ns.yminPrelim}};let ls=!ss.ymaxPrelim,us=!ss.xminPrelim,cs=!ss.xmaxPrelim,ds=us&&cs,ps=ns.width.size/ns.height.size;if(ds){let fs=(ns.xmaxPrelim-ns.xminPrelim)/ps;return ls?{setValue:{ymin:ns.ymaxPrelim-fs}}:{setValue:{ymin:-fs/2}}}else return ls?{setValue:{ymin:ns.ymaxPrelim-20/ps}}:{setValue:{ymin:-10/ps}}},async inverseDefinition({desiredStateVariableValues:ns,stateValues:ss}){return await ss.fixAxes?{success:!1}:{success:!0,instructions:[{setDependency:"yminPrelim",desiredValue:ns.ymin}]}}},rs.ymax={stateVariablesDeterminingDependencies:["identicalAxisScales"],defaultValue:-10,public:!0,shadowingInstructions:{createComponentOfType:"number"},forRenderer:!0,returnDependencies({stateValues:ns}){let ss={identicalAxisScales:{dependencyType:"stateVariable",variableName:"identicalAxisScales"},ymaxPrelim:{dependencyType:"stateVariable",variableName:"ymaxPrelim"}};return ns.identicalAxisScales&&(ss.xminPrelim={dependencyType:"stateVariable",variableName:"xminPrelim"},ss.yminPrelim={dependencyType:"stateVariable",variableName:"yminPrelim"},ss.xmaxPrelim={dependencyType:"stateVariable",variableName:"xmaxPrelim"},ss.width={dependencyType:"stateVariable",variableName:"width"},ss.height={dependencyType:"stateVariable",variableName:"height"}),ss},definition({dependencyValues:ns,usedDefault:ss}){if(!ns.identicalAxisScales)return{setValue:{ymax:ns.ymaxPrelim}};let os=!ss.xminPrelim,ls=!ss.xmaxPrelim,us=!ss.yminPrelim,cs=!ss.ymaxPrelim,ds=us&&cs,ps=os&&ls,fs=ns.yminPrelim,hs=ns.width.size/ns.height.size;if(ps){let gs=(ns.xmaxPrelim-ns.xminPrelim)/hs;if(ds){let ys=ns.ymaxPrelim-fs,bs=Math.max(ys,gs);return{setValue:{ymax:fs+bs}}}else return us?{setValue:{ymax:fs+gs}}:cs?{setValue:{ymax:ns.ymaxPrelim}}:{setValue:{ymax:gs/2}}}else return cs?{setValue:{ymax:ns.ymaxPrelim}}:us?{setValue:{ymax:fs+20/hs}}:{setValue:{ymax:10/hs}}},async inverseDefinition({desiredStateVariableValues:ns,stateValues:ss}){return await ss.fixAxes?{success:!1}:{success:!0,instructions:[{setDependency:"ymaxPrelim",desiredValue:ns.ymax}]}}},rs.xscale={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({xmin:{dependencyType:"stateVariable",variableName:"xmin"},xmax:{dependencyType:"stateVariable",variableName:"xmax"}}),definition({dependencyValues:ns}){return{setValue:{xscale:ns.xmax-ns.xmin}}}},rs.yscale={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({ymin:{dependencyType:"stateVariable",variableName:"ymin"},ymax:{dependencyType:"stateVariable",variableName:"ymax"}}),definition({dependencyValues:ns}){return{setValue:{yscale:ns.ymax-ns.ymin}}}},rs}async changeAxisLimits({xmin:rs,xmax:ns,ymin:ss,ymax:os,actionId:ls,sourceInformation:us={},skipRendererUpdate:cs=!1}){let ds=[];return rs!==void 0&&ds.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"xmin",value:rs}),ns!==void 0&&ds.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"xmax",value:ns}),ss!==void 0&&ds.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"ymin",value:ss}),os!==void 0&&ds.push({updateType:"updateValue",componentName:this.componentName,stateVariable:"ymax",value:os}),await this.coreFunctions.performUpdate({updateInstructions:ds,actionId:ls,sourceInformation:us,skipRendererUpdate:cs,event:{verb:"interacted",object:{componentName:this.componentName,componentType:this.componentType},result:{xmin:rs,xmax:ns,ymin:ss,ymax:os}}})}recordVisibilityChange({isVisible:rs,actionId:ns}){this.coreFunctions.requestRecordEvent({verb:"visibilityChanged",object:{componentName:this.componentName,componentType:this.componentType},result:{isVisible:rs}}),this.coreFunctions.resolveAction({actionId:ns})}}zs(Chart,"componentType","chart"),zs(Chart,"acceptTarget",!0);class Legend extends GraphicalComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.position={createComponentOfType:"text",createStateVariable:"position",defaultValue:"upperright",public:!0,forRenderer:!0,toLowerCase:!0,validValues:["upperright","upperleft","lowerright","lowerleft"]},rs.displayClosedSwatches={createComponentOfType:"boolean",createStateVariable:"displayClosedSwatches",defaultValue:!1,public:!0},rs}static returnChildGroups(){return[{group:"labels",componentTypes:["label"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.graphicalElementNames={returnDependencies:()=>({graphAncestor:{dependencyType:"ancestor",componentType:"graph",variableNames:["graphicalDescendants"]}}),definition({dependencyValues:ns}){return ns.graphAncestor?{setValue:{graphicalElementNames:ns.graphAncestor.stateValues.graphicalDescendants.map(ss=>ss.componentName)}}:{setValue:{graphicalElementNames:null}}}},rs.legendElements={forRenderer:!0,stateVariablesDeterminingDependencies:["graphicalElementNames"],returnDependencies:({stateValues:ns})=>{let ss={labelChildren:{dependencyType:"child",childGroups:["labels"],variableNames:["value","hasLatex","forObjectComponentName"]},displayClosedSwatches:{dependencyType:"stateVariable",variableName:"displayClosedSwatches"}};if(ns.graphicalElementNames){ss.numGraphicalElements={dependencyType:"value",value:ns.graphicalElementNames.length};for(let[os,ls]of ns.graphicalElementNames.entries())ss[`graphicalElement${os}`]={dependencyType:"multipleStateVariables",componentName:ls,variableNames:["selectedStyle","styleNumber","filled"],variablesOptional:!0},ss[`graphicalElement${os}AdapterSource`]={dependencyType:"adapterSource",componentName:ls},ss[`graphicalElement${os}ShadowSource`]={dependencyType:"shadowSource",componentName:ls}}return ss},definition({dependencyValues:ns,componentInfoObjects:ss}){let os=[];if(ns.numGraphicalElements>0){let ls=[],us=[],cs=[],ds=[];for(let gs=0;gsgs.componentName),fs=[],hs={};for(let gs of ns.labelChildren){let ys={value:gs.stateValues.value,hasLatex:gs.stateValues.hasLatex};if(gs.stateValues.forObjectComponentName){hs[gs.stateValues.forObjectComponentName]=ys;let bs=ps.indexOf(gs.stateValues.forObjectComponentName);if(bs!==-1){let vs=ds[bs];ss.isInheritedComponentType({inheritedComponentType:vs.componentType,baseComponentType:"point"})?ls.push(vs.stateValues.styleNumber):ns.displayClosedSwatches&&ss.allComponentClasses[vs.componentType].representsClosedPath?us.push(vs.stateValues.styleNumber):vs.componentType!=="legend"&&cs.push(vs.stateValues.styleNumber)}}fs.push({labelInfo:ys,forObject:gs.stateValues.forObjectComponentName})}for(let gs of fs){let ys;if(gs.forObject){let bs=ps.indexOf(gs.forObject);bs!==-1&&(ys=ds[bs],ds.splice(bs,1),ps.splice(bs,1))}else for(let bs=0;bs({graphAncestor:{dependencyType:"ancestor",componentType:"graph",variableNames:["xmin","xmax","ymin","ymax"]}}),definition({dependencyValues:ns}){return ns.graphAncestor?{setValue:{graphLimits:ns.graphAncestor.stateValues}}:{setValue:{graphLimits:null}}}},rs}}zs(Legend,"componentType","legend");class MatchesPattern extends BooleanComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.pattern={createComponentOfType:"math"},rs.allowImplicitIdentities={createComponentOfType:"boolean",createStateVariable:"allowImplicitIdentities",defaultValue:!1,public:!0},rs.allowPermutations={createComponentOfType:"boolean",createStateVariable:"allowPermutations",defaultValue:!0,public:!0},rs.requireNumericMatches={createComponentOfType:"boolean",createStateVariable:"requireNumericMatches",defaultValue:!1,public:!0},rs.requireVariableMatches={createComponentOfType:"boolean",createStateVariable:"requireVariableMatches",defaultValue:!1,public:!0},rs.excludeMatches={createComponentOfType:"mathList",createStateVariable:"excludeMatches",defaultValue:[],public:!0},rs.matchExpressionWithBlanks={createComponentOfType:"boolean",createStateVariable:"matchExpressionWithBlanks",defaultValue:!1,public:!0},rs}static returnSugarInstructions(){let rs=[],ns=function({matchedChildren:ss,componentInfoObjects:os}){return ss.length===0||ss.length===1&&os.componentIsSpecifiedType(ss[0],"math")?{success:!1}:{success:!0,newChildren:[{componentType:"math",children:ss}]}};return rs.push({replacementFunction:ns}),rs}static returnChildGroups(){return[{group:"maths",componentTypes:["math"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return delete rs.parsedExpression,delete rs.mathChildrenByCode,rs.pattern={additionalStateVariablesDefined:["patternVariables"],returnDependencies:()=>({patternAttr:{dependencyType:"attributeComponent",attributeName:"pattern",variableNames:["value"]}}),definition({dependencyValues:ns}){let ss=[];if(!ns.patternAttr)return{setValue:{pattern:"_",patternVariables:ss}};let os=ns.patternAttr.stateValues.value.variables(),ls=26*27+1;function us(ds){if(ds==="_"){let ps=numberToLetters(ls);for(ls++;os.includes(ps);)ps=numberToLetters(ls),ls++;return ss.push(ps),ps}else return Array.isArray(ds)?[ds[0],...ds.slice(1).map(us)]:ds}return{setValue:{pattern:us(ns.patternAttr.stateValues.value.tree),patternVariables:ss}}}},rs.value={additionalStateVariablesDefined:[{variableName:"allPatternMatches"}],public:!0,shadowingInstructions:{createComponentOfType:"boolean"},forRenderer:!0,returnDependencies:()=>({pattern:{dependencyType:"stateVariable",variableName:"pattern"},patternVariables:{dependencyType:"stateVariable",variableName:"patternVariables"},mathChildren:{dependencyType:"child",childGroups:["maths"],variableNames:["value"]},allowImplicitIdentities:{dependencyType:"stateVariable",variableName:"allowImplicitIdentities"},allowPermutations:{dependencyType:"stateVariable",variableName:"allowPermutations"},requireNumericMatches:{dependencyType:"stateVariable",variableName:"requireNumericMatches"},requireVariableMatches:{dependencyType:"stateVariable",variableName:"requireVariableMatches"},excludeMatches:{dependencyType:"stateVariable",variableName:"excludeMatches"},matchExpressionWithBlanks:{dependencyType:"stateVariable",variableName:"matchExpressionWithBlanks"}}),definition:function({dependencyValues:ns}){if(ns.mathChildren.length===0)return{setValue:{value:!1,allPatternMatches:[]}};let ss=ns.mathChildren[0].stateValues.value;if(ss.variables().includes("_")&&!ns.matchExpressionWithBlanks)return{setValue:{value:!1,allPatternMatches:[]}};let os={};if(ns.requireNumericMatches){let ps=fs=>!Number.isNaN(Context.fromAst(fs).evaluate_to_constant());ns.patternVariables.forEach(fs=>os[fs]=ps)}else if(ns.requireVariableMatches){let ps=fs=>typeof fs=="string";ns.patternVariables.forEach(fs=>os[fs]=ps)}else ns.patternVariables.forEach(ps=>os[ps]=!0);let ls={variables:os,allow_permutations:ns.allowPermutations};ns.allowImplicitIdentities&&(ls.allow_implicit_identities=ns.patternVariables);let us=ss.match(ns.pattern,ls),cs=!1,ds=[];return us&&(Object.values(us).map(ps=>Context.fromAst(ps)).some(ps=>ns.excludeMatches.some(fs=>ps.variables().some(hs=>fs.equalsViaSyntax(Context.fromAst(hs)))))||(cs=!0,ds=ns.patternVariables.map(ps=>Context.fromAst(us[ps])))),{setValue:{value:cs,allPatternMatches:ds}}}},rs.nMatches={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({allPatternMatches:{dependencyType:"stateVariable",variableName:"allPatternMatches"}}),definition({dependencyValues:ns}){return{setValue:{nMatches:ns.allPatternMatches.length},checkForActualChange:{nMatches:!0}}}},rs.patternMatches={public:!0,shadowingInstructions:{createComponentOfType:"math"},isArray:!0,nDimensions:1,entryPrefixes:["patternMatch"],returnArraySizeDependencies:()=>({nMatches:{dependencyType:"stateVariable",variableName:"nMatches"}}),returnArraySize({dependencyValues:ns}){return[ns.nMatches]},returnArrayDependenciesByKey(){return{globalDependencies:{allPatternMatches:{dependencyType:"stateVariable",variableName:"allPatternMatches"}}}},arrayDefinitionByKey({globalDependencyValues:ns}){let ss={};for(let os=0;os({displayDigitsAttr:{dependencyType:"attributeComponent",attributeName:"displayDigits",variableNames:["value"]},displayDecimalsAttr:{dependencyType:"attributeComponent",attributeName:"displayDecimals",variableNames:["value"]}}),definition({dependencyValues:ns,usedDefault:ss}){if(ns.displayDigitsAttr!==null){let os=ss.displayDigitsAttr,ls=ns.displayDecimalsAttr===null||ss.displayDecimalsAttr;if(!(os||ls)){let us=ns.displayDigitsAttr.shadowDepth;ns.displayDecimalsAttr.shadowDepth({}),definition(){return{setValue:{unordered:!1}}}},rs.matrixSizePre={returnDependencies:()=>({rowChildren:{dependencyType:"child",childGroups:["rows"],variableNames:["nComponents"]},colChildren:{dependencyType:"child",childGroups:["columns"],variableNames:["nComponents"]},mathChildren:{dependencyType:"child",childGroups:["maths"],variableNames:["matrixSize"]},nRowsAttr:{dependencyType:"attributeComponent",attributeName:"nRows",variableNames:["value"]},nColumnsAttr:{dependencyType:"attributeComponent",attributeName:"nColumns",variableNames:["value"]}}),definition({dependencyValues:ns}){let ss=null,os=null;return ns.nRowsAttr&&(ss=ns.nRowsAttr.stateValues.value,Number.isFinite(ss)&&ss>0||(ss=null)),ns.nColumnsAttr&&(os=ns.nColumnsAttr.stateValues.value,Number.isFinite(os)&&os>0||(os=null)),ns.rowChildren.length>0?(ss===null&&(ss=ns.rowChildren.length),os===null&&(os=Math.max(1,...ns.rowChildren.map(ls=>ls.stateValues.nComponents)))):ns.colChildren.length>0?(os===null&&(os=ns.colChildren.length),ss===null&&(ss=Math.max(1,...ns.colChildren.map(ls=>ls.stateValues.nComponents)))):ns.mathChildren.length===1?(ss===null&&(ss=ns.mathChildren[0].stateValues.matrixSize[0]),os===null&&(os=ns.mathChildren[0].stateValues.matrixSize[1])):ss===null?os===null?(ss=0,os=0):ss=1:os===null&&(os=1),{setValue:{matrixSizePre:[ss,os]}}}},rs.matrixPre={isArray:!0,nDimensions:2,hasEssential:!0,returnArraySizeDependencies:()=>({matrixSizePre:{dependencyType:"stateVariable",variableName:"matrixSizePre"}}),returnArraySize({dependencyValues:ns}){return ns.matrixSizePre},returnArrayDependenciesByKey:({arrayKeys:ns})=>{let ss={defaultEntry:{dependencyType:"stateVariable",variableName:"defaultEntry"},rowChildIdentities:{dependencyType:"child",childGroups:["rows"]},colChildIdentities:{dependencyType:"child",childGroups:["columns"]}},os={};for(let ls of ns){let[us,cs]=ls.split(",");os[ls]={rowChild:{dependencyType:"child",childGroups:["rows"],childIndices:[us],variableNames:["math"+(Number(cs)+1)]},colChild:{dependencyType:"child",childGroups:["columns"],childIndices:[cs],variableNames:["math"+(Number(us)+1)]},mathChild:{dependencyType:"child",childGroups:["maths"],childIndices:[0],variableNames:["matrixEntry"+(Number(us)+1)+"_"+(Number(cs)+1)]}}}return{globalDependencies:ss,dependenciesByKey:os}},arrayDefinitionByKey({globalDependencyValues:ns,dependencyValuesByKey:ss,arrayKeys:os,arraySize:ls}){var fs,hs,gs;let us={},cs={},ds=ns.rowChildIdentities.length>0,ps=ns.colChildIdentities.length>0;for(let ys of os){let[bs,vs]=ys.split(","),xs;ds?xs=(fs=ss[ys].rowChild[0])==null?void 0:fs.stateValues["math"+(Number(vs)+1)]:ps?xs=(hs=ss[ys].colChild[0])==null?void 0:hs.stateValues["math"+(Number(bs)+1)]:xs=(gs=ss[ys].mathChild[0])==null?void 0:gs.stateValues["matrixEntry"+(Number(bs)+1)+"_"+(Number(vs)+1)],xs===void 0?cs[ys]={defaultValue:ns.defaultEntry}:us[ys]=xs}return{setValue:{matrixPre:us},useEssentialOrDefaultValue:{matrixPre:cs}}},async inverseArrayDefinitionByKey({desiredStateVariableValues:ns,globalDependencyValues:ss,dependencyValuesByKey:os,dependencyNamesByKey:ls}){var fs,hs,gs;let us=[],cs={},ds=ss.rowChildIdentities.length>0,ps=ss.colChildIdentities.length>0;for(let ys in ns.matrixPre){let[bs,vs]=ys.split(",");ds?((fs=os[ys].rowChild[0])==null?void 0:fs.stateValues["math"+(Number(vs)+1)])===void 0?cs[ys]=ns.matrixPre[ys]:us.push({setDependency:ls[ys].rowChild,desiredValue:ns.matrixPre[ys],childIndex:0,variableIndex:0}):ps?((hs=os[ys].colChild[0])==null?void 0:hs.stateValues["math"+(Number(bs)+1)])===void 0?cs[ys]=ns.matrixPre[ys]:us.push({setDependency:ls[ys].colChild,desiredValue:ns.matrixPre[ys],childIndex:0,variableIndex:0}):((gs=os[ys].mathChild[0])==null?void 0:gs.stateValues["matrixEntry"+(Number(bs)+1)+"_"+(Number(vs)+1)])===void 0?cs[ys]=ns.matrixPre[ys]:us.push({setDependency:ls[ys].mathChild,desiredValue:ns.matrixPre[ys],childIndex:0,variableIndex:0})}return Object.keys(cs).length>0&&us.push({setEssentialValue:"matrixPre",value:cs}),{success:!0,instructions:us}}},rs.unnormalizedValue={returnDependencies:()=>({matrixPre:{dependencyType:"stateVariable",variableName:"matrixPre"},matrixSizePre:{dependencyType:"stateVariable",variableName:"matrixSizePre"}}),definition({dependencyValues:ns}){let ss=["tuple"];for(let ls=0;lsus.tree)]);return{setValue:{unnormalizedValue:Context.fromAst(["matrix",["tuple",...ns.matrixSizePre],ss])}}},inverseDefinition({dependencyValues:ns,desiredStateVariableValues:ss}){var us,cs;let os=ss.unnormalizedValue.tree;if(!(Array.isArray(os)&&os[0]==="matrix"&&((us=os[1])==null?void 0:us[1])===ns.matrixSizePre[0]&&((cs=os[1])==null?void 0:cs[2])===ns.matrixSizePre[1]))return{success:!1};let ls={};for(let ds=0;ds({modifyIndirectly:{dependencyType:"stateVariable",variableName:"modifyIndirectly"},fixed:{dependencyType:"stateVariable",variableName:"fixed"}}),definition({dependencyValues:ns}){return{setValue:{canBeModified:ns.modifyIndirectly&&!ns.fixed}}}},rs}}zs(Matrix,"componentType","matrix"),zs(Matrix,"rendererType","math");class EigenDecomposition extends BaseComponent{static createAttributesObject(){let rs=super.createAttributesObject();return rs.displayDigits={createComponentOfType:"integer",createStateVariable:"displayDigits",defaultValue:14,public:!0},rs.displayDecimals={createComponentOfType:"integer",createStateVariable:"displayDecimals",defaultValue:null,public:!0},rs.displaySmallAsZero={createComponentOfType:"number",createStateVariable:"displaySmallAsZero",valueForTrue:1e-14,valueForFalse:0,defaultValue:0,public:!0},rs.padZeros={createComponentOfType:"boolean",createStateVariable:"padZeros",defaultValue:!1,public:!0},rs}static returnChildGroups(){return[{group:"maths",componentTypes:["math"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.decomposition={returnDependencies:()=>({mathChild:{dependencyType:"child",childGroups:["maths"],variableNames:["value"]}}),definition({dependencyValues:ns}){if(ns.mathChild.length===0)return{setValue:{decomposition:null}};let ss=ns.mathChild[0].stateValues.value.tree;if(!Array.isArray(ss)||ss[0]!=="matrix")return{setValue:{decomposition:null}};let os=ss[1][1],ls=ss[1][2];if(!(Number.isInteger(os)&&ls===os))return{setValue:{decomposition:null}};let us=[];for(let ds=0;ds({decomposition:{dependencyType:"stateVariable",variableName:"decomposition"}}),returnArraySize({dependencyValues:ns}){let ss;return ns.decomposition?ss=ns.decomposition.values.length:ss=0,[ss]},returnArrayDependenciesByKey(){return{globalDependencies:{decomposition:{dependencyType:"stateVariable",variableName:"decomposition"}}}},arrayDefinitionByKey({globalDependencyValues:ns,arraySize:ss}){let os=[];for(let ls=0;lsNumber(us)-1);return ls.length===2&&ls.every((us,cs)=>Number.isInteger(us)&&us>=0)?os?ls.every((us,cs)=>us=0?os?lsls+","+cs):[]:[ls+",0"]:[]}},arrayVarNameFromPropIndex(ns,ss){if(ss==="eigenvectors")return ns.length===1?"eigenvector"+ns[0]:`eigenvectorX${ns[0]}_${ns[1]}`;if(ss.slice(0,11)==="eigenvector"){let os=Number(ss.slice(11));if(Number.isInteger(os)&&os>0)return`eigenvectorX${os}_${ns[0]}`}return null},entryPrefixes:["eigenvectorX","eigenvector"],returnArraySizeDependencies:()=>({decomposition:{dependencyType:"stateVariable",variableName:"decomposition"}}),returnArraySize({dependencyValues:ns}){let ss;return ns.decomposition?ss=ns.decomposition.values.length:ss=0,[ss,ss]},returnArrayDependenciesByKey(){return{globalDependencies:{decomposition:{dependencyType:"stateVariable",variableName:"decomposition"}}}},arrayDefinitionByKey({globalDependencyValues:ns,arraySize:ss}){let os={};for(let ls=0;lsContext.math.divide(ds,cs));for(let ds=0;ds({mathTextLikeChildren:{dependencyType:"child",childGroups:["mathTextLike"],variableNames:["text","latex"]}}),rs.value.definition=function({dependencyValues:ns}){if(ns.mathTextLikeChildren.length===0)return{useEssentialOrDefaultValue:{value:!0}};let ss="";for(let os of ns.mathTextLikeChildren)typeof os=="string"?ss+=os:os.stateValues.latex!==void 0?ss+=os.stateValues.latex:ss+=os.stateValues.text;return{setValue:{value:ss}}},rs.value.inverseDefinition=function({desiredStateVariableValues:ns,dependencyValues:ss}){var ls;let os=ss.mathTextLikeChildren.length;return os>1?{success:!1}:os===1?{success:!0,instructions:[{setDependency:"textLikeChildren",desiredValue:ns.value,childIndex:0,variableIndex:((ls=ss.textLikeChildren[0].stateValues)==null?void 0:ls.latex)===void 0?0:1}]}:{success:!0,instructions:[{setEssentialValue:"value",value:ns.value===null?"":String(ns.value)}]}},rs.text={public:!0,shadowingInstructions:{createComponentOfType:"text"},forRenderer:!0,returnDependencies:()=>({value:{dependencyType:"stateVariable",variableName:"value"}}),definition:({dependencyValues:ns})=>({setValue:{text:ns.value}}),inverseDefinition:({desiredStateVariableValues:ns})=>({success:!0,instructions:[{setDependency:"value",desiredValue:ns.text}]})},rs.latex={isAlias:!0,targetVariableName:"value"},rs}}zs(Latex,"componentType","latex"),zs(Latex,"rendererType","text");const unitConversions={"":1,px:1,pixel:1,pixels:1,"%":1,em:100,in:96,inch:96,inches:96,pt:1.333333333333,mm:3.7795296,millimeter:3.7795296,millimeters:3.7795296,cm:37.795296,centimeter:37.795296,centimeters:37.795296};class ComponentSize extends InlineComponent{static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=function({matchedChildren:ss}){let os=ss[ss.length-1];if(typeof os=="string"){let ls=/([a-zA-z]+|%)$/,us=os.trim(),cs=us.match(ls);if(cs){let ds=cs[1];if(ds in unitConversions){let ps=us.slice(0,cs.index),fs=ss.slice(0,ss.length-1);return ps.length>0&&fs.push(ps),{success:!0,newChildren:[{componentType:"number",children:fs},ds]}}}}return{success:!0,newChildren:[{componentType:"number",children:ss}]}};return rs.push({childrenRegex:/..+/,replacementFunction:ns}),rs}static returnChildGroups(){return[{group:"strings",componentTypes:["string"]},{group:"numbers",componentTypes:["number"]},{group:"componentSizes",componentTypes:["_componentSize"]}]}static returnStateVariableDefinitions(){let rs=super.returnStateVariableDefinitions();return rs.componentSize={public:!0,shadowingInstructions:{createComponentOfType:"_componentSize"},hasEssential:!0,returnDependencies:()=>({componentSizeChild:{dependencyType:"child",childGroups:["componentSizes"],variableNames:["componentSize"]},numberChild:{dependencyType:"child",childGroups:["numbers"],variableNames:["value"]},stringChild:{dependencyType:"child",childGroups:["strings"],variableNames:["value"]},parentDefaultAbsoluteSize:{dependencyType:"parentStateVariable",variableName:"defaultAbsoluteSize"}}),definition({dependencyValues:ns}){let ss=ns.parentDefaultAbsoluteSize===void 0?!1:ns.parentDefaultAbsoluteSize;if(ns.stringChild.length===0)return ns.numberChild.length===0?ns.componentSizeChild.length===0?{useEssentialOrDefaultValue:{componentSize:{defaultValue:{size:100,isAbsolute:ss}}}}:{setValue:{componentSize:ns.componentSizeChild[0].stateValues.componentSize}}:{setValue:{componentSize:{size:ns.numberChild[0].stateValues.value,isAbsolute:!0}}};{let os,ls;if(ns.numberChild.length>0)os=ns.numberChild[0].stateValues.value,ls=ns.stringChild[0].trim();else{let ps=ns.stringChild[0].trim().match(/^(-?[\d.]+)\s*(.*)$/);if(ps===null)return{setValue:{componentSize:null}};os=ps[1],ls=ps[2].trim()}if(os=Number(os),!Number.isFinite(os))return{setValue:{componentSize:null}};let us=!(ls==="%"||ls==="em"),cs=unitConversions[ls];return cs===void 0&&(cs=1),{setValue:{componentSize:{size:cs*os,isAbsolute:us}}}}},inverseDefinition({desiredStateVariableValues:ns,dependencyValues:ss}){if(ss.stringChild.length===0)return ss.numberChild.length===0?ss.componentSizeChild.length===0?{success:!0,instructions:[{setEssentialValue:"componentSize",value:ns.componentSize}]}:{success:!0,instructions:[{setDependency:"componentSizeChild",desiredValue:ns.componentSize,childIndex:0,variableIndex:0}]}:ns.componentSize.isAbsolute?{success:!0,instructions:[{setDependency:"numberChild",desiredValue:ns.componentSize.size,childIndex:0,variableIndex:0}]}:{success:!1};if(ss.numberChild.length>0){let os=ss.stringChild[0].trim(),ls=!(os==="%"||os==="em");if(ns.componentSize.isAbsolute!==ls)return{success:!1};let us=unitConversions[os];return us===void 0&&(us=1),{success:!0,instructions:[{setDependency:"numberChild",desiredValue:ns.componentSize.size/us,childIndex:0,variableIndex:0}]}}else{let os=ns.componentSize.size;return ns.componentSize.isAbsolute?os+="px":os+="%",{success:!0,instructions:[{setDependency:"stringChild",desiredValue:os,childIndex:0,variableIndex:0}]}}}},rs.number={public:!0,shadowingInstructions:{createComponentOfType:"number"},returnDependencies:()=>({componentSize:{dependencyType:"stateVariable",variableName:"componentSize"}}),definition({dependencyValues:ns}){let ss=null;return ns.componentSize&&(ss=ns.componentSize.size),{setValue:{number:ss}}},inverseDefinition({desiredStateVariableValues:ns,dependencyValues:ss}){return ss.componentSize?{success:!0,instructions:[{setDependency:"componentSize",desiredValue:{size:ns.number,isAbsolute:ss.componentSize.isAbsolute}}]}:{success:!1}}},rs.math=mathStateVariableFromNumberStateVariable({numberVariableName:"number",mathVariableName:"math",isPublic:!0}),rs.isAbsolute={public:!0,shadowingInstructions:{createComponentOfType:"boolean"},returnDependencies:()=>({componentSize:{dependencyType:"stateVariable",variableName:"componentSize"}}),definition({dependencyValues:ns}){let ss=null;return ns.componentSize&&(ss=ns.componentSize.isAbsolute),{setValue:{isAbsolute:ss}}}},rs.text={forRenderer:!0,returnDependencies:()=>({componentSize:{dependencyType:"stateVariable",variableName:"componentSize"}}),definition({dependencyValues:ns}){let ss="";return ns.componentSize&&(ss=ns.componentSize.size,ns.componentSize.isAbsolute?ss+="px":ss+="%"),{setValue:{text:ss}}}},rs}}zs(ComponentSize,"componentType","_componentSize"),zs(ComponentSize,"rendererType","text"),zs(ComponentSize,"primaryStateVariableForDefinition","componentSize"),zs(ComponentSize,"stateVariableForAttributeValue","componentSize"),zs(ComponentSize,"adapters",["number","math"]);class ComponentSizeList extends BaseComponent{static returnSugarInstructions(){let rs=super.returnSugarInstructions(),ns=function({matchedChildren:ss}){let os=[],ls=[],us=function(){ls.length>0&&(os.push({componentType:"_componentSize",children:ls}),ls=[])};for(let cs of ss)if(typeof cs=="string"){let ds=cs.split(/\s+/);ds[0].length===0&&(us(),ds=ds.slice(1));for(let[ps,fs]of ds.entries())fs.length>0?(ls.push(fs),ps({}),definition:()=>({setValue:{overrideChildHide:!0}})},rs.nComponents={public:!0,shadowingInstructions:{createComponentOfType:"number"},additionalStateVariablesDefined:["childIndexByArrayKey"],returnDependencies(){return{componentSizeListChildren:{dependencyType:"child",childGroups:["componentSizeLists"],variableNames:["nComponents"]},componentSizeAndComponentSizeListChildren:{dependencyType:"child",childGroups:["componentSizes","componentSizeLists"],skipComponentNames:!0}}},definition:function({dependencyValues:ns,componentInfoObjects:ss}){let os=0,ls=[],us=0;for(let[cs,ds]of ns.componentSizeAndComponentSizeListChildren.entries())if(ss.isInheritedComponentType({inheritedComponentType:ds.componentType,baseComponentType:"_componentSizeList"})){let ps=ns.componentSizeListChildren[us];us++;for(let fs=0;fs({nComponents:{dependencyType:"stateVariable",variableName:"nComponents"}}),returnArraySize({dependencyValues:ns}){return[ns.nComponents]},returnArrayDependenciesByKey({arrayKeys:ns,stateValues:ss}){let os={},ls={childIndexByArrayKey:{dependencyType:"stateVariable",variableName:"childIndexByArrayKey"}};for(let us of ns){let cs=[],ds="1";ss.childIndexByArrayKey[us]&&(cs=[ss.childIndexByArrayKey[us][0]],ds=ss.childIndexByArrayKey[us][1]+1),os[us]={componentSizeAndComponentSizeListChildren:{dependencyType:"child",childGroups:["componentSizes","componentSizeLists"],variableNames:["componentSize","componentSize"+ds],variablesOptional:!0,childIndices:cs}}}return{globalDependencies:ls,dependenciesByKey:os}},arrayDefinitionByKey({globalDependencyValues:ns,dependencyValuesByKey:ss,arrayKeys:os,componentInfoObjects:ls}){let us={};for(let cs of os){let ds=ss[cs].componentSizeAndComponentSizeListChildren[0];if(ds)if(ls.isInheritedComponentType({inheritedComponentType:ds.componentType,baseComponentType:"_componentSizeList"})){let ps=ns.childIndexByArrayKey[cs][1]+1;us[cs]=ds.stateValues["componentSize"+ps]}else us[cs]=ds.stateValues.componentSize}return{setValue:{componentSizes:us}}},inverseArrayDefinitionByKey({desiredStateVariableValues:ns,globalDependencyValues:ss,dependencyValuesByKey:os,dependencyNamesByKey:ls,arraySize:us,componentInfoObjects:cs}){let ds=[];for(let ps in ns.componentSizes){if(!os[ps])continue;let fs=os[ps].componentSizeAndComponentSizeListChildren[0];fs&&(cs.isInheritedComponentType({inheritedComponentType:fs.componentType,baseComponentType:"_componentSizeList"})?ds.push({setDependency:ls[ps].componentSizeAndComponentSizeListChildren,desiredValue:ns.componentSizes[ps],childIndex:0,variableIndex:1}):ds.push({setDependency:ls[ps].componentSizeAndComponentSizeListChildren,desiredValue:ns.componentSizes[ps],childIndex:0,variableIndex:0}))}return{success:!0,instructions:ds}}},rs.nValues={isAlias:!0,targetVariableName:"nComponents"},rs.values={isAlias:!0,targetVariableName:"componentSizes"},rs}}zs(ComponentSizeList,"componentType","_componentSizeList"),zs(ComponentSizeList,"rendererType","asList"),zs(ComponentSizeList,"renderChildren",!0),zs(ComponentSizeList,"stateVariableForAttributeValue","componentSizes");const ComponentSize$1=Object.freeze(Object.defineProperty({__proto__:null,ComponentSize,ComponentSizeList},Symbol.toStringTag,{value:"Module"})),componentTypeArray=[...Object.values(Aliases),...Object.values(MMeMen),...Object.values(MdMdnMrow),...Object.values(BooleanOperators),...Object.values(BooleanOperatorsOfMath),...Object.values(MathOperators),...Object.values(FunctionOperators),...Object.values(TextOperatorsOfMath),...Object.values(Extrema$1),...Object.values(ParagraphMarkup),...Object.values(SingleCharacterComponents),...Object.values(Sectioning),...Object.values(Lists),...Object.values(DynamicalSystems),...Object.values(Chemistry),...Object.values(FeedbackDefinitions$1),...Object.values(StyleDefinitions$1),...Object.values(SideBySide$2),...Object.values(ComponentWithSelectableType$1),...Object.values(Indexing),...Object.values(Divisions),...Object.values(Verbatim),...Object.values(Paginator$1),...Object.values(MatrixInput$1),Document,Text,TextList$1,TextList,P$2,BooleanComponent,BooleanList,MathComponent,MathList,TupleList,NumberList,NumberListFromString,Copy,Extract,Collect,Ref,Point,Coords,Line,LineSegment,Ray,Polyline,Polygon,Triangle,Rectangle,RegularPolygon,Circle,Parabola,Curve,BezierControls,ControlVectors,Vector,Angle,Answer,Award,When,MathInput,Textinput,BooleanInput,Choiceinput,Choice,NumberComponent,Integer,Graph$1,Variables,Variable,Function$1,PiecewiseFunction,Interval,Template,Option$1,Sequence,Slider,Spreadsheet,DiscreteSimulationResultList,DiscreteSimulationResultPolyline,Cell,Row,Column,CellBlock,Tabular,Table$1,Figure,Markers,Panel,Map$1,Sources,Pegboard,Constraints,ConstrainToGrid,ConstrainToGraph,AttractToGrid,ConstrainTo,AttractTo,ConstraintUnion,AttractToConstraint,Intersection,ConstrainToAngles,AttractToAngles,ConditionalContent,AsList,VariantControl,TextListFromString,SelectFromSequence,Select,Group,AnimateFromSequence,Evaluate,SelectRandomNumbers,SampleRandomNumbers,Substitute,PeriodicSet,Image$1,Video,Embed,Hint,Solution,IntComma,Pluralize,Feedback,CollaborateGroups,CollaborateGroupSetup,ConsiderAsResponses,Case,Lorem,UpdateValue,CallAction,triggerSet,FunctionIterates,Module,CustomAttribute,Setup,Footnote,Caption,Endpoint,Sort,Shuffle,SolveEquations,SolutionContainer,SubsetOfRealsInput,SubsetOfReals,Split,BestFitLine,RegionBetweenCurveXAxis,RegionHalfPlane,CodeEditor,CodeViewer,RenderDoenetML,HasSameFactoring,DataFrame,SummaryStatistics,Chart,Legend,Label$1,MatchesPattern,Matrix,EigenDecomposition,Latex,BaseComponent,InlineComponent,BlockComponent,GraphicalComponent,ConstraintComponent,Input,CompositeComponent,PointListComponent,IntervalListComponent,LineListComponent,VectorListComponent,AngleListComponent,BooleanOperator,BooleanBaseOperatorOfMath,MathOperator,MathOperatorOneInput,FunctionOperator,...Object.values(ComponentSize$1),SectioningComponent,InlineRenderInlineChildren,TextOrInline,SingleCharacter];function allComponentClasses(){const as={},rs=new Set;for(let ns of componentTypeArray){let ss=ns.componentType;if(ss===void 0)throw Error("Cannot create component as componentType is undefined for class "+ns);let os=ss.toLowerCase();if(rs.has(os))throw Error("component type "+ss+" defined in two classes");as[ss]=ns,rs.add(os)}return as}function componentTypesCreatingVariants(){const as={},rs=new Set;for(let ns of componentTypeArray)if(ns.createsVariants){let ss=ns.componentType;if(ss===void 0)throw Error("Cannot create component as componentType is undefined for class "+ns);let os=ss.toLowerCase();if(rs.has(os))throw Error("component type "+ss+" defined in two classes");as[ss]=ns,rs.add(os)}return as}/*! https://mths.be/cssesc v3.0.0 by @mathias */var object={},hasOwnProperty$1=object.hasOwnProperty,merge=function as(rs,ns){if(!rs)return ns;var ss={};for(var os in ns)ss[os]=hasOwnProperty$1.call(rs,os)?rs[os]:ns[os];return ss},regexAnySingleEscape=/[ -,\.\/:-@\[-\^`\{-~]/,regexSingleEscape=/[ -,\.\/:-@\[\]\^`\{-~]/,regexExcessiveSpaces=/(^|\\+)?(\\[A-F0-9]{1,6})\x20(?![a-fA-F0-9\x20])/g,cssesc=function as(rs,ns){ns=merge(ns,as.options),ns.quotes!="single"&&ns.quotes!="double"&&(ns.quotes="single");for(var ss=ns.quotes=="double"?'"':"'",os=ns.isIdentifier,ls=rs.charAt(0),us="",cs=0,ds=rs.length;cs126){if(fs>=55296&&fs<=56319&&csasync({coreId:Ql,componentName:Kl,stateValues:Il,childrenInstructions:$l,sourceOfUpdate:Yl,baseStateVariable:Zl,actionId:eu})=>{let tu=!1,nu=Ql+Kl;if(Zl){let iu=Ll.getLoadable(rendererUpdatesToIgnore(nu)).contents;if(Object.keys(iu).length>0){let su=iu[eu],lu=Il[Zl];su===lu||Array.isArray(su)&&Array.isArray(lu)&&su.length==lu.length&&su.every((fu,ou)=>lu[ou]===fu)?(tu=!0,Hl(rendererUpdatesToIgnore(nu),fu=>{let ou={...fu};return delete ou[eu],ou})):Hl(rendererUpdatesToIgnore(nu),{})}}let ru={stateValues:Il,childrenInstructions:$l,sourceOfUpdate:Yl,ignoreUpdate:tu,prefixForIds:js};if($l===void 0){let iu=Ll.getLoadable(rendererState(nu)).contents;ru.childrenInstructions=iu.childrenInstructions}Hl(rendererState(nu),ru)}),ss=Recoil_index_31(({snapshot:Ll,set:Hl})=>async({coreId:Ql,componentName:Kl,baseVariableValue:Il,actionId:$l})=>{let Yl=Ql+Kl;Hl(rendererUpdatesToIgnore(Yl),Zl=>{let eu={...Zl};return eu[$l]=Il,eu})}),[os,ls]=reactExports.useState(null),[us,cs]=reactExports.useState(null),[ds,ps]=reactExports.useState(null),[fs,hs]=reactExports.useState(null),[gs,ys]=reactExports.useState(null),[bs,vs]=reactExports.useState(null),[xs,Cs]=reactExports.useState(null),[Ts,Ss]=reactExports.useState(null),[Ns,As]=reactExports.useState("initial"),[ws,Es]=reactExports.useState(!1),[_s,$s]=reactExports.useState(null),Rs=reactExports.useRef({}),Is=reactExports.useRef({}),Os=reactExports.useRef(null),Ds=reactExports.useRef(!1),Vs=reactExports.useRef(null),ks=reactExports.useRef(null),Ps=reactExports.useRef([]),Bs=reactExports.useRef(null),Ms=reactExports.useRef(!1),Ws=reactExports.useRef({}),Us=reactExports.useRef({}),js=as.prefixForIds||"",Ls=reactExports.useRef([]),Gs=Recoil_index_20(darkModeAtom),Hs=Recoil_index_20(pageToolViewAtom),Ys=Recoil_index_20(itemByDoenetId(as.doenetId));Recoil_index_20(scrollableContainerAtom);let Xs=useNavigate(),Nl=useLocation(),xl=Nl.hash;reactExports.useEffect(()=>{Bs.current&&(Bs.current.onmessage=function(Ll){var Hl,Ql,Kl;Ll.data.messageType==="updateRenderers"?Ll.data.init&&Os.current||qs(Ll.data.args):Ll.data.messageType==="requestAnimationFrame"?Al(Ll.data.args):Ll.data.messageType==="cancelAnimationFrame"?Vl(Ll.data.args):Ll.data.messageType==="coreCreated"?(Ds.current=!0,Ms.current=!1,As("coreCreated"),(Hl=as.coreCreatedCallback)==null||Hl.call(as,Bs.current)):Ll.data.messageType==="initializeRenderers"?Os.current&&JSON.stringify(Os.current)===JSON.stringify(Ll.data.args.coreInfo)||Zs(Ll.data.args):Ll.data.messageType==="updateCreditAchieved"?(Ql=as.updateCreditAchievedCallback)==null||Ql.call(as,Ll.data.args):Ll.data.messageType==="savedState"?(Kl=as.saveStateCallback)==null||Kl.call(as):Ll.data.messageType==="sendToast"?(console.log(`Sending toast message: ${Ll.data.args.message}`),rs(Ll.data.args.message,Ll.data.args.toastType)):Ll.data.messageType==="resolveAction"?Qs(Ll.data.args):Ll.data.messageType==="returnAllStateVariables"?(console.log(Ll.data.args),ks.current(Ll.data.args)):Ll.data.messageType==="componentRangePieces"?window["componentRangePieces"+bs]=Ll.data.args.componentRangePieces:Ll.data.messageType==="inErrorState"?(as.setIsInErrorState&&as.setIsInErrorState(!0),ls(Ll.data.args.errMsg)):Ll.data.messageType==="resetPage"?Js(Ll.data.args):Ll.data.messageType==="copyToClipboard"?Fs(Ll.data.args):Ll.data.messageType==="navigateToTarget"?Cl(Ll.data.args):Ll.data.messageType==="terminated"&&Dl()})},[Bs.current]),reactExports.useEffect(()=>()=>{Bs.current&&Bs.current.postMessage({messageType:"terminate"})},[]),reactExports.useEffect(()=>{bs!==null&&(window["returnAllStateVariables"+bs]=function(){return Bs.current.postMessage({messageType:"returnAllStateVariables"}),new Promise((Ll,Hl)=>{ks.current=Ll})},window["callAction"+bs]=async function({actionName:Ll,componentName:Hl,args:Ql}){await Rl({action:{actionName:Ll,componentName:Hl},args:Ql})})},[bs]),reactExports.useEffect(()=>()=>{Ms.current=!0;for(let Ll in Ws.current)Vl(Ll);Ws.current={}},[]),reactExports.useEffect(()=>{document.addEventListener("visibilitychange",()=>{Bs.current&&Bs.current.postMessage({messageType:"visibilityChange",args:{visible:document.visibilityState==="visible"}})})},[]),reactExports.useEffect(()=>{if(xl&&Ds.current&&Bs.current){let Ll=xl.slice(1);Ll.substring(0,js.length)===js&&Bs.current.postMessage({messageType:"navigatingToComponent",args:{componentName:Ll.substring(js.length)}})}},[Nl,xl,Ds.current,Bs.current]),reactExports.useEffect(()=>{var Ll;if(xl&&_s&&as.pageIsActive){let Hl=xl.slice(1);(!Ls.current.includes(Nl.key)||Nl.key==="default")&&Hl.length>js.length&&Hl.substring(0,js.length)===js&&((Ll=document.getElementById(cssesc_1(Hl)))==null||Ll.scrollIntoView()),Ls.current.push(Nl.key)}},[Nl,xl,_s,as.pageIsActive]),reactExports.useEffect(()=>{Rl({action:{actionName:"setTheme"},args:{theme:Gs}})},[Gs]);function Dl(){Ms.current=!0,Bs.current.terminate(),Bs.current=null;for(let Ll in Ws.current)Vl(Ll);Ws.current={}}async function Rl({action:Ll,args:Hl,baseVariableValue:Ql,componentName:Kl,rendererType:Il}){var $l,Yl;if(Ds.current||!(($l=Is.current[Il])!=null&&$l.ignoreActionsWithoutCore)){let Zl=nanoid();Hl={...Hl},Hl.actionId=Zl,Ql!==void 0&&Kl&&ss({coreId:Vs.current,componentName:Kl,baseVariableValue:Ql,actionId:Zl});let eu={actionName:Ll.actionName,componentName:Ll.componentName,args:Hl};return(Yl=Bs.current)==null||Yl.postMessage({messageType:"requestAction",args:eu}),Ds.current||Ps.current.push(eu),new Promise((tu,nu)=>{Us.current[Zl]=tu})}}function Ml({rendererState:Ll,forceDisable:Hl,forceShowCorrectness:Ql,forceShowSolution:Kl,forceUnsuppressCheckwork:Il}){var $l;for(let Yl in Ll){let Zl=Ll[Yl].stateValues;if(Hl&&Zl.disabled===!1&&(Zl.disabled=!0),Ql&&Zl.showCorrectness===!1&&(Zl.showCorrectness=!0),Il&&Zl.suppressCheckwork===!0&&(Zl.suppressCheckwork=!1),Kl&&(($l=Ll[Yl].childrenInstructions)==null?void 0:$l.length)>0){for(let eu of Ll[Yl].childrenInstructions)if(eu.componentType==="solution"){let tu=eu.componentName;Ll[tu].stateValues.hidden&&(Ll[tu].stateValues.hidden=!1)}}}}function Zs(Ll){if(Ll.rendererState){delete Ll.rendererState.__componentNeedingUpdateValue,(as.forceDisable||as.forceShowCorrectness||as.forceShowSolution||as.forceUnsuppressCheckwork)&&Ml({rendererState:Ll.rendererState,...as});for(let Il in Ll.rendererState)ns({coreId:Vs.current,componentName:Il,stateValues:Ll.rendererState[Il].stateValues,childrenInstructions:Ll.rendererState[Il].childrenInstructions})}Os.current=Ll.coreInfo,as.generatedVariantCallback&&as.generatedVariantCallback(JSON.parse(Os.current.generatedVariantString,serializedComponentsReviver),Os.current.allPossibleVariants);let Hl=[],Ql=[];for(let Il of Os.current.rendererTypesInDocument)Ql.push(Il),Hl.push(__variableDynamicImportRuntimeHelper(Object.assign({"./renderers/alert.jsx":()=>__vitePreload(()=>import("./alert-c226fd9a.js"),[]),"./renderers/angle.jsx":()=>__vitePreload(()=>import("./angle-c70c4c3b.js"),["assets/angle-c70c4c3b.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/answer.jsx":()=>__vitePreload(()=>import("./answer-8c02c18e.js"),[]),"./renderers/asList.jsx":()=>__vitePreload(()=>import("./asList-0efae1ec.js"),[]),"./renderers/boolean.jsx":()=>__vitePreload(()=>import("./boolean-a3d2d482.js"),[]),"./renderers/booleanInput.jsx":()=>__vitePreload(()=>import("./booleanInput-102cb271.js"),["assets/booleanInput-102cb271.js","assets/ToggleButton-fffa6800.js","assets/booleanInput-01650bf1.css"]),"./renderers/c.jsx":()=>__vitePreload(()=>import("./c-8d620809.js"),[]),"./renderers/callAction.jsx":()=>__vitePreload(()=>import("./callAction-275a57a5.js"),[]),"./renderers/cell.jsx":()=>__vitePreload(()=>import("./cell-ea3cd2d6.js"),[]),"./renderers/chart.jsx":()=>__vitePreload(()=>import("./chart-82ac9578.js"),["assets/chart-82ac9578.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/choiceInput.jsx":()=>__vitePreload(()=>import("./choiceInput-5e85a5a2.js"),["assets/choiceInput-5e85a5a2.js","assets/choiceInput-92287600.css"]),"./renderers/circle.jsx":()=>__vitePreload(()=>import("./circle-0a5606a6.js"),["assets/circle-0a5606a6.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/cobwebPolyline.jsx":()=>__vitePreload(()=>import("./cobwebPolyline-29cb610e.js"),["assets/cobwebPolyline-29cb610e.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/codeEditor.jsx":()=>__vitePreload(()=>import("./codeEditor-1054a77f.js"),["assets/codeEditor-1054a77f.js","assets/css-14ccef8c.js","assets/CodeMirror-af01bb34.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/codeViewer.jsx":()=>__vitePreload(()=>import("./codeViewer-c243d08a.js"),["assets/codeViewer-c243d08a.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/containerBlock.jsx":()=>__vitePreload(()=>import("./containerBlock-d44a5ce6.js"),["assets/containerBlock-d44a5ce6.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/containerInline.jsx":()=>__vitePreload(()=>import("./containerInline-f5a5681b.js"),[]),"./renderers/curve.jsx":()=>__vitePreload(()=>import("./curve-249cdae7.js"),["assets/curve-249cdae7.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/ellipsis.jsx":()=>__vitePreload(()=>import("./ellipsis-9087eb4a.js"),[]),"./renderers/em.jsx":()=>__vitePreload(()=>import("./em-1b329239.js"),[]),"./renderers/embed.jsx":()=>__vitePreload(()=>import("./embed-f62ab46f.js"),["assets/embed-f62ab46f.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/feedback.jsx":()=>__vitePreload(()=>import("./feedback-83b2c508.js"),["assets/feedback-83b2c508.js","assets/index-47ca4f11.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/figure.jsx":()=>__vitePreload(()=>import("./figure-51094dce.js"),["assets/figure-51094dce.js","assets/visibility-sensor-aefdbbd5.js","assets/index.esm-d6b6ff57.js","assets/setPrototypeOf-51e8cf87.js"]),"./renderers/footnote.jsx":()=>__vitePreload(()=>import("./footnote-a071a0ab.js"),[]),"./renderers/graph.jsx":()=>__vitePreload(()=>import("./graph-0c612329.js"),["assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/hint.jsx":()=>__vitePreload(()=>import("./hint-b4ad3e8b.js"),["assets/hint-b4ad3e8b.js","assets/index-47ca4f11.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/image.jsx":()=>__vitePreload(()=>import("./image-b7690ea0.js"),["assets/image-b7690ea0.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/label.jsx":()=>__vitePreload(()=>import("./label-78ee8561.js"),["assets/label-78ee8561.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/legend.jsx":()=>__vitePreload(()=>import("./legend-55512da9.js"),["assets/legend-55512da9.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/line.jsx":()=>__vitePreload(()=>import("./line-b36a7b26.js"),["assets/line-b36a7b26.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/lineSegment.jsx":()=>__vitePreload(()=>import("./lineSegment-d511024e.js"),["assets/lineSegment-d511024e.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/list.jsx":()=>__vitePreload(()=>import("./list-3418a553.js"),["assets/list-3418a553.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/math.jsx":()=>__vitePreload(()=>import("./math-ffa3d1f6.js"),["assets/math-ffa3d1f6.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/mathInput.jsx":()=>__vitePreload(()=>import("./mathInput-b37ad8ec.js"),["assets/mathInput-b37ad8ec.js","assets/MathInputSelector-fa50f67b.js","assets/mathInput-cbd86307.css"]),"./renderers/mathList.jsx":()=>__vitePreload(()=>import("./mathList-25d30cec.js"),[]),"./renderers/matrixInput.jsx":()=>__vitePreload(()=>import("./matrixInput-688b8b02.js"),["assets/matrixInput-688b8b02.js","assets/ActionButton-056b08c3.js","assets/ActionButtonGroup-9e9bafb3.js","assets/mathInput-cbd86307.css"]),"./renderers/mdash.jsx":()=>__vitePreload(()=>import("./mdash-5a747c72.js"),[]),"./renderers/nbsp.jsx":()=>__vitePreload(()=>import("./nbsp-fdf85b3e.js"),[]),"./renderers/ndash.jsx":()=>__vitePreload(()=>import("./ndash-2b9718f9.js"),[]),"./renderers/number.jsx":()=>__vitePreload(()=>import("./number-30a5448d.js"),[]),"./renderers/numberList.jsx":()=>__vitePreload(()=>import("./numberList-95b4b851.js"),[]),"./renderers/orbitalDiagram.jsx":()=>__vitePreload(()=>import("./orbitalDiagram-df765f8c.js"),["assets/orbitalDiagram-df765f8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/orbitalDiagramInput.jsx":()=>__vitePreload(()=>import("./orbitalDiagramInput-e8842545.js"),["assets/orbitalDiagramInput-e8842545.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/p.jsx":()=>__vitePreload(()=>import("./p-2d693fae.js"),["assets/p-2d693fae.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/paginatorControls.jsx":()=>__vitePreload(()=>import("./paginatorControls-6e627977.js"),[]),"./renderers/pegboard.jsx":()=>__vitePreload(()=>import("./pegboard-8d7f035b.js"),["assets/pegboard-8d7f035b.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/point.jsx":()=>__vitePreload(()=>import("./point-568fc36e.js"),["assets/point-568fc36e.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/polygon.jsx":()=>__vitePreload(()=>import("./polygon-8718e4fd.js"),["assets/polygon-8718e4fd.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/polyline.jsx":()=>__vitePreload(()=>import("./polyline-19819420.js"),["assets/polyline-19819420.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/pre.jsx":()=>__vitePreload(()=>import("./pre-f047eef1.js"),["assets/pre-f047eef1.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/q.jsx":()=>__vitePreload(()=>import("./q-4058f1e9.js"),[]),"./renderers/ray.jsx":()=>__vitePreload(()=>import("./ray-fa809714.js"),["assets/ray-fa809714.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/ref.jsx":()=>__vitePreload(()=>import("./ref-d259f21d.js"),[]),"./renderers/regionBetweenCurveXAxis.jsx":()=>__vitePreload(()=>import("./regionBetweenCurveXAxis-0e1749d4.js"),["assets/regionBetweenCurveXAxis-0e1749d4.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/row.jsx":()=>__vitePreload(()=>import("./row-010cb0da.js"),[]),"./renderers/section.jsx":()=>__vitePreload(()=>import("./section-a358b9f5.js"),["assets/section-a358b9f5.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/sideBySide.jsx":()=>__vitePreload(()=>import("./sideBySide-1e910cfa.js"),["assets/sideBySide-1e910cfa.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/slider.jsx":()=>__vitePreload(()=>import("./slider-4e82f562.js"),["assets/slider-4e82f562.js","assets/ActionButton-056b08c3.js","assets/ActionButtonGroup-9e9bafb3.js"]),"./renderers/solution.jsx":()=>__vitePreload(()=>import("./solution-914435c0.js"),["assets/solution-914435c0.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/spreadsheet.jsx":()=>__vitePreload(()=>import("./spreadsheet-ffaf65b5.js"),["assets/spreadsheet-ffaf65b5.js","assets/moment-a2107d39.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js","assets/spreadsheet-f0a2a11b.css"]),"./renderers/sq.jsx":()=>__vitePreload(()=>import("./sq-20bc896e.js"),[]),"./renderers/subsetOfRealsInput.jsx":()=>__vitePreload(()=>import("./subsetOfRealsInput-59bd870f.js"),["assets/subsetOfRealsInput-59bd870f.js","assets/ActionButton-056b08c3.js","assets/ActionButtonGroup-9e9bafb3.js","assets/ToggleButton-fffa6800.js","assets/ToggleButtonGroup-0ab38e3a.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/summaryStatistics.jsx":()=>__vitePreload(()=>import("./summaryStatistics-bd1e35f8.js"),["assets/summaryStatistics-bd1e35f8.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/table.jsx":()=>__vitePreload(()=>import("./table-f1fe5d1a.js"),["assets/table-f1fe5d1a.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/tabular.jsx":()=>__vitePreload(()=>import("./tabular-bbf236ab.js"),["assets/tabular-bbf236ab.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/tag.jsx":()=>__vitePreload(()=>import("./tag-9ca120fd.js"),[]),"./renderers/text.jsx":()=>__vitePreload(()=>import("./text-af45da17.js"),["assets/text-af45da17.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/textInput.jsx":()=>__vitePreload(()=>import("./textInput-8b61e9c3.js"),["assets/textInput-8b61e9c3.js","assets/css-14ccef8c.js"]),"./renderers/textList.jsx":()=>__vitePreload(()=>import("./textList-63a95c8f.js"),[]),"./renderers/triggerSet.jsx":()=>__vitePreload(()=>import("./triggerSet-2a7a15cd.js"),[]),"./renderers/updateValue.jsx":()=>__vitePreload(()=>import("./updateValue-0c45c8c4.js"),[]),"./renderers/vector.jsx":()=>__vitePreload(()=>import("./vector-d3ac7f71.js"),["assets/vector-d3ac7f71.js","assets/graph-0c612329.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"]),"./renderers/video.jsx":()=>__vitePreload(()=>import("./video-44f5e648.js"),["assets/video-44f5e648.js","assets/css-14ccef8c.js","assets/visibility-sensor-aefdbbd5.js"])}),`./renderers/${Il}.jsx`));let Kl=Os.current.documentToRender;renderersloadComponent(Hl,Ql).then(Il=>{var Yl;Is.current=Il;let $l=Il[Kl.rendererType];$s(React.createElement($l,{key:Vs.current+Kl.componentName,componentInstructions:Kl,rendererClasses:Il,flags:as.flags,coreId:Vs.current,callAction:Rl})),(Yl=as.renderersInitializedCallback)==null||Yl.call(as)})}function qs({updateInstructions:Ll,actionId:Hl}){var Ql;for(let Kl of Ll)if(Kl.instructionType==="updateRendererStates")for(let{componentName:Il,stateValues:$l,rendererType:Yl,childrenInstructions:Zl}of Kl.rendererStatesToUpdate)ns({coreId:Vs.current,componentName:Il,stateValues:$l,childrenInstructions:Zl,sourceOfUpdate:Kl.sourceOfUpdate,baseStateVariable:(Ql=Is.current[Yl])==null?void 0:Ql.baseStateVariable,actionId:Hl});Qs({actionId:Hl})}function Qs({actionId:Ll}){var Hl,Ql;Ll&&((Ql=(Hl=Us.current)[Ll])==null||Ql.call(Hl),delete Us.current[Ll])}function Js({changedOnDevice:Ll,newCid:Hl,newAttemptNumber:Ql}){Ql!==xs?(rs("Reverted activity as attempt number changed on other device",toastType.ERROR),as.updateAttemptNumber?as.updateAttemptNumber(Ql):(as.setIsInErrorState&&as.setIsInErrorState(!0),ls("how to reset attempt number when not given updateAttemptNumber function?"))):(rs(`Reverted page to state saved on device ${Ll}`,toastType.ERROR),Vs.current=nanoid(),Es(!0))}function El(){const Ll=Vs.current;ds!==void 0?us?cidFromText(ds).then(Hl=>{Ll===Vs.current&&(Hl===us?(ys(ds),hs(us),As("continue")):(as.setIsInErrorState&&as.setIsInErrorState(!0),ls(`doenetML did not match specified cid: ${us}`)))}):cidFromText(ds).then(Hl=>{Ll===Vs.current&&(ys(ds),hs(Hl),As("continue"))}):retrieveTextFileForCid(us,"doenet").then(Hl=>{Ll===Vs.current&&(ys(Hl),hs(us),As("continue"))}).catch(Hl=>{Ll===Vs.current&&(as.setIsInErrorState&&as.setIsInErrorState(!0),ls(`doenetML not found for cid: ${us}`))})}async function _l(){const Ll=Vs.current;let Hl=!1;if(as.flags.allowLocalState){let Ql;try{Ql=await get(`${as.doenetId}|${bs}|${xs}|${fs}`)}catch{}if(Ql){if(as.flags.allowSaveState){let Kl=await Ks(Ql);if(Kl.changedOnDevice){if(Number(Kl.newAttemptNumber)!==xs){Js({changedOnDevice:Kl.changedOnDevice,newCid:Kl.newCid,newAttemptNumber:Number(Kl.newAttemptNumber)});return}else Kl.newCid!==fs&&(as.setIsInErrorState&&as.setIsInErrorState(!0),ls("content changed unexpectedly!"));Ql=Kl.newLocalInfo,console.log(`sending toast: Reverted page to state saved on device ${Kl.changedOnDevice}`),rs(`Reverted page to state saved on device ${Kl.changedOnDevice}`,toastType.ERROR)}}Ql.rendererState.__componentNeedingUpdateValue&&Rl({action:{actionName:"updateValue",componentName:Ql.rendererState.__componentNeedingUpdateValue}}),Zs({rendererState:Ql.rendererState,coreInfo:Ql.coreInfo}),Rs.current={coreState:Ql.coreState,serverSaveId:Ql.saveId,requestedVariant:JSON.parse(Ql.coreInfo.generatedVariantString,serializedComponentsReviver)},Hl=!0}}if(!Hl){const Ql={params:{cid:fs,pageNumber:bs,attemptNumber:xs,doenetId:as.doenetId,userId:as.userId,requestedVariantIndex:Ts,allowLoadState:as.flags.allowLoadState,showCorrectness:as.flags.showCorrectness,solutionDisplayMode:as.flags.solutionDisplayMode,showFeedback:as.flags.showFeedback,showHints:as.flags.showHints,autoSubmit:as.flags.autoSubmit}};try{let Kl=await axios.get("/api/loadPageState.php",Ql);if(!Kl.data.success&&as.flags.allowLoadState){as.setIsInErrorState&&as.setIsInErrorState(!0),ls(`Error loading page state: ${Kl.data.message}`);return}if(Kl.data.loadedState){let Il=JSON.parse(Kl.data.coreInfo,serializedComponentsReviver),$l=JSON.parse(Kl.data.rendererState,serializedComponentsReviver);$l.__componentNeedingUpdateValue&&Rl({action:{actionName:"updateValue",componentName:$l.__componentNeedingUpdateValue}}),Zs({rendererState:$l,coreInfo:Il}),Rs.current={coreState:JSON.parse(Kl.data.coreState,serializedComponentsReviver),serverSaveId:Kl.data.saveId,requestedVariant:JSON.parse(Il.generatedVariantString,serializedComponentsReviver)}}}catch(Kl){if(as.flags.allowLoadState){as.setIsInErrorState&&as.setIsInErrorState(!0),ls(`Error loading page state: ${Kl.message}`);return}}}Ll===Vs.current&&(as.pageIsActive?yl():As("readyToCreateCore"))}async function Ks(Ll){let Hl=await get(`${as.doenetId}|${bs}|${xs}|${fs}|ServerSaveId`),Ql={cid:fs,coreInfo:JSON.stringify(Ll.coreInfo,serializedComponentsReplacer),coreState:JSON.stringify(Ll.coreState,serializedComponentsReplacer),rendererState:JSON.stringify(Ll.rendererState,serializedComponentsReplacer),pageNumber:bs,attemptNumber:xs,doenetId:as.doenetId,saveId:Ll.saveId,serverSaveId:Hl,updateDataOnContentChange:as.updateDataOnContentChange},Kl;try{Kl=await axios.post("/api/savePageState.php",Ql)}catch{return{localInfo:Ll,cid:fs,attemptNumber:xs}}let Il=Kl.data;if(!Il.success)return{localInfo:Ll,cid:fs,attemptNumber:xs};if(await set(`${as.doenetId}|${bs}|${xs}|${fs}|ServerSaveId`,Il.saveId),Il.stateOverwritten){let $l={coreState:JSON.parse(Il.coreState,serializedComponentsReviver),rendererState:JSON.parse(Il.rendererState,serializedComponentsReviver),coreInfo:JSON.parse(Il.coreInfo,serializedComponentsReviver),saveId:Il.saveId};return await set(`${as.doenetId}|${bs}|${Il.attemptNumber}|${Il.cid}`,$l),{changedOnDevice:Il.device,newLocalInfo:$l,newCid:Il.cid,newAttemptNumber:Il.attemptNumber}}return{localInfo:Ll,cid:fs,attemptNumber:xs}}function yl(){var Ll;Bs.current&&Dl(),Bs.current=new Worker(new URL("/assets/CoreWorker-94b9bfba.js",self.location),{type:"module"}),Bs.current.postMessage({messageType:"createCore",args:{coreId:Vs.current,userId:as.userId,doenetML:gs,doenetId:as.doenetId,previousComponentTypeCounts:as.previousComponentTypeCounts,activityCid:as.activityCid,flags:as.flags,theme:Gs,requestedVariantIndex:Ts,pageNumber:bs,attemptNumber:xs,itemNumber:as.itemNumber,updateDataOnContentChange:as.updateDataOnContentChange,serverSaveId:Rs.current.serverSaveId,activityVariantIndex:as.activityVariantIndex,requestedVariant:Rs.current.requestedVariant,stateVariableChanges:Rs.current.coreState?Rs.current.coreState:void 0}}),As("waitingOnCore");for(let Hl of Ps.current)(Ll=Bs.current)==null||Ll.postMessage({messageType:"requestAction",args:Hl})}function Al({action:Ll,actionArgs:Hl,delay:Ql,animationId:Kl}){if(!Ms.current)if(Ql){let Il=window.setTimeout(()=>Sl({action:Ll,actionArgs:Hl,animationId:Kl}),Ql);Ws.current[Kl]={timeoutId:Il}}else Ws.current[Kl]={},Sl({action:Ll,actionArgs:Hl,animationId:Kl})}function Sl({action:Ll,actionArgs:Hl,animationId:Ql}){let Kl=window.requestAnimationFrame(()=>Rl({action:Ll,args:Hl})),Il=Ws.current[Ql];delete Il.timeoutId,Il.animationFrameID=Kl}async function Vl(Ll){let Hl=Ws.current[Ll],Ql=Hl==null?void 0:Hl.timeoutId;Ql!==void 0&&window.clearTimeout(Ql);let Kl=Hl==null?void 0:Hl.animationFrameID;Kl!==void 0&&window.cancelAnimationFrame(Kl),delete Ws.current[Ll]}async function Fs({text:Ll,actionId:Hl}){await navigator.clipboard.writeText(Ll),Qs({actionId:Hl})}async function Cl({cid:Ll,doenetId:Hl,variantIndex:Ql,edit:Kl,hash:Il,page:$l,uri:Yl,targetName:Zl,actionId:eu,componentName:tu,effectiveName:nu}){let ru=js+nu,{targetForATag:iu,url:su,haveValidTarget:lu,externalUri:fu}=getURLFromRef({cid:Ll,doenetId:Hl,variantIndex:Ql,edit:Kl,hash:Il,page:$l,givenUri:Yl,targetName:Zl,pageToolView:Hs,inCourse:Object.keys(Ys).length>0,search:Nl.search,id:ru});lu&&(iu==="_blank"?window.open(su,iu):Xs(su)),Qs({actionId:eu})}if(os!==null)return jsxs("div",{style:{fontSize:"1.3em",marginLeft:"20px",marginTop:"20px"},children:[jsx$1("span",{style:{fontSize:"1em",color:"#C1292E"},children:jsx$1(FontAwesomeIcon,{icon:faExclamationCircle})})," ",os]});let Tl=!1;ds!==as.doenetML&&(ps(as.doenetML),Tl=!0),us!==as.cid&&(cs(as.cid),Tl=!0);let zl=as.pageNumber;zl===void 0&&(zl="1"),zl!==bs&&(vs(zl),Tl=!0);let Xl=as.attemptNumber;Xl===void 0&&(Xl=1),Xl!==xs&&(Cs(Xl),Tl=!0);let Pl=as.requestedVariantIndex;if(Pl===void 0&&(Pl=Xl),Ts!==Pl&&(Ss(Pl),Tl=!0),Tl)return Bs.current&&Dl(),As("recalcParams"),Vs.current=nanoid(),Rs.current={},Es(!0),null;if(Ns==="wait")return null;if(Ns=="recalcParams")return As("wait"),El(),null;if(ws)return Es(!1),Os.current=null,$s(null),Ds.current=!1,As("wait"),_l(),null;if(Ns==="readyToCreateCore"&&as.pageIsActive?yl():Ns==="waitingOnCore"&&!as.pageIsActive&&(Dl(),As("readyToCreateCore")),as.hideWhenNotCurrent&&!as.pageIsCurrent)return null;let Bl=null,Wl={maxWidth:"850px",paddingLeft:"20px",paddingRight:"20px"};return Ds.current||(_s||(Bl=jsx$1("div",{style:{backgroundColor:"lightCyan",padding:"10px"},children:jsx$1("p",{children:"Initializing...."})})),Wl.backgroundColor="#F0F0F0"),jsxs(ErrorBoundary,{setIsInErrorState:as.setIsInErrorState,children:[Bl,jsx$1("div",{style:Wl,children:_s})]})}async function renderersloadComponent(as,rs){var ns={};for(let[ss,os]of as.entries())try{let ls=await os;ns[rs[ss]]=ls.default}catch(ls){throw console.log("here:",ls),Error(`loading ${rs[ss]} failed.`)}return ns}class ErrorBoundary extends React.Component{constructor(rs){super(rs),this.state={hasError:!1}}static getDerivedStateFromError(rs){return{hasError:!0}}componentDidCatch(rs,ns){var ss,os;(os=(ss=this.props).setIsInErrorState)==null||os.call(ss,!0)}render(){return this.state.hasError?jsx$1("h1",{children:"Something went wrong."}):this.props.children}}function getURLFromRef({cid:as,doenetId:rs,variantIndex:ns,edit:ss,hash:os,page:ls,givenUri:us,targetName:cs="",pageToolView:ds={},inCourse:ps=!1,search:fs="",id:hs=""}){let gs="",ys="_blank",bs=!1,vs=!1;if(as||rs){as?gs=`cid=${as}`:gs=`doenetId=${rs}`,ns&&(gs+=`&variant=${ns}`);let xs=!1;ds.page==="public"?xs=!0:ps||(xs=!0),xs?((ss===!0||ss===null&&ds.page==="public"&&ds.tool==="editor")&&(gs=`tool=editor&${gs}`),gs=`/public?${gs}`):ds.page==="placementexam"?gs=`?tool=exam&${gs}`:gs=`?tool=assignment&${gs}`,bs=!0,os?gs+=os:ls?(gs+=`#page${ls}`,cs&&(gs+=cs)):cs&&(gs+="#"+cs)}else if(us)gs=us,(gs.substring(0,8)==="https://"||gs.substring(0,7)==="http://"||gs.substring(0,7)==="mailto:")&&(bs=!0,vs=!0);else{if(gs+=fs,ls)gs+=`#page${ls}`;else{let xs=hs.indexOf("/"),Cs=hs.substring(0,xs);gs+="#"+Cs}gs+=cs,ys=null,bs=!0}return{targetForATag:ys,url:gs,haveValidTarget:bs,externalUri:vs}}const pageVariantInfoAtom=Recoil_index_8({key:"pageVariantInfoAtom",default:{index:1}}),pageVariantPanelAtom=Recoil_index_8({key:"pageVariantPanelAtom",default:{index:1,allPossibleVariants:[]}}),activityVariantPanelAtom=Recoil_index_8({key:"activityVariantPanelAtom",default:{index:1,numberOfVariants:0}});async function loader$5(){return await(await fetch("/api/getHPCarouselData.php")).json()}const HomeIntroVideo=reactExports.lazy(()=>__vitePreload(()=>import("./HomeIntroVideo-c749ef29.js"),[])),SectionText=styled$1.div` text-align: center; max-width: 800px; display: inline-block; @@ -2986,8 +2986,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho display: grid; grid-template-columns: auto min-content auto; min-height: calc(100vh - 100px); - background: var(--solidLightBlue); //Gutter color - `,ViewerInsideContainer=styled$1.div` + background: var(--solidLightBlue); //Gutter color +`,ViewerInsideContainer=styled$1.div` grid-column: 2 / 3; width: 850px; max-width: 850px; @@ -2995,7 +2995,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho min-height: calc(100vh - 100px); background: var(--canvas); border: 1px solid #949494; //Viewer Outline - margin: 20px 0px 20px 0px; //Only need when there is an outline + margin: 20px 0px 20px 0px; //Only need when there is an outline padding: 20px 5px 20px 5px; @media (max-width: 850px) { width: 100vw; @@ -3008,7 +3008,6 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho display: flex; justify-content: space-between; align-items: center; - `,HeaderSectionLeft=styled$1.div` margin: 5px; height: 30px; @@ -3031,6 +3030,6 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `,Byline=styled$1.small` position: absolute; left: 36px; - top: 8px; + top: 8px; width: 400px; -`;function PortfolioActivityViewer(){const{doenetML:as,signedIn:rs,label:ns,fullName:ss,courseId:os,doenetId:ls,pageDoenetId:us}=useLoaderData(),cs=useNavigate(),ds=Recoil_index_24(pageToolViewAtom),ps=Recoil_index_24(pageVariantPanelAtom),[fs,hs]=Recoil_index_22(pageVariantInfoAtom);function gs(ys,bs){const vs=JSON.parse(JSON.stringify(ys));ps({index:vs.index,allPossibleVariants:bs}),hs({index:vs.index})}return jsx$1(Fragment,{children:jsxs(PageContainer,{children:[jsx$1(Header,{children:jsxs(HeaderContent,{children:[jsxs("div",{children:[jsx$1(HeaderSectionLeft,{children:jsx$1(Label,{children:ns})}),jsx$1(HeaderSectionLeft,{children:jsxs(AvatarLink,{to:`/portfolio/${os}/public`,children:[jsx$1(Avatar,{size:"sm",name:ss})," ",jsxs(Byline,{children:["By ",ss]})]})})]}),jsxs("div",{children:[jsx$1(HeaderSectionRight,{children:jsx$1(Button$2,{value:"See Inside",onClick:()=>{ds({page:"public",tool:"editor",view:"",params:{}}),cs(`/public?tool=editor&doenetId=${ls}&pageId=${us}`)}})}),rs?jsx$1(HeaderSectionRight,{children:jsx$1(Form,{method:"post",children:jsx$1(Button$2,{value:"Remix",onClick:()=>{}})})}):null]})]})}),jsx$1(ViewerOutsideContainer,{children:jsx$1(ViewerInsideContainer,{children:jsx$1(PageViewer,{doenetML:as,flags:{showCorrectness:!0,solutionDisplayMode:!0,showFeedback:!0,showHints:!0,autoSubmit:!1,allowLoadState:!1,allowSaveState:!1,allowLocalState:!1,allowSaveSubmissions:!1,allowSaveEvents:!1},attemptNumber:1,generatedVariantCallback:gs,requestedVariantIndex:fs.index,pageIsActive:!0},"HPpageViewer")})})]})})}const index="",theme=extendTheme({fonts:{body:"Jost"},textStyles:{primary:{fontFamily:"Jost"}}}),router=createBrowserRouter([{path:"/",loader:loader$6,element:jsx$1(ChakraProvider,{theme,children:jsx$1(SiteHeader,{})}),children:[{path:"/",loader:loader$5,element:jsx$1(DarkmodeController,{children:jsx$1(betterReactMathjax.MathJaxContext,{version:2,config:mathjaxConfig,onStartup:as=>as.Hub.processSectionDelay=0,children:jsx$1(ChakraProvider,{theme,children:jsx$1(Home,{})})})})},{path:"community",loader:loader$7,element:jsx$1(ChakraProvider,{theme,children:jsx$1(Community,{})})},{path:"portfolio/:courseId",loader:loader$3,action:action$1,element:jsx$1(ChakraProvider,{theme,children:jsx$1(Portfolio,{})})},{path:"publicportfolio/:courseId",loader:loader$1,element:jsx$1(ChakraProvider,{theme,children:jsx$1(PublicPortfolio,{})})},{path:"/portfolioviewer/:doenetId",loader,action,element:jsx$1(DarkmodeController,{children:jsx$1(betterReactMathjax.MathJaxContext,{version:2,config:mathjaxConfig,onStartup:as=>as.Hub.processSectionDelay=0,children:jsx$1(ChakraProvider,{theme,children:jsx$1(PortfolioActivityViewer,{})})})})}]},{path:"/portfolio/:doenetId/settings",loader:loader$4,action:action$2,ErrorBoundary:ErrorBoundry,element:jsx$1(ChakraProvider,{theme,children:jsx$1(PortfolioActivitySettings,{})})},{path:"/portfolioeditor/:doenetId",loader:loader$2,element:jsx$1(DarkmodeController,{children:jsx$1(betterReactMathjax.MathJaxContext,{version:2,config:mathjaxConfig,onStartup:as=>as.Hub.processSectionDelay=0,children:jsx$1(ToolRoot,{})})})},{path:"/public",loader:loader$8,action:action$3,element:jsx$1(DarkmodeController,{children:jsx$1(betterReactMathjax.MathJaxContext,{version:2,config:mathjaxConfig,onStartup:as=>as.Hub.processSectionDelay=0,children:jsx$1(ToolRoot,{})})})},{path:"*",element:jsx$1(DarkmodeController,{children:jsx$1(betterReactMathjax.MathJaxContext,{version:2,config:mathjaxConfig,onStartup:as=>as.Hub.processSectionDelay=0,children:jsx$1(ToolRoot,{})})})}]),root=createRoot(document.getElementById("root"));root.render(jsx$1(Recoil_index_5,{children:jsx$1(RouterProvider,{router})}));export{faLink as $,CheckboxButton as A,Button$2 as B,Carousel as C,clearUsersInformationFromTheBrowser as D,suppressMenusAtom as E,Fragment as F,itemByDoenetId as G,findFirstPageOfActivity as H,coursePermissionsAndSettingsByCourseId as I,faCode as J,faUser as K,faChartPie as L,faTasks as M,UTCDateStringToDate as N,activityVariantPanelAtom as O,PageViewer as P,useSetCourseIdFromDoenetId as Q,Recoil_index_24 as R,useInitCourseItems as S,selectedCourseItems as T,Ue$1 as U,studentCourseItemOrderByCourseIdBySection as V,faFolderTree as W,faFileCode as X,authorCourseItemOrderByCourseIdBySection as Y,faLayerGroup as Z,faFileExport as _,jsxs as a,useValidateEmail as a$,faCheck as a0,faChevronDown as a1,faChevronRight as a2,serializedComponentsReviver as a3,useLoaderData as a4,peopleByCourseId as a5,useCourse as a6,formatAMPM as a7,Searchbar as a8,clear as a9,DateToUTCDateString as aA,faExternalLinkAlt as aB,global$2 as aC,propTypesExports as aD,_extends$2 as aE,courseRolePermissionsByCourseIdRoleId as aF,courseRolesByCourseId as aG,keyframes$1 as aH,jsx as aI,css$2 as aJ,faChevronLeft as aK,faThumbtack as aL,faSortDown as aM,faSortUp as aN,faSort as aO,faTimes as aP,Tree as aQ,NodeProp as aR,TreeFragment as aS,Parser$1 as aT,NodeType as aU,ContextTracker as aV,ExternalTokenizer as aW,LRParser as aX,parser as aY,fileByPageId as aZ,Ce$2 as a_,commonjsGlobal$1 as aa,scrollableContainerAtom as ab,retrieveTextFileForCid as ac,cssesc_1 as ad,nanoid as ae,set as af,Recoil_index_8 as ag,cidFromText as ah,get as ai,faExclamationCircle as aj,allComponentClasses as ak,componentTypesCreatingVariants as al,expandDoenetMLsToFullSerializedComponents as am,addDocumentIfItsMissing as an,getNumberOfVariants as ao,numberToLetters as ap,parseAndCompile as aq,enumerateCombinations as ar,countComponentTypes as as,getDefaultExportFromCjs$1 as at,reactDomExports as au,React as av,Fe$2 as aw,Recoil_index_9 as ax,Recoil_index_10 as ay,Recoil_index_11 as az,Recoil_index_21 as b,DateToDateString as b0,useDropzone as b1,faCaretRight as b2,getAugmentedNamespace$1 as b3,supportPanelHandleLeft as b4,authorCourseItemOrderByCourseId as b5,studentCourseItemOrderByCourseId as b6,faArrowUp as b7,faBackspace as b8,betterReactMathjax as b9,faPuzzlePiece as bA,ReactDOM as bB,HyperFormula as bC,cutCourseItems as ba,copiedCourseItems as bb,faChalkboard as bc,faCalendarPlus as bd,faCalendarTimes as be,DateToDisplayDateString as bf,faAngleLeft as bg,faAngleRight as bh,DateToUTCDateWithoutSecondsString as bi,authorCollectionsByCourseId as bj,useCreateCourse as bk,Recoil_index_25 as bl,faPlus as bm,useDoenetRenderer as bn,Context as bo,faLevelDownAlt as bp,faCloud as bq,rendererState as br,darkModeAtom as bs,createFunctionFromDefinition as bt,faLightbulb as bu,cidFromArrayBuffer as bv,deepCompare as bw,getURLFromRef as bx,Link as by,faCaretDown as bz,profileAtom as c,checkIfUserClearedOut as d,useNavigate as e,pageVariantPanelAtom as f,Recoil_index_22 as g,pageVariantInfoAtom as h,FontAwesomeIcon as i,jsx$1 as j,axios as k,Recoil_index_20 as l,searchParamAtomFamily as m,coursePermissionsAndSettings as n,mainPanelClickAtom as o,pageToolViewAtom as p,selectedMenuPanelAtom as q,reactExports as r,styled$1 as s,useTransition as t,useLocation as u,Recoil_index_31 as v,courseIdAtom as w,animated as x,useToast as y,toastType as z}; +`;function PortfolioActivityViewer(){const{doenetML:as,signedIn:rs,label:ns,fullName:ss,courseId:os,doenetId:ls,pageDoenetId:us}=useLoaderData(),cs=useNavigate(),ds=Recoil_index_24(pageToolViewAtom),ps=Recoil_index_24(pageVariantPanelAtom),[fs,hs]=Recoil_index_22(pageVariantInfoAtom);function gs(ys,bs){const vs=JSON.parse(JSON.stringify(ys));ps({index:vs.index,allPossibleVariants:bs}),hs({index:vs.index})}return jsx$1(Fragment,{children:jsxs(PageContainer,{children:[jsx$1(Header,{children:jsxs(HeaderContent,{children:[jsxs("div",{children:[jsx$1(HeaderSectionLeft,{children:jsx$1(Label,{children:ns})}),jsx$1(HeaderSectionLeft,{children:jsxs(AvatarLink,{to:`/publicportfolio/${os}`,children:[jsx$1(Avatar,{size:"sm",name:ss})," ",jsxs(Byline,{children:["By ",ss]})]})})]}),jsxs("div",{children:[jsx$1(HeaderSectionRight,{children:jsx$1(Button$2,{value:"See Inside",onClick:()=>{ds({page:"public",tool:"editor",view:"",params:{}}),cs(`/public?tool=editor&doenetId=${ls}&pageId=${us}`)}})}),rs?jsx$1(HeaderSectionRight,{children:jsx$1(Form,{method:"post",children:jsx$1(Button$2,{value:"Remix",onClick:()=>{}})})}):null]})]})}),jsx$1(ViewerOutsideContainer,{children:jsx$1(ViewerInsideContainer,{children:jsx$1(PageViewer,{doenetML:as,flags:{showCorrectness:!0,solutionDisplayMode:!0,showFeedback:!0,showHints:!0,autoSubmit:!1,allowLoadState:!1,allowSaveState:!1,allowLocalState:!1,allowSaveSubmissions:!1,allowSaveEvents:!1},attemptNumber:1,generatedVariantCallback:gs,requestedVariantIndex:fs.index,pageIsActive:!0},"HPpageViewer")})})]})})}const index="",theme=extendTheme({fonts:{body:"Jost"},textStyles:{primary:{fontFamily:"Jost"}}}),router=createBrowserRouter([{path:"/",loader:loader$6,element:jsx$1(ChakraProvider,{theme,children:jsx$1(SiteHeader,{})}),children:[{path:"/",loader:loader$5,element:jsx$1(DarkmodeController,{children:jsx$1(betterReactMathjax.MathJaxContext,{version:2,config:mathjaxConfig,onStartup:as=>as.Hub.processSectionDelay=0,children:jsx$1(ChakraProvider,{theme,children:jsx$1(Home,{})})})})},{path:"community",loader:loader$7,element:jsx$1(ChakraProvider,{theme,children:jsx$1(Community,{})})},{path:"portfolio/:courseId",loader:loader$3,action:action$1,element:jsx$1(ChakraProvider,{theme,children:jsx$1(Portfolio,{})})},{path:"publicportfolio/:courseId",loader:loader$1,element:jsx$1(ChakraProvider,{theme,children:jsx$1(PublicPortfolio,{})})},{path:"/portfolioviewer/:doenetId",loader,action,element:jsx$1(DarkmodeController,{children:jsx$1(betterReactMathjax.MathJaxContext,{version:2,config:mathjaxConfig,onStartup:as=>as.Hub.processSectionDelay=0,children:jsx$1(ChakraProvider,{theme,children:jsx$1(PortfolioActivityViewer,{})})})})}]},{path:"/portfolio/:doenetId/settings",loader:loader$4,action:action$2,ErrorBoundary:ErrorBoundry,element:jsx$1(ChakraProvider,{theme,children:jsx$1(PortfolioActivitySettings,{})})},{path:"/portfolioeditor/:doenetId",loader:loader$2,element:jsx$1(DarkmodeController,{children:jsx$1(betterReactMathjax.MathJaxContext,{version:2,config:mathjaxConfig,onStartup:as=>as.Hub.processSectionDelay=0,children:jsx$1(ToolRoot,{})})})},{path:"/public",loader:loader$8,action:action$3,element:jsx$1(DarkmodeController,{children:jsx$1(betterReactMathjax.MathJaxContext,{version:2,config:mathjaxConfig,onStartup:as=>as.Hub.processSectionDelay=0,children:jsx$1(ToolRoot,{})})})},{path:"*",element:jsx$1(DarkmodeController,{children:jsx$1(betterReactMathjax.MathJaxContext,{version:2,config:mathjaxConfig,onStartup:as=>as.Hub.processSectionDelay=0,children:jsx$1(ToolRoot,{})})})}]),root=createRoot(document.getElementById("root"));root.render(jsx$1(Recoil_index_5,{children:jsx$1(RouterProvider,{router})}));export{faLink as $,CheckboxButton as A,Button$2 as B,Carousel as C,clearUsersInformationFromTheBrowser as D,suppressMenusAtom as E,Fragment as F,itemByDoenetId as G,findFirstPageOfActivity as H,coursePermissionsAndSettingsByCourseId as I,faCode as J,faUser as K,faChartPie as L,faTasks as M,UTCDateStringToDate as N,activityVariantPanelAtom as O,PageViewer as P,useSetCourseIdFromDoenetId as Q,Recoil_index_24 as R,useInitCourseItems as S,selectedCourseItems as T,Ue$1 as U,studentCourseItemOrderByCourseIdBySection as V,faFolderTree as W,faFileCode as X,authorCourseItemOrderByCourseIdBySection as Y,faLayerGroup as Z,faFileExport as _,jsxs as a,useValidateEmail as a$,faCheck as a0,faChevronDown as a1,faChevronRight as a2,serializedComponentsReviver as a3,useLoaderData as a4,peopleByCourseId as a5,useCourse as a6,formatAMPM as a7,Searchbar as a8,clear as a9,DateToUTCDateString as aA,faExternalLinkAlt as aB,global$2 as aC,propTypesExports as aD,_extends$2 as aE,courseRolePermissionsByCourseIdRoleId as aF,courseRolesByCourseId as aG,keyframes$1 as aH,jsx as aI,css$2 as aJ,faChevronLeft as aK,faThumbtack as aL,faSortDown as aM,faSortUp as aN,faSort as aO,faTimes as aP,Tree as aQ,NodeProp as aR,TreeFragment as aS,Parser$1 as aT,NodeType as aU,ContextTracker as aV,ExternalTokenizer as aW,LRParser as aX,parser as aY,fileByPageId as aZ,Ce$2 as a_,commonjsGlobal$1 as aa,scrollableContainerAtom as ab,retrieveTextFileForCid as ac,cssesc_1 as ad,nanoid as ae,set as af,Recoil_index_8 as ag,cidFromText as ah,get as ai,faExclamationCircle as aj,allComponentClasses as ak,componentTypesCreatingVariants as al,expandDoenetMLsToFullSerializedComponents as am,addDocumentIfItsMissing as an,getNumberOfVariants as ao,numberToLetters as ap,parseAndCompile as aq,enumerateCombinations as ar,countComponentTypes as as,getDefaultExportFromCjs$1 as at,reactDomExports as au,React as av,Fe$2 as aw,Recoil_index_9 as ax,Recoil_index_10 as ay,Recoil_index_11 as az,Recoil_index_21 as b,DateToDateString as b0,useDropzone as b1,faCaretRight as b2,getAugmentedNamespace$1 as b3,supportPanelHandleLeft as b4,authorCourseItemOrderByCourseId as b5,studentCourseItemOrderByCourseId as b6,faArrowUp as b7,faBackspace as b8,betterReactMathjax as b9,faPuzzlePiece as bA,ReactDOM as bB,HyperFormula as bC,cutCourseItems as ba,copiedCourseItems as bb,faChalkboard as bc,faCalendarPlus as bd,faCalendarTimes as be,DateToDisplayDateString as bf,faAngleLeft as bg,faAngleRight as bh,DateToUTCDateWithoutSecondsString as bi,authorCollectionsByCourseId as bj,useCreateCourse as bk,Recoil_index_25 as bl,faPlus as bm,useDoenetRenderer as bn,Context as bo,faLevelDownAlt as bp,faCloud as bq,rendererState as br,darkModeAtom as bs,createFunctionFromDefinition as bt,faLightbulb as bu,cidFromArrayBuffer as bv,deepCompare as bw,getURLFromRef as bx,Link as by,faCaretDown as bz,profileAtom as c,checkIfUserClearedOut as d,useNavigate as e,pageVariantPanelAtom as f,Recoil_index_22 as g,pageVariantInfoAtom as h,FontAwesomeIcon as i,jsx$1 as j,axios as k,Recoil_index_20 as l,searchParamAtomFamily as m,coursePermissionsAndSettings as n,mainPanelClickAtom as o,pageToolViewAtom as p,selectedMenuPanelAtom as q,reactExports as r,styled$1 as s,useTransition as t,useLocation as u,Recoil_index_31 as v,courseIdAtom as w,animated as x,useToast as y,toastType as z}; diff --git a/dist/assets/index-1380c04c.js b/dist/assets/index-df71c5ec.js similarity index 98% rename from dist/assets/index-1380c04c.js rename to dist/assets/index-df71c5ec.js index c0d52a37b0..547cd5b171 100644 --- a/dist/assets/index-1380c04c.js +++ b/dist/assets/index-df71c5ec.js @@ -1 +1 @@ -import{r as x}from"./index-61b6fc23.js";import{c as R}from"./index-fcf36459.js";var l={};function s(e){return s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s(e)}Object.defineProperty(l,"__esModule",{value:!0});l.CopyToClipboard=void 0;var c=C(x),E=C(R),k=["text","onCopy","options","children"];function C(e){return e&&e.__esModule?e:{default:e}}function _(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function m(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function I(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i=0)&&(n[o]=e[o]);return n}function $(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function P(e,t){for(var n=0;n"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},a(e)}function O(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var w=function(e){B(n,e);var t=M(n);function n(){var r;$(this,n);for(var o=arguments.length,i=new Array(o),f=0;f=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function I(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i=0)&&(n[o]=e[o]);return n}function $(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function P(e,t){for(var n=0;n"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},a(e)}function O(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var w=function(e){B(n,e);var t=M(n);function n(){var r;$(this,n);for(var o=arguments.length,i=new Array(o),f=0;f0},e.prototype.connect_=function(){!w||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),G?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!w||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var n=t.propertyName,r=n===void 0?"":n,i=j.some(function(s){return!!~r.indexOf(s)});i&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),z=function(e,t){for(var n=0,r=Object.keys(t);n"u"||!(Element instanceof Object))){if(!(t instanceof d(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)||(n.set(t,new K(t)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof d(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)&&(n.delete(t),n.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&t.activeObservations_.push(n)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,n=this.activeObservations_.map(function(r){return new Y(r.target,r.broadcastRect())});this.callback_.call(t,n,t),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),x=typeof WeakMap<"u"?new WeakMap:new E,T=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=H.getInstance(),r=new J(t,n,this);x.set(this,r)}return e}();["observe","unobserve","disconnect"].forEach(function(e){T.prototype[e]=function(){var t;return(t=x.get(this))[e].apply(t,arguments)}});var Q=function(){return typeof v.ResizeObserver<"u"?v.ResizeObserver:T}(),X=["client","offset","scroll","bounds","margin"];function O(e){var t=[];return X.forEach(function(n){e[n]&&t.push(n)}),t}function R(e,t){var n={};if(t.indexOf("client")>-1&&(n.client={top:e.clientTop,left:e.clientLeft,width:e.clientWidth,height:e.clientHeight}),t.indexOf("offset")>-1&&(n.offset={top:e.offsetTop,left:e.offsetLeft,width:e.offsetWidth,height:e.offsetHeight}),t.indexOf("scroll")>-1&&(n.scroll={top:e.scrollTop,left:e.scrollLeft,width:e.scrollWidth,height:e.scrollHeight}),t.indexOf("bounds")>-1){var r=e.getBoundingClientRect();n.bounds={top:r.top,right:r.right,bottom:r.bottom,left:r.left,width:r.width,height:r.height}}if(t.indexOf("margin")>-1){var i=getComputedStyle(e);n.margin={top:i?parseInt(i.marginTop):0,right:i?parseInt(i.marginRight):0,bottom:i?parseInt(i.marginBottom):0,left:i?parseInt(i.marginLeft):0}}return n}function Z(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||window}function ee(e){return function(t){var n,r;return r=n=function(i){W(s,i);function s(){for(var o,c=arguments.length,h=new Array(c),l=0;l0},e.prototype.connect_=function(){!w||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),G?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!w||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var n=t.propertyName,r=n===void 0?"":n,i=j.some(function(s){return!!~r.indexOf(s)});i&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),z=function(e,t){for(var n=0,r=Object.keys(t);n"u"||!(Element instanceof Object))){if(!(t instanceof d(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)||(n.set(t,new K(t)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof d(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)&&(n.delete(t),n.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&t.activeObservations_.push(n)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,n=this.activeObservations_.map(function(r){return new Y(r.target,r.broadcastRect())});this.callback_.call(t,n,t),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),x=typeof WeakMap<"u"?new WeakMap:new E,T=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=H.getInstance(),r=new J(t,n,this);x.set(this,r)}return e}();["observe","unobserve","disconnect"].forEach(function(e){T.prototype[e]=function(){var t;return(t=x.get(this))[e].apply(t,arguments)}});var Q=function(){return typeof v.ResizeObserver<"u"?v.ResizeObserver:T}(),X=["client","offset","scroll","bounds","margin"];function O(e){var t=[];return X.forEach(function(n){e[n]&&t.push(n)}),t}function R(e,t){var n={};if(t.indexOf("client")>-1&&(n.client={top:e.clientTop,left:e.clientLeft,width:e.clientWidth,height:e.clientHeight}),t.indexOf("offset")>-1&&(n.offset={top:e.offsetTop,left:e.offsetLeft,width:e.offsetWidth,height:e.offsetHeight}),t.indexOf("scroll")>-1&&(n.scroll={top:e.scrollTop,left:e.scrollLeft,width:e.scrollWidth,height:e.scrollHeight}),t.indexOf("bounds")>-1){var r=e.getBoundingClientRect();n.bounds={top:r.top,right:r.right,bottom:r.bottom,left:r.left,width:r.width,height:r.height}}if(t.indexOf("margin")>-1){var i=getComputedStyle(e);n.margin={top:i?parseInt(i.marginTop):0,right:i?parseInt(i.marginRight):0,bottom:i?parseInt(i.marginBottom):0,left:i?parseInt(i.marginLeft):0}}return n}function Z(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||window}function ee(e){return function(t){var n,r;return r=n=function(i){W(s,i);function s(){for(var o,c=arguments.length,h=new Array(c),l=0;l()=>{t.current!==null&&(t.current.off("drag"),t.current.off("down"),t.current.off("up"),o==null||o.removeObject(t.current),t.current=null)},[]);function D(){let s=!e.draggable||e.fixed,i={visible:!e.hidden,fixed:s,layer:10*e.layer+N,highlight:!s,useMathJax:e.hasLatex,parse:!1},u;try{let r=M.fromAst(e.anchor),f=[r.get_component(0).evaluate_to_constant(),r.get_component(1).evaluate_to_constant()];Number.isFinite(f[0])||(f[0]=0,i.visible=!1),Number.isFinite(f[1])||(f[1]=0,i.visible=!1),u=o.create("point",f,{visible:!1})}catch{i.visible=!1,u=o.create("point",[0,0],{visible:!1})}i.anchor=u;let a,l;e.positionFromAnchor==="center"?(a="middle",l="middle"):e.positionFromAnchor==="lowerleft"?(a="right",l="top"):e.positionFromAnchor==="lowerright"?(a="left",l="top"):e.positionFromAnchor==="upperleft"?(a="right",l="bottom"):e.positionFromAnchor==="upperright"?(a="left",l="bottom"):e.positionFromAnchor==="bottom"?(a="middle",l="top"):e.positionFromAnchor==="top"?(a="middle",l="bottom"):e.positionFromAnchor==="right"?(a="left",l="middle"):(a="right",l="middle"),i.anchorx=a,i.anchory=l,b.current=[a,l];let n=o.create("text",[0,0,e.value],i);n.on("down",function(r){h.current=[r.x,r.y],F.current=[...u.coords.scrCoords],g.current=!1}),n.on("up",function(r){g.current&&O({action:L.moveLabel,args:{x:m.current,y:p.current}}),g.current=!1}),n.on("drag",function(r){var f=o.origin.scrCoords;let[C,_,P,X]=o.getBoundingBox(),w=n.size[0]/o.unitX,J=n.size[1]/o.unitY,E=b.current[0],G=b.current[1],v=0;E==="middle"?v=-w/2:E==="right"&&(v=-w);let A=0;G==="middle"?A=-J/2:G==="top"&&(A=-J);let T=C+.04*(P-C)-v-w,z=P-.04*(P-C)-v,V=X+.04*(_-X)-A-J,k=_-.04*(_-X)-A;m.current=(F.current[1]+r.x-h.current[0]-f[1])/o.unitX,m.current=Math.min(z,Math.max(T,m.current)),p.current=(f[2]-(F.current[2]+r.y-h.current[1]))/o.unitY,p.current=Math.min(k,Math.max(V,p.current)),O({action:L.moveLabel,args:{x:m.current,y:p.current,transient:!0,skippable:!0}}),n.relativeCoords.setCoordinates(JXG.COORDS_BY_USER,[0,0]),u.coords.setCoordinates(JXG.COORDS_BY_USER,S.current),(Math.abs(r.x-h.current[0])>.1||Math.abs(r.y-h.current[1])>.1)&&(g.current=!0)}),t.current=n,x.current=u,R.current=e.positionFromAnchor,e.hasLatex&&setTimeout(()=>{t.current&&(t.current.needsUpdate=!0,t.current.setText(e.value),t.current.update(),o==null||o.updateRenderer())},1e3)}if(o){let s;try{let i=M.fromAst(e.anchor);s=[i.get_component(0).evaluate_to_constant(),i.get_component(1).evaluate_to_constant()]}catch{s=[NaN,NaN]}if(S.current=s,t.current===null)D();else{t.current.relativeCoords.setCoordinates(JXG.COORDS_BY_USER,[0,0]),x.current.coords.setCoordinates(JXG.COORDS_BY_USER,s),t.current.setText(e.value);let i=!e.hidden;if(Number.isFinite(s[0])&&Number.isFinite(s[1])){let n=t.current.visProp.visible!==i;t.current.visProp.visible=i,t.current.visPropCalc.visible=i,n&&t.current.setAttribute({visible:i})}else t.current.visProp.visible=!1,t.current.visPropCalc.visible=!1;let u=10*e.layer+N;t.current.visProp.layer!==u&&t.current.setAttribute({layer:u});let l=!e.draggable||e.fixed;if(t.current.visProp.highlight=!l,t.current.visProp.fixed=l,t.current.needsUpdate=!0,e.positionFromAnchor!==R.current){let n,r;e.positionFromAnchor==="center"?(n="middle",r="middle"):e.positionFromAnchor==="lowerleft"?(n="right",r="top"):e.positionFromAnchor==="lowerright"?(n="left",r="top"):e.positionFromAnchor==="upperleft"?(n="right",r="bottom"):e.positionFromAnchor==="upperright"?(n="left",r="bottom"):e.positionFromAnchor==="bottom"?(n="middle",r="top"):e.positionFromAnchor==="top"?(n="middle",r="bottom"):e.positionFromAnchor==="right"?(n="left",r="middle"):(n="right",r="middle"),t.current.visProp.anchorx=n,t.current.visProp.anchory=r,b.current=[n,r],R.current=e.positionFromAnchor,t.current.fullUpdate()}else t.current.update();x.current.needsUpdate=!0,x.current.update(),o.updateRenderer()}return y("a",{name:d})}if(e.hidden)return null;if(j.length>0)return U("span",{id:d,style:{marginRight:"12px"},children:[y("a",{name:d}),j]});{let s=e.value;return e.hasLatex&&(s=y(H.MathJax,{hideUntilTypeset:"first",inline:!0,dynamic:!0,children:s})),U("span",{id:d,children:[y("a",{name:d}),s]})}});export{te as default}; +import{av as W,bn as q,r as c,bo as M,j as y,a as U,b9 as H}from"./index-9d63439d.js";import{BoardContext as I,TEXT_LAYER_OFFSET as N}from"./graph-0c612329.js";import"./css-14ccef8c.js";import"./visibility-sensor-aefdbbd5.js";const te=W.memo(function Y(B){let{name:K,id:d,SVs:e,children:j,actions:L,callAction:O}=q(B);Y.ignoreActionsWithoutCore=!0;let t=c.useRef(null),x=c.useRef(null),b=c.useRef(null);const o=c.useContext(I);let h=c.useRef(!1),F=c.useRef(!1),g=c.useRef(!1),m=c.useRef(null),p=c.useRef(null),S=c.useRef(null),R=c.useRef(null);c.useEffect(()=>()=>{t.current!==null&&(t.current.off("drag"),t.current.off("down"),t.current.off("up"),o==null||o.removeObject(t.current),t.current=null)},[]);function D(){let s=!e.draggable||e.fixed,i={visible:!e.hidden,fixed:s,layer:10*e.layer+N,highlight:!s,useMathJax:e.hasLatex,parse:!1},u;try{let r=M.fromAst(e.anchor),f=[r.get_component(0).evaluate_to_constant(),r.get_component(1).evaluate_to_constant()];Number.isFinite(f[0])||(f[0]=0,i.visible=!1),Number.isFinite(f[1])||(f[1]=0,i.visible=!1),u=o.create("point",f,{visible:!1})}catch{i.visible=!1,u=o.create("point",[0,0],{visible:!1})}i.anchor=u;let a,l;e.positionFromAnchor==="center"?(a="middle",l="middle"):e.positionFromAnchor==="lowerleft"?(a="right",l="top"):e.positionFromAnchor==="lowerright"?(a="left",l="top"):e.positionFromAnchor==="upperleft"?(a="right",l="bottom"):e.positionFromAnchor==="upperright"?(a="left",l="bottom"):e.positionFromAnchor==="bottom"?(a="middle",l="top"):e.positionFromAnchor==="top"?(a="middle",l="bottom"):e.positionFromAnchor==="right"?(a="left",l="middle"):(a="right",l="middle"),i.anchorx=a,i.anchory=l,b.current=[a,l];let n=o.create("text",[0,0,e.value],i);n.on("down",function(r){h.current=[r.x,r.y],F.current=[...u.coords.scrCoords],g.current=!1}),n.on("up",function(r){g.current&&O({action:L.moveLabel,args:{x:m.current,y:p.current}}),g.current=!1}),n.on("drag",function(r){var f=o.origin.scrCoords;let[C,_,P,X]=o.getBoundingBox(),w=n.size[0]/o.unitX,J=n.size[1]/o.unitY,E=b.current[0],G=b.current[1],v=0;E==="middle"?v=-w/2:E==="right"&&(v=-w);let A=0;G==="middle"?A=-J/2:G==="top"&&(A=-J);let T=C+.04*(P-C)-v-w,z=P-.04*(P-C)-v,V=X+.04*(_-X)-A-J,k=_-.04*(_-X)-A;m.current=(F.current[1]+r.x-h.current[0]-f[1])/o.unitX,m.current=Math.min(z,Math.max(T,m.current)),p.current=(f[2]-(F.current[2]+r.y-h.current[1]))/o.unitY,p.current=Math.min(k,Math.max(V,p.current)),O({action:L.moveLabel,args:{x:m.current,y:p.current,transient:!0,skippable:!0}}),n.relativeCoords.setCoordinates(JXG.COORDS_BY_USER,[0,0]),u.coords.setCoordinates(JXG.COORDS_BY_USER,S.current),(Math.abs(r.x-h.current[0])>.1||Math.abs(r.y-h.current[1])>.1)&&(g.current=!0)}),t.current=n,x.current=u,R.current=e.positionFromAnchor,e.hasLatex&&setTimeout(()=>{t.current&&(t.current.needsUpdate=!0,t.current.setText(e.value),t.current.update(),o==null||o.updateRenderer())},1e3)}if(o){let s;try{let i=M.fromAst(e.anchor);s=[i.get_component(0).evaluate_to_constant(),i.get_component(1).evaluate_to_constant()]}catch{s=[NaN,NaN]}if(S.current=s,t.current===null)D();else{t.current.relativeCoords.setCoordinates(JXG.COORDS_BY_USER,[0,0]),x.current.coords.setCoordinates(JXG.COORDS_BY_USER,s),t.current.setText(e.value);let i=!e.hidden;if(Number.isFinite(s[0])&&Number.isFinite(s[1])){let n=t.current.visProp.visible!==i;t.current.visProp.visible=i,t.current.visPropCalc.visible=i,n&&t.current.setAttribute({visible:i})}else t.current.visProp.visible=!1,t.current.visPropCalc.visible=!1;let u=10*e.layer+N;t.current.visProp.layer!==u&&t.current.setAttribute({layer:u});let l=!e.draggable||e.fixed;if(t.current.visProp.highlight=!l,t.current.visProp.fixed=l,t.current.needsUpdate=!0,e.positionFromAnchor!==R.current){let n,r;e.positionFromAnchor==="center"?(n="middle",r="middle"):e.positionFromAnchor==="lowerleft"?(n="right",r="top"):e.positionFromAnchor==="lowerright"?(n="left",r="top"):e.positionFromAnchor==="upperleft"?(n="right",r="bottom"):e.positionFromAnchor==="upperright"?(n="left",r="bottom"):e.positionFromAnchor==="bottom"?(n="middle",r="top"):e.positionFromAnchor==="top"?(n="middle",r="bottom"):e.positionFromAnchor==="right"?(n="left",r="middle"):(n="right",r="middle"),t.current.visProp.anchorx=n,t.current.visProp.anchory=r,b.current=[n,r],R.current=e.positionFromAnchor,t.current.fullUpdate()}else t.current.update();x.current.needsUpdate=!0,x.current.update(),o.updateRenderer()}return y("a",{name:d})}if(e.hidden)return null;if(j.length>0)return U("span",{id:d,style:{marginRight:"12px"},children:[y("a",{name:d}),j]});{let s=e.value;return e.hasLatex&&(s=y(H.MathJax,{hideUntilTypeset:"first",inline:!0,dynamic:!0,children:s})),U("span",{id:d,children:[y("a",{name:d}),s]})}});export{te as default}; diff --git a/dist/assets/legend-b70946f9.js b/dist/assets/legend-55512da9.js similarity index 96% rename from dist/assets/legend-b70946f9.js rename to dist/assets/legend-55512da9.js index fbcf5d05b5..348bbbfb90 100644 --- a/dist/assets/legend-b70946f9.js +++ b/dist/assets/legend-55512da9.js @@ -1 +1 @@ -import{av as Y,bn as w,r as g,bw as J,j as R,F as L}from"./index-61b6fc23.js";import{BoardContext as G}from"./graph-1ff63df5.js";import"./css-14ccef8c.js";import"./visibility-sensor-398e690f.js";const N=Y.memo(function(k){let{name:W,id:_,SVs:n}=w(k);const a=g.useContext(G);let c=g.useRef([]),d=g.useRef([]),b=g.useRef(null),E=g.useRef(null),v=g.useRef(null);g.useEffect(()=>()=>{U()},[]);function B(){let{xmin:f,xmax:m,ymin:x,ymax:S}=n.graphLimits,s=(S-x)*.06,i=(m-f)*.05,C=(m-f)*.02,t=f+(m-f)*.05,O;n.position.slice(0,5)==="upper"?O=x+(S-x)*.95:O=x+(S-x)*.05+s*n.legendElements.length;let y=n.position.slice(n.position.length-5,n.position.length)==="right";c.current=[],d.current=[];let u=0,D=!1;for(let[o,e]of n.legendElements.entries())if(e.label){let r=O-o*s,l={fixed:!0,highlight:!1};e.label.hasLatex&&(l.useMathJax=!0,l.parse=!1,D=!0);let p=a.create("text",[t+i+C,r,e.label.value],l);d.current.push(p),u=Math.max(u,p.rendNode.offsetWidth)}u/=a.unitX,y&&(t=Math.max(t,m-i-3*C-u));for(let[o,e]of n.legendElements.entries()){let r=O-o*s;if(e.swatchType==="marker"){let l={fillColor:e.markerColor,fillOpacity:e.lineOpacity,strokeColor:"none",size:e.markerSize,face:M(e.markerStyle),fixed:!0,highlight:!1,withLabel:!1,showInfoBox:!1},p=a.create("point",[t+i/2,r],l);c.current.push(p)}else if(e.swatchType==="rectangle"){let l={fillColor:e.filled?e.fillColor.toLowerCase():"none",fillOpacity:e.fillOpacity,fixed:!0,highlight:!1,vertices:{visible:!1},borders:{strokeColor:e.lineColor,strokeWidth:e.lineWidth,strokeOpacity:e.lineOpacity,dash:X(e.lineStyle),fixed:!0,highlight:!1}},p=a.create("polygon",[[t,r+s/4],[t+i,r+s/4],[t+i,r-s/4],[t,r-s/4]],l);c.current.push(p)}else{let l={strokeColor:e.lineColor,strokeWidth:e.lineWidth,strokeOpacity:e.lineOpacity,dash:X(e.lineStyle),fixed:!0,highlight:!1},p=a.create("segment",[[t,r],[t+i,r]],l);c.current.push(p)}y&&e.label&&d.current[o].coords.setCoordinates(JXG.COORDS_BY_USER,[t+i+C,r])}y&&D&&MathJax.Hub.Queue(()=>{u=0;for(let o of d.current)u=Math.max(u,o.rendNode.offsetWidth);u/=a.unitX,t=Math.max(t,m-i-3*C-u);for(let[o,e]of c.current.entries()){let r=O-o*s;if(e.elType==="point")e.coords.setCoordinates(JXG.COORDS_BY_USER,[t+i/2,r]),e.needsUpdate=!0,e.update();else if(e.elType==="polygon"){e.vertices[0].coords.setCoordinates(JXG.COORDS_BY_USER,[t,r+s/4]),e.vertices[1].coords.setCoordinates(JXG.COORDS_BY_USER,[t+i,r+s/4]),e.vertices[2].coords.setCoordinates(JXG.COORDS_BY_USER,[t+i,r-s/4]),e.vertices[3].coords.setCoordinates(JXG.COORDS_BY_USER,[t,r-s/4]);for(let l=0;l<4;l++)e.vertices[l].needsUpdate=!0,e.vertices[l].update(),e.borders[l].needsUpdate=!0,e.borders[l].update();e.needsUpdate=!0,e.update()}else e.point1.coords.setCoordinates(JXG.COORDS_BY_USER,[t,r]),e.point2.coords.setCoordinates(JXG.COORDS_BY_USER,[t+i,r]),e.needsUpdate=!0,e.update();d.current[o]&&(d.current[o].coords.setCoordinates(JXG.COORDS_BY_USER,[t+i+C,r]),d.current[o].needsUpdate=!0,d.current[o].update())}a.updateRenderer()})}function U(){for(let f of c.current)a.removeObject(f);for(let f of d.current)a.removeObject(f);c.current=[],d.current=[]}return a?((!J(b.current,n.legendElements)||!J(v.current,n.graphLimits)||E.current!==n.position)&&(c.current.length>0&&U(),B()),b.current=[...n.legendElements],v.current=Object.assign({},n.graphLimits),E.current=n.position,R(L,{children:R("a",{name:_})})):n.hidden?null:R(L,{children:R("a",{name:_})})});function X(h){return h==="dashed"?2:h==="solid"?0:h==="dotted"?1:0}function M(h){return h==="triangle"?"triangleup":h}export{N as default}; +import{av as Y,bn as w,r as g,bw as J,j as R,F as L}from"./index-9d63439d.js";import{BoardContext as G}from"./graph-0c612329.js";import"./css-14ccef8c.js";import"./visibility-sensor-aefdbbd5.js";const N=Y.memo(function(k){let{name:W,id:_,SVs:n}=w(k);const a=g.useContext(G);let c=g.useRef([]),d=g.useRef([]),b=g.useRef(null),E=g.useRef(null),v=g.useRef(null);g.useEffect(()=>()=>{U()},[]);function B(){let{xmin:f,xmax:m,ymin:x,ymax:S}=n.graphLimits,s=(S-x)*.06,i=(m-f)*.05,C=(m-f)*.02,t=f+(m-f)*.05,O;n.position.slice(0,5)==="upper"?O=x+(S-x)*.95:O=x+(S-x)*.05+s*n.legendElements.length;let y=n.position.slice(n.position.length-5,n.position.length)==="right";c.current=[],d.current=[];let u=0,D=!1;for(let[o,e]of n.legendElements.entries())if(e.label){let r=O-o*s,l={fixed:!0,highlight:!1};e.label.hasLatex&&(l.useMathJax=!0,l.parse=!1,D=!0);let p=a.create("text",[t+i+C,r,e.label.value],l);d.current.push(p),u=Math.max(u,p.rendNode.offsetWidth)}u/=a.unitX,y&&(t=Math.max(t,m-i-3*C-u));for(let[o,e]of n.legendElements.entries()){let r=O-o*s;if(e.swatchType==="marker"){let l={fillColor:e.markerColor,fillOpacity:e.lineOpacity,strokeColor:"none",size:e.markerSize,face:M(e.markerStyle),fixed:!0,highlight:!1,withLabel:!1,showInfoBox:!1},p=a.create("point",[t+i/2,r],l);c.current.push(p)}else if(e.swatchType==="rectangle"){let l={fillColor:e.filled?e.fillColor.toLowerCase():"none",fillOpacity:e.fillOpacity,fixed:!0,highlight:!1,vertices:{visible:!1},borders:{strokeColor:e.lineColor,strokeWidth:e.lineWidth,strokeOpacity:e.lineOpacity,dash:X(e.lineStyle),fixed:!0,highlight:!1}},p=a.create("polygon",[[t,r+s/4],[t+i,r+s/4],[t+i,r-s/4],[t,r-s/4]],l);c.current.push(p)}else{let l={strokeColor:e.lineColor,strokeWidth:e.lineWidth,strokeOpacity:e.lineOpacity,dash:X(e.lineStyle),fixed:!0,highlight:!1},p=a.create("segment",[[t,r],[t+i,r]],l);c.current.push(p)}y&&e.label&&d.current[o].coords.setCoordinates(JXG.COORDS_BY_USER,[t+i+C,r])}y&&D&&MathJax.Hub.Queue(()=>{u=0;for(let o of d.current)u=Math.max(u,o.rendNode.offsetWidth);u/=a.unitX,t=Math.max(t,m-i-3*C-u);for(let[o,e]of c.current.entries()){let r=O-o*s;if(e.elType==="point")e.coords.setCoordinates(JXG.COORDS_BY_USER,[t+i/2,r]),e.needsUpdate=!0,e.update();else if(e.elType==="polygon"){e.vertices[0].coords.setCoordinates(JXG.COORDS_BY_USER,[t,r+s/4]),e.vertices[1].coords.setCoordinates(JXG.COORDS_BY_USER,[t+i,r+s/4]),e.vertices[2].coords.setCoordinates(JXG.COORDS_BY_USER,[t+i,r-s/4]),e.vertices[3].coords.setCoordinates(JXG.COORDS_BY_USER,[t,r-s/4]);for(let l=0;l<4;l++)e.vertices[l].needsUpdate=!0,e.vertices[l].update(),e.borders[l].needsUpdate=!0,e.borders[l].update();e.needsUpdate=!0,e.update()}else e.point1.coords.setCoordinates(JXG.COORDS_BY_USER,[t,r]),e.point2.coords.setCoordinates(JXG.COORDS_BY_USER,[t+i,r]),e.needsUpdate=!0,e.update();d.current[o]&&(d.current[o].coords.setCoordinates(JXG.COORDS_BY_USER,[t+i+C,r]),d.current[o].needsUpdate=!0,d.current[o].update())}a.updateRenderer()})}function U(){for(let f of c.current)a.removeObject(f);for(let f of d.current)a.removeObject(f);c.current=[],d.current=[]}return a?((!J(b.current,n.legendElements)||!J(v.current,n.graphLimits)||E.current!==n.position)&&(c.current.length>0&&U(),B()),b.current=[...n.legendElements],v.current=Object.assign({},n.graphLimits),E.current=n.position,R(L,{children:R("a",{name:_})})):n.hidden?null:R(L,{children:R("a",{name:_})})});function X(h){return h==="dashed"?2:h==="solid"?0:h==="dotted"?1:0}function M(h){return h==="triangle"?"triangleup":h}export{N as default}; diff --git a/dist/assets/line-967c1dc1.js b/dist/assets/line-b36a7b26.js similarity index 96% rename from dist/assets/line-967c1dc1.js rename to dist/assets/line-b36a7b26.js index f04b78f36c..3f70cbd7df 100644 --- a/dist/assets/line-967c1dc1.js +++ b/dist/assets/line-b36a7b26.js @@ -1 +1 @@ -import{av as E,bn as W,r as u,l as j,bs as U,j as v,F,a as Y,b9 as B}from"./index-61b6fc23.js";import{BoardContext as T,LINE_LAYER_OFFSET as J}from"./graph-1ff63df5.js";import"./css-14ccef8c.js";import"./visibility-sensor-398e690f.js";const z=E.memo(function b(C){var D;let{name:N,id:S,SVs:e,actions:h,callAction:f}=W(C);b.ignoreActionsWithoutCore=!0;const d=u.useContext(T);let t=u.useRef({}),g=u.useRef(!1),k=u.useRef(!1),x=u.useRef(!1),L=u.useRef(null),w=u.useRef(null),p=u.useRef(null),R=u.useRef(null);R.current=e.numericalPoints;const O=j(U);u.useEffect(()=>()=>{Object.keys(t.current).length!==0&&G()},[]);function A(){var y;if(((y=e.numericalPoints)==null?void 0:y.length)!==2||e.numericalPoints.some(r=>r.length!==2)){t.current={};return}let s=!e.draggable||e.fixed,c=e.showLabel&&e.labelForGraph!=="",o=O==="dark"?e.selectedStyle.lineColorDarkMode:e.selectedStyle.lineColor;o=o.toLowerCase();var n={name:e.labelForGraph,visible:!e.hidden,withlabel:c,fixed:s,layer:10*e.layer+J,strokeColor:o,strokeOpacity:e.selectedStyle.lineOpacity,highlightStrokeColor:o,highlightStrokeOpacity:e.selectedStyle.lineOpacity*.5,strokeWidth:e.selectedStyle.lineWidth,highlightStrokeWidth:e.selectedStyle.lineWidth,dash:_(e.selectedStyle.lineStyle,e.dashed),highlight:!s};if(c){let r,l,a;e.labelPosition==="upperright"?(a=[5,5],r="left",l="bottom"):e.labelPosition==="upperleft"?(a=[-5,5],r="right",l="bottom"):e.labelPosition==="lowerright"?(a=[5,-5],r="left",l="top"):(a=[-5,-5],r="right",l="top"),n.label={offset:a,anchorx:r,anchory:l,position:"top",highlight:!1},e.labelHasLatex&&(n.label.useMathJax=!0),e.applyStyleToLabel?n.label.strokeColor=o:n.label.strokeColor="var(--canvastext)"}else n.label={highlight:!1},e.labelHasLatex&&(n.label.useMathJax=!0);let m=[[...e.numericalPoints[0]],[...e.numericalPoints[1]]],i=d.create("line",m,n);i.on("drag",function(r){(Math.abs(r.x-g.current[0])>.1||Math.abs(r.y-g.current[1])>.1)&&(x.current=!0),M(r),f({action:h.moveLine,args:{point1coords:p.current[0],point2coords:p.current[1],transient:!0,skippable:!0}}),i.point1.coords.setCoordinates(JXG.COORDS_BY_USER,R.current[0]),i.point2.coords.setCoordinates(JXG.COORDS_BY_USER,R.current[1])}),i.on("up",function(r){x.current?f({action:h.moveLine,args:{point1coords:p.current[0],point2coords:p.current[1]}}):e.switchable&&!e.fixed?(f({action:h.switchLine}),f({action:h.lineClicked})):f({action:h.lineClicked})}),i.on("down",function(r){x.current=!1,g.current=[r.x,r.y],k.current=[[...i.point1.coords.scrCoords],[...i.point2.coords.scrCoords]],f({action:h.mouseDownOnLine})}),L.current=e.showLabel&&e.labelForGraph!=="",t.current=i}function M(s){var c=d.origin.scrCoords;p.current=[];for(let o=0;o<2;o++){let n=(k.current[o][1]+s.x-g.current[0]-c[1])/d.unitX,m=(c[2]-(k.current[o][2]+s.y-g.current[1]))/d.unitY;p.current.push([n,m])}}function G(){t.current.off("drag"),t.current.off("down"),t.current.off("up"),d.removeObject(t.current),t.current={}}if(d){if(Object.keys(t.current).length===0)A();else if(((D=e.numericalPoints)==null?void 0:D.length)!==2||e.numericalPoints.some(s=>s.length!==2))G();else{let s=!0;for(let l of[e.numericalPoints[0],e.numericalPoints[1]])Number.isFinite(l[0])||(s=!1),Number.isFinite(l[1])||(s=!1);t.current.point1.coords.setCoordinates(JXG.COORDS_BY_USER,e.numericalPoints[0]),t.current.point2.coords.setCoordinates(JXG.COORDS_BY_USER,e.numericalPoints[1]);let c=!e.hidden;if(s){let l=t.current.visProp.visible!==c;t.current.visProp.visible=c,t.current.visPropCalc.visible=c,l&&t.current.setAttribute({visible:c})}else t.current.visProp.visible=!1,t.current.visPropCalc.visible=!1;let o=!e.draggable||e.fixed;t.current.visProp.fixed=o,t.current.visProp.highlight=!o;let n=10*e.layer+J;t.current.visProp.layer!==n&&t.current.setAttribute({layer:n});let i=O==="dark"?e.selectedStyle.lineColorDarkMode:e.selectedStyle.lineColor;i=i.toLowerCase(),t.current.visProp.strokecolor!==i&&(t.current.visProp.strokecolor=i,t.current.visProp.highlightstrokecolor=i),t.current.visProp.strokewidth!==e.selectedStyle.lineWidth&&(t.current.visProp.strokewidth=e.selectedStyle.lineWidth,t.current.visProp.highlightstrokewidth=e.selectedStyle.lineWidth),t.current.visProp.strokeopacity!==e.selectedStyle.lineOpacity&&(t.current.visProp.strokeopacity=e.selectedStyle.lineOpacity,t.current.visProp.highlightstrokeopacity=e.selectedStyle.lineOpacity*.5);let y=_(e.selectedStyle.lineStyle,e.dashed);t.current.visProp.dash!==y&&(t.current.visProp.dash=y),t.current.name=e.labelForGraph;let r=e.showLabel&&e.labelForGraph!=="";if(r!=L.current&&(t.current.setAttribute({withlabel:r}),L.current=r),t.current.needsUpdate=!0,t.current.update(),t.current.hasLabel)if(t.current.label.needsUpdate=!0,e.applyStyleToLabel?t.current.label.visProp.strokecolor=i:t.current.label.visProp.strokecolor="var(--canvastext)",e.labelPosition!==w.current){let l,a,P;e.labelPosition==="upperright"?(P=[5,5],l="left",a="bottom"):e.labelPosition==="upperleft"?(P=[-5,5],l="right",a="bottom"):e.labelPosition==="lowerright"?(P=[5,-5],l="left",a="top"):(P=[-5,-5],l="right",a="top"),t.current.label.visProp.anchorx=l,t.current.label.visProp.anchory=a,t.current.label.visProp.offset=P,w.current=e.labelPosition,t.current.label.fullUpdate()}else t.current.label.update();d.updateRenderer()}return v(F,{children:v("a",{name:S})})}if(e.hidden)return null;let X="\\("+e.latex+"\\)";return Y(F,{children:[v("a",{name:S}),v("span",{id:S,children:v(B.MathJax,{hideUntilTypeset:"first",inline:!0,dynamic:!0,children:X})})]})});function _(b,C){return b==="dashed"||C?2:b==="solid"?0:b==="dotted"?1:0}export{z as default}; +import{av as E,bn as W,r as u,l as j,bs as U,j as v,F,a as Y,b9 as B}from"./index-9d63439d.js";import{BoardContext as T,LINE_LAYER_OFFSET as J}from"./graph-0c612329.js";import"./css-14ccef8c.js";import"./visibility-sensor-aefdbbd5.js";const z=E.memo(function b(C){var D;let{name:N,id:S,SVs:e,actions:h,callAction:f}=W(C);b.ignoreActionsWithoutCore=!0;const d=u.useContext(T);let t=u.useRef({}),g=u.useRef(!1),k=u.useRef(!1),x=u.useRef(!1),L=u.useRef(null),w=u.useRef(null),p=u.useRef(null),R=u.useRef(null);R.current=e.numericalPoints;const O=j(U);u.useEffect(()=>()=>{Object.keys(t.current).length!==0&&G()},[]);function A(){var y;if(((y=e.numericalPoints)==null?void 0:y.length)!==2||e.numericalPoints.some(r=>r.length!==2)){t.current={};return}let s=!e.draggable||e.fixed,c=e.showLabel&&e.labelForGraph!=="",o=O==="dark"?e.selectedStyle.lineColorDarkMode:e.selectedStyle.lineColor;o=o.toLowerCase();var n={name:e.labelForGraph,visible:!e.hidden,withlabel:c,fixed:s,layer:10*e.layer+J,strokeColor:o,strokeOpacity:e.selectedStyle.lineOpacity,highlightStrokeColor:o,highlightStrokeOpacity:e.selectedStyle.lineOpacity*.5,strokeWidth:e.selectedStyle.lineWidth,highlightStrokeWidth:e.selectedStyle.lineWidth,dash:_(e.selectedStyle.lineStyle,e.dashed),highlight:!s};if(c){let r,l,a;e.labelPosition==="upperright"?(a=[5,5],r="left",l="bottom"):e.labelPosition==="upperleft"?(a=[-5,5],r="right",l="bottom"):e.labelPosition==="lowerright"?(a=[5,-5],r="left",l="top"):(a=[-5,-5],r="right",l="top"),n.label={offset:a,anchorx:r,anchory:l,position:"top",highlight:!1},e.labelHasLatex&&(n.label.useMathJax=!0),e.applyStyleToLabel?n.label.strokeColor=o:n.label.strokeColor="var(--canvastext)"}else n.label={highlight:!1},e.labelHasLatex&&(n.label.useMathJax=!0);let m=[[...e.numericalPoints[0]],[...e.numericalPoints[1]]],i=d.create("line",m,n);i.on("drag",function(r){(Math.abs(r.x-g.current[0])>.1||Math.abs(r.y-g.current[1])>.1)&&(x.current=!0),M(r),f({action:h.moveLine,args:{point1coords:p.current[0],point2coords:p.current[1],transient:!0,skippable:!0}}),i.point1.coords.setCoordinates(JXG.COORDS_BY_USER,R.current[0]),i.point2.coords.setCoordinates(JXG.COORDS_BY_USER,R.current[1])}),i.on("up",function(r){x.current?f({action:h.moveLine,args:{point1coords:p.current[0],point2coords:p.current[1]}}):e.switchable&&!e.fixed?(f({action:h.switchLine}),f({action:h.lineClicked})):f({action:h.lineClicked})}),i.on("down",function(r){x.current=!1,g.current=[r.x,r.y],k.current=[[...i.point1.coords.scrCoords],[...i.point2.coords.scrCoords]],f({action:h.mouseDownOnLine})}),L.current=e.showLabel&&e.labelForGraph!=="",t.current=i}function M(s){var c=d.origin.scrCoords;p.current=[];for(let o=0;o<2;o++){let n=(k.current[o][1]+s.x-g.current[0]-c[1])/d.unitX,m=(c[2]-(k.current[o][2]+s.y-g.current[1]))/d.unitY;p.current.push([n,m])}}function G(){t.current.off("drag"),t.current.off("down"),t.current.off("up"),d.removeObject(t.current),t.current={}}if(d){if(Object.keys(t.current).length===0)A();else if(((D=e.numericalPoints)==null?void 0:D.length)!==2||e.numericalPoints.some(s=>s.length!==2))G();else{let s=!0;for(let l of[e.numericalPoints[0],e.numericalPoints[1]])Number.isFinite(l[0])||(s=!1),Number.isFinite(l[1])||(s=!1);t.current.point1.coords.setCoordinates(JXG.COORDS_BY_USER,e.numericalPoints[0]),t.current.point2.coords.setCoordinates(JXG.COORDS_BY_USER,e.numericalPoints[1]);let c=!e.hidden;if(s){let l=t.current.visProp.visible!==c;t.current.visProp.visible=c,t.current.visPropCalc.visible=c,l&&t.current.setAttribute({visible:c})}else t.current.visProp.visible=!1,t.current.visPropCalc.visible=!1;let o=!e.draggable||e.fixed;t.current.visProp.fixed=o,t.current.visProp.highlight=!o;let n=10*e.layer+J;t.current.visProp.layer!==n&&t.current.setAttribute({layer:n});let i=O==="dark"?e.selectedStyle.lineColorDarkMode:e.selectedStyle.lineColor;i=i.toLowerCase(),t.current.visProp.strokecolor!==i&&(t.current.visProp.strokecolor=i,t.current.visProp.highlightstrokecolor=i),t.current.visProp.strokewidth!==e.selectedStyle.lineWidth&&(t.current.visProp.strokewidth=e.selectedStyle.lineWidth,t.current.visProp.highlightstrokewidth=e.selectedStyle.lineWidth),t.current.visProp.strokeopacity!==e.selectedStyle.lineOpacity&&(t.current.visProp.strokeopacity=e.selectedStyle.lineOpacity,t.current.visProp.highlightstrokeopacity=e.selectedStyle.lineOpacity*.5);let y=_(e.selectedStyle.lineStyle,e.dashed);t.current.visProp.dash!==y&&(t.current.visProp.dash=y),t.current.name=e.labelForGraph;let r=e.showLabel&&e.labelForGraph!=="";if(r!=L.current&&(t.current.setAttribute({withlabel:r}),L.current=r),t.current.needsUpdate=!0,t.current.update(),t.current.hasLabel)if(t.current.label.needsUpdate=!0,e.applyStyleToLabel?t.current.label.visProp.strokecolor=i:t.current.label.visProp.strokecolor="var(--canvastext)",e.labelPosition!==w.current){let l,a,P;e.labelPosition==="upperright"?(P=[5,5],l="left",a="bottom"):e.labelPosition==="upperleft"?(P=[-5,5],l="right",a="bottom"):e.labelPosition==="lowerright"?(P=[5,-5],l="left",a="top"):(P=[-5,-5],l="right",a="top"),t.current.label.visProp.anchorx=l,t.current.label.visProp.anchory=a,t.current.label.visProp.offset=P,w.current=e.labelPosition,t.current.label.fullUpdate()}else t.current.label.update();d.updateRenderer()}return v(F,{children:v("a",{name:S})})}if(e.hidden)return null;let X="\\("+e.latex+"\\)";return Y(F,{children:[v("a",{name:S}),v("span",{id:S,children:v(B.MathJax,{hideUntilTypeset:"first",inline:!0,dynamic:!0,children:X})})]})});function _(b,C){return b==="dashed"||C?2:b==="solid"?0:b==="dotted"?1:0}export{z as default}; diff --git a/dist/assets/lineSegment-bdbc44a3.js b/dist/assets/lineSegment-d511024e.js similarity index 97% rename from dist/assets/lineSegment-bdbc44a3.js rename to dist/assets/lineSegment-d511024e.js index 4ec22fc520..6228d0b13f 100644 --- a/dist/assets/lineSegment-bdbc44a3.js +++ b/dist/assets/lineSegment-d511024e.js @@ -1 +1 @@ -import{av as T,bn as V,r as d,l as H,bs as N,j as L,F as W}from"./index-61b6fc23.js";import{BoardContext as q,LINE_LAYER_OFFSET as Y,VERTEX_LAYER_OFFSET as G}from"./graph-1ff63df5.js";import"./css-14ccef8c.js";import"./visibility-sensor-398e690f.js";const $=T.memo(function C(I){let{name:X,id:_,SVs:e,actions:p,sourceOfUpdate:O,callAction:f}=V(I);C.ignoreActionsWithoutCore=!0;const s=d.useContext(q);let t=d.useRef(null),l=d.useRef(null),i=d.useRef(null),v=d.useRef(!1),R=d.useRef(!1),g=d.useRef(null),E=d.useRef(null),D=d.useRef(null),c=d.useRef(null),S=d.useRef(null),F=d.useRef(null);F.current=e.numericalEndpoints;const J=H(N);d.useEffect(()=>()=>{t.current&&U()},[]);function M(){if(e.numericalEndpoints.length!==2||e.numericalEndpoints.some(r=>r.length!==2)){t.current=null,l.current=null,i.current=null;return}let n=!e.draggable||e.fixed,u=e.showLabel&&e.labelForGraph!=="",a=J==="dark"?e.selectedStyle.lineColorDarkMode:e.selectedStyle.lineColor;a=a.toLowerCase();var h={name:e.labelForGraph,visible:!e.hidden,withlabel:u,fixed:n,layer:10*e.layer+Y,strokeColor:a,strokeOpacity:e.selectedStyle.lineOpacity,highlightStrokeColor:a,highlightStrokeOpacity:e.selectedStyle.lineOpacity*.5,strokeWidth:e.selectedStyle.lineWidth,highlightStrokeWidth:e.selectedStyle.lineWidth,dash:j(e.selectedStyle.lineStyle),highlight:!n};if(u){let r,m,o;e.labelPosition==="upperright"?(o=[5,5],r="left",m="bottom"):e.labelPosition==="upperleft"?(o=[-5,5],r="right",m="bottom"):e.labelPosition==="lowerright"?(o=[5,-5],r="left",m="top"):(o=[-5,-5],r="right",m="top"),h.label={offset:o,anchorx:r,anchory:m,highlight:!1},e.labelHasLatex&&(h.label.useMathJax=!0),e.applyStyleToLabel?h.label.strokeColor=a:h.label.strokeColor="var(--canvastext)"}else h.label={highlight:!1},e.labelHasLatex&&(h.label.useMathJax=!0);let k=!(!e.endpointsDraggable||e.fixed)&&!e.hidden,w=Object.assign({},h);Object.assign(w,{withLabel:!1,fixed:!1,highlight:!0,fillColor:"none",strokeColor:"none",highlightStrokeColor:"none",highlightFillColor:getComputedStyle(document.documentElement).getPropertyValue("--mainGray"),layer:10*e.layer+G,showInfoBox:e.showCoordsWhenDragging,visible:k});let b=[[...e.numericalEndpoints[0]],[...e.numericalEndpoints[1]]];return l.current=s.create("point",b[0],w),i.current=s.create("point",b[1],w),t.current=s.create("segment",[l.current,i.current],h),l.current.on("drag",r=>A(1,r)),i.current.on("drag",r=>A(2,r)),t.current.on("drag",r=>A(0,r)),l.current.on("up",()=>{g.current===1?f({action:p.moveLineSegment,args:{point1coords:c.current}}):g.current===null&&f({action:p.lineSegmentClicked}),S.current=null}),i.current.on("up",()=>{g.current===2?f({action:p.moveLineSegment,args:{point2coords:c.current}}):g.current===null&&f({action:p.lineSegmentClicked}),S.current=null}),t.current.on("up",function(r){g.current===0?f({action:p.moveLineSegment,args:{point1coords:c.current[0],point2coords:c.current[1]}}):g.current===null&&S.current===null&&f({action:p.lineSegmentClicked})}),l.current.on("down",r=>{g.current=null,v.current=[r.x,r.y],S.current=1,f({action:p.mouseDownOnLineSegment})}),i.current.on("down",r=>{g.current=null,v.current=[r.x,r.y],S.current=2,f({action:p.mouseDownOnLineSegment})}),t.current.on("down",function(r){g.current=null,v.current=[r.x,r.y],R.current=[[...l.current.coords.scrCoords],[...i.current.coords.scrCoords]],S.current===null&&f({action:p.mouseDownOnLineSegment})}),D.current=e.labelPosition,E.current=u,t.current}function A(n,u){(Math.abs(u.x-v.current[0])>.1||Math.abs(u.y-v.current[1])>.1)&&(g.current=n,n==1?(c.current=[t.current.point1.X(),t.current.point1.Y()],f({action:p.moveLineSegment,args:{point1coords:c.current,transient:!0,skippable:!0,sourceDetails:{endpoint:n}}})):n==2?(c.current=[t.current.point2.X(),t.current.point2.Y()],f({action:p.moveLineSegment,args:{point2coords:c.current,transient:!0,skippable:!0,sourceDetails:{endpoint:n}}})):(B(u),f({action:p.moveLineSegment,args:{point1coords:c.current[0],point2coords:c.current[1],transient:!0,skippable:!0}}))),t.current.point1.coords.setCoordinates(JXG.COORDS_BY_USER,F.current[0]),t.current.point2.coords.setCoordinates(JXG.COORDS_BY_USER,F.current[1]),n==1?s.updateInfobox(t.current.point1):n==2&&s.updateInfobox(t.current.point2)}function B(n){var u=s.origin.scrCoords;c.current=[];for(let a=0;a<2;a++){let h=(R.current[a][1]+n.x-v.current[0]-u[1])/s.unitX,y=(u[2]-(R.current[a][2]+n.y-v.current[1]))/s.unitY;c.current.push([h,y])}return c.current}function U(){t.current.off("drag"),t.current.off("down"),t.current.off("up"),s.removeObject(t.current),t.current=null,l.current.off("drag"),l.current.off("down"),l.current.off("up"),s.removeObject(l.current),l.current=null,i.current.off("drag"),i.current.off("down"),i.current.off("up"),s.removeObject(i.current),i.current=null}if(s){if(t.current===null)M();else if(e.numericalEndpoints.length!==2||e.numericalEndpoints.some(n=>n.length!==2))U();else{let n=!0;for(let o of[e.numericalEndpoints[0],e.numericalEndpoints[1]])Number.isFinite(o[0])||(n=!1),Number.isFinite(o[1])||(n=!1);if(t.current.point1.coords.setCoordinates(JXG.COORDS_BY_USER,e.numericalEndpoints[0]),t.current.point2.coords.setCoordinates(JXG.COORDS_BY_USER,e.numericalEndpoints[1]),O.sourceInformation&&X in O.sourceInformation){let o=O.sourceInformation[X].endpoint;o===1?s.updateInfobox(t.current.point1):o===2&&s.updateInfobox(t.current.point2)}let u=!e.hidden&&n;if(n){let o=t.current.visProp.visible!==u;t.current.visProp.visible=u,t.current.visPropCalc.visible=u,o&&t.current.setAttribute({visible:u})}else t.current.visProp.visible=!1,t.current.visPropCalc.visible=!1;let a=!e.draggable||e.fixed,y=!(!e.endpointsDraggable||e.fixed)&&u;l.current.visProp.visible=y,l.current.visPropCalc.visible=y,i.current.visProp.visible=y,i.current.visPropCalc.visible=y,t.current.visProp.fixed=a,t.current.visProp.highlight=!a;let k=10*e.layer+Y;t.current.visProp.layer!==k&&(t.current.setAttribute({layer:k}),l.current.setAttribute({layer:10*e.layer+G}),i.current.setAttribute({layer:10*e.layer+G}));let b=J==="dark"?e.selectedStyle.lineColorDarkMode:e.selectedStyle.lineColor;b=b.toLowerCase(),t.current.visProp.strokecolor!==b&&(t.current.visProp.strokecolor=b,t.current.visProp.highlightstrokecolor=b),t.current.visProp.strokewidth!==e.selectedStyle.lineWidth&&(t.current.visProp.strokewidth=e.selectedStyle.lineWidth,t.current.visProp.highlightstrokewidth=e.selectedStyle.lineWidth),t.current.visProp.strokeopacity!==e.selectedStyle.lineOpacity&&(t.current.visProp.strokeopacity=e.selectedStyle.lineOpacity,t.current.visProp.highlightstrokeopacity=e.selectedStyle.lineOpacity*.5);let r=j(e.selectedStyle.lineStyle);t.current.visProp.dash!==r&&(t.current.visProp.dash=r),t.current.name=e.labelForGraph;let m=e.showLabel&&e.labelForGraph!=="";if(m!=E.current&&(t.current.setAttribute({withlabel:m}),E.current=m),t.current.needsUpdate=!0,t.current.update(),t.current.hasLabel)if(t.current.label.needsUpdate=!0,e.applyStyleToLabel?t.current.label.visProp.strokecolor=b:t.current.label.visProp.strokecolor="var(--canvastext)",e.labelPosition!==D.current){let o,P,x;e.labelPosition==="upperright"?(x=[5,5],o="left",P="bottom"):e.labelPosition==="upperleft"?(x=[-5,5],o="right",P="bottom"):e.labelPosition==="lowerright"?(x=[5,-5],o="left",P="top"):(x=[-5,-5],o="right",P="top"),t.current.label.visProp.anchorx=o,t.current.label.visProp.anchory=P,t.current.label.visProp.offset=x,D.current=e.labelPosition,t.current.label.fullUpdate()}else t.current.label.update();l.current.needsUpdate=!0,l.current.update(),i.current.needsUpdate=!0,i.current.update(),s.updateRenderer()}return L(W,{children:L("a",{name:_})})}return e.hidden?null:L(W,{children:L("a",{name:_})})});function j(C){return C==="solid"?0:C==="dashed"?2:C==="dotted"?1:0}export{$ as default}; +import{av as T,bn as V,r as d,l as H,bs as N,j as L,F as W}from"./index-9d63439d.js";import{BoardContext as q,LINE_LAYER_OFFSET as Y,VERTEX_LAYER_OFFSET as G}from"./graph-0c612329.js";import"./css-14ccef8c.js";import"./visibility-sensor-aefdbbd5.js";const $=T.memo(function C(I){let{name:X,id:_,SVs:e,actions:p,sourceOfUpdate:O,callAction:f}=V(I);C.ignoreActionsWithoutCore=!0;const s=d.useContext(q);let t=d.useRef(null),l=d.useRef(null),i=d.useRef(null),v=d.useRef(!1),R=d.useRef(!1),g=d.useRef(null),E=d.useRef(null),D=d.useRef(null),c=d.useRef(null),S=d.useRef(null),F=d.useRef(null);F.current=e.numericalEndpoints;const J=H(N);d.useEffect(()=>()=>{t.current&&U()},[]);function M(){if(e.numericalEndpoints.length!==2||e.numericalEndpoints.some(r=>r.length!==2)){t.current=null,l.current=null,i.current=null;return}let n=!e.draggable||e.fixed,u=e.showLabel&&e.labelForGraph!=="",a=J==="dark"?e.selectedStyle.lineColorDarkMode:e.selectedStyle.lineColor;a=a.toLowerCase();var h={name:e.labelForGraph,visible:!e.hidden,withlabel:u,fixed:n,layer:10*e.layer+Y,strokeColor:a,strokeOpacity:e.selectedStyle.lineOpacity,highlightStrokeColor:a,highlightStrokeOpacity:e.selectedStyle.lineOpacity*.5,strokeWidth:e.selectedStyle.lineWidth,highlightStrokeWidth:e.selectedStyle.lineWidth,dash:j(e.selectedStyle.lineStyle),highlight:!n};if(u){let r,m,o;e.labelPosition==="upperright"?(o=[5,5],r="left",m="bottom"):e.labelPosition==="upperleft"?(o=[-5,5],r="right",m="bottom"):e.labelPosition==="lowerright"?(o=[5,-5],r="left",m="top"):(o=[-5,-5],r="right",m="top"),h.label={offset:o,anchorx:r,anchory:m,highlight:!1},e.labelHasLatex&&(h.label.useMathJax=!0),e.applyStyleToLabel?h.label.strokeColor=a:h.label.strokeColor="var(--canvastext)"}else h.label={highlight:!1},e.labelHasLatex&&(h.label.useMathJax=!0);let k=!(!e.endpointsDraggable||e.fixed)&&!e.hidden,w=Object.assign({},h);Object.assign(w,{withLabel:!1,fixed:!1,highlight:!0,fillColor:"none",strokeColor:"none",highlightStrokeColor:"none",highlightFillColor:getComputedStyle(document.documentElement).getPropertyValue("--mainGray"),layer:10*e.layer+G,showInfoBox:e.showCoordsWhenDragging,visible:k});let b=[[...e.numericalEndpoints[0]],[...e.numericalEndpoints[1]]];return l.current=s.create("point",b[0],w),i.current=s.create("point",b[1],w),t.current=s.create("segment",[l.current,i.current],h),l.current.on("drag",r=>A(1,r)),i.current.on("drag",r=>A(2,r)),t.current.on("drag",r=>A(0,r)),l.current.on("up",()=>{g.current===1?f({action:p.moveLineSegment,args:{point1coords:c.current}}):g.current===null&&f({action:p.lineSegmentClicked}),S.current=null}),i.current.on("up",()=>{g.current===2?f({action:p.moveLineSegment,args:{point2coords:c.current}}):g.current===null&&f({action:p.lineSegmentClicked}),S.current=null}),t.current.on("up",function(r){g.current===0?f({action:p.moveLineSegment,args:{point1coords:c.current[0],point2coords:c.current[1]}}):g.current===null&&S.current===null&&f({action:p.lineSegmentClicked})}),l.current.on("down",r=>{g.current=null,v.current=[r.x,r.y],S.current=1,f({action:p.mouseDownOnLineSegment})}),i.current.on("down",r=>{g.current=null,v.current=[r.x,r.y],S.current=2,f({action:p.mouseDownOnLineSegment})}),t.current.on("down",function(r){g.current=null,v.current=[r.x,r.y],R.current=[[...l.current.coords.scrCoords],[...i.current.coords.scrCoords]],S.current===null&&f({action:p.mouseDownOnLineSegment})}),D.current=e.labelPosition,E.current=u,t.current}function A(n,u){(Math.abs(u.x-v.current[0])>.1||Math.abs(u.y-v.current[1])>.1)&&(g.current=n,n==1?(c.current=[t.current.point1.X(),t.current.point1.Y()],f({action:p.moveLineSegment,args:{point1coords:c.current,transient:!0,skippable:!0,sourceDetails:{endpoint:n}}})):n==2?(c.current=[t.current.point2.X(),t.current.point2.Y()],f({action:p.moveLineSegment,args:{point2coords:c.current,transient:!0,skippable:!0,sourceDetails:{endpoint:n}}})):(B(u),f({action:p.moveLineSegment,args:{point1coords:c.current[0],point2coords:c.current[1],transient:!0,skippable:!0}}))),t.current.point1.coords.setCoordinates(JXG.COORDS_BY_USER,F.current[0]),t.current.point2.coords.setCoordinates(JXG.COORDS_BY_USER,F.current[1]),n==1?s.updateInfobox(t.current.point1):n==2&&s.updateInfobox(t.current.point2)}function B(n){var u=s.origin.scrCoords;c.current=[];for(let a=0;a<2;a++){let h=(R.current[a][1]+n.x-v.current[0]-u[1])/s.unitX,y=(u[2]-(R.current[a][2]+n.y-v.current[1]))/s.unitY;c.current.push([h,y])}return c.current}function U(){t.current.off("drag"),t.current.off("down"),t.current.off("up"),s.removeObject(t.current),t.current=null,l.current.off("drag"),l.current.off("down"),l.current.off("up"),s.removeObject(l.current),l.current=null,i.current.off("drag"),i.current.off("down"),i.current.off("up"),s.removeObject(i.current),i.current=null}if(s){if(t.current===null)M();else if(e.numericalEndpoints.length!==2||e.numericalEndpoints.some(n=>n.length!==2))U();else{let n=!0;for(let o of[e.numericalEndpoints[0],e.numericalEndpoints[1]])Number.isFinite(o[0])||(n=!1),Number.isFinite(o[1])||(n=!1);if(t.current.point1.coords.setCoordinates(JXG.COORDS_BY_USER,e.numericalEndpoints[0]),t.current.point2.coords.setCoordinates(JXG.COORDS_BY_USER,e.numericalEndpoints[1]),O.sourceInformation&&X in O.sourceInformation){let o=O.sourceInformation[X].endpoint;o===1?s.updateInfobox(t.current.point1):o===2&&s.updateInfobox(t.current.point2)}let u=!e.hidden&&n;if(n){let o=t.current.visProp.visible!==u;t.current.visProp.visible=u,t.current.visPropCalc.visible=u,o&&t.current.setAttribute({visible:u})}else t.current.visProp.visible=!1,t.current.visPropCalc.visible=!1;let a=!e.draggable||e.fixed,y=!(!e.endpointsDraggable||e.fixed)&&u;l.current.visProp.visible=y,l.current.visPropCalc.visible=y,i.current.visProp.visible=y,i.current.visPropCalc.visible=y,t.current.visProp.fixed=a,t.current.visProp.highlight=!a;let k=10*e.layer+Y;t.current.visProp.layer!==k&&(t.current.setAttribute({layer:k}),l.current.setAttribute({layer:10*e.layer+G}),i.current.setAttribute({layer:10*e.layer+G}));let b=J==="dark"?e.selectedStyle.lineColorDarkMode:e.selectedStyle.lineColor;b=b.toLowerCase(),t.current.visProp.strokecolor!==b&&(t.current.visProp.strokecolor=b,t.current.visProp.highlightstrokecolor=b),t.current.visProp.strokewidth!==e.selectedStyle.lineWidth&&(t.current.visProp.strokewidth=e.selectedStyle.lineWidth,t.current.visProp.highlightstrokewidth=e.selectedStyle.lineWidth),t.current.visProp.strokeopacity!==e.selectedStyle.lineOpacity&&(t.current.visProp.strokeopacity=e.selectedStyle.lineOpacity,t.current.visProp.highlightstrokeopacity=e.selectedStyle.lineOpacity*.5);let r=j(e.selectedStyle.lineStyle);t.current.visProp.dash!==r&&(t.current.visProp.dash=r),t.current.name=e.labelForGraph;let m=e.showLabel&&e.labelForGraph!=="";if(m!=E.current&&(t.current.setAttribute({withlabel:m}),E.current=m),t.current.needsUpdate=!0,t.current.update(),t.current.hasLabel)if(t.current.label.needsUpdate=!0,e.applyStyleToLabel?t.current.label.visProp.strokecolor=b:t.current.label.visProp.strokecolor="var(--canvastext)",e.labelPosition!==D.current){let o,P,x;e.labelPosition==="upperright"?(x=[5,5],o="left",P="bottom"):e.labelPosition==="upperleft"?(x=[-5,5],o="right",P="bottom"):e.labelPosition==="lowerright"?(x=[5,-5],o="left",P="top"):(x=[-5,-5],o="right",P="top"),t.current.label.visProp.anchorx=o,t.current.label.visProp.anchory=P,t.current.label.visProp.offset=x,D.current=e.labelPosition,t.current.label.fullUpdate()}else t.current.label.update();l.current.needsUpdate=!0,l.current.update(),i.current.needsUpdate=!0,i.current.update(),s.updateRenderer()}return L(W,{children:L("a",{name:_})})}return e.hidden?null:L(W,{children:L("a",{name:_})})});function j(C){return C==="solid"?0:C==="dashed"?2:C==="dotted"?1:0}export{$ as default}; diff --git a/dist/assets/list-6e9609f2.js b/dist/assets/list-3418a553.js similarity index 94% rename from dist/assets/list-6e9609f2.js rename to dist/assets/list-3418a553.js index 290517a2ae..6ef97f2a15 100644 --- a/dist/assets/list-6e9609f2.js +++ b/dist/assets/list-3418a553.js @@ -1 +1 @@ -import{av as h,bn as y,r as b,j as e,a as s,F as o}from"./index-61b6fc23.js";import{V as u}from"./visibility-sensor-398e690f.js";const C=h.memo(function(m){let{name:f,id:i,SVs:l,children:t,actions:c,callAction:d}=y(m),a=r=>{d({action:c.recordVisibilityChange,args:{isVisible:r}})};if(b.useEffect(()=>()=>{d({action:c.recordVisibilityChange,args:{isVisible:!1}})},[]),l.hidden)return null;if(l.item)return e(u,{partialVisibility:!0,onChange:a,requireContentsSize:!1,children:s(o,{children:[e("a",{name:i}),e("li",{id:i,children:t})]})});if(l.numbered){let r=n.numbered[(l.level-1)%n.numbered.length];return e(u,{partialVisibility:!0,onChange:a,children:e(o,{children:s("ol",{id:i,style:{listStyleType:r},children:[e("a",{name:i}),t]})})})}else{let r=n.unnumbered[(l.level-1)%n.unnumbered.length];return e(u,{partialVisibility:!0,onChange:a,children:e(o,{children:s("ul",{id:i,style:{listStyleType:r},children:[e("a",{name:i}),t]})})})}}),n={numbered:["decimal","lower-alpha","lower-roman","upper-alpha","upper-roman"],unnumbered:["disc","circle","square"]};export{C as default}; +import{av as h,bn as y,r as b,j as e,a as s,F as o}from"./index-9d63439d.js";import{V as u}from"./visibility-sensor-aefdbbd5.js";const C=h.memo(function(m){let{name:f,id:i,SVs:l,children:t,actions:c,callAction:d}=y(m),a=r=>{d({action:c.recordVisibilityChange,args:{isVisible:r}})};if(b.useEffect(()=>()=>{d({action:c.recordVisibilityChange,args:{isVisible:!1}})},[]),l.hidden)return null;if(l.item)return e(u,{partialVisibility:!0,onChange:a,requireContentsSize:!1,children:s(o,{children:[e("a",{name:i}),e("li",{id:i,children:t})]})});if(l.numbered){let r=n.numbered[(l.level-1)%n.numbered.length];return e(u,{partialVisibility:!0,onChange:a,children:e(o,{children:s("ol",{id:i,style:{listStyleType:r},children:[e("a",{name:i}),t]})})})}else{let r=n.unnumbered[(l.level-1)%n.unnumbered.length];return e(u,{partialVisibility:!0,onChange:a,children:e(o,{children:s("ul",{id:i,style:{listStyleType:r},children:[e("a",{name:i}),t]})})})}}),n={numbered:["decimal","lower-alpha","lower-roman","upper-alpha","upper-roman"],unnumbered:["disc","circle","square"]};export{C as default}; diff --git a/dist/assets/math-4022ba18.js b/dist/assets/math-ffa3d1f6.js similarity index 96% rename from dist/assets/math-4022ba18.js rename to dist/assets/math-ffa3d1f6.js index 8e53da68f1..8f11af0f5d 100644 --- a/dist/assets/math-4022ba18.js +++ b/dist/assets/math-ffa3d1f6.js @@ -1 +1 @@ -import{av as Z,bn as ee,r as u,bo as W,j as h,a as F,F as D,b9 as E}from"./index-61b6fc23.js";import{BoardContext as te,TEXT_LAYER_OFFSET as $}from"./graph-1ff63df5.js";import"./css-14ccef8c.js";import"./visibility-sensor-398e690f.js";const se=Z.memo(function z(V){let{name:re,id:p,SVs:e,actions:G,sourceOfUpdate:ne,callAction:Y}=ee(V);z.ignoreActionsWithoutCore=!0;let t=u.useRef(null),M=u.useRef(null),R=u.useRef(null);const a=u.useContext(te);let y=u.useRef(!1),J=u.useRef(!1),_=u.useRef(!1),A=u.useRef(null),v=u.useRef(null),B=u.useRef(null),X=u.useRef(null);u.useEffect(()=>()=>{t.current!==null&&(t.current.off("drag"),t.current.off("down"),t.current.off("up"),a==null||a.removeObject(t.current),t.current=null)},[]);function k(){let o=!e.draggable||e.fixed,i={visible:!e.hidden,fixed:o,layer:10*e.layer+$,highlight:!o,useMathJax:!0,parse:!1},c;try{let r=W.fromAst(e.anchor),m=[r.get_component(0).evaluate_to_constant(),r.get_component(1).evaluate_to_constant()];Number.isFinite(m[0])||(m[0]=0,i.visible=!1),Number.isFinite(m[1])||(m[1]=0,i.visible=!1),c=a.create("point",m,{visible:!1})}catch{i.visible=!1,c=a.create("point",[0,0],{visible:!1})}i.anchor=c;let l,s;e.positionFromAnchor==="center"?(l="middle",s="middle"):e.positionFromAnchor==="lowerleft"?(l="right",s="top"):e.positionFromAnchor==="lowerright"?(l="left",s="top"):e.positionFromAnchor==="upperleft"?(l="right",s="bottom"):e.positionFromAnchor==="upperright"?(l="left",s="bottom"):e.positionFromAnchor==="bottom"?(l="middle",s="top"):e.positionFromAnchor==="top"?(l="middle",s="bottom"):e.positionFromAnchor==="right"?(l="left",s="middle"):(l="right",s="middle"),i.anchorx=l,i.anchory=s,R.current=[l,s];let f,d;e.renderMode==="inline"?(f="\\(",d="\\)"):e.renderMode==="display"?(f="\\[",d="\\]"):e.renderMode==="numbered"?(f=`\\begin{gather}\\tag{${e.equationTag}}`,d="\\end{gather}"):e.renderMode==="align"?(f="\\begin{align}",d="\\end{align}"):(f="\\(",d="\\)");let n=a.create("text",[0,0,f+e.latex+d],i);n.on("down",function(r){y.current=[r.x,r.y],J.current=[...c.coords.scrCoords],_.current=!1}),n.on("up",function(r){_.current&&Y({action:G.moveMath,args:{x:A.current,y:v.current}}),_.current=!1}),n.on("drag",function(r){var m=a.origin.scrCoords;let[O,T,U,j]=a.getBoundingBox(),N=n.size[0]/a.unitX,S=n.size[1]/a.unitY,q=R.current[0],I=R.current[1],P=0;q==="middle"?P=-N/2:q==="right"&&(P=-N);let w=0;I==="middle"?w=-S/2:I==="top"&&(w=-S);let L=O+.04*(U-O)-P-N,H=U-.04*(U-O)-P,K=j+.04*(T-j)-w-S,Q=T-.04*(T-j)-w;A.current=(J.current[1]+r.x-y.current[0]-m[1])/a.unitX,A.current=Math.min(H,Math.max(L,A.current)),v.current=(m[2]-(J.current[2]+r.y-y.current[1]))/a.unitY,v.current=Math.min(Q,Math.max(K,v.current)),Y({action:G.moveMath,args:{x:A.current,y:v.current,transient:!0,skippable:!0}}),n.relativeCoords.setCoordinates(JXG.COORDS_BY_USER,[0,0]),c.coords.setCoordinates(JXG.COORDS_BY_USER,B.current),(Math.abs(r.x-y.current[0])>.1||Math.abs(r.y-y.current[1])>.1)&&(_.current=!0)}),t.current=n,M.current=c,X.current=e.positionFromAnchor,setTimeout(()=>{t.current&&(t.current.needsUpdate=!0,t.current.setText(f+e.latex+d),t.current.update(),a.updateRenderer())},1e3)}if(a){let o;try{let i=W.fromAst(e.anchor);o=[i.get_component(0).evaluate_to_constant(),i.get_component(1).evaluate_to_constant()]}catch{o=[NaN,NaN]}if(B.current=o,t.current===null)k();else{t.current.relativeCoords.setCoordinates(JXG.COORDS_BY_USER,[0,0]),M.current.coords.setCoordinates(JXG.COORDS_BY_USER,o);let i,c;e.renderMode==="inline"?(i="\\(",c="\\)"):e.renderMode==="display"?(i="\\[",c="\\]"):e.renderMode==="numbered"?(i=`\\begin{gather}\\tag{${e.equationTag}}`,c="\\end{gather}"):e.renderMode==="align"?(i="\\begin{align}",c="\\end{align}"):(i="\\(",c="\\)"),t.current.setText(i+e.latex+c);let l=!e.hidden;if(Number.isFinite(o[0])&&Number.isFinite(o[1])){let n=t.current.visProp.visible!==l;t.current.visProp.visible=l,t.current.visPropCalc.visible=l,n&&t.current.setAttribute({visible:l})}else t.current.visProp.visible=!1,t.current.visPropCalc.visible=!1;let s=10*e.layer+$;t.current.visProp.layer!==s&&t.current.setAttribute({layer:s});let d=!e.draggable||e.fixed;if(t.current.visProp.highlight=!d,t.current.visProp.fixed=d,t.current.needsUpdate=!0,e.positionFromAnchor!==X.current){let n,r;e.positionFromAnchor==="center"?(n="middle",r="middle"):e.positionFromAnchor==="lowerleft"?(n="right",r="top"):e.positionFromAnchor==="lowerright"?(n="left",r="top"):e.positionFromAnchor==="upperleft"?(n="right",r="bottom"):e.positionFromAnchor==="upperright"?(n="left",r="bottom"):e.positionFromAnchor==="bottom"?(n="middle",r="top"):e.positionFromAnchor==="top"?(n="middle",r="bottom"):e.positionFromAnchor==="right"?(n="left",r="middle"):(n="right",r="middle"),t.current.visProp.anchorx=n,t.current.visProp.anchory=r,R.current=[n,r],X.current=e.positionFromAnchor,t.current.fullUpdate()}else t.current.update();M.current.needsUpdate=!0,M.current.update(),a.updateRenderer()}return h("a",{name:p})}if(e.hidden)return null;let b,x;if(e.renderMode==="inline"?(b="\\(",x="\\)"):e.renderMode==="display"?(b="\\[",x="\\]"):e.renderMode==="numbered"?(b=`\\begin{gather}\\tag{${e.equationTag}}`,x="\\end{gather}"):e.renderMode==="align"?(b="\\begin{align}",x="\\end{align}"):(b="\\(",x="\\)"),!e.latexWithInputChildren)return null;let g=e.latexWithInputChildren.map(o=>typeof o=="number"?this.children[o]:b+o+x),C=[h("a",{name:p},p)];return e.mrowChildNames&&C.push(...e.mrowChildNames.map(o=>h("a",{name:o,id:o},o))),g.length===0?F(D,{children:[C,h("span",{id:p})]}):g.length===1?F(D,{children:[C,h("span",{id:p,children:h(E.MathJax,{hideUntilTypeset:"first",inline:!0,dynamic:!0,children:g[0]})})]}):g.length===2?F(D,{children:[C,h("span",{id:p,children:F(E.MathJax,{hideUntilTypeset:"first",inline:!0,dynamic:!0,children:[g[0],g[1]]})})]}):F(D,{children:[C,h("span",{id:p,children:h(E.MathJax,{hideUntilTypeset:"first",inline:!0,dynamic:!0,children:g[0]})})]})});export{se as default}; +import{av as Z,bn as ee,r as u,bo as W,j as h,a as F,F as D,b9 as E}from"./index-9d63439d.js";import{BoardContext as te,TEXT_LAYER_OFFSET as $}from"./graph-0c612329.js";import"./css-14ccef8c.js";import"./visibility-sensor-aefdbbd5.js";const se=Z.memo(function z(V){let{name:re,id:p,SVs:e,actions:G,sourceOfUpdate:ne,callAction:Y}=ee(V);z.ignoreActionsWithoutCore=!0;let t=u.useRef(null),M=u.useRef(null),R=u.useRef(null);const a=u.useContext(te);let y=u.useRef(!1),J=u.useRef(!1),_=u.useRef(!1),A=u.useRef(null),v=u.useRef(null),B=u.useRef(null),X=u.useRef(null);u.useEffect(()=>()=>{t.current!==null&&(t.current.off("drag"),t.current.off("down"),t.current.off("up"),a==null||a.removeObject(t.current),t.current=null)},[]);function k(){let o=!e.draggable||e.fixed,i={visible:!e.hidden,fixed:o,layer:10*e.layer+$,highlight:!o,useMathJax:!0,parse:!1},c;try{let r=W.fromAst(e.anchor),m=[r.get_component(0).evaluate_to_constant(),r.get_component(1).evaluate_to_constant()];Number.isFinite(m[0])||(m[0]=0,i.visible=!1),Number.isFinite(m[1])||(m[1]=0,i.visible=!1),c=a.create("point",m,{visible:!1})}catch{i.visible=!1,c=a.create("point",[0,0],{visible:!1})}i.anchor=c;let l,s;e.positionFromAnchor==="center"?(l="middle",s="middle"):e.positionFromAnchor==="lowerleft"?(l="right",s="top"):e.positionFromAnchor==="lowerright"?(l="left",s="top"):e.positionFromAnchor==="upperleft"?(l="right",s="bottom"):e.positionFromAnchor==="upperright"?(l="left",s="bottom"):e.positionFromAnchor==="bottom"?(l="middle",s="top"):e.positionFromAnchor==="top"?(l="middle",s="bottom"):e.positionFromAnchor==="right"?(l="left",s="middle"):(l="right",s="middle"),i.anchorx=l,i.anchory=s,R.current=[l,s];let f,d;e.renderMode==="inline"?(f="\\(",d="\\)"):e.renderMode==="display"?(f="\\[",d="\\]"):e.renderMode==="numbered"?(f=`\\begin{gather}\\tag{${e.equationTag}}`,d="\\end{gather}"):e.renderMode==="align"?(f="\\begin{align}",d="\\end{align}"):(f="\\(",d="\\)");let n=a.create("text",[0,0,f+e.latex+d],i);n.on("down",function(r){y.current=[r.x,r.y],J.current=[...c.coords.scrCoords],_.current=!1}),n.on("up",function(r){_.current&&Y({action:G.moveMath,args:{x:A.current,y:v.current}}),_.current=!1}),n.on("drag",function(r){var m=a.origin.scrCoords;let[O,T,U,j]=a.getBoundingBox(),N=n.size[0]/a.unitX,S=n.size[1]/a.unitY,q=R.current[0],I=R.current[1],P=0;q==="middle"?P=-N/2:q==="right"&&(P=-N);let w=0;I==="middle"?w=-S/2:I==="top"&&(w=-S);let L=O+.04*(U-O)-P-N,H=U-.04*(U-O)-P,K=j+.04*(T-j)-w-S,Q=T-.04*(T-j)-w;A.current=(J.current[1]+r.x-y.current[0]-m[1])/a.unitX,A.current=Math.min(H,Math.max(L,A.current)),v.current=(m[2]-(J.current[2]+r.y-y.current[1]))/a.unitY,v.current=Math.min(Q,Math.max(K,v.current)),Y({action:G.moveMath,args:{x:A.current,y:v.current,transient:!0,skippable:!0}}),n.relativeCoords.setCoordinates(JXG.COORDS_BY_USER,[0,0]),c.coords.setCoordinates(JXG.COORDS_BY_USER,B.current),(Math.abs(r.x-y.current[0])>.1||Math.abs(r.y-y.current[1])>.1)&&(_.current=!0)}),t.current=n,M.current=c,X.current=e.positionFromAnchor,setTimeout(()=>{t.current&&(t.current.needsUpdate=!0,t.current.setText(f+e.latex+d),t.current.update(),a.updateRenderer())},1e3)}if(a){let o;try{let i=W.fromAst(e.anchor);o=[i.get_component(0).evaluate_to_constant(),i.get_component(1).evaluate_to_constant()]}catch{o=[NaN,NaN]}if(B.current=o,t.current===null)k();else{t.current.relativeCoords.setCoordinates(JXG.COORDS_BY_USER,[0,0]),M.current.coords.setCoordinates(JXG.COORDS_BY_USER,o);let i,c;e.renderMode==="inline"?(i="\\(",c="\\)"):e.renderMode==="display"?(i="\\[",c="\\]"):e.renderMode==="numbered"?(i=`\\begin{gather}\\tag{${e.equationTag}}`,c="\\end{gather}"):e.renderMode==="align"?(i="\\begin{align}",c="\\end{align}"):(i="\\(",c="\\)"),t.current.setText(i+e.latex+c);let l=!e.hidden;if(Number.isFinite(o[0])&&Number.isFinite(o[1])){let n=t.current.visProp.visible!==l;t.current.visProp.visible=l,t.current.visPropCalc.visible=l,n&&t.current.setAttribute({visible:l})}else t.current.visProp.visible=!1,t.current.visPropCalc.visible=!1;let s=10*e.layer+$;t.current.visProp.layer!==s&&t.current.setAttribute({layer:s});let d=!e.draggable||e.fixed;if(t.current.visProp.highlight=!d,t.current.visProp.fixed=d,t.current.needsUpdate=!0,e.positionFromAnchor!==X.current){let n,r;e.positionFromAnchor==="center"?(n="middle",r="middle"):e.positionFromAnchor==="lowerleft"?(n="right",r="top"):e.positionFromAnchor==="lowerright"?(n="left",r="top"):e.positionFromAnchor==="upperleft"?(n="right",r="bottom"):e.positionFromAnchor==="upperright"?(n="left",r="bottom"):e.positionFromAnchor==="bottom"?(n="middle",r="top"):e.positionFromAnchor==="top"?(n="middle",r="bottom"):e.positionFromAnchor==="right"?(n="left",r="middle"):(n="right",r="middle"),t.current.visProp.anchorx=n,t.current.visProp.anchory=r,R.current=[n,r],X.current=e.positionFromAnchor,t.current.fullUpdate()}else t.current.update();M.current.needsUpdate=!0,M.current.update(),a.updateRenderer()}return h("a",{name:p})}if(e.hidden)return null;let b,x;if(e.renderMode==="inline"?(b="\\(",x="\\)"):e.renderMode==="display"?(b="\\[",x="\\]"):e.renderMode==="numbered"?(b=`\\begin{gather}\\tag{${e.equationTag}}`,x="\\end{gather}"):e.renderMode==="align"?(b="\\begin{align}",x="\\end{align}"):(b="\\(",x="\\)"),!e.latexWithInputChildren)return null;let g=e.latexWithInputChildren.map(o=>typeof o=="number"?this.children[o]:b+o+x),C=[h("a",{name:p},p)];return e.mrowChildNames&&C.push(...e.mrowChildNames.map(o=>h("a",{name:o,id:o},o))),g.length===0?F(D,{children:[C,h("span",{id:p})]}):g.length===1?F(D,{children:[C,h("span",{id:p,children:h(E.MathJax,{hideUntilTypeset:"first",inline:!0,dynamic:!0,children:g[0]})})]}):g.length===2?F(D,{children:[C,h("span",{id:p,children:F(E.MathJax,{hideUntilTypeset:"first",inline:!0,dynamic:!0,children:[g[0],g[1]]})})]}):F(D,{children:[C,h("span",{id:p,children:h(E.MathJax,{hideUntilTypeset:"first",inline:!0,dynamic:!0,children:g[0]})})]})});export{se as default}; diff --git a/dist/assets/mathInput-9baa2704.js b/dist/assets/mathInput-b37ad8ec.js similarity index 99% rename from dist/assets/mathInput-9baa2704.js rename to dist/assets/mathInput-b37ad8ec.js index 6f1df870aa..485e9f0c58 100644 --- a/dist/assets/mathInput-9baa2704.js +++ b/dist/assets/mathInput-b37ad8ec.js @@ -1,4 +1,4 @@ -import{r as sn,aa as hi,bn as mi,R as mr,br as gi,l as Pr,j as de,i as Zn,bp as vi,a0 as bi,aP as yi,bq as xi,a as yn,F as gr,av as qi,s as wi}from"./index-61b6fc23.js";import{f as ki,a as Ti,p as Ci,h as Oi}from"./MathInputSelector-84e903aa.js";/* empty css */var Jn={},Si={get exports(){return Jn},set exports(Re){Jn=Re}},vr={},ji={get exports(){return vr},set exports(Re){vr=Re}};/*! For license information please see react-mathquill.min.js.LICENSE.txt */(function(Re,zr){(function(Ae,Ot){Re.exports=Ot(sn)})(hi,function(Ae){return(()=>{var Ot={991:(it,pt,X)=>{X.d(pt,{Z:()=>Bt});var M=X(156),ut=X.n(M),ct=X(697),at=X.n(ct),gt=X(700),_t=["latex","onChange","config","mathquillDidMount"];function Pt(){return Pt=Object.assign||function(v){for(var z=1;z=0||(Ue[Le]=re[Le]);return Ue}(a,lt);if(Object.getOwnPropertySymbols){var Tt=Object.getOwnPropertySymbols(a);for(Et=0;Et=0||Object.prototype.propertyIsEnumerable.call(a,Z)&&(qt[Z]=a[Z])}return qt}(v,_t),Nt=(0,M.useRef)(2),yt=(0,M.useRef)(null),kt=(0,M.useRef)(null),s=(0,M.useRef)(D);return(0,M.useEffect)(function(){s.current=D},[D]),(0,M.useEffect)(function(){if(kt.current){var a={restrictMismatchedBrackets:!0,handlers:{}};m&&(a=zt(zt({},a),m));var lt=a.handlers.edit;a.handlers.edit=function(Z){lt&<(),Nt.current>0?Nt.current-=1:s.current&&s.current(Z)},yt.current=gt.Z.MathField(kt.current,a),yt.current.latex(z||""),V&&V(yt.current)}},[kt]),(0,M.useEffect)(function(){yt.current&&yt.current.latex()!==z&&yt.current.latex(z)},[z]),ut().createElement("span",Pt({},dt,{ref:kt}))};Ft.propTypes={latex:at().string,onChange:at().func,config:at().object,mathquillDidMount:at().func};const Bt=Ft},717:(it,pt,X)=>{X.d(pt,{Z:()=>zt});var M=X(156),ut=X.n(M),ct=X(697),at=X.n(ct),gt=X(700),_t=["mathquillDidMount","children"];function Pt(){return Pt=Object.assign||function(ft){for(var Ft=1;Ft=0||(Et[lt]=s[lt]);return Et}(m,V);if(Object.getOwnPropertySymbols){var kt=Object.getOwnPropertySymbols(m);for(Nt=0;Nt=0||Object.prototype.propertyIsEnumerable.call(m,dt)&&(yt[dt]=m[dt])}return yt}(ft,_t),z=(0,M.useRef)(null),D=(0,M.useRef)(null);return(0,M.useLayoutEffect)(function(){z&&(D.current=gt.Z.StaticMath(z.current),Ft&&Ft(D.current))},[z,Bt]),ut().createElement("span",Pt({},v,{ref:z}),Bt)};ht.propTypes={children:at().string,mathquillDidMount:at().func};const zt=ht},700:(it,pt,X)=>{X.d(pt,{Z:()=>M});const M=X(338).getInterface(2)},527:(it,pt,X)=>{X.d(pt,{Z:()=>gt});var M=X(81),ut=X.n(M),ct=X(645),at=X.n(ct)()(ut());at.push([it.id,`/* +import{r as sn,aa as hi,bn as mi,R as mr,br as gi,l as Pr,j as de,i as Zn,bp as vi,a0 as bi,aP as yi,bq as xi,a as yn,F as gr,av as qi,s as wi}from"./index-9d63439d.js";import{f as ki,a as Ti,p as Ci,h as Oi}from"./MathInputSelector-fa50f67b.js";/* empty css */var Jn={},Si={get exports(){return Jn},set exports(Re){Jn=Re}},vr={},ji={get exports(){return vr},set exports(Re){vr=Re}};/*! For license information please see react-mathquill.min.js.LICENSE.txt */(function(Re,zr){(function(Ae,Ot){Re.exports=Ot(sn)})(hi,function(Ae){return(()=>{var Ot={991:(it,pt,X)=>{X.d(pt,{Z:()=>Bt});var M=X(156),ut=X.n(M),ct=X(697),at=X.n(ct),gt=X(700),_t=["latex","onChange","config","mathquillDidMount"];function Pt(){return Pt=Object.assign||function(v){for(var z=1;z=0||(Ue[Le]=re[Le]);return Ue}(a,lt);if(Object.getOwnPropertySymbols){var Tt=Object.getOwnPropertySymbols(a);for(Et=0;Et=0||Object.prototype.propertyIsEnumerable.call(a,Z)&&(qt[Z]=a[Z])}return qt}(v,_t),Nt=(0,M.useRef)(2),yt=(0,M.useRef)(null),kt=(0,M.useRef)(null),s=(0,M.useRef)(D);return(0,M.useEffect)(function(){s.current=D},[D]),(0,M.useEffect)(function(){if(kt.current){var a={restrictMismatchedBrackets:!0,handlers:{}};m&&(a=zt(zt({},a),m));var lt=a.handlers.edit;a.handlers.edit=function(Z){lt&<(),Nt.current>0?Nt.current-=1:s.current&&s.current(Z)},yt.current=gt.Z.MathField(kt.current,a),yt.current.latex(z||""),V&&V(yt.current)}},[kt]),(0,M.useEffect)(function(){yt.current&&yt.current.latex()!==z&&yt.current.latex(z)},[z]),ut().createElement("span",Pt({},dt,{ref:kt}))};Ft.propTypes={latex:at().string,onChange:at().func,config:at().object,mathquillDidMount:at().func};const Bt=Ft},717:(it,pt,X)=>{X.d(pt,{Z:()=>zt});var M=X(156),ut=X.n(M),ct=X(697),at=X.n(ct),gt=X(700),_t=["mathquillDidMount","children"];function Pt(){return Pt=Object.assign||function(ft){for(var Ft=1;Ft=0||(Et[lt]=s[lt]);return Et}(m,V);if(Object.getOwnPropertySymbols){var kt=Object.getOwnPropertySymbols(m);for(Nt=0;Nt=0||Object.prototype.propertyIsEnumerable.call(m,dt)&&(yt[dt]=m[dt])}return yt}(ft,_t),z=(0,M.useRef)(null),D=(0,M.useRef)(null);return(0,M.useLayoutEffect)(function(){z&&(D.current=gt.Z.StaticMath(z.current),Ft&&Ft(D.current))},[z,Bt]),ut().createElement("span",Pt({},v,{ref:z}),Bt)};ht.propTypes={children:at().string,mathquillDidMount:at().func};const zt=ht},700:(it,pt,X)=>{X.d(pt,{Z:()=>M});const M=X(338).getInterface(2)},527:(it,pt,X)=>{X.d(pt,{Z:()=>gt});var M=X(81),ut=X.n(M),ct=X(645),at=X.n(ct)()(ut());at.push([it.id,`/* * MathQuill v0.11.0, by Han, Jeanine, and Mary * http://mathquill.com | maintainers@mathquill.com * diff --git a/dist/assets/mathList-438e20fc.js b/dist/assets/mathList-25d30cec.js similarity index 76% rename from dist/assets/mathList-438e20fc.js rename to dist/assets/mathList-25d30cec.js index a8c193668b..4cdb55b093 100644 --- a/dist/assets/mathList-438e20fc.js +++ b/dist/assets/mathList-25d30cec.js @@ -1 +1 @@ -import{av as a,bn as m,a as i,j as t,b9 as c}from"./index-61b6fc23.js";const x=a.memo(function(s){let{name:o,id:e,SVs:r,children:n}=m(s);if(r.hidden)return null;if(n.length===0&&r.latex)return i(a.Fragment,{children:[t("a",{name:e}),t("span",{id:e,children:t(c.MathJax,{hideUntilTypeset:"first",inline:!0,dynamic:!0,children:"\\("+r.latex+"\\)"})})]},e);if(n.length===0)return t(a.Fragment,{},e);let l=n.slice(1).reduce((h,d)=>[...h,", ",d],[n[0]]);return i(a.Fragment,{children:[t("a",{name:e}),t("span",{id:e,children:l})]},e)});export{x as default}; +import{av as a,bn as m,a as i,j as t,b9 as c}from"./index-9d63439d.js";const x=a.memo(function(s){let{name:o,id:e,SVs:r,children:n}=m(s);if(r.hidden)return null;if(n.length===0&&r.latex)return i(a.Fragment,{children:[t("a",{name:e}),t("span",{id:e,children:t(c.MathJax,{hideUntilTypeset:"first",inline:!0,dynamic:!0,children:"\\("+r.latex+"\\)"})})]},e);if(n.length===0)return t(a.Fragment,{},e);let l=n.slice(1).reduce((h,d)=>[...h,", ",d],[n[0]]);return i(a.Fragment,{children:[t("a",{name:e}),t("span",{id:e,children:l})]},e)});export{x as default}; diff --git a/dist/assets/matrixInput-520e93f2.js b/dist/assets/matrixInput-688b8b02.js similarity index 95% rename from dist/assets/matrixInput-520e93f2.js rename to dist/assets/matrixInput-688b8b02.js index 05d89c1a9b..cdf3535f07 100644 --- a/dist/assets/matrixInput-520e93f2.js +++ b/dist/assets/matrixInput-688b8b02.js @@ -1,4 +1,4 @@ -import{av as y,bn as B,r as _,j as t,i as p,bp as I,a0 as S,aP as N,bq as V,a as l,F as x,s as w}from"./index-61b6fc23.js";import{A as h}from"./ActionButton-be9a12e7.js";import{A as v}from"./ActionButtonGroup-f3a36748.js";/* empty css */const E=w.div` +import{av as y,bn as B,r as _,j as t,i as p,bp as I,a0 as S,aP as N,bq as V,a as l,F as x,s as w}from"./index-9d63439d.js";import{A as h}from"./ActionButton-056b08c3.js";import{A as v}from"./ActionButtonGroup-9e9bafb3.js";/* empty css */const E=w.div` position: relative; margin: 6px; display: inline-block; diff --git a/dist/assets/mdash-c7488048.js b/dist/assets/mdash-5a747c72.js similarity index 63% rename from dist/assets/mdash-c7488048.js rename to dist/assets/mdash-5a747c72.js index 91d12fff1e..9b002f3e3b 100644 --- a/dist/assets/mdash-c7488048.js +++ b/dist/assets/mdash-5a747c72.js @@ -1 +1 @@ -import{av as n,bn as s,j as r,F as t}from"./index-61b6fc23.js";const l=n.memo(function(e){let{SVs:a}=s(e,!1);return a.hidden?null:r(t,{children:"—"})});export{l as default}; +import{av as n,bn as s,j as r,F as t}from"./index-9d63439d.js";const l=n.memo(function(e){let{SVs:a}=s(e,!1);return a.hidden?null:r(t,{children:"—"})});export{l as default}; diff --git a/dist/assets/moment-b216ba57.js b/dist/assets/moment-a2107d39.js similarity index 99% rename from dist/assets/moment-b216ba57.js rename to dist/assets/moment-a2107d39.js index 6002f15cad..33af987c7a 100644 --- a/dist/assets/moment-b216ba57.js +++ b/dist/assets/moment-a2107d39.js @@ -1,4 +1,4 @@ -import{b3 as gs}from"./index-61b6fc23.js";function Ds(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}//! moment.js +import{b3 as gs}from"./index-9d63439d.js";function Ds(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}//! moment.js //! version : 2.29.4 //! authors : Tim Wood, Iskren Chernev, Moment.js contributors //! license : MIT diff --git a/dist/assets/nbsp-be2f0b5b.js b/dist/assets/nbsp-fdf85b3e.js similarity index 63% rename from dist/assets/nbsp-be2f0b5b.js rename to dist/assets/nbsp-fdf85b3e.js index de190e01ab..bce9af02bb 100644 --- a/dist/assets/nbsp-be2f0b5b.js +++ b/dist/assets/nbsp-fdf85b3e.js @@ -1 +1 @@ -import{av as s,bn as r,j as t,F as a}from"./index-61b6fc23.js";const u=s.memo(function(e){let{SVs:n}=r(e,!1);return n.hidden?null:t(a,{children:" "})});export{u as default}; +import{av as s,bn as r,j as t,F as a}from"./index-9d63439d.js";const u=s.memo(function(e){let{SVs:n}=r(e,!1);return n.hidden?null:t(a,{children:" "})});export{u as default}; diff --git a/dist/assets/ndash-6a81221e.js b/dist/assets/ndash-2b9718f9.js similarity index 63% rename from dist/assets/ndash-6a81221e.js rename to dist/assets/ndash-2b9718f9.js index 31409ba5cf..3319eb2634 100644 --- a/dist/assets/ndash-6a81221e.js +++ b/dist/assets/ndash-2b9718f9.js @@ -1 +1 @@ -import{av as a,bn as r,j as s,F as t}from"./index-61b6fc23.js";const u=a.memo(function(e){let{SVs:n}=r(e);return n.hidden?null:s(t,{children:"–"})});export{u as default}; +import{av as a,bn as r,j as s,F as t}from"./index-9d63439d.js";const u=a.memo(function(e){let{SVs:n}=r(e);return n.hidden?null:s(t,{children:"–"})});export{u as default}; diff --git a/dist/assets/number-9f233528.js b/dist/assets/number-30a5448d.js similarity index 82% rename from dist/assets/number-9f233528.js rename to dist/assets/number-30a5448d.js index 795fd5858f..6eb1cb00eb 100644 --- a/dist/assets/number-9f233528.js +++ b/dist/assets/number-30a5448d.js @@ -1 +1 @@ -import{av as s,bn as i,a as d,F as m,j as n,b9 as u}from"./index-61b6fc23.js";const o=s.memo(function(r){let{name:c,id:a,SVs:e}=i(r);if(e.hidden)return null;let t=e.text;return e.renderAsMath&&(t="\\("+t+"\\)"),d(m,{children:[n("a",{name:a}),n("span",{id:a,children:n(u.MathJax,{hideUntilTypeset:"first",inline:!0,dynamic:!0,children:t})})]})});export{o as default}; +import{av as s,bn as i,a as d,F as m,j as n,b9 as u}from"./index-9d63439d.js";const o=s.memo(function(r){let{name:c,id:a,SVs:e}=i(r);if(e.hidden)return null;let t=e.text;return e.renderAsMath&&(t="\\("+t+"\\)"),d(m,{children:[n("a",{name:a}),n("span",{id:a,children:n(u.MathJax,{hideUntilTypeset:"first",inline:!0,dynamic:!0,children:t})})]})});export{o as default}; diff --git a/dist/assets/numberList-430714f6.js b/dist/assets/numberList-95b4b851.js similarity index 86% rename from dist/assets/numberList-430714f6.js rename to dist/assets/numberList-95b4b851.js index a743f09746..2a99dfc1f4 100644 --- a/dist/assets/numberList-430714f6.js +++ b/dist/assets/numberList-95b4b851.js @@ -1 +1 @@ -import{av as r,bn as c,a as s,j as n}from"./index-61b6fc23.js";const f=r.memo(function(i){let{name:u,id:e,SVs:a,children:t}=c(i);if(a.hidden)return null;if(t.length===0&&a.text)return s(r.Fragment,{children:[n("a",{name:e}),n("span",{id:e,children:a.text})]},e);if(t.length===0)return n(r.Fragment,{},e);let l=t.slice(1).reduce((m,d)=>[...m,", ",d],[t[0]]);return s(r.Fragment,{children:[n("a",{name:e}),n("span",{id:e,children:l})]},e)});export{f as default}; +import{av as r,bn as c,a as s,j as n}from"./index-9d63439d.js";const f=r.memo(function(i){let{name:u,id:e,SVs:a,children:t}=c(i);if(a.hidden)return null;if(t.length===0&&a.text)return s(r.Fragment,{children:[n("a",{name:e}),n("span",{id:e,children:a.text})]},e);if(t.length===0)return n(r.Fragment,{},e);let l=t.slice(1).reduce((m,d)=>[...m,", ",d],[t[0]]);return s(r.Fragment,{children:[n("a",{name:e}),n("span",{id:e,children:l})]},e)});export{f as default}; diff --git a/dist/assets/orbitalDiagram-668225b9.js b/dist/assets/orbitalDiagram-df765f8c.js similarity index 96% rename from dist/assets/orbitalDiagram-668225b9.js rename to dist/assets/orbitalDiagram-df765f8c.js index 965cae9f01..22fee7431b 100644 --- a/dist/assets/orbitalDiagram-668225b9.js +++ b/dist/assets/orbitalDiagram-df765f8c.js @@ -1,4 +1,4 @@ -import{av as f,bn as O,r as w,j as i,F as u,s as U,a as $}from"./index-61b6fc23.js";import{V as R}from"./visibility-sensor-398e690f.js";const V=U.svg` +import{av as f,bn as O,r as w,j as i,F as u,s as U,a as $}from"./index-9d63439d.js";import{V as R}from"./visibility-sensor-aefdbbd5.js";const V=U.svg` border: '2px solid red'; margin: 2px; outline: none; diff --git a/dist/assets/orbitalDiagramInput-667388be.js b/dist/assets/orbitalDiagramInput-e8842545.js similarity index 98% rename from dist/assets/orbitalDiagramInput-667388be.js rename to dist/assets/orbitalDiagramInput-e8842545.js index e4a4cf29c2..00432b1fae 100644 --- a/dist/assets/orbitalDiagramInput-667388be.js +++ b/dist/assets/orbitalDiagramInput-e8842545.js @@ -1,4 +1,4 @@ -import{av as B,bn as S,r as m,j as l,a as R,F as V,s as W}from"./index-61b6fc23.js";import{V as I}from"./visibility-sensor-398e690f.js";const j=W.svg` +import{av as B,bn as S,r as m,j as l,a as R,F as V,s as W}from"./index-9d63439d.js";import{V as I}from"./visibility-sensor-aefdbbd5.js";const j=W.svg` border: '2px solid red'; margin: 2px; outline: none; diff --git a/dist/assets/p-6db7a549.js b/dist/assets/p-2d693fae.js similarity index 74% rename from dist/assets/p-6db7a549.js rename to dist/assets/p-2d693fae.js index db25aa916e..21ebd6d796 100644 --- a/dist/assets/p-6db7a549.js +++ b/dist/assets/p-2d693fae.js @@ -1 +1 @@ -import{av as c,bn as d,r as u,j as r,a as f}from"./index-61b6fc23.js";import{V as h}from"./visibility-sensor-398e690f.js";const g=c.memo(function(n){let{name:V,id:i,SVs:s,children:t,actions:e,callAction:a}=d(n),o=l=>{a({action:e.recordVisibilityChange,args:{isVisible:l}})};return u.useEffect(()=>()=>{a({action:e.recordVisibilityChange,args:{isVisible:!1}})},[]),s.hidden?null:r(h,{partialVisibility:!0,onChange:o,children:f("p",{id:i,children:[r("a",{name:i}),t]})})});export{g as default}; +import{av as c,bn as d,r as u,j as r,a as f}from"./index-9d63439d.js";import{V as h}from"./visibility-sensor-aefdbbd5.js";const g=c.memo(function(n){let{name:V,id:i,SVs:s,children:t,actions:e,callAction:a}=d(n),o=l=>{a({action:e.recordVisibilityChange,args:{isVisible:l}})};return u.useEffect(()=>()=>{a({action:e.recordVisibilityChange,args:{isVisible:!1}})},[]),s.hidden?null:r(h,{partialVisibility:!0,onChange:o,children:f("p",{id:i,children:[r("a",{name:i}),t]})})});export{g as default}; diff --git a/dist/assets/paginatorControls-3d3c1544.js b/dist/assets/paginatorControls-6e627977.js similarity index 89% rename from dist/assets/paginatorControls-3d3c1544.js rename to dist/assets/paginatorControls-6e627977.js index 37b48813bc..362c8ddaba 100644 --- a/dist/assets/paginatorControls-3d3c1544.js +++ b/dist/assets/paginatorControls-6e627977.js @@ -1 +1 @@ -import{av as i,bn as o,a as l,j as n}from"./index-61b6fc23.js";const g=i.memo(function(s){let{name:d,id:a,SVs:e,actions:r,callAction:t}=o(s,!1);return e.hidden?null:l("p",{id:a,children:[n("a",{name:a}),n("button",{id:a+"_previous",onClick:()=>{t({action:r.setPage,args:{number:e.currentPage-1}})},disabled:e.disabled||!(e.currentPage>1),children:e.previousLabel})," "+e.pageLabel," ",e.currentPage," of ",e.nPages+" ",n("button",{id:a+"_next",onClick:()=>{t({action:r.setPage,args:{number:e.currentPage+1}})},disabled:e.disabled||!(e.currentPage{t({action:r.setPage,args:{number:e.currentPage-1}})},disabled:e.disabled||!(e.currentPage>1),children:e.previousLabel})," "+e.pageLabel," ",e.currentPage," of ",e.nPages+" ",n("button",{id:a+"_next",onClick:()=>{t({action:r.setPage,args:{number:e.currentPage+1}})},disabled:e.disabled||!(e.currentPage()=>{P()},[]);function O(){let[o,b,g,M]=l.getBoundingBox(),R=(o-p.current)/x.current,C=(g-p.current)/x.current,w=(M-y.current)/h.current,B=(b-y.current)/h.current,d=f.math.round(Math.min(R,C)+1),m=f.math.round(Math.max(R,C)-1),i=f.math.round(Math.min(w,B)+1),a=f.math.round(Math.max(w,B)-1);if(N.current=[d,m,i,a],Number.isFinite(d)&&Number.isFinite(m)&&Number.isFinite(i)&&Number.isFinite(a)){let t=[];for(let r=i;r<=a;r++){let c=r*u.dy+u.yoffset,e=[];for(let n=d;n<=m;n++)e.push(l.create("point",[n*u.dx+u.xoffset,c],F.current));t.push(e)}s.current=t}l.on("boundingbox",()=>{let[t,r,c,e]=l.getBoundingBox(),n=(t-p.current)/x.current,E=(c-p.current)/x.current,Y=(e-y.current)/h.current,S=(r-y.current)/h.current,G=f.math.round(Math.min(n,E)+1),J=f.math.round(Math.max(n,E)-1),_=f.math.round(Math.min(Y,S)+1),k=f.math.round(Math.max(Y,S)-1),[z,L,T,V]=N.current;(G!==z||J!==L||_!==T||k!==V)&&X(G,J,_,k)})}function P(){if(s.current!==null)for(let o of s.current)for(let b of o)l.removeObject(b);s.current=null}function X(o,b,g,M){if(s.current===null)return O();if(!Number.isFinite(o)||!Number.isFinite(b)||!Number.isFinite(g)||!Number.isFinite(M))return P();let[R,C,w,B]=N.current,d=M-g+1,m=B-w+1,i=b-o+1,a=C-R+1;for(let t=0;ti)for(let e=i;ed)for(let t=d;t()=>{P()},[]);function O(){let[o,b,g,M]=l.getBoundingBox(),R=(o-p.current)/x.current,C=(g-p.current)/x.current,w=(M-y.current)/h.current,B=(b-y.current)/h.current,d=f.math.round(Math.min(R,C)+1),m=f.math.round(Math.max(R,C)-1),i=f.math.round(Math.min(w,B)+1),a=f.math.round(Math.max(w,B)-1);if(N.current=[d,m,i,a],Number.isFinite(d)&&Number.isFinite(m)&&Number.isFinite(i)&&Number.isFinite(a)){let t=[];for(let r=i;r<=a;r++){let c=r*u.dy+u.yoffset,e=[];for(let n=d;n<=m;n++)e.push(l.create("point",[n*u.dx+u.xoffset,c],F.current));t.push(e)}s.current=t}l.on("boundingbox",()=>{let[t,r,c,e]=l.getBoundingBox(),n=(t-p.current)/x.current,E=(c-p.current)/x.current,Y=(e-y.current)/h.current,S=(r-y.current)/h.current,G=f.math.round(Math.min(n,E)+1),J=f.math.round(Math.max(n,E)-1),_=f.math.round(Math.min(Y,S)+1),k=f.math.round(Math.max(Y,S)-1),[z,L,T,V]=N.current;(G!==z||J!==L||_!==T||k!==V)&&X(G,J,_,k)})}function P(){if(s.current!==null)for(let o of s.current)for(let b of o)l.removeObject(b);s.current=null}function X(o,b,g,M){if(s.current===null)return O();if(!Number.isFinite(o)||!Number.isFinite(b)||!Number.isFinite(g)||!Number.isFinite(M))return P();let[R,C,w,B]=N.current,d=M-g+1,m=B-w+1,i=b-o+1,a=C-R+1;for(let t=0;ti)for(let e=i;ed)for(let t=d;t()=>{t.current!==null&&(r.current.off("drag"),r.current.off("down"),r.current.off("up"),s.removeObject(t.current),s.removeObject(r.current),t.current=null,r.current=null)},[]);function Y(){let c=B==="dark"?e.selectedStyle.markerColorDarkMode:e.selectedStyle.markerColor;c=c.toLowerCase();let C=A?"var(--canvas)":c,R=A?c:"none",h=!e.draggable||e.fixed,m=e.showLabel&&e.labelForGraph!=="",o={name:e.labelForGraph,visible:!e.hidden,withlabel:m,fixed:!0,layer:10*e.layer+U,fillColor:C,strokeColor:R,strokeOpacity:e.selectedStyle.lineOpacity,fillOpacity:e.selectedStyle.lineOpacity,highlightFillColor:getComputedStyle(document.documentElement).getPropertyValue("--mainGray"),highlightStrokeColor:getComputedStyle(document.documentElement).getPropertyValue("--lightBlue"),size:I(e.selectedStyle.markerSize,e.selectedStyle.markerStyle),face:j(e.selectedStyle.markerStyle),highlight:!h};if(m){let i,n,l;e.labelPosition==="upperright"?(l=[5,5],i="left",n="bottom"):e.labelPosition==="upperleft"?(l=[-5,5],i="right",n="bottom"):e.labelPosition==="lowerright"?(l=[5,-5],i="left",n="top"):e.labelPosition==="lowerleft"?(l=[-5,-5],i="right",n="top"):e.labelPosition==="top"?(l=[0,10],i="middle",n="bottom"):e.labelPosition==="bottom"?(l=[0,-10],i="middle",n="top"):e.labelPosition==="left"?(l=[-10,0],i="right",n="middle"):(l=[10,0],i="left",n="middle"),o.label={offset:l,anchorx:i,anchory:n,highlight:!1},e.labelHasLatex&&(o.label.useMathJax=!0),e.applyStyleToLabel?o.label.strokeColor=c:o.label.strokeColor="var(--canvastext)"}else o.label={highlight:!1},e.labelHasLatex&&(o.label.useMathJax=!0);h?o.showInfoBox=!1:o.showInfoBox=e.showCoordsWhenDragging;let d=[e.numericalXs[0],e.numericalXs[1]];Number.isFinite(d[0])||(d[0]=0,o.visible=!1),Number.isFinite(d[1])||(d[1]=0,o.visible=!1);let P={...o};P.fixed=h,P.showInfoBox=!1,P.withlabel=!1,P.fillOpacity=0,P.strokeOpacity=0;let b=s.create("point",d,P),y=s.create("point",d,o);b.on("down",function(i){S.current=[i.x,i.y],M.current=[...b.coords.scrCoords],k.current=!1,r.current.visProp.fillopacity=t.current.visProp.fillopacity,r.current.visProp.strokeopacity=t.current.visProp.strokeopacity,x({action:g.mouseDownOnPoint})}),b.on("up",function(i){k.current?x({action:g.movePoint,args:{x:w.current,y:O.current}}):e.switchable&&!e.fixed?(x({action:g.switchPoint}),x({action:g.pointClicked})):x({action:g.pointClicked}),k.current=!1,r.current.visProp.fillopacity=0,r.current.visProp.strokeopacity=0}),b.on("drag",function(i){var n=s.origin.scrCoords;let[l,u,f,T]=s.getBoundingBox();w.current=(M.current[1]+i.x-S.current[0]-n[1])/s.unitX,w.current=Math.min(f,Math.max(l,w.current)),O.current=(n[2]-(M.current[2]+i.y-S.current[1]))/s.unitY,O.current=Math.min(u,Math.max(T,O.current)),x({action:g.movePoint,args:{x:w.current,y:O.current,transient:!0,skippable:!0}}),y.coords.setCoordinates(JXG.COORDS_BY_USER,D.current),s.updateInfobox(y),(Math.abs(i.x-S.current[0])>.1||Math.abs(i.y-S.current[1])>.1)&&(k.current=!0)}),t.current=y,r.current=b,J.current=e.labelPosition,G.current=m}if(s){if(t.current===null)Y();else{let c=B==="dark"?e.selectedStyle.markerColorDarkMode:e.selectedStyle.markerColor;c=c.toLowerCase();let C=A?"var(--canvas)":c,R=A?c:"none";t.current.visProp.fillcolor!==C&&(t.current.visProp.fillcolor=C);let h=(_=e.numericalXs)==null?void 0:_[0],m=(E=e.numericalXs)==null?void 0:E[1];t.current.coords.setCoordinates(JXG.COORDS_BY_USER,[h,m]),k.current||r.current.coords.setCoordinates(JXG.COORDS_BY_USER,[h,m]);let o=!e.hidden;if(Number.isFinite(h)&&Number.isFinite(m)){let l=t.current.visProp.visible!==o;t.current.visProp.visible=o,t.current.visPropCalc.visible=o,r.current.visProp.visible=o,r.current.visPropCalc.visible=o,l&&(t.current.setAttribute({visible:o}),r.current.setAttribute({visible:o}))}else t.current.visProp.visible=!1,t.current.visPropCalc.visible=!1,r.current.visProp.visible=!1,r.current.visPropCalc.visible=!1;let d=10*e.layer+U;t.current.visProp.layer!==d&&(t.current.setAttribute({layer:d}),r.current.setAttribute({layer:d}));let b=!e.draggable||e.fixed;t.current.visProp.highlight=!b,r.current.visProp.highlight=!b,r.current.visProp.fixed=b,t.current.visProp.strokecolor!==R&&(t.current.visProp.strokecolor=R,r.current.visProp.strokecolor=R,t.current.visProp.fillColor=C,r.current.visProp.fillColor=C),t.current.visProp.strokeopacity!==e.selectedStyle.lineOpacity&&(t.current.visProp.strokeopacity=e.selectedStyle.lineOpacity,t.current.visProp.fillopacity=e.selectedStyle.lineOpacity);let y=j(e.selectedStyle.markerStyle);t.current.visProp.face!==y&&(t.current.setAttribute({face:y}),r.current.setAttribute({face:y}));let i=I(e.selectedStyle.markerSize,e.selectedStyle.markerStyle);t.current.visProp.size!==i&&(t.current.setAttribute({size:i}),r.current.setAttribute({size:i})),b?t.current.visProp.showinfobox=!1:t.current.visProp.showinfobox=e.showCoordsWhenDragging,L.sourceInformation&&z in L.sourceInformation&&s.updateInfobox(t.current),t.current.name=e.labelForGraph;let n=e.showLabel&&e.labelForGraph!=="";if(n!=G.current&&(t.current.setAttribute({withlabel:n}),G.current=n),t.current.hasLabel)if(t.current.label.needsUpdate=!0,e.applyStyleToLabel?t.current.label.visProp.strokecolor=c:t.current.label.visProp.strokecolor="var(--canvastext)",e.labelPosition!==J.current){let l,u,f;e.labelPosition==="upperright"?(f=[5,5],l="left",u="bottom"):e.labelPosition==="upperleft"?(f=[-5,5],l="right",u="bottom"):e.labelPosition==="lowerright"?(f=[5,-5],l="left",u="top"):e.labelPosition==="lowerleft"?(f=[-5,-5],l="right",u="top"):e.labelPosition==="top"?(f=[0,10],l="middle",u="bottom"):e.labelPosition==="bottom"?(f=[0,-10],l="middle",u="top"):e.labelPosition==="left"?(f=[-10,0],l="right",u="middle"):(f=[10,0],l="left",u="middle"),t.current.label.visProp.anchorx=l,t.current.label.visProp.anchory=u,t.current.label.visProp.offset=f,J.current=e.labelPosition,t.current.label.fullUpdate()}else t.current.label.update();t.current.needsUpdate=!0,t.current.update(),r.current.needsUpdate=!0,r.current.update(),s.updateRenderer()}return F("a",{name:X})}if(e.hidden)return null;let N="\\("+e.latex+"\\)";return K(Q,{children:[F("a",{name:X}),F("span",{id:X,children:F(Z.MathJax,{hideUntilTypeset:"first",inline:!0,dynamic:!0,children:N})})]})});function I(p,v){return v==="diamond"?p*1.4:v==="plus"?p*1.2:v==="square"?p*1.1:v.substring(0,8)==="triangle"?p*1.5:p}function j(p){return p==="triangle"?"triangleup":p}export{ie as default}; +import{av as V,bn as W,r as a,l as H,bs as q,j as F,a as K,F as Q,b9 as Z}from"./index-9d63439d.js";import{BoardContext as $,POINT_LAYER_OFFSET as U}from"./graph-0c612329.js";import"./css-14ccef8c.js";import"./visibility-sensor-aefdbbd5.js";const ie=V.memo(function p(v){var _,E;let{name:z,id:X,SVs:e,actions:g,sourceOfUpdate:L,callAction:x}=W(v);p.ignoreActionsWithoutCore=!0;const s=a.useContext($);let t=a.useRef(null),r=a.useRef(null),S=a.useRef(!1),M=a.useRef(!1),k=a.useRef(!1),G=a.useRef(null),J=a.useRef(null),w=a.useRef(null),O=a.useRef(null),D=a.useRef(null);D.current=e.numericalXs;const B=H(q),A=e.open||["cross","plus"].includes(e.selectedStyle.markerStyle);a.useEffect(()=>()=>{t.current!==null&&(r.current.off("drag"),r.current.off("down"),r.current.off("up"),s.removeObject(t.current),s.removeObject(r.current),t.current=null,r.current=null)},[]);function Y(){let c=B==="dark"?e.selectedStyle.markerColorDarkMode:e.selectedStyle.markerColor;c=c.toLowerCase();let C=A?"var(--canvas)":c,R=A?c:"none",h=!e.draggable||e.fixed,m=e.showLabel&&e.labelForGraph!=="",o={name:e.labelForGraph,visible:!e.hidden,withlabel:m,fixed:!0,layer:10*e.layer+U,fillColor:C,strokeColor:R,strokeOpacity:e.selectedStyle.lineOpacity,fillOpacity:e.selectedStyle.lineOpacity,highlightFillColor:getComputedStyle(document.documentElement).getPropertyValue("--mainGray"),highlightStrokeColor:getComputedStyle(document.documentElement).getPropertyValue("--lightBlue"),size:I(e.selectedStyle.markerSize,e.selectedStyle.markerStyle),face:j(e.selectedStyle.markerStyle),highlight:!h};if(m){let i,n,l;e.labelPosition==="upperright"?(l=[5,5],i="left",n="bottom"):e.labelPosition==="upperleft"?(l=[-5,5],i="right",n="bottom"):e.labelPosition==="lowerright"?(l=[5,-5],i="left",n="top"):e.labelPosition==="lowerleft"?(l=[-5,-5],i="right",n="top"):e.labelPosition==="top"?(l=[0,10],i="middle",n="bottom"):e.labelPosition==="bottom"?(l=[0,-10],i="middle",n="top"):e.labelPosition==="left"?(l=[-10,0],i="right",n="middle"):(l=[10,0],i="left",n="middle"),o.label={offset:l,anchorx:i,anchory:n,highlight:!1},e.labelHasLatex&&(o.label.useMathJax=!0),e.applyStyleToLabel?o.label.strokeColor=c:o.label.strokeColor="var(--canvastext)"}else o.label={highlight:!1},e.labelHasLatex&&(o.label.useMathJax=!0);h?o.showInfoBox=!1:o.showInfoBox=e.showCoordsWhenDragging;let d=[e.numericalXs[0],e.numericalXs[1]];Number.isFinite(d[0])||(d[0]=0,o.visible=!1),Number.isFinite(d[1])||(d[1]=0,o.visible=!1);let P={...o};P.fixed=h,P.showInfoBox=!1,P.withlabel=!1,P.fillOpacity=0,P.strokeOpacity=0;let b=s.create("point",d,P),y=s.create("point",d,o);b.on("down",function(i){S.current=[i.x,i.y],M.current=[...b.coords.scrCoords],k.current=!1,r.current.visProp.fillopacity=t.current.visProp.fillopacity,r.current.visProp.strokeopacity=t.current.visProp.strokeopacity,x({action:g.mouseDownOnPoint})}),b.on("up",function(i){k.current?x({action:g.movePoint,args:{x:w.current,y:O.current}}):e.switchable&&!e.fixed?(x({action:g.switchPoint}),x({action:g.pointClicked})):x({action:g.pointClicked}),k.current=!1,r.current.visProp.fillopacity=0,r.current.visProp.strokeopacity=0}),b.on("drag",function(i){var n=s.origin.scrCoords;let[l,u,f,T]=s.getBoundingBox();w.current=(M.current[1]+i.x-S.current[0]-n[1])/s.unitX,w.current=Math.min(f,Math.max(l,w.current)),O.current=(n[2]-(M.current[2]+i.y-S.current[1]))/s.unitY,O.current=Math.min(u,Math.max(T,O.current)),x({action:g.movePoint,args:{x:w.current,y:O.current,transient:!0,skippable:!0}}),y.coords.setCoordinates(JXG.COORDS_BY_USER,D.current),s.updateInfobox(y),(Math.abs(i.x-S.current[0])>.1||Math.abs(i.y-S.current[1])>.1)&&(k.current=!0)}),t.current=y,r.current=b,J.current=e.labelPosition,G.current=m}if(s){if(t.current===null)Y();else{let c=B==="dark"?e.selectedStyle.markerColorDarkMode:e.selectedStyle.markerColor;c=c.toLowerCase();let C=A?"var(--canvas)":c,R=A?c:"none";t.current.visProp.fillcolor!==C&&(t.current.visProp.fillcolor=C);let h=(_=e.numericalXs)==null?void 0:_[0],m=(E=e.numericalXs)==null?void 0:E[1];t.current.coords.setCoordinates(JXG.COORDS_BY_USER,[h,m]),k.current||r.current.coords.setCoordinates(JXG.COORDS_BY_USER,[h,m]);let o=!e.hidden;if(Number.isFinite(h)&&Number.isFinite(m)){let l=t.current.visProp.visible!==o;t.current.visProp.visible=o,t.current.visPropCalc.visible=o,r.current.visProp.visible=o,r.current.visPropCalc.visible=o,l&&(t.current.setAttribute({visible:o}),r.current.setAttribute({visible:o}))}else t.current.visProp.visible=!1,t.current.visPropCalc.visible=!1,r.current.visProp.visible=!1,r.current.visPropCalc.visible=!1;let d=10*e.layer+U;t.current.visProp.layer!==d&&(t.current.setAttribute({layer:d}),r.current.setAttribute({layer:d}));let b=!e.draggable||e.fixed;t.current.visProp.highlight=!b,r.current.visProp.highlight=!b,r.current.visProp.fixed=b,t.current.visProp.strokecolor!==R&&(t.current.visProp.strokecolor=R,r.current.visProp.strokecolor=R,t.current.visProp.fillColor=C,r.current.visProp.fillColor=C),t.current.visProp.strokeopacity!==e.selectedStyle.lineOpacity&&(t.current.visProp.strokeopacity=e.selectedStyle.lineOpacity,t.current.visProp.fillopacity=e.selectedStyle.lineOpacity);let y=j(e.selectedStyle.markerStyle);t.current.visProp.face!==y&&(t.current.setAttribute({face:y}),r.current.setAttribute({face:y}));let i=I(e.selectedStyle.markerSize,e.selectedStyle.markerStyle);t.current.visProp.size!==i&&(t.current.setAttribute({size:i}),r.current.setAttribute({size:i})),b?t.current.visProp.showinfobox=!1:t.current.visProp.showinfobox=e.showCoordsWhenDragging,L.sourceInformation&&z in L.sourceInformation&&s.updateInfobox(t.current),t.current.name=e.labelForGraph;let n=e.showLabel&&e.labelForGraph!=="";if(n!=G.current&&(t.current.setAttribute({withlabel:n}),G.current=n),t.current.hasLabel)if(t.current.label.needsUpdate=!0,e.applyStyleToLabel?t.current.label.visProp.strokecolor=c:t.current.label.visProp.strokecolor="var(--canvastext)",e.labelPosition!==J.current){let l,u,f;e.labelPosition==="upperright"?(f=[5,5],l="left",u="bottom"):e.labelPosition==="upperleft"?(f=[-5,5],l="right",u="bottom"):e.labelPosition==="lowerright"?(f=[5,-5],l="left",u="top"):e.labelPosition==="lowerleft"?(f=[-5,-5],l="right",u="top"):e.labelPosition==="top"?(f=[0,10],l="middle",u="bottom"):e.labelPosition==="bottom"?(f=[0,-10],l="middle",u="top"):e.labelPosition==="left"?(f=[-10,0],l="right",u="middle"):(f=[10,0],l="left",u="middle"),t.current.label.visProp.anchorx=l,t.current.label.visProp.anchory=u,t.current.label.visProp.offset=f,J.current=e.labelPosition,t.current.label.fullUpdate()}else t.current.label.update();t.current.needsUpdate=!0,t.current.update(),r.current.needsUpdate=!0,r.current.update(),s.updateRenderer()}return F("a",{name:X})}if(e.hidden)return null;let N="\\("+e.latex+"\\)";return K(Q,{children:[F("a",{name:X}),F("span",{id:X,children:F(Z.MathJax,{hideUntilTypeset:"first",inline:!0,dynamic:!0,children:N})})]})});function I(p,v){return v==="diamond"?p*1.4:v==="plus"?p*1.2:v==="square"?p*1.1:v.substring(0,8)==="triangle"?p*1.5:p}function j(p){return p==="triangle"?"triangleup":p}export{ie as default}; diff --git a/dist/assets/polygon-45e4e0cc.js b/dist/assets/polygon-8718e4fd.js similarity index 97% rename from dist/assets/polygon-45e4e0cc.js rename to dist/assets/polygon-8718e4fd.js index 66e1b6297b..6e960139d2 100644 --- a/dist/assets/polygon-45e4e0cc.js +++ b/dist/assets/polygon-8718e4fd.js @@ -1 +1 @@ -import{av as T,bn as B,r as d,l as N,bs as H,j as X,F as z}from"./index-61b6fc23.js";import{BoardContext as q,LINE_LAYER_OFFSET as V,VERTEX_LAYER_OFFSET as M}from"./graph-1ff63df5.js";import"./css-14ccef8c.js";import"./visibility-sensor-398e690f.js";const ee=T.memo(function S(W){let{name:A,id:Y,SVs:e,actions:y,sourceOfUpdate:R,callAction:v}=B(W);S.ignoreActionsWithoutCore=!0;const c=d.useContext(q);let r=d.useRef(null),g=d.useRef(null),m=d.useRef(null),O=d.useRef(null),b=d.useRef(null),D=d.useRef(null),P=d.useRef(null),x=d.useRef(null),F=d.useRef(null);F.current=e.numericalVertices;const w=N(H);d.useEffect(()=>()=>{r.current&&E()},[]);function j(){if(!(e.nVertices>=2))return null;let l=!e.draggable||e.fixed,i=!e.verticesDraggable||e.fixed,o=w==="dark"?e.selectedStyle.lineColorDarkMode:e.selectedStyle.lineColor;o=o.toLowerCase();let s=w==="dark"?e.selectedStyle.fillColorDarkMode:e.selectedStyle.fillColor;s=e.filled?s.toLowerCase():"none",x.current={fillColor:"none",strokeColor:"none",highlightStrokeColor:"none",highlightFillColor:getComputedStyle(document.documentElement).getPropertyValue("--mainGray"),visible:!i&&!e.hidden,withLabel:!1,layer:10*e.layer+M,highlight:!0};let f={highlight:!1,visible:!e.hidden,layer:10*e.layer+V,fixed:!0,strokeColor:o,strokeOpacity:e.selectedStyle.lineOpacity,highlightStrokeColor:o,highlightStrokeOpacity:e.selectedStyle.lineOpacity*.5,strokeWidth:e.selectedStyle.lineWidth,highlightStrokeWidth:e.selectedStyle.lineWidth,dash:J(e.selectedStyle.lineStyle)},a={name:e.labelForGraph,visible:!e.hidden,withLabel:e.showLabel&&e.labelForGraph!=="",fixed:l,layer:10*e.layer+V,fillColor:s,fillOpacity:e.selectedStyle.fillOpacity,highlightFillColor:s,highlightFillOpacity:e.selectedStyle.fillOpacity*.5,highlight:!l,vertices:x.current,borders:f};a.label={highlight:!1},e.labelHasLatex&&(a.label.useMathJax=!0),e.applyStyleToLabel?a.label.strokeColor=o:a.label.strokeColor="var(--canvastext)",e.filled&&(a.hasInnerPoints=!0),c.suspendUpdate();let C=[];for(let u of e.numericalVertices)C.push(c.create("point",[...u],x.current));let p=c.create("polygon",C,a);return L(p),p.on("drag",u=>_(-1,u)),p.on("up",u=>G(-1)),p.on("down",function(u){m.current=null,b.current=[u.x,u.y],D.current=p.vertices.map(h=>[...h.coords.scrCoords]),O.current===null&&v({action:y.mouseDownOnPolygon})}),c.unsuspendUpdate(),P.current=e.nVertices,p}function L(l){for(let i=0;i_(i,s)),o.off("up"),o.on("up",()=>G(i)),o.off("down"),o.on("down",s=>{m.current=null,b.current=[s.x,s.y],O.current=i,v({action:y.mouseDownOnPolygon})})}}function E(){for(let l=0;l.1||Math.abs(i.y-b.current[1])>.1)if(m.current=l,l===-1){g.current=I(i),v({action:y.movePolygon,args:{pointCoords:g.current,transient:!0,skippable:!0}});for(let o=0;o=2))E();else{let l=!0;for(let t of e.numericalVertices)Number.isFinite(t[0])||(l=!1),Number.isFinite(t[1])||(l=!1);if(e.nVertices>P.current){for(let t=P.current;t=e.nVertices;t--)r.current.vertices[t].off("drag"),r.current.vertices[t].off("down"),r.current.vertices[t].off("up"),r.current.removePoints(r.current.vertices[t]);L(r.current)}let i=!e.draggable||e.fixed,s=!(!e.verticesDraggable||e.fixed)&&!e.hidden;for(let t=0;t()=>{r.current&&E()},[]);function j(){if(!(e.nVertices>=2))return null;let l=!e.draggable||e.fixed,i=!e.verticesDraggable||e.fixed,o=w==="dark"?e.selectedStyle.lineColorDarkMode:e.selectedStyle.lineColor;o=o.toLowerCase();let s=w==="dark"?e.selectedStyle.fillColorDarkMode:e.selectedStyle.fillColor;s=e.filled?s.toLowerCase():"none",x.current={fillColor:"none",strokeColor:"none",highlightStrokeColor:"none",highlightFillColor:getComputedStyle(document.documentElement).getPropertyValue("--mainGray"),visible:!i&&!e.hidden,withLabel:!1,layer:10*e.layer+M,highlight:!0};let f={highlight:!1,visible:!e.hidden,layer:10*e.layer+V,fixed:!0,strokeColor:o,strokeOpacity:e.selectedStyle.lineOpacity,highlightStrokeColor:o,highlightStrokeOpacity:e.selectedStyle.lineOpacity*.5,strokeWidth:e.selectedStyle.lineWidth,highlightStrokeWidth:e.selectedStyle.lineWidth,dash:J(e.selectedStyle.lineStyle)},a={name:e.labelForGraph,visible:!e.hidden,withLabel:e.showLabel&&e.labelForGraph!=="",fixed:l,layer:10*e.layer+V,fillColor:s,fillOpacity:e.selectedStyle.fillOpacity,highlightFillColor:s,highlightFillOpacity:e.selectedStyle.fillOpacity*.5,highlight:!l,vertices:x.current,borders:f};a.label={highlight:!1},e.labelHasLatex&&(a.label.useMathJax=!0),e.applyStyleToLabel?a.label.strokeColor=o:a.label.strokeColor="var(--canvastext)",e.filled&&(a.hasInnerPoints=!0),c.suspendUpdate();let C=[];for(let u of e.numericalVertices)C.push(c.create("point",[...u],x.current));let p=c.create("polygon",C,a);return L(p),p.on("drag",u=>_(-1,u)),p.on("up",u=>G(-1)),p.on("down",function(u){m.current=null,b.current=[u.x,u.y],D.current=p.vertices.map(h=>[...h.coords.scrCoords]),O.current===null&&v({action:y.mouseDownOnPolygon})}),c.unsuspendUpdate(),P.current=e.nVertices,p}function L(l){for(let i=0;i_(i,s)),o.off("up"),o.on("up",()=>G(i)),o.off("down"),o.on("down",s=>{m.current=null,b.current=[s.x,s.y],O.current=i,v({action:y.mouseDownOnPolygon})})}}function E(){for(let l=0;l.1||Math.abs(i.y-b.current[1])>.1)if(m.current=l,l===-1){g.current=I(i),v({action:y.movePolygon,args:{pointCoords:g.current,transient:!0,skippable:!0}});for(let o=0;o=2))E();else{let l=!0;for(let t of e.numericalVertices)Number.isFinite(t[0])||(l=!1),Number.isFinite(t[1])||(l=!1);if(e.nVertices>P.current){for(let t=P.current;t=e.nVertices;t--)r.current.vertices[t].off("drag"),r.current.vertices[t].off("down"),r.current.vertices[t].off("up"),r.current.removePoints(r.current.vertices[t]);L(r.current)}let i=!e.draggable||e.fixed,s=!(!e.verticesDraggable||e.fixed)&&!e.hidden;for(let t=0;t()=>{r.current&&L()},[]);function T(){if(e.numericalVertices.length!==e.nVertices||e.numericalVertices.some(l=>l.length!==2))return null;let n=!0;for(let l of e.numericalVertices)Number.isFinite(l[0])||(n=!1),Number.isFinite(l[1])||(n=!1);let a=!e.draggable||e.fixed,u=E==="dark"?e.selectedStyle.lineColorDarkMode:e.selectedStyle.lineColor;u=u.toLowerCase();let o={name:e.labelForGraph,visible:!e.hidden&&n,withLabel:e.showLabel&&e.labelForGraph!=="",layer:10*e.layer+Y,fixed:a,strokeColor:u,strokeOpacity:e.selectedStyle.lineOpacity,highlightStrokeColor:u,highlightStrokeOpacity:e.selectedStyle.lineOpacity*.5,strokeWidth:e.selectedStyle.lineWidth,highlightStrokeWidth:e.selectedStyle.lineWidth,dash:A(e.selectedStyle.lineStyle),highlight:!a,lineCap:"butt"},c=!e.verticesDraggable||e.fixed;P.current=Object.assign({},o),Object.assign(P.current,{fixed:!1,highlight:!0,withLabel:!1,fillColor:"none",strokeColor:"none",highlightStrokeColor:"none",highlightFillColor:getComputedStyle(document.documentElement).getPropertyValue("--mainGray"),layer:10*e.layer+_}),(c||e.hidden||!n)&&(P.current.visible=!1),o.label={highlight:!1},e.labelHasLatex&&(o.label.useMathJax=!0),e.applyStyleToLabel?o.label.strokeColor=u:o.label.strokeColor="var(--canvastext)",i.current=[];for(let l=0;l{x.push(l[0]),R.push(l[1])});let p=s.create("curve",[x,R],o);for(let l=0;lO(l,h)),i.current[l].on("up",()=>M(l)),i.current[l].on("down",h=>{b.current=null,m.current=[h.x,h.y],k.current=l,g({action:y.mouseDownOnPolyline})});return p.on("drag",l=>O(-1,l)),p.on("up",()=>M(-1)),p.on("down",function(l){b.current=null,m.current=[l.x,l.y],X.current=p.points.map(h=>[...h.scrCoords]),k.current===null&&g({action:y.mouseDownOnPolyline})}),C.current=e.nVertices,p}function L(){r.current.off("drag"),r.current.off("down"),r.current.off("up"),s.removeObject(r.current),r.current=null;for(let n=0;n.1||Math.abs(a.y-m.current[1])>.1)if(b.current=n,n===-1){v.current=U(a),g({action:y.movePolyline,args:{pointCoords:v.current,transient:!0,skippable:!0}}),r.current.updateTransformMatrix();let u=r.current.transformMat[1][0],o=r.current.transformMat[2][0];for(let c=0;cn.length!==2))L();else{let n=!0;for(let t of e.numericalVertices)Number.isFinite(t[0])||(n=!1),Number.isFinite(t[1])||(n=!1);let a=!e.draggable||e.fixed;r.current.visProp.fixed=a,r.current.visProp.highlight=!a;let u=10*e.layer+Y,o=r.current.visProp.layer!==u,c=10*e.layer+_;if(o&&(r.current.setAttribute({layer:u}),P.current.layer=c),e.nVertices>C.current)for(let t=C.current;tO(t,!0)),i.current[t].on("up",f=>O(t,!1)),i.current[t].on("down",f=>b.current=null);else if(e.nVertices()=>{r.current&&L()},[]);function T(){if(e.numericalVertices.length!==e.nVertices||e.numericalVertices.some(l=>l.length!==2))return null;let n=!0;for(let l of e.numericalVertices)Number.isFinite(l[0])||(n=!1),Number.isFinite(l[1])||(n=!1);let a=!e.draggable||e.fixed,u=E==="dark"?e.selectedStyle.lineColorDarkMode:e.selectedStyle.lineColor;u=u.toLowerCase();let o={name:e.labelForGraph,visible:!e.hidden&&n,withLabel:e.showLabel&&e.labelForGraph!=="",layer:10*e.layer+Y,fixed:a,strokeColor:u,strokeOpacity:e.selectedStyle.lineOpacity,highlightStrokeColor:u,highlightStrokeOpacity:e.selectedStyle.lineOpacity*.5,strokeWidth:e.selectedStyle.lineWidth,highlightStrokeWidth:e.selectedStyle.lineWidth,dash:A(e.selectedStyle.lineStyle),highlight:!a,lineCap:"butt"},c=!e.verticesDraggable||e.fixed;P.current=Object.assign({},o),Object.assign(P.current,{fixed:!1,highlight:!0,withLabel:!1,fillColor:"none",strokeColor:"none",highlightStrokeColor:"none",highlightFillColor:getComputedStyle(document.documentElement).getPropertyValue("--mainGray"),layer:10*e.layer+_}),(c||e.hidden||!n)&&(P.current.visible=!1),o.label={highlight:!1},e.labelHasLatex&&(o.label.useMathJax=!0),e.applyStyleToLabel?o.label.strokeColor=u:o.label.strokeColor="var(--canvastext)",i.current=[];for(let l=0;l{x.push(l[0]),R.push(l[1])});let p=s.create("curve",[x,R],o);for(let l=0;lO(l,h)),i.current[l].on("up",()=>M(l)),i.current[l].on("down",h=>{b.current=null,m.current=[h.x,h.y],k.current=l,g({action:y.mouseDownOnPolyline})});return p.on("drag",l=>O(-1,l)),p.on("up",()=>M(-1)),p.on("down",function(l){b.current=null,m.current=[l.x,l.y],X.current=p.points.map(h=>[...h.scrCoords]),k.current===null&&g({action:y.mouseDownOnPolyline})}),C.current=e.nVertices,p}function L(){r.current.off("drag"),r.current.off("down"),r.current.off("up"),s.removeObject(r.current),r.current=null;for(let n=0;n.1||Math.abs(a.y-m.current[1])>.1)if(b.current=n,n===-1){v.current=U(a),g({action:y.movePolyline,args:{pointCoords:v.current,transient:!0,skippable:!0}}),r.current.updateTransformMatrix();let u=r.current.transformMat[1][0],o=r.current.transformMat[2][0];for(let c=0;cn.length!==2))L();else{let n=!0;for(let t of e.numericalVertices)Number.isFinite(t[0])||(n=!1),Number.isFinite(t[1])||(n=!1);let a=!e.draggable||e.fixed;r.current.visProp.fixed=a,r.current.visProp.highlight=!a;let u=10*e.layer+Y,o=r.current.visProp.layer!==u,c=10*e.layer+_;if(o&&(r.current.setAttribute({layer:u}),P.current.layer=c),e.nVertices>C.current)for(let t=C.current;tO(t,!0)),i.current[t].on("up",f=>O(t,!1)),i.current[t].on("down",f=>b.current=null);else if(e.nVertices{r({action:i.recordVisibilityChange,args:{isVisible:o}})};return m.useEffect(()=>()=>{r({action:i.recordVisibilityChange,args:{isVisible:!1}})},[]),s.hidden?null:a(f,{partialVisibility:!0,onChange:l,children:u("pre",{id:e,style:{margin:"12px 0"},children:[a("a",{name:e}),t]})})});export{g as default}; +import{av as c,bn as d,r as m,j as a,a as u}from"./index-9d63439d.js";import{V as f}from"./visibility-sensor-aefdbbd5.js";const g=c.memo(function(n){let{name:p,id:e,SVs:s,children:t,actions:i,callAction:r}=d(n),l=o=>{r({action:i.recordVisibilityChange,args:{isVisible:o}})};return m.useEffect(()=>()=>{r({action:i.recordVisibilityChange,args:{isVisible:!1}})},[]),s.hidden?null:a(f,{partialVisibility:!0,onChange:l,children:u("pre",{id:e,style:{margin:"12px 0"},children:[a("a",{name:e}),t]})})});export{g as default}; diff --git a/dist/assets/q-199e8b0b.js b/dist/assets/q-199e8b0b.js deleted file mode 100644 index 376770e8b1..0000000000 --- a/dist/assets/q-199e8b0b.js +++ /dev/null @@ -1 +0,0 @@ -import{av as s,bn as t,a as d,F as i,j as m}from"./index-61b6fc23.js";const c=s.memo(function(e){let{name:l,id:n,SVs:a,children:r}=t(e);return a.hidden?null:d(i,{children:[m("a",{name:n}),"“",r,"”"]})});export{c as default}; diff --git a/dist/assets/q-4058f1e9.js b/dist/assets/q-4058f1e9.js new file mode 100644 index 0000000000..66f05d5e01 --- /dev/null +++ b/dist/assets/q-4058f1e9.js @@ -0,0 +1 @@ +import{av as s,bn as t,a as d,F as i,j as m}from"./index-9d63439d.js";const c=s.memo(function(e){let{name:l,id:n,SVs:a,children:r}=t(e);return a.hidden?null:d(i,{children:[m("a",{name:n}),"“",r,"”"]})});export{c as default}; diff --git a/dist/assets/ray-41a10f15.js b/dist/assets/ray-fa809714.js similarity index 95% rename from dist/assets/ray-41a10f15.js rename to dist/assets/ray-fa809714.js index 9534fd06fa..38fe13b3e3 100644 --- a/dist/assets/ray-41a10f15.js +++ b/dist/assets/ray-fa809714.js @@ -1 +1 @@ -import{av as D,bn as _,r as n,l as T,bs as A,j as O,F as X}from"./index-61b6fc23.js";import{BoardContext as J,LINE_LAYER_OFFSET as x}from"./graph-1ff63df5.js";import"./css-14ccef8c.js";import"./visibility-sensor-398e690f.js";const N=D.memo(function u(E){let{name:W,id:F,SVs:e,actions:p,sourceOfUpdate:M,callAction:f}=_(E);u.ignoreActionsWithoutCore=!0;const c=n.useContext(J);let r=n.useRef(null),d=n.useRef(!1),g=n.useRef(!1),b=n.useRef(!1),v=n.useRef(!1),h=n.useRef(null),m=n.useRef(null),S=n.useRef(null);m.current=e.numericalEndpoint,S.current=e.numericalThroughpoint;const R=T(A);n.useEffect(()=>()=>{Object.keys(r.current).length!==0&&k()},[]);function G(){if(e.numericalEndpoint.length!==2||e.numericalThroughpoint.length!==2){r.current=null;return}let i=!e.draggable||e.fixed,l=R==="dark"?e.selectedStyle.lineColorDarkMode:e.selectedStyle.lineColor;l=l.toLowerCase();var o={name:e.labelForGraph,visible:!e.hidden,withLabel:e.showLabel&&e.labelForGraph!=="",layer:10*e.layer+x,fixed:i,strokeColor:l,strokeOpacity:e.selectedStyle.lineOpacity,highlightStrokeColor:l,highlightStrokeOpacity:e.selectedStyle.lineOpacity*.5,strokeWidth:e.selectedStyle.lineWidth,highlightStrokeWidth:e.selectedStyle.lineWidth,dash:w(e.selectedStyle.lineStyle),highlight:!i,straightFirst:!1};o.label={highlight:!1},e.labelHasLatex&&(o.label.useMathJax=!0),e.applyStyleToLabel?o.label.strokeColor=l:o.label.strokeColor="var(--canvastext)";let s=[[...e.numericalEndpoint],[...e.numericalThroughpoint]],a=c.create("line",s,o);a.on("drag",function(t){(Math.abs(t.x-d.current[0])>.1||Math.abs(t.y-d.current[1])>.1)&&(b.current=!0,h.current=L(t),f({action:p.moveRay,args:{endpointcoords:h.current[0],throughcoords:h.current[1],transient:!0,skippable:!0}})),r.current.point1.coords.setCoordinates(JXG.COORDS_BY_USER,m.current),r.current.point2.coords.setCoordinates(JXG.COORDS_BY_USER,S.current)}),a.on("up",function(t){b.current?f({action:p.moveRay,args:{endpointcoords:h.current[0],throughcoords:h.current[1]}}):f({action:p.rayClicked})}),a.on("down",function(t){b.current=!1,d.current=[t.x,t.y],g.current=[[...a.point1.coords.scrCoords],[...a.point2.coords.scrCoords]],f({action:p.mouseDownOnRay})}),v.current=e.showLabel&&e.labelForGraph!=="",r.current=a}function k(){r.current.off("drag"),r.current.off("down"),r.current.off("up"),c.removeObject(r.current),r.current=null}function L(i){var l=c.origin.scrCoords;let o=[];for(let s=0;s<2;s++){let a=(g.current[s][1]+i.x-d.current[0]-l[1])/c.unitX,t=(l[2]-(g.current[s][2]+i.y-d.current[1]))/c.unitY;o.push([a,t])}return o}if(c)if(r.current===null)G();else if(e.numericalEndpoint.length!==2||e.numericalThroughpoint.length!==2)k();else{let i=!0;for(let y of[e.numericalEndpoint,e.numericalThroughpoint])Number.isFinite(y[0])||(i=!1),Number.isFinite(y[1])||(i=!1);r.current.point1.coords.setCoordinates(JXG.COORDS_BY_USER,e.numericalEndpoint),r.current.point2.coords.setCoordinates(JXG.COORDS_BY_USER,e.numericalThroughpoint);let l=!e.hidden;if(i){let y=r.current.visProp.visible!==l;r.current.visProp.visible=l,r.current.visPropCalc.visible=l,y&&r.current.setAttribute({visible:l})}else r.current.visProp.visible=!1,r.current.visPropCalc.visible=!1;let o=!e.draggable||e.fixed;r.current.visProp.fixed=o,r.current.visProp.highlight=!o;let s=10*e.layer+x;r.current.visProp.layer!==s&&r.current.setAttribute({layer:s});let t=R==="dark"?e.selectedStyle.lineColorDarkMode:e.selectedStyle.lineColor;t=t.toLowerCase(),r.current.visProp.strokecolor!==t&&(r.current.visProp.strokecolor=t,r.current.visProp.highlightstrokecolor=t),r.current.visProp.strokewidth!==e.selectedStyle.lineWidth&&(r.current.visProp.strokewidth=e.selectedStyle.lineWidth,r.current.visProp.highlightstrokewidth=e.selectedStyle.lineWidth),r.current.visProp.strokeopacity!==e.selectedStyle.lineOpacity&&(r.current.visProp.strokeopacity=e.selectedStyle.lineOpacity,r.current.visProp.highlightstrokeopacity=e.selectedStyle.lineOpacity*.5);let P=w(e.selectedStyle.lineStyle);r.current.visProp.dash!==P&&(r.current.visProp.dash=P),r.current.name=e.labelForGraph;let C=e.showLabel&&e.labelForGraph!=="";C!=v.current&&(r.current.setAttribute({withlabel:C}),v.current=C),r.current.needsUpdate=!0,r.current.update(),r.current.hasLabel&&(e.applyStyleToLabel?r.current.label.visProp.strokecolor=t:r.current.label.visProp.strokecolor="var(--canvastext)",r.current.label.needsUpdate=!0,r.current.label.update()),c.updateRenderer()}return e.hidden?null:O(X,{children:O("a",{name:F})})});function w(u){return u==="solid"?0:u==="dashed"?2:u==="dotted"?1:0}export{N as default}; +import{av as D,bn as _,r as n,l as T,bs as A,j as O,F as X}from"./index-9d63439d.js";import{BoardContext as J,LINE_LAYER_OFFSET as x}from"./graph-0c612329.js";import"./css-14ccef8c.js";import"./visibility-sensor-aefdbbd5.js";const N=D.memo(function u(E){let{name:W,id:F,SVs:e,actions:p,sourceOfUpdate:M,callAction:f}=_(E);u.ignoreActionsWithoutCore=!0;const c=n.useContext(J);let r=n.useRef(null),d=n.useRef(!1),g=n.useRef(!1),b=n.useRef(!1),v=n.useRef(!1),h=n.useRef(null),m=n.useRef(null),S=n.useRef(null);m.current=e.numericalEndpoint,S.current=e.numericalThroughpoint;const R=T(A);n.useEffect(()=>()=>{Object.keys(r.current).length!==0&&k()},[]);function G(){if(e.numericalEndpoint.length!==2||e.numericalThroughpoint.length!==2){r.current=null;return}let i=!e.draggable||e.fixed,l=R==="dark"?e.selectedStyle.lineColorDarkMode:e.selectedStyle.lineColor;l=l.toLowerCase();var o={name:e.labelForGraph,visible:!e.hidden,withLabel:e.showLabel&&e.labelForGraph!=="",layer:10*e.layer+x,fixed:i,strokeColor:l,strokeOpacity:e.selectedStyle.lineOpacity,highlightStrokeColor:l,highlightStrokeOpacity:e.selectedStyle.lineOpacity*.5,strokeWidth:e.selectedStyle.lineWidth,highlightStrokeWidth:e.selectedStyle.lineWidth,dash:w(e.selectedStyle.lineStyle),highlight:!i,straightFirst:!1};o.label={highlight:!1},e.labelHasLatex&&(o.label.useMathJax=!0),e.applyStyleToLabel?o.label.strokeColor=l:o.label.strokeColor="var(--canvastext)";let s=[[...e.numericalEndpoint],[...e.numericalThroughpoint]],a=c.create("line",s,o);a.on("drag",function(t){(Math.abs(t.x-d.current[0])>.1||Math.abs(t.y-d.current[1])>.1)&&(b.current=!0,h.current=L(t),f({action:p.moveRay,args:{endpointcoords:h.current[0],throughcoords:h.current[1],transient:!0,skippable:!0}})),r.current.point1.coords.setCoordinates(JXG.COORDS_BY_USER,m.current),r.current.point2.coords.setCoordinates(JXG.COORDS_BY_USER,S.current)}),a.on("up",function(t){b.current?f({action:p.moveRay,args:{endpointcoords:h.current[0],throughcoords:h.current[1]}}):f({action:p.rayClicked})}),a.on("down",function(t){b.current=!1,d.current=[t.x,t.y],g.current=[[...a.point1.coords.scrCoords],[...a.point2.coords.scrCoords]],f({action:p.mouseDownOnRay})}),v.current=e.showLabel&&e.labelForGraph!=="",r.current=a}function k(){r.current.off("drag"),r.current.off("down"),r.current.off("up"),c.removeObject(r.current),r.current=null}function L(i){var l=c.origin.scrCoords;let o=[];for(let s=0;s<2;s++){let a=(g.current[s][1]+i.x-d.current[0]-l[1])/c.unitX,t=(l[2]-(g.current[s][2]+i.y-d.current[1]))/c.unitY;o.push([a,t])}return o}if(c)if(r.current===null)G();else if(e.numericalEndpoint.length!==2||e.numericalThroughpoint.length!==2)k();else{let i=!0;for(let y of[e.numericalEndpoint,e.numericalThroughpoint])Number.isFinite(y[0])||(i=!1),Number.isFinite(y[1])||(i=!1);r.current.point1.coords.setCoordinates(JXG.COORDS_BY_USER,e.numericalEndpoint),r.current.point2.coords.setCoordinates(JXG.COORDS_BY_USER,e.numericalThroughpoint);let l=!e.hidden;if(i){let y=r.current.visProp.visible!==l;r.current.visProp.visible=l,r.current.visPropCalc.visible=l,y&&r.current.setAttribute({visible:l})}else r.current.visProp.visible=!1,r.current.visPropCalc.visible=!1;let o=!e.draggable||e.fixed;r.current.visProp.fixed=o,r.current.visProp.highlight=!o;let s=10*e.layer+x;r.current.visProp.layer!==s&&r.current.setAttribute({layer:s});let t=R==="dark"?e.selectedStyle.lineColorDarkMode:e.selectedStyle.lineColor;t=t.toLowerCase(),r.current.visProp.strokecolor!==t&&(r.current.visProp.strokecolor=t,r.current.visProp.highlightstrokecolor=t),r.current.visProp.strokewidth!==e.selectedStyle.lineWidth&&(r.current.visProp.strokewidth=e.selectedStyle.lineWidth,r.current.visProp.highlightstrokewidth=e.selectedStyle.lineWidth),r.current.visProp.strokeopacity!==e.selectedStyle.lineOpacity&&(r.current.visProp.strokeopacity=e.selectedStyle.lineOpacity,r.current.visProp.highlightstrokeopacity=e.selectedStyle.lineOpacity*.5);let P=w(e.selectedStyle.lineStyle);r.current.visProp.dash!==P&&(r.current.visProp.dash=P),r.current.name=e.labelForGraph;let C=e.showLabel&&e.labelForGraph!=="";C!=v.current&&(r.current.setAttribute({withlabel:C}),v.current=C),r.current.needsUpdate=!0,r.current.update(),r.current.hasLabel&&(e.applyStyleToLabel?r.current.label.visProp.strokecolor=t:r.current.label.visProp.strokecolor="var(--canvastext)",r.current.label.needsUpdate=!0,r.current.label.update()),c.updateRenderer()}return e.hidden?null:O(X,{children:O("a",{name:F})})});function w(u){return u==="solid"?0:u==="dashed"?2:u==="dotted"?1:0}export{N as default}; diff --git a/dist/assets/ref-ee7f7b38.js b/dist/assets/ref-d259f21d.js similarity index 96% rename from dist/assets/ref-ee7f7b38.js rename to dist/assets/ref-d259f21d.js index a692b50ca4..91a2cdaaf6 100644 --- a/dist/assets/ref-ee7f7b38.js +++ b/dist/assets/ref-d259f21d.js @@ -1,4 +1,4 @@ -import{av as R,bn as B,l as s,p as w,G as T,ab as I,u as j,e as C,bx as _,a as p,j as r,by as $,s as A}from"./index-61b6fc23.js";const b=A.button` +import{av as R,bn as B,l as s,p as w,G as T,ab as I,u as j,e as C,bx as _,a as p,j as r,by as $,s as A}from"./index-9d63439d.js";const b=A.button` position: relative; height: 24px; display: inline-block; diff --git a/dist/assets/regionBetweenCurveXAxis-ce0800c5.js b/dist/assets/regionBetweenCurveXAxis-0e1749d4.js similarity index 91% rename from dist/assets/regionBetweenCurveXAxis-ce0800c5.js rename to dist/assets/regionBetweenCurveXAxis-0e1749d4.js index 38f3e21c76..f145aee3ad 100644 --- a/dist/assets/regionBetweenCurveXAxis-ce0800c5.js +++ b/dist/assets/regionBetweenCurveXAxis-0e1749d4.js @@ -1 +1 @@ -import{av as L,bn as S,r as a,l as x,bs as F,bt as v,j as o,F as y}from"./index-61b6fc23.js";import{BoardContext as O,LINE_LAYER_OFFSET as b}from"./graph-1ff63df5.js";import"./css-14ccef8c.js";import"./visibility-sensor-398e690f.js";const P=L.memo(function h(g){let{name:U,id:s,SVs:e}=S(g);h.ignoreActionsWithoutCore=!0;const t=a.useContext(O);let n=a.useRef(null),r=a.useRef(null);const d=x(F);a.useEffect(()=>()=>{r.current!==null&&f()},[]);function m(){if(!e.haveFunction||e.boundaryValues.length!==2||!e.boundaryValues.every(Number.isFinite))return null;let l=d==="dark"?e.selectedStyle.fillColorDarkMode:e.selectedStyle.fillColor;l=l.toLowerCase();let i={name:e.labelForGraph,visible:!e.hidden,withLabel:e.showLabel&&e.labelForGraph!=="",fixed:!0,layer:10*e.layer+b,fillColor:l,fillOpacity:e.selectedStyle.fillOpacity,highlight:!1,curveLeft:{visible:!1},curveRight:{visible:!1}};i.label={highlight:!1};let c=v(e.fDefinition);return n.current=t.create("functiongraph",c,{visible:!1}),t.create("integral",[e.boundaryValues,n.current],i)}function f(){r.current&&(t.removeObject(r.current),r.current=null,t.removeObject(n.current),n.current=null)}if(t){if(r.current===null)r.current=m();else if(!e.haveFunction||e.boundaryValues.length!==2||!e.boundaryValues.every(Number.isFinite))f();else{let l=v(e.fDefinition);n.current.Y=l,r.current.visProp.visible=!e.hidden,r.current.visPropCalc.visible=!e.hidden;let[i,c]=e.boundaryValues,[C,R]=e.boundaryValues.map(l);r.current.curveLeft.coords.setCoordinates(JXG.COORDS_BY_USER,[i,C]),r.current.curveRight.coords.setCoordinates(JXG.COORDS_BY_USER,[c,R]);let p=10*e.layer+b;r.current.visProp.layer!==p&&r.current.setAttribute({layer:p});let u=d==="dark"?e.selectedStyle.fillColorDarkMode:e.selectedStyle.fillColor;u=u.toLowerCase(),r.current.visProp.fillcolor!==u&&(r.current.visProp.fillcolor=u),r.current.visProp.fillopacity!==e.selectedStyle.fillOpacity&&(r.current.visProp.fillopacity=e.selectedStyle.fillOpacity),r.current.curveLeft.needsUpdate=!0,r.current.curveLeft.update(),r.current.curveLeft.fullUpdate(),r.current.curveRight.needsUpdate=!0,r.current.curveLeft.update(),r.current.curveRight.fullUpdate(),r.current.needsUpdate=!0,r.current.curveLeft.update(),r.current.fullUpdate(),t.update(),t.fullUpdate(),t.updateRenderer()}return o(y,{children:o("a",{name:s})})}return e.hidden?null:o(y,{children:o("a",{name:s})})});export{P as default}; +import{av as L,bn as S,r as a,l as x,bs as F,bt as v,j as o,F as y}from"./index-9d63439d.js";import{BoardContext as O,LINE_LAYER_OFFSET as b}from"./graph-0c612329.js";import"./css-14ccef8c.js";import"./visibility-sensor-aefdbbd5.js";const P=L.memo(function h(g){let{name:U,id:s,SVs:e}=S(g);h.ignoreActionsWithoutCore=!0;const t=a.useContext(O);let n=a.useRef(null),r=a.useRef(null);const d=x(F);a.useEffect(()=>()=>{r.current!==null&&f()},[]);function m(){if(!e.haveFunction||e.boundaryValues.length!==2||!e.boundaryValues.every(Number.isFinite))return null;let l=d==="dark"?e.selectedStyle.fillColorDarkMode:e.selectedStyle.fillColor;l=l.toLowerCase();let i={name:e.labelForGraph,visible:!e.hidden,withLabel:e.showLabel&&e.labelForGraph!=="",fixed:!0,layer:10*e.layer+b,fillColor:l,fillOpacity:e.selectedStyle.fillOpacity,highlight:!1,curveLeft:{visible:!1},curveRight:{visible:!1}};i.label={highlight:!1};let c=v(e.fDefinition);return n.current=t.create("functiongraph",c,{visible:!1}),t.create("integral",[e.boundaryValues,n.current],i)}function f(){r.current&&(t.removeObject(r.current),r.current=null,t.removeObject(n.current),n.current=null)}if(t){if(r.current===null)r.current=m();else if(!e.haveFunction||e.boundaryValues.length!==2||!e.boundaryValues.every(Number.isFinite))f();else{let l=v(e.fDefinition);n.current.Y=l,r.current.visProp.visible=!e.hidden,r.current.visPropCalc.visible=!e.hidden;let[i,c]=e.boundaryValues,[C,R]=e.boundaryValues.map(l);r.current.curveLeft.coords.setCoordinates(JXG.COORDS_BY_USER,[i,C]),r.current.curveRight.coords.setCoordinates(JXG.COORDS_BY_USER,[c,R]);let p=10*e.layer+b;r.current.visProp.layer!==p&&r.current.setAttribute({layer:p});let u=d==="dark"?e.selectedStyle.fillColorDarkMode:e.selectedStyle.fillColor;u=u.toLowerCase(),r.current.visProp.fillcolor!==u&&(r.current.visProp.fillcolor=u),r.current.visProp.fillopacity!==e.selectedStyle.fillOpacity&&(r.current.visProp.fillopacity=e.selectedStyle.fillOpacity),r.current.curveLeft.needsUpdate=!0,r.current.curveLeft.update(),r.current.curveLeft.fullUpdate(),r.current.curveRight.needsUpdate=!0,r.current.curveLeft.update(),r.current.curveRight.fullUpdate(),r.current.needsUpdate=!0,r.current.curveLeft.update(),r.current.fullUpdate(),t.update(),t.fullUpdate(),t.updateRenderer()}return o(y,{children:o("a",{name:s})})}return e.hidden?null:o(y,{children:o("a",{name:s})})});export{P as default}; diff --git a/dist/assets/row-4df1652c.js b/dist/assets/row-010cb0da.js similarity index 84% rename from dist/assets/row-4df1652c.js rename to dist/assets/row-010cb0da.js index 79a16bf04f..560f28402d 100644 --- a/dist/assets/row-4df1652c.js +++ b/dist/assets/row-010cb0da.js @@ -1 +1 @@ -import{av as n,bn as d,j as o}from"./index-61b6fc23.js";const m=n.memo(function(i){let{name:s,id:r,SVs:e,children:l}=d(i);if(e.hidden)return null;let t={};return e.valign!==null&&(t.verticalAlign=e.valign),e.left!=="none"&&(t.borderLeftStyle="solid",e.left==="minor"?t.borderLeftWidth="thin":e.left==="medium"?t.borderLeftWidth="medium":t.borderLeftWidth="thick"),o("tr",{id:r,style:t,children:l})});export{m as default}; +import{av as n,bn as d,j as o}from"./index-9d63439d.js";const m=n.memo(function(i){let{name:s,id:r,SVs:e,children:l}=d(i);if(e.hidden)return null;let t={};return e.valign!==null&&(t.verticalAlign=e.valign),e.left!=="none"&&(t.borderLeftStyle="solid",e.left==="minor"?t.borderLeftWidth="thin":e.left==="medium"?t.borderLeftWidth="medium":t.borderLeftWidth="thick"),o("tr",{id:r,style:t,children:l})});export{m as default}; diff --git a/dist/assets/section-209bdcaa.js b/dist/assets/section-a358b9f5.js similarity index 96% rename from dist/assets/section-209bdcaa.js rename to dist/assets/section-a358b9f5.js index fa4fb8d82f..9ce430555b 100644 --- a/dist/assets/section-209bdcaa.js +++ b/dist/assets/section-a358b9f5.js @@ -1 +1 @@ -import{av as A,bn as S,r as x,a as n,F as m,j as r,i as p,bz as V,b2 as T,bp as _,a0 as I,aP as L,bq as j}from"./index-61b6fc23.js";import{V as g}from"./visibility-sensor-398e690f.js";const F=A.memo(function(R){var C;let{name:P,id:t,SVs:e,children:d,actions:b,callAction:f}=S(R),v=i=>{f({action:b.recordVisibilityChange,args:{isVisible:i}})};if(x.useEffect(()=>()=>{f({action:b.recordVisibilityChange,args:{isVisible:!1}})},[]),e.hidden)return null;let c=x.useRef(null);const B=()=>{c.current="unvalidated",e.justSubmitted&&(e.creditAchieved===1?c.current="correct":e.creditAchieved===0?c.current="incorrect":c.current="partialcorrect")};let k=()=>f({action:b.submitAllAnswers}),a;if(e.titleChildName){for(let[i,h]of d.entries())if(((C=h==null?void 0:h.props)==null?void 0:C.componentInstructions.componentName)===e.titleChildName){a=d[i],d.splice(i,1);break}}a?a=n(m,{children:[e.titlePrefix,a]}):a=e.title;let l=null,s=t+"_title";switch(e.collapsible&&(e.open?a=n(m,{children:[r(p,{icon:V})," ",a," (click to close)"]}):a=n(m,{children:[r(p,{icon:T})," ",a," (click to open)"]})),e.level){case 0:l=r("h1",{id:s,children:a});break;case 1:l=r("h2",{id:s,children:a});break;case 2:l=r("h3",{id:s,children:a});break;case 3:l=r("h4",{id:s,children:a});break;case 4:l=r("h5",{id:s,children:a});break;default:l=r("h6",{id:s,children:a});break}let o=null;if(e.createSubmitAllButton&&!e.suppressCheckwork){B();let i={height:"23px",display:"inline-block",backgroundColor:"var(--mainBlue)",padding:"1px 6px 1px 6px",color:"white",fontWeight:"bold",marginBottom:"30px"},h=e.submitLabel;if(e.showCorrectness||(h=e.submitLabelNoCorrectness),o=n("button",{id:t+"_submit",tabIndex:"0",style:i,onClick:k,onKeyPress:y=>{y.key==="Enter"&&k()},children:[r(p,{icon:_,transform:{rotate:90}})," ",h]}),e.showCorrectness){if(c.current==="correct")i.backgroundColor="var(--mainGreen)",o=n("span",{id:t+"_correct",style:i,children:[r(p,{icon:I}),"  Correct"]});else if(c.current==="incorrect")i.backgroundColor="var(--mainRed)",o=n("span",{id:t+"_incorrect",style:i,children:[r(p,{icon:L}),"  Incorrect"]});else if(c.current==="partialcorrect"){i.backgroundColor="var(--mainYellow)";let w=`${Math.round(e.creditAchieved*100)}% Correct`;o=r("span",{id:t+"_partial",style:i,children:w})}}else c.current!=="unvalidated"&&(i.backgroundColor="var(--mainPurple)",o=n("span",{id:t+"_saved",style:i,children:[r(p,{icon:j}),"  Response Saved"]}));o=r("div",{children:o})}let u=n(m,{children:[r("a",{name:t}),l,d,o]});if(e.collapsible){let i=null;e.open&&(i=n("div",{style:{display:"block",padding:"6px"},children:[d,o]})),u=n("div",{style:{border:"var(--mainBorder)",borderRadius:"var(--mainBorderRadius)"},children:[n("div",{style:{backgroundColor:"var(--mainGray)",cursor:"pointer",padding:"6px",borderBottom:e.open?"var(--mainBorder)":"none",borderTopLeftRadius:"var(--mainBorderRadius)",borderTopRightRadius:"var(--mainBorderRadius)"},onClick:()=>f({action:e.open?b.closeSection:b.revealSection}),children:[r("a",{name:t}),l]}),i]})}else e.boxed&&(u=n("div",{style:{border:"var(--mainBorder)",borderRadius:"var(--mainBorderRadius)"},children:[n("div",{style:{padding:"6px",borderBottom:"var(--mainBorder)",backgroundColor:"var(--mainGray)",borderTopLeftRadius:"var(--mainBorderRadius)",borderTopRightRadius:"var(--mainBorderRadius)"},children:[r("a",{name:t}),l,r("br",{})]}),n("div",{style:{display:"block",padding:"6px"},children:[d,o]})]}));switch(e.containerTag){case"aside":return r(g,{partialVisibility:!0,onChange:v,children:n("aside",{id:t,style:{margin:"12px 0"},children:[" ",u," "]})});case"div":return r(g,{partialVisibility:!0,onChange:v,children:n("div",{id:t,style:{margin:"12px 0"},children:[" ",u," "]})});case"none":return r(m,{children:u});default:return r(g,{partialVisibility:!0,onChange:v,children:n("section",{id:t,style:{margin:"12px 0"},children:[" ",u," "]})})}});export{F as default}; +import{av as A,bn as S,r as x,a as n,F as m,j as r,i as p,bz as V,b2 as T,bp as _,a0 as I,aP as L,bq as j}from"./index-9d63439d.js";import{V as g}from"./visibility-sensor-aefdbbd5.js";const F=A.memo(function(R){var C;let{name:P,id:t,SVs:e,children:d,actions:b,callAction:f}=S(R),v=i=>{f({action:b.recordVisibilityChange,args:{isVisible:i}})};if(x.useEffect(()=>()=>{f({action:b.recordVisibilityChange,args:{isVisible:!1}})},[]),e.hidden)return null;let c=x.useRef(null);const B=()=>{c.current="unvalidated",e.justSubmitted&&(e.creditAchieved===1?c.current="correct":e.creditAchieved===0?c.current="incorrect":c.current="partialcorrect")};let k=()=>f({action:b.submitAllAnswers}),a;if(e.titleChildName){for(let[i,h]of d.entries())if(((C=h==null?void 0:h.props)==null?void 0:C.componentInstructions.componentName)===e.titleChildName){a=d[i],d.splice(i,1);break}}a?a=n(m,{children:[e.titlePrefix,a]}):a=e.title;let l=null,s=t+"_title";switch(e.collapsible&&(e.open?a=n(m,{children:[r(p,{icon:V})," ",a," (click to close)"]}):a=n(m,{children:[r(p,{icon:T})," ",a," (click to open)"]})),e.level){case 0:l=r("h1",{id:s,children:a});break;case 1:l=r("h2",{id:s,children:a});break;case 2:l=r("h3",{id:s,children:a});break;case 3:l=r("h4",{id:s,children:a});break;case 4:l=r("h5",{id:s,children:a});break;default:l=r("h6",{id:s,children:a});break}let o=null;if(e.createSubmitAllButton&&!e.suppressCheckwork){B();let i={height:"23px",display:"inline-block",backgroundColor:"var(--mainBlue)",padding:"1px 6px 1px 6px",color:"white",fontWeight:"bold",marginBottom:"30px"},h=e.submitLabel;if(e.showCorrectness||(h=e.submitLabelNoCorrectness),o=n("button",{id:t+"_submit",tabIndex:"0",style:i,onClick:k,onKeyPress:y=>{y.key==="Enter"&&k()},children:[r(p,{icon:_,transform:{rotate:90}})," ",h]}),e.showCorrectness){if(c.current==="correct")i.backgroundColor="var(--mainGreen)",o=n("span",{id:t+"_correct",style:i,children:[r(p,{icon:I}),"  Correct"]});else if(c.current==="incorrect")i.backgroundColor="var(--mainRed)",o=n("span",{id:t+"_incorrect",style:i,children:[r(p,{icon:L}),"  Incorrect"]});else if(c.current==="partialcorrect"){i.backgroundColor="var(--mainYellow)";let w=`${Math.round(e.creditAchieved*100)}% Correct`;o=r("span",{id:t+"_partial",style:i,children:w})}}else c.current!=="unvalidated"&&(i.backgroundColor="var(--mainPurple)",o=n("span",{id:t+"_saved",style:i,children:[r(p,{icon:j}),"  Response Saved"]}));o=r("div",{children:o})}let u=n(m,{children:[r("a",{name:t}),l,d,o]});if(e.collapsible){let i=null;e.open&&(i=n("div",{style:{display:"block",padding:"6px"},children:[d,o]})),u=n("div",{style:{border:"var(--mainBorder)",borderRadius:"var(--mainBorderRadius)"},children:[n("div",{style:{backgroundColor:"var(--mainGray)",cursor:"pointer",padding:"6px",borderBottom:e.open?"var(--mainBorder)":"none",borderTopLeftRadius:"var(--mainBorderRadius)",borderTopRightRadius:"var(--mainBorderRadius)"},onClick:()=>f({action:e.open?b.closeSection:b.revealSection}),children:[r("a",{name:t}),l]}),i]})}else e.boxed&&(u=n("div",{style:{border:"var(--mainBorder)",borderRadius:"var(--mainBorderRadius)"},children:[n("div",{style:{padding:"6px",borderBottom:"var(--mainBorder)",backgroundColor:"var(--mainGray)",borderTopLeftRadius:"var(--mainBorderRadius)",borderTopRightRadius:"var(--mainBorderRadius)"},children:[r("a",{name:t}),l,r("br",{})]}),n("div",{style:{display:"block",padding:"6px"},children:[d,o]})]}));switch(e.containerTag){case"aside":return r(g,{partialVisibility:!0,onChange:v,children:n("aside",{id:t,style:{margin:"12px 0"},children:[" ",u," "]})});case"div":return r(g,{partialVisibility:!0,onChange:v,children:n("div",{id:t,style:{margin:"12px 0"},children:[" ",u," "]})});case"none":return r(m,{children:u});default:return r(g,{partialVisibility:!0,onChange:v,children:n("section",{id:t,style:{margin:"12px 0"},children:[" ",u," "]})})}});export{F as default}; diff --git a/dist/assets/sideBySide-b357db24.js b/dist/assets/sideBySide-1e910cfa.js similarity index 84% rename from dist/assets/sideBySide-b357db24.js rename to dist/assets/sideBySide-1e910cfa.js index 24da7b45cb..31a058b867 100644 --- a/dist/assets/sideBySide-b357db24.js +++ b/dist/assets/sideBySide-1e910cfa.js @@ -1 +1 @@ -import{av as u,bn as x,r as V,j as t,a as b}from"./index-61b6fc23.js";import{V as C}from"./visibility-sensor-398e690f.js";const L=u.memo(function(g){let{name:S,id:n,SVs:i,children:s,actions:a,callAction:r}=x(g),c=e=>{r({action:a.recordVisibilityChange,args:{isVisible:e}})};if(V.useEffect(()=>()=>{r({action:a.recordVisibilityChange,args:{isVisible:!1}})},[]),i.hidden)return null;let l=[];const f=i.margins[0],m=i.margins[1],p=s.length;for(let[e,d]of s.entries()){let y=i.widths[e],o=f,h=m;e>0&&(o+=i.gapWidth/2),e{r({action:a.recordVisibilityChange,args:{isVisible:e}})};if(V.useEffect(()=>()=>{r({action:a.recordVisibilityChange,args:{isVisible:!1}})},[]),i.hidden)return null;let l=[];const f=i.margins[0],m=i.margins[1],p=s.length;for(let[e,d]of s.entries()){let y=i.widths[e],o=f,h=m;e>0&&(o+=i.gapWidth/2),ese.round_numbers_to_decimals(l,u).tree;const q=z.div` +import{av as ae,bn as ne,r as L,R as re,br as ie,a as T,j as n,s as z,b9 as J,bo as se}from"./index-9d63439d.js";import{A as U}from"./ActionButton-056b08c3.js";import{A as K}from"./ActionButtonGroup-9e9bafb3.js";let A=(l,u)=>se.round_numbers_to_decimals(l,u).tree;const q=z.div` width: fit-content; height: ${l=>l.labeled&&l.noTicked?"60px":l.labeled?"80px":l.noTicked?"40px":"60px"}; margin-bottom: 12px; diff --git a/dist/assets/solution-87ce998d.js b/dist/assets/solution-914435c0.js similarity index 95% rename from dist/assets/solution-87ce998d.js rename to dist/assets/solution-914435c0.js index 6288988e1c..ae5f96c40a 100644 --- a/dist/assets/solution-87ce998d.js +++ b/dist/assets/solution-914435c0.js @@ -1,4 +1,4 @@ -import{av as y,bn as h,r as k,j as t,a as x,s as S,i as u,bA as b}from"./index-61b6fc23.js";import{V as R}from"./visibility-sensor-398e690f.js";const v=S.span` +import{av as y,bn as h,r as k,j as t,a as x,s as S,i as u,bA as b}from"./index-9d63439d.js";import{V as R}from"./visibility-sensor-aefdbbd5.js";const v=S.span` // display: block; // margin: SVs.open ? 12px 4px 0px 4px : 12px 4px 12px 4px; // padding: 6px; diff --git a/dist/assets/spreadsheet-fc3aeca1.js b/dist/assets/spreadsheet-ffaf65b5.js similarity index 99% rename from dist/assets/spreadsheet-fc3aeca1.js rename to dist/assets/spreadsheet-ffaf65b5.js index b5692cdf01..17fad40054 100644 --- a/dist/assets/spreadsheet-fc3aeca1.js +++ b/dist/assets/spreadsheet-ffaf65b5.js @@ -1,4 +1,4 @@ -import{aa as Vp,av as Et,bB as mM,bn as Nj,r as Lj,j as Od,a as jj,bC as Bj}from"./index-61b6fc23.js";import{h as Xe,c as bu,r as Fj}from"./moment-b216ba57.js";import{s as DO}from"./css-14ccef8c.js";import{V as Vj}from"./visibility-sensor-398e690f.js";var wu=function(e){return e&&e.Math==Math&&e},et=wu(typeof globalThis=="object"&&globalThis)||wu(typeof window=="object"&&window)||wu(typeof self=="object"&&self)||wu(typeof Vp=="object"&&Vp)||function(){return this}()||Function("return this")(),nn={},Le=function(e){try{return!!e()}catch{return!0}},Wj=Le,St=!Wj(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),Uj=Le,Ds=!Uj(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),zj=Ds,Su=Function.prototype.call,kt=zj?Su.bind(Su):function(){return Su.apply(Su,arguments)},Hs={},bM={}.propertyIsEnumerable,wM=Object.getOwnPropertyDescriptor,Gj=wM&&!bM.call({1:2},1);Hs.f=Gj?function(t){var r=wM(this,t);return!!r&&r.enumerable}:bM;var Ns=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},SM=Ds,CM=Function.prototype,Wp=CM.call,Yj=SM&&CM.bind.bind(Wp,Wp),_M=SM?Yj:function(e){return function(){return Wp.apply(e,arguments)}},OM=_M,Kj=OM({}.toString),Xj=OM("".slice),Un=function(e){return Xj(Kj(e),8,-1)},qj=Un,Qj=_M,He=function(e){if(qj(e)==="Function")return Qj(e)},Zj=He,Jj=Le,eB=Un,Rd=Object,tB=Zj("".split),Ls=Jj(function(){return!Rd("z").propertyIsEnumerable(0)})?function(e){return eB(e)=="String"?tB(e,""):Rd(e)}:Rd,Nr=function(e){return e==null},rB=Nr,nB=TypeError,rr=function(e){if(rB(e))throw nB("Can't call method on "+e);return e},oB=Ls,iB=rr,dr=function(e){return oB(iB(e))},Up=typeof document=="object"&&document.all,aB=typeof Up>"u"&&Up!==void 0,RM={all:Up,IS_HTMLDDA:aB},EM=RM,lB=EM.all,ut=EM.IS_HTMLDDA?function(e){return typeof e=="function"||e===lB}:function(e){return typeof e=="function"},HO=ut,TM=RM,sB=TM.all,mt=TM.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:HO(e)||e===sB}:function(e){return typeof e=="object"?e!==null:HO(e)},Ed=et,uB=ut,cB=function(e){return uB(e)?e:void 0},on=function(e,t){return arguments.length<2?cB(Ed[e]):Ed[e]&&Ed[e][t]},fB=He,Ro=fB({}.isPrototypeOf),hB=on,Li=hB("navigator","userAgent")||"",kM=et,Td=Li,NO=kM.process,LO=kM.Deno,jO=NO&&NO.versions||LO&&LO.version,BO=jO&&jO.v8,$r,lf;BO&&($r=BO.split("."),lf=$r[0]>0&&$r[0]<4?1:+($r[0]+$r[1]));!lf&&Td&&($r=Td.match(/Edge\/(\d+)/),(!$r||$r[1]>=74)&&($r=Td.match(/Chrome\/(\d+)/),$r&&(lf=+$r[1])));var js=lf,FO=js,dB=Le,sl=!!Object.getOwnPropertySymbols&&!dB(function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&FO&&FO<41}),vB=sl,PM=vB&&!Symbol.sham&&typeof Symbol.iterator=="symbol",pB=on,gB=ut,yB=Ro,mB=PM,bB=Object,Bs=mB?function(e){return typeof e=="symbol"}:function(e){var t=pB("Symbol");return gB(t)&&yB(t.prototype,bB(e))},wB=String,ul=function(e){try{return wB(e)}catch{return"Object"}},SB=ut,CB=ul,_B=TypeError,cl=function(e){if(SB(e))return e;throw _B(CB(e)+" is not a function")},OB=cl,RB=Nr,ji=function(e,t){var r=e[t];return RB(r)?void 0:OB(r)},kd=kt,Pd=ut,Ad=mt,EB=TypeError,TB=function(e,t){var r,n;if(t==="string"&&Pd(r=e.toString)&&!Ad(n=kd(r,e))||Pd(r=e.valueOf)&&!Ad(n=kd(r,e))||t!=="string"&&Pd(r=e.toString)&&!Ad(n=kd(r,e)))return n;throw EB("Can't convert object to primitive value")},_o={},kB={get exports(){return _o},set exports(e){_o=e}},VO=et,PB=Object.defineProperty,gS=function(e,t){try{PB(VO,e,{value:t,configurable:!0,writable:!0})}catch{VO[e]=t}return t},AB=et,IB=gS,WO="__core-js_shared__",$B=AB[WO]||IB(WO,{}),yS=$B,UO=yS;(kB.exports=function(e,t){return UO[e]||(UO[e]=t!==void 0?t:{})})("versions",[]).push({version:"3.26.0",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.26.0/LICENSE",source:"https://github.com/zloirock/core-js"});var MB=rr,xB=Object,nr=function(e){return xB(MB(e))},DB=He,HB=nr,NB=DB({}.hasOwnProperty),bt=Object.hasOwn||function(t,r){return NB(HB(t),r)},LB=He,jB=0,BB=Math.random(),FB=LB(1 .toString),Sh=function(e){return"Symbol("+(e===void 0?"":e)+")_"+FB(++jB+BB,36)},VB=et,WB=_o,zO=bt,UB=Sh,GO=sl,AM=PM,Qi=WB("wks"),wi=VB.Symbol,YO=wi&&wi.for,zB=AM?wi:wi&&wi.withoutSetter||UB,lt=function(e){if(!zO(Qi,e)||!(GO||typeof Qi[e]=="string")){var t="Symbol."+e;GO&&zO(wi,e)?Qi[e]=wi[e]:AM&&YO?Qi[e]=YO(t):Qi[e]=zB(t)}return Qi[e]},GB=kt,KO=mt,XO=Bs,YB=ji,KB=TB,XB=lt,qB=TypeError,QB=XB("toPrimitive"),IM=function(e,t){if(!KO(e)||XO(e))return e;var r=YB(e,QB),n;if(r){if(t===void 0&&(t="default"),n=GB(r,e,t),!KO(n)||XO(n))return n;throw qB("Can't convert object to primitive value")}return t===void 0&&(t="number"),KB(e,t)},ZB=IM,JB=Bs,Ch=function(e){var t=ZB(e,"string");return JB(t)?t:t+""},eF=et,qO=mt,zp=eF.document,tF=qO(zp)&&qO(zp.createElement),_h=function(e){return tF?zp.createElement(e):{}},rF=St,nF=Le,oF=_h,$M=!rF&&!nF(function(){return Object.defineProperty(oF("div"),"a",{get:function(){return 7}}).a!=7}),iF=St,aF=kt,lF=Hs,sF=Ns,uF=dr,cF=Ch,fF=bt,hF=$M,QO=Object.getOwnPropertyDescriptor;nn.f=iF?QO:function(t,r){if(t=uF(t),r=cF(r),hF)try{return QO(t,r)}catch{}if(fF(t,r))return sF(!aF(lF.f,t,r),t[r])};var Nt={},dF=St,vF=Le,MM=dF&&vF(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),pF=mt,gF=String,yF=TypeError,Ct=function(e){if(pF(e))return e;throw yF(gF(e)+" is not an object")},mF=St,bF=$M,wF=MM,Cu=Ct,ZO=Ch,SF=TypeError,Id=Object.defineProperty,CF=Object.getOwnPropertyDescriptor,$d="enumerable",Md="configurable",xd="writable";Nt.f=mF?wF?function(t,r,n){if(Cu(t),r=ZO(r),Cu(n),typeof t=="function"&&r==="prototype"&&"value"in n&&xd in n&&!n[xd]){var o=CF(t,r);o&&o[xd]&&(t[r]=n.value,n={configurable:Md in n?n[Md]:o[Md],enumerable:$d in n?n[$d]:o[$d],writable:!1})}return Id(t,r,n)}:Id:function(t,r,n){if(Cu(t),r=ZO(r),Cu(n),bF)try{return Id(t,r,n)}catch{}if("get"in n||"set"in n)throw SF("Accessors not supported");return"value"in n&&(t[r]=n.value),t};var _F=St,OF=Nt,RF=Ns,Bi=_F?function(e,t,r){return OF.f(e,t,RF(1,r))}:function(e,t,r){return e[t]=r,e},Gp={},EF={get exports(){return Gp},set exports(e){Gp=e}},Yp=St,TF=bt,xM=Function.prototype,kF=Yp&&Object.getOwnPropertyDescriptor,mS=TF(xM,"name"),PF=mS&&function(){}.name==="something",AF=mS&&(!Yp||Yp&&kF(xM,"name").configurable),Fs={EXISTS:mS,PROPER:PF,CONFIGURABLE:AF},IF=He,$F=ut,Kp=yS,MF=IF(Function.toString);$F(Kp.inspectSource)||(Kp.inspectSource=function(e){return MF(e)});var DM=Kp.inspectSource,xF=et,DF=ut,JO=xF.WeakMap,HM=DF(JO)&&/native code/.test(String(JO)),HF=_o,NF=Sh,eR=HF("keys"),Oh=function(e){return eR[e]||(eR[e]=NF(e))},Vs={},LF=HM,NM=et,jF=mt,BF=Bi,Dd=bt,Hd=yS,FF=Oh,VF=Vs,tR="Object already initialized",Xp=NM.TypeError,WF=NM.WeakMap,sf,vs,uf,UF=function(e){return uf(e)?vs(e):sf(e,{})},zF=function(e){return function(t){var r;if(!jF(t)||(r=vs(t)).type!==e)throw Xp("Incompatible receiver, "+e+" required");return r}};if(LF||Hd.state){var jr=Hd.state||(Hd.state=new WF);jr.get=jr.get,jr.has=jr.has,jr.set=jr.set,sf=function(e,t){if(jr.has(e))throw Xp(tR);return t.facade=e,jr.set(e,t),t},vs=function(e){return jr.get(e)||{}},uf=function(e){return jr.has(e)}}else{var Zi=FF("state");VF[Zi]=!0,sf=function(e,t){if(Dd(e,Zi))throw Xp(tR);return t.facade=e,BF(e,Zi,t),t},vs=function(e){return Dd(e,Zi)?e[Zi]:{}},uf=function(e){return Dd(e,Zi)}}var zn={set:sf,get:vs,has:uf,enforce:UF,getterFor:zF},GF=Le,YF=ut,_u=bt,qp=St,KF=Fs.CONFIGURABLE,XF=DM,LM=zn,qF=LM.enforce,QF=LM.get,Cc=Object.defineProperty,ZF=qp&&!GF(function(){return Cc(function(){},"length",{value:8}).length!==8}),JF=String(String).split("String"),eV=EF.exports=function(e,t,r){String(t).slice(0,7)==="Symbol("&&(t="["+String(t).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!_u(e,"name")||KF&&e.name!==t)&&(qp?Cc(e,"name",{value:t,configurable:!0}):e.name=t),ZF&&r&&_u(r,"arity")&&e.length!==r.arity&&Cc(e,"length",{value:r.arity});try{r&&_u(r,"constructor")&&r.constructor?qp&&Cc(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch{}var n=qF(e);return _u(n,"source")||(n.source=JF.join(typeof t=="string"?t:"")),e};Function.prototype.toString=eV(function(){return YF(this)&&QF(this).source||XF(this)},"toString");var tV=ut,rV=Nt,nV=Gp,oV=gS,_r=function(e,t,r,n){n||(n={});var o=n.enumerable,i=n.name!==void 0?n.name:t;if(tV(r)&&nV(r,i,n),n.global)o?e[t]=r:oV(t,r);else{try{n.unsafe?e[t]&&(o=!0):delete e[t]}catch{}o?e[t]=r:rV.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e},Fi={},iV=Math.ceil,aV=Math.floor,lV=Math.trunc||function(t){var r=+t;return(r>0?aV:iV)(r)},sV=lV,Eo=function(e){var t=+e;return t!==t||t===0?0:sV(t)},uV=Eo,cV=Math.max,fV=Math.min,Ws=function(e,t){var r=uV(e);return r<0?cV(r+t,0):fV(r,t)},hV=Eo,dV=Math.min,Vi=function(e){return e>0?dV(hV(e),9007199254740991):0},vV=Vi,Or=function(e){return vV(e.length)},pV=dr,gV=Ws,yV=Or,rR=function(e){return function(t,r,n){var o=pV(t),i=yV(o),a=gV(n,i),l;if(e&&r!=r){for(;i>a;)if(l=o[a++],l!=l)return!0}else for(;i>a;a++)if((e||a in o)&&o[a]===r)return e||a||0;return!e&&-1}},bS={includes:rR(!0),indexOf:rR(!1)},mV=He,Nd=bt,bV=dr,wV=bS.indexOf,SV=Vs,nR=mV([].push),jM=function(e,t){var r=bV(e),n=0,o=[],i;for(i in r)!Nd(SV,i)&&Nd(r,i)&&nR(o,i);for(;t.length>n;)Nd(r,i=t[n++])&&(~wV(o,i)||nR(o,i));return o},wS=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],CV=jM,_V=wS,OV=_V.concat("length","prototype");Fi.f=Object.getOwnPropertyNames||function(t){return CV(t,OV)};var Us={};Us.f=Object.getOwnPropertySymbols;var RV=on,EV=He,TV=Fi,kV=Us,PV=Ct,AV=EV([].concat),BM=RV("Reflect","ownKeys")||function(t){var r=TV.f(PV(t)),n=kV.f;return n?AV(r,n(t)):r},oR=bt,IV=BM,$V=nn,MV=Nt,FM=function(e,t,r){for(var n=IV(t),o=MV.f,i=$V.f,a=0;aa;)uW.f(t,l=o[a++],n[l]);return t};var dW=on,UM=dW("document","documentElement"),vW=Ct,pW=SS,aR=wS,gW=Vs,yW=UM,mW=_h,bW=Oh,lR=">",sR="<",Zp="prototype",Jp="script",zM=bW("IE_PROTO"),jd=function(){},GM=function(e){return sR+Jp+lR+e+sR+"/"+Jp+lR},uR=function(e){e.write(GM("")),e.close();var t=e.parentWindow.Object;return e=null,t},wW=function(){var e=mW("iframe"),t="java"+Jp+":",r;return e.style.display="none",yW.appendChild(e),e.src=String(t),r=e.contentWindow.document,r.open(),r.write(GM("document.F=Object")),r.close(),r.F},Ou,_c=function(){try{Ou=new ActiveXObject("htmlfile")}catch{}_c=typeof document<"u"?document.domain&&Ou?uR(Ou):wW():uR(Ou);for(var e=aR.length;e--;)delete _c[Zp][aR[e]];return _c()};gW[zM]=!0;var fl=Object.create||function(t,r){var n;return t!==null?(jd[Zp]=vW(t),n=new jd,jd[Zp]=null,n[zM]=t):n=_c(),r===void 0?n:pW.f(n,r)},SW=lt,CW=fl,_W=Nt.f,eg=SW("unscopables"),tg=Array.prototype;tg[eg]==null&&_W(tg,eg,{configurable:!0,value:CW(null)});var Ys=function(e){tg[eg][e]=!0},OW=Ae,RW=bS.includes,EW=Le,TW=Ys,kW=EW(function(){return!Array(1).includes()});OW({target:"Array",proto:!0,forced:kW},{includes:function(t){return RW(this,t,arguments.length>1?arguments[1]:void 0)}});TW("includes");var PW=mt,AW=Un,IW=lt,$W=IW("match"),CS=function(e){var t;return PW(e)&&((t=e[$W])!==void 0?!!t:AW(e)=="RegExp")},MW=CS,xW=TypeError,_S=function(e){if(MW(e))throw xW("The method doesn't accept regular expressions");return e},DW=lt,HW=DW("toStringTag"),YM={};YM[HW]="z";var OS=String(YM)==="[object z]",NW=OS,LW=ut,Oc=Un,jW=lt,BW=jW("toStringTag"),FW=Object,VW=Oc(function(){return arguments}())=="Arguments",WW=function(e,t){try{return e[t]}catch{}},Th=NW?Oc:function(e){var t,r,n;return e===void 0?"Undefined":e===null?"Null":typeof(r=WW(t=FW(e),BW))=="string"?r:VW?Oc(t):(n=Oc(t))=="Object"&&LW(t.callee)?"Arguments":n},UW=Th,zW=String,Pt=function(e){if(UW(e)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return zW(e)},GW=lt,YW=GW("match"),RS=function(e){var t=/./;try{"/./"[e](t)}catch{try{return t[YW]=!1,"/./"[e](t)}catch{}}return!1},KW=Ae,XW=He,qW=_S,QW=rr,cR=Pt,ZW=RS,JW=XW("".indexOf);KW({target:"String",proto:!0,forced:!ZW("includes")},{includes:function(t){return!!~JW(cR(QW(this)),cR(qW(t)),arguments.length>1?arguments[1]:void 0)}});var eU=Un,hl=Array.isArray||function(t){return eU(t)=="Array"},tU=He,rU=Le,KM=ut,nU=Th,oU=on,iU=DM,XM=function(){},aU=[],qM=oU("Reflect","construct"),ES=/^\s*(?:class|function)\b/,lU=tU(ES.exec),sU=!ES.exec(XM),Sl=function(t){if(!KM(t))return!1;try{return qM(XM,aU,t),!0}catch{return!1}},QM=function(t){if(!KM(t))return!1;switch(nU(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return sU||!!lU(ES,iU(t))}catch{return!0}};QM.sham=!0;var kh=!qM||rU(function(){var e;return Sl(Sl.call)||!Sl(Object)||!Sl(function(){e=!0})||e})?QM:Sl,uU=Ch,cU=Nt,fU=Ns,dl=function(e,t,r){var n=uU(t);n in e?cU.f(e,n,fU(0,r)):e[n]=r},hU=Le,dU=lt,vU=js,pU=dU("species"),Ks=function(e){return vU>=51||!hU(function(){var t=[],r=t.constructor={};return r[pU]=function(){return{foo:1}},t[e](Boolean).foo!==1})},gU=He,Xs=gU([].slice),yU=Ae,fR=hl,mU=kh,bU=mt,hR=Ws,wU=Or,SU=dr,CU=dl,_U=lt,OU=Ks,RU=Xs,EU=OU("slice"),TU=_U("species"),Bd=Array,kU=Math.max;yU({target:"Array",proto:!0,forced:!EU},{slice:function(t,r){var n=SU(this),o=wU(n),i=hR(t,o),a=hR(r===void 0?o:r,o),l,s,u;if(fR(n)&&(l=n.constructor,mU(l)&&(l===Bd||fR(l.prototype))?l=void 0:bU(l)&&(l=l[TU],l===null&&(l=void 0)),l===Bd||l===void 0))return RU(n,i,a);for(s=new(l===void 0?Bd:l)(kU(a-i,0)),u=0;i1?arguments[1]:void 0;return dR?rg(this,t,r)||0:$U(this,t,r)}});var vR=He,DU=cl,HU=Ds,NU=vR(vR.bind),qs=function(e,t){return DU(e),t===void 0?e:HU?NU(e,t):function(){return e.apply(t,arguments)}},pR=hl,LU=kh,jU=mt,BU=lt,FU=BU("species"),gR=Array,VU=function(e){var t;return pR(e)&&(t=e.constructor,LU(t)&&(t===gR||pR(t.prototype))?t=void 0:jU(t)&&(t=t[FU],t===null&&(t=void 0))),t===void 0?gR:t},WU=VU,TS=function(e,t){return new(WU(e))(t===0?0:t)},UU=qs,zU=He,GU=Ls,YU=nr,KU=Or,XU=TS,yR=zU([].push),Yn=function(e){var t=e==1,r=e==2,n=e==3,o=e==4,i=e==6,a=e==7,l=e==5||i;return function(s,u,c,f){for(var h=YU(s),d=GU(h),v=UU(u,c),g=KU(d),y=0,w=f||XU,C=t?w(s,g):r||a?w(s,0):void 0,_,I;g>y;y++)if((l||y in d)&&(_=d[y],I=v(_,y,h),e))if(t)C[y]=I;else if(I)switch(e){case 3:return!0;case 5:return _;case 6:return y;case 2:yR(C,_)}else switch(e){case 4:return!1;case 7:yR(C,_)}return i?-1:n||o?o:C}},Wi={forEach:Yn(0),map:Yn(1),filter:Yn(2),some:Yn(3),every:Yn(4),find:Yn(5),findIndex:Yn(6),filterReject:Yn(7)},qU=Ae,QU=Wi.filter,ZU=Ks,JU=ZU("filter");qU({target:"Array",proto:!0,forced:!JU},{filter:function(t){return QU(this,t,arguments.length>1?arguments[1]:void 0)}});var e2=OS,t2=Th,r2=e2?{}.toString:function(){return"[object "+t2(this)+"]"},n2=OS,o2=_r,i2=r2;n2||o2(Object.prototype,"toString",i2,{unsafe:!0});var a2=ut,l2=String,s2=TypeError,u2=function(e){if(typeof e=="object"||a2(e))return e;throw s2("Can't set "+l2(e)+" as a prototype")},c2=He,f2=Ct,h2=u2,kS=Object.setPrototypeOf||("__proto__"in{}?function(){var e=!1,t={},r;try{r=c2(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),r(t,[]),e=t instanceof Array}catch{}return function(o,i){return f2(o),h2(i),e?r(o,i):o.__proto__=i,o}}():void 0),d2=ut,v2=mt,mR=kS,PS=function(e,t,r){var n,o;return mR&&d2(n=t.constructor)&&n!==r&&v2(o=n.prototype)&&o!==r.prototype&&mR(e,o),e},p2=Ct,ZM=function(){var e=p2(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},g2=kt,y2=bt,m2=Ro,b2=ZM,bR=RegExp.prototype,JM=function(e){var t=e.flags;return t===void 0&&!("flags"in bR)&&!y2(e,"flags")&&m2(bR,e)?g2(b2,e):t},AS=Le,w2=et,IS=w2.RegExp,$S=AS(function(){var e=IS("a","y");return e.lastIndex=2,e.exec("abcd")!=null}),S2=$S||AS(function(){return!IS("a","y").sticky}),C2=$S||AS(function(){var e=IS("^r","gy");return e.lastIndex=2,e.exec("str")!=null}),MS={BROKEN_CARET:C2,MISSED_STICKY:S2,UNSUPPORTED_Y:$S},_2=Nt.f,O2=function(e,t,r){r in e||_2(e,r,{configurable:!0,get:function(){return t[r]},set:function(n){t[r]=n}})},R2=on,E2=Nt,T2=lt,k2=St,wR=T2("species"),ex=function(e){var t=R2(e),r=E2.f;k2&&t&&!t[wR]&&r(t,wR,{configurable:!0,get:function(){return this}})},P2=Le,A2=et,I2=A2.RegExp,tx=P2(function(){var e=I2(".","s");return!(e.dotAll&&e.exec(` +import{aa as Vp,av as Et,bB as mM,bn as Nj,r as Lj,j as Od,a as jj,bC as Bj}from"./index-9d63439d.js";import{h as Xe,c as bu,r as Fj}from"./moment-a2107d39.js";import{s as DO}from"./css-14ccef8c.js";import{V as Vj}from"./visibility-sensor-aefdbbd5.js";var wu=function(e){return e&&e.Math==Math&&e},et=wu(typeof globalThis=="object"&&globalThis)||wu(typeof window=="object"&&window)||wu(typeof self=="object"&&self)||wu(typeof Vp=="object"&&Vp)||function(){return this}()||Function("return this")(),nn={},Le=function(e){try{return!!e()}catch{return!0}},Wj=Le,St=!Wj(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),Uj=Le,Ds=!Uj(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),zj=Ds,Su=Function.prototype.call,kt=zj?Su.bind(Su):function(){return Su.apply(Su,arguments)},Hs={},bM={}.propertyIsEnumerable,wM=Object.getOwnPropertyDescriptor,Gj=wM&&!bM.call({1:2},1);Hs.f=Gj?function(t){var r=wM(this,t);return!!r&&r.enumerable}:bM;var Ns=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}},SM=Ds,CM=Function.prototype,Wp=CM.call,Yj=SM&&CM.bind.bind(Wp,Wp),_M=SM?Yj:function(e){return function(){return Wp.apply(e,arguments)}},OM=_M,Kj=OM({}.toString),Xj=OM("".slice),Un=function(e){return Xj(Kj(e),8,-1)},qj=Un,Qj=_M,He=function(e){if(qj(e)==="Function")return Qj(e)},Zj=He,Jj=Le,eB=Un,Rd=Object,tB=Zj("".split),Ls=Jj(function(){return!Rd("z").propertyIsEnumerable(0)})?function(e){return eB(e)=="String"?tB(e,""):Rd(e)}:Rd,Nr=function(e){return e==null},rB=Nr,nB=TypeError,rr=function(e){if(rB(e))throw nB("Can't call method on "+e);return e},oB=Ls,iB=rr,dr=function(e){return oB(iB(e))},Up=typeof document=="object"&&document.all,aB=typeof Up>"u"&&Up!==void 0,RM={all:Up,IS_HTMLDDA:aB},EM=RM,lB=EM.all,ut=EM.IS_HTMLDDA?function(e){return typeof e=="function"||e===lB}:function(e){return typeof e=="function"},HO=ut,TM=RM,sB=TM.all,mt=TM.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:HO(e)||e===sB}:function(e){return typeof e=="object"?e!==null:HO(e)},Ed=et,uB=ut,cB=function(e){return uB(e)?e:void 0},on=function(e,t){return arguments.length<2?cB(Ed[e]):Ed[e]&&Ed[e][t]},fB=He,Ro=fB({}.isPrototypeOf),hB=on,Li=hB("navigator","userAgent")||"",kM=et,Td=Li,NO=kM.process,LO=kM.Deno,jO=NO&&NO.versions||LO&&LO.version,BO=jO&&jO.v8,$r,lf;BO&&($r=BO.split("."),lf=$r[0]>0&&$r[0]<4?1:+($r[0]+$r[1]));!lf&&Td&&($r=Td.match(/Edge\/(\d+)/),(!$r||$r[1]>=74)&&($r=Td.match(/Chrome\/(\d+)/),$r&&(lf=+$r[1])));var js=lf,FO=js,dB=Le,sl=!!Object.getOwnPropertySymbols&&!dB(function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&FO&&FO<41}),vB=sl,PM=vB&&!Symbol.sham&&typeof Symbol.iterator=="symbol",pB=on,gB=ut,yB=Ro,mB=PM,bB=Object,Bs=mB?function(e){return typeof e=="symbol"}:function(e){var t=pB("Symbol");return gB(t)&&yB(t.prototype,bB(e))},wB=String,ul=function(e){try{return wB(e)}catch{return"Object"}},SB=ut,CB=ul,_B=TypeError,cl=function(e){if(SB(e))return e;throw _B(CB(e)+" is not a function")},OB=cl,RB=Nr,ji=function(e,t){var r=e[t];return RB(r)?void 0:OB(r)},kd=kt,Pd=ut,Ad=mt,EB=TypeError,TB=function(e,t){var r,n;if(t==="string"&&Pd(r=e.toString)&&!Ad(n=kd(r,e))||Pd(r=e.valueOf)&&!Ad(n=kd(r,e))||t!=="string"&&Pd(r=e.toString)&&!Ad(n=kd(r,e)))return n;throw EB("Can't convert object to primitive value")},_o={},kB={get exports(){return _o},set exports(e){_o=e}},VO=et,PB=Object.defineProperty,gS=function(e,t){try{PB(VO,e,{value:t,configurable:!0,writable:!0})}catch{VO[e]=t}return t},AB=et,IB=gS,WO="__core-js_shared__",$B=AB[WO]||IB(WO,{}),yS=$B,UO=yS;(kB.exports=function(e,t){return UO[e]||(UO[e]=t!==void 0?t:{})})("versions",[]).push({version:"3.26.0",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.26.0/LICENSE",source:"https://github.com/zloirock/core-js"});var MB=rr,xB=Object,nr=function(e){return xB(MB(e))},DB=He,HB=nr,NB=DB({}.hasOwnProperty),bt=Object.hasOwn||function(t,r){return NB(HB(t),r)},LB=He,jB=0,BB=Math.random(),FB=LB(1 .toString),Sh=function(e){return"Symbol("+(e===void 0?"":e)+")_"+FB(++jB+BB,36)},VB=et,WB=_o,zO=bt,UB=Sh,GO=sl,AM=PM,Qi=WB("wks"),wi=VB.Symbol,YO=wi&&wi.for,zB=AM?wi:wi&&wi.withoutSetter||UB,lt=function(e){if(!zO(Qi,e)||!(GO||typeof Qi[e]=="string")){var t="Symbol."+e;GO&&zO(wi,e)?Qi[e]=wi[e]:AM&&YO?Qi[e]=YO(t):Qi[e]=zB(t)}return Qi[e]},GB=kt,KO=mt,XO=Bs,YB=ji,KB=TB,XB=lt,qB=TypeError,QB=XB("toPrimitive"),IM=function(e,t){if(!KO(e)||XO(e))return e;var r=YB(e,QB),n;if(r){if(t===void 0&&(t="default"),n=GB(r,e,t),!KO(n)||XO(n))return n;throw qB("Can't convert object to primitive value")}return t===void 0&&(t="number"),KB(e,t)},ZB=IM,JB=Bs,Ch=function(e){var t=ZB(e,"string");return JB(t)?t:t+""},eF=et,qO=mt,zp=eF.document,tF=qO(zp)&&qO(zp.createElement),_h=function(e){return tF?zp.createElement(e):{}},rF=St,nF=Le,oF=_h,$M=!rF&&!nF(function(){return Object.defineProperty(oF("div"),"a",{get:function(){return 7}}).a!=7}),iF=St,aF=kt,lF=Hs,sF=Ns,uF=dr,cF=Ch,fF=bt,hF=$M,QO=Object.getOwnPropertyDescriptor;nn.f=iF?QO:function(t,r){if(t=uF(t),r=cF(r),hF)try{return QO(t,r)}catch{}if(fF(t,r))return sF(!aF(lF.f,t,r),t[r])};var Nt={},dF=St,vF=Le,MM=dF&&vF(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),pF=mt,gF=String,yF=TypeError,Ct=function(e){if(pF(e))return e;throw yF(gF(e)+" is not an object")},mF=St,bF=$M,wF=MM,Cu=Ct,ZO=Ch,SF=TypeError,Id=Object.defineProperty,CF=Object.getOwnPropertyDescriptor,$d="enumerable",Md="configurable",xd="writable";Nt.f=mF?wF?function(t,r,n){if(Cu(t),r=ZO(r),Cu(n),typeof t=="function"&&r==="prototype"&&"value"in n&&xd in n&&!n[xd]){var o=CF(t,r);o&&o[xd]&&(t[r]=n.value,n={configurable:Md in n?n[Md]:o[Md],enumerable:$d in n?n[$d]:o[$d],writable:!1})}return Id(t,r,n)}:Id:function(t,r,n){if(Cu(t),r=ZO(r),Cu(n),bF)try{return Id(t,r,n)}catch{}if("get"in n||"set"in n)throw SF("Accessors not supported");return"value"in n&&(t[r]=n.value),t};var _F=St,OF=Nt,RF=Ns,Bi=_F?function(e,t,r){return OF.f(e,t,RF(1,r))}:function(e,t,r){return e[t]=r,e},Gp={},EF={get exports(){return Gp},set exports(e){Gp=e}},Yp=St,TF=bt,xM=Function.prototype,kF=Yp&&Object.getOwnPropertyDescriptor,mS=TF(xM,"name"),PF=mS&&function(){}.name==="something",AF=mS&&(!Yp||Yp&&kF(xM,"name").configurable),Fs={EXISTS:mS,PROPER:PF,CONFIGURABLE:AF},IF=He,$F=ut,Kp=yS,MF=IF(Function.toString);$F(Kp.inspectSource)||(Kp.inspectSource=function(e){return MF(e)});var DM=Kp.inspectSource,xF=et,DF=ut,JO=xF.WeakMap,HM=DF(JO)&&/native code/.test(String(JO)),HF=_o,NF=Sh,eR=HF("keys"),Oh=function(e){return eR[e]||(eR[e]=NF(e))},Vs={},LF=HM,NM=et,jF=mt,BF=Bi,Dd=bt,Hd=yS,FF=Oh,VF=Vs,tR="Object already initialized",Xp=NM.TypeError,WF=NM.WeakMap,sf,vs,uf,UF=function(e){return uf(e)?vs(e):sf(e,{})},zF=function(e){return function(t){var r;if(!jF(t)||(r=vs(t)).type!==e)throw Xp("Incompatible receiver, "+e+" required");return r}};if(LF||Hd.state){var jr=Hd.state||(Hd.state=new WF);jr.get=jr.get,jr.has=jr.has,jr.set=jr.set,sf=function(e,t){if(jr.has(e))throw Xp(tR);return t.facade=e,jr.set(e,t),t},vs=function(e){return jr.get(e)||{}},uf=function(e){return jr.has(e)}}else{var Zi=FF("state");VF[Zi]=!0,sf=function(e,t){if(Dd(e,Zi))throw Xp(tR);return t.facade=e,BF(e,Zi,t),t},vs=function(e){return Dd(e,Zi)?e[Zi]:{}},uf=function(e){return Dd(e,Zi)}}var zn={set:sf,get:vs,has:uf,enforce:UF,getterFor:zF},GF=Le,YF=ut,_u=bt,qp=St,KF=Fs.CONFIGURABLE,XF=DM,LM=zn,qF=LM.enforce,QF=LM.get,Cc=Object.defineProperty,ZF=qp&&!GF(function(){return Cc(function(){},"length",{value:8}).length!==8}),JF=String(String).split("String"),eV=EF.exports=function(e,t,r){String(t).slice(0,7)==="Symbol("&&(t="["+String(t).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!_u(e,"name")||KF&&e.name!==t)&&(qp?Cc(e,"name",{value:t,configurable:!0}):e.name=t),ZF&&r&&_u(r,"arity")&&e.length!==r.arity&&Cc(e,"length",{value:r.arity});try{r&&_u(r,"constructor")&&r.constructor?qp&&Cc(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch{}var n=qF(e);return _u(n,"source")||(n.source=JF.join(typeof t=="string"?t:"")),e};Function.prototype.toString=eV(function(){return YF(this)&&QF(this).source||XF(this)},"toString");var tV=ut,rV=Nt,nV=Gp,oV=gS,_r=function(e,t,r,n){n||(n={});var o=n.enumerable,i=n.name!==void 0?n.name:t;if(tV(r)&&nV(r,i,n),n.global)o?e[t]=r:oV(t,r);else{try{n.unsafe?e[t]&&(o=!0):delete e[t]}catch{}o?e[t]=r:rV.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e},Fi={},iV=Math.ceil,aV=Math.floor,lV=Math.trunc||function(t){var r=+t;return(r>0?aV:iV)(r)},sV=lV,Eo=function(e){var t=+e;return t!==t||t===0?0:sV(t)},uV=Eo,cV=Math.max,fV=Math.min,Ws=function(e,t){var r=uV(e);return r<0?cV(r+t,0):fV(r,t)},hV=Eo,dV=Math.min,Vi=function(e){return e>0?dV(hV(e),9007199254740991):0},vV=Vi,Or=function(e){return vV(e.length)},pV=dr,gV=Ws,yV=Or,rR=function(e){return function(t,r,n){var o=pV(t),i=yV(o),a=gV(n,i),l;if(e&&r!=r){for(;i>a;)if(l=o[a++],l!=l)return!0}else for(;i>a;a++)if((e||a in o)&&o[a]===r)return e||a||0;return!e&&-1}},bS={includes:rR(!0),indexOf:rR(!1)},mV=He,Nd=bt,bV=dr,wV=bS.indexOf,SV=Vs,nR=mV([].push),jM=function(e,t){var r=bV(e),n=0,o=[],i;for(i in r)!Nd(SV,i)&&Nd(r,i)&&nR(o,i);for(;t.length>n;)Nd(r,i=t[n++])&&(~wV(o,i)||nR(o,i));return o},wS=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],CV=jM,_V=wS,OV=_V.concat("length","prototype");Fi.f=Object.getOwnPropertyNames||function(t){return CV(t,OV)};var Us={};Us.f=Object.getOwnPropertySymbols;var RV=on,EV=He,TV=Fi,kV=Us,PV=Ct,AV=EV([].concat),BM=RV("Reflect","ownKeys")||function(t){var r=TV.f(PV(t)),n=kV.f;return n?AV(r,n(t)):r},oR=bt,IV=BM,$V=nn,MV=Nt,FM=function(e,t,r){for(var n=IV(t),o=MV.f,i=$V.f,a=0;aa;)uW.f(t,l=o[a++],n[l]);return t};var dW=on,UM=dW("document","documentElement"),vW=Ct,pW=SS,aR=wS,gW=Vs,yW=UM,mW=_h,bW=Oh,lR=">",sR="<",Zp="prototype",Jp="script",zM=bW("IE_PROTO"),jd=function(){},GM=function(e){return sR+Jp+lR+e+sR+"/"+Jp+lR},uR=function(e){e.write(GM("")),e.close();var t=e.parentWindow.Object;return e=null,t},wW=function(){var e=mW("iframe"),t="java"+Jp+":",r;return e.style.display="none",yW.appendChild(e),e.src=String(t),r=e.contentWindow.document,r.open(),r.write(GM("document.F=Object")),r.close(),r.F},Ou,_c=function(){try{Ou=new ActiveXObject("htmlfile")}catch{}_c=typeof document<"u"?document.domain&&Ou?uR(Ou):wW():uR(Ou);for(var e=aR.length;e--;)delete _c[Zp][aR[e]];return _c()};gW[zM]=!0;var fl=Object.create||function(t,r){var n;return t!==null?(jd[Zp]=vW(t),n=new jd,jd[Zp]=null,n[zM]=t):n=_c(),r===void 0?n:pW.f(n,r)},SW=lt,CW=fl,_W=Nt.f,eg=SW("unscopables"),tg=Array.prototype;tg[eg]==null&&_W(tg,eg,{configurable:!0,value:CW(null)});var Ys=function(e){tg[eg][e]=!0},OW=Ae,RW=bS.includes,EW=Le,TW=Ys,kW=EW(function(){return!Array(1).includes()});OW({target:"Array",proto:!0,forced:kW},{includes:function(t){return RW(this,t,arguments.length>1?arguments[1]:void 0)}});TW("includes");var PW=mt,AW=Un,IW=lt,$W=IW("match"),CS=function(e){var t;return PW(e)&&((t=e[$W])!==void 0?!!t:AW(e)=="RegExp")},MW=CS,xW=TypeError,_S=function(e){if(MW(e))throw xW("The method doesn't accept regular expressions");return e},DW=lt,HW=DW("toStringTag"),YM={};YM[HW]="z";var OS=String(YM)==="[object z]",NW=OS,LW=ut,Oc=Un,jW=lt,BW=jW("toStringTag"),FW=Object,VW=Oc(function(){return arguments}())=="Arguments",WW=function(e,t){try{return e[t]}catch{}},Th=NW?Oc:function(e){var t,r,n;return e===void 0?"Undefined":e===null?"Null":typeof(r=WW(t=FW(e),BW))=="string"?r:VW?Oc(t):(n=Oc(t))=="Object"&&LW(t.callee)?"Arguments":n},UW=Th,zW=String,Pt=function(e){if(UW(e)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return zW(e)},GW=lt,YW=GW("match"),RS=function(e){var t=/./;try{"/./"[e](t)}catch{try{return t[YW]=!1,"/./"[e](t)}catch{}}return!1},KW=Ae,XW=He,qW=_S,QW=rr,cR=Pt,ZW=RS,JW=XW("".indexOf);KW({target:"String",proto:!0,forced:!ZW("includes")},{includes:function(t){return!!~JW(cR(QW(this)),cR(qW(t)),arguments.length>1?arguments[1]:void 0)}});var eU=Un,hl=Array.isArray||function(t){return eU(t)=="Array"},tU=He,rU=Le,KM=ut,nU=Th,oU=on,iU=DM,XM=function(){},aU=[],qM=oU("Reflect","construct"),ES=/^\s*(?:class|function)\b/,lU=tU(ES.exec),sU=!ES.exec(XM),Sl=function(t){if(!KM(t))return!1;try{return qM(XM,aU,t),!0}catch{return!1}},QM=function(t){if(!KM(t))return!1;switch(nU(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return sU||!!lU(ES,iU(t))}catch{return!0}};QM.sham=!0;var kh=!qM||rU(function(){var e;return Sl(Sl.call)||!Sl(Object)||!Sl(function(){e=!0})||e})?QM:Sl,uU=Ch,cU=Nt,fU=Ns,dl=function(e,t,r){var n=uU(t);n in e?cU.f(e,n,fU(0,r)):e[n]=r},hU=Le,dU=lt,vU=js,pU=dU("species"),Ks=function(e){return vU>=51||!hU(function(){var t=[],r=t.constructor={};return r[pU]=function(){return{foo:1}},t[e](Boolean).foo!==1})},gU=He,Xs=gU([].slice),yU=Ae,fR=hl,mU=kh,bU=mt,hR=Ws,wU=Or,SU=dr,CU=dl,_U=lt,OU=Ks,RU=Xs,EU=OU("slice"),TU=_U("species"),Bd=Array,kU=Math.max;yU({target:"Array",proto:!0,forced:!EU},{slice:function(t,r){var n=SU(this),o=wU(n),i=hR(t,o),a=hR(r===void 0?o:r,o),l,s,u;if(fR(n)&&(l=n.constructor,mU(l)&&(l===Bd||fR(l.prototype))?l=void 0:bU(l)&&(l=l[TU],l===null&&(l=void 0)),l===Bd||l===void 0))return RU(n,i,a);for(s=new(l===void 0?Bd:l)(kU(a-i,0)),u=0;i1?arguments[1]:void 0;return dR?rg(this,t,r)||0:$U(this,t,r)}});var vR=He,DU=cl,HU=Ds,NU=vR(vR.bind),qs=function(e,t){return DU(e),t===void 0?e:HU?NU(e,t):function(){return e.apply(t,arguments)}},pR=hl,LU=kh,jU=mt,BU=lt,FU=BU("species"),gR=Array,VU=function(e){var t;return pR(e)&&(t=e.constructor,LU(t)&&(t===gR||pR(t.prototype))?t=void 0:jU(t)&&(t=t[FU],t===null&&(t=void 0))),t===void 0?gR:t},WU=VU,TS=function(e,t){return new(WU(e))(t===0?0:t)},UU=qs,zU=He,GU=Ls,YU=nr,KU=Or,XU=TS,yR=zU([].push),Yn=function(e){var t=e==1,r=e==2,n=e==3,o=e==4,i=e==6,a=e==7,l=e==5||i;return function(s,u,c,f){for(var h=YU(s),d=GU(h),v=UU(u,c),g=KU(d),y=0,w=f||XU,C=t?w(s,g):r||a?w(s,0):void 0,_,I;g>y;y++)if((l||y in d)&&(_=d[y],I=v(_,y,h),e))if(t)C[y]=I;else if(I)switch(e){case 3:return!0;case 5:return _;case 6:return y;case 2:yR(C,_)}else switch(e){case 4:return!1;case 7:yR(C,_)}return i?-1:n||o?o:C}},Wi={forEach:Yn(0),map:Yn(1),filter:Yn(2),some:Yn(3),every:Yn(4),find:Yn(5),findIndex:Yn(6),filterReject:Yn(7)},qU=Ae,QU=Wi.filter,ZU=Ks,JU=ZU("filter");qU({target:"Array",proto:!0,forced:!JU},{filter:function(t){return QU(this,t,arguments.length>1?arguments[1]:void 0)}});var e2=OS,t2=Th,r2=e2?{}.toString:function(){return"[object "+t2(this)+"]"},n2=OS,o2=_r,i2=r2;n2||o2(Object.prototype,"toString",i2,{unsafe:!0});var a2=ut,l2=String,s2=TypeError,u2=function(e){if(typeof e=="object"||a2(e))return e;throw s2("Can't set "+l2(e)+" as a prototype")},c2=He,f2=Ct,h2=u2,kS=Object.setPrototypeOf||("__proto__"in{}?function(){var e=!1,t={},r;try{r=c2(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),r(t,[]),e=t instanceof Array}catch{}return function(o,i){return f2(o),h2(i),e?r(o,i):o.__proto__=i,o}}():void 0),d2=ut,v2=mt,mR=kS,PS=function(e,t,r){var n,o;return mR&&d2(n=t.constructor)&&n!==r&&v2(o=n.prototype)&&o!==r.prototype&&mR(e,o),e},p2=Ct,ZM=function(){var e=p2(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},g2=kt,y2=bt,m2=Ro,b2=ZM,bR=RegExp.prototype,JM=function(e){var t=e.flags;return t===void 0&&!("flags"in bR)&&!y2(e,"flags")&&m2(bR,e)?g2(b2,e):t},AS=Le,w2=et,IS=w2.RegExp,$S=AS(function(){var e=IS("a","y");return e.lastIndex=2,e.exec("abcd")!=null}),S2=$S||AS(function(){return!IS("a","y").sticky}),C2=$S||AS(function(){var e=IS("^r","gy");return e.lastIndex=2,e.exec("str")!=null}),MS={BROKEN_CARET:C2,MISSED_STICKY:S2,UNSUPPORTED_Y:$S},_2=Nt.f,O2=function(e,t,r){r in e||_2(e,r,{configurable:!0,get:function(){return t[r]},set:function(n){t[r]=n}})},R2=on,E2=Nt,T2=lt,k2=St,wR=T2("species"),ex=function(e){var t=R2(e),r=E2.f;k2&&t&&!t[wR]&&r(t,wR,{configurable:!0,get:function(){return this}})},P2=Le,A2=et,I2=A2.RegExp,tx=P2(function(){var e=I2(".","s");return!(e.dotAll&&e.exec(` `)&&e.flags==="s")}),$2=Le,M2=et,x2=M2.RegExp,rx=$2(function(){var e=x2("(?b)","g");return e.exec("b").groups.a!=="b"||"b".replace(e,"$c")!=="bc"}),D2=St,xS=et,Qs=He,H2=Rh,N2=PS,L2=Bi,j2=Fi.f,SR=Ro,B2=CS,CR=Pt,F2=JM,nx=MS,V2=O2,W2=_r,U2=Le,z2=bt,G2=zn.enforce,Y2=ex,K2=lt,ox=tx,ix=rx,X2=K2("match"),uo=xS.RegExp,Sa=uo.prototype,q2=xS.SyntaxError,Q2=Qs(Sa.exec),cf=Qs("".charAt),_R=Qs("".replace),OR=Qs("".indexOf),Z2=Qs("".slice),J2=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,Si=/a/g,Fd=/a/g,ez=new uo(Si)!==Si,ax=nx.MISSED_STICKY,tz=nx.UNSUPPORTED_Y,rz=D2&&(!ez||ax||ox||ix||U2(function(){return Fd[X2]=!1,uo(Si)!=Si||uo(Fd)==Fd||uo(Si,"i")!="/a/i"})),nz=function(e){for(var t=e.length,r=0,n="",o=!1,i;r<=t;r++){if(i=cf(e,r),i==="\\"){n+=i+cf(e,++r);continue}!o&&i==="."?n+="[\\s\\S]":(i==="["?o=!0:i==="]"&&(o=!1),n+=i)}return n},oz=function(e){for(var t=e.length,r=0,n="",o=[],i={},a=!1,l=!1,s=0,u="",c;r<=t;r++){if(c=cf(e,r),c==="\\")c=c+cf(e,++r);else if(c==="]")a=!1;else if(!a)switch(!0){case c==="[":a=!0;break;case c==="(":Q2(J2,Z2(e,r+1))&&(r+=2,l=!0),n+=c,s++;continue;case(c===">"&&l):if(u===""||z2(i,u))throw new q2("Invalid capture group name");i[u]=!0,o[o.length]=[u,s],l=!1,u="";continue}l?u+=c:n+=c}return[n,o]};if(H2("RegExp",rz)){for(var Ao=function(t,r){var n=SR(Sa,this),o=B2(t),i=r===void 0,a=[],l=t,s,u,c,f,h,d;if(!n&&o&&i&&t.constructor===Ao)return t;if((o||SR(Sa,t))&&(t=t.source,i&&(r=F2(l))),t=t===void 0?"":CR(t),r=r===void 0?"":CR(r),l=t,ox&&"dotAll"in Si&&(u=!!r&&OR(r,"s")>-1,u&&(r=_R(r,/s/g,""))),s=r,ax&&"sticky"in Si&&(c=!!r&&OR(r,"y")>-1,c&&tz&&(r=_R(r,/y/g,""))),ix&&(f=oz(t),t=f[0],a=f[1]),h=N2(uo(t,r),n?this:Sa,Ao),(u||c||a.length)&&(d=G2(h),u&&(d.dotAll=!0,d.raw=Ao(nz(t),s)),c&&(d.sticky=!0),a.length&&(d.groups=a)),t!==l)try{L2(h,"source",l===""?"(?:)":l)}catch{}return h},RR=j2(uo),ER=0;RR.length>ER;)V2(Ao,uo,RR[ER++]);Sa.constructor=Ao,Ao.prototype=Sa,W2(xS,"RegExp",Ao,{constructor:!0})}Y2("RegExp");var Oa=kt,Ph=He,iz=Pt,az=ZM,lz=MS,sz=_o,uz=fl,cz=zn.get,fz=tx,hz=rx,dz=sz("native-string-replace",String.prototype.replace),ff=RegExp.prototype.exec,ng=ff,vz=Ph("".charAt),pz=Ph("".indexOf),gz=Ph("".replace),Vd=Ph("".slice),og=function(){var e=/a/,t=/b*/g;return Oa(ff,e,"a"),Oa(ff,t,"a"),e.lastIndex!==0||t.lastIndex!==0}(),lx=lz.BROKEN_CARET,ig=/()??/.exec("")[1]!==void 0,yz=og||ig||lx||fz||hz;yz&&(ng=function(t){var r=this,n=cz(r),o=iz(t),i=n.raw,a,l,s,u,c,f,h;if(i)return i.lastIndex=r.lastIndex,a=Oa(ng,i,o),r.lastIndex=i.lastIndex,a;var d=n.groups,v=lx&&r.sticky,g=Oa(az,r),y=r.source,w=0,C=o;if(v&&(g=gz(g,"y",""),pz(g,"g")===-1&&(g+="g"),C=Vd(o,r.lastIndex),r.lastIndex>0&&(!r.multiline||r.multiline&&vz(o,r.lastIndex-1)!==` `)&&(y="(?: "+y+")",C=" "+C,w++),l=new RegExp("^(?:"+y+")",g)),ig&&(l=new RegExp("^"+y+"$(?!\\s)",g)),og&&(s=r.lastIndex),u=Oa(ff,v?l:r,C),v?u?(u.input=Vd(u.input,w),u[0]=Vd(u[0],w),u.index=r.lastIndex,r.lastIndex+=u[0].length):r.lastIndex=0:og&&u&&(r.lastIndex=r.global?u.index+u[0].length:s),ig&&u&&u.length>1&&Oa(dz,u[0],l,function(){for(c=1;c=i?e?"":void 0:(a=NR(n,o),a<55296||a>56319||o+1===i||(l=NR(n,o+1))<56320||l>57343?e?eG(n,o):a:e?tG(n,o,o+2):(a-55296<<10)+(l-56320)+65536)}},NS={codeAt:LR(!1),charAt:LR(!0)},rG=NS.charAt,LS=function(e,t,r){return t+(r?rG(e,t).length:1)},jS=He,nG=nr,oG=Math.floor,zd=jS("".charAt),iG=jS("".replace),Gd=jS("".slice),aG=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,lG=/\$([$&'`]|\d{1,2})/g,sG=function(e,t,r,n,o,i){var a=r+e.length,l=n.length,s=lG;return o!==void 0&&(o=nG(o),s=aG),iG(i,s,function(u,c){var f;switch(zd(c,0)){case"$":return"$";case"&":return e;case"`":return Gd(t,0,r);case"'":return Gd(t,a);case"<":f=o[Gd(c,1,-1)];break;default:var h=+c;if(h===0)return u;if(h>l){var d=oG(h/10);return d===0?u:d<=l?n[d-1]===void 0?zd(c,1):n[d-1]+zd(c,1):u}f=n[h-1]}return f===void 0?"":f})},jR=kt,uG=Ct,cG=ut,fG=Un,hG=Ah,dG=TypeError,$h=function(e,t){var r=e.exec;if(cG(r)){var n=jR(r,e,t);return n!==null&&uG(n),n}if(fG(e)==="RegExp")return jR(hG,e,t);throw dG("RegExp#exec called on incompatible receiver")},vG=Ui,BR=kt,Mh=He,pG=Ih,gG=Le,yG=Ct,mG=ut,bG=Nr,wG=Eo,SG=Vi,Ji=Pt,CG=rr,_G=LS,OG=ji,RG=sG,EG=$h,TG=lt,ag=TG("replace"),kG=Math.max,PG=Math.min,AG=Mh([].concat),Yd=Mh([].push),FR=Mh("".indexOf),VR=Mh("".slice),IG=function(e){return e===void 0?e:String(e)},$G=function(){return"a".replace(/./,"$0")==="$0"}(),WR=function(){return/./[ag]?/./[ag]("a","$0")==="":!1}(),MG=!gG(function(){var e=/./;return e.exec=function(){var t=[];return t.groups={a:"7"},t},"".replace(e,"$")!=="7"});pG("replace",function(e,t,r){var n=WR?"$":"$0";return[function(i,a){var l=CG(this),s=bG(i)?void 0:OG(i,ag);return s?BR(s,i,l,a):BR(t,Ji(l),i,a)},function(o,i){var a=yG(this),l=Ji(o);if(typeof i=="string"&&FR(i,n)===-1&&FR(i,"$<")===-1){var s=r(t,a,l,i);if(s.done)return s.value}var u=mG(i);u||(i=Ji(i));var c=a.global;if(c){var f=a.unicode;a.lastIndex=0}for(var h=[];;){var d=EG(a,l);if(d===null||(Yd(h,d),!c))break;var v=Ji(d[0]);v===""&&(a.lastIndex=_G(l,SG(a.lastIndex),f))}for(var g="",y=0,w=0;w=y&&(g+=VR(l,y,_)+Q,y=_+C.length)}return g+VR(l,y)}]},!MG||!$G||WR);var xG=TypeError,DG=9007199254740991,dx=function(e){if(e>DG)throw xG("Maximum allowed index exceeded");return e},HG=Ae,NG=Le,LG=hl,jG=mt,BG=nr,FG=Or,UR=dx,zR=dl,VG=TS,WG=Ks,UG=lt,zG=js,vx=UG("isConcatSpreadable"),GG=zG>=51||!NG(function(){var e=[];return e[vx]=!1,e.concat()[0]!==e}),YG=WG("concat"),KG=function(e){if(!jG(e))return!1;var t=e[vx];return t!==void 0?!!t:LG(e)},XG=!GG||!YG;HG({target:"Array",proto:!0,arity:1,forced:XG},{concat:function(t){var r=BG(this),n=VG(r,0),o=0,i,a,l,s,u;for(i=-1,l=arguments.length;i=t.length?(e.target=void 0,Pu(void 0,!0)):r=="keys"?Pu(n,!1):r=="values"?Pu(t[n],!1):Pu([n,t[n]],!1)},"values"),hE=fE.Arguments=fE.Array;qS("keys");qS("values");qS("entries");if(tK&&hE.name!=="values")try{JY(hE,"name",{value:"values"})}catch{}var iK=NS.charAt,aK=Pt,Ux=zn,lK=KS,dE=XS,zx="String Iterator",sK=Ux.set,uK=Ux.getterFor(zx);lK(String,"String",function(e){sK(this,{type:zx,string:aK(e),index:0})},function(){var t=uK(this),r=t.string,n=t.index,o;return n>=r.length?dE(void 0,!0):(o=iK(r,n),t.index+=o.length,dE(o,!1))});var Gx={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},cK=_h,tv=cK("span").classList,vE=tv&&tv.constructor&&tv.constructor.prototype,Yx=vE===Object.prototype?void 0:vE,pE=et,Kx=Gx,fK=Yx,Xl=oK,rv=Bi,Xx=lt,nv=Xx("iterator"),gE=Xx("toStringTag"),ov=Xl.values,qx=function(e,t){if(e){if(e[nv]!==ov)try{rv(e,nv,ov)}catch{e[nv]=ov}if(e[gE]||rv(e,gE,t),Kx[t]){for(var r in Xl)if(e[r]!==Xl[r])try{rv(e,r,Xl[r])}catch{e[r]=Xl[r]}}}};for(var iv in Kx)qx(pE[iv]&&pE[iv].prototype,iv);qx(fK,"DOMTokenList");var hK=kt,yE=Ct,dK=ji,Qx=function(e,t,r){var n,o;yE(e);try{if(n=dK(e,"return"),!n){if(t==="throw")throw r;return r}n=hK(n,e)}catch(i){o=!0,n=i}if(t==="throw")throw r;if(o)throw n;return yE(n),r},vK=Ct,pK=Qx,gK=function(e,t,r,n){try{return n?t(vK(r)[0],r[1]):t(r)}catch(o){pK(e,"throw",o)}},yK=lt,mK=eu,bK=yK("iterator"),wK=Array.prototype,Zx=function(e){return e!==void 0&&(mK.Array===e||wK[bK]===e)},SK=Th,mE=ji,CK=Nr,_K=eu,OK=lt,RK=OK("iterator"),QS=function(e){if(!CK(e))return mE(e,RK)||mE(e,"@@iterator")||_K[SK(e)]},EK=kt,TK=cl,kK=Ct,PK=ul,AK=QS,IK=TypeError,Jx=function(e,t){var r=arguments.length<2?AK(e):t;if(TK(r))return kK(EK(r,e));throw IK(PK(e)+" is not iterable")},$K=qs,MK=kt,xK=nr,DK=gK,HK=Zx,NK=kh,LK=Or,bE=dl,jK=Jx,BK=QS,wE=Array,FK=function(t){var r=xK(t),n=NK(this),o=arguments.length,i=o>1?arguments[1]:void 0,a=i!==void 0;a&&(i=$K(i,o>2?arguments[2]:void 0));var l=BK(r),s=0,u,c,f,h,d,v;if(l&&!(this===wE&&HK(l)))for(h=jK(r,l),d=h.next,c=n?new this:[];!(f=MK(d,h)).done;s++)v=a?DK(h,i,[f.value,s],!0):f.value,bE(c,s,v);else for(u=LK(r),c=n?new this(u):wE(u);u>s;s++)v=a?i(r[s],s):r[s],bE(c,s,v);return c.length=s,c},VK=lt,eD=VK("iterator"),tD=!1;try{var WK=0,SE={next:function(){return{done:!!WK++}},return:function(){tD=!0}};SE[eD]=function(){return this},Array.from(SE,function(){throw 2})}catch{}var rD=function(e,t){if(!t&&!tD)return!1;var r=!1;try{var n={};n[eD]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch{}return r},UK=Ae,zK=FK,GK=rD,YK=!GK(function(e){Array.from(e)});UK({target:"Array",stat:!0,forced:YK},{from:zK});var KK=St,XK=Fs.EXISTS,nD=He,qK=Nt.f,oD=Function.prototype,QK=nD(oD.toString),iD=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,ZK=nD(iD.exec),JK="name";KK&&!XK&&qK(oD,JK,{configurable:!0,get:function(){try{return ZK(iD,QK(this))[1]}catch{return""}}});var e8=TypeError,aD=function(e,t){if(e2,o=r8(t)?t:l8(t),i=n?o8(arguments,2):void 0;return e(n?function(){t8(o,this,i)}:o,r)}:e},lD={setTimeout:CE(dg.setTimeout),setInterval:CE(dg.setInterval)},s8=Ae,u8=et,_E=lD.setInterval;s8({global:!0,bind:!0,forced:u8.setInterval!==_E},{setInterval:_E});var c8=Ae,f8=et,OE=lD.setTimeout;c8({global:!0,bind:!0,forced:f8.setTimeout!==OE},{setTimeout:OE});function vg(e){return vg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vg(e)}var RE=0,Au=["ms","moz","webkit","o"],ys=window.requestAnimationFrame,df=window.cancelAnimationFrame;for(var Ol=0;Olt
t";var r=document.createElement("CAPTION");r.innerHTML="c
c
c
c",r.style.padding="0",r.style.margin="0",e.insertBefore(r,t),document.body.appendChild(e),pg=e.offsetHeight<2*e.lastChild.offsetHeight,document.body.removeChild(e)}function cD(){return pg===void 0&&p8(),pg}var ea;function g8(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return ea||((typeof Intl>"u"?"undefined":vg(Intl))==="object"?ea=new Intl.Collator(e,t).compare:typeof String.prototype.localeCompare=="function"?ea=function(n,o){return"".concat(n).localeCompare(o)}:ea=function(n,o){return n===o?0:n>o?-1:1},ea)}var Rl;function y8(){if(Rl!==void 0)return Rl;try{var e={get passive(){Rl=!0}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch{Rl=!1}return Rl}var m8=Wi.forEach,b8=vl,w8=b8("forEach"),S8=w8?[].forEach:function(t){return m8(this,t,arguments.length>1?arguments[1]:void 0)},EE=et,TE=Gx,C8=Yx,av=S8,_8=Bi,fD=function(e){if(e&&e.forEach!==av)try{_8(e,"forEach",av)}catch{e.forEach=av}};for(var lv in TE)TE[lv]&&fD(EE[lv]&&EE[lv].prototype);fD(C8);var Ei={},O8={get exports(){return Ei},set exports(e){Ei=e}},R8=Le,E8=R8(function(){if(typeof ArrayBuffer=="function"){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}}),T8=Le,k8=mt,P8=Un,kE=E8,Rc=Object.isExtensible,A8=T8(function(){Rc(1)}),hD=A8||kE?function(t){return!k8(t)||kE&&P8(t)=="ArrayBuffer"?!1:Rc?Rc(t):!0}:Rc,I8=Le,dD=!I8(function(){return Object.isExtensible(Object.preventExtensions({}))}),$8=Ae,M8=He,x8=Vs,D8=mt,ZS=bt,H8=Nt.f,PE=Fi,N8=BS,JS=hD,L8=Sh,j8=dD,vD=!1,Vn=L8("meta"),B8=0,eC=function(e){H8(e,Vn,{value:{objectID:"O"+B8++,weakData:{}}})},F8=function(e,t){if(!D8(e))return typeof e=="symbol"?e:(typeof e=="string"?"S":"P")+e;if(!ZS(e,Vn)){if(!JS(e))return"F";if(!t)return"E";eC(e)}return e[Vn].objectID},V8=function(e,t){if(!ZS(e,Vn)){if(!JS(e))return!0;if(!t)return!1;eC(e)}return e[Vn].weakData},W8=function(e){return j8&&vD&&JS(e)&&!ZS(e,Vn)&&eC(e),e},U8=function(){z8.enable=function(){},vD=!0;var e=PE.f,t=M8([].splice),r={};r[Vn]=1,e(r).length&&(PE.f=function(n){for(var o=e(n),i=0,a=o.length;if;f++)if(d=w(e[f]),d&&AE($E,d))return d;return new Ec(!1)}u=Z8(e,c)}for(v=i?e.next:u.next;!(g=Y8(v,u)).done;){try{d=w(g.value)}catch(C){IE(u,"throw",C)}if(typeof d=="object"&&d&&AE($E,d))return d}return new Ec(!1)},t4=Ro,r4=TypeError,rC=function(e,t){if(t4(t,e))return e;throw r4("Incorrect invocation")},n4=Ae,o4=et,i4=He,ME=Rh,a4=_r,l4=Ei,s4=tC,u4=rC,c4=ut,f4=Nr,sv=mt,uv=Le,h4=rD,d4=xh,v4=PS,Bh=function(e,t,r){var n=e.indexOf("Map")!==-1,o=e.indexOf("Weak")!==-1,i=n?"set":"add",a=o4[e],l=a&&a.prototype,s=a,u={},c=function(w){var C=i4(l[w]);a4(l,w,w=="add"?function(I){return C(this,I===0?0:I),this}:w=="delete"?function(_){return o&&!sv(_)?!1:C(this,_===0?0:_)}:w=="get"?function(I){return o&&!sv(I)?void 0:C(this,I===0?0:I)}:w=="has"?function(I){return o&&!sv(I)?!1:C(this,I===0?0:I)}:function(I,E){return C(this,I===0?0:I,E),this})},f=ME(e,!c4(a)||!(o||l.forEach&&!uv(function(){new a().entries().next()})));if(f)s=r.getConstructor(t,e,n,i),l4.enable();else if(ME(e,!0)){var h=new s,d=h[i](o?{}:-0,1)!=h,v=uv(function(){h.has(1)}),g=h4(function(w){new a(w)}),y=!o&&uv(function(){for(var w=new a,C=5;C--;)w[i](C,C);return!w.has(-0)});g||(s=t(function(w,C){u4(w,l);var _=v4(new a,w,s);return f4(C)||s4(C,_[i],{that:_,AS_ENTRIES:n}),_}),s.prototype=l,l.constructor=s),(v||y)&&(c("delete"),c("has"),n&&c("get")),(y||d)&&c(i),o&&l.clear&&delete l.clear}return u[e]=s,n4({global:!0,constructor:!0,forced:s!=a},u),d4(s,e),o||r.setStrong(s,e,n),s},p4=_r,nC=function(e,t,r){for(var n in t)p4(e,n,t[n],r);return e},g4=Nt.f,y4=fl,xE=nC,m4=qs,b4=rC,w4=Nr,S4=tC,C4=KS,Iu=XS,_4=ex,El=St,DE=Ei.fastKey,pD=zn,HE=pD.set,cv=pD.getterFor,gD={getConstructor:function(e,t,r,n){var o=e(function(u,c){b4(u,i),HE(u,{type:t,index:y4(null),first:void 0,last:void 0,size:0}),El||(u.size=0),w4(c)||S4(c,u[n],{that:u,AS_ENTRIES:r})}),i=o.prototype,a=cv(t),l=function(u,c,f){var h=a(u),d=s(u,c),v,g;return d?d.value=f:(h.last=d={index:g=DE(c,!0),key:c,value:f,previous:v=h.last,next:void 0,removed:!1},h.first||(h.first=d),v&&(v.next=d),El?h.size++:u.size++,g!=="F"&&(h.index[g]=d)),u},s=function(u,c){var f=a(u),h=DE(c),d;if(h!=="F")return f.index[h];for(d=f.first;d;d=d.next)if(d.key==c)return d};return xE(i,{clear:function(){for(var c=this,f=a(c),h=f.index,d=f.first;d;)d.removed=!0,d.previous&&(d.previous=d.previous.next=void 0),delete h[d.index],d=d.next;f.first=f.last=void 0,El?f.size=0:c.size=0},delete:function(u){var c=this,f=a(c),h=s(c,u);if(h){var d=h.next,v=h.previous;delete f.index[h.index],h.removed=!0,v&&(v.next=d),d&&(d.previous=v),f.first==h&&(f.first=d),f.last==h&&(f.last=v),El?f.size--:c.size--}return!!h},forEach:function(c){for(var f=a(this),h=m4(c,arguments.length>1?arguments[1]:void 0),d;d=d?d.next:f.first;)for(h(d.value,d.key,this);d&&d.removed;)d=d.previous},has:function(c){return!!s(this,c)}}),xE(i,r?{get:function(c){var f=s(this,c);return f&&f.value},set:function(c,f){return l(this,c===0?0:c,f)}}:{add:function(c){return l(this,c=c===0?0:c,c)}}),El&&g4(i,"size",{get:function(){return a(this).size}}),o},setStrong:function(e,t,r){var n=t+" Iterator",o=cv(t),i=cv(n);C4(e,t,function(a,l){HE(this,{type:n,target:a,state:o(a),kind:l,last:void 0})},function(){for(var a=i(this),l=a.kind,s=a.last;s&&s.removed;)s=s.previous;return!a.target||!(a.last=s=s?s.next:a.state.first)?(a.target=void 0,Iu(void 0,!0)):l=="keys"?Iu(s.key,!1):l=="values"?Iu(s.value,!1):Iu([s.key,s.value],!1)},r?"entries":"values",!r,!0),_4(t)}},O4=Bh,R4=gD;O4("Set",function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},R4);var E4=kh,T4=ul,k4=TypeError,yD=function(e){if(E4(e))return e;throw k4(T4(e)+" is not a constructor")},NE=Ct,P4=yD,A4=Nr,I4=lt,$4=I4("species"),M4=function(e,t){var r=NE(e).constructor,n;return r===void 0||A4(n=NE(r)[$4])?t:P4(n)},x4=Ui,Tl=kt,oC=He,D4=Ih,H4=Ct,N4=Nr,L4=CS,LE=rr,j4=M4,B4=LS,F4=Vi,fv=Pt,V4=ji,jE=FS,BE=$h,W4=Ah,U4=MS,z4=Le,ta=U4.UNSUPPORTED_Y,FE=4294967295,G4=Math.min,mD=[].push,Y4=oC(/./.exec),ra=oC(mD),kl=oC("".slice),K4=!z4(function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var r="ab".split(e);return r.length!==2||r[0]!=="a"||r[1]!=="b"});D4("split",function(e,t,r){var n;return"abbc".split(/(b)*/)[1]=="c"||"test".split(/(?:)/,-1).length!=4||"ab".split(/(?:ab)*/).length!=2||".".split(/(.?)(.?)/).length!=4||".".split(/()()/).length>1||"".split(/.?/).length?n=function(o,i){var a=fv(LE(this)),l=i===void 0?FE:i>>>0;if(l===0)return[];if(o===void 0)return[a];if(!L4(o))return Tl(t,a,o,l);for(var s=[],u=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(o.sticky?"y":""),c=0,f=new RegExp(o.source,u+"g"),h,d,v;(h=Tl(W4,f,a))&&(d=f.lastIndex,!(d>c&&(ra(s,kl(a,c,h.index)),h.length>1&&h.index=l)));)f.lastIndex===h.index&&f.lastIndex++;return c===a.length?(v||!Y4(f,""))&&ra(s,""):ra(s,kl(a,c)),s.length>l?jE(s,0,l):s}:"0".split(void 0,0).length?n=function(o,i){return o===void 0&&i===0?[]:Tl(t,this,o,i)}:n=t,[function(i,a){var l=LE(this),s=N4(i)?void 0:V4(i,e);return s?Tl(s,i,l,a):Tl(n,fv(l),i,a)},function(o,i){var a=H4(this),l=fv(o),s=r(n,a,l,i,n!==t);if(s.done)return s.value;var u=j4(a,RegExp),c=a.unicode,f=(a.ignoreCase?"i":"")+(a.multiline?"m":"")+(a.unicode?"u":"")+(ta?"g":"y"),h=new u(ta?"^(?:"+a.source+")":a,f),d=i===void 0?FE:i>>>0;if(d===0)return[];if(l.length===0)return BE(h,l)===null?[l]:[];for(var v=0,g=0,y=[];g1&&arguments[1]!==void 0?arguments[1]:" ";return e.split(t)}function zE(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function La(e){return La=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},La(e)}function ms(e){var t;return Array.isArray(e)?t=[]:(t={},Ve(e,function(r,n){n!=="__children"&&(r&&La(r)==="object"&&!Array.isArray(r)?t[n]=ms(r):Array.isArray(r)?r.length&&La(r[0])==="object"&&!Array.isArray(r[0])?t[n]=[ms(r[0])]:t[n]=[]:t[n]=null)})),t}function To(e,t){return t.prototype.constructor=t,e.prototype=new t,e.prototype.constructor=e,e}function ht(e,t,r){var n=Array.isArray(r);return Ve(t,function(o,i){(n===!1||r.includes(i))&&(e[i]=o)}),e}function Fh(e,t){Ve(t,function(r,n){t[n]&&La(t[n])==="object"?(e[n]||(Array.isArray(t[n])?e[n]=[]:Object.prototype.toString.call(t[n])==="[object Date]"?e[n]=t[n]:e[n]={}),Fh(e[n],t[n])):e[n]=t[n]})}function Kt(e){return La(e)==="object"?JSON.parse(JSON.stringify(e)):e}function tr(e){var t={};return Ve(e,function(r,n){t[n]=r}),t}function rt(e){e.MIXINS||(e.MIXINS=[]);for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n1&&arguments[1]!==void 0?arguments[1]:"value",n="_".concat(r),o=(t={_touched:!1},zE(t,n,e),zE(t,"isTouched",function(){return this._touched}),t);return Object.defineProperty(o,r,{get:function(){return this[n]},set:function(a){this._touched=!0,this[n]=a},enumerable:!0,configurable:!0}),o}function it(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Jt=function(t){var r={value:!1};return r.test=function(n,o){r.value=t(n,o)},r},an={chrome:Jt(function(e,t){return/Chrome/.test(e)&&/Google/.test(t)}),chromeWebKit:Jt(function(e){return/CriOS/.test(e)}),edge:Jt(function(e){return/Edge/.test(e)}),edgeWebKit:Jt(function(e){return/EdgiOS/.test(e)}),firefox:Jt(function(e){return/Firefox/.test(e)}),firefoxWebKit:Jt(function(e){return/FxiOS/.test(e)}),ie:Jt(function(e){return/Trident/.test(e)}),ie9:Jt(function(){return!!document.documentMode}),mobile:Jt(function(e){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(e)}),safari:Jt(function(e,t){return/Safari/.test(e)&&/Apple Computer/.test(t)})},tu={mac:Jt(function(e){return/^Mac/.test(e)}),win:Jt(function(e){return/^Win/.test(e)}),linux:Jt(function(e){return/^Linux/.test(e)}),ios:Jt(function(e){return/iPhone|iPad|iPod/i.test(e)})};function Q4(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.userAgent,r=t===void 0?navigator.userAgent:t,n=e.vendor,o=n===void 0?navigator.vendor:n;Ve(an,function(i){var a=i.test;return void a(r,o)})}function Z4(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.platform,r=t===void 0?navigator.platform:t;Ve(tu,function(n){var o=n.test;return void o(r)})}Q4();Z4();function J4(){return an.chrome.value}function e6(){return an.chromeWebKit.value}function dv(){return an.firefox.value}function t6(){return an.firefoxWebKit.value}function r6(){return an.safari.value}function n6(){return an.edge.value}function o6(){return an.ie.value}function i6(){return an.ie9.value}function Jr(){return an.mobile.value}function SD(){return tu.ios.value}function CD(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:navigator,t=e.maxTouchPoints;return t>2&&tu.mac.value}function GE(){return tu.win.value}function YE(){return tu.mac.value}/*! @license DOMPurify 2.4.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.0/LICENSE */function io(e){return io=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},io(e)}function gg(e,t){return gg=Object.setPrototypeOf||function(n,o){return n.__proto__=o,n},gg(e,t)}function a6(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function kc(e,t,r){return a6()?kc=Reflect.construct:kc=function(o,i,a){var l=[null];l.push.apply(l,i);var s=Function.bind.apply(o,l),u=new s;return a&&gg(u,a.prototype),u},kc.apply(null,arguments)}function Ar(e){return l6(e)||s6(e)||u6(e)||c6()}function l6(e){if(Array.isArray(e))return yg(e)}function s6(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function u6(e,t){if(e){if(typeof e=="string")return yg(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return yg(e,t)}}function yg(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r{l({action:n.recordVisibilityChange,args:{isVisible:i}})};if(f.useEffect(()=>()=>{l({action:n.recordVisibilityChange,args:{isVisible:!1}})},[]),t.hidden)return null;const u={width:m(t.width),height:m(t.height),borderCollapse:"collapse",borderColor:"black",borderRadius:"var(--mainBorderRadius)"};let o=["mean","stdev","variance","stderr","count","minimum","quartile1","median","quartile3","maximum","range","sum"].filter(i=>i in t.summaryStatistics),h=e("tr",{children:o.map((i,a)=>e("th",{children:i},a))}),b=e("tr",{children:o.map((i,a)=>e("td",{children:t.summaryStatistics[i]},a))});return e(g,{partialVisibility:!0,onChange:d,children:r("div",{style:{margin:"12px 0"},children:[e("a",{name:s}),r("p",{children:["Summary statistics of ",t.columnName]}),e("table",{id:s,style:u,children:r("tbody",{children:[h,b]})})]})})});export{q as default}; +import{av as p,bn as y,r as f,j as e,a as r}from"./index-9d63439d.js";import{s as m}from"./css-14ccef8c.js";import{V as g}from"./visibility-sensor-aefdbbd5.js";const q=p.memo(function(c){let{name:V,id:s,SVs:t,children:C,actions:n,callAction:l}=y(c),d=i=>{l({action:n.recordVisibilityChange,args:{isVisible:i}})};if(f.useEffect(()=>()=>{l({action:n.recordVisibilityChange,args:{isVisible:!1}})},[]),t.hidden)return null;const u={width:m(t.width),height:m(t.height),borderCollapse:"collapse",borderColor:"black",borderRadius:"var(--mainBorderRadius)"};let o=["mean","stdev","variance","stderr","count","minimum","quartile1","median","quartile3","maximum","range","sum"].filter(i=>i in t.summaryStatistics),h=e("tr",{children:o.map((i,a)=>e("th",{children:i},a))}),b=e("tr",{children:o.map((i,a)=>e("td",{children:t.summaryStatistics[i]},a))});return e(g,{partialVisibility:!0,onChange:d,children:r("div",{style:{margin:"12px 0"},children:[e("a",{name:s}),r("p",{children:["Summary statistics of ",t.columnName]}),e("table",{id:s,style:u,children:r("tbody",{children:[h,b]})})]})})});export{q as default}; diff --git a/dist/assets/table-6cd432a0.js b/dist/assets/table-f1fe5d1a.js similarity index 93% rename from dist/assets/table-6cd432a0.js rename to dist/assets/table-f1fe5d1a.js index 763c2b2522..9640d171af 100644 --- a/dist/assets/table-6cd432a0.js +++ b/dist/assets/table-f1fe5d1a.js @@ -1 +1 @@ -import{av as u,bn as g,r as V,j as l,a as h,F as C}from"./index-61b6fc23.js";import{V as y}from"./visibility-sensor-398e690f.js";const v=u.memo(function(f){var m;let{name:x,id:n,SVs:t,children:a,actions:s,callAction:o}=g(f),b=e=>{o({action:s.recordVisibilityChange,args:{isVisible:e}})};if(V.useEffect(()=>()=>{o({action:s.recordVisibilityChange,args:{isVisible:!1}})},[]),t.hidden)return null;let d=null,c=[...a],i;if(t.titleChildName){let e;for(let[p,r]of a.entries())if(((m=r==null?void 0:r.props)==null?void 0:m.componentInstructions.componentName)===t.titleChildName){e=p;break}i=a[e],c.splice(e,1)}else i=t.title;if(!t.suppressTableNameInTitle){let e=l("strong",{children:t.tableName});i?i=h(C,{children:[e,": ",i]}):i=e}return d=l("div",{id:n+"_title",children:i}),l(y,{partialVisibility:!0,onChange:b,children:h("div",{id:n,style:{margin:"12px 0"},children:[l("a",{name:n}),d,c]})})});export{v as default}; +import{av as u,bn as g,r as V,j as l,a as h,F as C}from"./index-9d63439d.js";import{V as y}from"./visibility-sensor-aefdbbd5.js";const v=u.memo(function(f){var m;let{name:x,id:n,SVs:t,children:a,actions:s,callAction:o}=g(f),b=e=>{o({action:s.recordVisibilityChange,args:{isVisible:e}})};if(V.useEffect(()=>()=>{o({action:s.recordVisibilityChange,args:{isVisible:!1}})},[]),t.hidden)return null;let d=null,c=[...a],i;if(t.titleChildName){let e;for(let[p,r]of a.entries())if(((m=r==null?void 0:r.props)==null?void 0:m.componentInstructions.componentName)===t.titleChildName){e=p;break}i=a[e],c.splice(e,1)}else i=t.title;if(!t.suppressTableNameInTitle){let e=l("strong",{children:t.tableName});i?i=h(C,{children:[e,": ",i]}):i=e}return d=l("div",{id:n+"_title",children:i}),l(y,{partialVisibility:!0,onChange:b,children:h("div",{id:n,style:{margin:"12px 0"},children:[l("a",{name:n}),d,c]})})});export{v as default}; diff --git a/dist/assets/tabular-efc5101f.js b/dist/assets/tabular-bbf236ab.js similarity index 79% rename from dist/assets/tabular-efc5101f.js rename to dist/assets/tabular-bbf236ab.js index 059c35373b..9c32928ca2 100644 --- a/dist/assets/tabular-efc5101f.js +++ b/dist/assets/tabular-bbf236ab.js @@ -1 +1 @@ -import{av as c,bn as h,r as m,j as r,a as p}from"./index-61b6fc23.js";import{s}from"./css-14ccef8c.js";import{V as u}from"./visibility-sensor-398e690f.js";const C=c.memo(function(l){let{name:y,id:t,SVs:e,children:n,actions:a,callAction:o}=h(l),d=b=>{o({action:a.recordVisibilityChange,args:{isVisible:b}})};if(m.useEffect(()=>()=>{o({action:a.recordVisibilityChange,args:{isVisible:!1}})},[]),e.hidden)return null;const i={width:s(e.width),height:s(e.height),borderCollapse:"collapse",borderColor:"var(--canvastext)",borderRadius:"var(--mainBorderRadius)",tableLayout:"fixed"};return e.top!=="none"&&(i.borderTopStyle="solid",e.top==="minor"?i.borderTopWidth="thin":e.top==="medium"?i.borderTopWidth="medium":i.borderTopWidth="thick"),r(u,{partialVisibility:!0,onChange:d,children:p("div",{style:{margin:"12px 0"},children:[r("a",{name:t}),r("table",{id:t,style:i,children:r("tbody",{children:n})})]})})});export{C as default}; +import{av as c,bn as h,r as m,j as r,a as p}from"./index-9d63439d.js";import{s}from"./css-14ccef8c.js";import{V as u}from"./visibility-sensor-aefdbbd5.js";const C=c.memo(function(l){let{name:y,id:t,SVs:e,children:n,actions:a,callAction:o}=h(l),d=b=>{o({action:a.recordVisibilityChange,args:{isVisible:b}})};if(m.useEffect(()=>()=>{o({action:a.recordVisibilityChange,args:{isVisible:!1}})},[]),e.hidden)return null;const i={width:s(e.width),height:s(e.height),borderCollapse:"collapse",borderColor:"var(--canvastext)",borderRadius:"var(--mainBorderRadius)",tableLayout:"fixed"};return e.top!=="none"&&(i.borderTopStyle="solid",e.top==="minor"?i.borderTopWidth="thin":e.top==="medium"?i.borderTopWidth="medium":i.borderTopWidth="thick"),r(u,{partialVisibility:!0,onChange:d,children:p("div",{style:{margin:"12px 0"},children:[r("a",{name:t}),r("table",{id:t,style:i,children:r("tbody",{children:n})})]})})});export{C as default}; diff --git a/dist/assets/tag-b10b024c.js b/dist/assets/tag-9ca120fd.js similarity index 79% rename from dist/assets/tag-b10b024c.js rename to dist/assets/tag-9ca120fd.js index ea4fc420d9..09a84308ae 100644 --- a/dist/assets/tag-b10b024c.js +++ b/dist/assets/tag-9ca120fd.js @@ -1 +1 @@ -import{av as l,bn as o,a as d,j as i}from"./index-61b6fc23.js";const u=l.memo(function(s){let{name:m,id:e,SVs:n,children:r}=o(s);if(n.hidden)return null;let t="<",a=">";return n.selfClosed&&(a="/>"),d("code",{id:e,style:{color:"var(--mainGreen)"},children:[i("a",{name:e}),t,r,a]})});export{u as default}; +import{av as l,bn as o,a as d,j as i}from"./index-9d63439d.js";const u=l.memo(function(s){let{name:m,id:e,SVs:n,children:r}=o(s);if(n.hidden)return null;let t="<",a=">";return n.selfClosed&&(a="/>"),d("code",{id:e,style:{color:"var(--mainGreen)"},children:[i("a",{name:e}),t,r,a]})});export{u as default}; diff --git a/dist/assets/text-1978288a.js b/dist/assets/text-af45da17.js similarity index 95% rename from dist/assets/text-1978288a.js rename to dist/assets/text-af45da17.js index 1512940819..7ce1ebd903 100644 --- a/dist/assets/text-1978288a.js +++ b/dist/assets/text-af45da17.js @@ -1 +1 @@ -import{av as k,bn as L,r as c,bo as J,j as O,a as W,F as q}from"./index-61b6fc23.js";import{BoardContext as H,TEXT_LAYER_OFFSET as N}from"./graph-1ff63df5.js";import"./css-14ccef8c.js";import"./visibility-sensor-398e690f.js";const te=k.memo(function U(Y){let{name:I,id:v,SVs:e,actions:S,sourceOfUpdate:K,callAction:T}=L(Y);U.ignoreActionsWithoutCore=!0;let t=c.useRef(null),p=c.useRef(null),x=c.useRef(null);const i=c.useContext(H);let d=c.useRef(!1),F=c.useRef(!1),g=c.useRef(!1),m=c.useRef(null),h=c.useRef(null),j=c.useRef(null),y=c.useRef(null);c.useEffect(()=>()=>{t.current!==null&&(t.current.off("drag"),t.current.off("down"),t.current.off("up"),i==null||i.removeObject(t.current),t.current=null)},[]);function B(){let u=!e.draggable||e.fixed,n={visible:!e.hidden,fixed:u,layer:10*e.layer+N,highlight:!u},a;try{let r=J.fromAst(e.anchor),f=[r.get_component(0).evaluate_to_constant(),r.get_component(1).evaluate_to_constant()];Number.isFinite(f[0])||(f[0]=0,n.visible=!1),Number.isFinite(f[1])||(f[1]=0,n.visible=!1),a=i.create("point",f,{visible:!1})}catch{n.visible=!1,a=i.create("point",[0,0],{visible:!1})}n.anchor=a;let s,l;e.positionFromAnchor==="center"?(s="middle",l="middle"):e.positionFromAnchor==="lowerleft"?(s="right",l="top"):e.positionFromAnchor==="lowerright"?(s="left",l="top"):e.positionFromAnchor==="upperleft"?(s="right",l="bottom"):e.positionFromAnchor==="upperright"?(s="left",l="bottom"):e.positionFromAnchor==="bottom"?(s="middle",l="top"):e.positionFromAnchor==="top"?(s="middle",l="bottom"):e.positionFromAnchor==="right"?(s="left",l="middle"):(s="right",l="middle"),n.anchorx=s,n.anchory=l,x.current=[s,l];let o=i.create("text",[0,0,e.text],n);o.on("down",function(r){d.current=[r.x,r.y],F.current=[...a.coords.scrCoords],g.current=!1}),o.on("up",function(r){g.current&&T({action:S.moveText,args:{x:m.current,y:h.current}}),g.current=!1}),o.on("drag",function(r){var f=i.origin.scrCoords;let[C,R,_,P]=i.getBoundingBox(),X=o.size[0]/i.unitX,w=o.size[1]/i.unitY,E=x.current[0],G=x.current[1],b=0;E==="middle"?b=-X/2:E==="right"&&(b=-X);let A=0;G==="middle"?A=-w/2:G==="top"&&(A=-w);let D=C+.04*(_-C)-b-X,M=_-.04*(_-C)-b,z=P+.04*(R-P)-A-w,V=R-.04*(R-P)-A;m.current=(F.current[1]+r.x-d.current[0]-f[1])/i.unitX,m.current=Math.min(M,Math.max(D,m.current)),h.current=(f[2]-(F.current[2]+r.y-d.current[1]))/i.unitY,h.current=Math.min(V,Math.max(z,h.current)),T({action:S.moveText,args:{x:m.current,y:h.current,transient:!0,skippable:!0}}),o.relativeCoords.setCoordinates(JXG.COORDS_BY_USER,[0,0]),a.coords.setCoordinates(JXG.COORDS_BY_USER,j.current),(Math.abs(r.x-d.current[0])>.1||Math.abs(r.y-d.current[1])>.1)&&(g.current=!0)}),t.current=o,p.current=a,y.current=e.positionFromAnchor}if(i){let u;try{let n=J.fromAst(e.anchor);u=[n.get_component(0).evaluate_to_constant(),n.get_component(1).evaluate_to_constant()]}catch{u=[NaN,NaN]}if(j.current=u,t.current===null)B();else{t.current.relativeCoords.setCoordinates(JXG.COORDS_BY_USER,[0,0]),p.current.coords.setCoordinates(JXG.COORDS_BY_USER,u),t.current.setText(e.text);let n=!e.hidden;if(Number.isFinite(u[0])&&Number.isFinite(u[1])){let o=t.current.visProp.visible!==n;t.current.visProp.visible=n,t.current.visPropCalc.visible=n,o&&t.current.setAttribute({visible:n})}else t.current.visProp.visible=!1,t.current.visPropCalc.visible=!1;let a=10*e.layer+N;t.current.visProp.layer!==a&&t.current.setAttribute({layer:a});let l=!e.draggable||e.fixed;if(t.current.visProp.highlight=!l,t.current.visProp.fixed=l,t.current.needsUpdate=!0,e.positionFromAnchor!==y.current){let o,r;e.positionFromAnchor==="center"?(o="middle",r="middle"):e.positionFromAnchor==="lowerleft"?(o="right",r="top"):e.positionFromAnchor==="lowerright"?(o="left",r="top"):e.positionFromAnchor==="upperleft"?(o="right",r="bottom"):e.positionFromAnchor==="upperright"?(o="left",r="bottom"):e.positionFromAnchor==="bottom"?(o="middle",r="top"):e.positionFromAnchor==="top"?(o="middle",r="bottom"):e.positionFromAnchor==="right"?(o="left",r="middle"):(o="right",r="middle"),t.current.visProp.anchorx=o,t.current.visProp.anchory=r,x.current=[o,r],y.current=e.positionFromAnchor,t.current.fullUpdate()}else t.current.update();p.current.needsUpdate=!0,p.current.update(),i.updateRenderer()}return O("a",{name:v})}return e.hidden?null:W(q,{children:[O("a",{name:v}),O("span",{id:v,children:e.text})]})});export{te as default}; +import{av as k,bn as L,r as c,bo as J,j as O,a as W,F as q}from"./index-9d63439d.js";import{BoardContext as H,TEXT_LAYER_OFFSET as N}from"./graph-0c612329.js";import"./css-14ccef8c.js";import"./visibility-sensor-aefdbbd5.js";const te=k.memo(function U(Y){let{name:I,id:v,SVs:e,actions:S,sourceOfUpdate:K,callAction:T}=L(Y);U.ignoreActionsWithoutCore=!0;let t=c.useRef(null),p=c.useRef(null),x=c.useRef(null);const i=c.useContext(H);let d=c.useRef(!1),F=c.useRef(!1),g=c.useRef(!1),m=c.useRef(null),h=c.useRef(null),j=c.useRef(null),y=c.useRef(null);c.useEffect(()=>()=>{t.current!==null&&(t.current.off("drag"),t.current.off("down"),t.current.off("up"),i==null||i.removeObject(t.current),t.current=null)},[]);function B(){let u=!e.draggable||e.fixed,n={visible:!e.hidden,fixed:u,layer:10*e.layer+N,highlight:!u},a;try{let r=J.fromAst(e.anchor),f=[r.get_component(0).evaluate_to_constant(),r.get_component(1).evaluate_to_constant()];Number.isFinite(f[0])||(f[0]=0,n.visible=!1),Number.isFinite(f[1])||(f[1]=0,n.visible=!1),a=i.create("point",f,{visible:!1})}catch{n.visible=!1,a=i.create("point",[0,0],{visible:!1})}n.anchor=a;let s,l;e.positionFromAnchor==="center"?(s="middle",l="middle"):e.positionFromAnchor==="lowerleft"?(s="right",l="top"):e.positionFromAnchor==="lowerright"?(s="left",l="top"):e.positionFromAnchor==="upperleft"?(s="right",l="bottom"):e.positionFromAnchor==="upperright"?(s="left",l="bottom"):e.positionFromAnchor==="bottom"?(s="middle",l="top"):e.positionFromAnchor==="top"?(s="middle",l="bottom"):e.positionFromAnchor==="right"?(s="left",l="middle"):(s="right",l="middle"),n.anchorx=s,n.anchory=l,x.current=[s,l];let o=i.create("text",[0,0,e.text],n);o.on("down",function(r){d.current=[r.x,r.y],F.current=[...a.coords.scrCoords],g.current=!1}),o.on("up",function(r){g.current&&T({action:S.moveText,args:{x:m.current,y:h.current}}),g.current=!1}),o.on("drag",function(r){var f=i.origin.scrCoords;let[C,R,_,P]=i.getBoundingBox(),X=o.size[0]/i.unitX,w=o.size[1]/i.unitY,E=x.current[0],G=x.current[1],b=0;E==="middle"?b=-X/2:E==="right"&&(b=-X);let A=0;G==="middle"?A=-w/2:G==="top"&&(A=-w);let D=C+.04*(_-C)-b-X,M=_-.04*(_-C)-b,z=P+.04*(R-P)-A-w,V=R-.04*(R-P)-A;m.current=(F.current[1]+r.x-d.current[0]-f[1])/i.unitX,m.current=Math.min(M,Math.max(D,m.current)),h.current=(f[2]-(F.current[2]+r.y-d.current[1]))/i.unitY,h.current=Math.min(V,Math.max(z,h.current)),T({action:S.moveText,args:{x:m.current,y:h.current,transient:!0,skippable:!0}}),o.relativeCoords.setCoordinates(JXG.COORDS_BY_USER,[0,0]),a.coords.setCoordinates(JXG.COORDS_BY_USER,j.current),(Math.abs(r.x-d.current[0])>.1||Math.abs(r.y-d.current[1])>.1)&&(g.current=!0)}),t.current=o,p.current=a,y.current=e.positionFromAnchor}if(i){let u;try{let n=J.fromAst(e.anchor);u=[n.get_component(0).evaluate_to_constant(),n.get_component(1).evaluate_to_constant()]}catch{u=[NaN,NaN]}if(j.current=u,t.current===null)B();else{t.current.relativeCoords.setCoordinates(JXG.COORDS_BY_USER,[0,0]),p.current.coords.setCoordinates(JXG.COORDS_BY_USER,u),t.current.setText(e.text);let n=!e.hidden;if(Number.isFinite(u[0])&&Number.isFinite(u[1])){let o=t.current.visProp.visible!==n;t.current.visProp.visible=n,t.current.visPropCalc.visible=n,o&&t.current.setAttribute({visible:n})}else t.current.visProp.visible=!1,t.current.visPropCalc.visible=!1;let a=10*e.layer+N;t.current.visProp.layer!==a&&t.current.setAttribute({layer:a});let l=!e.draggable||e.fixed;if(t.current.visProp.highlight=!l,t.current.visProp.fixed=l,t.current.needsUpdate=!0,e.positionFromAnchor!==y.current){let o,r;e.positionFromAnchor==="center"?(o="middle",r="middle"):e.positionFromAnchor==="lowerleft"?(o="right",r="top"):e.positionFromAnchor==="lowerright"?(o="left",r="top"):e.positionFromAnchor==="upperleft"?(o="right",r="bottom"):e.positionFromAnchor==="upperright"?(o="left",r="bottom"):e.positionFromAnchor==="bottom"?(o="middle",r="top"):e.positionFromAnchor==="top"?(o="middle",r="bottom"):e.positionFromAnchor==="right"?(o="left",r="middle"):(o="right",r="middle"),t.current.visProp.anchorx=o,t.current.visProp.anchory=r,x.current=[o,r],y.current=e.positionFromAnchor,t.current.fullUpdate()}else t.current.update();p.current.needsUpdate=!0,p.current.update(),i.updateRenderer()}return O("a",{name:v})}return e.hidden?null:W(q,{children:[O("a",{name:v}),O("span",{id:v,children:e.text})]})});export{te as default}; diff --git a/dist/assets/textInput-b488d15c.js b/dist/assets/textInput-8b61e9c3.js similarity index 97% rename from dist/assets/textInput-b488d15c.js rename to dist/assets/textInput-8b61e9c3.js index f68cba3291..65be168f6e 100644 --- a/dist/assets/textInput-b488d15c.js +++ b/dist/assets/textInput-8b61e9c3.js @@ -1,4 +1,4 @@ -import{bn as D,r as g,R as L,br as j,j as r,i as y,bp as z,a0 as G,aP as H,bq as N,a as p,F as v,av as U,s as w}from"./index-61b6fc23.js";import{s as K}from"./css-14ccef8c.js";const h=w.button` +import{bn as D,r as g,R as L,br as j,j as r,i as y,bp as z,a0 as G,aP as H,bq as N,a as p,F as v,av as U,s as w}from"./index-9d63439d.js";import{s as K}from"./css-14ccef8c.js";const h=w.button` position: relative; height: 24px; width: 24px; diff --git a/dist/assets/textList-ce45fad3.js b/dist/assets/textList-63a95c8f.js similarity index 83% rename from dist/assets/textList-ce45fad3.js rename to dist/assets/textList-63a95c8f.js index 6eb28ccd1b..5b2a8fee3d 100644 --- a/dist/assets/textList-ce45fad3.js +++ b/dist/assets/textList-63a95c8f.js @@ -1 +1 @@ -import{av as a,bn as c,a as s,j as r}from"./index-61b6fc23.js";const x=a.memo(function(i){let{name:u,id:e,SVs:t,children:n}=c(i);if(t.hidden)return null;if(n.length===0&&t.text)return s(a.Fragment,{children:[r("a",{name:e}),r("span",{id:e,children:t.text})]},e);let l=n.slice(1).reduce((m,d)=>[...m,", ",d],[n[0]]);return s(a.Fragment,{children:[r("a",{name:e}),l]},e)});export{x as default}; +import{av as a,bn as c,a as s,j as r}from"./index-9d63439d.js";const x=a.memo(function(i){let{name:u,id:e,SVs:t,children:n}=c(i);if(t.hidden)return null;if(n.length===0&&t.text)return s(a.Fragment,{children:[r("a",{name:e}),r("span",{id:e,children:t.text})]},e);let l=n.slice(1).reduce((m,d)=>[...m,", ",d],[n[0]]);return s(a.Fragment,{children:[r("a",{name:e}),l]},e)});export{x as default}; diff --git a/dist/assets/triggerSet-5593c809.js b/dist/assets/triggerSet-2a7a15cd.js similarity index 69% rename from dist/assets/triggerSet-5593c809.js rename to dist/assets/triggerSet-2a7a15cd.js index 155d3b75e2..677215833f 100644 --- a/dist/assets/triggerSet-5593c809.js +++ b/dist/assets/triggerSet-2a7a15cd.js @@ -1 +1 @@ -import{av as s,bn as r,a as o,j as t,B as d}from"./index-61b6fc23.js";const g=s.memo(function(n){let{name:u,id:a,SVs:e,actions:i,callAction:l}=r(n,!1);return e.hidden?null:o("div",{id:a,style:{margin:"12px 0",display:"inline-block"},children:[t("a",{name:a}),t(d,{id:a+"_button",onClick:()=>l({action:i.triggerActions}),disabled:e.disabled,value:e.label,valueHasLatex:e.labelHasLatex})]})});export{g as default}; +import{av as s,bn as r,a as o,j as t,B as d}from"./index-9d63439d.js";const g=s.memo(function(n){let{name:u,id:a,SVs:e,actions:i,callAction:l}=r(n,!1);return e.hidden?null:o("div",{id:a,style:{margin:"12px 0",display:"inline-block"},children:[t("a",{name:a}),t(d,{id:a+"_button",onClick:()=>l({action:i.triggerActions}),disabled:e.disabled,value:e.label,valueHasLatex:e.labelHasLatex})]})});export{g as default}; diff --git a/dist/assets/updateValue-cc05d70f.js b/dist/assets/updateValue-0c45c8c4.js similarity index 68% rename from dist/assets/updateValue-cc05d70f.js rename to dist/assets/updateValue-0c45c8c4.js index eff7f00854..ec7a8b63b6 100644 --- a/dist/assets/updateValue-cc05d70f.js +++ b/dist/assets/updateValue-0c45c8c4.js @@ -1 +1 @@ -import{av as i,bn as d,a as u,j as l,B as o}from"./index-61b6fc23.js";const m=i.memo(function(t){let{name:c,id:e,SVs:a,actions:n,callAction:s}=d(t,!1);return a.hidden?null:u("div",{id:e,margin:"12px 0",style:{display:"inline-block"},children:[l("a",{name:e}),l(o,{id:e+"_button",onClick:()=>s({action:n.updateValue}),disabled:a.disabled,value:a.label,valueHasLatex:a.labelHasLatex})]})});export{m as default}; +import{av as i,bn as d,a as u,j as l,B as o}from"./index-9d63439d.js";const m=i.memo(function(t){let{name:c,id:e,SVs:a,actions:n,callAction:s}=d(t,!1);return a.hidden?null:u("div",{id:e,margin:"12px 0",style:{display:"inline-block"},children:[l("a",{name:e}),l(o,{id:e+"_button",onClick:()=>s({action:n.updateValue}),disabled:a.disabled,value:a.label,valueHasLatex:a.labelHasLatex})]})});export{m as default}; diff --git a/dist/assets/useSaveDraft-fc810696.js b/dist/assets/useSaveDraft-50a40c9b.js similarity index 75% rename from dist/assets/useSaveDraft-fc810696.js rename to dist/assets/useSaveDraft-50a40c9b.js index 7c1fa5ac19..713258c21b 100644 --- a/dist/assets/useSaveDraft-fc810696.js +++ b/dist/assets/useSaveDraft-50a40c9b.js @@ -1 +1 @@ -import{y as m,v as u,k as p,aZ as d,z as v}from"./index-61b6fc23.js";import{t as y}from"./EditorViewerRecoil-fde09b36.js";function x(){const a=m();return{saveDraft:u(({snapshot:r,set:n})=>async({pageId:t,courseId:c,backup:i=!1})=>{const e=await r.getPromise(y);try{const s={doenetML:e,pageId:t,courseId:c,backup:i},{data:{success:o,message:f}}=await p.post("/api/saveDoenetML.php",s);if(!o)throw new Error(f);return n(d(t),e),{success:o}}catch(s){return a(s.message,v.ERROR),{success:!1}}},[a])}}export{x as u}; +import{y as m,v as u,k as p,aZ as d,z as v}from"./index-9d63439d.js";import{t as y}from"./EditorViewerRecoil-4f9a7d1d.js";function x(){const a=m();return{saveDraft:u(({snapshot:r,set:n})=>async({pageId:t,courseId:c,backup:i=!1})=>{const e=await r.getPromise(y);try{const s={doenetML:e,pageId:t,courseId:c,backup:i},{data:{success:o,message:f}}=await p.post("/api/saveDoenetML.php",s);if(!o)throw new Error(f);return n(d(t),e),{success:o}}catch(s){return a(s.message,v.ERROR),{success:!1}}},[a])}}export{x as u}; diff --git a/dist/assets/vector-e1829ec2.js b/dist/assets/vector-d3ac7f71.js similarity index 96% rename from dist/assets/vector-e1829ec2.js rename to dist/assets/vector-d3ac7f71.js index c0f9bc79af..a3098b01ea 100644 --- a/dist/assets/vector-e1829ec2.js +++ b/dist/assets/vector-d3ac7f71.js @@ -1 +1 @@ -import{av as Z,bn as $,r as o,l as ee,bs as te,j as V,F as W,a as re,b9 as ne}from"./index-61b6fc23.js";import{BoardContext as oe,LINE_LAYER_OFFSET as B,VERTEX_LAYER_OFFSET as T}from"./graph-1ff63df5.js";import"./css-14ccef8c.js";import"./visibility-sensor-398e690f.js";const se=Z.memo(function O(z){let{name:_,id:A,SVs:e,actions:d,sourceOfUpdate:L,callAction:f}=$(z);O.ignoreActionsWithoutCore=!0;const n=o.useContext(oe);let t=o.useRef({}),l=o.useRef({}),i=o.useRef({}),x=o.useRef(!1),j=o.useRef(!1),a=o.useRef(!1),c=o.useRef(!1),D=o.useRef(null),w=o.useRef(null),R=o.useRef(null),U=o.useRef(!1),J=o.useRef(null);J.current=e.numericalEndpoints;const Y=ee(te);o.useEffect(()=>()=>{Object.keys(t.current).length!==0&&I()},[]);function H(){if(e.numericalEndpoints.length!==2||e.numericalEndpoints.some(r=>r.length!==2)){t.current={},l.current={},i.current={};return}let p=10*e.layer+B,h=10*e.layer+T,v=!e.draggable||e.fixed,m=Y==="dark"?e.selectedStyle.lineColorDarkMode:e.selectedStyle.lineColor;m=m.toLowerCase();var u={name:e.labelForGraph,visible:!e.hidden,withLabel:e.showLabel&&e.labelForGraph!=="",fixed:v,layer:p,strokeColor:m,strokeOpacity:e.selectedStyle.lineOpacity,highlightStrokeColor:m,highlightStrokeOpacity:e.selectedStyle.lineOpacity*.5,strokeWidth:e.selectedStyle.lineWidth,highlightStrokeWidth:e.selectedStyle.lineWidth,dash:N(e.selectedStyle.lineStyle),highlight:!v,lastArrow:{type:1,size:3,highlightSize:3}};let G=[[...e.numericalEndpoints[0]],[...e.numericalEndpoints[1]]],S=Object.assign({},u);Object.assign(S,{withLabel:!1,fixed:!1,highlight:!0,fillColor:"none",strokeColor:"none",highlightStrokeColor:"none",highlightFillColor:getComputedStyle(document.documentElement).getPropertyValue("--mainGray"),layer:h});let E=Object.assign({},S),C=e.tailDraggable&&!e.fixed&&!e.hidden;E.visible=C;let g=n.create("point",G[0],E),k=Object.assign({},S),Q=e.headDraggable&&!e.fixed&&!e.hidden;k.visible=Q;let P=n.create("point",G[1],k);u.label={highlight:!1},e.labelHasLatex&&(u.label.useMathJax=!0),e.applyStyleToLabel?u.label.strokeColor=m:u.label.strokeColor="var(--canvastext)";let s=n.create("arrow",[g,P],u);g.on("drag",r=>F(r,0)),P.on("drag",r=>F(r,1)),s.on("drag",r=>F(r,-1)),g.on("up",r=>{!a.current&&c.current?f({action:d.moveVector,args:{tailcoords:R.current}}):!a.current&&!c.current&&f({action:d.vectorClicked}),D.current=null}),P.on("up",r=>{a.current&&!c.current?f({action:d.moveVector,args:{headcoords:w.current}}):!a.current&&!c.current&&f({action:d.vectorClicked}),D.current=null}),s.on("up",r=>{a.current&&c.current?f({action:d.moveVector,args:{headcoords:w.current,tailcoords:R.current}}):!a.current&&!c.current&&D.current===null&&f({action:d.vectorClicked})}),g.on("down",function(r){a.current=!1,c.current=!1,x.current=[r.x,r.y],D.current=1,f({action:d.mouseDownOnVector})}),P.on("down",function(r){a.current=!1,c.current=!1,x.current=[r.x,r.y],D.current=2,f({action:d.mouseDownOnVector})}),s.on("down",function(r){a.current=!1,c.current=!1,x.current=[r.x,r.y],j.current=[[...s.point1.coords.scrCoords],[...s.point2.coords.scrCoords]],f({action:d.mouseDownOnVector})});function F(r,y){if(Math.abs(r.x-x.current[0])>.1||Math.abs(r.y-x.current[1])>.1){y===0?c.current=!0:y===1?a.current=!0:(a.current=!0,c.current=!0);let X={transient:!0,skippable:!0};a.current&&(y===-1?w.current=M(r,1):w.current=[s.point2.X(),s.point2.Y()],X.headcoords=w.current),c.current&&(y===-1?R.current=M(r,0):R.current=[s.point1.X(),s.point1.Y()],X.tailcoords=R.current),(y===0||y===1)&&(X.sourceDetails={vertex:y}),f({action:d.moveVector,args:X}),s.point1.coords.setCoordinates(JXG.COORDS_BY_USER,J.current[0]),s.point2.coords.setCoordinates(JXG.COORDS_BY_USER,J.current[1]),y===0?n.updateInfobox(g):y===1&&n.updateInfobox(P)}}t.current=s,l.current=g,i.current=P}function I(){t.current.off("drag"),t.current.off("down"),t.current.off("up"),n.removeObject(t.current),t.current={},l.current.off("drag"),l.current.off("down"),l.current.off("up"),n.removeObject(l.current),l.current={},i.current.off("drag"),i.current.off("down"),i.current.off("up"),n.removeObject(i.current),i.current={}}function M(p,h){var v=n.origin.scrCoords;let m=(j.current[h][1]+p.x-x.current[0]-v[1])/n.unitX,u=(v[2]-(j.current[h][2]+p.y-x.current[1]))/n.unitY;return[m,u]}if(n){if(Object.keys(t.current).length===0)H();else if(e.numericalEndpoints.length!==2||e.numericalEndpoints.some(p=>p.length!==2))I();else{let p=!0;for(let b of[e.numericalEndpoints[0],e.numericalEndpoints[1]])Number.isFinite(b[0])||(p=!1),Number.isFinite(b[1])||(p=!1);t.current.point1.coords.setCoordinates(JXG.COORDS_BY_USER,e.numericalEndpoints[0]),t.current.point2.coords.setCoordinates(JXG.COORDS_BY_USER,e.numericalEndpoints[1]);let h=!e.hidden&&p,v=!e.draggable||e.fixed,u=e.tailDraggable&&!e.fixed&&h,S=e.headDraggable&&!e.fixed&&h;if(t.current.visProp.fixed=v,t.current.visProp.highlight=!v,t.current.visProp.visible=h,t.current.visPropCalc.visible=h,l.current.visProp.visible=u,l.current.visPropCalc.visible=u,i.current.visProp.visible=S,i.current.visPropCalc.visible=S,L.sourceInformation&&_ in L.sourceInformation){let b=L.sourceInformation[_];b.vertex===0?n.updateInfobox(l.current):b.vertex===1&&n.updateInfobox(i.current)}let E=10*e.layer+B;if(t.current.visProp.layer!==E){let b=10*e.layer+T;t.current.setAttribute({layer:E}),l.current.setAttribute({layer:b}),i.current.setAttribute({layer:b})}let C=Y==="dark"?e.selectedStyle.lineColorDarkMode:e.selectedStyle.lineColor;C=C.toLowerCase(),t.current.visProp.strokecolor!==C&&(t.current.visProp.strokecolor=C,t.current.visProp.highlightstrokecolor=C),t.current.visProp.strokewidth!==e.selectedStyle.lineWidth&&(t.current.visProp.strokewidth=e.selectedStyle.lineWidth,t.current.visProp.highlightstrokewidth=e.selectedStyle.lineWidth),t.current.visProp.strokeopacity!==e.selectedStyle.lineOpacity&&(t.current.visProp.strokeopacity=e.selectedStyle.lineOpacity,t.current.visProp.highlightstrokeopacity=e.selectedStyle.lineOpacity*.5);let g=N(e.selectedStyle.lineStyle);t.current.visProp.dash!==g&&(t.current.visProp.dash=g),t.current.name=e.labelForGraph;let k=e.showLabel&&e.labelForGraph!=="";k!=U.current&&(t.current.setAttribute({withlabel:k}),U.current=k),t.current.needsUpdate=!0,t.current.update(),t.current.hasLabel&&(e.applyStyleToLabel?t.current.label.visProp.strokecolor=C:t.current.label.visProp.strokecolor="var(--canvastext)",t.current.label.needsUpdate=!0,t.current.label.update()),l.current.needsUpdate=!0,l.current.update(),i.current.needsUpdate=!0,i.current.update(),n.updateRenderer()}return V(W,{children:V("a",{name:A})})}if(e.hidden)return null;let q="\\("+e.latex+"\\)";return re(W,{children:[V("a",{name:A}),V("span",{id:A,children:V(ne.MathJax,{hideUntilTypeset:"first",inline:!0,dynamic:!0,children:q})})]})});function N(O){return O==="solid"?0:O==="dashed"?2:O==="dotted"?1:0}export{se as default}; +import{av as Z,bn as $,r as o,l as ee,bs as te,j as V,F as W,a as re,b9 as ne}from"./index-9d63439d.js";import{BoardContext as oe,LINE_LAYER_OFFSET as B,VERTEX_LAYER_OFFSET as T}from"./graph-0c612329.js";import"./css-14ccef8c.js";import"./visibility-sensor-aefdbbd5.js";const se=Z.memo(function O(z){let{name:_,id:A,SVs:e,actions:d,sourceOfUpdate:L,callAction:f}=$(z);O.ignoreActionsWithoutCore=!0;const n=o.useContext(oe);let t=o.useRef({}),l=o.useRef({}),i=o.useRef({}),x=o.useRef(!1),j=o.useRef(!1),a=o.useRef(!1),c=o.useRef(!1),D=o.useRef(null),w=o.useRef(null),R=o.useRef(null),U=o.useRef(!1),J=o.useRef(null);J.current=e.numericalEndpoints;const Y=ee(te);o.useEffect(()=>()=>{Object.keys(t.current).length!==0&&I()},[]);function H(){if(e.numericalEndpoints.length!==2||e.numericalEndpoints.some(r=>r.length!==2)){t.current={},l.current={},i.current={};return}let p=10*e.layer+B,h=10*e.layer+T,v=!e.draggable||e.fixed,m=Y==="dark"?e.selectedStyle.lineColorDarkMode:e.selectedStyle.lineColor;m=m.toLowerCase();var u={name:e.labelForGraph,visible:!e.hidden,withLabel:e.showLabel&&e.labelForGraph!=="",fixed:v,layer:p,strokeColor:m,strokeOpacity:e.selectedStyle.lineOpacity,highlightStrokeColor:m,highlightStrokeOpacity:e.selectedStyle.lineOpacity*.5,strokeWidth:e.selectedStyle.lineWidth,highlightStrokeWidth:e.selectedStyle.lineWidth,dash:N(e.selectedStyle.lineStyle),highlight:!v,lastArrow:{type:1,size:3,highlightSize:3}};let G=[[...e.numericalEndpoints[0]],[...e.numericalEndpoints[1]]],S=Object.assign({},u);Object.assign(S,{withLabel:!1,fixed:!1,highlight:!0,fillColor:"none",strokeColor:"none",highlightStrokeColor:"none",highlightFillColor:getComputedStyle(document.documentElement).getPropertyValue("--mainGray"),layer:h});let E=Object.assign({},S),C=e.tailDraggable&&!e.fixed&&!e.hidden;E.visible=C;let g=n.create("point",G[0],E),k=Object.assign({},S),Q=e.headDraggable&&!e.fixed&&!e.hidden;k.visible=Q;let P=n.create("point",G[1],k);u.label={highlight:!1},e.labelHasLatex&&(u.label.useMathJax=!0),e.applyStyleToLabel?u.label.strokeColor=m:u.label.strokeColor="var(--canvastext)";let s=n.create("arrow",[g,P],u);g.on("drag",r=>F(r,0)),P.on("drag",r=>F(r,1)),s.on("drag",r=>F(r,-1)),g.on("up",r=>{!a.current&&c.current?f({action:d.moveVector,args:{tailcoords:R.current}}):!a.current&&!c.current&&f({action:d.vectorClicked}),D.current=null}),P.on("up",r=>{a.current&&!c.current?f({action:d.moveVector,args:{headcoords:w.current}}):!a.current&&!c.current&&f({action:d.vectorClicked}),D.current=null}),s.on("up",r=>{a.current&&c.current?f({action:d.moveVector,args:{headcoords:w.current,tailcoords:R.current}}):!a.current&&!c.current&&D.current===null&&f({action:d.vectorClicked})}),g.on("down",function(r){a.current=!1,c.current=!1,x.current=[r.x,r.y],D.current=1,f({action:d.mouseDownOnVector})}),P.on("down",function(r){a.current=!1,c.current=!1,x.current=[r.x,r.y],D.current=2,f({action:d.mouseDownOnVector})}),s.on("down",function(r){a.current=!1,c.current=!1,x.current=[r.x,r.y],j.current=[[...s.point1.coords.scrCoords],[...s.point2.coords.scrCoords]],f({action:d.mouseDownOnVector})});function F(r,y){if(Math.abs(r.x-x.current[0])>.1||Math.abs(r.y-x.current[1])>.1){y===0?c.current=!0:y===1?a.current=!0:(a.current=!0,c.current=!0);let X={transient:!0,skippable:!0};a.current&&(y===-1?w.current=M(r,1):w.current=[s.point2.X(),s.point2.Y()],X.headcoords=w.current),c.current&&(y===-1?R.current=M(r,0):R.current=[s.point1.X(),s.point1.Y()],X.tailcoords=R.current),(y===0||y===1)&&(X.sourceDetails={vertex:y}),f({action:d.moveVector,args:X}),s.point1.coords.setCoordinates(JXG.COORDS_BY_USER,J.current[0]),s.point2.coords.setCoordinates(JXG.COORDS_BY_USER,J.current[1]),y===0?n.updateInfobox(g):y===1&&n.updateInfobox(P)}}t.current=s,l.current=g,i.current=P}function I(){t.current.off("drag"),t.current.off("down"),t.current.off("up"),n.removeObject(t.current),t.current={},l.current.off("drag"),l.current.off("down"),l.current.off("up"),n.removeObject(l.current),l.current={},i.current.off("drag"),i.current.off("down"),i.current.off("up"),n.removeObject(i.current),i.current={}}function M(p,h){var v=n.origin.scrCoords;let m=(j.current[h][1]+p.x-x.current[0]-v[1])/n.unitX,u=(v[2]-(j.current[h][2]+p.y-x.current[1]))/n.unitY;return[m,u]}if(n){if(Object.keys(t.current).length===0)H();else if(e.numericalEndpoints.length!==2||e.numericalEndpoints.some(p=>p.length!==2))I();else{let p=!0;for(let b of[e.numericalEndpoints[0],e.numericalEndpoints[1]])Number.isFinite(b[0])||(p=!1),Number.isFinite(b[1])||(p=!1);t.current.point1.coords.setCoordinates(JXG.COORDS_BY_USER,e.numericalEndpoints[0]),t.current.point2.coords.setCoordinates(JXG.COORDS_BY_USER,e.numericalEndpoints[1]);let h=!e.hidden&&p,v=!e.draggable||e.fixed,u=e.tailDraggable&&!e.fixed&&h,S=e.headDraggable&&!e.fixed&&h;if(t.current.visProp.fixed=v,t.current.visProp.highlight=!v,t.current.visProp.visible=h,t.current.visPropCalc.visible=h,l.current.visProp.visible=u,l.current.visPropCalc.visible=u,i.current.visProp.visible=S,i.current.visPropCalc.visible=S,L.sourceInformation&&_ in L.sourceInformation){let b=L.sourceInformation[_];b.vertex===0?n.updateInfobox(l.current):b.vertex===1&&n.updateInfobox(i.current)}let E=10*e.layer+B;if(t.current.visProp.layer!==E){let b=10*e.layer+T;t.current.setAttribute({layer:E}),l.current.setAttribute({layer:b}),i.current.setAttribute({layer:b})}let C=Y==="dark"?e.selectedStyle.lineColorDarkMode:e.selectedStyle.lineColor;C=C.toLowerCase(),t.current.visProp.strokecolor!==C&&(t.current.visProp.strokecolor=C,t.current.visProp.highlightstrokecolor=C),t.current.visProp.strokewidth!==e.selectedStyle.lineWidth&&(t.current.visProp.strokewidth=e.selectedStyle.lineWidth,t.current.visProp.highlightstrokewidth=e.selectedStyle.lineWidth),t.current.visProp.strokeopacity!==e.selectedStyle.lineOpacity&&(t.current.visProp.strokeopacity=e.selectedStyle.lineOpacity,t.current.visProp.highlightstrokeopacity=e.selectedStyle.lineOpacity*.5);let g=N(e.selectedStyle.lineStyle);t.current.visProp.dash!==g&&(t.current.visProp.dash=g),t.current.name=e.labelForGraph;let k=e.showLabel&&e.labelForGraph!=="";k!=U.current&&(t.current.setAttribute({withlabel:k}),U.current=k),t.current.needsUpdate=!0,t.current.update(),t.current.hasLabel&&(e.applyStyleToLabel?t.current.label.visProp.strokecolor=C:t.current.label.visProp.strokecolor="var(--canvastext)",t.current.label.needsUpdate=!0,t.current.label.update()),l.current.needsUpdate=!0,l.current.update(),i.current.needsUpdate=!0,i.current.update(),n.updateRenderer()}return V(W,{children:V("a",{name:A})})}if(e.hidden)return null;let q="\\("+e.latex+"\\)";return re(W,{children:[V("a",{name:A}),V("span",{id:A,children:V(ne.MathJax,{hideUntilTypeset:"first",inline:!0,dynamic:!0,children:q})})]})});function N(O){return O==="solid"?0:O==="dashed"?2:O==="dotted"?1:0}export{se as default}; diff --git a/dist/assets/video-9bb16c8c.js b/dist/assets/video-44f5e648.js similarity index 97% rename from dist/assets/video-9bb16c8c.js rename to dist/assets/video-44f5e648.js index 27f7140698..ccf84471a3 100644 --- a/dist/assets/video-9bb16c8c.js +++ b/dist/assets/video-44f5e648.js @@ -1,4 +1,4 @@ -import{av as W,bn as L,r as u,ad as M,j as p,a as I,s as z}from"./index-61b6fc23.js";import{s as F}from"./css-14ccef8c.js";import{V as _}from"./visibility-sensor-398e690f.js";const B=z.div` +import{av as W,bn as L,r as u,ad as M,j as p,a as I,s as z}from"./index-9d63439d.js";import{s as F}from"./css-14ccef8c.js";import{V as _}from"./visibility-sensor-aefdbbd5.js";const B=z.div` &: focus { outline: 2px solid var(--canvastext); outline-offset: 2px; diff --git a/dist/assets/visibility-sensor-398e690f.js b/dist/assets/visibility-sensor-aefdbbd5.js similarity index 99% rename from dist/assets/visibility-sensor-398e690f.js rename to dist/assets/visibility-sensor-aefdbbd5.js index fb35c9bb44..566e27458b 100644 --- a/dist/assets/visibility-sensor-398e690f.js +++ b/dist/assets/visibility-sensor-aefdbbd5.js @@ -1 +1 @@ -import{at as F,r as N,au as H,aa as G}from"./index-61b6fc23.js";var z={},Y={get exports(){return z},set exports(w){z=w}};(function(w,J){(function(U,p){w.exports=p(N,H)})(G,function(j,U){return function(p){var b={};function n(e){if(b[e])return b[e].exports;var o=b[e]={i:e,l:!1,exports:{}};return p[e].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=p,n.c=b,n.d=function(e,o,h){n.o(e,o)||Object.defineProperty(e,o,{enumerable:!0,get:h})},n.r=function(e){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,o){if(o&1&&(e=n(e)),o&8||o&4&&typeof e=="object"&&e&&e.__esModule)return e;var h=Object.create(null);if(n.r(h),Object.defineProperty(h,"default",{enumerable:!0,value:e}),o&2&&typeof e!="string")for(var s in e)n.d(h,s,function(d){return e[d]}.bind(null,s));return h},n.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(o,"a",o),o},n.o=function(e,o){return Object.prototype.hasOwnProperty.call(e,o)},n.p="",n(n.s=4)}([function(p,b,n){p.exports=n(5)()},function(p,b){p.exports=j},function(p,b){p.exports=U},function(p,b){p.exports=function(n,e,o){var h=n.direction,s=n.value;switch(h){case"top":return o.top+se.bottom&&o.lefte.right;case"left":return o.left+se.bottom&&o.tope.right;case"bottom":return o.bottom-s>e.bottom&&o.lefte.right&&o.tope.right&&o.lefte.bottom}}},function(p,b,n){n.r(b),n.d(b,"default",function(){return W});var e=n(1),o=n.n(e),h=n(2),s=n.n(h),d=n(0),i=n.n(d),R=n(3),B=n.n(R);function _(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_=function(l){return typeof l}:_=function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},_(r)}function A(r,a){if(!(r instanceof a))throw new TypeError("Cannot call a class as a function")}function S(r,a){for(var l=0;l-1?C=function(){c||(c=setTimeout(m,g||0))}:C=function(){clearTimeout(c),c=setTimeout(m,u||0)};var D={target:y,fn:C,getLastTimeout:function(){return c}};y.addEventListener(f,D.fn),t.debounceCheck[f]=D}),v(O(t),"startWatching",function(){t.debounceCheck||t.interval||(t.props.intervalCheck&&(t.interval=setInterval(t.check,t.props.intervalDelay)),t.props.scrollCheck&&t.addEventListener(t.getContainer(),"scroll",t.props.scrollDelay,t.props.scrollThrottle),t.props.resizeCheck&&t.addEventListener(window,"resize",t.props.resizeDelay,t.props.resizeThrottle),!t.props.delayedCall&&t.check())}),v(O(t),"stopWatching",function(){if(t.debounceCheck){for(var y in t.debounceCheck)if(t.debounceCheck.hasOwnProperty(y)){var f=t.debounceCheck[y];clearTimeout(f.getLastTimeout()),f.target.removeEventListener(y,f.fn),t.debounceCheck[y]=null}}t.debounceCheck=null,t.interval&&(t.interval=clearInterval(t.interval))}),v(O(t),"check",function(){var y=t.node,f,u;if(!y)return t.state;if(f=K(t.roundRectDown(y.getBoundingClientRect())),t.props.containment){var g=t.props.containment.getBoundingClientRect();u={top:g.top,left:g.left,bottom:g.bottom,right:g.right}}else u={top:0,left:0,bottom:window.innerHeight||document.documentElement.clientHeight,right:window.innerWidth||document.documentElement.clientWidth};var c=t.props.offset||{},C=_(c)==="object";C&&(u.top+=c.top||0,u.left+=c.left||0,u.bottom-=c.bottom||0,u.right-=c.right||0);var m={top:f.top>=u.top,left:f.left>=u.left,bottom:f.bottom<=u.bottom,right:f.right<=u.right},D=f.height>0&&f.width>0,T=D||!t.props.requireContentsSize,E=T&&m.top&&m.left&&m.bottom&&m.right;if(T&&t.props.partialVisibility){var V=f.top<=u.bottom&&f.bottom>=u.top&&f.left<=u.right&&f.right>=u.left;typeof t.props.partialVisibility=="string"&&(V=m[t.props.partialVisibility]),E=t.props.minTopValue?V&&f.top<=u.bottom-t.props.minTopValue:V}typeof c.direction=="string"&&typeof c.value=="number"&&(console.warn("[notice] offset.direction and offset.value have been deprecated. They still work for now, but will be removed in next major version. Please upgrade to the new syntax: { %s: %d }",c.direction,c.value),E=B()(c,f,u));var L=t.state;return t.state.isVisible!==E&&(L={isVisible:E,visibilityRect:m},t.setState(L),t.props.onChange&&t.props.onChange(E)),L}),t.state={isVisible:null,visibilityRect:{}},t}return x(a,[{key:"componentDidMount",value:function(){this.node=s.a.findDOMNode(this),this.props.active&&this.startWatching()}},{key:"componentWillUnmount",value:function(){this.stopWatching()}},{key:"componentDidUpdate",value:function(t){this.node=s.a.findDOMNode(this),this.props.active&&!t.active?(this.setState({isVisible:null,visibilityRect:{}}),this.startWatching()):this.props.active||this.stopWatching()}},{key:"roundRectDown",value:function(t){return{top:Math.floor(t.top),left:Math.floor(t.left),bottom:Math.floor(t.bottom),right:Math.floor(t.right)}}},{key:"render",value:function(){return this.props.children instanceof Function?this.props.children({isVisible:this.state.isVisible,visibilityRect:this.state.visibilityRect}):o.a.Children.only(this.props.children)}}]),a}(o.a.Component);v(W,"defaultProps",{active:!0,partialVisibility:!1,minTopValue:0,scrollCheck:!1,scrollDelay:250,scrollThrottle:-1,resizeCheck:!1,resizeDelay:250,resizeThrottle:-1,intervalCheck:!0,intervalDelay:100,delayedCall:!1,offset:{},containment:null,children:o.a.createElement("span",null),requireContentsSize:!0}),v(W,"propTypes",{onChange:i.a.func,active:i.a.bool,partialVisibility:i.a.oneOfType([i.a.bool,i.a.oneOf(["top","right","bottom","left"])]),delayedCall:i.a.bool,offset:i.a.oneOfType([i.a.shape({top:i.a.number,left:i.a.number,bottom:i.a.number,right:i.a.number}),i.a.shape({direction:i.a.oneOf(["top","right","bottom","left"]),value:i.a.number})]),scrollCheck:i.a.bool,scrollDelay:i.a.number,scrollThrottle:i.a.number,resizeCheck:i.a.bool,resizeDelay:i.a.number,resizeThrottle:i.a.number,intervalCheck:i.a.bool,intervalDelay:i.a.number,containment:typeof window<"u"?i.a.instanceOf(window.Element):i.a.any,children:i.a.oneOfType([i.a.element,i.a.func]),minTopValue:i.a.number,requireContentsSize:i.a.bool})},function(p,b,n){var e=n(6);function o(){}function h(){}h.resetWarningCache=o,p.exports=function(){function s(R,B,_,A,S,x){if(x!==e){var P=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw P.name="Invariant Violation",P}}s.isRequired=s;function d(){return s}var i={array:s,bool:s,func:s,number:s,object:s,string:s,symbol:s,any:s,arrayOf:d,element:s,elementType:s,instanceOf:d,node:s,objectOf:d,oneOf:d,oneOfType:d,shape:d,exact:d,checkPropTypes:h,resetWarningCache:o};return i.PropTypes=i,i}},function(p,b,n){var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";p.exports=e}])})})(Y);const X=F(z);export{X as V}; +import{at as F,r as N,au as H,aa as G}from"./index-9d63439d.js";var z={},Y={get exports(){return z},set exports(w){z=w}};(function(w,J){(function(U,p){w.exports=p(N,H)})(G,function(j,U){return function(p){var b={};function n(e){if(b[e])return b[e].exports;var o=b[e]={i:e,l:!1,exports:{}};return p[e].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=p,n.c=b,n.d=function(e,o,h){n.o(e,o)||Object.defineProperty(e,o,{enumerable:!0,get:h})},n.r=function(e){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,o){if(o&1&&(e=n(e)),o&8||o&4&&typeof e=="object"&&e&&e.__esModule)return e;var h=Object.create(null);if(n.r(h),Object.defineProperty(h,"default",{enumerable:!0,value:e}),o&2&&typeof e!="string")for(var s in e)n.d(h,s,function(d){return e[d]}.bind(null,s));return h},n.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(o,"a",o),o},n.o=function(e,o){return Object.prototype.hasOwnProperty.call(e,o)},n.p="",n(n.s=4)}([function(p,b,n){p.exports=n(5)()},function(p,b){p.exports=j},function(p,b){p.exports=U},function(p,b){p.exports=function(n,e,o){var h=n.direction,s=n.value;switch(h){case"top":return o.top+se.bottom&&o.lefte.right;case"left":return o.left+se.bottom&&o.tope.right;case"bottom":return o.bottom-s>e.bottom&&o.lefte.right&&o.tope.right&&o.lefte.bottom}}},function(p,b,n){n.r(b),n.d(b,"default",function(){return W});var e=n(1),o=n.n(e),h=n(2),s=n.n(h),d=n(0),i=n.n(d),R=n(3),B=n.n(R);function _(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_=function(l){return typeof l}:_=function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},_(r)}function A(r,a){if(!(r instanceof a))throw new TypeError("Cannot call a class as a function")}function S(r,a){for(var l=0;l-1?C=function(){c||(c=setTimeout(m,g||0))}:C=function(){clearTimeout(c),c=setTimeout(m,u||0)};var D={target:y,fn:C,getLastTimeout:function(){return c}};y.addEventListener(f,D.fn),t.debounceCheck[f]=D}),v(O(t),"startWatching",function(){t.debounceCheck||t.interval||(t.props.intervalCheck&&(t.interval=setInterval(t.check,t.props.intervalDelay)),t.props.scrollCheck&&t.addEventListener(t.getContainer(),"scroll",t.props.scrollDelay,t.props.scrollThrottle),t.props.resizeCheck&&t.addEventListener(window,"resize",t.props.resizeDelay,t.props.resizeThrottle),!t.props.delayedCall&&t.check())}),v(O(t),"stopWatching",function(){if(t.debounceCheck){for(var y in t.debounceCheck)if(t.debounceCheck.hasOwnProperty(y)){var f=t.debounceCheck[y];clearTimeout(f.getLastTimeout()),f.target.removeEventListener(y,f.fn),t.debounceCheck[y]=null}}t.debounceCheck=null,t.interval&&(t.interval=clearInterval(t.interval))}),v(O(t),"check",function(){var y=t.node,f,u;if(!y)return t.state;if(f=K(t.roundRectDown(y.getBoundingClientRect())),t.props.containment){var g=t.props.containment.getBoundingClientRect();u={top:g.top,left:g.left,bottom:g.bottom,right:g.right}}else u={top:0,left:0,bottom:window.innerHeight||document.documentElement.clientHeight,right:window.innerWidth||document.documentElement.clientWidth};var c=t.props.offset||{},C=_(c)==="object";C&&(u.top+=c.top||0,u.left+=c.left||0,u.bottom-=c.bottom||0,u.right-=c.right||0);var m={top:f.top>=u.top,left:f.left>=u.left,bottom:f.bottom<=u.bottom,right:f.right<=u.right},D=f.height>0&&f.width>0,T=D||!t.props.requireContentsSize,E=T&&m.top&&m.left&&m.bottom&&m.right;if(T&&t.props.partialVisibility){var V=f.top<=u.bottom&&f.bottom>=u.top&&f.left<=u.right&&f.right>=u.left;typeof t.props.partialVisibility=="string"&&(V=m[t.props.partialVisibility]),E=t.props.minTopValue?V&&f.top<=u.bottom-t.props.minTopValue:V}typeof c.direction=="string"&&typeof c.value=="number"&&(console.warn("[notice] offset.direction and offset.value have been deprecated. They still work for now, but will be removed in next major version. Please upgrade to the new syntax: { %s: %d }",c.direction,c.value),E=B()(c,f,u));var L=t.state;return t.state.isVisible!==E&&(L={isVisible:E,visibilityRect:m},t.setState(L),t.props.onChange&&t.props.onChange(E)),L}),t.state={isVisible:null,visibilityRect:{}},t}return x(a,[{key:"componentDidMount",value:function(){this.node=s.a.findDOMNode(this),this.props.active&&this.startWatching()}},{key:"componentWillUnmount",value:function(){this.stopWatching()}},{key:"componentDidUpdate",value:function(t){this.node=s.a.findDOMNode(this),this.props.active&&!t.active?(this.setState({isVisible:null,visibilityRect:{}}),this.startWatching()):this.props.active||this.stopWatching()}},{key:"roundRectDown",value:function(t){return{top:Math.floor(t.top),left:Math.floor(t.left),bottom:Math.floor(t.bottom),right:Math.floor(t.right)}}},{key:"render",value:function(){return this.props.children instanceof Function?this.props.children({isVisible:this.state.isVisible,visibilityRect:this.state.visibilityRect}):o.a.Children.only(this.props.children)}}]),a}(o.a.Component);v(W,"defaultProps",{active:!0,partialVisibility:!1,minTopValue:0,scrollCheck:!1,scrollDelay:250,scrollThrottle:-1,resizeCheck:!1,resizeDelay:250,resizeThrottle:-1,intervalCheck:!0,intervalDelay:100,delayedCall:!1,offset:{},containment:null,children:o.a.createElement("span",null),requireContentsSize:!0}),v(W,"propTypes",{onChange:i.a.func,active:i.a.bool,partialVisibility:i.a.oneOfType([i.a.bool,i.a.oneOf(["top","right","bottom","left"])]),delayedCall:i.a.bool,offset:i.a.oneOfType([i.a.shape({top:i.a.number,left:i.a.number,bottom:i.a.number,right:i.a.number}),i.a.shape({direction:i.a.oneOf(["top","right","bottom","left"]),value:i.a.number})]),scrollCheck:i.a.bool,scrollDelay:i.a.number,scrollThrottle:i.a.number,resizeCheck:i.a.bool,resizeDelay:i.a.number,resizeThrottle:i.a.number,intervalCheck:i.a.bool,intervalDelay:i.a.number,containment:typeof window<"u"?i.a.instanceOf(window.Element):i.a.any,children:i.a.oneOfType([i.a.element,i.a.func]),minTopValue:i.a.number,requireContentsSize:i.a.bool})},function(p,b,n){var e=n(6);function o(){}function h(){}h.resetWarningCache=o,p.exports=function(){function s(R,B,_,A,S,x){if(x!==e){var P=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw P.name="Invariant Violation",P}}s.isRequired=s;function d(){return s}var i={array:s,bool:s,func:s,number:s,object:s,string:s,symbol:s,any:s,arrayOf:d,element:s,elementType:s,instanceOf:d,node:s,objectOf:d,oneOf:d,oneOfType:d,shape:d,exact:d,checkPropTypes:h,resetWarningCache:o};return i.PropTypes=i,i}},function(p,b,n){var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";p.exports=e}])})})(Y);const X=F(z);export{X as V}; diff --git a/dist/index.html b/dist/index.html index 3b8a9bc872..03f143630b 100644 --- a/dist/index.html +++ b/dist/index.html @@ -125,7 +125,7 @@ margin: 0; } - + diff --git a/src/Tools/_framework/Paths/PortfolioActivityViewer.jsx b/src/Tools/_framework/Paths/PortfolioActivityViewer.jsx index c06373b0ea..fa57b8e43c 100644 --- a/src/Tools/_framework/Paths/PortfolioActivityViewer.jsx +++ b/src/Tools/_framework/Paths/PortfolioActivityViewer.jsx @@ -1,31 +1,45 @@ import React from 'react'; -import { redirect, useLoaderData, useNavigate, useOutletContext } from 'react-router'; +import { + redirect, + useLoaderData, + useNavigate, + useOutletContext, +} from 'react-router'; import styled from 'styled-components'; import Button from '../../../_reactComponents/PanelHeaderComponents/Button'; import PageViewer from '../../../Viewer/PageViewer'; -import { pageVariantInfoAtom, pageVariantPanelAtom } from '../../../_sharedRecoil/PageViewerRecoil'; +import { + pageVariantInfoAtom, + pageVariantPanelAtom, +} from '../../../_sharedRecoil/PageViewerRecoil'; import { useRecoilState, useSetRecoilState } from 'recoil'; import { checkIfUserClearedOut } from '../../../_utils/applicationUtils'; import { Form, Link } from 'react-router-dom'; import { Avatar } from '@chakra-ui/react'; import { pageToolViewAtom } from '../NewToolRoot'; -export async function action({params}){ - let response = await fetch(`/api/duplicatePortfolioActivity.php?doenetId=${params.doenetId}`); +export async function action({ params }) { + let response = await fetch( + `/api/duplicatePortfolioActivity.php?doenetId=${params.doenetId}`, + ); let respObj = await response.json(); const { nextActivityDoenetId, nextPageDoenetId } = respObj; - return redirect(`/portfolioeditor/${nextActivityDoenetId}?tool=editor&doenetId=${nextActivityDoenetId}&pageId=${nextPageDoenetId}`); + return redirect( + `/portfolioeditor/${nextActivityDoenetId}?tool=editor&doenetId=${nextActivityDoenetId}&pageId=${nextPageDoenetId}`, + ); } -export async function loader({params}){ +export async function loader({ params }) { //Check if signedIn const profileInfo = await checkIfUserClearedOut(); let signedIn = true; - if (profileInfo.cookieRemoved){ + if (profileInfo.cookieRemoved) { signedIn = false; } - const response = await fetch(`/api/getPortfolioActivityView.php?doenetId=${params.doenetId}`); + const response = await fetch( + `/api/getPortfolioActivityView.php?doenetId=${params.doenetId}`, + ); const data = await response.json(); // const doenetMLResponse = await fetch(`/media/byPageId/${data.pageDoenetId}.doenet`); @@ -33,7 +47,7 @@ export async function loader({params}){ const cidResponse = await fetch(`/media/${data.json.assignedCid}.doenet`); const activityML = await cidResponse.text(); - + //Find the first page's doenetML const regex = //; const pageIds = activityML.match(regex); @@ -44,12 +58,12 @@ export async function loader({params}){ return { doenetML, signedIn, - label:data.label, + label: data.label, fullName: data.firstName + ' ' + data.lastName, - courseId:data.courseId, - doenetId:params.doenetId, - pageDoenetId:data.pageDoenetId, - } + courseId: data.courseId, + doenetId: params.doenetId, + pageDoenetId: data.pageDoenetId, + }; } const PageContainer = styled.div` @@ -58,7 +72,7 @@ const PageContainer = styled.div` height: 100%; width: 100%; /* background: var(--solidLightBlue); */ -` +`; const Header = styled.header` grid-row: 1 / 2; @@ -71,15 +85,15 @@ const Header = styled.header` width: 100%; background: var(--mainGray); z-index: 100; -` +`; // background: var(--canvas); const ViewerOutsideContainer = styled.div` grid-row: 2 / 3; display: grid; grid-template-columns: auto min-content auto; min-height: calc(100vh - 100px); - background: var(--solidLightBlue); //Gutter color - ` + background: var(--solidLightBlue); //Gutter color +`; const ViewerInsideContainer = styled.div` grid-column: 2 / 3; @@ -89,12 +103,12 @@ const ViewerInsideContainer = styled.div` min-height: calc(100vh - 100px); background: var(--canvas); border: 1px solid #949494; //Viewer Outline - margin: 20px 0px 20px 0px; //Only need when there is an outline + margin: 20px 0px 20px 0px; //Only need when there is an outline padding: 20px 5px 20px 5px; @media (max-width: 850px) { width: 100vw; } -` +`; const HeaderContent = styled.div` max-width: 800px; @@ -104,18 +118,17 @@ const HeaderContent = styled.div` display: flex; justify-content: space-between; align-items: center; - -` +`; const HeaderSectionLeft = styled.div` margin: 5px; height: 30px; -` +`; const HeaderSectionRight = styled.div` margin: 5px; height: 30px; display: flex; justify-content: flex-end; -` +`; const Label = styled.div` font-size: 1.4em; font-weight: bold; @@ -123,42 +136,43 @@ const Label = styled.div` overflow: hidden; text-overflow: ellipsis; white-space: nowrap; -` +`; const AvatarLink = styled(Link)` text-decoration: none; color: black; position: relative; -` +`; const Byline = styled.small` position: absolute; left: 36px; - top: 8px; + top: 8px; width: 400px; -` +`; export function PortfolioActivityViewer() { - const { + const { doenetML, - signedIn, - label, - fullName, + signedIn, + label, + fullName, courseId, doenetId, - pageDoenetId, + pageDoenetId, } = useLoaderData(); const navigate = useNavigate(); const setPageToolView = useSetRecoilState(pageToolViewAtom); - const setVariantPanel = useSetRecoilState(pageVariantPanelAtom); const [variantInfo, setVariantInfo] = useRecoilState(pageVariantInfoAtom); function variantCallback(generatedVariantInfo, allPossibleVariants) { // console.log(">>>variantCallback",generatedVariantInfo,allPossibleVariants) - const cleanGeneratedVariant = JSON.parse(JSON.stringify(generatedVariantInfo)) + const cleanGeneratedVariant = JSON.parse( + JSON.stringify(generatedVariantInfo), + ); setVariantPanel({ index: cleanGeneratedVariant.index, allPossibleVariants, @@ -168,69 +182,77 @@ export function PortfolioActivityViewer() { }); } - return (<> - - -
- -
- - - By {fullName} -
-
-
-
-
- - - - - - -
-) + return ( + <> + +
+ +
+ + + + + + {' '} + By {fullName} + + +
+
+ +
+
+
+ + + + + +
+ + ); } - -