@kbss-cvut/s-forms 0.7.2 → 0.7.3-alpha-093b173.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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,useImperativeHandle as s}from"react";import l from"prop-types";import"core-js/modules/es.object.assign.js";import*as u 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 c from"jsonld-utils";import"core-js/modules/es.array.sort.js";import p from"@kbss-cvut/tsort";import"core-js/modules/es.number.constructor.js";import"core-js/modules/es.number.max-safe-integer.js";import m from"react-dom";import{Form as d,FormGroup as f,FormControl as h,OverlayTrigger as E,Tooltip as v,Col as S,Row as A,Button as g,Badge as _,Overlay as T,FormText as N,Popover as I,ListGroup as O,ListGroupItem as C,Card as b,Accordion as R,ButtonToolbar as y,Nav as w,NavItem as L,NavLink as D,Modal as V}from"react-bootstrap";import{jsx as M,jsxs as H}from"react/jsx-runtime";import{IntlProvider as U,useIntl as j}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 P from"react-datepicker";import{parse as x,format as q}from"date-fns";import F 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 Q from"yasgui-yasqe";import"@triply/yasgui/build/yasgui.min.css";import"core-js/modules/web.timers.js";import k from"inputmask-core";import{IntelligentTreeSelect as z}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 B from"javascript-time-ago";import W from"javascript-time-ago/locale/en";import X from"javascript-time-ago/locale/cs";import{motion as G}from"framer-motion";import{Rings as Y}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 K(){return K=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},K.apply(this,arguments)}function J(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Z(e,t)}function Z(e,t){return Z=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Z(e,t)}function $(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 ee(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 te(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 ee(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)?ee(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 ne,oe=/*#__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}(),re=["children"],ie=/*#__PURE__*/e.createContext({}),ae=function(n){var o=n.children,r=$(n,re),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?u.frame(t,{},{}).then(function(t){var n,o=t["@graph"];return i.push(Object.assign({},o,((n={})[e]=o,n))),o}):(oe.warn("No data received when loading options using id "+e),[])})}catch(e){return Promise.reject(e)}},s=function(e){return i[e]||[]},l=t(function(){return{loadFormOptions:a,getOptions:s}},[a,s]);/*#__PURE__*/return e.createElement(ie.Provider,K({value:l},r),o)};ae.propTypes={children:l.element.isRequired,fetchTypeAheadValues:l.func};var se=function(){};ne=se,se.COLUMN_COUNT=12,se.INPUT_LENGTH_THRESHOLD=50,se.DATETIME_NUMBER_FORMAT="x",se.FORM="http://onto.fel.cvut.cz/ontologies/documentation/form",se.HAS_SUBQUESTION="http://onto.fel.cvut.cz/ontologies/documentation/has_related_question",se.HAS_ANSWER="http://onto.fel.cvut.cz/ontologies/documentation/has_answer",se.HAS_OPTION="http://onto.fel.cvut.cz/ontologies/form/has-possible-value",se.HAS_OPTIONS_QUERY="http://onto.fel.cvut.cz/ontologies/form/has-possible-values-query",se.HAS_VALUE_TYPE="http://onto.fel.cvut.cz/ontologies/form/has-value-type",se.IS_DISABLED="http://onto.fel.cvut.cz/ontologies/aviation/form-376/is-disabled",se.INPUT_MASK="http://onto.fel.cvut.cz/ontologies/form/has-input-mask",se.LAYOUT_CLASS="http://onto.fel.cvut.cz/ontologies/form-layout/has-layout-class",se.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"]},se.HAS_INITIAL_INPUT_LENGTH="http://onto.fel.cvut.cz/ontologies/form-layout/has-initial-input-length",se.VALUE_TYPE_CODE="code",se.VALUE_TYPE_TEXT="text",se.GENERATED_ROW_SIZE=1,se.HAS_QUESTION_ORIGIN="http://onto.fel.cvut.cz/ontologies/form/has-question-origin",se.HAS_ANSWER_ORIGIN="http://onto.fel.cvut.cz/ontologies/form/has-answer-origin",se.HAS_DATA_VALUE="http://onto.fel.cvut.cz/ontologies/documentation/has_data_value",se.HAS_OBJECT_VALUE="http://onto.fel.cvut.cz/ontologies/documentation/has_object_value",se.HELP_DESCRIPTION="http://purl.org/dc/elements/1.1/description",se.SOURCE="http://purl.org/dc/elements/1.1/source",se.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"},se.STEP="http://onto.fel.cvut.cz/ontologies/form/step",se.PATTERN="http://onto.fel.cvut.cz/ontologies/form/pattern",se.ACCEPTS_ANSWER_VALUE="http://onto.fel.cvut.cz/ontologies/form/accepts-answer-value",se.ACCEPTS="http://onto.fel.cvut.cz/ontologies/form/accepts",se.HAS_DATATYPE="http://onto.fel.cvut.cz/ontologies/form/has-datatype",se.HAS_LAYOUT_CLASS="http://onto.fel.cvut.cz/ontologies/form/has-layout-class",se.HAS_POSSIBLE_VALUES_QUERY="http://onto.fel.cvut.cz/ontologies/form/has-possible-values-query",se.HAS_REQUIRED_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-required-value",se.HAS_TESTED_QUESTION="http://onto.fel.cvut.cz/ontologies/form/has-tested-question",se.HAS_TESTED_FORM="http://onto.fel.cvut.cz/ontologies/form/has-tested-form",se.HAS_UNIT="http://onto.fel.cvut.cz/ontologies/form/has-unit",se.HAS_VALID_ANSWER="http://onto.fel.cvut.cz/ontologies/form/has-valid-answer",se.IS_RELEVANT_IF="http://onto.fel.cvut.cz/ontologies/form/is-relevant-if",se.ACCEPTS_VALIDATION_VALUE="http://onto.fel.cvut.cz/ontologies/form/accepts-validation-value",se.HAS_VALIDATION_MESSAGE="http://onto.fel.cvut.cz/ontologies/form/has-validation-message",se.NEGATIVE_CONDITION="http://onto.fel.cvut.cz/ontologies/form/negative-condition",se.REQUIRES_ANSWER="http://onto.fel.cvut.cz/ontologies/form/requires-answer",se.USED_ONLY_FOR_COMPLETENESS="http://onto.fel.cvut.cz/ontologies/form/used-only-for-completeness",se.REQUIRES_ANSWER_DESCRIPTION_IF="http://onto.fel.cvut.cz/ontologies/form/requires-answer-description-if",se.REQUIRES_ANSWER_IF="http://onto.fel.cvut.cz/ontologies/form/requires-answer-if",se.HAS_PRECEDING_QUESTION="http://onto.fel.cvut.cz/ontologies/form/has-preceding-question",se.HAS_PRECEDING_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-preceding-value",se.HAS_MEDIA_CONTENT="http://onto.fel.cvut.cz/ontologies/form/has-media-content",se.CONDITION="http://onto.fel.cvut.cz/ontologies/form/condition",se.OR_CONDITION="http://onto.fel.cvut.cz/ontologies/form/or-condition",se.HAS_SUB_CONDITION="http://onto.fel.cvut.cz/ontologies/form/has-sub-condition",se.HAS_PATTERN="http://onto.fel.cvut.cz/ontologies/form-lt/has-pattern",se.HAS_DECLARED_PREFIX="http://onto.fel.cvut.cz/ontologies/form-spin/has-declared-prefix",se.PREFIX="http://www.w3.org/ns/shacl#prefix",se.NAMESPACE="http://www.w3.org/ns/shacl#namespace",se.HAS_COMMENT="http://onto.fel.cvut.cz/ontologies/form/has-comment",se.HAS_COMMENT_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-comment-value",se.HAS_AUTHOR="http://onto.fel.cvut.cz/ontologies/form/has-author",se.HAS_TIMESTAMP="http://onto.fel.cvut.cz/ontologies/form/has-timestamp",se.TIME_FORMAT="http://onto.fel.cvut.cz/ontologies/form/time-format",se.DATE_FORMAT="http://onto.fel.cvut.cz/ontologies/form/date-format",se.DATETIME_FORMAT="http://onto.fel.cvut.cz/ontologies/form/datetime-format",se.NOT_ANSWERED_QUESTION="http://onto.fel.cvut.cz/ontologies/form/not-answered-question",se.ANSWERED_QUESTION="http://onto.fel.cvut.cz/ontologies/form/answered-question",se.HAS_VALIDATION_SEVERITY="http://onto.fel.cvut.cz/ontologies/form/has-validation-severity",se.RDFS_LABEL=c.RDFS_LABEL,se.RDFS_COMMENT=c.RDFS_COMMENT,se.DEFAULT_HAS_CHILD=c.DEFAULT_HAS_CHILD,se.BROADER="http://www.w3.org/2004/02/skos/core#broader",se.HAS_NON_SELECTABLE_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-non-selectable-value",se.PROVIDES_DEREFERENCEABLE_ANSWER_VALUES="http://onto.fel.cvut.cz/ontologies/form/provides-dereferenceable-answer-values",se.ICONS={QUESTION_COMMENTS:"questionComments",QUESTION_HELP:"questionHelp",QUESTION_LINK:"questionLink"},se.ICON_BEHAVIOR={ENABLE:"enable",DISABLE:"disable",ON_HOVER:"onHover"},se.DEFAULT_OPTIONS={icons:[{id:ne.ICONS.QUESTION_HELP,behavior:ne.ICON_BEHAVIOR.ENABLE},{id:ne.ICONS.QUESTION_COMMENTS,behavior:ne.ICON_BEHAVIOR.ON_HOVER},{id:ne.ICONS.QUESTION_LINK,behavior:ne.ICON_BEHAVIOR.ON_HOVER}]},se.LANG={cs:{locale:"cs",label:"Čestina"},en:{locale:"en",label:"English"}},se.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 le=/*#__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[se.HAS_SUBQUESTION]);if(r)for(var s,l=te(a);!(s=l()).done;){var u=e.findQuestionById(t,s.value,!0,!1,!1);if(u)return u}if(i)for(var c,p=te(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}(),ue=/*#__PURE__*/function(){function e(){}return e.putObject=function(t,n){e.objectMap[t]=n},e.getObject=function(t){return e.objectMap[t]},e}();ue.objectMap={};var ce=/*#__PURE__*/function(){function e(){}return e.getFirstObject=function(e,t){var n=u.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"])))||u.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=p(),o={},r=function(){var r=e[i]["@id"];n.add(r),o[r]=e[i],le.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=c.getLocalized(t[c.RDFS_LABEL],e),r=c.getLocalized(n[c.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}(),pe=/*#__PURE__*/function(){function e(){}return e.isForm=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.FORM)},e.isWizardStep=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.WIZARD_STEP)},e.isSection=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.QUESTION_SECTION)},e.isAnswerable=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.ANSWERABLE)},e.isTypeahead=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.QUESTION_TYPEAHEAD)},e.getPossibleValuesQuery=function(e){return c.getJsonAttValue(e,se.HAS_OPTIONS_QUERY)},e.isDisabled=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.DISABLED)},e.isHidden=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.HIDDEN)},e.isTextarea=function(t,n){return n&&n.length>se.INPUT_LENGTH_THRESHOLD&&!e.isTypeahead(t)||c.hasValue(t,se.LAYOUT_CLASS,se.LAYOUT.TEXTAREA)},e.isText=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.TEXT)},e.isCalendar=function(t){return e.isDate(t)||e.isTime(t)||e.isDateTime(t)},e.isDate=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.DATE)},e.isTime=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.TIME)},e.isDateTime=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.DATETIME)},e.isCheckbox=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.CHECKBOX)},e.isMaskedInput=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.MASKED_INPUT)},e.isSparqlInput=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.SPARQL)},e.isTurtleInput=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.TURTLE)},e.isCollapsed=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.COLLAPSED)},e.isEmphasised=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.EMPHASISED)},e.getCategory=function(e){return se.LAYOUT.CATEGORY.find(function(t){return c.hasValue(e,se.LAYOUT_CLASS,t)})},e.resolveValue=function(e){return e?e[se.HAS_OBJECT_VALUE]?e[se.HAS_OBJECT_VALUE]["@id"]:c.getJsonAttValue(e,se.HAS_DATA_VALUE):null},e.resolveValueObject=function(e){return e?e[se.HAS_OBJECT_VALUE]?le.asArray(e[se.HAS_OBJECT_VALUE])[0]:e[se.HAS_DATA_VALUE]?le.asArray(e[se.HAS_DATA_VALUE])[0]:null:null},e.isRelevant=function(t){if(!t[se.IS_RELEVANT_IF])return!0;for(var n,o=te(le.asArray(t[se.IS_RELEVANT_IF]));!(n=o()).done;)if(!e.testCondition(n.value))return!1;return!0},e.hasValidationLogic=function(e){return!!(e[se.REQUIRES_ANSWER]||e[se.REQUIRES_ANSWER_IF]||e[se.PATTERN]||this.containsXSDProperty(e))},e.isValid=function(e){if(!1===e[se.HAS_VALID_ANSWER])return!1;for(var t,n=te(le.asArray(e[se.HAS_SUBQUESTION]));!(t=n()).done;)if(!1===this.isValid(t.value))return!1;return!0},e.testOrCondition=function(e){var t=e[se.HAS_SUB_CONDITION];t||console.warn("Or condition does not have any sub-condition !");for(var n,o=te(this._getMappedObjectsArray(t));!(n=o()).done;)if(this.testCondition(n.value))return!0;return!1},e.testCondition=function(t){var n,o=t[se.ACCEPTS_VALIDATION_VALUE],r=t[se.ACCEPTS_ANSWER_VALUE],i=t[se.ACCEPTS],a=t[se.HAS_TESTED_QUESTION];if(t[se.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=le.asArray(i);if(1!==s.length&&console.warn("Support for multiple accepts values is not implemented !"),s[0]["@id"]===se.ANSWERED_QUESTION){(r||o)&&console.warn("Support for accepted answer/validations values is not implemented !");for(var l,c=te(this._getMappedObjectsArray(a));!(l=c()).done;)if(!this.hasAnswer(l.value))return!1;return!0}console.warn("No support to accept question of type "+s[0]["@id"]+" !")}if(o&&a){var p=le.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=te(le.asArray(a));!(m=d()).done;){if(void 0===(n=ue.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=ue.getObject(a["@id"]);for(var f,h=te(le.asArray(r));!(f=h()).done;){var E=f.value;if(!n)return console.warn("Question is not defined."),!0;if(!n.hasOwnProperty(se.HAS_ANSWER))return!1;var v=u.getValues(n,se.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(ce.compareValues(S,E))return!0}}return!1},e._getMappedObjectsArray=function(e,t){return le.asArray(e).map(function(e){var n=ue.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(se.HAS_ANSWER)){var n=u.getValues(t,se.HAS_ANSWER);if(n.length){var o=e.resolveValueObject(n[0]);if(o&&(o["@value"]||o["@id"]))return!0}}for(var r,i=te(le.asArray(t[se.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(se.HAS_ANSWER)){var n=u.getValues(t,se.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=te(le.asArray(t[se.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?se.DATETIME_NUMBER_FORMAT:i?t[se.DATE_FORMAT]||o.dateFormat:a?t[se.TIME_FORMAT]||o.timeFormat:s?t[se.DATETIME_FORMAT]||o.dateTimeFormat:null},e.dfsTraverseQuestionTree=function(e,t,n){function o(e){t(e),le.asArray(e[se.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[se.REQUIRES_ANSWER]&&!e[se.USED_ONLY_FOR_COMPLETENESS]?i=t+o+"required: "+e[se.REQUIRES_ANSWER]+"\n":e[se.USED_ONLY_FOR_COMPLETENESS]&&(i=t+o+"required only for completeness: "+e[se.USED_ONLY_FOR_COMPLETENESS]+"\n"),r+=t+e["http://www.w3.org/2000/01/rdf-schema#label"]+"\n",r+=e[se.HELP_DESCRIPTION]?t+o+"description: "+e[se.HELP_DESCRIPTION]+"\n":"",r+=i,r+=e[se.PATTERN]?t+o+"pattern: "+e[se.PATTERN]+"\n":"",r+=e[se.INPUT_MASK]?t+o+"mask: "+e[se.INPUT_MASK]+"\n":"",r+=e[se.XSD.MAX_INCLUSIVE]?t+o+"This field should be a number equal or lower to "+e[se.XSD.MAX_INCLUSIVE]+"\n":"",r+=e[se.XSD.MIN_INCLUSIVE]?t+o+"This field must be greater or equal to "+e[se.XSD.MIN_INCLUSIVE]+"\n":"",r+=e[se.HAS_VALIDATION_MESSAGE]?t+o+"validation-message: "+e[se.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(se.XSD);n<o.length;n++)if(t.includes(o[n]))return!0;return!1},e.getInputMask=function(e){if(e[se.INPUT_MASK])return e[se.INPUT_MASK]},e}(),me={},de=[],fe=/*#__PURE__*/e.createContext({}),he=function(r){var i=n(r.data||me),a=i[0],s=i[1],l=n(r.formQuestions||de),u=l[0],c=l[1];o(function(){if(r.isFormValid){var e=pe.isValid(a);r.isFormValid(e)}},[]),o(function(){s(r.data||me)},[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=pe.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(fe.Provider,K({value:h},r),r.children)};he.propTypes={children:l.element.isRequired,data:l.object.isRequired,formQuestions:l.array.isRequired,isFormValid:l.func};var Ee=/*#__PURE__*/function(t){function n(e){var n;return(n=t.call(this,e)||this).state={cursorPosition:0},n}J(n,t);var o=n.prototype;return o.focus=function(){m.findDOMNode(this.input).focus()},o.getInputDOMNode=function(){return m.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(d.Group,{size:"small",controlId:Math.floor(Math.random()*Number.MAX_SAFE_INTEGER)},/*#__PURE__*/e.createElement(d.Check,K({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(f,{size:"small"},/*#__PURE__*/e.createElement(d.Check,K({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(f,{size:"small"},this._renderLabel(),/*#__PURE__*/e.createElement(h,K({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(d.Label,null,this.props.label):null},o._renderTextArea=function(){var t=this;/*#__PURE__*/return e.createElement(f,{size:"small"},this._renderLabel(),/*#__PURE__*/e.createElement(h,K({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(f,{size:"small"},this._renderLabel(),/*#__PURE__*/e.createElement(h,K({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);Ee.propTypes={type:l.string,label:l.object,value:l.any,onChange:l.func,help:l.string,validation:l.object,placeholder:l.string},Ee.defaultProps={type:"text"};var ve=["children"],Se=/*#__PURE__*/e.createContext({}),Ae={components:{inputComponent:Ee},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}},ge=function(n){var o=n.children,r=$(n,ve),i=t(function(){return{inputComponent:r.components&&r.components.inputComponent||Ae.components.inputComponent,componentsOptions:Object.assign({},Ae.componentsOptions,r.componentsOptions),options:Object.assign({},Ae.options,r.options),mapComponent:r.mapComponent}},[r]);/*#__PURE__*/return e.createElement(Se.Provider,{value:i},o)};ge.propTypes={children:l.element.isRequired,components:l.object,mapComponent:l.func,options:l.object};var _e,Te,Ne={"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 "},Ie={"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 "},Oe=/*#__PURE__*/e.createContext({}),Ce=function(e){var t=e.locale,n=void 0===t?navigator.language:t,o=Ie;return n===se.LANG.cs.locale&&(o=Ne),M(Oe.Provider,{value:{locale:n,lang:o},children:M(U,{locale:n,messages:o,children:e.children})})},be={"@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":""}}]}]}]},Re=/*#__PURE__*/function(){function e(){}return e.generateForm=function(){return JSON.parse(JSON.stringify(be))},e}(),ye={root:(_e={},_e[se.HAS_LAYOUT_CLASS]=se.FORM,_e),expandProperties:[se.HAS_SUBQUESTION,se.IS_RELEVANT_IF,se.HAS_ANSWER,se.HAS_DECLARED_PREFIX,se.HAS_OPTION,se.HAS_COMMENT]},we=/*#__PURE__*/function(){function e(){}return e.customFrame=function(e,t,n){if(arguments.length<2)return u.nextTick(function(){n(new TypeError("Could not frame, too few arguments."))});null===t&&(t=ye),u.flatten(e,null,null,function(e,t){})},e.expandStructure=function(e){var t,n={};e["@graph"].forEach(function(e){n[e["@id"]]=e,pe.isForm(e)&&(t=e)});try{this._expandGraph(t,ye,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]=le.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}();Te=we,we.compressStructure=function(e){var t=[],n=new Set;return(t=Te._compressGraph(e,t,n)).sort(function(e,t){return e["@id"]&&t["@id"]?e["@id"].localeCompare(t["@id"]):0})},we._compressGraph=function(e,t,n){return n.has(e["@id"])||(t.push(e),n.add(e["@id"])),ye.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=Te._compressGraph(a,t,n),e[o][i]={"@id":a["@id"]})}}),t};var Le=/*#__PURE__*/function(){function e(){}return e.constructDefaultForm=function(t){var n=Re.generateForm();return e._constructFormQuestions(n,t)},e.constructForm=function(t,n){try{var o,r;return Promise.resolve(u.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=we.expandStructure(e),Object.keys(r).map(function(e){ue.putObject(e,r[e])})):console.warn("default form is constructed."),!(o=(n=e["@graph"].find(function(e){return pe.isForm(e)}))[se.HAS_SUBQUESTION]))throw oe.error("Could not find any questions in the received data."),"No questions in the form";return(i=o.filter(function(e){return!(!pe.isWizardStep(e)||pe.isHidden(e))||(oe.warn("Item is not a wizard step: "+e),!1)})).length||(oe.log("Could not find any wizard steps in the received data. Building form without steps"),n[se.HAS_SUBQUESTION].forEach(function(e){return i.push(e)})),i.sort(ce.getCompareLocalizedLabelFunction(t)),ce.orderPreservingToplogicalSort(i,se.HAS_PRECEDING_QUESTION),[i,{root:n}]},e}(),De=/*#__PURE__*/function(){function e(){}return e.buildQuestionAnswerModel=function(t,n){var o,r={subQuestions:[]};if(t&&(r.uri=t.root["@id"],r.origin=c.getJsonAttValue(t.root,se.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=c.getJsonAttValue(t,se.HAS_QUESTION_ORIGIN,"@id"),t[se.HAS_SUBQUESTION]){n.subQuestions=[];for(var o=0;o<t[se.HAS_SUBQUESTION].length;o++)n.subQuestions.push(e._processQuestion(t[se.HAS_SUBQUESTION][o]))}if(t[se.HAS_ANSWER]){n.answers=[],Array.isArray(t[se.HAS_ANSWER])||(t[se.HAS_ANSWER]=[t[se.HAS_ANSWER]]);for(var r=0;r<t[se.HAS_ANSWER].length;r++)n.answers.push(e.processAnswer(t[se.HAS_ANSWER][r]))}if(t[se.HAS_COMMENT]){n.comments=[],Array.isArray(t[se.HAS_COMMENT])||(t[se.HAS_COMMENT]=[t[se.HAS_COMMENT]]);for(var i=0;i<t[se.HAS_COMMENT].length;i++)n.comments.push(e.processComment(t[se.HAS_COMMENT][i]))}return n},e.processComment=function(e){var t={};return t.author=c.getJsonAttValue(e,se.HAS_AUTHOR,"@id"),t.value=c.getJsonAttValue(e,se.HAS_COMMENT_VALUE),t.timestamp=c.getJsonAttValue(e,se.HAS_TIMESTAMP,"@id"),t},e.processAnswer=function(e){var t={};return t.uri=e["@id"],t.origin=c.getJsonAttValue(e,se.HAS_ANSWER_ORIGIN,"@id"),e[se.HAS_OBJECT_VALUE]?t.codeValue=c.getJsonAttValue(e,se.HAS_OBJECT_VALUE,"@id"):t.textValue=c.getJsonAttValue(e,se.HAS_DATA_VALUE),t},e.generateAnswer=function(e){var t={};return t[se.HAS_DATA_VALUE]="",t},e}(),Ve=function(t){var n=r(Se);/*#__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||pe.isDisabled(t.question)})};Ve.propTypes={question:l.object.isRequired,label:l.object.isRequired,title:l.string,value:l.oneOfType([l.string,l.bool]),onChange:l.func.isRequired,mouseHover:l.bool,validation:l.object};var Me=function(t){var i=r(Se).componentsOptions,a=n(null),s=a[0],l=a[1];o(function(){t.value&&l(new Date(x(t.value,m,new Date)))},[]);var u=pe.resolveDateTimeFormat(t.question,t.value,i.dateTimeAnswer),c=pe.isDate(t.question),p=pe.isTime(t.question),m="x"===u?i.dateTimeAnswer.dateTimeFormat:u;/*#__PURE__*/return e.createElement(f,{size:"small"},/*#__PURE__*/e.createElement(d.Label,{className:"w-100"},t.label),/*#__PURE__*/e.createElement(P,{selected:s,placeholderText:m,onChange:function(e){l(e),e||t.onChange(""),t.onChange(u===se.DATETIME_NUMBER_FORMAT?Number(e):q(e,u))},showTimeSelect:!c,showTimeSelectOnly:p,timeFormat:"HH:mm",timeIntervals:1,timeCaption:"Time",dateFormat:m,className:F("form-control",t.validation.classname),disabled:i.readOnly||pe.isDisabled(t.question)}),t.validation.message)};Me.propTypes={question:l.object.isRequired,label:l.object.isRequired,title:l.string,value:l.oneOfType([l.string,l.number]),onChange:l.func.isRequired,validation:l.object};var He=[se.XSD.INT,se.XSD.INTEGER,se.XSD.NON_NEGATIVE_INTEGER,se.XSD.NON_POSITIVE_INTEGER,se.XSD.NEGATIVE_INTEGER,se.XSD.POSITIVE_INTEGER,se.XSD.FLOAT,se.XSD.POSITIVE_FLOAT,se.XSD.NEGATIVE_FLOAT],Ue={};Ue[se.XSD.NON_NEGATIVE_INTEGER]={min:0},Ue[se.XSD.NON_POSITIVE_INTEGER]={max:0},Ue[se.XSD.NEGATIVE_INTEGER]={max:-1},Ue[se.XSD.POSITIVE_INTEGER]={min:1};var je={"string-2":"prefixed",atom:"var"},Pe=/*#__PURE__*/function(){function e(){}return e._resolveInputType=function(t,n){return pe.isSparqlInput(t)||pe.isTurtleInput(t)||pe.isTextarea(t,n)?"textarea":e._isNumeric(t)?"number":"text"},e._isNumeric=function(e){for(var t=0,n=He.length;t<n;t++)if(c.hasValue(e,se.HAS_DATATYPE,He[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||pe.isDisabled(t),r},e._resolveStepRestriction=function(e){var t={};return void 0!==e[se.STEP]&&(t.step=c.getJsonAttValue(e,se.STEP)),t},e._resolveNumberRestrictions=function(e){var t={};return Object.getOwnPropertyNames(Ue).forEach(function(n){c.hasValue(e,se.HAS_DATATYPE,n)&&(t=Object.assign({},t,Ue[n]))}),void 0!==e[se.XSD.MIN_INCLUSIVE]&&(t.min=e[se.XSD.MIN_INCLUSIVE]),void 0!==e[se.XSD.MIN_EXCLUSIVE]&&(t.min=e[se.XSD.MIN_EXCLUSIVE]+1),void 0!==e[se.XSD.MAX_EXCLUSIVE]&&(t.max=e[se.XSD.MAX_EXCLUSIVE]-1),void 0!==e[se.XSD.MAX_INCLUSIVE]&&(t.max=e[se.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}(),xe=function(t){var n=r(Se),o=n.inputComponent,i=n.componentsOptions,a=t.question,s=t.answer,l=t.value;return s[se.HAS_OBJECT_VALUE]&&s[se.HAS_OBJECT_VALUE][c.RDFS_LABEL]&&(l=c.getJsonAttValue(s[se.HAS_OBJECT_VALUE],c.RDFS_LABEL)),/*#__PURE__*/e.createElement(o,Object.assign({},Pe.resolveInputProperties(a,l,i),{validation:t.validation,label:t.label,title:t.title,value:null==l?"":l,placeholder:pe.getInputMask(a),onKeyPress:function(e){return Pe._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=Q.fromTextArea(e.target);n.setValue(l),n.on("change",function(){t.onChange(n.getValue())}),Q.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"===je[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[se.HAS_DECLARED_PREFIX]&&t.question[se.HAS_DECLARED_PREFIX].filter(function(e){return e[se.PREFIX]===l.slice(0,-1)}).length){var u=t.question[se.HAS_DECLARED_PREFIX].filter(function(e){return e[se.PREFIX]===l.slice(0,-1)}),c={};c[u[0][se.PREFIX]]=u[0][se.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=Q.fromTextArea(e.target);o.setValue(l),o.on("change",function(){t.onChange(o.getValue())})}}}))};xe.propTypes={question:l.object.isRequired,answer:l.object.isRequired,label:l.object.isRequired,title:l.string,value:l.oneOfType([l.string,l.number]),onChange:l.func.isRequired,validation:l.object};var qe={D:"1",M:"1",Y:"1",h:"1",m:"1",s:"1"},Fe=/*#__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+=qe[t]?qe[t]:t;return n},e}(),Qe=["size","placeholder"];function ke(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 ze=/*#__PURE__*/function(t){function n(e){var n;return(n=t.call(this,e)||this)._updatePattern=function(e){n.mask.setPattern(Fe.mapMask(e.mask),{value:n.mask.getRawValue(),selection:ke(n.input)})},n._updateMaskSelection=function(){n.mask.selection=ke(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 k({pattern:Fe.mapMask(e.mask),value:e.value,formatCharacters:e.formatCharacters,placeholderChar:e.placeholderChar||"_"}),n}J(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(Fe.mapMask(this.props.mask),{value:this.props.value}):this.mask.setPattern(Fe.mapMask(this.props.mask),{value:this.mask.getRawValue()}):e.mask!==this.props.mask?this.mask.setPattern(Fe.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=$(n,Qe),a=this.mask.pattern.length;/*#__PURE__*/return e.createElement(this.context.inputComponent,Object.assign({},i,{ref:function(e){e&&(t.input=e.input?m.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);ze.contextType=Se,ze.propTypes={mask:l.string.isRequired},ze.defaultProps={value:""};var Be=function(t){var n=r(Se).componentsOptions,o=t.question,i=t.value,a=c.getJsonAttValue(o,se.INPUT_MASK);return a?/*#__PURE__*/e.createElement(ze,{mask:a,value:i,label:t.label,title:t.title,placeholder:a,onChange:function(e){return t.onChange(e.target.value)},disabled:n.readOnly||pe.isDisabled(o),validation:t.validation}):(oe.warn("Input mask not provided. Falling back to regular input."),/*#__PURE__*/e.createElement(xe,t))};Be.propTypes={question:l.object.isRequired,answer:l.object.isRequired,label:l.object.isRequired,title:l.string,value:l.oneOfType([l.string,l.number]),onChange:l.func.isRequired,validation:l.object};var We=/*#__PURE__*/function(t){function n(){return t.apply(this,arguments)||this}J(n,t);var o=n.prototype;return o._generateSelectOptions=function(t){var n=[];t.sort(function(e,t){var n=c.getJsonAttValue(e,se.RDFS_LABEL),o=c.getJsonAttValue(t,se.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:c.getJsonAttValue(t[o],se.RDFS_LABEL),key:"opt-"+o},c.getJsonAttValue(t[o],se.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||pe.isDisabled(n)},this._generateSelectOptions(n[se.HAS_OPTION]))},n}(e.Component);We.contextType=Se,We.propTypes={question:l.object.isRequired,label:l.object.isRequired,title:l.string,value:l.string,onChange:l.func.isRequired,validation:l.object};var Xe=function(e,t){return e&&e.length?(e.sort(ce.getCompareLocalizedLabelFunction(t)),ce.orderPreservingToplogicalSort(e,se.HAS_PRECEDING_VALUE),e):[]},Ge=function(t){var i=le.getStringHash(pe.getPossibleValuesQuery(t.question)),a=r(ie),s=r(Se),l=s.options.intl,u=n(!0),p=u[0],m=u[1],h=n([Xe(t.options,l)]),E=h[0],v=h[1];o(function(){var e=!1,n=t.question;return!n[se.HAS_OPTION]&&pe.getPossibleValuesQuery(n)?function(){try{var t=function(t,o){try{var r=Promise.resolve(a.loadFormOptions(i,pe.getPossibleValuesQuery(n))).then(function(t){e||(m(!1),g(t))})}catch(e){return o()}return r&&r.then?r.then(void 0,o):r}(0,function(){oe.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)}}():(m(!1),g(n[se.HAS_OPTION])),function(){e=!0}},[]);var S,A,g=function(e){if(!e)return[];for(var t,n={},o=[],r=te(e=Xe(e,l));!(t=r()).done;){var i=t.value,a=c.getLocalized(i[se.RDFS_LABEL],l),s=c.getLocalized(i[se.RDFS_COMMENT],l);n[i["@id"]]={id:i["@id"],value:i["@id"],label:a,description:s,children:[]};for(var u,p=te(le.asArray(i[se.BROADER]));!(u=p()).done;)o.push({type:"parent-child",parent:u.value["@id"],child:i["@id"]})}for(var m=0,d=o;m<d.length;m++){var f,h=d[m];"parent-child"===h.type&&(null==(f=n[h.parent])||f.children.push(h.child))}var E=Object.values(n);v(E)},_=le.findKeyInObjects(E,["name","value"]),T=le.findKeyInObjects(E,["name","label"]);/*#__PURE__*/return e.createElement(f,{size:"small"},/*#__PURE__*/e.createElement(d.Label,null,t.label),/*#__PURE__*/e.createElement(z,{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[se.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||pe.isDisabled(t.question),onChange:function(e){t.onChange(e?e.id:null)},titleKey:"description"}),t.validation.message)};Ge.propTypes={question:l.object.isRequired,answer:l.object.isRequired,label:l.oneOfType([l.string,l.object]).isRequired,title:l.string,value:l.string,onChange:l.func.isRequired,validation:l.object};var Ye=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"}))},Ke=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"}))},Je=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"}))},Ze=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"}))},$e=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(E,{overlay:t.show?/*#__PURE__*/e.createElement(v,{className:"tooltip-content",id:t.id},t.tooltipContent):/*#__PURE__*/e.createElement("span",null),placement:t.overlayPlacement||r},/*#__PURE__*/e.createElement("span",null,t.children)))};$e.propTypes={tooltipContent:l.oneOfType([l.object.isRequired,l.string.isRequired]),id:l.string.isRequired,overlayPlacement:l.string,absolutePosition:l.bool,show:l.bool},$e.defaultProps={iconClassContainer:"",iconClass:"",absolutePosition:!0,show:!0};var et=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($e,{id:"help-icon-tooltip-",overlayPlacement:t.overlayPlacement||o[0],absolutePosition:t.absolutePosition,tooltipContent:t.text},/*#__PURE__*/e.createElement(Ze,{className:t.iconClass})))};et.propTypes={text:l.string.isRequired,iconClassContainer:l.string,iconClass:l.string,overlayPlacement:l.string,absolutePosition:l.bool},et.defaultProps={iconClassContainer:"",iconClass:"",absolutePosition:!0};var tt=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"}))},nt=function(t){/*#__PURE__*/return e.createElement($e,{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(tt,{className:t.iconClass})))};nt.propTypes={url:l.oneOfType([l.string.isRequired,l.object.isRequired]),iconClassContainer:l.string,iconClass:l.string,overlayPlacement:l.string,absolutePosition:l.bool},nt.defaultProps={iconClassContainer:"",iconClass:"",absolutePosition:!0};var ot=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"}))},rt=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"}))))},it="Unknown author",at=function(t){var o=r(Se).options,i=n(!1),a=i[0],s=i[1],l=n(!1),u=l[0],c=l[1];B.addLocale(X),B.addLocale(W),B.setDefaultLocale(se.LANG.en.locale);var p,m=new B(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 it},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(nt,{iconClassContainer:"emphasise-on-relevant-icon",url:t.author?Object.values(t.author).toString():it})):d())),/*#__PURE__*/e.createElement("div",{className:"col-auto text-muted comment-timestamp"},/*#__PURE__*/e.createElement($e,{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(rt,null)):null),/*#__PURE__*/e.createElement("div",{className:"row"},/*#__PURE__*/e.createElement("div",{className:"col comment-value"},t.commentValue)))};at.propTypes={author:l.object,timestamp:l.string.isRequired,commentValue:l.string.isRequired,onDeleteQuestionComment:l.func.isRequired,onDeleteViewComment:l.func,index:l.number.isRequired};var st=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)]),M("span",{children:l?H("div",{className:"comment-delete",children:[M(Y,{color:"#00BFFF",height:80,width:80}),M("p",{children:"Deleting comment..."})]}):M("div",{className:"comment-list-items",ref:a,children:t.map(function(e,t){return M("div",{className:"comment-list-item",children:M(at,{commentValue:e[se.HAS_COMMENT_VALUE],author:e[se.HAS_AUTHOR]?e[se.HAS_AUTHOR]:null,timestamp:e[se.HAS_TIMESTAMP],onDeleteQuestionComment:r,onDeleteViewComment:c,index:t})},t)})})})},lt=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"}))},ut="300px",ct=function(t){var r=n(""),a=r[0],s=r[1],l=i(null),u=j();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",m(e)},m=function(e){e.style.height=e.scrollHeight+"px",parseInt(e.style.height)>parseInt(ut)&&(e.style.height=ut)};/*#__PURE__*/return e.createElement(d,{onSubmit:c,onKeyUp:function(e){"Enter"===e.key&&e.ctrlKey&&a.trim()&&c(e)},onClick:function(e){e.stopPropagation()}},/*#__PURE__*/e.createElement(d.Group,{className:"m-2",controlId:"formBasicComment"},/*#__PURE__*/e.createElement(S,{className:"col-lg-12 p-0"},/*#__PURE__*/e.createElement(A,{className:"container-fluid p-0 m-0"},/*#__PURE__*/e.createElement("div",{id:"comment-form"},/*#__PURE__*/e.createElement(d.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(g,{className:"comment-form-button",variant:"primary",type:"submit"},/*#__PURE__*/e.createElement(lt,null)))))))};ct.propTypes={onChange:l.func.isRequired};var pt,mt=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"}))},dt=function(t){var a=r(Se),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 E=function(){m(!1)},S=function(){var e=t.question;return e[se.HAS_COMMENT]||(e[se.HAS_COMMENT]=[]),Array.isArray(e[se.HAS_COMMENT])||(e[se.HAS_COMMENT]=[e[se.HAS_COMMENT]]),e[se.HAS_COMMENT]},A=function(e){var n={};g(n,e),t.onChange(O(),n)},g=function(e,t){a.options.currentUser&&(e[se.HAS_AUTHOR]={"@id":a.options.currentUser}),e[se.HAS_COMMENT_VALUE]=t,e[se.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(ot,null),O()>0?/*#__PURE__*/e.createElement(_,{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(T,{target:s.current,show:p,placement:f,rootClose:!1,onHide:E,container:l},function(t){/*#__PURE__*/return e.createElement(v,K({className:"comment-tooltip"},t),/*#__PURE__*/e.createElement("span",{onKeyDown:function(e){!function(e){"Escape"===e.key&&E()}(e)}},/*#__PURE__*/e.createElement(G.div,{className:"close-comment-icon",onClick:E,whileHover:{scale:1.1,transition:{duration:.1}}},/*#__PURE__*/e.createElement(mt,null)),/*#__PURE__*/e.createElement(st,{comments:S(),onDeleteCommentClick:N}),/*#__PURE__*/e.createElement(ct,{onChange:A})))})))};dt.propTypes={question:l.object.isRequired,onChange:l.func.isRequired};var ft=/*#__PURE__*/function(){function t(){}return t.renderIcons=function(t,n,o,r){var i;i=n.icons?n.icons:se.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===se.ICONS.QUESTION_COMMENTS&&a.push(/*#__PURE__*/e.createElement("li",{key:c,className:"icon-list-item"},l)),i[c].id===se.ICONS.QUESTION_HELP&&a.push(/*#__PURE__*/e.createElement("li",{key:c,className:"icon-list-item"},s)),i[c].id===se.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(se.ICONS.QUESTION_HELP,e,t,n,o)},t.renderQuestionLink=function(e,t,n,o){return this.getIconComponentFromName(se.ICONS.QUESTION_LINK,e,t,n,o)},t.getIconComponentFromName=function(e,t,n,o,r){var i=this.getIconFromIconList(n.icons?n.icons:se.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===se.ICON_BEHAVIOR.ON_HOVER||t.behavior===se.ICON_BEHAVIOR.ENABLE))return t.behavior===se.ICON_BEHAVIOR.ENABLE?(i=!0,a=""):a="emphasise-on-relevant-icon",t.id===se.ICONS.QUESTION_HELP&&n[se.HELP_DESCRIPTION]?i?/*#__PURE__*/e.createElement("div",{className:a},/*#__PURE__*/e.createElement(et,{text:c.getLocalized(n[se.HELP_DESCRIPTION],o.intl),absolutePosition:!1})):null:t.id===se.ICONS.QUESTION_LINK&&n[se.SOURCE]?i?/*#__PURE__*/e.createElement("div",{className:a},/*#__PURE__*/e.createElement(nt,{url:n[se.SOURCE]})):null:t.id===se.ICONS.QUESTION_COMMENTS&&i?/*#__PURE__*/e.createElement("div",{className:a},/*#__PURE__*/e.createElement(dt,{question:n,onChange:r})):null},t}();pt=ft,ft.renderQuestionComments=function(e,t,n,o){return pt.getIconComponentFromName(se.ICONS.QUESTION_COMMENTS,e,t,n,o)},ft.getIconFromIconList=function(e,t){return e?e.find(function(e){return e.id===t}):null};var ht=function(t){var r=e.useContext(ie),i=e.useContext(Se).options,a=n({severity:"",classname:"",message:null}),s=a[0],l=a[1];o(function(){f()},[t.question]);var u,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[se.HAS_OBJECT_VALUE]=null,e[se.HAS_DATA_VALUE]=null):t.answer[se.HAS_OBJECT_VALUE]||pe.isTypeahead(t.question)?e[se.HAS_OBJECT_VALUE]={"@id":n}:e[se.HAS_DATA_VALUE]={"@value":n}},f=function(){l({severity:"",classname:"",message:null}),!1===h[se.HAS_VALID_ANSWER]&&l(h[se.HAS_VALIDATION_SEVERITY]===se.VALIDATION.SEVERITY.WARNING?{severity:se.VALIDATION.SEVERITY.WARNING,classname:se.VALIDATION.CLASSNAME.WARNING,message:/*#__PURE__*/e.createElement(N,{className:se.VALIDATION.CLASSNAME.WARNING},h[se.HAS_VALIDATION_MESSAGE])}:{severity:se.VALIDATION.SEVERITY.ERROR,classname:se.VALIDATION.CLASSNAME.ERROR,message:/*#__PURE__*/e.createElement(N,{className:se.VALIDATION.CLASSNAME.ERROR},h[se.HAS_VALIDATION_MESSAGE])})},h=t.question,E=pe.resolveValue(t.answer),v=function(n){var o=c.getLocalized(n[se.RDFS_LABEL],i.intl);/*#__PURE__*/return e.createElement("div",{className:"question-header"},o,ft.renderIcons(t.question,i,t.onCommentChange,t.showIcon))}(h),S=c.getLocalized(h[se.RDFS_COMMENT],i.intl);return u=pe.isTypeahead(h)?function(n,o,i){var a=le.getStringHash(pe.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)[se.HAS_OPTION]&&0!==p[se.HAS_OPTION].length?function(n,o,r){/*#__PURE__*/return e.createElement(We,{question:t.question,label:o,title:r,value:n,onChange:m,validation:s})}(E,v,S):pe.isCalendar(h)?function(n,o,r){/*#__PURE__*/return e.createElement(Me,{question:t.question,value:n,title:r,label:o,onChange:m,validation:s})}(E,v,S):pe.isCheckbox(h)?function(n,o,r){/*#__PURE__*/return e.createElement(Ve,{label:o,title:r,value:n,onChange:m,question:t.question,validation:s})}(E,v,S):pe.isMaskedInput(h)?function(n,o,r){/*#__PURE__*/return e.createElement(Be,{label:o,title:r,value:n,onChange:m,question:t.question,answer:t.answer,validation:s})}(E,v,S):pe.isSparqlInput(h)?function(n,o,r){/*#__PURE__*/return e.createElement(xe,{question:t.question,answer:t.answer,label:o,title:r,value:n,onChange:m,sparql:!0,validation:s})}(E,v,S):pe.isTurtleInput(h)?function(n,o,r){/*#__PURE__*/return e.createElement(xe,{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(xe,{question:t.question,answer:t.answer,label:o,title:r,value:n,onChange:m,validation:s})}(E,v,S),u};ht.propTypes={answer:l.object.isRequired,question:l.object.isRequired,onChange:l.func.isRequired,onCommentChange:l.func.isRequired,index:l.number,icons:l.object};var Et=function(e,t){var n=[Nt,Tt,St,gt,At,_t];return function(){if(pe.hasValidationLogic(e,t)){var o=pe.getAnswerValue(e);return vt(e,t,o,n)}}},vt=function(e,t,n,o){for(var r,i={},a=te(o);!(r=a()).done;){var s=(0,r.value)(e,t);if(!s.isValid)return i[se.HAS_VALID_ANSWER]=!1,i[se.HAS_VALIDATION_MESSAGE]=s.message,i[se.HAS_VALIDATION_SEVERITY]=s.validationSeverity,i;if(!1===i[se.HAS_VALID_ANSWER])break}return i[se.HAS_VALID_ANSWER]=!0,i[se.HAS_VALIDATION_MESSAGE]="",i[se.HAS_VALIDATION_SEVERITY]="",i},St=function(e,t){var n=pe.getAnswerValue(e);return n&&n.length>0&&e[se.PATTERN]&&!new RegExp(e[se.PATTERN]).test(n)&&pe.hasAnswer(e)?{isValid:!1,validationSeverity:se.VALIDATION.SEVERITY.ERROR,message:e[se.HAS_VALIDATION_MESSAGE]?e[se.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.invalid"})}:{isValid:!0}},At=function(e,t){return!e[se.REQUIRES_ANSWER]||e[se.USED_ONLY_FOR_COMPLETENESS]||pe.hasAnswer(e)?{isValid:!0}:{isValid:!1,validationSeverity:se.VALIDATION.SEVERITY.ERROR,message:e[se.HAS_VALIDATION_MESSAGE]?e[se.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.required"})}},gt=function(e,t){return pe.isCheckbox(e)&&e[se.REQUIRES_ANSWER]&&!pe.hasAnswer(e)?{isValid:!1,validationSeverity:se.VALIDATION.SEVERITY.ERROR,message:e[se.HAS_VALIDATION_MESSAGE]?e[se.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.check"})}:{isValid:!0}},_t=function(e,t){return e[se.REQUIRES_ANSWER]&&e[se.USED_ONLY_FOR_COMPLETENESS]&&!pe.hasAnswer(e)?{isValid:!1,validationSeverity:se.VALIDATION.SEVERITY.WARNING,message:e[se.HAS_VALIDATION_MESSAGE]?e[se.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.required_only_for_completeness"})}:{isValid:!0}},Tt=function(e,t){if(e[se.XSD.MIN_INCLUSIVE]){var n=pe.getAnswerValue(e);if(n&&n.length>0){var o=e[se.XSD.MIN_INCLUSIVE];if(!(Number.isInteger(parseInt(n))&&n>=o))return{isValid:!1,validationSeverity:se.VALIDATION.SEVERITY.ERROR,message:e[se.HAS_VALIDATION_MESSAGE]?e[se.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.greater_or_equal"})+o+"."}}}return{isValid:!0}},Nt=function(e,t){var n=pe.getAnswerValue(e);if(e[se.XSD.MAX_INCLUSIVE]&&n&&n.length>0){var o=e[se.XSD.MAX_INCLUSIVE];if(!(Number.isInteger(parseInt(n))&&n<=o))return{isValid:!1,validationSeverity:se.VALIDATION.SEVERITY.ERROR,message:e[se.HAS_VALIDATION_MESSAGE]?e[se.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.lower_or_equal"})+o+"."}}return{isValid:!0}},It=/*#__PURE__*/function(t){function n(e){var n;return(n=t.call(this,e)||this).state={prefixes:e.prefixes},n}return J(n,t),n.prototype.render=function(){var t=/*#__PURE__*/e.createElement(I,{id:"prefixes",title:"Prefixes"},/*#__PURE__*/e.createElement(O,null,this.state.prefixes.sort(function(e,t){return e[se.PREFIX]<t[se.PREFIX]?-1:1}).map(function(t){/*#__PURE__*/return e.createElement(C,{key:t[se.PREFIX]},/*#__PURE__*/e.createElement("strong",null,t[se.PREFIX]),": ",t[se.NAMESPACE])})));/*#__PURE__*/return e.createElement(E,{trigger:"click",placement:"right",overlay:t},/*#__PURE__*/e.createElement("span",{className:this.props.iconClass},this.props.children))},n}(e.Component);It.propTypes={prefixes:l.array.isRequired,children:l.element.isRequired,iconClass:l.string},It.defaultProps={iconClass:""};var Ot=function(e){var t;return(t=e.question[se.HAS_MEDIA_CONTENT])?Array.isArray(t)?M("div",{className:"col-6",children:t.map(function(e,n){return M("div",{className:"row embed-responsive-21by9 media-content-video-container mb-3",children:M("iframe",{src:t[n],className:"embed-responsive-item",allowFullScreen:!0})},n)})}):M("div",{className:"col-6",children:M("iframe",{src:t,className:"embed-responsive-item",allowFullScreen:!0})}):null},Ct=/*#__PURE__*/function(t){function n(e){var o;return(o=t.call(this,e)||this).handleAnswerChange=function(e,t){if(pe.isSection(o.props.question)){var n=!!pe.resolveValue(t);o.setState({expanded:n})}o._handleChange(se.HAS_ANSWER,e,t)},o.handleSubQuestionChange=function(e,t){o._handleChange(se.HAS_SUBQUESTION,e,t)},o.handleCommentChange=function(e,t){o._handleChange(se.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"),pe.isWizardStep(e)&&r.push("wizard-step bg-primary text-white"),pe.isEmphasised(e)&&r.push(n.getEmphasizedClass(e)),pe.isSection(e)&&r.push("section-background"),t&&r.push("cursor-pointer"),o.isDebugged(e)&&r.push("show-irrelevant"),r},ue.putObject(e.question["@id"],e.question),o.state={validator:{},expanded:!pe.isCollapsed(e.question),showIcon:!1},o}J(n,t);var o=n.prototype;return o.componentDidMount=function(){this.setState({validator:Et(this.props.question,this.props.intl)})},o.componentDidUpdate=function(){var e=this.props.question,t=this.context.options.startingQuestionId,n=e[se.HAS_SUBQUESTION].find(function(e){return e["@id"]===t});if(pe.isSection(e)&&pe.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===se.HAS_ANSWER){var r=this.state.validator(n);o=Object.assign({},o,r)}ue.putObject(o["@id"],o),this.props.onChange(this.props.index,o)},o.isDebugged=function(e){var t=this.context.options.startingQuestionId;return!pe.isRelevant(e)&&(!!this.context.options.debugMode||null!=t&&!!le.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):pe.isHidden(t)?null:pe.isRelevant(t)?n:null},o.renderQuestion=function(t){if(pe.isAnswerable(t)&&!pe.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(pe.isAnswerable(t))return this.renderAnswerableSection();if(pe.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=c.getLocalized(t[c.RDFS_LABEL],this.context.options.intl),l=/*#__PURE__*/e.createElement(b.Body,{className:F("p-3",a)},this._renderQuestionContent());/*#__PURE__*/return e.createElement(e.Fragment,null,/*#__PURE__*/e.createElement(R,{defaultActiveKey:this.state.expanded?void 0:s},/*#__PURE__*/e.createElement(b,{className:"mb-3"},/*#__PURE__*/e.createElement(R.Toggle,{as:b.Header,onClick:this._toggleCollapse,className:this._getHeaderClassName(),onMouseEnter:this._onMouseEnterHandler,onMouseLeave:this._onMouseLeaveHandler},/*#__PURE__*/e.createElement("h6",{className:"d-inline",id:t["@id"]},r&&!pe.isWizardStep(t)&&this._renderCollapseToggle(),s),this.renderQuestionIcons(),this.props.children),/*#__PURE__*/e.createElement(r?R.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(Ot,{key:this.props.question["@id"]+"-media",question:this.props.question})),t.push(this.renderAnswers()),t.push(this.renderSubQuestions()),t},o.renderQuestionIcons=function(){return ft.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(b.Body,{className:F("p-3",r)},this.renderSubQuestions(i));/*#__PURE__*/return e.createElement(R,{activeKey:this.state.expanded?t["@id"]:void 0,className:"answerable-section"},/*#__PURE__*/e.createElement(b,{className:"mb-3"},/*#__PURE__*/e.createElement(b.Header,{onClick:this._toggleCollapse,className:this._getHeaderClassName()},this.renderAnswers()),o?/*#__PURE__*/e.createElement(R.Collapse,{className:i,eventKey:t["@id"]},a):{cardBody:a}))},o.getShowIrrelevantClassname=function(e){return!this.context.options.debugMode&&!ce.checkId(e[se.HAS_SUBQUESTION],this.context.options.startingQuestionId)||pe.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++)pe.isTextarea(o,pe.resolveValue(i[a]))||pe.isSparqlInput(o)||pe.isTurtleInput(o),t=F("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(ht,{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[se.HAS_ANSWER]||(e[se.HAS_ANSWER]=[]),Array.isArray(e[se.HAS_ANSWER])||(e[se.HAS_ANSWER]=[e[se.HAS_ANSWER]]),0===e[se.HAS_ANSWER].length&&(e[se.HAS_ANSWER]=pe.isSection(e)&&!pe.isAnswerable(e)?[]:[De.generateAnswer(e)]),e[se.HAS_ANSWER]},o._getAnswerWidthStyle=function(){var e=Number(this.props.question[se.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===se.GENERATED_ROW_SIZE?"col-6":"col-"+se.COLUMN_COUNT/se.GENERATED_ROW_SIZE},n._getQuestionCategoryClass=function(e){var t=pe.getCategory(e);return t?"question-"+t:""},n.getEmphasizedClass=function(e){return pe.isEmphasised(e)?"bg-warning":""},n.getEmphasizedOnRelevantClass=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.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?Ye:Ke,{title:t}))},o._renderPrefixes=function(){var t=this.props.question;return t[se.HAS_DECLARED_PREFIX]&&t[se.HAS_DECLARED_PREFIX].length?/*#__PURE__*/e.createElement(It,{prefixes:t[se.HAS_DECLARED_PREFIX],iconClass:"help-icon-checkbox"},/*#__PURE__*/e.createElement(Je,null)):null},o._renderUnits=function(){var t=this.props.question;return t[se.HAS_UNIT]?/*#__PURE__*/e.createElement("div",{className:"has-unit-label"},t[se.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||le.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[se.HAS_SUBQUESTION]||(e[se.HAS_SUBQUESTION]=[]),Array.isArray(e[se.HAS_SUBQUESTION])||(e[se.HAS_SUBQUESTION]=[e[se.HAS_SUBQUESTION]]),ce.orderByLocalizedLabels(e[se.HAS_SUBQUESTION],this.context.options.intl),ce.orderPreservingToplogicalSort(e[se.HAS_SUBQUESTION],se.HAS_PRECEDING_QUESTION),e[se.HAS_SUBQUESTION]},o._getFirstAnswerValue=function(){return pe.resolveValue(this._getAnswers()[0])},n}(e.Component);Ct.contextType=Se,Ct.propTypes={question:l.object.isRequired,onChange:l.func.isRequired,index:l.number,withoutCard:l.bool,collapsible:l.bool},Ct.defaultProps={withoutCard:!1,collapsible:!0};var bt=function(t){var n=r(fe),o=n.updateFormQuestionsData,i=n.getFormQuestionsData,a=j(),s=i([t.index]);/*#__PURE__*/return e.createElement(e.Fragment,null,/*#__PURE__*/e.createElement(Ct,{question:s,onChange:function(e,n){o(t.index||e,Object.assign({},t.question,n))},collapsible:pe.isAnswerable(s),intl:a}),t.options.wizardStepButtons&&/*#__PURE__*/e.createElement(y,{className:"m-3 float-right"},!t.isFirstStep&&/*#__PURE__*/e.createElement(g,{className:"mr-2",onClick:function(){t.onPreviousStep()},variant:"primary",size:"sm"},a.formatMessage({id:"wizard.previous"})),!t.isLastStep&&/*#__PURE__*/e.createElement(g,{onClick:function(){o(t.index,i()),t.onNextStep()},variant:"primary",size:"sm"},a.formatMessage({id:"wizard.next"}))))};bt.propTypes={options:l.object.isRequired,question:l.object.isRequired,index:l.number.isRequired,onNextStep:l.func,onPreviousStep:l.func,mapComponent:l.func,isFirstStep:l.bool,isLastStep:l.bool};var Rt=function(t){var n=t.steps,o=t.onNavigate,i=t.currentStep,a=r(Se).options,s=j();/*#__PURE__*/return e.createElement(b.Header,null,/*#__PURE__*/e.createElement(w,{variant:"tabs",activeKey:i,onSelect:function(e){return o(parseInt(e))}},n.map(function(t,n){/*#__PURE__*/return e.createElement($e,{id:"step-disabled",tooltipContent:s.formatMessage({id:"wizard.nav.tooltip"}),show:!a.enableWizardStepSkip},/*#__PURE__*/e.createElement(L,{key:"nav"+n,id:"wizard-nav-"+n},/*#__PURE__*/e.createElement(D,{eventKey:n,active:n===i?"active":"",hidden:!a.debugMode&&!pe.isRelevant(t),disabled:!a.enableWizardStepSkip,className:F([a.debugMode&&!pe.isRelevant(t)?"show-irrelevant":Ct.getEmphasizedClass(t),"wizard-nav"])},c.getLocalized(t[c.RDFS_LABEL],a.intl))))})))};Rt.propTypes={currentStep:l.number.isRequired,steps:l.array.isRequired,onNavigate:l.func.isRequired};var yt=function(t){var n=t.steps,o=t.onNavigate,i=t.currentStep,a=r(Se).options,s=j();/*#__PURE__*/return e.createElement("div",{className:"wizard-nav col-2 p-0"},/*#__PURE__*/e.createElement(O,null,n.map(function(t,n){/*#__PURE__*/return e.createElement($e,{id:"step-disabled",tooltipContent:s.formatMessage({id:"wizard.nav.tooltip"}),show:!a.enableWizardStepSkip},/*#__PURE__*/e.createElement(C,{hidden:!a.debugMode&&!pe.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:F([a.debugMode&&!pe.isRelevant(t)?"show-irrelevant":Ct.getEmphasizedClass(t),"wizard-nav"])},c.getLocalized(t[c.RDFS_LABEL],a.intl)))})))};yt.propTypes={currentStep:l.number.isRequired,steps:l.array.isRequired,onNavigate:l.func.isRequired};var wt,Lt=function(e,t){var n=function e(n,o){return n?n["@id"]===t?o:le.asArray(n[se.HAS_SUBQUESTION]).findIndex(function(t,n){return-1!==e(t,n)}):-1};return e.findIndex(function(e,t){return-1!==n(e,t)})},Dt=function(){var t=e.useContext(fe),n=e.useContext(Se),r=n.options,i=n.mapComponent,a=0;r.startingQuestionId?-1===(a=Lt(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?Rt:yt,{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(b,{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],bt),/*#__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}))))},Vt=/*#__PURE__*/e.forwardRef(function(t,n){var o=e.useContext(Se).options;/*#__PURE__*/return e.createElement(V,K({size:"xl",animation:!0},o.modalProps),/*#__PURE__*/e.createElement(V.Header,{closeButton:!0},/*#__PURE__*/e.createElement(V.Title,null,o.modalProps.title)),/*#__PURE__*/e.createElement(V.Body,{className:"overflow-hidden p-0"},t.children))});Vt.propTypes={children:l.element.isRequired};var Mt=function(){};wt=Mt,Mt.updateQuestionValidation=function(e,t,n,o){if(t[se.HAS_ANSWER]){var r=Et(t,o)();r&&(e[n]=Object.assign({},t,r))}for(var i,a=te(e);!(i=a()).done;)wt.updateSubQuestionsValidation(i.value,o)},Mt.updateSubQuestionsValidation=function(e,t){for(var n=le.asArray(e[se.HAS_SUBQUESTION]),o=0;o<n.length;o++)wt.updateQuestionValidation(n,n[o],o,t)};var Ht=/*#__PURE__*/a(function(t,n){var o=r(fe),i=o.getFormQuestionsData,a=o.updateFormQuestionsData,l=o.getData,u=j();s(n,function(){return{validateForm:p,getFormSpecification:m,getFormQuestionsData:i,getFormData:c}},[]);var c=function(){var e=l(),t=i();return De.buildQuestionAnswerModel(e,t)},p=function(){for(var e=i(),t=0;t<e.length;t++)Mt.updateQuestionValidation(e,e[t],t,u);a(null,e)},m=function(){var e=i();return pe.getFormSpecification(e)},d=function(){var t=i();/*#__PURE__*/return e.createElement(b,{className:"p-3"},t.map(function(e,t){return f(e,t)}))},f=function(n,o){var r=t.mapComponent(n,Ct);/*#__PURE__*/return e.createElement(r,{key:n["@id"],question:n,onChange:function(e,t){return function(e,t,n){a(t,Object.assign({},e,n))}(n,e,t)},index:o,intl:u})},h=t.modalView,E=i();if(!E.length)/*#__PURE__*/return e.createElement(b,{className:"p-3 font-italic"},"There are no questions available...");var v=E.every(function(e){return!pe.isWizardStep(e)});return h?/*#__PURE__*/e.createElement(Vt,null,v?d():/*#__PURE__*/e.createElement(Dt,null)):v?d():/*#__PURE__*/e.createElement(Dt,null)}),Ut=/*#__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(Le.constructForm(t.form,t.options.intl)).then(function(e){var t=e[0],n=e[1];t.formQuestions.some(function(e){return pe.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(b,{className:"p-3 font-italic"},"Loading SForms...");var f=function(e,t){return function(n,o){if(!e)return o;for(var r,i=te(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(ge,{components:t.components,componentsOptions:t.componentsOptions,mapComponent:f,options:t.options},/*#__PURE__*/e.createElement(Ce,{locale:t.options.intl.locale},/*#__PURE__*/e.createElement(ae,{fetchTypeAheadValues:t.fetchTypeAheadValues},/*#__PURE__*/e.createElement(he,{data:m,formQuestions:u.formQuestions,isFormValid:t.isFormValid},/*#__PURE__*/e.createElement(Ht,{ref:r,modalView:t.options&&t.options.modalView,mapComponent:f})))))});Ut.propTypes={form:l.object.isRequired,options:l.object.isRequired,componentMapRules:l.array,components:l.object,componentsOptions:l.object,fetchTypeAheadValues:l.func,isFormValid:l.func,loader:l.element};export{ht as Answer,Se as ConfigurationContext,se as Constants,fe as FormQuestionsContext,pe as FormUtils,et as HelpIcon,Ce as IntlContextProvider,we as JsonLdFramingUtils,ue as JsonLdObjectMap,ce as JsonLdObjectUtils,Ct as Question,ft as QuestionStatic,bt as WizardStep,Ut 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,useImperativeHandle as s}from"react";import l from"prop-types";import"core-js/modules/es.object.assign.js";import*as u 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 c from"jsonld-utils";import"core-js/modules/es.array.sort.js";import p from"@kbss-cvut/tsort";import"core-js/modules/es.number.constructor.js";import"core-js/modules/es.number.max-safe-integer.js";import m from"react-dom";import{Form as d,FormGroup as f,FormControl as h,OverlayTrigger as E,Tooltip as v,Col as S,Row as A,Button as g,Badge as _,Overlay as T,FormText as N,Popover as I,ListGroup as O,ListGroupItem as C,Card as b,Accordion as R,ButtonToolbar as y,Nav as L,NavItem as w,NavLink as D,Modal as V}from"react-bootstrap";import{jsx as M,jsxs as H}from"react/jsx-runtime";import{IntlProvider as U,useIntl as j}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 P from"react-datepicker";import{parse as x,format as q}from"date-fns";import F 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 Q from"yasgui-yasqe";import"@triply/yasgui/build/yasgui.min.css";import"core-js/modules/web.timers.js";import k from"inputmask-core";import{IntelligentTreeSelect as z}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 B from"javascript-time-ago";import W from"javascript-time-ago/locale/en";import X from"javascript-time-ago/locale/cs";import{motion as G}from"framer-motion";import{Rings as Y}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 K(){return K=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},K.apply(this,arguments)}function J(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Z(e,t)}function Z(e,t){return Z=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Z(e,t)}function $(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 ee(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 te(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 ee(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)?ee(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 ne,oe=/*#__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}(),re=["children"],ie=/*#__PURE__*/e.createContext({}),ae=function(n){var o=n.children,r=$(n,re),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?u.frame(t,{},{}).then(function(t){var n,o=t["@graph"];return i.push(Object.assign({},o,((n={})[e]=o,n))),o}):(oe.warn("No data received when loading options using id "+e),[])})}catch(e){return Promise.reject(e)}},s=function(e){return i[e]||[]},l=t(function(){return{loadFormOptions:a,getOptions:s}},[a,s]);/*#__PURE__*/return e.createElement(ie.Provider,K({value:l},r),o)};ae.propTypes={children:l.element.isRequired,fetchTypeAheadValues:l.func};var se=function(){};ne=se,se.COLUMN_COUNT=12,se.INPUT_LENGTH_THRESHOLD=50,se.DATETIME_NUMBER_FORMAT="x",se.FORM="http://onto.fel.cvut.cz/ontologies/documentation/form",se.HAS_SUBQUESTION="http://onto.fel.cvut.cz/ontologies/documentation/has_related_question",se.HAS_ANSWER="http://onto.fel.cvut.cz/ontologies/documentation/has_answer",se.HAS_OPTION="http://onto.fel.cvut.cz/ontologies/form/has-possible-value",se.HAS_OPTIONS_QUERY="http://onto.fel.cvut.cz/ontologies/form/has-possible-values-query",se.HAS_VALUE_TYPE="http://onto.fel.cvut.cz/ontologies/form/has-value-type",se.IS_DISABLED="http://onto.fel.cvut.cz/ontologies/aviation/form-376/is-disabled",se.INPUT_MASK="http://onto.fel.cvut.cz/ontologies/form/has-input-mask",se.LAYOUT_CLASS="http://onto.fel.cvut.cz/ontologies/form-layout/has-layout-class",se.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"]},se.HAS_INITIAL_INPUT_LENGTH="http://onto.fel.cvut.cz/ontologies/form-layout/has-initial-input-length",se.VALUE_TYPE_CODE="code",se.VALUE_TYPE_TEXT="text",se.GENERATED_ROW_SIZE=1,se.HAS_QUESTION_ORIGIN="http://onto.fel.cvut.cz/ontologies/form/has-question-origin",se.HAS_ANSWER_ORIGIN="http://onto.fel.cvut.cz/ontologies/form/has-answer-origin",se.HAS_DATA_VALUE="http://onto.fel.cvut.cz/ontologies/documentation/has_data_value",se.HAS_OBJECT_VALUE="http://onto.fel.cvut.cz/ontologies/documentation/has_object_value",se.HELP_DESCRIPTION="http://purl.org/dc/elements/1.1/description",se.SOURCE="http://purl.org/dc/elements/1.1/source",se.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"},se.STEP="http://onto.fel.cvut.cz/ontologies/form/step",se.PATTERN="http://onto.fel.cvut.cz/ontologies/form/pattern",se.ACCEPTS_ANSWER_VALUE="http://onto.fel.cvut.cz/ontologies/form/accepts-answer-value",se.ACCEPTS="http://onto.fel.cvut.cz/ontologies/form/accepts",se.HAS_DATATYPE="http://onto.fel.cvut.cz/ontologies/form/has-datatype",se.HAS_LAYOUT_CLASS="http://onto.fel.cvut.cz/ontologies/form/has-layout-class",se.HAS_POSSIBLE_VALUES_QUERY="http://onto.fel.cvut.cz/ontologies/form/has-possible-values-query",se.HAS_REQUIRED_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-required-value",se.HAS_TESTED_QUESTION="http://onto.fel.cvut.cz/ontologies/form/has-tested-question",se.HAS_TESTED_FORM="http://onto.fel.cvut.cz/ontologies/form/has-tested-form",se.HAS_UNIT="http://onto.fel.cvut.cz/ontologies/form/has-unit",se.HAS_VALID_ANSWER="http://onto.fel.cvut.cz/ontologies/form/has-valid-answer",se.IS_RELEVANT_IF="http://onto.fel.cvut.cz/ontologies/form/is-relevant-if",se.ACCEPTS_VALIDATION_VALUE="http://onto.fel.cvut.cz/ontologies/form/accepts-validation-value",se.HAS_VALIDATION_MESSAGE="http://onto.fel.cvut.cz/ontologies/form/has-validation-message",se.NEGATIVE_CONDITION="http://onto.fel.cvut.cz/ontologies/form/negative-condition",se.REQUIRES_ANSWER="http://onto.fel.cvut.cz/ontologies/form/requires-answer",se.USED_ONLY_FOR_COMPLETENESS="http://onto.fel.cvut.cz/ontologies/form/used-only-for-completeness",se.REQUIRES_ANSWER_DESCRIPTION_IF="http://onto.fel.cvut.cz/ontologies/form/requires-answer-description-if",se.REQUIRES_ANSWER_IF="http://onto.fel.cvut.cz/ontologies/form/requires-answer-if",se.HAS_PRECEDING_QUESTION="http://onto.fel.cvut.cz/ontologies/form/has-preceding-question",se.HAS_PRECEDING_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-preceding-value",se.HAS_MEDIA_CONTENT="http://onto.fel.cvut.cz/ontologies/form/has-media-content",se.CONDITION="http://onto.fel.cvut.cz/ontologies/form/condition",se.OR_CONDITION="http://onto.fel.cvut.cz/ontologies/form/or-condition",se.HAS_SUB_CONDITION="http://onto.fel.cvut.cz/ontologies/form/has-sub-condition",se.HAS_PATTERN="http://onto.fel.cvut.cz/ontologies/form-lt/has-pattern",se.HAS_DECLARED_PREFIX="http://onto.fel.cvut.cz/ontologies/form-spin/has-declared-prefix",se.PREFIX="http://www.w3.org/ns/shacl#prefix",se.NAMESPACE="http://www.w3.org/ns/shacl#namespace",se.HAS_COMMENT="http://onto.fel.cvut.cz/ontologies/form/has-comment",se.HAS_COMMENT_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-comment-value",se.HAS_AUTHOR="http://onto.fel.cvut.cz/ontologies/form/has-author",se.HAS_TIMESTAMP="http://onto.fel.cvut.cz/ontologies/form/has-timestamp",se.TIME_FORMAT="http://onto.fel.cvut.cz/ontologies/form/time-format",se.DATE_FORMAT="http://onto.fel.cvut.cz/ontologies/form/date-format",se.DATETIME_FORMAT="http://onto.fel.cvut.cz/ontologies/form/datetime-format",se.NOT_ANSWERED_QUESTION="http://onto.fel.cvut.cz/ontologies/form/not-answered-question",se.ANSWERED_QUESTION="http://onto.fel.cvut.cz/ontologies/form/answered-question",se.HAS_VALIDATION_SEVERITY="http://onto.fel.cvut.cz/ontologies/form/has-validation-severity",se.RDFS_LABEL=c.RDFS_LABEL,se.RDFS_COMMENT=c.RDFS_COMMENT,se.DEFAULT_HAS_CHILD=c.DEFAULT_HAS_CHILD,se.BROADER="http://www.w3.org/2004/02/skos/core#broader",se.HAS_NON_SELECTABLE_VALUE="http://onto.fel.cvut.cz/ontologies/form/has-non-selectable-value",se.PROVIDES_DEREFERENCEABLE_ANSWER_VALUES="http://onto.fel.cvut.cz/ontologies/form/provides-dereferenceable-answer-values",se.ICONS={QUESTION_COMMENTS:"questionComments",QUESTION_HELP:"questionHelp",QUESTION_LINK:"questionLink"},se.ICON_BEHAVIOR={ENABLE:"enable",DISABLE:"disable",ON_HOVER:"onHover"},se.DEFAULT_OPTIONS={icons:[{id:ne.ICONS.QUESTION_HELP,behavior:ne.ICON_BEHAVIOR.ENABLE},{id:ne.ICONS.QUESTION_COMMENTS,behavior:ne.ICON_BEHAVIOR.ON_HOVER},{id:ne.ICONS.QUESTION_LINK,behavior:ne.ICON_BEHAVIOR.ON_HOVER}]},se.LANG={cs:{locale:"cs",label:"Čestina"},en:{locale:"en",label:"English"}},se.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 le=/*#__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[se.HAS_SUBQUESTION]);if(r)for(var s,l=te(a);!(s=l()).done;){var u=e.findQuestionById(t,s.value,!0,!1,!1);if(u)return u}if(i)for(var c,p=te(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}(),ue=/*#__PURE__*/function(){function e(){}return e.putObject=function(t,n){e.objectMap[t]=n},e.getObject=function(t){return e.objectMap[t]},e}();ue.objectMap={};var ce=/*#__PURE__*/function(){function e(){}return e.getFirstObject=function(e,t){var n=u.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"])))||u.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=p(),o={},r=function(){var r=e[i]["@id"];n.add(r),o[r]=e[i],le.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=c.getLocalized(t[c.RDFS_LABEL],e),r=c.getLocalized(n[c.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}(),pe=/*#__PURE__*/function(){function e(){}return e.isForm=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.FORM)},e.isWizardStep=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.WIZARD_STEP)},e.isSection=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.QUESTION_SECTION)},e.isAnswerable=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.ANSWERABLE)},e.isTypeahead=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.QUESTION_TYPEAHEAD)},e.getPossibleValuesQuery=function(e){return c.getJsonAttValue(e,se.HAS_OPTIONS_QUERY)},e.isDisabled=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.DISABLED)},e.isHidden=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.HIDDEN)},e.isTextarea=function(t,n){return n&&n.length>se.INPUT_LENGTH_THRESHOLD&&!e.isTypeahead(t)||c.hasValue(t,se.LAYOUT_CLASS,se.LAYOUT.TEXTAREA)},e.isText=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.TEXT)},e.isCalendar=function(t){return e.isDate(t)||e.isTime(t)||e.isDateTime(t)},e.isDate=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.DATE)},e.isTime=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.TIME)},e.isDateTime=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.DATETIME)},e.isCheckbox=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.CHECKBOX)},e.isMaskedInput=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.MASKED_INPUT)},e.isSparqlInput=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.SPARQL)},e.isTurtleInput=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.TURTLE)},e.isCollapsed=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.COLLAPSED)},e.isEmphasised=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.LAYOUT.EMPHASISED)},e.getCategory=function(e){return se.LAYOUT.CATEGORY.find(function(t){return c.hasValue(e,se.LAYOUT_CLASS,t)})},e.resolveValue=function(e){return e?e[se.HAS_OBJECT_VALUE]?e[se.HAS_OBJECT_VALUE]["@id"]:c.getJsonAttValue(e,se.HAS_DATA_VALUE):null},e.resolveValueObject=function(e){return e?e[se.HAS_OBJECT_VALUE]?le.asArray(e[se.HAS_OBJECT_VALUE])[0]:e[se.HAS_DATA_VALUE]?le.asArray(e[se.HAS_DATA_VALUE])[0]:null:null},e.isRelevant=function(t){if(!t[se.IS_RELEVANT_IF])return!0;for(var n,o=te(le.asArray(t[se.IS_RELEVANT_IF]));!(n=o()).done;)if(!e.testCondition(n.value))return!1;return!0},e.hasValidationLogic=function(e){return!!(e[se.REQUIRES_ANSWER]||e[se.REQUIRES_ANSWER_IF]||e[se.PATTERN]||this.containsXSDProperty(e))},e.isValid=function(e){if(!1===e[se.HAS_VALID_ANSWER])return!1;for(var t,n=te(le.asArray(e[se.HAS_SUBQUESTION]));!(t=n()).done;)if(!1===this.isValid(t.value))return!1;return!0},e.testOrCondition=function(e){var t=e[se.HAS_SUB_CONDITION];t||console.warn("Or condition does not have any sub-condition !");for(var n,o=te(this._getMappedObjectsArray(t));!(n=o()).done;)if(this.testCondition(n.value))return!0;return!1},e.testCondition=function(t){var n,o=t[se.ACCEPTS_VALIDATION_VALUE],r=t[se.ACCEPTS_ANSWER_VALUE],i=t[se.ACCEPTS],a=t[se.HAS_TESTED_QUESTION];if(t[se.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=le.asArray(i);if(1!==s.length&&console.warn("Support for multiple accepts values is not implemented !"),s[0]["@id"]===se.ANSWERED_QUESTION){(r||o)&&console.warn("Support for accepted answer/validations values is not implemented !");for(var l,c=te(this._getMappedObjectsArray(a));!(l=c()).done;)if(!this.hasAnswer(l.value))return!1;return!0}console.warn("No support to accept question of type "+s[0]["@id"]+" !")}if(o&&a){var p=le.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=te(le.asArray(a));!(m=d()).done;){if(void 0===(n=ue.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=ue.getObject(a["@id"]);for(var f,h=te(le.asArray(r));!(f=h()).done;){var E=f.value;if(!n)return console.warn("Question is not defined."),!0;if(!n.hasOwnProperty(se.HAS_ANSWER))return!1;var v=u.getValues(n,se.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(ce.compareValues(S,E))return!0}}return!1},e._getMappedObjectsArray=function(e,t){return le.asArray(e).map(function(e){var n=ue.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(se.HAS_ANSWER)){var n=u.getValues(t,se.HAS_ANSWER);if(n.length){var o=e.resolveValueObject(n[0]);if(o&&(o["@value"]||o["@id"]))return!0}}for(var r,i=te(le.asArray(t[se.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(se.HAS_ANSWER)){var n=u.getValues(t,se.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=te(le.asArray(t[se.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?se.DATETIME_NUMBER_FORMAT:i?t[se.DATE_FORMAT]||o.dateFormat:a?t[se.TIME_FORMAT]||o.timeFormat:s?t[se.DATETIME_FORMAT]||o.dateTimeFormat:null},e.dfsTraverseQuestionTree=function(e,t,n){function o(e){t(e),le.asArray(e[se.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[se.REQUIRES_ANSWER]&&!e[se.USED_ONLY_FOR_COMPLETENESS]?i=t+o+"required: "+e[se.REQUIRES_ANSWER]+"\n":e[se.USED_ONLY_FOR_COMPLETENESS]&&(i=t+o+"required only for completeness: "+e[se.USED_ONLY_FOR_COMPLETENESS]+"\n"),r+=t+e["http://www.w3.org/2000/01/rdf-schema#label"]+"\n",r+=e[se.HELP_DESCRIPTION]?t+o+"description: "+e[se.HELP_DESCRIPTION]+"\n":"",r+=i,r+=e[se.PATTERN]?t+o+"pattern: "+e[se.PATTERN]+"\n":"",r+=e[se.INPUT_MASK]?t+o+"mask: "+e[se.INPUT_MASK]+"\n":"",r+=e[se.XSD.MAX_INCLUSIVE]?t+o+"This field should be a number equal or lower to "+e[se.XSD.MAX_INCLUSIVE]+"\n":"",r+=e[se.XSD.MIN_INCLUSIVE]?t+o+"This field must be greater or equal to "+e[se.XSD.MIN_INCLUSIVE]+"\n":"",r+=e[se.HAS_VALIDATION_MESSAGE]?t+o+"validation-message: "+e[se.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(se.XSD);n<o.length;n++)if(t.includes(o[n]))return!0;return!1},e.getInputMask=function(e){if(e[se.INPUT_MASK])return e[se.INPUT_MASK]},e}(),me={},de=[],fe=/*#__PURE__*/e.createContext({}),he=function(r){var i=n(r.data||me),a=i[0],s=i[1],l=n(r.formQuestions||de),u=l[0],c=l[1];o(function(){if(r.isFormValid){var e=pe.isValid(a);r.isFormValid(e)}},[]),o(function(){s(r.data||me)},[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=pe.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(fe.Provider,K({value:h},r),r.children)};he.propTypes={children:l.element.isRequired,data:l.object.isRequired,formQuestions:l.array.isRequired,isFormValid:l.func};var Ee=/*#__PURE__*/function(t){function n(e){var n;return(n=t.call(this,e)||this).state={cursorPosition:0},n}J(n,t);var o=n.prototype;return o.focus=function(){m.findDOMNode(this.input).focus()},o.getInputDOMNode=function(){return m.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(d.Group,{size:"small",controlId:Math.floor(Math.random()*Number.MAX_SAFE_INTEGER)},/*#__PURE__*/e.createElement(d.Check,K({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(f,{size:"small"},/*#__PURE__*/e.createElement(d.Check,K({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(f,{size:"small"},this._renderLabel(),/*#__PURE__*/e.createElement(h,K({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(d.Label,null,this.props.label):null},o._renderTextArea=function(){var t=this;/*#__PURE__*/return e.createElement(f,{size:"small"},this._renderLabel(),/*#__PURE__*/e.createElement(h,K({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(f,{size:"small"},this._renderLabel(),/*#__PURE__*/e.createElement(h,K({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);Ee.propTypes={type:l.string,label:l.object,value:l.any,onChange:l.func,help:l.string,validation:l.object,placeholder:l.string},Ee.defaultProps={type:"text"};var ve=["children"],Se=/*#__PURE__*/e.createContext({}),Ae={components:{inputComponent:Ee},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}},ge=function(n){var o=n.children,r=$(n,ve),i=t(function(){return{inputComponent:r.components&&r.components.inputComponent||Ae.components.inputComponent,componentsOptions:Object.assign({},Ae.componentsOptions,r.componentsOptions),options:Object.assign({},Ae.options,r.options),mapComponent:r.mapComponent}},[r]);/*#__PURE__*/return e.createElement(Se.Provider,{value:i},o)};ge.propTypes={children:l.element.isRequired,components:l.object,mapComponent:l.func,options:l.object};var _e,Te,Ne={"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 "},Ie={"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 "},Oe=/*#__PURE__*/e.createContext({}),Ce=function(e){var t=e.locale,n=void 0===t?navigator.language:t,o=Ie;return n===se.LANG.cs.locale&&(o=Ne),M(Oe.Provider,{value:{locale:n,lang:o},children:M(U,{locale:n,messages:o,children:e.children})})},be={"@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":""}}]}]}]},Re=/*#__PURE__*/function(){function e(){}return e.generateForm=function(){return JSON.parse(JSON.stringify(be))},e}(),ye={root:(_e={},_e[se.HAS_LAYOUT_CLASS]=se.FORM,_e),expandProperties:[se.HAS_SUBQUESTION,se.IS_RELEVANT_IF,se.HAS_ANSWER,se.HAS_DECLARED_PREFIX,se.HAS_OPTION,se.HAS_COMMENT]},Le=/*#__PURE__*/function(){function e(){}return e.customFrame=function(e,t,n){if(arguments.length<2)return u.nextTick(function(){n(new TypeError("Could not frame, too few arguments."))});null===t&&(t=ye),u.flatten(e,null,null,function(e,t){})},e.expandStructure=function(e){var t,n={};e["@graph"].forEach(function(e){n[e["@id"]]=e,pe.isForm(e)&&(t=e)});try{this._expandGraph(t,ye,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]=le.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}();Te=Le,Le.compressStructure=function(e){var t=[],n=new Set;return(t=Te._compressGraph(e,t,n)).sort(function(e,t){return e["@id"]&&t["@id"]?e["@id"].localeCompare(t["@id"]):0})},Le._compressGraph=function(e,t,n){return n.has(e["@id"])||(t.push(e),n.add(e["@id"])),ye.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=Te._compressGraph(a,t,n),e[o][i]={"@id":a["@id"]})}}),t};var we=/*#__PURE__*/function(){function e(){}return e.constructDefaultForm=function(t){var n=Re.generateForm();return e._constructFormQuestions(n,t)},e.constructForm=function(t,n){try{var o,r;return Promise.resolve(u.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=Le.expandStructure(e),Object.keys(r).map(function(e){ue.putObject(e,r[e])})):console.warn("default form is constructed."),!(o=(n=e["@graph"].find(function(e){return pe.isForm(e)}))[se.HAS_SUBQUESTION]))throw oe.error("Could not find any questions in the received data."),"No questions in the form";return(i=o.filter(function(e){return!(!pe.isWizardStep(e)||pe.isHidden(e))||(oe.warn("Item is not a wizard step: "+e),!1)})).length||(oe.log("Could not find any wizard steps in the received data. Building form without steps"),n[se.HAS_SUBQUESTION].forEach(function(e){return i.push(e)})),i.sort(ce.getCompareLocalizedLabelFunction(t)),ce.orderPreservingToplogicalSort(i,se.HAS_PRECEDING_QUESTION),[i,{root:n}]},e}(),De=/*#__PURE__*/function(){function e(){}return e.buildQuestionAnswerModel=function(t,n){var o,r={subQuestions:[]};if(t&&(r.uri=t.root["@id"],r.origin=c.getJsonAttValue(t.root,se.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=c.getJsonAttValue(t,se.HAS_QUESTION_ORIGIN,"@id"),t[se.HAS_SUBQUESTION]){n.subQuestions=[];for(var o=0;o<t[se.HAS_SUBQUESTION].length;o++)n.subQuestions.push(e._processQuestion(t[se.HAS_SUBQUESTION][o]))}if(t[se.HAS_ANSWER]){n.answers=[],Array.isArray(t[se.HAS_ANSWER])||(t[se.HAS_ANSWER]=[t[se.HAS_ANSWER]]);for(var r=0;r<t[se.HAS_ANSWER].length;r++)n.answers.push(e.processAnswer(t[se.HAS_ANSWER][r]))}if(t[se.HAS_COMMENT]){n.comments=[],Array.isArray(t[se.HAS_COMMENT])||(t[se.HAS_COMMENT]=[t[se.HAS_COMMENT]]);for(var i=0;i<t[se.HAS_COMMENT].length;i++)n.comments.push(e.processComment(t[se.HAS_COMMENT][i]))}return n},e.processComment=function(e){var t={};return t.author=c.getJsonAttValue(e,se.HAS_AUTHOR,"@id"),t.value=c.getJsonAttValue(e,se.HAS_COMMENT_VALUE),t.timestamp=c.getJsonAttValue(e,se.HAS_TIMESTAMP,"@id"),t},e.processAnswer=function(e){var t={};return t.uri=e["@id"],t.origin=c.getJsonAttValue(e,se.HAS_ANSWER_ORIGIN,"@id"),e[se.HAS_OBJECT_VALUE]?t.codeValue=c.getJsonAttValue(e,se.HAS_OBJECT_VALUE,"@id"):t.textValue=c.getJsonAttValue(e,se.HAS_DATA_VALUE),t},e.generateAnswer=function(e){var t={};return t[se.HAS_DATA_VALUE]="",t},e}(),Ve=function(t){var n=r(Se);/*#__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||pe.isDisabled(t.question)})};Ve.propTypes={question:l.object.isRequired,label:l.object.isRequired,title:l.string,value:l.oneOfType([l.string,l.bool]),onChange:l.func.isRequired,mouseHover:l.bool,validation:l.object};var Me=function(t){var i=r(Se).componentsOptions,a=n(null),s=a[0],l=a[1];o(function(){if(t.value){var e=x(t.value,m,new Date);isNaN(e.getTime())?console.error("Invalid date value:",t.value):l(e)}else l(null)},[t.value,m]);var u=pe.resolveDateTimeFormat(t.question,t.value,i.dateTimeAnswer),c=pe.isDate(t.question),p=pe.isTime(t.question),m="x"===u?i.dateTimeAnswer.dateTimeFormat:u;/*#__PURE__*/return e.createElement(f,{size:"small"},/*#__PURE__*/e.createElement(d.Label,{className:"w-100"},t.label),/*#__PURE__*/e.createElement(P,{selected:s,placeholderText:m,onChange:function(e){l(e),e||t.onChange(""),t.onChange(u===se.DATETIME_NUMBER_FORMAT?Number(e):q(e,u))},showTimeSelect:!c,showTimeSelectOnly:p,timeFormat:"HH:mm",timeIntervals:1,timeCaption:"Time",dateFormat:m,className:F("form-control",t.validation.classname),disabled:i.readOnly||pe.isDisabled(t.question)}),t.validation.message)};Me.propTypes={question:l.object.isRequired,label:l.object.isRequired,title:l.string,value:l.oneOfType([l.string,l.number]),onChange:l.func.isRequired,validation:l.object};var He=[se.XSD.INT,se.XSD.INTEGER,se.XSD.NON_NEGATIVE_INTEGER,se.XSD.NON_POSITIVE_INTEGER,se.XSD.NEGATIVE_INTEGER,se.XSD.POSITIVE_INTEGER,se.XSD.FLOAT,se.XSD.POSITIVE_FLOAT,se.XSD.NEGATIVE_FLOAT],Ue={};Ue[se.XSD.NON_NEGATIVE_INTEGER]={min:0},Ue[se.XSD.NON_POSITIVE_INTEGER]={max:0},Ue[se.XSD.NEGATIVE_INTEGER]={max:-1},Ue[se.XSD.POSITIVE_INTEGER]={min:1};var je={"string-2":"prefixed",atom:"var"},Pe=/*#__PURE__*/function(){function e(){}return e._resolveInputType=function(t,n){return pe.isSparqlInput(t)||pe.isTurtleInput(t)||pe.isTextarea(t,n)?"textarea":e._isNumeric(t)?"number":"text"},e._isNumeric=function(e){for(var t=0,n=He.length;t<n;t++)if(c.hasValue(e,se.HAS_DATATYPE,He[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||pe.isDisabled(t),r},e._resolveStepRestriction=function(e){var t={};return void 0!==e[se.STEP]&&(t.step=c.getJsonAttValue(e,se.STEP)),t},e._resolveNumberRestrictions=function(e){var t={};return Object.getOwnPropertyNames(Ue).forEach(function(n){c.hasValue(e,se.HAS_DATATYPE,n)&&(t=Object.assign({},t,Ue[n]))}),void 0!==e[se.XSD.MIN_INCLUSIVE]&&(t.min=e[se.XSD.MIN_INCLUSIVE]),void 0!==e[se.XSD.MIN_EXCLUSIVE]&&(t.min=e[se.XSD.MIN_EXCLUSIVE]+1),void 0!==e[se.XSD.MAX_EXCLUSIVE]&&(t.max=e[se.XSD.MAX_EXCLUSIVE]-1),void 0!==e[se.XSD.MAX_INCLUSIVE]&&(t.max=e[se.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}(),xe=function(t){var n=r(Se),o=n.inputComponent,i=n.componentsOptions,a=t.question,s=t.answer,l=t.value;return s[se.HAS_OBJECT_VALUE]&&s[se.HAS_OBJECT_VALUE][c.RDFS_LABEL]&&(l=c.getJsonAttValue(s[se.HAS_OBJECT_VALUE],c.RDFS_LABEL)),/*#__PURE__*/e.createElement(o,Object.assign({},Pe.resolveInputProperties(a,l,i),{validation:t.validation,label:t.label,title:t.title,value:null==l?"":l,placeholder:pe.getInputMask(a),onKeyPress:function(e){return Pe._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=Q.fromTextArea(e.target);n.setValue(l),n.on("change",function(){t.onChange(n.getValue())}),Q.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"===je[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[se.HAS_DECLARED_PREFIX]&&t.question[se.HAS_DECLARED_PREFIX].filter(function(e){return e[se.PREFIX]===l.slice(0,-1)}).length){var u=t.question[se.HAS_DECLARED_PREFIX].filter(function(e){return e[se.PREFIX]===l.slice(0,-1)}),c={};c[u[0][se.PREFIX]]=u[0][se.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=Q.fromTextArea(e.target);o.setValue(l),o.on("change",function(){t.onChange(o.getValue())})}}}))};xe.propTypes={question:l.object.isRequired,answer:l.object.isRequired,label:l.object.isRequired,title:l.string,value:l.oneOfType([l.string,l.number]),onChange:l.func.isRequired,validation:l.object};var qe={D:"1",M:"1",Y:"1",h:"1",m:"1",s:"1"},Fe=/*#__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+=qe[t]?qe[t]:t;return n},e}(),Qe=["size","placeholder"];function ke(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 ze=/*#__PURE__*/function(t){function n(e){var n;return(n=t.call(this,e)||this)._updatePattern=function(e){n.mask.setPattern(Fe.mapMask(e.mask),{value:n.mask.getRawValue(),selection:ke(n.input)})},n._updateMaskSelection=function(){n.mask.selection=ke(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 k({pattern:Fe.mapMask(e.mask),value:e.value,formatCharacters:e.formatCharacters,placeholderChar:e.placeholderChar||"_"}),n}J(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(Fe.mapMask(this.props.mask),{value:this.props.value}):this.mask.setPattern(Fe.mapMask(this.props.mask),{value:this.mask.getRawValue()}):e.mask!==this.props.mask?this.mask.setPattern(Fe.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=$(n,Qe),a=this.mask.pattern.length;/*#__PURE__*/return e.createElement(this.context.inputComponent,Object.assign({},i,{ref:function(e){e&&(t.input=e.input?m.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);ze.contextType=Se,ze.propTypes={mask:l.string.isRequired},ze.defaultProps={value:""};var Be=function(t){var n=r(Se).componentsOptions,o=t.question,i=t.value,a=c.getJsonAttValue(o,se.INPUT_MASK);return a?/*#__PURE__*/e.createElement(ze,{mask:a,value:i,label:t.label,title:t.title,placeholder:a,onChange:function(e){return t.onChange(e.target.value)},disabled:n.readOnly||pe.isDisabled(o),validation:t.validation}):(oe.warn("Input mask not provided. Falling back to regular input."),/*#__PURE__*/e.createElement(xe,t))};Be.propTypes={question:l.object.isRequired,answer:l.object.isRequired,label:l.object.isRequired,title:l.string,value:l.oneOfType([l.string,l.number]),onChange:l.func.isRequired,validation:l.object};var We=/*#__PURE__*/function(t){function n(){return t.apply(this,arguments)||this}J(n,t);var o=n.prototype;return o._generateSelectOptions=function(t){var n=[];t.sort(function(e,t){var n=c.getJsonAttValue(e,se.RDFS_LABEL),o=c.getJsonAttValue(t,se.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:c.getJsonAttValue(t[o],se.RDFS_LABEL),key:"opt-"+o},c.getJsonAttValue(t[o],se.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||pe.isDisabled(n)},this._generateSelectOptions(n[se.HAS_OPTION]))},n}(e.Component);We.contextType=Se,We.propTypes={question:l.object.isRequired,label:l.object.isRequired,title:l.string,value:l.string,onChange:l.func.isRequired,validation:l.object};var Xe=function(e,t){return e&&e.length?(e.sort(ce.getCompareLocalizedLabelFunction(t)),ce.orderPreservingToplogicalSort(e,se.HAS_PRECEDING_VALUE),e):[]},Ge=function(t){var i=le.getStringHash(pe.getPossibleValuesQuery(t.question)),a=r(ie),s=r(Se),l=s.options.intl,u=n(!0),p=u[0],m=u[1],h=n([Xe(t.options,l)]),E=h[0],v=h[1];o(function(){var e=!1,n=t.question;return!n[se.HAS_OPTION]&&pe.getPossibleValuesQuery(n)?function(){try{var t=function(t,o){try{var r=Promise.resolve(a.loadFormOptions(i,pe.getPossibleValuesQuery(n))).then(function(t){e||(m(!1),g(t))})}catch(e){return o()}return r&&r.then?r.then(void 0,o):r}(0,function(){oe.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)}}():(m(!1),g(n[se.HAS_OPTION])),function(){e=!0}},[]);var S,A,g=function(e){if(!e)return[];for(var t,n={},o=[],r=te(e=Xe(e,l));!(t=r()).done;){var i=t.value,a=c.getLocalized(i[se.RDFS_LABEL],l),s=c.getLocalized(i[se.RDFS_COMMENT],l);n[i["@id"]]={id:i["@id"],value:i["@id"],label:a,description:s,children:[]};for(var u,p=te(le.asArray(i[se.BROADER]));!(u=p()).done;)o.push({type:"parent-child",parent:u.value["@id"],child:i["@id"]})}for(var m=0,d=o;m<d.length;m++){var f,h=d[m];"parent-child"===h.type&&(null==(f=n[h.parent])||f.children.push(h.child))}var E=Object.values(n);v(E)},_=le.findKeyInObjects(E,["name","value"]),T=le.findKeyInObjects(E,["name","label"]);/*#__PURE__*/return e.createElement(f,{size:"small"},/*#__PURE__*/e.createElement(d.Label,null,t.label),/*#__PURE__*/e.createElement(z,{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[se.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||pe.isDisabled(t.question),onChange:function(e){t.onChange(e?e.id:null)},titleKey:"description"}),t.validation.message)};Ge.propTypes={question:l.object.isRequired,answer:l.object.isRequired,label:l.oneOfType([l.string,l.object]).isRequired,title:l.string,value:l.string,onChange:l.func.isRequired,validation:l.object};var Ye=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"}))},Ke=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"}))},Je=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"}))},Ze=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"}))},$e=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(E,{overlay:t.show?/*#__PURE__*/e.createElement(v,{className:"tooltip-content",id:t.id},t.tooltipContent):/*#__PURE__*/e.createElement("span",null),placement:t.overlayPlacement||r},/*#__PURE__*/e.createElement("span",null,t.children)))};$e.propTypes={tooltipContent:l.oneOfType([l.object.isRequired,l.string.isRequired]),id:l.string.isRequired,overlayPlacement:l.string,absolutePosition:l.bool,show:l.bool},$e.defaultProps={iconClassContainer:"",iconClass:"",absolutePosition:!0,show:!0};var et=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($e,{id:"help-icon-tooltip-",overlayPlacement:t.overlayPlacement||o[0],absolutePosition:t.absolutePosition,tooltipContent:t.text},/*#__PURE__*/e.createElement(Ze,{className:t.iconClass})))};et.propTypes={text:l.string.isRequired,iconClassContainer:l.string,iconClass:l.string,overlayPlacement:l.string,absolutePosition:l.bool},et.defaultProps={iconClassContainer:"",iconClass:"",absolutePosition:!0};var tt=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"}))},nt=function(t){/*#__PURE__*/return e.createElement($e,{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(tt,{className:t.iconClass})))};nt.propTypes={url:l.oneOfType([l.string.isRequired,l.object.isRequired]),iconClassContainer:l.string,iconClass:l.string,overlayPlacement:l.string,absolutePosition:l.bool},nt.defaultProps={iconClassContainer:"",iconClass:"",absolutePosition:!0};var ot=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"}))},rt=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"}))))},it="Unknown author",at=function(t){var o=r(Se).options,i=n(!1),a=i[0],s=i[1],l=n(!1),u=l[0],c=l[1];B.addLocale(X),B.addLocale(W),B.setDefaultLocale(se.LANG.en.locale);var p,m=new B(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 it},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(nt,{iconClassContainer:"emphasise-on-relevant-icon",url:t.author?Object.values(t.author).toString():it})):d())),/*#__PURE__*/e.createElement("div",{className:"col-auto text-muted comment-timestamp"},/*#__PURE__*/e.createElement($e,{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(rt,null)):null),/*#__PURE__*/e.createElement("div",{className:"row"},/*#__PURE__*/e.createElement("div",{className:"col comment-value"},t.commentValue)))};at.propTypes={author:l.object,timestamp:l.string.isRequired,commentValue:l.string.isRequired,onDeleteQuestionComment:l.func.isRequired,onDeleteViewComment:l.func,index:l.number.isRequired};var st=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)]),M("span",{children:l?H("div",{className:"comment-delete",children:[M(Y,{color:"#00BFFF",height:80,width:80}),M("p",{children:"Deleting comment..."})]}):M("div",{className:"comment-list-items",ref:a,children:t.map(function(e,t){return M("div",{className:"comment-list-item",children:M(at,{commentValue:e[se.HAS_COMMENT_VALUE],author:e[se.HAS_AUTHOR]?e[se.HAS_AUTHOR]:null,timestamp:e[se.HAS_TIMESTAMP],onDeleteQuestionComment:r,onDeleteViewComment:c,index:t})},t)})})})},lt=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"}))},ut="300px",ct=function(t){var r=n(""),a=r[0],s=r[1],l=i(null),u=j();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",m(e)},m=function(e){e.style.height=e.scrollHeight+"px",parseInt(e.style.height)>parseInt(ut)&&(e.style.height=ut)};/*#__PURE__*/return e.createElement(d,{onSubmit:c,onKeyUp:function(e){"Enter"===e.key&&e.ctrlKey&&a.trim()&&c(e)},onClick:function(e){e.stopPropagation()}},/*#__PURE__*/e.createElement(d.Group,{className:"m-2",controlId:"formBasicComment"},/*#__PURE__*/e.createElement(S,{className:"col-lg-12 p-0"},/*#__PURE__*/e.createElement(A,{className:"container-fluid p-0 m-0"},/*#__PURE__*/e.createElement("div",{id:"comment-form"},/*#__PURE__*/e.createElement(d.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(g,{className:"comment-form-button",variant:"primary",type:"submit"},/*#__PURE__*/e.createElement(lt,null)))))))};ct.propTypes={onChange:l.func.isRequired};var pt,mt=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"}))},dt=function(t){var a=r(Se),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 E=function(){m(!1)},S=function(){var e=t.question;return e[se.HAS_COMMENT]||(e[se.HAS_COMMENT]=[]),Array.isArray(e[se.HAS_COMMENT])||(e[se.HAS_COMMENT]=[e[se.HAS_COMMENT]]),e[se.HAS_COMMENT]},A=function(e){var n={};g(n,e),t.onChange(O(),n)},g=function(e,t){a.options.currentUser&&(e[se.HAS_AUTHOR]={"@id":a.options.currentUser}),e[se.HAS_COMMENT_VALUE]=t,e[se.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(ot,null),O()>0?/*#__PURE__*/e.createElement(_,{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(T,{target:s.current,show:p,placement:f,rootClose:!1,onHide:E,container:l},function(t){/*#__PURE__*/return e.createElement(v,K({className:"comment-tooltip"},t),/*#__PURE__*/e.createElement("span",{onKeyDown:function(e){!function(e){"Escape"===e.key&&E()}(e)}},/*#__PURE__*/e.createElement(G.div,{className:"close-comment-icon",onClick:E,whileHover:{scale:1.1,transition:{duration:.1}}},/*#__PURE__*/e.createElement(mt,null)),/*#__PURE__*/e.createElement(st,{comments:S(),onDeleteCommentClick:N}),/*#__PURE__*/e.createElement(ct,{onChange:A})))})))};dt.propTypes={question:l.object.isRequired,onChange:l.func.isRequired};var ft=/*#__PURE__*/function(){function t(){}return t.renderIcons=function(t,n,o,r){var i;i=n.icons?n.icons:se.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===se.ICONS.QUESTION_COMMENTS&&a.push(/*#__PURE__*/e.createElement("li",{key:c,className:"icon-list-item"},l)),i[c].id===se.ICONS.QUESTION_HELP&&a.push(/*#__PURE__*/e.createElement("li",{key:c,className:"icon-list-item"},s)),i[c].id===se.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(se.ICONS.QUESTION_HELP,e,t,n,o)},t.renderQuestionLink=function(e,t,n,o){return this.getIconComponentFromName(se.ICONS.QUESTION_LINK,e,t,n,o)},t.getIconComponentFromName=function(e,t,n,o,r){var i=this.getIconFromIconList(n.icons?n.icons:se.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===se.ICON_BEHAVIOR.ON_HOVER||t.behavior===se.ICON_BEHAVIOR.ENABLE))return t.behavior===se.ICON_BEHAVIOR.ENABLE?(i=!0,a=""):a="emphasise-on-relevant-icon",t.id===se.ICONS.QUESTION_HELP&&n[se.HELP_DESCRIPTION]?i?/*#__PURE__*/e.createElement("div",{className:a},/*#__PURE__*/e.createElement(et,{text:c.getLocalized(n[se.HELP_DESCRIPTION],o.intl),absolutePosition:!1})):null:t.id===se.ICONS.QUESTION_LINK&&n[se.SOURCE]?i?/*#__PURE__*/e.createElement("div",{className:a},/*#__PURE__*/e.createElement(nt,{url:n[se.SOURCE]})):null:t.id===se.ICONS.QUESTION_COMMENTS&&i?/*#__PURE__*/e.createElement("div",{className:a},/*#__PURE__*/e.createElement(dt,{question:n,onChange:r})):null},t}();pt=ft,ft.renderQuestionComments=function(e,t,n,o){return pt.getIconComponentFromName(se.ICONS.QUESTION_COMMENTS,e,t,n,o)},ft.getIconFromIconList=function(e,t){return e?e.find(function(e){return e.id===t}):null};var ht=function(t){var r=e.useContext(ie),i=e.useContext(Se).options,a=n({severity:"",classname:"",message:null}),s=a[0],l=a[1];o(function(){f()},[t.question]);var u,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[se.HAS_OBJECT_VALUE]=null,e[se.HAS_DATA_VALUE]=null):t.answer[se.HAS_OBJECT_VALUE]||pe.isTypeahead(t.question)?e[se.HAS_OBJECT_VALUE]={"@id":n}:e[se.HAS_DATA_VALUE]={"@value":n}},f=function(){l({severity:"",classname:"",message:null}),!1===h[se.HAS_VALID_ANSWER]&&l(h[se.HAS_VALIDATION_SEVERITY]===se.VALIDATION.SEVERITY.WARNING?{severity:se.VALIDATION.SEVERITY.WARNING,classname:se.VALIDATION.CLASSNAME.WARNING,message:/*#__PURE__*/e.createElement(N,{className:se.VALIDATION.CLASSNAME.WARNING},h[se.HAS_VALIDATION_MESSAGE])}:{severity:se.VALIDATION.SEVERITY.ERROR,classname:se.VALIDATION.CLASSNAME.ERROR,message:/*#__PURE__*/e.createElement(N,{className:se.VALIDATION.CLASSNAME.ERROR},h[se.HAS_VALIDATION_MESSAGE])})},h=t.question,E=pe.resolveValue(t.answer),v=function(n){var o=c.getLocalized(n[se.RDFS_LABEL],i.intl);/*#__PURE__*/return e.createElement("div",{className:"question-header"},o,ft.renderIcons(t.question,i,t.onCommentChange,t.showIcon))}(h),S=c.getLocalized(h[se.RDFS_COMMENT],i.intl);return u=pe.isTypeahead(h)?function(n,o,i){var a=le.getStringHash(pe.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)[se.HAS_OPTION]&&0!==p[se.HAS_OPTION].length?function(n,o,r){/*#__PURE__*/return e.createElement(We,{question:t.question,label:o,title:r,value:n,onChange:m,validation:s})}(E,v,S):pe.isCalendar(h)?function(n,o,r){/*#__PURE__*/return e.createElement(Me,{question:t.question,value:n,title:r,label:o,onChange:m,validation:s})}(E,v,S):pe.isCheckbox(h)?function(n,o,r){/*#__PURE__*/return e.createElement(Ve,{label:o,title:r,value:n,onChange:m,question:t.question,validation:s})}(E,v,S):pe.isMaskedInput(h)?function(n,o,r){/*#__PURE__*/return e.createElement(Be,{label:o,title:r,value:n,onChange:m,question:t.question,answer:t.answer,validation:s})}(E,v,S):pe.isSparqlInput(h)?function(n,o,r){/*#__PURE__*/return e.createElement(xe,{question:t.question,answer:t.answer,label:o,title:r,value:n,onChange:m,sparql:!0,validation:s})}(E,v,S):pe.isTurtleInput(h)?function(n,o,r){/*#__PURE__*/return e.createElement(xe,{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(xe,{question:t.question,answer:t.answer,label:o,title:r,value:n,onChange:m,validation:s})}(E,v,S),u};ht.propTypes={answer:l.object.isRequired,question:l.object.isRequired,onChange:l.func.isRequired,onCommentChange:l.func.isRequired,index:l.number,icons:l.object};var Et=function(e,t){var n=[Nt,Tt,St,gt,At,_t];return function(){if(pe.hasValidationLogic(e,t)){var o=pe.getAnswerValue(e);return vt(e,t,o,n)}}},vt=function(e,t,n,o){for(var r,i={},a=te(o);!(r=a()).done;){var s=(0,r.value)(e,t);if(!s.isValid)return i[se.HAS_VALID_ANSWER]=!1,i[se.HAS_VALIDATION_MESSAGE]=s.message,i[se.HAS_VALIDATION_SEVERITY]=s.validationSeverity,i;if(!1===i[se.HAS_VALID_ANSWER])break}return i[se.HAS_VALID_ANSWER]=!0,i[se.HAS_VALIDATION_MESSAGE]="",i[se.HAS_VALIDATION_SEVERITY]="",i},St=function(e,t){var n=pe.getAnswerValue(e);return n&&n.length>0&&e[se.PATTERN]&&!new RegExp(e[se.PATTERN]).test(n)&&pe.hasAnswer(e)?{isValid:!1,validationSeverity:se.VALIDATION.SEVERITY.ERROR,message:e[se.HAS_VALIDATION_MESSAGE]?e[se.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.invalid"})}:{isValid:!0}},At=function(e,t){return!e[se.REQUIRES_ANSWER]||e[se.USED_ONLY_FOR_COMPLETENESS]||pe.hasAnswer(e)?{isValid:!0}:{isValid:!1,validationSeverity:se.VALIDATION.SEVERITY.ERROR,message:e[se.HAS_VALIDATION_MESSAGE]?e[se.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.required"})}},gt=function(e,t){return pe.isCheckbox(e)&&e[se.REQUIRES_ANSWER]&&!pe.hasAnswer(e)?{isValid:!1,validationSeverity:se.VALIDATION.SEVERITY.ERROR,message:e[se.HAS_VALIDATION_MESSAGE]?e[se.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.check"})}:{isValid:!0}},_t=function(e,t){return e[se.REQUIRES_ANSWER]&&e[se.USED_ONLY_FOR_COMPLETENESS]&&!pe.hasAnswer(e)?{isValid:!1,validationSeverity:se.VALIDATION.SEVERITY.WARNING,message:e[se.HAS_VALIDATION_MESSAGE]?e[se.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.required_only_for_completeness"})}:{isValid:!0}},Tt=function(e,t){if(e[se.XSD.MIN_INCLUSIVE]){var n=pe.getAnswerValue(e);if(n&&n.length>0){var o=e[se.XSD.MIN_INCLUSIVE];if(!(Number.isInteger(parseInt(n))&&n>=o))return{isValid:!1,validationSeverity:se.VALIDATION.SEVERITY.ERROR,message:e[se.HAS_VALIDATION_MESSAGE]?e[se.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.greater_or_equal"})+o+"."}}}return{isValid:!0}},Nt=function(e,t){var n=pe.getAnswerValue(e);if(e[se.XSD.MAX_INCLUSIVE]&&n&&n.length>0){var o=e[se.XSD.MAX_INCLUSIVE];if(!(Number.isInteger(parseInt(n))&&n<=o))return{isValid:!1,validationSeverity:se.VALIDATION.SEVERITY.ERROR,message:e[se.HAS_VALIDATION_MESSAGE]?e[se.HAS_VALIDATION_MESSAGE]:t.formatMessage({id:"validation.lower_or_equal"})+o+"."}}return{isValid:!0}},It=/*#__PURE__*/function(t){function n(e){var n;return(n=t.call(this,e)||this).state={prefixes:e.prefixes},n}return J(n,t),n.prototype.render=function(){var t=/*#__PURE__*/e.createElement(I,{id:"prefixes",title:"Prefixes"},/*#__PURE__*/e.createElement(O,null,this.state.prefixes.sort(function(e,t){return e[se.PREFIX]<t[se.PREFIX]?-1:1}).map(function(t){/*#__PURE__*/return e.createElement(C,{key:t[se.PREFIX]},/*#__PURE__*/e.createElement("strong",null,t[se.PREFIX]),": ",t[se.NAMESPACE])})));/*#__PURE__*/return e.createElement(E,{trigger:"click",placement:"right",overlay:t},/*#__PURE__*/e.createElement("span",{className:this.props.iconClass},this.props.children))},n}(e.Component);It.propTypes={prefixes:l.array.isRequired,children:l.element.isRequired,iconClass:l.string},It.defaultProps={iconClass:""};var Ot=function(e){var t;return(t=e.question[se.HAS_MEDIA_CONTENT])?Array.isArray(t)?M("div",{className:"col-6",children:t.map(function(e,n){return M("div",{className:"row embed-responsive-21by9 media-content-video-container mb-3",children:M("iframe",{src:t[n],className:"embed-responsive-item",allowFullScreen:!0})},n)})}):M("div",{className:"col-6",children:M("iframe",{src:t,className:"embed-responsive-item",allowFullScreen:!0})}):null},Ct=/*#__PURE__*/function(t){function n(e){var o;return(o=t.call(this,e)||this).handleAnswerChange=function(e,t){if(pe.isSection(o.props.question)){var n=!!pe.resolveValue(t);o.setState({expanded:n})}o._handleChange(se.HAS_ANSWER,e,t)},o.handleSubQuestionChange=function(e,t){o._handleChange(se.HAS_SUBQUESTION,e,t)},o.handleCommentChange=function(e,t){o._handleChange(se.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"),pe.isWizardStep(e)&&r.push("wizard-step bg-primary text-white"),pe.isEmphasised(e)&&r.push(n.getEmphasizedClass(e)),pe.isSection(e)&&r.push("section-background"),t&&r.push("cursor-pointer"),o.isDebugged(e)&&r.push("show-irrelevant"),r},ue.putObject(e.question["@id"],e.question),o.state={validator:{},expanded:!pe.isCollapsed(e.question),showIcon:!1},o}J(n,t);var o=n.prototype;return o.componentDidMount=function(){this.setState({validator:Et(this.props.question,this.props.intl)})},o.componentDidUpdate=function(){var e=this.props.question,t=this.context.options.startingQuestionId,n=e[se.HAS_SUBQUESTION].find(function(e){return e["@id"]===t});if(pe.isSection(e)&&pe.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===se.HAS_ANSWER){var r=this.state.validator(n);o=Object.assign({},o,r)}ue.putObject(o["@id"],o),this.props.onChange(this.props.index,o)},o.isDebugged=function(e){var t=this.context.options.startingQuestionId;return!pe.isRelevant(e)&&(!!this.context.options.debugMode||null!=t&&!!le.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):pe.isHidden(t)?null:pe.isRelevant(t)?n:null},o.renderQuestion=function(t){if(pe.isAnswerable(t)&&!pe.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(pe.isAnswerable(t))return this.renderAnswerableSection();if(pe.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=c.getLocalized(t[c.RDFS_LABEL],this.context.options.intl),l=/*#__PURE__*/e.createElement(b.Body,{className:F("p-3",a)},this._renderQuestionContent());/*#__PURE__*/return e.createElement(e.Fragment,null,/*#__PURE__*/e.createElement(R,{defaultActiveKey:this.state.expanded?void 0:s},/*#__PURE__*/e.createElement(b,{className:"mb-3"},/*#__PURE__*/e.createElement(R.Toggle,{as:b.Header,onClick:this._toggleCollapse,className:this._getHeaderClassName(),onMouseEnter:this._onMouseEnterHandler,onMouseLeave:this._onMouseLeaveHandler},/*#__PURE__*/e.createElement("h6",{className:"d-inline",id:t["@id"]},r&&!pe.isWizardStep(t)&&this._renderCollapseToggle(),s),this.renderQuestionIcons(),this.props.children),/*#__PURE__*/e.createElement(r?R.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(Ot,{key:this.props.question["@id"]+"-media",question:this.props.question})),t.push(this.renderAnswers()),t.push(this.renderSubQuestions()),t},o.renderQuestionIcons=function(){return ft.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(b.Body,{className:F("p-3",r)},this.renderSubQuestions(i));/*#__PURE__*/return e.createElement(R,{activeKey:this.state.expanded?t["@id"]:void 0,className:"answerable-section"},/*#__PURE__*/e.createElement(b,{className:"mb-3"},/*#__PURE__*/e.createElement(b.Header,{onClick:this._toggleCollapse,className:this._getHeaderClassName()},this.renderAnswers()),o?/*#__PURE__*/e.createElement(R.Collapse,{className:i,eventKey:t["@id"]},a):{cardBody:a}))},o.getShowIrrelevantClassname=function(e){return!this.context.options.debugMode&&!ce.checkId(e[se.HAS_SUBQUESTION],this.context.options.startingQuestionId)||pe.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++)pe.isTextarea(o,pe.resolveValue(i[a]))||pe.isSparqlInput(o)||pe.isTurtleInput(o),t=F("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(ht,{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[se.HAS_ANSWER]||(e[se.HAS_ANSWER]=[]),Array.isArray(e[se.HAS_ANSWER])||(e[se.HAS_ANSWER]=[e[se.HAS_ANSWER]]),0===e[se.HAS_ANSWER].length&&(e[se.HAS_ANSWER]=pe.isSection(e)&&!pe.isAnswerable(e)?[]:[De.generateAnswer(e)]),e[se.HAS_ANSWER]},o._getAnswerWidthStyle=function(){var e=Number(this.props.question[se.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===se.GENERATED_ROW_SIZE?"col-6":"col-"+se.COLUMN_COUNT/se.GENERATED_ROW_SIZE},n._getQuestionCategoryClass=function(e){var t=pe.getCategory(e);return t?"question-"+t:""},n.getEmphasizedClass=function(e){return pe.isEmphasised(e)?"bg-warning":""},n.getEmphasizedOnRelevantClass=function(e){return c.hasValue(e,se.LAYOUT_CLASS,se.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?Ye:Ke,{title:t}))},o._renderPrefixes=function(){var t=this.props.question;return t[se.HAS_DECLARED_PREFIX]&&t[se.HAS_DECLARED_PREFIX].length?/*#__PURE__*/e.createElement(It,{prefixes:t[se.HAS_DECLARED_PREFIX],iconClass:"help-icon-checkbox"},/*#__PURE__*/e.createElement(Je,null)):null},o._renderUnits=function(){var t=this.props.question;return t[se.HAS_UNIT]?/*#__PURE__*/e.createElement("div",{className:"has-unit-label"},t[se.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||le.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[se.HAS_SUBQUESTION]||(e[se.HAS_SUBQUESTION]=[]),Array.isArray(e[se.HAS_SUBQUESTION])||(e[se.HAS_SUBQUESTION]=[e[se.HAS_SUBQUESTION]]),ce.orderByLocalizedLabels(e[se.HAS_SUBQUESTION],this.context.options.intl),ce.orderPreservingToplogicalSort(e[se.HAS_SUBQUESTION],se.HAS_PRECEDING_QUESTION),e[se.HAS_SUBQUESTION]},o._getFirstAnswerValue=function(){return pe.resolveValue(this._getAnswers()[0])},n}(e.Component);Ct.contextType=Se,Ct.propTypes={question:l.object.isRequired,onChange:l.func.isRequired,index:l.number,withoutCard:l.bool,collapsible:l.bool},Ct.defaultProps={withoutCard:!1,collapsible:!0};var bt=function(t){var n=r(fe),o=n.updateFormQuestionsData,i=n.getFormQuestionsData,a=j(),s=i([t.index]);/*#__PURE__*/return e.createElement(e.Fragment,null,/*#__PURE__*/e.createElement(Ct,{question:s,onChange:function(e,n){o(t.index||e,Object.assign({},t.question,n))},collapsible:pe.isAnswerable(s),intl:a}),t.options.wizardStepButtons&&/*#__PURE__*/e.createElement(y,{className:"m-3 float-right"},!t.isFirstStep&&/*#__PURE__*/e.createElement(g,{className:"mr-2",onClick:function(){t.onPreviousStep()},variant:"primary",size:"sm"},a.formatMessage({id:"wizard.previous"})),!t.isLastStep&&/*#__PURE__*/e.createElement(g,{onClick:function(){o(t.index,i()),t.onNextStep()},variant:"primary",size:"sm"},a.formatMessage({id:"wizard.next"}))))};bt.propTypes={options:l.object.isRequired,question:l.object.isRequired,index:l.number.isRequired,onNextStep:l.func,onPreviousStep:l.func,mapComponent:l.func,isFirstStep:l.bool,isLastStep:l.bool};var Rt=function(t){var n=t.steps,o=t.onNavigate,i=t.currentStep,a=r(Se).options,s=j();/*#__PURE__*/return e.createElement(b.Header,null,/*#__PURE__*/e.createElement(L,{variant:"tabs",activeKey:i,onSelect:function(e){return o(parseInt(e))}},n.map(function(t,n){/*#__PURE__*/return e.createElement($e,{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(D,{eventKey:n,active:n===i?"active":"",hidden:!a.debugMode&&!pe.isRelevant(t),disabled:!a.enableWizardStepSkip,className:F([a.debugMode&&!pe.isRelevant(t)?"show-irrelevant":Ct.getEmphasizedClass(t),"wizard-nav"])},c.getLocalized(t[c.RDFS_LABEL],a.intl))))})))};Rt.propTypes={currentStep:l.number.isRequired,steps:l.array.isRequired,onNavigate:l.func.isRequired};var yt=function(t){var n=t.steps,o=t.onNavigate,i=t.currentStep,a=r(Se).options,s=j();/*#__PURE__*/return e.createElement("div",{className:"wizard-nav col-2 p-0"},/*#__PURE__*/e.createElement(O,null,n.map(function(t,n){/*#__PURE__*/return e.createElement($e,{id:"step-disabled",tooltipContent:s.formatMessage({id:"wizard.nav.tooltip"}),show:!a.enableWizardStepSkip},/*#__PURE__*/e.createElement(C,{hidden:!a.debugMode&&!pe.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:F([a.debugMode&&!pe.isRelevant(t)?"show-irrelevant":Ct.getEmphasizedClass(t),"wizard-nav"])},c.getLocalized(t[c.RDFS_LABEL],a.intl)))})))};yt.propTypes={currentStep:l.number.isRequired,steps:l.array.isRequired,onNavigate:l.func.isRequired};var Lt,wt=function(e,t){var n=function e(n,o){return n?n["@id"]===t?o:le.asArray(n[se.HAS_SUBQUESTION]).findIndex(function(t,n){return-1!==e(t,n)}):-1};return e.findIndex(function(e,t){return-1!==n(e,t)})},Dt=function(){var t=e.useContext(fe),n=e.useContext(Se),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?Rt:yt,{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(b,{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],bt),/*#__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}))))},Vt=/*#__PURE__*/e.forwardRef(function(t,n){var o=e.useContext(Se).options;/*#__PURE__*/return e.createElement(V,K({size:"xl",animation:!0},o.modalProps),/*#__PURE__*/e.createElement(V.Header,{closeButton:!0},/*#__PURE__*/e.createElement(V.Title,null,o.modalProps.title)),/*#__PURE__*/e.createElement(V.Body,{className:"overflow-hidden p-0"},t.children))});Vt.propTypes={children:l.element.isRequired};var Mt=function(){};Lt=Mt,Mt.updateQuestionValidation=function(e,t,n,o){if(t[se.HAS_ANSWER]){var r=Et(t,o)();r&&(e[n]=Object.assign({},t,r))}for(var i,a=te(e);!(i=a()).done;)Lt.updateSubQuestionsValidation(i.value,o)},Mt.updateSubQuestionsValidation=function(e,t){for(var n=le.asArray(e[se.HAS_SUBQUESTION]),o=0;o<n.length;o++)Lt.updateQuestionValidation(n,n[o],o,t)};var Ht=/*#__PURE__*/a(function(t,n){var o=r(fe),i=o.getFormQuestionsData,a=o.updateFormQuestionsData,l=o.getData,u=j();s(n,function(){return{validateForm:p,getFormSpecification:m,getFormQuestionsData:i,getFormData:c}},[]);var c=function(){var e=l(),t=i();return De.buildQuestionAnswerModel(e,t)},p=function(){for(var e=i(),t=0;t<e.length;t++)Mt.updateQuestionValidation(e,e[t],t,u);a(null,e)},m=function(){var e=i();return pe.getFormSpecification(e)},d=function(){var t=i();/*#__PURE__*/return e.createElement(b,{className:"p-3"},t.map(function(e,t){return f(e,t)}))},f=function(n,o){var r=t.mapComponent(n,Ct);/*#__PURE__*/return e.createElement(r,{key:n["@id"],question:n,onChange:function(e,t){return function(e,t,n){a(t,Object.assign({},e,n))}(n,e,t)},index:o,intl:u})},h=t.modalView,E=i();if(!E.length)/*#__PURE__*/return e.createElement(b,{className:"p-3 font-italic"},"There are no questions available...");var v=E.every(function(e){return!pe.isWizardStep(e)});return h?/*#__PURE__*/e.createElement(Vt,null,v?d():/*#__PURE__*/e.createElement(Dt,null)):v?d():/*#__PURE__*/e.createElement(Dt,null)}),Ut=/*#__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 pe.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(b,{className:"p-3 font-italic"},"Loading SForms...");var f=function(e,t){return function(n,o){if(!e)return o;for(var r,i=te(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(ge,{components:t.components,componentsOptions:t.componentsOptions,mapComponent:f,options:t.options},/*#__PURE__*/e.createElement(Ce,{locale:t.options.intl.locale},/*#__PURE__*/e.createElement(ae,{fetchTypeAheadValues:t.fetchTypeAheadValues},/*#__PURE__*/e.createElement(he,{data:m,formQuestions:u.formQuestions,isFormValid:t.isFormValid},/*#__PURE__*/e.createElement(Ht,{ref:r,modalView:t.options&&t.options.modalView,mapComponent:f})))))});Ut.propTypes={form:l.object.isRequired,options:l.object.isRequired,componentMapRules:l.array,components:l.object,componentsOptions:l.object,fetchTypeAheadValues:l.func,isFormValid:l.func,loader:l.element};export{ht as Answer,Se as ConfigurationContext,se as Constants,fe as FormQuestionsContext,pe as FormUtils,et as HelpIcon,Ce as IntlContextProvider,Le as JsonLdFramingUtils,ue as JsonLdObjectMap,ce as JsonLdObjectUtils,Ct as Question,ft as QuestionStatic,bt as WizardStep,Ut as default};
2
2
  //# sourceMappingURL=s-forms.js.map