@kbss-cvut/s-forms 0.7.1-beta-27a7b90.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/s-forms.js CHANGED
@@ -1,2 +1,2 @@
1
- import"core-js/modules/es.array.some.js";import"core-js/modules/es.object.to-string.js";import"core-js/modules/es.promise.js";import e,{useMemo as t,useState as n,useEffect as o,useContext as r,useRef as i,forwardRef as a}from"react";import s from"prop-types";import"core-js/modules/es.object.assign.js";import*as l from"jsonld";import"core-js/modules/es.array.concat.js";import"core-js/modules/es.array.is-array.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/es.array.find.js";import"core-js/modules/es.array.for-each.js";import"core-js/modules/es.array.includes.js";import"core-js/modules/es.array.map.js";import"core-js/modules/es.object.keys.js";import"core-js/modules/es.object.values.js";import"core-js/modules/es.string.includes.js";import"core-js/modules/es.string.repeat.js";import"core-js/modules/web.dom-collections.for-each.js";import*as u from"jsonld-utils";import"core-js/modules/es.array.sort.js";import c from"@kbss-cvut/tsort";import"core-js/modules/es.number.constructor.js";import"core-js/modules/es.number.max-safe-integer.js";import p from"react-dom";import{Form as m,FormGroup as d,FormControl as h,OverlayTrigger as f,Tooltip as E,Col as v,Row as S,Button as A,Badge as g,Overlay as _,FormText as T,Popover as I,ListGroup as N,ListGroupItem as O,Card as C,Accordion as L,ButtonToolbar as R,Nav as y,NavItem as b,NavLink as w,Modal as D}from"react-bootstrap";import"core-js/modules/es.array.iterator.js";import"core-js/modules/es.set.js";import"core-js/modules/es.string.iterator.js";import"core-js/modules/esnext.set.add-all.js";import"core-js/modules/esnext.set.delete-all.js";import"core-js/modules/esnext.set.difference.js";import"core-js/modules/esnext.set.every.js";import"core-js/modules/esnext.set.filter.js";import"core-js/modules/esnext.set.find.js";import"core-js/modules/esnext.set.intersection.js";import"core-js/modules/esnext.set.is-disjoint-from.js";import"core-js/modules/esnext.set.is-subset-of.js";import"core-js/modules/esnext.set.is-superset-of.js";import"core-js/modules/esnext.set.join.js";import"core-js/modules/esnext.set.map.js";import"core-js/modules/esnext.set.reduce.js";import"core-js/modules/esnext.set.some.js";import"core-js/modules/esnext.set.symmetric-difference.js";import"core-js/modules/esnext.set.union.js";import"core-js/modules/web.dom-collections.iterator.js";import"core-js/modules/es.array.every.js";import"core-js/modules/es.array.find-index.js";import"core-js/modules/es.date.to-string.js";import V from"react-datepicker";import{parse as M,format as H}from"date-fns";import U from"classnames";import"core-js/modules/es.array.index-of.js";import"core-js/modules/es.array.slice.js";import"core-js/modules/es.object.get-own-property-names.js";import x from"yasgui-yasqe";import"@triply/yasgui/build/yasgui.min.css";import"core-js/modules/web.timers.js";import j from"inputmask-core";import{IntelligentTreeSelect as P}from"intelligent-tree-select/lib/components/IntelligentTreeSelect.js";import"intelligent-tree-select/lib/styles.css";import"core-js/modules/es.array.splice.js";import"core-js/modules/es.date.now.js";import"core-js/modules/es.regexp.to-string.js";import{jsx as q,jsxs as F}from"react/jsx-runtime";import"core-js/modules/es.parse-int.js";import"core-js/modules/es.regexp.exec.js";import"core-js/modules/es.string.replace.js";import Q from"javascript-time-ago";import z from"javascript-time-ago/locale/en";import k from"javascript-time-ago/locale/cs";import{motion as B}from"framer-motion";import{Rings as W}from"react-loader-spinner";import"core-js/modules/es.string.trim.js";import{useIntl as G,IntlProvider as X}from"react-intl";import"core-js/modules/es.number.is-integer.js";import"core-js/modules/es.regexp.constructor.js";function Y(){return Y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Y.apply(this,arguments)}function K(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,J(e,t)}function J(e,t){return J=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},J(e,t)}function Z(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)t.indexOf(n=i[o])>=0||(r[n]=e[n]);return r}function $(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function ee(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return $(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var te,ne=/*#__PURE__*/function(){function e(){}return e.log=function(e){console.log(e)},e.warn=function(e){console.warn?console.warn(e):console.log("WARNING: "+e)},e.error=function(e){console.error?console.error(e):console.log("ERROR: "+e)},e}(),oe=["children"],re=/*#__PURE__*/e.createContext({}),ie=function(n){var o=n.children,r=Z(n,oe),i=[],a=function(e,t){try{var n=i[e];return n&&n.length?Promise.resolve(n):Promise.resolve(r.fetchTypeAheadValues(t)).then(function(t){return t.length?l.frame(t,{},{}).then(function(t){var n,o=t["@graph"];return i.push(Object.assign({},o,((n={})[e]=o,n))),o}):(ne.warn("No data received when loading options using id "+e),[])})}catch(e){return Promise.reject(e)}},s=function(e){return i[e]||[]},u=t(function(){return{loadFormOptions:a,getOptions:s}},[a,s]);/*#__PURE__*/return e.createElement(re.Provider,Y({value:u},r),o)};ie.propTypes={children:s.element.isRequired,fetchTypeAheadValues:s.func};var ae=function(){};te=ae,ae.COLUMN_COUNT=12,ae.INPUT_LENGTH_THRESHOLD=50,ae.DATETIME_NUMBER_FORMAT="x",ae.FORM="http://onto.fel.cvut.cz/ontologies/documentation/form",ae.HAS_SUBQUESTION="http://onto.fel.cvut.cz/ontologies/documentation/has_related_question",ae.HAS_ANSWER="http://onto.fel.cvut.cz/ontologies/documentation/has_answer",ae.HAS_OPTION="http://onto.fel.cvut.cz/ontologies/form/has-possible-value",ae.HAS_OPTIONS_QUERY="http://onto.fel.cvut.cz/ontologies/form/has-possible-values-query",ae.HAS_VALUE_TYPE="http://onto.fel.cvut.cz/ontologies/form/has-value-type",ae.IS_DISABLED="http://onto.fel.cvut.cz/ontologies/aviation/form-376/is-disabled",ae.INPUT_MASK="http://onto.fel.cvut.cz/ontologies/form/has-input-mask",ae.LAYOUT_CLASS="http://onto.fel.cvut.cz/ontologies/form-layout/has-layout-class",ae.LAYOUT={FORM:"form",QUESTION_SECTION:"section",WIZARD_STEP:"wizard-step",DATE:"date",TIME:"time",DATETIME:"datetime",TEXT:"text",TEXTAREA:"textarea",CHECKBOX:"checkbox",QUESTION_TYPEAHEAD:"type-ahead",MASKED_INPUT:"masked-input",ANSWERABLE:"answerable",SPARQL:"sparql",TURTLE:"ttl",DISABLED:"disabled",HIDDEN:"hidden",COLLAPSED:"collapsed",EMPHASISED:"emphasised",EMPHASISE_ON_RELEVANT:"emphasise-on-relevant",CATEGORY:["category-1","category-2","category-3","category-4","category-5"]},ae.HAS_INITIAL_INPUT_LENGTH="http://onto.fel.cvut.cz/ontologies/form-layout/has-initial-input-length",ae.VALUE_TYPE_CODE="code",ae.VALUE_TYPE_TEXT="text",ae.GENERATED_ROW_SIZE=1,ae.HAS_QUESTION_ORIGIN="http://onto.fel.cvut.cz/ontologies/form/has-question-origin",ae.HAS_ANSWER_ORIGIN="http://onto.fel.cvut.cz/ontologies/form/has-answer-origin",ae.HAS_DATA_VALUE="http://onto.fel.cvut.cz/ontologies/documentation/has_data_value",ae.HAS_OBJECT_VALUE="http://onto.fel.cvut.cz/ontologies/documentation/has_object_value",ae.HELP_DESCRIPTION="http://purl.org/dc/elements/1.1/description",ae.SOURCE="http://purl.org/dc/elements/1.1/source",ae.XSD={MAX_EXCLUSIVE:"http://www.w3.org/2001/XMLSchema#maxExclusive",MAX_INCLUSIVE:"http://www.w3.org/2001/XMLSchema#maxInclusive",MIN_EXCLUSIVE:"http://www.w3.org/2001/XMLSchema#minExclusive",MIN_INCLUSIVE:"http://www.w3.org/2001/XMLSchema#minInclusive",INT:"http://www.w3.org/2001/XMLSchema#int",INTEGER:"http://www.w3.org/2001/XMLSchema#integer",NEGATIVE_INTEGER:"http://www.w3.org/2001/XMLSchema#negativeInteger",NON_NEGATIVE_INTEGER:"http://www.w3.org/2001/XMLSchema#nonNegativeInteger",NON_POSITIVE_INTEGER:"http://www.w3.org/2001/XMLSchema#nonPositiveInteger",POSITIVE_INTEGER:"http://www.w3.org/2001/XMLSchema#positiveInteger",FLOAT:"http://www.w3.org/2001/XMLSchema#float",POSITIVE_FLOAT:"http://www.w3.org/2001/XMLSchema#positiveFloat",NEGATIVE_FLOAT:"http://www.w3.org/2001/XMLSchema#negativeFloat",BOOLEAN:"http://www.w3.org/2001/XMLSchema#boolean"},ae.STEP="http://onto.fel.cvut.cz/ontologies/form/step",ae.PATTERN="http://onto.fel.cvut.cz/ontologies/form/pattern",ae.ACCEPTS_ANSWER_VALUE="http://onto.fel.cvut.cz/ontologies/form/accepts-answer-value",ae.ACCEPTS="http://onto.fel.cvut.cz/ontologies/form/accepts",ae.HAS_DATATYPE="http://onto.fel.cvut.cz/ontologies/form/has-datatype",ae.HAS_LAYOUT_CLASS="http://onto.fel.cvut.cz/ontologies/form/has-layout-class",ae.HAS_POSSIBLE_VALUES_QUERY="http://onto.fel.cvut.cz/ontologies/form/has-possible-values-query",ae.HAS_REQUIRED_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-required-value",ae.HAS_TESTED_QUESTION="http://onto.fel.cvut.cz/ontologies/form/has-tested-question",ae.HAS_TESTED_FORM="http://onto.fel.cvut.cz/ontologies/form/has-tested-form",ae.HAS_UNIT="http://onto.fel.cvut.cz/ontologies/form/has-unit",ae.HAS_VALID_ANSWER="http://onto.fel.cvut.cz/ontologies/form/has-valid-answer",ae.IS_RELEVANT_IF="http://onto.fel.cvut.cz/ontologies/form/is-relevant-if",ae.ACCEPTS_VALIDATION_VALUE="http://onto.fel.cvut.cz/ontologies/form/accepts-validation-value",ae.HAS_VALIDATION_MESSAGE="http://onto.fel.cvut.cz/ontologies/form/has-validation-message",ae.NEGATIVE_CONDITION="http://onto.fel.cvut.cz/ontologies/form/negative-condition",ae.REQUIRES_ANSWER="http://onto.fel.cvut.cz/ontologies/form/requires-answer",ae.USED_ONLY_FOR_COMPLETENESS="http://onto.fel.cvut.cz/ontologies/form/used-only-for-completeness",ae.REQUIRES_ANSWER_DESCRIPTION_IF="http://onto.fel.cvut.cz/ontologies/form/requires-answer-description-if",ae.REQUIRES_ANSWER_IF="http://onto.fel.cvut.cz/ontologies/form/requires-answer-if",ae.HAS_PRECEDING_QUESTION="http://onto.fel.cvut.cz/ontologies/form/has-preceding-question",ae.HAS_PRECEDING_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-preceding-value",ae.HAS_MEDIA_CONTENT="http://onto.fel.cvut.cz/ontologies/form/has-media-content",ae.CONDITION="http://onto.fel.cvut.cz/ontologies/form/condition",ae.OR_CONDITION="http://onto.fel.cvut.cz/ontologies/form/or-condition",ae.HAS_SUB_CONDITION="http://onto.fel.cvut.cz/ontologies/form/has-sub-condition",ae.HAS_PATTERN="http://onto.fel.cvut.cz/ontologies/form-lt/has-pattern",ae.HAS_DECLARED_PREFIX="http://onto.fel.cvut.cz/ontologies/form-spin/has-declared-prefix",ae.PREFIX="http://www.w3.org/ns/shacl#prefix",ae.NAMESPACE="http://www.w3.org/ns/shacl#namespace",ae.HAS_COMMENT="http://onto.fel.cvut.cz/ontologies/form/has-comment",ae.HAS_COMMENT_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-comment-value",ae.HAS_AUTHOR="http://onto.fel.cvut.cz/ontologies/form/has-author",ae.HAS_TIMESTAMP="http://onto.fel.cvut.cz/ontologies/form/has-timestamp",ae.TIME_FORMAT="http://onto.fel.cvut.cz/ontologies/form/time-format",ae.DATE_FORMAT="http://onto.fel.cvut.cz/ontologies/form/date-format",ae.DATETIME_FORMAT="http://onto.fel.cvut.cz/ontologies/form/datetime-format",ae.NOT_ANSWERED_QUESTION="http://onto.fel.cvut.cz/ontologies/form/not-answered-question",ae.ANSWERED_QUESTION="http://onto.fel.cvut.cz/ontologies/form/answered-question",ae.HAS_VALIDATION_SEVERITY="http://onto.fel.cvut.cz/ontologies/form/has-validation-severity",ae.RDFS_LABEL=u.RDFS_LABEL,ae.RDFS_COMMENT=u.RDFS_COMMENT,ae.DEFAULT_HAS_CHILD=u.DEFAULT_HAS_CHILD,ae.BROADER="http://www.w3.org/2004/02/skos/core#broader",ae.HAS_NON_SELECTABLE_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-non-selectable-value",ae.PROVIDES_DEREFERENCEABLE_ANSWER_VALUES="http://onto.fel.cvut.cz/ontologies/form/provides-dereferenceable-answer-values",ae.ICONS={QUESTION_COMMENTS:"questionComments",QUESTION_HELP:"questionHelp",QUESTION_LINK:"questionLink"},ae.ICON_BEHAVIOR={ENABLE:"enable",DISABLE:"disable",ON_HOVER:"onHover"},ae.DEFAULT_OPTIONS={icons:[{id:te.ICONS.QUESTION_HELP,behavior:te.ICON_BEHAVIOR.ENABLE},{id:te.ICONS.QUESTION_COMMENTS,behavior:te.ICON_BEHAVIOR.ON_HOVER},{id:te.ICONS.QUESTION_LINK,behavior:te.ICON_BEHAVIOR.ON_HOVER}]},ae.LANG={cs:{locale:"cs",label:"Čestina"},en:{locale:"en",label:"English"}},ae.VALIDATION={SEVERITY:{ERROR:"error",WARNING:"warning"},DEFAULT_MESSAGE:{REQUIRED:"This field is required.",REQUIRED_ONLY_FOR_COMPLETENESS:"This field is required to complete the form.",INVALID:"This field is invalid.",CHECK:"This field must be checked.",LOWER_OR_EQUAL:"This field should be a number equal or lower to ",GREATER_OR_EQUAL:"This field must be greater or equal to "},CLASSNAME:{ERROR:"is-invalid",WARNING:"is-warning"}};var se=/*#__PURE__*/function(){function e(){}return e.getStringHash=function(e){var t=0,n=e?e.length:0;if(0===n)return t;for(var o=0;o<n;o++)t=(t<<5)-t+e.charCodeAt(o),t&=t;return t},e.asArray=function(e){return e?e.constructor===Array?e:[e]:[]},e.findQuestionById=function(t,n,o,r,i){if(o&&n["@id"]===t)return n;var a=e.asArray(n[ae.HAS_SUBQUESTION]);if(r)for(var s,l=ee(a);!(s=l()).done;){var u=e.findQuestionById(t,s.value,!0,!1,!1);if(u)return u}if(i)for(var c,p=ee(a);!(c=p()).done;){var m=e.findQuestionById(t,c.value,!1,!0,!0);if(m)return m}return null},e.findKeyInObjects=function(e,t){for(var n=0;n<e.length;n++)for(var o=0;o<t.length;o++)if(e[n].hasOwnProperty(t[o]))return t[o];return null},e}(),le=/*#__PURE__*/function(){function e(){}return e.putObject=function(t,n){e.objectMap[t]=n},e.getObject=function(t){return e.objectMap[t]},e}();le.objectMap={};var ue=/*#__PURE__*/function(){function e(){}return e.getFirstObject=function(e,t){var n=l.getValues(e,t);return 0===n.length?null:n[0]},e.compareValues=function(e,t){return t="object"==typeof t?t:{"@value":t},!!((e="object"==typeof e?e:{"@value":e})&&e["@value"]&&t&&t["@value"]&&("string"==typeof e["@value"]?e["@value"]:JSON.stringify(e["@value"]))===("string"==typeof t["@value"]?t["@value"]:JSON.stringify(t["@value"])))||l.compareValues(e,t)},e.toplogicalSort=function(e,t){var n;do{n=!1;for(var o=0;o<e.length;o++)for(var r=o;r<e.length;r++)if(e[o][t]&&("object"==typeof e[o][t]?e[o][t]["@id"]:e[o][t])===e[r]["@id"]){var i=e[o];e[o]=e[r],e[r]=i,n=!0;break}}while(n);return e},e.orderPreservingToplogicalSort=function(e,t){for(var n=c(),o={},r=function(){var r=e[i]["@id"];n.add(r),o[r]=e[i],se.asArray(e[i][t]).map(function(e){return"object"==typeof e?e["@id"]:e}).map(function(e){return[e,r]}).forEach(function(e){return n.add(e)})},i=0;i<e.length;i++)r();for(var a=n.sort(),s=0;s<a.length;s++)e[s]=o[a[s]];return e},e.getCompareLocalizedLabelFunction=function(e){return function(t,n){var o=u.getLocalized(t[u.RDFS_LABEL],e),r=u.getLocalized(n[u.RDFS_LABEL],e);return o<r?-1:o>r?1:0}},e.orderByLocalizedLabels=function(t,n){return t.sort(e.getCompareLocalizedLabelFunction(n))},e.checkId=function(e,t){if(void 0!==e)return e.constructor===Array?!!e.find(function(e){return e["@id"]===t}):e.constructor===Object?e["@id"]===t:void 0},e}(),ce=/*#__PURE__*/function(){function e(){}return e.isForm=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.FORM)},e.isWizardStep=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.WIZARD_STEP)},e.isSection=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.QUESTION_SECTION)},e.isAnswerable=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.ANSWERABLE)},e.isTypeahead=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.QUESTION_TYPEAHEAD)},e.getPossibleValuesQuery=function(e){return u.getJsonAttValue(e,ae.HAS_OPTIONS_QUERY)},e.isDisabled=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.DISABLED)},e.isHidden=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.HIDDEN)},e.isTextarea=function(t,n){return n&&n.length>ae.INPUT_LENGTH_THRESHOLD&&!e.isTypeahead(t)||u.hasValue(t,ae.LAYOUT_CLASS,ae.LAYOUT.TEXTAREA)},e.isText=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.TEXT)},e.isCalendar=function(t){return e.isDate(t)||e.isTime(t)||e.isDateTime(t)},e.isDate=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.DATE)},e.isTime=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.TIME)},e.isDateTime=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.DATETIME)},e.isCheckbox=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.CHECKBOX)},e.isMaskedInput=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.MASKED_INPUT)},e.isSparqlInput=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.SPARQL)},e.isTurtleInput=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.TURTLE)},e.isCollapsed=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.COLLAPSED)},e.isEmphasised=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.EMPHASISED)},e.getCategory=function(e){return ae.LAYOUT.CATEGORY.find(function(t){return u.hasValue(e,ae.LAYOUT_CLASS,t)})},e.resolveValue=function(e){return e?e[ae.HAS_OBJECT_VALUE]?e[ae.HAS_OBJECT_VALUE]["@id"]:u.getJsonAttValue(e,ae.HAS_DATA_VALUE):null},e.resolveValueObject=function(e){return e?e[ae.HAS_OBJECT_VALUE]?se.asArray(e[ae.HAS_OBJECT_VALUE])[0]:e[ae.HAS_DATA_VALUE]?se.asArray(e[ae.HAS_DATA_VALUE])[0]:null:null},e.isRelevant=function(t){if(!t[ae.IS_RELEVANT_IF])return!0;for(var n,o=ee(se.asArray(t[ae.IS_RELEVANT_IF]));!(n=o()).done;)if(!e.testCondition(n.value))return!1;return!0},e.hasValidationLogic=function(e){return!!(e[ae.REQUIRES_ANSWER]||e[ae.REQUIRES_ANSWER_IF]||e[ae.PATTERN]||this.containsXSDProperty(e))},e.isValid=function(e){if(!1===e[ae.HAS_VALID_ANSWER])return!1;for(var t,n=ee(se.asArray(e[ae.HAS_SUBQUESTION]));!(t=n()).done;)if(!1===this.isValid(t.value))return!1;return!0},e.testOrCondition=function(e){var t=e[ae.HAS_SUB_CONDITION];t||console.warn("Or condition does not have any sub-condition !");for(var n,o=ee(this._getMappedObjectsArray(t));!(n=o()).done;)if(this.testCondition(n.value))return!0;return!1},e.testCondition=function(t){var n,o=t[ae.ACCEPTS_VALIDATION_VALUE],r=t[ae.ACCEPTS_ANSWER_VALUE],i=t[ae.ACCEPTS],a=t[ae.HAS_TESTED_QUESTION];if(t[ae.HAS_SUB_CONDITION])return this.testOrCondition(t);if(o&&r&&console.warn("Support for validation and requirement constraints at same time is not implemented !"),i&&a){var s=se.asArray(i);if(1!==s.length&&console.warn("Support for multiple accepts values is not implemented !"),s[0]["@id"]===ae.ANSWERED_QUESTION){(r||o)&&console.warn("Support for accepted answer/validations values is not implemented !");for(var u,c=ee(this._getMappedObjectsArray(a));!(u=c()).done;)if(!this.hasAnswer(u.value))return!1;return!0}console.warn("No support to accept question of type "+s[0]["@id"]+" !")}if(o&&a){var p=se.asArray(o);(1!==p.length||!0!==p[0]&&"true"!==p[0])&&console.warn('Validation values other than "true" are not implemented !');for(var m,d=ee(se.asArray(a));!(m=d()).done;){if(void 0===(n=le.getObject(m.value["@id"])))return console.warn("Questions is not loaded in an object map."),!0;if(!1===this.isValid(n))return!1}return!0}if(r&&a){n=le.getObject(a["@id"]);for(var h,f=ee(se.asArray(r));!(h=f()).done;){var E=h.value;if(!n)return console.warn("Question is not defined."),!0;if(!n.hasOwnProperty(ae.HAS_ANSWER))return!1;var v=l.getValues(n,ae.HAS_ANSWER);if(0===v.length)return!1;var S=e.resolveValueObject(v[0]);if(S&&E&&S.hasOwnProperty("@value")&&E.hasOwnProperty("@id")&&S["@value"]==E["@id"])return!0;if(ue.compareValues(S,E))return!0}}return!1},e._getMappedObjectsArray=function(e,t){return se.asArray(e).map(function(e){var n=le.getObject(e["@id"]);return void 0===n?(console.warn((t||"Object")+' "'+e["@id"]+'" is not loaded in an object map.'),null):n}).filter(function(e){return null!==e})},e.hasAnswer=function(t){if(!t)return!1;if(t.hasOwnProperty(ae.HAS_ANSWER)){var n=l.getValues(t,ae.HAS_ANSWER);if(n.length){var o=e.resolveValueObject(n[0]);if(o&&(o["@value"]||o["@id"]))return!0}}for(var r,i=ee(se.asArray(t[ae.HAS_SUBQUESTION]));!(r=i()).done;)if(e.hasAnswer(r.value))return!0;return!1},e.getAnswerValue=function(t){if(!t)return null;if(t.hasOwnProperty(ae.HAS_ANSWER)){var n=l.getValues(t,ae.HAS_ANSWER);if(n.length){var o=e.resolveValueObject(n[0]);if(o&&(o["@value"]||o["@id"]))return o["@value"]||o["@id"]}}for(var r,i=ee(se.asArray(t[ae.HAS_SUBQUESTION]));!(r=i()).done;){var a=e.getAnswerValue(r.value);if(a)return a}return null},e.resolveDateTimeFormat=function(t,n,o){var r="number"==typeof n,i=e.isDate(t),a=e.isTime(t),s=e.isDateTime(t);return r?ae.DATETIME_NUMBER_FORMAT:i?t[ae.DATE_FORMAT]||o.dateFormat:a?t[ae.TIME_FORMAT]||o.timeFormat:s?t[ae.DATETIME_FORMAT]||o.dateTimeFormat:null},e.dfsTraverseQuestionTree=function(e,t,n){function o(e){t(e),se.asArray(e[ae.HAS_SUBQUESTION]).forEach(function(e){o(e)}),n(e)}void 0===n&&(n=function(){}),e.forEach(function(e){o(e)})},e.getFormSpecification=function(t){var n=-1,o="..",r="";return e.dfsTraverseQuestionTree(t,function(e){var t=" ".repeat(n+=1),i="";e[ae.REQUIRES_ANSWER]&&!e[ae.USED_ONLY_FOR_COMPLETENESS]?i=t+o+"required: "+e[ae.REQUIRES_ANSWER]+"\n":e[ae.USED_ONLY_FOR_COMPLETENESS]&&(i=t+o+"required only for completeness: "+e[ae.USED_ONLY_FOR_COMPLETENESS]+"\n"),r+=t+e["http://www.w3.org/2000/01/rdf-schema#label"]+"\n",r+=e[ae.HELP_DESCRIPTION]?t+o+"description: "+e[ae.HELP_DESCRIPTION]+"\n":"",r+=i,r+=e[ae.PATTERN]?t+o+"pattern: "+e[ae.PATTERN]+"\n":"",r+=e[ae.INPUT_MASK]?t+o+"mask: "+e[ae.INPUT_MASK]+"\n":"",r+=e[ae.HAS_VALIDATION_MESSAGE]?t+o+"validation-message: "+e[ae.HAS_VALIDATION_MESSAGE]+"\n":"",r+="\n"},function(){n-=1}),r},e.containsXSDProperty=function(e){for(var t=Object.keys(e),n=0,o=Object.values(ae.XSD);n<o.length;n++)if(t.includes(o[n]))return!0;return!1},e.getInputMask=function(e){if(e[ae.INPUT_MASK])return e[ae.INPUT_MASK]},e}(),pe={},me=[],de=/*#__PURE__*/e.createContext({}),he=function(r){var i=n(r.data||pe),a=i[0],s=i[1],l=n(r.formQuestions||me),u=l[0],c=l[1];o(function(){if(r.isFormValid){var e=ce.isValid(a);r.isFormValid(e)}},[]),o(function(){s(r.data||pe)},[u]);var p=function(e){e&&s(Object.assign({},a,e))},m=function(e,t){if(!(!t||e<0||e>=u.length)){if("object"==typeof t){var n=[].concat(u);n[e]=Object.assign({},n[e],t),c(n)}if(Array.isArray(t)&&c(t),r.isFormValid){var o=ce.isValid(a);r.isFormValid(o)}}},d=function(){return a},h=function(e){return null==e?u:u[e]},f=t(function(){return{updateData:p,updateFormQuestionsData:m,getData:d,getFormQuestionsData:h}},[h,d]);/*#__PURE__*/return e.createElement(de.Provider,Y({value:f},r),r.children)};he.propTypes={children:s.element.isRequired,data:s.object.isRequired,formQuestions:s.array.isRequired,isFormValid:s.func};var fe=/*#__PURE__*/function(t){function n(e){var n;return(n=t.call(this,e)||this).state={cursorPosition:0},n}K(n,t);var o=n.prototype;return o.focus=function(){p.findDOMNode(this.input).focus()},o.getInputDOMNode=function(){return p.findDOMNode(this.input)},o.componentDidUpdate=function(e,t,n){(this.fieldDidShrink(e)||this.fieldDidExpand(e))&&this.updateFieldCursorPosition()},o.fieldDidExpand=function(e){return"textarea"===this.props.type&&"textarea"!==e.type},o.fieldDidShrink=function(e){return"text"===this.props.type&&"text"!==e.type},o.updateFieldCursorPosition=function(){this.focus(),this.getInputDOMNode().setSelectionRange(this.state.cursorPosition,this.state.cursorPosition)},o.saveCursorPosition=function(e){this.props.onChange(e),this.setState({cursorPosition:e.target.selectionStart})},o.render=function(){switch(this.props.type){case"radio":return this._renderRadio();case"checkbox":return this._renderCheckbox();case"select":return this._renderSelect();case"textarea":return this._renderTextArea();default:return this._renderInput()}},o._renderCheckbox=function(){var t=this;/*#__PURE__*/return e.createElement(m.Group,{size:"small",controlId:Math.floor(Math.random()*Number.MAX_SAFE_INTEGER)},/*#__PURE__*/e.createElement(m.Check,Y({type:"checkbox",ref:function(e){return t.input=e}},this.props,{label:this.props.label,className:this.props.validation.classname})),this.props.validation.message)},o._renderRadio=function(){var t=this;/*#__PURE__*/return e.createElement(d,{size:"small"},/*#__PURE__*/e.createElement(m.Check,Y({type:"radio",ref:function(e){return t.input=e}},this.props,{label:this.props.label,className:this.props.validation.classname})),this.props.validation.message)},o._renderSelect=function(){var t=this;/*#__PURE__*/return e.createElement(d,{size:"small"},this._renderLabel(),/*#__PURE__*/e.createElement(h,Y({as:"select",className:this.props.validation.classname,ref:function(e){return t.input=e}},this.props),this.props.children),this.props.validation.message)},o._renderLabel=function(){return this.props.label?/*#__PURE__*/e.createElement(m.Label,null,this.props.label):null},o._renderTextArea=function(){var t=this;/*#__PURE__*/return e.createElement(d,{size:"small"},this._renderLabel(),/*#__PURE__*/e.createElement(h,Y({ref:function(e){return t.input=e},as:"textarea"},this.props,{className:this.props.validation.classname,onChange:function(e){return t.saveCursorPosition(e)}})),this.props.validation.message)},o._renderInput=function(){var t=this;/*#__PURE__*/return e.createElement(d,{size:"small"},this._renderLabel(),/*#__PURE__*/e.createElement(h,Y({className:this.props.validation.classname,ref:function(e){return t.input=e},as:"input",placeholder:this.props.placeholder},this.props,{onChange:function(e){return t.saveCursorPosition(e)}})),this.props.validation.message)},n}(e.Component);fe.propTypes={type:s.string,label:s.object,value:s.any,onChange:s.func,help:s.string,validation:s.object,placeholder:s.string},fe.defaultProps={type:"text"};var Ee=["children"],ve=/*#__PURE__*/e.createContext({}),Se={components:{inputComponent:fe},componentsOptions:{dateTimeAnswer:{dateFormat:"yyyy-MM-dd",timeFormat:"HH:mm",dateTimeFormat:"yyyy-MM-dd HH:mm:ss"},readOnly:!1},options:{intl:{locale:"en"},i18n:{"wizard.next":"Next","wizard.previous":"Previous","section.collapse":"Collapse","section.expand":"Expand"},modalView:!1,modalProps:{},horizontalWizardNav:!0,wizardStepButtons:!0,enableWizardStepSkip:!0,startingStep:0}},Ae=function(n){var o=n.children,r=Z(n,Ee),i=t(function(){return{inputComponent:r.components&&r.components.inputComponent||Se.components.inputComponent,componentsOptions:Object.assign({},Se.componentsOptions,r.componentsOptions),options:Object.assign({},Se.options,r.options),mapComponent:r.mapComponent}},[r]);/*#__PURE__*/return e.createElement(ve.Provider,{value:i},o)};Ae.propTypes={children:s.element.isRequired,components:s.object,mapComponent:s.func,options:s.object};var ge,_e,Te={"@graph":[{"@type":"http://onto.fel.cvut.cz/ontologies/documentation/question","http://onto.fel.cvut.cz/ontologies/form-layout/has-layout-class":"form","http://onto.fel.cvut.cz/ontologies/documentation/has_related_question":[{"http://onto.fel.cvut.cz/ontologies/form-layout/has-layout-class":["wizard-step","section"],"http://www.w3.org/2000/01/rdf-schema#label":[{"@language":"en","@value":"Description"},{"@language":"cs","@value":"Popis"}],"http://onto.fel.cvut.cz/ontologies/documentation/has_related_question":[{"@type":"http://onto.fel.cvut.cz/ontologies/documentation/question","http://onto.fel.cvut.cz/ontologies/form-layout/has-layout-class":["textarea"],"http://www.w3.org/2000/01/rdf-schema#label":[{"@language":"en","@value":"Description"},{"@language":"cs","@value":"Popis"}],"http://onto.fel.cvut.cz/ontologies/documentation/has_answer":{"@type":"http://onto.fel.cvut.cz/ontologies/documentation/answer","http://onto.fel.cvut.cz/ontologies/documentation/has_data_value":""}}]}]}]},Ie=/*#__PURE__*/function(){function e(){}return e.generateForm=function(){return JSON.parse(JSON.stringify(Te))},e}(),Ne={root:(ge={},ge[ae.HAS_LAYOUT_CLASS]=ae.FORM,ge),expandProperties:[ae.HAS_SUBQUESTION,ae.IS_RELEVANT_IF,ae.HAS_ANSWER,ae.HAS_DECLARED_PREFIX,ae.HAS_OPTION,ae.HAS_COMMENT]},Oe=/*#__PURE__*/function(){function e(){}return e.customFrame=function(e,t,n){if(arguments.length<2)return l.nextTick(function(){n(new TypeError("Could not frame, too few arguments."))});null===t&&(t=Ne),l.flatten(e,null,null,function(e,t){})},e.expandStructure=function(e){var t,n={};e["@graph"].forEach(function(e){n[e["@id"]]=e,ce.isForm(e)&&(t=e)});try{this._expandGraph(t,Ne,n)}catch(e){console.error("Error '"+e+"' occured, while trying to apply frame-ing with custom shape.")}return n},e._expandGraph=function(e,t,n){var o,r,i,a=this;t.expandProperties.forEach(function(s){if(e.hasOwnProperty(s)){e[s]=se.asArray(e[s]),o=e[s];for(var l=0;l<o.length;l++)i=a._getId(o[l]),void 0!==(r=n[i])?(o[l]=r,a._expandGraph(r,t,n)):console.warn("object with @id "+i+" was not defined in input data.")}})},e._getId=function(e){return"string"==typeof e?e:e["@id"]},e}();_e=Oe,Oe.compressStructure=function(e){var t=[],n=new Set;return(t=_e._compressGraph(e,t,n)).sort(function(e,t){return e["@id"]&&t["@id"]?e["@id"].localeCompare(t["@id"]):0})},Oe._compressGraph=function(e,t,n){return n.has(e["@id"])||(t.push(e),n.add(e["@id"])),Ne.expandProperties.forEach(function(o){if(e.hasOwnProperty(o))for(var r=e[o],i=0;i<r.length;i++){var a=r[i];void 0!==a&&(r[i]=a,t=_e._compressGraph(a,t,n),e[o][i]={"@id":a["@id"]})}}),t};var Ce=/*#__PURE__*/function(){function e(){}return e.constructDefaultForm=function(t){var n=Ie.generateForm();return e._constructFormQuestions(n,t)},e.constructForm=function(t,n){try{var o,r;return Promise.resolve(l.flatten(t,{}).then(function(t){try{var i=e._constructFormQuestions(t,n);r=i[1],o={formQuestions:i[0]}}catch(e){console.error("Error while constructing form questions from the provided structure:",e)}if(!r){var a=e.constructDefaultForm(n);r=a[1],o={formQuestions:a[0]}}return[o,r]}).catch(function(e){return console.error("Failed to flatten the JSON-LD structure. Expected to transform a nested JSON-LD document into a flattened array of node objects:",e),[o,r]}))}catch(e){return Promise.reject(e)}},e._constructFormQuestions=function(e,t){var n,o,r,i=[];if(void 0!==e["@graph"][0]["@id"]?(r=Oe.expandStructure(e),Object.keys(r).map(function(e){le.putObject(e,r[e])})):console.warn("default form is constructed."),!(o=(n=e["@graph"].find(function(e){return ce.isForm(e)}))[ae.HAS_SUBQUESTION]))throw ne.error("Could not find any questions in the received data."),"No questions in the form";return(i=o.filter(function(e){return!(!ce.isWizardStep(e)||ce.isHidden(e))||(ne.warn("Item is not a wizard step: "+e),!1)})).length||(ne.log("Could not find any wizard steps in the received data. Building form without steps"),n[ae.HAS_SUBQUESTION].forEach(function(e){return i.push(e)})),i.sort(ue.getCompareLocalizedLabelFunction(t)),ue.orderPreservingToplogicalSort(i,ae.HAS_PRECEDING_QUESTION),[i,{root:n}]},e}(),Le=/*#__PURE__*/function(){function e(){}return e.buildQuestionAnswerModel=function(t,n){var o,r={subQuestions:[]};if(t&&(r.uri=t.root["@id"],r.origin=u.getJsonAttValue(t.root,ae.HAS_QUESTION_ORIGIN,"@id")),n)for(var i=0;i<n.length;i++)(o=e.processQuestionAnswerHierarchy(n[i]))&&r.subQuestions.push(o);return r},e.processQuestionAnswerHierarchy=function(t){return t?e._processQuestion(t):null},e._processQuestion=function(t){var n={};if(n.uri=t["@id"],n.origin=u.getJsonAttValue(t,ae.HAS_QUESTION_ORIGIN,"@id"),t[ae.HAS_SUBQUESTION]){n.subQuestions=[];for(var o=0;o<t[ae.HAS_SUBQUESTION].length;o++)n.subQuestions.push(e._processQuestion(t[ae.HAS_SUBQUESTION][o]))}if(t[ae.HAS_ANSWER]){n.answers=[],Array.isArray(t[ae.HAS_ANSWER])||(t[ae.HAS_ANSWER]=[t[ae.HAS_ANSWER]]);for(var r=0;r<t[ae.HAS_ANSWER].length;r++)n.answers.push(e.processAnswer(t[ae.HAS_ANSWER][r]))}if(t[ae.HAS_COMMENT]){n.comments=[],Array.isArray(t[ae.HAS_COMMENT])||(t[ae.HAS_COMMENT]=[t[ae.HAS_COMMENT]]);for(var i=0;i<t[ae.HAS_COMMENT].length;i++)n.comments.push(e.processComment(t[ae.HAS_COMMENT][i]))}return n},e.processComment=function(e){var t={};return t.author=u.getJsonAttValue(e,ae.HAS_AUTHOR,"@id"),t.value=u.getJsonAttValue(e,ae.HAS_COMMENT_VALUE),t.timestamp=u.getJsonAttValue(e,ae.HAS_TIMESTAMP,"@id"),t},e.processAnswer=function(e){var t={};return t.uri=e["@id"],t.origin=u.getJsonAttValue(e,ae.HAS_ANSWER_ORIGIN,"@id"),e[ae.HAS_OBJECT_VALUE]?t.codeValue=u.getJsonAttValue(e,ae.HAS_OBJECT_VALUE,"@id"):t.textValue=u.getJsonAttValue(e,ae.HAS_DATA_VALUE),t},e.generateAnswer=function(e){var t={};return t[ae.HAS_DATA_VALUE]="",t},e}(),Re=function(t){var n=r(ve);/*#__PURE__*/return e.createElement(n.inputComponent,{type:"checkbox",label:t.label,title:t.title,checked:!0===t.value||"true"===t.value,validation:t.validation,onChange:function(e){t.onChange(e.target.checked)},disabled:n.componentsOptions.readOnly||ce.isDisabled(t.question)})};Re.propTypes={question:s.object.isRequired,label:s.object.isRequired,title:s.string,value:s.oneOfType([s.string,s.bool]),onChange:s.func.isRequired,mouseHover:s.bool,validation:s.object};var ye=function(t){var i=r(ve).componentsOptions,a=n(null),s=a[0],l=a[1];o(function(){t.value&&l(new Date(M(t.value,h,new Date)))},[]);var u=ce.resolveDateTimeFormat(t.question,t.value,i.dateTimeAnswer),c=ce.isDate(t.question),p=ce.isTime(t.question),h="x"===u?i.dateTimeAnswer.dateTimeFormat:u;/*#__PURE__*/return e.createElement(d,{size:"small"},/*#__PURE__*/e.createElement(m.Label,{className:"w-100"},t.label),/*#__PURE__*/e.createElement(V,{selected:s,placeholderText:h,onChange:function(e){l(e),e||t.onChange(""),t.onChange(u===ae.DATETIME_NUMBER_FORMAT?Number(e):H(e,u))},showTimeSelect:!c,showTimeSelectOnly:p,timeFormat:"HH:mm",timeIntervals:1,timeCaption:"Time",dateFormat:h,className:U("form-control",t.validation.classname),disabled:i.readOnly||ce.isDisabled(t.question)}),t.validation.message)};ye.propTypes={question:s.object.isRequired,label:s.object.isRequired,title:s.string,value:s.oneOfType([s.string,s.number]),onChange:s.func.isRequired,validation:s.object};var be=[ae.XSD.INT,ae.XSD.INTEGER,ae.XSD.NON_NEGATIVE_INTEGER,ae.XSD.NON_POSITIVE_INTEGER,ae.XSD.NEGATIVE_INTEGER,ae.XSD.POSITIVE_INTEGER,ae.XSD.FLOAT,ae.XSD.POSITIVE_FLOAT,ae.XSD.NEGATIVE_FLOAT],we={};we[ae.XSD.NON_NEGATIVE_INTEGER]={min:0},we[ae.XSD.NON_POSITIVE_INTEGER]={max:0},we[ae.XSD.NEGATIVE_INTEGER]={max:-1},we[ae.XSD.POSITIVE_INTEGER]={min:1};var De={"string-2":"prefixed",atom:"var"},Ve=/*#__PURE__*/function(){function e(){}return e._resolveInputType=function(t,n){return ce.isSparqlInput(t)||ce.isTurtleInput(t)||ce.isTextarea(t,n)?"textarea":e._isNumeric(t)?"number":"text"},e._isNumeric=function(e){for(var t=0,n=be.length;t<n;t++)if(u.hasValue(e,ae.HAS_DATATYPE,be[t]))return!0;return!1},e.resolveInputProperties=function(t,n,o){var r={};switch(r.type=e._resolveInputType(t,n),r.type){case"textarea":r.rows=5;break;case"number":r=Object.assign({},r,e._resolveNumberRestrictions(t),this._resolveStepRestriction(t))}return r.disabled=o.readOnly||ce.isDisabled(t),r},e._resolveStepRestriction=function(e){var t={};return void 0!==e[ae.STEP]&&(t.step=u.getJsonAttValue(e,ae.STEP)),t},e._resolveNumberRestrictions=function(e){var t={};return Object.getOwnPropertyNames(we).forEach(function(n){u.hasValue(e,ae.HAS_DATATYPE,n)&&(t=Object.assign({},t,we[n]))}),void 0!==e[ae.XSD.MIN_INCLUSIVE]&&(t.min=e[ae.XSD.MIN_INCLUSIVE]),void 0!==e[ae.XSD.MIN_EXCLUSIVE]&&(t.min=e[ae.XSD.MIN_EXCLUSIVE]+1),void 0!==e[ae.XSD.MAX_EXCLUSIVE]&&(t.max=e[ae.XSD.MAX_EXCLUSIVE]-1),void 0!==e[ae.XSD.MAX_INCLUSIVE]&&(t.max=e[ae.XSD.MAX_INCLUSIVE]),t},e._preventCharacterInput=function(t,n){"number"!==e._resolveInputType(n)||t.key>="0"&&t.key<="9"||["Backspace","Delete","ArrowLeft","ArrowRight","-","Minus","NumpadSubtract",".","Period"].includes(t.key)||t.preventDefault()},e}(),Me=function(t){var n=r(ve),o=n.inputComponent,i=n.componentsOptions,a=t.question,s=t.answer,l=t.value;return s[ae.HAS_OBJECT_VALUE]&&s[ae.HAS_OBJECT_VALUE][u.RDFS_LABEL]&&(l=u.getJsonAttValue(s[ae.HAS_OBJECT_VALUE],u.RDFS_LABEL)),/*#__PURE__*/e.createElement(o,Object.assign({},Ve.resolveInputProperties(a,l,i),{validation:t.validation,label:t.label,title:t.title,value:null==l?"":l,placeholder:ce.getInputMask(a),onKeyPress:function(e){return Ve._preventCharacterInput(e,a)},onChange:function(e){t.onChange(e.target.value),(t.sparql||t.turtle)&&(void 0).hide()},onFocus:function(e){if(t.sparql){var n=x.fromTextArea(e.target);n.setValue(l),n.on("change",function(){t.onChange(n.getValue())}),x.Autocompleters.prefixes.appendPrefixIfNeeded=function(e,n){if(e.autocompleters.getTrie(n)&&e.options.autocompleters&&-1!==e.options.autocompleters.indexOf(n)){var o=e.getCursor(),r=e.getTokenAt(o);if("prefixed"===De[r.type]){var i=r.string.indexOf(":");if(-1!==i){var a=e.getPreviousNonWsToken(o.line,r).string.toUpperCase(),s=e.getTokenAt({line:o.line,ch:r.start});if("PREFIX"!==a&&("ws"===s.type||null==s.type)){var l=r.string.substring(0,i+1);if(null==e.getPrefixesFromQuery()[l.slice(0,-1)])if(t.question[ae.HAS_DECLARED_PREFIX]&&t.question[ae.HAS_DECLARED_PREFIX].filter(function(e){return e[ae.PREFIX]===l.slice(0,-1)}).length){var u=t.question[ae.HAS_DECLARED_PREFIX].filter(function(e){return e[ae.PREFIX]===l.slice(0,-1)}),c={};c[u[0][ae.PREFIX]]=u[0][ae.NAMESPACE],e.addPrefixes(c)}else{var p=e.autocompleters.getTrie(n).autoComplete(l);p.length>0&&e.addPrefixes(p[0])}}}}}}}else if(t.turtle){console.log("TTL");var o=x.fromTextArea(e.target);o.setValue(l),o.on("change",function(){t.onChange(o.getValue())})}}}))};Me.propTypes={question:s.object.isRequired,answer:s.object.isRequired,label:s.object.isRequired,title:s.string,value:s.oneOfType([s.string,s.number]),onChange:s.func.isRequired,validation:s.object};var He={D:"1",M:"1",Y:"1",h:"1",m:"1",s:"1"},Ue=/*#__PURE__*/function(){function e(){}return e.mapMask=function(e){if(!e)return e;for(var t,n="",o=0,r=e.length;o<r;o++)t=e.charAt(o),n+=He[t]?He[t]:t;return n},e}(),xe=["size","placeholder"];function je(e){var t,n,o,r;if(void 0!==e.selectionStart)t=e.selectionStart,n=e.selectionEnd;else try{e.focus(),r=(o=e.createTextRange()).duplicate(),o.moveToBookmark(document.selection.createRange().getBookmark()),r.setEndPoint("EndToStart",o),n=(t=r.text.length)+o.text.length}catch(e){}return{start:t,end:n}}var Pe=/*#__PURE__*/function(t){function n(e){var n;return(n=t.call(this,e)||this)._updatePattern=function(e){n.mask.setPattern(Ue.mapMask(e.mask),{value:n.mask.getRawValue(),selection:je(n.input)})},n._updateMaskSelection=function(){n.mask.selection=je(n.input)},n._updateInputSelection=function(){!function(e,t){var n;try{void 0!==e.selectionStart?(e.focus(),e.setSelectionRange(t.start,t.end)):(e.focus(),(n=e.createTextRange()).collapse(!0),n.moveStart("character",t.start),n.moveEnd("character",t.end-t.start),n.select())}catch(e){}}(n.input,n.mask.selection)},n._onChange=function(e){var t=n.mask.getValue();if(e.target.value!==t){if(e.target.value.length<t.length){var o=t.length-e.target.value.length;n._updateMaskSelection(),n.mask.selection.end=n.mask.selection.start+o,n.mask.backspace()}var r=n._getDisplayValue();e.target.value=r,r&&n._updateInputSelection()}n.props.onChange&&n.props.onChange(e)},n._onKeyDown=function(e){if(function(e){return e.ctrlKey&&90===e.keyCode}(e))e.preventDefault(),n.mask.undo()&&(e.target.value=n._getDisplayValue(),n._updateInputSelection(),n.props.onChange&&n.props.onChange(e));else if(function(e){return e.ctrlKey&&89===e.keyCode}(e))e.preventDefault(),n.mask.redo()&&(e.target.value=n._getDisplayValue(),n._updateInputSelection(),n.props.onChange&&n.props.onChange(e));else if("Backspace"===e.key&&(e.preventDefault(),n._updateMaskSelection(),n.mask.backspace())){var t=n._getDisplayValue();e.target.value=t,t&&n._updateInputSelection(),n.props.onChange&&n.props.onChange(e)}},n._onKeyPress=function(e){e.metaKey||e.altKey||e.ctrlKey||"Enter"===e.key||(e.preventDefault(),n._updateMaskSelection(),n.mask.input(e.key)&&(e.target.value=n.mask.getValue(),n._updateInputSelection(),n.props.onChange&&n.props.onChange(e)))},n._onPaste=function(e){e.preventDefault(),n._updateMaskSelection(),n.mask.paste(e.clipboardData.getData("Text"))&&(e.target.value=n.mask.getValue(),setTimeout(n._updateInputSelection,0),n.props.onChange&&n.props.onChange(e))},n.mask=new j({pattern:Ue.mapMask(e.mask),value:e.value,formatCharacters:e.formatCharacters,placeholderChar:e.placeholderChar||"_"}),n}K(n,t);var o=n.prototype;return o.componentDidUpdate=function(e){e.mask!==this.props.mask&&this._updatePattern(this.props),e.mask!==this.props.mask&&e.value!==this.props.mask?this.mask.getValue()===this.mask.emptyValue?this.mask.setPattern(Ue.mapMask(this.props.mask),{value:this.props.value}):this.mask.setPattern(Ue.mapMask(this.props.mask),{value:this.mask.getRawValue()}):e.mask!==this.props.mask?this.mask.setPattern(Ue.mapMask(this.props.mask),{value:this.mask.getRawValue()}):e.value!==this.props.value&&this.mask.setValue(this.props.value),e.mask!==this.props.mask&&this.mask.selection.start&&this._updateInputSelection()},o._getDisplayValue=function(){var e=this.mask.getValue();return e===this.mask.emptyValue?"":e},o.focus=function(){this.input.focus()},o.blur=function(){this.input.blur()},o.render=function(){var t=this,n=this.props,o=n.size,r=n.placeholder,i=Z(n,xe),a=this.mask.pattern.length;/*#__PURE__*/return e.createElement(this.context.inputComponent,Object.assign({},i,{ref:function(e){e&&(t.input=e.input?p.findDOMNode(e.input):e)},maxLength:a,onChange:this._onChange,onKeyDown:this._onKeyDown,onKeyPress:this._onKeyPress,onPaste:this._onPaste,placeholder:r||this.mask.emptyValue,size:o||a,value:this._getDisplayValue(),type:"text"}))},n}(e.Component);Pe.contextType=ve,Pe.propTypes={mask:s.string.isRequired},Pe.defaultProps={value:""};var qe=function(t){var n=r(ve).componentsOptions,o=t.question,i=t.value,a=u.getJsonAttValue(o,ae.INPUT_MASK);return a?/*#__PURE__*/e.createElement(Pe,{mask:a,value:i,label:t.label,title:t.title,placeholder:a,onChange:function(e){return t.onChange(e.target.value)},disabled:n.readOnly||ce.isDisabled(o),validation:t.validation}):(ne.warn("Input mask not provided. Falling back to regular input."),/*#__PURE__*/e.createElement(Me,t))};qe.propTypes={question:s.object.isRequired,answer:s.object.isRequired,label:s.object.isRequired,title:s.string,value:s.oneOfType([s.string,s.number]),onChange:s.func.isRequired,validation:s.object};var Fe=/*#__PURE__*/function(t){function n(){return t.apply(this,arguments)||this}K(n,t);var o=n.prototype;return o._generateSelectOptions=function(t){var n=[];t.sort(function(e,t){var n=u.getJsonAttValue(e,ae.RDFS_LABEL),o=u.getJsonAttValue(t,ae.RDFS_LABEL);return n<o?-1:n>o?1:0});for(var o=0;o<t.length;o++)n.push(/*#__PURE__*/e.createElement("option",{value:u.getJsonAttValue(t[o],ae.RDFS_LABEL),key:"opt-"+o},u.getJsonAttValue(t[o],ae.RDFS_LABEL)));return n},o.render=function(){var t=this,n=this.props.question;/*#__PURE__*/return e.createElement(this.context.inputComponent,{type:"select",label:this.props.label,value:this.props.value,title:this.props.title,validation:this.props.validation,onChange:function(e){t.props.onChange(e.target.value)},disabled:this.context.componentsOptions.readOnly||ce.isDisabled(n)},this._generateSelectOptions(n[ae.HAS_OPTION]))},n}(e.Component);Fe.contextType=ve,Fe.propTypes={question:s.object.isRequired,label:s.object.isRequired,title:s.string,value:s.string,onChange:s.func.isRequired,validation:s.object};var Qe=function(e,t){return e&&e.length?(e.sort(ue.getCompareLocalizedLabelFunction(t)),ue.orderPreservingToplogicalSort(e,ae.HAS_PRECEDING_VALUE),e):[]},ze=function(t){var i=se.getStringHash(ce.getPossibleValuesQuery(t.question)),a=r(re),s=r(ve),l=s.options.intl,c=n(!0),p=c[0],h=c[1],f=n([Qe(t.options,l)]),E=f[0],v=f[1];o(function(){var e=!1,n=t.question;return!n[ae.HAS_OPTION]&&ce.getPossibleValuesQuery(n)?function(){try{var t=function(t,o){try{var r=Promise.resolve(a.loadFormOptions(i,ce.getPossibleValuesQuery(n))).then(function(t){e||(h(!1),g(t))})}catch(e){return o()}return r&&r.then?r.then(void 0,o):r}(0,function(){ne.error("An error has occurred during loadFormOptions for query hash: "+i)});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}():(h(!1),g(n[ae.HAS_OPTION])),function(){e=!0}},[]);var S,A,g=function(e){if(!e)return[];for(var t,n={},o=[],r=ee(e=Qe(e,l));!(t=r()).done;){var i=t.value,a=u.getLocalized(i[ae.RDFS_LABEL],l);n[i["@id"]]={id:i["@id"],value:i["@id"],label:a,children:[]};for(var s,c=ee(se.asArray(i[ae.BROADER]));!(s=c()).done;)o.push({type:"parent-child",parent:s.value["@id"],child:i["@id"]})}for(var p=0,m=o;p<m.length;p++){var d,h=m[p];"parent-child"===h.type&&(null==(d=n[h.parent])||d.children.push(h.child))}var f=Object.values(n);v(f)},_=se.findKeyInObjects(E,["name","value"]),T=se.findKeyInObjects(E,["name","label"]);/*#__PURE__*/return e.createElement(d,{size:"small"},/*#__PURE__*/e.createElement(m.Label,null,t.label),/*#__PURE__*/e.createElement(P,{styles:("is-warning"===t.validation.classname?(S="#dc9135",A="0 0 0 0.2rem rgba(203, 127, 16, 0.25)"):"is-invalid"===t.validation.classname&&(S="#dc3545",A="0 0 0 .2rem rgba(220,53,69,.25)"),{control:function(e){return Object.assign({},e,{border:S?"1px solid "+S:e.border,boxShadow:e.boxShadow,"&:hover":{border:"1px solid "+S,boxShadow:A||e.boxShadow}})}}),valueKey:_,labelKey:T,valueRenderer:!1===t.question[ae.PROVIDES_DEREFERENCEABLE_ANSWER_VALUES]?function(t){/*#__PURE__*/return e.createElement(e.Fragment,null,t)}:null,valueIsControlled:!0,value:E.filter(function(e){return e.id===t.value}),multi:!1,options:E,isSearchable:!0,isLoading:p,isClearable:!0,renderAsTree:!0,optionLeftOffset:5,isDisabled:p||s.componentsOptions.readOnly||ce.isDisabled(t.question),onChange:function(e){t.onChange(e?e.id:null)}}),t.validation.message)};ze.propTypes={question:s.object.isRequired,answer:s.object.isRequired,label:s.oneOfType([s.string,s.object]).isRequired,title:s.string,value:s.string,onChange:s.func.isRequired,validation:s.object};var ke=function(t){/*#__PURE__*/return e.createElement("svg",{className:"caret-square-up",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"28",viewBox:"0 0 24 28"},/*#__PURE__*/e.createElement("title",null,t.title||""),/*#__PURE__*/e.createElement("path",{d:"M17.891 17.453c-0.172 0.344-0.516 0.547-0.891 0.547h-10c-0.375 0-0.719-0.203-0.891-0.547-0.172-0.328-0.141-0.734 0.078-1.031l5-7c0.187-0.266 0.484-0.422 0.812-0.422s0.625 0.156 0.812 0.422l5 7c0.219 0.297 0.25 0.703 0.078 1.031zM20 21.5v-15c0-0.266-0.234-0.5-0.5-0.5h-15c-0.266 0-0.5 0.234-0.5 0.5v15c0 0.266 0.234 0.5 0.5 0.5h15c0.266 0 0.5-0.234 0.5-0.5zM24 6.5v15c0 2.484-2.016 4.5-4.5 4.5h-15c-2.484 0-4.5-2.016-4.5-4.5v-15c0-2.484 2.016-4.5 4.5-4.5h15c2.484 0 4.5 2.016 4.5 4.5z"}))},Be=function(t){/*#__PURE__*/return e.createElement("svg",{className:"caret-square-down",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"28",viewBox:"0 0 24 28"},/*#__PURE__*/e.createElement("title",null,t.title||""),/*#__PURE__*/e.createElement("path",{d:"M17.891 10.547c0.172 0.328 0.141 0.734-0.078 1.031l-5 7c-0.187 0.266-0.484 0.422-0.812 0.422s-0.625-0.156-0.812-0.422l-5-7c-0.219-0.297-0.25-0.703-0.078-1.031 0.172-0.344 0.516-0.547 0.891-0.547h10c0.375 0 0.719 0.203 0.891 0.547zM20 21.5v-15c0-0.266-0.234-0.5-0.5-0.5h-15c-0.266 0-0.5 0.234-0.5 0.5v15c0 0.266 0.234 0.5 0.5 0.5h15c0.266 0 0.5-0.234 0.5-0.5zM24 6.5v15c0 2.484-2.016 4.5-4.5 4.5h-15c-2.484 0-4.5-2.016-4.5-4.5v-15c0-2.484 2.016-4.5 4.5-4.5h15c2.484 0 4.5 2.016 4.5 4.5z"}))},We=function(){/*#__PURE__*/return e.createElement("svg",{className:"info-circle",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"28",viewBox:"0 0 24 28"},/*#__PURE__*/e.createElement("title",null,"info-circle"),/*#__PURE__*/e.createElement("path",{d:"M16 21.5v-2.5c0-0.281-0.219-0.5-0.5-0.5h-1.5v-8c0-0.281-0.219-0.5-0.5-0.5h-5c-0.281 0-0.5 0.219-0.5 0.5v2.5c0 0.281 0.219 0.5 0.5 0.5h1.5v5h-1.5c-0.281 0-0.5 0.219-0.5 0.5v2.5c0 0.281 0.219 0.5 0.5 0.5h7c0.281 0 0.5-0.219 0.5-0.5zM14 7.5v-2.5c0-0.281-0.219-0.5-0.5-0.5h-3c-0.281 0-0.5 0.219-0.5 0.5v2.5c0 0.281 0.219 0.5 0.5 0.5h3c0.281 0 0.5-0.219 0.5-0.5zM24 14c0 6.625-5.375 12-12 12s-12-5.375-12-12 5.375-12 12-12 12 5.375 12 12z"}))},Ge=function(){/*#__PURE__*/return e.createElement("svg",{className:"question-circle",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"28",viewBox:"0 0 24 28"},/*#__PURE__*/e.createElement("path",{d:"M14 21.5v-3c0-0.281-0.219-0.5-0.5-0.5h-3c-0.281 0-0.5 0.219-0.5 0.5v3c0 0.281 0.219 0.5 0.5 0.5h3c0.281 0 0.5-0.219 0.5-0.5zM18 11c0-2.859-3-5-5.688-5-2.547 0-4.453 1.094-5.797 3.328-0.141 0.219-0.078 0.5 0.125 0.656l2.063 1.563c0.078 0.063 0.187 0.094 0.297 0.094 0.141 0 0.297-0.063 0.391-0.187 0.734-0.938 1.047-1.219 1.344-1.437 0.266-0.187 0.781-0.375 1.344-0.375 1 0 1.922 0.641 1.922 1.328 0 0.812-0.422 1.219-1.375 1.656-1.109 0.5-2.625 1.797-2.625 3.313v0.562c0 0.281 0.219 0.5 0.5 0.5h3c0.281 0 0.5-0.219 0.5-0.5v0c0-0.359 0.453-1.125 1.188-1.547 1.188-0.672 2.812-1.578 2.812-3.953zM24 14c0 6.625-5.375 12-12 12s-12-5.375-12-12 5.375-12 12-12 12 5.375 12 12z"}))},Xe=function(t){var o=n("right"),r=o[0],i=o[1];/*#__PURE__*/return e.createElement("span",{ref:function(e){return function(e){e&&(e.getBoundingClientRect().x>window.innerWidth/2?i("left"):i("right"))}(e)}},/*#__PURE__*/e.createElement(f,{overlay:t.show?/*#__PURE__*/e.createElement(E,{className:"tooltip-content",id:t.id},t.tooltipContent):/*#__PURE__*/e.createElement("span",null),placement:t.overlayPlacement||r},/*#__PURE__*/e.createElement("span",null,t.children)))};Xe.propTypes={tooltipContent:s.oneOfType([s.object.isRequired,s.string.isRequired]),id:s.string.isRequired,overlayPlacement:s.string,absolutePosition:s.bool,show:s.bool},Xe.defaultProps={iconClassContainer:"",iconClass:"",absolutePosition:!0,show:!0};var Ye=function(t){var o=n("right"),r=o[1];/*#__PURE__*/return e.createElement("div",{ref:function(e){return function(e){e&&(e.getBoundingClientRect().x>window.innerWidth/2?r("left"):r("right"))}(e)}},/*#__PURE__*/e.createElement(Xe,{id:"help-icon-tooltip-",overlayPlacement:t.overlayPlacement||o[0],absolutePosition:t.absolutePosition,tooltipContent:t.text},/*#__PURE__*/e.createElement(Ge,{className:t.iconClass})))};Ye.propTypes={text:s.string.isRequired,iconClassContainer:s.string,iconClass:s.string,overlayPlacement:s.string,absolutePosition:s.bool},Ye.defaultProps={iconClassContainer:"",iconClass:"",absolutePosition:!0};var Ke=function(){/*#__PURE__*/return e.createElement("svg",{className:"external-link-icon",width:"24",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},/*#__PURE__*/e.createElement("path",{d:"M5,2 C5.55228,2 6,2.44772 6,3 C6,3.55228 5.55228,4 5,4 L4,4 L4,12 L12,12 L12,11 C12,10.4477 12.4477,10 13,10 C13.5523,10 14,10.4477 14,11 L14,12 C14,13.1046 13.1046,14 12,14 L4,14 C2.89543,14 2,13.1046 2,12 L2,4 C2,2.89543 2.89543,2 4,2 L5,2 Z M15,1 L15,5.99814453 C15,6.55043453 14.5523,6.99814453 14,6.99814453 C13.4477,6.99814453 13,6.55043453 13,5.99814453 L13,4.41419 L8.71571,8.69846 C8.32519,9.08899 7.69202,9.08899 7.3015,8.69846 C6.91097,8.30794 6.91097,7.67477 7.3015,7.28425 L11.5858,3 L9.99619141,3 C9.44391141,3 8.99619141,2.55228 8.99619141,2 C8.99619141,1.44772 9.44391141,1 9.99619141,1 L15,1 Z"}))},Je=function(t){/*#__PURE__*/return e.createElement(Xe,{tooltipContent:t.url["@id"]||t.url,id:"url-tooltip",overlayPlacement:t.overlayPlacement},/*#__PURE__*/e.createElement("a",{href:t.url["@id"]||t.url,target:"_blank",className:t.iconClassContainer},/*#__PURE__*/e.createElement(Ke,{className:t.iconClass})))};Je.propTypes={url:s.oneOfType([s.string.isRequired,s.object.isRequired]),iconClassContainer:s.string,iconClass:s.string,overlayPlacement:s.string,absolutePosition:s.bool},Je.defaultProps={iconClassContainer:"",iconClass:"",absolutePosition:!0};var Ze=function(){/*#__PURE__*/return e.createElement("svg",{className:"question-comment",version:"1.1",id:"Capa_1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 60 60",width:"24",height:"28"},/*#__PURE__*/e.createElement("path",{d:"M30,1.5c-16.542,0-30,12.112-30,27c0,5.204,1.646,10.245,4.768,14.604c-0.591,6.537-2.175,11.39-4.475,13.689 c-0.304,0.304-0.38,0.769-0.188,1.153C0.275,58.289,0.625,58.5,1,58.5c0.046,0,0.092-0.003,0.139-0.01 c0.405-0.057,9.813-1.411,16.618-5.339C21.621,54.71,25.737,55.5,30,55.5c16.542,0,30-12.112,30-27S46.542,1.5,30,1.5z M16,32.5 c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S18.206,32.5,16,32.5z M30,32.5c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4 S32.206,32.5,30,32.5z M44,32.5c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S46.206,32.5,44,32.5z"}))},$e=function(){/*#__PURE__*/return e.createElement("svg",{className:"recycle-bin-icon",version:"1.1",xmlns:"http://www.w3.org/2000/svg",height:"15px",width:"15px",viewBox:"0 0 512 512"},/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("path",{d:"M331.636,69.818V0H180.364v69.818h-128v128h34.909V512h337.455V197.818h34.909v-128H331.636z M215.273,34.909h81.455\nv34.909h-81.455V34.909z M389.818,477.091H122.182V197.818h267.636V477.091z M424.727,162.909H87.273v-58.182h337.455V162.909z"}))),/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("rect",{x:"168.727",y:"256",width:"34.909",height:"162.909"}))),/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("rect",{x:"308.364",y:"256",width:"34.909",height:"162.909"}))),/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("rect",{x:"238.545",y:"256",width:"34.909",height:"162.909"}))))},et="Unknown author",tt=function(t){var o=r(ve).options,i=n(!1),a=i[0],s=i[1],l=n(!1),u=l[0],c=l[1];Q.addLocale(k),Q.addLocale(z),Q.setDefaultLocale(ae.LANG.en.locale);var p,m=new Q(o.intl.locale),d=function(){if(o&&o.users){var e=o.users.find(function(e){return e.id===o.currentUser});if(t.author)return e.label?e.label:h()}return et},h=function(){return t.author["@id"].replace(/.*[#\/]/,"... ")},f=function(){s(!a)};/*#__PURE__*/return e.createElement("div",{className:"comment-content",onMouseEnter:function(){c(!0)},onMouseLeave:function(){c(!1)}},/*#__PURE__*/e.createElement("div",{className:"row"},/*#__PURE__*/e.createElement("div",{className:"col-auto comment-author",onMouseEnter:f,onMouseLeave:f},/*#__PURE__*/e.createElement(e.Fragment,null,a?/*#__PURE__*/e.createElement(e.Fragment,null,d(),/*#__PURE__*/e.createElement(Je,{iconClassContainer:"emphasise-on-relevant-icon",url:t.author?Object.values(t.author).toString():et})):d())),/*#__PURE__*/e.createElement("div",{className:"col-auto text-muted comment-timestamp"},/*#__PURE__*/e.createElement(Xe,{id:"exact-time-overlay",tooltipContent:(p=new Date(parseInt(t.timestamp)),new Intl.DateTimeFormat(o.intl.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}).format(p))},m.format(parseInt(t.timestamp)))),u?/*#__PURE__*/e.createElement(B.div,{className:"comment-delete emphasise-on-relevant-icon",whileHover:{scale:1.2},whileTap:{scale:.9},onClick:function(){t.onDeleteQuestionComment(t.index),t.onDeleteViewComment()}},/*#__PURE__*/e.createElement($e,null)):null),/*#__PURE__*/e.createElement("div",{className:"row"},/*#__PURE__*/e.createElement("div",{className:"col comment-value"},t.commentValue)))};tt.propTypes={author:s.object,timestamp:s.string.isRequired,commentValue:s.string.isRequired,onDeleteQuestionComment:s.func.isRequired,onDeleteViewComment:s.func,index:s.number.isRequired};var nt=function(e){var t=e.comments,r=e.onDeleteCommentClick,a=i(null),s=n(!1),l=s[0],u=s[1],c=function(){u(!0),setTimeout(function(){u(!1)},2e3)};return o(function(){null!==a.current&&(a.current.scrollTop=a.current.scrollHeight)},[JSON.stringify(t)]),q("span",{children:l?F("div",{className:"comment-delete",children:[q(W,{color:"#00BFFF",height:80,width:80}),q("p",{children:"Deleting comment..."})]}):q("div",{className:"comment-list-items",ref:a,children:t.map(function(e,t){return q("div",{className:"comment-list-item",children:q(tt,{commentValue:e[ae.HAS_COMMENT_VALUE],author:e[ae.HAS_AUTHOR]?e[ae.HAS_AUTHOR]:null,timestamp:e[ae.HAS_TIMESTAMP],onDeleteQuestionComment:r,onDeleteViewComment:c,index:t})},t)})})})},ot=function(){/*#__PURE__*/return e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"15",height:"15",viewBox:"0 0 24 24"},/*#__PURE__*/e.createElement("path",{d:"M6.185 4.843l11.927 7.157-11.927 7.157 2.982-7.157-2.982-7.157zm-4.185-4.843l5 12-5 12 20-12-20-12z"}))},rt="300px",it=function(t){var r=n(""),a=r[0],s=r[1],l=i(null),u=G();o(function(){l.current.focus()},[]);var c=function(e){e.preventDefault(),t.onChange(a),s("")},p=function(){var e=l.current;e.style.height="auto",d(e)},d=function(e){e.style.height=e.scrollHeight+"px",parseInt(e.style.height)>parseInt(rt)&&(e.style.height=rt)};/*#__PURE__*/return e.createElement(m,{onSubmit:c,onKeyUp:function(e){"Enter"===e.key&&e.ctrlKey&&a.trim()&&c(e)},onClick:function(e){e.stopPropagation()}},/*#__PURE__*/e.createElement(m.Group,{className:"m-2",controlId:"formBasicComment"},/*#__PURE__*/e.createElement(v,{className:"col-lg-12 p-0"},/*#__PURE__*/e.createElement(S,{className:"container-fluid p-0 m-0"},/*#__PURE__*/e.createElement("div",{id:"comment-form"},/*#__PURE__*/e.createElement(m.Control,{className:"comment-form-control",name:"comment",as:"textarea",placeholder:u.formatMessage({id:"comment.form.placeholder"}),required:!0,value:a,onChange:function(e){s(e.target.value)},ref:l,onKeyPress:p,onKeyDown:p}),/*#__PURE__*/e.createElement(A,{className:"comment-form-button",variant:"primary",type:"submit"},/*#__PURE__*/e.createElement(ot,null)))))))};it.propTypes={onChange:s.func.isRequired};var at,st=function(){/*#__PURE__*/return e.createElement("svg",{className:"close-icon",width:"24px",height:"24px",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},/*#__PURE__*/e.createElement("path",{d:"M13.41 12l4.3-4.29a1 1 0 1 0-1.42-1.42L12 10.59l-4.29-4.3a1 1 0 0 0-1.42 1.42l4.3 4.29-4.3 4.29a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l4.29-4.3 4.29 4.3a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42z"}))},lt=function(t){var a=r(ve),s=i(null),l=i(null),u=i(null),c=n(!1),p=c[0],m=c[1],d=n("right"),h=d[0],f=d[1];o(function(){C(u.current)});var v=function(){m(!1)},S=function(){var e=t.question;return e[ae.HAS_COMMENT]||(e[ae.HAS_COMMENT]=[]),Array.isArray(e[ae.HAS_COMMENT])||(e[ae.HAS_COMMENT]=[e[ae.HAS_COMMENT]]),e[ae.HAS_COMMENT]},A=function(e){var n={};T(n,e),t.onChange(O(),n)},T=function(e,t){a.options.currentUser&&(e[ae.HAS_AUTHOR]={"@id":a.options.currentUser}),e[ae.HAS_COMMENT_VALUE]=t,e[ae.HAS_TIMESTAMP]=Date.now().toString()},I=function(e){S().splice(e,1)},N=function(e){e.preventDefault(),e.stopPropagation()},O=function(){return S().length},C=function(e){e&&(e.getBoundingClientRect().x>window.innerWidth/2?f("left"):f("right"))};/*#__PURE__*/return e.createElement("div",{ref:u,onClick:N},/*#__PURE__*/e.createElement("span",{className:"comment-bubble",ref:s,onClick:function(e){N(e),m(!p)}},/*#__PURE__*/e.createElement(Ze,null),O()>0?/*#__PURE__*/e.createElement(g,{className:"comment-badge",pill:!0,variant:"primary"},O()):null),/*#__PURE__*/e.createElement(B.div,{className:"overlay-comment",ref:l,drag:!0,dragConstraints:{top:-50,left:-50,right:50,bottom:50}},/*#__PURE__*/e.createElement(_,{target:s.current,show:p,placement:h,rootClose:!1,onHide:v,container:l},function(t){/*#__PURE__*/return e.createElement(E,Y({className:"comment-tooltip"},t),/*#__PURE__*/e.createElement("span",{onKeyDown:function(e){!function(e){"Escape"===e.key&&v()}(e)}},/*#__PURE__*/e.createElement(B.div,{className:"close-comment-icon",onClick:v,whileHover:{scale:1.1,transition:{duration:.1}}},/*#__PURE__*/e.createElement(st,null)),/*#__PURE__*/e.createElement(nt,{comments:S(),onDeleteCommentClick:I}),/*#__PURE__*/e.createElement(it,{onChange:A})))})))};lt.propTypes={question:s.object.isRequired,onChange:s.func.isRequired};var ut=/*#__PURE__*/function(){function t(){}return t.renderIcons=function(t,n,o,r){var i;i=n.icons?n.icons:ae.DEFAULT_OPTIONS.icons;for(var a=[],s=this.renderQuestionHelp(t,n,o,r),l=this.renderQuestionComments(t,n,o,r),u=this.renderQuestionLink(t,n,o,r),c=0;c<i.length;c++)i[c].id===ae.ICONS.QUESTION_COMMENTS&&a.push(/*#__PURE__*/e.createElement("li",{key:c,className:"icon-list-item"},l)),i[c].id===ae.ICONS.QUESTION_HELP&&a.push(/*#__PURE__*/e.createElement("li",{key:c,className:"icon-list-item"},s)),i[c].id===ae.ICONS.QUESTION_LINK&&a.push(/*#__PURE__*/e.createElement("li",{key:c,className:"icon-list-item"},u));/*#__PURE__*/return e.createElement("ol",{className:"icon-list-items"},a)},t.renderQuestionHelp=function(e,t,n,o){return this.getIconComponentFromName(ae.ICONS.QUESTION_HELP,e,t,n,o)},t.renderQuestionLink=function(e,t,n,o){return this.getIconComponentFromName(ae.ICONS.QUESTION_LINK,e,t,n,o)},t.getIconComponentFromName=function(e,t,n,o,r){var i=this.getIconFromIconList(n.icons?n.icons:ae.DEFAULT_OPTIONS.icons,e);return this.getIconComponent(i,t,n,o,r)},t.getIconComponent=function(t,n,o,r,i){var a;if(t&&(t.behavior===ae.ICON_BEHAVIOR.ON_HOVER||t.behavior===ae.ICON_BEHAVIOR.ENABLE))return t.behavior===ae.ICON_BEHAVIOR.ENABLE?(i=!0,a=""):a="emphasise-on-relevant-icon",t.id===ae.ICONS.QUESTION_HELP&&n[ae.HELP_DESCRIPTION]?i?/*#__PURE__*/e.createElement("div",{className:a},/*#__PURE__*/e.createElement(Ye,{text:u.getLocalized(n[ae.HELP_DESCRIPTION],o.intl),absolutePosition:!1})):null:t.id===ae.ICONS.QUESTION_LINK&&n[ae.SOURCE]?i?/*#__PURE__*/e.createElement("div",{className:a},/*#__PURE__*/e.createElement(Je,{url:n[ae.SOURCE]})):null:t.id===ae.ICONS.QUESTION_COMMENTS&&i?/*#__PURE__*/e.createElement("div",{className:a},/*#__PURE__*/e.createElement(lt,{question:n,onChange:r})):null},t}();at=ut,ut.renderQuestionComments=function(e,t,n,o){return at.getIconComponentFromName(ae.ICONS.QUESTION_COMMENTS,e,t,n,o)},ut.getIconFromIconList=function(e,t){return e?e.find(function(e){return e.id===t}):null};var ct=function(t){var r=e.useContext(re),i=e.useContext(ve).options,a=n({severity:"",classname:"",message:null}),s=a[0],l=a[1];o(function(){h()},[t.question]);var c,p,m=function(e){var n=Object.assign({},t.answer);d(n,e),t.onChange(t.index,n)},d=function(e,n){null===n?(e[ae.HAS_OBJECT_VALUE]=null,e[ae.HAS_DATA_VALUE]=null):t.answer[ae.HAS_OBJECT_VALUE]||ce.isTypeahead(t.question)?e[ae.HAS_OBJECT_VALUE]={"@id":n}:e[ae.HAS_DATA_VALUE]={"@value":n}},h=function(){l({severity:"",classname:"",message:null}),!1===f[ae.HAS_VALID_ANSWER]&&l(f[ae.HAS_VALIDATION_SEVERITY]===ae.VALIDATION.SEVERITY.WARNING?{severity:ae.VALIDATION.SEVERITY.WARNING,classname:ae.VALIDATION.CLASSNAME.WARNING,message:/*#__PURE__*/e.createElement(T,{className:ae.VALIDATION.CLASSNAME.WARNING},f[ae.HAS_VALIDATION_MESSAGE])}:{severity:ae.VALIDATION.SEVERITY.ERROR,classname:ae.VALIDATION.CLASSNAME.ERROR,message:/*#__PURE__*/e.createElement(T,{className:ae.VALIDATION.CLASSNAME.ERROR},f[ae.HAS_VALIDATION_MESSAGE])})},f=t.question,E=ce.resolveValue(t.answer),v=function(n){var o=u.getLocalized(n[ae.RDFS_LABEL],i.intl);/*#__PURE__*/return e.createElement("div",{className:"question-header"},o,ut.renderIcons(t.question,i,t.onCommentChange,t.showIcon))}(f),S=u.getLocalized(f[ae.RDFS_COMMENT],i.intl);return c=ce.isTypeahead(f)?function(n,o,i){var a=se.getStringHash(ce.getPossibleValuesQuery(t.question)),l=r.getOptions(a)||[];/*#__PURE__*/return e.createElement(ze,{question:t.question,answer:t.answer,label:o,title:i,value:n,onChange:m,options:l,validation:s})}(E,v,S):(p=f)[ae.HAS_OPTION]&&0!==p[ae.HAS_OPTION].length?function(n,o,r){/*#__PURE__*/return e.createElement(Fe,{question:t.question,label:o,title:r,value:n,onChange:m,validation:s})}(E,v,S):ce.isCalendar(f)?function(n,o,r){/*#__PURE__*/return e.createElement(ye,{question:t.question,value:n,title:r,label:o,onChange:m,validation:s})}(E,v,S):ce.isCheckbox(f)?function(n,o,r){/*#__PURE__*/return e.createElement(Re,{label:o,title:r,value:n,onChange:m,question:t.question,validation:s})}(E,v,S):ce.isMaskedInput(f)?function(n,o,r){/*#__PURE__*/return e.createElement(qe,{label:o,title:r,value:n,onChange:m,question:t.question,answer:t.answer,validation:s})}(E,v,S):ce.isSparqlInput(f)?function(n,o,r){/*#__PURE__*/return e.createElement(Me,{question:t.question,answer:t.answer,label:o,title:r,value:n,onChange:m,sparql:!0,validation:s})}(E,v,S):ce.isTurtleInput(f)?function(n,o,r){/*#__PURE__*/return e.createElement(Me,{question:t.question,answer:t.answer,label:o,title:r,value:n,onChange:m,turtle:!0,validation:s})}(E,v,S):function(n,o,r){/*#__PURE__*/return e.createElement(Me,{question:t.question,answer:t.answer,label:o,title:r,value:n,onChange:m,validation:s})}(E,v,S),c};ct.propTypes={answer:s.object.isRequired,question:s.object.isRequired,onChange:s.func.isRequired,onCommentChange:s.func.isRequired,index:s.number,icons:s.object};var pt=/*#__PURE__*/function(){function e(){}return e.createValidator=function(e,t){var n=this,o=[this._intMaxInclusiveValidator,this._intMinInclusiveValidator,this._patternValidator,this._checkboxValidator,this._requiredValidator,this._completenessValidator];return function(){if(ce.hasValidationLogic(e)){var r=ce.getAnswerValue(e);return n._validateAnswer(e,t,r,o)}}},e._validateAnswer=function(e,t,n,o){for(var r,i={},a=ee(o);!(r=a()).done;){var s=(0,r.value)(e,t,n);if(!s.isValid)return i[ae.HAS_VALID_ANSWER]=!1,i[ae.HAS_VALIDATION_MESSAGE]=s.message,i[ae.HAS_VALIDATION_SEVERITY]=s.validationSeverity,i;if(!1===i[ae.HAS_VALID_ANSWER])break}return i[ae.HAS_VALID_ANSWER]=!0,i[ae.HAS_VALIDATION_MESSAGE]="",i[ae.HAS_VALIDATION_SEVERITY]="",i},e._patternValidator=function(e,t){var n=ce.getAnswerValue(e);return n&&n.length>0&&e[ae.PATTERN]&&!new RegExp(e[ae.PATTERN]).test(n)&&ce.hasAnswer(e)?{isValid:!1,validationSeverity:ae.VALIDATION.SEVERITY.ERROR,message:e[ae.HAS_VALIDATION_MESSAGE]?e[ae.HAS_VALIDATION_MESSAGE]:ae.VALIDATION.DEFAULT_MESSAGE.INVALID}:{isValid:!0}},e._requiredValidator=function(e,t){return!e[ae.REQUIRES_ANSWER]||e[ae.USED_ONLY_FOR_COMPLETENESS]||ce.hasAnswer(e)?{isValid:!0}:{isValid:!1,validationSeverity:ae.VALIDATION.SEVERITY.ERROR,message:e[ae.HAS_VALIDATION_MESSAGE]?e[ae.HAS_VALIDATION_MESSAGE]:ae.VALIDATION.DEFAULT_MESSAGE.REQUIRED}},e._checkboxValidator=function(e,t){return ce.isCheckbox(e)&&e[ae.REQUIRES_ANSWER]&&!ce.hasAnswer(e)?{isValid:!1,validationSeverity:ae.VALIDATION.SEVERITY.ERROR,message:e[ae.HAS_VALIDATION_MESSAGE]?e[ae.HAS_VALIDATION_MESSAGE]:ae.VALIDATION.DEFAULT_MESSAGE.CHECK}:{isValid:!0}},e._completenessValidator=function(e,t){return e[ae.REQUIRES_ANSWER]&&e[ae.USED_ONLY_FOR_COMPLETENESS]&&!ce.hasAnswer(e)?{isValid:!1,validationSeverity:ae.VALIDATION.SEVERITY.WARNING,message:e[ae.HAS_VALIDATION_MESSAGE]?e[ae.HAS_VALIDATION_MESSAGE]:ae.VALIDATION.DEFAULT_MESSAGE.REQUIRED_ONLY_FOR_COMPLETENESS}:{isValid:!0}},e._intMinInclusiveValidator=function(e,t){if(e[ae.XSD.MIN_INCLUSIVE]){var n=ce.getAnswerValue(e);if(n&&n.length>0){var o=e[ae.XSD.MIN_INCLUSIVE];if(!(Number.isInteger(parseInt(n))&&n>=o))return{isValid:!1,validationSeverity:ae.VALIDATION.SEVERITY.ERROR,message:e[ae.HAS_VALIDATION_MESSAGE]?e[ae.HAS_VALIDATION_MESSAGE]:ae.VALIDATION.DEFAULT_MESSAGE.GREATER_OR_EQUAL+o+"."}}}return{isValid:!0}},e._intMaxInclusiveValidator=function(e,t){var n=ce.getAnswerValue(e);if(e[ae.XSD.MAX_INCLUSIVE]&&n&&n.length>0){var o=e[ae.XSD.MAX_INCLUSIVE];if(!(Number.isInteger(parseInt(n))&&n<=o))return{isValid:!1,validationSeverity:ae.VALIDATION.SEVERITY.ERROR,message:e[ae.HAS_VALIDATION_MESSAGE]?e[ae.HAS_VALIDATION_MESSAGE]:ae.VALIDATION.DEFAULT_MESSAGE.LOWER_OR_EQUAL+o+"."}}return{isValid:!0}},e}(),mt=/*#__PURE__*/function(t){function n(e){var n;return(n=t.call(this,e)||this).state={prefixes:e.prefixes},n}return K(n,t),n.prototype.render=function(){var t=/*#__PURE__*/e.createElement(I,{id:"prefixes",title:"Prefixes"},/*#__PURE__*/e.createElement(N,null,this.state.prefixes.sort(function(e,t){return e[ae.PREFIX]<t[ae.PREFIX]?-1:1}).map(function(t){/*#__PURE__*/return e.createElement(O,{key:t[ae.PREFIX]},/*#__PURE__*/e.createElement("strong",null,t[ae.PREFIX]),": ",t[ae.NAMESPACE])})));/*#__PURE__*/return e.createElement(f,{trigger:"click",placement:"right",overlay:t},/*#__PURE__*/e.createElement("span",{className:this.props.iconClass},this.props.children))},n}(e.Component);mt.propTypes={prefixes:s.array.isRequired,children:s.element.isRequired,iconClass:s.string},mt.defaultProps={iconClass:""};var dt=function(e){var t;return(t=e.question[ae.HAS_MEDIA_CONTENT])?Array.isArray(t)?q("div",{className:"col-6",children:t.map(function(e,n){return q("div",{className:"row embed-responsive-21by9 media-content-video-container mb-3",children:q("iframe",{src:t[n],className:"embed-responsive-item",allowFullScreen:!0})},n)})}):q("div",{className:"col-6",children:q("iframe",{src:t,className:"embed-responsive-item",allowFullScreen:!0})}):null},ht=/*#__PURE__*/function(t){function n(e){var o;return(o=t.call(this,e)||this).handleAnswerChange=function(e,t){if(ce.isSection(o.props.question)){var n=!!ce.resolveValue(t);o.setState({expanded:n})}o._handleChange(ae.HAS_ANSWER,e,t)},o.handleSubQuestionChange=function(e,t){o._handleChange(ae.HAS_SUBQUESTION,e,t)},o.handleCommentChange=function(e,t){o._handleChange(ae.HAS_COMMENT,e,t)},o._toggleCollapse=function(){o.props.collapsible&&o.setState({expanded:!o.state.expanded})},o._onMouseEnterHandler=function(){o.setState({showIcon:!0})},o._onMouseLeaveHandler=function(){o.setState({showIcon:!1})},o._getHeaderClassName=function(){var e=o.props.question,t=o.props.collapsible,r=[];return r.push(n.getEmphasizedOnRelevantClass(e),"question-header"),ce.isWizardStep(e)&&r.push("wizard-step bg-primary text-white"),ce.isEmphasised(e)&&r.push(n.getEmphasizedClass(e)),ce.isSection(e)&&r.push("section-background"),t&&r.push("cursor-pointer"),o.isDebugged(e)&&r.push("show-irrelevant"),r},le.putObject(e.question["@id"],e.question),o.state={validator:{},expanded:!ce.isCollapsed(e.question),showIcon:!1},o}K(n,t);var o=n.prototype;return o.componentDidMount=function(){this.setState({validator:pt.createValidator(this.props.question,this.context.options.intl)})},o.componentDidUpdate=function(){var e=this.props.question,t=this.context.options.startingQuestionId,n=e[ae.HAS_SUBQUESTION].find(function(e){return e["@id"]===t});if(ce.isSection(e)&&ce.isAnswerable(e)){var o=this._getFirstAnswerValue();if(this.context.options.debugMode)return null;if(n)return null;this.state.expanded&&!o&&this.setState({expanded:!1})}},o._handleChange=function(e,t,n){var o=Object.assign({},this.props.question);if(o[e][t]=n,e===ae.HAS_ANSWER){var r=this.state.validator(n);o=Object.assign({},o,r)}le.putObject(o["@id"],o),this.props.onChange(this.props.index,o)},o.isDebugged=function(e){var t=this.context.options.startingQuestionId;return!ce.isRelevant(e)&&(!!this.context.options.debugMode||null!=t&&!!se.findQuestionById(t,e,!0,!1,!1))},o.render=function(){var t=this.props.question,n=this.renderQuestion(t);return this.isDebugged(t)?/*#__PURE__*/e.createElement("div",{className:"show-irrelevant"},n):ce.isHidden(t)?null:ce.isRelevant(t)?n:null},o.renderQuestion=function(t){if(ce.isAnswerable(t)&&!ce.isSection(t))/*#__PURE__*/return e.createElement("div",{id:t["@id"]},/*#__PURE__*/e.createElement("div",{className:"panel-title answerable-question"},this.renderAnswers()),/*#__PURE__*/e.createElement("div",{className:"answerable-subquestions"},this.renderSubQuestions()));if(ce.isAnswerable(t))return this.renderAnswerableSection();if(ce.isSection(t)){var o=this.props,r=o.collapsible,i=o.withoutCard,a=n._getQuestionCategoryClass(t);if(i)/*#__PURE__*/return e.createElement("div",null,this._renderQuestionContent());var s=u.getLocalized(t[u.RDFS_LABEL],this.context.options.intl),l=/*#__PURE__*/e.createElement(C.Body,{className:U("p-3",a)},this._renderQuestionContent());/*#__PURE__*/return e.createElement(e.Fragment,null,/*#__PURE__*/e.createElement(L,{defaultActiveKey:this.state.expanded?void 0:s},/*#__PURE__*/e.createElement(C,{className:"mb-3"},/*#__PURE__*/e.createElement(L.Toggle,{as:C.Header,onClick:this._toggleCollapse,className:this._getHeaderClassName(),onMouseEnter:this._onMouseEnterHandler,onMouseLeave:this._onMouseLeaveHandler},/*#__PURE__*/e.createElement("h6",{className:"d-inline",id:t["@id"]},r&&!ce.isWizardStep(t)&&this._renderCollapseToggle(),s),this.renderQuestionIcons(),this.props.children),/*#__PURE__*/e.createElement(r?L.Collapse:e.Fragment,null,l))))}/*#__PURE__*/return e.createElement("div",null,this._renderQuestionContent())},o._renderQuestionContent=function(){var t=[];return this.state.expanded&&t.push(/*#__PURE__*/e.createElement(dt,{key:this.props.question["@id"]+"-media",question:this.props.question})),t.push(this.renderAnswers()),t.push(this.renderSubQuestions()),t},o.renderQuestionIcons=function(){return ut.renderIcons(this.props.question,this.context.options,this.handleCommentChange,this.state.showIcon)},o.renderAnswerableSection=function(){var t=this.props.question,o=this.props.collapsible,r=n._getQuestionCategoryClass(t),i=this.getShowIrrelevantClassname(t),a=/*#__PURE__*/e.createElement(C.Body,{className:U("p-3",r)},this.renderSubQuestions(i));/*#__PURE__*/return e.createElement(L,{activeKey:this.state.expanded?t["@id"]:void 0,className:"answerable-section"},/*#__PURE__*/e.createElement(C,{className:"mb-3"},/*#__PURE__*/e.createElement(C.Header,{onClick:this._toggleCollapse,className:this._getHeaderClassName()},this.renderAnswers()),o?/*#__PURE__*/e.createElement(L.Collapse,{className:i,eventKey:t["@id"]},a):{cardBody:a}))},o.getShowIrrelevantClassname=function(e){return!this.context.options.debugMode&&!ue.checkId(e[ae.HAS_SUBQUESTION],this.context.options.startingQuestionId)||ce.hasAnswer(e)?"":"show-irrelevant"},o.renderAnswers=function(){for(var t,o=this.props.question,r=[],i=this._getAnswers(),a=0,s=i.length;a<s;a++)ce.isTextarea(o,ce.resolveValue(i[a]))||ce.isSparqlInput(o)||ce.isTurtleInput(o),t=U("answer",n._getQuestionCategoryClass(o),n.getEmphasizedOnRelevantClass(o)),r.push(/*#__PURE__*/e.createElement("div",{key:"row-item-"+a,className:t,id:o["@id"],onMouseEnter:this._onMouseEnterHandler,onMouseLeave:this._onMouseLeaveHandler},/*#__PURE__*/e.createElement("div",{className:"answer-content",style:this._getAnswerWidthStyle()},/*#__PURE__*/e.createElement(ct,{index:a,answer:i[a],question:o,onChange:this.handleAnswerChange,onCommentChange:this.handleCommentChange,showIcon:this.state.showIcon})),this._renderUnits(),this._renderPrefixes()));return r},o._getAnswers=function(){var e=this.props.question;return e[ae.HAS_ANSWER]||(e[ae.HAS_ANSWER]=[]),Array.isArray(e[ae.HAS_ANSWER])||(e[ae.HAS_ANSWER]=[e[ae.HAS_ANSWER]]),0===e[ae.HAS_ANSWER].length&&(e[ae.HAS_ANSWER]=ce.isSection(e)&&!ce.isAnswerable(e)?[]:[Le.generateAnswer(e)]),e[ae.HAS_ANSWER]},o._getAnswerWidthStyle=function(){var e=Number(this.props.question[ae.HAS_INITIAL_INPUT_LENGTH]);return e?{flexGrow:0,maxWidth:"none",width:"calc("+e+"ch + 1.5rem + 2px)"}:{}},n._getAnswerClass=function(e,t){return t?"col-12":1===ae.GENERATED_ROW_SIZE?"col-6":"col-"+ae.COLUMN_COUNT/ae.GENERATED_ROW_SIZE},n._getQuestionCategoryClass=function(e){var t=ce.getCategory(e);return t?"question-"+t:""},n.getEmphasizedClass=function(e){return ce.isEmphasised(e)?"bg-warning":""},n.getEmphasizedOnRelevantClass=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.EMPHASISE_ON_RELEVANT)?"emphasise-on-relevant":""},o._renderCollapseToggle=function(){var t=this.context.options,n=this.state.expanded?t.i18n["section.collapse"]:t.i18n["section.expand"];/*#__PURE__*/return e.createElement("span",{onClick:this._toggleCollapse,title:n},/*#__PURE__*/e.createElement(this.state.expanded?ke:Be,{title:n}))},o._renderPrefixes=function(){var t=this.props.question;return t[ae.HAS_DECLARED_PREFIX]&&t[ae.HAS_DECLARED_PREFIX].length?/*#__PURE__*/e.createElement(mt,{prefixes:t[ae.HAS_DECLARED_PREFIX],iconClass:"help-icon-checkbox"},/*#__PURE__*/e.createElement(We,null)):null},o._renderUnits=function(){var t=this.props.question;return t[ae.HAS_UNIT]?/*#__PURE__*/e.createElement("div",{className:"has-unit-label"},t[ae.HAS_UNIT]):null},o.renderSubQuestions=function(t){for(var o=[],r=this._getSubQuestions(),i=this.context.options.debugMode,a=this.context.options.startingQuestionId,s=0;s<r.length;s++){var l=r[s],u=this.context.mapComponent(l,n),c=null;(i||"show-irrelevant"!==t||se.findQuestionById(a,l,!0,!1,!1))&&(c=/*#__PURE__*/e.createElement(u,{key:"sub-question-"+s,question:l,onChange:this.handleSubQuestionChange,index:s})),o.push(c)}return o},o._getSubQuestions=function(){var e=this.props.question;return e[ae.HAS_SUBQUESTION]||(e[ae.HAS_SUBQUESTION]=[]),Array.isArray(e[ae.HAS_SUBQUESTION])||(e[ae.HAS_SUBQUESTION]=[e[ae.HAS_SUBQUESTION]]),ue.orderByLocalizedLabels(e[ae.HAS_SUBQUESTION],this.context.options.intl),ue.orderPreservingToplogicalSort(e[ae.HAS_SUBQUESTION],ae.HAS_PRECEDING_QUESTION),e[ae.HAS_SUBQUESTION]},o._getFirstAnswerValue=function(){return ce.resolveValue(this._getAnswers()[0])},n}(e.Component);ht.contextType=ve,ht.propTypes={question:s.object.isRequired,onChange:s.func.isRequired,index:s.number,withoutCard:s.bool,collapsible:s.bool},ht.defaultProps={withoutCard:!1,collapsible:!0};var ft=/*#__PURE__*/function(t){function n(n){var o;return(o=t.call(this,n)||this).onNextStep=function(){o.context.updateFormQuestionsData(o.props.index,o.context.getFormQuestionsData()),o.props.onNextStep()},o.onPreviousStep=function(){o.props.onPreviousStep()},o._renderWizardStepButtons=function(){/*#__PURE__*/return e.createElement(R,{className:"m-3 float-right"},!o.props.isFirstStep&&/*#__PURE__*/e.createElement(A,{className:"mr-2",onClick:o.onPreviousStep,variant:"primary",size:"sm"},o.props.options.i18n["wizard.previous"]),!o.props.isLastStep&&/*#__PURE__*/e.createElement(A,{onClick:o.onNextStep,variant:"primary",size:"sm"},o.props.options.i18n["wizard.next"]))},o.onChange=function(e,t){o.context.updateFormQuestionsData(o.props.index||e,Object.assign({},o.props.question,t))},o}return K(n,t),n.prototype.render=function(){var t=this.context.getFormQuestionsData([this.props.index]);/*#__PURE__*/return e.createElement(e.Fragment,null,/*#__PURE__*/e.createElement(ht,{question:t,onChange:this.onChange,collapsible:ce.isAnswerable(t)}),this.props.options.wizardStepButtons&&this._renderWizardStepButtons())},n}(e.Component);ft.propTypes={options:s.object.isRequired,question:s.object.isRequired,index:s.number.isRequired,onNextStep:s.func,onPreviousStep:s.func,mapComponent:s.func,isFirstStep:s.bool,isLastStep:s.bool},ft.contextType=de;var Et=function(t){var n=t.steps,o=t.onNavigate,i=t.currentStep,a=r(ve).options,s=G();/*#__PURE__*/return e.createElement(C.Header,null,/*#__PURE__*/e.createElement(y,{variant:"tabs",activeKey:i,onSelect:function(e){return o(parseInt(e))}},n.map(function(t,n){/*#__PURE__*/return e.createElement(Xe,{id:"step-disabled",tooltipContent:s.formatMessage({id:"wizard.nav.tooltip"}),show:!a.enableWizardStepSkip},/*#__PURE__*/e.createElement(b,{key:"nav"+n,id:"wizard-nav-"+n},/*#__PURE__*/e.createElement(w,{eventKey:n,active:n===i?"active":"",hidden:!a.debugMode&&!ce.isRelevant(t),disabled:!a.enableWizardStepSkip,className:U([a.debugMode&&!ce.isRelevant(t)?"show-irrelevant":ht.getEmphasizedClass(t),"wizard-nav"])},u.getLocalized(t[u.RDFS_LABEL],a.intl))))})))};Et.propTypes={currentStep:s.number.isRequired,steps:s.array.isRequired,onNavigate:s.func.isRequired};var vt=function(t){var n=t.steps,o=t.onNavigate,i=t.currentStep,a=r(ve).options,s=G();/*#__PURE__*/return e.createElement("div",{className:"wizard-nav col-2 p-0"},/*#__PURE__*/e.createElement(N,null,n.map(function(t,n){/*#__PURE__*/return e.createElement(Xe,{id:"step-disabled",tooltipContent:s.formatMessage({id:"wizard.nav.tooltip"}),show:!a.enableWizardStepSkip},/*#__PURE__*/e.createElement(O,{hidden:!a.debugMode&&!ce.isRelevant(t),key:"nav"+n,onClick:function(){return o(n)},id:"wizard-nav-"+n,action:!0,active:n===i?"active":"",disabled:!a.enableWizardStepSkip,variant:"default",className:U([a.debugMode&&!ce.isRelevant(t)?"show-irrelevant":ht.getEmphasizedClass(t),"wizard-nav"])},u.getLocalized(t[u.RDFS_LABEL],a.intl)))})))};vt.propTypes={currentStep:s.number.isRequired,steps:s.array.isRequired,onNavigate:s.func.isRequired};var St,At=function(e,t){var n=function e(n,o){return n?n["@id"]===t?o:se.asArray(n[ae.HAS_SUBQUESTION]).findIndex(function(t,n){return-1!==e(t,n)}):-1};return e.findIndex(function(e,t){return-1!==n(e,t)})},gt=function(){var t=e.useContext(de),n=e.useContext(ve),r=n.options,i=n.mapComponent,a=0;r.startingQuestionId?-1===(a=At(t.getFormQuestionsData(),r.startingQuestionId))&&(console.warn("Question with id "+r.startingQuestionId+" not found!"),a=0):r.startingStep&&(a=r.startingStep<t.getFormQuestionsData().length?r.startingStep:0);var s=e.useState(a),l=s[0],u=s[1],c=e.useState(!1),p=c[0],m=c[1];o(function(){if(r.startingQuestionId&&!p){var e=document.getElementById(r.startingQuestionId);e&&(e.scrollIntoView(),e.classList.add("text-danger"),m(!0))}});var d,h=null;t.getFormQuestionsData().length>1&&(d=t.getFormQuestionsData(),h=/*#__PURE__*/e.createElement(r.horizontalWizardNav?Et:vt,{currentStep:l,steps:d,onNavigate:function(e){var n=t.getFormQuestionsData();e===l||e>=n.length||e>l&&!n[e].visited&&!r.enableWizardStepSkip||u(e)}}));var f,E,v=r.horizontalWizardNav;/*#__PURE__*/return e.createElement(C,{className:v?"":"flex-row p-3"},h,/*#__PURE__*/e.createElement("div",{className:v?"card-body p-3":h?"col-10 p-0 pl-3":"col-12 p-0"},(E=i(f=t.getFormQuestionsData()[l],ft),/*#__PURE__*/e.createElement(E,{options:r,key:"step"+l,question:f,onNextStep:function(){var e=t.getFormQuestionsData();l!==e.length-1&&(e[l+1].visited=!0,u(function(e){return e+1}))},onPreviousStep:function(){0!==l&&u(function(e){return e-1})},mapComponent:i,index:l,isFirstStep:0===l,isLastStep:l===t.getFormQuestionsData().length-1}))))},_t=/*#__PURE__*/e.forwardRef(function(t,n){var o=e.useContext(ve).options;/*#__PURE__*/return e.createElement(D,Y({size:"xl",animation:!0},o.modalProps),/*#__PURE__*/e.createElement(D.Header,{closeButton:!0},/*#__PURE__*/e.createElement(D.Title,null,o.modalProps.title)),/*#__PURE__*/e.createElement(D.Body,{className:"overflow-hidden p-0"},t.children))});_t.propTypes={children:s.element.isRequired};var Tt=function(){};St=Tt,Tt.updateQuestionValidation=function(e,t,n,o){if(t[ae.HAS_ANSWER]){var r=pt.createValidator(t,o)();r&&(e[n]=Object.assign({},t,r))}for(var i,a=ee(e);!(i=a()).done;)St.updateSubQuestionsValidation(i.value,o)},Tt.updateSubQuestionsValidation=function(e,t){for(var n=se.asArray(e[ae.HAS_SUBQUESTION]),o=0;o<n.length;o++)St.updateQuestionValidation(n,n[o],o,t)};var It=/*#__PURE__*/function(t){function n(){for(var n,o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return(n=t.call.apply(t,[this].concat(r))||this).getFormData=function(){var e=n.context.getData(),t=n.context.getFormQuestionsData();return Le.buildQuestionAnswerModel(e,t)},n.validateForm=function(){for(var e=n.context.getFormQuestionsData(),t=0;t<e.length;t++)Tt.updateQuestionValidation(e,e[t],t,"en");n.context.updateFormQuestionsData(null,e)},n.getFormQuestionsData=function(){return n.context.getFormQuestionsData()},n.getFormSpecification=function(){var e=n.context.getFormQuestionsData();return ce.getFormSpecification(e)},n.handleStepChange=function(e,t,o){n.context.updateFormQuestionsData(t,Object.assign({},e,o))},n.renderWizardlessForm=function(){var t=n.context.getFormQuestionsData();/*#__PURE__*/return e.createElement(C,{className:"p-3"},t.map(function(e,t){return n._mapQuestion(e,t)}))},n}K(n,t);var o=n.prototype;return o._mapQuestion=function(t,n){var o=this,r=this.props.mapComponent(t,ht);/*#__PURE__*/return e.createElement(r,{key:t["@id"],question:t,onChange:function(e,n){return o.handleStepChange(t,e,n)},index:n})},o.render=function(){var t=this.props.modalView,n=this.context.getFormQuestionsData();if(!n.length)/*#__PURE__*/return e.createElement(C,{className:"p-3 font-italic"},"There are no questions available...");var o=n.every(function(e){return!ce.isWizardStep(e)});return t?/*#__PURE__*/e.createElement(_t,null,o?this.renderWizardlessForm():/*#__PURE__*/e.createElement(gt,null)):o?this.renderWizardlessForm():/*#__PURE__*/e.createElement(gt,null)},n}(e.Component);It.contextType=de;var Nt=/*#__PURE__*/a(function(t,r){var i=n(!0),a=i[0],s=i[1],l=n(null),u=l[0],c=l[1],p=n(null),m=p[0],d=p[1];if(o(function(){!function(){try{return Promise.resolve(Ce.constructForm(t.form,t.options.intl)).then(function(e){var t=e[0],n=e[1];t.formQuestions.some(function(e){return ce.isWizardStep(e)})&&(t.formQuestions[0].visited=!0),c(t),d(n),s(!1)})}catch(e){return Promise.reject(e)}}()},[t.form]),a)return t.loader||/*#__PURE__*/e.createElement(C,{className:"p-3 font-italic"},"Loading SForms...");var h=function(e,t){return function(n,o){if(!e)return o;for(var r,i=ee(e);!(r=i()).done;){var a=r.value,s=a.component;if((0,a.mapRule)(n,t))return s}return o}}(t.componentMapRules,m);/*#__PURE__*/return e.createElement(Ae,{components:t.components,componentsOptions:t.componentsOptions,mapComponent:h,options:t.options},/*#__PURE__*/e.createElement(ie,{fetchTypeAheadValues:t.fetchTypeAheadValues},/*#__PURE__*/e.createElement(he,{data:m,formQuestions:u.formQuestions,isFormValid:t.isFormValid},/*#__PURE__*/e.createElement(It,{ref:r,modalView:t.options&&t.options.modalView,mapComponent:h}))))});Nt.propTypes={form:s.object.isRequired,options:s.object.isRequired,componentMapRules:s.array,components:s.object,componentsOptions:s.object,fetchTypeAheadValues:s.func,isFormValid:s.func,loader:s.element};var Ot={"comment.form.placeholder":"Sem napište své komentáře (Ctrl+Enter pro potvrzení)","wizard.nav.tooltip":"Navigace na této kartě je zakázána, aby nedošlo k přehlédnutí důležitých otázek. K navigaci na tuto kartu použijte tlačítka související s formulářem."},Ct={"comment.form.placeholder":"Write your comments here (Ctrl+Enter to confirm, Esc to cancel)","wizard.nav.tooltip":"Navigation to this tab is disabled to prevent overlooking important questions. Use form-related buttons to navigate to this tab instead."},Lt=/*#__PURE__*/e.createContext({}),Rt=function(e){var t=e.locale,n=void 0===t?navigator.language:t,o=Ct;return n===ae.LANG.cs.locale&&(o=Ot),q(Lt.Provider,{value:{locale:n,lang:o},children:q(X,{locale:n,messages:o,children:e.children})})};export{ct as Answer,ve as ConfigurationContext,ae as Constants,de as FormQuestionsContext,ce as FormUtils,Ye as HelpIcon,Rt as IntlContextProvider,Oe as JsonLdFramingUtils,le as JsonLdObjectMap,ue as JsonLdObjectUtils,ht as Question,ut as QuestionStatic,ft as WizardStep,Nt as default};
1
+ import"core-js/modules/es.array.some.js";import"core-js/modules/es.object.to-string.js";import"core-js/modules/es.promise.js";import e,{useMemo as t,useState as n,useEffect as o,useContext as r,useRef as i,forwardRef as a}from"react";import s from"prop-types";import"core-js/modules/es.object.assign.js";import*as l from"jsonld";import"core-js/modules/es.array.concat.js";import"core-js/modules/es.array.is-array.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/es.array.find.js";import"core-js/modules/es.array.for-each.js";import"core-js/modules/es.array.includes.js";import"core-js/modules/es.array.map.js";import"core-js/modules/es.object.keys.js";import"core-js/modules/es.object.values.js";import"core-js/modules/es.string.includes.js";import"core-js/modules/es.string.repeat.js";import"core-js/modules/web.dom-collections.for-each.js";import*as u from"jsonld-utils";import"core-js/modules/es.array.sort.js";import c from"@kbss-cvut/tsort";import"core-js/modules/es.number.constructor.js";import"core-js/modules/es.number.max-safe-integer.js";import p from"react-dom";import{Form as m,FormGroup as d,FormControl as f,OverlayTrigger as h,Tooltip as E,Col as v,Row as S,Button as A,Badge as g,Overlay as _,FormText as T,Popover as N,ListGroup as I,ListGroupItem as O,Card as C,Accordion as b,ButtonToolbar as R,Nav as y,NavItem as w,NavLink as L,Modal as D}from"react-bootstrap";import{jsx as V,jsxs as M}from"react/jsx-runtime";import{IntlProvider as H,useIntl as U}from"react-intl";import"core-js/modules/es.array.iterator.js";import"core-js/modules/es.set.js";import"core-js/modules/es.string.iterator.js";import"core-js/modules/esnext.set.add-all.js";import"core-js/modules/esnext.set.delete-all.js";import"core-js/modules/esnext.set.difference.js";import"core-js/modules/esnext.set.every.js";import"core-js/modules/esnext.set.filter.js";import"core-js/modules/esnext.set.find.js";import"core-js/modules/esnext.set.intersection.js";import"core-js/modules/esnext.set.is-disjoint-from.js";import"core-js/modules/esnext.set.is-subset-of.js";import"core-js/modules/esnext.set.is-superset-of.js";import"core-js/modules/esnext.set.join.js";import"core-js/modules/esnext.set.map.js";import"core-js/modules/esnext.set.reduce.js";import"core-js/modules/esnext.set.some.js";import"core-js/modules/esnext.set.symmetric-difference.js";import"core-js/modules/esnext.set.union.js";import"core-js/modules/web.dom-collections.iterator.js";import"core-js/modules/es.array.every.js";import"core-js/modules/es.array.find-index.js";import"core-js/modules/es.date.to-string.js";import j from"react-datepicker";import{parse as P,format as x}from"date-fns";import q from"classnames";import"core-js/modules/es.array.index-of.js";import"core-js/modules/es.array.slice.js";import"core-js/modules/es.object.get-own-property-names.js";import k from"yasgui-yasqe";import"@triply/yasgui/build/yasgui.min.css";import"core-js/modules/web.timers.js";import z from"inputmask-core";import{IntelligentTreeSelect as Q}from"intelligent-tree-select/lib/components/IntelligentTreeSelect.js";import"intelligent-tree-select/lib/styles.css";import"core-js/modules/es.array.splice.js";import"core-js/modules/es.date.now.js";import"core-js/modules/es.regexp.to-string.js";import"core-js/modules/es.parse-int.js";import"core-js/modules/es.regexp.exec.js";import"core-js/modules/es.string.replace.js";import F from"javascript-time-ago";import B from"javascript-time-ago/locale/en";import W from"javascript-time-ago/locale/cs";import{motion as G}from"framer-motion";import{Rings as X}from"react-loader-spinner";import"core-js/modules/es.string.trim.js";import"core-js/modules/es.number.is-integer.js";import"core-js/modules/es.regexp.constructor.js";function Y(){return Y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Y.apply(this,arguments)}function K(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,J(e,t)}function J(e,t){return J=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},J(e,t)}function Z(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)t.indexOf(n=i[o])>=0||(r[n]=e[n]);return r}function $(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function ee(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return $(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var te,ne=/*#__PURE__*/function(){function e(){}return e.log=function(e){console.log(e)},e.warn=function(e){console.warn?console.warn(e):console.log("WARNING: "+e)},e.error=function(e){console.error?console.error(e):console.log("ERROR: "+e)},e}(),oe=["children"],re=/*#__PURE__*/e.createContext({}),ie=function(n){var o=n.children,r=Z(n,oe),i=[],a=function(e,t){try{var n=i[e];return n&&n.length?Promise.resolve(n):Promise.resolve(r.fetchTypeAheadValues(t)).then(function(t){return t.length?l.frame(t,{},{}).then(function(t){var n,o=t["@graph"];return i.push(Object.assign({},o,((n={})[e]=o,n))),o}):(ne.warn("No data received when loading options using id "+e),[])})}catch(e){return Promise.reject(e)}},s=function(e){return i[e]||[]},u=t(function(){return{loadFormOptions:a,getOptions:s}},[a,s]);/*#__PURE__*/return e.createElement(re.Provider,Y({value:u},r),o)};ie.propTypes={children:s.element.isRequired,fetchTypeAheadValues:s.func};var ae=function(){};te=ae,ae.COLUMN_COUNT=12,ae.INPUT_LENGTH_THRESHOLD=50,ae.DATETIME_NUMBER_FORMAT="x",ae.FORM="http://onto.fel.cvut.cz/ontologies/documentation/form",ae.HAS_SUBQUESTION="http://onto.fel.cvut.cz/ontologies/documentation/has_related_question",ae.HAS_ANSWER="http://onto.fel.cvut.cz/ontologies/documentation/has_answer",ae.HAS_OPTION="http://onto.fel.cvut.cz/ontologies/form/has-possible-value",ae.HAS_OPTIONS_QUERY="http://onto.fel.cvut.cz/ontologies/form/has-possible-values-query",ae.HAS_VALUE_TYPE="http://onto.fel.cvut.cz/ontologies/form/has-value-type",ae.IS_DISABLED="http://onto.fel.cvut.cz/ontologies/aviation/form-376/is-disabled",ae.INPUT_MASK="http://onto.fel.cvut.cz/ontologies/form/has-input-mask",ae.LAYOUT_CLASS="http://onto.fel.cvut.cz/ontologies/form-layout/has-layout-class",ae.LAYOUT={FORM:"form",QUESTION_SECTION:"section",WIZARD_STEP:"wizard-step",DATE:"date",TIME:"time",DATETIME:"datetime",TEXT:"text",TEXTAREA:"textarea",CHECKBOX:"checkbox",QUESTION_TYPEAHEAD:"type-ahead",MASKED_INPUT:"masked-input",ANSWERABLE:"answerable",SPARQL:"sparql",TURTLE:"ttl",DISABLED:"disabled",HIDDEN:"hidden",COLLAPSED:"collapsed",EMPHASISED:"emphasised",EMPHASISE_ON_RELEVANT:"emphasise-on-relevant",CATEGORY:["category-1","category-2","category-3","category-4","category-5"]},ae.HAS_INITIAL_INPUT_LENGTH="http://onto.fel.cvut.cz/ontologies/form-layout/has-initial-input-length",ae.VALUE_TYPE_CODE="code",ae.VALUE_TYPE_TEXT="text",ae.GENERATED_ROW_SIZE=1,ae.HAS_QUESTION_ORIGIN="http://onto.fel.cvut.cz/ontologies/form/has-question-origin",ae.HAS_ANSWER_ORIGIN="http://onto.fel.cvut.cz/ontologies/form/has-answer-origin",ae.HAS_DATA_VALUE="http://onto.fel.cvut.cz/ontologies/documentation/has_data_value",ae.HAS_OBJECT_VALUE="http://onto.fel.cvut.cz/ontologies/documentation/has_object_value",ae.HELP_DESCRIPTION="http://purl.org/dc/elements/1.1/description",ae.SOURCE="http://purl.org/dc/elements/1.1/source",ae.XSD={MAX_EXCLUSIVE:"http://www.w3.org/2001/XMLSchema#maxExclusive",MAX_INCLUSIVE:"http://www.w3.org/2001/XMLSchema#maxInclusive",MIN_EXCLUSIVE:"http://www.w3.org/2001/XMLSchema#minExclusive",MIN_INCLUSIVE:"http://www.w3.org/2001/XMLSchema#minInclusive",INT:"http://www.w3.org/2001/XMLSchema#int",INTEGER:"http://www.w3.org/2001/XMLSchema#integer",NEGATIVE_INTEGER:"http://www.w3.org/2001/XMLSchema#negativeInteger",NON_NEGATIVE_INTEGER:"http://www.w3.org/2001/XMLSchema#nonNegativeInteger",NON_POSITIVE_INTEGER:"http://www.w3.org/2001/XMLSchema#nonPositiveInteger",POSITIVE_INTEGER:"http://www.w3.org/2001/XMLSchema#positiveInteger",FLOAT:"http://www.w3.org/2001/XMLSchema#float",POSITIVE_FLOAT:"http://www.w3.org/2001/XMLSchema#positiveFloat",NEGATIVE_FLOAT:"http://www.w3.org/2001/XMLSchema#negativeFloat",BOOLEAN:"http://www.w3.org/2001/XMLSchema#boolean"},ae.STEP="http://onto.fel.cvut.cz/ontologies/form/step",ae.PATTERN="http://onto.fel.cvut.cz/ontologies/form/pattern",ae.ACCEPTS_ANSWER_VALUE="http://onto.fel.cvut.cz/ontologies/form/accepts-answer-value",ae.ACCEPTS="http://onto.fel.cvut.cz/ontologies/form/accepts",ae.HAS_DATATYPE="http://onto.fel.cvut.cz/ontologies/form/has-datatype",ae.HAS_LAYOUT_CLASS="http://onto.fel.cvut.cz/ontologies/form/has-layout-class",ae.HAS_POSSIBLE_VALUES_QUERY="http://onto.fel.cvut.cz/ontologies/form/has-possible-values-query",ae.HAS_REQUIRED_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-required-value",ae.HAS_TESTED_QUESTION="http://onto.fel.cvut.cz/ontologies/form/has-tested-question",ae.HAS_TESTED_FORM="http://onto.fel.cvut.cz/ontologies/form/has-tested-form",ae.HAS_UNIT="http://onto.fel.cvut.cz/ontologies/form/has-unit",ae.HAS_VALID_ANSWER="http://onto.fel.cvut.cz/ontologies/form/has-valid-answer",ae.IS_RELEVANT_IF="http://onto.fel.cvut.cz/ontologies/form/is-relevant-if",ae.ACCEPTS_VALIDATION_VALUE="http://onto.fel.cvut.cz/ontologies/form/accepts-validation-value",ae.HAS_VALIDATION_MESSAGE="http://onto.fel.cvut.cz/ontologies/form/has-validation-message",ae.NEGATIVE_CONDITION="http://onto.fel.cvut.cz/ontologies/form/negative-condition",ae.REQUIRES_ANSWER="http://onto.fel.cvut.cz/ontologies/form/requires-answer",ae.USED_ONLY_FOR_COMPLETENESS="http://onto.fel.cvut.cz/ontologies/form/used-only-for-completeness",ae.REQUIRES_ANSWER_DESCRIPTION_IF="http://onto.fel.cvut.cz/ontologies/form/requires-answer-description-if",ae.REQUIRES_ANSWER_IF="http://onto.fel.cvut.cz/ontologies/form/requires-answer-if",ae.HAS_PRECEDING_QUESTION="http://onto.fel.cvut.cz/ontologies/form/has-preceding-question",ae.HAS_PRECEDING_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-preceding-value",ae.HAS_MEDIA_CONTENT="http://onto.fel.cvut.cz/ontologies/form/has-media-content",ae.CONDITION="http://onto.fel.cvut.cz/ontologies/form/condition",ae.OR_CONDITION="http://onto.fel.cvut.cz/ontologies/form/or-condition",ae.HAS_SUB_CONDITION="http://onto.fel.cvut.cz/ontologies/form/has-sub-condition",ae.HAS_PATTERN="http://onto.fel.cvut.cz/ontologies/form-lt/has-pattern",ae.HAS_DECLARED_PREFIX="http://onto.fel.cvut.cz/ontologies/form-spin/has-declared-prefix",ae.PREFIX="http://www.w3.org/ns/shacl#prefix",ae.NAMESPACE="http://www.w3.org/ns/shacl#namespace",ae.HAS_COMMENT="http://onto.fel.cvut.cz/ontologies/form/has-comment",ae.HAS_COMMENT_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-comment-value",ae.HAS_AUTHOR="http://onto.fel.cvut.cz/ontologies/form/has-author",ae.HAS_TIMESTAMP="http://onto.fel.cvut.cz/ontologies/form/has-timestamp",ae.TIME_FORMAT="http://onto.fel.cvut.cz/ontologies/form/time-format",ae.DATE_FORMAT="http://onto.fel.cvut.cz/ontologies/form/date-format",ae.DATETIME_FORMAT="http://onto.fel.cvut.cz/ontologies/form/datetime-format",ae.NOT_ANSWERED_QUESTION="http://onto.fel.cvut.cz/ontologies/form/not-answered-question",ae.ANSWERED_QUESTION="http://onto.fel.cvut.cz/ontologies/form/answered-question",ae.HAS_VALIDATION_SEVERITY="http://onto.fel.cvut.cz/ontologies/form/has-validation-severity",ae.RDFS_LABEL=u.RDFS_LABEL,ae.RDFS_COMMENT=u.RDFS_COMMENT,ae.DEFAULT_HAS_CHILD=u.DEFAULT_HAS_CHILD,ae.BROADER="http://www.w3.org/2004/02/skos/core#broader",ae.HAS_NON_SELECTABLE_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-non-selectable-value",ae.PROVIDES_DEREFERENCEABLE_ANSWER_VALUES="http://onto.fel.cvut.cz/ontologies/form/provides-dereferenceable-answer-values",ae.ICONS={QUESTION_COMMENTS:"questionComments",QUESTION_HELP:"questionHelp",QUESTION_LINK:"questionLink"},ae.ICON_BEHAVIOR={ENABLE:"enable",DISABLE:"disable",ON_HOVER:"onHover"},ae.DEFAULT_OPTIONS={icons:[{id:te.ICONS.QUESTION_HELP,behavior:te.ICON_BEHAVIOR.ENABLE},{id:te.ICONS.QUESTION_COMMENTS,behavior:te.ICON_BEHAVIOR.ON_HOVER},{id:te.ICONS.QUESTION_LINK,behavior:te.ICON_BEHAVIOR.ON_HOVER}]},ae.LANG={cs:{locale:"cs",label:"Čestina"},en:{locale:"en",label:"English"}},ae.VALIDATION={SEVERITY:{ERROR:"error",WARNING:"warning"},DEFAULT_MESSAGE:{REQUIRED:"This field is required.",REQUIRED_ONLY_FOR_COMPLETENESS:"This field is required to complete the form.",INVALID:"This field is invalid.",CHECK:"This field must be checked.",LOWER_OR_EQUAL:"This field should be a number equal or lower to ",GREATER_OR_EQUAL:"This field must be greater or equal to "},CLASSNAME:{ERROR:"is-invalid",WARNING:"is-warning"}};var se=/*#__PURE__*/function(){function e(){}return e.getStringHash=function(e){var t=0,n=e?e.length:0;if(0===n)return t;for(var o=0;o<n;o++)t=(t<<5)-t+e.charCodeAt(o),t&=t;return t},e.asArray=function(e){return e?e.constructor===Array?e:[e]:[]},e.findQuestionById=function(t,n,o,r,i){if(o&&n["@id"]===t)return n;var a=e.asArray(n[ae.HAS_SUBQUESTION]);if(r)for(var s,l=ee(a);!(s=l()).done;){var u=e.findQuestionById(t,s.value,!0,!1,!1);if(u)return u}if(i)for(var c,p=ee(a);!(c=p()).done;){var m=e.findQuestionById(t,c.value,!1,!0,!0);if(m)return m}return null},e.findKeyInObjects=function(e,t){for(var n=0;n<e.length;n++)for(var o=0;o<t.length;o++)if(e[n].hasOwnProperty(t[o]))return t[o];return null},e}(),le=/*#__PURE__*/function(){function e(){}return e.putObject=function(t,n){e.objectMap[t]=n},e.getObject=function(t){return e.objectMap[t]},e}();le.objectMap={};var ue=/*#__PURE__*/function(){function e(){}return e.getFirstObject=function(e,t){var n=l.getValues(e,t);return 0===n.length?null:n[0]},e.compareValues=function(e,t){return t="object"==typeof t?t:{"@value":t},!!((e="object"==typeof e?e:{"@value":e})&&e["@value"]&&t&&t["@value"]&&("string"==typeof e["@value"]?e["@value"]:JSON.stringify(e["@value"]))===("string"==typeof t["@value"]?t["@value"]:JSON.stringify(t["@value"])))||l.compareValues(e,t)},e.toplogicalSort=function(e,t){var n;do{n=!1;for(var o=0;o<e.length;o++)for(var r=o;r<e.length;r++)if(e[o][t]&&("object"==typeof e[o][t]?e[o][t]["@id"]:e[o][t])===e[r]["@id"]){var i=e[o];e[o]=e[r],e[r]=i,n=!0;break}}while(n);return e},e.orderPreservingToplogicalSort=function(e,t){for(var n=c(),o={},r=function(){var r=e[i]["@id"];n.add(r),o[r]=e[i],se.asArray(e[i][t]).map(function(e){return"object"==typeof e?e["@id"]:e}).map(function(e){return[e,r]}).forEach(function(e){return n.add(e)})},i=0;i<e.length;i++)r();for(var a=n.sort(),s=0;s<a.length;s++)e[s]=o[a[s]];return e},e.getCompareLocalizedLabelFunction=function(e){return function(t,n){var o=u.getLocalized(t[u.RDFS_LABEL],e),r=u.getLocalized(n[u.RDFS_LABEL],e);return o<r?-1:o>r?1:0}},e.orderByLocalizedLabels=function(t,n){return t.sort(e.getCompareLocalizedLabelFunction(n))},e.checkId=function(e,t){if(void 0!==e)return e.constructor===Array?!!e.find(function(e){return e["@id"]===t}):e.constructor===Object?e["@id"]===t:void 0},e}(),ce=/*#__PURE__*/function(){function e(){}return e.isForm=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.FORM)},e.isWizardStep=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.WIZARD_STEP)},e.isSection=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.QUESTION_SECTION)},e.isAnswerable=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.ANSWERABLE)},e.isTypeahead=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.QUESTION_TYPEAHEAD)},e.getPossibleValuesQuery=function(e){return u.getJsonAttValue(e,ae.HAS_OPTIONS_QUERY)},e.isDisabled=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.DISABLED)},e.isHidden=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.HIDDEN)},e.isTextarea=function(t,n){return n&&n.length>ae.INPUT_LENGTH_THRESHOLD&&!e.isTypeahead(t)||u.hasValue(t,ae.LAYOUT_CLASS,ae.LAYOUT.TEXTAREA)},e.isText=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.TEXT)},e.isCalendar=function(t){return e.isDate(t)||e.isTime(t)||e.isDateTime(t)},e.isDate=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.DATE)},e.isTime=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.TIME)},e.isDateTime=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.DATETIME)},e.isCheckbox=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.CHECKBOX)},e.isMaskedInput=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.MASKED_INPUT)},e.isSparqlInput=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.SPARQL)},e.isTurtleInput=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.TURTLE)},e.isCollapsed=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.COLLAPSED)},e.isEmphasised=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.EMPHASISED)},e.getCategory=function(e){return ae.LAYOUT.CATEGORY.find(function(t){return u.hasValue(e,ae.LAYOUT_CLASS,t)})},e.resolveValue=function(e){return e?e[ae.HAS_OBJECT_VALUE]?e[ae.HAS_OBJECT_VALUE]["@id"]:u.getJsonAttValue(e,ae.HAS_DATA_VALUE):null},e.resolveValueObject=function(e){return e?e[ae.HAS_OBJECT_VALUE]?se.asArray(e[ae.HAS_OBJECT_VALUE])[0]:e[ae.HAS_DATA_VALUE]?se.asArray(e[ae.HAS_DATA_VALUE])[0]:null:null},e.isRelevant=function(t){if(!t[ae.IS_RELEVANT_IF])return!0;for(var n,o=ee(se.asArray(t[ae.IS_RELEVANT_IF]));!(n=o()).done;)if(!e.testCondition(n.value))return!1;return!0},e.hasValidationLogic=function(e){return!!(e[ae.REQUIRES_ANSWER]||e[ae.REQUIRES_ANSWER_IF]||e[ae.PATTERN]||this.containsXSDProperty(e))},e.isValid=function(e){if(!1===e[ae.HAS_VALID_ANSWER])return!1;for(var t,n=ee(se.asArray(e[ae.HAS_SUBQUESTION]));!(t=n()).done;)if(!1===this.isValid(t.value))return!1;return!0},e.testOrCondition=function(e){var t=e[ae.HAS_SUB_CONDITION];t||console.warn("Or condition does not have any sub-condition !");for(var n,o=ee(this._getMappedObjectsArray(t));!(n=o()).done;)if(this.testCondition(n.value))return!0;return!1},e.testCondition=function(t){var n,o=t[ae.ACCEPTS_VALIDATION_VALUE],r=t[ae.ACCEPTS_ANSWER_VALUE],i=t[ae.ACCEPTS],a=t[ae.HAS_TESTED_QUESTION];if(t[ae.HAS_SUB_CONDITION])return this.testOrCondition(t);if(o&&r&&console.warn("Support for validation and requirement constraints at same time is not implemented !"),i&&a){var s=se.asArray(i);if(1!==s.length&&console.warn("Support for multiple accepts values is not implemented !"),s[0]["@id"]===ae.ANSWERED_QUESTION){(r||o)&&console.warn("Support for accepted answer/validations values is not implemented !");for(var u,c=ee(this._getMappedObjectsArray(a));!(u=c()).done;)if(!this.hasAnswer(u.value))return!1;return!0}console.warn("No support to accept question of type "+s[0]["@id"]+" !")}if(o&&a){var p=se.asArray(o);(1!==p.length||!0!==p[0]&&"true"!==p[0])&&console.warn('Validation values other than "true" are not implemented !');for(var m,d=ee(se.asArray(a));!(m=d()).done;){if(void 0===(n=le.getObject(m.value["@id"])))return console.warn("Questions is not loaded in an object map."),!0;if(!1===this.isValid(n))return!1}return!0}if(r&&a){n=le.getObject(a["@id"]);for(var f,h=ee(se.asArray(r));!(f=h()).done;){var E=f.value;if(!n)return console.warn("Question is not defined."),!0;if(!n.hasOwnProperty(ae.HAS_ANSWER))return!1;var v=l.getValues(n,ae.HAS_ANSWER);if(0===v.length)return!1;var S=e.resolveValueObject(v[0]);if(S&&E&&S.hasOwnProperty("@value")&&E.hasOwnProperty("@id")&&S["@value"]==E["@id"])return!0;if(ue.compareValues(S,E))return!0}}return!1},e._getMappedObjectsArray=function(e,t){return se.asArray(e).map(function(e){var n=le.getObject(e["@id"]);return void 0===n?(console.warn((t||"Object")+' "'+e["@id"]+'" is not loaded in an object map.'),null):n}).filter(function(e){return null!==e})},e.hasAnswer=function(t){if(!t)return!1;if(t.hasOwnProperty(ae.HAS_ANSWER)){var n=l.getValues(t,ae.HAS_ANSWER);if(n.length){var o=e.resolveValueObject(n[0]);if(o&&(o["@value"]||o["@id"]))return!0}}for(var r,i=ee(se.asArray(t[ae.HAS_SUBQUESTION]));!(r=i()).done;)if(e.hasAnswer(r.value))return!0;return!1},e.getAnswerValue=function(t){if(!t)return null;if(t.hasOwnProperty(ae.HAS_ANSWER)){var n=l.getValues(t,ae.HAS_ANSWER);if(n.length){var o=e.resolveValueObject(n[0]);if(o&&(o["@value"]||o["@id"]))return o["@value"]||o["@id"]}}for(var r,i=ee(se.asArray(t[ae.HAS_SUBQUESTION]));!(r=i()).done;){var a=e.getAnswerValue(r.value);if(a)return a}return null},e.resolveDateTimeFormat=function(t,n,o){var r="number"==typeof n,i=e.isDate(t),a=e.isTime(t),s=e.isDateTime(t);return r?ae.DATETIME_NUMBER_FORMAT:i?t[ae.DATE_FORMAT]||o.dateFormat:a?t[ae.TIME_FORMAT]||o.timeFormat:s?t[ae.DATETIME_FORMAT]||o.dateTimeFormat:null},e.dfsTraverseQuestionTree=function(e,t,n){function o(e){t(e),se.asArray(e[ae.HAS_SUBQUESTION]).forEach(function(e){o(e)}),n(e)}void 0===n&&(n=function(){}),e.forEach(function(e){o(e)})},e.getFormSpecification=function(t){var n=-1,o="..",r="";return e.dfsTraverseQuestionTree(t,function(e){var t=" ".repeat(n+=1),i="";e[ae.REQUIRES_ANSWER]&&!e[ae.USED_ONLY_FOR_COMPLETENESS]?i=t+o+"required: "+e[ae.REQUIRES_ANSWER]+"\n":e[ae.USED_ONLY_FOR_COMPLETENESS]&&(i=t+o+"required only for completeness: "+e[ae.USED_ONLY_FOR_COMPLETENESS]+"\n"),r+=t+e["http://www.w3.org/2000/01/rdf-schema#label"]+"\n",r+=e[ae.HELP_DESCRIPTION]?t+o+"description: "+e[ae.HELP_DESCRIPTION]+"\n":"",r+=i,r+=e[ae.PATTERN]?t+o+"pattern: "+e[ae.PATTERN]+"\n":"",r+=e[ae.INPUT_MASK]?t+o+"mask: "+e[ae.INPUT_MASK]+"\n":"",r+=e[ae.HAS_VALIDATION_MESSAGE]?t+o+"validation-message: "+e[ae.HAS_VALIDATION_MESSAGE]+"\n":"",r+="\n"},function(){n-=1}),r},e.containsXSDProperty=function(e){for(var t=Object.keys(e),n=0,o=Object.values(ae.XSD);n<o.length;n++)if(t.includes(o[n]))return!0;return!1},e.getInputMask=function(e){if(e[ae.INPUT_MASK])return e[ae.INPUT_MASK]},e}(),pe={},me=[],de=/*#__PURE__*/e.createContext({}),fe=function(r){var i=n(r.data||pe),a=i[0],s=i[1],l=n(r.formQuestions||me),u=l[0],c=l[1];o(function(){if(r.isFormValid){var e=ce.isValid(a);r.isFormValid(e)}},[]),o(function(){s(r.data||pe)},[u]);var p=function(e){e&&s(Object.assign({},a,e))},m=function(e,t){if(!(!t||e<0||e>=u.length)){if("object"==typeof t){var n=[].concat(u);n[e]=Object.assign({},n[e],t),c(n)}if(Array.isArray(t)&&c(t),r.isFormValid){var o=ce.isValid(a);r.isFormValid(o)}}},d=function(){return a},f=function(e){return null==e?u:u[e]},h=t(function(){return{updateData:p,updateFormQuestionsData:m,getData:d,getFormQuestionsData:f}},[f,d]);/*#__PURE__*/return e.createElement(de.Provider,Y({value:h},r),r.children)};fe.propTypes={children:s.element.isRequired,data:s.object.isRequired,formQuestions:s.array.isRequired,isFormValid:s.func};var he=/*#__PURE__*/function(t){function n(e){var n;return(n=t.call(this,e)||this).state={cursorPosition:0},n}K(n,t);var o=n.prototype;return o.focus=function(){p.findDOMNode(this.input).focus()},o.getInputDOMNode=function(){return p.findDOMNode(this.input)},o.componentDidUpdate=function(e,t,n){(this.fieldDidShrink(e)||this.fieldDidExpand(e))&&this.updateFieldCursorPosition()},o.fieldDidExpand=function(e){return"textarea"===this.props.type&&"textarea"!==e.type},o.fieldDidShrink=function(e){return"text"===this.props.type&&"text"!==e.type},o.updateFieldCursorPosition=function(){this.focus(),this.getInputDOMNode().setSelectionRange(this.state.cursorPosition,this.state.cursorPosition)},o.saveCursorPosition=function(e){this.props.onChange(e),this.setState({cursorPosition:e.target.selectionStart})},o.render=function(){switch(this.props.type){case"radio":return this._renderRadio();case"checkbox":return this._renderCheckbox();case"select":return this._renderSelect();case"textarea":return this._renderTextArea();default:return this._renderInput()}},o._renderCheckbox=function(){var t=this;/*#__PURE__*/return e.createElement(m.Group,{size:"small",controlId:Math.floor(Math.random()*Number.MAX_SAFE_INTEGER)},/*#__PURE__*/e.createElement(m.Check,Y({type:"checkbox",ref:function(e){return t.input=e}},this.props,{label:this.props.label,className:this.props.validation.classname})),this.props.validation.message)},o._renderRadio=function(){var t=this;/*#__PURE__*/return e.createElement(d,{size:"small"},/*#__PURE__*/e.createElement(m.Check,Y({type:"radio",ref:function(e){return t.input=e}},this.props,{label:this.props.label,className:this.props.validation.classname})),this.props.validation.message)},o._renderSelect=function(){var t=this;/*#__PURE__*/return e.createElement(d,{size:"small"},this._renderLabel(),/*#__PURE__*/e.createElement(f,Y({as:"select",className:this.props.validation.classname,ref:function(e){return t.input=e}},this.props),this.props.children),this.props.validation.message)},o._renderLabel=function(){return this.props.label?/*#__PURE__*/e.createElement(m.Label,null,this.props.label):null},o._renderTextArea=function(){var t=this;/*#__PURE__*/return e.createElement(d,{size:"small"},this._renderLabel(),/*#__PURE__*/e.createElement(f,Y({ref:function(e){return t.input=e},as:"textarea"},this.props,{className:this.props.validation.classname,onChange:function(e){return t.saveCursorPosition(e)}})),this.props.validation.message)},o._renderInput=function(){var t=this;/*#__PURE__*/return e.createElement(d,{size:"small"},this._renderLabel(),/*#__PURE__*/e.createElement(f,Y({className:this.props.validation.classname,ref:function(e){return t.input=e},as:"input",placeholder:this.props.placeholder},this.props,{onChange:function(e){return t.saveCursorPosition(e)}})),this.props.validation.message)},n}(e.Component);he.propTypes={type:s.string,label:s.object,value:s.any,onChange:s.func,help:s.string,validation:s.object,placeholder:s.string},he.defaultProps={type:"text"};var Ee=["children"],ve=/*#__PURE__*/e.createContext({}),Se={components:{inputComponent:he},componentsOptions:{dateTimeAnswer:{dateFormat:"yyyy-MM-dd",timeFormat:"HH:mm",dateTimeFormat:"yyyy-MM-dd HH:mm:ss"},readOnly:!1},options:{intl:{locale:"en"},modalView:!1,modalProps:{},horizontalWizardNav:!0,wizardStepButtons:!0,enableWizardStepSkip:!0,startingStep:0}},Ae=function(n){var o=n.children,r=Z(n,Ee),i=t(function(){return{inputComponent:r.components&&r.components.inputComponent||Se.components.inputComponent,componentsOptions:Object.assign({},Se.componentsOptions,r.componentsOptions),options:Object.assign({},Se.options,r.options),mapComponent:r.mapComponent}},[r]);/*#__PURE__*/return e.createElement(ve.Provider,{value:i},o)};Ae.propTypes={children:s.element.isRequired,components:s.object,mapComponent:s.func,options:s.object};var ge,_e,Te={"comment.form.placeholder":"Sem napište své komentáře (Ctrl+Enter pro potvrzení)","wizard.nav.tooltip":"Navigace na této kartě je zakázána, aby nedošlo k přehlédnutí důležitých otázek. K navigaci na tuto kartu použijte tlačítka související s formulářem.","wizard.next":"Další","wizard.previous":"Předchozí","section.expand":"Rozbalit","section.collapse":"Sbalit","validation.required":"Toto pole je povinné.","validation.required_only_for_completeness":"Toto pole je povinné pro vyplnění formuláře.","validation.invalid":"Toto pole je neplatné.","validation.check":"Toto pole musí být zkontrolováno.","validation.lower_or_equal":"Toto pole by mělo být číslo rovné nebo nižší než ","validation.greater_or_equal":"Toto pole musí být větší nebo rovno "},Ne={"comment.form.placeholder":"Write your comments here (Ctrl+Enter to confirm, Esc to cancel)","wizard.nav.tooltip":"Navigation to this tab is disabled to prevent overlooking important questions. Use form-related buttons to navigate to this tab instead.","wizard.next":"Next","wizard.previous":"Previous","section.expand":"Expand","section.collapse":"Collapse","validation.required":"This field is required.","validation.required_only_for_completeness":"This field is required to complete the form.","validation.invalid":"This field is invalid.","validation.check":"This field must be checked.","validation.lower_or_equal":"This field should be a number equal or lower to ","validation.greater_or_equal":"This field must be greater or equal to "},Ie=/*#__PURE__*/e.createContext({}),Oe=function(e){var t=e.locale,n=void 0===t?navigator.language:t,o=Ne;return n===ae.LANG.cs.locale&&(o=Te),V(Ie.Provider,{value:{locale:n,lang:o},children:V(H,{locale:n,messages:o,children:e.children})})},Ce={"@graph":[{"@type":"http://onto.fel.cvut.cz/ontologies/documentation/question","http://onto.fel.cvut.cz/ontologies/form-layout/has-layout-class":"form","http://onto.fel.cvut.cz/ontologies/documentation/has_related_question":[{"http://onto.fel.cvut.cz/ontologies/form-layout/has-layout-class":["wizard-step","section"],"http://www.w3.org/2000/01/rdf-schema#label":[{"@language":"en","@value":"Description"},{"@language":"cs","@value":"Popis"}],"http://onto.fel.cvut.cz/ontologies/documentation/has_related_question":[{"@type":"http://onto.fel.cvut.cz/ontologies/documentation/question","http://onto.fel.cvut.cz/ontologies/form-layout/has-layout-class":["textarea"],"http://www.w3.org/2000/01/rdf-schema#label":[{"@language":"en","@value":"Description"},{"@language":"cs","@value":"Popis"}],"http://onto.fel.cvut.cz/ontologies/documentation/has_answer":{"@type":"http://onto.fel.cvut.cz/ontologies/documentation/answer","http://onto.fel.cvut.cz/ontologies/documentation/has_data_value":""}}]}]}]},be=/*#__PURE__*/function(){function e(){}return e.generateForm=function(){return JSON.parse(JSON.stringify(Ce))},e}(),Re={root:(ge={},ge[ae.HAS_LAYOUT_CLASS]=ae.FORM,ge),expandProperties:[ae.HAS_SUBQUESTION,ae.IS_RELEVANT_IF,ae.HAS_ANSWER,ae.HAS_DECLARED_PREFIX,ae.HAS_OPTION,ae.HAS_COMMENT]},ye=/*#__PURE__*/function(){function e(){}return e.customFrame=function(e,t,n){if(arguments.length<2)return l.nextTick(function(){n(new TypeError("Could not frame, too few arguments."))});null===t&&(t=Re),l.flatten(e,null,null,function(e,t){})},e.expandStructure=function(e){var t,n={};e["@graph"].forEach(function(e){n[e["@id"]]=e,ce.isForm(e)&&(t=e)});try{this._expandGraph(t,Re,n)}catch(e){console.error("Error '"+e+"' occured, while trying to apply frame-ing with custom shape.")}return n},e._expandGraph=function(e,t,n){var o,r,i,a=this;t.expandProperties.forEach(function(s){if(e.hasOwnProperty(s)){e[s]=se.asArray(e[s]),o=e[s];for(var l=0;l<o.length;l++)i=a._getId(o[l]),void 0!==(r=n[i])?(o[l]=r,a._expandGraph(r,t,n)):console.warn("object with @id "+i+" was not defined in input data.")}})},e._getId=function(e){return"string"==typeof e?e:e["@id"]},e}();_e=ye,ye.compressStructure=function(e){var t=[],n=new Set;return(t=_e._compressGraph(e,t,n)).sort(function(e,t){return e["@id"]&&t["@id"]?e["@id"].localeCompare(t["@id"]):0})},ye._compressGraph=function(e,t,n){return n.has(e["@id"])||(t.push(e),n.add(e["@id"])),Re.expandProperties.forEach(function(o){if(e.hasOwnProperty(o))for(var r=e[o],i=0;i<r.length;i++){var a=r[i];void 0!==a&&(r[i]=a,t=_e._compressGraph(a,t,n),e[o][i]={"@id":a["@id"]})}}),t};var we=/*#__PURE__*/function(){function e(){}return e.constructDefaultForm=function(t){var n=be.generateForm();return e._constructFormQuestions(n,t)},e.constructForm=function(t,n){try{var o,r;return Promise.resolve(l.flatten(t,{}).then(function(t){try{var i=e._constructFormQuestions(t,n);r=i[1],o={formQuestions:i[0]}}catch(e){console.error("Error while constructing form questions from the provided structure:",e)}if(!r){var a=e.constructDefaultForm(n);r=a[1],o={formQuestions:a[0]}}return[o,r]}).catch(function(e){return console.error("Failed to flatten the JSON-LD structure. Expected to transform a nested JSON-LD document into a flattened array of node objects:",e),[o,r]}))}catch(e){return Promise.reject(e)}},e._constructFormQuestions=function(e,t){var n,o,r,i=[];if(void 0!==e["@graph"][0]["@id"]?(r=ye.expandStructure(e),Object.keys(r).map(function(e){le.putObject(e,r[e])})):console.warn("default form is constructed."),!(o=(n=e["@graph"].find(function(e){return ce.isForm(e)}))[ae.HAS_SUBQUESTION]))throw ne.error("Could not find any questions in the received data."),"No questions in the form";return(i=o.filter(function(e){return!(!ce.isWizardStep(e)||ce.isHidden(e))||(ne.warn("Item is not a wizard step: "+e),!1)})).length||(ne.log("Could not find any wizard steps in the received data. Building form without steps"),n[ae.HAS_SUBQUESTION].forEach(function(e){return i.push(e)})),i.sort(ue.getCompareLocalizedLabelFunction(t)),ue.orderPreservingToplogicalSort(i,ae.HAS_PRECEDING_QUESTION),[i,{root:n}]},e}(),Le=/*#__PURE__*/function(){function e(){}return e.buildQuestionAnswerModel=function(t,n){var o,r={subQuestions:[]};if(t&&(r.uri=t.root["@id"],r.origin=u.getJsonAttValue(t.root,ae.HAS_QUESTION_ORIGIN,"@id")),n)for(var i=0;i<n.length;i++)(o=e.processQuestionAnswerHierarchy(n[i]))&&r.subQuestions.push(o);return r},e.processQuestionAnswerHierarchy=function(t){return t?e._processQuestion(t):null},e._processQuestion=function(t){var n={};if(n.uri=t["@id"],n.origin=u.getJsonAttValue(t,ae.HAS_QUESTION_ORIGIN,"@id"),t[ae.HAS_SUBQUESTION]){n.subQuestions=[];for(var o=0;o<t[ae.HAS_SUBQUESTION].length;o++)n.subQuestions.push(e._processQuestion(t[ae.HAS_SUBQUESTION][o]))}if(t[ae.HAS_ANSWER]){n.answers=[],Array.isArray(t[ae.HAS_ANSWER])||(t[ae.HAS_ANSWER]=[t[ae.HAS_ANSWER]]);for(var r=0;r<t[ae.HAS_ANSWER].length;r++)n.answers.push(e.processAnswer(t[ae.HAS_ANSWER][r]))}if(t[ae.HAS_COMMENT]){n.comments=[],Array.isArray(t[ae.HAS_COMMENT])||(t[ae.HAS_COMMENT]=[t[ae.HAS_COMMENT]]);for(var i=0;i<t[ae.HAS_COMMENT].length;i++)n.comments.push(e.processComment(t[ae.HAS_COMMENT][i]))}return n},e.processComment=function(e){var t={};return t.author=u.getJsonAttValue(e,ae.HAS_AUTHOR,"@id"),t.value=u.getJsonAttValue(e,ae.HAS_COMMENT_VALUE),t.timestamp=u.getJsonAttValue(e,ae.HAS_TIMESTAMP,"@id"),t},e.processAnswer=function(e){var t={};return t.uri=e["@id"],t.origin=u.getJsonAttValue(e,ae.HAS_ANSWER_ORIGIN,"@id"),e[ae.HAS_OBJECT_VALUE]?t.codeValue=u.getJsonAttValue(e,ae.HAS_OBJECT_VALUE,"@id"):t.textValue=u.getJsonAttValue(e,ae.HAS_DATA_VALUE),t},e.generateAnswer=function(e){var t={};return t[ae.HAS_DATA_VALUE]="",t},e}(),De=function(t){var n=r(ve);/*#__PURE__*/return e.createElement(n.inputComponent,{type:"checkbox",label:t.label,title:t.title,checked:!0===t.value||"true"===t.value,validation:t.validation,onChange:function(e){t.onChange(e.target.checked)},disabled:n.componentsOptions.readOnly||ce.isDisabled(t.question)})};De.propTypes={question:s.object.isRequired,label:s.object.isRequired,title:s.string,value:s.oneOfType([s.string,s.bool]),onChange:s.func.isRequired,mouseHover:s.bool,validation:s.object};var Ve=function(t){var i=r(ve).componentsOptions,a=n(null),s=a[0],l=a[1];o(function(){t.value&&l(new Date(P(t.value,f,new Date)))},[]);var u=ce.resolveDateTimeFormat(t.question,t.value,i.dateTimeAnswer),c=ce.isDate(t.question),p=ce.isTime(t.question),f="x"===u?i.dateTimeAnswer.dateTimeFormat:u;/*#__PURE__*/return e.createElement(d,{size:"small"},/*#__PURE__*/e.createElement(m.Label,{className:"w-100"},t.label),/*#__PURE__*/e.createElement(j,{selected:s,placeholderText:f,onChange:function(e){l(e),e||t.onChange(""),t.onChange(u===ae.DATETIME_NUMBER_FORMAT?Number(e):x(e,u))},showTimeSelect:!c,showTimeSelectOnly:p,timeFormat:"HH:mm",timeIntervals:1,timeCaption:"Time",dateFormat:f,className:q("form-control",t.validation.classname),disabled:i.readOnly||ce.isDisabled(t.question)}),t.validation.message)};Ve.propTypes={question:s.object.isRequired,label:s.object.isRequired,title:s.string,value:s.oneOfType([s.string,s.number]),onChange:s.func.isRequired,validation:s.object};var Me=[ae.XSD.INT,ae.XSD.INTEGER,ae.XSD.NON_NEGATIVE_INTEGER,ae.XSD.NON_POSITIVE_INTEGER,ae.XSD.NEGATIVE_INTEGER,ae.XSD.POSITIVE_INTEGER,ae.XSD.FLOAT,ae.XSD.POSITIVE_FLOAT,ae.XSD.NEGATIVE_FLOAT],He={};He[ae.XSD.NON_NEGATIVE_INTEGER]={min:0},He[ae.XSD.NON_POSITIVE_INTEGER]={max:0},He[ae.XSD.NEGATIVE_INTEGER]={max:-1},He[ae.XSD.POSITIVE_INTEGER]={min:1};var Ue={"string-2":"prefixed",atom:"var"},je=/*#__PURE__*/function(){function e(){}return e._resolveInputType=function(t,n){return ce.isSparqlInput(t)||ce.isTurtleInput(t)||ce.isTextarea(t,n)?"textarea":e._isNumeric(t)?"number":"text"},e._isNumeric=function(e){for(var t=0,n=Me.length;t<n;t++)if(u.hasValue(e,ae.HAS_DATATYPE,Me[t]))return!0;return!1},e.resolveInputProperties=function(t,n,o){var r={};switch(r.type=e._resolveInputType(t,n),r.type){case"textarea":r.rows=5;break;case"number":r=Object.assign({},r,e._resolveNumberRestrictions(t),this._resolveStepRestriction(t))}return r.disabled=o.readOnly||ce.isDisabled(t),r},e._resolveStepRestriction=function(e){var t={};return void 0!==e[ae.STEP]&&(t.step=u.getJsonAttValue(e,ae.STEP)),t},e._resolveNumberRestrictions=function(e){var t={};return Object.getOwnPropertyNames(He).forEach(function(n){u.hasValue(e,ae.HAS_DATATYPE,n)&&(t=Object.assign({},t,He[n]))}),void 0!==e[ae.XSD.MIN_INCLUSIVE]&&(t.min=e[ae.XSD.MIN_INCLUSIVE]),void 0!==e[ae.XSD.MIN_EXCLUSIVE]&&(t.min=e[ae.XSD.MIN_EXCLUSIVE]+1),void 0!==e[ae.XSD.MAX_EXCLUSIVE]&&(t.max=e[ae.XSD.MAX_EXCLUSIVE]-1),void 0!==e[ae.XSD.MAX_INCLUSIVE]&&(t.max=e[ae.XSD.MAX_INCLUSIVE]),t},e._preventCharacterInput=function(t,n){"number"!==e._resolveInputType(n)||t.key>="0"&&t.key<="9"||["Backspace","Delete","ArrowLeft","ArrowRight","-","Minus","NumpadSubtract",".","Period"].includes(t.key)||t.preventDefault()},e}(),Pe=function(t){var n=r(ve),o=n.inputComponent,i=n.componentsOptions,a=t.question,s=t.answer,l=t.value;return s[ae.HAS_OBJECT_VALUE]&&s[ae.HAS_OBJECT_VALUE][u.RDFS_LABEL]&&(l=u.getJsonAttValue(s[ae.HAS_OBJECT_VALUE],u.RDFS_LABEL)),/*#__PURE__*/e.createElement(o,Object.assign({},je.resolveInputProperties(a,l,i),{validation:t.validation,label:t.label,title:t.title,value:null==l?"":l,placeholder:ce.getInputMask(a),onKeyPress:function(e){return je._preventCharacterInput(e,a)},onChange:function(e){t.onChange(e.target.value),(t.sparql||t.turtle)&&(void 0).hide()},onFocus:function(e){if(t.sparql){var n=k.fromTextArea(e.target);n.setValue(l),n.on("change",function(){t.onChange(n.getValue())}),k.Autocompleters.prefixes.appendPrefixIfNeeded=function(e,n){if(e.autocompleters.getTrie(n)&&e.options.autocompleters&&-1!==e.options.autocompleters.indexOf(n)){var o=e.getCursor(),r=e.getTokenAt(o);if("prefixed"===Ue[r.type]){var i=r.string.indexOf(":");if(-1!==i){var a=e.getPreviousNonWsToken(o.line,r).string.toUpperCase(),s=e.getTokenAt({line:o.line,ch:r.start});if("PREFIX"!==a&&("ws"===s.type||null==s.type)){var l=r.string.substring(0,i+1);if(null==e.getPrefixesFromQuery()[l.slice(0,-1)])if(t.question[ae.HAS_DECLARED_PREFIX]&&t.question[ae.HAS_DECLARED_PREFIX].filter(function(e){return e[ae.PREFIX]===l.slice(0,-1)}).length){var u=t.question[ae.HAS_DECLARED_PREFIX].filter(function(e){return e[ae.PREFIX]===l.slice(0,-1)}),c={};c[u[0][ae.PREFIX]]=u[0][ae.NAMESPACE],e.addPrefixes(c)}else{var p=e.autocompleters.getTrie(n).autoComplete(l);p.length>0&&e.addPrefixes(p[0])}}}}}}}else if(t.turtle){console.log("TTL");var o=k.fromTextArea(e.target);o.setValue(l),o.on("change",function(){t.onChange(o.getValue())})}}}))};Pe.propTypes={question:s.object.isRequired,answer:s.object.isRequired,label:s.object.isRequired,title:s.string,value:s.oneOfType([s.string,s.number]),onChange:s.func.isRequired,validation:s.object};var xe={D:"1",M:"1",Y:"1",h:"1",m:"1",s:"1"},qe=/*#__PURE__*/function(){function e(){}return e.mapMask=function(e){if(!e)return e;for(var t,n="",o=0,r=e.length;o<r;o++)t=e.charAt(o),n+=xe[t]?xe[t]:t;return n},e}(),ke=["size","placeholder"];function ze(e){var t,n,o,r;if(void 0!==e.selectionStart)t=e.selectionStart,n=e.selectionEnd;else try{e.focus(),r=(o=e.createTextRange()).duplicate(),o.moveToBookmark(document.selection.createRange().getBookmark()),r.setEndPoint("EndToStart",o),n=(t=r.text.length)+o.text.length}catch(e){}return{start:t,end:n}}var Qe=/*#__PURE__*/function(t){function n(e){var n;return(n=t.call(this,e)||this)._updatePattern=function(e){n.mask.setPattern(qe.mapMask(e.mask),{value:n.mask.getRawValue(),selection:ze(n.input)})},n._updateMaskSelection=function(){n.mask.selection=ze(n.input)},n._updateInputSelection=function(){!function(e,t){var n;try{void 0!==e.selectionStart?(e.focus(),e.setSelectionRange(t.start,t.end)):(e.focus(),(n=e.createTextRange()).collapse(!0),n.moveStart("character",t.start),n.moveEnd("character",t.end-t.start),n.select())}catch(e){}}(n.input,n.mask.selection)},n._onChange=function(e){var t=n.mask.getValue();if(e.target.value!==t){if(e.target.value.length<t.length){var o=t.length-e.target.value.length;n._updateMaskSelection(),n.mask.selection.end=n.mask.selection.start+o,n.mask.backspace()}var r=n._getDisplayValue();e.target.value=r,r&&n._updateInputSelection()}n.props.onChange&&n.props.onChange(e)},n._onKeyDown=function(e){if(function(e){return e.ctrlKey&&90===e.keyCode}(e))e.preventDefault(),n.mask.undo()&&(e.target.value=n._getDisplayValue(),n._updateInputSelection(),n.props.onChange&&n.props.onChange(e));else if(function(e){return e.ctrlKey&&89===e.keyCode}(e))e.preventDefault(),n.mask.redo()&&(e.target.value=n._getDisplayValue(),n._updateInputSelection(),n.props.onChange&&n.props.onChange(e));else if("Backspace"===e.key&&(e.preventDefault(),n._updateMaskSelection(),n.mask.backspace())){var t=n._getDisplayValue();e.target.value=t,t&&n._updateInputSelection(),n.props.onChange&&n.props.onChange(e)}},n._onKeyPress=function(e){e.metaKey||e.altKey||e.ctrlKey||"Enter"===e.key||(e.preventDefault(),n._updateMaskSelection(),n.mask.input(e.key)&&(e.target.value=n.mask.getValue(),n._updateInputSelection(),n.props.onChange&&n.props.onChange(e)))},n._onPaste=function(e){e.preventDefault(),n._updateMaskSelection(),n.mask.paste(e.clipboardData.getData("Text"))&&(e.target.value=n.mask.getValue(),setTimeout(n._updateInputSelection,0),n.props.onChange&&n.props.onChange(e))},n.mask=new z({pattern:qe.mapMask(e.mask),value:e.value,formatCharacters:e.formatCharacters,placeholderChar:e.placeholderChar||"_"}),n}K(n,t);var o=n.prototype;return o.componentDidUpdate=function(e){e.mask!==this.props.mask&&this._updatePattern(this.props),e.mask!==this.props.mask&&e.value!==this.props.mask?this.mask.getValue()===this.mask.emptyValue?this.mask.setPattern(qe.mapMask(this.props.mask),{value:this.props.value}):this.mask.setPattern(qe.mapMask(this.props.mask),{value:this.mask.getRawValue()}):e.mask!==this.props.mask?this.mask.setPattern(qe.mapMask(this.props.mask),{value:this.mask.getRawValue()}):e.value!==this.props.value&&this.mask.setValue(this.props.value),e.mask!==this.props.mask&&this.mask.selection.start&&this._updateInputSelection()},o._getDisplayValue=function(){var e=this.mask.getValue();return e===this.mask.emptyValue?"":e},o.focus=function(){this.input.focus()},o.blur=function(){this.input.blur()},o.render=function(){var t=this,n=this.props,o=n.size,r=n.placeholder,i=Z(n,ke),a=this.mask.pattern.length;/*#__PURE__*/return e.createElement(this.context.inputComponent,Object.assign({},i,{ref:function(e){e&&(t.input=e.input?p.findDOMNode(e.input):e)},maxLength:a,onChange:this._onChange,onKeyDown:this._onKeyDown,onKeyPress:this._onKeyPress,onPaste:this._onPaste,placeholder:r||this.mask.emptyValue,size:o||a,value:this._getDisplayValue(),type:"text"}))},n}(e.Component);Qe.contextType=ve,Qe.propTypes={mask:s.string.isRequired},Qe.defaultProps={value:""};var Fe=function(t){var n=r(ve).componentsOptions,o=t.question,i=t.value,a=u.getJsonAttValue(o,ae.INPUT_MASK);return a?/*#__PURE__*/e.createElement(Qe,{mask:a,value:i,label:t.label,title:t.title,placeholder:a,onChange:function(e){return t.onChange(e.target.value)},disabled:n.readOnly||ce.isDisabled(o),validation:t.validation}):(ne.warn("Input mask not provided. Falling back to regular input."),/*#__PURE__*/e.createElement(Pe,t))};Fe.propTypes={question:s.object.isRequired,answer:s.object.isRequired,label:s.object.isRequired,title:s.string,value:s.oneOfType([s.string,s.number]),onChange:s.func.isRequired,validation:s.object};var Be=/*#__PURE__*/function(t){function n(){return t.apply(this,arguments)||this}K(n,t);var o=n.prototype;return o._generateSelectOptions=function(t){var n=[];t.sort(function(e,t){var n=u.getJsonAttValue(e,ae.RDFS_LABEL),o=u.getJsonAttValue(t,ae.RDFS_LABEL);return n<o?-1:n>o?1:0});for(var o=0;o<t.length;o++)n.push(/*#__PURE__*/e.createElement("option",{value:u.getJsonAttValue(t[o],ae.RDFS_LABEL),key:"opt-"+o},u.getJsonAttValue(t[o],ae.RDFS_LABEL)));return n},o.render=function(){var t=this,n=this.props.question;/*#__PURE__*/return e.createElement(this.context.inputComponent,{type:"select",label:this.props.label,value:this.props.value,title:this.props.title,validation:this.props.validation,onChange:function(e){t.props.onChange(e.target.value)},disabled:this.context.componentsOptions.readOnly||ce.isDisabled(n)},this._generateSelectOptions(n[ae.HAS_OPTION]))},n}(e.Component);Be.contextType=ve,Be.propTypes={question:s.object.isRequired,label:s.object.isRequired,title:s.string,value:s.string,onChange:s.func.isRequired,validation:s.object};var We=function(e,t){return e&&e.length?(e.sort(ue.getCompareLocalizedLabelFunction(t)),ue.orderPreservingToplogicalSort(e,ae.HAS_PRECEDING_VALUE),e):[]},Ge=function(t){var i=se.getStringHash(ce.getPossibleValuesQuery(t.question)),a=r(re),s=r(ve),l=s.options.intl,c=n(!0),p=c[0],f=c[1],h=n([We(t.options,l)]),E=h[0],v=h[1];o(function(){var e=!1,n=t.question;return!n[ae.HAS_OPTION]&&ce.getPossibleValuesQuery(n)?function(){try{var t=function(t,o){try{var r=Promise.resolve(a.loadFormOptions(i,ce.getPossibleValuesQuery(n))).then(function(t){e||(f(!1),g(t))})}catch(e){return o()}return r&&r.then?r.then(void 0,o):r}(0,function(){ne.error("An error has occurred during loadFormOptions for query hash: "+i)});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}():(f(!1),g(n[ae.HAS_OPTION])),function(){e=!0}},[]);var S,A,g=function(e){if(!e)return[];for(var t,n={},o=[],r=ee(e=We(e,l));!(t=r()).done;){var i=t.value,a=u.getLocalized(i[ae.RDFS_LABEL],l);n[i["@id"]]={id:i["@id"],value:i["@id"],label:a,children:[]};for(var s,c=ee(se.asArray(i[ae.BROADER]));!(s=c()).done;)o.push({type:"parent-child",parent:s.value["@id"],child:i["@id"]})}for(var p=0,m=o;p<m.length;p++){var d,f=m[p];"parent-child"===f.type&&(null==(d=n[f.parent])||d.children.push(f.child))}var h=Object.values(n);v(h)},_=se.findKeyInObjects(E,["name","value"]),T=se.findKeyInObjects(E,["name","label"]);/*#__PURE__*/return e.createElement(d,{size:"small"},/*#__PURE__*/e.createElement(m.Label,null,t.label),/*#__PURE__*/e.createElement(Q,{styles:("is-warning"===t.validation.classname?(S="#dc9135",A="0 0 0 0.2rem rgba(203, 127, 16, 0.25)"):"is-invalid"===t.validation.classname&&(S="#dc3545",A="0 0 0 .2rem rgba(220,53,69,.25)"),{control:function(e){return Object.assign({},e,{border:S?"1px solid "+S:e.border,boxShadow:e.boxShadow,"&:hover":{border:"1px solid "+S,boxShadow:A||e.boxShadow}})}}),valueKey:_,labelKey:T,valueRenderer:!1===t.question[ae.PROVIDES_DEREFERENCEABLE_ANSWER_VALUES]?function(t){/*#__PURE__*/return e.createElement(e.Fragment,null,t)}:null,valueIsControlled:!0,value:E.filter(function(e){return e.id===t.value}),multi:!1,options:E,isSearchable:!0,isLoading:p,isClearable:!0,renderAsTree:!0,optionLeftOffset:5,isDisabled:p||s.componentsOptions.readOnly||ce.isDisabled(t.question),onChange:function(e){t.onChange(e?e.id:null)}}),t.validation.message)};Ge.propTypes={question:s.object.isRequired,answer:s.object.isRequired,label:s.oneOfType([s.string,s.object]).isRequired,title:s.string,value:s.string,onChange:s.func.isRequired,validation:s.object};var Xe=function(t){/*#__PURE__*/return e.createElement("svg",{className:"caret-square-up",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"28",viewBox:"0 0 24 28"},/*#__PURE__*/e.createElement("title",null,t.title||""),/*#__PURE__*/e.createElement("path",{d:"M17.891 17.453c-0.172 0.344-0.516 0.547-0.891 0.547h-10c-0.375 0-0.719-0.203-0.891-0.547-0.172-0.328-0.141-0.734 0.078-1.031l5-7c0.187-0.266 0.484-0.422 0.812-0.422s0.625 0.156 0.812 0.422l5 7c0.219 0.297 0.25 0.703 0.078 1.031zM20 21.5v-15c0-0.266-0.234-0.5-0.5-0.5h-15c-0.266 0-0.5 0.234-0.5 0.5v15c0 0.266 0.234 0.5 0.5 0.5h15c0.266 0 0.5-0.234 0.5-0.5zM24 6.5v15c0 2.484-2.016 4.5-4.5 4.5h-15c-2.484 0-4.5-2.016-4.5-4.5v-15c0-2.484 2.016-4.5 4.5-4.5h15c2.484 0 4.5 2.016 4.5 4.5z"}))},Ye=function(t){/*#__PURE__*/return e.createElement("svg",{className:"caret-square-down",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"28",viewBox:"0 0 24 28"},/*#__PURE__*/e.createElement("title",null,t.title||""),/*#__PURE__*/e.createElement("path",{d:"M17.891 10.547c0.172 0.328 0.141 0.734-0.078 1.031l-5 7c-0.187 0.266-0.484 0.422-0.812 0.422s-0.625-0.156-0.812-0.422l-5-7c-0.219-0.297-0.25-0.703-0.078-1.031 0.172-0.344 0.516-0.547 0.891-0.547h10c0.375 0 0.719 0.203 0.891 0.547zM20 21.5v-15c0-0.266-0.234-0.5-0.5-0.5h-15c-0.266 0-0.5 0.234-0.5 0.5v15c0 0.266 0.234 0.5 0.5 0.5h15c0.266 0 0.5-0.234 0.5-0.5zM24 6.5v15c0 2.484-2.016 4.5-4.5 4.5h-15c-2.484 0-4.5-2.016-4.5-4.5v-15c0-2.484 2.016-4.5 4.5-4.5h15c2.484 0 4.5 2.016 4.5 4.5z"}))},Ke=function(){/*#__PURE__*/return e.createElement("svg",{className:"info-circle",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"28",viewBox:"0 0 24 28"},/*#__PURE__*/e.createElement("title",null,"info-circle"),/*#__PURE__*/e.createElement("path",{d:"M16 21.5v-2.5c0-0.281-0.219-0.5-0.5-0.5h-1.5v-8c0-0.281-0.219-0.5-0.5-0.5h-5c-0.281 0-0.5 0.219-0.5 0.5v2.5c0 0.281 0.219 0.5 0.5 0.5h1.5v5h-1.5c-0.281 0-0.5 0.219-0.5 0.5v2.5c0 0.281 0.219 0.5 0.5 0.5h7c0.281 0 0.5-0.219 0.5-0.5zM14 7.5v-2.5c0-0.281-0.219-0.5-0.5-0.5h-3c-0.281 0-0.5 0.219-0.5 0.5v2.5c0 0.281 0.219 0.5 0.5 0.5h3c0.281 0 0.5-0.219 0.5-0.5zM24 14c0 6.625-5.375 12-12 12s-12-5.375-12-12 5.375-12 12-12 12 5.375 12 12z"}))},Je=function(){/*#__PURE__*/return e.createElement("svg",{className:"question-circle",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"28",viewBox:"0 0 24 28"},/*#__PURE__*/e.createElement("path",{d:"M14 21.5v-3c0-0.281-0.219-0.5-0.5-0.5h-3c-0.281 0-0.5 0.219-0.5 0.5v3c0 0.281 0.219 0.5 0.5 0.5h3c0.281 0 0.5-0.219 0.5-0.5zM18 11c0-2.859-3-5-5.688-5-2.547 0-4.453 1.094-5.797 3.328-0.141 0.219-0.078 0.5 0.125 0.656l2.063 1.563c0.078 0.063 0.187 0.094 0.297 0.094 0.141 0 0.297-0.063 0.391-0.187 0.734-0.938 1.047-1.219 1.344-1.437 0.266-0.187 0.781-0.375 1.344-0.375 1 0 1.922 0.641 1.922 1.328 0 0.812-0.422 1.219-1.375 1.656-1.109 0.5-2.625 1.797-2.625 3.313v0.562c0 0.281 0.219 0.5 0.5 0.5h3c0.281 0 0.5-0.219 0.5-0.5v0c0-0.359 0.453-1.125 1.188-1.547 1.188-0.672 2.812-1.578 2.812-3.953zM24 14c0 6.625-5.375 12-12 12s-12-5.375-12-12 5.375-12 12-12 12 5.375 12 12z"}))},Ze=function(t){var o=n("right"),r=o[0],i=o[1];/*#__PURE__*/return e.createElement("span",{ref:function(e){return function(e){e&&(e.getBoundingClientRect().x>window.innerWidth/2?i("left"):i("right"))}(e)}},/*#__PURE__*/e.createElement(h,{overlay:t.show?/*#__PURE__*/e.createElement(E,{className:"tooltip-content",id:t.id},t.tooltipContent):/*#__PURE__*/e.createElement("span",null),placement:t.overlayPlacement||r},/*#__PURE__*/e.createElement("span",null,t.children)))};Ze.propTypes={tooltipContent:s.oneOfType([s.object.isRequired,s.string.isRequired]),id:s.string.isRequired,overlayPlacement:s.string,absolutePosition:s.bool,show:s.bool},Ze.defaultProps={iconClassContainer:"",iconClass:"",absolutePosition:!0,show:!0};var $e=function(t){var o=n("right"),r=o[1];/*#__PURE__*/return e.createElement("div",{ref:function(e){return function(e){e&&(e.getBoundingClientRect().x>window.innerWidth/2?r("left"):r("right"))}(e)}},/*#__PURE__*/e.createElement(Ze,{id:"help-icon-tooltip-",overlayPlacement:t.overlayPlacement||o[0],absolutePosition:t.absolutePosition,tooltipContent:t.text},/*#__PURE__*/e.createElement(Je,{className:t.iconClass})))};$e.propTypes={text:s.string.isRequired,iconClassContainer:s.string,iconClass:s.string,overlayPlacement:s.string,absolutePosition:s.bool},$e.defaultProps={iconClassContainer:"",iconClass:"",absolutePosition:!0};var et=function(){/*#__PURE__*/return e.createElement("svg",{className:"external-link-icon",width:"24",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},/*#__PURE__*/e.createElement("path",{d:"M5,2 C5.55228,2 6,2.44772 6,3 C6,3.55228 5.55228,4 5,4 L4,4 L4,12 L12,12 L12,11 C12,10.4477 12.4477,10 13,10 C13.5523,10 14,10.4477 14,11 L14,12 C14,13.1046 13.1046,14 12,14 L4,14 C2.89543,14 2,13.1046 2,12 L2,4 C2,2.89543 2.89543,2 4,2 L5,2 Z M15,1 L15,5.99814453 C15,6.55043453 14.5523,6.99814453 14,6.99814453 C13.4477,6.99814453 13,6.55043453 13,5.99814453 L13,4.41419 L8.71571,8.69846 C8.32519,9.08899 7.69202,9.08899 7.3015,8.69846 C6.91097,8.30794 6.91097,7.67477 7.3015,7.28425 L11.5858,3 L9.99619141,3 C9.44391141,3 8.99619141,2.55228 8.99619141,2 C8.99619141,1.44772 9.44391141,1 9.99619141,1 L15,1 Z"}))},tt=function(t){/*#__PURE__*/return e.createElement(Ze,{tooltipContent:t.url["@id"]||t.url,id:"url-tooltip",overlayPlacement:t.overlayPlacement},/*#__PURE__*/e.createElement("a",{href:t.url["@id"]||t.url,target:"_blank",className:t.iconClassContainer},/*#__PURE__*/e.createElement(et,{className:t.iconClass})))};tt.propTypes={url:s.oneOfType([s.string.isRequired,s.object.isRequired]),iconClassContainer:s.string,iconClass:s.string,overlayPlacement:s.string,absolutePosition:s.bool},tt.defaultProps={iconClassContainer:"",iconClass:"",absolutePosition:!0};var nt=function(){/*#__PURE__*/return e.createElement("svg",{className:"question-comment",version:"1.1",id:"Capa_1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 60 60",width:"24",height:"28"},/*#__PURE__*/e.createElement("path",{d:"M30,1.5c-16.542,0-30,12.112-30,27c0,5.204,1.646,10.245,4.768,14.604c-0.591,6.537-2.175,11.39-4.475,13.689 c-0.304,0.304-0.38,0.769-0.188,1.153C0.275,58.289,0.625,58.5,1,58.5c0.046,0,0.092-0.003,0.139-0.01 c0.405-0.057,9.813-1.411,16.618-5.339C21.621,54.71,25.737,55.5,30,55.5c16.542,0,30-12.112,30-27S46.542,1.5,30,1.5z M16,32.5 c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S18.206,32.5,16,32.5z M30,32.5c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4 S32.206,32.5,30,32.5z M44,32.5c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S46.206,32.5,44,32.5z"}))},ot=function(){/*#__PURE__*/return e.createElement("svg",{className:"recycle-bin-icon",version:"1.1",xmlns:"http://www.w3.org/2000/svg",height:"15px",width:"15px",viewBox:"0 0 512 512"},/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("path",{d:"M331.636,69.818V0H180.364v69.818h-128v128h34.909V512h337.455V197.818h34.909v-128H331.636z M215.273,34.909h81.455\nv34.909h-81.455V34.909z M389.818,477.091H122.182V197.818h267.636V477.091z M424.727,162.909H87.273v-58.182h337.455V162.909z"}))),/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("rect",{x:"168.727",y:"256",width:"34.909",height:"162.909"}))),/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("rect",{x:"308.364",y:"256",width:"34.909",height:"162.909"}))),/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("g",null,/*#__PURE__*/e.createElement("rect",{x:"238.545",y:"256",width:"34.909",height:"162.909"}))))},rt="Unknown author",it=function(t){var o=r(ve).options,i=n(!1),a=i[0],s=i[1],l=n(!1),u=l[0],c=l[1];F.addLocale(W),F.addLocale(B),F.setDefaultLocale(ae.LANG.en.locale);var p,m=new F(o.intl.locale),d=function(){if(o&&o.users){var e=o.users.find(function(e){return e.id===o.currentUser});if(t.author)return e.label?e.label:f()}return rt},f=function(){return t.author["@id"].replace(/.*[#\/]/,"... ")},h=function(){s(!a)};/*#__PURE__*/return e.createElement("div",{className:"comment-content",onMouseEnter:function(){c(!0)},onMouseLeave:function(){c(!1)}},/*#__PURE__*/e.createElement("div",{className:"row"},/*#__PURE__*/e.createElement("div",{className:"col-auto comment-author",onMouseEnter:h,onMouseLeave:h},/*#__PURE__*/e.createElement(e.Fragment,null,a?/*#__PURE__*/e.createElement(e.Fragment,null,d(),/*#__PURE__*/e.createElement(tt,{iconClassContainer:"emphasise-on-relevant-icon",url:t.author?Object.values(t.author).toString():rt})):d())),/*#__PURE__*/e.createElement("div",{className:"col-auto text-muted comment-timestamp"},/*#__PURE__*/e.createElement(Ze,{id:"exact-time-overlay",tooltipContent:(p=new Date(parseInt(t.timestamp)),new Intl.DateTimeFormat(o.intl.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}).format(p))},m.format(parseInt(t.timestamp)))),u?/*#__PURE__*/e.createElement(G.div,{className:"comment-delete emphasise-on-relevant-icon",whileHover:{scale:1.2},whileTap:{scale:.9},onClick:function(){t.onDeleteQuestionComment(t.index),t.onDeleteViewComment()}},/*#__PURE__*/e.createElement(ot,null)):null),/*#__PURE__*/e.createElement("div",{className:"row"},/*#__PURE__*/e.createElement("div",{className:"col comment-value"},t.commentValue)))};it.propTypes={author:s.object,timestamp:s.string.isRequired,commentValue:s.string.isRequired,onDeleteQuestionComment:s.func.isRequired,onDeleteViewComment:s.func,index:s.number.isRequired};var at=function(e){var t=e.comments,r=e.onDeleteCommentClick,a=i(null),s=n(!1),l=s[0],u=s[1],c=function(){u(!0),setTimeout(function(){u(!1)},2e3)};return o(function(){null!==a.current&&(a.current.scrollTop=a.current.scrollHeight)},[JSON.stringify(t)]),V("span",{children:l?M("div",{className:"comment-delete",children:[V(X,{color:"#00BFFF",height:80,width:80}),V("p",{children:"Deleting comment..."})]}):V("div",{className:"comment-list-items",ref:a,children:t.map(function(e,t){return V("div",{className:"comment-list-item",children:V(it,{commentValue:e[ae.HAS_COMMENT_VALUE],author:e[ae.HAS_AUTHOR]?e[ae.HAS_AUTHOR]:null,timestamp:e[ae.HAS_TIMESTAMP],onDeleteQuestionComment:r,onDeleteViewComment:c,index:t})},t)})})})},st=function(){/*#__PURE__*/return e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"15",height:"15",viewBox:"0 0 24 24"},/*#__PURE__*/e.createElement("path",{d:"M6.185 4.843l11.927 7.157-11.927 7.157 2.982-7.157-2.982-7.157zm-4.185-4.843l5 12-5 12 20-12-20-12z"}))},lt="300px",ut=function(t){var r=n(""),a=r[0],s=r[1],l=i(null),u=U();o(function(){l.current.focus()},[]);var c=function(e){e.preventDefault(),t.onChange(a),s("")},p=function(){var e=l.current;e.style.height="auto",d(e)},d=function(e){e.style.height=e.scrollHeight+"px",parseInt(e.style.height)>parseInt(lt)&&(e.style.height=lt)};/*#__PURE__*/return e.createElement(m,{onSubmit:c,onKeyUp:function(e){"Enter"===e.key&&e.ctrlKey&&a.trim()&&c(e)},onClick:function(e){e.stopPropagation()}},/*#__PURE__*/e.createElement(m.Group,{className:"m-2",controlId:"formBasicComment"},/*#__PURE__*/e.createElement(v,{className:"col-lg-12 p-0"},/*#__PURE__*/e.createElement(S,{className:"container-fluid p-0 m-0"},/*#__PURE__*/e.createElement("div",{id:"comment-form"},/*#__PURE__*/e.createElement(m.Control,{className:"comment-form-control",name:"comment",as:"textarea",placeholder:u.formatMessage({id:"comment.form.placeholder"}),required:!0,value:a,onChange:function(e){s(e.target.value)},ref:l,onKeyPress:p,onKeyDown:p}),/*#__PURE__*/e.createElement(A,{className:"comment-form-button",variant:"primary",type:"submit"},/*#__PURE__*/e.createElement(st,null)))))))};ut.propTypes={onChange:s.func.isRequired};var ct,pt=function(){/*#__PURE__*/return e.createElement("svg",{className:"close-icon",width:"24px",height:"24px",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},/*#__PURE__*/e.createElement("path",{d:"M13.41 12l4.3-4.29a1 1 0 1 0-1.42-1.42L12 10.59l-4.29-4.3a1 1 0 0 0-1.42 1.42l4.3 4.29-4.3 4.29a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l4.29-4.3 4.29 4.3a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42z"}))},mt=function(t){var a=r(ve),s=i(null),l=i(null),u=i(null),c=n(!1),p=c[0],m=c[1],d=n("right"),f=d[0],h=d[1];o(function(){C(u.current)});var v=function(){m(!1)},S=function(){var e=t.question;return e[ae.HAS_COMMENT]||(e[ae.HAS_COMMENT]=[]),Array.isArray(e[ae.HAS_COMMENT])||(e[ae.HAS_COMMENT]=[e[ae.HAS_COMMENT]]),e[ae.HAS_COMMENT]},A=function(e){var n={};T(n,e),t.onChange(O(),n)},T=function(e,t){a.options.currentUser&&(e[ae.HAS_AUTHOR]={"@id":a.options.currentUser}),e[ae.HAS_COMMENT_VALUE]=t,e[ae.HAS_TIMESTAMP]=Date.now().toString()},N=function(e){S().splice(e,1)},I=function(e){e.preventDefault(),e.stopPropagation()},O=function(){return S().length},C=function(e){e&&(e.getBoundingClientRect().x>window.innerWidth/2?h("left"):h("right"))};/*#__PURE__*/return e.createElement("div",{ref:u,onClick:I},/*#__PURE__*/e.createElement("span",{className:"comment-bubble",ref:s,onClick:function(e){I(e),m(!p)}},/*#__PURE__*/e.createElement(nt,null),O()>0?/*#__PURE__*/e.createElement(g,{className:"comment-badge",pill:!0,variant:"primary"},O()):null),/*#__PURE__*/e.createElement(G.div,{className:"overlay-comment",ref:l,drag:!0,dragConstraints:{top:-50,left:-50,right:50,bottom:50}},/*#__PURE__*/e.createElement(_,{target:s.current,show:p,placement:f,rootClose:!1,onHide:v,container:l},function(t){/*#__PURE__*/return e.createElement(E,Y({className:"comment-tooltip"},t),/*#__PURE__*/e.createElement("span",{onKeyDown:function(e){!function(e){"Escape"===e.key&&v()}(e)}},/*#__PURE__*/e.createElement(G.div,{className:"close-comment-icon",onClick:v,whileHover:{scale:1.1,transition:{duration:.1}}},/*#__PURE__*/e.createElement(pt,null)),/*#__PURE__*/e.createElement(at,{comments:S(),onDeleteCommentClick:N}),/*#__PURE__*/e.createElement(ut,{onChange:A})))})))};mt.propTypes={question:s.object.isRequired,onChange:s.func.isRequired};var dt=/*#__PURE__*/function(){function t(){}return t.renderIcons=function(t,n,o,r){var i;i=n.icons?n.icons:ae.DEFAULT_OPTIONS.icons;for(var a=[],s=this.renderQuestionHelp(t,n,o,r),l=this.renderQuestionComments(t,n,o,r),u=this.renderQuestionLink(t,n,o,r),c=0;c<i.length;c++)i[c].id===ae.ICONS.QUESTION_COMMENTS&&a.push(/*#__PURE__*/e.createElement("li",{key:c,className:"icon-list-item"},l)),i[c].id===ae.ICONS.QUESTION_HELP&&a.push(/*#__PURE__*/e.createElement("li",{key:c,className:"icon-list-item"},s)),i[c].id===ae.ICONS.QUESTION_LINK&&a.push(/*#__PURE__*/e.createElement("li",{key:c,className:"icon-list-item"},u));/*#__PURE__*/return e.createElement("ol",{className:"icon-list-items"},a)},t.renderQuestionHelp=function(e,t,n,o){return this.getIconComponentFromName(ae.ICONS.QUESTION_HELP,e,t,n,o)},t.renderQuestionLink=function(e,t,n,o){return this.getIconComponentFromName(ae.ICONS.QUESTION_LINK,e,t,n,o)},t.getIconComponentFromName=function(e,t,n,o,r){var i=this.getIconFromIconList(n.icons?n.icons:ae.DEFAULT_OPTIONS.icons,e);return this.getIconComponent(i,t,n,o,r)},t.getIconComponent=function(t,n,o,r,i){var a;if(t&&(t.behavior===ae.ICON_BEHAVIOR.ON_HOVER||t.behavior===ae.ICON_BEHAVIOR.ENABLE))return t.behavior===ae.ICON_BEHAVIOR.ENABLE?(i=!0,a=""):a="emphasise-on-relevant-icon",t.id===ae.ICONS.QUESTION_HELP&&n[ae.HELP_DESCRIPTION]?i?/*#__PURE__*/e.createElement("div",{className:a},/*#__PURE__*/e.createElement($e,{text:u.getLocalized(n[ae.HELP_DESCRIPTION],o.intl),absolutePosition:!1})):null:t.id===ae.ICONS.QUESTION_LINK&&n[ae.SOURCE]?i?/*#__PURE__*/e.createElement("div",{className:a},/*#__PURE__*/e.createElement(tt,{url:n[ae.SOURCE]})):null:t.id===ae.ICONS.QUESTION_COMMENTS&&i?/*#__PURE__*/e.createElement("div",{className:a},/*#__PURE__*/e.createElement(mt,{question:n,onChange:r})):null},t}();ct=dt,dt.renderQuestionComments=function(e,t,n,o){return ct.getIconComponentFromName(ae.ICONS.QUESTION_COMMENTS,e,t,n,o)},dt.getIconFromIconList=function(e,t){return e?e.find(function(e){return e.id===t}):null};var ft=function(t){var r=e.useContext(re),i=e.useContext(ve).options,a=n({severity:"",classname:"",message:null}),s=a[0],l=a[1];o(function(){f()},[t.question]);var c,p,m=function(e){var n=Object.assign({},t.answer);d(n,e),t.onChange(t.index,n)},d=function(e,n){null===n?(e[ae.HAS_OBJECT_VALUE]=null,e[ae.HAS_DATA_VALUE]=null):t.answer[ae.HAS_OBJECT_VALUE]||ce.isTypeahead(t.question)?e[ae.HAS_OBJECT_VALUE]={"@id":n}:e[ae.HAS_DATA_VALUE]={"@value":n}},f=function(){l({severity:"",classname:"",message:null}),!1===h[ae.HAS_VALID_ANSWER]&&l(h[ae.HAS_VALIDATION_SEVERITY]===ae.VALIDATION.SEVERITY.WARNING?{severity:ae.VALIDATION.SEVERITY.WARNING,classname:ae.VALIDATION.CLASSNAME.WARNING,message:/*#__PURE__*/e.createElement(T,{className:ae.VALIDATION.CLASSNAME.WARNING},h[ae.HAS_VALIDATION_MESSAGE])}:{severity:ae.VALIDATION.SEVERITY.ERROR,classname:ae.VALIDATION.CLASSNAME.ERROR,message:/*#__PURE__*/e.createElement(T,{className:ae.VALIDATION.CLASSNAME.ERROR},h[ae.HAS_VALIDATION_MESSAGE])})},h=t.question,E=ce.resolveValue(t.answer),v=function(n){var o=u.getLocalized(n[ae.RDFS_LABEL],i.intl);/*#__PURE__*/return e.createElement("div",{className:"question-header"},o,dt.renderIcons(t.question,i,t.onCommentChange,t.showIcon))}(h),S=u.getLocalized(h[ae.RDFS_COMMENT],i.intl);return c=ce.isTypeahead(h)?function(n,o,i){var a=se.getStringHash(ce.getPossibleValuesQuery(t.question)),l=r.getOptions(a)||[];/*#__PURE__*/return e.createElement(Ge,{question:t.question,answer:t.answer,label:o,title:i,value:n,onChange:m,options:l,validation:s})}(E,v,S):(p=h)[ae.HAS_OPTION]&&0!==p[ae.HAS_OPTION].length?function(n,o,r){/*#__PURE__*/return e.createElement(Be,{question:t.question,label:o,title:r,value:n,onChange:m,validation:s})}(E,v,S):ce.isCalendar(h)?function(n,o,r){/*#__PURE__*/return e.createElement(Ve,{question:t.question,value:n,title:r,label:o,onChange:m,validation:s})}(E,v,S):ce.isCheckbox(h)?function(n,o,r){/*#__PURE__*/return e.createElement(De,{label:o,title:r,value:n,onChange:m,question:t.question,validation:s})}(E,v,S):ce.isMaskedInput(h)?function(n,o,r){/*#__PURE__*/return e.createElement(Fe,{label:o,title:r,value:n,onChange:m,question:t.question,answer:t.answer,validation:s})}(E,v,S):ce.isSparqlInput(h)?function(n,o,r){/*#__PURE__*/return e.createElement(Pe,{question:t.question,answer:t.answer,label:o,title:r,value:n,onChange:m,sparql:!0,validation:s})}(E,v,S):ce.isTurtleInput(h)?function(n,o,r){/*#__PURE__*/return e.createElement(Pe,{question:t.question,answer:t.answer,label:o,title:r,value:n,onChange:m,turtle:!0,validation:s})}(E,v,S):function(n,o,r){/*#__PURE__*/return e.createElement(Pe,{question:t.question,answer:t.answer,label:o,title:r,value:n,onChange:m,validation:s})}(E,v,S),c};ft.propTypes={answer:s.object.isRequired,question:s.object.isRequired,onChange:s.func.isRequired,onCommentChange:s.func.isRequired,index:s.number,icons:s.object};var ht=function(e,t){var n=[Tt,_t,vt,At,St,gt];return function(){if(ce.hasValidationLogic(e,t)){var o=ce.getAnswerValue(e);return Et(e,t,o,n)}}},Et=function(e,t,n,o){for(var r,i={},a=ee(o);!(r=a()).done;){var s=(0,r.value)(e,t);if(!s.isValid)return i[ae.HAS_VALID_ANSWER]=!1,i[ae.HAS_VALIDATION_MESSAGE]=s.message,i[ae.HAS_VALIDATION_SEVERITY]=s.validationSeverity,i;if(!1===i[ae.HAS_VALID_ANSWER])break}return i[ae.HAS_VALID_ANSWER]=!0,i[ae.HAS_VALIDATION_MESSAGE]="",i[ae.HAS_VALIDATION_SEVERITY]="",i},vt=function(e,t){var n=ce.getAnswerValue(e);return n&&n.length>0&&e[ae.PATTERN]&&!new RegExp(e[ae.PATTERN]).test(n)&&ce.hasAnswer(e)?{isValid:!1,validationSeverity:ae.VALIDATION.SEVERITY.ERROR,message:e[ae.HAS_VALIDATION_MESSAGE]?e[ae.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.invalid"})}:{isValid:!0}},St=function(e,t){return!e[ae.REQUIRES_ANSWER]||e[ae.USED_ONLY_FOR_COMPLETENESS]||ce.hasAnswer(e)?{isValid:!0}:{isValid:!1,validationSeverity:ae.VALIDATION.SEVERITY.ERROR,message:e[ae.HAS_VALIDATION_MESSAGE]?e[ae.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.required"})}},At=function(e,t){return ce.isCheckbox(e)&&e[ae.REQUIRES_ANSWER]&&!ce.hasAnswer(e)?{isValid:!1,validationSeverity:ae.VALIDATION.SEVERITY.ERROR,message:e[ae.HAS_VALIDATION_MESSAGE]?e[ae.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.check"})}:{isValid:!0}},gt=function(e,t){return e[ae.REQUIRES_ANSWER]&&e[ae.USED_ONLY_FOR_COMPLETENESS]&&!ce.hasAnswer(e)?{isValid:!1,validationSeverity:ae.VALIDATION.SEVERITY.WARNING,message:e[ae.HAS_VALIDATION_MESSAGE]?e[ae.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.required_only_for_completeness"})}:{isValid:!0}},_t=function(e,t){if(e[ae.XSD.MIN_INCLUSIVE]){var n=ce.getAnswerValue(e);if(n&&n.length>0){var o=e[ae.XSD.MIN_INCLUSIVE];if(!(Number.isInteger(parseInt(n))&&n>=o))return{isValid:!1,validationSeverity:ae.VALIDATION.SEVERITY.ERROR,message:e[ae.HAS_VALIDATION_MESSAGE]?e[ae.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.greater_or_equal"})+o+"."}}}return{isValid:!0}},Tt=function(e,t){var n=ce.getAnswerValue(e);if(e[ae.XSD.MAX_INCLUSIVE]&&n&&n.length>0){var o=e[ae.XSD.MAX_INCLUSIVE];if(!(Number.isInteger(parseInt(n))&&n<=o))return{isValid:!1,validationSeverity:ae.VALIDATION.SEVERITY.ERROR,message:e[ae.HAS_VALIDATION_MESSAGE]?e[ae.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.lower_or_equal"})+o+"."}}return{isValid:!0}},Nt=/*#__PURE__*/function(t){function n(e){var n;return(n=t.call(this,e)||this).state={prefixes:e.prefixes},n}return K(n,t),n.prototype.render=function(){var t=/*#__PURE__*/e.createElement(N,{id:"prefixes",title:"Prefixes"},/*#__PURE__*/e.createElement(I,null,this.state.prefixes.sort(function(e,t){return e[ae.PREFIX]<t[ae.PREFIX]?-1:1}).map(function(t){/*#__PURE__*/return e.createElement(O,{key:t[ae.PREFIX]},/*#__PURE__*/e.createElement("strong",null,t[ae.PREFIX]),": ",t[ae.NAMESPACE])})));/*#__PURE__*/return e.createElement(h,{trigger:"click",placement:"right",overlay:t},/*#__PURE__*/e.createElement("span",{className:this.props.iconClass},this.props.children))},n}(e.Component);Nt.propTypes={prefixes:s.array.isRequired,children:s.element.isRequired,iconClass:s.string},Nt.defaultProps={iconClass:""};var It=function(e){var t;return(t=e.question[ae.HAS_MEDIA_CONTENT])?Array.isArray(t)?V("div",{className:"col-6",children:t.map(function(e,n){return V("div",{className:"row embed-responsive-21by9 media-content-video-container mb-3",children:V("iframe",{src:t[n],className:"embed-responsive-item",allowFullScreen:!0})},n)})}):V("div",{className:"col-6",children:V("iframe",{src:t,className:"embed-responsive-item",allowFullScreen:!0})}):null},Ot=/*#__PURE__*/function(t){function n(e){var o;return(o=t.call(this,e)||this).handleAnswerChange=function(e,t){if(ce.isSection(o.props.question)){var n=!!ce.resolveValue(t);o.setState({expanded:n})}o._handleChange(ae.HAS_ANSWER,e,t)},o.handleSubQuestionChange=function(e,t){o._handleChange(ae.HAS_SUBQUESTION,e,t)},o.handleCommentChange=function(e,t){o._handleChange(ae.HAS_COMMENT,e,t)},o._toggleCollapse=function(){o.props.collapsible&&o.setState({expanded:!o.state.expanded})},o._onMouseEnterHandler=function(){o.setState({showIcon:!0})},o._onMouseLeaveHandler=function(){o.setState({showIcon:!1})},o._getHeaderClassName=function(){var e=o.props.question,t=o.props.collapsible,r=[];return r.push(n.getEmphasizedOnRelevantClass(e),"question-header"),ce.isWizardStep(e)&&r.push("wizard-step bg-primary text-white"),ce.isEmphasised(e)&&r.push(n.getEmphasizedClass(e)),ce.isSection(e)&&r.push("section-background"),t&&r.push("cursor-pointer"),o.isDebugged(e)&&r.push("show-irrelevant"),r},le.putObject(e.question["@id"],e.question),o.state={validator:{},expanded:!ce.isCollapsed(e.question),showIcon:!1},o}K(n,t);var o=n.prototype;return o.componentDidMount=function(){this.setState({validator:ht(this.props.question,this.props.intl)})},o.componentDidUpdate=function(){var e=this.props.question,t=this.context.options.startingQuestionId,n=e[ae.HAS_SUBQUESTION].find(function(e){return e["@id"]===t});if(ce.isSection(e)&&ce.isAnswerable(e)){var o=this._getFirstAnswerValue();if(this.context.options.debugMode)return null;if(n)return null;this.state.expanded&&!o&&this.setState({expanded:!1})}},o._handleChange=function(e,t,n){var o=Object.assign({},this.props.question);if(o[e][t]=n,e===ae.HAS_ANSWER){var r=this.state.validator(n);o=Object.assign({},o,r)}le.putObject(o["@id"],o),this.props.onChange(this.props.index,o)},o.isDebugged=function(e){var t=this.context.options.startingQuestionId;return!ce.isRelevant(e)&&(!!this.context.options.debugMode||null!=t&&!!se.findQuestionById(t,e,!0,!1,!1))},o.render=function(){var t=this.props.question,n=this.renderQuestion(t);return this.isDebugged(t)?/*#__PURE__*/e.createElement("div",{className:"show-irrelevant"},n):ce.isHidden(t)?null:ce.isRelevant(t)?n:null},o.renderQuestion=function(t){if(ce.isAnswerable(t)&&!ce.isSection(t))/*#__PURE__*/return e.createElement("div",{id:t["@id"]},/*#__PURE__*/e.createElement("div",{className:"panel-title answerable-question"},this.renderAnswers()),/*#__PURE__*/e.createElement("div",{className:"answerable-subquestions"},this.renderSubQuestions()));if(ce.isAnswerable(t))return this.renderAnswerableSection();if(ce.isSection(t)){var o=this.props,r=o.collapsible,i=o.withoutCard,a=n._getQuestionCategoryClass(t);if(i)/*#__PURE__*/return e.createElement("div",null,this._renderQuestionContent());var s=u.getLocalized(t[u.RDFS_LABEL],this.context.options.intl),l=/*#__PURE__*/e.createElement(C.Body,{className:q("p-3",a)},this._renderQuestionContent());/*#__PURE__*/return e.createElement(e.Fragment,null,/*#__PURE__*/e.createElement(b,{defaultActiveKey:this.state.expanded?void 0:s},/*#__PURE__*/e.createElement(C,{className:"mb-3"},/*#__PURE__*/e.createElement(b.Toggle,{as:C.Header,onClick:this._toggleCollapse,className:this._getHeaderClassName(),onMouseEnter:this._onMouseEnterHandler,onMouseLeave:this._onMouseLeaveHandler},/*#__PURE__*/e.createElement("h6",{className:"d-inline",id:t["@id"]},r&&!ce.isWizardStep(t)&&this._renderCollapseToggle(),s),this.renderQuestionIcons(),this.props.children),/*#__PURE__*/e.createElement(r?b.Collapse:e.Fragment,null,l))))}/*#__PURE__*/return e.createElement("div",null,this._renderQuestionContent())},o._renderQuestionContent=function(){var t=[];return this.state.expanded&&t.push(/*#__PURE__*/e.createElement(It,{key:this.props.question["@id"]+"-media",question:this.props.question})),t.push(this.renderAnswers()),t.push(this.renderSubQuestions()),t},o.renderQuestionIcons=function(){return dt.renderIcons(this.props.question,this.context.options,this.handleCommentChange,this.state.showIcon)},o.renderAnswerableSection=function(){var t=this.props.question,o=this.props.collapsible,r=n._getQuestionCategoryClass(t),i=this.getShowIrrelevantClassname(t),a=/*#__PURE__*/e.createElement(C.Body,{className:q("p-3",r)},this.renderSubQuestions(i));/*#__PURE__*/return e.createElement(b,{activeKey:this.state.expanded?t["@id"]:void 0,className:"answerable-section"},/*#__PURE__*/e.createElement(C,{className:"mb-3"},/*#__PURE__*/e.createElement(C.Header,{onClick:this._toggleCollapse,className:this._getHeaderClassName()},this.renderAnswers()),o?/*#__PURE__*/e.createElement(b.Collapse,{className:i,eventKey:t["@id"]},a):{cardBody:a}))},o.getShowIrrelevantClassname=function(e){return!this.context.options.debugMode&&!ue.checkId(e[ae.HAS_SUBQUESTION],this.context.options.startingQuestionId)||ce.hasAnswer(e)?"":"show-irrelevant"},o.renderAnswers=function(){for(var t,o=this.props.question,r=[],i=this._getAnswers(),a=0,s=i.length;a<s;a++)ce.isTextarea(o,ce.resolveValue(i[a]))||ce.isSparqlInput(o)||ce.isTurtleInput(o),t=q("answer",n._getQuestionCategoryClass(o),n.getEmphasizedOnRelevantClass(o)),r.push(/*#__PURE__*/e.createElement("div",{key:"row-item-"+a,className:t,id:o["@id"],onMouseEnter:this._onMouseEnterHandler,onMouseLeave:this._onMouseLeaveHandler},/*#__PURE__*/e.createElement("div",{className:"answer-content",style:this._getAnswerWidthStyle()},/*#__PURE__*/e.createElement(ft,{index:a,answer:i[a],question:o,onChange:this.handleAnswerChange,onCommentChange:this.handleCommentChange,showIcon:this.state.showIcon})),this._renderUnits(),this._renderPrefixes()));return r},o._getAnswers=function(){var e=this.props.question;return e[ae.HAS_ANSWER]||(e[ae.HAS_ANSWER]=[]),Array.isArray(e[ae.HAS_ANSWER])||(e[ae.HAS_ANSWER]=[e[ae.HAS_ANSWER]]),0===e[ae.HAS_ANSWER].length&&(e[ae.HAS_ANSWER]=ce.isSection(e)&&!ce.isAnswerable(e)?[]:[Le.generateAnswer(e)]),e[ae.HAS_ANSWER]},o._getAnswerWidthStyle=function(){var e=Number(this.props.question[ae.HAS_INITIAL_INPUT_LENGTH]);return e?{flexGrow:0,maxWidth:"none",width:"calc("+e+"ch + 1.5rem + 2px)"}:{}},n._getAnswerClass=function(e,t){return t?"col-12":1===ae.GENERATED_ROW_SIZE?"col-6":"col-"+ae.COLUMN_COUNT/ae.GENERATED_ROW_SIZE},n._getQuestionCategoryClass=function(e){var t=ce.getCategory(e);return t?"question-"+t:""},n.getEmphasizedClass=function(e){return ce.isEmphasised(e)?"bg-warning":""},n.getEmphasizedOnRelevantClass=function(e){return u.hasValue(e,ae.LAYOUT_CLASS,ae.LAYOUT.EMPHASISE_ON_RELEVANT)?"emphasise-on-relevant":""},o._renderCollapseToggle=function(){var t=this.props.intl.formatMessage(this.state.expanded?{id:"section.collapse"}:{id:"section.expand"});/*#__PURE__*/return e.createElement("span",{onClick:this._toggleCollapse,title:t},/*#__PURE__*/e.createElement(this.state.expanded?Xe:Ye,{title:t}))},o._renderPrefixes=function(){var t=this.props.question;return t[ae.HAS_DECLARED_PREFIX]&&t[ae.HAS_DECLARED_PREFIX].length?/*#__PURE__*/e.createElement(Nt,{prefixes:t[ae.HAS_DECLARED_PREFIX],iconClass:"help-icon-checkbox"},/*#__PURE__*/e.createElement(Ke,null)):null},o._renderUnits=function(){var t=this.props.question;return t[ae.HAS_UNIT]?/*#__PURE__*/e.createElement("div",{className:"has-unit-label"},t[ae.HAS_UNIT]):null},o.renderSubQuestions=function(t){for(var o=[],r=this._getSubQuestions(),i=this.context.options.debugMode,a=this.context.options.startingQuestionId,s=0;s<r.length;s++){var l=r[s],u=this.context.mapComponent(l,n),c=null;(i||"show-irrelevant"!==t||se.findQuestionById(a,l,!0,!1,!1))&&(c=/*#__PURE__*/e.createElement(u,{key:"sub-question-"+s,question:l,onChange:this.handleSubQuestionChange,index:s,intl:this.props.intl})),o.push(c)}return o},o._getSubQuestions=function(){var e=this.props.question;return e[ae.HAS_SUBQUESTION]||(e[ae.HAS_SUBQUESTION]=[]),Array.isArray(e[ae.HAS_SUBQUESTION])||(e[ae.HAS_SUBQUESTION]=[e[ae.HAS_SUBQUESTION]]),ue.orderByLocalizedLabels(e[ae.HAS_SUBQUESTION],this.context.options.intl),ue.orderPreservingToplogicalSort(e[ae.HAS_SUBQUESTION],ae.HAS_PRECEDING_QUESTION),e[ae.HAS_SUBQUESTION]},o._getFirstAnswerValue=function(){return ce.resolveValue(this._getAnswers()[0])},n}(e.Component);Ot.contextType=ve,Ot.propTypes={question:s.object.isRequired,onChange:s.func.isRequired,index:s.number,withoutCard:s.bool,collapsible:s.bool},Ot.defaultProps={withoutCard:!1,collapsible:!0};var Ct=function(t){var n=r(de),o=n.updateFormQuestionsData,i=n.getFormQuestionsData,a=U(),s=i([t.index]);/*#__PURE__*/return e.createElement(e.Fragment,null,/*#__PURE__*/e.createElement(Ot,{question:s,onChange:function(e,n){o(t.index||e,Object.assign({},t.question,n))},collapsible:ce.isAnswerable(s),intl:a}),t.options.wizardStepButtons&&/*#__PURE__*/e.createElement(R,{className:"m-3 float-right"},!t.isFirstStep&&/*#__PURE__*/e.createElement(A,{className:"mr-2",onClick:function(){t.onPreviousStep()},variant:"primary",size:"sm"},a.formatMessage({id:"wizard.previous"})),!t.isLastStep&&/*#__PURE__*/e.createElement(A,{onClick:function(){o(t.index,i()),t.onNextStep()},variant:"primary",size:"sm"},a.formatMessage({id:"wizard.next"}))))};Ct.propTypes={options:s.object.isRequired,question:s.object.isRequired,index:s.number.isRequired,onNextStep:s.func,onPreviousStep:s.func,mapComponent:s.func,isFirstStep:s.bool,isLastStep:s.bool};var bt=function(t){var n=t.steps,o=t.onNavigate,i=t.currentStep,a=r(ve).options,s=U();/*#__PURE__*/return e.createElement(C.Header,null,/*#__PURE__*/e.createElement(y,{variant:"tabs",activeKey:i,onSelect:function(e){return o(parseInt(e))}},n.map(function(t,n){/*#__PURE__*/return e.createElement(Ze,{id:"step-disabled",tooltipContent:s.formatMessage({id:"wizard.nav.tooltip"}),show:!a.enableWizardStepSkip},/*#__PURE__*/e.createElement(w,{key:"nav"+n,id:"wizard-nav-"+n},/*#__PURE__*/e.createElement(L,{eventKey:n,active:n===i?"active":"",hidden:!a.debugMode&&!ce.isRelevant(t),disabled:!a.enableWizardStepSkip,className:q([a.debugMode&&!ce.isRelevant(t)?"show-irrelevant":Ot.getEmphasizedClass(t),"wizard-nav"])},u.getLocalized(t[u.RDFS_LABEL],a.intl))))})))};bt.propTypes={currentStep:s.number.isRequired,steps:s.array.isRequired,onNavigate:s.func.isRequired};var Rt=function(t){var n=t.steps,o=t.onNavigate,i=t.currentStep,a=r(ve).options,s=U();/*#__PURE__*/return e.createElement("div",{className:"wizard-nav col-2 p-0"},/*#__PURE__*/e.createElement(I,null,n.map(function(t,n){/*#__PURE__*/return e.createElement(Ze,{id:"step-disabled",tooltipContent:s.formatMessage({id:"wizard.nav.tooltip"}),show:!a.enableWizardStepSkip},/*#__PURE__*/e.createElement(O,{hidden:!a.debugMode&&!ce.isRelevant(t),key:"nav"+n,onClick:function(){return o(n)},id:"wizard-nav-"+n,action:!0,active:n===i?"active":"",disabled:!a.enableWizardStepSkip,variant:"default",className:q([a.debugMode&&!ce.isRelevant(t)?"show-irrelevant":Ot.getEmphasizedClass(t),"wizard-nav"])},u.getLocalized(t[u.RDFS_LABEL],a.intl)))})))};Rt.propTypes={currentStep:s.number.isRequired,steps:s.array.isRequired,onNavigate:s.func.isRequired};var yt,wt=function(e,t){var n=function e(n,o){return n?n["@id"]===t?o:se.asArray(n[ae.HAS_SUBQUESTION]).findIndex(function(t,n){return-1!==e(t,n)}):-1};return e.findIndex(function(e,t){return-1!==n(e,t)})},Lt=function(){var t=e.useContext(de),n=e.useContext(ve),r=n.options,i=n.mapComponent,a=0;r.startingQuestionId?-1===(a=wt(t.getFormQuestionsData(),r.startingQuestionId))&&(console.warn("Question with id "+r.startingQuestionId+" not found!"),a=0):r.startingStep&&(a=r.startingStep<t.getFormQuestionsData().length?r.startingStep:0);var s=e.useState(a),l=s[0],u=s[1],c=e.useState(!1),p=c[0],m=c[1];o(function(){if(r.startingQuestionId&&!p){var e=document.getElementById(r.startingQuestionId);e&&(e.scrollIntoView(),e.classList.add("text-danger"),m(!0))}});var d,f=null;t.getFormQuestionsData().length>1&&(d=t.getFormQuestionsData(),f=/*#__PURE__*/e.createElement(r.horizontalWizardNav?bt:Rt,{currentStep:l,steps:d,onNavigate:function(e){var n=t.getFormQuestionsData();e===l||e>=n.length||e>l&&!n[e].visited&&!r.enableWizardStepSkip||u(e)}}));var h,E,v=r.horizontalWizardNav;/*#__PURE__*/return e.createElement(C,{className:v?"":"flex-row p-3"},f,/*#__PURE__*/e.createElement("div",{className:v?"card-body p-3":f?"col-10 p-0 pl-3":"col-12 p-0"},(E=i(h=t.getFormQuestionsData()[l],Ct),/*#__PURE__*/e.createElement(E,{options:r,key:"step"+l,question:h,onNextStep:function(){var e=t.getFormQuestionsData();l!==e.length-1&&(e[l+1].visited=!0,u(function(e){return e+1}))},onPreviousStep:function(){0!==l&&u(function(e){return e-1})},mapComponent:i,index:l,isFirstStep:0===l,isLastStep:l===t.getFormQuestionsData().length-1}))))},Dt=/*#__PURE__*/e.forwardRef(function(t,n){var o=e.useContext(ve).options;/*#__PURE__*/return e.createElement(D,Y({size:"xl",animation:!0},o.modalProps),/*#__PURE__*/e.createElement(D.Header,{closeButton:!0},/*#__PURE__*/e.createElement(D.Title,null,o.modalProps.title)),/*#__PURE__*/e.createElement(D.Body,{className:"overflow-hidden p-0"},t.children))});Dt.propTypes={children:s.element.isRequired};var Vt=function(){};yt=Vt,Vt.updateQuestionValidation=function(e,t,n,o){if(t[ae.HAS_ANSWER]){var r=ht(t,o)();r&&(e[n]=Object.assign({},t,r))}for(var i,a=ee(e);!(i=a()).done;)yt.updateSubQuestionsValidation(i.value,o)},Vt.updateSubQuestionsValidation=function(e,t){for(var n=se.asArray(e[ae.HAS_SUBQUESTION]),o=0;o<n.length;o++)yt.updateQuestionValidation(n,n[o],o,t)};var Mt=function(t){var n=r(de),o=n.getFormQuestionsData,i=n.updateFormQuestionsData,a=U(),s=function(){var t=o();/*#__PURE__*/return e.createElement(C,{className:"p-3"},t.map(function(e,t){return l(e,t)}))},l=function(n,o){var r=t.mapComponent(n,Ot);/*#__PURE__*/return e.createElement(r,{key:n["@id"],question:n,onChange:function(e,t){return function(e,t,n){i(t,Object.assign({},e,n))}(n,e,t)},index:o,intl:a})},u=t.modalView,c=o();if(!c.length)/*#__PURE__*/return e.createElement(C,{className:"p-3 font-italic"},"There are no questions available...");var p=c.every(function(e){return!ce.isWizardStep(e)});return u?/*#__PURE__*/e.createElement(Dt,null,p?s():/*#__PURE__*/e.createElement(Lt,null)):p?s():/*#__PURE__*/e.createElement(Lt,null)},Ht=/*#__PURE__*/a(function(t,r){var i=n(!0),a=i[0],s=i[1],l=n(null),u=l[0],c=l[1],p=n(null),m=p[0],d=p[1];if(o(function(){!function(){try{return Promise.resolve(we.constructForm(t.form,t.options.intl)).then(function(e){var t=e[0],n=e[1];t.formQuestions.some(function(e){return ce.isWizardStep(e)})&&(t.formQuestions[0].visited=!0),c(t),d(n),s(!1)})}catch(e){return Promise.reject(e)}}()},[t.form]),a)return t.loader||/*#__PURE__*/e.createElement(C,{className:"p-3 font-italic"},"Loading SForms...");var f=function(e,t){return function(n,o){if(!e)return o;for(var r,i=ee(e);!(r=i()).done;){var a=r.value,s=a.component;if((0,a.mapRule)(n,t))return s}return o}}(t.componentMapRules,m);/*#__PURE__*/return e.createElement(Ae,{components:t.components,componentsOptions:t.componentsOptions,mapComponent:f,options:t.options},/*#__PURE__*/e.createElement(Oe,{locale:t.options.intl.locale},/*#__PURE__*/e.createElement(ie,{fetchTypeAheadValues:t.fetchTypeAheadValues},/*#__PURE__*/e.createElement(fe,{data:m,formQuestions:u.formQuestions,isFormValid:t.isFormValid},/*#__PURE__*/e.createElement(Mt,{ref:r,modalView:t.options&&t.options.modalView,mapComponent:f})))))});Ht.propTypes={form:s.object.isRequired,options:s.object.isRequired,componentMapRules:s.array,components:s.object,componentsOptions:s.object,fetchTypeAheadValues:s.func,isFormValid:s.func,loader:s.element};export{ft as Answer,ve as ConfigurationContext,ae as Constants,de as FormQuestionsContext,ce as FormUtils,$e as HelpIcon,Oe as IntlContextProvider,ye as JsonLdFramingUtils,le as JsonLdObjectMap,ue as JsonLdObjectUtils,Ot as Question,dt as QuestionStatic,Ct as WizardStep,Ht as default};
2
2
  //# sourceMappingURL=s-forms.js.map