survey-creator-core 2.5.26 → 2.5.27

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.
Files changed (154) hide show
  1. package/fesm/i18n/arabic.mjs +1 -1
  2. package/fesm/i18n/bulgarian.mjs +1 -1
  3. package/fesm/i18n/burmese.mjs +1 -1
  4. package/fesm/i18n/catalan.mjs +1 -1
  5. package/fesm/i18n/croatian.mjs +1 -1
  6. package/fesm/i18n/czech.mjs +1 -1
  7. package/fesm/i18n/danish.mjs +1 -1
  8. package/fesm/i18n/dutch.mjs +1 -1
  9. package/fesm/i18n/english.mjs +1 -1
  10. package/fesm/i18n/finnish.mjs +1 -1
  11. package/fesm/i18n/french.mjs +1 -1
  12. package/fesm/i18n/german.mjs +1 -1
  13. package/fesm/i18n/greek.mjs +1 -1
  14. package/fesm/i18n/haitian-creole.mjs +1 -1
  15. package/fesm/i18n/hebrew.mjs +1 -1
  16. package/fesm/i18n/hungarian.mjs +1 -1
  17. package/fesm/i18n/index.mjs +1 -1
  18. package/fesm/i18n/indonesian.mjs +1 -1
  19. package/fesm/i18n/italian.mjs +1 -1
  20. package/fesm/i18n/japanese.mjs +1 -1
  21. package/fesm/i18n/korean.mjs +1 -1
  22. package/fesm/i18n/malay.mjs +1 -1
  23. package/fesm/i18n/mongolian.mjs +1 -1
  24. package/fesm/i18n/norwegian.mjs +1 -1
  25. package/fesm/i18n/persian.mjs +1 -1
  26. package/fesm/i18n/polish.mjs +1 -1
  27. package/fesm/i18n/portuguese.mjs +1 -1
  28. package/fesm/i18n/romanian.mjs +1 -1
  29. package/fesm/i18n/russian.mjs +1 -1
  30. package/fesm/i18n/simplified-chinese.mjs +1 -1
  31. package/fesm/i18n/slovak.mjs +1 -1
  32. package/fesm/i18n/slovenian.mjs +1 -1
  33. package/fesm/i18n/spanish.mjs +1 -1
  34. package/fesm/i18n/swedish.mjs +1 -1
  35. package/fesm/i18n/tajik.mjs +1 -1
  36. package/fesm/i18n/thai.mjs +1 -1
  37. package/fesm/i18n/traditional-chinese.mjs +1 -1
  38. package/fesm/i18n/turkish.mjs +1 -1
  39. package/fesm/survey-creator-core.i18n.mjs +1 -1
  40. package/fesm/survey-creator-core.mjs +3 -3
  41. package/fesm/themes/index.mjs +1 -1
  42. package/fesm/ui-preset-editor.mjs +2 -2
  43. package/fesm/ui-presets/index.mjs +1 -1
  44. package/fonts.fontless.css +1 -1
  45. package/fonts.fontless.min.css +1 -1
  46. package/i18n/arabic.js +1 -1
  47. package/i18n/arabic.min.js +1 -1
  48. package/i18n/bulgarian.js +1 -1
  49. package/i18n/bulgarian.min.js +1 -1
  50. package/i18n/burmese.js +1 -1
  51. package/i18n/burmese.min.js +1 -1
  52. package/i18n/catalan.js +1 -1
  53. package/i18n/catalan.min.js +1 -1
  54. package/i18n/croatian.js +1 -1
  55. package/i18n/croatian.min.js +1 -1
  56. package/i18n/czech.js +1 -1
  57. package/i18n/czech.min.js +1 -1
  58. package/i18n/danish.js +1 -1
  59. package/i18n/danish.min.js +1 -1
  60. package/i18n/dutch.js +1 -1
  61. package/i18n/dutch.min.js +1 -1
  62. package/i18n/english.js +1 -1
  63. package/i18n/english.min.js +1 -1
  64. package/i18n/finnish.js +1 -1
  65. package/i18n/finnish.min.js +1 -1
  66. package/i18n/french.js +1 -1
  67. package/i18n/french.min.js +1 -1
  68. package/i18n/german.js +1 -1
  69. package/i18n/german.min.js +1 -1
  70. package/i18n/greek.js +1 -1
  71. package/i18n/greek.min.js +1 -1
  72. package/i18n/haitian-creole.js +1 -1
  73. package/i18n/haitian-creole.min.js +1 -1
  74. package/i18n/hebrew.js +1 -1
  75. package/i18n/hebrew.min.js +1 -1
  76. package/i18n/hungarian.js +1 -1
  77. package/i18n/hungarian.min.js +1 -1
  78. package/i18n/index.js +1 -1
  79. package/i18n/index.min.js +1 -1
  80. package/i18n/indonesian.js +1 -1
  81. package/i18n/indonesian.min.js +1 -1
  82. package/i18n/italian.js +1 -1
  83. package/i18n/italian.min.js +1 -1
  84. package/i18n/japanese.js +1 -1
  85. package/i18n/japanese.min.js +1 -1
  86. package/i18n/korean.js +1 -1
  87. package/i18n/korean.min.js +1 -1
  88. package/i18n/malay.js +1 -1
  89. package/i18n/malay.min.js +1 -1
  90. package/i18n/mongolian.js +1 -1
  91. package/i18n/mongolian.min.js +1 -1
  92. package/i18n/norwegian.js +1 -1
  93. package/i18n/norwegian.min.js +1 -1
  94. package/i18n/persian.js +1 -1
  95. package/i18n/persian.min.js +1 -1
  96. package/i18n/polish.js +1 -1
  97. package/i18n/polish.min.js +1 -1
  98. package/i18n/portuguese.js +1 -1
  99. package/i18n/portuguese.min.js +1 -1
  100. package/i18n/romanian.js +1 -1
  101. package/i18n/romanian.min.js +1 -1
  102. package/i18n/russian.js +1 -1
  103. package/i18n/russian.min.js +1 -1
  104. package/i18n/simplified-chinese.js +1 -1
  105. package/i18n/simplified-chinese.min.js +1 -1
  106. package/i18n/slovak.js +1 -1
  107. package/i18n/slovak.min.js +1 -1
  108. package/i18n/slovenian.js +1 -1
  109. package/i18n/slovenian.min.js +1 -1
  110. package/i18n/spanish.js +1 -1
  111. package/i18n/spanish.min.js +1 -1
  112. package/i18n/swedish.js +1 -1
  113. package/i18n/swedish.min.js +1 -1
  114. package/i18n/tajik.js +1 -1
  115. package/i18n/tajik.min.js +1 -1
  116. package/i18n/thai.js +1 -1
  117. package/i18n/thai.min.js +1 -1
  118. package/i18n/traditional-chinese.js +1 -1
  119. package/i18n/traditional-chinese.min.js +1 -1
  120. package/i18n/turkish.js +1 -1
  121. package/i18n/turkish.min.js +1 -1
  122. package/package.json +2 -2
  123. package/survey-creator-core.css +46 -46
  124. package/survey-creator-core.fontless.css +45 -45
  125. package/survey-creator-core.fontless.min.css +1 -1
  126. package/survey-creator-core.i18n.js +1 -1
  127. package/survey-creator-core.i18n.min.js +1 -1
  128. package/survey-creator-core.js +3 -3
  129. package/survey-creator-core.min.css +2 -2
  130. package/survey-creator-core.min.js +2 -2
  131. package/themes/default-contrast.js +1 -1
  132. package/themes/default-contrast.min.js +1 -1
  133. package/themes/default-dark.js +1 -1
  134. package/themes/default-dark.min.js +1 -1
  135. package/themes/default-light.js +1 -1
  136. package/themes/default-light.min.js +1 -1
  137. package/themes/index.js +1 -1
  138. package/themes/index.min.js +1 -1
  139. package/themes/sc2020.js +1 -1
  140. package/themes/sc2020.min.js +1 -1
  141. package/themes/test.js +1 -1
  142. package/themes/test.min.js +1 -1
  143. package/ui-preset-editor.css +1 -1
  144. package/ui-preset-editor.js +2 -2
  145. package/ui-preset-editor.min.css +1 -1
  146. package/ui-preset-editor.min.js +2 -2
  147. package/ui-presets/advanced.js +1 -1
  148. package/ui-presets/advanced.min.js +1 -1
  149. package/ui-presets/basic.js +1 -1
  150. package/ui-presets/basic.min.js +1 -1
  151. package/ui-presets/expert.js +1 -1
  152. package/ui-presets/expert.min.js +1 -1
  153. package/ui-presets/index.js +1 -1
  154. package/ui-presets/index.min.js +1 -1
@@ -1,7 +1,7 @@
1
1
  /*!
2
- * SurveyJS Creator v2.5.26
2
+ * SurveyJS Creator v2.5.27
3
3
  * (c) 2015-2026 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * Github: https://github.com/surveyjs/survey-creator
5
5
  * License: https://surveyjs.io/Licenses#SurveyCreator
6
6
  */
7
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("survey-core"),require("survey-creator-core")):"function"==typeof define&&define.amd?define(["exports","survey-core","survey-creator-core"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SurveyCreatorUIPresetEditorCore={},e.Survey,e.SurveyCreatorCore)}(this,function(e,t,o){"use strict";function n(e,n){var i=new t.LocalizableString(void 0,!1);i.defaultValue=n.title;var s=new t.LocalizableString(void 0,!1);s.defaultValue=n.message;var r=new o.ComponentContainerModel;r.elements=[{componentName:"sv-string-viewer",componentData:{locStr:i,locString:i,model:i,textClass:"svc-creator-confirm-dialog__title"}},{componentName:"sv-string-viewer",componentData:{locStr:s,locString:s,model:s,textClass:"svc-creator-confirm-dialog__message"}}],r.cssClass="svc-creator-confirm-dialog__title-container";var a="svc-creator-confirm-dialog__icon"+("danger"===n.category?" svc-creator-confirm-dialog__icon--danger":""),l=[{componentName:"sv-svg-icon",componentData:{iconName:n.iconName,size:"auto",className:a,class:a,partCss:a}},{componentName:"svc-component-container",componentData:{model:r}}],u=new o.ComponentContainerModel;u.elements=l,u.cssClass="svc-creator-confirm-dialog__content-container";var p=t.settings.showDialog({componentName:"svc-component-container",data:{model:u},onApply:function(){return n.onApply()},onCancel:function(){return n.onCancel()},cssClass:"sps-popup svc-creator-popup svc-creator-confirm-dialog",displayMode:"popup",showCloseButton:n.showCloseButton},e.rootElement),c=p.footerToolbar.cssClasses;c.item="sps-btn",p.footerToolbar.cssClasses=c;var d=p.footerToolbar.getActionById("apply"),m=p.footerToolbar.getActionById("cancel");return d.title=n.applyText,d.innerCss="danger"===n.category?"sps-btn--secondary-alert":"sps-btn--primary-neutral",m.title=n.cancelText,m.innerCss="sps-btn--secondary-neutral",p}var i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])},i(e,t)};function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}var r=function(){return r=Object.assign||function(e){for(var t,o=1,n=arguments.length;o<n;o++)for(var i in t=arguments[o])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)};function a(e,t,o){if(o||2===arguments.length)for(var n,i=0,s=t.length;i<s;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var l=function(){function e(e){this.preset=e,this.children=[],this.notifyCallback=function(e){}}return Object.defineProperty(e.prototype,"navigationPanelName",{get:function(){return this.path+"_navigation"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSettingUp",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"path",{get:function(){return this.preset.getPath()},enumerable:!1,configurable:!0}),e.prototype.getJsonPath=function(e){return this.path},Object.defineProperty(e.prototype,"fullPath",{get:function(){var e=this.parent?this.parent.fullPath:"";return this.path&&e&&(e+="_"),e+this.path},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageName",{get:function(){return"page_"+this.fullPath},enumerable:!1,configurable:!0}),e.prototype.getPageTitle=function(e){return e.getPageByName(this.pageName).title},e.prototype.getPageShortTitle=function(e){return e.getPageByName(this.pageName).navigationTitle},Object.defineProperty(e.prototype,"mainPanelName",{get:function(){return this.path+"_mainPanel"},enumerable:!1,configurable:!0}),e.prototype.getMainElementNames=function(){return[this.mainPanelName]},e.prototype.getMainPanelName=function(){return this.mainPanelName},e.prototype.getCustomQuestionCssSuffix=function(e){return""},e.prototype.createPages=function(){var e=[],t=this.createMainPage();return t&&e.push(t),this.children.forEach(function(t){var o=t.createPages();Array.isArray(o)&&o.forEach(function(t){return e.push(t)})}),e},Object.defineProperty(e.prototype,"questionNames",{get:function(){return[]},enumerable:!1,configurable:!0}),e.prototype.validate=function(e){if(!this.validateCore(e))return!1;for(var t=0;t<this.children.length;t++)if(!this.children[t].validate(e))return!1;return!0},e.prototype.validateCore=function(e){return!0},e.prototype.createMainPage=function(){var e=this.createMainPageCore();return e&&(e.name=this.pageName),e},e.prototype.getBoolVisibleIf=function(e,t){return void 0===t&&(t=!0),"{"+e+"}="+(t?"true":"false")},e.prototype.getTextVisibleIf=function(e,t){return"{"+e+"}='"+t+"'"},e.prototype.getNotEmptyVisibleIf=function(e){return"{"+e+"} notempty"},e.prototype.createMainPageCore=function(){},e.prototype.getNavigationElementName=function(){return this.navigationPanelName},e.prototype.getJsonValue=function(e,t,o){var n=e.getPageByName(this.pageName),i=n&&n.isVisible?this.getJsonValueCore(e,t,o):void 0,s=!!i,r=s?i:{};return this.children.forEach(function(o){var n=o.getJsonValue(e,t);n&&(s=!0,r[o.getJsonPath(e)]=n)}),s?r:void 0},e.prototype.getDefaultJsonValue=function(e){var t=this.getDefaultJsonValueCore(e);return this.children.forEach(function(o){return t[o.path]=o.getDefaultJsonValueCore(e)}),t},e.prototype.setJsonLocalizationStrings=function(e,t){this.setJsonLocalizationStringsCore(e,t),this.children.forEach(function(o){return o.setJsonLocalizationStrings(e,t)})},e.prototype.updateJsonLocalizationStrings=function(e){this.updateJsonLocalizationStringsCore(e),this.children.forEach(function(t){return t.updateJsonLocalizationStrings(e)})},e.prototype.dispose=function(){this.disposeCore(),this.children.forEach(function(e){return e.dispose()})},e.prototype.setupQuestions=function(e,t){this.setupQuestionsCore(e,t),this.children.forEach(function(o){o.setupQuestions(e,t)})},e.prototype.resetToDefaults=function(e,t){void 0===t&&(t=!0),this.restoreValuesFromDefault(e),this.notifyCallback(this.getPageTitle(e)+" "+o.getLocString("presets.editor.resoredToDefault")),this.children.forEach(function(o){o.resetToDefaults(e,t)})},e.prototype.setupOnCurrentPage=function(e,t,o){this.setupOnCurrentPageCore(e,t,o),this.children.forEach(function(n){n.setupOnCurrentPage(e,t,o)})},e.prototype.updateOnValueChanged=function(e,t){this.updateOnValueChangedCore(e,t),this.children.forEach(function(o){o.updateOnValueChanged(e,t)})},e.prototype.updateOnMatrixDetailPanelVisibleChanged=function(e,t,o){this.updateOnMatrixDetailPanelVisibleChangedCore(e,t,o),this.children.forEach(function(n){n.updateOnMatrixDetailPanelVisibleChanged(e,t,o)})},e.prototype.onGetMatrixRowActions=function(e,t,o){this.onGetMatrixRowActionsCore(e,t,o),this.children.forEach(function(n){n.onGetMatrixRowActions(e,t,o)})},e.prototype.onGetQuestionTitleActions=function(e,t,o){},e.prototype.onGetPanelTitleActions=function(e,t,o){},e.prototype.onMatrixRowDragOver=function(e,t,o){},e.prototype.onMatrixRowRemoving=function(e,t,o){},e.prototype.onMatrixRowAdded=function(e,t,o){},e.prototype.onMatrixCellValueChanged=function(e,t,o){},e.prototype.setupQuestionsValue=function(e,t,o){this.setupQuestionsValueCore(e,t,o),this.saveValuesAsDefault(e),this.children.forEach(function(n){n.setupQuestionsValue(e,t?t[n.path]:void 0,o)})},e.prototype.onLocaleChanged=function(e,t,o){this.onLocaleChangedCore(e,t,o),this.children.forEach(function(n){n.setupQuestionsValue(e,t?t[n.path]:void 0,o)})},e.prototype.saveValuesAsDefault=function(e){this.questionNames.forEach(function(t){return e.getQuestionByName(t).defaultValue=e.getValue(t)&&JSON.parse(JSON.stringify(e.getValue(t)))})},e.prototype.restoreValuesFromDefault=function(e){this.questionNames.forEach(function(t){return e.getQuestionByName(t).value=e.getQuestionByName(t).defaultValue&&JSON.parse(JSON.stringify(e.getQuestionByName(t).defaultValue))})},e.prototype.setupQuestionsCore=function(e,t){},e.prototype.resetToDefaultsCore=function(e){},e.prototype.setupQuestionsValueCore=function(e,t,o){},e.prototype.onLocaleChangedCore=function(e,t,o){},e.prototype.getJsonValueCore=function(e,t,o){},e.prototype.getDefaultJsonValueCore=function(e){return{}},e.prototype.setJsonLocalizationStringsCore=function(e,t){},e.prototype.updateJsonLocalizationStringsCore=function(e){},e.prototype.disposeCore=function(){},e.prototype.setupOnCurrentPageCore=function(e,t,o){},e.prototype.updateOnValueChangedCore=function(e,t){},e.prototype.updateOnMatrixDetailPanelVisibleChangedCore=function(e,t,o){},e.prototype.onGetMatrixRowActionsCore=function(e,t,o){},e.prototype.copyJson=function(e){return t.Helpers.getUnbindValue(e)},e.updateModifiedText=function(t,n,i){if(i&&n){var s=o.editorLocalization.presetStrings;o.editorLocalization.presetStrings=void 0,n!==o.editorLocalization.getString(i)&&e.saveTextInLocStrs(t,n,i),o.editorLocalization.presetStrings=s}},e.saveTextInLocStrs=function(e,t,o){for(var n=o.split("."),i=0;i<n.length-1;i++){var s=n[i];e[s]||(e[s]={}),e=e[s]}e[n[n.length-1]]=t},e}(),u={root:"sps-root-modern",container:"sps-container-modern",header:"sps-title sps-container-modern__title",body:"sps-body",bodyEmpty:"sps-body sps-body--empty",footer:"sps-footer sps-body__footer sps-clearfix",title:"",description:"",logo:"sps-logo",logoImage:"sps-logo__image",headerText:"sps-header__text",navigationButton:"",bodyNavigationButton:"",completedPage:"sps-completedpage",navigation:{complete:"sps-btn sps-btn--primary-brand sps-footer__complete-btn",prev:"sps-btn sps-btn--secondary-brand sps-footer__prev-btn",next:"sps-btn sps-btn--primary-brand sps-footer__next-btn",start:"sps-btn sps-footer__start-btn",preview:"sps-btn sps-footer__preview-btn",edit:"sps-btn sps-footer__edit-btn"},list:JSON.parse(JSON.stringify(o.listComponentCss)),panel:{withFrame:"sps-panel--with-frame",nested:"sps-panel--nested",expandableAnimating:"",header:"sps-panel__header",title:"sps-title sps-panel__title",titleBar:"sd-action-title-bar sps-action-title-bar",contentEnter:"sps-panel__content--enter",contentLeave:"sps-panel__content--leave",titleExpandable:"sps-panel__title--expandable",titleExpanded:"sps-panel__title--expanded",titleCollapsed:"sps-panel__title--collapsed",titleOnError:"sps-panel__title--error",description:"sps-description sps-panel__description",container:"sps-panel sps-row__panel",content:"sps-panel__content",icon:"sps-panel__icon",iconExpanded:"sps-panel__icon--expanded",footer:"sps-panel__footer",requiredMark:"sps-panel__required-text",collapsed:"sps-panel--collapsed",expanded:"sps-panel--expanded"},paneldynamic:{nested:"",mainRoot:"sps-question sps-row__question",root:"sps-paneldynamic",navigation:"sps-paneldynamic__navigation",title:"sps-title sps-question__title",button:"sps-action-button sps-action-button--text",buttonRemove:"sps-action-button--danger",buttonAdd:"sps-paneldynamic__add-btn",panelsContainer:"",panelWrapper:"sps-paneldynamic__panel-wrapper",panelWrapperList:"",progressTop:"sps-paneldynamic__progress sps-paneldynamic__progress--top",progressBottom:"sps-paneldynamic__progress sps-paneldynamic__progress--bottom",buttonPrev:"sps-paneldynamic__prev-btn",buttonNext:"sps-paneldynamic__next-btn",progressContainer:"sps-paneldynamic__progress-container",progress:"sps-progress",progressBar:"sps-progress__bar",progressText:"sps-paneldynamic__progress-text",panelFooter:"sps-panel__footer",separator:"sps-paneldynamic__separator",footer:"sps-paneldynamic__footer",footerButtonsContainer:"sps-paneldynamic__buttons-container"},progress:"sps-progress sps-body__progress",progressBar:"sps-progress__bar",progressText:"sps-progress__text",progressTextInBar:"sps-hidden",page:{root:"sps-page sps-body__page",title:"sps-title sps-page__title",description:"sps-description sps-page__description"},pageTitle:"sps-title sps-page__title",pageDescription:"sps-description sps-page__description",row:"sps-row sps-clearfix",rowEnter:"sps-row--enter",rowLeave:"sps-row--leave",rowDelayedEnter:"sps-row--delayed-fade-in",rowMultiple:"sps-row--multiple",question:{withFrame:"sps-question--with-frame",nested:"sps-question--nested",mainRoot:"sps-question sps-row__question",flowRoot:"sps-question sps-row__question sps-row__question--flow",asCell:"sps-table__cell",header:"sps-question__header",headerLeft:"sps-question__header--location--left",headerTop:"sps-question__header--location--top",headerBottom:"sps-question__header--location--bottom",content:"sps-question__content",contentLeft:"sps-question__content--left",titleLeftRoot:"sps-question--location--left",titleOnAnswer:"sps-question__title--answer",titleOnError:"sps-question__title--error",title:"sps-title sps-question__title",titleBar:"sd-action-title-bar sps-action-title-bar",requiredMark:"sps-question__required-text",number:"sps-question__num",description:"sps-description sps-question__description",descriptionUnderInput:"sps-question__description--under",comment:"sps-comment",required:"sps-question--required",titleRequired:"sps-question__title--required",indent:0,footer:"sps-question__footer",formGroup:"sps-question__form-group",hasError:"",readOnly:"sd-question--readonly sps-question--disabled",confirmDialog:"sps-popup--confirm sv-popup--confirm svc-creator-popup",errorsContainerBottom:"sps-question__erbox--below-question"},checkbox:{root:"sps-selectbase",item:"sps-item sps-checkbox sps-selectbase__item",itemSelectAll:"sps-checkbox--selectall",itemNone:"sps-checkbox--none",itemReadOnly:"sps-item--disabled sps-checkbox--disabled",itemChecked:"sps-checkbox--checked",itemHover:"sps-checkbox--allowhover",itemInline:"sps-selectbase__item--inline",label:"sps-selectbase__label",itemSvgIconId:"#icon-check-16x16",labelChecked:"",itemControl:"sps-checkbox__control",itemDecorator:"sps-checkbox__svg",controlLabel:"sps-checkbox__caption",materialDecorator:"sps-checkbox__rectangle",other:"sps-comment sps-question__other",column:"sps-selectbase__column"},radiogroup:{root:"sps-selectbase",item:"sps-item sps-radio sps-selectbase__item",itemInline:"sps-selectbase__item--inline",label:"sps-selectbase__label",labelChecked:"",itemReadOnly:"sps-item--disabled sps-radio--disabled",itemChecked:"sps-radio--checked",itemHover:"sps-radio--allowhover",itemControl:"sps-visuallyhidden sps-item__control",itemDecorator:"sps-item__svg sps-radio__svg",controlLabel:"sps-item__control-label",materialDecorator:"sps-item__decorator sps-radio__decorator",other:"sps-comment sps-question__other",clearButton:"sps-btn sps-selectbase__clear-btn",column:"sps-selectbase__column"},boolean:{mainRoot:"sps-question sps-row__question sps-question--boolean",rootCheckbox:"sps-selectbase",checkboxItem:"sps-checkbox",checkboxItemChecked:"sps-checkbox--checked",checkboxitemIndeterminate:"sps-checkbox--indeterminate",checkboxItemReadOnly:"sps-checkbox--disabled",svgIconId:"#icon-v2check",checkboxLabel:"sps-selectbase__label",controlCheckbox:"sps-checkbox__control",checkboxControlLabel:"sps-checkbox__caption",checkboxItemDecorator:"sps-checkbox__svg",checkboxMaterialDecorator:"sps-checkbox__rectangle"},text:{root:"sps-input sps-text",controlReadOnly:"sps-input--readonly",small:"sps-row__question--small",content:"sps-question__content sps-text__content",remainingCharacterCounter:"sps-remaining-character-counter",onError:"sps-input--error"},comment:{root:"sps-input sps-comment",content:"sps-question__content sps-comment__content",remainingCharacterCounter:"sps-remaining-character-counter",small:"sps-row__question--small",onError:"sps-input--error"},dropdown:{root:"sps-selectbase",popup:"sps-dropdown-popup svc-creator-popup",small:"sps-row__question--small sd-row__question--small",control:"sps-input sps-dropdown",controlEmpty:"sps-dropdown--empty sd-dropdown--empty",controlValue:"sps-dropdown__value",filterStringInput:"sd-dropdown__filter-string-input sps-dropdown__filter-string-input",other:"sps-comment sps-question__other",onError:"sps-input--error",selectWrapper:"sv-dropdown_select-wrapper sps-dropdown_select-wrapper",chevronButtonIconId:"icon-chevron",cleanButton:"sps-dropdown__clean-button sps-input__edit-button",controlReadOnly:"sps-input--readonly sd-input--disabled sd-input--readonly",hintPrefix:"sps-dropdown__hint-prefix sd-dropdown__hint-prefix",hintSuffix:"sps-dropdown__hint-suffix sd-dropdown__hint-suffix"},tagbox:{cleanItemButton:"sd-tagbox-item_clean-button sps-tagbox-item_clean-button",cleanItemButtonSvg:"sd-tagbox-item_clean-button-svg sps-tagbox-item_clean-button-svg",control:"sd-input sd-tagbox sd-dropdown sps-tagbox sps-dropdown",controlValue:"sd-tagbox__value sd-dropdown__value sps-tagbox__value",filterStringInput:"sd-dropdown__filter-string-input sps-dropdown__filter-string-input"},matrix:{tableWrapper:"sps-matrix sps-table-wrapper",root:"sps-table",rowError:"sps-matrix__row--error",cell:"sps-table__cell sps-matrix__cell",headerCell:"sps-table__cell sps-table__cell--header",label:"sps-item sps-radio sps-matrix__label",itemValue:"sps-visuallyhidden sps-item__control sps-radio__control",itemChecked:"sps-radio--checked",itemReadOnly:"sps-item--disabled sps-radio--disabled",itemHover:"sps-radio--allowhover",materialDecorator:"sps-item__decorator sps-radio__decorator",itemDecorator:"sps-item__svg sps-radio__svg",cellText:"sps-matrix__text",cellTextSelected:"sps-matrix__text--checked",cellTextReadOnly:"sps-matrix__text--disabled"},matrixdropdown:{tableWrapper:"sps-table-wrapper",root:"sps-table",cell:"sps-table__cell",headerCell:"sps-table__cell sps-table__cell--header",emptyCell:"sps-table__cell--empty",rowEnter:"sps-table__row--enter",rowLeave:"sps-table__row--leave"},matrixdynamic:{mainRoot:"sps-question sps-question--matrixdynamic sd-element sd-question sd-row__question sd-element--complex sd-question--complex sd-question--table",tableWrapper:"sps-table-wrapper",root:"sps-table sps-matrixdynamic",content:"sps-matrixdynamic__content sps-text__content",cell:"sps-table__cell",row:"sps-table__row",rowDisabled:"sps-table__row-disabled",rowReadOnly:"sps-table__row-readonly",headerCell:"sps-table__cell sps-table__cell--header",button:"sps-btn",detailRow:"sps-table__row sps-table__row--detail",detailButton:"sps-table__cell--detail-button sps-action-button sps-action-button--icon",detailButtonExpanded:"sps-table__cell--detail-button--expanded",detailIcon:"sps-detail-panel__icon sps-action-button__icon",detailIconExpanded:"sps-detail-panel__icon--expanded",detailIconExpandedId:"icon-collapse-24x24",detailIconId:"icon-expand-24x24",detailPanelCell:"sps-table__cell sps-table__cell--detail-panel",actionsCell:"sps-table__cell sps-table__cell--actions",buttonAdd:"sps-matrixdynamic__add-btn sps-action-button sps-action-button--large",buttonRemove:"",iconAdd:"",iconRemove:"#icon-delete-24x24",dragElementDecorator:"sps-drag-element__svg",iconDragElement:"#icon-drag-24x24",iconDrag:"sps-matrixdynamic__drag-element",footer:"sps-matrixdynamic__footer",dragDropGhostPositionTop:"sps-matrixdynamic__drag-drop-ghost-position-top",dragDropGhostPositionBottom:"sps-matrixdynamic__drag-drop-ghost-position-bottom",noRowsSection:"sps-matrixdynamic__placeholder",noRowsText:"sps-matrixdynamic__placeholder-text",cellQuestionWrapper:"sps-table__question-wrapper",draggedRow:"sps-matrixdynamic__dragged-row",emptyCell:"sps-table__cell--empty",rowEmpty:"sps-table__row--empty",rowEnter:"sps-table__row--enter",rowLeave:"sps-table__row--leave"},actionBar:{root:"sps-action-bar",item:"sps-action-button",itemPressed:"sps-action-button--pressed",itemAsIcon:"sps-action-button--icon",itemIcon:"sps-action-button__icon",itemTitle:"sps-action-button__title"}},p=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.defaultIcon="square-dashed-24x24",t}return s(n,e),Object.defineProperty(n.prototype,"nameItems",{get:function(){return this.path+"_items"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"nameMatrix",{get:function(){return this.fullPath+"_matrix"},enumerable:!1,configurable:!0}),n.prototype.hasIcon=function(e){return!1},n.prototype.getMainElementNames=function(){return[this.nameItems]},Object.defineProperty(n.prototype,"iconList",{get:function(){return Object.keys(t.SvgRegistry.icons).map(function(e){return"icon-"+e})},enumerable:!1,configurable:!0}),n.prototype.getMatrixKeyColumnName=function(e){return"name"},n.prototype.getDefaultItems=function(e){return this.defaultItems},n.prototype.getDefaultItem=function(e,t){var o=this.getMatrixKeyColumnName(e);return this.getDefaultItems(e).filter(function(e){return e[o]==t})[0]},n.prototype.updateOnValueChangedCore=function(e,t){if(this.needToSetActions(t)){var o=e.getQuestionByName(t);this.updateMatrixRowActions(e,o)}},n.prototype.updateMatrixRowActions=function(e,t){var o=this;t.renderedTable.rows.forEach(function(e){var n,i,s;if(e.row){var r=null===(i=null===(n=e.cells[1])||void 0===n?void 0:n.item)||void 0===i?void 0:i.value.actions;o.updateRowActions(t,e.row,r);var a=null===(s=e.cells[e.cells.length-1].item)||void 0===s?void 0:s.value.actions;o.updateRowActions(t,e.row,a)}})},n.prototype.updateRowActions=function(e,t,o){var n=this;if(o){var i=this.getMatrixKeyColumnName(e);if(e.value){var s=e.value.filter(function(e){var o;return(null===(o=t.value)||void 0===o?void 0:o[i])==(null==e?void 0:e[i])})[0];s&&o.forEach(function(o){return n.updateRowAction(e,t,s,i,o)})}}},n.prototype.updateRowAction=function(e,o,n,i,s){if("icon-action"==s.id&&(s.iconName=n.iconName||this.defaultIcon),"reset-to-default"==s.id){var r=this.getDefaultItem(e,n[i]);if(!r)return;var a={};Object.keys(n).forEach(function(e){return a[e]=r[e]}),s.enabled=!t.Helpers.isTwoValueEquals(n,a)}},n.prototype.createResetAction=function(e,t,n){return{id:"reset-to-default",iconName:"icon-reset",tooltip:o.getLocString("presets.items.restoreToDefault"),location:"end",visibleIndex:15,action:n}},n.prototype.createEditAction=function(e,t,n,i){var s=this;return{id:"edit-item",iconName:"icon-edit",tooltip:o.getLocString("presets.items.edit"),location:"end",visibleIndex:13,action:function(){s.editItem(e,t,n,i)}}},n.prototype.createIconAction=function(e,t){return void 0===t&&(t="sps-matrixdynamic__row-icon"),{id:"icon-action",iconName:e,innerCss:t,location:"start",enabled:!1}},n.prototype.setupStandardActions=function(e,n,i,s,r){e.forEach(function(e){"show-detail"==e.id&&(e.location="end",e.iconName="icon-expand-24x24",e.title=new t.ComputedUpdater(function(){return i.isDetailPanelShowing?o.getLocString("presets.items.collapse"):o.getLocString("presets.items.expand")}),e.tooltip=o.getLocString("presets.items.expand"),e.visibleIndex=10,e.visible=s),"remove-row"==e.id&&(e.visibleIndex=20,e.component="sv-action-bar-item",e.action=function(){return n.removeRowUI(i)},e.iconName=r?"icon-add_24x24":"icon-remove_24x24",e.tooltip=r?o.getLocString("presets.items.add"):o.getLocString("presets.items.delete"))})},n.prototype.editItem=function(e,n,i,s,r){var a,l,u=this,p=this.getMatrixKeyColumnName(i),c={id:"reset-to-default",title:o.getLocString("presets.editor.resetToDefault"),css:"sps-action--grow",innerCss:"sps-btn sps-btn--secondary-alert",visibleIndex:15,action:function(e){var t=u.getDefaultItem(i,a.getValue(p));a.data=t,l.enabled=!1,u.notifyCallback(o.getLocString("presets.editor.itemRestoredToDefault"))}};l=new t.Action(c),a=this.showDetailPanelInPopup(i,s,e.rootElement,{actions:[l],title:null==r?void 0:r.description,removeOnCancel:null==r?void 0:r.isNew}),l.enabled=!t.Helpers.isTwoValueEquals(a.data,this.getDefaultItem(i,a.getValue(p))),a.onValueChanged.add(function(){return l.enabled=!0});var d=a.getQuestionByName(p);this.getDefaultItem(i,d.value)&&(d.readOnly=!0)},n.prototype.resetItem=function(e,t,n){var i=n.getValue("name"),s=this.getDefaultItem(t,i);if(s){var r=t.value,a=r.filter(function(e){return e.name==i})[0];Object.keys(a).forEach(function(e){a[e]=s[e]}),t.value=r}this.notifyCallback(o.getLocString("presets.editor.itemRestoredToDefault"))},n.prototype.restoreItems=function(e,t,o){var n=t.value[o],i=e.value?a([],e.value,!0):[];i.push(n),e.value=i},n.prototype.getMatrix=function(e){return e.getQuestionByName(this.nameMatrix)},n.prototype.isItemsMatrix=function(e){return e===this.nameMatrix},n.prototype.needToSetActions=function(e){return this.isItemsMatrix(e)},n.prototype.onGetMatrixRowActionsCore=function(e,t,o){var n,i,s=this;if(this.needToSetActions(o.question.name)){var r=o.question,a=r.detailElements.filter(function(e){return e.visible}).length>0;if(this.hasIcon(o.question.name)){var l=this.getMatrixKeyColumnName(o.question),u=(null===(i=null===(n=r.value)||void 0===n?void 0:n.filter(function(e){return e[l]==o.row.getValue(l)})[0])||void 0===i?void 0:i.iconName)||this.defaultIcon;o.actions.push(this.createIconAction(u))}var p=this.createResetAction(e,o.row,function(t){s.resetItem(e,r,o.row),t.enabled=!1});o.actions.push(p),o.actions.push(this.createEditAction(e,t,r,o.row)),this.setupStandardActions(o.actions,r,o.row,a,r.name==this.nameMatrix),this.updateRowActions(r,o.row,o.actions)}},n.prototype.onMatrixRowDragOver=function(e,t,o){this.isItemsMatrix(o.fromMatrix.name)&&this.isItemsMatrix(o.toMatrix.name)&&(o.allow=!0)},n.prototype.onMatrixRowRemoving=function(e,t,o){if(this.isItemsMatrix(o.question.name)&&o.question.name!=this.nameMatrix){var n=o.question.value[o.rowIndex],i=this.getMatrix(e),s=i.value?a([],i.value,!0):[];s.push(n),i.value=s}},n.prototype.getExistingKeys=function(e,t){var o=e.getQuestionByName(this.nameItems).value||[],n=e.getQuestionByName(this.nameMatrix).value||[];return a(a([],o,!0),n,!0)},n.prototype.getDefaultValueForRow=function(e,t,n){return o.SurveyHelper.getNewName(this.getExistingKeys(e,n).map(function(e){return e[n]}).filter(function(e){return!!e}).map(function(e){return{name:e}}),n)},n.prototype.setDefaultValueForRow=function(e,t,o){var n=this.getMatrixKeyColumnName(t),i=this.getDefaultValueForRow(e,t,n);o.getQuestionByName(n).value=i,o.getQuestionByName("title").value=i},n.prototype.onMatrixRowAdded=function(e,t,n){var i,s;this.isItemsMatrix(n.question.name)&&(this.setDefaultValueForRow(e,n.question,n.row),this.editItem(e,t,n.question,n.row,{description:o.getLocString("presets.items.newItem")+" "+((null===(s=null===(i=n.question.data)||void 0===i?void 0:i.value)||void 0===s?void 0:s.title)||this.getPageShortTitle(e)),isNew:!0}))},n.prototype.onMatrixCellValueChanged=function(e,t,o){if(this.needToSetActions(o.question.name)){var n=o.question.renderedTable.rows.find(function(e){return e.row==o.row});if(!n)return;var i=n.cells[n.cells.length-1].item.value.actions;if(!i)return;this.updateRowActions(o.question,o.row,i)}},n.prototype.onDetailPanelInPopupApply=function(e,t,o){return!0},n.prototype.applyDetailPanelInPopup=function(e,t,o,n){if(e.validate()){var i={};e.getAllQuestions().forEach(function(e){e.visible&&(i[e.name]=e.isEmpty()&&e.isDescendantOf("checkbox")?[]:e.value)});var s=a([],t.value,!0),l=r(r({},t.value[n]),i);return s[n]=l,this.onDetailPanelInPopupApply(i,t,o)&&(t.value=s),this.updateMatrixRowActions(t.survey,t),!0}return!1},n.prototype.showDetailPanelInPopup=function(e,n,i,s){var r,a,l=this,p=e.visibleRows.findIndex(function(e){return e===n}),c=e.value[p],d=new t.SurveyModel({elements:e.toJSON().detailElements});if(d.fitToContainer=!1,d.showNavigationButtons=!1,d.data=c,d.css=u,d.enterKeyAction="loseFocus",d.questionErrorLocation="bottom",t.settings.showDialog){var m=null===(a=t.settings.showDialog)||void 0===a?void 0:a.call(t.settings,{componentName:"survey",data:{survey:d,model:d},onApply:function(){return l.applyDetailPanelInPopup(d,e,n,p)},onCancel:function(){return s.removeOnCancel&&e.removeRowUI(n),!0},cssClass:"sps-popup svc-property-editor svc-creator-popup",title:s.title||o.getLocString("presets.editor.edit"),displayMode:"popup"},i);if(d.getAllQuestions().filter(function(e){return!e.startWithNewLine}).length>0&&(m.width="100%"),m.footerToolbar){var g=m.footerToolbar.cssClasses;g.item="sps-btn",m.footerToolbar.cssClasses=g,m.footerToolbar.getActionById("apply").innerCss="sps-btn--primary-brand",m.footerToolbar.getActionById("cancel").innerCss="sps-btn--secondary-brand",s.actions&&(r=m.footerToolbar.actions).unshift.apply(r,s.actions)}d.getAllPanels().forEach(function(e){return e.visible=!e.visible}),d.getAllQuestions().forEach(function(e){e.visible=!e.visible,e.isRequired&&(e.requiredErrorText=o.getLocString("presets.editor.required"))})}return d},n}(l),c={root:"sps-list__container",itemsContainer:"sps-list",itemsContainerFiltering:"sps-list--filtering",emptyContainer:"sps-list__empty-container",emptyText:"sps-list__empty-text",filter:"sps-list__filter",filterIcon:"sps-list__filter-icon",filterInput:"sps-list__input",searchClearButtonIcon:"sps-list__filter-clear-button",loadingIndicator:"sps-list__loading-indicator",item:"sps-list__item",itemSelected:"sps-list__item--selected",itemGroup:"sps-list__item--group",itemGroupSelected:"sps-list__item--group-selected",itemWithIcon:"sps-list__item--with-icon",itemDisabled:"sps-list__item--disabled",itemFocused:"sps-list__item--focused",itemHovered:"sps-list__item--hovered",itemTextWrap:"sps-list__item-text--wrap",itemIcon:"sps-list__item-icon",itemMarkerIcon:"sps-list-item__marker-icon",itemSeparator:"sps-list__item-separator",itemBody:"sps-list__item-body"},d=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return s(n,e),Object.defineProperty(n.prototype,"defaultCategoriesMap",{get:function(){return this.defaultCategories.reduce(function(e,t){return e[t.category]=t,e},{})},enumerable:!1,configurable:!0}),n.prototype.getDefaultItems=function(e){return(null==e?void 0:e.name)===this.nameCategories?this.defaultCategories:this.defaultItems},Object.defineProperty(n.prototype,"nameInnerMatrix",{get:function(){return"items"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"nameCategories",{get:function(){return this.fullPath+"_categories"},enumerable:!1,configurable:!0}),n.prototype.getMainElementNames=function(){return[this.nameCategories]},n.prototype.getMatrixKeyColumnName=function(e){return e.name===this.nameCategories?"category":"name"},Object.defineProperty(n.prototype,"questionNames",{get:function(){return[this.nameCategories]},enumerable:!1,configurable:!0}),n.prototype.setupCategoryActions=function(e,t,n,i,s){var r=this;s.forEach(function(t){"remove-row"==t.id&&(t.iconName="icon-delete_24x24",t.tooltip=o.getLocString("presets.items.delete"),t.innerCss="sps-action-button sps-action-button--icon sps-action-button--danger"),"reset-to-default"==t.id&&(t.action=function(){r.resetCategory(e,i)})})},n.prototype.ejectRowData=function(e,t,o){var n=e.value,i=e.visibleRows.indexOf(t),s=n[i];return o&&(n.splice(i,1),e.value=n),s},n.prototype.moveToCategory=function(e,t,o,n,i){void 0===i&&(i=!1);var s=this.ejectRowData(t,o,i),r=this.getQuestionCategories(e),a=r.value;return this.findOrCreateCategory(a,n)[this.nameInnerMatrix].push(s),r.value=a,r.visibleRows.find(function(e){return e.getValue("category")==n})},n.prototype.itemMenuCategoriesEnabled=function(e){return!0},n.prototype.setSubitemsToAction=function(e,t){e.setSubItems({items:t,cssClasses:c}),e.markerIconName="icon-chevronright-24x24"},n.prototype.getItemMenuActionsCore=function(e,n,i){var s=this,r=this.getQuestionCategories(e),a=r.value,l=[],u=n.name==this.nameMatrix,p=this.itemMenuCategoriesEnabled(e);if(u?p?l.push(new t.Action({id:"move-to",title:o.getLocString("presets.items.moveTo"),css:"sps-list__item--label",enabled:!1})):l.push(new t.Action({id:"restore-item",title:o.getLocString("presets.toolbox.addToToolbox"),action:function(){var e=n.visibleRows.indexOf(i);n.removeRow(e)}})):l.push(new t.Action({id:"remove-from",title:o.getLocString("presets.items.removeFrom").replace("{0}",n.title),action:function(){var e=n.visibleRows.indexOf(i);n.removeRow(e)}})),!p)return l;var c=a.filter(function(e){return(e[s.nameInnerMatrix]||[]).filter(function(e){var t;return e.name==(null===(t=i.value)||void 0===t?void 0:t.name)}).length>0})[0],d=a.filter(function(e){return e.category!=(null==c?void 0:c.category)}).map(function(o){return new t.Action({id:"to-"+o.category,title:o.title,action:function(){s.moveToCategory(e,n,i,o.category,!0)}})});if(u)l.push.apply(l,d);else{l.push(new t.Action({id:"categories",title:o.getLocString("presets.items.categoriesLabel"),css:"sps-list__item--label",enabled:!1,needSeparator:!0}));var m=new t.Action({id:"move-to-categories",title:o.getLocString("presets.items.moveToCategory")});this.setSubitemsToAction(m,d),l.push(m)}return l.push(new t.Action({id:"move-to-new-category",title:o.getLocString("presets.items.moveToNewCategory"),needSeparator:u,action:function(){var t=s.moveToCategory(e,n,i,s.getDefaultValueForRow(e,n,"category"),!0);s.editItem(e,null,r,t,{description:o.getLocString("presets.items.newCategory")+" "+s.getPageShortTitle(e),isNew:!0})}})),l},n.prototype.getItemMenuActions=function(e,n,i){var s=this,r=this.getItemMenuActionsCore(e,n,i);return this.getDefaultItem(n,i.value.name)||r.push(new t.Action({id:"remove-custom-item",title:o.getLocString("presets.toolbox.deleteCustomItem"),css:"sps-list__item--alert",needSeparator:!0,action:function(){s.ejectRowData(n,i,!0)}})),r},n.prototype.replaceRemoveAction=function(e,n,i,s){var r=this,a=s.filter(function(e){return"remove-row"==e.id})[0];if(a){a.visible=!1;var l=t.createDropdownActionModel({id:"context-menu",iconName:"more-circle-24x24",tooltip:o.getLocString("presets.items.more"),location:"end",visibleIndex:20},{items:[],showPointer:!1,verticalPosition:"bottom",horizontalPosition:"center",cssClass:"sps-popup-menu sps-popup-menu--context",cssClasses:c,searchEnabled:!1});l.popupModel.onVisibilityChanged.add(function(t,o){if(o.isVisible){var s=o.model.contentComponentData.model;s.actions=r.getItemMenuActions(e,n,i),s.flushUpdates()}}),s.push(l)}},n.prototype.getQuestionCategories=function(e){return e.getQuestionByName(this.nameCategories)},n.prototype.isItemsMatrix=function(t){return e.prototype.isItemsMatrix.call(this,t)||t===this.nameInnerMatrix},n.prototype.resetCategory=function(e,t){var n,i=this,s=t.getValue("category"),r=null===(n=this.defaultCategories.filter(function(e){return e.category==s})[0])||void 0===n?void 0:n[this.nameInnerMatrix];if(r){var a=this.getQuestionCategories(e),l=this.getMatrix(e),u=l.value||[],p=a.value,c=p.filter(function(e){return e.category==s})[0];c[this.nameInnerMatrix].forEach(function(e){r.some(function(t){return t.name==e.name})||u.push(e)}),c[this.nameInnerMatrix]=r,p.filter(function(e){return e.category!=s}).forEach(function(e){r.forEach(function(t){d(e[i.nameInnerMatrix])})}),d(u),l.value=u,a.value=p,this.notifyCallback(o.getLocString("presets.editor.categoryRestoredToDefault"))}function d(e){e&&r.forEach(function(t){var o=e.findIndex(function(e){return e.name==t.name});o>=0&&e.splice(o,1)})}},n.prototype.findOrCreateCategory=function(e,t){var o,n=e.filter(function(e){return e.category==t})[0];return n||((o={category:t||"general",title:t||"General"})[this.nameInnerMatrix]=[],n=o,e.push(n)),n},n.prototype.needToSetActions=function(e){return this.isItemsMatrix(e)||e===this.nameCategories},n.prototype.onGetMatrixRowActionsCore=function(t,o,n){e.prototype.onGetMatrixRowActionsCore.call(this,t,o,n),n.question.name===this.nameCategories&&this.setupCategoryActions(t,o,n.question,n.row,n.actions),this.isItemsMatrix(n.question.name)&&this.replaceRemoveAction(t,n.question,n.row,n.actions)},n.prototype.getExistingKeys=function(e,t){var o=e.getQuestionByName(this.nameCategories).value||[],n=e.getQuestionByName(this.nameMatrix).value||[];return a(a(a([],o,!0),o.map(function(e){return e.items}).flat().filter(function(e){return!!e}),!0),n,!0)},n.prototype.onMatrixRowRemoving=function(t,o,n){var i=this;if(e.prototype.onMatrixRowRemoving.call(this,t,o,n),n.question.name==this.nameCategories){var s=n.question.value[n.rowIndex][this.nameInnerMatrix];if(s){var r=this.getMatrix(t),a=r.value?r.value.concat(s):s;r.value=a}}if(n.question.name==this.nameMatrix){var l=n.question.value[n.rowIndex],u=this.defaultCategories.filter(function(e){return e[i.nameInnerMatrix].filter(function(e){return e.name==l.name}).length>0})[0];this.moveToCategory(t,n.question,n.row,null==u?void 0:u.category)}},n.prototype.onMatrixRowAdded=function(t,n,i){e.prototype.onMatrixRowAdded.call(this,t,n,i),i.question.name==this.nameCategories&&(this.setDefaultValueForRow(t,i.question,i.row),this.editItem(t,n,i.question,i.row,{description:o.getLocString("presets.items.newCategory")+" "+this.getPageShortTitle(t),isNew:!0}))},n}(p),m="toolboxCategories";t.FunctionFactory.Instance.register("validateToolboxJson",function(e){var o=e[0];return!o||!o.type||!!t.Serializer.createClass(o.type,o)});var g=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return s(n,e),n.prototype.createItemsMatrixJSON=function(e,t){var n={type:"matrixdynamic",name:"items",title:"Toolbox",allowRowReorder:!0,cellType:"text",showHeader:!1,rowCount:0,allowAddRows:!1,addRowButtonLocation:"top",columns:[{name:"name",visible:!1},{name:"title"}],detailPanelMode:"underRow",detailElements:[{type:"panel",name:"details",maxWidth:"30%",elements:[{type:"text",name:"name",title:o.getLocString("presets.toolbox.categoryName"),isUnique:!0,visible:!1,isRequired:!0},{type:"text",name:"title",title:o.getLocString("presets.toolbox.categoryTitle"),visible:!1},{type:"dropdown",name:"iconName",title:o.getLocString("presets.toolbox.iconName"),itemComponent:"svc-presets-icon-item",allowCustomChoices:!0,choices:this.iconList,visible:!1},{type:"text",name:"tooltip",title:o.getLocString("presets.toolbox.tooltip"),visible:!1}],visible:!1},{type:"presetjson",name:"json",startWithNewLine:!1,renderAs:"default-comment",title:o.getLocString("presets.toolbox.jsonObject"),validators:[{type:"expression",text:"JSON should be correct",expression:"validateToolboxJson({json})"}],visible:!1}]},i=r(r({},n),e);return t&&i.detailElements.push(this.createItemsMatrixJSON({allowAddRows:!0,addRowText:o.getLocString("presets.toolbox.addNewSubitem"),addRowButtonLocation:"bottom",name:this.nameSubitems,valueName:"subitems",titleLocation:"hidden",startWithNewLine:!1},!1)),i},n.prototype.createMainPageCore=function(){return{title:o.getLocString("presets.toolbox.title"),description:o.getLocString("presets.toolbox.description"),navigationTitle:o.getLocString("presets.toolbox.navigationTitle"),elements:[{type:"panel",name:this.mainPanelName,elements:[{type:"matrixdynamic",name:this.nameCategories,title:o.getLocString("presets.toolbox.toolbox"),visibleIf:this.getTextVisibleIf(this.nameCategoriesMode,"categories"),allowRowReorder:!0,allowAddRows:!0,addRowButtonLocation:"top",noRowsText:o.getLocString("presets.toolbox.noCategoriesText"),addRowText:o.getLocString("presets.toolbox.addCustomCategory"),showHeader:!1,columns:[{cellType:"text",name:"category",isUnique:!0,isRequired:!0,visible:!1},{cellType:"text",name:"title"}],detailPanelMode:"underRow",detailElements:[{type:"text",name:"category",title:o.getLocString("presets.toolbox.categoryName"),isRequired:!0,visible:!1},{type:"text",name:"title",title:o.getLocString("presets.toolbox.categoryTitle"),visible:!1},{type:"text",name:"tooltip",title:o.getLocString("presets.toolbox.tooltip"),visible:!1},this.createItemsMatrixJSON({name:this.nameInnerMatrix,titleLocation:"hidden",allowAddRows:!0,addRowButtonLocation:"bottom",noRowsText:o.getLocString("presets.toolbox.noItemsText"),addRowText:o.getLocString("presets.toolbox.addNewItem"),valueName:"items"},!0)]},this.createItemsMatrixJSON({name:this.nameItems,title:o.getLocString("presets.toolbox.toolbox"),addRowButtonLocation:"top",noRowsText:o.getLocString("presets.toolbox.noItemsText"),addRowText:o.getLocString("presets.toolbox.addCustomItem"),startWithNewLine:!1,visibleIf:this.getTextVisibleIf(this.nameCategoriesMode,"items")},!0),this.createItemsMatrixJSON({allowAddRows:!0,title:o.getLocString("presets.toolbox.hiddenItems"),noRowsText:o.getLocString("presets.toolbox.noHiddenItemsText"),descriptionLocation:"underInput",addRowButtonLocation:"bottom",addRowText:o.getLocString("presets.toolbox.addNewItem"),startWithNewLine:!1,name:this.nameMatrix},!0)]},{type:"panel",title:" ",name:this.navigationPanelName,elements:[{type:"boolean",name:this.nameCategoriesMode,title:o.getLocString("presets.toolbox.enableGrouping"),titleLocation:"hidden",defaultValue:"categories",valueTrue:"categories",valueFalse:"items",clearIfInvisible:"onHidden",renderAs:"switch"},{type:"boolean",name:this.nameShowCategoryTitles,title:o.getLocString("presets.toolbox.showCategoryTitles"),defaultValue:!1,useTitleAsLabel:!0,visibleIf:this.getTextVisibleIf(this.nameCategoriesMode,"categories"),clearIfInvisible:"onHidden",renderAs:"switch"}]}]}},Object.defineProperty(n.prototype,"nameCategoriesMode",{get:function(){return this.fullPath+"_mode"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"nameItems",{get:function(){return this.fullPath+"_items"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"nameSubitems",{get:function(){return"subitems"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"nameShowCategoryTitles",{get:function(){return this.fullPath+"_showCategoryTitles"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"questionNames",{get:function(){return[this.nameCategories,this.nameItems,this.nameMatrix,this.nameShowCategoryTitles,this.nameCategoriesMode]},enumerable:!1,configurable:!0}),n.prototype.hasIcon=function(e){return e!==this.nameCategories&&e!==this.nameSubitems},n.prototype.getDefaultItems=function(e){return(null==e?void 0:e.name)===this.nameCategories?this.defaultCategories:a(a([],this.defaultItems,!0),this.defaultSubitems,!0)},n.prototype.updateRowAction=function(t,o,n,i,s){e.prototype.updateRowAction.call(this,t,o,n,i,s),"show-detail"==s.id&&t.name!=this.nameCategories&&(s.visible=o.isDetailPanelShowing||!!n.subitems)},n.prototype.findItem=function(e,t,o){return o?e.map(function(e){return e.items.filter(function(e){return e.name==t})[0]}).filter(function(e){return!!e})[0]:e.filter(function(e){return e.name==t})[0]},n.prototype.moveToSubitems=function(e,t,o,n,i){void 0===i&&(i=!1);var s=this.ejectRowData(t,o,i),r=this.itemMenuCategoriesEnabled(e),a=r?this.getQuestionCategories(e):this.getQuestionItems(e),l=JSON.parse(JSON.stringify(a.value)),u=this.findItem(l,n,r);u&&(u.subitems||(u.subitems=[]),u.subitems.push(s)),a.value=l},n.prototype.getExistingKeys=function(t,o){var n=e.prototype.getExistingKeys.call(this,t,o),i=t.getQuestionByName(this.nameItems).value||[],s=a(a([],n,!0),i,!0),r=s.map(function(e){return e.subitems||[]}).flat();return a(a([],s,!0),r,!0)},n.prototype.itemMenuCategoriesEnabled=function(e){return"items"!==e.getValue(this.nameCategoriesMode)},n.prototype.getItemMenuActionsCore=function(n,i,s){var r=this,a=this.getQuestionCategories(n).value,l=e.prototype.getItemMenuActionsCore.call(this,n,i,s),u=this.itemMenuCategoriesEnabled(n),p=a.map(function(e){var o=new t.Action({id:"tosubitemcategory-"+e.category,title:e.title});if(e.items){var a=e.items.filter(function(e){var t;return e.name!=(null===(t=s.value)||void 0===t?void 0:t.name)}).map(function(e){return new t.Action({id:"tosubitem-"+e.name,title:e.title,action:function(){r.moveToSubitems(n,i,s,e.name,!0)}})});r.setSubitemsToAction(o,a)}return o}),c=u?p:p.map(function(e){return e.items}).flat(),d=i.visibleRows.indexOf(s),m=i.value[d];if(!m.subitems){i.name!=this.nameItems&&i.name!=this.nameInnerMatrix||(l.push(new t.Action({id:"subcategories",title:o.getLocString("presets.toolbox.subitems"),css:"sps-list__item--label",enabled:!1,needSeparator:!0})),l.push(new t.Action({id:"convert-to-subcategory",title:o.getLocString("presets.toolbox.enableSubitems"),action:function(){var e=u?r.getQuestionCategories(n):r.getQuestionItems(n),t=JSON.parse(JSON.stringify(e.value)),o=r.findItem(t,m.name,u);o&&(o.subitems=[]),e.value=t,r.updateMatrixRowActions(n,i),s.showDetailPanel()}})));var g=new t.Action({id:"move-as-subitem",title:o.getLocString("presets.toolbox.moveAsSubitem"),needSeparator:!0});this.setSubitemsToAction(g,c),l.push(g)}return l},n.prototype.getJsonValueCore=function(e,t,o){var n={},i=this.getJsonItemsDefinition(e);i&&(n.definition=i);var s=e.getValue(this.nameCategoriesMode);t.toolbox;var r=null==o?void 0:o.categories;if("categories"===s){var a=this.getCategoriesJson(e);Array.isArray(a)&&a.length>0&&!this.isCategoriesSame(a,r)&&(n.categories=this.getCategoriesJson(e))}else n.categories=[];return e.getValue(this.nameShowCategoryTitles)&&(n.showCategoryTitles=!0),Object.keys(n).length>0?n:void 0},n.prototype.getDefaultJsonValueCore=function(e){return{categories:e.toolbox.categories.map(function(e){return{category:e.name,title:e.title,items:e.items.map(function(e){return e.name})}})}},n.prototype.isCategoriesSame=function(e,o){if(e.length!==(null==o?void 0:o.length))return!1;for(var n=0;n<e.length;n++){if(e[n].category!==o[n].category)return!1;var i=o[n].items,s=e[n].items;if(!t.Helpers.isTwoValueEquals(s,i))return!1}return!0},n.prototype.getCategoriesJson=function(e){var t=e.getValue(this.nameCategories);if(Array.isArray(t))return t.map(function(e){var t;return{category:e.category,items:null===(t=e.items)||void 0===t?void 0:t.map(function(e){return e.name})}})},n.prototype.cleanIfNotDiffers=function(e,o){if(!o)return!0;var n=!1;return Object.keys(r(r({},e),o)).forEach(function(i){t.Helpers.isTwoValueEquals(e[i],o[i])?"name"!==i&&delete e[i]:n=!0}),n},n.prototype.getJsonItemsDefinition=function(e){var o=this,n=(("items"===e.getValue(this.nameCategoriesMode)?e.getValue(this.nameItems):(e.getValue(this.nameCategories)||[]).map(function(e){return e.items}).flat())||[]).map(function(e){return r({},e)}),i=!1;return n.forEach(function(e){var t=o.defaultItems.filter(function(t){return t.name==e.name})[0];!e.subitems&&(null==t?void 0:t.subitems)&&(e.subitems=[]),o.cleanIfNotDiffers(e,t)&&(i=!0)}),i||t.Helpers.isTwoValueEquals(n.map(function(e){return e.name}),this.defaultItems.map(function(e){return e.name}))||(i=!0),i?n:void 0},n.prototype.isItemsMatrix=function(t){return t===this.nameItems||t===this.nameSubitems||e.prototype.isItemsMatrix.call(this,t)},n.prototype.onMatrixRowRemoving=function(t,o,n){n.question.name==this.nameMatrix&&("items"===t.getValue(this.nameCategoriesMode)&&this.restoreItems(this.getQuestionItems(t),n.question,n.rowIndex));e.prototype.onMatrixRowRemoving.call(this,t,o,n)},n.prototype.setupOnCurrentPageCore=function(e,t,o){t.toolbox.forceCompact=!o,t.toolbox.isCompact=!o,t.readOnly!=o&&t.setPropertyValue("readOnly",o),t.toolbox.items.forEach(function(e){return e.enabled=o}),t.toolbox.enabled=o},n.prototype.setupQuestionsCore=function(t,o){e.prototype.setupQuestionsCore.call(this,t,o),this.setupDefaults(t,o.creator)},n.prototype.setupDefaults=function(e,t){var o=this,n=t.toolbox.getDefaultItems([],!0,!0,!0),i=t.toolbox.getDefaultCategories();this.defaultItems=n.map(function(e){return o.createToolboxItemRow(e)}),this.defaultSubitems=[],n.forEach(function(e){var t;e.items&&(t=o.defaultSubitems).push.apply(t,e.items.map(function(e){return o.createToolboxItemRow(e)}))}),this.defaultCategories=i.map(function(e){return o.createToolboxCategoryRow(e)})},n.prototype.setupQuestionsValueCore=function(e,t,o){var n=this.defaultItems.reduce(function(e,t){return e[t.name]=t,e},{}),i=this.defaultCategoriesMap;this.defaultItems.filter(function(e){return e.subitems}).map(function(e){return e.subitems.forEach(function(e){return n[e.name]=e})});var s=((t=t||{}).definition||[]).map(function(e){return"string"==typeof e?{name:e}:e}),a=t.categories||[];s=0===s.length?this.defaultItems:s.map(function(e){return r(r({},n[e.name]||{}),e)});var l={};s.forEach(function(e){return l[e.name]=r(r({},e),{subitems:e.subitems&&e.subitems.map(function(e){return r(r({},n[e.name]||{}),e)})})}),(a=0===a.length?this.defaultCategories:a.map(function(e){var t;return r(r(r({},i[e.category]),e),{items:null===(t=e.items)||void 0===t?void 0:t.map(function(e){return l[e]}).filter(function(e){return!!e})})})).filter(function(e){return e.items}).forEach(function(e){return e.items.forEach(function(e){return delete n[e.name]})});var u=this.defaultItems.filter(function(e){return n[e.name]});e.setValue(this.nameMatrix,u),e.setValue(this.nameCategories,a),this.updateItemsFromCategories(e),this.updateShowCategoriesTitlesElements(e)},n.prototype.onLocaleChangedCore=function(e,t,o){this.setupDefaults(e,o),this.setupQuestionsValueCore(e,t,o)},n.prototype.updateItemsFromCategories=function(e){this.getQuestionItems(e).value=this.getQuestionCategories(e).value.map(function(e){return a([],e.items||[],!0)}).flat()},n.prototype.updateCategoriesFromItems=function(e){var t=this,o=this.getQuestionCategories(e).value,n=a([],this.getQuestionItems(e).value,!0).reduce(function(e,t){return e[t.name]=t,e},{});o.forEach(function(e){e.items=e.items.map(function(e){var t=n[e.name];return delete n[e.name],t}).filter(function(e){return!!e})});var i=Object.keys(n);if(i.length>0){var s=this.findOrCreateCategory(o,"general");s.items=s.items.concat(i.map(function(e){return t.createToolboxItemRow(n[e])}))}this.getQuestionCategories(e).value=o},n.prototype.updateOnValueChangedCore=function(t,o){e.prototype.updateOnValueChangedCore.call(this,t,o),o===this.nameCategoriesMode&&("items"==t.getValue(this.nameCategoriesMode)?this.updateItemsFromCategories(t):this.updateCategoriesFromItems(t)),o===this.nameShowCategoryTitles&&this.updateShowCategoriesTitlesElements(t)},n.prototype.updateShowCategoriesTitlesElements=function(e){var t=this;e.getValue(this.nameShowCategoryTitles),this.getQuestionCategories(e).visibleRows.forEach(function(e){var o=e.getValue("category"),n=t.getCategoryTitle(o);n&&(e.getQuestionByName("category").readOnly=!0);var i=e.getQuestionByName("title");i.isEmpty()&&(i.value=n)})},n.prototype.getCategoryTitle=function(e){return o.editorLocalization.getString(m+"."+e)},n.prototype.setJsonLocalizationStringsCore=function(e,t){function o(e,t){e&&e.visibleRows.forEach(function(e){l.updateModifiedText(t,e.getValue("title"),"qt."+e.getValue("name"))})}o(this.getQuestionItems(e),t);var n=this.getQuestionCategories(e),i=this.defaultCategoriesMap;n.isVisible&&n.visibleRows.forEach(function(e){var n,s=e.getValue("category");e.getValue("title")!==(null===(n=i[s])||void 0===n?void 0:n.title)&&(t[m]||(t[m]={}),t[m][s]=e.getValue("title")),o(e.getQuestionByName("items"),t)})},n.prototype.getQuestionItems=function(e){return e.getQuestionByName(this.nameItems)},n.prototype.createToolboxItemRow=function(e){var t,o=this,n={name:e.name,title:e.title,iconName:e.iconName,tooltip:e.tooltip,json:e.json,subitems:null===(t=e.items)||void 0===t?void 0:t.map(function(e){return o.createToolboxItemRow(e)})};for(var i in n)void 0===n[i]&&delete n[i];return n},n.prototype.createToolboxCategoryRow=function(e){var t,o=this,n={category:e.name,title:e.title,items:null===(t=e.items)||void 0===t?void 0:t.map(function(e){return o.createToolboxItemRow(e)})};for(var i in n)void 0===n[i]&&delete n[i];return n},n}(d),h=function(e){function t(t,o,n){return e.call(this,t,null,o,null,null,null,n)||this}return s(t,e),t.prototype.getIsPropertyVisible=function(e){return!1!==e.visible},t}(o.SurveyQuestionProperties),f="matrixdropdowncolumn",v=["question","matrixdropdownbase","selectbase","panelbase",f+"@default",f+"@selectbase"],y=function(){function e(e,o){var n=this;this.className=e,this.currentJson=o,this.propertiesHash={},this.allClasses=[],this.baseClasses=[];var i={},s=this.createObj();this.obj=s,this.currentJson.classes=this.currentJson.classes||{},this.properties=new h(s,e,o);var r=this.properties.getAllVisiblePropertiesNames(!0),a={};t.Serializer.getPropertiesByObj(s).forEach(function(e){return a[e.name]=e}),r.forEach(function(e){var t=a[e];if(t){var o=n.getPropClassName(t);n.propertiesHash[e]=o,i[o]=!0}});for(var l="",u=0;u<v.length;u++){var p=v[u];i[p]&&(l=l||p)}l=l||e,this.collectAllClasses(l).forEach(function(e){v.indexOf(e)<0?n.allClasses.push(e):n.baseClasses.push(e)}),this.propertyGridValue=this.createPropertyGrid(s,this.currentJson),this.propertyGridDefaultValue=this.createPropertyGrid(s)}return e.prototype.getObj=function(){return this.obj},e.prototype.collectAllClasses=function(e){var o=new Array;if(o.push(e),"survey"==e)return o;var n=0==e.indexOf(f+"@");return Object.keys(this.currentJson.classes).forEach(function(i){n?0===i.indexOf(f+"@")&&o.push(i):t.Serializer.isDescendantOf(i,e)&&o.indexOf(i)<0&&o.push(i)}),o},e.prototype.createPropertyGrid=function(e,t){var n=new o.PropertyGridModel(void 0,void 0,t);return n.showOneCategoryInPropertyGrid=!0,n.obj=e,n},e.prototype.createObj=function(e){if("survey"===(e=e||this.className))return new t.SurveyModel;var o=e.indexOf("@");if(o<0)return t.Serializer.createClass(e);var n=e.substring(0,o),i=e.substring(o+1),s=t.Serializer.createClass(n);return s.cellType&&(s.cellType=i),s},e.prototype.getInitialJson=function(e){var t=e?this.propertyGridDefaultValue:this.propertyGridValue;return t.survey.toJSON().pages.filter(function(e){return e.name!=t.placeholderPageName}).map(function(e){var t;return{category:e.name,title:e.title,iconName:e.iconName,properties:null===(t=e.elements)||void 0===t?void 0:t.filter(function(e){return e.name&&-1==e.name.indexOf("overridingProperty")}).map(function(e){var t={name:e.name,title:e.title};return void 0!==e.description&&(t.description=e.description),t})}})},Object.defineProperty(e.prototype,"propertyGridDefault",{get:function(){return this.propertyGridDefaultValue},enumerable:!1,configurable:!0}),e.prototype.getPropertyClassName=function(e){return this.propertiesHash[e]},e.prototype.updateCurrentJson=function(e){this.removeBaseClassesFromCurrentJson(),this.updateCurrentJsonCore(this.currentJson.classes,e)},e.prototype.getAllClasses=function(){return this.allClasses},e.prototype.getClassesBySharedProperty=function(e){for(var o=[],n=0;n<this.allClasses.length;n++){var i=t.Serializer.findProperty(this.allClasses[n],e);i&&!1!==i.visible&&o.push(this.allClasses[n])}return o},e.prototype.getSelectedClassesForProperty=function(e){for(var t,o=[],n=0;n<this.allClasses.length;n++)(null===(t=this.currentJson.classes[this.allClasses[n]].properties)||void 0===t?void 0:t.filter(function(t){return t===e||t.name===e})[0])&&o.push(this.allClasses[n]);return 0===o.length?this.getClassesBySharedProperty(e):o},e.prototype.removeBaseClassesFromCurrentJson=function(){var e=this;if(this.hasBaseClassInCurrentJson()&&0!==this.baseClasses.length){var t=this.currentJson.classes;this.allClasses.forEach(function(o){t[o]=e.createFlatClassProperties(o)}),this.removeBaseClassesFromCurrentJsonCore()}},e.prototype.createFlatClassProperties=function(e){var t,o=this.createObj(e);this.properties=new h(o,e,this.currentJson);var n={properties:[]},i=null===(t=this.currentJson.classes[e])||void 0===t?void 0:t.title;return i&&(n.title=i),this.properties.getTabs().forEach(function(e,t){if(!1!==e.visible&&e.properties.length>0){n.tabs=n.tabs||[];var o={name:e.name};e.title&&(o.title=e.title),e.iconName&&(o.iconName=e.iconName),n.tabs.push(o),e.properties.forEach(function(t){var o;null===(o=n.properties)||void 0===o||o.push({name:t.name,tab:e.name})})}}),n},e.prototype.hasBaseClassInCurrentJson=function(){for(var e=0;e<this.baseClasses.length;e++)if(this.currentJson.classes[this.baseClasses[e]])return!0;return!1},e.prototype.removeBaseClassesFromCurrentJsonCore=function(){var e=this;this.baseClasses.forEach(function(t){delete e.currentJson.classes[t]})},e.prototype.updateCurrentJsonCore=function(e,t){Array.isArray(t)||(t=[]),this.updateJsonClasses(e,t)},e.prototype.updateJsonClasses=function(e,t){var o=new Array,n=new Array,i=new Array;t.forEach(function(e){if(e&&e.name){var t={name:e.name};void 0!==e.iconName&&(t.iconName=e.iconName),o.push(t),Array.isArray(e.items)&&e.items.forEach(function(t){n.push({name:t,tab:e.name}),i.push(t)})}}),e[this.className]=e[this.className]||{},e[this.className].tabs=o,e[this.className].properties=n;var s=this.properties.getInvisibleCustomGeneratedProperties(i);s.length>0?e[this.className].invisibleGeneratedProperties=s:delete e[this.className].invisibleGeneratedProperties},e.prototype.updatePropertyVisibility=function(e,t){this.removeBaseClassesFromCurrentJson(),this.updatePropertyVisibilityCore(this.currentJson.classes,e,t)},e.prototype.updatePropertyVisibilityCore=function(e,t,o){Object.keys(e).forEach(function(n){var i,s=e[n],r=null===(i=s.properties)||void 0===i?void 0:i.findIndex(function(e){return e.name===t.name});t.classes&&(t.classes.indexOf(n)<0?r>-1&&s.properties.splice(r,1):r<0&&s.properties.push({name:t.name,tab:o}))})},e.prototype.getPropClassName=function(e){for(var o=e.classInfo.name,n=1;n<v.length;n++){var i=v[n];if(o===i||t.Serializer.isDescendantOf(o,i))return this.getClassName(i)}return o===this.className?this.className:this.getClassName("question")},e.prototype.getClassName=function(e){var t=this.className.indexOf("@");if(t<0)return e;var o=this.className.substring(0,t);return o!==e&&"question"!==e||(e="default"),o+"@"+e},e}(),b=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.firstTimeLoading=!1,t}return s(n,e),Object.defineProperty(n.prototype,"nameInnerMatrix",{get:function(){return"properties"},enumerable:!1,configurable:!0}),n.prototype.createItemsMatrixJSON=function(e){var t={type:"matrixdynamic",allowRowReorder:!0,cellType:"text",showHeader:!1,rowCount:0,allowAddRows:!1,addRowButtonLocation:"top",addRowText:"Add Custom Item",noRowsText:"There are no items",columns:[{name:"name",visible:!1},{name:"title"}],detailPanelMode:"underRow",detailElements:[{type:"text",name:"name",title:o.getLocString("presets.propertyGrid.name"),isUnique:!0,isRequired:!0,visible:!1},{type:"text",name:"title",title:o.getLocString("presets.propertyGrid.titleField"),isUnique:!0,isRequired:!0,visible:!1},{type:"comment",name:"description",title:o.getLocString("presets.propertyGrid.descriptionField"),visible:!1}]};return r(r({},t),e)},n.prototype.createMainPageCore=function(){return{title:o.getLocString("presets.propertyGrid.title"),navigationTitle:o.getLocString("presets.propertyGrid.navigationTitle"),description:o.getLocString("presets.propertyGrid.description"),elements:[{type:"dropdown",name:this.nameSelector,allowClear:!1,clearIfInvisible:"onHidden",title:o.getLocString("presets.propertyGrid.selectElement")},{type:"panel",name:this.mainPanelName,visibleIf:this.getNotEmptyVisibleIf(this.nameSelector),elements:[{type:"matrixdynamic",name:this.nameCategories,title:o.getLocString("presets.propertyGrid.propertyGrid"),allowRowReorder:!0,addRowButtonLocation:"top",rowCount:0,allowAddRows:!0,noRowsText:o.getLocString("presets.propertyGrid.noCategoriesText"),addRowText:o.getLocString("presets.propertyGrid.addCustomCategory"),showHeader:!1,columns:[{cellType:"text",name:"category",isUnique:!0,isRequired:!0,visible:!1},{type:"boolean",name:"isDefault",visible:!1},{cellType:"text",name:"title"}],detailPanelMode:"underRow",detailElements:[{type:"text",name:"category",title:o.getLocString("presets.propertyGrid.categoryName"),isRequired:!0,visible:!1},{type:"text",name:"title",title:o.getLocString("presets.propertyGrid.categoryTitle"),visible:!1},{type:"dropdown",name:"iconName",title:o.getLocString("presets.propertyGrid.iconName"),itemComponent:"svc-presets-icon-item",allowCustomChoices:!0,choices:this.iconList,visible:!1},this.createItemsMatrixJSON({name:this.nameInnerMatrix,noRowsText:o.getLocString("presets.propertyGrid.noItemsText"),titleLocation:"hidden",detailElements:[{type:"panel",name:"details",maxWidth:"30%",elements:[{type:"text",name:"name",title:o.getLocString("presets.propertyGrid.name"),isUnique:!0,isRequired:!0,visible:!1},{type:"text",name:"title",title:o.getLocString("presets.propertyGrid.titleField"),isUnique:!0,isRequired:!0,visible:!1},{type:"comment",name:"description",title:o.getLocString("presets.propertyGrid.descriptionField"),showSelectAllItem:!0,visible:!1}],visible:!1},{type:"checkbox",name:"classes",title:o.getLocString("presets.propertyGrid.propertyVisibleIn"),colCount:3,choicesOrder:"asc",startWithNewLine:!1,visible:!1}]})]},this.createItemsMatrixJSON({title:o.getLocString("presets.propertyGrid.hiddenItems"),name:this.nameMatrix,noRowsText:o.getLocString("presets.propertyGrid.noHiddenItemsText"),descriptionLocation:"underInput",startWithNewLine:!1})]},{type:"panel",title:" ",name:this.navigationPanelName,elements:[{type:"html",html:"&nbsp"}]}]}},n.prototype.propertyGridSetObj=function(e){var t,o=null===(t=this.propertyGrid.survey.currentPage)||void 0===t?void 0:t.name;this.propertyGrid.setObj(e),this.propertyGrid.survey.currentPage=this.propertyGrid.survey.getPageByName(o)},n.prototype.hasIcon=function(e){return e==this.nameCategories},n.prototype.restoreValuesFromDefault=function(e){this.isModified=!1,this.currentJson=this.copyJson(o.defaultPropertyGridDefinition),this.updateMatrices(e)},n.prototype.getJsonValueCore=function(e,t,o){if(this.isModified)return{definition:this.currentJson}},n.prototype.setupPageQuestions=function(e,t){this.getSelector(e).choices=this.getSelectorChoices(t);var n=o.settings.propertyGrid.enableSearch;o.settings.propertyGrid.enableSearch=!1,o.settings.propertyGrid.enableSearch=n},n.prototype.setupQuestionsCore=function(t,o){this.propertyGrid=o.creator.designerPropertyGrid,e.prototype.setupQuestionsCore.call(this,t,o),this.setupPageQuestions(t,o.creator)},n.prototype.setJSONForTitlesAndDescriptions=function(e,t){var o=this.localeStrings[t];Object.keys(o).length>0&&(e[t]=o)},n.prototype.onLocaleChangedCore=function(e,t,o){this.setupPageQuestions(e,o),this.setupQuestionsValueCore(e,t,o)},n.prototype.setJsonLocalizationStringsCore=function(e,t){this.setJSONForTitlesAndDescriptions(t,"pe"),this.setJSONForTitlesAndDescriptions(t,"pehelp")},n.prototype.updateJsonLocalizationStringsCore=function(e){this.localeStrings={pe:e.pe||{},pehelp:e.pehelp||{}}},n.prototype.setupOnCurrentPageCore=function(e,t,o){var n;t.setSidebarEnabled(o),this.propertyGridSetObj(o?null===(n=this.currentProperties)||void 0===n?void 0:n.getObj():null)},Object.defineProperty(n.prototype,"isSettingUp",{get:function(){return this.firstTimeLoading},enumerable:!1,configurable:!0}),n.prototype.updateOnValueChangedCore=function(t,n){var i,s=this;if(e.prototype.updateOnValueChangedCore.call(this,t,n),n==this.nameCategories){this.firstTimeLoading||(this.isModified=!0);var r=this.getQuestionCategories(t);r.isVisible&&(null===(i=r.value)||void 0===i||i.forEach(function(e){var t,n=e.category,i=e.title;e.title!==o.editorLocalization.getString("pe.tabs."+n)&&(s.ensureLocalizationPath("pe.tabs"),s.localeStrings.pe.tabs[n]=i),null===(t=e.properties)||void 0===t||t.forEach(function(e){e.title!==o.editorLocalization.getString("pe."+e.name)&&s.changePropTitleAndDescription("pe",e.name,e.title),e.description!==o.editorLocalization.getString("pehelp."+e.name)&&s.changePropTitleAndDescription("pehelp",e.name,e.description)})})),this.firstTimeLoading||this.updateCurrentJson(t)}if(n===this.nameSelector){this.firstTimeLoading=!0,this.currentProperties&&(this.currentProperties=void 0);var a=this.getSelector(t);this.currentClassName=a.value,this.updateMatrices(t),this.firstTimeLoading=!1}},n.prototype.updateMatrices=function(e){if(this.currentClassName){this.currentProperties=new y(this.currentClassName,this.currentJson),this.setupDefaults(e);var t=this.currentProperties.getInitialJson(!1);e.setValue(this.nameCategories,t);var o=this.getCurrentlyHiddenItems(t);e.setValue(this.nameMatrix,o),this.pageName==e.currentPage.name&&this.propertyGridSetObj(this.currentProperties.getObj())}},n.prototype.getCurrentlyHiddenItems=function(e){var t=["progressBarInheritWidthFrom"],o={};return this.defaultItems.forEach(function(e){return o[e.name]=e}),e.filter(function(e){return e.properties}).forEach(function(e){return e.properties.forEach(function(e){return delete o[e.name]})}),Object.keys(o).map(function(e){return o[e]}).filter(function(e){return-1==t.indexOf(e.name)})},n.prototype.setupDefaults=function(e){var t,o=this,n=(null===(t=this.currentProperties)||void 0===t?void 0:t.getInitialJson(!0))||[];this.defaultCategories=a([],n,!0),this.defaultItems=[],n.forEach(function(e){var t;e.properties&&(t=o.defaultItems).push.apply(t,e.properties)})},n.prototype.setupQuestionsValueCore=function(e,t,n){this.getSelector(e).value="survey";var i=n.getPropertyGridDefinition();this.isModified=!!(null==t?void 0:t.definition)||i&&JSON.stringify(i)!==JSON.stringify(o.defaultPropertyGridDefinition),this.currentJson=(null==t?void 0:t.definition)||this.copyJson(i||o.defaultPropertyGridDefinition),this.currentJson.generateOtherTab=!1,this.updateOnValueChangedCore(e,this.nameSelector)},n.prototype.getSelector=function(e){return e.getQuestionByName(this.nameSelector)},Object.defineProperty(n.prototype,"nameSelector",{get:function(){return this.fullPath+"_selector"},enumerable:!1,configurable:!0}),n.prototype.getSelectorChoices=function(e){var o=this,n=["survey","page"];e.toolbox.getDefaultItems([],!1,!0,!0).forEach(function(e){n.push(e.id)});var i=[];n.forEach(function(e){return i.push(new t.ItemValue(e,o.getSelectorItemTitle(e)))});var s="matrixdropdowncolumn@";for(var r in i.push(new t.ItemValue(s+"default",this.getColumnItemTitle(""))),t.matrixDropdownColumnTypes)i.push(new t.ItemValue(s+r,this.getColumnItemTitle(r)));return i},n.prototype.getSelectorItemTitle=function(e){return"survey"===e?o.editorLocalization.getString("ed.surveyTypeName"):"page"===e?o.editorLocalization.getString("ed.pageTypeName"):o.editorLocalization.getString("qt."+e)},n.prototype.getColumnItemTitle=function(e){return o.editorLocalization.getString("ed.columnTypeName")+": "+(e?this.getSelectorItemTitle(e):"default")},n.prototype.updateCurrentJson=function(e){this.currentProperties&&this.currentProperties.updateCurrentJson(this.getPropertiesArray(this.getQuestionCategories(e).value))},n.prototype.getPropertiesArray=function(e){return null==e?void 0:e.map(function(e){var t;return{name:e.category,items:null===(t=e.properties)||void 0===t?void 0:t.map(function(e){return e.name}),iconName:e.iconName}})},n.prototype.changePropTitleAndDescription=function(e,t,o){this.ensureLocalizationPath(e);var n=this.localeStrings[e],i=this.currentProperties.getPropertyClassName(t);i&&(n[i]||(n[i]={}),n[i][t]=o)},n.prototype.ensureLocalizationPath=function(e){this.localeStrings||(this.localeStrings={});for(var t=e.split("."),o=this.localeStrings,n=0;n<t.length;n++){var i=t[n];o[i]||(o[i]={}),o=o[i]}},n.prototype.onDetailPanelInPopupApply=function(t,o,n){var i,s,r=this,a=n.getValue("name");null===(i=this.getQuestionCategories(o.survey).value)||void 0===i||i.forEach(function(e){var o;return null===(o=e.properties)||void 0===o?void 0:o.forEach(function(o){var n;o.name==a&&(null===(n=r.currentProperties)||void 0===n||n.updatePropertyVisibility(t,e.category))})});var l=!1;if(-1==(null===(s=t.classes)||void 0===s?void 0:s.indexOf(this.currentClassName))){var u=o.visibleRows.findIndex(function(e){return e===n});u>=0&&(o.removeRow(u),l=!0)}return e.prototype.onDetailPanelInPopupApply.call(this,t,o,n),!l},n.prototype.editItem=function(o,n,i,s,r){var l=this;if(i.name===this.nameInnerMatrix&&this.currentProperties){var u=i.detailPanel.getQuestionByName("classes"),p=s.getValue("name");u.choices=this.currentProperties.getClassesBySharedProperty(p).map(function(e){return new t.ItemValue(e,l.getSelectorItemTitle(e))}),u.showSelectAllItem=u.choices.length>1;var c=i.visibleRows.findIndex(function(e){return e===s});if(c>=0){var d=i.value||[];d[c].classes=this.currentProperties.getSelectedClassesForProperty(p),i.value=a([],d,!0)}}e.prototype.editItem.call(this,o,n,i,s,r)},n}(d),C=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return s(n,e),n.prototype.createItemsMatrixJSON=function(e){var t={type:"matrixdynamic",name:"items",allowRowReorder:!0,cellType:"text",showHeader:!1,rowCount:0,allowAddRows:!1,addRowButtonLocation:"top",addRowText:"Add Custom Item",noRowsText:"There are no items",columns:[{name:"name",visible:!1},{name:"title"}],detailPanelMode:"underRow",detailElements:[{type:"text",name:"name",title:o.getLocString("presets.tabs.name"),isUnique:!0,isRequired:!0,readOnly:!0,visible:!1},{type:"text",name:"title",title:o.getLocString("presets.tabs.titleField"),visible:!1},{type:"dropdown",name:"iconName",title:o.getLocString("presets.tabs.iconName"),itemComponent:"svc-presets-icon-item",allowCustomChoices:!0,choices:this.iconList,visible:!1}]};return r(r({},t),e)},n.prototype.createMainPageCore=function(){return{title:o.getLocString("presets.tabs.title"),description:o.getLocString("presets.tabs.description"),navigationTitle:o.getLocString("presets.tabs.navigationTitle"),elements:[{type:"panel",name:this.mainPanelName,elements:[this.createItemsMatrixJSON({title:o.getLocString("presets.tabs.items"),noRowsText:o.getLocString("presets.tabs.noItemsText"),name:this.nameItems}),this.createItemsMatrixJSON({startWithNewLine:!1,title:o.getLocString("presets.tabs.hiddenItems"),noRowsText:o.getLocString("presets.tabs.noHiddenItemsText"),name:this.nameMatrix,descriptionLocation:"underInput"})]},{type:"panel",name:"panel_tabs_controls",elements:[{type:"dropdown",name:this.nameActiveTab,allowClear:!1,title:o.getLocString("presets.tabs.defaultTab")}]},{type:"panel",title:" ",name:this.navigationPanelName,elements:[{type:"html",html:"&nbsp"}]}]}},Object.defineProperty(n.prototype,"questionNames",{get:function(){return[this.nameItems,this.nameActiveTab]},enumerable:!1,configurable:!0}),n.prototype.filterTabs=function(e){return e.filter(function(e){return"presets"!=e.name})},n.prototype.hasIcon=function(e){return!0},n.prototype.getJsonValueCore=function(e,o,n){var i=e.getQuestionByName(this.nameItems).value;if(Array.isArray(i)){var s=this.filterTabs((null==n?void 0:n.items)||o.getTabs()),r=o.getTabsInfo(),a=i.map(function(e){return{name:e.name,iconName:e.iconName}});a.forEach(function(e){var t;e.iconName&&e.iconName!=(null===(t=r[e.name])||void 0===t?void 0:t.iconName)||delete e.iconName}),t.Helpers.isArraysEqual(a,s,!1)&&(a=void 0);var l=e.getValue(this.nameActiveTab);if(a||l!==((null==n?void 0:n.activeTab)||o.activeTab)||(l=void 0),a||l){var u={};return a&&(u.items=a),l&&(u.activeTab=l),u}}},n.prototype.getDefaultJsonValueCore=function(e){return{activeTab:e.activeTab,items:this.filterTabs(e.getTabs()).map(function(e){return{name:e.name}})}},n.prototype.getQuestionItems=function(e){return e.getQuestionByName(this.nameItems)},n.prototype.onMatrixRowRemoving=function(t,o,n){n.question.name===this.nameMatrix&&this.restoreItems(this.getQuestionItems(t),n.question,n.rowIndex),e.prototype.onMatrixRowRemoving.call(this,t,o,n)},n.prototype.isItemsMatrix=function(t){return t===this.nameItems||e.prototype.isItemsMatrix.call(this,t)},n.prototype.setJsonLocalizationStringsCore=function(e,t){this.getQuestionItems(e).visibleRows.forEach(function(e){l.updateModifiedText(t,e.getValue("title"),"tabs."+e.getValue("name"))})},n.prototype.setupQuestionsCore=function(e,t){this.setupPageQuestions(e,t.creator)},n.prototype.getAllTabs=function(e){return this.filterTabs(e.getAvailableTabs().map(function(e){return{name:e.name,title:o.editorLocalization.getString("tabs."+e.name),iconName:e.iconName}}))},n.prototype.setupOnCurrentPageCore=function(e,t,o){t.tabs.forEach(function(e){return e.enabled=o})},n.prototype.setupQuestionsValueCore=function(e,o,n){var i=((o=o||{}).items||[]).map(function(e){return"string"==typeof e?{name:e}:e}),s=n.initialTabs(),a=this.getAllTabs(n),l=a.filter(function(e){return s.indexOf(e.name)>=0});if(0===i.length)i=l;else for(var u=function(e){var t=l.filter(function(t){return t.name==i[e].name})[0];t&&(i[e]=r(r({},t),i[e]))},p=0;p<i.length;p++)u(p);var c=i.map(function(e){return e.name}),d=a.filter(function(e){return c.indexOf(e.name)<0});e.setValue(this.nameItems,i),e.setValue(this.nameMatrix,d),e.setValue(this.nameActiveTab,o.activeTab||n.activeTab),e.getQuestionByName(this.nameActiveTab).choices=i.map(function(e){return new t.ItemValue(e.name,e.title)})},n.prototype.onLocaleChangedCore=function(e,t,o){this.setupPageQuestions(e,o),this.setupQuestionsValueCore(e,t,o)},n.prototype.setupPageQuestions=function(e,o){this.defaultItems=this.getAllTabs(o),e.getQuestionByName(this.nameActiveTab).choices=this.defaultItems.map(function(e){return new t.ItemValue(e.name,e.title)})},n.prototype.updateOnValueChangedCore=function(o,n){if(e.prototype.updateOnValueChangedCore.call(this,o,n),n===this.nameItems){var i=o.getValue(n)||[],s=o.getQuestionByName(this.nameActiveTab);s.choices=i.map(function(e){return new t.ItemValue(e.name,e.title)}),s.selectedItem||s.selectItem(s.choices[0])}},Object.defineProperty(n.prototype,"nameActiveTab",{get:function(){return this.path+"_activeTab"},enumerable:!1,configurable:!0}),n}(p);t.FunctionFactory.Instance.register("searchItem",function(e){var t=this.survey.getQuestionByName(e[0]),o=e[1],n=e[2];if(!n)return!0;var i=t.choices.filter(function(e){return e.value==o})[0];return!i||-1!=i.text.toUpperCase().indexOf(n.toUpperCase())});var w=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return s(n,e),n.prototype.createMainPageCore=function(){var e=this.getSurveyLocales();return{title:o.getLocString("presets.languages.title"),description:o.getLocString("presets.languages.description"),navigationTitle:o.getLocString("presets.languages.navigationTitle"),elements:[{type:"dropdown",title:o.getLocString("presets.languages.creatorUI"),placeholder:o.editorLocalization.getLocaleName(""),name:this.creatorLocaleName,searchEnabled:!0,choices:this.getCreatorLocales()},{type:"panel",title:o.getLocString("presets.languages.surveyLanguages"),elements:[{type:"text",name:this.searchLocalesName,placeholder:o.getLocString("presets.languages.searchPlaceholder"),titleLocation:"hidden",textUpdateMode:"onTyping"},{type:"checkbox",name:this.surveyLocalesName,titleLocation:"hidden",minSelectedChoices:1,colCount:3,showSelectAllItem:e.length>1,choices:e,choicesEnableIf:'{item} <> "'+t.surveyLocalization.defaultLocale+'"',choicesVisibleIf:"searchItem('"+this.surveyLocalesName+"', {item}, {"+this.searchLocalesName+"}"}]},{type:"panel",title:" ",name:this.navigationPanelName,elements:[{type:"boolean",name:this.surveyUseEnglishNames,title:o.getLocString("presets.languages.translateToEnglish"),titleLocation:"hidden",renderAs:"switch"}]}]}},n.prototype.getMainElementNames=function(){return[this.surveyLocalesName]},n.prototype.getCustomQuestionCssSuffix=function(e){return e.name===this.searchLocalesName?"search":""},n.prototype.getJsonValueCore=function(e,t,o){var n=e.getValue(this.creatorLocaleName),i=!0===e.getValue(this.surveyUseEnglishNames),s=e.getQuestionByName(this.surveyLocalesName),r=s.isAllSelected||s.choices.length<2;if(n||!r||i){var a={};return n&&(a.creator=n),i&&(a.useEnglishNames=!0),!r&&Array.isArray(s.value)&&(a.surveyLocales=[],s.value.forEach(function(e){return a.surveyLocales.push(e)})),a}},n.prototype.setupQuestionsValueCore=function(e,t,o){t=t||{},e.setValue(this.creatorLocaleName,t.creator),e.setValue(this.surveyUseEnglishNames,!0===t.useEnglishNames),this.updateLocaleNames(e);var n=e.getQuestionByName(this.surveyLocalesName),i=t.surveyLocales;Array.isArray(i)&&i.length>0?n.value=i:n.value=n.choices.map(function(e){return e.value})},n.prototype.updateOnValueChangedCore=function(e,t){t===this.surveyUseEnglishNames&&this.updateLocaleNames(e)},Object.defineProperty(n.prototype,"creatorLocaleName",{get:function(){return this.path+"_creator"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"surveyLocalesName",{get:function(){return this.path+"_surveyLocales"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"searchLocalesName",{get:function(){return this.path+"_searchLocales"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"surveyUseEnglishNames",{get:function(){return this.path+"_surveyUseEnglishNames"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"questionNames",{get:function(){return[this.creatorLocaleName,this.surveyLocalesName,this.surveyUseEnglishNames]},enumerable:!1,configurable:!0}),n.prototype.getIsShowInEnglishSelected=function(e){return!0===e.getValue(this.surveyUseEnglishNames)},n.prototype.getCreatorLocales=function(){return this.getLocaleItemValues(o.editorLocalization.getLocales(),!1)},n.prototype.getSurveyLocales=function(){return this.getLocaleItemValues(Object.keys(t.surveyLocalization.locales),!0)},n.prototype.getLocaleItemValues=function(e,n){var i=[];return e.forEach(function(e){if(e&&"en"!==e){var n=o.editorLocalization.getLocaleName(e);n&&n!==e&&i.push(new t.ItemValue(e,n))}}),n&&i.unshift(new t.ItemValue("en",o.editorLocalization.getLocaleName("en"))),i},n.prototype.updateLocaleNames=function(e){var t=this.getIsShowInEnglishSelected(e),n=e.getQuestionByName(this.surveyLocalesName);n.choices.forEach(function(e){e.text=o.editorLocalization.getLocaleName(e.value,null,t)}),n.choicesOrder="none",n.choicesOrder="asc"},n}(l),x=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.optionsList=[],t}return s(n,e),n.prototype.createElements=function(){var e=t.ElementFactory.Instance.getAllToolboxTypes().map(function(e){return{value:e,text:o.editorLocalization.getString("qt."+e)}});return[{type:"panel",name:"designer",state:"expanded",elements:[{name:"pageEditMode",type:"dropdown",choices:["standard","bypage","single"]},{type:"panel",name:"designerHeader",elements:[{name:"showSurveyHeader",type:"boolean"},{name:"showHeaderInEmptySurvey",type:"boolean"}]},{type:"panel",name:"designerTitles",elements:[{name:"useElementTitles",type:"boolean"}]},{type:"panel",name:"designerZoomDrag",elements:[{name:"allowDragPages",type:"boolean"},{name:"allowZoom",type:"boolean"}]},{name:"expandCollapseButtonVisibility",type:"dropdown",choices:["never","onhover","always"]},{type:"panel",name:"designerExpandCollapse",elements:[{name:"collapseQuestions",type:"boolean"},{name:"collapsePanels",type:"boolean"},{name:"collapsePages",type:"boolean"}]},{name:"maxRows",type:"text",inputType:"number"},{name:"maxColumns",type:"text",inputType:"number"},{name:"minChoices",type:"text",inputType:"number"},{name:"maxChoices",type:"text",inputType:"number"},{name:"maxVisibleChoices",type:"text",inputType:"number",min:-1},{name:"maxRateValues",type:"text",inputType:"number"},{name:"forbiddenNestedElementsPanel",type:"tagbox",choices:e},{name:"forbiddenNestedElementsPanelDynamic",type:"tagbox",choices:e},{name:"maxPanelNestingLevel",type:"text",inputType:"number",min:-1},{type:"panel",name:"expressionsValidation",elements:[{name:"expressionsValidateFunctions",type:"boolean"},{name:"expressionsValidateVariables",type:"boolean"},{name:"expressionsValidateSyntax",type:"boolean"}]}]},{type:"panel",name:"preview",state:"expanded",elements:[{type:"panel",name:"previewSimulateDevice",elements:[{name:"previewAllowSimulateDevices",type:"boolean"}]},{name:"previewDevice",type:"dropdown",choices:[{value:"desktop",text:"Desktop"},{value:"iPhoneSE",text:"iPhone SE"},{value:"iPhone15",text:"iPhone 15"},{value:"iPhone15Plus",text:"iPhone 15 Plus"},{value:"iPad",text:"iPad"},{value:"iPadMini",text:"iPad Mini"},{value:"androidPhone",text:"Android Phone"},{value:"androidTablet",text:"Android Tablet"},{value:"microsoftSurface",text:"Microsoft Surface"}]},{name:"previewOrientation",type:"dropdown",choices:["landscape","portrait"]},{name:"previewAllowSelectLanguage",type:"dropdown",choices:["auto","all",!0,!1]},{type:"panel",name:"previewAllowSelect",elements:[{name:"previewAllowSelectPage",type:"boolean"},{name:"previewAllowHiddenElements",type:"boolean"}]}]},{type:"panel",name:"logic",state:"expanded",elements:[{type:"panel",name:"previewSimulateDevice",elements:[{name:"logicAllowTextEditExpressions",type:"boolean"}]},{name:"logicMaxItemsInCondition",type:"text",inputType:"number",min:-1}]},{type:"panel",name:"translation",state:"expanded",elements:[{type:"panel",name:"previewSimulateDevice",elements:[{name:"clearTranslationsOnSourceTextChange",type:"boolean"}]}]},{type:"panel",title:" ",name:this.navigationPanelName,elements:[{type:"html",html:"&nbsp"}]}]},n.prototype.addPathToName=function(e){return this.fullPath+"_"+e},n.prototype.patchElements=function(e){var t=this;return e.map(function(e){return e.name===t.navigationPanelName||("panel"===e.type?("expanded"==e.state&&(e.title=o.editorLocalization.getString("tabs."+e.name)),t.patchElements(e.elements)):(t.optionsList.push(e.name),e.title=o.editorLocalization.getString("presets.options.o."+e.name)),e.choices&&(e.choices=e.choices.map(function(t){var n=void 0!==t.value?t.value:t;return{value:n,text:t.text||o.editorLocalization.getString("presets.options.ov."+e.name+"."+n)}})),"number"===e.inputType&&void 0===e.min&&(e.min=0),"boolean"===e.type&&(e.renderAs="checkbox",e.useTitleAsLabel=!0),"dropdown"===e.type&&(e.searchEnabled=!1),e.name=t.addPathToName(e.name)),e})},n.prototype.createMainPageCore=function(){return this.optionsList=[],{title:o.getLocString("presets.options.title"),description:o.getLocString("presets.options.description"),navigationTitle:o.getLocString("presets.options.navigationTitle"),elements:this.patchElements(this.createElements())}},n.prototype.getDefaultJsonValueCore=function(e){var t=this.optionsList.reduce(function(t,o){return t[o]=e[o],t},{});return delete t.forbiddenNestedElementsPanel,delete t.forbiddenNestedElementsPanelDynamic,e.forbiddenNestedElements&&(t.forbiddenNestedElements={panel:a([],e.forbiddenNestedElements.panel,!0),paneldynamic:a([],e.forbiddenNestedElements.paneldynamic,!0)}),t},n.prototype.getJsonValueCore=function(e,o,n){var i,s,r=this,l={};if(this.optionsList.forEach(function(t){var o=e.getQuestionByName(r.addPathToName(t));o&&(l[t]=o.value)}),((null===(i=l.forbiddenNestedElementsPanel)||void 0===i?void 0:i.length)||(null===(s=l.forbiddenNestedElementsPanelDynamic)||void 0===s?void 0:s.length))&&(l.forbiddenNestedElements={panel:a([],l.forbiddenNestedElementsPanel,!0),paneldynamic:a([],l.forbiddenNestedElementsPanelDynamic,!0)}),delete l.forbiddenNestedElementsPanel,delete l.forbiddenNestedElementsPanelDynamic,!t.Helpers.isTwoValueEquals(l,n))return l},n.prototype.setupQuestionsValueCore=function(e,t,o){var n=this;function i(e){return void 0===(null==t?void 0:t[e])?o[e]:t[e]}this.optionsList.forEach(function(t){var o,s,r=i(t);"forbiddenNestedElementsPanel"===t&&(r=null===(o=i("forbiddenNestedElements"))||void 0===o?void 0:o.panel)&&(r=a([],r,!0)),"forbiddenNestedElementsPanelDynamic"===t&&(r=null===(s=i("forbiddenNestedElements"))||void 0===s?void 0:s.paneldynamic)&&(r=a([],r,!0)),e.getQuestionByName(n.addPathToName(t)).value=r})},Object.defineProperty(n.prototype,"questionNames",{get:function(){var e=this;return this.optionsList.map(function(t){return e.addPathToName(t)})},enumerable:!1,configurable:!0}),n.prototype.onGetQuestionTitleActions=function(e,n,i){var s,r=this.fullPath+"_";if((null===(s=i.question.parent)||void 0===s?void 0:s.name.substring(0,r.length))===r){var a=i.question.name.substring(r.length),l=o.editorLocalization.getString("presets.options.ohelp."+a);if(l!=a){i.actions=[{id:"hint",css:"sv-action-bar-item--hint",iconName:new t.ComputedUpdater(function(){return i.question.description?"icon-hidehint-16x16":"icon-hint-16x16"}),iconSize:"auto",action:function(){i.question.description?i.question.description="":i.question.description=l}}]}}},n.prototype.onGetPanelTitleActions=function(e,o,n){var i=this.fullPath+"_";if(n.panel.name!==this.navigationPanelName&&n.panel.name.substring(0,i.length)===i){n.actions=[{id:"collapse",css:"sv-action-bar-item--collapse",locTooltipName:new t.ComputedUpdater(function(){return n.panel.isCollapsed?"ed.expandTooltip":"ed.collapseTooltip"}),iconName:new t.ComputedUpdater(function(){return n.panel.isCollapsed?"icon-expandpanel-16x16":"icon-collapsepanel-16x16"}),iconSize:"auto",action:function(){n.panel.isCollapsed?n.panel.expand():n.panel.collapse()}}]}},n}(l),S={languages:{title:"Languages",navigationTitle:"Languages",description:"Select the language of the Survey Creator UI and target\nlanguages for the survey being configured.",creatorUI:"Survey Creator UI language",defaultSurveyLocale:"Default survey language",surveyLanguages:"Survey languages",searchPlaceholder:"Type to search...",translateToEnglish:"Translate language names to English"},tabs:{title:"Configure tabs",navigationTitle:"Tabs",description:"Select the tabs you want to show, reorder them, change their titles,\nand choose the tab that will be active by default.",items:"Visible tabs",hiddenItems:"Hidden tabs",defaultTab:"Default tab",noItemsText:"Drag tabs here to show them",noHiddenItemsText:"Drag tabs here to hide them",name:"Name",titleField:"Title",iconName:"Icon name"},toolbox:{title:"Set up the Toolbox",navigationTitle:"Toolbox",description:"Select the toolbox items you want to show, group them into categories, \nrename them, and change their order if required.",toolbox:"Toolbox",categories:"Categories",noCategoriesText:"No categories",noItemsText:"Drag items here to show them",noHiddenItemsText:"Drag items here to hide them",hiddenItems:"Hidden toolbox items",enableGrouping:"Enable grouping",showCategoryTitles:"Show category titles",categoryName:"Name",categoryTitle:"Title",tooltip:"Tooltip",iconName:"Icon name",jsonObject:"JSON object to apply when users select this toolbox item",subitems:"Subitems",enableSubitems:"Enable subitems for this question",moveAsSubitem:"Move as a subitem to...",addToToolbox:"Add to Toolbox",deleteCustomItem:"Delete Custom Item",addCustomCategory:"New Category",addCustomItem:"New Item",addNewItem:"Add a new item",addNewSubitem:"Add a new subitem",noRowsText:"There are no items",newItem:"New item in"},propertyGrid:{title:"Customize the Property Grid",navigationTitle:"Property Grid",description:"Hide, rename, reorder, or change property grouping in the Property Grid.",selectElement:"Select a survey element to customize",propertyGrid:"Property Grid",noCategoriesText:"No categories",noItemsText:"Drag properties here to show them",noHiddenItemsText:"Drag properties here to hide them",hiddenItems:"Hidden properties",categoryName:"Name",categoryTitle:"Title",iconName:"Icon name",name:"Name",titleField:"Title",descriptionField:"Helper text",propertyVisibleIn:"Property visible in",addCustomCategory:"New Category"},options:{title:"Options",navigationTitle:"Options",description:"Detailed configuration settings for Survey Creator.",o:{pageEditMode:"Page edit mode",showSurveyHeader:"Show survey header",showHeaderInEmptySurvey:"Show header when survey is empty",useElementTitles:"Show element titles instead of IDs",allowDragPages:"Enable page drag-and-drop",allowZoom:"Enable zoom controls",expandCollapseButtonVisibility:"Show expand/collapse buttons",collapseQuestions:"Collapse questions by default",collapsePanels:"Collapse panels by default",collapsePages:"Collapse pages by default",maxRows:"Maximum number of matrix rows",maxColumns:"Maximum number of matrix columns",minChoices:"Minimum number of choices",maxChoices:"Maximum number of choices",maxVisibleChoices:"Maximum number of visible choices",maxRateValues:"Maximum number of rating values",forbiddenNestedElementsPanel:"Elements not allowed inside a Panel",forbiddenNestedElementsPanelDynamic:"Elements not allowed inside a Dynamic Panel",maxPanelNestingLevel:"Maximum panel nesting depth",previewAllowSimulateDevices:"Enable survey preview on different devices",previewDevice:"Default device for preview",previewOrientation:"Preview orientation",previewAllowSelectLanguage:"Show language selector",previewAllowSelectPage:"Show page selector",previewAllowHiddenElements:"Show toggle for hidden elements",logicAllowTextEditExpressions:"Allow editing expressions as plain text",logicMaxItemsInCondition:"Maximum number of items in a logic condition",clearTranslationsOnSourceTextChange:"Clear translations when source text changes",expressionsValidateFunctions:"Validate variables and element names in expressions",expressionsValidateVariables:"Validate functions in expressions",expressionsValidateSyntax:"Validate expression syntax"},ov:{pageEditMode:{standard:"Scrollable pages",bypage:"Page-by-page editing",single:"Single page only"},expandCollapseButtonVisibility:{never:"Never",always:"Always",onhover:"On hover"},previewOrientation:{landscape:"Landscape (Horizontal)",portrait:"Portrait (Vertical)"},previewAllowSelectLanguage:{auto:"Only for multilingual surveys",true:"Always (all available languages)",all:"Always (translated languages when available)",false:"Never"}},ohelp:{pageEditMode:'Choose how pages are navigated in the Designer tab. "Scrollable pages" - survey designers can scroll to move between multiple pages; "Page-by-page editing" - survey designers switch between pages using the page menu; "Single page only" - all questions are placed on a single page, and page creation and deletion are disabled.',showSurveyHeader:"Controls whether survey designers can see and edit the survey header and its properties.",showHeaderInEmptySurvey:"Controls whether the survey title and description appear on the design surface when the survey has no questions or panels.",useElementTitles:"Controls whether Survey Creator displays titles instead of IDs for survey elements across the UI, including the survey tree, conditional logic, validation rules, etc.",allowDragPages:"Controls whether survey designers can drag and drop pages to reorder them on the design surface.",allowZoom:"Controls whether the Zoom In, Zoom Out, and Zoom to 100% buttons are available.",maxRows:"Specifies the number of rows that survey designers can add to Single-Select Matrix and Multi-Select Matrix questions.",maxColumns:"Specifies the number of columns that survey designers can add to Single-Select Matrix, Multi-Select Matrix, and Dynamic Matrix questions.",minChoices:"Specifies the minimum number of choices allowed in Checkboxes, Dropdown, Radio Button Group, and other choice questions. Survey designers won't be able to delete choices below this limit.",maxChoices:"Specifies the maximum number of choices survey designers can add to Checkboxes, Dropdown, Radio Button Group, and other choice questions.",maxVisibleChoices:"Specifies the maximum number of choices shown. Survey designers can click “Show more” to view hidden choices. Set to -1 to show all choices.",maxRateValues:"Specifies the maximum number of rating values that survey designers can add to Rating Scale questions.",maxPanelNestingLevel:"Specifies the maximum nesting level for Panels and Dynamic Panels. Use -1 for no limit, 0 to allow nesting only questions, or a positive number to set the maximum nesting depth.",previewAllowSimulateDevices:"Controls whether the Preview tab shows the Device button for testing surveys on different devices.",previewAllowSelectLanguage:'Choose whether the Preview tab shows the language selector. "Only for multilingual surveys" - show the selector only if the survey has translations; "Always (translated languages when available)" - always show the selector, listing only survey translations when present and all available languages otherwise; "Always (all available languages)" - always show the selector with all available languages; "Never" - never show the selector.',previewAllowSelectPage:"Choose whether the Preview tab shows the page selector at the bottom. When enabled, survey designers can freely navigate between pages, ignoring validation rules.",previewAllowHiddenElements:"Specifies whether the Preview tab shows a toogle (eye icon) to show or hide invisible survey elements.",logicAllowTextEditExpressions:"Controls whether survey designers can manually edit logical expressions in the Logic tab as plain text instead of using the visual editor.",logicMaxItemsInCondition:"-1 is unlimited.",clearTranslationsOnSourceTextChange:"Specifies whether translations in other languages are cleared when the source language text is changed.",expressionsValidateFunctions:"When selected, Survey Creator reports an error if an expression references an unknown variable or survey element name.",expressionsValidateVariables:"When selected, Survey Creator reports an error if an expression uses an unknown function.",expressionsValidateSyntax:"When selected, Survey Creator reports an error if an expression contains syntax errors."}},items:{addNewItem:"Add a new item",addNewSubitem:"Add a new subitem",newItem:"New item in",addCustomCategory:"New Category",newCategory:"New category in",moveToCategory:"Move to category...",moveToNewCategory:"Move to new category",categoriesLabel:"Categories",moveTo:"Move To...",removeFrom:"Remove from {0}",more:"More",restoreToDefault:"Restore",edit:"Edit",expand:"Expand",collapse:"Collapse",remove:"Remove",add:"Add",delete:"Delete"},editor:{title:"Creator Presets",presetJson:"Preset JSON:",copy:"Copy",download:"Download",load:"Load",saveExit:"Save & Exit",back:"Back",resetToDefault:"Reset",resetToDefaults:"All settings restored to default",resoredToDefault:"resored to default",itemRestoredToDefault:"Item restored to default",categoryRestoredToDefault:"Category restored to default",edit:"Edit",completeText:"Save & Exit",pagePrevText:"Back",required:"Please enter a value."},plugin:{buttonTitle:"UI Configuration Manager",buttonDescription:"Configure the Toolbox, Tabs, Property Grid, and other UI elements, and save the setup as a reusable preset.",presetsTab:"Presets",creatorPresets:"Creator Presets",save:"Save",add:"Add",discard:"Discard",cancel:"Cancel",saveAs:"Save as...",saveAsTitle:"Save current preset as...",quit:"Quit",quitConfirmation:"Exit to Survey Creator?",quitConfirmationMessage:"You will loose all unsaved changes",quitConfirmationSave:"Save and exit",quitConfirmationDiscard:"Exit without saving",deleteConfirmation:"Delete {0}?",deleteConfirmationMessage:"You will not be able to restore it",deleteConfirmationOk:"Yes, delete",deleteConfirmationCancel:"No, cancel",switchPresetConfirmation:"Switch Preset?",switchPresetConfirmationMessage:"You will loose all unsaved changes",switchPresetConfirmationOk:"Yes, switch",switchPresetConfirmationCancel:"No, cancel",file:"File",import:"Import",export:"Export",edit:"Edit",resetLanguages:"Reset Languages",resetAll:"Reset all changes",resetConfirmation:"Do you really want to reset the settings?",resetConfirmationMessage:"You will lose all changes",resetConfirmationOk:"Yes, reset the settings",resetConfirmationCancel:"No, cancel",status:{saved:"Saved",unsaved:"Unsaved changes",saving:"Saving...",initial:"Initial"},resetToDefaults:"Reset {0}",defaultSettings:"Default Settings",basic:"Basic",advanced:"Advanced",expert:"Expert",editPresetsList:"Edit Presets list...",editPresetsListTitle:"Edit Presets list",addNewPreset:"Add new preset...",addNewPresetTitle:"Add new preset",deletePreset:"Delete",savedPresets:"Saved presets",license:"<a href='https://surveyjs.io/' target='_blank'>UI Preset Editor</a> is available only with a PRO license. To use it in your application, please <a href='https://surveyjs.io/manage#renewals-and-upgrades' target='_blank'>upgrade your license</a>.",license2:"Your maintenance subscription expired on {date}. You may continue using all <a href='https://surveyjs.io/stay-updated/release-notes' target='_blank'>versions released up to that date</a>. To remove this banner in the latest version, please <a href='https://surveyjs.io/manage#license-manager' target='_blank'>renew your subscription</a> and <a href='https://surveyjs.io/remove-alert-banner' target='_blank'>set up a new license key</a>. Please note <a href='https://surveyjs.io/' target='_blank'>UI Preset Editor</a> is available to all users with an active PRO license.",licenseCreator:"To use the Survey Creator plugin in your application, a <a href='https://surveyjs.io/licensing' target='_blank'>developer license</a> is required. If you have an active license, please <a href='https://surveyjs.io/remove-alert-banner' target='_blank'>set up your license key</a> and ensure you're using the <a href='https://surveyjs.io/stay-updated/release-notes' target='_blank'>latest version</a>. Please note <a href='https://surveyjs.io/' target='_blank'>UI Preset Editor</a> is included only in the PRO license tier.",licenseCreator2:"Your maintenance subscription expired on {date}. You may continue using all <a href='https://surveyjs.io/stay-updated/release-notes' target='_blank'>versions released up to that date</a>. To remove this banner in the latest version, please <a href='https://surveyjs.io/manage#license-manager' target='_blank'>renew your subscription</a> and <a href='https://surveyjs.io/remove-alert-banner' target='_blank'>set up a new license key</a>. Please note <a href='https://surveyjs.io/' target='_blank'>UI Preset Editor</a> is included only in the PRO license tier. To use it in your application, please also <a href='https://surveyjs.io/manage#renewals-and-upgrades' target='_blank'>upgrade your license</a>."}};o.getLocaleStrings("en").presets=S;var _=function(e){function t(){var t=e.call(this)||this;return t.cssClasses={root:"sps-navigation-bar",defaultSizeMode:"",smallSizeMode:"",item:"sps-navigation-bar__item sps-navigation-bar-item",itemWithTitle:"",itemAsIcon:"",itemActive:"sps-navigation-bar-item--active",itemPressed:"sps-navigation-bar-item--pressed",itemIcon:"sps-navigation-bar-item__icon",itemTitle:"sps-navigation-bar-item__title",itemTitleWithIcon:""},t}return s(t,e),t}(t.ActionContainer),P=function(e){function n(n,i,s){var r=e.call(this)||this;return r.creatorValue=i,r.defaultJsonValue=s,r.applying=!1,o.editorLocalization.presetStrings=void 0,r.presetValue=new o.UIPreset(n),r.creatorValue||(r.creatorValue=r.createCreator({})),r.modelValue=r.createModel(),r.resultModelValue=r.createResultModel(),r.locTitle=new t.LocalizableString(void 0,!1),r.locTitle.text=o.getLocString("presets.editor.title"),r.navigationBarValue=new _,r.preset.setJson(r.getJsonFromSurveyModel()),r}return s(n,e),Object.defineProperty(n.prototype,"navigationBar",{get:function(){return this.navigationBarValue},enumerable:!1,configurable:!0}),n.prototype.dispose=function(){e.prototype.dispose.call(this),this.disposeModel()},n.prototype.disposeModel=function(){this.resetAllPages(),this.model.editablePresets.forEach(function(e){return e.dispose()}),this.model.dispose()},Object.defineProperty(n.prototype,"preset",{get:function(){return this.presetValue},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"creator",{get:function(){return this.creatorValue},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"model",{get:function(){return this.modelValue},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"resultModel",{get:function(){return this.upldateResultJson(),this.resultModelValue},enumerable:!1,configurable:!0}),n.prototype.getLocale=function(){return o.editorLocalization.currentLocale||"en"},Object.defineProperty(n.prototype,"json",{get:function(){return this.preset.getJson()},set:function(e){this.preset.setJson(e),this.updateDataFromJson(this.modelValue),this.upldateResultJson()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"jsonText",{get:function(){return JSON.stringify(this.json,null,2)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"defaultJson",{get:function(){return this.defaultJsonValue},enumerable:!1,configurable:!0}),n.prototype.createCreator=function(e){return new o.SurveyCreatorModel(e)},n.prototype.resetAllPages=function(){var e=this;this.model.editablePresets.forEach(function(t){return t.setupOnCurrentPage(e.model,e.creator,!0)}),this.creator.readOnly=!1},n.prototype.resetToDefaults=function(e){var t=this;e||this.notify(o.getLocString("presets.editor.resetToDefaults")),this.model.editablePresets.forEach(function(o){e&&o.pageName!=e||o.resetToDefaults(t.model,!!e)})},n.prototype.activatePage=function(e,t,o){var n=this,i=o.filter(function(t){return e.currentPage.name!==t.pageName}),s=o.filter(function(t){return e.currentPage.name===t.pageName})[0];i.forEach(function(t){return t.setupOnCurrentPage(e,n.creator,!1)}),s.setupOnCurrentPage(e,this.creator,!0)},n.prototype.notify=function(e){this.creator.notify(e)},n.prototype.updateDataFromJson=function(e){var t=this,n=this.preset.getJson()||{};return o.editorLocalization.presetStrings=n.localization,e.editablePresets.forEach(function(o){return o.setupQuestions(e,t)}),e.editablePresets.forEach(function(o){return o.setupQuestionsValue(e,n[o.path],t.creator)}),this.updateJsonLocalizationStrings(e.editablePresets),n},n.prototype.onLocaleChanged=function(){var e=this,t=this.preset.getJson();this.model.editablePresets.forEach(function(o){return o.onLocaleChanged(e.model,t[o.path],e.creator)})},n.prototype.createModel=function(){var e=this,n=this.createEditablePresets(),i=new t.SurveyModel(this.getEditModelJson(n));function s(e){e.isDescendantOf("matrixdynamic")&&(e.onCreateDetailPanelRenderedRowCallback=function(e){e.cells=[e.cells[1]],e.cells[0].colSpans+=2})}return i.css=u,i.editablePresets=n,i.keepIncorrectValues=!0,i.showNavigationButtons=!1,i.completeText=o.getLocString("presets.editor.completeText"),i.pagePrevText=o.getLocString("presets.editor.pagePrevText"),i.enterKeyAction="loseFocus",i.fitToContainer=!1,n.forEach(function(t){return t.notifyCallback=function(t){return e.notify(t)}}),this.defaultJsonValue||(this.defaultJsonValue={},n.forEach(function(t){return e.defaultJsonValue[t.path]=t.getDefaultJsonValue(e.creator)})),this.updateDataFromJson(i),this.activatePage(i,this.creator,n),i.onCurrentPageChanged.add(function(t,o){e.activatePage(i,e.creator,n)}),i.onValueChanged.add(function(t,o){var s,r=n.filter(function(e){return!e.isSettingUp}).map(function(e){return e.questionNames}).reduce(function(e,t){return e.concat(t)},[]);n.forEach(function(e){return e.updateOnValueChanged(i,o.name)}),-1==r.indexOf(o.name)||e.applying||(e.applyFromSurveyModel(!1),e.activatePage(i,e.creator,n),null===(s=e.onJsonChangedCallback)||void 0===s||s.call(e))}),i.onGetQuestionTitleActions.add(function(t,o){n.forEach(function(t){o.question.name==t.getNavigationElementName()&&(o.question.getTitleToolbar().isResponsivenessDisabled=!0,o.actions=i.navigationBar.actions),t.onGetQuestionTitleActions(i,e.creator,o)})}),i.onGetPanelTitleActions.add(function(t,o){n.forEach(function(t){o.panel.name==t.getNavigationElementName()&&(o.panel.getTitleToolbar().isResponsivenessDisabled=!0,o.actions=i.navigationBar.actions),t.onGetPanelTitleActions(i,e.creator,o)})}),i.getAllQuestions().forEach(function(e){return s(e)}),i.onQuestionCreated.add(function(e,t){s(t.question)}),i.onMatrixDetailPanelVisibleChanged.add(function(t,o){n.forEach(function(t){return t.updateOnMatrixDetailPanelVisibleChanged(i,e.creator,o)})}),i.onGetMatrixRowActions.add(function(t,o){n.forEach(function(t){return t.onGetMatrixRowActions(i,e.creator,o)})}),i.onMatrixRowDragOver.add(function(t,o){n.forEach(function(t){return t.onMatrixRowDragOver(i,e.creator,o)})}),i.onMatrixRowRemoving.add(function(t,o){n.forEach(function(t){return t.onMatrixRowRemoving(i,e.creator,o)})}),i.onMatrixRowAdded.add(function(t,o){n.forEach(function(t){return t.onMatrixRowAdded(i,e.creator,o)})}),i.onMatrixCellValueChanged.add(function(t,o){n.forEach(function(t){return t.onMatrixCellValueChanged(i,e.creator,o)})}),i.onUpdateQuestionCssClasses.add(function(e,t){n.forEach(function(e){var o=e.getCustomQuestionCssSuffix(t.question);o&&(t.cssClasses.mainRoot+=" sps-question--"+o),e.getMainElementNames().indexOf(t.question.name)>=0&&(t.cssClasses.mainRoot+=" sps-question--main",t.cssClasses.row+=" sps-table__row--main",t.cssClasses.buttonAdd+=" sps-matrixdynamic__add-btn--icon",t.cssClasses.iconAdd="sps-matrixdynamic__add-btn-icon",t.cssClasses.iconAddId="#icon-add-24x24")})}),i.onUpdatePanelCssClasses.add(function(e,t){n.forEach(function(e){t.panel.name===e.getNavigationElementName()&&(t.cssClasses.panel.container+=" sps-panel--navigation ")})}),i.onUpdatePageCssClasses.add(function(e,t){n.forEach(function(e){e.pageName===t.page.name&&(t.cssClasses.page.root+=" sps-page--"+e.fullPath)})}),i},n.prototype.createResultModel=function(){var e=this,n=new t.SurveyModel({elements:[{type:"html",name:"q1",html:this.getResultHtml()},{type:"comment",name:"json",title:o.getLocString("presets.editor.presetJson"),rows:60,cols:120,readOnly:!0}]});return n.showPrevButton=!1,n.showCompleteButton=!1,n.showQuestionNumbers=!1,n.width="900px",n.onGetQuestionTitleActions.add(function(t,n){if("json"===n.question.name){var i=n.question;n.actions.push({id:"json_copy",iconName:"icon-copy",title:o.getLocString("presets.editor.copy"),action:function(){navigator.clipboard.writeText(i.value)}}),n.actions.push({id:"json_download",iconName:"icon-download",title:o.getLocString("presets.editor.download"),action:function(){e.downloadJsonFile(i.value)}}),n.actions.push({id:"icon-load",iconName:"icon-load",title:o.getLocString("presets.editor.load"),action:function(){e.loadJsonFile()}})}}),n},n.prototype.getResultHtml=function(){return"<div>".concat(o.getLocString("presets.editor.usageExample"),"</div>")},n.prototype.downloadJsonFile=function(e){var o=t.DomDocumentHelper.getDocument();e||(e=this.jsonText);var n=new Blob([e],{type:"application/json"}),i=o.createElement("a");i.href=URL.createObjectURL(n),i.download="preset.json",o.body.appendChild(i),i.click(),o.body.removeChild(i)},n.prototype.loadJsonFile=function(){var e=this;o.CreatorDomHelper.openFileDialog(function(t){return e.importFromFile(t)},".json")},n.prototype.importFromFile=function(e){var t=this,o=new FileReader;o.onload=function(e){var n=o.result;t.json=JSON.parse(n)},o.readAsText(e)},n.prototype.upldateResultJson=function(){this.resultModelValue.getQuestionByName("json").value=this.jsonText},n.prototype.applyFromSurveyModel=function(e){return void 0===e&&(e=!0),this.applying=!0,e&&!this.validateEditableModel(this.model)?(this.applying=!1,!1):(this.preset.setJson(this.getJsonFromSurveyModel()),this.model.setValue("json_result",JSON.stringify(this.preset.getJson(),null,2)),this.preset.apply(this.creator,!0),this.applying=!1,!0)},n.prototype.getJsonFromSurveyModel=function(){var e=this,t={};return this.model.editablePresets.forEach(function(o){var n,i=o.getJsonValue(e.model,e.creator,null===(n=e.defaultJsonValue)||void 0===n?void 0:n[o.path]);i&&(t[o.path]=i)}),this.getJsonLocalizationStrings(t),t},n.prototype.getJsonLocalizationStrings=function(e){var t=this,o={};this.model.editablePresets.forEach(function(e){e.setJsonLocalizationStrings(t.model,o)}),this.json&&this.json.localization&&(e.localization=JSON.parse(JSON.stringify(this.json.localization)));var n=this.getLocale();Object.keys(o).length>0?(e.localization||(e.localization={}),e.localization[n]=o):e.localization&&(e.localization[n]&&delete e.localization[n],0===Object.keys(e.localization).length&&delete e.localization)},n.prototype.updateJsonLocalizationStrings=function(e){var t=(this.json&&this.json.localization?JSON.parse(JSON.stringify(this.json.localization)):{})[this.getLocale()]||{};e.forEach(function(e){e.updateJsonLocalizationStrings(t)})},n.prototype.validateEditableModel=function(e){if(!e.validate(!0,!0))return!1;for(var t=e.editablePresets,o=0;o<t.length;o++)if(!t[o].validate(e))return!1;return!0},n.prototype.createEditableCore=function(e,t){return"languages"===t?new w(e):"tabs"===t?new C(e):"toolbox"===t?new g(e):"propertyGrid"===t?new b(e):"options"===t?new x(e):void 0},n.prototype.createEditable=function(e,t,o){var n=this,i=this.createEditableCore(e,o);return i&&e.children.forEach(function(e){var t=n.createEditable(e,i,o+"_"+e.getPath());t&&(i.children.push(t),t.parent=i)}),i},n.prototype.createEditablePresets=function(){var e=this,t=[];return this.preset.children.forEach(function(o){var n=e.createEditable(o,void 0,o.getPath());n&&t.push(n)}),t},n.prototype.getEditModelJson=function(e){var t={pages:[],showQuestionNumbers:!1};return e.forEach(function(e){var o=e.createPages();Array.isArray(o)&&o.forEach(function(e){return t.pages.push(e)})}),t},n}(t.Base),L=function(){function e(e){this.creator=e,this.unsaved=!1,this.customPresets=[],this._presetsArray=[]}return e.prototype.setStatus=function(e){this.unsaved=e},Object.defineProperty(e.prototype,"isSaved",{get:function(){return!this.unsaved},enumerable:!1,configurable:!0}),e.prototype.getPresetTitle=function(e){return o.getLocString("preset.names."+e)},e.prototype.confirmSwitchPreset=function(e){this.isSaved?e():n(this.creator,{category:"danger",title:o.getLocString("presets.plugin.switchPresetConfirmation"),message:o.getLocString("presets.plugin.switchPresetConfirmationMessage"),applyText:o.getLocString("presets.plugin.switchPresetConfirmationOk"),cancelText:o.getLocString("presets.plugin.switchPresetConfirmationCancel"),iconName:"icon-warning-24x24",showCloseButton:!1,onApply:function(){return e(),!0},onCancel:function(){return!0}})},e.prototype.presetListToItems=function(e){var t=this;return e.filter(function(e){return!1!==o.CreatorPresets[e].visible}).map(function(e){return{id:e,title:t.getPresetTitle(e),action:function(n){t.confirmSwitchPreset(function(){var i;t.presetsList.selectedItem=n,null===(i=t.selectPresetCallback)||void 0===i||i.call(t,o.CreatorPresets[e])})}}})},Object.defineProperty(e.prototype,"presetsMenuItems",{get:function(){var e=this,t=this.presetListToItems(o.PredefinedCreatorPresets),n=this.presetListToItems(this.customPresets),i={id:"editPresetsList",needSeparator:n.length+t.length>0,title:o.getLocString("presets.plugin.editPresetsList"),action:function(){return e.editPresetsList(e.applyPresetsList.bind(e))}};return a(a(a([],t,!0),n,!0),[i],!1)},enumerable:!1,configurable:!0}),e.prototype.setPresetNewName=function(e){var n,i,s=new t.SurveyModel({showNavigationButtons:"none",enterKeyAction:"loseFocus",questionErrorLocation:"bottom",focusFirstQuestionAutomatic:!0,elements:[{type:"dropdown",name:"presetName",allowCustomChoices:!0,choices:this.customPresets.map(function(e){return{value:e,text:e}}),titleLocation:"hidden",requiredErrorText:o.getLocString("presets.editor.required"),isRequired:!0}]});s.css=u,s.questionErrorLocation="bottom";var r=null===(n=t.settings.showDialog)||void 0===n?void 0:n.call(t.settings,{componentName:"survey",data:{survey:s,model:s},onApply:function(){return!!s.validate()&&(e(s.getValue("presetName")),!0)},cssClass:"sps-popup svc-property-editor svc-creator-popup",title:o.getLocString("presets.plugin.saveAsTitle"),displayMode:"popup"},null===(i=this.creator)||void 0===i?void 0:i.rootElement);this.customizePopupButtons(r,o.getLocString("presets.plugin.save"),o.getLocString("presets.plugin.cancel"))},e.prototype.getPresetsListToEdit=function(){var e=this;return a(a([],o.PredefinedCreatorPresets.map(function(t){var n;return{title:e.getPresetTitle(t),name:t,visible:!1!==(null===(n=o.CreatorPresets[t])||void 0===n?void 0:n.visible),custom:!1}}),!0),this.customPresets.map(function(e){return{title:e,name:e,visible:!0,custom:!0}}),!0)},e.prototype.applyPresetsList=function(e){var t,n,i,s,a,l=this;this.customPresets=[];var u={};e.forEach(function(e){if(o.PredefinedCreatorPresets.includes(e.name))o.CreatorPresets[e.name].visible=e.visible;else{var t=(e.title||e.name||"").trim(),n=e.name;if(!t)return;n&&n!==t&&o.CreatorPresets[n]&&(o.CreatorPresets[t]=r(r({},o.CreatorPresets[n]),{presetName:t}),delete o.CreatorPresets[n],u[n]=t),l.customPresets.push(t)}}),this.rebuildPresetsArray(),null===(t=this.onPresetListSaved)||void 0===t||t.call(this,this._presetsArray),this.updateMenu();var p=null===(i=null===(n=this.presetsList)||void 0===n?void 0:n.selectedItem)||void 0===i?void 0:i.id;if(p&&u[p]){var c=null===(a=null===(s=this.presetsList)||void 0===s?void 0:s.getActionById)||void 0===a?void 0:a.call(s,u[p]);c&&this.presetsList.onItemClick(c)}this.ensureSelectedPresetAvailable()},e.prototype.ensureSelectedPresetAvailable=function(){var e,t,n,i,s=null===(t=null===(e=this.presetsList)||void 0===e?void 0:e.selectedItem)||void 0===t?void 0:t.id,r=this.getPresetsListToEdit().filter(function(e){return e.visible}).map(function(e){return e.name});if(!(r.indexOf(s)>=0)){var a=r[0];if(a&&o.CreatorPresets[a]){var l=null===(i=null===(n=this.presetsList)||void 0===n?void 0:n.getActionById)||void 0===i?void 0:i.call(n,a);l&&this.presetsList.onItemClick(l)}}},e.prototype.rebuildPresetsArray=function(){var e=this;this._presetsArray.length=0,a(a([],o.PredefinedCreatorPresets,!0),this.customPresets,!0).forEach(function(t){var n;e._presetsArray.push({name:t,visible:!1!==(null===(n=o.CreatorPresets[t])||void 0===n?void 0:n.visible)})})},e.prototype.getPresetsArray=function(){return this.rebuildPresetsArray(),this._presetsArray},e.prototype.addPresetsListEditor=function(e,i){var s=this,a=new t.QuestionMatrixDynamicModel("presetsList");a.fromJSON({type:"matrixdynamic",name:"presetsList",columns:[{name:"title",title:"Title"},{name:"name",visible:!1},{name:"visible",visible:!1,cellType:"boolean"},{name:"custom",cellType:"boolean",visible:!1,defaultValue:!0}],cellType:"text",rowCount:0,hideColumnsIfEmpty:!0,addRowText:o.getLocString("presets.plugin.addNewPreset"),allowRowReorder:!0,allowCustomChoices:!0,isRequired:!0}),e.onMatrixCellCreated.add(function(e,t){"title"===t.columnName&&(t.cellQuestion.readOnly=!t.row.getValue("custom"))});var l=!1;e.onMatrixRowRemoving.add(function(e,t){t.allow=l,l?l=!1:n(s.creator,{category:"danger",title:o.getLocString("presets.plugin.deleteConfirmation").replace("{0}",t.row.getValue("title")),message:o.getLocString("presets.plugin.deleteConfirmationMessage"),applyText:o.getLocString("presets.plugin.deleteConfirmationOk"),cancelText:o.getLocString("presets.plugin.deleteConfirmationCancel"),iconName:"icon-delete-24x24",showCloseButton:!1,onApply:function(){return l=!0,t.question.removeRow(t.rowIndex),!0},onCancel:function(){return!0}})}),e.onGetMatrixRowActions.add(function(e,n){var i=n.actions.filter(function(e){return"remove-row"==e.id})[0],s=function(e){return e.getValue("visible")?"icon-visible-24x24":"icon-invisible-24x24"},r=new t.Action({id:"visible",iconName:s(n.row),location:"end",css:n.row.getValue("visible")?"":"sps-action--invisible",action:function(){n.row.getQuestionByName("visible").value=!n.row.getValue("visible"),r.iconName=s(n.row),r.css=n.row.getValue("visible")?"":"sps-action--invisible"}});n.actions.push(r),n.row.getValue("custom")?(i.iconName="icon-delete-24x24",i.iconSize="auto",i.component="sv-action-bar-item",i.innerCss="sps-action-button sps-action-button--danger",i.tooltip=o.getLocString("presets.plugin.deletePreset"),i.showTitle=!1,i.action=function(){n.question.removeRowUI(n.row)}):i.visible=!1}),e.onMatrixRowAdding.add(function(e,n){var i,a,l=new t.SurveyModel({showNavigationButtons:"none",enterKeyAction:"loseFocus",questionErrorLocation:"bottom",elements:[{type:"text",name:"presetName",titleLocation:"hidden",isRequired:!0},{type:"buttongroup",name:"template",title:"Template",defaultValue:"basic",choices:[{value:"basic",text:"Basic"},{value:"advanced",text:"Advanced"},{value:"expert",text:"Expert"}]}]});l.css=r(r({},u),{buttongroup:r({},o.propertyGridCss.buttongroup)});var p=null===(i=t.settings.showDialog)||void 0===i?void 0:i.call(t.settings,{componentName:"survey",data:{survey:l,model:l},onApply:function(){if(!l.validate())return!1;var e=l.getValue("presetName"),t=o.CreatorPresets[l.getValue("template")];o.CreatorPresets[e]=t?JSON.parse(JSON.stringify(t)):{presetName:e,json:{}};var i=n.question.value||[];return i.push({title:e,name:e,visible:!0,custom:!0}),n.question.value=i,!0},cssClass:"sps-popup sps-popup--level2 svc-property-editor svc-creator-popup",title:o.getLocString("presets.plugin.addNewPreset"),displayMode:"popup"},null===(a=s.creator)||void 0===a?void 0:a.rootElement);s.customizePopupButtons(p,o.getLocString("presets.plugin.add"),o.getLocString("presets.plugin.discard")),n.allow=!1}),e.pages[0].addQuestion(a),a.value=this.getPresetsListToEdit()},e.prototype.customizePopupButtons=function(e,t,n){if(e.footerToolbar){var i=e.footerToolbar.cssClasses;i.item="sps-btn",e.footerToolbar.cssClasses=i;var s=e.footerToolbar.getActionById("apply"),r=e.footerToolbar.getActionById("cancel");s.innerCss="sps-btn--primary-brand",s.title=t||o.getLocString("buttons.apply"),r.innerCss="sps-btn--secondary-brand",r.css+=" sps-action--grow",r.title=n||o.getLocString("buttons.cancel")}},e.prototype.editPresetsList=function(e){var n,i,s=new t.SurveyModel({showNavigationButtons:"none",enterKeyAction:"loseFocus",questionErrorLocation:"bottom",questionTitleLocation:"hidden",pages:[{name:"page1",elements:[]}]});this.addPresetsListEditor(s),s.css=r(r({},u),{actionBar:r(r({},o.propertyGridCss.actionBar),{itemIcon:u.actionBar.itemIcon+" sps-action-button__icon--muted"}),matrixdynamic:r(r({},o.propertyGridCss.matrixdynamic),{buttonAdd:u.matrixdynamic.buttonAdd,footer:o.propertyGridCss.matrixdynamic.footer+" sps-matrixdynamic__footer--in-dialog"})});var a=null===(n=t.settings.showDialog)||void 0===n?void 0:n.call(t.settings,{componentName:"survey",data:{survey:s,model:s},onApply:function(){return!!s.validate()&&(e(s.getValue("presetsList")),!0)},cssClass:"sps-popup svc-property-editor svc-creator-popup",title:o.getLocString("presets.plugin.editPresetsListTitle"),displayMode:"popup"},null===(i=this.creator)||void 0===i?void 0:i.rootElement);this.customizePopupButtons(a,o.getLocString("presets.plugin.save"),o.getLocString("presets.plugin.discard"))},e.prototype.updateMenu=function(){var e;null===(e=this.presetsList)||void 0===e||e.setItems(this.presetsMenuItems),this.presetSelector&&(this.presetSelector.choices=this.getPresetsListToEdit().filter(function(e){return e.visible}).map(function(e){return{value:e.name,text:e.title}}))},e.prototype.update=function(){this.updateMenu()},e.prototype.saveAs=function(e,t){var o=this;this.setPresetNewName(function(n){o.addPreset({presetName:n,json:e}),t(n),o.presetsList.onItemClick(o.presetsList.getActionById(n))})},e.prototype.addPreset=function(e){var t=null==e?void 0:e.presetName;if(t){var n=o.CreatorPresets[t];o.CreatorPresets[t]=n?r(r({},n),e):e,-1===o.PredefinedCreatorPresets.indexOf(t)&&-1===this.customPresets.indexOf(t)&&this.customPresets.push(t),this.rebuildPresetsArray(),this.updateMenu()}},e.prototype.removePreset=function(e){delete o.CreatorPresets[e],this.customPresets=this.customPresets.filter(function(t){return t!==e}),this.rebuildPresetsArray(),this.updateMenu(),this.ensureSelectedPresetAvailable()},e.prototype.getPreset=function(e){return o.CreatorPresets[e]},e.prototype.getCurrentPreset=function(){var e,t,n=null===(t=null===(e=this.presetsList)||void 0===e?void 0:e.selectedItem)||void 0===t?void 0:t.id;return n?o.CreatorPresets[n]:void 0},e}(),T=function(){function e(n){var i=this;this.creator=n,this.activeTab="designer",this.currentPresetIndex=0,this.saveCount=0,this.onPresetListSaved=new t.EventBase,this.saveToFileHandler=o.saveToFileHandler,this.preventTabSwitch=function(e,t){t.allow=!1},n.addTab({name:"presets",title:o.getLocString("presets.plugin.presetsTab"),plugin:this,iconName:e.iconName,isInternal:!0}),this.designerPlugin=n.getPlugin("designer");var s=this.creator.sidebar.getPageById("creatorTheme");s.componentData.elements[0].componentName="svc-presets-property-grid",s.componentData.elements[0].componentData.model.showPresets=function(){return i.showPresets()},this.toolboxCompact=n.toolbox.forceCompact,this.presetsManager=new L(n),this.presetsManager.onPresetListSaved=function(e){i.onPresetListSaved.fire(i,{presets:e})},this.presetsManager.selectPresetCallback=function(e){i.model.json=e.json,i.setStatus("initial")},this.creator.onSurveyInstanceCreated.add(function(e,t){"designer-tab:creator-settings:preset"==t.area&&(i.presetsManager.presetSelector=t.survey.getQuestionByName("presetName"),i.presetsManager.update())})}return e.prototype.showPresets=function(){this.activeTab=this.creator.activeTab,this.creator.activeTab="presets"},e.prototype.hidePresets=function(){this.presetsManager&&!this.presetsManager.isSaved&&(this.model.json=this.defaultJson,this.model.applyFromSurveyModel(!1)),this.presetsManager.update(),this.presetsManager.presetSelector.value=this.presetsList.selectedItem.id,this.creator.onActiveTabChanging.remove(this.preventTabSwitch),this.creator.activeTab=this.activeTab},e.prototype.confirmReset=function(e){n(this.creator,{category:"danger",title:o.getLocString("presets.plugin.resetConfirmation"),message:o.getLocString("presets.plugin.resetConfirmationMessage"),applyText:o.getLocString("presets.plugin.resetConfirmationOk"),cancelText:o.getLocString("presets.plugin.resetConfirmationCancel"),iconName:"icon-warning-24x24",showCloseButton:!1,onApply:function(){return e(),!0},onCancel:function(){return!0}})},e.prototype.confirmQuit=function(e,t){n(this.creator,{title:o.getLocString("presets.plugin.quitConfirmation"),message:o.getLocString("presets.plugin.quitConfirmationMessage"),applyText:o.getLocString("presets.plugin.quitConfirmationSave"),cancelText:o.getLocString("presets.plugin.quitConfirmationDiscard"),iconName:"icon-warning-24x24",showCloseButton:!0,onApply:function(){return e(),!0},onCancel:function(){return t(),!0}})},e.prototype.addPreset=function(e){this.presetsManager.addPreset({presetName:e.name,json:e.getJson()})},e.prototype.removePreset=function(e){this.presetsManager.removePreset("string"==typeof e?e:e.name)},e.prototype.getPreset=function(e){return this.presetsManager.getPreset(e)},e.prototype.getCurrentPreset=function(){return this.presetsManager.getCurrentPreset()},Object.defineProperty(e.prototype,"presets",{get:function(){return this.presetsManager.getPresetsArray()},enumerable:!1,configurable:!0}),e.prototype.performSave=function(e){var t=this;void 0===e&&(e=!1),this.savePresetFunc?(this.setStatus("saving"),this.savePresetFunc(this.saveCount,function(){t.saveHandler(e)})):this.saveHandler(e)},e.prototype.saveOrSaveAs=function(e){var t;void 0===e&&(e=!1);var n=null===(t=this.getCurrentPreset())||void 0===t?void 0:t.presetName;n&&-1===o.PredefinedCreatorPresets.indexOf(n)?this.performSave(e):this.saveAsHandler(e)},e.prototype.saveHandler=function(e){void 0===e&&(e=!1),this.defaultJson=JSON.parse(JSON.stringify(this.model.json)),this.saveCount++,this.setStatus("saved"),e&&this.hidePresets()},e.prototype.saveAsHandler=function(e){var t=this;void 0===e&&(e=!1),this.presetsManager.saveAs(this.model.json,function(){t.performSave(e)})},e.prototype.setStatus=function(e){this.presetsManager.setStatus("unsaved"===e);var t=this.model.navigationBar.getActionById("presets-status");t.visible="unsaved"===e,t.title=o.getLocString("presets.plugin.status."+e.toLowerCase())},e.prototype.activate=function(){var e,n=this;this.creator.onActiveTabChanging.add(this.preventTabSwitch),this.model=new P({},this.creator,this.defaultJson),this.defaultJson=r({},this.model.defaultJson),this.currentValue&&(this.model.model.data=this.currentValue),this.designerPlugin.activateSidebar();var i=null===(e=this.model)||void 0===e?void 0:e.model.pages.map(function(e){return{id:e.name,title:e.navigationTitle}});this.model.model.onComplete.add(function(){return n.hidePresets()});var s=this.presetsManager.presetsMenuItems,a=[{id:"save",title:o.getLocString("presets.plugin.save"),action:function(){return n.saveOrSaveAs()}},{id:"saveAs",title:o.getLocString("presets.plugin.saveAs"),action:function(){return n.saveAsHandler()}},{id:"import",title:o.getLocString("presets.plugin.import"),markerIconName:"import-24x24",needSeparator:!0,action:function(e){var t;null===(t=n.model)||void 0===t||t.loadJsonFile()}},{id:"export",title:o.getLocString("presets.plugin.export"),markerIconName:"download-24x24",action:function(e){var t;null===(t=n.model)||void 0===t||t.downloadJsonFile()}},{id:"reset-current",title:o.getLocString("presets.plugin.resetLanguages"),needSeparator:!0,action:function(){n.confirmReset(function(){var e;return null===(e=n.model)||void 0===e?void 0:e.resetToDefaults("page_languages")})}},{id:"reset",title:o.getLocString("presets.plugin.resetAll"),css:"sps-list__item--alert",action:function(){n.confirmReset(function(){var e;return null===(e=n.model)||void 0===e?void 0:e.resetToDefaults()})}}];i.forEach(function(e){e.action=function(e){n.pagesList.selectedItem=e,n.model&&(n.model.model.currentPage=n.model.model.getPageByName(e.id))}});var l,u={showPointer:!1,verticalPosition:"bottom",horizontalPosition:"center",searchEnabled:!1,cssClass:"sps-popup-menu sps-popup-menu--dropdown",cssClasses:c},p=t.createDropdownActionModel({items:[],id:"presets-list",iconName:"icon-chevron_16x16",iconSize:16,title:o.getLocString("presets.plugin.creatorPresets"),css:"sps-navigation-action"},r(r({},u),{items:s,onSelectionChanged:function(e){"editPresetsList"===e.id?(n.presetsList.selectedItem=l,(null==l?void 0:l.title)&&(p.title=l.title)):l=e},onBlur:function(){p.popupModel.hide()}}),this.model.model),d=t.createDropdownActionModel({items:[],id:"presets-pages",iconName:"icon-chevron_16x16",iconSize:16,title:o.getLocString("presets.plugin.select"),css:"sps-navigation-action"},r(r({},u),{items:i,onBlur:function(){d.popupModel.hide()}}),this.model.model),m=t.createDropdownActionModel({items:[],id:"presets-edit",iconName:"icon-chevron_16x16",iconSize:16,title:o.getLocString("presets.plugin.edit"),css:"sps-navigation-action"},r(r({},u),{onSelectionChanged:function(){m.title=o.getLocString("presets.plugin.edit")},items:a,onBlur:function(){m.popupModel.hide()}}),this.model.model),g=new t.Action({id:"presets-status",enabled:!1,visible:!1,title:"Saved",css:"sps-navigation-action sps-navigation-action--label sps-navigation-action--large-icon"}),h=new t.Action({id:"presets-quit",iconName:"icon-exit-24x24",title:o.getLocString("presets.plugin.quit"),css:"sps-navigation-action sps-navigation-action--right sps-navigation-action--large-icon",action:function(){n.presetsManager.isSaved?n.hidePresets():n.confirmQuit(function(){return n.saveOrSaveAs(!0)},function(){return n.hidePresets()})}});this.designerPlugin.tabControlModel.bottomToolbar.actions.forEach(function(e){return e.visible=!1}),s.length>0&&this.model.navigationBar.addAction(p),this.model.navigationBar.addAction(d),this.model.navigationBar.addAction(m),this.model.navigationBar.addAction(g),this.model.navigationBar.addAction(h),this.pagesList=d.popupModel.contentComponentData.model,this.presetsList=p.popupModel.contentComponentData.model,this.presetsManager.presetsList=this.presetsList;var f=m.popupModel.contentComponentData.model.getActionById("reset-current");this.saveAction=m.popupModel.contentComponentData.model.getActionById("save"),this.pagesList.selectedItem=this.pagesList.actions[0],d.title=this.pagesList.selectedItem.title||"",this.model.model.onCurrentPageChanged.add(function(e,t){n.pagesList.selectedItem=n.pagesList.actions[n.model.model.currentPageNo],d.title=n.pagesList.selectedItem.title||"",f.title=o.getLocString("presets.plugin.resetToDefaults").replace("{0}",n.model.model.currentPage.navigationTitle),f.action=function(){var e;null===(e=n.model)||void 0===e||e.resetToDefaults(n.pagesList.selectedItem.id)}}),this.model.onJsonChangedCallback=function(){n.setStatus("unsaved")},this.presetsList.selectedItem=this.presetsList.actions.filter(function(e){var t;return e.id==(null===(t=n.presetsManager.presetSelector)||void 0===t?void 0:t.value)})[0],l=this.presetsList.selectedItem,this.presetsList.selectedItem&&(this.presetsList.selectedItem.action(this.presetsList.selectedItem),p.title=this.presetsList.selectedItem.title||""),setTimeout(function(){i[n.currentPresetIndex].action(i[n.currentPresetIndex])},100)},e.prototype.deactivate=function(){var e,t;return this.creator.toolbox.forceCompact=this.toolboxCompact,this.currentValue=null===(e=this.model)||void 0===e?void 0:e.model.data,this.designerPlugin.tabControlModel.bottomToolbar.actions.forEach(function(e){return e.visible=!0}),this.currentPresetIndex=(null===(t=this.model)||void 0===t?void 0:t.model.currentPageNo)||0,this.model&&this.model.dispose(),this.model=void 0,!0},e.prototype.onLocaleChanged=function(){this.model&&this.model.onLocaleChanged()},e.prototype.getLicenseText=function(e,n){var i,s;if(!(null===t.hasLicense||void 0===t.hasLicense?void 0:t.hasLicense(8))){var r=null===(s=null===(i=null===t.glc||void 0===t.glc?void 0:t.glc(8))||void 0===i?void 0:i.toLocaleDateString)||void 0===s?void 0:s.call(i);return r?o.getLocString("presets.plugin.license2").replace("{date}",r):e?o.getLocString("presets.plugin.license"):n?o.getLocString("presets.plugin.licenseCreator2").replace("{date}",n):o.getLocString("presets.plugin.licenseCreator")}return""},e.defaultPresetName="expert",e.iconName="icon-settings",e}(),I=function(e){function n(t){var o=e.call(this,t)||this;return o.jsonErrors=[],o}return s(n,e),n.prototype.getType=function(){return"presetjson"},n.prototype.getCssType=function(){return"comment"},n.prototype.getTemplate=function(){return"comment"},Object.defineProperty(n.prototype,"textAreaModel",{get:function(){var e=this;if(!this.jsonAreaModelValue){var n=this.getTextAreaOptions(),i=this;n.getTextValue=function(){return JSON.stringify(e.value,null,2)},n.onTextAreaChange=function(n){!function(n){if(t.Helpers.isTwoValueEquals(JSON.stringify(i.value,null,2),n,!1,!0,!1))e.jsonErrors=[];else try{var s=(new o.SurveyJSON5).parse(n),a=r(r({},s),{name:"temp"}),l=new t.JsonObject;if(l.toObject({elements:[a]},new t.SurveyModel),e.jsonErrors=l.errors.map(function(e){return e.message}),e.jsonErrors.length>0)return;i.value=s}catch(t){e.jsonErrors=[t.message]}}(n.target.value)},this.jsonAreaModelValue=new t.TextAreaModel(n)}return this.jsonAreaModelValue},enumerable:!1,configurable:!0}),n.prototype.onCheckForErrors=function(o,n,i){var s=this;e.prototype.onCheckForErrors.call(this,o,n,i),this.jsonErrors.forEach(function(e){o.push(new t.CustomError(e,s))})},n}(t.QuestionCommentModel);t.ElementFactory.Instance.registerElement("presetjson",function(e){return new I(e)},!1),t.Serializer.addClass("presetjson",[],function(){return new I("")},"comment"),e.Version=void 0,e.Version="".concat("2.5.26"),t.checkLibraryVersion(e.Version,"survey-creator-core-presets"),e.CreatorPresetEditableBase=l,e.CreatorPresetEditableLanguages=w,e.CreatorPresetEditableOptions=x,e.CreatorPresetEditableTabs=C,e.CreatorPresetEditableToolboxConfigurator=g,e.CreatorPresetEditorModel=P,e.NavigationBar=_,e.PresetsManager=L,e.QuestionPresetJsonModel=I,e.UIPresetEditor=T,e.enStrings=S,e.showConfirmDialog=n});
7
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("survey-core"),require("survey-creator-core")):"function"==typeof define&&define.amd?define(["exports","survey-core","survey-creator-core"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SurveyCreatorUIPresetEditorCore={},e.Survey,e.SurveyCreatorCore)}(this,function(e,t,o){"use strict";function n(e,n){var i=new t.LocalizableString(void 0,!1);i.defaultValue=n.title;var s=new t.LocalizableString(void 0,!1);s.defaultValue=n.message;var r=new o.ComponentContainerModel;r.elements=[{componentName:"sv-string-viewer",componentData:{locStr:i,locString:i,model:i,textClass:"svc-creator-confirm-dialog__title"}},{componentName:"sv-string-viewer",componentData:{locStr:s,locString:s,model:s,textClass:"svc-creator-confirm-dialog__message"}}],r.cssClass="svc-creator-confirm-dialog__title-container";var a="svc-creator-confirm-dialog__icon"+("danger"===n.category?" svc-creator-confirm-dialog__icon--danger":""),l=[{componentName:"sv-svg-icon",componentData:{iconName:n.iconName,size:"auto",className:a,class:a,partCss:a}},{componentName:"svc-component-container",componentData:{model:r}}],u=new o.ComponentContainerModel;u.elements=l,u.cssClass="svc-creator-confirm-dialog__content-container";var p=t.settings.showDialog({componentName:"svc-component-container",data:{model:u},onApply:function(){return n.onApply()},onCancel:function(){return n.onCancel()},cssClass:"sps-popup svc-creator-popup svc-creator-confirm-dialog",displayMode:"popup",showCloseButton:n.showCloseButton},e.rootElement),c=p.footerToolbar.cssClasses;c.item="sps-btn",p.footerToolbar.cssClasses=c;var d=p.footerToolbar.getActionById("apply"),m=p.footerToolbar.getActionById("cancel");return d.title=n.applyText,d.innerCss="danger"===n.category?"sps-btn--secondary-alert":"sps-btn--primary-neutral",m.title=n.cancelText,m.innerCss="sps-btn--secondary-neutral",p}var i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])},i(e,t)};function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}var r=function(){return r=Object.assign||function(e){for(var t,o=1,n=arguments.length;o<n;o++)for(var i in t=arguments[o])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)};function a(e,t,o){if(o||2===arguments.length)for(var n,i=0,s=t.length;i<s;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var l=function(){function e(e){this.preset=e,this.children=[],this.notifyCallback=function(e){}}return Object.defineProperty(e.prototype,"navigationPanelName",{get:function(){return this.path+"_navigation"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSettingUp",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"path",{get:function(){return this.preset.getPath()},enumerable:!1,configurable:!0}),e.prototype.getJsonPath=function(e){return this.path},Object.defineProperty(e.prototype,"fullPath",{get:function(){var e=this.parent?this.parent.fullPath:"";return this.path&&e&&(e+="_"),e+this.path},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageName",{get:function(){return"page_"+this.fullPath},enumerable:!1,configurable:!0}),e.prototype.getPageTitle=function(e){return e.getPageByName(this.pageName).title},e.prototype.getPageShortTitle=function(e){return e.getPageByName(this.pageName).navigationTitle},Object.defineProperty(e.prototype,"mainPanelName",{get:function(){return this.path+"_mainPanel"},enumerable:!1,configurable:!0}),e.prototype.getMainElementNames=function(){return[this.mainPanelName]},e.prototype.getMainPanelName=function(){return this.mainPanelName},e.prototype.getCustomQuestionCssSuffix=function(e){return""},e.prototype.createPages=function(){var e=[],t=this.createMainPage();return t&&e.push(t),this.children.forEach(function(t){var o=t.createPages();Array.isArray(o)&&o.forEach(function(t){return e.push(t)})}),e},Object.defineProperty(e.prototype,"questionNames",{get:function(){return[]},enumerable:!1,configurable:!0}),e.prototype.validate=function(e){if(!this.validateCore(e))return!1;for(var t=0;t<this.children.length;t++)if(!this.children[t].validate(e))return!1;return!0},e.prototype.validateCore=function(e){return!0},e.prototype.createMainPage=function(){var e=this.createMainPageCore();return e&&(e.name=this.pageName),e},e.prototype.getBoolVisibleIf=function(e,t){return void 0===t&&(t=!0),"{"+e+"}="+(t?"true":"false")},e.prototype.getTextVisibleIf=function(e,t){return"{"+e+"}='"+t+"'"},e.prototype.getNotEmptyVisibleIf=function(e){return"{"+e+"} notempty"},e.prototype.createMainPageCore=function(){},e.prototype.getNavigationElementName=function(){return this.navigationPanelName},e.prototype.getJsonValue=function(e,t,o){var n=e.getPageByName(this.pageName),i=n&&n.isVisible?this.getJsonValueCore(e,t,o):void 0,s=!!i,r=s?i:{};return this.children.forEach(function(o){var n=o.getJsonValue(e,t);n&&(s=!0,r[o.getJsonPath(e)]=n)}),s?r:void 0},e.prototype.getDefaultJsonValue=function(e){var t=this.getDefaultJsonValueCore(e);return this.children.forEach(function(o){return t[o.path]=o.getDefaultJsonValueCore(e)}),t},e.prototype.setJsonLocalizationStrings=function(e,t){this.setJsonLocalizationStringsCore(e,t),this.children.forEach(function(o){return o.setJsonLocalizationStrings(e,t)})},e.prototype.updateJsonLocalizationStrings=function(e){this.updateJsonLocalizationStringsCore(e),this.children.forEach(function(t){return t.updateJsonLocalizationStrings(e)})},e.prototype.dispose=function(){this.disposeCore(),this.children.forEach(function(e){return e.dispose()})},e.prototype.setupQuestions=function(e,t){this.setupQuestionsCore(e,t),this.children.forEach(function(o){o.setupQuestions(e,t)})},e.prototype.resetToDefaults=function(e,t){void 0===t&&(t=!0),this.restoreValuesFromDefault(e),this.notifyCallback(this.getPageTitle(e)+" "+o.getLocString("presets.editor.resoredToDefault")),this.children.forEach(function(o){o.resetToDefaults(e,t)})},e.prototype.setupOnCurrentPage=function(e,t,o){this.setupOnCurrentPageCore(e,t,o),this.children.forEach(function(n){n.setupOnCurrentPage(e,t,o)})},e.prototype.updateOnValueChanged=function(e,t){this.updateOnValueChangedCore(e,t),this.children.forEach(function(o){o.updateOnValueChanged(e,t)})},e.prototype.updateOnMatrixDetailPanelVisibleChanged=function(e,t,o){this.updateOnMatrixDetailPanelVisibleChangedCore(e,t,o),this.children.forEach(function(n){n.updateOnMatrixDetailPanelVisibleChanged(e,t,o)})},e.prototype.onGetMatrixRowActions=function(e,t,o){this.onGetMatrixRowActionsCore(e,t,o),this.children.forEach(function(n){n.onGetMatrixRowActions(e,t,o)})},e.prototype.onGetQuestionTitleActions=function(e,t,o){},e.prototype.onGetPanelTitleActions=function(e,t,o){},e.prototype.onMatrixRowDragOver=function(e,t,o){},e.prototype.onMatrixRowRemoving=function(e,t,o){},e.prototype.onMatrixRowAdded=function(e,t,o){},e.prototype.onMatrixCellValueChanged=function(e,t,o){},e.prototype.setupQuestionsValue=function(e,t,o){this.setupQuestionsValueCore(e,t,o),this.saveValuesAsDefault(e),this.children.forEach(function(n){n.setupQuestionsValue(e,t?t[n.path]:void 0,o)})},e.prototype.onLocaleChanged=function(e,t,o){this.onLocaleChangedCore(e,t,o),this.children.forEach(function(n){n.setupQuestionsValue(e,t?t[n.path]:void 0,o)})},e.prototype.saveValuesAsDefault=function(e){this.questionNames.forEach(function(t){return e.getQuestionByName(t).defaultValue=e.getValue(t)&&JSON.parse(JSON.stringify(e.getValue(t)))})},e.prototype.restoreValuesFromDefault=function(e){this.questionNames.forEach(function(t){return e.getQuestionByName(t).value=e.getQuestionByName(t).defaultValue&&JSON.parse(JSON.stringify(e.getQuestionByName(t).defaultValue))})},e.prototype.setupQuestionsCore=function(e,t){},e.prototype.resetToDefaultsCore=function(e){},e.prototype.setupQuestionsValueCore=function(e,t,o){},e.prototype.onLocaleChangedCore=function(e,t,o){},e.prototype.getJsonValueCore=function(e,t,o){},e.prototype.getDefaultJsonValueCore=function(e){return{}},e.prototype.setJsonLocalizationStringsCore=function(e,t){},e.prototype.updateJsonLocalizationStringsCore=function(e){},e.prototype.disposeCore=function(){},e.prototype.setupOnCurrentPageCore=function(e,t,o){},e.prototype.updateOnValueChangedCore=function(e,t){},e.prototype.updateOnMatrixDetailPanelVisibleChangedCore=function(e,t,o){},e.prototype.onGetMatrixRowActionsCore=function(e,t,o){},e.prototype.copyJson=function(e){return t.Helpers.getUnbindValue(e)},e.updateModifiedText=function(t,n,i){if(i&&n){var s=o.editorLocalization.presetStrings;o.editorLocalization.presetStrings=void 0,n!==o.editorLocalization.getString(i)&&e.saveTextInLocStrs(t,n,i),o.editorLocalization.presetStrings=s}},e.saveTextInLocStrs=function(e,t,o){for(var n=o.split("."),i=0;i<n.length-1;i++){var s=n[i];e[s]||(e[s]={}),e=e[s]}e[n[n.length-1]]=t},e}(),u={root:"sps-root-modern",container:"sps-container-modern",header:"sps-title sps-container-modern__title",body:"sps-body",bodyEmpty:"sps-body sps-body--empty",footer:"sps-footer sps-body__footer sps-clearfix",title:"",description:"",logo:"sps-logo",logoImage:"sps-logo__image",headerText:"sps-header__text",navigationButton:"",bodyNavigationButton:"",completedPage:"sps-completedpage",navigation:{complete:"sps-btn sps-btn--primary-brand sps-footer__complete-btn",prev:"sps-btn sps-btn--secondary-brand sps-footer__prev-btn",next:"sps-btn sps-btn--primary-brand sps-footer__next-btn",start:"sps-btn sps-footer__start-btn",preview:"sps-btn sps-footer__preview-btn",edit:"sps-btn sps-footer__edit-btn"},list:JSON.parse(JSON.stringify(o.listComponentCss)),panel:{withFrame:"sps-panel--with-frame",nested:"sps-panel--nested",expandableAnimating:"",header:"sps-panel__header",title:"sps-title sps-panel__title",titleBar:"sd-action-title-bar sps-action-title-bar",contentEnter:"sps-panel__content--enter",contentLeave:"sps-panel__content--leave",titleExpandable:"sps-panel__title--expandable",titleExpanded:"sps-panel__title--expanded",titleCollapsed:"sps-panel__title--collapsed",titleOnError:"sps-panel__title--error",description:"sps-description sps-panel__description",container:"sps-panel sps-row__panel",content:"sps-panel__content",icon:"sps-panel__icon",iconExpanded:"sps-panel__icon--expanded",footer:"sps-panel__footer",requiredMark:"sps-panel__required-text",collapsed:"sps-panel--collapsed",expanded:"sps-panel--expanded"},paneldynamic:{nested:"",mainRoot:"sps-question sps-row__question",root:"sps-paneldynamic",navigation:"sps-paneldynamic__navigation",title:"sps-title sps-question__title",button:"sps-action-button sps-action-button--text",buttonRemove:"sps-action-button--danger",buttonAdd:"sps-paneldynamic__add-btn",panelsContainer:"",panelWrapper:"sps-paneldynamic__panel-wrapper",panelWrapperList:"",progressTop:"sps-paneldynamic__progress sps-paneldynamic__progress--top",progressBottom:"sps-paneldynamic__progress sps-paneldynamic__progress--bottom",buttonPrev:"sps-paneldynamic__prev-btn",buttonNext:"sps-paneldynamic__next-btn",progressContainer:"sps-paneldynamic__progress-container",progress:"sps-progress",progressBar:"sps-progress__bar",progressText:"sps-paneldynamic__progress-text",panelFooter:"sps-panel__footer",separator:"sps-paneldynamic__separator",footer:"sps-paneldynamic__footer",footerButtonsContainer:"sps-paneldynamic__buttons-container"},progress:"sps-progress sps-body__progress",progressBar:"sps-progress__bar",progressText:"sps-progress__text",progressTextInBar:"sps-hidden",page:{root:"sps-page sps-body__page",title:"sps-title sps-page__title",description:"sps-description sps-page__description"},pageTitle:"sps-title sps-page__title",pageDescription:"sps-description sps-page__description",row:"sps-row sps-clearfix",rowEnter:"sps-row--enter",rowLeave:"sps-row--leave",rowDelayedEnter:"sps-row--delayed-fade-in",rowMultiple:"sps-row--multiple",question:{withFrame:"sps-question--with-frame",nested:"sps-question--nested",mainRoot:"sps-question sps-row__question",flowRoot:"sps-question sps-row__question sps-row__question--flow",asCell:"sps-table__cell",header:"sps-question__header",headerLeft:"sps-question__header--location--left",headerTop:"sps-question__header--location--top",headerBottom:"sps-question__header--location--bottom",content:"sps-question__content",contentLeft:"sps-question__content--left",titleLeftRoot:"sps-question--location--left",titleOnAnswer:"sps-question__title--answer",titleOnError:"sps-question__title--error",title:"sps-title sps-question__title",titleBar:"sd-action-title-bar sps-action-title-bar",requiredMark:"sps-question__required-text",number:"sps-question__num",description:"sps-description sps-question__description",descriptionUnderInput:"sps-question__description--under",comment:"sps-comment",required:"sps-question--required",titleRequired:"sps-question__title--required",indent:0,footer:"sps-question__footer",formGroup:"sps-question__form-group",hasError:"",readOnly:"sd-question--readonly sps-question--disabled",confirmDialog:"sps-popup--confirm sv-popup--confirm svc-creator-popup",errorsContainerBottom:"sps-question__erbox--below-question"},checkbox:{root:"sps-selectbase",item:"sps-item sps-checkbox sps-selectbase__item",itemSelectAll:"sps-checkbox--selectall",itemNone:"sps-checkbox--none",itemReadOnly:"sps-item--disabled sps-checkbox--disabled",itemChecked:"sps-checkbox--checked",itemHover:"sps-checkbox--allowhover",itemInline:"sps-selectbase__item--inline",label:"sps-selectbase__label",itemSvgIconId:"#icon-check-16x16",labelChecked:"",itemControl:"sps-checkbox__control",itemDecorator:"sps-checkbox__svg",controlLabel:"sps-checkbox__caption",materialDecorator:"sps-checkbox__rectangle",other:"sps-comment sps-question__other",column:"sps-selectbase__column"},radiogroup:{root:"sps-selectbase",item:"sps-item sps-radio sps-selectbase__item",itemInline:"sps-selectbase__item--inline",label:"sps-selectbase__label",labelChecked:"",itemReadOnly:"sps-item--disabled sps-radio--disabled",itemChecked:"sps-radio--checked",itemHover:"sps-radio--allowhover",itemControl:"sps-visuallyhidden sps-item__control",itemDecorator:"sps-item__svg sps-radio__svg",controlLabel:"sps-item__control-label",materialDecorator:"sps-item__decorator sps-radio__decorator",other:"sps-comment sps-question__other",clearButton:"sps-btn sps-selectbase__clear-btn",column:"sps-selectbase__column"},boolean:{mainRoot:"sps-question sps-row__question sps-question--boolean",rootCheckbox:"sps-selectbase",checkboxItem:"sps-checkbox",checkboxItemChecked:"sps-checkbox--checked",checkboxitemIndeterminate:"sps-checkbox--indeterminate",checkboxItemReadOnly:"sps-checkbox--disabled",svgIconId:"#icon-v2check",checkboxLabel:"sps-selectbase__label",controlCheckbox:"sps-checkbox__control",checkboxControlLabel:"sps-checkbox__caption",checkboxItemDecorator:"sps-checkbox__svg",checkboxMaterialDecorator:"sps-checkbox__rectangle"},text:{root:"sps-input sps-text",controlReadOnly:"sps-input--readonly",small:"sps-row__question--small",content:"sps-question__content sps-text__content",remainingCharacterCounter:"sps-remaining-character-counter",onError:"sps-input--error"},comment:{root:"sps-input sps-comment",content:"sps-question__content sps-comment__content",remainingCharacterCounter:"sps-remaining-character-counter",small:"sps-row__question--small",onError:"sps-input--error"},dropdown:{root:"sps-selectbase",popup:"sps-dropdown-popup svc-creator-popup",small:"sps-row__question--small sd-row__question--small",control:"sps-input sps-dropdown",controlEmpty:"sps-dropdown--empty sd-dropdown--empty",controlValue:"sps-dropdown__value",filterStringInput:"sd-dropdown__filter-string-input sps-dropdown__filter-string-input",other:"sps-comment sps-question__other",onError:"sps-input--error",selectWrapper:"sv-dropdown_select-wrapper sps-dropdown_select-wrapper",chevronButtonIconId:"icon-chevron",cleanButton:"sps-dropdown__clean-button sps-input__edit-button",controlReadOnly:"sps-input--readonly sd-input--disabled sd-input--readonly",hintPrefix:"sps-dropdown__hint-prefix sd-dropdown__hint-prefix",hintSuffix:"sps-dropdown__hint-suffix sd-dropdown__hint-suffix"},tagbox:{cleanItemButton:"sd-tagbox-item_clean-button sps-tagbox-item_clean-button",cleanItemButtonSvg:"sd-tagbox-item_clean-button-svg sps-tagbox-item_clean-button-svg",control:"sd-input sd-tagbox sd-dropdown sps-tagbox sps-dropdown",controlValue:"sd-tagbox__value sd-dropdown__value sps-tagbox__value",filterStringInput:"sd-dropdown__filter-string-input sps-dropdown__filter-string-input"},matrix:{tableWrapper:"sps-matrix sps-table-wrapper",root:"sps-table",rowError:"sps-matrix__row--error",cell:"sps-table__cell sps-matrix__cell",headerCell:"sps-table__cell sps-table__cell--header",label:"sps-item sps-radio sps-matrix__label",itemValue:"sps-visuallyhidden sps-item__control sps-radio__control",itemChecked:"sps-radio--checked",itemReadOnly:"sps-item--disabled sps-radio--disabled",itemHover:"sps-radio--allowhover",materialDecorator:"sps-item__decorator sps-radio__decorator",itemDecorator:"sps-item__svg sps-radio__svg",cellText:"sps-matrix__text",cellTextSelected:"sps-matrix__text--checked",cellTextReadOnly:"sps-matrix__text--disabled"},matrixdropdown:{tableWrapper:"sps-table-wrapper",root:"sps-table",cell:"sps-table__cell",headerCell:"sps-table__cell sps-table__cell--header",emptyCell:"sps-table__cell--empty",rowEnter:"sps-table__row--enter",rowLeave:"sps-table__row--leave"},matrixdynamic:{mainRoot:"sps-question sps-question--matrixdynamic sd-element sd-question sd-row__question sd-element--complex sd-question--complex sd-question--table",tableWrapper:"sps-table-wrapper",root:"sps-table sps-matrixdynamic",content:"sps-matrixdynamic__content sps-text__content",cell:"sps-table__cell",row:"sps-table__row",rowDisabled:"sps-table__row-disabled",rowReadOnly:"sps-table__row-readonly",headerCell:"sps-table__cell sps-table__cell--header",button:"sps-btn",detailRow:"sps-table__row sps-table__row--detail",detailButton:"sps-table__cell--detail-button sps-action-button sps-action-button--icon",detailButtonExpanded:"sps-table__cell--detail-button--expanded",detailIcon:"sps-detail-panel__icon sps-action-button__icon",detailIconExpanded:"sps-detail-panel__icon--expanded",detailIconExpandedId:"icon-collapse-24x24",detailIconId:"icon-expand-24x24",detailPanelCell:"sps-table__cell sps-table__cell--detail-panel",actionsCell:"sps-table__cell sps-table__cell--actions",buttonAdd:"sps-matrixdynamic__add-btn sps-action-button sps-action-button--large",buttonRemove:"",iconAdd:"",iconRemove:"#icon-delete-24x24",dragElementDecorator:"sps-drag-element__svg",iconDragElement:"#icon-drag-24x24",iconDrag:"sps-matrixdynamic__drag-element",footer:"sps-matrixdynamic__footer",dragDropGhostPositionTop:"sps-matrixdynamic__drag-drop-ghost-position-top",dragDropGhostPositionBottom:"sps-matrixdynamic__drag-drop-ghost-position-bottom",noRowsSection:"sps-matrixdynamic__placeholder",noRowsText:"sps-matrixdynamic__placeholder-text",cellQuestionWrapper:"sps-table__question-wrapper",draggedRow:"sps-matrixdynamic__dragged-row",emptyCell:"sps-table__cell--empty",rowEmpty:"sps-table__row--empty",rowEnter:"sps-table__row--enter",rowLeave:"sps-table__row--leave"},actionBar:{root:"sps-action-bar",item:"sps-action-button",itemPressed:"sps-action-button--pressed",itemAsIcon:"sps-action-button--icon",itemIcon:"sps-action-button__icon",itemTitle:"sps-action-button__title"}},p=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.defaultIcon="square-dashed-24x24",t}return s(n,e),Object.defineProperty(n.prototype,"nameItems",{get:function(){return this.path+"_items"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"nameMatrix",{get:function(){return this.fullPath+"_matrix"},enumerable:!1,configurable:!0}),n.prototype.hasIcon=function(e){return!1},n.prototype.getMainElementNames=function(){return[this.nameItems]},Object.defineProperty(n.prototype,"iconList",{get:function(){return Object.keys(t.SvgRegistry.icons).map(function(e){return"icon-"+e})},enumerable:!1,configurable:!0}),n.prototype.getMatrixKeyColumnName=function(e){return"name"},n.prototype.getDefaultItems=function(e){return this.defaultItems},n.prototype.getDefaultItem=function(e,t){var o=this.getMatrixKeyColumnName(e);return this.getDefaultItems(e).filter(function(e){return e[o]==t})[0]},n.prototype.updateOnValueChangedCore=function(e,t){if(this.needToSetActions(t)){var o=e.getQuestionByName(t);this.updateMatrixRowActions(e,o)}},n.prototype.updateMatrixRowActions=function(e,t){var o=this;t.renderedTable.rows.forEach(function(e){var n,i,s;if(e.row){var r=null===(i=null===(n=e.cells[1])||void 0===n?void 0:n.item)||void 0===i?void 0:i.value.actions;o.updateRowActions(t,e.row,r);var a=null===(s=e.cells[e.cells.length-1].item)||void 0===s?void 0:s.value.actions;o.updateRowActions(t,e.row,a)}})},n.prototype.updateRowActions=function(e,t,o){var n=this;if(o){var i=this.getMatrixKeyColumnName(e);if(e.value){var s=e.value.filter(function(e){var o;return(null===(o=t.value)||void 0===o?void 0:o[i])==(null==e?void 0:e[i])})[0];s&&o.forEach(function(o){return n.updateRowAction(e,t,s,i,o)})}}},n.prototype.updateRowAction=function(e,o,n,i,s){if("icon-action"==s.id&&(s.iconName=n.iconName||this.defaultIcon),"reset-to-default"==s.id){var r=this.getDefaultItem(e,n[i]);if(!r)return;var a={};Object.keys(n).forEach(function(e){return a[e]=r[e]}),s.enabled=!t.Helpers.isTwoValueEquals(n,a)}},n.prototype.createResetAction=function(e,t,n){return{id:"reset-to-default",iconName:"icon-reset",tooltip:o.getLocString("presets.items.restoreToDefault"),location:"end",visibleIndex:15,action:n}},n.prototype.createEditAction=function(e,t,n,i){var s=this;return{id:"edit-item",iconName:"icon-edit",tooltip:o.getLocString("presets.items.edit"),location:"end",visibleIndex:13,action:function(){s.editItem(e,t,n,i)}}},n.prototype.createIconAction=function(e,t){return void 0===t&&(t="sps-matrixdynamic__row-icon"),{id:"icon-action",iconName:e,innerCss:t,location:"start",enabled:!1}},n.prototype.setupStandardActions=function(e,n,i,s,r){e.forEach(function(e){"show-detail"==e.id&&(e.location="end",e.iconName="icon-expand-24x24",e.title=new t.ComputedUpdater(function(){return i.isDetailPanelShowing?o.getLocString("presets.items.collapse"):o.getLocString("presets.items.expand")}),e.tooltip=o.getLocString("presets.items.expand"),e.visibleIndex=10,e.visible=s),"remove-row"==e.id&&(e.visibleIndex=20,e.component="sv-action-bar-item",e.action=function(){return n.removeRowUI(i)},e.iconName=r?"icon-add_24x24":"icon-remove_24x24",e.tooltip=r?o.getLocString("presets.items.add"):o.getLocString("presets.items.delete"))})},n.prototype.editItem=function(e,n,i,s,r){var a,l,u=this,p=this.getMatrixKeyColumnName(i),c={id:"reset-to-default",title:o.getLocString("presets.editor.resetToDefault"),css:"sps-action--grow",innerCss:"sps-btn sps-btn--secondary-alert",visibleIndex:15,action:function(e){var t=u.getDefaultItem(i,a.getValue(p));a.data=t,l.enabled=!1,u.notifyCallback(o.getLocString("presets.editor.itemRestoredToDefault"))}};l=new t.Action(c),a=this.showDetailPanelInPopup(i,s,e.rootElement,{actions:[l],title:null==r?void 0:r.description,removeOnCancel:null==r?void 0:r.isNew}),l.enabled=!t.Helpers.isTwoValueEquals(a.data,this.getDefaultItem(i,a.getValue(p))),a.onValueChanged.add(function(){return l.enabled=!0});var d=a.getQuestionByName(p);this.getDefaultItem(i,d.value)&&(d.readOnly=!0)},n.prototype.resetItem=function(e,t,n){var i=n.getValue("name"),s=this.getDefaultItem(t,i);if(s){var r=t.value,a=r.filter(function(e){return e.name==i})[0];Object.keys(a).forEach(function(e){a[e]=s[e]}),t.value=r}this.notifyCallback(o.getLocString("presets.editor.itemRestoredToDefault"))},n.prototype.restoreItems=function(e,t,o){var n=t.value[o],i=e.value?a([],e.value,!0):[];i.push(n),e.value=i},n.prototype.getMatrix=function(e){return e.getQuestionByName(this.nameMatrix)},n.prototype.isItemsMatrix=function(e){return e===this.nameMatrix},n.prototype.needToSetActions=function(e){return this.isItemsMatrix(e)},n.prototype.onGetMatrixRowActionsCore=function(e,t,o){var n,i,s=this;if(this.needToSetActions(o.question.name)){var r=o.question,a=r.detailElements.filter(function(e){return e.visible}).length>0;if(this.hasIcon(o.question.name)){var l=this.getMatrixKeyColumnName(o.question),u=(null===(i=null===(n=r.value)||void 0===n?void 0:n.filter(function(e){return e[l]==o.row.getValue(l)})[0])||void 0===i?void 0:i.iconName)||this.defaultIcon;o.actions.push(this.createIconAction(u))}var p=this.createResetAction(e,o.row,function(t){s.resetItem(e,r,o.row),t.enabled=!1});o.actions.push(p),o.actions.push(this.createEditAction(e,t,r,o.row)),this.setupStandardActions(o.actions,r,o.row,a,r.name==this.nameMatrix),this.updateRowActions(r,o.row,o.actions)}},n.prototype.onMatrixRowDragOver=function(e,t,o){this.isItemsMatrix(o.fromMatrix.name)&&this.isItemsMatrix(o.toMatrix.name)&&(o.allow=!0)},n.prototype.onMatrixRowRemoving=function(e,t,o){if(this.isItemsMatrix(o.question.name)&&o.question.name!=this.nameMatrix){var n=o.question.value[o.rowIndex],i=this.getMatrix(e),s=i.value?a([],i.value,!0):[];s.push(n),i.value=s}},n.prototype.getExistingKeys=function(e,t){var o=e.getQuestionByName(this.nameItems).value||[],n=e.getQuestionByName(this.nameMatrix).value||[];return a(a([],o,!0),n,!0)},n.prototype.getDefaultValueForRow=function(e,t,n){return o.SurveyHelper.getNewName(this.getExistingKeys(e,n).map(function(e){return e[n]}).filter(function(e){return!!e}).map(function(e){return{name:e}}),n)},n.prototype.setDefaultValueForRow=function(e,t,o){var n=this.getMatrixKeyColumnName(t),i=this.getDefaultValueForRow(e,t,n);o.getQuestionByName(n).value=i,o.getQuestionByName("title").value=i},n.prototype.onMatrixRowAdded=function(e,t,n){var i,s;this.isItemsMatrix(n.question.name)&&(this.setDefaultValueForRow(e,n.question,n.row),this.editItem(e,t,n.question,n.row,{description:o.getLocString("presets.items.newItem")+" "+((null===(s=null===(i=n.question.data)||void 0===i?void 0:i.value)||void 0===s?void 0:s.title)||this.getPageShortTitle(e)),isNew:!0}))},n.prototype.onMatrixCellValueChanged=function(e,t,o){if(this.needToSetActions(o.question.name)){var n=o.question.renderedTable.rows.find(function(e){return e.row==o.row});if(!n)return;var i=n.cells[n.cells.length-1].item.value.actions;if(!i)return;this.updateRowActions(o.question,o.row,i)}},n.prototype.onDetailPanelInPopupApply=function(e,t,o){return!0},n.prototype.applyDetailPanelInPopup=function(e,t,o,n){if(e.validate()){var i={};e.getAllQuestions().forEach(function(e){e.visible&&(i[e.name]=e.isEmpty()&&e.isDescendantOf("checkbox")?[]:e.value)});var s=a([],t.value,!0),l=r(r({},t.value[n]),i);return s[n]=l,this.onDetailPanelInPopupApply(i,t,o)&&(t.value=s),this.updateMatrixRowActions(t.survey,t),!0}return!1},n.prototype.showDetailPanelInPopup=function(e,n,i,s){var r,a,l=this,p=e.visibleRows.findIndex(function(e){return e===n}),c=e.value[p],d=new t.SurveyModel({elements:e.toJSON().detailElements});if(d.fitToContainer=!1,d.showNavigationButtons=!1,d.data=c,d.css=u,d.enterKeyAction="loseFocus",d.questionErrorLocation="bottom",t.settings.showDialog){var m=null===(a=t.settings.showDialog)||void 0===a?void 0:a.call(t.settings,{componentName:"survey",data:{survey:d,model:d},onApply:function(){return l.applyDetailPanelInPopup(d,e,n,p)},onCancel:function(){return s.removeOnCancel&&e.removeRowUI(n),!0},cssClass:"sps-popup svc-property-editor svc-creator-popup",title:s.title||o.getLocString("presets.editor.edit"),displayMode:"popup"},i);if(d.getAllQuestions().filter(function(e){return!e.startWithNewLine}).length>0&&(m.width="100%"),m.footerToolbar){var g=m.footerToolbar.cssClasses;g.item="sps-btn",m.footerToolbar.cssClasses=g,m.footerToolbar.getActionById("apply").innerCss="sps-btn--primary-brand",m.footerToolbar.getActionById("cancel").innerCss="sps-btn--secondary-brand",s.actions&&(r=m.footerToolbar.actions).unshift.apply(r,s.actions)}d.getAllPanels().forEach(function(e){return e.visible=!e.visible}),d.getAllQuestions().forEach(function(e){e.visible=!e.visible,e.isRequired&&(e.requiredErrorText=o.getLocString("presets.editor.required"))})}return d},n}(l),c={root:"sps-list__container",itemsContainer:"sps-list",itemsContainerFiltering:"sps-list--filtering",emptyContainer:"sps-list__empty-container",emptyText:"sps-list__empty-text",filter:"sps-list__filter",filterIcon:"sps-list__filter-icon",filterInput:"sps-list__input",searchClearButtonIcon:"sps-list__filter-clear-button",loadingIndicator:"sps-list__loading-indicator",item:"sps-list__item",itemSelected:"sps-list__item--selected",itemGroup:"sps-list__item--group",itemGroupSelected:"sps-list__item--group-selected",itemWithIcon:"sps-list__item--with-icon",itemDisabled:"sps-list__item--disabled",itemFocused:"sps-list__item--focused",itemHovered:"sps-list__item--hovered",itemTextWrap:"sps-list__item-text--wrap",itemIcon:"sps-list__item-icon",itemMarkerIcon:"sps-list-item__marker-icon",itemSeparator:"sps-list__item-separator",itemBody:"sps-list__item-body"},d=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return s(n,e),Object.defineProperty(n.prototype,"defaultCategoriesMap",{get:function(){return this.defaultCategories.reduce(function(e,t){return e[t.category]=t,e},{})},enumerable:!1,configurable:!0}),n.prototype.getDefaultItems=function(e){return(null==e?void 0:e.name)===this.nameCategories?this.defaultCategories:this.defaultItems},Object.defineProperty(n.prototype,"nameInnerMatrix",{get:function(){return"items"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"nameCategories",{get:function(){return this.fullPath+"_categories"},enumerable:!1,configurable:!0}),n.prototype.getMainElementNames=function(){return[this.nameCategories]},n.prototype.getMatrixKeyColumnName=function(e){return e.name===this.nameCategories?"category":"name"},Object.defineProperty(n.prototype,"questionNames",{get:function(){return[this.nameCategories]},enumerable:!1,configurable:!0}),n.prototype.setupCategoryActions=function(e,t,n,i,s){var r=this;s.forEach(function(t){"remove-row"==t.id&&(t.iconName="icon-delete_24x24",t.tooltip=o.getLocString("presets.items.delete"),t.innerCss="sps-action-button sps-action-button--icon sps-action-button--danger"),"reset-to-default"==t.id&&(t.action=function(){r.resetCategory(e,i)})})},n.prototype.ejectRowData=function(e,t,o){var n=e.value,i=e.visibleRows.indexOf(t),s=n[i];return o&&(n.splice(i,1),e.value=n),s},n.prototype.moveToCategory=function(e,t,o,n,i){void 0===i&&(i=!1);var s=this.ejectRowData(t,o,i),r=this.getQuestionCategories(e),a=r.value;return this.findOrCreateCategory(a,n)[this.nameInnerMatrix].push(s),r.value=a,r.visibleRows.find(function(e){return e.getValue("category")==n})},n.prototype.itemMenuCategoriesEnabled=function(e){return!0},n.prototype.setSubitemsToAction=function(e,t){e.setSubItems({items:t,cssClasses:c}),e.markerIconName="icon-chevronright-24x24"},n.prototype.getItemMenuActionsCore=function(e,n,i){var s=this,r=this.getQuestionCategories(e),a=r.value,l=[],u=n.name==this.nameMatrix,p=this.itemMenuCategoriesEnabled(e);if(u?p?l.push(new t.Action({id:"move-to",title:o.getLocString("presets.items.moveTo"),css:"sps-list__item--label",enabled:!1})):l.push(new t.Action({id:"restore-item",title:o.getLocString("presets.toolbox.addToToolbox"),action:function(){var e=n.visibleRows.indexOf(i);n.removeRow(e)}})):l.push(new t.Action({id:"remove-from",title:o.getLocString("presets.items.removeFrom").replace("{0}",n.title),action:function(){var e=n.visibleRows.indexOf(i);n.removeRow(e)}})),!p)return l;var c=a.filter(function(e){return(e[s.nameInnerMatrix]||[]).filter(function(e){var t;return e.name==(null===(t=i.value)||void 0===t?void 0:t.name)}).length>0})[0],d=a.filter(function(e){return e.category!=(null==c?void 0:c.category)}).map(function(o){return new t.Action({id:"to-"+o.category,title:o.title,action:function(){s.moveToCategory(e,n,i,o.category,!0)}})});if(u)l.push.apply(l,d);else{l.push(new t.Action({id:"categories",title:o.getLocString("presets.items.categoriesLabel"),css:"sps-list__item--label",enabled:!1,needSeparator:!0}));var m=new t.Action({id:"move-to-categories",title:o.getLocString("presets.items.moveToCategory")});this.setSubitemsToAction(m,d),l.push(m)}return l.push(new t.Action({id:"move-to-new-category",title:o.getLocString("presets.items.moveToNewCategory"),needSeparator:u,action:function(){var t=s.moveToCategory(e,n,i,s.getDefaultValueForRow(e,n,"category"),!0);s.editItem(e,null,r,t,{description:o.getLocString("presets.items.newCategory")+" "+s.getPageShortTitle(e),isNew:!0})}})),l},n.prototype.getItemMenuActions=function(e,n,i){var s=this,r=this.getItemMenuActionsCore(e,n,i);return this.getDefaultItem(n,i.value.name)||r.push(new t.Action({id:"remove-custom-item",title:o.getLocString("presets.toolbox.deleteCustomItem"),css:"sps-list__item--alert",needSeparator:!0,action:function(){s.ejectRowData(n,i,!0)}})),r},n.prototype.replaceRemoveAction=function(e,n,i,s){var r=this,a=s.filter(function(e){return"remove-row"==e.id})[0];if(a){a.visible=!1;var l=t.createDropdownActionModel({id:"context-menu",iconName:"more-circle-24x24",tooltip:o.getLocString("presets.items.more"),location:"end",visibleIndex:20},{items:[],showPointer:!1,verticalPosition:"bottom",horizontalPosition:"center",cssClass:"sps-popup-menu sps-popup-menu--context",cssClasses:c,searchEnabled:!1});l.popupModel.onVisibilityChanged.add(function(t,o){if(o.isVisible){var s=o.model.contentComponentData.model;s.actions=r.getItemMenuActions(e,n,i),s.flushUpdates()}}),s.push(l)}},n.prototype.getQuestionCategories=function(e){return e.getQuestionByName(this.nameCategories)},n.prototype.isItemsMatrix=function(t){return e.prototype.isItemsMatrix.call(this,t)||t===this.nameInnerMatrix},n.prototype.resetCategory=function(e,t){var n,i=this,s=t.getValue("category"),r=null===(n=this.defaultCategories.filter(function(e){return e.category==s})[0])||void 0===n?void 0:n[this.nameInnerMatrix];if(r){var a=this.getQuestionCategories(e),l=this.getMatrix(e),u=l.value||[],p=a.value,c=p.filter(function(e){return e.category==s})[0];c[this.nameInnerMatrix].forEach(function(e){r.some(function(t){return t.name==e.name})||u.push(e)}),c[this.nameInnerMatrix]=r,p.filter(function(e){return e.category!=s}).forEach(function(e){r.forEach(function(t){d(e[i.nameInnerMatrix])})}),d(u),l.value=u,a.value=p,this.notifyCallback(o.getLocString("presets.editor.categoryRestoredToDefault"))}function d(e){e&&r.forEach(function(t){var o=e.findIndex(function(e){return e.name==t.name});o>=0&&e.splice(o,1)})}},n.prototype.findOrCreateCategory=function(e,t){var o,n=e.filter(function(e){return e.category==t})[0];return n||((o={category:t||"general",title:t||"General"})[this.nameInnerMatrix]=[],n=o,e.push(n)),n},n.prototype.needToSetActions=function(e){return this.isItemsMatrix(e)||e===this.nameCategories},n.prototype.onGetMatrixRowActionsCore=function(t,o,n){e.prototype.onGetMatrixRowActionsCore.call(this,t,o,n),n.question.name===this.nameCategories&&this.setupCategoryActions(t,o,n.question,n.row,n.actions),this.isItemsMatrix(n.question.name)&&this.replaceRemoveAction(t,n.question,n.row,n.actions)},n.prototype.getExistingKeys=function(e,t){var o=e.getQuestionByName(this.nameCategories).value||[],n=e.getQuestionByName(this.nameMatrix).value||[];return a(a(a([],o,!0),o.map(function(e){return e.items}).flat().filter(function(e){return!!e}),!0),n,!0)},n.prototype.onMatrixRowRemoving=function(t,o,n){var i=this;if(e.prototype.onMatrixRowRemoving.call(this,t,o,n),n.question.name==this.nameCategories){var s=n.question.value[n.rowIndex][this.nameInnerMatrix];if(s){var r=this.getMatrix(t),a=r.value?r.value.concat(s):s;r.value=a}}if(n.question.name==this.nameMatrix){var l=n.question.value[n.rowIndex],u=this.defaultCategories.filter(function(e){return e[i.nameInnerMatrix].filter(function(e){return e.name==l.name}).length>0})[0];this.moveToCategory(t,n.question,n.row,null==u?void 0:u.category)}},n.prototype.onMatrixRowAdded=function(t,n,i){e.prototype.onMatrixRowAdded.call(this,t,n,i),i.question.name==this.nameCategories&&(this.setDefaultValueForRow(t,i.question,i.row),this.editItem(t,n,i.question,i.row,{description:o.getLocString("presets.items.newCategory")+" "+this.getPageShortTitle(t),isNew:!0}))},n}(p),m="toolboxCategories";t.FunctionFactory.Instance.register("validateToolboxJson",function(e){var o=e[0];return!o||!o.type||!!t.Serializer.createClass(o.type,o)});var g=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return s(n,e),n.prototype.createItemsMatrixJSON=function(e,t){var n={type:"matrixdynamic",name:"items",title:"Toolbox",allowRowReorder:!0,cellType:"text",showHeader:!1,rowCount:0,allowAddRows:!1,addRowButtonLocation:"top",columns:[{name:"name",visible:!1},{name:"title"}],detailPanelMode:"underRow",detailElements:[{type:"panel",name:"details",maxWidth:"30%",elements:[{type:"text",name:"name",title:o.getLocString("presets.toolbox.categoryName"),isUnique:!0,visible:!1,isRequired:!0},{type:"text",name:"title",title:o.getLocString("presets.toolbox.categoryTitle"),visible:!1},{type:"dropdown",name:"iconName",title:o.getLocString("presets.toolbox.iconName"),itemComponent:"svc-presets-icon-item",allowCustomChoices:!0,choices:this.iconList,visible:!1},{type:"text",name:"tooltip",title:o.getLocString("presets.toolbox.tooltip"),visible:!1}],visible:!1},{type:"presetjson",name:"json",startWithNewLine:!1,renderAs:"default-comment",title:o.getLocString("presets.toolbox.jsonObject"),validators:[{type:"expression",text:"JSON should be correct",expression:"validateToolboxJson({json})"}],visible:!1}]},i=r(r({},n),e);return t&&i.detailElements.push(this.createItemsMatrixJSON({allowAddRows:!0,addRowText:o.getLocString("presets.toolbox.addNewSubitem"),addRowButtonLocation:"bottom",name:this.nameSubitems,valueName:"subitems",titleLocation:"hidden",startWithNewLine:!1},!1)),i},n.prototype.createMainPageCore=function(){return{title:o.getLocString("presets.toolbox.title"),description:o.getLocString("presets.toolbox.description"),navigationTitle:o.getLocString("presets.toolbox.navigationTitle"),elements:[{type:"panel",name:this.mainPanelName,elements:[{type:"matrixdynamic",name:this.nameCategories,title:o.getLocString("presets.toolbox.toolbox"),visibleIf:this.getTextVisibleIf(this.nameCategoriesMode,"categories"),allowRowReorder:!0,allowAddRows:!0,addRowButtonLocation:"top",noRowsText:o.getLocString("presets.toolbox.noCategoriesText"),addRowText:o.getLocString("presets.toolbox.addCustomCategory"),showHeader:!1,columns:[{cellType:"text",name:"category",isUnique:!0,isRequired:!0,visible:!1},{cellType:"text",name:"title"}],detailPanelMode:"underRow",detailElements:[{type:"text",name:"category",title:o.getLocString("presets.toolbox.categoryName"),isRequired:!0,visible:!1},{type:"text",name:"title",title:o.getLocString("presets.toolbox.categoryTitle"),visible:!1},{type:"text",name:"tooltip",title:o.getLocString("presets.toolbox.tooltip"),visible:!1},this.createItemsMatrixJSON({name:this.nameInnerMatrix,titleLocation:"hidden",allowAddRows:!0,addRowButtonLocation:"bottom",noRowsText:o.getLocString("presets.toolbox.noItemsText"),addRowText:o.getLocString("presets.toolbox.addNewItem"),valueName:"items"},!0)]},this.createItemsMatrixJSON({name:this.nameItems,title:o.getLocString("presets.toolbox.toolbox"),addRowButtonLocation:"top",noRowsText:o.getLocString("presets.toolbox.noItemsText"),addRowText:o.getLocString("presets.toolbox.addCustomItem"),startWithNewLine:!1,visibleIf:this.getTextVisibleIf(this.nameCategoriesMode,"items")},!0),this.createItemsMatrixJSON({allowAddRows:!0,title:o.getLocString("presets.toolbox.hiddenItems"),noRowsText:o.getLocString("presets.toolbox.noHiddenItemsText"),descriptionLocation:"underInput",addRowButtonLocation:"bottom",addRowText:o.getLocString("presets.toolbox.addNewItem"),startWithNewLine:!1,name:this.nameMatrix},!0)]},{type:"panel",title:" ",name:this.navigationPanelName,elements:[{type:"boolean",name:this.nameCategoriesMode,title:o.getLocString("presets.toolbox.enableGrouping"),titleLocation:"hidden",defaultValue:"categories",valueTrue:"categories",valueFalse:"items",clearIfInvisible:"onHidden",renderAs:"switch"},{type:"boolean",name:this.nameShowCategoryTitles,title:o.getLocString("presets.toolbox.showCategoryTitles"),defaultValue:!1,useTitleAsLabel:!0,visibleIf:this.getTextVisibleIf(this.nameCategoriesMode,"categories"),clearIfInvisible:"onHidden",renderAs:"switch"}]}]}},Object.defineProperty(n.prototype,"nameCategoriesMode",{get:function(){return this.fullPath+"_mode"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"nameItems",{get:function(){return this.fullPath+"_items"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"nameSubitems",{get:function(){return"subitems"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"nameShowCategoryTitles",{get:function(){return this.fullPath+"_showCategoryTitles"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"questionNames",{get:function(){return[this.nameCategories,this.nameItems,this.nameMatrix,this.nameShowCategoryTitles,this.nameCategoriesMode]},enumerable:!1,configurable:!0}),n.prototype.hasIcon=function(e){return e!==this.nameCategories&&e!==this.nameSubitems},n.prototype.getDefaultItems=function(e){return(null==e?void 0:e.name)===this.nameCategories?this.defaultCategories:a(a([],this.defaultItems,!0),this.defaultSubitems,!0)},n.prototype.updateRowAction=function(t,o,n,i,s){e.prototype.updateRowAction.call(this,t,o,n,i,s),"show-detail"==s.id&&t.name!=this.nameCategories&&(s.visible=o.isDetailPanelShowing||!!n.subitems)},n.prototype.findItem=function(e,t,o){return o?e.map(function(e){return e.items.filter(function(e){return e.name==t})[0]}).filter(function(e){return!!e})[0]:e.filter(function(e){return e.name==t})[0]},n.prototype.moveToSubitems=function(e,t,o,n,i){void 0===i&&(i=!1);var s=this.ejectRowData(t,o,i),r=this.itemMenuCategoriesEnabled(e),a=r?this.getQuestionCategories(e):this.getQuestionItems(e),l=JSON.parse(JSON.stringify(a.value)),u=this.findItem(l,n,r);u&&(u.subitems||(u.subitems=[]),u.subitems.push(s)),a.value=l},n.prototype.getExistingKeys=function(t,o){var n=e.prototype.getExistingKeys.call(this,t,o),i=t.getQuestionByName(this.nameItems).value||[],s=a(a([],n,!0),i,!0),r=s.map(function(e){return e.subitems||[]}).flat();return a(a([],s,!0),r,!0)},n.prototype.itemMenuCategoriesEnabled=function(e){return"items"!==e.getValue(this.nameCategoriesMode)},n.prototype.getItemMenuActionsCore=function(n,i,s){var r=this,a=this.getQuestionCategories(n).value,l=e.prototype.getItemMenuActionsCore.call(this,n,i,s),u=this.itemMenuCategoriesEnabled(n),p=a.map(function(e){var o=new t.Action({id:"tosubitemcategory-"+e.category,title:e.title});if(e.items){var a=e.items.filter(function(e){var t;return e.name!=(null===(t=s.value)||void 0===t?void 0:t.name)}).map(function(e){return new t.Action({id:"tosubitem-"+e.name,title:e.title,action:function(){r.moveToSubitems(n,i,s,e.name,!0)}})});r.setSubitemsToAction(o,a)}return o}),c=u?p:p.map(function(e){return e.items}).flat(),d=i.visibleRows.indexOf(s),m=i.value[d];if(!m.subitems){i.name!=this.nameItems&&i.name!=this.nameInnerMatrix||(l.push(new t.Action({id:"subcategories",title:o.getLocString("presets.toolbox.subitems"),css:"sps-list__item--label",enabled:!1,needSeparator:!0})),l.push(new t.Action({id:"convert-to-subcategory",title:o.getLocString("presets.toolbox.enableSubitems"),action:function(){var e=u?r.getQuestionCategories(n):r.getQuestionItems(n),t=JSON.parse(JSON.stringify(e.value)),o=r.findItem(t,m.name,u);o&&(o.subitems=[]),e.value=t,r.updateMatrixRowActions(n,i),s.showDetailPanel()}})));var g=new t.Action({id:"move-as-subitem",title:o.getLocString("presets.toolbox.moveAsSubitem"),needSeparator:!0});this.setSubitemsToAction(g,c),l.push(g)}return l},n.prototype.getJsonValueCore=function(e,t,o){var n={},i=this.getJsonItemsDefinition(e);i&&(n.definition=i);var s=e.getValue(this.nameCategoriesMode);t.toolbox;var r=null==o?void 0:o.categories;if("categories"===s){var a=this.getCategoriesJson(e);Array.isArray(a)&&a.length>0&&!this.isCategoriesSame(a,r)&&(n.categories=this.getCategoriesJson(e))}else n.categories=[];return e.getValue(this.nameShowCategoryTitles)&&(n.showCategoryTitles=!0),Object.keys(n).length>0?n:void 0},n.prototype.getDefaultJsonValueCore=function(e){return{categories:e.toolbox.categories.map(function(e){return{category:e.name,title:e.title,items:e.items.map(function(e){return e.name})}})}},n.prototype.isCategoriesSame=function(e,o){if(e.length!==(null==o?void 0:o.length))return!1;for(var n=0;n<e.length;n++){if(e[n].category!==o[n].category)return!1;var i=o[n].items,s=e[n].items;if(!t.Helpers.isTwoValueEquals(s,i))return!1}return!0},n.prototype.getCategoriesJson=function(e){var t=e.getValue(this.nameCategories);if(Array.isArray(t))return t.map(function(e){var t;return{category:e.category,items:null===(t=e.items)||void 0===t?void 0:t.map(function(e){return e.name})}})},n.prototype.cleanIfNotDiffers=function(e,o){if(!o)return!0;var n=!1;return Object.keys(r(r({},e),o)).forEach(function(i){t.Helpers.isTwoValueEquals(e[i],o[i])?"name"!==i&&delete e[i]:n=!0}),n},n.prototype.getJsonItemsDefinition=function(e){var o=this,n=(("items"===e.getValue(this.nameCategoriesMode)?e.getValue(this.nameItems):(e.getValue(this.nameCategories)||[]).map(function(e){return e.items}).flat())||[]).map(function(e){return r({},e)}),i=!1;return n.forEach(function(e){var t=o.defaultItems.filter(function(t){return t.name==e.name})[0];!e.subitems&&(null==t?void 0:t.subitems)&&(e.subitems=[]),o.cleanIfNotDiffers(e,t)&&(i=!0)}),i||t.Helpers.isTwoValueEquals(n.map(function(e){return e.name}),this.defaultItems.map(function(e){return e.name}))||(i=!0),i?n:void 0},n.prototype.isItemsMatrix=function(t){return t===this.nameItems||t===this.nameSubitems||e.prototype.isItemsMatrix.call(this,t)},n.prototype.onMatrixRowRemoving=function(t,o,n){n.question.name==this.nameMatrix&&("items"===t.getValue(this.nameCategoriesMode)&&this.restoreItems(this.getQuestionItems(t),n.question,n.rowIndex));e.prototype.onMatrixRowRemoving.call(this,t,o,n)},n.prototype.setupOnCurrentPageCore=function(e,t,o){t.toolbox.forceCompact=!o,t.toolbox.isCompact=!o,t.readOnly!=o&&t.setPropertyValue("readOnly",o),t.toolbox.items.forEach(function(e){return e.enabled=o}),t.toolbox.enabled=o},n.prototype.setupQuestionsCore=function(t,o){e.prototype.setupQuestionsCore.call(this,t,o),this.setupDefaults(t,o.creator)},n.prototype.setupDefaults=function(e,t){var o=this,n=t.toolbox.getDefaultItems([],!0,!0,!0),i=t.toolbox.getDefaultCategories();this.defaultItems=n.map(function(e){return o.createToolboxItemRow(e)}),this.defaultSubitems=[],n.forEach(function(e){var t;e.items&&(t=o.defaultSubitems).push.apply(t,e.items.map(function(e){return o.createToolboxItemRow(e)}))}),this.defaultCategories=i.map(function(e){return o.createToolboxCategoryRow(e)})},n.prototype.setupQuestionsValueCore=function(e,t,o){var n=this.defaultItems.reduce(function(e,t){return e[t.name]=t,e},{}),i=this.defaultCategoriesMap;this.defaultItems.filter(function(e){return e.subitems}).map(function(e){return e.subitems.forEach(function(e){return n[e.name]=e})});var s=((t=t||{}).definition||[]).map(function(e){return"string"==typeof e?{name:e}:e}),a=t.categories||[];s=0===s.length?this.defaultItems:s.map(function(e){return r(r({},n[e.name]||{}),e)});var l={};s.forEach(function(e){return l[e.name]=r(r({},e),{subitems:e.subitems&&e.subitems.map(function(e){return r(r({},n[e.name]||{}),e)})})}),(a=0===a.length?this.defaultCategories:a.map(function(e){var t;return r(r(r({},i[e.category]),e),{items:null===(t=e.items)||void 0===t?void 0:t.map(function(e){return l[e]}).filter(function(e){return!!e})})})).filter(function(e){return e.items}).forEach(function(e){return e.items.forEach(function(e){return delete n[e.name]})});var u=this.defaultItems.filter(function(e){return n[e.name]});e.setValue(this.nameMatrix,u),e.setValue(this.nameCategories,a),this.updateItemsFromCategories(e),this.updateShowCategoriesTitlesElements(e)},n.prototype.onLocaleChangedCore=function(e,t,o){this.setupDefaults(e,o),this.setupQuestionsValueCore(e,t,o)},n.prototype.updateItemsFromCategories=function(e){this.getQuestionItems(e).value=this.getQuestionCategories(e).value.map(function(e){return a([],e.items||[],!0)}).flat()},n.prototype.updateCategoriesFromItems=function(e){var t=this,o=this.getQuestionCategories(e).value,n=a([],this.getQuestionItems(e).value,!0).reduce(function(e,t){return e[t.name]=t,e},{});o.forEach(function(e){e.items=e.items.map(function(e){var t=n[e.name];return delete n[e.name],t}).filter(function(e){return!!e})});var i=Object.keys(n);if(i.length>0){var s=this.findOrCreateCategory(o,"general");s.items=s.items.concat(i.map(function(e){return t.createToolboxItemRow(n[e])}))}this.getQuestionCategories(e).value=o},n.prototype.updateOnValueChangedCore=function(t,o){e.prototype.updateOnValueChangedCore.call(this,t,o),o===this.nameCategoriesMode&&("items"==t.getValue(this.nameCategoriesMode)?this.updateItemsFromCategories(t):this.updateCategoriesFromItems(t)),o===this.nameShowCategoryTitles&&this.updateShowCategoriesTitlesElements(t)},n.prototype.updateShowCategoriesTitlesElements=function(e){var t=this;e.getValue(this.nameShowCategoryTitles),this.getQuestionCategories(e).visibleRows.forEach(function(e){var o=e.getValue("category"),n=t.getCategoryTitle(o);n&&(e.getQuestionByName("category").readOnly=!0);var i=e.getQuestionByName("title");i.isEmpty()&&(i.value=n)})},n.prototype.getCategoryTitle=function(e){return o.editorLocalization.getString(m+"."+e)},n.prototype.setJsonLocalizationStringsCore=function(e,t){function o(e,t){e&&e.visibleRows.forEach(function(e){l.updateModifiedText(t,e.getValue("title"),"qt."+e.getValue("name"))})}o(this.getQuestionItems(e),t);var n=this.getQuestionCategories(e),i=this.defaultCategoriesMap;n.isVisible&&n.visibleRows.forEach(function(e){var n,s=e.getValue("category");e.getValue("title")!==(null===(n=i[s])||void 0===n?void 0:n.title)&&(t[m]||(t[m]={}),t[m][s]=e.getValue("title")),o(e.getQuestionByName("items"),t)})},n.prototype.getQuestionItems=function(e){return e.getQuestionByName(this.nameItems)},n.prototype.createToolboxItemRow=function(e){var t,o=this,n={name:e.name,title:e.title,iconName:e.iconName,tooltip:e.tooltip,json:e.json,subitems:null===(t=e.items)||void 0===t?void 0:t.map(function(e){return o.createToolboxItemRow(e)})};for(var i in n)void 0===n[i]&&delete n[i];return n},n.prototype.createToolboxCategoryRow=function(e){var t,o=this,n={category:e.name,title:e.title,items:null===(t=e.items)||void 0===t?void 0:t.map(function(e){return o.createToolboxItemRow(e)})};for(var i in n)void 0===n[i]&&delete n[i];return n},n}(d),h=function(e){function t(t,o,n){return e.call(this,t,null,o,null,null,null,n)||this}return s(t,e),t.prototype.getIsPropertyVisible=function(e){return!1!==e.visible},t}(o.SurveyQuestionProperties),f="matrixdropdowncolumn",v=["question","matrixdropdownbase","selectbase","panelbase",f+"@default",f+"@selectbase"],y=function(){function e(e,o){var n=this;this.className=e,this.currentJson=o,this.propertiesHash={},this.allClasses=[],this.baseClasses=[];var i={},s=this.createObj();this.obj=s,this.currentJson.classes=this.currentJson.classes||{},this.properties=new h(s,e,o);var r=this.properties.getAllVisiblePropertiesNames(!0),a={};t.Serializer.getPropertiesByObj(s).forEach(function(e){return a[e.name]=e}),r.forEach(function(e){var t=a[e];if(t){var o=n.getPropClassName(t);n.propertiesHash[e]=o,i[o]=!0}});for(var l="",u=0;u<v.length;u++){var p=v[u];i[p]&&(l=l||p)}l=l||e,this.collectAllClasses(l).forEach(function(e){v.indexOf(e)<0?n.allClasses.push(e):n.baseClasses.push(e)}),this.propertyGridValue=this.createPropertyGrid(s,this.currentJson),this.propertyGridDefaultValue=this.createPropertyGrid(s)}return e.prototype.getObj=function(){return this.obj},e.prototype.collectAllClasses=function(e){var o=new Array;if(o.push(e),"survey"==e)return o;var n=0==e.indexOf(f+"@");return Object.keys(this.currentJson.classes).forEach(function(i){n?0===i.indexOf(f+"@")&&o.push(i):t.Serializer.isDescendantOf(i,e)&&o.indexOf(i)<0&&o.push(i)}),o},e.prototype.createPropertyGrid=function(e,t){var n=new o.PropertyGridModel(void 0,void 0,t);return n.showOneCategoryInPropertyGrid=!0,n.obj=e,n},e.prototype.createObj=function(e){if("survey"===(e=e||this.className))return new t.SurveyModel;var o=e.indexOf("@");if(o<0)return t.Serializer.createClass(e);var n=e.substring(0,o),i=e.substring(o+1),s=t.Serializer.createClass(n);return s.cellType&&(s.cellType=i),s},e.prototype.getInitialJson=function(e){var t=e?this.propertyGridDefaultValue:this.propertyGridValue;return t.survey.toJSON().pages.filter(function(e){return e.name!=t.placeholderPageName}).map(function(e){var t;return{category:e.name,title:e.title,iconName:e.iconName,properties:null===(t=e.elements)||void 0===t?void 0:t.filter(function(e){return e.name&&-1==e.name.indexOf("overridingProperty")}).map(function(e){var t={name:e.name,title:e.title};return void 0!==e.description&&(t.description=e.description),t})}})},Object.defineProperty(e.prototype,"propertyGridDefault",{get:function(){return this.propertyGridDefaultValue},enumerable:!1,configurable:!0}),e.prototype.getPropertyClassName=function(e){return this.propertiesHash[e]},e.prototype.updateCurrentJson=function(e){this.removeBaseClassesFromCurrentJson(),this.updateCurrentJsonCore(this.currentJson.classes,e)},e.prototype.getAllClasses=function(){return this.allClasses},e.prototype.getClassesBySharedProperty=function(e){for(var o=[],n=0;n<this.allClasses.length;n++){var i=t.Serializer.findProperty(this.allClasses[n],e);i&&!1!==i.visible&&o.push(this.allClasses[n])}return o},e.prototype.getSelectedClassesForProperty=function(e){for(var t,o=[],n=0;n<this.allClasses.length;n++)(null===(t=this.currentJson.classes[this.allClasses[n]].properties)||void 0===t?void 0:t.filter(function(t){return t===e||t.name===e})[0])&&o.push(this.allClasses[n]);return 0===o.length?this.getClassesBySharedProperty(e):o},e.prototype.removeBaseClassesFromCurrentJson=function(){var e=this;if(this.hasBaseClassInCurrentJson()&&0!==this.baseClasses.length){var t=this.currentJson.classes;this.allClasses.forEach(function(o){t[o]=e.createFlatClassProperties(o)}),this.removeBaseClassesFromCurrentJsonCore()}},e.prototype.createFlatClassProperties=function(e){var t,o=this.createObj(e);this.properties=new h(o,e,this.currentJson);var n={properties:[]},i=null===(t=this.currentJson.classes[e])||void 0===t?void 0:t.title;return i&&(n.title=i),this.properties.getTabs().forEach(function(e,t){if(!1!==e.visible&&e.properties.length>0){n.tabs=n.tabs||[];var o={name:e.name};e.title&&(o.title=e.title),e.iconName&&(o.iconName=e.iconName),n.tabs.push(o),e.properties.forEach(function(t){var o;null===(o=n.properties)||void 0===o||o.push({name:t.name,tab:e.name})})}}),n},e.prototype.hasBaseClassInCurrentJson=function(){for(var e=0;e<this.baseClasses.length;e++)if(this.currentJson.classes[this.baseClasses[e]])return!0;return!1},e.prototype.removeBaseClassesFromCurrentJsonCore=function(){var e=this;this.baseClasses.forEach(function(t){delete e.currentJson.classes[t]})},e.prototype.updateCurrentJsonCore=function(e,t){Array.isArray(t)||(t=[]),this.updateJsonClasses(e,t)},e.prototype.updateJsonClasses=function(e,t){var o=new Array,n=new Array,i=new Array;t.forEach(function(e){if(e&&e.name){var t={name:e.name};void 0!==e.iconName&&(t.iconName=e.iconName),o.push(t),Array.isArray(e.items)&&e.items.forEach(function(t){n.push({name:t,tab:e.name}),i.push(t)})}}),e[this.className]=e[this.className]||{},e[this.className].tabs=o,e[this.className].properties=n;var s=this.properties.getInvisibleCustomGeneratedProperties(i);s.length>0?e[this.className].invisibleGeneratedProperties=s:delete e[this.className].invisibleGeneratedProperties},e.prototype.updatePropertyVisibility=function(e,t){this.removeBaseClassesFromCurrentJson(),this.updatePropertyVisibilityCore(this.currentJson.classes,e,t)},e.prototype.updatePropertyVisibilityCore=function(e,t,o){Object.keys(e).forEach(function(n){var i,s=e[n],r=null===(i=s.properties)||void 0===i?void 0:i.findIndex(function(e){return e.name===t.name});t.classes&&(t.classes.indexOf(n)<0?r>-1&&s.properties.splice(r,1):r<0&&s.properties.push({name:t.name,tab:o}))})},e.prototype.getPropClassName=function(e){for(var o=e.classInfo.name,n=1;n<v.length;n++){var i=v[n];if(o===i||t.Serializer.isDescendantOf(o,i))return this.getClassName(i)}return o===this.className?this.className:this.getClassName("question")},e.prototype.getClassName=function(e){var t=this.className.indexOf("@");if(t<0)return e;var o=this.className.substring(0,t);return o!==e&&"question"!==e||(e="default"),o+"@"+e},e}(),b=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.firstTimeLoading=!1,t}return s(n,e),Object.defineProperty(n.prototype,"nameInnerMatrix",{get:function(){return"properties"},enumerable:!1,configurable:!0}),n.prototype.createItemsMatrixJSON=function(e){var t={type:"matrixdynamic",allowRowReorder:!0,cellType:"text",showHeader:!1,rowCount:0,allowAddRows:!1,addRowButtonLocation:"top",addRowText:"Add Custom Item",noRowsText:"There are no items",columns:[{name:"name",visible:!1},{name:"title"}],detailPanelMode:"underRow",detailElements:[{type:"text",name:"name",title:o.getLocString("presets.propertyGrid.name"),isUnique:!0,isRequired:!0,visible:!1},{type:"text",name:"title",title:o.getLocString("presets.propertyGrid.titleField"),isUnique:!0,isRequired:!0,visible:!1},{type:"comment",name:"description",title:o.getLocString("presets.propertyGrid.descriptionField"),visible:!1}]};return r(r({},t),e)},n.prototype.createMainPageCore=function(){return{title:o.getLocString("presets.propertyGrid.title"),navigationTitle:o.getLocString("presets.propertyGrid.navigationTitle"),description:o.getLocString("presets.propertyGrid.description"),elements:[{type:"dropdown",name:this.nameSelector,allowClear:!1,clearIfInvisible:"onHidden",title:o.getLocString("presets.propertyGrid.selectElement")},{type:"panel",name:this.mainPanelName,visibleIf:this.getNotEmptyVisibleIf(this.nameSelector),elements:[{type:"matrixdynamic",name:this.nameCategories,title:o.getLocString("presets.propertyGrid.propertyGrid"),allowRowReorder:!0,addRowButtonLocation:"top",rowCount:0,allowAddRows:!0,noRowsText:o.getLocString("presets.propertyGrid.noCategoriesText"),addRowText:o.getLocString("presets.propertyGrid.addCustomCategory"),showHeader:!1,columns:[{cellType:"text",name:"category",isUnique:!0,isRequired:!0,visible:!1},{type:"boolean",name:"isDefault",visible:!1},{cellType:"text",name:"title"}],detailPanelMode:"underRow",detailElements:[{type:"text",name:"category",title:o.getLocString("presets.propertyGrid.categoryName"),isRequired:!0,visible:!1},{type:"text",name:"title",title:o.getLocString("presets.propertyGrid.categoryTitle"),visible:!1},{type:"dropdown",name:"iconName",title:o.getLocString("presets.propertyGrid.iconName"),itemComponent:"svc-presets-icon-item",allowCustomChoices:!0,choices:this.iconList,visible:!1},this.createItemsMatrixJSON({name:this.nameInnerMatrix,noRowsText:o.getLocString("presets.propertyGrid.noItemsText"),titleLocation:"hidden",detailElements:[{type:"panel",name:"details",maxWidth:"30%",elements:[{type:"text",name:"name",title:o.getLocString("presets.propertyGrid.name"),isUnique:!0,isRequired:!0,visible:!1},{type:"text",name:"title",title:o.getLocString("presets.propertyGrid.titleField"),isUnique:!0,isRequired:!0,visible:!1},{type:"comment",name:"description",title:o.getLocString("presets.propertyGrid.descriptionField"),showSelectAllItem:!0,visible:!1}],visible:!1},{type:"checkbox",name:"classes",title:o.getLocString("presets.propertyGrid.propertyVisibleIn"),colCount:3,choicesOrder:"asc",startWithNewLine:!1,visible:!1}]})]},this.createItemsMatrixJSON({title:o.getLocString("presets.propertyGrid.hiddenItems"),name:this.nameMatrix,noRowsText:o.getLocString("presets.propertyGrid.noHiddenItemsText"),descriptionLocation:"underInput",startWithNewLine:!1})]},{type:"panel",title:" ",name:this.navigationPanelName,elements:[{type:"html",html:"&nbsp"}]}]}},n.prototype.propertyGridSetObj=function(e){var t,o=null===(t=this.propertyGrid.survey.currentPage)||void 0===t?void 0:t.name;this.propertyGrid.setObj(e),this.propertyGrid.survey.currentPage=this.propertyGrid.survey.getPageByName(o)},n.prototype.hasIcon=function(e){return e==this.nameCategories},n.prototype.restoreValuesFromDefault=function(e){this.isModified=!1,this.currentJson=this.copyJson(o.defaultPropertyGridDefinition),this.updateMatrices(e)},n.prototype.getJsonValueCore=function(e,t,o){if(this.isModified)return{definition:this.currentJson}},n.prototype.setupPageQuestions=function(e,t){this.getSelector(e).choices=this.getSelectorChoices(t);var n=o.settings.propertyGrid.enableSearch;o.settings.propertyGrid.enableSearch=!1,o.settings.propertyGrid.enableSearch=n},n.prototype.setupQuestionsCore=function(t,o){this.propertyGrid=o.creator.designerPropertyGrid,e.prototype.setupQuestionsCore.call(this,t,o),this.setupPageQuestions(t,o.creator)},n.prototype.setJSONForTitlesAndDescriptions=function(e,t){var o=this.localeStrings[t];Object.keys(o).length>0&&(e[t]=o)},n.prototype.onLocaleChangedCore=function(e,t,o){this.setupPageQuestions(e,o),this.setupQuestionsValueCore(e,t,o)},n.prototype.setJsonLocalizationStringsCore=function(e,t){this.setJSONForTitlesAndDescriptions(t,"pe"),this.setJSONForTitlesAndDescriptions(t,"pehelp")},n.prototype.updateJsonLocalizationStringsCore=function(e){this.localeStrings={pe:e.pe||{},pehelp:e.pehelp||{}}},n.prototype.setupOnCurrentPageCore=function(e,t,o){var n;t.setSidebarEnabled(o),this.propertyGridSetObj(o?null===(n=this.currentProperties)||void 0===n?void 0:n.getObj():null)},Object.defineProperty(n.prototype,"isSettingUp",{get:function(){return this.firstTimeLoading},enumerable:!1,configurable:!0}),n.prototype.updateOnValueChangedCore=function(t,n){var i,s=this;if(e.prototype.updateOnValueChangedCore.call(this,t,n),n==this.nameCategories){this.firstTimeLoading||(this.isModified=!0);var r=this.getQuestionCategories(t);r.isVisible&&(null===(i=r.value)||void 0===i||i.forEach(function(e){var t,n=e.category,i=e.title;e.title!==o.editorLocalization.getString("pe.tabs."+n)&&(s.ensureLocalizationPath("pe.tabs"),s.localeStrings.pe.tabs[n]=i),null===(t=e.properties)||void 0===t||t.forEach(function(e){e.title!==o.editorLocalization.getString("pe."+e.name)&&s.changePropTitleAndDescription("pe",e.name,e.title),e.description!==o.editorLocalization.getString("pehelp."+e.name)&&s.changePropTitleAndDescription("pehelp",e.name,e.description)})})),this.firstTimeLoading||this.updateCurrentJson(t)}if(n===this.nameSelector){this.firstTimeLoading=!0,this.currentProperties&&(this.currentProperties=void 0);var a=this.getSelector(t);this.currentClassName=a.value,this.updateMatrices(t),this.firstTimeLoading=!1}},n.prototype.updateMatrices=function(e){if(this.currentClassName){this.currentProperties=new y(this.currentClassName,this.currentJson),this.setupDefaults(e);var t=this.currentProperties.getInitialJson(!1);e.setValue(this.nameCategories,t);var o=this.getCurrentlyHiddenItems(t);e.setValue(this.nameMatrix,o),this.pageName==e.currentPage.name&&this.propertyGridSetObj(this.currentProperties.getObj())}},n.prototype.getCurrentlyHiddenItems=function(e){var t=["progressBarInheritWidthFrom"],o={};return this.defaultItems.forEach(function(e){return o[e.name]=e}),e.filter(function(e){return e.properties}).forEach(function(e){return e.properties.forEach(function(e){return delete o[e.name]})}),Object.keys(o).map(function(e){return o[e]}).filter(function(e){return-1==t.indexOf(e.name)})},n.prototype.setupDefaults=function(e){var t,o=this,n=(null===(t=this.currentProperties)||void 0===t?void 0:t.getInitialJson(!0))||[];this.defaultCategories=a([],n,!0),this.defaultItems=[],n.forEach(function(e){var t;e.properties&&(t=o.defaultItems).push.apply(t,e.properties)})},n.prototype.setupQuestionsValueCore=function(e,t,n){this.getSelector(e).value="survey";var i=n.getPropertyGridDefinition();this.isModified=!!(null==t?void 0:t.definition)||i&&JSON.stringify(i)!==JSON.stringify(o.defaultPropertyGridDefinition),this.currentJson=(null==t?void 0:t.definition)||this.copyJson(i||o.defaultPropertyGridDefinition),this.currentJson.generateOtherTab=!1,this.updateOnValueChangedCore(e,this.nameSelector)},n.prototype.getSelector=function(e){return e.getQuestionByName(this.nameSelector)},Object.defineProperty(n.prototype,"nameSelector",{get:function(){return this.fullPath+"_selector"},enumerable:!1,configurable:!0}),n.prototype.getSelectorChoices=function(e){var o=this,n=["survey","page"];e.toolbox.getDefaultItems([],!1,!0,!0).forEach(function(e){n.push(e.id)});var i=[];n.forEach(function(e){return i.push(new t.ItemValue(e,o.getSelectorItemTitle(e)))});var s="matrixdropdowncolumn@";for(var r in i.push(new t.ItemValue(s+"default",this.getColumnItemTitle(""))),t.matrixDropdownColumnTypes)i.push(new t.ItemValue(s+r,this.getColumnItemTitle(r)));return i},n.prototype.getSelectorItemTitle=function(e){return"survey"===e?o.editorLocalization.getString("ed.surveyTypeName"):"page"===e?o.editorLocalization.getString("ed.pageTypeName"):o.editorLocalization.getString("qt."+e)},n.prototype.getColumnItemTitle=function(e){return o.editorLocalization.getString("ed.columnTypeName")+": "+(e?this.getSelectorItemTitle(e):"default")},n.prototype.updateCurrentJson=function(e){this.currentProperties&&this.currentProperties.updateCurrentJson(this.getPropertiesArray(this.getQuestionCategories(e).value))},n.prototype.getPropertiesArray=function(e){return null==e?void 0:e.map(function(e){var t;return{name:e.category,items:null===(t=e.properties)||void 0===t?void 0:t.map(function(e){return e.name}),iconName:e.iconName}})},n.prototype.changePropTitleAndDescription=function(e,t,o){this.ensureLocalizationPath(e);var n=this.localeStrings[e],i=this.currentProperties.getPropertyClassName(t);i&&(n[i]||(n[i]={}),n[i][t]=o)},n.prototype.ensureLocalizationPath=function(e){this.localeStrings||(this.localeStrings={});for(var t=e.split("."),o=this.localeStrings,n=0;n<t.length;n++){var i=t[n];o[i]||(o[i]={}),o=o[i]}},n.prototype.onDetailPanelInPopupApply=function(t,o,n){var i,s,r=this,a=n.getValue("name");null===(i=this.getQuestionCategories(o.survey).value)||void 0===i||i.forEach(function(e){var o;return null===(o=e.properties)||void 0===o?void 0:o.forEach(function(o){var n;o.name==a&&(null===(n=r.currentProperties)||void 0===n||n.updatePropertyVisibility(t,e.category))})});var l=!1;if(-1==(null===(s=t.classes)||void 0===s?void 0:s.indexOf(this.currentClassName))){var u=o.visibleRows.findIndex(function(e){return e===n});u>=0&&(o.removeRow(u),l=!0)}return e.prototype.onDetailPanelInPopupApply.call(this,t,o,n),!l},n.prototype.editItem=function(o,n,i,s,r){var l=this;if(i.name===this.nameInnerMatrix&&this.currentProperties){var u=i.detailPanel.getQuestionByName("classes"),p=s.getValue("name");u.choices=this.currentProperties.getClassesBySharedProperty(p).map(function(e){return new t.ItemValue(e,l.getSelectorItemTitle(e))}),u.showSelectAllItem=u.choices.length>1;var c=i.visibleRows.findIndex(function(e){return e===s});if(c>=0){var d=i.value||[];d[c].classes=this.currentProperties.getSelectedClassesForProperty(p),i.value=a([],d,!0)}}e.prototype.editItem.call(this,o,n,i,s,r)},n}(d),C=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return s(n,e),n.prototype.createItemsMatrixJSON=function(e){var t={type:"matrixdynamic",name:"items",allowRowReorder:!0,cellType:"text",showHeader:!1,rowCount:0,allowAddRows:!1,addRowButtonLocation:"top",addRowText:"Add Custom Item",noRowsText:"There are no items",columns:[{name:"name",visible:!1},{name:"title"}],detailPanelMode:"underRow",detailElements:[{type:"text",name:"name",title:o.getLocString("presets.tabs.name"),isUnique:!0,isRequired:!0,readOnly:!0,visible:!1},{type:"text",name:"title",title:o.getLocString("presets.tabs.titleField"),visible:!1},{type:"dropdown",name:"iconName",title:o.getLocString("presets.tabs.iconName"),itemComponent:"svc-presets-icon-item",allowCustomChoices:!0,choices:this.iconList,visible:!1}]};return r(r({},t),e)},n.prototype.createMainPageCore=function(){return{title:o.getLocString("presets.tabs.title"),description:o.getLocString("presets.tabs.description"),navigationTitle:o.getLocString("presets.tabs.navigationTitle"),elements:[{type:"panel",name:this.mainPanelName,elements:[this.createItemsMatrixJSON({title:o.getLocString("presets.tabs.items"),noRowsText:o.getLocString("presets.tabs.noItemsText"),name:this.nameItems}),this.createItemsMatrixJSON({startWithNewLine:!1,title:o.getLocString("presets.tabs.hiddenItems"),noRowsText:o.getLocString("presets.tabs.noHiddenItemsText"),name:this.nameMatrix,descriptionLocation:"underInput"})]},{type:"panel",name:"panel_tabs_controls",elements:[{type:"dropdown",name:this.nameActiveTab,allowClear:!1,title:o.getLocString("presets.tabs.defaultTab")}]},{type:"panel",title:" ",name:this.navigationPanelName,elements:[{type:"html",html:"&nbsp"}]}]}},Object.defineProperty(n.prototype,"questionNames",{get:function(){return[this.nameItems,this.nameActiveTab]},enumerable:!1,configurable:!0}),n.prototype.filterTabs=function(e){return e.filter(function(e){return"presets"!=e.name})},n.prototype.hasIcon=function(e){return!0},n.prototype.getJsonValueCore=function(e,o,n){var i=e.getQuestionByName(this.nameItems).value;if(Array.isArray(i)){var s=this.filterTabs((null==n?void 0:n.items)||o.getTabs()),r=o.getTabsInfo(),a=i.map(function(e){return{name:e.name,iconName:e.iconName}});a.forEach(function(e){var t;e.iconName&&e.iconName!=(null===(t=r[e.name])||void 0===t?void 0:t.iconName)||delete e.iconName}),t.Helpers.isArraysEqual(a,s,!1)&&(a=void 0);var l=e.getValue(this.nameActiveTab);if(a||l!==((null==n?void 0:n.activeTab)||o.activeTab)||(l=void 0),a||l){var u={};return a&&(u.items=a),l&&(u.activeTab=l),u}}},n.prototype.getDefaultJsonValueCore=function(e){return{activeTab:e.activeTab,items:this.filterTabs(e.getTabs()).map(function(e){return{name:e.name}})}},n.prototype.getQuestionItems=function(e){return e.getQuestionByName(this.nameItems)},n.prototype.onMatrixRowRemoving=function(t,o,n){n.question.name===this.nameMatrix&&this.restoreItems(this.getQuestionItems(t),n.question,n.rowIndex),e.prototype.onMatrixRowRemoving.call(this,t,o,n)},n.prototype.isItemsMatrix=function(t){return t===this.nameItems||e.prototype.isItemsMatrix.call(this,t)},n.prototype.setJsonLocalizationStringsCore=function(e,t){this.getQuestionItems(e).visibleRows.forEach(function(e){l.updateModifiedText(t,e.getValue("title"),"tabs."+e.getValue("name"))})},n.prototype.setupQuestionsCore=function(e,t){this.setupPageQuestions(e,t.creator)},n.prototype.getAllTabs=function(e){return this.filterTabs(e.getAvailableTabs().map(function(e){return{name:e.name,title:o.editorLocalization.getString("tabs."+e.name),iconName:e.iconName}}))},n.prototype.setupOnCurrentPageCore=function(e,t,o){t.tabs.forEach(function(e){return e.enabled=o})},n.prototype.setupQuestionsValueCore=function(e,o,n){var i=((o=o||{}).items||[]).map(function(e){return"string"==typeof e?{name:e}:e}),s=n.initialTabs(),a=this.getAllTabs(n),l=a.filter(function(e){return s.indexOf(e.name)>=0});if(0===i.length)i=l;else for(var u=function(e){var t=l.filter(function(t){return t.name==i[e].name})[0];t&&(i[e]=r(r({},t),i[e]))},p=0;p<i.length;p++)u(p);var c=i.map(function(e){return e.name}),d=a.filter(function(e){return c.indexOf(e.name)<0});e.setValue(this.nameItems,i),e.setValue(this.nameMatrix,d),e.setValue(this.nameActiveTab,o.activeTab||n.activeTab),e.getQuestionByName(this.nameActiveTab).choices=i.map(function(e){return new t.ItemValue(e.name,e.title)})},n.prototype.onLocaleChangedCore=function(e,t,o){this.setupPageQuestions(e,o),this.setupQuestionsValueCore(e,t,o)},n.prototype.setupPageQuestions=function(e,o){this.defaultItems=this.getAllTabs(o),e.getQuestionByName(this.nameActiveTab).choices=this.defaultItems.map(function(e){return new t.ItemValue(e.name,e.title)})},n.prototype.updateOnValueChangedCore=function(o,n){if(e.prototype.updateOnValueChangedCore.call(this,o,n),n===this.nameItems){var i=o.getValue(n)||[],s=o.getQuestionByName(this.nameActiveTab);s.choices=i.map(function(e){return new t.ItemValue(e.name,e.title)}),s.selectedItem||s.selectItem(s.choices[0])}},Object.defineProperty(n.prototype,"nameActiveTab",{get:function(){return this.path+"_activeTab"},enumerable:!1,configurable:!0}),n}(p);t.FunctionFactory.Instance.register("searchItem",function(e){var t=this.survey.getQuestionByName(e[0]),o=e[1],n=e[2];if(!n)return!0;var i=t.choices.filter(function(e){return e.value==o})[0];return!i||-1!=i.text.toUpperCase().indexOf(n.toUpperCase())});var w=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return s(n,e),n.prototype.createMainPageCore=function(){var e=this.getSurveyLocales();return{title:o.getLocString("presets.languages.title"),description:o.getLocString("presets.languages.description"),navigationTitle:o.getLocString("presets.languages.navigationTitle"),elements:[{type:"dropdown",title:o.getLocString("presets.languages.creatorUI"),placeholder:o.editorLocalization.getLocaleName(""),name:this.creatorLocaleName,searchEnabled:!0,choices:this.getCreatorLocales()},{type:"panel",title:o.getLocString("presets.languages.surveyLanguages"),elements:[{type:"text",name:this.searchLocalesName,placeholder:o.getLocString("presets.languages.searchPlaceholder"),titleLocation:"hidden",textUpdateMode:"onTyping"},{type:"checkbox",name:this.surveyLocalesName,titleLocation:"hidden",minSelectedChoices:1,colCount:3,showSelectAllItem:e.length>1,choices:e,choicesEnableIf:'{item} <> "'+t.surveyLocalization.defaultLocale+'"',choicesVisibleIf:"searchItem('"+this.surveyLocalesName+"', {item}, {"+this.searchLocalesName+"}"}]},{type:"panel",title:" ",name:this.navigationPanelName,elements:[{type:"boolean",name:this.surveyUseEnglishNames,title:o.getLocString("presets.languages.translateToEnglish"),titleLocation:"hidden",renderAs:"switch"}]}]}},n.prototype.getMainElementNames=function(){return[this.surveyLocalesName]},n.prototype.getCustomQuestionCssSuffix=function(e){return e.name===this.searchLocalesName?"search":""},n.prototype.getJsonValueCore=function(e,t,o){var n=e.getValue(this.creatorLocaleName),i=!0===e.getValue(this.surveyUseEnglishNames),s=e.getQuestionByName(this.surveyLocalesName),r=s.isAllSelected||s.choices.length<2;if(n||!r||i){var a={};return n&&(a.creator=n),i&&(a.useEnglishNames=!0),!r&&Array.isArray(s.value)&&(a.surveyLocales=[],s.value.forEach(function(e){return a.surveyLocales.push(e)})),a}},n.prototype.setupQuestionsValueCore=function(e,t,o){t=t||{},e.setValue(this.creatorLocaleName,t.creator),e.setValue(this.surveyUseEnglishNames,!0===t.useEnglishNames),this.updateLocaleNames(e);var n=e.getQuestionByName(this.surveyLocalesName),i=t.surveyLocales;Array.isArray(i)&&i.length>0?n.value=i:n.value=n.choices.map(function(e){return e.value})},n.prototype.updateOnValueChangedCore=function(e,t){t===this.surveyUseEnglishNames&&this.updateLocaleNames(e)},Object.defineProperty(n.prototype,"creatorLocaleName",{get:function(){return this.path+"_creator"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"surveyLocalesName",{get:function(){return this.path+"_surveyLocales"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"searchLocalesName",{get:function(){return this.path+"_searchLocales"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"surveyUseEnglishNames",{get:function(){return this.path+"_surveyUseEnglishNames"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"questionNames",{get:function(){return[this.creatorLocaleName,this.surveyLocalesName,this.surveyUseEnglishNames]},enumerable:!1,configurable:!0}),n.prototype.getIsShowInEnglishSelected=function(e){return!0===e.getValue(this.surveyUseEnglishNames)},n.prototype.getCreatorLocales=function(){return this.getLocaleItemValues(o.editorLocalization.getLocales(),!1)},n.prototype.getSurveyLocales=function(){return this.getLocaleItemValues(Object.keys(t.surveyLocalization.locales),!0)},n.prototype.getLocaleItemValues=function(e,n){var i=[];return e.forEach(function(e){if(e&&"en"!==e){var n=o.editorLocalization.getLocaleName(e);n&&n!==e&&i.push(new t.ItemValue(e,n))}}),n&&i.unshift(new t.ItemValue("en",o.editorLocalization.getLocaleName("en"))),i},n.prototype.updateLocaleNames=function(e){var t=this.getIsShowInEnglishSelected(e),n=e.getQuestionByName(this.surveyLocalesName);n.choices.forEach(function(e){e.text=o.editorLocalization.getLocaleName(e.value,null,t)}),n.choicesOrder="none",n.choicesOrder="asc"},n}(l),x=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.optionsList=[],t}return s(n,e),n.prototype.createElements=function(){var e=t.ElementFactory.Instance.getAllToolboxTypes().map(function(e){return{value:e,text:o.editorLocalization.getString("qt."+e)}});return[{type:"panel",name:"designer",state:"expanded",elements:[{name:"pageEditMode",type:"dropdown",choices:["standard","bypage","single"]},{type:"panel",name:"designerHeader",elements:[{name:"showSurveyHeader",type:"boolean"},{name:"showHeaderInEmptySurvey",type:"boolean"}]},{type:"panel",name:"designerTitles",elements:[{name:"useElementTitles",type:"boolean"}]},{type:"panel",name:"designerZoomDrag",elements:[{name:"allowDragPages",type:"boolean"},{name:"allowZoom",type:"boolean"}]},{name:"expandCollapseButtonVisibility",type:"dropdown",choices:["never","onhover","always"]},{type:"panel",name:"designerExpandCollapse",elements:[{name:"collapseQuestions",type:"boolean"},{name:"collapsePanels",type:"boolean"},{name:"collapsePages",type:"boolean"}]},{name:"maxRows",type:"text",inputType:"number"},{name:"maxColumns",type:"text",inputType:"number"},{name:"minChoices",type:"text",inputType:"number"},{name:"maxChoices",type:"text",inputType:"number"},{name:"maxVisibleChoices",type:"text",inputType:"number",min:-1},{name:"maxRateValues",type:"text",inputType:"number"},{name:"forbiddenNestedElementsPanel",type:"tagbox",choices:e},{name:"forbiddenNestedElementsPanelDynamic",type:"tagbox",choices:e},{name:"maxPanelNestingLevel",type:"text",inputType:"number",min:-1},{type:"panel",name:"expressionsValidation",elements:[{name:"expressionsValidateFunctions",type:"boolean"},{name:"expressionsValidateVariables",type:"boolean"},{name:"expressionsValidateSyntax",type:"boolean"}]}]},{type:"panel",name:"preview",state:"expanded",elements:[{type:"panel",name:"previewSimulateDevice",elements:[{name:"previewAllowSimulateDevices",type:"boolean"}]},{name:"previewDevice",type:"dropdown",choices:[{value:"desktop",text:"Desktop"},{value:"iPhoneSE",text:"iPhone SE"},{value:"iPhone15",text:"iPhone 15"},{value:"iPhone15Plus",text:"iPhone 15 Plus"},{value:"iPad",text:"iPad"},{value:"iPadMini",text:"iPad Mini"},{value:"androidPhone",text:"Android Phone"},{value:"androidTablet",text:"Android Tablet"},{value:"microsoftSurface",text:"Microsoft Surface"}]},{name:"previewOrientation",type:"dropdown",choices:["landscape","portrait"]},{name:"previewAllowSelectLanguage",type:"dropdown",choices:["auto","all",!0,!1]},{type:"panel",name:"previewAllowSelect",elements:[{name:"previewAllowSelectPage",type:"boolean"},{name:"previewAllowHiddenElements",type:"boolean"}]}]},{type:"panel",name:"logic",state:"expanded",elements:[{type:"panel",name:"previewSimulateDevice",elements:[{name:"logicAllowTextEditExpressions",type:"boolean"}]},{name:"logicMaxItemsInCondition",type:"text",inputType:"number",min:-1}]},{type:"panel",name:"translation",state:"expanded",elements:[{type:"panel",name:"previewSimulateDevice",elements:[{name:"clearTranslationsOnSourceTextChange",type:"boolean"}]}]},{type:"panel",title:" ",name:this.navigationPanelName,elements:[{type:"html",html:"&nbsp"}]}]},n.prototype.addPathToName=function(e){return this.fullPath+"_"+e},n.prototype.patchElements=function(e){var t=this;return e.map(function(e){return e.name===t.navigationPanelName||("panel"===e.type?("expanded"==e.state&&(e.title=o.editorLocalization.getString("tabs."+e.name)),t.patchElements(e.elements)):(t.optionsList.push(e.name),e.title=o.editorLocalization.getString("presets.options.o."+e.name)),e.choices&&(e.choices=e.choices.map(function(t){var n=void 0!==t.value?t.value:t;return{value:n,text:t.text||o.editorLocalization.getString("presets.options.ov."+e.name+"."+n)}})),"number"===e.inputType&&void 0===e.min&&(e.min=0),"boolean"===e.type&&(e.renderAs="checkbox",e.useTitleAsLabel=!0),"dropdown"===e.type&&(e.searchEnabled=!1),e.name=t.addPathToName(e.name)),e})},n.prototype.createMainPageCore=function(){return this.optionsList=[],{title:o.getLocString("presets.options.title"),description:o.getLocString("presets.options.description"),navigationTitle:o.getLocString("presets.options.navigationTitle"),elements:this.patchElements(this.createElements())}},n.prototype.getDefaultJsonValueCore=function(e){var t=this.optionsList.reduce(function(t,o){return t[o]=e[o],t},{});return delete t.forbiddenNestedElementsPanel,delete t.forbiddenNestedElementsPanelDynamic,e.forbiddenNestedElements&&(t.forbiddenNestedElements={panel:a([],e.forbiddenNestedElements.panel,!0),paneldynamic:a([],e.forbiddenNestedElements.paneldynamic,!0)}),t},n.prototype.getJsonValueCore=function(e,o,n){var i,s,r=this,l={};if(this.optionsList.forEach(function(t){var o=e.getQuestionByName(r.addPathToName(t));o&&(l[t]=o.value)}),((null===(i=l.forbiddenNestedElementsPanel)||void 0===i?void 0:i.length)||(null===(s=l.forbiddenNestedElementsPanelDynamic)||void 0===s?void 0:s.length))&&(l.forbiddenNestedElements={panel:a([],l.forbiddenNestedElementsPanel,!0),paneldynamic:a([],l.forbiddenNestedElementsPanelDynamic,!0)}),delete l.forbiddenNestedElementsPanel,delete l.forbiddenNestedElementsPanelDynamic,!t.Helpers.isTwoValueEquals(l,n))return l},n.prototype.setupQuestionsValueCore=function(e,t,o){var n=this;function i(e){return void 0===(null==t?void 0:t[e])?o[e]:t[e]}this.optionsList.forEach(function(t){var o,s,r=i(t);"forbiddenNestedElementsPanel"===t&&(r=null===(o=i("forbiddenNestedElements"))||void 0===o?void 0:o.panel)&&(r=a([],r,!0)),"forbiddenNestedElementsPanelDynamic"===t&&(r=null===(s=i("forbiddenNestedElements"))||void 0===s?void 0:s.paneldynamic)&&(r=a([],r,!0)),e.getQuestionByName(n.addPathToName(t)).value=r})},Object.defineProperty(n.prototype,"questionNames",{get:function(){var e=this;return this.optionsList.map(function(t){return e.addPathToName(t)})},enumerable:!1,configurable:!0}),n.prototype.onGetQuestionTitleActions=function(e,n,i){var s,r=this.fullPath+"_";if((null===(s=i.question.parent)||void 0===s?void 0:s.name.substring(0,r.length))===r){var a=i.question.name.substring(r.length),l=o.editorLocalization.getString("presets.options.ohelp."+a);if(l!=a){i.actions=[{id:"hint",css:"sv-action-bar-item--hint",iconName:new t.ComputedUpdater(function(){return i.question.description?"icon-hidehint-16x16":"icon-hint-16x16"}),iconSize:"auto",action:function(){i.question.description?i.question.description="":i.question.description=l}}]}}},n.prototype.onGetPanelTitleActions=function(e,o,n){var i=this.fullPath+"_";if(n.panel.name!==this.navigationPanelName&&n.panel.name.substring(0,i.length)===i){n.actions=[{id:"collapse",css:"sv-action-bar-item--collapse",locTooltipName:new t.ComputedUpdater(function(){return n.panel.isCollapsed?"ed.expandTooltip":"ed.collapseTooltip"}),iconName:new t.ComputedUpdater(function(){return n.panel.isCollapsed?"icon-expandpanel-16x16":"icon-collapsepanel-16x16"}),iconSize:"auto",action:function(){n.panel.isCollapsed?n.panel.expand():n.panel.collapse()}}]}},n}(l),S={languages:{title:"Languages",navigationTitle:"Languages",description:"Select the language of the Survey Creator UI and target\nlanguages for the survey being configured.",creatorUI:"Survey Creator UI language",defaultSurveyLocale:"Default survey language",surveyLanguages:"Survey languages",searchPlaceholder:"Type to search...",translateToEnglish:"Translate language names to English"},tabs:{title:"Configure tabs",navigationTitle:"Tabs",description:"Select the tabs you want to show, reorder them, change their titles,\nand choose the tab that will be active by default.",items:"Visible tabs",hiddenItems:"Hidden tabs",defaultTab:"Default tab",noItemsText:"Drag tabs here to show them",noHiddenItemsText:"Drag tabs here to hide them",name:"Name",titleField:"Title",iconName:"Icon name"},toolbox:{title:"Set up the Toolbox",navigationTitle:"Toolbox",description:"Select the toolbox items you want to show, group them into categories, \nrename them, and change their order if required.",toolbox:"Toolbox",categories:"Categories",noCategoriesText:"No categories",noItemsText:"Drag items here to show them",noHiddenItemsText:"Drag items here to hide them",hiddenItems:"Hidden toolbox items",enableGrouping:"Enable grouping",showCategoryTitles:"Show category titles",categoryName:"Name",categoryTitle:"Title",tooltip:"Tooltip",iconName:"Icon name",jsonObject:"JSON object to apply when users select this toolbox item",subitems:"Subitems",enableSubitems:"Enable subitems for this question",moveAsSubitem:"Move as a subitem to...",addToToolbox:"Add to Toolbox",deleteCustomItem:"Delete Custom Item",addCustomCategory:"New Category",addCustomItem:"New Item",addNewItem:"Add a new item",addNewSubitem:"Add a new subitem",noRowsText:"There are no items",newItem:"New item in"},propertyGrid:{title:"Customize the Property Grid",navigationTitle:"Property Grid",description:"Hide, rename, reorder, or change property grouping in the Property Grid.",selectElement:"Select a survey element to customize",propertyGrid:"Property Grid",noCategoriesText:"No categories",noItemsText:"Drag properties here to show them",noHiddenItemsText:"Drag properties here to hide them",hiddenItems:"Hidden properties",categoryName:"Name",categoryTitle:"Title",iconName:"Icon name",name:"Name",titleField:"Title",descriptionField:"Helper text",propertyVisibleIn:"Property visible in",addCustomCategory:"New Category"},options:{title:"Options",navigationTitle:"Options",description:"Detailed configuration settings for Survey Creator.",o:{pageEditMode:"Page edit mode",showSurveyHeader:"Show survey header",showHeaderInEmptySurvey:"Show header when survey is empty",useElementTitles:"Show element titles instead of IDs",allowDragPages:"Enable page drag-and-drop",allowZoom:"Enable zoom controls",expandCollapseButtonVisibility:"Show expand/collapse buttons",collapseQuestions:"Collapse questions by default",collapsePanels:"Collapse panels by default",collapsePages:"Collapse pages by default",maxRows:"Maximum number of matrix rows",maxColumns:"Maximum number of matrix columns",minChoices:"Minimum number of choices",maxChoices:"Maximum number of choices",maxVisibleChoices:"Maximum number of visible choices",maxRateValues:"Maximum number of rating values",forbiddenNestedElementsPanel:"Elements not allowed inside a Panel",forbiddenNestedElementsPanelDynamic:"Elements not allowed inside a Dynamic Panel",maxPanelNestingLevel:"Maximum panel nesting depth",previewAllowSimulateDevices:"Enable survey preview on different devices",previewDevice:"Default device for preview",previewOrientation:"Preview orientation",previewAllowSelectLanguage:"Show language selector",previewAllowSelectPage:"Show page selector",previewAllowHiddenElements:"Show toggle for hidden elements",logicAllowTextEditExpressions:"Allow editing expressions as plain text",logicMaxItemsInCondition:"Maximum number of items in a logic condition",clearTranslationsOnSourceTextChange:"Clear translations when source text changes",expressionsValidateFunctions:"Validate variables and element names in expressions",expressionsValidateVariables:"Validate functions in expressions",expressionsValidateSyntax:"Validate expression syntax"},ov:{pageEditMode:{standard:"Scrollable pages",bypage:"Page-by-page editing",single:"Single page only"},expandCollapseButtonVisibility:{never:"Never",always:"Always",onhover:"On hover"},previewOrientation:{landscape:"Landscape (Horizontal)",portrait:"Portrait (Vertical)"},previewAllowSelectLanguage:{auto:"Only for multilingual surveys",true:"Always (all available languages)",all:"Always (translated languages when available)",false:"Never"}},ohelp:{pageEditMode:'Choose how pages are navigated in the Designer tab. "Scrollable pages" - survey designers can scroll to move between multiple pages; "Page-by-page editing" - survey designers switch between pages using the page menu; "Single page only" - all questions are placed on a single page, and page creation and deletion are disabled.',showSurveyHeader:"Controls whether survey designers can see and edit the survey header and its properties.",showHeaderInEmptySurvey:"Controls whether the survey title and description appear on the design surface when the survey has no questions or panels.",useElementTitles:"Controls whether Survey Creator displays titles instead of IDs for survey elements across the UI, including the survey tree, conditional logic, validation rules, etc.",allowDragPages:"Controls whether survey designers can drag and drop pages to reorder them on the design surface.",allowZoom:"Controls whether the Zoom In, Zoom Out, and Zoom to 100% buttons are available.",maxRows:"Specifies the number of rows that survey designers can add to Single-Select Matrix and Multi-Select Matrix questions.",maxColumns:"Specifies the number of columns that survey designers can add to Single-Select Matrix, Multi-Select Matrix, and Dynamic Matrix questions.",minChoices:"Specifies the minimum number of choices allowed in Checkboxes, Dropdown, Radio Button Group, and other choice questions. Survey designers won't be able to delete choices below this limit.",maxChoices:"Specifies the maximum number of choices survey designers can add to Checkboxes, Dropdown, Radio Button Group, and other choice questions.",maxVisibleChoices:"Specifies the maximum number of choices shown. Survey designers can click “Show more” to view hidden choices. Set to -1 to show all choices.",maxRateValues:"Specifies the maximum number of rating values that survey designers can add to Rating Scale questions.",maxPanelNestingLevel:"Specifies the maximum nesting level for Panels and Dynamic Panels. Use -1 for no limit, 0 to allow nesting only questions, or a positive number to set the maximum nesting depth.",previewAllowSimulateDevices:"Controls whether the Preview tab shows the Device button for testing surveys on different devices.",previewAllowSelectLanguage:'Choose whether the Preview tab shows the language selector. "Only for multilingual surveys" - show the selector only if the survey has translations; "Always (translated languages when available)" - always show the selector, listing only survey translations when present and all available languages otherwise; "Always (all available languages)" - always show the selector with all available languages; "Never" - never show the selector.',previewAllowSelectPage:"Choose whether the Preview tab shows the page selector at the bottom. When enabled, survey designers can freely navigate between pages, ignoring validation rules.",previewAllowHiddenElements:"Specifies whether the Preview tab shows a toogle (eye icon) to show or hide invisible survey elements.",logicAllowTextEditExpressions:"Controls whether survey designers can manually edit logical expressions in the Logic tab as plain text instead of using the visual editor.",logicMaxItemsInCondition:"-1 is unlimited.",clearTranslationsOnSourceTextChange:"Specifies whether translations in other languages are cleared when the source language text is changed.",expressionsValidateFunctions:"When selected, Survey Creator reports an error if an expression references an unknown variable or survey element name.",expressionsValidateVariables:"When selected, Survey Creator reports an error if an expression uses an unknown function.",expressionsValidateSyntax:"When selected, Survey Creator reports an error if an expression contains syntax errors."}},items:{addNewItem:"Add a new item",addNewSubitem:"Add a new subitem",newItem:"New item in",addCustomCategory:"New Category",newCategory:"New category in",moveToCategory:"Move to category...",moveToNewCategory:"Move to new category",categoriesLabel:"Categories",moveTo:"Move To...",removeFrom:"Remove from {0}",more:"More",restoreToDefault:"Restore",edit:"Edit",expand:"Expand",collapse:"Collapse",remove:"Remove",add:"Add",delete:"Delete"},editor:{title:"Creator Presets",presetJson:"Preset JSON:",copy:"Copy",download:"Download",load:"Load",saveExit:"Save & Exit",back:"Back",resetToDefault:"Reset",resetToDefaults:"All settings restored to default",resoredToDefault:"resored to default",itemRestoredToDefault:"Item restored to default",categoryRestoredToDefault:"Category restored to default",edit:"Edit",completeText:"Save & Exit",pagePrevText:"Back",required:"Please enter a value."},plugin:{buttonTitle:"UI Configuration Manager",buttonDescription:"Configure the Toolbox, Tabs, Property Grid, and other UI elements, and save the setup as a reusable preset.",presetsTab:"Presets",creatorPresets:"Creator Presets",save:"Save",add:"Add",discard:"Discard",cancel:"Cancel",saveAs:"Save as...",saveAsTitle:"Save current preset as...",quit:"Quit",quitConfirmation:"Exit to Survey Creator?",quitConfirmationMessage:"You will loose all unsaved changes",quitConfirmationSave:"Save and exit",quitConfirmationDiscard:"Exit without saving",deleteConfirmation:"Delete {0}?",deleteConfirmationMessage:"You will not be able to restore it",deleteConfirmationOk:"Yes, delete",deleteConfirmationCancel:"No, cancel",switchPresetConfirmation:"Switch Preset?",switchPresetConfirmationMessage:"You will loose all unsaved changes",switchPresetConfirmationOk:"Yes, switch",switchPresetConfirmationCancel:"No, cancel",file:"File",import:"Import",export:"Export",edit:"Edit",resetLanguages:"Reset Languages",resetAll:"Reset all changes",resetConfirmation:"Do you really want to reset the settings?",resetConfirmationMessage:"You will lose all changes",resetConfirmationOk:"Yes, reset the settings",resetConfirmationCancel:"No, cancel",status:{saved:"Saved",unsaved:"Unsaved changes",saving:"Saving...",initial:"Initial"},resetToDefaults:"Reset {0}",defaultSettings:"Default Settings",basic:"Basic",advanced:"Advanced",expert:"Expert",editPresetsList:"Edit Presets list...",editPresetsListTitle:"Edit Presets list",addNewPreset:"Add new preset...",addNewPresetTitle:"Add new preset",deletePreset:"Delete",savedPresets:"Saved presets",license:"<a href='https://surveyjs.io/' target='_blank'>UI Preset Editor</a> is available only with a PRO license. To use it in your application, please <a href='https://surveyjs.io/manage#renewals-and-upgrades' target='_blank'>upgrade your license</a>.",license2:"Your maintenance subscription expired on {date}. You may continue using all <a href='https://surveyjs.io/stay-updated/release-notes' target='_blank'>versions released up to that date</a>. To remove this banner in the latest version, please <a href='https://surveyjs.io/manage#license-manager' target='_blank'>renew your subscription</a> and <a href='https://surveyjs.io/remove-alert-banner' target='_blank'>set up a new license key</a>. Please note <a href='https://surveyjs.io/' target='_blank'>UI Preset Editor</a> is available to all users with an active PRO license.",licenseCreator:"To use the Survey Creator plugin in your application, a <a href='https://surveyjs.io/licensing' target='_blank'>developer license</a> is required. If you have an active license, please <a href='https://surveyjs.io/remove-alert-banner' target='_blank'>set up your license key</a> and ensure you're using the <a href='https://surveyjs.io/stay-updated/release-notes' target='_blank'>latest version</a>. Please note <a href='https://surveyjs.io/' target='_blank'>UI Preset Editor</a> is included only in the PRO license tier.",licenseCreator2:"Your maintenance subscription expired on {date}. You may continue using all <a href='https://surveyjs.io/stay-updated/release-notes' target='_blank'>versions released up to that date</a>. To remove this banner in the latest version, please <a href='https://surveyjs.io/manage#license-manager' target='_blank'>renew your subscription</a> and <a href='https://surveyjs.io/remove-alert-banner' target='_blank'>set up a new license key</a>. Please note <a href='https://surveyjs.io/' target='_blank'>UI Preset Editor</a> is included only in the PRO license tier. To use it in your application, please also <a href='https://surveyjs.io/manage#renewals-and-upgrades' target='_blank'>upgrade your license</a>."}};o.getLocaleStrings("en").presets=S;var _=function(e){function t(){var t=e.call(this)||this;return t.cssClasses={root:"sps-navigation-bar",defaultSizeMode:"",smallSizeMode:"",item:"sps-navigation-bar__item sps-navigation-bar-item",itemWithTitle:"",itemAsIcon:"",itemActive:"sps-navigation-bar-item--active",itemPressed:"sps-navigation-bar-item--pressed",itemIcon:"sps-navigation-bar-item__icon",itemTitle:"sps-navigation-bar-item__title",itemTitleWithIcon:""},t}return s(t,e),t}(t.ActionContainer),P=function(e){function n(n,i,s){var r=e.call(this)||this;return r.creatorValue=i,r.defaultJsonValue=s,r.applying=!1,o.editorLocalization.presetStrings=void 0,r.presetValue=new o.UIPreset(n),r.creatorValue||(r.creatorValue=r.createCreator({})),r.modelValue=r.createModel(),r.resultModelValue=r.createResultModel(),r.locTitle=new t.LocalizableString(void 0,!1),r.locTitle.text=o.getLocString("presets.editor.title"),r.navigationBarValue=new _,r.preset.setJson(r.getJsonFromSurveyModel()),r}return s(n,e),Object.defineProperty(n.prototype,"navigationBar",{get:function(){return this.navigationBarValue},enumerable:!1,configurable:!0}),n.prototype.dispose=function(){e.prototype.dispose.call(this),this.disposeModel()},n.prototype.disposeModel=function(){this.resetAllPages(),this.model.editablePresets.forEach(function(e){return e.dispose()}),this.model.dispose()},Object.defineProperty(n.prototype,"preset",{get:function(){return this.presetValue},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"creator",{get:function(){return this.creatorValue},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"model",{get:function(){return this.modelValue},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"resultModel",{get:function(){return this.upldateResultJson(),this.resultModelValue},enumerable:!1,configurable:!0}),n.prototype.getLocale=function(){return o.editorLocalization.currentLocale||"en"},Object.defineProperty(n.prototype,"json",{get:function(){return this.preset.getJson()},set:function(e){this.preset.setJson(e),this.updateDataFromJson(this.modelValue),this.upldateResultJson()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"jsonText",{get:function(){return JSON.stringify(this.json,null,2)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"defaultJson",{get:function(){return this.defaultJsonValue},enumerable:!1,configurable:!0}),n.prototype.createCreator=function(e){return new o.SurveyCreatorModel(e)},n.prototype.resetAllPages=function(){var e=this;this.model.editablePresets.forEach(function(t){return t.setupOnCurrentPage(e.model,e.creator,!0)}),this.creator.readOnly=!1},n.prototype.resetToDefaults=function(e){var t=this;e||this.notify(o.getLocString("presets.editor.resetToDefaults")),this.model.editablePresets.forEach(function(o){e&&o.pageName!=e||o.resetToDefaults(t.model,!!e)})},n.prototype.activatePage=function(e,t,o){var n=this,i=o.filter(function(t){return e.currentPage.name!==t.pageName}),s=o.filter(function(t){return e.currentPage.name===t.pageName})[0];i.forEach(function(t){return t.setupOnCurrentPage(e,n.creator,!1)}),s.setupOnCurrentPage(e,this.creator,!0)},n.prototype.notify=function(e){this.creator.notify(e)},n.prototype.updateDataFromJson=function(e){var t=this,n=this.preset.getJson()||{};return o.editorLocalization.presetStrings=n.localization,e.editablePresets.forEach(function(o){return o.setupQuestions(e,t)}),e.editablePresets.forEach(function(o){return o.setupQuestionsValue(e,n[o.path],t.creator)}),this.updateJsonLocalizationStrings(e.editablePresets),n},n.prototype.onLocaleChanged=function(){var e=this,t=this.preset.getJson();this.model.editablePresets.forEach(function(o){return o.onLocaleChanged(e.model,t[o.path],e.creator)})},n.prototype.createModel=function(){var e=this,n=this.createEditablePresets(),i=new t.SurveyModel(this.getEditModelJson(n));function s(e){e.isDescendantOf("matrixdynamic")&&(e.onCreateDetailPanelRenderedRowCallback=function(e){e.cells=[e.cells[1]],e.cells[0].colSpans+=2})}return i.css=u,i.editablePresets=n,i.keepIncorrectValues=!0,i.showNavigationButtons=!1,i.completeText=o.getLocString("presets.editor.completeText"),i.pagePrevText=o.getLocString("presets.editor.pagePrevText"),i.enterKeyAction="loseFocus",i.fitToContainer=!1,n.forEach(function(t){return t.notifyCallback=function(t){return e.notify(t)}}),this.defaultJsonValue||(this.defaultJsonValue={},n.forEach(function(t){return e.defaultJsonValue[t.path]=t.getDefaultJsonValue(e.creator)})),this.updateDataFromJson(i),this.activatePage(i,this.creator,n),i.onCurrentPageChanged.add(function(t,o){e.activatePage(i,e.creator,n)}),i.onValueChanged.add(function(t,o){var s,r=n.filter(function(e){return!e.isSettingUp}).map(function(e){return e.questionNames}).reduce(function(e,t){return e.concat(t)},[]);n.forEach(function(e){return e.updateOnValueChanged(i,o.name)}),-1==r.indexOf(o.name)||e.applying||(e.applyFromSurveyModel(!1),e.activatePage(i,e.creator,n),null===(s=e.onJsonChangedCallback)||void 0===s||s.call(e))}),i.onGetQuestionTitleActions.add(function(t,o){n.forEach(function(t){o.question.name==t.getNavigationElementName()&&(o.question.getTitleToolbar().isResponsivenessDisabled=!0,o.actions=i.navigationBar.actions),t.onGetQuestionTitleActions(i,e.creator,o)})}),i.onGetPanelTitleActions.add(function(t,o){n.forEach(function(t){o.panel.name==t.getNavigationElementName()&&(o.panel.getTitleToolbar().isResponsivenessDisabled=!0,o.actions=i.navigationBar.actions),t.onGetPanelTitleActions(i,e.creator,o)})}),i.getAllQuestions().forEach(function(e){return s(e)}),i.onQuestionCreated.add(function(e,t){s(t.question)}),i.onMatrixDetailPanelVisibleChanged.add(function(t,o){n.forEach(function(t){return t.updateOnMatrixDetailPanelVisibleChanged(i,e.creator,o)})}),i.onGetMatrixRowActions.add(function(t,o){n.forEach(function(t){return t.onGetMatrixRowActions(i,e.creator,o)})}),i.onMatrixRowDragOver.add(function(t,o){n.forEach(function(t){return t.onMatrixRowDragOver(i,e.creator,o)})}),i.onMatrixRowRemoving.add(function(t,o){n.forEach(function(t){return t.onMatrixRowRemoving(i,e.creator,o)})}),i.onMatrixRowAdded.add(function(t,o){n.forEach(function(t){return t.onMatrixRowAdded(i,e.creator,o)})}),i.onMatrixCellValueChanged.add(function(t,o){n.forEach(function(t){return t.onMatrixCellValueChanged(i,e.creator,o)})}),i.onUpdateQuestionCssClasses.add(function(e,t){n.forEach(function(e){var o=e.getCustomQuestionCssSuffix(t.question);o&&(t.cssClasses.mainRoot+=" sps-question--"+o),e.getMainElementNames().indexOf(t.question.name)>=0&&(t.cssClasses.mainRoot+=" sps-question--main",t.cssClasses.row+=" sps-table__row--main",t.cssClasses.buttonAdd+=" sps-matrixdynamic__add-btn--icon",t.cssClasses.iconAdd="sps-matrixdynamic__add-btn-icon",t.cssClasses.iconAddId="#icon-add-24x24")})}),i.onUpdatePanelCssClasses.add(function(e,t){n.forEach(function(e){t.panel.name===e.getNavigationElementName()&&(t.cssClasses.panel.container+=" sps-panel--navigation ")})}),i.onUpdatePageCssClasses.add(function(e,t){n.forEach(function(e){e.pageName===t.page.name&&(t.cssClasses.page.root+=" sps-page--"+e.fullPath)})}),i},n.prototype.createResultModel=function(){var e=this,n=new t.SurveyModel({elements:[{type:"html",name:"q1",html:this.getResultHtml()},{type:"comment",name:"json",title:o.getLocString("presets.editor.presetJson"),rows:60,cols:120,readOnly:!0}]});return n.showPrevButton=!1,n.showCompleteButton=!1,n.showQuestionNumbers=!1,n.width="900px",n.onGetQuestionTitleActions.add(function(t,n){if("json"===n.question.name){var i=n.question;n.actions.push({id:"json_copy",iconName:"icon-copy",title:o.getLocString("presets.editor.copy"),action:function(){navigator.clipboard.writeText(i.value)}}),n.actions.push({id:"json_download",iconName:"icon-download",title:o.getLocString("presets.editor.download"),action:function(){e.downloadJsonFile(i.value)}}),n.actions.push({id:"icon-load",iconName:"icon-load",title:o.getLocString("presets.editor.load"),action:function(){e.loadJsonFile()}})}}),n},n.prototype.getResultHtml=function(){return"<div>".concat(o.getLocString("presets.editor.usageExample"),"</div>")},n.prototype.downloadJsonFile=function(e){var o=t.DomDocumentHelper.getDocument();e||(e=this.jsonText);var n=new Blob([e],{type:"application/json"}),i=o.createElement("a");i.href=URL.createObjectURL(n),i.download="preset.json",o.body.appendChild(i),i.click(),o.body.removeChild(i)},n.prototype.loadJsonFile=function(){var e=this;o.CreatorDomHelper.openFileDialog(function(t){return e.importFromFile(t)},".json")},n.prototype.importFromFile=function(e){var t=this,o=new FileReader;o.onload=function(e){var n=o.result;t.json=JSON.parse(n)},o.readAsText(e)},n.prototype.upldateResultJson=function(){this.resultModelValue.getQuestionByName("json").value=this.jsonText},n.prototype.applyFromSurveyModel=function(e){return void 0===e&&(e=!0),this.applying=!0,e&&!this.validateEditableModel(this.model)?(this.applying=!1,!1):(this.preset.setJson(this.getJsonFromSurveyModel()),this.model.setValue("json_result",JSON.stringify(this.preset.getJson(),null,2)),this.preset.apply(this.creator,!0),this.applying=!1,!0)},n.prototype.getJsonFromSurveyModel=function(){var e=this,t={};return this.model.editablePresets.forEach(function(o){var n,i=o.getJsonValue(e.model,e.creator,null===(n=e.defaultJsonValue)||void 0===n?void 0:n[o.path]);i&&(t[o.path]=i)}),this.getJsonLocalizationStrings(t),t},n.prototype.getJsonLocalizationStrings=function(e){var t=this,o={};this.model.editablePresets.forEach(function(e){e.setJsonLocalizationStrings(t.model,o)}),this.json&&this.json.localization&&(e.localization=JSON.parse(JSON.stringify(this.json.localization)));var n=this.getLocale();Object.keys(o).length>0?(e.localization||(e.localization={}),e.localization[n]=o):e.localization&&(e.localization[n]&&delete e.localization[n],0===Object.keys(e.localization).length&&delete e.localization)},n.prototype.updateJsonLocalizationStrings=function(e){var t=(this.json&&this.json.localization?JSON.parse(JSON.stringify(this.json.localization)):{})[this.getLocale()]||{};e.forEach(function(e){e.updateJsonLocalizationStrings(t)})},n.prototype.validateEditableModel=function(e){if(!e.validate(!0,!0))return!1;for(var t=e.editablePresets,o=0;o<t.length;o++)if(!t[o].validate(e))return!1;return!0},n.prototype.createEditableCore=function(e,t){return"languages"===t?new w(e):"tabs"===t?new C(e):"toolbox"===t?new g(e):"propertyGrid"===t?new b(e):"options"===t?new x(e):void 0},n.prototype.createEditable=function(e,t,o){var n=this,i=this.createEditableCore(e,o);return i&&e.children.forEach(function(e){var t=n.createEditable(e,i,o+"_"+e.getPath());t&&(i.children.push(t),t.parent=i)}),i},n.prototype.createEditablePresets=function(){var e=this,t=[];return this.preset.children.forEach(function(o){var n=e.createEditable(o,void 0,o.getPath());n&&t.push(n)}),t},n.prototype.getEditModelJson=function(e){var t={pages:[],showQuestionNumbers:!1};return e.forEach(function(e){var o=e.createPages();Array.isArray(o)&&o.forEach(function(e){return t.pages.push(e)})}),t},n}(t.Base),L=function(){function e(e){this.creator=e,this.unsaved=!1,this.customPresets=[],this._presetsArray=[]}return e.prototype.setStatus=function(e){this.unsaved=e},Object.defineProperty(e.prototype,"isSaved",{get:function(){return!this.unsaved},enumerable:!1,configurable:!0}),e.prototype.getPresetTitle=function(e){return o.getLocString("preset.names."+e)},e.prototype.confirmSwitchPreset=function(e){this.isSaved?e():n(this.creator,{category:"danger",title:o.getLocString("presets.plugin.switchPresetConfirmation"),message:o.getLocString("presets.plugin.switchPresetConfirmationMessage"),applyText:o.getLocString("presets.plugin.switchPresetConfirmationOk"),cancelText:o.getLocString("presets.plugin.switchPresetConfirmationCancel"),iconName:"icon-warning-24x24",showCloseButton:!1,onApply:function(){return e(),!0},onCancel:function(){return!0}})},e.prototype.presetListToItems=function(e){var t=this;return e.filter(function(e){return!1!==o.CreatorPresets[e].visible}).map(function(e){return{id:e,title:t.getPresetTitle(e),action:function(n){t.confirmSwitchPreset(function(){var i;t.presetsList.selectedItem=n,null===(i=t.selectPresetCallback)||void 0===i||i.call(t,o.CreatorPresets[e])})}}})},Object.defineProperty(e.prototype,"presetsMenuItems",{get:function(){var e=this,t=this.presetListToItems(o.PredefinedCreatorPresets),n=this.presetListToItems(this.customPresets),i={id:"editPresetsList",needSeparator:n.length+t.length>0,title:o.getLocString("presets.plugin.editPresetsList"),action:function(){return e.editPresetsList(e.applyPresetsList.bind(e))}};return a(a(a([],t,!0),n,!0),[i],!1)},enumerable:!1,configurable:!0}),e.prototype.setPresetNewName=function(e){var n,i,s=new t.SurveyModel({showNavigationButtons:"none",enterKeyAction:"loseFocus",questionErrorLocation:"bottom",focusFirstQuestionAutomatic:!0,elements:[{type:"dropdown",name:"presetName",allowCustomChoices:!0,choices:this.customPresets.map(function(e){return{value:e,text:e}}),titleLocation:"hidden",requiredErrorText:o.getLocString("presets.editor.required"),isRequired:!0}]});s.css=u,s.questionErrorLocation="bottom";var r=null===(n=t.settings.showDialog)||void 0===n?void 0:n.call(t.settings,{componentName:"survey",data:{survey:s,model:s},onApply:function(){return!!s.validate()&&(e(s.getValue("presetName")),!0)},cssClass:"sps-popup svc-property-editor svc-creator-popup",title:o.getLocString("presets.plugin.saveAsTitle"),displayMode:"popup"},null===(i=this.creator)||void 0===i?void 0:i.rootElement);this.customizePopupButtons(r,o.getLocString("presets.plugin.save"),o.getLocString("presets.plugin.cancel"))},e.prototype.getPresetsListToEdit=function(){var e=this;return a(a([],o.PredefinedCreatorPresets.map(function(t){var n;return{title:e.getPresetTitle(t),name:t,visible:!1!==(null===(n=o.CreatorPresets[t])||void 0===n?void 0:n.visible),custom:!1}}),!0),this.customPresets.map(function(e){return{title:e,name:e,visible:!0,custom:!0}}),!0)},e.prototype.applyPresetsList=function(e){var t,n,i,s,a,l=this;this.customPresets=[];var u={};e.forEach(function(e){if(o.PredefinedCreatorPresets.includes(e.name))o.CreatorPresets[e.name].visible=e.visible;else{var t=(e.title||e.name||"").trim(),n=e.name;if(!t)return;n&&n!==t&&o.CreatorPresets[n]&&(o.CreatorPresets[t]=r(r({},o.CreatorPresets[n]),{presetName:t}),delete o.CreatorPresets[n],u[n]=t),l.customPresets.push(t)}}),this.rebuildPresetsArray(),null===(t=this.onPresetListSaved)||void 0===t||t.call(this,this._presetsArray),this.updateMenu();var p=null===(i=null===(n=this.presetsList)||void 0===n?void 0:n.selectedItem)||void 0===i?void 0:i.id;if(p&&u[p]){var c=null===(a=null===(s=this.presetsList)||void 0===s?void 0:s.getActionById)||void 0===a?void 0:a.call(s,u[p]);c&&this.presetsList.onItemClick(c)}this.ensureSelectedPresetAvailable()},e.prototype.ensureSelectedPresetAvailable=function(){var e,t,n,i,s=null===(t=null===(e=this.presetsList)||void 0===e?void 0:e.selectedItem)||void 0===t?void 0:t.id,r=this.getPresetsListToEdit().filter(function(e){return e.visible}).map(function(e){return e.name});if(!(r.indexOf(s)>=0)){var a=r[0];if(a&&o.CreatorPresets[a]){var l=null===(i=null===(n=this.presetsList)||void 0===n?void 0:n.getActionById)||void 0===i?void 0:i.call(n,a);l&&this.presetsList.onItemClick(l)}}},e.prototype.rebuildPresetsArray=function(){var e=this;this._presetsArray.length=0,a(a([],o.PredefinedCreatorPresets,!0),this.customPresets,!0).forEach(function(t){var n;e._presetsArray.push({name:t,visible:!1!==(null===(n=o.CreatorPresets[t])||void 0===n?void 0:n.visible)})})},e.prototype.getPresetsArray=function(){return this.rebuildPresetsArray(),this._presetsArray},e.prototype.addPresetsListEditor=function(e,i){var s=this,a=new t.QuestionMatrixDynamicModel("presetsList");a.fromJSON({type:"matrixdynamic",name:"presetsList",columns:[{name:"title",title:"Title"},{name:"name",visible:!1},{name:"visible",visible:!1,cellType:"boolean"},{name:"custom",cellType:"boolean",visible:!1,defaultValue:!0}],cellType:"text",rowCount:0,hideColumnsIfEmpty:!0,addRowText:o.getLocString("presets.plugin.addNewPreset"),allowRowReorder:!0,allowCustomChoices:!0,isRequired:!0}),e.onMatrixCellCreated.add(function(e,t){"title"===t.columnName&&(t.cellQuestion.readOnly=!t.row.getValue("custom"))});var l=!1;e.onMatrixRowRemoving.add(function(e,t){t.allow=l,l?l=!1:n(s.creator,{category:"danger",title:o.getLocString("presets.plugin.deleteConfirmation").replace("{0}",t.row.getValue("title")),message:o.getLocString("presets.plugin.deleteConfirmationMessage"),applyText:o.getLocString("presets.plugin.deleteConfirmationOk"),cancelText:o.getLocString("presets.plugin.deleteConfirmationCancel"),iconName:"icon-delete-24x24",showCloseButton:!1,onApply:function(){return l=!0,t.question.removeRow(t.rowIndex),!0},onCancel:function(){return!0}})}),e.onGetMatrixRowActions.add(function(e,n){var i=n.actions.filter(function(e){return"remove-row"==e.id})[0],s=function(e){return e.getValue("visible")?"icon-visible-24x24":"icon-invisible-24x24"},r=new t.Action({id:"visible",iconName:s(n.row),location:"end",css:n.row.getValue("visible")?"":"sps-action--invisible",action:function(){n.row.getQuestionByName("visible").value=!n.row.getValue("visible"),r.iconName=s(n.row),r.css=n.row.getValue("visible")?"":"sps-action--invisible"}});n.actions.push(r),n.row.getValue("custom")?(i.iconName="icon-delete-24x24",i.iconSize="auto",i.component="sv-action-bar-item",i.innerCss="sps-action-button sps-action-button--danger",i.tooltip=o.getLocString("presets.plugin.deletePreset"),i.showTitle=!1,i.action=function(){n.question.removeRowUI(n.row)}):i.visible=!1}),e.onMatrixRowAdding.add(function(e,n){var i,a,l=new t.SurveyModel({showNavigationButtons:"none",enterKeyAction:"loseFocus",questionErrorLocation:"bottom",elements:[{type:"text",name:"presetName",titleLocation:"hidden",isRequired:!0},{type:"buttongroup",name:"template",title:"Template",defaultValue:"basic",choices:[{value:"basic",text:"Basic"},{value:"advanced",text:"Advanced"},{value:"expert",text:"Expert"}]}]});l.css=r(r({},u),{buttongroup:r({},o.propertyGridCss.buttongroup)});var p=null===(i=t.settings.showDialog)||void 0===i?void 0:i.call(t.settings,{componentName:"survey",data:{survey:l,model:l},onApply:function(){if(!l.validate())return!1;var e=l.getValue("presetName"),t=o.CreatorPresets[l.getValue("template")];o.CreatorPresets[e]=t?JSON.parse(JSON.stringify(t)):{presetName:e,json:{}};var i=n.question.value||[];return i.push({title:e,name:e,visible:!0,custom:!0}),n.question.value=i,!0},cssClass:"sps-popup sps-popup--level2 svc-property-editor svc-creator-popup",title:o.getLocString("presets.plugin.addNewPreset"),displayMode:"popup"},null===(a=s.creator)||void 0===a?void 0:a.rootElement);s.customizePopupButtons(p,o.getLocString("presets.plugin.add"),o.getLocString("presets.plugin.discard")),n.allow=!1}),e.pages[0].addQuestion(a),a.value=this.getPresetsListToEdit()},e.prototype.customizePopupButtons=function(e,t,n){if(e.footerToolbar){var i=e.footerToolbar.cssClasses;i.item="sps-btn",e.footerToolbar.cssClasses=i;var s=e.footerToolbar.getActionById("apply"),r=e.footerToolbar.getActionById("cancel");s.innerCss="sps-btn--primary-brand",s.title=t||o.getLocString("buttons.apply"),r.innerCss="sps-btn--secondary-brand",r.css+=" sps-action--grow",r.title=n||o.getLocString("buttons.cancel")}},e.prototype.editPresetsList=function(e){var n,i,s=new t.SurveyModel({showNavigationButtons:"none",enterKeyAction:"loseFocus",questionErrorLocation:"bottom",questionTitleLocation:"hidden",pages:[{name:"page1",elements:[]}]});this.addPresetsListEditor(s),s.css=r(r({},u),{actionBar:r(r({},o.propertyGridCss.actionBar),{itemIcon:u.actionBar.itemIcon+" sps-action-button__icon--muted"}),matrixdynamic:r(r({},o.propertyGridCss.matrixdynamic),{buttonAdd:u.matrixdynamic.buttonAdd,footer:o.propertyGridCss.matrixdynamic.footer+" sps-matrixdynamic__footer--in-dialog"})});var a=null===(n=t.settings.showDialog)||void 0===n?void 0:n.call(t.settings,{componentName:"survey",data:{survey:s,model:s},onApply:function(){return!!s.validate()&&(e(s.getValue("presetsList")),!0)},cssClass:"sps-popup svc-property-editor svc-creator-popup",title:o.getLocString("presets.plugin.editPresetsListTitle"),displayMode:"popup"},null===(i=this.creator)||void 0===i?void 0:i.rootElement);this.customizePopupButtons(a,o.getLocString("presets.plugin.save"),o.getLocString("presets.plugin.discard"))},e.prototype.updateMenu=function(){var e;null===(e=this.presetsList)||void 0===e||e.setItems(this.presetsMenuItems),this.presetSelector&&(this.presetSelector.choices=this.getPresetsListToEdit().filter(function(e){return e.visible}).map(function(e){return{value:e.name,text:e.title}}))},e.prototype.update=function(){this.updateMenu()},e.prototype.saveAs=function(e,t){var o=this;this.setPresetNewName(function(n){o.addPreset({presetName:n,json:e}),t(n),o.presetsList.onItemClick(o.presetsList.getActionById(n))})},e.prototype.addPreset=function(e){var t=null==e?void 0:e.presetName;if(t){var n=o.CreatorPresets[t];o.CreatorPresets[t]=n?r(r({},n),e):e,-1===o.PredefinedCreatorPresets.indexOf(t)&&-1===this.customPresets.indexOf(t)&&this.customPresets.push(t),this.rebuildPresetsArray(),this.updateMenu()}},e.prototype.removePreset=function(e){delete o.CreatorPresets[e],this.customPresets=this.customPresets.filter(function(t){return t!==e}),this.rebuildPresetsArray(),this.updateMenu(),this.ensureSelectedPresetAvailable()},e.prototype.getPreset=function(e){return o.CreatorPresets[e]},e.prototype.getCurrentPreset=function(){var e,t,n=null===(t=null===(e=this.presetsList)||void 0===e?void 0:e.selectedItem)||void 0===t?void 0:t.id;return n?o.CreatorPresets[n]:void 0},e}(),T=function(){function e(n){var i=this;this.creator=n,this.activeTab="designer",this.currentPresetIndex=0,this.saveCount=0,this.onPresetListSaved=new t.EventBase,this.saveToFileHandler=o.saveToFileHandler,this.preventTabSwitch=function(e,t){t.allow=!1},n.addTab({name:"presets",title:o.getLocString("presets.plugin.presetsTab"),plugin:this,iconName:e.iconName,isInternal:!0}),this.designerPlugin=n.getPlugin("designer");var s=this.creator.sidebar.getPageById("creatorTheme");s.componentData.elements[0].componentName="svc-presets-property-grid",s.componentData.elements[0].componentData.model.showPresets=function(){return i.showPresets()},this.toolboxCompact=n.toolbox.forceCompact,this.presetsManager=new L(n),this.presetsManager.onPresetListSaved=function(e){i.onPresetListSaved.fire(i,{presets:e})},this.presetsManager.selectPresetCallback=function(e){i.model.json=e.json,i.setStatus("initial")},this.creator.onSurveyInstanceCreated.add(function(e,t){"designer-tab:creator-settings:preset"==t.area&&(i.presetsManager.presetSelector=t.survey.getQuestionByName("presetName"),i.presetsManager.update())})}return e.prototype.showPresets=function(){this.activeTab=this.creator.activeTab,this.creator.activeTab="presets"},e.prototype.hidePresets=function(){this.presetsManager&&!this.presetsManager.isSaved&&(this.model.json=this.defaultJson,this.model.applyFromSurveyModel(!1)),this.presetsManager.update(),this.presetsManager.presetSelector.value=this.presetsList.selectedItem.id,this.creator.onActiveTabChanging.remove(this.preventTabSwitch),this.creator.activeTab=this.activeTab},e.prototype.confirmReset=function(e){n(this.creator,{category:"danger",title:o.getLocString("presets.plugin.resetConfirmation"),message:o.getLocString("presets.plugin.resetConfirmationMessage"),applyText:o.getLocString("presets.plugin.resetConfirmationOk"),cancelText:o.getLocString("presets.plugin.resetConfirmationCancel"),iconName:"icon-warning-24x24",showCloseButton:!1,onApply:function(){return e(),!0},onCancel:function(){return!0}})},e.prototype.confirmQuit=function(e,t){n(this.creator,{title:o.getLocString("presets.plugin.quitConfirmation"),message:o.getLocString("presets.plugin.quitConfirmationMessage"),applyText:o.getLocString("presets.plugin.quitConfirmationSave"),cancelText:o.getLocString("presets.plugin.quitConfirmationDiscard"),iconName:"icon-warning-24x24",showCloseButton:!0,onApply:function(){return e(),!0},onCancel:function(){return t(),!0}})},e.prototype.addPreset=function(e){this.presetsManager.addPreset({presetName:e.name,json:e.getJson()})},e.prototype.removePreset=function(e){this.presetsManager.removePreset("string"==typeof e?e:e.name)},e.prototype.getPreset=function(e){return this.presetsManager.getPreset(e)},e.prototype.getCurrentPreset=function(){return this.presetsManager.getCurrentPreset()},Object.defineProperty(e.prototype,"presets",{get:function(){return this.presetsManager.getPresetsArray()},enumerable:!1,configurable:!0}),e.prototype.performSave=function(e){var t=this;void 0===e&&(e=!1),this.savePresetFunc?(this.setStatus("saving"),this.savePresetFunc(this.saveCount,function(){t.saveHandler(e)})):this.saveHandler(e)},e.prototype.saveOrSaveAs=function(e){var t;void 0===e&&(e=!1);var n=null===(t=this.getCurrentPreset())||void 0===t?void 0:t.presetName;n&&-1===o.PredefinedCreatorPresets.indexOf(n)?this.performSave(e):this.saveAsHandler(e)},e.prototype.saveHandler=function(e){void 0===e&&(e=!1),this.defaultJson=JSON.parse(JSON.stringify(this.model.json)),this.saveCount++,this.setStatus("saved"),e&&this.hidePresets()},e.prototype.saveAsHandler=function(e){var t=this;void 0===e&&(e=!1),this.presetsManager.saveAs(this.model.json,function(){t.performSave(e)})},e.prototype.setStatus=function(e){this.presetsManager.setStatus("unsaved"===e);var t=this.model.navigationBar.getActionById("presets-status");t.visible="unsaved"===e,t.title=o.getLocString("presets.plugin.status."+e.toLowerCase())},e.prototype.activate=function(){var e,n=this;this.creator.onActiveTabChanging.add(this.preventTabSwitch),this.model=new P({},this.creator,this.defaultJson),this.defaultJson=r({},this.model.defaultJson),this.currentValue&&(this.model.model.data=this.currentValue),this.designerPlugin.activateSidebar();var i=null===(e=this.model)||void 0===e?void 0:e.model.pages.map(function(e){return{id:e.name,title:e.navigationTitle}});this.model.model.onComplete.add(function(){return n.hidePresets()});var s=this.presetsManager.presetsMenuItems,a=[{id:"save",title:o.getLocString("presets.plugin.save"),action:function(){return n.saveOrSaveAs()}},{id:"saveAs",title:o.getLocString("presets.plugin.saveAs"),action:function(){return n.saveAsHandler()}},{id:"import",title:o.getLocString("presets.plugin.import"),markerIconName:"import-24x24",needSeparator:!0,action:function(e){var t;null===(t=n.model)||void 0===t||t.loadJsonFile()}},{id:"export",title:o.getLocString("presets.plugin.export"),markerIconName:"download-24x24",action:function(e){var t;null===(t=n.model)||void 0===t||t.downloadJsonFile()}},{id:"reset-current",title:o.getLocString("presets.plugin.resetLanguages"),needSeparator:!0,action:function(){n.confirmReset(function(){var e;return null===(e=n.model)||void 0===e?void 0:e.resetToDefaults("page_languages")})}},{id:"reset",title:o.getLocString("presets.plugin.resetAll"),css:"sps-list__item--alert",action:function(){n.confirmReset(function(){var e;return null===(e=n.model)||void 0===e?void 0:e.resetToDefaults()})}}];i.forEach(function(e){e.action=function(e){n.pagesList.selectedItem=e,n.model&&(n.model.model.currentPage=n.model.model.getPageByName(e.id))}});var l,u={showPointer:!1,verticalPosition:"bottom",horizontalPosition:"center",searchEnabled:!1,cssClass:"sps-popup-menu sps-popup-menu--dropdown",cssClasses:c},p=t.createDropdownActionModel({items:[],id:"presets-list",iconName:"icon-chevron_16x16",iconSize:16,title:o.getLocString("presets.plugin.creatorPresets"),css:"sps-navigation-action"},r(r({},u),{items:s,onSelectionChanged:function(e){"editPresetsList"===e.id?(n.presetsList.selectedItem=l,(null==l?void 0:l.title)&&(p.title=l.title)):l=e},onBlur:function(){p.popupModel.hide()}}),this.model.model),d=t.createDropdownActionModel({items:[],id:"presets-pages",iconName:"icon-chevron_16x16",iconSize:16,title:o.getLocString("presets.plugin.select"),css:"sps-navigation-action"},r(r({},u),{items:i,onBlur:function(){d.popupModel.hide()}}),this.model.model),m=t.createDropdownActionModel({items:[],id:"presets-edit",iconName:"icon-chevron_16x16",iconSize:16,title:o.getLocString("presets.plugin.edit"),css:"sps-navigation-action"},r(r({},u),{onSelectionChanged:function(){m.title=o.getLocString("presets.plugin.edit")},items:a,onBlur:function(){m.popupModel.hide()}}),this.model.model),g=new t.Action({id:"presets-status",enabled:!1,visible:!1,title:"Saved",css:"sps-navigation-action sps-navigation-action--label sps-navigation-action--large-icon"}),h=new t.Action({id:"presets-quit",iconName:"icon-exit-24x24",title:o.getLocString("presets.plugin.quit"),css:"sps-navigation-action sps-navigation-action--right sps-navigation-action--large-icon",action:function(){n.presetsManager.isSaved?n.hidePresets():n.confirmQuit(function(){return n.saveOrSaveAs(!0)},function(){return n.hidePresets()})}});this.designerPlugin.tabControlModel.bottomToolbar.actions.forEach(function(e){return e.visible=!1}),s.length>0&&this.model.navigationBar.addAction(p),this.model.navigationBar.addAction(d),this.model.navigationBar.addAction(m),this.model.navigationBar.addAction(g),this.model.navigationBar.addAction(h),this.pagesList=d.popupModel.contentComponentData.model,this.presetsList=p.popupModel.contentComponentData.model,this.presetsManager.presetsList=this.presetsList;var f=m.popupModel.contentComponentData.model.getActionById("reset-current");this.saveAction=m.popupModel.contentComponentData.model.getActionById("save"),this.pagesList.selectedItem=this.pagesList.actions[0],d.title=this.pagesList.selectedItem.title||"",this.model.model.onCurrentPageChanged.add(function(e,t){n.pagesList.selectedItem=n.pagesList.actions[n.model.model.currentPageNo],d.title=n.pagesList.selectedItem.title||"",f.title=o.getLocString("presets.plugin.resetToDefaults").replace("{0}",n.model.model.currentPage.navigationTitle),f.action=function(){var e;null===(e=n.model)||void 0===e||e.resetToDefaults(n.pagesList.selectedItem.id)}}),this.model.onJsonChangedCallback=function(){n.setStatus("unsaved")},this.presetsList.selectedItem=this.presetsList.actions.filter(function(e){var t;return e.id==(null===(t=n.presetsManager.presetSelector)||void 0===t?void 0:t.value)})[0],l=this.presetsList.selectedItem,this.presetsList.selectedItem&&(this.presetsList.selectedItem.action(this.presetsList.selectedItem),p.title=this.presetsList.selectedItem.title||""),setTimeout(function(){i[n.currentPresetIndex].action(i[n.currentPresetIndex])},100)},e.prototype.deactivate=function(){var e,t;return this.creator.toolbox.forceCompact=this.toolboxCompact,this.currentValue=null===(e=this.model)||void 0===e?void 0:e.model.data,this.designerPlugin.tabControlModel.bottomToolbar.actions.forEach(function(e){return e.visible=!0}),this.currentPresetIndex=(null===(t=this.model)||void 0===t?void 0:t.model.currentPageNo)||0,this.model&&this.model.dispose(),this.model=void 0,!0},e.prototype.onLocaleChanged=function(){this.model&&this.model.onLocaleChanged()},e.prototype.getLicenseText=function(e,n){var i,s;if(!(null===t.hasLicense||void 0===t.hasLicense?void 0:t.hasLicense(8))){var r=null===(s=null===(i=null===t.glc||void 0===t.glc?void 0:t.glc(8))||void 0===i?void 0:i.toLocaleDateString)||void 0===s?void 0:s.call(i);return r?o.getLocString("presets.plugin.license2").replace("{date}",r):e?o.getLocString("presets.plugin.license"):n?o.getLocString("presets.plugin.licenseCreator2").replace("{date}",n):o.getLocString("presets.plugin.licenseCreator")}return""},e.defaultPresetName="expert",e.iconName="icon-settings",e}(),I=function(e){function n(t){var o=e.call(this,t)||this;return o.jsonErrors=[],o}return s(n,e),n.prototype.getType=function(){return"presetjson"},n.prototype.getCssType=function(){return"comment"},n.prototype.getTemplate=function(){return"comment"},Object.defineProperty(n.prototype,"textAreaModel",{get:function(){var e=this;if(!this.jsonAreaModelValue){var n=this.getTextAreaOptions(),i=this;n.getTextValue=function(){return JSON.stringify(e.value,null,2)},n.onTextAreaChange=function(n){!function(n){if(t.Helpers.isTwoValueEquals(JSON.stringify(i.value,null,2),n,!1,!0,!1))e.jsonErrors=[];else try{var s=(new o.SurveyJSON5).parse(n),a=r(r({},s),{name:"temp"}),l=new t.JsonObject;if(l.toObject({elements:[a]},new t.SurveyModel),e.jsonErrors=l.errors.map(function(e){return e.message}),e.jsonErrors.length>0)return;i.value=s}catch(t){e.jsonErrors=[t.message]}}(n.target.value)},this.jsonAreaModelValue=new t.TextAreaModel(n)}return this.jsonAreaModelValue},enumerable:!1,configurable:!0}),n.prototype.onCheckForErrors=function(o,n,i){var s=this;e.prototype.onCheckForErrors.call(this,o,n,i),this.jsonErrors.forEach(function(e){o.push(new t.CustomError(e,s))})},n}(t.QuestionCommentModel);t.ElementFactory.Instance.registerElement("presetjson",function(e){return new I(e)},!1),t.Serializer.addClass("presetjson",[],function(){return new I("")},"comment"),e.Version=void 0,e.Version="".concat("2.5.27"),t.checkLibraryVersion(e.Version,"survey-creator-core-presets"),e.CreatorPresetEditableBase=l,e.CreatorPresetEditableLanguages=w,e.CreatorPresetEditableOptions=x,e.CreatorPresetEditableTabs=C,e.CreatorPresetEditableToolboxConfigurator=g,e.CreatorPresetEditorModel=P,e.NavigationBar=_,e.PresetsManager=L,e.QuestionPresetJsonModel=I,e.UIPresetEditor=T,e.enStrings=S,e.showConfirmDialog=n});