@syncfusion/ej2-form-renderer 34.2.2 → 34.2.4

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.
@@ -1,11 +1,11 @@
1
1
  /*!
2
2
  * filename: ej2-form-renderer.min.js
3
- * version : 34.2.2
3
+ * version : 34.2.4
4
4
  * Copyright Syncfusion Inc. 2001 - 2025. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
7
7
  * licensing@syncfusion.com. Any infringement will be prosecuted under
8
8
  * applicable laws.
9
9
  */
10
- this.ej=this.ej||{},this.ej.formrenderer=function(e,t,n,r,a,i,o,s,l,d,c,u,p,h){"use strict";function m(e){for(var t=new Map,n=0,r=Object.keys(e.properties);n<r.length;n++){var a=r[n];t.set(a,e.properties[a])}var i,o=new Set,s=function(e){for(var n=[],r=0,a=e;r<a.length;r++)!function(e){if("field"===e.type){var r=e;if(o.has(r.propertyId))return"continue";o.add(r.propertyId);var a=t.get(r.propertyId);if(a)n.push(f(a));else{var i={id:r.propertyId||w("textbox"),name:S(""),type:"textbox",label:"Unknown Field",_configured:!0};n.push(i)}}else if("table"===e.type){var l=e,d=C({id:l.id||w("table"),name:l.name,type:"table",label:l.label||"Table",cssClass:l.cssClass,hideBorders:l.hideBorders,rows:l.rows,columns:l.cols,columnWidths:l.columnWidths,tableCells:[],_configured:!0},l.conditions?{conditions:l.conditions}:{});l.cells.forEach(function(e){var t=[];e.forEach(function(e){var n=s(e.children);t.push(n)}),d.tableCells.push(t)}),n.push(d)}else if("panel"===e.type){var c=e,u=C({id:c.id||w("panel"),type:"panel",name:c.name,cssClass:c.cssClass,hideBorders:c.hideBorders,hideLabel:c.hideLabel,label:c.label||"Panel",children:s(c.children),_configured:!0},c.conditions?{conditions:c.conditions}:{});n.push(u)}else if("tabs"===e.type){var p=e,h=C({id:p.id||w("tabs"),type:"tabs",name:p.name,label:p.label||"Tabs",cssClass:p.cssClass,tabOptions:p.tabOptions,tabItems:[],_configured:!0},p.conditions?{conditions:p.conditions}:{});p.tabs.forEach(function(e){h.tabItems.push({header:e.header,content:s(e.children)})}),n.push(h)}else if("card"===e.type){var m=e,v=C({id:m.id||w("card"),type:"card",name:m.name,label:m.label||"Card",cssClass:m.cssClass,hideLabel:m.hideLabel,children:s(m.children),_configured:!0},m.conditions?{conditions:m.conditions}:{});void 0!==m.cardTitle&&(v.cardTitle=m.cardTitle),void 0!==m.cardSubtitle&&(v.cardSubtitle=m.cardSubtitle),n.push(v)}}(a[r]);return n};return i=e.layout&&0!==e.layout.length?s(e.layout):Object.keys(e.properties).map(function(t){return f(e.properties[t])}),C({version:e.version,components:i},e.settings?{settings:e.settings}:{})}function f(e){var t=void 0!==e.options&&e.options.length>0,n={id:e.id||w(e.widget||v(e.type,e.format,t)),name:e.name,type:e.widget||v(e.type,e.format,t),label:e.label||e.id},r=new Set(["id","type","name","label","format","widget","defaultValue","required","options","expressionValue","minLength","maxLength","minimum","maximum","minValue","maxValue","minDate","maxDate","minTime","maxTime","regex","pattern","content","buttonType","textboxType"]);return Object.keys(e).forEach(function(t){r.has(t)||"id"===t||"name"===t||"type"===t||"label"===t||(n[t]=e[t])}),void 0!==e.defaultValue&&(n.defaultValue=e.defaultValue),void 0!==e.expressionValue&&(n.expressionValue=e.expressionValue),void 0!==e.required&&(n.required=e.required),void 0!==e.content&&(n.content=e.content),void 0!==e.buttonType&&(n.buttonType=e.buttonType),void 0!==e.textboxType&&(n.textboxType=e.textboxType),void 0!==e.options&&(n.options=e.options),void 0!==e.minLength&&(n.minLength=e.minLength),void 0!==e.maxLength&&(n.maxLength=e.maxLength),void 0!==e.minValue&&(n.minValue=e.minValue),void 0!==e.maxValue&&(n.maxValue=e.maxValue),void 0!==e.minDate&&(n.minDate=e.minDate),void 0!==e.maxDate&&(n.maxDate=e.maxDate),void 0!==e.minTime&&(n.minTime=e.minTime),void 0!==e.maxTime&&(n.maxTime=e.maxTime),void 0!==e.pattern&&(n.regex=e.pattern),n}function v(e,t,n){return"string"===e?"date"===t?"date":"date-time"===t?"dateTime":"time"===t?"time":"email"===t?"email":"url"===t?"url":n?"dropdown":"textbox":"number"===e?"number":"boolean"===e?"checkbox":"array"===e?"multiselect":"button"===e?"button":"message"===e?"message":"sign"===e?"signature":"image"===e?"imageEditor":"file"===e?"fileUpload":"color"===e?"colorPicker":"grid"===e?"dataGrid":"textbox"}function y(e){var t=e.map(function(e){return null===e?NaN:Number(e)}),n=t.reduce(function(e,t){return e+(isNaN(t)?0:t)},0),r=Math.max(0,Math.round(100-n)),a=t.map(function(e,t){return isNaN(e)?t:-1}).filter(function(e){return e>=0}),i=a.length;if(0===i)return t.map(function(e){return Math.round(e)});var o=Math.floor(r/i),s=r-o*i;return a.forEach(function(e){var n=s>0?o+1:o;t[e]=n,s=Math.max(0,s-1)}),t.map(function(e){return isNaN(e)?0:Math.round(e)})}function g(e,n){var r=new t.Internationalization,a=r.getDateFormat({format:"MM/dd/yyyy",type:"date"});return"date"===e.type&&(n=a(new Date(n))),"time"===e.type&&(n=(a=r.getDateFormat({format:"hh:mm a",type:"time"}))(new Date(n))),"dateTime"===e.type&&(n=(a=r.getDateFormat({format:"MM/dd/yyyy hh:mm a",type:"dateTime"}))(new Date(n))),"dateRange"===e.type&&Array.isArray(n)&&(n=n.map(function(e){return e?a(new Date(e)):null})),n}function b(e,t){var n="string"==typeof t&&t?t:"field_"+Date.now()+"_"+Math.floor(1e3*Math.random());if(null===e||void 0===e)return n;var r=String(e).trim();return r&&"__proto__"!==r&&"prototype"!==r&&"constructor"!==r?(r=r.replace(/[^A-Za-z0-9_-]/g,"_"),/^[A-Za-z_]/.test(r)||(r="f_"+r),r.length>100&&(r=r.slice(0,100)),"__proto__"===r||"prototype"===r||"constructor"===r?n:r):n}var x=function(){function e(){}return e.evaluateCondition=function(e,t){try{return"field"in e&&"operator"in e&&"value"in e?this.evaluateSimpleRule(e,t):"condition"in e&&"rules"in e&&this.evaluateCompositeRule(e,t)}catch(e){return!1}},e.evaluateSimpleRule=function(e,n){try{var r=n[e.field],a=e.operator.toLowerCase();if(void 0===r&&-1===["equal","equals","notequal","notequals","isempty","isnotempty"].indexOf(a))return!1;var i=Array.isArray(r),o=new t.Internationalization;switch(a){case"equal":case"equals":return r===e.value;case"notequal":case"notequals":return r!==e.value;case"startswith":return r.startsWith(e.value);case"doesnotstartswith":return!r.startsWith(e.value);case"greaterthan":case"lessthan":case"greaterthanorequal":case"lessthanorequal":var s=Number(r),l=Number(e.value);return!Number.isNaN(s)&&!Number.isNaN(l)&&("greaterthan"===a?s>l:"lessthan"===a?s<l:"greaterthanorequal"===a?s>=l:s<=l);case"dategreaterthan":case"datelessthan":var d=o.parseDate(r,{format:"MM/dd/yyyy"}),c=o.parseDate(e.value,{format:"MM/dd/yyyy"});return null!==d&&null!==c&&("dategreaterthan"===a?d>c:"datelessthan"===a?d<c:d<=c);case"timegreaterthan":case"timelessthan":var u=o.parseDate(r,{format:"hh:mm a",type:"time"}),p=o.parseDate(e.value,{format:"hh:mm a",type:"time"});if(null!==u&&null!==p){if("timegreaterthan"===a)return u>p;if("timelessthan"===a)return u<p}return!1;case"datetimegreaterthan":case"datetimelessthan":var h=o.parseDate(r,{format:"MM/dd/yyyy hh:mm a",type:"dateTime"}),m=o.parseDate(e.value,{format:"MM/dd/yyyy hh:mm a",type:"dateTime"});if(null!==h&&null!==m){if("datetimegreaterthan"===a)return h>m;if("datetimelessthan"===a)return h<m}return!1;case"contains":return i?"string"==typeof e.value&&-1!==e.value.indexOf(",")?(f=e.value.split(",").map(function(e){return e.trim()})).some(function(e){return-1!==r.indexOf(e)}):-1!==r.indexOf(e.value):-1!==String(r).indexOf(String(e.value));case"notcontains":if(i){if("string"==typeof e.value&&-1!==e.value.indexOf(",")){var f=e.value.split(",").map(function(e){return e.trim()});return!f.some(function(e){return-1!==r.indexOf(e)})}return-1===r.indexOf(e.value)}return-1===String(r).indexOf(String(e.value));case"isempty":return i?0===r.length:!r||0===String(r).length;case"isnotempty":return i?r.length>0:!!r&&String(r).length>0;default:return!1}}catch(e){return!1}},e.evaluateCompositeRule=function(e,t){var n=this;try{if(!Array.isArray(e.rules)||0===e.rules.length)return!1;var r=e.condition.toLowerCase();return"and"===r?e.rules.every(function(e){return n.evaluateCondition(e,t)}):"or"===r&&e.rules.some(function(e){return n.evaluateCondition(e,t)})}catch(e){return!1}},e.isFieldVisible=function(e,t){try{return!e||!e.visibleWhen||this.evaluateCondition(e.visibleWhen,t)}catch(e){return!0}},e.isFieldReadOnly=function(e,t){try{return!(!e||!e.readOnlyWhen)&&this.evaluateCondition(e.readOnlyWhen,t)}catch(e){return!1}},e.isFieldDisabled=function(e,t){try{return!(!e||!e.disabledWhen)&&this.evaluateCondition(e.disabledWhen,t)}catch(e){return!1}},e.isFieldHidden=function(e,t){try{return!(!e||!e.hideWhen)&&this.evaluateCondition(e.hideWhen,t)}catch(e){return!1}},e.isFieldRequired=function(e,t){try{return!(!e||!e.requiredWhen)&&this.evaluateCondition(e.requiredWhen,t)}catch(e){return!1}},e.getConditionalValue=function(e,t){try{if(!e||!e.setValueWhen)return;if(this.evaluateCondition(e.setValueWhen.condition,t))return e.setValueWhen.value;return}catch(e){return}},e.evaluateConditionalDataRules=function(e,t){if(!e||!Array.isArray(e))return-1;for(var n=0;n<e.length;n++){var r=e[n];if(this.evaluateCondition(r.condition,t))return n}return-1},e.getChoiceBasedOptions=function(e,t,n,r){try{var a=n&&n[r];if(null===a||void 0===a)return e.showAllWhenNotMapped?t:[];var i=String(a);return i in e.choiceMapping?e.choiceMapping[i].filter(function(e){return-1!==t.indexOf(e)}):e.showAllWhenNotMapped?t:[]}catch(e){return t}},e}(),C=function(){return(C=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)},w=function(e){return e+"_"+Date.now()+"_"+Math.floor(1e3*Math.random())},S=function(e){return e+"_"+Math.floor(1e3*Math.random())},E=function(){function e(){this.supportedFunctions=["SUM","AVG","MIN","MAX","COUNT","ROUND","FLOOR","CEIL","ABS","SQRT","UPPER","LOWER","CONCAT","LENGTH","TRIM","SUBSTRING","TODAY","AGE","DATEFORMAT","DATEDIFF","ADDDAYS","SUBDAYS","INCLUDES","CONTAINS","ISNAN","SUPPORTEDVALUESOF","TOSTRING","DATE","GETTIME","EVERY","SOME"],this.availableFields=new Map}return e.prototype.setAvailableFields=function(e){var t=this;this.availableFields.clear(),e.forEach(function(e){t.availableFields.set(e.name,e)})},e.prototype.validateFieldOperations=function(e){var t=[];if(0===this.availableFields.size)return t;for(var n,r=["-","*","/","%","^"],a=["-","*","/","%","^","+"],i=new Set,o=/(\{[^}]+\})/g;null!==(n=o.exec(e));){var s=n[0],l=s.slice(1,-1),d=this.availableFields.get(l);if(d){var c=n.index,u=c+s.length,p=e.substring(Math.max(0,c-10),c),h=e.substring(u,Math.min(e.length,u+10)),m=p.replace(/\s+$/,"").slice(-1),f=h.replace(/^\s+/,"").charAt(0),v=p.replace(/\s+$/,""),y=h.replace(/^\s+/,""),g=c-(p.length-v.length)-1,b=u+(h.length-y.length);if("string"===d.type&&!d.format){if(m&&-1!==r.indexOf(m)){x=g+":"+m;i.has(x)||(t.push("Cannot perform '"+m+"' operation on string field '{"+l+"}'"),i.add(x))}if(f&&-1!==r.indexOf(f)){x=b+":"+f;i.has(x)||(t.push("Cannot perform '"+f+"' operation on string field '{"+l+"}'"),i.add(x))}}if("date"===d.format||"date-time"===d.format||"time"===d.format){if(m&&-1!==a.indexOf(m)){x=g+":"+m;i.has(x)||(t.push("Cannot perform '"+m+"' operation on date field '{"+l+"}'"),i.add(x))}if(f&&-1!==a.indexOf(f)){var x=b+":"+f;i.has(x)||(t.push("Cannot perform '"+f+"' operation on date field '{"+l+"}'"),i.add(x))}}}}return t},e.prototype.validate=function(e){var t=[];if(!e||""===e.trim())return{valid:!0,errors:[]};(e.match(/\{/g)||[]).length!==(e.match(/\}/g)||[]).length&&t.push("Unbalanced braces in expression"),(e.match(/\(/g)||[]).length!==(e.match(/\)/g)||[]).length&&t.push("Unbalanced parentheses in expression");for(var n,r=/(\w+)\s*\(/g;null!==(n=r.exec(e));){var a=n[1].toUpperCase();a===a.toUpperCase()&&-1===this.supportedFunctions.indexOf(a)&&t.push("Unknown function: "+a)}var i=this.validateFieldOperations(e);return t.push.apply(t,i),{valid:0===t.length,errors:t}},e.prototype.compile=function(e,t){void 0===t&&(t={});try{if(t.availableFields&&Array.isArray(t.availableFields)&&this.setAvailableFields(t.availableFields),!this.validate(e).valid)return function(){return null};var n=e;return n=this.compileFieldReferences(n),n=t.isCustomValidation?this.compileInputReferences(n):n,n=this.compileBareFunctionCalls(n),n=this.compileMatrixExpressions(n),function(e){try{return new Function("context","\n try {\n return "+n+";\n } catch (e) {\n return null;\n }\n ")(e)}catch(e){return null}}}catch(e){return function(){return null}}},e.prototype.compileMatrixExpressions=function(e){var t=e,n=["PI","TRUE","FALSE","NULL","UNDEFINED","Math"],r=["SUM","AVG","MIN","MAX","COUNT","ROUND","FLOOR","CEIL","ABS","SQRT","UPPER","LOWER","CONCAT","LENGTH","TRIM","SUBSTRING","TODAY","AGE","DATEFORMAT","DATEDIFF","ADDDAYS","SUBDAYS"];return t=t.replace(/\$?\{([^}]+)\}/g,function(e,t){var a=t;return r.forEach(function(e){var t=new RegExp("(?<!context\\.)\\b"+e+"\\b(?=\\s*\\()","g");a=a.replace(t,"context."+e)}),n.forEach(function(e){var t=new RegExp("\\b"+e+"\\b","g");a=a.replace(t,"context."+e)}),"("+a+")"})},e.prototype.compileBareFunctionCalls=function(e){var t=e;return["SUM","AVG","MIN","MAX","COUNT","ROUND","FLOOR","CEIL","ABS","SQRT","UPPER","LOWER","CONCAT","LENGTH","TRIM","SUBSTRING","TODAY","AGE","DATEFORMAT","DATEDIFF","ADDDAYS","SUBDAYS"].forEach(function(e){var n=new RegExp("(?<!context\\.)\\b"+e+"\\b(?=\\s*\\()","g");t=t.replace(n,"context."+e)}),t},e.prototype.compileFieldReferences=function(e){var t=e;return t=t.replace(/\{([^{}]+)\}/g,function(e,t){return t.startsWith("\\")&&t.endsWith("\\")?e:"context['"+t.replace(/\./g,"'].[")+"']"})},e.prototype.compileInputReferences=function(e){var t=[],n=e,r=n=(n=(n=n.replace(/(['"`])(?:(?=(\\?))\2.)*?\1/g,function(e){return t.push(e),"__STRING_"+(t.length-1)+"__"})).replace(/(?<!context\[')\binput\./g,"context['input'].")).replace(/(?<!context\[')\binput\b(?!\s*[(\.])/g,"context['input']");return t.forEach(function(e,t){r=r.replace("__STRING_"+t+"__",e)}),r},e}(),T=function(){function e(){this.escapedBracePattern=/\\{.*?\\}/g}return e.prototype.extractFieldReferences=function(e){if(!e)return[];for(var t,n=new Set,r=e.replace(this.escapedBracePattern,""),a=/\{([^{}]+)\}/g;null!==(t=a.exec(r));){var i=t[1].trim();if(!this.isFunctionCall(i)&&!this.isOperator(i)){var o=i.split(/[.\[\]]/)[0].trim();o&&!this.isKeyword(o)&&n.add(o)}}for(var s=/\$\{([^}]+)\}/g;null!==(t=s.exec(r));)for(var l=t[1],d=/\b([a-zA-Z_][a-zA-Z0-9_]*)\b(?!\s*[(\.])/g,c=void 0;null!==(c=d.exec(l));){var u=c[1];this.isKeyword(u)||"Math"===u||n.add(u)}return Array.from(n)},e.prototype.buildGraph=function(e){for(var t={},n=0,r=Object.keys(e);n<r.length;n++){var a=r[n],i=this.extractFieldReferences(e[a]);t[a]=i}return t},e.prototype.detectCircularDependencies=function(e){for(var t=new Set,n=new Set,r=[],a=function(i,o){t.add(i),n.add(i),o.push(i);for(var s=0,l=e[i]||[];s<l.length;s++){var d=l[s];if(t.has(d)){if(n.has(d)){var c=o.indexOf(d);r.push(o.slice(c).concat([d]))}}else a(d,o.slice())}n.delete(i)},i=0,o=Object.keys(e);i<o.length;i++){var s=o[i];t.has(s)||a(s,[])}return r},e.prototype.getTopologicalOrder=function(e){for(var t=new Set,n=[],r=function(a){if(!t.has(a)){t.add(a);for(var i=0,o=e[a]||[];i<o.length;i++){var s=o[i];e[s]&&r(s)}n.push(a)}},a=0,i=Object.keys(e);a<i.length;a++){var o=i[a];r(o)}return n},e.prototype.isFunctionCall=function(e){return/^\w+\s*\(/.test(e)},e.prototype.isOperator=function(e){return/^[+\-*/()=!<>&|]/.test(e)},e.prototype.isKeyword=function(e){return-1!==["PI","TRUE","FALSE","NULL","UNDEFINED","and","or","in"].indexOf(e.toUpperCase())},e}(),A=function(){return(A=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)},D=function(){function e(){this.evaluationCache=new Map,this.compiledFunctions=new Map,this.parser=new E,this.dependencyTracker=new T}return e.prototype.evaluate=function(e,t,n,r){void 0===n&&(n={}),void 0===r&&(r=!1);try{if(!e||""===e.trim())return null;var a=n.timeout,i=void 0===a?5e3:a,o=n.maxDepth,s=void 0===o?10:o,l=n.locale,d=void 0===l?"en-US":l,c=n.throwOnError,u=void 0!==c&&c,p=this.getCacheKey(e,t);if(!r&&this.evaluationCache.has(p))return this.evaluationCache.get(p);var h=this.compiledFunctions.get(e);h||(h=this.parser.compile(e,{timeout:i,maxDepth:s,locale:d,isCustomValidation:r}),this.compiledFunctions.set(e,h));var m=this.buildContext(t),f=Date.now(),v=h(m);if(Date.now()-f>i){var y=new Error("Expression evaluation exceeded timeout of "+i+"ms");if(u)throw y;return null}return this.evaluationCache.set(p,v),v}catch(y){if(n.throwOnError)throw y;return null}},e.prototype.extractDependencies=function(e){return e?this.dependencyTracker.extractFieldReferences(e):[]},e.prototype.buildDependencyGraph=function(e){var t=this,n={};return e.forEach(function(e){if(e.expressionValue){var r=t.extractDependencies(e.expressionValue);n[e.name]=r}}),n},e.prototype.detectCircularDependencies=function(e){for(var t=new Set,n=new Set,r=[],a=function(i,o){t.add(i),n.add(i),o.push(i);for(var s=0,l=e[i]||[];s<l.length;s++){var d=l[s];if(t.has(d)){if(n.has(d)){var c=o.indexOf(d);r.push(o.slice(c).concat([d]))}}else a(d,o.slice())}n.delete(i)},i=0,o=Object.keys(e);i<o.length;i++){var s=o[i];t.has(s)||a(s,[])}return r},e.prototype.getTopologicalOrder=function(e){for(var t=new Set,n=[],r=function(a){if(!t.has(a)){t.add(a);for(var i=0,o=e[a]||[];i<o.length;i++)r(o[i]);n.push(a)}},a=0,i=Object.keys(e);a<i.length;a++){var o=i[a];r(o)}return n},e.prototype.clearCache=function(){this.evaluationCache.clear(),this.compiledFunctions.clear()},e.prototype.getCacheKey=function(e,t){return e+":"+JSON.stringify(t)},e.prototype.buildContext=function(e){var n=new t.Internationalization,r=n.getDateFormat({format:"MM/dd/yyyy",type:"date"});return A({},e,{PI:Math.PI,TRUE:!0,FALSE:!1,NULL:null,UNDEFINED:void 0,Math:Math,SUM:function(e){return Array.isArray(e)?e.reduce(function(e,t){return Number(e)+Number(t)},0):0},AVG:function(e){return Array.isArray(e)&&0!==e.length?e.reduce(function(e,t){return Number(e)+Number(t)},0)/e.length:0},MIN:function(e){return Array.isArray(e)&&e.length>0?Math.min.apply(Math,e.map(Number)):0},MAX:function(e){return Array.isArray(e)&&e.length>0?Math.max.apply(Math,e.map(Number)):0},COUNT:function(e){return Array.isArray(e)?e.length:0},ROUND:function(e,t){return void 0===t&&(t=0),Math.round(e*Math.pow(10,t))/Math.pow(10,t)},FLOOR:Math.floor,CEIL:Math.ceil,ABS:Math.abs,SQRT:Math.sqrt,UPPER:function(e){return String(e).toUpperCase()},LOWER:function(e){return String(e).toLowerCase()},CONCAT:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.map(String).join("")},LENGTH:function(e){return String(e).length},TRIM:function(e){return String(e).trim()},SUBSTRING:function(e,t,n){return void 0!==n?String(e).substr(t,n):String(e).substr(t)},TODAY:function(){return r(new Date)},AGE:function(e){var t="string"==typeof e?new Date(e):e,n=new Date,r=n.getFullYear()-t.getFullYear(),a=n.getMonth()-t.getMonth();return(a<0||0===a&&n.getDate()<t.getDate())&&r--,r},DATEFORMAT:function(e,t){var r="string"==typeof e?new Date(e):e;return n.getDateFormat({format:t,type:"date"})(r)},DATEDIFF:function(e,t){var n="string"==typeof e?new Date(e):e,r="string"==typeof t?new Date(t):t;return Math.floor((r.getTime()-n.getTime())/864e5)},ADDDAYS:function(e,t){var n=new Date(e);return n.setDate(n.getDate()+Number(t)),r(n)},SUBDAYS:function(e,t){var n=new Date(e);return n.setDate(n.getDate()-Number(t)),r(n)}})},e}(),V={EMAIL:/^(?!.*\.\.)[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/,URL:/^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\/[^\s]*)?$/,DATE_ISO:/^([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/,DIGITS:/^[0-9]*$/,PHONE:/^[+]?[0-9]{9,13}$/,CREDIT_CARD:/^\d{13,16}$/},O=function(e){return{primary:"e-primary",flat:"e-flat",information:"e-info",error:"e-danger",success:"e-success",warning:"e-warning"}[e||"primary"]||"e-primary"},I=function(e){return"submit"===e||"reset"===e?e:"button"},F=function(e){return{Left:"flex-start",Right:"flex-end",Center:"center"}[e||"Left"]||"flex-start"},R=function(e){switch(e){case"WebApiAdaptor":return new p.WebApiAdaptor;case"ODataV4Adaptor":return new p.ODataV4Adaptor;case"UrlAdaptor":default:return new p.UrlAdaptor}},k=function(e,t){if(!t||null===e||void 0===e)return e;for(var n=e,r=0,a=t.split(/\.(?![^\[]*\])/);r<a.length;r++){var i=a[r];if(null===n||void 0===n)return null;var o=i.match(/^(\w*)\[(\d+)\]$/);if(o){var s=o[1],l=parseInt(o[2]);n=s?n[s]&&n[s][l]:n[l]}else n=n[i]}return n},N=function(e,t){var n={},r=function(t){t.forEach(function(t){t.name&&t.id in e&&(n[t.name]=e[t.id]),t.children&&r(t.children),t.tabItems&&t.tabItems.forEach(function(e){return e.content&&r(e.content)}),t.tableCells&&t.tableCells.forEach(function(e){return e.forEach(function(e){return r(e)})})})};return r(t),n},M=new D,L=function(e,t,n){if("string"!=typeof e||!/{[^}]+}/.test(e))return e;var r=n?N(t,n):t;try{var a=M.evaluate(e,r);return null!==a&&void 0!==a?String(a):""}catch(t){return e}},P=function(e,t,n){return e&&"object"==typeof e&&!Array.isArray(e)&&"lookup"===e.type&&n?n&&n.length>0?n:[]:e&&"object"==typeof e&&!Array.isArray(e)&&"url"===e.type?t.length>0?t:[]:Array.isArray(e)?e:e&&"object"==typeof e&&!Array.isArray(e)&&"raw"===e.type&&Array.isArray(e.data)?e.data:[]},j=function(e,t){if(e&&e.conditionalData&&Array.isArray(e.conditionalData))for(var n=0,r=e.conditionalData;n<r.length;n++){var a=r[n];if(x.evaluateCondition(a.condition,t))return{dataSource:a.dataSource,columns:a.columns&&a.columns.length>0?a.columns:void 0}}},B=function(){function e(){}return e.fetch=function(e,t,n,r){if(!(e&&"object"==typeof e&&!Array.isArray(e)&&"url"===e.type&&e.url))return Promise.resolve({id:t,options:[]});var a=e;return new Promise(function(e){try{var i={};a.headers&&Array.isArray(a.headers)&&a.headers.forEach(function(e){e.key&&e.key.trim()&&(i[e.key]=e.value)});var o=new p.DataManager({url:a.url,adaptor:R(a.adaptorType),headers:Object.keys(i).length?i:void 0}),s=new p.Query;if(a.search&&a.search.enabled&&a.search.fields&&a.search.fields.length>0){var l=a.search.key||"search",d=n?L(l,n,r):/[{}]/.test(l)?"":l;s=s.search(d,a.search.fields)}if(a.sort&&a.sort.enabled&&a.sort.field){var c="descending"===a.sort.direction?"descending":"ascending";s=s.sortBy(a.sort.field,c)}a.filters&&Array.isArray(a.filters)&&a.filters.length>0&&a.filters.forEach(function(e){if(e.field&&e.operator&&void 0!==e.value&&""!==e.value){var t=n?L(e.value,n,r):/[{}]/.test(e.value)?"":e.value;""!==t&&(s=s.where(e.field,e.operator,t))}}),a.queryParams&&Object.keys(a.queryParams).forEach(function(e){s=s.addParams(e,a.queryParams[e])}),a.skip&&(s=s.skip(a.skip)),a.take&&(s=s.take(a.take));var u=!1,h=setTimeout(function(){u=!0,e({id:t,options:[]})},15e3);o.executeQuery(s).then(function(n){if(!u){clearTimeout(h);var r=n.result;a.dataPath&&(r=k(r,a.dataPath));var i;i=Array.isArray(r)?r:"string"==typeof r?[r]:[],e({id:t,options:i})}}).catch(function(n){u||(clearTimeout(h),e({id:t,options:[]}))})}catch(n){e({id:t,options:[]})}})},e}(),U=function(e){return e?Array.isArray(e)?e.reduce(function(e,t){return t&&t.key&&void 0!==t.value&&(e[t.key]=t.value),e},{}):e:{}},_=function(){function e(e){this.checkboxes=[],this.component=e.component,this.formState=e.formState,this.onChangeCb=e.onChange,this.optionRef=e.optionRef,this.enableRtl=e.enableRtl,this.target=e.target,this.container=null,this.itemsContainer=null,this.ref=e.ref}return e.prototype.getSelectedItems=function(){var e=this.formState?this.formState.values[this.component.id]:t.isNullOrUndefined(this.valueProp())?this.component.defaultValue:this.valueProp();return Array.isArray(e)?e:[]},e.prototype.valueProp=function(){return this._value},e.prototype.setValue=function(e){this._value=e},e.prototype.handleCheckboxChange=function(e,t){var n=this.getSelectedItems(),r=t?n.concat([e]):n.filter(function(t){return t!==e});this.formState&&this.onChangeCb(r)},Object.defineProperty(e.prototype,"sizeCssClass",{get:function(){return""+(this.component.cssClass||"")+("Small"===this.component.size?" e-small":"Bigger"===this.component.size?" e-bigger":"")},enumerable:!0,configurable:!0}),e.prototype.render=function(e){var t=this,n=this.component,r=n.label&&n.required?n.label+" *":n.label||"",a=e||this.target,o=document.createElement("div");o.className=("checkbox-group "+(n.cssClass||"")).trim(),o.setAttribute("role","group"),o.setAttribute("aria-label",r),o.title=n.tooltip||"";var s=U(n.htmlAttributes);Object.keys(s).forEach(function(e){"class"!==e&&"className"!==e&&"style"!==e&&o.setAttribute(e,String(s[e]))});var l="display:flex;flex-direction:"+("row"===n.layoutDirection?"row":"column")+";gap:"+(n.gap||"8px")+";align-items:flex-start;";o.setAttribute("style",l);var d=document.createElement("div");d.className="checkbox-group-items";var c="display:flex;flex-direction:"+("row"===n.layoutDirection?"row":"column")+";flex-wrap:wrap;gap:"+(n.gap||"2px")+";width:100%;";d.setAttribute("style",c);var u=Array.isArray(n.options)?n.options:["Option 1"],p=this.getSelectedItems();return u.forEach(function(e,r){var a="string"==typeof e?e:null!=e.value?e.value:null!=e.label?e.label:e.key,o="string"==typeof e?e:null!=e.label?e.label:null!=e.value?e.value:String(a),l=document.createElement("div");d.appendChild(l);var c=new i.CheckBox({label:o,enableRtl:t.enableRtl,checked:-1!==p.indexOf(a),disabled:!!n.disabled,labelPosition:n.checkboxLabelPosition||"After",cssClass:t.sizeCssClass.trim(),htmlAttributes:s,change:function(e){t.handleCheckboxChange(a,e.checked)}});c.appendTo(l),t.ref(c,r);var u=l.querySelector('input[type="checkbox"]');u&&(u.id=t.component.id+"_"+r),t.optionRef&&t.optionRef(c,r),t.checkboxes.push(c)}),o.appendChild(d),a&&a.appendChild(o),this.container=o,this.itemsContainer=d,o},e.prototype.refreshSelection=function(){var e=this,t=this.getSelectedItems();(Array.isArray(this.component.options)?this.component.options:["Option 1"]).forEach(function(n,r){var a="string"==typeof n?n:null!=n.value?n.value:null!=n.label?n.label:n.key,i=e.checkboxes[r];i&&(i.checked=-1!==t.indexOf(a))})},e.prototype.destroy=function(){for(var e=0,t=this.checkboxes;e<t.length;e++){var n=t[e];try{n.destroy()}catch(e){}}this.checkboxes=[],this.container&&this.container.parentNode&&this.container.parentNode.removeChild(this.container),this.container=null,this.itemsContainer=null},e.prototype.setOptions=function(e){var t=this;if(this.component.options=e,this.itemsContainer){for(var n=0,r=this.checkboxes;n<r.length;n++){var a=r[n];try{a.destroy()}catch(e){}}for(this.checkboxes=[];this.itemsContainer.firstChild;)this.itemsContainer.removeChild(this.itemsContainer.firstChild);var o=this.getSelectedItems();e.forEach(function(e,n){var r="string"==typeof e?e:e.value||e.label||e.key,a="string"==typeof e?e:e.label||e.value||String(r),s=document.createElement("div");t.itemsContainer.appendChild(s);var l=new i.CheckBox({label:a,enableRtl:t.enableRtl,checked:-1!==o.indexOf(r),disabled:!!t.component.disabled,labelPosition:t.component.checkboxLabelPosition||"After",cssClass:t.sizeCssClass.trim(),change:function(e){t.handleCheckboxChange(r,e.checked)}});l.appendTo(s),t.ref(l,n);var d=s.querySelector('input[type="checkbox"]');d&&(d.id=t.component.id+"_"+n),t.optionRef&&t.optionRef(l,n),t.checkboxes.push(l)})}},e}(),z=function(){return(z=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)},W=function(){function e(){this.engine=new D}return e.prototype.parseColumnValue=function(e,t){if(null===e||void 0===e||""===e)return e;if("number"===t){var n=parseFloat(String(e));return isNaN(n)?0:n}return"boolean"===t?"boolean"==typeof e?e:"true"===e||"1"===e||1===e||!0===e:e},e.prototype.evaluateRowExpressions=function(e,t){for(var n=this,r=z({},e),a=this,i=0,o=t.filter(function(e){return e.expression&&e.expression.toString().trim()});i<o.length;i++)!function(e){if(!e.expression)return"continue";try{var i={};t.forEach(function(e){var t=r[e.field];i[e.field]=n.parseColumnValue(t,e.type)});var o=a.engine.evaluate(e.expression,i,{throwOnError:!1});r[e.field]=o}catch(t){r[e.field]=null}}(o[i]);return r},e.prototype.extractCalculatedColumns=function(e){return e.filter(function(e){return e.expression&&e.expression.toString().trim()})},e.prototype.getEngine=function(){return this.engine},e}(),q=function(){return(q=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)},H=function(){function e(){this.expressionEngine=new D}return e.prototype.validate=function(e,t,n){if(!e||""===e.trim())return!0;try{var r=q({},n,{input:t,valid:!0}),a=e.match(/valid\s*=\s*(.+?)\s*\?\s*true\s*:\s*['"](.+?)['"]\s*$/);if(!a)return"Invalid validation expression format";var i=a[1].trim(),o=a[2];return!0===this.expressionEngine.evaluate(i,r,{throwOnError:!1},!0)||o}catch(e){return"Validation expression error"}},e.prototype.extractDependencies=function(e){if(!e)return[];var t=e.match(/valid\s*=\s*(.+)/),n=t?t[1]:e;return this.expressionEngine.extractDependencies(n).filter(function(e){return"input"!==e})},e.prototype.validateConditionSyntax=function(e,t){if(!e||""===e.trim())return["Condition cannot be empty"];var n=[],r=(e.match(/\(/g)||[]).length,a=(e.match(/\)/g)||[]).length;r!==a&&n.push("Unbalanced parentheses ("+r+" open, "+a+" close)");var i=(e.match(/\{/g)||[]).length,o=(e.match(/\}/g)||[]).length;i!==o&&n.push("Unbalanced braces ("+i+" open, "+o+" close)");var s=this.extractDependencies(e).filter(function(e){return-1===t.indexOf(e)});return s.length>0&&n.push("Unknown field references: "+s.join(", ")),n},e.prototype.buildExpression=function(e,t){return"valid = "+e.trim()+" ? true : '"+t.replace(/'/g,"\\'")+"'"},e.prototype.parseExpression=function(e){var t=e.match(/valid\s*=\s*(.+?)\s*\?\s*true\s*:\s*'(.+)'/);return t?{condition:t[1].trim(),errorMessage:t[2].replace(/\\'/g,"'")}:null},e}(),G=function(){return(G=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)},$=function(){function e(e){var t=this;this.grid=null,this.wrapper=null,this.mapCustomValidationToSyncfusion=function(e){if(e.customValidation&&0!==e.customValidation.length)return function(n){var r=t.grid&&t.grid.editModule?t.grid.editModule.formObj:null;if(!r)return!0;var a={};(t.columns||[]).forEach(function(e){var t=r.getInputElement(e.field);if(t){var n=t.value;a[e.field]="number"===e.type?parseInt(n,10):n}});for(var i=0,o=e.customValidation;i<o.length;i++){var s=o[i];if(s.expression){var l="number"===e.type?parseInt(n.value,10):n.value;return!0===t.validationEngine.validate(s.expression,l,a)}}return!0}},this.createEditParams=function(e){if(t.hasExpressions){var n=t.calculatedColumns;if(n.some(function(t){return!!t.expression&&-1!==t.expression.indexOf("{"+e.field+"}")}))return{params:{change:function(){if(t.grid&&t.grid.element){var e=t.grid.element.querySelector("form");if(e&&e.ej2_instances&&e.ej2_instances[0]){var r=e.ej2_instances[0];n.forEach(function(e){var n=r.getInputElement(e.field);if(n)try{var a={};t.columns.forEach(function(e){var t=r.getInputElement(e.field);t&&(a[e.field]=t.value)});var i=t.gridExpressions.evaluateRowExpressions(a,t.columns)[e.field];if(void 0!==i&&null!==i)if("boolean"===e.type)n.checked=!!i;else if("number"===e.type){var o=n.closest(".e-control-wrapper"),s=o?o.querySelector('input.e-control:not([type="hidden"])'):null;s&&s.ej2_instances&&s.ej2_instances[0]?s.ej2_instances[0].value=i:n.value=i}else"date"===e.type?n.ej2_instances[0].value=new Date(i):n.value=i}catch(e){}})}}}}}}},this.handleActionComplete=function(e){if(t.grid)switch(e.requestType){case"save":case"delete":case"add":if(t.grid.dataSource){var n=Array.isArray(t.grid.dataSource)?t.grid.dataSource:[];t.currentData=n,t.onDataChange&&t.onDataChange(n)}}},this.id=e.id,this.columns=e.columns||[],this.dataSource=Array.isArray(e.dataSource)?e.dataSource:[],this.height=null!=e.height?e.height:"200px",this.width=null!=e.width?e.width:"100%",this.locale=e.locale,this.cssClass=e.cssClass,this.pageSize=null!=e.pageSize?e.pageSize:6,this.allowPaging=!1!==e.allowPaging,this.allowAdding=!1!==e.allowAdding,this.allowEditing=!1!==e.allowEditing,this.allowDeleting=!1!==e.allowDeleting,this.allowFiltering=!0===e.allowFiltering,this.onDataChange=e.onDataChange,this.isPreviewMode=e.isPreviewMode,this.enableRtl=e.enableRtl,this.ref=e.ref,this.currentData=Array.isArray(this.dataSource)?this.dataSource:[],this.gridExpressions=new W,this.validationEngine=new H}return Object.defineProperty(e.prototype,"calculatedColumns",{get:function(){return this.gridExpressions.extractCalculatedColumns(this.columns)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasExpressions",{get:function(){return this.calculatedColumns.length>0},enumerable:!0,configurable:!0}),e.prototype.buildToolbar=function(){var e=[];return this.allowAdding&&e.push("Add"),this.allowEditing&&e.push("Edit"),this.allowDeleting&&e.push("Delete"),e.push("Update","Cancel"),e},e.prototype.mapColumn=function(e){var t=e.validationRules?G({},e.validationRules):{},n=this.mapCustomValidationToSyncfusion(e);if(n){var r=e.customValidation&&e.customValidation[0]&&e.customValidation[0].expression?(this.validationEngine.parseExpression?this.validationEngine.parseExpression(e.customValidation[0].expression).errorMessage:"Validation failed")||"Validation failed":"Validation failed";t.required=[!0,r],t.custom=[n,r]}return{field:e.field,headerText:e.headerText,type:e.type||"string",isPrimaryKey:e.isPrimaryKey||!1,width:e.width,format:"date"===e.type?e.format||"MM/dd/yyyy":e.format,editType:e.editType,allowEditing:!1!==e.allowEditing&&!e.expression,validationRules:t,edit:this.createEditParams(e)}},e.prototype.render=function(e){var t=this,n=Array.isArray(this.dataSource)?this.dataSource:[];this.hasExpressions&&n.length>0?this.currentData=n.map(function(e){var n=t.gridExpressions.evaluateRowExpressions(e,t.columns);return G({},e,n)}):this.currentData=n;var r=document.createElement("div");r.className="datagrid-wrapper",r.style.width="string"==typeof this.width?this.width:this.width+"px",r.style.height="auto";var a=document.createElement("div");a.className="datagrid-grid",r.appendChild(a),this.id&&(a.id=this.id);var i=new h.Grid({dataSource:this.currentData,allowPaging:this.allowPaging,filterSettings:{mode:"Immediate"},pageSettings:{pageSize:this.pageSize},editSettings:{allowEditing:this.allowEditing,allowAdding:this.allowAdding,allowDeleting:this.allowDeleting,mode:"Normal"},enableRtl:this.enableRtl,locale:this.locale||"en-US",cssClass:this.cssClass,toolbar:this.buildToolbar(),actionComplete:this.handleActionComplete,height:"string"==typeof this.height?this.height:this.height+"px",width:"string"==typeof this.width?this.width:this.width+"px",allowSorting:!0,allowFiltering:this.allowFiltering,allowSelection:!0,columns:(this.columns||[]).map(function(e){return t.mapColumn(e)})});return i.appendTo(a),this.ref(i),this.grid=i,e&&e.appendChild(r),this.wrapper=r,r},e.prototype.getRef=function(){var e=this;return{getGridData:function(){return e.currentData},gridRef:{current:this.grid}}},e.prototype.getGridData=function(){return this.currentData},e.prototype.setDataSource=function(e){var t=this;if(this.grid){var n=Array.isArray(e)?e:[];this.hasExpressions&&n.length>0?this.currentData=n.map(function(e){var n=t.gridExpressions.evaluateRowExpressions(e,t.columns);return G({},e,n)}):this.currentData=n,this.grid.dataSource=this.currentData,this.grid.refreshBatchData?this.grid.setProperties({dataSource:this.currentData},!0):this.grid.dataSource=this.currentData,this.grid.refresh&&this.grid.refresh()}},e.prototype.setColumns=function(e){this.grid&&(e&&0!==e.length?0===this.grid.columns.length&&e&&1===e.length&&(this.grid.columns=e):this.grid.columns=[],this.columns=e,this.grid.refresh&&!this.isPreviewMode&&(this.dataSource&&Array.isArray(this.dataSource)&&this.dataSource.length>0&&!this.hasExpressions&&(this.grid.dataSource=this.dataSource),this.grid.refresh()))},e.prototype.destroy=function(){if(this.grid){try{this.grid.destroy()}catch(e){}this.grid=null}this.wrapper&&this.wrapper.parentNode&&this.wrapper.parentNode.removeChild(this.wrapper),this.wrapper=null,this.gridExpressions=null,this.validationEngine=null,this.currentData=[],this.columns=[],this.dataSource=[]},e}();h.Grid.Inject(h.Edit,h.Toolbar,h.Page,h.Resize,h.Sort,h.Filter);var J=function(){return(J=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)},Y=function(e){return e?Array.isArray(e)?e.reduce(function(e,t){return t&&t.key&&void 0!==t.value&&(e[t.key]=t.value),e},{}):e:{}},Z=function(e,t){e&&t&&e.setAttribute("id",t)},K=function(e){var n=e.component,r=e.value,p=e.onChange,h=e.onBlur,m=e.onClick,f=e.hasError,v=void 0!==f&&f,y=e.locale,g=e.formState,b=e.settings,C=e.components,w=e.enableRtl,S=e.ref,E=e.l10n,T=e.initializedGrids||new Set,A=e.target,D={floatLabelType:n.floatLabelType||"Never",placeholder:n.placeholder||"",enabled:!n.disabled},V=function(e){var t=n.validateOn||"Change",r={};return t&&"Change"!==t||(r.change=function(t){return p(e(t))},r.blur=function(){h&&h()}),"Blur"===t&&(r.change=function(t){return p(e(t))},r.blur=function(){h&&h()}),r},R=Y(n.htmlAttributes);n.required&&(R["aria-required"]="true");var k=v?"e-error":"",N=((n.cssClass||"")+" "+k+" "+("Small"===n.size?" e-small":"Bigger"===n.size?" e-bigger":"")).trim();switch(n.type){case"textbox":var M=new a.TextBox(J({id:n.name,type:n.multiline?"hidden":n.textboxType?n.textboxType:"text",name:n.id,enableRtl:w,locale:y,floatLabelType:D.floatLabelType,placeholder:D.placeholder,enabled:D.enabled,value:void 0!==r?r:n.defaultValue||"",multiline:n.multiline,showClearButton:n.showClearButton,autocomplete:!1===n.autocomplete||void 0===n.autocomplete?"off":"on",readonly:n.readOnly||!1,cssClass:N,htmlAttributes:R,appendTemplate:n.suffix,prependTemplate:n.prefix},V(function(e){return e.value||""})));return A&&M.appendTo(A),S(M),M;case"textarea":var L=new a.TextArea(J({id:n.name,name:n.id,enableRtl:w,locale:y,floatLabelType:D.floatLabelType,placeholder:D.placeholder,enabled:D.enabled,value:void 0!==r?r:n.defaultValue||"",cols:n.cols||200,rows:n.textareaRows||4,showClearButton:n.showClearButton||!1,readonly:n.readOnly||!1,maxLength:n.maxLength||255,cssClass:N,htmlAttributes:R,appendTemplate:n.suffix,prependTemplate:n.prefix,resizeMode:"Vertical"},V(function(e){return e.value||""})));return A&&L.appendTo(A),S(L),L;case"number":var U=""===r?void 0:r,z=new a.NumericTextBox({locale:y,enableRtl:w,floatLabelType:D.floatLabelType,placeholder:D.placeholder,enabled:D.enabled,value:void 0!==U?U:n.defaultValue||void 0,decimals:n.decimals||2,currency:n.currency,format:n.numberFormat||"n2",step:n.step||1,min:n.minValue||void 0,max:n.maxValue||void 0,readonly:n.readOnly||!1,showClearButton:n.showClearButton||!1,cssClass:N,htmlAttributes:R,appendTemplate:n.suffix,prependTemplate:n.prefix,change:function(e){return p(e.value)}});return A&&(Z(A,n.name),A.setAttribute("name",n.id),z.appendTo(A)),S(z),z;case"checkbox":var W=n.label&&n.required?n.label+" *":n.label,q=new i.CheckBox({locale:y,name:n.id,enableRtl:w,label:W,labelPosition:n.checkboxLabelPosition,checked:void 0!==n.checked&&null!==n.checked&&n.checked||void 0!==r&&null!==r&&r,indeterminate:n.indeterminate||!1,disabled:n.disabled,cssClass:N,htmlAttributes:R,change:function(e){return p(e.checked)}});return A&&(Z(A,n.name),q.appendTo(A)),S(q),q;case"checkboxGroup":var H=[];B.fetch(n.options,n.id,g?g.values:void 0,C).then(function(e){e.id===n.id&&e.options.length>0&&(H.push.apply(H,e.options),Q.setOptions(H))}).catch(function(){});var G=P(n.options,H),K=G.length>0?G:n.options||["Option 1"],Q=new _({component:J({},n,{options:K}),formState:g,value:r,enableRtl:w,onChange:function(e){return p(e)},optionRef:e.ref,target:A,ref:S});return A&&Z(A,n.name),Q.render(A),Q;case"radio":var X=Array.isArray(n.options)?n.options:["Option 1"],ee=t.createElement("div",{id:n.name+"-group",className:"e-radio-group "+k}),te=[];return X.forEach(function(a,o){var s=a,l=a,d=t.createElement("div");d.style.marginBottom="8px",ee.appendChild(d);var c=t.createElement("input",{id:n.name+"_"+o+"_"+s,attrs:{type:"radio"}});d.appendChild(c);var u=new i.RadioButton({name:n.id,label:l,enableRtl:w,locale:y,disabled:n.disabled,value:s,htmlAttributes:R,labelPosition:n.fieldLabelPosition,checked:n.defaultValue===s||r===s,cssClass:N,change:function(e){e.value===s&&p(s)}});u.appendTo(c),S(u,o),e.ref&&"function"==typeof e.ref&&e.ref(u,o)}),A&&A.appendChild(ee),te;case"dropdown":var ne=[];B.fetch(n.options,n.id,g?g.values:void 0,C).then(function(e){e.id===n.id&&e.options.length>0&&(ne.push.apply(ne,e.options),ie.dataSource=ne)}).catch(function(){});var re=P(n.options,ne),ae=re.length>0?re:n.options||["Option 1"];n.conditions&&n.conditions.choiceBasedField&&(ae=x.getChoiceBasedOptions(n.conditions.choiceBasedField,ae,g?g.values:void 0,n.conditions.choiceBasedField.primaryFieldId)).length>0&&null!=r&&-1===ae.indexOf(r)&&g&&(g.values[n.id]=null);var ie=new s.DropDownList(J({id:n.name,name:n.id,floatLabelType:D.floatLabelType,placeholder:D.placeholder,enabled:D.enabled,locale:y,enableRtl:w,cssClass:N,dataSource:ae,value:void 0!==g.values[n.id]?g.values[n.id]:void 0!==n.defaultValue&&null!==n.defaultValue?n.defaultValue:null,showClearButton:n.showClearButton||!1,readonly:n.readOnly||!1,enableVirtualization:n.enableVirtualization||!1,popupHeight:n.popupHeight||"300px",popupWidth:n.popupWidth||"100%",htmlAttributes:R},V(function(e){return e.value||""})));return s.DropDownList.Inject(s.VirtualScroll),A&&ie.appendTo(A),S(ie),ie;case"multiselect":var oe=[];B.fetch(n.options,n.id,g?g.values:void 0,C).then(function(e){e.id===n.id&&e.options.length>0&&(oe.push.apply(oe,e.options),de.dataSource=oe)}).catch(function(){});var se=P(n.options,oe),le=se.length>0?se:n.options||["Option 1"],de=new s.MultiSelect(J({name:n.id,enableRtl:w,locale:y,floatLabelType:D.floatLabelType,enabled:D.enabled,value:void 0!==r?r:void 0!==n.defaultValue&&null!==n.defaultValue?n.defaultValue:null,placeholder:n.placeholder,dataSource:le,fields:{text:"text",value:"value"},showClearButton:n.showClearButton||!1,readonly:n.readOnly||!1,allowCustomValue:n.allowCustomValue||!1,addTagOnBlur:n.addTagOnBlur||!1,delimiterChar:n.delimiterChar||",",showSelectAll:n.showSelectAll||!1,mode:n.showSelectAll?"CheckBox":n.visualMode?n.visualMode:void 0,selectAllText:n.selectAllText,unSelectAllText:n.unSelectAllText,showDropDownIcon:!1!==n.showDropDownIcon,enableVirtualization:n.enableVirtualization||!1,popupHeight:n.popupHeight||"300px",popupWidth:n.popupWidth||"100%",cssClass:N,htmlAttributes:R},V(function(e){return e.value||""})));return s.MultiSelect.Inject(s.CheckBoxSelection,s.VirtualScroll),A&&de.appendTo(A),S(de),de;case"date":var ce=new l.DatePicker(J({floatLabelType:D.floatLabelType,id:n.name,name:n.id,enableRtl:w,locale:y,placeholder:D.placeholder,enabled:D.enabled,value:void 0!==r?r:void 0!==n.defaultValue&&null!==n.defaultValue?n.defaultValue:null,format:n.format||"MM/dd/yyyy",readOnly:n.readOnly||!1,showClearButton:void 0!==n.showClearButton&&n.showClearButton,showTodayButton:!1!==n.showTodayButton,calendarMode:n.calendarMode||"Gregorian",dayHeaderFormat:n.dayHeaderFormat||"Short",depth:n.depth||"Month",start:n.start||"Month",firstDayOfWeek:n.firstDayOfWeek||0,min:n.minDate?new Date(n.minDate):void 0,max:n.maxDate?new Date(n.maxDate):void 0,cssClass:N,htmlAttributes:R},V(function(e){return e.value||""})));return l.DatePicker.Inject(l.Islamic),A&&ce.appendTo(A),S(ce),ce;case"dateTime":var ue=new l.DateTimePicker(J({id:n.name,floatLabelType:D.floatLabelType,placeholder:D.placeholder,enabled:D.enabled,locale:y,enableRtl:w,name:n.id,dayHeaderFormat:n.dayHeaderFormat||"Short",value:void 0!==r?r:void 0!==n.defaultValue&&null!==n.defaultValue?n.defaultValue:null,format:n.format||"MM/dd/yyyy hh:mm a",showClearButton:void 0!==n.showClearButton&&n.showClearButton,showTodayButton:!1!==n.showTodayButton,depth:n.depth||"Month",start:n.start||"Month",step:n.step||1,readonly:n.readOnly||!1,min:n.minDate?new Date(n.minDate):void 0,max:n.maxDate?new Date(n.maxDate):void 0,minTime:n.minTime?new Date("2000-01-01 "+n.minTime):void 0,maxTime:n.maxTime?new Date("2000-01-01 "+n.maxTime):void 0,enableMask:!1,cssClass:N,htmlAttributes:R},V(function(e){return e.value||""})));return l.DateTimePicker.Inject(l.Islamic),A&&ue.appendTo(A),S(ue),ue;case"time":var pe=new l.TimePicker(J({id:n.name,locale:y,name:n.id,enableRtl:w,floatLabelType:D.floatLabelType,placeholder:D.placeholder,enabled:D.enabled,value:void 0!==r?r:void 0!==n.defaultValue&&null!==n.defaultValue?n.defaultValue:null,format:n.format||"hh:mm a",showClearButton:void 0!==n.showClearButton&&n.showClearButton,step:n.step||30,readonly:n.readOnly||!1,min:n.minTime?new Date("2000-01-01 "+n.minTime):void 0,max:n.maxTime?new Date("2000-01-01 "+n.maxTime):void 0,enableMask:!1,cssClass:N,htmlAttributes:R},V(function(e){return e.value||""})));return A&&pe.appendTo(A),S(pe),pe;case"dateRange":var he=new l.DateRangePicker(J({id:n.name,locale:y,enableRtl:w,name:n.id,floatLabelType:D.floatLabelType,dayHeaderFormat:n.dayHeaderFormat||"Short",placeholder:D.placeholder,enabled:D.enabled,value:void 0!==r?r:void 0!==n.defaultValue&&null!==n.defaultValue?n.defaultValue:null,depth:n.depth||"Month",start:n.start||"Month",min:n.minDate?new Date(n.minDate):void 0,max:n.maxDate?new Date(n.maxDate):void 0,format:n.format||"MM/dd/yyyy",separator:n.separator||" - ",showClearButton:void 0!==n.showClearButton&&n.showClearButton,readonly:n.readOnly||!1,cssClass:N,htmlAttributes:R},V(function(e){return e.value||""})));return A&&he.appendTo(A),S(he),he;case"switch":var me=new i.Switch({locale:y,enableRtl:w,value:n.defaultValue,name:n.id,checked:void 0!==n.checked&&null!==n.checked&&n.checked||void 0!==r&&null!==r&&r,disabled:n.disabled,onLabel:n.onLabel||"",offLabel:n.offLabel||"",cssClass:N,htmlAttributes:R,change:function(e){return p(e.checked)}});return A&&(Z(A,n.name),me.appendTo(A)),S(me),me;case"button":var fe=n.buttonsGroups||n.buttons||[];if(fe&&fe.length>0){var ve={display:"flex",flexWrap:"wrap",alignItems:"center",gap:n.gap||"8px",justifyContent:F(n.position),width:n.width||void 0},ye=t.createElement("div",{id:n.name,attrs:{role:"group","aria-label":n.label||"Button Group",className:N+" "+(w?"e-rtl":"")}});Object.assign(ye.style,ve);var ge=[];return fe.forEach(function(r,a){var o=n.name+"_"+a,s=[O(r.style)].filter(Boolean).join(" ");s+="Small"===n.size?" e-small":"Bigger"===n.size?" e-bigger":"";var l=I(r.type),d=t.createElement("button",{id:String(o),attrs:{name:String(o),type:l}});ye.appendChild(d);var c=new i.Button({locale:y,enableRtl:w,cssClass:s,disabled:r.disabled||!1,content:r.label||"Button "+(a+1),iconCss:r.iconCss,iconPosition:r.iconPosition});c.appendTo(d),c.element.onclick=function(e){m&&m(e)},S(c,a),ge.push(c),e.ref&&"function"==typeof e.ref&&e.ref(c,a)}),A&&A.appendChild(ye),ge}var be=I(n.buttonType),xe=[O(n.style),"submit"===be?"submit-btn form-submit-type":"","reset"===be?"form-reset-type":"",n.cssClass||"e-primary","Small"===n.size?" e-small":"Bigger"===n.size?" e-bigger":""].filter(Boolean).join(" ")||"e-primary",Ce={display:"flex",justifyContent:F(n.position),width:n.width||"100%"},we=t.createElement("div",{id:n.name+"-container"});Object.assign(we.style,Ce);var Se=t.createElement("button",{id:n.name,attrs:{type:be}});we.appendChild(Se);var Ee=new i.Button({enableRtl:w,locale:y,cssClass:xe,disabled:n.disabled,iconCss:n.iconCss,iconPosition:n.iconPosition,content:n.label});return Ee.appendTo(Se),S(Ee),Ee.element.onclick=function(e){m&&m(e)},A&&A.appendChild(we),Ee;case"splitButton":var Te=["primary"===n.style?"e-primary":"",(n.style,""),"information"===n.style?"e-info":"","error"===n.style?"e-danger":"","success"===n.style?"e-success":"","warning"===n.style?"e-warning":"",n.cssClass||""].filter(Boolean).join(" ")||void 0,Ae={display:"flex",justifyContent:F(n.position)},we=t.createElement("div",{id:n.name+"-container",attrs:{"aria-label":"Splitbutton"}});Object.assign(we.style,Ae);var De=n.options&&n.options.length>0?n.options.map(function(e,t){return{text:e,id:n.id+"_option_"+t}}):[{text:"Option 1",id:n.id+"_option_0"}],Ve=t.createElement("button",{id:n.name});we.appendChild(Ve);var Oe=new o.SplitButton({locale:y,enableRtl:w,content:n.label||"Split Button",items:De,cssClass:Te,disabled:n.disabled,iconCss:n.iconCss,iconPosition:n.iconPosition||"Left",click:function(e){m&&m(J({},e))},select:function(e){m&&m(J({},e,{selectedItem:e.item.text}))}});return Oe.appendTo(Ve),A&&A.appendChild(we),S(Oe),Oe;case"signature":var Ie=t.createElement("canvas",{id:n.name}),Fe=new a.Signature({enableRtl:w,locale:y,backgroundColor:n.backgroundColor||"",strokeColor:n.strokeColor||"",maxStrokeWidth:n.maxValue,minStrokeWidth:n.minValue,velocity:n.velocity,disabled:n.disabled,change:function(){return p(n.name)}});return A&&(Fe.appendTo(Ie),A.appendChild(Ie)),S(Fe),Fe;case"rating":var Re=new a.Rating({enableRtl:w,locale:y,value:void 0!==r?r:n.defaultValue||0,disabled:n.disabled,cssClass:N,allowReset:n.allowReset,itemsCount:n.itemsCount,min:n.minValue,precision:n.precision,readOnly:n.readOnly,showTooltip:n.showRatingTooltip||!1,showLabel:n.showRatingLabel,labelPosition:n.showRatingLabel?n.ratingLabelPosition:void 0,valueChanged:function(e){return p(e.value)}});return A&&(Z(A,n.name),A.setAttribute("name",n.id),Re.appendTo(A)),S(Re),Re;case"colorPicker":var ke=new a.ColorPicker({enableRtl:w,locale:y,value:void 0!==r?r:n.defaultValue||"",disabled:n.disabled,enableOpacity:n.enableOpacity,showButtons:n.showButtons,showRecentColors:n.showRecentColors,noColor:n.showNoColor,cssClass:N,change:function(e){return p(e.value)}});return A&&(Z(A,n.name),ke.appendTo(A)),S(ke),ke;case"inputMask":var Ne=new a.MaskedTextBox(J({id:n.name,name:n.id,enableRtl:w,floatLabelType:n.floatLabelType||"Never",placeholder:n.placeholder||"",enabled:!n.disabled,locale:y,value:void 0!==r?r:n.defaultValue||"",mask:n.mask||"000-000-0000",promptChar:n.promptChar||"_",customCharacters:n.customCharacters,readOnly:n.readOnly||!1,showClearButton:!1!==n.showClearButton,cssClass:N,htmlAttributes:R,appendTemplate:n.suffix,prependTemplate:n.prefix},V(function(e){return e.value||""})));return A&&Ne.appendTo(A),S(Ne),Ne;case"rangeSlider":var Me=new a.Slider({enableRtl:w,locale:y,value:void 0!==r?r:void 0!==n.defaultValue&&null!==n.defaultValue?n.defaultValue:0,min:n.minValue||0,max:n.maxValue||100,step:n.step||1,cssClass:N,enabled:!n.disabled,readonly:n.readOnly,showButtons:n.showButtons,change:function(e){return p(e.value)}});return A&&(Z(A,n.name),Me.appendTo(A)),S(Me),Me;case"fileUpload":var Le=new a.Uploader({enableRtl:w,locale:y,type:"file",enabled:!n.disabled,allowedExtensions:n.allowExtensions,asyncSettings:{saveUrl:n.saveUrl,removeUrl:n.removeUrl},buttons:n.buttons||{browse:"Choose File",clear:"Clear All",upload:"Upload All"},maxFileSize:n.maxValue,minFileSize:n.minValue,multiple:!!n.allowMultiple,showFileList:n.showFileList,htmlAttributes:R,cssClass:N,change:function(e){return p(e.file)}});return A&&(Z(A,n.name),Le.appendTo(A)),S(Le),Le;case"imageEditor":var Pe,je=t.createElement("div",{id:n.name,attrs:{"data-field":n.id}});return setTimeout(function(){Pe=new c.ImageEditor({locale:y,enableRtl:w,disabled:n.disabled,cssClass:N,height:(null!=n.height?n.height:"350px").toString(),width:(null!=n.width?n.width:"100%").toString(),editComplete:function(){return p(n.name)},fileOpened:function(){return p(n.name)}},"#"+n.name)},100),A&&A.appendChild(je),S(Pe),Pe;case"message":nt=new d.Message({locale:y,enableRtl:w,severity:n.severity||n.messageType||"info",variant:n.variant,content:n.content||"Message",showCloseIcon:n.showCloseIcon,showIcon:void 0!==n.showIcon&&n.showIcon||!1,cssClass:N});return A&&(Z(A,n.name),nt.appendTo(A)),S(nt),nt;case"dataGrid":var Be=n,Ue=j(Be.conditions,g&&g.values||{}),_e=Ue?Ue.dataSource:void 0,ze=Ue?Ue.columns:void 0,We=(_e||Be.dataSource,[]);B.fetch(_e||Be.dataSource,Be.id,g&&g.values,C).then(function(e){if(e.id===Be.id&&e.options.length>0){var t=P(_e||Be.dataSource,e.options,qe);Ye.setDataSource(t)}});var qe=[],He=_e?P(_e,We,qe):P(Be.dataSource,We,qe),Ge=He.length>0?He:void 0!==Be.dataSource&&null!==Be.dataSource?Be.dataSource:[],$e=ze&&ze.length>0?ze:void 0!==Be.columns&&null!==Be.columns?Be.columns:[],Je=A||t.createElement("div",{id:Be.name,className:Be.cssClass});A&&Z(A,n.name);var Ye=new $({locale:y,name:Be.name||"",columns:$e,enableRtl:w,dataSource:void 0!==Ge&&Ge.length>0?Ge:r,height:null!=Be.height?Be.height:"200px",width:null!=Be.width?Be.width:"100%",pageSize:Be.pageSize||6,allowPaging:!1!==Be.allowPaging,allowFiltering:Be.allowFiltering,allowAdding:!1!==Be.allowAdding,allowEditing:!1!==Be.allowEditing,allowDeleting:!1!==Be.allowDeleting,onDataChange:function(e){return p(e)},cssClass:N,target:Je,ref:S});return Ye.render(Je),!T.has(n.id)&&g&&Array.isArray(Ge)&&(g.values[n.id]=Ge,Ye.isInitialized=!0,T.add(n.id)),"function"==typeof e.ref?e.ref(Ye):e.ref&&(e.ref.current=Ye),A||Je;case"richTextEditor":var Ze={items:["Undo","Redo","|","Bold","Italic","Underline","StrikeThrough","InlineCode","|","CreateLink","Image","CreateTable","CodeBlock","HorizontalLine","Blockquote","EmojiPicker","|","LineHeight","Formats","Alignments","|","BulletFormatList","NumberFormatList","Checklist","|","Outdent","Indent","|","FontColor","BackgroundColor","FontName","FontSize","|","LowerCase","UpperCase","SuperScript","SubScript","|","SourceCode","|"]};n.enableImportFromWord&&n.enableImportFromWord.enabled&&Ze.items.push("ImportWord"),n.enableExportToWord&&n.enableExportToWord.enabled&&Ze.items.push("ExportWord"),n.enableExportToPdf&&n.enableExportToPdf.enabled&&Ze.items.push("ExportPdf"),Ze.items.push("Print");var Ke=function(e){return!!e&&e.enabled&&"string"==typeof e.serviceUrl&&""!==e.serviceUrl.trim()},Qe=Ke(n.enableImportFromWord)?{serviceUrl:/^(https?:)?\/\//i.test(n.enableImportFromWord?n.enableImportFromWord.serviceUrl:"")?n.enableImportFromWord?n.enableImportFromWord.serviceUrl:"":(b&&b.hostUrl?b.hostUrl:"").replace(/\/+$/,"")+"/"+(n.enableImportFromWord?n.enableImportFromWord.serviceUrl:"").replace(/^\/+/,"")}:void 0,Xe=Ke(n.enableExportToWord)?{serviceUrl:/^(https?:)?\/\//i.test(n.enableExportToWord?n.enableExportToWord.serviceUrl:"")?n.enableExportToWord?n.enableExportToWord.serviceUrl:"":(b&&b.hostUrl?b.hostUrl:"").replace(/\/+$/,"")+"/"+(n.enableExportToWord?n.enableExportToWord.serviceUrl:"").replace(/^\/+/,""),fileName:"RichTextEditor.docx",stylesheet:"\n .e-rte-content {\n font-size: 1em;\n font-weight: 400;\n margin: 0;\n }\n "}:void 0,et=Ke(n.enableExportToPdf)?{serviceUrl:/^(https?:)?\/\//i.test(n.enableExportToPdf?n.enableExportToPdf.serviceUrl:"")?n.enableExportToPdf?n.enableExportToPdf.serviceUrl:"":(b&&b.hostUrl?b.hostUrl:"").replace(/\/+$/,"")+"/"+(n.enableExportToPdf?n.enableExportToPdf.serviceUrl:"").replace(/^\/+/,""),fileName:"RichTextEditor.pdf",stylesheet:"\n .e-rte-content {\n font-size: 1em;\n font-weight: 400;\n margin: 0;\n }\n "}:void 0,tt=new u.RichTextEditor({locale:y,toolbarSettings:Ze,enableRtl:w,value:void 0!==r?r:n.defaultValue||"",placeholder:n.placeholder||"",enabled:!n.disabled,readonly:n.readOnly||!1,maxLength:n.maxLength||void 0,cssClass:N||void 0,height:n.height||"300px",width:n.width||"100%",htmlAttributes:R,importWord:Qe,exportPdf:et,exportWord:Xe,change:function(e){return p(e.value)}});return u.RichTextEditor.Inject(u.Toolbar,u.Link,u.HtmlEditor,u.QuickToolbar,u.Image,u.Count,u.Table,u.EmojiPicker,u.PasteCleanup,u.SlashMenu,u.CodeBlock,u.ClipBoardCleanup,u.AutoFormat,u.ImportExport),tt.appendTo(A),S(tt),tt;default:var nt=new d.Message({locale:y,enableRtl:w,severity:"Warning",content:E.getConstant("unsupportedComponent")+" : "+n.type,cssClass:N});return A&&(Z(A,n.name),nt.appendTo(A)),S(nt),nt}},Q=function(){return(Q=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)},X={strict:!1,maxInputSize:5242880,defaultTextType:"textbox",inferTypeFromValue:!0,generateIds:!0,includeMetadata:!0,customTypeMap:{},validateUnknownFields:!1},ee=function(){function e(e){this.config=Q({},X,e)}return e.prototype.parse=function(e){var t=[],n=[];if("string"==typeof e){if(e.length>this.config.maxInputSize)return this.formatError(t,n,"Input exceeds maximum size of "+this.config.maxInputSize+" bytes");var r=te(e);if(!r.valid)return this.formatError(t,n,r.errors&&r.errors[0]||"Invalid JSON");try{e=JSON.parse(e)}catch(e){return this.formatError(t,n,"Failed to parse JSON: "+e.message)}}var a=this.detectFormat(e);a.ambiguousFormats&&a.ambiguousFormats.length>0&&(n.push("Ambiguous format detected."),n.push("Using "+a.format+" format ("+("json-schema"===a.format?"properties priority":"pages priority")+")"));var i=[];switch(a.format){case"configured-schema":i=e.properties||[];break;case"json-schema":var o=this.parseJsonSchema(e);i=o.components,o.warnings&&n.push.apply(n,o.warnings);break;case"surveyjs":i=this.parseSurveyJS(e);break;case"openapi":i=this.parseOpenAPI(e);break;case"data-inference":(i=this.parseDataInference(e)).length>0&&n.push("Field types inferred from data; please verify");break;default:t.push("Could not determine input format")}0===i.length&&t.push("No form fields could be extracted from input"),!i.some(function(e){return"button"===e.type&&"submit"===e.buttonType})&&i.length>0&&i.push({id:this.generateComponentId("button"),type:"button",label:"Submit",style:"primary",buttonType:"submit"});var s={version:e.version||"0.1.0",components:i},l=ne(s);!l.valid&&l.errors&&t.push.apply(t,l.errors),l.warnings&&n.push.apply(n,l.warnings),this.config.strict&&n.length>0&&(t.push.apply(t,n),n.length=0);var d=re(s);return{success:0===t.length,schema:d,errors:t,warnings:n,metadata:{detectedFormat:a.format,confidence:a.confidence,sourceHints:a.hints}}},e.prototype.formatError=function(e,t,n){return e.push(n),{success:!1,schema:null,errors:e,warnings:t,metadata:{detectedFormat:"unknown",confidence:"low",sourceHints:[]}}},e.prototype.detectFormat=function(e){var t=[],n=[];if(!e||"object"!=typeof e)return{format:"unknown",confidence:"low",hints:["Input is not a valid object"]};if(e.$schema&&"string"==typeof e.$schema&&e.$schema.includes("json-schema"))return t.push("$schema property detected"),{format:"json-schema",confidence:"high",hints:t};var r=e.properties&&"object"==typeof e.properties,a=e.pages&&Array.isArray(e.pages),i=e.elements&&Array.isArray(e.elements);return r&&a?(t.push("Multiple format patterns detected"),t.push("Selected based on priority rules"),n.push("properties format","pages format"),{format:"json-schema",confidence:"medium",hints:t,ambiguousFormats:n}):a?(t.push("pages array detected"),e.pages[0]&&e.pages[0].elements&&t.push("elements structure matched"),{format:"surveyjs",confidence:"high",hints:t}):i&&!r?(t.push("elements array at root level"),{format:"surveyjs",confidence:"medium",hints:t}):r?(t.push("properties object detected"),"object"===e.type&&t.push("type: object matched"),e.required&&Array.isArray(e.required)&&t.push("required array found"),this.hasExampleFields(e.properties)?(t.push("example fields detected (API schema pattern)"),{format:"openapi",confidence:"high",hints:t}):{format:"json-schema",confidence:"high",hints:t}):this.isDataInferenceCandidate(e)?(t.push("Simple object with primitive values"),t.push("No schema indicators found"),{format:"data-inference",confidence:"medium",hints:t}):{format:"unknown",confidence:"low",hints:["Could not identify format"]}},e.prototype.hasExampleFields=function(e){if(!e||"object"!=typeof e)return!1;for(var t=0,n=Object.keys(e);t<n.length;t++){var r=e[n[t]];if(r&&"example"in r)return!0}return!1},e.prototype.isDataInferenceCandidate=function(e){return!(!e||"object"!=typeof e)&&(!(e.$schema||e.properties||e.pages||e.elements)&&Object.keys(e).every(function(t){var n=e[t];return null===n||void 0===n||("string"==typeof n||"number"==typeof n||"boolean"==typeof n||!!Array.isArray(n)&&n.every(function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e}))}))},e.prototype.inferComponentType=function(e,t){var n=this.inferTypeFromValue(e,t);if(n.type)return Q({},n,{confidence:"high",method:"value-type"});var r=this.matchFieldNamePattern(e);return r.type?Q({},r,{confidence:"high",method:"name-pattern"}):{type:this.config.defaultTextType,confidence:"low",method:"fallback"}},e.prototype.inferTypeFromValue=function(e,t){if(!this.config.inferTypeFromValue)return{type:"textbox"};if(null===t||void 0===t)return this.matchFieldNamePattern(e);if("string"==typeof t){if(t.includes("@")&&t.includes("."))return{type:"textbox",textboxType:"email"};if(/^(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}/.test(t))return{type:"textbox",textboxType:"url"};if(/^\d{4}-\d{2}-\d{2}/.test(t))return{type:"date"};var n=this.matchFieldNamePattern(e);return"textbox"!==n.type||n.textboxType?n:{type:this.config.defaultTextType}}return"number"==typeof t?{type:"number"}:"boolean"==typeof t?{type:"checkbox"}:Array.isArray(t)?{type:"multiselect"}:{type:"textbox"}},e.prototype.matchFieldNamePattern=function(e){if(this.config.customTypeMap){var t=this.config.customTypeMap[e.toLowerCase()];if(t)return{type:t}}var n=e.toLowerCase().replace(/[_\-\s]+/g," ");return/email|mail|e-?mail/.test(n)?{type:"textbox",textboxType:"email"}:/date|birth|birthday|dob|created|updated/.test(n)?{type:"date"}:/phone|tel|mobile|cell|cellphone|msisdn/.test(n)?{type:"textbox",textboxType:"number"}:/url|link|uri|website/.test(n)?{type:"textbox",textboxType:"url"}:/password|pwd|pass|security|secret|key|token/.test(n)?{type:"textbox",textboxType:"password"}:/\b(?:age|count|qty|quantity|amount|price|cost|salary|fee|rate|number|num)\b/.test(n)?{type:"number"}:/active|enabled|visible|deleted|archived|approved|confirmed/.test(n)?{type:"checkbox"}:/select|choice|option|type|status|category|kind/.test(n)?{type:"dropdown"}:/description|comment|note|bio|biography|about|message|content|summary|details/.test(n)?{type:"textarea"}:{type:"textbox"}},e.prototype.parseJsonSchema=function(e){var t=[],n=[];if(!e.properties||"object"!=typeof e.properties)return{components:t,warnings:n};for(var r=this.flattenNestedProperties(e.properties,"",n),a=0,i=Object.keys(r);a<i.length;a++){var o=i[a],s=r[o],l=this.mapJsonSchemaType(s),d=-1!==(e.required||[]).indexOf(o);t.push(this.createComponent(o,s,l,{required:d}))}return{components:t,warnings:n}},e.prototype.flattenNestedProperties=function(e,t,n){for(var r={},a=!1,i=0,o=Object.keys(e);i<o.length;i++){var s=e[p=o[i]],l=t?t+"_"+p:p;if("object"===s.type&&s.properties&&"object"==typeof s.properties){a=!0;var d=this.flattenNestedProperties(s.properties,l,n);Object.assign(r,d)}else r[l]=s}if(a&&!t){n.push("NESTED_OBJECTS_FLATTENED: Nested objects converted to flat structure");for(var c=0,u=Object.keys(e);c<u.length;c++){var p=u[c];"object"===(s=e[p]).type&&s.properties&&this.collectFlattenedFieldNames(s.properties,p,n)}}return r},e.prototype.collectFlattenedFieldNames=function(e,t,n){for(var r=0,a=Object.keys(e);r<a.length;r++){var i=a[r],o=e[i],s=t+"_"+i;n.push("Field '"+t+"."+i+"' flattened to '"+s+"'"),"object"===o.type&&o.properties&&this.collectFlattenedFieldNames(o.properties,s,n)}},e.prototype.parseSurveyJS=function(e){var t=this,n=[];return e.pages&&Array.isArray(e.pages)&&e.pages.forEach(function(e){e.elements&&Array.isArray(e.elements)&&e.elements.forEach(function(e){n.push(t.createComponentFromSurveyJS(e))})}),!n.length&&e.elements&&Array.isArray(e.elements)&&e.elements.forEach(function(e){n.push(t.createComponentFromSurveyJS(e))}),n},e.prototype.createComponentFromSurveyJS=function(e){var t=this.mapSurveyJSType(e.type||"text"),n={};!0===e.isRequired&&(n.required=!0),e.validators&&Array.isArray(e.validators)&&e.validators.forEach(function(e){"numeric"===e.type&&(void 0!==e.minValue&&(n.minValue=e.minValue),void 0!==e.maxValue&&(n.maxValue=e.maxValue)),"text"===e.type&&(void 0!==e.minLength&&(n.minLength=e.minLength),void 0!==e.maxLength&&(n.maxLength=e.maxLength))});var r=Q({id:this.generateComponentId(t),type:t,label:e.title||e.label||this.humanizeFieldName(e.name),defaultValue:e.defaultValue,expressionValue:e.expressionValue},Object.keys(n).length>0?n:void 0);return"dropdown"!==t&&"multiselect"!==t&&"radio"!==t&&"splitButton"!==t||e.choices&&Array.isArray(e.choices)&&(r.options=e.choices),r},e.prototype.mapSurveyJSType=function(e){return{text:"textbox",email:"email",number:"number",checkbox:"checkbox",radiogroup:"radio",dropdown:"dropdown",tagbox:"multiselect",multiselect:"multiselect",rating:"number",comment:"textarea",date:"date"}[e]||"textbox"},e.prototype.parseOpenAPI=function(e){var t=[];if(!e.properties||"object"!=typeof e.properties)return t;for(var n=Object.keys(e.properties),r=e.required||[],a=0,i=n;a<i.length;a++){var o=i[a],s=e.properties[o],l=this.mapJsonSchemaType(s),d=-1!==r.indexOf(o);t.push(this.createComponent(o,s,l,{required:d}))}return t},e.prototype.parseDataInference=function(e){for(var t=[],n=0,r=Object.keys(e);n<r.length;n++){var a=r[n],i=e[a],o=this.inferComponentType(a,i),s={id:this.generateComponentId(o.type),type:o.type,label:this.humanizeFieldName(a),defaultValue:i,expressionValue:void 0};if(o.textboxType&&(s.textboxType=o.textboxType,"email"===o.textboxType?s.regex=V.EMAIL:"url"===o.textboxType&&(s.regex=V.URL)),"date"===o.type&&void 0!==s.defaultValue&&null!==s.defaultValue){var l=this.formatDateTimeValue(s.defaultValue);l&&(s.defaultValue=l)}Array.isArray(i)&&i.length>0&&(s.options=i),t.push(s)}return t},e.prototype.createComponent=function(e,t,n,r){var a={};!0===(void 0!==t.required?t.required:r.required)&&(a.required=!0),t.minLength&&(a.minLength=t.minLength),t.maxLength&&(a.maxLength=t.maxLength),t.minDate&&(a.minDate=t.minDate),t.maxDate&&(a.maxDate=t.maxDate),t.minTime&&(a.minTime=t.minTime),t.minValue&&(a.minValue=t.minValue),t.maxValue&&(a.maxValue=t.maxValue),t.pattern&&(a.pattern=t.pattern);var i=b(t.id||this.generateComponentId(n.type),this.generateComponentId(n.type)),o=Q({id:i,name:t.name,type:n.type,label:t.title||t.label||this.humanizeFieldName(e),defaultValue:t.default||t.defaultValue||void 0,expressionValue:t.expressionValue||void 0,content:t.content,buttonType:t.buttonType,textboxType:t.textboxType},Object.keys(a).length>0?a:void 0);if(n.textboxType&&(o.textboxType=n.textboxType,"email"===n.textboxType?a.pattern||(a.regex="^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$",a.validationMessage="Please enter a valid email address"):"url"===n.textboxType&&(a.pattern||(a.regex="^(https?:\\/\\/)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)$",a.validationMessage="Please enter a valid URL"))),"date"===n.type&&void 0!==o.defaultValue&&null!==o.defaultValue){var s=this.formatDateTimeValue(o.defaultValue);s&&(o.defaultValue=s)}return"splitButton"!==n.type&&"dropdown"!==n.type&&"multiselect"!==n.type&&"radio"!==n.type||!t.enum&&!t.options||(o.options=t.enum||t.options),o},e.prototype.parseDateFromValue=function(e){if(null==e)return null;if("number"==typeof e)return e<1e12?new Date(1e3*e):new Date(e);if("string"==typeof e){var t=e.trim(),n=new Date(t);if(!isNaN(n.getTime()))return n;var r=t.match(/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?)?/);if(r)return new Date(Number(r[1]),Number(r[2])-1,Number(r[3]),Number(r[4]||0),Number(r[5]||0),Number(r[6]||0));var a=t.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})(?:[ T](\d{1,2}):(\d{2})(?:[:](\d{2}))?)?/);if(a)return new Date(Number(a[3]),Number(a[1])-1,Number(a[2]),Number(a[4]||0),Number(a[5]||0),Number(a[6]||0))}return null},e.prototype.formatDate=function(e){var t=e.getMonth()+1,n=e.getDate();return(t<10?"0"+t:String(t))+"/"+(n<10?"0"+n:String(n))+"/"+e.getFullYear()},e.prototype.formatDateTimeValue=function(e){var t=this.parseDateFromValue(e);if(t){var n=this.formatDate(t);return 0!==t.getHours()||0!==t.getMinutes()||/\dT\d{2}:\d{2}/.test(String(e))?""+n:n}},e.prototype.mapJsonSchemaType=function(e){var t=e.type;if("string"===t){var n=(e.format||"").toString().toLowerCase(),r=((e.title||e.label||"")+" "+(e.description||"")).toLowerCase();return/email|mail|e-?mail/.test(n)||/email|mail|e-?mail/.test(r)?{type:"textbox",textboxType:"email"}:/uri|url|link|website/.test(n)||/uri|url|link|website/.test(r)?{type:"textbox",textboxType:"url"}:/phone|tel|mobile|cell|msisdn/.test(n)||/phone|tel|mobile|cell|msisdn/.test(r)?{type:"textbox",textboxType:"number"}:/password|pwd|pass|security|secret|key/.test(n)||/password|pwd|pass|security|secret|key/.test(r)?{type:"textbox",textboxType:"password"}:"date"===n||"date-time"===n||/date|birthday|dob/.test(r)?{type:"date"}:e.enum?{type:"dropdown"}:e.options?{type:"dropdown"}:{type:this.config.defaultTextType}}return"number"===t||"integer"===t?{type:"number"}:"boolean"===t?{type:"checkbox"}:"array"===t?{type:"multiselect"}:"message"===t?{type:"message"}:"button"===t?{type:"button"}:"signature"===t||"sign"===t?{type:"signature"}:"image"===t||"imageEditor"===t?{type:"imageEditor"}:"file"===t||"fileUpload"===t?{type:"fileUpload"}:"color"===t||"colorPicker"===t?{type:"colorPicker"}:"splitButton"===t?{type:"splitButton"}:{type:this.config.defaultTextType}},e.prototype.generateComponentId=function(e){return this.config.generateIds?e+"_"+Date.now()+"_"+Math.floor(1e3*Math.random()):""},e.prototype.humanizeFieldName=function(e){var t=e.replace(/_/g," ");return t=t.replace(/([a-z])([A-Z])/g,"$1 $2")},e}(),te=function(e){try{return JSON.parse(e),{valid:!0}}catch(e){return{valid:!1,errors:["Invalid JSON syntax: "+e.message]}}},ne=function(e){var t=[],n=[];if(e.components?Array.isArray(e.components)||t.push('Property "components" must be an array'):t.push("Missing required property: components"),Array.isArray(e.components)){var r=new Set,a=function(e,n){void 0===n&&(n="root"),e.id?(r.has(e.id)&&t.push("Duplicate component ID found: "+e.id),r.add(e.id)):t.push("Component at "+n+' is missing "id" property'),e.type||t.push('Component "'+(e.id||"unknown")+'" is missing "type" property'),e.children&&Array.isArray(e.children)&&e.children.forEach(function(e,t){a(e,n+".children["+t+"]")}),e.tabItems&&Array.isArray(e.tabItems)&&e.tabItems.forEach(function(e,t){e.content&&Array.isArray(e.content)&&e.content.forEach(function(e,r){a(e,n+".tabItems["+t+"].content["+r+"]")})}),e.tableCells&&Array.isArray(e.tableCells)&&e.tableCells.forEach(function(e,t){Array.isArray(e)&&e.forEach(function(e,r){Array.isArray(e)&&e.forEach(function(e,i){a(e,n+".tableCells["+t+"]["+r+"]["+i+"]")})})})};e.components.forEach(function(e,t){a(e,"components["+t+"]")})}return{valid:0===t.length,errors:t.length>0?t:void 0,warnings:n.length>0?n:void 0}},re=function(e){var t={version:e.version||"0.1.0",components:e.components||[]},n=function(e){var t=Q({},e,{_configured:!0});return e.children&&Array.isArray(e.children)&&(t.children=e.children.map(n)),e.tabItems&&Array.isArray(e.tabItems)&&(t.tabItems=e.tabItems.map(function(e){return Q({},e,{content:e.content?e.content.map(n):[]})})),e.tableCells&&Array.isArray(e.tableCells)&&(t.tableCells=e.tableCells.map(function(e){return e.map(function(e){return Array.isArray(e)?e.map(n):[]})})),t};return t.components=t.components.map(n),t},ae=function(){function e(e){this.content=e.content,this.id=e.id,this.enableHtmlSanitizer=!!t.isNullOrUndefined(e.enableHtmlSanitizer)||e.enableHtmlSanitizer,this.el=e.target||null}return e.prototype.resolveHtml=function(e){try{return this.enableHtmlSanitizer?t.SanitizeHtmlHelper.sanitize(e):e}catch(e){return""}},e.prototype.render=function(){var e=document.createElement("div");return this.id&&(e.id=this.id),e.innerHTML=this.resolveHtml(this.content),this.el=e,e},e.prototype.update=function(e){this.content=e,this.el&&(this.el.innerHTML=this.resolveHtml(this.content))},e.prototype.getElement=function(){return this.el},e.prototype.destroy=function(){this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el),this.el=null,this.content="",this.enableHtmlSanitizer=!1,this.id=void 0},e}(),ie=function(){function e(){}return e.getConstraints=function(e,t,n){var r=this;if(void 0===n&&(n="number"),!e||0===e.length)return this.getEmptyConstraints(n);var a=e.find(function(e){return!1===e.enabled});if(a){var i=this.resolveValue(a.minValue,{}),o=this.resolveValue(a.maxValue,{});return"date"===n||"dateRange"===n?{minValue:void 0,maxValue:void 0,minDate:i,maxDate:o,minTime:void 0,maxTime:void 0}:"time"===n?{minValue:void 0,maxValue:void 0,minDate:void 0,maxDate:void 0,minTime:i,maxTime:o}:{minValue:i,maxValue:o,minDate:void 0,maxDate:void 0,minTime:void 0,maxTime:void 0}}var s=e.filter(function(e){return!0===e.enabled});if(0===s.length)return this.getEmptyConstraints(n);var l=s.map(function(e){return{min:r.resolveValue(e.minValue,t),max:r.resolveValue(e.maxValue,t)}}).filter(function(e){return void 0!==e.min||void 0!==e.max});if(0===l.length)return this.getEmptyConstraints(n);var d=this.getPermissiveMin(l,n),c=this.getPermissiveMax(l,n);return"date"===n||"dateRange"===n?{minValue:void 0,maxValue:void 0,minDate:d,maxDate:c,minTime:void 0,maxTime:void 0}:"time"===n?{minValue:void 0,maxValue:void 0,minDate:void 0,maxDate:void 0,minTime:d,maxTime:c}:{minValue:d,maxValue:c,minDate:void 0,maxDate:void 0,minTime:void 0,maxTime:void 0}},e.resolveValue=function(e,t){if("number"==typeof e)return e;if("string"==typeof e)return e;if(e&&"object"==typeof e&&e.field){var n=t[e.field];return void 0!==n?n:void 0}},e.getPermissiveMin=function(e,t){var n=this;if(0!==e.length){if("date"===t||"dateRange"===t)return e.reduce(function(e,t){if(!t.min)return e;if(!e)return t.min;var r=n.convertToISO(e);return n.convertToISO(t.min)<r?t.min:e},void 0);if("time"===t)return e.reduce(function(e,t){if(!t.min)return e;if(!e)return t.min;var r=n.convertTimeTo24Hour(e);return n.convertTimeTo24Hour(t.min)<r?t.min:e},void 0);var r=e.map(function(e){return e.min}).filter(function(e){return void 0!==e});return r.length>0?Math.min.apply(Math,r):void 0}},e.getPermissiveMax=function(e,t){var n=this;if(0!==e.length){if("date"===t||"dateRange"===t)return e.reduce(function(e,t){if(!t.max)return e;if(!e)return t.max;var r=n.convertToISO(e);return n.convertToISO(t.max)>r?t.max:e},void 0);if("time"===t)return e.reduce(function(e,t){if(!t.max)return e;if(!e)return t.max;var r=n.convertTimeTo24Hour(e);return n.convertTimeTo24Hour(t.max)>r?t.max:e},void 0);var r=e.map(function(e){return e.max}).filter(function(e){return void 0!==e});return r.length>0?Math.max.apply(Math,r):void 0}},e.convertToISO=function(e){if(!e)return"";if(e.includes("-")&&10===e.length)return e;if(-1!==e.indexOf("/")){var t=e.split("/"),n=t[0],r=t[1],a=t[2];return n&&r&&a?a+"-"+(n.length<2?"0"+n:n)+"-"+(r.length<2?"0"+r:r):e}return e},e.convertTimeTo24Hour=function(e){if(!e)return"";var t=/PM/i.test(e),n=/AM/i.test(e);if(n||t){var r=e.replace(/\s*(AM|PM)/i,"").trim().split(":"),a=r[0],i=r[1];if(!a||!i)return e;var o=parseInt(a,10);t&&12!==o?o+=12:n&&12===o&&(o=0);var s=String(o);return(s.length<2?"0"+s:s)+":"+i}return e},e.getEmptyConstraints=function(e){return{minValue:void 0,maxValue:void 0,minDate:void 0,maxDate:void 0,minTime:void 0,maxTime:void 0}},e.validateValue=function(e,t,n){if(void 0===e||null===e||""===e)return{isValid:!0};if("date"===n||"dateRange"===n){if(t.minDate){var r=this.convertToISO(t.minDate);if((i=this.convertToISO(e))<r)return{isValid:!1,error:"Date must be on or after "+t.minDate}}if(t.maxDate){var a=this.convertToISO(t.maxDate),i=this.convertToISO(e);if(i>a)return{isValid:!1,error:"Date must be on or before "+t.maxDate}}}else if("time"===n){if(t.minTime&&e<t.minTime)return{isValid:!1,error:"Time must be on or after "+t.minTime};if(t.maxTime&&e>t.maxTime)return{isValid:!1,error:"Time must be on or before "+t.maxTime}}else{var o=Number(e);if(void 0!==t.minValue&&o<Number(t.minValue))return{isValid:!1,error:"Value must be at least "+t.minValue};if(void 0!==t.maxValue&&o>Number(t.maxValue))return{isValid:!1,error:"Value must be at most "+t.maxValue}}return{isValid:!0}},e}(),oe=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),se=function(){return(se=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)},le=function(e,t,n,r){var a,i=arguments.length,o=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(o=(i<3?a(o):i>3?a(t,n,o):a(t,n))||o);return i>3&&o&&Object.defineProperty(t,n,o),o},de=["textbox","number","checkbox","dropdown","multiselect","date","dateTime","time","dateRange","switch","rating","colorPicker","inputMask","fileUpload"],ce={unsupportedComponent:"Unsupported Component type"},ue=function(e){function i(n,r){var a=e.call(this,n,r)||this;return a.processedSchemaCache={version:"1.0.0",components:[]},a.l10n=new t.L10n("form-renderer",ce,a.locale),a.formState={values:Object.create(null),errors:Object.create(null)},a.validator=null,a.inputRefs={},a.conditionalValueApplied={},a.expressionEngine=null,a.expressionDependencyGraph={},a.expressionEvaluationInProgress=!1,a.previousFormValues={},a.computedFieldNames=new Set,a.customValidationEngine=new H,a.currentFormValues={},a.isInitialized=!1,a.hasLayoutComponentsCache=!1,a.idToLabelCache={},a.initialValuesCache={},a.renderedInstances=[],a.tooltipRefs={},a.createdFired=!1,a.rerenderScheduled=!1,a.conditionalTriggerFieldIds=new Set,a.preservedFields=new Map,a.consumerDependencyMap=new Map,a.pendingChangedFieldIds=new Set,a}oe(i,e),o=i,i.prototype.getModuleName=function(){return"form-renderer"},i.prototype.getPersistData=function(){return this.addOnPersist(["formState",JSON.stringify(this.formState)])},i.prototype.preRender=function(){t.enableRipple(!0),this.createdFired=!1,this.expressionEngine=new D},i.prototype.render=function(){var e=this;if(this.clearEngineCaches(),this.removePreviousRoot(),this.normalizeSchema(),this.element.classList.add("form-renderer-container"),this.className&&t.addClass([this.element],this.className.replace(/\s+/g," ").trim().split(" ")),this.enableRtl?this.element.classList.add("e-rtl"):this.element.classList.remove("e-rtl"),this.hasLayoutComponentsCache=this.computeHasLayoutComponents(),this.idToLabelCache=this.computeIdToLabel(),this.initialValuesCache=this.buildInitialValues(),this.buildValidationRulesAndBridge(),this.isInitialized||(this.isInitialized=!0),this.formState&&this.initialValuesCache)for(var n=0,r=Object.keys(this.initialValuesCache);n<r.length;n++){var a=r[n],i=this.initialValuesCache[a];this.formState.values[a]||(this.formState.values[a]=i)}this.currentFormValues=se({},this.formState?this.formState.values:{}),this.initExpressionEngine(),this.buildConditionalDependencyMap();var o=t.createElement("form",{className:"form-renderer "+this.layoutClass,attrs:{role:"region","aria-label":this.processedSchemaCache.settings?this.processedSchemaCache.settings.name||"Form":"Form"}});this.element.appendChild(o),this.inputRefs={},(this.processedSchemaCache.components||[]).forEach(function(n){var r=e.renderComponent(n);if(r&&o.appendChild(r),"richTextEditor"===n.type){var a=r.querySelector(".e-richtexteditor");(s=t.getComponent(a,"richtexteditor")).refreshUI()}if("dataGrid"===n.type){var i=r.querySelector(".e-control.e-toolbar"),s=t.getComponent(i,"toolbar");s.refresh()}}),this.created&&!this.createdFired&&setTimeout(function(){Object.keys(e.inputRefs).length>0&&(e.createdFired=!0,e.trigger("created",{}))},0)},i.prototype.normalizeSchema=function(){var e=this.schema;try{if(!e)return void(this.processedSchemaCache={version:"1.0.0",components:[]});var t=e;if("string"==typeof e)try{t=JSON.parse(e)}catch(e){return this.failure&&this.trigger("failure",{error:e}),void(this.processedSchemaCache={version:"1.0.0",components:[]})}if(t&&"object"==typeof t&&t.properties&&Array.isArray(t.layout))this.processedSchemaCache=m(t);else{var n=(new ee).parse("string"==typeof e?e:JSON.stringify(e));n.success&&n.schema?this.processedSchemaCache=n.schema:(this.failure&&this.trigger("failure",{error:n.errors}),this.processedSchemaCache={version:"1.0.0",components:[]})}}catch(e){this.failure&&this.trigger("failure",{error:e}),this.processedSchemaCache={version:"1.0.0",components:[]}}},i.prototype.computeHasLayoutComponents=function(){if(!this.processedSchemaCache.components)return!1;var e=function(t){for(var n=0,r=t;n<r.length;n++){var a=r[n];if(-1!==["table","tabs","panel","card"].indexOf(a.type))return!0;if(a.children&&e(a.children))return!0;if(a.tableCells)for(var i=0,o=a.tableCells;i<o.length;i++)for(var s=0,l=o[i];s<l.length;s++){var d=l[s];if(e(d))return!0}if(a.tabItems)for(var c=0,u=a.tabItems;c<u.length;c++){var p=u[c];if(p.content&&e(p.content))return!0}}return!1};return e(this.processedSchemaCache.components)},Object.defineProperty(i.prototype,"layoutClass",{get:function(){if(this.hasLayoutComponentsCache)return"";switch(this.layout){case"TwoColumn":return"twolayout";case"ThreeColumn":return"threelayout";case"FourColumn":return"fourlayout";case"SingleColumn":default:return""}},enumerable:!0,configurable:!0}),i.prototype.collectAllComponents=function(e){var t=[],n=function(e){e.forEach(function(e){t.push(e),e.children&&e.children.length>0&&n(e.children),e.tableCells&&e.tableCells.forEach(function(e){e.forEach(function(e){return n(e)})}),e.tabItems&&e.tabItems.forEach(function(e){e.content&&n(e.content)})})};return n(e),t},i.prototype.computeIdToLabel=function(){var e={},t=function(n){n.forEach(function(n){n.label&&-1===["panel","table","tabs","card","button","message","splitButton"].indexOf(n.type)&&(n.name?e[n.id]=n.name:n.label&&(e[n.id]=n.label)),n.children&&t(n.children),n.tableCells&&n.tableCells.forEach(function(e){return e.forEach(function(e){return t(e)})}),n.tabItems&&n.tabItems.forEach(function(e){e.content&&t(e.content)})})};return t(this.processedSchemaCache.components),e},i.prototype.buildValidationRulesAndBridge=function(){var e=this,t={},n=this.formState&&this.formState.values||{},r=function(a,i){void 0===i&&(i=!0),a.forEach(function(a){if(a){var o={},s=i&&!1!==a.visible&&x.isFieldVisible(a.conditions,n),l=i&&x.isFieldHidden(a.conditions,n);if(s&&!l){var d=x.isFieldRequired(a.conditions,n),c=x.isFieldDisabled(a.conditions,n),u=x.isFieldReadOnly(a.conditions,n),p=!!a.required||d,h=!!a.disabled||c,m=!!a.readOnly||u;if(a.customValidation&&Array.isArray(a.customValidation)&&a.customValidation.length>0&&!h&&!m){var f=a.customValidation&&a.customValidation[0]&&a.customValidation[0].expression,v=(f&&f.match(/\?\s*true\s*:\s*['"](.+?)['"]/)?f.match(/\?\s*true\s*:\s*['"](.+?)['"]/)[1]:void 0)||a.validationMessage||(a.label||a.id)+" is invalid",y=e;o.customValidation=[function(e){var t=e.value;if(p&&(""===t||null===t||void 0===t))return!0;var n={};y.collectAllComponents(y.processedSchemaCache.components).forEach(function(e){e.name&&(n[e.id]=e.name)});for(var r=se({},y.currentFormValues||{}),i=0,o=Object.keys(se({},r));i<o.length;i++){var s=o[i],l=r[s],d=n[s];d&&(r[d]=l,delete r[s])}for(var c=0,u=a.customValidation;c<u.length;c++){var h=u[c];if(!y.customValidationEngine)return!0;if(!0!==y.customValidationEngine.validate(h.expression,t,r))return!1}return!0},v]}!p||h||m||(o.required=[!0,a.validationMessage||a.label+" is required"]),!a.minLength||h||m||(o.minLength=[a.minLength,"Minimum "+a.minLength+" characters allowed"]),!a.maxLength||h||m||(o.maxLength=[a.maxLength,"Maximum "+a.maxLength+" characters allowed"]),"textbox"!==a.type||!a.textboxType||a.regex||o.regex||h||m||("email"===a.textboxType?o.regex=[V.EMAIL,a.validationMessage||"Invalid format"]:"url"===a.textboxType&&(o.regex=[V.URL,a.validationMessage||"Invalid format"])),!a.regex||h||m||(o.regex=[a.regex,a.validationMessage||"Invalid format"]),Object.keys(o).length>0&&(t[a.id]=o),a.children&&r(a.children,s&&!l),a.tableCells&&a.tableCells.forEach(function(e){return e.forEach(function(e){return r(e,s&&!l)})}),a.tabItems&&a.tabItems.forEach(function(e){e.content&&r(e.content,s&&!l)})}}})};r(this.processedSchemaCache.components);var i=this.formState?se({},this.formState.values):se({},this.initialValuesCache);if(this.formState={values:Object.assign(Object.create(null),this.initialValuesCache,i),errors:this.enablePersistence?this.formState.errors:Object.create(null)},i&&Object.keys(i).forEach(function(t){t in e.formState.values||(e.formState.values[t]=i[t])}),this.validator){try{this.validator.refresh(),this.validator.destroy()}catch(e){}this.validator=null}var o=this;this.validator=new a.FormValidator(this.element,{rules:t,locale:this.locale,ignore:"e-hidden",errorClass:"e-error",validClass:"e-valid",errorElement:"div",errorContainer:"div",customPlacement:function(e,t){var n=e.getAttribute("name");if(!n)return void(e.parentElement&&e.parentElement.appendChild(t));var r=document.getElementById("error-"+n);if(r){for(;r.firstChild;)r.removeChild(r.firstChild);r.appendChild(t),r.style.display="block"}else e.parentElement&&e.parentElement.appendChild(t)},validationComplete:function(e){if(o.syncFormStateErrors(),e&&e.inputName){var t=document.getElementById("error-"+e.inputName);if(t)if("success"===e.status){for(;t.firstChild;)t.removeChild(t.firstChild);t.style.display="none"}else"failure"===e.status&&(t.style.display="block")}},submit:function(e){if(o.validator){if(!o.validator.validate())return void(e&&"function"==typeof e.preventDefault&&e.preventDefault());o.handleSubmitData(se({},o.formState.values)),e&&"function"==typeof e.preventDefault&&e.preventDefault()}},reset:function(){}}),i&&Object.keys(i).forEach(function(t){var n=e.validator.getInputElement(t);if(n&&void 0!==i[t]&&null!==i[t])try{n.value=String(i[t])}catch(e){}})},i.prototype.syncFormStateErrors=function(){var e={};if(this.validator)for(var t=0,n=this.validator.errorRules||[];t<n.length;t++){var r=n[t];r&&r.name&&(e[r.name]=r.message)}this.formState.errors=e},i.prototype.buildInitialValues=function(){var e=this,t={},n=this.collectAllComponents(this.processedSchemaCache.components),r=new Set;return n.forEach(function(e){if("staticHtml"===e.type)return void r.add(e.id);if("dataGrid"===e.type&&(t[e.id]=Array.isArray(e.dataSource)?e.dataSource:[]),void 0!==e.defaultValue)t[e.id]=e.defaultValue;else switch(e.type){case"checkbox":case"switch":t[e.id]=!1}r.add(e.id)}),this.formState&&Object.keys(this.formState.values).filter(function(e){return!r.has(e)}).forEach(function(t){delete e.formState.values[t]}),t},i.prototype.initExpressionEngine=function(){if(this.processedSchemaCache.components&&0!==this.processedSchemaCache.components.length)try{var e=this.expressionEngine,t=this.collectAllComponents(this.processedSchemaCache.components),n=e.buildDependencyGraph(t);e.detectCircularDependencies(n).length,this.expressionDependencyGraph=n;var r=new Set;t.forEach(function(e){e.expressionValue&&r.add(e.id)}),this.computedFieldNames=r}catch(e){this.failure&&this.trigger("failure",{error:e})}},i.prototype.disposeTooltipInstance=function(e){var t=this.tooltipRefs[e]||null;if(t){try{t.destroy()}catch(e){this.trigger("failure",{error:e})}this.renderedInstances=this.renderedInstances.filter(function(e){return e!==t}),this.tooltipRefs[e]=null}},i.prototype.renderField=function(e){var n=this,a=this.formState,i=a?a.values:{};if(-1!==["panel","table","tabs","card","message","button","splitButton","staticHtml"].indexOf(e.type))return null;var o=x.isFieldReadOnly(e.conditions,i),s=x.isFieldDisabled(e.conditions,i),l=x.isFieldRequired(e.conditions,i),d=x.getConditionalValue(e.conditions,i),c=!!e.readOnly||o,u=!!e.disabled||s,p=!!e.required||l,h=ie.getConstraints(e.minMaxRange,i,e.type);if("dateTime"===e.type){var m=ie.getConstraints(e.minMaxRange,i,"date"),f=ie.getConstraints(e.minMaxTimeRange,i,"time");h={minValue:void 0,maxValue:void 0,minDate:m.minDate,maxDate:m.maxDate,minTime:f.minTime,maxTime:f.maxTime}}var v=e.labelPosition||"top",y=e.labelWidth||"auto",b=!e.hideLabel&&!!e.label&&-1===["checkbox","button","staticHtml"].indexOf(e.type),C=!(!a||!a.errors[e.id]),w=C&&!(!a||-1===a.errors[e.id].indexOf("required")),S=C&&!(w&&!p),E=void 0!==d,T=this.conditionalValueApplied[e.id]||!1;a&&(E&&!T?(a.values[e.id]=d,this.conditionalValueApplied[e.id]=!0):!E&&T&&(this.conditionalValueApplied[e.id]=!1));var A=t.createElement("div",{className:"form-group",attrs:{"data-field-id":e.id,"data-fr-field":e.id}}),D=t.createElement("div",{className:"field-wrapper label-"+v.toLowerCase()});if(b){var V=t.createElement("label",{className:"field-label"});-1===de.indexOf(e.type)&&"textarea"!==e.type||V.setAttribute("for",t.isNullOrUndefined(this.element.id)?e.name:this.element.id+"-"+e.name),V.style.width="left"===v.toLowerCase()?y+"%":"auto";var O=t.createElement("span");if(O.textContent=e.label,V.appendChild(O),p){var I=t.createElement("span",{className:"required-asterisk"});I.textContent="*",V.appendChild(I)}if(this.disposeTooltipInstance(e.id),e.tooltip){var F=t.createElement("span",{className:"e-msg-icon e-icons e-circle-info tooltip-icon",attrs:{"aria-label":e.tooltip,title:e.tooltip,tabindex:"0",role:"button","aria-haspopup":"true"}});F.style.cursor="pointer",F.style.display="flex",F.style.alignItems="center",F.style.justifyContent="center",F.style.flexShrink="0",V.appendChild(F);var R=new r.Tooltip({content:e.tooltip,enableRtl:this.enableRtl});R.appendTo(F),this.tooltipRefs[e.id]=R,this.renderedInstances.push(R)}D.appendChild(V)}var k=t.createElement("div",{className:"field-input"}),N=("radio"===e.type||"checkboxGroup"===e.type)&&Array.isArray(e.options)?function(t,r){t&&"number"==typeof r&&(n.inputRefs[e.name+"_"+r]=t)}:function(t){t&&(n.inputRefs[e.name]=t)},M=se({},e,{readOnly:c,disabled:u,required:p},void 0!==h.minValue&&{minValue:h.minValue},void 0!==h.maxValue&&{maxValue:h.maxValue},void 0!==h.minDate&&{minDate:h.minDate},void 0!==h.maxDate&&{maxDate:h.maxDate},void 0!==h.minTime&&{minTime:h.minTime},void 0!==h.maxTime&&{maxTime:h.maxTime}),L=function(t){if("staticHtml"!==e.type){if("signature"===e.type&&(t=(r=n.inputRefs[t]).getSignature()),"imageEditor"===e.type){var r=n.inputRefs[t],i=r.getImageData(),o=document.createElement("canvas");o.width=i.width,o.height=i.height;var s=o.getContext("2d");s&&s.putImageData(i,0,0),t=o.toDataURL()}"radio"!==e.type&&"checkboxGroup"!==e.type||(n.validator.getInputElement(e.id).value=t),t=g(e,t),n.formState&&a&&(n.formState.values[e.id]=t,a.values[e.id]=t),n.trigger("change",{fieldName:e.name,label:e.label||e.id,value:t}),n.afterValueChange(e.id)}},P=-1!==de.indexOf(e.type)?"input":"textarea"===e.type?"textarea":"div",j=t.createElement(P,{attrs:{"aria-label":e.label+" "+e.type}});if("radio"===e.type||"checkboxGroup"===e.type){var B=t.createElement("input");B.id=t.isNullOrUndefined(this.element.id)?e.name:this.element.id+"-"+e.name,B.setAttribute("name",e.id),B.style.display="none",B.setAttribute("aria-hidden","true"),j.appendChild(B)}else j.id=t.isNullOrUndefined(this.element.id)?e.name:this.element.id+"-"+e.name,j.setAttribute("name",e.id);k.appendChild(j);var U=K({component:M,value:a?a.values[e.id]:void 0,onChange:L,formState:a,settings:this.processedSchemaCache.settings,onBlur:function(){if(a&&"staticHtml"!==e.type&&n.validator){try{n.beforeValidate(e.id),n.validator.validate(e.id)}catch(e){}n.syncFormStateErrors()}},ref:N,hasError:S,locale:this.locale,components:this.collectAllComponents(this.processedSchemaCache.components),enableRtl:this.enableRtl,target:j,l10n:this.l10n});if(Array.isArray(U))U.forEach(function(e){if(e&&"function"==typeof e.destroy)n.renderedInstances.push(e);else if(e instanceof HTMLElement)for(var t=0,r=Object.keys(n.inputRefs);t<r.length;t++){var a=r[t],i=n.inputRefs[a],o=i&&(i.element||i.target||i.hostElement&&i.hostElement());o&&(o===e||e.contains(o))&&n.renderedInstances.push(i)}});else if(U)if("function"==typeof U.destroy)this.renderedInstances.push(U);else if(U instanceof HTMLElement)for(var _=0,z=Object.keys(this.inputRefs);_<z.length;_++){var W=z[_],q=this.inputRefs[W],H=q&&(q.element||q.target||q.hostElement&&q.hostElement());H&&(H===U||U.contains(H))&&this.renderedInstances.push(q)}var G=t.createElement("div",{id:"error-"+(e.id||e.name||e.label),className:"e-error-message",attrs:{role:"alert","aria-live":"assertive"}});if(G.style.display="none",S&&a&&a.errors[e.id]&&(G.textContent=a.errors[e.id],G.classList.add("e-error"),G.style.display="block"),k.appendChild(G),D.appendChild(k),A.appendChild(D),e.description){var $=t.createElement("div",{className:"field-description",attrs:{"aria-describedby":"description-"+e.label}});$.textContent=e.description,A.appendChild($)}return A},i.prototype.renderComponent=function(e){var r=this,a=this.formState,i=a?a.values:{},s=!1!==e.visible&&x.isFieldVisible(e.conditions,i),l=x.isFieldHidden(e.conditions,i);if(!s||l)return a&&void 0!==a.values[e.id]&&null!==a.values[e.id]&&(a.values[e.id]=null),null;if(o.PRESERVABLE_TYPES.has(e.type)&&this.preservedFields.has(e.id)){var d=this.preservedFields.get(e.id);if(d)return this.preservedFields.delete(e.id),d}switch(e.type){case"panel":if((V=t.createElement("fieldset",{className:"form-panel-renderer "+(e.cssClass||"")})).style.minInlineSize="unset",e.label&&!e.hideLabel){var c=t.createElement("legend",{className:e.hideBorders?"":"panel-legend"});c.textContent=e.label,V.appendChild(c)}var u=t.createElement("div",{className:"panel-content"});return(e.children||[]).forEach(function(e){var t=r.renderComponent(e);t&&u.appendChild(t)}),V.appendChild(u),V;case"table":for(var p=e.rows||(e.tableCells?e.tableCells.length:2),h=e.columns||(e.tableCells&&e.tableCells[0]?e.tableCells[0].length:2),m=Math.floor(12/h),f=e.columnWidths,v=f?y(f.widths):[],g=t.createElement("div",{className:"form-table-renderer "+(e.hideBorders?"":"table-border")+" "+(e.cssClass||""),attrs:{role:"group","aria-label":e.label||"Table Layout"}}),b=0;b<p;b++){var C=t.createElement("div",{className:"e-form-table-row"});e.hideBorders&&(C.style.display="flex",C.style.gap="1.5rem");for(var w=0;w<h;w++)!function(n){var a=e.tableCells&&e.tableCells[b]&&e.tableCells[b][n]||[],i=m,o=v[n],s=1===h?{width:"100%"}:o?{width:o+"%"}:{},l=!f||Array.isArray(f.widths)&&f.widths.every(function(e){return null===e}),d=0===b,c=t.createElement("div",{className:"e-form-table-cell "+(o?"":l?"col-"+i:"")});e.hideBorders?Object.assign(c.style,s,{padding:d?"0":"12px 0 0 0"}):Object.assign(c.style,s),a.forEach(function(e){var t=r.renderComponent(e);t&&c.appendChild(t)}),C.appendChild(c)}(w);g.appendChild(C)}return g;case"tabs":var S=t.createElement("div",{className:"form-tabs-renderer "+(e.cssClass||"")}),E=t.createElement("div",{className:"e-tab"});E.id=e.id;var T=t.createElement("div",{className:"e-tab-header"}),A=t.createElement("div",{className:"e-content"});E.appendChild(T),E.appendChild(A),S.appendChild(E),(e.tabItems||[]).forEach(function(e){var n=t.createElement("div");n.textContent=e.header,T.appendChild(n);var a=t.createElement("div"),i=t.createElement("div",{className:"tab-content-renderer"});(e.content||[]).forEach(function(e){var t=r.renderComponent(e);t&&i.appendChild(t)}),a.appendChild(i),A.appendChild(a)});var D=new n.Tab({enableRtl:this.enableRtl,cssClass:e.cssClass,enablePersistence:!0,animation:{previous:{effect:"None"},next:{effect:"None"}},selected:function(t){if("undefined"==typeof window)return null;try{window.localStorage.setItem("tab"+e.id,JSON.stringify({selectedItem:t.selectedIndex}))}catch(e){}}});return D.appendTo(E),this.renderedInstances.push(D),S;case"card":var V=t.createElement("fieldset",{className:"e-card form-card-renderer "+(e.cssClass||"")});V.style.minInlineSize="unset",V.style.padding="0";var O=t.createElement("div",{className:"e-card-header"}),I=t.createElement("div",{className:"e-card-header-caption"}),F=t.createElement("div",{className:"e-card-title"});if(F.textContent=e.cardTitle||e.label||"Card Title",I.appendChild(F),e.cardSubtitle){var R=t.createElement("div",{className:"e-card-sub-title"});R.textContent=e.cardSubtitle,I.appendChild(R)}O.appendChild(I),V.appendChild(O);var k=t.createElement("div",{className:"e-card-content card-content"});return(e.children||[]).forEach(function(e){var t=r.renderComponent(e);t&&k.appendChild(t)}),V.appendChild(k),V;case"staticHtml":var N=new ae({content:e.defaultValue||"<p>HTML content</p>",id:e.id,enableHtmlSanitizer:e.enableHtmlSanitizer}),M=N.render();return this.renderedInstances.push(N),M;case"message":j=t.createElement("div",{className:"form-group"});(W=t.createElement("div")).id=e.name,W.setAttribute("name",e.id),j.appendChild(W);U=K({component:e,locale:this.locale,value:void 0,onChange:function(){},enableRtl:this.enableRtl,target:W,ref:function(t,n){void 0!==n?r.inputRefs[e.name+"_"+n]=t:r.inputRefs[e.name]=t}});return Array.isArray(U)?U.forEach(function(e){e&&r.renderedInstances.push(e)}):U&&this.renderedInstances.push(U),j;case"button":var L=x.isFieldDisabled(e.conditions,i),P=!!e.disabled||L,j=t.createElement("div",{className:"form-group"});(W=t.createElement("div")).id=e.name,W.setAttribute("name",e.id),j.appendChild(W);var B=function(t){if(r.buttonClick){var n=e.buttonsGroups?t.target&&t.target.ej2_instances?t.target.ej2_instances[0].content:"":e.label||"";r.trigger("buttonClick",{fieldName:e.name,label:n,event:t})}var a=t.target;if(a.type&&"reset"===a.type){var i=a.closest("form");i&&i.querySelectorAll('input[type="checkbox"]').forEach(function(e){e.ej2_instances[0].checked=!1}),r.formState.values={},i.reset(),r.rerenderForm(),r.validator.destroy()}},U=K({component:se({},e,{disabled:P}),value:void 0,onChange:function(){},locale:this.locale,onClick:B,ref:function(t,n){void 0!==n?r.inputRefs[e.name+"_"+n]=t:r.inputRefs[e.name]=t},enableRtl:this.enableRtl,target:W});return Array.isArray(U)?U.forEach(function(e){e&&r.renderedInstances.push(e)}):U&&this.renderedInstances.push(U),j;case"splitButton":var _=x.isFieldDisabled(e.conditions,i),z=!!e.disabled||_,j=t.createElement("div",{className:"form-group"}),W=t.createElement("div");W.id=e.name,W.setAttribute("name",e.id),j.appendChild(W);var q=function(t){r.buttonClick&&r.trigger("buttonClick",{fieldName:e.name,label:e.label||"",event:t})},U=K({component:se({},e,{disabled:z}),value:void 0,locale:this.locale,onChange:function(){},onClick:q,ref:function(t){t&&(r.inputRefs[e.name]=t)},enableRtl:this.enableRtl,target:W});return Array.isArray(U)?U.forEach(function(e){e&&r.renderedInstances.push(e)}):U&&this.renderedInstances.push(U),j;default:return this.renderField(e)}},i.prototype.afterValueChange=function(e){this.formState&&(this.currentFormValues=se({},this.formState.values),this.evaluateExpressions(),this.retriggerCustomValidation(),this.beforeValidate(e),this.validator.validate(e),this.syncFormStateErrors(),e&&this.isConditionalTrigger(e)&&this.scheduleRerender(e))},i.prototype.beforeValidate=function(e){var t=this.element.querySelector("#"+e+"-info");t&&t.classList.contains("e-error")&&t.classList.remove("e-error");var n=this.getInputElementByName(e),r=n.parentElement,a=r.parentElement;r.classList.contains("e-control-wrapper")||r.classList.contains("e-wrapper")||n.classList.contains("e-input")&&r.classList.contains("e-input-group")?r.classList.remove("e-error"):null!=a&&(a.classList.contains("e-control-wrapper")||a.classList.contains("e-wrapper"))?a.classList.remove("e-error"):n.classList.remove("e-error"),this.validator&&(this.validator.errorRules=[])},i.prototype.scheduleRerender=function(e){var t=this;e&&this.pendingChangedFieldIds.add(e),this.rerenderScheduled||(this.rerenderScheduled=!0,Promise.resolve().then(function(){t.rerenderScheduled=!1;var e=new Set(t.pendingChangedFieldIds);t.pendingChangedFieldIds.clear(),t.rerenderForm(e)}))},i.prototype.collectConditionFieldIds=function(e,t){if(e)if("string"==typeof e.field)t.add(e.field);else if(Array.isArray(e.rules))for(var n=0,r=e.rules;n<r.length;n++){var a=r[n];this.collectConditionFieldIds(a,t)}},i.prototype.collectDataSourceReferenceIds=function(e,t,n){if("string"==typeof e){var r=e.match(/\{([^}]+)\}/g);if(r)for(var a=0,i=r;a<i.length;a++)!function(e){var r=e.slice(1,-1),a=t.find(function(e){return e.name===r});a&&a.id&&n.add(a.id)}(i[a])}},i.prototype.buildConditionalDependencyMap=function(){for(var e=new Set,t=new Map,n=this.collectAllComponents(this.processedSchemaCache.components),r=0,a=n;r<a.length;r++){var i=a[r],o=new Set;t.set(i.id,o);var s=i.conditions;if(s){for(var l=0,d=["visibleWhen","hideWhen","disabledWhen","requiredWhen","readOnlyWhen","choiceBasedField","conditionalData"];l<d.length;l++){var c=d[l];s[c]&&(this.collectConditionFieldIds(s[c],e),this.collectConditionFieldIds(s[c],o))}if(Array.isArray(s.conditionalData))for(var u=0,p=s.conditionalData;u<p.length;u++){var h=p[u];if(h&&h.condition&&(this.collectConditionFieldIds(h.condition,e),this.collectConditionFieldIds(h.condition,o)),h&&Array.isArray(h.conditions))for(var m=0,f=h.conditions;m<f.length;m++){var v=f[m];this.collectConditionFieldIds(v,e),this.collectConditionFieldIds(v,o)}}s.setValueWhen&&s.setValueWhen.condition&&(this.collectConditionFieldIds(s.setValueWhen.condition,e),this.collectConditionFieldIds(s.setValueWhen.condition,o)),s.choiceBasedField&&"string"==typeof s.choiceBasedField.primaryFieldId&&(e.add(s.choiceBasedField.primaryFieldId),o.add(s.choiceBasedField.primaryFieldId))}var y=i.dataSource;if("dataGrid"===i.type&&y&&"url"===y.type&&(y.search&&"string"==typeof y.search.key&&(this.collectDataSourceReferenceIds(y.search.key,n,e),this.collectDataSourceReferenceIds(y.search.key,n,o)),Array.isArray(y.filters)))for(var g=0,b=y.filters;g<b.length;g++){var x=b[g];"string"==typeof x.value&&(this.collectDataSourceReferenceIds(x.value,n,e),this.collectDataSourceReferenceIds(x.value,n,o))}}this.conditionalTriggerFieldIds=e,this.consumerDependencyMap=t},i.prototype.isConditionalTrigger=function(e){return this.conditionalTriggerFieldIds.has(e)},i.prototype.rerenderForm=function(e){var t=this,n=e||new Set,r=document.activeElement,a=r&&r.getAttribute?r.getAttribute("name"):null,i=null,s=null;if(a&&r&&void 0!==r.selectionStart)try{i=r.selectionStart,s=r.selectionEnd}catch(e){}var l=this.element.scrollTop,d=this.element.scrollLeft,c=window.scrollX,u=window.scrollY;this.preservedFields.clear();for(var p=this,h=0,m=this.collectAllComponents(this.processedSchemaCache.components);h<m.length;h++)!function(e){if(!o.PRESERVABLE_TYPES.has(e.type))return"continue";var t=p.consumerDependencyMap.get(e.id),r=!1;if(t&&n.forEach(function(e){t.has(e)&&(r=!0)}),r)return"continue";var a=p.element.querySelector('[data-field-id="'+e.id+'"]');a&&a.parentElement&&(a.parentElement.removeChild(a),p.preservedFields.set(e.id,a))}(m[h]);this.refreshing=!0,this.destroyRenderedExcludingPreserved(),this.removePreviousRoot(),this.validator&&this.validator.destroy(),this.render(),this.refreshing=!1;try{this.element.scrollTop=l,this.element.scrollLeft=d,window.scrollTo(c,u)}catch(e){}if(a){var f=this.getInputElementByName(a);if(f&&"function"==typeof f.focus)try{if(f.focus(),null!==i&&null!==s&&"function"==typeof f.setSelectionRange)try{f.setSelectionRange(i,s)}catch(e){}}catch(e){}}if(this.preservedFields.size>0){var v=[];this.preservedFields.forEach(function(e,n){if(t.element.contains(e)||document.body.contains(e))v.push(n);else{t.destroyPreservedSubtree(e);try{e.parentNode&&e.parentNode.removeChild(e)}catch(e){}t.preservedFields.delete(n)}}),v.forEach(function(e){return t.preservedFields.delete(e)})}},i.prototype.removePreviousRoot=function(){if(this.element)for(;this.element.childNodes.length>0;)this.element.removeChild(this.element.firstChild)},i.prototype.destroyRenderedInstance=function(e){if(e&&"function"==typeof e.destroy){var t=e;if(!(t.isDestroyed||t.destroyed||t.disposed)){var n=e.element||e.target||(e.hostElement&&"function"==typeof e.hostElement?e.hostElement():void 0);try{t.isDestroyed=!0,t.destroyed=!0,t.disposed=!0,e.destroy()}catch(e){console.warn("FormRenderer: failed to destroy child instance.",e)}finally{if(n&&n.parentNode)try{n.parentNode.removeChild(n)}catch(e){}}}}},i.prototype.destroyRenderedExcludingPreserved=function(){for(var e=[],t=Array.from(this.preservedFields.values()),n=this,r=0,a=this.renderedInstances;r<a.length;r++)!function(r){var a=r&&(r.element||r.target||r.hostElement&&r.hostElement());!!a&&t.some(function(e){return e===a||e.contains(a)})?e.push(r):n.destroyRenderedInstance(r)}(a[r]);this.renderedInstances=e;for(var i=this,o=0,s=Object.keys(this.inputRefs);o<s.length;o++)!function(e){var n=i.inputRefs[e],r=n&&(n.element||n.target||n.hostElement&&n.hostElement());!!r&&t.some(function(e){return e===r||e.contains(r)})||delete i.inputRefs[e]}(s[o]);this.conditionalValueApplied={},this.expressionDependencyGraph={},this.computedFieldNames=new Set,this.previousFormValues={},this.conditionalTriggerFieldIds=new Set},i.prototype.destroyPreservedSubtree=function(e){for(var t=[],n=0,r=this.renderedInstances;n<r.length;n++){var a=r[n],i=a&&(a.element||a.target||a.hostElement&&a.hostElement());i&&(i===e||e.contains(i))?this.destroyRenderedInstance(a):t.push(a)}this.renderedInstances=t},i.prototype.getInputElementByName=function(e){var t=this.element.querySelector('[name="'+e+'"]');if(!t)return null;if(!t.classList.contains("e-control")){var n=t.parentElement?t.parentElement.querySelector(".e-control"):null;if(n)return n}return t},i.prototype.evaluateExpressions=function(){if(this.formState&&this.expressionEngine&&!this.expressionEvaluationInProgress)try{this.expressionEvaluationInProgress=!0;var e=this.expressionEngine,t=this.expressionDependencyGraph,n=this.formState.values||{},r=this.collectAllComponents(this.processedSchemaCache.components),a=this.previousFormValues,i=this.computedFieldNames,o={};r.forEach(function(e){e.name&&(o[e.id]=e.name)});for(var s={},l=0,d=Object.keys(n);l<d.length;l++){var c=d[l],u=n[c];(b=o[c])&&(s[b]=u)}var p=se({},a);Object.assign(a,s);for(var h=new Set,m=0,f=Object.keys(s);m<f.length;m++)!function(e){var t=Object.keys(o).find(function(t){return o[t]===e});t&&s[e]!==p[e]&&!i.has(t)&&h.add(e)}(b=f[m]);if(0===h.size)return;for(var v=this,y=0,g=e.getTopologicalOrder(t);y<g.length;y++){var b=g[y];!function(t){var a=r.find(function(e){return e.name===t});if(a&&a.expressionValue){i.add(a.id);try{if(!1!==a.visible&&x.isFieldVisible(a.conditions,n)){for(var s={},l=0,d=Object.keys(n);l<d.length;l++){var c=d[l],u=n[c],p=o[c];p&&(s[p]=u)}var h=e.evaluate(a.expressionValue,s);if(null!==(h="string"==typeof h&&-1!==h.indexOf("undefined")?h.replace(/undefined/g,""):h)&&void 0!==h&&""!==h)switch(a.type){case"number":var m=Number(h);h=isNaN(m)?0:m;break;case"checkbox":case"switch":h=Boolean(h);break;case"textbox":case"textarea":h=String(h);break;case"dateRange":case"checkboxGroup":case"multiselect":break;default:h=String(h)}if(null!==h&&void 0!==h&&h!==n[a.id]&&v.formState&&(v.formState.values[a.id]=h,v.validator)){var f=v.getInputElementByName(a.id);if(f)try{f.ej2_instances[0]?f.ej2_instances[0].value=h:f.value=String(h)}catch(e){}}}}catch(e){v.failure&&v.trigger("failure",{error:e})}}}(b)}Object.assign(a,s)}finally{this.expressionEvaluationInProgress=!1}},i.prototype.retriggerCustomValidation=function(){var e=this;if(this.formState&&this.customValidationEngine)try{var t=this.collectAllComponents(this.processedSchemaCache.components),n=this.formState.values||{},r=this.previousFormValues,a=new Set;if(Object.keys(n).forEach(function(e){n[e]!==r[e]&&a.add(e)}),0===a.size)return;var i=new Set;a.forEach(function(e){var n=t.find(function(t){return t.id===e});n&&n.customValidation&&Array.isArray(n.customValidation)&&i.add(e)}),t.forEach(function(n){n.customValidation&&Array.isArray(n.customValidation)&&n.customValidation.forEach(function(r){e.customValidationEngine.extractDependencies(r.expression).forEach(function(e){var r=t.find(function(t){return t.id===e||t.name===e});r&&a.has(r.id)&&i.add(n.id)})})}),this.previousFormValues=se({},n)}catch(e){this.failure&&this.trigger("failure",{error:e})}},i.prototype.handleSubmitData=function(e){for(var t=this.formState,n=!(!t||!t.errors)&&0===Object.keys(t.errors).length,r={},a=t?t.values:{},i=new Set(["button","message","panel","table","tabs"]),o=this.collectAllComponents(this.processedSchemaCache.components||[]),s=new Set(o.filter(function(e){return i.has(e.type)}).map(function(e){return e.id})),l=new Set(o.filter(function(e){return!1===e.visible||(!(!e.conditions||!e.conditions.visibleWhen||x.isFieldVisible(e.conditions,a))||!!(e.conditions&&e.conditions.hideWhen&&x.isFieldHidden(e.conditions,a)))}).map(function(e){return e.id})),d=new Set(o.filter(function(e){return!!e.disabled||!(!e.conditions||!e.conditions.disabledWhen)&&x.isFieldDisabled(e.conditions,a)}).map(function(e){return e.id})),c=0,u=Object.keys(e);c<u.length;c++){var p=u[c],h=e[p];if(s.has(p)||l.has(p)||d.has(p))return;r[this.idToLabelCache[p]||p]=h}this.submit&&this.trigger("submit",{data:r,isValid:n})},i.prototype.getComponent=function(e){return this.inputRefs[e]||null},i.prototype.onPropertyChanged=function(e,t){var n=!1;e.schema!==t.schema&&(n=!0),e.locale!==t.locale&&(n=!0),e.enableRtl!==t.enableRtl&&(n=!0),e.layout!==t.layout&&(n=!0),e.locale!==t.locale&&(n=!0),n&&(this.refreshing=!0,this.destroyRendered(),this.removePreviousRoot(),this.isInitialized=!1,this.render(),this.refreshing=!1)},i.prototype.destroyRendered=function(){var e=this;if(this.validator){try{this.validator.destroy()}catch(e){this.trigger("failure",{error:e})}this.validator=null}this.renderedInstances.forEach(function(t){e.destroyRenderedInstance(t)}),this.renderedInstances=[],this.removePreviousRoot(),this.inputRefs={},this.tooltipRefs={},this.conditionalValueApplied={},this.expressionDependencyGraph={},this.computedFieldNames=new Set,this.previousFormValues={},this.conditionalTriggerFieldIds=new Set,this.consumerDependencyMap=new Map,this.preservedFields=new Map,this.pendingChangedFieldIds=new Set},i.prototype.clearPersistedTabSelections=function(){if("undefined"==typeof window)return null;try{var e=this.processedSchemaCache&&this.processedSchemaCache.components?this.processedSchemaCache.components:[];this.collectAllComponents(e).forEach(function(e){"tabs"===e.type&&e.id&&window.localStorage.removeItem("tab"+e.id)})}catch(e){}},i.prototype.destroy=function(){this.destroyRendered(),this.formState={values:{},errors:{}},this.expressionEngine=null,this.customValidationEngine=null,this.clearEngineCaches(),this.clearPersistedTabSelections(),this.consumerDependencyMap=new Map,this.preservedFields=new Map,this.conditionalTriggerFieldIds=new Set,e.prototype.destroy.call(this)},i.prototype.clearEngineCaches=function(){if(this.expressionEngine)try{this.expressionEngine.clearCache()}catch(e){}if(this.customValidationEngine){var e=this.customValidationEngine.expressionEngine;if(e&&"function"==typeof e.clearCache)try{e.clearCache()}catch(e){}}};var o;return i.PRESERVABLE_TYPES=new Set(["textbox","textarea","number","checkbox","checkboxGroup","radio","dropdown","multiselect","button","date","dateTime","time","dateRange","switch","signature","rating","imageEditor","fileUpload","rangeSlider","colorPicker","inputMask","message","panel","table","tabs","dataGrid","staticHtml","card","splitButton","richTextEditor"]),le([t.Property(null)],i.prototype,"schema",void 0),le([t.Property("SingleColumn")],i.prototype,"layout",void 0),le([t.Property("")],i.prototype,"className",void 0),le([t.Event()],i.prototype,"submit",void 0),le([t.Event()],i.prototype,"change",void 0),le([t.Event()],i.prototype,"buttonClick",void 0),le([t.Event()],i.prototype,"failure",void 0),le([t.Event()],i.prototype,"created",void 0),i=o=le([t.NotifyPropertyChanges],i)}(t.Component);!function(e){e.SingleColumn="SingleColumn",e.TwoColumn="TwoColumn",e.ThreeColumn="ThreeColumn",e.FourColumn="FourColumn"}(e.FormLayout||(e.FormLayout={}));var pe=["textbox","textarea","number","checkbox","checkboxGroup","radio","dropdown","multiselect","button","date","dateTime","time","dateRange","switch","signature","rating","imageEditor","fileUpload","rangeSlider","colorPicker","inputMask","message","panel","table","tabs","dataGrid","staticHtml","card","splitButton","richTextEditor"];return e.FORM_COMPONENT_TYPES=pe,e.FormRenderer=ue,e.defaultLocale=ce,e}({},ej.base,ej.navigations,ej.popups,ej.inputs,ej.buttons,ej.splitbuttons,ej.dropdowns,ej.calendars,ej.notifications,ej2ImageEditor,ej.richtexteditor,ej.data,ej.grids),this.ejs=ej;
10
+ this.ej=this.ej||{},this.ej.formrenderer=function(e,t,n,r,a,i,o,s,l,d,c,u,p,h){"use strict";function m(e){for(var t=new Map,n=0,r=Object.keys(e.properties);n<r.length;n++){var a=r[n];t.set(a,e.properties[a])}var i,o=new Set,s=function(e){for(var n=[],r=0,a=e;r<a.length;r++)!function(e){if("field"===e.type){var r=e;if(o.has(r.propertyId))return"continue";o.add(r.propertyId);var a=t.get(r.propertyId);if(a)n.push(f(a));else{var i={id:r.propertyId||w("textbox"),name:S(""),type:"textbox",label:"Unknown Field",_configured:!0};n.push(i)}}else if("table"===e.type){var l=e,d=C({id:l.id||w("table"),name:l.name,type:"table",label:l.label||"Table",cssClass:l.cssClass,hideBorders:l.hideBorders,rows:l.rows,columns:l.cols,columnWidths:l.columnWidths,tableCells:[],_configured:!0},l.conditions?{conditions:l.conditions}:{});l.cells.forEach(function(e){var t=[];e.forEach(function(e){var n=s(e.children);t.push(n)}),d.tableCells.push(t)}),n.push(d)}else if("panel"===e.type){var c=e,u=C({id:c.id||w("panel"),type:"panel",name:c.name,cssClass:c.cssClass,hideBorders:c.hideBorders,hideLabel:c.hideLabel,label:c.label||"Panel",children:s(c.children),_configured:!0},c.conditions?{conditions:c.conditions}:{});n.push(u)}else if("tabs"===e.type){var p=e,h=C({id:p.id||w("tabs"),type:"tabs",name:p.name,label:p.label||"Tabs",cssClass:p.cssClass,tabOptions:p.tabOptions,tabItems:[],_configured:!0},p.conditions?{conditions:p.conditions}:{});p.tabs.forEach(function(e){h.tabItems.push({header:e.header,content:s(e.children)})}),n.push(h)}else if("card"===e.type){var m=e,v=C({id:m.id||w("card"),type:"card",name:m.name,label:m.label||"Card",cssClass:m.cssClass,hideLabel:m.hideLabel,children:s(m.children),_configured:!0},m.conditions?{conditions:m.conditions}:{});void 0!==m.cardTitle&&(v.cardTitle=m.cardTitle),void 0!==m.cardSubtitle&&(v.cardSubtitle=m.cardSubtitle),n.push(v)}}(a[r]);return n};return i=e.layout&&0!==e.layout.length?s(e.layout):Object.keys(e.properties).map(function(t){return f(e.properties[t])}),C({version:e.version,components:i},e.settings?{settings:e.settings}:{})}function f(e){var t=void 0!==e.options&&e.options.length>0,n={id:e.id||w(e.widget||v(e.type,e.format,t)),name:e.name,type:e.widget||v(e.type,e.format,t),label:e.label||e.id},r=new Set(["id","type","name","label","format","widget","defaultValue","required","options","expressionValue","minLength","maxLength","minimum","maximum","minValue","maxValue","minDate","maxDate","minTime","maxTime","regex","pattern","content","buttonType","textboxType"]);return Object.keys(e).forEach(function(t){r.has(t)||"id"===t||"name"===t||"type"===t||"label"===t||(n[t]=e[t])}),void 0!==e.defaultValue&&(n.defaultValue=e.defaultValue),void 0!==e.expressionValue&&(n.expressionValue=e.expressionValue),void 0!==e.required&&(n.required=e.required),void 0!==e.content&&(n.content=e.content),void 0!==e.buttonType&&(n.buttonType=e.buttonType),void 0!==e.textboxType&&(n.textboxType=e.textboxType),void 0!==e.options&&(n.options=e.options),void 0!==e.minLength&&(n.minLength=e.minLength),void 0!==e.maxLength&&(n.maxLength=e.maxLength),void 0!==e.minValue&&(n.minValue=e.minValue),void 0!==e.maxValue&&(n.maxValue=e.maxValue),void 0!==e.minDate&&(n.minDate=e.minDate),void 0!==e.maxDate&&(n.maxDate=e.maxDate),void 0!==e.minTime&&(n.minTime=e.minTime),void 0!==e.maxTime&&(n.maxTime=e.maxTime),void 0!==e.pattern&&(n.regex=e.pattern),n}function v(e,t,n){return"string"===e?"date"===t?"date":"date-time"===t?"dateTime":"time"===t?"time":"email"===t?"email":"url"===t?"url":n?"dropdown":"textbox":"number"===e?"number":"boolean"===e?"checkbox":"array"===e?"multiselect":"button"===e?"button":"message"===e?"message":"sign"===e?"signature":"image"===e?"imageEditor":"file"===e?"fileUpload":"color"===e?"colorPicker":"grid"===e?"dataGrid":"textbox"}function y(e){var t=e.map(function(e){return null===e?NaN:Number(e)}),n=t.reduce(function(e,t){return e+(isNaN(t)?0:t)},0),r=Math.max(0,Math.round(100-n)),a=t.map(function(e,t){return isNaN(e)?t:-1}).filter(function(e){return e>=0}),i=a.length;if(0===i)return t.map(function(e){return Math.round(e)});var o=Math.floor(r/i),s=r-o*i;return a.forEach(function(e){var n=s>0?o+1:o;t[e]=n,s=Math.max(0,s-1)}),t.map(function(e){return isNaN(e)?0:Math.round(e)})}function g(e,n){var r=new t.Internationalization,a=r.getDateFormat({format:"MM/dd/yyyy",type:"date"});return"date"===e.type&&(n=a(new Date(n))),"time"===e.type&&(n=(a=r.getDateFormat({format:"hh:mm a",type:"time"}))(new Date(n))),"dateTime"===e.type&&(n=(a=r.getDateFormat({format:"MM/dd/yyyy hh:mm a",type:"dateTime"}))(new Date(n))),"dateRange"===e.type&&Array.isArray(n)&&(n=n.map(function(e){return e?a(new Date(e)):null})),n}function b(e,t){var n="string"==typeof t&&t?t:"field_"+Date.now()+"_"+Math.floor(1e3*Math.random());if(null===e||void 0===e)return n;var r=String(e).trim();return r&&"__proto__"!==r&&"prototype"!==r&&"constructor"!==r?(r=r.replace(/[^A-Za-z0-9_-]/g,"_"),/^[A-Za-z_]/.test(r)||(r="f_"+r),r.length>100&&(r=r.slice(0,100)),"__proto__"===r||"prototype"===r||"constructor"===r?n:r):n}var x=function(){function e(){}return e.evaluateCondition=function(e,t){try{return"field"in e&&"operator"in e&&"value"in e?this.evaluateSimpleRule(e,t):"condition"in e&&"rules"in e&&this.evaluateCompositeRule(e,t)}catch(e){return!1}},e.evaluateSimpleRule=function(e,n){try{var r=n[e.field],a=e.operator.toLowerCase();if(void 0===r&&-1===["equal","equals","notequal","notequals","isempty","isnotempty"].indexOf(a))return!1;var i=Array.isArray(r),o=new t.Internationalization;switch(a){case"equal":case"equals":return r===e.value;case"notequal":case"notequals":return r!==e.value;case"startswith":return r.startsWith(e.value);case"doesnotstartswith":return!r.startsWith(e.value);case"greaterthan":case"lessthan":case"greaterthanorequal":case"lessthanorequal":var s=Number(r),l=Number(e.value);return!Number.isNaN(s)&&!Number.isNaN(l)&&("greaterthan"===a?s>l:"lessthan"===a?s<l:"greaterthanorequal"===a?s>=l:s<=l);case"dategreaterthan":case"datelessthan":var d=o.parseDate(r,{format:"MM/dd/yyyy"}),c=o.parseDate(e.value,{format:"MM/dd/yyyy"});return null!==d&&null!==c&&("dategreaterthan"===a?d>c:"datelessthan"===a?d<c:d<=c);case"timegreaterthan":case"timelessthan":var u=o.parseDate(r,{format:"hh:mm a",type:"time"}),p=o.parseDate(e.value,{format:"hh:mm a",type:"time"});if(null!==u&&null!==p){if("timegreaterthan"===a)return u>p;if("timelessthan"===a)return u<p}return!1;case"datetimegreaterthan":case"datetimelessthan":var h=o.parseDate(r,{format:"MM/dd/yyyy hh:mm a",type:"dateTime"}),m=o.parseDate(e.value,{format:"MM/dd/yyyy hh:mm a",type:"dateTime"});if(null!==h&&null!==m){if("datetimegreaterthan"===a)return h>m;if("datetimelessthan"===a)return h<m}return!1;case"contains":return i?"string"==typeof e.value&&-1!==e.value.indexOf(",")?(f=e.value.split(",").map(function(e){return e.trim()})).some(function(e){return-1!==r.indexOf(e)}):-1!==r.indexOf(e.value):-1!==String(r).indexOf(String(e.value));case"notcontains":if(i){if("string"==typeof e.value&&-1!==e.value.indexOf(",")){var f=e.value.split(",").map(function(e){return e.trim()});return!f.some(function(e){return-1!==r.indexOf(e)})}return-1===r.indexOf(e.value)}return-1===String(r).indexOf(String(e.value));case"isempty":return i?0===r.length:!r||0===String(r).length;case"isnotempty":return i?r.length>0:!!r&&String(r).length>0;default:return!1}}catch(e){return!1}},e.evaluateCompositeRule=function(e,t){var n=this;try{if(!Array.isArray(e.rules)||0===e.rules.length)return!1;var r=e.condition.toLowerCase();return"and"===r?e.rules.every(function(e){return n.evaluateCondition(e,t)}):"or"===r&&e.rules.some(function(e){return n.evaluateCondition(e,t)})}catch(e){return!1}},e.isFieldVisible=function(e,t){try{return!e||!e.visibleWhen||this.evaluateCondition(e.visibleWhen,t)}catch(e){return!0}},e.isFieldReadOnly=function(e,t){try{return!(!e||!e.readOnlyWhen)&&this.evaluateCondition(e.readOnlyWhen,t)}catch(e){return!1}},e.isFieldDisabled=function(e,t){try{return!(!e||!e.disabledWhen)&&this.evaluateCondition(e.disabledWhen,t)}catch(e){return!1}},e.isFieldHidden=function(e,t){try{return!(!e||!e.hideWhen)&&this.evaluateCondition(e.hideWhen,t)}catch(e){return!1}},e.isFieldRequired=function(e,t){try{return!(!e||!e.requiredWhen)&&this.evaluateCondition(e.requiredWhen,t)}catch(e){return!1}},e.getConditionalValue=function(e,t){try{if(!e||!e.setValueWhen)return;if(this.evaluateCondition(e.setValueWhen.condition,t))return e.setValueWhen.value;return}catch(e){return}},e.evaluateConditionalDataRules=function(e,t){if(!e||!Array.isArray(e))return-1;for(var n=0;n<e.length;n++){var r=e[n];if(this.evaluateCondition(r.condition,t))return n}return-1},e.getChoiceBasedOptions=function(e,t,n,r){try{var a=n&&n[r];if(null===a||void 0===a)return e.showAllWhenNotMapped?t:[];var i=String(a);return i in e.choiceMapping?e.choiceMapping[i].filter(function(e){return-1!==t.indexOf(e)}):e.showAllWhenNotMapped?t:[]}catch(e){return t}},e}(),C=function(){return(C=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)},w=function(e){return e+"_"+Date.now()+"_"+Math.floor(1e3*Math.random())},S=function(e){return e+"_"+Math.floor(1e3*Math.random())},E=function(){function e(){this.supportedFunctions=["SUM","AVG","MIN","MAX","COUNT","ROUND","FLOOR","CEIL","ABS","SQRT","UPPER","LOWER","CONCAT","LENGTH","TRIM","SUBSTRING","TODAY","AGE","DATEFORMAT","DATEDIFF","ADDDAYS","SUBDAYS","INCLUDES","CONTAINS","ISNAN","SUPPORTEDVALUESOF","TOSTRING","DATE","GETTIME","EVERY","SOME"],this.availableFields=new Map}return e.prototype.setAvailableFields=function(e){var t=this;this.availableFields.clear(),e.forEach(function(e){t.availableFields.set(e.name,e)})},e.prototype.validateFieldOperations=function(e){var t=[];if(0===this.availableFields.size)return t;for(var n,r=["-","*","/","%","^"],a=["-","*","/","%","^","+"],i=new Set,o=/(\{[^}]+\})/g;null!==(n=o.exec(e));){var s=n[0],l=s.slice(1,-1),d=this.availableFields.get(l);if(d){var c=n.index,u=c+s.length,p=e.substring(Math.max(0,c-10),c),h=e.substring(u,Math.min(e.length,u+10)),m=p.replace(/\s+$/,"").slice(-1),f=h.replace(/^\s+/,"").charAt(0),v=p.replace(/\s+$/,""),y=h.replace(/^\s+/,""),g=c-(p.length-v.length)-1,b=u+(h.length-y.length);if("string"===d.type&&!d.format){if(m&&-1!==r.indexOf(m)){x=g+":"+m;i.has(x)||(t.push("Cannot perform '"+m+"' operation on string field '{"+l+"}'"),i.add(x))}if(f&&-1!==r.indexOf(f)){x=b+":"+f;i.has(x)||(t.push("Cannot perform '"+f+"' operation on string field '{"+l+"}'"),i.add(x))}}if("date"===d.format||"date-time"===d.format||"time"===d.format){if(m&&-1!==a.indexOf(m)){x=g+":"+m;i.has(x)||(t.push("Cannot perform '"+m+"' operation on date field '{"+l+"}'"),i.add(x))}if(f&&-1!==a.indexOf(f)){var x=b+":"+f;i.has(x)||(t.push("Cannot perform '"+f+"' operation on date field '{"+l+"}'"),i.add(x))}}}}return t},e.prototype.validate=function(e){var t=[];if(!e||""===e.trim())return{valid:!0,errors:[]};(e.match(/\{/g)||[]).length!==(e.match(/\}/g)||[]).length&&t.push("Unbalanced braces in expression"),(e.match(/\(/g)||[]).length!==(e.match(/\)/g)||[]).length&&t.push("Unbalanced parentheses in expression");for(var n,r=/(\w+)\s*\(/g;null!==(n=r.exec(e));){var a=n[1].toUpperCase();a===a.toUpperCase()&&-1===this.supportedFunctions.indexOf(a)&&t.push("Unknown function: "+a)}var i=this.validateFieldOperations(e);return t.push.apply(t,i),{valid:0===t.length,errors:t}},e.prototype.compile=function(e,t){void 0===t&&(t={});try{if(t.availableFields&&Array.isArray(t.availableFields)&&this.setAvailableFields(t.availableFields),!this.validate(e).valid)return function(){return null};var n=e;return n=this.compileFieldReferences(n),n=t.isCustomValidation?this.compileInputReferences(n):n,n=this.compileBareFunctionCalls(n),n=this.compileMatrixExpressions(n),function(e){try{return new Function("context","\n try {\n return "+n+";\n } catch (e) {\n return null;\n }\n ")(e)}catch(e){return null}}}catch(e){return function(){return null}}},e.prototype.compileMatrixExpressions=function(e){var t=e,n=["PI","TRUE","FALSE","NULL","UNDEFINED","Math"],r=["SUM","AVG","MIN","MAX","COUNT","ROUND","FLOOR","CEIL","ABS","SQRT","UPPER","LOWER","CONCAT","LENGTH","TRIM","SUBSTRING","TODAY","AGE","DATEFORMAT","DATEDIFF","ADDDAYS","SUBDAYS"];return t=t.replace(/\$?\{([^}]+)\}/g,function(e,t){var a=t;return r.forEach(function(e){var t=new RegExp("(?<!context\\.)\\b"+e+"\\b(?=\\s*\\()","g");a=a.replace(t,"context."+e)}),n.forEach(function(e){var t=new RegExp("\\b"+e+"\\b","g");a=a.replace(t,"context."+e)}),"("+a+")"})},e.prototype.compileBareFunctionCalls=function(e){var t=e;return["SUM","AVG","MIN","MAX","COUNT","ROUND","FLOOR","CEIL","ABS","SQRT","UPPER","LOWER","CONCAT","LENGTH","TRIM","SUBSTRING","TODAY","AGE","DATEFORMAT","DATEDIFF","ADDDAYS","SUBDAYS"].forEach(function(e){var n=new RegExp("(?<!context\\.)\\b"+e+"\\b(?=\\s*\\()","g");t=t.replace(n,"context."+e)}),t},e.prototype.compileFieldReferences=function(e){var t=e;return t=t.replace(/\{([^{}]+)\}/g,function(e,t){return t.startsWith("\\")&&t.endsWith("\\")?e:"context['"+t.replace(/\./g,"'].[")+"']"})},e.prototype.compileInputReferences=function(e){var t=[],n=e,r=n=(n=(n=n.replace(/(['"`])(?:(?=(\\?))\2.)*?\1/g,function(e){return t.push(e),"__STRING_"+(t.length-1)+"__"})).replace(/(?<!context\[')\binput\./g,"context['input'].")).replace(/(?<!context\[')\binput\b(?!\s*[(\.])/g,"context['input']");return t.forEach(function(e,t){r=r.replace("__STRING_"+t+"__",e)}),r},e}(),T=function(){function e(){this.escapedBracePattern=/\\{.*?\\}/g}return e.prototype.extractFieldReferences=function(e){if(!e)return[];for(var t,n=new Set,r=e.replace(this.escapedBracePattern,""),a=/\{([^{}]+)\}/g;null!==(t=a.exec(r));){var i=t[1].trim();if(!this.isFunctionCall(i)&&!this.isOperator(i)){var o=i.split(/[.\[\]]/)[0].trim();o&&!this.isKeyword(o)&&n.add(o)}}for(var s=/\$\{([^}]+)\}/g;null!==(t=s.exec(r));)for(var l=t[1],d=/\b([a-zA-Z_][a-zA-Z0-9_]*)\b(?!\s*[(\.])/g,c=void 0;null!==(c=d.exec(l));){var u=c[1];this.isKeyword(u)||"Math"===u||n.add(u)}return Array.from(n)},e.prototype.buildGraph=function(e){for(var t={},n=0,r=Object.keys(e);n<r.length;n++){var a=r[n],i=this.extractFieldReferences(e[a]);t[a]=i}return t},e.prototype.detectCircularDependencies=function(e){for(var t=new Set,n=new Set,r=[],a=function(i,o){t.add(i),n.add(i),o.push(i);for(var s=0,l=e[i]||[];s<l.length;s++){var d=l[s];if(t.has(d)){if(n.has(d)){var c=o.indexOf(d);r.push(o.slice(c).concat([d]))}}else a(d,o.slice())}n.delete(i)},i=0,o=Object.keys(e);i<o.length;i++){var s=o[i];t.has(s)||a(s,[])}return r},e.prototype.getTopologicalOrder=function(e){for(var t=new Set,n=[],r=function(a){if(!t.has(a)){t.add(a);for(var i=0,o=e[a]||[];i<o.length;i++){var s=o[i];e[s]&&r(s)}n.push(a)}},a=0,i=Object.keys(e);a<i.length;a++){var o=i[a];r(o)}return n},e.prototype.isFunctionCall=function(e){return/^\w+\s*\(/.test(e)},e.prototype.isOperator=function(e){return/^[+\-*/()=!<>&|]/.test(e)},e.prototype.isKeyword=function(e){return-1!==["PI","TRUE","FALSE","NULL","UNDEFINED","and","or","in"].indexOf(e.toUpperCase())},e}(),A=function(){return(A=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)},D=function(){function e(){this.evaluationCache=new Map,this.compiledFunctions=new Map,this.parser=new E,this.dependencyTracker=new T}return e.prototype.evaluate=function(e,t,n,r){void 0===n&&(n={}),void 0===r&&(r=!1);try{if(!e||""===e.trim())return null;var a=n.timeout,i=void 0===a?5e3:a,o=n.maxDepth,s=void 0===o?10:o,l=n.locale,d=void 0===l?"en-US":l,c=n.throwOnError,u=void 0!==c&&c,p=this.getCacheKey(e,t);if(!r&&this.evaluationCache.has(p))return this.evaluationCache.get(p);var h=this.compiledFunctions.get(e);h||(h=this.parser.compile(e,{timeout:i,maxDepth:s,locale:d,isCustomValidation:r}),this.compiledFunctions.set(e,h));var m=this.buildContext(t),f=Date.now(),v=h(m);if(Date.now()-f>i){var y=new Error("Expression evaluation exceeded timeout of "+i+"ms");if(u)throw y;return null}return this.evaluationCache.set(p,v),v}catch(y){if(n.throwOnError)throw y;return null}},e.prototype.extractDependencies=function(e){return e?this.dependencyTracker.extractFieldReferences(e):[]},e.prototype.buildDependencyGraph=function(e){var t=this,n={};return e.forEach(function(e){if(e.expressionValue){var r=t.extractDependencies(e.expressionValue);n[e.name]=r}}),n},e.prototype.detectCircularDependencies=function(e){for(var t=new Set,n=new Set,r=[],a=function(i,o){t.add(i),n.add(i),o.push(i);for(var s=0,l=e[i]||[];s<l.length;s++){var d=l[s];if(t.has(d)){if(n.has(d)){var c=o.indexOf(d);r.push(o.slice(c).concat([d]))}}else a(d,o.slice())}n.delete(i)},i=0,o=Object.keys(e);i<o.length;i++){var s=o[i];t.has(s)||a(s,[])}return r},e.prototype.getTopologicalOrder=function(e){for(var t=new Set,n=[],r=function(a){if(!t.has(a)){t.add(a);for(var i=0,o=e[a]||[];i<o.length;i++)r(o[i]);n.push(a)}},a=0,i=Object.keys(e);a<i.length;a++){var o=i[a];r(o)}return n},e.prototype.clearCache=function(){this.evaluationCache.clear(),this.compiledFunctions.clear()},e.prototype.getCacheKey=function(e,t){return e+":"+JSON.stringify(t)},e.prototype.buildContext=function(e){var n=new t.Internationalization,r=n.getDateFormat({format:"MM/dd/yyyy",type:"date"});return A({},e,{PI:Math.PI,TRUE:!0,FALSE:!1,NULL:null,UNDEFINED:void 0,Math:Math,SUM:function(e){return Array.isArray(e)?e.reduce(function(e,t){return Number(e)+Number(t)},0):0},AVG:function(e){return Array.isArray(e)&&0!==e.length?e.reduce(function(e,t){return Number(e)+Number(t)},0)/e.length:0},MIN:function(e){return Array.isArray(e)&&e.length>0?Math.min.apply(Math,e.map(Number)):0},MAX:function(e){return Array.isArray(e)&&e.length>0?Math.max.apply(Math,e.map(Number)):0},COUNT:function(e){return Array.isArray(e)?e.length:0},ROUND:function(e,t){return void 0===t&&(t=0),Math.round(e*Math.pow(10,t))/Math.pow(10,t)},FLOOR:Math.floor,CEIL:Math.ceil,ABS:Math.abs,SQRT:Math.sqrt,UPPER:function(e){return String(e).toUpperCase()},LOWER:function(e){return String(e).toLowerCase()},CONCAT:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.map(String).join("")},LENGTH:function(e){return String(e).length},TRIM:function(e){return String(e).trim()},SUBSTRING:function(e,t,n){return void 0!==n?String(e).substr(t,n):String(e).substr(t)},TODAY:function(){return r(new Date)},AGE:function(e){var t="string"==typeof e?new Date(e):e,n=new Date,r=n.getFullYear()-t.getFullYear(),a=n.getMonth()-t.getMonth();return(a<0||0===a&&n.getDate()<t.getDate())&&r--,r},DATEFORMAT:function(e,t){var r="string"==typeof e?new Date(e):e;return n.getDateFormat({format:t,type:"date"})(r)},DATEDIFF:function(e,t){var n="string"==typeof e?new Date(e):e,r="string"==typeof t?new Date(t):t;return Math.floor((r.getTime()-n.getTime())/864e5)},ADDDAYS:function(e,t){var n=new Date(e);return n.setDate(n.getDate()+Number(t)),r(n)},SUBDAYS:function(e,t){var n=new Date(e);return n.setDate(n.getDate()-Number(t)),r(n)}})},e}(),V={EMAIL:/^(?!.*\.\.)[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/,URL:/^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\/[^\s]*)?$/,DATE_ISO:/^([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/,DIGITS:/^[0-9]*$/,PHONE:/^[+]?[0-9]{9,13}$/,CREDIT_CARD:/^\d{13,16}$/},O=function(e){return{primary:"e-primary",flat:"e-flat",information:"e-info",error:"e-danger",success:"e-success",warning:"e-warning"}[e||"primary"]||"e-primary"},I=function(e){return"submit"===e||"reset"===e?e:"button"},R=function(e){return{Left:"flex-start",Right:"flex-end",Center:"center"}[e||"Left"]||"flex-start"},F=function(e){switch(e){case"WebApiAdaptor":return new p.WebApiAdaptor;case"ODataV4Adaptor":return new p.ODataV4Adaptor;case"UrlAdaptor":default:return new p.UrlAdaptor}},k=function(e,t){if(!t||null===e||void 0===e)return e;for(var n=e,r=0,a=t.split(/\.(?![^\[]*\])/);r<a.length;r++){var i=a[r];if(null===n||void 0===n)return null;var o=i.match(/^(\w*)\[(\d+)\]$/);if(o){var s=o[1],l=parseInt(o[2]);n=s?n[s]&&n[s][l]:n[l]}else n=n[i]}return n},N=function(e,t){var n={},r=function(t){t.forEach(function(t){t.name&&t.id in e&&(n[t.name]=e[t.id]),t.children&&r(t.children),t.tabItems&&t.tabItems.forEach(function(e){return e.content&&r(e.content)}),t.tableCells&&t.tableCells.forEach(function(e){return e.forEach(function(e){return r(e)})})})};return r(t),n},M=new D,L=function(e,t,n){if("string"!=typeof e||!/{[^}]+}/.test(e))return e;var r=n?N(t,n):t;try{var a=M.evaluate(e,r);return null!==a&&void 0!==a?String(a):""}catch(t){return e}},P=function(e,t,n){return e&&"object"==typeof e&&!Array.isArray(e)&&"lookup"===e.type&&n?n&&n.length>0?n:[]:e&&"object"==typeof e&&!Array.isArray(e)&&"url"===e.type?t.length>0?t:[]:Array.isArray(e)?e:e&&"object"==typeof e&&!Array.isArray(e)&&"raw"===e.type&&Array.isArray(e.data)?e.data:[]},j=function(e,t){if(e&&e.conditionalData&&Array.isArray(e.conditionalData))for(var n=0,r=e.conditionalData;n<r.length;n++){var a=r[n];if(x.evaluateCondition(a.condition,t))return{dataSource:a.dataSource,columns:a.columns&&a.columns.length>0?a.columns:void 0}}},B=function(){function e(){}return e.fetch=function(e,t,n,r){if(!(e&&"object"==typeof e&&!Array.isArray(e)&&"url"===e.type&&e.url))return Promise.resolve({id:t,options:[]});var a=e;return new Promise(function(e){try{var i={};a.headers&&Array.isArray(a.headers)&&a.headers.forEach(function(e){e.key&&e.key.trim()&&(i[e.key]=e.value)});var o=new p.DataManager({url:a.url,adaptor:F(a.adaptorType),headers:Object.keys(i).length?i:void 0}),s=new p.Query;if(a.search&&a.search.enabled&&a.search.fields&&a.search.fields.length>0){var l=a.search.key||"search",d=n?L(l,n,r):/[{}]/.test(l)?"":l;s=s.search(d,a.search.fields)}if(a.sort&&a.sort.enabled&&a.sort.field){var c="descending"===a.sort.direction?"descending":"ascending";s=s.sortBy(a.sort.field,c)}a.filters&&Array.isArray(a.filters)&&a.filters.length>0&&a.filters.forEach(function(e){if(e.field&&e.operator&&void 0!==e.value&&""!==e.value){var t=n?L(e.value,n,r):/[{}]/.test(e.value)?"":e.value;""!==t&&(s=s.where(e.field,e.operator,t))}}),a.queryParams&&Object.keys(a.queryParams).forEach(function(e){s=s.addParams(e,a.queryParams[e])}),a.skip&&(s=s.skip(a.skip)),a.take&&(s=s.take(a.take));var u=!1,h=setTimeout(function(){u=!0,e({id:t,options:[]})},15e3);o.executeQuery(s).then(function(n){if(!u){clearTimeout(h);var r=n.result;a.dataPath&&(r=k(r,a.dataPath));var i;i=Array.isArray(r)?r:"string"==typeof r?[r]:[],e({id:t,options:i})}}).catch(function(n){u||(clearTimeout(h),e({id:t,options:[]}))})}catch(n){e({id:t,options:[]})}})},e}(),U=function(e){return e?Array.isArray(e)?e.reduce(function(e,t){return t&&t.key&&void 0!==t.value&&(e[t.key]=t.value),e},{}):e:{}},_=function(){function e(e){this.checkboxes=[],this.component=e.component,this.formState=e.formState,this.onChangeCb=e.onChange,this.optionRef=e.optionRef,this.enableRtl=e.enableRtl,this.target=e.target,this.container=null,this.itemsContainer=null,this.ref=e.ref}return e.prototype.getSelectedItems=function(){var e=this.formState?this.formState.values[this.component.id]:t.isNullOrUndefined(this.valueProp())?this.component.defaultValue:this.valueProp();return Array.isArray(e)?e:[]},e.prototype.valueProp=function(){return this._value},e.prototype.setValue=function(e){this._value=e},e.prototype.handleCheckboxChange=function(e,t){var n=this.getSelectedItems(),r=t?n.concat([e]):n.filter(function(t){return t!==e});this.formState&&this.onChangeCb(r)},Object.defineProperty(e.prototype,"sizeCssClass",{get:function(){return""+(this.component.cssClass||"")+("Small"===this.component.size?" e-small":"Bigger"===this.component.size?" e-bigger":"")},enumerable:!0,configurable:!0}),e.prototype.render=function(e){var t=this,n=this.component,r=n.label&&n.required?n.label+" *":n.label||"",a=e||this.target,o=document.createElement("div");o.className=("checkbox-group "+(n.cssClass||"")).trim(),o.setAttribute("role","group"),o.setAttribute("aria-label",r),o.title=n.tooltip||"";var s=U(n.htmlAttributes);Object.keys(s).forEach(function(e){"class"!==e&&"className"!==e&&"style"!==e&&o.setAttribute(e,String(s[e]))});var l="display:flex;flex-direction:"+("row"===n.layoutDirection?"row":"column")+";gap:"+(n.gap||"8px")+";align-items:flex-start;";o.setAttribute("style",l);var d=document.createElement("div");d.className="checkbox-group-items";var c="display:flex;flex-direction:"+("row"===n.layoutDirection?"row":"column")+";flex-wrap:wrap;gap:"+(n.gap||"2px")+";width:100%;";d.setAttribute("style",c);var u=Array.isArray(n.options)?n.options:["Option 1"],p=this.getSelectedItems();return u.forEach(function(e,r){var a="string"==typeof e?e:null!=e.value?e.value:null!=e.label?e.label:e.key,o="string"==typeof e?e:null!=e.label?e.label:null!=e.value?e.value:String(a),l=document.createElement("input");d.appendChild(l);var c=new i.CheckBox({label:o,enableRtl:t.enableRtl,checked:-1!==p.indexOf(a),disabled:!!n.disabled,labelPosition:n.checkboxLabelPosition||"After",cssClass:t.sizeCssClass.trim(),htmlAttributes:s,change:function(e){t.handleCheckboxChange(a,e.checked)}});c.appendTo(l),t.ref(c,r);var u=l.querySelector('input[type="checkbox"]');u&&(u.id=t.component.id+"_"+r),t.optionRef&&t.optionRef(c,r),t.checkboxes.push(c)}),o.appendChild(d),a&&a.appendChild(o),this.container=o,this.itemsContainer=d,o},e.prototype.refreshSelection=function(){var e=this,t=this.getSelectedItems();(Array.isArray(this.component.options)?this.component.options:["Option 1"]).forEach(function(n,r){var a="string"==typeof n?n:null!=n.value?n.value:null!=n.label?n.label:n.key,i=e.checkboxes[r];i&&(i.checked=-1!==t.indexOf(a))})},e.prototype.destroy=function(){for(var e=0,t=this.checkboxes;e<t.length;e++){var n=t[e];try{n.destroy()}catch(e){}}this.checkboxes=[],this.container&&this.container.parentNode&&this.container.parentNode.removeChild(this.container),this.container=null,this.itemsContainer=null},e.prototype.setOptions=function(e){var t=this;if(this.component.options=e,this.itemsContainer){for(var n=0,r=this.checkboxes;n<r.length;n++){var a=r[n];try{a.destroy()}catch(e){}}for(this.checkboxes=[];this.itemsContainer.firstChild;)this.itemsContainer.removeChild(this.itemsContainer.firstChild);var o=this.getSelectedItems();e.forEach(function(e,n){var r="string"==typeof e?e:e.value||e.label||e.key,a="string"==typeof e?e:e.label||e.value||String(r),s=document.createElement("input");t.itemsContainer.appendChild(s);var l=new i.CheckBox({label:a,enableRtl:t.enableRtl,checked:-1!==o.indexOf(r),disabled:!!t.component.disabled,labelPosition:t.component.checkboxLabelPosition||"After",cssClass:t.sizeCssClass.trim(),change:function(e){t.handleCheckboxChange(r,e.checked)}});l.appendTo(s),t.ref(l,n);var d=s.querySelector('input[type="checkbox"]');d&&(d.id=t.component.id+"_"+n),t.optionRef&&t.optionRef(l,n),t.checkboxes.push(l)})}},e}(),z=function(){return(z=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)},W=function(){function e(){this.engine=new D}return e.prototype.parseColumnValue=function(e,t){if(null===e||void 0===e||""===e)return e;if("number"===t){var n=parseFloat(String(e));return isNaN(n)?0:n}return"boolean"===t?"boolean"==typeof e?e:"true"===e||"1"===e||1===e||!0===e:e},e.prototype.evaluateRowExpressions=function(e,t){for(var n=this,r=z({},e),a=this,i=0,o=t.filter(function(e){return e.expression&&e.expression.toString().trim()});i<o.length;i++)!function(e){if(!e.expression)return"continue";try{var i={};t.forEach(function(e){var t=r[e.field];i[e.field]=n.parseColumnValue(t,e.type)});var o=a.engine.evaluate(e.expression,i,{throwOnError:!1});r[e.field]=o}catch(t){r[e.field]=null}}(o[i]);return r},e.prototype.extractCalculatedColumns=function(e){return e.filter(function(e){return e.expression&&e.expression.toString().trim()})},e.prototype.getEngine=function(){return this.engine},e}(),q=function(){return(q=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)},H=function(){function e(){this.expressionEngine=new D}return e.prototype.validate=function(e,t,n){if(!e||""===e.trim())return!0;try{var r=q({},n,{input:t,valid:!0}),a=e.match(/valid\s*=\s*(.+?)\s*\?\s*true\s*:\s*['"](.+?)['"]\s*$/);if(!a)return"Invalid validation expression format";var i=a[1].trim(),o=a[2];return!0===this.expressionEngine.evaluate(i,r,{throwOnError:!1},!0)||o}catch(e){return"Validation expression error"}},e.prototype.extractDependencies=function(e){if(!e)return[];var t=e.match(/valid\s*=\s*(.+)/),n=t?t[1]:e;return this.expressionEngine.extractDependencies(n).filter(function(e){return"input"!==e})},e.prototype.validateConditionSyntax=function(e,t){if(!e||""===e.trim())return["Condition cannot be empty"];var n=[],r=(e.match(/\(/g)||[]).length,a=(e.match(/\)/g)||[]).length;r!==a&&n.push("Unbalanced parentheses ("+r+" open, "+a+" close)");var i=(e.match(/\{/g)||[]).length,o=(e.match(/\}/g)||[]).length;i!==o&&n.push("Unbalanced braces ("+i+" open, "+o+" close)");var s=this.extractDependencies(e).filter(function(e){return-1===t.indexOf(e)});return s.length>0&&n.push("Unknown field references: "+s.join(", ")),n},e.prototype.buildExpression=function(e,t){return"valid = "+e.trim()+" ? true : '"+t.replace(/'/g,"\\'")+"'"},e.prototype.parseExpression=function(e){var t=e.match(/valid\s*=\s*(.+?)\s*\?\s*true\s*:\s*'(.+)'/);return t?{condition:t[1].trim(),errorMessage:t[2].replace(/\\'/g,"'")}:null},e}(),G=function(){return(G=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)},$=function(){function e(e){var t=this;this.grid=null,this.wrapper=null,this.mapCustomValidationToSyncfusion=function(e){if(e.customValidation&&0!==e.customValidation.length)return function(n){var r=t.grid&&t.grid.editModule?t.grid.editModule.formObj:null;if(!r)return!0;var a={};(t.columns||[]).forEach(function(e){var t=r.getInputElement(e.field);if(t){var n=t.value;a[e.field]="number"===e.type?parseInt(n,10):n}});for(var i=0,o=e.customValidation;i<o.length;i++){var s=o[i];if(s.expression){var l="number"===e.type?parseInt(n.value,10):n.value;return!0===t.validationEngine.validate(s.expression,l,a)}}return!0}},this.createEditParams=function(e){if(t.hasExpressions){var n=t.calculatedColumns;if(n.some(function(t){return!!t.expression&&-1!==t.expression.indexOf("{"+e.field+"}")}))return{params:{change:function(){if(t.grid&&t.grid.element){var e=t.grid.element.querySelector("form");if(e&&e.ej2_instances&&e.ej2_instances[0]){var r=e.ej2_instances[0];n.forEach(function(e){var n=r.getInputElement(e.field);if(n)try{var a={};t.columns.forEach(function(e){var t=r.getInputElement(e.field);t&&(a[e.field]=t.value)});var i=t.gridExpressions.evaluateRowExpressions(a,t.columns)[e.field];if(void 0!==i&&null!==i)if("boolean"===e.type)n.checked=!!i;else if("number"===e.type){var o=n.closest(".e-control-wrapper"),s=o?o.querySelector('input.e-control:not([type="hidden"])'):null;s&&s.ej2_instances&&s.ej2_instances[0]?s.ej2_instances[0].value=i:n.value=i}else"date"===e.type?n.ej2_instances[0].value=new Date(i):n.value=i}catch(e){}})}}}}}}},this.handleActionComplete=function(e){if(t.grid)switch(e.requestType){case"save":case"delete":case"add":if(t.grid.dataSource){var n=Array.isArray(t.grid.dataSource)?t.grid.dataSource:[];t.currentData=n,t.onDataChange&&t.onDataChange(n)}}},this.id=e.id,this.columns=e.columns||[],this.dataSource=Array.isArray(e.dataSource)?e.dataSource:[],this.height=null!=e.height?e.height:"200px",this.width=null!=e.width?e.width:"100%",this.locale=e.locale,this.cssClass=e.cssClass,this.pageSize=null!=e.pageSize?e.pageSize:6,this.allowPaging=!1!==e.allowPaging,this.allowAdding=!1!==e.allowAdding,this.allowEditing=!1!==e.allowEditing,this.allowDeleting=!1!==e.allowDeleting,this.allowFiltering=!0===e.allowFiltering,this.onDataChange=e.onDataChange,this.isPreviewMode=e.isPreviewMode,this.enableRtl=e.enableRtl,this.ref=e.ref,this.currentData=Array.isArray(this.dataSource)?this.dataSource:[],this.gridExpressions=new W,this.validationEngine=new H}return Object.defineProperty(e.prototype,"calculatedColumns",{get:function(){return this.gridExpressions.extractCalculatedColumns(this.columns)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasExpressions",{get:function(){return this.calculatedColumns.length>0},enumerable:!0,configurable:!0}),e.prototype.buildToolbar=function(){var e=[];return this.allowAdding&&e.push("Add"),this.allowEditing&&e.push("Edit"),this.allowDeleting&&e.push("Delete"),e.push("Update","Cancel"),e},e.prototype.mapColumn=function(e){var t=e.validationRules?G({},e.validationRules):{},n=this.mapCustomValidationToSyncfusion(e);if(n){var r=e.customValidation&&e.customValidation[0]&&e.customValidation[0].expression?(this.validationEngine.parseExpression?this.validationEngine.parseExpression(e.customValidation[0].expression).errorMessage:"Validation failed")||"Validation failed":"Validation failed";t.required=[!0,r],t.custom=[n,r]}return{field:e.field,headerText:e.headerText,type:e.type||"string",isPrimaryKey:e.isPrimaryKey||!1,width:e.width,format:"date"===e.type?e.format||"MM/dd/yyyy":e.format,editType:e.editType,allowEditing:!1!==e.allowEditing&&!e.expression,validationRules:t,edit:this.createEditParams(e)}},e.prototype.render=function(e){var t=this,n=Array.isArray(this.dataSource)?this.dataSource:[];this.hasExpressions&&n.length>0?this.currentData=n.map(function(e){var n=t.gridExpressions.evaluateRowExpressions(e,t.columns);return G({},e,n)}):this.currentData=n;var r=document.createElement("div");r.className="datagrid-wrapper",r.style.width="string"==typeof this.width?this.width:this.width+"px",r.style.height="auto";var a=document.createElement("div");a.className="datagrid-grid",r.appendChild(a),this.id&&(a.id=this.id);var i=new h.Grid({dataSource:this.currentData,allowPaging:this.allowPaging,filterSettings:{mode:"Immediate"},pageSettings:{pageSize:this.pageSize},editSettings:{allowEditing:this.allowEditing,allowAdding:this.allowAdding,allowDeleting:this.allowDeleting,mode:"Normal"},enableRtl:this.enableRtl,locale:this.locale||"en-US",cssClass:this.cssClass,toolbar:this.buildToolbar(),actionComplete:this.handleActionComplete,height:"string"==typeof this.height?this.height:this.height+"px",width:"string"==typeof this.width?this.width:this.width+"px",allowSorting:!0,allowFiltering:this.allowFiltering,allowSelection:!0,columns:(this.columns||[]).map(function(e){return t.mapColumn(e)})});return i.appendTo(a),this.ref(i),this.grid=i,e&&e.appendChild(r),this.wrapper=r,r},e.prototype.getRef=function(){var e=this;return{getGridData:function(){return e.currentData},gridRef:{current:this.grid}}},e.prototype.getGridData=function(){return this.currentData},e.prototype.setDataSource=function(e){var t=this;if(this.grid){var n=Array.isArray(e)?e:[];this.hasExpressions&&n.length>0?this.currentData=n.map(function(e){var n=t.gridExpressions.evaluateRowExpressions(e,t.columns);return G({},e,n)}):this.currentData=n,this.grid.dataSource=this.currentData,this.grid.refreshBatchData?this.grid.setProperties({dataSource:this.currentData},!0):this.grid.dataSource=this.currentData,this.grid.refresh&&this.grid.refresh()}},e.prototype.setColumns=function(e){this.grid&&(e&&0!==e.length?0===this.grid.columns.length&&e&&1===e.length&&(this.grid.columns=e):this.grid.columns=[],this.columns=e,this.grid.refresh&&!this.isPreviewMode&&(this.dataSource&&Array.isArray(this.dataSource)&&this.dataSource.length>0&&!this.hasExpressions&&(this.grid.dataSource=this.dataSource),this.grid.refresh()))},e.prototype.destroy=function(){if(this.grid){try{this.grid.destroy()}catch(e){}this.grid=null}this.wrapper&&this.wrapper.parentNode&&this.wrapper.parentNode.removeChild(this.wrapper),this.wrapper=null,this.gridExpressions=null,this.validationEngine=null,this.currentData=[],this.columns=[],this.dataSource=[]},e}();h.Grid.Inject(h.Edit,h.Toolbar,h.Page,h.Resize,h.Sort,h.Filter);var J=function(){return(J=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)},Y=function(e){return e?Array.isArray(e)?e.reduce(function(e,t){return t&&t.key&&void 0!==t.value&&(e[t.key]=t.value),e},{}):e:{}},Z=function(e,t){e&&t&&e.setAttribute("id",t)},K=function(e){var n=e.component,r=e.value,p=e.onChange,h=e.onBlur,m=e.onClick,f=e.hasError,v=void 0!==f&&f,y=e.locale,g=e.formState,b=e.settings,C=e.components,w=e.enableRtl,S=e.ref,E=e.l10n,T=e.initializedGrids||new Set,A=e.target,D={floatLabelType:n.floatLabelType||"Never",placeholder:n.placeholder||"",enabled:!n.disabled},V=function(e){var t=n.validateOn||"Change",r={};return t&&"Change"!==t||(r.change=function(t){return p(e(t))},r.blur=function(){h&&h()}),"Blur"===t&&(r.change=function(t){return p(e(t))},r.blur=function(){h&&h()}),r},F=Y(n.htmlAttributes);n.required&&(F["aria-required"]="true");var k=v?"e-error":"",N=((n.cssClass||"")+" "+k+" "+("Small"===n.size?" e-small":"Bigger"===n.size?" e-bigger":"")).trim();switch(n.type){case"textbox":var M=new a.TextBox(J({id:n.name,type:n.multiline?"hidden":n.textboxType?n.textboxType:"text",name:n.id,enableRtl:w,locale:y,floatLabelType:D.floatLabelType,placeholder:D.placeholder,enabled:D.enabled,value:void 0!==r?r:n.defaultValue||"",multiline:n.multiline,showClearButton:n.showClearButton,autocomplete:!1===n.autocomplete||void 0===n.autocomplete?"off":"on",readonly:n.readOnly||!1,cssClass:N,htmlAttributes:F,appendTemplate:n.suffix,prependTemplate:n.prefix},V(function(e){return e.value||""})));return A&&M.appendTo(A),S(M),M;case"textarea":var L=new a.TextArea(J({id:n.name,name:n.id,enableRtl:w,locale:y,floatLabelType:D.floatLabelType,placeholder:D.placeholder,enabled:D.enabled,value:void 0!==r?r:n.defaultValue||"",cols:n.cols||200,rows:n.textareaRows||4,showClearButton:n.showClearButton||!1,readonly:n.readOnly||!1,maxLength:n.maxLength||255,cssClass:N,htmlAttributes:F,appendTemplate:n.suffix,prependTemplate:n.prefix,resizeMode:"Vertical"},V(function(e){return e.value||""})));return A&&L.appendTo(A),S(L),L;case"number":var U=""===r?void 0:r,z=new a.NumericTextBox({locale:y,enableRtl:w,floatLabelType:D.floatLabelType,placeholder:D.placeholder,enabled:D.enabled,value:void 0!==U?U:n.defaultValue||void 0,decimals:n.decimals||2,currency:n.currency,format:n.numberFormat||"n2",step:n.step||1,min:n.minValue||void 0,max:n.maxValue||void 0,readonly:n.readOnly||!1,showClearButton:n.showClearButton||!1,cssClass:N,htmlAttributes:F,appendTemplate:n.suffix,prependTemplate:n.prefix,change:function(e){return p(e.value)}});return A&&(Z(A,n.name),A.setAttribute("name",n.id),z.appendTo(A)),S(z),z;case"checkbox":var W=n.label&&n.required?n.label+" *":n.label,q=new i.CheckBox({locale:y,name:n.id,enableRtl:w,label:W,labelPosition:n.checkboxLabelPosition,checked:void 0!==n.checked&&null!==n.checked&&n.checked||void 0!==r&&null!==r&&r,indeterminate:n.indeterminate||!1,disabled:n.disabled,cssClass:N,htmlAttributes:F,change:function(e){return p(e.checked)}});return A&&(Z(A,n.name),q.appendTo(A)),S(q),q;case"checkboxGroup":var H=[];B.fetch(n.options,n.id,g?g.values:void 0,C).then(function(e){e.id===n.id&&e.options.length>0&&(H.push.apply(H,e.options),Q.setOptions(H))}).catch(function(){});var G=P(n.options,H),K=G.length>0?G:n.options||["Option 1"],Q=new _({component:J({},n,{options:K}),formState:g,value:r,enableRtl:w,onChange:function(e){return p(e)},optionRef:e.ref,target:A,ref:S});return A&&Z(A,n.name),Q.render(A),Q;case"radio":var X=Array.isArray(n.options)?n.options:["Option 1"],ee=t.createElement("div",{id:n.name+"-group",className:"e-radio-group "+k}),te=[];return X.forEach(function(a,o){var s=a,l=a,d=t.createElement("div");d.style.marginBottom="8px",ee.appendChild(d);var c=t.createElement("input",{id:n.name+"_"+o+"_"+s,attrs:{type:"radio"}});d.appendChild(c);var u=new i.RadioButton({name:n.id,label:l,enableRtl:w,locale:y,disabled:n.disabled,value:s,htmlAttributes:F,labelPosition:n.fieldLabelPosition,checked:n.defaultValue===s||r===s,cssClass:N,change:function(e){e.value===s&&p(s)}});u.appendTo(c),S(u,o),e.ref&&"function"==typeof e.ref&&e.ref(u,o)}),A&&A.appendChild(ee),te;case"dropdown":var ne=[];B.fetch(n.options,n.id,g?g.values:void 0,C).then(function(e){e.id===n.id&&e.options.length>0&&(ne.push.apply(ne,e.options),ie.dataSource=ne)}).catch(function(){});var re=P(n.options,ne),ae=re.length>0?re:n.options||["Option 1"];n.conditions&&n.conditions.choiceBasedField&&(ae=x.getChoiceBasedOptions(n.conditions.choiceBasedField,ae,g?g.values:void 0,n.conditions.choiceBasedField.primaryFieldId)).length>0&&null!=r&&-1===ae.indexOf(r)&&g&&(g.values[n.id]=null);var ie=new s.DropDownList(J({id:n.name,name:n.id,floatLabelType:D.floatLabelType,placeholder:D.placeholder,enabled:D.enabled,locale:y,enableRtl:w,cssClass:N,dataSource:ae,value:void 0!==g.values[n.id]?g.values[n.id]:void 0!==n.defaultValue&&null!==n.defaultValue?n.defaultValue:null,showClearButton:n.showClearButton||!1,readonly:n.readOnly||!1,enableVirtualization:n.enableVirtualization||!1,popupHeight:n.popupHeight||"300px",popupWidth:n.popupWidth||"100%",htmlAttributes:F},V(function(e){return e.value||""})));return s.DropDownList.Inject(s.VirtualScroll),A&&ie.appendTo(A),S(ie),ie;case"multiselect":var oe=[];B.fetch(n.options,n.id,g?g.values:void 0,C).then(function(e){e.id===n.id&&e.options.length>0&&(oe.push.apply(oe,e.options),de.dataSource=oe)}).catch(function(){});var se=P(n.options,oe),le=se.length>0?se:n.options||["Option 1"],de=new s.MultiSelect(J({name:n.id,enableRtl:w,locale:y,floatLabelType:D.floatLabelType,enabled:D.enabled,value:void 0!==r?r:void 0!==n.defaultValue&&null!==n.defaultValue?n.defaultValue:null,placeholder:n.placeholder,dataSource:le,fields:{text:"text",value:"value"},showClearButton:n.showClearButton||!1,readonly:n.readOnly||!1,allowCustomValue:n.allowCustomValue||!1,addTagOnBlur:n.addTagOnBlur||!1,delimiterChar:n.delimiterChar||",",showSelectAll:n.showSelectAll||!1,mode:n.showSelectAll?"CheckBox":n.visualMode?n.visualMode:void 0,selectAllText:n.selectAllText,unSelectAllText:n.unSelectAllText,showDropDownIcon:!1!==n.showDropDownIcon,enableVirtualization:n.enableVirtualization||!1,popupHeight:n.popupHeight||"300px",popupWidth:n.popupWidth||"100%",cssClass:N,htmlAttributes:F},V(function(e){return e.value||""})));return s.MultiSelect.Inject(s.CheckBoxSelection,s.VirtualScroll),A&&de.appendTo(A),S(de),de;case"date":var ce=new l.DatePicker(J({floatLabelType:D.floatLabelType,id:n.name,name:n.id,enableRtl:w,locale:y,placeholder:D.placeholder,enabled:D.enabled,value:void 0!==r?r:void 0!==n.defaultValue&&null!==n.defaultValue?n.defaultValue:null,format:n.format||"MM/dd/yyyy",readOnly:n.readOnly||!1,showClearButton:void 0!==n.showClearButton&&n.showClearButton,showTodayButton:!1!==n.showTodayButton,calendarMode:n.calendarMode||"Gregorian",dayHeaderFormat:n.dayHeaderFormat||"Short",depth:n.depth||"Month",start:n.start||"Month",firstDayOfWeek:n.firstDayOfWeek||0,min:n.minDate?new Date(n.minDate):void 0,max:n.maxDate?new Date(n.maxDate):void 0,cssClass:N,htmlAttributes:F},V(function(e){return e.value||""})));return l.DatePicker.Inject(l.Islamic),A&&ce.appendTo(A),S(ce),ce;case"dateTime":var ue=new l.DateTimePicker(J({id:n.name,floatLabelType:D.floatLabelType,placeholder:D.placeholder,enabled:D.enabled,locale:y,enableRtl:w,name:n.id,dayHeaderFormat:n.dayHeaderFormat||"Short",value:void 0!==r?r:void 0!==n.defaultValue&&null!==n.defaultValue?n.defaultValue:null,format:n.format||"MM/dd/yyyy hh:mm a",showClearButton:void 0!==n.showClearButton&&n.showClearButton,showTodayButton:!1!==n.showTodayButton,depth:n.depth||"Month",start:n.start||"Month",step:n.step||1,readonly:n.readOnly||!1,min:n.minDate?new Date(n.minDate):void 0,max:n.maxDate?new Date(n.maxDate):void 0,minTime:n.minTime?new Date("2000-01-01 "+n.minTime):void 0,maxTime:n.maxTime?new Date("2000-01-01 "+n.maxTime):void 0,enableMask:!1,cssClass:N,htmlAttributes:F},V(function(e){return e.value||""})));return l.DateTimePicker.Inject(l.Islamic),A&&ue.appendTo(A),S(ue),ue;case"time":var pe=new l.TimePicker(J({id:n.name,locale:y,name:n.id,enableRtl:w,floatLabelType:D.floatLabelType,placeholder:D.placeholder,enabled:D.enabled,value:void 0!==r?r:void 0!==n.defaultValue&&null!==n.defaultValue?n.defaultValue:null,format:n.format||"hh:mm a",showClearButton:void 0!==n.showClearButton&&n.showClearButton,step:n.step||30,readonly:n.readOnly||!1,min:n.minTime?new Date("2000-01-01 "+n.minTime):void 0,max:n.maxTime?new Date("2000-01-01 "+n.maxTime):void 0,enableMask:!1,cssClass:N,htmlAttributes:F},V(function(e){return e.value||""})));return A&&pe.appendTo(A),S(pe),pe;case"dateRange":var he=new l.DateRangePicker(J({id:n.name,locale:y,enableRtl:w,name:n.id,floatLabelType:D.floatLabelType,dayHeaderFormat:n.dayHeaderFormat||"Short",placeholder:D.placeholder,enabled:D.enabled,value:void 0!==r?r:void 0!==n.defaultValue&&null!==n.defaultValue?n.defaultValue:null,depth:n.depth||"Month",start:n.start||"Month",min:n.minDate?new Date(n.minDate):void 0,max:n.maxDate?new Date(n.maxDate):void 0,format:n.format||"MM/dd/yyyy",separator:n.separator||" - ",showClearButton:void 0!==n.showClearButton&&n.showClearButton,readonly:n.readOnly||!1,cssClass:N,htmlAttributes:F},V(function(e){return e.value||""})));return A&&he.appendTo(A),S(he),he;case"switch":var me=new i.Switch({locale:y,enableRtl:w,value:n.defaultValue,name:n.id,checked:void 0!==n.checked&&null!==n.checked&&n.checked||void 0!==r&&null!==r&&r,disabled:n.disabled,onLabel:n.onLabel||"",offLabel:n.offLabel||"",cssClass:N,htmlAttributes:F,change:function(e){return p(e.checked)}});return A&&(Z(A,n.name),me.appendTo(A)),S(me),me;case"button":var fe=n.buttonsGroups||n.buttons||[];if(fe&&fe.length>0){var ve={display:"flex",flexWrap:"wrap",alignItems:"center",gap:n.gap||"8px",justifyContent:R(n.position),width:n.width||void 0},ye=t.createElement("div",{id:n.name,attrs:{role:"group","aria-label":n.label||"Button Group",className:N+" "+(w?"e-rtl":"")}});Object.assign(ye.style,ve);var ge=[];return fe.forEach(function(r,a){var o=n.name+"_"+a,s=[O(r.style)].filter(Boolean).join(" ");s+="Small"===n.size?" e-small":"Bigger"===n.size?" e-bigger":"";var l=I(r.type),d=t.createElement("button",{id:String(o),attrs:{name:String(o),type:l}});ye.appendChild(d);var c=new i.Button({locale:y,enableRtl:w,cssClass:s,disabled:r.disabled||!1,content:r.label||"Button "+(a+1),iconCss:r.iconCss,iconPosition:r.iconPosition});c.appendTo(d),c.element.onclick=function(e){m&&m(e)},S(c,a),ge.push(c),e.ref&&"function"==typeof e.ref&&e.ref(c,a)}),A&&A.appendChild(ye),ge}var be=I(n.buttonType),xe=[O(n.style),"submit"===be?"submit-btn form-submit-type":"","reset"===be?"form-reset-type":"",n.cssClass||"e-primary","Small"===n.size?" e-small":"Bigger"===n.size?" e-bigger":""].filter(Boolean).join(" ")||"e-primary",Ce={display:"flex",justifyContent:R(n.position),width:n.width||"100%"},we=t.createElement("div",{id:n.name+"-container"});Object.assign(we.style,Ce);var Se=t.createElement("button",{id:n.name,attrs:{type:be}});we.appendChild(Se);var Ee=new i.Button({enableRtl:w,locale:y,cssClass:xe,disabled:n.disabled,iconCss:n.iconCss,iconPosition:n.iconPosition,content:n.label});return Ee.appendTo(Se),S(Ee),Ee.element.onclick=function(e){m&&m(e)},A&&A.appendChild(we),Ee;case"splitButton":var Te=["primary"===n.style?"e-primary":"",(n.style,""),"information"===n.style?"e-info":"","error"===n.style?"e-danger":"","success"===n.style?"e-success":"","warning"===n.style?"e-warning":"",n.cssClass||""].filter(Boolean).join(" ")||void 0,Ae={display:"flex",justifyContent:R(n.position)},we=t.createElement("div",{id:n.name+"-container",attrs:{"aria-label":"Splitbutton"}});Object.assign(we.style,Ae);var De=n.options&&n.options.length>0?n.options.map(function(e,t){return{text:e,id:n.id+"_option_"+t}}):[{text:"Option 1",id:n.id+"_option_0"}],Ve=t.createElement("button",{id:n.name});we.appendChild(Ve);var Oe=new o.SplitButton({locale:y,enableRtl:w,content:n.label||"Split Button",items:De,cssClass:Te,disabled:n.disabled,iconCss:n.iconCss,iconPosition:n.iconPosition||"Left",click:function(e){m&&m(J({},e))},select:function(e){m&&m(J({},e,{selectedItem:e.item.text}))}});return Oe.appendTo(Ve),A&&A.appendChild(we),S(Oe),Oe;case"signature":var Ie=t.createElement("canvas",{id:n.name}),Re=new a.Signature({enableRtl:w,locale:y,backgroundColor:n.backgroundColor||"",strokeColor:n.strokeColor||"",maxStrokeWidth:n.maxValue,minStrokeWidth:n.minValue,velocity:n.velocity,disabled:n.disabled,change:function(){return p(n.name)}});return A&&(Re.appendTo(Ie),A.appendChild(Ie)),S(Re),Re;case"rating":var Fe=new a.Rating({enableRtl:w,locale:y,value:void 0!==r?r:n.defaultValue||0,disabled:n.disabled,cssClass:N,allowReset:n.allowReset,itemsCount:n.itemsCount,min:n.minValue,precision:n.precision,readOnly:n.readOnly,showTooltip:n.showRatingTooltip||!1,showLabel:n.showRatingLabel,labelPosition:n.showRatingLabel?n.ratingLabelPosition:void 0,valueChanged:function(e){return p(e.value)}});return A&&(Z(A,n.name),A.setAttribute("name",n.id),Fe.appendTo(A)),S(Fe),Fe;case"colorPicker":var ke=new a.ColorPicker({enableRtl:w,locale:y,value:void 0!==r?r:n.defaultValue||"",disabled:n.disabled,enableOpacity:n.enableOpacity,showButtons:n.showButtons,showRecentColors:n.showRecentColors,noColor:n.showNoColor,cssClass:N,change:function(e){return p(e.value)}});return A&&(Z(A,n.name),ke.appendTo(A)),S(ke),ke;case"inputMask":var Ne=new a.MaskedTextBox(J({id:n.name,name:n.id,enableRtl:w,floatLabelType:n.floatLabelType||"Never",placeholder:n.placeholder||"",enabled:!n.disabled,locale:y,value:void 0!==r?r:n.defaultValue||"",mask:n.mask||"000-000-0000",promptChar:n.promptChar||"_",customCharacters:n.customCharacters,readOnly:n.readOnly||!1,showClearButton:!1!==n.showClearButton,cssClass:N,htmlAttributes:F,appendTemplate:n.suffix,prependTemplate:n.prefix},V(function(e){return e.value||""})));return A&&Ne.appendTo(A),S(Ne),Ne;case"rangeSlider":var Me=new a.Slider({enableRtl:w,locale:y,value:void 0!==r?r:void 0!==n.defaultValue&&null!==n.defaultValue?n.defaultValue:0,min:n.minValue||0,max:n.maxValue||100,step:n.step||1,cssClass:N,enabled:!n.disabled,readonly:n.readOnly,showButtons:n.showButtons,change:function(e){return p(e.value)}});return A&&(Z(A,n.name),Me.appendTo(A)),S(Me),Me;case"fileUpload":var Le=new a.Uploader({enableRtl:w,locale:y,type:"file",enabled:!n.disabled,allowedExtensions:n.allowExtensions,asyncSettings:{saveUrl:n.saveUrl,removeUrl:n.removeUrl},buttons:n.buttons||{browse:"Choose File",clear:"Clear All",upload:"Upload All"},maxFileSize:n.maxValue,minFileSize:n.minValue,multiple:!!n.allowMultiple,showFileList:n.showFileList,htmlAttributes:F,cssClass:N,change:function(e){return p(e.file)}});return A&&(Z(A,n.name),Le.appendTo(A)),S(Le),Le;case"imageEditor":var Pe,je=t.createElement("div",{id:n.name,attrs:{"data-field":n.id}});return setTimeout(function(){Pe=new c.ImageEditor({locale:y,enableRtl:w,disabled:n.disabled,cssClass:N,height:(null!=n.height?n.height:"350px").toString(),width:(null!=n.width?n.width:"100%").toString(),editComplete:function(){return p(n.name)},fileOpened:function(){return p(n.name)}},"#"+n.name)},100),A&&A.appendChild(je),S(Pe),Pe;case"message":nt=new d.Message({locale:y,enableRtl:w,severity:n.severity||n.messageType||"info",variant:n.variant,content:n.content||"Message",showCloseIcon:n.showCloseIcon,showIcon:void 0!==n.showIcon&&n.showIcon||!1,cssClass:N});return A&&(Z(A,n.name),nt.appendTo(A)),S(nt),nt;case"dataGrid":var Be=n,Ue=j(Be.conditions,g&&g.values||{}),_e=Ue?Ue.dataSource:void 0,ze=Ue?Ue.columns:void 0,We=(_e||Be.dataSource,[]);B.fetch(_e||Be.dataSource,Be.id,g&&g.values,C).then(function(e){if(e.id===Be.id&&e.options.length>0){var t=P(_e||Be.dataSource,e.options,qe);Ye.setDataSource(t)}});var qe=[],He=_e?P(_e,We,qe):P(Be.dataSource,We,qe),Ge=He.length>0?He:void 0!==Be.dataSource&&null!==Be.dataSource?Be.dataSource:[],$e=ze&&ze.length>0?ze:void 0!==Be.columns&&null!==Be.columns?Be.columns:[],Je=A||t.createElement("div",{id:Be.name,className:Be.cssClass});A&&Z(A,n.name);var Ye=new $({locale:y,name:Be.name||"",columns:$e,enableRtl:w,dataSource:void 0!==Ge&&Ge.length>0?Ge:r,height:null!=Be.height?Be.height:"200px",width:null!=Be.width?Be.width:"100%",pageSize:Be.pageSize||6,allowPaging:!1!==Be.allowPaging,allowFiltering:Be.allowFiltering,allowAdding:!1!==Be.allowAdding,allowEditing:!1!==Be.allowEditing,allowDeleting:!1!==Be.allowDeleting,onDataChange:function(e){return p(e)},cssClass:N,target:Je,ref:S});return Ye.render(Je),!T.has(n.id)&&g&&Array.isArray(Ge)&&(g.values[n.id]=Ge,Ye.isInitialized=!0,T.add(n.id)),"function"==typeof e.ref?e.ref(Ye):e.ref&&(e.ref.current=Ye),A||Je;case"richTextEditor":var Ze={items:["Undo","Redo","|","Bold","Italic","Underline","StrikeThrough","InlineCode","|","CreateLink","Image","CreateTable","CodeBlock","HorizontalLine","Blockquote","EmojiPicker","|","LineHeight","Formats","Alignments","|","BulletFormatList","NumberFormatList","Checklist","|","Outdent","Indent","|","FontColor","BackgroundColor","FontName","FontSize","|","LowerCase","UpperCase","SuperScript","SubScript","|","SourceCode","|"]};n.enableImportFromWord&&n.enableImportFromWord.enabled&&Ze.items.push("ImportWord"),n.enableExportToWord&&n.enableExportToWord.enabled&&Ze.items.push("ExportWord"),n.enableExportToPdf&&n.enableExportToPdf.enabled&&Ze.items.push("ExportPdf"),Ze.items.push("Print");var Ke=function(e){return!!e&&e.enabled&&"string"==typeof e.serviceUrl&&""!==e.serviceUrl.trim()},Qe=Ke(n.enableImportFromWord)?{serviceUrl:/^(https?:)?\/\//i.test(n.enableImportFromWord?n.enableImportFromWord.serviceUrl:"")?n.enableImportFromWord?n.enableImportFromWord.serviceUrl:"":(b&&b.hostUrl?b.hostUrl:"").replace(/\/+$/,"")+"/"+(n.enableImportFromWord?n.enableImportFromWord.serviceUrl:"").replace(/^\/+/,"")}:void 0,Xe=Ke(n.enableExportToWord)?{serviceUrl:/^(https?:)?\/\//i.test(n.enableExportToWord?n.enableExportToWord.serviceUrl:"")?n.enableExportToWord?n.enableExportToWord.serviceUrl:"":(b&&b.hostUrl?b.hostUrl:"").replace(/\/+$/,"")+"/"+(n.enableExportToWord?n.enableExportToWord.serviceUrl:"").replace(/^\/+/,""),fileName:"RichTextEditor.docx",stylesheet:"\n .e-rte-content {\n font-size: 1em;\n font-weight: 400;\n margin: 0;\n }\n "}:void 0,et=Ke(n.enableExportToPdf)?{serviceUrl:/^(https?:)?\/\//i.test(n.enableExportToPdf?n.enableExportToPdf.serviceUrl:"")?n.enableExportToPdf?n.enableExportToPdf.serviceUrl:"":(b&&b.hostUrl?b.hostUrl:"").replace(/\/+$/,"")+"/"+(n.enableExportToPdf?n.enableExportToPdf.serviceUrl:"").replace(/^\/+/,""),fileName:"RichTextEditor.pdf",stylesheet:"\n .e-rte-content {\n font-size: 1em;\n font-weight: 400;\n margin: 0;\n }\n "}:void 0,tt=new u.RichTextEditor({locale:y,toolbarSettings:Ze,enableRtl:w,value:void 0!==r?r:n.defaultValue||"",placeholder:n.placeholder||"",enabled:!n.disabled,readonly:n.readOnly||!1,maxLength:n.maxLength||void 0,cssClass:N||void 0,height:n.height||"300px",width:n.width||"100%",htmlAttributes:F,importWord:Qe,exportPdf:et,exportWord:Xe,change:function(e){return p(e.value)}});return u.RichTextEditor.Inject(u.Toolbar,u.Link,u.HtmlEditor,u.QuickToolbar,u.Image,u.Count,u.Table,u.EmojiPicker,u.PasteCleanup,u.SlashMenu,u.CodeBlock,u.ClipBoardCleanup,u.AutoFormat,u.ImportExport),tt.appendTo(A),S(tt),tt;default:var nt=new d.Message({locale:y,enableRtl:w,severity:"Warning",content:E.getConstant("unsupportedComponent")+" : "+n.type,cssClass:N});return A&&(Z(A,n.name),nt.appendTo(A)),S(nt),nt}},Q=function(){return(Q=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)},X={strict:!1,maxInputSize:5242880,defaultTextType:"textbox",inferTypeFromValue:!0,generateIds:!0,includeMetadata:!0,customTypeMap:{},validateUnknownFields:!1},ee=function(){function e(e){this.config=Q({},X,e)}return e.prototype.parse=function(e){var t=[],n=[];if("string"==typeof e){if(e.length>this.config.maxInputSize)return this.formatError(t,n,"Input exceeds maximum size of "+this.config.maxInputSize+" bytes");var r=te(e);if(!r.valid)return this.formatError(t,n,r.errors&&r.errors[0]||"Invalid JSON");try{e=JSON.parse(e)}catch(e){return this.formatError(t,n,"Failed to parse JSON: "+e.message)}}var a=this.detectFormat(e);a.ambiguousFormats&&a.ambiguousFormats.length>0&&(n.push("Ambiguous format detected."),n.push("Using "+a.format+" format ("+("json-schema"===a.format?"properties priority":"pages priority")+")"));var i=[];switch(a.format){case"configured-schema":i=e.properties||[];break;case"json-schema":var o=this.parseJsonSchema(e);i=o.components,o.warnings&&n.push.apply(n,o.warnings);break;case"surveyjs":i=this.parseSurveyJS(e);break;case"openapi":i=this.parseOpenAPI(e);break;case"data-inference":(i=this.parseDataInference(e)).length>0&&n.push("Field types inferred from data; please verify");break;default:t.push("Could not determine input format")}0===i.length&&t.push("No form fields could be extracted from input"),!i.some(function(e){return"button"===e.type&&"submit"===e.buttonType})&&i.length>0&&i.push({id:this.generateComponentId("button"),type:"button",label:"Submit",style:"primary",buttonType:"submit"});var s={version:e.version||"0.1.0",components:i},l=ne(s);!l.valid&&l.errors&&t.push.apply(t,l.errors),l.warnings&&n.push.apply(n,l.warnings),this.config.strict&&n.length>0&&(t.push.apply(t,n),n.length=0);var d=re(s);return{success:0===t.length,schema:d,errors:t,warnings:n,metadata:{detectedFormat:a.format,confidence:a.confidence,sourceHints:a.hints}}},e.prototype.formatError=function(e,t,n){return e.push(n),{success:!1,schema:null,errors:e,warnings:t,metadata:{detectedFormat:"unknown",confidence:"low",sourceHints:[]}}},e.prototype.detectFormat=function(e){var t=[],n=[];if(!e||"object"!=typeof e)return{format:"unknown",confidence:"low",hints:["Input is not a valid object"]};if(e.$schema&&"string"==typeof e.$schema&&e.$schema.includes("json-schema"))return t.push("$schema property detected"),{format:"json-schema",confidence:"high",hints:t};var r=e.properties&&"object"==typeof e.properties,a=e.pages&&Array.isArray(e.pages),i=e.elements&&Array.isArray(e.elements);return r&&a?(t.push("Multiple format patterns detected"),t.push("Selected based on priority rules"),n.push("properties format","pages format"),{format:"json-schema",confidence:"medium",hints:t,ambiguousFormats:n}):a?(t.push("pages array detected"),e.pages[0]&&e.pages[0].elements&&t.push("elements structure matched"),{format:"surveyjs",confidence:"high",hints:t}):i&&!r?(t.push("elements array at root level"),{format:"surveyjs",confidence:"medium",hints:t}):r?(t.push("properties object detected"),"object"===e.type&&t.push("type: object matched"),e.required&&Array.isArray(e.required)&&t.push("required array found"),this.hasExampleFields(e.properties)?(t.push("example fields detected (API schema pattern)"),{format:"openapi",confidence:"high",hints:t}):{format:"json-schema",confidence:"high",hints:t}):this.isDataInferenceCandidate(e)?(t.push("Simple object with primitive values"),t.push("No schema indicators found"),{format:"data-inference",confidence:"medium",hints:t}):{format:"unknown",confidence:"low",hints:["Could not identify format"]}},e.prototype.hasExampleFields=function(e){if(!e||"object"!=typeof e)return!1;for(var t=0,n=Object.keys(e);t<n.length;t++){var r=e[n[t]];if(r&&"example"in r)return!0}return!1},e.prototype.isDataInferenceCandidate=function(e){return!(!e||"object"!=typeof e)&&(!(e.$schema||e.properties||e.pages||e.elements)&&Object.keys(e).every(function(t){var n=e[t];return null===n||void 0===n||("string"==typeof n||"number"==typeof n||"boolean"==typeof n||!!Array.isArray(n)&&n.every(function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e}))}))},e.prototype.inferComponentType=function(e,t){var n=this.inferTypeFromValue(e,t);if(n.type)return Q({},n,{confidence:"high",method:"value-type"});var r=this.matchFieldNamePattern(e);return r.type?Q({},r,{confidence:"high",method:"name-pattern"}):{type:this.config.defaultTextType,confidence:"low",method:"fallback"}},e.prototype.inferTypeFromValue=function(e,t){if(!this.config.inferTypeFromValue)return{type:"textbox"};if(null===t||void 0===t)return this.matchFieldNamePattern(e);if("string"==typeof t){if(t.includes("@")&&t.includes("."))return{type:"textbox",textboxType:"email"};if(/^(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}/.test(t))return{type:"textbox",textboxType:"url"};if(/^\d{4}-\d{2}-\d{2}/.test(t))return{type:"date"};var n=this.matchFieldNamePattern(e);return"textbox"!==n.type||n.textboxType?n:{type:this.config.defaultTextType}}return"number"==typeof t?{type:"number"}:"boolean"==typeof t?{type:"checkbox"}:Array.isArray(t)?{type:"multiselect"}:{type:"textbox"}},e.prototype.matchFieldNamePattern=function(e){if(this.config.customTypeMap){var t=this.config.customTypeMap[e.toLowerCase()];if(t)return{type:t}}var n=e.toLowerCase().replace(/[_\-\s]+/g," ");return/email|mail|e-?mail/.test(n)?{type:"textbox",textboxType:"email"}:/date|birth|birthday|dob|created|updated/.test(n)?{type:"date"}:/phone|tel|mobile|cell|cellphone|msisdn/.test(n)?{type:"textbox",textboxType:"number"}:/url|link|uri|website/.test(n)?{type:"textbox",textboxType:"url"}:/password|pwd|pass|security|secret|key|token/.test(n)?{type:"textbox",textboxType:"password"}:/\b(?:age|count|qty|quantity|amount|price|cost|salary|fee|rate|number|num)\b/.test(n)?{type:"number"}:/active|enabled|visible|deleted|archived|approved|confirmed/.test(n)?{type:"checkbox"}:/select|choice|option|type|status|category|kind/.test(n)?{type:"dropdown"}:/description|comment|note|bio|biography|about|message|content|summary|details/.test(n)?{type:"textarea"}:{type:"textbox"}},e.prototype.parseJsonSchema=function(e){var t=[],n=[];if(!e.properties||"object"!=typeof e.properties)return{components:t,warnings:n};for(var r=this.flattenNestedProperties(e.properties,"",n),a=0,i=Object.keys(r);a<i.length;a++){var o=i[a],s=r[o],l=this.mapJsonSchemaType(s),d=-1!==(e.required||[]).indexOf(o);t.push(this.createComponent(o,s,l,{required:d}))}return{components:t,warnings:n}},e.prototype.flattenNestedProperties=function(e,t,n){for(var r={},a=!1,i=0,o=Object.keys(e);i<o.length;i++){var s=e[p=o[i]],l=t?t+"_"+p:p;if("object"===s.type&&s.properties&&"object"==typeof s.properties){a=!0;var d=this.flattenNestedProperties(s.properties,l,n);Object.assign(r,d)}else r[l]=s}if(a&&!t){n.push("NESTED_OBJECTS_FLATTENED: Nested objects converted to flat structure");for(var c=0,u=Object.keys(e);c<u.length;c++){var p=u[c];"object"===(s=e[p]).type&&s.properties&&this.collectFlattenedFieldNames(s.properties,p,n)}}return r},e.prototype.collectFlattenedFieldNames=function(e,t,n){for(var r=0,a=Object.keys(e);r<a.length;r++){var i=a[r],o=e[i],s=t+"_"+i;n.push("Field '"+t+"."+i+"' flattened to '"+s+"'"),"object"===o.type&&o.properties&&this.collectFlattenedFieldNames(o.properties,s,n)}},e.prototype.parseSurveyJS=function(e){var t=this,n=[];return e.pages&&Array.isArray(e.pages)&&e.pages.forEach(function(e){e.elements&&Array.isArray(e.elements)&&e.elements.forEach(function(e){n.push(t.createComponentFromSurveyJS(e))})}),!n.length&&e.elements&&Array.isArray(e.elements)&&e.elements.forEach(function(e){n.push(t.createComponentFromSurveyJS(e))}),n},e.prototype.createComponentFromSurveyJS=function(e){var t=this.mapSurveyJSType(e.type||"text"),n={};!0===e.isRequired&&(n.required=!0),e.validators&&Array.isArray(e.validators)&&e.validators.forEach(function(e){"numeric"===e.type&&(void 0!==e.minValue&&(n.minValue=e.minValue),void 0!==e.maxValue&&(n.maxValue=e.maxValue)),"text"===e.type&&(void 0!==e.minLength&&(n.minLength=e.minLength),void 0!==e.maxLength&&(n.maxLength=e.maxLength))});var r=Q({id:this.generateComponentId(t),type:t,label:e.title||e.label||this.humanizeFieldName(e.name),defaultValue:e.defaultValue,expressionValue:e.expressionValue},Object.keys(n).length>0?n:void 0);return"dropdown"!==t&&"multiselect"!==t&&"radio"!==t&&"splitButton"!==t||e.choices&&Array.isArray(e.choices)&&(r.options=e.choices),r},e.prototype.mapSurveyJSType=function(e){return{text:"textbox",email:"email",number:"number",checkbox:"checkbox",radiogroup:"radio",dropdown:"dropdown",tagbox:"multiselect",multiselect:"multiselect",rating:"number",comment:"textarea",date:"date"}[e]||"textbox"},e.prototype.parseOpenAPI=function(e){var t=[];if(!e.properties||"object"!=typeof e.properties)return t;for(var n=Object.keys(e.properties),r=e.required||[],a=0,i=n;a<i.length;a++){var o=i[a],s=e.properties[o],l=this.mapJsonSchemaType(s),d=-1!==r.indexOf(o);t.push(this.createComponent(o,s,l,{required:d}))}return t},e.prototype.parseDataInference=function(e){for(var t=[],n=0,r=Object.keys(e);n<r.length;n++){var a=r[n],i=e[a],o=this.inferComponentType(a,i),s={id:this.generateComponentId(o.type),type:o.type,label:this.humanizeFieldName(a),defaultValue:i,expressionValue:void 0};if(o.textboxType&&(s.textboxType=o.textboxType,"email"===o.textboxType?s.regex=V.EMAIL:"url"===o.textboxType&&(s.regex=V.URL)),"date"===o.type&&void 0!==s.defaultValue&&null!==s.defaultValue){var l=this.formatDateTimeValue(s.defaultValue);l&&(s.defaultValue=l)}Array.isArray(i)&&i.length>0&&(s.options=i),t.push(s)}return t},e.prototype.createComponent=function(e,t,n,r){var a={};!0===(void 0!==t.required?t.required:r.required)&&(a.required=!0),t.minLength&&(a.minLength=t.minLength),t.maxLength&&(a.maxLength=t.maxLength),t.minDate&&(a.minDate=t.minDate),t.maxDate&&(a.maxDate=t.maxDate),t.minTime&&(a.minTime=t.minTime),t.minValue&&(a.minValue=t.minValue),t.maxValue&&(a.maxValue=t.maxValue),t.pattern&&(a.pattern=t.pattern);var i=b(t.id||this.generateComponentId(n.type),this.generateComponentId(n.type)),o=Q({id:i,name:t.name,type:n.type,label:t.title||t.label||this.humanizeFieldName(e),defaultValue:t.default||t.defaultValue||void 0,expressionValue:t.expressionValue||void 0,content:t.content,buttonType:t.buttonType,textboxType:t.textboxType},Object.keys(a).length>0?a:void 0);if(n.textboxType&&(o.textboxType=n.textboxType,"email"===n.textboxType?a.pattern||(a.regex="^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$",a.validationMessage="Please enter a valid email address"):"url"===n.textboxType&&(a.pattern||(a.regex="^(https?:\\/\\/)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)$",a.validationMessage="Please enter a valid URL"))),"date"===n.type&&void 0!==o.defaultValue&&null!==o.defaultValue){var s=this.formatDateTimeValue(o.defaultValue);s&&(o.defaultValue=s)}return"splitButton"!==n.type&&"dropdown"!==n.type&&"multiselect"!==n.type&&"radio"!==n.type||!t.enum&&!t.options||(o.options=t.enum||t.options),o},e.prototype.parseDateFromValue=function(e){if(null==e)return null;if("number"==typeof e)return e<1e12?new Date(1e3*e):new Date(e);if("string"==typeof e){var t=e.trim(),n=new Date(t);if(!isNaN(n.getTime()))return n;var r=t.match(/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?)?/);if(r)return new Date(Number(r[1]),Number(r[2])-1,Number(r[3]),Number(r[4]||0),Number(r[5]||0),Number(r[6]||0));var a=t.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})(?:[ T](\d{1,2}):(\d{2})(?:[:](\d{2}))?)?/);if(a)return new Date(Number(a[3]),Number(a[1])-1,Number(a[2]),Number(a[4]||0),Number(a[5]||0),Number(a[6]||0))}return null},e.prototype.formatDate=function(e){var t=e.getMonth()+1,n=e.getDate();return(t<10?"0"+t:String(t))+"/"+(n<10?"0"+n:String(n))+"/"+e.getFullYear()},e.prototype.formatDateTimeValue=function(e){var t=this.parseDateFromValue(e);if(t){var n=this.formatDate(t);return 0!==t.getHours()||0!==t.getMinutes()||/\dT\d{2}:\d{2}/.test(String(e))?""+n:n}},e.prototype.mapJsonSchemaType=function(e){var t=e.type;if("string"===t){var n=(e.format||"").toString().toLowerCase(),r=((e.title||e.label||"")+" "+(e.description||"")).toLowerCase();return/email|mail|e-?mail/.test(n)||/email|mail|e-?mail/.test(r)?{type:"textbox",textboxType:"email"}:/uri|url|link|website/.test(n)||/uri|url|link|website/.test(r)?{type:"textbox",textboxType:"url"}:/phone|tel|mobile|cell|msisdn/.test(n)||/phone|tel|mobile|cell|msisdn/.test(r)?{type:"textbox",textboxType:"number"}:/password|pwd|pass|security|secret|key/.test(n)||/password|pwd|pass|security|secret|key/.test(r)?{type:"textbox",textboxType:"password"}:"date"===n||"date-time"===n||/date|birthday|dob/.test(r)?{type:"date"}:e.enum?{type:"dropdown"}:e.options?{type:"dropdown"}:{type:this.config.defaultTextType}}return"number"===t||"integer"===t?{type:"number"}:"boolean"===t?{type:"checkbox"}:"array"===t?{type:"multiselect"}:"message"===t?{type:"message"}:"button"===t?{type:"button"}:"signature"===t||"sign"===t?{type:"signature"}:"image"===t||"imageEditor"===t?{type:"imageEditor"}:"file"===t||"fileUpload"===t?{type:"fileUpload"}:"color"===t||"colorPicker"===t?{type:"colorPicker"}:"splitButton"===t?{type:"splitButton"}:{type:this.config.defaultTextType}},e.prototype.generateComponentId=function(e){return this.config.generateIds?e+"_"+Date.now()+"_"+Math.floor(1e3*Math.random()):""},e.prototype.humanizeFieldName=function(e){var t=e.replace(/_/g," ");return t=t.replace(/([a-z])([A-Z])/g,"$1 $2")},e}(),te=function(e){try{return JSON.parse(e),{valid:!0}}catch(e){return{valid:!1,errors:["Invalid JSON syntax: "+e.message]}}},ne=function(e){var t=[],n=[];if(e.components?Array.isArray(e.components)||t.push('Property "components" must be an array'):t.push("Missing required property: components"),Array.isArray(e.components)){var r=new Set,a=function(e,n){void 0===n&&(n="root"),e.id?(r.has(e.id)&&t.push("Duplicate component ID found: "+e.id),r.add(e.id)):t.push("Component at "+n+' is missing "id" property'),e.type||t.push('Component "'+(e.id||"unknown")+'" is missing "type" property'),e.children&&Array.isArray(e.children)&&e.children.forEach(function(e,t){a(e,n+".children["+t+"]")}),e.tabItems&&Array.isArray(e.tabItems)&&e.tabItems.forEach(function(e,t){e.content&&Array.isArray(e.content)&&e.content.forEach(function(e,r){a(e,n+".tabItems["+t+"].content["+r+"]")})}),e.tableCells&&Array.isArray(e.tableCells)&&e.tableCells.forEach(function(e,t){Array.isArray(e)&&e.forEach(function(e,r){Array.isArray(e)&&e.forEach(function(e,i){a(e,n+".tableCells["+t+"]["+r+"]["+i+"]")})})})};e.components.forEach(function(e,t){a(e,"components["+t+"]")})}return{valid:0===t.length,errors:t.length>0?t:void 0,warnings:n.length>0?n:void 0}},re=function(e){var t={version:e.version||"0.1.0",components:e.components||[]},n=function(e){var t=Q({},e,{_configured:!0});return e.children&&Array.isArray(e.children)&&(t.children=e.children.map(n)),e.tabItems&&Array.isArray(e.tabItems)&&(t.tabItems=e.tabItems.map(function(e){return Q({},e,{content:e.content?e.content.map(n):[]})})),e.tableCells&&Array.isArray(e.tableCells)&&(t.tableCells=e.tableCells.map(function(e){return e.map(function(e){return Array.isArray(e)?e.map(n):[]})})),t};return t.components=t.components.map(n),t},ae=function(){function e(e){this.content=e.content,this.id=e.id,this.enableHtmlSanitizer=!!t.isNullOrUndefined(e.enableHtmlSanitizer)||e.enableHtmlSanitizer,this.el=e.target||null}return e.prototype.resolveHtml=function(e){try{return this.enableHtmlSanitizer?t.SanitizeHtmlHelper.sanitize(e):e}catch(e){return""}},e.prototype.render=function(){var e=document.createElement("div");return this.id&&(e.id=this.id),e.innerHTML=this.resolveHtml(this.content),this.el=e,e},e.prototype.update=function(e){this.content=e,this.el&&(this.el.innerHTML=this.resolveHtml(this.content))},e.prototype.getElement=function(){return this.el},e.prototype.destroy=function(){this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el),this.el=null,this.content="",this.enableHtmlSanitizer=!1,this.id=void 0},e}(),ie=function(){function e(){}return e.getConstraints=function(e,t,n){var r=this;if(void 0===n&&(n="number"),!e||0===e.length)return this.getEmptyConstraints(n);var a=e.find(function(e){return!1===e.enabled});if(a){var i=this.resolveValue(a.minValue,{}),o=this.resolveValue(a.maxValue,{});return"date"===n||"dateRange"===n?{minValue:void 0,maxValue:void 0,minDate:i,maxDate:o,minTime:void 0,maxTime:void 0}:"time"===n?{minValue:void 0,maxValue:void 0,minDate:void 0,maxDate:void 0,minTime:i,maxTime:o}:{minValue:i,maxValue:o,minDate:void 0,maxDate:void 0,minTime:void 0,maxTime:void 0}}var s=e.filter(function(e){return!0===e.enabled});if(0===s.length)return this.getEmptyConstraints(n);var l=s.map(function(e){return{min:r.resolveValue(e.minValue,t),max:r.resolveValue(e.maxValue,t)}}).filter(function(e){return void 0!==e.min||void 0!==e.max});if(0===l.length)return this.getEmptyConstraints(n);var d=this.getPermissiveMin(l,n),c=this.getPermissiveMax(l,n);return"date"===n||"dateRange"===n?{minValue:void 0,maxValue:void 0,minDate:d,maxDate:c,minTime:void 0,maxTime:void 0}:"time"===n?{minValue:void 0,maxValue:void 0,minDate:void 0,maxDate:void 0,minTime:d,maxTime:c}:{minValue:d,maxValue:c,minDate:void 0,maxDate:void 0,minTime:void 0,maxTime:void 0}},e.resolveValue=function(e,t){if("number"==typeof e)return e;if("string"==typeof e)return e;if(e&&"object"==typeof e&&e.field){var n=t[e.field];return void 0!==n?n:void 0}},e.getPermissiveMin=function(e,t){var n=this;if(0!==e.length){if("date"===t||"dateRange"===t)return e.reduce(function(e,t){if(!t.min)return e;if(!e)return t.min;var r=n.convertToISO(e);return n.convertToISO(t.min)<r?t.min:e},void 0);if("time"===t)return e.reduce(function(e,t){if(!t.min)return e;if(!e)return t.min;var r=n.convertTimeTo24Hour(e);return n.convertTimeTo24Hour(t.min)<r?t.min:e},void 0);var r=e.map(function(e){return e.min}).filter(function(e){return void 0!==e});return r.length>0?Math.min.apply(Math,r):void 0}},e.getPermissiveMax=function(e,t){var n=this;if(0!==e.length){if("date"===t||"dateRange"===t)return e.reduce(function(e,t){if(!t.max)return e;if(!e)return t.max;var r=n.convertToISO(e);return n.convertToISO(t.max)>r?t.max:e},void 0);if("time"===t)return e.reduce(function(e,t){if(!t.max)return e;if(!e)return t.max;var r=n.convertTimeTo24Hour(e);return n.convertTimeTo24Hour(t.max)>r?t.max:e},void 0);var r=e.map(function(e){return e.max}).filter(function(e){return void 0!==e});return r.length>0?Math.max.apply(Math,r):void 0}},e.convertToISO=function(e){if(!e)return"";if(e.includes("-")&&10===e.length)return e;if(-1!==e.indexOf("/")){var t=e.split("/"),n=t[0],r=t[1],a=t[2];return n&&r&&a?a+"-"+(n.length<2?"0"+n:n)+"-"+(r.length<2?"0"+r:r):e}return e},e.convertTimeTo24Hour=function(e){if(!e)return"";var t=/PM/i.test(e),n=/AM/i.test(e);if(n||t){var r=e.replace(/\s*(AM|PM)/i,"").trim().split(":"),a=r[0],i=r[1];if(!a||!i)return e;var o=parseInt(a,10);t&&12!==o?o+=12:n&&12===o&&(o=0);var s=String(o);return(s.length<2?"0"+s:s)+":"+i}return e},e.getEmptyConstraints=function(e){return{minValue:void 0,maxValue:void 0,minDate:void 0,maxDate:void 0,minTime:void 0,maxTime:void 0}},e.validateValue=function(e,t,n){if(void 0===e||null===e||""===e)return{isValid:!0};if("date"===n||"dateRange"===n){if(t.minDate){var r=this.convertToISO(t.minDate);if((i=this.convertToISO(e))<r)return{isValid:!1,error:"Date must be on or after "+t.minDate}}if(t.maxDate){var a=this.convertToISO(t.maxDate),i=this.convertToISO(e);if(i>a)return{isValid:!1,error:"Date must be on or before "+t.maxDate}}}else if("time"===n){if(t.minTime&&e<t.minTime)return{isValid:!1,error:"Time must be on or after "+t.minTime};if(t.maxTime&&e>t.maxTime)return{isValid:!1,error:"Time must be on or before "+t.maxTime}}else{var o=Number(e);if(void 0!==t.minValue&&o<Number(t.minValue))return{isValid:!1,error:"Value must be at least "+t.minValue};if(void 0!==t.maxValue&&o>Number(t.maxValue))return{isValid:!1,error:"Value must be at most "+t.maxValue}}return{isValid:!0}},e}(),oe=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),se=function(){return(se=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)},le=function(e,t,n,r){var a,i=arguments.length,o=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(o=(i<3?a(o):i>3?a(t,n,o):a(t,n))||o);return i>3&&o&&Object.defineProperty(t,n,o),o},de=["textbox","number","checkbox","dropdown","multiselect","date","dateTime","time","dateRange","switch","rating","colorPicker","inputMask","fileUpload"],ce={unsupportedComponent:"Unsupported Component type"},ue=function(e){function i(n,r){var a=e.call(this,n,r)||this;return a.processedSchemaCache={version:"1.0.0",components:[]},a.l10n=new t.L10n("form-renderer",ce,a.locale),a.formState={values:Object.create(null),errors:Object.create(null)},a.validator=null,a.inputRefs={},a.conditionalValueApplied={},a.expressionEngine=null,a.expressionDependencyGraph={},a.expressionEvaluationInProgress=!1,a.previousFormValues={},a.computedFieldNames=new Set,a.customValidationEngine=new H,a.currentFormValues={},a.isInitialized=!1,a.hasLayoutComponentsCache=!1,a.idToLabelCache={},a.initialValuesCache={},a.renderedInstances=[],a.tooltipRefs={},a.createdFired=!1,a.rerenderScheduled=!1,a.conditionalTriggerFieldIds=new Set,a.preservedFields=new Map,a.consumerDependencyMap=new Map,a.pendingChangedFieldIds=new Set,a}oe(i,e),o=i,i.prototype.getModuleName=function(){return"form-renderer"},i.prototype.getPersistData=function(){return this.addOnPersist(["formState",JSON.stringify(this.formState)])},i.prototype.preRender=function(){t.enableRipple(!0),this.createdFired=!1,this.expressionEngine=new D},i.prototype.render=function(){var e=this;if(this.clearEngineCaches(),this.removePreviousRoot(),this.normalizeSchema(),this.element.classList.add("form-renderer-container"),this.className&&t.addClass([this.element],this.className.replace(/\s+/g," ").trim().split(" ")),this.enableRtl?this.element.classList.add("e-rtl"):this.element.classList.remove("e-rtl"),this.hasLayoutComponentsCache=this.computeHasLayoutComponents(),this.idToLabelCache=this.computeIdToLabel(),this.initialValuesCache=this.buildInitialValues(),this.buildValidationRulesAndBridge(),this.isInitialized||(this.isInitialized=!0),this.formState&&this.initialValuesCache)for(var n=0,r=Object.keys(this.initialValuesCache);n<r.length;n++){var a=r[n],i=this.initialValuesCache[a];this.formState.values[a]||(this.formState.values[a]=i)}this.currentFormValues=se({},this.formState?this.formState.values:{}),this.initExpressionEngine(),this.buildConditionalDependencyMap();var o=t.createElement("form",{className:"form-renderer "+this.layoutClass,attrs:{role:"region","aria-label":this.processedSchemaCache.settings?this.processedSchemaCache.settings.name||"Form":"Form"}});this.element.appendChild(o),this.inputRefs={},(this.processedSchemaCache.components||[]).forEach(function(n){var r=e.renderComponent(n);if(r&&o.appendChild(r),"richTextEditor"===n.type){var a=r.querySelector(".e-richtexteditor");(s=t.getComponent(a,"richtexteditor")).refreshUI()}if("dataGrid"===n.type){var i=r.querySelector(".e-control.e-toolbar"),s=t.getComponent(i,"toolbar");s.refresh()}if("tabs"===n.type){var l=r.querySelector(".e-control.e-tab");t.getComponent(l,"tab").refreshOverflow()}}),this.created&&!this.createdFired&&setTimeout(function(){Object.keys(e.inputRefs).length>0&&(e.createdFired=!0,e.trigger("created",{}))},0)},i.prototype.normalizeSchema=function(){var e=this.schema;try{if(!e)return void(this.processedSchemaCache={version:"1.0.0",components:[]});var t=e;if("string"==typeof e)try{t=JSON.parse(e)}catch(e){return this.failure&&this.trigger("failure",{error:e}),void(this.processedSchemaCache={version:"1.0.0",components:[]})}if(t&&"object"==typeof t&&t.properties&&Array.isArray(t.layout))this.processedSchemaCache=m(t);else{var n=(new ee).parse("string"==typeof e?e:JSON.stringify(e));n.success&&n.schema?this.processedSchemaCache=n.schema:(this.failure&&this.trigger("failure",{error:n.errors}),this.processedSchemaCache={version:"1.0.0",components:[]})}}catch(e){this.failure&&this.trigger("failure",{error:e}),this.processedSchemaCache={version:"1.0.0",components:[]}}},i.prototype.computeHasLayoutComponents=function(){if(!this.processedSchemaCache.components)return!1;var e=function(t){for(var n=0,r=t;n<r.length;n++){var a=r[n];if(-1!==["table","tabs","panel","card"].indexOf(a.type))return!0;if(a.children&&e(a.children))return!0;if(a.tableCells)for(var i=0,o=a.tableCells;i<o.length;i++)for(var s=0,l=o[i];s<l.length;s++){var d=l[s];if(e(d))return!0}if(a.tabItems)for(var c=0,u=a.tabItems;c<u.length;c++){var p=u[c];if(p.content&&e(p.content))return!0}}return!1};return e(this.processedSchemaCache.components)},Object.defineProperty(i.prototype,"layoutClass",{get:function(){if(this.hasLayoutComponentsCache)return"";switch(this.layout){case"TwoColumn":return"twolayout";case"ThreeColumn":return"threelayout";case"FourColumn":return"fourlayout";case"SingleColumn":default:return""}},enumerable:!0,configurable:!0}),i.prototype.collectAllComponents=function(e){var t=[],n=function(e){e.forEach(function(e){t.push(e),e.children&&e.children.length>0&&n(e.children),e.tableCells&&e.tableCells.forEach(function(e){e.forEach(function(e){return n(e)})}),e.tabItems&&e.tabItems.forEach(function(e){e.content&&n(e.content)})})};return n(e),t},i.prototype.computeIdToLabel=function(){var e={},t=function(n){n.forEach(function(n){n.label&&-1===["panel","table","tabs","card","button","message","splitButton"].indexOf(n.type)&&(n.name?e[n.id]=n.name:n.label&&(e[n.id]=n.label)),n.children&&t(n.children),n.tableCells&&n.tableCells.forEach(function(e){return e.forEach(function(e){return t(e)})}),n.tabItems&&n.tabItems.forEach(function(e){e.content&&t(e.content)})})};return t(this.processedSchemaCache.components),e},i.prototype.buildValidationRulesAndBridge=function(){var e=this,t={},n=this.formState&&this.formState.values||{},r=function(a,i){void 0===i&&(i=!0),a.forEach(function(a){if(a){var o={},s=i&&!1!==a.visible&&x.isFieldVisible(a.conditions,n),l=i&&x.isFieldHidden(a.conditions,n);if(s&&!l){var d=x.isFieldRequired(a.conditions,n),c=x.isFieldDisabled(a.conditions,n),u=x.isFieldReadOnly(a.conditions,n),p=!!a.required||d,h=!!a.disabled||c,m=!!a.readOnly||u;if(a.customValidation&&Array.isArray(a.customValidation)&&a.customValidation.length>0&&!h&&!m){var f=a.customValidation&&a.customValidation[0]&&a.customValidation[0].expression,v=(f&&f.match(/\?\s*true\s*:\s*['"](.+?)['"]/)?f.match(/\?\s*true\s*:\s*['"](.+?)['"]/)[1]:void 0)||a.validationMessage||(a.label||a.id)+" is invalid",y=e;o.customValidation=[function(e){var t=e.value;if(p&&(""===t||null===t||void 0===t))return!0;var n={};y.collectAllComponents(y.processedSchemaCache.components).forEach(function(e){e.name&&(n[e.id]=e.name)});for(var r=se({},y.currentFormValues||{}),i=0,o=Object.keys(se({},r));i<o.length;i++){var s=o[i],l=r[s],d=n[s];d&&(r[d]=l,delete r[s])}for(var c=0,u=a.customValidation;c<u.length;c++){var h=u[c];if(!y.customValidationEngine)return!0;if(!0!==y.customValidationEngine.validate(h.expression,t,r))return!1}return!0},v]}!p||h||m||(o.required=[!0,a.validationMessage||a.label+" is required"]),!a.minLength||h||m||(o.minLength=[a.minLength,"Minimum "+a.minLength+" characters allowed"]),!a.maxLength||h||m||(o.maxLength=[a.maxLength,"Maximum "+a.maxLength+" characters allowed"]),"textbox"!==a.type||!a.textboxType||a.regex||o.regex||h||m||("email"===a.textboxType?o.regex=[V.EMAIL,a.validationMessage||"Invalid format"]:"url"===a.textboxType&&(o.regex=[V.URL,a.validationMessage||"Invalid format"])),!a.regex||h||m||(o.regex=[a.regex,a.validationMessage||"Invalid format"]),Object.keys(o).length>0&&(t[a.id]=o),a.children&&r(a.children,s&&!l),a.tableCells&&a.tableCells.forEach(function(e){return e.forEach(function(e){return r(e,s&&!l)})}),a.tabItems&&a.tabItems.forEach(function(e){e.content&&r(e.content,s&&!l)})}}})};r(this.processedSchemaCache.components);var i=this.formState?se({},this.formState.values):se({},this.initialValuesCache);if(this.formState={values:Object.assign(Object.create(null),this.initialValuesCache,i),errors:this.enablePersistence?this.formState.errors:Object.create(null)},i&&Object.keys(i).forEach(function(t){t in e.formState.values||(e.formState.values[t]=i[t])}),this.validator){try{this.validator.refresh(),this.validator.destroy()}catch(e){}this.validator=null}var o=this;this.validator=new a.FormValidator(this.element,{rules:t,locale:this.locale,ignore:"e-hidden",errorClass:"e-error",validClass:"e-valid",errorElement:"div",errorContainer:"div",customPlacement:function(e,t){var n=e.getAttribute("name");if(!n)return void(e.parentElement&&e.parentElement.appendChild(t));var r=document.getElementById("error-"+n);if(r){for(;r.firstChild;)r.removeChild(r.firstChild);r.appendChild(t),r.style.display="block"}else e.parentElement&&e.parentElement.appendChild(t)},validationComplete:function(e){if(o.syncFormStateErrors(),e&&e.inputName){var t=document.getElementById("error-"+e.inputName);if(t)if("success"===e.status){for(;t.firstChild;)t.removeChild(t.firstChild);t.style.display="none"}else"failure"===e.status&&(t.style.display="block")}},submit:function(e){if(o.validator){if(!o.validator.validate())return void(e&&"function"==typeof e.preventDefault&&e.preventDefault());o.handleSubmitData(se({},o.formState.values)),e&&"function"==typeof e.preventDefault&&e.preventDefault()}},reset:function(){}}),i&&Object.keys(i).forEach(function(t){var n=e.validator.getInputElement(t);if(n&&void 0!==i[t]&&null!==i[t])try{n.value=String(i[t])}catch(e){}})},i.prototype.syncFormStateErrors=function(){var e={};if(this.validator)for(var t=0,n=this.validator.errorRules||[];t<n.length;t++){var r=n[t];r&&r.name&&(e[r.name]=r.message)}this.formState.errors=e},i.prototype.buildInitialValues=function(){var e=this,t={},n=this.collectAllComponents(this.processedSchemaCache.components),r=new Set;return n.forEach(function(e){if("staticHtml"===e.type)return void r.add(e.id);if("dataGrid"===e.type&&(t[e.id]=Array.isArray(e.dataSource)?e.dataSource:[]),void 0!==e.defaultValue)t[e.id]=e.defaultValue;else switch(e.type){case"checkbox":case"switch":t[e.id]=!1}r.add(e.id)}),this.formState&&Object.keys(this.formState.values).filter(function(e){return!r.has(e)}).forEach(function(t){delete e.formState.values[t]}),t},i.prototype.initExpressionEngine=function(){if(this.processedSchemaCache.components&&0!==this.processedSchemaCache.components.length)try{var e=this.expressionEngine,t=this.collectAllComponents(this.processedSchemaCache.components),n=e.buildDependencyGraph(t);e.detectCircularDependencies(n).length,this.expressionDependencyGraph=n;var r=new Set;t.forEach(function(e){e.expressionValue&&r.add(e.id)}),this.computedFieldNames=r}catch(e){this.failure&&this.trigger("failure",{error:e})}},i.prototype.disposeTooltipInstance=function(e){var t=this.tooltipRefs[e]||null;if(t){try{t.destroy()}catch(e){this.trigger("failure",{error:e})}this.renderedInstances=this.renderedInstances.filter(function(e){return e!==t}),this.tooltipRefs[e]=null}},i.prototype.renderField=function(e){var n=this,a=this.formState,i=a?a.values:{};if(-1!==["panel","table","tabs","card","message","button","splitButton","staticHtml"].indexOf(e.type))return null;var o=x.isFieldReadOnly(e.conditions,i),s=x.isFieldDisabled(e.conditions,i),l=x.isFieldRequired(e.conditions,i),d=x.getConditionalValue(e.conditions,i),c=!!e.readOnly||o,u=!!e.disabled||s,p=!!e.required||l,h=ie.getConstraints(e.minMaxRange,i,e.type);if("dateTime"===e.type){var m=ie.getConstraints(e.minMaxRange,i,"date"),f=ie.getConstraints(e.minMaxTimeRange,i,"time");h={minValue:void 0,maxValue:void 0,minDate:m.minDate,maxDate:m.maxDate,minTime:f.minTime,maxTime:f.maxTime}}var v=e.labelPosition||"top",y=e.labelWidth||"auto",b=!e.hideLabel&&!!e.label&&-1===["checkbox","button","staticHtml"].indexOf(e.type),C=!(!a||!a.errors[e.id]),w=C&&!(!a||-1===a.errors[e.id].indexOf("required")),S=C&&!(w&&!p),E=void 0!==d,T=this.conditionalValueApplied[e.id]||!1;a&&(E&&!T?(a.values[e.id]=d,this.conditionalValueApplied[e.id]=!0):!E&&T&&(this.conditionalValueApplied[e.id]=!1));var A=t.createElement("div",{className:"form-group",attrs:{"data-field-id":e.id,"data-fr-field":e.id}}),D=t.createElement("div",{className:"field-wrapper label-"+v.toLowerCase()});if(b){var V=t.createElement("label",{className:"field-label"});-1===de.indexOf(e.type)&&"textarea"!==e.type||V.setAttribute("for",t.isNullOrUndefined(this.element.id)?e.name:this.element.id+"-"+e.name),V.style.width="left"===v.toLowerCase()?y+"%":"auto";var O=t.createElement("span");if(O.textContent=e.label,V.appendChild(O),p){var I=t.createElement("span",{className:"required-asterisk"});I.textContent="*",V.appendChild(I)}if(this.disposeTooltipInstance(e.id),e.tooltip){var R=t.createElement("span",{className:"e-msg-icon e-icons e-circle-info tooltip-icon",attrs:{"aria-label":e.tooltip,title:e.tooltip,tabindex:"0",role:"button","aria-haspopup":"true"}});R.style.cursor="pointer",R.style.display="flex",R.style.alignItems="center",R.style.justifyContent="center",R.style.flexShrink="0",V.appendChild(R);var F=new r.Tooltip({content:e.tooltip,enableRtl:this.enableRtl});F.appendTo(R),this.tooltipRefs[e.id]=F,this.renderedInstances.push(F)}D.appendChild(V)}var k=t.createElement("div",{className:"field-input"}),N=("radio"===e.type||"checkboxGroup"===e.type)&&Array.isArray(e.options)?function(t,r){t&&"number"==typeof r&&(n.inputRefs[e.name+"_"+r]=t)}:function(t){t&&(n.inputRefs[e.name]=t)},M=se({},e,{readOnly:c,disabled:u,required:p},void 0!==h.minValue&&{minValue:h.minValue},void 0!==h.maxValue&&{maxValue:h.maxValue},void 0!==h.minDate&&{minDate:h.minDate},void 0!==h.maxDate&&{maxDate:h.maxDate},void 0!==h.minTime&&{minTime:h.minTime},void 0!==h.maxTime&&{maxTime:h.maxTime}),L=function(t){if("staticHtml"!==e.type){if("signature"===e.type&&(t=(r=n.inputRefs[t]).getSignature()),"imageEditor"===e.type){var r=n.inputRefs[t],i=r.getImageData(),o=document.createElement("canvas");o.width=i.width,o.height=i.height;var s=o.getContext("2d");s&&s.putImageData(i,0,0),t=o.toDataURL()}"radio"!==e.type&&"checkboxGroup"!==e.type||(n.validator.getInputElement(e.id).value=t),t=g(e,t),n.formState&&a&&(n.formState.values[e.id]=t,a.values[e.id]=t),n.trigger("change",{fieldName:e.name,label:e.label||e.id,value:t}),n.afterValueChange(e.id)}},P=-1!==de.indexOf(e.type)?"input":"textarea"===e.type?"textarea":"div",j=t.createElement(P,{attrs:{"aria-label":e.label+" "+e.type}});if("radio"===e.type||"checkboxGroup"===e.type){var B=t.createElement("input");B.id=t.isNullOrUndefined(this.element.id)?e.name:this.element.id+"-"+e.name,B.setAttribute("name",e.id),B.style.display="none",B.setAttribute("aria-hidden","true"),j.appendChild(B)}else j.id=t.isNullOrUndefined(this.element.id)?e.name:this.element.id+"-"+e.name,j.setAttribute("name",e.id);k.appendChild(j);var U=K({component:M,value:a?a.values[e.id]:void 0,onChange:L,formState:a,settings:this.processedSchemaCache.settings,onBlur:function(){if(a&&"staticHtml"!==e.type&&n.validator){try{n.beforeValidate(e.id),n.validator.validate(e.id)}catch(e){}n.syncFormStateErrors()}},ref:N,hasError:S,locale:this.locale,components:this.collectAllComponents(this.processedSchemaCache.components),enableRtl:this.enableRtl,target:j,l10n:this.l10n});if(Array.isArray(U))U.forEach(function(e){if(e&&"function"==typeof e.destroy)n.renderedInstances.push(e);else if(e instanceof HTMLElement)for(var t=0,r=Object.keys(n.inputRefs);t<r.length;t++){var a=r[t],i=n.inputRefs[a],o=i&&(i.element||i.target||i.hostElement&&i.hostElement());o&&(o===e||e.contains(o))&&n.renderedInstances.push(i)}});else if(U)if("function"==typeof U.destroy)this.renderedInstances.push(U);else if(U instanceof HTMLElement)for(var _=0,z=Object.keys(this.inputRefs);_<z.length;_++){var W=z[_],q=this.inputRefs[W],H=q&&(q.element||q.target||q.hostElement&&q.hostElement());H&&(H===U||U.contains(H))&&this.renderedInstances.push(q)}var G=t.createElement("div",{id:"error-"+(e.id||e.name||e.label),className:"e-error-message",attrs:{role:"alert","aria-live":"assertive"}});if(G.style.display="none",S&&a&&a.errors[e.id]&&(G.textContent=a.errors[e.id],G.classList.add("e-error"),G.style.display="block"),k.appendChild(G),D.appendChild(k),A.appendChild(D),e.description){var $=t.createElement("div",{className:"field-description",attrs:{"aria-describedby":"description-"+e.label}});$.textContent=e.description,A.appendChild($)}return A},i.prototype.renderComponent=function(e){var r=this,a=this.formState,i=a?a.values:{},s=!1!==e.visible&&x.isFieldVisible(e.conditions,i),l=x.isFieldHidden(e.conditions,i);if(!s||l)return a&&void 0!==a.values[e.id]&&null!==a.values[e.id]&&(a.values[e.id]=null),null;if(o.PRESERVABLE_TYPES.has(e.type)&&this.preservedFields.has(e.id)){var d=this.preservedFields.get(e.id);if(d)return this.preservedFields.delete(e.id),d}switch(e.type){case"panel":if((V=t.createElement("fieldset",{className:"form-panel-renderer "+(e.cssClass||"")})).style.minInlineSize="unset",e.label&&!e.hideLabel){var c=t.createElement("legend",{className:e.hideBorders?"":"panel-legend"});c.textContent=e.label,V.appendChild(c)}var u=t.createElement("div",{className:"panel-content"});return(e.children||[]).forEach(function(e){var t=r.renderComponent(e);t&&u.appendChild(t)}),V.appendChild(u),V;case"table":for(var p=e.rows||(e.tableCells?e.tableCells.length:2),h=e.columns||(e.tableCells&&e.tableCells[0]?e.tableCells[0].length:2),m=Math.floor(12/h),f=e.columnWidths,v=f?y(f.widths):[],g=t.createElement("div",{className:"form-table-renderer "+(e.hideBorders?"":"table-border")+" "+(e.cssClass||""),attrs:{role:"group","aria-label":e.label||"Table Layout"}}),b=0;b<p;b++){var C=t.createElement("div",{className:"e-form-table-row"});e.hideBorders&&(C.style.display="flex",C.style.gap="1.5rem");for(var w=0;w<h;w++)!function(n){var a=e.tableCells&&e.tableCells[b]&&e.tableCells[b][n]||[],i=m,o=v[n],s=1===h?{width:"100%"}:o?{width:o+"%"}:{},l=!f||Array.isArray(f.widths)&&f.widths.every(function(e){return null===e}),d=0===b,c=t.createElement("div",{className:"e-form-table-cell "+(o?"":l?"col-"+i:"")});e.hideBorders?Object.assign(c.style,s,{padding:d?"0":"12px 0 0 0"}):Object.assign(c.style,s),a.forEach(function(e){var t=r.renderComponent(e);t&&c.appendChild(t)}),C.appendChild(c)}(w);g.appendChild(C)}return g;case"tabs":var S=t.createElement("div",{className:"form-tabs-renderer "+(e.cssClass||"")}),E=t.createElement("div",{className:"e-tab"});E.id=e.id;var T=t.createElement("div",{className:"e-tab-header"}),A=t.createElement("div",{className:"e-content"});E.appendChild(T),E.appendChild(A),S.appendChild(E),(e.tabItems||[]).forEach(function(e){var n=t.createElement("div");n.textContent=e.header,T.appendChild(n);var a=t.createElement("div"),i=t.createElement("div",{className:"tab-content-renderer"});(e.content||[]).forEach(function(e){var t=r.renderComponent(e);t&&i.appendChild(t)}),a.appendChild(i),A.appendChild(a)});var D=new n.Tab({enableRtl:this.enableRtl,cssClass:e.cssClass,enablePersistence:!0,animation:{previous:{effect:"None"},next:{effect:"None"}},selected:function(t){if("undefined"==typeof window)return null;try{window.localStorage.setItem("tab"+e.id,JSON.stringify({selectedItem:t.selectedIndex}))}catch(e){}}});return D.appendTo(E),this.renderedInstances.push(D),S;case"card":var V=t.createElement("fieldset",{className:"e-card form-card-renderer "+(e.cssClass||"")});V.style.minInlineSize="unset",V.style.padding="0";var O=t.createElement("div",{className:"e-card-header"}),I=t.createElement("div",{className:"e-card-header-caption"}),R=t.createElement("div",{className:"e-card-title"});if(R.textContent=e.cardTitle||e.label||"Card Title",I.appendChild(R),e.cardSubtitle){var F=t.createElement("div",{className:"e-card-sub-title"});F.textContent=e.cardSubtitle,I.appendChild(F)}O.appendChild(I),V.appendChild(O);var k=t.createElement("div",{className:"e-card-content card-content"});return(e.children||[]).forEach(function(e){var t=r.renderComponent(e);t&&k.appendChild(t)}),V.appendChild(k),V;case"staticHtml":var N=new ae({content:e.defaultValue||"<p>HTML content</p>",id:e.id,enableHtmlSanitizer:e.enableHtmlSanitizer}),M=N.render();return this.renderedInstances.push(N),M;case"message":j=t.createElement("div",{className:"form-group"});(W=t.createElement("div")).id=e.name,W.setAttribute("name",e.id),j.appendChild(W);U=K({component:e,locale:this.locale,value:void 0,onChange:function(){},enableRtl:this.enableRtl,target:W,ref:function(t,n){void 0!==n?r.inputRefs[e.name+"_"+n]=t:r.inputRefs[e.name]=t}});return Array.isArray(U)?U.forEach(function(e){e&&r.renderedInstances.push(e)}):U&&this.renderedInstances.push(U),j;case"button":var L=x.isFieldDisabled(e.conditions,i),P=!!e.disabled||L,j=t.createElement("div",{className:"form-group"});(W=t.createElement("div")).id=e.name,W.setAttribute("name",e.id),j.appendChild(W);var B=function(t){if(r.buttonClick){var n=e.buttonsGroups?t.target&&t.target.ej2_instances?t.target.ej2_instances[0].content:"":e.label||"";r.trigger("buttonClick",{fieldName:e.name,label:n,event:t})}var a=t.target;if(a.type&&"reset"===a.type){var i=a.closest("form");i&&(i.querySelectorAll('input[type="checkbox"]').forEach(function(e){e.ej2_instances[0].checked=!1}),i.querySelectorAll(".e-control.e-multiselect.e-lib").forEach(function(e){e.ej2_instances[0].value=[]})),r.formState.values={},i.reset(),r.rerenderForm(),r.validator.destroy()}},U=K({component:se({},e,{disabled:P}),value:void 0,onChange:function(){},locale:this.locale,onClick:B,ref:function(t,n){void 0!==n?r.inputRefs[e.name+"_"+n]=t:r.inputRefs[e.name]=t},enableRtl:this.enableRtl,target:W});return Array.isArray(U)?U.forEach(function(e){e&&r.renderedInstances.push(e)}):U&&this.renderedInstances.push(U),j;case"splitButton":var _=x.isFieldDisabled(e.conditions,i),z=!!e.disabled||_,j=t.createElement("div",{className:"form-group"}),W=t.createElement("div");W.id=e.name,W.setAttribute("name",e.id),j.appendChild(W);var q=function(t){r.buttonClick&&r.trigger("buttonClick",{fieldName:e.name,label:e.label||"",event:t})},U=K({component:se({},e,{disabled:z}),value:void 0,locale:this.locale,onChange:function(){},onClick:q,ref:function(t){t&&(r.inputRefs[e.name]=t)},enableRtl:this.enableRtl,target:W});return Array.isArray(U)?U.forEach(function(e){e&&r.renderedInstances.push(e)}):U&&this.renderedInstances.push(U),j;default:return this.renderField(e)}},i.prototype.afterValueChange=function(e){this.formState&&(this.currentFormValues=se({},this.formState.values),this.evaluateExpressions(),this.retriggerCustomValidation(),this.beforeValidate(e),this.validator.validate(e),this.syncFormStateErrors(),e&&this.isConditionalTrigger(e)&&this.scheduleRerender(e))},i.prototype.beforeValidate=function(e){var t=this.element.querySelector("#"+e+"-info");t&&t.classList.contains("e-error")&&t.classList.remove("e-error");var n=this.getInputElementByName(e),r=n.parentElement,a=r.parentElement;r.classList.contains("e-control-wrapper")||r.classList.contains("e-wrapper")||n.classList.contains("e-input")&&r.classList.contains("e-input-group")?r.classList.remove("e-error"):null!=a&&(a.classList.contains("e-control-wrapper")||a.classList.contains("e-wrapper"))?a.classList.remove("e-error"):n.classList.remove("e-error"),this.validator&&(this.validator.errorRules=[])},i.prototype.scheduleRerender=function(e){var t=this;e&&this.pendingChangedFieldIds.add(e),this.rerenderScheduled||(this.rerenderScheduled=!0,Promise.resolve().then(function(){t.rerenderScheduled=!1;var e=new Set(t.pendingChangedFieldIds);t.pendingChangedFieldIds.clear(),t.rerenderForm(e)}))},i.prototype.collectConditionFieldIds=function(e,t){if(e)if("string"==typeof e.field)t.add(e.field);else if(Array.isArray(e.rules))for(var n=0,r=e.rules;n<r.length;n++){var a=r[n];this.collectConditionFieldIds(a,t)}},i.prototype.collectDataSourceReferenceIds=function(e,t,n){if("string"==typeof e){var r=e.match(/\{([^}]+)\}/g);if(r)for(var a=0,i=r;a<i.length;a++)!function(e){var r=e.slice(1,-1),a=t.find(function(e){return e.name===r});a&&a.id&&n.add(a.id)}(i[a])}},i.prototype.buildConditionalDependencyMap=function(){for(var e=new Set,t=new Map,n=this.collectAllComponents(this.processedSchemaCache.components),r=this,a=0,i=n;a<i.length;a++)!function(a){var i=new Set;t.set(a.id,i);var o=a.conditions;if(o){for(var s=0,l=["visibleWhen","hideWhen","disabledWhen","requiredWhen","readOnlyWhen","choiceBasedField","conditionalData"];s<l.length;s++){var d=l[s];o[d]&&(r.collectConditionFieldIds(o[d],e),r.collectConditionFieldIds(o[d],i))}if(Array.isArray(o.conditionalData))for(var c=0,u=o.conditionalData;c<u.length;c++){var p=u[c];if(p&&p.condition&&(r.collectConditionFieldIds(p.condition,e),r.collectConditionFieldIds(p.condition,i)),p&&Array.isArray(p.conditions))for(var h=0,m=p.conditions;h<m.length;h++){var f=m[h];r.collectConditionFieldIds(f,e),r.collectConditionFieldIds(f,i)}}o.setValueWhen&&o.setValueWhen.condition&&(r.collectConditionFieldIds(o.setValueWhen.condition,e),r.collectConditionFieldIds(o.setValueWhen.condition,i)),o.choiceBasedField&&"string"==typeof o.choiceBasedField.primaryFieldId&&(e.add(o.choiceBasedField.primaryFieldId),i.add(o.choiceBasedField.primaryFieldId))}var v=function(t){if(t&&!0===t.enabled){var n=function(t){t&&"object"==typeof t&&"string"==typeof t.field&&(e.add(t.field),i.add(t.field))};n(t.minValue),n(t.maxValue)}},y=a.minMaxRange;if(Array.isArray(y))for(var g=0,b=y;g<b.length;g++)v(S=b[g]);var x=a.minMaxTimeRange;if(Array.isArray(x))for(var C=0,w=x;C<w.length;C++){var S=w[C];v(S)}var E=a.dataSource;if("dataGrid"===a.type&&E&&"url"===E.type&&(E.search&&"string"==typeof E.search.key&&(r.collectDataSourceReferenceIds(E.search.key,n,e),r.collectDataSourceReferenceIds(E.search.key,n,i)),Array.isArray(E.filters)))for(var T=0,A=E.filters;T<A.length;T++){var D=A[T];"string"==typeof D.value&&(r.collectDataSourceReferenceIds(D.value,n,e),r.collectDataSourceReferenceIds(D.value,n,i))}}(i[a]);this.conditionalTriggerFieldIds=e,this.consumerDependencyMap=t},i.prototype.isConditionalTrigger=function(e){return this.conditionalTriggerFieldIds.has(e)},i.prototype.rerenderForm=function(e){var t=this,n=e||new Set,r=document.activeElement,a=r&&r.getAttribute?r.getAttribute("name"):null,i=null,s=null;if(a&&r&&void 0!==r.selectionStart)try{i=r.selectionStart,s=r.selectionEnd}catch(e){}var l=this.element.scrollTop,d=this.element.scrollLeft,c=window.scrollX,u=window.scrollY;this.preservedFields.clear();for(var p=this,h=0,m=this.collectAllComponents(this.processedSchemaCache.components);h<m.length;h++)!function(e){if(!o.PRESERVABLE_TYPES.has(e.type))return"continue";var t=p.consumerDependencyMap.get(e.id),r=!1;if(t&&n.forEach(function(e){t.has(e)&&(r=!0)}),r)return"continue";var a=p.element.querySelector('[data-field-id="'+e.id+'"]');a&&a.parentElement&&(a.parentElement.removeChild(a),p.preservedFields.set(e.id,a))}(m[h]);this.refreshing=!0,this.destroyRenderedExcludingPreserved(),this.removePreviousRoot(),this.validator&&this.validator.destroy(),this.render(),this.refreshing=!1;try{this.element.scrollTop=l,this.element.scrollLeft=d,window.scrollTo(c,u)}catch(e){}if(a){var f=this.getInputElementByName(a);if(f&&"function"==typeof f.focus)try{if(f.focus(),null!==i&&null!==s&&"function"==typeof f.setSelectionRange)try{f.setSelectionRange(i,s)}catch(e){}}catch(e){}}if(this.preservedFields.size>0){var v=[];this.preservedFields.forEach(function(e,n){if(t.element.contains(e)||document.body.contains(e))v.push(n);else{t.destroyPreservedSubtree(e);try{e.parentNode&&e.parentNode.removeChild(e)}catch(e){}t.preservedFields.delete(n)}}),v.forEach(function(e){return t.preservedFields.delete(e)})}},i.prototype.removePreviousRoot=function(){if(this.element)for(;this.element.childNodes.length>0;)this.element.removeChild(this.element.firstChild)},i.prototype.destroyRenderedInstance=function(e){if(e&&"function"==typeof e.destroy){var t=e;if(!(t.isDestroyed||t.destroyed||t.disposed)){var n=e.element||e.target||(e.hostElement&&"function"==typeof e.hostElement?e.hostElement():void 0);try{t.isDestroyed=!0,t.destroyed=!0,t.disposed=!0,e.destroy()}catch(e){console.warn("FormRenderer: failed to destroy child instance.",e)}finally{if(n&&n.parentNode)try{n.parentNode.removeChild(n)}catch(e){}}}}},i.prototype.destroyRenderedExcludingPreserved=function(){for(var e=[],t=Array.from(this.preservedFields.values()),n=this,r=0,a=this.renderedInstances;r<a.length;r++)!function(r){var a=r&&(r.element||r.target||r.hostElement&&r.hostElement());!!a&&t.some(function(e){return e===a||e.contains(a)})?e.push(r):n.destroyRenderedInstance(r)}(a[r]);this.renderedInstances=e;for(var i=this,o=0,s=Object.keys(this.inputRefs);o<s.length;o++)!function(e){var n=i.inputRefs[e],r=n&&(n.element||n.target||n.hostElement&&n.hostElement());!!r&&t.some(function(e){return e===r||e.contains(r)})||delete i.inputRefs[e]}(s[o]);this.conditionalValueApplied={},this.expressionDependencyGraph={},this.computedFieldNames=new Set,this.previousFormValues={},this.conditionalTriggerFieldIds=new Set},i.prototype.destroyPreservedSubtree=function(e){for(var t=[],n=0,r=this.renderedInstances;n<r.length;n++){var a=r[n],i=a&&(a.element||a.target||a.hostElement&&a.hostElement());i&&(i===e||e.contains(i))?this.destroyRenderedInstance(a):t.push(a)}this.renderedInstances=t},i.prototype.getInputElementByName=function(e){var t=this.element.querySelector('[name="'+e+'"]');if(!t)return null;if(!t.classList.contains("e-control")){var n=t.parentElement?t.parentElement.querySelector(".e-control"):null;if(n)return n}return t},i.prototype.evaluateExpressions=function(){if(this.formState&&this.expressionEngine&&!this.expressionEvaluationInProgress)try{this.expressionEvaluationInProgress=!0;var e=this.expressionEngine,t=this.expressionDependencyGraph,n=this.formState.values||{},r=this.collectAllComponents(this.processedSchemaCache.components),a=this.previousFormValues,i=this.computedFieldNames,o={};r.forEach(function(e){e.name&&(o[e.id]=e.name)});for(var s={},l=0,d=Object.keys(n);l<d.length;l++){var c=d[l],u=n[c];(b=o[c])&&(s[b]=u)}var p=se({},a);Object.assign(a,s);for(var h=new Set,m=0,f=Object.keys(s);m<f.length;m++)!function(e){var t=Object.keys(o).find(function(t){return o[t]===e});t&&s[e]!==p[e]&&!i.has(t)&&h.add(e)}(b=f[m]);if(0===h.size)return;for(var v=this,y=0,g=e.getTopologicalOrder(t);y<g.length;y++){var b=g[y];!function(t){var a=r.find(function(e){return e.name===t});if(a&&a.expressionValue){i.add(a.id);try{if(!1!==a.visible&&x.isFieldVisible(a.conditions,n)){for(var s={},l=0,d=Object.keys(n);l<d.length;l++){var c=d[l],u=n[c],p=o[c];p&&(s[p]=u)}var h=e.evaluate(a.expressionValue,s);if(null!==(h="string"==typeof h&&-1!==h.indexOf("undefined")?h.replace(/undefined/g,""):h)&&void 0!==h&&""!==h)switch(a.type){case"number":var m=Number(h);h=isNaN(m)?0:m;break;case"checkbox":case"switch":h=Boolean(h);break;case"textbox":case"textarea":h=String(h);break;case"dateRange":case"checkboxGroup":case"multiselect":break;default:h=String(h)}if(null!==h&&void 0!==h&&h!==n[a.id]&&v.formState&&(v.formState.values[a.id]=h,v.validator)){var f=v.getInputElementByName(a.id);if(f)try{f.ej2_instances[0]?f.ej2_instances[0].value=h:f.value=String(h)}catch(e){}}}}catch(e){v.failure&&v.trigger("failure",{error:e})}}}(b)}Object.assign(a,s)}finally{this.expressionEvaluationInProgress=!1}},i.prototype.retriggerCustomValidation=function(){var e=this;if(this.formState&&this.customValidationEngine)try{var t=this.collectAllComponents(this.processedSchemaCache.components),n=this.formState.values||{},r=this.previousFormValues,a=new Set;if(Object.keys(n).forEach(function(e){n[e]!==r[e]&&a.add(e)}),0===a.size)return;var i=new Set;a.forEach(function(e){var n=t.find(function(t){return t.id===e});n&&n.customValidation&&Array.isArray(n.customValidation)&&i.add(e)}),t.forEach(function(n){n.customValidation&&Array.isArray(n.customValidation)&&n.customValidation.forEach(function(r){e.customValidationEngine.extractDependencies(r.expression).forEach(function(e){var r=t.find(function(t){return t.id===e||t.name===e});r&&a.has(r.id)&&i.add(n.id)})})}),this.previousFormValues=se({},n)}catch(e){this.failure&&this.trigger("failure",{error:e})}},i.prototype.handleSubmitData=function(e){for(var t=this.formState,n=!(!t||!t.errors)&&0===Object.keys(t.errors).length,r={},a=t?t.values:{},i=new Set(["button","message","panel","table","tabs"]),o=this.collectAllComponents(this.processedSchemaCache.components||[]),s=new Set(o.filter(function(e){return i.has(e.type)}).map(function(e){return e.id})),l=new Set(o.filter(function(e){return!1===e.visible||(!(!e.conditions||!e.conditions.visibleWhen||x.isFieldVisible(e.conditions,a))||!!(e.conditions&&e.conditions.hideWhen&&x.isFieldHidden(e.conditions,a)))}).map(function(e){return e.id})),d=new Set(o.filter(function(e){return!!e.disabled||!(!e.conditions||!e.conditions.disabledWhen)&&x.isFieldDisabled(e.conditions,a)}).map(function(e){return e.id})),c=0,u=Object.keys(e);c<u.length;c++){var p=u[c],h=e[p];if(s.has(p)||l.has(p)||d.has(p))return;r[this.idToLabelCache[p]||p]=h}this.submit&&this.trigger("submit",{data:r,isValid:n})},i.prototype.getComponent=function(e){return this.inputRefs[e]||null},i.prototype.onPropertyChanged=function(e,t){var n=!1;e.schema!==t.schema&&(n=!0),e.locale!==t.locale&&(n=!0),e.enableRtl!==t.enableRtl&&(n=!0),e.layout!==t.layout&&(n=!0),e.locale!==t.locale&&(n=!0),n&&(this.refreshing=!0,this.destroyRendered(),this.removePreviousRoot(),this.isInitialized=!1,this.render(),this.refreshing=!1)},i.prototype.destroyRendered=function(){var e=this;if(this.validator){try{this.validator.destroy()}catch(e){this.trigger("failure",{error:e})}this.validator=null}this.renderedInstances.forEach(function(t){e.destroyRenderedInstance(t)}),this.renderedInstances=[],this.removePreviousRoot(),this.inputRefs={},this.tooltipRefs={},this.conditionalValueApplied={},this.expressionDependencyGraph={},this.computedFieldNames=new Set,this.previousFormValues={},this.conditionalTriggerFieldIds=new Set,this.consumerDependencyMap=new Map,this.preservedFields=new Map,this.pendingChangedFieldIds=new Set},i.prototype.clearPersistedTabSelections=function(){if("undefined"==typeof window)return null;try{var e=this.processedSchemaCache&&this.processedSchemaCache.components?this.processedSchemaCache.components:[];this.collectAllComponents(e).forEach(function(e){"tabs"===e.type&&e.id&&window.localStorage.removeItem("tab"+e.id)})}catch(e){}},i.prototype.destroy=function(){this.destroyRendered(),this.formState={values:{},errors:{}},this.expressionEngine=null,this.customValidationEngine=null,this.clearEngineCaches(),this.clearPersistedTabSelections(),this.consumerDependencyMap=new Map,this.preservedFields=new Map,this.conditionalTriggerFieldIds=new Set,e.prototype.destroy.call(this)},i.prototype.clearEngineCaches=function(){if(this.expressionEngine)try{this.expressionEngine.clearCache()}catch(e){}if(this.customValidationEngine){var e=this.customValidationEngine.expressionEngine;if(e&&"function"==typeof e.clearCache)try{e.clearCache()}catch(e){}}};var o;return i.PRESERVABLE_TYPES=new Set(["textbox","textarea","number","checkbox","checkboxGroup","radio","dropdown","multiselect","button","date","dateTime","time","dateRange","switch","signature","rating","imageEditor","fileUpload","rangeSlider","colorPicker","inputMask","message","panel","table","tabs","dataGrid","staticHtml","card","splitButton","richTextEditor"]),le([t.Property(null)],i.prototype,"schema",void 0),le([t.Property("SingleColumn")],i.prototype,"layout",void 0),le([t.Property("")],i.prototype,"className",void 0),le([t.Event()],i.prototype,"submit",void 0),le([t.Event()],i.prototype,"change",void 0),le([t.Event()],i.prototype,"buttonClick",void 0),le([t.Event()],i.prototype,"failure",void 0),le([t.Event()],i.prototype,"created",void 0),i=o=le([t.NotifyPropertyChanges],i)}(t.Component);!function(e){e.SingleColumn="SingleColumn",e.TwoColumn="TwoColumn",e.ThreeColumn="ThreeColumn",e.FourColumn="FourColumn"}(e.FormLayout||(e.FormLayout={}));var pe=["textbox","textarea","number","checkbox","checkboxGroup","radio","dropdown","multiselect","button","date","dateTime","time","dateRange","switch","signature","rating","imageEditor","fileUpload","rangeSlider","colorPicker","inputMask","message","panel","table","tabs","dataGrid","staticHtml","card","splitButton","richTextEditor"];return e.FORM_COMPONENT_TYPES=pe,e.FormRenderer=ue,e.defaultLocale=ce,e}({},ej.base,ej.navigations,ej.popups,ej.inputs,ej.buttons,ej.splitbuttons,ej.dropdowns,ej.calendars,ej.notifications,ej2ImageEditor,ej.richtexteditor,ej.data,ej.grids),this.ejs=ej;
11
11
  //# sourceMappingURL=ej2-form-renderer.min.js.map