@pie-element/math-inline 11.0.0-next.42 → 11.0.0-next.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/module/configure.js +1 -0
- package/module/controller.js +3857 -0
- package/module/demo.js +66 -0
- package/module/element.js +1 -0
- package/module/index.html +21 -0
- package/module/manifest.json +18 -0
- package/module/print-demo.js +104 -0
- package/module/print.html +18 -0
- package/module/print.js +1 -0
- package/package.json +9 -5
package/module/print.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_dll_react_dom as e,_dll_react as t,_dll_mui__material_styles as s,_dll_prop_types as o,_dll_pie_lib__render_ui as n,_dll_pie_lib__correct_answer_toggle as i,_dll_mui__material as a,_dll_lodash as r,_dll_debug as l}from"../../../@pie-lib/shared-module@^3.0.5/module/index.js";import{_dll_pie_lib__math_rendering as c}from"../../../@pie-lib/math-rendering-module@^4.0.5/module/index.js";import{_dll_pie_lib__math_toolbar as p,_dll_pie_lib__math_input as h,_dll_pie_framework__mathquill as d}from"../../../@pie-lib/math-edit-module@^3.0.5/module/index.js";var u,g=e;u=g.createRoot,g.hydrateRoot;const m="Advanced Multi",f="Simple",y=t,{styled:b}=s,x=o,{color:v}=n,{MathToolbar:S}=p,{mq:w}=h,k=b("div")(({theme:e})=>({marginTop:e.spacing(2),marginBottom:e.spacing(2),padding:e.spacing(1)})),C=b("div",{shouldForwardProp:e=>!["isCorrect","isIncorrect"].includes(e)})(({theme:e,isCorrect:t,isIncorrect:s})=>({color:v.text(),background:v.background(),border:t?`2px solid ${v.correct()} !important`:s?`2px solid ${v.incorrect()} !important`:`1px solid ${v.primaryLight()}`,width:"fit-content",fontSize:"1rem",padding:t||s?e.spacing(1):e.spacing(.5),letterSpacing:t||s?"0.5px":"normal","& > .mq-math-mode":{"& > .mq-hasCursor":{"& > .mq-cursor":{display:"none"}}}}));if("undefined"!=typeof document){const e="math-inline-simple-question-styles";if(!document.getElementById(e)){const t=document.createElement("style");t.id=e,t.textContent=`\n .response-editor {\n display: flex;\n justify-content: center;\n width: auto;\n max-width: fit-content;\n height: auto;\n text-align: left;\n padding: 8px;\n }\n .response-editor.mq-math-mode {\n border: 1px solid ${v.primaryLight()};\n }\n `,document.head.appendChild(t)}}class L extends y.Component{static __initStatic(){this.propTypes={onSimpleResponseChange:x.func,model:x.object.isRequired,emptyResponse:x.bool,session:x.object.isRequired,showCorrect:x.bool,onSubFieldFocus:x.func.isRequired,showKeypad:x.bool.isRequired}}constructor(e){super(e),L.prototype.__init.call(this),L.prototype.__init2.call(this),L.prototype.__init3.call(this),this.mathToolBarId=`math-toolbar-${(new Date).getTime()}`}__init(){this.mathToolBarContainsTarget=e=>document.getElementById(this.mathToolBarId).contains(e.target)}__init2(){this.handleClick=e=>{try{this.mathToolBarContainsTarget(e)||this.setState({showKeypad:!1})}catch(e){}}}__init3(){this.onFocus=()=>{const{onSubFieldFocus:e}=this.props;e(this.mathToolBarId)}}render(){const{model:e,showCorrect:t,session:s,emptyResponse:o,onSimpleResponseChange:n,showKeypad:i}=this.props,{config:a,disabled:r,correctness:l}=e||{};if(!a)return;const c=l&&l.correct,{responses:p,equationEditor:h}=a;return y.createElement(k,{"data-keypad":!0},t||r?y.createElement(C,{isIncorrect:!o&&!c&&!t,isCorrect:!o&&(c||t)},y.createElement(w.Static,{latex:t?p&&p.length&&p[0].answer:s.response||""})):y.createElement("div",{id:this.mathToolBarId},y.createElement(S,{classNames:{editor:"response-editor"},latex:s.response,keypadMode:h,onChange:n,onDone:()=>{},onFocus:this.onFocus,controlledKeypad:!0,showKeypad:i,hideDoneButton:!0})))}}function A(e,t){return null!=e?e:t()}function O(e){let t,s=e[0],o=1;for(;o<e.length;){const n=e[o],i=e[o+1];if(o+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=i(s)):"call"!==n&&"optionalCall"!==n||(s=i((...e)=>s.call(t,...e)),t=void 0)}return s}L.__initStatic();const E=e=>"string"==typeof e,R=()=>{let e,t;const s=new Promise((s,o)=>{e=s,t=o});return s.resolve=e,s.reject=t,s},_=e=>null==e?"":""+e,$=/###/g,N=e=>e&&e.indexOf("###")>-1?e.replace($,"."):e,P=e=>!e||E(e),T=(e,t,s)=>{const o=E(t)?t.split("."):t;let n=0;for(;n<o.length-1;){if(P(e))return{};const t=N(o[n]);!e[t]&&s&&(e[t]=new s),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++n}return P(e)?{}:{obj:e,k:N(o[n])}},j=(e,t,s)=>{const{obj:o,k:n}=T(e,t,Object);if(void 0!==o||1===t.length)return void(o[n]=s);let i=t[t.length-1],a=t.slice(0,t.length-1),r=T(e,a,Object);for(;void 0===r.obj&&a.length;)i=`${a[a.length-1]}.${i}`,a=a.slice(0,a.length-1),r=T(e,a,Object),O([r,"optionalAccess",e=>e.obj])&&void 0!==r.obj[`${r.k}.${i}`]&&(r.obj=void 0);r.obj[`${r.k}.${i}`]=s},F=(e,t)=>{const{obj:s,k:o}=T(e,t);if(s&&Object.prototype.hasOwnProperty.call(s,o))return s[o]},I=(e,t,s)=>{for(const o in t)"__proto__"!==o&&"constructor"!==o&&(o in e?E(e[o])||e[o]instanceof String||E(t[o])||t[o]instanceof String?s&&(e[o]=t[o]):I(e[o],t[o],s):e[o]=t[o]);return e},D=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var q={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const M=e=>E(e)?e.replace(/[&<>"'\/]/g,e=>q[e]):e;const B=[" ",",","?","!",";"],V=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(void 0!==t)return t;const s=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,s),this.regExpQueue.push(e),s}}(20),K=(e,t,s=".")=>{if(!e)return;if(e[t]){if(!Object.prototype.hasOwnProperty.call(e,t))return;return e[t]}const o=t.split(s);let n=e;for(let e=0;e<o.length;){if(!n||"object"!=typeof n)return;let t,i="";for(let a=e;a<o.length;++a)if(a!==e&&(i+=s),i+=o[a],t=n[i],void 0!==t){if(["string","number","boolean"].indexOf(typeof t)>-1&&a<o.length-1)continue;e+=a-e+1;break}n=t}return n},U=e=>O([e,"optionalAccess",e=>e.replace,"call",e=>e("_","-")]),z={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){O([console,"optionalAccess",t=>t[e],"optionalAccess",e=>e.apply,"optionalCall",e=>e(console,t)])}};class H{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||z,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,s,o){return o&&!this.debug?null:(E(e[0])&&(e[0]=`${s}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new H(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new H(this.logger,e)}}var W=new H;class J{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(e=>{this.observers[e]||(this.observers[e]=new Map);const s=this.observers[e].get(t)||0;this.observers[e].set(t,s+1)}),this}off(e,t){this.observers[e]&&(t?this.observers[e].delete(t):delete this.observers[e])}emit(e,...t){if(this.observers[e]){Array.from(this.observers[e].entries()).forEach(([e,s])=>{for(let o=0;o<s;o++)e(...t)})}if(this.observers["*"]){Array.from(this.observers["*"].entries()).forEach(([s,o])=>{for(let n=0;n<o;n++)s.apply(s,[e,...t])})}}}class Y extends J{constructor(e,t={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,s,o={}){const n=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator,i=void 0!==o.ignoreJSONStructure?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;e.indexOf(".")>-1?a=e.split("."):(a=[e,t],s&&(Array.isArray(s)?a.push(...s):E(s)&&n?a.push(...s.split(n)):a.push(s)));const r=F(this.data,a);return!r&&!t&&!s&&e.indexOf(".")>-1&&(e=a[0],t=a[1],s=a.slice(2).join(".")),!r&&i&&E(s)?K(O([this,"access",e=>e.data,"optionalAccess",t=>t[e],"optionalAccess",e=>e[t]]),s,n):r}addResource(e,t,s,o,n={silent:!1}){const i=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator;let a=[e,t];s&&(a=a.concat(i?s.split(i):s)),e.indexOf(".")>-1&&(a=e.split("."),o=t,t=a[1]),this.addNamespaces(t),j(this.data,a,o),n.silent||this.emit("added",e,t,s,o)}addResources(e,t,s,o={silent:!1}){for(const o in s)(E(s[o])||Array.isArray(s[o]))&&this.addResource(e,t,o,s[o],{silent:!0});o.silent||this.emit("added",e,t,s)}addResourceBundle(e,t,s,o,n,i={silent:!1,skipCopy:!1}){let a=[e,t];e.indexOf(".")>-1&&(a=e.split("."),o=s,s=t,t=a[1]),this.addNamespaces(t);let r=F(this.data,a)||{};i.skipCopy||(s=JSON.parse(JSON.stringify(s))),o?I(r,s,n):r={...r,...s},j(this.data,a,r),i.silent||this.emit("added",e,t,s)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}}var Q={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,s,o,n){return e.forEach(e=>{t=A(O([this,"access",e=>e.processors,"access",t=>t[e],"optionalAccess",e=>e.process,"call",e=>e(t,s,o,n)]),()=>t)}),t}};const G=Symbol("i18next/PATH_KEY");function X(e,t){const{[G]:s}=e(function(){const e=[],t=Object.create(null);let s;return t.get=(o,n)=>(O([s,"optionalAccess",e=>e.revoke,"optionalCall",e=>e()]),n===G?e:(e.push(n),s=Proxy.revocable(o,t),s.proxy)),Proxy.revocable(Object.create(null),t).proxy}());return s.join(A(O([t,"optionalAccess",e=>e.keySeparator]),()=>"."))}const Z={},ee=e=>!E(e)&&"boolean"!=typeof e&&"number"!=typeof e;class te extends J{constructor(e,t={}){var s,o;super(),s=e,o=this,["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"].forEach(e=>{s[e]&&(o[e]=s[e])}),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=W.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){const s={...t};if(null==e)return!1;const o=this.resolve(e,s);if(void 0===O([o,"optionalAccess",e=>e.res]))return!1;const n=ee(o.res);return!1!==s.returnObjects||!n}extractFromKey(e,t){let s=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===s&&(s=":");const o=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator;let n=t.ns||this.options.defaultNS||[];const i=s&&e.indexOf(s)>-1,a=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||((e,t,s)=>{t=t||"",s=s||"";const o=B.filter(e=>t.indexOf(e)<0&&s.indexOf(e)<0);if(0===o.length)return!0;const n=V.getRegExp(`(${o.map(e=>"?"===e?"\\?":e).join("|")})`);let i=!n.test(e);if(!i){const t=e.indexOf(s);t>0&&!n.test(e.substring(0,t))&&(i=!0)}return i})(e,s,o));if(i&&!a){const t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:E(n)?[n]:n};const i=e.split(s);(s!==o||s===o&&this.options.ns.indexOf(i[0])>-1)&&(n=i.shift()),e=i.join(o)}return{key:e,namespaces:E(n)?[n]:n}}translate(e,t,s){let o="object"==typeof t?{...t}:t;if("object"!=typeof o&&this.options.overloadTranslationOptionHandler&&(o=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof o&&(o={...o}),o||(o={}),null==e)return"";"function"==typeof e&&(e=X(e,{...this.options,...o})),Array.isArray(e)||(e=[String(e)]);const n=void 0!==o.returnDetails?o.returnDetails:this.options.returnDetails,i=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator,{key:a,namespaces:r}=this.extractFromKey(e[e.length-1],o),l=r[r.length-1];let c=void 0!==o.nsSeparator?o.nsSeparator:this.options.nsSeparator;void 0===c&&(c=":");const p=o.lng||this.language,h=o.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if("cimode"===O([p,"optionalAccess",e=>e.toLowerCase,"call",e=>e()]))return h?n?{res:`${l}${c}${a}`,usedKey:a,exactUsedKey:a,usedLng:p,usedNS:l,usedParams:this.getUsedParamsDetails(o)}:`${l}${c}${a}`:n?{res:a,usedKey:a,exactUsedKey:a,usedLng:p,usedNS:l,usedParams:this.getUsedParamsDetails(o)}:a;const d=this.resolve(e,o);let u=O([d,"optionalAccess",e=>e.res]);const g=O([d,"optionalAccess",e=>e.usedKey])||a,m=O([d,"optionalAccess",e=>e.exactUsedKey])||a,f=void 0!==o.joinArrays?o.joinArrays:this.options.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,b=void 0!==o.count&&!E(o.count),x=te.hasDefaultValue(o),v=b?this.pluralResolver.getSuffix(p,o.count,o):"",S=o.ordinal&&b?this.pluralResolver.getSuffix(p,o.count,{ordinal:!1}):"",w=b&&!o.ordinal&&0===o.count,k=w&&o[`defaultValue${this.options.pluralSeparator}zero`]||o[`defaultValue${v}`]||o[`defaultValue${S}`]||o.defaultValue;let C=u;y&&!u&&x&&(C=k);const L=ee(C),A=Object.prototype.toString.apply(C);if(!(y&&C&&L&&["[object Number]","[object Function]","[object RegExp]"].indexOf(A)<0)||E(f)&&Array.isArray(C))if(y&&E(f)&&Array.isArray(u))u=u.join(f),u&&(u=this.extendTranslation(u,e,o,s));else{let t=!1,n=!1;!this.isValidLookup(u)&&x&&(t=!0,u=k),this.isValidLookup(u)||(n=!0,u=a);const r=(o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&n?void 0:u,h=x&&k!==u&&this.options.updateMissing;if(n||t||h){if(this.logger.log(h?"updateKey":"missingKey",p,l,a,h?k:u),i){const e=this.resolve(a,{...o,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[];const t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,o.lng||this.language);if("fallback"===this.options.saveMissingTo&&t&&t[0])for(let s=0;s<t.length;s++)e.push(t[s]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(o.lng||this.language):e.push(o.lng||this.language);const s=(e,t,s)=>{const n=x&&s!==u?s:r;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,n,h,o):O([this,"access",e=>e.backendConnector,"optionalAccess",e=>e.saveMissing])&&this.backendConnector.saveMissing(e,l,t,n,h,o),this.emit("missingKey",e,l,t,u)};this.options.saveMissing&&(this.options.saveMissingPlurals&&b?e.forEach(e=>{const t=this.pluralResolver.getSuffixes(e,o);w&&o[`defaultValue${this.options.pluralSeparator}zero`]&&t.indexOf(`${this.options.pluralSeparator}zero`)<0&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{s([e],a+t,o[`defaultValue${t}`]||k)})}):s(e,a,k))}u=this.extendTranslation(u,e,o,d,s),n&&u===a&&this.options.appendNamespaceToMissingKey&&(u=`${l}${c}${a}`),(n||t)&&this.options.parseMissingKeyHandler&&(u=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${c}${a}`:a,t?u:void 0,o))}else{if(!o.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,C,{...o,ns:r}):`key '${a} (${this.language})' returned an object instead of string.`;return n?(d.res=e,d.usedParams=this.getUsedParamsDetails(o),d):e}if(i){const e=Array.isArray(C),t=e?[]:{},s=e?m:g;for(const e in C)if(Object.prototype.hasOwnProperty.call(C,e)){const n=`${s}${i}${e}`;t[e]=x&&!u?this.translate(n,{...o,defaultValue:ee(k)?k[e]:void 0,joinArrays:!1,ns:r}):this.translate(n,{...o,joinArrays:!1,ns:r}),t[e]===n&&(t[e]=C[e])}u=t}}return n?(d.res=u,d.usedParams=this.getUsedParamsDetails(o),d):u}extendTranslation(e,t,s,o,n){if(O([this,"access",e=>e.i18nFormat,"optionalAccess",e=>e.parse]))e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...s},s.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init({...s,interpolation:{...this.options.interpolation,...s.interpolation}});const i=E(e)&&(void 0!==O([s,"optionalAccess",e=>e.interpolation,"optionalAccess",e=>e.skipOnVariables])?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let a;if(i){const t=e.match(this.interpolator.nestingRegexp);a=t&&t.length}let r=s.replace&&!E(s.replace)?s.replace:s;if(this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),e=this.interpolator.interpolate(e,r,s.lng||this.language||o.usedLng,s),i){const t=e.match(this.interpolator.nestingRegexp);a<(t&&t.length)&&(s.nest=!1)}!s.lng&&o&&o.res&&(s.lng=this.language||o.usedLng),!1!==s.nest&&(e=this.interpolator.nest(e,(...e)=>O([n,"optionalAccess",e=>e[0]])!==e[0]||s.context?this.translate(...e,t):(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null),s)),s.interpolation&&this.interpolator.reset()}const i=s.postProcess||this.options.postProcess,a=E(i)?[i]:i;return null!=e&&O([a,"optionalAccess",e=>e.length])&&!1!==s.applyPostProcessor&&(e=Q.handle(a,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...o,usedParams:this.getUsedParamsDetails(s)},...s}:s,this)),e}resolve(e,t={}){let s,o,n,i,a;return E(e)&&(e=[e]),e.forEach(e=>{if(this.isValidLookup(s))return;const r=this.extractFromKey(e,t),l=r.key;o=l;let c=r.namespaces;this.options.fallbackNS&&(c=c.concat(this.options.fallbackNS));const p=void 0!==t.count&&!E(t.count),h=p&&!t.ordinal&&0===t.count,d=void 0!==t.context&&(E(t.context)||"number"==typeof t.context)&&""!==t.context,u=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);c.forEach(e=>{this.isValidLookup(s)||(a=e,Z[`${u[0]}-${e}`]||!O([this,"access",e=>e.utils,"optionalAccess",e=>e.hasLoadedNamespace])||O([this,"access",e=>e.utils,"optionalAccess",e=>e.hasLoadedNamespace,"call",e=>e(a)])||(Z[`${u[0]}-${e}`]=!0,this.logger.warn(`key "${o}" for languages "${u.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),u.forEach(o=>{if(this.isValidLookup(s))return;i=o;const a=[l];if(O([this,"access",e=>e.i18nFormat,"optionalAccess",e=>e.addLookupKeys]))this.i18nFormat.addLookupKeys(a,l,o,e,t);else{let e;p&&(e=this.pluralResolver.getSuffix(o,t.count,t));const s=`${this.options.pluralSeparator}zero`,n=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(p&&(t.ordinal&&0===e.indexOf(n)&&a.push(l+e.replace(n,this.options.pluralSeparator)),a.push(l+e),h&&a.push(l+s)),d){const o=`${l}${this.options.contextSeparator||"_"}${t.context}`;a.push(o),p&&(t.ordinal&&0===e.indexOf(n)&&a.push(o+e.replace(n,this.options.pluralSeparator)),a.push(o+e),h&&a.push(o+s))}}let r;for(;r=a.pop();)this.isValidLookup(s)||(n=r,s=this.getResource(o,e,r,t))}))})}),{res:s,usedKey:o,exactUsedKey:n,usedLng:i,usedNS:a}}isValidLookup(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}getResource(e,t,s,o={}){return O([this,"access",e=>e.i18nFormat,"optionalAccess",e=>e.getResource])?this.i18nFormat.getResource(e,t,s,o):this.resourceStore.getResource(e,t,s,o)}getUsedParamsDetails(e={}){const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],s=e.replace&&!E(e.replace);let o=s?e.replace:e;if(s&&void 0!==e.count&&(o.count=e.count),this.options.interpolation.defaultVariables&&(o={...this.options.interpolation.defaultVariables,...o}),!s){o={...o};for(const e of t)delete o[e]}return o}static hasDefaultValue(e){const t="defaultValue";for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&t===s.substring(0,12)&&void 0!==e[s])return!0;return!1}}class se{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=W.create("languageUtils")}getScriptPartFromCode(e){if(!(e=U(e))||e.indexOf("-")<0)return null;const t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}getLanguagePartFromCode(e){if(!(e=U(e))||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(E(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch(e){}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;const s=this.formatLanguageCode(e);this.options.supportedLngs&&!this.isSupportedCode(s)||(t=s)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;const s=this.getScriptPartFromCode(e);if(this.isSupportedCode(s))return t=s;const o=this.getLanguagePartFromCode(e);if(this.isSupportedCode(o))return t=o;t=this.options.supportedLngs.find(e=>e===o?e:e.indexOf("-")<0&&o.indexOf("-")<0?void 0:e.indexOf("-")>0&&o.indexOf("-")<0&&e.substring(0,e.indexOf("-"))===o||0===e.indexOf(o)&&o.length>1?e:void 0)}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),E(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let s=e[t];return s||(s=e[this.getScriptPartFromCode(t)]),s||(s=e[this.formatLanguageCode(t)]),s||(s=e[this.getLanguagePartFromCode(t)]),s||(s=e.default),s||[]}toResolveHierarchy(e,t){const s=this.getFallbackCodes((!1===t?[]:t)||this.options.fallbackLng||[],e),o=[],n=e=>{e&&(this.isSupportedCode(e)?o.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return E(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&n(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&n(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&n(this.getLanguagePartFromCode(e))):E(e)&&n(this.formatLanguageCode(e)),s.forEach(e=>{o.indexOf(e)<0&&n(this.formatLanguageCode(e))}),o}}const oe={zero:0,one:1,two:2,few:3,many:4,other:5},ne={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class ie{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=W.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const s=U("dev"===e?"en":e),o=t.ordinal?"ordinal":"cardinal",n=JSON.stringify({cleanedCode:s,type:o});if(n in this.pluralRulesCache)return this.pluralRulesCache[n];let i;try{i=new Intl.PluralRules(s,{type:o})}catch(s){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),ne;if(!e.match(/-|_/))return ne;const o=this.languageUtils.getLanguagePartFromCode(e);i=this.getRule(o,t)}return this.pluralRulesCache[n]=i,i}needsPlural(e,t={}){let s=this.getRule(e,t);return s||(s=this.getRule("dev",t)),O([s,"optionalAccess",e=>e.resolvedOptions,"call",e=>e(),"access",e=>e.pluralCategories,"access",e=>e.length])>1}getPluralFormsOfKey(e,t,s={}){return this.getSuffixes(e,s).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let s=this.getRule(e,t);return s||(s=this.getRule("dev",t)),s?s.resolvedOptions().pluralCategories.sort((e,t)=>oe[e]-oe[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`):[]}getSuffix(e,t,s={}){const o=this.getRule(e,s);return o?`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${o.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,s))}}const ae=(e,t,s,o=".",n=!0)=>{let i=((e,t,s)=>{const o=F(e,s);return void 0!==o?o:F(t,s)})(e,t,s);return!i&&n&&E(s)&&(i=K(e,s,o),void 0===i&&(i=K(t,s,o))),i},re=e=>e.replace(/\$/g,"$$$$");class le{constructor(e={}){this.logger=W.create("interpolator"),this.options=e,this.format=O([e,"optionalAccess",e=>e.interpolation,"optionalAccess",e=>e.format])||(e=>e),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:s,useRawValueToEscape:o,prefix:n,prefixEscaped:i,suffix:a,suffixEscaped:r,formatSeparator:l,unescapeSuffix:c,unescapePrefix:p,nestingPrefix:h,nestingPrefixEscaped:d,nestingSuffix:u,nestingSuffixEscaped:g,nestingOptionsSeparator:m,maxReplaces:f,alwaysFormat:y}=e.interpolation;this.escape=void 0!==t?t:M,this.escapeValue=void 0===s||s,this.useRawValueToEscape=void 0!==o&&o,this.prefix=n?D(n):i||"{{",this.suffix=a?D(a):r||"}}",this.formatSeparator=l||",",this.unescapePrefix=c?"":p||"-",this.unescapeSuffix=this.unescapePrefix?"":c||"",this.nestingPrefix=h?D(h):d||D("$t("),this.nestingSuffix=u?D(u):g||D(")"),this.nestingOptionsSeparator=m||",",this.maxReplaces=f||1e3,this.alwaysFormat=void 0!==y&&y,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(e,t)=>O([e,"optionalAccess",e=>e.source])===t?(e.lastIndex=0,e):new RegExp(t,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,s,o){let n,i,a;const r=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=e=>{if(e.indexOf(this.formatSeparator)<0){const n=ae(t,r,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(n,void 0,s,{...o,...t,interpolationkey:e}):n}const n=e.split(this.formatSeparator),i=n.shift().trim(),a=n.join(this.formatSeparator).trim();return this.format(ae(t,r,i,this.options.keySeparator,this.options.ignoreJSONStructure),a,s,{...o,...t,interpolationkey:i})};this.resetRegExp();const c=O([o,"optionalAccess",e=>e.missingInterpolationHandler])||this.options.missingInterpolationHandler,p=void 0!==O([o,"optionalAccess",e=>e.interpolation,"optionalAccess",e=>e.skipOnVariables])?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>re(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?re(this.escape(e)):re(e)}].forEach(t=>{for(a=0;n=t.regex.exec(e);){const s=n[1].trim();if(i=l(s),void 0===i)if("function"==typeof c){const t=c(e,n,o);i=E(t)?t:""}else if(o&&Object.prototype.hasOwnProperty.call(o,s))i="";else{if(p){i=n[0];continue}this.logger.warn(`missed to pass in variable ${s} for interpolating ${e}`),i=""}else E(i)||this.useRawValueToEscape||(i=_(i));const r=t.safeValue(i);if(e=e.replace(n[0],r),p?(t.regex.lastIndex+=i.length,t.regex.lastIndex-=n[0].length):t.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,t,s={}){let o,n,i;const a=(e,t)=>{const s=this.nestingOptionsSeparator;if(e.indexOf(s)<0)return e;const o=e.split(new RegExp(`${s}[ ]*{`));let n=`{${o[1]}`;e=o[0],n=this.interpolate(n,i);const a=n.match(/'/g),r=n.match(/"/g);(A(O([a,"optionalAccess",e=>e.length]),()=>0)%2==0&&!r||r.length%2!=0)&&(n=n.replace(/'/g,'"'));try{i=JSON.parse(n),t&&(i={...t,...i})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${s}${n}`}return i.defaultValue&&i.defaultValue.indexOf(this.prefix)>-1&&delete i.defaultValue,e};for(;o=this.nestingRegexp.exec(e);){let r=[];i={...s},i=i.replace&&!E(i.replace)?i.replace:i,i.applyPostProcessor=!1,delete i.defaultValue;const l=/{.*}/.test(o[1])?o[1].lastIndexOf("}")+1:o[1].indexOf(this.formatSeparator);if(-1!==l&&(r=o[1].slice(l).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),o[1]=o[1].slice(0,l)),n=t(a.call(this,o[1].trim(),i),i),n&&o[0]===e&&!E(n))return n;E(n)||(n=_(n)),n||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${e}`),n=""),r.length&&(n=r.reduce((e,t)=>this.format(e,t,s.lng,{...s,interpolationkey:o[1].trim()}),n.trim())),e=e.replace(o[0],n),this.regexp.lastIndex=0}return e}}const ce=e=>{const t={};return(s,o,n)=>{let i=n;n&&n.interpolationkey&&n.formatParams&&n.formatParams[n.interpolationkey]&&n[n.interpolationkey]&&(i={...i,[n.interpolationkey]:void 0});const a=o+JSON.stringify(i);let r=t[a];return r||(r=e(U(o),n),t[a]=r),r(s)}},pe=e=>(t,s,o)=>e(U(s),o)(t);class he{constructor(e={}){this.logger=W.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const s=t.cacheInBuiltFormats?ce:pe;this.formats={number:s((e,t)=>{const s=new Intl.NumberFormat(e,{...t});return e=>s.format(e)}),currency:s((e,t)=>{const s=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>s.format(e)}),datetime:s((e,t)=>{const s=new Intl.DateTimeFormat(e,{...t});return e=>s.format(e)}),relativetime:s((e,t)=>{const s=new Intl.RelativeTimeFormat(e,{...t});return e=>s.format(e,t.range||"day")}),list:s((e,t)=>{const s=new Intl.ListFormat(e,{...t});return e=>s.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=ce(t)}format(e,t,s,o={}){const n=t.split(this.formatSeparator);if(n.length>1&&n[0].indexOf("(")>1&&n[0].indexOf(")")<0&&n.find(e=>e.indexOf(")")>-1)){const e=n.findIndex(e=>e.indexOf(")")>-1);n[0]=[n[0],...n.splice(1,e)].join(this.formatSeparator)}return n.reduce((e,t)=>{const{formatName:n,formatOptions:i}=(e=>{let t=e.toLowerCase().trim();const s={};if(e.indexOf("(")>-1){const o=e.split("(");t=o[0].toLowerCase().trim();const n=o[1].substring(0,o[1].length-1);"currency"===t&&n.indexOf(":")<0?s.currency||(s.currency=n.trim()):"relativetime"===t&&n.indexOf(":")<0?s.range||(s.range=n.trim()):n.split(";").forEach(e=>{if(e){const[t,...o]=e.split(":"),n=o.join(":").trim().replace(/^'+|'+$/g,""),i=t.trim();s[i]||(s[i]=n),"false"===n&&(s[i]=!1),"true"===n&&(s[i]=!0),isNaN(n)||(s[i]=parseInt(n,10))}})}return{formatName:t,formatOptions:s}})(t);if(this.formats[n]){let t=e;try{const a=O([o,"optionalAccess",e=>e.formatParams,"optionalAccess",e=>e[o.interpolationkey]])||{},r=a.locale||a.lng||o.locale||o.lng||s;t=this.formats[n](e,r,{...i,...o,...a})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${n}`),e},e)}}class de extends J{constructor(e,t,s,o={}){super(),this.backend=e,this.store=t,this.services=s,this.languageUtils=s.languageUtils,this.options=o,this.logger=W.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],O([this,"access",e=>e.backend,"optionalAccess",e=>e.init,"optionalCall",e=>e(s,o.backend,o)])}queueLoad(e,t,s,o){const n={},i={},a={},r={};return e.forEach(e=>{let o=!0;t.forEach(t=>{const a=`${e}|${t}`;!s.reload&&this.store.hasResourceBundle(e,t)?this.state[a]=2:this.state[a]<0||(1===this.state[a]?void 0===i[a]&&(i[a]=!0):(this.state[a]=1,o=!1,void 0===i[a]&&(i[a]=!0),void 0===n[a]&&(n[a]=!0),void 0===r[t]&&(r[t]=!0)))}),o||(a[e]=!0)}),(Object.keys(n).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(n),pending:Object.keys(i),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(r)}}loaded(e,t,s){const o=e.split("|"),n=o[0],i=o[1];t&&this.emit("failedLoading",n,i,t),!t&&s&&this.store.addResourceBundle(n,i,s,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&s&&(this.state[e]=0);const a={};this.queue.forEach(s=>{((e,t,s)=>{const{obj:o,k:n}=T(e,t,Object);o[n]=o[n]||[],o[n].push(s)})(s.loaded,[n],i),((e,t)=>{void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)})(s,e),t&&s.errors.push(t),0!==s.pendingCount||s.done||(Object.keys(s.loaded).forEach(e=>{a[e]||(a[e]={});const t=s.loaded[e];t.length&&t.forEach(t=>{void 0===a[e][t]&&(a[e][t]=!0)})}),s.done=!0,s.errors.length?s.callback(s.errors):s.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(e=>!e.done)}read(e,t,s,o=0,n=this.retryTimeout,i){if(!e.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:s,tried:o,wait:n,callback:i});this.readingCalls++;const a=(a,r)=>{if(this.readingCalls--,this.waitingReads.length>0){const e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}a&&r&&o<this.maxRetries?setTimeout(()=>{this.read.call(this,e,t,s,o+1,2*n,i)},n):i(a,r)},r=this.backend[s].bind(this.backend);if(2!==r.length)return r(e,t,a);try{const s=r(e,t);s&&"function"==typeof s.then?s.then(e=>a(null,e)).catch(a):a(null,s)}catch(e){a(e)}}prepareLoading(e,t,s={},o){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();E(e)&&(e=this.languageUtils.toResolveHierarchy(e)),E(t)&&(t=[t]);const n=this.queueLoad(e,t,s,o);if(!n.toLoad.length)return n.pending.length||o(),null;n.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,s){this.prepareLoading(e,t,{},s)}reload(e,t,s){this.prepareLoading(e,t,{reload:!0},s)}loadOne(e,t=""){const s=e.split("|"),o=s[0],n=s[1];this.read(o,n,"read",void 0,void 0,(s,i)=>{s&&this.logger.warn(`${t}loading namespace ${n} for language ${o} failed`,s),!s&&i&&this.logger.log(`${t}loaded namespace ${n} for language ${o}`,i),this.loaded(e,s,i)})}saveMissing(e,t,s,o,n,i={},a=()=>{}){if(!O([this,"access",e=>e.services,"optionalAccess",e=>e.utils,"optionalAccess",e=>e.hasLoadedNamespace])||O([this,"access",e=>e.services,"optionalAccess",e=>e.utils,"optionalAccess",e=>e.hasLoadedNamespace,"call",e=>e(t)])){if(null!=s&&""!==s){if(O([this,"access",e=>e.backend,"optionalAccess",e=>e.create])){const r={...i,isUpdate:n},l=this.backend.create.bind(this.backend);if(l.length<6)try{let n;n=5===l.length?l(e,t,s,o,r):l(e,t,s,o),n&&"function"==typeof n.then?n.then(e=>a(null,e)).catch(a):a(null,n)}catch(e){a(e)}else l(e,t,s,o,a,r)}e&&e[0]&&this.store.addResource(e[0],t,s,o)}}else this.logger.warn(`did not save key "${s}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")}}const ue=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if("object"==typeof e[1]&&(t=e[1]),E(e[1])&&(t.defaultValue=e[1]),E(e[2])&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){const s=e[3]||e[2];Object.keys(s).forEach(e=>{t[e]=s[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),ge=e=>(E(e.ns)&&(e.ns=[e.ns]),E(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),E(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),O([e,"access",e=>e.supportedLngs,"optionalAccess",e=>e.indexOf,"optionalCall",e=>e("cimode")])<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),"boolean"==typeof e.initImmediate&&(e.initAsync=e.initImmediate),e),me=()=>{};class fe extends J{constructor(e={},t){var s;if(super(),this.options=ge(e),this.services={},this.logger=W,this.modules={external:[]},s=this,Object.getOwnPropertyNames(Object.getPrototypeOf(s)).forEach(e=>{"function"==typeof s[e]&&(s[e]=s[e].bind(s))}),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,"function"==typeof e&&(t=e,e={}),null==e.defaultNS&&e.ns&&(E(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const s=ue();var o;this.options={...s,...this.options,...ge(e)},this.options.interpolation={...s.interpolation,...this.options.interpolation},void 0!==e.keySeparator&&(this.options.userDefinedKeySeparator=e.keySeparator),void 0!==e.nsSeparator&&(this.options.userDefinedNsSeparator=e.nsSeparator),"function"!=typeof this.options.overloadTranslationOptionHandler&&(this.options.overloadTranslationOptionHandler=s.overloadTranslationOptionHandler),!1===this.options.showSupportNotice||(O([o=this,"optionalAccess",e=>e.modules,"optionalAccess",e=>e.backend,"optionalAccess",e=>e.name,"optionalAccess",e=>e.indexOf,"call",e=>e("Locize")])>0||O([o,"optionalAccess",e=>e.modules,"optionalAccess",e=>e.backend,"optionalAccess",e=>e.constructor,"optionalAccess",e=>e.name,"optionalAccess",e=>e.indexOf,"call",e=>e("Locize")])>0||O([o,"optionalAccess",e=>e.options,"optionalAccess",e=>e.backend,"optionalAccess",e=>e.backends])&&o.options.backend.backends.some(e=>O([e,"optionalAccess",e=>e.name,"access",e=>e.indexOf,"call",e=>e("Locize")])>0||O([e,"optionalAccess",e=>e.constructor,"optionalAccess",e=>e.name,"access",e=>e.indexOf,"call",e=>e("Locize")])>0))||"undefined"!=typeof console&&void 0!==console.info&&console.info("🌐 i18next is maintained with support from locize.com — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙");const n=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let e;this.modules.logger?W.init(n(this.modules.logger),this.options):W.init(null,this.options),e=this.modules.formatter?this.modules.formatter:he;const t=new se(this.options);this.store=new Y(this.options.resources,this.options);const o=this.services;o.logger=W,o.resourceStore=this.store,o.languageUtils=t,o.pluralResolver=new ie(t,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix});this.options.interpolation.format&&this.options.interpolation.format!==s.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),!e||this.options.interpolation.format&&this.options.interpolation.format!==s.interpolation.format||(o.formatter=n(e),o.formatter.init&&o.formatter.init(o,this.options),this.options.interpolation.format=o.formatter.format.bind(o.formatter)),o.interpolator=new le(this.options),o.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},o.backendConnector=new de(n(this.modules.backend),o.resourceStore,o,this.options),o.backendConnector.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(o.languageDetector=n(this.modules.languageDetector),o.languageDetector.init&&o.languageDetector.init(o,this.options.detection,this.options)),this.modules.i18nFormat&&(o.i18nFormat=n(this.modules.i18nFormat),o.i18nFormat.init&&o.i18nFormat.init(this)),this.translator=new te(this.services,this.options),this.translator.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||(t=me),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(e=>{this[e]=(...t)=>this.store[e](...t)});["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});const i=R(),a=()=>{const e=(e,s)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),i.resolve(s),t(e,s)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?a():setTimeout(a,0),i}loadResources(e,t=me){let s=t;const o=E(e)?e:this.language;if("function"==typeof e&&(s=e),!this.options.resources||this.options.partialBundledLanguages){if("cimode"===O([o,"optionalAccess",e=>e.toLowerCase,"call",e=>e()])&&(!this.options.preload||0===this.options.preload.length))return s();const e=[],t=t=>{if(!t)return;if("cimode"===t)return;this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{"cimode"!==t&&e.indexOf(t)<0&&e.push(t)})};if(o)t(o);else{this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e))}O([this,"access",e=>e.options,"access",e=>e.preload,"optionalAccess",e=>e.forEach,"optionalCall",e=>e(e=>t(e))]),this.services.backendConnector.load(e,this.options.ns,e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),s(e)})}else s(null)}reloadResources(e,t,s){const o=R();return"function"==typeof e&&(s=e,e=void 0),"function"==typeof t&&(s=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),s||(s=me),this.services.backendConnector.reload(e,t,e=>{o.resolve(),s(e)}),o}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&Q.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1)){for(let e=0;e<this.languages.length;e++){const t=this.languages[e];if(!(["cimode","dev"].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;const s=R();this.emit("languageChanging",e);const o=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},n=(n,i)=>{i?this.isLanguageChangingTo===e&&(o(i),this.translator.changeLanguage(i),this.isLanguageChangingTo=void 0,this.emit("languageChanged",i),this.logger.log("languageChanged",i)):this.isLanguageChangingTo=void 0,s.resolve((...e)=>this.t(...e)),t&&t(n,(...e)=>this.t(...e))},i=t=>{e||t||!this.services.languageDetector||(t=[]);const s=E(t)?t:t&&t[0],i=this.store.hasLanguageSomeTranslations(s)?s:this.services.languageUtils.getBestMatchFromCodes(E(t)?[t]:t);i&&(this.language||o(i),this.translator.language||this.translator.changeLanguage(i),O([this,"access",e=>e.services,"access",e=>e.languageDetector,"optionalAccess",e=>e.cacheUserLanguage,"optionalCall",e=>e(i)])),this.loadResources(i,e=>{n(e,i)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(i):this.services.languageDetector.detect(i):i(e):i(this.services.languageDetector.detect()),s}getFixedT(e,t,s){const o=(e,t,...n)=>{let i;i="object"!=typeof t?this.options.overloadTranslationOptionHandler([e,t].concat(n)):{...t},i.lng=i.lng||o.lng,i.lngs=i.lngs||o.lngs,i.ns=i.ns||o.ns,""!==i.keyPrefix&&(i.keyPrefix=i.keyPrefix||s||o.keyPrefix);const a=this.options.keySeparator||".";let r;return i.keyPrefix&&Array.isArray(e)?r=e.map(e=>("function"==typeof e&&(e=X(e,{...this.options,...t})),`${i.keyPrefix}${a}${e}`)):("function"==typeof e&&(e=X(e,{...this.options,...t})),r=i.keyPrefix?`${i.keyPrefix}${a}${e}`:e),this.t(r,i)};return E(e)?o.lng=e:o.lngs=e,o.ns=t,o.keyPrefix=s,o}t(...e){return O([this,"access",e=>e.translator,"optionalAccess",e=>e.translate,"call",t=>t(...e)])}exists(...e){return O([this,"access",e=>e.translator,"optionalAccess",e=>e.exists,"call",t=>t(...e)])}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const s=t.lng||this.resolvedLanguage||this.languages[0],o=!!this.options&&this.options.fallbackLng,n=this.languages[this.languages.length-1];if("cimode"===s.toLowerCase())return!0;const i=(e,t)=>{const s=this.services.backendConnector.state[`${e}|${t}`];return-1===s||0===s||2===s};if(t.precheck){const e=t.precheck(this,i);if(void 0!==e)return e}return!!this.hasResourceBundle(s,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!i(s,e)||o&&!i(n,e)))}loadNamespaces(e,t){const s=R();return this.options.ns?(E(e)&&(e=[e]),e.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{s.resolve(),t&&t(e)}),s):(t&&t(),Promise.resolve())}loadLanguages(e,t){const s=R();E(e)&&(e=[e]);const o=this.options.preload||[],n=e.filter(e=>o.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return n.length?(this.options.preload=o.concat(n),this.loadResources(e=>{s.resolve(),t&&t(e)}),s):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(O([this,"access",e=>e.languages,"optionalAccess",e=>e.length])>0?this.languages[0]:this.language)),!e)return"rtl";try{const t=new Intl.Locale(e);if(t&&t.getTextInfo){const e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch(e){}const t=O([this,"access",e=>e.services,"optionalAccess",e=>e.languageUtils])||new se(ue());return e.toLowerCase().indexOf("-latn")>1?"ltr":["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){const s=new fe(e,t);return s.createInstance=fe.createInstance,s}cloneInstance(e={},t=me){const s=e.forkResourceStore;s&&delete e.forkResourceStore;const o={...this.options,...e,isClone:!0},n=new fe(o);void 0===e.debug&&void 0===e.prefix||(n.logger=n.logger.clone(e));if(["store","services","language"].forEach(e=>{n[e]=this[e]}),n.services={...this.services},n.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},s){const e=Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((s,o)=>(s[o]={...e[t][o]},s),e[t]),e),{});n.store=new Y(e,o),n.services.resourceStore=n.store}if(e.interpolation){const t={...ue().interpolation,...this.options.interpolation,...e.interpolation},s={...o,interpolation:t};n.services.interpolator=new le(s)}return n.translator=new te(n.services,o),n.translator.on("*",(e,...t)=>{n.emit(e,...t)}),n.init(o,t),n.translator.options=o,n.translator.backendConnector.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},n}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const ye=fe.createInstance();ye.createInstance,ye.dir,ye.init,ye.loadResources,ye.reloadResources,ye.use,ye.changeLanguage,ye.getFixedT,ye.t,ye.exists,ye.setDefaultNamespace,ye.hasLoadedNamespace,ye.loadNamespaces,ye.loadLanguages;ye.init({fallbackLng:"en",lng:"en",debug:!0,resources:{en:{translation:{categorize:{limitMaxChoicesPerCategory:"You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",maxChoicesPerCategoryRestriction:"To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s]."},ebsr:{part:"Part {{index}}"},numberLine:{addElementLimit_one:"You can only add {{count}} element",addElementLimit_other:"You can only add {{count}} elements",clearAll:"Clear all"},imageClozeAssociation:{reachedLimit_one:"You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.",reachedLimit_other:"Full"},drawingResponse:{fillColor:"Fill color",outlineColor:"Outline color",noFill:"No fill",lightblue:"Light blue",lightyellow:"Light yellow",red:"Red",orange:"Orange",yellow:"Yellow",violet:"Violet",blue:"Blue",green:"Green",white:"White",black:"Black",onDoubleClick:"Double click to edit this text. Press Enter to submit."},charting:{addCategory:"Add category",actions:"Actions",add:"Add",delete:"Delete",newLabel:"New label",reachedLimit_other:"There can't be more than {{count}} categories.",keyLegend:{incorrectAnswer:"Student incorrect answer",correctAnswer:"Student correct answer",correctKeyAnswer:"Answer key correct"}},graphing:{point:"Point",circle:"Circle",line:"Line",parabola:"Parabola",absolute:"Absolute Value",exponential:"Exponential",polygon:"Polygon",ray:"Ray",segment:"Segment",sine:"Sine",vector:"Vector",label:"Label",redo:"Redo",reset:"Reset"},mathInline:{primaryCorrectWithAlternates:"Note: The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct."},multipleChoice:{minSelections:"Select at least {{minSelections}}.",maxSelections_one:"Only {{maxSelections}} answer is allowed.",maxSelections_other:"Only {{maxSelections}} answers are allowed.",minmaxSelections_equal:"Select {{minSelections}}.",minmaxSelections_range:"Select between {{minSelections}} and {{maxSelections}}."},selectText:{correctAnswerSelected:"Correct",correctAnswerNotSelected:"Correct Answer Not Selected",incorrectSelection:"Incorrect Selection",key:"Key"}},common:{undo:"Undo",clearAll:"Clear all",correct:"Correct",incorrect:"Incorrect",showCorrectAnswer:"Show correct answer",hideCorrectAnswer:"Hide correct answer",commonCorrectAnswerWithAlternates:"Note: The answer shown above is the most common correct answer for this item. One or more additional correct answers are also defined, and will also be recognized as correct.",warning:"Warning",showNote:"Show Note",hideNote:"Hide Note",cancel:"Cancel"}},es:{translation:{categorize:{limitMaxChoicesPerCategory:"Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",maxChoicesPerCategoryRestriction:"Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta"},ebsr:{part:"Parte {{index}}"},numberLine:{addElementLimit_one:"Solo puedes agregar {{count}} elemento",addElementLimit_other:"Solo puedes agregar {{count}} elementos",clearAll:"Borrar todo"},imageClozeAssociation:{reachedLimit_one:"Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",reachedLimit_other:"Lleno"},drawingResponse:{fillColor:"Color de relleno",outlineColor:"Color del contorno",noFill:"Sin relleno",lightblue:"Azul claro",lightyellow:"Amarillo claro",red:"Rojo",orange:"Naranja",yellow:"Amarillo",violet:"Violeta",blue:"Azul",green:"Verde",white:"Blanco",black:"Negro",onDoubleClick:"Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar"},charting:{addCategory:"Añadir categoría",actions:"Acciones",add:"Añadir",delete:"Eliminar",newLabel:"Nueva etiqueta",reachedLimit_other:"No puede haber más de {{count}} categorías.",keyLegend:{incorrectAnswer:"Respuesta incorrecta del estudiante",correctAnswer:"Respuesta correcta del estudiante",correctKeyAnswer:"Clave de respuesta correcta"}},graphing:{point:"Punto",circle:"Circulo",line:"Línea",parabola:"Parábola",absolute:"Valor absoluto",exponential:"Exponencial",polygon:"Polígono",ray:"Semirrecta",segment:"Segmento ",sine:"Seno",vector:"Vector",label:"Etiqueta",redo:"Rehacer",reset:"Reiniciar"},mathInline:{primaryCorrectWithAlternates:"Nota: La respuesta que se muestra arriba es la respuesta correcta principal especificada por el autor para esta pregunta, pero también se pueden reconocer otras respuestas como correctas."},multipleChoice:{minSelections:"Seleccione al menos {{minSelections}}.",maxSelections_one:"Sólo se permite {{maxSelections}} respuesta.",maxSelections_other:"Sólo se permiten {{maxSelections}} respuestas.",minmaxSelections_equal:"Seleccione {{minSelections}}.",minmaxSelections_range:"Seleccione entre {{minSelections}} y {{maxSelections}}."},selectText:{correctAnswerSelected:"Respuesta Correcta",correctAnswerNotSelected:"Respuesta Correcta No Seleccionada",incorrectSelection:"Selección Incorrecta",key:"Clave"}},common:{undo:"Deshacer",clearAll:"Borrar todo",correct:"Correct",incorrect:"Incorrect",showCorrectAnswer:"Mostrar respuesta correcta",hideCorrectAnswer:"Ocultar respuesta correcta",commonCorrectAnswerWithAlternates:"Nota: La respuesta que se muestra arriba es la respuesta correcta más común para esta pregunta. También se definen una o más respuestas correctas adicionales, y también se reconocerán como correctas.",warning:"Advertencia",showNote:"Mostrar Nota",hideNote:"Ocultar Nota",cancel:"Cancelar"}}}});var be={translator:{...ye,t:(e,t)=>{const{lng:s}=t;switch(s){case"en_US":case"en-US":t.lng="en";break;case"es_ES":case"es-ES":case"es_MX":case"es-MX":t.lng="es"}return ye.t(e,{lng:s,...t})}},languageOptions:[{value:"en_US",label:"English (US)"},{value:"es_ES",label:"Spanish"}]};const xe=t,ve=o,Se=i,{Feedback:we}=n,{Collapsible:ke}=n,{Readable:Ce}=n,{hasText:Le}=n,{hasMedia:Ae}=n,{PreviewPrompt:Oe}=n,{UiLayout:Ee}=n,{color:Re}=n,{styled:_e}=s,{Tooltip:$e}=a,{isEqual:Ne}=r,{isEmpty:Pe}=r,Te=e,{mq:je}=h,{HorizontalKeypad:Fe}=h,{updateSpans:Ie}=h,De=d,{renderMath:qe}=c;function Me(e){let t,s=e[0],o=1;for(;o<e.length;){const n=e[o],i=e[o+1];if(o+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=i(s)):"call"!==n&&"optionalCall"!==n||(s=i((...e)=>s.call(t,...e)),t=void 0)}return s}const{translator:Be}=be;let Ve=!1;const Ke=/\\newline/g,Ue=/{{response}}/gm,ze=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);function He(e=[],t){return 30*Math.floor(e.length/5)+("miscellaneous"===t?600:500)}function We(e,t){const s={};if(t.config&&t.config.expression){let o=1;(t.config.expression||"").replace(Ue,()=>{s[`r${o}`]={value:e&&e.answers&&e.answers[`r${o}`]&&e.answers[`r${o}`].value||""},o+=1})}return s}class Je extends xe.Component{static __initStatic(){this.propTypes={session:ve.object.isRequired,onSessionChange:ve.func,model:ve.object.isRequired}}constructor(e){super(e),Je.prototype.__init.call(this),Je.prototype.__init2.call(this),Je.prototype.__init3.call(this),Je.prototype.__init4.call(this),Je.prototype.__init5.call(this),Je.prototype.__init6.call(this),Je.prototype.__init7.call(this),Je.prototype.__init8.call(this),Je.prototype.__init9.call(this),Je.prototype.__init10.call(this),Je.prototype.__init11.call(this),Je.prototype.__init12.call(this),Je.prototype.__init13.call(this),Je.prototype.__init14.call(this),Je.prototype.__init15.call(this),Je.prototype.__init16.call(this);const{model:t,session:s}=e,o=We(s,t);this.state={session:{...e.session,answers:o},activeAnswerBlock:"",showCorrect:this.props.model.config.alwaysShowCorrect||!1,tooltipContainerRef:xe.createRef()}}UNSAFE_componentWillMount(){if("undefined"!=typeof window){let e=De.getInterface(2);Ve||(e.registerEmbed("answerBlock",e=>{const t=Ye();return{htmlString:`<div class="${t.blockContainer}">\n <div class="${t.blockResponse}" id="${e}Index">R</div>\n <div class="${t.blockMath}">\n <span id="${e}"></span>\n </div>\n </div>`,text:()=>"text",latex:()=>`\\embed{answerBlock}[${e}]`}}),Ve=!0)}}__init(){this.handleAnswerBlockDomUpdate=()=>{const{model:e}=this.props,{session:t,showCorrect:s}=this.state,o=t.answers;this.root&&e.disabled&&!s&&Object.keys(o).forEach(t=>{const s=this.root.querySelector(`#${t}`),n=this.root.querySelector(`#${t}Index`);if(s){let i=De.getInterface(2);const a=o[t];s.textContent=a&&a.value||"",e.view&&(s.parentElement.parentElement.classList.remove("correct"),s.parentElement.parentElement.classList.remove("incorrect")),i.StaticMath(s),n.textContent="R"}}),qe(this.root)}}countResponseOccurrences(e){const t=/\{\{response\}\}/g,s=Me([e,"optionalAccess",e=>e.match,"call",e=>e(t)]);return s?s.length:0}UNSAFE_componentWillReceiveProps(e){const{config:t}=this.props.model,{config:s={}}=e.model||{},{session:o}=this.props,{session:n={}}=e||{};if(o&&n&&!Ne(o.answers,n.answers)&&this.setState({session:{...n,answers:We(n,this.props.model)}}),t.note&&t.language&&t.language!==s.language&&t.note===Be.t("mathInline.primaryCorrectWithAlternates",{lng:t.language})&&(t.note=Be.t("mathInline.primaryCorrectWithAlternates",{lng:s.language})),(t.env&&"evaluate"!==t.env.mode||s.env&&"evaluate"!==s.env.mode)&&this.setState({...this.state.session,showCorrect:!1}),s.alwaysShowCorrect&&this.setState({showCorrect:!0}),this.countResponseOccurrences(t.expression)<this.countResponseOccurrences(s.expression)&&setTimeout(()=>this.updateAria(),100),t&&t.responses&&t.responses.length!==s.responses.length||!t&&s&&s.responses||t&&s&&t.expression!==s.expression){const e={},t=this.state.session.answers;let o=1;(s.expression||"").replace(Ue,()=>{e[`r${o}`]={value:t&&t[`r${o}`]&&t[`r${o}`].value||""},o++}),this.setState(t=>({session:{...t.session,completeAnswer:this.mqStatic&&this.mqStatic.mathField.latex(),answers:e}}),this.handleAnswerBlockDomUpdate)}}shouldComponentUpdate(e,t){const s=Ne(this.props.model,e.model),o=Ne(this.state,t);return!s||!o}componentDidMount(){this.handleAnswerBlockDomUpdate(),this.updateAria(),setTimeout(()=>qe(this.root),100)}componentDidUpdate(e,t){this.handleAnswerBlockDomUpdate();Me([e,"access",e=>e.model,"optionalAccess",e=>e.config,"optionalAccess",e=>e.responseType])!==Me([this,"access",e=>e.props,"access",e=>e.model,"optionalAccess",e=>e.config,"optionalAccess",e=>e.responseType])&&this.updateAria()}__init2(){this.updateAria=()=>{if(this.root){this.root.querySelectorAll(".mq-selectable").forEach(e=>e.setAttribute("aria-hidden","true"));this.root.querySelectorAll("textarea").forEach((e,t)=>{e.setAttribute("aria-label","Enter answer.");const s=`instructions-${t}`,o=e.closest(".mq-textarea");if(o){let t=o.querySelector(`#${s}`);t||(t=document.createElement("span"),t.id=s,t.className="sr-only",t.textContent="This field supports both keypad and keyboard input. Use the keyboard to access and interact with the on-screen math keypad, which accepts LaTeX markup. Use the down arrow key to open the keypad and navigate its buttons. Use the escape key to close the keypad and return to the input field.",o.insertBefore(t,e)),e.setAttribute("aria-describedby",s)}})}}}__init3(){this.focusFirstKeypadElement=()=>{setTimeout(()=>{const e=document.querySelector("[data-keypad]");if(e){const t=e.querySelector("button, [role='button']");t&&t.focus()}},0)}}__init4(){this.handleKeyDown=(e,t)=>{const s=function(e,t){let s=e;for(;null!==s;){if(t&&s===t)return!0;s=s.parentNode}return!1}(e.target,this.root),o=this.mqStatic&&Me([this,"access",e=>e.mqStatic,"access",e=>e.inputRef,"optionalAccess",e=>e.current])?Me([this,"access",e=>e.mqStatic,"access",e=>e.inputRef,"optionalAccess",e=>e.current,"access",e=>e.contains,"call",e=>e(document.activeElement)]):"Enter answer."===Me([document,"access",e=>e.activeElement,"optionalAccess",e=>e.getAttribute,"call",e=>e("aria-label")]),{key:n,type:i}=e;o&&("ArrowDown"===n||("click"===i||"touchstart"===i))?this.state.activeAnswerBlock!==t&&s&&(this.cleanupKeyDownListener(),this.setState({activeAnswerBlock:t},()=>{this.onSubFieldFocus(t),"ArrowDown"===n&&this.focusFirstKeypadElement()})):"Escape"===e.key&&this.setState({activeAnswerBlock:""})}}__init5(){this.onSubFieldFocus=e=>{this.handleEvent||(this.handleEvent=t=>{this.handleKeyDown(t,e)},document.addEventListener("keydown",this.handleEvent),document.addEventListener("click",this.handleEvent),document.addEventListener("touchstart",this.handleEvent))}}__init6(){this.cleanupKeyDownListener=()=>{this.handleEvent&&(document.removeEventListener("keydown",this.handleEvent),document.removeEventListener("click",this.handleEvent),document.removeEventListener("touchstart",this.handleEvent),this.handleEvent=null)}}componentWillUnmount(){this.cleanupKeyDownListener&&this.cleanupKeyDownListener()}__init7(){this.onDone=()=>{}}__init8(){this.onSimpleResponseChange=e=>{this.setState(t=>({session:{...t.session,response:e}}),this.callOnSessionChange)}}__init9(){this.toNodeData=e=>{if(!e)return;const{type:t,value:s}=e;return"command"===t||"cursor"===t?e:"answer"===t?{type:"answer",...e}:"clear"===s?{type:"clear"}:{type:"write",value:s}}}__init10(){this.setInput=e=>{this.input=e}}__init11(){this.onClick=e=>{const t=this.toNodeData(e);"clear"===t.type?this.input.clear():"command"===t.type?Array.isArray(t.value)?t.value.forEach(e=>{this.input.cmd(e)}):this.input.cmd(t.value):"cursor"===t.type?this.input.keystroke(t.value):this.input.write(t.value),this.input.focus()}}__init12(){this.callOnSessionChange=()=>{const{onSessionChange:e}=this.props;e&&e(this.state.session)}}__init13(){this.toggleShowCorrect=e=>{this.setState({showCorrect:e},this.handleAnswerBlockDomUpdate)}}__init14(){this.subFieldChanged=(e,t)=>{Ie(),e&&this.setState(s=>({session:{...s.session,completeAnswer:this.mqStatic&&this.mqStatic.mathField.latex(),answers:{...s.session.answers,[e]:{value:t}}}}),this.callOnSessionChange)}}__init15(){this.getFieldName=(e,t)=>{const{answers:s}=this.state.session;if(Object.keys(s||{}).length){return Object.keys(s).find(s=>{const o=t[s];return o&&o.id==e.id})}}}__init16(){this.onBlur=e=>{const{relatedTarget:t,currentTarget:s}=e||{},o=s&&s.closest("[role=tooltip]");const n=function e(t,s=0){if(!t||s>=16)return null;const o=t.offsetParent;return o?"tooltip"===o.getAttribute("role")?o:e(o,s+1):null}(t),i=n?function e(t,s=0){if(!t||s>=4)return null;const o=Me([t,"optionalAccess",e=>e.children,"optionalAccess",e=>e[0]]);return o?o.attributes&&o.attributes["data-keypad"]?o:e(o,s+1):null}(n):null;t&&s&&Me([i,"optionalAccess",e=>e.attributes,"access",e=>e["data-keypad"]])||o||this.setState({activeAnswerBlock:""})}}setTooltipRef(e){setTimeout(()=>{if(e&&ze){const e=document.querySelector("[role='tooltip']");if(e){e.firstChild.setAttribute("tabindex","-1")}}},1)}render(){const{model:e}=this.props,{activeAnswerBlock:t,showCorrect:s,session:o,tooltipContainerRef:n}=this.state,{config:i,correctness:a,disabled:r,extraCSSRules:l,view:c,teacherInstructions:p,rationale:h,feedback:d,animationsDisabled:u,printMode:g,alwaysShowCorrect:y,language:b}=e||{};if(!i)return null;const{showNote:x,note:v,prompt:S,responses:w,responseType:k,equationEditor:C,customKeys:A,id:O,env:{mode:E,role:R}={}}=i||{},_=(s||"view"===E&&"instructor"===R)&&x&&v,$=Pe(w),N=!$&&a&&"correct"!==a.correctness,P=r&&a,T=function(e=[]){return e.map(e=>({name:e,latex:e,write:e,label:e}))}(A),j=a&&a.correct,F=function(e,t){const{config:s,disabled:o}=e||{},{expression:n,responses:i,printMode:a,alwaysShowCorrect:r}=s||{};if(s&&n){const e=n;if(t.showCorrect)return i&&i.length&&i[0].answer;let s=1;return(e||"").replace(Ue,function(){const e=t.session.answers[`r${s}`];if(a&&!r){const e="\\ \\ ".repeat(30)+"\\newline ";return`\\MathQuillMathField[r${s++}]{${e.repeat(3)}}`}return o?`\\embed{answerBlock}[r${s++}]`:`\\MathQuillMathField[r${s++}]{${e&&e.value||""}}`}).replace(Ke,"\\embed{newLine}[]")}}(e,this.state)||"",I=r&&!a,D=g&&!y,q=h&&(Le(h)||Ae(h)),M=p&&(Le(p)||Ae(p)),B=xe.createElement(it,null,xe.createElement(je.Static,{className:"static-math",ref:e=>{e&&(this.mqStatic=e)},latex:F,onSubFieldChange:this.subFieldChanged,getFieldName:this.getFieldName,setInput:this.setInput,onSubFieldFocus:this.onSubFieldFocus,onBlur:this.onBlur})),V=xe.createElement(Ze,null,"gather"===E&&xe.createElement(at,null,"Math Equation Response Question"),I&&M&&(u?xe.createElement("div",{dangerouslySetInnerHTML:{__html:p}}):xe.createElement(tt,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},xe.createElement("div",{dangerouslySetInnerHTML:{__html:p}}))),S&&xe.createElement(Xe,null,xe.createElement(Oe,{prompt:S})),D?B:xe.createElement(Ce,{false:!0},xe.createElement(nt,{tabIndex:0},k===f&&xe.createElement(L,{onSimpleResponseChange:this.onSimpleResponseChange,showCorrect:s,emptyResponse:$,model:e,session:o,onSubFieldFocus:this.onSubFieldFocus,showKeypad:!!t}),k===m&&xe.createElement(ot,{ref:n,isIncorrect:!$&&!j&&!s,isCorrect:!$&&(j||s),showCorrectness:!$&&r&&a&&!c,correctAnswerShown:s,printCorrect:g&&y},xe.createElement($e,{ref:e=>this.setTooltipRef(e),enterTouchDelay:0,interactive:!0,open:!!t,slotProps:{popper:{container:Me([n,"optionalAccess",e=>e.current])||void 0,placement:"bottom-start",sx:{backgroundColor:"transparent",width:"650px",opacity:1,"& .MuiTooltip-arrow":{display:"none"}},modifiers:[{name:"offset",options:{offset:[0,8]}},{name:"preventOverflow",enabled:!0,options:{boundary:"viewport",padding:8}},{name:"computeStyles",options:{adaptive:!0,gpuAcceleration:!0}},{name:"flip",enabled:!1}]},tooltip:{sx:{fontSize:"initial",backgroundColor:"transparent",width:"600px",marginTop:0,paddingTop:0,boxShadow:"none"}}},title:Object.keys(o.answers).map(e=>e===t&&!(s||r)&&xe.createElement(st,{"data-keypad":!0,key:e,style:{width:He(T,C)}},xe.createElement(Fe,{additionalKeys:T,mode:C||6,onClick:this.onClick}))||null)},xe.createElement("div",null,xe.createElement(je.Static,{className:"static-math",ref:e=>{e&&(this.mqStatic=e)},latex:F,onSubFieldChange:this.subFieldChanged,getFieldName:this.getFieldName,setInput:this.setInput,onSubFieldFocus:this.onSubFieldFocus,onBlur:this.onBlur})))))),I&&_&&xe.createElement(et,{dangerouslySetInnerHTML:{__html:`<strong>Note:</strong> ${v}`}}),I&&q&&(u?xe.createElement("div",{dangerouslySetInnerHTML:{__html:h}}):xe.createElement(ke,{labels:{hidden:"Show Rationale",visible:"Hide Rationale"}},xe.createElement("div",{dangerouslySetInnerHTML:{__html:h}}))));return P&&(N||M||q||d)?xe.createElement(Ee,{extraCSSRules:l},xe.createElement(Ge,{interactive:!0,enterTouchDelay:0,placement:"bottom-start",slotProps:{tooltip:{sx:e=>({background:`${Re.primaryLight()} !important`,color:Re.text(),padding:e.spacing(2),border:`1px solid ${Re.secondary()}`,fontSize:"16px","& :not(.MathJax) > table tr":{"&:nth-child(2n)":{backgroundColor:"unset !important"}}})},popper:{sx:{opacity:1},modifiers:[{name:"offset",options:{offset:[0,2]}}]}},title:xe.createElement("div",null,xe.createElement(Ze,null,N&&xe.createElement(rt,{language:b,show:!0,toggled:s,onToggle:this.toggleShowCorrect})),M&&xe.createElement(tt,{key:"collapsible-teacher-instructions",labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},xe.createElement(Oe,{prompt:p})),_&&Le(v)&&xe.createElement(tt,{key:"collapsible-note",labels:{hidden:Be.t("common:showNote",{lng:b}),visible:Be.t("common:hideNote",{lng:b})}},xe.createElement(Oe,{prompt:v})),q&&xe.createElement(tt,{key:"collapsible-rationale",labels:{hidden:"Show Rationale",visible:"Hide Rationale"}},xe.createElement(Oe,{prompt:h})),d&&xe.createElement(we,{correctness:a.correctness,feedback:d}))},xe.createElement(Qe,{ref:e=>this.root=e||this.root},V))):xe.createElement(Ee,{id:O,extraCSSRules:l,ref:e=>{const t=Te.findDOMNode(e);this.root=t||this.root}},xe.createElement(Qe,null,V))}}Je.__initStatic();const Ye=()=>({blockContainer:"block-container",blockResponse:"block-response",blockMath:"block-math"});if("undefined"!=typeof document){const e="math-inline-block-styles";if(!document.getElementById(e)){const t=document.createElement("style");t.id=e,t.textContent=`\n .block-container {\n margin: 8px !important;\n display: inline-flex;\n border: 2px solid grey !important;\n }\n .block-response {\n color: grey;\n background: #f5f5f5;\n font-size: 0.8rem !important;\n padding: 4px !important;\n display: flex;\n align-items: center;\n justify-content: center;\n border-right: 2px solid #bdbdbd !important;\n flex-shrink: 0;\n flex-grow: 0;\n flex-basis: auto;\n }\n .block-math {\n color: ${Re.text()};\n background-color: ${Re.background()};\n padding: 4px !important;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-grow: 1;\n }\n .block-math > .mq-math-mode > .mq-hasCursor > .mq-cursor {\n display: none;\n }\n .sr-only {\n position: absolute;\n left: -10000px;\n top: auto;\n width: 1px;\n height: 1px;\n overflow: hidden;\n }\n .static-math > .mq-root-block > .mq-editable-field {\n border-color: ${Re.text()};\n }\n `,document.head.appendChild(t)}}const Qe=_e("div")({color:Re.text(),backgroundColor:Re.background(),display:"inline-block"}),Ge=_e($e)({}),Xe=_e("div")(({theme:e})=>({marginBottom:e.spacing(2)})),Ze=_e("div")({width:"100%",position:"relative",backgroundColor:Re.background(),color:Re.text()}),et=_e("div")(({theme:e})=>({paddingBottom:e.spacing(2)})),tt=_e(ke)(({theme:e})=>({marginBottom:e.spacing(2)})),st=_e("div")(({theme:e})=>({zIndex:10,minWidth:"400px",marginTop:e.spacing(2)})),ot=_e("div",{shouldForwardProp:e=>!["isIncorrect","isCorrect","showCorrectness","correctAnswerShown","printCorrect"].includes(e)})(({theme:e,isIncorrect:t,isCorrect:s,showCorrectness:o,correctAnswerShown:n,printCorrect:i})=>{const a=t?Re.incorrect():s?Re.correct():void 0;return{maxWidth:"fit-content",padding:e.spacing(.25),...o&&{border:a?`2px solid ${a} !important`:"2px solid"},...!o&&a&&{borderColor:`${a} !important`},...n&&{padding:e.spacing(1),letterSpacing:"0.5px"},...i&&{border:`2px solid ${Re.correct()} !important`},"& > .mq-math-mode":{"& > .mq-root-block":{paddingRight:"0 !important",paddingLeft:"0 !important","& > .mq-editable-field":{minWidth:"10px",padding:e.spacing(.25)}},"& sup":{top:0}}}}),nt=_e("div")({position:"relative","& .mq-overarrow-inner":{border:"none !important",padding:"0 !important"},"& .mq-overarrow-inner-right":{display:"none !important"},"& .mq-overarrow-inner-left":{display:"none !important"},"& .mq-overarrow.mq-arrow-both":{minWidth:"1.23em","& *":{lineHeight:"1 !important"},"&:before":{top:"-0.4em",left:"-1px"},"&:after":{top:"-2.4em",right:"-1px"},"&.mq-empty:after":{top:"-0.45em"}},"& .mq-overarrow.mq-arrow-right":{"&:before":{top:"-0.4em",right:"-1px"}},"& .mq-longdiv-inner":{borderTop:"1px solid !important",paddingTop:"1.5px !important"},"& .mq-parallelogram":{lineHeight:.85}}),it=_e("div")(({theme:e})=>({marginBottom:e.spacing(1),pointerEvents:"none"})),at=_e("h2")({position:"absolute",left:"-10000px",top:"auto",width:"1px",height:"1px",overflow:"hidden"}),rt=_e(Se)(({theme:e})=>({color:Re.text(),marginBottom:e.spacing(2)})),lt=t,{debounce:ct}=r,pt=l,{renderMath:ht}=c,dt=pt("pie-element:math-inline:print");class ut extends HTMLElement{constructor(){super(),this._options=null,this._model=null,this._session=[],this._root=null,this._rerender=ct(()=>{if(this._model&&this._session){const e=((e,t)=>{const s="instructor"===t.role;return e.prompt=!1!==e.promptEnabled?e.prompt:void 0,e.teacherInstructions=s&&!1!==e.teacherInstructionsEnabled?e.teacherInstructions:void 0,e.rationale=s&&!1!==e.rationaleEnabled?e.rationale:void 0,e.showTeacherInstructions=s,e.alwaysShowCorrect=s,e.printMode=!0,e.feedback=void 0,e.expression=e.expression||"{{response}}",e.animationsDisabled=!0,{...e,disabled:!0,config:{...e,env:{mode:s?"evaluate":e.mode,role:t.role}}}})(this._model,this._options),t=this._options&<.createElement(Je,{model:e,session:{}});this._root||(this._root=u(this)),this._root.render(t),queueMicrotask(()=>{dt("render complete - render math"),ht(this)})}else dt("skip")},50,{leading:!1,trailing:!0})}set options(e){this._options=e}set model(e){this._model=e,this._rerender()}connectedCallback(){}disconnectedCallback(){this._root&&this._root.unmount()}}export{ut as default};
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"repository": "pie-framework/pie-elements",
|
|
7
|
-
"version": "11.0.0-next.
|
|
7
|
+
"version": "11.0.0-next.43+4249fa78f",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"description": "",
|
|
10
10
|
"scripts": {
|
|
@@ -27,11 +27,15 @@
|
|
|
27
27
|
"debug": "^4.1.1",
|
|
28
28
|
"lodash": "^4.17.10",
|
|
29
29
|
"prop-types": "^15.6.1",
|
|
30
|
-
"react": "18.
|
|
31
|
-
"react-dom": "18.
|
|
30
|
+
"react": "18.3.1",
|
|
31
|
+
"react-dom": "18.3.1"
|
|
32
32
|
},
|
|
33
33
|
"author": "",
|
|
34
34
|
"license": "ISC",
|
|
35
|
-
"gitHead": "
|
|
36
|
-
"module": "src/index.js"
|
|
35
|
+
"gitHead": "4249fa78fc423ef0a8c89002b8f937c42b3478ea",
|
|
36
|
+
"module": "src/index.js",
|
|
37
|
+
"exports": {
|
|
38
|
+
".": "./src/index.js",
|
|
39
|
+
"./print": "./src/print.js"
|
|
40
|
+
}
|
|
37
41
|
}
|