define("qui/utils/Form",{setDataToForm:function(e,t){"use strict";if("undefined"!=typeof t&&"FORM"===t.nodeName){var n,c,o,i,d;e=e||{};for(c in e)e.hasOwnProperty(c)&&"undefined"!=typeof t.elements[c]&&(d=t.elements[c],("checkbox"===d.type||"radio"===d.type)&&t.getElements('[name="'+c+'"]').set("checked",!1),!d.length||"checkbox"!==d[0].type&&"radio"!==d[0].type||t.getElements('[name="'+c+'"]').set("checked",!1));for(c in e)if(e.hasOwnProperty(c)&&"undefined"!=typeof t.elements[c])if(d=t.elements[c],"checkbox"!==d.type)if("text"!==d.type&&"hidden"!==d.type&&"TEXTAREA"!==d.nodeName&&"SELECT"!==d.nodeName)if(d.length)for(n=0,o=d.length;o>n;n++)("radio"===d[n].type||"checkbox"===d[n].type)&&(i=d[n].value,"array"!=typeOf(e[c])?i==e[c]&&(d[n].checked=!0):e[c].contains(i)&&(d[n].checked=!0));else d.value=e[c];else{if("boolean"==typeOf(e[c]))continue;d.value=e[c]}else{if(e[c]===!1||e[c]===!0){d.checked=e[c];continue}d.checked=e[c].toInt()?!0:!1}}},getFormData:function(e){"use strict";if("undefined"==typeof e||!e)return{};var t,n,c,o,i={},d=e.elements;for(t=0,c=d.length;c>t;t++)if(o=d[t],n=o.name,"checkbox"!==o.type)if("radio"!==o.type||o.length){if("radio"===o.type&&o.length)for(t=0,c=o.length;c>t;t++)"radio"===o[t].type&&(i[o[t].name]="",o[t].checked&&(i[o[t].name]=o[t].value));i[n]=o.value}else o.checked&&(i[n]=o.value);else{if(d[n].length){"undefined"==typeof i[o.name]&&(i[n]=[]),o.checked&&i[n].push(o.value);continue}i[n]=o.checked?!0:!1}return i},insertTextAtCursor:function(e,t){"use strict";var n,c,o=e.value;"undefined"!=typeof e.selectionStart&&"undefined"!=typeof e.selectionEnd?(n=e.selectionEnd,e.value=o.slice(0,e.selectionStart)+t+o.slice(n),e.selectionStart=e.selectionEnd=n+t.length):"undefined"!=typeof document.selection&&"undefined"!=typeof document.selection.createRange&&(e.focus(),c=document.selection.createRange(),c.collapse(!1),c.text=t,c.select())}});
//# sourceMappingURL=Form.js.map