@pie-element/math-templated 6.2.0-next.6 → 6.2.0-next.7

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/demo.js ADDED
@@ -0,0 +1,67 @@
1
+ import Configure from './configure.js';
2
+ import Element from './element.js';
3
+ import * as controller from './controller.js';
4
+
5
+ var generate = {};
6
+
7
+ generate.model = (id, element) => ({
8
+ id,
9
+ element,
10
+ rationale: 'Rationale',
11
+ partialScoring: true,
12
+ prompt: 'There are 24 students in the class. They had the choice to buy supplies from two different stores, Store A and B. Each of them bought 2 binders and 5 notebooks. The students have a total of $420 to spend.',
13
+ scoringType: 'auto',
14
+ feedbackEnabled: false,
15
+ promptEnabled: true,
16
+ rationaleEnabled: true,
17
+ teacherInstructionsEnabled: true,
18
+ studentInstructionsEnabled: true,
19
+ toolbarEditorPosition: 'bottom',
20
+ validationDefault: 'literal',
21
+ ignoreOrderDefault: false,
22
+ allowTrailingZerosDefault: false,
23
+ teacherInstructions: 'These are teacher instructions',
24
+ customKeys: [], // these have effect on player only?
25
+ equationEditor: 'geometry',
26
+ markup: `
27
+ <p>If the unit price of a notebook in Store A is $1.50, what is the unit price of a binder? \${{0}}</p>
28
+ <p>If the unit price of a binder in Store B is $2.80, what is the unit price of a notebook? \${{1}}</p>
29
+ `,
30
+ responses: {
31
+ 0: {
32
+ allowTrailingZeros: false,
33
+ answer: '5',
34
+ id: '1',
35
+ validation: 'symbolic',
36
+ ignoreOrder: false,
37
+ alternates: {}
38
+ },
39
+ 1: {
40
+ allowTrailingZeros: false,
41
+ answer: '2.38',
42
+ id: '1',
43
+ validation: 'literal',
44
+ ignoreOrder: false,
45
+ alternates: {}
46
+ }
47
+ }
48
+ });
49
+
50
+ const { model } = generate;
51
+
52
+ var config = {
53
+ elements: {
54
+ 'math-templated': '../..',
55
+ },
56
+ models: [model('1', 'math-templated')],
57
+ };
58
+
59
+ //Note: demo-el is a custom element loaded in the markup.
60
+ customElements.whenDefined("demo-el").then(() => {
61
+ config.models.forEach((m) => {
62
+ const de = document.createElement("demo-el");
63
+ document.body.appendChild(de);
64
+ de.def = { tagName: m.element, Element, Configure, controller };
65
+ de.model = m;
66
+ });
67
+ });
@@ -0,0 +1 @@
1
+ import{_dll_react_dom as e,_dll_react as t,_dll_prop_types as n,_dll_mui__material_styles as r,_dll_debug as o,_dll_mui__material as i,_dll_pie_lib__render_ui as a,_dll_classnames as s,_dll_mui__icons_material as l,_dll_pie_lib__correct_answer_toggle as c}from"../../../@pie-lib/shared-module@^4.1.0/module/index.js";import{_dll_pie_lib__math_rendering as d}from"../../../@pie-lib/math-rendering-module@^4.1.0/module/index.js";import{_dll_pie_framework__mathquill as u}from"../../../@pie-lib/math-edit-module@^3.2.0/module/index.js";import{_dll_pie_lib__drag as p}from"../../../@pie-lib/drag-module@^3.2.0/module/index.js";import{grey as h}from"@mui/material/colors";var m,f=e;m=f.createRoot,f.hydrateRoot;var g={};Object.defineProperty(g,"__esModule",{value:!0});class v extends CustomEvent{constructor(e,t,n){super(v.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e,hasModel:n}}),this.component=e,this.complete=t}}v.TYPE="model-set";var b=g.ModelSetEvent=v;class y extends CustomEvent{constructor(e,t){super(y.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e}}),this.component=e,this.complete=t}}y.TYPE="session-changed";var x=g.SessionChangedEvent=y,w="object"==typeof global&&global&&global.Object===Object&&global,_="object"==typeof self&&self&&self.Object===Object&&self,C=w||_||Function("return this")(),k=C.Symbol,E=Object.prototype,S=E.hasOwnProperty,A=E.toString,R=k?k.toStringTag:void 0;var O=Object.prototype.toString;var D=k?k.toStringTag:void 0;function j(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":D&&D in Object(e)?function(e){var t=S.call(e,R),n=e[R];try{e[R]=void 0;var r=!0}catch(e){}var o=A.call(e);return r&&(t?e[R]=n:delete e[R]),o}(e):function(e){return O.call(e)}(e)}function T(e){return null!=e&&"object"==typeof e}function M(e){return"symbol"==typeof e||T(e)&&"[object Symbol]"==j(e)}function L(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}var q=Array.isArray,N=k?k.prototype:void 0,F=N?N.toString:void 0;function I(e){if("string"==typeof e)return e;if(q(e))return L(e,I)+"";if(M(e))return F?F.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}var P=/\s/;var B=/^\s+/;function $(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&P.test(e.charAt(t)););return t}(e)+1).replace(B,""):e}function z(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var W=/^[-+]0x[0-9a-f]+$/i,K=/^0b[01]+$/i,H=/^0o[0-7]+$/i,U=parseInt;function X(e){if("number"==typeof e)return e;if(M(e))return NaN;if(z(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=z(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=$(e);var n=K.test(e);return n||H.test(e)?U(e.slice(2),n?2:8):W.test(e)?NaN:+e}var V=1/0;function Y(e){var t=function(e){return e?(e=X(e))===V||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}(e),n=t%1;return t==t?n?t-n:t:0}function J(e){return e}function Q(e){if(!z(e))return!1;var t=j(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var Z,G=C["__core-js_shared__"],ee=(Z=/[^.]+$/.exec(G&&G.keys&&G.keys.IE_PROTO||""))?"Symbol(src)_1."+Z:"";var te=Function.prototype.toString;function ne(e){if(null!=e){try{return te.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var re=/^\[object .+?Constructor\]$/,oe=Function.prototype,ie=Object.prototype,ae=oe.toString,se=ie.hasOwnProperty,le=RegExp("^"+ae.call(se).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ce(e){return!(!z(e)||(t=e,ee&&ee in t))&&(Q(e)?le:re).test(ne(e));var t}function de(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return ce(n)?n:void 0}var ue=de(C,"WeakMap");var pe=Date.now;var he,me,fe,ge=function(){try{var e=de(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),ve=ge,be=ve?function(e,t){return ve(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:J,ye=(he=be,me=0,fe=0,function(){var e=pe(),t=16-(e-fe);if(fe=e,t>0){if(++me>=800)return arguments[0]}else me=0;return he.apply(void 0,arguments)}),xe=/^(?:0|[1-9]\d*)$/;function we(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&xe.test(e))&&e>-1&&e%1==0&&e<t}function _e(e,t){return e===t||e!=e&&t!=t}var Ce=Math.max;function ke(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Ee(e){return null!=e&&ke(e.length)&&!Q(e)}var Se=Object.prototype;function Ae(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Se)}function Re(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Oe(e){return T(e)&&"[object Arguments]"==j(e)}var De=Object.prototype,je=De.hasOwnProperty,Te=De.propertyIsEnumerable,Me=Oe(function(){return arguments}())?Oe:function(e){return T(e)&&je.call(e,"callee")&&!Te.call(e,"callee")};var Le="object"==typeof exports&&exports&&!exports.nodeType&&exports,qe=Le&&"object"==typeof module&&module&&!module.nodeType&&module,Ne=qe&&qe.exports===Le?C.Buffer:void 0,Fe=(Ne?Ne.isBuffer:void 0)||function(){return!1},Ie={};Ie["[object Float32Array]"]=Ie["[object Float64Array]"]=Ie["[object Int8Array]"]=Ie["[object Int16Array]"]=Ie["[object Int32Array]"]=Ie["[object Uint8Array]"]=Ie["[object Uint8ClampedArray]"]=Ie["[object Uint16Array]"]=Ie["[object Uint32Array]"]=!0,Ie["[object Arguments]"]=Ie["[object Array]"]=Ie["[object ArrayBuffer]"]=Ie["[object Boolean]"]=Ie["[object DataView]"]=Ie["[object Date]"]=Ie["[object Error]"]=Ie["[object Function]"]=Ie["[object Map]"]=Ie["[object Number]"]=Ie["[object Object]"]=Ie["[object RegExp]"]=Ie["[object Set]"]=Ie["[object String]"]=Ie["[object WeakMap]"]=!1;var Pe="object"==typeof exports&&exports&&!exports.nodeType&&exports,Be=Pe&&"object"==typeof module&&module&&!module.nodeType&&module,$e=Be&&Be.exports===Pe&&w.process,ze=function(){try{var e=Be&&Be.require&&Be.require("util").types;return e||$e&&$e.binding&&$e.binding("util")}catch(e){}}(),We=ze&&ze.isTypedArray,Ke=We?function(e){return function(t){return e(t)}}(We):function(e){return T(e)&&ke(e.length)&&!!Ie[j(e)]},He=Ke,Ue=Object.prototype.hasOwnProperty;var Xe=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),Ve=Xe,Ye=Object.prototype.hasOwnProperty;function Je(e){if(!Ae(e))return Ve(e);var t=[];for(var n in Object(e))Ye.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Qe(e){return Ee(e)?function(e,t){var n=q(e),r=!n&&Me(e),o=!n&&!r&&Fe(e),i=!n&&!r&&!o&&He(e),a=n||r||o||i,s=a?Re(e.length,String):[],l=s.length;for(var c in e)!t&&!Ue.call(e,c)||a&&("length"==c||o&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||we(c,l))||s.push(c);return s}(e):Je(e)}var Ze=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ge=/^\w*$/;function et(e,t){if(q(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!M(e))||(Ge.test(e)||!Ze.test(e)||null!=t&&e in Object(t))}var tt=de(Object,"create");var nt=Object.prototype.hasOwnProperty;var rt=Object.prototype.hasOwnProperty;function ot(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function it(e,t){for(var n=e.length;n--;)if(_e(e[n][0],t))return n;return-1}ot.prototype.clear=function(){this.__data__=tt?tt(null):{},this.size=0},ot.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ot.prototype.get=function(e){var t=this.__data__;if(tt){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return nt.call(t,e)?t[e]:void 0},ot.prototype.has=function(e){var t=this.__data__;return tt?void 0!==t[e]:rt.call(t,e)},ot.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=tt&&void 0===t?"__lodash_hash_undefined__":t,this};var at=Array.prototype.splice;function st(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}st.prototype.clear=function(){this.__data__=[],this.size=0},st.prototype.delete=function(e){var t=this.__data__,n=it(t,e);return!(n<0)&&(n==t.length-1?t.pop():at.call(t,n,1),--this.size,!0)},st.prototype.get=function(e){var t=this.__data__,n=it(t,e);return n<0?void 0:t[n][1]},st.prototype.has=function(e){return it(this.__data__,e)>-1},st.prototype.set=function(e,t){var n=this.__data__,r=it(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};var lt=de(C,"Map");function ct(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function dt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}dt.prototype.clear=function(){this.size=0,this.__data__={hash:new ot,map:new(lt||st),string:new ot}},dt.prototype.delete=function(e){var t=ct(this,e).delete(e);return this.size-=t?1:0,t},dt.prototype.get=function(e){return ct(this,e).get(e)},dt.prototype.has=function(e){return ct(this,e).has(e)},dt.prototype.set=function(e,t){var n=ct(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};function ut(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a)||i,a};return n.cache=new(ut.Cache||dt),n}ut.Cache=dt;var pt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ht=/\\(\\)?/g,mt=function(e){var t=ut(e,function(e){return 500===n.size&&n.clear(),e}),n=t.cache;return t}(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(pt,function(e,n,r,o){t.push(r?o.replace(ht,"$1"):n||e)}),t}),ft=mt;function gt(e,t){return q(e)?e:et(e,t)?[e]:ft(function(e){return null==e?"":I(e)}(e))}function vt(e){if("string"==typeof e||M(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function bt(e,t){for(var n=0,r=(t=gt(t,e)).length;null!=e&&n<r;)e=e[vt(t[n++])];return n&&n==r?e:void 0}function yt(e,t,n){var r=null==e?void 0:bt(e,t);return void 0===r?n:r}function xt(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}var wt=k?k.isConcatSpreadable:void 0;function _t(e){return q(e)||Me(e)||!!(wt&&e&&e[wt])}function Ct(e,t,n,r,o){var i=-1,a=e.length;for(n||(n=_t),o||(o=[]);++i<a;){var s=e[i];t>0&&n(s)?t>1?Ct(s,t-1,n,r,o):xt(o,s):r||(o[o.length]=s)}return o}function kt(e){return(null==e?0:e.length)?Ct(e,1):[]}function Et(e){var t=this.__data__=new st(e);this.size=t.size}function St(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n<r;){var a=e[n];t(a,n,e)&&(i[o++]=a)}return i}Et.prototype.clear=function(){this.__data__=new st,this.size=0},Et.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Et.prototype.get=function(e){return this.__data__.get(e)},Et.prototype.has=function(e){return this.__data__.has(e)},Et.prototype.set=function(e,t){var n=this.__data__;if(n instanceof st){var r=n.__data__;if(!lt||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new dt(r)}return n.set(e,t),this.size=n.size,this};var At=Object.prototype.propertyIsEnumerable,Rt=Object.getOwnPropertySymbols,Ot=Rt?function(e){return null==e?[]:(e=Object(e),St(Rt(e),function(t){return At.call(e,t)}))}:function(){return[]};function Dt(e){return function(e,t,n){var r=t(e);return q(e)?r:xt(r,n(e))}(e,Qe,Ot)}var jt=de(C,"DataView"),Tt=de(C,"Promise"),Mt=de(C,"Set"),Lt="[object Map]",qt="[object Promise]",Nt="[object Set]",Ft="[object WeakMap]",It="[object DataView]",Pt=ne(jt),Bt=ne(lt),$t=ne(Tt),zt=ne(Mt),Wt=ne(ue),Kt=j;(jt&&Kt(new jt(new ArrayBuffer(1)))!=It||lt&&Kt(new lt)!=Lt||Tt&&Kt(Tt.resolve())!=qt||Mt&&Kt(new Mt)!=Nt||ue&&Kt(new ue)!=Ft)&&(Kt=function(e){var t=j(e),n="[object Object]"==t?e.constructor:void 0,r=n?ne(n):"";if(r)switch(r){case Pt:return It;case Bt:return Lt;case $t:return qt;case zt:return Nt;case Wt:return Ft}return t});var Ht=Kt,Ut=C.Uint8Array;function Xt(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new dt;++t<n;)this.add(e[t])}function Vt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function Yt(e,t){return e.has(t)}Xt.prototype.add=Xt.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Xt.prototype.has=function(e){return this.__data__.has(e)};function Jt(e,t,n,r,o,i){var a=1&n,s=e.length,l=t.length;if(s!=l&&!(a&&l>s))return!1;var c=i.get(e),d=i.get(t);if(c&&d)return c==t&&d==e;var u=-1,p=!0,h=2&n?new Xt:void 0;for(i.set(e,t),i.set(t,e);++u<s;){var m=e[u],f=t[u];if(r)var g=a?r(f,m,u,t,e,i):r(m,f,u,e,t,i);if(void 0!==g){if(g)continue;p=!1;break}if(h){if(!Vt(t,function(e,t){if(!Yt(h,t)&&(m===e||o(m,e,n,r,i)))return h.push(t)})){p=!1;break}}else if(m!==f&&!o(m,f,n,r,i)){p=!1;break}}return i.delete(e),i.delete(t),p}function Qt(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function Zt(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var Gt=k?k.prototype:void 0,en=Gt?Gt.valueOf:void 0;var tn=Object.prototype.hasOwnProperty;var nn="[object Arguments]",rn="[object Array]",on="[object Object]",an=Object.prototype.hasOwnProperty;function sn(e,t,n,r,o,i){var a=q(e),s=q(t),l=a?rn:Ht(e),c=s?rn:Ht(t),d=(l=l==nn?on:l)==on,u=(c=c==nn?on:c)==on,p=l==c;if(p&&Fe(e)){if(!Fe(t))return!1;a=!0,d=!1}if(p&&!d)return i||(i=new Et),a||He(e)?Jt(e,t,n,r,o,i):function(e,t,n,r,o,i,a){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!i(new Ut(e),new Ut(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return _e(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var s=Qt;case"[object Set]":var l=1&r;if(s||(s=Zt),e.size!=t.size&&!l)return!1;var c=a.get(e);if(c)return c==t;r|=2,a.set(e,t);var d=Jt(s(e),s(t),r,o,i,a);return a.delete(e),d;case"[object Symbol]":if(en)return en.call(e)==en.call(t)}return!1}(e,t,l,n,r,o,i);if(!(1&n)){var h=d&&an.call(e,"__wrapped__"),m=u&&an.call(t,"__wrapped__");if(h||m){var f=h?e.value():e,g=m?t.value():t;return i||(i=new Et),o(f,g,n,r,i)}}return!!p&&(i||(i=new Et),function(e,t,n,r,o,i){var a=1&n,s=Dt(e),l=s.length;if(l!=Dt(t).length&&!a)return!1;for(var c=l;c--;){var d=s[c];if(!(a?d in t:tn.call(t,d)))return!1}var u=i.get(e),p=i.get(t);if(u&&p)return u==t&&p==e;var h=!0;i.set(e,t),i.set(t,e);for(var m=a;++c<l;){var f=e[d=s[c]],g=t[d];if(r)var v=a?r(g,f,d,t,e,i):r(f,g,d,e,t,i);if(!(void 0===v?f===g||o(f,g,n,r,i):v)){h=!1;break}m||(m="constructor"==d)}if(h&&!m){var b=e.constructor,y=t.constructor;b==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof y&&y instanceof y||(h=!1)}return i.delete(e),i.delete(t),h}(e,t,n,r,o,i))}function ln(e,t,n,r,o){return e===t||(null==e||null==t||!T(e)&&!T(t)?e!=e&&t!=t:sn(e,t,n,r,ln,o))}function cn(e){return e==e&&!z(e)}function dn(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}function un(e){var t=function(e){for(var t=Qe(e),n=t.length;n--;){var r=t[n],o=e[r];t[n]=[r,o,cn(o)]}return t}(e);return 1==t.length&&t[0][2]?dn(t[0][0],t[0][1]):function(n){return n===e||function(e,t,n,r){var o=n.length,i=o,a=!r;if(null==e)return!i;for(e=Object(e);o--;){var s=n[o];if(a&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++o<i;){var l=(s=n[o])[0],c=e[l],d=s[1];if(a&&s[2]){if(void 0===c&&!(l in e))return!1}else{var u=new Et;if(r)var p=r(c,d,l,e,t,u);if(!(void 0===p?ln(d,c,3,r,u):p))return!1}}return!0}(n,e,t)}}function pn(e,t){return null!=e&&t in Object(e)}function hn(e,t){return null!=e&&function(e,t,n){for(var r=-1,o=(t=gt(t,e)).length,i=!1;++r<o;){var a=vt(t[r]);if(!(i=null!=e&&n(e,a)))break;e=e[a]}return i||++r!=o?i:!!(o=null==e?0:e.length)&&ke(o)&&we(a,o)&&(q(e)||Me(e))}(e,t,pn)}function mn(e){return function(t){return null==t?void 0:t[e]}}function fn(e){return et(e)?mn(vt(e)):function(e){return function(t){return bt(t,e)}}(e)}function gn(e){return"function"==typeof e?e:null==e?J:"object"==typeof e?q(e)?(t=e[0],n=e[1],et(t)&&cn(n)?dn(vt(t),n):function(e){var r=yt(e,t);return void 0===r&&r===n?hn(e,t):ln(n,r,3)}):un(e):fn(e);var t,n}var vn,bn=function(e,t,n){for(var r=-1,o=Object(e),i=n(e),a=i.length;a--;){var s=i[vn?a:++r];if(!1===t(o[s],s,o))break}return e},yn=bn;function xn(e,t){return e&&yn(e,t,Qe)}var wn=function(){return C.Date.now()},_n=Math.max,Cn=Math.min;function kn(e,t,n){var r,o,i,a,s,l,c=0,d=!1,u=!1,p=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function h(t){var n=r,i=o;return r=o=void 0,c=t,a=e.apply(i,n)}function m(e){var n=e-l;return void 0===l||n>=t||n<0||u&&e-c>=i}function f(){var e=wn();if(m(e))return g(e);s=setTimeout(f,function(e){var n=t-(e-l);return u?Cn(n,i-(e-c)):n}(e))}function g(e){return s=void 0,p&&r?h(e):(r=o=void 0,a)}function v(){var e=wn(),n=m(e);if(r=arguments,o=this,l=e,n){if(void 0===s)return function(e){return c=e,s=setTimeout(f,t),d?h(e):a}(l);if(u)return clearTimeout(s),s=setTimeout(f,t),h(l)}return void 0===s&&(s=setTimeout(f,t)),a}return t=X(t)||0,z(n)&&(d=!!n.leading,i=(u="maxWait"in n)?_n(X(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p),v.cancel=function(){void 0!==s&&clearTimeout(s),c=0,r=l=o=s=void 0},v.flush=function(){return void 0===s?a:g(wn())},v}var En=Object.prototype.hasOwnProperty;function Sn(e){if(null==e)return!0;if(Ee(e)&&(q(e)||"string"==typeof e||"function"==typeof e.splice||Fe(e)||He(e)||Me(e)))return!e.length;var t=Ht(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(Ae(e))return!Je(e).length;for(var n in e)if(En.call(e,n))return!1;return!0}function An(e,t){return ln(e,t)}var Rn=4294967295,On=Math.min;function Dn(e,t){if((e=Y(e))<1||e>9007199254740991)return[];var n,r=Rn,o=On(e,Rn);e-=Rn;for(var i=Re(o,t="function"==typeof(n=t)?n:J);++r<e;)t(r);return i}var jn=Math.max;var Tn=function(e,t){return ye(function(e,t,n){return t=Ce(void 0===t?e.length-1:t,0),function(){for(var r=arguments,o=-1,i=Ce(r.length-t,0),a=Array(i);++o<i;)a[o]=r[t+o];o=-1;for(var s=Array(t+1);++o<t;)s[o]=r[o];return s[t]=n(a),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,s)}}(e,t,J),e+"")}(function(e){if(!e||!e.length)return[];var t=0;return e=St(e,function(e){if(T(n=e)&&Ee(n))return t=jn(e.length,t),!0;var n}),Re(t,function(t){return L(e,mn(t))})}),Mn=Tn;const Ln=e=>({...e,category:"comparison"}),qn=Ln({name:"Less than",latex:"<",command:"\\lt"}),Nn=Ln({name:"Greater than",latex:">",command:"\\gt"}),Fn=Ln({name:"Less than or equal",latex:"\\le",symbol:"<=",command:"\\le",ariaLabel:"less than or equal to"}),In=Ln({name:"Greater than or equal",symbol:">=",command:"\\ge",latex:"\\ge"});var Pn=Object.freeze({__proto__:null,lessThan:qn,greaterThan:Nn,lessThanEqual:Fn,greaterThanEqual:In});const Bn=e=>t=>({...t,category:e}),$n=(e=[],t=[])=>{t=t.filter((e=>t=>{const n=kt(e),r=n.some(e=>e.latex===t.latex),o=n.some(e=>e.name===t.name);return!r&&!o})(e));const n=[];Dn(5-e.length,()=>e.push([])),Dn(5,()=>n.push([]));const r=((e=[])=>{const t=[];Dn(5,()=>t.push([]));let n=e.length,r=0,o=0;for(;o<n;)t[r++].push(e[o++]),5===r&&(r=0);return t})(t);for(let t=0;t<5;t++)n[t]=[...e[t],...r[t]];return n},zn=Bn("vars"),Wn=zn({name:"X",latex:"x",write:"x"}),Kn=zn({name:"Y",latex:"y",write:"y"}),Hn=zn({name:"Theta",latex:"\\theta",write:"\\theta"});var Un=Object.freeze({__proto__:null,x:Wn,y:Kn,theta:Hn});const Xn=Bn("fractions"),Vn=Xn({name:"blank/blank",latex:"\\frac{}{}",command:"\\frac",ariaLabel:"fraction"}),Yn=Xn({latex:"\\frac{x}{ }",name:"X/blank",label:"x/[]",command:"/",ariaLabel:"x over blank fraction"}),Jn=Xn({name:"X (blank/blank)",latex:"x\\frac{}{}",label:"x([]/[])",command:"\\frac",ariaLabel:"mixed number"});var Qn=Object.freeze({__proto__:null,blankOverBlank:Vn,xOverBlank:Yn,xBlankBlank:Jn});const Zn=Bn("exponent"),Gn=Zn({name:"Squared",latex:"x^2",write:"^2"}),er=Zn({name:"X to the power of n",latex:"x^{}",command:"^",ariaLabel:"exponent"}),tr=Zn({name:"Square root",latex:"\\sqrt{}",command:"\\sqrt"}),nr=Zn({name:"Nth root",latex:"\\sqrt[{}]{}",command:"\\nthroot"});var rr=Object.freeze({__proto__:null,squared:Gn,xToPowerOfN:er,squareRoot:tr,nthRoot:nr});const or=Bn("misc"),ir=or({name:"Plus or Minus",latex:"\\pm",write:"\\pm"}),ar=or({name:"Absolute Value",latex:"\\abs{}",symbol:"| |",command:"|"}),sr=or({name:"Parenthesis",latex:"\\left(\\right)",symbol:"( )",command:"("}),lr=or({name:"Brackets",latex:"\\left[\\right]",symbol:"[ ]",command:"["}),cr=or({name:"Percent",latex:"%",command:"%"}),dr=or({latex:"\\approx",command:"\\approx",ariaLabel:"Approximately equal to"}),ur=or({latex:"\\napprox",command:"\\napprox",ariaLabel:"Not pproximately equal to"}),pr=or({latex:"\\neq",command:"\\neq",ariaLabel:"Not equals"}),hr=or({latex:"\\sim",command:"\\sim",ariaLabel:"Similar"}),mr=or({latex:"\\nsim",command:"\\nsim",ariaLabel:"Not similar"});var fr=Object.freeze({__proto__:null,plusMinus:ir,absValue:ar,parenthesis:sr,brackets:lr,percentage:cr,approx:dr,nApprox:ur,notEqual:pr,similar:hr,notSimilar:mr});const gr=Bn("constants"),vr=gr({name:"Pi",label:"π",latex:"\\pi",command:"\\pi",category:"constants"}),br=gr({name:"Eulers",label:"e",latex:"e",command:"e",category:"constants"}),yr=gr({name:"Infinity",label:"\\infty",latex:"\\infty",command:"\\infty",category:"constants"}),xr=gr({name:"Half Infinity",label:"\\propto",latex:"\\propto",command:"\\propto",category:"constants"});var wr=Object.freeze({__proto__:null,pi:vr,eulers:br,infinity:yr,halfInfinity:xr});const _r=Bn("trigonometry"),Cr=_r({name:"sine",label:"sin",command:"\\sin",latex:"\\sin"}),kr=_r({name:"cosine",label:"cos",command:"\\cos",latex:"\\cos"}),Er=_r({name:"tanget",label:"tan",command:"\\tan",latex:"\\tan"}),Sr=_r({name:"secant",label:"sec",command:"\\sec",latex:"\\sec"}),Ar=_r({name:"cosecant",label:"csc",command:"\\csc",latex:"\\csc"}),Rr=_r({name:"cotangent",label:"cot",command:"\\cot",latex:"\\cot"});var Or=Object.freeze({__proto__:null,sin:Cr,cos:kr,tan:Er,sec:Sr,csc:Ar,cot:Rr});const Dr=e=>({...e,category:"geometry"}),jr=Dr({name:"Line",latex:"\\overline{}",command:"\\overline"}),Tr=Dr({name:"Ray",latex:"\\overrightarrow{}",command:"\\overrightarrow"}),Mr=Dr({name:"Segment",latex:"\\overleftrightarrow{\\overline{}}",symbol:"AB",command:"\\overleftrightarrow"}),Lr=Dr({name:"Segment",latex:"\\overleftrightarrow{AB}",write:"\\overleftrightarrow{AB}",label:"AB"}),qr=Dr({name:"Parallel",latex:"\\parallel",command:"\\parallel"}),Nr=Dr({name:"Not Parallel",latex:"\\nparallel",command:"\\nparallel"}),Fr=Dr({name:"Perpendicular",latex:"\\perp",command:"\\perpendicular"}),Ir=Dr({name:"Angle",latex:"\\angle",command:"\\angle"}),Pr=Dr({name:"Over arc",latex:"\\overarc{\\overline{}}",command:"\\overarc"}),Br=Dr({name:"Measured Angle",latex:"\\measuredangle",command:["m","\\angle"]}),$r=Dr({name:"Triangle",latex:"\\triangle",command:"\\triangle"}),zr=Dr({name:"Square",latex:"\\square",command:"\\square"}),Wr=Dr({name:"Parallelogram",latex:"\\parallelogram",command:"\\parallelogram"}),Kr=Dr({name:"Circled Dot",latex:"\\odot",command:"\\odot"}),Hr=Dr({name:"Degree",latex:"\\degree",command:"\\degree"}),Ur=Dr({name:"Similar",command:"\\sim",latex:"\\sim"}),Xr=Dr({name:"Congruent To",command:"\\cong",latex:"\\cong"}),Vr=Dr({name:"Not Congruent To",command:"\\ncong",latex:"\\ncong"}),Yr=Dr({name:"Prime",label:"pam",latex:"'",write:"'"}),Jr=Dr({name:"Double Prime",latex:"''",write:"''"}),Qr=Dr({name:"Left Arrow",latex:"\\leftarrow",command:"\\leftarrow"}),Zr=Dr({name:"Right Arrow",latex:"\\rightarrow",command:"\\rightarrow"}),Gr=Dr({name:"Left and Right Arrow",latex:"\\leftrightarrow",command:"\\leftrightarrow"});var eo=Object.freeze({__proto__:null,overline:jr,overRightArrow:Tr,overLeftRightArrow:Mr,segment:Lr,parallel:qr,notParallel:Nr,perpindicular:Fr,angle:Ir,overArc:Pr,measureOfAngle:Br,triangle:$r,square:zr,parallelogram:Wr,circledDot:Kr,degree:Hr,similarTo:Ur,congruentTo:Xr,notCongruentTo:Vr,primeArcminute:Yr,doublePrimeArcSecond:Jr,leftArrow:Qr,rightArrow:Zr,leftrightArrow:Gr});const to=Bn("operators")({name:"CircleDot",label:"⋅",write:"\\cdot",ariaLabel:"Dot multiplier"});var no=Object.freeze({__proto__:null,circleDot:to});const ro=Bn("log"),oo=ro({name:"Log",label:"log",command:"\\log",latex:"\\log"}),io=ro({name:"log base n",label:"log s",latex:"\\log_{}",command:["\\log","_"]}),ao=ro({name:"natural log",label:"ln",command:"\\ln",latex:"\\ln"});var so=Object.freeze({__proto__:null,log:oo,logSubscript:io,ln:ao});const lo=Bn("sub-sup"),co=lo({name:"Superscript",latex:"x^{}",command:"^"}),uo=lo({name:"Subscript",latex:"x_{}",command:"_"});var po=Object.freeze({__proto__:null,superscript:co,subscript:uo});const ho=Bn("statistics"),mo=ho({name:"X Bar",label:"x̄",latex:"\\overline{x}",write:"\\overline{x}"}),fo=ho({name:"Y Bar",latex:"\\overline{y}",write:"\\overline{y}"}),go=ho({name:"mu",label:"mu",latex:"\\mu",write:"\\mu"}),vo=ho({name:"Sigma",ariaLabel:"Uppercase Sigma",label:"\\Sigma",latex:"\\Sigma",write:"\\Sigma"}),bo=ho({name:"sigma",ariaLabel:"Lowercase Sigma",label:"\\sigma",latex:"\\sigma",write:"\\sigma"});var yo=Object.freeze({__proto__:null,xBar:mo,yBar:fo,mu:go,sigma:vo,smallSigma:bo});const xo=Bn("operators"),wo=xo({write:"=",label:"="}),_o=xo({write:"+",label:"+"}),Co=xo({write:"−",label:"−"}),ko=xo({name:"divide",label:"÷",command:"\\divide",otherNotation:"\\div"}),Eo=xo({name:"multiply",label:"×",command:"\\times"});var So=Object.freeze({__proto__:null,equals:wo,plus:_o,minus:Co,divide:ko,multiply:Eo});const Ao=Bn("matrices"),Ro=Ao({name:"Single Cell Matrix",label:"[ ]",write:"\\begin{pmatrix}\\end{pmatrix}"}),Oo=Ao({name:"Double Cell Matrix",label:"[ ] [ ] \\\\newline [ ] [ ]",write:"\\begin{bmatrix}&\\\\&\\end{bmatrix}"});var Do=Object.freeze({__proto__:null,singleCellMatrix:Ro,doubleCellMatrix:Oo});const jo={0:"zero",1:"one",2:"two",3:"three",4:"four",5:"five",6:"six",7:"seven",8:"eight",9:"nine"};var To=Dn(10,String).map(e=>({name:jo[e],write:e,label:e,category:"digit"})).reduce((e,t)=>(e[t.name]=t,e),{comma:{name:"comma",label:",",write:",",category:"digit"},decimalPoint:{name:"decimal-point",label:".",write:".",category:"digit"}});const Mo=Bn("logic"),Lo=Mo({name:"Therefore",label:"∴",write:"∴"}),qo=Mo({name:"Long division",latex:"\\longdiv{}",command:"\\longdiv"}),No=Bn("navigation"),Fo=No({label:"◀",keystroke:"Left",ariaLabel:"Move cursor left"}),Io=No({label:"▶",keystroke:"Right",ariaLabel:"Move cursor right"}),Po={label:"⌫",category:"edit",keystroke:"Backspace",ariaLabel:"Delete"},Bo=[[Vn,cr,Wn,Gn,tr],[to,Kn,uo,er,nr],[ir,qn,Nn,Fn,In],[vr,Hn,sr,lr,ar],[pr,Cr,kr,Er,Hr]],$o=(()=>{const e=[...Bo.map(e=>[...e])];return e[0].push({name:"i",latex:"i",write:"i"}),e[1].push(oo),e[2].push(io),e[3].push(ao),e[4].push(br),e})(),zo=(()=>{const e=[...Bo.map(e=>[...e])];return e[0].push(go),e[1].push(mo),e[2].push(fo),e[3].push(vo),e[4].push(bo),e})(),Wo=[{predicate:e=>e>=3&&e<=5,set:[[qn,Nn],[Yn,Jn],[Wn,qo],[Gn,er]]},{predicate:e=>e>=6&&e<=7,set:[[Hr,qn,Nn],[to,Fn,In],[Wn,Kn,Gn,er],[ir,Yn,Jn,tr],[vr,sr,ar,nr]]},{predicate:e=>e>=8||"HS"===e,set:Bo},{predicate:"non-negative-integers",set:[[To.seven,To.eight,To.nine],[To.four,To.five,To.six],[To.one,To.two,To.three],[To.zero,{name:"",latex:"",write:""},{name:"",latex:"",write:""}],[Fo,Io,Po]]},{predicate:"integers",set:[[To.seven,To.eight,To.nine],[To.four,To.five,To.six],[To.one,To.two,To.three],[To.zero,{name:"",latex:"",write:""},Co],[Fo,Io,Po]]},{predicate:"decimals",set:[[To.seven,To.eight,To.nine],[To.four,To.five,To.six],[To.one,To.two,To.three],[To.zero,To.decimalPoint,Co],[Fo,Io,Po]]},{predicate:"fractions",set:[[To.seven,To.eight,To.nine],[To.four,To.five,To.six],[To.one,To.two,To.three],[To.zero,Vn,Co],[Fo,Io,Po]]},{predicate:"geometry",set:[[Vn,Hr,Yr,Jr,Xr,Ur],[to,Ir,Br,$r,Vr,mr],[Cr,kr,Er,vr,tr,nr],[Ar,Sr,Rr,Hn,uo,er],[jr,Tr,Mr,Pr,Fr,qr]]},{predicate:"advanced-algebra",set:$o},{predicate:"statistics",set:zo},{predicate:"item-authoring",set:[[ko,Vn,qo,xr,Gn,tr,jr,Tr,Mr,oo],[Eo,to,{name:"",latex:"",write:""},uo,er,nr,Fr,qr,Pr,io],[ir,vr,Hn,Hr,Ir,Qr,Zr,$r,zr,ao],[pr,ar,bo,go,Lo,vo,Gr,Cr,kr,Er],[Fn,In,{name:"",latex:"",write:""},{name:"",latex:"",write:""},yr,{name:"",latex:"",write:""},{name:"",latex:"",write:""},Ar,Sr,Rr]]},{predicate:e=>e>=1&&e<=2,set:[]}],Ko=e=>{const t=parseInt(e,10);if(!(e=isNaN(t)?e:t))return[];const n=Wo.find(t=>"string"==typeof t.predicate?t.predicate===e:t.predicate(e));return n?n.set||[]:"language"!==e?Wo[2].set:void 0},Ho=[...Object.values(So),...Object.values(Pn),...Object.values(wr),...Object.values(To),...Object.values(rr),...Object.values(Qn),...Object.values(eo),...Object.values(so),...Object.values(Do),...Object.values(fr),...Object.values(no),...Object.values(yo),...Object.values(po),...Object.values(Or),...Object.values(Un)],Uo=()=>{(Array.from(document.querySelectorAll("span[mathquill-command-id]"))||[]).forEach(e=>{e&&"∥"===e.innerText&&"mq-editable-field"!==e.className&&(e.style.fontSize="32px"),"′"!==e.innerText&&"′′"!==e.innerText||e.hasAttribute("data-prime")||e.setAttribute("data-prime","true")})},{one:Xo,two:Vo,three:Yo,four:Jo,five:Qo,six:Zo,seven:Go,eight:ei,nine:ti,zero:ni,comma:ri,decimalPoint:oi}=To,ii=[[Go,ei,ti,ko],[Jo,Qo,Zo,Eo],[Xo,Vo,Yo,Co],[ni,oi,ri,_o],[Fo,Io,Po,wo]];let ai;"undefined"!=typeof window&&(ai=u.getInterface(3),ai&&ai.registerEmbed&&function(e){e.registerEmbed("newLine",()=>({htmlString:'<div class="newLine"></div>',text:()=>"testText",latex:()=>"\\embed{newLine}[]"}))}(ai));const si=t,li=n,{styled:ci}=r,di=o("math-input:mq:input"),ui=ci("span")({});class pi extends si.Component{constructor(...e){super(...e),pi.prototype.__init.call(this),pi.prototype.__init2.call(this),pi.prototype.__init3.call(this),pi.prototype.__init4.call(this)}static __initStatic(){this.propTypes={className:li.string,onClick:li.func,onChange:li.func,latex:li.string,onFocus:li.func,onBlur:li.func}}componentDidMount(){if(!ai)throw new Error("MQ is not defined - but component has mounted?");this.mathField=ai.MathField(this.input,{handlers:{edit:this.onInputEdit.bind(this)}}),this.updateLatex()}componentDidUpdate(){this.updateLatex()}updateLatex(){if(!this.mathField)return;const{latex:e}=this.props;null!=e&&this.mathField.latex(e)}clear(){return this.mathField.latex(""),""}blur(){di("blur mathfield"),this.mathField.blur()}focus(){di("focus mathfield..."),this.mathField.focus()}command(e){return di("command: ",e),Array.isArray(e)?e.forEach(e=>{this.mathField.cmd(e)}):this.mathField.cmd(e),this.mathField.focus(),this.mathField.latex()}keystroke(e){return this.mathField.keystroke(e),this.mathField.focus(),this.mathField.latex()}write(e){return di("write: ",e),this.mathField.write(e),this.mathField.focus(),this.mathField.latex()}__init(){this.onInputEdit=()=>{di("[onInputEdit] ...");const{onChange:e}=this.props;this.mathField&&e&&e(this.mathField.latex())}}__init2(){this.refresh=()=>{this.blur(),this.focus()}}__init3(){this.onKeyPress=e=>{Object.keys(this.mathField.__controller.options).indexOf("ignoreNextMousedown")<0&&this.refresh(),13!==e.charCode||e.preventDefault()}}__init4(){this.onClick=e=>{const{onClick:t}=this.props;this.refresh(),t&&t(e)}}shouldComponentUpdate(e){return di("next: ",e.latex),di("current: ",this.mathField.latex()),e.latex!==this.mathField.latex()}render(){const{onFocus:e,onBlur:t,className:n}=this.props;return si.createElement(ui,{className:n,onKeyDown:this.onKeyPress,onClick:this.onClick,onFocus:e,onBlur:t,ref:e=>this.input=e})}}pi.__initStatic();const hi=n,mi=t;function fi(e){let t,n=e[0],r=1;for(;r<e.length;){const o=e[r],i=e[r+1];if(r+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=i(n)):"call"!==o&&"optionalCall"!==o||(n=i((...e)=>n.call(t,...e)),t=void 0)}return n}const gi=o("pie-lib:math-input:mq:static"),vi=/\\MathQuillMathField\[r\d*\]\{(.*?)\}/g,bi=/ /g;function yi(e=""){return e.replace(bi,"")}function xi(e){let t=0;for(let n=0;n<(e||"").length;n++)"{"===e[n]&&t++;return t}class wi extends mi.Component{static __initStatic(){this.propTypes={latex:hi.string.isRequired,onFocus:hi.func,onBlur:hi.func,className:hi.string,getFieldName:hi.func,onSubFieldChange:hi.func,onSubFieldFocus:hi.func,setInput:hi.func}}static __initStatic2(){this.defaultProps={getFieldName:()=>{}}}constructor(e){super(e),wi.prototype.__init.call(this),wi.prototype.__init2.call(this),wi.prototype.__init3.call(this),wi.prototype.__init4.call(this),wi.prototype.__init5.call(this),wi.prototype.__init6.call(this),wi.prototype.__init7.call(this),wi.prototype.__init8.call(this),wi.prototype.__init9.call(this),wi.prototype.__init10.call(this),wi.prototype.__init11.call(this),wi.prototype.__init12.call(this),wi.prototype.__init13.call(this),this.state={announcement:"",previousLatex:"",inputSource:null,isDeleteKeyPressed:!1},this.inputRef=mi.createRef()}componentDidMount(){this.update(),Uo(),this.createLiveRegion(),this.addEventListeners()}componentDidUpdate(){this.update(),Uo()}componentWillUnmount(){this.removeLiveRegion(),this.removeEventListeners()}__init(){this.createLiveRegion=()=>{this.liveRegion=document.createElement("div"),this.liveRegion.style.position="absolute",this.liveRegion.style.width="1px",this.liveRegion.style.height="1px",this.liveRegion.style.marginTop="-1px",this.liveRegion.style.clip="rect(1px, 1px, 1px, 1px)",this.liveRegion.style.overflow="hidden",this.liveRegion.setAttribute("aria-live","polite"),this.liveRegion.setAttribute("aria-atomic","true"),document.body.appendChild(this.liveRegion)}}__init2(){this.addEventListeners=()=>{const e=this.inputRef.current;e&&(e.addEventListener("keydown",this.handleKeyDown),e.addEventListener("click",this.handleMathKeyboardClick))}}__init3(){this.removeEventListeners=()=>{const e=this.inputRef.current;e&&(e.removeEventListener("keydown",this.handleKeyDown),e.removeEventListener("click",this.handleMathKeyboardClick))}}__init4(){this.removeLiveRegion=()=>{this.liveRegion&&(document.body.removeChild(this.liveRegion),this.liveRegion=null)}}__init5(){this.handleKeyDown=e=>{"Backspace"!==fi([e,"optionalAccess",e=>e.key])&&"Delete"!==fi([e,"optionalAccess",e=>e.key])||this.setState({isDeleteKeyPressed:!0}),this.setState({inputSource:"keyboard"})}}__init6(){this.handleMathKeyboardClick=()=>{this.setState({inputSource:"mathKeyboard"})}}__init7(){this.onInputEdit=e=>{if(!this.mathField||this._isProgrammaticUpdate)return;const t=this.props.getFieldName(e,this.mathField.innerFields);if(this.props.onSubFieldChange){const n=e.latex().match(/[0-9]\\ \\frac\{[^\{]*\}\{ \}/);if(fi([this,"access",e=>e.inputRef,"optionalAccess",e=>e.current])&&n&&fi([n,"optionalAccess",e=>e.length]))try{e.__controller.cursor.insLeftOf(e.__controller.cursor.parent[-1].parent),e.el().dispatchEvent(new KeyboardEvent("keydown",{keyCode:8}))}catch(e){console.error(e.toString())}else this.props.onSubFieldChange(t,e.latex())}this.announceLatexConversion(e.latex())}}__init8(){this.announceLatexConversion=e=>{if(!this.state)return void console.error("State is not initialized");const{previousLatex:t,inputSource:n,isDeleteKeyPressed:r}=this.state,o="Converted to math symbol";if("keyboard"===n&&!r){if(xi(e)>xi(t))this.announceMessage(o);else try{this.mathField.parseLatex(t),this.mathField.parseLatex(e),e==t&&this.announceMessage(o)}catch(e){console.warn("Error parsing latex:",e.message),console.warn(e)}}(this.state.previousLatex!==e||this.state.isDeleteKeyPressed)&&this.setState({previousLatex:e,isDeleteKeyPressed:!1})}}__init9(){this.announceMessage=e=>{this.setState({previousLatex:""}),this.liveRegion&&(this.liveRegion.textContent=e,setTimeout(()=>{this.liveRegion.textContent=""},500))}}__init10(){this.update=()=>{if(!ai)throw new Error("MQ is not defined - but component has mounted?");this.mathField||(this.mathField=ai.StaticMath(fi([this,"access",e=>e.inputRef,"optionalAccess",e=>e.current]),{handlers:{edit:this.onInputEdit.bind(this)}}));try{this._isProgrammaticUpdate=!0,this.mathField.parseLatex(this.props.latex),this.mathField.latex(this.props.latex)}catch(e){this.mathField.latex("\\MathQuillMathField[r1]{}")}finally{this._isProgrammaticUpdate=!1}}}__init11(){this.blur=()=>{gi("blur mathfield"),this.mathField.blur()}}__init12(){this.focus=()=>{gi("focus mathfield..."),this.mathField.focus()}}shouldComponentUpdate(e){try{const t=yi(this.mathField.parseLatex(e.latex)),n=(e.latex.match(vi)||[]).length,r=t!==yi(this.mathField.latex().trim())||n!==Object.keys(this.mathField.innerFields).length/2;return gi("[shouldComponentUpdate] ",r),r}catch(e){return console.warn("Error parsing latex:",e.message,"skip update"),console.warn(e),!1}}__init13(){this.onFocus=e=>{try{let t=e.target.parentElement.nextSibling,n=parseInt(t.getAttribute("mathquill-block-id"),10);n||(t=t.parentElement,n=parseInt(t.getAttribute("mathquill-block-id"),10));const r=this.mathField.innerFields.find(e=>e.id===n);if(r){const e=this.props.getFieldName(r,this.mathField.innerFields);this.props.setInput&&this.props.setInput(r),this.props.onSubFieldFocus(e,r)}}catch(e){console.error("error finding root block",e.message)}}}render(){const{onBlur:e,className:t}=this.props;return mi.createElement("span",{className:t,onFocus:this.onFocus,onBlur:e,ref:this.inputRef})}}wi.__initStatic(),wi.__initStatic2();const _i={"& *":{fontFamily:"MJXZERO, MJXTEX !important","-webkit-font-smoothing":"antialiased !important","& .mq-math-mode > span > var":{fontFamily:"MJXZERO, MJXTEX-I !important"},"& .mq-math-mode span var":{fontFamily:"MJXZERO, MJXTEX-I !important"},"& .mq-math-mode .mq-nonSymbola":{fontFamily:"MJXZERO, MJXTEX-I !important"},"& .mq-math-mode > span > var.mq-operator-name":{fontFamily:"MJXZERO, MJXTEX !important"},"& .mq-longdiv-inner":{marginTop:"-1px",marginLeft:"5px !important;","& > .mq-empty":{padding:"0 !important",marginLeft:"0px !important",marginTop:"2px"}},"& .mq-math-mode .mq-longdiv":{display:"inline-flex !important"},"& .mq-math-mode .mq-sqrt-prefix":{top:"0 !important"},"& .mq-math-mode .mq-empty":{padding:"9px 1px !important"},"& .mq-math-mode .mq-longdiv-inner .mq-empty":{padding:"0 !important"},"& .mq-math-mode .mq-supsub":{fontSize:"70.7% !important"},"& .mq-math-mode .mq-sqrt-stem":{marginTop:"-5px",paddingTop:"4px"},"& .mq-math-mode .mq-paren":{verticalAlign:"middle !important"},"& .mq-math-mode .mq-overarrow .mq-overarrow-inner .mq-empty":{padding:"0 !important"},"& .mq-math-mode .mq-overline .mq-overline-inner .mq-empty ":{padding:"0 !important"}}},Ci=e=>{Dn(5-e.length,()=>e.push([]));return Mn.apply(null,e)},ki=t,Ei=n,{Button:Si}=i,{IconButton:Ai}=i,{styled:Ri}=r,Oi=o,{color:Di}=a;function ji(e){let t,n=e[0],r=1;for(;r<e.length;){const o=e[r],i=e[r+1];if(r+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=i(n)):"call"!==o&&"optionalCall"!==o||(n=i((...e)=>n.call(t,...e)),t=void 0)}return n}const Ti=Oi("pie-lib:math-inline:keypad"),Mi=Ri(wi)(({latex:e})=>{const t={pointerEvents:"none",textTransform:"none !important",color:Di.text(),"& .mq-scaled.mq-sqrt-prefix":{transform:"scale(1, 0.9) !important"},"& .mq-sup-only .mq-sup":{marginBottom:"0.9px !important"},"& .mq-empty":{backgroundColor:`${Di.keypadEmptyPlaceholder()} !important`},"& .mq-overline .mq-overline-inner":{borderTop:"2px solid black"},"& .mq-non-leaf.mq-overline":{borderTop:"none !important"},"& .mq-overarrow":{width:"30px",marginTop:"0 !important",borderTop:"2px solid black",fontFamily:"Roboto, Helvetica, Arial, sans-serif !important","&.mq-arrow-both":{top:"0px !important","& *":{lineHeight:"1 !important",borderTop:"none !important"},"&:before":{fontSize:"80%",left:"calc(-13%) !important",top:"-0.31em !important"},"&:after":{fontSize:"80% !important",right:"calc(-13%) !important",top:"-1.5em"},"&.mq-empty:before":{fontSize:"80%",left:"calc(-13%)",top:"-0.26em"},"&.mq-empty:after":{fontSize:"80%",right:"calc(-13%)",top:"-0.26em"},"&.mq-empty":{minHeight:"1.4em"}},"&.mq-arrow-right:before":{fontSize:"80%",right:"calc(-13%) !important",top:"-0.26em !important"},"& .mq-overarrow-inner":{border:"none !important"},"& .mq-overarrow-inner .mq-overarrow-inner-right":{display:"none !important"}},"& .mq-root-block":{padding:"5px !important"},"& .mq-overarrow.mq-arrow-both.mq-empty:after":{right:"-6px",fontSize:"80% !important",top:"-3px"},"& .mq-overarrow.mq-arrow-right.mq-empty:before":{right:"-5px",fontSize:"80% !important",top:"-3px"},"& .mq-overarrow.mq-arrow-both.mq-empty:before":{left:"-6px",fontSize:"80% !important",top:"-3px"},"& .mq-longdiv-inner":{borderTop:"1px solid !important",paddingTop:"1.5px !important"},"& .mq-parallelogram":{lineHeight:.85},"& .mq-overarc":{borderTop:"2px solid black !important","& .mq-overline":{borderTop:"none !important"},"& .mq-overline-inner":{borderTop:"none !important",paddingTop:"0 !important"}}};return"\\parallel"===e?{...t,fontStyle:"italic !important"}:"\\overleftrightarrow{\\overline{}}"===e?{...t,"& .mq-overarrow.mq-arrow-both":{"& .mq-overline-inner":{borderTop:"none !important",paddingTop:"0 !important"},"&:after":{position:"absolute !important",top:"0px !important"}}}:t});Mi.propTypes={latex:Ei.string.isRequired};const Li=Ri("div")(()=>({..._i,width:"100%",display:"grid",gridTemplateRows:"repeat(5, minmax(40px, 60px))",gridRowGap:"0px",gridColumnGap:"0px",gridAutoFlow:"column","&.character":{textTransform:"initial !important",gridTemplateRows:"repeat(5, minmax(40px, 50px)) !important"},"&.language":{gridTemplateRows:"repeat(4, minmax(40px, 50px)) !important","& *":{fontFamily:"Roboto, Helvetica, Arial, sans-serif !important"}}})),qi=Ri(Si)(({category:e,isDelete:t,isComma:n,isDot:r})=>({minWidth:"auto",textTransform:"none",fontSize:n||r?"200% !important":"140% !important",lineHeight:n||r?"100%":"normal",color:Di.text(),backgroundColor:"operators"===e?Di.keypadButtonOperator():Di.keypadButton(),"&:hover":{backgroundColor:"operators"===e?Di.keypadButtonOperatorHover():Di.keypadButtonHover()},borderRadius:0,...t&&{fontFamily:"Roboto, Helvetica, Arial, sans-serif !important"}})),Ni=Ri(Si)(({category:e})=>({textTransform:"none",padding:0,margin:0,fontSize:"110% !important",minWidth:"auto",borderRadius:0,backgroundColor:"operators"===e?Di.keypadButtonOperator():Di.keypadButton(),"&:hover":{backgroundColor:"operators"===e?Di.keypadButtonOperatorHover():Di.keypadButtonHover()}})),Fi=Ri(Ai)(({category:e})=>({minWidth:"auto",backgroundColor:"operators"===e?Di.keypadButtonOperator():Di.keypadButton(),"&:hover":{backgroundColor:"operators"===e?Di.keypadButtonOperatorHover():Di.keypadButtonHover()},borderRadius:0,"& .icon":{height:"30px"}}));class Ii extends ki.Component{static __initStatic(){this.propTypes={className:Ei.string,controlledKeypadMode:Ei.bool,baseSet:Ei.array,additionalKeys:Ei.array,layoutForKeyPad:Ei.object,onPress:Ei.func.isRequired,onFocus:Ei.func,noDecimal:Ei.bool,setKeypadInteraction:Ei.func,mode:Ei.oneOfType([Ei.string,Ei.number])}}static __initStatic2(){this.defaultProps={baseSet:ii,noDecimal:!1}}constructor(e){super(e),Ii.prototype.__init.call(this),Ii.prototype.__init2.call(this),Ii.prototype.__init3.call(this),Ii.prototype.__init4.call(this),this.keypadRef=ki.createRef()}componentDidMount(){const e=ji([this,"access",e=>e.keypadRef,"optionalAccess",e=>e.current]),t=ji([e,"optionalAccess",e=>e.closest,"call",e=>e(".main-container")]),n=ji([e,"optionalAccess",e=>e.closest,"call",e=>e(".pie-toolbar")]);if(this.props.controlledKeypadMode&&t&&n){const e=t.getBoundingClientRect(),r=n.getBoundingClientRect(),o=e.top+e.height-(r.top+r.height);if(o<0){const n=e.height+e.top-o;t&&(t.style.height=`${n}px`)}}e&&(e.addEventListener("touchstart",this.handleKeypadInteraction,!0),e.addEventListener("mousedown",this.handleKeypadInteraction,!0))}componentWillUnmount(){const e=ji([this,"access",e=>e.keypadRef,"optionalAccess",e=>e.current]);if(this.props.controlledKeypadMode&&e){const t=e.closest(".main-container");t&&(t.style.height="unset")}e&&(e.removeEventListener("touchstart",this.handleKeypadInteraction,!0),e.removeEventListener("mousedown",this.handleKeypadInteraction,!0))}__init(){this.handleKeypadInteraction=()=>{this.props.setKeypadInteraction&&this.props.setKeypadInteraction(!0)}}__init2(){this.buttonClick=e=>{Ti("[buttonClick]",e);const{onPress:t}=this.props;t(e)}}__init3(){this.flowKeys=(e,t)=>kt([...Ci(e),...Ci(t)])}__init4(){this.keyIsNotAllowed=e=>{const{noDecimal:t}=this.props;return!(!("."===e.write&&"."===e.label||","===e.write&&","===e.label)||!t)}}render(){const{className:e,baseSet:t,additionalKeys:n,layoutForKeyPad:r,onFocus:o,mode:i}=this.props,a=["non-negative-integers","integers","decimals","fractions","item-authoring","language"].includes(i),s=a?this.flowKeys([],n||[]):this.flowKeys(t,n||[]),l=s.length%5?1:0,c={gridTemplateColumns:`repeat(${Math.floor(s.length/5)+l}, minmax(min-content, 150px))`,...(d=r,d?{gridTemplateColumns:`repeat(${d.columns}, minmax(min-content, 150px))`,gridTemplateRows:`repeat(${d.rows}, minmax(40px, 60px))`,gridAutoFlow:"initial"}:{})};var d;return ki.createElement(Li,{ref:this.keypadRef,className:[e,i].filter(Boolean).join(" "),style:c,onFocus:o},s.map((e,t)=>{const n=this.buttonClick.bind(this,e);if(!e)return ki.createElement("span",{key:`empty-${t}`});const r={onClick:n,disabled:this.keyIsNotAllowed(e),key:`${e.label||e.latex||e.command}-${t}`,...e.actions||{},...e.extraProps||{}};if(e.latex)return ki.createElement(Ni,{key:r.key,onClick:r.onClick,disabled:r.disabled,category:a?void 0:e.category,"aria-label":e.ariaLabel?e.ariaLabel:e.name||e.label,...e.actions||{},...e.extraProps||{}},ki.createElement(Mi,{latex:e.latex}));if(e.label)return ki.createElement(qi,{key:r.key,onClick:r.onClick,disabled:r.disabled,category:a?void 0:e.category,isDelete:"⌫"===e.label,isComma:","===e.label,isDot:"."===e.label,"aria-label":e.ariaLabel?e.ariaLabel:e.name||e.label,...e.actions||{},...e.extraProps||{}},e.label);{const t=e.icon?e.icon:"div";return ki.createElement(Fi,{key:r.key,tabIndex:"-1",onClick:r.onClick,disabled:r.disabled,category:a?void 0:e.category,size:"large",...e.actions||{},...e.extraProps||{}},ki.createElement(t,{className:"icon"}))}}))}}Ii.__initStatic(),Ii.__initStatic2();const Pi=t,Bi=n;class $i extends Pi.Component{constructor(...e){super(...e),$i.prototype.__init.call(this)}static __initStatic(){this.propTypes={className:Bi.string,controlledKeypadMode:Bi.bool,mode:Bi.oneOfType([Bi.string,Bi.number]),layoutForKeyPad:Bi.object,onClick:Bi.func.isRequired,onFocus:Bi.func,noDecimal:Bi.bool,additionalKeys:Bi.array,setKeypadInteraction:Bi.func}}static __initStatic2(){this.defaultProps={mode:"scientific",noDecimal:!1,additionalKeys:[]}}__init(){this.keypadPress=e=>{const{onClick:t}=this.props;var n;t((n=e).command?{value:n.command,type:"command"}:n.write?{value:n.write}:n.keystroke?{type:"cursor",value:n.keystroke}:void 0)}}render(){const{mode:e,onFocus:t,controlledKeypadMode:n,noDecimal:r,className:o,additionalKeys:i,layoutForKeyPad:a,setKeypadInteraction:s}=this.props,l=(e=>(e||[]).map(e=>{const{latex:t}=e,n=(Ho||[]).find(e=>t===e.latex||t===e.write||t===e.command||t===e.otherNotation);return t&&n||e}))(i);return Pi.createElement(Ii,{className:o,controlledKeypadMode:n,onFocus:t,noDecimal:r,layoutForKeyPad:a,additionalKeys:$n(Ko(e),l),onPress:this.keypadPress,mode:e,setKeypadInteraction:s})}}$i.__initStatic(),$i.__initStatic2();var zi,Wi,Ki,Hi={"border-radius":1,"border-top-left-radius":1,"border-top-right-radius":1,"border-bottom-left-radius":1,"border-bottom-right-radius":1,"box-shadow":1,order:1,flex:function(e,t){return[t+"box-flex"]},"box-flex":1,"box-align":1,animation:1,"animation-duration":1,"animation-name":1,transition:1,"transition-duration":1,transform:1,"transform-style":1,"transform-origin":1,"backface-visibility":1,perspective:1,"box-pack":1},Ui={animation:1,"column-count":1,columns:1,"font-weight":1,opacity:1,"order ":1,"z-index":1,zoom:1,flex:1,"box-flex":1,transform:1,perspective:1,"box-pack":1,"box-align":1,colspan:1,rowspan:1},Xi=function(e){return e.length?e.charAt(0).toUpperCase()+e.substring(1):e},Vi=Xi,Yi=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,Ji="undefined"==typeof document?{}:document.documentElement.style,Qi=(zi=function(){for(var e in Ji)if(Yi.test(e))return e.match(Yi)[0];return"WebkitOpacity"in Ji?"Webkit":"KhtmlOpacity"in Ji?"Khtml":""}(),Wi=zi.toLowerCase(),{style:zi,css:"-"+Wi+"-",dom:{Webkit:"WebKit",ms:"MS",o:"WebKit"}[zi]||Vi(zi)}),Zi=function(e,t){return t?t.toUpperCase():""},Gi=/[-\s]+(.)?/g,ea=function(e){return e?e.replace(Gi,Zi):""},ta=/::/g,na=/([A-Z]+)([A-Z][a-z])/g,ra=/([a-z\d])([A-Z])/g,oa=/_/g,ia=function(e,t){return e?e.replace(ta,"/").replace(na,"$1_$2").replace(ra,"$1_$2").replace(oa,t||"-"):""},aa=function(e){return ia(e).toLowerCase()},sa=ea,la=aa,ca=function(e){return e.length?e.charAt(0).toLowerCase()+e.substring(1):e},da=Xi,ua=Qi,pa=Hi,ha="undefined"==typeof document?{}:document.documentElement.style,ma=function(e,t){t=t||{};var n=ca(sa(e)),r=la(e),o=Ki?n:r,i=ua.style?Ki?ua.style:ua.css:"";if(n in ha)return t.asString?o:[o];var a=o,s=pa[r],l=[];if(Ki&&(a=da(o)),"function"==typeof s){var c=s(o,i)||[];c&&!Array.isArray(c)&&(c=[c]),c.length&&(c=c.map(function(e){return Ki?ca(sa(e)):la(e)})),l=l.concat(c)}return i&&l.push(i+a),l.push(o),t.asString||1==l.length?l[0]:l},fa=Object.prototype.hasOwnProperty,ga=function(e,t){return fa.call(e,t)},va=Object.prototype.toString,ba=Object.prototype.toString,ya=ma,xa=aa,wa=ea,_a=ga,Ca=function(e){return!!e&&"[object Object]"===va.call(e)},ka=function(e){return"[object Function]"===ba.apply(e)},Ea=function(e,t,n,r){ya(t).forEach(function(t){e[r?r(t):t]=n})},Sa={cssUnitless:Ui},Aa=function(e,t,n,r){"string"==typeof e&&(e=function(e){e=(e||"").split(";");var t={};return e.forEach(function(e){var n=e.split(":");2==n.length&&(t[n[0].trim()]=n[1].trim())}),t}(e)),(t=t||Sa).cssUnitless=t.cssUnitless||Sa.cssUnitless,r=r||{};var o,i,a,s,l,c,d,u,p=t.scope||{},h=null!=t.addUnits?t.addUnits:!p||null==p.addUnits||p.addUnits,m=(null!=t.cssUnitless?t.cssUnitless:p?p.cssUnitless:null)||{},f=(t.cssUnit||p?p.cssUnit:null)||"px",g=t.prefixProperties||(p?p.prefixProperties:null)||{},v=t.camelize?wa:xa;for(a in e)if(_a(e,a)){if(s=e[a],i=xa(n?n+a:a),o=!1,u=!1,ka(s)&&(d=s.call(p||e,s,a,i,e),Ca(d)&&null!=d.value?(s=d.value,u=d.prefix,i=d.name?xa(d.name):i):s=d),c="number"==(l=typeof s)||"string"==l&&""!=s&&1*s==s,null==s||null==i||""===i)continue;if((c||"string"==l)&&(o=!0),!o&&null!=s.value&&s.prefix&&(o=!0,u=s.prefix,s=s.value),o){if(u=u||!!g[i],c&&(s=h&&!(i in m)?s+f:s+""),"border"!=i&&(i.indexOf("border")||~i.indexOf("radius")||~i.indexOf("width"))||!c||(i+="-width"),!i.indexOf("border-radius-")&&(i.replace(/border(-radius)(-(.*))/,function(e,t,n){var r={"-top":["-top-left","-top-right"],"-left":["-top-left","-bottom-left"],"-right":["-top-right","-bottom-right"],"-bottom":["-bottom-left","-bottom-right"]};n in r?(i=[],r[n].forEach(function(e){i.push("border"+e+t)})):i="border"+n+t}),Array.isArray(i))){i.forEach(function(e){u?Ea(r,e,s,v):r[v(e)]=s});continue}u?Ea(r,i,s,v):r[v(i)]=s}else Aa(s,t,i+"-",r)}return r},Ra=Aa,Oa=ga,Da={prefixProperties:Hi,cssUnitless:Ui,object:Aa,string:function(e,t){e=Ra(e,t);var n,r=[];for(n in e)Oa(e,n)&&r.push(n+": "+e[n]);return r.join("; ")}};const ja=o("@pie-lib:mask-markup:serialization"),Ta=["span"],Ma=["em","strong","u"],La=(e,t)=>{const n=e.getAttribute(t);return r=(e=>{const t=/([\w-]*)\s*:\s*([^;]*)/g;let n;const r={};for(;n=t.exec(e);)r[n[1]]=n[2].trim();return r})(n),Da.object(r,{camelize:!0,addUnits:!1});var r},qa=["border","class","style"],Na={b:"bold",em:"italic",u:"underline",s:"strikethrough",code:"code",strong:"strong"},Fa=(e,t=[])=>{if(8===e.nodeType)return null;if(3===e.nodeType){const n={text:e.textContent};return t.length>0&&(n.marks=t.map(e=>({type:e,data:void 0}))),{object:"text",leaves:[n]}}if(1===e.nodeType){const r=e.tagName.toLowerCase(),o=Na[r];if(o){ja("[deserialize] mark: ",o);return{_flatten:!0,nodes:Ia(e.childNodes,[...t,o])}}if("math"===r)return{isMath:!0,nodes:[e]};const i=(e=>{if(!e.attributes||e.attributes.length<=0)return;const t={};let n;for(n=0;n<e.attributes.length;n++){const r=e.attributes[n];t[r.name]=r.value}return t})(e)||{};"audio"===r&&""===i.controls&&(i.controls=!0);const a=qa.reduce((n=e,(e,t)=>{if(!n.getAttribute)return e;if(n.getAttribute(t))switch(t){case"style":e.style=La(n,t);break;case"class":e.className=((e,t,n)=>{const r=e.getAttribute(n);return delete t.class,r})(n,e,t);break;default:e[t]=n.getAttribute(t)}return e}),{...i}),s=(e=>Ta.includes(e)?"inline":Ma.includes(e)?"mark":"block")(r),l=Ia(e.childNodes,t);return{object:s,type:r,data:{dataset:{...e.dataset},attributes:{...a}},nodes:l}}var n;return null},Ia=(e,t=[])=>{const n=[];for(let r=0;r<e.length;r++){const o=Fa(e[r],t);null!==o&&(o._flatten&&o.nodes?n.push(...o.nodes):n.push(o))}return n},Pa=t,Ba=n,{styled:$a}=r,{renderMath:za}=d;function Wa(e){let t,n=e[0],r=1;for(;r<e.length;){const o=e[r],i=e[r+1];if(r+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=i(n)):"call"!==o&&"optionalCall"!==o||(n=i((...e)=>n.call(t,...e)),t=void 0)}return n}const Ka=$a("div")(({theme:e})=>({paddingTop:e.spacing(.5),paddingBottom:e.spacing(.5)})),Ha=$a("span")(()=>({display:"inline-block",width:".75em"})),Ua=["tbody","tr"],Xa=(e,t,n,r,o,i)=>{if(!t)return null;const a=[];return(e.nodes||[]).forEach((e,s)=>{const l=e.type?`${e.type}-${s}`:`${s}`;if(e.isMath)return a.push(Pa.createElement("span",{dangerouslySetInnerHTML:{__html:`<math displaystyle="true">${e.nodes[0].innerHTML}</math>`}})),a;if(r){const l=r(e,t,n);if(l)return a.push(l),void("td"!==Wa([o,"optionalAccess",e=>e.type])&&"drag-in-the-blank"===i&&a.push(Pa.createElement(Ha,{key:`spacer-${s}`})))}if("text"===e.object){const t=e.leaves.reduce((e,t)=>{const n=t.text,r=((e,t)=>{const n=""===t.trim(),r=e&&e.type;return n&&Ua.includes(r)?void 0:t})(o,n);return r?e+r:e},""),n=(e=>{const t=e.leaves.find(e=>yt(e,"marks",[]).length);return t?t.marks[0]:null})(e);if(n){let e;for(e in Na)if(Na[e]===n.type){const n=e;a.push(Pa.createElement(n,{key:l},t));break}}else t.length>0&&(a.push(t),"td"!==Wa([o,"optionalAccess",e=>e.type])&&"drag-in-the-blank"===i&&a.push(Pa.createElement(Ha,{key:`spacer-${s}`})))}else{const o=Xa(e,t,n,r,e,i);if("p"===e.type||"paragraph"===e.type)a.push(Pa.createElement(Ka,{key:l},o));else{const t=e.type;e.nodes&&e.nodes.length>0?a.push(Pa.createElement(t,{key:l,...e.data.attributes},o)):a.push(Pa.createElement(t,{key:l,...e.data.attributes}))}}}),a},Va=$a("div")(()=>({display:"initial","&:not(.MathJax) table":{borderCollapse:"collapse"},"&:not(.MathJax) table td, &:not(.MathJax) table th":{padding:"8px 12px",textAlign:"left"}}));class Ya extends Pa.Component{constructor(e){super(e),Ya.prototype.__init.call(this),this.internalContainerRef=Pa.createRef()}static __initStatic(){this.propTypes={renderChildren:Ba.func,layout:Ba.object,value:Ba.object,onChange:Ba.func,elementType:Ba.string,containerRef:Ba.oneOfType([Ba.func,Ba.shape({current:Ba.instanceOf(Element)})])}}componentDidMount(){const e=this.props.containerRef||this.internalContainerRef;e.current&&"function"==typeof za&&za(e.current)}__init(){this.handleChange=(e,t)=>{const n={...this.props.value,[e]:t};this.props.onChange(n)}}render(){const{value:e,layout:t,elementType:n,containerRef:r}=this.props,o=Xa(t,e,this.handleChange,this.props.renderChildren,null,n),i=r||this.internalContainerRef;return Pa.createElement(Va,{ref:i},o)}}Ya.__initStatic();const Ja=/\{\{(\d+)\}\}/g;const Qa=t,Za=n;var Ga;const es=(e,t)=>{const{markup:n}=(o=t,(r=e)?{markup:r.replace(Ja,(e,t)=>`<span data-component="${o}" data-id="${t}"></span>`)}:{markup:""});var r,o;return(e=>{if(!e||!e.trim())return{object:"value",document:{object:"document",data:{},nodes:[{object:"block",type:"span",data:{},isVoid:!1,nodes:[]}]}};const t=(new DOMParser).parseFromString(e,"text/html");let n=Ia(t.body.childNodes);return!n.some(e=>"block"===e.object||"inline"===e.object)&&n.length>0&&(n=[{object:"block",type:"span",data:{},isVoid:!1,nodes:n}]),0===n.length&&(n=[{object:"block",type:"span",data:{},isVoid:!1,nodes:[]}]),{object:"value",document:{object:"document",data:{},nodes:n}}})(n).document},ts=(e,t)=>((Ga=class extends Qa.Component{static __initStatic(){this.propTypes={markup:Za.string,layout:Za.object,value:Za.object,onChange:Za.func,customMarkMarkupComponent:Za.func,elementType:Za.string}}constructor(e){super(e),this.containerRef=Qa.createRef()}componentDidUpdate(e){if(this.props.markup!==e.markup){const e=this.containerRef.current;(e&&e.querySelectorAll('[data-latex][data-math-handled="true"]')||[]).forEach(e=>{const t=e.querySelector("mjx-container");t&&e.removeChild(t);const n=e.getAttribute("data-raw");e.innerHTML=n,e.removeAttribute("data-math-handled")})}}render(){const{markup:n,layout:r,value:o,onChange:i,elementType:a}=this.props,s=r||es(n,e);return Qa.createElement(Ya,{containerRef:this.containerRef,elementType:a,layout:s,value:o,onChange:i,renderChildren:t(this.props)})}}).__initStatic(),Ga),{useMemo:ns}=t,{useLayoutEffect:rs}=t,{useEffect:os}=t,{useRef:is}=t,{useCallback:as}=t,ss="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function ls(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function cs(e){return"nodeType"in e}function ds(e){var t,n;return e?ls(e)?e:cs(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function us(e){const{Document:t}=ds(e);return e instanceof t}function ps(e){return!ls(e)&&e instanceof ds(e).HTMLElement}function hs(e){return e instanceof ds(e).SVGElement}function ms(e){return e?ls(e)?e.document:cs(e)?us(e)?e:ps(e)||hs(e)?e.ownerDocument:document:document:document}const fs=ss?rs:os;function gs(e){const t=is(e);return fs(()=>{t.current=e}),as(function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)},[])}function vs(e,t){void 0===t&&(t=[e]);const n=is(e);return fs(()=>{n.current!==e&&(n.current=e)},t),n}function bs(e,t){const n=is();return ns(()=>{const t=e(n.current);return n.current=t,t},[...t])}function ys(e){const t=gs(e),n=is(null),r=as(e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e},[]);return[n,r]}function xs(e){const t=is();return os(()=>{t.current=e},[e]),t.current}let ws={};function _s(e,t){return ns(()=>{if(t)return t;const n=null==ws[e]?0:ws[e]+1;return ws[e]=n,e+"-"+n},[e,t])}function Cs(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((t,n)=>{const r=Object.entries(n);for(const[n,o]of r){const r=t[n];null!=r&&(t[n]=r+e*o)}return t},{...t})}}const ks=Cs(1),Es=Cs(-1);function Ss(e){if(!e)return!1;const{KeyboardEvent:t}=ds(e.target);return t&&e instanceof t}function As(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=ds(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const Rs=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Rs.Translate.toString(e),Rs.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Os="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Ds(e){return e.matches(Os)?e:e.querySelector(Os)}const js=t,{useState:Ts}=t,{useCallback:Ms}=t,Ls={display:"none"};function qs(e){let{id:t,value:n}=e;return js.createElement("div",{id:t,style:Ls},n)}function Ns(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;return js.createElement("div",{id:t,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":r,"aria-atomic":!0},n)}const Fs=t,{createContext:Is}=t,{useContext:Ps}=t,{useEffect:Bs}=t,{useState:$s}=t,{useCallback:zs}=t,{useMemo:Ws}=t,{useRef:Ks}=t,{memo:Hs}=t,{useReducer:Us}=t,{cloneElement:Xs}=t,{forwardRef:Vs}=t,{createPortal:Ys}=e,{unstable_batchedUpdates:Js}=e,Qs=Is(null);const Zs={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},Gs={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function el(e){let{announcements:t=Gs,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Zs}=e;const{announce:i,announcement:a}=function(){const[e,t]=Ts("");return{announce:Ms(e=>{null!=e&&t(e)},[]),announcement:e}}(),s=_s("DndLiveRegion"),[l,c]=$s(!1);if(Bs(()=>{c(!0)},[]),function(e){const t=Ps(Qs);Bs(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}(Ws(()=>({onDragStart(e){let{active:n}=e;i(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&i(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;i(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;i(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;i(t.onDragCancel({active:n,over:r}))}}),[i,t])),!l)return null;const d=Fs.createElement(Fs.Fragment,null,Fs.createElement(qs,{id:r,value:o.draggable}),Fs.createElement(Ns,{id:s,announcement:a}));return n?Ys(d,n):d}var tl;function nl(){}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(tl||(tl={}));const rl=Object.freeze({x:0,y:0});function ol(e,t){const n=As(e);if(!n)return"0 0";return(n.x-t.left)/t.width*100+"% "+(n.y-t.top)/t.height*100+"%"}function il(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function al(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),a=o-r,s=i-n;if(r<o&&n<i){const n=t.width*t.height,r=e.width*e.height,o=a*s;return Number((o/(n+r-o)).toFixed(4))}return 0}const sl=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const e of r){const{id:r}=e,i=n.get(r);if(i){const n=al(i,t);n>0&&o.push({id:r,data:{droppableContainer:e,value:n}})}}return o.sort(il)};function ll(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:rl}const cl=(dl=1,function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.reduce((e,t)=>({...e,top:e.top+dl*t.y,bottom:e.bottom+dl*t.y,left:e.left+dl*t.x,right:e.right+dl*t.x}),{...e})});var dl;function ul(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}const pl={ignoreTransform:!1};function hl(e,t){void 0===t&&(t=pl);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:r}=ds(e).getComputedStyle(e);t&&(n=function(e,t,n){const r=ul(t);if(!r)return e;const{scaleX:o,scaleY:i,x:a,y:s}=r,l=e.left-a-(1-o)*parseFloat(n),c=e.top-s-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),d=o?e.width/o:e.width,u=i?e.height/i:e.height;return{width:d,height:u,top:c,right:l+d,bottom:c+u,left:l}}(n,t,r))}const{top:r,left:o,width:i,height:a,bottom:s,right:l}=n;return{top:r,left:o,width:i,height:a,bottom:s,right:l}}function ml(e){return hl(e,{ignoreTransform:!0})}function fl(e,t){const n=[];return e?function r(o){if(null!=t&&n.length>=t)return n;if(!o)return n;if(us(o)&&null!=o.scrollingElement&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!ps(o)||hs(o))return n;if(n.includes(o))return n;const i=ds(e).getComputedStyle(o);return o!==e&&function(e,t){void 0===t&&(t=ds(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(e=>{const r=t[e];return"string"==typeof r&&n.test(r)})}(o,i)&&n.push(o),function(e,t){return void 0===t&&(t=ds(e).getComputedStyle(e)),"fixed"===t.position}(o,i)?n:r(o.parentNode)}(e):n}function gl(e){const[t]=fl(e,1);return null!=t?t:null}function vl(e){return ss&&e?ls(e)?e:cs(e)?us(e)||e===ms(e).scrollingElement?window:ps(e)?e:null:null:null}function bl(e){return ls(e)?e.scrollX:e.scrollLeft}function yl(e){return ls(e)?e.scrollY:e.scrollTop}function xl(e){return{x:bl(e),y:yl(e)}}var wl;function _l(e){return!(!ss||!e)&&e===document.scrollingElement}function Cl(e){const t={x:0,y:0},n=_l(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(wl||(wl={}));const kl={x:.2,y:.2};function El(e,t,n,r,o){let{top:i,left:a,right:s,bottom:l}=n;void 0===r&&(r=10),void 0===o&&(o=kl);const{isTop:c,isBottom:d,isLeft:u,isRight:p}=Cl(e),h={x:0,y:0},m={x:0,y:0},f=t.height*o.y,g=t.width*o.x;return!c&&i<=t.top+f?(h.y=wl.Backward,m.y=r*Math.abs((t.top+f-i)/f)):!d&&l>=t.bottom-f&&(h.y=wl.Forward,m.y=r*Math.abs((t.bottom-f-l)/f)),!p&&s>=t.right-g?(h.x=wl.Forward,m.x=r*Math.abs((t.right-g-s)/g)):!u&&a<=t.left+g&&(h.x=wl.Backward,m.x=r*Math.abs((t.left+g-a)/g)),{direction:h,speed:m}}function Sl(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Al(e){return e.reduce((e,t)=>ks(e,xl(t)),rl)}function Rl(e,t){if(void 0===t&&(t=hl),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);gl(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Ol=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+bl(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+yl(t),0)}]];class Dl{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=fl(t),r=Al(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,o]of Ol)for(const i of t)Object.defineProperty(this,i,{get:()=>{const t=o(n),a=r[e]-t;return this.rect[i]+a},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class jl{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function Tl(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var Ml,Ll;function ql(e){e.preventDefault()}function Nl(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(Ml||(Ml={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"}(Ll||(Ll={}));const Fl={start:[Ll.Space,Ll.Enter],cancel:[Ll.Esc],end:[Ll.Space,Ll.Enter,Ll.Tab]},Il=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Ll.Right:return{...n,x:n.x+25};case Ll.Left:return{...n,x:n.x-25};case Ll.Down:return{...n,y:n.y+25};case Ll.Up:return{...n,y:n.y-25}}};class Pl{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new jl(ms(t)),this.windowListeners=new jl(ds(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ml.Resize,this.handleCancel),this.windowListeners.add(Ml.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ml.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Rl(n),t(rl)}handleKeyDown(e){if(Ss(e)){const{active:t,context:n,options:r}=this.props,{keyboardCodes:o=Fl,coordinateGetter:i=Il,scrollBehavior:a="smooth"}=r,{code:s}=e;if(o.end.includes(s))return void this.handleEnd(e);if(o.cancel.includes(s))return void this.handleCancel(e);const{collisionRect:l}=n.current,c=l?{x:l.left,y:l.top}:rl;this.referenceCoordinates||(this.referenceCoordinates=c);const d=i(e,{active:t,context:n.current,currentCoordinates:c});if(d){const t=Es(d,c),r={x:0,y:0},{scrollableAncestors:o}=n.current;for(const n of o){const o=e.code,{isTop:i,isRight:s,isLeft:l,isBottom:c,maxScroll:u,minScroll:p}=Cl(n),h=Sl(n),m={x:Math.min(o===Ll.Right?h.right-h.width/2:h.right,Math.max(o===Ll.Right?h.left:h.left+h.width/2,d.x)),y:Math.min(o===Ll.Down?h.bottom-h.height/2:h.bottom,Math.max(o===Ll.Down?h.top:h.top+h.height/2,d.y))},f=o===Ll.Right&&!s||o===Ll.Left&&!l,g=o===Ll.Down&&!c||o===Ll.Up&&!i;if(f&&m.x!==d.x){const e=n.scrollLeft+t.x,i=o===Ll.Right&&e<=u.x||o===Ll.Left&&e>=p.x;if(i&&!t.y)return void n.scrollTo({left:e,behavior:a});r.x=i?n.scrollLeft-e:o===Ll.Right?n.scrollLeft-u.x:n.scrollLeft-p.x,r.x&&n.scrollBy({left:-r.x,behavior:a});break}if(g&&m.y!==d.y){const e=n.scrollTop+t.y,i=o===Ll.Down&&e<=u.y||o===Ll.Up&&e>=p.y;if(i&&!t.x)return void n.scrollTo({top:e,behavior:a});r.y=i?n.scrollTop-e:o===Ll.Down?n.scrollTop-u.y:n.scrollTop-p.y,r.y&&n.scrollBy({top:-r.y,behavior:a});break}}this.handleMove(e,ks(Es(d,this.referenceCoordinates),r))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function Bl(e){return Boolean(e&&"distance"in e)}function $l(e){return Boolean(e&&"delay"in e)}Pl.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Fl,onActivation:o}=t,{active:i}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const t=i.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==o||o({event:e.nativeEvent}),!0)}return!1}}];class zl{constructor(e,t,n){var r;void 0===n&&(n=function(e){const{EventTarget:t}=ds(e);return e instanceof t?e:ms(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:o}=e,{target:i}=o;this.props=e,this.events=t,this.document=ms(i),this.documentListeners=new jl(this.document),this.listeners=new jl(n),this.windowListeners=new jl(ds(i)),this.initialCoordinates=null!=(r=As(o))?r:rl,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Ml.Resize,this.handleCancel),this.windowListeners.add(Ml.DragStart,ql),this.windowListeners.add(Ml.VisibilityChange,this.handleCancel),this.windowListeners.add(Ml.ContextMenu,ql),this.documentListeners.add(Ml.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if($l(t))return this.timeoutId=setTimeout(this.handleStart,t.delay),void this.handlePending(t);if(Bl(t))return void this.handlePending(t)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){const{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Ml.Click,Nl,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ml.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:o}=this,{onMove:i,options:{activationConstraint:a}}=o;if(!r)return;const s=null!=(t=As(e))?t:rl,l=Es(r,s);if(!n&&a){if(Bl(a)){if(null!=a.tolerance&&Tl(l,a.tolerance))return this.handleCancel();if(Tl(l,a.distance))return this.handleStart()}return $l(a)&&Tl(l,a.tolerance)?this.handleCancel():void this.handlePending(a,l)}e.cancelable&&e.preventDefault(),i(s)}handleEnd(){const{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){const{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Ll.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const Wl={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Kl extends zl{constructor(e){const{event:t}=e,n=ms(t.target);super(e,Wl,n)}}Kl.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!(!n.isPrimary||0!==n.button)&&(null==r||r({event:n}),!0)}}];const Hl={move:{name:"mousemove"},end:{name:"mouseup"}};var Ul;!function(e){e[e.RightClick=2]="RightClick"}(Ul||(Ul={}));(class extends zl{constructor(e){super(e,Hl,ms(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==Ul.RightClick&&(null==r||r({event:n}),!0)}}];const Xl={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var Vl,Yl;function Jl(e){let{acceleration:t,activator:n=Vl.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:a=5,order:s=Yl.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:d,delta:u,threshold:p}=e;const h=function(e){let{delta:t,disabled:n}=e;const r=xs(t);return bs(e=>{if(n||!r||!e)return Ql;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[wl.Backward]:e.x[wl.Backward]||-1===o.x,[wl.Forward]:e.x[wl.Forward]||1===o.x},y:{[wl.Backward]:e.y[wl.Backward]||-1===o.y,[wl.Forward]:e.y[wl.Forward]||1===o.y}}},[n,t,r])}({delta:u,disabled:!i}),[m,f]=function(){const e=is(null);return[as((t,n)=>{e.current=setInterval(t,n)},[]),as(()=>{null!==e.current&&(clearInterval(e.current),e.current=null)},[])]}(),g=Ks({x:0,y:0}),v=Ks({x:0,y:0}),b=Ws(()=>{switch(n){case Vl.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Vl.DraggableRect:return o}},[n,o,l]),y=Ks(null),x=zs(()=>{const e=y.current;if(!e)return;const t=g.current.x*v.current.x,n=g.current.y*v.current.y;e.scrollBy(t,n)},[]),w=Ws(()=>s===Yl.TreeOrder?[...c].reverse():c,[s,c]);Bs(()=>{if(i&&c.length&&b){for(const e of w){if(!1===(null==r?void 0:r(e)))continue;const n=c.indexOf(e),o=d[n];if(!o)continue;const{direction:i,speed:s}=El(e,o,b,t,p);for(const e of["x","y"])h[e][i[e]]||(s[e]=0,i[e]=0);if(s.x>0||s.y>0)return f(),y.current=e,m(x,a),g.current=s,void(v.current=i)}g.current={x:0,y:0},v.current={x:0,y:0},f()}else f()},[t,x,r,f,i,a,JSON.stringify(b),JSON.stringify(h),m,c,w,d,JSON.stringify(p)])}(class extends zl{constructor(e){super(e,Xl)}static setup(){return window.addEventListener(Xl.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Xl.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return!(o.length>1)&&(null==r||r({event:n}),!0)}}],function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"}(Vl||(Vl={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(Yl||(Yl={}));const Ql={x:{[wl.Backward]:!1,[wl.Forward]:!1},y:{[wl.Backward]:!1,[wl.Forward]:!1}};var Zl,Gl;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(Zl||(Zl={})),function(e){e.Optimized="optimized"}(Gl||(Gl={}));const ec=new Map;function tc(e,t){return bs(n=>e?n||("function"==typeof t?t(e):e):null,[t,e])}function nc(e){let{callback:t,disabled:n}=e;const r=gs(t),o=Ws(()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(r)},[n]);return Bs(()=>()=>null==o?void 0:o.disconnect(),[o]),o}function rc(e){return new Dl(hl(e),e)}function oc(e,t,n){void 0===t&&(t=rc);const[r,o]=$s(null);function i(){o(r=>{if(!e)return null;var o;if(!1===e.isConnected)return null!=(o=null!=r?r:n)?o:null;const i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}const a=function(e){let{callback:t,disabled:n}=e;const r=gs(t),o=Ws(()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(r)},[r,n]);return Bs(()=>()=>null==o?void 0:o.disconnect(),[o]),o}({callback(t){if(e)for(const n of t){const{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){i();break}}}}),s=nc({callback:i});return fs(()=>{i(),e?(null==s||s.observe(e),null==a||a.observe(document.body,{childList:!0,subtree:!0})):(null==s||s.disconnect(),null==a||a.disconnect())},[e]),r}const ic=[];function ac(e,t){void 0===t&&(t=[]);const n=Ks(null);return Bs(()=>{n.current=null},t),Bs(()=>{const t=e!==rl;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Es(e,n.current):rl}function sc(e){return Ws(()=>e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null,[e])}const lc=[];function cc(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ps(t)?t:e}const dc=[{sensor:Kl,options:{}},{sensor:Pl,options:{}}],uc={current:{}},pc={draggable:{measure:ml},droppable:{measure:ml,strategy:Zl.WhileDragging,frequency:Gl.Optimized},dragOverlay:{measure:hl}};class hc extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const mc={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new hc,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:nl},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:pc,measureDroppableContainers:nl,windowRect:null,measuringScheduled:!1},fc={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:nl,draggableNodes:new Map,over:null,measureDroppableContainers:nl},gc=Is(fc),vc=Is(mc);function bc(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new hc}}}function yc(e,t){switch(t.type){case tl.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case tl.DragMove:return null==e.draggable.active?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case tl.DragEnd:case tl.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case tl.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new hc(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case tl.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const a=new hc(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case tl.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new hc(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function xc(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=Ps(gc),i=xs(r),a=xs(null==n?void 0:n.id);return Bs(()=>{if(!t&&!r&&i&&null!=a){if(!Ss(i))return;if(document.activeElement===i.target)return;const e=o.get(a);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=Ds(e);if(t){t.focus();break}}})}},[r,t,o,a,i]),null}function wc(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}const _c=Is({...rl,scaleX:1,scaleY:1});var Cc;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(Cc||(Cc={})),Hs(function(e){var t,n,r,o;let{id:i,accessibility:a,autoScroll:s=!0,children:l,sensors:c=dc,collisionDetection:d=sl,measuring:u,modifiers:p,...h}=e;const m=Us(yc,void 0,bc),[f,g]=m,[v,b]=function(){const[e]=$s(()=>new Set),t=zs(t=>(e.add(t),()=>e.delete(t)),[e]);return[zs(t=>{let{type:n,event:r}=t;e.forEach(e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)})},[e]),t]}(),[y,x]=$s(Cc.Uninitialized),w=y===Cc.Initialized,{draggable:{active:_,nodes:C,translate:k},droppable:{containers:E}}=f,S=null!=_?C.get(_):null,A=Ks({initial:null,translated:null}),R=Ws(()=>{var e;return null!=_?{id:_,data:null!=(e=null==S?void 0:S.data)?e:uc,rect:A}:null},[_,S]),O=Ks(null),[D,j]=$s(null),[T,M]=$s(null),L=vs(h,Object.values(h)),q=_s("DndDescribedBy",i),N=Ws(()=>E.getEnabled(),[E]),F=Ws(()=>({draggable:{...pc.draggable,...null==I?void 0:I.draggable},droppable:{...pc.droppable,...null==I?void 0:I.droppable},dragOverlay:{...pc.dragOverlay,...null==I?void 0:I.dragOverlay}}),[null==(I=u)?void 0:I.draggable,null==I?void 0:I.droppable,null==I?void 0:I.dragOverlay]);var I;const{droppableRects:P,measureDroppableContainers:B,measuringScheduled:$}=function(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,a]=$s(null),{frequency:s,measure:l,strategy:c}=o,d=Ks(e),u=function(){switch(c){case Zl.Always:return!1;case Zl.BeforeDragging:return n;default:return!n}}(),p=vs(u),h=zs(function(e){void 0===e&&(e=[]),p.current||a(t=>null===t?e:t.concat(e.filter(e=>!t.includes(e))))},[p]),m=Ks(null),f=bs(t=>{if(u&&!n)return ec;if(!t||t===ec||d.current!==e||null!=i){const t=new Map;for(let n of e){if(!n)continue;if(i&&i.length>0&&!i.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,r=e?new Dl(l(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,i,n,u,l]);return Bs(()=>{d.current=e},[e]),Bs(()=>{u||h()},[n,u]),Bs(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),Bs(()=>{u||"number"!=typeof s||null!==m.current||(m.current=setTimeout(()=>{h(),m.current=null},s))},[s,u,h,...r]),{droppableRects:f,measureDroppableContainers:h,measuringScheduled:null!=i}}(N,{dragging:w,dependencies:[k.x,k.y],config:F.droppable}),z=function(e,t){const n=null!=t?e.get(t):void 0,r=n?n.node.current:null;return bs(e=>{var n;return null==t?null:null!=(n=null!=r?r:e)?n:null},[r,t])}(C,_),W=Ws(()=>T?As(T):null,[T]),K=function(){const e=!1===(null==D?void 0:D.autoScrollEnabled),t="object"==typeof s?!1===s.enabled:!1===s,n=w&&!e&&!t;if("object"==typeof s)return{...s,enabled:n};return{enabled:n}}(),H=function(e,t){return tc(e,t)}(z,F.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=Ks(!1),{x:a,y:s}="boolean"==typeof o?{x:o,y:o}:o;fs(()=>{if(!a&&!s||!t)return void(i.current=!1);if(i.current||!r)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const o=ll(n(e),r);if(a||(o.x=0),s||(o.y=0),i.current=!0,Math.abs(o.x)>0||Math.abs(o.y)>0){const t=gl(e);t&&t.scrollBy({top:o.y,left:o.x})}},[t,a,s,r,n])}({activeNode:null!=_?C.get(_):null,config:K.layoutShiftCompensation,initialRect:H,measure:F.draggable.measure});const U=oc(z,F.draggable.measure,H),X=oc(z?z.parentElement:null),V=Ks({activatorEvent:null,active:null,activeNode:z,collisionRect:null,collisions:null,droppableRects:P,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:E,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Y=E.getNodeFor(null==(t=V.current.over)?void 0:t.id),J=function(e){let{measure:t}=e;const[n,r]=$s(null),o=nc({callback:zs(e=>{for(const{target:n}of e)if(ps(n)){r(e=>{const r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),i=zs(e=>{const n=cc(e);null==o||o.disconnect(),n&&(null==o||o.observe(n)),r(n?t(n):null)},[t,o]),[a,s]=ys(i);return Ws(()=>({nodeRef:a,rect:n,setRef:s}),[n,a,s])}({measure:F.dragOverlay.measure}),Q=null!=(n=J.nodeRef.current)?n:z,Z=w?null!=(r=J.rect)?r:U:null,G=Boolean(J.nodeRef.current&&J.rect),ee=ll(te=G?null:U,tc(te));var te;const ne=sc(Q?ds(Q):null),re=function(e){const t=Ks(e),n=bs(n=>e?n&&n!==ic&&e&&t.current&&e.parentNode===t.current.parentNode?n:fl(e):ic,[e]);return Bs(()=>{t.current=e},[e]),n}(w?null!=Y?Y:z:null),oe=function(e,t){void 0===t&&(t=hl);const[n]=e,r=sc(n?ds(n):null),[o,i]=$s(lc);function a(){i(()=>e.length?e.map(e=>_l(e)?r:new Dl(t(e),e)):lc)}const s=nc({callback:a});return fs(()=>{null==s||s.disconnect(),a(),e.forEach(e=>null==s?void 0:s.observe(e))},[e]),o}(re),ie=wc(p,{transform:{x:k.x-ee.x,y:k.y-ee.y,scaleX:1,scaleY:1},activatorEvent:T,active:R,activeNodeRect:U,containerNodeRect:X,draggingNodeRect:Z,over:V.current.over,overlayNodeRect:J.rect,scrollableAncestors:re,scrollableAncestorRects:oe,windowRect:ne}),ae=W?ks(W,k):null,se=function(e){const[t,n]=$s(null),r=Ks(e),o=zs(e=>{const t=vl(e.target);t&&n(e=>e?(e.set(t,xl(t)),new Map(e)):null)},[]);return Bs(()=>{const t=r.current;if(e!==t){i(t);const a=e.map(e=>{const t=vl(e);return t?(t.addEventListener("scroll",o,{passive:!0}),[t,xl(t)]):null}).filter(e=>null!=e);n(a.length?new Map(a):null),r.current=e}return()=>{i(e),i(t)};function i(e){e.forEach(e=>{const t=vl(e);null==t||t.removeEventListener("scroll",o)})}},[o,e]),Ws(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>ks(e,t),rl):Al(e):rl,[e,t])}(re),le=ac(se),ce=ac(se,[U]),de=ks(ie,le),ue=Z?cl(Z,ie):null,pe=R&&ue?d({active:R,collisionRect:ue,droppableRects:P,droppableContainers:N,pointerCoordinates:ae}):null,he=function(e,t){if(!e||0===e.length)return null;const[n]=e;return t?n[t]:n}(pe,"id"),[me,fe]=$s(null),ge=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(G?ie:ks(ie,ce),null!=(o=null==me?void 0:me.rect)?o:null,U),ve=Ks(null),be=zs((e,t)=>{let{sensor:n,options:r}=t;if(null==O.current)return;const o=C.get(O.current);if(!o)return;const i=e.nativeEvent,a=new n({active:O.current,activeNode:o,event:i,options:r,context:V,onAbort(e){if(!C.get(e))return;const{onDragAbort:t}=L.current,n={id:e};null==t||t(n),v({type:"onDragAbort",event:n})},onPending(e,t,n,r){if(!C.get(e))return;const{onDragPending:o}=L.current,i={id:e,constraint:t,initialCoordinates:n,offset:r};null==o||o(i),v({type:"onDragPending",event:i})},onStart(e){const t=O.current;if(null==t)return;const n=C.get(t);if(!n)return;const{onDragStart:r}=L.current,o={activatorEvent:i,active:{id:t,data:n.data,rect:A}};Js(()=>{null==r||r(o),x(Cc.Initializing),g({type:tl.DragStart,initialCoordinates:e,active:t}),v({type:"onDragStart",event:o}),j(ve.current),M(i)})},onMove(e){g({type:tl.DragMove,coordinates:e})},onEnd:s(tl.DragEnd),onCancel:s(tl.DragCancel)});function s(e){return async function(){const{active:t,collisions:n,over:r,scrollAdjustedTranslate:o}=V.current;let a=null;if(t&&o){const{cancelDrop:s}=L.current;if(a={activatorEvent:i,active:t,collisions:n,delta:o,over:r},e===tl.DragEnd&&"function"==typeof s){await Promise.resolve(s(a))&&(e=tl.DragCancel)}}O.current=null,Js(()=>{g({type:e}),x(Cc.Uninitialized),fe(null),j(null),M(null),ve.current=null;const t=e===tl.DragEnd?"onDragEnd":"onDragCancel";if(a){const e=L.current[t];null==e||e(a),v({type:t,event:a})}})}}ve.current=a},[C]),ye=zs((e,t)=>(n,r)=>{const o=n.nativeEvent,i=C.get(r);if(null!==O.current||!i||o.dndKit||o.defaultPrevented)return;const a={active:i};!0===e(n,t.options,a)&&(o.dndKit={capturedBy:t.sensor},O.current=r,be(n,t))},[C,be]),xe=function(e,t){return Ws(()=>e.reduce((e,n)=>{const{sensor:r}=n;return[...e,...r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}))]},[]),[e,t])}(c,ye);!function(e){Bs(()=>{if(!ss)return;const t=e.map(e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()});return()=>{for(const e of t)null==e||e()}},e.map(e=>{let{sensor:t}=e;return t}))}(c),fs(()=>{U&&y===Cc.Initializing&&x(Cc.Initialized)},[U,y]),Bs(()=>{const{onDragMove:e}=L.current,{active:t,activatorEvent:n,collisions:r,over:o}=V.current;if(!t||!n)return;const i={active:t,activatorEvent:n,collisions:r,delta:{x:de.x,y:de.y},over:o};Js(()=>{null==e||e(i),v({type:"onDragMove",event:i})})},[de.x,de.y]),Bs(()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:o}=V.current;if(!e||null==O.current||!t||!o)return;const{onDragOver:i}=L.current,a=r.get(he),s=a&&a.rect.current?{id:a.id,rect:a.rect.current,data:a.data,disabled:a.disabled}:null,l={active:e,activatorEvent:t,collisions:n,delta:{x:o.x,y:o.y},over:s};Js(()=>{fe(s),null==i||i(l),v({type:"onDragOver",event:l})})},[he]),fs(()=>{V.current={activatorEvent:T,active:R,activeNode:z,collisionRect:ue,collisions:pe,droppableRects:P,draggableNodes:C,draggingNode:Q,draggingNodeRect:Z,droppableContainers:E,over:me,scrollableAncestors:re,scrollAdjustedTranslate:de},A.current={initial:Z,translated:ue}},[R,z,pe,ue,C,Q,Z,P,E,me,re,de]),Jl({...K,delta:k,draggingRect:ue,pointerCoordinates:ae,scrollableAncestors:re,scrollableAncestorRects:oe});const we=Ws(()=>({active:R,activeNode:z,activeNodeRect:U,activatorEvent:T,collisions:pe,containerNodeRect:X,dragOverlay:J,draggableNodes:C,droppableContainers:E,droppableRects:P,over:me,measureDroppableContainers:B,scrollableAncestors:re,scrollableAncestorRects:oe,measuringConfiguration:F,measuringScheduled:$,windowRect:ne}),[R,z,U,T,pe,X,J,C,E,P,me,B,re,oe,F,$,ne]),_e=Ws(()=>({activatorEvent:T,activators:xe,active:R,activeNodeRect:U,ariaDescribedById:{draggable:q},dispatch:g,draggableNodes:C,over:me,measureDroppableContainers:B}),[T,xe,R,U,g,q,C,me,B]);return Fs.createElement(Qs.Provider,{value:b},Fs.createElement(gc.Provider,{value:_e},Fs.createElement(vc.Provider,{value:we},Fs.createElement(_c.Provider,{value:ge},l)),Fs.createElement(xc,{disabled:!1===(null==a?void 0:a.restoreFocus)})),Fs.createElement(el,{...a,hiddenTextDescribedById:q}))});const kc=Is(null),Ec="button";function Sc(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=_s("Draggable"),{activators:a,activatorEvent:s,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:u,over:p}=Ps(gc),{role:h=Ec,roleDescription:m="draggable",tabIndex:f=0}=null!=o?o:{},g=(null==l?void 0:l.id)===t,v=Ps(g?_c:kc),[b,y]=ys(),[x,w]=ys(),_=function(e,t){return Ws(()=>e.reduce((e,n)=>{let{eventName:r,handler:o}=n;return e[r]=e=>{o(e,t)},e},{}),[e,t])}(a,t),C=vs(n);fs(()=>(u.set(t,{id:t,key:i,node:b,activatorNode:x,data:C}),()=>{const e=u.get(t);e&&e.key===i&&u.delete(t)}),[u,t]);return{active:l,activatorEvent:s,activeNodeRect:c,attributes:Ws(()=>({role:h,tabIndex:f,"aria-disabled":r,"aria-pressed":!(!g||h!==Ec)||void 0,"aria-roledescription":m,"aria-describedby":d.draggable}),[r,h,f,g,m,d.draggable]),isDragging:g,listeners:r?void 0:_,node:b,over:p,setNodeRef:y,setActivatorNodeRef:w,transform:v}}const Ac={timeout:25};function Rc(e){let{animation:t,children:n}=e;const[r,o]=$s(null),[i,a]=$s(null),s=xs(n);return n||r||!s||o(s),fs(()=>{if(!i)return;const e=null==r?void 0:r.key,n=null==r?void 0:r.props.id;null!=e&&null!=n?Promise.resolve(t(n,i)).then(()=>{o(null)}):o(null)},[t,r,i]),Fs.createElement(Fs.Fragment,null,n,r?Xs(r,{ref:a}):null)}const Oc={x:0,y:0,scaleX:1,scaleY:1};function Dc(e){let{children:t}=e;return Fs.createElement(gc.Provider,{value:fc},Fs.createElement(_c.Provider,{value:Oc},t))}const jc={position:"fixed",touchAction:"none"},Tc=e=>Ss(e)?"transform 250ms ease":void 0,Mc=Vs((e,t)=>{let{as:n,activatorEvent:r,adjustScale:o,children:i,className:a,rect:s,style:l,transform:c,transition:d=Tc}=e;if(!s)return null;const u=o?c:{...c,scaleX:1,scaleY:1},p={...jc,width:s.width,height:s.height,top:s.top,left:s.left,transform:Rs.Transform.toString(u),transformOrigin:o&&r?ol(r,s):void 0,transition:"function"==typeof d?d(r):d,...l};return Fs.createElement(n,{className:a,style:p,ref:t},i)}),Lc={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Rs.Transform.toString(t)},{transform:Rs.Transform.toString(n)}]},sideEffects:(qc={styles:{active:{opacity:"0"}}},e=>{let{active:t,dragOverlay:n}=e;const r={},{styles:o,className:i}=qc;if(null!=o&&o.active)for(const[e,n]of Object.entries(o.active))void 0!==n&&(r[e]=t.node.style.getPropertyValue(e),t.node.style.setProperty(e,n));if(null!=o&&o.dragOverlay)for(const[e,t]of Object.entries(o.dragOverlay))void 0!==t&&n.node.style.setProperty(e,t);return null!=i&&i.active&&t.node.classList.add(i.active),null!=i&&i.dragOverlay&&n.node.classList.add(i.dragOverlay),function(){for(const[e,n]of Object.entries(r))t.node.style.setProperty(e,n);null!=i&&i.active&&t.node.classList.remove(i.active)}})};var qc;function Nc(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:o}=e;return gs((e,i)=>{if(null===t)return;const a=n.get(e);if(!a)return;const s=a.node.current;if(!s)return;const l=cc(i);if(!l)return;const{transform:c}=ds(i).getComputedStyle(i),d=ul(c);if(!d)return;const u="function"==typeof t?t:function(e){const{duration:t,easing:n,sideEffects:r,keyframes:o}={...Lc,...e};return e=>{let{active:i,dragOverlay:a,transform:s,...l}=e;if(!t)return;const c={x:a.rect.left-i.rect.left,y:a.rect.top-i.rect.top},d={scaleX:1!==s.scaleX?i.rect.width*s.scaleX/a.rect.width:1,scaleY:1!==s.scaleY?i.rect.height*s.scaleY/a.rect.height:1},u={x:s.x-c.x,y:s.y-c.y,...d},p=o({...l,active:i,dragOverlay:a,transform:{initial:s,final:u}}),[h]=p,m=p[p.length-1];if(JSON.stringify(h)===JSON.stringify(m))return;const f=null==r?void 0:r({active:i,dragOverlay:a,...l}),g=a.node.animate(p,{duration:t,easing:n,fill:"forwards"});return new Promise(e=>{g.onfinish=()=>{null==f||f(),e()}})}}(t);return Rl(s,o.draggable.measure),u({active:{id:e,data:a.data,node:s,rect:o.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:i,rect:o.dragOverlay.measure(l)},droppableContainers:r,measuringConfiguration:o,transform:d})})}let Fc=0;function Ic(e){return Ws(()=>{if(null!=e)return Fc++,Fc},[e])}const Pc=Fs.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:o,transition:i,modifiers:a,wrapperElement:s="div",className:l,zIndex:c=999}=e;const{activatorEvent:d,active:u,activeNodeRect:p,containerNodeRect:h,draggableNodes:m,droppableContainers:f,dragOverlay:g,over:v,measuringConfiguration:b,scrollableAncestors:y,scrollableAncestorRects:x,windowRect:w}=Ps(vc),_=Ps(_c),C=Ic(null==u?void 0:u.id),k=wc(a,{activatorEvent:d,active:u,activeNodeRect:p,containerNodeRect:h,draggingNodeRect:g.rect,over:v,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:x,transform:_,windowRect:w}),E=tc(p),S=Nc({config:r,draggableNodes:m,droppableContainers:f,measuringConfiguration:b}),A=E?g.setRef:void 0;return Fs.createElement(Dc,null,Fs.createElement(Rc,{animation:S},u&&C?Fs.createElement(Mc,{key:C,id:u.id,ref:A,as:s,activatorEvent:d,adjustScale:t,className:l,transition:i,rect:E,style:{zIndex:c,...o},transform:k},n):null))}),Bc=t,{useEffect:$c}=t,{useRef:zc}=t,Wc=n,{styled:Kc}=r,{Chip:Hc}=i,{color:Uc}=a,{renderMath:Xc}=d;function Vc(e){let t,n=e[0],r=1;for(;r<e.length;){const o=e[r],i=e[r+1];if(r+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=i(n)):"call"!==o&&"optionalCall"!==o||(n=i((...e)=>n.call(t,...e)),t=void 0)}return n}const Yc=Kc("span")(({theme:e,disabled:t})=>({border:`solid 0px ${e.palette.primary.main}`,borderRadius:e.spacing(2),margin:e.spacing(.5),transform:"translate(0, 0)",display:"inline-flex",...t&&{}})),Jc=Kc(Hc)(()=>({backgroundColor:Uc.white(),border:`1px solid ${Uc.text()}`,color:Uc.text(),alignItems:"center",display:"inline-flex",height:"initial",minHeight:"32px",fontSize:"inherit",whiteSpace:"pre-wrap",maxWidth:"374px",pointerEvents:"none",borderRadius:"3px",paddingTop:"12px",paddingBottom:"12px","&.Mui-disabled":{opacity:1}})),Qc=Kc("span")(()=>({whiteSpace:"normal","& img":{display:"block",padding:"2px 0"},"& mjx-frac":{fontSize:"120% !important"}}));function Zc({choice:e,disabled:t,instanceId:n}){const r=zc(null),{attributes:o,listeners:i,setNodeRef:a,isDragging:s}=Sc({id:`choice-${e.id}`,data:{choice:e,instanceId:n,fromChoice:!0,type:"MaskBlank"},disabled:t});return $c(()=>{Xc(r.current)},[e.value]),Bc.createElement(Yc,{ref:a,style:s?{width:Vc([r,"access",e=>e.current,"optionalAccess",e=>e.offsetWidth]),height:Vc([r,"access",e=>e.current,"optionalAccess",e=>e.offsetHeight])}:{},disabled:t,...i,...o},Bc.createElement(Jc,{clickable:!1,disabled:t,ref:r,label:Bc.createElement(Qc,{dangerouslySetInnerHTML:{__html:e.value}})}))}Zc.propTypes={choice:Wc.object.isRequired,disabled:Wc.bool,instanceId:Wc.oneOfType([Wc.string,Wc.number])};const Gc=t,ed=n,{DragDroppablePlaceholder:td}=p;class nd extends Gc.Component{constructor(...e){super(...e),nd.prototype.__init.call(this)}static __initStatic(){this.propTypes={disabled:ed.bool,duplicates:ed.bool,choices:ed.arrayOf(ed.shape({label:ed.string,value:ed.string})),value:ed.object,choicePosition:ed.string.isRequired,instanceId:ed.string}}__init(){this.getStyleForWrapper=()=>{const{choicePosition:e}=this.props;switch(e){case"above":return{margin:"0 0 40px 0"};case"below":return{margin:"40px 0 0 0"};case"right":return{margin:"0 0 0 40px"};default:return{margin:"0 40px 0 0"}}}}render(){const{disabled:e,duplicates:t,choices:n,value:r,instanceId:o}=this.props,i=n.filter(e=>{if(!0===t)return!0;const n=function(e,t){var n;return xn(e,function(e,r,o){if(t(e,r,o))return n=r,!1}),n}(r,gn(t=>t===e.id));return void 0===n}),a={...this.getStyleForWrapper(),minWidth:"100px"};return Gc.createElement("div",{style:a},Gc.createElement(td,{disabled:e,instanceId:o},i.map((t,n)=>Gc.createElement(Zc,{key:`${t.value}-${n}`,disabled:e,choice:t,instanceId:o}))))}}nd.__initStatic();const rd=t,{useEffect:od}=t,{useRef:id}=t,{useState:ad}=t,sd=n,ld=o,{styled:cd}=r,{Chip:dd}=i,ud=s,{color:pd}=a,{renderMath:hd}=d;function md(e){let t,n=e[0],r=1;for(;r<e.length;){const o=e[r],i=e[r+1];if(r+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=i(n)):"call"!==o&&"optionalCall"!==o||(n=i((...e)=>n.call(t,...e)),t=void 0)}return n}ld("pie-lib:mask-markup:blank");const fd=cd("span")(({dragged:e,over:t})=>({border:`solid 0px ${pd.primary()}`,minWidth:"200px",touchAction:"none",overflow:"hidden",whiteSpace:"nowrap",opacity:1,...t&&{whiteSpace:"nowrap",overflow:"hidden"},...e&&{opacity:.5}})),gd=cd(dd)(()=>({backgroundColor:pd.background(),border:`2px dashed ${pd.text()}`,touchAction:"none",color:pd.text(),fontSize:"inherit",maxWidth:"374px",position:"relative",borderRadius:"3px","&.over":{whiteSpace:"nowrap",overflow:"hidden"},"&.parentOver":{border:`1px solid ${h[500]}`,backgroundColor:`${h[300]}`},"&.correct":{border:`solid 1px ${pd.correct()}`},"&.incorrect":{border:`solid 1px ${pd.incorrect()}`},"&.Mui-disabled":{opacity:1}})),vd=cd("span")(()=>({whiteSpace:"normal",pointerEvents:"none","& img":{display:"block",padding:"2px 0"},"& p":{marginTop:"0",marginBottom:"0"},"& mjx-frac":{fontSize:"120% !important"},"&.over":{whiteSpace:"nowrap",overflow:"hidden"},"&.hidden":{color:"transparent",opacity:0},"&.dragged":{position:"absolute",left:16,maxWidth:"60px",top:"50%",transform:"translateY(-50%)"}}));function bd({disabled:e,choice:t,isOver:n,isDragging:r,dragItem:o,correct:i,emptyResponseAreaWidth:a,emptyResponseAreaHeight:s}){const l=id(null),c=id(null),d=id(null),[u,p]=ad({height:0,width:0}),h=()=>{f()},m=()=>{const e=md([c,"access",e=>e.current,"optionalAccess",e=>e.querySelector,"call",e=>e("img")]);e?e.onload=h:setTimeout(()=>{f()},300)},f=()=>{if(c.current&&l.current){l.current.style.width="auto",l.current.style.height="auto",l.current.offsetHeight;const e=(()=>{if(!c.current)return null;if(c.current.querySelector("mjx-container")&&c.current.parentElement)return c.current.parentElement;return c.current.querySelector("img")||c.current})()||c.current,t=e.getBoundingClientRect(),n=(t.width||e.offsetWidth||0)+24,r=Math.max(t.height||0,e.offsetHeight||0,e.scrollHeight||0,c.current.scrollHeight||0)+24,o=parseFloat(a)||0,i=parseFloat(s)||0,d=n<=o?o:n,u=r<=i?i:r;p(e=>({width:d>o?d:e.width,height:u>i?u:e.height})),l.current.style.width=`${d}px`,l.current.style.height=`${u}px`}};od(()=>{m()},[]),od(()=>{l.current&&hd(l.current)},[n,md([o,"optionalAccess",e=>e.choice,"optionalAccess",e=>e.value])]),od(()=>{t?m():p({height:0,width:0})},[t]),od(()=>{n||r||(d.current={width:l.current.offsetWidth,height:l.current.offsetHeight})},[t,n,r]);const g=o&&n&&o.choice&&o.choice.value,v=t&&t.value,b=n||r?{width:md([d,"access",e=>e.current,"optionalAccess",e=>e.width]),height:md([d,"access",e=>e.current,"optionalAccess",e=>e.height])}:(()=>{const e=isNaN(parseFloat(a))?0:parseFloat(a),t=isNaN(parseFloat(s))?0:parseFloat(s);return{...{height:u.height||t,width:u.width||e},...e?{}:{minWidth:90},...t?{}:{minHeight:32}}})();return rd.createElement(gd,{clickable:!1,disabled:e,ref:l,component:"span",label:rd.createElement(rd.Fragment,null,rd.createElement(vd,{ref:c,draggable:!0,className:ud({over:n,hidden:g}),dangerouslySetInnerHTML:{__html:v||""}}),g&&rd.createElement(vd,{draggable:!0,className:ud({over:n,dragged:!0}),dangerouslySetInnerHTML:{__html:g||""}})),className:ud({over:n,parentOver:n,correct:void 0!==i&&i,incorrect:void 0!==i&&!i}),variant:e?"outlined":void 0,style:b})}function yd({id:e,disabled:t,duplicates:n,choice:r,correct:o,onChange:i,emptyResponseAreaWidth:a,emptyResponseAreaHeight:s,instanceId:l}){const{attributes:c,listeners:d,setNodeRef:u,transform:p,isDragging:h}=Sc({id:`mask-blank-drag-${e}`,disabled:t||!r,data:{id:e,choice:r,instanceId:l,fromChoice:!1,type:"MaskBlank"}}),{setNodeRef:m,isOver:f,active:g}=function(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=_s("Droppable"),{active:a,dispatch:s,over:l,measureDroppableContainers:c}=Ps(gc),d=Ks({disabled:n}),u=Ks(!1),p=Ks(null),h=Ks(null),{disabled:m,updateMeasurementsFor:f,timeout:g}={...Ac,...o},v=vs(null!=f?f:r),b=nc({callback:zs(()=>{u.current?(null!=h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{c(Array.isArray(v.current)?v.current:[v.current]),h.current=null},g)):u.current=!0},[g]),disabled:m||!a}),y=zs((e,t)=>{b&&(t&&(b.unobserve(t),u.current=!1),e&&b.observe(e))},[b]),[x,w]=ys(y),_=vs(t);return Bs(()=>{b&&x.current&&(b.disconnect(),u.current=!1,b.observe(x.current))},[x,b]),Bs(()=>(s({type:tl.RegisterDroppable,element:{id:r,key:i,disabled:n,node:x,rect:p,data:_}}),()=>s({type:tl.UnregisterDroppable,key:i,id:r})),[r]),Bs(()=>{n!==d.current.disabled&&(s({type:tl.SetDroppableDisabled,id:r,key:i,disabled:n}),d.current.disabled=n)},[r,i,n,s]),{active:a,rect:p,isOver:(null==l?void 0:l.id)===r,node:x,over:l,setNodeRef:w}}({id:`mask-blank-drop-${e}`,data:{id:e,accepts:["MaskBlank"],instanceId:l}}),v={transform:Rs.Translate.toString(p)};return rd.createElement(fd,{ref:e=>{u(e),m(e)},style:v,dragged:h,over:f,...c,...d},rd.createElement(bd,{id:e,disabled:t,duplicates:n,choice:r,isOver:f,dragItem:md([g,"optionalAccess",e=>e.data,"optionalAccess",e=>e.current]),correct:o,onChange:i,emptyResponseAreaWidth:a,emptyResponseAreaHeight:s,instanceId:l}))}bd.defaultProps={emptyResponseAreaWidth:0,emptyResponseAreaHeight:0},bd.propTypes={id:sd.oneOfType([sd.string,sd.number]),disabled:sd.bool,duplicates:sd.bool,choice:sd.object,isOver:sd.bool,dragItem:sd.object,correct:sd.bool,onChange:sd.func,emptyResponseAreaWidth:sd.oneOfType([sd.string,sd.number]),emptyResponseAreaHeight:sd.oneOfType([sd.string,sd.number]),instanceId:sd.string},yd.defaultProps={emptyResponseAreaWidth:0,emptyResponseAreaHeight:0},yd.propTypes={id:sd.oneOfType([sd.string,sd.number]),disabled:sd.bool,duplicates:sd.bool,choice:sd.object,correct:sd.bool,onChange:sd.func,emptyResponseAreaWidth:sd.oneOfType([sd.string,sd.number]),emptyResponseAreaHeight:sd.oneOfType([sd.string,sd.number]),instanceId:sd.string};const xd=t,wd=n,{DragProvider:_d}=p;function Cd(e){let t,n=e[0],r=1;for(;r<e.length;){const o=e[r],i=e[r+1];if(r+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=i(n)):"call"!==o&&"optionalCall"!==o||(n=i((...e)=>n.call(t,...e)),t=void 0)}return n}const kd=ts("blank",e=>(t,n,r)=>{const o=Cd([t,"access",e=>e.data,"optionalAccess",e=>e.dataset])||{};if("blank"===o.component){const{disabled:i,duplicates:a,correctResponse:s,feedback:l,showCorrectAnswer:c,emptyResponseAreaWidth:d,emptyResponseAreaHeight:u,instanceId:p,isDragging:h}=e,m=c?s[o.id]:n[o.id],f=m&&e.choices.find(e=>e.id===m);return xd.createElement(yd,{key:`${t.type}-${o.id}`,correct:c||l&&l[o.id],disabled:i,duplicates:a,choice:f,id:o.id,emptyResponseAreaWidth:d,emptyResponseAreaHeight:u,onChange:(e,t)=>{const o={...n};void 0===t?delete o[e]:o[e]=t,r(o)},instanceId:p,isDragging:h})}});class Ed extends xd.Component{constructor(e){super(e),Ed.prototype.__init.call(this),Ed.prototype.__init2.call(this),Ed.prototype.__init3.call(this),Ed.prototype.__init4.call(this),this.state={activeDragItem:null,dropAnimation:void 0}}static __initStatic(){this.propTypes={markup:wd.string,layout:wd.object,choicesPosition:wd.string,choices:wd.array,value:wd.object,onChange:wd.func,duplicates:wd.bool,disabled:wd.bool,feedback:wd.object,correctResponse:wd.object,showCorrectAnswer:wd.bool,emptyResponseAreaWidth:wd.oneOfType([wd.string,wd.number]),emptyResponseAreaHeight:wd.oneOfType([wd.string,wd.number]),instanceId:wd.string}}static __initStatic2(){this.defaultProps={instanceId:"drag-in-the-blank"}}__init(){this.handleDragStart=e=>{const{active:t}=e;Cd([t,"optionalAccess",e=>e.data,"optionalAccess",e=>e.current])&&this.setState({activeDragItem:t.data.current,dropAnimation:void 0})}}__init2(){this.renderDragOverlay=()=>{const{activeDragItem:e}=this.state;return e&&"MaskBlank"===e.type?xd.createElement(Zc,{disabled:e.disabled,choice:e.choice,instanceId:e.instanceId}):null}}__init3(){this.handleDragEnd=e=>{const{active:t,over:n}=e,{onChange:r,value:o}=this.props,i=Cd([t,"optionalAccess",e=>e.data,"optionalAccess",e=>e.current]),a=Cd([n,"optionalAccess",e=>e.data,"optionalAccess",e=>e.current]),s=!!t&&!!n&&"MaskBlank"===Cd([i,"optionalAccess",e=>e.type])&&Cd([a,"optionalAccess",e=>e.accepts,"optionalAccess",e=>e.includes,"call",e=>e("MaskBlank")]);if(this.setState({activeDragItem:null,dropAnimation:s?null:void 0}),!s||!r)return;const l=i,c=a.id;if(!0===a.toChoiceBoard){if(!l.fromChoice&&l.id){const e={...o};delete e[l.id],r(e)}}else if(!0===l.fromChoice){if(c&&"drag-in-the-blank-droppable"!==c){const e={...o};e[c]=l.choice.id,r(e)}}else if(l.id&&l.id!==c){const e={...o};e[c]=l.choice.id,delete e[l.id],r(e)}}}__init4(){this.getPositionDirection=e=>{let t,n,r;switch(e){case"left":t="row",r="center";break;case"right":t="row-reverse",n="flex-end",r="center";break;case"below":t="column-reverse";break;default:t="column"}return{flexDirection:t,justifyContent:n,alignItems:r}}}render(){const{markup:e,duplicates:t,value:n,onChange:r,choicesPosition:o,choices:i,correctResponse:a,disabled:s,feedback:l,showCorrectAnswer:c,emptyResponseAreaWidth:d,emptyResponseAreaHeight:u,layout:p,instanceId:h}=this.props,m=o||"below",f={display:"flex",minWidth:"100px",...this.getPositionDirection(m)};return xd.createElement(_d,{onDragStart:this.handleDragStart,onDragEnd:this.handleDragEnd,collisionDetection:sl},xd.createElement("div",{ref:e=>this.rootRef=e,style:f},xd.createElement(nd,{choicePosition:m,choices:i,value:n,duplicates:t,disabled:s,instanceId:h}),xd.createElement(kd,{elementType:"drag-in-the-blank",markup:e,layout:p,value:n,choices:i,onChange:r,disabled:s,duplicates:t,feedback:l,correctResponse:a,showCorrectAnswer:c,emptyResponseAreaWidth:d,emptyResponseAreaHeight:u,instanceId:h,isDragging:!!this.state.activeDragItem}),xd.createElement(Pc,{style:{pointerEvents:"none"},dropAnimation:this.state.dropAnimation},this.renderDragOverlay())))}}Ed.__initStatic(),Ed.__initStatic2();const Sd=t,{styled:Ad}=r,Rd=s,{color:Od}=a;function Dd(e){let t,n=e[0],r=1;for(;r<e.length;){const o=e[r],i=e[r+1];if(r+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=i(n)):"call"!==o&&"optionalCall"!==o||(n=i((...e)=>n.call(t,...e)),t=void 0)}return n}let jd,Td;"undefined"!=typeof window&&(jd=require("@pie-lib/editable-html-tip-tap").default,Td=Ad(jd)(()=>({display:"inline-block",verticalAlign:"middle",margin:"4px",borderRadius:"4px",border:`1px solid ${Od.black()}`,"&.correct":{border:`1px solid ${Od.correct()}`},"&.incorrect":{border:`1px solid ${Od.incorrect()}`}})));ts("input",e=>(t,n)=>{const{adjustedLimit:r,disabled:o,feedback:i,showCorrectAnswer:a,maxLength:s,spellCheck:l,pluginProps:c,onChange:d}=e,u=Dd([t,"access",e=>e.data,"optionalAccess",e=>e.dataset])||{};if("input"===u.component){const p=(e.choices&&u&&e.choices[u.id]||[])[0],h=a?p&&p.label:n[u.id]||"",m=s&&s[u.id],f=i&&i[u.id],g=a||"correct"===f,v=!a&&"incorrect"===f,b=e=>{const t={...n,[u.id]:e};d(t)},y=e=>{if("Enter"===e.key||13===e.keyCode)return!0};return Sd.createElement(Td,{id:u.id,key:`${t.type}-input-${u.id}`,disabled:a||o,disableUnderline:!0,onChange:b,markup:h||"",charactersLimit:r?m:25,activePlugins:["languageCharacters"],pluginProps:c,languageCharactersProps:[{language:"spanish"}],spellCheck:l,adjustWidthForLimit:!0,onKeyDown:y,autoWidthToolbar:!0,toolbarOpts:{minWidth:"auto",noBorder:!0,isHidden:!!Dd([c,"optionalAccess",e=>e.characters,"optionalAccess",e=>e.disabled])},className:Rd({correct:g,incorrect:v})})}});var Md=ts("input",e=>(t,n,r)=>{const o=t.data&&t.data.dataset||{};if("input"===o.component)return e.customMarkMarkupComponent(o.id)});const Ld=t,qd=n,{Button:Nd}=i,{InputLabel:Fd}=i,{Menu:Id}=i,{MenuItem:Pd}=i,{ArrowDropDown:Bd}=l,{ArrowDropUp:$d}=l,{Close:zd}=l,{Check:Wd}=l,{styled:Kd}=r,{color:Hd}=a,{renderMath:Ud}=d,Xd=Kd(Nd)(()=>({color:Hd.text(),border:`1px solid ${Hd.borderGray()}`,borderRadius:"4px",justifyContent:"space-between",backgroundColor:Hd.background(),position:"relative",height:"45px",width:"fit-content",margin:"2px",textTransform:"none","& span":{paddingRight:"5px"},"& svg":{position:"absolute",right:0,top:"calc(50% - 12px)",pointerEvents:"none",color:Hd.text(),marginLeft:"5px"},"&.Mui-focused":{outline:`3px solid ${Hd.tertiary()}`,outlineOffset:"2px",borderWidth:"3px"},"&.disabledCorrect":{borderWidth:"2px",borderColor:Hd.correct(),color:`${Hd.text()} !important`},"&.disabledIncorrect":{borderWidth:"2px",borderColor:Hd.incorrectWithIcon(),color:`${Hd.text()} !important`}})),Vd=Kd(Id)(()=>({backgroundColor:Hd.background(),border:`1px solid ${Hd.correct()} !important`,"&:hover":{border:`1px solid ${Hd.text()} `,borderColor:"initial"},"&:focus":{border:`1px solid ${Hd.text()}`,borderColor:"initial"},"& .MuiList-root":{padding:0}})),Yd=Kd(Pd)(()=>({height:24,overflow:"hidden",fontSize:"1rem",fontWeight:400,fontFamily:"inherit",lineHeight:"1.5em",whiteSpace:"nowrap",color:Hd.text(),backgroundColor:Hd.background(),"&.Mui-focusVisible":{outline:`3px solid ${Hd.tertiary()}`,outlineOffset:"-1px",color:Hd.text(),backgroundColor:Hd.background()},"&:hover":{color:Hd.text(),backgroundColor:Hd.dropdownBackground()},boxSizing:"border-box",padding:"25px",borderRadius:"4px","&.selected":{color:`${Hd.text()} !important`,backgroundColor:`${Hd.background()} !important`,"&:hover":{color:Hd.text(),backgroundColor:`${Hd.dropdownBackground()} !important`}}})),Jd=Kd("span")(()=>({fontSize:"max(1rem, 14px)"})),Qd=Kd("span")(()=>({fontSize:"max(1rem, 14px)",position:"absolute",right:"10px"})),Zd=Kd(Fd)(()=>({position:"absolute",left:"-10000px",top:"auto",width:"1px",height:"1px",overflow:"hidden"})),Gd=Kd(Wd)(()=>({color:`${Hd.white()} !important`,position:"absolute",top:"-8px !important",left:"-8px",marginLeft:"0 !important",borderRadius:"50%",fontSize:"16px",padding:"2px","&.correct":{backgroundColor:Hd.correct()},"&.incorrect":{backgroundColor:Hd.incorrectWithIcon()}})),eu=Kd(zd)(()=>({color:`${Hd.white()} !important`,position:"absolute",top:"-8px !important",left:"-8px",marginLeft:"0 !important",borderRadius:"50%",fontSize:"16px",padding:"2px","&.correct":{backgroundColor:Hd.correct()},"&.incorrect":{backgroundColor:Hd.incorrectWithIcon()}}));class tu extends Ld.Component{static __initStatic(){this.propTypes={id:qd.string,value:qd.string,disabled:qd.bool,onChange:qd.func,correct:qd.bool,choices:qd.arrayOf(qd.shape({value:qd.string,label:qd.string})),showCorrectAnswer:qd.bool,singleQuery:qd.bool,correctValue:qd.string}}constructor(e){super(e),tu.prototype.__init.call(this),tu.prototype.__init2.call(this),tu.prototype.__init3.call(this),tu.prototype.__init4.call(this),tu.prototype.__init5.call(this),this.state={anchorEl:null,highlightedOptionId:null,menuWidth:null,previewValue:null},this.hiddenRef=Ld.createRef(),this.buttonRef=Ld.createRef(),this.previewRef=Ld.createRef(),this.elementRefs=[]}componentDidMount(){this.hiddenRef.current&&null===this.state.menuWidth&&this.setState({menuWidth:this.hiddenRef.current.clientWidth})}componentDidUpdate(e,t){const n=this.hiddenRef.current;if(!t.anchorEl&&this.state.anchorEl&&this.elementRefs.forEach(e=>{if(!e)return;const t=e.querySelector("[data-latex], [data-raw]"),n=e.querySelector("mjx-container"),r=e.querySelector('[data-math-handled="true"]');!t||r&&n||Ud(e)}),n){const e=n.clientWidth;e!==this.state.menuWidth&&(this.elementRefs.forEach(e=>{e&&Ud(e)}),Ud(n),this.setState({menuWidth:e}))}}__init(){this.handleClick=e=>this.setState({anchorEl:e.currentTarget})}__init2(){this.handleClose=()=>{const{value:e}=this.props;this.setState({anchorEl:null,previewValue:null,highlightedOptionId:null}),!e&&this.previewRef.current&&(this.previewRef.current.innerHTML="")}}__init3(){this.handleHighlight=e=>{const t={highlightedOptionId:`dropdown-option-${this.props.id}-${e}`};this.props.value||(t.previewValue=this.props.choices[e].value),this.setState(t)}}__init4(){this.handleSelect=(e,t)=>{this.props.onChange(this.props.id,e),this.handleHighlight(t),this.handleClose()}}__init5(){this.handleHover=e=>{if(this.props.value)return;const t=`dropdown-option-${this.props.id}-${e}`,n=this.state.previewValue;this.setState({highlightedOptionId:t,previewValue:n},()=>{const t=this.elementRefs[e],n=this.previewRef.current;t&&n&&(n.innerHTML=t.innerHTML)})}}getLabel(e,t){const n=(e||[]).find(e=>e.value===t);return n?n.label.trim():void 0}render(){const{id:e,correct:t,disabled:n,value:r,choices:o,showCorrectAnswer:i,singleQuery:a,correctValue:s}=this.props,{anchorEl:l}=this.state,c=Boolean(l),d=`dropdown-button-${e}`,u=`dropdown-menu-${e}`,p=`dropdown-value-${e}`;let h;this.elementRefs=[],n&&void 0!==t&&(h=t||i?"disabledCorrect":"disabledIncorrect");const m=parseInt(e,10)+1,f=a?"Query-label":`Query-label-${m}`,g=a?"Query":`Query ${m}`;let v=null;return n&&void 0!==t&&(v=t||i?Ld.createElement(Gd,{className:"correct"}):Ld.createElement(eu,{className:"incorrect"})),Ld.createElement(Ld.Fragment,null,Ld.createElement("div",{ref:this.hiddenRef,style:{position:"absolute",visibility:"hidden",top:0,left:0},tabIndex:-1,"aria-hidden":"true"},(o||[]).map((e,t)=>Ld.createElement(Yd,{key:t,tabIndex:-1,"aria-hidden":"true"},Ld.createElement(Jd,{dangerouslySetInnerHTML:{__html:e.label}})))),Ld.createElement(Zd,{id:f,tabIndex:-1,"aria-hidden":"true"},g),Ld.createElement(Xd,{ref:this.buttonRef,style:{...this.state.menuWidth&&{minWidth:`calc(${this.state.menuWidth}px + 8px)`},borderWidth:c?"2px":"1px",transition:"border-width 0.2s ease-in-out"},"aria-controls":c?u:void 0,"aria-haspopup":"listbox","aria-expanded":c?"true":void 0,"aria-activedescendant":this.state.highlightedOptionId,onClick:this.handleClick,className:h,disabled:n,id:d,role:"combobox","aria-label":`Select an option for ${g}`,"aria-labelledby":p},v,Ld.createElement(Jd,{id:p,ref:this.previewRef,dangerouslySetInnerHTML:{__html:s||(c&&this.state.previewValue?this.getLabel(o,this.state.previewValue):this.getLabel(o,r)||"")}}),c?Ld.createElement($d,null):Ld.createElement(Bd,null)),Ld.createElement(Vd,{id:u,anchorEl:l,keepMounted:!0,open:c,onClose:this.handleClose,getContentAnchorEl:null,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},transitionDuration:{enter:225,exit:195},slotProps:{paper:this.state.menuWidth?{style:{minWidth:this.state.menuWidth,padding:"4px"}}:void 0,list:{"aria-labelledby":d,role:"listbox",disablePadding:!0}}},(o||[]).map((t,n)=>{const o=`dropdown-option-${e}-${n}`;return Ld.createElement(Yd,{id:o,className:t.value===r?"selected":"",key:`${t.label}-${n}`,value:t.value,onClick:()=>this.handleSelect(t.value,n),role:"option","aria-selected":this.state.highlightedOptionId===o?"true":void 0,onMouseOver:()=>this.handleHover(n)},Ld.createElement(Jd,{ref:e=>this.elementRefs[n]=e,dangerouslySetInnerHTML:{__html:t.label}}),Ld.createElement(Qd,{dangerouslySetInnerHTML:{__html:t.value===r?" &check;":""}}))})))}}tu.__initStatic();const nu=t;ts("dropdown",e=>(t,n,r)=>{const o=t.data&&t.data.dataset||{};if("dropdown"===o.component){const{choices:i,disabled:a,feedback:s,showCorrectAnswer:l}=e,c=i&&i[o.id]&&i[o.id].find(e=>e.correct),d=l?c&&c.value:n[o.id];return nu.createElement(tu,{key:`${t.type}-dropdown-${o.id}`,correct:s&&s[o.id]&&"correct"===s[o.id],disabled:a||l,value:d,correctValue:l?c&&c.label:void 0,id:o.id,onChange:r,choices:i[o.id],showCorrectAnswer:l,singleQuery:1==Object.keys(i).length})}});const ru=t,ou=n,{styled:iu}=r,{Tooltip:au}=i,{color:su}=a,{Collapsible:lu}=a,{Readable:cu}=a,{hasText:du}=a,{hasMedia:uu}=a,{PreviewPrompt:pu}=a,{UiLayout:hu}=a,mu=c,fu=e,{renderMath:gu}=d,vu=u;function bu(e){let t,n=e[0],r=1;for(;r<e.length;){const o=e[r],i=e[r+1];if(r+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=i(n)):"call"!==o&&"optionalCall"!==o||(n=i((...e)=>n.call(t,...e)),t=void 0)}return n}const yu=iu(hu)({color:su.text(),backgroundColor:su.background(),display:"inline-block"}),xu=iu("div")({width:"100%",position:"relative",backgroundColor:su.background(),color:su.text()}),wu=iu("div")(({theme:e})=>({marginBottom:e.spacing(2)})),_u=iu("div")(({theme:e})=>({marginBottom:e.spacing(2)})),Cu=iu("div")({position:"relative","& > div > div":{display:"flex",alignItems:"baseline",flexWrap:"wrap"},"& .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}}),ku=iu("div")(({theme:e,$incorrect:t,$correct:n,$showCorrectness:r,$correctAnswerShown:o})=>({maxWidth:"fit-content",...t&&{borderColor:`${su.incorrect()} !important`},...n&&{borderColor:`${su.correct()} !important`},...r&&{border:"2px solid"},...o&&{padding:e.spacing(1),letterSpacing:"0.5px"},"& > .mq-math-mode":{"& > .mq-root-block":{"& > .mq-editable-field":{minWidth:"10px",padding:e.spacing(.25)}},"& sup":{top:0}}})),Eu=iu(wi)({"& > .mq-root-block":{"& > .mq-editable-field":{borderColor:su.text()}}}),Su=iu("div")(({theme:e})=>({zIndex:10,minWidth:"400px",marginTop:e.spacing(2)})),Au=iu("div")(({theme:e})=>({marginBottom:e.spacing(1),pointerEvents:"none"})),Ru=iu("h2")({position:"absolute",left:"-10000px",top:"auto",width:"1px",height:"1px",overflow:"hidden"}),Ou=iu("div")(({theme:e})=>({marginBottom:e.spacing(2)})),Du=iu(mu)(({theme:e})=>({color:su.text(),marginBottom:e.spacing(2)}));if("undefined"!=typeof document){const e="math-templated-main-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 flex: 2;\n color: grey;\n background: rgba(0, 0, 0, 0.04);\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 }\n .block-math {\n color: ${su.text()};\n background-color: ${su.background()};\n padding: 4px !important;\n display: flex;\n align-items: center;\n justify-content: center;\n flex: 8;\n }\n .block-math > .mq-math-mode > .mq-hasCursor > .mq-cursor {\n display: none;\n }\n .correct {\n border-color: ${su.correct()} !important;\n }\n .incorrect {\n border-color: ${su.incorrect()} !important;\n }\n `,document.head.appendChild(t)}}let ju=!1;const Tu=/(\{\{\d+\}\})/gm,Mu=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);function Lu(e=[],t){return 30*Math.floor(e.length/5)+("miscellaneous"===t?600:500)}function qu(e,t){const{responses:n,disabled:r,markup:o,printMode:i,alwaysShowCorrect:a}=e||{};if(o){if(t.showCorrect)return Object.keys(n||{}).reduce((e,t)=>(e[t]=bu([n,"optionalAccess",e=>e[t],"optionalAccess",e=>e.answer]),e),{});return o.split(Tu).filter(e=>e).reduce((e,n)=>{if(n.match(Tu)){const o=Nu.getResponseKey(n),s=t.session.answers[`r${o}`];if(i&&!a){const t="\\ \\ ".repeat(30)+"\\embed{newLine}[] ";return{...e,[o]:`\\MathQuillMathField[r${o}]{${t.repeat(3)}}`}}return r?{...e,[o]:`\\embed{answerBlock}[r${o}]`}:{...e,[o]:`\\MathQuillMathField[r${o}]{${s&&s.value||""}}`}}return e},{})}}class Nu extends ru.Component{static __initStatic(){this.getResponseKey=e=>(e||"").replaceAll("{{","").replaceAll("}}","")}static __initStatic2(){this.propTypes={session:ou.object.isRequired,onSessionChange:ou.func,model:ou.object.isRequired}}constructor(e){super(e),Nu.prototype.__init.call(this),Nu.prototype.__init2.call(this),Nu.prototype.__init3.call(this),Nu.prototype.__init4.call(this),Nu.prototype.__init5.call(this),Nu.prototype.__init6.call(this),Nu.prototype.__init7.call(this),Nu.prototype.__init8.call(this),Nu.prototype.__init9.call(this),Nu.prototype.__init10.call(this),Nu.prototype.__init11.call(this),Nu.prototype.__init12.call(this),Nu.prototype.__init13.call(this);const t={},{model:n,session:r}=e||{},{markup:o,alwaysShowCorrect:i}=n||{},{answers:a}=r||{};o&&(o||"").replace(Tu,e=>{const n=Nu.getResponseKey(e),r=a&&a[`r${n}`];t[`r${n}`]={value:bu([r,"optionalAccess",e=>e.value])||""}}),this.state={session:{...e.session,answers:t},activeAnswerBlock:"",showCorrect:i||!1,tooltipContainerRef:ru.createRef()}}UNSAFE_componentWillMount(){if("undefined"!=typeof window){let e=vu.getInterface(3);ju||(e.registerEmbed("answerBlock",e=>({htmlString:`<div class="block-container">\n <div class="block-response" id="${e}Index">R</div>\n <div class="block-math">\n <span id="${e}"></span>\n </div>\n </div>`,text:()=>"text",latex:()=>`\\embed{answerBlock}[${e}]`})),ju=!0)}}__init(){this.handleAnswerBlockDomUpdate=()=>{const{model:e}=this.props,{session:t,showCorrect:n}=this.state,r=t.answers;this.root&&e.disabled&&!n&&Object.keys(r).forEach(t=>{const n=this.root.querySelector(`#${t}`),o=this.root.querySelector(`#${t}Index`);if(n){let i=vu.getInterface(3);const a=r[t];n.textContent=a&&a.value||"",e.view&&(n.parentElement.parentElement.classList.remove("correct"),n.parentElement.parentElement.classList.remove("incorrect")),i.StaticMath(n),o.textContent="R"}}),gu(this.root)}}UNSAFE_componentWillReceiveProps(e){const{model:t}=this.props,{model:n={}}=e||{},{markup:r="",env:o={}}=t||{},{markup:i="",env:a={},alwaysShowCorrect:s=!1}=n,l=e=>e&&"evaluate"===e.mode;l(o)&&l(a)||this.setState(e=>({...e.session,showCorrect:!1})),s&&this.setState({showCorrect:!0});const c=r.match(Tu),d=i.match(Tu);if(!An(c,d)){const e={},t=this.state.session.answers;(d||[]).forEach(n=>{const r=Nu.getResponseKey(n),o=t&&t[`r${r}`];e[`r${r}`]={value:bu([o,"optionalAccess",e=>e.value])||""}}),this.setState(t=>({session:{...t.session,answers:e}}),()=>{this.props.onSessionChange(this.state.session),this.handleAnswerBlockDomUpdate()})}}shouldComponentUpdate(e,t){const n=An(this.props.model,e.model),r=An(this.state,t);return!n||!r}componentDidMount(){this.handleAnswerBlockDomUpdate(),setTimeout(()=>gu(this.root),100)}componentDidUpdate(){this.handleAnswerBlockDomUpdate()}__init2(){this.onSubFieldFocus=e=>{this.setState({activeAnswerBlock:e})}}__init3(){this.toNodeData=e=>{if(!e)return;const{type:t,value:n}=e;return"command"===t||"cursor"===t?e:"answer"===t?{type:"answer",...e}:"clear"===n?{type:"clear"}:{type:"write",value:n}}}__init4(){this.setInput=e=>{this.input=e}}__init5(){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()}}__init6(){this.callOnSessionChange=()=>{const{onSessionChange:e}=this.props;e&&e(this.state.session)}}__init7(){this.toggleShowCorrect=e=>{this.setState({showCorrect:e},this.handleAnswerBlockDomUpdate)}}__init8(){this.subFieldChanged=(e,t)=>{Uo(),e&&this.setState(n=>({session:{...n.session,answers:{...n.session.answers,[e]:{value:t}}}}),this.callOnSessionChange)}}__init9(){this.getFieldName=(e,t)=>{const{answers:n}=this.state.session;if(Object.keys(n||{}).length){return Object.keys(n).find(n=>{const r=t[n];return r&&r.id==e.id})}}}__init10(){this.onBlur=e=>{const{relatedTarget:t,currentTarget:n}=e||{};const r=function e(t,n=0){if(!t||n>=16)return null;const r=t.offsetParent;return r?"tooltip"===r.getAttribute("role")?r:e(r,n+1):null}(t),o=r?function e(t,n=0){if(!t||n>=4)return null;const r=bu([t,"optionalAccess",e=>e.children,"optionalAccess",e=>e[0]]);return r?r.attributes&&r.attributes["data-keypad"]?r:e(r,n+1):null}(r):null;t&&n&&bu([o,"optionalAccess",e=>e.attributes,"access",e=>e["data-keypad"]])||this.setState({activeAnswerBlock:""})}}setTooltipRef(e){setTimeout(()=>{if(e&&Mu){const e=document.querySelector("[role='tooltip']");if(e){e.firstChild.setAttribute("tabindex","-1")}}},1)}__init11(){this.renderTeacherInstructions=()=>{const{model:e}=this.props,{teacherInstructions:t,animationsDisabled:n}=e||{},r=t&&(du(t)||uu(t)),o=ru.createElement(pu,{defaultClassName:"teacher-instructions",prompt:t});return r&&ru.createElement(_u,null,n?o:ru.createElement(lu,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},o))}}__init12(){this.renderRationale=()=>{const{model:e}=this.props,{rationale:t,animationsDisabled:n}=e||{},r=ru.createElement(pu,{prompt:t});return t&&(du(t)||uu(t))&&ru.createElement(_u,null,n?r:ru.createElement(lu,{labels:{hidden:"Show Rationale",visible:"Hide Rationale"}},r))}}__init13(){this.renderPlayerContent=()=>{const{model:e}=this.props,{activeAnswerBlock:t,showCorrect:n,session:r,tooltipContainerRef:o}=this.state,{correctness:i,disabled:a,view:s,responses:l,equationEditor:c,customKeys:d,feedback:u,env:{mode:p}={},printMode:h,alwaysShowCorrect:m}=e||{},f=Sn(l),g=function(e=[]){return e.map(e=>({name:e,latex:e,write:e,label:e}))}(d),v=qu(e,this.state)||"",b=h&&!m;return ru.createElement(Cu,null,ru.createElement(Md,{disabled:a,markup:e.markup,value:{},customMarkMarkupComponent:e=>{const l="evaluate"===p&&u&&u[e],d=ru.createElement(Eu,{ref:e=>{this.mqStatic=e||this.mqStatic},latex:v[e],onSubFieldChange:this.subFieldChanged,getFieldName:this.getFieldName,setInput:this.setInput,onSubFieldFocus:this.onSubFieldFocus,onBlur:this.onBlur});return ru.createElement(ku,{ref:o,$incorrect:!f&&!l&&!n,$correct:!f&&(l||n),$showCorrectness:!f&&a&&i&&!s,$correctAnswerShown:n},ru.createElement(au,{ref:e=>this.setTooltipRef(e),enterTouchDelay:0,interactive:!0,open:t===`r${e}`,slotProps:{popper:{container:bu([o,"optionalAccess",e=>e.current])||void 0,placement:"bottom-end",sx:{backgroundColor:"transparent",width:"650px",opacity:1,"& .MuiTooltip-arrow":{display:"none"}},modifiers:{preventOverflow:{enabled:!0,boundariesElement:"body"},flip:{enabled:!1}}},tooltip:{sx:{fontSize:"initial",backgroundColor:"transparent",width:"600px",marginTop:0,paddingTop:0,boxShadow:"none"}}},title:Object.keys(r.answers).map(e=>e===t&&!(n||a)&&ru.createElement(Su,{"data-keypad":!0,key:e,style:{width:Lu(g,c)}},ru.createElement($i,{additionalKeys:g,mode:c||6,onClick:this.onClick}))||null)},b?ru.createElement(Au,null,d):ru.createElement("div",null,d)))}}))}}render(){const{model:e}=this.props,{showCorrect:t}=this.state,{prompt:n,env:{mode:r,role:o}={},extraCSSRules:i,correctness:a,responses:s,language:l,showNote:c,note:d}=e||{},u=!Sn(s)&&a&&"correct"!==a.correctness,p=(t||"view"===r&&"instructor"===o)&&c&&d;return ru.createElement(yu,{extraCSSRules:i,ref:e=>{const t=fu.findDOMNode(e);this.root=t||this.root}},ru.createElement(xu,null,"gather"===r&&ru.createElement(Ru,null,"Math Equation Response Question"),ru.createElement(xu,null,u&&ru.createElement(Du,{language:l,show:!0,toggled:t,onToggle:this.toggleShowCorrect})),this.renderTeacherInstructions(),n&&ru.createElement(wu,null,ru.createElement(pu,{prompt:n})),ru.createElement(cu,{false:!0},this.renderPlayerContent()),p&&ru.createElement(Ou,{className:"note",dangerouslySetInnerHTML:{__html:d}}),this.renderRationale()))}}Nu.__initStatic(),Nu.__initStatic2();const Fu=t;class Iu extends HTMLElement{constructor(){super(),this._root=null,this.sessionChangedEventCaller=kn(()=>{this.dispatchEvent(new x(this.tagName.toLowerCase(),!0))},1e3)}set model(e){this._model=e,this.render(),this.dispatchEvent(new b(this.tagName.toLowerCase(),this.isSessionComplete(),void 0!==this._model))}get model(){return this._model}set session(e){this._session=e,this.render()}get session(){return this._session}isSessionComplete(){return!0}onSessionChange(e){Object.keys(e).map(t=>{this._session[t]=e[t]}),this.sessionChangedEventCaller(),this.render()}connectedCallback(){this.render()}render(){if(this._model&&this._session&&this._model&&this._session){const e=Fu.createElement(Nu,{model:this._model,session:this._session,onSessionChange:this.onSessionChange.bind(this)});this._root||(this._root=m(this)),this._root.render(e)}}disconnectedCallback(){this._root&&this._root.unmount()}}export{Iu as default};
@@ -0,0 +1,21 @@
1
+
2
+ <!doctype html>
3
+ <html>
4
+ <head>
5
+ <title>@pie-element/math-templated@6.2.0-next.6</title>
6
+ <script
7
+ type="module"
8
+ src="https://cdn.jsdelivr.net/npm/@pslb/demo-el@^1.0.0/dist/demo-el/demo-el.esm.js"></script>
9
+
10
+ <link
11
+ href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
12
+ rel="stylesheet"
13
+ />
14
+ <style>
15
+ html, body {
16
+ font-family: 'Roboto', sans-serif;
17
+ }
18
+ </style>
19
+ <script type="module" src="./demo.js"></script>
20
+ </head>
21
+ </html>
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@pie-element/math-templated",
3
+ "version": "6.2.0-next.6",
4
+ "modules": [
5
+ {
6
+ "name": "@pie-lib/shared-module",
7
+ "version": "^4.1.0"
8
+ },
9
+ {
10
+ "name": "@pie-lib/math-rendering-module",
11
+ "version": "^4.1.0"
12
+ },
13
+ {
14
+ "name": "@pie-lib/math-edit-module",
15
+ "version": "^3.2.0"
16
+ },
17
+ {
18
+ "name": "@pie-lib/drag-module",
19
+ "version": "^3.2.0"
20
+ }
21
+ ]
22
+ }
@@ -0,0 +1,105 @@
1
+ import PrintElement from './print.js';
2
+
3
+ var generate = {};
4
+
5
+ generate.model = (id, element) => ({
6
+ id,
7
+ element,
8
+ rationale: 'Rationale',
9
+ partialScoring: true,
10
+ prompt: 'There are 24 students in the class. They had the choice to buy supplies from two different stores, Store A and B. Each of them bought 2 binders and 5 notebooks. The students have a total of $420 to spend.',
11
+ scoringType: 'auto',
12
+ feedbackEnabled: false,
13
+ promptEnabled: true,
14
+ rationaleEnabled: true,
15
+ teacherInstructionsEnabled: true,
16
+ studentInstructionsEnabled: true,
17
+ toolbarEditorPosition: 'bottom',
18
+ validationDefault: 'literal',
19
+ ignoreOrderDefault: false,
20
+ allowTrailingZerosDefault: false,
21
+ teacherInstructions: 'These are teacher instructions',
22
+ customKeys: [], // these have effect on player only?
23
+ equationEditor: 'geometry',
24
+ markup: `
25
+ <p>If the unit price of a notebook in Store A is $1.50, what is the unit price of a binder? \${{0}}</p>
26
+ <p>If the unit price of a binder in Store B is $2.80, what is the unit price of a notebook? \${{1}}</p>
27
+ `,
28
+ responses: {
29
+ 0: {
30
+ allowTrailingZeros: false,
31
+ answer: '5',
32
+ id: '1',
33
+ validation: 'symbolic',
34
+ ignoreOrder: false,
35
+ alternates: {}
36
+ },
37
+ 1: {
38
+ allowTrailingZeros: false,
39
+ answer: '2.38',
40
+ id: '1',
41
+ validation: 'literal',
42
+ ignoreOrder: false,
43
+ alternates: {}
44
+ }
45
+ }
46
+ });
47
+
48
+ const { model } = generate;
49
+
50
+ var config = {
51
+ elements: {
52
+ 'math-templated': '../..',
53
+ },
54
+ models: [model('1', 'math-templated')],
55
+ };
56
+
57
+ // new init - just shows off print!
58
+
59
+ const init = async () => {
60
+ console.log('define the element...');
61
+ await Promise.all(
62
+ config.models.map(async (m) => {
63
+ try {
64
+ const printTag = `${m.element}-print`;
65
+ if (customElements.get(printTag)) {
66
+ return true;
67
+ } else {
68
+ customElements.define(printTag, PrintElement);
69
+ await customElements.whenDefined(printTag);
70
+ return true;
71
+ }
72
+ } catch (e) {
73
+ return false;
74
+ }
75
+ })
76
+ );
77
+
78
+ console.log('now apply the model...');
79
+ config.models.forEach((m) => {
80
+ const printTag = `${m.element}-print`;
81
+ const h3s = document.createElement('h3');
82
+ h3s.textContent = 'student mode';
83
+ document.body.appendChild(h3s);
84
+ const de = document.createElement(printTag);
85
+ document.body.appendChild(de);
86
+ de.options = {};
87
+ de.model = m;
88
+
89
+ const h3 = document.createElement('h3');
90
+ h3.textContent = 'instructor mode';
91
+ document.body.appendChild(h3);
92
+ const instr = document.createElement(printTag);
93
+ document.body.appendChild(instr);
94
+ instr.options = { mode: 'instructor' };
95
+ instr.model = JSON.parse(JSON.stringify(m));
96
+ });
97
+ };
98
+
99
+ init()
100
+ .then(() => {
101
+ console.log('ready');
102
+ })
103
+ .catch((e) => {
104
+ console.error(e);
105
+ });
@@ -0,0 +1,18 @@
1
+
2
+ <!doctype html>
3
+ <html>
4
+ <head>
5
+ <title>@pie-element/math-templated@6.2.0-next.6</title>
6
+ <link
7
+ href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
8
+ rel="stylesheet"
9
+ />
10
+ <style>
11
+ html, body {
12
+ font-family: 'Roboto', sans-serif;
13
+ }
14
+ </style>
15
+ <script type="module" src="./print-demo.js"></script>
16
+ </head>
17
+ <body></body>
18
+ </html>