@pie-element/categorize 10.0.0 → 11.0.1-esmbeta.0
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/CHANGELOG.md +21 -0
- package/configure/CHANGELOG.md +8 -0
- package/configure/package.json +8 -8
- package/controller/CHANGELOG.md +8 -0
- package/controller/package.json +5 -5
- package/esm/configure.js +61000 -0
- package/esm/configure.js.map +1 -0
- package/esm/controller.js +1429 -0
- package/esm/controller.js.map +1 -0
- package/esm/element.js +39704 -0
- package/esm/element.js.map +1 -0
- package/esm/package.json +4 -0
- package/module/configure.js +1 -0
- package/module/controller.js +6076 -0
- package/module/demo.js +382 -0
- package/module/element.js +1 -0
- package/module/index.html +21 -0
- package/module/manifest.json +22 -0
- package/module/print-demo.js +420 -0
- package/module/print.html +18 -0
- package/package.json +27 -10
package/esm/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_dll_debug as e,_dll_lodash as t,_dll_react as n,_dll_prop_types as o,_dll_material_ui__core_styles as r,_dll_classnames as i,_dll_material_ui__core as a,_dll_material_ui__icons as s,_dll_pie_lib__render_ui as c,_dll_react_dom as l}from"../../../@pie-lib/shared-module@^1.14.0/module/index.js";import{_dll_pie_lib__math_rendering as u}from"../../../@pie-lib/math-rendering-module@^2.7.0/module/index.js";import{_dll_pie_lib__config_ui as p}from"../../../@pie-lib/config-module@^2.19.0/module/index.js";import{_dll_pie_lib__editable_html as d}from"../../../@pie-lib/editable-html-module@^5.6.0/module/index.js";import{_dll_pie_lib__drag as h}from"../../../@pie-lib/drag-module@^2.8.0/module/index.js";var g={};Object.defineProperty(g,"__esModule",{value:!0});class f extends CustomEvent{constructor(e,t=!1){super(f.TYPE,{bubbles:!0,detail:{update:e,reset:t}}),this.update=e,this.reset=t}}f.TYPE="model.updated";var m=g.ModelUpdatedEvent=f;class y extends CustomEvent{constructor(e,t){super(y.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}y.TYPE="delete.image";var b=g.DeleteImageEvent=y;class v extends CustomEvent{constructor(e){super(v.TYPE,{bubbles:!0,detail:e}),this.handler=e}}v.TYPE="insert.image";var C=g.InsertImageEvent=v;class S extends CustomEvent{constructor(e,t){super(S.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}S.TYPE="delete.sound";var w=g.DeleteSoundEvent=S;class x extends CustomEvent{constructor(e){super(x.TYPE,{bubbles:!0,detail:e}),this.handler=e}}x.TYPE="insert.sound";var k=g.InsertSoundEvent=x;const O=(e={},t={})=>({...t,...e});e("@pie-lib:categorize:scoring");const R=e,{clone:_}=t,{remove:P}=t;function E(e){let t,n=e[0],o=1;for(;o<e.length;){const r=e[o],i=e[o+1];if(o+=2,("optionalAccess"===r||"optionalCall"===r)&&null==n)return;"access"===r||"optionalAccess"===r?(t=n,n=i(n)):"call"!==r&&"optionalCall"!==r||(n=i(((...e)=>n.call(t,...e))),t=void 0)}return n}const I=R("@pie-lib:categorize"),D=(e,t,n)=>{const o=(t=t||[]).reduce(((t,o)=>{const r=n-t.count,i=j(e,o,r);return t.out.push(i.array),t.count=t.count+(i.count||0),t}),{out:[],count:0});return o.out},j=(e,t,n)=>{if(t=t||[],0===n){const n=t.filter((t=>t!==e));return{array:n,count:t.length-n.length}}{const o=t.reduce(((t,o)=>(o===e?t.count<n&&(t.count+=1,t.out.push(o)):t.out.push(o),t)),{out:[],count:0});return{array:o.out,count:o.count}}},T=(e,t,n)=>n.map((n=>n.category!==t?(n.choices=(n.choices||[]).filter((t=>t!==e.id)),n):(n.choices=n.choices.reduce(((t,n)=>{if(n.id===e.id){-1===t.findIndex((t=>t.id===e.id))&&t.push(n)}else t.push(n);return t}),[]),n))),N=(e,t,n,o)=>(I("[removeChoiceFromCategory] choiceIndex:",n),o.map((o=>{if(o.category===t){const t=_(o.choices),r=t.findIndex(((t,o)=>t===e&&o>=n));return-1!==r&&t.splice(r,1),{...o,choices:t}}return o}))),M=(e,t,n,o,r)=>(I("[moveChoiceToCategory] choice: ",e,"from: ",t,"to: ",n,"answers: ",r),t===n?r:(t&&(r=N(e,t,o,r)),-1===r.findIndex((e=>e.category===n))?(r.push({category:n,choices:[e]}),r):r.map((t=>t.category===n?(t.choices=t.choices||[],t.choices.push(e),t):t)))),A=n,L=o,{withStyles:H}=r,F=i,q=d;function B(e){let t,n=e[0],o=1;for(;o<e.length;){const r=e[o],i=e[o+1];if(o+=2,("optionalAccess"===r||"optionalCall"===r)&&null==n)return;"access"===r||"optionalAccess"===r?(t=n,n=i(n)):"call"!==r&&"optionalCall"!==r||(n=i(((...e)=>n.call(t,...e))),t=void 0)}return n}class $ extends A.Component{static __initStatic(){this.propTypes={classes:L.object.isRequired,className:L.string,configuration:L.object.isRequired,deleteFocusedEl:L.func,disabled:L.bool,focusedEl:L.number,index:L.number,label:L.string,maxImageWidth:L.object,maxImageHeight:L.object,onChange:L.func,onDelete:L.func,imageSupport:L.shape({add:L.func.isRequired,delete:L.func.isRequired}),uploadSoundSupport:L.shape({add:L.func.isRequired,delete:L.func.isRequired}),toolbarOpts:L.object,error:L.string,spellCheck:L.bool}}static __initStatic2(){this.defaultProps={}}constructor(e){super(e)}componentDidMount(){const{focusedEl:e,index:t}=this.props;e&&t&&e===t&&this.inputRef.focus("end",null,!0)}render(){const{onChange:e,configuration:t,label:n,classes:o,className:r,deleteFocusedEl:i,disabled:a,imageSupport:s,toolbarOpts:c,spellCheck:l,error:u,maxImageWidth:p,maxImageHeight:d,uploadSoundSupport:h,mathMlOptions:g={}}=this.props,{headers:f,baseInputConfiguration:m}=t;return A.createElement("div",{className:F(o.inputHeader,r)},A.createElement(q,{imageSupport:s,disabled:a,ref:e=>this.inputRef=e,autoWidthToolbar:!0,label:"label",markup:n,onChange:e,className:o.editor,pluginProps:O(B([f,"optionalAccess",e=>e.inputConfiguration]),m),toolbarOpts:c,spellCheck:l,error:u,maxImageWidth:p,maxImageHeight:d,uploadSoundSupport:h,languageCharactersProps:[{language:"spanish"},{language:"special"}],onDone:()=>{i&&i()},mathMlOptions:g}))}}$.__initStatic(),$.__initStatic2();var U=H((e=>({editor:{flex:"1",paddingBottom:e.spacing.unit,maxWidth:"100%"},iconButtonRoot:{width:"auto",height:"auto"},inputHeader:{display:"flex",justifyContent:"space-between"}})))($);const z=n,W=o,{withStyles:V}=r,K=i,{Button:Y}=a;class J extends z.Component{static __initStatic(){this.propTypes={classes:W.object.isRequired,className:W.string,label:W.string,onClick:W.func,disabled:W.bool}}static __initStatic2(){this.defaultProps={label:"Add"}}render(){const{classes:e,className:t,label:n,onClick:o,disabled:r}=this.props;return z.createElement(Y,{onClick:o,disabled:r,className:K(e.addButton,t),size:"small",variant:"contained",color:"primary"},n)}}J.__initStatic(),J.__initStatic2();const G=V((e=>({addButton:{height:4*e.spacing.unit}})))(J),X=V((()=>({deleteButton:{margin:0,padding:0}})))((({classes:e,label:t,onClick:n,disabled:o})=>z.createElement(Y,{className:e.deleteButton,onClick:n,size:"small",color:"primary",disabled:o},t))),Q=n,Z=o,{withStyles:ee}=r,te=i,{IconButton:ne}=a,{RemoveCircleOutline:oe}=s,{HtmlAndMath:re}=c,{color:ie}=c,{Choice:ae}=h;function se(e){let t,n=e[0],o=1;for(;o<e.length;){const r=e[o],i=e[o+1];if(o+=2,("optionalAccess"===r||"optionalCall"===r)&&null==n)return;"access"===r||"optionalAccess"===r?(t=n,n=i(n)):"call"!==r&&"optionalCall"!==r||(n=i(((...e)=>n.call(t,...e))),t=void 0)}return n}class ce extends Q.Component{constructor(...e){super(...e),ce.prototype.__init.call(this)}static __initStatic(){this.propTypes={alternateResponseIndex:Z.number,category:Z.object,classes:Z.object.isRequired,className:Z.string,choice:Z.object.isRequired,choiceIndex:Z.number,onDelete:Z.func.isRequired}}static __initStatic2(){this.defaultProps={}}__init(){this.delete=()=>{const{onDelete:e,choice:t}=this.props;e(t)}}render(){const{alternateResponseIndex:e,category:t,classes:n,className:o,choice:r,choiceIndex:i}=this.props;return Q.createElement("div",{className:te(n.choicePreview,o)},r?Q.createElement(ae,{alternateResponseIndex:e,category:t,choice:r,choiceIndex:i,className:n.overflowChoice,onRemoveChoice:()=>this.delete()},Q.createElement(re,{html:se([r,"optionalAccess",e=>e.content]),className:`${n.breakWord}`}),Q.createElement(ne,{"aria-label":"delete",className:te(n.delete,n.customColor),onClick:this.delete},Q.createElement(oe,null))):null)}}ce.__initStatic(),ce.__initStatic2();var le=ee((()=>({choicePreview:{position:"relative",overflow:"auto"},delete:{position:"absolute",right:0,top:0},breakWord:{maxWidth:"90%",wordBreak:"break-all"},customColor:{color:`${ie.tertiary()} !important`},overflowChoice:{overflow:"auto"}})))(ce);const{createContext:ue}=n;var pe=ue({dragDropManager:void 0}),de={exports:{}},he={},ge=n,fe=60103;if(he.Fragment=60107,"function"==typeof Symbol&&Symbol.for){var me=Symbol.for;fe=me("react.element"),he.Fragment=me("react.fragment")}var ye=ge.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,be=Object.prototype.hasOwnProperty,ve={key:!0,ref:!0,__self:!0,__source:!0};function Ce(e,t,n){var o,r={},i=null,a=null;for(o in void 0!==n&&(i=""+n),void 0!==t.key&&(i=""+t.key),void 0!==t.ref&&(a=t.ref),t)be.call(t,o)&&!ve.hasOwnProperty(o)&&(r[o]=t[o]);if(e&&e.defaultProps)for(o in t=e.defaultProps)void 0===r[o]&&(r[o]=t[o]);return{$$typeof:fe,type:e,key:i,ref:a,props:r,_owner:ye.current}}function Se(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),r=2;r<n;r++)o[r-2]=arguments[r];if(!e){var i;if(void 0===t)i=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var a=0;(i=new Error(t.replace(/%s/g,(function(){return o[a++]})))).name="Invariant Violation"}throw i.framesToPop=1,i}}function we(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function xe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}he.jsx=Ce,he.jsxs=Ce,de.exports=he;var ke=!1,Oe=!1,Re=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),xe(this,"internalMonitor",void 0),xe(this,"sourceId",null),this.internalMonitor=t.getMonitor()}var t,n;return t=e,(n=[{key:"receiveHandlerId",value:function(e){this.sourceId=e}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){Se(!ke,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return ke=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{ke=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;Se(!Oe,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Oe=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Oe=!1}}},{key:"subscribeToStateChange",value:function(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}},{key:"isDraggingSource",value:function(e){return this.internalMonitor.isDraggingSource(e)}},{key:"isOverTarget",value:function(e,t){return this.internalMonitor.isOverTarget(e,t)}},{key:"getTargetIds",value:function(){return this.internalMonitor.getTargetIds()}},{key:"isSourcePublic",value:function(){return this.internalMonitor.isSourcePublic()}},{key:"getSourceId",value:function(){return this.internalMonitor.getSourceId()}},{key:"subscribeToOffsetChange",value:function(e){return this.internalMonitor.subscribeToOffsetChange(e)}},{key:"canDragSource",value:function(e){return this.internalMonitor.canDragSource(e)}},{key:"canDropOnTarget",value:function(e){return this.internalMonitor.canDropOnTarget(e)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}])&&we(t.prototype,n),e}();function _e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Pe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ee=!1,Ie=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Pe(this,"internalMonitor",void 0),Pe(this,"targetId",null),this.internalMonitor=t.getMonitor()}var t,n;return t=e,(n=[{key:"receiveHandlerId",value:function(e){this.targetId=e}},{key:"getHandlerId",value:function(){return this.targetId}},{key:"subscribeToStateChange",value:function(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}},{key:"canDrop",value:function(){if(!this.targetId)return!1;Se(!Ee,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return Ee=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Ee=!1}}},{key:"isOver",value:function(e){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,e)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}])&&_e(t.prototype,n),e}();const{cloneElement:De}=n,{isValidElement:je}=n;function Te(e){if("string"!=typeof e.type){var t=e.type.displayName||e.type.name||"the component";throw new Error("Only native element nodes can now be passed to React DnD connectors."+"You can either wrap ".concat(t," into a <div>, or turn it into a ")+"drag source or a drop target itself.")}}function Ne(e){var t={};return Object.keys(e).forEach((function(n){var o=e[n];if(n.endsWith("Ref"))t[n]=e[n];else{var r=function(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!je(t)){var o=t;return e(o,n),o}var r=t;Te(r);var i=n?function(t){return e(t,n)}:e;return Ae(r,i)}}(o);t[n]=function(){return r}}})),t}function Me(e,t){"function"==typeof e?e(t):e.current=t}function Ae(e,t){var n=e.ref;return Se("string"!=typeof n,"Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),De(e,n?{ref:function(e){Me(n,e),Me(t,e)}}:{ref:t})}function Le(e){return Le="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Le(e)}function He(e){return null!==e&&"object"===Le(e)&&Object.prototype.hasOwnProperty.call(e,"current")}function Fe(e,t,n,o){var r=n?n.call(o,e,t):void 0;if(void 0!==r)return!!r;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(var s=Object.prototype.hasOwnProperty.bind(t),c=0;c<i.length;c++){var l=i[c];if(!s(l))return!1;var u=e[l],p=t[l];if(!1===(r=n?n.call(o,u,p,l):void 0)||void 0===r&&u!==p)return!1}return!0}function qe(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Be(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var $e=function(){function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Be(this,"hooks",Ne({dragSource:function(e,t){n.clearDragSource(),n.dragSourceOptions=t||null,He(e)?n.dragSourceRef=e:n.dragSourceNode=e,n.reconnectDragSource()},dragPreview:function(e,t){n.clearDragPreview(),n.dragPreviewOptions=t||null,He(e)?n.dragPreviewRef=e:n.dragPreviewNode=e,n.reconnectDragPreview()}})),Be(this,"handlerId",null),Be(this,"dragSourceRef",null),Be(this,"dragSourceNode",void 0),Be(this,"dragSourceOptionsInternal",null),Be(this,"dragSourceUnsubscribe",void 0),Be(this,"dragPreviewRef",null),Be(this,"dragPreviewNode",void 0),Be(this,"dragPreviewOptionsInternal",null),Be(this,"dragPreviewUnsubscribe",void 0),Be(this,"lastConnectedHandlerId",null),Be(this,"lastConnectedDragSource",null),Be(this,"lastConnectedDragSourceOptions",null),Be(this,"lastConnectedDragPreview",null),Be(this,"lastConnectedDragPreviewOptions",null),Be(this,"backend",void 0),this.backend=t}var t,n;return t=e,(n=[{key:"receiveHandlerId",value:function(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}},{key:"connectTarget",get:function(){return this.dragSource}},{key:"dragSourceOptions",get:function(){return this.dragSourceOptionsInternal},set:function(e){this.dragSourceOptionsInternal=e}},{key:"dragPreviewOptions",get:function(){return this.dragPreviewOptionsInternal},set:function(e){this.dragPreviewOptionsInternal=e}},{key:"reconnect",value:function(){this.reconnectDragSource(),this.reconnectDragPreview()}},{key:"reconnectDragSource",value:function(){var e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();t&&this.disconnectDragSource(),this.handlerId&&(e?t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)):this.lastConnectedDragSource=e)}},{key:"reconnectDragPreview",value:function(){var e=this.dragPreview,t=this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();t&&this.disconnectDragPreview(),this.handlerId&&(e?t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=e,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,e,this.dragPreviewOptions)):this.lastConnectedDragPreview=e)}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didConnectedDragSourceChange",value:function(){return this.lastConnectedDragSource!==this.dragSource}},{key:"didConnectedDragPreviewChange",value:function(){return this.lastConnectedDragPreview!==this.dragPreview}},{key:"didDragSourceOptionsChange",value:function(){return!Fe(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!Fe(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}},{key:"disconnectDragSource",value:function(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}},{key:"disconnectDragPreview",value:function(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}},{key:"dragSource",get:function(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}},{key:"dragPreview",get:function(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}},{key:"clearDragSource",value:function(){this.dragSourceNode=null,this.dragSourceRef=null}},{key:"clearDragPreview",value:function(){this.dragPreviewNode=null,this.dragPreviewRef=null}}])&&qe(t.prototype,n),e}();function Ue(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function ze(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var We=function(){function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ze(this,"hooks",Ne({dropTarget:function(e,t){n.clearDropTarget(),n.dropTargetOptions=t,He(e)?n.dropTargetRef=e:n.dropTargetNode=e,n.reconnect()}})),ze(this,"handlerId",null),ze(this,"dropTargetRef",null),ze(this,"dropTargetNode",void 0),ze(this,"dropTargetOptionsInternal",null),ze(this,"unsubscribeDropTarget",void 0),ze(this,"lastConnectedHandlerId",null),ze(this,"lastConnectedDropTarget",null),ze(this,"lastConnectedDropTargetOptions",null),ze(this,"backend",void 0),this.backend=t}var t,n;return t=e,(n=[{key:"connectTarget",get:function(){return this.dropTarget}},{key:"reconnect",value:function(){var e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();var t=this.dropTarget;this.handlerId&&(t?e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions)):this.lastConnectedDropTarget=t)}},{key:"receiveHandlerId",value:function(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}},{key:"dropTargetOptions",get:function(){return this.dropTargetOptionsInternal},set:function(e){this.dropTargetOptionsInternal=e}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didDropTargetChange",value:function(){return this.lastConnectedDropTarget!==this.dropTarget}},{key:"didOptionsChange",value:function(){return!Fe(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}},{key:"disconnectDropTarget",value:function(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}},{key:"dropTarget",get:function(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}},{key:"clearDropTarget",value:function(){this.dropTargetRef=null,this.dropTargetNode=null}}])&&Ue(t.prototype,n),e}();function Ve(e,t,n){var o=n.getRegistry(),r=o.addTarget(e,t);return[r,function(){return o.removeTarget(r)}]}function Ke(e,t,n){var o=n.getRegistry(),r=o.addSource(e,t);return[r,function(){return o.removeSource(r)}]}function Ye(e){return Ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ye(e)}function Je(e){var t=e.current;return null==t?null:t.decoratedRef?t.decoratedRef.current:t}function Ge(e){return"function"==typeof e}function Xe(){}function Qe(e){if(!function(e){return"object"===Ye(e)&&null!==e}(e))return!1;if(null===Object.getPrototypeOf(e))return!0;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Ze(e,t){return"string"==typeof e||"symbol"===Ye(e)||!!t&&Array.isArray(e)&&e.every((function(e){return Ze(e,!1)}))}function et(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tt(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function nt(e,t,n){return t&&tt(e.prototype,t),n&&tt(e,n),e}function ot(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var rt=function(){function e(t){et(this,e),ot(this,"isDisposed",!1),ot(this,"action",void 0),this.action=Ge(t)?t:Xe}return nt(e,[{key:"dispose",value:function(){this.isDisposed||(this.action(),this.isDisposed=!0)}}],[{key:"isDisposable",value:function(e){return Boolean(e&&Ge(e.dispose))}},{key:"_fixup",value:function(t){return e.isDisposable(t)?t:e.empty}},{key:"create",value:function(t){return new e(t)}}]),e}();ot(rt,"empty",{dispose:Xe});var it=function(){function e(){et(this,e),ot(this,"isDisposed",!1),ot(this,"disposables",void 0);for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];this.disposables=n}return nt(e,[{key:"add",value:function(e){this.isDisposed?e.dispose():this.disposables.push(e)}},{key:"remove",value:function(e){var t=!1;if(!this.isDisposed){var n=this.disposables.indexOf(e);-1!==n&&(t=!0,this.disposables.splice(n,1),e.dispose())}return t}},{key:"clear",value:function(){if(!this.isDisposed){for(var e=this.disposables.length,t=new Array(e),n=0;n<e;n++)t[n]=this.disposables[n];this.disposables=[];for(var o=0;o<e;o++)t[o].dispose()}}},{key:"dispose",value:function(){if(!this.isDisposed){this.isDisposed=!0;for(var e=this.disposables.length,t=new Array(e),n=0;n<e;n++)t[n]=this.disposables[n];this.disposables=[];for(var o=0;o<e;o++)t[o].dispose()}}}]),e}(),at=function(){function e(){et(this,e),ot(this,"isDisposed",!1),ot(this,"current",void 0)}return nt(e,[{key:"getDisposable",value:function(){return this.current}},{key:"setDisposable",value:function(e){var t=this.isDisposed;if(!t){var n=this.current;this.current=e,n&&n.dispose()}t&&e&&e.dispose()}},{key:"dispose",value:function(){if(!this.isDisposed){this.isDisposed=!0;var e=this.current;this.current=void 0,e&&e.dispose()}}}]),e}(),st={exports:{}},ct={},lt="function"==typeof Symbol&&Symbol.for,ut=lt?Symbol.for("react.element"):60103,pt=lt?Symbol.for("react.portal"):60106,dt=lt?Symbol.for("react.fragment"):60107,ht=lt?Symbol.for("react.strict_mode"):60108,gt=lt?Symbol.for("react.profiler"):60114,ft=lt?Symbol.for("react.provider"):60109,mt=lt?Symbol.for("react.context"):60110,yt=lt?Symbol.for("react.async_mode"):60111,bt=lt?Symbol.for("react.concurrent_mode"):60111,vt=lt?Symbol.for("react.forward_ref"):60112,Ct=lt?Symbol.for("react.suspense"):60113,St=lt?Symbol.for("react.suspense_list"):60120,wt=lt?Symbol.for("react.memo"):60115,xt=lt?Symbol.for("react.lazy"):60116,kt=lt?Symbol.for("react.block"):60121,Ot=lt?Symbol.for("react.fundamental"):60117,Rt=lt?Symbol.for("react.responder"):60118,_t=lt?Symbol.for("react.scope"):60119;function Pt(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case ut:switch(e=e.type){case yt:case bt:case dt:case gt:case ht:case Ct:return e;default:switch(e=e&&e.$$typeof){case mt:case vt:case xt:case wt:case ft:return e;default:return t}}case pt:return t}}}function Et(e){return Pt(e)===bt}ct.AsyncMode=yt,ct.ConcurrentMode=bt,ct.ContextConsumer=mt,ct.ContextProvider=ft,ct.Element=ut,ct.ForwardRef=vt,ct.Fragment=dt,ct.Lazy=xt,ct.Memo=wt,ct.Portal=pt,ct.Profiler=gt,ct.StrictMode=ht,ct.Suspense=Ct,ct.isAsyncMode=function(e){return Et(e)||Pt(e)===yt},ct.isConcurrentMode=Et,ct.isContextConsumer=function(e){return Pt(e)===mt},ct.isContextProvider=function(e){return Pt(e)===ft},ct.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===ut},ct.isForwardRef=function(e){return Pt(e)===vt},ct.isFragment=function(e){return Pt(e)===dt},ct.isLazy=function(e){return Pt(e)===xt},ct.isMemo=function(e){return Pt(e)===wt},ct.isPortal=function(e){return Pt(e)===pt},ct.isProfiler=function(e){return Pt(e)===gt},ct.isStrictMode=function(e){return Pt(e)===ht},ct.isSuspense=function(e){return Pt(e)===Ct},ct.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===dt||e===bt||e===gt||e===ht||e===Ct||e===St||"object"==typeof e&&null!==e&&(e.$$typeof===xt||e.$$typeof===wt||e.$$typeof===ft||e.$$typeof===mt||e.$$typeof===vt||e.$$typeof===Ot||e.$$typeof===Rt||e.$$typeof===_t||e.$$typeof===kt)},ct.typeOf=Pt,st.exports=ct;var It=st.exports,Dt={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},jt={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Tt={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Nt={};function Mt(e){return It.isMemo(e)?Tt:Nt[e.$$typeof]||Dt}Nt[It.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Nt[It.Memo]=Tt;var At=Object.defineProperty,Lt=Object.getOwnPropertyNames,Ht=Object.getOwnPropertySymbols,Ft=Object.getOwnPropertyDescriptor,qt=Object.getPrototypeOf,Bt=Object.prototype,$t=function e(t,n,o){if("string"!=typeof n){if(Bt){var r=qt(n);r&&r!==Bt&&e(t,r,o)}var i=Lt(n);Ht&&(i=i.concat(Ht(n)));for(var a=Mt(t),s=Mt(n),c=0;c<i.length;++c){var l=i[c];if(!(jt[l]||o&&o[l]||s&&s[l]||a&&a[l])){var u=Ft(n,l);try{At(t,l,u)}catch(e){}}}}return t};const{createRef:Ut}=n,{Component:zt}=n;function Wt(e){return Wt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wt(e)}function Vt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Kt(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Yt(e,t){return Yt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Yt(e,t)}function Jt(e,t){if(t&&("object"===Wt(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Gt(e)}function Gt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xt(e){return Xt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Xt(e)}function Qt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zt(e){var t=e.DecoratedComponent,n=e.createHandler,o=e.createMonitor,r=e.createConnector,i=e.registerHandler,a=e.containerDisplayName,s=e.getType,c=e.collect,l=e.options.arePropsEqual,u=void 0===l?Fe:l,p=t,d=t.displayName||t.name||"Component",h=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Yt(e,t)}(h,zt);var t,a,l=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=Xt(e);if(t){var r=Xt(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return Jt(this,n)}}(h);function h(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,h),Qt(Gt(t=l.call(this,e)),"decoratedRef",Ut()),Qt(Gt(t),"handlerId",void 0),Qt(Gt(t),"manager",void 0),Qt(Gt(t),"handlerMonitor",void 0),Qt(Gt(t),"handlerConnector",void 0),Qt(Gt(t),"handler",void 0),Qt(Gt(t),"disposable",void 0),Qt(Gt(t),"currentType",void 0),Qt(Gt(t),"handleChange",(function(){var e=t.getCurrentState();Fe(e,t.state)||t.setState(e)})),t.disposable=new at,t.receiveProps(e),t.dispose(),t}return t=h,a=[{key:"getHandlerId",value:function(){return this.handlerId}},{key:"getDecoratedComponentInstance",value:function(){return Se(this.decoratedRef.current,"In order to access an instance of the decorated component, it must either be a class component or use React.forwardRef()"),this.decoratedRef.current}},{key:"shouldComponentUpdate",value:function(e,t){return!u(e,this.props)||!Fe(t,this.state)}},{key:"componentDidMount",value:function(){this.disposable=new at,this.currentType=void 0,this.receiveProps(this.props),this.handleChange()}},{key:"componentDidUpdate",value:function(e){u(this.props,e)||(this.receiveProps(this.props),this.handleChange())}},{key:"componentWillUnmount",value:function(){this.dispose()}},{key:"receiveProps",value:function(e){this.handler&&(this.handler.receiveProps(e),this.receiveType(s(e)))}},{key:"receiveType",value:function(e){if(this.handlerMonitor&&this.manager&&this.handlerConnector&&e!==this.currentType){this.currentType=e;var t=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(o=n.next()).done)&&(i.push(o.value),!t||i.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Vt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(i(e,this.handler,this.manager),2),n=t[0],o=t[1];this.handlerId=n,this.handlerMonitor.receiveHandlerId(n),this.handlerConnector.receiveHandlerId(n);var r=this.manager.getMonitor().subscribeToStateChange(this.handleChange,{handlerIds:[n]});this.disposable.setDisposable(new it(new rt(r),new rt(o)))}}},{key:"dispose",value:function(){this.disposable.dispose(),this.handlerConnector&&this.handlerConnector.receiveHandlerId(null)}},{key:"getCurrentState",value:function(){return this.handlerConnector?c(this.handlerConnector.hooks,this.handlerMonitor,this.props):{}}},{key:"render",value:function(){var e=this;return de.exports.jsx(pe.Consumer,{children:function(t){var n,o=t.dragDropManager;return e.receiveDragDropManager(o),"undefined"!=typeof requestAnimationFrame&&requestAnimationFrame((function(){var t;return null===(t=e.handlerConnector)||void 0===t?void 0:t.reconnect()})),de.exports.jsx(p,Object.assign({},e.props,e.getCurrentState(),{ref:(n=p,function(e){return e&&e.prototype&&"function"==typeof e.prototype.render}(n)||function(e){var t;return"Symbol(react.forward_ref)"===(null==e||null===(t=e.$$typeof)||void 0===t?void 0:t.toString())}(n)?e.decoratedRef:null)}),void 0)}},void 0)}},{key:"receiveDragDropManager",value:function(e){void 0===this.manager&&(Se(void 0!==e,"Could not find the drag and drop manager in the context of %s. Make sure to render a DndProvider component in your top-level component. Read more: http://react-dnd.github.io/react-dnd/docs/troubleshooting#could-not-find-the-drag-and-drop-manager-in-the-context",d,d),void 0!==e&&(this.manager=e,this.handlerMonitor=o(e),this.handlerConnector=r(e.getBackend()),this.handler=n(this.handlerMonitor,this.decoratedRef)))}}],a&&Kt(t.prototype,a),h}();return Qt(h,"DecoratedComponent",t),Qt(h,"displayName","".concat(a,"(").concat(d,")")),$t(h,t)}function en(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function tn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var nn=["canDrag","beginDrag","isDragging","endDrag"],on=["beginDrag"],rn=function(){function e(t,n,o){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),tn(this,"props",null),tn(this,"spec",void 0),tn(this,"monitor",void 0),tn(this,"ref",void 0),tn(this,"beginDrag",(function(){if(r.props)return r.spec.beginDrag(r.props,r.monitor,r.ref.current)})),this.spec=t,this.monitor=n,this.ref=o}var t,n;return t=e,(n=[{key:"receiveProps",value:function(e){this.props=e}},{key:"canDrag",value:function(){return!!this.props&&(!this.spec.canDrag||this.spec.canDrag(this.props,this.monitor))}},{key:"isDragging",value:function(e,t){return!!this.props&&(this.spec.isDragging?this.spec.isDragging(this.props,this.monitor):t===e.getSourceId())}},{key:"endDrag",value:function(){this.props&&this.spec.endDrag&&this.spec.endDrag(this.props,this.monitor,Je(this.ref))}}])&&en(t.prototype,n),e}();function an(e){return Object.keys(e).forEach((function(t){Se(nn.indexOf(t)>-1,'Expected the drag source specification to only have some of the following keys: %s. Instead received a specification with an unexpected "%s" key. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source',nn.join(", "),t),Se("function"==typeof e[t],"Expected %s in the drag source specification to be a function. Instead received a specification with %s: %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source",t,t,e[t])})),on.forEach((function(t){Se("function"==typeof e[t],"Expected %s in the drag source specification to be a function. Instead received a specification with %s: %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source",t,t,e[t])})),function(t,n){return new rn(e,t,n)}}function sn(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function cn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ln=["canDrop","hover","drop"],un=function(){function e(t,n,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),cn(this,"props",null),cn(this,"spec",void 0),cn(this,"monitor",void 0),cn(this,"ref",void 0),this.spec=t,this.monitor=n,this.ref=o}var t,n;return t=e,(n=[{key:"receiveProps",value:function(e){this.props=e}},{key:"receiveMonitor",value:function(e){this.monitor=e}},{key:"canDrop",value:function(){return!this.spec.canDrop||this.spec.canDrop(this.props,this.monitor)}},{key:"hover",value:function(){this.spec.hover&&this.props&&this.spec.hover(this.props,this.monitor,Je(this.ref))}},{key:"drop",value:function(){if(this.spec.drop)return this.spec.drop(this.props,this.monitor,this.ref.current)}}])&&sn(t.prototype,n),e}();function pn(e){return Object.keys(e).forEach((function(t){Se(ln.indexOf(t)>-1,'Expected the drop target specification to only have some of the following keys: %s. Instead received a specification with an unexpected "%s" key. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target',ln.join(", "),t),Se("function"==typeof e[t],"Expected %s in the drop target specification to be a function. Instead received a specification with %s: %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target",t,t,e[t])})),function(t,n){return new un(e,t,n)}}function dn(e,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=e;"function"!=typeof e&&(Se(Ze(e,!0),'Expected "type" provided as the first argument to DropTarget to be a string, an array of strings, or a function that returns either given the current props. Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target',e),r=function(){return e}),Se(Qe(t),'Expected "spec" provided as the second argument to DropTarget to be a plain object. Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target',t);var i=pn(t);return Se("function"==typeof n,'Expected "collect" provided as the third argument to DropTarget to be a function that returns a plain object of props to inject. Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target',n),Se(Qe(o),'Expected "options" provided as the fourth argument to DropTarget to be a plain object when specified. Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target',n),function(e){return Zt({containerDisplayName:"DropTarget",createHandler:i,registerHandler:Ve,createMonitor:function(e){return new Ie(e)},createConnector:function(e){return new We(e)},DecoratedComponent:e,getType:r,collect:n,options:o})}}const hn=n,gn=o,{withStyles:fn}=r,mn=i,yn=e,{uid:bn}=h,{PlaceHolder:vn}=h,Cn=yn("@pie-element:categorize:configure"),Sn=fn((e=>({helper:{display:"flex",alignItems:"center",fontSize:e.typography.fontSize-2,color:`rgba(${e.palette.common.black}, 0.4)`,width:"100%",height:"100%"}})))((({classes:e})=>hn.createElement("div",{className:e.helper},"Drag your correct answers here"))),wn=({alternateResponseIndex:e,category:t,choices:n,onDeleteChoice:o})=>hn.createElement(hn.Fragment,null,n.map(((n,r)=>n&&hn.createElement(le,{alternateResponseIndex:e,category:t,choice:n,key:r,choiceIndex:r,onDelete:e=>o(e,r)}))));wn.propTypes={alternateResponseIndex:gn.number,category:gn.object,choices:gn.array,onDeleteChoice:gn.func};class xn extends hn.Component{static __initStatic(){this.propTypes={alternateResponseIndex:gn.number,category:gn.object,classes:gn.object.isRequired,className:gn.string,connectDropTarget:gn.func.isRequired,choices:gn.array,onDropChoice:gn.func.isRequired,onMoveChoice:gn.func,isOver:gn.bool,onDeleteChoice:gn.func,categoryId:gn.string.isRequired}}static __initStatic2(){this.defaultProps={}}render(){const{alternateResponseIndex:e,isOver:t,category:n,choices:o,classes:r,className:i,connectDropTarget:a,onDeleteChoice:s}=this.props;return a(hn.createElement("div",{className:mn(r.droppablePlaceholder,i)},hn.createElement(vn,{isOver:t,className:r.placeHolder},0===(o||[]).length?hn.createElement(Sn,null):hn.createElement(wn,{alternateResponseIndex:e,category:n,choices:o,onDeleteChoice:s}))))}}xn.__initStatic(),xn.__initStatic2();const kn=fn((()=>({droppablePlaceholder:{minHeight:"100px"},placeHolder:{width:"100%",minHeight:"100px",height:"auto"}})))(xn),On=dn((({uid:e})=>e),{drop:(e,t)=>{Cn("[drop] props: ",e);const n=t.getItem();n.from&&n.alternateResponseIndex===e.alternateResponseIndex?e.onMoveChoice(n.choiceId,n.from,e.categoryId,n.choiceIndex,n.alternateResponseIndex):n.from||e.onDropChoice(n,e.categoryId)},canDrop:e=>!e.disabled},((e,t)=>({connectDropTarget:e.dropTarget(),isOver:t.isOver()})))(kn);var Rn=bn.withUid(On);const _n=n,Pn=o,{withStyles:En}=r,In=i,{Card:Dn}=a,{CardActions:jn}=a;class Tn extends _n.Component{constructor(...e){super(...e),Tn.prototype.__init.call(this)}static __initStatic(){this.propTypes={alternateResponseIndex:Pn.number,classes:Pn.object.isRequired,className:Pn.string,category:Pn.object.isRequired,configuration:Pn.object.isRequired,defaultImageMaxHeight:Pn.number,defaultImageMaxWidth:Pn.number,deleteFocusedEl:Pn.func,focusedEl:Pn.number,index:Pn.number,error:Pn.string,isDuplicated:Pn.bool,maxImageWidth:Pn.object,maxImageHeight:Pn.object,onChange:Pn.func,onDelete:Pn.func,onDeleteChoice:Pn.func,onAddChoice:Pn.func,onMoveChoice:Pn.func,imageSupport:Pn.shape({add:Pn.func.isRequired,delete:Pn.func.isRequired}),toolbarOpts:Pn.object,spellCheck:Pn.bool,uploadSoundSupport:Pn.shape({add:Pn.func.isRequired,delete:Pn.func.isRequired})}}static __initStatic2(){this.defaultProps={}}__init(){this.changeLabel=e=>{const{category:t,onChange:n}=this.props;t.label=e,n(t)}}render(){const{alternateResponseIndex:e,category:t,classes:n,className:o,configuration:r,deleteFocusedEl:i,focusedEl:a,index:s,error:c,isDuplicated:l,onDelete:u,onDeleteChoice:p,onAddChoice:d,onMoveChoice:h,imageSupport:g,spellCheck:f,toolbarOpts:m,maxImageWidth:y,maxImageHeight:b,uploadSoundSupport:v,mathMlOptions:C={}}=this.props,S=!!e||0===e;return _n.createElement(Dn,{className:In(n.category,o,{[n.duplicateError]:l})},_n.createElement("span",null,S?_n.createElement("div",{className:n.categoryHeader,dangerouslySetInnerHTML:{__html:t.label}}):_n.createElement(U,{label:t.label,focusedEl:a,deleteFocusedEl:i,index:s,disabled:!!e||0===e,error:c,onChange:this.changeLabel,onDelete:u,imageSupport:g,toolbarOpts:m,spellCheck:f,maxImageWidth:y,maxImageHeight:b,uploadSoundSupport:v,mathMlOptions:C,configuration:r}),c&&_n.createElement("div",{className:n.errorText},c)),_n.createElement(Rn,{className:n.placeHolder,alternateResponseIndex:e,category:t,choices:t.choices,onDeleteChoice:p,onDropChoice:d,onMoveChoice:h,categoryId:t.id}),u&&_n.createElement(jn,{className:n.actions},_n.createElement(X,{label:"delete",onClick:u})))}}Tn.__initStatic(),Tn.__initStatic2();var Nn=En((e=>({placeHolder:{minHeight:"100px"},deleteButton:{margin:0},actions:{padding:0,paddingBottom:0,paddingTop:e.spacing.unit},iconButtonRoot:{width:"auto",height:"auto"},header:{display:"flex",justifyContent:"space-between"},category:{minWidth:"196px",padding:e.spacing.unit,overflow:"visible"},categoryHeader:{padding:2*e.spacing.unit,"& p":{margin:0}},duplicateError:{border:"1px solid red"},errorText:{fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingBottom:e.spacing.unit},editor:{flex:"1",paddingBottom:2*e.spacing.unit}})))(Tn);const Mn=n,An=o,{Tooltip:Ln}=a,{Typography:Hn}=a,{withStyles:Fn}=r,qn=i;class Bn extends Mn.Component{static __initStatic(){this.propTypes={classes:An.object.isRequired,className:An.string,buttonLabel:An.string,onAdd:An.func.isRequired,label:An.string.isRequired,info:An.any,buttonDisabled:An.bool,variant:An.string,tooltip:An.string}}static __initStatic2(){this.defaultProps={}}render(){const{classes:e,className:t,onAdd:n,label:o,buttonLabel:r,info:i,buttonDisabled:a,variant:s,tooltip:c}=this.props;return Mn.createElement("div",{className:qn(e.header,t)},Mn.createElement("div",{className:e.titleContainer},Mn.createElement(Hn,{variant:s||"title",className:e.title},o),i),Mn.createElement(Ln,{title:c||"",classes:{tooltip:e.tooltip},enterTouchDelay:50,leaveTouchDelay:3e3},Mn.createElement("span",null,Mn.createElement(G,{onClick:n,label:r,disabled:a}))))}}Bn.__initStatic(),Bn.__initStatic2();var $n=Fn((e=>({header:{display:"flex",justifyContent:"space-between",marginBottom:e.spacing.unit},titleContainer:{display:"flex",alignItems:"center"},tooltip:{fontSize:e.typography.fontSize-2,whiteSpace:"pre",maxWidth:"500px"}})))(Bn);function Un(e){let t,n=e[0],o=1;for(;o<e.length;){const r=e[o],i=e[o+1];if(o+=2,("optionalAccess"===r||"optionalCall"===r)&&null==n)return;"access"===r||"optionalAccess"===r?(t=n,n=i(n)):"call"!==r&&"optionalCall"!==r||(n=i(((...e)=>n.call(t,...e))),t=void 0)}return n}const zn="Set Per Choice",Wn=e=>{const{correctResponse:t=[]}=e||{};return t.reduce(((e,t)=>{const n=Un([t,"optionalAccess",e=>e.choices,"optionalAccess",e=>e.length])||0,o=Un([t,"optionalAccess",e=>e.alternateResponses])||[],r=Math.max(n,(o||[]).reduce(((e,t)=>Math.max(e,t.length)),0));return r>e?r:e}),0)},Vn=n,{withStyles:Kn}=r,{InputContainer:Yn}=c,Jn=d;function Gn(e){let t,n=e[0],o=1;for(;o<e.length;){const r=e[o],i=e[o+1];if(o+=2,("optionalAccess"===r||"optionalCall"===r)&&null==n)return;"access"===r||"optionalAccess"===r?(t=n,n=i(n)):"call"!==r&&"optionalCall"!==r||(n=i(((...e)=>n.call(t,...e))),t=void 0)}return n}const Xn=Kn((e=>({rowLabel:{gridColumn:"1/3"},rowLabelHolder:{paddingTop:2*e.spacing.unit,width:"100%"}})))((({categoriesPerRow:e,classes:t,configuration:n,disabled:o,markup:r,imageSupport:i,onChange:a,toolbarOpts:s,spellCheck:c,maxImageWidth:l,maxImageHeight:u,uploadSoundSupport:p,mathMlOptions:d={}})=>{const{rowLabels:h,baseInputConfiguration:g}=n;return Vn.createElement("div",{style:{gridColumn:`1/${e+1}`,width:"100%"}},Vn.createElement(Yn,{label:"Row Label",className:t.rowLabelHolder},Vn.createElement(Jn,{disabled:o,markup:r,onChange:a,imageSupport:i,nonEmpty:!1,toolbarOpts:s,pluginProps:O(Gn([h,"optionalAccess",e=>e.inputConfiguration]),g),spellCheck:c,maxImageWidth:l,maxImageHeight:u,uploadSoundSupport:p,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:d})))})),Qn=n,Zn=l,eo=o,{withStyles:to}=r,no=i,{Info:oo}=s,{Tooltip:ro}=a,{choiceUtils:io}=p,{renderMath:ao}=u;class so extends Qn.Component{constructor(...e){super(...e),so.prototype.__init.call(this),so.prototype.__init2.call(this),so.prototype.__init3.call(this),so.prototype.__init4.call(this),so.prototype.__init5.call(this),so.prototype.__init6.call(this),so.prototype.__init7.call(this),so.prototype.__init8.call(this),so.prototype.__init9.call(this)}static __initStatic(){this.propTypes={defaultImageMaxHeight:eo.number,defaultImageMaxWidth:eo.number,imageSupport:eo.shape({add:eo.func.isRequired,delete:eo.func.isRequired}),uploadSoundSupport:eo.shape({add:eo.func.isRequired,delete:eo.func.isRequired}),classes:eo.object.isRequired,className:eo.string,categories:eo.array,onModelChanged:eo.func,model:eo.object.isRequired,configuration:eo.object.isRequired,toolbarOpts:eo.object,spellCheck:eo.bool}}__init(){this.state={focusedEl:null}}componentDidMount(){try{const e=Zn.findDOMNode(this);ao(e)}catch(e){console.error("DOM not mounted")}}componentDidUpdate(){try{const e=Zn.findDOMNode(this);ao(e)}catch(e){console.error("DOM not mounted")}}__init2(){this.add=()=>{const{model:e,categories:t}=this.props,{categoriesPerRow:n,correctResponse:o,allowAlternateEnabled:r}=e,i=io.firstAvailableIndex(e.categories.map((e=>e.id)),1),a={id:i,label:"Category "+i},s=e.categories.length%n==0,c=[...e.rowLabels];s&&c.push(""),this.setState({focusedEl:t.length},(()=>{this.props.onModelChanged({rowLabels:c,categories:e.categories.concat([a]),correctResponse:r?[...o,{category:i,choices:[],alternateResponses:[]}]:o})}))}}__init3(){this.deleteFocusedEl=()=>{this.setState({focusedEl:null})}}__init4(){this.delete=e=>{const{model:t,onModelChanged:n}=this.props,o=t.categories.findIndex((t=>t.id===e.id));var r;-1!==o&&(t.categories.splice(o,1),t.correctResponse=(r=e.id,t.correctResponse.filter((e=>e.category!==r))),n(t))}}__init5(){this.change=e=>{const{categories:t}=this.props,n=t.findIndex((t=>t.id===e.id));-1!==n&&(t.splice(n,1,e),this.props.onModelChanged({categories:t}))}}__init6(){this.addChoiceToCategory=(e,t)=>{const{model:n,onModelChanged:o}=this.props;let{choices:r=[],correctResponse:i=[],maxChoicesPerCategory:a=0}=n||{};const s=(r||[]).find((t=>t.id===e.id));i=M(e.id,void 0,t,0,n.correctResponse),0!==s.categoryCount&&(i=T(e,t,i));const c=Wn(n);o({correctResponse:i,maxChoicesPerCategory:0!==a&&a<c?a+1:a})}}__init7(){this.deleteChoiceFromCategory=(e,t,n)=>{const{model:o,onModelChanged:r}=this.props;r({correctResponse:N(t.id,e.id,n,o.correctResponse)})}}__init8(){this.moveChoice=(e,t,n,o)=>{const{model:r,onModelChanged:i}=this.props;let{choices:a,correctResponse:s=[],maxChoicesPerCategory:c=0}=r||{};const l=(a||[]).find((t=>t.id===e));if(n===t||!l)return;0!==l.categoryCount?(s=M(l.id,t,n,o,s),s=T(l,n,s)):0===l.categoryCount&&(s=M(l.id,void 0,n,0,s));const u=Wn(r);i({correctResponse:s,maxChoicesPerCategory:0!==c&&c<u?c+1:c})}}__init9(){this.changeRowLabel=(e,t)=>{const{model:n}=this.props,{rowLabels:o}=n,r=[...o];r.length<t?r.push(e):r[t]=e,this.props.onModelChanged({rowLabels:r})}}render(){const{model:e,classes:t,className:n,categories:o,imageSupport:r,uploadSoundSupport:i,toolbarOpts:a,spellCheck:s,configuration:c,defaultImageMaxHeight:l,defaultImageMaxWidth:u,mathMlOptions:p={}}=this.props,{categoriesPerRow:d,rowLabels:h,errors:g}=e,{associationError:f,categoriesError:m,categoriesErrors:y}=g||{},{maxCategories:b,maxImageWidth:v={},maxImageHeight:C={}}=c||{},S={gridTemplateColumns:`repeat(${d}, 1fr)`},w=(e=>{let{minChoices:t,maxChoices:n,maxCategories:o}=e||{};return t=t||1,"Validation requirements:\nThe choices content should not be empty and should be unique.\nThere should be at least 1 "+(o?`and at most ${o} `:"")+"category"+(o?"s":"")+" defined."+(t?`\nThere should be at least ${t} choices defined.`:"")+(n?`\nNo more than ${n} choices should be defined.`:"")+"\nAt least one token should be assigned to at least one category."})(c);return Qn.createElement("div",{className:no(t.categories,n)},Qn.createElement($n,{label:"Categories",buttonLabel:"ADD A CATEGORY",onAdd:this.add,info:Qn.createElement(ro,{classes:{tooltip:t.tooltip},disableFocusListener:!0,disableTouchListener:!0,placement:"right",title:w},Qn.createElement(oo,{fontSize:"small",color:"primary",style:{marginLeft:"5px"}})),buttonDisabled:b&&o&&b===o.length}),Qn.createElement("div",{className:t.categoriesHolder,style:S},o.map(((e,t)=>{const n=t%d==0,o=t/d;return Qn.createElement(Qn.Fragment,{key:t},n&&Qn.createElement(Xn,{categoriesPerRow:d,disabled:!1,rowIndex:o,markup:h[o]||"",onChange:e=>this.changeRowLabel(e,o),imageSupport:r,toolbarOpts:a,spellCheck:s,maxImageWidth:v&&v.rowLabel||u,maxImageHeight:C&&C.rowLabel||l,uploadSoundSupport:i,mathMlOptions:p,configuration:c}),Qn.createElement(Nn,{imageSupport:r,focusedEl:this.state.focusedEl,deleteFocusedEl:this.deleteFocusedEl,index:t,category:e,error:y&&y[e.id],onChange:this.change,onDelete:()=>this.delete(e),onAddChoice:this.addChoiceToCategory,onMoveChoice:(e,t,n,o)=>this.moveChoice(e,t,n,o),toolbarOpts:a,spellCheck:s,onDeleteChoice:(t,n)=>this.deleteChoiceFromCategory(e,t,n),maxImageWidth:v&&v.categoryLabel||u,maxImageHeight:C&&C.categoryLabel||l,uploadSoundSupport:i,configuration:c}))}))),f&&Qn.createElement("div",{className:t.errorText},f),m&&Qn.createElement("div",{className:t.errorText},m))}}so.__initStatic();var co=to((e=>({categories:{marginBottom:3*e.spacing.unit},categoriesHolder:{display:"grid",gridRowGap:`${e.spacing.unit}px`,gridColumnGap:`${e.spacing.unit}px`},row:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gridColumnGap:`${e.spacing.unit}px`,alignItems:"baseline",width:"100%",marginTop:e.spacing.unit,marginBottom:2*e.spacing.unit},rowLabel:{gridColumn:"1/3"},rowLabelHolder:{width:"100%"},tooltip:{fontSize:e.typography.fontSize-2,whiteSpace:"pre",maxWidth:"500px"},errorText:{fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing.unit/2}})))(so);const lo=n,uo=o,{withStyles:po}=r,ho=i;class go extends lo.Component{constructor(...e){super(...e),go.prototype.__init.call(this),go.prototype.__init2.call(this),go.prototype.__init3.call(this)}static __initStatic(){this.propTypes={altIndex:uo.number.isRequired,configuration:uo.object,imageSupport:uo.shape({add:uo.func.isRequired,delete:uo.func.isRequired}),classes:uo.object.isRequired,className:uo.string,categories:uo.array,onModelChanged:uo.func,model:uo.object.isRequired,uploadSoundSupport:uo.shape({add:uo.func.isRequired,delete:uo.func.isRequired}),spellCheck:uo.bool}}__init(){this.addChoiceToCategory=(e,t)=>{const{altIndex:n,model:{correctResponse:o,choices:r,maxChoicesPerCategory:i=0},onModelChanged:a}=this.props,s=r.find((t=>t.id===e.id));o.forEach((o=>o.category===t?(o.alternateResponses=o.alternateResponses||[],o.alternateResponses[n]||(o.alternateResponses[n]=[]),o.alternateResponses[n].push(e.id),s.categoryCount&&0!==s.categoryCount&&(o.alternateResponses[n]=o.alternateResponses[n].reduce(((e,t)=>{if(t===s.id){-1===e.findIndex((e=>e===s.id))&&e.push(t)}else e.push(t);return e}),[])),o):o.alternateResponses[n]&&0!==s.categoryCount?(o.alternateResponses[n]=o.alternateResponses[n].filter((t=>t!==e.id)),o):o));const c=Wn(this.props.model);a({correctResponse:o,maxChoicesPerCategory:0!==i&&i<c?i+1:i})}}__init2(){this.moveChoice=(e,t,n,o,r)=>{const{model:i,onModelChanged:a}=this.props;let{choices:s,correctResponse:c=[],maxChoicesPerCategory:l=0}=i||{};const u=(s||[]).find((t=>t.id===e));c=((e,t,n,o,r,i,a)=>(I("[moveChoiceToAlternate] choice: ",e,"from: ",t,"to: ",n,"answers: ",r,"chocieIndex: ",o),t===n?r:r.map((o=>(o.category===n&&(0!==a&&o.alternateResponses&&(o.alternateResponses[i]=(o.alternateResponses[i]||[]).filter((t=>t!==e))),o.alternateResponses||(o.alternateResponses=[],o.alternateResponses[i]=[]),o.alternateResponses[i].push(e)),o.category===t&&0!==a&&o.alternateResponses&&o.alternateResponses[i]&&(o.alternateResponses[i]=o.alternateResponses[i].filter((t=>t!==e))),o)))))(e,t,n,o,c,r,function(e){let t,n=e[0],o=1;for(;o<e.length;){const r=e[o],i=e[o+1];if(o+=2,("optionalAccess"===r||"optionalCall"===r)&&null==n)return;"access"===r||"optionalAccess"===r?(t=n,n=i(n)):"call"!==r&&"optionalCall"!==r||(n=i(((...e)=>n.call(t,...e))),t=void 0)}return n}([u,"optionalAccess",e=>e.categoryCount]));const p=Wn(this.props.model);a({correctResponse:c,maxChoicesPerCategory:0!==l&&l<p?l+1:l})}}__init3(){this.deleteChoiceFromCategory=(e,t,n)=>{const{model:o,altIndex:r,onModelChanged:i}=this.props,a=((e,t,n,o,r)=>(r||[]).map((e=>{if(E([e,"optionalAccess",e=>e.category])===t){const t=(E([e,"optionalAccess",e=>e.alternateResponses])||[]).map(((e,t)=>t===o?((e||[]).splice(n,1),e):e));return{...e,alternateResponses:t}}return e})))(t.id,e.id,n,r,o.correctResponse);i({correctResponse:a})}}render(){const{altIndex:e,model:t,configuration:n,classes:o,className:r,categories:i,imageSupport:a,spellCheck:s,uploadSoundSupport:c,mathMlOptions:l={}}=this.props,{categoriesPerRow:u,errors:p,rowLabels:d}=t,{duplicateAlternate:h}=p||{},g={gridTemplateColumns:`repeat(${u}, 1fr)`},f=!!h&&h.index===e;return lo.createElement("div",{className:ho(o.categories,r)},lo.createElement("div",{className:o.categoriesHolder,style:g},i.map(((t,r)=>{const i=r%u==0,p=r/u;return lo.createElement(lo.Fragment,{key:r},i&&lo.createElement("div",{style:{gridColumn:`1/${u+1}`,width:"100%"},className:o.rowLabel,dangerouslySetInnerHTML:{__html:d[p]||""}}),lo.createElement(Nn,{key:r,alternateResponseIndex:e,imageSupport:a,isDuplicated:f&&h.category===t.id,category:t,spellCheck:s,onAddChoice:this.addChoiceToCategory,onDeleteChoice:(e,n)=>this.deleteChoiceFromCategory(t,e,n),onMoveChoice:(e,t,n,o,r)=>this.moveChoice(e,t,n,o,r),uploadSoundSupport:c,mathMlOptions:l,configuration:n}))}))))}}go.__initStatic();var fo=po((e=>({categories:{marginBottom:2.5*e.spacing.unit},categoriesHolder:{display:"grid",gridRowGap:`${e.spacing.unit}px`,gridColumnGap:`${e.spacing.unit}px`},row:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gridColumnGap:`${e.spacing.unit}px`,alignItems:"baseline",width:"100%",marginTop:e.spacing.unit,marginBottom:2*e.spacing.unit},rowLabel:{gridColumn:"1/3"}})))(go);const mo=n,yo=o,{withStyles:bo}=r,vo=i,{Card:Co}=a,{CardActions:So}=a,{DragHandle:wo}=s,xo=e,{flow:ko}=t,{Checkbox:Oo}=p,{uid:Ro}=h,_o=xo("@pie-element:categorize:configure:choice"),Po=e=>{if(e.lockChoiceOrder)return!0;const t=e.choice.categoryCount||0;return 0===t||e.correctResponseCount<t};class Eo extends mo.Component{constructor(...e){super(...e),Eo.prototype.__init.call(this),Eo.prototype.__init2.call(this),Eo.prototype.__init3.call(this)}static __initStatic(){this.propTypes={allowMultiplePlacements:yo.string,classes:yo.object.isRequired,className:yo.string,configuration:yo.object.isRequired,choice:yo.object.isRequired,connectDropTarget:yo.func,deleteFocusedEl:yo.func,focusedEl:yo.number,index:yo.number,lockChoiceOrder:yo.bool,maxImageHeight:yo.object,maxImageWidth:yo.object,onChange:yo.func.isRequired,onDelete:yo.func.isRequired,connectDragSource:yo.func.isRequired,connectDragPreview:yo.func.isRequired,correctResponseCount:yo.number.isRequired,imageSupport:yo.shape({add:yo.func.isRequired,delete:yo.func.isRequired}),toolbarOpts:yo.object,error:yo.string,uploadSoundSupport:yo.shape({add:yo.func.isRequired,delete:yo.func.isRequired}),spellCheck:yo.bool}}static __initStatic2(){this.defaultProps={}}__init(){this.changeContent=e=>{const{onChange:t,choice:n}=this.props;n.content=e,t(n)}}__init2(){this.changeCategoryCount=()=>{const{onChange:e,choice:t}=this.props;1===t.categoryCount?t.categoryCount=0:t.categoryCount=1,e(t)}}__init3(){this.isCheckboxShown=e=>e===zn}render(){const{allowMultiplePlacements:e,classes:t,className:n,configuration:o,choice:r,deleteFocusedEl:i,focusedEl:a,index:s,onDelete:c,connectDropTarget:l,connectDragSource:u,connectDragPreview:p,imageSupport:d,spellCheck:h,toolbarOpts:g,error:f,maxImageWidth:m,maxImageHeight:y,uploadSoundSupport:b}=this.props,v=this.isCheckboxShown(e),C=Po(this.props);return mo.createElement(Co,{className:vo(t.choice,n)},mo.createElement(So,{className:t.actions},u(l(mo.createElement("span",{className:vo(t.dragHandle,!1===C&&t.dragDisabled)},mo.createElement(wo,{color:C?"primary":"disabled"}))))),p(mo.createElement("span",null,mo.createElement(U,{imageSupport:d,focusedEl:a,deleteFocusedEl:i,index:s,label:r.content,onChange:this.changeContent,onDelete:c,toolbarOpts:g,spellCheck:h,error:f,maxImageWidth:m,maxImageHeight:y,uploadSoundSupport:b,configuration:o}),f&&mo.createElement("div",{className:t.errorText},f))),mo.createElement(So,{className:t.actions},mo.createElement(X,{label:"delete",onClick:c}),v&&mo.createElement(Oo,{mini:!0,label:"Remove after placing",checked:1===r.categoryCount,onChange:this.changeCategoryCount})))}}Eo.__initStatic(),Eo.__initStatic2();const Io=bo((e=>({actions:{padding:0,justifyContent:"space-between"},choice:{minWidth:"196px",padding:e.spacing.unit,overflow:"visible"},dragHandle:{cursor:"move"},dragDisabled:{cursor:"inherit"},errorText:{fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingBottom:e.spacing.unit}})))(Eo),Do={canDrag:Po,beginDrag:e=>{const t={id:e.choice.id,index:e.index};return _o("[beginDrag] out:",t),t},endDrag:(e,t)=>{if(!t.didDrop()){const n=t.getItem();n.categoryId&&(_o("wasnt droppped - what to do?"),e.onRemoveChoice(n))}}},jo={drop:(e,t)=>{_o("[drop] props: ",e);const n=t.getItem();e.rearrangeChoices(n.index,e.index)},canDrop:(e,t)=>{const n=t.getItem();return e.choice.id!==n.id}};var To=Ro.withUid(ko(function(e,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=e;"function"!=typeof e&&(Se(Ze(e),'Expected "type" provided as the first argument to DragSource to be a string, or a function that returns a string given the current props. Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source',e),r=function(){return e}),Se(Qe(t),'Expected "spec" provided as the second argument to DragSource to be a plain object. Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source',t);var i=an(t);return Se("function"==typeof n,'Expected "collect" provided as the third argument to DragSource to be a function that returns a plain object of props to inject. Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source',n),Se(Qe(o),'Expected "options" provided as the fourth argument to DragSource to be a plain object when specified. Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source',n),function(e){return Zt({containerDisplayName:"DragSource",createHandler:i,registerHandler:Ke,createConnector:function(e){return new $e(e)},createMonitor:function(e){return new Re(e)},DecoratedComponent:e,getType:r,collect:n,options:o})}}((({uid:e})=>e),Do,((e,t)=>({connectDragSource:e.dragSource(),connectDragPreview:e.dragPreview(),isDragging:t.isDragging()}))),dn((({uid:e})=>e),jo,((e,t)=>({connectDropTarget:e.dropTarget(),isOver:t.isOver()}))))(Io));const No=n,Mo=o,{withStyles:Ao}=r,Lo=i,{TextField:Ho}=a;class Fo extends No.Component{constructor(...e){super(...e),Fo.prototype.__init.call(this)}static __initStatic(){this.propTypes={classes:Mo.object.isRequired,className:Mo.string,config:Mo.object,onModelChanged:Mo.func,spellCheck:Mo.bool}}static __initStatic2(){this.defaultProps={}}__init(){this.changeLabel=({target:e})=>{this.props.onModelChanged({choicesLabel:e.value})}}render(){const{classes:e,className:t,config:n,spellCheck:o}=this.props;return No.createElement("div",{className:Lo(e.config,t)},No.createElement(Ho,{className:e.label,InputLabelProps:{shrink:!0},variant:"outlined",label:"Label",value:n.choicesLabel,onChange:this.changeLabel,spellCheck:o}))}}Fo.__initStatic(),Fo.__initStatic2();var qo=Ao((e=>({config:{paddingTop:e.spacing.unit,marginBottom:e.spacing.unit},label:{width:"100%"}})))(Fo);const Bo=n,$o=o,{withStyles:Uo}=r,zo=i,{choiceUtils:Wo}=p;function Vo(e){let t,n=e[0],o=1;for(;o<e.length;){const r=e[o],i=e[o+1];if(o+=2,("optionalAccess"===r||"optionalCall"===r)&&null==n)return;"access"===r||"optionalAccess"===r?(t=n,n=i(n)):"call"!==r&&"optionalCall"!==r||(n=i(((...e)=>n.call(t,...e))),t=void 0)}return n}class Ko extends Bo.Component{constructor(...e){super(...e),Ko.prototype.__init.call(this),Ko.prototype.__init2.call(this),Ko.prototype.__init3.call(this),Ko.prototype.__init4.call(this),Ko.prototype.__init5.call(this),Ko.prototype.__init6.call(this),Ko.prototype.__init7.call(this)}static __initStatic(){this.propTypes={model:$o.object.isRequired,configuration:$o.object.isRequired,classes:$o.object.isRequired,className:$o.string,choices:$o.array.isRequired,defaultImageMaxWidth:$o.number,defaultImageMaxHeight:$o.number,onModelChanged:$o.func.isRequired,imageSupport:$o.shape({add:$o.func.isRequired,delete:$o.func.isRequired}),uploadSoundSupport:$o.shape({add:$o.func.isRequired,delete:$o.func.isRequired}),toolbarOpts:$o.object,spellCheck:$o.bool}}static __initStatic2(){this.defaultProps={}}__init(){this.state={focusedEl:null}}__init2(){this.changeChoice=e=>{const{choices:t,onModelChanged:n}=this.props,o=t.findIndex((t=>t.id===e.id));-1!==o&&(t.splice(o,1,e),n({choices:t}))}}__init3(){this.allChoicesHaveCount=e=>{const{choices:t}=this.props;return Array.isArray(t)&&t.every((t=>t.categoryCount===e))}}__init4(){this.addChoice=()=>{const{onModelChanged:e,model:t,choices:n}=this.props;let{maxAnswerChoices:o}=t||{};if(o&&Vo([t,"access",e=>e.choices,"optionalAccess",e=>e.length])>=o)return;const r=Wo.firstAvailableIndex(t.choices.map((e=>e.id)),1),i={id:r,content:"Choice "+r};this.setState({focusedEl:n.length},(()=>{e({choices:t.choices.concat([i])})}))}}__init5(){this.deleteFocusedEl=()=>{this.setState({focusedEl:null})}}__init6(){this.deleteChoice=e=>{const{model:t,onModelChanged:n}=this.props,o=t.choices.findIndex((t=>t.id===e.id));var r;-1!==o&&(t.choices.splice(o,1),t.correctResponse=(r=e.id,t.correctResponse.map((e=>{{const t=_(e.choices);return P(t,(e=>e===r)),{...e,choices:t}}}))),n(t))}}__init7(){this.rearrangeChoices=(e,t)=>{const{model:n,onModelChanged:o}=this.props||{};let{choices:r}=n||[];r=((e,t,n)=>(0===e.length||e.splice(t,1,e.splice(n,1,e[t])[0]),e))(r,e,t),o({choices:r})}}render(){const{focusedEl:e}=this.state,{classes:t,className:n,choices:o,model:r,imageSupport:i,uploadSoundSupport:a,onModelChanged:s,spellCheck:c,toolbarOpts:l,configuration:u,defaultImageMaxWidth:p,defaultImageMaxHeight:d}=this.props,{errors:h,allowMultiplePlacementsEnabled:g,lockChoiceOrder:f,maxAnswerChoices:m}=r,{choicesError:y,choicesErrors:b}=h||{},{maxImageWidth:v={},maxImageHeight:C={}}=u||{},S={gridTemplateColumns:`repeat(${r.categoriesPerRow}, 1fr)`},w=m&&Vo([o,"optionalAccess",e=>e.length])>=m?`Only ${m} allowed maximum`:"";return Bo.createElement("div",{className:zo(t.choices,n)},Bo.createElement($n,{label:"Choices",buttonLabel:"ADD A CHOICE",onAdd:this.addChoice,buttonDisabled:m&&o&&Vo([o,"optionalAccess",e=>e.length])>=m,tooltip:w}),Bo.createElement(qo,{config:r,onModelChanged:s,spellCheck:c}),Bo.createElement("div",{className:t.choiceHolder,style:S},o.map(((t,n)=>Bo.createElement(To,{choice:t,focusedEl:e,deleteFocusedEl:this.deleteFocusedEl,correctResponseCount:t.correctResponseCount,allowMultiplePlacements:g,lockChoiceOrder:f,index:n,key:n,imageSupport:i,onChange:this.changeChoice,onDelete:()=>this.deleteChoice(t),rearrangeChoices:(e,t)=>this.rearrangeChoices(e,t),toolbarOpts:l,spellCheck:c,error:b&&b[t.id],maxImageWidth:v&&v.choice||p,maxImageHeight:C&&C.choice||d,uploadSoundSupport:a,configuration:u})))),y&&Bo.createElement("div",{className:t.errorText},y))}}Ko.__initStatic(),Ko.__initStatic2();var Yo=Uo((e=>({choiceHolder:{paddingTop:e.spacing.unit,paddingBottom:e.spacing.unit,display:"grid",gridRowGap:`${e.spacing.unit}px`,gridColumnGap:`${e.spacing.unit}px`},choices:{marginBottom:2.5*e.spacing.unit},errorText:{fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing.unit/2}})))(Ko);const{cloneDeep:Jo}=t,Go=(e,t,n)=>e.alternateResponses&&0!==e.alternateResponses.length?(e.alternateResponses[n]||[]).map((e=>t.find((t=>t.id===e)))):[];function Xo(e){return Xo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xo(e)}function Qo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Zo(e){var t=function(e,t){if("object"!==Xo(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t);if("object"!==Xo(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===Xo(t)?t:String(t)}function er(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,Zo(o.key),o)}}function tr(e,t,n){return t&&er(e.prototype,t),n&&er(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function nr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function or(e,t){return or=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},or(e,t)}function rr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&or(e,t)}function ir(e,t){if(t&&("object"===Xo(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return nr(e)}function ar(e){return ar=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ar(e)}function sr(e,t,n){return(t=Zo(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function lr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function ur(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?lr(Object(n),!0).forEach((function(t){sr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var pr={type:"logger",log:function(e){this.output("log",e)},warn:function(e){this.output("warn",e)},error:function(e){this.output("error",e)},output:function(e,t){console&&console[e]&&console[e].apply(console,t)}},dr=new(function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Qo(this,e),this.init(t,n)}return tr(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||pr,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,n,o){return o&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(n).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,ur(ur({},{prefix:"".concat(this.prefix,":").concat(t,":")}),this.options))}},{key:"clone",value:function(t){return(t=t||this.options).prefix=t.prefix||this.prefix,new e(this.logger,t)}}]),e}()),hr=function(){function e(){Qo(this,e),this.observers={}}return tr(e,[{key:"on",value:function(e,t){var n=this;return e.split(" ").forEach((function(e){n.observers[e]=n.observers[e]||[],n.observers[e].push(t)})),this}},{key:"off",value:function(e,t){this.observers[e]&&(t?this.observers[e]=this.observers[e].filter((function(e){return e!==t})):delete this.observers[e])}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];if(this.observers[e]){var r=[].concat(this.observers[e]);r.forEach((function(e){e.apply(void 0,n)}))}if(this.observers["*"]){var i=[].concat(this.observers["*"]);i.forEach((function(t){t.apply(t,[e].concat(n))}))}}}]),e}();function gr(){var e,t,n=new Promise((function(n,o){e=n,t=o}));return n.resolve=e,n.reject=t,n}function fr(e){return null==e?"":""+e}function mr(e,t,n){e.forEach((function(e){t[e]&&(n[e]=t[e])}))}function yr(e,t,n){function o(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}function r(){return!e||"string"==typeof e}for(var i="string"!=typeof t?[].concat(t):t.split(".");i.length>1;){if(r())return{};var a=o(i.shift());!e[a]&&n&&(e[a]=new n),e=Object.prototype.hasOwnProperty.call(e,a)?e[a]:{}}return r()?{}:{obj:e,k:o(i.shift())}}function br(e,t,n){var o=yr(e,t,Object);o.obj[o.k]=n}function vr(e,t){var n=yr(e,t),o=n.obj,r=n.k;if(o)return o[r]}function Cr(e,t,n){var o=vr(e,n);return void 0!==o?o:vr(t,n)}function Sr(e,t,n){for(var o in t)"__proto__"!==o&&"constructor"!==o&&(o in e?"string"==typeof e[o]||e[o]instanceof String||"string"==typeof t[o]||t[o]instanceof String?n&&(e[o]=t[o]):Sr(e[o],t[o],n):e[o]=t[o]);return e}function wr(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var xr={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function kr(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return xr[e]})):e}var Or="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,Rr=[" ",",","?","!",";"];function _r(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var o=t.split(n),r=e,i=0;i<o.length;++i){if(!r)return;if("string"==typeof r[o[i]]&&i+1<o.length)return;if(void 0===r[o[i]]){for(var a=2,s=o.slice(i,i+a).join(n),c=r[s];void 0===c&&o.length>i+a;)a++,c=r[s=o.slice(i,i+a).join(n)];if(void 0===c)return;if(null===c)return null;if(t.endsWith(s)){if("string"==typeof c)return c;if(s&&"string"==typeof c[s])return c[s]}var l=o.slice(i+a).join(n);return l?_r(c,l,n):void 0}r=r[o[i]]}return r}}function Pr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Er(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Pr(Object(n),!0).forEach((function(t){sr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Ir=function(e){rr(n,hr);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=ar(e);if(t){var r=ar(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return ir(this,n)}}(n);function n(e){var o,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return Qo(this,n),o=t.call(this),Or&&hr.call(nr(o)),o.data=e||{},o.options=r,void 0===o.options.keySeparator&&(o.options.keySeparator="."),void 0===o.options.ignoreJSONStructure&&(o.options.ignoreJSONStructure=!0),o}return tr(n,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator,i=void 0!==o.ignoreJSONStructure?o.ignoreJSONStructure:this.options.ignoreJSONStructure,a=[e,t];n&&"string"!=typeof n&&(a=a.concat(n)),n&&"string"==typeof n&&(a=a.concat(r?n.split(r):n)),e.indexOf(".")>-1&&(a=e.split("."));var s=vr(this.data,a);return s||!i||"string"!=typeof n?s:_r(this.data&&this.data[e]&&this.data[e][t],n,r)}},{key:"addResource",value:function(e,t,n,o){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},i=this.options.keySeparator;void 0===i&&(i=".");var a=[e,t];n&&(a=a.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(o=t,t=(a=e.split("."))[1]),this.addNamespaces(t),br(this.data,a,o),r.silent||this.emit("added",e,t,n,o)}},{key:"addResources",value:function(e,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var r in n)"string"!=typeof n[r]&&"[object Array]"!==Object.prototype.toString.apply(n[r])||this.addResource(e,t,r,n[r],{silent:!0});o.silent||this.emit("added",e,t,n)}},{key:"addResourceBundle",value:function(e,t,n,o,r){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},a=[e,t];e.indexOf(".")>-1&&(o=n,n=t,t=(a=e.split("."))[1]),this.addNamespaces(t);var s=vr(this.data,a)||{};o?Sr(s,n,r):s=Er(Er({},s),n),br(this.data,a,s),i.silent||this.emit("added",e,t,n)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?Er(Er({},{}),this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"hasLanguageSomeTranslations",value:function(e){var t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find((function(e){return t[e]&&Object.keys(t[e]).length>0}))}},{key:"toJSON",value:function(){return this.data}}]),n}(),Dr={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,n,o,r){var i=this;return e.forEach((function(e){i.processors[e]&&(t=i.processors[e].process(t,n,o,r))})),t}};function jr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Tr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?jr(Object(n),!0).forEach((function(t){sr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Nr={},Mr=function(e){rr(n,hr);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=ar(e);if(t){var r=ar(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return ir(this,n)}}(n);function n(e){var o,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Qo(this,n),o=t.call(this),Or&&hr.call(nr(o)),mr(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,nr(o)),o.options=r,void 0===o.options.keySeparator&&(o.options.keySeparator="."),o.logger=dr.create("translator"),o}return tr(n,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;var n=this.resolve(e,t);return n&&void 0!==n.res}},{key:"extractFromKey",value:function(e,t){var n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");var o=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,r=t.ns||this.options.defaultNS||[],i=n&&e.indexOf(n)>-1,a=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,n){t=t||"",n=n||"";var o=Rr.filter((function(e){return t.indexOf(e)<0&&n.indexOf(e)<0}));if(0===o.length)return!0;var r=new RegExp("(".concat(o.map((function(e){return"?"===e?"\\?":e})).join("|"),")")),i=!r.test(e);if(!i){var a=e.indexOf(n);a>0&&!r.test(e.substring(0,a))&&(i=!0)}return i}(e,n,o));if(i&&!a){var s=e.match(this.interpolator.nestingRegexp);if(s&&s.length>0)return{key:e,namespaces:r};var c=e.split(n);(n!==o||n===o&&this.options.ns.indexOf(c[0])>-1)&&(r=c.shift()),e=c.join(o)}return"string"==typeof r&&(r=[r]),{key:e,namespaces:r}}},{key:"translate",value:function(e,t,o){var r=this;if("object"!==Xo(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),"object"===Xo(t)&&(t=Tr({},t)),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var i=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,a=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,s=this.extractFromKey(e[e.length-1],t),c=s.key,l=s.namespaces,u=l[l.length-1],p=t.lng||this.language,d=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(p&&"cimode"===p.toLowerCase()){if(d){var h=t.nsSeparator||this.options.nsSeparator;return i?{res:"".concat(u).concat(h).concat(c),usedKey:c,exactUsedKey:c,usedLng:p,usedNS:u}:"".concat(u).concat(h).concat(c)}return i?{res:c,usedKey:c,exactUsedKey:c,usedLng:p,usedNS:u}:c}var g=this.resolve(e,t),f=g&&g.res,m=g&&g.usedKey||c,y=g&&g.exactUsedKey||c,b=Object.prototype.toString.apply(f),v=["[object Number]","[object Function]","[object RegExp]"],C=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,S=!this.i18nFormat||this.i18nFormat.handleAsObject,w="string"!=typeof f&&"boolean"!=typeof f&&"number"!=typeof f;if(S&&f&&w&&v.indexOf(b)<0&&("string"!=typeof C||"[object Array]"!==b)){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var x=this.options.returnedObjectHandler?this.options.returnedObjectHandler(m,f,Tr(Tr({},t),{},{ns:l})):"key '".concat(c," (").concat(this.language,")' returned an object instead of string.");return i?(g.res=x,g):x}if(a){var k="[object Array]"===b,O=k?[]:{},R=k?y:m;for(var _ in f)if(Object.prototype.hasOwnProperty.call(f,_)){var P="".concat(R).concat(a).concat(_);O[_]=this.translate(P,Tr(Tr({},t),{joinArrays:!1,ns:l})),O[_]===P&&(O[_]=f[_])}f=O}}else if(S&&"string"==typeof C&&"[object Array]"===b)(f=f.join(C))&&(f=this.extendTranslation(f,e,t,o));else{var E=!1,I=!1,D=void 0!==t.count&&"string"!=typeof t.count,j=n.hasDefaultValue(t),T=D?this.pluralResolver.getSuffix(p,t.count,t):"",N=t["defaultValue".concat(T)]||t.defaultValue;!this.isValidLookup(f)&&j&&(E=!0,f=N),this.isValidLookup(f)||(I=!0,f=c);var M=t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,A=M&&I?void 0:f,L=j&&N!==f&&this.options.updateMissing;if(I||E||L){if(this.logger.log(L?"updateKey":"missingKey",p,u,c,L?N:f),a){var H=this.resolve(c,Tr(Tr({},t),{},{keySeparator:!1}));H&&H.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var F=[],q=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&q&&q[0])for(var B=0;B<q.length;B++)F.push(q[B]);else"all"===this.options.saveMissingTo?F=this.languageUtils.toResolveHierarchy(t.lng||this.language):F.push(t.lng||this.language);var $=function(e,n,o){var i=j&&o!==f?o:A;r.options.missingKeyHandler?r.options.missingKeyHandler(e,u,n,i,L,t):r.backendConnector&&r.backendConnector.saveMissing&&r.backendConnector.saveMissing(e,u,n,i,L,t),r.emit("missingKey",e,u,n,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&D?F.forEach((function(e){r.pluralResolver.getSuffixes(e,t).forEach((function(n){$([e],c+n,t["defaultValue".concat(n)]||N)}))})):$(F,c,N))}f=this.extendTranslation(f,e,t,g,o),I&&f===c&&this.options.appendNamespaceToMissingKey&&(f="".concat(u,":").concat(c)),(I||E)&&this.options.parseMissingKeyHandler&&(f="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(u,":").concat(c):c,E?f:void 0):this.options.parseMissingKeyHandler(f))}return i?(g.res=f,g):f}},{key:"extendTranslation",value:function(e,t,n,o,r){var i=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,Tr(Tr({},this.options.interpolation.defaultVariables),n),o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init(Tr(Tr({},n),{interpolation:Tr(Tr({},this.options.interpolation),n.interpolation)}));var a,s="string"==typeof e&&(n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(s){var c=e.match(this.interpolator.nestingRegexp);a=c&&c.length}var l=n.replace&&"string"!=typeof n.replace?n.replace:n;if(this.options.interpolation.defaultVariables&&(l=Tr(Tr({},this.options.interpolation.defaultVariables),l)),e=this.interpolator.interpolate(e,l,n.lng||this.language,n),s){var u=e.match(this.interpolator.nestingRegexp);a<(u&&u.length)&&(n.nest=!1)}!n.lng&&"v1"!==this.options.compatibilityAPI&&o&&o.res&&(n.lng=o.usedLng),!1!==n.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,o=new Array(e),a=0;a<e;a++)o[a]=arguments[a];return r&&r[0]===o[0]&&!n.context?(i.logger.warn("It seems you are nesting recursively key: ".concat(o[0]," in key: ").concat(t[0])),null):i.translate.apply(i,o.concat([t]))}),n)),n.interpolation&&this.interpolator.reset()}var p=n.postProcess||this.options.postProcess,d="string"==typeof p?[p]:p;return null!=e&&d&&d.length&&!1!==n.applyPostProcessor&&(e=Dr.handle(d,e,t,this.options&&this.options.postProcessPassResolved?Tr({i18nResolved:o},n):n,this)),e}},{key:"resolve",value:function(e){var t,n,o,r,i,a=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach((function(e){if(!a.isValidLookup(t)){var c=a.extractFromKey(e,s),l=c.key;n=l;var u=c.namespaces;a.options.fallbackNS&&(u=u.concat(a.options.fallbackNS));var p=void 0!==s.count&&"string"!=typeof s.count,d=p&&!s.ordinal&&0===s.count&&a.pluralResolver.shouldUseIntlApi(),h=void 0!==s.context&&("string"==typeof s.context||"number"==typeof s.context)&&""!==s.context,g=s.lngs?s.lngs:a.languageUtils.toResolveHierarchy(s.lng||a.language,s.fallbackLng);u.forEach((function(e){a.isValidLookup(t)||(i=e,!Nr["".concat(g[0],"-").concat(e)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(i)&&(Nr["".concat(g[0],"-").concat(e)]=!0,a.logger.warn('key "'.concat(n,'" for languages "').concat(g.join(", "),'" won\'t get resolved as namespace "').concat(i,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),g.forEach((function(n){if(!a.isValidLookup(t)){r=n;var i,c=[l];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(c,l,n,e,s);else{var u;p&&(u=a.pluralResolver.getSuffix(n,s.count,s));var g="".concat(a.options.pluralSeparator,"zero");if(p&&(c.push(l+u),d&&c.push(l+g)),h){var f="".concat(l).concat(a.options.contextSeparator).concat(s.context);c.push(f),p&&(c.push(f+u),d&&c.push(f+g))}}for(;i=c.pop();)a.isValidLookup(t)||(o=i,t=a.getResource(n,e,i,s))}})))}))}})),{res:t,usedKey:n,exactUsedKey:o,usedLng:r,usedNS:i}}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,o):this.resourceStore.getResource(e,t,n,o)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,t.length)&&void 0!==e[n])return!0;return!1}}]),n}();function Ar(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Lr=function(){function e(t){Qo(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=dr.create("languageUtils")}return tr(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],n=e.split("-");return this.options.lowerCaseLng?n=n.map((function(e){return e.toLowerCase()})):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=Ar(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=Ar(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=Ar(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,n=this;return e?(e.forEach((function(e){if(!t){var o=n.formatLanguageCode(e);n.options.supportedLngs&&!n.isSupportedCode(o)||(t=o)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var o=n.getLanguagePartFromCode(e);if(n.isSupportedCode(o))return t=o;t=n.options.supportedLngs.find((function(e){return e===o?e:e.indexOf("-")<0&&o.indexOf("-")<0?void 0:0===e.indexOf(o)?e:void 0}))}})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}},{key:"toResolveHierarchy",value:function(e,t){var n=this,o=this.getFallbackCodes(t||this.options.fallbackLng||[],e),r=[],i=function(e){e&&(n.isSupportedCode(e)?r.push(e):n.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&i(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&i(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&i(this.getLanguagePartFromCode(e))):"string"==typeof e&&i(this.formatLanguageCode(e)),o.forEach((function(e){r.indexOf(e)<0&&i(n.formatLanguageCode(e))})),r}}]),e}(),Hr=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Fr={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}},qr=["v1","v2","v3"],Br={zero:0,one:1,two:2,few:3,many:4,other:5};function $r(){var e={};return Hr.forEach((function(t){t.lngs.forEach((function(n){e[n]={numbers:t.nr,plurals:Fr[t.fc]}}))})),e}var Ur=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Qo(this,e),this.languageUtils=t,this.options=n,this.logger=dr.create("pluralResolver"),this.options.compatibilityJSON&&"v4"!==this.options.compatibilityJSON||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=$r()}return tr(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(e,{type:t.ordinal?"ordinal":"cardinal"})}catch(e){return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getRule(e,t);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,n).map((function(e){return"".concat(t).concat(e)}))}},{key:"getSuffixes",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=this.getRule(e,n);return o?this.shouldUseIntlApi()?o.resolvedOptions().pluralCategories.sort((function(e,t){return Br[e]-Br[t]})).map((function(e){return"".concat(t.options.prepend).concat(e)})):o.numbers.map((function(o){return t.getSuffix(e,o,n)})):[]}},{key:"getSuffix",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=this.getRule(e,n);return o?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(o.select(t)):this.getSuffixRetroCompatible(o,t):(this.logger.warn("no plural rule found for: ".concat(e)),"")}},{key:"getSuffixRetroCompatible",value:function(e,t){var n=this,o=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),r=e.numbers[o];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===r?r="plural":1===r&&(r=""));var i=function(){return n.options.prepend&&r.toString()?n.options.prepend+r.toString():r.toString()};return"v1"===this.options.compatibilityJSON?1===r?"":"number"==typeof r?"_plural_".concat(r.toString()):i():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?i():this.options.prepend&&o.toString()?this.options.prepend+o.toString():o.toString()}},{key:"shouldUseIntlApi",value:function(){return!qr.includes(this.options.compatibilityJSON)}}]),e}();function zr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Wr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zr(Object(n),!0).forEach((function(t){sr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Vr(e,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".",r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=Cr(e,t,n);return!i&&r&&"string"==typeof n&&void 0===(i=_r(e,n,o))&&(i=_r(t,n,o)),i}var Kr=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Qo(this,e),this.logger=dr.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return tr(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:kr,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?wr(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?wr(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?wr(t.nestingPrefix):t.nestingPrefixEscaped||wr("$t("),this.nestingSuffix=t.nestingSuffix?wr(t.nestingSuffix):t.nestingSuffixEscaped||wr(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(n,"g")}},{key:"interpolate",value:function(e,t,n,o){var r,i,a,s=this,c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function l(e){return e.replace(/\$/g,"$$$$")}var u=function(e){if(e.indexOf(s.formatSeparator)<0){var r=Vr(t,c,e,s.options.keySeparator,s.options.ignoreJSONStructure);return s.alwaysFormat?s.format(r,void 0,n,Wr(Wr(Wr({},o),t),{},{interpolationkey:e})):r}var i=e.split(s.formatSeparator),a=i.shift().trim(),l=i.join(s.formatSeparator).trim();return s.format(Vr(t,c,a,s.options.keySeparator,s.options.ignoreJSONStructure),l,n,Wr(Wr(Wr({},o),t),{},{interpolationkey:a}))};this.resetRegExp();var p=o&&o.missingInterpolationHandler||this.options.missingInterpolationHandler,d=o&&o.interpolation&&void 0!==o.interpolation.skipOnVariables?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return l(e)}},{regex:this.regexp,safeValue:function(e){return s.escapeValue?l(s.escape(e)):l(e)}}].forEach((function(t){for(a=0;r=t.regex.exec(e);){var n=r[1].trim();if(void 0===(i=u(n)))if("function"==typeof p){var c=p(e,r,o);i="string"==typeof c?c:""}else if(o&&Object.prototype.hasOwnProperty.call(o,n))i="";else{if(d){i=r[0];continue}s.logger.warn("missed to pass in variable ".concat(n," for interpolating ").concat(e)),i=""}else"string"==typeof i||s.useRawValueToEscape||(i=fr(i));var l=t.safeValue(i);if(e=e.replace(r[0],l),d?(t.regex.lastIndex+=i.length,t.regex.lastIndex-=r[0].length):t.regex.lastIndex=0,++a>=s.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var n,o,r,i=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};function s(e,t){var n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;var o=e.split(new RegExp("".concat(n,"[ ]*{"))),i="{".concat(o[1]);e=o[0];var a=(i=this.interpolate(i,r)).match(/'/g),s=i.match(/"/g);(a&&a.length%2==0&&!s||s.length%2!=0)&&(i=i.replace(/'/g,'"'));try{r=JSON.parse(i),t&&(r=Wr(Wr({},t),r))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(n).concat(i)}return delete r.defaultValue,e}for(;n=this.nestingRegexp.exec(e);){var c=[];(r=(r=Wr({},a)).replace&&"string"!=typeof r.replace?r.replace:r).applyPostProcessor=!1,delete r.defaultValue;var l=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){var u=n[1].split(this.formatSeparator).map((function(e){return e.trim()}));n[1]=u.shift(),c=u,l=!0}if((o=t(s.call(this,n[1].trim(),r),r))&&n[0]===e&&"string"!=typeof o)return o;"string"!=typeof o&&(o=fr(o)),o||(this.logger.warn("missed to resolve ".concat(n[1]," for nesting ").concat(e)),o=""),l&&(o=c.reduce((function(e,t){return i.format(e,t,a.lng,Wr(Wr({},a),{},{interpolationkey:n[1].trim()}))}),o.trim())),e=e.replace(n[0],o),this.regexp.lastIndex=0}return e}}]),e}();function Yr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Jr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Yr(Object(n),!0).forEach((function(t){sr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Gr(e){var t=e.toLowerCase().trim(),n={};if(e.indexOf("(")>-1){var o=e.split("(");t=o[0].toLowerCase().trim();var r=o[1].substring(0,o[1].length-1);"currency"===t&&r.indexOf(":")<0?n.currency||(n.currency=r.trim()):"relativetime"===t&&r.indexOf(":")<0?n.range||(n.range=r.trim()):r.split(";").forEach((function(e){if(e){var t=function(e){return function(e){if(Array.isArray(e))return e}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return cr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cr(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(e.split(":")),o=t[0],r=t.slice(1).join(":").trim().replace(/^'+|'+$/g,"");n[o.trim()]||(n[o.trim()]=r),"false"===r&&(n[o.trim()]=!1),"true"===r&&(n[o.trim()]=!0),isNaN(r)||(n[o.trim()]=parseInt(r,10))}}))}return{formatName:t,formatOptions:n}}function Xr(e){var t={};return function(n,o,r){var i=o+JSON.stringify(r),a=t[i];return a||(a=e(o,r),t[i]=a),a(n)}}var Qr=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Qo(this,e),this.logger=dr.create("formatter"),this.options=t,this.formats={number:Xr((function(e,t){var n=new Intl.NumberFormat(e,Jr({},t));return function(e){return n.format(e)}})),currency:Xr((function(e,t){var n=new Intl.NumberFormat(e,Jr(Jr({},t),{},{style:"currency"}));return function(e){return n.format(e)}})),datetime:Xr((function(e,t){var n=new Intl.DateTimeFormat(e,Jr({},t));return function(e){return n.format(e)}})),relativetime:Xr((function(e,t){var n=new Intl.RelativeTimeFormat(e,Jr({},t));return function(e){return n.format(e,t.range||"day")}})),list:Xr((function(e,t){var n=new Intl.ListFormat(e,Jr({},t));return function(e){return n.format(e)}}))},this.init(t)}return tr(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}},n=t.interpolation;this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||","}},{key:"add",value:function(e,t){this.formats[e.toLowerCase().trim()]=t}},{key:"addCached",value:function(e,t){this.formats[e.toLowerCase().trim()]=Xr(t)}},{key:"format",value:function(e,t,n){var o=this,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=t.split(this.formatSeparator),a=i.reduce((function(e,t){var i=Gr(t),a=i.formatName,s=i.formatOptions;if(o.formats[a]){var c=e;try{var l=r&&r.formatParams&&r.formatParams[r.interpolationkey]||{},u=l.locale||l.lng||r.locale||r.lng||n;c=o.formats[a](e,u,Jr(Jr(Jr({},s),r),l))}catch(e){o.logger.warn(e)}return c}return o.logger.warn("there was no format function for ".concat(a)),e}),e);return a}}]),e}();function Zr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function ei(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Zr(Object(n),!0).forEach((function(t){sr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ti=function(e){rr(n,hr);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=ar(e);if(t){var r=ar(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return ir(this,n)}}(n);function n(e,o,r){var i,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Qo(this,n),i=t.call(this),Or&&hr.call(nr(i)),i.backend=e,i.store=o,i.services=r,i.languageUtils=r.languageUtils,i.options=a,i.logger=dr.create("backendConnector"),i.waitingReads=[],i.maxParallelReads=a.maxParallelReads||10,i.readingCalls=0,i.maxRetries=a.maxRetries>=0?a.maxRetries:5,i.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,i.state={},i.queue=[],i.backend&&i.backend.init&&i.backend.init(r,a.backend,a),i}return tr(n,[{key:"queueLoad",value:function(e,t,n,o){var r=this,i={},a={},s={},c={};return e.forEach((function(e){var o=!0;t.forEach((function(t){var s="".concat(e,"|").concat(t);!n.reload&&r.store.hasResourceBundle(e,t)?r.state[s]=2:r.state[s]<0||(1===r.state[s]?void 0===a[s]&&(a[s]=!0):(r.state[s]=1,o=!1,void 0===a[s]&&(a[s]=!0),void 0===i[s]&&(i[s]=!0),void 0===c[t]&&(c[t]=!0)))})),o||(s[e]=!0)})),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(c)}}},{key:"loaded",value:function(e,t,n){var o=e.split("|"),r=o[0],i=o[1];t&&this.emit("failedLoading",r,i,t),n&&this.store.addResourceBundle(r,i,n),this.state[e]=t?-1:2;var a={};this.queue.forEach((function(n){!function(e,t,n,o){var r=yr(e,t,Object),i=r.obj,a=r.k;i[a]=i[a]||[],i[a].push(n)}(n.loaded,[r],i),function(e,t){void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)}(n,e),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach((function(e){a[e]||(a[e]={});var t=n.loaded[e];t.length&&t.forEach((function(t){void 0===a[e][t]&&(a[e][t]=!0)}))})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())})),this.emit("loaded",a),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,n){var o=this,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads)this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:i,callback:a});else{this.readingCalls++;var s=function(s,c){if(o.readingCalls--,o.waitingReads.length>0){var l=o.waitingReads.shift();o.read(l.lng,l.ns,l.fcName,l.tried,l.wait,l.callback)}s&&c&&r<o.maxRetries?setTimeout((function(){o.read.call(o,e,t,n,r+1,2*i,a)}),i):a(s,c)},c=this.backend[n].bind(this.backend);if(2!==c.length)return c(e,t,s);try{var l=c(e,t);l&&"function"==typeof l.then?l.then((function(e){return s(null,e)})).catch(s):s(null,l)}catch(e){s(e)}}}},{key:"prepareLoading",value:function(e,t){var n=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var i=this.queueLoad(e,t,o,r);if(!i.toLoad.length)return i.pending.length||r(),null;i.toLoad.forEach((function(e){n.loadOne(e)}))}},{key:"load",value:function(e,t,n){this.prepareLoading(e,t,{},n)}},{key:"reload",value:function(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}},{key:"loadOne",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",o=e.split("|"),r=o[0],i=o[1];this.read(r,i,"read",void 0,void 0,(function(o,a){o&&t.logger.warn("".concat(n,"loading namespace ").concat(i," for language ").concat(r," failed"),o),!o&&a&&t.logger.log("".concat(n,"loaded namespace ").concat(i," for language ").concat(r),a),t.loaded(e,o,a)}))}},{key:"saveMissing",value:function(e,t,n,o,r){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t))this.logger.warn('did not save key "'.concat(n,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");else if(null!=n&&""!==n){if(this.backend&&this.backend.create){var s=ei(ei({},i),{},{isUpdate:r}),c=this.backend.create.bind(this.backend);if(c.length<6)try{var l;(l=5===c.length?c(e,t,n,o,s):c(e,t,n,o))&&"function"==typeof l.then?l.then((function(e){return a(null,e)})).catch(a):a(null,l)}catch(e){a(e)}else c(e,t,n,o,a,s)}e&&e[0]&&this.store.addResource(e[0],t,n,o)}}}]),n}();function ni(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===Xo(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===Xo(e[2])||"object"===Xo(e[3])){var n=e[3]||e[2];Object.keys(n).forEach((function(e){t[e]=n[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,n,o){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function oi(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function ri(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function ii(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ri(Object(n),!0).forEach((function(t){sr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ri(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ai(){}function si(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((function(t){"function"==typeof e[t]&&(e[t]=e[t].bind(e))}))}var ci=function(e){rr(n,hr);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=ar(e);if(t){var r=ar(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return ir(this,n)}}(n);function n(){var e,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;if(Qo(this,n),e=t.call(this),Or&&hr.call(nr(e)),e.options=oi(o),e.services={},e.logger=dr,e.modules={external:[]},si(nr(e)),r&&!e.isInitialized&&!o.isClone){if(!e.options.initImmediate)return e.init(o,r),ir(e,nr(e));setTimeout((function(){e.init(o,r)}),0)}return e}return tr(n,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(n=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&("string"==typeof t.ns?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));var o=ni();function r(e){return e?"function"==typeof e?new e:e:null}if(this.options=ii(ii(ii({},o),this.options),oi(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=ii(ii({},o.interpolation),this.options.interpolation)),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator),!this.options.isClone){var i;this.modules.logger?dr.init(r(this.modules.logger),this.options):dr.init(null,this.options),this.modules.formatter?i=this.modules.formatter:"undefined"!=typeof Intl&&(i=Qr);var a=new Lr(this.options);this.store=new Ir(this.options.resources,this.options);var s=this.services;s.logger=dr,s.resourceStore=this.store,s.languageUtils=a,s.pluralResolver=new Ur(a,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!i||this.options.interpolation.format&&this.options.interpolation.format!==o.interpolation.format||(s.formatter=r(i),s.formatter.init(s,this.options),this.options.interpolation.format=s.formatter.format.bind(s.formatter)),s.interpolator=new Kr(this.options),s.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},s.backendConnector=new ti(r(this.modules.backend),s.resourceStore,s,this.options),s.backendConnector.on("*",(function(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];e.emit.apply(e,[t].concat(o))})),this.modules.languageDetector&&(s.languageDetector=r(this.modules.languageDetector),s.languageDetector.init&&s.languageDetector.init(s,this.options.detection,this.options)),this.modules.i18nFormat&&(s.i18nFormat=r(this.modules.i18nFormat),s.i18nFormat.init&&s.i18nFormat.init(this)),this.translator=new Mr(this.services,this.options),this.translator.on("*",(function(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];e.emit.apply(e,[t].concat(o))})),this.modules.external.forEach((function(t){t.init&&t.init(e)}))}if(this.format=this.options.interpolation.format,n||(n=ai),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&"dev"!==c[0]&&(this.options.lng=c[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");var l=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];l.forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments)}}));var u=["addResource","addResources","addResourceBundle","removeResourceBundle"];u.forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments),e}}));var p=gr(),d=function(){var t=function(t,o){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),p.resolve(o),n(t,o)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?d():setTimeout(d,0),p}},{key:"loadResources",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ai,o=n,r="string"==typeof e?e:this.language;if("function"==typeof e&&(o=e),!this.options.resources||this.options.partialBundledLanguages){if(r&&"cimode"===r.toLowerCase())return o();var i=[],a=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){i.indexOf(e)<0&&i.push(e)}))};if(r)a(r);else{var s=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);s.forEach((function(e){return a(e)}))}this.options.preload&&this.options.preload.forEach((function(e){return a(e)})),this.services.backendConnector.load(i,this.options.ns,(function(e){e||t.resolvedLanguage||!t.language||t.setResolvedLanguage(t.language),o(e)}))}else o(null)}},{key:"reloadResources",value:function(e,t,n){var o=gr();return e||(e=this.languages),t||(t=this.options.ns),n||(n=ai),this.services.backendConnector.reload(e,t,(function(e){o.resolve(),n(e)})),o}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&Dr.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"setResolvedLanguage",value:function(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(var t=0;t<this.languages.length;t++){var n=this.languages[t];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}}},{key:"changeLanguage",value:function(e,t){var n=this;this.isLanguageChangingTo=e;var o=gr();this.emit("languageChanging",e);var r=function(e){n.language=e,n.languages=n.services.languageUtils.toResolveHierarchy(e),n.resolvedLanguage=void 0,n.setResolvedLanguage(e)},i=function(i){e||i||!n.services.languageDetector||(i=[]);var a="string"==typeof i?i:n.services.languageUtils.getBestMatchFromCodes(i);a&&(n.language||r(a),n.translator.language||n.translator.changeLanguage(a),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage&&n.services.languageDetector.cacheUserLanguage(a)),n.loadResources(a,(function(e){!function(e,i){i?(r(i),n.translator.changeLanguage(i),n.isLanguageChangingTo=void 0,n.emit("languageChanged",i),n.logger.log("languageChanged",i)):n.isLanguageChangingTo=void 0,o.resolve((function(){return n.t.apply(n,arguments)})),t&&t(e,(function(){return n.t.apply(n,arguments)}))}(e,a)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(i):this.services.languageDetector.detect(i):i(e):i(this.services.languageDetector.detect()),o}},{key:"getFixedT",value:function(e,t,n){var o=this,r=function e(t,r){var i;if("object"!==Xo(r)){for(var a=arguments.length,s=new Array(a>2?a-2:0),c=2;c<a;c++)s[c-2]=arguments[c];i=o.options.overloadTranslationOptionHandler([t,r].concat(s))}else i=ii({},r);i.lng=i.lng||e.lng,i.lngs=i.lngs||e.lngs,i.ns=i.ns||e.ns,i.keyPrefix=i.keyPrefix||n||e.keyPrefix;var l,u=o.options.keySeparator||".";return l=i.keyPrefix&&Array.isArray(t)?t.map((function(e){return"".concat(i.keyPrefix).concat(u).concat(e)})):i.keyPrefix?"".concat(i.keyPrefix).concat(u).concat(t):t,o.t(l,i)};return"string"==typeof e?r.lng=e:r.lngs=e,r.ns=t,r.keyPrefix=n,r}},{key:"t",value:function(){var e;return this.translator&&(e=this.translator).translate.apply(e,arguments)}},{key:"exists",value:function(){var e;return this.translator&&(e=this.translator).exists.apply(e,arguments)}},{key:"setDefaultNamespace",value:function(e){this.options.defaultNS=e}},{key:"hasLoadedNamespace",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var o=n.lng||this.resolvedLanguage||this.languages[0],r=!!this.options&&this.options.fallbackLng,i=this.languages[this.languages.length-1];if("cimode"===o.toLowerCase())return!0;var a=function(e,n){var o=t.services.backendConnector.state["".concat(e,"|").concat(n)];return-1===o||2===o};if(n.precheck){var s=n.precheck(this,a);if(void 0!==s)return s}return!(!this.hasResourceBundle(o,e)&&this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages)&&(!a(o,e)||r&&!a(i,e)))}},{key:"loadNamespaces",value:function(e,t){var n=this,o=gr();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){n.options.ns.indexOf(e)<0&&n.options.ns.push(e)})),this.loadResources((function(e){o.resolve(),t&&t(e)})),o):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var n=gr();"string"==typeof e&&(e=[e]);var o=this.options.preload||[],r=e.filter((function(e){return o.indexOf(e)<0}));return r.length?(this.options.preload=o.concat(r),this.loadResources((function(e){n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";var t=this.services&&this.services.languageUtils||new Lr(ni());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ai,r=ii(ii(ii({},this.options),t),{isClone:!0}),i=new n(r);void 0===t.debug&&void 0===t.prefix||(i.logger=i.logger.clone(t));var a=["store","services","language"];return a.forEach((function(t){i[t]=e[t]})),i.services=ii({},this.services),i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i.translator=new Mr(i.services,i.options),i.translator.on("*",(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];i.emit.apply(i,[e].concat(n))})),i.init(r,o),i.translator.options=i.options,i.translator.backendConnector.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i}},{key:"toJSON",value:function(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}]),n}();sr(ci,"createInstance",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new ci(e,t)}));var li=ci.createInstance();li.createInstance=ci.createInstance,li.createInstance,li.dir,li.init,li.loadResources,li.reloadResources,li.use,li.changeLanguage,li.getFixedT,li.t,li.exists,li.setDefaultNamespace,li.hasLoadedNamespace,li.loadNamespaces,li.loadLanguages,li.init({fallbackLng:"en",lng:"en",debug:!0,resources:{en:{translation:{categorize:{limitMaxChoicesPerCategory:"You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",maxChoicesPerCategoryRestriction:"To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s]."},ebsr:{part:"Part {{index}}"},numberLine:{addElementLimit_one:"You can only add {{count}} element",addElementLimit_other:"You can only add {{count}} elements",clearAll:"Clear all"},imageClozeAssociation:{reachedLimit_one:"You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.",reachedLimit_other:"Full"},drawingResponse:{fillColor:"Fill color",outlineColor:"Outline color",noFill:"No fill",lightblue:"Light blue",lightyellow:"Light yellow",red:"Red",orange:"Orange",yellow:"Yellow",violet:"Violet",blue:"Blue",green:"Green",white:"White",black:"Black",onDoubleClick:"Double click to edit this text. Press Enter to submit."},charting:{addCategory:"Add category",actions:"Actions",add:"Add",delete:"Delete",newLabel:"New label",reachedLimit_other:"There can't be more than {{count}} categories.",keyLegend:{incorrectAnswer:"Student incorrect answer",correctAnswer:"Student correct answer",correctKeyAnswer:"Answer key correct"}},graphing:{point:"Point",circle:"Circle",line:"Line",parabola:"Parabola",absolute:"Absolute Value",exponential:"Exponential",polygon:"Polygon",ray:"Ray",segment:"Segment",sine:"Sine",vector:"Vector",label:"Label",redo:"Redo",reset:"Reset"},mathInline:{primaryCorrectWithAlternates:"Note: The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct."},multipleChoice:{minSelections:"Select at least {{minSelections}}.",maxSelections_one:"Only {{maxSelections}} answer is allowed.",maxSelections_other:"Only {{maxSelections}} answers are allowed.",minmaxSelections_equal:"Select {{minSelections}}.",minmaxSelections_range:"Select between {{minSelections}} and {{maxSelections}}."},selectText:{correctAnswerSelected:"Correct",correctAnswerNotSelected:"Correct Answer Not Selected",incorrectSelection:"Incorrect Selection",key:"Key"}},common:{undo:"Undo",clearAll:"Clear all",correct:"Correct",incorrect:"Incorrect",showCorrectAnswer:"Show correct answer",hideCorrectAnswer:"Hide correct answer",commonCorrectAnswerWithAlternates:"Note: The answer shown above is the most common correct answer for this item. One or more additional correct answers are also defined, and will also be recognized as correct.",warning:"Warning",showNote:"Show Note",hideNote:"Hide Note",cancel:"Cancel"}},es:{translation:{categorize:{limitMaxChoicesPerCategory:"Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",maxChoicesPerCategoryRestriction:"Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta"},ebsr:{part:"Parte {{index}}"},numberLine:{addElementLimit_one:"Solo puedes agregar {{count}} elemento",addElementLimit_other:"Solo puedes agregar {{count}} elementos",clearAll:"Borrar todo"},imageClozeAssociation:{reachedLimit_one:"Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",reachedLimit_other:"Lleno"},drawingResponse:{fillColor:"Color de relleno",outlineColor:"Color del contorno",noFill:"Sin relleno",lightblue:"Azul claro",lightyellow:"Amarillo claro",red:"Rojo",orange:"Naranja",yellow:"Amarillo",violet:"Violeta",blue:"Azul",green:"Verde",white:"Blanco",black:"Negro",onDoubleClick:"Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar"},charting:{addCategory:"Añadir categoría",actions:"Acciones",add:"Añadir",delete:"Eliminar",newLabel:"Nueva etiqueta",reachedLimit_other:"No puede haber más de {{count}} categorías.",keyLegend:{incorrectAnswer:"Respuesta incorrecta del estudiante",correctAnswer:"Respuesta correcta del estudiante",correctKeyAnswer:"Clave de respuesta correcta"}},graphing:{point:"Punto",circle:"Circulo",line:"Línea",parabola:"Parábola",absolute:"Valor absoluto",exponential:"Exponencial",polygon:"Polígono",ray:"Semirrecta",segment:"Segmento ",sine:"Seno",vector:"Vector",label:"Etiqueta",redo:"Rehacer",reset:"Reiniciar"},mathInline:{primaryCorrectWithAlternates:"Nota: La respuesta que se muestra arriba es la respuesta correcta principal especificada por el autor para esta pregunta, pero también se pueden reconocer otras respuestas como correctas."},multipleChoice:{minSelections:"Seleccione al menos {{minSelections}}.",maxSelections_one:"Sólo se permite {{maxSelections}} respuesta.",maxSelections_other:"Sólo se permiten {{maxSelections}} respuestas.",minmaxSelections_equal:"Seleccione {{minSelections}}.",minmaxSelections_range:"Seleccione entre {{minSelections}} y {{maxSelections}}."},selectText:{correctAnswerSelected:"Respuesta Correcta",correctAnswerNotSelected:"Respuesta Correcta No Seleccionada",incorrectSelection:"Selección Incorrecta",key:"Clave"}},common:{undo:"Deshacer",clearAll:"Borrar todo",correct:"Correct",incorrect:"Incorrect",showCorrectAnswer:"Mostrar respuesta correcta",hideCorrectAnswer:"Ocultar respuesta correcta",commonCorrectAnswerWithAlternates:"Nota: La respuesta que se muestra arriba es la respuesta correcta más común para esta pregunta. También se definen una o más respuestas correctas adicionales, y también se reconocerán como correctas.",warning:"Advertencia",showNote:"Mostrar Nota",hideNote:"Ocultar Nota",cancel:"Cancelar"}}}});var ui={translator:{...li,t:(e,t)=>{const{lng:n}=t;switch(n){case"en_US":case"en-US":t.lng="en";break;case"es_ES":case"es-ES":case"es_MX":case"es-MX":t.lng="es"}return li.t(e,{lng:n,...t})}},languageOptions:[{value:"en_US",label:"English (US)"},{value:"es_ES",label:"Spanish"}]};const pi=n,di=o,{withStyles:hi}=r,{FeedbackConfig:gi}=p,{InputContainer:fi}=p,{layout:mi}=p,{settings:yi}=p,{AlertDialog:bi}=p,vi=d,{uid:Ci}=h,{withDragContext:Si}=h;function wi(e){let t,n=e[0],o=1;for(;o<e.length;){const r=e[o],i=e[o+1];if(o+=2,("optionalAccess"===r||"optionalCall"===r)&&null==n)return;"access"===r||"optionalAccess"===r?(t=n,n=i(n)):"call"!==r&&"optionalCall"!==r||(n=i(((...e)=>n.call(t,...e))),t=void 0)}return n}const{translator:xi}=ui,{dropdown:ki,Panel:Oi,toggle:Ri,radio:_i,numberField:Pi}=yi,{Provider:Ei}=Ci;class Ii extends pi.Component{static __initStatic(){this.propTypes={classes:di.object.isRequired,configuration:di.object,className:di.string,onConfigurationChanged:di.func,model:di.object.isRequired,onChange:di.func.isRequired,uid:di.string,imageSupport:di.shape({add:di.func.isRequired,delete:di.func.isRequired}),uploadSoundSupport:di.shape({add:di.func.isRequired,delete:di.func.isRequired})}}constructor(e){super(e),Ii.prototype.__init.call(this),Ii.prototype.__init2.call(this),Ii.prototype.__init3.call(this),Ii.prototype.__init4.call(this),Ii.prototype.__init5.call(this),Ii.prototype.__init6.call(this),Ii.prototype.__init7.call(this),Ii.prototype.__init8.call(this),Ii.prototype.__init9.call(this),Ii.prototype.__init10.call(this),Ii.prototype.__init11.call(this),this.uid=e.uid||Ci.generateId()}__init(){this.updateModel=e=>{const{model:t,onChange:n}=this.props,o={...t,...e};o.choices=o.choices.map((e=>({...e,categoryCount:this.checkAllowMultiplePlacements(o.allowMultiplePlacementsEnabled,e)}))),o.correctResponse=((e,t)=>{const n=(t=t||[]).reduce(((e,t)=>{if(I("choice: ----\x3e ",t.id,"categoryCount: ",t.categoryCount),void 0===t.categoryCount||0===t.categoryCount)return e;{const n=e.map((e=>e.choices));return D(t.id,n,t.categoryCount).map(((t,n)=>({category:e[n].category,alternateResponses:e[n].alternateResponses,choices:t})))}}),e);return n})(o.correctResponse||[],o.choices),o.correctResponse=((e,t)=>{const n=(t=t||[]).reduce(((e,t)=>{if(I("choice: ----\x3e ",t.id,"categoryCount: ",t.categoryCount),void 0===t.categoryCount||0===t.categoryCount)return e;{let n={};e.forEach((e=>(e.alternateResponses||[]).forEach(((e,t)=>{t in n||(n[t]=[]),n[t].push(e)}))));const o=[];Object.keys(n).forEach((e=>{const r=D(t.id,n[e],t.categoryCount);n[e]=r,n[e].forEach(((e,t)=>{o[t]||(o[t]=[]),o[t].push(e)}))}));const r=e.map(((e,t)=>({category:e.category,alternateResponses:o[t]||e.alternateResponses,choices:e.choices})));return r}}),e);return n})(o.correctResponse||[],o.choices),o.categories=o.categories.map((e=>({id:e.id,label:e.label}))),o.choices=o.choices.map((e=>({id:e.id,content:e.content,categoryCount:e.categoryCount}))),o.maxChoicesPerCategory=o.allowMaxChoicesPerCategory?o.maxChoicesPerCategory:0,n(o)}}__init2(){this.changeRationale=e=>{const{model:t,onChange:n}=this.props;n({...t,rationale:e})}}__init3(){this.changeTeacherInstructions=e=>{const{model:t,onChange:n}=this.props;n({...t,teacherInstructions:e})}}__init4(){this.changeFeedback=e=>{this.updateModel({feedback:e})}}__init5(){this.onAddAlternateResponse=()=>{const{model:{correctResponse:e}}=this.props;this.updateModel({correctResponse:(e||[]).map((e=>({...e,alternateResponses:[...e.alternateResponses||[],[]]})))})}}__init6(){this.onPromptChanged=e=>this.updateModel({prompt:e})}__init7(){this.onRemoveAlternateResponse=e=>{const{model:{correctResponse:t}}=this.props;this.updateModel({correctResponse:(t||[]).map((t=>({...t,alternateResponses:(t.alternateResponses||[]).filter(((t,n)=>n!==e))})))})}}__init8(){this.countChoiceInCorrectResponse=e=>{const{model:t}=this.props;return((e,t)=>{const n=t.reduce(((t,n)=>t+((e,t)=>(t||[]).filter((t=>t===e)).length)(e,n.choices)),0);return I("[countInAnswer] choiceId:",e,t),n})(e.id,t.correctResponse)}}__init9(){this.checkAllowMultiplePlacements=(e,t)=>"Yes"===e?0:"No"===e?1:t.categoryCount||0}__init10(){this.isAlertModalOpened=()=>{const{model:e}=this.props,{maxChoicesPerCategory:t=0}=e||{},n=Wn(e);return 0!==t&&n>t}}__init11(){this.onAlertModalCancel=()=>{const{model:e}=this.props,t=Wn(e);this.updateModel({maxChoicesPerCategory:t})}}render(){const{classes:e,configuration:t,imageSupport:n,model:o,uploadSoundSupport:r,onConfigurationChanged:i}=this.props,{allowAlternate:a={},allowMultiplePlacements:s={},baseInputConfiguration:c={},categoriesPerRow:l={},choicesPosition:u={},contentDimensions:p={},feedback:d={},lockChoiceOrder:h={},maxImageHeight:g={},maxImageWidth:f={},maxPlacements:m={},minCategoriesPerRow:y=1,partialScoring:b={},prompt:v={},rationale:C={},scoringType:S={},settingsPanelDisabled:w,spellCheck:x={},studentInstructions:k={},teacherInstructions:R={},withRubric:_={},mathMlOptions:P={},language:E={},languageChoices:I={},allowMaxAnswerChoices:D={}}=t||{},{allowAlternateEnabled:j,allowMaxChoicesPerCategory:T,errors:N,feedbackEnabled:M,maxChoicesPerCategory:A,promptEnabled:L,rationaleEnabled:H,spellCheckEnabled:F,teacherInstructionsEnabled:q,toolbarEditorPosition:B,extraCSSRules:$}=o||{},{prompt:U,rationale:z,teacherInstructions:W}=N||{},V={position:"top"===B?"top":"bottom"},K=o.config||{};K.choices=K.choices||{label:"",columns:2};const Y=((e,t,n)=>Jo(e).map((e=>{const o=n.find((t=>t.category===e.id));return o&&(e.choices=(o.choices||[]).map((e=>{const n=t.find((t=>t.id===e));if(n)return Object.assign({},{id:n.id,content:n.content})}))),e})))(o.categories||[],o.choices||[],o.correctResponse||[]),J=((e,t,n)=>{const o=n.reduce(((e,t)=>t.alternateResponses&&t.alternateResponses.length>=e?t.alternateResponses.length:e),0);return new Array(o).fill(0).map(((o,r)=>n.map(((n,o)=>{const i=e[o];return{id:i.id,label:i.label,choices:Go(n,t,r)}}))))})(o.categories||[],o.choices||[],o.correctResponse||[]),G=o.choices.map((e=>(e.correctResponseCount=this.countChoiceInCorrectResponse(e),e.categoryCount=this.checkAllowMultiplePlacements(o.allowMultiplePlacementsEnabled,e),e))),X=f&&f.prompt,Q=g&&g.prompt,Z={partialScoring:b.settings&&Ri(b.label),lockChoiceOrder:h.settings&&Ri(h.label),categoriesPerRow:l.settings&&Pi(l.label,{label:l.label,min:y,max:6}),choicesPosition:u.settings&&_i(u.label,["below","above","left","right"]),allowMultiplePlacementsEnabled:s.settings&&ki(s.label,["Yes","No",zn]),maxAnswerChoices:D.settings&&Pi(D.label,{label:"",min:wi([G,"optionalAccess",e=>e.length])||0,max:30}),allowMaxChoicesPerCategory:m.settings&&Ri(m.label),maxChoicesPerCategory:!0===T&&Pi(m.label,{label:"",min:0,max:30}),promptEnabled:v.settings&&Ri(v.label),feedbackEnabled:d.settings&&Ri(d.label),allowAlternateEnabled:a.settings&&Ri(a.label),"language.enabled":E.settings&&Ri(E.label,!0),language:E.settings&&E.enabled&&ki(I.label,I.options)},ee={teacherInstructionsEnabled:R.settings&&Ri(R.label),studentInstructionsEnabled:k.settings&&Ri(k.label),rationaleEnabled:C.settings&&Ri(C.label),spellCheckEnabled:x.settings&&Ri(x.label),scoringType:S.settings&&_i(S.label,["auto","rubric"]),rubricEnabled:wi([_,"optionalAccess",e=>e.settings])&&Ri(wi([_,"optionalAccess",e=>e.label]))},te=this.isAlertModalOpened(),ne=xi.t("translation:categorize:maxChoicesPerCategoryRestriction",{lng:o.language,maxChoicesPerCategory:A});return pi.createElement(Ei,{value:this.uid},pi.createElement(mi.ConfigLayout,{extraCSSRules:$,dimensions:p,hideSettings:w,settings:pi.createElement(Oi,{model:o,onChangeModel:this.updateModel,configuration:t,onChangeConfiguration:i,groups:{Settings:Z,Properties:ee},modal:pi.createElement(bi,{title:"Warning",text:ne,open:te,onClose:this.onAlertModalCancel})})},q&&pi.createElement(fi,{label:R.label,className:e.inputContainer},pi.createElement(vi,{className:e.input,markup:o.teacherInstructions||"",onChange:this.changeTeacherInstructions,imageSupport:n,error:W,nonEmpty:!1,toolbarOpts:V,pluginProps:O(wi([R,"optionalAccess",e=>e.inputConfiguration]),c),spellCheck:F,maxImageWidth:f&&f.teacherInstructions||X,maxImageHeight:g&&g.teacherInstructions||Q,uploadSoundSupport:r,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:P}),W&&pi.createElement("div",{className:e.errorText},W)),L&&pi.createElement(fi,{label:v.label,className:e.inputContainer},pi.createElement(vi,{className:e.input,markup:o.prompt||"",onChange:this.onPromptChanged,imageSupport:n,error:U,nonEmpty:!1,disableUnderline:!0,toolbarOpts:V,pluginProps:O(wi([v,"optionalAccess",e=>e.inputConfiguration]),c),spellCheck:F,maxImageWidth:f&&f.prompt,maxImageHeight:g&&g.prompt,uploadSoundSupport:r,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:P}),U&&pi.createElement("div",{className:e.errorText},U)),pi.createElement(co,{imageSupport:n,uploadSoundSupport:r,model:o,categories:Y||[],onModelChanged:this.updateModel,toolbarOpts:V,spellCheck:F,configuration:t,defaultImageMaxWidth:X,defaultImageMaxHeight:Q,mathMlOptions:P}),pi.createElement(Yo,{imageSupport:n,uploadSoundSupport:r,choices:G,model:o,onModelChanged:this.updateModel,toolbarOpts:V,spellCheck:F,configuration:t,defaultImageMaxWidth:X,defaultImageMaxHeight:Q}),j&&pi.createElement($n,{className:e.alternatesHeader,label:"Alternate Responses",buttonLabel:"ADD AN ALTERNATE RESPONSE",onAdd:this.onAddAlternateResponse}),j&&J.map(((i,a)=>pi.createElement(pi.Fragment,{key:a},pi.createElement($n,{className:e.alternatesHeader,variant:"subtitle1",label:"Alternate Response",buttonLabel:"REMOVE ALTERNATE RESPONSE",onAdd:()=>this.onRemoveAlternateResponse(a)}),pi.createElement(fo,{altIndex:a,imageSupport:n,model:o,configuration:t,categories:i,onModelChanged:this.updateModel,uploadSoundSupport:r,mathMlOptions:P})))),H&&pi.createElement(fi,{label:C.label,className:e.inputContainer},pi.createElement(vi,{className:e.input,markup:o.rationale||"",onChange:this.changeRationale,imageSupport:n,error:z,nonEmpty:!1,toolbarOpts:V,pluginProps:O(wi([v,"optionalAccess",e=>e.inputConfiguration]),c),spellCheck:F,maxImageWidth:f&&f.rationale||X,maxImageHeight:g&&g.rationale||Q,uploadSoundSupport:r,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:P}),z&&pi.createElement("div",{className:e.errorText},z)),M&&pi.createElement(gi,{feedback:o.feedback,onChange:this.changeFeedback,toolbarOpts:V})))}}Ii.__initStatic();var Di=Si(hi((e=>({alternatesHeader:{marginBottom:2*e.spacing.unit},text:{paddingTop:2*e.spacing.unit,paddingBottom:2*e.spacing.unit},inputContainer:{width:"100%",paddingTop:2*e.spacing.unit,marginBottom:2*e.spacing.unit},title:{marginBottom:4*e.spacing.unit},errorText:{fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing.unit}})))(Ii));const ji=n,Ti=o,{withStyles:Ni}=r;class Mi extends ji.Component{static __initStatic(){this.propTypes={classes:Ti.object.isRequired,configuration:Ti.object,className:Ti.string,onConfigurationChanged:Ti.func,model:Ti.object.isRequired,onModelChanged:Ti.func.isRequired,imageSupport:Ti.object,uploadSoundSupport:Ti.object}}static __initStatic2(){this.defaultProps={}}render(){const{model:e,onModelChanged:t,configuration:n,onConfigurationChanged:o,imageSupport:r,uploadSoundSupport:i}=this.props;return ji.createElement(Di,{imageSupport:r,uploadSoundSupport:i,title:"Design",model:e,configuration:n,onChange:t,onConfigurationChanged:o})}}Mi.__initStatic(),Mi.__initStatic2();var Ai=Ni((()=>({})))(Mi),Li={allowAlternateEnabled:!0,allowMaxChoicesPerCategory:!1,allowMultiplePlacementsEnabled:"Yes",alternates:[],categories:[],categoriesPerRow:2,choices:[],choicesLabel:"",choicesPosition:"below",correctResponse:[],feedbackEnabled:!1,lockChoiceOrder:!0,maxAnswerChoices:6,maxChoicesPerCategory:0,partialScoring:!0,promptEnabled:!0,rationaleEnabled:!0,rowLabels:[""],studentInstructionsEnabled:!0,teacherInstructionsEnabled:!0,toolbarEditorPosition:"bottom",minRowHeight:"80px"},Hi={baseInputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},textAlign:{disabled:!0},showParagraphs:{disabled:!1},separateParagraphs:{disabled:!0}},spellCheck:{label:"Spellcheck",settings:!1,enabled:!0},feedback:{settings:!0,label:"Feedback",enabled:!0},lockChoiceOrder:{settings:!0,label:"Lock Choice Order"},choicesPosition:{settings:!0,label:"Choices Position"},allowMultiplePlacements:{settings:!0,label:"Allow Multiple Placements"},maxPlacements:{settings:!0,label:"Max choices per category"},allowAlternate:{settings:!0,label:"Allow Alternate Correct Answers"},categoriesPerRow:{settings:!0,label:"Categories per row"},partialScoring:{settings:!1,label:"Allow Partial Scoring"},prompt:{settings:!0,label:"Prompt",required:!1,inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}}},rationale:{settings:!0,label:"Rationale",required:!1,inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}}},scoringType:{settings:!1,label:"Scoring Type"},settingsPanelDisabled:!1,studentInstructions:{settings:!1,label:"Student Instructions"},teacherInstructions:{settings:!0,label:"Teacher Instructions",required:!1,inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}}},headers:{inputConfiguration:{audio:{disabled:!0},video:{disabled:!0},image:{disabled:!1}}},rowLabels:{inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}}},toolbarEditorPosition:{settings:!1,label:"Toolbar Editor Position"},maxImageWidth:{teacherInstructions:300,prompt:300,rationale:300,rowLabel:200,categoryLabel:260,choices:240},maxImageHeight:{teacherInstructions:300,prompt:300,rationale:300,rowLabel:100,categoryLabel:100,choices:150},withRubric:{settings:!1,label:"Add Rubric"},minCategoriesPerRow:1,allowMaxAnswerChoices:{settings:!0,label:"Max answer choices"},mathMlOptions:{mmlOutput:!1,mmlEditing:!1},language:{settings:!1,label:"Specify Language",enabled:!1},languageChoices:{label:"Language Choices",options:[]}};const Fi=n,qi=l,{renderMath:Bi}=u;function $i(e){let t,n=e[0],o=1;for(;o<e.length;){const r=e[o],i=e[o+1];if(o+=2,("optionalAccess"===r||"optionalCall"===r)&&null==n)return;"access"===r||"optionalAccess"===r?(t=n,n=i(n)):"call"!==r&&"optionalCall"!==r||(n=i(((...e)=>n.call(t,...e))),t=void 0)}return n}class Ui extends HTMLElement{static __initStatic(){this.createDefaultModel=(e={})=>({...Li,...e})}static __initStatic2(){this.disableAlternateResponses=e=>{let{correctResponse:t}=e||{};t=t||[];const n=t.map((e=>{const{alternateResponses:t,...n}=e;return n}));return{...e,correctResponse:n,allowAlternateEnabled:!1}}}constructor(){super(),this._model=Ui.createDefaultModel(),this._configuration=Hi}set model(e){this._model=Ui.createDefaultModel(e),e.choices&&e.choices.length>=e.maxAnswerChoices&&(this._model.maxAnswerChoices=e.choices.length,console.warn("Max Answer Choices can't be less than choices length!")),this.render()}set configuration(e){const t={...Hi,...e};this._configuration=t,$i([t,"optionalAccess",e=>e.language,"optionalAccess",e=>e.enabled])?$i([t,"optionalAccess",e=>e.languageChoices,"optionalAccess",e=>e.options,"optionalAccess",e=>e.length])&&(this._model.language=$i([t,"optionalAccess",e=>e.languageChoices,"access",e=>e.options,"access",e=>e[0],"access",e=>e.value])):t.language.settings&&this._model.language?(this._configuration.language.enabled=!0,this._configuration.languageChoices.options&&this._configuration.languageChoices.options.length||(this._configuration.languageChoices.options=[]),this._configuration.languageChoices.options.find((e=>e.value===this._model.language))||this._configuration.languageChoices.options.push({value:this._model.language,label:this._model.language})):delete this._model.language,this.render()}onModelChanged(e){this._model=e,this.render(),this.dispatchEvent(new m(this._model,!1))}onConfigurationChanged(e){this._configuration=e,this.render()}connectedCallback(){this.render()}insertImage(e){this.dispatchEvent(new C(e))}onDeleteImage(e,t){this.dispatchEvent(new b(e,t))}insertSound(e){this.dispatchEvent(new k(e))}onDeleteSound(e,t){this.dispatchEvent(new w(e,t))}render(){const e=Fi.createElement(Ai,{model:this._model,configuration:this._configuration,onModelChanged:this.onModelChanged.bind(this),onConfigurationChanged:this.onConfigurationChanged.bind(this),imageSupport:{add:this.insertImage.bind(this),delete:this.onDeleteImage.bind(this)},uploadSoundSupport:{add:this.insertSound.bind(this),delete:this.onDeleteSound.bind(this)}});qi.render(e,this,(()=>{Bi(this)}))}}Ui.__initStatic(),Ui.__initStatic2();export{Ui as default};
|